/***************************************************************************** # 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. # #*****************************************************************************/ // guiEditResources.cpp.part3 void guiEditResources :: createWindow() { PleaseWait* pPleaseWait = new PleaseWait(); resources_ = *consedResources::pCurrentResources_; Widget widFalseButton; // these are needed by the makeWidget... macros Pixel pixForeground; Pixel pixBackground; // get colors for when the resource is different pixValueChangedForegroundColor_ = ulGetXColorForColorName( "cornsilk" ); pixValueChangedBackgroundColor_ = ulGetXColorForColorName( "red" ); int nArgs; Arg aArg[50]; if ( bStandAlone_ ) { widPopupShell_ = GAPP->widGetTopLevel(); } else { widPopupShell_ = XtVaCreatePopupShell( "Edit Consed/Autofinish Parameters", topLevelShellWidgetClass, GAPP->widGetTopLevel(), XmNtitle, "Edit Parameters", XmNnoResize, False, XmNtransient, False, XmNdeleteResponse, XmDO_NOTHING, NULL ); handleWindowManagerDelete2( widPopupShell_, cbCancelButton, this ); } // create a form widget Widget widTopForm = XtVaCreateManagedWidget( "top form", xmFormWidgetClass, widPopupShell_, XmNshadowThickness, 0, XmNborderWidth, 0, NULL ); XtVaGetValues( widTopForm, XmNforeground, &pixValueUnchangedForegroundColor_, XmNbackground, &pixValueUnchangedBackgroundColor_, NULL ); // labels on the top of the form Widget widColumn1Label = XtVaCreateManagedWidget( "current values:", xmLabelWidgetClass, widTopForm, XmNtopAttachment, XmATTACH_FORM, XmNleftAttachment, XmATTACH_FORM, XmNalignment, XmALIGNMENT_BEGINNING, NULL ); Widget widAttachWidgetToBottomOfThis = widColumn1Label; Widget widColumn2Label = XtVaCreateManagedWidget( "default values:", xmLabelWidgetClass, widTopForm, XmNtopAttachment, XmATTACH_FORM, XmNleftAttachment, XmATTACH_POSITION, XmNleftPosition, 50, XmNalignment, XmALIGNMENT_BEGINNING, NULL ); // put buttons on the bottom of the form widSaveButton_ = XtVaCreateManagedWidget( "Save", xmPushButtonWidgetClass, widTopForm, XmNbottomAttachment, XmATTACH_FORM, XmNbottomOffset, 10, XmNleftAttachment, XmATTACH_POSITION, XmNleftPosition, 4, XmNrightAttachment, XmATTACH_POSITION, XmNrightPosition, 16, NULL ); Widget widAttachWidgetsToTopOfThis = widSaveButton_; XtAddCallback( widSaveButton_, XmNactivateCallback, cbUserPushedSaveButton, this ); widCancelButton_ = XtVaCreateManagedWidget( "Dismiss", xmPushButtonWidgetClass, widTopForm, XmNbottomAttachment, XmATTACH_FORM, XmNbottomOffset, 10, XmNleftAttachment, XmATTACH_POSITION, XmNleftPosition, 84, XmNrightAttachment, XmATTACH_POSITION, XmNrightPosition, 96, NULL ); XtAddCallback( widCancelButton_, XmNactivateCallback, cbCancelButton, this ); // create a set of 3 radio buttons: one for just user // one for project // one for all users and all projects Widget widWhichConsedrcRadioBox = XmCreateRadioBox( widTopForm, "radio", NULL, 0 ); XtVaSetValues( widWhichConsedrcRadioBox, XmNtraversalOn, True, XmNbottomAttachment, XmATTACH_WIDGET, XmNbottomOffset, 20, XmNbottomWidget, widAttachWidgetsToTopOfThis, XmNleftAttachment, XmATTACH_FORM, XmNrightAttachment, XmATTACH_FORM, XmNorientation, XmHORIZONTAL, NULL ); XtManageChild( widWhichConsedrcRadioBox ); widAttachWidgetsToTopOfThis = widWhichConsedrcRadioBox; widUserRadioButton_ = XtVaCreateManagedWidget( "just user", xmToggleButtonWidgetClass, widWhichConsedrcRadioBox, XmNset, True, NULL ); widProjectRadioButton_ = XtVaCreateManagedWidget( "just project", xmToggleButtonWidgetClass, widWhichConsedrcRadioBox, XmNset, False, NULL ); widAllUsersAllProjectsRadioButton_ = XtVaCreateManagedWidget( "all users/all projects", xmToggleButtonWidgetClass, widWhichConsedrcRadioBox, XmNset, False, NULL ); Widget widEnterParameterLabel = XtVaCreateManagedWidget( "Find Parameter:", xmLabelWidgetClass, widTopForm, XmNleftAttachment, XmATTACH_FORM, XmNleftOffset, 10, NULL ); widEnterParameter_ = XtVaCreateManagedWidget( "Find Parameter", xmTextFieldWidgetClass, widTopForm, XmNbottomAttachment, XmATTACH_WIDGET, XmNbottomWidget, widAttachWidgetsToTopOfThis, XmNbottomOffset, 10, NULL ); XtAddCallback( widEnterParameter_, XmNactivateCallback, cbFindFirstButton, this ); // funny business to avoid circular dependency of // widEnterParameter_ and widEnterParameterLabel Dimension dimWidthOfLabel; XtVaGetValues( widEnterParameterLabel, XmNwidth, &dimWidthOfLabel, NULL ); XtVaSetValues( widEnterParameter_, XmNleftAttachment, XmATTACH_FORM, XmNleftOffset, ( dimWidthOfLabel + 10 + 10 ), NULL ); XtVaSetValues( widEnterParameterLabel, XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET, XmNbottomWidget, widEnterParameter_, XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET, XmNtopWidget, widEnterParameter_, NULL ); widAttachWidgetsToTopOfThis = widEnterParameterLabel; Widget widFindFirst = XtVaCreateManagedWidget( "Find First", xmPushButtonWidgetClass, widTopForm, XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET, XmNtopWidget, widEnterParameter_, XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET, XmNbottomWidget, widEnterParameter_, XmNleftAttachment, XmATTACH_WIDGET, XmNleftWidget, widEnterParameter_, XmNleftOffset, 10, NULL ); XtAddCallback( widFindFirst, XmNactivateCallback, cbFindFirstButton, this ); Widget widFindNext = XtVaCreateManagedWidget( "Find Next", xmPushButtonWidgetClass, widTopForm, XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET, XmNtopWidget, widEnterParameter_, XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET, XmNbottomWidget, widEnterParameter_, XmNleftAttachment, XmATTACH_WIDGET, XmNleftWidget, widFindFirst, XmNleftOffset, 10, NULL ); XtAddCallback( widFindNext, XmNactivateCallback, cbFindNextButton, this ); widScrolledWindow_ = XtVaCreateManagedWidget( "scrolled", xmScrolledWindowWidgetClass, widTopForm, XmNtopAttachment, XmATTACH_WIDGET, XmNtopWidget, widAttachWidgetToBottomOfThis, XmNleftAttachment, XmATTACH_FORM, XmNrightAttachment, XmATTACH_FORM, XmNbottomAttachment, XmATTACH_WIDGET, XmNbottomWidget, widAttachWidgetsToTopOfThis, XmNbottomOffset, 20, XmNscrollingPolicy, XmAUTOMATIC, XmNscrollBarDisplayPolicy, XmSTATIC, XmNheight, (Dimension) GuiApp::nGetFontHeight() * 50, NULL ); Widget widRowCol = XtVaCreateManagedWidget( "rowcol", xmRowColumnWidgetClass, widScrolledWindow_, XmNorientation, XmVERTICAL, XmNnumColumns, 1, XmNpacking, XmPACK_COLUMN, NULL ); // this funny business is to make boxes expand when the user expands // the scrolling window XmScrolledWindowSetAreas( widScrolledWindow_, NULL, NULL, widRowCol ); XtVaGetValues( widScrolledWindow_, XmNclipWindow, &widClipWindow_, NULL ); XtAddCallback( widClipWindow_, XmNresizeCallback, cbResize, this ); helpCallbackInfo* pHelp = NULL; // this is where all the of the computer-generated widgets go // guiEditResources.cpp.part4