prevwdlg.h

Go to the documentation of this file.
00001 // $Id: prevwdlg.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 
00099 // A preview dialog box for previwing items like animated GIFs
00100 
00101 #ifndef INC_PREVIEWDLG
00102 #define INC_PREVIEWDLG
00103 
00104 // Find out about the DialogOp Class
00105 //#include "dialogop.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00106 //#include "list.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00107 //#include "listitem.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00108 #include "ktimer.h"
00109 //#include "impexpop.h"
00110 #include "frameops.h"
00111 
00112 class KernelBitmap;
00113 class RenderRegion;
00114 class DialogColourInfo;
00115 
00116 /********************************************************************************************
00117 
00118 >   class AnimatedBitmapItem : public ListItem
00119 
00120     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
00121     Created:    11/4/97
00122     Purpose:    Saves out the list of bitmaps currently in the animation sequence.
00123     
00124 ********************************************************************************************/
00125 
00126 class AnimatedBitmapItem : public ListItem
00127 {
00128     CC_DECLARE_DYNCREATE( AnimatedBitmapItem )
00129 
00130 public:
00131     AnimatedBitmapItem();
00132     ~AnimatedBitmapItem();
00133 
00134     AnimatedBitmapItem(KernelBitmap * pEntry, Layer * pLayer = NULL);
00135 
00136     KernelBitmap * GetBitmap() { return m_pBitmap; }
00137     Layer * GetLayer() { return m_pLayer; }
00138 
00139 protected:
00140     KernelBitmap * m_pBitmap;
00141     Layer * m_pLayer;
00142 };
00143 
00144 /********************************************************************************************
00145 
00146 >   class PreviewDialog : public DialogOp
00147 
00148     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
00149     Created:    11/4/97
00150     Purpose:    A preview dialog box for previwing items like animated GIFs
00151     SeeAlso:    PreviewDialog
00152 
00153 ********************************************************************************************/
00154 
00155 #define OPTOKEN_PREVIEWDIALOG _T("PreviewDialog")
00156 
00157 class PreviewDialog : public DialogOp
00158 {
00159     // Give my name in memory dumps
00160     CC_DECLARE_DYNCREATE(PreviewDialog);
00161 
00162 public:
00163     // Construction etc
00164     PreviewDialog();
00165     ~PreviewDialog();
00166 
00167     static  BOOL Init();
00168 
00169     // Called when the dialog is to be displayed
00170     virtual void DoWithParam(OpDescriptor* pOpDesc,OpParam* pParam);
00171     virtual MsgResult Message(Msg* Message);
00172 
00173     virtual BOOL OnIdleEvent(void);     // Overriden idle event processing method.
00174     void    UpdateBubbleHelp(void);     // Get Bubble help for the current pointer position.    
00175 
00176     static  BOOL GetStatusLineText(String_256 *Result); // Get status line help text for the current pointer position.
00177             
00178     // Find out about the state of the dlg
00179     static  OpState         GetState(String_256*, OpDescriptor*);
00180     static  BOOL            GetAnimationPropertiesChanged()                     { return m_AnimationPropertiesChanged; }
00181     static  void            SetAnimationPropertiesChanged(const BOOL Val)       { m_pPreviewDialog->m_AnimationPropertiesChanged = Val; }       
00182             BOOL            SetBitmapList(BitmapExportParam* pParam, BOOL SetSlider = TRUE);
00183             BOOL            SetRegeneratedBitmapInList(GIFAnimationExportParam* pParam);
00184             BOOL            SetBitmapToListTail(GIFAnimationExportParam* pParam);
00185 
00186     // Access to our static preview dialog ptr.
00187     static  PreviewDialog*  GetPreviewDialog()  { return m_pPreviewDialog; }                                                
00188 
00189     // Acess functions.
00190     BOOL    GetPlayAnimation()                  { return m_PlayAnimation;   }
00191     void    SetPlayAnimation(BOOL Value)        { m_PlayAnimation = Value;  } 
00192     INT32       GetBitmapListSize()                 { return  m_BitmapListSize; }
00193     void    SetDlgState(BOOL State)             { m_SetPreviewDlgToIdleState = State;   }       
00194     BOOL    GetDlgState()                       { return m_SetPreviewDlgToIdleState;    }
00195     void    SetDocumentAboutToDie(BOOL Val)     { m_DocumentAboutToDie = Val;           }
00196     void    SetGeneratedFrameLayers(BOOL Val)   { m_GeneratedFrameLayers = Val;         }
00197     BOOL    GetGeneratedFrameLayers()           { return m_GeneratedFrameLayers;        }               
00198     void    SetCurrentItem(INT32 Num)               { m_CurrentItem = Num;                  }
00199     INT32       GetCurrentItem()                    { return m_CurrentItem;                 }
00200     INT32       GetSliderPosition()                 { return m_SliderPosition;              }
00201     void    SetSliderPosition(INT32 Position);
00202     void    SelectCurrentBitmap(UINT32 Position);
00203     
00204 public:
00205     // Re-start the timer.
00206     void RestartTimer();
00207 
00208     // Called when the dialog box is already open
00209     BOOL ReInitDialog();
00210 
00211     BOOL StopPreviewing();
00212 
00213     BOOL SetDialogToIdleState();
00214 
00215     BOOL SelectCurrentFrame(const UINT32 Position);
00216 
00217     static void ToggleViaBitmapGallery (BOOL val);
00218 
00219     void SetDelay (UINT32 newDelay) { m_Delay = newDelay; }
00220 
00221 protected:
00222     void RenderControl(ReDrawInfoType* pExtraInfo);
00223 
00224     void GridLockRect(DocRect *TheRect, INT32 GridSize);
00225     inline INT32 HalfGridLock(INT32 Position, INT32 GridSize);
00226 
00227     // Useful set up functions
00228             BOOL    InitDialog();
00229             BOOL    SetUpCallBack();
00230     static  TCHAR*  HelpCallbackHandler(wxWindow * Window, UINT32 Item, void *UserData);
00231     static  BOOL    GetStatusLineText(PreviewDialog *pPrvDlg, UINT32 GadgetID,String_256 *Result);
00232             BOOL    DoRegenerateFrames();
00233             void    SetPreviewDialogToIdleState(ReDrawInfoType* pExtraInfo);
00234     
00235 public:
00236     // Static Vars
00237     static const UINT32 IDD;
00238     static const CDlgMode Mode;
00239 
00240 protected:
00241     // Useful helper functions
00242     KernelBitmap * GetBitmapItem(INT32 Index);
00243     KernelBitmap * GetCurrentBitmap(BOOL GetDetails = TRUE);
00244     
00245     Layer * GetLayerItem(INT32 Index);
00246     Layer * GetCurrentLayer();
00247 
00248     void    IncrementCurrentBitmap();
00249     void    DecrementCurrentBitmap();
00250     UINT32  GetDelayForCurrentBitmap();
00251     void    SelectFirstBitmap();
00252     void    SelectLastBitmap();
00253     BOOL    SetDlgStateAfterDocChange();
00254     BOOL    SetDlgStateAfterRefresh();
00255     void    PreviewDlgPlay();
00256     void    PreviewDlgStop();
00257     void    PreviewNextFrame();
00258     void    PreviewPreviousFrame();
00259     void    SetSliderPosition();
00260 
00261     BOOL    ResizeDialogToFitAnimation();
00262 
00263     BOOL    RedrawBitmap(KernelBitmap * pBitmapToUse, DocRect * pVirtualSize);
00264     BOOL    RedrawCross(DocRect * pVirtualSize, DialogColourInfo * pRedrawColours,
00265                         INT32 PixelSize);
00266     
00267 protected:
00268     // The list of bitmaps that we need to animate
00269     List m_BitmapList;
00270     INT32 m_BitmapListSize;
00271 
00272     // The number of the current bitmap that we are displaying
00273     INT32 m_CurrentItem;
00274     
00275     // The render region that we are using for redraws
00276     RenderRegion * m_pRender;
00277 
00278     INT32    m_SliderPosition;              // The position on the slider.  
00279     BOOL m_PlayAnimation;               // Should the animation be played?
00280     BOOL m_DisplayNextFrame;            // Should we display the next frame?
00281     BOOL m_DisplayPreviousFrame;        // Should we display the prvious frame?
00282     BOOL m_DocumentAboutToDie;          // Is the document about to be closed.          
00283     BOOL m_SetPreviewDlgToIdleState;    // If the document has changed, then set the dlg to its idle state.
00284     BOOL m_GeneratedFrameLayers;        // Have the gif animation frame layers been generated.
00285 
00286     GIFDisposalMethod m_DisposalMethod; // The GIF disposal method for the previous frame
00287     GIFDisposalMethod m_CurrentDisposalMethod;  // The GIF disposal method for the current frame
00288 
00289     DocRect m_AnimationRect;            // Bounding box of the animation
00290 
00291     INT32 m_CurrentLoopCount;               // The loop that we are currently on
00292     INT32 m_RequiredLoopCount;          // The loop count that we must reach
00293 
00294     static BOOL viaBitmapGallery;
00295 
00296 protected:
00297     // the call back statics that we require
00298 //  static BOOL TimerProc(HiResTimer* pTimer, INT32 nElapsed, void* pvData);
00299 
00300     void OnTimer();
00301 
00302     class PreviewTimer : public KernelTimer
00303     {
00304     public:
00305         PreviewTimer(PreviewDialog * pOwner) : m_pOwner(pOwner) {}
00306         virtual void Notify() {m_pOwner->OnTimer();}
00307         PreviewDialog * m_pOwner;
00308     };
00309     PreviewTimer m_Timer;
00310 
00311 
00312     static UINT32 m_Delay; 
00313     static BOOL m_AnimationPropertiesChanged;   // While the dialog is open, has the user changed any properties?
00314     static PreviewDialog* m_pPreviewDialog;
00315 };
00316 
00317 #endif  // INC_PREVIEWDLG

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