/***************************************************************************** # 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. # #*****************************************************************************/ #include "guiGetUserDefinedTagInfo.h" #include #include #include #include #include #include #include "guiapp.h" #include #include "handleWindowManagerDelete2.h" #include "tag.h" #include "assert.h" #include "hp_exception_kludge.h" #include "bInputEventToWrongWindow.h" #include "popupErrorMessage2.h" #include "userDefinedTagFieldType.h" #include "bIsNumericLongMaybeWithWhitespace.h" #include "assembly.h" #include "contig.h" #include "consed.h" class passToUserPushedAddAnotherField { public: guiGetUserDefinedTagInfo* pGuiGetUserDefinedTagInfo_; Widget widFormForOneField_; // just to identify which widget it is public: passToUserPushedAddAnotherField( guiGetUserDefinedTagInfo* pGuiGetUserDefinedTagInfo, const Widget widFormForOneField ) : pGuiGetUserDefinedTagInfo_( pGuiGetUserDefinedTagInfo ), widFormForOneField_( widFormForOneField ) {} }; class passToFindTag { public: guiGetUserDefinedTagInfo* pGuiGetUserDefinedTagInfo_; Widget widUserEntersTagID_; Widget widFoundTagType_; Widget widLocationOfFoundTag_; userDefinedTagFieldType* pUserDefinedTagFieldType_; public: passToFindTag( guiGetUserDefinedTagInfo* pGuiGetUserDefinedTagInfo, Widget widUserEntersTagID, Widget widFoundTagType, Widget widLocationOfFoundTag, userDefinedTagFieldType* pUserDefinedTagFieldType ) : pGuiGetUserDefinedTagInfo_( pGuiGetUserDefinedTagInfo ), widUserEntersTagID_( widUserEntersTagID ), widFoundTagType_( widFoundTagType ), widLocationOfFoundTag_( widLocationOfFoundTag ), pUserDefinedTagFieldType_( pUserDefinedTagFieldType ) {} }; const int nSpaceBetweenLabelAndField = 10; static void cbResize( Widget wid, XtPointer pClientData, XtPointer pCallData ) { guiGetUserDefinedTagInfo* pGuiGet = (guiGetUserDefinedTagInfo*) pClientData; TRY_CATCH_WRAPPER( pGuiGet->userResizedWindow() ); } static void cbUserPushedFindTagButton( Widget wid, XtPointer pClientData, XtPointer pCallData ) { passToFindTag* pPassToFindTag = (passToFindTag*) pClientData; TRY_CATCH_WRAPPER( pPassToFindTag->pGuiGetUserDefinedTagInfo_->userPushedFindTagButton( pPassToFindTag->widUserEntersTagID_, pPassToFindTag->widFoundTagType_, pPassToFindTag->widLocationOfFoundTag_, pPassToFindTag->pUserDefinedTagFieldType_ ) ); } static void cbUserPushedAddAnotherField( Widget wid, XtPointer pClientData, XtPointer pCallData ) { passToUserPushedAddAnotherField* pPassToUserPushedAddAnotherField = (passToUserPushedAddAnotherField*) pClientData; TRY_CATCH_WRAPPER( pPassToUserPushedAddAnotherField->pGuiGetUserDefinedTagInfo_->userPushedAddAnotherField( pPassToUserPushedAddAnotherField->widFormForOneField_ ) ); } static void cbUserPushedCancel( Widget wid, XtPointer pClientData, XtPointer pCallData ) { guiGetUserDefinedTagInfo* pGuiGet = (guiGetUserDefinedTagInfo*) pClientData; TRY_CATCH_WRAPPER( pGuiGet->userPushedCancel() ); } static void cbUserPushedOK( Widget wid, XtPointer pClientData, XtPointer pCallData ) { guiGetUserDefinedTagInfo* pGuiGet = (guiGetUserDefinedTagInfo*) pClientData; TRY_CATCH_WRAPPER( pGuiGet->userPushedOK() ); } void guiGetUserDefinedTagInfo :: popupBox( bool& bUserPushedCancel ) { widPopupShell_ = XtVaCreatePopupShell( "guiGetUserDefinedTagInfo", topLevelShellWidgetClass, GuiApp::pGetGuiApp()->widGetTopLevel(), XmNtitle, "Respond to this Window Before Switching to Any Other", XmNnoResize, False, XmNautoUnmanage, False, XmNtransient, False, XmNdeleteResponse, XmDO_NOTHING, XmNmwmDecorations, MWM_DECOR_ALL | MWM_DECOR_MENU | MWM_DECOR_MINIMIZE | MWM_DECOR_MAXIMIZE, NULL ); handleWindowManagerDelete2( widPopupShell_, cbUserPushedCancel, this ); Widget widTopForm = XtVaCreateManagedWidget( "topform", xmFormWidgetClass, widPopupShell_, XmNshadowThickness, 0, XmNborderWidth, 0, NULL ); // put OK and Dismiss at the bottom widOK_ = XtVaCreateManagedWidget( "Apply & Dismiss", xmPushButtonWidgetClass, widTopForm, XmNbottomAttachment, XmATTACH_FORM, XmNbottomOffset, 10, XmNleftAttachment, XmATTACH_POSITION, XmNleftPosition, 4, XmNtraversalOn, False, NULL ); XtAddCallback( widOK_, XmNactivateCallback, cbUserPushedOK, this ); widCancel_ = XtVaCreateManagedWidget( "Cancel", xmPushButtonWidgetClass, widTopForm, XmNbottomAttachment, XmATTACH_FORM, XmNbottomOffset, 10, XmNrightAttachment, XmATTACH_POSITION, XmNrightPosition, 96, XmNtraversalOn, False, NULL ); XtAddCallback( widCancel_, XmNactivateCallback, cbUserPushedCancel, this ); Widget widBelow = widOK_; // now put scrolling window from top down to these buttons const int nWidthOfForm = 80; const int nHeightOfForm = 50; Dimension dimWidth = GuiApp::pGetGuiApp()->nGetFontWidth() * nWidthOfForm; Dimension dimHeight = GuiApp::pGetGuiApp()->nGetFontHeight() * nHeightOfForm; Widget widScrolledWindow = XtVaCreateManagedWidget( "scrolled", xmScrolledWindowWidgetClass, widTopForm, XmNtopAttachment, XmATTACH_FORM, XmNleftAttachment, XmATTACH_FORM, XmNrightAttachment, XmATTACH_FORM, XmNbottomAttachment, XmATTACH_WIDGET, XmNbottomWidget, widBelow, XmNbottomOffset, 20, XmNscrollingPolicy, XmAUTOMATIC, XmNscrollBarDisplayPolicy, XmSTATIC, XmNwidth, (Dimension) (GuiApp::pGetGuiApp()->nGetFontWidth() * nWidthOfForm ), XmNheight, (Dimension) (GuiApp::pGetGuiApp()->nGetFontHeight() * nHeightOfForm ), NULL ); XtVaGetValues( widScrolledWindow, XmNclipWindow, &widClipWindow_, NULL ); XtAddCallback( widClipWindow_, XmNresizeCallback, cbResize, this ); widForm_ = XtVaCreateManagedWidget( "form", xmFormWidgetClass, widScrolledWindow, XmNwidth, dimWidth - 35, XmNheight, dimHeight - 35, XmNshadowThickness, 0, XmNborderWidth, 0, NULL ); Widget widInstructions = XtVaCreateManagedWidget( "Click \"Cancel\" or Enter information and \"Apply and Dismiss\"", xmLabelWidgetClass, widForm_, XmNtopAttachment, XmATTACH_FORM, XmNleftAttachment, XmATTACH_FORM, NULL ); Widget widAbove = widInstructions; // now attach widgets to this form from top to bottom // according to what the field name/types are. If there // are repeating types, have buttons for creating more of these fields. for( int nField = 0; nField < pTag_->pUserDefinedTagType_->aUserDefinedTagFieldType_.length(); ++nField ) { userDefinedTagFieldType* pUserDefinedTagFieldType = pTag_->pUserDefinedTagType_->aUserDefinedTagFieldType_[ nField ]; Widget widFormWidgetCreated; addWidgetsForOneField( pUserDefinedTagFieldType, widAbove, true, // bAppendFieldToList 0, widFormWidgetCreated ); widAbove = widFormWidgetCreated; } // connect the bottom widget to the form // No! Can make integer/float widgets enormous // XtVaSetValues( widAbove, // XmNbottomAttachment, XmATTACH_FORM, // NULL ); bBlockApplication_ = true; XtPopup( widPopupShell_, XtGrabExclusive ); bWindowIsUp_ = true; bUserPushedCancel_ = false; XEvent xevent; bBlockApplication_ = true; while( bBlockApplication_ ) { XtAppNextEvent( GuiApp::pGetGuiApp()->ctxGetAppContext(), &xevent ); bool bWrongWindow = bInputEventToWrongWindow( xevent, widPopupShell_ ); XtDispatchEvent( &xevent ); if ( bWrongWindow ) { // I'd like to put up a message, but the user // may click "dismiss", which will repeat this error. raiseWindow(); GuiApp::beep(); } } XtRemoveCallback( widClipWindow_, XmNresizeCallback, cbResize, this ); XtPopdown( widPopupShell_ ); XtDestroyWidget( widPopupShell_ ); bUserPushedCancel = bUserPushedCancel_; } void guiGetUserDefinedTagInfo :: addWidgetsForOneField( userDefinedTagFieldType* pUserDefinedTagFieldType, const Widget widToAttachToAbove, const bool bAddingFormAtEndNotBetweenOtherForms, const int nIndexOfWhereToInsertForm, Widget& widFormForOneFieldCreated ) { widFormForOneFieldCreated = XtVaCreateManagedWidget( "fieldForm", xmFormWidgetClass, widForm_, XmNleftAttachment, XmATTACH_FORM, XmNrightAttachment, XmATTACH_FORM, XmNtopAttachment, XmATTACH_WIDGET, XmNtopWidget, widToAttachToAbove, XmNshadowThickness, 0, NULL ); Widget widEntry; if ( pUserDefinedTagFieldType->eFieldType_ == userDefinedTagFieldType::eInteger || pUserDefinedTagFieldType->eFieldType_ == userDefinedTagFieldType::eFloating ) { widEntry = XtVaCreateManagedWidget( "entry", xmTextFieldWidgetClass, widFormForOneFieldCreated, XmNtopAttachment, XmATTACH_FORM, XmNbottomAttachment, XmATTACH_FORM, NULL ); Widget widLabel = XtVaCreateManagedWidget( pUserDefinedTagFieldType->soFieldName_.data(), xmLabelWidgetClass, widFormForOneFieldCreated, XmNleftAttachment, XmATTACH_FORM, XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET, XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET, XmNtopWidget, widEntry, XmNbottomWidget, widEntry, NULL ); Dimension dimWidth; XtVaGetValues( widLabel, XmNwidth, &dimWidth, NULL ); XtVaSetValues( widEntry, XmNleftAttachment, XmATTACH_FORM, XmNleftOffset, dimWidth + nSpaceBetweenLabelAndField, NULL ); if ( pUserDefinedTagFieldType->eRepeatCode_ == userDefinedTagFieldType::eZeroOrMore || pUserDefinedTagFieldType->eRepeatCode_ == userDefinedTagFieldType::eOneOrMore ) { Widget widAddMore = XtVaCreateManagedWidget( "add another such field", xmPushButtonWidgetClass, widFormForOneFieldCreated, XmNrightAttachment, XmATTACH_FORM, XmNtopAttachment, XmATTACH_FORM, NULL ); // Widget widAddMore = XtVaCreateManagedWidget( // "add another such field", // xmPushButtonWidgetClass, // widFormForOneFieldCreated, // XmNleftAttachment, widEntry, // XmNleftOffset, 10, // XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET, // XmNtopWidget, widEntry, // XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET, // XmNbottomWidget, widEntry, // NULL ); passToUserPushedAddAnotherField* pPassToUserPushedAddAnotherField = new passToUserPushedAddAnotherField( this, widFormForOneFieldCreated ); XtAddCallback( widAddMore, XmNactivateCallback, cbUserPushedAddAnotherField, pPassToUserPushedAddAnotherField ); } } else if ( pUserDefinedTagFieldType->eFieldType_ == userDefinedTagFieldType::eString ) { Widget widLabel = XtVaCreateManagedWidget( pUserDefinedTagFieldType->soFieldName_.data(), xmLabelWidgetClass, widFormForOneFieldCreated, XmNleftAttachment, XmATTACH_FORM, XmNtopAttachment, XmATTACH_FORM, NULL ); short shRowsVisible = 3; const int nWidthInChars = 50; Arg aArg[30]; int nArgs = 0; XtSetArg( aArg[nArgs], XmNeditable, True ); nArgs++; XtSetArg( aArg[nArgs], XmNcursorPositionVisible, True ); nArgs++; XtSetArg( aArg[nArgs], XmNrows, shRowsVisible ); nArgs++; XtSetArg( aArg[nArgs], XmNeditMode, XmMULTI_LINE_EDIT ); nArgs++; XtSetArg( aArg[nArgs], XmNtraversalOn, True ); nArgs++; XtSetArg( aArg[nArgs], XmNtopAttachment, XmATTACH_WIDGET ); nArgs++; XtSetArg( aArg[nArgs], XmNtopWidget, widLabel ); nArgs++; XtSetArg( aArg[nArgs], XmNleftAttachment, XmATTACH_FORM ); nArgs++; XtSetArg( aArg[nArgs], XmNrightAttachment, XmATTACH_FORM ); nArgs++; XtSetArg( aArg[nArgs], XmNbottomAttachment, XmATTACH_FORM ); nArgs++; widEntry = XmCreateScrolledText( widFormForOneFieldCreated, "textentry", aArg, nArgs ); XtManageChild( widEntry ); if ( pUserDefinedTagFieldType->eRepeatCode_ == userDefinedTagFieldType::eZeroOrMore || pUserDefinedTagFieldType->eRepeatCode_ == userDefinedTagFieldType::eOneOrMore ) { Widget widAddMore = XtVaCreateManagedWidget( "add another such field", xmPushButtonWidgetClass, widFormForOneFieldCreated, XmNrightAttachment, XmATTACH_FORM, XmNtopAttachment, XmATTACH_FORM, NULL ); passToUserPushedAddAnotherField* pPassToUserPushedAddAnotherField = new passToUserPushedAddAnotherField( this, widFormForOneFieldCreated ); XtAddCallback( widAddMore, XmNactivateCallback, cbUserPushedAddAnotherField, pPassToUserPushedAddAnotherField ); } } else if ( pUserDefinedTagFieldType->eFieldType_ == userDefinedTagFieldType::ePointer ) { widEntry = XtVaCreateManagedWidget( "entry", xmTextFieldWidgetClass, widFormForOneFieldCreated, XmNtopAttachment, XmATTACH_FORM, XmNcolumns, 7, NULL ); RWCString soLabel = pUserDefinedTagFieldType->soFieldName_; soLabel += " (enter tag id)"; Widget widLabel = XtVaCreateManagedWidget( soLabel.data(), xmLabelWidgetClass, widFormForOneFieldCreated, XmNleftAttachment, XmATTACH_FORM, NULL ); Dimension dimWidth; XtVaGetValues( widLabel, XmNwidth, &dimWidth, NULL ); const int nSpaceBetweenLabelAndField = 10; XtVaGetValues( widLabel, XmNwidth, &dimWidth, NULL ); XtVaSetValues( widEntry, XmNleftAttachment, XmATTACH_FORM, XmNleftOffset, dimWidth + nSpaceBetweenLabelAndField, NULL ); Widget widFindTagButton = XtVaCreateManagedWidget( "Find Tag", xmPushButtonWidgetClass, widFormForOneFieldCreated, XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET, XmNtopWidget, widEntry, XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET, XmNbottomWidget, widEntry, XmNleftAttachment, XmATTACH_WIDGET, XmNleftWidget, widEntry, NULL ); Widget widAbove = widEntry; if ( pUserDefinedTagFieldType->eRepeatCode_ == userDefinedTagFieldType::eZeroOrMore || pUserDefinedTagFieldType->eRepeatCode_ == userDefinedTagFieldType::eOneOrMore ) { Widget widAddMore = XtVaCreateManagedWidget( "add another such field", xmPushButtonWidgetClass, widFormForOneFieldCreated, XmNrightAttachment, XmATTACH_FORM, XmNtopAttachment, XmATTACH_FORM, NULL ); passToUserPushedAddAnotherField* pPassToUserPushedAddAnotherField = new passToUserPushedAddAnotherField( this, widFormForOneFieldCreated ); XtAddCallback( widAddMore, XmNactivateCallback, cbUserPushedAddAnotherField, pPassToUserPushedAddAnotherField ); } // next line Widget widFoundTagType = XtVaCreateManagedWidget( "type", xmTextFieldWidgetClass, widFormForOneFieldCreated, XmNtopAttachment, XmATTACH_WIDGET, XmNtopWidget, widAbove, XmNleftAttachment, XmATTACH_FORM, XmNcolumns, 15, XmNeditable, False, NULL ); const int nIndented = 60; Widget widFoundTagTypeLabel = XtVaCreateManagedWidget( "type:", xmLabelWidgetClass, widFormForOneFieldCreated, XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET, XmNtopWidget, widFoundTagType, XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET, XmNbottomWidget, widFoundTagType, XmNleftAttachment, XmATTACH_FORM, XmNleftOffset, nIndented, // so it is indented NULL ); XtVaGetValues( widFoundTagTypeLabel, XmNwidth, &dimWidth, NULL ); XtVaSetValues( widFoundTagType, XmNleftAttachment, XmATTACH_FORM, XmNleftOffset, nIndented + dimWidth + nSpaceBetweenLabelAndField, NULL ); Widget widLeft = widFoundTagType; Widget widLocationLabel = XtVaCreateManagedWidget( "location:", xmLabelWidgetClass, widFormForOneFieldCreated, XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET, XmNtopWidget, widLeft, XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET, XmNbottomWidget, widLeft, XmNleftAttachment, XmATTACH_WIDGET, XmNleftWidget, widLeft, NULL ); widLeft = widLocationLabel; Widget widLocationOfFoundTag = XtVaCreateManagedWidget( "locationOutput", xmTextFieldWidgetClass, widFormForOneFieldCreated, XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET, XmNtopWidget, widLeft, XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET, XmNbottomWidget, widLeft, XmNleftAttachment, XmATTACH_WIDGET, XmNleftWidget, widLeft, XmNcolumns, 40, XmNeditable, False, NULL ); passToFindTag* pPassToFindTag = new passToFindTag( this, widEntry, widFoundTagType, widLocationOfFoundTag, pUserDefinedTagFieldType ); XtAddCallback( widFindTagButton, XmNactivateCallback, cbUserPushedFindTagButton, pPassToFindTag ); } else { assert( false ); } if ( bAddingFormAtEndNotBetweenOtherForms ) { aUserEntryWidget_.insert( widEntry ); aFormWidget_.insert( widFormForOneFieldCreated ); aUserDefinedTagFieldType_.insert( pUserDefinedTagFieldType ); } else { aUserEntryWidget_.insertAt( nIndexOfWhereToInsertForm, widEntry ); aFormWidget_.insertAt( nIndexOfWhereToInsertForm, widFormForOneFieldCreated ); aUserDefinedTagFieldType_.insertAt( nIndexOfWhereToInsertForm, pUserDefinedTagFieldType ); } } void guiGetUserDefinedTagInfo :: userResizedWindow() { if ( !bWindowIsUp_ ) return; Dimension dimClipWindowWidth; XtVaGetValues( widClipWindow_, XmNwidth, &dimClipWindowWidth, NULL ); XtVaSetValues( widForm_, XmNwidth, dimClipWindowWidth, NULL ); } // guiGetUserDefinedTagInfo :: ~guiGetUserDefinedTagInfo() { // XtRemoveCallback( widClipWindow_, // XmNresizeCallback, // cbResize, // this ); // XtPopdown( widPopupShell_ ); // XtDestroyWidget( widPopupShell_ ); // } void guiGetUserDefinedTagInfo :: userPushedCancel() { bUserPushedCancel_ = true; bBlockApplication_ = false; } void guiGetUserDefinedTagInfo :: raiseWindow() { XtMapWidget( widPopupShell_ ); XRaiseWindow( XtDisplay( widPopupShell_ ), XtWindow( widPopupShell_ ) ); } void guiGetUserDefinedTagInfo :: userPushedOK() { bool bError = false; verifyAndStoreFields( bError ); if ( bError) return; bBlockApplication_ = false; } void guiGetUserDefinedTagInfo :: verifyAndStoreFields( bool& bError ) { pTag_->clearUserDefinedFields(); for( int nField = 0; nField < aUserEntryWidget_.length(); ++nField ) { Widget widEntry = aUserEntryWidget_[ nField ]; userDefinedTagFieldType* pUserDefinedTagFieldType = aUserDefinedTagFieldType_[ nField ]; char* szEnteredData; if ( pUserDefinedTagFieldType->eFieldType_ == userDefinedTagFieldType::eString ) { szEnteredData = XmTextGetString( widEntry ); } else { szEnteredData = XmTextFieldGetString( widEntry ); } RWCString soEnteredData( szEnteredData ); XtFree( szEnteredData ); soEnteredData.stripAllWhitespaceExceptInternal(); if ( soEnteredData.isNull() ) continue; RWCString soErrorMessage; if ( !pUserDefinedTagFieldType->bIsOK( soEnteredData, pTag_, soErrorMessage ) ) { popupErrorMessage2( widPopupShell_, soErrorMessage ); bError = true; return; } } RWCString soErrorMessage; if ( !pTag_->pUserDefinedTagType_->bCorrectNumberOfEachField( pTag_->pArrayOfUserDefinedTagFields_, soErrorMessage ) ) { bError = true; popupErrorMessage2( widPopupShell_, soErrorMessage ); return; } bError = false; } void guiGetUserDefinedTagInfo :: userPushedFindTagButton( Widget widUserEntersTagID, Widget widFoundTagType, Widget widLocationOfFoundTag, userDefinedTagFieldType* pUserDefinedTagFieldType ) { char* szTagID = XmTextFieldGetString( widUserEntersTagID ); RWCString soTagID( szTagID ); XtFree( szTagID ); long lTagID; if ( !bIsNumericLongMaybeWithWhitespace( soTagID, lTagID ) ) { RWCString soErrorMessage = "The tag id: "; soErrorMessage += soTagID; soErrorMessage += " is not numeric."; popupErrorMessage2( widPopupShell_, soErrorMessage.data() ); return; } tag* pTag = ConsEd::pGetAssembly()->pFindTagWithThisID( lTagID ); if ( !pTag ) { RWCString soErrorMessage = "No tag in this assembly with ID "; soErrorMessage += soTagID; popupErrorMessage2( widPopupShell_, soErrorMessage.data() ); return; } XmTextFieldSetString( widFoundTagType, pTag->soType_.data() ); RWCString soLocation = pTag->pGetContig()->soGetName(); soLocation += " "; soLocation += RWCString( (long) pTag->nGetUnpaddedStart() ); soLocation += "-"; soLocation += RWCString( (long) pTag->nGetUnpaddedEnd() ); if ( pTag->bReadTagNotConsensusTag_ ) { soLocation += " on read "; soLocation += pTag->pLocFrag_->soGetName(); } else { soLocation += " on consensus"; } XmTextFieldSetString( widLocationOfFoundTag, soLocation.data() ); // I also should check that the type of tag found is the type // specified for this field. if ( pUserDefinedTagFieldType->soPointerToWhichTagType_ != pTag->soType_ ) { RWCString soErrorMessage = "This field should have had an id of a "; soErrorMessage += pUserDefinedTagFieldType->soPointerToWhichTagType_; soErrorMessage += " tag instead of a "; soErrorMessage += pTag->soType_; soErrorMessage += " tag"; popupErrorMessage2( widPopupShell_, soErrorMessage.data() ); return; } } void guiGetUserDefinedTagInfo :: userPushedAddAnotherField( const Widget widFormForOneField ) { // find where this widget is: int nIndexOfFormWidget = aFormWidget_.index( widFormForOneField ); assert( nIndexOfFormWidget != RW_NPOS ); userDefinedTagFieldType* pUserDefinedTagFieldType = aUserDefinedTagFieldType_[ nIndexOfFormWidget ]; Widget widFormForOneFieldCreated; if ( nIndexOfFormWidget < ( aFormWidget_.length() - 1 ) ) { // case in which the current form widget has another form // below it. So insert another one. // this must be done before addWidgetsForOneField since that will // move the widgets down Widget widFormAfter = aFormWidget_[ nIndexOfFormWidget + 1 ]; addWidgetsForOneField( pUserDefinedTagFieldType, aFormWidget_[ nIndexOfFormWidget ], // widget to attach to above false, // bAppendFieldToList nIndexOfFormWidget + 1, // where to insert field widFormForOneFieldCreated ); // in list // reconnect the widget afterwards to the one just added XtVaSetValues( widFormAfter, XmNtopAttachment, XmATTACH_WIDGET, XmNtopWidget, widFormForOneFieldCreated, NULL ); } else { addWidgetsForOneField( pUserDefinedTagFieldType, aFormWidget_[ nIndexOfFormWidget ], // widget to attach to above true, // bAppendFieldToList 0, // not used widFormForOneFieldCreated ); } // important to keep the form widget from shrinking back again userResizedWindow(); }