statline.h

Go to the documentation of this file.
00001 // $Id: statline.h 1282 2006-06-09 09:46: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 // Header file for status line class
00099 
00100 #ifndef INC_STATUSLINE
00101 #define INC_STATUSLINE
00102 
00103 //#include "pump.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00104 //#include "flags.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00105 #include "camframe.h"
00106 //#include "monotime.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00107 #include "stdbars.h"
00108 //#include "ed.h"
00109 #include "ktimer.h"
00110 
00111 class Spread;
00112 class StringBase;
00113 class Cursor;
00114 
00115 #define STATUSLINE_SELDESC_DEFAULT      1   // over dialogs, outside app window
00116 #define STATUSLINE_SELDESC_BARDRAG      0
00117 #define STATUSLINE_SELDESC_OTHERDOC     0
00118 #define STATUSLINE_SELDESC_DRAGOPS      1
00119 #define STATUSLINE_SELDESC_SELDOC       1
00120 #define STATUSLINE_SELDESC_COLBAR       1
00121 #define STATUSLINE_SELDESC_STATBAR      1
00122 #define STATUSLINE_SELDESC_BUTTONS      1
00123 #define STATUSLINE_SELDESC_MENUS        1
00124 #define STATUSLINE_SELDESC_PREVIEWDLG   1
00125 
00126 enum RenderState { Rendering,Paused,NotRendering,Animate };
00127 
00128 
00129 /****************************************************************************************
00130 >   class StatusLine : public MessageHandler
00131 
00132     Author:     Ed_Cornes (Xara Group Ltd) <camelotdev@xara.com>
00133     Created:    15/11/94
00134     Purpose:    Encapsulate the status line
00135 ********************************************************************************************/
00136 
00137 class StatusLine : public StandardBar
00138 {
00139 public:
00140     StatusLine();
00141     ~StatusLine();
00142 
00143     MsgResult Message(Msg* Msg);
00144     BOOL UpdateText(String_256* ptext, BOOL PrefixSelDesc=TRUE);
00145     BOOL UpdateTextForColourPicker(String_256* ptext, BOOL PrefixSelDesc=TRUE);
00146     BOOL UpdateMousePosAndSnap(DocCoord* pDocCoord, Spread* pSpread, DocView* pDocView, BOOL Snapped);
00147     BOOL UpdateSolidDragIndicator(BOOL bSolidAllowed, BOOL bSolid);
00148     BOOL SetRenderIndicator(RenderState Action);
00149     void FlagMousePosNeedsUpdating() { MousePosNeedsUpdatingFlag=TRUE; };
00150     BOOL MousePosNeedsUpdating() { return MousePosNeedsUpdatingFlag; };
00151     
00152     void FlagMousePosPaneNeedsUpdating() {MousePosPaneNeedsResizing=TRUE;};
00153 
00154     // This can be used to override the default behaviour of showing the selection state
00155     // as a prefix to the status-line.
00156     static void SetPrefix(const StringBase& str);
00157     static void SetDefaultPrefix();
00158     static INT32  GetPrefixWidth();
00159 
00160     // colour picker custom control interface functions ....
00161 
00162     BOOL RestrictStatusLineFunctionsToColourPicker (CWindowID colourPicker);
00163     BOOL RestoreStatusLineFunctions (CWindowID colourPicker);
00164     BOOL IsRestrictedAccessToColourPicker () { return restrictStatusLineFunctionsToColourPicker; }
00165 
00166     BOOL LockOutControlHelp () { DoControlHelp = FALSE; return (TRUE); }
00167     BOOL UnlockControlHelp () { DoControlHelp = TRUE; return (TRUE); }
00168     BOOL AllowControlHelp () { return (DoControlHelp); }
00169 
00170     void SetNeedsUpdate(BOOL Immediate=FALSE);
00171 
00172 protected:
00173     BOOL OnIdleEvent();
00174 
00175     BOOL SetMousePosPaneWidth(Spread* pSpread);
00176     BOOL RefreshHelpText();
00177     BOOL GetMousePosText(String_256* pText, DocCoord MousePos, Spread* pSread, INT32 dp=-1);
00178     BOOL TruncateTextToWidth(String_256* pText, INT32 width);
00179 
00180     Cursor* pSnappedCursor;
00181     INT32 SnappedCursorID;
00182 
00183 protected:
00184 
00185     MonotonicTime TextTimer;
00186     MonotonicTime RenderTimer;
00187     BOOL MousePosPaneNeedsResizing;
00188     BOOL MousePosNeedsUpdatingFlag;
00189 //  BOOL TransparencyNeedsUpdating;
00190     INT32  RenderAnimationState;
00191     INT32  MousePosDP;
00192     INT32 OldMemory;
00193 
00194 private:
00195 
00196     // The prefix to display in the status-line - if empty, show the selection state.
00197     static String_256 m_strPrefix;
00198 
00199     static BOOL restrictStatusLineFunctionsToColourPicker;
00200     static BOOL DoControlHelp;                              // whether controls are allowed
00201                                                             // to display help text (or not)
00202     static StatusLine * s_pStatusLine;
00203 
00204 public:
00205     static StatusLine * Get() {return s_pStatusLine;}
00206 
00207 // Progress related functions
00208 public:
00209     BOOL ShowProgress (BOOL Show=TRUE, StringBase *JobDescrip = NULL);
00210 
00211     INT32 GetPercent() const {return CurrentPercent;}
00212     BOOL SetPercent(INT32 Percent, BOOL RedrawBackground = FALSE, StringBase *JobDescrip = NULL);
00213 
00214     BOOL IsProgressShown() const {return ProgressShown;}
00215 
00216 protected:
00217     INT32 CurrentPercent;           // The currently displayed percentage value
00218     String_256 *JobDescription; // NULL, or pointer to description of current job
00219     BOOL ProgressShown;
00220     String_256 StatusText;
00221     BOOL SetStatusText(const String_256 &text);
00222     String_256 m_MousePosText;
00223 
00224     void OnTimer()
00225     {
00226         GetApplication()->NeedMoreIdles();
00227     }
00228 
00229     class StatusTimer : public KernelTimer
00230     {
00231     public:
00232         StatusTimer(StatusLine * pOwner) : m_pOwner(pOwner) {}
00233         virtual void Notify() {m_pOwner->OnTimer();}
00234         StatusLine * m_pOwner;
00235     };
00236 
00237     StatusTimer m_Timer;
00238 
00239     CC_DECLARE_DYNCREATE(StatusLine);
00240 };
00241 
00242 #endif  // INC_STATUSLINE

Generated on Sat Nov 10 03:47:04 2007 for Camelot by  doxygen 1.4.4