/***************************************************************************** # 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. # #*****************************************************************************/ #ifndef guiDisplayDigest_included #define guiDisplayDigest_included #include #include "rwcstring.h" #include "rwtptrorderedvector.h" #include "rwtvalorderedvector.h" #include "restrictionFragment.h" #include "guiapp.h" #include "visibleLineForRestrictionFragments.h" // the #include "visibleLine... // is required by the hp compiler that otherwise gives: // CC: "rwtvalorderedvector.h", line 23: error: new visibleLineForRestrictionFragments; visibleLineForRestrictionFragments is undefined (1249) // "rwtvalorderedvector.h", line 23: error detected during the instantiation of RWTValOrderedVector // "guiDisplayDigest.h", line 20: is the site of the instantiation class guiFindRestrictionEnzymeSites; class digestForOneEnzyme; class GuiColorText; class arrayOfRestrictionFragments; // class visibleLineForRestrictionFragments; class guiDisplayDigest { public: RWTPtrOrderedVector aDigests_; digestForOneEnzyme* pCurrentlyDisplayedDigest_; Widget widPopupShell_; Widget widGelWindow_; Widget widTextSelectionBox_; Widget widTextList_; Widget widGelScrollBar_; Widget widGelScrollingWindow_; Widget widForm_; Widget widEnzymeOptionsMenu_; Widget widDismiss_; Widget widGotoLeft_; Widget widGotoRight_; Widget widShowTextOutput_; Widget widCurrentlyDisplayedEnzymeBases_; Widget widZoomIn_; Widget widZoomOut_; Widget widZoomOriginal_; Widget widShowProblems_; Widget widContigMap_; Widget widSortByPosition_; Widget widComplVector_; RWCString soTextMessage_; int nMinGelPosition_; int nGelPositionAtTopOfGelWindow_; bool bWindowVisible_; RWCString soVectorSequence_; RWCString soComplementedVectorSequence_; RWTValOrderedVector aEnzymeWidgets_; RWTValOrderedVector aSelectedEnzymeNames_; RWTValOrderedVector aSelectedEnzymeBases_; float fPixelsPerGelUnit_; // int nBasesPerScaleTick_; float fGelUnitsPerScaleTick_; RWTValOrderedVector aVisibleLinesForPredictedFragments_; RWTValOrderedVector aVisibleLinesForActualFragments_; restrictionFragment* pTempMarkedActualRestrictionFragment_; restrictionFragment* pTempMarkedPredictedRestrictionFragment_; restrictionFragment* pPermMarkedActualRestrictionFragment_; restrictionFragment* pPermMarkedPredictedRestrictionFragment_; bool bUseUserDefinedContigMap_; RWCString soUserEnteredContigMap_; int nStartUnpaddedConsPos_; int nEndUnpaddedConsPos_; bool bFlipVectorFromTheDefault_; public: guiDisplayDigest(); void createWindow( const RWTValOrderedVector& aSelectedEnzymeNames, const RWTValOrderedVector& aSelectedEnzymeBases, const bool bUseUserDefinedContigMap, const RWCString soUserEnteredContigMap, const int nStartUnpaddedConsPos, const int nEndUnpaddedConsPos ); ~guiDisplayDigest(); bool operator==( const guiDisplayDigest& gui) const { return( this == &gui ); } void doSearch(); void getVectorFragments( RWTPtrOrderedVector& aIndexedByEnzymeBases, RWTPtrOrderedVector& aRestrictionFragments, RWTPtrOrderedVector& aRestrictionFragmentsEndingAtAVectorInsertJunction, int& nPositionOrderOfFragment, bool& bNoCutSitesInVector ); void updateDisplays(); bool bFragmentsAreSortedBySize(); void drawTempVisibleLines(); void drawPermVisibleLines(); void drawVisibleLine( const unsigned char cActualOrPredicted, const bool bPermNotTemp ); void drawLineForPredictedFragment( visibleLineForRestrictionFragments* pVis ); void drawLineForActualFragment( visibleLineForRestrictionFragments* pVis ); // void drawActualRestrictionFragment( restrictionFragment* pActualFrag ); void displayGelWindow(); void gelScrollBarMoved( const int nNewScrollBarPosition ); void adjustScrollBarWhenZoom(); void clearGelWindow(); void updateTextDisplay(); void gotoEnd( const int nWhichEnd ); void userChangedEnzyme( Widget wid ); void changeCurrentlyDisplayedDigest( digestForOneEnzyme* pNewDigest ); enum { nLeftEnd = 10, nFragmentWidth = 50, nSpaceBetweenActualFragmentSizeAndScaleNumber1 = 10, nMaxDigitsFragmentSize = 10, nArrowWidth = 10, nHalfWidthOfGelScaleTick = 6, nSpaceBetweenScaleTickAndScaleNumber2 = 1, nSpaceBetweenActualFragmentSizeAndLeftArrow = 5, nSpaceBetweenActualAndPredictedFragments = 1, nSpaceBetweenPredictedFragmentArrowAndFragmentSize = 3 }; int nGetTitleBaseline() { return( GuiApp::nGetFontAscent() + 5 ); } int nGetLeftEndOfActualFragmentSizeOnGel() { return( nLeftEnd ); } int nGetRightEndOfActualFragmentSizeOnGel() { return( nLeftEnd + nMaxDigitsFragmentSize * GuiApp::nGetFontWidth() ); }; int nGetLeftEndOfLeftArrowForActualFragment() { return( nGetRightEndOfActualFragmentSizeOnGel() + nSpaceBetweenActualFragmentSizeAndLeftArrow ); } int nGetRightEndOfLeftArrowForActualFragment() { return( nGetLeftEndOfLeftArrowForActualFragment() + nArrowWidth ); } int nGetActualFragmentLeftEndOnGel() { return( nGetRightEndOfLeftArrowForActualFragment() ); } int nGetActualFragmentRightEndOnGel() { return( nGetActualFragmentLeftEndOnGel() + nFragmentWidth ); } // the +1 is so that, if the space is 0, the fragments do not // overlap int nGetPredictedFragmentLeftEndOnGel() { return( nGetActualFragmentRightEndOnGel() + nSpaceBetweenActualAndPredictedFragments + 1 ); } int nGetPredictedFragmentRightEndOnGel() { return( nGetPredictedFragmentLeftEndOnGel() + nFragmentWidth ); } int nGetLeftEndOfRightArrowForPredictedFragment() { return( nGetPredictedFragmentRightEndOnGel() ); } int nGetRightEndOfRightArrowForPredictedFragment() { return( nGetLeftEndOfRightArrowForPredictedFragment() + nArrowWidth ); } int nGetLeftEndOfPredictedFragmentSizeOnGel() { return( nGetRightEndOfRightArrowForPredictedFragment() + 1 + nSpaceBetweenPredictedFragmentArrowAndFragmentSize ); } int nGetRightEndOfPredictedFragmentSizeOnGel() { return( nGetLeftEndOfPredictedFragmentSizeOnGel() + nMaxDigitsFragmentSize * GuiApp::nGetFontWidth() ); } int nGetGelScaleCenter() { return( nGetRightEndOfPredictedFragmentSizeOnGel() + nSpaceBetweenActualFragmentSizeAndScaleNumber1 ); } int nGetRightEndGelScaleTick() { return( nGetGelScaleCenter() + nHalfWidthOfGelScaleTick ); } int nGetLeftEndScaleNumber2() { return( nGetRightEndGelScaleTick() + nSpaceBetweenScaleTickAndScaleNumber2 ); } int nGetPixelYFromGelPosition( const float fGelPosition ) { return( (int) ( ( fGelPosition - (float) nGelPositionAtTopOfGelWindow_ ) * fPixelsPerGelUnit_ ) ); } // reverse of above float fGetGelPositionFromPixelY( const int nPixelY ) { return( (float) nPixelY / fPixelsPerGelUnit_ + nGelPositionAtTopOfGelWindow_ ); } int nGetPixelYFromRestrictionFragmentSize( const int nFragmentSize ); // reverse of above bool bCouldGetFragmentSizeFromPixelY( const int nPixelY, int& nFragSize ); void drawPredictedRestrictionFragment( restrictionFragment* pRes ); GuiColorText* pGetGuiColorTextForFragment( restrictionFragment* pRes ); void userPushedZoomInOrOut( Widget wid ); int nGetGelWindowPixelHeight(); void setScrollBar(); void drawGelWindowScale(); void drawScaleLine(); void drawScaleTickForFragmentSize( const int nBases ); void drawScaleTickForFragmentPosition( const int nGelPosition ); bool bCouldGetBottomScaleTickFragmentSize( int& nPowerOfTen, int& nMultipleOfPowerOfTen, int& nPixelOfBottomScaleTick ); bool bCouldGetNextFragmentSizeScaleTick( int& nPowerOfTenOfPreviousScaleTick, int& nMultipleOfPreviousScaleTick, int& nPixelOfPreviousScaleTick ); bool bAbleToCalculateBasesPerScaleTick(); void calculateGelUnitsPerScaleTick(); int nGetGelPositionAtBottomOfGelWindow(); inline int nGetGelPositionAtTopOfGelWindow() { return( nGelPositionAtTopOfGelWindow_ ); } void calculateInitialZoomFactor(); void expandVisibleLines(); void expandVisibleLines2( RWTValOrderedVector* pVisibleLineArray ); void pointerMoved( const int nPixelX, const int nPixelY ); void clearTempVisibleLines(); void clearPermVisibleLines(); void clearLineIndicator( const unsigned char cActualOrPredicted, const bool bPermNotTemp ); void clearLineIndicator2( unsigned char cActualOrPredicted, const int nPixelYOfLine ); void getFragmentsAtPosition( const int nPointerPixelX, const int nPointerPixelY, restrictionFragment*& pNewActualVisibleLine, restrictionFragment*& pNewPredictedVisibleLine ); visibleLineForRestrictionFragments* pGetVisibleLineFromRestrictionFragment( restrictionFragment* pResFrag ); visibleLineForRestrictionFragments* pGetVisibleLineForPredictedRestrictionFragments( const int nPointerPixelY ); visibleLineForRestrictionFragments* pGetVisibleLineForActualRestrictionFragments( const int nPointerPixelY ); visibleLineForRestrictionFragments* pGetVisibleLineForRestrictionFragments2( const int nPointerPixelY, RWTValOrderedVector* pVisibleLineArray ); void userClicked( XtPointer pCallData ); void drawCurrentNumber(); void clearCurrentNumber(); void drawTitles(); void createProblemList( RWTPtrOrderedVector* pProblemList ); void userPushedShowProblems(); void highlightFragment( restrictionFragment* pResFrag ); void highlightTextWindowLineForPredictedFragment( restrictionFragment* pResFragClickedOn ); void highlightContigMapForFragment( restrictionFragment* pResFrag ); void scrollGel( const float fPositionOnGel ); int nGetMaxGelPosition(); int nGetMinGelPosition() { return( nMinGelPosition_ ); } void setMinGelPosition(); void zoomInForNavigate(); void showTextOutput(); void sortChanged(); arrayOfRestrictionFragments* pGetPredictedFragmentsArray(); static void showDocumentationForRestrictionDigest(); void userPushedComplVector(); void tellAssemblyView(); void raiseWindow(); }; #endif