BOOL BitmapPreviewData::ComposeHTMLColour(DocColour *pColour, String_32 &OutColour) { if (pColour == NULL) return FALSE; // get the RGB values from the colour INT32 R, G, B; pColour->GetRGBValue(&R, &G, &B); // convert this into a html colour string OutColour = String_32( _T("#") ); String_32 c; // add the red component if (R < 16) // is a leading 0 required OutColour += _T("0"); c._MakeMsg( _T("#1%X"), R % 256); OutColour += c; // the green component if (G < 16) OutColour += _T("0"); c._MakeMsg( _T("#1%X"), G % 256); OutColour += c; // the blue component if (B < 16) OutColour += _T("0"); c._MakeMsg( _T("#1%X"), B % 256); OutColour += c; return TRUE; }
/******************************************************************************************** > 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); }
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 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; }
BOOL ATMFontMan::CacheCompatibleFont(String_64* pFontName) { // search for an underscore in the font INT32 pos = pFontName->Sub(String_32("_"),0,0); if (pos==-1) return FALSE; // pos is position of first _ character, is there a digit next? TCHAR digit = (*pFontName)[pos+1]; if (!StringBase::IsNumeric(digit)) return FALSE; String_64 MultiMaster; pFontName->Left(&MultiMaster, pos); // now we need to know whether this font exists. return FALSE; }
void BitmapPreviewData::GenerateBitmapInfoStrings(String_64 &ImageSize, String_64 &FileSize, BOOL bIncludeBpp) { // sanity check ERROR3IF(m_pBitmap == NULL, "BitmapPreviewData::GenerateBitmapInfoStrings no bitmap to work with"); ERROR3IF(m_pOptions == NULL, "BitmapPreviewData::GenerateBitmapInfoStrings no export options"); if ((m_pBitmap == NULL) || (m_pOptions == NULL)) return; // Get a pointer to the actual bitmap so that we can get some details from it. OILBitmap *pOilBitmap = m_pBitmap->ActualBitmap; ERROR3IF(pOilBitmap == NULL,"BitmapPreviewData::GenerateBitmapInfoStrings NULL oil bitmap pointer"); // Get the details from the specified bitmap BitmapInfo BmInfo; pOilBitmap->GetInfo(&BmInfo); // make the image size string // the width and the height ImageSize.MakeMsg(_R(IDS_IMAGE_SIZE), BmInfo.PixelWidth, BmInfo.PixelHeight); // the image depth if (bIncludeBpp) { UINT32 Depth = m_pOptions->GetDepth(); if (Depth == 1) { // monochrome image ImageSize += String_32(_R(IDS_IMAGE_DEPTH1)); } else { String_16 s; s.MakeMsg(_R(IDS_IMAGE_DEPTH2), Depth); ImageSize += s; } } // make the file size message FileSize.MakeMsg(_R(IDS_FILE_SIZE), m_FileSize); }
void ClickModifiers::GetButtonFuncName(ButtonFunction bf, String_32* pString) { *pString = String_32( ButtFuncNames[bf] ); }
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 (); } }*/ }
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); }