Hacking away on the file_new_dilaog.

--Sven
This commit is contained in:
Sven Neumann 1999-03-02 00:31:39 +00:00
parent ad6a04b54b
commit 984d90a5a5
10 changed files with 955 additions and 93 deletions

View File

@ -1,3 +1,15 @@
Tue Mar 2 01:24:41 MET 1999 Sven Neumann <sven@gimp.org>
* libgimp/Makefile.am
* libgimp/chain.xpm
* libgimp/gimpchainbutton.c
* libgimp/gimpchainbutton.h: a mockup for a new widget that
indicates that two entries are connected. Please feel free to
hack this as I'm afraid I won't find the time to finish this.
* app/file_new_dialogs: a first attempt to make the dialog
easier to use w/o loosing the flexibility it provided.
1999-02-28 Jay Cox <jaycox@earthlink.net>
* app/Makefile.am: added gimphistogram*, histogramwidget*,

View File

@ -12,6 +12,7 @@
#include "plug_in.h"
#include "tile_manager_pvt.h"
#include "gdisplay.h"
#include "libgimp/gimpchainbutton.h"
#include "libgimp/gimpsizeentry.h"
#include "libgimp/gimpintl.h"
@ -20,9 +21,10 @@ typedef struct {
GtkWidget *dlg;
GtkWidget *size_sizeentry;
GtkWidget *simple_res;
GtkWidget *resolution_sizeentry;
GtkWidget *couple_resolutions;
GtkWidget *change_size;
GtkWidget *couple_resolutions;
int width;
int height;
@ -42,6 +44,7 @@ static void file_new_cancel_callback (GtkWidget *, gpointer);
static gint file_new_delete_callback (GtkWidget *, GdkEvent *, gpointer);
static void file_new_toggle_callback (GtkWidget *, gpointer);
static void file_new_resolution_callback (GtkWidget *, gpointer);
static void file_new_advanced_res_callback (GtkWidget *, gpointer);
/* static variables */
static int last_width = 256;
@ -184,6 +187,19 @@ file_new_toggle_callback (GtkWidget *widget,
}
}
static void
file_new_advanced_res_callback (GtkWidget *widget,
gpointer data)
{
NewImageValues *vals;
vals = data;
gtk_widget_hide(widget);
gtk_widget_hide(vals->simple_res);
gtk_widget_show(vals->resolution_sizeentry);
gtk_widget_show (vals->couple_resolutions);
}
static void
file_new_resolution_callback (GtkWidget *widget,
gpointer data)
@ -198,39 +214,43 @@ file_new_resolution_callback (GtkWidget *widget,
vals = data;
new_xres = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 0);
new_yres = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 1);
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (vals->couple_resolutions)))
if (widget == vals->simple_res)
{
if (new_xres != xres)
{
yres = new_yres = xres = new_xres;
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (vals->resolution_sizeentry), 1, yres);
xres = new_xres;
yres = xres;
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (vals->resolution_sizeentry), 1, xres);
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (vals->resolution_sizeentry), 0, yres);
}
if (new_yres != yres)
{
xres = new_xres = yres = new_yres;
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (vals->resolution_sizeentry), 0, xres);
}
}
else
}
else
{
if (new_xres != xres)
xres = new_xres;
if (new_yres != yres)
yres = new_yres;
new_yres = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 1);
if (gimp_chain_button_get_active (GIMP_CHAIN_BUTTON (vals->couple_resolutions)))
{
if (new_xres != xres)
{
yres = new_yres = xres = new_xres;
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (vals->resolution_sizeentry), 1, yres);
}
if (new_yres != yres)
{
xres = new_xres = yres = new_yres;
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (vals->resolution_sizeentry), 0, xres);
}
}
}
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (vals->size_sizeentry), 0,
xres,
!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (vals->change_size)));
FALSE);
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (vals->size_sizeentry), 1,
yres,
!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (vals->change_size)));
FALSE);
}
void
file_new_cmd_callback (GtkWidget *widget,
gpointer callback_data,
@ -244,6 +264,8 @@ file_new_cmd_callback (GtkWidget *widget,
GtkWidget *hbox;
GtkWidget *frame;
GtkWidget *radio_box;
gboolean advanced_options = FALSE;
GtkWidget *advanced_button;
GSList *group;
/* this value is from gimprc.h */
@ -294,6 +316,9 @@ file_new_cmd_callback (GtkWidget *widget,
vals->res_unit = last_res_unit;
}
if (vals->xresolution != vals->yresolution)
advanced_options = TRUE;
if (vals->type == INDEXED)
vals->type = RGB; /* no indexed images */
@ -372,6 +397,7 @@ file_new_cmd_callback (GtkWidget *widget,
_("Pixels"), 1, 4, 0.0);
gtk_container_set_border_width (GTK_CONTAINER (vals->size_sizeentry), 4);
gtk_box_pack_start (GTK_BOX (vbox), vals->size_sizeentry, TRUE, TRUE, 0);
gtk_widget_show (vals->size_sizeentry);
/* resolution frame */
@ -385,6 +411,23 @@ file_new_cmd_callback (GtkWidget *widget,
gtk_container_add (GTK_CONTAINER (frame), vbox2);
gtk_widget_show (vbox2);
vals->simple_res = gimp_size_entry_new (1, vals->res_unit, "%s",
FALSE, FALSE, 75,
GIMP_SIZE_ENTRY_UPDATE_RESOLUTION);
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (vals->simple_res),
0, 1, 32767);
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (vals->simple_res), 0,
MIN(vals->xresolution, vals->yresolution));
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (vals->simple_res),
_("pixels per "), 1, 2, 0.0);
gtk_signal_connect (GTK_OBJECT (vals->simple_res), "value_changed",
(GtkSignalFunc)file_new_resolution_callback, vals);
gtk_box_pack_start (GTK_BOX (vbox2), vals->simple_res, TRUE, TRUE, 0);
if (!advanced_options)
gtk_widget_show (vals->simple_res);
/* the advanced resolution stuff
(not shown by default, but used to keep track of all the variables) */
vals->resolution_sizeentry = gimp_size_entry_new (2, vals->res_unit, "%s",
FALSE, TRUE, 75,
GIMP_SIZE_ENTRY_UPDATE_RESOLUTION);
@ -404,24 +447,38 @@ file_new_cmd_callback (GtkWidget *widget,
_("dpi"), 1, 3, 0.0);
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (vals->resolution_sizeentry),
_("pixels per "), 2, 3, 0.0);
vals->couple_resolutions = gimp_chain_button_new (GIMP_CHAIN_BOTTOM);
gimp_chain_button_set_active (GIMP_CHAIN_BUTTON (vals->couple_resolutions), TRUE);
gtk_table_attach_defaults (GTK_TABLE (vals->resolution_sizeentry),
vals->couple_resolutions, 1, 3, 3, 4);
gtk_signal_connect (GTK_OBJECT (vals->resolution_sizeentry), "value_changed",
(GtkSignalFunc)file_new_resolution_callback, vals);
gtk_signal_connect (GTK_OBJECT (vals->resolution_sizeentry), "refval_changed",
(GtkSignalFunc)file_new_resolution_callback, vals);
gtk_box_pack_start (GTK_BOX (vbox2), vals->resolution_sizeentry,
TRUE, TRUE, 0);
gtk_widget_show (vals->resolution_sizeentry);
if (advanced_options)
{
gtk_widget_show (vals->resolution_sizeentry);
gtk_widget_show (vals->couple_resolutions);
}
vals->couple_resolutions = gtk_check_button_new_with_label (_("Force equal horizontal and vertical resolutions"));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (vals->couple_resolutions),
TRUE);
gtk_box_pack_start (GTK_BOX (vbox2), vals->couple_resolutions, TRUE, TRUE, 0);
gtk_widget_show (vals->couple_resolutions);
/* This code is commented out since it seems to be overkill...
* vals->change_size = gtk_check_button_new_with_label (_("Change image size with resolution changes"));
* gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (vals->change_size), TRUE);
* gtk_box_pack_start (GTK_BOX (vbox2), vals->change_size, TRUE, TRUE, 0);
* gtk_widget_show (vals->change_size);
*/
vals->change_size = gtk_check_button_new_with_label (_("Change image size with resolution changes"));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (vals->change_size), TRUE);
gtk_box_pack_start (GTK_BOX (vbox2), vals->change_size, TRUE, TRUE, 0);
gtk_widget_show (vals->change_size);
if (advanced_options)
advanced_button = gtk_button_new_with_label (_("Advanced options <<"));
else
advanced_button = gtk_button_new_with_label (_("Advanced options >>"));
gtk_box_pack_start (GTK_BOX (vbox2), advanced_button,
FALSE, FALSE, 0);
gtk_signal_connect (GTK_OBJECT (advanced_button), "clicked",
(GtkSignalFunc)file_new_advanced_res_callback, vals);
gtk_widget_show (advanced_button);
/* hbox containing the Image type and fill type frames */
hbox = gtk_hbox_new(FALSE, 1);

View File

@ -12,6 +12,7 @@
#include "plug_in.h"
#include "tile_manager_pvt.h"
#include "gdisplay.h"
#include "libgimp/gimpchainbutton.h"
#include "libgimp/gimpsizeentry.h"
#include "libgimp/gimpintl.h"
@ -20,9 +21,10 @@ typedef struct {
GtkWidget *dlg;
GtkWidget *size_sizeentry;
GtkWidget *simple_res;
GtkWidget *resolution_sizeentry;
GtkWidget *couple_resolutions;
GtkWidget *change_size;
GtkWidget *couple_resolutions;
int width;
int height;
@ -42,6 +44,7 @@ static void file_new_cancel_callback (GtkWidget *, gpointer);
static gint file_new_delete_callback (GtkWidget *, GdkEvent *, gpointer);
static void file_new_toggle_callback (GtkWidget *, gpointer);
static void file_new_resolution_callback (GtkWidget *, gpointer);
static void file_new_advanced_res_callback (GtkWidget *, gpointer);
/* static variables */
static int last_width = 256;
@ -184,6 +187,19 @@ file_new_toggle_callback (GtkWidget *widget,
}
}
static void
file_new_advanced_res_callback (GtkWidget *widget,
gpointer data)
{
NewImageValues *vals;
vals = data;
gtk_widget_hide(widget);
gtk_widget_hide(vals->simple_res);
gtk_widget_show(vals->resolution_sizeentry);
gtk_widget_show (vals->couple_resolutions);
}
static void
file_new_resolution_callback (GtkWidget *widget,
gpointer data)
@ -198,39 +214,43 @@ file_new_resolution_callback (GtkWidget *widget,
vals = data;
new_xres = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 0);
new_yres = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 1);
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (vals->couple_resolutions)))
if (widget == vals->simple_res)
{
if (new_xres != xres)
{
yres = new_yres = xres = new_xres;
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (vals->resolution_sizeentry), 1, yres);
xres = new_xres;
yres = xres;
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (vals->resolution_sizeentry), 1, xres);
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (vals->resolution_sizeentry), 0, yres);
}
if (new_yres != yres)
{
xres = new_xres = yres = new_yres;
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (vals->resolution_sizeentry), 0, xres);
}
}
else
}
else
{
if (new_xres != xres)
xres = new_xres;
if (new_yres != yres)
yres = new_yres;
new_yres = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 1);
if (gimp_chain_button_get_active (GIMP_CHAIN_BUTTON (vals->couple_resolutions)))
{
if (new_xres != xres)
{
yres = new_yres = xres = new_xres;
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (vals->resolution_sizeentry), 1, yres);
}
if (new_yres != yres)
{
xres = new_xres = yres = new_yres;
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (vals->resolution_sizeentry), 0, xres);
}
}
}
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (vals->size_sizeentry), 0,
xres,
!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (vals->change_size)));
FALSE);
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (vals->size_sizeentry), 1,
yres,
!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (vals->change_size)));
FALSE);
}
void
file_new_cmd_callback (GtkWidget *widget,
gpointer callback_data,
@ -244,6 +264,8 @@ file_new_cmd_callback (GtkWidget *widget,
GtkWidget *hbox;
GtkWidget *frame;
GtkWidget *radio_box;
gboolean advanced_options = FALSE;
GtkWidget *advanced_button;
GSList *group;
/* this value is from gimprc.h */
@ -294,6 +316,9 @@ file_new_cmd_callback (GtkWidget *widget,
vals->res_unit = last_res_unit;
}
if (vals->xresolution != vals->yresolution)
advanced_options = TRUE;
if (vals->type == INDEXED)
vals->type = RGB; /* no indexed images */
@ -372,6 +397,7 @@ file_new_cmd_callback (GtkWidget *widget,
_("Pixels"), 1, 4, 0.0);
gtk_container_set_border_width (GTK_CONTAINER (vals->size_sizeentry), 4);
gtk_box_pack_start (GTK_BOX (vbox), vals->size_sizeentry, TRUE, TRUE, 0);
gtk_widget_show (vals->size_sizeentry);
/* resolution frame */
@ -385,6 +411,23 @@ file_new_cmd_callback (GtkWidget *widget,
gtk_container_add (GTK_CONTAINER (frame), vbox2);
gtk_widget_show (vbox2);
vals->simple_res = gimp_size_entry_new (1, vals->res_unit, "%s",
FALSE, FALSE, 75,
GIMP_SIZE_ENTRY_UPDATE_RESOLUTION);
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (vals->simple_res),
0, 1, 32767);
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (vals->simple_res), 0,
MIN(vals->xresolution, vals->yresolution));
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (vals->simple_res),
_("pixels per "), 1, 2, 0.0);
gtk_signal_connect (GTK_OBJECT (vals->simple_res), "value_changed",
(GtkSignalFunc)file_new_resolution_callback, vals);
gtk_box_pack_start (GTK_BOX (vbox2), vals->simple_res, TRUE, TRUE, 0);
if (!advanced_options)
gtk_widget_show (vals->simple_res);
/* the advanced resolution stuff
(not shown by default, but used to keep track of all the variables) */
vals->resolution_sizeentry = gimp_size_entry_new (2, vals->res_unit, "%s",
FALSE, TRUE, 75,
GIMP_SIZE_ENTRY_UPDATE_RESOLUTION);
@ -404,24 +447,38 @@ file_new_cmd_callback (GtkWidget *widget,
_("dpi"), 1, 3, 0.0);
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (vals->resolution_sizeentry),
_("pixels per "), 2, 3, 0.0);
vals->couple_resolutions = gimp_chain_button_new (GIMP_CHAIN_BOTTOM);
gimp_chain_button_set_active (GIMP_CHAIN_BUTTON (vals->couple_resolutions), TRUE);
gtk_table_attach_defaults (GTK_TABLE (vals->resolution_sizeentry),
vals->couple_resolutions, 1, 3, 3, 4);
gtk_signal_connect (GTK_OBJECT (vals->resolution_sizeentry), "value_changed",
(GtkSignalFunc)file_new_resolution_callback, vals);
gtk_signal_connect (GTK_OBJECT (vals->resolution_sizeentry), "refval_changed",
(GtkSignalFunc)file_new_resolution_callback, vals);
gtk_box_pack_start (GTK_BOX (vbox2), vals->resolution_sizeentry,
TRUE, TRUE, 0);
gtk_widget_show (vals->resolution_sizeentry);
if (advanced_options)
{
gtk_widget_show (vals->resolution_sizeentry);
gtk_widget_show (vals->couple_resolutions);
}
vals->couple_resolutions = gtk_check_button_new_with_label (_("Force equal horizontal and vertical resolutions"));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (vals->couple_resolutions),
TRUE);
gtk_box_pack_start (GTK_BOX (vbox2), vals->couple_resolutions, TRUE, TRUE, 0);
gtk_widget_show (vals->couple_resolutions);
/* This code is commented out since it seems to be overkill...
* vals->change_size = gtk_check_button_new_with_label (_("Change image size with resolution changes"));
* gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (vals->change_size), TRUE);
* gtk_box_pack_start (GTK_BOX (vbox2), vals->change_size, TRUE, TRUE, 0);
* gtk_widget_show (vals->change_size);
*/
vals->change_size = gtk_check_button_new_with_label (_("Change image size with resolution changes"));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (vals->change_size), TRUE);
gtk_box_pack_start (GTK_BOX (vbox2), vals->change_size, TRUE, TRUE, 0);
gtk_widget_show (vals->change_size);
if (advanced_options)
advanced_button = gtk_button_new_with_label (_("Advanced options <<"));
else
advanced_button = gtk_button_new_with_label (_("Advanced options >>"));
gtk_box_pack_start (GTK_BOX (vbox2), advanced_button,
FALSE, FALSE, 0);
gtk_signal_connect (GTK_OBJECT (advanced_button), "clicked",
(GtkSignalFunc)file_new_advanced_res_callback, vals);
gtk_widget_show (advanced_button);
/* hbox containing the Image type and fill type frames */
hbox = gtk_hbox_new(FALSE, 1);

View File

@ -12,6 +12,7 @@
#include "plug_in.h"
#include "tile_manager_pvt.h"
#include "gdisplay.h"
#include "libgimp/gimpchainbutton.h"
#include "libgimp/gimpsizeentry.h"
#include "libgimp/gimpintl.h"
@ -20,9 +21,10 @@ typedef struct {
GtkWidget *dlg;
GtkWidget *size_sizeentry;
GtkWidget *simple_res;
GtkWidget *resolution_sizeentry;
GtkWidget *couple_resolutions;
GtkWidget *change_size;
GtkWidget *couple_resolutions;
int width;
int height;
@ -42,6 +44,7 @@ static void file_new_cancel_callback (GtkWidget *, gpointer);
static gint file_new_delete_callback (GtkWidget *, GdkEvent *, gpointer);
static void file_new_toggle_callback (GtkWidget *, gpointer);
static void file_new_resolution_callback (GtkWidget *, gpointer);
static void file_new_advanced_res_callback (GtkWidget *, gpointer);
/* static variables */
static int last_width = 256;
@ -184,6 +187,19 @@ file_new_toggle_callback (GtkWidget *widget,
}
}
static void
file_new_advanced_res_callback (GtkWidget *widget,
gpointer data)
{
NewImageValues *vals;
vals = data;
gtk_widget_hide(widget);
gtk_widget_hide(vals->simple_res);
gtk_widget_show(vals->resolution_sizeentry);
gtk_widget_show (vals->couple_resolutions);
}
static void
file_new_resolution_callback (GtkWidget *widget,
gpointer data)
@ -198,39 +214,43 @@ file_new_resolution_callback (GtkWidget *widget,
vals = data;
new_xres = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 0);
new_yres = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 1);
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (vals->couple_resolutions)))
if (widget == vals->simple_res)
{
if (new_xres != xres)
{
yres = new_yres = xres = new_xres;
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (vals->resolution_sizeentry), 1, yres);
xres = new_xres;
yres = xres;
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (vals->resolution_sizeentry), 1, xres);
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (vals->resolution_sizeentry), 0, yres);
}
if (new_yres != yres)
{
xres = new_xres = yres = new_yres;
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (vals->resolution_sizeentry), 0, xres);
}
}
else
}
else
{
if (new_xres != xres)
xres = new_xres;
if (new_yres != yres)
yres = new_yres;
new_yres = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 1);
if (gimp_chain_button_get_active (GIMP_CHAIN_BUTTON (vals->couple_resolutions)))
{
if (new_xres != xres)
{
yres = new_yres = xres = new_xres;
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (vals->resolution_sizeentry), 1, yres);
}
if (new_yres != yres)
{
xres = new_xres = yres = new_yres;
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (vals->resolution_sizeentry), 0, xres);
}
}
}
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (vals->size_sizeentry), 0,
xres,
!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (vals->change_size)));
FALSE);
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (vals->size_sizeentry), 1,
yres,
!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (vals->change_size)));
FALSE);
}
void
file_new_cmd_callback (GtkWidget *widget,
gpointer callback_data,
@ -244,6 +264,8 @@ file_new_cmd_callback (GtkWidget *widget,
GtkWidget *hbox;
GtkWidget *frame;
GtkWidget *radio_box;
gboolean advanced_options = FALSE;
GtkWidget *advanced_button;
GSList *group;
/* this value is from gimprc.h */
@ -294,6 +316,9 @@ file_new_cmd_callback (GtkWidget *widget,
vals->res_unit = last_res_unit;
}
if (vals->xresolution != vals->yresolution)
advanced_options = TRUE;
if (vals->type == INDEXED)
vals->type = RGB; /* no indexed images */
@ -372,6 +397,7 @@ file_new_cmd_callback (GtkWidget *widget,
_("Pixels"), 1, 4, 0.0);
gtk_container_set_border_width (GTK_CONTAINER (vals->size_sizeentry), 4);
gtk_box_pack_start (GTK_BOX (vbox), vals->size_sizeentry, TRUE, TRUE, 0);
gtk_widget_show (vals->size_sizeentry);
/* resolution frame */
@ -385,6 +411,23 @@ file_new_cmd_callback (GtkWidget *widget,
gtk_container_add (GTK_CONTAINER (frame), vbox2);
gtk_widget_show (vbox2);
vals->simple_res = gimp_size_entry_new (1, vals->res_unit, "%s",
FALSE, FALSE, 75,
GIMP_SIZE_ENTRY_UPDATE_RESOLUTION);
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (vals->simple_res),
0, 1, 32767);
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (vals->simple_res), 0,
MIN(vals->xresolution, vals->yresolution));
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (vals->simple_res),
_("pixels per "), 1, 2, 0.0);
gtk_signal_connect (GTK_OBJECT (vals->simple_res), "value_changed",
(GtkSignalFunc)file_new_resolution_callback, vals);
gtk_box_pack_start (GTK_BOX (vbox2), vals->simple_res, TRUE, TRUE, 0);
if (!advanced_options)
gtk_widget_show (vals->simple_res);
/* the advanced resolution stuff
(not shown by default, but used to keep track of all the variables) */
vals->resolution_sizeentry = gimp_size_entry_new (2, vals->res_unit, "%s",
FALSE, TRUE, 75,
GIMP_SIZE_ENTRY_UPDATE_RESOLUTION);
@ -404,24 +447,38 @@ file_new_cmd_callback (GtkWidget *widget,
_("dpi"), 1, 3, 0.0);
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (vals->resolution_sizeentry),
_("pixels per "), 2, 3, 0.0);
vals->couple_resolutions = gimp_chain_button_new (GIMP_CHAIN_BOTTOM);
gimp_chain_button_set_active (GIMP_CHAIN_BUTTON (vals->couple_resolutions), TRUE);
gtk_table_attach_defaults (GTK_TABLE (vals->resolution_sizeentry),
vals->couple_resolutions, 1, 3, 3, 4);
gtk_signal_connect (GTK_OBJECT (vals->resolution_sizeentry), "value_changed",
(GtkSignalFunc)file_new_resolution_callback, vals);
gtk_signal_connect (GTK_OBJECT (vals->resolution_sizeentry), "refval_changed",
(GtkSignalFunc)file_new_resolution_callback, vals);
gtk_box_pack_start (GTK_BOX (vbox2), vals->resolution_sizeentry,
TRUE, TRUE, 0);
gtk_widget_show (vals->resolution_sizeentry);
if (advanced_options)
{
gtk_widget_show (vals->resolution_sizeentry);
gtk_widget_show (vals->couple_resolutions);
}
vals->couple_resolutions = gtk_check_button_new_with_label (_("Force equal horizontal and vertical resolutions"));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (vals->couple_resolutions),
TRUE);
gtk_box_pack_start (GTK_BOX (vbox2), vals->couple_resolutions, TRUE, TRUE, 0);
gtk_widget_show (vals->couple_resolutions);
/* This code is commented out since it seems to be overkill...
* vals->change_size = gtk_check_button_new_with_label (_("Change image size with resolution changes"));
* gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (vals->change_size), TRUE);
* gtk_box_pack_start (GTK_BOX (vbox2), vals->change_size, TRUE, TRUE, 0);
* gtk_widget_show (vals->change_size);
*/
vals->change_size = gtk_check_button_new_with_label (_("Change image size with resolution changes"));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (vals->change_size), TRUE);
gtk_box_pack_start (GTK_BOX (vbox2), vals->change_size, TRUE, TRUE, 0);
gtk_widget_show (vals->change_size);
if (advanced_options)
advanced_button = gtk_button_new_with_label (_("Advanced options <<"));
else
advanced_button = gtk_button_new_with_label (_("Advanced options >>"));
gtk_box_pack_start (GTK_BOX (vbox2), advanced_button,
FALSE, FALSE, 0);
gtk_signal_connect (GTK_OBJECT (advanced_button), "clicked",
(GtkSignalFunc)file_new_advanced_res_callback, vals);
gtk_widget_show (advanced_button);
/* hbox containing the Image type and fill type frames */
hbox = gtk_hbox_new(FALSE, 1);

View File

@ -19,6 +19,8 @@ lib_LTLIBRARIES = libgimp.la libgimpui.la
noinst_LIBRARIES = libgimpi.a
libgimpi_a_SOURCES = \
gimpchainbutton.c \
gimpchainbutton.h \
gimpmatrix.c \
gimpmatrix.h \
gimpprotocol.c \
@ -77,6 +79,7 @@ libgimpui_la_SOURCES = \
gimpinclude_HEADERS = \
color_selector.h \
gimp.h \
gimpchainbutton.h \
gimpenums.h \
gimpfeatures.h \
gimpmatrix.h \

118
libgimp/chain.xpm Normal file
View File

@ -0,0 +1,118 @@
/* XPM */
static char * chain_hor_xpm[] = {
"24 9 9 1",
" c None",
". c #020204",
"+ c #5A5A5C",
"@ c #E8E8E9",
"# c #D0D0D1",
"$ c #8F8F91",
"% c #B5B5B6",
"& c #6E6E6E",
"* c #9A9A98",
" ",
" ....... ....... ",
" .+@####$. .$%@@@@%. ",
" .%................@. ",
" .#. .&%###%. .#. ",
" .#................@. ",
" .&*##%*$. .&%%%%#&. ",
" ....... ....... ",
" "};
/* XPM */
static char * chain_ver_xpm[] = {
"9 24 9 1",
" c None",
". c #020204",
"+ c #6E6E6E",
"@ c #D0D0D1",
"# c #B5B5B6",
"$ c #5A5A5C",
"% c #9A9A98",
"& c #E8E8E9",
"* c #8F8F91",
" ",
" ",
" ..... ",
" .+@@#$. ",
" .%...&. ",
" .@. .@. ",
" .@. .@. ",
" .#. .@. ",
" .%...@. ",
" .*.+.*. ",
" ..#.. ",
" .@. ",
" .@. ",
" ..@.. ",
" .+.#.*. ",
" .#...#. ",
" .#. .&. ",
" .#. .&. ",
" .#. .&. ",
" .@...&. ",
" .+&@&#. ",
" ..... ",
" ",
" "};
/* XPM */
static char * chain_broken_hor_xpm[] = {
"24 9 9 1",
" c None",
". c #020204",
"+ c #5A5A5C",
"@ c #E8E8E9",
"# c #D0D0D1",
"$ c #8F8F91",
"% c #B5B5B6",
"& c #6E6E6E",
"* c #9A9A98",
" ",
" ....... ....... ",
".+@####$. .$%@@@@%.",
".%........ ........@.",
".#. .&%# ##%. .#.",
".#........ ........@.",
".&*##%*$. .&%%%%#&.",
" ....... ....... ",
" "};
/* XPM */
static char * chain_broken_ver_xpm[] = {
"9 24 9 1",
" c None",
". c #020204",
"+ c #6E6E6E",
"@ c #D0D0D1",
"# c #B5B5B6",
"$ c #5A5A5C",
"% c #9A9A98",
"& c #E8E8E9",
"* c #8F8F91",
" ..... ",
" .+@@#$. ",
" .%...&. ",
" .@. .@. ",
" .@. .@. ",
" .#. .@. ",
" .%...@. ",
" .*.+.*. ",
" ..#.. ",
" .@. ",
" ",
" ",
" ",
" ",
" .@. ",
" ..@.. ",
" .+.#.*. ",
" .#...#. ",
" .#. .&. ",
" .#. .&. ",
" .#. .&. ",
" .@...&. ",
" .+&@&#. ",
" ..... "};

192
libgimp/gimpchainbutton.c Normal file
View File

@ -0,0 +1,192 @@
/* LIBGIMP - The GIMP Library
* Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include "gimpchainbutton.h"
#include "chain.xpm"
static char **gimp_chain_xpm[] = {
chain_hor_xpm,
chain_ver_xpm
};
static char **gimp_chain_broken_xpm[] = {
chain_broken_hor_xpm,
chain_broken_ver_xpm
};
void gimp_chain_button_realize (GtkWidget *widget, GimpChainButton *gcb);
void gimp_chain_button_callback (GtkWidget *widget, GimpChainButton *gcb);
static void
gimp_chain_button_class_init (GimpChainButtonClass *class)
{
GtkObjectClass *object_class;
object_class = (GtkObjectClass*) class;
class->gimp_chain_button = NULL;
}
static void
gimp_chain_button_init (GimpChainButton *gcb)
{
gcb->position = GIMP_CHAIN_TOP;
gcb->tooltips = NULL;
gcb->tip = NULL;
gcb->pixmap = NULL;
gcb->broken = NULL;
gcb->broken_mask = NULL;
gcb->chain = NULL;
gcb->chain_mask = NULL;
gcb->active = FALSE;
gtk_signal_connect (GTK_OBJECT(gcb), "clicked",
GTK_SIGNAL_FUNC(gimp_chain_button_callback), gcb);
/* That's all we do here, since setting the pixmaps won't work before
the parent window is realized.
We connect to the realized-signal instead and do the rest there. */
gtk_signal_connect (GTK_OBJECT(gcb), "realize",
GTK_SIGNAL_FUNC(gimp_chain_button_realize), gcb);
}
guint
gimp_chain_button_get_type ()
{
static guint gcb_type = 0;
if (!gcb_type)
{
GtkTypeInfo gcb_info =
{
"GimpChainButton",
sizeof (GimpChainButton),
sizeof (GimpChainButtonClass),
(GtkClassInitFunc) gimp_chain_button_class_init,
(GtkObjectInitFunc) gimp_chain_button_init,
/* reserved_1 */ NULL,
/* reserved_2 */ NULL,
(GtkClassInitFunc) NULL
};
gcb_type = gtk_type_unique (gtk_button_get_type (), &gcb_info);
}
return gcb_type;
}
GtkWidget*
gimp_chain_button_new (GimpChainPosition position)
{
GimpChainButton *gcb;
gcb = gtk_type_new (gimp_chain_button_get_type ());
gcb->position = position;
gtk_button_set_relief (GTK_BUTTON(gcb), GTK_RELIEF_NONE);
return (GTK_WIDGET(gcb));
}
void
gimp_chain_button_realize (GtkWidget *widget, GimpChainButton *gcb)
{
GtkStyle *style;
GtkWidget *parent;
GtkWidget *box;
parent = GTK_WIDGET(gcb)->parent;
if (!GTK_WIDGET_REALIZED (parent))
return;
style = gtk_widget_get_style (parent);
gcb->chain = gdk_pixmap_create_from_xpm_d (parent->window,
&gcb->chain_mask,
&style->bg[GTK_STATE_NORMAL],
gimp_chain_xpm[gcb->position % 2]);
gcb->broken = gdk_pixmap_create_from_xpm_d (parent->window,
&gcb->broken_mask,
&style->bg[GTK_STATE_NORMAL],
gimp_chain_broken_xpm[gcb->position % 2]);
if (gcb->active)
gcb->pixmap = gtk_pixmap_new (gcb->chain, gcb->chain_mask);
else
gcb->pixmap = gtk_pixmap_new (gcb->broken, gcb->broken_mask);
box = gtk_hbox_new (FALSE, 0);
gtk_container_border_width (GTK_CONTAINER (box), 0);
gtk_container_add (GTK_CONTAINER (gcb), box);
gtk_box_pack_start (GTK_BOX (box), gcb->pixmap, TRUE, TRUE, 2);
gtk_widget_show (gcb->pixmap);
gtk_widget_show (box);
}
void
gimp_chain_button_callback (GtkWidget *widget, GimpChainButton *gcb)
{
g_return_if_fail (gcb != NULL);
g_return_if_fail (GIMP_IS_CHAIN_BUTTON (gcb));
gcb->active = !(gcb->active);
if (!GTK_WIDGET_REALIZED (GTK_WIDGET(gcb)))
return;
if (gcb->active)
gtk_pixmap_set (GTK_PIXMAP(gcb->pixmap), gcb->chain, gcb->chain_mask);
else
gtk_pixmap_set (GTK_PIXMAP(gcb->pixmap), gcb->broken, gcb->broken_mask);
}
void
gimp_chain_button_set_active (GimpChainButton *gcb,
gboolean is_active)
{
g_return_if_fail (gcb != NULL);
g_return_if_fail (GIMP_IS_CHAIN_BUTTON (gcb));
is_active = is_active != 0;
if (gcb->active != is_active)
{
gcb->active = is_active;
if (!GTK_WIDGET_REALIZED (GTK_WIDGET(gcb)))
return;
if (gcb->active)
gtk_pixmap_set (GTK_PIXMAP(gcb->pixmap), gcb->chain, gcb->chain_mask);
else
gtk_pixmap_set (GTK_PIXMAP(gcb->pixmap), gcb->broken, gcb->broken_mask);
}
}
gboolean
gimp_chain_button_get_active (GimpChainButton *gcb)
{
g_return_val_if_fail (gcb != NULL, FALSE);
g_return_val_if_fail (GIMP_IS_CHAIN_BUTTON (gcb), FALSE);
return (gcb->active) ? TRUE : FALSE;
}

87
libgimp/gimpchainbutton.h Normal file
View File

@ -0,0 +1,87 @@
/* LIBGIMP - The GIMP Library
* Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/* This implements a widget derived from gtk_button that visualizes
it's state with two different pixmaps showing a closed and a
broken chain. It's intented to be used with the gimpsizeentry
widget. The usage is quite similar to the one the gtk_toggle_button
provides.
*/
#ifndef __GIMP_CHAIN_BUTTON_H__
#define __GIMP_CHAIN_BUTTON_H__
#include <gtk/gtk.h>
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#define GIMP_CHAIN_BUTTON(obj) GTK_CHECK_CAST (obj, gimp_chain_button_get_type (), GimpChainButton)
#define GIMP_CHAIN_BUTTON_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gimp_chain_button_get_type (), GimpChainButtonClass)
#define GIMP_IS_CHAIN_BUTTON(obj) GTK_CHECK_TYPE (obj, gimp_chain_button_get_type ())
typedef struct _GimpChainButton GimpChainButton;
typedef struct _GimpChainButtonClass GimpChainButtonClass;
typedef enum {
GIMP_CHAIN_TOP,
GIMP_CHAIN_LEFT,
GIMP_CHAIN_BOTTOM,
GIMP_CHAIN_RIGHT
} GimpChainPosition;
struct _GimpChainButton
{
GtkHBox hbox;
GimpChainPosition position;
GtkTooltips *tooltips;
gchar *tip;
GtkWidget *pixmap;
GdkPixmap *broken;
GdkBitmap *broken_mask;
GdkPixmap *chain;
GdkBitmap *chain_mask;
gboolean active;
};
struct _GimpChainButtonClass
{
GtkButtonClass parent_class;
void (* gimp_chain_button) (GimpChainButton *gcb);
};
GtkType gimp_chain_button_get_type (void);
GtkWidget* gimp_chain_button_new (GimpChainPosition position);
void gimp_chain_button_set_active (GimpChainButton *gcb,
gboolean is_active);
gboolean gimp_chain_button_get_active (GimpChainButton *gcb);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __CHAIN_BUTTON_H__ */

View File

@ -0,0 +1,192 @@
/* LIBGIMP - The GIMP Library
* Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include "gimpchainbutton.h"
#include "chain.xpm"
static char **gimp_chain_xpm[] = {
chain_hor_xpm,
chain_ver_xpm
};
static char **gimp_chain_broken_xpm[] = {
chain_broken_hor_xpm,
chain_broken_ver_xpm
};
void gimp_chain_button_realize (GtkWidget *widget, GimpChainButton *gcb);
void gimp_chain_button_callback (GtkWidget *widget, GimpChainButton *gcb);
static void
gimp_chain_button_class_init (GimpChainButtonClass *class)
{
GtkObjectClass *object_class;
object_class = (GtkObjectClass*) class;
class->gimp_chain_button = NULL;
}
static void
gimp_chain_button_init (GimpChainButton *gcb)
{
gcb->position = GIMP_CHAIN_TOP;
gcb->tooltips = NULL;
gcb->tip = NULL;
gcb->pixmap = NULL;
gcb->broken = NULL;
gcb->broken_mask = NULL;
gcb->chain = NULL;
gcb->chain_mask = NULL;
gcb->active = FALSE;
gtk_signal_connect (GTK_OBJECT(gcb), "clicked",
GTK_SIGNAL_FUNC(gimp_chain_button_callback), gcb);
/* That's all we do here, since setting the pixmaps won't work before
the parent window is realized.
We connect to the realized-signal instead and do the rest there. */
gtk_signal_connect (GTK_OBJECT(gcb), "realize",
GTK_SIGNAL_FUNC(gimp_chain_button_realize), gcb);
}
guint
gimp_chain_button_get_type ()
{
static guint gcb_type = 0;
if (!gcb_type)
{
GtkTypeInfo gcb_info =
{
"GimpChainButton",
sizeof (GimpChainButton),
sizeof (GimpChainButtonClass),
(GtkClassInitFunc) gimp_chain_button_class_init,
(GtkObjectInitFunc) gimp_chain_button_init,
/* reserved_1 */ NULL,
/* reserved_2 */ NULL,
(GtkClassInitFunc) NULL
};
gcb_type = gtk_type_unique (gtk_button_get_type (), &gcb_info);
}
return gcb_type;
}
GtkWidget*
gimp_chain_button_new (GimpChainPosition position)
{
GimpChainButton *gcb;
gcb = gtk_type_new (gimp_chain_button_get_type ());
gcb->position = position;
gtk_button_set_relief (GTK_BUTTON(gcb), GTK_RELIEF_NONE);
return (GTK_WIDGET(gcb));
}
void
gimp_chain_button_realize (GtkWidget *widget, GimpChainButton *gcb)
{
GtkStyle *style;
GtkWidget *parent;
GtkWidget *box;
parent = GTK_WIDGET(gcb)->parent;
if (!GTK_WIDGET_REALIZED (parent))
return;
style = gtk_widget_get_style (parent);
gcb->chain = gdk_pixmap_create_from_xpm_d (parent->window,
&gcb->chain_mask,
&style->bg[GTK_STATE_NORMAL],
gimp_chain_xpm[gcb->position % 2]);
gcb->broken = gdk_pixmap_create_from_xpm_d (parent->window,
&gcb->broken_mask,
&style->bg[GTK_STATE_NORMAL],
gimp_chain_broken_xpm[gcb->position % 2]);
if (gcb->active)
gcb->pixmap = gtk_pixmap_new (gcb->chain, gcb->chain_mask);
else
gcb->pixmap = gtk_pixmap_new (gcb->broken, gcb->broken_mask);
box = gtk_hbox_new (FALSE, 0);
gtk_container_border_width (GTK_CONTAINER (box), 0);
gtk_container_add (GTK_CONTAINER (gcb), box);
gtk_box_pack_start (GTK_BOX (box), gcb->pixmap, TRUE, TRUE, 2);
gtk_widget_show (gcb->pixmap);
gtk_widget_show (box);
}
void
gimp_chain_button_callback (GtkWidget *widget, GimpChainButton *gcb)
{
g_return_if_fail (gcb != NULL);
g_return_if_fail (GIMP_IS_CHAIN_BUTTON (gcb));
gcb->active = !(gcb->active);
if (!GTK_WIDGET_REALIZED (GTK_WIDGET(gcb)))
return;
if (gcb->active)
gtk_pixmap_set (GTK_PIXMAP(gcb->pixmap), gcb->chain, gcb->chain_mask);
else
gtk_pixmap_set (GTK_PIXMAP(gcb->pixmap), gcb->broken, gcb->broken_mask);
}
void
gimp_chain_button_set_active (GimpChainButton *gcb,
gboolean is_active)
{
g_return_if_fail (gcb != NULL);
g_return_if_fail (GIMP_IS_CHAIN_BUTTON (gcb));
is_active = is_active != 0;
if (gcb->active != is_active)
{
gcb->active = is_active;
if (!GTK_WIDGET_REALIZED (GTK_WIDGET(gcb)))
return;
if (gcb->active)
gtk_pixmap_set (GTK_PIXMAP(gcb->pixmap), gcb->chain, gcb->chain_mask);
else
gtk_pixmap_set (GTK_PIXMAP(gcb->pixmap), gcb->broken, gcb->broken_mask);
}
}
gboolean
gimp_chain_button_get_active (GimpChainButton *gcb)
{
g_return_val_if_fail (gcb != NULL, FALSE);
g_return_val_if_fail (GIMP_IS_CHAIN_BUTTON (gcb), FALSE);
return (gcb->active) ? TRUE : FALSE;
}

View File

@ -0,0 +1,87 @@
/* LIBGIMP - The GIMP Library
* Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/* This implements a widget derived from gtk_button that visualizes
it's state with two different pixmaps showing a closed and a
broken chain. It's intented to be used with the gimpsizeentry
widget. The usage is quite similar to the one the gtk_toggle_button
provides.
*/
#ifndef __GIMP_CHAIN_BUTTON_H__
#define __GIMP_CHAIN_BUTTON_H__
#include <gtk/gtk.h>
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#define GIMP_CHAIN_BUTTON(obj) GTK_CHECK_CAST (obj, gimp_chain_button_get_type (), GimpChainButton)
#define GIMP_CHAIN_BUTTON_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gimp_chain_button_get_type (), GimpChainButtonClass)
#define GIMP_IS_CHAIN_BUTTON(obj) GTK_CHECK_TYPE (obj, gimp_chain_button_get_type ())
typedef struct _GimpChainButton GimpChainButton;
typedef struct _GimpChainButtonClass GimpChainButtonClass;
typedef enum {
GIMP_CHAIN_TOP,
GIMP_CHAIN_LEFT,
GIMP_CHAIN_BOTTOM,
GIMP_CHAIN_RIGHT
} GimpChainPosition;
struct _GimpChainButton
{
GtkHBox hbox;
GimpChainPosition position;
GtkTooltips *tooltips;
gchar *tip;
GtkWidget *pixmap;
GdkPixmap *broken;
GdkBitmap *broken_mask;
GdkPixmap *chain;
GdkBitmap *chain_mask;
gboolean active;
};
struct _GimpChainButtonClass
{
GtkButtonClass parent_class;
void (* gimp_chain_button) (GimpChainButton *gcb);
};
GtkType gimp_chain_button_get_type (void);
GtkWidget* gimp_chain_button_new (GimpChainPosition position);
void gimp_chain_button_set_active (GimpChainButton *gcb,
gboolean is_active);
gboolean gimp_chain_button_get_active (GimpChainButton *gcb);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __CHAIN_BUTTON_H__ */