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