~ubuntu-branches/ubuntu/jaunty/gimp/jaunty-security

« back to all changes in this revision

Viewing changes to app/widgets/gimptoolview.c

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Holbach
  • Date: 2007-05-02 16:33:03 UTC
  • mto: This revision was merged to the branch mainline in revision 12.
  • Revision ID: james.westby@ubuntu.com-20070502163303-6wchheivjxgjtlna
Tags: upstream-2.3.16
ImportĀ upstreamĀ versionĀ 2.3.16

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* The GIMP -- an image manipulation program
 
1
/* GIMP - The GNU Image Manipulation Program
2
2
 * Copyright (C) 1995 Spencer Kimball and Peter Mattis
3
3
 *
4
4
 * gimptoolview.c
43
43
#include "gimp-intl.h"
44
44
 
45
45
 
46
 
static void   gimp_tool_view_class_init     (GimpToolViewClass     *klass);
47
 
static void   gimp_tool_view_init           (GimpToolView          *view);
48
 
 
49
46
static void   gimp_tool_view_destroy        (GtkObject             *object);
50
47
 
51
48
static void   gimp_tool_view_select_item    (GimpContainerEditor   *editor,
67
64
                                             GimpContainerTreeView *tree_view);
68
65
 
69
66
 
70
 
static GimpContainerEditorClass *parent_class = NULL;
71
 
 
72
 
 
73
 
GType
74
 
gimp_tool_view_get_type (void)
75
 
{
76
 
  static GType view_type = 0;
77
 
 
78
 
  if (! view_type)
79
 
    {
80
 
      static const GTypeInfo view_info =
81
 
      {
82
 
        sizeof (GimpToolViewClass),
83
 
        NULL,           /* base_init */
84
 
        NULL,           /* base_finalize */
85
 
        (GClassInitFunc) gimp_tool_view_class_init,
86
 
        NULL,           /* class_finalize */
87
 
        NULL,           /* class_data */
88
 
        sizeof (GimpToolView),
89
 
        0,              /* n_preallocs */
90
 
        (GInstanceInitFunc) gimp_tool_view_init,
91
 
      };
92
 
 
93
 
      view_type = g_type_register_static (GIMP_TYPE_CONTAINER_EDITOR,
94
 
                                          "GimpToolView",
95
 
                                          &view_info, 0);
96
 
    }
97
 
 
98
 
  return view_type;
99
 
}
 
67
G_DEFINE_TYPE (GimpToolView, gimp_tool_view, GIMP_TYPE_CONTAINER_EDITOR)
 
68
 
 
69
#define parent_class gimp_tool_view_parent_class
 
70
 
100
71
 
101
72
static void
102
73
gimp_tool_view_class_init (GimpToolViewClass *klass)
104
75
  GtkObjectClass           *object_class = GTK_OBJECT_CLASS (klass);
105
76
  GimpContainerEditorClass *editor_class = GIMP_CONTAINER_EDITOR_CLASS (klass);
106
77
 
107
 
  parent_class = g_type_class_peek_parent (klass);
108
 
 
109
78
  object_class->destroy       = gimp_tool_view_destroy;
110
79
 
111
80
  editor_class->select_item   = gimp_tool_view_select_item;
116
85
gimp_tool_view_init (GimpToolView *view)
117
86
{
118
87
  view->visible_handler_id = 0;
 
88
  view->raise_button       = NULL;
 
89
  view->lower_button       = NULL;
119
90
  view->reset_button       = NULL;
120
91
}
121
92
 
141
112
gimp_tool_view_new (GimpViewType     view_type,
142
113
                    GimpContainer   *container,
143
114
                    GimpContext     *context,
144
 
                    gint             preview_size,
145
 
                    gint             preview_border_width,
 
115
                    gint             view_size,
 
116
                    gint             view_border_width,
146
117
                    GimpMenuFactory *menu_factory)
147
118
{
148
119
  GimpToolView        *tool_view;
153
124
  if (! gimp_container_editor_construct (GIMP_CONTAINER_EDITOR (tool_view),
154
125
                                         view_type,
155
126
                                         container, context,
156
 
                                         preview_size, preview_border_width,
 
127
                                         view_size, view_border_width,
157
128
                                         menu_factory, "<Tools>",
158
129
                                         "/tools-popup"))
159
130
    {
163
134
 
164
135
  editor = GIMP_CONTAINER_EDITOR (tool_view);
165
136
 
 
137
  tool_view->raise_button =
 
138
    gimp_editor_add_action_button (GIMP_EDITOR (editor->view), "tools",
 
139
                                   "tools-raise",
 
140
                                   "tools-raise-to-top", GDK_SHIFT_MASK,
 
141
                                   NULL);
 
142
 
 
143
  tool_view->lower_button =
 
144
    gimp_editor_add_action_button (GIMP_EDITOR (editor->view), "tools",
 
145
                                   "tools-lower",
 
146
                                   "tools-lower-to-bottom", GDK_SHIFT_MASK,
 
147
                                    NULL);
 
148
 
166
149
  tool_view->reset_button =
167
150
    gimp_editor_add_action_button (GIMP_EDITOR (editor->view), "tools",
168
151
                                   "tools-reset", NULL);
183
166
      icon_size = gimp_get_icon_size (GTK_WIDGET (tree_view),
184
167
                                      GIMP_STOCK_VISIBLE,
185
168
                                      GTK_ICON_SIZE_BUTTON,
186
 
                                      preview_size -
 
169
                                      view_size -
187
170
                                      2 * tree_widget->style->xthickness,
188
 
                                      preview_size -
 
171
                                      view_size -
189
172
                                      2 * tree_widget->style->ythickness);
190
173
      g_object_set (eye_cell, "stock-size", icon_size, NULL);
191
174