wxDC scaling fix patch (Derry Bryson)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@9240 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2001-01-31 15:57:09 +00:00
parent 8a16a98e59
commit ce83033f35
5 changed files with 326 additions and 211 deletions

View File

@@ -1,8 +1,120 @@
This file contains the detailed log of wxGTK-specific changes, please see
doc/changes.txt for the concise log of important changes in all wxWindows
ports.
22nd July 2000: wxWindows 2.2.1 released
*** wxWindows 2.3.0 ***
scaling for map modes other than wxMM_TEXT works correctly (Derry Bryson)
*** wxWindows 2.2.6 ***
wxGauge now supports wxGA_VERTICAL (Shane Forsythe)
*** 29th January 2001: wxWindows 2.2.5 released ***
Synchronized with wxMSW 2.2.5, include macros
for upwards 2.4.0 compatibility.
Added missing wxEntry prototype to wx/gtk/app.h.
Fixed compilation with --enable-no_rtti/no_exceptions
with older egcs.
*** 15th January 2001: wxWindows 2.2.4 released ***
Corrected wxYield() to handle recursive calls
more gracefully (and with a warning in debug mode).
This fixes a problem with crashing wxTreeCtrl's
built-in drag'n'drop and probably some other as
well.
Corrected wxMenuItem::GetLabel() to handle deliberate '_'
characters correctly.
Patch for better 8-bit-display support.
Corrected log error message box.
Implememted wxCommandEvent::IsSelection() for wxListBox.
Corrected wxListBox::Set() for sorted mode.
Added EVT_TEXT_UPDATED for spin ctrl.
Corrected wrongly rounded value in slider and scrollbar
for negative values.
Small fix for wxTextFile type guessing.
Translation updates.
Various other fixes.
Synchronized release with wxMSW again.
*** 3rd November: wxWindows 2.2.3 released ***
Fixed bugs in HTTP code.
Implemented wxNO_FULL_REPAINT_ON_RESIZE whenever possible
and reduced flicker a little (no longer diables GTK's own
anti-flicker code).
Always have a clipping region equivalent to the update
region in OnPaint events (such as under wxMSW and wxMac).
Implemented wxListBox::SetFirstItem().
Fixed some minor problems in HTML code, wxListCtrl,
wxListBox.
Fixed compilation on RedHat 7.0.
Updated many translations, added Swedish.
Changed default screenpixels-per-inch from 100 to 75 in
printing code.
Updated AFM font metrics for Ghostscript fonts and let
Linux and FreeBSD default to using GS fonts (and not
Adobe fonts).
*** 20th September: wxWindows 2.2.2 released ***
Fixed wxSizer bug that made items with option
flags greater than 1 report a wrong size.
Fixed many incompatibilties with GTK themes -
essentially a backport from the 2.3 branch.
Added missing wxImage::Paste() for transparent
images.
Fixed a drawing error for ellipses and arc in both
the DC code and the PostScript code.
Fixed wxListCtrl::HitTest() for report mode.
Other minor fixes.
*** 20th August 2000: wxWindows 2.2.1 released ***
Minor build fixes.
Use the wxCommmandEvent::IsChecked() function for checkable
menu items. This mean that the m_int parameter no longer
contains the ID of the menu!
Fixed major problems in ODBC logging code. This change is
binary backward incompatible.
Fixed reentry problems in DnD code.
Changed PostScript code so that it can handle a higher
resolution (720dpi).
Minor improvements to wxGrid code.
Corrected guffow-scrolling so that no surplus expose
events are generated.
@@ -12,14 +124,13 @@ Minor correction to wxDC::DrawRoundedRectangle.
Added support for <INSERT> and <DELETE> menu accelerators.
Use the wxCommmandEvent::IsChecked() function for checkable
menu items.
Made wxComboBox case-sensitive.
Minor correction to doc-view architecture.
10th July 2000: wxWindows 2.2.0 released
Minor wxCommandLineParser changes.
*** 10th July 2000: wxWindows 2.2.0 released ***
Added code for writing BMP images.
@@ -50,7 +161,7 @@ Various fixes to the new wxGrid class.
Bug-fixes.
4th June 2000: wxWindows pre-2.2 release
*** 4th June 2000: wxWindows pre-2.2 release ***
Complete freeze now. Only vital bug-fixes allowed.
@@ -62,12 +173,12 @@ Reworked wxURL.
MANY bugfixes.
22th March 2000: wxWindows 2.1.15 released
*** 22th March 2000: wxWindows 2.1.15 released ***
Build fix. RPMs no loner require GTK's include files.
An extra library for the OpenGl class now gets builts
19th March 2000: wxWindows 2.1.14 released
*** 19th March 2000: wxWindows 2.1.14 released ***
An extra library for the OpenGl class now gets builts
and installed. There is also an extra RPM for this
@@ -128,7 +239,7 @@ style when using the default.
The L-GPL iODBC library must now be enables explicitly so as
to not mislead people into reading the license wrong.
24th January '2000: wxWindows 2.1.13 released
*** 24th January '2000: wxWindows 2.1.13 released ***
Corrections to TAB handling in notebooks.
@@ -173,7 +284,7 @@ Updates to the ODBC classes (George Tasker).
Build-fixes for various platforms and compilers.
6th January '2000: wxWindows 2.1.12 released
*** 6th January '2000: wxWindows 2.1.12 released ***
Who has a BigEndian computer (e.g. Sparc or PowerPC) that runs a 15
and/or 16 bit colour mode? I need this for testing purposes, i.e. this
@@ -284,7 +395,7 @@ More minor changes and fixes.
Began work on a new dialog and resource editor (wxDesigner).
7st November '99: wxWindows 2.1.11 released
*** 7st November '99: wxWindows 2.1.11 released ***
There is still an unresolved problem with bitmap to image
conversion on big-endian architectures (such as Solaris),
@@ -704,7 +815,7 @@ Note that the next release might bring about changes to keyboard
handling and scroll event intercepting from wxScrolledWindow.
By and large much of the code has stabilized and won't be much
different in the final wxWindows 2.1 release. Please test as
*** different in the final wxWindows 2.1 release. Please test as ***
much as you can.
The next release will have a new build system.
@@ -831,7 +942,7 @@ gooddies, possibly world domination.
5th March '99: wxWindows 2.0 released
*** 5th March '99: wxWindows 2.0 released ***
This is the final version of wxWindows 2.0 for GTK. The versions for
@@ -840,7 +951,7 @@ site. The Mac version is still under development.
19th February '99: wxWindows 2.0 beta 5
*** 19th February '99: wxWindows 2.0 beta 5 ***
This is the fifth beta release and it contains mostly bug fixes and
@@ -850,7 +961,7 @@ Applied compile fixes for Solaris (different flavours and compilers).
12th February '99: wxWindows 2.0 beta 4
*** 12th February '99: wxWindows 2.0 beta 4 ***
This is the fourth beta release and it contains mostly bug fixes and
@@ -869,7 +980,7 @@ Fixed many bugs. You guessed it.
29th January '99: wxWindows 2.0 beta 3
*** 29th January '99: wxWindows 2.0 beta 3 ***
This is the third beta release and it contains mostly bug fixes.
@@ -910,7 +1021,7 @@ SuSE 6.0 as SuSE decided to ship 6.0 with a broken GTK+ package.
6th January '99: wxWindows 2.0 beta 2
*** 6th January '99: wxWindows 2.0 beta 2 ***
This is the second beta release and contains it mostly build and
@@ -919,7 +1030,7 @@ commercial Unices and Windows.
20th December '98: wxWindows 2.0 beta 1
*** 20th December '98: wxWindows 2.0 beta 1 ***
This is the first beta release and we have used the time before

View File

@@ -38,8 +38,10 @@ wxDC::wxDC()
{
m_ok = FALSE;
m_mm_to_pix_x = 1.0;
m_mm_to_pix_y = 1.0;
m_mm_to_pix_x = (double)wxGetDisplaySize().GetWidth() /
(double)wxGetDisplaySizeMM().GetWidth();
m_mm_to_pix_y = (double)wxGetDisplaySize().GetHeight() /
(double)wxGetDisplaySizeMM().GetHeight();
m_needComputeScaleX = FALSE; /* not used yet */
m_needComputeScaleY = FALSE; /* not used yet */
@@ -74,8 +76,8 @@ void wxDC::DoGetSizeMM( int* width, int* height ) const
int w = 0;
int h = 0;
GetSize( &w, &h );
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) );
if (width) *width = int( double(w) / (m_userScaleX*m_mm_to_pix_x) );
if (height) *height = int( double(h) / (m_userScaleY*m_mm_to_pix_y) );
}
// Resolution in pixels per logical inch

View File

@@ -2041,7 +2041,7 @@ void wxWindowDC::ComputeScaleAndOrigin()
// Resolution in pixels per logical inch
wxSize wxWindowDC::GetPPI() const
{
return wxSize(100, 100);
return wxSize(m_mm_to_pix_x * 25.4 + 0.5, m_mm_to_pix_y * 25.4 + 0.5);
}
int wxWindowDC::GetDepth() const

View File

@@ -38,8 +38,10 @@ wxDC::wxDC()
{
m_ok = FALSE;
m_mm_to_pix_x = 1.0;
m_mm_to_pix_y = 1.0;
m_mm_to_pix_x = (double)wxGetDisplaySize().GetWidth() /
(double)wxGetDisplaySizeMM().GetWidth();
m_mm_to_pix_y = (double)wxGetDisplaySize().GetHeight() /
(double)wxGetDisplaySizeMM().GetHeight();
m_needComputeScaleX = FALSE; /* not used yet */
m_needComputeScaleY = FALSE; /* not used yet */
@@ -74,8 +76,8 @@ void wxDC::DoGetSizeMM( int* width, int* height ) const
int w = 0;
int h = 0;
GetSize( &w, &h );
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) );
if (width) *width = int( double(w) / (m_userScaleX*m_mm_to_pix_x) );
if (height) *height = int( double(h) / (m_userScaleY*m_mm_to_pix_y) );
}
// Resolution in pixels per logical inch

View File

@@ -2041,7 +2041,7 @@ void wxWindowDC::ComputeScaleAndOrigin()
// Resolution in pixels per logical inch
wxSize wxWindowDC::GetPPI() const
{
return wxSize(100, 100);
return wxSize(m_mm_to_pix_x * 25.4 + 0.5, m_mm_to_pix_y * 25.4 + 0.5);
}
int wxWindowDC::GetDepth() const