plug-ins/gfig/images/stock-show-all.png added these two stock icons.

* plug-ins/gfig/images/stock-show-all.png
* plug-ins/gfig/images/stock-select-object.png: added these two stock
  icons. Jimmac, these two are screaming to be redone, please.

* plug-ins/gfig/images/Makefile.am: added these icons.

* plug-ins/gfig/gfig-bezier.c
* plug-ins/gfig/gfig-bezier.h
* plug-ins/gfig/gfig-dialog.c
* plug-ins/gfig/gfig-poly.c
* plug-ins/gfig/gfig-poly.h
* plug-ins/gfig/gfig-spiral.c
* plug-ins/gfig/gfig-spiral.h
* plug-ins/gfig/gfig-star.c
* plug-ins/gfig/gfig-star.h
* plug-ins/gfig/gfig-stock.c
* plug-ins/gfig/gfig-stock.h
* plug-ins/gfig/gfig.h: moved all the buttons to a GtkUIManager
  toolbar, which makes the code simpler and easier to read.
This commit is contained in:
David Odin 2004-11-12 01:54:02 +00:00
parent 1aa12291a2
commit 8ad5aefa69
16 changed files with 220 additions and 285 deletions

View File

@ -1,3 +1,25 @@
2004-11-12 DindinX <dindinx@gimp.org>
* plug-ins/gfig/images/stock-show-all.png
* plug-ins/gfig/images/stock-select-object.png: added these two stock
icons. Jimmac, these two are screaming to be redone, please.
* plug-ins/gfig/images/Makefile.am: added these icons.
* plug-ins/gfig/gfig-bezier.c
* plug-ins/gfig/gfig-bezier.h
* plug-ins/gfig/gfig-dialog.c
* plug-ins/gfig/gfig-poly.c
* plug-ins/gfig/gfig-poly.h
* plug-ins/gfig/gfig-spiral.c
* plug-ins/gfig/gfig-spiral.h
* plug-ins/gfig/gfig-star.c
* plug-ins/gfig/gfig-star.h
* plug-ins/gfig/gfig-stock.c
* plug-ins/gfig/gfig-stock.h
* plug-ins/gfig/gfig.h: moved all the buttons to a GtkUIManager
toolbar, which makes the code simpler and easier to read.
2004-11-12 Sven Neumann <sven@gimp.org>
* app/dialogs/tips-dialog.c: added icons to the Previous/Next

View File

@ -434,23 +434,16 @@ d_bezier_end (GdkPoint *pnt, gint shift_down)
}
void
tool_options_bezier (GtkWidget *notebook,
GtkWidget *button)
tool_options_bezier (GtkWidget *notebook)
{
GtkWidget *vbox;
GtkWidget *toggle;
gint page;
vbox = gtk_vbox_new (FALSE, 0);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 12);
page = gtk_notebook_append_page (GTK_NOTEBOOK (notebook), vbox, NULL);
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), vbox, NULL);
gtk_widget_show (vbox);
g_object_set_data (G_OBJECT (button), "page", GINT_TO_POINTER (page));
g_signal_connect (button, "clicked",
G_CALLBACK (tool_option_page_update),
notebook);
toggle = gtk_check_button_new_with_label (_("Closed"));
g_signal_connect (toggle, "toggled",
G_CALLBACK (gimp_toggle_button_update),

View File

@ -37,7 +37,6 @@ void d_bezier_end (GdkPoint *pnt,
gint shift_down);
void d_bezier_object_class_init (void);
void tool_options_bezier (GtkWidget *notebook,
GtkWidget *button);
void tool_options_bezier (GtkWidget *notebook);
#endif /* __GFIG_BEZIER_H__ */

View File

@ -61,8 +61,6 @@
#include "gfig-star.h"
#include "gfig-stock.h"
#define SCALE_WIDTH 120
#define BRUSH_PREVIEW_SZ 32
#define SEL_BUTTON_WIDTH 100
#define SEL_BUTTON_HEIGHT 20
@ -147,6 +145,7 @@ typedef struct
static GfigOptWidgets gfig_opt_widget;
static gchar *gfig_path = NULL;
static GtkWidget *page_menu_bg;
static GtkWidget *tool_options_notebook;
static void gfig_response (GtkWidget *widget,
@ -162,7 +161,7 @@ static void gfig_list_free_all (void);
static void create_save_file_chooser (GFigObj *obj,
gchar *tpath,
GtkWidget *parent);
static GtkWidget *draw_buttons (GtkWidget *notebook);
static void create_notebook_pages (GtkWidget *notebook);
static void select_combo_callback (GtkWidget *widget,
gpointer data);
static void adjust_grid_callback (GtkWidget *widget,
@ -181,14 +180,13 @@ static void load_file_chooser_response (GtkFileChooser *chooser,
static void save_file_chooser_response (GtkFileChooser *chooser,
gint response_id,
GFigObj *obj);
static GtkWidget *but_with_pix (const gchar *stock_id,
GSList **group,
gint baction);
static void paint_combo_callback (GtkWidget *widget,
gpointer data);
static void select_button_clicked (GtkWidget *widget,
gpointer data);
static void select_button_clicked (gint type);
static void select_button_clicked_lt (void);
static void select_button_clicked_gt (void);
static void select_button_clicked_eq (void);
static void raise_selected_obj_to_top (GtkWidget *widget,
gpointer data);
static void lower_selected_obj_to_bottom (GtkWidget *widget,
@ -198,6 +196,10 @@ static void raise_selected_obj (GtkWidget *widget,
static void lower_selected_obj (GtkWidget *widget,
gpointer data);
static void toggle_obj_type (GtkRadioAction *action,
GtkRadioAction *current,
gpointer data);
static GtkUIManager *create_ui_manager (GtkWidget *window);
gint
@ -209,13 +211,13 @@ gfig_dialog (void)
GimpParasite *parasite;
gint newlayer;
GtkWidget *menubar;
GtkWidget *toolbar;
GtkWidget *combo;
GtkWidget *frame;
gint k;
gint img_width;
gint img_height;
GtkWidget *toggle;
GtkWidget *notebook;
GtkWidget *right_vbox;
GtkWidget *hbox;
GtkUIManager *ui_manager;
@ -323,6 +325,11 @@ gfig_dialog (void)
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (top_level_dlg)->vbox),
menubar, FALSE, FALSE, 0);
gtk_widget_show (menubar);
toolbar = gtk_ui_manager_get_widget (ui_manager, "/ui/gfig-toolbar");
gtk_toolbar_set_style (GTK_TOOLBAR (toolbar), GTK_TOOLBAR_ICONS);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (top_level_dlg)->vbox),
toolbar, FALSE, FALSE, 0);
gtk_widget_show (toolbar);
/* Main box */
main_hbox = gtk_hbox_new (FALSE, 12);
@ -344,11 +351,12 @@ gfig_dialog (void)
gtk_box_pack_start (GTK_BOX (right_vbox), frame, FALSE, FALSE, 0);
gtk_widget_show (frame);
notebook = gtk_notebook_new ();
gtk_container_add (GTK_CONTAINER (frame), notebook);
gtk_notebook_set_show_tabs (GTK_NOTEBOOK (notebook), FALSE);
gtk_notebook_set_show_border (GTK_NOTEBOOK (notebook), FALSE);
gtk_widget_show (notebook);
tool_options_notebook = gtk_notebook_new ();
gtk_container_add (GTK_CONTAINER (frame), tool_options_notebook);
gtk_notebook_set_show_tabs (GTK_NOTEBOOK (tool_options_notebook), FALSE);
gtk_notebook_set_show_border (GTK_NOTEBOOK (tool_options_notebook), FALSE);
gtk_widget_show (tool_options_notebook);
create_notebook_pages (tool_options_notebook);
/* Style frame on right side */
frame = gimp_frame_new ("Style");
@ -470,12 +478,6 @@ gfig_dialog (void)
gtk_widget_show (toggle);
gfig_opt_widget.drawgrid = toggle;
/* Add buttons above the preview frame */
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (top_level_dlg)->vbox),
draw_buttons (notebook),
FALSE, FALSE, 0);
/* Load saved objects */
gfig_list_load_all (gfig_path);
@ -763,18 +765,77 @@ create_ui_manager (GtkWidget *window)
{ "options", GTK_STOCK_PREFERENCES,
NULL, "<control>P", NULL,
G_CALLBACK (options_dialog_callback) }
G_CALLBACK (options_dialog_callback) },
{ "raise", GTK_STOCK_GO_UP,
NULL, "<control>U", N_("Raise selected object"),
G_CALLBACK (raise_selected_obj) },
{ "lower", GTK_STOCK_GO_DOWN,
NULL, "<control>D", N_("Lower selected object"),
G_CALLBACK (lower_selected_obj) },
{ "top", GTK_STOCK_GOTO_TOP,
NULL, "<control>T", N_("Raise selected object to top"),
G_CALLBACK (raise_selected_obj_to_top) },
{ "bottom", GTK_STOCK_GOTO_BOTTOM,
NULL, "<control>B", N_("Lower selected object to bottom"),
G_CALLBACK (lower_selected_obj_to_bottom) },
{ "show_previous", GTK_STOCK_GO_BACK,
NULL, "<control>H", N_("Show previous object"),
G_CALLBACK (select_button_clicked_lt) },
{ "show_next", GTK_STOCK_GO_FORWARD,
NULL, "<control>L", N_("Show next object"),
G_CALLBACK (select_button_clicked_gt) },
{ "show_all", GFIG_STOCK_SHOW_ALL,
NULL, "<control>A", N_("Show all objects"),
G_CALLBACK (select_button_clicked_eq) }
};
static GtkRadioActionEntry radio_actions[] =
{
{ "line", GIMP_STOCK_TOOL_MOVE,
N_("Move"), "M", NULL, 0 },
{ "line", GFIG_STOCK_LINE,
NULL, "L", N_("Create line"), LINE },
{ "rotate", GIMP_STOCK_TOOL_ROTATE,
N_("Rotate"), "R", N_("Rotate / Scale"), 1/*OP_ROTATE*/ },
{ "circle", GFIG_STOCK_CIRCLE,
NULL, "C", N_("Create circle"), CIRCLE },
{ "stretch", GIMP_STOCK_TOOL_PERSPECTIVE,
N_("Stretch"), "S", NULL, 2/*OP_STRETCH*/ }
{ "ellipse", GFIG_STOCK_ELLIPSE,
NULL, "E", N_("Create ellipse"), ELLIPSE },
{ "arc", GFIG_STOCK_CURVE,
NULL, "A", N_("Create arc"), ARC },
{ "polygon", GFIG_STOCK_POLYGON,
NULL, "P", N_("Create reg polygon"), POLY },
{ "star", GFIG_STOCK_STAR,
NULL, "S", N_("Create star"), STAR },
{ "spiral", GFIG_STOCK_SPIRAL,
NULL, "I", N_("Create spiral"), SPIRAL },
{ "bezier", GFIG_STOCK_BEZIER,
NULL, "B", N_("Create bezier curve. "
"Shift + Button ends object creation."), BEZIER },
{ "move_obj", GFIG_STOCK_MOVE_OBJECT,
NULL, "M", N_("Move an object"), MOVE_OBJ },
{ "move_point", GFIG_STOCK_MOVE_POINT,
NULL, "V", N_("Move a single point"), MOVE_POINT },
{ "copy", GFIG_STOCK_COPY_OBJECT,
NULL, "Y", N_("Copy an object"), COPY_OBJ },
{ "delete", GFIG_STOCK_DELETE_OBJECT,
NULL, "D", N_("Delete an object"), DEL_OBJ },
{ "select", GFIG_STOCK_SELECT_OBJECT,
NULL, "A", N_("Select an object"), SELECT_OBJ }
};
GtkUIManager *ui_manager = gtk_ui_manager_new ();
@ -786,12 +847,12 @@ create_ui_manager (GtkWidget *window)
actions,
G_N_ELEMENTS (actions),
window);
/* gtk_action_group_add_radio_actions (group,
gtk_action_group_add_radio_actions (group,
radio_actions,
G_N_ELEMENTS (radio_actions),
ifsDesign->op,
G_CALLBACK (design_op_update_callback),
window);*/
LINE,
G_CALLBACK (toggle_obj_type),
window);
gtk_window_add_accel_group (GTK_WINDOW (window),
gtk_ui_manager_get_accel_group (ui_manager));
@ -814,187 +875,64 @@ create_ui_manager (GtkWidget *window)
" </menubar>"
"</ui>",
-1, NULL);
gtk_ui_manager_add_ui_from_string (ui_manager,
"<ui>"
" <toolbar name=\"gfig-toolbar\">"
" <toolitem action=\"line\" />"
" <toolitem action=\"circle\" />"
" <toolitem action=\"ellipse\" />"
" <toolitem action=\"arc\" />"
" <toolitem action=\"polygon\" />"
" <toolitem action=\"star\" />"
" <toolitem action=\"spiral\" />"
" <toolitem action=\"bezier\" />"
" <toolitem action=\"move_obj\" />"
" <toolitem action=\"move_point\" />"
" <toolitem action=\"copy\" />"
" <toolitem action=\"delete\" />"
" <toolitem action=\"select\" />"
" <separator />"
" <toolitem action=\"raise\" />"
" <toolitem action=\"lower\" />"
" <toolitem action=\"top\" />"
" <toolitem action=\"bottom\" />"
" <separator />"
" <toolitem action=\"show_previous\" />"
" <toolitem action=\"show_next\" />"
" <toolitem action=\"show_all\" />"
" </toolbar>"
"</ui>",
-1, NULL);
return ui_manager;
}
void
tool_option_page_update (GtkWidget *button,
GtkWidget *notebook)
{
gint page = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (button), "page"));
gtk_notebook_set_current_page (GTK_NOTEBOOK (notebook), page);
}
static void
tool_option_no_option (GtkWidget *notebook,
GtkWidget *button)
tool_option_no_option (GtkWidget *notebook)
{
GtkWidget *label;
gint page;
label = gtk_label_new (_("This tool has no options"));
gtk_widget_show (label);
page = gtk_notebook_append_page (GTK_NOTEBOOK (notebook), label, NULL);
g_object_set_data (G_OBJECT (button), "page", GINT_TO_POINTER (page));
g_signal_connect (button, "clicked",
G_CALLBACK (tool_option_page_update),
notebook);
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), label, NULL);
}
#define BOX_APPEND(button, text) \
gtk_box_pack_start (GTK_BOX (hbox), (button), FALSE, FALSE, 0);\
gtk_widget_show (button);\
gimp_help_set_help_data (button, (text), NULL);
#define SKIP_ROW \
do \
{ \
GtkWidget *separator; \
separator = gtk_vseparator_new (); \
gtk_box_pack_start (GTK_BOX (hbox), separator, FALSE, FALSE, 0); \
gtk_widget_show (separator); \
} \
while (0)
static GtkWidget *
draw_buttons (GtkWidget *notebook)
static void
create_notebook_pages (GtkWidget *notebook)
{
GtkWidget *hbox;
GtkWidget *button;
GtkWidget *image;
GSList *group = NULL;
hbox = gtk_hbox_new (FALSE, 0);
gtk_widget_show (hbox);
/* Tools buttons */
button = but_with_pix (GFIG_STOCK_LINE, &group, LINE);
BOX_APPEND (button, _("Create line"));
tool_option_no_option (notebook, button);
button = but_with_pix (GFIG_STOCK_CIRCLE, &group, CIRCLE);
BOX_APPEND (button, _("Create circle"));
tool_option_no_option (notebook, button);
button = but_with_pix (GFIG_STOCK_ELLIPSE, &group, ELLIPSE);
BOX_APPEND (button, _("Create ellipse"));
tool_option_no_option (notebook, button);
button = but_with_pix (GFIG_STOCK_CURVE, &group, ARC);
BOX_APPEND (button, _("Create arc"));
tool_option_no_option (notebook, button);
button = but_with_pix (GFIG_STOCK_POLYGON, &group, POLY);
BOX_APPEND (button, _("Create reg polygon"));
tool_options_poly (notebook, button);
button = but_with_pix (GFIG_STOCK_STAR, &group, STAR);
BOX_APPEND (button, _("Create star"));
tool_options_star (notebook, button);
button = but_with_pix (GFIG_STOCK_SPIRAL, &group, SPIRAL);
BOX_APPEND (button, _("Create spiral"));
tool_options_spiral (notebook, button);
button = but_with_pix (GFIG_STOCK_BEZIER, &group, BEZIER);
BOX_APPEND (button, _("Create bezier curve. "
"Shift + Button ends object creation."));
tool_options_bezier (notebook, button);
SKIP_ROW;
button = but_with_pix (GFIG_STOCK_MOVE_OBJECT, &group, MOVE_OBJ);
BOX_APPEND (button, _("Move an object"));
tool_option_no_option (notebook, button);
button = but_with_pix (GFIG_STOCK_MOVE_POINT, &group, MOVE_POINT);
BOX_APPEND (button, _("Move a single point"));
tool_option_no_option (notebook, button);
button = but_with_pix (GFIG_STOCK_COPY_OBJECT, &group, COPY_OBJ);
BOX_APPEND (button, _("Copy an object"));
tool_option_no_option (notebook, button);
button = but_with_pix (GFIG_STOCK_DELETE_OBJECT, &group, DEL_OBJ);
BOX_APPEND (button, _("Delete an object"));
tool_option_no_option (notebook, button);
button = but_with_pix (GIMP_STOCK_TOOL_RECT_SELECT, &group, SELECT_OBJ);
BOX_APPEND (button, _("Select an object"));
tool_option_no_option (notebook, button);
SKIP_ROW;
button = gtk_button_new ();
g_signal_connect (button, "clicked",
G_CALLBACK (raise_selected_obj),
NULL);
image = gtk_image_new_from_stock (GTK_STOCK_GO_UP,
GTK_ICON_SIZE_BUTTON);
gtk_container_add (GTK_CONTAINER (button), image);
gtk_widget_show (image);
BOX_APPEND (button, _("Raise selected object"));
button = gtk_button_new ();
g_signal_connect (button, "clicked",
G_CALLBACK (lower_selected_obj),
NULL);
image = gtk_image_new_from_stock (GTK_STOCK_GO_DOWN,
GTK_ICON_SIZE_BUTTON);
gtk_container_add (GTK_CONTAINER (button), image);
gtk_widget_show (image);
BOX_APPEND (button, _("Lower selected object"));
button = gtk_button_new ();
g_signal_connect (button, "clicked",
G_CALLBACK (raise_selected_obj_to_top),
NULL);
image = gtk_image_new_from_stock (GTK_STOCK_GOTO_TOP,
GTK_ICON_SIZE_BUTTON);
gtk_container_add (GTK_CONTAINER (button), image);
gtk_widget_show (image);
BOX_APPEND (button, _("Raise selected object to top"));
button = gtk_button_new ();
g_signal_connect (button, "clicked",
G_CALLBACK (lower_selected_obj_to_bottom),
NULL);
image = gtk_image_new_from_stock (GTK_STOCK_GOTO_BOTTOM,
GTK_ICON_SIZE_BUTTON);
gtk_container_add (GTK_CONTAINER (button), image);
gtk_widget_show (image);
BOX_APPEND (button, _("Lower selected object to bottom"));
button = gtk_button_new ();
g_signal_connect (button, "clicked",
G_CALLBACK (select_button_clicked),
GINT_TO_POINTER (OBJ_SELECT_LT));
image = gtk_image_new_from_stock (GTK_STOCK_GO_BACK,
GTK_ICON_SIZE_BUTTON);
gtk_container_add (GTK_CONTAINER (button), image);
gtk_widget_show (image);
BOX_APPEND (button, _("Show previous object"));
button = gtk_button_new ();
g_signal_connect (button, "clicked",
G_CALLBACK (select_button_clicked),
GINT_TO_POINTER (OBJ_SELECT_GT));
image = gtk_image_new_from_stock (GTK_STOCK_GO_FORWARD,
GTK_ICON_SIZE_BUTTON);
gtk_container_add (GTK_CONTAINER (button), image);
gtk_widget_show (image);
BOX_APPEND (button, _("Show next object"));
button = gtk_button_new_with_label (_("All"));
g_signal_connect (button, "clicked",
G_CALLBACK (select_button_clicked),
GINT_TO_POINTER (OBJ_SELECT_EQ));
BOX_APPEND (button, _("Show all objects"));
return hbox;
tool_option_no_option (notebook); /* Line */
tool_option_no_option (notebook); /* Circle */
tool_option_no_option (notebook); /* Ellipse */
tool_option_no_option (notebook); /* Arc */
tool_options_poly (notebook); /* Polygon */
tool_options_star (notebook); /* Star */
tool_options_spiral (notebook); /* Spiral */
tool_options_bezier (notebook); /* Bezier */
tool_option_no_option (notebook); /* Dummy */
tool_option_no_option (notebook); /* Move Object */
tool_option_no_option (notebook); /* Move Point */
tool_option_no_option (notebook); /* Copy Object */
tool_option_no_option (notebook); /* Delete Object */
}
static void
@ -1552,10 +1490,8 @@ gfig_select_obj_by_number (gint count)
}
static void
select_button_clicked (GtkWidget *widget,
gpointer data)
select_button_clicked (gint type)
{
gint type = GPOINTER_TO_INT (data);
gint count = 0;
DAllObjs *objs;
@ -1595,26 +1531,23 @@ select_button_clicked (GtkWidget *widget,
draw_grid_clear ();
}
static GtkWidget *
but_with_pix (const gchar *stock_id,
GSList **group,
gint baction)
static void
select_button_clicked_lt (void)
{
GtkWidget *button;
button = gtk_radio_button_new_with_label (*group, stock_id);
gtk_button_set_use_stock (GTK_BUTTON (button), TRUE);
gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (button), FALSE);
g_signal_connect (button, "toggled",
G_CALLBACK (toggle_obj_type),
GINT_TO_POINTER (baction));
gtk_widget_show (button);
*group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (button));
return button;
select_button_clicked (OBJ_SELECT_LT);
}
static void
select_button_clicked_gt (void)
{
select_button_clicked (OBJ_SELECT_GT);
}
static void
select_button_clicked_eq (void)
{
select_button_clicked (OBJ_SELECT_EQ);
}
/* Special case for now - options on poly/star/spiral button */
@ -1929,21 +1862,24 @@ toggle_show_image (void)
draw_grid_clear ();
}
void
toggle_obj_type (GtkWidget *widget,
gpointer data)
static void
toggle_obj_type (GtkRadioAction *action,
GtkRadioAction *current,
gpointer data)
{
static GdkCursor *p_cursors[DEL_OBJ + 1];
GdkCursorType ctype = GDK_LAST_CURSOR;
DobjType new_type;
if (selvals.otype != (DobjType) GPOINTER_TO_INT (data))
new_type = gtk_radio_action_get_current_value (action);
if (selvals.otype != new_type)
{
/* Mem leak */
obj_creating = NULL;
tmp_line = NULL;
tmp_bezier = NULL;
if ((DobjType)data < MOVE_OBJ)
if (new_type < MOVE_OBJ) /* Eeeeek */
{
obj_show_single = -1; /* Cancel select preview */
}
@ -1951,7 +1887,9 @@ toggle_obj_type (GtkWidget *widget,
gtk_widget_queue_draw (gfig_context->preview);
}
selvals.otype = (DobjType) GPOINTER_TO_INT (data);
selvals.otype = new_type;
gtk_notebook_set_current_page (GTK_NOTEBOOK (tool_options_notebook),
new_type - 1);
switch (selvals.otype)
{

View File

@ -47,20 +47,13 @@ static void d_draw_poly (Dobject *obj);
static Dobject *d_copy_poly (Dobject *obj);
void
tool_options_poly (GtkWidget *notebook,
GtkWidget *button)
tool_options_poly (GtkWidget *notebook)
{
GtkWidget *sides;
gint page;
sides = num_sides_widget (_("Regular Polygon Number of Sides"),
&poly_num_sides, NULL, 3, 200);
page = gtk_notebook_append_page (GTK_NOTEBOOK (notebook), sides, NULL);
g_object_set_data (G_OBJECT (button), "page", GINT_TO_POINTER (page));
g_signal_connect (button, "clicked",
G_CALLBACK (tool_option_page_update),
notebook);
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), sides, NULL);
}
static void

View File

@ -26,8 +26,7 @@
#ifndef __GFIG_POLY_H__
#define __GFIG_POLY_H__
void tool_options_poly (GtkWidget *notebook,
GtkWidget *button);
void tool_options_poly (GtkWidget *notebook);
void d_update_poly (GdkPoint *pnt);
void d_poly_start (GdkPoint *pnt,

View File

@ -49,23 +49,15 @@ static gint spiral_num_turns = 4; /* Default to 4 turns */
static gint spiral_toggle = 0; /* 0 = clockwise -1 = anti-clockwise */
void
tool_options_spiral (GtkWidget *notebook,
GtkWidget *button)
tool_options_spiral (GtkWidget *notebook)
{
GtkWidget *sides;
gint page;
sides = num_sides_widget (_("Spiral Number of Turns"),
&spiral_num_turns, &spiral_toggle, 1, 20);
page = gtk_notebook_append_page (GTK_NOTEBOOK (notebook), sides, NULL);
g_object_set_data (G_OBJECT (button), "page", GINT_TO_POINTER (page));
g_signal_connect (button, "clicked",
G_CALLBACK (tool_option_page_update),
notebook);
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), sides, NULL);
}
static void
d_draw_spiral (Dobject *obj)
{

View File

@ -26,8 +26,7 @@
#ifndef __GFIG_SPIRAL_H__
#define __GFIG_SPIRAL_H__
void tool_options_spiral (GtkWidget *notebook,
GtkWidget *button);
void tool_options_spiral (GtkWidget *notebook);
void d_update_spiral (GdkPoint *pnt);
void d_spiral_start (GdkPoint *pnt,

View File

@ -47,20 +47,13 @@ static void d_paint_star (Dobject *obj);
static Dobject *d_copy_star (Dobject * obj);
void
tool_options_star (GtkWidget *notebook,
GtkWidget *button)
tool_options_star (GtkWidget *notebook)
{
GtkWidget *sides;
gint page;
sides = num_sides_widget (_("Star Number of Points"),
&star_num_sides, NULL, 3, 200);
page = gtk_notebook_append_page (GTK_NOTEBOOK (notebook), sides, NULL);
g_object_set_data (G_OBJECT (button), "page", GINT_TO_POINTER (page));
g_signal_connect (button, "clicked",
G_CALLBACK (tool_option_page_update),
notebook);
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), sides, NULL);
}
static void

View File

@ -26,8 +26,7 @@
#ifndef __GFIG_STAR_H__
#define __GFIG_STAR_H__
void tool_options_star (GtkWidget *notebook,
GtkWidget *button);
void tool_options_star (GtkWidget *notebook);
void d_update_star (GdkPoint *pnt);
void d_star_start (GdkPoint *pnt,

View File

@ -31,23 +31,27 @@
#include "images/gfig-stock-pixbufs.h"
#include "libgimp/stdplugins-intl.h"
static GtkIconFactory *gfig_icon_factory = NULL;
static GtkStockItem gfig_stock_items[] =
{
{ GFIG_STOCK_BEZIER, NULL, 0, 0, NULL },
{ GFIG_STOCK_CIRCLE, NULL, 0, 0, NULL },
{ GFIG_STOCK_COPY_OBJECT, NULL, 0, 0, NULL },
{ GFIG_STOCK_CURVE, NULL, 0, 0, NULL },
{ GFIG_STOCK_DELETE_OBJECT, NULL, 0, 0, NULL },
{ GFIG_STOCK_ELLIPSE, NULL, 0, 0, NULL },
{ GFIG_STOCK_LINE, NULL, 0, 0, NULL },
{ GFIG_STOCK_MOVE_OBJECT, NULL, 0, 0, NULL },
{ GFIG_STOCK_MOVE_POINT, NULL, 0, 0, NULL },
{ GFIG_STOCK_POLYGON, NULL, 0, 0, NULL },
{ GFIG_STOCK_SPIRAL, NULL, 0, 0, NULL },
{ GFIG_STOCK_STAR, NULL, 0, 0, NULL }
{ GFIG_STOCK_BEZIER, N_("Create bezier curve"), 0, 0, NULL },
{ GFIG_STOCK_CIRCLE, N_("Create circle"), 0, 0, NULL },
{ GFIG_STOCK_COPY_OBJECT, N_("Copy an object"), 0, 0, NULL },
{ GFIG_STOCK_CURVE, N_("Create arc"), 0, 0, NULL },
{ GFIG_STOCK_DELETE_OBJECT, N_("Delete an object"), 0, 0, NULL },
{ GFIG_STOCK_ELLIPSE, N_("Create ellipse"), 0, 0, NULL },
{ GFIG_STOCK_LINE, N_("Create line"), 0, 0, NULL },
{ GFIG_STOCK_MOVE_OBJECT, N_("Move an object"), 0, 0, NULL },
{ GFIG_STOCK_MOVE_POINT, N_("Move a single point"), 0, 0, NULL },
{ GFIG_STOCK_POLYGON, N_("Create reg polygon"), 0, 0, NULL },
{ GFIG_STOCK_SELECT_OBJECT, N_("Select an object"), 0, 0, NULL },
{ GFIG_STOCK_SHOW_ALL, N_("Show all objects"), 0, 0, NULL },
{ GFIG_STOCK_SPIRAL, N_("Create spiral"), 0, 0, NULL },
{ GFIG_STOCK_STAR, N_("Create star"), 0, 0, NULL }
};
@ -63,7 +67,7 @@ add_stock_icon (const gchar *stock_id,
source = gtk_icon_source_new ();
gtk_icon_source_set_size (source, size);
gtk_icon_source_set_size_wildcarded (source, FALSE);
gtk_icon_source_set_size_wildcarded (source, TRUE);
pixbuf = gdk_pixbuf_new_from_inline (-1, inline_data, FALSE, NULL);
@ -100,6 +104,8 @@ gfig_stock_init (void)
add_stock_icon (GFIG_STOCK_MOVE_OBJECT, GTK_ICON_SIZE_BUTTON, stock_move_object);
add_stock_icon (GFIG_STOCK_MOVE_POINT, GTK_ICON_SIZE_BUTTON, stock_move_point);
add_stock_icon (GFIG_STOCK_POLYGON, GTK_ICON_SIZE_BUTTON, stock_polygon);
add_stock_icon (GFIG_STOCK_SELECT_OBJECT, GTK_ICON_SIZE_BUTTON, stock_select_object);
add_stock_icon (GFIG_STOCK_SHOW_ALL, GTK_ICON_SIZE_BUTTON, stock_show_all);
add_stock_icon (GFIG_STOCK_SPIRAL, GTK_ICON_SIZE_BUTTON, stock_spiral);
add_stock_icon (GFIG_STOCK_STAR, GTK_ICON_SIZE_BUTTON, stock_star);

View File

@ -37,6 +37,8 @@
#define GFIG_STOCK_MOVE_OBJECT "gfig-move-object"
#define GFIG_STOCK_MOVE_POINT "gfig-move-point"
#define GFIG_STOCK_POLYGON "gfig-polygon"
#define GFIG_STOCK_SELECT_OBJECT "gfig-select-object"
#define GFIG_STOCK_SHOW_ALL "gfig-show-all"
#define GFIG_STOCK_SPIRAL "gfig-spiral"
#define GFIG_STOCK_STAR "gfig-star"

View File

@ -184,8 +184,6 @@ GtkWidget *num_sides_widget (gchar *d_title,
gint *which_way,
gint adj_min,
gint adj_max);
void toggle_obj_type (GtkWidget *widget,
gpointer data);
void setup_undo (void);
void draw_grid_clear (void);

View File

@ -11,6 +11,8 @@ STOCK_IMAGES = \
stock-move-object.png \
stock-move-point.png \
stock-polygon.png \
stock-select-object.png \
stock-show-all.png \
stock-spiral.png \
stock-star.png \
stock-logo.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 511 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 140 B