1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179
|
/**
* @author Mark Larkin, Conway Institute, UCD. mark.larkin@ucd.ie
*
* Changes:
*
* 16-01-07,Nigel Brown(EMBL): added drawContents() called by paintEvent().
*
* 20-02-07,Nigel Brown(EMBL): constructor and changeBoxSizeAndFontSize()
* parameters reordered.
*
* 12-4-07, Mark Larkin, Removed destructor. No need to delete QObjects.
*
* 25-04-07,Nigel Brown(EMBL): Removed keyPressEvent(), keyReleaseEvent(),
* shiftPressed. Keyboard events handled by KeyController singleton. Fixed
* problem in shift-selection of columns which did not extend selection
* backwards by replacing with new procedure selectColumns().
*
* 04-05-07,Nigel Brown(EMBL): moved getFirstSelectedCol() and
* getSecondSelectedCol() into AlignmentWidget.cpp.
*
* 09-05-07,Nigel Brown(EMBL): Added 'mousePressed', mouseMoveEvent()
* and mouseReleaseEvent(); Changed 'rowSelected' to 'firstRow' and
* added 'secondRow' store row range information.
*
* 09-05-07,Nigel Brown(EMBL): Added 'scrollArea' and registerScrollArea()
* allowing the instance to know its own containing QScrollArea (This is not
* the same as parentWidget()).
****************************************************************************/
#ifndef ALIGNMENTWIDGET_H
#define ALIGNMENTWIDGET_H
#include <QFont>
#include <QPoint>
#include <QSize>
#include <QString>
#include <QWidget>
#include <QVector>
#include <vector>
#include <string>
#include "clustalW/alignment/Alignment.h"
#include "ColorParameters.h"
#include <QKeyEvent>
#include <QPixmap>
class QMouseEvent;
class QPaintEvent;
class QMessageBox;
class QKeyEvent;
class QScrollArea; //- nige
/**
* The AlignmentWidget is used to display a multiple alignment. It takes sequences
* in the form of QString objects. The conservation information is displayed,
* if it is available.
*/
class AlignmentWidget : public QWidget
{
Q_OBJECT
public:
AlignmentWidget(int boxWidth, int boxSize, QFont* font, QWidget *parent = 0);
QSize sizeHint() const;
void changeBoxSizeAndFontSize(int _boxWidth, int _boxSize, QFont* fontPtr);
void updateSizeHint();
void setAlignment(const clustalw::SeqArray* align,
clustalw::Alignment* _alignObjPtr);
void updateDisplay(int firstSeq, int lastSeq, clustalw::Array2D<int>* exRes, int nhead,
QString secStruct);
void updateLowScoreSeg();
void showExceptionalResidues(bool show);
bool getShowExceptionalResidues(){return showExceptionalRes;}
void showLowScoreSeg(bool show, clustalw::Array2D<int>* _lowScoreRes);
bool getShowLowScoreSeg(){return showLowScoreRes;}
void setColorScheme(ColorParameters* colors);
void setPrintoutColorScheme(ColorParameters colors);
void setBlackAndWhite();
void setBackGroundColoring(bool backgroundColor);
bool getBackGroundColor(){return backGroundColor;}
void clearRangeSelection();
QString getConservationInfo(){return QString(conservationInfo.c_str());}
QString getSecStructInfo(){return secStructInfo;}
clustalw::Array2D<QColor> getPrintoutColorMask();
ColorParameters* getPtrToCurrentColorScheme(){return currentColorScheme;}
int getFirstSelectedCol();
int getSecondSelectedCol();
void registerScrollArea(QScrollArea *s) { scrollArea = s; }; //- nige
public slots:
signals:
void characterSelected(const QString &character);
protected:
void mousePressEvent(QMouseEvent *event);
void mouseMoveEvent(QMouseEvent *event);
void mouseReleaseEvent(QMouseEvent *event);
void paintEvent(QPaintEvent *event);
void selectColumns(int column); //nige
void drawContents(QPainter *p, int cx, int cy, int cw, int ch); //nige
private:
char getAminoAcidCode(int i);
void setUpWeakAndStrongGroups();
void calcConserveInfo();
void calculatePixMaps();
void makeColorMask(clustalw::Array2D<QColor>* colMask,
ColorParameters* colorScheme);
void makeColorMask(clustalw::Array2D<int>* colMask,
ColorParameters* colorScheme);
void generatePixMaps();
void generateSecStructurePixmaps();
QString initConsensus();
int getExtraRowNum();
int firstSeq, lastSeq;
QFont displayFont;
int firstColumnSelected;
int secondColumn;
int boxSize;
int boxWidth;
int pixelsize;
int alignLength;
int numSequencesSoFar;
int offSetFromTop;
int displayStartPos;
QPixmap defaultPixMap;
QPixmap defaultGreyPixMap;
QString conserveInfo;
QColor *selectedColor; // This will stay here!!!!! Others will go!!!
QColor *lightGrey;
QColor *slateGrey;
QColor *backGroundGrey;
bool conserveDisplay;
bool mousePressed;
const clustalw::SeqArray* alignment;
clustalw::Alignment* alignObjPtr;
bool alignmentSet;
bool showAlignment;
std::vector<std::string> strongGroup;
std::vector<std::string> weakGroup;
std::string conservationInfo;
clustalw::Array2D<int>* exceptionalRes;
bool exResLoaded;
bool showExceptionalRes;
std::string conservationChars;
bool lowScoreResLoaded;
bool showLowScoreRes;
int colorScheme;
clustalw::Array2D<int>* lowScoreRes;
clustalw::Array2D<QPixmap*>* colorAlignment;
clustalw::Array2D<QColor> colorMask;
clustalw::Array2D<int> colMask;
QColor defaultColor;
clustalw::Array2D<QPixmap> coloredLetters;
std::vector<QPixmap>* selectedColoredRes;
std::vector<QPixmap>* lowScoreColoredRes;
std::vector<QPixmap>* exceptionalColoredRes;
std::vector<QPixmap>* conservationPixmaps;
std::vector<QPixmap>* secStructPixmaps;
// Color scheme stuff!!!
ColorParameters* currentColorScheme;
ColorParameters printoutColorScheme;
bool blackAndWhite;
bool backGroundColor;
int secStruct;
QString secStructInfo;
int defaultIndex;
QScrollArea *scrollArea; //-nige
};
#endif
|