opbarcreation.h

Go to the documentation of this file.
00001 // $Id: opbarcreation.h 751 2006-03-31 15:43:49Z 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 #ifndef OPTOKEN_BARCREATIONOP
00099 
00100 #include "cutop.h"
00101 #include "opdupbar.h"
00102 
00103 #define OPTOKEN_BARCREATIONOP _T("BarCreationOp")
00104 // modes of state replacement that the bar creation dlg can be in
00105 #define NEW_BAR             0
00106 #define ONLY_BAR            1
00107 #define REPLACE_SOME_STATES 2
00108 
00109 class NodeBarProperty;
00110 
00111 
00112 /********************************************************************************************
00113 
00114 >   class OpBarCreation : public CarbonCopyOp
00115 
00116     Author:     Simon_Knight (Xara Group Ltd) <camelotdev@xara.com>
00117     Created:    27/8/99
00118     Purpose:    This class makes several copies of the selection, putting them onto
00119                 particular named layers. Each copy is named button1, button2, etc..
00120                 Each layer is created and named Default, Mouse, Clicked or Selected.
00121                 The copy can be 'mutated' to appear slightly different on each layer.
00122                 The selection is deleted
00123 
00124 ********************************************************************************************/
00125 
00126 class CCAPI OpBarCreation: public CarbonCopyOp
00127 //class CCAPI OpBarCreation: public OpReAlignBar
00128 {         
00129     CC_DECLARE_DYNCREATE( OpBarCreation )    
00130 
00131 public:
00132     // standard stuff
00133     OpBarCreation();                                
00134     static BOOL Init();             
00135     static OpState  GetState(String_256*, OpDescriptor*);       
00136     virtual void    Do(OpDescriptor* token);
00137     void            DoWithParam(OpDescriptor* token, OpParam* pOpParam);
00138 
00139     // functions that are useful here
00140     Layer * AddLayer(String_256 LayerName, INT32 NewLayerNo);
00141     BOOL ApplyNameAttr(String_256 * pNameAttr, Node * pNode, BOOL UseBarName = TRUE);
00142     void ShiftColourValue(DocColour* pdoccol, INT32 PercentColourChange);
00143     void FindAttribColours(Node * pAttrNode, INT32 PercentColourChange, INT32 State);
00144     BOOL CleanSelection (Range * pSel, List * pSelectionList, List * pDeletionList, INT32 LayerNumToCreate);
00145 
00146     // main function that does the business
00147     BOOL CreateOrEditBar (OpParam* pOpParam);
00148     BOOL CreateFromDefaultState (OpParam* pOpParam);
00149     BOOL CreateBackBarFromSelection (OpParam* pOpParam, BOOL Extend = FALSE);
00150     BOOL CreateBarAndBackBar (OpParam* pOpParam);
00151 
00152     void ShowState(INT32 ShowLayer);
00153     INT32 GetBarNumber() {return SliceHelper::GetBarNumberFromBarName(m_BarName);}
00154 
00155 
00156 
00157 private:
00158     String_256  m_RolloverName[5];
00159     String_256  m_BarName;
00160 
00161     DocRect m_BarSelectionRect;
00162     DocRect m_FinishedBarRect;
00163 
00164 };    
00165 
00166 
00167 class OpParamBarCreation : public OpParam
00168 {
00169 //CC_DECLARE_DYNAMIC(OpParamBarCreation)
00170 
00171 public:
00172     OpParamBarCreation()
00173             {   
00174                 m_WantMouse = TRUE;
00175                 m_WantClicked = FALSE;
00176                 m_WantSelected = TRUE;
00177                 m_IsVertical = TRUE;
00178                 m_SuggestDesign = FALSE;
00179                 m_NoOfButtons = 4;
00180                 m_WantDefault = TRUE;
00181                 m_StateReuse = REPLACE_SOME_STATES;
00182                 m_BarName = _T("Bar1");
00183                 m_ContinuousBar = FALSE;
00184                 m_ButtonsAllSameSize = FALSE;
00185                 m_Spacing = 0;
00186                 m_FromSelection = TRUE;
00187                 m_WantBackBar = FALSE;
00188                 m_ExtendFlags = 3;
00189                 m_DelExistingState = FALSE;
00190             }
00191 
00192     OpParamBarCreation(BOOL WantMouse, BOOL WantClicked, BOOL WantSelected, BOOL WantBackBar, BOOL IsVertical, BOOL SuggestDesign, INT32 NoOfButtons, BOOL WantDefault = TRUE, INT32 StateReuse = REPLACE_SOME_STATES,
00193                         INT32 Spacing = 0,
00194                         BOOL ContinuousBar = FALSE, BOOL ButtonsAllSameSize = FALSE, String_256 BarName = "Bar1", BOOL FromSelection = TRUE, BYTE ExtendFlags = 3,
00195                         BOOL DelExistingState = FALSE)
00196             {   
00197                 m_WantMouse = WantMouse;
00198                 m_WantClicked = WantClicked;
00199                 m_WantSelected = WantSelected;
00200                 m_IsVertical = IsVertical;
00201                 m_SuggestDesign = SuggestDesign;
00202                 m_NoOfButtons = NoOfButtons;
00203                 m_WantDefault = WantDefault;
00204                 m_StateReuse = StateReuse;
00205                 m_Spacing = Spacing;
00206                 m_BarName = BarName;
00207                 m_ContinuousBar = ContinuousBar;
00208                 m_ButtonsAllSameSize = ButtonsAllSameSize;
00209                 m_FromSelection = FromSelection;
00210                 m_WantBackBar = WantBackBar;
00211                 m_ExtendFlags = ExtendFlags;
00212                 m_DelExistingState = DelExistingState;
00213             }
00214 
00215     BOOL m_WantMouse;
00216     BOOL m_WantClicked;
00217     BOOL m_WantSelected;
00218     BOOL m_IsVertical;
00219     BOOL m_SuggestDesign;
00220     BOOL m_ContinuousBar;
00221     BOOL m_ButtonsAllSameSize;
00222     INT32 m_NoOfButtons;
00223     BOOL m_WantDefault;
00224     INT32 m_StateReuse;
00225     String_256 m_BarName;
00226     INT32 m_Spacing;
00227     BOOL m_FromSelection;
00228     BOOL m_WantBackBar;
00229     BYTE m_ExtendFlags;
00230     BOOL m_DelExistingState;
00231 };
00232 
00233 
00234 
00235 /********************************************************************************************
00236 >   struct BarDataType
00237 
00238     Author:     Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
00239     Created:    23/3/00
00240     Purpose:    Attributes of bars.
00241     SeeAlso:    NodeBarProperty
00242 ********************************************************************************************/
00243 
00244 struct BarDataType
00245 {
00246 
00247     BYTE SameSize;
00248     unsigned IsLive          : 1;
00249     unsigned IsHorizontal    : 1;
00250     unsigned RequiresShuffle : 1;
00251     unsigned ButtonsExtend   : 1;
00252     unsigned ButtonsScale    : 1;
00253     unsigned GroupsStretch   : 1;
00254     INT32 Spacing;
00255 
00256     BarDataType()
00257       : SameSize(0), IsLive(1), IsHorizontal(1), RequiresShuffle(1),
00258         ButtonsExtend(1), ButtonsScale(0), GroupsStretch(1), Spacing(0)
00259             { }
00260 };
00261 
00262 
00263 // Accesses 'current' document's array of BarDataTypes.
00264 NodeBarProperty* GetBarData();
00265 
00266 #endif // have defined this class before

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