/***************************************************************************** # 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. # #*****************************************************************************/ // // // guiapp.h // // the GuiApp object contains the toplevel widget // and other stuff required to manage, realize and // otherwise mess with a motif application. // // #ifndef GUIAPP_INCLUDED #define GUIAPP_INCLUDED #define GAPP GuiApp::pGetGuiApp() #include #include "motifutils.h" #include "guicolortext.h" #include "filename.h" #include "rwtvalorderedvector.h" #include "rwtptrorderedvector.h" #include "rwcstring.h" // forward declaration class guiTopWindow; class ColorMode; class ColorMeansMatch; class ColorMeansQuality; class ColorMeansEdited; class ColorMeansQualityAndTags; class ColorMeansEditedAndTags; class GuiApp { public: // // sole constructor (you only live once...) // GuiApp(const char* szName, int argc, char* argv[], const bool bTopWindow = true ); // // member functions to return widgets, etc. // Widget widGetTopLevel() { return widTopLevel_; } XtAppContext ctxGetAppContext() { return ctxAppContext_; } // // Warning: Motif specific behavior // void makeVisible(); void mainLoop(); void maybeSetXKeySymDB(); // // display related stuff // int nGetScreenNumber() { return DefaultScreen( XtDisplay(widTopLevel_) ); } int nGetDisplayWidth() { return DisplayWidth(XtDisplay(widTopLevel_), nGetScreenNumber() ); } int nGetDisplayHeight() { return DisplayHeight(XtDisplay(widTopLevel_), nGetScreenNumber() ); } // // information concerning the contig window font // static int nGetFontHeight() { return GuiApp::pGetGuiApp()->nFontHeight_; } static int nGetFontDescent() { return GuiApp::pGetGuiApp()->nFontDescent_; } static int nGetFontWidth() { return GuiApp::pGetGuiApp()->nFontWidth_; } static int nGetFontAscent() { return GuiApp::pGetGuiApp()->nFontAscent_; } int nGetFontOriginFromCenter() { return( (nFontLBearing_ + nFontRBearing_ ) / 2 ); } XFontStruct* pXfsGetDrawFont() { return pXfsDrawFont_; } unsigned long ulFormVertOffset() { return 4; } unsigned long ulFormHorizOffset() { return 4; } // // convenience functions to pop up utility dialog boxes // // allow single line "printf" like use of the // error/info boxes, supports varargs, etc. // blocks application, cleans up after itself. static void popupErrorMessage( const char *szErrorFormat, ... ); static void popupInfoMessage( const char *szErrorFormat, ... ); // similar to above two. // returns bool if user presses "ok". if you want ostrstream // message building or relabeled buttons, use DecisionBox object // directly static bool popupDecisionMessage( const char *szErrorFormat, ... ); // another convenience wrapper, this time around the FileSelector // object. returns user choice or null string object if user cancels. static FileName popupFileSelector(const char* szTitle, // i.e. "Save file as:" const char* szDirMask, // default dir & pattern const char* szFileName = 0); // optional default // provide read access to class static member static GuiApp* pGetGuiApp() { return pGlobalGuiApp_; } // // convenience function to go "beep" // // if it has a window, it can beep static void beep() { XBell(XtDisplay(pGetGuiApp()->widGetTopLevel()), 0); } // same but with user specified volume // nAdjust is + or - percent change to default volume static void beep(const int nAdjust) { XBell(XtDisplay(pGetGuiApp()->widGetTopLevel()), nAdjust); } void saveColors( bool& bEnoughRoomInColormap ); void getFallbackResources( RWCString& soFallbackResources ); guiTopWindow* pGetGuiTopWindow() { return pGuiTopWindow_; } void makeSelectionForPasting( const RWCString& soBasesToPaste ); friend char cbSelectionConversion( Widget wid, Atom* pSelection, Atom* pTarget, Atom* pReturnType, XtPointer* pValue, unsigned long* pLength, int* pFormat ); Colormap cmapGetColorMap() { return cmap_; } void setUpColormap( const bool bEnoughRoomInColormap ); void copyABunchOfColormapCells(); void justCheckColormap( char* szColorName, bool& bEnoughRoomInColormap ); XmFontList xmfontListGet() { return xmFontList_; } void findTopWindow(); void changeDefaultToLightBackground(); void printWindow(); bool bGetGuiColorTextForReadPrefixByColor( GuiColorText*& pGuiColorText, const RWCString& soForegroundColor ); GuiColorText* pGetGuiColorTextForReadPrefixColor( const RWCString& soForegroundColor ); void startBlinking(); void blinkAgain(); public: Widget widTopLevel_; XtAppContext ctxAppContext_; // font struct pointer for drawable window font XFontStruct* pXfsDrawFont_; int nFontHeight_; int nFontDescent_; int nFontWidth_; int nFontAscent_; int nFontLBearing_; int nFontRBearing_; bool bUserAckedErrorMessage_; // // global pointer to single permitted instance // static GuiApp* pGlobalGuiApp_; // cause fail if more than one created static bool bGuiAppCreated_; guiTopWindow* pGuiTopWindow_; RWCString soSelectedBasesForPasting_; Colormap cmap_; XmFontList xmFontList_; GuiColorText* pColorOfRestrictionFragmentPairTooFarApart_; GuiColorText* pColorOfUnmatchedRestrictionFragment_; GuiColorText* pColorOfRestrictionFragmentInContig_; GuiColorText* pColorOfRestrictionFragmentPartlyOffContig_; GuiColorText* pColorOfRestrictionFragmentEntirelyOffContig_; GuiColorText* pColorOfActualGelRestrictionFragment_; GuiColorText* pColorOfRestrictionDigestScale_; GuiColorText* pColorOfRestrictionDigestCursorIndicator_; GuiColorText* pColorOfRestrictionFragmentsOnTopOfEachOther_; GuiColorText* pColorReadPrefixDefault_; ColorMeansMatch* pColorMeansMatch_; ColorMeansQuality* pColorMeansQuality_; ColorMeansEdited* pColorMeansEdited_; ColorMeansQualityAndTags* pColorMeansQualityAndTags_; ColorMeansEditedAndTags* pColorMeansEditedAndTags_; RWTPtrOrderedVector aGuiColorTextForReadPrefixes_; RWTValOrderedVector aColorNamesForReadPrefixes_; bool bBlinkState_; }; #endif // GUIAPP_INCLUDED