00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101 #ifndef INC_PREVIEWDLG
00102 #define INC_PREVIEWDLG
00103
00104
00105
00106
00107
00108 #include "ktimer.h"
00109
00110 #include "frameops.h"
00111
00112 class KernelBitmap;
00113 class RenderRegion;
00114 class DialogColourInfo;
00115
00116
00117
00118
00119
00120
00121
00122
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
00147
00148
00149
00150
00151
00152
00153
00154
00155 #define OPTOKEN_PREVIEWDIALOG _T("PreviewDialog")
00156
00157 class PreviewDialog : public DialogOp
00158 {
00159
00160 CC_DECLARE_DYNCREATE(PreviewDialog);
00161
00162 public:
00163
00164 PreviewDialog();
00165 ~PreviewDialog();
00166
00167 static BOOL Init();
00168
00169
00170 virtual void DoWithParam(OpDescriptor* pOpDesc,OpParam* pParam);
00171 virtual MsgResult Message(Msg* Message);
00172
00173 virtual BOOL OnIdleEvent(void);
00174 void UpdateBubbleHelp(void);
00175
00176 static BOOL GetStatusLineText(String_256 *Result);
00177
00178
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
00187 static PreviewDialog* GetPreviewDialog() { return m_pPreviewDialog; }
00188
00189
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
00206 void RestartTimer();
00207
00208
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
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
00237 static const UINT32 IDD;
00238 static const CDlgMode Mode;
00239
00240 protected:
00241
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
00269 List m_BitmapList;
00270 INT32 m_BitmapListSize;
00271
00272
00273 INT32 m_CurrentItem;
00274
00275
00276 RenderRegion * m_pRender;
00277
00278 INT32 m_SliderPosition;
00279 BOOL m_PlayAnimation;
00280 BOOL m_DisplayNextFrame;
00281 BOOL m_DisplayPreviousFrame;
00282 BOOL m_DocumentAboutToDie;
00283 BOOL m_SetPreviewDlgToIdleState;
00284 BOOL m_GeneratedFrameLayers;
00285
00286 GIFDisposalMethod m_DisposalMethod;
00287 GIFDisposalMethod m_CurrentDisposalMethod;
00288
00289 DocRect m_AnimationRect;
00290
00291 INT32 m_CurrentLoopCount;
00292 INT32 m_RequiredLoopCount;
00293
00294 static BOOL viaBitmapGallery;
00295
00296 protected:
00297
00298
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;
00314 static PreviewDialog* m_pPreviewDialog;
00315 };
00316
00317 #endif // INC_PREVIEWDLG