00001 // $Id: opnudge.h 751 2006-03-31 15:43:49Z alex $ 00002 // $Header: /Camelot/kernel/opnudge.h 2 28/07/00 11:51 Simonk $Descriptor 00003 // Definition of the op nudge classes 00004 /* @@tag:xara-cn@@ DO NOT MODIFY THIS LINE 00005 ================================XARAHEADERSTART=========================== 00006 00007 Xara LX, a vector drawing and manipulation program. 00008 Copyright (C) 1993-2006 Xara Group Ltd. 00009 Copyright on certain contributions may be held in joint with their 00010 respective authors. See AUTHORS file for details. 00011 00012 LICENSE TO USE AND MODIFY SOFTWARE 00013 ---------------------------------- 00014 00015 This file is part of Xara LX. 00016 00017 Xara LX is free software; you can redistribute it and/or modify it 00018 under the terms of the GNU General Public License version 2 as published 00019 by the Free Software Foundation. 00020 00021 Xara LX and its component source files are distributed in the hope 00022 that it will be useful, but WITHOUT ANY WARRANTY; without even the 00023 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00024 See the GNU General Public License for more details. 00025 00026 You should have received a copy of the GNU General Public License along 00027 with Xara LX (see the file GPL in the root directory of the 00028 distribution); if not, write to the Free Software Foundation, Inc., 51 00029 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00030 00031 00032 ADDITIONAL RIGHTS 00033 ----------------- 00034 00035 Conditional upon your continuing compliance with the GNU General Public 00036 License described above, Xara Group Ltd grants to you certain additional 00037 rights. 00038 00039 The additional rights are to use, modify, and distribute the software 00040 together with the wxWidgets library, the wxXtra library, and the "CDraw" 00041 library and any other such library that any version of Xara LX relased 00042 by Xara Group Ltd requires in order to compile and execute, including 00043 the static linking of that library to XaraLX. In the case of the 00044 "CDraw" library, you may satisfy obligation under the GNU General Public 00045 License to provide source code by providing a binary copy of the library 00046 concerned and a copy of the license accompanying it. 00047 00048 Nothing in this section restricts any of the rights you have under 00049 the GNU General Public License. 00050 00051 00052 SCOPE OF LICENSE 00053 ---------------- 00054 00055 This license applies to this program (XaraLX) and its constituent source 00056 files only, and does not necessarily apply to other Xara products which may 00057 in part share the same code base, and are subject to their own licensing 00058 terms. 00059 00060 This license does not apply to files in the wxXtra directory, which 00061 are built into a separate library, and are subject to the wxWindows 00062 license contained within that directory in the file "WXXTRA-LICENSE". 00063 00064 This license does not apply to the binary libraries (if any) within 00065 the "libs" directory, which are subject to a separate license contained 00066 within that directory in the file "LIBS-LICENSE". 00067 00068 00069 ARRANGEMENTS FOR CONTRIBUTION OF MODIFICATIONS 00070 ---------------------------------------------- 00071 00072 Subject to the terms of the GNU Public License (see above), you are 00073 free to do whatever you like with your modifications. However, you may 00074 (at your option) wish contribute them to Xara's source tree. You can 00075 find details of how to do this at: 00076 http://www.xaraxtreme.org/developers/ 00077 00078 Prior to contributing your modifications, you will need to complete our 00079 contributor agreement. This can be found at: 00080 http://www.xaraxtreme.org/developers/contribute/ 00081 00082 Please note that Xara will not accept modifications which modify any of 00083 the text between the start and end of this header (marked 00084 XARAHEADERSTART and XARAHEADEREND). 00085 00086 00087 MARKS 00088 ----- 00089 00090 Xara, Xara LX, Xara X, Xara X/Xtreme, Xara Xtreme, the Xtreme and Xara 00091 designs are registered or unregistered trademarks, design-marks, and/or 00092 service marks of Xara Group Ltd. All rights in these marks are reserved. 00093 00094 00095 Xara Group Ltd, Gaddesden Place, Hemel Hempstead, HP2 6EX, UK. 00096 http://www.xara.com/ 00097 00098 =================================XARAHEADEREND============================ 00099 */ 00100 00101 #ifndef INC_OPNUDGE 00102 #define INC_OPNUDGE 00103 #include "tranlate.h" 00104 00105 #define OPTOKEN_NUDGE _T("Nudge") 00106 00107 /******************************************************************************************** 00108 00109 > class OpNudge : public CCObject 00110 00111 Author: Mark_Neves (Xara Group Ltd) <camelotdev@xara.com> 00112 Created: 7/9/94 00113 Purpose: The underlying nudge op that does a nudge on the selection. 00114 Note: Mark initially implemented the twelve different types of nudge as 00115 twelve seperate ops. Simon changed this (07/11/94) so that it now 00116 uses only one operation, but has 12 OpDescriptors all of which map 00117 to the same operation. We determine the type of nudge we are after 00118 from the runtime class of the OpDescriptor in the Do function. 00119 00120 ********************************************************************************************/ 00121 00122 class OpNudge : public OpTranslateTrans 00123 { 00124 CC_DECLARE_DYNCREATE(OpNudge); 00125 00126 public: 00127 static BOOL Init(); 00128 static OpState GetState(String_256*, OpDescriptor*); 00129 00130 // Nudge step is the setting people will see in the set up dialogue, etc 00131 // i.e. it is the underlying nudge step distance 00132 static void SetNudgeStep(MILLIPOINT Step) { NudgeStep = Step; } 00133 static MILLIPOINT GetNudgeStep() { return NudgeStep; } 00134 00135 // The actual nudge displacement is the one that takes into account the nudge factor, which 00136 // provides the magnitude and direction. 00137 // Use these functions to get the X and Y nudge displacements to apply 00138 00139 //changed from MILLIPOINT to double, to allow 1/5 nudge option 00140 double GetXNudgeDisplacement() { return NudgeStep * X_NudgeFactor; } 00141 double GetYNudgeDisplacement() { return NudgeStep * Y_NudgeFactor; } 00142 double GetXPixelDisplacement() { return PixelNudge * X_NudgeFactor;} 00143 double GetYPixelDisplacement() { return PixelNudge * Y_NudgeFactor;} 00144 00145 // Do() will nudge each selected object by GetXNudgeDisplacement() in the x direction 00146 // and GetYNudgeDisplacement in the y direction 00147 virtual void Do(OpDescriptor* pOpDesc); 00148 00149 // Overide GetOpName() so the correct string appears in the undo/redo menu item strings 00150 void GetOpName(String_256* OpName); 00151 00152 // Used to merge sequences of nudge operations 00153 virtual void PerformMergeProcessing() ; 00154 00155 // Will the nudge send the selection out of bounds 00156 BOOL IsNudgeOK(BOOL dx,BOOL dy); 00157 00158 void ScrollToShow(DocCoord Coord); 00159 00160 BOOL DoesActionListHideNodes(Operation * pOp); 00161 00162 protected: 00163 double X_NudgeFactor; // displacement nudged in x dir = NudgeStep * X_NudgeFactor; 00164 double Y_NudgeFactor; // displacement nudged in y dir = NudgeStep * Y_NudgeFactor; 00165 00166 private: 00167 static MILLIPOINT NudgeStep; // The size of a single nudge (must be a +ve value) 00168 double PixelNudge; // The size of a single nudge. 00169 BOOL flag; //Flag to determine whether to nudge in MM or pixels. 00170 }; 00171 00172 // Define all the op tokens 00173 00174 #define OPTOKEN_NUDGEUP1 _T("NudgeUp1") 00175 #define OPTOKEN_NUDGEUP5 _T("NudgeUp5") 00176 #define OPTOKEN_NUDGEUP10 _T("NudgeUp10") 00177 #define OPTOKEN_NUDGEUPFIFTH _T("NudgeUpFifth") 00178 #define OPTOKEN_NUDGEUPPIXEL1 _T("NudgeUpPixel1") 00179 #define OPTOKEN_NUDGEUPPIXEL10 _T("NudgeUpPixel10") 00180 00181 #define OPTOKEN_NUDGEDOWN1 _T("NudgeDown1") 00182 #define OPTOKEN_NUDGEDOWN5 _T("NudgeDown5") 00183 #define OPTOKEN_NUDGEDOWN10 _T("NudgeDown10") 00184 #define OPTOKEN_NUDGEDOWNFIFTH _T("NudgeDownFifth") 00185 #define OPTOKEN_NUDGEDOWNPIXEL1 _T("NudgeDownPixel1") 00186 #define OPTOKEN_NUDGEDOWNPIXEL10 _T("NudgeDownPixel10") 00187 00188 #define OPTOKEN_NUDGELEFT1 _T("NudgeLeft1") 00189 #define OPTOKEN_NUDGELEFT5 _T("NudgeLeft5") 00190 #define OPTOKEN_NUDGELEFT10 _T("NudgeLeft10") 00191 #define OPTOKEN_NUDGELEFTFIFTH _T("NudgeLeftFifth") 00192 #define OPTOKEN_NUDGELEFTPIXEL1 _T("NudgeLeftPixel1") 00193 #define OPTOKEN_NUDGELEFTPIXEL10 _T("NudgeLeftPixel10") 00194 00195 #define OPTOKEN_NUDGERIGHT1 _T("NudgeRight1") 00196 #define OPTOKEN_NUDGERIGHT5 _T("NudgeRight5") 00197 #define OPTOKEN_NUDGERIGHT10 _T("NudgeRight10") 00198 #define OPTOKEN_NUDGERIGHTFIFTH _T("NudgeRightFifth") 00199 #define OPTOKEN_NUDGERIGHTPIXEL1 _T("NudgeRightPixel1") 00200 #define OPTOKEN_NUDGERIGHTPIXEL10 _T("NudgeRightPixel10") 00201 00202 #endif // INC_OPNUDGE 00203 00204