X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4ed696943fc2e511c0c1d8b77bfdb64e1a457d42..e1379e29e21c7eabf6abf19a1f1f46163251b2a8:/src/gtk/dcclient.cpp diff --git a/src/gtk/dcclient.cpp b/src/gtk/dcclient.cpp index 1fdc8aab53..146afce404 100644 --- a/src/gtk/dcclient.cpp +++ b/src/gtk/dcclient.cpp @@ -324,7 +324,7 @@ wxWindowDC::wxWindowDC( wxWindow *window ) standard (as e.g. wxStatusBar) */ m_owner = window; - + if (m_owner && m_owner->m_wxwindow && (m_owner->GetLayoutDirection() == wxLayout_RightToLeft)) { // reverse sense @@ -391,7 +391,7 @@ void wxWindowDC::SetUpDC() gdk_gc_set_background( m_textGC, m_textBackgroundColour.GetColor() ); gdk_gc_set_fill( m_textGC, GDK_SOLID ); - + gdk_gc_set_colormap( m_textGC, m_cmap ); /* m_penGC */ @@ -862,7 +862,7 @@ void wxWindowDC::DoDrawRectangle( wxCoord x, wxCoord y, wxCoord width, wxCoord h gdk_draw_rectangle( m_window, m_penGC, FALSE, xx, yy, ww-2, hh-2 ); gdk_draw_rectangle( m_window, m_penGC, FALSE, xx-1, yy-1, ww, hh ); } - + // reset gdk_gc_set_line_attributes( m_penGC, 2, GDK_LINE_SOLID, GDK_CAP_ROUND, GDK_JOIN_ROUND ); } @@ -1083,10 +1083,10 @@ void wxWindowDC::DoDrawBitmap( const wxBitmap &bitmap, int w = bitmap.GetWidth(); int h = bitmap.GetHeight(); - + if (m_owner && m_owner->GetLayoutDirection() == wxLayout_RightToLeft) xx -= w; - + CalcBoundingBox( x, y ); CalcBoundingBox( x + w, y + h ); @@ -1219,7 +1219,7 @@ bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest, wxMemoryDC *memDC = wxDynamicCast(source, wxMemoryDC); wxBitmap selected = source->GetSelectedBitmap(); - + bool use_bitmap_method = false; bool is_mono = false; @@ -1230,7 +1230,7 @@ bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest, } if (memDC && !selected.Ok()) return false; - + if (selected.Ok()) { is_mono = (selected.GetDepth() == 1); @@ -1428,7 +1428,7 @@ bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest, GdkWindow* window = source->GetGDKWindow(); if ( !window ) return false; - + // copy including child window contents gdk_gc_set_subwindow( m_penGC, GDK_INCLUDE_INFERIORS ); gdk_draw_drawable( m_window, m_penGC, @@ -1579,7 +1579,7 @@ void wxWindowDC::DoDrawText( const wxString &text, wxCoord x, wxCoord y ) gdk_draw_rectangle(m_window, m_textGC, TRUE, x, y, w, h); gdk_gc_set_foreground(m_textGC, m_textForegroundColour.GetColor()); } - + // Draw layout. if (m_owner && m_owner->GetLayoutDirection() == wxLayout_RightToLeft) gdk_draw_layout( m_window, m_textGC, x-w, y, m_layout ); @@ -1771,7 +1771,7 @@ void wxWindowDC::DoGetTextExtent(const wxString &string, } // Reset old font description - if (theFont) + if (theFont->IsOk()) pango_layout_set_font_description( m_layout, m_fontdesc ); } @@ -1796,7 +1796,7 @@ bool wxWindowDC::DoGetPartialTextExtents(const wxString& text, } pango_layout_set_text( m_layout, dataUTF8, strlen(dataUTF8) ); - + // Calculate the position of each character based on the widths of // the previous characters @@ -1830,7 +1830,12 @@ wxCoord wxWindowDC::GetCharWidth() const wxCoord wxWindowDC::GetCharHeight() const { PangoFontMetrics *metrics = pango_context_get_metrics (m_context, m_fontdesc, pango_context_get_language(m_context)); - return PANGO_PIXELS (pango_font_metrics_get_descent (metrics) + pango_font_metrics_get_ascent (metrics)); + wxCHECK_MSG( metrics, -1, _T("failed to get pango font metrics") ); + + wxCoord h = PANGO_PIXELS (pango_font_metrics_get_descent (metrics) + + pango_font_metrics_get_ascent (metrics)); + pango_font_metrics_unref (metrics); + return h; } void wxWindowDC::Clear() @@ -2368,7 +2373,7 @@ void wxWindowDC::SetDeviceOrigin( wxCoord x, wxCoord y ) { m_deviceOriginX = x; m_deviceOriginY = y; - + ComputeScaleAndOrigin(); } @@ -2376,10 +2381,10 @@ void wxWindowDC::SetAxisOrientation( bool xLeftRight, bool yBottomUp ) { m_signX = (xLeftRight ? 1 : -1); m_signY = (yBottomUp ? -1 : 1); - + if (m_owner && m_owner->m_wxwindow && (m_owner->GetLayoutDirection() == wxLayout_RightToLeft)) - m_signX = -m_signX; - + m_signX = -m_signX; + ComputeScaleAndOrigin(); }