/******************************************************************************************** > BOOL TipsDlg::OnInitDialog() Author: Colin_Barfoot (Xara Group Ltd) <*****@*****.**> Created: 03/08/96 Returns: FALSE if initialisation failed Purpose: Initializes this TipsDlg ready for display ********************************************************************************************/ BOOL TipsDlg::OnInitDialog() { // If Tips file does not exist then disable NextTip if (!m_bTipOK) { EnableGadget(_R(IDC_NEXTTIP), FALSE); } // Check there's more help & disable the more button if there isn't HelpID helpID = GetTipHelpID(); if (helpID == 0) { EnableGadget(_R(IDC_MORE), FALSE); } else { EnableGadget(_R(IDC_MORE), TRUE); } // Tip should be some error message if not OK DrawTipString(); SetBoolGadgetSelected(_R(IDC_STARTUP), g_bStartUp); return TRUE; }
BOOL NativePrefsDlg::InitDialog () { ERROR2IF ( mpParams == NULL, FALSE, "NativePrefsDlg::InitDialog called after duff initialisation?!" ); //First, do we have a selection? Application *pApp = GetApplication(); ERROR2IF(pApp == NULL, FALSE,"NativePrefsDlg::InitDialog - no application!"); SelRange *pRange = pApp->FindSelection(); ERROR2IF(pRange == NULL, FALSE,"NativePrefsDlg::InitDialog - no selection range!"); DocRect ClipRect = pRange->GetBoundingRect(); BOOL fThereIsASelection=!ClipRect.IsEmpty(); //Now, is there a selection? if (fThereIsASelection) { // Yes. So ungrey both the buttons for selecting the nodes to export. EnableGadget(_R(IDC_NATIVEOPTS_SELECT), TRUE); EnableGadget(_R(IDC_NATIVEOPTS_DRAWING), TRUE); //Now, which of those buttons should be selected? switch ( mpParams->GetExportSel () ) { case SELECTION: // Choose the export pair of buttons. SetLongGadgetValue(_R(IDC_NATIVEOPTS_SELECT), FALSE); SetLongGadgetValue(_R(IDC_NATIVEOPTS_DRAWING), TRUE); break; default: case DRAWING: // Choose the export pair of buttons. SetLongGadgetValue(_R(IDC_NATIVEOPTS_SELECT), TRUE); SetLongGadgetValue(_R(IDC_NATIVEOPTS_DRAWING), FALSE); break; } } else { //No. So grey the SELECTION button and ungrey //the DRAWING button EnableGadget(_R(IDC_NATIVEOPTS_SELECT), FALSE); EnableGadget(_R(IDC_NATIVEOPTS_DRAWING), TRUE); // And we must select the DRAWING button for the export area controls. SetLongGadgetValue(_R(IDC_NATIVEOPTS_SELECT), TRUE); SetLongGadgetValue(_R(IDC_NATIVEOPTS_DRAWING), FALSE); } return TRUE; }
/******************************************************************************************** > void TipsDlg::OnNextTip() Author: Colin_Barfoot (Xara Group Ltd) <*****@*****.**> Created: 03/08/96 Purpose: Responds to a user's request for the Next Tip by displaying it. ********************************************************************************************/ void TipsDlg::OnNextTip() { GetNextTipString(); // Check there's more help & disable the more button if there isn't HelpID helpID = GetTipHelpID(); if (helpID == 0) { EnableGadget(_R(IDC_MORE), FALSE); } else { EnableGadget(_R(IDC_MORE), TRUE); } DrawTipString(); }
void ArrangeAlignment::UpdateState() { // update target CGadgetID Target = ReadRadioGroup(TargetArea,TargetArea[0]); if (Target == _R(IDC_ALIGNDIALOG_TOSELECTION)) { Align.target=ToSelection; } else if (Target == _R(IDC_ALIGNDIALOG_TOPAGE)) { Align.target=ToPage; } // WEBSTER-ranbirr-13/11/96 #ifndef WEBSTER else if (Target == _R(IDC_ALIGNDIALOG_TOSPREAD)) { Align.target=ToSpread; } #endif //webster else { ERROR3("ArrangeAlignment::UpdateState() - unknown target"); } // read alignments from horizontal and vertical combo boxes Align.h = (AlignType)GetSelectedValueIndex(_R(IDC_ALIGNDIALOG_HORIZONTAL)); Align.v = (AlignType)GetSelectedValueIndex(_R(IDC_ALIGNDIALOG_VERTICAL)); // force the diagram to redraw InvalidateGadget(_R(IDC_ALIGNDIALOG_DIAGRAM)); // set state of Apply button INT32 NumObjs = 0; if (Document::GetSelected()) NumObjs = GetApplication()->FindSelection()->Count(); BOOL ApplyButtonState = (NumObjs>0); if (NumObjs==1 && Target==_R(IDC_ALIGNDIALOG_TOSELECTION)) ApplyButtonState = FALSE; if (Align.h==AlignNone && Align.v==AlignNone) ApplyButtonState = FALSE; EnableGadget(_R(IDOK),ApplyButtonState); }
void WebAddressDlg::EnableRemove(BOOL fValue) { EnableGadget(_R(IDC_WEBADDRESS_REMOVE), fValue); }
void WebAddressDlg::EnableAdd(BOOL fValue) { EnableGadget(IDOK, fValue); }
void InfoBarOp::EnableLayerControl() { EnableGadget(_R(IDC_LAYER_COMBO), TRUE ); EnableGadget(_R(IDC_INVOKE_LYR_DLG), TRUE ); }
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()); } }
MsgResult CBaseBrushNameDlg::Message(Msg* pMessage) { // A message from the dialog or its gadgets? if (IS_OUR_DIALOG_MSG(pMessage)) { DialogMsg* pMsg = (DialogMsg*) pMessage; switch (pMsg->DlgMsg) { case DIM_CREATE: InitGadgetText(); break; case DIM_TEXT_CHANGED: // Disable the OK/Apply button if there's no document or entered text. EnableGadget(_R(IDOK), !GetStringGadgetValue(_R(IDC_EDITBRUSHNAME), 0).IsEmpty() && Document::GetSelected() != 0); break; case DIM_LFT_BN_CLICKED: // enter messages when the edit box has the focus get cast to this if (pMsg->GadgetID == _R(ID_CC_HELP_BUTTON)) break; case DIM_COMMIT: { // Check name for validity. String_256 strEnter = GetStringGadgetValue(_R(IDC_EDITBRUSHNAME), 0); UINT32 nErrID = IsValid(strEnter); if (nErrID != 0) { // Invalid, reinitialise. InformError(nErrID); if (nErrID == _R(IDS_BRUSHNAME_INVALID)) { String_32 s(strEnter); InitGadgetText(&s, FALSE); } else InitGadgetText(NULL); break; } else { // Entry is valid, try committing it. String_32 FinalString(strEnter); if (DoCommit(strEnter)) { // Don't close, reinitialise (dialog is modeless). InitGadgetText(); pMsg->DlgMsg = DIM_NONE; // stop base class closing it break; } else { // Close(); // End(); - base class will close break; } } } break; case DIM_CANCEL: HandleCancel(); // base class will close break; default: break; } } // Has the document been switched or closed? else if (MESSAGE_IS_A(pMessage, DocChangingMsg)) { DocChangingMsg* pMsg = (DocChangingMsg*) pMessage; if (pMsg->State == DocChangingMsg::SELCHANGED) EnableGadget(_R(IDOK), pMsg->pNewDoc != 0); } // Pass everything on to the base class . . . return DialogOp::Message(pMessage); }
void ToolbarDlg::TakeToolbarDetails() { EnableGadget(_R(IDC_DELETEBAR), CanDeleteSelection()); CMainFrame* pFrame = GetMainFrame(); BOOL check; BOOL VV; check = (BOOL)GetLongGadgetValue(_R(IDC_BIGTOP),0,1,_R(IDS_PHILS_EXAMPLE),&VV); pFrame->GetDockBar(DOCKBAR_TOP)->SetBigControlState(check); check = (BOOL)GetLongGadgetValue(_R(IDC_BIGLEFT),0,1,_R(IDS_PHILS_EXAMPLE),&VV); pFrame->GetDockBar(DOCKBAR_LEFT)->SetBigControlState(check); check = (BOOL)GetLongGadgetValue(_R(IDC_BIGRIGHT),0,1,_R(IDS_PHILS_EXAMPLE),&VV); pFrame->GetDockBar(DOCKBAR_RIGHT)->SetBigControlState(check); check = (BOOL)GetLongGadgetValue(_R(IDC_BIGBOTTOM),0,1,_R(IDS_PHILS_EXAMPLE),&VV); pFrame->GetDockBar(DOCKBAR_BOTTOM)->SetBigControlState(check); check = (BOOL)GetLongGadgetValue(_R(IDC_BIGFLOAT),0,1,_R(IDS_PHILS_EXAMPLE),&VV); pFrame->GetDockBar(DOCKBAR_FLOAT)->SetBigControlState(check); CCustomList* pListGadget = CCustomList::GetGadget(GetReadWriteWindowID(), _R(IDC_BARLIST)); if (pListGadget == NULL) return; // Adjust the visibility of the bars... INT32 listitem = 0; INT32 listcount = pListGadget->GetItemCount(); String_32 BarName; // variables control the dynamic relocation of the 'floating' toolbar .... // INT32 ToolbarIndex = -1; // BOOL BeenHidden = FALSE; // BOOL ToolbarCurrentState = FALSE; while (listitem < listcount) { // Find bar by name... pListGadget->GetItemString(BarName, listitem, 1); // If name is "Infobar" deal with it specially... if (BarName == InfoBarName) InformationBarOp::SetVisibility(pListGadget->GetSwitchState(listitem, 0)); else if (BarName == String_32 (TEXT ("Toolbar"))) { // do special stuff now .... DialogBarOp* pBar = DialogBarOp::FindDialogBarOp(BarName); ERROR3IF(pBar == NULL, "Cannot find named bar in TakeToolbarDetails"); // If bar is of correct type then adjust its visibility according to the // check mark... if (!pBar->IsKindOf(CC_RUNTIME_CLASS(SystemBarOp)) || !pBar->IsKindOf(CC_RUNTIME_CLASS(InformationBarOp)) ) { //ToolbarIndex = listitem; BOOL CurrentState = pBar->IsVisible (); //ToolbarCurrentState = CurrentState; pBar->SetVisibility(pListGadget->GetSwitchState(listitem, 0)); if (pListGadget->GetSwitchState(listitem, 0) != CurrentState) { if (pListGadget->GetSwitchState(listitem, 0)) { GetMainFrame ()->SetToolbarCreated (TRUE); GetMainFrame ()->RelocateToolbar (); } else { // so that we can lock out the toolbar 'onmove' and 'onsize' code // from being executed when there is no toolbar GetMainFrame ()->SetToolbarCreated (FALSE); } } // else // { // BeenHidden = TRUE; // } } } else { // Look for the named bar in the barops list... DialogBarOp* pBar = DialogBarOp::FindDialogBarOp(BarName); ERROR3IF(pBar == NULL, "Cannot find named bar in TakeToolbarDetails"); // If bar is of correct type then adjust its visibility according to the // check mark... if (!pBar->IsKindOf(CC_RUNTIME_CLASS(SystemBarOp)) || !pBar->IsKindOf(CC_RUNTIME_CLASS(InformationBarOp)) ) { pBar->SetVisibility(pListGadget->GetSwitchState(listitem, 0)); } } listitem++; } // dynamically reposition the toolbar when the above options are changed .... /* if ((ToolbarIndex != -1) && (!BeenHidden)) { if (pListGadget->GetSwitchState(ToolbarIndex, 0) != ToolbarCurrentState) if (pListGadget->GetSwitchState(ToolbarIndex, 0)) { GetMainFrame ()->SetToolbarCreated (TRUE); GetMainFrame ()->RelocateToolbar (); } }*/ }