gimp r26072 - in branches/soc-2008-tagging: . app/widgets
- From: aurisj svn gnome org
- To: svn-commits-list gnome org
- Subject: gimp r26072 - in branches/soc-2008-tagging: . app/widgets
- Date: Sun, 6 Jul 2008 08:50:43 +0000 (UTC)
Author: aurisj
Date: Sun Jul 6 08:50:43 2008
New Revision: 26072
URL: http://svn.gnome.org/viewvc/gimp?rev=26072&view=rev
Log:
2008-07-06 Aurimas JuÅka <aurisj svn gnome org>
* app/widgets/Makefile.am
* app/widgets/gimpcombotagentry.[ch]
* app/widgets/gimpdatafactoryview.c
* app/widgets/widgets-types.h: added GimpComboTagEntry widget which
wraps GimpTagEntry and will provide UI similar to combo box.
Added:
branches/soc-2008-tagging/app/widgets/gimpcombotagentry.c
branches/soc-2008-tagging/app/widgets/gimpcombotagentry.h
Modified:
branches/soc-2008-tagging/ChangeLog
branches/soc-2008-tagging/app/widgets/Makefile.am
branches/soc-2008-tagging/app/widgets/gimpdatafactoryview.c
branches/soc-2008-tagging/app/widgets/widgets-types.h
Modified: branches/soc-2008-tagging/app/widgets/Makefile.am
==============================================================================
--- branches/soc-2008-tagging/app/widgets/Makefile.am (original)
+++ branches/soc-2008-tagging/app/widgets/Makefile.am Sun Jul 6 08:50:43 2008
@@ -64,6 +64,8 @@
gimpcolorpanel.h \
gimpcolorselectorpalette.c \
gimpcolorselectorpalette.h \
+ gimpcombotagentry.c \
+ gimpcombotagentry.h \
gimpcomponenteditor.c \
gimpcomponenteditor.h \
gimpcontainerbox.c \
Added: branches/soc-2008-tagging/app/widgets/gimpcombotagentry.c
==============================================================================
--- (empty file)
+++ branches/soc-2008-tagging/app/widgets/gimpcombotagentry.c Sun Jul 6 08:50:43 2008
@@ -0,0 +1,201 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995 Spencer Kimball and Peter Mattis
+ *
+ * gimpcombotagentry.c
+ * Copyright (C) 2008 Aurimas JuÅka <aurisj svn gnome org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include "config.h"
+
+#include <string.h>
+
+#include <gtk/gtk.h>
+
+#include "widgets-types.h"
+
+#include "core/gimpcontainer.h"
+#include "core/gimpfilteredcontainer.h"
+#include "core/gimpcontext.h"
+#include "core/gimpviewable.h"
+#include "core/gimptagged.h"
+
+#include "gimptagentry.h"
+#include "gimpcombotagentry.h"
+
+
+static gboolean gimp_combo_tag_entry_expose_event (GtkWidget *widget,
+ GdkEventExpose *event);
+static void gimp_combo_tag_entry_style_set (GtkWidget *widget,
+ GtkStyle *previous_style,
+ GimpComboTagEntry *combo_entry);
+static gboolean gimp_combo_tag_entry_focus_in_out (GtkWidget *widget,
+ GdkEventFocus *event,
+ GimpComboTagEntry *combo_entry);
+
+
+G_DEFINE_TYPE (GimpComboTagEntry, gimp_combo_tag_entry, GTK_TYPE_ALIGNMENT);
+
+#define parent_class gimp_combo_tag_entry_parent_class
+
+
+static void
+gimp_combo_tag_entry_class_init (GimpComboTagEntryClass *klass)
+{
+ GtkWidgetClass *widget_class;
+
+ widget_class = GTK_WIDGET_CLASS (klass);
+ widget_class->expose_event = gimp_combo_tag_entry_expose_event;
+}
+
+static void
+gimp_combo_tag_entry_init (GimpComboTagEntry *combo_entry)
+{
+ combo_entry->tag_entry = NULL;
+ combo_entry->focus_width = 0;
+ combo_entry->interior_focus = FALSE;
+}
+
+GtkWidget *
+gimp_combo_tag_entry_new (GimpTagEntry *tag_entry)
+{
+ GimpComboTagEntry *combo_entry;
+
+ combo_entry = g_object_new (GIMP_TYPE_COMBO_TAG_ENTRY, NULL);
+ combo_entry->tag_entry = GTK_WIDGET (tag_entry);
+
+ gtk_entry_set_has_frame (GTK_ENTRY (tag_entry), FALSE);
+ gtk_widget_show (GTK_WIDGET (tag_entry));
+ gtk_container_add (GTK_CONTAINER (combo_entry), GTK_WIDGET (tag_entry));
+
+ g_signal_connect (combo_entry->tag_entry, "style-set",
+ G_CALLBACK (gimp_combo_tag_entry_style_set),
+ combo_entry);
+ g_signal_connect (combo_entry->tag_entry, "focus-in-event",
+ G_CALLBACK (gimp_combo_tag_entry_focus_in_out),
+ combo_entry);
+ g_signal_connect (combo_entry->tag_entry, "focus-out-event",
+ G_CALLBACK (gimp_combo_tag_entry_focus_in_out),
+ combo_entry);
+
+ return GTK_WIDGET (combo_entry);
+}
+
+static gboolean
+gimp_combo_tag_entry_expose_event (GtkWidget *widget,
+ GdkEventExpose *event)
+{
+ GdkGC *gc;
+ GimpComboTagEntry *combo_entry;
+ GtkWidget *tag_entry;
+ GtkStyle *style;
+ GtkAllocation *allocation;
+ GdkRectangle client_area;
+ GdkRectangle shadow_area;
+
+ combo_entry = GIMP_COMBO_TAG_ENTRY (widget);
+ tag_entry = combo_entry->tag_entry;
+ style = gtk_widget_get_style (tag_entry);
+ allocation = &widget->allocation;
+
+ gc = gdk_gc_new (widget->window);
+
+ client_area.x = widget->allocation.x;
+ client_area.y = widget->allocation.y;
+ client_area.width = widget->allocation.width;
+ client_area.height = widget->allocation.height;
+
+ shadow_area = client_area;
+ if (GTK_WIDGET_HAS_FOCUS (tag_entry)
+ && ! combo_entry->interior_focus)
+ {
+ shadow_area.x += combo_entry->interior_focus;
+ shadow_area.y += combo_entry->interior_focus;
+ shadow_area.width -= combo_entry->interior_focus * 2;
+ shadow_area.height -= combo_entry->interior_focus * 2;
+ }
+
+ gtk_paint_flat_box (style, widget->window,
+ GTK_WIDGET_STATE (tag_entry), GTK_SHADOW_NONE,
+ &event->area, tag_entry, "entry_bg",
+ client_area.x, client_area.y,
+ client_area.width, client_area.height);
+ gtk_paint_shadow (style, widget->window,
+ GTK_STATE_NORMAL, GTK_SHADOW_ETCHED_IN,
+ &event->area, tag_entry, "entry",
+ shadow_area.x, shadow_area.y,
+ shadow_area.width, shadow_area.height);
+ if (GTK_WIDGET_HAS_FOCUS (tag_entry)
+ && ! combo_entry->interior_focus)
+ {
+ gtk_paint_focus (widget->style, widget->window,
+ GTK_WIDGET_STATE (tag_entry),
+ &event->area, tag_entry, "entry",
+ client_area.x, client_area.y,
+ client_area.width, client_area.width);
+ }
+
+ gtk_paint_arrow (style, widget->window, GTK_STATE_NORMAL,
+ GTK_SHADOW_NONE, NULL, NULL, NULL,
+ GTK_ARROW_DOWN, TRUE,
+ shadow_area.x + shadow_area.width - 14,
+ shadow_area.y + shadow_area.height / 2 - 4, 8, 8);
+
+ g_object_unref (gc);
+
+ return FALSE;
+}
+
+static void
+gimp_combo_tag_entry_style_set (GtkWidget *widget,
+ GtkStyle *previous_style,
+ GimpComboTagEntry *combo_entry)
+{
+ GtkStyle *style;
+ gint xmargin;
+ gint ymargin;
+
+ gtk_widget_style_get (combo_entry->tag_entry,
+ "focus-line-width", &combo_entry->focus_width,
+ "interior-focus", &combo_entry->interior_focus,
+ NULL);
+
+ style = gtk_widget_get_style (combo_entry->tag_entry);
+ xmargin = style->xthickness;
+ if (! combo_entry->interior_focus)
+ {
+ xmargin += combo_entry->focus_width;
+ }
+ ymargin = style->ythickness;
+ if (! combo_entry->interior_focus)
+ {
+ ymargin += combo_entry->focus_width;
+ }
+
+ gtk_alignment_set_padding (GTK_ALIGNMENT (combo_entry),
+ ymargin, ymargin, xmargin, xmargin + 16);
+}
+
+static gboolean
+gimp_combo_tag_entry_focus_in_out (GtkWidget *widget,
+ GdkEventFocus *event,
+ GimpComboTagEntry *combo_entry)
+{
+ gtk_widget_queue_draw (GTK_WIDGET (combo_entry));
+
+ return FALSE;
+}
+
Added: branches/soc-2008-tagging/app/widgets/gimpcombotagentry.h
==============================================================================
--- (empty file)
+++ branches/soc-2008-tagging/app/widgets/gimpcombotagentry.h Sun Jul 6 08:50:43 2008
@@ -0,0 +1,57 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995 Spencer Kimball and Peter Mattis
+ *
+ * gimpcombotagentry.h
+ * Copyright (C) 2008 Aurimas JuÅka <aurisj svn gnome org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __GIMP_COMBO_TAG_ENTRY_H__
+#define __GIMP_COMBO_TAG_ENTRY_H__
+
+
+#define GIMP_TYPE_COMBO_TAG_ENTRY (gimp_combo_tag_entry_get_type ())
+#define GIMP_COMBO_TAG_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_COMBO_TAG_ENTRY, GimpComboTagEntry))
+#define GIMP_COMBO_TAG_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_TAG_ENTRY, GimpComboTagEntryClass))
+#define GIMP_IS_COMBO_TAG_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_CONTAINER_ENTRY))
+#define GIMP_IS_COMBO_TAG_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_CONTAINER_ENTRY))
+#define GIMP_COMBO_TAG_ENTRY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_TAG_ENTRY, GimpComboTagEntryClass))
+
+
+typedef struct _GimpComboTagEntryClass GimpComboTagEntryClass;
+
+struct _GimpComboTagEntry
+{
+ GtkAlignment parent_instance;
+
+ GtkWidget *tag_entry;
+ gint focus_width;
+ gboolean interior_focus;
+};
+
+struct _GimpComboTagEntryClass
+{
+ GtkAlignmentClass parent_class;
+};
+
+
+GType gimp_combo_tag_entry_get_type (void) G_GNUC_CONST;
+
+GtkWidget * gimp_combo_tag_entry_new (GimpTagEntry *tag_entry);
+
+GtkWidget * gimp_combo_tag_entry_get_tag_entry (GimpComboTagEntry *combo_entry);
+
+#endif /* __GIMP_COMBO_TAG_ENTRY_H__ */
Modified: branches/soc-2008-tagging/app/widgets/gimpdatafactoryview.c
==============================================================================
--- branches/soc-2008-tagging/app/widgets/gimpdatafactoryview.c (original)
+++ branches/soc-2008-tagging/app/widgets/gimpdatafactoryview.c Sun Jul 6 08:50:43 2008
@@ -39,6 +39,7 @@
#include "core/gimpfilteredcontainer.h"
#include "core/gimpmarshal.h"
+#include "gimpcombotagentry.h"
#include "gimpcontainerview.h"
#include "gimpdatafactoryview.h"
#include "gimpcontainergridview.h"
@@ -139,6 +140,7 @@
{
GimpContainerEditor *editor;
gchar *str;
+ GtkWidget *tag_combo;
g_return_val_if_fail (GIMP_IS_DATA_FACTORY_VIEW (factory_view), FALSE);
g_return_val_if_fail (GIMP_IS_DATA_FACTORY (factory), FALSE);
@@ -231,11 +233,15 @@
gimp_tag_entry_new (GIMP_FILTERED_CONTAINER (factory_view->filtered_container),
GIMP_TAG_ENTRY_MODE_QUERY);
gtk_widget_show (factory_view->query_tag_entry);
+
+ tag_combo = gimp_combo_tag_entry_new (GIMP_TAG_ENTRY (factory_view->query_tag_entry));
+ gtk_widget_show (tag_combo);
+
gtk_box_pack_start (GTK_BOX (editor->view),
- factory_view->query_tag_entry,
+ tag_combo,
FALSE, FALSE, 0);
gtk_box_reorder_child (GTK_BOX (editor->view),
- factory_view->query_tag_entry, 0);
+ tag_combo, 0);
factory_view->assign_tag_entry =
gimp_tag_entry_new (GIMP_FILTERED_CONTAINER (factory_view->filtered_container),
@@ -244,9 +250,12 @@
factory_view->selected_items);
g_list_free (factory_view->selected_items);
factory_view->selected_items = NULL;
- gtk_widget_show (factory_view->assign_tag_entry);
+
+ tag_combo = gimp_combo_tag_entry_new (GIMP_TAG_ENTRY (factory_view->assign_tag_entry));
+ gtk_widget_show (tag_combo);
+
gtk_box_pack_end (GTK_BOX (editor->view),
- factory_view->assign_tag_entry,
+ tag_combo,
FALSE, FALSE, 0);
return TRUE;
Modified: branches/soc-2008-tagging/app/widgets/widgets-types.h
==============================================================================
--- branches/soc-2008-tagging/app/widgets/widgets-types.h (original)
+++ branches/soc-2008-tagging/app/widgets/widgets-types.h Sun Jul 6 08:50:43 2008
@@ -155,6 +155,7 @@
typedef struct _GimpColorDisplayEditor GimpColorDisplayEditor;
typedef struct _GimpColorFrame GimpColorFrame;
typedef struct _GimpColorPanel GimpColorPanel;
+typedef struct _GimpComboTagEntry GimpComboTagEntry;
typedef struct _GimpControllerEditor GimpControllerEditor;
typedef struct _GimpControllerList GimpControllerList;
typedef struct _GimpCurveView GimpCurveView;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]