void WebAddressDlg::ShowWebAddressOnSelection(BOOL fValue) { if (fValue) SetStringGadgetValue(IDOK, _R(IDS_ADDBUTTON_CHANGE)); else SetStringGadgetValue(IDOK, _R(IDS_ADDBUTTON_ADD)); }
void CInitBrushNameDlg::InitGadgetText(String_32* pString, BOOL resizeDialog /*= TRUE*/) { if (pString != NULL) m_strSuggest = *pString; SetStringGadgetValue(_R(IDC_EDITBRUSHNAME), *GetSuggestion(&m_strSuggest)); // change the dialog title to "Enter brush name:" // Errr, NO! This is very bad for translation! // String_256 Name = TEXT("Create new brush:"); // SetTitlebarName(&Name); // Show the help button HideGadget(_R(ID_CC_HELP_BUTTON), FALSE); // show the group info text SetStringGadgetValue(_R(IDC_STATICBRUSHGROUP), _R(IDS_BRUSHGROUP)); HideGadget(_R(IDC_STATICBRUSHGROUP), FALSE); HighlightText(_R(IDC_EDITBRUSHNAME)); SetKeyboardFocus(_R(IDC_EDITBRUSHNAME)); }
void ArrangeAlignment::BuildIDSDropList(const CGadgetID DropListID, const INT32* IDSList, INT32 Default) { // Make sure the list is empty DeleteAllValues(DropListID); // build the list String_32 Str; INT32 i=0; while (IDSList[i]) { Str.MakeMsg(IDSList[i]); SetStringGadgetValue( DropListID, Str ); i++; } SetComboListLength(DropListID); // select one of the entries in the list if (Default<0 || Default>=i) { ERROR3("BuildIDSDropList() passed a default outside the list"); Default=0; } SetSelectedValueIndex(DropListID,Default); }
void WebAddressDlg::ShowURL(TCHAR* pcURL) { //First set a flag to ensure we don't handle the "Text changed" message //that will occur when we change the edit field. WebAddressDlg::DontHandleNextTextMessage=TRUE; //Is pcURL NULL? if (pcURL==NULL) //Yes. So set a blank string in the edit field SetStringGadgetValue(_R(IDC_WEBADDRESS_URL), &String_256(""), FALSE, -1); else { //No. So set the string we have been given in the edit field String_256 strToSet=pcURL; SetStringGadgetValue(_R(IDC_WEBADDRESS_URL), &strToSet, FALSE, -1); } }
void WebAddressDlg::ShowFrame(UINT32 uiFrame) { //First set a flag to ensure we don't handle the "Text changed" message //that will occur when we change the edit field. WebAddressDlg::DontHandleNextTextMessage=TRUE; //Simply set the string SetStringGadgetValue(_R(IDC_WEBADDRESS_FRAME), uiFrame, FALSE, -1); }
void WebAddressDlg::ShowFrame(TCHAR* pcFrame) { //Is pcFrame NULL? if (pcFrame==NULL) //Yes. So set a blank string in the frame field SetStringGadgetValue(_R(IDC_WEBADDRESS_FRAME), &String_256(""), FALSE, -1); else { //No. //First put the string into one of Camelot's string classes String_256 strFrame=pcFrame; //And check to see if the string is one of our short strings //This if/else statement is basically a large switch statement if (strFrame==String_256(_R(IDS_WEBADDRESS_SHORT_SELF))) SetSelectedValueIndex(_R(IDC_WEBADDRESS_FRAME), 0); else if (strFrame==String_256(_R(IDS_WEBADDRESS_SHORT_PARENT))) SetSelectedValueIndex(_R(IDC_WEBADDRESS_FRAME), 1); else if (strFrame==String_256(_R(IDS_WEBADDRESS_SHORT_TOP))) SetSelectedValueIndex(_R(IDC_WEBADDRESS_FRAME), 2); else if (strFrame==String_256(_R(IDS_WEBADDRESS_SHORT_BLANK))) SetSelectedValueIndex(_R(IDC_WEBADDRESS_FRAME), 3); else if (strFrame==String_256(_R(IDS_WEBADDRESS_SHORT_DEFAULT))) SetSelectedValueIndex(_R(IDC_WEBADDRESS_FRAME), 4); else //Otherwise, set the string in the edit field SetStringGadgetValue(_R(IDC_WEBADDRESS_FRAME), &strFrame, FALSE, -1); } }
void CustomizeBarDlg::ShowOpsList() { OpListItem* pOpListItem = OpDescriptor::GetFirstDescriptor(); OpDescriptor* pCurrentOpDesc; ENSURE(pOpListItem,"Wot, no OpDescriptors?"); while (pOpListItem) { pCurrentOpDesc = pOpListItem->pOpDesc; ENSURE(pCurrentOpDesc,"OpListitem doesn't point to OpDescriptor in ShowOpsList"); SetStringGadgetValue(_R(IDC_OPSLIST),&(pCurrentOpDesc->Token),TRUE,0); pOpListItem = OpDescriptor::GetNextDescriptor(pOpListItem); } }
void WebAddressDlg::SetDialogInitialControls() { //First, we want to know what the WebAddressAttribute applied to the selection //is. //This variable will hold that attribute WebAddressAttribute waaApplied; //Then call this function to find the state of the WebAddressAttribute(s) //applied to the selection WebCommonAttributeResult aasApplied=FindCommonWebAttribute(&waaApplied); //Edit field and combo box //First set up the combo box list DeleteAllValues(_R(IDC_WEBADDRESS_FRAME)); SetStringGadgetValue(_R(IDC_WEBADDRESS_FRAME), _R(IDS_WEBADDRESS_COMBO_SELF), FALSE, 0); SetStringGadgetValue(_R(IDC_WEBADDRESS_FRAME), _R(IDS_WEBADDRESS_COMBO_PARENT), FALSE, 1); SetStringGadgetValue(_R(IDC_WEBADDRESS_FRAME), _R(IDS_WEBADDRESS_COMBO_TOP), FALSE, 2); SetStringGadgetValue(_R(IDC_WEBADDRESS_FRAME), _R(IDS_WEBADDRESS_COMBO_BLANK), FALSE, 3); SetStringGadgetValue(_R(IDC_WEBADDRESS_FRAME), _R(IDS_WEBADDRESS_COMBO_DEFAULT), FALSE, 4); SetComboListLength(_R(IDC_WEBADDRESS_FRAME)); // If a single attribute is applied or the default attribute // is applied, set it into the edit fields if (aasApplied==WCA_SINGLE || aasApplied==WCA_DEFAULT) { ShowURL(waaApplied.m_url.GetWebAddress()); ShowFrame(waaApplied.m_pcFrame); } //If many attributes are applied, put <Many> into the edit fields if (aasApplied==WCA_MANY) { ShowURL(String_256(_R(IDS_WEBADDRESSDLG_MANY))); ShowFrame(String_256(_R(IDS_WEBADDRESSDLG_MANY))); } //If nothing is selected, clear the edit fields if (aasApplied==WCA_NOSELECTION) { ShowURL(); ShowFrame(); } //Radio buttons //If a single attribute is applied, set the radio buttons accordingly if (aasApplied==WCA_SINGLE) ShowClickableArea(waaApplied.m_fBounding); //If many attributes are applied, or if nothing is selected, //give the radio buttons an indeterminate value if (aasApplied==WCA_MANY || aasApplied==WCA_NOSELECTION) ShowClickableArea(2); //If the default attribute is applied to the selection... if (aasApplied==WCA_DEFAULT) //Then if the selection consists only of text, set the "Rectangle" radio button. //Otherwise, set the "Object shape" radio button ShowClickableArea(SelectionConsistsOfText()); //AutoCorrect switch ShowCorrect(ms_fCorrect); //Buttons //Grey the Add/Change button EnableAdd(FALSE); //If one or many attributes are applied to the selection, enable the Remove button. //Otherwise, grey the Remove button EnableRemove((aasApplied==WCA_SINGLE || aasApplied==WCA_MANY)); }
void ImagemapDlg::SetOptions(ImagemapFilterOptions ifoSet) { //First let's set the options which we should get from ifoSet. //These are the controls which remember the values which the user set //for the last export. //Set the "save clickable areas as rectangles" SetLongGadgetValue(_R(IDC_IMAGEMAP_ALLRECTANGLES), ifoSet.m_fAllRectangles); //Set the "copy imagemap to clipboard" SetLongGadgetValue(_R(IDC_IMAGEMAP_CLIPBOARD), ifoSet.m_fClipboard); //Set up the "Approximate curves with lines" drop down box DeleteAllValues(_R(IDC_IMAGEMAP_APPROX)); SetStringGadgetValue(_R(IDC_IMAGEMAP_APPROX), &String_256(_R(IDS_IMAGEMAP_APPROX_VERYCLOSELY)), FALSE, 0); SetStringGadgetValue(_R(IDC_IMAGEMAP_APPROX), &String_256(_R(IDS_IMAGEMAP_APPROX_CLOSELY)), FALSE, 1); SetStringGadgetValue(_R(IDC_IMAGEMAP_APPROX), &String_256(_R(IDS_IMAGEMAP_APPROX_APPROXIMATELY)), FALSE, 2); SetStringGadgetValue(_R(IDC_IMAGEMAP_APPROX), &String_256(_R(IDS_IMAGEMAP_APPROX_NOTATALL)), FALSE, 3); SetComboListLength(_R(IDC_IMAGEMAP_APPROX)); //And choose the appropriate value switch (ifoSet.m_ffApprox) { case FF_VERYCLOSELY: SetSelectedValueIndex(_R(IDC_IMAGEMAP_APPROX), 0); break; case FF_CLOSELY: SetSelectedValueIndex(_R(IDC_IMAGEMAP_APPROX), 1); break; case FF_APPROXIMATELY: SetSelectedValueIndex(_R(IDC_IMAGEMAP_APPROX), 2); break; default: ERROR3("ImagemapDlg::SetOptions - invalid flattening factor"); case FF_NOTATALL: SetSelectedValueIndex(_R(IDC_IMAGEMAP_APPROX), 3); break; } //Now, let's set up the remaining controls with default values. These //controls do not remember their settings between exports //The "Map Name" combo box //First delete all the values that were previously in this box DeleteAllValues(_R(IDC_IMAGEMAP_MAPNAME)); //Have we been passed a list of names to put in the combo box? if (ms_plstNames) { //Yes. So go through them, one by one, putting them into the combo box StringListItem* psliThis=(StringListItem*) ms_plstNames->GetHead(); INT32 iListPos=0; while (psliThis!=NULL) { String_256 strToSet=psliThis->GetString(); SetStringGadgetValue(_R(IDC_IMAGEMAP_MAPNAME), &strToSet, FALSE, iListPos); iListPos++; psliThis=(StringListItem*) ms_plstNames->GetNext(psliThis); } //And select the first item SetSelectedValueIndex(_R(IDC_IMAGEMAP_MAPNAME),0); } else //No. So simply set a default name into the combo box SetStringGadgetValue(_R(IDC_IMAGEMAP_MAPNAME), &String_256(_R(IDS_IMAGEMAP_DEFAULTMAPNAME)), FALSE,-1); SetComboListLength(_R(IDC_IMAGEMAP_MAPNAME)); //Set the Area For Imagemap radio buttons according to whether there is a selection //or not //Is there a selection? SelRange* pSelRange=GetApplication()->FindSelection(); if (pSelRange && !pSelRange->IsEmpty()) { //Yes. So enable the selection radio button (in case it was disabled before) EnableGadget(_R(IDC_IMAGEMAP_AREA_SELECTION), TRUE); //And select it SetLongGadgetValue(_R(IDC_IMAGEMAP_AREA_SELECTION), TRUE); SetLongGadgetValue(_R(IDC_IMAGEMAP_AREA_DRAWING), FALSE); //And set the width and height fields to reflect the width //and height of the selection scaled by 96 DPI SetDPI(SELECTION, BMPFilter::GetDefaultExportDPI()); } else { //No. So disable the selection radio button EnableGadget(_R(IDC_IMAGEMAP_AREA_SELECTION), FALSE); //And select the drawing radio button SetLongGadgetValue(_R(IDC_IMAGEMAP_AREA_SELECTION), FALSE); SetLongGadgetValue(_R(IDC_IMAGEMAP_AREA_DRAWING), TRUE); //And set the width and height fields to reflect the width //and height of the drawing scaled by 96 DPI SetDPI(DRAWING, BMPFilter::GetDefaultExportDPI()); } }
void CNameBrushDlg::InitGadgetText(String_32* pString, BOOL resizeDialog /*= TRUE*/) { if (pString != NULL) m_strSuggest = *pString; SetStringGadgetValue(_R(IDC_EDITBRUSHNAME), *GetSuggestion(&m_strSuggest)); HighlightText(_R(IDC_EDITBRUSHNAME)); SetKeyboardFocus(_R(IDC_EDITBRUSHNAME)); // change the dialog title to "Enter brush name:" String_256 Name = TEXT("Enter brush name:"); SetTitlebarName(&Name); if (resizeDialog) { // what we want to do is shrink the dialog by the size of the label and then hide it RECT LabelRect; GetGadgetPosition(_R(IDC_STATICBRUSHGROUP), &LabelRect); // hide the label HideGadget(_R(IDC_STATICBRUSHGROUP), TRUE); // get the size of this dialog RECT DialogRect; GetWindowPosition(&DialogRect); // subtract the size of the label INT32 Subtract = LabelRect.bottom - LabelRect.top; DialogRect.bottom -= Subtract; // We want to move up the buttons RECT OkRect; if (GetGadgetPosition(_R(IDOK), &OkRect)) { OkRect.top -= Subtract; OkRect.bottom -= Subtract; INT32 Width = OkRect.right - OkRect.left; Width = (Width * 2) / 3; OkRect.left += Width ; OkRect.right += Width; SetGadgetPosition(_R(IDOK), OkRect); } RECT CancelRect; if (GetGadgetPosition(_R(IDCANCEL), &CancelRect)) { CancelRect.top -= Subtract; CancelRect.bottom -= Subtract; INT32 Width = CancelRect.right - CancelRect.left; Width = (Width * 2) / 3; CancelRect.left += Width; CancelRect.right += Width; SetGadgetPosition(_R(IDCANCEL), CancelRect); } // Reset the window SetWindowPosition(DialogRect); // Hide the help button HideGadget(_R(ID_CC_HELP_BUTTON), TRUE); } }