Esempio n. 1
0
static void
remove_one_object(Object_t *obj, gpointer data)
{
   CutCommand_t *command = (CutCommand_t*) data;
   command_add_subcommand(&command->parent,
                          delete_command_new(command->list, obj));
}
Esempio n. 2
0
static void
changed_cb(GtkTreeSelection *selection, gpointer param)
{
  Selection_t *data = (Selection_t*) param;

  if (data->select_lock)
    {
      data->select_lock = FALSE;
    } else
      {
        Command_t *command, *sub_command;
        GtkTreeModel *model;
        GList *list, *selected_rows;

        selected_rows = gtk_tree_selection_get_selected_rows (selection,
                                                              &model);

        command = subcommand_start (NULL);
        sub_command = unselect_all_command_new (data->object_list, NULL);
        command_add_subcommand (command, sub_command);

        for (list = selected_rows; list; list = list->next)
          {
            Object_t *obj;
            GtkTreeIter iter;
            GtkTreePath *path = (GtkTreePath*) list->data;

            gtk_tree_model_get_iter (model, &iter, path);
            gtk_tree_model_get (model, &iter, 0, &obj, -1);

            sub_command = select_command_new (obj);
            command_add_subcommand (command, sub_command);
          }

        command_set_name (command, sub_command->name);
        subcommand_end ();

        command_execute (command);

        g_list_foreach (selected_rows, (GFunc) gtk_tree_path_free, NULL);
        g_list_free (selected_rows);

        set_buttons (data);
  }
}
Esempio n. 3
0
static void
select_one_object(Object_t *obj, gpointer data)
{
   SelectNextCommand_t *command = (SelectNextCommand_t*) data;
   Command_t *sub_command;

   sub_command = (obj->selected)
      ? select_command_new(obj) : unselect_command_new(obj);
   command_add_subcommand(&command->parent, sub_command);
}
Esempio n. 4
0
static void
move_down_one_object(Object_t *obj, gpointer data)
{
   MoveDownCommand_t *command = (MoveDownCommand_t*) data;

   if (command->add) {
      command_add_subcommand(&command->parent,
                             object_down_command_new(command->list, obj));
      command->add = FALSE;
   }
   else {
      command->add = TRUE;
   }
}
Esempio n. 5
0
Command_t*
select_region_command_new(GtkWidget *widget, ObjectList_t *list, gint x,
                          gint y)
{
   SelectRegionCommand_t *command = g_new(SelectRegionCommand_t, 1);
   Command_t *sub_command;

   command->widget = widget;
   command->list = list;
   command->x = x;
   command->y = y;
   (void) command_init(&command->parent, _("Select Region"),
                       &select_region_command_class);

   sub_command = unselect_all_command_new(list, NULL);
   command_add_subcommand(&command->parent, sub_command);
   command->unselect_command = sub_command;

   return &command->parent;
}
Esempio n. 6
0
static void
select_one_object(Object_t *obj, gpointer data)
{
   SelectRegionCommand_t *command = (SelectRegionCommand_t*) data;
   command_add_subcommand(&command->parent, select_command_new(obj));
}