Commit 46d726d0 authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann

app/widgets/gimpvectorstreeview.h moved function definitions to the

2003-06-02  Sven Neumann  <sven@gimp.org>

	* app/widgets/gimpvectorstreeview.h
	* app/widgets/widgets-types.h: moved function definitions to the
	widgets-types header file.

	* app/gui/dialogs-constructors.c
	* app/widgets/gimpselectioneditor.[ch]: added a "Selection to
	Path" button as suggested in bug #112448.
parent 2d90edbc
2003-06-02 Sven Neumann <sven@gimp.org>
* app/widgets/gimpvectorstreeview.h
* app/widgets/widgets-types.h: moved function definitions to the
widgets-types header file.
* app/gui/dialogs-constructors.c
* app/widgets/gimpselectioneditor.[ch]: added a "Selection to
Path" button as suggested in bug #112448.
2003-06-02 Michael Natterer <mitch@gimp.org>
* app/core/gimpchannel.c (gimp_channel_scale, resize): make sure
......@@ -766,14 +766,19 @@ dialogs_selection_editor_new (GimpDialogFactory *factory,
GimpContext *context,
gint preview_size)
{
GimpImage *gimage;
GtkWidget *view;
GtkWidget *dockable;
GimpImage *gimage;
GtkWidget *view;
GtkWidget *dockable;
GimpSelectionEditor *selection_editor;
gimage = gimp_context_get_image (context);
view = gimp_selection_editor_new (gimage);
selection_editor = GIMP_SELECTION_EDITOR (view);
selection_editor->selection_to_vectors_func = vectors_selection_to_vectors;
dockable = dialogs_dockable_new (view,
_("Selection Editor"), _("Selection"),
GIMP_STOCK_TOOL_RECT_SELECT,
......
......@@ -766,14 +766,19 @@ dialogs_selection_editor_new (GimpDialogFactory *factory,
GimpContext *context,
gint preview_size)
{
GimpImage *gimage;
GtkWidget *view;
GtkWidget *dockable;
GimpImage *gimage;
GtkWidget *view;
GtkWidget *dockable;
GimpSelectionEditor *selection_editor;
gimage = gimp_context_get_image (context);
view = gimp_selection_editor_new (gimage);
selection_editor = GIMP_SELECTION_EDITOR (view);
selection_editor->selection_to_vectors_func = vectors_selection_to_vectors;
dockable = dialogs_dockable_new (view,
_("Selection Editor"), _("Selection"),
GIMP_STOCK_TOOL_RECT_SELECT,
......
......@@ -51,6 +51,7 @@
#include "gimpdnd.h"
#include "gimppreview.h"
#include "gimppreviewrenderer.h"
#include "gimpwidgets-utils.h"
#include "gimp-intl.h"
......@@ -69,6 +70,11 @@ static void gimp_selection_editor_none_clicked (GtkWidget *widget,
GimpImageEditor *editor);
static void gimp_selection_editor_save_clicked (GtkWidget *widget,
GimpImageEditor *editor);
static void gimp_selection_editor_path_clicked (GtkWidget *widget,
GimpImageEditor *editor);
static void gimp_selection_editor_path_extended_clicked (GtkWidget *widget,
guint state,
GimpImageEditor *editor);
static void gimp_selection_editor_stroke_clicked (GtkWidget *widget,
GimpImageEditor *editor);
......@@ -130,12 +136,15 @@ static void
gimp_selection_editor_init (GimpSelectionEditor *selection_editor)
{
GtkWidget *frame;
gchar *str;
frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
gtk_box_pack_start (GTK_BOX (selection_editor), frame, TRUE, TRUE, 0);
gtk_widget_show (frame);
selection_editor->selection_to_vectors_func = NULL;
selection_editor->preview = gimp_preview_new_by_types (GIMP_TYPE_PREVIEW,
GIMP_TYPE_DRAWABLE,
GIMP_PREVIEW_SIZE_HUGE,
......@@ -186,14 +195,29 @@ gimp_selection_editor_init (GimpSelectionEditor *selection_editor)
NULL,
selection_editor);
str = g_strdup_printf (_("Selection to Path\n"
"%s Advanced Options"),
gimp_get_mod_name_shift ());
selection_editor->path_button =
gimp_editor_add_button (GIMP_EDITOR (selection_editor),
GIMP_STOCK_SELECTION_TO_PATH,
str, NULL,
G_CALLBACK (gimp_selection_editor_path_clicked),
G_CALLBACK (gimp_selection_editor_path_extended_clicked),
selection_editor);
g_free (str);
selection_editor->stroke_button =
gimp_editor_add_button (GIMP_EDITOR (selection_editor),
GIMP_STOCK_SELECTION_STROKE,
GIMP_STOCK_SELECTION_STROKE,
_("Stroke Selection"), NULL,
G_CALLBACK (gimp_selection_editor_stroke_clicked),
NULL,
selection_editor);
gtk_widget_set_sensitive (GTK_WIDGET (selection_editor), FALSE);
}
......@@ -296,6 +320,28 @@ gimp_selection_editor_save_clicked (GtkWidget *widget,
}
}
static void
gimp_selection_editor_path_clicked (GtkWidget *widget,
GimpImageEditor *editor)
{
gimp_selection_editor_path_extended_clicked (widget, 0, editor);
}
static void
gimp_selection_editor_path_extended_clicked (GtkWidget *widget,
guint state,
GimpImageEditor *editor)
{
if (editor->gimage)
{
GimpSelectionEditor *sel_editor = GIMP_SELECTION_EDITOR (editor);
if (sel_editor->selection_to_vectors_func)
sel_editor->selection_to_vectors_func (editor->gimage,
(state & GDK_SHIFT_MASK) != 0);
}
}
static void
gimp_selection_editor_stroke_clicked (GtkWidget *widget,
GimpImageEditor *editor)
......
......@@ -35,15 +35,18 @@ typedef struct _GimpSelectionEditorClass GimpSelectionEditorClass;
struct _GimpSelectionEditor
{
GimpImageEditor parent_instance;
GimpImageEditor parent_instance;
GtkWidget *preview;
GimpSelectionToVectorsFunc selection_to_vectors_func;
GtkWidget *all_button;
GtkWidget *none_button;
GtkWidget *invert_button;
GtkWidget *save_button;
GtkWidget *stroke_button;
GtkWidget *preview;
GtkWidget *all_button;
GtkWidget *none_button;
GtkWidget *invert_button;
GtkWidget *save_button;
GtkWidget *path_button;
GtkWidget *stroke_button;
};
struct _GimpSelectionEditorClass
......
......@@ -26,11 +26,6 @@
#include "gimpitemtreeview.h"
typedef void (* GimpStrokeItemFunc) (GimpVectors *vectors);
typedef void (* GimpSelectionToVectorsFunc) (GimpImage *gimage,
gboolean advanced);
#define GIMP_TYPE_VECTORS_TREE_VIEW (gimp_vectors_tree_view_get_type ())
#define GIMP_VECTORS_TREE_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_VECTORS_TREE_VIEW, GimpVectorsTreeView))
#define GIMP_VECTORS_TREE_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_VECTORS_TREE_VIEW, GimpVectorsTreeViewClass))
......
......@@ -116,9 +116,13 @@ typedef struct _GimpItemFactoryEntry GimpItemFactoryEntry;
/* function types */
typedef void (* GimpItemFactorySetupFunc) (GimpItemFactory *factory);
typedef void (* GimpItemFactoryUpdateFunc) (GtkItemFactory *factory,
gpointer data);
typedef void (* GimpItemFactorySetupFunc) (GimpItemFactory *factory);
typedef void (* GimpItemFactoryUpdateFunc) (GtkItemFactory *factory,
gpointer data);
typedef void (* GimpStrokeItemFunc) (GimpVectors *vectors);
typedef void (* GimpSelectionToVectorsFunc) (GimpImage *gimage,
gboolean advanced);
#endif /* __WIDGETS_TYPES_H__ */
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment