mirror of https://github.com/GNOME/gimp.git
Default to "Cancel" in the "Really Quit?" dialog.
1999-12-02 Michael Natterer <mitch@gimp.org> * app/app_procs.c: Default to "Cancel" in the "Really Quit?" dialog. * app/app_procs.c * app/brush_select.c * app/gimpbrushlist.c: Call brush_select_[freeze|thaw]_all() from brushes_init() and brushes_free(), so refreshing the brushes from plugins/scripts is faster. * app/brightness_contrast.c * app/color_balance.c * app/curves.c * app/file_new_dialog.c * app/hue_saturation.c * app/levels.c * app/posterize.c * app/threshold.c: Reorder the action are buttons: [ "OK" "Reset" "Cancel" ] * app/menus.c: Some more cleanups in the menu code. Reorder <Image>/Filters/Misc only if ot exists. Generalized menu_translate() in preparation for correctly supporting catalogs which only exist sometimes (like gimp-perl). * app/gradient.c * app/gradient_select.c: Save some lines of code by using gtk_clist_new_with_titles() instead of gtk_clist_new(). * libgimp/gimpunitmenu.c: Code cleanup and made the clist titles of the unit selection un-clickable.
This commit is contained in:
parent
35cc6abc0c
commit
c688e055e2
32
ChangeLog
32
ChangeLog
|
@ -1,3 +1,35 @@
|
|||
1999-12-02 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/app_procs.c: Default to "Cancel" in the "Really Quit?" dialog.
|
||||
|
||||
* app/app_procs.c
|
||||
* app/brush_select.c
|
||||
* app/gimpbrushlist.c: Call brush_select_[freeze|thaw]_all() from
|
||||
brushes_init() and brushes_free(), so refreshing the brushes from
|
||||
plugins/scripts is faster.
|
||||
|
||||
* app/brightness_contrast.c
|
||||
* app/color_balance.c
|
||||
* app/curves.c
|
||||
* app/file_new_dialog.c
|
||||
* app/hue_saturation.c
|
||||
* app/levels.c
|
||||
* app/posterize.c
|
||||
* app/threshold.c:
|
||||
Reorder the action are buttons: [ "OK" "Reset" "Cancel" ]
|
||||
|
||||
* app/menus.c: Some more cleanups in the menu code. Reorder
|
||||
<Image>/Filters/Misc only if ot exists. Generalized
|
||||
menu_translate() in preparation for correctly supporting catalogs
|
||||
which only exist sometimes (like gimp-perl).
|
||||
|
||||
* app/gradient.c
|
||||
* app/gradient_select.c: Save some lines of code by using
|
||||
gtk_clist_new_with_titles() instead of gtk_clist_new().
|
||||
|
||||
* libgimp/gimpunitmenu.c: Code cleanup and made the clist titles
|
||||
of the unit selection un-clickable.
|
||||
|
||||
Thu Dec 2 01:18:33 MET 1999 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* plug-ins/common/grid.c: more chainbuttons and nicer dialog layout
|
||||
|
|
|
@ -658,11 +658,6 @@ app_exit_finish (void)
|
|||
named_buffers_free ();
|
||||
swapping_free ();
|
||||
brush_dialog_free ();
|
||||
|
||||
/* there may be dialogs still waiting for brush signals */
|
||||
if (!no_interface)
|
||||
brush_select_freeze_all ();
|
||||
|
||||
brushes_free ();
|
||||
pattern_dialog_free ();
|
||||
patterns_free ();
|
||||
|
@ -750,9 +745,9 @@ really_quit_dialog (void)
|
|||
FALSE, TRUE, FALSE,
|
||||
|
||||
_("Quit"), really_quit_callback,
|
||||
NULL, NULL, TRUE, FALSE,
|
||||
NULL, NULL, FALSE, FALSE,
|
||||
_("Cancel"), really_quit_cancel_callback,
|
||||
NULL, NULL, FALSE, TRUE,
|
||||
NULL, NULL, TRUE, TRUE,
|
||||
|
||||
NULL);
|
||||
|
||||
|
|
|
@ -266,10 +266,10 @@ color_balance_dialog_new (void)
|
|||
GTK_WIN_POS_NONE,
|
||||
FALSE, TRUE, FALSE,
|
||||
|
||||
_("Reset"), color_balance_reset_callback,
|
||||
cbd, NULL, TRUE, FALSE,
|
||||
_("OK"), color_balance_ok_callback,
|
||||
cbd, NULL, TRUE, FALSE,
|
||||
_("Reset"), color_balance_reset_callback,
|
||||
cbd, NULL, TRUE, FALSE,
|
||||
_("Cancel"), color_balance_cancel_callback,
|
||||
cbd, NULL, FALSE, TRUE,
|
||||
|
||||
|
|
|
@ -557,10 +557,10 @@ curves_dialog_new (void)
|
|||
GTK_WIN_POS_NONE,
|
||||
FALSE, TRUE, FALSE,
|
||||
|
||||
_("Reset"), curves_reset_callback,
|
||||
cd, NULL, FALSE, FALSE,
|
||||
_("OK"), curves_ok_callback,
|
||||
cd, NULL, TRUE, FALSE,
|
||||
_("Reset"), curves_reset_callback,
|
||||
cd, NULL, FALSE, FALSE,
|
||||
_("Cancel"), curves_cancel_callback,
|
||||
cd, NULL, FALSE, TRUE,
|
||||
|
||||
|
|
|
@ -368,10 +368,10 @@ hue_saturation_dialog_new (void)
|
|||
GTK_WIN_POS_NONE,
|
||||
FALSE, TRUE, FALSE,
|
||||
|
||||
_("Reset"), hue_saturation_reset_callback,
|
||||
hsd, NULL, FALSE, FALSE,
|
||||
_("OK"), hue_saturation_ok_callback,
|
||||
hsd, NULL, TRUE, FALSE,
|
||||
_("Reset"), hue_saturation_reset_callback,
|
||||
hsd, NULL, FALSE, FALSE,
|
||||
_("Cancel"), hue_saturation_cancel_callback,
|
||||
hsd, NULL, FALSE, TRUE,
|
||||
|
||||
|
|
|
@ -267,10 +267,10 @@ threshold_dialog_new (void)
|
|||
GTK_WIN_POS_NONE,
|
||||
FALSE, TRUE, FALSE,
|
||||
|
||||
_("Reset"), threshold_reset_callback,
|
||||
td, NULL, TRUE, FALSE,
|
||||
_("OK"), threshold_ok_callback,
|
||||
td, NULL, TRUE, FALSE,
|
||||
_("Reset"), threshold_reset_callback,
|
||||
td, NULL, TRUE, FALSE,
|
||||
_("Cancel"), threshold_cancel_callback,
|
||||
td, NULL, FALSE, TRUE,
|
||||
|
||||
|
|
|
@ -210,10 +210,10 @@ brightness_contrast_dialog_new (void)
|
|||
GTK_WIN_POS_NONE,
|
||||
FALSE, TRUE, FALSE,
|
||||
|
||||
_("Reset"), brightness_contrast_reset_callback,
|
||||
bcd, NULL, TRUE, FALSE,
|
||||
_("OK"), brightness_contrast_ok_callback,
|
||||
bcd, NULL, TRUE, FALSE,
|
||||
_("Reset"), brightness_contrast_reset_callback,
|
||||
bcd, NULL, TRUE, FALSE,
|
||||
_("Cancel"), brightness_contrast_cancel_callback,
|
||||
bcd, NULL, FALSE, TRUE,
|
||||
|
||||
|
|
|
@ -1734,12 +1734,8 @@ static void
|
|||
brush_select_refresh_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
brush_select_freeze_all ();
|
||||
|
||||
/* re-init the brush list */
|
||||
brushes_init (FALSE);
|
||||
|
||||
brush_select_thaw_all ();
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -266,10 +266,10 @@ color_balance_dialog_new (void)
|
|||
GTK_WIN_POS_NONE,
|
||||
FALSE, TRUE, FALSE,
|
||||
|
||||
_("Reset"), color_balance_reset_callback,
|
||||
cbd, NULL, TRUE, FALSE,
|
||||
_("OK"), color_balance_ok_callback,
|
||||
cbd, NULL, TRUE, FALSE,
|
||||
_("Reset"), color_balance_reset_callback,
|
||||
cbd, NULL, TRUE, FALSE,
|
||||
_("Cancel"), color_balance_cancel_callback,
|
||||
cbd, NULL, FALSE, TRUE,
|
||||
|
||||
|
|
|
@ -557,10 +557,10 @@ curves_dialog_new (void)
|
|||
GTK_WIN_POS_NONE,
|
||||
FALSE, TRUE, FALSE,
|
||||
|
||||
_("Reset"), curves_reset_callback,
|
||||
cd, NULL, FALSE, FALSE,
|
||||
_("OK"), curves_ok_callback,
|
||||
cd, NULL, TRUE, FALSE,
|
||||
_("Reset"), curves_reset_callback,
|
||||
cd, NULL, FALSE, FALSE,
|
||||
_("Cancel"), curves_cancel_callback,
|
||||
cd, NULL, FALSE, TRUE,
|
||||
|
||||
|
|
|
@ -374,10 +374,10 @@ ui_new_image_window_create (const GimpImageNewValues *values_orig)
|
|||
GTK_WIN_POS_MOUSE,
|
||||
FALSE, FALSE, TRUE,
|
||||
|
||||
_("Reset"), file_new_reset_callback,
|
||||
info, NULL, FALSE, FALSE,
|
||||
_("OK"), file_new_ok_callback,
|
||||
info, NULL, TRUE, FALSE,
|
||||
_("Reset"), file_new_reset_callback,
|
||||
info, NULL, FALSE, FALSE,
|
||||
_("Cancel"), file_new_cancel_callback,
|
||||
info, NULL, FALSE, TRUE,
|
||||
|
||||
|
|
|
@ -374,10 +374,10 @@ ui_new_image_window_create (const GimpImageNewValues *values_orig)
|
|||
GTK_WIN_POS_MOUSE,
|
||||
FALSE, FALSE, TRUE,
|
||||
|
||||
_("Reset"), file_new_reset_callback,
|
||||
info, NULL, FALSE, FALSE,
|
||||
_("OK"), file_new_ok_callback,
|
||||
info, NULL, TRUE, FALSE,
|
||||
_("Reset"), file_new_reset_callback,
|
||||
info, NULL, FALSE, FALSE,
|
||||
_("Cancel"), file_new_cancel_callback,
|
||||
info, NULL, FALSE, TRUE,
|
||||
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#include "gimpbrushgenerated.h"
|
||||
#include "gimpbrushpipe.h"
|
||||
#include "brush_header.h"
|
||||
#include "brush_select.h"
|
||||
#include "datafiles.h"
|
||||
#include "gimprc.h"
|
||||
#include "gimpsignal.h"
|
||||
|
@ -119,7 +120,7 @@ gimp_brush_list_get_type (void)
|
|||
}
|
||||
|
||||
GimpBrushList *
|
||||
gimp_brush_list_new ()
|
||||
gimp_brush_list_new (void)
|
||||
{
|
||||
GimpBrushList *list;
|
||||
|
||||
|
@ -141,8 +142,14 @@ brushes_init (int no_data)
|
|||
brush_list = gimp_brush_list_new ();
|
||||
|
||||
if (brush_path != NULL && !no_data)
|
||||
datafiles_read_directories (brush_path,
|
||||
(datafile_loader_t) brushes_brush_load, 0);
|
||||
{
|
||||
brush_select_freeze_all ();
|
||||
|
||||
datafiles_read_directories (brush_path,
|
||||
(datafile_loader_t) brushes_brush_load, 0);
|
||||
|
||||
brush_select_thaw_all ();
|
||||
}
|
||||
|
||||
gimp_context_refresh_brushes ();
|
||||
}
|
||||
|
@ -215,10 +222,12 @@ brush_compare_func (gconstpointer first,
|
|||
}
|
||||
|
||||
void
|
||||
brushes_free ()
|
||||
brushes_free (void)
|
||||
{
|
||||
if (brush_list)
|
||||
{
|
||||
brush_select_freeze_all ();
|
||||
|
||||
while (GIMP_LIST (brush_list)->list)
|
||||
{
|
||||
GimpBrush * b = GIMP_BRUSH (GIMP_LIST (brush_list)->list->data);
|
||||
|
@ -290,6 +299,8 @@ brushes_free ()
|
|||
|
||||
gimp_brush_list_remove (brush_list, b);
|
||||
}
|
||||
|
||||
brush_select_thaw_all ();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
107
app/gradient.c
107
app/gradient.c
|
@ -328,10 +328,11 @@ static void gradient_editor_drop_gradient (GtkWidget *widget,
|
|||
|
||||
/* Gradient editor functions */
|
||||
|
||||
static GtkWidget *ed_create_button (gchar *label,
|
||||
double xalign, double yalign,
|
||||
GtkSignalFunc signal_func,
|
||||
gpointer user_data);
|
||||
static GtkWidget *ed_create_button (gchar *label,
|
||||
gdouble xalign,
|
||||
gdouble yalign,
|
||||
GtkSignalFunc signal_func,
|
||||
gpointer data);
|
||||
|
||||
static void ed_fetch_foreground (double *fg_r, double *fg_g, double *fg_b,
|
||||
double *fg_a);
|
||||
|
@ -855,12 +856,13 @@ gradient_editor_create (void)
|
|||
GtkWidget *frame;
|
||||
GtkWidget *scrolled_win;
|
||||
GdkColormap *colormap;
|
||||
GtkWidget* pixmapwid;
|
||||
GdkPixmap* pixmap;
|
||||
GdkBitmap* mask;
|
||||
GtkStyle* style;
|
||||
gint i;
|
||||
gint select_pos;
|
||||
GtkWidget *pixmapwid;
|
||||
GdkPixmap *pixmap;
|
||||
GdkBitmap *mask;
|
||||
GtkStyle *style;
|
||||
gchar *titles[2];
|
||||
gint select_pos;
|
||||
gint i;
|
||||
|
||||
/* If the editor already exists, just show it */
|
||||
if (g_editor)
|
||||
|
@ -904,28 +906,23 @@ gradient_editor_create (void)
|
|||
|
||||
/* clist preview of gradients */
|
||||
scrolled_win = gtk_scrolled_window_new (NULL, NULL);
|
||||
|
||||
g_editor->clist = gtk_clist_new (2);
|
||||
gtk_clist_set_shadow_type (GTK_CLIST (g_editor->clist), GTK_SHADOW_IN);
|
||||
gtk_clist_set_row_height (GTK_CLIST (g_editor->clist), 18);
|
||||
gtk_clist_set_selection_mode (GTK_CLIST (g_editor->clist),
|
||||
GTK_SELECTION_BROWSE);
|
||||
|
||||
gtk_clist_set_column_width (GTK_CLIST (g_editor->clist), 0, 52);
|
||||
gtk_clist_set_column_title (GTK_CLIST (g_editor->clist), 0, _("Gradient"));
|
||||
gtk_clist_set_column_title (GTK_CLIST (g_editor->clist), 1, _("Name"));
|
||||
|
||||
gtk_clist_column_titles_show (GTK_CLIST (g_editor->clist));
|
||||
gtk_clist_set_use_drag_icons (GTK_CLIST (g_editor->clist), FALSE);
|
||||
gtk_clist_column_titles_passive (GTK_CLIST (g_editor->clist));
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (hbox), scrolled_win, TRUE, TRUE, 0);
|
||||
gtk_container_add (GTK_CONTAINER (scrolled_win), g_editor->clist);
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_win),
|
||||
GTK_POLICY_AUTOMATIC,
|
||||
GTK_POLICY_ALWAYS);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (hbox), scrolled_win, TRUE, TRUE, 0);
|
||||
gtk_widget_show (scrolled_win);
|
||||
|
||||
titles[0] = _("Gradient");
|
||||
titles[1] = _("Name");
|
||||
g_editor->clist = gtk_clist_new_with_titles (2, titles);
|
||||
gtk_clist_set_shadow_type (GTK_CLIST (g_editor->clist), GTK_SHADOW_IN);
|
||||
gtk_clist_set_selection_mode (GTK_CLIST (g_editor->clist),
|
||||
GTK_SELECTION_BROWSE);
|
||||
gtk_clist_set_row_height (GTK_CLIST (g_editor->clist), 18);
|
||||
gtk_clist_set_use_drag_icons (GTK_CLIST (g_editor->clist), FALSE);
|
||||
gtk_clist_column_titles_passive (GTK_CLIST (g_editor->clist));
|
||||
gtk_container_add (GTK_CONTAINER (scrolled_win), g_editor->clist);
|
||||
|
||||
gtk_widget_show (g_editor->clist);
|
||||
|
||||
colormap = gtk_widget_get_colormap (g_editor->clist);
|
||||
|
@ -965,31 +962,36 @@ gradient_editor_create (void)
|
|||
|
||||
/* Buttons for gradient functions */
|
||||
button = ed_create_button (_("New Gradient"), 0.5, 0.5,
|
||||
(GtkSignalFunc) ed_new_gradient_callback, NULL);
|
||||
GTK_SIGNAL_FUNC (ed_new_gradient_callback),
|
||||
NULL);
|
||||
GTK_WIDGET_UNSET_FLAGS (button, GTK_RECEIVES_DEFAULT);
|
||||
gtk_box_pack_start (GTK_BOX (gvbox), button, FALSE, FALSE, 0);
|
||||
gtk_widget_show (button);
|
||||
|
||||
button = ed_create_button (_("Copy Gradient"), 0.5, 0.5,
|
||||
(GtkSignalFunc) ed_copy_gradient_callback, NULL);
|
||||
GTK_SIGNAL_FUNC (ed_copy_gradient_callback),
|
||||
NULL);
|
||||
GTK_WIDGET_UNSET_FLAGS (button, GTK_RECEIVES_DEFAULT);
|
||||
gtk_box_pack_start (GTK_BOX (gvbox), button, FALSE, FALSE, 0);
|
||||
gtk_widget_show (button);
|
||||
|
||||
button = ed_create_button (_("Delete Gradient"), 0.5, 0.5,
|
||||
(GtkSignalFunc) ed_delete_gradient_callback, NULL);
|
||||
GTK_SIGNAL_FUNC (ed_delete_gradient_callback),
|
||||
NULL);
|
||||
GTK_WIDGET_UNSET_FLAGS (button, GTK_RECEIVES_DEFAULT);
|
||||
gtk_box_pack_start (GTK_BOX (gvbox), button, FALSE, FALSE, 0);
|
||||
gtk_widget_show (button);
|
||||
|
||||
button = ed_create_button (_("Rename Gradient"), 0.5, 0.5,
|
||||
(GtkSignalFunc) ed_rename_gradient_callback, NULL);
|
||||
GTK_SIGNAL_FUNC (ed_rename_gradient_callback),
|
||||
NULL);
|
||||
GTK_WIDGET_UNSET_FLAGS (button, GTK_RECEIVES_DEFAULT);
|
||||
gtk_box_pack_start (GTK_BOX (gvbox), button, FALSE, FALSE, 0);
|
||||
gtk_widget_show (button);
|
||||
|
||||
button = ed_create_button (_("Save as POV-Ray"), 0.5, 0.5,
|
||||
(GtkSignalFunc) ed_save_pov_callback, NULL);
|
||||
GTK_SIGNAL_FUNC (ed_save_pov_callback),
|
||||
NULL);
|
||||
GTK_WIDGET_UNSET_FLAGS (button, GTK_RECEIVES_DEFAULT);
|
||||
gtk_box_pack_start (GTK_BOX (gvbox), button, FALSE, FALSE, 0);
|
||||
gtk_widget_show (button);
|
||||
|
@ -1005,7 +1007,8 @@ gradient_editor_create (void)
|
|||
|
||||
/* Zoom all button */
|
||||
button = ed_create_button (_("Zoom all"), 0.5, 0.5,
|
||||
(GtkSignalFunc) ed_zoom_all_callback, g_editor);
|
||||
GTK_SIGNAL_FUNC (ed_zoom_all_callback),
|
||||
g_editor);
|
||||
GTK_WIDGET_UNSET_FLAGS (button, GTK_RECEIVES_DEFAULT);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
|
||||
gtk_widget_show (button);
|
||||
|
@ -1053,10 +1056,10 @@ gradient_editor_create (void)
|
|||
1.0);
|
||||
|
||||
gtk_signal_connect (g_editor->scroll_data, "value_changed",
|
||||
(GtkSignalFunc) ed_scrollbar_update,
|
||||
GTK_SIGNAL_FUNC (ed_scrollbar_update),
|
||||
g_editor);
|
||||
gtk_signal_connect (g_editor->scroll_data, "changed",
|
||||
(GtkSignalFunc) ed_scrollbar_update,
|
||||
GTK_SIGNAL_FUNC (ed_scrollbar_update),
|
||||
g_editor);
|
||||
|
||||
g_editor->scrollbar =
|
||||
|
@ -1072,7 +1075,7 @@ gradient_editor_create (void)
|
|||
button = gtk_check_button_new_with_label (_("Instant update"));
|
||||
gtk_box_pack_end (GTK_BOX (hbox), button, FALSE, FALSE, 0);
|
||||
gtk_signal_connect (GTK_OBJECT (button), "toggled",
|
||||
(GtkSignalFunc) ed_instant_update_update,
|
||||
GTK_SIGNAL_FUNC (ed_instant_update_update),
|
||||
g_editor);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
|
||||
gtk_widget_show (button);
|
||||
|
@ -1105,7 +1108,7 @@ gradient_editor_create (void)
|
|||
|
||||
gtk_widget_set_events (g_editor->preview, GRAD_PREVIEW_EVENT_MASK);
|
||||
gtk_signal_connect (GTK_OBJECT(g_editor->preview), "event",
|
||||
(GdkEventFunc) prev_events,
|
||||
GTK_SIGNAL_FUNC (prev_events),
|
||||
g_editor);
|
||||
|
||||
gtk_drag_dest_set (g_editor->preview,
|
||||
|
@ -1343,10 +1346,10 @@ ed_update_editor (int flags)
|
|||
|
||||
static GtkWidget *
|
||||
ed_create_button (gchar *label,
|
||||
double xalign,
|
||||
double yalign,
|
||||
gdouble xalign,
|
||||
gdouble yalign,
|
||||
GtkSignalFunc signal_func,
|
||||
gpointer user_data)
|
||||
gpointer data)
|
||||
{
|
||||
GtkWidget *button;
|
||||
GtkWidget *text;
|
||||
|
@ -1361,8 +1364,8 @@ ed_create_button (gchar *label,
|
|||
|
||||
if (signal_func != NULL)
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
(GtkSignalFunc) signal_func,
|
||||
user_data);
|
||||
signal_func,
|
||||
data);
|
||||
|
||||
return button;
|
||||
}
|
||||
|
@ -1373,7 +1376,7 @@ static void
|
|||
ed_set_hint (gchar *str)
|
||||
{
|
||||
gtk_label_set_text (GTK_LABEL (g_editor->hint_label), str);
|
||||
gdk_flush();
|
||||
/*gdk_flush();*/
|
||||
}
|
||||
|
||||
/*****/
|
||||
|
@ -2354,10 +2357,10 @@ prev_events (GtkWidget *widget,
|
|||
static void
|
||||
prev_set_hint (gint x)
|
||||
{
|
||||
double xpos;
|
||||
double r, g, b, a;
|
||||
double h, s, v;
|
||||
gchar str[256];
|
||||
gdouble xpos;
|
||||
gdouble r, g, b, a;
|
||||
gdouble h, s, v;
|
||||
gchar str[512];
|
||||
|
||||
xpos = control_calc_g_pos (x);
|
||||
|
||||
|
@ -2955,7 +2958,7 @@ control_extend_selection (grad_segment_t *seg,
|
|||
double pos)
|
||||
{
|
||||
if (fabs (pos - g_editor->control_sel_l->left) <
|
||||
fabs(pos - g_editor->control_sel_r->right))
|
||||
fabs (pos - g_editor->control_sel_r->right))
|
||||
g_editor->control_sel_l = seg;
|
||||
else
|
||||
g_editor->control_sel_r = seg;
|
||||
|
@ -2967,9 +2970,9 @@ static void
|
|||
control_motion (gint x)
|
||||
{
|
||||
grad_segment_t *seg;
|
||||
double pos;
|
||||
double delta;
|
||||
char str[256];
|
||||
gdouble pos;
|
||||
gdouble delta;
|
||||
gchar str[256];
|
||||
|
||||
seg = g_editor->control_drag_segment;
|
||||
|
||||
|
|
|
@ -328,10 +328,11 @@ static void gradient_editor_drop_gradient (GtkWidget *widget,
|
|||
|
||||
/* Gradient editor functions */
|
||||
|
||||
static GtkWidget *ed_create_button (gchar *label,
|
||||
double xalign, double yalign,
|
||||
GtkSignalFunc signal_func,
|
||||
gpointer user_data);
|
||||
static GtkWidget *ed_create_button (gchar *label,
|
||||
gdouble xalign,
|
||||
gdouble yalign,
|
||||
GtkSignalFunc signal_func,
|
||||
gpointer data);
|
||||
|
||||
static void ed_fetch_foreground (double *fg_r, double *fg_g, double *fg_b,
|
||||
double *fg_a);
|
||||
|
@ -855,12 +856,13 @@ gradient_editor_create (void)
|
|||
GtkWidget *frame;
|
||||
GtkWidget *scrolled_win;
|
||||
GdkColormap *colormap;
|
||||
GtkWidget* pixmapwid;
|
||||
GdkPixmap* pixmap;
|
||||
GdkBitmap* mask;
|
||||
GtkStyle* style;
|
||||
gint i;
|
||||
gint select_pos;
|
||||
GtkWidget *pixmapwid;
|
||||
GdkPixmap *pixmap;
|
||||
GdkBitmap *mask;
|
||||
GtkStyle *style;
|
||||
gchar *titles[2];
|
||||
gint select_pos;
|
||||
gint i;
|
||||
|
||||
/* If the editor already exists, just show it */
|
||||
if (g_editor)
|
||||
|
@ -904,28 +906,23 @@ gradient_editor_create (void)
|
|||
|
||||
/* clist preview of gradients */
|
||||
scrolled_win = gtk_scrolled_window_new (NULL, NULL);
|
||||
|
||||
g_editor->clist = gtk_clist_new (2);
|
||||
gtk_clist_set_shadow_type (GTK_CLIST (g_editor->clist), GTK_SHADOW_IN);
|
||||
gtk_clist_set_row_height (GTK_CLIST (g_editor->clist), 18);
|
||||
gtk_clist_set_selection_mode (GTK_CLIST (g_editor->clist),
|
||||
GTK_SELECTION_BROWSE);
|
||||
|
||||
gtk_clist_set_column_width (GTK_CLIST (g_editor->clist), 0, 52);
|
||||
gtk_clist_set_column_title (GTK_CLIST (g_editor->clist), 0, _("Gradient"));
|
||||
gtk_clist_set_column_title (GTK_CLIST (g_editor->clist), 1, _("Name"));
|
||||
|
||||
gtk_clist_column_titles_show (GTK_CLIST (g_editor->clist));
|
||||
gtk_clist_set_use_drag_icons (GTK_CLIST (g_editor->clist), FALSE);
|
||||
gtk_clist_column_titles_passive (GTK_CLIST (g_editor->clist));
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (hbox), scrolled_win, TRUE, TRUE, 0);
|
||||
gtk_container_add (GTK_CONTAINER (scrolled_win), g_editor->clist);
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_win),
|
||||
GTK_POLICY_AUTOMATIC,
|
||||
GTK_POLICY_ALWAYS);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (hbox), scrolled_win, TRUE, TRUE, 0);
|
||||
gtk_widget_show (scrolled_win);
|
||||
|
||||
titles[0] = _("Gradient");
|
||||
titles[1] = _("Name");
|
||||
g_editor->clist = gtk_clist_new_with_titles (2, titles);
|
||||
gtk_clist_set_shadow_type (GTK_CLIST (g_editor->clist), GTK_SHADOW_IN);
|
||||
gtk_clist_set_selection_mode (GTK_CLIST (g_editor->clist),
|
||||
GTK_SELECTION_BROWSE);
|
||||
gtk_clist_set_row_height (GTK_CLIST (g_editor->clist), 18);
|
||||
gtk_clist_set_use_drag_icons (GTK_CLIST (g_editor->clist), FALSE);
|
||||
gtk_clist_column_titles_passive (GTK_CLIST (g_editor->clist));
|
||||
gtk_container_add (GTK_CONTAINER (scrolled_win), g_editor->clist);
|
||||
|
||||
gtk_widget_show (g_editor->clist);
|
||||
|
||||
colormap = gtk_widget_get_colormap (g_editor->clist);
|
||||
|
@ -965,31 +962,36 @@ gradient_editor_create (void)
|
|||
|
||||
/* Buttons for gradient functions */
|
||||
button = ed_create_button (_("New Gradient"), 0.5, 0.5,
|
||||
(GtkSignalFunc) ed_new_gradient_callback, NULL);
|
||||
GTK_SIGNAL_FUNC (ed_new_gradient_callback),
|
||||
NULL);
|
||||
GTK_WIDGET_UNSET_FLAGS (button, GTK_RECEIVES_DEFAULT);
|
||||
gtk_box_pack_start (GTK_BOX (gvbox), button, FALSE, FALSE, 0);
|
||||
gtk_widget_show (button);
|
||||
|
||||
button = ed_create_button (_("Copy Gradient"), 0.5, 0.5,
|
||||
(GtkSignalFunc) ed_copy_gradient_callback, NULL);
|
||||
GTK_SIGNAL_FUNC (ed_copy_gradient_callback),
|
||||
NULL);
|
||||
GTK_WIDGET_UNSET_FLAGS (button, GTK_RECEIVES_DEFAULT);
|
||||
gtk_box_pack_start (GTK_BOX (gvbox), button, FALSE, FALSE, 0);
|
||||
gtk_widget_show (button);
|
||||
|
||||
button = ed_create_button (_("Delete Gradient"), 0.5, 0.5,
|
||||
(GtkSignalFunc) ed_delete_gradient_callback, NULL);
|
||||
GTK_SIGNAL_FUNC (ed_delete_gradient_callback),
|
||||
NULL);
|
||||
GTK_WIDGET_UNSET_FLAGS (button, GTK_RECEIVES_DEFAULT);
|
||||
gtk_box_pack_start (GTK_BOX (gvbox), button, FALSE, FALSE, 0);
|
||||
gtk_widget_show (button);
|
||||
|
||||
button = ed_create_button (_("Rename Gradient"), 0.5, 0.5,
|
||||
(GtkSignalFunc) ed_rename_gradient_callback, NULL);
|
||||
GTK_SIGNAL_FUNC (ed_rename_gradient_callback),
|
||||
NULL);
|
||||
GTK_WIDGET_UNSET_FLAGS (button, GTK_RECEIVES_DEFAULT);
|
||||
gtk_box_pack_start (GTK_BOX (gvbox), button, FALSE, FALSE, 0);
|
||||
gtk_widget_show (button);
|
||||
|
||||
button = ed_create_button (_("Save as POV-Ray"), 0.5, 0.5,
|
||||
(GtkSignalFunc) ed_save_pov_callback, NULL);
|
||||
GTK_SIGNAL_FUNC (ed_save_pov_callback),
|
||||
NULL);
|
||||
GTK_WIDGET_UNSET_FLAGS (button, GTK_RECEIVES_DEFAULT);
|
||||
gtk_box_pack_start (GTK_BOX (gvbox), button, FALSE, FALSE, 0);
|
||||
gtk_widget_show (button);
|
||||
|
@ -1005,7 +1007,8 @@ gradient_editor_create (void)
|
|||
|
||||
/* Zoom all button */
|
||||
button = ed_create_button (_("Zoom all"), 0.5, 0.5,
|
||||
(GtkSignalFunc) ed_zoom_all_callback, g_editor);
|
||||
GTK_SIGNAL_FUNC (ed_zoom_all_callback),
|
||||
g_editor);
|
||||
GTK_WIDGET_UNSET_FLAGS (button, GTK_RECEIVES_DEFAULT);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
|
||||
gtk_widget_show (button);
|
||||
|
@ -1053,10 +1056,10 @@ gradient_editor_create (void)
|
|||
1.0);
|
||||
|
||||
gtk_signal_connect (g_editor->scroll_data, "value_changed",
|
||||
(GtkSignalFunc) ed_scrollbar_update,
|
||||
GTK_SIGNAL_FUNC (ed_scrollbar_update),
|
||||
g_editor);
|
||||
gtk_signal_connect (g_editor->scroll_data, "changed",
|
||||
(GtkSignalFunc) ed_scrollbar_update,
|
||||
GTK_SIGNAL_FUNC (ed_scrollbar_update),
|
||||
g_editor);
|
||||
|
||||
g_editor->scrollbar =
|
||||
|
@ -1072,7 +1075,7 @@ gradient_editor_create (void)
|
|||
button = gtk_check_button_new_with_label (_("Instant update"));
|
||||
gtk_box_pack_end (GTK_BOX (hbox), button, FALSE, FALSE, 0);
|
||||
gtk_signal_connect (GTK_OBJECT (button), "toggled",
|
||||
(GtkSignalFunc) ed_instant_update_update,
|
||||
GTK_SIGNAL_FUNC (ed_instant_update_update),
|
||||
g_editor);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
|
||||
gtk_widget_show (button);
|
||||
|
@ -1105,7 +1108,7 @@ gradient_editor_create (void)
|
|||
|
||||
gtk_widget_set_events (g_editor->preview, GRAD_PREVIEW_EVENT_MASK);
|
||||
gtk_signal_connect (GTK_OBJECT(g_editor->preview), "event",
|
||||
(GdkEventFunc) prev_events,
|
||||
GTK_SIGNAL_FUNC (prev_events),
|
||||
g_editor);
|
||||
|
||||
gtk_drag_dest_set (g_editor->preview,
|
||||
|
@ -1343,10 +1346,10 @@ ed_update_editor (int flags)
|
|||
|
||||
static GtkWidget *
|
||||
ed_create_button (gchar *label,
|
||||
double xalign,
|
||||
double yalign,
|
||||
gdouble xalign,
|
||||
gdouble yalign,
|
||||
GtkSignalFunc signal_func,
|
||||
gpointer user_data)
|
||||
gpointer data)
|
||||
{
|
||||
GtkWidget *button;
|
||||
GtkWidget *text;
|
||||
|
@ -1361,8 +1364,8 @@ ed_create_button (gchar *label,
|
|||
|
||||
if (signal_func != NULL)
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
(GtkSignalFunc) signal_func,
|
||||
user_data);
|
||||
signal_func,
|
||||
data);
|
||||
|
||||
return button;
|
||||
}
|
||||
|
@ -1373,7 +1376,7 @@ static void
|
|||
ed_set_hint (gchar *str)
|
||||
{
|
||||
gtk_label_set_text (GTK_LABEL (g_editor->hint_label), str);
|
||||
gdk_flush();
|
||||
/*gdk_flush();*/
|
||||
}
|
||||
|
||||
/*****/
|
||||
|
@ -2354,10 +2357,10 @@ prev_events (GtkWidget *widget,
|
|||
static void
|
||||
prev_set_hint (gint x)
|
||||
{
|
||||
double xpos;
|
||||
double r, g, b, a;
|
||||
double h, s, v;
|
||||
gchar str[256];
|
||||
gdouble xpos;
|
||||
gdouble r, g, b, a;
|
||||
gdouble h, s, v;
|
||||
gchar str[512];
|
||||
|
||||
xpos = control_calc_g_pos (x);
|
||||
|
||||
|
@ -2955,7 +2958,7 @@ control_extend_selection (grad_segment_t *seg,
|
|||
double pos)
|
||||
{
|
||||
if (fabs (pos - g_editor->control_sel_l->left) <
|
||||
fabs(pos - g_editor->control_sel_r->right))
|
||||
fabs (pos - g_editor->control_sel_r->right))
|
||||
g_editor->control_sel_l = seg;
|
||||
else
|
||||
g_editor->control_sel_r = seg;
|
||||
|
@ -2967,9 +2970,9 @@ static void
|
|||
control_motion (gint x)
|
||||
{
|
||||
grad_segment_t *seg;
|
||||
double pos;
|
||||
double delta;
|
||||
char str[256];
|
||||
gdouble pos;
|
||||
gdouble delta;
|
||||
gchar str[256];
|
||||
|
||||
seg = g_editor->control_drag_segment;
|
||||
|
||||
|
|
|
@ -123,10 +123,11 @@ GradientSelect *
|
|||
gradient_select_new (gchar *title,
|
||||
gchar *initial_gradient)
|
||||
{
|
||||
GradientSelect *gsp;
|
||||
GradientSelect *gsp;
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *scrolled_win;
|
||||
GdkColormap *colormap;
|
||||
gchar *titles[2];
|
||||
gint select_pos;
|
||||
|
||||
gradient_t *active = NULL;
|
||||
|
@ -195,29 +196,24 @@ gradient_select_new (gchar *title,
|
|||
|
||||
/* clist preview of gradients */
|
||||
scrolled_win = gtk_scrolled_window_new (NULL, NULL);
|
||||
|
||||
gsp->clist = gtk_clist_new (2);
|
||||
gtk_clist_set_shadow_type (GTK_CLIST (gsp->clist), GTK_SHADOW_IN);
|
||||
gtk_clist_set_row_height (GTK_CLIST (gsp->clist), 18);
|
||||
gtk_clist_set_selection_mode (GTK_CLIST (gsp->clist), GTK_SELECTION_BROWSE);
|
||||
|
||||
gtk_clist_set_column_width (GTK_CLIST (gsp->clist), 0, 52);
|
||||
gtk_clist_set_column_title (GTK_CLIST (gsp->clist), 0, _("Gradient"));
|
||||
gtk_clist_set_column_title (GTK_CLIST (gsp->clist), 1, _("Name"));
|
||||
|
||||
gtk_clist_column_titles_show (GTK_CLIST (gsp->clist));
|
||||
gtk_clist_set_use_drag_icons (GTK_CLIST (gsp->clist), FALSE);
|
||||
gtk_clist_column_titles_passive (GTK_CLIST (gsp->clist));
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (vbox), scrolled_win);
|
||||
gtk_container_add (GTK_CONTAINER (scrolled_win), gsp->clist);
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_win),
|
||||
GTK_POLICY_AUTOMATIC,
|
||||
GTK_POLICY_ALWAYS);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (vbox), scrolled_win);
|
||||
gtk_widget_show (scrolled_win);
|
||||
gtk_widget_show (gsp->clist);
|
||||
|
||||
titles[0] = _("Gradient");
|
||||
titles[1] = _("Name");
|
||||
gsp->clist = gtk_clist_new_with_titles (2, titles);
|
||||
gtk_clist_set_shadow_type (GTK_CLIST (gsp->clist), GTK_SHADOW_IN);
|
||||
gtk_clist_set_selection_mode (GTK_CLIST (gsp->clist), GTK_SELECTION_BROWSE);
|
||||
gtk_clist_set_row_height (GTK_CLIST (gsp->clist), 18);
|
||||
gtk_clist_set_use_drag_icons (GTK_CLIST (gsp->clist), FALSE);
|
||||
gtk_clist_column_titles_passive (GTK_CLIST (gsp->clist));
|
||||
gtk_widget_set_usize (gsp->clist, 200, 250);
|
||||
gtk_container_add (GTK_CONTAINER (scrolled_win), gsp->clist);
|
||||
|
||||
gtk_widget_show (gsp->clist);
|
||||
|
||||
colormap = gtk_widget_get_colormap (gsp->clist);
|
||||
gdk_color_parse ("black", &gsp->black);
|
||||
|
|
|
@ -1734,12 +1734,8 @@ static void
|
|||
brush_select_refresh_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
brush_select_freeze_all ();
|
||||
|
||||
/* re-init the brush list */
|
||||
brushes_init (FALSE);
|
||||
|
||||
brush_select_thaw_all ();
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -374,10 +374,10 @@ ui_new_image_window_create (const GimpImageNewValues *values_orig)
|
|||
GTK_WIN_POS_MOUSE,
|
||||
FALSE, FALSE, TRUE,
|
||||
|
||||
_("Reset"), file_new_reset_callback,
|
||||
info, NULL, FALSE, FALSE,
|
||||
_("OK"), file_new_ok_callback,
|
||||
info, NULL, TRUE, FALSE,
|
||||
_("Reset"), file_new_reset_callback,
|
||||
info, NULL, FALSE, FALSE,
|
||||
_("Cancel"), file_new_cancel_callback,
|
||||
info, NULL, FALSE, TRUE,
|
||||
|
||||
|
|
|
@ -328,10 +328,11 @@ static void gradient_editor_drop_gradient (GtkWidget *widget,
|
|||
|
||||
/* Gradient editor functions */
|
||||
|
||||
static GtkWidget *ed_create_button (gchar *label,
|
||||
double xalign, double yalign,
|
||||
GtkSignalFunc signal_func,
|
||||
gpointer user_data);
|
||||
static GtkWidget *ed_create_button (gchar *label,
|
||||
gdouble xalign,
|
||||
gdouble yalign,
|
||||
GtkSignalFunc signal_func,
|
||||
gpointer data);
|
||||
|
||||
static void ed_fetch_foreground (double *fg_r, double *fg_g, double *fg_b,
|
||||
double *fg_a);
|
||||
|
@ -855,12 +856,13 @@ gradient_editor_create (void)
|
|||
GtkWidget *frame;
|
||||
GtkWidget *scrolled_win;
|
||||
GdkColormap *colormap;
|
||||
GtkWidget* pixmapwid;
|
||||
GdkPixmap* pixmap;
|
||||
GdkBitmap* mask;
|
||||
GtkStyle* style;
|
||||
gint i;
|
||||
gint select_pos;
|
||||
GtkWidget *pixmapwid;
|
||||
GdkPixmap *pixmap;
|
||||
GdkBitmap *mask;
|
||||
GtkStyle *style;
|
||||
gchar *titles[2];
|
||||
gint select_pos;
|
||||
gint i;
|
||||
|
||||
/* If the editor already exists, just show it */
|
||||
if (g_editor)
|
||||
|
@ -904,28 +906,23 @@ gradient_editor_create (void)
|
|||
|
||||
/* clist preview of gradients */
|
||||
scrolled_win = gtk_scrolled_window_new (NULL, NULL);
|
||||
|
||||
g_editor->clist = gtk_clist_new (2);
|
||||
gtk_clist_set_shadow_type (GTK_CLIST (g_editor->clist), GTK_SHADOW_IN);
|
||||
gtk_clist_set_row_height (GTK_CLIST (g_editor->clist), 18);
|
||||
gtk_clist_set_selection_mode (GTK_CLIST (g_editor->clist),
|
||||
GTK_SELECTION_BROWSE);
|
||||
|
||||
gtk_clist_set_column_width (GTK_CLIST (g_editor->clist), 0, 52);
|
||||
gtk_clist_set_column_title (GTK_CLIST (g_editor->clist), 0, _("Gradient"));
|
||||
gtk_clist_set_column_title (GTK_CLIST (g_editor->clist), 1, _("Name"));
|
||||
|
||||
gtk_clist_column_titles_show (GTK_CLIST (g_editor->clist));
|
||||
gtk_clist_set_use_drag_icons (GTK_CLIST (g_editor->clist), FALSE);
|
||||
gtk_clist_column_titles_passive (GTK_CLIST (g_editor->clist));
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (hbox), scrolled_win, TRUE, TRUE, 0);
|
||||
gtk_container_add (GTK_CONTAINER (scrolled_win), g_editor->clist);
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_win),
|
||||
GTK_POLICY_AUTOMATIC,
|
||||
GTK_POLICY_ALWAYS);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (hbox), scrolled_win, TRUE, TRUE, 0);
|
||||
gtk_widget_show (scrolled_win);
|
||||
|
||||
titles[0] = _("Gradient");
|
||||
titles[1] = _("Name");
|
||||
g_editor->clist = gtk_clist_new_with_titles (2, titles);
|
||||
gtk_clist_set_shadow_type (GTK_CLIST (g_editor->clist), GTK_SHADOW_IN);
|
||||
gtk_clist_set_selection_mode (GTK_CLIST (g_editor->clist),
|
||||
GTK_SELECTION_BROWSE);
|
||||
gtk_clist_set_row_height (GTK_CLIST (g_editor->clist), 18);
|
||||
gtk_clist_set_use_drag_icons (GTK_CLIST (g_editor->clist), FALSE);
|
||||
gtk_clist_column_titles_passive (GTK_CLIST (g_editor->clist));
|
||||
gtk_container_add (GTK_CONTAINER (scrolled_win), g_editor->clist);
|
||||
|
||||
gtk_widget_show (g_editor->clist);
|
||||
|
||||
colormap = gtk_widget_get_colormap (g_editor->clist);
|
||||
|
@ -965,31 +962,36 @@ gradient_editor_create (void)
|
|||
|
||||
/* Buttons for gradient functions */
|
||||
button = ed_create_button (_("New Gradient"), 0.5, 0.5,
|
||||
(GtkSignalFunc) ed_new_gradient_callback, NULL);
|
||||
GTK_SIGNAL_FUNC (ed_new_gradient_callback),
|
||||
NULL);
|
||||
GTK_WIDGET_UNSET_FLAGS (button, GTK_RECEIVES_DEFAULT);
|
||||
gtk_box_pack_start (GTK_BOX (gvbox), button, FALSE, FALSE, 0);
|
||||
gtk_widget_show (button);
|
||||
|
||||
button = ed_create_button (_("Copy Gradient"), 0.5, 0.5,
|
||||
(GtkSignalFunc) ed_copy_gradient_callback, NULL);
|
||||
GTK_SIGNAL_FUNC (ed_copy_gradient_callback),
|
||||
NULL);
|
||||
GTK_WIDGET_UNSET_FLAGS (button, GTK_RECEIVES_DEFAULT);
|
||||
gtk_box_pack_start (GTK_BOX (gvbox), button, FALSE, FALSE, 0);
|
||||
gtk_widget_show (button);
|
||||
|
||||
button = ed_create_button (_("Delete Gradient"), 0.5, 0.5,
|
||||
(GtkSignalFunc) ed_delete_gradient_callback, NULL);
|
||||
GTK_SIGNAL_FUNC (ed_delete_gradient_callback),
|
||||
NULL);
|
||||
GTK_WIDGET_UNSET_FLAGS (button, GTK_RECEIVES_DEFAULT);
|
||||
gtk_box_pack_start (GTK_BOX (gvbox), button, FALSE, FALSE, 0);
|
||||
gtk_widget_show (button);
|
||||
|
||||
button = ed_create_button (_("Rename Gradient"), 0.5, 0.5,
|
||||
(GtkSignalFunc) ed_rename_gradient_callback, NULL);
|
||||
GTK_SIGNAL_FUNC (ed_rename_gradient_callback),
|
||||
NULL);
|
||||
GTK_WIDGET_UNSET_FLAGS (button, GTK_RECEIVES_DEFAULT);
|
||||
gtk_box_pack_start (GTK_BOX (gvbox), button, FALSE, FALSE, 0);
|
||||
gtk_widget_show (button);
|
||||
|
||||
button = ed_create_button (_("Save as POV-Ray"), 0.5, 0.5,
|
||||
(GtkSignalFunc) ed_save_pov_callback, NULL);
|
||||
GTK_SIGNAL_FUNC (ed_save_pov_callback),
|
||||
NULL);
|
||||
GTK_WIDGET_UNSET_FLAGS (button, GTK_RECEIVES_DEFAULT);
|
||||
gtk_box_pack_start (GTK_BOX (gvbox), button, FALSE, FALSE, 0);
|
||||
gtk_widget_show (button);
|
||||
|
@ -1005,7 +1007,8 @@ gradient_editor_create (void)
|
|||
|
||||
/* Zoom all button */
|
||||
button = ed_create_button (_("Zoom all"), 0.5, 0.5,
|
||||
(GtkSignalFunc) ed_zoom_all_callback, g_editor);
|
||||
GTK_SIGNAL_FUNC (ed_zoom_all_callback),
|
||||
g_editor);
|
||||
GTK_WIDGET_UNSET_FLAGS (button, GTK_RECEIVES_DEFAULT);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
|
||||
gtk_widget_show (button);
|
||||
|
@ -1053,10 +1056,10 @@ gradient_editor_create (void)
|
|||
1.0);
|
||||
|
||||
gtk_signal_connect (g_editor->scroll_data, "value_changed",
|
||||
(GtkSignalFunc) ed_scrollbar_update,
|
||||
GTK_SIGNAL_FUNC (ed_scrollbar_update),
|
||||
g_editor);
|
||||
gtk_signal_connect (g_editor->scroll_data, "changed",
|
||||
(GtkSignalFunc) ed_scrollbar_update,
|
||||
GTK_SIGNAL_FUNC (ed_scrollbar_update),
|
||||
g_editor);
|
||||
|
||||
g_editor->scrollbar =
|
||||
|
@ -1072,7 +1075,7 @@ gradient_editor_create (void)
|
|||
button = gtk_check_button_new_with_label (_("Instant update"));
|
||||
gtk_box_pack_end (GTK_BOX (hbox), button, FALSE, FALSE, 0);
|
||||
gtk_signal_connect (GTK_OBJECT (button), "toggled",
|
||||
(GtkSignalFunc) ed_instant_update_update,
|
||||
GTK_SIGNAL_FUNC (ed_instant_update_update),
|
||||
g_editor);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
|
||||
gtk_widget_show (button);
|
||||
|
@ -1105,7 +1108,7 @@ gradient_editor_create (void)
|
|||
|
||||
gtk_widget_set_events (g_editor->preview, GRAD_PREVIEW_EVENT_MASK);
|
||||
gtk_signal_connect (GTK_OBJECT(g_editor->preview), "event",
|
||||
(GdkEventFunc) prev_events,
|
||||
GTK_SIGNAL_FUNC (prev_events),
|
||||
g_editor);
|
||||
|
||||
gtk_drag_dest_set (g_editor->preview,
|
||||
|
@ -1343,10 +1346,10 @@ ed_update_editor (int flags)
|
|||
|
||||
static GtkWidget *
|
||||
ed_create_button (gchar *label,
|
||||
double xalign,
|
||||
double yalign,
|
||||
gdouble xalign,
|
||||
gdouble yalign,
|
||||
GtkSignalFunc signal_func,
|
||||
gpointer user_data)
|
||||
gpointer data)
|
||||
{
|
||||
GtkWidget *button;
|
||||
GtkWidget *text;
|
||||
|
@ -1361,8 +1364,8 @@ ed_create_button (gchar *label,
|
|||
|
||||
if (signal_func != NULL)
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
(GtkSignalFunc) signal_func,
|
||||
user_data);
|
||||
signal_func,
|
||||
data);
|
||||
|
||||
return button;
|
||||
}
|
||||
|
@ -1373,7 +1376,7 @@ static void
|
|||
ed_set_hint (gchar *str)
|
||||
{
|
||||
gtk_label_set_text (GTK_LABEL (g_editor->hint_label), str);
|
||||
gdk_flush();
|
||||
/*gdk_flush();*/
|
||||
}
|
||||
|
||||
/*****/
|
||||
|
@ -2354,10 +2357,10 @@ prev_events (GtkWidget *widget,
|
|||
static void
|
||||
prev_set_hint (gint x)
|
||||
{
|
||||
double xpos;
|
||||
double r, g, b, a;
|
||||
double h, s, v;
|
||||
gchar str[256];
|
||||
gdouble xpos;
|
||||
gdouble r, g, b, a;
|
||||
gdouble h, s, v;
|
||||
gchar str[512];
|
||||
|
||||
xpos = control_calc_g_pos (x);
|
||||
|
||||
|
@ -2955,7 +2958,7 @@ control_extend_selection (grad_segment_t *seg,
|
|||
double pos)
|
||||
{
|
||||
if (fabs (pos - g_editor->control_sel_l->left) <
|
||||
fabs(pos - g_editor->control_sel_r->right))
|
||||
fabs (pos - g_editor->control_sel_r->right))
|
||||
g_editor->control_sel_l = seg;
|
||||
else
|
||||
g_editor->control_sel_r = seg;
|
||||
|
@ -2967,9 +2970,9 @@ static void
|
|||
control_motion (gint x)
|
||||
{
|
||||
grad_segment_t *seg;
|
||||
double pos;
|
||||
double delta;
|
||||
char str[256];
|
||||
gdouble pos;
|
||||
gdouble delta;
|
||||
gchar str[256];
|
||||
|
||||
seg = g_editor->control_drag_segment;
|
||||
|
||||
|
|
|
@ -123,10 +123,11 @@ GradientSelect *
|
|||
gradient_select_new (gchar *title,
|
||||
gchar *initial_gradient)
|
||||
{
|
||||
GradientSelect *gsp;
|
||||
GradientSelect *gsp;
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *scrolled_win;
|
||||
GdkColormap *colormap;
|
||||
gchar *titles[2];
|
||||
gint select_pos;
|
||||
|
||||
gradient_t *active = NULL;
|
||||
|
@ -195,29 +196,24 @@ gradient_select_new (gchar *title,
|
|||
|
||||
/* clist preview of gradients */
|
||||
scrolled_win = gtk_scrolled_window_new (NULL, NULL);
|
||||
|
||||
gsp->clist = gtk_clist_new (2);
|
||||
gtk_clist_set_shadow_type (GTK_CLIST (gsp->clist), GTK_SHADOW_IN);
|
||||
gtk_clist_set_row_height (GTK_CLIST (gsp->clist), 18);
|
||||
gtk_clist_set_selection_mode (GTK_CLIST (gsp->clist), GTK_SELECTION_BROWSE);
|
||||
|
||||
gtk_clist_set_column_width (GTK_CLIST (gsp->clist), 0, 52);
|
||||
gtk_clist_set_column_title (GTK_CLIST (gsp->clist), 0, _("Gradient"));
|
||||
gtk_clist_set_column_title (GTK_CLIST (gsp->clist), 1, _("Name"));
|
||||
|
||||
gtk_clist_column_titles_show (GTK_CLIST (gsp->clist));
|
||||
gtk_clist_set_use_drag_icons (GTK_CLIST (gsp->clist), FALSE);
|
||||
gtk_clist_column_titles_passive (GTK_CLIST (gsp->clist));
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (vbox), scrolled_win);
|
||||
gtk_container_add (GTK_CONTAINER (scrolled_win), gsp->clist);
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_win),
|
||||
GTK_POLICY_AUTOMATIC,
|
||||
GTK_POLICY_ALWAYS);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (vbox), scrolled_win);
|
||||
gtk_widget_show (scrolled_win);
|
||||
gtk_widget_show (gsp->clist);
|
||||
|
||||
titles[0] = _("Gradient");
|
||||
titles[1] = _("Name");
|
||||
gsp->clist = gtk_clist_new_with_titles (2, titles);
|
||||
gtk_clist_set_shadow_type (GTK_CLIST (gsp->clist), GTK_SHADOW_IN);
|
||||
gtk_clist_set_selection_mode (GTK_CLIST (gsp->clist), GTK_SELECTION_BROWSE);
|
||||
gtk_clist_set_row_height (GTK_CLIST (gsp->clist), 18);
|
||||
gtk_clist_set_use_drag_icons (GTK_CLIST (gsp->clist), FALSE);
|
||||
gtk_clist_column_titles_passive (GTK_CLIST (gsp->clist));
|
||||
gtk_widget_set_usize (gsp->clist, 200, 250);
|
||||
gtk_container_add (GTK_CONTAINER (scrolled_win), gsp->clist);
|
||||
|
||||
gtk_widget_show (gsp->clist);
|
||||
|
||||
colormap = gtk_widget_get_colormap (gsp->clist);
|
||||
gdk_color_parse ("black", &gsp->black);
|
||||
|
|
377
app/gui/menus.c
377
app/gui/menus.c
|
@ -174,8 +174,13 @@ static GimpItemFactoryEntry toolbox_entries[] =
|
|||
|
||||
{ { "/File/---", NULL, NULL, 0, "<Separator>" },
|
||||
NULL, NULL },
|
||||
{ { "/File/---", NULL, NULL, 0, "<Separator>" },
|
||||
|
||||
/* MRU entries are inserted here */
|
||||
|
||||
{ { "/File/---MRU", NULL, NULL, 0, "<Separator>" },
|
||||
NULL, NULL },
|
||||
{ { N_("/File/Quit"), "<control>Q", file_quit_cmd_callback, 0 },
|
||||
"file/quit.html", NULL },
|
||||
|
||||
/* <Toolbox>/Xtns */
|
||||
|
||||
|
@ -206,14 +211,6 @@ static guint n_toolbox_entries = (sizeof (toolbox_entries) /
|
|||
sizeof (toolbox_entries[0]));
|
||||
static GtkItemFactory *toolbox_factory = NULL;
|
||||
|
||||
static GimpItemFactoryEntry file_menu_separator =
|
||||
{ { "/File/---", NULL, NULL, 0, "<Separator>" },
|
||||
NULL, NULL };
|
||||
|
||||
static GimpItemFactoryEntry toolbox_end =
|
||||
{ { N_("/File/Quit"), "<control>Q", file_quit_cmd_callback, 0 },
|
||||
"file/quit.html", NULL };
|
||||
|
||||
/***** <Image> *****/
|
||||
|
||||
static GimpItemFactoryEntry image_entries[] =
|
||||
|
@ -581,7 +578,7 @@ static GimpItemFactoryEntry image_entries[] =
|
|||
{ { N_("/Filters/Web"), NULL, NULL, 0, "<Branch>" },
|
||||
NULL, NULL },
|
||||
|
||||
{ { "/Filters/---", NULL, NULL, 0, "<Separator>" },
|
||||
{ { "/Filters/---INSERT", NULL, NULL, 0, "<Separator>" },
|
||||
NULL, NULL },
|
||||
{ { N_("/Filters/Animation"), NULL, NULL, 0, "<Branch>" },
|
||||
NULL, NULL },
|
||||
|
@ -1037,10 +1034,14 @@ menus_reorder_plugins (void)
|
|||
static gint n_reorder_submenus = (sizeof (reorder_submenus) /
|
||||
sizeof (reorder_submenus[0]));
|
||||
|
||||
static gchar *reorder_sub_submenus[] = { "<Image>/Filters",
|
||||
"<Toolbox>/Xtns" };
|
||||
static gint n_reorder_sub_submenus = (sizeof (reorder_sub_submenus) /
|
||||
sizeof (reorder_sub_submenus[0]));
|
||||
static gchar *reorder_subsubmenus[] = { "<Image>/Filters",
|
||||
"<Toolbox>/Xtns" };
|
||||
static gint n_reorder_subsubmenus = (sizeof (reorder_subsubmenus) /
|
||||
sizeof (reorder_subsubmenus[0]));
|
||||
|
||||
static gchar *reorder_if_exists[] = { "/Filters/Misc" };
|
||||
static gint n_reorder_if_exists = (sizeof (reorder_if_exists) /
|
||||
sizeof (reorder_if_exists[0]));
|
||||
|
||||
GtkItemFactory *item_factory;
|
||||
GtkWidget *menu_item;
|
||||
|
@ -1123,11 +1124,11 @@ menus_reorder_plugins (void)
|
|||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < n_reorder_sub_submenus; i++)
|
||||
for (i = 0; i < n_reorder_subsubmenus; i++)
|
||||
{
|
||||
item_factory = gtk_item_factory_from_path (reorder_sub_submenus[i]);
|
||||
item_factory = gtk_item_factory_from_path (reorder_subsubmenus[i]);
|
||||
menu = gtk_item_factory_get_widget (item_factory,
|
||||
reorder_sub_submenus[i]);
|
||||
reorder_subsubmenus[i]);
|
||||
|
||||
if (menu && GTK_IS_MENU (menu))
|
||||
{
|
||||
|
@ -1143,6 +1144,41 @@ menus_reorder_plugins (void)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Reorder submenus of <Image>/Filters which only exist sometimes */
|
||||
menu_item = gtk_item_factory_get_widget (image_factory,
|
||||
"/Filters/---INSERT");
|
||||
|
||||
if (menu_item && menu_item->parent && GTK_IS_MENU (menu_item->parent))
|
||||
{
|
||||
menu = menu_item->parent;
|
||||
pos = g_list_index (GTK_MENU_SHELL (menu)->children, menu_item);
|
||||
|
||||
for (i = 0; i < n_reorder_if_exists; i++)
|
||||
{
|
||||
GList *list;
|
||||
|
||||
menu_item = gtk_item_factory_get_widget (image_factory,
|
||||
reorder_if_exists[i]);
|
||||
|
||||
if (menu_item && GTK_IS_MENU (menu_item))
|
||||
{
|
||||
for (list = GTK_MENU_SHELL (menu)->children; list;
|
||||
list = g_list_next (list))
|
||||
{
|
||||
if (GTK_MENU_ITEM (list->data)->submenu == menu_item)
|
||||
break;
|
||||
}
|
||||
|
||||
if (list)
|
||||
{
|
||||
gtk_menu_reorder_child (GTK_MENU (menu),
|
||||
GTK_WIDGET (list->data), pos);
|
||||
pos++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1285,12 +1321,13 @@ menus_last_opened_update_labels (void)
|
|||
g_string_sprintf (path, "/File/MRU%02d", i);
|
||||
|
||||
widget = gtk_item_factory_get_widget (toolbox_factory, path->str);
|
||||
if (widget != NULL) {
|
||||
gtk_widget_show (widget);
|
||||
if (widget)
|
||||
{
|
||||
gtk_widget_show (widget);
|
||||
|
||||
gtk_label_set (GTK_LABEL (GTK_BIN (widget)->child),
|
||||
entry_filename->str);
|
||||
}
|
||||
gtk_label_set (GTK_LABEL (GTK_BIN (widget)->child),
|
||||
entry_filename->str);
|
||||
}
|
||||
filename_slist = filename_slist->next;
|
||||
}
|
||||
|
||||
|
@ -1303,7 +1340,7 @@ menus_last_opened_add (gchar *filename)
|
|||
{
|
||||
GString *raw_filename;
|
||||
GSList *list;
|
||||
GtkWidget *widget;
|
||||
GtkWidget *menu_item;
|
||||
guint num_entries;
|
||||
|
||||
/* ignore the add if we've already got the filename on the list */
|
||||
|
@ -1329,9 +1366,8 @@ menus_last_opened_add (gchar *filename)
|
|||
|
||||
if (num_entries == 0)
|
||||
{
|
||||
widget = gtk_item_factory_get_widget (toolbox_factory,
|
||||
file_menu_separator.entry.path);
|
||||
gtk_widget_show (widget);
|
||||
menu_item = gtk_item_factory_get_widget (toolbox_factory, "/File/---MRU");
|
||||
gtk_widget_show (menu_item);
|
||||
}
|
||||
|
||||
menus_last_opened_update_labels ();
|
||||
|
@ -1340,10 +1376,11 @@ menus_last_opened_add (gchar *filename)
|
|||
static void
|
||||
menus_init_mru (void)
|
||||
{
|
||||
gchar *paths, *accelerators;
|
||||
gint i;
|
||||
GimpItemFactoryEntry *last_opened_entries;
|
||||
GtkWidget *widget;
|
||||
GimpItemFactoryEntry *last_opened_entries;
|
||||
GtkWidget *menu_item;
|
||||
gchar *paths;
|
||||
gchar *accelerators;
|
||||
gint i;
|
||||
|
||||
last_opened_entries = g_new (GimpItemFactoryEntry, last_opened_size);
|
||||
|
||||
|
@ -1379,14 +1416,20 @@ menus_init_mru (void)
|
|||
|
||||
for (i=0; i < last_opened_size; i++)
|
||||
{
|
||||
widget = gtk_item_factory_get_widget (toolbox_factory,
|
||||
last_opened_entries[i].entry.path);
|
||||
gtk_widget_hide (widget);
|
||||
menu_item =
|
||||
gtk_item_factory_get_widget (toolbox_factory,
|
||||
last_opened_entries[i].entry.path);
|
||||
gtk_widget_hide (menu_item);
|
||||
}
|
||||
|
||||
widget = gtk_item_factory_get_widget (toolbox_factory,
|
||||
file_menu_separator.entry.path);
|
||||
gtk_widget_hide (widget);
|
||||
menu_item = gtk_item_factory_get_widget (toolbox_factory, "/File/---MRU");
|
||||
if (menu_item && menu_item->parent)
|
||||
gtk_menu_reorder_child (GTK_MENU (menu_item->parent), menu_item, -1);
|
||||
gtk_widget_hide (menu_item);
|
||||
|
||||
menu_item = gtk_item_factory_get_widget (toolbox_factory, "/File/Quit");
|
||||
if (menu_item && menu_item->parent)
|
||||
gtk_menu_reorder_child (GTK_MENU (menu_item->parent), menu_item, -1);
|
||||
|
||||
g_free (paths);
|
||||
g_free (accelerators);
|
||||
|
@ -1466,23 +1509,23 @@ menus_create_item (GtkItemFactory *item_factory,
|
|||
gpointer callback_data,
|
||||
guint callback_type)
|
||||
{
|
||||
GtkWidget *item;
|
||||
GtkWidget *menu_item;
|
||||
|
||||
gtk_item_factory_create_item (item_factory,
|
||||
(GtkItemFactoryEntry *) entry,
|
||||
callback_data,
|
||||
callback_type);
|
||||
|
||||
item = gtk_item_factory_get_item (item_factory,
|
||||
((GtkItemFactoryEntry *) entry)->path);
|
||||
menu_item = gtk_item_factory_get_item (item_factory,
|
||||
((GtkItemFactoryEntry *) entry)->path);
|
||||
|
||||
if (item)
|
||||
if (menu_item)
|
||||
{
|
||||
gtk_signal_connect_after (GTK_OBJECT (item), "realize",
|
||||
gtk_signal_connect_after (GTK_OBJECT (menu_item), "realize",
|
||||
GTK_SIGNAL_FUNC (menus_item_realize),
|
||||
(gpointer) item_factory);
|
||||
|
||||
gtk_object_set_data (GTK_OBJECT (item), "help_page",
|
||||
gtk_object_set_data (GTK_OBJECT (menu_item), "help_page",
|
||||
(gpointer) entry->help_page);
|
||||
}
|
||||
}
|
||||
|
@ -1530,157 +1573,149 @@ menus_create_items (GtkItemFactory *item_factory,
|
|||
}
|
||||
|
||||
static void
|
||||
menus_init_toolbox (void)
|
||||
menus_init (void)
|
||||
{
|
||||
toolbox_factory = gtk_item_factory_new (GTK_TYPE_MENU_BAR, "<Toolbox>", NULL);
|
||||
GtkWidget *menu_item;
|
||||
gchar *filename;
|
||||
gint i;
|
||||
|
||||
if (! initialize)
|
||||
return;
|
||||
|
||||
initialize = FALSE;
|
||||
|
||||
toolbox_factory = gtk_item_factory_new (GTK_TYPE_MENU_BAR, "<Toolbox>",
|
||||
NULL);
|
||||
gtk_object_set_data (GTK_OBJECT (toolbox_factory), "help_path",
|
||||
(gpointer) "toolbox");
|
||||
gtk_item_factory_set_translate_func (toolbox_factory, menu_translate,
|
||||
"<Toolbox>", NULL);
|
||||
menus_create_items (toolbox_factory, n_toolbox_entries,
|
||||
toolbox_entries, NULL, 2);
|
||||
"<Toolbox>", NULL);
|
||||
menus_create_items (toolbox_factory,
|
||||
n_toolbox_entries,
|
||||
toolbox_entries,
|
||||
NULL, 2);
|
||||
|
||||
menus_init_mru ();
|
||||
|
||||
menus_create_items (toolbox_factory, 1,
|
||||
&file_menu_separator, NULL, 2);
|
||||
image_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<Image>", NULL);
|
||||
gtk_object_set_data (GTK_OBJECT (image_factory), "help_path",
|
||||
(gpointer) "image");
|
||||
gtk_item_factory_set_translate_func (image_factory, menu_translate,
|
||||
"<Image>", NULL);
|
||||
menus_create_items (image_factory,
|
||||
n_image_entries,
|
||||
image_entries,
|
||||
NULL, 2);
|
||||
|
||||
menus_create_items (toolbox_factory, 1,
|
||||
&toolbox_end, NULL, 2);
|
||||
}
|
||||
load_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<Load>", NULL);
|
||||
gtk_object_set_data (GTK_OBJECT (load_factory), "help_path",
|
||||
(gpointer) "open");
|
||||
gtk_item_factory_set_translate_func (load_factory, menu_translate,
|
||||
"<Load>", NULL);
|
||||
menus_create_items (load_factory,
|
||||
n_load_entries,
|
||||
load_entries,
|
||||
NULL, 2);
|
||||
|
||||
static void
|
||||
menus_init (void)
|
||||
{
|
||||
gint i;
|
||||
save_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<Save>", NULL);
|
||||
gtk_object_set_data (GTK_OBJECT (save_factory), "help_path",
|
||||
(gpointer) "save");
|
||||
gtk_item_factory_set_translate_func (save_factory, menu_translate,
|
||||
"<Save>", NULL);
|
||||
menus_create_items (save_factory,
|
||||
n_save_entries,
|
||||
save_entries,
|
||||
NULL, 2);
|
||||
|
||||
if (initialize)
|
||||
layers_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<Layers>", NULL);
|
||||
gtk_object_set_data (GTK_OBJECT (layers_factory), "help_path",
|
||||
(gpointer) "layers");
|
||||
gtk_item_factory_set_translate_func (layers_factory, menu_translate,
|
||||
"<Layers>", NULL);
|
||||
menus_create_items (layers_factory,
|
||||
n_layers_entries,
|
||||
layers_entries,
|
||||
NULL, 2);
|
||||
|
||||
channels_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<Channels>", NULL);
|
||||
gtk_object_set_data (GTK_OBJECT (channels_factory), "help_path",
|
||||
(gpointer) "channels");
|
||||
gtk_item_factory_set_translate_func (channels_factory, menu_translate,
|
||||
"<Channels>", NULL);
|
||||
menus_create_items (channels_factory,
|
||||
n_channels_entries,
|
||||
channels_entries,
|
||||
NULL, 2);
|
||||
|
||||
paths_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<Paths>", NULL);
|
||||
gtk_object_set_data (GTK_OBJECT (paths_factory), "help_path",
|
||||
(gpointer) "paths");
|
||||
gtk_item_factory_set_translate_func (paths_factory, menu_translate,
|
||||
"<Paths>", NULL);
|
||||
menus_create_items (paths_factory,
|
||||
n_paths_entries,
|
||||
paths_entries,
|
||||
NULL, 2);
|
||||
|
||||
for (i = 0; i < num_tools; i++)
|
||||
{
|
||||
GtkWidget *menu_item;
|
||||
gchar *filename;
|
||||
/* FIXME this need to use access functions to check a flag */
|
||||
if (tool_info[i].menu_path)
|
||||
menus_tools_create (&tool_info[i]);
|
||||
}
|
||||
|
||||
initialize = FALSE;
|
||||
/* reorder <Image>/Image/Colors */
|
||||
menu_item = gtk_item_factory_get_widget (image_factory,
|
||||
tool_info[POSTERIZE].menu_path);
|
||||
if (menu_item && menu_item->parent)
|
||||
gtk_menu_reorder_child (GTK_MENU (menu_item->parent), menu_item, 3);
|
||||
|
||||
menus_init_toolbox ();
|
||||
{
|
||||
static ToolType color_tools[] = { COLOR_BALANCE,
|
||||
HUE_SATURATION,
|
||||
BRIGHTNESS_CONTRAST,
|
||||
THRESHOLD,
|
||||
LEVELS,
|
||||
CURVES };
|
||||
static gint n_color_tools = (sizeof (color_tools) /
|
||||
sizeof (color_tools[0]));
|
||||
gint i, pos;
|
||||
|
||||
image_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<Image>", NULL);
|
||||
gtk_object_set_data (GTK_OBJECT (image_factory), "help_path",
|
||||
(gpointer) "image");
|
||||
gtk_item_factory_set_translate_func (image_factory,
|
||||
menu_translate,
|
||||
"<Image>", NULL);
|
||||
menus_create_items (image_factory,
|
||||
n_image_entries,
|
||||
image_entries,
|
||||
NULL, 2);
|
||||
|
||||
load_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<Load>", NULL);
|
||||
gtk_object_set_data (GTK_OBJECT (load_factory), "help_path",
|
||||
(gpointer) "open");
|
||||
gtk_item_factory_set_translate_func (load_factory,
|
||||
menu_translate,
|
||||
NULL, NULL);
|
||||
menus_create_items (load_factory,
|
||||
n_load_entries,
|
||||
load_entries,
|
||||
NULL, 2);
|
||||
|
||||
save_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<Save>", NULL);
|
||||
gtk_object_set_data (GTK_OBJECT (save_factory), "help_path",
|
||||
(gpointer) "save");
|
||||
gtk_item_factory_set_translate_func (save_factory,
|
||||
menu_translate,
|
||||
NULL, NULL);
|
||||
menus_create_items (save_factory,
|
||||
n_save_entries,
|
||||
save_entries,
|
||||
NULL, 2);
|
||||
|
||||
layers_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<Layers>", NULL);
|
||||
gtk_object_set_data (GTK_OBJECT (layers_factory), "help_path",
|
||||
(gpointer) "layers");
|
||||
gtk_item_factory_set_translate_func (layers_factory,
|
||||
menu_translate,
|
||||
NULL, NULL);
|
||||
menus_create_items (layers_factory,
|
||||
n_layers_entries,
|
||||
layers_entries,
|
||||
NULL, 2);
|
||||
|
||||
channels_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<Channels>", NULL);
|
||||
gtk_object_set_data (GTK_OBJECT (channels_factory), "help_path",
|
||||
(gpointer) "channels");
|
||||
gtk_item_factory_set_translate_func (channels_factory,
|
||||
menu_translate,
|
||||
NULL, NULL);
|
||||
menus_create_items (channels_factory,
|
||||
n_channels_entries,
|
||||
channels_entries,
|
||||
NULL, 2);
|
||||
|
||||
paths_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<Paths>", NULL);
|
||||
gtk_object_set_data (GTK_OBJECT (paths_factory), "help_path",
|
||||
(gpointer) "paths");
|
||||
gtk_item_factory_set_translate_func (paths_factory,
|
||||
menu_translate,
|
||||
NULL, NULL);
|
||||
menus_create_items (paths_factory,
|
||||
n_paths_entries,
|
||||
paths_entries,
|
||||
NULL, 2);
|
||||
|
||||
for (i = 0; i < num_tools; i++)
|
||||
{
|
||||
/* FIXME this need to use access functions to check a flag */
|
||||
if (tool_info[i].menu_path)
|
||||
menus_tools_create (&tool_info[i]);
|
||||
}
|
||||
|
||||
menu_item = gtk_item_factory_get_widget (image_factory,
|
||||
tool_info[POSTERIZE].menu_path);
|
||||
if (menu_item && menu_item->parent)
|
||||
gtk_menu_reorder_child (GTK_MENU (menu_item->parent), menu_item, 3);
|
||||
pos = 1;
|
||||
|
||||
for (i = 0; i < n_color_tools; i++)
|
||||
{
|
||||
static ToolType color_tools[] = { COLOR_BALANCE,
|
||||
HUE_SATURATION,
|
||||
BRIGHTNESS_CONTRAST,
|
||||
THRESHOLD,
|
||||
LEVELS,
|
||||
CURVES };
|
||||
static gint n_color_tools = (sizeof (color_tools) /
|
||||
sizeof (color_tools[0]));
|
||||
gint i, pos;
|
||||
|
||||
pos = 1;
|
||||
|
||||
for (i = 0; i < n_color_tools; i++)
|
||||
menu_item =
|
||||
gtk_item_factory_get_widget (image_factory,
|
||||
tool_info[color_tools[i]].menu_path);
|
||||
if (menu_item && menu_item->parent)
|
||||
{
|
||||
menu_item =
|
||||
gtk_item_factory_get_widget (image_factory,
|
||||
tool_info[color_tools[i]].menu_path);
|
||||
if (menu_item && menu_item->parent)
|
||||
{
|
||||
gtk_menu_reorder_child (GTK_MENU (menu_item->parent),
|
||||
menu_item, pos);
|
||||
pos++;
|
||||
}
|
||||
gtk_menu_reorder_child (GTK_MENU (menu_item->parent),
|
||||
menu_item, pos);
|
||||
pos++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
filename = gimp_personal_rc_file ("menurc");
|
||||
gtk_item_factory_parse_rc (filename);
|
||||
g_free (filename);
|
||||
}
|
||||
filename = gimp_personal_rc_file ("menurc");
|
||||
gtk_item_factory_parse_rc (filename);
|
||||
g_free (filename);
|
||||
}
|
||||
|
||||
static gchar *
|
||||
menu_translate (const gchar *path,
|
||||
gpointer data)
|
||||
{
|
||||
static gchar *plugin_domains[] = { "gimp-std-plugins",
|
||||
"gimp-perl" };
|
||||
static gint n_plugin_domains = (sizeof (plugin_domains) /
|
||||
sizeof (plugin_domains[0]));
|
||||
|
||||
static gchar *menupath = NULL;
|
||||
|
||||
gchar *retval;
|
||||
gchar *factory;
|
||||
gint i;
|
||||
|
||||
factory = (gchar *) data;
|
||||
|
||||
|
@ -1696,18 +1731,14 @@ menu_translate (const gchar *path,
|
|||
|
||||
retval = gettext (menupath);
|
||||
|
||||
if (!strcmp (path, retval) && factory)
|
||||
i = 0;
|
||||
while (i < n_plugin_domains && !strcmp (path, retval) && factory)
|
||||
{
|
||||
g_free (menupath);
|
||||
|
||||
menupath = g_strconcat (factory, path, NULL);
|
||||
|
||||
retval = dgettext ("gimp-std-plugins", menupath) + strlen (factory);
|
||||
|
||||
if (!strcmp (path, retval))
|
||||
{
|
||||
retval = dgettext ("gimp-perl", menupath) + strlen (factory);
|
||||
}
|
||||
retval = dgettext (plugin_domains[i++], menupath) + strlen (factory);
|
||||
}
|
||||
|
||||
return retval;
|
||||
|
@ -1739,7 +1770,7 @@ tearoff_cmd_callback (GtkWidget *widget,
|
|||
/* This should be a window */
|
||||
if (!GTK_IS_WINDOW (top))
|
||||
{
|
||||
g_message("tearoff menu not in top level window");
|
||||
g_message ("tearoff menu not in top level window");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1748,7 +1779,7 @@ tearoff_cmd_callback (GtkWidget *widget,
|
|||
"delete_event",
|
||||
GTK_SIGNAL_FUNC (tearoff_delete_cb),
|
||||
GTK_OBJECT (top));
|
||||
|
||||
|
||||
gtk_object_set_data (GTK_OBJECT (widget), "tearoff_menu_top",
|
||||
top);
|
||||
}
|
||||
|
|
|
@ -368,10 +368,10 @@ hue_saturation_dialog_new (void)
|
|||
GTK_WIN_POS_NONE,
|
||||
FALSE, TRUE, FALSE,
|
||||
|
||||
_("Reset"), hue_saturation_reset_callback,
|
||||
hsd, NULL, FALSE, FALSE,
|
||||
_("OK"), hue_saturation_ok_callback,
|
||||
hsd, NULL, TRUE, FALSE,
|
||||
_("Reset"), hue_saturation_reset_callback,
|
||||
hsd, NULL, FALSE, FALSE,
|
||||
_("Cancel"), hue_saturation_cancel_callback,
|
||||
hsd, NULL, FALSE, TRUE,
|
||||
|
||||
|
|
|
@ -361,10 +361,10 @@ levels_dialog_new (void)
|
|||
GTK_WIN_POS_NONE,
|
||||
FALSE, TRUE, FALSE,
|
||||
|
||||
_("Reset"), levels_reset_callback,
|
||||
ld, NULL, FALSE, FALSE,
|
||||
_("OK"), levels_ok_callback,
|
||||
ld, NULL, TRUE, FALSE,
|
||||
_("Reset"), levels_reset_callback,
|
||||
ld, NULL, FALSE, FALSE,
|
||||
_("Cancel"), levels_cancel_callback,
|
||||
ld, NULL, FALSE, TRUE,
|
||||
|
||||
|
|
377
app/menus.c
377
app/menus.c
|
@ -174,8 +174,13 @@ static GimpItemFactoryEntry toolbox_entries[] =
|
|||
|
||||
{ { "/File/---", NULL, NULL, 0, "<Separator>" },
|
||||
NULL, NULL },
|
||||
{ { "/File/---", NULL, NULL, 0, "<Separator>" },
|
||||
|
||||
/* MRU entries are inserted here */
|
||||
|
||||
{ { "/File/---MRU", NULL, NULL, 0, "<Separator>" },
|
||||
NULL, NULL },
|
||||
{ { N_("/File/Quit"), "<control>Q", file_quit_cmd_callback, 0 },
|
||||
"file/quit.html", NULL },
|
||||
|
||||
/* <Toolbox>/Xtns */
|
||||
|
||||
|
@ -206,14 +211,6 @@ static guint n_toolbox_entries = (sizeof (toolbox_entries) /
|
|||
sizeof (toolbox_entries[0]));
|
||||
static GtkItemFactory *toolbox_factory = NULL;
|
||||
|
||||
static GimpItemFactoryEntry file_menu_separator =
|
||||
{ { "/File/---", NULL, NULL, 0, "<Separator>" },
|
||||
NULL, NULL };
|
||||
|
||||
static GimpItemFactoryEntry toolbox_end =
|
||||
{ { N_("/File/Quit"), "<control>Q", file_quit_cmd_callback, 0 },
|
||||
"file/quit.html", NULL };
|
||||
|
||||
/***** <Image> *****/
|
||||
|
||||
static GimpItemFactoryEntry image_entries[] =
|
||||
|
@ -581,7 +578,7 @@ static GimpItemFactoryEntry image_entries[] =
|
|||
{ { N_("/Filters/Web"), NULL, NULL, 0, "<Branch>" },
|
||||
NULL, NULL },
|
||||
|
||||
{ { "/Filters/---", NULL, NULL, 0, "<Separator>" },
|
||||
{ { "/Filters/---INSERT", NULL, NULL, 0, "<Separator>" },
|
||||
NULL, NULL },
|
||||
{ { N_("/Filters/Animation"), NULL, NULL, 0, "<Branch>" },
|
||||
NULL, NULL },
|
||||
|
@ -1037,10 +1034,14 @@ menus_reorder_plugins (void)
|
|||
static gint n_reorder_submenus = (sizeof (reorder_submenus) /
|
||||
sizeof (reorder_submenus[0]));
|
||||
|
||||
static gchar *reorder_sub_submenus[] = { "<Image>/Filters",
|
||||
"<Toolbox>/Xtns" };
|
||||
static gint n_reorder_sub_submenus = (sizeof (reorder_sub_submenus) /
|
||||
sizeof (reorder_sub_submenus[0]));
|
||||
static gchar *reorder_subsubmenus[] = { "<Image>/Filters",
|
||||
"<Toolbox>/Xtns" };
|
||||
static gint n_reorder_subsubmenus = (sizeof (reorder_subsubmenus) /
|
||||
sizeof (reorder_subsubmenus[0]));
|
||||
|
||||
static gchar *reorder_if_exists[] = { "/Filters/Misc" };
|
||||
static gint n_reorder_if_exists = (sizeof (reorder_if_exists) /
|
||||
sizeof (reorder_if_exists[0]));
|
||||
|
||||
GtkItemFactory *item_factory;
|
||||
GtkWidget *menu_item;
|
||||
|
@ -1123,11 +1124,11 @@ menus_reorder_plugins (void)
|
|||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < n_reorder_sub_submenus; i++)
|
||||
for (i = 0; i < n_reorder_subsubmenus; i++)
|
||||
{
|
||||
item_factory = gtk_item_factory_from_path (reorder_sub_submenus[i]);
|
||||
item_factory = gtk_item_factory_from_path (reorder_subsubmenus[i]);
|
||||
menu = gtk_item_factory_get_widget (item_factory,
|
||||
reorder_sub_submenus[i]);
|
||||
reorder_subsubmenus[i]);
|
||||
|
||||
if (menu && GTK_IS_MENU (menu))
|
||||
{
|
||||
|
@ -1143,6 +1144,41 @@ menus_reorder_plugins (void)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Reorder submenus of <Image>/Filters which only exist sometimes */
|
||||
menu_item = gtk_item_factory_get_widget (image_factory,
|
||||
"/Filters/---INSERT");
|
||||
|
||||
if (menu_item && menu_item->parent && GTK_IS_MENU (menu_item->parent))
|
||||
{
|
||||
menu = menu_item->parent;
|
||||
pos = g_list_index (GTK_MENU_SHELL (menu)->children, menu_item);
|
||||
|
||||
for (i = 0; i < n_reorder_if_exists; i++)
|
||||
{
|
||||
GList *list;
|
||||
|
||||
menu_item = gtk_item_factory_get_widget (image_factory,
|
||||
reorder_if_exists[i]);
|
||||
|
||||
if (menu_item && GTK_IS_MENU (menu_item))
|
||||
{
|
||||
for (list = GTK_MENU_SHELL (menu)->children; list;
|
||||
list = g_list_next (list))
|
||||
{
|
||||
if (GTK_MENU_ITEM (list->data)->submenu == menu_item)
|
||||
break;
|
||||
}
|
||||
|
||||
if (list)
|
||||
{
|
||||
gtk_menu_reorder_child (GTK_MENU (menu),
|
||||
GTK_WIDGET (list->data), pos);
|
||||
pos++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1285,12 +1321,13 @@ menus_last_opened_update_labels (void)
|
|||
g_string_sprintf (path, "/File/MRU%02d", i);
|
||||
|
||||
widget = gtk_item_factory_get_widget (toolbox_factory, path->str);
|
||||
if (widget != NULL) {
|
||||
gtk_widget_show (widget);
|
||||
if (widget)
|
||||
{
|
||||
gtk_widget_show (widget);
|
||||
|
||||
gtk_label_set (GTK_LABEL (GTK_BIN (widget)->child),
|
||||
entry_filename->str);
|
||||
}
|
||||
gtk_label_set (GTK_LABEL (GTK_BIN (widget)->child),
|
||||
entry_filename->str);
|
||||
}
|
||||
filename_slist = filename_slist->next;
|
||||
}
|
||||
|
||||
|
@ -1303,7 +1340,7 @@ menus_last_opened_add (gchar *filename)
|
|||
{
|
||||
GString *raw_filename;
|
||||
GSList *list;
|
||||
GtkWidget *widget;
|
||||
GtkWidget *menu_item;
|
||||
guint num_entries;
|
||||
|
||||
/* ignore the add if we've already got the filename on the list */
|
||||
|
@ -1329,9 +1366,8 @@ menus_last_opened_add (gchar *filename)
|
|||
|
||||
if (num_entries == 0)
|
||||
{
|
||||
widget = gtk_item_factory_get_widget (toolbox_factory,
|
||||
file_menu_separator.entry.path);
|
||||
gtk_widget_show (widget);
|
||||
menu_item = gtk_item_factory_get_widget (toolbox_factory, "/File/---MRU");
|
||||
gtk_widget_show (menu_item);
|
||||
}
|
||||
|
||||
menus_last_opened_update_labels ();
|
||||
|
@ -1340,10 +1376,11 @@ menus_last_opened_add (gchar *filename)
|
|||
static void
|
||||
menus_init_mru (void)
|
||||
{
|
||||
gchar *paths, *accelerators;
|
||||
gint i;
|
||||
GimpItemFactoryEntry *last_opened_entries;
|
||||
GtkWidget *widget;
|
||||
GimpItemFactoryEntry *last_opened_entries;
|
||||
GtkWidget *menu_item;
|
||||
gchar *paths;
|
||||
gchar *accelerators;
|
||||
gint i;
|
||||
|
||||
last_opened_entries = g_new (GimpItemFactoryEntry, last_opened_size);
|
||||
|
||||
|
@ -1379,14 +1416,20 @@ menus_init_mru (void)
|
|||
|
||||
for (i=0; i < last_opened_size; i++)
|
||||
{
|
||||
widget = gtk_item_factory_get_widget (toolbox_factory,
|
||||
last_opened_entries[i].entry.path);
|
||||
gtk_widget_hide (widget);
|
||||
menu_item =
|
||||
gtk_item_factory_get_widget (toolbox_factory,
|
||||
last_opened_entries[i].entry.path);
|
||||
gtk_widget_hide (menu_item);
|
||||
}
|
||||
|
||||
widget = gtk_item_factory_get_widget (toolbox_factory,
|
||||
file_menu_separator.entry.path);
|
||||
gtk_widget_hide (widget);
|
||||
menu_item = gtk_item_factory_get_widget (toolbox_factory, "/File/---MRU");
|
||||
if (menu_item && menu_item->parent)
|
||||
gtk_menu_reorder_child (GTK_MENU (menu_item->parent), menu_item, -1);
|
||||
gtk_widget_hide (menu_item);
|
||||
|
||||
menu_item = gtk_item_factory_get_widget (toolbox_factory, "/File/Quit");
|
||||
if (menu_item && menu_item->parent)
|
||||
gtk_menu_reorder_child (GTK_MENU (menu_item->parent), menu_item, -1);
|
||||
|
||||
g_free (paths);
|
||||
g_free (accelerators);
|
||||
|
@ -1466,23 +1509,23 @@ menus_create_item (GtkItemFactory *item_factory,
|
|||
gpointer callback_data,
|
||||
guint callback_type)
|
||||
{
|
||||
GtkWidget *item;
|
||||
GtkWidget *menu_item;
|
||||
|
||||
gtk_item_factory_create_item (item_factory,
|
||||
(GtkItemFactoryEntry *) entry,
|
||||
callback_data,
|
||||
callback_type);
|
||||
|
||||
item = gtk_item_factory_get_item (item_factory,
|
||||
((GtkItemFactoryEntry *) entry)->path);
|
||||
menu_item = gtk_item_factory_get_item (item_factory,
|
||||
((GtkItemFactoryEntry *) entry)->path);
|
||||
|
||||
if (item)
|
||||
if (menu_item)
|
||||
{
|
||||
gtk_signal_connect_after (GTK_OBJECT (item), "realize",
|
||||
gtk_signal_connect_after (GTK_OBJECT (menu_item), "realize",
|
||||
GTK_SIGNAL_FUNC (menus_item_realize),
|
||||
(gpointer) item_factory);
|
||||
|
||||
gtk_object_set_data (GTK_OBJECT (item), "help_page",
|
||||
gtk_object_set_data (GTK_OBJECT (menu_item), "help_page",
|
||||
(gpointer) entry->help_page);
|
||||
}
|
||||
}
|
||||
|
@ -1530,157 +1573,149 @@ menus_create_items (GtkItemFactory *item_factory,
|
|||
}
|
||||
|
||||
static void
|
||||
menus_init_toolbox (void)
|
||||
menus_init (void)
|
||||
{
|
||||
toolbox_factory = gtk_item_factory_new (GTK_TYPE_MENU_BAR, "<Toolbox>", NULL);
|
||||
GtkWidget *menu_item;
|
||||
gchar *filename;
|
||||
gint i;
|
||||
|
||||
if (! initialize)
|
||||
return;
|
||||
|
||||
initialize = FALSE;
|
||||
|
||||
toolbox_factory = gtk_item_factory_new (GTK_TYPE_MENU_BAR, "<Toolbox>",
|
||||
NULL);
|
||||
gtk_object_set_data (GTK_OBJECT (toolbox_factory), "help_path",
|
||||
(gpointer) "toolbox");
|
||||
gtk_item_factory_set_translate_func (toolbox_factory, menu_translate,
|
||||
"<Toolbox>", NULL);
|
||||
menus_create_items (toolbox_factory, n_toolbox_entries,
|
||||
toolbox_entries, NULL, 2);
|
||||
"<Toolbox>", NULL);
|
||||
menus_create_items (toolbox_factory,
|
||||
n_toolbox_entries,
|
||||
toolbox_entries,
|
||||
NULL, 2);
|
||||
|
||||
menus_init_mru ();
|
||||
|
||||
menus_create_items (toolbox_factory, 1,
|
||||
&file_menu_separator, NULL, 2);
|
||||
image_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<Image>", NULL);
|
||||
gtk_object_set_data (GTK_OBJECT (image_factory), "help_path",
|
||||
(gpointer) "image");
|
||||
gtk_item_factory_set_translate_func (image_factory, menu_translate,
|
||||
"<Image>", NULL);
|
||||
menus_create_items (image_factory,
|
||||
n_image_entries,
|
||||
image_entries,
|
||||
NULL, 2);
|
||||
|
||||
menus_create_items (toolbox_factory, 1,
|
||||
&toolbox_end, NULL, 2);
|
||||
}
|
||||
load_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<Load>", NULL);
|
||||
gtk_object_set_data (GTK_OBJECT (load_factory), "help_path",
|
||||
(gpointer) "open");
|
||||
gtk_item_factory_set_translate_func (load_factory, menu_translate,
|
||||
"<Load>", NULL);
|
||||
menus_create_items (load_factory,
|
||||
n_load_entries,
|
||||
load_entries,
|
||||
NULL, 2);
|
||||
|
||||
static void
|
||||
menus_init (void)
|
||||
{
|
||||
gint i;
|
||||
save_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<Save>", NULL);
|
||||
gtk_object_set_data (GTK_OBJECT (save_factory), "help_path",
|
||||
(gpointer) "save");
|
||||
gtk_item_factory_set_translate_func (save_factory, menu_translate,
|
||||
"<Save>", NULL);
|
||||
menus_create_items (save_factory,
|
||||
n_save_entries,
|
||||
save_entries,
|
||||
NULL, 2);
|
||||
|
||||
if (initialize)
|
||||
layers_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<Layers>", NULL);
|
||||
gtk_object_set_data (GTK_OBJECT (layers_factory), "help_path",
|
||||
(gpointer) "layers");
|
||||
gtk_item_factory_set_translate_func (layers_factory, menu_translate,
|
||||
"<Layers>", NULL);
|
||||
menus_create_items (layers_factory,
|
||||
n_layers_entries,
|
||||
layers_entries,
|
||||
NULL, 2);
|
||||
|
||||
channels_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<Channels>", NULL);
|
||||
gtk_object_set_data (GTK_OBJECT (channels_factory), "help_path",
|
||||
(gpointer) "channels");
|
||||
gtk_item_factory_set_translate_func (channels_factory, menu_translate,
|
||||
"<Channels>", NULL);
|
||||
menus_create_items (channels_factory,
|
||||
n_channels_entries,
|
||||
channels_entries,
|
||||
NULL, 2);
|
||||
|
||||
paths_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<Paths>", NULL);
|
||||
gtk_object_set_data (GTK_OBJECT (paths_factory), "help_path",
|
||||
(gpointer) "paths");
|
||||
gtk_item_factory_set_translate_func (paths_factory, menu_translate,
|
||||
"<Paths>", NULL);
|
||||
menus_create_items (paths_factory,
|
||||
n_paths_entries,
|
||||
paths_entries,
|
||||
NULL, 2);
|
||||
|
||||
for (i = 0; i < num_tools; i++)
|
||||
{
|
||||
GtkWidget *menu_item;
|
||||
gchar *filename;
|
||||
/* FIXME this need to use access functions to check a flag */
|
||||
if (tool_info[i].menu_path)
|
||||
menus_tools_create (&tool_info[i]);
|
||||
}
|
||||
|
||||
initialize = FALSE;
|
||||
/* reorder <Image>/Image/Colors */
|
||||
menu_item = gtk_item_factory_get_widget (image_factory,
|
||||
tool_info[POSTERIZE].menu_path);
|
||||
if (menu_item && menu_item->parent)
|
||||
gtk_menu_reorder_child (GTK_MENU (menu_item->parent), menu_item, 3);
|
||||
|
||||
menus_init_toolbox ();
|
||||
{
|
||||
static ToolType color_tools[] = { COLOR_BALANCE,
|
||||
HUE_SATURATION,
|
||||
BRIGHTNESS_CONTRAST,
|
||||
THRESHOLD,
|
||||
LEVELS,
|
||||
CURVES };
|
||||
static gint n_color_tools = (sizeof (color_tools) /
|
||||
sizeof (color_tools[0]));
|
||||
gint i, pos;
|
||||
|
||||
image_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<Image>", NULL);
|
||||
gtk_object_set_data (GTK_OBJECT (image_factory), "help_path",
|
||||
(gpointer) "image");
|
||||
gtk_item_factory_set_translate_func (image_factory,
|
||||
menu_translate,
|
||||
"<Image>", NULL);
|
||||
menus_create_items (image_factory,
|
||||
n_image_entries,
|
||||
image_entries,
|
||||
NULL, 2);
|
||||
|
||||
load_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<Load>", NULL);
|
||||
gtk_object_set_data (GTK_OBJECT (load_factory), "help_path",
|
||||
(gpointer) "open");
|
||||
gtk_item_factory_set_translate_func (load_factory,
|
||||
menu_translate,
|
||||
NULL, NULL);
|
||||
menus_create_items (load_factory,
|
||||
n_load_entries,
|
||||
load_entries,
|
||||
NULL, 2);
|
||||
|
||||
save_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<Save>", NULL);
|
||||
gtk_object_set_data (GTK_OBJECT (save_factory), "help_path",
|
||||
(gpointer) "save");
|
||||
gtk_item_factory_set_translate_func (save_factory,
|
||||
menu_translate,
|
||||
NULL, NULL);
|
||||
menus_create_items (save_factory,
|
||||
n_save_entries,
|
||||
save_entries,
|
||||
NULL, 2);
|
||||
|
||||
layers_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<Layers>", NULL);
|
||||
gtk_object_set_data (GTK_OBJECT (layers_factory), "help_path",
|
||||
(gpointer) "layers");
|
||||
gtk_item_factory_set_translate_func (layers_factory,
|
||||
menu_translate,
|
||||
NULL, NULL);
|
||||
menus_create_items (layers_factory,
|
||||
n_layers_entries,
|
||||
layers_entries,
|
||||
NULL, 2);
|
||||
|
||||
channels_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<Channels>", NULL);
|
||||
gtk_object_set_data (GTK_OBJECT (channels_factory), "help_path",
|
||||
(gpointer) "channels");
|
||||
gtk_item_factory_set_translate_func (channels_factory,
|
||||
menu_translate,
|
||||
NULL, NULL);
|
||||
menus_create_items (channels_factory,
|
||||
n_channels_entries,
|
||||
channels_entries,
|
||||
NULL, 2);
|
||||
|
||||
paths_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<Paths>", NULL);
|
||||
gtk_object_set_data (GTK_OBJECT (paths_factory), "help_path",
|
||||
(gpointer) "paths");
|
||||
gtk_item_factory_set_translate_func (paths_factory,
|
||||
menu_translate,
|
||||
NULL, NULL);
|
||||
menus_create_items (paths_factory,
|
||||
n_paths_entries,
|
||||
paths_entries,
|
||||
NULL, 2);
|
||||
|
||||
for (i = 0; i < num_tools; i++)
|
||||
{
|
||||
/* FIXME this need to use access functions to check a flag */
|
||||
if (tool_info[i].menu_path)
|
||||
menus_tools_create (&tool_info[i]);
|
||||
}
|
||||
|
||||
menu_item = gtk_item_factory_get_widget (image_factory,
|
||||
tool_info[POSTERIZE].menu_path);
|
||||
if (menu_item && menu_item->parent)
|
||||
gtk_menu_reorder_child (GTK_MENU (menu_item->parent), menu_item, 3);
|
||||
pos = 1;
|
||||
|
||||
for (i = 0; i < n_color_tools; i++)
|
||||
{
|
||||
static ToolType color_tools[] = { COLOR_BALANCE,
|
||||
HUE_SATURATION,
|
||||
BRIGHTNESS_CONTRAST,
|
||||
THRESHOLD,
|
||||
LEVELS,
|
||||
CURVES };
|
||||
static gint n_color_tools = (sizeof (color_tools) /
|
||||
sizeof (color_tools[0]));
|
||||
gint i, pos;
|
||||
|
||||
pos = 1;
|
||||
|
||||
for (i = 0; i < n_color_tools; i++)
|
||||
menu_item =
|
||||
gtk_item_factory_get_widget (image_factory,
|
||||
tool_info[color_tools[i]].menu_path);
|
||||
if (menu_item && menu_item->parent)
|
||||
{
|
||||
menu_item =
|
||||
gtk_item_factory_get_widget (image_factory,
|
||||
tool_info[color_tools[i]].menu_path);
|
||||
if (menu_item && menu_item->parent)
|
||||
{
|
||||
gtk_menu_reorder_child (GTK_MENU (menu_item->parent),
|
||||
menu_item, pos);
|
||||
pos++;
|
||||
}
|
||||
gtk_menu_reorder_child (GTK_MENU (menu_item->parent),
|
||||
menu_item, pos);
|
||||
pos++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
filename = gimp_personal_rc_file ("menurc");
|
||||
gtk_item_factory_parse_rc (filename);
|
||||
g_free (filename);
|
||||
}
|
||||
filename = gimp_personal_rc_file ("menurc");
|
||||
gtk_item_factory_parse_rc (filename);
|
||||
g_free (filename);
|
||||
}
|
||||
|
||||
static gchar *
|
||||
menu_translate (const gchar *path,
|
||||
gpointer data)
|
||||
{
|
||||
static gchar *plugin_domains[] = { "gimp-std-plugins",
|
||||
"gimp-perl" };
|
||||
static gint n_plugin_domains = (sizeof (plugin_domains) /
|
||||
sizeof (plugin_domains[0]));
|
||||
|
||||
static gchar *menupath = NULL;
|
||||
|
||||
gchar *retval;
|
||||
gchar *factory;
|
||||
gint i;
|
||||
|
||||
factory = (gchar *) data;
|
||||
|
||||
|
@ -1696,18 +1731,14 @@ menu_translate (const gchar *path,
|
|||
|
||||
retval = gettext (menupath);
|
||||
|
||||
if (!strcmp (path, retval) && factory)
|
||||
i = 0;
|
||||
while (i < n_plugin_domains && !strcmp (path, retval) && factory)
|
||||
{
|
||||
g_free (menupath);
|
||||
|
||||
menupath = g_strconcat (factory, path, NULL);
|
||||
|
||||
retval = dgettext ("gimp-std-plugins", menupath) + strlen (factory);
|
||||
|
||||
if (!strcmp (path, retval))
|
||||
{
|
||||
retval = dgettext ("gimp-perl", menupath) + strlen (factory);
|
||||
}
|
||||
retval = dgettext (plugin_domains[i++], menupath) + strlen (factory);
|
||||
}
|
||||
|
||||
return retval;
|
||||
|
@ -1739,7 +1770,7 @@ tearoff_cmd_callback (GtkWidget *widget,
|
|||
/* This should be a window */
|
||||
if (!GTK_IS_WINDOW (top))
|
||||
{
|
||||
g_message("tearoff menu not in top level window");
|
||||
g_message ("tearoff menu not in top level window");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1748,7 +1779,7 @@ tearoff_cmd_callback (GtkWidget *widget,
|
|||
"delete_event",
|
||||
GTK_SIGNAL_FUNC (tearoff_delete_cb),
|
||||
GTK_OBJECT (top));
|
||||
|
||||
|
||||
gtk_object_set_data (GTK_OBJECT (widget), "tearoff_menu_top",
|
||||
top);
|
||||
}
|
||||
|
|
|
@ -174,8 +174,13 @@ static GimpItemFactoryEntry toolbox_entries[] =
|
|||
|
||||
{ { "/File/---", NULL, NULL, 0, "<Separator>" },
|
||||
NULL, NULL },
|
||||
{ { "/File/---", NULL, NULL, 0, "<Separator>" },
|
||||
|
||||
/* MRU entries are inserted here */
|
||||
|
||||
{ { "/File/---MRU", NULL, NULL, 0, "<Separator>" },
|
||||
NULL, NULL },
|
||||
{ { N_("/File/Quit"), "<control>Q", file_quit_cmd_callback, 0 },
|
||||
"file/quit.html", NULL },
|
||||
|
||||
/* <Toolbox>/Xtns */
|
||||
|
||||
|
@ -206,14 +211,6 @@ static guint n_toolbox_entries = (sizeof (toolbox_entries) /
|
|||
sizeof (toolbox_entries[0]));
|
||||
static GtkItemFactory *toolbox_factory = NULL;
|
||||
|
||||
static GimpItemFactoryEntry file_menu_separator =
|
||||
{ { "/File/---", NULL, NULL, 0, "<Separator>" },
|
||||
NULL, NULL };
|
||||
|
||||
static GimpItemFactoryEntry toolbox_end =
|
||||
{ { N_("/File/Quit"), "<control>Q", file_quit_cmd_callback, 0 },
|
||||
"file/quit.html", NULL };
|
||||
|
||||
/***** <Image> *****/
|
||||
|
||||
static GimpItemFactoryEntry image_entries[] =
|
||||
|
@ -581,7 +578,7 @@ static GimpItemFactoryEntry image_entries[] =
|
|||
{ { N_("/Filters/Web"), NULL, NULL, 0, "<Branch>" },
|
||||
NULL, NULL },
|
||||
|
||||
{ { "/Filters/---", NULL, NULL, 0, "<Separator>" },
|
||||
{ { "/Filters/---INSERT", NULL, NULL, 0, "<Separator>" },
|
||||
NULL, NULL },
|
||||
{ { N_("/Filters/Animation"), NULL, NULL, 0, "<Branch>" },
|
||||
NULL, NULL },
|
||||
|
@ -1037,10 +1034,14 @@ menus_reorder_plugins (void)
|
|||
static gint n_reorder_submenus = (sizeof (reorder_submenus) /
|
||||
sizeof (reorder_submenus[0]));
|
||||
|
||||
static gchar *reorder_sub_submenus[] = { "<Image>/Filters",
|
||||
"<Toolbox>/Xtns" };
|
||||
static gint n_reorder_sub_submenus = (sizeof (reorder_sub_submenus) /
|
||||
sizeof (reorder_sub_submenus[0]));
|
||||
static gchar *reorder_subsubmenus[] = { "<Image>/Filters",
|
||||
"<Toolbox>/Xtns" };
|
||||
static gint n_reorder_subsubmenus = (sizeof (reorder_subsubmenus) /
|
||||
sizeof (reorder_subsubmenus[0]));
|
||||
|
||||
static gchar *reorder_if_exists[] = { "/Filters/Misc" };
|
||||
static gint n_reorder_if_exists = (sizeof (reorder_if_exists) /
|
||||
sizeof (reorder_if_exists[0]));
|
||||
|
||||
GtkItemFactory *item_factory;
|
||||
GtkWidget *menu_item;
|
||||
|
@ -1123,11 +1124,11 @@ menus_reorder_plugins (void)
|
|||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < n_reorder_sub_submenus; i++)
|
||||
for (i = 0; i < n_reorder_subsubmenus; i++)
|
||||
{
|
||||
item_factory = gtk_item_factory_from_path (reorder_sub_submenus[i]);
|
||||
item_factory = gtk_item_factory_from_path (reorder_subsubmenus[i]);
|
||||
menu = gtk_item_factory_get_widget (item_factory,
|
||||
reorder_sub_submenus[i]);
|
||||
reorder_subsubmenus[i]);
|
||||
|
||||
if (menu && GTK_IS_MENU (menu))
|
||||
{
|
||||
|
@ -1143,6 +1144,41 @@ menus_reorder_plugins (void)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Reorder submenus of <Image>/Filters which only exist sometimes */
|
||||
menu_item = gtk_item_factory_get_widget (image_factory,
|
||||
"/Filters/---INSERT");
|
||||
|
||||
if (menu_item && menu_item->parent && GTK_IS_MENU (menu_item->parent))
|
||||
{
|
||||
menu = menu_item->parent;
|
||||
pos = g_list_index (GTK_MENU_SHELL (menu)->children, menu_item);
|
||||
|
||||
for (i = 0; i < n_reorder_if_exists; i++)
|
||||
{
|
||||
GList *list;
|
||||
|
||||
menu_item = gtk_item_factory_get_widget (image_factory,
|
||||
reorder_if_exists[i]);
|
||||
|
||||
if (menu_item && GTK_IS_MENU (menu_item))
|
||||
{
|
||||
for (list = GTK_MENU_SHELL (menu)->children; list;
|
||||
list = g_list_next (list))
|
||||
{
|
||||
if (GTK_MENU_ITEM (list->data)->submenu == menu_item)
|
||||
break;
|
||||
}
|
||||
|
||||
if (list)
|
||||
{
|
||||
gtk_menu_reorder_child (GTK_MENU (menu),
|
||||
GTK_WIDGET (list->data), pos);
|
||||
pos++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1285,12 +1321,13 @@ menus_last_opened_update_labels (void)
|
|||
g_string_sprintf (path, "/File/MRU%02d", i);
|
||||
|
||||
widget = gtk_item_factory_get_widget (toolbox_factory, path->str);
|
||||
if (widget != NULL) {
|
||||
gtk_widget_show (widget);
|
||||
if (widget)
|
||||
{
|
||||
gtk_widget_show (widget);
|
||||
|
||||
gtk_label_set (GTK_LABEL (GTK_BIN (widget)->child),
|
||||
entry_filename->str);
|
||||
}
|
||||
gtk_label_set (GTK_LABEL (GTK_BIN (widget)->child),
|
||||
entry_filename->str);
|
||||
}
|
||||
filename_slist = filename_slist->next;
|
||||
}
|
||||
|
||||
|
@ -1303,7 +1340,7 @@ menus_last_opened_add (gchar *filename)
|
|||
{
|
||||
GString *raw_filename;
|
||||
GSList *list;
|
||||
GtkWidget *widget;
|
||||
GtkWidget *menu_item;
|
||||
guint num_entries;
|
||||
|
||||
/* ignore the add if we've already got the filename on the list */
|
||||
|
@ -1329,9 +1366,8 @@ menus_last_opened_add (gchar *filename)
|
|||
|
||||
if (num_entries == 0)
|
||||
{
|
||||
widget = gtk_item_factory_get_widget (toolbox_factory,
|
||||
file_menu_separator.entry.path);
|
||||
gtk_widget_show (widget);
|
||||
menu_item = gtk_item_factory_get_widget (toolbox_factory, "/File/---MRU");
|
||||
gtk_widget_show (menu_item);
|
||||
}
|
||||
|
||||
menus_last_opened_update_labels ();
|
||||
|
@ -1340,10 +1376,11 @@ menus_last_opened_add (gchar *filename)
|
|||
static void
|
||||
menus_init_mru (void)
|
||||
{
|
||||
gchar *paths, *accelerators;
|
||||
gint i;
|
||||
GimpItemFactoryEntry *last_opened_entries;
|
||||
GtkWidget *widget;
|
||||
GimpItemFactoryEntry *last_opened_entries;
|
||||
GtkWidget *menu_item;
|
||||
gchar *paths;
|
||||
gchar *accelerators;
|
||||
gint i;
|
||||
|
||||
last_opened_entries = g_new (GimpItemFactoryEntry, last_opened_size);
|
||||
|
||||
|
@ -1379,14 +1416,20 @@ menus_init_mru (void)
|
|||
|
||||
for (i=0; i < last_opened_size; i++)
|
||||
{
|
||||
widget = gtk_item_factory_get_widget (toolbox_factory,
|
||||
last_opened_entries[i].entry.path);
|
||||
gtk_widget_hide (widget);
|
||||
menu_item =
|
||||
gtk_item_factory_get_widget (toolbox_factory,
|
||||
last_opened_entries[i].entry.path);
|
||||
gtk_widget_hide (menu_item);
|
||||
}
|
||||
|
||||
widget = gtk_item_factory_get_widget (toolbox_factory,
|
||||
file_menu_separator.entry.path);
|
||||
gtk_widget_hide (widget);
|
||||
menu_item = gtk_item_factory_get_widget (toolbox_factory, "/File/---MRU");
|
||||
if (menu_item && menu_item->parent)
|
||||
gtk_menu_reorder_child (GTK_MENU (menu_item->parent), menu_item, -1);
|
||||
gtk_widget_hide (menu_item);
|
||||
|
||||
menu_item = gtk_item_factory_get_widget (toolbox_factory, "/File/Quit");
|
||||
if (menu_item && menu_item->parent)
|
||||
gtk_menu_reorder_child (GTK_MENU (menu_item->parent), menu_item, -1);
|
||||
|
||||
g_free (paths);
|
||||
g_free (accelerators);
|
||||
|
@ -1466,23 +1509,23 @@ menus_create_item (GtkItemFactory *item_factory,
|
|||
gpointer callback_data,
|
||||
guint callback_type)
|
||||
{
|
||||
GtkWidget *item;
|
||||
GtkWidget *menu_item;
|
||||
|
||||
gtk_item_factory_create_item (item_factory,
|
||||
(GtkItemFactoryEntry *) entry,
|
||||
callback_data,
|
||||
callback_type);
|
||||
|
||||
item = gtk_item_factory_get_item (item_factory,
|
||||
((GtkItemFactoryEntry *) entry)->path);
|
||||
menu_item = gtk_item_factory_get_item (item_factory,
|
||||
((GtkItemFactoryEntry *) entry)->path);
|
||||
|
||||
if (item)
|
||||
if (menu_item)
|
||||
{
|
||||
gtk_signal_connect_after (GTK_OBJECT (item), "realize",
|
||||
gtk_signal_connect_after (GTK_OBJECT (menu_item), "realize",
|
||||
GTK_SIGNAL_FUNC (menus_item_realize),
|
||||
(gpointer) item_factory);
|
||||
|
||||
gtk_object_set_data (GTK_OBJECT (item), "help_page",
|
||||
gtk_object_set_data (GTK_OBJECT (menu_item), "help_page",
|
||||
(gpointer) entry->help_page);
|
||||
}
|
||||
}
|
||||
|
@ -1530,157 +1573,149 @@ menus_create_items (GtkItemFactory *item_factory,
|
|||
}
|
||||
|
||||
static void
|
||||
menus_init_toolbox (void)
|
||||
menus_init (void)
|
||||
{
|
||||
toolbox_factory = gtk_item_factory_new (GTK_TYPE_MENU_BAR, "<Toolbox>", NULL);
|
||||
GtkWidget *menu_item;
|
||||
gchar *filename;
|
||||
gint i;
|
||||
|
||||
if (! initialize)
|
||||
return;
|
||||
|
||||
initialize = FALSE;
|
||||
|
||||
toolbox_factory = gtk_item_factory_new (GTK_TYPE_MENU_BAR, "<Toolbox>",
|
||||
NULL);
|
||||
gtk_object_set_data (GTK_OBJECT (toolbox_factory), "help_path",
|
||||
(gpointer) "toolbox");
|
||||
gtk_item_factory_set_translate_func (toolbox_factory, menu_translate,
|
||||
"<Toolbox>", NULL);
|
||||
menus_create_items (toolbox_factory, n_toolbox_entries,
|
||||
toolbox_entries, NULL, 2);
|
||||
"<Toolbox>", NULL);
|
||||
menus_create_items (toolbox_factory,
|
||||
n_toolbox_entries,
|
||||
toolbox_entries,
|
||||
NULL, 2);
|
||||
|
||||
menus_init_mru ();
|
||||
|
||||
menus_create_items (toolbox_factory, 1,
|
||||
&file_menu_separator, NULL, 2);
|
||||
image_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<Image>", NULL);
|
||||
gtk_object_set_data (GTK_OBJECT (image_factory), "help_path",
|
||||
(gpointer) "image");
|
||||
gtk_item_factory_set_translate_func (image_factory, menu_translate,
|
||||
"<Image>", NULL);
|
||||
menus_create_items (image_factory,
|
||||
n_image_entries,
|
||||
image_entries,
|
||||
NULL, 2);
|
||||
|
||||
menus_create_items (toolbox_factory, 1,
|
||||
&toolbox_end, NULL, 2);
|
||||
}
|
||||
load_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<Load>", NULL);
|
||||
gtk_object_set_data (GTK_OBJECT (load_factory), "help_path",
|
||||
(gpointer) "open");
|
||||
gtk_item_factory_set_translate_func (load_factory, menu_translate,
|
||||
"<Load>", NULL);
|
||||
menus_create_items (load_factory,
|
||||
n_load_entries,
|
||||
load_entries,
|
||||
NULL, 2);
|
||||
|
||||
static void
|
||||
menus_init (void)
|
||||
{
|
||||
gint i;
|
||||
save_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<Save>", NULL);
|
||||
gtk_object_set_data (GTK_OBJECT (save_factory), "help_path",
|
||||
(gpointer) "save");
|
||||
gtk_item_factory_set_translate_func (save_factory, menu_translate,
|
||||
"<Save>", NULL);
|
||||
menus_create_items (save_factory,
|
||||
n_save_entries,
|
||||
save_entries,
|
||||
NULL, 2);
|
||||
|
||||
if (initialize)
|
||||
layers_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<Layers>", NULL);
|
||||
gtk_object_set_data (GTK_OBJECT (layers_factory), "help_path",
|
||||
(gpointer) "layers");
|
||||
gtk_item_factory_set_translate_func (layers_factory, menu_translate,
|
||||
"<Layers>", NULL);
|
||||
menus_create_items (layers_factory,
|
||||
n_layers_entries,
|
||||
layers_entries,
|
||||
NULL, 2);
|
||||
|
||||
channels_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<Channels>", NULL);
|
||||
gtk_object_set_data (GTK_OBJECT (channels_factory), "help_path",
|
||||
(gpointer) "channels");
|
||||
gtk_item_factory_set_translate_func (channels_factory, menu_translate,
|
||||
"<Channels>", NULL);
|
||||
menus_create_items (channels_factory,
|
||||
n_channels_entries,
|
||||
channels_entries,
|
||||
NULL, 2);
|
||||
|
||||
paths_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<Paths>", NULL);
|
||||
gtk_object_set_data (GTK_OBJECT (paths_factory), "help_path",
|
||||
(gpointer) "paths");
|
||||
gtk_item_factory_set_translate_func (paths_factory, menu_translate,
|
||||
"<Paths>", NULL);
|
||||
menus_create_items (paths_factory,
|
||||
n_paths_entries,
|
||||
paths_entries,
|
||||
NULL, 2);
|
||||
|
||||
for (i = 0; i < num_tools; i++)
|
||||
{
|
||||
GtkWidget *menu_item;
|
||||
gchar *filename;
|
||||
/* FIXME this need to use access functions to check a flag */
|
||||
if (tool_info[i].menu_path)
|
||||
menus_tools_create (&tool_info[i]);
|
||||
}
|
||||
|
||||
initialize = FALSE;
|
||||
/* reorder <Image>/Image/Colors */
|
||||
menu_item = gtk_item_factory_get_widget (image_factory,
|
||||
tool_info[POSTERIZE].menu_path);
|
||||
if (menu_item && menu_item->parent)
|
||||
gtk_menu_reorder_child (GTK_MENU (menu_item->parent), menu_item, 3);
|
||||
|
||||
menus_init_toolbox ();
|
||||
{
|
||||
static ToolType color_tools[] = { COLOR_BALANCE,
|
||||
HUE_SATURATION,
|
||||
BRIGHTNESS_CONTRAST,
|
||||
THRESHOLD,
|
||||
LEVELS,
|
||||
CURVES };
|
||||
static gint n_color_tools = (sizeof (color_tools) /
|
||||
sizeof (color_tools[0]));
|
||||
gint i, pos;
|
||||
|
||||
image_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<Image>", NULL);
|
||||
gtk_object_set_data (GTK_OBJECT (image_factory), "help_path",
|
||||
(gpointer) "image");
|
||||
gtk_item_factory_set_translate_func (image_factory,
|
||||
menu_translate,
|
||||
"<Image>", NULL);
|
||||
menus_create_items (image_factory,
|
||||
n_image_entries,
|
||||
image_entries,
|
||||
NULL, 2);
|
||||
|
||||
load_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<Load>", NULL);
|
||||
gtk_object_set_data (GTK_OBJECT (load_factory), "help_path",
|
||||
(gpointer) "open");
|
||||
gtk_item_factory_set_translate_func (load_factory,
|
||||
menu_translate,
|
||||
NULL, NULL);
|
||||
menus_create_items (load_factory,
|
||||
n_load_entries,
|
||||
load_entries,
|
||||
NULL, 2);
|
||||
|
||||
save_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<Save>", NULL);
|
||||
gtk_object_set_data (GTK_OBJECT (save_factory), "help_path",
|
||||
(gpointer) "save");
|
||||
gtk_item_factory_set_translate_func (save_factory,
|
||||
menu_translate,
|
||||
NULL, NULL);
|
||||
menus_create_items (save_factory,
|
||||
n_save_entries,
|
||||
save_entries,
|
||||
NULL, 2);
|
||||
|
||||
layers_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<Layers>", NULL);
|
||||
gtk_object_set_data (GTK_OBJECT (layers_factory), "help_path",
|
||||
(gpointer) "layers");
|
||||
gtk_item_factory_set_translate_func (layers_factory,
|
||||
menu_translate,
|
||||
NULL, NULL);
|
||||
menus_create_items (layers_factory,
|
||||
n_layers_entries,
|
||||
layers_entries,
|
||||
NULL, 2);
|
||||
|
||||
channels_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<Channels>", NULL);
|
||||
gtk_object_set_data (GTK_OBJECT (channels_factory), "help_path",
|
||||
(gpointer) "channels");
|
||||
gtk_item_factory_set_translate_func (channels_factory,
|
||||
menu_translate,
|
||||
NULL, NULL);
|
||||
menus_create_items (channels_factory,
|
||||
n_channels_entries,
|
||||
channels_entries,
|
||||
NULL, 2);
|
||||
|
||||
paths_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<Paths>", NULL);
|
||||
gtk_object_set_data (GTK_OBJECT (paths_factory), "help_path",
|
||||
(gpointer) "paths");
|
||||
gtk_item_factory_set_translate_func (paths_factory,
|
||||
menu_translate,
|
||||
NULL, NULL);
|
||||
menus_create_items (paths_factory,
|
||||
n_paths_entries,
|
||||
paths_entries,
|
||||
NULL, 2);
|
||||
|
||||
for (i = 0; i < num_tools; i++)
|
||||
{
|
||||
/* FIXME this need to use access functions to check a flag */
|
||||
if (tool_info[i].menu_path)
|
||||
menus_tools_create (&tool_info[i]);
|
||||
}
|
||||
|
||||
menu_item = gtk_item_factory_get_widget (image_factory,
|
||||
tool_info[POSTERIZE].menu_path);
|
||||
if (menu_item && menu_item->parent)
|
||||
gtk_menu_reorder_child (GTK_MENU (menu_item->parent), menu_item, 3);
|
||||
pos = 1;
|
||||
|
||||
for (i = 0; i < n_color_tools; i++)
|
||||
{
|
||||
static ToolType color_tools[] = { COLOR_BALANCE,
|
||||
HUE_SATURATION,
|
||||
BRIGHTNESS_CONTRAST,
|
||||
THRESHOLD,
|
||||
LEVELS,
|
||||
CURVES };
|
||||
static gint n_color_tools = (sizeof (color_tools) /
|
||||
sizeof (color_tools[0]));
|
||||
gint i, pos;
|
||||
|
||||
pos = 1;
|
||||
|
||||
for (i = 0; i < n_color_tools; i++)
|
||||
menu_item =
|
||||
gtk_item_factory_get_widget (image_factory,
|
||||
tool_info[color_tools[i]].menu_path);
|
||||
if (menu_item && menu_item->parent)
|
||||
{
|
||||
menu_item =
|
||||
gtk_item_factory_get_widget (image_factory,
|
||||
tool_info[color_tools[i]].menu_path);
|
||||
if (menu_item && menu_item->parent)
|
||||
{
|
||||
gtk_menu_reorder_child (GTK_MENU (menu_item->parent),
|
||||
menu_item, pos);
|
||||
pos++;
|
||||
}
|
||||
gtk_menu_reorder_child (GTK_MENU (menu_item->parent),
|
||||
menu_item, pos);
|
||||
pos++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
filename = gimp_personal_rc_file ("menurc");
|
||||
gtk_item_factory_parse_rc (filename);
|
||||
g_free (filename);
|
||||
}
|
||||
filename = gimp_personal_rc_file ("menurc");
|
||||
gtk_item_factory_parse_rc (filename);
|
||||
g_free (filename);
|
||||
}
|
||||
|
||||
static gchar *
|
||||
menu_translate (const gchar *path,
|
||||
gpointer data)
|
||||
{
|
||||
static gchar *plugin_domains[] = { "gimp-std-plugins",
|
||||
"gimp-perl" };
|
||||
static gint n_plugin_domains = (sizeof (plugin_domains) /
|
||||
sizeof (plugin_domains[0]));
|
||||
|
||||
static gchar *menupath = NULL;
|
||||
|
||||
gchar *retval;
|
||||
gchar *factory;
|
||||
gint i;
|
||||
|
||||
factory = (gchar *) data;
|
||||
|
||||
|
@ -1696,18 +1731,14 @@ menu_translate (const gchar *path,
|
|||
|
||||
retval = gettext (menupath);
|
||||
|
||||
if (!strcmp (path, retval) && factory)
|
||||
i = 0;
|
||||
while (i < n_plugin_domains && !strcmp (path, retval) && factory)
|
||||
{
|
||||
g_free (menupath);
|
||||
|
||||
menupath = g_strconcat (factory, path, NULL);
|
||||
|
||||
retval = dgettext ("gimp-std-plugins", menupath) + strlen (factory);
|
||||
|
||||
if (!strcmp (path, retval))
|
||||
{
|
||||
retval = dgettext ("gimp-perl", menupath) + strlen (factory);
|
||||
}
|
||||
retval = dgettext (plugin_domains[i++], menupath) + strlen (factory);
|
||||
}
|
||||
|
||||
return retval;
|
||||
|
@ -1739,7 +1770,7 @@ tearoff_cmd_callback (GtkWidget *widget,
|
|||
/* This should be a window */
|
||||
if (!GTK_IS_WINDOW (top))
|
||||
{
|
||||
g_message("tearoff menu not in top level window");
|
||||
g_message ("tearoff menu not in top level window");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1748,7 +1779,7 @@ tearoff_cmd_callback (GtkWidget *widget,
|
|||
"delete_event",
|
||||
GTK_SIGNAL_FUNC (tearoff_delete_cb),
|
||||
GTK_OBJECT (top));
|
||||
|
||||
|
||||
gtk_object_set_data (GTK_OBJECT (widget), "tearoff_menu_top",
|
||||
top);
|
||||
}
|
||||
|
|
|
@ -193,10 +193,10 @@ posterize_dialog_new (void)
|
|||
GTK_WIN_POS_NONE,
|
||||
FALSE, TRUE, FALSE,
|
||||
|
||||
_("Reset"), posterize_reset_callback,
|
||||
pd, NULL, TRUE, FALSE,
|
||||
_("OK"), posterize_ok_callback,
|
||||
pd, NULL, TRUE, FALSE,
|
||||
_("Reset"), posterize_reset_callback,
|
||||
pd, NULL, TRUE, FALSE,
|
||||
_("Cancel"), posterize_cancel_callback,
|
||||
pd, NULL, FALSE, TRUE,
|
||||
|
||||
|
|
|
@ -267,10 +267,10 @@ threshold_dialog_new (void)
|
|||
GTK_WIN_POS_NONE,
|
||||
FALSE, TRUE, FALSE,
|
||||
|
||||
_("Reset"), threshold_reset_callback,
|
||||
td, NULL, TRUE, FALSE,
|
||||
_("OK"), threshold_ok_callback,
|
||||
td, NULL, TRUE, FALSE,
|
||||
_("Reset"), threshold_reset_callback,
|
||||
td, NULL, TRUE, FALSE,
|
||||
_("Cancel"), threshold_cancel_callback,
|
||||
td, NULL, FALSE, TRUE,
|
||||
|
||||
|
|
|
@ -210,10 +210,10 @@ brightness_contrast_dialog_new (void)
|
|||
GTK_WIN_POS_NONE,
|
||||
FALSE, TRUE, FALSE,
|
||||
|
||||
_("Reset"), brightness_contrast_reset_callback,
|
||||
bcd, NULL, TRUE, FALSE,
|
||||
_("OK"), brightness_contrast_ok_callback,
|
||||
bcd, NULL, TRUE, FALSE,
|
||||
_("Reset"), brightness_contrast_reset_callback,
|
||||
bcd, NULL, TRUE, FALSE,
|
||||
_("Cancel"), brightness_contrast_cancel_callback,
|
||||
bcd, NULL, FALSE, TRUE,
|
||||
|
||||
|
|
|
@ -266,10 +266,10 @@ color_balance_dialog_new (void)
|
|||
GTK_WIN_POS_NONE,
|
||||
FALSE, TRUE, FALSE,
|
||||
|
||||
_("Reset"), color_balance_reset_callback,
|
||||
cbd, NULL, TRUE, FALSE,
|
||||
_("OK"), color_balance_ok_callback,
|
||||
cbd, NULL, TRUE, FALSE,
|
||||
_("Reset"), color_balance_reset_callback,
|
||||
cbd, NULL, TRUE, FALSE,
|
||||
_("Cancel"), color_balance_cancel_callback,
|
||||
cbd, NULL, FALSE, TRUE,
|
||||
|
||||
|
|
|
@ -557,10 +557,10 @@ curves_dialog_new (void)
|
|||
GTK_WIN_POS_NONE,
|
||||
FALSE, TRUE, FALSE,
|
||||
|
||||
_("Reset"), curves_reset_callback,
|
||||
cd, NULL, FALSE, FALSE,
|
||||
_("OK"), curves_ok_callback,
|
||||
cd, NULL, TRUE, FALSE,
|
||||
_("Reset"), curves_reset_callback,
|
||||
cd, NULL, FALSE, FALSE,
|
||||
_("Cancel"), curves_cancel_callback,
|
||||
cd, NULL, FALSE, TRUE,
|
||||
|
||||
|
|
|
@ -210,10 +210,10 @@ brightness_contrast_dialog_new (void)
|
|||
GTK_WIN_POS_NONE,
|
||||
FALSE, TRUE, FALSE,
|
||||
|
||||
_("Reset"), brightness_contrast_reset_callback,
|
||||
bcd, NULL, TRUE, FALSE,
|
||||
_("OK"), brightness_contrast_ok_callback,
|
||||
bcd, NULL, TRUE, FALSE,
|
||||
_("Reset"), brightness_contrast_reset_callback,
|
||||
bcd, NULL, TRUE, FALSE,
|
||||
_("Cancel"), brightness_contrast_cancel_callback,
|
||||
bcd, NULL, FALSE, TRUE,
|
||||
|
||||
|
|
|
@ -266,10 +266,10 @@ color_balance_dialog_new (void)
|
|||
GTK_WIN_POS_NONE,
|
||||
FALSE, TRUE, FALSE,
|
||||
|
||||
_("Reset"), color_balance_reset_callback,
|
||||
cbd, NULL, TRUE, FALSE,
|
||||
_("OK"), color_balance_ok_callback,
|
||||
cbd, NULL, TRUE, FALSE,
|
||||
_("Reset"), color_balance_reset_callback,
|
||||
cbd, NULL, TRUE, FALSE,
|
||||
_("Cancel"), color_balance_cancel_callback,
|
||||
cbd, NULL, FALSE, TRUE,
|
||||
|
||||
|
|
|
@ -557,10 +557,10 @@ curves_dialog_new (void)
|
|||
GTK_WIN_POS_NONE,
|
||||
FALSE, TRUE, FALSE,
|
||||
|
||||
_("Reset"), curves_reset_callback,
|
||||
cd, NULL, FALSE, FALSE,
|
||||
_("OK"), curves_ok_callback,
|
||||
cd, NULL, TRUE, FALSE,
|
||||
_("Reset"), curves_reset_callback,
|
||||
cd, NULL, FALSE, FALSE,
|
||||
_("Cancel"), curves_cancel_callback,
|
||||
cd, NULL, FALSE, TRUE,
|
||||
|
||||
|
|
|
@ -368,10 +368,10 @@ hue_saturation_dialog_new (void)
|
|||
GTK_WIN_POS_NONE,
|
||||
FALSE, TRUE, FALSE,
|
||||
|
||||
_("Reset"), hue_saturation_reset_callback,
|
||||
hsd, NULL, FALSE, FALSE,
|
||||
_("OK"), hue_saturation_ok_callback,
|
||||
hsd, NULL, TRUE, FALSE,
|
||||
_("Reset"), hue_saturation_reset_callback,
|
||||
hsd, NULL, FALSE, FALSE,
|
||||
_("Cancel"), hue_saturation_cancel_callback,
|
||||
hsd, NULL, FALSE, TRUE,
|
||||
|
||||
|
|
|
@ -361,10 +361,10 @@ levels_dialog_new (void)
|
|||
GTK_WIN_POS_NONE,
|
||||
FALSE, TRUE, FALSE,
|
||||
|
||||
_("Reset"), levels_reset_callback,
|
||||
ld, NULL, FALSE, FALSE,
|
||||
_("OK"), levels_ok_callback,
|
||||
ld, NULL, TRUE, FALSE,
|
||||
_("Reset"), levels_reset_callback,
|
||||
ld, NULL, FALSE, FALSE,
|
||||
_("Cancel"), levels_cancel_callback,
|
||||
ld, NULL, FALSE, TRUE,
|
||||
|
||||
|
|
|
@ -193,10 +193,10 @@ posterize_dialog_new (void)
|
|||
GTK_WIN_POS_NONE,
|
||||
FALSE, TRUE, FALSE,
|
||||
|
||||
_("Reset"), posterize_reset_callback,
|
||||
pd, NULL, TRUE, FALSE,
|
||||
_("OK"), posterize_ok_callback,
|
||||
pd, NULL, TRUE, FALSE,
|
||||
_("Reset"), posterize_reset_callback,
|
||||
pd, NULL, TRUE, FALSE,
|
||||
_("Cancel"), posterize_cancel_callback,
|
||||
pd, NULL, FALSE, TRUE,
|
||||
|
||||
|
|
|
@ -267,10 +267,10 @@ threshold_dialog_new (void)
|
|||
GTK_WIN_POS_NONE,
|
||||
FALSE, TRUE, FALSE,
|
||||
|
||||
_("Reset"), threshold_reset_callback,
|
||||
td, NULL, TRUE, FALSE,
|
||||
_("OK"), threshold_ok_callback,
|
||||
td, NULL, TRUE, FALSE,
|
||||
_("Reset"), threshold_reset_callback,
|
||||
td, NULL, TRUE, FALSE,
|
||||
_("Cancel"), threshold_cancel_callback,
|
||||
td, NULL, FALSE, TRUE,
|
||||
|
||||
|
|
|
@ -368,10 +368,10 @@ hue_saturation_dialog_new (void)
|
|||
GTK_WIN_POS_NONE,
|
||||
FALSE, TRUE, FALSE,
|
||||
|
||||
_("Reset"), hue_saturation_reset_callback,
|
||||
hsd, NULL, FALSE, FALSE,
|
||||
_("OK"), hue_saturation_ok_callback,
|
||||
hsd, NULL, TRUE, FALSE,
|
||||
_("Reset"), hue_saturation_reset_callback,
|
||||
hsd, NULL, FALSE, FALSE,
|
||||
_("Cancel"), hue_saturation_cancel_callback,
|
||||
hsd, NULL, FALSE, TRUE,
|
||||
|
||||
|
|
|
@ -361,10 +361,10 @@ levels_dialog_new (void)
|
|||
GTK_WIN_POS_NONE,
|
||||
FALSE, TRUE, FALSE,
|
||||
|
||||
_("Reset"), levels_reset_callback,
|
||||
ld, NULL, FALSE, FALSE,
|
||||
_("OK"), levels_ok_callback,
|
||||
ld, NULL, TRUE, FALSE,
|
||||
_("Reset"), levels_reset_callback,
|
||||
ld, NULL, FALSE, FALSE,
|
||||
_("Cancel"), levels_cancel_callback,
|
||||
ld, NULL, FALSE, TRUE,
|
||||
|
||||
|
|
|
@ -193,10 +193,10 @@ posterize_dialog_new (void)
|
|||
GTK_WIN_POS_NONE,
|
||||
FALSE, TRUE, FALSE,
|
||||
|
||||
_("Reset"), posterize_reset_callback,
|
||||
pd, NULL, TRUE, FALSE,
|
||||
_("OK"), posterize_ok_callback,
|
||||
pd, NULL, TRUE, FALSE,
|
||||
_("Reset"), posterize_reset_callback,
|
||||
pd, NULL, TRUE, FALSE,
|
||||
_("Cancel"), posterize_cancel_callback,
|
||||
pd, NULL, FALSE, TRUE,
|
||||
|
||||
|
|
|
@ -267,10 +267,10 @@ threshold_dialog_new (void)
|
|||
GTK_WIN_POS_NONE,
|
||||
FALSE, TRUE, FALSE,
|
||||
|
||||
_("Reset"), threshold_reset_callback,
|
||||
td, NULL, TRUE, FALSE,
|
||||
_("OK"), threshold_ok_callback,
|
||||
td, NULL, TRUE, FALSE,
|
||||
_("Reset"), threshold_reset_callback,
|
||||
td, NULL, TRUE, FALSE,
|
||||
_("Cancel"), threshold_cancel_callback,
|
||||
td, NULL, FALSE, TRUE,
|
||||
|
||||
|
|
|
@ -328,10 +328,11 @@ static void gradient_editor_drop_gradient (GtkWidget *widget,
|
|||
|
||||
/* Gradient editor functions */
|
||||
|
||||
static GtkWidget *ed_create_button (gchar *label,
|
||||
double xalign, double yalign,
|
||||
GtkSignalFunc signal_func,
|
||||
gpointer user_data);
|
||||
static GtkWidget *ed_create_button (gchar *label,
|
||||
gdouble xalign,
|
||||
gdouble yalign,
|
||||
GtkSignalFunc signal_func,
|
||||
gpointer data);
|
||||
|
||||
static void ed_fetch_foreground (double *fg_r, double *fg_g, double *fg_b,
|
||||
double *fg_a);
|
||||
|
@ -855,12 +856,13 @@ gradient_editor_create (void)
|
|||
GtkWidget *frame;
|
||||
GtkWidget *scrolled_win;
|
||||
GdkColormap *colormap;
|
||||
GtkWidget* pixmapwid;
|
||||
GdkPixmap* pixmap;
|
||||
GdkBitmap* mask;
|
||||
GtkStyle* style;
|
||||
gint i;
|
||||
gint select_pos;
|
||||
GtkWidget *pixmapwid;
|
||||
GdkPixmap *pixmap;
|
||||
GdkBitmap *mask;
|
||||
GtkStyle *style;
|
||||
gchar *titles[2];
|
||||
gint select_pos;
|
||||
gint i;
|
||||
|
||||
/* If the editor already exists, just show it */
|
||||
if (g_editor)
|
||||
|
@ -904,28 +906,23 @@ gradient_editor_create (void)
|
|||
|
||||
/* clist preview of gradients */
|
||||
scrolled_win = gtk_scrolled_window_new (NULL, NULL);
|
||||
|
||||
g_editor->clist = gtk_clist_new (2);
|
||||
gtk_clist_set_shadow_type (GTK_CLIST (g_editor->clist), GTK_SHADOW_IN);
|
||||
gtk_clist_set_row_height (GTK_CLIST (g_editor->clist), 18);
|
||||
gtk_clist_set_selection_mode (GTK_CLIST (g_editor->clist),
|
||||
GTK_SELECTION_BROWSE);
|
||||
|
||||
gtk_clist_set_column_width (GTK_CLIST (g_editor->clist), 0, 52);
|
||||
gtk_clist_set_column_title (GTK_CLIST (g_editor->clist), 0, _("Gradient"));
|
||||
gtk_clist_set_column_title (GTK_CLIST (g_editor->clist), 1, _("Name"));
|
||||
|
||||
gtk_clist_column_titles_show (GTK_CLIST (g_editor->clist));
|
||||
gtk_clist_set_use_drag_icons (GTK_CLIST (g_editor->clist), FALSE);
|
||||
gtk_clist_column_titles_passive (GTK_CLIST (g_editor->clist));
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (hbox), scrolled_win, TRUE, TRUE, 0);
|
||||
gtk_container_add (GTK_CONTAINER (scrolled_win), g_editor->clist);
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_win),
|
||||
GTK_POLICY_AUTOMATIC,
|
||||
GTK_POLICY_ALWAYS);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (hbox), scrolled_win, TRUE, TRUE, 0);
|
||||
gtk_widget_show (scrolled_win);
|
||||
|
||||
titles[0] = _("Gradient");
|
||||
titles[1] = _("Name");
|
||||
g_editor->clist = gtk_clist_new_with_titles (2, titles);
|
||||
gtk_clist_set_shadow_type (GTK_CLIST (g_editor->clist), GTK_SHADOW_IN);
|
||||
gtk_clist_set_selection_mode (GTK_CLIST (g_editor->clist),
|
||||
GTK_SELECTION_BROWSE);
|
||||
gtk_clist_set_row_height (GTK_CLIST (g_editor->clist), 18);
|
||||
gtk_clist_set_use_drag_icons (GTK_CLIST (g_editor->clist), FALSE);
|
||||
gtk_clist_column_titles_passive (GTK_CLIST (g_editor->clist));
|
||||
gtk_container_add (GTK_CONTAINER (scrolled_win), g_editor->clist);
|
||||
|
||||
gtk_widget_show (g_editor->clist);
|
||||
|
||||
colormap = gtk_widget_get_colormap (g_editor->clist);
|
||||
|
@ -965,31 +962,36 @@ gradient_editor_create (void)
|
|||
|
||||
/* Buttons for gradient functions */
|
||||
button = ed_create_button (_("New Gradient"), 0.5, 0.5,
|
||||
(GtkSignalFunc) ed_new_gradient_callback, NULL);
|
||||
GTK_SIGNAL_FUNC (ed_new_gradient_callback),
|
||||
NULL);
|
||||
GTK_WIDGET_UNSET_FLAGS (button, GTK_RECEIVES_DEFAULT);
|
||||
gtk_box_pack_start (GTK_BOX (gvbox), button, FALSE, FALSE, 0);
|
||||
gtk_widget_show (button);
|
||||
|
||||
button = ed_create_button (_("Copy Gradient"), 0.5, 0.5,
|
||||
(GtkSignalFunc) ed_copy_gradient_callback, NULL);
|
||||
GTK_SIGNAL_FUNC (ed_copy_gradient_callback),
|
||||
NULL);
|
||||
GTK_WIDGET_UNSET_FLAGS (button, GTK_RECEIVES_DEFAULT);
|
||||
gtk_box_pack_start (GTK_BOX (gvbox), button, FALSE, FALSE, 0);
|
||||
gtk_widget_show (button);
|
||||
|
||||
button = ed_create_button (_("Delete Gradient"), 0.5, 0.5,
|
||||
(GtkSignalFunc) ed_delete_gradient_callback, NULL);
|
||||
GTK_SIGNAL_FUNC (ed_delete_gradient_callback),
|
||||
NULL);
|
||||
GTK_WIDGET_UNSET_FLAGS (button, GTK_RECEIVES_DEFAULT);
|
||||
gtk_box_pack_start (GTK_BOX (gvbox), button, FALSE, FALSE, 0);
|
||||
gtk_widget_show (button);
|
||||
|
||||
button = ed_create_button (_("Rename Gradient"), 0.5, 0.5,
|
||||
(GtkSignalFunc) ed_rename_gradient_callback, NULL);
|
||||
GTK_SIGNAL_FUNC (ed_rename_gradient_callback),
|
||||
NULL);
|
||||
GTK_WIDGET_UNSET_FLAGS (button, GTK_RECEIVES_DEFAULT);
|
||||
gtk_box_pack_start (GTK_BOX (gvbox), button, FALSE, FALSE, 0);
|
||||
gtk_widget_show (button);
|
||||
|
||||
button = ed_create_button (_("Save as POV-Ray"), 0.5, 0.5,
|
||||
(GtkSignalFunc) ed_save_pov_callback, NULL);
|
||||
GTK_SIGNAL_FUNC (ed_save_pov_callback),
|
||||
NULL);
|
||||
GTK_WIDGET_UNSET_FLAGS (button, GTK_RECEIVES_DEFAULT);
|
||||
gtk_box_pack_start (GTK_BOX (gvbox), button, FALSE, FALSE, 0);
|
||||
gtk_widget_show (button);
|
||||
|
@ -1005,7 +1007,8 @@ gradient_editor_create (void)
|
|||
|
||||
/* Zoom all button */
|
||||
button = ed_create_button (_("Zoom all"), 0.5, 0.5,
|
||||
(GtkSignalFunc) ed_zoom_all_callback, g_editor);
|
||||
GTK_SIGNAL_FUNC (ed_zoom_all_callback),
|
||||
g_editor);
|
||||
GTK_WIDGET_UNSET_FLAGS (button, GTK_RECEIVES_DEFAULT);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
|
||||
gtk_widget_show (button);
|
||||
|
@ -1053,10 +1056,10 @@ gradient_editor_create (void)
|
|||
1.0);
|
||||
|
||||
gtk_signal_connect (g_editor->scroll_data, "value_changed",
|
||||
(GtkSignalFunc) ed_scrollbar_update,
|
||||
GTK_SIGNAL_FUNC (ed_scrollbar_update),
|
||||
g_editor);
|
||||
gtk_signal_connect (g_editor->scroll_data, "changed",
|
||||
(GtkSignalFunc) ed_scrollbar_update,
|
||||
GTK_SIGNAL_FUNC (ed_scrollbar_update),
|
||||
g_editor);
|
||||
|
||||
g_editor->scrollbar =
|
||||
|
@ -1072,7 +1075,7 @@ gradient_editor_create (void)
|
|||
button = gtk_check_button_new_with_label (_("Instant update"));
|
||||
gtk_box_pack_end (GTK_BOX (hbox), button, FALSE, FALSE, 0);
|
||||
gtk_signal_connect (GTK_OBJECT (button), "toggled",
|
||||
(GtkSignalFunc) ed_instant_update_update,
|
||||
GTK_SIGNAL_FUNC (ed_instant_update_update),
|
||||
g_editor);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
|
||||
gtk_widget_show (button);
|
||||
|
@ -1105,7 +1108,7 @@ gradient_editor_create (void)
|
|||
|
||||
gtk_widget_set_events (g_editor->preview, GRAD_PREVIEW_EVENT_MASK);
|
||||
gtk_signal_connect (GTK_OBJECT(g_editor->preview), "event",
|
||||
(GdkEventFunc) prev_events,
|
||||
GTK_SIGNAL_FUNC (prev_events),
|
||||
g_editor);
|
||||
|
||||
gtk_drag_dest_set (g_editor->preview,
|
||||
|
@ -1343,10 +1346,10 @@ ed_update_editor (int flags)
|
|||
|
||||
static GtkWidget *
|
||||
ed_create_button (gchar *label,
|
||||
double xalign,
|
||||
double yalign,
|
||||
gdouble xalign,
|
||||
gdouble yalign,
|
||||
GtkSignalFunc signal_func,
|
||||
gpointer user_data)
|
||||
gpointer data)
|
||||
{
|
||||
GtkWidget *button;
|
||||
GtkWidget *text;
|
||||
|
@ -1361,8 +1364,8 @@ ed_create_button (gchar *label,
|
|||
|
||||
if (signal_func != NULL)
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
(GtkSignalFunc) signal_func,
|
||||
user_data);
|
||||
signal_func,
|
||||
data);
|
||||
|
||||
return button;
|
||||
}
|
||||
|
@ -1373,7 +1376,7 @@ static void
|
|||
ed_set_hint (gchar *str)
|
||||
{
|
||||
gtk_label_set_text (GTK_LABEL (g_editor->hint_label), str);
|
||||
gdk_flush();
|
||||
/*gdk_flush();*/
|
||||
}
|
||||
|
||||
/*****/
|
||||
|
@ -2354,10 +2357,10 @@ prev_events (GtkWidget *widget,
|
|||
static void
|
||||
prev_set_hint (gint x)
|
||||
{
|
||||
double xpos;
|
||||
double r, g, b, a;
|
||||
double h, s, v;
|
||||
gchar str[256];
|
||||
gdouble xpos;
|
||||
gdouble r, g, b, a;
|
||||
gdouble h, s, v;
|
||||
gchar str[512];
|
||||
|
||||
xpos = control_calc_g_pos (x);
|
||||
|
||||
|
@ -2955,7 +2958,7 @@ control_extend_selection (grad_segment_t *seg,
|
|||
double pos)
|
||||
{
|
||||
if (fabs (pos - g_editor->control_sel_l->left) <
|
||||
fabs(pos - g_editor->control_sel_r->right))
|
||||
fabs (pos - g_editor->control_sel_r->right))
|
||||
g_editor->control_sel_l = seg;
|
||||
else
|
||||
g_editor->control_sel_r = seg;
|
||||
|
@ -2967,9 +2970,9 @@ static void
|
|||
control_motion (gint x)
|
||||
{
|
||||
grad_segment_t *seg;
|
||||
double pos;
|
||||
double delta;
|
||||
char str[256];
|
||||
gdouble pos;
|
||||
gdouble delta;
|
||||
gchar str[256];
|
||||
|
||||
seg = g_editor->control_drag_segment;
|
||||
|
||||
|
|
|
@ -174,8 +174,13 @@ static GimpItemFactoryEntry toolbox_entries[] =
|
|||
|
||||
{ { "/File/---", NULL, NULL, 0, "<Separator>" },
|
||||
NULL, NULL },
|
||||
{ { "/File/---", NULL, NULL, 0, "<Separator>" },
|
||||
|
||||
/* MRU entries are inserted here */
|
||||
|
||||
{ { "/File/---MRU", NULL, NULL, 0, "<Separator>" },
|
||||
NULL, NULL },
|
||||
{ { N_("/File/Quit"), "<control>Q", file_quit_cmd_callback, 0 },
|
||||
"file/quit.html", NULL },
|
||||
|
||||
/* <Toolbox>/Xtns */
|
||||
|
||||
|
@ -206,14 +211,6 @@ static guint n_toolbox_entries = (sizeof (toolbox_entries) /
|
|||
sizeof (toolbox_entries[0]));
|
||||
static GtkItemFactory *toolbox_factory = NULL;
|
||||
|
||||
static GimpItemFactoryEntry file_menu_separator =
|
||||
{ { "/File/---", NULL, NULL, 0, "<Separator>" },
|
||||
NULL, NULL };
|
||||
|
||||
static GimpItemFactoryEntry toolbox_end =
|
||||
{ { N_("/File/Quit"), "<control>Q", file_quit_cmd_callback, 0 },
|
||||
"file/quit.html", NULL };
|
||||
|
||||
/***** <Image> *****/
|
||||
|
||||
static GimpItemFactoryEntry image_entries[] =
|
||||
|
@ -581,7 +578,7 @@ static GimpItemFactoryEntry image_entries[] =
|
|||
{ { N_("/Filters/Web"), NULL, NULL, 0, "<Branch>" },
|
||||
NULL, NULL },
|
||||
|
||||
{ { "/Filters/---", NULL, NULL, 0, "<Separator>" },
|
||||
{ { "/Filters/---INSERT", NULL, NULL, 0, "<Separator>" },
|
||||
NULL, NULL },
|
||||
{ { N_("/Filters/Animation"), NULL, NULL, 0, "<Branch>" },
|
||||
NULL, NULL },
|
||||
|
@ -1037,10 +1034,14 @@ menus_reorder_plugins (void)
|
|||
static gint n_reorder_submenus = (sizeof (reorder_submenus) /
|
||||
sizeof (reorder_submenus[0]));
|
||||
|
||||
static gchar *reorder_sub_submenus[] = { "<Image>/Filters",
|
||||
"<Toolbox>/Xtns" };
|
||||
static gint n_reorder_sub_submenus = (sizeof (reorder_sub_submenus) /
|
||||
sizeof (reorder_sub_submenus[0]));
|
||||
static gchar *reorder_subsubmenus[] = { "<Image>/Filters",
|
||||
"<Toolbox>/Xtns" };
|
||||
static gint n_reorder_subsubmenus = (sizeof (reorder_subsubmenus) /
|
||||
sizeof (reorder_subsubmenus[0]));
|
||||
|
||||
static gchar *reorder_if_exists[] = { "/Filters/Misc" };
|
||||
static gint n_reorder_if_exists = (sizeof (reorder_if_exists) /
|
||||
sizeof (reorder_if_exists[0]));
|
||||
|
||||
GtkItemFactory *item_factory;
|
||||
GtkWidget *menu_item;
|
||||
|
@ -1123,11 +1124,11 @@ menus_reorder_plugins (void)
|
|||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < n_reorder_sub_submenus; i++)
|
||||
for (i = 0; i < n_reorder_subsubmenus; i++)
|
||||
{
|
||||
item_factory = gtk_item_factory_from_path (reorder_sub_submenus[i]);
|
||||
item_factory = gtk_item_factory_from_path (reorder_subsubmenus[i]);
|
||||
menu = gtk_item_factory_get_widget (item_factory,
|
||||
reorder_sub_submenus[i]);
|
||||
reorder_subsubmenus[i]);
|
||||
|
||||
if (menu && GTK_IS_MENU (menu))
|
||||
{
|
||||
|
@ -1143,6 +1144,41 @@ menus_reorder_plugins (void)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Reorder submenus of <Image>/Filters which only exist sometimes */
|
||||
menu_item = gtk_item_factory_get_widget (image_factory,
|
||||
"/Filters/---INSERT");
|
||||
|
||||
if (menu_item && menu_item->parent && GTK_IS_MENU (menu_item->parent))
|
||||
{
|
||||
menu = menu_item->parent;
|
||||
pos = g_list_index (GTK_MENU_SHELL (menu)->children, menu_item);
|
||||
|
||||
for (i = 0; i < n_reorder_if_exists; i++)
|
||||
{
|
||||
GList *list;
|
||||
|
||||
menu_item = gtk_item_factory_get_widget (image_factory,
|
||||
reorder_if_exists[i]);
|
||||
|
||||
if (menu_item && GTK_IS_MENU (menu_item))
|
||||
{
|
||||
for (list = GTK_MENU_SHELL (menu)->children; list;
|
||||
list = g_list_next (list))
|
||||
{
|
||||
if (GTK_MENU_ITEM (list->data)->submenu == menu_item)
|
||||
break;
|
||||
}
|
||||
|
||||
if (list)
|
||||
{
|
||||
gtk_menu_reorder_child (GTK_MENU (menu),
|
||||
GTK_WIDGET (list->data), pos);
|
||||
pos++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1285,12 +1321,13 @@ menus_last_opened_update_labels (void)
|
|||
g_string_sprintf (path, "/File/MRU%02d", i);
|
||||
|
||||
widget = gtk_item_factory_get_widget (toolbox_factory, path->str);
|
||||
if (widget != NULL) {
|
||||
gtk_widget_show (widget);
|
||||
if (widget)
|
||||
{
|
||||
gtk_widget_show (widget);
|
||||
|
||||
gtk_label_set (GTK_LABEL (GTK_BIN (widget)->child),
|
||||
entry_filename->str);
|
||||
}
|
||||
gtk_label_set (GTK_LABEL (GTK_BIN (widget)->child),
|
||||
entry_filename->str);
|
||||
}
|
||||
filename_slist = filename_slist->next;
|
||||
}
|
||||
|
||||
|
@ -1303,7 +1340,7 @@ menus_last_opened_add (gchar *filename)
|
|||
{
|
||||
GString *raw_filename;
|
||||
GSList *list;
|
||||
GtkWidget *widget;
|
||||
GtkWidget *menu_item;
|
||||
guint num_entries;
|
||||
|
||||
/* ignore the add if we've already got the filename on the list */
|
||||
|
@ -1329,9 +1366,8 @@ menus_last_opened_add (gchar *filename)
|
|||
|
||||
if (num_entries == 0)
|
||||
{
|
||||
widget = gtk_item_factory_get_widget (toolbox_factory,
|
||||
file_menu_separator.entry.path);
|
||||
gtk_widget_show (widget);
|
||||
menu_item = gtk_item_factory_get_widget (toolbox_factory, "/File/---MRU");
|
||||
gtk_widget_show (menu_item);
|
||||
}
|
||||
|
||||
menus_last_opened_update_labels ();
|
||||
|
@ -1340,10 +1376,11 @@ menus_last_opened_add (gchar *filename)
|
|||
static void
|
||||
menus_init_mru (void)
|
||||
{
|
||||
gchar *paths, *accelerators;
|
||||
gint i;
|
||||
GimpItemFactoryEntry *last_opened_entries;
|
||||
GtkWidget *widget;
|
||||
GimpItemFactoryEntry *last_opened_entries;
|
||||
GtkWidget *menu_item;
|
||||
gchar *paths;
|
||||
gchar *accelerators;
|
||||
gint i;
|
||||
|
||||
last_opened_entries = g_new (GimpItemFactoryEntry, last_opened_size);
|
||||
|
||||
|
@ -1379,14 +1416,20 @@ menus_init_mru (void)
|
|||
|
||||
for (i=0; i < last_opened_size; i++)
|
||||
{
|
||||
widget = gtk_item_factory_get_widget (toolbox_factory,
|
||||
last_opened_entries[i].entry.path);
|
||||
gtk_widget_hide (widget);
|
||||
menu_item =
|
||||
gtk_item_factory_get_widget (toolbox_factory,
|
||||
last_opened_entries[i].entry.path);
|
||||
gtk_widget_hide (menu_item);
|
||||
}
|
||||
|
||||
widget = gtk_item_factory_get_widget (toolbox_factory,
|
||||
file_menu_separator.entry.path);
|
||||
gtk_widget_hide (widget);
|
||||
menu_item = gtk_item_factory_get_widget (toolbox_factory, "/File/---MRU");
|
||||
if (menu_item && menu_item->parent)
|
||||
gtk_menu_reorder_child (GTK_MENU (menu_item->parent), menu_item, -1);
|
||||
gtk_widget_hide (menu_item);
|
||||
|
||||
menu_item = gtk_item_factory_get_widget (toolbox_factory, "/File/Quit");
|
||||
if (menu_item && menu_item->parent)
|
||||
gtk_menu_reorder_child (GTK_MENU (menu_item->parent), menu_item, -1);
|
||||
|
||||
g_free (paths);
|
||||
g_free (accelerators);
|
||||
|
@ -1466,23 +1509,23 @@ menus_create_item (GtkItemFactory *item_factory,
|
|||
gpointer callback_data,
|
||||
guint callback_type)
|
||||
{
|
||||
GtkWidget *item;
|
||||
GtkWidget *menu_item;
|
||||
|
||||
gtk_item_factory_create_item (item_factory,
|
||||
(GtkItemFactoryEntry *) entry,
|
||||
callback_data,
|
||||
callback_type);
|
||||
|
||||
item = gtk_item_factory_get_item (item_factory,
|
||||
((GtkItemFactoryEntry *) entry)->path);
|
||||
menu_item = gtk_item_factory_get_item (item_factory,
|
||||
((GtkItemFactoryEntry *) entry)->path);
|
||||
|
||||
if (item)
|
||||
if (menu_item)
|
||||
{
|
||||
gtk_signal_connect_after (GTK_OBJECT (item), "realize",
|
||||
gtk_signal_connect_after (GTK_OBJECT (menu_item), "realize",
|
||||
GTK_SIGNAL_FUNC (menus_item_realize),
|
||||
(gpointer) item_factory);
|
||||
|
||||
gtk_object_set_data (GTK_OBJECT (item), "help_page",
|
||||
gtk_object_set_data (GTK_OBJECT (menu_item), "help_page",
|
||||
(gpointer) entry->help_page);
|
||||
}
|
||||
}
|
||||
|
@ -1530,157 +1573,149 @@ menus_create_items (GtkItemFactory *item_factory,
|
|||
}
|
||||
|
||||
static void
|
||||
menus_init_toolbox (void)
|
||||
menus_init (void)
|
||||
{
|
||||
toolbox_factory = gtk_item_factory_new (GTK_TYPE_MENU_BAR, "<Toolbox>", NULL);
|
||||
GtkWidget *menu_item;
|
||||
gchar *filename;
|
||||
gint i;
|
||||
|
||||
if (! initialize)
|
||||
return;
|
||||
|
||||
initialize = FALSE;
|
||||
|
||||
toolbox_factory = gtk_item_factory_new (GTK_TYPE_MENU_BAR, "<Toolbox>",
|
||||
NULL);
|
||||
gtk_object_set_data (GTK_OBJECT (toolbox_factory), "help_path",
|
||||
(gpointer) "toolbox");
|
||||
gtk_item_factory_set_translate_func (toolbox_factory, menu_translate,
|
||||
"<Toolbox>", NULL);
|
||||
menus_create_items (toolbox_factory, n_toolbox_entries,
|
||||
toolbox_entries, NULL, 2);
|
||||
"<Toolbox>", NULL);
|
||||
menus_create_items (toolbox_factory,
|
||||
n_toolbox_entries,
|
||||
toolbox_entries,
|
||||
NULL, 2);
|
||||
|
||||
menus_init_mru ();
|
||||
|
||||
menus_create_items (toolbox_factory, 1,
|
||||
&file_menu_separator, NULL, 2);
|
||||
image_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<Image>", NULL);
|
||||
gtk_object_set_data (GTK_OBJECT (image_factory), "help_path",
|
||||
(gpointer) "image");
|
||||
gtk_item_factory_set_translate_func (image_factory, menu_translate,
|
||||
"<Image>", NULL);
|
||||
menus_create_items (image_factory,
|
||||
n_image_entries,
|
||||
image_entries,
|
||||
NULL, 2);
|
||||
|
||||
menus_create_items (toolbox_factory, 1,
|
||||
&toolbox_end, NULL, 2);
|
||||
}
|
||||
load_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<Load>", NULL);
|
||||
gtk_object_set_data (GTK_OBJECT (load_factory), "help_path",
|
||||
(gpointer) "open");
|
||||
gtk_item_factory_set_translate_func (load_factory, menu_translate,
|
||||
"<Load>", NULL);
|
||||
menus_create_items (load_factory,
|
||||
n_load_entries,
|
||||
load_entries,
|
||||
NULL, 2);
|
||||
|
||||
static void
|
||||
menus_init (void)
|
||||
{
|
||||
gint i;
|
||||
save_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<Save>", NULL);
|
||||
gtk_object_set_data (GTK_OBJECT (save_factory), "help_path",
|
||||
(gpointer) "save");
|
||||
gtk_item_factory_set_translate_func (save_factory, menu_translate,
|
||||
"<Save>", NULL);
|
||||
menus_create_items (save_factory,
|
||||
n_save_entries,
|
||||
save_entries,
|
||||
NULL, 2);
|
||||
|
||||
if (initialize)
|
||||
layers_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<Layers>", NULL);
|
||||
gtk_object_set_data (GTK_OBJECT (layers_factory), "help_path",
|
||||
(gpointer) "layers");
|
||||
gtk_item_factory_set_translate_func (layers_factory, menu_translate,
|
||||
"<Layers>", NULL);
|
||||
menus_create_items (layers_factory,
|
||||
n_layers_entries,
|
||||
layers_entries,
|
||||
NULL, 2);
|
||||
|
||||
channels_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<Channels>", NULL);
|
||||
gtk_object_set_data (GTK_OBJECT (channels_factory), "help_path",
|
||||
(gpointer) "channels");
|
||||
gtk_item_factory_set_translate_func (channels_factory, menu_translate,
|
||||
"<Channels>", NULL);
|
||||
menus_create_items (channels_factory,
|
||||
n_channels_entries,
|
||||
channels_entries,
|
||||
NULL, 2);
|
||||
|
||||
paths_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<Paths>", NULL);
|
||||
gtk_object_set_data (GTK_OBJECT (paths_factory), "help_path",
|
||||
(gpointer) "paths");
|
||||
gtk_item_factory_set_translate_func (paths_factory, menu_translate,
|
||||
"<Paths>", NULL);
|
||||
menus_create_items (paths_factory,
|
||||
n_paths_entries,
|
||||
paths_entries,
|
||||
NULL, 2);
|
||||
|
||||
for (i = 0; i < num_tools; i++)
|
||||
{
|
||||
GtkWidget *menu_item;
|
||||
gchar *filename;
|
||||
/* FIXME this need to use access functions to check a flag */
|
||||
if (tool_info[i].menu_path)
|
||||
menus_tools_create (&tool_info[i]);
|
||||
}
|
||||
|
||||
initialize = FALSE;
|
||||
/* reorder <Image>/Image/Colors */
|
||||
menu_item = gtk_item_factory_get_widget (image_factory,
|
||||
tool_info[POSTERIZE].menu_path);
|
||||
if (menu_item && menu_item->parent)
|
||||
gtk_menu_reorder_child (GTK_MENU (menu_item->parent), menu_item, 3);
|
||||
|
||||
menus_init_toolbox ();
|
||||
{
|
||||
static ToolType color_tools[] = { COLOR_BALANCE,
|
||||
HUE_SATURATION,
|
||||
BRIGHTNESS_CONTRAST,
|
||||
THRESHOLD,
|
||||
LEVELS,
|
||||
CURVES };
|
||||
static gint n_color_tools = (sizeof (color_tools) /
|
||||
sizeof (color_tools[0]));
|
||||
gint i, pos;
|
||||
|
||||
image_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<Image>", NULL);
|
||||
gtk_object_set_data (GTK_OBJECT (image_factory), "help_path",
|
||||
(gpointer) "image");
|
||||
gtk_item_factory_set_translate_func (image_factory,
|
||||
menu_translate,
|
||||
"<Image>", NULL);
|
||||
menus_create_items (image_factory,
|
||||
n_image_entries,
|
||||
image_entries,
|
||||
NULL, 2);
|
||||
|
||||
load_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<Load>", NULL);
|
||||
gtk_object_set_data (GTK_OBJECT (load_factory), "help_path",
|
||||
(gpointer) "open");
|
||||
gtk_item_factory_set_translate_func (load_factory,
|
||||
menu_translate,
|
||||
NULL, NULL);
|
||||
menus_create_items (load_factory,
|
||||
n_load_entries,
|
||||
load_entries,
|
||||
NULL, 2);
|
||||
|
||||
save_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<Save>", NULL);
|
||||
gtk_object_set_data (GTK_OBJECT (save_factory), "help_path",
|
||||
(gpointer) "save");
|
||||
gtk_item_factory_set_translate_func (save_factory,
|
||||
menu_translate,
|
||||
NULL, NULL);
|
||||
menus_create_items (save_factory,
|
||||
n_save_entries,
|
||||
save_entries,
|
||||
NULL, 2);
|
||||
|
||||
layers_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<Layers>", NULL);
|
||||
gtk_object_set_data (GTK_OBJECT (layers_factory), "help_path",
|
||||
(gpointer) "layers");
|
||||
gtk_item_factory_set_translate_func (layers_factory,
|
||||
menu_translate,
|
||||
NULL, NULL);
|
||||
menus_create_items (layers_factory,
|
||||
n_layers_entries,
|
||||
layers_entries,
|
||||
NULL, 2);
|
||||
|
||||
channels_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<Channels>", NULL);
|
||||
gtk_object_set_data (GTK_OBJECT (channels_factory), "help_path",
|
||||
(gpointer) "channels");
|
||||
gtk_item_factory_set_translate_func (channels_factory,
|
||||
menu_translate,
|
||||
NULL, NULL);
|
||||
menus_create_items (channels_factory,
|
||||
n_channels_entries,
|
||||
channels_entries,
|
||||
NULL, 2);
|
||||
|
||||
paths_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<Paths>", NULL);
|
||||
gtk_object_set_data (GTK_OBJECT (paths_factory), "help_path",
|
||||
(gpointer) "paths");
|
||||
gtk_item_factory_set_translate_func (paths_factory,
|
||||
menu_translate,
|
||||
NULL, NULL);
|
||||
menus_create_items (paths_factory,
|
||||
n_paths_entries,
|
||||
paths_entries,
|
||||
NULL, 2);
|
||||
|
||||
for (i = 0; i < num_tools; i++)
|
||||
{
|
||||
/* FIXME this need to use access functions to check a flag */
|
||||
if (tool_info[i].menu_path)
|
||||
menus_tools_create (&tool_info[i]);
|
||||
}
|
||||
|
||||
menu_item = gtk_item_factory_get_widget (image_factory,
|
||||
tool_info[POSTERIZE].menu_path);
|
||||
if (menu_item && menu_item->parent)
|
||||
gtk_menu_reorder_child (GTK_MENU (menu_item->parent), menu_item, 3);
|
||||
pos = 1;
|
||||
|
||||
for (i = 0; i < n_color_tools; i++)
|
||||
{
|
||||
static ToolType color_tools[] = { COLOR_BALANCE,
|
||||
HUE_SATURATION,
|
||||
BRIGHTNESS_CONTRAST,
|
||||
THRESHOLD,
|
||||
LEVELS,
|
||||
CURVES };
|
||||
static gint n_color_tools = (sizeof (color_tools) /
|
||||
sizeof (color_tools[0]));
|
||||
gint i, pos;
|
||||
|
||||
pos = 1;
|
||||
|
||||
for (i = 0; i < n_color_tools; i++)
|
||||
menu_item =
|
||||
gtk_item_factory_get_widget (image_factory,
|
||||
tool_info[color_tools[i]].menu_path);
|
||||
if (menu_item && menu_item->parent)
|
||||
{
|
||||
menu_item =
|
||||
gtk_item_factory_get_widget (image_factory,
|
||||
tool_info[color_tools[i]].menu_path);
|
||||
if (menu_item && menu_item->parent)
|
||||
{
|
||||
gtk_menu_reorder_child (GTK_MENU (menu_item->parent),
|
||||
menu_item, pos);
|
||||
pos++;
|
||||
}
|
||||
gtk_menu_reorder_child (GTK_MENU (menu_item->parent),
|
||||
menu_item, pos);
|
||||
pos++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
filename = gimp_personal_rc_file ("menurc");
|
||||
gtk_item_factory_parse_rc (filename);
|
||||
g_free (filename);
|
||||
}
|
||||
filename = gimp_personal_rc_file ("menurc");
|
||||
gtk_item_factory_parse_rc (filename);
|
||||
g_free (filename);
|
||||
}
|
||||
|
||||
static gchar *
|
||||
menu_translate (const gchar *path,
|
||||
gpointer data)
|
||||
{
|
||||
static gchar *plugin_domains[] = { "gimp-std-plugins",
|
||||
"gimp-perl" };
|
||||
static gint n_plugin_domains = (sizeof (plugin_domains) /
|
||||
sizeof (plugin_domains[0]));
|
||||
|
||||
static gchar *menupath = NULL;
|
||||
|
||||
gchar *retval;
|
||||
gchar *factory;
|
||||
gint i;
|
||||
|
||||
factory = (gchar *) data;
|
||||
|
||||
|
@ -1696,18 +1731,14 @@ menu_translate (const gchar *path,
|
|||
|
||||
retval = gettext (menupath);
|
||||
|
||||
if (!strcmp (path, retval) && factory)
|
||||
i = 0;
|
||||
while (i < n_plugin_domains && !strcmp (path, retval) && factory)
|
||||
{
|
||||
g_free (menupath);
|
||||
|
||||
menupath = g_strconcat (factory, path, NULL);
|
||||
|
||||
retval = dgettext ("gimp-std-plugins", menupath) + strlen (factory);
|
||||
|
||||
if (!strcmp (path, retval))
|
||||
{
|
||||
retval = dgettext ("gimp-perl", menupath) + strlen (factory);
|
||||
}
|
||||
retval = dgettext (plugin_domains[i++], menupath) + strlen (factory);
|
||||
}
|
||||
|
||||
return retval;
|
||||
|
@ -1739,7 +1770,7 @@ tearoff_cmd_callback (GtkWidget *widget,
|
|||
/* This should be a window */
|
||||
if (!GTK_IS_WINDOW (top))
|
||||
{
|
||||
g_message("tearoff menu not in top level window");
|
||||
g_message ("tearoff menu not in top level window");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1748,7 +1779,7 @@ tearoff_cmd_callback (GtkWidget *widget,
|
|||
"delete_event",
|
||||
GTK_SIGNAL_FUNC (tearoff_delete_cb),
|
||||
GTK_OBJECT (top));
|
||||
|
||||
|
||||
gtk_object_set_data (GTK_OBJECT (widget), "tearoff_menu_top",
|
||||
top);
|
||||
}
|
||||
|
|
|
@ -31,7 +31,8 @@ static const gchar * gimp_unit_menu_build_string (gchar *format,
|
|||
static void gimp_unit_menu_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
|
||||
enum {
|
||||
enum
|
||||
{
|
||||
UNIT_CHANGED,
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
@ -85,16 +86,16 @@ gimp_unit_menu_class_init (GimpUnitMenuClass *class)
|
|||
static void
|
||||
gimp_unit_menu_init (GimpUnitMenu *gum)
|
||||
{
|
||||
gum->selection = NULL;
|
||||
gum->clist = NULL;
|
||||
gum->format = NULL;
|
||||
gum->unit = UNIT_PIXEL;
|
||||
gum->show_pixels = FALSE;
|
||||
gum->selection = NULL;
|
||||
gum->clist = NULL;
|
||||
gum->format = NULL;
|
||||
gum->unit = UNIT_PIXEL;
|
||||
gum->show_pixels = FALSE;
|
||||
gum->show_percent = FALSE;
|
||||
}
|
||||
|
||||
GtkType
|
||||
gimp_unit_menu_get_type ()
|
||||
gimp_unit_menu_get_type (void)
|
||||
{
|
||||
static GtkType gum_type = 0;
|
||||
|
||||
|
@ -118,7 +119,7 @@ gimp_unit_menu_get_type ()
|
|||
return gum_type;
|
||||
}
|
||||
|
||||
GtkWidget*
|
||||
GtkWidget *
|
||||
gimp_unit_menu_new (gchar *format,
|
||||
GUnit unit,
|
||||
gboolean show_pixels,
|
||||
|
@ -140,11 +141,11 @@ gimp_unit_menu_new (gchar *format,
|
|||
|
||||
gum = gtk_type_new (gimp_unit_menu_get_type ());
|
||||
|
||||
gum->format = g_strdup (format);
|
||||
gum->show_pixels = show_pixels;
|
||||
gum->format = g_strdup (format);
|
||||
gum->show_pixels = show_pixels;
|
||||
gum->show_percent = show_percent;
|
||||
|
||||
menu = gtk_menu_new();
|
||||
menu = gtk_menu_new ();
|
||||
for (u = show_pixels ? UNIT_PIXEL : UNIT_INCH;
|
||||
u < gimp_unit_get_number_of_built_in_units();
|
||||
u++)
|
||||
|
@ -155,15 +156,17 @@ gimp_unit_menu_new (gchar *format,
|
|||
if (show_percent)
|
||||
{
|
||||
menuitem =
|
||||
gtk_menu_item_new_with_label (gimp_unit_menu_build_string (format, UNIT_PERCENT));
|
||||
gtk_menu_item_new_with_label
|
||||
(gimp_unit_menu_build_string (format, UNIT_PERCENT));
|
||||
gtk_menu_append (GTK_MENU (menu), menuitem);
|
||||
gtk_signal_connect (GTK_OBJECT (menuitem), "activate",
|
||||
(GtkSignalFunc) gimp_unit_menu_callback, gum);
|
||||
gtk_object_set_data (GTK_OBJECT (menuitem),
|
||||
"gimp_unit_menu", (gpointer) UNIT_PERCENT);
|
||||
GTK_SIGNAL_FUNC (gimp_unit_menu_callback),
|
||||
gum);
|
||||
gtk_object_set_data (GTK_OBJECT (menuitem), "gimp_unit_menu",
|
||||
(gpointer) UNIT_PERCENT);
|
||||
gtk_widget_show (menuitem);
|
||||
}
|
||||
|
||||
|
||||
if (show_pixels || show_percent)
|
||||
{
|
||||
menuitem = gtk_menu_item_new ();
|
||||
|
@ -176,8 +179,10 @@ gimp_unit_menu_new (gchar *format,
|
|||
gtk_menu_item_new_with_label (gimp_unit_menu_build_string (format, u));
|
||||
gtk_menu_append (GTK_MENU (menu), menuitem);
|
||||
gtk_signal_connect (GTK_OBJECT (menuitem), "activate",
|
||||
(GtkSignalFunc) gimp_unit_menu_callback, gum);
|
||||
gtk_object_set_data (GTK_OBJECT (menuitem), "gimp_unit_menu", (gpointer)u);
|
||||
GTK_SIGNAL_FUNC (gimp_unit_menu_callback),
|
||||
gum);
|
||||
gtk_object_set_data (GTK_OBJECT (menuitem), "gimp_unit_menu",
|
||||
(gpointer) u);
|
||||
gtk_widget_show (menuitem);
|
||||
}
|
||||
|
||||
|
@ -192,8 +197,10 @@ gimp_unit_menu_new (gchar *format,
|
|||
gtk_menu_item_new_with_label (gimp_unit_menu_build_string (format, unit));
|
||||
gtk_menu_append (GTK_MENU (menu), menuitem);
|
||||
gtk_signal_connect (GTK_OBJECT (menuitem), "activate",
|
||||
(GtkSignalFunc) gimp_unit_menu_callback, gum);
|
||||
gtk_object_set_data (GTK_OBJECT (menuitem), "gimp_unit_menu", (gpointer)unit);
|
||||
GTK_SIGNAL_FUNC (gimp_unit_menu_callback),
|
||||
gum);
|
||||
gtk_object_set_data (GTK_OBJECT (menuitem), "gimp_unit_menu",
|
||||
(gpointer) unit);
|
||||
gtk_widget_show(menuitem);
|
||||
}
|
||||
|
||||
|
@ -207,7 +214,8 @@ gimp_unit_menu_new (gchar *format,
|
|||
gtk_menu_item_new_with_label (_("More..."));
|
||||
gtk_menu_append (GTK_MENU (menu), menuitem);
|
||||
gtk_signal_connect (GTK_OBJECT (menuitem), "activate",
|
||||
(GtkSignalFunc) gimp_unit_menu_callback, gum);
|
||||
GTK_SIGNAL_FUNC (gimp_unit_menu_callback),
|
||||
gum);
|
||||
gtk_object_set_data (GTK_OBJECT (menuitem), "gimp_unit_menu",
|
||||
(gpointer) (UNIT_PERCENT + 1));
|
||||
gtk_widget_show(menuitem);
|
||||
|
@ -264,11 +272,14 @@ gimp_unit_menu_set_unit (GimpUnitMenu *gum,
|
|||
gtk_widget_show(menuitem);
|
||||
|
||||
menuitem =
|
||||
gtk_menu_item_new_with_label (gimp_unit_menu_build_string (gum->format, unit));
|
||||
gtk_menu_item_new_with_label (gimp_unit_menu_build_string (gum->format,
|
||||
unit));
|
||||
gtk_menu_append (GTK_MENU (GTK_OPTION_MENU (gum)->menu), menuitem);
|
||||
gtk_signal_connect (GTK_OBJECT (menuitem), "activate",
|
||||
(GtkSignalFunc) gimp_unit_menu_callback, gum);
|
||||
gtk_object_set_data (GTK_OBJECT (menuitem), "gimp_unit_menu", (gpointer)unit);
|
||||
GTK_SIGNAL_FUNC (gimp_unit_menu_callback),
|
||||
gum);
|
||||
gtk_object_set_data (GTK_OBJECT (menuitem), "gimp_unit_menu",
|
||||
(gpointer) unit);
|
||||
gtk_menu_reorder_child (GTK_MENU (GTK_OPTION_MENU (gum)->menu),
|
||||
menuitem, user_unit);
|
||||
gtk_widget_show(menuitem);
|
||||
|
@ -296,11 +307,15 @@ gimp_unit_menu_get_unit (GimpUnitMenu *gum)
|
|||
}
|
||||
|
||||
/* most of the next two functions is stolen from app/gdisplay.c */
|
||||
static int
|
||||
print (char *buf, int len, int start, const char *fmt, ...)
|
||||
static gint
|
||||
print (gchar *buf,
|
||||
gint len,
|
||||
gint start,
|
||||
const gchar *fmt,
|
||||
...)
|
||||
{
|
||||
va_list args;
|
||||
int printed;
|
||||
gint printed;
|
||||
|
||||
va_start (args, fmt);
|
||||
|
||||
|
@ -313,13 +328,14 @@ print (char *buf, int len, int start, const char *fmt, ...)
|
|||
return printed;
|
||||
}
|
||||
|
||||
static const gchar*
|
||||
gimp_unit_menu_build_string (gchar *format, GUnit unit)
|
||||
static const gchar *
|
||||
gimp_unit_menu_build_string (gchar *format,
|
||||
GUnit unit)
|
||||
{
|
||||
#define BUFFER_LEN 64
|
||||
|
||||
static gchar buffer[BUFFER_LEN];
|
||||
int i = 0;
|
||||
gint i = 0;
|
||||
|
||||
while (i < (BUFFER_LEN - 1) && *format)
|
||||
{
|
||||
|
@ -375,15 +391,27 @@ gimp_unit_menu_build_string (gchar *format, GUnit unit)
|
|||
|
||||
format++;
|
||||
}
|
||||
|
||||
|
||||
buffer[MIN(i, BUFFER_LEN - 1)] = 0;
|
||||
|
||||
|
||||
return buffer;
|
||||
|
||||
#undef BUFFER_LEN
|
||||
}
|
||||
|
||||
/* private callbacks of gimp_unit_menu_create_selection () */
|
||||
static void
|
||||
gimp_unit_menu_selection_close_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GimpUnitMenu *gum;
|
||||
|
||||
gum = GIMP_UNIT_MENU (data);
|
||||
|
||||
if (gum->selection)
|
||||
gtk_widget_destroy (gum->selection);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_unit_menu_selection_select_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
|
@ -401,25 +429,7 @@ gimp_unit_menu_selection_select_callback (GtkWidget *widget,
|
|||
gtk_signal_emit (GTK_OBJECT (gum),
|
||||
gimp_unit_menu_signals[UNIT_CHANGED]);
|
||||
|
||||
gtk_widget_destroy (gum->selection);
|
||||
gum->selection = NULL;
|
||||
gum->clist = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_unit_menu_selection_close_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GimpUnitMenu *gum;
|
||||
|
||||
gum = GIMP_UNIT_MENU (data);
|
||||
|
||||
if (gum->selection)
|
||||
{
|
||||
gtk_widget_destroy (gum->selection);
|
||||
gum->selection = NULL;
|
||||
gum->clist = NULL;
|
||||
gimp_unit_menu_selection_close_callback (NULL, gum);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -437,11 +447,11 @@ gimp_unit_menu_selection_delete_callback (GtkWidget *widget,
|
|||
static void
|
||||
gimp_unit_menu_create_selection (GimpUnitMenu *gum)
|
||||
{
|
||||
GtkWidget *hbox;
|
||||
GtkWidget *hbbox;
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *scrolled_win;
|
||||
GtkWidget *button;
|
||||
gchar *titles[2];
|
||||
gchar *row[2];
|
||||
GUnit unit;
|
||||
gint num_units;
|
||||
|
@ -453,9 +463,9 @@ gimp_unit_menu_create_selection (GimpUnitMenu *gum)
|
|||
gtk_window_set_policy (GTK_WINDOW (gum->selection), FALSE, TRUE, FALSE);
|
||||
gtk_window_position (GTK_WINDOW (gum->selection), GTK_WIN_POS_MOUSE);
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 2);
|
||||
vbox = gtk_vbox_new (FALSE, 0);
|
||||
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (gum->selection)->vbox), vbox);
|
||||
gtk_container_border_width (GTK_CONTAINER (vbox), 2);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 2);
|
||||
gtk_widget_show (vbox);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (gum->selection), "delete_event",
|
||||
|
@ -470,30 +480,28 @@ gimp_unit_menu_create_selection (GimpUnitMenu *gum)
|
|||
|
||||
/* build the selection list */
|
||||
scrolled_win = gtk_scrolled_window_new (NULL, NULL);
|
||||
gum->clist = gtk_clist_new (2);
|
||||
gtk_clist_set_shadow_type (GTK_CLIST (gum->clist), GTK_SHADOW_IN);
|
||||
gtk_clist_set_selection_mode (GTK_CLIST (gum->clist), GTK_SELECTION_BROWSE);
|
||||
gtk_widget_set_usize (gum->clist, 200, 150);
|
||||
|
||||
gtk_clist_set_column_title (GTK_CLIST (gum->clist), 0, _("Unit "));
|
||||
gtk_clist_set_column_auto_resize (GTK_CLIST (gum->clist), 0, TRUE);
|
||||
gtk_clist_set_column_title (GTK_CLIST (gum->clist), 1, _("Factor"));
|
||||
gtk_clist_set_column_auto_resize (GTK_CLIST (gum->clist), 1, TRUE);
|
||||
gtk_clist_column_titles_show (GTK_CLIST (gum->clist));
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 8);
|
||||
gtk_container_border_width (GTK_CONTAINER (hbox), 0);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 0);
|
||||
gtk_widget_show (hbox);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (hbox), scrolled_win, TRUE, TRUE, 0);
|
||||
gtk_container_add (GTK_CONTAINER (scrolled_win), gum->clist);
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_win),
|
||||
GTK_POLICY_AUTOMATIC,
|
||||
GTK_POLICY_ALWAYS);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (vbox), scrolled_win, TRUE, TRUE, 0);
|
||||
gtk_widget_show(scrolled_win);
|
||||
gtk_widget_show(gum->clist);
|
||||
|
||||
titles[0] = _("Unit");
|
||||
titles[1] = _("Factor");
|
||||
gum->clist = gtk_clist_new_with_titles (2, titles);
|
||||
gtk_clist_set_shadow_type (GTK_CLIST (gum->clist), GTK_SHADOW_IN);
|
||||
gtk_clist_set_selection_mode (GTK_CLIST (gum->clist), GTK_SELECTION_BROWSE);
|
||||
gtk_clist_column_titles_passive (GTK_CLIST (gum->clist));
|
||||
gtk_widget_set_usize (gum->clist, 200, 150);
|
||||
gtk_container_add (GTK_CONTAINER (scrolled_win), gum->clist);
|
||||
gtk_widget_show (gum->clist);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (gum->selection), "destroy",
|
||||
GTK_SIGNAL_FUNC (gtk_widget_destroyed),
|
||||
&gum->selection);
|
||||
gtk_signal_connect (GTK_OBJECT (gum->clist), "destroy",
|
||||
GTK_SIGNAL_FUNC (gtk_widget_destroyed),
|
||||
&gum->clist);
|
||||
|
||||
/* build the action area */
|
||||
gtk_container_set_border_width
|
||||
|
@ -502,14 +510,14 @@ gimp_unit_menu_create_selection (GimpUnitMenu *gum)
|
|||
FALSE);
|
||||
hbbox = gtk_hbutton_box_new ();
|
||||
gtk_button_box_set_spacing (GTK_BUTTON_BOX (hbbox), 4);
|
||||
gtk_box_pack_end(GTK_BOX (GTK_DIALOG (gum->selection)->action_area), hbbox,
|
||||
FALSE, FALSE, 0);
|
||||
gtk_box_pack_end (GTK_BOX (GTK_DIALOG (gum->selection)->action_area), hbbox,
|
||||
FALSE, FALSE, 0);
|
||||
gtk_widget_show (hbbox);
|
||||
|
||||
button = gtk_button_new_with_label (_("Select"));
|
||||
gtk_box_pack_start (GTK_BOX (hbbox), button, FALSE, FALSE, 0);
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
(GtkSignalFunc) gimp_unit_menu_selection_select_callback,
|
||||
GTK_SIGNAL_FUNC (gimp_unit_menu_selection_select_callback),
|
||||
gum);
|
||||
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
|
||||
gtk_widget_show (button);
|
||||
|
@ -517,7 +525,7 @@ gimp_unit_menu_create_selection (GimpUnitMenu *gum)
|
|||
button = gtk_button_new_with_label (_("Close"));
|
||||
gtk_box_pack_start (GTK_BOX (hbbox), button, FALSE, FALSE, 0);
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
(GtkSignalFunc) gimp_unit_menu_selection_close_callback,
|
||||
GTK_SIGNAL_FUNC (gimp_unit_menu_selection_close_callback),
|
||||
gum);
|
||||
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
|
||||
gtk_widget_grab_default (button);
|
||||
|
@ -532,7 +540,8 @@ gimp_unit_menu_create_selection (GimpUnitMenu *gum)
|
|||
|
||||
gtk_clist_append (GTK_CLIST (gum->clist), row);
|
||||
gtk_clist_set_row_data (GTK_CLIST (gum->clist),
|
||||
unit - UNIT_END, (gpointer)unit);
|
||||
unit - UNIT_END,
|
||||
(gpointer) unit);
|
||||
|
||||
g_free (row[0]);
|
||||
g_free (row[1]);
|
||||
|
@ -542,7 +551,7 @@ gimp_unit_menu_create_selection (GimpUnitMenu *gum)
|
|||
gtk_widget_show(vbox);
|
||||
gtk_widget_show(gum->selection);
|
||||
|
||||
if(gum->unit >= UNIT_END)
|
||||
if (gum->unit >= UNIT_END)
|
||||
{
|
||||
gtk_clist_select_row (GTK_CLIST (gum->clist), gum->unit - UNIT_END, 0);
|
||||
gtk_clist_moveto (GTK_CLIST (gum->clist), gum->unit - UNIT_END,
|
||||
|
|
|
@ -31,7 +31,8 @@ static const gchar * gimp_unit_menu_build_string (gchar *format,
|
|||
static void gimp_unit_menu_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
|
||||
enum {
|
||||
enum
|
||||
{
|
||||
UNIT_CHANGED,
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
@ -85,16 +86,16 @@ gimp_unit_menu_class_init (GimpUnitMenuClass *class)
|
|||
static void
|
||||
gimp_unit_menu_init (GimpUnitMenu *gum)
|
||||
{
|
||||
gum->selection = NULL;
|
||||
gum->clist = NULL;
|
||||
gum->format = NULL;
|
||||
gum->unit = UNIT_PIXEL;
|
||||
gum->show_pixels = FALSE;
|
||||
gum->selection = NULL;
|
||||
gum->clist = NULL;
|
||||
gum->format = NULL;
|
||||
gum->unit = UNIT_PIXEL;
|
||||
gum->show_pixels = FALSE;
|
||||
gum->show_percent = FALSE;
|
||||
}
|
||||
|
||||
GtkType
|
||||
gimp_unit_menu_get_type ()
|
||||
gimp_unit_menu_get_type (void)
|
||||
{
|
||||
static GtkType gum_type = 0;
|
||||
|
||||
|
@ -118,7 +119,7 @@ gimp_unit_menu_get_type ()
|
|||
return gum_type;
|
||||
}
|
||||
|
||||
GtkWidget*
|
||||
GtkWidget *
|
||||
gimp_unit_menu_new (gchar *format,
|
||||
GUnit unit,
|
||||
gboolean show_pixels,
|
||||
|
@ -140,11 +141,11 @@ gimp_unit_menu_new (gchar *format,
|
|||
|
||||
gum = gtk_type_new (gimp_unit_menu_get_type ());
|
||||
|
||||
gum->format = g_strdup (format);
|
||||
gum->show_pixels = show_pixels;
|
||||
gum->format = g_strdup (format);
|
||||
gum->show_pixels = show_pixels;
|
||||
gum->show_percent = show_percent;
|
||||
|
||||
menu = gtk_menu_new();
|
||||
menu = gtk_menu_new ();
|
||||
for (u = show_pixels ? UNIT_PIXEL : UNIT_INCH;
|
||||
u < gimp_unit_get_number_of_built_in_units();
|
||||
u++)
|
||||
|
@ -155,15 +156,17 @@ gimp_unit_menu_new (gchar *format,
|
|||
if (show_percent)
|
||||
{
|
||||
menuitem =
|
||||
gtk_menu_item_new_with_label (gimp_unit_menu_build_string (format, UNIT_PERCENT));
|
||||
gtk_menu_item_new_with_label
|
||||
(gimp_unit_menu_build_string (format, UNIT_PERCENT));
|
||||
gtk_menu_append (GTK_MENU (menu), menuitem);
|
||||
gtk_signal_connect (GTK_OBJECT (menuitem), "activate",
|
||||
(GtkSignalFunc) gimp_unit_menu_callback, gum);
|
||||
gtk_object_set_data (GTK_OBJECT (menuitem),
|
||||
"gimp_unit_menu", (gpointer) UNIT_PERCENT);
|
||||
GTK_SIGNAL_FUNC (gimp_unit_menu_callback),
|
||||
gum);
|
||||
gtk_object_set_data (GTK_OBJECT (menuitem), "gimp_unit_menu",
|
||||
(gpointer) UNIT_PERCENT);
|
||||
gtk_widget_show (menuitem);
|
||||
}
|
||||
|
||||
|
||||
if (show_pixels || show_percent)
|
||||
{
|
||||
menuitem = gtk_menu_item_new ();
|
||||
|
@ -176,8 +179,10 @@ gimp_unit_menu_new (gchar *format,
|
|||
gtk_menu_item_new_with_label (gimp_unit_menu_build_string (format, u));
|
||||
gtk_menu_append (GTK_MENU (menu), menuitem);
|
||||
gtk_signal_connect (GTK_OBJECT (menuitem), "activate",
|
||||
(GtkSignalFunc) gimp_unit_menu_callback, gum);
|
||||
gtk_object_set_data (GTK_OBJECT (menuitem), "gimp_unit_menu", (gpointer)u);
|
||||
GTK_SIGNAL_FUNC (gimp_unit_menu_callback),
|
||||
gum);
|
||||
gtk_object_set_data (GTK_OBJECT (menuitem), "gimp_unit_menu",
|
||||
(gpointer) u);
|
||||
gtk_widget_show (menuitem);
|
||||
}
|
||||
|
||||
|
@ -192,8 +197,10 @@ gimp_unit_menu_new (gchar *format,
|
|||
gtk_menu_item_new_with_label (gimp_unit_menu_build_string (format, unit));
|
||||
gtk_menu_append (GTK_MENU (menu), menuitem);
|
||||
gtk_signal_connect (GTK_OBJECT (menuitem), "activate",
|
||||
(GtkSignalFunc) gimp_unit_menu_callback, gum);
|
||||
gtk_object_set_data (GTK_OBJECT (menuitem), "gimp_unit_menu", (gpointer)unit);
|
||||
GTK_SIGNAL_FUNC (gimp_unit_menu_callback),
|
||||
gum);
|
||||
gtk_object_set_data (GTK_OBJECT (menuitem), "gimp_unit_menu",
|
||||
(gpointer) unit);
|
||||
gtk_widget_show(menuitem);
|
||||
}
|
||||
|
||||
|
@ -207,7 +214,8 @@ gimp_unit_menu_new (gchar *format,
|
|||
gtk_menu_item_new_with_label (_("More..."));
|
||||
gtk_menu_append (GTK_MENU (menu), menuitem);
|
||||
gtk_signal_connect (GTK_OBJECT (menuitem), "activate",
|
||||
(GtkSignalFunc) gimp_unit_menu_callback, gum);
|
||||
GTK_SIGNAL_FUNC (gimp_unit_menu_callback),
|
||||
gum);
|
||||
gtk_object_set_data (GTK_OBJECT (menuitem), "gimp_unit_menu",
|
||||
(gpointer) (UNIT_PERCENT + 1));
|
||||
gtk_widget_show(menuitem);
|
||||
|
@ -264,11 +272,14 @@ gimp_unit_menu_set_unit (GimpUnitMenu *gum,
|
|||
gtk_widget_show(menuitem);
|
||||
|
||||
menuitem =
|
||||
gtk_menu_item_new_with_label (gimp_unit_menu_build_string (gum->format, unit));
|
||||
gtk_menu_item_new_with_label (gimp_unit_menu_build_string (gum->format,
|
||||
unit));
|
||||
gtk_menu_append (GTK_MENU (GTK_OPTION_MENU (gum)->menu), menuitem);
|
||||
gtk_signal_connect (GTK_OBJECT (menuitem), "activate",
|
||||
(GtkSignalFunc) gimp_unit_menu_callback, gum);
|
||||
gtk_object_set_data (GTK_OBJECT (menuitem), "gimp_unit_menu", (gpointer)unit);
|
||||
GTK_SIGNAL_FUNC (gimp_unit_menu_callback),
|
||||
gum);
|
||||
gtk_object_set_data (GTK_OBJECT (menuitem), "gimp_unit_menu",
|
||||
(gpointer) unit);
|
||||
gtk_menu_reorder_child (GTK_MENU (GTK_OPTION_MENU (gum)->menu),
|
||||
menuitem, user_unit);
|
||||
gtk_widget_show(menuitem);
|
||||
|
@ -296,11 +307,15 @@ gimp_unit_menu_get_unit (GimpUnitMenu *gum)
|
|||
}
|
||||
|
||||
/* most of the next two functions is stolen from app/gdisplay.c */
|
||||
static int
|
||||
print (char *buf, int len, int start, const char *fmt, ...)
|
||||
static gint
|
||||
print (gchar *buf,
|
||||
gint len,
|
||||
gint start,
|
||||
const gchar *fmt,
|
||||
...)
|
||||
{
|
||||
va_list args;
|
||||
int printed;
|
||||
gint printed;
|
||||
|
||||
va_start (args, fmt);
|
||||
|
||||
|
@ -313,13 +328,14 @@ print (char *buf, int len, int start, const char *fmt, ...)
|
|||
return printed;
|
||||
}
|
||||
|
||||
static const gchar*
|
||||
gimp_unit_menu_build_string (gchar *format, GUnit unit)
|
||||
static const gchar *
|
||||
gimp_unit_menu_build_string (gchar *format,
|
||||
GUnit unit)
|
||||
{
|
||||
#define BUFFER_LEN 64
|
||||
|
||||
static gchar buffer[BUFFER_LEN];
|
||||
int i = 0;
|
||||
gint i = 0;
|
||||
|
||||
while (i < (BUFFER_LEN - 1) && *format)
|
||||
{
|
||||
|
@ -375,15 +391,27 @@ gimp_unit_menu_build_string (gchar *format, GUnit unit)
|
|||
|
||||
format++;
|
||||
}
|
||||
|
||||
|
||||
buffer[MIN(i, BUFFER_LEN - 1)] = 0;
|
||||
|
||||
|
||||
return buffer;
|
||||
|
||||
#undef BUFFER_LEN
|
||||
}
|
||||
|
||||
/* private callbacks of gimp_unit_menu_create_selection () */
|
||||
static void
|
||||
gimp_unit_menu_selection_close_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GimpUnitMenu *gum;
|
||||
|
||||
gum = GIMP_UNIT_MENU (data);
|
||||
|
||||
if (gum->selection)
|
||||
gtk_widget_destroy (gum->selection);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_unit_menu_selection_select_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
|
@ -401,25 +429,7 @@ gimp_unit_menu_selection_select_callback (GtkWidget *widget,
|
|||
gtk_signal_emit (GTK_OBJECT (gum),
|
||||
gimp_unit_menu_signals[UNIT_CHANGED]);
|
||||
|
||||
gtk_widget_destroy (gum->selection);
|
||||
gum->selection = NULL;
|
||||
gum->clist = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_unit_menu_selection_close_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GimpUnitMenu *gum;
|
||||
|
||||
gum = GIMP_UNIT_MENU (data);
|
||||
|
||||
if (gum->selection)
|
||||
{
|
||||
gtk_widget_destroy (gum->selection);
|
||||
gum->selection = NULL;
|
||||
gum->clist = NULL;
|
||||
gimp_unit_menu_selection_close_callback (NULL, gum);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -437,11 +447,11 @@ gimp_unit_menu_selection_delete_callback (GtkWidget *widget,
|
|||
static void
|
||||
gimp_unit_menu_create_selection (GimpUnitMenu *gum)
|
||||
{
|
||||
GtkWidget *hbox;
|
||||
GtkWidget *hbbox;
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *scrolled_win;
|
||||
GtkWidget *button;
|
||||
gchar *titles[2];
|
||||
gchar *row[2];
|
||||
GUnit unit;
|
||||
gint num_units;
|
||||
|
@ -453,9 +463,9 @@ gimp_unit_menu_create_selection (GimpUnitMenu *gum)
|
|||
gtk_window_set_policy (GTK_WINDOW (gum->selection), FALSE, TRUE, FALSE);
|
||||
gtk_window_position (GTK_WINDOW (gum->selection), GTK_WIN_POS_MOUSE);
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 2);
|
||||
vbox = gtk_vbox_new (FALSE, 0);
|
||||
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (gum->selection)->vbox), vbox);
|
||||
gtk_container_border_width (GTK_CONTAINER (vbox), 2);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 2);
|
||||
gtk_widget_show (vbox);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (gum->selection), "delete_event",
|
||||
|
@ -470,30 +480,28 @@ gimp_unit_menu_create_selection (GimpUnitMenu *gum)
|
|||
|
||||
/* build the selection list */
|
||||
scrolled_win = gtk_scrolled_window_new (NULL, NULL);
|
||||
gum->clist = gtk_clist_new (2);
|
||||
gtk_clist_set_shadow_type (GTK_CLIST (gum->clist), GTK_SHADOW_IN);
|
||||
gtk_clist_set_selection_mode (GTK_CLIST (gum->clist), GTK_SELECTION_BROWSE);
|
||||
gtk_widget_set_usize (gum->clist, 200, 150);
|
||||
|
||||
gtk_clist_set_column_title (GTK_CLIST (gum->clist), 0, _("Unit "));
|
||||
gtk_clist_set_column_auto_resize (GTK_CLIST (gum->clist), 0, TRUE);
|
||||
gtk_clist_set_column_title (GTK_CLIST (gum->clist), 1, _("Factor"));
|
||||
gtk_clist_set_column_auto_resize (GTK_CLIST (gum->clist), 1, TRUE);
|
||||
gtk_clist_column_titles_show (GTK_CLIST (gum->clist));
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 8);
|
||||
gtk_container_border_width (GTK_CONTAINER (hbox), 0);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 0);
|
||||
gtk_widget_show (hbox);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (hbox), scrolled_win, TRUE, TRUE, 0);
|
||||
gtk_container_add (GTK_CONTAINER (scrolled_win), gum->clist);
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_win),
|
||||
GTK_POLICY_AUTOMATIC,
|
||||
GTK_POLICY_ALWAYS);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (vbox), scrolled_win, TRUE, TRUE, 0);
|
||||
gtk_widget_show(scrolled_win);
|
||||
gtk_widget_show(gum->clist);
|
||||
|
||||
titles[0] = _("Unit");
|
||||
titles[1] = _("Factor");
|
||||
gum->clist = gtk_clist_new_with_titles (2, titles);
|
||||
gtk_clist_set_shadow_type (GTK_CLIST (gum->clist), GTK_SHADOW_IN);
|
||||
gtk_clist_set_selection_mode (GTK_CLIST (gum->clist), GTK_SELECTION_BROWSE);
|
||||
gtk_clist_column_titles_passive (GTK_CLIST (gum->clist));
|
||||
gtk_widget_set_usize (gum->clist, 200, 150);
|
||||
gtk_container_add (GTK_CONTAINER (scrolled_win), gum->clist);
|
||||
gtk_widget_show (gum->clist);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (gum->selection), "destroy",
|
||||
GTK_SIGNAL_FUNC (gtk_widget_destroyed),
|
||||
&gum->selection);
|
||||
gtk_signal_connect (GTK_OBJECT (gum->clist), "destroy",
|
||||
GTK_SIGNAL_FUNC (gtk_widget_destroyed),
|
||||
&gum->clist);
|
||||
|
||||
/* build the action area */
|
||||
gtk_container_set_border_width
|
||||
|
@ -502,14 +510,14 @@ gimp_unit_menu_create_selection (GimpUnitMenu *gum)
|
|||
FALSE);
|
||||
hbbox = gtk_hbutton_box_new ();
|
||||
gtk_button_box_set_spacing (GTK_BUTTON_BOX (hbbox), 4);
|
||||
gtk_box_pack_end(GTK_BOX (GTK_DIALOG (gum->selection)->action_area), hbbox,
|
||||
FALSE, FALSE, 0);
|
||||
gtk_box_pack_end (GTK_BOX (GTK_DIALOG (gum->selection)->action_area), hbbox,
|
||||
FALSE, FALSE, 0);
|
||||
gtk_widget_show (hbbox);
|
||||
|
||||
button = gtk_button_new_with_label (_("Select"));
|
||||
gtk_box_pack_start (GTK_BOX (hbbox), button, FALSE, FALSE, 0);
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
(GtkSignalFunc) gimp_unit_menu_selection_select_callback,
|
||||
GTK_SIGNAL_FUNC (gimp_unit_menu_selection_select_callback),
|
||||
gum);
|
||||
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
|
||||
gtk_widget_show (button);
|
||||
|
@ -517,7 +525,7 @@ gimp_unit_menu_create_selection (GimpUnitMenu *gum)
|
|||
button = gtk_button_new_with_label (_("Close"));
|
||||
gtk_box_pack_start (GTK_BOX (hbbox), button, FALSE, FALSE, 0);
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
(GtkSignalFunc) gimp_unit_menu_selection_close_callback,
|
||||
GTK_SIGNAL_FUNC (gimp_unit_menu_selection_close_callback),
|
||||
gum);
|
||||
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
|
||||
gtk_widget_grab_default (button);
|
||||
|
@ -532,7 +540,8 @@ gimp_unit_menu_create_selection (GimpUnitMenu *gum)
|
|||
|
||||
gtk_clist_append (GTK_CLIST (gum->clist), row);
|
||||
gtk_clist_set_row_data (GTK_CLIST (gum->clist),
|
||||
unit - UNIT_END, (gpointer)unit);
|
||||
unit - UNIT_END,
|
||||
(gpointer) unit);
|
||||
|
||||
g_free (row[0]);
|
||||
g_free (row[1]);
|
||||
|
@ -542,7 +551,7 @@ gimp_unit_menu_create_selection (GimpUnitMenu *gum)
|
|||
gtk_widget_show(vbox);
|
||||
gtk_widget_show(gum->selection);
|
||||
|
||||
if(gum->unit >= UNIT_END)
|
||||
if (gum->unit >= UNIT_END)
|
||||
{
|
||||
gtk_clist_select_row (GTK_CLIST (gum->clist), gum->unit - UNIT_END, 0);
|
||||
gtk_clist_moveto (GTK_CLIST (gum->clist), gum->unit - UNIT_END,
|
||||
|
|
Loading…
Reference in New Issue