app/docindex.[ch] call dialog_[un]register(). Fixes #10284. Also removed

2000-05-05  Michael Natterer  <mitch@gimp.org>

	* app/docindex.[ch]
	* app/docindexif.[ch]: call dialog_[un]register(). Fixes #10284.
	Also removed some useless stuff.

	* app/gdisplay_color_ui.c
	* modules/cdisplay_gamma.c
	* modules/cdisplay_highcontrast.c: call dialog_[un]register().
This commit is contained in:
Michael Natterer 2000-05-05 13:29:46 +00:00 committed by Michael Natterer
parent 5ccf431ce5
commit 53238ebc28
10 changed files with 155 additions and 118 deletions

View File

@ -1,3 +1,13 @@
2000-05-05 Michael Natterer <mitch@gimp.org>
* app/docindex.[ch]
* app/docindexif.[ch]: call dialog_[un]register(). Fixes #10284.
Also removed some useless stuff.
* app/gdisplay_color_ui.c
* modules/cdisplay_gamma.c
* modules/cdisplay_highcontrast.c: call dialog_[un]register().
2000-05-05 Jay Cox <jaycox@earthlink.net>
* app/pixel_processor.c: try to minimize the overhead of

View File

@ -16,15 +16,21 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <gtk/gtk.h>
#include "color_area.h"
#include "dialog_handler.h"
#include "gdisplay.h"
#include "gdisplay_color.h"
#include "gdisplay_color_ui.h"
#include "gimpimageP.h"
#include "gimpui.h"
#include "libgimp/parasite.h"
#include "libgimp/gimpintl.h"
#include <gtk/gtk.h>
typedef struct _ColorDisplayDialog ColorDisplayDialog;
@ -106,8 +112,8 @@ make_dialog (ColorDisplayDialog *cdd)
GtkWidget *hbox;
GtkWidget *scrolled_win;
GtkWidget *vbbox;
char *titles[2];
int i;
gchar *titles[2];
gint i;
static ButtonInfo buttons[] =
{
@ -131,6 +137,8 @@ make_dialog (ColorDisplayDialog *cdd)
NULL);
dialog_register (cdd->shell);
hbox = gtk_hbox_new (FALSE, 4);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (cdd->shell)->vbox), hbox,
TRUE, TRUE, 4);

View File

@ -17,6 +17,7 @@
#include <gtk/gtk.h>
#include "dialog_handler.h"
#include "docindexif.h"
#include "docindex.h"
#include "gimpdnd.h"
@ -167,13 +168,10 @@ idea_window_delete_event_callback (GtkWidget *widget,
GdkEvent *event,
gpointer data)
{
if (! exit_from_go ())
{
save_idea_manager (ideas);
create_idea_list ();
g_free (ideas);
ideas = 0;
}
save_idea_manager (ideas);
create_idea_list ();
g_free (ideas);
ideas = 0;
return FALSE;
}
@ -186,9 +184,10 @@ idea_hide_callback (GtkWidget *widget,
save_idea_manager (ideas);
/* False if exitting */
if ((! exit_from_go ()) && ideas)
if (ideas)
{
create_idea_list ();
dialog_unregister (ideas->window);
gtk_widget_destroy (ideas->window);
g_free (ideas);
ideas = 0;
@ -614,7 +613,7 @@ idea_remove_callback (GtkWidget *widget,
}
void
close_idea_window( void )
close_idea_window (void)
{
idea_hide_callback (NULL, NULL);
}

View File

@ -22,12 +22,10 @@
typedef struct idea_manager
{
/* The scrollbar */
GtkWidget *vscrollbar,
/* The GTK window */
*window;
GtkWidget *vscrollbar;
/* The GTK window */
GtkWidget *window;
GtkWidget *tree;
/* The menufactory */
GtkMenuFactory *menubar;
/* The window menu widget */
GtkWidget *window_menu;
/* The status bar widget */
@ -36,7 +34,6 @@ typedef struct idea_manager
guint contextid;
gboolean changed;
gboolean named;
gchar *title;
gint auto_save;
gint long_term_auto_save;
gint count;

View File

@ -15,6 +15,9 @@
#include <ctype.h>
#include <string.h>
#include <gtk/gtk.h>
#include "dialog_handler.h"
#include "docindex.h"
#include "docindexif.h"
#include "fileops.h"
@ -56,12 +59,6 @@ open_or_raise (gchar *file_name)
}
}
gboolean
exit_from_go ()
{
return FALSE;
}
void open_file_in_position (gchar *filename,
gint position)
{
@ -73,7 +70,8 @@ GtkMenuFactory *create_idea_menu ()
return NULL;
}
GtkWidget *create_idea_toolbar ()
GtkWidget *
create_idea_toolbar (void)
{
GtkWidget *toolbar;
@ -168,7 +166,7 @@ clear_white (FILE *fp)
/* reset_usize
* A callback so that the window can be resized smaller. */
gint
reset_usize (gpointer data )
reset_usize (gpointer data)
{
gtk_widget_set_usize (GTK_WIDGET (data), 0, 0);
return FALSE;
@ -178,13 +176,12 @@ void
make_idea_window (gint x,
gint y)
{
GtkWidget *main_vbox, *menu;
GtkWidget *main_vbox;
GtkWidget *scrolled_win;
GtkWidget *toolbar;
GtkAccelGroup *accel;
/* malloc idea_manager */
ideas = g_malloc0 (sizeof (idea_manager));
ideas = g_new0 (idea_manager, 1);
/* Setup tree */
ideas->tree = gtk_tree_new ();
@ -195,23 +192,11 @@ make_idea_window (gint x,
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_win),
GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS );
gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scrolled_win),
ideas->tree );
ideas->tree);
gtk_widget_show (ideas->tree);
/* allocate the window and attach the menu */
ideas->window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
ideas->menubar = create_idea_menu (ideas);
if (ideas->menubar)
{
menu = ideas->menubar->widget;
/* Setup accelerator (hotkey) table */
accel = ideas->menubar->accel_group;
/* Add accelerators to window widget */
gtk_window_add_accel_group (GTK_WINDOW (ideas->window), accel);
}
else
menu = NULL;
/* Setup the status bar */
ideas->status = gtk_statusbar_new ();
@ -224,25 +209,17 @@ make_idea_window (gint x,
/* Setup a vbox to contain the menu */
main_vbox = gtk_vbox_new (FALSE, 0);
if (menu)
gtk_box_pack_start (GTK_BOX (main_vbox), menu, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (main_vbox), toolbar, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (main_vbox), scrolled_win, TRUE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (main_vbox), ideas->status, FALSE, FALSE, 0);
if (menu)
gtk_widget_show (menu);
gtk_widget_show (scrolled_win);
gtk_widget_show (ideas->status);
/* Set the GOWindow title */
ideas->title = g_strdup (_("Document Index"));
/* Set the GtkWindow title */
gtk_window_set_title (GTK_WINDOW (ideas->window), ideas->title);
gtk_window_set_title (GTK_WINDOW (ideas->window), _("Document Index"));
/* Set the initial status message */
gtk_statusbar_push (GTK_STATUSBAR (ideas->status), ideas->contextid,
_("GTK successfully started"));
gtk_statusbar_push (GTK_STATUSBAR (ideas->status), ideas->contextid, "");
/* Connect the signals */
gtk_signal_connect (GTK_OBJECT (ideas->window), "delete_event",
@ -267,4 +244,6 @@ make_idea_window (gint x,
gimp_help_connect_help_accel (ideas->window,
gimp_standard_help_func,
"dialogs/document_index.html");
dialog_register (ideas->window);
}

View File

@ -17,14 +17,18 @@
#include <stdio.h>
struct bool_char_pair
{
gboolean boole;
gchar *string;
};
void open_or_raise (gchar *file_name);
void raise_if_match (gpointer data,
gpointer user_data);
gboolean exit_from_go ();
void open_file_in_position (gchar *filename,
gint position);
GtkMenuFactory * create_idea_menu ();
GtkWidget * create_idea_toolbar ();
GtkWidget * create_idea_toolbar (void);
void clear_white (FILE *fp);
int getinteger (FILE *fp);
gchar * append2 (gchar *string1,
@ -33,10 +37,4 @@ gchar * append2 (gchar *string1,
gboolean del2);
gint reset_usize (gpointer data);
struct bool_char_pair
{
gboolean boole;
gchar *string;
};
#endif /* __DOCINDEXIF_H__ */

View File

@ -16,15 +16,21 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <gtk/gtk.h>
#include "color_area.h"
#include "dialog_handler.h"
#include "gdisplay.h"
#include "gdisplay_color.h"
#include "gdisplay_color_ui.h"
#include "gimpimageP.h"
#include "gimpui.h"
#include "libgimp/parasite.h"
#include "libgimp/gimpintl.h"
#include <gtk/gtk.h>
typedef struct _ColorDisplayDialog ColorDisplayDialog;
@ -106,8 +112,8 @@ make_dialog (ColorDisplayDialog *cdd)
GtkWidget *hbox;
GtkWidget *scrolled_win;
GtkWidget *vbbox;
char *titles[2];
int i;
gchar *titles[2];
gint i;
static ButtonInfo buttons[] =
{
@ -131,6 +137,8 @@ make_dialog (ColorDisplayDialog *cdd)
NULL);
dialog_register (cdd->shell);
hbox = gtk_hbox_new (FALSE, 4);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (cdd->shell)->vbox), hbox,
TRUE, TRUE, 4);

View File

@ -16,15 +16,21 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <gtk/gtk.h>
#include "color_area.h"
#include "dialog_handler.h"
#include "gdisplay.h"
#include "gdisplay_color.h"
#include "gdisplay_color_ui.h"
#include "gimpimageP.h"
#include "gimpui.h"
#include "libgimp/parasite.h"
#include "libgimp/gimpintl.h"
#include <gtk/gtk.h>
typedef struct _ColorDisplayDialog ColorDisplayDialog;
@ -106,8 +112,8 @@ make_dialog (ColorDisplayDialog *cdd)
GtkWidget *hbox;
GtkWidget *scrolled_win;
GtkWidget *vbbox;
char *titles[2];
int i;
gchar *titles[2];
gint i;
static ButtonInfo buttons[] =
{
@ -131,6 +137,8 @@ make_dialog (ColorDisplayDialog *cdd)
NULL);
dialog_register (cdd->shell);
hbox = gtk_hbox_new (FALSE, 4);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (cdd->shell)->vbox), hbox,
TRUE, TRUE, 4);

View File

@ -17,18 +17,23 @@
*/
#include "config.h"
#include <math.h>
#include <string.h>
#include <gtk/gtk.h>
#include <libgimp/color_display.h>
#include <libgimp/gimpintl.h>
#include <libgimp/gimpmodule.h>
#include <libgimp/parasite.h>
#include <libgimp/gimpmath.h>
#include <libgimp/gimpui.h>
#include <gtk/gtk.h>
#include "app/dialog_handler.h"
#include "modregister.h"
#include "libgimp/gimpintl.h"
#define COLOR_DISPLAY_NAME _("Gamma")
typedef struct _GammaContext GammaContext;
@ -116,7 +121,7 @@ module_unload (void *shutdown_data,
void (*completed_cb)(void *),
void *completed_data)
{
#ifndef __EMX__
#ifndef __EMX__
gimp_color_display_unregister (COLOR_DISPLAY_NAME);
#else
mod_color_display_unregister (COLOR_DISPLAY_NAME);
@ -157,9 +162,9 @@ gamma_clone (gpointer cd_ID)
static void
gamma_create_lookup_table (GammaContext *context)
{
double one_over_gamma;
double ind;
int i;
gdouble one_over_gamma;
gdouble ind;
gint i;
if (context->gamma == 0.0)
context->gamma = 1.0;
@ -179,7 +184,10 @@ gamma_destroy (gpointer cd_ID)
GammaContext *context = cd_ID;
if (context->shell)
gtk_widget_destroy (context->shell);
{
dialog_unregister (context->shell);
gtk_widget_destroy (context->shell);
}
g_free (context->lookup);
g_free (context);
@ -188,13 +196,13 @@ gamma_destroy (gpointer cd_ID)
static void
gamma_convert (gpointer cd_ID,
guchar *buf,
int width,
int height,
int bpp,
int bpl)
gint width,
gint height,
gint bpp,
gint bpl)
{
guchar *lookup = ((GammaContext *) cd_ID)->lookup;
int i, j = height;
gint i, j = height;
/* You will not be using the entire buffer most of the time.
* Hence, the simplistic code for this is as follows:
@ -271,6 +279,7 @@ gamma_configure_ok_callback (GtkWidget *widget,
context->gamma = gtk_spin_button_get_value_as_float (GTK_SPIN_BUTTON (context->spinner));
gamma_create_lookup_table (context);
dialog_unregister (context->shell);
gtk_widget_destroy (GTK_WIDGET (context->shell));
context->shell = NULL;
@ -284,6 +293,7 @@ gamma_configure_cancel_callback (GtkWidget *widget,
{
GammaContext *context = data;
dialog_unregister (context->shell);
gtk_widget_destroy (GTK_WIDGET (context->shell));
context->shell = NULL;
@ -310,17 +320,20 @@ gamma_configure (gpointer cd_ID,
context->cancel_func = cancel_func;
context->cancel_data = cancel_data;
context->shell = gimp_dialog_new (_("Gamma"), "gamma",
gimp_standard_help_func, "modules/gamma.html",
GTK_WIN_POS_MOUSE,
FALSE, TRUE, FALSE,
context->shell =
gimp_dialog_new (_("Gamma"), "gamma",
gimp_standard_help_func, "modules/gamma.html",
GTK_WIN_POS_MOUSE,
FALSE, TRUE, FALSE,
_("OK"), gamma_configure_ok_callback,
cd_ID, NULL, NULL, TRUE, FALSE,
_("Cancel"), gamma_configure_cancel_callback,
cd_ID, NULL, NULL, FALSE, TRUE,
NULL);
_("OK"), gamma_configure_ok_callback,
cd_ID, NULL, NULL, TRUE, FALSE,
_("Cancel"), gamma_configure_cancel_callback,
cd_ID, NULL, NULL, FALSE, TRUE,
NULL);
dialog_register (context->shell);
hbox = gtk_hbox_new (FALSE, 2);
gtk_container_set_border_width (GTK_CONTAINER (hbox), 6);
@ -347,9 +360,11 @@ gamma_configure_cancel (gpointer cd_ID)
GammaContext *context = cd_ID;
if (context->shell)
gtk_widget_destroy (context->shell);
context->shell = NULL;
{
dialog_unregister (context->shell);
gtk_widget_destroy (context->shell);
context->shell = NULL;
}
if (context->cancel_func)
context->cancel_func (context, context->cancel_data);

View File

@ -19,16 +19,21 @@
#include <string.h>
#include <gtk/gtk.h>
#include <libgimp/color_display.h>
#include <libgimp/gimpintl.h>
#include <libgimp/gimpmodule.h>
#include <libgimp/parasite.h>
#include <libgimp/gimpui.h>
#include <libgimp/gimpmath.h>
#include <gtk/gtk.h>
#include "app/dialog_handler.h"
#include "modregister.h"
#include "libgimp/gimpintl.h"
#define COLOR_DISPLAY_NAME _("High Contrast")
typedef struct _ContrastContext ContrastContext;
@ -98,7 +103,7 @@ static GimpModuleInfo info =
G_MODULE_EXPORT GimpModuleStatus
module_init (GimpModuleInfo **inforet)
{
#ifndef __EMX__
#ifndef __EMX__
if (gimp_color_display_register (COLOR_DISPLAY_NAME, &methods))
#else
if (mod_color_display_register (COLOR_DISPLAY_NAME, &methods))
@ -116,7 +121,7 @@ module_unload (void *shutdown_data,
void (*completed_cb)(void *),
void *completed_data)
{
#ifndef __EMX__
#ifndef __EMX__
gimp_color_display_unregister (COLOR_DISPLAY_NAME);
#else
mod_color_display_unregister (COLOR_DISPLAY_NAME);
@ -125,7 +130,7 @@ module_unload (void *shutdown_data,
static gpointer
contrast_new (int type)
contrast_new (gint type)
{
ContrastContext *context;
@ -155,7 +160,7 @@ contrast_clone (gpointer cd_ID)
static void
contrast_create_lookup_table (ContrastContext *context)
{
int i;
gint i;
if (context->contrast == 0.0)
context->contrast = 1.0;
@ -173,7 +178,10 @@ contrast_destroy (gpointer cd_ID)
ContrastContext *context = cd_ID;
if (context->shell)
gtk_widget_destroy (context->shell);
{
dialog_unregister (context->shell);
gtk_widget_destroy (context->shell);
}
g_free (context->lookup);
g_free (context);
@ -182,13 +190,13 @@ contrast_destroy (gpointer cd_ID)
static void
contrast_convert (gpointer cd_ID,
guchar *buf,
int width,
int height,
int bpp,
int bpl)
gint width,
gint height,
gint bpp,
gint bpl)
{
guchar *lookup = ((ContrastContext *) cd_ID)->lookup;
int i, j = height;
gint i, j = height;
/* You will not be using the entire buffer most of the time.
* Hence, the simplistic code for this is as follows:
@ -265,6 +273,7 @@ contrast_configure_ok_callback (GtkWidget *widget,
context->contrast = gtk_spin_button_get_value_as_float (GTK_SPIN_BUTTON (context->spinner));
contrast_create_lookup_table (context);
dialog_unregister (context->shell);
gtk_widget_destroy (GTK_WIDGET (context->shell));
context->shell = NULL;
@ -278,6 +287,7 @@ contrast_configure_cancel_callback (GtkWidget *widget,
{
ContrastContext *context = data;
dialog_unregister (context->shell);
gtk_widget_destroy (GTK_WIDGET (context->shell));
context->shell = NULL;
@ -304,17 +314,20 @@ contrast_configure (gpointer cd_ID,
context->cancel_func = cancel_func;
context->cancel_data = cancel_data;
context->shell = gimp_dialog_new (_("High Contrast"), "high contrast",
gimp_standard_help_func, "modules/highcontrast.html",
GTK_WIN_POS_MOUSE,
FALSE, TRUE, FALSE,
context->shell =
gimp_dialog_new (_("High Contrast"), "high contrast",
gimp_standard_help_func, "modules/highcontrast.html",
GTK_WIN_POS_MOUSE,
FALSE, TRUE, FALSE,
_("OK"), contrast_configure_ok_callback,
cd_ID, NULL, NULL, TRUE, FALSE,
_("Cancel"), contrast_configure_cancel_callback,
cd_ID, NULL, NULL, FALSE, TRUE,
NULL);
_("OK"), contrast_configure_ok_callback,
cd_ID, NULL, NULL, TRUE, FALSE,
_("Cancel"), contrast_configure_cancel_callback,
cd_ID, NULL, NULL, FALSE, TRUE,
NULL);
dialog_register (context->shell);
hbox = gtk_hbox_new (FALSE, 2);
gtk_container_set_border_width (GTK_CONTAINER (hbox), 6);
@ -341,9 +354,11 @@ contrast_configure_cancel (gpointer cd_ID)
ContrastContext *context = cd_ID;
if (context->shell)
gtk_widget_destroy (context->shell);
context->shell = NULL;
{
dialog_unregister (context->shell);
gtk_widget_destroy (context->shell);
context->shell = NULL;
}
if (context->cancel_func)
context->cancel_func (context, context->cancel_data);