/***************************************************************************** # 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 "guiPopupWholeReadItem.h" #include "wholeReadItem.h" #include "handleWindowManagerDelete2.h" #include "hp_exception_kludge.h" #include #include #include #include #include #include #include #include "guiapp.h" #include "rwcstring.h" #include static void cbUserPushedDismiss( Widget wid, XtPointer pClientData, XtPointer pCallData ) { guiPopupWholeReadItem* pGuiPopupWholeReadItem = ( guiPopupWholeReadItem*) pClientData; TRY_CATCH_WRAPPER( delete pGuiPopupWholeReadItem ); } guiPopupWholeReadItem :: guiPopupWholeReadItem( Widget widParent, wholeReadItem* pWholeReadItem ) { // Note: If you use XtVaCreateManagedWidget instead of // XtVaCreatePopupShell, the box comes up as a little tiny box // and you can't see anything widPopupShell_ = XtVaCreatePopupShell( "wholeReadItem", topLevelShellWidgetClass, widParent, XmNtitle, (char*) pWholeReadItem->soType_.data(), XmNtransient, False, XmNdeleteResponse, XmDO_NOTHING, // XmNwidth, (Dimension) (70 * GuiApp::nGetFontWidth()), NULL ); handleWindowManagerDelete2( widPopupShell_, cbUserPushedDismiss, this ); // create the form widget Widget widForm = XtVaCreateManagedWidget( "form", xmFormWidgetClass, widPopupShell_, XmNshadowThickness, 0, XmNborderWidth, 0, NULL ); Widget widRowCol = XtVaCreateManagedWidget( "rowcol", xmRowColumnWidgetClass, widForm, XmNtopAttachment, XmATTACH_FORM, XmNleftAttachment, XmATTACH_FORM, XmNrightAttachment, XmATTACH_FORM, XmNorientation, XmVERTICAL, XmNnumColumns, 1, XmNpacking, XmPACK_COLUMN, NULL ); Widget widTypeForm = XtVaCreateManagedWidget( "form", xmFormWidgetClass, widRowCol, XmNshadowThickness, 0, NULL ); const Position nLeftColumn = 60; Widget widTypeLabel = XtVaCreateManagedWidget( "Type:", xmLabelWidgetClass, widTypeForm, XmNtopAttachment, XmATTACH_FORM, XmNbottomAttachment, XmATTACH_FORM, XmNrightAttachment, XmATTACH_POSITION, XmNrightPosition, nLeftColumn, XmNalignment, XmALIGNMENT_END, NULL ); const Position nRightColumn = 65; Widget widType = XtVaCreateManagedWidget( "Typedata", xmTextFieldWidgetClass, widTypeForm, XmNtopAttachment, XmATTACH_FORM, XmNbottomAttachment, XmATTACH_FORM, XmNleftAttachment, XmATTACH_POSITION, XmNleftPosition, nRightColumn, XmNrightAttachment, XmATTACH_FORM, XmNvalue, (char*) pWholeReadItem->soType_.data(), XmNeditable, False, XmNcursorPositionVisible, False, XmNtraversalOn, False, NULL ); Widget widSourceForm = XtVaCreateManagedWidget( "sourceform", xmFormWidgetClass, widRowCol, XmNshadowThickness, 0, NULL ); Widget widSourceLabel = XtVaCreateManagedWidget( "Source:", xmLabelWidgetClass, widSourceForm, XmNtopAttachment, XmATTACH_FORM, XmNbottomAttachment, XmATTACH_FORM, XmNleftAttachment, XmATTACH_FORM, XmNrightAttachment, XmATTACH_POSITION, XmNrightPosition, nLeftColumn, XmNalignment, XmALIGNMENT_END, NULL ); Widget widSource = XtVaCreateManagedWidget( "sourcedata", xmTextFieldWidgetClass, widSourceForm, XmNtopAttachment, XmATTACH_FORM, XmNbottomAttachment, XmATTACH_FORM, XmNrightAttachment, XmATTACH_FORM, XmNleftAttachment, XmATTACH_POSITION, XmNleftPosition, nRightColumn, XmNvalue, (char*) pWholeReadItem->soSource_.data(), XmNeditable, False, XmNcursorPositionVisible, False, XmNtraversalOn, False, NULL ); Widget widDateTimeForm = XtVaCreateManagedWidget( "dateform", xmFormWidgetClass, widRowCol, XmNshadowThickness, 0, NULL ); Widget widDateTimeLabel = XtVaCreateManagedWidget( "Date:Time", xmLabelWidgetClass, widDateTimeForm, XmNtopAttachment, XmATTACH_FORM, XmNbottomAttachment, XmATTACH_FORM, XmNleftAttachment, XmATTACH_FORM, XmNrightAttachment, XmATTACH_POSITION, XmNrightPosition, nLeftColumn, XmNalignment, XmALIGNMENT_END, NULL ); Widget widDateTime = XtVaCreateManagedWidget( "datetimedata", xmTextFieldWidgetClass, widDateTimeForm, XmNtopAttachment, XmATTACH_FORM, XmNbottomAttachment, XmATTACH_FORM, XmNleftAttachment, XmATTACH_POSITION, XmNleftPosition, nRightColumn, XmNrightAttachment, XmATTACH_FORM, XmNvalue, (char*) pWholeReadItem->soDateTime_.data(), XmNeditable, False, XmNcursorPositionVisible, False, XmNtraversalOn, False, NULL ); Widget widDataLabel = XtVaCreateManagedWidget( "Data:", xmLabelWidgetClass, widForm, XmNtopAttachment, XmATTACH_WIDGET, XmNtopWidget, widRowCol, XmNleftAttachment, XmATTACH_FORM, NULL ); // now put bottom dismiss button on widDismissButton_ = XtVaCreateManagedWidget( "Dismiss", xmPushButtonWidgetClass, widForm, XmNbottomAttachment, XmATTACH_FORM, XmNbottomOffset, 10, XmNleftAttachment, XmATTACH_POSITION, XmNleftPosition, 40, XmNrightAttachment, XmATTACH_POSITION, XmNrightPosition, 60, NULL ); XtAddCallback( widDismissButton_, XmNactivateCallback, (XtCallbackProc) cbUserPushedDismiss, this ); // put data fields between the data label and the dismiss button Arg aArg[ 100 ]; int nArgs = 0; XtSetArg( aArg[nArgs], XmNtopAttachment, XmATTACH_WIDGET ); ++nArgs; XtSetArg( aArg[nArgs], XmNtopWidget, widDataLabel ); ++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; XtSetArg( aArg[nArgs], XmNrows, 3 ); ++nArgs; XtSetArg( aArg[nArgs], XmNcolumns, 70 ); ++nArgs; XtSetArg( aArg[nArgs], XmNvalue, (char*) pWholeReadItem->soData_.data() ); ++nArgs; XtSetArg( aArg[nArgs], XmNeditable, False ); ++nArgs; XtSetArg( aArg[nArgs], XmNeditMode, XmMULTI_LINE_EDIT ); ++nArgs; XtSetArg( aArg[nArgs], XmNcursorPositionVisible, False ); ++nArgs; XtSetArg( aArg[nArgs], XmNtraversalOn, True ); ++nArgs; Widget widData = XmCreateScrolledText( widForm, "data", aArg, nArgs ); XtManageChild( widData ); XtPopup( widPopupShell_, XtGrabNone ); } guiPopupWholeReadItem :: ~guiPopupWholeReadItem() { XtPopdown( widPopupShell_ ); XtDestroyWidget( widPopupShell_ ); }