diff --git a/docs/changes.txt b/docs/changes.txt index 32a891b08b..3bd0aada82 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -37,6 +37,9 @@ Changes in behaviour which may result in build errors 3.1.0: (released 2014-xx-xx) ---------------------------- +- Many improvements for high DPI monitors support, notably XRC now interprets + all pixel values as being in resolution-independent pixels. + - wxQt branch implementing Qt5-based port of wxWidgets API was merged into the trunk (Mariano Reingart, Google Summer of Code project). diff --git a/docs/doxygen/overviews/xrc_format.h b/docs/doxygen/overviews/xrc_format.h index 6e4c3d75b7..8786732bad 100644 --- a/docs/doxygen/overviews/xrc_format.h +++ b/docs/doxygen/overviews/xrc_format.h @@ -246,8 +246,10 @@ Some examples: @subsection overview_xrcformat_type_size Size -Sizes and positions have the form of string with two comma-separated integer -components, with optional "d" suffix. Semi-formally: +Sizes and positions can be expressed in either @ref wxWindow::FromDIP() +"DPI-independent pixel values" or in @ref wxWindow::ConvertDialogToPixels() +"dialog units". The former is the default, to use the latter "d" suffix can be +added. Semi-formally the format is: size := x "," y ["d"] @@ -255,9 +257,6 @@ where x and y are integers. Either of the components (or both) may be "-1" to signify default value. As a shortcut, empty string is equivalent to "-1,-1" (= wxDefaultSize or wxDefaultPosition). -When the "d" suffix is used, integer values are interpreted as -@ref wxWindow::ConvertDialogToPixels() "dialog units" in the parent window. - Examples: @code 42,-1 @@ -274,7 +273,8 @@ Same as @ref overview_xrcformat_type_size. Similarly to @ref overview_xrcformat_type_size "sizes", dimensions are expressed as integers with optional "d" suffix. When "d" suffix is used, the integer -preceding it is interpreted as dialog units in the parent window. +preceding it is interpreted as dialog units in the parent window, otherwise +it's a DPI-independent pixel value. @subsection overview_xrcformat_type_text Text diff --git a/src/xrc/xmlres.cpp b/src/xrc/xmlres.cpp index 88b280025c..b4044336c3 100644 --- a/src/xrc/xmlres.cpp +++ b/src/xrc/xmlres.cpp @@ -2125,11 +2125,11 @@ ParseValueInPixels(wxXmlResourceHandlerImpl* impl, return defaultValue; } + if ( !windowToUse ) + windowToUse = impl->GetParentAsWindow(); + if ( inDLU ) { - if ( !windowToUse ) - windowToUse = impl->GetParentAsWindow(); - if ( !windowToUse ) { impl->ReportParamError @@ -2143,6 +2143,10 @@ ParseValueInPixels(wxXmlResourceHandlerImpl* impl, XRCConvertFromDLU(windowToUse, value); } + else // The value is in resolution-independent pixels. + { + value = wxWindow::FromDIP(value, windowToUse); + } return value; }