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

« back to all changes in this revision

Viewing changes to plug-ins/imagemap/imap_selection.c

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Holbach
  • Date: 2007-05-02 16:33:03 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20070502163303-bvzhjzbpw8qglc4y
Tags: 2.3.16-1ubuntu1
* Resynchronized with Debian, remaining Ubuntu changes:
  - debian/rules: i18n magic.
* debian/control.in:
  - Maintainer: Ubuntu Core Developers <ubuntu-devel@lists.ubuntu.com>
* debian/patches/02_help-message.patch,
  debian/patches/03_gimp.desktop.in.in.patch,
  debian/patches/10_dont_show_wizard.patch: updated.
* debian/patches/04_composite-signedness.patch,
  debian/patches/05_add-letter-spacing.patch: dropped, used upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
 *
4
4
 * Generates clickable image maps.
5
5
 *
6
 
 * Copyright (C) 1998-2004 Maurits Rijk  m.rijk@chello.nl
 
6
 * Copyright (C) 1998-2005 Maurits Rijk  m.rijk@chello.nl
7
7
 *
8
8
 * This program is free software; you can redistribute it and/or modify
9
9
 * it under the terms of the GNU General Public License as published by
30
30
#include "libgimpwidgets/gimpwidgets.h"
31
31
 
32
32
#include "imap_commands.h"
33
 
#include "imap_edit_area_info.h"
34
33
#include "imap_main.h"
35
 
#include "imap_misc.h"
 
34
#include "imap_menu.h"
36
35
#include "imap_selection.h"
37
36
 
38
37
#include "libgimp/stdplugins-intl.h"
40
39
static void
41
40
set_buttons(Selection_t *data)
42
41
{
 
42
#ifdef _OLD_
43
43
  if (gtk_tree_selection_count_selected_rows (data->selection)) {
44
44
#ifdef _OLD_
45
45
    gtk_widget_set_sensitive(data->arrow_up,
57
57
    gtk_widget_set_sensitive(data->remove, FALSE);
58
58
    gtk_widget_set_sensitive(data->edit, FALSE);
59
59
  }
 
60
#endif
60
61
}
61
62
 
62
63
static void
64
65
{
65
66
  Selection_t *data = (Selection_t*) param;
66
67
 
67
 
  if (data->select_lock) {
68
 
    data->select_lock = FALSE;
69
 
  } else {
70
 
    Command_t *command, *sub_command;
71
 
    GtkTreeModel *model;
72
 
    GList *list = gtk_tree_selection_get_selected_rows (selection, &model);
73
 
 
74
 
    command = subcommand_start (NULL);
75
 
    sub_command = unselect_all_command_new (data->object_list, NULL);
76
 
    command_add_subcommand (command, sub_command);
77
 
 
78
 
    for (; list; list = list->next)
 
68
  if (data->select_lock)
 
69
    {
 
70
      data->select_lock = FALSE;
 
71
    } else
79
72
      {
80
 
        Object_t *obj;
81
 
        GtkTreeIter iter;
82
 
        GtkTreePath *path = (GtkTreePath*) list->data;
83
 
 
84
 
        gtk_tree_model_get_iter (model, &iter, path);
85
 
        gtk_tree_model_get (model, &iter, 0, &obj, -1);
86
 
 
87
 
        sub_command = select_command_new (obj);
88
 
        command_add_subcommand (command, sub_command);
89
 
      }
90
 
 
91
 
    command_set_name (command, sub_command->name);
92
 
    subcommand_end ();
93
 
 
94
 
    command_execute (command);
95
 
 
96
 
    g_list_foreach (list, (GFunc) gtk_tree_path_free, NULL);
97
 
    g_list_free (list);
98
 
 
99
 
    set_buttons (data);
 
73
        Command_t *command, *sub_command;
 
74
        GtkTreeModel *model;
 
75
        GList *list, *selected_rows;
 
76
 
 
77
        selected_rows = gtk_tree_selection_get_selected_rows (selection,
 
78
                                                              &model);
 
79
 
 
80
        command = subcommand_start (NULL);
 
81
        sub_command = unselect_all_command_new (data->object_list, NULL);
 
82
        command_add_subcommand (command, sub_command);
 
83
 
 
84
        for (list = selected_rows; list; list = list->next)
 
85
          {
 
86
            Object_t *obj;
 
87
            GtkTreeIter iter;
 
88
            GtkTreePath *path = (GtkTreePath*) list->data;
 
89
 
 
90
            gtk_tree_model_get_iter (model, &iter, path);
 
91
            gtk_tree_model_get (model, &iter, 0, &obj, -1);
 
92
 
 
93
            sub_command = select_command_new (obj);
 
94
            command_add_subcommand (command, sub_command);
 
95
          }
 
96
 
 
97
        command_set_name (command, sub_command->name);
 
98
        subcommand_end ();
 
99
 
 
100
        command_execute (command);
 
101
 
 
102
        g_list_foreach (selected_rows, (GFunc) gtk_tree_path_free, NULL);
 
103
        g_list_free (selected_rows);
 
104
 
 
105
        set_buttons (data);
100
106
  }
101
107
}
102
108
 
138
144
}
139
145
 
140
146
static void
141
 
selection_command(GtkWidget *widget, gpointer data)
142
 
{
143
 
  CommandFactory_t *factory = (CommandFactory_t*) data;
144
 
  Command_t *command = (*factory)();
145
 
  command_execute(command);
146
 
}
147
 
 
148
 
static GtkWidget*
149
 
make_selection_toolbar(Selection_t *data)
150
 
{
151
 
  GtkWidget *toolbar;
152
 
 
153
 
  toolbar = gtk_toolbar_new();
154
 
  gtk_toolbar_set_style(GTK_TOOLBAR(toolbar), GTK_TOOLBAR_ICONS);
155
 
  gtk_toolbar_set_orientation(GTK_TOOLBAR(toolbar), GTK_ORIENTATION_VERTICAL);
156
 
  gtk_container_set_border_width(GTK_CONTAINER(toolbar), 0);
157
 
 
158
 
  data->arrow_up = make_toolbar_stock_icon(toolbar, GTK_STOCK_GO_UP,
159
 
                                           "MoveUp", _("Move Up"),
160
 
                                           selection_command,
161
 
                                           &data->cmd_move_up);
162
 
  data->arrow_down = make_toolbar_stock_icon(toolbar, GTK_STOCK_GO_DOWN,
163
 
                                             "MoveDown", _("Move Down"),
164
 
                                             selection_command,
165
 
                                             &data->cmd_move_down);
166
 
  toolbar_add_space(toolbar);
167
 
  data->edit = make_toolbar_stock_icon(toolbar, GTK_STOCK_PROPERTIES,
168
 
                                       "Edit", _("Edit"), selection_command,
169
 
                                       &data->cmd_edit);
170
 
  toolbar_add_space(toolbar);
171
 
  data->remove = make_toolbar_stock_icon(toolbar, GTK_STOCK_DELETE, "Delete",
172
 
                                         _("Delete"), selection_command,
173
 
                                         &data->cmd_delete);
174
 
 
175
 
  gtk_widget_show(toolbar);
176
 
 
177
 
  return toolbar;
178
 
}
179
 
 
180
 
static void
181
147
selection_set_selected(Selection_t *selection, gint row)
182
148
{
183
149
  GtkTreeIter iter;
313
279
        Object_t *obj = selection_get_object (model, &iter);
314
280
        if (!obj->locked) {
315
281
          command_list_add(edit_object_command_new (obj));
316
 
          object_set_url (obj, data->data);
 
282
          object_set_url (obj, (const gchar *) data->data);
317
283
          object_emit_update_signal (obj);
318
284
          success = TRUE;
319
285
        }
329
295
              GtkTreeModel *tree_model, GtkTreeIter *iter, gpointer data)
330
296
{
331
297
  Object_t *obj = selection_get_object (tree_model, iter);
332
 
  g_object_set(cell, "stock-id", obj->class->get_stock_icon_name(), NULL);
 
298
  g_object_set(cell, "stock-id", object_get_stock_icon_name(obj), NULL);
333
299
}
334
300
 
335
301
static void
393
359
  gtk_container_add(GTK_CONTAINER(frame), hbox);
394
360
  gtk_widget_show(hbox);
395
361
 
396
 
  toolbar = make_selection_toolbar(data);
 
362
  toolbar = make_selection_toolbar();
397
363
  gtk_container_add(GTK_CONTAINER(hbox), toolbar);
398
364
 
399
365
  /* Create selection */
472
438
 
473
439
  /* For handling doubleclick */
474
440
 
475
 
  g_signal_connect (list, "button_press_event",
 
441
  g_signal_connect (list, "button-press-event",
476
442
                    G_CALLBACK(button_press_cb), data);
477
 
  g_signal_connect (list, "button_release_event",
 
443
  g_signal_connect (list, "button-release-event",
478
444
                    G_CALLBACK(button_release_cb), data);
479
445
 
480
446
  /* Callbacks we are interested in */