void ToolbarDlg::DeleteSelectedBar() { // we can't delete the control bank !! if (!CanDeleteSelection()) return; String_32 BarName; GetSelectedBarName(&BarName); // If nothing is selected, we can't do anything if (BarName == String_8(TEXT(""))) return; // we can't delete the infoobar if (BarName == String_32(TEXT("Infobar"))) return; DialogBarOp* pBar = DialogBarOp::FindDialogBarOp(BarName); ENSURE(pBar,"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->Delete(); pBar->End(); ShowToolbarList(); } }
BOOL ToolbarDlg::CanDeleteSelection() { String_32 BarName; GetSelectedBarName(&BarName); if (BarName == String_8(TEXT(""))) // No selection to delete return(FALSE); if (BarName == InfoBarName) // Don't delete InfoBar return(FALSE); if (BarName == ControlBankName) // Don't delete button palette return(FALSE); return(TRUE); }
BOOL GalleryLineDragInfo::GetStatusLineText(String_256 * TheText, DragTarget* pDragTarget) { ERROR2IF(TheText==NULL,FALSE,"NULL string in GetStatusLineText()"); if (TheBitmap == NULL || TheBitmap->ActualBitmap == NULL) return FALSE; String_256 DragString(_R(IDS_SGLDRAG_DRAG_LINE_ATTR)); // "Dragging line attribute" DragString += String_8(_R(IDS_SGDFONTS_STAT_COLON_SEP)); //" : "; if (pDragTarget && pDragTarget->IS_KIND_OF(ViewDragTarget)) { PageDropInfo PageDropInfo; ((ViewDragTarget*)pDragTarget)->GetDropInfo(&PageDropInfo); NodeRenderableInk* pObjectHit = PageDropInfo.pObjectHit; ObjectDragTarget TargetHit = PageDropInfo.TargetHit; String_256 ObjectDesc = _R(IDS_SGLDRAG_THIS_OBJECT); // " this object"; if (pObjectHit) { ObjectDesc = pObjectHit->Describe(FALSE); } ClickModifiers ClickMods = ClickModifiers::GetClickModifiers(); BOOL IsInside = ClickMods.Constrain; if (!IsInside && pObjectHit && pObjectHit->IsCompound()) { TargetHit = MANY_TARGET; } switch (TargetHit) { case FILL_TARGET: case LINE_TARGET: case STARTCOL_TARGET: case ENDCOL_TARGET: DragString += String_64(_R(IDS_SGLDRAG_DROP_TO_APPLY)); // "Drop to apply this attribute to this "; DragString += ObjectDesc; if (IsInside) DragString += String_64(_R(IDS_SGLDRAG_SPACE_ALONE)); // " alone"; break; case MANY_TARGET: DragString += String_64(_R(IDS_SGLDRAG_DROP_TO_APPLY)); // "Drop to apply this attribute to this "; DragString += ObjectDesc; DragString += String_64(_R(IDS_SGLDRAG_CONTROL_DROP_INSIDE)); // "; Press 'Control' to drop 'Inside'"; break; case NO_TARGET: DragString += String_64(_R(IDS_SGLDRAG_DROP_CURRENT_ATTRIBUTE)); // "Drop to set the Current Attribute"; break; default: break; }; *TheText = DragString; return TRUE; } return FALSE; }
BOOL PrintPSRenderRegion::WritePlateScreen(KernelDC *pDC) { PrintControl *pPrintCtl=NULL; View *pView = GetRenderView(); if (pView) pPrintCtl = pView->GetPrintControl(); if (!pPrintCtl) return TRUE; // Get a pointer to the typeset info structure TypesetInfo *pInfo = pPrintCtl->GetTypesetInfo(); double ang,freq; String_256 ScreenName; ScreenType scrtype; // If separating then interogate the current plate if (pInfo->AreSeparating()) { ColourPlate* pSeparation; GetOutputColourPlate(COLOURMODEL_CMYK, NULL, &pSeparation); // do nothing if we are not separating if (pSeparation==NULL) return TRUE; // Make sure screening is on in this plate if (!pSeparation->ActiveScreening()) return TRUE; // Get the screen type if enabled. scrtype = pSeparation->GetScreenFunction(); if (scrtype==SCRTYPE_NONE) return TRUE; // ok we can get the angle and frequency ang = pSeparation->GetScreenAngle(); freq = pSeparation->GetScreenFrequency(); } else { // Is screening off? if (!pInfo->AreScreening()) return TRUE; scrtype = pInfo->GetScreenFunction(); if (scrtype==SCRTYPE_NONE) return TRUE; ang = 45.0; freq = pInfo->GetDefaultScreenFrequency(); } // read the name of this screen pInfo->GetScreenName(scrtype, &ScreenName); String_256 fred; fred += String_8(_T("{")); fred += ScreenName; fred += String_8(_T("}")); // ok output 'freq ang screenfunc setscreen' BOOL ok = pDC->OutputFloat(freq, 4); ok = ok && pDC->OutputFloat(ang, 4); ok = ok && pDC->OutputToken(fred); ok = ok && pDC->OutputToken(_T("setscreen")); ok = ok && pDC->OutputNewLine(); return ok; }
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); }