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(); }