Minor corrections.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@19178 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling
2003-02-11 11:20:45 +00:00
parent 1a55595e69
commit 6185050104
5 changed files with 23 additions and 21 deletions

View File

@@ -1427,23 +1427,21 @@ void wxWindowDC::DoDrawText( const wxString &text, wxCoord x, wxCoord y )
wxCHECK_RET( font, wxT("invalid font") ); wxCHECK_RET( font, wxT("invalid font") );
#endif #endif
x = XLOG2DEV(x); x = XLOG2DEV(x);
y = YLOG2DEV(y); y = YLOG2DEV(y);
#ifdef __WXGTK20__ #ifdef __WXGTK20__
wxCHECK_RET( m_context, wxT("no Pango context") ); wxCHECK_RET( m_context, wxT("no Pango context") );
wxCHECK_RET( m_layout, wxT("o Pango layout") ); wxCHECK_RET( m_layout, wxT("no Pango layout") );
wxCHECK_RET( m_fontdesc, wxT("no Pango font description") ); wxCHECK_RET( m_fontdesc, wxT("no Pango font description") );
#if wxUSE_UNICODE #if wxUSE_UNICODE
const wxCharBuffer data = wxConvUTF8.cWC2MB( text ); const wxCharBuffer data = wxConvUTF8.cWC2MB( text );
pango_layout_set_text( m_layout, (const char*) data, strlen( (const char*) data ));
#else #else
const wxWCharBuffer wdata = wxConvLocal.cMB2WC( text ); const wxWCharBuffer wdata = wxConvLocal.cMB2WC( text );
const wxCharBuffer data = wxConvUTF8.cWC2MB( wdata ); const wxCharBuffer data = wxConvUTF8.cWC2MB( wdata );
pango_layout_set_text( m_layout, (const char*) data, strlen( (const char*) data ));
#endif #endif
pango_layout_set_text( m_layout, (const char*) data, strlen( (const char*) data ));
if (m_scaleY != 1.0) if (m_scaleY != 1.0)
{ {
@@ -1465,7 +1463,7 @@ void wxWindowDC::DoDrawText( const wxString &text, wxCoord x, wxCoord y )
// reset unscaled size // reset unscaled size
pango_font_description_set_size( m_fontdesc, oldSize ); pango_font_description_set_size( m_fontdesc, oldSize );
// actually apply scaled font // actually apply unscaled font
pango_layout_set_font_description( m_layout, m_fontdesc ); pango_layout_set_font_description( m_layout, m_fontdesc );
} }
else else
@@ -1474,9 +1472,15 @@ void wxWindowDC::DoDrawText( const wxString &text, wxCoord x, wxCoord y )
gdk_draw_layout( m_window, m_textGC, x, y, m_layout ); gdk_draw_layout( m_window, m_textGC, x, y, m_layout );
} }
// Measure layout. #if 0
// Measure layout
int w,h; int w,h;
pango_layout_get_pixel_size( m_layout, &w, &h ); pango_layout_get_pixel_size( m_layout, &w, &h );
#else
int w = 10;
int h = 10;
#endif
wxCoord width = w; wxCoord width = w;
wxCoord height = h; wxCoord height = h;

View File

@@ -66,7 +66,6 @@ void wxToolTip::Apply( wxWindow *win )
ss_bg.blue = 50000; ss_bg.blue = 50000;
gdk_color_alloc( gtk_widget_get_default_colormap(), &ss_bg ); gdk_color_alloc( gtk_widget_get_default_colormap(), &ss_bg );
#if GTK_CHECK_VERSION(1, 2, 0)
gtk_tooltips_force_window( ss_tooltips ); gtk_tooltips_force_window( ss_tooltips );
GtkStyle *g_style = GtkStyle *g_style =
@@ -77,9 +76,6 @@ void wxToolTip::Apply( wxWindow *win )
g_style->bg[GTK_STATE_NORMAL] = ss_bg; g_style->bg[GTK_STATE_NORMAL] = ss_bg;
gtk_widget_set_style( ss_tooltips->tip_window, g_style ); gtk_widget_set_style( ss_tooltips->tip_window, g_style );
#else // GTK+ 1.0
gtk_tooltips_set_colors( ss_tooltips, &ss_bg, &ss_fg );
#endif
} }
m_window = win; m_window = win;

View File

@@ -1427,23 +1427,21 @@ void wxWindowDC::DoDrawText( const wxString &text, wxCoord x, wxCoord y )
wxCHECK_RET( font, wxT("invalid font") ); wxCHECK_RET( font, wxT("invalid font") );
#endif #endif
x = XLOG2DEV(x); x = XLOG2DEV(x);
y = YLOG2DEV(y); y = YLOG2DEV(y);
#ifdef __WXGTK20__ #ifdef __WXGTK20__
wxCHECK_RET( m_context, wxT("no Pango context") ); wxCHECK_RET( m_context, wxT("no Pango context") );
wxCHECK_RET( m_layout, wxT("o Pango layout") ); wxCHECK_RET( m_layout, wxT("no Pango layout") );
wxCHECK_RET( m_fontdesc, wxT("no Pango font description") ); wxCHECK_RET( m_fontdesc, wxT("no Pango font description") );
#if wxUSE_UNICODE #if wxUSE_UNICODE
const wxCharBuffer data = wxConvUTF8.cWC2MB( text ); const wxCharBuffer data = wxConvUTF8.cWC2MB( text );
pango_layout_set_text( m_layout, (const char*) data, strlen( (const char*) data ));
#else #else
const wxWCharBuffer wdata = wxConvLocal.cMB2WC( text ); const wxWCharBuffer wdata = wxConvLocal.cMB2WC( text );
const wxCharBuffer data = wxConvUTF8.cWC2MB( wdata ); const wxCharBuffer data = wxConvUTF8.cWC2MB( wdata );
pango_layout_set_text( m_layout, (const char*) data, strlen( (const char*) data ));
#endif #endif
pango_layout_set_text( m_layout, (const char*) data, strlen( (const char*) data ));
if (m_scaleY != 1.0) if (m_scaleY != 1.0)
{ {
@@ -1465,7 +1463,7 @@ void wxWindowDC::DoDrawText( const wxString &text, wxCoord x, wxCoord y )
// reset unscaled size // reset unscaled size
pango_font_description_set_size( m_fontdesc, oldSize ); pango_font_description_set_size( m_fontdesc, oldSize );
// actually apply scaled font // actually apply unscaled font
pango_layout_set_font_description( m_layout, m_fontdesc ); pango_layout_set_font_description( m_layout, m_fontdesc );
} }
else else
@@ -1474,9 +1472,15 @@ void wxWindowDC::DoDrawText( const wxString &text, wxCoord x, wxCoord y )
gdk_draw_layout( m_window, m_textGC, x, y, m_layout ); gdk_draw_layout( m_window, m_textGC, x, y, m_layout );
} }
// Measure layout. #if 0
// Measure layout
int w,h; int w,h;
pango_layout_get_pixel_size( m_layout, &w, &h ); pango_layout_get_pixel_size( m_layout, &w, &h );
#else
int w = 10;
int h = 10;
#endif
wxCoord width = w; wxCoord width = w;
wxCoord height = h; wxCoord height = h;

View File

@@ -66,7 +66,6 @@ void wxToolTip::Apply( wxWindow *win )
ss_bg.blue = 50000; ss_bg.blue = 50000;
gdk_color_alloc( gtk_widget_get_default_colormap(), &ss_bg ); gdk_color_alloc( gtk_widget_get_default_colormap(), &ss_bg );
#if GTK_CHECK_VERSION(1, 2, 0)
gtk_tooltips_force_window( ss_tooltips ); gtk_tooltips_force_window( ss_tooltips );
GtkStyle *g_style = GtkStyle *g_style =
@@ -77,9 +76,6 @@ void wxToolTip::Apply( wxWindow *win )
g_style->bg[GTK_STATE_NORMAL] = ss_bg; g_style->bg[GTK_STATE_NORMAL] = ss_bg;
gtk_widget_set_style( ss_tooltips->tip_window, g_style ); gtk_widget_set_style( ss_tooltips->tip_window, g_style );
#else // GTK+ 1.0
gtk_tooltips_set_colors( ss_tooltips, &ss_bg, &ss_fg );
#endif
} }
m_window = win; m_window = win;

View File

@@ -144,7 +144,9 @@ bool wxNativeFontInfo::FromString(const wxString& s)
wxString wxNativeFontInfo::ToString() const wxString wxNativeFontInfo::ToString() const
{ {
wxString tmp = wxGTK_CONV_BACK( pango_font_description_to_string( description ) ); char *str = pango_font_description_to_string( description );
wxString tmp = wxGTK_CONV_BACK( str );
g_free( str );
return tmp; return tmp;
} }