Many changes to the printing classes.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1981 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -57,6 +57,7 @@ in an application.
|
||||
\twocolitem{\helpref{wxFontDialog}{wxfontdialog}}{Font chooser dialog}
|
||||
\twocolitem{\helpref{wxPageSetupDialog}{wxpagesetupdialog}}{Standard page setup dialog}
|
||||
\twocolitem{\helpref{wxPrintDialog}{wxprintdialog}}{Standard print dialog}
|
||||
\twocolitem{\helpref{wxPageSetupDialog}{wxpagesetupdialog}}{Standard page setup dialog}
|
||||
\twocolitem{\helpref{wxMessageDialog}{wxmessagedialog}}{Simple message box dialog}
|
||||
\end{twocollist}
|
||||
|
||||
@@ -308,12 +309,15 @@ facilities.
|
||||
\twocolitem{\helpref{wxPreviewFrame}{wxpreviewframe}}{Frame for displaying a print preview}
|
||||
\twocolitem{\helpref{wxPreviewCanvas}{wxpreviewcanvas}}{Canvas for displaying a print preview}
|
||||
\twocolitem{\helpref{wxPreviewControlBar}{wxpreviewcontrolbar}}{Standard control bar for a print preview}
|
||||
\twocolitem{\helpref{wxPrintData}{wxprintdata}}{Represents information about the document being printed}
|
||||
\twocolitem{\helpref{wxPrintDialog}{wxprintdialog}}{Standard print dialog}
|
||||
\twocolitem{\helpref{wxPageSetupDialog}{wxpagesetupdialog}}{Standard page setup dialog}
|
||||
\twocolitem{\helpref{wxPrinter}{wxprinter}}{Class representing the printer}
|
||||
\twocolitem{\helpref{wxPrinterDC}{wxprinterdc}}{Printer device context}
|
||||
\twocolitem{\helpref{wxPrintout}{wxprintout}}{Class representing a particular printout}
|
||||
\twocolitem{\helpref{wxPrintPreview}{wxprintpreview}}{Class representing a print preview}
|
||||
\twocolitem{\helpref{wxPrintData}{wxprintdata}}{Represents information about the document being printed}
|
||||
\twocolitem{\helpref{wxPrintDialogData}{wxprintdialogdata}}{Represents information about the print dialog}
|
||||
\twocolitem{\helpref{wxPageSetupDialogData}{wxpagesetupdialogdata}}{Represents information about the page setup dialog}
|
||||
\end{twocollist}
|
||||
|
||||
{\large {\bf Database classes}}
|
||||
|
@@ -1,7 +1,10 @@
|
||||
\section{\class{wxPageSetupData}}\label{wxpagesetupdata}
|
||||
\section{\class{wxPageSetupDialogData}}\label{wxpagesetupdialogdata}
|
||||
|
||||
This class holds a variety of information related to \helpref{wxPageSetupDialog}{wxpagesetupdialog}.
|
||||
|
||||
It contains a \helpref{wxPrintData}{wxprintdata} member which is used to hold basic printer configuration data (as opposed to the
|
||||
user-interface configuration settings stored by wxPageSetupDialogData).
|
||||
|
||||
\wxheading{Derived from}
|
||||
|
||||
\helpref{wxObject}{wxobject}
|
||||
@@ -16,177 +19,212 @@ This class holds a variety of information related to \helpref{wxPageSetupDialog}
|
||||
|
||||
\latexignore{\rtfignore{\wxheading{Members}}}
|
||||
|
||||
\membersection{wxPageSetupData::wxPageSetupData}
|
||||
\membersection{wxPageSetupDialogData::wxPageSetupDialogData}
|
||||
|
||||
\func{}{wxPageSetupData}{\void}
|
||||
\func{}{wxPageSetupDialogData}{\void}
|
||||
|
||||
Constructor.
|
||||
Default constructor.
|
||||
|
||||
\membersection{wxPageSetupData::\destruct{wxPageSetupData}}
|
||||
\func{}{wxPageSetupDialogData}{\param{wxPageSetupDialogData\&}{ data}}
|
||||
|
||||
\func{}{\destruct{wxPageSetupData}}{\void}
|
||||
Copy constructor.
|
||||
|
||||
\func{}{wxPrintDialogData}{\param{wxPrintData\&}{ printData}}
|
||||
|
||||
Construct an object from a print dialog data object.
|
||||
|
||||
\membersection{wxPageSetupDialogData::\destruct{wxPageSetupDialogData}}
|
||||
|
||||
\func{}{\destruct{wxPageSetupDialogData}}{\void}
|
||||
|
||||
Destructor.
|
||||
|
||||
\membersection{wxPageSetupData::EnableHelp}\label{wxpagesetupdataenablehelp}
|
||||
\membersection{wxPageSetupDialogData::EnableHelp}\label{wxpagesetupdialogdataenablehelp}
|
||||
|
||||
\func{void}{EnableHelp}{\param{bool }{flag}}
|
||||
|
||||
Enables or disables the `Help' button (Windows only).
|
||||
|
||||
\membersection{wxPageSetupData::EnableMargins}\label{wxpagesetupdataenablemargins}
|
||||
\membersection{wxPageSetupDialogData::EnableMargins}\label{wxpagesetupdialogdataenablemargins}
|
||||
|
||||
\func{void}{EnableMargins}{\param{bool }{flag}}
|
||||
|
||||
Enables or disables the margin controls (Windows only).
|
||||
|
||||
\membersection{wxPageSetupData::EnableOrientation}\label{wxpagesetupdataenableorientation}
|
||||
\membersection{wxPageSetupDialogData::EnableOrientation}\label{wxpagesetupdialogdataenableorientation}
|
||||
|
||||
\func{void}{EnableOrientation}{\param{bool }{flag}}
|
||||
|
||||
Enables or disables the orientation control (Windows only).
|
||||
|
||||
\membersection{wxPageSetupData::EnablePaper}\label{wxpagesetupdataenablepaper}
|
||||
\membersection{wxPageSetupDialogData::EnablePaper}\label{wxpagesetupdialogdataenablepaper}
|
||||
|
||||
\func{void}{EnablePaper}{\param{bool }{flag}}
|
||||
|
||||
Enables or disables the paper size control (Windows only).
|
||||
|
||||
\membersection{wxPageSetupData::EnablePrinter}\label{wxpagesetupdataenableprinter}
|
||||
\membersection{wxPageSetupDialogData::EnablePrinter}\label{wxpagesetupdialogdataenableprinter}
|
||||
|
||||
\func{void}{EnablePrinter}{\param{bool }{flag}}
|
||||
|
||||
Enables or disables the {\bf Printer} button, which invokes a printer setup dialog.
|
||||
|
||||
\membersection{wxPageSetupData::GetPaperSize}\label{wxpagesetupdatagetpapersize}
|
||||
\membersection{wxPageSetupDialogData::GetDefaultMinMargins}\label{wxpagesetupdialogdatagetdefaultminmargins}
|
||||
|
||||
\func{wxPoint}{GetPaperSize}{\void}
|
||||
|
||||
Returns the paper size in millimetres.
|
||||
|
||||
\membersection{wxPageSetupData::GetMarginTopLeft}\label{wxpagesetupdatagetmargintopleft}
|
||||
|
||||
\func{wxPoint}{GetMarginTopLeft}{\void}
|
||||
|
||||
Returns the left (x) and top (y) margins.
|
||||
|
||||
\membersection{wxPageSetupData::GetMarginBottomRight}\label{wxpagesetupdatagetmarginbottomright}
|
||||
|
||||
\func{wxPoint}{GetMarginBottomRight}{\void}
|
||||
|
||||
Returns the right (x) and bottom (y) margins.
|
||||
|
||||
\membersection{wxPageSetupData::GetMinMarginTopLeft}\label{wxpagesetupdatagetminmargintopleft}
|
||||
|
||||
\func{wxPoint}{GetMinMarginTopLeft}{\void}
|
||||
|
||||
Returns the left (x) and top (y) minimum margins the user can enter (Windows only).
|
||||
|
||||
\membersection{wxPageSetupData::GetMinMarginBottomRight}\label{wxpagesetupdatagetminmarginbottomright}
|
||||
|
||||
\func{wxPoint}{GetMinMarginBottomRight}{\void}
|
||||
|
||||
Returns the right (x) and bottom (y) minimum margins the user can enter (Windows only).
|
||||
|
||||
\membersection{wxPageSetupData::GetOrientation}\label{wxpagesetupdatagetorientation}
|
||||
|
||||
\func{int}{GetOrientation}{\void}
|
||||
|
||||
Returns the orientation, which can be wxPORTRAIT or wxLANDSCAPE.
|
||||
|
||||
\membersection{wxPageSetupData::GetDefaultMinMargins}\label{wxpagesetupdatagetdefaultminmargins}
|
||||
|
||||
\func{bool}{GetDefaultMinMargins}{\void}
|
||||
\constfunc{bool}{GetDefaultMinMargins}{\void}
|
||||
|
||||
Returns TRUE if the page setup dialog will take its minimum margin values from the currently
|
||||
selected printer properties. Windows only.
|
||||
|
||||
\membersection{wxPageSetupData::GetEnableMargins}\label{wxpagesetupdatagetenablemargins}
|
||||
\membersection{wxPageSetupDialogData::GetEnableMargins}\label{wxpagesetupdialogdatagetenablemargins}
|
||||
|
||||
\func{bool}{GetEnableMargins}{\void}
|
||||
\constfunc{bool}{GetEnableMargins}{\void}
|
||||
|
||||
Returns TRUE if the margin controls are enabled (Windows only).
|
||||
|
||||
\membersection{wxPageSetupData::GetEnableOrientation}\label{wxpagesetupdatagetenableorientation}
|
||||
\membersection{wxPageSetupDialogData::GetEnableOrientation}\label{wxpagesetupdialogdatagetenableorientation}
|
||||
|
||||
\func{bool}{GetEnableOrientation}{\void}
|
||||
\constfunc{bool}{GetEnableOrientation}{\void}
|
||||
|
||||
Returns TRUE if the orientation control is enabled (Windows only).
|
||||
|
||||
\membersection{wxPageSetupData::GetEnablePaper}\label{wxpagesetupdatagetenablepaper}
|
||||
\membersection{wxPageSetupDialogData::GetEnablePaper}\label{wxpagesetupdialogdatagetenablepaper}
|
||||
|
||||
\func{bool}{GetEnablePaper}{\void}
|
||||
\constfunc{bool}{GetEnablePaper}{\void}
|
||||
|
||||
Returns TRUE if the paper size control is enabled (Windows only).
|
||||
|
||||
\membersection{wxPageSetupData::GetEnablePrinter}\label{wxpagesetupdatagetenableprinter}
|
||||
\membersection{wxPageSetupDialogData::GetEnablePrinter}\label{wxpagesetupdialogdatagetenableprinter}
|
||||
|
||||
\func{bool}{GetEnablePrinter}{\void}
|
||||
\constfunc{bool}{GetEnablePrinter}{\void}
|
||||
|
||||
Returns TRUE if the printer setup button is enabled.
|
||||
|
||||
\membersection{wxPageSetupData::GetEnableHelp}\label{wxpagesetupdatagetenablehelp}
|
||||
\membersection{wxPageSetupDialogData::GetEnableHelp}\label{wxpagesetupdialogdatagetenablehelp}
|
||||
|
||||
\func{bool}{GetEnableHelp}{\void}
|
||||
\constfunc{bool}{GetEnableHelp}{\void}
|
||||
|
||||
Returns TRUE if the printer setup button is enabled.
|
||||
|
||||
\membersection{wxPageSetupData::GetDefaultInfo}\label{wxpagesetupdatagetdefaultinfo}
|
||||
\membersection{wxPageSetupDialogData::GetDefaultInfo}\label{wxpagesetupdialogdatagetdefaultinfo}
|
||||
|
||||
\func{bool}{GetDefaultInfo}{\void}
|
||||
\constfunc{bool}{GetDefaultInfo}{\void}
|
||||
|
||||
Returns TRUE if the dialog will simply return default printer information (such as orientation)
|
||||
instead of showing a dialog. Windows only.
|
||||
|
||||
\membersection{wxPageSetupData::SetPaperSize}\label{wxpagesetupdatasetpapersize}
|
||||
\membersection{wxPageSetupDialogData::GetMarginTopLeft}\label{wxpagesetupdialogdatagetmargintopleft}
|
||||
|
||||
\func{void}{SetPaperSize}{\param{const wxPoint\& }{size}}
|
||||
\constfunc{wxPoint}{GetMarginTopLeft}{\void}
|
||||
|
||||
Sets the paper size in millimetres.
|
||||
Returns the left (x) and top (y) margins.
|
||||
|
||||
\membersection{wxPageSetupData::SetMarginTopLeft}\label{wxpagesetupdatasetmargintopleft}
|
||||
\membersection{wxPageSetupDialogData::GetMarginBottomRight}\label{wxpagesetupdialogdatagetmarginbottomright}
|
||||
|
||||
\func{void}{GetMarginTopLeft}{\param{const wxPoint\& }{pt}}
|
||||
\constfunc{wxPoint}{GetMarginBottomRight}{\void}
|
||||
|
||||
Sets the left (x) and top (y) margins.
|
||||
Returns the right (x) and bottom (y) margins.
|
||||
|
||||
\membersection{wxPageSetupData::SetMarginBottomRight}\label{wxpagesetupdatasetmarginbottomright}
|
||||
\membersection{wxPageSetupDialogData::GetMinMarginTopLeft}\label{wxpagesetupdialogdatagetminmargintopleft}
|
||||
|
||||
\func{void}{SetMarginBottomRight}{\param{const wxPoint\& }{pt}}
|
||||
\constfunc{wxPoint}{GetMinMarginTopLeft}{\void}
|
||||
|
||||
Sets the right (x) and bottom (y) margins.
|
||||
Returns the left (x) and top (y) minimum margins the user can enter (Windows only).
|
||||
|
||||
\membersection{wxPageSetupData::SetMinMarginTopLeft}\label{wxpagesetupdatasetminmargintopleft}
|
||||
\membersection{wxPageSetupDialogData::GetMinMarginBottomRight}\label{wxpagesetupdialogdatagetminmarginbottomright}
|
||||
|
||||
\func{void}{SetMinMarginTopLeft}{\param{const wxPoint\& }{pt}}
|
||||
\constfunc{wxPoint}{GetMinMarginBottomRight}{\void}
|
||||
|
||||
Sets the left (x) and top (y) minimum margins the user can enter (Windows only).
|
||||
Returns the right (x) and bottom (y) minimum margins the user can enter (Windows only).
|
||||
|
||||
\membersection{wxPageSetupData::SetMinMarginBottomRight}\label{wxpagesetupdatasetminmarginbottomright}
|
||||
\membersection{wxPageSetupDialogData::GetPaperId}\label{wxpagesetupdialogdatagetpaperid}
|
||||
|
||||
\func{void}{SetMinMarginBottomRight}{\param{const wxPoint\& }{pt}}
|
||||
\constfunc{wxPaperSize}{GetPaperId}{\void}
|
||||
|
||||
Sets the right (x) and bottom (y) minimum margins the user can enter (Windows only).
|
||||
Returns the paper id (stored in the internal wxPrintData object).
|
||||
|
||||
\membersection{wxPageSetupData::SetOrientation}\label{wxpagesetupdatasetorientation}
|
||||
For further information, see \helpref{wxPrintData::SetPaperId}{wxprintdatasetpaperid}.
|
||||
|
||||
\func{void}{SetOrientation}{\param{int }{orientation}}
|
||||
\membersection{wxPageSetupDialogData::GetPaperSize}\label{wxpagesetupdialogdatagetpapersize}
|
||||
|
||||
Sets the orientation, which can be wxPORTRAIT or wxLANDSCAPE.
|
||||
\constfunc{wxSize}{GetPaperSize}{\void}
|
||||
|
||||
\membersection{wxPageSetupData::SetDefaultMinMargins}\label{wxpagesetupdatasetdefaultminmargins}
|
||||
Returns the paper size in millimetres.
|
||||
|
||||
\membersection{wxPageSetupDialogData::GetPrintData}\label{wxpagesetupdialogdatagetprintdata}
|
||||
|
||||
\func{wxPrintData\&}{GetPrintData}{\void}
|
||||
|
||||
Returns a reference to the \helpref{print data}{wxprintdata} associated with this object.
|
||||
|
||||
\membersection{wxPageSetupDialogData::SetDefaultInfo}\label{wxpagesetupdialogdatasetdefaultinfo}
|
||||
|
||||
\func{void}{SetDefaultInfo}{\param{bool}{ flag}}
|
||||
|
||||
Pass TRUE if the dialog will simply return default printer information (such as orientation)
|
||||
instead of showing a dialog. Windows only.
|
||||
|
||||
\membersection{wxPageSetupDialogData::SetDefaultMinMargins}\label{wxpagesetupdialogdatasetdefaultminmargins}
|
||||
|
||||
\func{void}{SetDefaultMinMargins}{\param{bool}{ flag}}
|
||||
|
||||
Pass TRUE if the page setup dialog will take its minimum margin values from the currently
|
||||
selected printer properties. Windows only.
|
||||
|
||||
\membersection{wxPageSetupData::SetDefaultInfo}\label{wxpagesetupdatasetdefaultinfo}
|
||||
\membersection{wxPageSetupDialogData::SetMarginTopLeft}\label{wxpagesetupdialogdatasetmargintopleft}
|
||||
|
||||
\func{void}{SetDefaultInfo}{\param{bool}{ flag}}
|
||||
\func{void}{GetMarginTopLeft}{\param{const wxPoint\& }{pt}}
|
||||
|
||||
Pass TRUE if the dialog will simply return default printer information (such as orientation)
|
||||
instead of showing a dialog. Windows only.
|
||||
Sets the left (x) and top (y) margins.
|
||||
|
||||
\membersection{wxPageSetupDialogData::SetMarginBottomRight}\label{wxpagesetupdialogdatasetmarginbottomright}
|
||||
|
||||
\func{void}{SetMarginBottomRight}{\param{const wxPoint\& }{pt}}
|
||||
|
||||
Sets the right (x) and bottom (y) margins.
|
||||
|
||||
\membersection{wxPageSetupDialogData::SetMinMarginTopLeft}\label{wxpagesetupdialogdatasetminmargintopleft}
|
||||
|
||||
\func{void}{SetMinMarginTopLeft}{\param{const wxPoint\& }{pt}}
|
||||
|
||||
Sets the left (x) and top (y) minimum margins the user can enter (Windows only).
|
||||
|
||||
\membersection{wxPageSetupDialogData::SetMinMarginBottomRight}\label{wxpagesetupdialogdatasetminmarginbottomright}
|
||||
|
||||
\func{void}{SetMinMarginBottomRight}{\param{const wxPoint\& }{pt}}
|
||||
|
||||
Sets the right (x) and bottom (y) minimum margins the user can enter (Windows only).
|
||||
|
||||
\membersection{wxPageSetupDialogData::SetPaperId}\label{wxpagesetupdialogdatasetpaperid}
|
||||
|
||||
\func{void}{SetPaperId}{\param{wxPaperSize\& }{id}}
|
||||
|
||||
Sets the paper size id. For further information, see \helpref{wxPrintData::SetPaperId}{wxprintdatasetpaperid}.
|
||||
|
||||
Calling this function overrides the explicit paper dimensions passed in \helpref{wxPageSetupDialogData::SetPaperSize}{wxpagesetupdialogdatasetpapersize}.
|
||||
|
||||
\membersection{wxPageSetupDialogData::SetPaperSize}\label{wxpagesetupdialogdatasetpapersize}
|
||||
|
||||
\func{void}{SetPaperSize}{\param{const wxSize\& }{size}}
|
||||
|
||||
Sets the paper size in millimetres. If a corresponding paper id is found, it will be set in the
|
||||
internal wxPrintData object, otherwise the paper size overrides the paper id.
|
||||
|
||||
\membersection{wxPageSetupDialogData::SetPrintData}\label{wxpagesetupdialogdatasetprintdata}
|
||||
|
||||
\func{void}{SetPrintData}{\param{const wxPrintData\&}{ printData}}
|
||||
|
||||
Sets the \helpref{print data}{wxprintdata} associated with this object.
|
||||
|
||||
\membersection{wxPageSetupDialogData::operator $=$}\label{wxpagesetupdialogdataassign}
|
||||
|
||||
\func{void}{operator $=$}{\param{const wxPrintData\&}{ data}}
|
||||
|
||||
Assigns print data to this object.
|
||||
|
||||
\func{void}{operator $=$}{\param{const wxPageSetupDialogData\&}{ data}}
|
||||
|
||||
Assigns page setup data to this object.
|
||||
|
||||
\section{\class{wxPageSetupDialog}}\label{wxpagesetupdialog}
|
||||
|
||||
@@ -197,8 +235,8 @@ native to the windowing system, otherwise it is emulated.
|
||||
|
||||
The page setup dialog contains controls for paper size (A4, A5 etc.), orientation (landscape
|
||||
or portrait), and controls for setting left, top, right and bottom margin sizes in millimetres.
|
||||
The page setup dialog does not set any global information (the exception being orientation
|
||||
for PostScript printing) so you need to query the \helpref{wxPageSetupData}{wxpagesetupdata} object
|
||||
|
||||
When the dialog has been closed, you need to query the \helpref{wxPageSetupDialogData}{wxpagesetupdialogdata} object
|
||||
associated with the dialog.
|
||||
|
||||
Note that the OK and Cancel buttons do not destroy the dialog; this must be done by the
|
||||
@@ -217,13 +255,13 @@ application.
|
||||
|
||||
\wxheading{See also}
|
||||
|
||||
\helpref{wxPrintDialog}{wxprintdialog}, \helpref{wxPageSetupData}{wxpagesetupdata}
|
||||
\helpref{wxPrintDialog}{wxprintdialog}, \helpref{wxPageSetupDialogData}{wxpagesetupdialogdata}
|
||||
|
||||
\latexignore{\rtfignore{\wxheading{Members}}}
|
||||
|
||||
\membersection{wxPageSetupDialog::wxPageSetupDialog}
|
||||
|
||||
\func{}{wxPageSetupDialog}{\param{wxWindow* }{parent}, \param{wxPageSetupData* }{data = NULL}}
|
||||
\func{}{wxPageSetupDialog}{\param{wxWindow* }{parent}, \param{wxPageSetupDialogData* }{data = NULL}}
|
||||
|
||||
Constructor. Pass a parent window, and optionally a pointer to a block of page setup
|
||||
data, which will be copied to the print dialog's internal data.
|
||||
@@ -236,9 +274,9 @@ Destructor.
|
||||
|
||||
\membersection{wxPageSetupDialog::GetPageSetupData}\label{wxpagesetupdialoggetpagesetupdata}
|
||||
|
||||
\func{wxPageSetupData\&}{GetPageSetupData}{\void}
|
||||
\func{wxPageSetupDialogData\&}{GetPageSetupData}{\void}
|
||||
|
||||
Returns the \helpref{page setup data}{wxpagesetupdata} associated with the dialog.
|
||||
Returns the \helpref{page setup data}{wxpagesetupdialogdata} associated with the dialog.
|
||||
|
||||
\membersection{wxPageSetupDialog::ShowModal}\label{wxpagesetupdialogshowmodal}
|
||||
|
||||
|
@@ -15,6 +15,10 @@ descriptions of the member functions.
|
||||
|
||||
\membersection{wxPostScriptDC::wxPostScriptDC}
|
||||
|
||||
\func{}{wxPostScriptDC}{\param{const wxPrintData\&}{ printData}}
|
||||
|
||||
Constructs a PostScript printer device context from a \helpref{wxPrintData}{wxprintdata} object.
|
||||
|
||||
\func{}{wxPostScriptDC}{\param{const wxString\& }{output}, \param{bool }{interactive = TRUE},\\
|
||||
\param{wxWindow *}{parent}}
|
||||
|
||||
@@ -28,6 +32,9 @@ in creating a useable device context.
|
||||
See \helpref{Printer settings}{printersettings} for functions to set and
|
||||
get PostScript printing settings.
|
||||
|
||||
This constructor and the global printer settings are now deprecated;
|
||||
use the wxPrintData constructor instead.
|
||||
|
||||
\membersection{wxPostScriptDC::GetStream}
|
||||
|
||||
\func{ostream *}{GetStream}{\void}
|
||||
|
@@ -1,6 +1,10 @@
|
||||
\section{\class{wxPrintData}}\label{wxprintdata}
|
||||
|
||||
This class holds a variety of information related to print dialogs.
|
||||
This class holds a variety of information related to printers and
|
||||
printer device contexts. This class is used to create a wxPrinterDC
|
||||
and a wxPostScriptDC. It is also used as a data member of wxPrintDialogData
|
||||
and wxPageSetupDialogData, as part of the mechanism for transferring data
|
||||
between the print dialogs and the application.
|
||||
|
||||
\wxheading{Derived from}
|
||||
|
||||
@@ -12,7 +16,45 @@ This class holds a variety of information related to print dialogs.
|
||||
|
||||
\wxheading{See also}
|
||||
|
||||
\helpref{wxPrintDialog}{wxprintdialog}, \helpref{wxPrintDialog Overview}{wxprintdialogoverview}
|
||||
\helpref{wxPrintDialog}{wxprintdialog},
|
||||
\helpref{wxPageSetupDialog}{wxpagesetupdialog},
|
||||
\helpref{wxPrintDialogData}{wxprintdialogdata},
|
||||
\helpref{wxPageSetupDialogData}{wxpagesetupdialogdata},
|
||||
\helpref{wxPrintDialog Overview}{wxprintdialogoverview},
|
||||
\helpref{wxPrinterDC}{wxprinterdc},
|
||||
\helpref{wxPostScriptDC}{wxpostscriptdc}
|
||||
|
||||
\wxheading{Remarks}
|
||||
|
||||
The following functions are specific to PostScript printing
|
||||
and have not yet been documented:
|
||||
|
||||
\begin{verbatim}
|
||||
const wxString& GetPrinterCommand() const ;
|
||||
const wxString& GetPrinterOptions() const ;
|
||||
const wxString& GetPreviewCommand() const ;
|
||||
const wxString& GetFilename() const ;
|
||||
const wxString& GetFontMetricPath() const ;
|
||||
double GetPrinterScaleX() const ;
|
||||
double GetPrinterScaleY() const ;
|
||||
long GetPrinterTranslateX() const ;
|
||||
long GetPrinterTranslateY() const ;
|
||||
// wxPRINT_MODE_PREVIEW, wxPRINT_MODE_FILE, wxPRINT_MODE_PRINTER
|
||||
wxPrintMode GetPrintMode() const ;
|
||||
|
||||
void SetPrinterCommand(const wxString& command) ;
|
||||
void SetPrinterOptions(const wxString& options) ;
|
||||
void SetPreviewCommand(const wxString& command) ;
|
||||
void SetFilename(const wxString& filename) ;
|
||||
void SetFontMetricPath(const wxString& path) ;
|
||||
void SetPrinterScaleX(double x) ;
|
||||
void SetPrinterScaleY(double y) ;
|
||||
void SetPrinterScaling(double x, double y) ;
|
||||
void SetPrinterTranslateX(long x) ;
|
||||
void SetPrinterTranslateY(long y) ;
|
||||
void SetPrinterTranslation(long x, long y) ;
|
||||
void SetPrintMode(wxPrintMode printMode) ;
|
||||
\end{verbatim}
|
||||
|
||||
\latexignore{\rtfignore{\wxheading{Members}}}
|
||||
|
||||
@@ -20,7 +62,11 @@ This class holds a variety of information related to print dialogs.
|
||||
|
||||
\func{}{wxPrintData}{\void}
|
||||
|
||||
Constructor.
|
||||
Default constructor.
|
||||
|
||||
\func{}{wxPrintData}{\param{const wxPrintData\&}{ data}}
|
||||
|
||||
Copy constructor.
|
||||
|
||||
\membersection{wxPrintData::\destruct{wxPrintData}}
|
||||
|
||||
@@ -28,107 +74,83 @@ Constructor.
|
||||
|
||||
Destructor.
|
||||
|
||||
\membersection{wxPrintData::EnableHelp}\label{wxprintdataenablehelp}
|
||||
|
||||
\func{void}{EnableHelp}{\param{bool }{flag}}
|
||||
|
||||
Enables or disables the `Help' button.
|
||||
|
||||
\membersection{wxPrintData::EnablePageNumbers}\label{wxprintdataenablepagenumbers}
|
||||
|
||||
\func{void}{EnablePageNumbers}{\param{bool }{flag}}
|
||||
|
||||
Enables or disables the `Page numbers' controls.
|
||||
|
||||
\membersection{wxPrintData::EnablePrintToFile}\label{wxprintdataenableprinttofile}
|
||||
|
||||
\func{void}{EnablePrintToFile}{\param{bool }{flag}}
|
||||
|
||||
Enables or disables the `Print to file' checkbox.
|
||||
|
||||
\membersection{wxPrintData::EnableSelection}\label{wxprintdataenableselection}
|
||||
|
||||
\func{void}{EnableSelection}{\param{bool }{flag}}
|
||||
|
||||
Enables or disables the `Selection' radio button.
|
||||
|
||||
\membersection{wxPrintData::GetAllPages}\label{wxprintdatagetallpages}
|
||||
|
||||
\func{bool}{GetAllPages}{\void}
|
||||
|
||||
Returns TRUE if the user requested that all pages be printed.
|
||||
|
||||
\membersection{wxPrintData::GetCollate}\label{wxprintdatagetcollate}
|
||||
|
||||
\func{bool}{GetCollate}{\void}
|
||||
\constfunc{bool}{GetCollate}{\void}
|
||||
|
||||
Returns TRUE if the user requested that the document(s) be collated.
|
||||
Returns TRUE if collation is on.
|
||||
|
||||
\membersection{wxPrintData::GetFromPage}\label{wxprintdatagetfrompage}
|
||||
\membersection{wxPrintData::GetColour}\label{wxprintdatagetcolour}
|
||||
|
||||
\func{int}{GetFromPage}{\void}
|
||||
\constfunc{bool}{GetColour}{\void}
|
||||
|
||||
Returns the {\it from} page number, as entered by the user.
|
||||
Returns TRUE if colour printing is on.
|
||||
|
||||
\membersection{wxPrintData::GetMaxPage}\label{wxprintdatagetmaxpage}
|
||||
\membersection{wxPrintData::GetDuplex}\label{wxprintdatagetduplex}
|
||||
|
||||
\func{int}{GetMaxPage}{\void}
|
||||
\constfunc{wxDuplexMode}{GetDuplex}{\void}
|
||||
|
||||
Returns the {\it maximum} page number.
|
||||
|
||||
\membersection{wxPrintData::GetMinPage}\label{wxprintdatagetminpage}
|
||||
|
||||
\func{int}{GetMinPage}{\void}
|
||||
|
||||
Returns the {\it minimum} page number.
|
||||
Returns the duplex mode. One of wxDUPLEX\_SIMPLEX, wxDUPLEX\_HORIZONTAL, wxDUPLEX\_VERTICAL.
|
||||
|
||||
\membersection{wxPrintData::GetNoCopies}\label{wxprintdatagetnocopies}
|
||||
|
||||
\func{int}{GetNoCopies}{\void}
|
||||
\constfunc{int}{GetNoCopies}{\void}
|
||||
|
||||
Returns the number of copies requested by the user.
|
||||
|
||||
\membersection{wxPrintData::GetOrientation}\label{wxprintdatagetorientation}
|
||||
|
||||
\func{int}{GetOrientation}{\void}
|
||||
\constfunc{int}{GetOrientation}{\void}
|
||||
|
||||
Gets the orientation. This can be wxLANDSCAPE or wxPORTRAIT.
|
||||
|
||||
\membersection{wxPrintData::GetToPage}\label{wxprintdatagettopage}
|
||||
\membersection{wxPrintData::GetPaperId}\label{wxprintdatagetpaperid}
|
||||
|
||||
\func{int}{GetToPage}{\void}
|
||||
\constfunc{wxPaperSize}{GetPaperId}{\void}
|
||||
|
||||
Returns the {\it to} page number, as entered by the user.
|
||||
Returns the paper size id. For more information, see \helpref{wxPrintData::SetPaperId}{wxprintdatasetpaperid}.
|
||||
|
||||
\membersection{wxPrintData::GetPrinterName}\label{wxprintdatagetprintername}
|
||||
|
||||
\constfunc{const wxString\&}{GetPrinterName}{\void}
|
||||
|
||||
Returns the printer name. If the printer name is the empty string, it indicates that the default
|
||||
printer should be used.
|
||||
|
||||
\membersection{wxPrintData::GetQuality}\label{wxprintdatagetquality}
|
||||
|
||||
\constfunc{wxPaperQuality}{GetQuality}{\void}
|
||||
|
||||
Returns the current print quality. This can be a positive integer, denoting the number of dots per inch, or
|
||||
one of the following identifiers:
|
||||
|
||||
\begin{verbatim}
|
||||
wxPRINT\_QUALITY\_HIGH
|
||||
wxPRINT\_QUALITY\_MEDIUM
|
||||
wxPRINT\_QUALITY\_LOW
|
||||
wxPRINT\_QUALITY\_DRAFT
|
||||
\end{verbatim}
|
||||
|
||||
On input you should pass one of these identifiers, but on return you may get back a positive integer
|
||||
indicating the current resolution setting.
|
||||
|
||||
\membersection{wxPrintData::SetCollate}\label{wxprintdatasetcollate}
|
||||
|
||||
\func{void}{SetCollate}{\param{bool }{flag}}
|
||||
|
||||
Sets the 'Collate' checkbox to TRUE or FALSE.
|
||||
Sets collation to on or off.
|
||||
|
||||
\membersection{wxPrintData::SetFromPage}\label{wxprintdatasetfrompage}
|
||||
\membersection{wxPrintData::SetColour}\label{wxprintdatasetcolour}
|
||||
|
||||
\func{void}{SetFromPage}{\param{int }{page}}
|
||||
\func{void}{SetColour}{\param{bool }{flag}}
|
||||
|
||||
Sets the {\it from} page number.
|
||||
Sets colour printing on or off.
|
||||
|
||||
\membersection{wxPrintData::SetMaxPage}\label{wxprintdatasetmaxpage}
|
||||
\membersection{wxPrintData::SetDuplex}\label{wxprintdatasetduplex}
|
||||
|
||||
\func{void}{SetMaxPage}{\param{int }{page}}
|
||||
\func{void}{SetDuplex}{\param{wxDuplexMode}{ mode}}
|
||||
|
||||
Sets the {\it maximum} page number.
|
||||
|
||||
\membersection{wxPrintData::SetMinPage}\label{wxprintdatasetminpage}
|
||||
|
||||
\func{void}{SetMinPage}{\param{int }{page}}
|
||||
|
||||
Sets the {\it minimum} page number.
|
||||
|
||||
\membersection{wxPrintData::SetOrientation}\label{wxprintdatasetorientation}
|
||||
|
||||
\func{void}{SetOrientation}{\param{int }{orientation}}
|
||||
|
||||
Sets the orientation. This can be wxLANDSCAPE or wxPORTRAIT.
|
||||
Returns the duplex mode. One of wxDUPLEX\_SIMPLEX, wxDUPLEX\_HORIZONTAL, wxDUPLEX\_VERTICAL.
|
||||
|
||||
\membersection{wxPrintData::SetNoCopies}\label{wxprintdatasetnocopies}
|
||||
|
||||
@@ -136,27 +158,129 @@ Sets the orientation. This can be wxLANDSCAPE or wxPORTRAIT.
|
||||
|
||||
Sets the default number of copies to be printed out.
|
||||
|
||||
\membersection{wxPrintData::SetPrintToFile}\label{wxprintdatasetprinttofile}
|
||||
\membersection{wxPrintData::SetOrientation}\label{wxprintdatasetorientation}
|
||||
|
||||
\func{void}{SetPrintToFile}{\param{bool }{flag}}
|
||||
\func{void}{SetOrientation}{\param{int }{orientation}}
|
||||
|
||||
Sets the 'Print to file' checkbox to TRUE or FALSE.
|
||||
Sets the orientation. This can be wxLANDSCAPE or wxPORTRAIT.
|
||||
|
||||
\membersection{wxPrintData::SetSetupDialog}\label{wxprintdatasetsetupdialog}
|
||||
\membersection{wxPrintData::SetPaperId}\label{wxprintdatasetpaperid}
|
||||
|
||||
\func{void}{SetSetupDialog}{\param{bool }{flag}}
|
||||
\func{void}{SetPaperId}{\param{wxPaperSize}{ paperId}}
|
||||
|
||||
Determines whether the dialog to be shown will be the Print dialog
|
||||
(pass FALSE) or Print Setup dialog (pass TRUE).
|
||||
\index{wxPaperSize}Sets the paper id. This indicates the type of paper to be used. For a mapping between
|
||||
paper id, paper size and string name, see wxPrintPaperDatabase in {\tt paper.h} (not yet documented).
|
||||
|
||||
Note that the setup dialog is obsolete from
|
||||
Windows 95, though retained for backward compatibility.
|
||||
{\it paperId} can be one of:
|
||||
|
||||
\membersection{wxPrintData::SetToPage}\label{wxprintdatasettopage}
|
||||
{\small
|
||||
\begin{verbatim}
|
||||
wxPAPER_NONE, // Use specific dimensions
|
||||
wxPAPER_LETTER, // Letter, 8 1/2 by 11 inches
|
||||
wxPAPER_LEGAL, // Legal, 8 1/2 by 14 inches
|
||||
wxPAPER_A4, // A4 Sheet, 210 by 297 millimeters
|
||||
wxPAPER_CSHEET, // C Sheet, 17 by 22 inches
|
||||
wxPAPER_DSHEET, // D Sheet, 22 by 34 inches
|
||||
wxPAPER_ESHEET, // E Sheet, 34 by 44 inches
|
||||
wxPAPER_LETTERSMALL, // Letter Small, 8 1/2 by 11 inches
|
||||
wxPAPER_TABLOID, // Tabloid, 11 by 17 inches
|
||||
wxPAPER_LEDGER, // Ledger, 17 by 11 inches
|
||||
wxPAPER_STATEMENT, // Statement, 5 1/2 by 8 1/2 inches
|
||||
wxPAPER_EXECUTIVE, // Executive, 7 1/4 by 10 1/2 inches
|
||||
wxPAPER_A3, // A3 sheet, 297 by 420 millimeters
|
||||
wxPAPER_A4SMALL, // A4 small sheet, 210 by 297 millimeters
|
||||
wxPAPER_A5, // A5 sheet, 148 by 210 millimeters
|
||||
wxPAPER_B4, // B4 sheet, 250 by 354 millimeters
|
||||
wxPAPER_B5, // B5 sheet, 182-by-257-millimeter paper
|
||||
wxPAPER_FOLIO, // Folio, 8-1/2-by-13-inch paper
|
||||
wxPAPER_QUARTO, // Quarto, 215-by-275-millimeter paper
|
||||
wxPAPER_10X14, // 10-by-14-inch sheet
|
||||
wxPAPER_11X17, // 11-by-17-inch sheet
|
||||
wxPAPER_NOTE, // Note, 8 1/2 by 11 inches
|
||||
wxPAPER_ENV_9, // #9 Envelope, 3 7/8 by 8 7/8 inches
|
||||
wxPAPER_ENV_10, // #10 Envelope, 4 1/8 by 9 1/2 inches
|
||||
wxPAPER_ENV_11, // #11 Envelope, 4 1/2 by 10 3/8 inches
|
||||
wxPAPER_ENV_12, // #12 Envelope, 4 3/4 by 11 inches
|
||||
wxPAPER_ENV_14, // #14 Envelope, 5 by 11 1/2 inches
|
||||
wxPAPER_ENV_DL, // DL Envelope, 110 by 220 millimeters
|
||||
wxPAPER_ENV_C5, // C5 Envelope, 162 by 229 millimeters
|
||||
wxPAPER_ENV_C3, // C3 Envelope, 324 by 458 millimeters
|
||||
wxPAPER_ENV_C4, // C4 Envelope, 229 by 324 millimeters
|
||||
wxPAPER_ENV_C6, // C6 Envelope, 114 by 162 millimeters
|
||||
wxPAPER_ENV_C65, // C65 Envelope, 114 by 229 millimeters
|
||||
wxPAPER_ENV_B4, // B4 Envelope, 250 by 353 millimeters
|
||||
wxPAPER_ENV_B5, // B5 Envelope, 176 by 250 millimeters
|
||||
wxPAPER_ENV_B6, // B6 Envelope, 176 by 125 millimeters
|
||||
wxPAPER_ENV_ITALY, // Italy Envelope, 110 by 230 millimeters
|
||||
wxPAPER_ENV_MONARCH, // Monarch Envelope, 3 7/8 by 7 1/2 inches
|
||||
wxPAPER_ENV_PERSONAL, // 6 3/4 Envelope, 3 5/8 by 6 1/2 inches
|
||||
wxPAPER_FANFOLD_US, // US Std Fanfold, 14 7/8 by 11 inches
|
||||
wxPAPER_FANFOLD_STD_GERMAN, // German Std Fanfold, 8 1/2 by 12 inches
|
||||
wxPAPER_FANFOLD_LGL_GERMAN, // German Legal Fanfold, 8 1/2 by 13 inches
|
||||
|
||||
\func{void}{SetToPage}{\param{int }{page}}
|
||||
Windows 95 only:
|
||||
wxPAPER_ISO_B4, // B4 (ISO) 250 x 353 mm
|
||||
wxPAPER_JAPANESE_POSTCARD, // Japanese Postcard 100 x 148 mm
|
||||
wxPAPER_9X11, // 9 x 11 in
|
||||
wxPAPER_10X11, // 10 x 11 in
|
||||
wxPAPER_15X11, // 15 x 11 in
|
||||
wxPAPER_ENV_INVITE, // Envelope Invite 220 x 220 mm
|
||||
wxPAPER_LETTER_EXTRA, // Letter Extra 9 \275 x 12 in
|
||||
wxPAPER_LEGAL_EXTRA, // Legal Extra 9 \275 x 15 in
|
||||
wxPAPER_TABLOID_EXTRA, // Tabloid Extra 11.69 x 18 in
|
||||
wxPAPER_A4_EXTRA, // A4 Extra 9.27 x 12.69 in
|
||||
wxPAPER_LETTER_TRANSVERSE, // Letter Transverse 8 \275 x 11 in
|
||||
wxPAPER_A4_TRANSVERSE, // A4 Transverse 210 x 297 mm
|
||||
wxPAPER_LETTER_EXTRA_TRANSVERSE, // Letter Extra Transverse 9\275 x 12 in
|
||||
wxPAPER_A_PLUS, // SuperA/SuperA/A4 227 x 356 mm
|
||||
wxPAPER_B_PLUS, // SuperB/SuperB/A3 305 x 487 mm
|
||||
wxPAPER_LETTER_PLUS, // Letter Plus 8.5 x 12.69 in
|
||||
wxPAPER_A4_PLUS, // A4 Plus 210 x 330 mm
|
||||
wxPAPER_A5_TRANSVERSE, // A5 Transverse 148 x 210 mm
|
||||
wxPAPER_B5_TRANSVERSE, // B5 (JIS) Transverse 182 x 257 mm
|
||||
wxPAPER_A3_EXTRA, // A3 Extra 322 x 445 mm
|
||||
wxPAPER_A5_EXTRA, // A5 Extra 174 x 235 mm
|
||||
wxPAPER_B5_EXTRA, // B5 (ISO) Extra 201 x 276 mm
|
||||
wxPAPER_A2, // A2 420 x 594 mm
|
||||
wxPAPER_A3_TRANSVERSE, // A3 Transverse 297 x 420 mm
|
||||
wxPAPER_A3_EXTRA_TRANSVERSE // A3 Extra Transverse 322 x 445 mm
|
||||
\end{verbatim}
|
||||
}
|
||||
|
||||
Sets the {\it to} page number.
|
||||
\membersection{wxPrintData::SetPrinterName}\label{wxprintdatasetprintername}
|
||||
|
||||
\func{void}{SetPrinterName}{\param{const wxString\& }{printerName}}
|
||||
|
||||
Sets the printer name. This can be the empty string to indicate that the default
|
||||
printer should be used.
|
||||
|
||||
\membersection{wxPrintData::SetQuality}\label{wxprintdatasetquality}
|
||||
|
||||
\func{void}{SetQuality}{\param{wxPaperQuality}{ quality}}
|
||||
|
||||
Sets the desired print quality. This can be a positive integer, denoting the number of dots per inch, or
|
||||
one of the following identifiers:
|
||||
|
||||
\begin{verbatim}
|
||||
wxPRINT\_QUALITY\_HIGH
|
||||
wxPRINT\_QUALITY\_MEDIUM
|
||||
wxPRINT\_QUALITY\_LOW
|
||||
wxPRINT\_QUALITY\_DRAFT
|
||||
\end{verbatim}
|
||||
|
||||
On input you should pass one of these identifiers, but on return you may get back a positive integer
|
||||
indicating the current resolution setting.
|
||||
|
||||
\membersection{wxPrintData::operator $=$}\label{wxprintdataassign}
|
||||
|
||||
\func{void}{operator $=$}{\param{const wxPrintData\&}{ data}}
|
||||
|
||||
Assigns print data to this object.
|
||||
|
||||
\func{void}{operator $=$}{\param{const wxPrintSetupData\&}{ data}}
|
||||
|
||||
Assigns print setup data to this object. wxPrintSetupData is deprecated,
|
||||
but retained for backward compatibility.
|
||||
|
||||
\section{\class{wxPrintDialog}}\label{wxprintdialog}
|
||||
|
||||
@@ -183,14 +307,14 @@ a successfully dismissed print dialog.
|
||||
|
||||
\membersection{wxPrintDialog::wxPrintDialog}
|
||||
|
||||
\func{}{wxPrintDialog}{\param{wxWindow* }{parent}, \param{wxPrintData* }{data = NULL}}
|
||||
\func{}{wxPrintDialog}{\param{wxWindow* }{parent}, \param{wxPrintDialogData* }{data = NULL}}
|
||||
|
||||
Constructor. Pass a parent window, and optionally a pointer to a block of print
|
||||
data, which will be copied to the print dialog's print data.
|
||||
|
||||
\wxheading{See also}
|
||||
|
||||
\helpref{wxPrintData}{wxprintdata}
|
||||
\helpref{wxPrintDialogData}{wxprintdialogdata}
|
||||
|
||||
\membersection{wxPrintDialog::\destruct{wxPrintDialog}}
|
||||
|
||||
@@ -199,11 +323,11 @@ data, which will be copied to the print dialog's print data.
|
||||
Destructor. If wxPrintDialog::GetPrintDC has {\it not} been called,
|
||||
the device context obtained by the dialog (if any) will be deleted.
|
||||
|
||||
\membersection{wxPrintDialog::GetPrintData}\label{wxprintdialoggetprintdata}
|
||||
\membersection{wxPrintDialog::GetPrintDialogData}\label{wxprintdialoggetprintdialogdata}
|
||||
|
||||
\func{wxPrintData\&}{GetPrintData}{\void}
|
||||
\func{wxPrintDialogData\&}{GetPrintDialogData}{\void}
|
||||
|
||||
Returns the \helpref{print data}{wxprintdata} associated with the print dialog.
|
||||
Returns the \helpref{print dialog data}{wxprintdialogdata} associated with the print dialog.
|
||||
|
||||
\membersection{wxPrintDialog::GetPrintDC}\label{wxprintdialoggetprintdc}
|
||||
|
||||
@@ -222,6 +346,191 @@ Shows the dialog, returning wxID\_OK if the user pressed OK, and wxID\_CANCEL
|
||||
otherwise. After this function is called, a device context may
|
||||
be retrievable using \helpref{wxPrintDialog::GetPrintDC}{wxprintdialoggetprintdc}.
|
||||
|
||||
\section{\class{wxPrintDialogData}}\label{wxprintdialogdata}
|
||||
|
||||
This class holds information related to the visual characteristics of wxPrintDialog.
|
||||
It contains a wxPrintData object with underlying printing settings.
|
||||
|
||||
\wxheading{Derived from}
|
||||
|
||||
\helpref{wxObject}{wxobject}
|
||||
|
||||
\wxheading{Include files}
|
||||
|
||||
<wx/cmndata.h>
|
||||
|
||||
\wxheading{See also}
|
||||
|
||||
\helpref{wxPrintDialog}{wxprintdialog}, \helpref{wxPrintDialog Overview}{wxprintdialogoverview}
|
||||
|
||||
\latexignore{\rtfignore{\wxheading{Members}}}
|
||||
|
||||
\membersection{wxPrintDialogData::wxPrintDialogData}
|
||||
|
||||
\func{}{wxPrintDialogData}{\void}
|
||||
|
||||
Default constructor.
|
||||
|
||||
\func{}{wxPrintDialogData}{\param{wxPrintDialogData\&}{ dialogData}}
|
||||
|
||||
Copy constructor.
|
||||
|
||||
\func{}{wxPrintDialogData}{\param{wxPrintData\&}{ printData}}
|
||||
|
||||
Construct an object from a print dialog data object.
|
||||
|
||||
\membersection{wxPrintDialogData::\destruct{wxprintdialogdata}}
|
||||
|
||||
\func{}{\destruct{wxPrintDialogData}}{\void}
|
||||
|
||||
Destructor.
|
||||
|
||||
\membersection{wxPrintDialogData::EnableHelp}\label{wxprintdialogdataenablehelp}
|
||||
|
||||
\func{void}{EnableHelp}{\param{bool }{flag}}
|
||||
|
||||
Enables or disables the `Help' button.
|
||||
|
||||
\membersection{wxPrintDialogData::EnablePageNumbers}\label{wxprintdialogdataenablepagenumbers}
|
||||
|
||||
\func{void}{EnablePageNumbers}{\param{bool }{flag}}
|
||||
|
||||
Enables or disables the `Page numbers' controls.
|
||||
|
||||
\membersection{wxPrintDialogData::EnablePrintToFile}\label{wxprintdialogdataenableprinttofile}
|
||||
|
||||
\func{void}{EnablePrintToFile}{\param{bool }{flag}}
|
||||
|
||||
Enables or disables the `Print to file' checkbox.
|
||||
|
||||
\membersection{wxPrintDialogData::EnableSelection}\label{wxprintdialogdataenableselection}
|
||||
|
||||
\func{void}{EnableSelection}{\param{bool }{flag}}
|
||||
|
||||
Enables or disables the `Selection' radio button.
|
||||
|
||||
\membersection{wxPrintDialogData::GetAllPages}\label{wxprintdialogdatagetallpages}
|
||||
|
||||
\constfunc{bool}{GetAllPages}{\void}
|
||||
|
||||
Returns TRUE if the user requested that all pages be printed.
|
||||
|
||||
\membersection{wxPrintDialogData::GetCollate}\label{wxprintdialogdatagetcollate}
|
||||
|
||||
\constfunc{bool}{GetCollate}{\void}
|
||||
|
||||
Returns TRUE if the user requested that the document(s) be collated.
|
||||
|
||||
\membersection{wxPrintDialogData::GetFromPage}\label{wxprintdialogdatagetfrompage}
|
||||
|
||||
\constfunc{int}{GetFromPage}{\void}
|
||||
|
||||
Returns the {\it from} page number, as entered by the user.
|
||||
|
||||
\membersection{wxPrintDialogData::GetMaxPage}\label{wxprintdialogdatagetmaxpage}
|
||||
|
||||
\constfunc{int}{GetMaxPage}{\void}
|
||||
|
||||
Returns the {\it maximum} page number.
|
||||
|
||||
\membersection{wxPrintDialogData::GetMinPage}\label{wxprintdialogdatagetminpage}
|
||||
|
||||
\constfunc{int}{GetMinPage}{\void}
|
||||
|
||||
Returns the {\it minimum} page number.
|
||||
|
||||
\membersection{wxPrintDialogData::GetNoCopies}\label{wxprintdialogdatagetnocopies}
|
||||
|
||||
\constfunc{int}{GetNoCopies}{\void}
|
||||
|
||||
Returns the number of copies requested by the user.
|
||||
|
||||
\membersection{wxPrintDialogData::GetPrintData}\label{wxprintdialogdatagetprintdata}
|
||||
|
||||
\func{wxPrintData\&}{GetPrintData}{\void}
|
||||
|
||||
Returns a reference to the internal wxPrintData object.
|
||||
|
||||
\membersection{wxPrintDialogData::GetPrintToFile}\label{wxprintdialogdatagetprinttofile}
|
||||
|
||||
\constfunc{bool}{GetPrintToFile}{\void}
|
||||
|
||||
Returns TRUE if the user has selected printing to a file.
|
||||
|
||||
\membersection{wxPrintDialogData::GetToPage}\label{wxprintdialogdatagettopage}
|
||||
|
||||
\constfunc{int}{GetToPage}{\void}
|
||||
|
||||
Returns the {\it to} page number, as entered by the user.
|
||||
|
||||
\membersection{wxPrintDialogData::SetCollate}\label{wxprintdialogdatasetcollate}
|
||||
|
||||
\func{void}{SetCollate}{\param{bool }{flag}}
|
||||
|
||||
Sets the 'Collate' checkbox to TRUE or FALSE.
|
||||
|
||||
\membersection{wxPrintDialogData::SetFromPage}\label{wxprintdialogdatasetfrompage}
|
||||
|
||||
\func{void}{SetFromPage}{\param{int }{page}}
|
||||
|
||||
Sets the {\it from} page number.
|
||||
|
||||
\membersection{wxPrintDialogData::SetMaxPage}\label{wxprintdialogdatasetmaxpage}
|
||||
|
||||
\func{void}{SetMaxPage}{\param{int }{page}}
|
||||
|
||||
Sets the {\it maximum} page number.
|
||||
|
||||
\membersection{wxPrintDialogData::SetMinPage}\label{wxprintdialogdatasetminpage}
|
||||
|
||||
\func{void}{SetMinPage}{\param{int }{page}}
|
||||
|
||||
Sets the {\it minimum} page number.
|
||||
|
||||
\membersection{wxPrintDialogData::SetNoCopies}\label{wxprintdialogdatasetnocopies}
|
||||
|
||||
\func{void}{SetNoCopies}{\param{int }{n}}
|
||||
|
||||
Sets the default number of copies the user has requested to be printed out.
|
||||
|
||||
\membersection{wxPrintDialogData::SetPrintData}\label{wxprintdialogdatasetprintdata}
|
||||
|
||||
\func{void}{SetPrintData}{\param{const wxPrintData\& }{printData}}
|
||||
|
||||
Sets the internal wxPrintData.
|
||||
|
||||
\membersection{wxPrintDialogData::SetPrintToFile}\label{wxprintdialogdatasetprinttofile}
|
||||
|
||||
\func{void}{SetPrintToFile}{\param{bool }{flag}}
|
||||
|
||||
Sets the 'Print to file' checkbox to TRUE or FALSE.
|
||||
|
||||
\membersection{wxPrintDialogData::SetSetupDialog}\label{wxprintdialogdatasetsetupdialog}
|
||||
|
||||
\func{void}{SetSetupDialog}{\param{bool }{flag}}
|
||||
|
||||
Determines whether the dialog to be shown will be the Print dialog
|
||||
(pass FALSE) or Print Setup dialog (pass TRUE).
|
||||
|
||||
Note that the setup dialog is (according to Microsoft) obsolete from
|
||||
Windows 95, though retained for backward compatibility.
|
||||
|
||||
\membersection{wxPrintDialogData::SetToPage}\label{wxprintdialogdatasettopage}
|
||||
|
||||
\func{void}{SetToPage}{\param{int }{page}}
|
||||
|
||||
Sets the {\it to} page number.
|
||||
|
||||
\membersection{wxPrintDialogData::operator $=$}\label{wxprintdialogdataassign}
|
||||
|
||||
\func{void}{operator $=$}{\param{const wxPrintData\&}{ data}}
|
||||
|
||||
Assigns print data to this object.
|
||||
|
||||
\func{void}{operator $=$}{\param{const wxPrintDialogData\&}{ data}}
|
||||
|
||||
Assigns another print dialog data object to this object.
|
||||
|
||||
\section{\class{wxPrinter}}\label{wxprinter}
|
||||
|
||||
This class represents the Windows or PostScript printer, and is the vehicle through
|
||||
@@ -247,13 +556,14 @@ method of printing.
|
||||
|
||||
\membersection{wxPrinter::wxPrinter}
|
||||
|
||||
\func{}{wxPrinter}{\param{wxPrintData* }{data = NULL}}
|
||||
\func{}{wxPrinter}{\param{wxPrintDialogData* }{data = NULL}}
|
||||
|
||||
Constructor. Pass an optional pointer to a block of print
|
||||
data, which will be copied to the printer object's print data.
|
||||
dialog data, which will be copied to the printer object's local data.
|
||||
|
||||
\wxheading{See also}
|
||||
|
||||
\helpref{wxPrintDialogData}{wxprintdialogdata},
|
||||
\helpref{wxPrintData}{wxprintdata}
|
||||
|
||||
\membersection{wxPrinter::\destruct{wxPrinter}}
|
||||
@@ -274,9 +584,9 @@ Returns TRUE if the user has aborted the print job.
|
||||
|
||||
Creates the default printing abort window, with a cancel button.
|
||||
|
||||
\membersection{wxPrinter::GetPrintData}\label{wxprintergetprintdata}
|
||||
\membersection{wxPrinter::GetPrintDialogData}\label{wxprintergetprintdialogdata}
|
||||
|
||||
\func{wxPrintData\&}{GetPrintData}{\void}
|
||||
\func{wxPrintDialogData\&}{GetPrintDialogData}{\void}
|
||||
|
||||
Returns the \helpref{print data}{wxprintdata} associated with the printer object.
|
||||
|
||||
@@ -292,9 +602,13 @@ Print could return FALSE if there was a problem initializing the printer device
|
||||
|
||||
\membersection{wxPrinter::PrintDialog}\label{wxprinterprintdialog}
|
||||
|
||||
\func{bool}{PrintDialog}{\param{wxWindow *}{parent}}
|
||||
\func{wxDC*}{PrintDialog}{\param{wxWindow *}{parent}}
|
||||
|
||||
Invokes the print dialog.
|
||||
Invokes the print dialog. If successful (the user did not press Cancel
|
||||
and no error occurred), a suitable device context will be returned
|
||||
(otherwise NULL is returned).
|
||||
|
||||
The application must delete this device context to avoid a memory leak.
|
||||
|
||||
\membersection{wxPrinter::ReportError}\label{wxprinterreporterror}
|
||||
|
||||
@@ -304,7 +618,7 @@ Default error-reporting function.
|
||||
|
||||
\membersection{wxPrinter::Setup}\label{wxprintersetup}
|
||||
|
||||
\func{void}{Setup}{\param{wxWindow *}{parent}}
|
||||
\func{bool}{Setup}{\param{wxWindow *}{parent}}
|
||||
|
||||
Invokes the print setup dialog. Note that the setup dialog is obsolete from
|
||||
Windows 95, though retained for backward compatibility.
|
||||
@@ -333,6 +647,12 @@ achieving the correct scaling for the page.
|
||||
|
||||
\membersection{wxPrinterDC::wxPrinterDC}
|
||||
|
||||
\func{}{wxPrinterDC}{\param{const wxPrintData\& }{printData}}
|
||||
|
||||
Pass a \helpref{wxPrintData}{wxprintdata} object with information
|
||||
necessary for setting up a suitable printer device context. This
|
||||
is the recommended way to construct a wxPrinterDC.
|
||||
|
||||
\func{}{wxPrinterDC}{\param{const wxString\& }{driver}, \param{const wxString\& }{device}, \param{const wxString\& }{output},
|
||||
\param{const bool }{interactive = TRUE}, \param{int }{orientation = wxPORTRAIT}}
|
||||
|
||||
@@ -342,6 +662,8 @@ is an optional file for printing to. The {\it driver} parameter is
|
||||
currently unused. Use the {\it Ok} member to test whether the
|
||||
constructor was successful in creating a useable device context.
|
||||
|
||||
This constructor is deprecated and retained only for backward compatibility.
|
||||
|
||||
\section{\class{wxPrintout}}\label{wxprintout}
|
||||
|
||||
This class encapsulates the functionality of printing out an
|
||||
@@ -671,4 +993,3 @@ Associates a printout object with the wxPrintPreview object.
|
||||
Sets the percentage preview zoom, and refreshes the preview canvas
|
||||
accordingly.
|
||||
|
||||
|
||||
|
@@ -1,8 +1,14 @@
|
||||
\section{Printing overview}\label{printingoverview}
|
||||
|
||||
Classes: \helpref{wxPrintout}{wxprintout}, \helpref{wxPrinter}{wxprinter},\rtfsp
|
||||
\helpref{wxPrintPreview}{wxprintpreview}, \helpref{wxPrinterDC}{wxprinterdc},\rtfsp
|
||||
\helpref{wxPrintDialog}{wxprintdialog}.
|
||||
Classes: \helpref{wxPrintout}{wxprintout},
|
||||
\helpref{wxPrinter}{wxprinter},
|
||||
\helpref{wxPrintPreview}{wxprintpreview},
|
||||
\helpref{wxPrinterDC}{wxprinterdc},
|
||||
\helpref{wxPrintDialog}{wxprintdialog},
|
||||
\helpref{wxPrintData}{wxprintdata},
|
||||
\helpref{wxPrintDialogData}{wxprintdialogdata},
|
||||
\helpref{wxPageSetupDialog}{wxpagesetupdialog},
|
||||
\helpref{wxPageSetupDialogData}{wxpagesetupdialogdata}
|
||||
|
||||
The printing framework relies on the application to provide classes
|
||||
whose member functions can respond to particular requests, such
|
||||
@@ -11,8 +17,6 @@ This method allows wxWindows to take over the housekeeping duties of
|
||||
turning preview pages, calling the print dialog box, creating
|
||||
the printer device context, and so on: the application can concentrate
|
||||
on the rendering of the information onto a device context.
|
||||
The printing framework is mainly a Windows feature; PostScript
|
||||
support under non-Windows platforms is emerging but has not been rigorously tested.
|
||||
|
||||
The \helpref{document/view framework}{docviewoverview} creates a default wxPrintout
|
||||
object for every view, calling wxView::OnDraw to achieve a
|
||||
|
@@ -438,7 +438,7 @@ as possible to the C++ spec over time.
|
||||
\item \helpref{wxMoveEvent}{wxmoveevent}
|
||||
\item \helpref{wxNotebookEvent}{wxnotebookevent}
|
||||
\item \helpref{wxNotebook}{wxnotebook}
|
||||
\item \helpref{wxPageSetupData}{wxpagesetupdata}
|
||||
\item \helpref{wxPageSetupDialogData}{wxpagesetupdialogdata}
|
||||
\item \helpref{wxPageSetupDialog}{wxpagesetupdialog}
|
||||
\item \helpref{wxPaintDC}{wxpaintdc}
|
||||
\item \helpref{wxPaintEvent}{wxpaintevent}
|
||||
|
@@ -19,33 +19,66 @@
|
||||
#include "wx/font.h"
|
||||
#include "wx/colour.h"
|
||||
|
||||
#if (defined(__WXMOTIF__) || defined(__WXGTK__)) && wxUSE_POSTSCRIPT
|
||||
class WXDLLEXPORT wxPrintSetupData;
|
||||
#endif
|
||||
|
||||
class WXDLLEXPORT wxColourData: public wxObject
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxColourData)
|
||||
public:
|
||||
wxColour dataColour;
|
||||
wxColour custColours[16];
|
||||
bool chooseFull;
|
||||
|
||||
wxColourData(void);
|
||||
~wxColourData(void);
|
||||
public:
|
||||
wxColourData();
|
||||
wxColourData(const wxColourData& data);
|
||||
~wxColourData();
|
||||
|
||||
inline void SetChooseFull(bool flag) { chooseFull = flag; }
|
||||
inline bool GetChooseFull(void) { return chooseFull; }
|
||||
inline bool GetChooseFull() const { return chooseFull; }
|
||||
inline void SetColour(wxColour& colour) { dataColour = colour; }
|
||||
inline wxColour &GetColour(void) { return dataColour; }
|
||||
inline wxColour &GetColour() { return dataColour; }
|
||||
|
||||
// Array of 16 custom colours
|
||||
void SetCustomColour(int i, wxColour& colour);
|
||||
wxColour GetCustomColour(int i);
|
||||
|
||||
void operator=(const wxColourData& data);
|
||||
|
||||
public:
|
||||
wxColour dataColour;
|
||||
wxColour custColours[16];
|
||||
bool chooseFull;
|
||||
};
|
||||
|
||||
class WXDLLEXPORT wxFontData: public wxObject
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxFontData)
|
||||
public:
|
||||
public:
|
||||
wxFontData();
|
||||
wxFontData(const wxFontData& fontData);
|
||||
~wxFontData();
|
||||
|
||||
inline void SetAllowSymbols(bool flag) { allowSymbols = flag; }
|
||||
inline bool GetAllowSymbols() const { return allowSymbols; }
|
||||
|
||||
inline void SetColour(const wxColour& colour) { fontColour = colour; }
|
||||
inline wxColour &GetColour() { return fontColour; }
|
||||
|
||||
inline void SetShowHelp(bool flag) { showHelp = flag; }
|
||||
inline bool GetShowHelp() const { return showHelp; }
|
||||
|
||||
inline void EnableEffects(bool flag) { enableEffects = flag; }
|
||||
inline bool GetEnableEffects() const { return enableEffects; }
|
||||
|
||||
inline void SetInitialFont(const wxFont& font) { initialFont = font; }
|
||||
inline wxFont GetInitialFont() const { return initialFont; }
|
||||
|
||||
inline void SetChosenFont(const wxFont& font) { chosenFont = font; }
|
||||
inline wxFont GetChosenFont() const { return chosenFont; }
|
||||
|
||||
inline void SetRange(int minRange, int maxRange) { minSize = minRange; maxSize = maxRange; }
|
||||
|
||||
void operator=(const wxFontData& data);
|
||||
|
||||
public:
|
||||
wxColour fontColour;
|
||||
bool showHelp;
|
||||
bool allowSymbols;
|
||||
@@ -54,153 +87,242 @@ class WXDLLEXPORT wxFontData: public wxObject
|
||||
wxFont chosenFont;
|
||||
int minSize;
|
||||
int maxSize;
|
||||
|
||||
wxFontData(void);
|
||||
~wxFontData(void);
|
||||
|
||||
inline void SetAllowSymbols(bool flag) { allowSymbols = flag; }
|
||||
inline bool GetAllowSymbols(void) { return allowSymbols; }
|
||||
inline void SetColour(const wxColour& colour) { fontColour = colour; }
|
||||
inline wxColour &GetColour(void) { return fontColour; }
|
||||
inline void SetShowHelp(bool flag) { showHelp = flag; }
|
||||
inline bool GetShowHelp(void) { return showHelp; }
|
||||
inline void EnableEffects(bool flag) { enableEffects = flag; }
|
||||
inline bool GetEnableEffects(void) { return enableEffects; }
|
||||
inline void SetInitialFont(const wxFont& font) { initialFont = font; }
|
||||
inline wxFont GetInitialFont(void) { return initialFont; }
|
||||
inline void SetChosenFont(const wxFont& font) { chosenFont = font; }
|
||||
inline wxFont GetChosenFont(void) { return chosenFont; }
|
||||
inline void SetRange(int minRange, int maxRange) { minSize = minRange; maxSize = maxRange; }
|
||||
|
||||
void operator=(const wxFontData& data);
|
||||
};
|
||||
|
||||
/*
|
||||
* wxPrintData
|
||||
* Encapsulates information displayed and edited in the printer dialog box.
|
||||
* Encapsulates printer information (not printer dialog information)
|
||||
*/
|
||||
|
||||
class WXDLLEXPORT wxPrintData: public wxObject
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxPrintData)
|
||||
|
||||
public:
|
||||
#ifdef __WXMSW__
|
||||
void *printData;
|
||||
#endif
|
||||
int printFromPage;
|
||||
int printToPage;
|
||||
int printMinPage;
|
||||
int printMaxPage;
|
||||
int printNoCopies;
|
||||
int printOrientation;
|
||||
bool printAllPages;
|
||||
bool printCollate;
|
||||
bool printToFile;
|
||||
bool printEnableSelection;
|
||||
bool printEnablePageNumbers;
|
||||
bool printEnableHelp;
|
||||
bool printEnablePrintToFile;
|
||||
bool printSetupDialog;
|
||||
wxPrintData();
|
||||
wxPrintData(const wxPrintData& printData);
|
||||
~wxPrintData();
|
||||
|
||||
wxPrintData(void);
|
||||
~wxPrintData(void);
|
||||
inline int GetNoCopies() const { return m_printNoCopies; };
|
||||
inline bool GetCollate() const { return m_printCollate; };
|
||||
inline int GetOrientation() const { return m_printOrientation; };
|
||||
|
||||
inline int GetFromPage(void) { return printFromPage; };
|
||||
inline int GetToPage(void) { return printToPage; };
|
||||
inline int GetMinPage(void) { return printMinPage; };
|
||||
inline int GetMaxPage(void) { return printMaxPage; };
|
||||
inline int GetNoCopies(void) { return printNoCopies; };
|
||||
inline bool GetAllPages(void) { return printAllPages; };
|
||||
inline bool GetCollate(void) { return printCollate; };
|
||||
inline bool GetPrintToFile(void) { return printToFile; };
|
||||
inline bool GetSetupDialog(void) { return printSetupDialog; };
|
||||
inline int GetOrientation(void) { return printOrientation; };
|
||||
inline const wxString& GetPrinterName() const { return m_printerName; }
|
||||
inline bool GetColour() const { return m_colour; }
|
||||
inline wxDuplexMode GetDuplex() const { return m_duplexMode; }
|
||||
inline wxPaperSize GetPaperId() const { return m_paperId; }
|
||||
inline const wxSize& GetPaperSize() const { return m_paperSize; } // Not used yet: confusable with paper size
|
||||
// in wxPageSetupDialogData
|
||||
inline wxPrintQuality GetQuality() const { return m_printQuality; }
|
||||
|
||||
inline void SetFromPage(int v) { printFromPage = v; };
|
||||
inline void SetToPage(int v) { printToPage = v; };
|
||||
inline void SetMinPage(int v) { printMinPage = v; };
|
||||
inline void SetMaxPage(int v) { printMaxPage = v; };
|
||||
inline void SetNoCopies(int v) { printNoCopies = v; };
|
||||
inline void SetAllPages(bool flag) { printAllPages = flag; };
|
||||
inline void SetCollate(bool flag) { printCollate = flag; };
|
||||
inline void SetPrintToFile(bool flag) { printToFile = flag; };
|
||||
inline void SetSetupDialog(bool flag) { printSetupDialog = flag; };
|
||||
inline void SetOrientation(int orient) { printOrientation = orient; };
|
||||
inline void SetNoCopies(int v) { m_printNoCopies = v; };
|
||||
inline void SetCollate(bool flag) { m_printCollate = flag; };
|
||||
inline void SetOrientation(int orient) { m_printOrientation = orient; };
|
||||
|
||||
inline void EnablePrintToFile(bool flag) { printEnablePrintToFile = flag; };
|
||||
inline void EnableSelection(bool flag) { printEnableSelection = flag; };
|
||||
inline void EnablePageNumbers(bool flag) { printEnablePageNumbers = flag; };
|
||||
inline void EnableHelp(bool flag) { printEnableHelp = flag; };
|
||||
inline void SetPrinterName(const wxString& name) { m_printerName = name; }
|
||||
inline void SetColour(bool colour) { m_colour = colour; }
|
||||
inline void SetDuplex(wxDuplexMode duplex) { m_duplexMode = duplex; }
|
||||
inline void SetPaperId(wxPaperSize sizeId) { m_paperId = sizeId; }
|
||||
inline void SetPaperSize(const wxSize& sz) { m_paperSize = sz; }
|
||||
inline void SetQuality(wxPrintQuality quality) { m_printQuality = quality; }
|
||||
|
||||
inline bool GetEnablePrintToFile(void) { return printEnablePrintToFile; };
|
||||
inline bool GetEnableSelection(void) { return printEnableSelection; };
|
||||
inline bool GetEnablePageNumbers(void) { return printEnablePageNumbers; };
|
||||
inline bool GetEnableHelp(void) { return printEnableHelp; };
|
||||
// PostScript-specific data
|
||||
inline const wxString& GetPrinterCommand() const { return m_printerCommand; }
|
||||
inline const wxString& GetPrinterOptions() const { return m_printerOptions; }
|
||||
inline const wxString& GetPreviewCommand() const { return m_previewCommand; }
|
||||
inline const wxString& GetFilename() const { return m_filename; }
|
||||
inline const wxString& GetFontMetricPath() const { return m_afmPath; }
|
||||
inline double GetPrinterScaleX() const { return m_printerScaleX; }
|
||||
inline double GetPrinterScaleY() const { return m_printerScaleY; }
|
||||
inline long GetPrinterTranslateX() const { return m_printerTranslateX; }
|
||||
inline long GetPrinterTranslateY() const { return m_printerTranslateY; }
|
||||
inline wxPrintMode GetPrintMode() const { return m_printMode; }
|
||||
|
||||
inline void SetPrinterCommand(const wxString& command) { m_printerCommand = command; }
|
||||
inline void SetPrinterOptions(const wxString& options) { m_printerOptions = options; }
|
||||
inline void SetPreviewCommand(const wxString& command) { m_previewCommand = command; }
|
||||
inline void SetFilename(const wxString& filename) { m_filename = filename; }
|
||||
inline void SetFontMetricPath(const wxString& path) { m_afmPath = path; }
|
||||
inline void SetPrinterScaleX(double x) { m_printerScaleX = x; }
|
||||
inline void SetPrinterScaleY(double y) { m_printerScaleY = y; }
|
||||
inline void SetPrinterScaling(double x, double y) { m_printerScaleX = x; m_printerScaleY = y; }
|
||||
inline void SetPrinterTranslateX(long x) { m_printerTranslateX = x; }
|
||||
inline void SetPrinterTranslateY(long y) { m_printerTranslateY = y; }
|
||||
inline void SetPrinterTranslation(long x, long y) { m_printerTranslateX = x; m_printerTranslateY = y; }
|
||||
inline void SetPrintMode(wxPrintMode printMode) { m_printMode = printMode; }
|
||||
|
||||
void operator=(const wxPrintData& data);
|
||||
|
||||
#ifdef __WXMSW__
|
||||
// Convert to/from the PRINTDLG structure
|
||||
void ConvertToNative(void);
|
||||
void ConvertFromNative(void);
|
||||
void SetOwnerWindow(wxWindow* win);
|
||||
inline void* GetNativeData(void) { return printData; }
|
||||
// For compatibility
|
||||
#if (defined(__WXMOTIF__) || defined(__WXGTK__)) && wxUSE_POSTSCRIPT
|
||||
void operator=(const wxPrintSetupData& setupData);
|
||||
#endif
|
||||
|
||||
#ifdef __WXMSW__
|
||||
// Convert to/from the DEVMODE structure
|
||||
void ConvertToNative();
|
||||
void ConvertFromNative();
|
||||
inline void* GetNativeData() const { return m_devMode; }
|
||||
inline void SetNativeData(void* data) { m_devMode = data; }
|
||||
#endif
|
||||
|
||||
public:
|
||||
#ifdef __WXMSW__
|
||||
void* m_devMode;
|
||||
#endif
|
||||
|
||||
private:
|
||||
|
||||
int m_printNoCopies;
|
||||
int m_printOrientation;
|
||||
bool m_printCollate;
|
||||
|
||||
// New members, 24/3/99
|
||||
wxString m_printerName;
|
||||
bool m_colour;
|
||||
wxDuplexMode m_duplexMode;
|
||||
wxPrintQuality m_printQuality;
|
||||
wxPaperSize m_paperId;
|
||||
wxSize m_paperSize;
|
||||
|
||||
// PostScript-specific data
|
||||
wxString m_printerCommand;
|
||||
wxString m_previewCommand;
|
||||
wxString m_printerOptions;
|
||||
wxString m_filename;
|
||||
wxString m_afmPath;
|
||||
double m_printerScaleX;
|
||||
double m_printerScaleY;
|
||||
long m_printerTranslateX;
|
||||
long m_printerTranslateY;
|
||||
wxPrintMode m_printMode;
|
||||
};
|
||||
|
||||
/*
|
||||
* This is the data used (and returned) by the wxPageSetupDialog.
|
||||
* wxPrintDialogData
|
||||
* Encapsulates information displayed and edited in the printer dialog box.
|
||||
* Contains a wxPrintData object which is filled in according to the values retrieved
|
||||
* from the dialog.
|
||||
*/
|
||||
|
||||
class WXDLLEXPORT wxPageSetupData: public wxObject
|
||||
class WXDLLEXPORT wxPrintDialogData: public wxObject
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxPageSetupData)
|
||||
DECLARE_DYNAMIC_CLASS(wxPrintDialogData)
|
||||
|
||||
public:
|
||||
#if defined(__WIN95__)
|
||||
void* m_pageSetupData;
|
||||
wxPrintDialogData();
|
||||
wxPrintDialogData(const wxPrintDialogData& dialogData);
|
||||
wxPrintDialogData(const wxPrintData& printData);
|
||||
~wxPrintDialogData();
|
||||
|
||||
inline int GetFromPage() const { return m_printFromPage; };
|
||||
inline int GetToPage() const { return m_printToPage; };
|
||||
inline int GetMinPage() const { return m_printMinPage; };
|
||||
inline int GetMaxPage() const { return m_printMaxPage; };
|
||||
inline int GetNoCopies() const { return m_printNoCopies; };
|
||||
inline bool GetAllPages() const { return m_printAllPages; };
|
||||
inline bool GetCollate() const { return m_printCollate; };
|
||||
inline bool GetPrintToFile() const { return m_printToFile; };
|
||||
inline bool GetSetupDialog() const { return m_printSetupDialog; };
|
||||
|
||||
inline void SetFromPage(int v) { m_printFromPage = v; };
|
||||
inline void SetToPage(int v) { m_printToPage = v; };
|
||||
inline void SetMinPage(int v) { m_printMinPage = v; };
|
||||
inline void SetMaxPage(int v) { m_printMaxPage = v; };
|
||||
inline void SetNoCopies(int v) { m_printNoCopies = v; };
|
||||
inline void SetAllPages(bool flag) { m_printAllPages = flag; };
|
||||
inline void SetCollate(bool flag) { m_printCollate = flag; };
|
||||
inline void SetPrintToFile(bool flag) { m_printToFile = flag; };
|
||||
inline void SetSetupDialog(bool flag) { m_printSetupDialog = flag; };
|
||||
|
||||
inline void EnablePrintToFile(bool flag) { m_printEnablePrintToFile = flag; };
|
||||
inline void EnableSelection(bool flag) { m_printEnableSelection = flag; };
|
||||
inline void EnablePageNumbers(bool flag) { m_printEnablePageNumbers = flag; };
|
||||
inline void EnableHelp(bool flag) { m_printEnableHelp = flag; };
|
||||
|
||||
inline bool GetEnablePrintToFile() const { return m_printEnablePrintToFile; };
|
||||
inline bool GetEnableSelection() const { return m_printEnableSelection; };
|
||||
inline bool GetEnablePageNumbers() const { return m_printEnablePageNumbers; };
|
||||
inline bool GetEnableHelp() const { return m_printEnableHelp; };
|
||||
|
||||
inline wxPrintData& GetPrintData() { return m_printData; }
|
||||
inline void SetPrintData(const wxPrintData& printData) { m_printData = printData; }
|
||||
|
||||
void operator=(const wxPrintDialogData& data);
|
||||
void operator=(const wxPrintData& data); // Sets internal m_printData member
|
||||
|
||||
#ifdef __WXMSW__
|
||||
// Convert to/from the PRINTDLG structure
|
||||
void ConvertToNative();
|
||||
void ConvertFromNative();
|
||||
void SetOwnerWindow(wxWindow* win);
|
||||
inline void* GetNativeData() const { return m_printDlgData; }
|
||||
#endif
|
||||
wxPoint m_paperSize;
|
||||
wxPoint m_minMarginTopLeft;
|
||||
wxPoint m_minMarginBottomRight;
|
||||
wxPoint m_marginTopLeft;
|
||||
wxPoint m_marginBottomRight;
|
||||
int m_orientation;
|
||||
|
||||
// Flags
|
||||
bool m_defaultMinMargins;
|
||||
bool m_enableMargins;
|
||||
bool m_enableOrientation;
|
||||
bool m_enablePaper;
|
||||
bool m_enablePrinter;
|
||||
bool m_getDefaultInfo; // Equiv. to PSD_RETURNDEFAULT
|
||||
bool m_enableHelp;
|
||||
#ifdef __WXMSW__
|
||||
void* m_printDlgData;
|
||||
#endif
|
||||
|
||||
wxPageSetupData(void);
|
||||
~wxPageSetupData(void);
|
||||
private:
|
||||
|
||||
inline wxPoint GetPaperSize(void) { return m_paperSize; };
|
||||
inline wxPoint GetMinMarginTopLeft(void) { return m_minMarginTopLeft; };
|
||||
inline wxPoint GetMinMarginBottomRight(void) { return m_minMarginBottomRight; };
|
||||
inline wxPoint GetMarginTopLeft(void) { return m_marginTopLeft; };
|
||||
inline wxPoint GetMarginBottomRight(void) { return m_marginBottomRight; };
|
||||
inline int GetOrientation(void) { return m_orientation; };
|
||||
int m_printFromPage;
|
||||
int m_printToPage;
|
||||
int m_printMinPage;
|
||||
int m_printMaxPage;
|
||||
int m_printNoCopies;
|
||||
bool m_printAllPages;
|
||||
bool m_printCollate;
|
||||
bool m_printToFile;
|
||||
bool m_printEnableSelection;
|
||||
bool m_printEnablePageNumbers;
|
||||
bool m_printEnableHelp;
|
||||
bool m_printEnablePrintToFile;
|
||||
bool m_printSetupDialog;
|
||||
|
||||
inline bool GetDefaultMinMargins(void) { return m_defaultMinMargins; };
|
||||
inline bool GetEnableMargins(void) { return m_enableMargins; };
|
||||
inline bool GetEnableOrientation(void) { return m_enableOrientation; };
|
||||
inline bool GetEnablePaper(void) { return m_enablePaper; };
|
||||
inline bool GetEnablePrinter(void) { return m_enablePrinter; };
|
||||
inline bool GetDefaultInfo(void) { return m_getDefaultInfo; };
|
||||
inline bool GetEnableHelp(void) { return m_enableHelp; };
|
||||
wxPrintData m_printData;
|
||||
};
|
||||
|
||||
/*
|
||||
* This is the data used (and returned) by the wxPageSetupDialog.
|
||||
*/
|
||||
|
||||
// Compatibility with old name
|
||||
#define wxPageSetupData wxPageSetupDialogData
|
||||
|
||||
class WXDLLEXPORT wxPageSetupDialogData: public wxObject
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxPageSetupDialogData)
|
||||
|
||||
public:
|
||||
wxPageSetupDialogData();
|
||||
wxPageSetupDialogData(const wxPageSetupDialogData& dialogData);
|
||||
wxPageSetupDialogData(const wxPrintData& printData);
|
||||
~wxPageSetupDialogData();
|
||||
|
||||
inline wxSize GetPaperSize() const { return m_paperSize; };
|
||||
inline wxPaperSize GetPaperId() const { return m_printData.GetPaperId(); };
|
||||
inline wxPoint GetMinMarginTopLeft() const { return m_minMarginTopLeft; };
|
||||
inline wxPoint GetMinMarginBottomRight() const { return m_minMarginBottomRight; };
|
||||
inline wxPoint GetMarginTopLeft() const { return m_marginTopLeft; };
|
||||
inline wxPoint GetMarginBottomRight() const { return m_marginBottomRight; };
|
||||
|
||||
inline bool GetDefaultMinMargins() const { return m_defaultMinMargins; };
|
||||
inline bool GetEnableMargins() const { return m_enableMargins; };
|
||||
inline bool GetEnableOrientation() const { return m_enableOrientation; };
|
||||
inline bool GetEnablePaper() const { return m_enablePaper; };
|
||||
inline bool GetEnablePrinter() const { return m_enablePrinter; };
|
||||
inline bool GetDefaultInfo() const { return m_getDefaultInfo; };
|
||||
inline bool GetEnableHelp() const { return m_enableHelp; };
|
||||
|
||||
// If a corresponding paper type is found in the paper database, will set the m_printData
|
||||
// paper size id member as well.
|
||||
void SetPaperSize(const wxSize& sz);
|
||||
|
||||
// Sets the wxPrintData id, plus the paper width/height if found in the paper database.
|
||||
void SetPaperSize(wxPaperSize id);
|
||||
|
||||
inline void SetPaperSize(const wxPoint& pt) { m_paperSize = pt; };
|
||||
inline void SetMinMarginTopLeft(const wxPoint& pt) { m_minMarginTopLeft = pt; };
|
||||
inline void SetMinMarginBottomRight(const wxPoint& pt) { m_minMarginBottomRight = pt; };
|
||||
inline void SetMarginTopLeft(const wxPoint& pt) { m_marginTopLeft = pt; };
|
||||
inline void SetMarginBottomRight(const wxPoint& pt) { m_marginBottomRight = pt; };
|
||||
inline void SetOrientation(int orient) { m_orientation = orient; };
|
||||
inline void SetDefaultMinMargins(bool flag) { m_defaultMinMargins = flag; };
|
||||
inline void SetDefaultInfo(bool flag) { m_getDefaultInfo = flag; };
|
||||
|
||||
@@ -212,15 +334,48 @@ class WXDLLEXPORT wxPageSetupData: public wxObject
|
||||
|
||||
#if defined(__WIN95__)
|
||||
// Convert to/from the PAGESETUPDLG structure
|
||||
void ConvertToNative(void);
|
||||
void ConvertFromNative(void);
|
||||
void ConvertToNative();
|
||||
void ConvertFromNative();
|
||||
void SetOwnerWindow(wxWindow* win);
|
||||
inline void* GetNativeData(void) { return m_pageSetupData; }
|
||||
inline void* GetNativeData() const { return m_pageSetupData; }
|
||||
#endif
|
||||
|
||||
// Use paper size defined in this object to set the wxPrintData
|
||||
// paper id
|
||||
void CalculateIdFromPaperSize();
|
||||
|
||||
// Use paper id in wxPrintData to set this object's paper size
|
||||
void CalculatePaperSizeFromId();
|
||||
|
||||
void operator=(const wxPageSetupData& data);
|
||||
void operator=(const wxPrintData& data);
|
||||
|
||||
inline wxPrintData& GetPrintData() { return m_printData; }
|
||||
inline void SetPrintData(const wxPrintData& printData) { m_printData = printData; }
|
||||
|
||||
#if defined(__WIN95__)
|
||||
void* m_pageSetupData;
|
||||
#endif
|
||||
|
||||
private:
|
||||
|
||||
wxSize m_paperSize; // The dimensions selected by the user (on return, same as in wxPrintData?)
|
||||
wxPoint m_minMarginTopLeft;
|
||||
wxPoint m_minMarginBottomRight;
|
||||
wxPoint m_marginTopLeft;
|
||||
wxPoint m_marginBottomRight;
|
||||
|
||||
// Flags
|
||||
bool m_defaultMinMargins;
|
||||
bool m_enableMargins;
|
||||
bool m_enableOrientation;
|
||||
bool m_enablePaper;
|
||||
bool m_enablePrinter;
|
||||
bool m_getDefaultInfo; // Equiv. to PSD_RETURNDEFAULT
|
||||
bool m_enableHelp;
|
||||
|
||||
wxPrintData m_printData;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
// _WX_CMNDATA_H_BASE_
|
||||
// _WX_CMNDATA_H_BASE_
|
||||
|
@@ -868,12 +868,6 @@ enum
|
||||
wxWIN386 // Watcom 32-bit supervisor modus
|
||||
};
|
||||
|
||||
/* Printing */
|
||||
#ifndef wxPORTRAIT
|
||||
#define wxPORTRAIT 1
|
||||
#define wxLANDSCAPE 2
|
||||
#endif
|
||||
|
||||
/* Standard menu identifiers */
|
||||
#define wxID_LOWEST 4999
|
||||
|
||||
@@ -939,6 +933,115 @@ enum
|
||||
/* Shortcut for easier dialog-unit-to-pixel conversion */
|
||||
#define wxDLG_UNIT(parent, pt) parent->ConvertDialogToPixels(pt)
|
||||
|
||||
/* Paper types */
|
||||
typedef enum {
|
||||
wxPAPER_NONE, // Use specific dimensions
|
||||
wxPAPER_LETTER, // Letter, 8 1/2 by 11 inches
|
||||
wxPAPER_LEGAL, // Legal, 8 1/2 by 14 inches
|
||||
wxPAPER_A4, // A4 Sheet, 210 by 297 millimeters
|
||||
wxPAPER_CSHEET, // C Sheet, 17 by 22 inches
|
||||
wxPAPER_DSHEET, // D Sheet, 22 by 34 inches
|
||||
wxPAPER_ESHEET, // E Sheet, 34 by 44 inches
|
||||
wxPAPER_LETTERSMALL, // Letter Small, 8 1/2 by 11 inches
|
||||
wxPAPER_TABLOID, // Tabloid, 11 by 17 inches
|
||||
wxPAPER_LEDGER, // Ledger, 17 by 11 inches
|
||||
wxPAPER_STATEMENT, // Statement, 5 1/2 by 8 1/2 inches
|
||||
wxPAPER_EXECUTIVE, // Executive, 7 1/4 by 10 1/2 inches
|
||||
wxPAPER_A3, // A3 sheet, 297 by 420 millimeters
|
||||
wxPAPER_A4SMALL, // A4 small sheet, 210 by 297 millimeters
|
||||
wxPAPER_A5, // A5 sheet, 148 by 210 millimeters
|
||||
wxPAPER_B4, // B4 sheet, 250 by 354 millimeters
|
||||
wxPAPER_B5, // B5 sheet, 182-by-257-millimeter paper
|
||||
wxPAPER_FOLIO, // Folio, 8-1/2-by-13-inch paper
|
||||
wxPAPER_QUARTO, // Quarto, 215-by-275-millimeter paper
|
||||
wxPAPER_10X14, // 10-by-14-inch sheet
|
||||
wxPAPER_11X17, // 11-by-17-inch sheet
|
||||
wxPAPER_NOTE, // Note, 8 1/2 by 11 inches
|
||||
wxPAPER_ENV_9, // #9 Envelope, 3 7/8 by 8 7/8 inches
|
||||
wxPAPER_ENV_10, // #10 Envelope, 4 1/8 by 9 1/2 inches
|
||||
wxPAPER_ENV_11, // #11 Envelope, 4 1/2 by 10 3/8 inches
|
||||
wxPAPER_ENV_12, // #12 Envelope, 4 3/4 by 11 inches
|
||||
wxPAPER_ENV_14, // #14 Envelope, 5 by 11 1/2 inches
|
||||
wxPAPER_ENV_DL, // DL Envelope, 110 by 220 millimeters
|
||||
wxPAPER_ENV_C5, // C5 Envelope, 162 by 229 millimeters
|
||||
wxPAPER_ENV_C3, // C3 Envelope, 324 by 458 millimeters
|
||||
wxPAPER_ENV_C4, // C4 Envelope, 229 by 324 millimeters
|
||||
wxPAPER_ENV_C6, // C6 Envelope, 114 by 162 millimeters
|
||||
wxPAPER_ENV_C65, // C65 Envelope, 114 by 229 millimeters
|
||||
wxPAPER_ENV_B4, // B4 Envelope, 250 by 353 millimeters
|
||||
wxPAPER_ENV_B5, // B5 Envelope, 176 by 250 millimeters
|
||||
wxPAPER_ENV_B6, // B6 Envelope, 176 by 125 millimeters
|
||||
wxPAPER_ENV_ITALY, // Italy Envelope, 110 by 230 millimeters
|
||||
wxPAPER_ENV_MONARCH, // Monarch Envelope, 3 7/8 by 7 1/2 inches
|
||||
wxPAPER_ENV_PERSONAL, // 6 3/4 Envelope, 3 5/8 by 6 1/2 inches
|
||||
wxPAPER_FANFOLD_US, // US Std Fanfold, 14 7/8 by 11 inches
|
||||
wxPAPER_FANFOLD_STD_GERMAN, // German Std Fanfold, 8 1/2 by 12 inches
|
||||
wxPAPER_FANFOLD_LGL_GERMAN, // German Legal Fanfold, 8 1/2 by 13 inches
|
||||
|
||||
wxPAPER_ISO_B4, // B4 (ISO) 250 x 353 mm
|
||||
wxPAPER_JAPANESE_POSTCARD, // Japanese Postcard 100 x 148 mm
|
||||
wxPAPER_9X11, // 9 x 11 in
|
||||
wxPAPER_10X11, // 10 x 11 in
|
||||
wxPAPER_15X11, // 15 x 11 in
|
||||
wxPAPER_ENV_INVITE, // Envelope Invite 220 x 220 mm
|
||||
wxPAPER_LETTER_EXTRA, // Letter Extra 9 \275 x 12 in
|
||||
wxPAPER_LEGAL_EXTRA, // Legal Extra 9 \275 x 15 in
|
||||
wxPAPER_TABLOID_EXTRA, // Tabloid Extra 11.69 x 18 in
|
||||
wxPAPER_A4_EXTRA, // A4 Extra 9.27 x 12.69 in
|
||||
wxPAPER_LETTER_TRANSVERSE, // Letter Transverse 8 \275 x 11 in
|
||||
wxPAPER_A4_TRANSVERSE, // A4 Transverse 210 x 297 mm
|
||||
wxPAPER_LETTER_EXTRA_TRANSVERSE, // Letter Extra Transverse 9\275 x 12 in
|
||||
wxPAPER_A_PLUS, // SuperA/SuperA/A4 227 x 356 mm
|
||||
wxPAPER_B_PLUS, // SuperB/SuperB/A3 305 x 487 mm
|
||||
wxPAPER_LETTER_PLUS, // Letter Plus 8.5 x 12.69 in
|
||||
wxPAPER_A4_PLUS, // A4 Plus 210 x 330 mm
|
||||
wxPAPER_A5_TRANSVERSE, // A5 Transverse 148 x 210 mm
|
||||
wxPAPER_B5_TRANSVERSE, // B5 (JIS) Transverse 182 x 257 mm
|
||||
wxPAPER_A3_EXTRA, // A3 Extra 322 x 445 mm
|
||||
wxPAPER_A5_EXTRA, // A5 Extra 174 x 235 mm
|
||||
wxPAPER_B5_EXTRA, // B5 (ISO) Extra 201 x 276 mm
|
||||
wxPAPER_A2, // A2 420 x 594 mm
|
||||
wxPAPER_A3_TRANSVERSE, // A3 Transverse 297 x 420 mm
|
||||
wxPAPER_A3_EXTRA_TRANSVERSE // A3 Extra Transverse 322 x 445 mm
|
||||
|
||||
} wxPaperSize ;
|
||||
|
||||
/* Printing orientation */
|
||||
#ifndef wxPORTRAIT
|
||||
#define wxPORTRAIT 1
|
||||
#define wxLANDSCAPE 2
|
||||
#endif
|
||||
|
||||
/* Duplex printing modes
|
||||
*/
|
||||
|
||||
typedef enum {
|
||||
wxDUPLEX_SIMPLEX, // Non-duplex
|
||||
wxDUPLEX_HORIZONTAL,
|
||||
wxDUPLEX_VERTICAL
|
||||
} wxDuplexMode;
|
||||
|
||||
/* Print quality.
|
||||
*/
|
||||
|
||||
#define wxPRINT_QUALITY_HIGH -1
|
||||
#define wxPRINT_QUALITY_MEDIUM -2
|
||||
#define wxPRINT_QUALITY_LOW -3
|
||||
#define wxPRINT_QUALITY_DRAFT -4
|
||||
|
||||
typedef int wxPrintQuality;
|
||||
|
||||
/* Print mode (currently PostScript only)
|
||||
*/
|
||||
|
||||
typedef enum {
|
||||
wxPRINT_MODE_NONE = 0,
|
||||
wxPRINT_MODE_PREVIEW = 1, // Preview in external application
|
||||
wxPRINT_MODE_FILE = 2, // Print to file
|
||||
wxPRINT_MODE_PRINTER = 3 // Send to printer
|
||||
} wxPrintMode;
|
||||
|
||||
|
||||
#ifdef __WXMSW__
|
||||
/* Stand-ins for Windows types, to avoid
|
||||
* #including all of windows.h */
|
||||
|
@@ -69,6 +69,7 @@ public:
|
||||
inline wxSize(long xx, long yy) { x = xx; y = yy; }
|
||||
inline wxSize(const wxSize& sz) { x = sz.x; y = sz.y; }
|
||||
inline void operator = (const wxSize& sz) { x = sz.x; y = sz.y; }
|
||||
inline bool operator == (const wxSize& sz) const { return (x == sz.x && y == sz.y); }
|
||||
inline wxSize operator + (const wxSize& sz) { return wxSize(x + sz.x, y + sz.y); }
|
||||
inline wxSize operator - (const wxSize& sz) { return wxSize(x - sz.x, y - sz.y); }
|
||||
inline void Set(long xx, long yy) { x = xx; y = yy; }
|
||||
@@ -88,6 +89,7 @@ class WXDLLEXPORT wxRealPoint
|
||||
inline wxRealPoint operator - (const wxRealPoint& pt) { return wxRealPoint(x - pt.x, y - pt.y); }
|
||||
|
||||
inline void operator = (const wxRealPoint& pt) { x = pt.x; y = pt.y; }
|
||||
inline bool operator == (const wxRealPoint& pt) const { return (x == pt.x && y == pt.y); }
|
||||
};
|
||||
|
||||
class WXDLLEXPORT wxPoint
|
||||
@@ -106,6 +108,7 @@ class WXDLLEXPORT wxPoint
|
||||
wxPoint(const wxPoint& pt) { x = pt.x; y = pt.y; };
|
||||
|
||||
inline void operator = (const wxPoint& pt) { x = pt.x; y = pt.y; }
|
||||
inline bool operator == (const wxPoint& pt) const { return (x == pt.x && y == pt.y); }
|
||||
inline wxPoint operator + (const wxPoint& pt) { return wxPoint(x + pt.x, y + pt.y); }
|
||||
inline wxPoint operator - (const wxPoint& pt) { return wxPoint(x - pt.x, y - pt.y); }
|
||||
};
|
||||
|
@@ -21,6 +21,7 @@
|
||||
|
||||
#include "wx/dialog.h"
|
||||
#include "wx/module.h"
|
||||
#include "wx/cmndata.h"
|
||||
#include <fstream.h>
|
||||
|
||||
|
||||
@@ -41,14 +42,21 @@ class WXDLLEXPORT wxPostScriptDC: public wxDC
|
||||
public:
|
||||
|
||||
wxPostScriptDC();
|
||||
|
||||
// Deprecated constructor
|
||||
wxPostScriptDC(const wxString& output, bool interactive = TRUE, wxWindow *parent = (wxWindow *) NULL);
|
||||
|
||||
// Recommended constructor
|
||||
wxPostScriptDC(const wxPrintData& printData);
|
||||
|
||||
~wxPostScriptDC();
|
||||
|
||||
// Deprecated
|
||||
bool Create(const wxString& output, bool interactive = TRUE, wxWindow *parent = (wxWindow *) NULL);
|
||||
|
||||
virtual bool Ok() const;
|
||||
|
||||
// Deprecated: use wxGenericPrintDialog instead
|
||||
virtual bool PrinterDialog(wxWindow *parent = (wxWindow *) NULL);
|
||||
|
||||
virtual void BeginDrawing() {}
|
||||
@@ -112,7 +120,10 @@ public:
|
||||
wxFont *theFont = (wxFont *) NULL, bool use16 = FALSE);
|
||||
|
||||
void GetSize(int* width, int* height) const;
|
||||
void GetSizeMM(long *width, long *height) const;
|
||||
void GetSizeMM(int *width, int *height) const;
|
||||
|
||||
// Resolution in pixels per logical inch
|
||||
wxSize GetPPI(void) const;
|
||||
|
||||
void SetAxisOrientation( bool xLeftRight, bool yBottomUp );
|
||||
void SetDeviceOrigin( long x, long y );
|
||||
@@ -122,6 +133,9 @@ public:
|
||||
|
||||
inline ofstream *GetStream(void) const { return m_pstream; }
|
||||
|
||||
inline wxPrintData& GetPrintData() { return m_printData; }
|
||||
inline void SetPrintData(const wxPrintData& data) { m_printData = data; }
|
||||
|
||||
protected:
|
||||
|
||||
ofstream * m_pstream; // PostScript output stream
|
||||
@@ -133,9 +147,10 @@ protected:
|
||||
bool m_clipping;
|
||||
double m_underlinePosition;
|
||||
double m_underlineThickness;
|
||||
wxPrintData m_printData;
|
||||
};
|
||||
|
||||
// TODO Needed? Should perhaps use wxGenericPrintDialog instead.
|
||||
// Deprecated: should use wxGenericPrintDialog instead.
|
||||
#if 1
|
||||
#define wxID_PRINTER_COMMAND 1
|
||||
#define wxID_PRINTER_OPTIONS 2
|
||||
@@ -166,89 +181,94 @@ enum {
|
||||
|
||||
// Print Actions
|
||||
enum {
|
||||
PS_PRINTER,
|
||||
PS_NONE,
|
||||
PS_PREVIEW,
|
||||
PS_FILE,
|
||||
PS_PREVIEW
|
||||
PS_PRINTER
|
||||
};// ps_action = PS_PREVIEW;
|
||||
|
||||
// PostScript printer settings
|
||||
WXDLLEXPORT void wxSetPrinterCommand(const char *cmd);
|
||||
WXDLLEXPORT void wxSetPrintPreviewCommand(const char *cmd);
|
||||
WXDLLEXPORT void wxSetPrinterOptions(const char *flags);
|
||||
WXDLLEXPORT void wxSetPrinterCommand(const wxString& cmd);
|
||||
WXDLLEXPORT void wxSetPrintPreviewCommand(const wxString& cmd);
|
||||
WXDLLEXPORT void wxSetPrinterOptions(const wxString& flags);
|
||||
WXDLLEXPORT void wxSetPrinterOrientation(int orientation);
|
||||
WXDLLEXPORT void wxSetPrinterScaling(double x, double y);
|
||||
WXDLLEXPORT void wxSetPrinterTranslation(long x, long y);
|
||||
WXDLLEXPORT void wxSetPrinterMode(int mode);
|
||||
WXDLLEXPORT void wxSetPrinterFile(const char *f);
|
||||
WXDLLEXPORT void wxSetAFMPath(const char *f);
|
||||
WXDLLEXPORT void wxSetPrinterFile(const wxString& f);
|
||||
WXDLLEXPORT void wxSetAFMPath(const wxString& f);
|
||||
|
||||
// Get current values
|
||||
WXDLLEXPORT char* wxGetPrinterCommand();
|
||||
WXDLLEXPORT char* wxGetPrintPreviewCommand();
|
||||
WXDLLEXPORT char* wxGetPrinterOptions();
|
||||
WXDLLEXPORT wxString wxGetPrinterCommand();
|
||||
WXDLLEXPORT wxString wxGetPrintPreviewCommand();
|
||||
WXDLLEXPORT wxString wxGetPrinterOptions();
|
||||
WXDLLEXPORT int wxGetPrinterOrientation();
|
||||
WXDLLEXPORT void wxGetPrinterScaling(double* x, double* y);
|
||||
WXDLLEXPORT void wxGetPrinterTranslation(long *x, long *y);
|
||||
WXDLLEXPORT int wxGetPrinterMode();
|
||||
WXDLLEXPORT char* wxGetPrinterFile();
|
||||
WXDLLEXPORT char* wxGetAFMPath();
|
||||
WXDLLEXPORT wxString wxGetPrinterFile();
|
||||
WXDLLEXPORT wxString wxGetAFMPath();
|
||||
|
||||
/*
|
||||
* PostScript print setup information
|
||||
* PostScript print setup information.
|
||||
* This is now obsolete, but retained for a while for compatibility
|
||||
*/
|
||||
|
||||
class WXDLLEXPORT wxPrintSetupData: public wxObject
|
||||
{
|
||||
public:
|
||||
char *printerCommand;
|
||||
char *previewCommand;
|
||||
char *printerFlags;
|
||||
char *printerFile;
|
||||
int printerOrient;
|
||||
double printerScaleX;
|
||||
double printerScaleY;
|
||||
long printerTranslateX;
|
||||
long printerTranslateY;
|
||||
// 1 = Preview, 2 = print to file, 3 = send to printer
|
||||
int printerMode;
|
||||
char *afmPath;
|
||||
// A name in the paper database (see wx_print.h: the printing framework)
|
||||
char *paperName;
|
||||
bool printColour;
|
||||
|
||||
public:
|
||||
wxPrintSetupData();
|
||||
~wxPrintSetupData();
|
||||
|
||||
void SetPrinterCommand(const char *cmd);
|
||||
void SetPaperName(const char *paper);
|
||||
void SetPrintPreviewCommand(const char *cmd);
|
||||
void SetPrinterOptions(const char *flags);
|
||||
void SetPrinterFile(const char *f);
|
||||
void SetPrinterOrientation(int orient);
|
||||
void SetPrinterScaling(double x, double y);
|
||||
void SetPrinterTranslation(long x, long y);
|
||||
void SetPrinterCommand(const wxString& cmd) { m_printerCommand = cmd; };
|
||||
void SetPaperName(const wxString& paper) { m_paperName = paper; };
|
||||
void SetPrintPreviewCommand(const wxString& cmd) { m_previewCommand = cmd; };
|
||||
void SetPrinterOptions(const wxString& flags) { m_printerFlags = flags; };
|
||||
void SetPrinterFile(const wxString& f) { m_printerFile = f; };
|
||||
void SetPrinterOrientation(int orient) { m_printerOrient = orient; };
|
||||
void SetPrinterScaling(double x, double y) { m_printerScaleX = x; m_printerScaleY = y; };
|
||||
void SetPrinterTranslation(long x, long y) { m_printerTranslateX = x; m_printerTranslateY = y; };
|
||||
// 1 = Preview, 2 = print to file, 3 = send to printer
|
||||
void SetPrinterMode(int mode);
|
||||
void SetAFMPath(const char *f);
|
||||
void SetColour(bool col);
|
||||
void SetPrinterMode(int mode) { m_printerMode = mode; };
|
||||
void SetAFMPath(const wxString& f) { m_afmPath = f; };
|
||||
void SetColour(bool col) { m_printColour = col; };
|
||||
|
||||
// Get current values
|
||||
char *GetPrinterCommand();
|
||||
char *GetPrintPreviewCommand();
|
||||
char *GetPrinterOptions();
|
||||
char *GetPrinterFile();
|
||||
char *GetPaperName();
|
||||
int GetPrinterOrientation();
|
||||
void GetPrinterScaling(double* x, double* y);
|
||||
void GetPrinterTranslation(long *x, long *y);
|
||||
int GetPrinterMode();
|
||||
char *GetAFMPath();
|
||||
bool GetColour();
|
||||
wxString GetPrinterCommand() const { return m_printerCommand; } ;
|
||||
wxString GetPrintPreviewCommand() const { return m_previewCommand; } ;
|
||||
wxString GetPrinterOptions() const { return m_printerFlags; };
|
||||
wxString GetPrinterFile() const { return m_printerFile; };
|
||||
wxString GetPaperName() const { return m_paperName; }
|
||||
int GetPrinterOrientation() const { return m_printerOrient; };
|
||||
void GetPrinterScaling(double* x, double* y) const { *x = m_printerScaleX; *y = m_printerScaleY; };
|
||||
void GetPrinterTranslation(long *x, long *y) const { *x = m_printerTranslateX; *y = m_printerTranslateY; };
|
||||
int GetPrinterMode() const { return m_printerMode; };
|
||||
wxString GetAFMPath() const { return m_afmPath; };
|
||||
bool GetColour() const { return m_printColour; };
|
||||
|
||||
void operator=(wxPrintSetupData& data);
|
||||
|
||||
private:
|
||||
// Initialize from a wxPrintData object (wxPrintData should now be used instead of wxPrintSetupData).
|
||||
// There is also an operator for initializing a wxPrintData from a wxPrintSetupData.
|
||||
void operator=(const wxPrintData& data);
|
||||
|
||||
public:
|
||||
wxString m_printerCommand;
|
||||
wxString m_previewCommand;
|
||||
wxString m_printerFlags;
|
||||
wxString m_printerFile;
|
||||
int m_printerOrient;
|
||||
double m_printerScaleX;
|
||||
double m_printerScaleY;
|
||||
long m_printerTranslateX;
|
||||
long m_printerTranslateY;
|
||||
// 1 = Preview, 2 = print to file, 3 = send to printer
|
||||
int m_printerMode;
|
||||
wxString m_afmPath;
|
||||
// A name in the paper database (see paper.h)
|
||||
wxString m_paperName;
|
||||
bool m_printColour;
|
||||
|
||||
DECLARE_DYNAMIC_CLASS(wxPrintSetupData)
|
||||
};
|
||||
|
||||
|
@@ -20,33 +20,33 @@
|
||||
#include "wx/prntbase.h"
|
||||
|
||||
/*
|
||||
* Represents the printer: manages printing a wxPrintout object
|
||||
*/
|
||||
* Represents the printer: manages printing a wxPrintout object
|
||||
*/
|
||||
|
||||
class WXDLLEXPORT wxPostScriptPrinter: public wxPrinterBase
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxPostScriptPrinter)
|
||||
|
||||
public:
|
||||
wxPostScriptPrinter(wxPrintData *data = (wxPrintData *) NULL);
|
||||
public:
|
||||
wxPostScriptPrinter(wxPrintDialogData *data = (wxPrintDialogData *) NULL);
|
||||
~wxPostScriptPrinter(void);
|
||||
|
||||
virtual bool Print(wxWindow *parent, wxPrintout *printout, bool prompt = TRUE);
|
||||
virtual bool PrintDialog(wxWindow *parent);
|
||||
virtual wxDC* PrintDialog(wxWindow *parent);
|
||||
virtual bool Setup(wxWindow *parent);
|
||||
};
|
||||
|
||||
/*
|
||||
* wxPrintPreview
|
||||
* Programmer creates an object of this class to preview a wxPrintout.
|
||||
*/
|
||||
* wxPrintPreview
|
||||
* Programmer creates an object of this class to preview a wxPrintout.
|
||||
*/
|
||||
|
||||
class WXDLLEXPORT wxPostScriptPrintPreview: public wxPrintPreviewBase
|
||||
{
|
||||
DECLARE_CLASS(wxPostScriptPrintPreview)
|
||||
|
||||
public:
|
||||
wxPostScriptPrintPreview(wxPrintout *printout, wxPrintout *printoutForPrinting = (wxPrintout *) NULL, wxPrintData *data = (wxPrintData *) NULL);
|
||||
public:
|
||||
wxPostScriptPrintPreview(wxPrintout *printout, wxPrintout *printoutForPrinting = (wxPrintout *) NULL, wxPrintDialogData *data = (wxPrintDialogData *) NULL);
|
||||
~wxPostScriptPrintPreview(void);
|
||||
|
||||
virtual bool Print(bool interactive);
|
||||
@@ -54,4 +54,4 @@ class WXDLLEXPORT wxPostScriptPrintPreview: public wxPrintPreviewBase
|
||||
};
|
||||
|
||||
#endif
|
||||
// __PRINTPSH__
|
||||
// __PRINTPSH__
|
||||
|
@@ -36,9 +36,9 @@ class WXDLLEXPORT wxRadioBox;
|
||||
class WXDLLEXPORT wxPrintSetupData;
|
||||
|
||||
/*
|
||||
* Simulated Print and Print Setup dialogs
|
||||
* for non-Windows platforms (and Windows using PostScript print/preview)
|
||||
*/
|
||||
* Simulated Print and Print Setup dialogs
|
||||
* for non-Windows platforms (and Windows using PostScript print/preview)
|
||||
*/
|
||||
|
||||
#define wxPRINTID_STATIC 10
|
||||
#define wxPRINTID_RANGE 11
|
||||
@@ -52,34 +52,37 @@ class WXDLLEXPORT wxGenericPrintDialog: public wxDialog
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxGenericPrintDialog)
|
||||
|
||||
public:
|
||||
wxStaticText *printerMessage;
|
||||
wxButton *setupButton;
|
||||
wxButton *helpButton;
|
||||
wxRadioBox *rangeRadioBox;
|
||||
wxTextCtrl *fromText;
|
||||
wxTextCtrl *toText;
|
||||
wxTextCtrl *noCopiesText;
|
||||
wxCheckBox *printToFileCheckBox;
|
||||
wxCheckBox *collateCopiesCheckBox;
|
||||
|
||||
wxPrintData printData;
|
||||
wxGenericPrintDialog(wxWindow *parent, wxPrintData* data);
|
||||
~wxGenericPrintDialog(void);
|
||||
public:
|
||||
wxGenericPrintDialog(wxWindow *parent, wxPrintDialogData* data = (wxPrintDialogData*) NULL);
|
||||
~wxGenericPrintDialog();
|
||||
|
||||
void OnSetup(wxCommandEvent& event);
|
||||
void OnRange(wxCommandEvent& event);
|
||||
void OnOK(wxCommandEvent& event);
|
||||
|
||||
virtual bool TransferDataFromWindow(void);
|
||||
virtual bool TransferDataToWindow(void);
|
||||
virtual bool TransferDataFromWindow();
|
||||
virtual bool TransferDataToWindow();
|
||||
|
||||
virtual int ShowModal(void);
|
||||
virtual int ShowModal();
|
||||
|
||||
inline wxPrintData& GetPrintData(void) { return printData; }
|
||||
wxDC *GetPrintDC(void);
|
||||
inline wxPrintDialogData& GetPrintDialogData() { return m_printDialogData; }
|
||||
wxDC *GetPrintDC();
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
public:
|
||||
wxStaticText* m_printerMessage;
|
||||
wxButton* m_setupButton;
|
||||
wxButton* m_helpButton;
|
||||
wxRadioBox* m_rangeRadioBox;
|
||||
wxTextCtrl* m_fromText;
|
||||
wxTextCtrl* m_toText;
|
||||
wxTextCtrl* m_noCopiesText;
|
||||
wxCheckBox* m_printToFileCheckBox;
|
||||
wxCheckBox* m_collateCopiesCheckBox;
|
||||
|
||||
wxPrintDialogData m_printDialogData;
|
||||
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
#define wxPRINTID_PRINTCOLOUR 10
|
||||
@@ -92,25 +95,32 @@ class WXDLLEXPORT wxGenericPrintSetupDialog: public wxDialog
|
||||
{
|
||||
DECLARE_CLASS(wxGenericPrintSetupDialog)
|
||||
|
||||
public:
|
||||
wxRadioBox *orientationRadioBox;
|
||||
wxTextCtrl *printerCommandText;
|
||||
wxTextCtrl *printerOptionsText;
|
||||
wxCheckBox *colourCheckBox;
|
||||
wxChoice *paperTypeChoice;
|
||||
|
||||
#if wxUSE_POSTSCRIPT
|
||||
wxPrintSetupData printData;
|
||||
inline wxPrintSetupData& GetPrintData(void) { return printData; }
|
||||
#endif
|
||||
|
||||
public:
|
||||
// There are no configuration options for the dialog, so we
|
||||
// just pass the wxPrintData object (no wxPrintSetupDialogData class needed)
|
||||
wxGenericPrintSetupDialog(wxWindow *parent, wxPrintData* data);
|
||||
wxGenericPrintSetupDialog(wxWindow *parent, wxPrintSetupData* data);
|
||||
~wxGenericPrintSetupDialog(void);
|
||||
~wxGenericPrintSetupDialog();
|
||||
|
||||
virtual bool TransferDataFromWindow(void);
|
||||
virtual bool TransferDataToWindow(void);
|
||||
void Init(wxPrintData* data);
|
||||
|
||||
virtual bool TransferDataFromWindow();
|
||||
virtual bool TransferDataToWindow();
|
||||
|
||||
wxChoice *CreatePaperTypeChoice(int* x, int* y);
|
||||
|
||||
public:
|
||||
wxRadioBox* m_orientationRadioBox;
|
||||
wxTextCtrl* m_printerCommandText;
|
||||
wxTextCtrl* m_printerOptionsText;
|
||||
wxCheckBox* m_colourCheckBox;
|
||||
wxChoice* m_paperTypeChoice;
|
||||
|
||||
#if wxUSE_POSTSCRIPT
|
||||
wxPrintData m_printData;
|
||||
inline wxPrintData& GetPrintData() { return m_printData; }
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
#define wxPRINTID_LEFTMARGIN 30
|
||||
@@ -122,32 +132,33 @@ class WXDLLEXPORT wxGenericPageSetupDialog: public wxDialog
|
||||
{
|
||||
DECLARE_CLASS(wxGenericPageSetupDialog)
|
||||
|
||||
public:
|
||||
wxButton *printerButton;
|
||||
wxRadioBox *orientationRadioBox;
|
||||
wxTextCtrl *marginLeftText;
|
||||
wxTextCtrl *marginTopText;
|
||||
wxTextCtrl *marginRightText;
|
||||
wxTextCtrl *marginBottomText;
|
||||
wxChoice *paperTypeChoice;
|
||||
|
||||
static bool pageSetupDialogCancelled;
|
||||
|
||||
wxPageSetupData pageData;
|
||||
|
||||
public:
|
||||
wxGenericPageSetupDialog(wxWindow *parent, wxPageSetupData* data = (wxPageSetupData*) NULL);
|
||||
~wxGenericPageSetupDialog(void);
|
||||
~wxGenericPageSetupDialog();
|
||||
|
||||
virtual bool TransferDataFromWindow(void);
|
||||
virtual bool TransferDataToWindow(void);
|
||||
virtual bool TransferDataFromWindow();
|
||||
virtual bool TransferDataToWindow();
|
||||
|
||||
void OnPrinter(wxCommandEvent& event);
|
||||
|
||||
wxChoice *CreatePaperTypeChoice(int* x, int* y);
|
||||
inline wxPageSetupData& GetPageSetupData(void) { return pageData; }
|
||||
inline wxPageSetupData& GetPageSetupData() { return m_pageData; }
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
public:
|
||||
wxButton* m_printerButton;
|
||||
wxRadioBox* m_orientationRadioBox;
|
||||
wxTextCtrl* m_marginLeftText;
|
||||
wxTextCtrl* m_marginTopText;
|
||||
wxTextCtrl* m_marginRightText;
|
||||
wxTextCtrl* m_marginBottomText;
|
||||
wxChoice* m_paperTypeChoice;
|
||||
|
||||
static bool m_pageSetupDialogCancelled;
|
||||
|
||||
wxPageSetupData m_pageData;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
#endif
|
||||
// __PRINTDLGH_G__
|
||||
// __PRINTDLGH_G__
|
||||
|
@@ -225,9 +225,16 @@ public:
|
||||
virtual long MinY() const { return m_minY; }
|
||||
virtual long MaxY() const { return m_maxY; }
|
||||
|
||||
// Size in device units
|
||||
virtual void GetSize( int* width, int* height ) const;
|
||||
inline wxSize GetSize(void) const { int w, h; GetSize(&w, &h); return wxSize(w, h); }
|
||||
virtual void GetSizeMM( long* width, long* height ) const;
|
||||
|
||||
// Size in millimetres
|
||||
virtual void GetSizeMM( int* width, int* height ) const;
|
||||
inline wxSize GetSizeMM(void) const { int w, h; GetSizeMM(&w, &h); return wxSize(w, h); }
|
||||
|
||||
// Resolution in pixels per logical inch
|
||||
virtual wxSize GetPPI(void) const;
|
||||
|
||||
virtual bool StartDoc( const wxString& WXUNUSED(message) ) { return TRUE; }
|
||||
virtual void EndDoc() {}
|
||||
@@ -339,7 +346,6 @@ public:
|
||||
bool m_autoSetting; // wxMSW only ?
|
||||
bool m_dontDelete; // wxMSW only ?
|
||||
bool m_optimize; // wxMSW only ?
|
||||
wxString m_filename; // Not sure where this belongs.
|
||||
|
||||
wxPen m_pen;
|
||||
wxBrush m_brush;
|
||||
|
@@ -92,6 +92,9 @@ public:
|
||||
|
||||
virtual void DrawSpline( wxList *points );
|
||||
|
||||
// Resolution in pixels per logical inch
|
||||
wxSize GetPPI(void) const;
|
||||
|
||||
// implementation
|
||||
|
||||
GdkWindow *m_window;
|
||||
|
@@ -225,9 +225,16 @@ public:
|
||||
virtual long MinY() const { return m_minY; }
|
||||
virtual long MaxY() const { return m_maxY; }
|
||||
|
||||
// Size in device units
|
||||
virtual void GetSize( int* width, int* height ) const;
|
||||
inline wxSize GetSize(void) const { int w, h; GetSize(&w, &h); return wxSize(w, h); }
|
||||
virtual void GetSizeMM( long* width, long* height ) const;
|
||||
|
||||
// Size in millimetres
|
||||
virtual void GetSizeMM( int* width, int* height ) const;
|
||||
inline wxSize GetSizeMM(void) const { int w, h; GetSizeMM(&w, &h); return wxSize(w, h); }
|
||||
|
||||
// Resolution in pixels per logical inch
|
||||
virtual wxSize GetPPI(void) const;
|
||||
|
||||
virtual bool StartDoc( const wxString& WXUNUSED(message) ) { return TRUE; }
|
||||
virtual void EndDoc() {}
|
||||
@@ -339,7 +346,6 @@ public:
|
||||
bool m_autoSetting; // wxMSW only ?
|
||||
bool m_dontDelete; // wxMSW only ?
|
||||
bool m_optimize; // wxMSW only ?
|
||||
wxString m_filename; // Not sure where this belongs.
|
||||
|
||||
wxPen m_pen;
|
||||
wxBrush m_brush;
|
||||
|
@@ -92,6 +92,9 @@ public:
|
||||
|
||||
virtual void DrawSpline( wxList *points );
|
||||
|
||||
// Resolution in pixels per logical inch
|
||||
wxSize GetPPI(void) const;
|
||||
|
||||
// implementation
|
||||
|
||||
GdkWindow *m_window;
|
||||
|
@@ -211,9 +211,16 @@ class WXDLLEXPORT wxDC: public wxObject
|
||||
virtual inline long MinY(void) const { return m_minY; }
|
||||
virtual inline long MaxY(void) const { return m_maxY; }
|
||||
|
||||
// Size in device units
|
||||
virtual void GetSize( int* width, int* height ) const;
|
||||
inline wxSize GetSize(void) const { int w, h; GetSize(&w, &h); return wxSize(w, h); }
|
||||
virtual void GetSizeMM( long* width, long* height ) const;
|
||||
|
||||
// Size in millimetres
|
||||
virtual void GetSizeMM( int* width, int* height ) const;
|
||||
inline wxSize GetSizeMM(void) const { int w, h; GetSizeMM(&w, &h); return wxSize(w, h); }
|
||||
|
||||
// Resolution in pixels per logical inch
|
||||
wxSize GetPPI(void) const ;
|
||||
|
||||
virtual bool StartDoc( const wxString& WXUNUSED(message) ) { return TRUE; };
|
||||
virtual void EndDoc(void) {};
|
||||
@@ -342,7 +349,6 @@ class WXDLLEXPORT wxDC: public wxObject
|
||||
bool m_clipping; // Is clipping on right now ?
|
||||
bool m_optimize; // wxMSW only ?
|
||||
bool m_isInteractive; // For wxPostScriptDC
|
||||
wxString m_filename; // Ditto
|
||||
|
||||
wxPen m_pen;
|
||||
wxBrush m_brush;
|
||||
|
@@ -172,6 +172,9 @@ class WXDLLEXPORT wxWindowDC: public wxDC
|
||||
virtual void DrawSpline( int n, wxPoint points[] )
|
||||
{ wxDC::DrawSpline(n, points); }
|
||||
|
||||
// Resolution in pixels per logical inch
|
||||
wxSize GetPPI(void) const;
|
||||
|
||||
// Motif-specific
|
||||
void SetDCClipping (); // Helper function for setting clipping
|
||||
|
||||
|
@@ -68,7 +68,7 @@
|
||||
/*
|
||||
* Use Threads
|
||||
*/
|
||||
#define wxUSE_THREADS 1
|
||||
#define wxUSE_THREADS 0
|
||||
/*
|
||||
* Have glibc2
|
||||
*/
|
||||
@@ -78,6 +78,8 @@
|
||||
*/
|
||||
#define wxHAVE_LIB_XPM 0
|
||||
|
||||
#define wxUSE_XPM 1
|
||||
|
||||
/* ------------------------------------------------------------------------ */
|
||||
/* GUI control options (always enabled in wxGTK) */
|
||||
/* ------------------------------------------------------------------------ */
|
||||
@@ -199,11 +201,11 @@
|
||||
/*
|
||||
* Use tooltips
|
||||
*/
|
||||
#define wxUSE_TOOLTIPS 1
|
||||
#define wxUSE_TOOLTIPS 0
|
||||
/*
|
||||
* Use dnd
|
||||
*/
|
||||
#define wxUSE_DRAG_AND_DROP 1
|
||||
#define wxUSE_DRAG_AND_DROP 0
|
||||
/*
|
||||
* Use wxLibrary class
|
||||
*/
|
||||
@@ -387,7 +389,7 @@
|
||||
/* #undef HAVE_DOPRNT */
|
||||
|
||||
/* Define if you have sched.h */
|
||||
#define HAVE_SCHED_H 1
|
||||
#define HAVE_SCHED_H 0
|
||||
|
||||
/* Define if you have strings.h */
|
||||
#define HAVE_STRINGS_H 1
|
||||
@@ -405,10 +407,10 @@
|
||||
#define HAVE_VSNPRINTF 1
|
||||
|
||||
/* Define if you have usleep() */
|
||||
/* #undef HAVE_USLEEP */
|
||||
#define HAVE_USLEEP 1
|
||||
|
||||
/* Define if you have nanosleep() */
|
||||
#define HAVE_NANOSLEEP 1
|
||||
#define HAVE_NANOSLEEP 0
|
||||
|
||||
/* Define if you have vfork() */
|
||||
#define HAVE_VFORK 1
|
||||
|
@@ -199,10 +199,14 @@ public:
|
||||
|
||||
// Size in device units
|
||||
virtual void GetSize(int* width, int* height) const;
|
||||
inline wxSize GetSize(void) const { int w, h; GetSize(&w, &h); return wxSize(w, h); }
|
||||
inline wxSize GetSize() const { int w, h; GetSize(&w, &h); return wxSize(w, h); }
|
||||
|
||||
// Size in mm
|
||||
virtual void GetSizeMM(long* width, long* height) const ;
|
||||
virtual void GetSizeMM(int* width, int* height) const ;
|
||||
inline wxSize GetSizeMM() const { int w, h; GetSizeMM(&w, &h); return wxSize(w, h); }
|
||||
|
||||
// Resolution in Pixels per inch
|
||||
virtual wxSize GetPPI(void) const ;
|
||||
|
||||
// Compatibility
|
||||
#if WXWIN_COMPATIBILITY
|
||||
@@ -351,7 +355,6 @@ protected:
|
||||
|
||||
wxWindow * m_canvas;
|
||||
wxBitmap m_selectedBitmap;
|
||||
wxString m_filename;
|
||||
|
||||
// TRUE => DeleteDC() in dtor, FALSE => only ReleaseDC() it
|
||||
bool m_bOwnsDC;
|
||||
|
@@ -17,21 +17,37 @@
|
||||
#endif
|
||||
|
||||
#include "wx/dc.h"
|
||||
#include "wx/cmndata.h"
|
||||
|
||||
class WXDLLEXPORT wxPrinterDC: public wxDC
|
||||
{
|
||||
public:
|
||||
DECLARE_CLASS(wxPrinterDC)
|
||||
public:
|
||||
DECLARE_CLASS(wxPrinterDC)
|
||||
|
||||
// Create a printer DC
|
||||
// Create a printer DC (obsolete function: use wxPrintData version now)
|
||||
wxPrinterDC(const wxString& driver, const wxString& device, const wxString& output, bool interactive = TRUE, int orientation = wxPORTRAIT);
|
||||
|
||||
// Create from print data
|
||||
wxPrinterDC(const wxPrintData& data);
|
||||
|
||||
wxPrinterDC(WXHDC theDC);
|
||||
|
||||
~wxPrinterDC(void);
|
||||
|
||||
bool StartDoc(const wxString& message);
|
||||
void EndDoc(void);
|
||||
void StartPage(void);
|
||||
void EndPage(void);
|
||||
|
||||
protected:
|
||||
wxPrintData m_printData;
|
||||
};
|
||||
|
||||
// Gets an HDC for the default printer configuration
|
||||
WXHDC WXDLLEXPORT wxGetPrinterDC(int orientation);
|
||||
// WXHDC WXDLLEXPORT wxGetPrinterDC(int orientation);
|
||||
|
||||
// Gets an HDC for the specified printer configuration
|
||||
WXHDC WXDLLEXPORT wxGetPrinterDC(const wxPrintData& data);
|
||||
|
||||
#endif
|
||||
// _WX_DCPRINT_H_
|
||||
|
@@ -29,24 +29,23 @@ class WXDLLEXPORT wxPrintDialog: public wxDialog
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxPrintDialog)
|
||||
|
||||
private:
|
||||
wxPrintData printData;
|
||||
wxDC *printerDC;
|
||||
bool destroyDC;
|
||||
char *deviceName;
|
||||
char *driverName;
|
||||
char *portName;
|
||||
wxWindow *dialogParent;
|
||||
public:
|
||||
public:
|
||||
wxPrintDialog(void);
|
||||
wxPrintDialog(wxWindow *parent, wxPrintData* data = NULL);
|
||||
wxPrintDialog(wxWindow *parent, wxPrintDialogData* data = NULL);
|
||||
~wxPrintDialog(void);
|
||||
|
||||
bool Create(wxWindow *parent, wxPrintData* data = NULL);
|
||||
bool Create(wxWindow *parent, wxPrintDialogData* data = NULL);
|
||||
virtual int ShowModal(void);
|
||||
|
||||
inline wxPrintData& GetPrintData(void) { return printData; }
|
||||
inline wxPrintDialogData& GetPrintDialogData(void) { return m_printDialogData; }
|
||||
inline wxPrintData& GetPrintData(void) { return m_printDialogData.GetPrintData(); }
|
||||
virtual wxDC *GetPrintDC(void);
|
||||
|
||||
private:
|
||||
wxPrintDialogData m_printDialogData;
|
||||
wxDC* m_printerDC;
|
||||
bool m_destroyDC;
|
||||
wxWindow* m_dialogParent;
|
||||
};
|
||||
|
||||
class WXDLLEXPORT wxPageSetupDialog: public wxDialog
|
||||
|
@@ -27,11 +27,11 @@ class WXDLLEXPORT wxWindowsPrinter: public wxPrinterBase
|
||||
DECLARE_DYNAMIC_CLASS(wxWindowsPrinter)
|
||||
|
||||
public:
|
||||
wxWindowsPrinter(wxPrintData *data = NULL);
|
||||
wxWindowsPrinter(wxPrintDialogData *data = NULL);
|
||||
~wxWindowsPrinter(void);
|
||||
|
||||
virtual bool Print(wxWindow *parent, wxPrintout *printout, bool prompt = TRUE);
|
||||
virtual bool PrintDialog(wxWindow *parent);
|
||||
virtual wxDC* PrintDialog(wxWindow *parent);
|
||||
virtual bool Setup(wxWindow *parent);
|
||||
|
||||
private:
|
||||
@@ -48,7 +48,7 @@ class WXDLLEXPORT wxWindowsPrintPreview: public wxPrintPreviewBase
|
||||
DECLARE_CLASS(wxWindowsPrintPreview)
|
||||
|
||||
public:
|
||||
wxWindowsPrintPreview(wxPrintout *printout, wxPrintout *printoutForPrinting = NULL, wxPrintData *data = NULL);
|
||||
wxWindowsPrintPreview(wxPrintout *printout, wxPrintout *printoutForPrinting = NULL, wxPrintDialogData *data = NULL);
|
||||
~wxWindowsPrintPreview(void);
|
||||
|
||||
virtual bool Print(bool interactive);
|
||||
|
@@ -44,12 +44,12 @@ class WXDLLEXPORT wxPrinterBase: public wxObject
|
||||
DECLARE_CLASS(wxPrinterBase)
|
||||
|
||||
public:
|
||||
wxPrinterBase(wxPrintData *data = (wxPrintData *) NULL);
|
||||
wxPrinterBase(wxPrintDialogData *data = (wxPrintDialogData *) NULL);
|
||||
~wxPrinterBase();
|
||||
|
||||
virtual wxWindow *CreateAbortWindow(wxWindow *parent, wxPrintout *printout);
|
||||
virtual void ReportError(wxWindow *parent, wxPrintout *printout, char *message);
|
||||
inline wxPrintData& GetPrintData() const { return (wxPrintData&) m_printData; };
|
||||
inline wxPrintDialogData& GetPrintDialogData() const { return (wxPrintDialogData&) m_printDialogData; };
|
||||
inline bool GetAbort() const { return sm_abortIt; }
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
@@ -57,10 +57,10 @@ public:
|
||||
|
||||
virtual bool Setup(wxWindow *parent) = 0;
|
||||
virtual bool Print(wxWindow *parent, wxPrintout *printout, bool prompt = TRUE) = 0;
|
||||
virtual bool PrintDialog(wxWindow *parent) = 0;
|
||||
virtual wxDC* PrintDialog(wxWindow *parent) = 0;
|
||||
|
||||
protected:
|
||||
wxPrintData m_printData;
|
||||
wxPrintDialogData m_printDialogData;
|
||||
wxPrintout* m_currentPrintout;
|
||||
public:
|
||||
static wxWindow* sm_abortWindow;
|
||||
@@ -251,7 +251,7 @@ class WXDLLEXPORT wxPrintPreviewBase: public wxObject
|
||||
DECLARE_CLASS(wxPrintPreviewBase)
|
||||
|
||||
public:
|
||||
wxPrintPreviewBase(wxPrintout *printout, wxPrintout *printoutForPrinting = (wxPrintout *) NULL, wxPrintData *data = (wxPrintData *) NULL);
|
||||
wxPrintPreviewBase(wxPrintout *printout, wxPrintout *printoutForPrinting = (wxPrintout *) NULL, wxPrintDialogData *data = (wxPrintDialogData *) NULL);
|
||||
~wxPrintPreviewBase();
|
||||
|
||||
virtual bool SetCurrentPage(int pageNum);
|
||||
@@ -277,7 +277,7 @@ public:
|
||||
// a wxMemoryDC.
|
||||
virtual bool RenderPage(int pageNum);
|
||||
|
||||
inline wxPrintData& GetPrintData() { return m_printData; }
|
||||
inline wxPrintDialogData& GetPrintDialogData() { return m_printDialogData; }
|
||||
|
||||
virtual void SetZoom(int percent);
|
||||
inline int GetZoom() const { return m_currentZoom; };
|
||||
@@ -302,7 +302,7 @@ public:
|
||||
virtual void DetermineScaling() = 0;
|
||||
|
||||
protected:
|
||||
wxPrintData m_printData;
|
||||
wxPrintDialogData m_printDialogData;
|
||||
wxWindow* m_previewCanvas;
|
||||
wxFrame* m_previewFrame;
|
||||
wxBitmap* m_previewBitmap;
|
||||
@@ -340,47 +340,5 @@ public:
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
/*
|
||||
* Again, this only really needed for non-Windows platforms
|
||||
* or if you want to test the PostScript printing under Windows,
|
||||
* or if you're using the generic page setup dialog under e.g. Win16.
|
||||
*/
|
||||
|
||||
class WXDLLEXPORT wxPrintPaperType: public wxObject
|
||||
{
|
||||
public:
|
||||
wxPrintPaperType(const char *name = (const char *) NULL, int wmm = 0, int hmm = 0, int wp = 0, int hp = 0);
|
||||
~wxPrintPaperType();
|
||||
|
||||
public:
|
||||
int widthMM;
|
||||
int heightMM;
|
||||
int widthPixels;
|
||||
int heightPixels;
|
||||
char *pageName;
|
||||
|
||||
private:
|
||||
DECLARE_DYNAMIC_CLASS(wxPrintPaperType)
|
||||
};
|
||||
|
||||
class WXDLLEXPORT wxPrintPaperDatabase: public wxList
|
||||
{
|
||||
public:
|
||||
wxPrintPaperDatabase();
|
||||
~wxPrintPaperDatabase();
|
||||
|
||||
void CreateDatabase();
|
||||
void ClearDatabase();
|
||||
|
||||
void AddPaperType(const char *name, int wmm, int hmm, int wp, int hp);
|
||||
wxPrintPaperType *FindPaperType(const char *name);
|
||||
|
||||
private:
|
||||
DECLARE_DYNAMIC_CLASS(wxPrintPaperDatabase)
|
||||
};
|
||||
|
||||
WXDLLEXPORT_DATA(extern wxPrintPaperDatabase*) wxThePrintPaperDatabase;
|
||||
|
||||
|
||||
#endif
|
||||
// _WX_PRNTBASEH__
|
||||
|
@@ -1,11 +1,11 @@
|
||||
/*
|
||||
* File: printing.cc
|
||||
* Purpose: Printing demo for wxWindows class library
|
||||
* Author: Julian Smart
|
||||
* Created: 1995
|
||||
* Updated:
|
||||
* Copyright: (c) 1995, AIAI, University of Edinburgh
|
||||
*/
|
||||
* File: printing.cc
|
||||
* Purpose: Printing demo for wxWindows class library
|
||||
* Author: Julian Smart
|
||||
* Created: 1995
|
||||
* Updated:
|
||||
* Copyright: (c) 1995, AIAI, University of Edinburgh
|
||||
*/
|
||||
|
||||
/* static const char sccsid[] = "%W% %G%"; */
|
||||
|
||||
@@ -52,7 +52,13 @@
|
||||
|
||||
// Declare a frame
|
||||
MyFrame *frame = (MyFrame *) NULL;
|
||||
int orientation = wxPORTRAIT;
|
||||
// int orientation = wxPORTRAIT;
|
||||
|
||||
// Global print data, to remember settings during the session
|
||||
wxPrintData *g_printData = (wxPrintData*) NULL ;
|
||||
|
||||
// Global page setup data
|
||||
wxPageSetupData* g_pageSetupData = (wxPageSetupData*) NULL;
|
||||
|
||||
// Main proc
|
||||
IMPLEMENT_APP(MyApp)
|
||||
@@ -70,6 +76,17 @@ bool MyApp::OnInit(void)
|
||||
{
|
||||
m_testFont = new wxFont(10, wxSWISS, wxNORMAL, wxNORMAL);
|
||||
|
||||
g_printData = new wxPrintData;
|
||||
g_pageSetupData = new wxPageSetupDialogData;
|
||||
|
||||
// Compatibility with old system. In fact, we might keep wxThePrintSetupData
|
||||
// just for useful default values which we can optionally assign to our
|
||||
// own print data object.
|
||||
|
||||
#if defined(__WXGTK__) || defined(__WXMOTIF__)
|
||||
(*g_printData) = * wxThePrintSetupData;
|
||||
#endif
|
||||
|
||||
// Create the main frame window
|
||||
frame = new MyFrame((wxFrame *) NULL, (char *) "wxWindows Printing Demo", wxPoint(0, 0), wxSize(400, 400));
|
||||
|
||||
@@ -134,27 +151,29 @@ bool MyApp::OnInit(void)
|
||||
int MyApp::OnExit()
|
||||
{
|
||||
delete wxGetApp().m_testFont;
|
||||
delete g_printData;
|
||||
delete g_pageSetupData;
|
||||
return 1;
|
||||
}
|
||||
|
||||
BEGIN_EVENT_TABLE(MyFrame, wxFrame)
|
||||
EVT_MENU(WXPRINT_QUIT, MyFrame::OnExit)
|
||||
EVT_MENU(WXPRINT_PRINT, MyFrame::OnPrint)
|
||||
EVT_MENU(WXPRINT_PREVIEW, MyFrame::OnPrintPreview)
|
||||
EVT_MENU(WXPRINT_PRINT_SETUP, MyFrame::OnPrintSetup)
|
||||
EVT_MENU(WXPRINT_PAGE_SETUP, MyFrame::OnPageSetup)
|
||||
EVT_MENU(WXPRINT_ABOUT, MyFrame::OnPrintAbout)
|
||||
EVT_MENU(WXPRINT_QUIT, MyFrame::OnExit)
|
||||
EVT_MENU(WXPRINT_PRINT, MyFrame::OnPrint)
|
||||
EVT_MENU(WXPRINT_PREVIEW, MyFrame::OnPrintPreview)
|
||||
EVT_MENU(WXPRINT_PRINT_SETUP, MyFrame::OnPrintSetup)
|
||||
EVT_MENU(WXPRINT_PAGE_SETUP, MyFrame::OnPageSetup)
|
||||
EVT_MENU(WXPRINT_ABOUT, MyFrame::OnPrintAbout)
|
||||
#if defined(__WXMSW__) && wxTEST_POSTSCRIPT_IN_MSW
|
||||
EVT_MENU(WXPRINT_PRINT_PS, MyFrame::OnPrintPS)
|
||||
EVT_MENU(WXPRINT_PREVIEW_PS, MyFrame::OnPrintPreviewPS)
|
||||
EVT_MENU(WXPRINT_PRINT_SETUP_PS, MyFrame::OnPrintSetupPS)
|
||||
EVT_MENU(WXPRINT_PAGE_SETUP_PS, MyFrame::OnPageSetupPS)
|
||||
EVT_MENU(WXPRINT_PRINT_PS, MyFrame::OnPrintPS)
|
||||
EVT_MENU(WXPRINT_PREVIEW_PS, MyFrame::OnPrintPreviewPS)
|
||||
EVT_MENU(WXPRINT_PRINT_SETUP_PS, MyFrame::OnPrintSetupPS)
|
||||
EVT_MENU(WXPRINT_PAGE_SETUP_PS, MyFrame::OnPageSetupPS)
|
||||
#endif
|
||||
END_EVENT_TABLE()
|
||||
|
||||
// Define my frame constructor
|
||||
MyFrame::MyFrame(wxFrame *frame, const wxString& title, const wxPoint& pos, const wxSize& size):
|
||||
wxFrame(frame, -1, title, pos, size)
|
||||
wxFrame(frame, -1, title, pos, size)
|
||||
{
|
||||
canvas = (MyCanvas *) NULL;
|
||||
}
|
||||
@@ -166,19 +185,23 @@ void MyFrame::OnExit(wxCommandEvent& WXUNUSED(event))
|
||||
|
||||
void MyFrame::OnPrint(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxPrinter printer;
|
||||
wxPrintDialogData printDialogData(* g_printData);
|
||||
|
||||
wxPrinter printer(& printDialogData);
|
||||
MyPrintout printout("My printout");
|
||||
if (!printer.Print(this, &printout, TRUE))
|
||||
wxMessageBox("There was a problem printing.\nPerhaps your current printer is not set correctly?", "Printing", wxOK);
|
||||
else
|
||||
{
|
||||
(*g_printData) = printer.GetPrintDialogData().GetPrintData();
|
||||
}
|
||||
}
|
||||
|
||||
void MyFrame::OnPrintPreview(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxPrintData printData;
|
||||
printData.SetOrientation(orientation);
|
||||
|
||||
// Pass two printout objects: for preview, and possible printing.
|
||||
wxPrintPreview *preview = new wxPrintPreview(new MyPrintout, new MyPrintout, & printData);
|
||||
wxPrintDialogData printDialogData(* g_printData);
|
||||
wxPrintPreview *preview = new wxPrintPreview(new MyPrintout, new MyPrintout, & printDialogData);
|
||||
if (!preview->Ok())
|
||||
{
|
||||
delete preview;
|
||||
@@ -194,44 +217,41 @@ void MyFrame::OnPrintPreview(wxCommandEvent& WXUNUSED(event))
|
||||
|
||||
void MyFrame::OnPrintSetup(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxPrintData data;
|
||||
data.SetOrientation(orientation);
|
||||
wxPrintDialogData printDialogData(* g_printData);
|
||||
wxPrintDialog printerDialog(this, & printDialogData);
|
||||
|
||||
wxPrintDialog printerDialog(this, & data);
|
||||
|
||||
printerDialog.GetPrintData().SetSetupDialog(TRUE);
|
||||
printerDialog.GetPrintDialogData().SetSetupDialog(TRUE);
|
||||
printerDialog.ShowModal();
|
||||
|
||||
orientation = printerDialog.GetPrintData().GetOrientation();
|
||||
(*g_printData) = printerDialog.GetPrintDialogData().GetPrintData();
|
||||
}
|
||||
|
||||
void MyFrame::OnPageSetup(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxPageSetupData data;
|
||||
data.SetOrientation(orientation);
|
||||
(*g_pageSetupData) = * g_printData;
|
||||
|
||||
wxPageSetupDialog pageSetupDialog(this, & data);
|
||||
wxPageSetupDialog pageSetupDialog(this, g_pageSetupData);
|
||||
pageSetupDialog.ShowModal();
|
||||
|
||||
data = pageSetupDialog.GetPageSetupData();
|
||||
orientation = data.GetOrientation();
|
||||
(*g_printData) = pageSetupDialog.GetPageSetupData().GetPrintData();
|
||||
(*g_pageSetupData) = pageSetupDialog.GetPageSetupData();
|
||||
}
|
||||
|
||||
#if defined(__WXMSW__) && wxTEST_POSTSCRIPT_IN_MSW
|
||||
void MyFrame::OnPrintPS(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxPostScriptPrinter printer;
|
||||
wxPostScriptPrinter printer(g_printData);
|
||||
MyPrintout printout("My printout");
|
||||
printer.Print(this, &printout, TRUE);
|
||||
|
||||
(*g_printData) = printer.GetPrintData();
|
||||
}
|
||||
|
||||
void MyFrame::OnPrintPreviewPS(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxPrintData printData;
|
||||
printData.SetOrientation(orientation);
|
||||
|
||||
// Pass two printout objects: for preview, and possible printing.
|
||||
wxPrintPreview *preview = new wxPrintPreview(new MyPrintout, new MyPrintout, & printData);
|
||||
wxPrintDialogData printDialogData(* g_printData);
|
||||
wxPrintPreview *preview = new wxPrintPreview(new MyPrintout, new MyPrintout, & printDialogData);
|
||||
wxPreviewFrame *frame = new wxPreviewFrame(preview, this, "Demo Print Preview", wxPoint(100, 100), wxSize(600, 650));
|
||||
frame->Centre(wxBOTH);
|
||||
frame->Initialize();
|
||||
@@ -240,25 +260,24 @@ void MyFrame::OnPrintPreviewPS(wxCommandEvent& WXUNUSED(event))
|
||||
|
||||
void MyFrame::OnPrintSetupPS(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxPrintData data;
|
||||
data.SetOrientation(orientation);
|
||||
wxPrintDialogData printDialogData(* g_printData);
|
||||
wxGenericPrintDialog printerDialog(this, & printDialogData);
|
||||
|
||||
wxGenericPrintDialog printerDialog(this, & data);
|
||||
printerDialog.GetPrintData().SetSetupDialog(TRUE);
|
||||
printerDialog.GetPrintDialogData().SetSetupDialog(TRUE);
|
||||
printerDialog.ShowModal();
|
||||
|
||||
orientation = printerDialog.GetPrintData().GetOrientation();
|
||||
(*g_printData) = printerDialog.GetPrintDialogData().GetPrintData();
|
||||
}
|
||||
|
||||
void MyFrame::OnPageSetupPS(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxPageSetupData data;
|
||||
data.SetOrientation(orientation);
|
||||
(*g_pageSetupData) = * g_printData;
|
||||
|
||||
wxGenericPageSetupDialog pageSetupDialog(this, & data);
|
||||
wxGenericPageSetupDialog pageSetupDialog(this, g_pageSetupData);
|
||||
pageSetupDialog.ShowModal();
|
||||
|
||||
orientation = pageSetupDialog.GetPageSetupData().GetOrientation();
|
||||
(*g_printData) = pageSetupDialog.GetPageSetupData().GetPrintData();
|
||||
(*g_pageSetupData) = pageSetupDialog.GetPageSetupData();
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -300,13 +319,14 @@ void MyFrame::OnSize(wxSizeEvent& event )
|
||||
}
|
||||
|
||||
BEGIN_EVENT_TABLE(MyCanvas, wxScrolledWindow)
|
||||
EVT_MOUSE_EVENTS(MyCanvas::OnEvent)
|
||||
EVT_MOUSE_EVENTS(MyCanvas::OnEvent)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
// Define a constructor for my canvas
|
||||
MyCanvas::MyCanvas(wxFrame *frame, const wxPoint& pos, const wxSize& size, long style):
|
||||
wxScrolledWindow(frame, -1, pos, size, style)
|
||||
{
|
||||
SetBackgroundColour(* wxWHITE);
|
||||
}
|
||||
|
||||
MyCanvas::~MyCanvas(void)
|
||||
@@ -370,7 +390,7 @@ bool MyPrintout::HasPage(int pageNum)
|
||||
void MyPrintout::DrawPageOne(wxDC *dc)
|
||||
{
|
||||
/* You might use THIS code if you were scaling
|
||||
* graphics of known size to fit on the page.
|
||||
* graphics of known size to fit on the page.
|
||||
*/
|
||||
int w, h;
|
||||
|
||||
@@ -411,8 +431,8 @@ void MyPrintout::DrawPageOne(wxDC *dc)
|
||||
void MyPrintout::DrawPageTwo(wxDC *dc)
|
||||
{
|
||||
/* You might use THIS code to set the printer DC to ROUGHLY reflect
|
||||
* the screen text size. This page also draws lines of actual length 5cm
|
||||
* on the page.
|
||||
* the screen text size. This page also draws lines of actual length 5cm
|
||||
* on the page.
|
||||
*/
|
||||
// Get the logical pixels per inch of screen and printer
|
||||
int ppiScreenX, ppiScreenY;
|
||||
@@ -487,13 +507,13 @@ void MyPrintout::DrawPageTwo(wxDC *dc)
|
||||
bool WritePageHeader(wxPrintout *printout, wxDC *dc, char *text, float mmToLogical)
|
||||
{
|
||||
/*
|
||||
static wxFont *headerFont = (wxFont *) NULL;
|
||||
if (!headerFont)
|
||||
{
|
||||
headerFont = wxTheFontList->FindOrCreateFont(16, wxSWISS, wxNORMAL, wxBOLD);
|
||||
}
|
||||
dc->SetFont(headerFont);
|
||||
*/
|
||||
static wxFont *headerFont = (wxFont *) NULL;
|
||||
if (!headerFont)
|
||||
{
|
||||
headerFont = wxTheFontList->FindOrCreateFont(16, wxSWISS, wxNORMAL, wxBOLD);
|
||||
}
|
||||
dc->SetFont(headerFont);
|
||||
*/
|
||||
|
||||
int pageWidthMM, pageHeightMM;
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -762,10 +762,10 @@ void wxDocManager::OnPrintSetup(wxCommandEvent& WXUNUSED(event))
|
||||
if (view)
|
||||
parentWin = view->GetFrame();
|
||||
|
||||
wxPrintData data;
|
||||
wxPrintDialogData data;
|
||||
|
||||
wxPrintDialog printerDialog(parentWin, & data);
|
||||
printerDialog.GetPrintData().SetSetupDialog(TRUE);
|
||||
printerDialog.GetPrintDialogData().SetSetupDialog(TRUE);
|
||||
printerDialog.ShowModal();
|
||||
}
|
||||
|
||||
|
@@ -58,7 +58,7 @@
|
||||
#endif
|
||||
|
||||
#endif
|
||||
// End __WXMSW__
|
||||
// End __WXMSW__
|
||||
|
||||
#if !USE_SHARED_LIBRARY
|
||||
IMPLEMENT_CLASS(wxPrinterBase, wxObject)
|
||||
@@ -67,29 +67,28 @@ IMPLEMENT_CLASS(wxPreviewCanvas, wxWindow)
|
||||
IMPLEMENT_CLASS(wxPreviewControlBar, wxWindow)
|
||||
IMPLEMENT_CLASS(wxPreviewFrame, wxFrame)
|
||||
IMPLEMENT_CLASS(wxPrintPreviewBase, wxObject)
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxPrintPaperType, wxObject)
|
||||
|
||||
BEGIN_EVENT_TABLE(wxPrintAbortDialog, wxDialog)
|
||||
EVT_BUTTON(wxID_CANCEL, wxPrintAbortDialog::OnCancel)
|
||||
EVT_BUTTON(wxID_CANCEL, wxPrintAbortDialog::OnCancel)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
BEGIN_EVENT_TABLE(wxPreviewCanvas, wxScrolledWindow)
|
||||
EVT_PAINT(wxPreviewCanvas::OnPaint)
|
||||
EVT_SYS_COLOUR_CHANGED(wxPreviewCanvas::OnSysColourChanged)
|
||||
EVT_PAINT(wxPreviewCanvas::OnPaint)
|
||||
EVT_SYS_COLOUR_CHANGED(wxPreviewCanvas::OnSysColourChanged)
|
||||
END_EVENT_TABLE()
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Printer
|
||||
*/
|
||||
* Printer
|
||||
*/
|
||||
|
||||
wxPrinterBase::wxPrinterBase(wxPrintData *data)
|
||||
wxPrinterBase::wxPrinterBase(wxPrintDialogData *data)
|
||||
{
|
||||
m_currentPrintout = (wxPrintout *) NULL;
|
||||
sm_abortWindow = (wxWindow *) NULL;
|
||||
sm_abortIt = FALSE;
|
||||
if (data)
|
||||
m_printData = (*data);
|
||||
m_printDialogData = (*data);
|
||||
}
|
||||
|
||||
wxWindow *wxPrinterBase::sm_abortWindow = (wxWindow *) NULL;
|
||||
@@ -127,8 +126,8 @@ void wxPrinterBase::ReportError(wxWindow *parent, wxPrintout *WXUNUSED(printout)
|
||||
}
|
||||
|
||||
/*
|
||||
* Printout class
|
||||
*/
|
||||
* Printout class
|
||||
*/
|
||||
|
||||
wxPrintout::wxPrintout(const wxString& title)
|
||||
{
|
||||
@@ -181,12 +180,12 @@ void wxPrintout::GetPageInfo(int *minPage, int *maxPage, int *fromPage, int *toP
|
||||
}
|
||||
|
||||
/*
|
||||
* Preview canvas
|
||||
*/
|
||||
* Preview canvas
|
||||
*/
|
||||
|
||||
wxPreviewCanvas::wxPreviewCanvas(wxPrintPreviewBase *preview, wxWindow *parent,
|
||||
const wxPoint& pos, const wxSize& size, long style, const wxString& name):
|
||||
wxScrolledWindow(parent, -1, pos, size, style, name)
|
||||
wxScrolledWindow(parent, -1, pos, size, style, name)
|
||||
{
|
||||
m_printPreview = preview;
|
||||
SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_APPWORKSPACE));
|
||||
@@ -220,22 +219,22 @@ void wxPreviewCanvas::OnSysColourChanged(wxSysColourChangedEvent& event)
|
||||
}
|
||||
|
||||
/*
|
||||
* Preview control bar
|
||||
*/
|
||||
* Preview control bar
|
||||
*/
|
||||
|
||||
BEGIN_EVENT_TABLE(wxPreviewControlBar, wxPanel)
|
||||
EVT_BUTTON(wxID_PREVIEW_CLOSE, wxPreviewControlBar::OnWindowClose)
|
||||
EVT_BUTTON(wxID_PREVIEW_PRINT, wxPreviewControlBar::OnPrint)
|
||||
EVT_BUTTON(wxID_PREVIEW_PREVIOUS, wxPreviewControlBar::OnPrevious)
|
||||
EVT_BUTTON(wxID_PREVIEW_NEXT, wxPreviewControlBar::OnNext)
|
||||
EVT_CHOICE(wxID_PREVIEW_ZOOM, wxPreviewControlBar::OnZoom)
|
||||
EVT_PAINT(wxPreviewControlBar::OnPaint)
|
||||
EVT_BUTTON(wxID_PREVIEW_CLOSE, wxPreviewControlBar::OnWindowClose)
|
||||
EVT_BUTTON(wxID_PREVIEW_PRINT, wxPreviewControlBar::OnPrint)
|
||||
EVT_BUTTON(wxID_PREVIEW_PREVIOUS, wxPreviewControlBar::OnPrevious)
|
||||
EVT_BUTTON(wxID_PREVIEW_NEXT, wxPreviewControlBar::OnNext)
|
||||
EVT_CHOICE(wxID_PREVIEW_ZOOM, wxPreviewControlBar::OnZoom)
|
||||
EVT_PAINT(wxPreviewControlBar::OnPaint)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
wxPreviewControlBar::wxPreviewControlBar(wxPrintPreviewBase *preview, long buttons,
|
||||
wxWindow *parent, const wxPoint& pos, const wxSize& size,
|
||||
long style, const wxString& name):
|
||||
wxPanel(parent, -1, pos, size, style, name)
|
||||
wxPanel(parent, -1, pos, size, style, name)
|
||||
{
|
||||
m_printPreview = preview;
|
||||
m_closeButton = (wxButton *) NULL;
|
||||
@@ -315,11 +314,11 @@ void wxPreviewControlBar::CreateButtons()
|
||||
SetSize(0, 0, 400, 40);
|
||||
|
||||
/*
|
||||
#ifdef __WXMSW__
|
||||
#ifdef __WXMSW__
|
||||
int fontSize = 9;
|
||||
#else
|
||||
#else
|
||||
int fontSize = 10;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
wxFont buttonFont(fontSize, wxSWISS, wxNORMAL, wxBOLD);
|
||||
SetFont(buttonFont);
|
||||
@@ -428,16 +427,16 @@ int wxPreviewControlBar::GetZoomControl()
|
||||
|
||||
|
||||
/*
|
||||
* Preview frame
|
||||
*/
|
||||
* Preview frame
|
||||
*/
|
||||
|
||||
BEGIN_EVENT_TABLE(wxPreviewFrame, wxFrame)
|
||||
EVT_CLOSE(wxPreviewFrame::OnCloseWindow)
|
||||
EVT_CLOSE(wxPreviewFrame::OnCloseWindow)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
wxPreviewFrame::wxPreviewFrame(wxPrintPreviewBase *preview, wxFrame *parent, const wxString& title,
|
||||
const wxPoint& pos, const wxSize& size, long style, const wxString& name):
|
||||
wxFrame(parent, -1, title, pos, size, style, name)
|
||||
wxFrame(parent, -1, title, pos, size, style, name)
|
||||
{
|
||||
m_printPreview = preview;
|
||||
m_controlBar = NULL;
|
||||
@@ -480,8 +479,8 @@ void wxPreviewFrame::Initialize()
|
||||
|
||||
// Control bar constraints
|
||||
wxLayoutConstraints *c1 = new wxLayoutConstraints;
|
||||
// int w, h;
|
||||
// m_controlBar->GetSize(&w, &h);
|
||||
// int w, h;
|
||||
// m_controlBar->GetSize(&w, &h);
|
||||
int h;
|
||||
#if (defined(__WXMSW__) || defined(__WXGTK__))
|
||||
h = 40;
|
||||
@@ -529,10 +528,10 @@ void wxPreviewFrame::CreateControlBar()
|
||||
}
|
||||
|
||||
/*
|
||||
* Print preview
|
||||
*/
|
||||
* Print preview
|
||||
*/
|
||||
|
||||
wxPrintPreviewBase::wxPrintPreviewBase(wxPrintout *printout, wxPrintout *printoutForPrinting, wxPrintData *data)
|
||||
wxPrintPreviewBase::wxPrintPreviewBase(wxPrintout *printout, wxPrintout *printoutForPrinting, wxPrintDialogData *data)
|
||||
{
|
||||
m_isOk = TRUE;
|
||||
m_previewPrintout = printout;
|
||||
@@ -541,7 +540,7 @@ wxPrintPreviewBase::wxPrintPreviewBase(wxPrintout *printout, wxPrintout *printou
|
||||
|
||||
m_printPrintout = printoutForPrinting;
|
||||
if (data)
|
||||
m_printData = (*data);
|
||||
m_printDialogData = (*data);
|
||||
|
||||
m_previewCanvas = NULL;
|
||||
m_previewFrame = NULL;
|
||||
@@ -608,7 +607,7 @@ bool wxPrintPreviewBase::PaintPage(wxWindow *canvas, wxDC& dc)
|
||||
|
||||
double zoomScale = ((float)m_currentZoom/(float)100);
|
||||
double actualWidth = (zoomScale*m_pageWidth*m_previewScale);
|
||||
// float actualHeight = (float)(zoomScale*m_pageHeight*m_previewScale);
|
||||
// float actualHeight = (float)(zoomScale*m_pageHeight*m_previewScale);
|
||||
|
||||
int x = (int) ((canvasWidth - actualWidth)/2.0);
|
||||
if (x < m_leftMargin)
|
||||
@@ -644,7 +643,7 @@ bool wxPrintPreviewBase::RenderPage(int pageNum)
|
||||
int x = (int)((canvasWidth - actualWidth)/2.0);
|
||||
if (x < m_leftMargin)
|
||||
x = m_leftMargin;
|
||||
// int y = m_topMargin;
|
||||
// int y = m_topMargin;
|
||||
|
||||
|
||||
if (!m_previewBitmap)
|
||||
@@ -669,8 +668,7 @@ bool wxPrintPreviewBase::RenderPage(int pageNum)
|
||||
|
||||
m_previewPrintout->OnBeginPrinting();
|
||||
|
||||
|
||||
if (!m_previewPrintout->OnBeginDocument(m_printData.GetFromPage(), m_printData.GetToPage()))
|
||||
if (!m_previewPrintout->OnBeginDocument(m_printDialogData.GetFromPage(), m_printDialogData.GetToPage()))
|
||||
{
|
||||
wxMessageBox(_("Could not start document preview."), _("Print Preview Failure"), wxOK);
|
||||
|
||||
@@ -719,9 +717,9 @@ bool wxPrintPreviewBase::DrawBlankPage(wxWindow *canvas, wxDC& dc)
|
||||
int shadowOffset = 4;
|
||||
dc.SetPen(*wxBLACK_PEN);
|
||||
dc.SetBrush(*wxBLACK_BRUSH);
|
||||
/*
|
||||
/*
|
||||
dc.DrawRectangle((int)(x-1 + shadowOffset), (int)(y-1 + shadowOffset), (int)(actualWidth+2), (int)(actualHeight+2));
|
||||
*/
|
||||
*/
|
||||
dc.DrawRectangle((int)(x + shadowOffset), (int)(y + actualHeight+1), (int)(actualWidth), shadowOffset);
|
||||
dc.DrawRectangle((int)(x + actualWidth), (int)(y + shadowOffset), shadowOffset, (int)(actualHeight));
|
||||
|
||||
@@ -729,12 +727,12 @@ bool wxPrintPreviewBase::DrawBlankPage(wxWindow *canvas, wxDC& dc)
|
||||
dc.SetPen(*wxBLACK_PEN);
|
||||
dc.SetBrush(*wxWHITE_BRUSH);
|
||||
|
||||
/*
|
||||
/*
|
||||
wxRegion update_region = canvas->GetUpdateRegion();
|
||||
wxRect r = update_region.GetBox();
|
||||
|
||||
printf( "x: %d y: %d w: %d h: %d.\n", (int)r.x, (int)r.y, (int)r.width, (int)r.height );
|
||||
*/
|
||||
*/
|
||||
|
||||
dc.DrawRectangle((int)(x-2), (int)(y-1), (int)(actualWidth+3), (int)(actualHeight+2));
|
||||
|
||||
@@ -761,120 +759,3 @@ void wxPrintPreviewBase::SetZoom(int percent)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Paper size database for PostScript or where the generic page setup dialog is
|
||||
* needed
|
||||
*/
|
||||
|
||||
wxPrintPaperType::wxPrintPaperType(const char *name, int wmm, int hmm, int wp, int hp)
|
||||
{
|
||||
widthMM = wmm;
|
||||
heightMM = hmm;
|
||||
widthPixels = wp;
|
||||
heightPixels = hp;
|
||||
pageName = copystring(name);
|
||||
}
|
||||
|
||||
wxPrintPaperType::~wxPrintPaperType()
|
||||
{
|
||||
delete[] pageName;
|
||||
}
|
||||
|
||||
/*
|
||||
* Print paper database for PostScript
|
||||
*/
|
||||
|
||||
wxPrintPaperDatabase* wxThePrintPaperDatabase = (wxPrintPaperDatabase*) NULL;
|
||||
|
||||
#if !USE_SHARED_LIBRARIES
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxPrintPaperDatabase, wxList)
|
||||
#endif
|
||||
|
||||
wxPrintPaperDatabase::wxPrintPaperDatabase():wxList(wxKEY_STRING)
|
||||
{
|
||||
DeleteContents(TRUE);
|
||||
}
|
||||
|
||||
wxPrintPaperDatabase::~wxPrintPaperDatabase()
|
||||
{
|
||||
}
|
||||
|
||||
void wxPrintPaperDatabase::CreateDatabase()
|
||||
{
|
||||
// Need correct values for page size in pixels.
|
||||
// Each unit is one 'point' = 1/72 of an inch.
|
||||
// NOTE: WE NEED ALSO TO MAKE ADJUSTMENTS WHEN TRANSLATING
|
||||
// in wxPostScriptDC code, so we can start from top left.
|
||||
// So access this database and translate by appropriate number
|
||||
// of points for this paper size. OR IS IT OK ALREADY?
|
||||
// Can't remember where the PostScript origin is by default.
|
||||
// Heck, someone will know how to make it hunky-dory...
|
||||
// JACS 25/5/95
|
||||
|
||||
AddPaperType(_("A4 210 x 297 mm"), 210, 297, 595, 842);
|
||||
AddPaperType(_("A3 297 x 420 mm"), 297, 420, 842, 1191);
|
||||
AddPaperType(_("Letter 8 1/2 x 11 in"), 216, 279, 612, 791);
|
||||
AddPaperType(_("Legal 8 1/2 x 14 in"), 216, 356, 612, 1009);
|
||||
|
||||
/*
|
||||
This is for 100 ppi
|
||||
|
||||
AddPaperType(_("A4 210 x 297 mm"), 210, 297, 210*4, 297*4 );
|
||||
AddPaperType(_("A3 297 x 420 mm"), 297, 420, 297*4, 420*4 );
|
||||
AddPaperType(_("Letter 8 1/2 x 11 in"), 216, 279, 216*4, 279*4 );
|
||||
AddPaperType(_("Legal 8 1/2 x 14 in"), 216, 356, 216*4, 356*4 );
|
||||
*/
|
||||
}
|
||||
|
||||
void wxPrintPaperDatabase::ClearDatabase()
|
||||
{
|
||||
Clear();
|
||||
}
|
||||
|
||||
void wxPrintPaperDatabase::AddPaperType(const char *name, int wmm, int hmm, int wp, int hp)
|
||||
{
|
||||
Append(name, new wxPrintPaperType(name, wmm, hmm, wp, hp));
|
||||
}
|
||||
|
||||
wxPrintPaperType *wxPrintPaperDatabase::FindPaperType(const char *name)
|
||||
{
|
||||
wxNode *node = Find(name);
|
||||
if (node)
|
||||
return (wxPrintPaperType *)node->Data();
|
||||
else
|
||||
return (wxPrintPaperType *) NULL;
|
||||
}
|
||||
|
||||
// A module to allow initialization/cleanup of print paper
|
||||
// things without calling these functions from app.cpp.
|
||||
|
||||
class WXDLLEXPORT wxPrintBaseModule: public wxModule
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxPrintBaseModule)
|
||||
public:
|
||||
wxPrintBaseModule() {}
|
||||
bool OnInit();
|
||||
void OnExit();
|
||||
};
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxPrintBaseModule, wxModule)
|
||||
|
||||
/*
|
||||
* Initialization/cleanup module
|
||||
*/
|
||||
|
||||
bool wxPrintBaseModule::OnInit()
|
||||
{
|
||||
wxThePrintPaperDatabase = new wxPrintPaperDatabase;
|
||||
wxThePrintPaperDatabase->CreateDatabase();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void wxPrintBaseModule::OnExit()
|
||||
{
|
||||
delete wxThePrintPaperDatabase;
|
||||
wxThePrintPaperDatabase = NULL;
|
||||
}
|
||||
|
||||
|
||||
|
@@ -42,6 +42,7 @@
|
||||
#include "wx/radiobox.h"
|
||||
#include "wx/textctrl.h"
|
||||
#include "wx/prntbase.h"
|
||||
#include "wx/paper.h"
|
||||
|
||||
#include <math.h>
|
||||
|
||||
@@ -245,6 +246,9 @@ wxPostScriptDC::wxPostScriptDC ()
|
||||
|
||||
m_signX = 1; // default x-axis left to right
|
||||
m_signY = -1; // default y-axis bottom up -> top down
|
||||
|
||||
// Compatibility only
|
||||
m_printData = * wxThePrintSetupData;
|
||||
}
|
||||
|
||||
wxPostScriptDC::wxPostScriptDC (const wxString& file, bool interactive, wxWindow *parent)
|
||||
@@ -273,11 +277,11 @@ bool wxPostScriptDC::Create(const wxString& file, bool interactive, wxWindow *pa
|
||||
m_isInteractive = interactive;
|
||||
|
||||
m_title = "";
|
||||
m_filename = file;
|
||||
m_printData.SetFilename(file);
|
||||
|
||||
#ifdef __WXMSW__
|
||||
// Can only send to file in Windows
|
||||
wxThePrintSetupData->SetPrinterMode(PS_FILE);
|
||||
m_printData.SetPrintMode(wxPRINT_MODE_FILE);
|
||||
#endif
|
||||
|
||||
if (m_isInteractive)
|
||||
@@ -292,6 +296,27 @@ bool wxPostScriptDC::Create(const wxString& file, bool interactive, wxWindow *pa
|
||||
return m_ok;
|
||||
}
|
||||
|
||||
wxPostScriptDC::wxPostScriptDC (const wxPrintData& printData)
|
||||
{
|
||||
m_pstream = (ofstream*) NULL;
|
||||
|
||||
m_currentRed = 0;
|
||||
m_currentGreen = 0;
|
||||
m_currentBlue = 0;
|
||||
|
||||
m_pageNumber = 0;
|
||||
|
||||
m_clipping = FALSE;
|
||||
|
||||
m_underlinePosition = 0.0;
|
||||
m_underlineThickness = 0.0;
|
||||
|
||||
m_signX = 1; // default x-axis left to right
|
||||
m_signY = -1; // default y-axis bottom up -> top down
|
||||
|
||||
m_printData = printData;
|
||||
}
|
||||
|
||||
wxPostScriptDC::~wxPostScriptDC ()
|
||||
{
|
||||
if (m_pstream) delete m_pstream;
|
||||
@@ -302,6 +327,7 @@ bool wxPostScriptDC::Ok() const
|
||||
return m_ok;
|
||||
}
|
||||
|
||||
// This dialog is deprecated now: use wxGenericPrintDialog or the printing framework
|
||||
bool wxPostScriptDC::PrinterDialog(wxWindow *parent)
|
||||
{
|
||||
wxPostScriptPrintDialog dialog( parent, _("Printer Settings"), wxPoint(150, 150), wxSize(400, 400),
|
||||
@@ -310,13 +336,13 @@ bool wxPostScriptDC::PrinterDialog(wxWindow *parent)
|
||||
|
||||
if (!m_ok) return FALSE;
|
||||
|
||||
if ((m_filename == "") &&
|
||||
(wxThePrintSetupData->GetPrinterMode() == PS_PREVIEW ||
|
||||
wxThePrintSetupData->GetPrinterMode() == PS_PRINTER))
|
||||
if ((m_printData.GetFilename() == "") &&
|
||||
(m_printData.GetPrintMode() == wxPRINT_MODE_PREVIEW ||
|
||||
m_printData.GetPrintMode() == wxPRINT_MODE_PRINTER))
|
||||
{
|
||||
// steve, 05.09.94
|
||||
#ifdef __VMS__
|
||||
wxThePrintSetupData->SetPrinterFile("preview");
|
||||
m_printData.SetFilename("preview");
|
||||
#else
|
||||
// For PS_PRINTER action this depends on a Unix-style print spooler
|
||||
// since the wx_printer_file can be destroyed during a session
|
||||
@@ -326,15 +352,14 @@ bool wxPostScriptDC::PrinterDialog(wxWindow *parent)
|
||||
char tmp[256];
|
||||
strcpy (tmp, "/tmp/preview_");
|
||||
strcat (tmp, userId);
|
||||
wxThePrintSetupData->SetPrinterFile(tmp);
|
||||
m_printData.SetFilename(tmp);
|
||||
#endif
|
||||
char tmp2[256];
|
||||
strcpy(tmp2, wxThePrintSetupData->GetPrinterFile());
|
||||
strcpy(tmp2, m_printData.GetFilename());
|
||||
strcat (tmp2, ".ps");
|
||||
wxThePrintSetupData->SetPrinterFile(tmp2);
|
||||
m_filename = tmp2;
|
||||
m_printData.SetFilename(tmp2);
|
||||
}
|
||||
else if ((m_filename == "") && (wxThePrintSetupData->GetPrinterMode() == PS_FILE))
|
||||
else if ((m_printData.GetFilename() == "") && (m_printData.GetPrintMode() == wxPRINT_MODE_FILE))
|
||||
{
|
||||
wxString file = wxSaveFileSelector (_("PostScript"), "ps");
|
||||
if ( file.IsEmpty() )
|
||||
@@ -343,8 +368,7 @@ bool wxPostScriptDC::PrinterDialog(wxWindow *parent)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
wxThePrintSetupData->SetPrinterFile(file);
|
||||
m_filename = file;
|
||||
m_printData.SetFilename(file);
|
||||
m_ok = TRUE;
|
||||
}
|
||||
|
||||
@@ -1206,18 +1230,16 @@ void wxPostScriptDC::SetDeviceOrigin( long x, long y )
|
||||
|
||||
void wxPostScriptDC::GetSize(int* width, int* height) const
|
||||
{
|
||||
const char *paperType = wxThePrintSetupData->GetPaperName();
|
||||
wxPaperSize id = m_printData.GetPaperId();
|
||||
|
||||
if (!paperType) paperType = _("A4 210 x 297 mm");
|
||||
wxPrintPaperType *paper = wxThePrintPaperDatabase->FindPaperType(id);
|
||||
|
||||
wxPrintPaperType *paper = wxThePrintPaperDatabase->FindPaperType(paperType);
|
||||
|
||||
if (!paper) paper = wxThePrintPaperDatabase->FindPaperType(_("A4 210 x 297 mm"));
|
||||
if (!paper) paper = wxThePrintPaperDatabase->FindPaperType(wxPAPER_A4);
|
||||
|
||||
if (paper)
|
||||
{
|
||||
if (width) *width = paper->widthPixels;
|
||||
if (height) *height = paper->heightPixels;
|
||||
if (width) *width = paper->GetSizeDeviceUnits().x;
|
||||
if (height) *height = paper->GetSizeDeviceUnits().y;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1226,22 +1248,46 @@ void wxPostScriptDC::GetSize(int* width, int* height) const
|
||||
}
|
||||
}
|
||||
|
||||
void wxPostScriptDC::GetSizeMM(int *width, int *height) const
|
||||
{
|
||||
wxPaperSize id = m_printData.GetPaperId();
|
||||
|
||||
wxPrintPaperType *paper = wxThePrintPaperDatabase->FindPaperType(id);
|
||||
|
||||
if (!paper) paper = wxThePrintPaperDatabase->FindPaperType(wxPAPER_A4);
|
||||
|
||||
if (paper)
|
||||
{
|
||||
if (width) *width = paper->GetWidth() / 10;
|
||||
if (height) *height = paper->GetHeight() / 10;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (width) *width = 210;
|
||||
if (height) *height = 297;
|
||||
}
|
||||
}
|
||||
|
||||
// Resolution in pixels per logical inch
|
||||
wxSize wxPostScriptDC::GetPPI(void) const
|
||||
{
|
||||
return wxSize(72, 72);
|
||||
}
|
||||
|
||||
|
||||
bool wxPostScriptDC::StartDoc (const wxString& message)
|
||||
{
|
||||
wxCHECK_MSG( m_ok, FALSE, "invalid postscript dc" );
|
||||
|
||||
if (m_filename == "")
|
||||
if (m_printData.GetFilename() == "")
|
||||
{
|
||||
m_filename = wxGetTempFileName("ps");
|
||||
wxThePrintSetupData->SetPrinterFile((char *)(const char *)m_filename);
|
||||
wxString filename = wxGetTempFileName("ps");
|
||||
m_printData.SetFilename(filename);
|
||||
|
||||
m_ok = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
wxThePrintSetupData->SetPrinterFile((char *)(const char *)m_filename);
|
||||
}
|
||||
|
||||
m_pstream = new ofstream (wxThePrintSetupData->GetPrinterFile());
|
||||
m_pstream = new ofstream (m_printData.GetFilename());
|
||||
|
||||
if (!m_pstream || !m_pstream->good())
|
||||
{
|
||||
@@ -1309,10 +1355,14 @@ void wxPostScriptDC::EndDoc ()
|
||||
|
||||
long wx_printer_translate_x, wx_printer_translate_y;
|
||||
double wx_printer_scale_x, wx_printer_scale_y;
|
||||
wxThePrintSetupData->GetPrinterTranslation(&wx_printer_translate_x, &wx_printer_translate_y);
|
||||
wxThePrintSetupData->GetPrinterScaling(&wx_printer_scale_x, &wx_printer_scale_y);
|
||||
|
||||
if (wxThePrintSetupData->GetPrinterOrientation() == PS_LANDSCAPE)
|
||||
wx_printer_translate_x = m_printData.GetPrinterTranslateX();
|
||||
wx_printer_translate_y = m_printData.GetPrinterTranslateY();
|
||||
|
||||
wx_printer_scale_x = m_printData.GetPrinterScaleX();
|
||||
wx_printer_scale_y = m_printData.GetPrinterScaleY();
|
||||
|
||||
if (m_printData.GetOrientation() == wxLANDSCAPE)
|
||||
{
|
||||
*m_pstream << "%%Orientation: Landscape\n";
|
||||
}
|
||||
@@ -1329,7 +1379,7 @@ void wxPostScriptDC::EndDoc ()
|
||||
long ury = (long) ((YLOG2DEV(m_maxY)+wx_printer_translate_y)*wx_printer_scale_y);
|
||||
|
||||
// If we're landscape, our sense of "x" and "y" is reversed.
|
||||
if (wxThePrintSetupData->GetPrinterOrientation() == PS_LANDSCAPE)
|
||||
if (m_printData.GetOrientation() == wxLANDSCAPE)
|
||||
{
|
||||
long tmp;
|
||||
tmp = llx; llx = lly; lly = tmp;
|
||||
@@ -1378,46 +1428,53 @@ void wxPostScriptDC::EndDoc ()
|
||||
char *tmp_file = wxGetTempFileName("ps");
|
||||
|
||||
// Paste header Before wx_printer_file
|
||||
wxConcatFiles (header_file, wxThePrintSetupData->GetPrinterFile(), tmp_file);
|
||||
wxConcatFiles (header_file, m_printData.GetFilename(), tmp_file);
|
||||
wxRemoveFile (header_file);
|
||||
wxRemoveFile (wxThePrintSetupData->GetPrinterFile());
|
||||
wxRenameFile(tmp_file, wxThePrintSetupData->GetPrinterFile());
|
||||
wxRemoveFile (m_printData.GetFilename());
|
||||
wxRenameFile(tmp_file, m_printData.GetFilename());
|
||||
|
||||
#if defined(__X__) || defined(__WXGTK__)
|
||||
if (m_ok)
|
||||
{
|
||||
switch (wxThePrintSetupData->GetPrinterMode()) {
|
||||
case PS_PREVIEW:
|
||||
wxString previewCommand(m_printData.GetPreviewCommand());
|
||||
wxString printerCommand(m_printData.GetPrinterCommand());
|
||||
wxString printerOptions(m_printData.GetPrinterOptions());
|
||||
wxString filename(m_printData.GetFilename());
|
||||
|
||||
switch (m_printData.GetPrintMode()) {
|
||||
|
||||
case wxPRINT_MODE_PREVIEW:
|
||||
{
|
||||
char *argv[3];
|
||||
argv[0] = wxThePrintSetupData->GetPrintPreviewCommand();
|
||||
argv[1] = wxThePrintSetupData->GetPrinterFile();
|
||||
argv[2] = (char *) NULL;
|
||||
argv[0] = (char*) (const char*) previewCommand;
|
||||
argv[1] = (char*) (const char*) filename;
|
||||
argv[2] = (char*) (char *) NULL;
|
||||
wxExecute (argv, TRUE);
|
||||
wxRemoveFile(wxThePrintSetupData->GetPrinterFile());
|
||||
wxRemoveFile(m_printData.GetFilename());
|
||||
}
|
||||
break;
|
||||
|
||||
case PS_PRINTER:
|
||||
case wxPRINT_MODE_PRINTER:
|
||||
{
|
||||
char *argv[4];
|
||||
int argc = 0;
|
||||
argv[argc++] = wxThePrintSetupData->GetPrinterCommand();
|
||||
argv[argc++] = (char*) (const char*) printerCommand;
|
||||
|
||||
// !SM! If we simply assign to argv[1] here, if printer options
|
||||
// are blank, we get an annoying and confusing message from lpr.
|
||||
char * opts = wxThePrintSetupData->GetPrinterOptions();
|
||||
char * opts = (char*) (const char*) printerOptions;
|
||||
if (opts && *opts)
|
||||
argv[argc++] = opts;
|
||||
|
||||
argv[argc++] = wxThePrintSetupData->GetPrinterFile();
|
||||
argv[argc++] = (char*) (const char*) filename;
|
||||
argv[argc++] = (char *) NULL;
|
||||
wxExecute (argv, TRUE);
|
||||
wxRemoveFile(wxThePrintSetupData->GetPrinterFile());
|
||||
wxRemoveFile(filename);
|
||||
}
|
||||
break;
|
||||
|
||||
case PS_FILE:
|
||||
case wxPRINT_MODE_FILE:
|
||||
case wxPRINT_MODE_NONE:
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1446,10 +1503,14 @@ void wxPostScriptDC::StartPage ()
|
||||
// Output scaling
|
||||
long translate_x, translate_y;
|
||||
double scale_x, scale_y;
|
||||
wxThePrintSetupData->GetPrinterTranslation(&translate_x, &translate_y);
|
||||
wxThePrintSetupData->GetPrinterScaling(&scale_x, &scale_y);
|
||||
|
||||
if (wxThePrintSetupData->GetPrinterOrientation() == PS_LANDSCAPE)
|
||||
translate_x = m_printData.GetPrinterTranslateX();
|
||||
translate_y = m_printData.GetPrinterTranslateY();
|
||||
|
||||
scale_x = m_printData.GetPrinterScaleX();
|
||||
scale_y = m_printData.GetPrinterScaleY();
|
||||
|
||||
if (m_printData.GetOrientation() == wxLANDSCAPE)
|
||||
{
|
||||
translate_y -= m_maxY;
|
||||
*m_pstream << "90 rotate\n";
|
||||
@@ -1621,7 +1682,8 @@ void wxPostScriptDC::GetTextExtent( const wxString& string, long *x, long *y,
|
||||
/* get the directory of the AFM files */
|
||||
char afmName[256];
|
||||
afmName[0] = 0;
|
||||
if (wxGetAFMPath()) strcpy( afmName, wxGetAFMPath() );
|
||||
wxString fmPath(m_printData.GetFontMetricPath());
|
||||
if (fmPath != "") strcpy( afmName, (const char*) fmPath );
|
||||
|
||||
/* 2. open and process the file
|
||||
/ a short explanation of the AFM format:
|
||||
@@ -1794,28 +1856,6 @@ void wxPostScriptDC::GetTextExtent( const wxString& string, long *x, long *y,
|
||||
#endif
|
||||
}
|
||||
|
||||
void wxPostScriptDC::GetSizeMM(long *width, long *height) const
|
||||
{
|
||||
const char *paperType = wxThePrintSetupData->GetPaperName();
|
||||
|
||||
if (!paperType) paperType = _("A4 210 x 297 mm");
|
||||
|
||||
wxPrintPaperType *paper = wxThePrintPaperDatabase->FindPaperType(paperType);
|
||||
|
||||
if (!paper) paper = wxThePrintPaperDatabase->FindPaperType(_("A4 210 x 297 mm"));
|
||||
|
||||
if (paper)
|
||||
{
|
||||
if (width) *width = paper->widthMM;
|
||||
if (height) *height = paper->heightMM;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (width) *width = 210;
|
||||
if (height) *height = 297;
|
||||
}
|
||||
}
|
||||
|
||||
// Determine the Default Postscript Previewer
|
||||
// available on the platform
|
||||
#if defined(__SUN__) && defined(__XVIEW__)
|
||||
@@ -1898,7 +1938,7 @@ wxPostScriptPrintDialog::wxPostScriptPrintDialog (wxWindow *parent, const wxStri
|
||||
if (wxThePrintSetupData->GetPrintPreviewCommand() == NULL)
|
||||
wxThePrintSetupData->SetPrintPreviewCommand(PS_VIEWER_PROG);
|
||||
|
||||
wxGetResource ("wxWindows", "PSView", &wxThePrintSetupData->previewCommand);
|
||||
// wxGetResource ("wxWindows", "PSView", &wxThePrintSetupData->m_previewCommand);
|
||||
|
||||
features = (wxThePrintSetupData->GetPrintPreviewCommand() &&
|
||||
*wxThePrintSetupData->GetPrintPreviewCommand()) ? 3 : 2;
|
||||
@@ -1959,17 +1999,17 @@ int wxPostScriptPrintDialog::ShowModal ()
|
||||
wxRadioBox *radio0 = (wxRadioBox *)FindWindow(wxID_PRINTER_ORIENTATION);
|
||||
wxRadioBox *radio1 = (wxRadioBox *)FindWindow(wxID_PRINTER_MODES);
|
||||
|
||||
StringToDouble (WXSTRINGCAST text1->GetValue (), &wxThePrintSetupData->printerScaleX);
|
||||
StringToDouble (WXSTRINGCAST text2->GetValue (), &wxThePrintSetupData->printerScaleY);
|
||||
StringToLong (WXSTRINGCAST text3->GetValue (), &wxThePrintSetupData->printerTranslateX);
|
||||
StringToLong (WXSTRINGCAST text4->GetValue (), &wxThePrintSetupData->printerTranslateY);
|
||||
StringToDouble (WXSTRINGCAST text1->GetValue (), &wxThePrintSetupData->m_printerScaleX);
|
||||
StringToDouble (WXSTRINGCAST text2->GetValue (), &wxThePrintSetupData->m_printerScaleY);
|
||||
StringToLong (WXSTRINGCAST text3->GetValue (), &wxThePrintSetupData->m_printerTranslateX);
|
||||
StringToLong (WXSTRINGCAST text4->GetValue (), &wxThePrintSetupData->m_printerTranslateY);
|
||||
|
||||
#ifdef __X__
|
||||
// wxThePrintSetupData->SetPrinterOptions(WXSTRINGCAST text0->GetValue ());
|
||||
// wxThePrintSetupData->SetPrinterCommand(WXSTRINGCAST text_prt->GetValue ());
|
||||
#endif
|
||||
|
||||
wxThePrintSetupData->SetPrinterOrientation((radio0->GetSelection() == 1 ? PS_LANDSCAPE : PS_PORTRAIT));
|
||||
wxThePrintSetupData->SetPrinterOrientation((radio0->GetSelection() == 1 ? wxLANDSCAPE : wxPORTRAIT));
|
||||
|
||||
// C++ wants this
|
||||
switch ( radio1->GetSelection() ) {
|
||||
@@ -1986,22 +2026,22 @@ int wxPostScriptPrintDialog::ShowModal ()
|
||||
|
||||
// PostScript printer settings
|
||||
// RETAINED FOR BACKWARD COMPATIBILITY
|
||||
void wxSetPrinterCommand(const char *cmd)
|
||||
void wxSetPrinterCommand(const wxString& cmd)
|
||||
{
|
||||
wxThePrintSetupData->SetPrinterCommand(cmd);
|
||||
}
|
||||
|
||||
void wxSetPrintPreviewCommand(const char *cmd)
|
||||
void wxSetPrintPreviewCommand(const wxString& cmd)
|
||||
{
|
||||
wxThePrintSetupData->SetPrintPreviewCommand(cmd);
|
||||
}
|
||||
|
||||
void wxSetPrinterOptions(const char *flags)
|
||||
void wxSetPrinterOptions(const wxString& flags)
|
||||
{
|
||||
wxThePrintSetupData->SetPrinterOptions(flags);
|
||||
}
|
||||
|
||||
void wxSetPrinterFile(const char *f)
|
||||
void wxSetPrinterFile(const wxString& f)
|
||||
{
|
||||
wxThePrintSetupData->SetPrinterFile(f);
|
||||
}
|
||||
@@ -2027,28 +2067,28 @@ void wxSetPrinterMode(int mode)
|
||||
wxThePrintSetupData->SetPrinterMode(mode);
|
||||
}
|
||||
|
||||
void wxSetAFMPath(const char *f)
|
||||
void wxSetAFMPath(const wxString& f)
|
||||
{
|
||||
wxThePrintSetupData->SetAFMPath(f);
|
||||
}
|
||||
|
||||
// Get current values
|
||||
char *wxGetPrinterCommand()
|
||||
wxString wxGetPrinterCommand()
|
||||
{
|
||||
return wxThePrintSetupData->GetPrinterCommand();
|
||||
}
|
||||
|
||||
char *wxGetPrintPreviewCommand()
|
||||
wxString wxGetPrintPreviewCommand()
|
||||
{
|
||||
return wxThePrintSetupData->GetPrintPreviewCommand();
|
||||
}
|
||||
|
||||
char *wxGetPrinterOptions()
|
||||
wxString wxGetPrinterOptions()
|
||||
{
|
||||
return wxThePrintSetupData->GetPrinterOptions();
|
||||
}
|
||||
|
||||
char *wxGetPrinterFile()
|
||||
wxString wxGetPrinterFile()
|
||||
{
|
||||
return wxThePrintSetupData->GetPrinterFile();
|
||||
}
|
||||
@@ -2073,7 +2113,7 @@ int wxGetPrinterMode()
|
||||
return wxThePrintSetupData->GetPrinterMode();
|
||||
}
|
||||
|
||||
char *wxGetAFMPath()
|
||||
wxString wxGetAFMPath()
|
||||
{
|
||||
return wxThePrintSetupData->GetAFMPath();
|
||||
}
|
||||
@@ -2084,200 +2124,17 @@ char *wxGetAFMPath()
|
||||
|
||||
wxPrintSetupData::wxPrintSetupData()
|
||||
{
|
||||
printerCommand = (char *) NULL;
|
||||
previewCommand = (char *) NULL;
|
||||
printerFlags = (char *) NULL;
|
||||
printerOrient = PS_PORTRAIT;
|
||||
printerScaleX = (double)1.0;
|
||||
printerScaleY = (double)1.0;
|
||||
printerTranslateX = 0;
|
||||
printerTranslateY = 0;
|
||||
// 1 = Preview, 2 = print to file, 3 = send to printer
|
||||
printerMode = 3;
|
||||
afmPath = (char *) NULL;
|
||||
paperName = (char *) NULL;
|
||||
printColour = TRUE;
|
||||
printerFile = (char *) NULL;
|
||||
m_printerOrient = wxPORTRAIT;
|
||||
m_printerScaleX = (double)1.0;
|
||||
m_printerScaleY = (double)1.0;
|
||||
m_printerTranslateX = 0;
|
||||
m_printerTranslateY = 0;
|
||||
m_printerMode = wxPRINT_MODE_FILE;
|
||||
m_printColour = TRUE;
|
||||
}
|
||||
|
||||
wxPrintSetupData::~wxPrintSetupData()
|
||||
{
|
||||
if (printerCommand)
|
||||
delete[] printerCommand;
|
||||
if (previewCommand)
|
||||
delete[] previewCommand;
|
||||
if (printerFlags)
|
||||
delete[] printerFlags;
|
||||
if (afmPath)
|
||||
delete[] afmPath;
|
||||
if (paperName)
|
||||
delete[] paperName;
|
||||
if (printerFile)
|
||||
delete[] printerFile;
|
||||
}
|
||||
|
||||
void wxPrintSetupData::SetPrinterCommand(const char *cmd)
|
||||
{
|
||||
if (cmd == printerCommand)
|
||||
return;
|
||||
|
||||
if (printerCommand)
|
||||
delete[] printerCommand;
|
||||
if (cmd)
|
||||
printerCommand = copystring(cmd);
|
||||
else
|
||||
printerCommand = (char *) NULL;
|
||||
}
|
||||
|
||||
void wxPrintSetupData::SetPrintPreviewCommand(const char *cmd)
|
||||
{
|
||||
if (cmd == previewCommand)
|
||||
return;
|
||||
|
||||
if (previewCommand)
|
||||
delete[] previewCommand;
|
||||
if (cmd)
|
||||
previewCommand = copystring(cmd);
|
||||
else
|
||||
previewCommand = (char *) NULL;
|
||||
}
|
||||
|
||||
void wxPrintSetupData::SetPaperName(const char *name)
|
||||
{
|
||||
if (name == paperName)
|
||||
return;
|
||||
|
||||
if (paperName)
|
||||
delete[] paperName;
|
||||
if (name)
|
||||
paperName = copystring(name);
|
||||
else
|
||||
paperName = (char *) NULL;
|
||||
}
|
||||
|
||||
void wxPrintSetupData::SetPrinterOptions(const char *flags)
|
||||
{
|
||||
if (printerFlags == flags)
|
||||
return;
|
||||
|
||||
if (printerFlags)
|
||||
delete[] printerFlags;
|
||||
if (flags)
|
||||
printerFlags = copystring(flags);
|
||||
else
|
||||
printerFlags = (char *) NULL;
|
||||
}
|
||||
|
||||
void wxPrintSetupData::SetPrinterFile(const char *f)
|
||||
{
|
||||
if (f == printerFile)
|
||||
return;
|
||||
|
||||
if (printerFile)
|
||||
delete[] printerFile;
|
||||
if (f)
|
||||
printerFile = copystring(f);
|
||||
else
|
||||
printerFile = (char *) NULL;
|
||||
}
|
||||
|
||||
void wxPrintSetupData::SetPrinterOrientation(int orient)
|
||||
{
|
||||
printerOrient = orient;
|
||||
}
|
||||
|
||||
void wxPrintSetupData::SetPrinterScaling(double x, double y)
|
||||
{
|
||||
printerScaleX = x;
|
||||
printerScaleY = y;
|
||||
}
|
||||
|
||||
void wxPrintSetupData::SetPrinterTranslation(long x, long y)
|
||||
{
|
||||
printerTranslateX = x;
|
||||
printerTranslateY = y;
|
||||
}
|
||||
|
||||
// 1 = Preview, 2 = print to file, 3 = send to printer
|
||||
void wxPrintSetupData::SetPrinterMode(int mode)
|
||||
{
|
||||
printerMode = mode;
|
||||
}
|
||||
|
||||
void wxPrintSetupData::SetAFMPath(const char *f)
|
||||
{
|
||||
if (f == afmPath)
|
||||
return;
|
||||
|
||||
if (afmPath)
|
||||
delete[] afmPath;
|
||||
if (f)
|
||||
afmPath = copystring(f);
|
||||
else
|
||||
afmPath = (char *) NULL;
|
||||
}
|
||||
|
||||
void wxPrintSetupData::SetColour(bool col)
|
||||
{
|
||||
printColour = col;
|
||||
}
|
||||
|
||||
// Get current values
|
||||
char *wxPrintSetupData::GetPrinterCommand()
|
||||
{
|
||||
return printerCommand;
|
||||
}
|
||||
|
||||
char *wxPrintSetupData::GetPrintPreviewCommand()
|
||||
{
|
||||
return previewCommand;
|
||||
}
|
||||
|
||||
char *wxPrintSetupData::GetPrinterOptions()
|
||||
{
|
||||
return printerFlags;
|
||||
}
|
||||
|
||||
char *wxPrintSetupData::GetPrinterFile()
|
||||
{
|
||||
return printerFile;
|
||||
}
|
||||
|
||||
char *wxPrintSetupData::GetPaperName()
|
||||
{
|
||||
return paperName;
|
||||
}
|
||||
|
||||
int wxPrintSetupData::GetPrinterOrientation()
|
||||
{
|
||||
return printerOrient;
|
||||
}
|
||||
|
||||
void wxPrintSetupData::GetPrinterScaling(double *x, double *y)
|
||||
{
|
||||
*x = printerScaleX;
|
||||
*y = printerScaleY;
|
||||
}
|
||||
|
||||
void wxPrintSetupData::GetPrinterTranslation(long *x, long *y)
|
||||
{
|
||||
*x = printerTranslateX;
|
||||
*y = printerTranslateY;
|
||||
}
|
||||
|
||||
int wxPrintSetupData::GetPrinterMode()
|
||||
{
|
||||
return printerMode;
|
||||
}
|
||||
|
||||
char *wxPrintSetupData::GetAFMPath()
|
||||
{
|
||||
return afmPath;
|
||||
}
|
||||
|
||||
bool wxPrintSetupData::GetColour()
|
||||
{
|
||||
return printColour;
|
||||
}
|
||||
|
||||
void wxPrintSetupData::operator=(wxPrintSetupData& data)
|
||||
@@ -2300,6 +2157,22 @@ void wxPrintSetupData::operator=(wxPrintSetupData& data)
|
||||
SetColour(data.GetColour());
|
||||
}
|
||||
|
||||
// Initialize from a wxPrintData object (wxPrintData should now be used instead of wxPrintSetupData).
|
||||
void wxPrintSetupData::operator=(const wxPrintData& data)
|
||||
{
|
||||
SetPrinterCommand(data.GetPrinterCommand());
|
||||
SetPrintPreviewCommand(data.GetPreviewCommand());
|
||||
SetPrinterOptions(data.GetPrinterOptions());
|
||||
SetPrinterTranslation(data.GetPrinterTranslateX(), data.GetPrinterTranslateY());
|
||||
SetPrinterScaling(data.GetPrinterScaleX(), data.GetPrinterScaleY());
|
||||
SetPrinterOrientation(data.GetOrientation());
|
||||
SetPrinterMode((int) data.GetPrintMode());
|
||||
SetAFMPath(data.GetFontMetricPath());
|
||||
SetPaperName(wxThePrintPaperDatabase->ConvertIdToName(data.GetPaperId()));
|
||||
SetColour(data.GetColour());
|
||||
SetPrinterFile(data.GetFilename());
|
||||
}
|
||||
|
||||
void wxInitializePrintSetupData(bool init)
|
||||
{
|
||||
if (init)
|
||||
@@ -2307,9 +2180,9 @@ void wxInitializePrintSetupData(bool init)
|
||||
wxThePrintSetupData = new wxPrintSetupData;
|
||||
|
||||
wxThePrintSetupData->SetPrintPreviewCommand(PS_VIEWER_PROG);
|
||||
wxThePrintSetupData->SetPrinterOrientation(PS_PORTRAIT);
|
||||
wxThePrintSetupData->SetPrinterMode(PS_PREVIEW);
|
||||
wxThePrintSetupData->SetPaperName(_("A4 210 x 297 mm"));
|
||||
wxThePrintSetupData->SetPrinterOrientation(wxPORTRAIT);
|
||||
wxThePrintSetupData->SetPrinterMode(wxPRINT_MODE_PREVIEW);
|
||||
wxThePrintSetupData->SetPaperName(_("A4 sheet, 210 x 297 mm"));
|
||||
|
||||
// Could have a .ini file to read in some defaults
|
||||
// - and/or use environment variables, e.g. WXWIN
|
||||
@@ -2321,12 +2194,12 @@ void wxInitializePrintSetupData(bool init)
|
||||
#ifdef __WXMSW__
|
||||
wxThePrintSetupData->SetPrinterCommand("print");
|
||||
wxThePrintSetupData->SetAFMPath("c:\\windows\\system\\");
|
||||
wxThePrintSetupData->SetPrinterOptions(NULL);
|
||||
wxThePrintSetupData->SetPrinterOptions("");
|
||||
#endif
|
||||
#if !defined(__VMS__) && !defined(__WXMSW__)
|
||||
wxThePrintSetupData->SetPrinterCommand("lpr");
|
||||
wxThePrintSetupData->SetPrinterOptions((char *) NULL);
|
||||
wxThePrintSetupData->SetAFMPath((char *) NULL);
|
||||
wxThePrintSetupData->SetPrinterOptions("");
|
||||
wxThePrintSetupData->SetAFMPath("");
|
||||
#endif
|
||||
}
|
||||
else
|
||||
|
@@ -1417,9 +1417,10 @@ void wxGenericGrid::OnSelectCellImplementation(wxDC *dc, int row, int col)
|
||||
// Probably because of the SetValue?? JS.
|
||||
// 2) Arrrrrgh. This isn't needed anywhere,
|
||||
// of course. One hour of debugging... RR.
|
||||
// Put back for Motif only on advice of Michael Bedward
|
||||
#ifdef __WXMOTIF__
|
||||
HighlightCell(dc);
|
||||
#endif // motif
|
||||
#endif
|
||||
|
||||
dc->DestroyClippingRegion();
|
||||
|
||||
|
@@ -34,6 +34,7 @@
|
||||
#include "wx/dcprint.h"
|
||||
#include "wx/printdlg.h"
|
||||
#include "wx/generic/prntdlgg.h"
|
||||
#include "wx/paper.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
@@ -43,11 +44,11 @@ IMPLEMENT_CLASS(wxPostScriptPrintPreview, wxPrintPreviewBase)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Printer
|
||||
*/
|
||||
* Printer
|
||||
*/
|
||||
|
||||
wxPostScriptPrinter::wxPostScriptPrinter(wxPrintData *data):
|
||||
wxPrinterBase(data)
|
||||
wxPostScriptPrinter::wxPostScriptPrinter(wxPrintDialogData *data):
|
||||
wxPrinterBase(data)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -74,38 +75,35 @@ bool wxPostScriptPrinter::Print(wxWindow *parent, wxPrintout *printout, bool pro
|
||||
if (maxPage == 0)
|
||||
return FALSE;
|
||||
|
||||
m_printData.SetMinPage(minPage);
|
||||
m_printData.SetMaxPage(maxPage);
|
||||
m_printDialogData.SetMinPage(minPage);
|
||||
m_printDialogData.SetMaxPage(maxPage);
|
||||
if (fromPage != 0)
|
||||
m_printData.SetFromPage(fromPage);
|
||||
m_printDialogData.SetFromPage(fromPage);
|
||||
if (toPage != 0)
|
||||
m_printData.SetToPage(toPage);
|
||||
m_printDialogData.SetToPage(toPage);
|
||||
|
||||
if (minPage != 0)
|
||||
{
|
||||
m_printData.EnablePageNumbers(TRUE);
|
||||
if (m_printData.GetFromPage() < m_printData.GetMinPage())
|
||||
m_printData.SetFromPage(m_printData.GetMinPage());
|
||||
else if (m_printData.GetFromPage() > m_printData.GetMaxPage())
|
||||
m_printData.SetFromPage(m_printData.GetMaxPage());
|
||||
if (m_printData.GetToPage() > m_printData.GetMaxPage())
|
||||
m_printData.SetToPage(m_printData.GetMaxPage());
|
||||
else if (m_printData.GetToPage() < m_printData.GetMinPage())
|
||||
m_printData.SetToPage(m_printData.GetMinPage());
|
||||
m_printDialogData.EnablePageNumbers(TRUE);
|
||||
if (m_printDialogData.GetFromPage() < m_printDialogData.GetMinPage())
|
||||
m_printDialogData.SetFromPage(m_printDialogData.GetMinPage());
|
||||
else if (m_printDialogData.GetFromPage() > m_printDialogData.GetMaxPage())
|
||||
m_printDialogData.SetFromPage(m_printDialogData.GetMaxPage());
|
||||
if (m_printDialogData.GetToPage() > m_printDialogData.GetMaxPage())
|
||||
m_printDialogData.SetToPage(m_printDialogData.GetMaxPage());
|
||||
else if (m_printDialogData.GetToPage() < m_printDialogData.GetMinPage())
|
||||
m_printDialogData.SetToPage(m_printDialogData.GetMinPage());
|
||||
}
|
||||
else
|
||||
m_printData.EnablePageNumbers(FALSE);
|
||||
m_printDialogData.EnablePageNumbers(FALSE);
|
||||
|
||||
// Create a suitable device context
|
||||
wxDC *dc = (wxDC *) NULL;
|
||||
if (prompt)
|
||||
{
|
||||
wxGenericPrintDialog dialog(parent, & m_printData);
|
||||
if (dialog.ShowModal() == wxID_OK)
|
||||
{
|
||||
dc = dialog.GetPrintDC();
|
||||
m_printData = dialog.GetPrintData();
|
||||
}
|
||||
dc = PrintDialog(parent);
|
||||
if (!dc)
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -127,11 +125,11 @@ bool wxPostScriptPrinter::Print(wxWindow *parent, wxPrintout *printout, bool pro
|
||||
logPPIScreenX = 100;
|
||||
logPPIScreenY = 100;
|
||||
|
||||
/*
|
||||
/*
|
||||
// Correct values for X/PostScript?
|
||||
logPPIPrinterX = 100;
|
||||
logPPIPrinterY = 100;
|
||||
*/
|
||||
*/
|
||||
|
||||
logPPIPrinterX = 72;
|
||||
logPPIPrinterY = 72;
|
||||
@@ -143,11 +141,10 @@ bool wxPostScriptPrinter::Print(wxWindow *parent, wxPrintout *printout, bool pro
|
||||
printout->SetDC(dc);
|
||||
|
||||
int w, h;
|
||||
long ww, hh;
|
||||
dc->GetSize(&w, &h);
|
||||
printout->SetPageSizePixels((int)w, (int)h);
|
||||
dc->GetSizeMM(&ww, &hh);
|
||||
printout->SetPageSizeMM((int)ww, (int)hh);
|
||||
dc->GetSizeMM(&w, &h);
|
||||
printout->SetPageSizeMM((int)w, (int)h);
|
||||
|
||||
// Create an abort window
|
||||
wxBeginBusyCursor();
|
||||
@@ -157,9 +154,9 @@ bool wxPostScriptPrinter::Print(wxWindow *parent, wxPrintout *printout, bool pro
|
||||
bool keepGoing = TRUE;
|
||||
|
||||
int copyCount;
|
||||
for (copyCount = 1; copyCount <= m_printData.GetNoCopies(); copyCount ++)
|
||||
for (copyCount = 1; copyCount <= m_printDialogData.GetNoCopies(); copyCount ++)
|
||||
{
|
||||
if (!printout->OnBeginDocument(m_printData.GetFromPage(), m_printData.GetToPage()))
|
||||
if (!printout->OnBeginDocument(m_printDialogData.GetFromPage(), m_printDialogData.GetToPage()))
|
||||
{
|
||||
wxEndBusyCursor();
|
||||
wxMessageBox(_("Could not start printing."), _("Print Error"), wxOK, parent);
|
||||
@@ -169,7 +166,7 @@ bool wxPostScriptPrinter::Print(wxWindow *parent, wxPrintout *printout, bool pro
|
||||
break;
|
||||
|
||||
int pn;
|
||||
for (pn = m_printData.GetFromPage(); keepGoing && (pn <= m_printData.GetToPage()) && printout->HasPage(pn);
|
||||
for (pn = m_printDialogData.GetFromPage(); keepGoing && (pn <= m_printDialogData.GetToPage()) && printout->HasPage(pn);
|
||||
pn++)
|
||||
{
|
||||
if (sm_abortIt)
|
||||
@@ -196,25 +193,44 @@ bool wxPostScriptPrinter::Print(wxWindow *parent, wxPrintout *printout, bool pro
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool wxPostScriptPrinter::PrintDialog(wxWindow *parent)
|
||||
wxDC* wxPostScriptPrinter::PrintDialog(wxWindow *parent)
|
||||
{
|
||||
wxGenericPrintDialog dialog(parent, & m_printData);
|
||||
return (dialog.ShowModal() == wxID_OK);
|
||||
wxDC* dc = (wxDC*) NULL;
|
||||
wxGenericPrintDialog* dialog = new wxGenericPrintDialog(parent, & m_printDialogData);
|
||||
int ret = dialog->ShowModal() ;
|
||||
if (ret == wxID_OK)
|
||||
{
|
||||
dc = dialog->GetPrintDC();
|
||||
m_printDialogData = dialog->GetPrintDialogData();
|
||||
}
|
||||
dialog->Destroy();
|
||||
|
||||
return dc;
|
||||
}
|
||||
|
||||
bool wxPostScriptPrinter::Setup(wxWindow *parent)
|
||||
{
|
||||
wxGenericPrintDialog dialog(parent, & m_printData);
|
||||
dialog.GetPrintData().SetSetupDialog(TRUE);
|
||||
return (dialog.ShowModal() == wxID_OK);
|
||||
wxGenericPrintDialog* dialog = new wxGenericPrintDialog(parent, & m_printDialogData);
|
||||
dialog->GetPrintDialogData().SetSetupDialog(TRUE);
|
||||
|
||||
int ret = dialog->ShowModal();
|
||||
|
||||
if (ret == wxID_OK)
|
||||
{
|
||||
m_printDialogData = dialog->GetPrintDialogData();
|
||||
}
|
||||
|
||||
dialog->Destroy();
|
||||
|
||||
return (ret == wxID_OK);
|
||||
}
|
||||
|
||||
/*
|
||||
* Print preview
|
||||
*/
|
||||
* Print preview
|
||||
*/
|
||||
|
||||
wxPostScriptPrintPreview::wxPostScriptPrintPreview(wxPrintout *printout, wxPrintout *printoutForPrinting, wxPrintData *data):
|
||||
wxPrintPreviewBase(printout, printoutForPrinting, data)
|
||||
wxPostScriptPrintPreview::wxPostScriptPrintPreview(wxPrintout *printout, wxPrintout *printoutForPrinting, wxPrintDialogData *data):
|
||||
wxPrintPreviewBase(printout, printoutForPrinting, data)
|
||||
{
|
||||
// Have to call it here since base constructor can't call it
|
||||
DetermineScaling();
|
||||
@@ -228,45 +244,48 @@ bool wxPostScriptPrintPreview::Print(bool interactive)
|
||||
{
|
||||
if (!m_printPrintout)
|
||||
return FALSE;
|
||||
wxPostScriptPrinter printer(&m_printData);
|
||||
wxPostScriptPrinter printer(& m_printDialogData);
|
||||
return printer.Print(m_previewFrame, m_printPrintout, interactive);
|
||||
}
|
||||
|
||||
void wxPostScriptPrintPreview::DetermineScaling(void)
|
||||
{
|
||||
const char *paperType = wxThePrintSetupData->GetPaperName();
|
||||
if (!paperType)
|
||||
paperType = _("A4 210 x 297 mm");
|
||||
wxPaperSize paperType = m_printDialogData.GetPrintData().GetPaperId();
|
||||
if (paperType == wxPAPER_NONE)
|
||||
paperType = wxPAPER_NONE;
|
||||
|
||||
wxPrintPaperType *paper = wxThePrintPaperDatabase->FindPaperType(paperType);
|
||||
if (!paper)
|
||||
paper = wxThePrintPaperDatabase->FindPaperType(_("A4 210 x 297 mm"));
|
||||
paper = wxThePrintPaperDatabase->FindPaperType(wxPAPER_A4);
|
||||
|
||||
if (paper)
|
||||
{
|
||||
m_previewPrintout->SetPPIScreen(100, 100);
|
||||
// m_previewPrintout->SetPPIPrinter(100, 100);
|
||||
// m_previewPrintout->SetPPIPrinter(100, 100);
|
||||
m_previewPrintout->SetPPIPrinter(72, 72);
|
||||
|
||||
wxSize sizeDevUnits(paper->GetSizeDeviceUnits());
|
||||
wxSize sizeTenthsMM(paper->GetSize());
|
||||
wxSize sizeMM(sizeTenthsMM.x / 10, sizeTenthsMM.y / 10);
|
||||
|
||||
// If in landscape mode, we need to swap the width and height.
|
||||
if ( m_printData.GetOrientation() == wxLANDSCAPE )
|
||||
if ( m_printDialogData.GetPrintData().GetOrientation() == wxLANDSCAPE )
|
||||
{
|
||||
m_pageWidth = paper->heightPixels;
|
||||
m_pageHeight = paper->widthPixels;
|
||||
m_previewPrintout->SetPageSizeMM(paper->heightMM, paper->widthMM);
|
||||
m_previewPrintout->SetPageSizePixels(paper->heightPixels, paper->widthPixels);
|
||||
m_pageWidth = sizeDevUnits.y;
|
||||
m_pageHeight = sizeDevUnits.x;
|
||||
m_previewPrintout->SetPageSizeMM(sizeMM.y, sizeMM.x);
|
||||
m_previewPrintout->SetPageSizePixels(m_pageWidth, m_pageHeight);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_pageWidth = paper->widthPixels;
|
||||
m_pageHeight = paper->heightPixels;
|
||||
m_previewPrintout->SetPageSizeMM(paper->widthMM, paper->heightMM);
|
||||
m_previewPrintout->SetPageSizePixels(paper->widthPixels, paper->heightPixels);
|
||||
m_pageWidth = sizeDevUnits.x;
|
||||
m_pageHeight = sizeDevUnits.y;
|
||||
m_previewPrintout->SetPageSizeMM(sizeMM.x, sizeMM.y);
|
||||
m_previewPrintout->SetPageSizePixels(m_pageWidth, m_pageHeight);
|
||||
}
|
||||
|
||||
// At 100%, the page should look about page-size on the screen.
|
||||
m_previewScale = (float)0.8;
|
||||
// m_previewScale = (float)((float)screenWidth/(float)printerWidth);
|
||||
// m_previewScale = previewScale * (float)((float)screenXRes/(float)printerYRes);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -45,6 +45,7 @@
|
||||
#endif
|
||||
|
||||
#include "wx/printdlg.h"
|
||||
#include "wx/paper.h"
|
||||
|
||||
// For print paper things
|
||||
#include "wx/prntbase.h"
|
||||
@@ -60,62 +61,62 @@ IMPLEMENT_CLASS(wxGenericPrintSetupDialog, wxDialog)
|
||||
IMPLEMENT_CLASS(wxGenericPageSetupDialog, wxDialog)
|
||||
|
||||
BEGIN_EVENT_TABLE(wxGenericPrintDialog, wxDialog)
|
||||
EVT_BUTTON(wxID_OK, wxGenericPrintDialog::OnOK)
|
||||
EVT_BUTTON(wxPRINTID_SETUP, wxGenericPrintDialog::OnSetup)
|
||||
EVT_RADIOBOX(wxPRINTID_RANGE, wxGenericPrintDialog::OnRange)
|
||||
EVT_BUTTON(wxID_OK, wxGenericPrintDialog::OnOK)
|
||||
EVT_BUTTON(wxPRINTID_SETUP, wxGenericPrintDialog::OnSetup)
|
||||
EVT_RADIOBOX(wxPRINTID_RANGE, wxGenericPrintDialog::OnRange)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
BEGIN_EVENT_TABLE(wxGenericPageSetupDialog, wxDialog)
|
||||
EVT_BUTTON(wxPRINTID_SETUP, wxGenericPageSetupDialog::OnPrinter)
|
||||
EVT_BUTTON(wxPRINTID_SETUP, wxGenericPageSetupDialog::OnPrinter)
|
||||
END_EVENT_TABLE()
|
||||
#endif
|
||||
|
||||
extern wxPrintPaperDatabase *wxThePrintPaperDatabase;
|
||||
|
||||
/*
|
||||
* Generic print dialog for non-Windows printing use.
|
||||
*/
|
||||
* Generic print dialog for non-Windows printing use.
|
||||
*/
|
||||
|
||||
|
||||
wxGenericPrintDialog::wxGenericPrintDialog(wxWindow *parent, wxPrintData* data):
|
||||
wxDialog(parent, -1, _("Print"), wxPoint(0, 0), wxSize(600, 600), wxDEFAULT_DIALOG_STYLE|wxDIALOG_MODAL|wxTAB_TRAVERSAL)
|
||||
wxGenericPrintDialog::wxGenericPrintDialog(wxWindow *parent, wxPrintDialogData* data):
|
||||
wxDialog(parent, -1, _("Print"), wxPoint(0, 0), wxSize(600, 600), wxDEFAULT_DIALOG_STYLE|wxDIALOG_MODAL|wxTAB_TRAVERSAL)
|
||||
{
|
||||
if ( data )
|
||||
printData = *data;
|
||||
m_printDialogData = *data;
|
||||
|
||||
(void)new wxStaticBox( this, -1, _( "Printer options" ), wxPoint( 5, 5), wxSize( 300, 60 ) );
|
||||
|
||||
printToFileCheckBox = new wxCheckBox(this, wxPRINTID_PRINTTOFILE, _("Print to File"), wxPoint(20, 25) );
|
||||
m_printToFileCheckBox = new wxCheckBox(this, wxPRINTID_PRINTTOFILE, _("Print to File"), wxPoint(20, 25) );
|
||||
|
||||
setupButton = new wxButton(this, wxPRINTID_SETUP, _("Setup..."), wxPoint(160, 25), wxSize(100, -1));
|
||||
m_setupButton = new wxButton(this, wxPRINTID_SETUP, _("Setup..."), wxPoint(160, 25), wxSize(100, -1));
|
||||
|
||||
wxString *choices = new wxString[2];
|
||||
choices[0] = _("All");
|
||||
choices[1] = _("Pages");
|
||||
|
||||
fromText = (wxTextCtrl*)NULL;
|
||||
m_fromText = (wxTextCtrl*)NULL;
|
||||
|
||||
if(printData.GetFromPage() != 0)
|
||||
if (m_printDialogData.GetFromPage() != 0)
|
||||
{
|
||||
rangeRadioBox = new wxRadioBox(this, wxPRINTID_RANGE, _("Print Range"),
|
||||
m_rangeRadioBox = new wxRadioBox(this, wxPRINTID_RANGE, _("Print Range"),
|
||||
wxPoint(5, 80), wxSize(-1, -1), 2, choices, 1, wxRA_VERTICAL);
|
||||
rangeRadioBox->SetSelection(1);
|
||||
m_rangeRadioBox->SetSelection(1);
|
||||
}
|
||||
|
||||
if(printData.GetFromPage() != 0)
|
||||
if(m_printDialogData.GetFromPage() != 0)
|
||||
{
|
||||
(void) new wxStaticText(this, wxPRINTID_STATIC, _("From:"), wxPoint(5, 135));
|
||||
|
||||
fromText = new wxTextCtrl(this, wxPRINTID_FROM, "", wxPoint(45, 130), wxSize(40, -1));
|
||||
m_fromText = new wxTextCtrl(this, wxPRINTID_FROM, "", wxPoint(45, 130), wxSize(40, -1));
|
||||
|
||||
(void) new wxStaticText(this, wxPRINTID_STATIC, _("To:"), wxPoint(100, 135));
|
||||
|
||||
toText = new wxTextCtrl(this, wxPRINTID_TO, "", wxPoint(133, 130), wxSize(40, -1));
|
||||
m_toText = new wxTextCtrl(this, wxPRINTID_TO, "", wxPoint(133, 130), wxSize(40, -1));
|
||||
}
|
||||
|
||||
(void) new wxStaticText(this, wxPRINTID_STATIC, _("Copies:"), wxPoint(200, 135));
|
||||
|
||||
noCopiesText = new wxTextCtrl(this, wxPRINTID_COPIES, "", wxPoint(252, 130), wxSize(40, -1));
|
||||
m_noCopiesText = new wxTextCtrl(this, wxPRINTID_COPIES, "", wxPoint(252, 130), wxSize(40, -1));
|
||||
|
||||
wxButton *okButton = new wxButton(this, wxID_OK, _("OK"), wxPoint(40, 180), wxSize(100, -1));
|
||||
(void) new wxButton(this, wxID_CANCEL, _("Cancel"), wxPoint(180, 180), wxSize(100, -1));
|
||||
@@ -130,18 +131,31 @@ wxGenericPrintDialog::wxGenericPrintDialog(wxWindow *parent, wxPrintData* data):
|
||||
delete[] choices;
|
||||
}
|
||||
|
||||
int wxGenericPrintDialog::ShowModal(void)
|
||||
int wxGenericPrintDialog::ShowModal()
|
||||
{
|
||||
if ( printData.GetSetupDialog() )
|
||||
if ( m_printDialogData.GetSetupDialog() )
|
||||
{
|
||||
// Make sure wxPrintData object reflects the settings now, in case the setup dialog
|
||||
// changes it. In fact there aren't any common settings at
|
||||
// present, but there might be in future.
|
||||
// TransferDataFromWindow();
|
||||
|
||||
wxGenericPrintSetupDialog *genericPrintSetupDialog =
|
||||
new wxGenericPrintSetupDialog(GetParent(), wxThePrintSetupData);
|
||||
new wxGenericPrintSetupDialog(this, & m_printDialogData.GetPrintData());
|
||||
int ret = genericPrintSetupDialog->ShowModal();
|
||||
if ( ret != wxID_CANCEL )
|
||||
{
|
||||
*wxThePrintSetupData = genericPrintSetupDialog->printData;
|
||||
// Transfer settings to the global object (for compatibility) and to
|
||||
// the print dialog's print data.
|
||||
*wxThePrintSetupData = genericPrintSetupDialog->GetPrintData();
|
||||
m_printDialogData.GetPrintData() = genericPrintSetupDialog->GetPrintData();
|
||||
}
|
||||
genericPrintSetupDialog->Close(TRUE);
|
||||
genericPrintSetupDialog->Destroy();
|
||||
|
||||
// Restore the wxPrintData settings again (uncomment if any settings become common
|
||||
// to both dialogs)
|
||||
// TransferDataToWindow();
|
||||
|
||||
return ret;
|
||||
}
|
||||
else
|
||||
@@ -150,7 +164,7 @@ int wxGenericPrintDialog::ShowModal(void)
|
||||
}
|
||||
}
|
||||
|
||||
wxGenericPrintDialog::~wxGenericPrintDialog(void)
|
||||
wxGenericPrintDialog::~wxGenericPrintDialog()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -162,9 +176,10 @@ void wxGenericPrintDialog::OnOK(wxCommandEvent& WXUNUSED(event))
|
||||
// and the standard print dialog. The global printing 'mode'
|
||||
// is determined by whether the user checks Print to file
|
||||
// or not.
|
||||
if (printData.GetPrintToFile())
|
||||
if (m_printDialogData.GetPrintToFile())
|
||||
{
|
||||
wxThePrintSetupData->SetPrinterMode(PS_FILE);
|
||||
m_printDialogData.GetPrintData().SetPrintMode(wxPRINT_MODE_FILE);
|
||||
wxThePrintSetupData->SetPrinterMode(wxPRINT_MODE_FILE);
|
||||
|
||||
wxString f = wxFileSelector(_("PostScript file"),
|
||||
wxPathOnly(wxThePrintSetupData->GetPrinterFile()),
|
||||
@@ -173,27 +188,28 @@ void wxGenericPrintDialog::OnOK(wxCommandEvent& WXUNUSED(event))
|
||||
if ( f.IsEmpty() )
|
||||
return;
|
||||
|
||||
m_printDialogData.GetPrintData().SetFilename(f);
|
||||
wxThePrintSetupData->SetPrinterFile(f);
|
||||
}
|
||||
else
|
||||
wxThePrintSetupData->SetPrinterMode(PS_PRINTER);
|
||||
wxThePrintSetupData->SetPrinterMode(wxPRINT_MODE_PRINTER);
|
||||
|
||||
EndModal(wxID_OK);
|
||||
}
|
||||
|
||||
void wxGenericPrintDialog::OnRange(wxCommandEvent& event)
|
||||
{
|
||||
if (!fromText) return;
|
||||
if (!m_fromText) return;
|
||||
|
||||
if (event.GetInt() == 0)
|
||||
{
|
||||
fromText->Enable(FALSE);
|
||||
toText->Enable(FALSE);
|
||||
m_fromText->Enable(FALSE);
|
||||
m_toText->Enable(FALSE);
|
||||
}
|
||||
else if (event.GetInt() == 1)
|
||||
{
|
||||
fromText->Enable(TRUE);
|
||||
toText->Enable(TRUE);
|
||||
m_fromText->Enable(TRUE);
|
||||
m_toText->Enable(TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -204,127 +220,151 @@ void wxGenericPrintDialog::OnSetup(wxCommandEvent& WXUNUSED(event))
|
||||
int ret = genericPrintSetupDialog->ShowModal();
|
||||
if ( ret != wxID_CANCEL )
|
||||
{
|
||||
*wxThePrintSetupData = genericPrintSetupDialog->printData;
|
||||
printData.SetOrientation(wxThePrintSetupData->GetPrinterOrientation());
|
||||
*wxThePrintSetupData = genericPrintSetupDialog->GetPrintData();
|
||||
m_printDialogData = genericPrintSetupDialog->GetPrintData();
|
||||
}
|
||||
|
||||
genericPrintSetupDialog->Close(TRUE);
|
||||
}
|
||||
|
||||
bool wxGenericPrintDialog::TransferDataToWindow(void)
|
||||
bool wxGenericPrintDialog::TransferDataToWindow()
|
||||
{
|
||||
char buf[10];
|
||||
|
||||
if(printData.GetFromPage() != 0)
|
||||
if(m_printDialogData.GetFromPage() != 0)
|
||||
{
|
||||
if (printData.GetEnablePageNumbers())
|
||||
if (m_printDialogData.GetEnablePageNumbers())
|
||||
{
|
||||
fromText->Enable(TRUE);
|
||||
toText->Enable(TRUE);
|
||||
m_fromText->Enable(TRUE);
|
||||
m_toText->Enable(TRUE);
|
||||
|
||||
sprintf(buf, "%d", printData.GetFromPage());
|
||||
fromText->SetValue(buf);
|
||||
sprintf(buf, "%d", printData.GetToPage());
|
||||
toText->SetValue(buf);
|
||||
sprintf(buf, "%d", m_printDialogData.GetFromPage());
|
||||
m_fromText->SetValue(buf);
|
||||
sprintf(buf, "%d", m_printDialogData.GetToPage());
|
||||
m_toText->SetValue(buf);
|
||||
|
||||
if (printData.GetAllPages())
|
||||
rangeRadioBox->SetSelection(0);
|
||||
if (m_printDialogData.GetAllPages())
|
||||
m_rangeRadioBox->SetSelection(0);
|
||||
else
|
||||
rangeRadioBox->SetSelection(1);
|
||||
m_rangeRadioBox->SetSelection(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
fromText->Enable(FALSE);
|
||||
toText->Enable(FALSE);
|
||||
rangeRadioBox->SetSelection(0);
|
||||
rangeRadioBox->wxRadioBox::Enable(1, FALSE);
|
||||
m_fromText->Enable(FALSE);
|
||||
m_toText->Enable(FALSE);
|
||||
m_rangeRadioBox->SetSelection(0);
|
||||
m_rangeRadioBox->wxRadioBox::Enable(1, FALSE);
|
||||
}
|
||||
}
|
||||
sprintf(buf, "%d", printData.GetNoCopies());
|
||||
noCopiesText->SetValue(buf);
|
||||
sprintf(buf, "%d", m_printDialogData.GetNoCopies());
|
||||
m_noCopiesText->SetValue(buf);
|
||||
|
||||
printToFileCheckBox->SetValue(printData.GetPrintToFile());
|
||||
printToFileCheckBox->Enable(printData.GetEnablePrintToFile());
|
||||
m_printToFileCheckBox->SetValue(m_printDialogData.GetPrintToFile());
|
||||
m_printToFileCheckBox->Enable(m_printDialogData.GetEnablePrintToFile());
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool wxGenericPrintDialog::TransferDataFromWindow(void)
|
||||
bool wxGenericPrintDialog::TransferDataFromWindow()
|
||||
{
|
||||
if(printData.GetFromPage() != -1)
|
||||
if(m_printDialogData.GetFromPage() != -1)
|
||||
{
|
||||
if (printData.GetEnablePageNumbers())
|
||||
if (m_printDialogData.GetEnablePageNumbers())
|
||||
{
|
||||
printData.SetFromPage(atoi(fromText->GetValue()));
|
||||
printData.SetToPage(atoi(toText->GetValue()));
|
||||
m_printDialogData.SetFromPage(atoi(m_fromText->GetValue()));
|
||||
m_printDialogData.SetToPage(atoi(m_toText->GetValue()));
|
||||
}
|
||||
if (rangeRadioBox->GetSelection() == 0)
|
||||
printData.SetAllPages(TRUE);
|
||||
if (m_rangeRadioBox->GetSelection() == 0)
|
||||
m_printDialogData.SetAllPages(TRUE);
|
||||
else
|
||||
printData.SetAllPages(FALSE);
|
||||
m_printDialogData.SetAllPages(FALSE);
|
||||
}
|
||||
else
|
||||
{ // continuous printing
|
||||
printData.SetFromPage(1);
|
||||
printData.SetToPage(32000);
|
||||
m_printDialogData.SetFromPage(1);
|
||||
m_printDialogData.SetToPage(32000);
|
||||
}
|
||||
printData.SetNoCopies(atoi(noCopiesText->GetValue()));
|
||||
printData.SetPrintToFile(printToFileCheckBox->GetValue());
|
||||
m_printDialogData.SetNoCopies(atoi(m_noCopiesText->GetValue()));
|
||||
m_printDialogData.SetPrintToFile(m_printToFileCheckBox->GetValue());
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
wxDC *wxGenericPrintDialog::GetPrintDC(void)
|
||||
/*
|
||||
TODO: collate and noCopies should be duplicated across dialog data and print data objects
|
||||
(slightly different semantics on Windows but let's ignore this for a bit).
|
||||
*/
|
||||
|
||||
wxDC *wxGenericPrintDialog::GetPrintDC()
|
||||
{
|
||||
return new wxPostScriptDC(wxThePrintSetupData->GetPrinterFile(), FALSE, (wxWindow *) NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
* Generic print setup dialog
|
||||
*/
|
||||
* Generic print setup dialog
|
||||
*/
|
||||
|
||||
wxGenericPrintSetupDialog::wxGenericPrintSetupDialog(wxWindow *parent, wxPrintData* data):
|
||||
wxDialog(parent, -1, _("Print Setup"), wxPoint(0, 0), wxSize(600, 600), wxDEFAULT_DIALOG_STYLE|wxDIALOG_MODAL|wxTAB_TRAVERSAL)
|
||||
{
|
||||
Init(data);
|
||||
}
|
||||
|
||||
// Convert wxPrintSetupData to standard wxPrintData object
|
||||
wxGenericPrintSetupDialog::wxGenericPrintSetupDialog(wxWindow *parent, wxPrintSetupData* data):
|
||||
wxDialog(parent, -1, _("Print Setup"), wxPoint(0, 0), wxSize(600, 600), wxDEFAULT_DIALOG_STYLE|wxDIALOG_MODAL|wxTAB_TRAVERSAL)
|
||||
wxDialog(parent, -1, _("Print Setup"), wxPoint(0, 0), wxSize(600, 600), wxDEFAULT_DIALOG_STYLE|wxDIALOG_MODAL|wxTAB_TRAVERSAL)
|
||||
{
|
||||
wxPrintData printData;
|
||||
if (data)
|
||||
printData = * data;
|
||||
else
|
||||
printData = * wxThePrintSetupData;
|
||||
|
||||
Init(& printData);
|
||||
}
|
||||
|
||||
void wxGenericPrintSetupDialog::Init(wxPrintData* data)
|
||||
{
|
||||
if ( data )
|
||||
printData = *data;
|
||||
m_printData = *data;
|
||||
|
||||
(void) new wxStaticBox(this, wxPRINTID_STATIC, _("Paper size"), wxPoint(10, 10), wxSize(200,60) );
|
||||
int staticBoxWidth = 300;
|
||||
|
||||
(void) new wxStaticBox(this, wxPRINTID_STATIC, _("Paper size"), wxPoint(10, 10), wxSize(staticBoxWidth, 60) );
|
||||
|
||||
int xPos = 20;
|
||||
int yPos = 30;
|
||||
paperTypeChoice = CreatePaperTypeChoice(&xPos, &yPos);
|
||||
m_paperTypeChoice = CreatePaperTypeChoice(&xPos, &yPos);
|
||||
|
||||
wxString *choices = new wxString[2];
|
||||
choices[0] = _("Portrait");
|
||||
choices[1] = _("Landscape");
|
||||
|
||||
orientationRadioBox = new wxRadioBox(this, wxPRINTID_ORIENTATION, _("Orientation"),
|
||||
m_orientationRadioBox = new wxRadioBox(this, wxPRINTID_ORIENTATION, _("Orientation"),
|
||||
wxPoint(10, 80), wxSize(-1, -1), 2, choices, 1, wxRA_VERTICAL );
|
||||
orientationRadioBox->SetSelection(0);
|
||||
m_orientationRadioBox->SetSelection(0);
|
||||
|
||||
(void) new wxStaticBox(this, wxPRINTID_STATIC, _("Options"), wxPoint(10, 130), wxSize(200,50) );
|
||||
(void) new wxStaticBox(this, wxPRINTID_STATIC, _("Options"), wxPoint(10, 130), wxSize(staticBoxWidth, 50) );
|
||||
|
||||
int colourXPos = 145;
|
||||
int colourYPos = 145;
|
||||
|
||||
#ifdef __WXMOTIF__
|
||||
colourXPos = 150;
|
||||
colourYPos = 150;
|
||||
#endif
|
||||
|
||||
colourCheckBox = new wxCheckBox(this, wxPRINTID_PRINTCOLOUR, _("Print in colour"), wxPoint(15, colourXPos));
|
||||
m_colourCheckBox = new wxCheckBox(this, wxPRINTID_PRINTCOLOUR, _("Print in colour"), wxPoint(15, colourYPos));
|
||||
|
||||
(void) new wxStaticBox(this, wxPRINTID_STATIC, _("Print spooling"), wxPoint(330, 10), wxSize(200,170) );
|
||||
|
||||
(void) new wxStaticBox(this, wxPRINTID_STATIC, _("Print spooling"), wxPoint(230, 10), wxSize(200,170) );
|
||||
(void) new wxStaticText(this, wxPRINTID_STATIC, _("Printer command:"), wxPoint(340, 30));
|
||||
|
||||
(void) new wxStaticText(this, wxPRINTID_STATIC, _("Printer command:"), wxPoint(240, 30));
|
||||
m_printerCommandText = new wxTextCtrl(this, wxPRINTID_COMMAND, "", wxPoint(360, 55), wxSize(150, -1));
|
||||
|
||||
printerCommandText = new wxTextCtrl(this, wxPRINTID_COMMAND, "", wxPoint(260, 55), wxSize(150, -1));
|
||||
(void) new wxStaticText(this, wxPRINTID_STATIC, _("Printer options:"), wxPoint(340, 110));
|
||||
|
||||
(void) new wxStaticText(this, wxPRINTID_STATIC, _("Printer options:"), wxPoint(240, 110));
|
||||
m_printerOptionsText = new wxTextCtrl(this, wxPRINTID_OPTIONS, "", wxPoint(360, 135), wxSize(150, -1));
|
||||
|
||||
printerOptionsText = new wxTextCtrl(this, wxPRINTID_OPTIONS, "", wxPoint(260, 135), wxSize(150, -1));
|
||||
|
||||
wxButton *okButton = new wxButton(this, wxID_OK, _("OK"), wxPoint(80, 200), wxSize(100, -1));
|
||||
(void) new wxButton(this, wxID_CANCEL, _("Cancel"), wxPoint(270, 200), wxSize(100, -1));
|
||||
wxButton *okButton = new wxButton(this, wxID_OK, _("OK"), wxPoint(130, 200), wxSize(100, -1));
|
||||
(void) new wxButton(this, wxID_CANCEL, _("Cancel"), wxPoint(320, 200), wxSize(100, -1));
|
||||
|
||||
okButton->SetDefault();
|
||||
okButton->SetFocus();
|
||||
@@ -336,62 +376,66 @@ wxGenericPrintSetupDialog::wxGenericPrintSetupDialog(wxWindow *parent, wxPrintSe
|
||||
delete[] choices;
|
||||
}
|
||||
|
||||
wxGenericPrintSetupDialog::~wxGenericPrintSetupDialog(void)
|
||||
wxGenericPrintSetupDialog::~wxGenericPrintSetupDialog()
|
||||
{
|
||||
}
|
||||
|
||||
bool wxGenericPrintSetupDialog::TransferDataToWindow(void)
|
||||
bool wxGenericPrintSetupDialog::TransferDataToWindow()
|
||||
{
|
||||
if (printerCommandText && printData.GetPrinterCommand())
|
||||
printerCommandText->SetValue(printData.GetPrinterCommand());
|
||||
if (printerOptionsText && printData.GetPrinterOptions())
|
||||
printerOptionsText->SetValue(printData.GetPrinterOptions());
|
||||
if (colourCheckBox)
|
||||
colourCheckBox->SetValue(printData.GetColour());
|
||||
if (m_printerCommandText && m_printData.GetPrinterCommand())
|
||||
m_printerCommandText->SetValue(m_printData.GetPrinterCommand());
|
||||
if (m_printerOptionsText && m_printData.GetPrinterOptions())
|
||||
m_printerOptionsText->SetValue(m_printData.GetPrinterOptions());
|
||||
if (m_colourCheckBox)
|
||||
m_colourCheckBox->SetValue(m_printData.GetColour());
|
||||
|
||||
if (orientationRadioBox)
|
||||
if (m_orientationRadioBox)
|
||||
{
|
||||
if (printData.GetPrinterOrientation() == PS_PORTRAIT)
|
||||
orientationRadioBox->SetSelection(0);
|
||||
if (m_printData.GetOrientation() == wxPORTRAIT)
|
||||
m_orientationRadioBox->SetSelection(0);
|
||||
else
|
||||
orientationRadioBox->SetSelection(1);
|
||||
m_orientationRadioBox->SetSelection(1);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool wxGenericPrintSetupDialog::TransferDataFromWindow(void)
|
||||
bool wxGenericPrintSetupDialog::TransferDataFromWindow()
|
||||
{
|
||||
if (printerCommandText)
|
||||
printData.SetPrinterCommand(WXSTRINGCAST printerCommandText->GetValue());
|
||||
if (printerOptionsText)
|
||||
printData.SetPrinterOptions(WXSTRINGCAST printerOptionsText->GetValue());
|
||||
if (colourCheckBox)
|
||||
printData.SetColour(colourCheckBox->GetValue());
|
||||
if (orientationRadioBox)
|
||||
if (m_printerCommandText)
|
||||
m_printData.SetPrinterCommand(m_printerCommandText->GetValue());
|
||||
if (m_printerOptionsText)
|
||||
m_printData.SetPrinterOptions(m_printerOptionsText->GetValue());
|
||||
if (m_colourCheckBox)
|
||||
m_printData.SetColour(m_colourCheckBox->GetValue());
|
||||
if (m_orientationRadioBox)
|
||||
{
|
||||
int sel = orientationRadioBox->GetSelection();
|
||||
int sel = m_orientationRadioBox->GetSelection();
|
||||
if (sel == 0)
|
||||
printData.SetPrinterOrientation(PS_PORTRAIT);
|
||||
m_printData.SetOrientation(wxPORTRAIT);
|
||||
else
|
||||
printData.SetPrinterOrientation(PS_LANDSCAPE);
|
||||
m_printData.SetOrientation(wxLANDSCAPE);
|
||||
}
|
||||
if (paperTypeChoice)
|
||||
if (m_paperTypeChoice)
|
||||
{
|
||||
wxString val(paperTypeChoice->GetStringSelection());
|
||||
wxString val(m_paperTypeChoice->GetStringSelection());
|
||||
if (!val.IsNull() && val != "")
|
||||
printData.SetPaperName((char *)(const char *)val);
|
||||
m_printData.SetPaperId(wxThePrintPaperDatabase->ConvertNameToId(val));
|
||||
}
|
||||
|
||||
// This is for backward compatibility only
|
||||
*wxThePrintSetupData = GetPrintData();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
wxChoice *wxGenericPrintSetupDialog::CreatePaperTypeChoice(int *x, int *y)
|
||||
{
|
||||
/* Should not be necessary
|
||||
if (!wxThePrintPaperDatabase)
|
||||
{
|
||||
wxThePrintPaperDatabase = new wxPrintPaperDatabase;
|
||||
wxThePrintPaperDatabase->CreateDatabase();
|
||||
}
|
||||
*/
|
||||
int n = wxThePrintPaperDatabase->Number();
|
||||
wxString *choices = new wxString [n];
|
||||
int sel = 0;
|
||||
@@ -399,26 +443,25 @@ wxChoice *wxGenericPrintSetupDialog::CreatePaperTypeChoice(int *x, int *y)
|
||||
for (i = 0; i < n; i++)
|
||||
{
|
||||
wxPrintPaperType *paper = (wxPrintPaperType *)wxThePrintPaperDatabase->Nth(i)->Data();
|
||||
choices[i] = paper->pageName;
|
||||
if (printData.GetPaperName() && choices[i] == printData.GetPaperName())
|
||||
choices[i] = paper->GetName();
|
||||
if (m_printData.GetPaperId() == paper->GetId())
|
||||
sel = i;
|
||||
}
|
||||
|
||||
int width = 170;
|
||||
#ifdef __WXMOTIF__
|
||||
width = 150;
|
||||
#endif
|
||||
int width = 250;
|
||||
|
||||
wxChoice *choice = new wxChoice(this, wxPRINTID_PAPERSIZE, wxPoint(*x, *y), wxSize(width, -1), n,
|
||||
choices);
|
||||
|
||||
// SetFont(thisFont);
|
||||
|
||||
delete[] choices;
|
||||
|
||||
choice->SetSelection(sel);
|
||||
return choice;
|
||||
}
|
||||
#endif
|
||||
// wxUSE_POSTSCRIPT
|
||||
// wxUSE_POSTSCRIPT
|
||||
|
||||
/*
|
||||
* Generic page setup dialog
|
||||
@@ -434,19 +477,32 @@ void wxGenericPageSetupDialog::OnPrinter(wxCommandEvent& WXUNUSED(event))
|
||||
// printing under Windows (and only in 16-bit Windows which
|
||||
// doesn't have a Windows-specific page setup dialog) it's worth it.
|
||||
|
||||
wxPrintData data;
|
||||
// First save the current settings, so the wxPrintData object is up to date.
|
||||
TransferDataFromWindow();
|
||||
|
||||
// Transfer the current print settings from this dialog to the page setup dialog.
|
||||
wxPrintDialogData data;
|
||||
data = GetPageSetupData().GetPrintData();
|
||||
data.SetSetupDialog(TRUE);
|
||||
wxPrintDialog *printDialog = new wxPrintDialog(this, & data);
|
||||
printDialog->ShowModal();
|
||||
|
||||
// Transfer the page setup print settings from the page dialog to this dialog again, in case
|
||||
// the page setup dialog changed something.
|
||||
GetPageSetupData().GetPrintData() = printDialog->GetPrintDialogData().GetPrintData();
|
||||
GetPageSetupData().CalculatePaperSizeFromId(); // Make sure page size reflects the id in wxPrintData
|
||||
|
||||
printDialog->Destroy();
|
||||
|
||||
// Now update the dialog in case the page setup dialog changed some of our settings.
|
||||
TransferDataToWindow();
|
||||
}
|
||||
|
||||
wxGenericPageSetupDialog::wxGenericPageSetupDialog(wxWindow *parent, wxPageSetupData* data):
|
||||
wxDialog(parent, -1, _("Page Setup"), wxPoint(0, 0), wxSize(600, 600), wxDIALOG_MODAL|wxDEFAULT_DIALOG_STYLE|wxTAB_TRAVERSAL)
|
||||
wxDialog(parent, -1, _("Page Setup"), wxPoint(0, 0), wxSize(600, 600), wxDIALOG_MODAL|wxDEFAULT_DIALOG_STYLE|wxTAB_TRAVERSAL)
|
||||
{
|
||||
if ( data )
|
||||
pageData = *data;
|
||||
m_pageData = *data;
|
||||
|
||||
int buttonWidth = 75;
|
||||
int buttonHeight = 25;
|
||||
@@ -461,13 +517,13 @@ wxGenericPageSetupDialog::wxGenericPageSetupDialog(wxWindow *parent, wxPageSetup
|
||||
wxButton *okButton = new wxButton(this, wxID_OK, _("OK"), wxPoint(5, yPos), wxSize(buttonWidth, buttonHeight));
|
||||
(void) new wxButton(this, wxID_CANCEL, _("Cancel"), wxPoint(buttonWidth + 5 + spacing, yPos), wxSize(buttonWidth, buttonHeight));
|
||||
|
||||
printerButton = new wxButton(this, wxPRINTID_SETUP, _("Printer..."), wxPoint(buttonWidth*2 + 5 + 2*spacing, yPos), wxSize(buttonWidth, buttonHeight));
|
||||
m_printerButton = new wxButton(this, wxPRINTID_SETUP, _("Printer..."), wxPoint(buttonWidth*2 + 5 + 2*spacing, yPos), wxSize(buttonWidth, buttonHeight));
|
||||
|
||||
if ( !pageData.GetEnablePrinter() )
|
||||
printerButton->Enable(FALSE);
|
||||
if ( !m_pageData.GetEnablePrinter() )
|
||||
m_printerButton->Enable(FALSE);
|
||||
|
||||
// if (printData.GetEnableHelp())
|
||||
// wxButton *helpButton = new wxButton(this, (wxFunction)wxGenericPageSetupHelpProc, _("Help"), -1, -1, buttonWidth, buttonHeight);
|
||||
// if (m_printData.GetEnableHelp())
|
||||
// wxButton *helpButton = new wxButton(this, (wxFunction)wxGenericPageSetupHelpProc, _("Help"), -1, -1, buttonWidth, buttonHeight);
|
||||
|
||||
okButton->SetDefault();
|
||||
okButton->SetFocus();
|
||||
@@ -479,16 +535,16 @@ wxGenericPageSetupDialog::wxGenericPageSetupDialog(wxWindow *parent, wxPageSetup
|
||||
yPos += 10;
|
||||
#endif
|
||||
|
||||
paperTypeChoice = CreatePaperTypeChoice(&xPos, &yPos);
|
||||
m_paperTypeChoice = CreatePaperTypeChoice(&xPos, &yPos);
|
||||
|
||||
xPos = 5;
|
||||
|
||||
wxString *choices = new wxString[2];
|
||||
choices[0] = _("Portrait");
|
||||
choices[1] = _("Landscape");
|
||||
orientationRadioBox = new wxRadioBox(this, wxPRINTID_ORIENTATION, _("Orientation"),
|
||||
m_orientationRadioBox = new wxRadioBox(this, wxPRINTID_ORIENTATION, _("Orientation"),
|
||||
wxPoint(xPos, yPos), wxSize(-1, -1), 2, choices, 2);
|
||||
orientationRadioBox->SetSelection(0);
|
||||
m_orientationRadioBox->SetSelection(0);
|
||||
|
||||
xPos = 5;
|
||||
yPos += 60;
|
||||
@@ -504,13 +560,13 @@ wxGenericPageSetupDialog::wxGenericPageSetupDialog(wxWindow *parent, wxPageSetup
|
||||
(void) new wxStaticText(this, wxPRINTID_STATIC, _("Left margin (mm):"), wxPoint(xPos, yPos));
|
||||
xPos += staticWidth;
|
||||
|
||||
marginLeftText = new wxTextCtrl(this, wxPRINTID_LEFTMARGIN, "", wxPoint(xPos, yPos), wxSize(textWidth, -1));
|
||||
m_marginLeftText = new wxTextCtrl(this, wxPRINTID_LEFTMARGIN, "", wxPoint(xPos, yPos), wxSize(textWidth, -1));
|
||||
xPos += textWidth + spacing;
|
||||
|
||||
(void) new wxStaticText(this, wxPRINTID_STATIC, _("Right margin (mm):"), wxPoint(xPos, yPos));
|
||||
xPos += staticWidth;
|
||||
|
||||
marginRightText = new wxTextCtrl(this, wxPRINTID_RIGHTMARGIN, "", wxPoint(xPos, yPos), wxSize(textWidth, -1));
|
||||
m_marginRightText = new wxTextCtrl(this, wxPRINTID_RIGHTMARGIN, "", wxPoint(xPos, yPos), wxSize(textWidth, -1));
|
||||
xPos += textWidth + spacing;
|
||||
|
||||
yPos += 35;
|
||||
@@ -519,13 +575,13 @@ wxGenericPageSetupDialog::wxGenericPageSetupDialog(wxWindow *parent, wxPageSetup
|
||||
(void) new wxStaticText(this, wxPRINTID_STATIC, _("Top margin (mm):"), wxPoint(xPos, yPos));
|
||||
xPos += staticWidth;
|
||||
|
||||
marginTopText = new wxTextCtrl(this, wxPRINTID_TOPMARGIN, "", wxPoint(xPos, yPos), wxSize(textWidth, -1));
|
||||
m_marginTopText = new wxTextCtrl(this, wxPRINTID_TOPMARGIN, "", wxPoint(xPos, yPos), wxSize(textWidth, -1));
|
||||
xPos += textWidth + spacing;
|
||||
|
||||
(void) new wxStaticText(this, wxPRINTID_STATIC, _("Bottom margin (mm):"), wxPoint(xPos, yPos));
|
||||
xPos += staticWidth;
|
||||
|
||||
marginBottomText = new wxTextCtrl(this, wxPRINTID_BOTTOMMARGIN, "", wxPoint(xPos, yPos), wxSize(textWidth, -1));
|
||||
m_marginBottomText = new wxTextCtrl(this, wxPRINTID_BOTTOMMARGIN, "", wxPoint(xPos, yPos), wxSize(textWidth, -1));
|
||||
|
||||
Fit();
|
||||
Centre(wxBOTH);
|
||||
@@ -534,65 +590,81 @@ wxGenericPageSetupDialog::wxGenericPageSetupDialog(wxWindow *parent, wxPageSetup
|
||||
delete [] choices;
|
||||
}
|
||||
|
||||
wxGenericPageSetupDialog::~wxGenericPageSetupDialog(void)
|
||||
wxGenericPageSetupDialog::~wxGenericPageSetupDialog()
|
||||
{
|
||||
}
|
||||
|
||||
bool wxGenericPageSetupDialog::TransferDataToWindow(void)
|
||||
bool wxGenericPageSetupDialog::TransferDataToWindow()
|
||||
{
|
||||
if (marginLeftText)
|
||||
marginLeftText->SetValue(IntToString((int) pageData.GetMarginTopLeft().x));
|
||||
if (marginTopText)
|
||||
marginTopText->SetValue(IntToString((int) pageData.GetMarginTopLeft().y));
|
||||
if (marginRightText)
|
||||
marginRightText->SetValue(IntToString((int) pageData.GetMarginBottomRight().x));
|
||||
if (marginBottomText)
|
||||
marginBottomText->SetValue(IntToString((int) pageData.GetMarginBottomRight().y));
|
||||
if (m_marginLeftText)
|
||||
m_marginLeftText->SetValue(IntToString((int) m_pageData.GetMarginTopLeft().x));
|
||||
if (m_marginTopText)
|
||||
m_marginTopText->SetValue(IntToString((int) m_pageData.GetMarginTopLeft().y));
|
||||
if (m_marginRightText)
|
||||
m_marginRightText->SetValue(IntToString((int) m_pageData.GetMarginBottomRight().x));
|
||||
if (m_marginBottomText)
|
||||
m_marginBottomText->SetValue(IntToString((int) m_pageData.GetMarginBottomRight().y));
|
||||
|
||||
if (orientationRadioBox)
|
||||
if (m_orientationRadioBox)
|
||||
{
|
||||
if (pageData.GetOrientation() == wxPORTRAIT)
|
||||
orientationRadioBox->SetSelection(0);
|
||||
if (m_pageData.GetPrintData().GetOrientation() == wxPORTRAIT)
|
||||
m_orientationRadioBox->SetSelection(0);
|
||||
else
|
||||
orientationRadioBox->SetSelection(1);
|
||||
m_orientationRadioBox->SetSelection(1);
|
||||
}
|
||||
|
||||
// Find the paper type from either the current paper size in the wxPageSetupDialogData, or
|
||||
// failing that, the id in the wxPrintData object.
|
||||
|
||||
wxPrintPaperType* type = wxThePrintPaperDatabase->FindPaperType(
|
||||
wxSize(m_pageData.GetPaperSize().x * 10, m_pageData.GetPaperSize().y * 10));
|
||||
|
||||
if (!type && m_pageData.GetPrintData().GetPaperId() != wxPAPER_NONE)
|
||||
type = wxThePrintPaperDatabase->FindPaperType(m_pageData.GetPrintData().GetPaperId());
|
||||
|
||||
if (type)
|
||||
{
|
||||
m_paperTypeChoice->SetStringSelection(type->GetName());
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool wxGenericPageSetupDialog::TransferDataFromWindow(void)
|
||||
bool wxGenericPageSetupDialog::TransferDataFromWindow()
|
||||
{
|
||||
if (marginLeftText && marginTopText)
|
||||
pageData.SetMarginTopLeft(wxPoint(atoi((const char *)marginLeftText->GetValue()),atoi((const char *)marginTopText->GetValue())));
|
||||
if (marginRightText && marginBottomText)
|
||||
pageData.SetMarginBottomRight(wxPoint(atoi((const char *)marginRightText->GetValue()),atoi((const char *)marginBottomText->GetValue())));
|
||||
if (m_marginLeftText && m_marginTopText)
|
||||
m_pageData.SetMarginTopLeft(wxPoint(atoi((const char *)m_marginLeftText->GetValue()),atoi((const char *)m_marginTopText->GetValue())));
|
||||
if (m_marginRightText && m_marginBottomText)
|
||||
m_pageData.SetMarginBottomRight(wxPoint(atoi((const char *)m_marginRightText->GetValue()),atoi((const char *)m_marginBottomText->GetValue())));
|
||||
|
||||
if (orientationRadioBox)
|
||||
if (m_orientationRadioBox)
|
||||
{
|
||||
int sel = orientationRadioBox->GetSelection();
|
||||
int sel = m_orientationRadioBox->GetSelection();
|
||||
if (sel == 0)
|
||||
{
|
||||
#if wxUSE_POSTSCRIPT
|
||||
wxThePrintSetupData->SetPrinterOrientation(wxPORTRAIT);
|
||||
#endif
|
||||
pageData.SetOrientation(wxPORTRAIT);
|
||||
m_pageData.GetPrintData().SetOrientation(wxPORTRAIT);
|
||||
}
|
||||
else
|
||||
{
|
||||
#if wxUSE_POSTSCRIPT
|
||||
wxThePrintSetupData->SetPrinterOrientation(wxLANDSCAPE);
|
||||
#endif
|
||||
pageData.SetOrientation(wxLANDSCAPE);
|
||||
m_pageData.GetPrintData().SetOrientation(wxLANDSCAPE);
|
||||
}
|
||||
}
|
||||
if (paperTypeChoice)
|
||||
if (m_paperTypeChoice)
|
||||
{
|
||||
wxString val(paperTypeChoice->GetStringSelection());
|
||||
wxString val(m_paperTypeChoice->GetStringSelection());
|
||||
if (!val.IsNull() && val != "")
|
||||
{
|
||||
wxPrintPaperType* paper = wxThePrintPaperDatabase->FindPaperType((char*) (const char *)val);
|
||||
wxPrintPaperType* paper = wxThePrintPaperDatabase->FindPaperType(val);
|
||||
if ( paper )
|
||||
{
|
||||
pageData.SetPaperSize(wxPoint(paper->widthMM, paper->heightMM));
|
||||
m_pageData.SetPaperSize(wxSize(paper->GetWidth()/10, paper->GetHeight()/10));
|
||||
m_pageData.GetPrintData().SetPaperId(paper->GetId());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -602,21 +674,21 @@ bool wxGenericPageSetupDialog::TransferDataFromWindow(void)
|
||||
|
||||
wxChoice *wxGenericPageSetupDialog::CreatePaperTypeChoice(int *x, int *y)
|
||||
{
|
||||
/*
|
||||
if (!wxThePrintPaperDatabase)
|
||||
{
|
||||
wxThePrintPaperDatabase = new wxPrintPaperDatabase;
|
||||
wxThePrintPaperDatabase->CreateDatabase();
|
||||
}
|
||||
*/
|
||||
|
||||
int n = wxThePrintPaperDatabase->Number();
|
||||
wxString *choices = new wxString [n];
|
||||
int sel = 0;
|
||||
int i;
|
||||
for (i = 0; i < n; i++)
|
||||
{
|
||||
wxPrintPaperType *paper = (wxPrintPaperType *)wxThePrintPaperDatabase->Nth(i)->Data();
|
||||
choices[i] = paper->pageName;
|
||||
if (pageData.GetPaperSize().x == paper->widthMM && pageData.GetPaperSize().y == paper->heightMM)
|
||||
sel = i;
|
||||
choices[i] = paper->GetName();
|
||||
}
|
||||
|
||||
(void) new wxStaticText(this, wxPRINTID_STATIC, _("Paper size"), wxPoint(*x, *y));
|
||||
@@ -627,7 +699,7 @@ wxChoice *wxGenericPageSetupDialog::CreatePaperTypeChoice(int *x, int *y)
|
||||
*y += 35;
|
||||
delete[] choices;
|
||||
|
||||
choice->SetSelection(sel);
|
||||
// choice->SetSelection(sel);
|
||||
return choice;
|
||||
}
|
||||
|
||||
|
@@ -39,6 +39,7 @@ LIB_CPP_SRC=\
|
||||
common/dbtable.cpp \
|
||||
common/prntbase.cpp \
|
||||
common/serbase.cpp \
|
||||
common/paper.cpp \
|
||||
common/string.cpp \
|
||||
common/textfile.cpp \
|
||||
common/time.cpp \
|
||||
|
@@ -194,13 +194,20 @@ void wxDC::GetSize( int* width, int* height ) const
|
||||
if (height) *height = m_maxY-m_minY;
|
||||
}
|
||||
|
||||
void wxDC::GetSizeMM( long* width, long* height ) const
|
||||
void wxDC::GetSizeMM( int* width, int* height ) const
|
||||
{
|
||||
int w = 0;
|
||||
int h = 0;
|
||||
GetSize( &w, &h );
|
||||
if (width) *width = long( double(w) / (m_scaleX*m_mm_to_pix_x) );
|
||||
if (height) *height = long( double(h) / (m_scaleY*m_mm_to_pix_y) );
|
||||
if (width) *width = int( double(w) / (m_scaleX*m_mm_to_pix_x) );
|
||||
if (height) *height = int( double(h) / (m_scaleY*m_mm_to_pix_y) );
|
||||
}
|
||||
|
||||
// Resolution in pixels per logical inch
|
||||
wxSize wxDC::GetPPI(void) const
|
||||
{
|
||||
// TODO (should probably be pure virtual)
|
||||
return wxSize(0, 0);
|
||||
}
|
||||
|
||||
void wxDC::SetTextForeground( const wxColour &col )
|
||||
|
@@ -1370,6 +1370,11 @@ void wxWindowDC::DrawSpline( wxList *points )
|
||||
wx_spline_draw_point_array( this );
|
||||
}
|
||||
|
||||
// Resolution in pixels per logical inch
|
||||
wxSize wxWindowDC::GetPPI(void) const
|
||||
{
|
||||
return wxSize(100, 100);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxPaintDC
|
||||
|
@@ -194,13 +194,20 @@ void wxDC::GetSize( int* width, int* height ) const
|
||||
if (height) *height = m_maxY-m_minY;
|
||||
}
|
||||
|
||||
void wxDC::GetSizeMM( long* width, long* height ) const
|
||||
void wxDC::GetSizeMM( int* width, int* height ) const
|
||||
{
|
||||
int w = 0;
|
||||
int h = 0;
|
||||
GetSize( &w, &h );
|
||||
if (width) *width = long( double(w) / (m_scaleX*m_mm_to_pix_x) );
|
||||
if (height) *height = long( double(h) / (m_scaleY*m_mm_to_pix_y) );
|
||||
if (width) *width = int( double(w) / (m_scaleX*m_mm_to_pix_x) );
|
||||
if (height) *height = int( double(h) / (m_scaleY*m_mm_to_pix_y) );
|
||||
}
|
||||
|
||||
// Resolution in pixels per logical inch
|
||||
wxSize wxDC::GetPPI(void) const
|
||||
{
|
||||
// TODO (should probably be pure virtual)
|
||||
return wxSize(0, 0);
|
||||
}
|
||||
|
||||
void wxDC::SetTextForeground( const wxColour &col )
|
||||
|
@@ -1370,6 +1370,11 @@ void wxWindowDC::DrawSpline( wxList *points )
|
||||
wx_spline_draw_point_array( this );
|
||||
}
|
||||
|
||||
// Resolution in pixels per logical inch
|
||||
wxSize wxWindowDC::GetPPI(void) const
|
||||
{
|
||||
return wxSize(100, 100);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxPaintDC
|
||||
|
@@ -35,6 +35,7 @@ LIB_CPP_SRC=\
|
||||
common/mimetype.cpp \
|
||||
common/module.cpp \
|
||||
common/object.cpp \
|
||||
common/paper.cpp \
|
||||
common/prntbase.cpp \
|
||||
common/resource.cpp \
|
||||
common/serbase.cpp \
|
||||
|
@@ -29,7 +29,9 @@
|
||||
#include "wx/module.h"
|
||||
#include "wx/memory.h"
|
||||
|
||||
#if wxUSE_THREADS
|
||||
#include "wx/thread.h"
|
||||
#endif
|
||||
|
||||
#if wxUSE_WX_RESOURCES
|
||||
#include "wx/resource.h"
|
||||
@@ -297,11 +299,13 @@ int wxApp::MainLoop()
|
||||
{
|
||||
if (!ProcessIdle())
|
||||
{
|
||||
#if wxUSE_THREADS
|
||||
// leave the main loop to give other threads a chance to
|
||||
// perform their GUI work
|
||||
wxMutexGuiLeave();
|
||||
wxUsleep(20);
|
||||
wxMutexGuiEnter();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -509,8 +513,9 @@ bool wxApp::OnInitGui()
|
||||
argv);
|
||||
|
||||
if (!dpy) {
|
||||
wxString className(wxTheApp->GetClassName());
|
||||
wxLogError(_("wxWindows could not open display for '%s': exiting."),
|
||||
wxTheApp->GetClassName());
|
||||
(const char*) className);
|
||||
exit(-1);
|
||||
}
|
||||
m_initialDisplay = (WXDisplay*) dpy;
|
||||
|
@@ -197,7 +197,7 @@ bool wxBitmap::LoadFile(const wxString& filename, long type)
|
||||
wxBitmapHandler *handler = FindHandler(type);
|
||||
|
||||
if ( handler == NULL ) {
|
||||
wxLogWarning("no bitmap handler for type %d defined.", type);
|
||||
wxLogWarning("%s: no bitmap handler for type %d defined.", (const char*) filename, type);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
@@ -214,7 +214,7 @@ bool wxBitmap::Create(void *data, long type, int width, int height, int depth)
|
||||
wxBitmapHandler *handler = FindHandler(type);
|
||||
|
||||
if ( handler == NULL ) {
|
||||
wxLogWarning("no bitmap handler for type %d defined.", type);
|
||||
wxLogWarning("no data bitmap handler for type %d defined.", type);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
@@ -790,7 +790,7 @@ void wxBitmap::InitStandardHandlers()
|
||||
AddHandler(new wxXBMFileHandler);
|
||||
AddHandler(new wxXBMDataHandler);
|
||||
|
||||
// XPM is considered standard for Moif, although it can be omitted if absolutely
|
||||
// XPM is considered standard for Motif, although it can be omitted if absolutely
|
||||
// necessary.
|
||||
#if wxUSE_XPM
|
||||
AddHandler(new wxXPMFileHandler);
|
||||
|
@@ -213,15 +213,22 @@ void wxDC::GetSize( int* width, int* height ) const
|
||||
*height = m_maxY-m_minY;
|
||||
};
|
||||
|
||||
void wxDC::GetSizeMM( long* width, long* height ) const
|
||||
void wxDC::GetSizeMM( int* width, int* height ) const
|
||||
{
|
||||
int w = 0;
|
||||
int h = 0;
|
||||
GetSize( &w, &h );
|
||||
*width = long( double(w) / (m_scaleX*m_mm_to_pix_x) );
|
||||
*height = long( double(h) / (m_scaleY*m_mm_to_pix_y) );
|
||||
*width = int( double(w) / (m_scaleX*m_mm_to_pix_x) );
|
||||
*height = int( double(h) / (m_scaleY*m_mm_to_pix_y) );
|
||||
};
|
||||
|
||||
// Resolution in pixels per logical inch
|
||||
wxSize wxDC::GetPPI(void) const
|
||||
{
|
||||
// TODO (should probably be pure virtual)
|
||||
return wxSize(0, 0);
|
||||
}
|
||||
|
||||
void wxDC::SetTextForeground( const wxColour &col )
|
||||
{
|
||||
if (!Ok()) return;
|
||||
|
@@ -2323,6 +2323,12 @@ void wxWindowDC::DrawSpline( wxList *points )
|
||||
wx_spline_draw_point_array( this );
|
||||
};
|
||||
|
||||
// Resolution in pixels per logical inch
|
||||
wxSize wxWindowDC::GetPPI(void) const
|
||||
{
|
||||
return wxSize(100, 100);
|
||||
}
|
||||
|
||||
/*
|
||||
* wxPaintDC
|
||||
*/
|
||||
|
@@ -42,6 +42,7 @@ LIB_CPP_SRC=\
|
||||
../common/prntbase.cpp \
|
||||
../common/resource.cpp \
|
||||
../common/serbase.cpp \
|
||||
../common/paper.cpp \
|
||||
../common/string.cpp \
|
||||
../common/textfile.cpp \
|
||||
../common/tbarbase.cpp \
|
||||
@@ -71,6 +72,9 @@ LIB_CPP_SRC=\
|
||||
../common/http.cpp \
|
||||
../common/url.cpp \
|
||||
../common/tokenzr.cpp \
|
||||
\
|
||||
../unix/threadpsx.cpp \
|
||||
../unix/utilsunx.cpp \
|
||||
\
|
||||
accel.cpp \
|
||||
app.cpp \
|
||||
@@ -121,11 +125,9 @@ LIB_CPP_SRC=\
|
||||
stattext.cpp \
|
||||
taskbar.cpp \
|
||||
textctrl.cpp \
|
||||
thread.cpp \
|
||||
timer.cpp \
|
||||
toolbar.cpp \
|
||||
utils.cpp \
|
||||
utilsexc.cpp \
|
||||
wave.cpp \
|
||||
window.cpp \
|
||||
\
|
||||
|
102
src/msw/dc.cpp
102
src/msw/dc.cpp
@@ -72,7 +72,6 @@ wxDC::wxDC(void)
|
||||
m_minX = 0; m_minY = 0; m_maxX = 0; m_maxY = 0;
|
||||
m_clipping = FALSE;
|
||||
|
||||
m_filename = "";
|
||||
m_canvas = NULL;
|
||||
m_oldBitmap = 0;
|
||||
m_oldPen = 0;
|
||||
@@ -310,7 +309,7 @@ void wxDC::FloodFill(long x, long y, const wxColour& col, int style)
|
||||
(void)ExtFloodFill((HDC) m_hDC, XLOG2DEV(x), YLOG2DEV(y),
|
||||
col.GetPixel(),
|
||||
style==wxFLOOD_SURFACE?
|
||||
FLOODFILLSURFACE:FLOODFILLBORDER
|
||||
FLOODFILLSURFACE:FLOODFILLBORDER
|
||||
);
|
||||
|
||||
CalcBoundingBox(x, y);
|
||||
@@ -491,7 +490,7 @@ void wxDC::DrawRectangle(long x, long y, long width, long height)
|
||||
long x2 = x + width;
|
||||
long y2 = y + height;
|
||||
|
||||
/* MATTHEW: [6] new normalization */
|
||||
/* MATTHEW: [6] new normalization */
|
||||
#if WX_STANDARD_GRAPHICS
|
||||
bool do_brush, do_pen;
|
||||
|
||||
@@ -642,12 +641,12 @@ void wxDC::DrawBitmap( const wxBitmap &bmp, long x, long y, bool useMask )
|
||||
/* Not sure if we need this. The mask should leave the
|
||||
* masked areas as per the original background of this DC.
|
||||
*/
|
||||
/*
|
||||
/*
|
||||
// There might be transparent areas, so make these
|
||||
// the same colour as this DC
|
||||
memDC.SetBackground(* GetBackground());
|
||||
memDC.Clear();
|
||||
*/
|
||||
*/
|
||||
|
||||
Blit(x, y, bmp.GetWidth(), bmp.GetHeight(), & memDC, 0, 0, wxCOPY, useMask);
|
||||
|
||||
@@ -815,7 +814,7 @@ void wxDC::SetBackground(const wxBrush& brush)
|
||||
// transparently or not. TODO: maybe this should be a new function
|
||||
// wxWindow::SetTransparency(). Should that apply to the child itself, or the
|
||||
// parent?
|
||||
// m_canvas->SetBackgroundColour(m_backgroundBrush.GetColour());
|
||||
// m_canvas->SetBackgroundColour(m_backgroundBrush.GetColour());
|
||||
m_canvas->m_backgroundTransparent = FALSE;
|
||||
}
|
||||
}
|
||||
@@ -852,7 +851,7 @@ void wxDC::SetRop(WXHDC dc)
|
||||
// These may be wrong
|
||||
switch (m_logicalFunction)
|
||||
{
|
||||
// case wxXOR: c_rop = R2_XORPEN; break;
|
||||
// case wxXOR: c_rop = R2_XORPEN; break;
|
||||
case wxXOR: c_rop = R2_NOTXORPEN; break;
|
||||
case wxINVERT: c_rop = R2_NOT; break;
|
||||
case wxOR_REVERSE: c_rop = R2_MERGEPENNOT; break;
|
||||
@@ -875,73 +874,20 @@ void wxDC::SetRop(WXHDC dc)
|
||||
|
||||
bool wxDC::StartDoc(const wxString& message)
|
||||
{
|
||||
if (!this->IsKindOf(CLASSINFO(wxPrinterDC)))
|
||||
// We might be previewing, so return TRUE to let it continue.
|
||||
return TRUE;
|
||||
|
||||
DOCINFO docinfo;
|
||||
docinfo.cbSize = sizeof(DOCINFO);
|
||||
docinfo.lpszDocName = (const char *)message;
|
||||
|
||||
if (m_filename.IsEmpty())
|
||||
docinfo.lpszOutput = NULL;
|
||||
else
|
||||
docinfo.lpszOutput = (const char *)m_filename;
|
||||
|
||||
#if defined(__WIN95__)
|
||||
docinfo.lpszDatatype = NULL;
|
||||
docinfo.fwType = 0;
|
||||
#endif
|
||||
|
||||
if (!m_hDC)
|
||||
return FALSE;
|
||||
|
||||
int ret =
|
||||
#ifndef __WIN32__
|
||||
::StartDoc((HDC) m_hDC, &docinfo);
|
||||
#else
|
||||
#ifdef UNICODE
|
||||
::StartDocW((HDC) m_hDC, &docinfo);
|
||||
#else
|
||||
#ifdef __TWIN32__
|
||||
::StartDoc((HDC) m_hDC, &docinfo);
|
||||
#else
|
||||
::StartDocA((HDC) m_hDC, &docinfo);
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef __WIN16__
|
||||
if (ret <= 0)
|
||||
{
|
||||
DWORD lastError = GetLastError();
|
||||
wxDebugMsg("wxDC::StartDoc failed with error: %d\n", lastError);
|
||||
}
|
||||
#endif
|
||||
|
||||
return (ret > 0);
|
||||
}
|
||||
|
||||
void wxDC::EndDoc(void)
|
||||
{
|
||||
if (!this->IsKindOf(CLASSINFO(wxPrinterDC)))
|
||||
return;
|
||||
if (m_hDC) ::EndDoc((HDC) m_hDC);
|
||||
}
|
||||
|
||||
void wxDC::StartPage(void)
|
||||
{
|
||||
if (!this->IsKindOf(CLASSINFO(wxPrinterDC)))
|
||||
return;
|
||||
if (m_hDC)
|
||||
::StartPage((HDC) m_hDC);
|
||||
}
|
||||
|
||||
void wxDC::EndPage(void)
|
||||
{
|
||||
if (!this->IsKindOf(CLASSINFO(wxPrinterDC)))
|
||||
return;
|
||||
if (m_hDC)
|
||||
::EndPage((HDC) m_hDC);
|
||||
}
|
||||
|
||||
long wxDC::GetCharHeight(void) const
|
||||
@@ -1135,49 +1081,49 @@ long wxDC::LogicalToDeviceYRel(long y) const
|
||||
|
||||
long wxDC::ImplDeviceToLogicalX(long x) const
|
||||
{
|
||||
// return (m_scaleGDI ? x : DeviceToLogicalX(x));
|
||||
// return (m_scaleGDI ? x : DeviceToLogicalX(x));
|
||||
return x;
|
||||
}
|
||||
|
||||
long wxDC::ImplDeviceToLogicalY(long y) const
|
||||
{
|
||||
// return (m_scaleGDI ? y : DeviceToLogicalY(y));
|
||||
// return (m_scaleGDI ? y : DeviceToLogicalY(y));
|
||||
return y;
|
||||
}
|
||||
|
||||
long wxDC::ImplDeviceToLogicalXRel(long x) const
|
||||
{
|
||||
// return (m_scaleGDI ? x : DeviceToLogicalXRel(x));
|
||||
// return (m_scaleGDI ? x : DeviceToLogicalXRel(x));
|
||||
return x;
|
||||
}
|
||||
|
||||
long wxDC::ImplDeviceToLogicalYRel(long y) const
|
||||
{
|
||||
// return (m_scaleGDI ? y : DeviceToLogicalYRel(y));
|
||||
// return (m_scaleGDI ? y : DeviceToLogicalYRel(y));
|
||||
return y;
|
||||
}
|
||||
|
||||
long wxDC::ImplLogicalToDeviceX(long x) const
|
||||
{
|
||||
// return (m_scaleGDI ? (floor(double(x))) : LogicalToDeviceX(x));
|
||||
// return (m_scaleGDI ? (floor(double(x))) : LogicalToDeviceX(x));
|
||||
return x;
|
||||
}
|
||||
|
||||
long wxDC::ImplLogicalToDeviceY(long y) const
|
||||
{
|
||||
// return (m_scaleGDI ? (floor(double(y))) : LogicalToDeviceY(y));
|
||||
// return (m_scaleGDI ? (floor(double(y))) : LogicalToDeviceY(y));
|
||||
return y;
|
||||
}
|
||||
|
||||
long wxDC::ImplLogicalToDeviceXRel(long x) const
|
||||
{
|
||||
// return (m_scaleGDI ? (floor(double(x))) : LogicalToDeviceXRel(x));
|
||||
// return (m_scaleGDI ? (floor(double(x))) : LogicalToDeviceXRel(x));
|
||||
return x;
|
||||
}
|
||||
|
||||
long wxDC::ImplLogicalToDeviceYRel(long y) const
|
||||
{
|
||||
// return (m_scaleGDI ? (floor(double(y))) : LogicalToDeviceYRel(y));
|
||||
// return (m_scaleGDI ? (floor(double(y))) : LogicalToDeviceYRel(y));
|
||||
return y;
|
||||
}
|
||||
|
||||
@@ -1358,14 +1304,22 @@ void wxDC::GetSize(int* width, int* height) const
|
||||
*height = h;
|
||||
}
|
||||
|
||||
void wxDC::GetSizeMM(long *width, long *height) const
|
||||
void wxDC::GetSizeMM(int *width, int *height) const
|
||||
{
|
||||
long w=::GetDeviceCaps((HDC) m_hDC,HORZSIZE);
|
||||
long h=::GetDeviceCaps((HDC) m_hDC,VERTSIZE);
|
||||
int w=::GetDeviceCaps((HDC) m_hDC,HORZSIZE);
|
||||
int h=::GetDeviceCaps((HDC) m_hDC,VERTSIZE);
|
||||
*width = w;
|
||||
*height = h;
|
||||
}
|
||||
|
||||
// Resolution in Pixels per inch
|
||||
wxSize wxDC::GetPPI(void) const
|
||||
{
|
||||
int x=::GetDeviceCaps((HDC) m_hDC,LOGPIXELSX);
|
||||
int y=::GetDeviceCaps((HDC) m_hDC,LOGPIXELSY);
|
||||
return wxSize(x, y);
|
||||
}
|
||||
|
||||
void wxDC::DrawPolygon(wxList *list, long xoffset, long yoffset,int fillStyle)
|
||||
{
|
||||
int n = list->Number();
|
||||
@@ -1487,7 +1441,7 @@ void wxDC::DrawSpline(long x1, long y1, long x2, long y2, long x3, long y3)
|
||||
|
||||
class wxSpline: public wxObject
|
||||
{
|
||||
public:
|
||||
public:
|
||||
int type;
|
||||
wxList *points;
|
||||
|
||||
@@ -1635,7 +1589,7 @@ void wx_quadratic_spline(double a1, double b1, double a2, double b2, double a3,
|
||||
typedef struct wx_spline_stack_struct {
|
||||
double x1, y1, x2, y2, x3, y3, x4, y4;
|
||||
}
|
||||
Stack;
|
||||
Stack;
|
||||
|
||||
#define SPLINE_STACK_DEPTH 20
|
||||
static Stack wx_spline_stack[SPLINE_STACK_DEPTH];
|
||||
|
@@ -52,12 +52,13 @@
|
||||
IMPLEMENT_CLASS(wxPrinterDC, wxDC)
|
||||
#endif
|
||||
|
||||
// This form is deprecated
|
||||
wxPrinterDC::wxPrinterDC(const wxString& driver_name, const wxString& device_name, const wxString& file, bool interactive, int orientation)
|
||||
{
|
||||
m_isInteractive = interactive;
|
||||
|
||||
if (!file.IsNull() && file != "")
|
||||
m_filename = file;
|
||||
m_printData.SetFilename(file);
|
||||
|
||||
#if wxUSE_COMMON_DIALOGS
|
||||
if (interactive)
|
||||
@@ -87,7 +88,7 @@ wxPrinterDC::wxPrinterDC(const wxString& driver_name, const wxString& device_nam
|
||||
return;
|
||||
}
|
||||
|
||||
// m_dontDelete = TRUE;
|
||||
// m_dontDelete = TRUE;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
@@ -100,20 +101,39 @@ wxPrinterDC::wxPrinterDC(const wxString& driver_name, const wxString& device_nam
|
||||
}
|
||||
else
|
||||
{
|
||||
m_hDC = wxGetPrinterDC(orientation);
|
||||
wxPrintData printData;
|
||||
printData.SetOrientation(orientation);
|
||||
m_hDC = wxGetPrinterDC(printData);
|
||||
m_ok = m_hDC ? TRUE: FALSE;
|
||||
}
|
||||
|
||||
if (m_hDC)
|
||||
{
|
||||
// int width = GetDeviceCaps(m_hDC, VERTRES);
|
||||
// int height = GetDeviceCaps(m_hDC, HORZRES);
|
||||
// int width = GetDeviceCaps(m_hDC, VERTRES);
|
||||
// int height = GetDeviceCaps(m_hDC, HORZRES);
|
||||
SetMapMode(wxMM_TEXT);
|
||||
}
|
||||
SetBrush(*wxBLACK_BRUSH);
|
||||
SetPen(*wxBLACK_PEN);
|
||||
}
|
||||
|
||||
wxPrinterDC::wxPrinterDC(const wxPrintData& printData)
|
||||
{
|
||||
m_printData = printData;
|
||||
|
||||
m_isInteractive = FALSE;
|
||||
|
||||
m_hDC = wxGetPrinterDC(printData);
|
||||
m_ok = (m_hDC != 0);
|
||||
|
||||
if (m_hDC)
|
||||
SetMapMode(wxMM_TEXT);
|
||||
|
||||
SetBrush(*wxBLACK_BRUSH);
|
||||
SetPen(*wxBLACK_PEN);
|
||||
}
|
||||
|
||||
|
||||
wxPrinterDC::wxPrinterDC(WXHDC theDC)
|
||||
{
|
||||
m_isInteractive = FALSE;
|
||||
@@ -122,8 +142,8 @@ wxPrinterDC::wxPrinterDC(WXHDC theDC)
|
||||
m_ok = TRUE;
|
||||
if (m_hDC)
|
||||
{
|
||||
// int width = GetDeviceCaps(m_hDC, VERTRES);
|
||||
// int height = GetDeviceCaps(m_hDC, HORZRES);
|
||||
// int width = GetDeviceCaps(m_hDC, VERTRES);
|
||||
// int height = GetDeviceCaps(m_hDC, HORZRES);
|
||||
SetMapMode(wxMM_TEXT);
|
||||
}
|
||||
SetBrush(*wxBLACK_BRUSH);
|
||||
@@ -134,6 +154,130 @@ wxPrinterDC::~wxPrinterDC(void)
|
||||
{
|
||||
}
|
||||
|
||||
bool wxPrinterDC::StartDoc(const wxString& message)
|
||||
{
|
||||
DOCINFO docinfo;
|
||||
docinfo.cbSize = sizeof(DOCINFO);
|
||||
docinfo.lpszDocName = (const char *)message;
|
||||
|
||||
wxString filename(m_printData.GetFilename());
|
||||
|
||||
if (filename.IsEmpty())
|
||||
docinfo.lpszOutput = NULL;
|
||||
else
|
||||
docinfo.lpszOutput = (const char *) filename;
|
||||
|
||||
#if defined(__WIN95__)
|
||||
docinfo.lpszDatatype = NULL;
|
||||
docinfo.fwType = 0;
|
||||
#endif
|
||||
|
||||
if (!m_hDC)
|
||||
return FALSE;
|
||||
|
||||
int ret =
|
||||
#ifndef __WIN32__
|
||||
::StartDoc((HDC) m_hDC, &docinfo);
|
||||
#else
|
||||
#ifdef UNICODE
|
||||
::StartDocW((HDC) m_hDC, &docinfo);
|
||||
#else
|
||||
#ifdef __TWIN32__
|
||||
::StartDoc((HDC) m_hDC, &docinfo);
|
||||
#else
|
||||
::StartDocA((HDC) m_hDC, &docinfo);
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef __WIN16__
|
||||
if (ret <= 0)
|
||||
{
|
||||
DWORD lastError = GetLastError();
|
||||
wxDebugMsg("wxDC::StartDoc failed with error: %d\n", lastError);
|
||||
}
|
||||
#endif
|
||||
|
||||
return (ret > 0);
|
||||
}
|
||||
|
||||
void wxPrinterDC::EndDoc(void)
|
||||
{
|
||||
if (m_hDC) ::EndDoc((HDC) m_hDC);
|
||||
}
|
||||
|
||||
void wxPrinterDC::StartPage(void)
|
||||
{
|
||||
if (m_hDC)
|
||||
::StartPage((HDC) m_hDC);
|
||||
}
|
||||
|
||||
void wxPrinterDC::EndPage(void)
|
||||
{
|
||||
if (m_hDC)
|
||||
::EndPage((HDC) m_hDC);
|
||||
}
|
||||
|
||||
// Returns default device and port names
|
||||
static bool wxGetDefaultDeviceName(wxString& deviceName, wxString& portName)
|
||||
{
|
||||
deviceName = "";
|
||||
|
||||
LPDEVNAMES lpDevNames;
|
||||
LPSTR lpszDriverName;
|
||||
LPSTR lpszDeviceName;
|
||||
LPSTR lpszPortName;
|
||||
|
||||
PRINTDLG pd;
|
||||
|
||||
// Cygwin has trouble believing PRINTDLG is 66 bytes - thinks it is 68
|
||||
#ifdef __GNUWIN32__
|
||||
pd.lStructSize = 66; // sizeof(PRINTDLG);
|
||||
#else
|
||||
pd.lStructSize = sizeof(PRINTDLG);
|
||||
#endif
|
||||
|
||||
pd.hwndOwner = (HWND)NULL;
|
||||
pd.hDevMode = NULL; // Will be created by PrintDlg
|
||||
pd.hDevNames = NULL; // Ditto
|
||||
pd.Flags = PD_RETURNDEFAULT;
|
||||
pd.nCopies = 1;
|
||||
|
||||
if (!PrintDlg((LPPRINTDLG)&pd))
|
||||
{
|
||||
if ( pd.hDevMode )
|
||||
GlobalFree(pd.hDevMode);
|
||||
if (pd.hDevNames)
|
||||
GlobalFree(pd.hDevNames);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (pd.hDevNames)
|
||||
{
|
||||
lpDevNames = (LPDEVNAMES)GlobalLock(pd.hDevNames);
|
||||
lpszDriverName = (LPSTR)lpDevNames + lpDevNames->wDriverOffset;
|
||||
lpszDeviceName = (LPSTR)lpDevNames + lpDevNames->wDeviceOffset;
|
||||
lpszPortName = (LPSTR)lpDevNames + lpDevNames->wOutputOffset;
|
||||
GlobalUnlock(pd.hDevNames);
|
||||
GlobalFree(pd.hDevNames);
|
||||
pd.hDevNames=NULL;
|
||||
|
||||
deviceName = lpszDeviceName;
|
||||
portName = lpszPortName;
|
||||
}
|
||||
|
||||
if (pd.hDevMode)
|
||||
{
|
||||
GlobalFree(pd.hDevMode);
|
||||
pd.hDevMode=NULL;
|
||||
}
|
||||
return ( deviceName != "" );
|
||||
}
|
||||
|
||||
#if 0
|
||||
// This uses defaults, except for orientation, so we should eliminate this function
|
||||
// and use the 2nd form (passing wxPrintData) instead.
|
||||
WXHDC wxGetPrinterDC(int orientation)
|
||||
{
|
||||
HDC hDC;
|
||||
@@ -145,7 +289,11 @@ WXHDC wxGetPrinterDC(int orientation)
|
||||
|
||||
PRINTDLG pd;
|
||||
// __GNUWIN32__ has trouble believing PRINTDLG is 66 bytes - thinks it is 68
|
||||
#ifdef __GNUWIN32__
|
||||
pd.lStructSize = 66; // sizeof(PRINTDLG);
|
||||
#else
|
||||
pd.lStructSize = sizeof(PRINTDLG);
|
||||
#endif
|
||||
pd.hwndOwner = (HWND)NULL;
|
||||
pd.hDevMode = NULL; // Will be created by PrintDlg
|
||||
pd.hDevNames = NULL; // Ditto
|
||||
@@ -202,5 +350,52 @@ WXHDC wxGetPrinterDC(int orientation)
|
||||
}
|
||||
return (WXHDC) hDC;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Gets an HDC for the specified printer configuration
|
||||
WXHDC WXDLLEXPORT wxGetPrinterDC(const wxPrintData& printDataConst)
|
||||
{
|
||||
wxPrintData printData = printDataConst;
|
||||
printData.ConvertToNative();
|
||||
|
||||
char* driverName = (char*) NULL;
|
||||
|
||||
wxString devNameStr = printData.GetPrinterName();
|
||||
char* deviceName;
|
||||
char* portName = (char*) NULL; // Obsolete in WIN32
|
||||
|
||||
if (devNameStr == "")
|
||||
deviceName = (char*) NULL;
|
||||
else
|
||||
deviceName = (char*) (const char*) devNameStr;
|
||||
|
||||
LPDEVMODE lpDevMode = (LPDEVMODE) NULL;
|
||||
|
||||
HGLOBAL hDevMode = (HGLOBAL) printData.GetNativeData();
|
||||
|
||||
if ( hDevMode )
|
||||
lpDevMode = (DEVMODE*) GlobalLock(hDevMode);
|
||||
|
||||
if (devNameStr == "")
|
||||
{
|
||||
// Retrieve the default device name
|
||||
wxString portName;
|
||||
bool ret = wxGetDefaultDeviceName(devNameStr, portName);
|
||||
|
||||
wxASSERT_MSG( ret, "Could not get default device name." );
|
||||
|
||||
deviceName = (char*) (const char*) devNameStr;
|
||||
}
|
||||
|
||||
#ifdef __WIN32__
|
||||
HDC hDC = CreateDC(driverName, deviceName, portName, (DEVMODE *) lpDevMode);
|
||||
#else
|
||||
HDC hDC = CreateDC(driverName, deviceName, portName, (LPSTR) lpDevMode);
|
||||
#endif
|
||||
|
||||
if (hDevMode && lpDevMode)
|
||||
GlobalUnlock(hDevMode);
|
||||
|
||||
return (WXHDC) hDC;
|
||||
}
|
||||
|
||||
|
@@ -132,6 +132,7 @@ COMMONOBJS = \
|
||||
$(MSWDIR)\date.obj \
|
||||
$(MSWDIR)\hash.obj \
|
||||
$(MSWDIR)\list.obj \
|
||||
$(MSWDIR)\paper.obj \
|
||||
$(MSWDIR)\string.obj \
|
||||
$(MSWDIR)\time.obj \
|
||||
$(MSWDIR)\wxexpr.obj \
|
||||
@@ -551,6 +552,8 @@ $(MSWDIR)\hash.obj: $(COMMDIR)\hash.$(SRCSUFF)
|
||||
|
||||
$(MSWDIR)\list.obj: $(COMMDIR)\list.$(SRCSUFF)
|
||||
|
||||
$(MSWDIR)\paper.obj: $(COMMDIR)\paper.$(SRCSUFF)
|
||||
|
||||
$(MSWDIR)\string.obj: $(COMMDIR)\string.$(SRCSUFF)
|
||||
|
||||
$(MSWDIR)\variant.obj: $(COMMDIR)\variant.$(SRCSUFF)
|
||||
|
@@ -130,6 +130,7 @@ COMMONOBJS = \
|
||||
$(MSWDIR)\date.obj \
|
||||
$(MSWDIR)\hash.obj \
|
||||
$(MSWDIR)\list.obj \
|
||||
$(MSWDIR)\paper.obj \
|
||||
$(MSWDIR)\string.obj \
|
||||
$(MSWDIR)\time.obj \
|
||||
$(MSWDIR)\wxexpr.obj \
|
||||
@@ -539,6 +540,8 @@ $(MSWDIR)\hash.obj: $(COMMDIR)\hash.$(SRCSUFF)
|
||||
|
||||
$(MSWDIR)\list.obj: $(COMMDIR)\list.$(SRCSUFF)
|
||||
|
||||
$(MSWDIR)\paper.obj: $(COMMDIR)\paper.$(SRCSUFF)
|
||||
|
||||
$(MSWDIR)\string.obj: $(COMMDIR)\string.$(SRCSUFF)
|
||||
|
||||
$(MSWDIR)\variant.obj: $(COMMDIR)\variant.$(SRCSUFF)
|
||||
|
@@ -116,6 +116,7 @@ COMMONOBJS = \
|
||||
$(COMMDIR)\hash.obj \
|
||||
$(COMMDIR)\list.obj \
|
||||
$(COMMDIR)\variant.obj \
|
||||
$(COMMDIR)\paper.obj \
|
||||
$(COMMDIR)\string.obj \
|
||||
$(COMMDIR)\time.obj \
|
||||
$(COMMDIR)\y_tab.obj \
|
||||
@@ -873,6 +874,11 @@ $(COMMDIR)/variant.obj: $*.$(SRCSUFF)
|
||||
$(CPPFLAGS) /Fo$@ /c /Tp $*.$(SRCSUFF)
|
||||
<<
|
||||
|
||||
$(COMMDIR)/paper.obj: $*.$(SRCSUFF)
|
||||
cl @<<
|
||||
$(CPPFLAGS) /Fo$@ /c /Tp $*.$(SRCSUFF)
|
||||
<<
|
||||
|
||||
$(COMMDIR)/string.obj: $*.$(SRCSUFF)
|
||||
cl @<<
|
||||
$(CPPFLAGS) /Fo$@ /c /Tp $*.$(SRCSUFF)
|
||||
|
@@ -114,6 +114,7 @@ COMMONOBJS = \
|
||||
$(COMMDIR)/hash.$(OBJSUFF) \
|
||||
$(COMMDIR)/list.$(OBJSUFF) \
|
||||
$(COMMDIR)/variant.$(OBJSUFF) \
|
||||
$(COMMDIR)/paper.$(OBJSUFF) \
|
||||
$(COMMDIR)/string.$(OBJSUFF) \
|
||||
$(COMMDIR)/time.$(OBJSUFF) \
|
||||
$(COMMDIR)/tokenzr.$(OBJSUFF) \
|
||||
|
@@ -88,6 +88,7 @@ COMMONOBJS = \
|
||||
$(COMMDIR)\date.obj \
|
||||
$(COMMDIR)\hash.obj \
|
||||
$(COMMDIR)\list.obj \
|
||||
$(COMMDIR)\paper.obj \
|
||||
$(COMMDIR)\string.obj \
|
||||
$(COMMDIR)\time.obj \
|
||||
$(COMMDIR)\tokenzr.obj \
|
||||
|
@@ -74,6 +74,7 @@ COMMONOBJS = cmndata.obj \
|
||||
date.obj \
|
||||
hash.obj \
|
||||
list.obj \
|
||||
paper.obj \
|
||||
string.obj \
|
||||
socket.obj \
|
||||
sckaddr.obj \
|
||||
@@ -617,6 +618,9 @@ hash.obj: $(COMMDIR)\hash.cpp
|
||||
list.obj: $(COMMDIR)\list.cpp
|
||||
$(CCC) $(CPPFLAGS) $(IFLAGS) $(COMMDIR)\list.cpp /BINARY list.obj
|
||||
|
||||
paper.obj: $(COMMDIR)\paper.cpp
|
||||
$(CCC) $(CPPFLAGS) $(IFLAGS) $(COMMDIR)\paper.cpp /BINARY paper.obj
|
||||
|
||||
string.obj: $(COMMDIR)\string.cpp
|
||||
$(CCC) $(CPPFLAGS) $(IFLAGS) $(COMMDIR)\string.cpp /BINARY string.obj
|
||||
|
||||
|
@@ -116,6 +116,7 @@ COMMONOBJS = \
|
||||
$(COMMDIR)/hash.$(OBJSUFF) \
|
||||
$(COMMDIR)/list.$(OBJSUFF) \
|
||||
$(COMMDIR)/variant.$(OBJSUFF) \
|
||||
$(COMMDIR)/paper.$(OBJSUFF) \
|
||||
$(COMMDIR)/string.$(OBJSUFF) \
|
||||
$(COMMDIR)/time.$(OBJSUFF) \
|
||||
$(COMMDIR)/tokenzr.$(OBJSUFF) \
|
||||
|
@@ -135,6 +135,7 @@ COMMONOBJS = \
|
||||
..\common\$D\date.obj \
|
||||
..\common\$D\hash.obj \
|
||||
..\common\$D\list.obj \
|
||||
..\common\$D\paper.obj \
|
||||
..\common\$D\string.obj \
|
||||
..\common\$D\socket.obj \
|
||||
..\common\$D\sckaddr.obj \
|
||||
|
@@ -84,6 +84,7 @@ COMMONOBJS = cmndata.obj &
|
||||
date.obj &
|
||||
hash.obj &
|
||||
list.obj &
|
||||
paper.obj &
|
||||
string.obj &
|
||||
socket.obj &
|
||||
sckaddr.obj &
|
||||
@@ -629,6 +630,9 @@ hash.obj: $(COMMDIR)\hash.cpp
|
||||
list.obj: $(COMMDIR)\list.cpp
|
||||
*$(CCC) $(CPPFLAGS) $(IFLAGS) $<
|
||||
|
||||
paper.obj: $(COMMDIR)\paper.cpp
|
||||
*$(CCC) $(CPPFLAGS) $(IFLAGS) $<
|
||||
|
||||
string.obj: $(COMMDIR)\string.cpp
|
||||
*$(CCC) $(CPPFLAGS) $(IFLAGS) $<
|
||||
|
||||
|
@@ -50,97 +50,86 @@ IMPLEMENT_CLASS(wxPageSetupDialog, wxDialog)
|
||||
#endif
|
||||
|
||||
wxPrintDialog::wxPrintDialog(void):
|
||||
wxDialog()
|
||||
wxDialog()
|
||||
{
|
||||
dialogParent = NULL;
|
||||
printerDC = NULL;
|
||||
destroyDC = TRUE;
|
||||
deviceName = NULL;
|
||||
driverName = NULL;
|
||||
portName = NULL;
|
||||
m_dialogParent = NULL;
|
||||
m_printerDC = NULL;
|
||||
m_destroyDC = TRUE;
|
||||
}
|
||||
|
||||
wxPrintDialog::wxPrintDialog(wxWindow *p, wxPrintData* data):
|
||||
wxDialog()
|
||||
wxPrintDialog::wxPrintDialog(wxWindow *p, wxPrintDialogData* data):
|
||||
wxDialog()
|
||||
{
|
||||
Create(p, data);
|
||||
}
|
||||
|
||||
bool wxPrintDialog::Create(wxWindow *p, wxPrintData* data)
|
||||
bool wxPrintDialog::Create(wxWindow *p, wxPrintDialogData* data)
|
||||
{
|
||||
dialogParent = p;
|
||||
printerDC = NULL;
|
||||
destroyDC = TRUE;
|
||||
deviceName = NULL;
|
||||
driverName = NULL;
|
||||
portName = NULL;
|
||||
m_dialogParent = p;
|
||||
m_printerDC = NULL;
|
||||
m_destroyDC = TRUE;
|
||||
|
||||
if ( data )
|
||||
printData = *data;
|
||||
m_printDialogData = *data;
|
||||
|
||||
#ifdef __WXMSW__
|
||||
printData.SetOwnerWindow(p);
|
||||
#endif
|
||||
m_printDialogData.SetOwnerWindow(p);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
wxPrintDialog::~wxPrintDialog(void)
|
||||
{
|
||||
if (destroyDC && printerDC)
|
||||
delete printerDC;
|
||||
if (deviceName) delete[] deviceName;
|
||||
if (driverName) delete[] driverName;
|
||||
if (portName) delete[] portName;
|
||||
if (m_destroyDC && m_printerDC)
|
||||
delete m_printerDC;
|
||||
}
|
||||
|
||||
int wxPrintDialog::ShowModal(void)
|
||||
{
|
||||
printData.ConvertToNative();
|
||||
m_printDialogData.ConvertToNative();
|
||||
|
||||
bool ret = (PrintDlg( (PRINTDLG *)printData.printData ) != 0);
|
||||
if ( ret != FALSE && ((PRINTDLG *)printData.printData)->hDC)
|
||||
bool ret = (PrintDlg( (PRINTDLG *)m_printDialogData.GetNativeData() ) != 0);
|
||||
if ( ret != FALSE && ((PRINTDLG *)m_printDialogData.GetNativeData())->hDC)
|
||||
{
|
||||
wxPrinterDC *pdc = new wxPrinterDC((WXHDC) ((PRINTDLG *)printData.printData)->hDC);
|
||||
printerDC = pdc;
|
||||
printData.ConvertFromNative();
|
||||
wxPrinterDC *pdc = new wxPrinterDC((WXHDC) ((PRINTDLG *)m_printDialogData.GetNativeData())->hDC);
|
||||
m_printerDC = pdc;
|
||||
m_printDialogData.ConvertFromNative();
|
||||
return wxID_OK;
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
/*
|
||||
char buf[256];
|
||||
DWORD exError = CommDlgExtendedError();
|
||||
sprintf(buf, "ret = %d, ex error = %d", (int) ret, (int) exError);
|
||||
wxMessageBox(buf);
|
||||
*/
|
||||
*/
|
||||
return wxID_CANCEL;
|
||||
}
|
||||
}
|
||||
|
||||
wxDC *wxPrintDialog::GetPrintDC(void)
|
||||
{
|
||||
if (printerDC)
|
||||
if (m_printerDC)
|
||||
{
|
||||
destroyDC = FALSE;
|
||||
return printerDC;
|
||||
m_destroyDC = FALSE;
|
||||
return m_printerDC;
|
||||
}
|
||||
else
|
||||
return NULL;
|
||||
return (wxDC*) NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* wxPageSetupDialog
|
||||
*/
|
||||
* wxPageSetupDialog
|
||||
*/
|
||||
|
||||
wxPageSetupDialog::wxPageSetupDialog(void):
|
||||
wxDialog()
|
||||
wxDialog()
|
||||
{
|
||||
m_dialogParent = NULL;
|
||||
}
|
||||
|
||||
wxPageSetupDialog::wxPageSetupDialog(wxWindow *p, wxPageSetupData *data):
|
||||
wxDialog()
|
||||
wxDialog()
|
||||
{
|
||||
Create(p, data);
|
||||
}
|
||||
|
@@ -55,11 +55,11 @@ IMPLEMENT_CLASS(wxWindowsPrintPreview, wxPrintPreviewBase)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Printer
|
||||
*/
|
||||
* Printer
|
||||
*/
|
||||
|
||||
wxWindowsPrinter::wxWindowsPrinter(wxPrintData *data):
|
||||
wxPrinterBase(data)
|
||||
wxWindowsPrinter::wxWindowsPrinter(wxPrintDialogData *data):
|
||||
wxPrinterBase(data)
|
||||
{
|
||||
m_lpAbortProc = (WXFARPROC) MakeProcInstance((FARPROC) wxAbortProc, wxGetInstance());
|
||||
}
|
||||
@@ -88,42 +88,40 @@ bool wxWindowsPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt
|
||||
if (maxPage == 0)
|
||||
return FALSE;
|
||||
|
||||
m_printData.SetMinPage(minPage);
|
||||
m_printData.SetMaxPage(maxPage);
|
||||
m_printDialogData.SetMinPage(minPage);
|
||||
m_printDialogData.SetMaxPage(maxPage);
|
||||
if (fromPage != 0)
|
||||
m_printData.SetFromPage(fromPage);
|
||||
m_printDialogData.SetFromPage(fromPage);
|
||||
if (toPage != 0)
|
||||
m_printData.SetToPage(toPage);
|
||||
m_printDialogData.SetToPage(toPage);
|
||||
|
||||
if (minPage != 0)
|
||||
{
|
||||
m_printData.EnablePageNumbers(TRUE);
|
||||
if (m_printData.GetFromPage() < m_printData.GetMinPage())
|
||||
m_printData.SetFromPage(m_printData.GetMinPage());
|
||||
else if (m_printData.GetFromPage() > m_printData.GetMaxPage())
|
||||
m_printData.SetFromPage(m_printData.GetMaxPage());
|
||||
if (m_printData.GetToPage() > m_printData.GetMaxPage())
|
||||
m_printData.SetToPage(m_printData.GetMaxPage());
|
||||
else if (m_printData.GetToPage() < m_printData.GetMinPage())
|
||||
m_printData.SetToPage(m_printData.GetMinPage());
|
||||
m_printDialogData.EnablePageNumbers(TRUE);
|
||||
if (m_printDialogData.GetFromPage() < m_printDialogData.GetMinPage())
|
||||
m_printDialogData.SetFromPage(m_printDialogData.GetMinPage());
|
||||
else if (m_printDialogData.GetFromPage() > m_printDialogData.GetMaxPage())
|
||||
m_printDialogData.SetFromPage(m_printDialogData.GetMaxPage());
|
||||
if (m_printDialogData.GetToPage() > m_printDialogData.GetMaxPage())
|
||||
m_printDialogData.SetToPage(m_printDialogData.GetMaxPage());
|
||||
else if (m_printDialogData.GetToPage() < m_printDialogData.GetMinPage())
|
||||
m_printDialogData.SetToPage(m_printDialogData.GetMinPage());
|
||||
}
|
||||
else
|
||||
m_printData.EnablePageNumbers(FALSE);
|
||||
m_printDialogData.EnablePageNumbers(FALSE);
|
||||
|
||||
// Create a suitable device context
|
||||
wxDC *dc = NULL;
|
||||
if (prompt)
|
||||
{
|
||||
wxPrintDialog dialog(parent, & m_printData);
|
||||
if (dialog.ShowModal() == wxID_OK)
|
||||
{
|
||||
dc = dialog.GetPrintDC();
|
||||
m_printData = dialog.GetPrintData();
|
||||
}
|
||||
dc = PrintDialog(parent);
|
||||
if (!dc)
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
dc = new wxPrinterDC("", "", "", FALSE, m_printData.GetOrientation());
|
||||
// dc = new wxPrinterDC("", "", "", FALSE, m_printData.GetOrientation());
|
||||
dc = new wxPrinterDC(m_printDialogData.GetPrintData());
|
||||
}
|
||||
|
||||
// May have pressed cancel.
|
||||
@@ -158,11 +156,11 @@ bool wxWindowsPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt
|
||||
printout->SetDC(dc);
|
||||
|
||||
int w, h;
|
||||
long ww, hh;
|
||||
dc->GetSize(&w, &h);
|
||||
printout->SetPageSizePixels((int)w, (int)h);
|
||||
dc->GetSizeMM(&ww, &hh);
|
||||
printout->SetPageSizeMM((int)ww, (int)hh);
|
||||
|
||||
dc->GetSizeMM(&w, &h);
|
||||
printout->SetPageSizeMM((int)w, (int)h);
|
||||
|
||||
// Create an abort window
|
||||
wxBeginBusyCursor();
|
||||
@@ -177,11 +175,11 @@ bool wxWindowsPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt
|
||||
// cast it to right type only if required
|
||||
// @@@ it's really cdecl and we're casting it to stdcall - either there is
|
||||
// something I don't understand or it will crash at first usage
|
||||
#ifdef STRICT
|
||||
#ifdef STRICT
|
||||
(HDC, int)
|
||||
#else
|
||||
#else
|
||||
()
|
||||
#endif
|
||||
#endif
|
||||
)m_lpAbortProc);
|
||||
#endif
|
||||
|
||||
@@ -200,9 +198,9 @@ bool wxWindowsPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt
|
||||
bool keepGoing = TRUE;
|
||||
|
||||
int copyCount;
|
||||
for (copyCount = 1; copyCount <= m_printData.GetNoCopies(); copyCount ++)
|
||||
for (copyCount = 1; copyCount <= m_printDialogData.GetNoCopies(); copyCount ++)
|
||||
{
|
||||
if (!printout->OnBeginDocument(m_printData.GetFromPage(), m_printData.GetToPage()))
|
||||
if (!printout->OnBeginDocument(m_printDialogData.GetFromPage(), m_printDialogData.GetToPage()))
|
||||
{
|
||||
wxEndBusyCursor();
|
||||
wxMessageBox("Could not start printing.", "Print Error", wxOK, parent);
|
||||
@@ -212,7 +210,7 @@ bool wxWindowsPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt
|
||||
break;
|
||||
|
||||
int pn;
|
||||
for (pn = m_printData.GetFromPage(); keepGoing && (pn <= m_printData.GetToPage()) && printout->HasPage(pn);
|
||||
for (pn = m_printDialogData.GetFromPage(); keepGoing && (pn <= m_printDialogData.GetToPage()) && printout->HasPage(pn);
|
||||
pn++)
|
||||
{
|
||||
if (sm_abortIt)
|
||||
@@ -222,11 +220,9 @@ bool wxWindowsPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt
|
||||
}
|
||||
else
|
||||
{
|
||||
// int dcID = ::SaveDC(dc->GetHDC());
|
||||
dc->StartPage();
|
||||
printout->OnPrintPage(pn);
|
||||
dc->EndPage();
|
||||
// ::RestoreDC(dc->GetHDC(), dcID);
|
||||
}
|
||||
}
|
||||
printout->OnEndDocument();
|
||||
@@ -248,25 +244,43 @@ bool wxWindowsPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool wxWindowsPrinter::PrintDialog(wxWindow *parent)
|
||||
wxDC* wxWindowsPrinter::PrintDialog(wxWindow *parent)
|
||||
{
|
||||
wxPrintDialog dialog(parent, & m_printData);
|
||||
return (dialog.ShowModal() == wxID_OK);
|
||||
wxDC* dc = (wxDC*) NULL;
|
||||
|
||||
wxPrintDialog dialog(parent, & m_printDialogData);
|
||||
int ret = dialog.ShowModal();
|
||||
|
||||
if (ret == wxID_OK)
|
||||
{
|
||||
dc = dialog.GetPrintDC();
|
||||
m_printDialogData = dialog.GetPrintDialogData();
|
||||
}
|
||||
|
||||
return dc;
|
||||
}
|
||||
|
||||
bool wxWindowsPrinter::Setup(wxWindow *parent)
|
||||
{
|
||||
wxPrintDialog dialog(parent, & m_printData);
|
||||
dialog.GetPrintData().SetSetupDialog(TRUE);
|
||||
return (dialog.ShowModal() == wxID_OK);
|
||||
wxPrintDialog dialog(parent, & m_printDialogData);
|
||||
dialog.GetPrintDialogData().SetSetupDialog(TRUE);
|
||||
|
||||
int ret = dialog.ShowModal();
|
||||
|
||||
if (ret == wxID_OK)
|
||||
{
|
||||
m_printDialogData = dialog.GetPrintDialogData();
|
||||
}
|
||||
|
||||
return (ret == wxID_OK);
|
||||
}
|
||||
|
||||
/*
|
||||
* Print preview
|
||||
*/
|
||||
* Print preview
|
||||
*/
|
||||
|
||||
wxWindowsPrintPreview::wxWindowsPrintPreview(wxPrintout *printout, wxPrintout *printoutForPrinting, wxPrintData *data):
|
||||
wxPrintPreviewBase(printout, printoutForPrinting, data)
|
||||
wxWindowsPrintPreview::wxWindowsPrintPreview(wxPrintout *printout, wxPrintout *printoutForPrinting, wxPrintDialogData *data):
|
||||
wxPrintPreviewBase(printout, printoutForPrinting, data)
|
||||
{
|
||||
DetermineScaling();
|
||||
}
|
||||
@@ -279,7 +293,7 @@ bool wxWindowsPrintPreview::Print(bool interactive)
|
||||
{
|
||||
if (!m_printPrintout)
|
||||
return FALSE;
|
||||
wxWindowsPrinter printer(&m_printData);
|
||||
wxWindowsPrinter printer(&m_printDialogData);
|
||||
return printer.Print(m_previewFrame, m_printPrintout, interactive);
|
||||
}
|
||||
|
||||
@@ -287,9 +301,9 @@ void wxWindowsPrintPreview::DetermineScaling(void)
|
||||
{
|
||||
HDC dc = ::GetDC(NULL);
|
||||
int screenWidth = ::GetDeviceCaps(dc, HORZSIZE);
|
||||
// int screenHeight = ::GetDeviceCaps(dc, VERTSIZE);
|
||||
// int screenHeight = ::GetDeviceCaps(dc, VERTSIZE);
|
||||
int screenXRes = ::GetDeviceCaps(dc, HORZRES);
|
||||
// int screenYRes = ::GetDeviceCaps(dc, VERTRES);
|
||||
// int screenYRes = ::GetDeviceCaps(dc, VERTRES);
|
||||
int logPPIScreenX = ::GetDeviceCaps(dc, LOGPIXELSX);
|
||||
int logPPIScreenY = ::GetDeviceCaps(dc, LOGPIXELSY);
|
||||
m_previewPrintout->SetPPIScreen(logPPIScreenX, logPPIScreenY);
|
||||
@@ -297,7 +311,7 @@ void wxWindowsPrintPreview::DetermineScaling(void)
|
||||
::ReleaseDC(NULL, dc);
|
||||
|
||||
// Get a device context for the currently selected printer
|
||||
wxPrinterDC printerDC("", "", "", FALSE, m_printData.GetOrientation());
|
||||
wxPrinterDC printerDC(m_printDialogData.GetPrintData());
|
||||
|
||||
int printerWidth = 150;
|
||||
int printerHeight = 250;
|
||||
|
@@ -34,6 +34,7 @@ LIB_CPP_SRC=\
|
||||
common/module.cpp \
|
||||
common/object.cpp \
|
||||
common/odbc.cpp \
|
||||
common/paper.cpp \
|
||||
common/prntbase.cpp \
|
||||
common/resource.cpp \
|
||||
common/serbase.cpp \
|
||||
|
@@ -24,12 +24,13 @@
|
||||
#pragma implementation "thread.h"
|
||||
#endif
|
||||
|
||||
// With simple makefiles, we must ignore the file body if not using
|
||||
// threads.
|
||||
#include "wx/setup.h"
|
||||
|
||||
#if wxUSE_THREADS
|
||||
|
||||
#include "wx/thread.h"
|
||||
|
||||
#if !wxUSE_THREADS
|
||||
#error This file needs wxUSE_THREADS
|
||||
#endif
|
||||
|
||||
#include "wx/module.h"
|
||||
#include "wx/utils.h"
|
||||
#include "wx/log.h"
|
||||
@@ -42,7 +43,7 @@
|
||||
#include <errno.h>
|
||||
#include <time.h>
|
||||
|
||||
#ifdef HAVE_SCHED_H
|
||||
#if HAVE_SCHED_H
|
||||
#include <sched.h>
|
||||
#endif
|
||||
|
||||
@@ -793,3 +794,5 @@ void wxMutexGuiLeave()
|
||||
gs_mutexGui->Unlock();
|
||||
}
|
||||
|
||||
#endif
|
||||
// wxUSE_THREADS
|
||||
|
@@ -41,7 +41,10 @@
|
||||
#include <time.h> // nanosleep() and/or usleep()
|
||||
#include <ctype.h> // isspace()
|
||||
|
||||
#ifdef HAVE_UNAME
|
||||
// JACS: needed for FD_SETSIZE
|
||||
#include <sys/time.h>
|
||||
|
||||
#if HAVE_UNAME
|
||||
#include <sys/utsname.h> // for uname()
|
||||
#endif // HAVE_UNAME
|
||||
|
||||
@@ -81,14 +84,14 @@ void wxSleep(int nSecs)
|
||||
|
||||
void wxUsleep(unsigned long milliseconds)
|
||||
{
|
||||
#if defined(HAVE_NANOSLEEP)
|
||||
#if HAVE_NANOSLEEP
|
||||
timespec tmReq;
|
||||
tmReq.tv_sec = milliseconds / 1000;
|
||||
tmReq.tv_nsec = (milliseconds % 1000) * 1000 * 1000;
|
||||
|
||||
// we're not interested in remaining time nor in return value
|
||||
(void)nanosleep(&tmReq, (timespec *)NULL);
|
||||
#elif defined(HAVE_USLEEP)
|
||||
#elif HAVE_USLEEP
|
||||
// uncomment this if you feel brave or if you are sure that your version
|
||||
// of Solaris has a safe usleep() function but please notice that usleep()
|
||||
// is known to lead to crashes in MT programs in Solaris 2.[67] and is not
|
||||
|
Reference in New Issue
Block a user