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 EllipseTool::Init() Author: Peter_Arnold (Xara Group Ltd) <*****@*****.**> Created: 18/03/95 Inputs: - Outputs: - Returns: TRUE/FALSE for success/failure Purpose: Called to initialise the ellipse tool. Errors: - SeeAlso: QuickShapeBase::Init ********************************************************************************************/ BOOL EllipseTool::Init() { BOOL ok = TRUE; pQuickShapeBaseInfoBarOp = new QuickShapeBaseInfoBarOp(this, _R(IDD_ELLIPSETOOLBAR)); return pQuickShapeBaseInfoBarOp != NULL; PORTNOTE("dialog", "Removed Bar reading") #if 0 CCResTextFile file; // Resource File QuickShapeBaseInfoBarOpCreate BarCreate; // Object that creates QuickShapeBaseInfoBarOp objects ok = file.open(_R(IDM_ELLIPSE_BAR), _R(IDT_INFO_BAR_RES)); // Open resource if (ok) ok = DialogBarOp::ReadBarsFromFile(file,BarCreate); // Read and create info bar if (ok) file.close(); // Close resource ERROR2IF(!ok,FALSE,"Unable to load EllipseTool.ini from resource"); // Info bar now exists. Now get a pointer to it String_32 str = String_32(_R(IDS_ELIPTOOL_INFOBARNAME)); DialogBarOp* pDialogBarOp = DialogBarOp::FindDialogBarOp(str); ERROR2IF(pDialogBarOp==NULL, FALSE, "Ellipse infobar not found\n"); ok = pDialogBarOp->IsKindOf(CC_RUNTIME_CLASS(QuickShapeBaseInfoBarOp)); if (ok) { pQuickShapeBaseInfoBarOp = (QuickShapeBaseInfoBarOp*)pDialogBarOp; pQuickShapeBaseInfoBarOp->pQuickShapeBase = this; } #endif ERROR2IF(!ok,FALSE,"Error finding the Ellipse tool info bar"); return (ok); }
OpState OpDisplayTEMPLATEGallery::GetState(String_256* UIDescription, OpDescriptor*) { OpState OpSt; // If the gallery is currenty open, then the menu item should be ticked DialogBarOp* pDialogBarOp = FindGallery(); if (pDialogBarOp != NULL) OpSt.Ticked = pDialogBarOp->IsVisible(); // If there are no open documents, you can't toggle the gallery OpSt.Greyed = (Document::GetSelected() == NULL); return(OpSt); }
void OpDisplayTEMPLATEGallery::Do(OpDescriptor*) { DialogBarOp *pDialogBarOp = FindGallery(); if (pDialogBarOp != NULL) { // Toggle the visible state of the gallery window pDialogBarOp->SetVisibility( !pDialogBarOp->IsVisible() ); // And update the gallery button state SGInit::UpdateGalleryButton(OPTOKEN_DISPLAYTEMPLATEGALLERY, pDialogBarOp->IsVisible()); } End(); }
BOOL PushTool::Init() { /* // Claim right-alt for our tool. ToolKeyClaimDetails Mods; Mods.Value = 0; Mods.Keys.Alternative2 = TRUE; ClaimToolKey((Tool*) this, Mods); */ // Initially, no cursor. pcPushCursor = 0; // RALPH don't need no sissy infobar #if defined(EXCLUDE_FROM_RALPH) return OpPush::Declare(); #else pPushInfoBarOp = new ZoomInfoBarOp(_R(IDD_PUSHINFO)); // Push tool uses a zoom info bar BOOL ok=(pPushInfoBarOp!=NULL); #if 0 // Load in the info-bar stuff. CCResTextFile file; // Resource File ZoomInfoBarOpCreate BarCreate; // Object that creates PushInfoBarOp objects BOOL ok = file.open(_R(IDM_PUSH_BAR), _R(IDT_INFO_BAR_RES)); // Open resource if (ok) ok = DialogBarOp::ReadBarsFromFile(file, BarCreate); // Read & create bar if (ok) file.close(); // Close resource ENSURE(ok,"Unable to load PUSHBAR.INI from resource\n"); if (ok) { // Info bar now exists. Now get a pointer to it. String_32 str(_R(IDS_PUSHTOOL_INFOBARNAME)); DialogBarOp* pDialogBarOp = DialogBarOp::FindDialogBarOp(str); ok = (pDialogBarOp != NULL); if (ok) ok = pDialogBarOp->IsKindOf(CC_RUNTIME_CLASS(ZoomInfoBarOp)); if (ok) pPushInfoBarOp = (ZoomInfoBarOp*) pDialogBarOp; ENSURE(ok,"Couldn't find push tool info bar"); } #endif // Register our push operation. return ok && OpPush::Declare(); #endif }
BOOL LiveEffectsTool::Init() { // This should be set to NULL by default. It will be set properly below, if // everthing is working as it should m_pInfoBarOp = NULL; // Now we have to declare all our operations and if that works, try to find // the liveeffects tools info bar and create it if (OpLiveEffect::Init()) { // Resource File and Object that creates FreeHandInfoBarOp objects CCResTextFile ResFile; LiveEffectsInfoBarOpCreate BarCreate; if (ResFile.open(_R(IDM_LIVEEFFECTS_BAR), _R(IDT_INFO_BAR_RES))) { // Found the file and opened it if (DialogBarOp::ReadBarsFromFile(ResFile,BarCreate)) { // read it in ok, so close it ResFile.close(); // Info bar now exists. Now get a pointer to it String_32 str = String_32(_R(IDS_LIVEEFFECTS_INFOBARNAME)); DialogBarOp* pDialogBarOp = DialogBarOp::FindDialogBarOp(str); // Should have a dialog bar op by now if (pDialogBarOp != NULL) { // Make sure it is what we were expecting and set it if (pDialogBarOp->IsKindOf(CC_RUNTIME_CLASS(LiveEffectsInfoBarOp))) { m_pInfoBarOp = (LiveEffectsInfoBarOp*) pDialogBarOp; m_pInfoBarOp->m_pTool = this; } } } } } // See if it all worked and return depending on the result ENSURE(m_pInfoBarOp!=NULL, "Failed to create LiveEffects Info Bar" ); if (m_pInfoBarOp==NULL) return FALSE; else return TRUE; }
DialogBarOp *OpDisplayTEMPLATEGallery::FindGallery(void) { String_32 Name = _R(IDS_SGBASE_TEMPLATE_GALLERY); //"TEMPLATE gallery"; DialogBarOp* pDialogBarOp = DialogBarOp::FindDialogBarOp(Name); if (pDialogBarOp != NULL) { if (pDialogBarOp->GetRuntimeClass() == CC_RUNTIME_CLASS(TEMPLATESGallery)) return(pDialogBarOp); ERROR3("Got the TEMPLATE gallery but it's not of the TEMPLATESGallery class"); } else { ERROR3("Can't find the TEMPLATE gallery in bars.ini!\n"); } return(NULL); }
OpState OpDisplayColourGallery::GetState(String_256* UIDescription, OpDescriptor*) { OpState OpSt; // If the gallery is currenty open, then the menu item should be ticked String_32 Name(_R(IDS_K_COLGAL_GALLNAME)); DialogBarOp* pDialogBarOp = DialogBarOp::FindDialogBarOp(Name); if (pDialogBarOp != NULL) { if (pDialogBarOp->GetRuntimeClass() == CC_RUNTIME_CLASS(ColourSGallery)) OpSt.Ticked = pDialogBarOp->IsVisible(); } // If there are no open documents, you can't toggle the gallery OpSt.Greyed = (Document::GetSelected() == NULL); return(OpSt); }
void OpDisplayColourGallery::Do(OpDescriptor*) { String_32 Name(_R(IDS_K_COLGAL_GALLNAME)); DialogBarOp* pDialogBarOp = DialogBarOp::FindDialogBarOp(Name); if (pDialogBarOp != NULL) { if (pDialogBarOp->GetRuntimeClass() == CC_RUNTIME_CLASS(ColourSGallery)) { // Toggle the visibility of the gallery window pDialogBarOp->SetVisibility( !pDialogBarOp->IsVisible() ); } #if _DEBUG else ERROR3("The Colour Gallery isn't a ColourSGallery! Woss goin' on?"); #endif SGInit::UpdateGalleryButton(OPTOKEN_DISPLAYCOLOURGALLERY, pDialogBarOp->IsVisible()); } ERROR3IF(pDialogBarOp == NULL,"Couldn't find the colour gallery bar"); End(); }
MsgResult ToolnameDlg::Message(Msg* Message) { if (IS_OUR_DIALOG_MSG(Message)) { DialogMsg* Msg = (DialogMsg*)Message; BOOL EndDialog = FALSE; switch (Msg->DlgMsg) { case DIM_CREATE: SetKeyboardFocus (_R(IDC_EDITNEWBARNAME)) ; HighlightText (_R(IDC_EDITNEWBARNAME)) ; break ; case DIM_COMMIT: { // Accept all changes that the user wants to make to toolbars... BOOL VV; String_32 NewBarName = GetStringGadgetValue(_R(IDC_EDITNEWBARNAME),&VV); if(NewBarName.Length()==0) { UINT32 Number = DialogBarOp::FindUniqueBarNumber(); NewBarName._MakeMsg(TEXT("Bar #1%ld"),Number); } DialogBarOp* pNewBar = new DialogBarOp(NewBarName); if (pNewBar) { pNewBar->SetDockBarType(DOCKBAR_FLOAT); pNewBar->Create(); // The Create function sends a message which we intercept to update // the list of bars in the Toolbars... dialog. // this is very dangerous in fact it blows up.. // so I have removed it .. chris. /* if (pNewBar) { // Find toolbar dialog and close it... ToolbarDlg* pToolbarDlg = ToolbarDlg::GetToolbarDlg(); if (pToolbarDlg) { pToolbarDlg->Close(); pToolbarDlg->End(); } } */ ToolbarDlg* pToolbarDlg = ToolbarDlg::GetToolbarDlg(); pToolbarDlg->ShowToolbarList(); } EndDialog = TRUE; } break; case DIM_CANCEL: // Cancel all changes the user wants to make to toolbars... EndDialog = TRUE; break; // default: } if (EndDialog) // Dialog communication over { Close(); // Close the dialog End(); // Destroy dialog } // return (DLG_EAT_IF_HUNGRY(Msg)); } // return OK; // Pass everything on to the base-class . . . return DialogOp::Message(Message); }
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 (); } }*/ }
void ToolbarDlg::ShowToolbarList() { if (!WindowID) return; // set the custom list gadget CCustomList* pListGadget = CCustomList::GetGadget(GetReadWriteWindowID(), _R(IDC_BARLIST)); if(!pListGadget) { ERROR2RAW("No list gadget"); return; } pListGadget->SetColumnWidth(0,GetSystemMetrics(SM_CXMENUCHECK) + 10); CMainFrame* pFrame = GetMainFrame(); ERROR3IF(pFrame == NULL, "Can't find Main Frame in ShowToolBarList"); if(pFrame->IsChangingViewMode()) return ; // Fetch the names and states of all defined bars... List* pBarList = MessageHandler::GetClassList(CC_RUNTIME_CLASS(DialogBarOp)); ENSURE(pBarList,"Can't find list of DialogBarOps in ShowToolBarList"); // Delete any existing list items... pListGadget->DeleteAllItems(); // Add names of all bars to the list... // First do the infobar... pListGadget->AddItem(InfoBarName); pListGadget->SetSwitchState(InformationBarOp::IsVisible(), (pListGadget->GetItemCount() - 1), 0); // Scan the list of all barops and add the names of those which should be shown // to the user to the scrollable list. DialogBarOp* pBar = (DialogBarOp*)pBarList->GetHead(); BOOL FoundControlBank = FALSE; BOOL ControlBankVisible = FALSE; while (pBar) { // Show any bar that's NOT a system bar and NOT an information bar // and NOT a Super Gallery put the Controlbank at the end if ( IS_A(pBar,DialogBarOp) ) { // Put its name in the list String_32 BarName = pBar->GetName(); if (BarName != ControlBankName) { pListGadget->AddItem(BarName); pListGadget->SetSwitchState(pBar->IsVisible(), (pListGadget->GetItemCount() - 1), 0); } else { FoundControlBank = TRUE; ControlBankVisible = pBar->IsVisible(); } } pBar = (DialogBarOp*)pBarList->GetNext(pBar); } if (FoundControlBank) { pListGadget->AddItem(ControlBankName); pListGadget->SetSwitchState(ControlBankVisible, (pListGadget->GetItemCount() - 1), 0); } }