From 6a3a2cd3447c539233053e1693ce4105a6487cf3 Mon Sep 17 00:00:00 2001 From: Hans Breuer Date: Sun, 21 Nov 2004 21:01:28 +0000 Subject: [PATCH] updated 2004-11-21 Hans Breuer * gdk/makefile.msc.in gtk/stock-icons/makefile.msc gtk/makefile.msc.in demos/gtk-demo/makefile.msc.in : updated * gdk/win32/gdkdrawable-win32.c : implement gdk_win32_draw_glyphs_transformed() * gdk/win32/gdkgc-win32.c : implement _gdk_windowing_gc_get_foreground() * demos/gtk-demo/rotated_text.c : use G_PI --- ChangeLog | 10 +++++ ChangeLog.pre-2-10 | 10 +++++ ChangeLog.pre-2-6 | 10 +++++ ChangeLog.pre-2-8 | 10 +++++ demos/gtk-demo/makefile.msc.in | 2 + demos/gtk-demo/rotated_text.c | 2 +- gdk/makefile.msc | 2 +- gdk/win32/gdkdrawable-win32.c | 77 +++++++++++++++++++++++++++++++++- gdk/win32/gdkgc-win32.c | 23 +++++++++- gtk/stock-icons/makefile.msc | 2 + 10 files changed, 144 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 826dbed0ce..e789b4fc17 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2004-11-21 Hans Breuer + + * gdk/makefile.msc.in gtk/stock-icons/makefile.msc + gtk/makefile.msc.in demos/gtk-demo/makefile.msc.in : updated + + * gdk/win32/gdkdrawable-win32.c : implement gdk_win32_draw_glyphs_transformed() + * gdk/win32/gdkgc-win32.c : implement _gdk_windowing_gc_get_foreground() + + * demos/gtk-demo/rotated_text.c : use G_PI + Sat Nov 20 15:13:51 2004 Owen Taylor * gdk/gdkpango.[ch]: Add GdkPangoRenderer, a subclass of diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 826dbed0ce..e789b4fc17 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,13 @@ +2004-11-21 Hans Breuer + + * gdk/makefile.msc.in gtk/stock-icons/makefile.msc + gtk/makefile.msc.in demos/gtk-demo/makefile.msc.in : updated + + * gdk/win32/gdkdrawable-win32.c : implement gdk_win32_draw_glyphs_transformed() + * gdk/win32/gdkgc-win32.c : implement _gdk_windowing_gc_get_foreground() + + * demos/gtk-demo/rotated_text.c : use G_PI + Sat Nov 20 15:13:51 2004 Owen Taylor * gdk/gdkpango.[ch]: Add GdkPangoRenderer, a subclass of diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 826dbed0ce..e789b4fc17 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,13 @@ +2004-11-21 Hans Breuer + + * gdk/makefile.msc.in gtk/stock-icons/makefile.msc + gtk/makefile.msc.in demos/gtk-demo/makefile.msc.in : updated + + * gdk/win32/gdkdrawable-win32.c : implement gdk_win32_draw_glyphs_transformed() + * gdk/win32/gdkgc-win32.c : implement _gdk_windowing_gc_get_foreground() + + * demos/gtk-demo/rotated_text.c : use G_PI + Sat Nov 20 15:13:51 2004 Owen Taylor * gdk/gdkpango.[ch]: Add GdkPangoRenderer, a subclass of diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 826dbed0ce..e789b4fc17 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,13 @@ +2004-11-21 Hans Breuer + + * gdk/makefile.msc.in gtk/stock-icons/makefile.msc + gtk/makefile.msc.in demos/gtk-demo/makefile.msc.in : updated + + * gdk/win32/gdkdrawable-win32.c : implement gdk_win32_draw_glyphs_transformed() + * gdk/win32/gdkgc-win32.c : implement _gdk_windowing_gc_get_foreground() + + * demos/gtk-demo/rotated_text.c : use G_PI + Sat Nov 20 15:13:51 2004 Owen Taylor * gdk/gdkpango.[ch]: Add GdkPangoRenderer, a subclass of diff --git a/demos/gtk-demo/makefile.msc.in b/demos/gtk-demo/makefile.msc.in index 4b83874b00..f4d857c610 100644 --- a/demos/gtk-demo/makefile.msc.in +++ b/demos/gtk-demo/makefile.msc.in @@ -52,6 +52,7 @@ DEMOS = \ menus.c \ panes.c \ pixbufs.c \ + rotated_text.c \ sizegroup.c \ stock_browser.c \ textview.c \ @@ -80,6 +81,7 @@ OBJECTS = \ menus.obj \ panes.obj \ pixbufs.obj \ + rotated_text.obj \ sizegroup.obj \ stock_browser.obj \ textview.obj \ diff --git a/demos/gtk-demo/rotated_text.c b/demos/gtk-demo/rotated_text.c index 1c37548dd2..550101eda4 100644 --- a/demos/gtk-demo/rotated_text.c +++ b/demos/gtk-demo/rotated_text.c @@ -68,7 +68,7 @@ rotated_text_expose_event (GtkWidget *widget, double angle = (360. * i) / N_WORDS; /* Gradient from red at angle == 60 to blue at angle == 300 */ - color.red = 65535 * (1 + cos ((angle - 60) * M_PI / 180.)) / 2; + color.red = 65535 * (1 + cos ((angle - 60) * G_PI / 180.)) / 2; color.green = 0; color.blue = 65535 - color.red; diff --git a/gdk/makefile.msc b/gdk/makefile.msc index ef3cec5278..fee146e148 100644 --- a/gdk/makefile.msc +++ b/gdk/makefile.msc @@ -148,7 +148,7 @@ gdkalias.h: gdk.symbols gdk.def: gdk.symbols echo EXPORTS > gdk.def - cl /EP -DINCLUDE_VARIABLES -DG_OS_WIN32 gdk.symbols >> gdk.def + cl /EP -DINCLUDE_VARIABLES -DG_OS_WIN32 -DGDK_WINDOWING_WIN32 gdk.symbols >> gdk.def libgdk-win32-$(GTK_VER)-0.dll : $(gdk_OBJECTS) gdk.def win32\gdk-win32.lib $(CC) $(CFLAGS) -LD -Fe$@ $(gdk_OBJECTS) win32\gdk-win32.lib $(EXTRALIBS) \ diff --git a/gdk/win32/gdkdrawable-win32.c b/gdk/win32/gdkdrawable-win32.c index bea0b0e909..bdabde0383 100644 --- a/gdk/win32/gdkdrawable-win32.c +++ b/gdk/win32/gdkdrawable-win32.c @@ -1,6 +1,7 @@ /* GDK - The GIMP Drawing Kit * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald - * Copyright (C) 1998-2002 Tor Lillqvist + * Copyright (C) 1998-2004 Tor Lillqvist + * Copyright (C) 2001-2004 Hans Breuer * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -105,6 +106,13 @@ static void gdk_win32_draw_glyphs (GdkDrawable *drawable, gint x, gint y, PangoGlyphString *glyphs); +static void gdk_win32_draw_glyphs_transformed (GdkDrawable *drawable, + GdkGC *gc, + PangoMatrix *matrix, + PangoFont *font, + gint x, + gint y, + PangoGlyphString *glyphs); static void gdk_win32_draw_image (GdkDrawable *drawable, GdkGC *gc, GdkImage *image, @@ -181,6 +189,7 @@ gdk_drawable_impl_win32_class_init (GdkDrawableImplWin32Class *klass) drawable_class->draw_segments = gdk_win32_draw_segments; drawable_class->draw_lines = gdk_win32_draw_lines; drawable_class->draw_glyphs = gdk_win32_draw_glyphs; + drawable_class->draw_glyphs_transformed = gdk_win32_draw_glyphs_transformed; drawable_class->draw_image = gdk_win32_draw_image; drawable_class->set_colormap = gdk_win32_set_colormap; @@ -1439,6 +1448,31 @@ draw_glyphs (GdkGCWin32 *gcwin32, pango_win32_render (hdc, font, glyphs, x, y); } +static void +draw_glyphs_transformed (GdkGCWin32 *gcwin32, + HDC hdc, + gint x_offset, + gint y_offset, + va_list args) +{ + PangoFont *font; + gint x; + gint y; + PangoGlyphString *glyphs; + PangoMatrix *matrix; + + matrix = va_arg(args, PangoMatrix *); + font = va_arg (args, PangoFont *); + x = va_arg (args, gint); + y = va_arg (args, gint); + glyphs = va_arg (args, PangoGlyphString *); + + x -= x_offset; + y -= y_offset; + + pango_win32_render_transformed (hdc, matrix, font, glyphs, x, y); +} + static void gdk_win32_draw_glyphs (GdkDrawable *drawable, GdkGC *gc, @@ -1465,6 +1499,47 @@ gdk_win32_draw_glyphs (GdkDrawable *drawable, gdk_region_destroy (region); } +static void +gdk_win32_draw_glyphs_transformed (GdkDrawable *drawable, + GdkGC *gc, + PangoMatrix *matrix, + PangoFont *font, + gint x, + gint y, + PangoGlyphString *glyphs) +{ + GdkRectangle bounds; + GdkRegion *region; + PangoRectangle ink_rect; + + pango_glyph_string_extents (glyphs, font, &ink_rect, NULL); + + bounds.x = x + PANGO_PIXELS (ink_rect.x) - 1; + bounds.y = y + PANGO_PIXELS (ink_rect.y) - 1; + bounds.width = PANGO_PIXELS (ink_rect.width) + 2; + bounds.height = PANGO_PIXELS (ink_rect.height) + 2; + region = gdk_region_rectangle (&bounds); + + if (matrix) + { + /* transform region */ + bounds.x = bounds.x * matrix->xx + bounds.y * matrix->xy + matrix->x0; + bounds.y = bounds.x * matrix->yx + bounds.y * matrix->yy + matrix->x0; + bounds.width = bounds.width * matrix->xx + bounds.height * matrix->xy; + bounds.height = bounds.height * matrix->yx + bounds.width * matrix->xy; + + generic_draw (drawable, gc, GDK_GC_FOREGROUND|GDK_GC_FONT, + draw_glyphs_transformed, region, matrix, font, x, y, glyphs); + } + else + { + generic_draw (drawable, gc, GDK_GC_FOREGROUND|GDK_GC_FONT, + draw_glyphs, region, font, x/PANGO_SCALE, y/PANGO_SCALE, glyphs); + } + + gdk_region_destroy (region); +} + static void blit_from_pixmap (gboolean use_fg_bg, GdkDrawableImplWin32 *dest, diff --git a/gdk/win32/gdkgc-win32.c b/gdk/win32/gdkgc-win32.c index ed652ea1c0..49beed4569 100644 --- a/gdk/win32/gdkgc-win32.c +++ b/gdk/win32/gdkgc-win32.c @@ -1,6 +1,7 @@ /* GDK - The GIMP Drawing Kit * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald - * Copyright (C) 1998-2002 Tor Lillqvist + * Copyright (C) 1998-2004 Tor Lillqvist + * Copyright (C) 2000-2004 Hans Breuer * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -1259,3 +1260,23 @@ _gdk_win32_gdkregion_to_hrgn (GdkRegion *region, return (hrgn); } + +void +_gdk_windowing_gc_get_foreground (GdkGC *gc, + GdkColor *color) +{ + GdkGCWin32 *win32_gc; + GdkColormap *cmap; + + g_return_if_fail (GDK_IS_GC_WIN32 (gc)); + + win32_gc = GDK_GC_WIN32 (gc); + + color->pixel = win32_gc->foreground; + cmap = gdk_gc_get_colormap (gc); + + if (cmap) + gdk_colormap_query_color (cmap, win32_gc->foreground, color); + else + g_warning ("No colormap in _gdk_windowing_gc_get_foreground"); +} diff --git a/gtk/stock-icons/makefile.msc b/gtk/stock-icons/makefile.msc index 5b4a3288f1..a78166afb0 100644 --- a/gtk/stock-icons/makefile.msc +++ b/gtk/stock-icons/makefile.msc @@ -84,6 +84,8 @@ VARIABLES = \ stock_media_pause_24 stock_media_pause_24.png \ stock_media_play_16 stock_media_play_16.png \ stock_media_play_24 stock_media_play_24.png \ + stock_media_play_rtl_16 stock_media_play_rtl_16.png \ + stock_media_play_rtl_24 stock_media_play_rtl_24.png \ stock_media_previous_16 stock_media_previous_16.png \ stock_media_previous_24 stock_media_previous_24.png \ stock_media_record_16 stock_media_record_16.png \