bmpexprw.h

Go to the documentation of this file.
00001 // $Id: bmpexprw.h 1482 2006-07-20 10:23:23Z luke $
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 dialog box for previwing bitmaps
00100 
00101 #ifndef INC_EXPORTPREVIEWDLG
00102 #define INC_EXPORTPREVIEWDLG
00103 
00104 // Find out about the DialogOp Class
00105 //#include "dialogop.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00106 #include "bmpprefs.h"
00107 //#include "monotime.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00108 #include "bblwnd.h"
00109 #include "grndrgn.h"
00110 #include "cbmpdata.h"
00111 
00112 class KernelBitmap;
00113 class RenderRegion;
00114 class BaseBitmapFilter;
00115 class BitmapExportOptions;
00116 
00117 // view tool types
00118 typedef enum {PREVIEW_ZOOM_TOOL, PREVIEW_PUSH_TOOL, PREVIEW_OTHER_TOOL, PREVIEW_COLOUR_SELECTOR_TOOL} PreviewTool;
00119 
00120 
00121 /********************************************************************************************
00122 
00123 >   class BitmapExportPreviewDialog : public DialogOp
00124 
00125     Author:     Stefan_Stoykov (Xara Group Ltd) <camelotdev@xara.com> (based on Neville's code)
00126     Created:    11/4/97
00127     Purpose:    A dialog box for previewing bitmaps
00128 
00129 ********************************************************************************************/
00130 
00131 #define OPTOKEN_BITMAPPREVIEWDIALOG _T("BitmapExportPreviewDialog")
00132 
00133 class BitmapExportPreviewDialog : public DialogOp
00134 {
00135     // Give my name in memory dumps
00136     CC_DECLARE_DYNCREATE(BitmapExportPreviewDialog);
00137 
00138 public:
00139     // Construction etc
00140     BitmapExportPreviewDialog(CWindowID ParentWnd = NULL);
00141     ~BitmapExportPreviewDialog();
00142 
00143     // allows changing one of the preview bitmaps
00144     BOOL DoWithExportOptions(BitmapExportOptions *pExportOptions, UINT32 Num);
00145 
00146     // Called when the dialog is to be displayed
00147     void InitPreviewDialog(BmapPrevDlg *pParentDlg, Filter *pFilter);
00148 
00149     // allows obtaining and changing the currently selected bitmap
00150     UINT32 GetActiveBitmap() { return m_ActiveBitmap;}
00151     void ChangeActiveBitmap(UINT32 Active);
00152 
00153     const KernelBitmap * GetActiveKernelBmp() { return BitmapData[m_ActiveBitmap].m_pBitmap; }
00154 
00155 
00156     // allows the context menu to obtain the current tool
00157     PreviewTool GetCurrentTool() { return m_CurrentTool;};
00158 
00159     // for browser preview
00160     BOOL DoBrowserPreview(BrowserPreviewOptions BrowserOptions);
00161 
00162     BOOL OnExport(BitmapExportOptions * pExportOptions);
00163 
00164     // for the message handling
00165     virtual MsgResult Message(Msg* Message);
00166 
00167     // handles the context menu commands
00168     virtual void DoCommand(StringBase *CommandID);
00169 
00170     void InitialiseBitmapPaletteInformation( BitmapExportOptions* pExportOptions, INT32 Num = 0 );
00171 
00172     void SetFilter( Filter* pFilter )   { m_pBmpFilter = ( BaseBitmapFilter* )pFilter; }
00173 
00174     void SetNeedBitmapCopied( BOOL State ) { m_bNeedBitmapCopied[ m_ActiveBitmap - 1 ] = State; }
00175 
00176     // Static functions
00177     // Find out about the state of the dlg
00178     static  OpState GetState(String_256*, OpDescriptor*);
00179     static  BOOL Init();
00180 
00181     // Static Vars
00182     static const UINT32 IDD;
00183     static const CDlgMode Mode;
00184 
00185 protected:
00186     // render control redraw function
00187     void RenderControl(ReDrawInfoType* pExtraInfo, UINT32 GadgetID);
00188 
00189     // Useful set up functions
00190     BOOL InitDialog();
00191     BOOL SetUpCallBack();
00192 
00193     // pushing
00194     void DoPush(DocCoord *NewPos);
00195 
00196     // zooming
00197     void CalcViewRect(double NewZoomFactor, DocCoord *Pos);
00198     void DoZoom(DocCoord *NewPos);
00199     double FindNearestZoom(BOOL Up);
00200     void DrawZoomRect();
00201     void ZoomToRect();
00202     void DisplayZoomFactor();
00203 
00204     // cursor display
00205     void SetCurrentCursor(UINT32 id);
00206     void DeleteCurrentCursor();
00207 
00208     void DisplayBitmapInfo();
00209 
00210     // bubble and status line text
00211     void ResetInfo(UINT32 id);
00212     void DoBubbleHelp();
00213 
00214     // handle menu or button selected commands
00215     void OnZoomTool();
00216     void OnPushTool();
00217     void On1to1();
00218     void On100Percent();
00219     void OnColourSelectorTool();
00220 
00221     INT32 GetPaletteIndexOfColour( ReDrawInfoType* param, CGadgetID Gadget );
00222 
00223     void InitFileTypeList();
00224     void HandleFileTypeListChange( INT32 Index );
00225 
00226     // static pointr to this dialog
00227     static BitmapExportPreviewDialog * m_pBitmapExportPreviewDialog;
00228     
00229     // The render region that we are using for redraws
00230     GRenderRegion * m_pRender;
00231 
00232     // bitmap data for the two preview bitmaps
00233     BitmapPreviewData BitmapData[2]; // this stores the ptr to BitmapExportOptions
00234 
00235     KernelBitmap* pOriginalBitmap[2];
00236 
00237     BaseBitmapFilter *m_pBmpFilter; // pointer to the bitmap export filter
00238     BmapPrevDlg *m_pParentDlg;
00239 
00240     // keep the width and height for the first bitmap only
00241     MILLIPOINT m_Width;
00242     MILLIPOINT m_Height;
00243     double m_Scaling; // required to calculate the width and height for the second bitmap
00244     
00245     // display data
00246     DocRect m_BitmapView; // the current view rectangle
00247     double m_ZoomFactor;  //the current zoom factor
00248 
00249     UINT32 m_ActiveBitmap; // 1 or 2 - indicates that the first or the second bitmap is selected
00250     DocCoord m_CurrentPos; // the endos of the zoom rect (changes as the mouse pointer is dragged)
00251     DocCoord m_StartPos; // the start pos of the zoom rectangle (doesn't change during the operation)
00252     PreviewTool m_CurrentTool; // zoom or push tool
00253     BOOL m_Dragging; // are we in drag mode?
00254     BOOL m_ZoomRectRender; // whether we are to render the zoom rectangle in the redraw() function
00255     INT32 m_CurID; // the id of the last set cursor
00256 //  BubbleHelpWnd *m_pBubbleWnd; // the bubble help window
00257     UINT32 m_LastCursorOverControlID; //the id of the last control, the cursor was over
00258     MonotonicTime BubbleTimer; // the timer for the bubble help
00259     BOOL m_BubbleHelpPending; // is it waiting for the timer to signal displaying of bubble help
00260     BOOL m_StatusTextChanged; // there is a need to update the status line
00261     BOOL m_LastAdjustState; //1 - Adjust pressed, 0 - Adjust not pressed
00262     BOOL m_MouseOperationStarted;  //the mouse button was pressed (but not released yet)
00263     CWindowID m_PreviousWithFocus;
00264     //ExportFileType m_CurrentFileType[2];  //  The current file types selected
00265     BOOL m_bWantCursorRedrawn;
00266     BOOL m_bNeedBitmapCopied[2];
00267     INT32 m_TopLevelCursor; // The first cursor the dialog puts on the cursor stack
00268 };
00269 
00270 
00271 
00272 #endif  // INC_EXPORTPREVIEWDLG
00273 
00274 

Generated on Sat Nov 10 03:44:28 2007 for Camelot by  doxygen 1.4.4