#include <sglinepr.h>
Inheritance diagram for SGalleryLinePropertiesDlg:
Public Member Functions | |
SGalleryLinePropertiesDlg () | |
Constructor. | |
~SGalleryLinePropertiesDlg () | |
destructor | |
MsgResult | Message (Msg *Message) |
Standard DialogOp message handler which handles redraw and commit stuff. | |
void | Do (OpDescriptor *) |
'Does' a line properties dialogue op. DO NOT call this method - it must be invoked via DoWithParam | |
void | DoWithParam (OpDescriptor *, OpParam *Param) |
'Does' a line properties dialogue op. Shows the dialogue. | |
BOOL | Create () |
Creates a Line Properties dialogue box. | |
void | SetNameEditField (String_256 *pString) |
Can be called by sgline to set the name text from the dialog. | |
void | GetNameEditField (String_256 *pString) |
Can be called by sgline to get the name text from the dialog. | |
void | SetRepeatingBool (BOOL Repeating) |
Can be called by sgline to set the repeating button state from the dialog. | |
BOOL | GetRepeatingBool () |
Can be called by sgline to get the repeating button state from the dialog. | |
void | SetRepeatingLong (INT32 Repeats) |
Set the UI corresponding to the number of fixed repeats for a brush (where 0 repeats really means optimal repeats). | |
INT32 | GetRepeatingLong () |
Get the number of fixed repeats for this brush from the UI. 0 means optimal. | |
void | SetSliderMinMax (INT32 Min, INT32 Max) |
void | SetSliderPos (INT32 Value) |
void | GreyRepeats (BOOL Grey) |
void | SetOverrideFillBool (BOOL OverrideFill) |
Set the Override Fill button state from the dialog. | |
BOOL | GetOverrideFillBool () |
Get the Override Fill button state from the dialog. | |
void | SetOverrideTransBool (BOOL OverrideTrans) |
Set the Override Trans button state from the dialog. | |
BOOL | GetOverrideTransBool () |
Get the Override Trans button state from the dialog. | |
void | RedrawStrokesInDocuments (StrokeHandle Handle) |
Whizzes through all the documents, redrawing nodes containing the passed in stroke business. | |
Static Public Member Functions | |
static BOOL | Init () |
Initialises the Line Properties Dialogue Op. | |
static OpState | GetState (String_256 *, OpDescriptor *) |
Get the state of the Line Properties Dialog Op. | |
static void | InvokeDialog (SuperGallery *Parent) |
Creates a new instance of this dialogue type, connects it to the given gallery, and opens the dialogue on screen. | |
Public Attributes | |
SGDisplayNode * | m_pItem |
Static Public Attributes | |
static const UINT32 | IDD = _R(IDD_SGLINEPROPERTIES) |
static const CDlgMode | Mode = MODELESS |
Protected Member Functions | |
virtual void | RedrawDiagram (ReDrawInfoType *ExtraInfo) |
Redraws the diagram on the line properties dialog. | |
void | InitValues (void) |
Initialises the line properties dialogue, and sets its controls Scope: private. | |
void | SetControls (void) |
(Re)Initialises the line properties dialogue controls | |
void | Commit (BOOL RedrawDocument=TRUE) |
Applies the current settings in the dialog to its parent gallery and the referenced stroke in the document. | |
Protected Attributes | |
SuperGallery * | ParentGallery |
Definition at line 125 of file sglinepr.h.
|
Constructor.
Definition at line 163 of file sglinepr.cpp. 00164 : DialogOp(SGalleryLinePropertiesDlg::IDD, SGalleryLinePropertiesDlg::Mode) 00165 { 00166 ParentGallery = NULL; 00167 m_pItem = NULL; 00168 }
|
|
destructor
Definition at line 183 of file sglinepr.cpp. 00184 { 00185 if (ParentGallery != NULL) 00186 ParentGallery->CurrentLinePropertiesDlg = NULL; 00187 }
|
|
Applies the current settings in the dialog to its parent gallery and the referenced stroke in the document.
Definition at line 339 of file sglinepr.cpp. 00340 { 00341 if (ParentGallery == NULL) 00342 { 00343 ERROR3("No parent gallery!"); 00344 return; 00345 } 00346 00347 if(m_pItem == NULL) 00348 { 00349 ERROR3("SGalleryLinePropertiesDlg::Commit - No associated item"); 00350 return; 00351 } 00352 00353 // Commit changes to item and redraw the various bits 00354 if(m_pItem->IsKindOf(CC_RUNTIME_CLASS(StrokeTypeItem))) 00355 { 00356 StrokeTypeItem *pItem = (StrokeTypeItem *)m_pItem; 00357 00358 StrokeDefinition *pStroke = pItem->GetStrokeDefinition(); 00359 if (pStroke != NULL) 00360 { 00361 // Apply the checkboxes 00362 pStroke->SetStrokeRepeating(GetRepeatingBool()); 00363 pStroke->SetNumStrokeRepeats(GetRepeatingLong()); 00364 pStroke->SetOverrideFill(GetOverrideFillBool()); 00365 pStroke->SetOverrideTrans(GetOverrideTransBool()); 00366 00367 // Change the brush name 00368 String_256 NewName; 00369 GetNameEditField(&NewName); 00370 pStroke->SetStrokeName(&NewName); 00371 00372 // Get the number of repeats 00373 INT32 Repeats = GetRepeatingLong(); 00374 pStroke->SetNumStrokeRepeats(Repeats); 00375 SetSliderPos(Repeats); 00376 00377 // Grey the fixed repeat stuff 00378 GreyRepeats(pItem->IsRepeating() == 0); 00379 00380 pItem->UpdateGalleryItem(); 00381 InvalidateGadget(_R(IDC_SGLINEPROPERTIES_DIAGRAM)); 00382 00383 if(RedrawDocument) 00384 { 00385 StrokeHandle Handle = pItem->GetStrokeHandle(); 00386 RedrawStrokesInDocuments(Handle); 00387 } 00388 } 00389 } 00390 }
|
|
Creates a Line Properties dialogue box.
Reimplemented from DialogOp. Definition at line 540 of file sglinepr.cpp. 00541 { 00542 ERROR3IF(ParentGallery == NULL, "My ParentGallery is NULL!"); 00543 00544 if (DialogOp::Create()) 00545 { 00546 ParentGallery->CurrentLinePropertiesDlg = this; 00547 00548 InitValues(); 00549 return(TRUE); 00550 } 00551 00552 return(FALSE); 00553 }
|
|
'Does' a line properties dialogue op. DO NOT call this method - it must be invoked via DoWithParam
Reimplemented from Operation. Definition at line 574 of file sglinepr.cpp. 00575 { 00576 ERROR3("SGalleryLinePropertiesDlg - You must use DoWithParam (Call InvokeDialog)"); 00577 End(); 00578 }
|
|
'Does' a line properties dialogue op. Shows the dialogue.
Reimplemented from Operation. Definition at line 599 of file sglinepr.cpp. 00600 { 00601 ERROR3IF(Param == NULL, "Null parameters are illegal"); 00602 00603 ParentGallery = ((LinePropertiesDlgParam *)Param)->ParentGal; 00604 00605 ERROR3IF(ParentGallery == NULL, "SGalleryLinePropertiesDlg needs a non-NULL parent gallery!"); 00606 00607 if (ParentGallery != NULL && Create()) 00608 Open(); 00609 else 00610 End(); 00611 }
|
|
Can be called by sgline to get the name text from the dialog.
Definition at line 647 of file sglinepr.cpp. 00648 { 00649 if(pString != NULL) 00650 { 00651 *pString = ""; 00652 00653 BOOL Valid = FALSE; 00654 String_256 TheString = GetStringGadgetValue(_R(IDC_SGLINEPROPERTIES_NAMEEDIT), &Valid); 00655 if(Valid) 00656 *pString = TheString; 00657 } 00658 }
|
|
Get the Override Fill button state from the dialog.
Definition at line 803 of file sglinepr.cpp. 00804 { 00805 BOOL Valid = FALSE; 00806 INT32 Value = GetLongGadgetValue(_R(IDC_SGLINEPROPERTIES_OVERRIDE_FILL),0,1,0,&Valid); 00807 if(Valid && Value > 0) 00808 return TRUE; 00809 00810 return FALSE; 00811 }
|
|
Get the Override Trans button state from the dialog.
Definition at line 844 of file sglinepr.cpp. 00845 { 00846 BOOL Valid = FALSE; 00847 INT32 Value = GetLongGadgetValue(_R(IDC_SGLINEPROPERTIES_OVERRIDE_TRANS),0,1,0,&Valid); 00848 if(Valid && Value > 0) 00849 return TRUE; 00850 00851 return FALSE; 00852 }
|
|
Can be called by sgline to get the repeating button state from the dialog.
Definition at line 691 of file sglinepr.cpp. 00692 { 00693 BOOL Valid = FALSE; 00694 INT32 Value = GetLongGadgetValue(_R(IDC_SGLINEPROPERTIES_REPEAT),0,1,0,&Valid); 00695 if(Valid && Value > 0) 00696 return TRUE; 00697 00698 return FALSE; 00699 }
|
|
Get the number of fixed repeats for this brush from the UI. 0 means optimal.
Definition at line 731 of file sglinepr.cpp. 00732 { 00733 BOOL Valid = FALSE; 00734 00735 INT32 Fixed = GetLongGadgetValue(_R(IDC_SGLINEPROPERTIES_FIXED),0,1,0,&Valid); 00736 if(Fixed != 0 && Valid) 00737 { 00738 INT32 Value = GetLongGadgetValue(_R(IDC_SGLINEPROPERTIES_FIXED_EDIT),0,255,0,&Valid); 00739 if(Valid && (Value > 0)) 00740 return Value; 00741 } 00742 00743 // SetRepeatingLong(0); 00744 00745 return 0; 00746 }
|
|
Get the state of the Line Properties Dialog Op.
Definition at line 489 of file sglinepr.cpp. 00490 { 00491 OpState OpSt; 00492 return(OpSt); 00493 }
|
|
Definition at line 760 of file sglinepr.cpp. 00761 { 00762 EnableGadget(_R(IDC_SGLINEPROPERTIES_FIXED), !Grey); 00763 EnableGadget(_R(IDC_SGLINEPROPERTIES_OPTIMAL), !Grey); 00764 EnableGadget(_R(IDC_SGLINEPROPERTIES_FIXED_EDIT), !Grey); 00765 EnableGadget(_R(IDC_SGLINEPROPERTIES_FIXED_SLIDER), !Grey); 00766 00767 /* SetLongGadgetValue(_R(IDC_SGLINEPROPERTIES_FIXED), (Repeats > 0), TRUE, 0); 00768 SetLongGadgetValue(_R(IDC_SGLINEPROPERTIES_OPTIMAL), (Repeats == 0), TRUE, 0); 00769 SetLongGadgetValue(_R(IDC_SGLINEPROPERTIES_FIXED_EDIT), Repeats, TRUE, 0);*/ 00770 }
|
|
Initialises the Line Properties Dialogue Op.
Reimplemented from SimpleCCObject. Definition at line 512 of file sglinepr.cpp. 00513 { 00514 return (RegisterOpDescriptor( 00515 0, 00516 _R(IDS_SGLINEPROPERTIESDLG), 00517 CC_RUNTIME_CLASS(SGalleryLinePropertiesDlg), 00518 OPTOKEN_SGLINEPROPERTIESDLG, 00519 SGalleryLinePropertiesDlg::GetState, 00520 _R(IDST_GALLERY_MENU), // Status line help 00521 _R(IDBBL_GALLERY_MENU), // Bubble help 00522 0 /* bitmap ID */ 00523 )); 00524 }
|
|
Initialises the line properties dialogue, and sets its controls Scope: private.
Definition at line 205 of file sglinepr.cpp. 00206 { 00207 if (ParentGallery == NULL) 00208 { 00209 ERROR3("SGalleryLinePropertiesDlg MUST be given a valid parent pointer"); 00210 return; 00211 } 00212 00213 // The fixed thingy slider 00214 SetSliderMinMax(0, SliderMax); 00215 SetGadgetBitmaps(_R(IDC_SGLINEPROPERTIES_FIXED_SLIDER), _R(IDB_SLIDERBASE), _R(IDB_SLIDERSLIDER)); 00216 SetSliderPos(0); 00217 00218 // Set up the OK button to respond to Adjust (SOFT_COMMIT) clicks 00219 // Don't call this more than once per dialog - fireworks ensue ! 00220 // DualFunctionButton(IDOK); 00221 00222 // Fill in the controls with the current settings 00223 SetControls(); 00224 }
|
|
Creates a new instance of this dialogue type, connects it to the given gallery, and opens the dialogue on screen.
Definition at line 244 of file sglinepr.cpp. 00245 { 00246 if (Parent->CurrentLinePropertiesDlg != NULL) // There's one already open! 00247 { 00248 // Update the settings in the dialog 00249 Parent->CurrentLinePropertiesDlg->SetControls(); 00250 00251 // Bring it to the front of the window stack, then return 00252 Parent->CurrentLinePropertiesDlg->BringToTop(); 00253 return; 00254 } 00255 00256 LinePropertiesDlgParam OptInfo(Parent); 00257 OpDescriptor *Dlg = OpDescriptor::FindOpDescriptor(CC_RUNTIME_CLASS(SGalleryLinePropertiesDlg)); 00258 00259 ERROR3IF(Dlg == NULL, "I can't find the Dialog OpDescriptor"); 00260 00261 if (Dlg != NULL) 00262 Dlg->Invoke(&OptInfo); 00263 }
|
|
Standard DialogOp message handler which handles redraw and commit stuff.
Reimplemented from DialogOp. Definition at line 408 of file sglinepr.cpp. 00409 { 00410 if (!(IS_OUR_DIALOG_MSG(Message))) return DialogOp::Message(Message); 00411 00412 DialogMsg* TheMsg = (DialogMsg*)Message; 00413 00414 switch(TheMsg->DlgMsg) 00415 { 00416 case DIM_SLIDER_POS_CHANGING: 00417 case DIM_SLIDER_POS_IDLE: 00418 case DIM_SLIDER_POS_SET: 00419 { 00420 BOOL Valid = FALSE; 00421 00422 INT32 Value = GetLongGadgetValue(_R(IDC_SGLINEPROPERTIES_FIXED_SLIDER),0,SliderMax,0,&Valid); 00423 if(Value != 0 && Valid) 00424 { 00425 SetRepeatingLong(SliderMax - Value); 00426 } 00427 break; 00428 } 00429 00430 case DIM_LFT_BN_CLICKED: 00431 case DIM_RGT_BN_CLICKED: 00432 Commit(); 00433 break; 00434 00435 case DIM_TEXT_CHANGED: 00436 // Only commit if the user typed something rather than the code 00437 if(SGLinePrJustSetATextEditChangeMessage) 00438 SGLinePrJustSetATextEditChangeMessage = FALSE; 00439 else 00440 { 00441 CGadgetID GadgetID = TheMsg->GadgetID; 00442 if(GadgetID == _R(IDC_SGLINEPROPERTIES_NAMEEDIT)) 00443 Commit(FALSE); // No need to redraw the document here 00444 else 00445 Commit(TRUE); // OK, we need to redraw the document 00446 } 00447 break; 00448 00449 case DIM_COMMIT: // OK clicked 00450 Commit(); 00451 // Drop through to CANCEL to close the dlg... 00452 00453 case DIM_CANCEL: // Cancel clicked 00454 Close(); 00455 End(); 00456 break; 00457 00458 case DIM_SOFT_COMMIT: // OK "adjust clicked" 00459 Commit(); 00460 break; 00461 00462 case DIM_REDRAW: // handle redraw request for diagram gadget 00463 if (TheMsg->GadgetID == _R(IDC_SGLINEPROPERTIES_DIAGRAM)) 00464 RedrawDiagram((ReDrawInfoType*)TheMsg->DlgMsgParam); 00465 break; 00466 00467 } 00468 00469 return DialogOp::Message(Message); 00470 }
|
|
Redraws the diagram on the line properties dialog.
Definition at line 864 of file sglinepr.cpp. 00865 { 00866 INT32 dx = ExtraInfo->dx; // In millipoints 00867 INT32 dy = ExtraInfo->dy; 00868 INT32 Dpi = ExtraInfo->Dpi; // The DPI of the screen 00869 00870 if(m_pItem == NULL || !(m_pItem->IsKindOf(CC_RUNTIME_CLASS(StrokeTypeItem)))) 00871 { 00872 ERROR3("SGalleryLinePropertiesDlg::RedrawDiagram - Dodgy or no item"); 00873 return; 00874 } 00875 00876 StrokeTypeItem *pItem = (StrokeTypeItem *)m_pItem; 00877 00878 // Total size of control 00879 DocRect ControlRect; 00880 ControlRect.lox = 0; 00881 ControlRect.loy = 0; 00882 ControlRect.hix = dx; 00883 ControlRect.hiy = dy; 00884 00885 // make a render region 00886 DocRect RendRect = ControlRect; 00887 RenderRegion* pRender=CreateGRenderRegion(&RendRect,ExtraInfo); 00888 if (pRender!=NULL) 00889 { 00890 // Renders the stroke into the render region 00891 // pItem->RenderItem(pRender, &RendRect, (32000)); // 32pt line width 00892 pItem->RenderItem(pRender, &RendRect, dy); // almost as big as the control 00893 00894 // Destroys and blits the render region 00895 DestroyGRenderRegion(pRender); 00896 } 00897 }
|
|
Whizzes through all the documents, redrawing nodes containing the passed in stroke business.
Definition at line 913 of file sglinepr.cpp. 00914 { 00915 Document *pOurDoc = (Document *) GetApplication()->Documents.GetHead(); 00916 while (pOurDoc != NULL) 00917 { 00918 ObjChangeFlags ChangeFlags; 00919 ChangeFlags.Attribute = TRUE; 00920 00921 ObjChangeParam ChangeParam(OBJCHANGE_STARTING, ChangeFlags, NULL, NULL); 00922 00923 Node *CurNode = Node::DocFindFirstDepthFirst(pOurDoc); 00924 while (CurNode != NULL) 00925 { 00926 if (CurNode->IsAnAttribute() && CurNode->IsKindOf(CC_RUNTIME_CLASS(AttrStrokeType))) 00927 { 00928 // actually, in here, we could possibly just use NodeAttribute::operator== to 00929 // see if it's the same as the Stroke Attribute that we're playing with 00930 // - this would be better than IsKindOf's 00931 00932 // Have found a StrokeType Attribute. Check if it's a Vector Stroke attribute 00933 // If it is one using the stroke we're after, then force a redraw of our parent node 00934 AttrStrokeType *pNode = (AttrStrokeType *) CurNode; 00935 00936 StrokeTypeAttrValue *pValue = (StrokeTypeAttrValue *)pNode->GetAttributeValue(); 00937 00938 PathProcessorStroke *pProcessor = pValue->GetPathProcessor(); 00939 00940 if (pProcessor != NULL && pProcessor->IsKindOf(CC_RUNTIME_CLASS(PathProcessorStrokeVector))) 00941 { 00942 StrokeHandle ThisHandle = ((PathProcessorStrokeVector *)pProcessor)->GetStrokeDefinition(); 00943 if (ThisHandle == Handle || Handle == StrokeHandle_NoStroke) 00944 { 00945 Node *Parent = CurNode->FindParent(); 00946 if (Parent != NULL && Parent->IsBounded()) 00947 { 00948 // Invoke AllowOp on the node to tag it so that parents such as blends 00949 // and moulds will also redraw if necessary. We ignore the return code 00950 // because we're not actually going to touch the node at all. 00951 CurNode->AllowOp(&ChangeParam); 00952 00953 // And redraw the directly affected node (our parent) 00954 DocRect NodeBounds = ((NodeRenderableBounded *)Parent)->GetBoundingRect(); 00955 pOurDoc->ForceRedraw(Parent->FindParentSpread(), NodeBounds, FALSE, Parent); 00956 } 00957 } 00958 } 00959 } 00960 CurNode = CurNode->DocFindNextDepthFirst(); 00961 } 00962 00963 // And make sure that the redraw occurs right away 00964 pOurDoc->FlushRedraw(); 00965 00966 ChangeParam.Define(OBJCHANGE_FINISHED, ChangeParam.GetChangeFlags(), NULL, NULL); 00967 UpdateAllChangedNodes(&ChangeParam); 00968 00969 pOurDoc = (Document *) GetApplication()->Documents.GetNext(pOurDoc); 00970 } 00971 }
|
|
(Re)Initialises the line properties dialogue controls
Definition at line 279 of file sglinepr.cpp. 00280 { 00281 if (ParentGallery == NULL) 00282 { 00283 ERROR3("ParentGallery is NULL!"); 00284 return; 00285 } 00286 00287 // Call gallery first 00288 BOOL Result = ParentGallery->ApplyAction(SGACTION_SETLINEPROPERTIES); 00289 00290 // Now set values in the dialog 00291 SGDisplayNode *pNode = ParentGallery->DisplayTree->FindNextSelectedItem(NULL); 00292 if(pNode != NULL && pNode->IsKindOf(CC_RUNTIME_CLASS(StrokeTypeItem))) 00293 { 00294 StrokeTypeItem *pItem = (StrokeTypeItem *)pNode; 00295 m_pItem = pItem; 00296 00297 // Set the edit name field 00298 String_256 ItemText; 00299 pItem->GetNameText(&ItemText); 00300 SetNameEditField(&ItemText); 00301 00302 // Set the repeating button 00303 SetRepeatingBool(pItem->IsRepeating()); 00304 00305 // Set the fixed repeating values 00306 SetRepeatingLong(pItem->NumRepeats()); 00307 00308 // Grey the fixed repeat stuff 00309 GreyRepeats(pItem->IsRepeating() == 0); 00310 00311 // Set the override fill button 00312 SetOverrideFillBool(pItem->OverridesFill()); 00313 00314 // Set the override transparency button 00315 SetOverrideTransBool(pItem->OverridesTrans()); 00316 } 00317 00318 InvalidateGadget(_R(IDC_SGLINEPROPERTIES_DIAGRAM)); 00319 }
|
|
Can be called by sgline to set the name text from the dialog.
Definition at line 626 of file sglinepr.cpp. 00627 { 00628 if(pString != NULL) 00629 { 00630 SGLinePrJustSetATextEditChangeMessage = TRUE; 00631 SetStringGadgetValue(_R(IDC_SGLINEPROPERTIES_NAMEEDIT), pString); 00632 } 00633 }
|
|
Set the Override Fill button state from the dialog.
Definition at line 783 of file sglinepr.cpp. 00784 { 00785 INT32 RadioValue = 0; 00786 if(OverrideFill) 00787 RadioValue = 1; 00788 00789 SetLongGadgetValue(_R(IDC_SGLINEPROPERTIES_OVERRIDE_FILL), RadioValue, TRUE, 0); 00790 }
|
|
Set the Override Trans button state from the dialog.
Definition at line 824 of file sglinepr.cpp. 00825 { 00826 INT32 RadioValue = 0; 00827 if(OverrideTrans) 00828 RadioValue = 1; 00829 00830 SetLongGadgetValue(_R(IDC_SGLINEPROPERTIES_OVERRIDE_TRANS), RadioValue, TRUE, 0); 00831 }
|
|
Can be called by sgline to set the repeating button state from the dialog.
Definition at line 671 of file sglinepr.cpp. 00672 { 00673 INT32 RadioValue = 0; 00674 if(Repeating) 00675 RadioValue = 1; 00676 00677 SetLongGadgetValue(_R(IDC_SGLINEPROPERTIES_REPEAT), RadioValue, TRUE, 0); 00678 }
|
|
Set the UI corresponding to the number of fixed repeats for a brush (where 0 repeats really means optimal repeats).
Definition at line 713 of file sglinepr.cpp. 00714 { 00715 SetLongGadgetValue(_R(IDC_SGLINEPROPERTIES_FIXED), (Repeats > 0), TRUE, 0); 00716 SetLongGadgetValue(_R(IDC_SGLINEPROPERTIES_OPTIMAL), (Repeats == 0), TRUE, 0); 00717 SetLongGadgetValue(_R(IDC_SGLINEPROPERTIES_FIXED_EDIT), Repeats, TRUE, 0); 00718 }
|
|
Definition at line 749 of file sglinepr.cpp. 00750 { 00751 SetGadgetRange(_R(IDC_SGLINEPROPERTIES_FIXED_SLIDER), Min, Max, 1); 00752 }
|
|
Definition at line 754 of file sglinepr.cpp. 00755 { 00756 SetLongGadgetValue(_R(IDC_SGLINEPROPERTIES_FIXED_SLIDER), SliderMax - Value); 00757 }
|
|
Definition at line 142 of file sglinepr.h. |
|
Definition at line 183 of file sglinepr.h. |
|
Definition at line 143 of file sglinepr.h. |
|
Definition at line 186 of file sglinepr.h. |