From 0455fa3029a4744fa40ab58bf4f837bfa1890509 Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Mon, 16 Aug 1999 04:45:01 +0000 Subject: [PATCH] Fix start and end radial endpoint calculations which were totally wrong. * gdk/win32/gdkdraw.c (gdk_draw_arc): Fix start and end radial endpoint calculations which were totally wrong. (A little RTFMing helps a lot ;-) * gtk/makefile.{cygwin,msc}: Use libintl extracted from glibc from a separate directory, not from gettext, because of licensing issues (we want to use the LGPL version). * README.win32: Mention the intl from glibc vs from gettext issue. --- ChangeLog | 12 ++++++++++ ChangeLog.pre-2-0 | 12 ++++++++++ ChangeLog.pre-2-10 | 12 ++++++++++ ChangeLog.pre-2-2 | 12 ++++++++++ ChangeLog.pre-2-4 | 12 ++++++++++ ChangeLog.pre-2-6 | 12 ++++++++++ ChangeLog.pre-2-8 | 12 ++++++++++ README.win32 | 18 ++++++++------- gdk/win32/gdkdraw.c | 41 +++++++++++++++++++++++++++++------ gdk/win32/gdkdrawable-win32.c | 41 +++++++++++++++++++++++++++++------ gtk/makefile.cygwin | 6 ++--- gtk/makefile.msc | 6 ++--- 12 files changed, 168 insertions(+), 28 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4f28d8b08..eeac15447 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +1999-08-16 Tor Lillqvist + + * gdk/win32/gdkdraw.c (gdk_draw_arc): Fix start and end radial + endpoint calculations which were totally wrong. (A little RTFMing + helps a lot ;-) + + * gtk/makefile.{cygwin,msc}: Use libintl extracted from glibc + from a separate directory, not from gettext, because of licensing + issues (we want to use the LGPL version). + + * README.win32: Mention the intl from glibc vs from gettext issue. + 1999-08-13 Tor Lillqvist * gdk/win32/gdkevents.c (gdk_event_translate): Fix a couple of bugs diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index 4f28d8b08..eeac15447 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,15 @@ +1999-08-16 Tor Lillqvist + + * gdk/win32/gdkdraw.c (gdk_draw_arc): Fix start and end radial + endpoint calculations which were totally wrong. (A little RTFMing + helps a lot ;-) + + * gtk/makefile.{cygwin,msc}: Use libintl extracted from glibc + from a separate directory, not from gettext, because of licensing + issues (we want to use the LGPL version). + + * README.win32: Mention the intl from glibc vs from gettext issue. + 1999-08-13 Tor Lillqvist * gdk/win32/gdkevents.c (gdk_event_translate): Fix a couple of bugs diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 4f28d8b08..eeac15447 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,15 @@ +1999-08-16 Tor Lillqvist + + * gdk/win32/gdkdraw.c (gdk_draw_arc): Fix start and end radial + endpoint calculations which were totally wrong. (A little RTFMing + helps a lot ;-) + + * gtk/makefile.{cygwin,msc}: Use libintl extracted from glibc + from a separate directory, not from gettext, because of licensing + issues (we want to use the LGPL version). + + * README.win32: Mention the intl from glibc vs from gettext issue. + 1999-08-13 Tor Lillqvist * gdk/win32/gdkevents.c (gdk_event_translate): Fix a couple of bugs diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index 4f28d8b08..eeac15447 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,15 @@ +1999-08-16 Tor Lillqvist + + * gdk/win32/gdkdraw.c (gdk_draw_arc): Fix start and end radial + endpoint calculations which were totally wrong. (A little RTFMing + helps a lot ;-) + + * gtk/makefile.{cygwin,msc}: Use libintl extracted from glibc + from a separate directory, not from gettext, because of licensing + issues (we want to use the LGPL version). + + * README.win32: Mention the intl from glibc vs from gettext issue. + 1999-08-13 Tor Lillqvist * gdk/win32/gdkevents.c (gdk_event_translate): Fix a couple of bugs diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 4f28d8b08..eeac15447 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,15 @@ +1999-08-16 Tor Lillqvist + + * gdk/win32/gdkdraw.c (gdk_draw_arc): Fix start and end radial + endpoint calculations which were totally wrong. (A little RTFMing + helps a lot ;-) + + * gtk/makefile.{cygwin,msc}: Use libintl extracted from glibc + from a separate directory, not from gettext, because of licensing + issues (we want to use the LGPL version). + + * README.win32: Mention the intl from glibc vs from gettext issue. + 1999-08-13 Tor Lillqvist * gdk/win32/gdkevents.c (gdk_event_translate): Fix a couple of bugs diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 4f28d8b08..eeac15447 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,15 @@ +1999-08-16 Tor Lillqvist + + * gdk/win32/gdkdraw.c (gdk_draw_arc): Fix start and end radial + endpoint calculations which were totally wrong. (A little RTFMing + helps a lot ;-) + + * gtk/makefile.{cygwin,msc}: Use libintl extracted from glibc + from a separate directory, not from gettext, because of licensing + issues (we want to use the LGPL version). + + * README.win32: Mention the intl from glibc vs from gettext issue. + 1999-08-13 Tor Lillqvist * gdk/win32/gdkevents.c (gdk_event_translate): Fix a couple of bugs diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 4f28d8b08..eeac15447 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,15 @@ +1999-08-16 Tor Lillqvist + + * gdk/win32/gdkdraw.c (gdk_draw_arc): Fix start and end radial + endpoint calculations which were totally wrong. (A little RTFMing + helps a lot ;-) + + * gtk/makefile.{cygwin,msc}: Use libintl extracted from glibc + from a separate directory, not from gettext, because of licensing + issues (we want to use the LGPL version). + + * README.win32: Mention the intl from glibc vs from gettext issue. + 1999-08-13 Tor Lillqvist * gdk/win32/gdkevents.c (gdk_event_translate): Fix a couple of bugs diff --git a/README.win32 b/README.win32 index fe7ac8a72..e085036c7 100644 --- a/README.win32 +++ b/README.win32 @@ -17,13 +17,15 @@ The tablet support uses the Wintab API. The Wintab development kit can be downloaded from http://www.pointing.com. If you don't care for that, undefine HAVE_WINTAB in config.h.win32 before building. -GTk+ wants to be built with the GNU gettext library for +GTk+ wants to be built with the GNU "intl" library for internationalisation (i18n). Get the version ported to Win32 (not a -very big deal) from tml's web site mentioned above. If you don't want -any i18n stuff, undefine ENABLE_NLS, HAVE_GETTEXT and HAVE_LIBINTL in -the config.h.win32 file, and remove references to the gnu-intl library -from the makefiles. +very big deal) from tml's web site mentioned above. We build the +"intl" library to a DLL called gnu-intl.dll to reduce name clash +risks. If you don't want any i18n stuff, undefine ENABLE_NLS, +HAVE_GETTEXT and HAVE_LIBINTL in the config.h.win32 file, and remove +references to the gnu-intl library from the makefiles. -Note that GNU gettext is under the GPL, not the LGPL like GTk+ or -GLib. So, if GPL is a problem to you, follow the above advice to -remove the use of gettext. +Note that while the GNU gettext package is under the GPL, the "intl" +library part as distributed with GNU libc is under the LGPL (like GTk+ +or GLib). We want the LGPL one, even if they are the same, more or +less. diff --git a/gdk/win32/gdkdraw.c b/gdk/win32/gdkdraw.c index 6acf1e488..8cc0c4b7c 100644 --- a/gdk/win32/gdkdraw.c +++ b/gdk/win32/gdkdraw.c @@ -30,8 +30,8 @@ #include #include "gdkprivate.h" -#ifndef M_TWOPI -#define M_TWOPI (2.0 * 3.14159265358979323846) +#ifndef G_PI +#define G_PI 3.14159265358979323846 #endif void @@ -203,22 +203,49 @@ gdk_draw_arc (GdkDrawable *drawable, if (height == -1) height = drawable_private->height; - if (width != 0 && height != 0) + GDK_NOTE (MISC, g_print ("gdk_draw_arc: %#x %d,%d,%d,%d %d %d\n", + drawable_private->xwindow, + x, y, width, height, angle1, angle2)); + + if (width != 0 && height != 0 && angle2 != 0) { hdc = gdk_gc_predraw (drawable_private, gc_private); - nXStartArc = x + width/2 + (int) (sin(angle1/64.*M_TWOPI)*width); - nYStartArc = y + height/2 + (int) (cos(angle1/64.*M_TWOPI)*height); - nXEndArc = x + width/2 + (int) (sin(angle2/64.*M_TWOPI)*width); - nYEndArc = y + height/2 + (int) (cos(angle2/64.*M_TWOPI)*height); + if (angle2 >= 360*64) + { + nXStartArc = nYStartArc = nXEndArc = nYEndArc = 0; + } + else if (angle2 > 0) + { + /* The 100. is just an arbitrary value */ + nXStartArc = x + width/2 + 100. * cos(angle1/64.*2.*G_PI/360.); + nYStartArc = y + height/2 + -100. * sin(angle1/64.*2.*G_PI/360.); + nXEndArc = x + width/2 + 100. * cos((angle1+angle2)/64.*2.*G_PI/360.); + nYEndArc = y + height/2 + -100. * sin((angle1+angle2)/64.*2.*G_PI/360.); + } + else + { + nXEndArc = x + width/2 + 100. * cos(angle1/64.*2.*G_PI/360.); + nYEndArc = y + height/2 + -100. * sin(angle1/64.*2.*G_PI/360.); + nXStartArc = x + width/2 + 100. * cos((angle1+angle2)/64.*2.*G_PI/360.); + nYStartArc = y + height/2 + -100. * sin((angle1+angle2)/64.*2.*G_PI/360.); + } if (filled) { + GDK_NOTE (MISC, g_print ("...Pie(hdc,%d,%d,%d,%d,%d,%d,%d,%d)\n", + x, y, x+width, y+height, + nXStartArc, nYStartArc, + nXEndArc, nYEndArc)); Pie (hdc, x, y, x+width, y+height, nXStartArc, nYStartArc, nXEndArc, nYEndArc); } else { + GDK_NOTE (MISC, g_print ("...Arc(hdc,%d,%d,%d,%d,%d,%d,%d,%d)\n", + x, y, x+width, y+height, + nXStartArc, nYStartArc, + nXEndArc, nYEndArc)); Arc (hdc, x, y, x+width, y+height, nXStartArc, nYStartArc, nXEndArc, nYEndArc); } diff --git a/gdk/win32/gdkdrawable-win32.c b/gdk/win32/gdkdrawable-win32.c index 6acf1e488..8cc0c4b7c 100644 --- a/gdk/win32/gdkdrawable-win32.c +++ b/gdk/win32/gdkdrawable-win32.c @@ -30,8 +30,8 @@ #include #include "gdkprivate.h" -#ifndef M_TWOPI -#define M_TWOPI (2.0 * 3.14159265358979323846) +#ifndef G_PI +#define G_PI 3.14159265358979323846 #endif void @@ -203,22 +203,49 @@ gdk_draw_arc (GdkDrawable *drawable, if (height == -1) height = drawable_private->height; - if (width != 0 && height != 0) + GDK_NOTE (MISC, g_print ("gdk_draw_arc: %#x %d,%d,%d,%d %d %d\n", + drawable_private->xwindow, + x, y, width, height, angle1, angle2)); + + if (width != 0 && height != 0 && angle2 != 0) { hdc = gdk_gc_predraw (drawable_private, gc_private); - nXStartArc = x + width/2 + (int) (sin(angle1/64.*M_TWOPI)*width); - nYStartArc = y + height/2 + (int) (cos(angle1/64.*M_TWOPI)*height); - nXEndArc = x + width/2 + (int) (sin(angle2/64.*M_TWOPI)*width); - nYEndArc = y + height/2 + (int) (cos(angle2/64.*M_TWOPI)*height); + if (angle2 >= 360*64) + { + nXStartArc = nYStartArc = nXEndArc = nYEndArc = 0; + } + else if (angle2 > 0) + { + /* The 100. is just an arbitrary value */ + nXStartArc = x + width/2 + 100. * cos(angle1/64.*2.*G_PI/360.); + nYStartArc = y + height/2 + -100. * sin(angle1/64.*2.*G_PI/360.); + nXEndArc = x + width/2 + 100. * cos((angle1+angle2)/64.*2.*G_PI/360.); + nYEndArc = y + height/2 + -100. * sin((angle1+angle2)/64.*2.*G_PI/360.); + } + else + { + nXEndArc = x + width/2 + 100. * cos(angle1/64.*2.*G_PI/360.); + nYEndArc = y + height/2 + -100. * sin(angle1/64.*2.*G_PI/360.); + nXStartArc = x + width/2 + 100. * cos((angle1+angle2)/64.*2.*G_PI/360.); + nYStartArc = y + height/2 + -100. * sin((angle1+angle2)/64.*2.*G_PI/360.); + } if (filled) { + GDK_NOTE (MISC, g_print ("...Pie(hdc,%d,%d,%d,%d,%d,%d,%d,%d)\n", + x, y, x+width, y+height, + nXStartArc, nYStartArc, + nXEndArc, nYEndArc)); Pie (hdc, x, y, x+width, y+height, nXStartArc, nYStartArc, nXEndArc, nYEndArc); } else { + GDK_NOTE (MISC, g_print ("...Arc(hdc,%d,%d,%d,%d,%d,%d,%d,%d)\n", + x, y, x+width, y+height, + nXStartArc, nYStartArc, + nXEndArc, nYEndArc)); Arc (hdc, x, y, x+width, y+height, nXStartArc, nYStartArc, nXEndArc, nYEndArc); } diff --git a/gtk/makefile.cygwin b/gtk/makefile.cygwin index be2a52e9f..a104d62ea 100644 --- a/gtk/makefile.cygwin +++ b/gtk/makefile.cygwin @@ -32,9 +32,9 @@ GTK_VER=1.3 GDKSYSDEP = ../gdk/win32 GLIB = ../../glib -GETTEXT = ../../gettext-0.10.35 +INTL = ../../intl -CFLAGS = $(OPTIMIZE) -I . -I .. -I $(GDKSYSDEP) -I $(GLIB) -I $(GLIB)/gmodule -I $(GETTEXT)/intl -DGTK_DISABLE_COMPAT_H +CFLAGS = $(OPTIMIZE) -I . -I .. -I $(GDKSYSDEP) -I $(GLIB) -I $(GLIB)/gmodule -I $(INTL) -DGTK_DISABLE_COMPAT_H all : \ ../config.h \ @@ -320,7 +320,7 @@ gtkmarshal.h gtkmarshal.c : gtkmarshal.list genmarshal.pl # Linking: # gtk-$(GTK_VER).dll : generated $(gtk_OBJECTS) gtk.def - $(GLIB)/build-dll gtk $(GTK_VER) gtk.def $(gtk_OBJECTS) -L $(GDKSYSDEP) -lgdk-$(GTK_VER) -L$(GETTEXT)/intl -lgnu-intl -L $(GLIB) -lglib-$(GLIB_VER) -lgmodule-$(GLIB_VER) -lgdi32 -luser32 + $(GLIB)/build-dll gtk $(GTK_VER) gtk.def $(gtk_OBJECTS) -L $(GDKSYSDEP) -lgdk-$(GTK_VER) -L$(INTL) -lgnu-intl -L $(GLIB) -lglib-$(GLIB_VER) -lgmodule-$(GLIB_VER) -lgdi32 -luser32 # General rule for compiling the objects into the DLL .c.o : diff --git a/gtk/makefile.msc b/gtk/makefile.msc index d4a0f9a88..349c0d7b4 100755 --- a/gtk/makefile.msc +++ b/gtk/makefile.msc @@ -44,9 +44,9 @@ GTK_VER=1.3 GDKSYSDEP = ..\gdk\win32 GLIB = ..\..\glib -GETTEXT = ..\..\gettext-0.10.35 +INTL = ..\..\gettext-0.10.35 -CFLAGS = -I. -I.. -I$(GDKSYSDEP) -I$(GLIB) -I$(GLIB)\gmodule -I$(GETTEXT)\intl -DGTK_DISABLE_COMPAT_H +CFLAGS = -I. -I.. -I$(GDKSYSDEP) -I$(GLIB) -I$(GLIB)\gmodule -I$(INTL) -DGTK_DISABLE_COMPAT_H all : \ ..\config.h \ @@ -333,7 +333,7 @@ gtkmarshal.h gtkmarshal.c : gtkmarshal.list genmarshal.pl # Linking: # gtk-$(GTK_VER).dll : $(gtk_OBJECTS) gtk.def - $(CC) $(CFLAGS) -LD -Fegtk-$(GTK_VER).dll $(gtk_OBJECTS) $(GDKSYSDEP)\gdk-$(GTK_VER).lib $(GETTEXT)\intl\gnu-intl.lib $(GLIB)\glib-$(GLIB_VER).lib $(GLIB)\gmodule-$(GLIB_VER).lib gdi32.lib user32.lib $(LDFLAGS) /def:gtk.def + $(CC) $(CFLAGS) -LD -Fegtk-$(GTK_VER).dll $(gtk_OBJECTS) $(GDKSYSDEP)\gdk-$(GTK_VER).lib $(INTL)\gnu-intl.lib $(GLIB)\glib-$(GLIB_VER).lib $(GLIB)\gmodule-$(GLIB_VER).lib gdi32.lib user32.lib $(LDFLAGS) /def:gtk.def # General rule for compiling the objects into the DLL .c.obj : -- 2.43.2