void ImagemapDlg::OnHeightChanged() { //First we set up a flag to find if the value in the Height field //is a valid value BOOL fValid=TRUE; //Get the value of the height field and find out the value //is between 1 and our maximum pixel width INT32 lHeight = GetLongGadgetValue(_R(IDC_IMAGEMAP_HEIGHT), 1, PIXELWIDTH_MAX, NULL ,&fValid); //Set the width to zero by default INT32 lWidth=0; //If the height is valid... if (fValid) { //Then get the width by multiplying our height by the width height //ratio, rounding to the nearest integer lWidth=(INT32) ((lHeight*m_dWidthHeightRatio)+0.5); } //And set our width into the dialog ImagemapDlg::DontHandleNextMessage=TRUE; SetLongGadgetValue(_R(IDC_IMAGEMAP_WIDTH), lWidth); }
void ToolbarDlg::ShowToolbarSizes() { CMainFrame* pFrame = GetMainFrame(); ENSURE(pFrame,"Can't find Main Frame in ShowToolBarSizes"); // Only attempt to redisplay things if the toolbars dlg exists... if (WindowID) { // Fetch the states of all the docking bars... SetLongGadgetValue(_R(IDC_BIGTOP), (INT32) pFrame->GetDockBar(DOCKBAR_TOP)->IsBigControls()); SetLongGadgetValue(_R(IDC_BIGLEFT), (INT32) pFrame->GetDockBar(DOCKBAR_LEFT)->IsBigControls()); SetLongGadgetValue(_R(IDC_BIGRIGHT), (INT32) pFrame->GetDockBar(DOCKBAR_RIGHT)->IsBigControls()); SetLongGadgetValue(_R(IDC_BIGBOTTOM), (INT32) pFrame->GetDockBar(DOCKBAR_BOTTOM)->IsBigControls()); SetLongGadgetValue(_R(IDC_BIGFLOAT), (INT32) pFrame->GetDockBar(DOCKBAR_FLOAT)->IsBigControls()); } }
void ImagemapDlg::SetDPI(SelectionType stExportArea, double dDPI) { //First we need to get the bounding box of the area to export DocRect rectBounds=ImagemapFilterOptions::GetSizeOfExportArea(stExportArea); //And scale it by the DPI we have been given. The easiest //way to do this is to use this function Matrix Identity; WinRect Rect = OSRenderRegion::BitmapDocRectToWin( Identity, rectBounds, dDPI ); //Then set the result into the width and height fields ImagemapDlg::DontHandleNextMessage=TRUE; SetLongGadgetValue(_R(IDC_IMAGEMAP_WIDTH), Rect.Width()); ImagemapDlg::DontHandleNextMessage=TRUE; SetLongGadgetValue(_R(IDC_IMAGEMAP_HEIGHT), Rect.Height()); }
void ImagemapDlg::OnAreaDrawingClicked() { //Make sure the "Area for imagemap - Selection" button is off SetLongGadgetValue(_R(IDC_IMAGEMAP_AREA_SELECTION), FALSE); //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 ArrangeAlignment::SetRadioGroup(const CGadgetID* IDCList, const CGadgetID IDC) { INT32 i=0; while (IDCList[i]) { SetLongGadgetValue(IDCList[i],IDCList[i]==IDC); i++; } }
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 WebAddressDlg::ShowClickableArea(UINT32 uiArea) { SetLongGadgetValue(_R(IDC_WEBADDRESS_OBJECTSHAPE), (uiArea==0)); SetLongGadgetValue(_R(IDC_WEBADDRESS_RECTANGLE), (uiArea==1)); }
void WebAddressDlg::ShowCorrect(BOOL fValue) { //Set the switch SetLongGadgetValue(_R(IDC_WEBADDRESS_CORRECT), fValue); }
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 ToolbarDlg::Message(Msg* Message) { if (IS_OUR_DIALOG_MSG(Message)) { DialogMsg* Msg = (DialogMsg*)Message; BOOL EndDialog = FALSE; switch (Msg->DlgMsg) { case DIM_CANCEL: case DIM_COMMIT: // Cancel all changes the user wants to make to toolbars... EndDialog = TRUE; break; case DIM_SELECTION_CHANGED: case DIM_SELECTION_CHANGED_COMMIT: TakeToolbarDetails(); break; case DIM_LFT_BN_CLICKED: { // A control in the Toolbars... dialog has been clicked... CMainFrame* pFrame = GetMainFrame(); BOOL check; BOOL VV; switch (Msg->GadgetID) { case _R(IDC_BIGALL): // Select all the large buttons... SetLongGadgetValue(_R(IDC_BIGTOP),1); SetLongGadgetValue(_R(IDC_BIGLEFT),1); SetLongGadgetValue(_R(IDC_BIGRIGHT),1); SetLongGadgetValue(_R(IDC_BIGBOTTOM),1); SetLongGadgetValue(_R(IDC_BIGFLOAT),1); TakeToolbarDetails(); break; case _R(IDC_BIGNONE): // Deselect all the large buttons... SetLongGadgetValue(_R(IDC_BIGTOP),0); SetLongGadgetValue(_R(IDC_BIGLEFT),0); SetLongGadgetValue(_R(IDC_BIGRIGHT),0); SetLongGadgetValue(_R(IDC_BIGBOTTOM),0); SetLongGadgetValue(_R(IDC_BIGFLOAT),0); TakeToolbarDetails(); break; case _R(IDC_NEWBAR): NewToolbar(); break; case _R(IDC_BIGTOP): check = (BOOL)GetLongGadgetValue(_R(IDC_BIGTOP),0,1,_R(IDS_PHILS_EXAMPLE),&VV); pFrame->GetDockBar(DOCKBAR_TOP)->SetBigControlState(check); break; case _R(IDC_BIGLEFT): check = (BOOL)GetLongGadgetValue(_R(IDC_BIGLEFT),0,1,_R(IDS_PHILS_EXAMPLE),&VV); pFrame->GetDockBar(DOCKBAR_LEFT)->SetBigControlState(check); break; case _R(IDC_BIGRIGHT): check = (BOOL)GetLongGadgetValue(_R(IDC_BIGRIGHT),0,1,_R(IDS_PHILS_EXAMPLE),&VV); pFrame->GetDockBar(DOCKBAR_RIGHT)->SetBigControlState(check); break; case _R(IDC_BIGBOTTOM): check = (BOOL)GetLongGadgetValue(_R(IDC_BIGBOTTOM),0,1,_R(IDS_PHILS_EXAMPLE),&VV); pFrame->GetDockBar(DOCKBAR_BOTTOM)->SetBigControlState(check); break; case _R(IDC_BIGFLOAT): check = (BOOL)GetLongGadgetValue(_R(IDC_BIGFLOAT),0,1,_R(IDS_PHILS_EXAMPLE),&VV); pFrame->GetDockBar(DOCKBAR_FLOAT)->SetBigControlState(check); break; case _R(IDC_DELETEBAR): { String_32 BarName; GetSelectedBarName(&BarName); if (BarName != String_8(TEXT(""))) { // we can't delete the infoobar if(BarName == String_32(TEXT("Infobar"))) { InformWarning(_R(IDS_CANTDELETEINFOBAR),_R(IDS_OK)); break; } INT32 ButtonPressed = 1; ButtonPressed = InformWarning(_R(IDS_WARNDELETEBAR), _R(IDS_OK),_R(IDS_CANCEL)); Error::ClearError(); if (ButtonPressed == 1) DeleteSelectedBar(); } break; } case _R(IDC_RESETBARS): { INT32 ButtonPressed = 1; ButtonPressed = InformWarning(_R(IDS_WARNRESETBARS), _R(IDS_OK),_R(IDS_CANCEL)); Error::ClearError(); if(ButtonPressed == 1) { Progress::Start(FALSE); // lock the window to avoid untidy layout recalcs ::LockWindowUpdate(GetMainFrame()->GetSafeHwnd()); // tell the mainframe we are changing modes - this prevents // some unnecessary work GetMainFrame()->SetChangingMode(TRUE); // kill all bars ( except infobar at the mo..) BROADCAST_TO_CLASS(DialogMsg(NULL, DIM_BAR_DEATH, NULL ),DialogBarOp); // hide the info bar InformationBarOp::SetVisibility(FALSE,TRUE); DialogBarOp::WipeBarFiles(); DialogBarOp::LoadDefaultBars(); // force the info bar to the correct visible state InformationBarOp::SetVisibility(InformationBarOp::IsVisible(),TRUE); // All clear to Mainframe GetMainFrame()->SetChangingMode(FALSE); // Make sure everything is positioned correctly GetMainFrame()->RecalcLayout(); // Now handle the toolbar .... GetMainFrame ()->SetToolbarCreated (TRUE); GetMainFrame ()->RelocateToolbar (); // and unlock and show the window ::LockWindowUpdate(NULL); ShowToolbarList(); ShowToolbarSizes(); Progress::Stop(); } break; } } break; } } if (EndDialog) // Dialog communication over { Close(); // Close the dialog End(); // Destroy dialog return(OK); // After destroying this object, it's very dangerous to call base class! } } else if ( MESSAGE_IS_A(Message,BarMsg) ) { switch ( ((BarMsg*)Message)->Reason ) { case BAR_CHANGESTATE: // A bar simply became horizontal, vertical or floating and we don't care // about that so do nothing. break; default: // In most cases of BarMsg we want to show the user what happened... ShowToolbarList(); // Show changes in bars to user // Note: it would be more optimal to use the pointer // to the bar that comes with this message to just // alter that item in the list. break; } } return DialogOp::Message(Message); }