/***************************************************************************** # 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.part9 } void guiEditResources :: userResizedWindow() { if ( !bAllTheWayUp_ ) return; Dimension dimClipWindowWidth; XtVaGetValues( widClipWindow_, XmNwidth, &dimClipWindowWidth, NULL ); // it is only necessary to set one form in the row-col widget // to get the entire row-col widget to increase in size and, apparently, // this causes all the form widgets within it to increase in size as well // This makes all the textfield widgets that are connected to the right end // to resize as well. XtVaSetValues( widPrimersSubcloneFullPathnameForm_, XmNwidth, dimClipWindowWidth, NULL ); // for some reason, Motif changes the increment when the window is resized. XtVaSetValues( widVerticalScrollBar_, XmNincrement, 20, NULL ); } void guiEditResources :: userPushedHelp( const RWCString& soResource ) { int n; bool bFound = false; int nStartIndex; for( n = 0; aszDefaultResources[n] && !bFound; ++n ) { char* pFound = strstr( aszDefaultResources[n], soResource.data() ); if ( pFound == aszDefaultResources[n] ) { bFound = true; nStartIndex = n; } } if ( !bFound ) { RWCString soError = "Internal program error finding "; soError += soResource; popupErrorMessage( soError ); return; } // now find the end int nEndIndex; bool bFoundEnd = false; for( n = nStartIndex + 1; !bFoundEnd; ++n ) { if ( !aszDefaultResources[n] ) { bFoundEnd = true; nEndIndex = n - 1; } else if ( memcmp( "consed.", aszDefaultResources[n], 7 ) == 0 ) { // found next resources bFoundEnd = true; nEndIndex = n - 1; } } if ( !bFoundEnd ) { RWCString soError = "Internal program error b finding "; soError += soResource; popupErrorMessage( soError ); return; } RWCString soToDisplay; for( n = nStartIndex; n <= nEndIndex; ++n ) { soToDisplay += RWCString( aszDefaultResources[n] ); } soToDisplay += "\n"; soToDisplay += "(YES) = freely customize to your own site\n"; soToDisplay += "(OK) = don't change unless you have a specific need and know what you\n"; soToDisplay += " are doing\n"; soToDisplay += "(NO) = don't change this!\n"; TextBox* pDocumentationWindow = new TextBox( soResource, 15, // rows visible soToDisplay ); pDocumentationWindow->makeVisible(); } void guiEditResources :: windowCameUp() { XtVaGetValues( widScrolledWindow_, XmNverticalScrollBar, &widVerticalScrollBar_, NULL ); XtVaSetValues( widVerticalScrollBar_, XmNincrement, 20, NULL ); } void guiEditResources :: userPushedFindButton( const bool bFindFirstNotFindNext ) { char* szValue = XmTextFieldGetString( widEnterParameter_ ); RWCString soValue = szValue; XtFree( szValue ); RWCString soOriginalCase = soValue; soValue.toLower(); int nStartIndex = ( bFindFirstNotFindNext ? 0 : nIndexOfLastFoundResource_ + 1 ); bool bFound = false; for( int nParameter = nStartIndex; nParameter < aConsedResources_.length() && ! bFound; ++nParameter ) { if ( aConsedResources_[ nParameter ].index( soValue ) != RW_NPOS ) { nIndexOfLastFoundResource_ = nParameter; bFound = true; } } if ( !bFound ) { popupErrorMessage( "could not find %s", soOriginalCase.data() ); return; } int nScrollBarMax; int nScrollBarMin; int nSliderSize; XtVaGetValues( widVerticalScrollBar_, XmNmaximum, &nScrollBarMax, XmNminimum, &nScrollBarMin, XmNsliderSize, &nSliderSize, NULL ); const int nMarginAtTop = 20; int nNewValue = nIndexOfLastFoundResource_ * (double) ( nScrollBarMax - nScrollBarMin + 1 ) / (double) aConsedResources_.length() - nMarginAtTop; if ( nNewValue < 0 ) nNewValue = 0; else if ( nNewValue > ( nScrollBarMax - nSliderSize - nScrollBarMin + 1 ) ) nNewValue = nScrollBarMax - nSliderSize - nScrollBarMin + 1; XtVaSetValues( widVerticalScrollBar_, XmNvalue, nNewValue, NULL ); XmScrollBarCallbackStruct xmMyScrollBarCallbackStruct; xmMyScrollBarCallbackStruct.reason = 0; xmMyScrollBarCallbackStruct.event = 0; xmMyScrollBarCallbackStruct.value = nNewValue; xmMyScrollBarCallbackStruct.pixel = 0; XtCallCallbacks( widVerticalScrollBar_, XmNvalueChangedCallback, &xmMyScrollBarCallbackStruct ); } void guiEditResources :: createResourceArray() { aConsedResources_.resize( (size_t) 200 ); // guiEditResources.cpp.part10