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:
parent
11207aa4c2
commit
904a68b6f6
@ -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).
|
||||
|
||||
\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}
|
||||
|
||||
\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();
|
||||
#define wxGetDisplayDepth wxDisplayDepth
|
||||
|
||||
// get the diaplay size
|
||||
// get the display size
|
||||
extern void WXDLLEXPORT wxDisplaySize(int *width, int *height);
|
||||
extern wxSize WXDLLEXPORT wxGetDisplaySize();
|
||||
extern void WXDLLEXPORT wxDisplaySizeMM(int *width, int *height);
|
||||
extern wxSize WXDLLEXPORT wxGetDisplaySizeMM();
|
||||
|
||||
// set global cursor
|
||||
extern void WXDLLEXPORT wxSetCursor(const wxCursor& cursor);
|
||||
|
@ -691,6 +691,13 @@ wxSize wxGetDisplaySize()
|
||||
return wxSize(x, y);
|
||||
}
|
||||
|
||||
wxSize wxGetDisplaySizeMM()
|
||||
{
|
||||
int x, y;
|
||||
wxDisplaySizeMM(& x, & y);
|
||||
return wxSize(x, y);
|
||||
}
|
||||
|
||||
wxResourceCache::~wxResourceCache ()
|
||||
{
|
||||
wxNode *node = First ();
|
||||
|
@ -148,25 +148,13 @@ bool wxPostScriptPrinter::Print(wxWindow *parent, wxPrintout *printout, bool pro
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
int logPPIScreenX = 0;
|
||||
int logPPIScreenY = 0;
|
||||
int logPPIPrinterX = 0;
|
||||
int logPPIPrinterY = 0;
|
||||
wxSize ScreenPixels = wxGetDisplaySize();
|
||||
wxSize ScreenMM = wxGetDisplaySizeMM();
|
||||
|
||||
logPPIScreenX = 100;
|
||||
logPPIScreenY = 100;
|
||||
|
||||
/*
|
||||
// Correct values for X/PostScript?
|
||||
logPPIPrinterX = 100;
|
||||
logPPIPrinterY = 100;
|
||||
*/
|
||||
|
||||
logPPIPrinterX = wxPostScriptDC::GetResolution();
|
||||
logPPIPrinterY = wxPostScriptDC::GetResolution();
|
||||
|
||||
printout->SetPPIScreen(logPPIScreenX, logPPIScreenY);
|
||||
printout->SetPPIPrinter(logPPIPrinterX, logPPIPrinterY);
|
||||
printout->SetPPIScreen( (ScreenPixels.GetWidth() * 25.4) / ScreenMM.GetWidth(),
|
||||
(ScreenPixels.GetHeight() * 25.4) / ScreenMM.GetHeight() );
|
||||
printout->SetPPIPrinter( wxPostScriptDC::GetResolution(),
|
||||
wxPostScriptDC::GetResolution() );
|
||||
|
||||
// Set printout parameters
|
||||
printout->SetDC(dc);
|
||||
@ -348,8 +336,11 @@ void wxPostScriptPrintPreview::DetermineScaling()
|
||||
|
||||
if (paper)
|
||||
{
|
||||
m_previewPrintout->SetPPIScreen(100, 100);
|
||||
// m_previewPrintout->SetPPIPrinter(100, 100);
|
||||
wxSize ScreenPixels = wxGetDisplaySize();
|
||||
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());
|
||||
|
||||
wxSize sizeDevUnits(paper->GetSizeDeviceUnits());
|
||||
|
@ -88,6 +88,12 @@ void wxDisplaySize( int *width, int *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 )
|
||||
{
|
||||
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();
|
||||
}
|
||||
|
||||
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 )
|
||||
{
|
||||
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));
|
||||
}
|
||||
|
||||
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
|
||||
static WXDisplay *gs_currentDisplay = NULL;
|
||||
static wxString gs_displayName;
|
||||
|
@ -986,6 +986,15 @@ void wxDisplaySize(int *width, int *height)
|
||||
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
|
||||
// ---------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user