/***************************************************************************** # 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. # #*****************************************************************************/ // // GuiContigWin.cpp // // implementation for GuiContigWin class // // #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #include #include #include "motifutils.h" #include "contigwin.h" #include "guiapp.h" #include "guicontigwin.h" #include "mbt_errors.h" #include "numutil.h" #include "consed.h" #include "xsynchronize.h" #include "hp_exception_kludge.h" #include "colorDefaults.h" #include "guiPopupDocumentation.h" #include "handleWindowManagerDelete2.h" #include "searchForSingleStrandedRegions.h" #include "searchForSingleSubcloneRegions.h" #include "consedParameters.h" #include "guiPopupTagInfo.h" #include "mbt_exception.h" #include "guiAskUserToSelectReadListOptions.h" #include #include "guiExportConsensusWithOptions.h" // required for callbacks for quit, save, search_for_string #include "guiTopWindow.h" #include "tagTypes.h" #include "guiSearchForOpenReadingFrames.h" #include "wholeReadItem.h" #include "guiPopupWholeReadItem.h" #include "guiShowErrorInfoForARegion.h" #include "pickPCRPrimers.h" #include "guiChangeColor.h" #include "guiCheckPrimer.h" #include "assemblyView.h" #include "bGuiGetAnswerYesNo.h" #include "guiHowToSortAlignedReads.h" #include "guiSaveHighlightedReads.h" static const int nSpaceBetweenButtons = 10; static const int nNumberOfReadsToOverlapWhenPaging = 1; // // forward declarations for callbacks // CbInfoButton cbComplementContig; CbInfoButton cbPaddedUnpaddedScale; CbInfoButton cbCompareContigs; static LocatedFragment* pLocFragToFindInAssemblyView = NULL; static void cbHowToSortAlignedReads( Widget wid, XtPointer pClientData, XtPointer pCallData ) { TRY_CATCH_WRAPPER( GuiContigWin* pGuiContigWin = (GuiContigWin*) pClientData; guiHowToSortAlignedReads* pGuiSort = new guiHowToSortAlignedReads( pGuiContigWin->pContigWin_ ); pGuiSort->createWindow() ); } static void cbToggleHorizontalLineAtCursor( Widget wid, XtPointer pClientData, XtPointer pCallData ) { TRY_CATCH_WRAPPER( GuiContigWin* pGuiContigWin = (GuiContigWin*) pClientData; ContigWin* pContigWin = pGuiContigWin->pContigWin_; pContigWin->toggleHorizontalLineAtCursor() ); } static void cbToggleVerticalLineAtCursor( Widget wid, XtPointer pClientData, XtPointer pCallData ) { TRY_CATCH_WRAPPER( GuiContigWin* pGuiContigWin = (GuiContigWin*) pClientData; ContigWin* pContigWin = pGuiContigWin->pContigWin_; pContigWin->toggleVerticalLineAtCursor() ); } static void cbTurnOnOrOffStartNumberingConsensusStartingAtUserDefinedPosition( Widget wid, XtPointer pClientData, XtPointer pCallData ) { GuiContigWin* pGuiContigWin = (GuiContigWin*) pClientData; ContigWin* pContigWin = pGuiContigWin->pContigWin_; TRY_CATCH_WRAPPER( pContigWin->turnOnOrOffStartNumberingConsensusStartingAtUserDefinedPosition() ); } static void cbShowUncalledPeakInfo( Widget wid, XtPointer pClientData, XtPointer pCallData ) { GuiContigWin* pGuiContigWin = (GuiContigWin*) pClientData; ContigWin* pContigWin = pGuiContigWin->pContigWin_; TRY_CATCH_WRAPPER( pContigWin->showUncalledPeakInfo() ); } static void cbCompareReadsToReferenceSequence( Widget wid, XtPointer pClientData, XtPointer pCallData ) { GuiContigWin* pGuiContigWin = (GuiContigWin*) pClientData; ContigWin* pContigWin = pGuiContigWin->pContigWin_; TRY_CATCH_WRAPPER( pContigWin->compareReadsToReference() ); } static void cbGuiFindReadInAssemblyView( Widget wid, XtPointer pClientData, XtPointer pCallData ) { TRY_CATCH_WRAPPER( ConsEd::pGetConsEd()->pAssemblyView_->programHighlightsRead( pLocFragToFindInAssemblyView ) ); } static void cbGuiCreateHighQualityDiscrepancyNavigatorAsAboveWithoutMostPads( Widget w, XtPointer pClientData, XtPointer pCallData ) { GuiContigWin* pGuiContigWin = (GuiContigWin*) pClientData; TRY_CATCH_WRAPPER( ContigWin* pContigWin = pGuiContigWin->pContigWin_; pContigWin->createHighQualityDiscrepancyNavigator( true, true ); ); } void cbExportConsensus(void* clientData); static void cbGotoConsensusPosition( Widget, GuiContigWin*, XtPointer ); static void cbClearConsensusPosition( Widget wid, XtPointer pClientData, XtPointer pCallData ) { GuiContigWin* pGuiContigWin = (GuiContigWin*) pClientData; XmTextSetString( pGuiContigWin->widGotoConsensusPosition_, "" ); } static void cbScrollLeft( Widget wid, XtPointer pClientData, XtPointer pCallData ); static void cbScrollLeftLeft( Widget wid, XtPointer pClientData, XtPointer pCallData ); static void cbScrollRight( Widget wid, XtPointer pClientData, XtPointer pCallData ); static void cbScrollRightRight( Widget wid, XtPointer pClientData, XtPointer pCallData ); static void cbFindMainWindow( Widget w, XtPointer pClientThis, XtPointer pClientData ); static void cbGuiShowAllTraces( Widget wid, XtPointer pClientData, XtPointer pCallData ) { GuiContigWin* pGuiContigWin = (GuiContigWin*) pClientData; TRY_CATCH_WRAPPER( pGuiContigWin->guiShowAllTraces() ); } static void cbFixDimMenuLabels( Widget wid, XtPointer pClientData, XtPointer pCallData ) { GuiContigWin* pGuiContigWin = (GuiContigWin*) pClientData; TRY_CATCH_WRAPPER( pGuiContigWin->fixDimMenuLabels() ); } static void cbFixShowProteinTranslationLabels( Widget wid, XtPointer pClientData, XtPointer pCallData ) { GuiContigWin* pGuiContigWin = (GuiContigWin*) pClientData; TRY_CATCH_WRAPPER( pGuiContigWin->fixShowProteinTranslationLabels() ); } static void cbDimNothing( Widget wid, XtPointer pClientData, XtPointer pCallData ) { consedParameters::pGetConsedParameters()->bDimLowQualityEndsOfReads_ = false; consedParameters::pGetConsedParameters()->bDimUnalignedEndsOfReads_ = false; TRY_CATCH_WRAPPER( ConsEd::pGetConsEd()->refreshAllContigWinsAndAllTeditors() ); } static void cbDimUnaligned( Widget wid, XtPointer pClientData, XtPointer pCallData ) { consedParameters::pGetConsedParameters()->bDimLowQualityEndsOfReads_ = false; consedParameters::pGetConsedParameters()->bDimUnalignedEndsOfReads_ = true; TRY_CATCH_WRAPPER( ConsEd::pGetConsEd()->refreshAllContigWinsAndAllTeditors() ); } static void cbDimLowQuality( Widget wid, XtPointer pClientData, XtPointer pCallData ) { consedParameters::pGetConsedParameters()->bDimLowQualityEndsOfReads_ = true; consedParameters::pGetConsedParameters()->bDimUnalignedEndsOfReads_ = false; TRY_CATCH_WRAPPER( ConsEd::pGetConsEd()->refreshAllContigWinsAndAllTeditors() ); } static void cbDimLowQualityOrUnaligned( Widget wid, XtPointer pClientData, XtPointer pCallData ) { consedParameters::pGetConsedParameters()->bDimLowQualityEndsOfReads_ = true; consedParameters::pGetConsedParameters()->bDimUnalignedEndsOfReads_ = true; TRY_CATCH_WRAPPER( ConsEd::pGetConsEd()->refreshAllContigWinsAndAllTeditors() ); } static void cbUserPushedShowSomeTagsButton( Widget wid, XtPointer pClientData, XtPointer pCallData ) { GuiContigWin* pGuiContigWin = (GuiContigWin*) pClientData; TRY_CATCH_WRAPPER( pGuiContigWin->userPushedShowSomeTagsButton() ); } static void cbGuiExportConsensusWithOptions( Widget wid, XtPointer pClientData, XtPointer pCallData ) { GuiContigWin* pGuiContigWin = (GuiContigWin*) pClientData; TRY_CATCH_WRAPPER( pGuiContigWin->exportConsensusWithOptions() ); } static void cbShowProteinTranslationTopStrand( Widget wid, XtPointer pClientData, XtPointer pCallData ) { GuiContigWin* pGuiContigWin = (GuiContigWin*) pClientData; TRY_CATCH_WRAPPER( pGuiContigWin->showProteinTranslation( nShowProteinTranslationTopStrand ) ); } static void cbShowProteinTranslationBottomStrand( Widget wid, XtPointer pClientData, XtPointer pCallData ) { GuiContigWin* pGuiContigWin = (GuiContigWin*) pClientData; TRY_CATCH_WRAPPER( pGuiContigWin->showProteinTranslation( nShowProteinTranslationBottomStrand ) ); } static void cbDontShowProteinTranslation( Widget wid, XtPointer pClientData, XtPointer pCallData ) { GuiContigWin* pGuiContigWin = (GuiContigWin*) pClientData; TRY_CATCH_WRAPPER( pGuiContigWin->showProteinTranslation( nDontShowProteinTranslation ) ); } static void cbSearchForOpenReadingFrames( Widget wid, XtPointer pClientData, XtPointer pCallData ) { GuiContigWin* pGuiContigWin = (GuiContigWin*) pClientData; TRY_CATCH_WRAPPER( pGuiContigWin->guiSearchForOpenReadingFrames2() ); } static void cbGuiTearContigs( Widget wid, XtPointer pClientData, XtPointer pCallData ) { GuiContigWin* pGuiContigWin = (GuiContigWin*) pClientData; TRY_CATCH_WRAPPER( pGuiContigWin->guiTearContigs() ); } static void cbToggleNavigateAutomaticAllTracesPopup( Widget wid, XtPointer pClientData, XtPointer pCallData ) { consedParameters::pGetConsedParameters()->bNavigateAutomaticAllTracesPopup_ = ! consedParameters::pGetConsedParameters()->bNavigateAutomaticAllTracesPopup_; } static void cbShowWholeReadItem( Widget wid, XtPointer pClientData, XtPointer pCallData ) { TRY_CATCH_WRAPPER( passToShowWholeReadItem* pPassToShowWholeReadItem = (passToShowWholeReadItem*) pClientData; new guiPopupWholeReadItem( pPassToShowWholeReadItem->pGuiContigWin_->widGetGuiContigWinTopLevel(), pPassToShowWholeReadItem->pWholeReadItem_ ); ); } static void cbPutReadIntoItsOwnContig( Widget wid, XtPointer pClientData, XtPointer pCallData ) { TRY_CATCH_WRAPPER( passToPutReadIntoItsOwnContig* pPassToPutReadIntoItsOwnContig = (passToPutReadIntoItsOwnContig*) pClientData; pPassToPutReadIntoItsOwnContig->pGuiContigWin_->pContigWin_->pContig_->putReadIntoItsOwnContig( pPassToPutReadIntoItsOwnContig->pLocFrag_, pPassToPutReadIntoItsOwnContig->pGuiContigWin_->pContigWin_, true ); // bOKToUseGui ); } static void cbScrollToLeftEndOfConsensus( Widget wid, XtPointer pClientData, XtPointer pCallData ) { TRY_CATCH_WRAPPER( GuiContigWin* pGuiContigWin = (GuiContigWin*) pClientData; pGuiContigWin->pContigWin_->scrollToLeftOrRightEndOfConsensus( true ); ); } static void cbScrollToRightEndOfConsensus( Widget wid, XtPointer pClientData, XtPointer pCallData ) { TRY_CATCH_WRAPPER( GuiContigWin* pGuiContigWin = (GuiContigWin*) pClientData; pGuiContigWin->pContigWin_->scrollToLeftOrRightEndOfConsensus( false ); ); } static void cbPrev( Widget wid, XtPointer pClientData, XtPointer pCallData ) { TRY_CATCH_WRAPPER( GuiContigWin* pGuiContigWin = (GuiContigWin*) pClientData; pGuiContigWin->pContigWin_->navigateToNextOrPreviousItem( false ); ); } static void cbNext( Widget wid, XtPointer pClientData, XtPointer pCallData ) { TRY_CATCH_WRAPPER( GuiContigWin* pGuiContigWin = (GuiContigWin*) pClientData; pGuiContigWin->pContigWin_->navigateToNextOrPreviousItem( true ); ); } static void cbGotoCursor( Widget wid, XtPointer pClientData, XtPointer pCallData ) { TRY_CATCH_WRAPPER( GuiContigWin* pGuiContigWin = (GuiContigWin*) pClientData; pGuiContigWin->pContigWin_->scrollToCursor(); ); } static void cbSaveAssembly( Widget wid, XtPointer pClientData, XtPointer pCallData ) { GuiContigWin* pGuiContigWin = (GuiContigWin*) pClientData; bool bUserPushedCancel = false; TRY_CATCH_WRAPPER( ConsEd::pGetAssembly()->saveAssembly( bUserPushedCancel, pGuiContigWin->widGetGuiContigWinTopLevel() ) ); } static void cbShowErrorInfoForARegion( Widget wid, XtPointer pClientData, XtPointer pCallData ) { GuiContigWin* pGuiContigWin = (GuiContigWin*) pClientData; TRY_CATCH_WRAPPER( guiShowErrorInfoForARegion* pGuiShowErrorInfo = new guiShowErrorInfoForARegion( pGuiContigWin->widGetGuiContigWinTopLevel(), pGuiContigWin->pContigWin_->pContig_ ); pGuiShowErrorInfo->display(); ); } void guiContigWinPointerMotionEventHandler( Widget wid, XtPointer pClientData, XEvent* pEvent, Boolean* ) { int nPixelX = pEvent->xmotion.x; int nPixelY = pEvent->xmotion.y; GuiContigWin *pGuiContigWin = (GuiContigWin*) pClientData; TRY_CATCH_WRAPPER( pGuiContigWin->pContigWin_->pointerMoved( nPixelX, nPixelY ) ); } void cbGuiPickTopStrandFirstPCRPrimer( Widget wid, XtPointer pClientData, XtPointer pCallData ) { GuiContigWin* pGuiContigWin = (GuiContigWin*) pClientData; TRY_CATCH_WRAPPER( pGuiContigWin->guiPickFirstPCRPrimer( true ) // bTopStrandNotBottomStrand ); } void cbGuiPickBottomStrandFirstPCRPrimer( Widget wid, XtPointer pClientData, XtPointer pCallData ) { GuiContigWin* pGuiContigWin = (GuiContigWin*) pClientData; TRY_CATCH_WRAPPER( pGuiContigWin->guiPickFirstPCRPrimer( false ) // bTopStrandNotBottomStrand ); } void cbGuiPickTopStrandSecondPCRPrimer( Widget wid, XtPointer pClientData, XtPointer pCallData ) { GuiContigWin* pGuiContigWin = (GuiContigWin*) pClientData; TRY_CATCH_WRAPPER( pGuiContigWin->guiPickSecondPCRPrimer( true ) // bTopStrandNotBottomStrand ); } void cbGuiPickBottomStrandSecondPCRPrimer( Widget wid, XtPointer pClientData, XtPointer pCallData ) { GuiContigWin* pGuiContigWin = (GuiContigWin*) pClientData; TRY_CATCH_WRAPPER( pGuiContigWin->guiPickSecondPCRPrimer( false ) // bTopStrandNotBottomStrand ); } void cbCancelPickingPCRPrimers( Widget wid, XtPointer pClientData, XtPointer pCallData ) { GuiContigWin* pGuiContigWin = (GuiContigWin*) pClientData; TRY_CATCH_WRAPPER( assert( pCP->pPickPCRPrimers_ ); delete pCP->pPickPCRPrimers_; pCP->pPickPCRPrimers_ = NULL; pCP->bReadyToPickSecondPCRPrimer_ = false; ); } static void cbGuiTemplateInfo( Widget w, XtPointer pClientData, XtPointer pCallData ) { GuiContigWin* pGuiContigWin = (GuiContigWin*) pClientData; ContigWin* pContigWin = pGuiContigWin->pContigWin_; TRY_CATCH_WRAPPER( pContigWin->showTemplateInfo( ) ); } static void cbSaveHighlightedReadNamesToFile( Widget wid, XtPointer pClientData, XtPointer pCallData ) { TRY_CATCH_WRAPPER( GuiContigWin* pGuiContigWin = (GuiContigWin*) pClientData; guiSaveHighlightedReads* pGHR = new guiSaveHighlightedReads( pGuiContigWin ); pGHR->createWindow(); ); } static void cbUnhighlightAllReads( Widget wid, XtPointer pClientData, XtPointer pCallData ) { GuiContigWin* pGuiContigWin = (GuiContigWin*) pClientData; TRY_CATCH_WRAPPER( pGuiContigWin->pContigWin_->pContig_->unhighlightAllReads() ); } static void cbChangeColor( Widget wid, XtPointer pClientData, XtPointer pCallData ) { GuiContigWin* pGuiContigWin = (GuiContigWin*) pClientData; TRY_CATCH_WRAPPER( new guiChangeColor( pGuiContigWin->pContigWin_ ) ); } static void cbCheckPrimer( Widget wid, XtPointer pClientData, XtPointer pCallData ) { GuiContigWin* pGuiContigWin = (GuiContigWin*) pClientData; TRY_CATCH_WRAPPER( guiCheckPrimer* pGuiCheckPrimer = new guiCheckPrimer( pGuiContigWin->widGetGuiContigWinTopLevel(), pGuiContigWin->pContigWin_->pContig_ ); pGuiCheckPrimer->display(); ); } static void cbChangeToXsToLeftInAllReads( Widget wid, XtPointer pClientData, XtPointer pCallData ) { GuiContigWin* pGuiContigWin = (GuiContigWin*) pClientData; TRY_CATCH_WRAPPER( pGuiContigWin->pContigWin_->changeToXsToLeftInAllReads() ); } static void cbChangeToXsToRightInAllReads( Widget wid, XtPointer pClientData, XtPointer pCallData ) { GuiContigWin* pGuiContigWin = (GuiContigWin*) pClientData; TRY_CATCH_WRAPPER( pGuiContigWin->pContigWin_->changeToXsToRightInAllReads() ); } static void cbCreateCloneEndTagInsertToRight( Widget wid, XtPointer pClientData, XtPointer pCallData ) { GuiContigWin* pGuiContigWin = (GuiContigWin*) pClientData; TRY_CATCH_WRAPPER( pGuiContigWin->pContigWin_->createCloneEndTag( true ) // bInsertToRight ); } static void cbCreateCloneEndTagInsertToLeft( Widget wid, XtPointer pClientData, XtPointer pCallData ) { GuiContigWin* pGuiContigWin = (GuiContigWin*) pClientData; TRY_CATCH_WRAPPER( pGuiContigWin->pContigWin_->createCloneEndTag( false ) // bInsertToRight ); } static void cbTurnOnSortByQualityAtCursor( Widget wid, XtPointer pClientData, XtPointer pCallData ) { GuiContigWin* pGuiContigWin = (GuiContigWin*) pClientData; TRY_CATCH_WRAPPER( pGuiContigWin->pContigWin_->sortByQualityValuesAtCursor( true ); ); } static void cbTurnOffSortByQualityAtCursor( Widget wid, XtPointer pClientData, XtPointer pCallData ) { GuiContigWin* pGuiContigWin = (GuiContigWin*) pClientData; TRY_CATCH_WRAPPER( pGuiContigWin->pContigWin_->sortByQualityValuesAtCursor( false ); ); } static void cbSortOptions( Widget wid, XtPointer pClientData, XtPointer pCallData ) { TRY_CATCH_WRAPPER( GuiContigWin* pGuiContigWin = (GuiContigWin*) pClientData; guiHowToSortAlignedReads* pGuiSort = new guiHowToSortAlignedReads( pGuiContigWin->pContigWin_ ); pGuiSort->createWindow() ); } // // sole ctor // GuiContigWin :: GuiContigWin( ContigWin* pContigWin ) : pContigWin_(pContigWin), bSavedVerticalScrollbarColors_( false ), nRoomForReadNames_( 0 ), bMouseIsOnBasesWithButtonDown_( false ), bAutomaticScrollingInProgress_( false ) { Arg aArg[30]; int nArgs = 0; widMainWinTopLevelShell_ = XtVaCreatePopupShell("Aligned Reads", topLevelShellWidgetClass, GuiApp::pGetGuiApp()->widGetTopLevel(), XmNdeleteResponse, XmDO_NOTHING, NULL ); handleWindowManagerDelete2( widMainWinTopLevelShell_, (XtCallbackProc) dismissXtCb, this ); // the immediate child of the application shell is a // main window widMainWin_ = XtVaCreateManagedWidget("mainwin", xmMainWindowWidgetClass, widMainWinTopLevelShell_, XmNancestorSensitive, True, NULL ); nArgs = 0; widMenuBar_ = XmCreateMenuBar(widMainWin_, "menubar", aArg, nArgs); XtManageChild(widMenuBar_); // // menu bar items are dynamically created // see inherited MenuMainWin object for details // // save a fasta file copy of the consensus for the // currently open contig nArgs = 0; Widget widFileMenu = XmCreatePulldownMenu(widMenuBar_, "File", aArg, nArgs); // create the cascade button nArgs = 0; XtSetArg(aArg[nArgs], XmNsubMenuId, widFileMenu); nArgs++; Widget widFileCascade = XmCreateCascadeButton(widMenuBar_, "File", aArg, nArgs); XtManageChild(widFileCascade ); nArgs = 0; Widget widNavigateMenu = XmCreatePulldownMenu( widMenuBar_, "Navigate", aArg, nArgs ); XtAddCallback( widNavigateMenu, XmNmapCallback, cbFixNavigateMenuLabels, this ); // create the cascade button nArgs = 0; XtSetArg(aArg[nArgs], XmNsubMenuId, widNavigateMenu); nArgs++; Widget widNavigateCascade = XmCreateCascadeButton(widMenuBar_, "Navigate", aArg, nArgs); XtManageChild(widNavigateCascade ); nArgs = 0; Widget widInfoMenu = XmCreatePulldownMenu( widMenuBar_, "Info", aArg, nArgs ); // create the cascade button nArgs = 0; XtSetArg(aArg[nArgs], XmNsubMenuId, widInfoMenu); nArgs++; Widget widInfoCascade = XmCreateCascadeButton(widMenuBar_, "Info", aArg, nArgs); XtManageChild(widInfoCascade ); // create color menu button nArgs = 0; Widget widColorMenu = XmCreatePulldownMenu( widMenuBar_, "Color", aArg, nArgs ); nArgs = 0; XtSetArg(aArg[nArgs], XmNsubMenuId, widColorMenu); nArgs++; Widget widColorCascade = XmCreateCascadeButton(widMenuBar_, "Color", aArg, nArgs); XtManageChild(widColorCascade ); // create dim menu button nArgs = 0; Widget widDimMenu = XmCreatePulldownMenu( widMenuBar_, "Dim", aArg, nArgs ); XtAddCallback( widDimMenu, XmNmapCallback, cbFixDimMenuLabels, this ); nArgs = 0; XtSetArg( aArg[ nArgs ], XmNsubMenuId, widDimMenu ); nArgs++; Widget widDimCascade = XmCreateCascadeButton( widMenuBar_, "Dim", aArg, nArgs ); XtManageChild( widDimCascade ); /// create misc menu button nArgs = 0; Widget widMiscMenu = XmCreatePulldownMenu( widMenuBar_, "Misc", aArg, nArgs ); XtAddCallback( widMiscMenu, XmNmapCallback, cbFixShowProteinTranslationLabels, this ); nArgs = 0; XtSetArg( aArg[nArgs], XmNsubMenuId, widMiscMenu ); nArgs++; Widget widMiscCascade = XmCreateCascadeButton( widMenuBar_, "Misc", aArg, nArgs ); XtManageChild( widMiscCascade ); // create sort menu button nArgs = 0; Widget widSortMenu = XmCreatePulldownMenu( widMenuBar_, "Sort", aArg, nArgs ); nArgs = 0; XtSetArg( aArg[nArgs], XmNsubMenuId, widSortMenu ); ++nArgs; Widget widSortCascade = XmCreateCascadeButton( widMenuBar_, "Sort", aArg, nArgs ); XtManageChild( widSortCascade ); // create help menu button nArgs = 0; Widget widHelpMenu = XmCreatePulldownMenu( widMenuBar_, "Help", aArg, nArgs ); nArgs = 0; XtSetArg(aArg[nArgs], XmNsubMenuId, widHelpMenu); nArgs++; Widget widHelpCascade = XmCreateCascadeButton(widMenuBar_, "Help", aArg, nArgs); XtManageChild(widHelpCascade ); XtVaSetValues( widMenuBar_, XmNmenuHelpWidget, widHelpCascade, NULL ); // now add all the menu items Widget widExportConsensus = XtVaCreateManagedWidget( "Export consensus sequence", xmPushButtonWidgetClass, widFileMenu, NULL ); XtAddCallback(widExportConsensus, XmNactivateCallback, cbGuiExportConsensus, this ); Widget widExportConsensusWithOptions = XtVaCreateManagedWidget( "Export consensus sequence (with options)...", xmPushButtonWidgetClass, widFileMenu, NULL ); XtAddCallback( widExportConsensusWithOptions, XmNactivateCallback, cbGuiExportConsensusWithOptions, this ); Widget widSaveAssembly = XtVaCreateManagedWidget( "Save assembly", xmPushButtonWidgetClass, widFileMenu, NULL ); XtAddCallback( widSaveAssembly, XmNactivateCallback, cbSaveAssembly, this ); Widget widSeparator = XtVaCreateManagedWidget( "separator", xmSeparatorWidgetClass, widFileMenu, NULL ); Widget widQuitConsed = XtVaCreateManagedWidget( "Quit consed", xmPushButtonWidgetClass, widFileMenu, NULL ); XtAddCallback( widQuitConsed, XmNactivateCallback, quitConsedMenuItemCb, NULL ); // search for our choice of problems widCreateMultiProblemNavigator_ = XtVaCreateManagedWidget( "Low Cons/High Qual Discrep/Single Stranded/Single Subclone/Unaligned High", xmPushButtonWidgetClass, widNavigateMenu, NULL ); XtAddCallback( widCreateMultiProblemNavigator_, XmNactivateCallback, cbGuiCreateMultiProblemNavigator, this ); // the true label will be set in fixNavigateMenuLabels widCreateLowConsensusQualityNavigator_ = XtVaCreateManagedWidget( "Low consensus quality", xmPushButtonWidgetClass, widNavigateMenu, NULL ); XtAddCallback( widCreateLowConsensusQualityNavigator_, XmNactivateCallback, cbGuiCreateLowConsensusQualityNavigator, this ); // the true label will be set in fixNavigateMenuLabels widCreateHighQualityDiscrepancyNavigator_ = XtVaCreateManagedWidget( "High quality discrepancies (in aligned region)", xmPushButtonWidgetClass, widNavigateMenu, NULL ); XtAddCallback( widCreateHighQualityDiscrepancyNavigator_, XmNactivateCallback, cbGuiCreateHighQualityDiscrepancyNavigator, this ); Widget widCreateHighQualityDiscrepancyNavigatorWithoutCompressionsOrG_dropout = XtVaCreateManagedWidget( "High quality discrepancies as above, but omitting tagged compressions and G_dropouts", xmPushButtonWidgetClass, widNavigateMenu, NULL ); XtAddCallback( widCreateHighQualityDiscrepancyNavigatorWithoutCompressionsOrG_dropout, XmNactivateCallback, cbGuiCreateHighQualityDiscrepancyNavigatorWithoutCompressionsOrG_dropouts, this ); Widget widCreateHighQualityDiscrepancyNavigatorAsAboveWithoutMostPads = XtVaCreateManagedWidget( "High quality discrepancies as above, but omitting most pads", xmPushButtonWidgetClass, widNavigateMenu, NULL ); XtAddCallback( widCreateHighQualityDiscrepancyNavigatorAsAboveWithoutMostPads, XmNactivateCallback, cbGuiCreateHighQualityDiscrepancyNavigatorAsAboveWithoutMostPads, this ); Widget widCreateEditedNavigator = XtVaCreateManagedWidget( "Edits", xmPushButtonWidgetClass, widNavigateMenu, NULL ); XtAddCallback( widCreateEditedNavigator, XmNactivateCallback, cbGuiCreateEditedNavigator, this ); Widget widCreateEditedButNotNsNavigator = XtVaCreateManagedWidget( "Edits but not n's", xmPushButtonWidgetClass, widNavigateMenu, NULL ); XtAddCallback( widCreateEditedButNotNsNavigator, XmNactivateCallback, cbGuiCreateEditedButNotNsNavigator, this ); Widget widCreateTagsNavigator = XtVaCreateManagedWidget( "Tags", xmPushButtonWidgetClass, widNavigateMenu, NULL ); XtAddCallback( widCreateTagsNavigator, XmNactivateCallback, cbGuiCreateTagsNavigator, this ); widCreateUnalignedHighQualityNavigator_ = XtVaCreateManagedWidget( "Unaligned High Quality Regions", xmPushButtonWidgetClass, widNavigateMenu, NULL ); XtAddCallback( widCreateUnalignedHighQualityNavigator_, XmNactivateCallback, cbGuiCreateUnalignedHighQualityNavigator, this ); widSearchForSingleStrandedRegions_ = XtVaCreateManagedWidget( "Regions covered by only 1 strand and only 1 chemistry (or none at all)", xmPushButtonWidgetClass, widNavigateMenu, NULL ); XtAddCallback( widSearchForSingleStrandedRegions_, XmNactivateCallback, cbSearchForSingleStrandedRegions, this ); widSearchForSingleSubcloneRegions_ = XtVaCreateManagedWidget( "Regions covered by only 1 subclone (or none at all)", xmPushButtonWidgetClass, widNavigateMenu, NULL ); XtAddCallback( widSearchForSingleSubcloneRegions_, XmNactivateCallback, cbSearchForSingleSubcloneRegions, this ); Widget widSearchForOpenReadingFrames = XtVaCreateManagedWidget( "Search for open reading frames", xmPushButtonWidgetClass, widNavigateMenu, NULL ); XtAddCallback( widSearchForOpenReadingFrames, XmNactivateCallback, cbSearchForOpenReadingFrames, this ); widToggleNavigateAutomaticTracePopup_ = XtVaCreateManagedWidget( "Toggles feature: traces popped up when navigate to read location", xmPushButtonWidgetClass, widNavigateMenu, NULL ); XtAddCallback( widToggleNavigateAutomaticTracePopup_, XmNactivateCallback, cbToggleNavigateAutomaticTracePopup, this ); widToggleNavigateAutomaticAllTracesPopup_ = XtVaCreateManagedWidget( "Toggles feature: all traces popped up when navigate to consensus location", xmPushButtonWidgetClass, widNavigateMenu, NULL ); XtAddCallback( widToggleNavigateAutomaticAllTracesPopup_, XmNactivateCallback, cbToggleNavigateAutomaticAllTracesPopup, this ); Widget widCompareReadsToReferenceSequence = XtVaCreateManagedWidget( "Compare reads to reference sequence", xmPushButtonWidgetClass, widNavigateMenu, NULL ); XtAddCallback( widCompareReadsToReferenceSequence, XmNactivateCallback, cbCompareReadsToReferenceSequence, this ); Widget widContigInformation = XtVaCreateManagedWidget( "Show Contig Information", xmPushButtonWidgetClass, widInfoMenu, NULL ); XtAddCallback( widContigInformation, XmNactivateCallback, cbGuiContigInfo, this ); Widget widTemplateInformation = XtVaCreateManagedWidget( "Show Subclone Template Information", xmPushButtonWidgetClass, widInfoMenu, NULL ); XtAddCallback( widTemplateInformation, XmNactivateCallback, cbGuiTemplateInfo, this ); Widget widColorMeansQualityAndTags = XtVaCreateManagedWidget( "Color Means Quality And Tags", xmPushButtonWidgetClass, widColorMenu, NULL ); XtAddCallback( widColorMeansQualityAndTags, XmNactivateCallback, cbGuiColorMeansQualityAndTags, this ); Widget widColorMeansEditedAndTags = XtVaCreateManagedWidget( "Color Means Edited And Tags", xmPushButtonWidgetClass, widColorMenu, NULL ); XtAddCallback( widColorMeansEditedAndTags, XmNactivateCallback, cbGuiColorMeansEditedAndTags, this ); Widget widColorMeansMatch = XtVaCreateManagedWidget( "Color Means Match", xmPushButtonWidgetClass, widColorMenu, NULL ); XtAddCallback( widColorMeansMatch, XmNactivateCallback, cbGuiColorMeansMatch, this ); Widget widColorMeansQuality = XtVaCreateManagedWidget( "Color Means Quality", xmPushButtonWidgetClass, widColorMenu, NULL ); XtAddCallback( widColorMeansQuality, XmNactivateCallback, cbGuiColorMeansQuality, this ); Widget widColorMeansEdited = XtVaCreateManagedWidget( "Color Means Edited", xmPushButtonWidgetClass, widColorMenu, NULL ); XtAddCallback( widColorMeansEdited, XmNactivateCallback, cbGuiColorMeansEdited, this ); widDimNothing_ = XtVaCreateManagedWidget( "Dim Nothing", xmPushButtonWidgetClass, widDimMenu, NULL ); XtAddCallback( widDimNothing_, XmNactivateCallback, cbDimNothing, this ); widDimUnaligned_ = XtVaCreateManagedWidget( "Dim Unaligned", xmPushButtonWidgetClass, widDimMenu, NULL ); XtAddCallback( widDimUnaligned_, XmNactivateCallback, cbDimUnaligned, this ); widDimLowQuality_ = XtVaCreateManagedWidget( "Dim Low Quality", xmPushButtonWidgetClass, widDimMenu, NULL ); XtAddCallback( widDimLowQuality_, XmNactivateCallback, cbDimLowQuality, this ); widDimLowQualityOrUnaligned_ = XtVaCreateManagedWidget( "Dim Low Quality or Unaligned", xmPushButtonWidgetClass, widDimMenu, NULL ); XtAddCallback( widDimLowQualityOrUnaligned_, XmNactivateCallback, cbDimLowQualityOrUnaligned, this ); Widget widShowConsedVersion = XtVaCreateManagedWidget( "Show Consed Version", xmPushButtonWidgetClass, widHelpMenu, NULL ); XtAddCallback( widShowConsedVersion, XmNactivateCallback, showConsedVersionMenuItemCb, this ); Widget widShowDocumentation = XtVaCreateManagedWidget( "Show Complete Documentation", xmPushButtonWidgetClass, widHelpMenu, NULL ); XtAddCallback( widShowDocumentation, XmNactivateCallback, cbGuiShowDocumentation, this ); // Widget widCreateExperiments = XtVaCreateManagedWidget( // "Create Exp", // xmPushButtonWidgetClass, // widMiscMenu, // NULL ); // XtAddCallback( widCreateExperiments, // XmNactivateCallback, // cbCreateExperiments, // this ); widShowProteinTranslationTopStrand_ = XtVaCreateManagedWidget( "Show Top Strand Protein Translation", xmPushButtonWidgetClass, widMiscMenu, NULL ); XtAddCallback( widShowProteinTranslationTopStrand_, XmNactivateCallback, cbShowProteinTranslationTopStrand, this ); widShowProteinTranslationBottomStrand_ = XtVaCreateManagedWidget( "Show Bottom Strand Protein Translation", xmPushButtonWidgetClass, widMiscMenu, NULL ); XtAddCallback( widShowProteinTranslationBottomStrand_, XmNactivateCallback, cbShowProteinTranslationBottomStrand, this ); widDontShowProteinTranslation_ = XtVaCreateManagedWidget( "Dont Show Protein Translation", xmPushButtonWidgetClass, widMiscMenu, NULL ); XtAddCallback( widDontShowProteinTranslation_, XmNactivateCallback, cbDontShowProteinTranslation, this ); Widget widShowErrorInfoForARegion = XtVaCreateManagedWidget( "Show Error Info For Region", xmPushButtonWidgetClass, widMiscMenu, NULL ); XtAddCallback( widShowErrorInfoForARegion, XmNactivateCallback, cbShowErrorInfoForARegion, this ); Widget widSaveHighlightedReads = XtVaCreateManagedWidget( "Save Highlighted Read Names to File", xmPushButtonWidgetClass, widMiscMenu, NULL ); XtAddCallback( widSaveHighlightedReads, XmNactivateCallback, cbSaveHighlightedReadNamesToFile, this ); Widget widUnhighlightAllReads = XtVaCreateManagedWidget( "Unhighlight All Reads", xmPushButtonWidgetClass, widMiscMenu, NULL ); XtAddCallback( widUnhighlightAllReads, XmNactivateCallback, cbUnhighlightAllReads, this ); Widget widChangeColor = XtVaCreateManagedWidget( "Change Color for Discrepant Bases", xmPushButtonWidgetClass, widMiscMenu, NULL ); XtAddCallback( widChangeColor, XmNactivateCallback, cbChangeColor, this ); Widget widCheckPrimer = XtVaCreateManagedWidget( "Check Primer", xmPushButtonWidgetClass, widMiscMenu, NULL ); XtAddCallback( widCheckPrimer, XmNactivateCallback, cbCheckPrimer, this ); Widget widChangeToXsToLeftInAllReads = XtVaCreateManagedWidget( "Change to X's to Left in All Reads", xmPushButtonWidgetClass, widMiscMenu, NULL ); XtAddCallback( widChangeToXsToLeftInAllReads, XmNactivateCallback, cbChangeToXsToLeftInAllReads, this ); Widget widChangeToXsToRightInAllReads = XtVaCreateManagedWidget( "Change to X's to Right in All Reads", xmPushButtonWidgetClass, widMiscMenu, NULL ); XtAddCallback( widChangeToXsToRightInAllReads, XmNactivateCallback, cbChangeToXsToRightInAllReads, this ); Widget widCreateCloneEndTagInsertToRight = XtVaCreateManagedWidget( "Add Clone End Tag with Insert to the Right", xmPushButtonWidgetClass, widMiscMenu, NULL ); XtAddCallback( widCreateCloneEndTagInsertToRight, XmNactivateCallback, cbCreateCloneEndTagInsertToRight, this ); Widget widCreateCloneEndTagInsertToLeft = XtVaCreateManagedWidget( "Add Clone End Tag with Insert to the Left", xmPushButtonWidgetClass, widMiscMenu, NULL ); XtAddCallback( widCreateCloneEndTagInsertToLeft, XmNactivateCallback, cbCreateCloneEndTagInsertToLeft, this ); Widget widTurnOnOrOffStartNumberingConsensusStartingAtUserDefinedPosition = XtVaCreateManagedWidget( "Turn On/Off User-Defined Consensus Scale Numbers", xmPushButtonWidgetClass, widMiscMenu, NULL ); XtAddCallback( widTurnOnOrOffStartNumberingConsensusStartingAtUserDefinedPosition, XmNactivateCallback, cbTurnOnOrOffStartNumberingConsensusStartingAtUserDefinedPosition, this ); Widget widShowUncalledPeakInfo = XtVaCreateManagedWidget( "Show Uncalled Peak Info About All Reads", xmPushButtonWidgetClass, widMiscMenu, NULL ); XtAddCallback( widShowUncalledPeakInfo, XmNactivateCallback, cbShowUncalledPeakInfo, this ); Widget widHorizontalLineAtCursor = XtVaCreateManagedWidget( "Toggle horizontal line at cursor", xmPushButtonWidgetClass, widMiscMenu, NULL ); XtAddCallback( widHorizontalLineAtCursor, XmNactivateCallback, cbToggleHorizontalLineAtCursor, this ); Widget widVerticalLineAtCursor = XtVaCreateManagedWidget( "Toggle vertical line at cursor", xmPushButtonWidgetClass, widMiscMenu, NULL ); XtAddCallback( widVerticalLineAtCursor, XmNactivateCallback, cbToggleVerticalLineAtCursor, this ); Widget widHowToSortAlignedReads = XtVaCreateManagedWidget( "How to sort reads", xmPushButtonWidgetClass, widMiscMenu, NULL ); XtAddCallback( widHowToSortAlignedReads, XmNactivateCallback, cbHowToSortAlignedReads, this ); Widget widTurnOnSortByQualityAtCursor = XtVaCreateManagedWidget( "Turn on: Sort by quality at cursor position", xmPushButtonWidgetClass, widSortMenu, NULL ); XtAddCallback( widTurnOnSortByQualityAtCursor, XmNactivateCallback, cbTurnOnSortByQualityAtCursor, this ); Widget widTurnOffSortByQualityAtCursor = XtVaCreateManagedWidget( "Turn off: Sort by quality at cursor position", xmPushButtonWidgetClass, widSortMenu, NULL ); XtAddCallback( widTurnOffSortByQualityAtCursor, XmNactivateCallback, cbTurnOffSortByQualityAtCursor, this ); Widget widSortOptions = XtVaCreateManagedWidget( "Sort options and help", xmPushButtonWidgetClass, widSortMenu, NULL ); XtAddCallback( widSortOptions, XmNactivateCallback, cbSortOptions, this ); //////////////////////////////////////////////////////////////// // done with menu items //////////////////////////////////////////////////////////////// nArgs = 0; XtSetArg(aArg[nArgs],XmNshadowThickness,0); nArgs++; XtSetArg(aArg[nArgs],XmNborderWidth,0); nArgs++; widForm_ = XmCreateForm(widMainWin_, "form", aArg, nArgs); XtManageChild(widForm_); XmString xmsFile, xmsFrag, xmsBasePos; // // the first thing under the menu bar is a line of text fields // these are implemented using the TextField objects, which // although members of the GuiContigWin object, must be // initialized and positioned explicitly for the sake of their // motif widgets // Assembly* pAssembly = ConsEd::pGetAssembly(); FileName soAceFileName; if (pAssembly == NULL ) { soAceFileName = "(no assembly open)"; } else { soAceFileName = pAssembly->soGetAceFileName().soGetBasename(); } widAssemblyName_ = XtVaCreateManagedWidget( "assemblyName", xmTextFieldWidgetClass, widForm_, XmNtopAttachment, XmATTACH_FORM, XmNleftAttachment, XmATTACH_FORM, XmNrightAttachment, XmATTACH_POSITION, XmNrightPosition, 45, XmNvalue, (char*) soAceFileName.data(), XmNeditable, False, XmNcursorPositionVisible, False, XmNtraversalOn, False, NULL ); widContigName_ = XtVaCreateManagedWidget( "contigName", xmTextFieldWidgetClass, widForm_, XmNtopAttachment, XmATTACH_FORM, XmNleftAttachment, XmATTACH_WIDGET, XmNleftWidget, widAssemblyName_, XmNrightAttachment, XmATTACH_POSITION, XmNrightPosition, 65, XmNvalue, "(no contig selected)", XmNeditable, False, XmNcursorPositionVisible, False, XmNtraversalOn, False, NULL ); widShowSomeTags_ = XtVaCreateManagedWidget( "Show Some Tags", xmPushButtonWidgetClass, widForm_, // XmNalignement, XmALIGNMENT_BEGINNING, XmNtraversalOn, False, XmNtopAttachment, XmATTACH_FORM, XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET, XmNbottomWidget, widContigName_, XmNleftAttachment, XmATTACH_WIDGET, XmNleftWidget, widContigName_, XmNleftOffset, nSpaceBetweenButtons, XmNrecomputeSize, True, NULL ); XtAddCallback( widShowSomeTags_, XmNactivateCallback, cbUserPushedShowSomeTagsButton, this ); setLabelOfShowSomeTagsButton(); Widget widGotoConsensusPositionLabel = XtVaCreateManagedWidget( "Pos:", xmLabelWidgetClass, widForm_, XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET, XmNtopWidget, widContigName_, XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET, XmNbottomWidget, widContigName_, XmNleftAttachment, XmATTACH_WIDGET, XmNleftWidget, widShowSomeTags_, NULL ); widClearConsensusPositionButton_ = XtVaCreateManagedWidget( "clear", xmPushButtonWidgetClass, widForm_, XmNtraversalOn, False, XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET, XmNtopWidget, widContigName_, XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET, XmNbottomWidget, widContigName_, XmNrightAttachment, XmATTACH_FORM, NULL ); XtAddCallback( widClearConsensusPositionButton_, XmNactivateCallback, (XtCallbackProc) cbClearConsensusPosition, this ); widGotoConsensusPosition_ = XtVaCreateManagedWidget( "goto consensus pos", xmTextWidgetClass, widForm_, XmNeditMode, XmSINGLE_LINE_EDIT, XmNcolumns, 8, XmNmarginHeight, 0, XmNtraversalOn, True, XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET, XmNtopWidget, widContigName_, XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET, XmNbottomWidget, widContigName_, XmNleftAttachment, XmATTACH_WIDGET, XmNleftWidget, widGotoConsensusPositionLabel, XmNrightAttachment, XmATTACH_WIDGET, XmNrightWidget, widClearConsensusPositionButton_, NULL ); XtAddCallback( widGotoConsensusPosition_, XmNactivateCallback, (XtCallbackProc) cbGotoConsensusPosition, this ); Widget widSearchForStringButton = XtVaCreateManagedWidget( "Search for String", xmPushButtonWidgetClass, widForm_, XmNtopAttachment, XmATTACH_WIDGET, XmNtopWidget, widAssemblyName_, XmNleftAttachment, XmATTACH_FORM, XmNalignment, XmALIGNMENT_BEGINNING, XmNtraversalOn, False, NULL ); XtAddCallback(widSearchForStringButton, XmNactivateCallback, (XtCallbackProc )searchForStringButtonCb, this); xmsComplementContig_ = XmStringCreateLtoR( "Compl Cont", XmSTRING_DEFAULT_CHARSET ); xmsUncomplementContig_ = XmStringCreateLtoR( "Uncompl", XmSTRING_DEFAULT_CHARSET ); // this button complements the current contig ibComplementContig_.initialize(widForm_, cbComplementContig, this, // pointer to self NULL, // client data unused "Complement Contig", true, // always visible false); // but initially inactivated nArgs = 0; XtSetArg(aArg[nArgs], XmNtopAttachment, XmATTACH_WIDGET); nArgs++; XtSetArg(aArg[nArgs], XmNtopWidget, widAssemblyName_ ); nArgs++; XtSetArg(aArg[nArgs], XmNleftAttachment, XmATTACH_WIDGET); nArgs++; XtSetArg(aArg[nArgs], XmNleftWidget, widSearchForStringButton ); nArgs++; XtSetArg(aArg[nArgs], XmNleftOffset, nSpaceBetweenButtons); nArgs++; XtSetArg(aArg[nArgs], XmNlabelString, xmsComplementContig_); nArgs++; XtSetValues(ibComplementContig_.widGet(), aArg, nArgs); ibCompareContigs_.initialize( widForm_, cbCompareContigs, this, NULL, "Compare Cont", true, false ); XtVaSetValues( ibCompareContigs_.widGet(), XmNtopAttachment, XmATTACH_WIDGET, XmNtopWidget, widAssemblyName_, XmNleftAttachment, XmATTACH_WIDGET, XmNleftWidget, ibComplementContig_.widGet(), XmNleftOffset, nSpaceBetweenButtons, NULL ); Widget widFindMainWindow = XtVaCreateManagedWidget( "Find Main Win", xmPushButtonWidgetClass, widForm_, XmNalignment, XmALIGNMENT_BEGINNING, XmNtraversalOn, False, XmNtopAttachment, XmATTACH_WIDGET, XmNtopWidget, widAssemblyName_, XmNleftAttachment, XmATTACH_WIDGET, XmNleftWidget, ibCompareContigs_.widGet(), XmNleftOffset, nSpaceBetweenButtons, NULL ); XtAddCallback( widFindMainWindow, XmNactivateCallback, cbFindMainWindow, this ); widErrorRateButton_ = XtVaCreateManagedWidget( "Err/10kb:", xmPushButtonWidgetClass, widForm_, XmNtraversalOn, False, XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET, XmNtopWidget, ibCompareContigs_.widGet(), XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET, XmNbottomWidget, ibCompareContigs_.widGet(), XmNleftAttachment, XmATTACH_WIDGET, XmNleftWidget, widFindMainWindow, XmNleftOffset, nSpaceBetweenButtons, NULL ); XtAddCallback( widErrorRateButton_, XmNactivateCallback, (XtCallbackProc) cbErrorRateButton, this ); widErrorRate_ = XtVaCreateManagedWidget( "error rate", xmTextWidgetClass, widForm_, XmNeditable, False, XmNcolumns, 6, XmNmarginHeight, 0, XmNtraversalOn, False, XmNcursorPositionVisible, False, XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET, XmNtopWidget, ibCompareContigs_.widGet(), XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET, XmNbottomWidget, ibCompareContigs_.widGet(), XmNleftAttachment, XmATTACH_WIDGET, XmNleftWidget, widErrorRateButton_, XmNleftOffset, nSpaceBetweenButtons, XmNrightAttachment, XmATTACH_FORM, NULL ); // bottom buttons // // put a dismiss button on the botton right // widDismissButton_ = XtVaCreateManagedWidget( "dismiss", xmPushButtonWidgetClass, widForm_, XmNbottomAttachment, XmATTACH_FORM, XmNrightAttachment, XmATTACH_FORM, XmNrightOffset, 15, XmNtraversalOn, False, NULL ); XtAddCallback( widDismissButton_, XmNactivateCallback, (XtCallbackProc) dismissXtCb, this ); // place other bottoms left to right along the bottom Widget widScrollToLeftEndOfConsensus = XtVaCreateManagedWidget( "<<<", xmPushButtonWidgetClass, widForm_, XmNbottomAttachment, XmATTACH_FORM, XmNleftAttachment, XmATTACH_FORM, XmNtraversalOn, False, NULL ); XtAddCallback( widScrollToLeftEndOfConsensus, XmNactivateCallback, (XtCallbackProc) cbScrollToLeftEndOfConsensus, this ); Widget widScrollLeftLeft = XtVaCreateManagedWidget( "<<", xmPushButtonWidgetClass, widForm_, XmNbottomAttachment, XmATTACH_FORM, XmNleftAttachment, XmATTACH_WIDGET, XmNleftWidget, widScrollToLeftEndOfConsensus, XmNtraversalOn, False, NULL ); XtAddCallback( widScrollLeftLeft, XmNactivateCallback, (XtCallbackProc) cbScrollLeftLeft, this ); Widget widScrollLeft = XtVaCreateManagedWidget( "<", xmPushButtonWidgetClass, widForm_, // XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET, // XmNtopWidget, widDismissButton_, XmNbottomAttachment, XmATTACH_FORM, XmNleftAttachment, XmATTACH_WIDGET, XmNleftWidget, widScrollLeftLeft, XmNtraversalOn, False, NULL ); XtAddCallback( widScrollLeft, XmNactivateCallback, (XtCallbackProc) cbScrollLeft, this ); Widget widPrev = XtVaCreateManagedWidget( "Prev", xmPushButtonWidgetClass, widForm_, XmNbottomAttachment, XmATTACH_FORM, XmNleftAttachment, XmATTACH_WIDGET, XmNleftWidget, widScrollLeft, XmNtraversalOn, False, NULL ); XtAddCallback( widPrev, XmNactivateCallback, cbPrev, this ); Widget widNext = XtVaCreateManagedWidget( "Next", xmPushButtonWidgetClass, widForm_, XmNbottomAttachment, XmATTACH_FORM, XmNleftAttachment, XmATTACH_WIDGET, XmNleftWidget, widPrev, XmNtraversalOn, False, NULL ); XtAddCallback( widNext, XmNactivateCallback, cbNext, this ); Widget widScrollRight = XtVaCreateManagedWidget( ">", xmPushButtonWidgetClass, widForm_, XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET, XmNtopWidget, widDismissButton_, XmNbottomAttachment, XmATTACH_FORM, XmNleftAttachment, XmATTACH_WIDGET, XmNleftWidget, widNext, XmNtraversalOn, False, NULL ); XtAddCallback( widScrollRight, XmNactivateCallback, (XtCallbackProc) cbScrollRight, this ); Widget widScrollRightRight = XtVaCreateManagedWidget( ">>", xmPushButtonWidgetClass, widForm_, XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET, XmNtopWidget, widDismissButton_, XmNbottomAttachment, XmATTACH_FORM, XmNleftAttachment, XmATTACH_WIDGET, XmNleftWidget, widScrollRight, XmNtraversalOn, False, NULL ); XtAddCallback( widScrollRightRight, XmNactivateCallback, (XtCallbackProc) cbScrollRightRight, this ); Widget widScrollToRightEndOfConsensus = XtVaCreateManagedWidget( ">>>", xmPushButtonWidgetClass, widForm_, XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET, XmNtopWidget, widDismissButton_, XmNbottomAttachment, XmATTACH_FORM, XmNleftAttachment, XmATTACH_WIDGET, XmNleftWidget, widScrollRightRight, XmNtraversalOn, False, NULL ); XtAddCallback( widScrollToRightEndOfConsensus, XmNactivateCallback, cbScrollToRightEndOfConsensus, this ); Widget widGotoCursor = XtVaCreateManagedWidget( "cursor", xmPushButtonWidgetClass, widForm_, XmNbottomAttachment, XmATTACH_FORM, XmNleftAttachment, XmATTACH_WIDGET, XmNleftWidget, widScrollToRightEndOfConsensus, XmNtraversalOn, False, NULL ); XtAddCallback( widGotoCursor, XmNactivateCallback, cbGotoCursor, this ); widMessageWindowAtBottom_ = XtVaCreateManagedWidget( "messages", xmTextWidgetClass, widForm_, XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET, XmNtopWidget, widDismissButton_, XmNbottomAttachment, XmATTACH_FORM, XmNleftAttachment, XmATTACH_WIDGET, XmNleftWidget, widGotoCursor, XmNrightAttachment, XmATTACH_WIDGET, XmNrightWidget, widDismissButton_, XmNtraversalOn, True, XmNeditable, False, XmNeditMode, XmSINGLE_LINE_EDIT, XmNcursorPositionVisible, True, XmNmarginHeight, 0, NULL ); // // create the scrolled window widget // nArgs = 0; // attach the scrolled window to the form XtSetArg(aArg[nArgs], XmNtopAttachment, XmATTACH_WIDGET); nArgs++; XtSetArg(aArg[nArgs], XmNtopWidget, ibComplementContig_.widGet()); nArgs++; XtSetArg(aArg[nArgs], XmNbottomAttachment, XmATTACH_WIDGET); nArgs++; XtSetArg(aArg[nArgs], XmNbottomWidget, widDismissButton_ ); nArgs++; XtSetArg(aArg[nArgs], XmNleftAttachment, XmATTACH_FORM); nArgs++; XtSetArg(aArg[nArgs], XmNrightAttachment, XmATTACH_FORM); nArgs++; widScrolledWin_ = XmCreateScrolledWindow(widForm_, "scrolled", aArg, nArgs); XtManageChild(widScrolledWin_); // // create the scrollbar // nArgs = 0; XtSetArg(aArg[nArgs], XmNorientation, XmHORIZONTAL ); nArgs++; XtSetArg(aArg[nArgs], XmNminimum, 0); nArgs++; widHorizontalScrollBar_ = XmCreateScrollBar(widScrolledWin_, "scrollbar", aArg, nArgs); XtManageChild(widHorizontalScrollBar_); // add scrollbar callbacks XtAddCallback(widHorizontalScrollBar_, XmNvalueChangedCallback, (XtCallbackProc )horizontalScrollBarXtCb, this); XtAddCallback(widHorizontalScrollBar_, XmNdragCallback, (XtCallbackProc )horizontalScrollBarXtCb, this); // // create the vertical scrollbar // nArgs = 0; XtSetArg(aArg[nArgs], XmNorientation, XmVERTICAL ); nArgs++; XtSetArg(aArg[nArgs], XmNminimum, 0); nArgs++; widVerticalScrollBar_ = XmCreateScrollBar(widScrolledWin_, "scrollbar", aArg, nArgs); XtManageChild(widVerticalScrollBar_); // add scrollbar callbacks XtAddCallback(widVerticalScrollBar_, XmNvalueChangedCallback, (XtCallbackProc )verticalScrollBarXtCb, this); XtAddCallback(widVerticalScrollBar_, XmNdragCallback, (XtCallbackProc )verticalScrollBarXtCb, this); // // create the drawing ("contig") window // nArgs = 0; widContigWin_ = XmCreateDrawingArea(widScrolledWin_, "contigwin", aArg, nArgs); XtManageChild(widContigWin_); XtAddCallback(widContigWin_, XmNresizeCallback, (XtCallbackProc )resizeXtCb, this); XtAddCallback(widContigWin_, XmNinputCallback, (XtCallbackProc )inputXtCb, this); XtAddCallback( widContigWin_, XmNexposeCallback, (XtCallbackProc ) exposureXtCb, this ); XtAddEventHandler( widContigWin_, Button1MotionMask, False, (XtEventHandler) guiContigWinButton1MotionXtEventHandler, this ); XtAddEventHandler( widContigWin_, Button2MotionMask, False, (XtEventHandler) guiContigWinButton2MotionXtEventHandler, this ); XtAddEventHandler( widContigWin_, PointerMotionMask, False, (XtEventHandler) guiContigWinPointerMotionEventHandler, this ); // // allocate graphics contexts for the scale // pGctScale_ = new GuiColorText( ColorDefaults::pGetColorDefaults()->soColorScale_, "Black" ); pGctScaleNumbers_ = new GuiColorText( ColorDefaults::pGetColorDefaults()->soColorScale_, ColorDefaults::pGetColorDefaults()->soColorScaleBackground_ ); pGctFragmentNames_ = pGctScaleNumbers_; pGctFragmentNamesHighlighted_ = new GuiColorText( ColorDefaults::pGetColorDefaults()->soColorHighlightedReadNames_, "Black" ); pGctConsensusLabel_ = new GuiColorText( ColorDefaults::pGetColorDefaults()->soColorConsensusLabel_, ColorDefaults::pGetColorDefaults()->soColorConsensusLabelBackground_ ); pGctConsensusCursor_ = new GuiColorText( ColorDefaults::pGetColorDefaults()->soColorMode_editCursorForeground_, ColorDefaults::pGetColorDefaults()->soColorMode_editCursorBackground_ ); pGctSequencingDirection_ = new GuiColorText( ColorDefaults::pGetColorDefaults()->soColorSequencingDirectionArrow_, "Black" ); pGctSequencingDirectionTraceIsUp_ = new GuiColorText( ColorDefaults::pGetColorDefaults()->soColorSequencingDirectionArrowTracesUp_, "Black" ); pGuiColorTextForHighlightedBases_ = new GuiColorText( ColorDefaults::pGetColorDefaults()->soColorHighlightForegroundX_, ColorDefaults::pGetColorDefaults()->soColorHighlightBackground_ ); pGctProteinTranslation_ = new GuiColorText( ColorDefaults::pGetColorDefaults()->soColorProteinTranslation_, "Black" ); pGctProteinTranslationLabels_ = new GuiColorText( ColorDefaults::pGetColorDefaults()->soColorProteinTranslationLabels_, "Black" ); pGctProteinStartCodon_ = new GuiColorText( ColorDefaults::pGetColorDefaults()->soColorProteinStartCodon_, "Black" ); pGctProteinStopCodon_ = new GuiColorText( ColorDefaults::pGetColorDefaults()->soColorProteinStopCodon_, "Black" ); pGctHorizontalLineAtCursor_ = new GuiColorText( ColorDefaults::pGetColorDefaults()->soColorHorizontalLineAtCursor_, "Black" ); pGctVerticalLineAtCursor_ = new GuiColorText( ColorDefaults::pGetColorDefaults()->soColorVerticalLineAtCursor_, "Black" ); /*------------------------------------------------------------*/ /* for now, we want enough room for a scale */ /*------------------------------------------------------------*/ // nFragmentBasesBaselinePixelY_ = nConsensusSeparatorLinePixelY_ + // rGap_.nGetFontAscent() + 1 + nPixelMarginAboveFragmentBases; // and no +1 is necessary here for the same reason // nFragmentBasesTopPixelY_ = nFragmentBasesBaselinePixelY_ - GuiApp::pGetGuiApp()->nGetFontAscent(); // get this ready--when the time comes to use them, don't have to // redo all of this aPointRight[0].x = 0; aPointRight[0].y = - (int ) (.5 * GuiApp::pGetGuiApp()->nGetFontHeight()); aPointRight[1].x = 0; aPointRight[1].y = 0; aPointRight[2].x = (int) (GuiApp::pGetGuiApp()->nGetFontHeight()); aPointRight[2].y = - (int) (.25 * GuiApp::pGetGuiApp()->nGetFontHeight() ); aPointRight[3] = aPointRight[0]; aPointLeft[0].x = (int) (GuiApp::pGetGuiApp()->nGetFontHeight()); aPointLeft[0].y = - (int) (.5 * GuiApp::pGetGuiApp()->nGetFontHeight() ); aPointLeft[1].x = (int) (GuiApp::pGetGuiApp()->nGetFontHeight()); aPointLeft[1].y = 0; aPointLeft[2].x = 0; aPointLeft[2].y = - (int) (.25 * GuiApp::pGetGuiApp()->nGetFontHeight() ); aPointLeft[3] = aPointLeft[0]; // This must be done before calling resizeContigWindow setScreenForProteinTranslation( consedParameters::pGetConsedParameters()->nShowProteinTranslation_ ); resizeContigWindow( consedParameters::pGetConsedParameters()->nAlignedReadsWindowInitialCharsWide_, consedParameters::pGetConsedParameters()->nAlignedReadsWindowInitialCharsHigh_ ); // now create popup menu nArgs = 0; widPopupMenu_ = XmCreatePopupMenu( widContigWin_, "popup", aArg, nArgs ); XtAddCallback( widPopupMenu_, XmNunmapCallback, cbResetPopupMenuLabels, this ); Widget widPickForwardPrimerFromSubclone = XtVaCreateManagedWidget( "Pick --> (Top Strand) Primer from Subclone (M13, plasmid) template", xmPushButtonWidgetClass, widPopupMenu_, NULL ); XtAddCallback( widPickForwardPrimerFromSubclone, XmNactivateCallback, (XtCallbackProc) cbGuiPickForwardPrimerFromSubclone, this ); Widget widPickReversePrimerFromSubclone = XtVaCreateManagedWidget( "Pick <-- (Bottom Strand) Primer from Subclone (M13, plasmid) template", xmPushButtonWidgetClass, widPopupMenu_, NULL ); XtAddCallback( widPickReversePrimerFromSubclone, XmNactivateCallback, (XtCallbackProc) cbGuiPickReversePrimerFromSubclone, this ); Widget widPickForwardPrimerFromClone = XtVaCreateManagedWidget( "Pick --> (Top Strand) Primer from Clone (BAC, cosmid) template", xmPushButtonWidgetClass, widPopupMenu_, NULL ); XtAddCallback( widPickForwardPrimerFromClone, XmNactivateCallback, (XtCallbackProc) cbGuiPickForwardPrimerFromClone, this ); Widget widPickReversePrimerFromClone = XtVaCreateManagedWidget( "Pick <-- (Bottom Strand) Primer from Clone (BAC, cosmid) template", xmPushButtonWidgetClass, widPopupMenu_, NULL ); XtAddCallback( widPickReversePrimerFromClone, XmNactivateCallback, (XtCallbackProc) cbGuiPickReversePrimerFromClone, this ); Widget widTellPhrapToNotOverlapReadDiscrepantAtThisLocation = XtVaCreateManagedWidget( "Tell phrap to not overlap reads discrepant at this location", xmPushButtonWidgetClass, widPopupMenu_, NULL ); XtAddCallback( widTellPhrapToNotOverlapReadDiscrepantAtThisLocation, XmNactivateCallback, (XtCallbackProc) cbGuiTellPhrapToNotOverlapReadsDiscrepantAtThisLocation, this ); Widget widMakeAllReadsNAtThisLocation = XtVaCreateManagedWidget( "Make all reads N's in this column", xmPushButtonWidgetClass, widPopupMenu_, NULL ); XtAddCallback( widMakeAllReadsNAtThisLocation, XmNactivateCallback, (XtCallbackProc) cbGuiMakeAllReadsNAtThisLocation, this ); Widget widTearContigs = XtVaCreateManagedWidget( "Tear contig at this consensus position", xmPushButtonWidgetClass, widPopupMenu_, NULL ); XtAddCallback( widTearContigs, XmNactivateCallback, (XtCallbackProc) cbGuiTearContigs, this ); Widget widShowAllTraces = XtVaCreateManagedWidget( "Display traces for all reads", xmPushButtonWidgetClass, widPopupMenu_, NULL ); XtAddCallback( widShowAllTraces, XmNactivateCallback, (XtCallbackProc) cbGuiShowAllTraces, this ); } void GuiContigWin :: makeVisible() { XtPopup( widMainWinTopLevelShell_, XtGrabNone ); } // // callbacks for infobuttons // these are not strictly Xt callbacks, rather callbacks // supplied to the generic infobutton ctor. // void cbComplementContig(void* clientThis, void* clientData) { GuiContigWin* pGuiContigWin = (GuiContigWin* )clientThis; TRY_CATCH_WRAPPER( pGuiContigWin->toggleComplementContigButtonLabel() ); TRY_CATCH_WRAPPER( pGuiContigWin->pContigWin_->complementContig() ); } void cbCompareContigs( void* clientThis, void* clientData ) { GuiContigWin* pGuiContigWin = (GuiContigWin*) clientThis; TRY_CATCH_WRAPPER( ConsEd::pGetConsEd()->ccompareContigs( pGuiContigWin->pContigWin_ ) ); } // void cbCreateExperiments( Widget wid, // XtPointer pClientThis, // XtPointer pClientData ) { // GuiContigWin* pGuiContigWin = (GuiContigWin*) pClientThis; // TRY_CATCH_WRAPPER( pGuiContigWin->pContigWin_->createExperimentsList() ); // } void cbErrorRateButton( Widget wid, XtPointer pClientThis, XtPointer pClientData ) { GuiContigWin* pGuiContigWin = (GuiContigWin*) pClientThis; TRY_CATCH_WRAPPER( pGuiContigWin->pContigWin_->displayContigErrorRate() ); } static void cbFindMainWindow( Widget wid, XtPointer pClientThis, XtPointer pClientData ) { TRY_CATCH_WRAPPER( GuiApp::pGetGuiApp()->findTopWindow() ); } void GuiContigWin :: toggleComplementContigButtonLabel() { XmString xmsCurrentLabel; XtVaGetValues( ibComplementContig_.widGet(), XmNlabelString, &xmsCurrentLabel, NULL ); if (XmStringCompare( xmsCurrentLabel, xmsComplementContig_ ) ) { XtVaSetValues( ibComplementContig_.widGet(), XmNlabelString, xmsUncomplementContig_, NULL ); } else { XtVaSetValues( ibComplementContig_.widGet(), XmNlabelString, xmsComplementContig_, NULL ); } } static void cbScrollLeft( Widget wid, XtPointer pClientData, XtPointer pCallData ) { GuiContigWin* pGuiContigWin = (GuiContigWin*) pClientData; TRY_CATCH_WRAPPER( pGuiContigWin->pContigWin_->scrollLeft() ); } static void cbScrollLeftLeft( Widget wid, XtPointer pClientData, XtPointer pCallData ) { GuiContigWin* pGuiContigWin = (GuiContigWin*) pClientData; TRY_CATCH_WRAPPER( pGuiContigWin->pContigWin_->scrollLeftLeft() ); } static void cbScrollRight( Widget wid, XtPointer pClientData, XtPointer pCallData ) { GuiContigWin* pGuiContigWin = (GuiContigWin*) pClientData; TRY_CATCH_WRAPPER( pGuiContigWin->pContigWin_->scrollRight() ); } static void cbScrollRightRight( Widget wid, XtPointer pClientData, XtPointer pCallData ) { GuiContigWin* pGuiContigWin = (GuiContigWin*) pClientData; TRY_CATCH_WRAPPER( pGuiContigWin->pContigWin_->scrollRightRight() ); } // // this is the Xt callback for the scroll bar. // does no translation of the value // void horizontalScrollBarXtCb(Widget widSb, GuiContigWin* pGcw, XmScrollBarCallbackStruct *pCbStruct) { // send a message to client via passed callback TRY_CATCH_WRAPPER(pGcw->pContigWin_->horizontalScrollBarMoved(pCbStruct->value)); } // // this is the Xt callback for the vertical scroll bar. // does no translation of the value // void verticalScrollBarXtCb(Widget widSb, GuiContigWin* pGcw, XmScrollBarCallbackStruct *pCbStruct) { // send a message to client via passed callback TRY_CATCH_WRAPPER(pGcw->pContigWin_->verticalScrollBarMoved(pCbStruct->value)); } void GuiContigWin :: guiResetSlider(const int nVal, const int nMin, const int nMax, const int nSize) { Arg aArg[20]; int nArgs; nArgs = 0; XtSetArg(aArg[nArgs], XmNminimum, nMin); nArgs++; // note that the slider will report a maximum XmNvalue of // XmNmaximum - XmNsliderSize // This means that the window will display values from // XmNmaximum - XmNsliderSize to // XmNmaximum - XmNsliderSize + width_of_screen - 1 // If we make the width of the screen be XmNsliderSize, // then the maximum column value will be XmNmaximum - 1. // Hence the + 1 below. XtSetArg(aArg[nArgs], XmNmaximum, nMax + 1); nArgs++; XtSetArg(aArg[nArgs], XmNvalue, nVal ); nArgs++; XtSetArg(aArg[nArgs], XmNsliderSize, nSize); nArgs++; int nPageByThisManyBases = nSize - nNumberOfBasesToOverlapWhenPaging; if (nPageByThisManyBases < 1) nPageByThisManyBases = 1; XtSetArg(aArg[nArgs], XmNpageIncrement, nPageByThisManyBases); nArgs++; XtSetValues(widHorizontalScrollBar_, aArg, nArgs); } void GuiContigWin :: guiResetSliderMax( const int nMax ) { Arg aArg[20]; int nArgs; nArgs = 0; // note that the slider will report a maximum XmNvalue of // XmNmaximum - XmNsliderSize // This means that the window will display values from // XmNmaximum - XmNsliderSize to // XmNmaximum - XmNsliderSize + width_of_screen - 1 // If we make the width of the screen be XmNsliderSize, // then the maximum column value will be XmNmaximum - 1. // Hence the + 1 below. XtSetArg(aArg[nArgs], XmNmaximum, nMax + 1); nArgs++; XtSetValues(widHorizontalScrollBar_, aArg, nArgs); } void GuiContigWin :: guiResizeSlider() { Arg aArg[20]; int nArgs; nArgs = 0; XtSetArg(aArg[nArgs], XmNsliderSize, nGetDisplayedBasesWide()); nArgs++; int nPageByThisManyBases = nGetDisplayedBasesWide() - nNumberOfBasesToOverlapWhenPaging; if (nPageByThisManyBases < 1) nPageByThisManyBases = 1; XtSetArg(aArg[nArgs], XmNpageIncrement, nPageByThisManyBases); nArgs++; XtSetValues(widHorizontalScrollBar_, aArg, nArgs); } // used when the user changes the window size void GuiContigWin :: guiResizeVerticalScrollBar() { int nMax; XtVaGetValues( widVerticalScrollBar_, XmNmaximum, &nMax, NULL ); int nSliderSize = nGetDisplayedReadsHigh(); if (nSliderSize > nMax ) nSliderSize = nMax; if (nSliderSize < 1 ) nSliderSize = 1; int nPageByThisManyReads = nGetDisplayedReadsHigh() - nNumberOfReadsToOverlapWhenPaging; if (nPageByThisManyReads < 1) nPageByThisManyReads = 1; if (nPageByThisManyReads > nMax) nPageByThisManyReads = nMax; XtVaSetValues( widVerticalScrollBar_, XmNpageIncrement, nPageByThisManyReads, XmNsliderSize, nSliderSize, NULL ); } void GuiContigWin :: guiSetSliderPos(const int nPos) { Arg aArg[10]; int nArgs; nArgs = 0; XtSetArg(aArg[nArgs], XmNvalue, nPos); nArgs++; XtSetValues(widHorizontalScrollBar_, aArg, nArgs); } void GuiContigWin :: guiResetVerticalScrollBar(const int nVal, const int nMin, const int nMax, const int nSize) { Arg aArg[20]; int nArgs; nArgs = 0; XtSetArg(aArg[nArgs], XmNminimum, nMin); nArgs++; // note that the slider will report a maximum XmNvalue of // XmNmaximum - XmNsliderSize // This means that the window will display values from // XmNmaximum - XmNsliderSize to // XmNmaximum - XmNsliderSize + height_of_screen - 1 // If we make XmNsliderSize to be the height of the screen, // then the maximum row value will be XmNmaximum - 1. // Hence the + 1 below. // There was a bug in which the vertical scrollbar was scrolled down, // and then the user horizontal scrolled to an area of lower coverage, // causing the max value to decrease, which caused the scrollbar to // fill the screen and the user could no longer scroll up. // I believe the solution is that when scrolled down this far, we // need to keep XmNmaximum so it can accommodate this current value // of the scrollbar. // Typically, nMax is set to pContigView_->nGetNumberOfFragments() - 1 int nSize2 = nSize; if (nSize2 < 1 ) nSize2 = 1; int nMax2 = nMax; if ( nVal > nMax2 ) nMax2 = nVal + nSize2 - 1; else if ( nVal > (nMax2 + 1 -nSize2 ) ) nSize2 = nMax2 + 1 - nVal; // there is an error if the XmNsliderSize > XmNmaximum // so there is an error if XmNsliderSize > nMax2 + 1 if (nSize2 > (nMax2 + 1) ) nSize2 = nMax2 + 1; XtSetArg(aArg[nArgs], XmNmaximum, nMax2 + 1); nArgs++; XtSetArg(aArg[nArgs], XmNvalue, nVal ); nArgs++; XtSetArg(aArg[nArgs], XmNsliderSize, nSize2); nArgs++; int nPageByThisManyBases = nSize2; XtSetArg(aArg[nArgs], XmNpageIncrement, nPageByThisManyBases); nArgs++; XtSetValues(widVerticalScrollBar_, aArg, nArgs); // cout << "guiResetVerticalScrollBar nValue=" << nVal << // " XmNmin=" << nMin << " XmNmax=" << nMax2+1 << " XmNsliderSize=" << nSize2 << " XmNpageI=" << nPageByThisManyBases << endl; } //////////////////////////////////////////////////////////// // // PURPOSE: the REAL expose callback (that X calls) // calls cbGuiContigWinExposure, which is a GuiContigWin/Consed hybrid // // REV: Feb 2, 1995 (David Gordon) // //////////////////////////////////////////////////////////// void exposureXtCb( Widget widCw, GuiContigWin* pGcw, XmDrawingAreaCallbackStruct *pCb ) { TRY_CATCH_WRAPPER( pGcw->pContigWin_->drawBasesAndConsensus( false ) ); // no need, I think, to erase first } void dismissXtCb( Widget widCw, GuiContigWin* pGcw, XmDrawingAreaCallbackStruct *pCb ) { TRY_CATCH_WRAPPER( pGcw->pContigWin_->deleteIfOK() ); } // // these have to be here (instead of guicontigwin.h) because // consed.h cannot be included in guicontigwin.h // int GuiContigWin :: nForFragsVisible() const { return pContigWin_->nGetForFragsVisible(); // ask the consed } int GuiContigWin :: nRevFragsVisible() const { return pContigWin_->nGetRevFragsVisible(); // ask the consed } // debug void GuiContigWin :: dumpRealEstate () { cout << "GuiApp::pGetGuiApp()->nGetFontHeight " << GuiApp::pGetGuiApp()->nGetFontHeight() << endl << "nForFragsVisible " << nForFragsVisible() << endl << "nRevFragsVisible " << nRevFragsVisible() << endl << "nFragmentBasesStartPixelX " << nFragmentBasesStartPixelX() << endl << "nDirectionIndicatorPixelX " << nDirectionIndicatorPixelX() << endl << "nScaleLinePixelY " << nScaleLinePixelY() << endl << "nScaleMarksHeight " << nScaleMarksHeight() << endl << "nScaleNumbersBaseline " << nScaleNumbersBaseline() << endl << "nConsensusBaselinePixelY " << nConsensusBaselinePixelY() << endl << "nConsensusSeparatorLinePixelY " << nConsensusSeparatorLinePixelY() << endl << "nForFragLineTopPixelY " << nForFragLineTopPixelY() << endl << "nForFragLineBaselinePixelY " << nForFragLineBaselinePixelY() << endl << "nDirectionSepLinePixelY " << nDirectionSepLinePixelY() << endl << "nGetDirectionSepLineHeightPixels " << nGetDirectionSepLineHeightPixels() << endl << "nFragmentNameXPixelPosition " << nFragmentNameXPixelPosition() << endl << "nRevFragLineTopPixelY " << nRevFragLineTopPixelY() << endl << "nRevFragLineBaselinePixelY " << nRevFragLineBaselinePixelY() << endl << "nGetFragmentBasesMaxPixelY " << nGetFragmentBasesMaxPixelY() << endl << endl; cout.flush(); } void GuiContigWin :: getScrollBarData( int& nMin, int& nMax, int& nVal, int& nSize ) { Arg aArg[20]; int nArgs; nArgs = 0; XtSetArg(aArg[nArgs], XmNminimum, &nMin); nArgs++; XtSetArg(aArg[nArgs], XmNmaximum, &nMax); nArgs++; XtSetArg(aArg[nArgs], XmNvalue, &nVal ); nArgs++; XtSetArg(aArg[nArgs], XmNsliderSize, &nSize); nArgs++; XtGetValues(widHorizontalScrollBar_, aArg, nArgs); } void cbGuiExportConsensus( Widget w, XtPointer client_data, XtPointer call_data) { GuiContigWin* pGuiContigWin = (GuiContigWin*) client_data; TRY_CATCH_WRAPPER( cbExportConsensus( pGuiContigWin->pContigWin_ ) ); } void cbGuiCreateMultiProblemNavigator( Widget w, XtPointer pClientData, XtPointer pCallData ) { GuiContigWin* pGuiContigWin = (GuiContigWin*) pClientData; TRY_CATCH_WRAPPER( pGuiContigWin->pContigWin_->createMultiProblemNavigator() ); } void cbGuiCreateLowConsensusQualityNavigator( Widget w, XtPointer client_data, XtPointer call_data) { GuiContigWin* pGuiContigWin = (GuiContigWin*) client_data; ContigWin* pContigWin = pGuiContigWin->pContigWin_; TRY_CATCH_WRAPPER( pContigWin->createLowConsensusQualityNavigator() ); } void cbGuiCreateHighQualityDiscrepancyNavigator( Widget w, XtPointer client_data, XtPointer call_data) { GuiContigWin* pGuiContigWin = (GuiContigWin*) client_data; ContigWin* pContigWin = pGuiContigWin->pContigWin_; TRY_CATCH_WRAPPER( pContigWin->createHighQualityDiscrepancyNavigator( false, false ) ); // ignore compression tags and G_dropout tags } void cbGuiCreateHighQualityDiscrepancyNavigatorWithoutCompressionsOrG_dropouts( Widget w, XtPointer client_data, XtPointer call_data) { GuiContigWin* pGuiContigWin = (GuiContigWin*) client_data; ContigWin* pContigWin = pGuiContigWin->pContigWin_; TRY_CATCH_WRAPPER( pContigWin->createHighQualityDiscrepancyNavigator( true, false ) ); // exclude in compression tags and G_dropout tags } void cbGuiCreateEditedNavigator( Widget w, XtPointer client_data, XtPointer call_data) { GuiContigWin* pGuiContigWin = (GuiContigWin*) client_data; ContigWin* pContigWin = pGuiContigWin->pContigWin_; TRY_CATCH_WRAPPER( pContigWin->createEditedNavigator() ); } void cbGuiCreateEditedButNotNsNavigator( Widget w, XtPointer client_data, XtPointer call_data) { GuiContigWin* pGuiContigWin = (GuiContigWin*) client_data; ContigWin* pContigWin = pGuiContigWin->pContigWin_; TRY_CATCH_WRAPPER( pContigWin->createEditedButNotNsNavigator() ); } void cbGuiCreateTagsNavigator( Widget w, XtPointer client_data, XtPointer call_data) { GuiContigWin* pGuiContigWin = (GuiContigWin*) client_data; ContigWin* pContigWin = pGuiContigWin->pContigWin_; TRY_CATCH_WRAPPER( pContigWin->createTagsNavigator() ); } void cbGuiCreateUnalignedHighQualityNavigator( Widget w, XtPointer client_data, XtPointer call_data) { GuiContigWin* pGuiContigWin = (GuiContigWin*) client_data; ContigWin* pContigWin = pGuiContigWin->pContigWin_; TRY_CATCH_WRAPPER( pContigWin->createUnalignedHighQualityNavigator2() ); } void cbSearchForSingleStrandedRegions( Widget w, XtPointer pClientData, XtPointer call_data) { GuiContigWin* pGuiContigWin = (GuiContigWin*) pClientData; TRY_CATCH_WRAPPER( searchForSingleStrandedRegions( pGuiContigWin->widGetGuiContigWinTopLevel(), pGuiContigWin->pContigWin_->pGetContig(), pGuiContigWin->pContigWin_ ) ); } void cbSearchForSingleSubcloneRegions( Widget w, XtPointer pClientData, XtPointer call_data) { GuiContigWin* pGuiContigWin = (GuiContigWin*) pClientData; TRY_CATCH_WRAPPER( searchForSingleSubcloneRegions( pGuiContigWin->widGetGuiContigWinTopLevel(), pGuiContigWin->pContigWin_->pGetContig(), pGuiContigWin->pContigWin_ ) ); } void cbToggleNavigateAutomaticTracePopup( Widget wid, XtPointer pClientData, XtPointer pCallData ) { consedParameters::pGetConsedParameters()->bNavigateAutomaticTracePopup_ = ! consedParameters::pGetConsedParameters()->bNavigateAutomaticTracePopup_; } void cbGuiContigInfo( Widget w, XtPointer client_data, XtPointer call_data) { GuiContigWin* pGuiContigWin = (GuiContigWin*) client_data; ContigWin* pContigWin = pGuiContigWin->pContigWin_; TRY_CATCH_WRAPPER( pContigWin->showContigInfo( ) ); } void cbGuiColorMeansMatch( Widget w, XtPointer client_data, XtPointer call_data) { GuiContigWin* pGuiContigWin = (GuiContigWin*) client_data; ContigWin* pContigWin = pGuiContigWin->pContigWin_; TRY_CATCH_WRAPPER( pContigWin->colorMeansMatch() ); } void cbGuiColorMeansQuality( Widget w, XtPointer client_data, XtPointer call_data) { GuiContigWin* pGuiContigWin = (GuiContigWin*) client_data; ContigWin* pContigWin = pGuiContigWin->pContigWin_; TRY_CATCH_WRAPPER( pContigWin->colorMeansQuality() ); } void cbGuiColorMeansEdited( Widget w, XtPointer client_data, XtPointer call_data) { GuiContigWin* pGuiContigWin = (GuiContigWin*) client_data; ContigWin* pContigWin = pGuiContigWin->pContigWin_; TRY_CATCH_WRAPPER( pContigWin->colorMeansEdited() ); } void cbGuiColorMeansQualityAndTags( Widget w, XtPointer client_data, XtPointer call_data) { GuiContigWin* pGuiContigWin = (GuiContigWin*) client_data; ContigWin* pContigWin = pGuiContigWin->pContigWin_; TRY_CATCH_WRAPPER( pContigWin->colorMeansQualityAndTags() ); } void cbGuiColorMeansEditedAndTags( Widget w, XtPointer client_data, XtPointer call_data) { GuiContigWin* pGuiContigWin = (GuiContigWin*) client_data; ContigWin* pContigWin = pGuiContigWin->pContigWin_; TRY_CATCH_WRAPPER( pContigWin->colorMeansEditedAndTags() ); } void cbGuiShowDocumentation( Widget w, XtPointer client_data, XtPointer call_data) { TRY_CATCH_WRAPPER( new guiPopupDocumentation() ); } void guiContigWinButton1MotionXtEventHandler(Widget, XtPointer client_data, XEvent* pEvent, Boolean* ) { int nPixelX = pEvent->xmotion.x; int nPixelY = pEvent->xmotion.y; unsigned long ulSerial = pEvent->xmotion.serial; GuiContigWin *pGuiContigWin = (GuiContigWin*) client_data; TRY_CATCH_WRAPPER( pGuiContigWin->pContigWin_->continueHighlight( nPixelX, nPixelY ) ); } void guiContigWinButton2MotionXtEventHandler(Widget, XtPointer client_data, XEvent* pEvent, Boolean* ) { int nPixelX = pEvent->xmotion.x; int nPixelY = pEvent->xmotion.y; unsigned long ulSerial = pEvent->xmotion.serial; GuiContigWin *pGuiContigWin = (GuiContigWin*) client_data; TRY_CATCH_WRAPPER( pGuiContigWin->pContigWin_->continueHighlight( nPixelX, nPixelY ) ); } static void cbGotoConsensusPosition( Widget wid, GuiContigWin* pGuiContigWin, XtPointer pCallData ) { TRY_CATCH_WRAPPER( pGuiContigWin->guiGotoConsensusPosition() ); } void GuiContigWin :: guiGotoConsensusPosition() { char* szValue = XmTextGetString( widGotoConsensusPosition_ ); RWCString soConsPos( szValue ); XtFree( szValue ); pContigWin_->userTypedInConsPos( soConsPos ); } void cbGuiPickForwardPrimerFromSubclone( Widget w, XtPointer client_data, XtPointer call_data) { GuiContigWin* pGuiContigWin = (GuiContigWin*) client_data; TRY_CATCH_WRAPPER( pGuiContigWin->guiPickPrimer( true, false ) ); } void cbGuiPickReversePrimerFromSubclone( Widget w, XtPointer client_data, XtPointer call_data) { GuiContigWin* pGuiContigWin = (GuiContigWin*) client_data; TRY_CATCH_WRAPPER( pGuiContigWin->guiPickPrimer( false, false ) ); } void cbGuiPickForwardPrimerFromClone( Widget w, XtPointer client_data, XtPointer call_data) { GuiContigWin* pGuiContigWin = (GuiContigWin*) client_data; TRY_CATCH_WRAPPER( pGuiContigWin->guiPickPrimer( true, true ) ); } void cbGuiPickReversePrimerFromClone( Widget w, XtPointer client_data, XtPointer call_data) { GuiContigWin* pGuiContigWin = (GuiContigWin*) client_data; TRY_CATCH_WRAPPER( pGuiContigWin->guiPickPrimer( false, true ) ); } void GuiContigWin :: guiPickPrimer( const bool bForwardNotReversePrimer, const bool bCloneNotSubcloneTemplate ) { int nCharX = nCharXFromPixel( nPixelXBeforePopupMenu_ ); pContigWin_->pickPrimer( nCharX, bForwardNotReversePrimer, bCloneNotSubcloneTemplate ); } void GuiContigWin :: guiPickFirstPCRPrimer( const bool bTopStrandNotBottomStrand ) { assert( !pCP->bReadyToPickSecondPCRPrimer_ ); int nScreenCharX = nCharXFromPixel( nPixelXBeforePopupMenu_ ); int nConsPos = pContigWin_->nScreenCharToConsensusPosition( nScreenCharX ); pCP->pPickPCRPrimers_ = new pickPCRPrimers( pContigWin_->pContig_, nConsPos, bTopStrandNotBottomStrand, pContigWin_ ); } void GuiContigWin :: guiPickSecondPCRPrimer( const bool bTopStrandNotBottomStrand ) { assert( pCP->bReadyToPickSecondPCRPrimer_ ); int nScreenCharX = nCharXFromPixel( nPixelXBeforePopupMenu_ ); int nConsPos = pContigWin_->nScreenCharToConsensusPosition( nScreenCharX ); assert( pCP->pPickPCRPrimers_ ); pCP->pPickPCRPrimers_->userPickedSecondPCRPrimerSite( pContigWin_->pContig_, nConsPos, bTopStrandNotBottomStrand, pContigWin_ ); } void GuiContigWin :: guiPopupTagInfoForTagsAtThisLocation() { int nCharX = nCharXFromPixel( nPixelXBeforePopupMenu_ ); if ( bIsInFragmentBasesArea( nPixelXBeforePopupMenu_, nPixelYBeforePopupMenu_ ) ) { int nReadLine = pContigWin_->nFragLineFromPixelY( nPixelYBeforePopupMenu_ ); pContigWin_->popupTagInfoForTagsAtThisLocation( nCharX, nReadLine ); } else if ( bIsInConsensusBasesArea( nPixelXBeforePopupMenu_, nPixelYBeforePopupMenu_ ) ) { pContigWin_->popupTagInfoForConsensusTagsAtThisLocation( nCharX ); } } void GuiContigWin :: displayErrorRate( char* szErrors ) { XtVaSetValues( widErrorRate_, XmNvalue, szErrors, NULL ); } void GuiContigWin :: displayMessageAtBottom( char* szMessage ) { soDisplayedMessageAtBottom_ = szMessage; XtVaSetValues( widMessageWindowAtBottom_, XmNvalue, szMessage, NULL ); } void GuiContigWin :: highlightVerticalScrollBar( const bool bHighlight ) { if ( !bSavedVerticalScrollbarColors_ ) { pGuiColorTextWhenVerticalScrollbarScrolledDown_ = new GuiColorText( "Green", "Black" ); Colormap cmap; XColor xcolor1; XColor xcolor2; XtVaGetValues( widVerticalScrollBar_, XmNcolormap, &cmap, XmNtopShadowColor, &pixVerticalScrollbarNormalTopShadowColor_, XmNbottomShadowColor, &pixVerticalScrollbarNormalBottomShadowColor_, NULL ); int nStatus = XAllocNamedColor( XtDisplay( widVerticalScrollBar_ ), cmap, (char*) ColorDefaults::pGetColorDefaults()->soColorVerticalScrollbarScrolledDown_.data(), &xcolor1, &xcolor2 ); if (nStatus != 1 ) { ostringstream ost; ost << "Could not allocate colormap entry for color \"" << ColorDefaults::pGetColorDefaults()->soColorVerticalScrollbarScrolledDown_ << "\"." << "This may be due to a spelling error in your color name. Or this may be because some other application is a hog. " << "If it is netscape, run netscape via netscape -install" << ends; SysRequestFailed srf(ost.str().c_str()); throw srf; // throw exception } // calculate new shades of that color to make the scrollbar still // look 3D XmGetColors( XtScreen( widVerticalScrollBar_ ), cmap, xcolor1.pixel, NULL, &pixVerticalScrollbarScrolledDownTopShadowColor_, &pixVerticalScrollbarScrolledDownBottomShadowColor_, NULL ); bSavedVerticalScrollbarColors_ = true; } if ( bHighlight ) { XtVaSetValues( widVerticalScrollBar_, // XmNbackground, pixVerticalScrollbarScrolledDownBackgroundColor_, XmNtopShadowColor, pixVerticalScrollbarScrolledDownTopShadowColor_, XmNbottomShadowColor, pixVerticalScrollbarScrolledDownBottomShadowColor_, NULL ); } else { XtVaSetValues( widVerticalScrollBar_, XmNtopShadowColor, pixVerticalScrollbarNormalTopShadowColor_, XmNbottomShadowColor, pixVerticalScrollbarNormalBottomShadowColor_, NULL ); } } GuiContigWin :: ~GuiContigWin() { // the XtPopdown is required in addition to the XtDestroyWidget // Otherwise, if in joinContigs, the contigwin's are deleted and // then an exception occurs in joinContigs, this is what will happen: // the contigwin's will stay on the screen until you acknowledge // the exception. Then they will go away and everything will be fine. // However, if you (before acknowledging the exception), // expose the part of the screen where they *where*, consed will // crash with a segmentation fault and the debugger will show that // it was the expose event callback for the (non-existent) guicontigwin // running and using a null pointers. // I tried removing the TRY_CATCH_WRAPPER from joinContigsButtonCb // and then the windows *never* popped down, thus leading to a // seg fault on the next refresh. It seems that if a callback isn't // returned from, there is stuff that isn't cleaned up and other // widgets that should be destroyed need to wait until the callback // returns. There are 2 ways this could happen: an app event loop // inside a callback, such as with popupErrorMessage, or else // throwing an exception that goes all the way out of the callback // back to the main loop in main.cpp XtRemoveCallback( widContigWin_, XmNexposeCallback, (XtCallbackProc ) exposureXtCb, this ); XtRemoveEventHandler( widContigWin_, PointerMotionMask, False, (XtEventHandler) guiContigWinPointerMotionEventHandler, this ); XtPopdown( widMainWinTopLevelShell_ ); // wait for window manager to pop down the window before returning // Otherwise we had a different bug with "put read into its own contig" // in which, if an exception is thrown, the window refreshes and cout // statements show that it is trying to refresh the (nonexistent) // GuiContigWin // flush the event queue // while ( XtAppPending( cxt ) ) { // XtAppNextEvent( cxt, &event ); // XtDispatchEvent( &event ); // cout << "another event" << endl; // } // cout << endl; // cout.flush(); XtDestroyWidget( widMainWinTopLevelShell_ ); } void cbGuiTellPhrapToNotOverlapReadsDiscrepantAtThisLocation( Widget wid, XtPointer pClientData, XtPointer pCallData ) { GuiContigWin* pGuiContigWin = (GuiContigWin*) pClientData; TRY_CATCH_WRAPPER( pGuiContigWin->guiTellPhrapToNotOverlapReadsDiscrepantAtThisLocation() ); } void GuiContigWin :: guiTellPhrapToNotOverlapReadsDiscrepantAtThisLocation() { int nCharX = nCharXFromPixel( nPixelXBeforePopupMenu_ ); pContigWin_->tellPhrapNotToOverlapReadsDiscrepantAtThisLocation( nCharX ); } void cbGuiMakeAllReadsNAtThisLocation( Widget wid, XtPointer pClientData, XtPointer pCallData ) { GuiContigWin* pGuiContigWin = (GuiContigWin*) pClientData; TRY_CATCH_WRAPPER( pGuiContigWin->guiMakeAllReadsNAtThisLocation() ); } void GuiContigWin :: guiMakeAllReadsNAtThisLocation() { int nCharX = nCharXFromPixel( nPixelXBeforePopupMenu_ ); pContigWin_->makeAllReadsNAtThisLocation( nCharX ); } void cbFixNavigateMenuLabels( Widget wid, XtPointer pClientData, XtPointer pCallData ) { GuiContigWin* pGuiContigWin = (GuiContigWin*) pClientData; TRY_CATCH_WRAPPER( pGuiContigWin->fixNavigateMenuLabels() ); } void GuiContigWin :: fixNavigateMenuLabels() { char szLabel[200]; // Low consensus quality label sprintf( szLabel, "Low consensus quality (<=%d or 98)", consedParameters::pGetConsedParameters()->nQualityThresholdForLowConsensusQuality_ ); XmString xmsLabel = XmStringCreateLtoR( szLabel, XmFONTLIST_DEFAULT_TAG ); XtVaSetValues( widCreateLowConsensusQualityNavigator_, XmNlabelString, xmsLabel, NULL ); XmStringFree( xmsLabel ); // high quality discrepancy label sprintf( szLabel, "High quality (>=%d) discrepancies, > %d bp from unaligned region", consedParameters::pGetConsedParameters()->nQualityThresholdForFindingHighQualityDiscrepancies_, consedParameters::pGetConsedParameters()->nIgnoreHighQualityDiscrepanciesThisManyBasesFromEndOfAlignedRegion_ ); xmsLabel = XmStringCreateLtoR( szLabel, XmFONTLIST_DEFAULT_TAG ); XtVaSetValues( widCreateHighQualityDiscrepancyNavigator_, XmNlabelString, xmsLabel, NULL ); XmStringFree( xmsLabel ); // unaligned high quality segments sprintf( szLabel, "Unaligned high quality regions with >= %d bases outside chimera tag", consedParameters::pGetConsedParameters()->nIgnoreUnalignedHighQualitySegmentsShorterThanThis_ ); xmsLabel = XmStringCreateLtoR( szLabel, XmFONTLIST_DEFAULT_TAG ); XtVaSetValues( widCreateUnalignedHighQualityNavigator_, XmNlabelString, xmsLabel, NULL ); XmStringFree( xmsLabel ); // search for single stranded regions strcpy( szLabel, "Regions covered by only 1 strand and only 1 chemistry (or none at all)" ); if ( !consedParameters::pGetConsedParameters()->bSearchFunctionsUseLowQualityEndsOfReads_ ) { if ( !consedParameters::pGetConsedParameters()->bSearchFunctionsUseUnalignedEndsOfReads_ ) strcat( szLabel, " (not counting low quality ends of reads nor unaligned ends of reads)" ); else strcat( szLabel, " (not counting low quality ends of reads)" ); } else { if ( !consedParameters::pGetConsedParameters()->bSearchFunctionsUseUnalignedEndsOfReads_ ) strcat( szLabel, " (not counting unaligned ends of reads)" ); } xmsLabel = XmStringCreateLtoR( szLabel, XmFONTLIST_DEFAULT_TAG ); XtVaSetValues( widSearchForSingleStrandedRegions_, XmNlabelString, xmsLabel, NULL ); XmStringFree( xmsLabel ); // search for single subclone regions strcpy( szLabel, "Regions covered by only 1 subclone (or none at all)" ); if ( !consedParameters::pGetConsedParameters()->bSearchFunctionsUseLowQualityEndsOfReads_ ) { if ( !consedParameters::pGetConsedParameters()->bSearchFunctionsUseUnalignedEndsOfReads_ ) { strcat( szLabel, " (not counting low quality ends of reads nor unaligned ends of reads)" ); } else strcat( szLabel, " (not counting low quality ends of reads)" ); } else { if ( !consedParameters::pGetConsedParameters()->bSearchFunctionsUseUnalignedEndsOfReads_ ) strcat( szLabel, " (not counting unaligned ends of reads)" ); } xmsLabel = XmStringCreateLtoR( szLabel, XmFONTLIST_DEFAULT_TAG ); XtVaSetValues( widSearchForSingleSubcloneRegions_, XmNlabelString, xmsLabel, NULL ); XmStringFree( xmsLabel ); // toggle navigate automatic trace popup if ( consedParameters::pGetConsedParameters()->bNavigateAutomaticTracePopup_ ) strcpy( szLabel, "Toggle feature: when navigating to position on a read, pop up the trace (currently on)" ); else strcpy( szLabel, "Toggle feature: when navigating to position on a read, pop up the trace (currently off)" ); xmsLabel = XmStringCreateLtoR( szLabel, XmFONTLIST_DEFAULT_TAG ); XtVaSetValues( widToggleNavigateAutomaticTracePopup_, XmNlabelString, xmsLabel, NULL ); XmStringFree( xmsLabel ); // toggle navigate automatic all traces popup if ( consedParameters::pGetConsedParameters()->bNavigateAutomaticAllTracesPopup_ ) strcpy( szLabel, "Toggle feature: when navigating to consensus location, pop up all traces (currently on)" ); else strcpy( szLabel, "Toggle feature: when navigating to consensus location, pop up all traces (currently off)" ); xmsLabel = XmStringCreateLtoR( szLabel, XmFONTLIST_DEFAULT_TAG ); XtVaSetValues( widToggleNavigateAutomaticAllTracesPopup_, XmNlabelString, xmsLabel, NULL ); XmStringFree( xmsLabel ); } void cbResetPopupMenuLabels( Widget wid, XtPointer pClientData, XtPointer pCallData ) { GuiContigWin* pGuiContigWin = (GuiContigWin*) pClientData; TRY_CATCH_WRAPPER( pGuiContigWin->resetPopupMenuLabels() ); } void GuiContigWin :: resetDimMenuLabels() { XmString xmsLabel; xmsLabel = XmStringCreateLtoR( "Dim Nothing", XmFONTLIST_DEFAULT_TAG ); XtVaSetValues( widDimNothing_, XmNlabelString, xmsLabel, NULL ); XmStringFree( xmsLabel ); xmsLabel = XmStringCreateLtoR( "Dim Unaligned", XmFONTLIST_DEFAULT_TAG ); XtVaSetValues( widDimUnaligned_, XmNlabelString, xmsLabel, NULL ); XmStringFree( xmsLabel ); xmsLabel = XmStringCreateLtoR( "Dim Low Quality", XmFONTLIST_DEFAULT_TAG ); XtVaSetValues( widDimLowQuality_, XmNlabelString, xmsLabel, NULL ); XmStringFree( xmsLabel ); xmsLabel = XmStringCreateLtoR( "Dim Low Quality or Unaligned", XmFONTLIST_DEFAULT_TAG ); XtVaSetValues( widDimLowQualityOrUnaligned_, XmNlabelString, xmsLabel, NULL ); XmStringFree( xmsLabel ); } void GuiContigWin :: fixDimMenuLabels() { resetDimMenuLabels(); char* szLabel; if ( consedParameters::pGetConsedParameters()->bDimLowQualityEndsOfReads_ ) { if ( consedParameters::pGetConsedParameters()->bDimUnalignedEndsOfReads_ ) { szLabel = ">Dim Low Quality or Unaligned"; XmString xmsLabel = XmStringCreateLtoR( szLabel, XmFONTLIST_DEFAULT_TAG ); XtVaSetValues( widDimLowQualityOrUnaligned_, XmNlabelString, xmsLabel, NULL ); XmStringFree( xmsLabel ); } else { szLabel = ">Dim Low Quality"; XmString xmsLabel = XmStringCreateLtoR( szLabel, XmFONTLIST_DEFAULT_TAG ); XtVaSetValues( widDimLowQuality_, XmNlabelString, xmsLabel, NULL ); XmStringFree( xmsLabel ); } } else { if ( consedParameters::pGetConsedParameters()->bDimUnalignedEndsOfReads_ ) { szLabel = ">Dim Unaligned"; XmString xmsLabel = XmStringCreateLtoR( szLabel, XmFONTLIST_DEFAULT_TAG ); XtVaSetValues( widDimUnaligned_, XmNlabelString, xmsLabel, NULL ); XmStringFree( xmsLabel ); } else { szLabel = ">Dim Nothing"; XmString xmsLabel = XmStringCreateLtoR( szLabel, XmFONTLIST_DEFAULT_TAG ); XtVaSetValues( widDimNothing_, XmNlabelString, xmsLabel, NULL ); XmStringFree( xmsLabel ); } } } void GuiContigWin :: fixShowProteinTranslationLabels() { char* szLabel; if ( consedParameters::pGetConsedParameters()->nShowProteinTranslation_ == nShowProteinTranslationTopStrand ) { szLabel = ">Show Top Strand Protein Translation"; XmString xmsLabel = XmStringCreateLtoR( szLabel, XmFONTLIST_DEFAULT_TAG ); XtVaSetValues( widShowProteinTranslationTopStrand_, XmNlabelString, xmsLabel, NULL ); XmStringFree( xmsLabel ); szLabel = "Show Bottom Strand Protein Translation"; xmsLabel = XmStringCreateLtoR( szLabel, XmFONTLIST_DEFAULT_TAG ); XtVaSetValues( widShowProteinTranslationBottomStrand_, XmNlabelString, xmsLabel, NULL ); szLabel = "Don't Show Protein Translation"; xmsLabel = XmStringCreateLtoR( szLabel, XmFONTLIST_DEFAULT_TAG ); XtVaSetValues( widDontShowProteinTranslation_, XmNlabelString, xmsLabel, NULL ); XmStringFree( xmsLabel ); } else if ( consedParameters::pGetConsedParameters()->nShowProteinTranslation_ == nShowProteinTranslationBottomStrand ) { szLabel = "Show Top Strand Protein Translation"; XmString xmsLabel = XmStringCreateLtoR( szLabel, XmFONTLIST_DEFAULT_TAG ); XtVaSetValues( widShowProteinTranslationTopStrand_, XmNlabelString, xmsLabel, NULL ); XmStringFree( xmsLabel ); szLabel = ">Show Bottom Strand Protein Translation"; xmsLabel = XmStringCreateLtoR( szLabel, XmFONTLIST_DEFAULT_TAG ); XtVaSetValues( widShowProteinTranslationBottomStrand_, XmNlabelString, xmsLabel, NULL ); XmStringFree( xmsLabel ); szLabel = "Don't Show Protein Translation"; xmsLabel = XmStringCreateLtoR( szLabel, XmFONTLIST_DEFAULT_TAG ); XtVaSetValues( widDontShowProteinTranslation_, XmNlabelString, xmsLabel, NULL ); XmStringFree( xmsLabel ); } else { szLabel = "Show Top Strand Protein Translation"; XmString xmsLabel = XmStringCreateLtoR( szLabel, XmFONTLIST_DEFAULT_TAG ); XtVaSetValues( widShowProteinTranslationTopStrand_, XmNlabelString, xmsLabel, NULL ); XmStringFree( xmsLabel ); szLabel = "Show Bottom Strand Protein Translation"; xmsLabel = XmStringCreateLtoR( szLabel, XmFONTLIST_DEFAULT_TAG ); XtVaSetValues( widShowProteinTranslationBottomStrand_, XmNlabelString, xmsLabel, NULL ); XmStringFree( xmsLabel ); szLabel = ">Don't Show Protein Translation"; xmsLabel = XmStringCreateLtoR( szLabel, XmFONTLIST_DEFAULT_TAG ); XtVaSetValues( widDontShowProteinTranslation_, XmNlabelString, xmsLabel, NULL ); XmStringFree( xmsLabel ); } } void cbShowTagInfo( Widget wid, XtPointer pClientData, XtPointer pCallData ) { passToShowTagInfo* pPassToShowTagInfo = (passToShowTagInfo*) pClientData; tag* pTag = pPassToShowTagInfo->pTag_; TRY_CATCH_WRAPPER( if ( pTag->pGuiPopupTagInfo_ ) { pTag->pGuiPopupTagInfo_->raiseWindow(); } else { pTag->pGuiPopupTagInfo_ = new guiPopupTagInfo( pPassToShowTagInfo->pGuiContigWin_, true, // is guicontigwin not guitedwin 0, // number of tags already popped up pPassToShowTagInfo->pTag_ ); } ); } void cbEditAllReads( Widget wid, XtPointer pClientData, XtPointer pCallData ) { passToEditAllReads* pPassToEditAllReads = (passToEditAllReads*) pClientData; TRY_CATCH_WRAPPER( pPassToEditAllReads->pContigWin_->editAllReads( pPassToEditAllReads->pLocFrag_, pPassToEditAllReads->nConsPos_ ); ); } void GuiContigWin :: popupMenu( XButtonPressedEvent* pEvent ) { fixPopupMenuLabels(); // this allows people to see what they pointed to after the // popup menu has come up pEvent->y_root += 20; XmMenuPosition( widPopupMenu_, pEvent ); XtManageChild( widPopupMenu_ ); } void GuiContigWin :: resetPopupMenuLabels() { // clear the modifiable part of the popup menu for( int n = 0; n < aTemporaryPopupMenuItems_.length(); ++n ) { XtDestroyWidget( (Widget) aTemporaryPopupMenuItems_[ n ] ); } aTemporaryPopupMenuItems_.clear(); } void cbSearchForStringWithMatchElsewhereTag( Widget wid, XtPointer pClientData, XtPointer pCallData ) { passToShowTagInfo* pPassToShowTagInfo = (passToShowTagInfo*) pClientData; tag* pTag = pPassToShowTagInfo->pTag_; TRY_CATCH_WRAPPER( pTag->matchElsewhereTagSearchForString() ); } void cbAddReadNameToFile( Widget wid, XtPointer pClientData, XtPointer pCallData ) { GuiContigWin* pGuiContigWin = (GuiContigWin*) pClientData; TRY_CATCH_WRAPPER( pGuiContigWin->addReadNameToFile() ); } void GuiContigWin :: addReadNameToFile() { FileName filReadList = ConsEd::pGetAssembly()->filGetReadListFilename(); FILE* pReadListFile = fopen( (char*) filReadList.data(), "a" ); // try on HP! if ( ! pReadListFile ) { ostringstream ost; ost << "unable to open file " << filReadList << " for append" << endl << ends; SysRequestFailed srf( ost.str().c_str() ); srf.includeErrnoDescription(); throw srf; } fprintf( pReadListFile, "%s\n", (char*) soReadName_.data() ); fclose( pReadListFile ); } void cbAddReadNameWithOptionsToFile( Widget wid, XtPointer pClientData, XtPointer pCallData ) { GuiContigWin* pGuiContigWin = (GuiContigWin*) pClientData; TRY_CATCH_WRAPPER( pGuiContigWin->addReadNameToFileWithReadListOptions() ); } void GuiContigWin :: addReadNameToFileWithReadListOptions() { guiAskUserToSelectReadListOptions* pAsk = new guiAskUserToSelectReadListOptions(); bool bUserPushedCancel = false; RWCString soReadListOptions; pAsk->popupBoxAndWaitForUserToSelectReadListOptions( soReadName_, soReadListOptions, bUserPushedCancel ); delete pAsk; if (bUserPushedCancel) return; FileName filReadList = ConsEd::pGetAssembly()->filGetReadListFilename(); FILE* pReadListFile = fopen( (char*) filReadList.data(), "a" ); // try on HP! if ( ! pReadListFile ) { ostringstream ost; ost << "unable to open file " << filReadList << " for append" << endl << ends; SysRequestFailed srf( ost.str().c_str() ); srf.includeErrnoDescription(); throw srf; } RWCString soToWriteToFile = soReadName_ + " " + soReadListOptions; fprintf( pReadListFile, "%s\n", (char*) soToWriteToFile.data() ); fclose( pReadListFile ); } bool GuiContigWin :: bReadLineIsBelowBottomOfWindow( const int nReadLine ) { if ( nFragLineToPixelY( nReadLine ) > nGetContigWindowPixelHeight() ) return( true ); else return( false ); } void GuiContigWin :: guiSetSliderPosOfVerticalScrollBar( const int nNewPosition ){ XtVaSetValues( widVerticalScrollBar_, XmNvalue, nNewPosition, NULL ); } void GuiContigWin :: setAceFileLabel( const RWCString& soAceFile ) { XtVaSetValues( widAssemblyName_, XmNvalue, (char*) soAceFile.data(), NULL ); } void GuiContigWin :: setContigLabel( const RWCString& soContigName ) { XtVaSetValues( widContigName_, XmNvalue, (char*) soContigName.data(), NULL ); } void GuiContigWin :: userPushedShowSomeTagsButton() { tagTypes::pGetTagTypes()->bCurrentlyShowAllTagTypes_ = ! tagTypes::pGetTagTypes()->bCurrentlyShowAllTagTypes_; setLabelOfShowSomeTagsButton(); ConsEd::pGetConsEd()->refreshAllContigWinsAndAllTeditors(); } void GuiContigWin :: setLabelOfShowSomeTagsButton() { // the label is set the opposite of the current value // since the bottom changes the current value XmString xmsLabelOfButton = XmStringCreateLocalized( (char*) ( tagTypes::pGetTagTypes()->bCurrentlyShowAllTagTypes_ ? "Some Tags" : "Sh All Tags" ) ); XtVaSetValues( widShowSomeTags_, XmNlabelString, xmsLabelOfButton, NULL ); } void GuiContigWin :: exportConsensusWithOptions() { new guiExportConsensusWithOptions( widGetGuiContigWinTopLevel(), this->pContigWin_->pContig_ ); } void GuiContigWin :: showProteinTranslation( const int nShow ) { if ( consedParameters::pGetConsedParameters()->nShowProteinTranslation_ == nShow ) return; consedParameters::pGetConsedParameters()->nShowProteinTranslation_ = nShow; setScreenForProteinTranslation( nShow ); ConsEd::pGetConsEd()->getNewContigViewsForAllContigWins(); // wish there were a function to just refresh all contigwins ConsEd::pGetConsEd()->refreshAllContigWinsAndAllTeditors(); } void GuiContigWin :: setScreenForProteinTranslation( const int nShowProteinTranslation ) { // set up some screen real estate if ( nShowProteinTranslation != nDontShowProteinTranslation ) nConsensusBaselinePixelY_ = nReadingFrameToPixelY( 3 ) + GuiApp::pGetGuiApp()->nGetFontHeight() + nPixelMarginAboveConsensus; else nConsensusBaselinePixelY_ = nScaleLinePixelY() + nScaleMarksHeight() + GuiApp::pGetGuiApp()->nGetFontHeight() + nPixelMarginAboveConsensus; } void GuiContigWin :: guiSearchForOpenReadingFrames2() { new guiSearchForOpenReadingFrames( widMainWinTopLevelShell_, pContigWin_->pContig_, pContigWin_ ); } void GuiContigWin :: guiTearContigs() { int nCharX = nCharXFromPixel( nPixelXBeforePopupMenu_ ); pContigWin_->tearContigs( nCharX ); } void GuiContigWin :: guiShowAllTraces() { int nScreenCharX = nCharXFromPixel( nPixelXBeforePopupMenu_ ); pContigWin_->showAllTraces( nScreenCharX ); } void GuiContigWin :: putIntoPopupMenuReadTags( LocatedFragment* pLocFrag, const int nConsPos ) { for( int nTag = 0; nTag < pLocFrag->nGetNumberOfTags(); ++nTag ) { tag* pTag = pLocFrag->pGetTag( nTag ); if ( pTag->bTouchesThisConsPos( nConsPos ) ) { char szLabel[200]; if ( ! pTag->soComment_.isNull() ) { RWCString soComment = pTag->soComment_; const int nMaxLengthOfComment = 30; if ( soComment.length() > nMaxLengthOfComment ) soComment = soComment(0, 27 ) + "..."; sprintf( szLabel, "Tag: %s \"%s\" show more info?", (char*) pTag->soType_.data(), soComment.data() ); } else { sprintf( szLabel, "Tag: %s show more info?", (char*) pTag->soType_.data() ); } // the XmNpositionIndex, 0, is to put the tag line // at the top of the menu Widget widShowTag = XtVaCreateManagedWidget( szLabel, xmPushButtonWidgetClass, widPopupMenu_, XmNpositionIndex, 0, NULL ); passToShowTagInfo* pPassToShowTagInfo = new passToShowTagInfo; pPassToShowTagInfo->pGuiContigWin_ = this; pPassToShowTagInfo->pTag_ = pTag; XtAddCallback( widShowTag, XmNactivateCallback, (XtCallbackProc) cbShowTagInfo, pPassToShowTagInfo ); // put these in the lists so we can destroy them // before building the popup menu the next time aTemporaryPopupMenuItems_.insert( (int*) widShowTag ); aPassToShowTagInfo_.insert( pPassToShowTagInfo ); if ( (pTag->soType_ == "matchElsewhereHighQual" ) || (pTag->soType_ == "matchElsewhereLowQual" ) ) { Widget widSearchForStringButton = XtVaCreateManagedWidget( " search for string with this matchElsewhere tag", xmPushButtonWidgetClass, widPopupMenu_, XmNpositionIndex, 1, NULL ); passToShowTagInfo* pPassToShowTagInfo2 = new passToShowTagInfo; pPassToShowTagInfo2->pGuiContigWin_ = this; pPassToShowTagInfo2->pTag_ = pTag; XtAddCallback( widSearchForStringButton, XmNactivateCallback, (XtCallbackProc) cbSearchForStringWithMatchElsewhereTag, pPassToShowTagInfo2 ); aTemporaryPopupMenuItems_.insert( (int*) widSearchForStringButton ); aPassToShowTagInfo_.insert( pPassToShowTagInfo2 ); } } } // for( int nTag = 0; nTag < ... } void GuiContigWin :: putIntoPopupMenuButtonToPutReadIntoItsOwnContig( LocatedFragment* pLocFrag ) { // put button to put read into its own contig char szLabel[200]; sprintf( szLabel, "Put read %s into its own contig", (char*) pLocFrag->soGetName().data() ); Widget widPutReadIntoItsOwnContigButton = XtVaCreateManagedWidget( szLabel, xmPushButtonWidgetClass, widPopupMenu_, NULL ); passToPutReadIntoItsOwnContig* pPassToPutReadIntoItsOwnContig = new passToPutReadIntoItsOwnContig(); pPassToPutReadIntoItsOwnContig->pGuiContigWin_ = this; pPassToPutReadIntoItsOwnContig->pLocFrag_ = pLocFrag; XtAddCallback( widPutReadIntoItsOwnContigButton, XmNactivateCallback, (XtCallbackProc) cbPutReadIntoItsOwnContig, pPassToPutReadIntoItsOwnContig ); aTemporaryPopupMenuItems_.insert( (int*) widPutReadIntoItsOwnContigButton ); aPassToPutReadIntoItsOwnContig_.insert( pPassToPutReadIntoItsOwnContig ); // end: put button to put read into its own contig } void GuiContigWin :: fixPopupMenuLabels() { aPassToShowTagInfo_.clearAndDestroy(); aPassToShowWholeReadItem_.clearAndDestroy(); aPassToPutReadIntoItsOwnContig_.clearAndDestroy(); aPassToEditAllReads_.clearAndDestroy(); int nCharX = nCharXFromPixel( nPixelXBeforePopupMenu_ ); int nConsPos = pContigWin_->nScreenCharToConsensusPosition( nCharX ); putIntoPopupMenuPickPCRPrimers(); if ( bIsOnARead( nPixelYBeforePopupMenu_ ) ) { int nReadLine = pContigWin_->nFragLineFromPixelY( nPixelYBeforePopupMenu_ ); LocatedFragment* pLocFrag = pContigWin_->pContigView_->pLocatedFragmentGet( nReadLine ); bool bIsInReadBasesArea = bIsInFragmentBasesArea( nPixelXBeforePopupMenu_, nPixelYBeforePopupMenu_ ); if ( bIsInReadBasesArea ) { putIntoPopupMenuReadTags( pLocFrag, nConsPos ); } putIntoPopupMenuButtonToPutReadIntoItsOwnContig( pLocFrag ); putIntoPopupMenuAddReadNameToFile( pLocFrag ); if ( bIsOnAReadName( nPixelXBeforePopupMenu_, nPixelYBeforePopupMenu_ ) ) { putIntoPopupMenuWholeReadItems( pLocFrag ); putIntoPopupMenuIfWholeReadIsUnalignedOrLowQuality( pLocFrag ); } putIntoPopupMenuFindReadInAssemblyView( pLocFrag ); if ( bIsInReadBasesArea ) { putIntoPopupMenuEditAllReads( pLocFrag, nConsPos ); } } // if ( bIsInFragmentBasesArea( else if ( bIsInConsensusBasesArea( nPixelXBeforePopupMenu_, nPixelYBeforePopupMenu_ ) ) { Contig* pContig = pContigWin_->pGetContig(); putIntoPopupMenuConsensusTags( pContig, nConsPos ); } } void GuiContigWin :: putIntoPopupMenuEditAllReads( LocatedFragment* pLocFrag, const int nConsPos ) { passToEditAllReads* pPassToEditAllReads = new passToEditAllReads; pPassToEditAllReads->pContigWin_ = pContigWin_; pPassToEditAllReads->pLocFrag_ = pLocFrag; pPassToEditAllReads->nConsPos_ = nConsPos; char cBase = pLocFrag->ntGetFragFromConsPos( nConsPos ); RWCString soMenuLabel = "make all reads " + RWCString( cBase ); Widget widEditAllTraces = XtVaCreateManagedWidget( soMenuLabel.data(), xmPushButtonWidgetClass, widPopupMenu_, NULL ); XtAddCallback( widEditAllTraces, XmNactivateCallback, cbEditAllReads, pPassToEditAllReads ); // put these in the lists so we can destroy them later aTemporaryPopupMenuItems_.insert( (int*) widEditAllTraces ); aPassToEditAllReads_.insert( pPassToEditAllReads ); } void GuiContigWin :: putIntoPopupMenuConsensusTags( Contig* pContig, const int nConsPos ) { for( int nTag = 0; nTag < pContig->nGetNumberOfTags(); ++nTag ) { tag* pTag = pContig->pGetTag( nTag ); if ( pTag->bTouchesThisConsPos( nConsPos ) ) { char szLabel[200]; if ( !pTag->soComment_.isNull() ) { RWCString soComment = pTag->soComment_; const int nMaxLengthOfComment = 30; if ( soComment.length() > nMaxLengthOfComment ) soComment = soComment(0, 27 ) + "..."; sprintf( szLabel, "Tag: %s \"%s\" show more info?", (char*) pTag->soType_.data(), soComment.data() ); } else { sprintf( szLabel, "Tag: %s show more info?", (char*) pTag->soType_.data() ); } Widget widShowTag = XtVaCreateManagedWidget( szLabel, xmPushButtonWidgetClass, widPopupMenu_, XmNpositionIndex, 0, NULL ); passToShowTagInfo* pPassToShowTagInfo = new passToShowTagInfo; pPassToShowTagInfo->pGuiContigWin_ = this; pPassToShowTagInfo->pTag_ = pTag; XtAddCallback( widShowTag, XmNactivateCallback, (XtCallbackProc) cbShowTagInfo, pPassToShowTagInfo ); // put these in the lists so we can destroy them later aTemporaryPopupMenuItems_.insert( (int*) widShowTag ); aPassToShowTagInfo_.insert( pPassToShowTagInfo ); } // if ( pTag->bTouchesThisConsPos ... } // for( int nTag = 0 } void GuiContigWin :: putIntoPopupMenuAddReadNameToFile( LocatedFragment* pLocFrag ) { // add "add read name" widgets to the very top of the popup menu soReadName_ = pLocFrag->soGetName(); RWCString soLabel = "add " + soReadName_ + " to file " + ConsEd::pGetAssembly()->filGetReadListFilename(); XmString xmsLabel = XmStringCreateLtoR( (char*) soLabel.data(), XmFONTLIST_DEFAULT_TAG ); Widget widAddReadNameToFile = XtVaCreateManagedWidget( "add read name to file", xmPushButtonWidgetClass, widPopupMenu_, XmNlabelString, xmsLabel, XmNpositionIndex, 0, NULL ); XtAddCallback( widAddReadNameToFile, XmNactivateCallback, (XtCallbackProc) cbAddReadNameToFile, this ); aTemporaryPopupMenuItems_.insert( (int*) widAddReadNameToFile ); Widget widAddReadNameWithOptionsToFile = XtVaCreateManagedWidget( " as above but with options...", xmPushButtonWidgetClass, widPopupMenu_, XmNpositionIndex, 1, NULL ); XtAddCallback( widAddReadNameWithOptionsToFile, XmNactivateCallback, (XtCallbackProc) cbAddReadNameWithOptionsToFile, this ); aTemporaryPopupMenuItems_.insert( (int*) widAddReadNameWithOptionsToFile ); } void GuiContigWin :: putIntoPopupMenuIfWholeReadIsUnalignedOrLowQuality( LocatedFragment* pLocFrag ) { RWCString soLabel; if ( pLocFrag->bIsWholeReadLowQuality() ) soLabel += "whole read is low quality; "; else { int nLeftUnpadded = pLocFrag->nGetHighQualityStartUnpadded(); int nRightUnpadded = pLocFrag->nGetHighQualityEndUnpadded(); soLabel = soLabel + "high quality from " + RWCString( (long) nLeftUnpadded ) + " to " + RWCString( (long) nRightUnpadded ) + "; "; } if ( pLocFrag->bIsWholeReadUnaligned() ) soLabel += "whole read is unaligned"; else { int nLeftUnpadded = pLocFrag->nGetAlignClipStartUnpadded(); int nRightUnpadded = pLocFrag->nGetAlignClipEndUnpadded(); soLabel = soLabel + "aligned region from " + RWCString( (long) nLeftUnpadded ) + " to " + RWCString( (long) nRightUnpadded ); } if ( !pLocFrag->soChemistry_.bIsNull() ) { soLabel += " chem: "; soLabel += pLocFrag->soChemistry_; } // soLabel += " chem: "; // if ( pLocFrag->bIsDyePrimerNotDyeTerminator() ) // soLabel += "prim"; // else // soLabel += "term"; if ( !soLabel.isNull() ) { XmString xmsLabel = XmStringCreateSimple( soLabel.data() ); Widget widReadInfo = XtVaCreateManagedWidget( "read info", xmPushButtonWidgetClass, widPopupMenu_, XmNlabelString, xmsLabel, NULL ); // no callback for this button--we don't want it to do anything-- // just to be a label aTemporaryPopupMenuItems_.insert( (int*) widReadInfo ); } } void GuiContigWin :: putIntoPopupMenuWholeReadItems( LocatedFragment* pLocFrag ) { for( int nWR = 0; nWR < pLocFrag->aWholeReadItems_.length(); ++nWR ) { wholeReadItem* pWR = pLocFrag->aWholeReadItems_[ nWR ]; RWCString soLabel = "Show WholeReadItem: " + pWR->soType_ + " "; RWCString soData = pWR->soData_; const int nMaxCharsOfDataShown = 50; if ( soData.length() > nMaxCharsOfDataShown ) soData = soData(0, nMaxCharsOfDataShown ) + "..."; soLabel += soData; XmString xmsLabel = XmStringCreateSimple( (char*) soLabel.data() ); Widget widShowWholeReadItem = XtVaCreateManagedWidget( "show whole read item", xmPushButtonWidgetClass, widPopupMenu_, XmNlabelString, xmsLabel, NULL ); passToShowWholeReadItem* pPassToShowWholeReadItem = new passToShowWholeReadItem(); pPassToShowWholeReadItem->pGuiContigWin_ = this; pPassToShowWholeReadItem->pWholeReadItem_ = pWR; XtAddCallback( widShowWholeReadItem, XmNactivateCallback, (XtCallbackProc) cbShowWholeReadItem, pPassToShowWholeReadItem ); aTemporaryPopupMenuItems_.insert( (int*) widShowWholeReadItem ); aPassToShowWholeReadItem_.insert( pPassToShowWholeReadItem ); } // for( int nWR = 0 ... } void GuiContigWin :: putIntoPopupMenuPickPCRPrimers() { if ( pCP->bReadyToPickSecondPCRPrimer_ ) { Widget widPickTopStrandSecondPCRPrimer = XtVaCreateManagedWidget( "Pick --> (Top Strand) Second PCR Primer", xmPushButtonWidgetClass, widPopupMenu_, NULL ); XtAddCallback( widPickTopStrandSecondPCRPrimer, XmNactivateCallback, (XtCallbackProc) cbGuiPickTopStrandSecondPCRPrimer, this ); aTemporaryPopupMenuItems_.insert( (int*) widPickTopStrandSecondPCRPrimer ); Widget widPickBottomStrandSecondPCRPrimer = XtVaCreateManagedWidget( "Pick <-- (Bottom Strand) Second PCR Primer", xmPushButtonWidgetClass, widPopupMenu_, NULL ); XtAddCallback( widPickBottomStrandSecondPCRPrimer, XmNactivateCallback, (XtCallbackProc) cbGuiPickBottomStrandSecondPCRPrimer, this ); aTemporaryPopupMenuItems_.insert( (int*) widPickBottomStrandSecondPCRPrimer ); Widget widCancelPickingPCRPrimers = XtVaCreateManagedWidget( "Cancel picking PCR primers and start over", xmPushButtonWidgetClass, widPopupMenu_, NULL ); XtAddCallback( widCancelPickingPCRPrimers, XmNactivateCallback, (XtCallbackProc) cbCancelPickingPCRPrimers, this ); aTemporaryPopupMenuItems_.insert( (int*) widCancelPickingPCRPrimers ); } else { Widget widPickTopStrandFirstPCRPrimer = XtVaCreateManagedWidget( "Pick --> (Top Strand) First PCR Primer", xmPushButtonWidgetClass, widPopupMenu_, NULL ); XtAddCallback( widPickTopStrandFirstPCRPrimer, XmNactivateCallback, (XtCallbackProc) cbGuiPickTopStrandFirstPCRPrimer, this ); aTemporaryPopupMenuItems_.insert( (int*) widPickTopStrandFirstPCRPrimer ); Widget widPickBottomStrandFirstPCRPrimer = XtVaCreateManagedWidget( "Pick <-- (Bottom Strand) First PCR Primer", xmPushButtonWidgetClass, widPopupMenu_, NULL ); XtAddCallback( widPickBottomStrandFirstPCRPrimer, XmNactivateCallback, (XtCallbackProc) cbGuiPickBottomStrandFirstPCRPrimer, this ); aTemporaryPopupMenuItems_.insert( (int*) widPickBottomStrandFirstPCRPrimer ); } } void GuiContigWin :: putIntoPopupMenuFindReadInAssemblyView( LocatedFragment* pLocFrag ) { if ( ConsEd::pGetConsEd()->pAssemblyView_ ) { Widget widFindReadInAssemblyView = XtVaCreateManagedWidget( "Find read in Assembly View", xmPushButtonWidgetClass, widPopupMenu_, NULL ); XtAddCallback( widFindReadInAssemblyView, XmNactivateCallback, cbGuiFindReadInAssemblyView, this ); pLocFragToFindInAssemblyView = pLocFrag; // must delete this with next time user pushes right mouse button, // since it will come up again aTemporaryPopupMenuItems_.insert( (int*) widFindReadInAssemblyView ); } } void GuiContigWin :: handleMovingMouseOffOrBackIntoWindow( const int nPixelX ) { bool bIsNowOnBasesWithButtonDown = ( nPixelX < nFragmentBasesStartPixelX() || nGetContigWindowPixelWidth() <= nPixelX ? false : true ); if ( bIsNowOnBasesWithButtonDown && !bMouseIsOnBasesWithButtonDown_ ) { // change back to onto window--remove the timer stopAutomaticScrollingIfNecessary(); } else if ( !bIsNowOnBasesWithButtonDown && bMouseIsOnBasesWithButtonDown_ ) { // just moved off the window--add the timer bAutomaticallyScrollLeftNotRight_ = ( nPixelX < nFragmentBasesStartPixelX() ? true : false ); pContigWin_->automaticallyScroll(); resetScrollingTimer(); } else if ( bIsNowOnBasesWithButtonDown && bMouseIsOnBasesWithButtonDown_ ) { return; } else if ( !bIsNowOnBasesWithButtonDown && !bMouseIsOnBasesWithButtonDown_ ) { return; } // button must be down to call this routine bMouseIsOnBasesWithButtonDown_ = bIsNowOnBasesWithButtonDown; } static void cbAutomaticScrollingTimer( XtPointer pClientData, XtIntervalId* pId) { ContigWin* pContigWin = (ContigWin*) pClientData; TRY_CATCH_WRAPPER( pContigWin->automaticScrollingTimer(); pContigWin->pGcw_->resetScrollingTimer(); ); } void GuiContigWin :: resetScrollingTimer( ) { bAutomaticScrollingInProgress_ = true; xtidTimerForAutomaticScrolling_ = XtAppAddTimeOut( GAPP->ctxGetAppContext(), pCP->nWhenUserScrollsOffWindowMillisecondsBetweenScrolling_, cbAutomaticScrollingTimer, pContigWin_ ); } void GuiContigWin :: stopAutomaticScrollingIfNecessary() { if ( bAutomaticScrollingInProgress_ ) { XtRemoveTimeOut( xtidTimerForAutomaticScrolling_ ); bAutomaticScrollingInProgress_ = false; } }