Use spinbutton for number of colours.

1999-08-22  Tor Lillqvist  <tml@iki.fi>

* app/convert.c: Use spinbutton for number of colours.

* app/preferences_dialog.h: Export gimp_spin_button_new. Not the
most logical place for it, though.
This commit is contained in:
Tor Lillqvist 1999-08-22 00:56:18 +00:00 committed by Tor Lillqvist
parent e0dc5cd9e1
commit 32879bafe3
7 changed files with 142 additions and 120 deletions

View File

@ -1,3 +1,10 @@
1999-08-22 Tor Lillqvist <tml@iki.fi>
* app/convert.c: Use spinbutton for number of colours.
* app/preferences_dialog.h: Export gimp_spin_button_new. Not the
most logical place for it, though.
Sat Aug 21 17:34:53 PDT 1999 Manish Singh <yosh@gimp.org>
* configure.in: version number bump

View File

@ -87,6 +87,7 @@
#include "interface.h"
#include "undo.h"
#include "palette.h"
#include "preferences_dialog.h" /* ick. */
#include "libgimp/gimpintl.h"
@ -316,9 +317,12 @@ convert_to_indexed (GimpImage *gimage)
GtkWidget *hbox;
GtkWidget *label;
GtkWidget *text;
GtkObject *adjustment;
GtkWidget *spinbutton;
GtkWidget *frame;
GtkWidget *toggle;
GSList *group = NULL;
gint maxval;
dialog = g_new(IndexedDialog, 1);
dialog->gimage = gimage;
@ -368,8 +372,6 @@ convert_to_indexed (GimpImage *gimage)
gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, FALSE, 0);
gtk_widget_show (label);
text = gtk_entry_new ();
{
if (dialog->num_cols == 256)
{
if ((!gimage_is_empty (gimage))
@ -381,27 +383,26 @@ convert_to_indexed (GimpImage *gimage)
)
)
{
gtk_entry_set_text (GTK_ENTRY (text), "255");
maxval = 255;
dialog->num_cols = 255;
}
else
{
gtk_entry_set_text (GTK_ENTRY (text), "256");
maxval = 256;
}
}
else
{
gchar tempstr[50];
g_snprintf (tempstr, sizeof (tempstr), "%d", dialog->num_cols);
gtk_entry_set_text (GTK_ENTRY (text), tempstr);
maxval = 256;
}
gtk_widget_set_usize (text, 50, 25);
gtk_box_pack_start (GTK_BOX (hbox), text, FALSE, FALSE, 0);
gtk_signal_connect (GTK_OBJECT (text), "changed",
spinbutton = gimp_spin_button_new (&adjustment, dialog->num_cols,
2, maxval, 1, 5, 0, 1, 0);
gtk_signal_connect (GTK_OBJECT (adjustment), "value_changed",
(GtkSignalFunc) indexed_num_cols_update,
dialog);
}
gtk_widget_show (text);
gtk_box_pack_start (GTK_BOX (hbox), spinbutton, FALSE, FALSE, 0);
gtk_widget_show (spinbutton);
gtk_widget_show (hbox);
if (TRUE /* gimage->base_type == RGB */ )
@ -701,12 +702,7 @@ static void
indexed_num_cols_update (GtkWidget *w,
gpointer data)
{
IndexedDialog *dialog;
char *str;
str = gtk_entry_get_text (GTK_ENTRY (w));
dialog = (IndexedDialog *) data;
dialog->num_cols = BOUNDS(((int) atof (str)), 1, 256);
((IndexedDialog *) data)->num_cols = GTK_ADJUSTMENT (w)->value;
}
static void

View File

@ -87,6 +87,7 @@
#include "interface.h"
#include "undo.h"
#include "palette.h"
#include "preferences_dialog.h" /* ick. */
#include "libgimp/gimpintl.h"
@ -316,9 +317,12 @@ convert_to_indexed (GimpImage *gimage)
GtkWidget *hbox;
GtkWidget *label;
GtkWidget *text;
GtkObject *adjustment;
GtkWidget *spinbutton;
GtkWidget *frame;
GtkWidget *toggle;
GSList *group = NULL;
gint maxval;
dialog = g_new(IndexedDialog, 1);
dialog->gimage = gimage;
@ -368,8 +372,6 @@ convert_to_indexed (GimpImage *gimage)
gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, FALSE, 0);
gtk_widget_show (label);
text = gtk_entry_new ();
{
if (dialog->num_cols == 256)
{
if ((!gimage_is_empty (gimage))
@ -381,27 +383,26 @@ convert_to_indexed (GimpImage *gimage)
)
)
{
gtk_entry_set_text (GTK_ENTRY (text), "255");
maxval = 255;
dialog->num_cols = 255;
}
else
{
gtk_entry_set_text (GTK_ENTRY (text), "256");
maxval = 256;
}
}
else
{
gchar tempstr[50];
g_snprintf (tempstr, sizeof (tempstr), "%d", dialog->num_cols);
gtk_entry_set_text (GTK_ENTRY (text), tempstr);
maxval = 256;
}
gtk_widget_set_usize (text, 50, 25);
gtk_box_pack_start (GTK_BOX (hbox), text, FALSE, FALSE, 0);
gtk_signal_connect (GTK_OBJECT (text), "changed",
spinbutton = gimp_spin_button_new (&adjustment, dialog->num_cols,
2, maxval, 1, 5, 0, 1, 0);
gtk_signal_connect (GTK_OBJECT (adjustment), "value_changed",
(GtkSignalFunc) indexed_num_cols_update,
dialog);
}
gtk_widget_show (text);
gtk_box_pack_start (GTK_BOX (hbox), spinbutton, FALSE, FALSE, 0);
gtk_widget_show (spinbutton);
gtk_widget_show (hbox);
if (TRUE /* gimage->base_type == RGB */ )
@ -701,12 +702,7 @@ static void
indexed_num_cols_update (GtkWidget *w,
gpointer data)
{
IndexedDialog *dialog;
char *str;
str = gtk_entry_get_text (GTK_ENTRY (w));
dialog = (IndexedDialog *) data;
dialog->num_cols = BOUNDS(((int) atof (str)), 1, 256);
((IndexedDialog *) data)->num_cols = GTK_ADJUSTMENT (w)->value;
}
static void

View File

@ -20,5 +20,14 @@
#define __PREFERENCES_DIALOG_H__
void file_pref_cmd_callback (GtkWidget *, gpointer);
GtkWidget* gimp_spin_button_new (GtkObject **,
gfloat,
gfloat,
gfloat,
gfloat,
gfloat,
gfloat,
gfloat,
guint);
#endif /* __PREFERENCES_DIALOG_H__ */

View File

@ -87,6 +87,7 @@
#include "interface.h"
#include "undo.h"
#include "palette.h"
#include "preferences_dialog.h" /* ick. */
#include "libgimp/gimpintl.h"
@ -316,9 +317,12 @@ convert_to_indexed (GimpImage *gimage)
GtkWidget *hbox;
GtkWidget *label;
GtkWidget *text;
GtkObject *adjustment;
GtkWidget *spinbutton;
GtkWidget *frame;
GtkWidget *toggle;
GSList *group = NULL;
gint maxval;
dialog = g_new(IndexedDialog, 1);
dialog->gimage = gimage;
@ -368,8 +372,6 @@ convert_to_indexed (GimpImage *gimage)
gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, FALSE, 0);
gtk_widget_show (label);
text = gtk_entry_new ();
{
if (dialog->num_cols == 256)
{
if ((!gimage_is_empty (gimage))
@ -381,27 +383,26 @@ convert_to_indexed (GimpImage *gimage)
)
)
{
gtk_entry_set_text (GTK_ENTRY (text), "255");
maxval = 255;
dialog->num_cols = 255;
}
else
{
gtk_entry_set_text (GTK_ENTRY (text), "256");
maxval = 256;
}
}
else
{
gchar tempstr[50];
g_snprintf (tempstr, sizeof (tempstr), "%d", dialog->num_cols);
gtk_entry_set_text (GTK_ENTRY (text), tempstr);
maxval = 256;
}
gtk_widget_set_usize (text, 50, 25);
gtk_box_pack_start (GTK_BOX (hbox), text, FALSE, FALSE, 0);
gtk_signal_connect (GTK_OBJECT (text), "changed",
spinbutton = gimp_spin_button_new (&adjustment, dialog->num_cols,
2, maxval, 1, 5, 0, 1, 0);
gtk_signal_connect (GTK_OBJECT (adjustment), "value_changed",
(GtkSignalFunc) indexed_num_cols_update,
dialog);
}
gtk_widget_show (text);
gtk_box_pack_start (GTK_BOX (hbox), spinbutton, FALSE, FALSE, 0);
gtk_widget_show (spinbutton);
gtk_widget_show (hbox);
if (TRUE /* gimage->base_type == RGB */ )
@ -701,12 +702,7 @@ static void
indexed_num_cols_update (GtkWidget *w,
gpointer data)
{
IndexedDialog *dialog;
char *str;
str = gtk_entry_get_text (GTK_ENTRY (w));
dialog = (IndexedDialog *) data;
dialog->num_cols = BOUNDS(((int) atof (str)), 1, 256);
((IndexedDialog *) data)->num_cols = GTK_ADJUSTMENT (w)->value;
}
static void

View File

@ -20,5 +20,14 @@
#define __PREFERENCES_DIALOG_H__
void file_pref_cmd_callback (GtkWidget *, gpointer);
GtkWidget* gimp_spin_button_new (GtkObject **,
gfloat,
gfloat,
gfloat,
gfloat,
gfloat,
gfloat,
gfloat,
guint);
#endif /* __PREFERENCES_DIALOG_H__ */

View File

@ -20,5 +20,14 @@
#define __PREFERENCES_DIALOG_H__
void file_pref_cmd_callback (GtkWidget *, gpointer);
GtkWidget* gimp_spin_button_new (GtkObject **,
gfloat,
gfloat,
gfloat,
gfloat,
gfloat,
gfloat,
gfloat,
guint);
#endif /* __PREFERENCES_DIALOG_H__ */