Patches to ee
- From: Neil Vachharajani <nvachhar pluto njcc com>
- To: gnome-list gnome org
- Subject: Patches to ee
- Date: Mon, 13 Jul 1998 23:55:11 -0400 (EDT)
I have made several changes to electric eyes to fix some bugs I noticed.
The majority of the changes deal with the aspect ratio resizing and the
other major change is fixing some problems with the pop up menu.
I have attached a patch to this message. In addition to applying the
patch it will be necessary to create a file called topic.dat in the
gnome-graphics/ee/doc directory. I have also attached that file to this
message.
I know this patch is probably going to be a pain to apply, so if there are
any problems let me know. Also, I will be more than happy to commit the
changes if I could have access to the CVS archive.
-------------------------------------------------------------------------------
Neil Vachharajani
nvachhar@pluto.njcc.com
? ee/doc/topic.dat
Index: ee/edit.c
===================================================================
RCS file: /cvs/gnome/gnome-graphics/ee/edit.c,v
retrieving revision 1.7
diff -u -r1.7 edit.c
--- edit.c 1998/06/11 23:12:39 1.7
+++ edit.c 1998/07/10 07:13:22
@@ -905,30 +905,48 @@
void force_aspect_from_w()
{
- int w,h,ww;
+ int dw,w,ww;
w=(int)GTK_ADJUSTMENT(width_adj)->value;
- h=(int)GTK_ADJUSTMENT(height_adj)->value;
-
- ww=(w*current.image->rgb_height)/current.image->rgb_width;
+ dw=w - current.image->rgb_width;
+
+ ww=(dw*current.image->rgb_height)/current.image->rgb_width + current.image->rgb_height;
+
+ correcting_aspect=1;
+#ifdef 1
+ gtk_spin_button_spin(GTK_SPIN_BUTTON(height_wid),GTK_SPIN_USER_DEFINED,(gfloat)
+ (ww-gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(height_wid))));
+#else
gtk_spin_button_spin(GTK_SPIN_BUTTON(height_wid),1,(gfloat)
(gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(height_wid))-
ww));
+#endif
+ correcting_aspect=0;
+
gtk_widget_queue_draw(GTK_WIDGET(height_wid));
mod_height=1;
}
void force_aspect_from_h()
{
- int w,h,hh;
+ int dh,h,hh;
- w=(int)GTK_ADJUSTMENT(width_adj)->value;
h=(int)GTK_ADJUSTMENT(height_adj)->value;
+ dh = h - current.image->rgb_height;
- hh=(h*current.image->rgb_width)/current.image->rgb_height;
+ hh=(dh*current.image->rgb_width)/current.image->rgb_height + current.image->rgb_width;
+
+ correcting_aspect=1;
+#ifdef 1
+ gtk_spin_button_spin(GTK_SPIN_BUTTON(width_wid),GTK_SPIN_USER_DEFINED,(gfloat)
+ (hh-gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(width_wid))));
+#else
gtk_spin_button_spin(GTK_SPIN_BUTTON(width_wid),1,(gfloat)
(gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(width_wid))-
hh));
+#endif
+ correcting_aspect=0;
+
gtk_widget_queue_draw(GTK_WIDGET(width_wid));
mod_width=1;
}
@@ -940,7 +958,7 @@
mod_height=0;
return;
}
- if (fixed_aspect) force_aspect_from_w();
+ if (fixed_aspect && !correcting_aspect) force_aspect_from_w();
}
void mod_height_cb(GtkWidget *widget, void *data)
@@ -950,7 +968,7 @@
mod_width=0;
return;
}
- if (fixed_aspect) force_aspect_from_h();
+ if (fixed_aspect && !correcting_aspect) force_aspect_from_h();
}
void toggle_fixed_cb(GtkWidget *widget, void *data)
@@ -958,8 +976,8 @@
if (fixed_aspect) fixed_aspect=0;
else
{
- force_aspect_from_w();
- fixed_aspect=1;
+ force_aspect_from_w();
+ fixed_aspect=1;
}
}
Index: ee/ee.h
===================================================================
RCS file: /cvs/gnome/gnome-graphics/ee/ee.h,v
retrieving revision 1.7
diff -u -r1.7 ee.h
--- ee.h 1998/06/14 15:13:12 1.7
+++ ee.h 1998/07/10 07:13:22
@@ -189,6 +189,7 @@
extern int num_categories;
extern char **categories;
extern char fixed_aspect;
+extern char correcting_aspect;
extern GtkObject *width_adj,*height_adj;
extern GtkWidget *width_wid,*height_wid;
extern GtkObject *cropx_adj,*cropy_adj,*cropw_adj,*croph_adj;
Index: ee/globals.c
===================================================================
RCS file: /cvs/gnome/gnome-graphics/ee/globals.c,v
retrieving revision 1.5
diff -u -r1.5 globals.c
--- globals.c 1998/06/11 23:12:42 1.5
+++ globals.c 1998/07/10 07:13:22
@@ -46,6 +46,7 @@
int num_categories;
char **categories;
char fixed_aspect=0;
+char correcting_aspect=0;
GtkObject *width_adj,*height_adj;
GtkWidget *width_wid,*height_wid;
GtkObject *cropx_adj,*cropy_adj,*cropw_adj,*croph_adj;
Index: ee/image.c
===================================================================
RCS file: /cvs/gnome/gnome-graphics/ee/image.c,v
retrieving revision 1.14
diff -u -r1.14 image.c
--- image.c 1998/06/10 04:16:43 1.14
+++ image.c 1998/07/10 07:13:26
@@ -6,6 +6,14 @@
#include "ee.h"
#include "stdimg.xpm"
+static GnomeUIInfo menu6[]=
+{
+ GNOMEUIINFO_ITEM_STOCK(N_("About"), N_("Info about this program"), about_image_cb, GNOME_STOCK_MENU_ABOUT),
+ GNOMEUIINFO_SEPARATOR,
+ GNOMEUIINFO_HELP("ee"),
+ GNOMEUIINFO_END
+};
+
static GnomeUIInfo menu5[]=
{
GNOMEUIINFO_ITEM_NONE(N_("Original size"),N_("Scale this image to it's original size"),handle_image_resize_original),
@@ -30,42 +38,23 @@
static GnomeUIInfo menu3[]=
{
- { GNOME_APP_UI_ITEM,N_("Open"),N_("Open up a new image file and add it to the image list"),image_open,NULL,
- NULL,GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_OPEN,
- 0,0,NULL
- },
- { GNOME_APP_UI_ITEM,N_("Save"),N_("Save this image"),image_save,NULL,
- NULL,GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_SAVE,
- 0,0,NULL
- },
- { GNOME_APP_UI_ITEM,N_("Save As"),N_("Save this image as a new file"),image_save_as,NULL,
- NULL,GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_SAVE_AS,
- 0,0,NULL
- },
+ GNOMEUIINFO_ITEM_STOCK(N_("Open"),N_("Open up a new image file and add it to the image list"),image_open,
+ GNOME_STOCK_MENU_OPEN),
+ GNOMEUIINFO_ITEM_STOCK(N_("Save"),N_("Save this image"),image_save,GNOME_STOCK_MENU_SAVE),
+ GNOMEUIINFO_ITEM_STOCK(N_("Save As"),N_("Save this image as a new file"),image_save_as,GNOME_STOCK_MENU_SAVE_AS),
GNOMEUIINFO_SEPARATOR,
- { GNOME_APP_UI_ITEM,N_("Next Image"),N_("Display the next image in the image list"),handle_image_next,NULL,
- NULL,GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_FORWARD,
- 0,0,NULL
- },
- { GNOME_APP_UI_ITEM,N_("Previous Image"),N_("Display the previous image in the image list"),handle_image_previous,NULL,
- NULL,GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_BACK,
- 0,0,NULL
- },
- { GNOME_APP_UI_ITEM,N_("Start Slideshow"),N_("Start an automated slideshow of all the images in the image list"),start_slideshow,NULL,
- NULL,GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_ABOUT,
- 0,0,NULL
- },
- { GNOME_APP_UI_ITEM,N_("Stop Slideshow"),N_("Start an automated slideshow of all the images in the image list"),stop_slideshow,NULL,
- NULL,GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_ABOUT,
- 0,0,NULL
- },
+ GNOMEUIINFO_ITEM_STOCK(N_("Next Image"),N_("Display the next image in the image list"),handle_image_next,
+ GNOME_STOCK_MENU_FORWARD),
+ GNOMEUIINFO_ITEM_STOCK(N_("Previous Image"),N_("Display the previous image in the image list"),handle_image_previous,
+ GNOME_STOCK_MENU_BACK),
+ GNOMEUIINFO_ITEM_STOCK(N_("Start Slideshow"),N_("Start an automated slideshow of all the images in the image list"),
+ start_slideshow,GNOME_STOCK_MENU_ABOUT),
+ GNOMEUIINFO_ITEM_STOCK(N_("Stop Slideshow"),N_("Start an automated slideshow of all the images in the image list"),
+ stop_slideshow,GNOME_STOCK_MENU_ABOUT),
GNOMEUIINFO_SEPARATOR,
GNOMEUIINFO_ITEM_STOCK(N_("Print"),N_("Print this Image"),print_image,GNOME_STOCK_MENU_BLANK),
GNOMEUIINFO_SEPARATOR,
- { GNOME_APP_UI_ITEM,N_("Quit"),N_("Exit this program"),quit_image_cb,NULL,
- NULL,GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_QUIT,
- 0,0,NULL
- },
+ GNOMEUIINFO_ITEM_STOCK(N_("Quit"),N_("Exit this program"),quit_image_cb, GNOME_STOCK_MENU_QUIT),
GNOMEUIINFO_END
};
@@ -75,25 +64,12 @@
GNOMEUIINFO_SUBTREE(N_("Edit"),menu4),
GNOMEUIINFO_SUBTREE(N_("Image"),menu5),
GNOMEUIINFO_SEPARATOR,
- { GNOME_APP_UI_ITEM,N_("Preferences"),N_("Change your user preferences for this program"),show_config,NULL,
- NULL,GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_PREF,
- 0,0,NULL
- },
- GNOMEUIINFO_HELP("ElectricEyes"),
- { GNOME_APP_UI_ITEM,N_("About"),N_("Info about this program"),about_image_cb,NULL,
- NULL,GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_ABOUT,
- 0,0,NULL
- },
- GNOMEUIINFO_HELP("ElectricEyes"),
- { GNOME_APP_UI_ITEM,N_("Help"),N_("Help on this program"),about_image_help_cb,NULL,
- NULL,GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_ABOUT,
- 0,0,NULL
- },
+ GNOMEUIINFO_ITEM_STOCK(N_("Preferences"), N_("Change your user preferences for this program"), show_config,
+ GNOME_STOCK_MENU_PREF),
+
+ GNOMEUIINFO_SUBTREE(N_("Help"), menu6),
GNOMEUIINFO_SEPARATOR,
- { GNOME_APP_UI_ITEM,N_("Quit"),N_("Exit this program"),quit_image_cb,NULL,
- NULL,GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_QUIT,
- 0,0,NULL
- },
+ GNOMEUIINFO_ITEM_STOCK(N_("Quit"),N_("Exit this program"),quit_image_cb, GNOME_STOCK_MENU_QUIT),
GNOMEUIINFO_END
};
@@ -318,6 +294,23 @@
void handle_image_resize_original(GtkWidget *widget, GdkEventConfigure *event)
{
if (!current.image) return;
+
+#ifdef 1
+ gtk_spin_button_spin(GTK_SPIN_BUTTON(height_wid),GTK_SPIN_USER_DEFINED,(gfloat)
+ (current.image->rgb_height -
+ gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(height_wid))));
+ gtk_spin_button_spin(GTK_SPIN_BUTTON(width_wid),GTK_SPIN_USER_DEFINED,(gfloat)
+ (current.image->rgb_width -
+ gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(width_wid))));
+#else
+ gtk_spin_button_spin(GTK_SPIN_BUTTON(height_wid),0,(gfloat)
+ (current.image->rgb_height -
+ gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(height_wid))));
+ gtk_spin_button_spin(GTK_SPIN_BUTTON(width_wid),0,(gfloat)
+ (current.image->rgb_width -
+ gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(width_wid))));
+#endif
+
gtk_widget_set_usize(window_image,current.image->rgb_width,current.image->rgb_height);
}
Index: ee/doc/Makefile.am
===================================================================
RCS file: /cvs/gnome/gnome-graphics/ee/doc/Makefile.am,v
retrieving revision 1.1
diff -u -r1.1 Makefile.am
--- Makefile.am 1998/04/10 15:56:32 1.1
+++ Makefile.am 1998/07/10 07:13:26
@@ -1,6 +1,6 @@
helpdir = $(datadir)/gnome/help/ee/C
-docfiles = index.html ee.png colors.png editwin.png geom.png list.png \
+docfiles = topic.dat index.html ee.png colors.png editwin.png geom.png list.png \
thumbs.png view.png
EXTRA_DIST = $(docfiles)
index.html Manual
index.html#License License
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]