#include <sgcolour.h>
Inheritance diagram for ColourNameDlg:
Public Member Functions | |
ColourNameDlg () | |
ColourNameDlg constructor. | |
void | DoWithParam (OpDescriptor *, OpParam *) |
Creates then opens the dialog. | |
BOOL | Create () |
ColourNameDlg create method. | |
virtual MsgResult | Message (Msg *Message) |
Handles all the scale dialog's messages. | |
Static Public Member Functions | |
static BOOL | InvokeDialog (ColourList *Parentlist, IndexedColour *ColourToName) |
Opens the gallery name dialogue on screen, elicits a response, and returns having set the new name. This is a MODAL dlg. | |
static BOOL | InvokeDialog (String_64 *NameToFill, IndexedColour *DisplayColour=NULL) |
Opens the gallery name dialogue on screen, elicits a response, and returns having set the new name. This is a MODAL Dlg. | |
static OpState | GetState (String_256 *, OpDescriptor *) |
ColourNameDlg GetState method. | |
static BOOL | Init () |
ColourNameDlg Init method. Called by sginit.cpp. | |
Static Public Attributes | |
static const INT32 | IDD = _R(IDD_COLOURNAMEDLG) |
static const CDlgMode | Mode = MODAL |
Protected Member Functions | |
void | CommitName (void) |
Commits to the current setting for the new name Reads the name into the supplied destination, sets the return value to TRUE and closes and ends the Dlg Op. | |
Protected Attributes | |
ColourNameParam * | Info |
Definition at line 682 of file sgcolour.h.
|
ColourNameDlg constructor.
Definition at line 4911 of file sgcolour.cpp. 04911 : DialogOp(ColourNameDlg::IDD, ColourNameDlg::Mode) 04912 { 04913 }
|
|
Commits to the current setting for the new name Reads the name into the supplied destination, sets the return value to TRUE and closes and ends the Dlg Op.
Definition at line 5029 of file sgcolour.cpp. 05030 { 05031 Info->Result = TRUE; 05032 05033 String_256 NewName = GetStringGadgetValue(_R(IDC_COLNAME_TEXT)); 05034 05035 if (NewName.Length() < 1) // User gave NULL name. Use 'Unnamed' instead. 05036 NewName.MakeMsg(_R(IDS_UNNAMEDCOLOUR)); 05037 05038 if (Info->TheList != NULL && Info->TheColour != NULL) 05039 { 05040 // We must set the new name for the colour - first make sure it's unique 05041 String_64 UniqueName; 05042 Info->TheList->GenerateUniqueColourName((const StringBase *) &NewName, &UniqueName); 05043 05044 IndexedColour *NewCol = new IndexedColour(*Info->TheColour); 05045 if (NewCol == NULL) 05046 InformError(); 05047 else 05048 { 05049 NewCol->SetName(UniqueName); 05050 ColourManager::ChangeColour(Info->TheList, NewCol, Info->TheColour, TRUE); 05051 } 05052 } 05053 else if (Info->TheName != NULL) 05054 { 05055 // We just copy the string into the result string, truncating at 63 chars 05056 NewName.Left(Info->TheName, 63); 05057 } 05058 05059 Close(); 05060 End(); 05061 }
|
|
ColourNameDlg create method.
Reimplemented from DialogOp. Definition at line 5121 of file sgcolour.cpp. 05122 { 05123 return(DialogOp::Create()); 05124 }
|
|
Creates then opens the dialog.
Reimplemented from Operation. Definition at line 5141 of file sgcolour.cpp. 05142 { 05143 ERROR3IF(pOpParam == NULL, "Come on, play by the rules"); 05144 05145 Info = (ColourNameParam *) pOpParam; 05146 05147 if (Info->TheColour == NULL && Info->TheName == NULL) 05148 { 05149 ERROR3("ColourNameDlg parameters are unhelpful to say the least"); 05150 End(); 05151 } 05152 05153 if (!Create()) 05154 { 05155 InformError(); 05156 End(); 05157 } 05158 }
|
|
ColourNameDlg GetState method.
Definition at line 5075 of file sgcolour.cpp. 05076 { 05077 OpState OpSt; 05078 return(OpSt); 05079 }
|
|
ColourNameDlg Init method. Called by sginit.cpp.
Reimplemented from SimpleCCObject. Definition at line 5094 of file sgcolour.cpp. 05095 { 05096 return (RegisterOpDescriptor( 05097 0, 05098 _R(IDS_COLOURNAMEDLG), 05099 CC_RUNTIME_CLASS(ColourNameDlg), 05100 OPTOKEN_COLOURNAMEDLG, 05101 ColourNameDlg::GetState, 05102 0, // help ID 05103 0 // bubble ID 05104 ) 05105 ); 05106 }
|
|
Opens the gallery name dialogue on screen, elicits a response, and returns having set the new name. This is a MODAL Dlg.
This variant gets the name of a new colour. The window indicates that a new colour is being created, and has 'Create' and 'Cancel' buttons. Only if it returns TRUE should you create the colour. Note that this variant is not 'set and forget'. You have to do something with the returned name. Notes: DO NOT use this method with the result of a call to the IndexedColour::GetName() function! See the other variant to do this. If you SetName() a colour already in a colour list, (in which case you should be using the other variant of this method) then you MUST ensure that the name you set is guaranteed to be unique within the list (or export/import will fail). Definition at line 5242 of file sgcolour.cpp. 05243 { 05244 ERROR3IF(NameToFill == NULL, "Come on, play by the rules"); 05245 05246 ColourNameParam Info(NameToFill, DisplayColour); 05247 OpDescriptor *NameDlg = OpDescriptor::FindOpDescriptor(CC_RUNTIME_CLASS(ColourNameDlg)); 05248 05249 ERROR3IF(NameDlg == NULL, 05250 "ColourNameDlg::InvokeDialog is unable to find the Dlg OpDescriptor"); 05251 05252 if (NameDlg != NULL) 05253 NameDlg->Invoke(&Info); 05254 05255 return(Info.Result); 05256 }
|
|
Opens the gallery name dialogue on screen, elicits a response, and returns having set the new name. This is a MODAL dlg. vAuthor: Jason
If the name is changed, the colour name will be set (to a name guaranteed to be unique within the colour list), and an appropriate ColourChangingMsg willbe broadcast (i.e. it's a set-and-forget mode) Definition at line 5188 of file sgcolour.cpp. 05189 { 05190 ERROR3IF(ParentList == NULL || ColourToName == NULL, "Come on, play by the rules"); 05191 05192 ColourNameParam Info(ParentList, ColourToName); 05193 OpDescriptor *NameDlg = OpDescriptor::FindOpDescriptor(CC_RUNTIME_CLASS(ColourNameDlg)); 05194 05195 ERROR3IF(NameDlg == NULL, 05196 "ColourNameDlg::InvokeDialog is unable to find the Dlg OpDescriptor"); 05197 05198 if (NameDlg != NULL) 05199 NameDlg->Invoke(&Info); 05200 05201 return(Info.Result); 05202 }
|
|
Handles all the scale dialog's messages.
Reimplemented from DialogOp. Definition at line 4932 of file sgcolour.cpp. 04933 { 04934 if (IS_OUR_DIALOG_MSG(Message)) 04935 { 04936 DialogMsg* Msg = (DialogMsg*)Message; 04937 // BOOL EndDialog = FALSE; 04938 04939 switch (Msg->DlgMsg) 04940 { 04941 case DIM_CREATE: 04942 { 04943 String_256 Name; 04944 04945 if (Info->TheName != NULL) // Must be creating new colour 04946 { 04947 Name.MakeMsg(_R(IDS_COLNAME_CREATE)); 04948 SetStringGadgetValue(_R(IDOK), _R(IDS_COLNAME_YCREATE)); 04949 SetStringGadgetValue(_R(IDC_COLNAME_TEXT), *Info->TheName); 04950 } 04951 else if (Info->TheColour != NULL) // Are renaming existing colour 04952 { 04953 Name.MakeMsg(_R(IDS_COLNAME_ALTER)); 04954 SetStringGadgetValue(_R(IDOK), _R(IDS_COLNAME_YALTER)); 04955 SetStringGadgetValue(_R(IDC_COLNAME_TEXT), *Info->TheColour->GetName()); 04956 } 04957 04958 SetTitlebarName(&Name); 04959 SetKeyboardFocus (_R(IDC_COLNAME_TEXT)); 04960 HighlightText (_R(IDC_COLNAME_TEXT)); 04961 } 04962 break; 04963 04964 case DIM_COMMIT: 04965 case DIM_SOFT_COMMIT: 04966 CommitName(); 04967 break; 04968 04969 case DIM_CANCEL: 04970 Close(); 04971 End(); 04972 break; 04973 04974 case DIM_REDRAW: 04975 if (Msg->GadgetID == _R(IDC_COLNAME_PATCH)) 04976 { 04977 ReDrawInfoType *RedrawInfo = (ReDrawInfoType*) Msg->DlgMsgParam; 04978 DocRect VirtualSize(0, 0, RedrawInfo->dx, RedrawInfo->dy); 04979 RenderRegion *pRender = CreateOSRenderRegion(&VirtualSize, RedrawInfo); 04980 if (pRender) 04981 { 04982 pRender->SaveContext(); 04983 04984 DocColour PatchCol(128L, 128L, 128L); 04985 if (Info->TheColour != NULL) 04986 PatchCol.MakeRefToIndexedColour(Info->TheColour); 04987 04988 pRender->SetLineWidth(0); 04989 pRender->SetLineColour(PatchCol); 04990 pRender->SetFillColour(PatchCol); 04991 pRender->DrawRect(&VirtualSize); 04992 04993 pRender->RestoreContext(); 04994 04995 DestroyOSRenderRegion(pRender); 04996 } 04997 } 04998 break; 04999 05000 default: 05001 break; 05002 } 05003 05004 return (DLG_EAT_IF_HUNGRY(Msg)); 05005 } 05006 05007 return OK; 05008 }
|
|
Definition at line 697 of file sgcolour.h. |
|
Definition at line 709 of file sgcolour.h. |
|
Definition at line 698 of file sgcolour.h. |