/***************************************************************************** # 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 GUICOMPARECONTIGS_INCLUDED #define GUICOMPARECONTIGS_INCLUDED #include #include #include "rwcstring.h" #include "sysdepend.h" #include "guiapp.h" #include "compareContigsTypes.h" #include "scaleTickSizes.h" const int nPixelMarginBetweenBasesAndScaleMarks = 0; const int nPixelMarginBetweenScaleLineAndScaleNumbers = 3; const int nPixelMarginAtTopOfDrawingArea1 = 1; const int nPixelMarginAtBottomOfDrawingArea2 = 3; const int nPixelMarginAtBottomOfDrawingArea1OrTopOfDrawingArea2 = 0; const int nPixelMarginBetweenAlignmentWindowContigs = 0; const int nPixelMarginAtTopOfAlignmentWindow = 0; const int nPixelMarginAtBottomOfAlignmentWindow = 0; class compareContigs; class guiCompareContigs { public: guiCompareContigs( compareContigs* pCompareContigs ); ~guiCompareContigs(); friend void alignButtonCb(Widget wid, XtPointer client_data, XtPointer call_data); friend void scrollContigWinButtonCb(Widget wid, XtPointer client_data, XtPointer call_data); friend void scrollBarXtCb( Widget widCallback, XtPointer client_data, XtPointer call_data ); friend void dismissButtonCb( Widget widCallback, XtPointer client_data, XtPointer call_data ); friend void joinContigsButtonCb(Widget w, XtPointer client_data, XtPointer call_data); friend void createFakeReadButtonCb( Widget w, XtPointer client_data, XtPointer call_data ); friend void compareContigsOptionsButtonCb( Widget w, XtPointer client_data, XtPointer call_data ); friend void contigExposureXtCb( Widget wid, XtPointer client_data, XtPointer call_data ); void guiDrawContigBases( const compareContigsTypes eContig1OrContig2, const RWCString& soPartOfContigToDraw ); void guiDrawAlignmentWindowBases( const compareContigsAlignmentWindowLineTypes eLine, const RWCString& soBasesToDisplay ); void guiDrawAlignmentWindowBases( const compareContigsAlignmentWindowLineTypes eLine, const int nZeroBasedPosOfBasesToDisplay, const RWCString& soBasesToDisplay, GuiColorText* pGuiColorTextOfBasesToDisplay ); void guiDrawScaleTick( const compareContigsTypes eContig1OrContig2, const scaleTickSizeTypes eBigTickOrLittleTick, const int nCharScreenPosition ); void guiDrawAlignmentWindowScaleTick( const compareContigsTypes eContig1OrContig2, const scaleTickSizeTypes eBigTickOrLittleTick, const int nCharScreenPosition ); void guiDrawScaleNumber( const compareContigsTypes eContig1OrContig2, const int nCharScreenPosition, char* szLabel ); void guiDrawAlignmentWindowScaleNumber( const compareContigsTypes eContig1OrContig2, const int nCharScreenPosition, char* szLabel ); void guiDrawScaleHorizontalLine( const compareContigsTypes eContig1OrContig2 ); void guiDrawAlignmentWindowScaleHorizontalLine( const compareContigsTypes eContig1OrContig2 ); void guiClearContigWindow( const compareContigsTypes eContig1OrContig2 ); void guiClearAlignmentWindow( ); int nScreenWidthInChars(); // if the screen is not an integral number of characters, truncate // used for setting scrolling size so you can see the last character int nScreenWidthInCharsNotRoundedUp( ); int nGetContigWindowPixelWidth() const; void guiResetScrollBar(const int nVal, const int nMin, const int nMax, const int nSize, const compareContigsWindowTypes eWindow); void guiResetScrollBarMax( const int nMax, const compareContigsTypes eContig1OrContig2 ); void guiResizeScrollBar( const compareContigsWindowTypes eWindow ); void guiSetScrollBarPos(const int nPos, const compareContigsWindowTypes eWindow ); void programMovesAlignmentWindowScrollBarInCenter( const int n0VisiblePos ); void programMovesAlignmentWindowScrollBar2( const int n0NewPos ); void guiResetScrollbarForComplementContig( const compareContigsTypes eContig1OrContig2 ); void setContigName( const compareContigsTypes eContig1OrContig2, const RWCString& soContigName ); void guiDrawContigCursor( const compareContigsTypes eContig1OrContig2, const int nScreenCharPosX, const bool bBlinkOn, const char cBaseToDisplay ); void guiDrawAlignmentWindowCursor( const compareContigsTypes eContig1OrContig2, const int nScreenCharPosX, const char cBaseToDisplay, GuiColorText* pGuiColorText ); void guiSetCursor( const Widget wid, const int nPixelX, const int nPixelY ); void guiScrollContigWins(); void raiseWindow(); void makeAlignButtonInsensitive(); void makeJoinButtonInsensitive(); bool bHighlightRightReads(); void setComplementContigButton( const compareContigsTypes eContig1OrContig2 ); private: // takes index of base in a fragment line (where the leftmost // position possible for visible bases = 0) and returns pixel pos int nPixelXFromScreenChar( const int nScreenChar ) const { return GuiApp::pGetGuiApp()->nGetFontWidth() * nScreenChar; } // returns a zero-based number int nScreenCharFromPixelX( const int nPixelX ) const { return ( nPixelX / GuiApp::pGetGuiApp()->nGetFontWidth() ); } //////////////////////////////////////////////////////////////////// // // these private member data are used to map/navigate // the contigwin. // //////////////////////////////////////////////////////////////////// int nContig1ScaleNumbersBaseline() const { return( nPixelMarginAtTopOfDrawingArea1 + GuiApp::pGetGuiApp()->nGetFontAscent() ); } int nContig1ScaleLinePixelY() const { // add 1 so it uses the next pixel after the bottom of the numbers return (int) (nContig1ScaleNumbersBaseline() + 1 + nPixelMarginBetweenScaleLineAndScaleNumbers ); } int nScaleMarksHeight() const { return (int) (.5 * GuiApp::pGetGuiApp()->nGetFontHeight() ); } int nContig1BaselinePixelY() const { return (nContig1ScaleLinePixelY() + nScaleMarksHeight() + GuiApp::pGetGuiApp()->nGetFontAscent() + nPixelMarginBetweenBasesAndScaleMarks); } int nDrawingArea1Height() const { return( nContig1BaselinePixelY() + GuiApp::pGetGuiApp()->nGetFontDescent() + nPixelMarginAtBottomOfDrawingArea1OrTopOfDrawingArea2 ); } int nContig2BaselinePixelY() const { return ( nPixelMarginAtBottomOfDrawingArea1OrTopOfDrawingArea2 + GuiApp::pGetGuiApp()->nGetFontAscent() ); } int nContig2ScaleLinePixelY() const { return (int) (nContig2BaselinePixelY() + GuiApp::pGetGuiApp()->nGetFontDescent() + nPixelMarginBetweenBasesAndScaleMarks + nScaleMarksHeight() ); } int nContig2ScaleNumbersBaseline() const { return ( nContig2ScaleLinePixelY() + nPixelMarginBetweenScaleLineAndScaleNumbers + GuiApp::pGetGuiApp()->nGetFontAscent() ); } int nDrawingArea2Height() const { return( nContig2ScaleNumbersBaseline() + nPixelMarginAtBottomOfDrawingArea2 ); } // private member functions for alignment window real estate int nAlignmentWindowContig1ScaleNumbersBaseline() { return( nPixelMarginAtTopOfAlignmentWindow + GuiApp::pGetGuiApp()->nGetFontAscent() ); } int nAlignmentWindowContig1ScaleLinePixelY() { // add 1 so it uses the next pixel after the bottom of the numbers return (int) (nAlignmentWindowContig1ScaleNumbersBaseline() + 1 + nPixelMarginBetweenScaleLineAndScaleNumbers ); } int nAlignmentWindowContig1BaselinePixelY() { return (nAlignmentWindowContig1ScaleLinePixelY() + nScaleMarksHeight() + GuiApp::pGetGuiApp()->nGetFontAscent() + nPixelMarginBetweenBasesAndScaleMarks); } int nAlignmentWindowMiddleLineBaselinePixelY() { return ( nAlignmentWindowContig1BaselinePixelY() + GuiApp::pGetGuiApp()->nGetFontDescent() + GuiApp::pGetGuiApp()->nGetFontAscent() + nPixelMarginBetweenAlignmentWindowContigs ); } int nAlignmentWindowContig2BaselinePixelY() { return( nAlignmentWindowMiddleLineBaselinePixelY() + GuiApp::pGetGuiApp()->nGetFontAscent() + nPixelMarginBetweenAlignmentWindowContigs ); } int nAlignmentWindowContig2ScaleLinePixelY() { return( nAlignmentWindowContig2BaselinePixelY() + GuiApp::pGetGuiApp()->nGetFontDescent() + nPixelMarginBetweenBasesAndScaleMarks + nScaleMarksHeight() ); } int nAlignmentWindowContig2ScaleNumbersBaseline() { return( nAlignmentWindowContig2ScaleLinePixelY() + nPixelMarginBetweenScaleLineAndScaleNumbers + GuiApp::pGetGuiApp()->nGetFontAscent() ); } int nAlignmentDrawingAreaHeight() { return( nAlignmentWindowContig2ScaleNumbersBaseline() + nPixelMarginAtBottomOfAlignmentWindow ); } void guiCompareContigsExposure( const Widget wid ); void guiHorizontalScrollBarMoved( const Widget wid, const int nNewScrollBarPosition ); Widget widGetWidget( const compareContigsWindowTypes eWindow ); Widget widGetScrollBarWidget( const compareContigsWindowTypes eWindow ); // end of private functions public: compareContigs* pCompareContigs_; // looks like this: // top half of the screen: // widContigName1_ // widScrollBar1_ // widDrawingArea1_ (for 1st contig) // widDrawingArea2_ (for 2nd contig) // widScrollBar2_ // widContigName2_ // // (bottom half of the screen:) // widAlignmentDrawingArea_ // widAlignmentScrollBar_ // (and buttons) Widget widPopupShell_; Widget widContigName1_; Widget widScrollBar1_; Widget widDrawingArea1_; Widget widDrawingArea2_; Widget widScrollBar2_; Widget widContigName2_; Widget widAlignButton_; Widget widCompareContigsOptionsButton_; Widget widJoinContigsButton_; Widget widCreateFakeReadButton_; Widget widAlignmentDrawingArea_; Widget widAlignmentScrollBar_; Widget widScrollContigwinsButton_; Widget widDismissButton_; Widget widHighlightRightReadsTrue_; Widget widComplementContig1_; Widget widComplementContig2_; Widget widNumberOfDiscrepancies_; Widget widDiscrepancyRate_; Widget widPrevDiscrepancyButton_; Widget widNextDiscrepancyButton_; GuiColorText* pGuiColorTextContigs_; GuiColorText* pGuiColorTextScale_; GuiColorText* pGuiColorTextCursor_; }; void guiCompareContigsButtonPressXtEventHandler( Widget, XtPointer client_data, XEvent* pEvent, Boolean* ); void alignButtonCb(Widget wid, XtPointer client_data, XtPointer call_data); void scrollContigWinButtonCb(Widget wid, XtPointer client_data, XtPointer call_data); void scrollBarXtCb( Widget widCallback, XtPointer client_data, XtPointer call_data ); void dismissButtonCb( Widget widCallback, XtPointer client_data, XtPointer call_data ); void joinContigsButtonCb(Widget w, XtPointer client_data, XtPointer call_data); void createFakeReadButtonCb( Widget w, XtPointer client_data, XtPointer call_data ); void compareContigsOptionsButtonCb( Widget w, XtPointer client_data, XtPointer call_data ); void contigExposureXtCb( Widget wid, XtPointer client_data, XtPointer call_data ); #endif