[SCM] Rasmol packaging branch, master, updated. debian/2.7.4.2-5-53-gbfb75e3
Teemu Ikonen
tpikonen at gmail.com
Sun Nov 20 21:01:26 UTC 2011
The following commit has been merged in the master branch:
commit 10ba91777faa218c46ace45c6411aac3fcf09cd1
Author: Teemu Ikonen <tpikonen at gmail.com>
Date: Fri Nov 18 17:29:11 2011 +0100
Add generated patch files in debian/patches.
diff --git a/debian/patches/01_gtkabout.patch b/debian/patches/01_gtkabout.patch
new file mode 100644
index 0000000..1df5e9a
--- /dev/null
+++ b/debian/patches/01_gtkabout.patch
@@ -0,0 +1,22 @@
+From: Teemu Ikonen <tpikonen at gmail.com>
+Subject: Fix icon in GTK About dialog.
+X-git-branch: p/gtkabout
+
+Fix icon in GTK About dialog.
+
+ src/gtkwin.c | 2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+diff --git a/src/gtkwin.c b/src/gtkwin.c
+index f5b70ac..828a94a 100755
+--- a/src/gtkwin.c
++++ b/src/gtkwin.c
+@@ -833,7 +833,7 @@ Roger Sayle 1992-1999\n\
+ Herbert J. Bernstein 1998-2008\n\
+ ",
+ "license", "GPL",
+- "logo-icon-name", "/usr/share/pixmaps/rasmol.xpm",
++ "logo-icon-name", "rasmol",
+ "version", VERSION,
+ "website", "http://rasmol.org/",
+ NULL);
diff --git a/debian/patches/02_imakefile.patch b/debian/patches/02_imakefile.patch
new file mode 100644
index 0000000..5e10edf
--- /dev/null
+++ b/debian/patches/02_imakefile.patch
@@ -0,0 +1,82 @@
+From: Teemu Ikonen <tpikonen at gmail.com>
+Subject: Debian changes to Imakefile.
+X-git-branch: p/imakefile
+
+ src/Imakefile | 28 ++++++++++++++--------------
+ 1 files changed, 14 insertions(+), 14 deletions(-)
+
+diff --git a/src/Imakefile b/src/Imakefile
+index b5a88dd..83dddea 100755
+--- a/src/Imakefile
++++ b/src/Imakefile
+@@ -1,8 +1,8 @@
+-#define CBFLIB_LOCAL
+-#define CQRLIB_LOCAL
+-#define CVECTOR_LOCAL
+-#define NEARTREE_LOCAL
+-#define XFORMSLIB_LOCAL
++# #define CBFLIB_LOCAL
++# #define CQRLIB_LOCAL
++# #define CVECTOR_LOCAL
++# #define NEARTREE_LOCAL
++# #define XFORMSLIB_LOCAL
+ ###########################################################################
+ # RasMol 2.7.5 #
+ # #
+@@ -124,7 +124,7 @@ DEPTHDEF = -DTHIRTYTWOBIT
+ LOCALEDEF =
+ #endif
+
+-PKGDIR = $(HOME)
++PKGDIR = /usr
+
+ #ifndef GTKWIN
+ #define X11WIN
+@@ -197,7 +197,7 @@ CBFLIB_OBJDEP = $(CBFLIB_DIR)/lib/libcbf.a
+ ifeq ($(strip $(CBFLIB_DIR)),)
+ CBFLIB_DIR = $(PKGDIR)
+ endif
+-CBFLIB_INCLUDE_DIR = $(CBFLIB_DIR)/include/cbflib
++CBFLIB_INCLUDE_DIR = $(CBFLIB_DIR)/include/cbf
+ CBFLIB_LDLIB = -L$(CBFLIB_DIR)/lib -lcbf
+ CBFLIB_OBJDEP =
+ #define NO_CBFLIB_BUILD
+@@ -276,7 +276,7 @@ NEARTREE_OBJDEP =
+
+ # RasMol's on-line help direcory
+ # e.g. /usr/local/lib/rasmol/rasmol.hlp
+-RASMOLDIR = $(USRLIBDIR)/rasmol/
++RASMOLDIR = /usr/share/rasmol/
+
+
+ #ifndef USE_XFORMSLIB
+@@ -332,23 +332,23 @@ LDLIBS = -lm -lXi $(XLIB) $(EXTRA_LIBRARIES) $(XFORMSLIB) $(GTKLIBS) \
+ #
+
+ #ifdef HPArchitecture
+-CCOPTIONS = -Ae
+-CDEBUGFLAGS = +O2 +Onolimit
++#CCOPTIONS = -Ae
++#CDEBUGFLAGS = -O2 # -Onolimit
+
+ #ifdef HPUX_PARISC_32
+-CCOPTIONS = -Ae +DA2.0 +DS2.0
++#CCOPTIONS = -Ae -DA2.0 -DS2.0
+ #endif
+
+ #ifdef HPUX_PARISC_64
+-CCOPTIONS = -Ae +DA2.0W +DS2.0 -D_LONGLONG
++#CCOPTIONS = -Ae -DA2.0W -DS2.0 -D_LONGLONG
+ #endif
+
+ #ifdef HPUX_IA64_32
+-CCOPTIONS = -Ae +DD32 +DSmckinley
++#CCOPTIONS = -Ae -DD32 -DSmckinley
+ #endif
+
+ #ifdef HPUX_IA64_64
+-CCOPTIONS = -Ae +DD64 +DSmckinley -D_LONGLONG
++#CCOPTIONS = -Ae -DD64 -DSmckinley -D_LONGLONG
+ #endif
+ #endif
+
diff --git a/debian/patches/03_intwidth.patch b/debian/patches/03_intwidth.patch
new file mode 100644
index 0000000..817d740
--- /dev/null
+++ b/debian/patches/03_intwidth.patch
@@ -0,0 +1,56 @@
+From: Teemu Ikonen <tpikonen at gmail.com>
+Subject: rasmol.h: Use C99 exact-width ints in typedefs.
+X-git-branch: p/intwidth
+
+ src/rasmol.h | 18 ++++++++----------
+ 1 files changed, 8 insertions(+), 10 deletions(-)
+
+diff --git a/src/rasmol.h b/src/rasmol.h
+index 94e3640..b6cde5e 100755
+--- a/src/rasmol.h
++++ b/src/rasmol.h
+@@ -78,6 +78,7 @@
+ /* rasmol.h
+ */
+
++#include <stdint.h>
+
+ /*===========================*/
+ /* User Definable Options! */
+@@ -202,7 +203,7 @@
+
+ typedef double Real;
+ #ifndef APPLEMAC
+-typedef unsigned char Byte;
++typedef uint8_t Byte;
+ #endif
+
+ #ifdef __STDC__
+@@ -211,21 +212,18 @@ typedef signed char Char;
+ typedef char Char;
+ #endif
+
+-#ifdef _LONGLONG
+-typedef unsigned int Card;
+-typedef int Long;
+-#else
+-typedef unsigned long Card;
++typedef uint32_t Card;
++/* Long has to be defined as long, instead of int32_t because of
++ multiple printf and scanf calls using %ld in the format. */
+ typedef long Long;
+-#endif
+
+ #ifdef EIGHTBIT
+-typedef unsigned char Pixel;
++typedef uint8_t Pixel;
+ #else
+ #ifdef THIRTYTWOBIT
+-typedef Long Pixel;
++typedef int32_t Pixel;
+ #else
+-typedef short Pixel;
++typedef int16_t Pixel;
+ #endif
+ #endif
+
diff --git a/debian/patches/04_spinbuttons.patch b/debian/patches/04_spinbuttons.patch
new file mode 100644
index 0000000..6be3437
--- /dev/null
+++ b/debian/patches/04_spinbuttons.patch
@@ -0,0 +1,120 @@
+From: Teemu Ikonen <tpikonen at gmail.com>
+Subject: Set zero page size to GtkSpinButtons in export dialog.
+X-git-branch: p/spinbuttons
+
+ Fixes deprecation warning from GTK.
+
+ Also re-save the sizechooser.glade file in glade, causing
+ some reordering in the XML file.
+
+
+ src/sizechooser.glade | 29 +++++++++++++++++++----------
+ 1 files changed, 19 insertions(+), 10 deletions(-)
+
+diff --git a/src/sizechooser.glade b/src/sizechooser.glade
+index 77b3d99..da8bdbe 100644
+--- a/src/sizechooser.glade
++++ b/src/sizechooser.glade
+@@ -1,7 +1,7 @@
+-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+-<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
+-<!--Generated with glade3 3.2.2 on Wed Sep 19 00:07:16 2007 by tpikonen at slobo-->
++<?xml version="1.0"?>
+ <glade-interface>
++ <!-- interface-requires gtk+ 2.6 -->
++ <!-- interface-naming-policy toplevel-contextual -->
+ <widget class="GtkWindow" id="window1">
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <child>
+@@ -15,20 +15,25 @@
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <child>
+ <widget class="GtkRadioButton" id="size_current">
++ <property name="label" translatable="yes">Current size</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
++ <property name="receives_default">False</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+- <property name="label" translatable="yes">Current size</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">True</property>
+ </widget>
++ <packing>
++ <property name="position">0</property>
++ </packing>
+ </child>
+ <child>
+ <widget class="GtkRadioButton" id="size_640">
++ <property name="label" translatable="yes">640 x 480</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
++ <property name="receives_default">False</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+- <property name="label" translatable="yes">640 x 480</property>
+ <property name="draw_indicator">True</property>
+ <property name="group">size_current</property>
+ <signal name="toggled" handler="size_toggled"/>
+@@ -39,10 +44,11 @@
+ </child>
+ <child>
+ <widget class="GtkRadioButton" id="size_1024">
++ <property name="label" translatable="yes">1024 x 768</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
++ <property name="receives_default">False</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+- <property name="label" translatable="yes">1024 x 768</property>
+ <property name="draw_indicator">True</property>
+ <property name="group">size_current</property>
+ </widget>
+@@ -52,10 +58,11 @@
+ </child>
+ <child>
+ <widget class="GtkRadioButton" id="size_1600">
++ <property name="label" translatable="yes">1600 x 1200</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
++ <property name="receives_default">False</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+- <property name="label" translatable="yes">1600 x 1200</property>
+ <property name="draw_indicator">True</property>
+ <property name="group">size_current</property>
+ </widget>
+@@ -69,16 +76,18 @@
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <child>
+ <widget class="GtkRadioButton" id="size_custom">
++ <property name="label" translatable="yes">Custom: </property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
++ <property name="receives_default">False</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+- <property name="label" translatable="yes">Custom: </property>
+ <property name="draw_indicator">True</property>
+ <property name="group">size_current</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
++ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+@@ -87,7 +96,7 @@
+ <property name="can_focus">True</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="max_length">5</property>
+- <property name="adjustment">1920 1 65536 1 100 10</property>
++ <property name="adjustment">1920 1 65536 1 100 0</property>
+ <property name="snap_to_ticks">True</property>
+ <property name="numeric">True</property>
+ <signal name="value_changed" handler="sizespin_cb"/>
+@@ -114,7 +123,7 @@
+ <property name="can_focus">True</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="max_length">5</property>
+- <property name="adjustment">1440 1 65536 1 100 10</property>
++ <property name="adjustment">1440 1 65536 1 100 0</property>
+ <property name="numeric">True</property>
+ <signal name="value_changed" handler="sizespin_cb"/>
+ </widget>
diff --git a/debian/patches/05_gtkexport.patch b/debian/patches/05_gtkexport.patch
new file mode 100644
index 0000000..b0187db
--- /dev/null
+++ b/debian/patches/05_gtkexport.patch
@@ -0,0 +1,491 @@
+From: Teemu Ikonen <tpikonen at gmail.com>
+Subject: Fix segfault in image export with GTK.
+X-git-branch: p/gtkexport
+
+ File->Export segfaulted when the exported image size was different
+ from the image buffer size currently on the screen.
+
+ The fix is to not try to render to user supplied buffer in
+ render_buffer(), but to copy FBuffer to the supplied buffer after
+ resizing.
+
+ Also fixed the temporary image buffer allocation in export_cb() to use
+ sizeof(Pixel) instead of 4.
+
+ Also, replace int with uintptr_t when casting pointers to ints.
+
+ src/gtkwin.c | 425 +++++++++++++++++++++++++++++++---------------------------
+ 1 files changed, 226 insertions(+), 199 deletions(-)
+
+diff --git a/src/gtkwin.c b/src/gtkwin.c
+index f5b70ac..2a324b3 100755
+--- a/src/gtkwin.c
++++ b/src/gtkwin.c
+@@ -155,7 +155,7 @@ enum {
+ RES_150,
+ RES_300
+ };
+-int print_resolution = RES_CURRENT;
++uintptr_t print_resolution = RES_CURRENT;
+ GtkPrintSettings *print_settings = NULL;
+ GtkPageSetup *print_pagesetup = NULL;
+
+@@ -392,109 +392,116 @@ void save_cb(GtkAction *action, gpointer user_data)
+ gtk_widget_destroy (dialog);
+ }
+
++
+ /* Render the current image to a given memory buffer with a given size */
+-void render_buffer(Pixel *buf, int xsize, int ysize)
+-{
+- Pixel *old_fbuffer;
+- int old_xrange, old_yrange, old_hrange, old_wrange, old_range, old_interactive, dx;
+-
+- old_fbuffer = FBuffer;
+- old_xrange = XRange;
+- old_yrange = YRange;
+- FBuffer = buf;
+- XRange = xsize;
+- YRange = ysize;
+-
+- if( (dx = XRange%4) )
+- XRange += 4-dx;
+-
+- old_hrange = HRange;
+- old_wrange = WRange;
+- old_range = Range;
+- HRange = YRange>>1;
+- WRange = XRange>>1;
+- Range = MinFun(XRange,YRange);
+-
+- ReDrawFlag |= RFReSize;
+- old_interactive = Interactive;
+- Interactive = False;
+- RefreshScreen(); // *buf now contains the image
+- Interactive = old_interactive;
+-
+- FBuffer = old_fbuffer;
+- XRange = old_xrange;
+- YRange = old_yrange;
+- HRange = old_hrange;
+- WRange = old_wrange;
+- Range = old_range;
+-
+- ReDrawFlag |= RFReSize;
+- RefreshScreen();
+- ReDrawFlag = NextReDrawFlag;
++void render_buffer(Pixel * buf, int xsize, int ysize)
++{
++ int old_xrange, old_yrange, old_hrange, old_wrange, old_range,
++ old_interactive, dx;
++
++ old_xrange = XRange;
++ old_yrange = YRange;
++ XRange = xsize;
++ YRange = ysize;
++ if ((dx = XRange % 4))
++ XRange += 4 - dx;
++
++ old_hrange = HRange;
++ old_wrange = WRange;
++ old_range = Range;
++ HRange = YRange >> 1;
++ WRange = XRange >> 1;
++ Range = MinFun(XRange, YRange);
++
++ ReDrawFlag |= RFReSize;
++ old_interactive = Interactive;
++ Interactive = False;
++ RefreshScreen(); // FBuffer now contains the image
++ memcpy(buf, FBuffer, sizeof(Pixel) * xsize * ysize);
++
++ Interactive = old_interactive;
++
++ XRange = old_xrange;
++ YRange = old_yrange;
++ HRange = old_hrange;
++ WRange = old_wrange;
++ Range = old_range;
++
++ ReDrawFlag |= RFReSize;
++ RefreshScreen();
++ ReDrawFlag = NextReDrawFlag;
+ }
+
++
+ gboolean sizespin_cb(GtkSpinButton button, gpointer data)
+ {
+- GtkLabel *header = NULL;
+- char header_str[128];
+-
+- if(gtk_toggle_button_get_active(
+- GTK_TOGGLE_BUTTON(gtk_builder_get_object(sizebuilder, "size_custom"))))
+- {
+- export_x = gtk_spin_button_get_value_as_int(
+- GTK_SPIN_BUTTON(gtk_builder_get_object(sizebuilder, "custom_x")));
+- export_y = gtk_spin_button_get_value_as_int(
+- GTK_SPIN_BUTTON(gtk_builder_get_object(sizebuilder, "custom_y")));
+-
+- header = GTK_LABEL(gtk_builder_get_object(sizebuilder, "size_header"));
+- snprintf(header_str, 127, "Size: %d x %d", export_x, export_y);
+- gtk_label_set_text(header, header_str);
+- }
+-
+- return FALSE;
++ GtkLabel *header = NULL;
++ char header_str[128];
++
++ if (gtk_toggle_button_get_active
++ (GTK_TOGGLE_BUTTON
++ (gtk_builder_get_object(sizebuilder, "size_custom")))) {
++ export_x =
++ gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON
++ (gtk_builder_get_object
++ (sizebuilder, "custom_x")));
++ export_y =
++ gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON
++ (gtk_builder_get_object
++ (sizebuilder, "custom_y")));
++
++ header = GTK_LABEL(gtk_builder_get_object(sizebuilder, "size_header"));
++ snprintf(header_str, 127, "Size: %d x %d", export_x, export_y);
++ gtk_label_set_text(header, header_str);
++ }
++
++ return FALSE;
+ }
+
+-gboolean sizeradio_cb(GtkButton *button, gpointer data)
++
++gboolean sizeradio_cb(GtkButton * button, gpointer data)
+ {
+- int radioid;
+- GtkLabel *header = NULL;
+- char header_str[128];
+-
+- radioid = (int) data;
+-
+- export_x = XRange;
+- export_y = YRange;
+-
+- switch(radioid) {
+- case RADIO_CURRENT:
+- break;
+- case RADIO_640:
+- export_x = 640;
+- export_y = 480;
+- break;
+- case RADIO_1024:
+- export_x = 1024;
+- export_y = 768;
+- break;
+- case RADIO_1600:
+- export_x = 1600;
+- export_y = 1200;
+- break;
+- case RADIO_CUSTOM:
+- export_x = gtk_spin_button_get_value_as_int(
+- GTK_SPIN_BUTTON(gtk_builder_get_object(sizebuilder, "custom_x")));
+- export_y = gtk_spin_button_get_value_as_int(
+- GTK_SPIN_BUTTON(gtk_builder_get_object(sizebuilder, "custom_y")));
+- break;
+- default:
+- ;
+- }
+-
+- header = GTK_LABEL(gtk_builder_get_object(sizebuilder, "size_header"));
+- snprintf(header_str, 127, "Size: %d x %d", export_x, export_y);
+- gtk_label_set_text(header, header_str);
+-
+- return FALSE;
++ GtkLabel *header = NULL;
++ char header_str[128];
++ uintptr_t radioid = (uintptr_t) data;
++
++ export_x = XRange;
++ export_y = YRange;
++
++ switch (radioid) {
++ case RADIO_CURRENT:
++ break;
++ case RADIO_640:
++ export_x = 640;
++ export_y = 480;
++ break;
++ case RADIO_1024:
++ export_x = 1024;
++ export_y = 768;
++ break;
++ case RADIO_1600:
++ export_x = 1600;
++ export_y = 1200;
++ break;
++ case RADIO_CUSTOM:
++ export_x =
++ gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON
++ (gtk_builder_get_object
++ (sizebuilder, "custom_x")));
++ export_y =
++ gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON
++ (gtk_builder_get_object
++ (sizebuilder, "custom_y")));
++ break;
++ default:
++ ;
++ }
++
++ header = GTK_LABEL(gtk_builder_get_object(sizebuilder, "size_header"));
++ snprintf(header_str, 127, "Size: %d x %d", export_x, export_y);
++ gtk_label_set_text(header, header_str);
++
++ return FALSE;
+ }
+
+
+@@ -560,101 +567,117 @@ void build_exportdialog(void)
+
+ }
+
+-void export_cb(GtkAction *action, gpointer user_data)
++
++void export_cb(GtkAction * action, gpointer user_data)
+ {
+- static char *fname = NULL;
++ static char *fname = NULL;
+
+- if(!exportdialog) {
+- build_exportdialog();
+- }
+- if(fname) {
+- gtk_file_chooser_set_filename(GTK_FILE_CHOOSER (exportdialog), fname);
+- gtk_file_chooser_unselect_all(GTK_FILE_CHOOSER (exportdialog));
+- }
+- if(gtk_toggle_button_get_active(
+- GTK_TOGGLE_BUTTON(gtk_builder_get_object(sizebuilder, "size_current"))))
+- {
+- GtkLabel *header = NULL;
+- char header_str[128];
+-
+- export_x = XRange;
+- export_y = YRange;
+- header = GTK_LABEL(gtk_builder_get_object(sizebuilder, "size_header"));
+- snprintf(header_str, 127, "Size: %d x %d", export_x, export_y);
+- gtk_label_set_text(header, header_str);
+- }
+- while(TRUE) {
+- GtkWidget *question;
+- GdkPixbuf *pbuf;
+- GError *err = NULL;
+- gboolean success = TRUE;
+- guint format = 0;
+- gchar *formatname = NULL;
+- GSList *tmplist = NULL;
+- guchar *tmpbuf;
+-
+- if (gtk_dialog_run (GTK_DIALOG (exportdialog)) != GTK_RESPONSE_ACCEPT) {
+- break;
+- }
+-
+- if(fname) {
+- g_free (fname);
+- }
+- fname = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (exportdialog));
+- if(g_file_test(fname, G_FILE_TEST_EXISTS)) {
+- gint resp;
+- question = gtk_message_dialog_new(GTK_WINDOW(exportdialog),
+- GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
+- GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO,
+- "A file named \"%s\" already exists. Do you want to replace it?",
+- fname);
+- resp = gtk_dialog_run(GTK_DIALOG(question));
+- gtk_widget_destroy (question);
+- if(resp != GTK_RESPONSE_YES) {
+- continue;
+- }
+- }
+-
+- format = egg_file_format_chooser_get_format (
+- EGG_FILE_FORMAT_CHOOSER(format_chooser), fname);
+- if(!format) {
+- char *tmp;
+- question = gtk_message_dialog_new(GTK_WINDOW(exportdialog),
+- GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
+- GTK_MESSAGE_WARNING, GTK_BUTTONS_OK,
+- "Could not recognise format of output file \"%s\", please choose another format.",
+- ((tmp = rindex(fname, '/')) != NULL) ? (tmp+1) : (fname));
+- gtk_dialog_run(GTK_DIALOG(question));
+- gtk_widget_destroy (question);
+- continue;
+- }
+- formatname = (gchar *) egg_file_format_chooser_get_format_data(
+- EGG_FILE_FORMAT_CHOOSER(format_chooser), format);
+-
+- tmpbuf = g_new(guchar, 4*export_x*export_y);
+- render_buffer((Pixel *) tmpbuf, export_x, export_y);
+- pbuf = gdk_pixbuf_new_from_data(tmpbuf,
+- GDK_COLORSPACE_RGB,
+- TRUE, 8,
+- export_x, export_y, 4*export_x,
+- NULL, NULL);
+- success = gdk_pixbuf_save(pbuf, fname, formatname, &err, NULL);
+-
+- if(!success && (err != NULL) ) {
+- question = gtk_message_dialog_new(GTK_WINDOW(exportdialog),
+- GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
+- GTK_MESSAGE_WARNING, GTK_BUTTONS_OK, "Error saving image: %s",
+- err->message);
+- gtk_dialog_run(GTK_DIALOG(question));
+- gtk_widget_destroy (question);
+- }
+- g_object_unref(pbuf);
+- g_free(tmpbuf);
+- break;
+- }
+- gtk_widget_hide (exportdialog);
++ if (!exportdialog) {
++ build_exportdialog();
++ }
++ if (fname) {
++ gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(exportdialog), fname);
++ gtk_file_chooser_unselect_all(GTK_FILE_CHOOSER(exportdialog));
++ }
++ if (gtk_toggle_button_get_active
++ (GTK_TOGGLE_BUTTON
++ (gtk_builder_get_object(sizebuilder, "size_current")))) {
++ GtkLabel *header = NULL;
++ char header_str[128];
++
++ export_x = XRange;
++ export_y = YRange;
++ header = GTK_LABEL(gtk_builder_get_object(sizebuilder, "size_header"));
++ snprintf(header_str, 127, "Size: %d x %d", export_x, export_y);
++ gtk_label_set_text(header, header_str);
++ }
++ while (TRUE) {
++ GtkWidget *question;
++ GdkPixbuf *pbuf;
++ GError *err = NULL;
++ gboolean success = TRUE;
++ guint format = 0;
++ gchar *formatname = NULL;
++ GSList *tmplist = NULL;
++ Pixel *tmpbuf;
++
++ if (gtk_dialog_run(GTK_DIALOG(exportdialog)) != GTK_RESPONSE_ACCEPT) {
++ break;
++ }
++
++ if (fname) {
++ g_free(fname);
++ }
++ fname = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(exportdialog));
++ if (g_file_test(fname, G_FILE_TEST_EXISTS)) {
++ gint resp;
++ question = gtk_message_dialog_new(GTK_WINDOW(exportdialog),
++ GTK_DIALOG_MODAL |
++ GTK_DIALOG_DESTROY_WITH_PARENT,
++ GTK_MESSAGE_QUESTION,
++ GTK_BUTTONS_YES_NO,
++ "A file named \"%s\" already exists. Do you want to replace it?",
++ fname);
++ resp = gtk_dialog_run(GTK_DIALOG(question));
++ gtk_widget_destroy(question);
++ if (resp != GTK_RESPONSE_YES) {
++ continue;
++ }
++ }
++
++ format =
++ egg_file_format_chooser_get_format(EGG_FILE_FORMAT_CHOOSER
++ (format_chooser), fname);
++ if (!format) {
++ char *tmp;
++ question = gtk_message_dialog_new(GTK_WINDOW(exportdialog),
++ GTK_DIALOG_MODAL |
++ GTK_DIALOG_DESTROY_WITH_PARENT,
++ GTK_MESSAGE_WARNING,
++ GTK_BUTTONS_OK,
++ "Could not recognise format of output file \"%s\", please choose another format.",
++ ((tmp =
++ rindex(fname,
++ '/')) !=
++ NULL) ? (tmp + 1) : (fname));
++ gtk_dialog_run(GTK_DIALOG(question));
++ gtk_widget_destroy(question);
++ continue;
++ }
++ formatname =
++ (gchar *)
++ egg_file_format_chooser_get_format_data(EGG_FILE_FORMAT_CHOOSER
++ (format_chooser), format);
++
++ tmpbuf = g_new(Pixel, export_x * export_y);
++ render_buffer(tmpbuf, export_x, export_y);
++ pbuf = gdk_pixbuf_new_from_data((guchar *) tmpbuf,
++ GDK_COLORSPACE_RGB,
++ TRUE, 8,
++ export_x, export_y,
++ sizeof(Pixel) * export_x,
++ NULL, NULL);
++ success = gdk_pixbuf_save(pbuf, fname, formatname, &err, NULL);
++
++ if (!success && (err != NULL)) {
++ question = gtk_message_dialog_new(GTK_WINDOW(exportdialog),
++ GTK_DIALOG_MODAL |
++ GTK_DIALOG_DESTROY_WITH_PARENT,
++ GTK_MESSAGE_WARNING,
++ GTK_BUTTONS_OK,
++ "Error saving image: %s",
++ err->message);
++ gtk_dialog_run(GTK_DIALOG(question));
++ gtk_widget_destroy(question);
++ }
++ g_object_unref(pbuf);
++ g_free(tmpbuf);
++ break;
++ }
++ gtk_widget_hide(exportdialog);
+ }
+
++
+ void pagesetup_cb(GtkAction *action, gpointer user_data)
+ {
+ if (print_pagesetup == NULL) {
+@@ -735,21 +758,25 @@ void print_draw(GtkPrintOperation *printop, GtkPrintContext *context,
+ g_free(tmpbuf);
+ }
+
+-void print_get_res_cb(GtkPrintOperation *print, GtkWidget *widget, gpointer rb)
++
++void print_get_res_cb(GtkPrintOperation * print, GtkWidget * widget,
++ gpointer rb)
+ {
+- GSList *el;
+-
+- el = gtk_radio_button_get_group(*((GtkRadioButton **)rb));
+- while(el != NULL) {
+- if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(el->data))) {
+- print_resolution = (int) g_object_get_data(G_OBJECT(el->data), "res");
+- return;
+- } else
+- el = el->next;
+- }
+- return;
++ GSList *el;
++
++ el = gtk_radio_button_get_group(*((GtkRadioButton **) rb));
++ while (el != NULL) {
++ if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(el->data))) {
++ print_resolution =
++ (uintptr_t) g_object_get_data(G_OBJECT(el->data), "res");
++ return;
++ } else
++ el = el->next;
++ }
++ return;
+ }
+
++
+ GObject *print_build_reswidget_cb(GtkPrintOperation *operation, gpointer radio_p)
+ {
+ GtkBuilder *b = NULL;
diff --git a/debian/patches/06_manfix.patch b/debian/patches/06_manfix.patch
new file mode 100644
index 0000000..d8a072d
--- /dev/null
+++ b/debian/patches/06_manfix.patch
@@ -0,0 +1,93 @@
+From: Teemu Ikonen <tpikonen at gmail.com>
+Subject: Rasmol man page fixes.
+X-git-branch: p/manfix
+
+ doc/rasmol.1 | 22 +++++++++++-----------
+ 1 files changed, 11 insertions(+), 11 deletions(-)
+
+diff --git a/doc/rasmol.1 b/doc/rasmol.1
+index 85df72c..fec7275 100644
+--- a/doc/rasmol.1
++++ b/doc/rasmol.1
+@@ -1,4 +1,3 @@
+-.PU
+ .TH RASMOL 1 "July 2009"
+ .SH NAME
+ rasmol \- Molecular Graphics Visualisation Tool v2.7.5
+@@ -917,7 +916,7 @@ The RasMol
+ .B clipboard
+ command places a copy of the currently displayed image on the local
+ graphics 'clipboard'. Note: this command is not yet supported on
+-UNIX or VMS machines. It is intended to make transfering images
++UNIX or VMS machines. It is intended to make transferring images
+ between applications easier under Microsoft Windows or on an Apple
+ Macintosh.
+
+@@ -1992,7 +1991,7 @@ The RasMol
+ command allows the user to alter various internal program parameters
+ such as those controlling rendering options. Each parameter has its
+ own set or permissible parameter options. Typically, omitting the
+-paramter option resets that parameter to its default value. A list of
++parameter option resets that parameter to its default value. A list of
+ valid parameter names is given below.
+
+ .TP
+@@ -2144,7 +2143,7 @@ command the position of the cysteine's alpha carbons may be used instead.
+ The RasMol
+ .B star
+ command is used to represent all of the currently selected atoms as
+-stars (six strokes, one each in the x, -x, y, -y, z and -z directions).
++stars (six strokes, one each in the x, \-x, y, \-y, z and \-z directions).
+ The commands
+ .B select not bonded
+ followed by
+@@ -2344,7 +2343,7 @@ is to be moved and the integer parameter specifies the absolute
+ position of the molecule centre from the middle of the screen.
+ Permitted values for the axis parameter are
+ "x", "y" and "z".
+-Displacement values must be between -100 and 100 which correspond to
++Displacement values must be between \-100 and 100 which correspond to
+ moving the current molecule just off the screen. A positive
+ "x"
+ displacement moves the molecule to the right, and a positive
+@@ -2388,7 +2387,7 @@ command.
+
+ If the selected bonds involved atoms of alternate conformers then
+ the bonds are narrowed in the middle to a radius of .8 of the specified
+-radius (or to the radius specifed as the optional second parameter).
++radius (or to the radius specified as the optional second parameter).
+
+ Non-bonded atoms, which could become invisible in an
+ ordinary
+@@ -3051,7 +3050,7 @@ parameter).
+ A value of 0 distributes the light on the entire object.
+
+ This implementation of shadepower differs from the one in RasTop
+-only in the choice of range (0 to 100 versus -20 to 20 in RasTop).
++only in the choice of range (0 to 100 versus \-20 to 20 in RasTop).
+
+ .TP
+ .B Set Shadow
+@@ -3065,7 +3064,7 @@ shadows. Enabling shadowing will automatically disable the Z-clipping
+ Ray-tracing typically takes about several seconds for a moderately sized protein.
+ It is recommended that shadowing be normally disabled whilst the
+ molecule is being transformed or manipulated, and only enabled once
+-an appropiate viewpoint is selected, to provide a greater impression
++an appropriate viewpoint is selected, to provide a greater impression
+ of depth.
+
+ .TP
+@@ -4115,9 +4114,10 @@ codes of each of the amino acids.
+
+ .TP
+ .B Booleans
+-A boolean parameter is a truth value. Valid boolean values are 'true' and
+-'false', and their synonyms 'on' and 'off'. Boolean parameters are commonly
+-used by RasMol to either enable or disable a representation or option.
++A boolean parameter is a truth value. Valid boolean values are 'true'
++and 'false', and their synonyms 'on' and 'off'. Boolean parameters are
++commonly used by RasMol to either enable or disable a representation or
++option.
+
+ .SH FILE FORMATS
+
diff --git a/debian/patches/07_CONFLICTS_IN_gtk-tiff-lzw.patch b/debian/patches/07_CONFLICTS_IN_gtk-tiff-lzw.patch
new file mode 100644
index 0000000..61e64be
--- /dev/null
+++ b/debian/patches/07_CONFLICTS_IN_gtk-tiff-lzw.patch
@@ -0,0 +1,212 @@
+reverted:
+--- b/src/gtkwin.c
++++ a/src/gtkwin.c
+@@ -560,117 +560,101 @@
+
+ }
+
++void export_cb(GtkAction *action, gpointer user_data)
+-
+-void export_cb(GtkAction * action, gpointer user_data)
+ {
++ static char *fname = NULL;
+- static char *fname = NULL;
+
++ if(!exportdialog) {
++ build_exportdialog();
++ }
++ if(fname) {
++ gtk_file_chooser_set_filename(GTK_FILE_CHOOSER (exportdialog), fname);
++ gtk_file_chooser_unselect_all(GTK_FILE_CHOOSER (exportdialog));
++ }
++ if(gtk_toggle_button_get_active(
++ GTK_TOGGLE_BUTTON(gtk_builder_get_object(sizebuilder, "size_current"))))
++ {
++ GtkLabel *header = NULL;
++ char header_str[128];
++
++ export_x = XRange;
++ export_y = YRange;
++ header = GTK_LABEL(gtk_builder_get_object(sizebuilder, "size_header"));
++ snprintf(header_str, 127, "Size: %d x %d", export_x, export_y);
++ gtk_label_set_text(header, header_str);
++ }
++ while(TRUE) {
++ GtkWidget *question;
++ GdkPixbuf *pbuf;
++ GError *err = NULL;
++ gboolean success = TRUE;
++ guint format = 0;
++ gchar *formatname = NULL;
++ GSList *tmplist = NULL;
++ guchar *tmpbuf;
++
++ if (gtk_dialog_run (GTK_DIALOG (exportdialog)) != GTK_RESPONSE_ACCEPT) {
++ break;
++ }
++
++ if(fname) {
++ g_free (fname);
++ }
++ fname = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (exportdialog));
++ if(g_file_test(fname, G_FILE_TEST_EXISTS)) {
++ gint resp;
++ question = gtk_message_dialog_new(GTK_WINDOW(exportdialog),
++ GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
++ GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO,
++ "A file named \"%s\" already exists. Do you want to replace it?",
++ fname);
++ resp = gtk_dialog_run(GTK_DIALOG(question));
++ gtk_widget_destroy (question);
++ if(resp != GTK_RESPONSE_YES) {
++ continue;
++ }
++ }
++
++ format = egg_file_format_chooser_get_format (
++ EGG_FILE_FORMAT_CHOOSER(format_chooser), fname);
++ if(!format) {
++ char *tmp;
++ question = gtk_message_dialog_new(GTK_WINDOW(exportdialog),
++ GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
++ GTK_MESSAGE_WARNING, GTK_BUTTONS_OK,
++ "Could not recognise format of output file \"%s\", please choose another format.",
++ ((tmp = rindex(fname, '/')) != NULL) ? (tmp+1) : (fname));
++ gtk_dialog_run(GTK_DIALOG(question));
++ gtk_widget_destroy (question);
++ continue;
++ }
++ formatname = (gchar *) egg_file_format_chooser_get_format_data(
++ EGG_FILE_FORMAT_CHOOSER(format_chooser), format);
++
++ tmpbuf = g_new(guchar, 4*export_x*export_y);
++ render_buffer((Pixel *) tmpbuf, export_x, export_y);
++ pbuf = gdk_pixbuf_new_from_data(tmpbuf,
++ GDK_COLORSPACE_RGB,
++ TRUE, 8,
++ export_x, export_y, 4*export_x,
++ NULL, NULL);
++ success = gdk_pixbuf_save(pbuf, fname, formatname, &err, NULL);
++
++ if(!success && (err != NULL) ) {
++ question = gtk_message_dialog_new(GTK_WINDOW(exportdialog),
++ GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
++ GTK_MESSAGE_WARNING, GTK_BUTTONS_OK, "Error saving image: %s",
++ err->message);
++ gtk_dialog_run(GTK_DIALOG(question));
++ gtk_widget_destroy (question);
++ }
++ g_object_unref(pbuf);
++ g_free(tmpbuf);
++ break;
++ }
++ gtk_widget_hide (exportdialog);
+- if (!exportdialog) {
+- build_exportdialog();
+- }
+- if (fname) {
+- gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(exportdialog), fname);
+- gtk_file_chooser_unselect_all(GTK_FILE_CHOOSER(exportdialog));
+- }
+- if (gtk_toggle_button_get_active
+- (GTK_TOGGLE_BUTTON
+- (gtk_builder_get_object(sizebuilder, "size_current")))) {
+- GtkLabel *header = NULL;
+- char header_str[128];
+-
+- export_x = XRange;
+- export_y = YRange;
+- header = GTK_LABEL(gtk_builder_get_object(sizebuilder, "size_header"));
+- snprintf(header_str, 127, "Size: %d x %d", export_x, export_y);
+- gtk_label_set_text(header, header_str);
+- }
+- while (TRUE) {
+- GtkWidget *question;
+- GdkPixbuf *pbuf;
+- GError *err = NULL;
+- gboolean success = TRUE;
+- guint format = 0;
+- gchar *formatname = NULL;
+- GSList *tmplist = NULL;
+- Pixel *tmpbuf;
+-
+- if (gtk_dialog_run(GTK_DIALOG(exportdialog)) != GTK_RESPONSE_ACCEPT) {
+- break;
+- }
+-
+- if (fname) {
+- g_free(fname);
+- }
+- fname = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(exportdialog));
+- if (g_file_test(fname, G_FILE_TEST_EXISTS)) {
+- gint resp;
+- question = gtk_message_dialog_new(GTK_WINDOW(exportdialog),
+- GTK_DIALOG_MODAL |
+- GTK_DIALOG_DESTROY_WITH_PARENT,
+- GTK_MESSAGE_QUESTION,
+- GTK_BUTTONS_YES_NO,
+- "A file named \"%s\" already exists. Do you want to replace it?",
+- fname);
+- resp = gtk_dialog_run(GTK_DIALOG(question));
+- gtk_widget_destroy(question);
+- if (resp != GTK_RESPONSE_YES) {
+- continue;
+- }
+- }
+-
+- format =
+- egg_file_format_chooser_get_format(EGG_FILE_FORMAT_CHOOSER
+- (format_chooser), fname);
+- if (!format) {
+- char *tmp;
+- question = gtk_message_dialog_new(GTK_WINDOW(exportdialog),
+- GTK_DIALOG_MODAL |
+- GTK_DIALOG_DESTROY_WITH_PARENT,
+- GTK_MESSAGE_WARNING,
+- GTK_BUTTONS_OK,
+- "Could not recognise format of output file \"%s\", please choose another format.",
+- ((tmp =
+- rindex(fname,
+- '/')) !=
+- NULL) ? (tmp + 1) : (fname));
+- gtk_dialog_run(GTK_DIALOG(question));
+- gtk_widget_destroy(question);
+- continue;
+- }
+- formatname =
+- (gchar *)
+- egg_file_format_chooser_get_format_data(EGG_FILE_FORMAT_CHOOSER
+- (format_chooser), format);
+-
+- tmpbuf = g_new(Pixel, export_x * export_y);
+- render_buffer(tmpbuf, export_x, export_y);
+- pbuf = gdk_pixbuf_new_from_data((guchar *) tmpbuf,
+- GDK_COLORSPACE_RGB,
+- TRUE, 8,
+- export_x, export_y,
+- sizeof(Pixel) * export_x,
+- NULL, NULL);
+- success = gdk_pixbuf_save(pbuf, fname, formatname, &err, NULL);
+-
+- if (!success && (err != NULL)) {
+- question = gtk_message_dialog_new(GTK_WINDOW(exportdialog),
+- GTK_DIALOG_MODAL |
+- GTK_DIALOG_DESTROY_WITH_PARENT,
+- GTK_MESSAGE_WARNING,
+- GTK_BUTTONS_OK,
+- "Error saving image: %s",
+- err->message);
+- gtk_dialog_run(GTK_DIALOG(question));
+- gtk_widget_destroy(question);
+- }
+- g_object_unref(pbuf);
+- g_free(tmpbuf);
+- break;
+- }
+- gtk_widget_hide(exportdialog);
+ }
+
+-
+ void pagesetup_cb(GtkAction *action, gpointer user_data)
+ {
+ if (print_pagesetup == NULL) {
diff --git a/debian/patches/08_gtk-tiff-lzw.patch b/debian/patches/08_gtk-tiff-lzw.patch
new file mode 100644
index 0000000..fc41d25
--- /dev/null
+++ b/debian/patches/08_gtk-tiff-lzw.patch
@@ -0,0 +1,22 @@
+From: Teemu Ikonen <tpikonen at gmail.com>
+Subject: Write TIFFs with LZW compression in GTK version.
+X-git-branch: p/gtk-tiff-lzw
+
+ src/gtkwin.c | 4 +++-
+ 1 files changed, 3 insertions(+), 1 deletions(-)
+
+diff --git a/src/gtkwin.c b/src/gtkwin.c
+index f5b70ac..14eddee 100755
+--- a/src/gtkwin.c
++++ b/src/gtkwin.c
+@@ -638,7 +638,9 @@ void export_cb(GtkAction *action, gpointer user_data)
+ TRUE, 8,
+ export_x, export_y, 4*export_x,
+ NULL, NULL);
+- success = gdk_pixbuf_save(pbuf, fname, formatname, &err, NULL);
++ // Use TIFF compression 5 = LZW
++ success = gdk_pixbuf_save(pbuf, fname, formatname, &err,
++ "compression", "5", NULL);
+
+ if(!success && (err != NULL) ) {
+ question = gtk_message_dialog_new(GTK_WINDOW(exportdialog),
diff --git a/debian/patches/09_RESOLUTION.patch b/debian/patches/09_RESOLUTION.patch
new file mode 100644
index 0000000..89d4562
--- /dev/null
+++ b/debian/patches/09_RESOLUTION.patch
@@ -0,0 +1,213 @@
+Resolve patch overlaps.
+--- a/src/gtkwin.c
++++ b/src/gtkwin.c
+@@ -567,103 +567,119 @@
+
+ }
+
+-void export_cb(GtkAction *action, gpointer user_data)
++
++void export_cb(GtkAction * action, gpointer user_data)
+ {
+- static char *fname = NULL;
++ static char *fname = NULL;
+
+- if(!exportdialog) {
+- build_exportdialog();
+- }
+- if(fname) {
+- gtk_file_chooser_set_filename(GTK_FILE_CHOOSER (exportdialog), fname);
+- gtk_file_chooser_unselect_all(GTK_FILE_CHOOSER (exportdialog));
+- }
+- if(gtk_toggle_button_get_active(
+- GTK_TOGGLE_BUTTON(gtk_builder_get_object(sizebuilder, "size_current"))))
+- {
+- GtkLabel *header = NULL;
+- char header_str[128];
+-
+- export_x = XRange;
+- export_y = YRange;
+- header = GTK_LABEL(gtk_builder_get_object(sizebuilder, "size_header"));
+- snprintf(header_str, 127, "Size: %d x %d", export_x, export_y);
+- gtk_label_set_text(header, header_str);
+- }
+- while(TRUE) {
+- GtkWidget *question;
+- GdkPixbuf *pbuf;
+- GError *err = NULL;
+- gboolean success = TRUE;
+- guint format = 0;
+- gchar *formatname = NULL;
+- GSList *tmplist = NULL;
+- guchar *tmpbuf;
+-
+- if (gtk_dialog_run (GTK_DIALOG (exportdialog)) != GTK_RESPONSE_ACCEPT) {
+- break;
+- }
+-
+- if(fname) {
+- g_free (fname);
+- }
+- fname = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (exportdialog));
+- if(g_file_test(fname, G_FILE_TEST_EXISTS)) {
+- gint resp;
+- question = gtk_message_dialog_new(GTK_WINDOW(exportdialog),
+- GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
+- GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO,
+- "A file named \"%s\" already exists. Do you want to replace it?",
+- fname);
+- resp = gtk_dialog_run(GTK_DIALOG(question));
+- gtk_widget_destroy (question);
+- if(resp != GTK_RESPONSE_YES) {
+- continue;
+- }
+- }
+-
+- format = egg_file_format_chooser_get_format (
+- EGG_FILE_FORMAT_CHOOSER(format_chooser), fname);
+- if(!format) {
+- char *tmp;
+- question = gtk_message_dialog_new(GTK_WINDOW(exportdialog),
+- GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
+- GTK_MESSAGE_WARNING, GTK_BUTTONS_OK,
+- "Could not recognise format of output file \"%s\", please choose another format.",
+- ((tmp = rindex(fname, '/')) != NULL) ? (tmp+1) : (fname));
+- gtk_dialog_run(GTK_DIALOG(question));
+- gtk_widget_destroy (question);
+- continue;
+- }
+- formatname = (gchar *) egg_file_format_chooser_get_format_data(
+- EGG_FILE_FORMAT_CHOOSER(format_chooser), format);
+-
+- tmpbuf = g_new(guchar, 4*export_x*export_y);
+- render_buffer((Pixel *) tmpbuf, export_x, export_y);
+- pbuf = gdk_pixbuf_new_from_data(tmpbuf,
+- GDK_COLORSPACE_RGB,
+- TRUE, 8,
+- export_x, export_y, 4*export_x,
+- NULL, NULL);
++ if (!exportdialog) {
++ build_exportdialog();
++ }
++ if (fname) {
++ gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(exportdialog), fname);
++ gtk_file_chooser_unselect_all(GTK_FILE_CHOOSER(exportdialog));
++ }
++ if (gtk_toggle_button_get_active
++ (GTK_TOGGLE_BUTTON
++ (gtk_builder_get_object(sizebuilder, "size_current")))) {
++ GtkLabel *header = NULL;
++ char header_str[128];
++
++ export_x = XRange;
++ export_y = YRange;
++ header = GTK_LABEL(gtk_builder_get_object(sizebuilder, "size_header"));
++ snprintf(header_str, 127, "Size: %d x %d", export_x, export_y);
++ gtk_label_set_text(header, header_str);
++ }
++ while (TRUE) {
++ GtkWidget *question;
++ GdkPixbuf *pbuf;
++ GError *err = NULL;
++ gboolean success = TRUE;
++ guint format = 0;
++ gchar *formatname = NULL;
++ GSList *tmplist = NULL;
++ Pixel *tmpbuf;
++
++ if (gtk_dialog_run(GTK_DIALOG(exportdialog)) != GTK_RESPONSE_ACCEPT) {
++ break;
++ }
++
++ if (fname) {
++ g_free(fname);
++ }
++ fname = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(exportdialog));
++ if (g_file_test(fname, G_FILE_TEST_EXISTS)) {
++ gint resp;
++ question = gtk_message_dialog_new(GTK_WINDOW(exportdialog),
++ GTK_DIALOG_MODAL |
++ GTK_DIALOG_DESTROY_WITH_PARENT,
++ GTK_MESSAGE_QUESTION,
++ GTK_BUTTONS_YES_NO,
++ "A file named \"%s\" already exists. Do you want to replace it?",
++ fname);
++ resp = gtk_dialog_run(GTK_DIALOG(question));
++ gtk_widget_destroy(question);
++ if (resp != GTK_RESPONSE_YES) {
++ continue;
++ }
++ }
++
++ format =
++ egg_file_format_chooser_get_format(EGG_FILE_FORMAT_CHOOSER
++ (format_chooser), fname);
++ if (!format) {
++ char *tmp;
++ question = gtk_message_dialog_new(GTK_WINDOW(exportdialog),
++ GTK_DIALOG_MODAL |
++ GTK_DIALOG_DESTROY_WITH_PARENT,
++ GTK_MESSAGE_WARNING,
++ GTK_BUTTONS_OK,
++ "Could not recognise format of output file \"%s\", please choose another format.",
++ ((tmp =
++ rindex(fname,
++ '/')) !=
++ NULL) ? (tmp + 1) : (fname));
++ gtk_dialog_run(GTK_DIALOG(question));
++ gtk_widget_destroy(question);
++ continue;
++ }
++ formatname =
++ (gchar *)
++ egg_file_format_chooser_get_format_data(EGG_FILE_FORMAT_CHOOSER
++ (format_chooser), format);
++
++ tmpbuf = g_new(Pixel, export_x * export_y);
++ render_buffer(tmpbuf, export_x, export_y);
++ pbuf = gdk_pixbuf_new_from_data((guchar *) tmpbuf,
++ GDK_COLORSPACE_RGB,
++ TRUE, 8,
++ export_x, export_y,
++ sizeof(Pixel) * export_x,
++ NULL, NULL);
+ // Use TIFF compression 5 = LZW
+ success = gdk_pixbuf_save(pbuf, fname, formatname, &err,
+ "compression", "5", NULL);
+-
+- if(!success && (err != NULL) ) {
+- question = gtk_message_dialog_new(GTK_WINDOW(exportdialog),
+- GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
+- GTK_MESSAGE_WARNING, GTK_BUTTONS_OK, "Error saving image: %s",
+- err->message);
+- gtk_dialog_run(GTK_DIALOG(question));
+- gtk_widget_destroy (question);
+- }
+- g_object_unref(pbuf);
+- g_free(tmpbuf);
+- break;
+- }
+- gtk_widget_hide (exportdialog);
++
++ if (!success && (err != NULL)) {
++ question = gtk_message_dialog_new(GTK_WINDOW(exportdialog),
++ GTK_DIALOG_MODAL |
++ GTK_DIALOG_DESTROY_WITH_PARENT,
++ GTK_MESSAGE_WARNING,
++ GTK_BUTTONS_OK,
++ "Error saving image: %s",
++ err->message);
++ gtk_dialog_run(GTK_DIALOG(question));
++ gtk_widget_destroy(question);
++ }
++ g_object_unref(pbuf);
++ g_free(tmpbuf);
++ break;
++ }
++ gtk_widget_hide(exportdialog);
+ }
+
++
+ void pagesetup_cb(GtkAction *action, gpointer user_data)
+ {
+ if (print_pagesetup == NULL) {
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..ab93f57
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1,9 @@
+01_gtkabout.patch
+02_imakefile.patch
+03_intwidth.patch
+04_spinbuttons.patch
+05_gtkexport.patch
+06_manfix.patch
+07_CONFLICTS_IN_gtk-tiff-lzw.patch
+08_gtk-tiff-lzw.patch
+09_RESOLUTION.patch
--
Rasmol packaging
More information about the debian-science-commits
mailing list