implemented wxDisplaySizeMM for gtk, msw & motif.
used wxDisplaySize and wxDisplaySizeMM to calculate real screen PPI in wxPostScriptPrinter. documented wxDisplaySize and wxDisplaySizeMM. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@8414 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -849,6 +849,22 @@ Returns TRUE if the display is colour, FALSE otherwise.
|
|||||||
|
|
||||||
Returns the depth of the display (a value of 1 denotes a monochrome display).
|
Returns the depth of the display (a value of 1 denotes a monochrome display).
|
||||||
|
|
||||||
|
\membersection{::wxDisplaySize}
|
||||||
|
|
||||||
|
\func{void}{wxDisplaySize}{\param{int *}{width}, \param{int *}{height}}
|
||||||
|
|
||||||
|
\func{wxSize}{wxGetDisplaySize}{\void}
|
||||||
|
|
||||||
|
Returns the display size in pixels.
|
||||||
|
|
||||||
|
\membersection{::wxDisplaySizeMM}
|
||||||
|
|
||||||
|
\func{void}{wxDisplaySizeMM}{\param{int *}{width}, \param{int *}{height}}
|
||||||
|
|
||||||
|
\func{wxSize}{wxGetDisplaySizeMM}{\void}
|
||||||
|
|
||||||
|
Returns the display size in millimeters.
|
||||||
|
|
||||||
\membersection{::wxMakeMetafilePlaceable}\label{wxmakemetafileplaceable}
|
\membersection{::wxMakeMetafilePlaceable}\label{wxmakemetafileplaceable}
|
||||||
|
|
||||||
\func{bool}{wxMakeMetafilePlaceable}{\param{const wxString\& }{filename}, \param{int }{minX}, \param{int }{minY},
|
\func{bool}{wxMakeMetafilePlaceable}{\param{const wxString\& }{filename}, \param{int }{minX}, \param{int }{minY},
|
||||||
|
@@ -496,9 +496,11 @@ extern bool WXDLLEXPORT wxColourDisplay();
|
|||||||
extern int WXDLLEXPORT wxDisplayDepth();
|
extern int WXDLLEXPORT wxDisplayDepth();
|
||||||
#define wxGetDisplayDepth wxDisplayDepth
|
#define wxGetDisplayDepth wxDisplayDepth
|
||||||
|
|
||||||
// get the diaplay size
|
// get the display size
|
||||||
extern void WXDLLEXPORT wxDisplaySize(int *width, int *height);
|
extern void WXDLLEXPORT wxDisplaySize(int *width, int *height);
|
||||||
extern wxSize WXDLLEXPORT wxGetDisplaySize();
|
extern wxSize WXDLLEXPORT wxGetDisplaySize();
|
||||||
|
extern void WXDLLEXPORT wxDisplaySizeMM(int *width, int *height);
|
||||||
|
extern wxSize WXDLLEXPORT wxGetDisplaySizeMM();
|
||||||
|
|
||||||
// set global cursor
|
// set global cursor
|
||||||
extern void WXDLLEXPORT wxSetCursor(const wxCursor& cursor);
|
extern void WXDLLEXPORT wxSetCursor(const wxCursor& cursor);
|
||||||
|
@@ -691,6 +691,13 @@ wxSize wxGetDisplaySize()
|
|||||||
return wxSize(x, y);
|
return wxSize(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wxSize wxGetDisplaySizeMM()
|
||||||
|
{
|
||||||
|
int x, y;
|
||||||
|
wxDisplaySizeMM(& x, & y);
|
||||||
|
return wxSize(x, y);
|
||||||
|
}
|
||||||
|
|
||||||
wxResourceCache::~wxResourceCache ()
|
wxResourceCache::~wxResourceCache ()
|
||||||
{
|
{
|
||||||
wxNode *node = First ();
|
wxNode *node = First ();
|
||||||
|
@@ -148,25 +148,13 @@ bool wxPostScriptPrinter::Print(wxWindow *parent, wxPrintout *printout, bool pro
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
int logPPIScreenX = 0;
|
wxSize ScreenPixels = wxGetDisplaySize();
|
||||||
int logPPIScreenY = 0;
|
wxSize ScreenMM = wxGetDisplaySizeMM();
|
||||||
int logPPIPrinterX = 0;
|
|
||||||
int logPPIPrinterY = 0;
|
|
||||||
|
|
||||||
logPPIScreenX = 100;
|
printout->SetPPIScreen( (ScreenPixels.GetWidth() * 25.4) / ScreenMM.GetWidth(),
|
||||||
logPPIScreenY = 100;
|
(ScreenPixels.GetHeight() * 25.4) / ScreenMM.GetHeight() );
|
||||||
|
printout->SetPPIPrinter( wxPostScriptDC::GetResolution(),
|
||||||
/*
|
wxPostScriptDC::GetResolution() );
|
||||||
// Correct values for X/PostScript?
|
|
||||||
logPPIPrinterX = 100;
|
|
||||||
logPPIPrinterY = 100;
|
|
||||||
*/
|
|
||||||
|
|
||||||
logPPIPrinterX = wxPostScriptDC::GetResolution();
|
|
||||||
logPPIPrinterY = wxPostScriptDC::GetResolution();
|
|
||||||
|
|
||||||
printout->SetPPIScreen(logPPIScreenX, logPPIScreenY);
|
|
||||||
printout->SetPPIPrinter(logPPIPrinterX, logPPIPrinterY);
|
|
||||||
|
|
||||||
// Set printout parameters
|
// Set printout parameters
|
||||||
printout->SetDC(dc);
|
printout->SetDC(dc);
|
||||||
@@ -348,8 +336,11 @@ void wxPostScriptPrintPreview::DetermineScaling()
|
|||||||
|
|
||||||
if (paper)
|
if (paper)
|
||||||
{
|
{
|
||||||
m_previewPrintout->SetPPIScreen(100, 100);
|
wxSize ScreenPixels = wxGetDisplaySize();
|
||||||
// m_previewPrintout->SetPPIPrinter(100, 100);
|
wxSize ScreenMM = wxGetDisplaySizeMM();
|
||||||
|
|
||||||
|
m_previewPrintout->SetPPIScreen( (ScreenPixels.GetWidth() * 25.4) / ScreenMM.GetWidth(),
|
||||||
|
(ScreenPixels.GetHeight() * 25.4) / ScreenMM.GetHeight() );
|
||||||
m_previewPrintout->SetPPIPrinter(wxPostScriptDC::GetResolution(), wxPostScriptDC::GetResolution());
|
m_previewPrintout->SetPPIPrinter(wxPostScriptDC::GetResolution(), wxPostScriptDC::GetResolution());
|
||||||
|
|
||||||
wxSize sizeDevUnits(paper->GetSizeDeviceUnits());
|
wxSize sizeDevUnits(paper->GetSizeDeviceUnits());
|
||||||
|
@@ -88,6 +88,12 @@ void wxDisplaySize( int *width, int *height )
|
|||||||
if (height) *height = gdk_screen_height();
|
if (height) *height = gdk_screen_height();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wxDisplaySizeMM( int *width, int *height )
|
||||||
|
{
|
||||||
|
if (width) *width = gdk_screen_width_mm();
|
||||||
|
if (height) *height = gdk_screen_height_mm();
|
||||||
|
}
|
||||||
|
|
||||||
void wxGetMousePosition( int* x, int* y )
|
void wxGetMousePosition( int* x, int* y )
|
||||||
{
|
{
|
||||||
gdk_window_get_pointer( (GdkWindow*) NULL, x, y, (GdkModifierType*) NULL );
|
gdk_window_get_pointer( (GdkWindow*) NULL, x, y, (GdkModifierType*) NULL );
|
||||||
|
@@ -88,6 +88,12 @@ void wxDisplaySize( int *width, int *height )
|
|||||||
if (height) *height = gdk_screen_height();
|
if (height) *height = gdk_screen_height();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wxDisplaySizeMM( int *width, int *height )
|
||||||
|
{
|
||||||
|
if (width) *width = gdk_screen_width_mm();
|
||||||
|
if (height) *height = gdk_screen_height_mm();
|
||||||
|
}
|
||||||
|
|
||||||
void wxGetMousePosition( int* x, int* y )
|
void wxGetMousePosition( int* x, int* y )
|
||||||
{
|
{
|
||||||
gdk_window_get_pointer( (GdkWindow*) NULL, x, y, (GdkModifierType*) NULL );
|
gdk_window_get_pointer( (GdkWindow*) NULL, x, y, (GdkModifierType*) NULL );
|
||||||
|
@@ -648,6 +648,16 @@ void wxDisplaySize(int *width, int *height)
|
|||||||
*height = DisplayHeight (dpy, DefaultScreen (dpy));
|
*height = DisplayHeight (dpy, DefaultScreen (dpy));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wxDisplaySizeMM(int *width, int *height)
|
||||||
|
{
|
||||||
|
Display *dpy = (Display*) wxGetDisplay();
|
||||||
|
|
||||||
|
if ( width )
|
||||||
|
*width = DisplayWidthMM(dpy, DefaultScreen (dpy));
|
||||||
|
if ( height )
|
||||||
|
*height = DisplayHeightMM(dpy, DefaultScreen (dpy));
|
||||||
|
}
|
||||||
|
|
||||||
// Configurable display in Motif
|
// Configurable display in Motif
|
||||||
static WXDisplay *gs_currentDisplay = NULL;
|
static WXDisplay *gs_currentDisplay = NULL;
|
||||||
static wxString gs_displayName;
|
static wxString gs_displayName;
|
||||||
|
@@ -986,6 +986,15 @@ void wxDisplaySize(int *width, int *height)
|
|||||||
if ( height ) *height = GetDeviceCaps(dc, VERTRES);
|
if ( height ) *height = GetDeviceCaps(dc, VERTRES);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wxDisplaySizeMM(int *width, int *height)
|
||||||
|
{
|
||||||
|
ScreenHDC dc;
|
||||||
|
|
||||||
|
if ( width ) *width = GetDeviceCaps(dc, HORZSIZE);
|
||||||
|
if ( height ) *height = GetDeviceCaps(dc, VERTSIZE);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
// window information functions
|
// window information functions
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
Reference in New Issue
Block a user