/***************************************************************************** # Copyright (C) 1994-2008 by David Gordon. # All rights reserved. # # This software is part of a beta-test version of the Consed/Autofinish # package. It should not be redistributed or # used for any commercial purpose, including commercially funded # sequencing, without written permission from the author and the # University of Washington. # # This software is provided ``AS IS'' and any express or implied # warranties, including, but not limited to, the implied warranties of # merchantability and fitness for a particular purpose, are disclaimed. # In no event shall the authors or the University of Washington be # liable for any direct, indirect, incidental, special, exemplary, or # consequential damages (including, but not limited to, procurement of # substitute goods or services; loss of use, data, or profits; or # business interruption) however caused and on any theory of liability, # whether in contract, strict liability, or tort (including negligence # or otherwise) arising in any way out of the use of this software, even # if advised of the possibility of such damage. # # Building Consed from source is error prone and not simple which is # why I provide executables. Due to time limitations I cannot # provide any assistance in building Consed. Even if you do not # modify the source, you may introduce errors due to using a # different version of the compiler, a different version of motif, # different versions of other libraries than I used, etc. For this # reason, if you discover Consed bugs, I can only offer help with # those bugs if you first reproduce those bugs with an executable # provided by me--not an executable you have built. # # Modifying Consed is also difficult. Although Consed is modular, # some modules are used by many other modules. Thus making a change # in one place can have unforeseen effects on many other features. # It may takes months for you to notice these other side-effects # which may not seen connected at all. It is not feasable for me to # provide help with modifying Consed sources because of the # potentially huge amount of time involved. # #*****************************************************************************/ // // colormode.h // // ColorMode objects are used to determine how the editor object // makes its decision to draw fragments and contigs in one color // scheme rather than another. They are NOT to be confused with // GuiColorText objects, which are a wrapper to the gui dependent // calls and structures required to draw in a specific font and // color. // // The abstract base class ColorMode has a virtual function that // accepts as arguments what information it will need about // the contig to make a decision, and returns a pointer to // the appropriate GuiColorText object. // // A typical color mode would be one that used one color (GuiColorText) // to draw bases in fragments that were of high quality and // another to draw those of low quality. a pointer is stored as a // private data member of the editor object to the current mode. // this eliminates the need to edit a switch statement within the // draw routines when adding another mode. Similarly, when the // user requests (via pulldown menu) that the editor use different // colors (for example) for annotated vs. non-annotated sequence, // this requires only changing the editors (private member) pointer // to another ColorMode derived subclass, one that checks an annotation // list rather than comparing the base to the consensus. // // to change or add a color-representation behavior in the editor, // modify the appropriate derived class or add a new one in // this module. note that while GuiColorText objects effectively hide // the gui dependent details of drawing in a particular color // or font, the ColorMode is intimately aware of the editor's // data structures. // // gordon Dec-94 // #ifndef COLORMODE_INCLUDED #define COLORMODE_INCLUDED #ifdef SCCS_ID static const char* colorModeSccsId = "@(#)colormode.h 1.20 12/31/96 04:00:20"; #endif #include "ntide.h" #include "locatedFragment.h" #include "contig.h" #include "guicolortext.h" // // pure virtual base class // class ColorMode { public: virtual GuiColorText* pGuiColorTextGet(LocatedFragment *plocfrag, const int nConsensusPosition) = 0; virtual GuiColorText* pGuiColorTextGetForeground( LocatedFragment *pLocFrag, const int nConsPos ) = 0; GuiColorText* pGuiColorTextCursorGet(); ColorMode(); protected: GuiColorText *pColorEditCursor_; }; // // this derived class will draw fragment bases that match // the consensus in (passed) one color and those that // do not match in another. these colors are initialized // in the ColorMeansMatch ctor from application defaults // which are obtained from the MotifApp object. // class ColorMeansMatch : public ColorMode { public: ColorMeansMatch(); const char* szDescription() const { return "Color indicates whether fragment base matches consensus."; } virtual GuiColorText* pGuiColorTextGet(LocatedFragment *plocfrag, const int nConsensusPosition ); // at present, there is no need for this since there is no // color mode ColorMeansMatchAndTags virtual GuiColorText* pGuiColorTextGetForeground( LocatedFragment *pLocFrag, const int nConsPos ) { return NULL; } private: GuiColorText *pColorSame_; GuiColorText *pColorDifferent_; GuiColorText *pColorConsensus_; GuiColorText *pColorLowQualConsensus_; //allow other colormodes to use pColorLowQualEnds_ public: GuiColorText *pColorDimLowQualityEnds_; }; // // this derived class will draw fragment bases in a color // that reflects their quality // class ColorMeansQuality : public ColorMode { public: ColorMeansQuality( ); const char* szDescription() const { return "Color indicates what the quality of the base is."; } virtual GuiColorText* pGuiColorTextGet(LocatedFragment *plocfrag, const int nConsensusPosition ); // for compareContigs GuiColorText* pGuiColorTextGetBackgroundAgree( const int nQuality ); virtual GuiColorText* pGuiColorTextGetForeground(LocatedFragment *plocfrag, const int nConsPos ); GuiColorText* pGetGuiColorTextForConsensus( Contig* pContig, int nConsPos ); public: GuiColorText *pColorDisagree0_4_; GuiColorText *pColorDisagree5_9_; GuiColorText *pColorDisagree10_14_; GuiColorText *pColorDisagree15_19_; GuiColorText *pColorDisagree20_24_; GuiColorText *pColorDisagree25_29_; GuiColorText *pColorDisagree30_34_; GuiColorText *pColorDisagree35_39_; GuiColorText *pColorDisagree40_97_; GuiColorText *pColor0_4_; GuiColorText *pColor5_9_; GuiColorText *pColor10_14_; GuiColorText *pColor15_19_; GuiColorText *pColor20_24_; GuiColorText *pColor25_29_; GuiColorText *pColor30_34_; GuiColorText *pColor35_39_; GuiColorText *pColor40_97_; GuiColorText *pColorDisagree98_; // edited GuiColorText *pColorDisagree99_; // edited GuiColorText *pColor98_; // edited GuiColorText *pColor99_; // edited GuiColorText *pColorConsensus0_4_; GuiColorText *pColorConsensus5_9_; GuiColorText *pColorConsensus10_14_; GuiColorText *pColorConsensus15_19_; GuiColorText *pColorConsensus20_24_; GuiColorText *pColorConsensus25_29_; GuiColorText *pColorConsensus30_34_; GuiColorText *pColorConsensus35_39_; GuiColorText *pColorConsensus40_97_; GuiColorText *pColorConsensus98_; // edited low quality public: GuiColorText *pColorConsensus99_; // edited high quality }; // // this derived class will draw fragment bases in a color // that reflects their quality // class ColorMeansEdited : public ColorMode { public: ColorMeansEdited( ); const char* szDescription() const { return "Color indicates whether a base has been edited low quality, edited high quality, or not edited."; } virtual GuiColorText* pGuiColorTextGet( LocatedFragment *pLocFrag, const int nConsensusPosition ); virtual GuiColorText* pGuiColorTextGetForeground( LocatedFragment *pLocFrag, const int nConsPos ); private: GuiColorText *pColorDisagreeUnedited_; GuiColorText *pColorDisagree98_; GuiColorText *pColorDisagree99_; GuiColorText *pColorAgreeUnedited_; GuiColorText *pColorAgree98_; GuiColorText *pColorAgree99_; }; class ColorMeansQualityAndTags : public ColorMeansQuality { public: ColorMeansQualityAndTags( ) : ColorMeansQuality( ) {} const char* szDescription() const { return "Color indicates quality or which bases have tags on them"; } }; class ColorMeansEditedAndTags : public ColorMeansEdited { public: ColorMeansEditedAndTags( ) : ColorMeansEdited( ) {} }; #endif // COLORMODE_INCLUDED