opfeathr.h

Go to the documentation of this file.
00001 // $Id: opfeathr.h 1526 2006-07-25 13:32:07Z alex $
00002 /* @@tag:xara-cn@@ DO NOT MODIFY THIS LINE
00003 ================================XARAHEADERSTART===========================
00004  
00005                Xara LX, a vector drawing and manipulation program.
00006                     Copyright (C) 1993-2006 Xara Group Ltd.
00007        Copyright on certain contributions may be held in joint with their
00008               respective authors. See AUTHORS file for details.
00009 
00010 LICENSE TO USE AND MODIFY SOFTWARE
00011 ----------------------------------
00012 
00013 This file is part of Xara LX.
00014 
00015 Xara LX is free software; you can redistribute it and/or modify it
00016 under the terms of the GNU General Public License version 2 as published
00017 by the Free Software Foundation.
00018 
00019 Xara LX and its component source files are distributed in the hope
00020 that it will be useful, but WITHOUT ANY WARRANTY; without even the
00021 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00022 See the GNU General Public License for more details.
00023 
00024 You should have received a copy of the GNU General Public License along
00025 with Xara LX (see the file GPL in the root directory of the
00026 distribution); if not, write to the Free Software Foundation, Inc., 51
00027 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
00028 
00029 
00030 ADDITIONAL RIGHTS
00031 -----------------
00032 
00033 Conditional upon your continuing compliance with the GNU General Public
00034 License described above, Xara Group Ltd grants to you certain additional
00035 rights. 
00036 
00037 The additional rights are to use, modify, and distribute the software
00038 together with the wxWidgets library, the wxXtra library, and the "CDraw"
00039 library and any other such library that any version of Xara LX relased
00040 by Xara Group Ltd requires in order to compile and execute, including
00041 the static linking of that library to XaraLX. In the case of the
00042 "CDraw" library, you may satisfy obligation under the GNU General Public
00043 License to provide source code by providing a binary copy of the library
00044 concerned and a copy of the license accompanying it.
00045 
00046 Nothing in this section restricts any of the rights you have under
00047 the GNU General Public License.
00048 
00049 
00050 SCOPE OF LICENSE
00051 ----------------
00052 
00053 This license applies to this program (XaraLX) and its constituent source
00054 files only, and does not necessarily apply to other Xara products which may
00055 in part share the same code base, and are subject to their own licensing
00056 terms.
00057 
00058 This license does not apply to files in the wxXtra directory, which
00059 are built into a separate library, and are subject to the wxWindows
00060 license contained within that directory in the file "WXXTRA-LICENSE".
00061 
00062 This license does not apply to the binary libraries (if any) within
00063 the "libs" directory, which are subject to a separate license contained
00064 within that directory in the file "LIBS-LICENSE".
00065 
00066 
00067 ARRANGEMENTS FOR CONTRIBUTION OF MODIFICATIONS
00068 ----------------------------------------------
00069 
00070 Subject to the terms of the GNU Public License (see above), you are
00071 free to do whatever you like with your modifications. However, you may
00072 (at your option) wish contribute them to Xara's source tree. You can
00073 find details of how to do this at:
00074   http://www.xaraxtreme.org/developers/
00075 
00076 Prior to contributing your modifications, you will need to complete our
00077 contributor agreement. This can be found at:
00078   http://www.xaraxtreme.org/developers/contribute/
00079 
00080 Please note that Xara will not accept modifications which modify any of
00081 the text between the start and end of this header (marked
00082 XARAHEADERSTART and XARAHEADEREND).
00083 
00084 
00085 MARKS
00086 -----
00087 
00088 Xara, Xara LX, Xara X, Xara X/Xtreme, Xara Xtreme, the Xtreme and Xara
00089 designs are registered or unregistered trademarks, design-marks, and/or
00090 service marks of Xara Group Ltd. All rights in these marks are reserved.
00091 
00092 
00093       Xara Group Ltd, Gaddesden Place, Hemel Hempstead, HP2 6EX, UK.
00094                         http://www.xara.com/
00095 
00096 =================================XARAHEADEREND============================
00097  */
00098 
00099 #ifndef INC_FEATHEROPS
00100 #define INC_FEATHEROPS
00101 
00102 //#define OPTOKEN_FEATHER           "Feather"
00103 //#define OPTOKEN_UNFEATHER     "UnFeather"
00104 #define OPTOKEN_FEATHERSIZE     _T("FeatherSize")
00105 #define OPTOKEN_FEATHERPROFILE  _T("FeatherProfile")
00106 
00107 //#include "selop.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00108 #include "biasgdgt.h"       // for CBiasGainGadget
00109 //#include "node.h"         // NodeHidden - in camtypes.h [AUTOMATICALLY REMOVED]
00110 #include "opliveeffects.h"
00111 #include "effects_stack.h"
00112 
00113 class AttrFeather;
00114 class OpChangeFeatherSize;
00115 class NodeFeatherEffect;
00116 class FeatherAttrValue;
00117 
00119 //                                      Changing feather size
00121 
00122 
00123 /********************************************************************************************
00124 >   class ChangeFeatherSizeSliderOpDesc : public UndoableOpDescriptor
00125     Author:     Ilan_Copelyn (Xara Group Ltd) <camelotdev@xara.com>
00126     Created:    07/12/99
00127     Purpose:    This class handles the UI for _R(IDC_FEATHERSIZE_CUSTOMEDIT). It invokes OpChangeFeatherSize
00128                 on the selected FeatherAttrValue(s)
00129     SeeAlso:    OpChangeFeatherSize, OpChangeLineWidthOpDesc
00130  ********************************************************************************************/
00131 
00132 class ChangeFeatherSizeSliderOpDesc : public UndoableOpDescriptor
00133 {
00134     CC_DECLARE_DYNAMIC( ChangeFeatherSizeSliderOpDesc )
00135 
00136 public:
00137     ChangeFeatherSizeSliderOpDesc(
00138                             UINT32 toolID,                    // Tool (Module) Identifier
00139                             UINT32 txID,                      // String Resource ID
00140                             CCRuntimeClass* Op,             // pointer to the Op's runtime class object
00141                             TCHAR* tok,                     // pointer to the token string
00142                             pfnGetState gs,                 // pointer to the GetState function
00143                             UINT32 helpId = 0,              // help identifier 
00144                             UINT32 bubbleID = 0,                // string resource for bubble help
00145                             UINT32 resourceID = 0,          // resource ID
00146                             UINT32 controlID = 0,               // control ID within resource
00147                             BOOL ReceiveMessages = TRUE,        
00148                             BOOL Smart = FALSE, 
00149                             BOOL Clean = FALSE,
00150                             UINT32 AutoStateFlags = 0
00151                            );
00152 
00153     // GetState function for the OpDescriptor. Implemented in the Operation
00154 //  static OpState GetState(String_256* Description, OpDescriptor*);
00155 
00157     //                                  Message handling functions
00159     // Function to initialise the feather controls on creation. 
00160     virtual void OnControlCreate(OpDescControlCreateMsg* CreateMsg);    
00161     // Function to handle final slider change
00162     virtual void OnSliderSet(OpDescControlMsg* SelChangedMsg);
00163     // Function to handle interactive slider changes
00164     virtual void OnSliderChanging(OpDescControlMsg* SliderChangingMsg);
00165     // Function to handle a selection from the edit text
00166     virtual void OnSelectionChange(OpDescControlMsg* SelChangedMsg, List* GadgetList);
00167     // Function to handle slider cancel
00168     virtual void OnSliderCancelled(OpDescControlMsg* SliderChangingMsg);
00169 
00170 protected:
00171     // Function to handle changes of various messages
00172     virtual MsgResult Message(Msg* Msg);
00173     virtual BOOL OnSelChangingMsg(SelChangingMsg::SelectionState State);
00174     virtual BOOL OnCommonAttrsChangedMsg();
00175     virtual BOOL OnOptionsChangingMsg(OptionsChangingMsg* Msg);
00176 
00177 private:
00178     BOOL SetFeatherSizeForCurrentSel();
00179     BOOL UpdateAllFeatherControls(String_256* Str, MILLIPOINT InverseSliderVal);
00180     void ConvertSizeToUnits(String_256& StrSize, MILLIPOINT size);
00181 
00182     INT32 GetSliderValue(DialogOp* pDlg, CGadgetID SliderID);
00183     void SetSliderValue(INT32 SliderVal, DialogOp* pDlg, CGadgetID SliderID);
00184 
00185     static const MILLIPOINT MinSlider;
00186     static const MILLIPOINT MaxSlider;
00187 
00188     // denotes the power to use for the exponential slider values.
00189     static const double     SliderChangeRate;
00190 
00191 private:
00192     OpChangeFeatherSize* m_pOpChangeFeatherSize;
00193     INT32 LastOnscreenPixelSize;
00194 };
00195 
00196 
00197 /********************************************************************************************
00198 >   class OpChangeFeatherSize : public UndoableOperation
00199     Author:     Ilan_Copelyn (Xara Group Ltd) <camelotdev@xara.com>
00200     Created:    02/12/99
00201     Purpose:    This class represents the operation of changing the size of the feather
00202                 region (ie the penumbra width of of the shadow transparency). It is
00203                 tied to the _R(IDC_FEATHERSIZE_CUSTOMEDIT) slider / edit control
00204                 which appear in the Feather bar (and also on the Control Bar Palette).
00205     SeeAlso:    OpShadowPenumbra, ShadowPenumbra
00206 ********************************************************************************************/
00207 
00208 class CCAPI OpChangeFeatherSize : public UndoableOperation
00209 {
00210     CC_DECLARE_DYNCREATE( OpChangeFeatherSize )
00211 
00212 public:
00213     OpChangeFeatherSize() : UndoableOperation() {};
00214     static OpState      GetState(String_256* Description, OpDescriptor*);
00215     static BOOL         Init();
00216     static BOOL         DeInit();
00217     static void         SetEditContext(INT32 iStackPos = STACKPOS_INVALID, ListRange* pEditRange = NULL);
00218     static ListRange*   GetEditContext();
00219     static void         ReleaseFeatherCache(NodeRenderableInk* pNode, DocRect& drRegion);
00220 
00221     virtual void        DoWithParam(OpDescriptor* pOp, OpParam* pParam);
00222 
00223     // Karim 21/01/2000 - see UndoableOperation base implementation.
00224     virtual BOOL        MayChangeNodeBounds() const { return FALSE; }
00225 
00226     // Karim 23/08/2000 - New Feather slider UI.
00227 
00228     virtual void        DoSlide(INT32 SlideValue);
00229     virtual void        SlideFinished(BOOL SuccessfulFinish = TRUE);
00230 
00231     static BOOL IsUpdateDisabled() {return s_DisableUpdates;}
00232 
00233 private:
00234 #ifdef FEATHER_EFFECT
00235     static NodeFeatherEffect* DoReplaceFeatherEffectNode(UndoableOperation* pOp,
00236                                               NodeFeatherEffect* pNode,
00237                                               MILLIPOINT FeatherSize,
00238                                               CProfileBiasGain Profile);
00239 #endif
00240 
00241 private:
00242     List                m_NewFeatherAttrs;
00243 
00244     static INT32        s_iEditStackPos;
00245     static ListRange*   s_pEditRange;
00246     static BOOL         s_DisableUpdates;
00247 };
00248 
00249 
00250 
00251 
00252 /********************************************************************************************
00253 >   class OpChangeFeatherSizeParam : public OpParam
00254     Author:     Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
00255     Created:    09/05/05
00256     Purpose:    Control OpChangeFeatherSize
00257 ********************************************************************************************/
00258 
00259 class OpChangeFeatherSizeParam : public OpParam
00260 {
00261     CC_DECLARE_DYNAMIC(OpChangeFeatherSizeParam)
00262 
00263 public:
00264     OpChangeFeatherSizeParam(   MILLIPOINT p,
00265                                 BOOL bAddNew,
00266                                 ListRange* pRange )
00267     {
00268         size = p;
00269         bAddNewFeathers = bAddNew;
00270         pLevelRange = pRange;
00271     };
00272     OpChangeFeatherSizeParam(   MILLIPOINT p,
00273                                 ListRange* pRange )
00274     {
00275         size = p;
00276         pLevelRange = pRange;
00277         bAddNewFeathers = (pRange==NULL);
00278     };
00279     ~OpChangeFeatherSizeParam() {};
00280 
00281 public:
00282     MILLIPOINT  size;
00283     BOOL        bAddNewFeathers;
00284     ListRange*  pLevelRange;
00285 };
00286 
00287 
00288 
00289 
00291 //                                      Changing feather profile
00293 
00294 
00295 
00296 /********************************************************************************************
00297 >   class ChangeFeatherProfileOpDesc : public UndoableOpDescriptor
00298     Author:     Ilan_Copelyn (Xara Group Ltd) <camelotdev@xara.com>
00299     Created:    07/12/99
00300     Purpose:    This class handles the UI for _R(IDCB_FEATHERSIZE). It invokes OpChangeFeatherSize
00301                 on the selected FeatherAttrValue(s)
00302     SeeAlso:    OpChangeFeatherSize, OpChangeLineWidthOpDesc
00303  ********************************************************************************************/
00304 
00305 class ChangeFeatherProfileOpDesc : public UndoableOpDescriptor
00306 {
00307     CC_DECLARE_DYNAMIC( ChangeFeatherProfileOpDesc )
00308 
00309 public:
00310     ChangeFeatherProfileOpDesc(
00311                             UINT32 toolID,                    // Tool (Module) Identifier
00312                             UINT32 txID,                      // String Resource ID
00313                             CCRuntimeClass* Op,             // pointer to the Op's runtime class object
00314                             TCHAR* tok,                     // pointer to the token string
00315                             pfnGetState gs,                 // pointer to the GetState function
00316                             UINT32 helpId = 0,              // help identifier 
00317                             UINT32 bubbleID = 0,                // string resource for bubble help
00318                             UINT32 resourceID = 0,          // resource ID
00319                             UINT32 controlID = 0,               // control ID within resource
00320                             BOOL ReceiveMessages = TRUE,        
00321                             BOOL Smart = FALSE, 
00322                             BOOL Clean = FALSE,
00323                             UINT32 AutoStateFlags = 0
00324                            );
00325 
00326     // GetState function for the OpDescriptor. Implemented in the Operation
00327 //  static OpState GetState(String_256* Description, OpDescriptor*);
00328 
00330     //                                  Message handling functions
00332     // Function to initialise the profile gadget 
00333     virtual void OnControlCreate(OpDescControlCreateMsg* CreateMsg);    
00334     // Function to handle a selection from the profile gadgets dropdown/edit boxes
00335     virtual MsgResult Message(Msg* Msg);
00336 
00337     
00338     // Function to handle profile changed message (e.g. when sliders in BiasDialog are set or a profile in
00339     // combobox selected)
00340     virtual void OnProfileChanged(OpDescControlMsg* SelChangedMsg);
00341     // Function to handle profile changing (e.g. when slider is moving).
00342     virtual void OnProfileChanging(OpDescControlMsg* SliderChangingMsg);
00343 
00344     static CBiasGainGadget  m_BiasGainGadget;
00345 
00346     static void SetBoolGadgetSelected (CGadgetID Gadget, BOOL IsSelected);
00347 
00348 public:
00349     BOOL m_bProfileChanging;    // Indicates whether the profile is changing (e.g. when user drags a slider in
00350                                 // the BiasGain dialog).
00351     BOOL m_bProfileInitialChange;   // set to true when the op should record itself in the ophist list
00352                                     // so that its actions are undoable (by OpUndo)
00353 };
00354 
00355 /********************************************************************************************
00356 >   class OpChangeFeatherProfile : public UndoableOperation
00357     Author:     Ilan_Copelyn (Xara Group Ltd) <camelotdev@xara.com>
00358     Created:    02/12/99
00359     Purpose:    This class represents the operation of changing the profile of the feather
00360                 region. It is tied to the _R(IDC_FEATHERPROFILE_GDGT) bias gain profile control
00361     SeeAlso:    OpChangeShadowProfile
00362  ********************************************************************************************/
00363 class CCAPI OpChangeFeatherProfile: public UndoableOperation
00364 {         
00365     CC_DECLARE_DYNCREATE( OpChangeFeatherProfile )    
00366 
00367 public:
00368     OpChangeFeatherProfile() : UndoableOperation() {}
00369     static OpState  GetState(String_256*, OpDescriptor*);
00370     static BOOL     Init();
00371     virtual void    Do (OpDescriptor* pOp);
00372     virtual void    DoWithParam(OpDescriptor* pOp, OpParam* pParam);
00373 
00374     // Karim 21/01/2000 - see UndoableOperation base implementation.
00375     virtual BOOL MayChangeNodeBounds() const { return FALSE; }
00376 
00377 protected:
00378     // Function to handle changes of various messages
00379     virtual BOOL OnSelChangingMsg(SelChangingMsg::SelectionState State);
00380 
00381 private:
00382     BOOL DoChangeFeatherProfile(FeatherAttrValue* pAttr, CProfileBiasGain &newProfile);
00383 //  CProfileBiasGain* GetProfileFromSelection(CGadgetID GadgetID, BOOL* bMany, BOOL* bAllSameType);
00384     static SelRange::CommonAttribResult GetProfileFromSelection2(BOOL bFastScan,
00385                                                                   CProfileBiasGain* pCommonProfile);
00386 
00387 };
00388 
00389 /********************************************************************************************
00390 >   class FeatherProfileOpParam : public OpParam
00391     Author:     Ilan_Copelyn (Xara Group Ltd) <camelotdev@xara.com>
00392     Created:    13/04/00
00393     Purpose:    so we can can virtual DoWithParam functions with a CProfileBiasGain
00394  ********************************************************************************************/
00395 class FeatherProfileOpParam : public OpParam
00396 {
00397     CC_DECLARE_DYNCREATE(FeatherProfileOpParam)
00398 
00399 public:
00400     FeatherProfileOpParam(const CProfileBiasGain p, ListRange* pRange) { P = p; pLevelRange = pRange; }
00401     ~FeatherProfileOpParam() {;}
00402 
00403 public:
00404     CProfileBiasGain P;
00405     ListRange* pLevelRange;
00406 };
00407 
00408 /********************************************************************************************
00409 >   class ChangeFeatherProfileAction : public Action
00410     Author:     Ilan_Copelyn (Xara Group Ltd) <camelotdev@xara.com>
00411     Created:    02/12/99
00412     Purpose:    An action which modifies the profile of the feather region
00413     SeeAlso:    ChangePenumbraProfileAction
00414  ********************************************************************************************/
00415 
00416 class ChangeFeatherProfileAction : public Action
00417 {
00418 CC_DECLARE_DYNCREATE(ChangeFeatherProfileAction)
00419 
00420 public:
00421     ChangeFeatherProfileAction();
00422 //  ~ChangeFeatherProfileAction();
00423     virtual ActionCode Execute();
00424     static ActionCode Init( Operation* pOp,
00425                             ActionList* pActionList,
00426                             FeatherAttrValue* pThisFeatherCompound,
00427                             CProfileBiasGain Profile,
00428                             ChangeFeatherProfileAction** NewAction);
00429 
00430 protected:
00431     FeatherAttrValue* m_pFeather;
00432     CProfileBiasGain m_LastProfile; 
00433 };
00434 
00435 
00436 /********************************************************************************************
00437 >   class ChangeFeatherEffectProfileAction : public Action
00438     Author:     Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
00439     Created:    27/05/2005
00440     Purpose:    An action which modifies the profile of the feather effect
00441  ********************************************************************************************/
00442 
00443 #ifdef FEATHER_EFFECT
00444 class ChangeFeatherEffectProfileAction : public Action
00445 {
00446     CC_DECLARE_DYNCREATE(ChangeFeatherEffectProfileAction)
00447 
00448 public:
00449     ChangeFeatherEffectProfileAction() { m_pFeatherEffect = NULL;}
00450 //  ~ChangeFeatherProfileAction();
00451     virtual ActionCode Execute();
00452     static ActionCode Init( Operation* pOp,
00453                             ActionList* pActionList,
00454                             NodeFeatherEffect* pThisFeather,
00455                             CProfileBiasGain Profile,
00456                             ChangeFeatherEffectProfileAction** NewAction);
00457 
00458 protected:
00459     NodeFeatherEffect*  m_pFeatherEffect;
00460     CProfileBiasGain    m_LastProfile;  
00461 };
00462 
00463 
00464 /********************************************************************************************
00465 >   class ChangeFeatherEffectAction : public Action
00466     Author:     Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
00467     Created:    27/05/2005
00468     Purpose:    An action which modifies the profile of the feather effect
00469  ********************************************************************************************/
00470 
00471 class ChangeFeatherEffectAction : public Action
00472 {
00473     CC_DECLARE_DYNCREATE(ChangeFeatherEffectAction)
00474 
00475 public:
00476     ChangeFeatherEffectAction() { m_pFeatherEffect = NULL; m_LastFeatherSize = 0; }
00477 //  ~ChangeFeatherEffectAction();
00478     virtual ActionCode Execute();
00479     static ActionCode Init( Operation* pOp,
00480                             ActionList* pActionList,
00481                             NodeFeatherEffect* pThisFeather,
00482                             MILLIPOINT FeatherSize,
00483                             CProfileBiasGain Profile,
00484                             ChangeFeatherEffectAction** NewAction);
00485 
00486 protected:
00487     NodeFeatherEffect*  m_pFeatherEffect;
00488     MILLIPOINT          m_LastFeatherSize;
00489     CProfileBiasGain    m_LastProfile;  
00490 };
00491 #endif
00492 
00493 
00494 /********************************************************************************************
00495 >   class RegenerateFeatherContourAction : public Action
00496     Author:     Ilan_Copelyn (Xara Group Ltd) <camelotdev@xara.com>
00497     Created:    13/04/00
00498     Purpose:    An action which speeds facillitates the caching of the outer contour which
00499                 feathers use to create the feather transparency mask
00500     SeeAlso:    
00501  ********************************************************************************************/
00502 class RegenerateFeatherContourAction : public Action
00503 {
00504 CC_DECLARE_DYNCREATE(RegenerateFeatherContourAction)
00505 
00506 public:
00507     RegenerateFeatherContourAction();
00508     ~RegenerateFeatherContourAction();
00509     virtual ActionCode Execute();
00510     static ActionCode Init( Operation* pOp,
00511                             ActionList* pActionList,
00512                             FeatherAttrValue* pThisFeatherCompound,
00513                             Path* OldContour,
00514                             RegenerateFeatherContourAction** NewAction);
00515 
00516 protected:
00517     FeatherAttrValue* m_pFeather;
00518     Path* m_pContour;
00519 };
00520 
00521 #endif

Generated on Sat Nov 10 03:46:14 2007 for Camelot by  doxygen 1.4.4