Exemple #1
0
void
rig_selection_tool_set_active(rig_selection_tool_t *tool, bool active)
{
    rig_editor_t *editor = rig_engine_get_editor(tool->view->engine);
    rig_objects_selection_t *selection =
        rig_editor_get_objects_selection(editor);
    c_llist_t *l;

    if (tool->active == active)
        return;

    tool->active = active;

    if (active) {
        tool->objects_selection_closure =
            rig_objects_selection_add_event_callback(selection,
                                                     objects_selection_event_cb,
                                                     tool,
                                                     NULL); /* destroy notify */

        for (l = selection->objects; l; l = l->next) {
            objects_selection_event_cb(
                selection, RIG_OBJECTS_SELECTION_ADD_EVENT, l->data, tool);
        }
    } else {
        for (l = selection->objects; l; l = l->next) {
            objects_selection_event_cb(
                selection, RIG_OBJECTS_SELECTION_REMOVE_EVENT, l->data, tool);
        }

        rut_closure_disconnect_FIXME(tool->objects_selection_closure);
        tool->objects_selection_closure = NULL;
    }
}
Exemple #2
0
void
rig_selection_tool_set_active (RigSelectionTool *tool,
                               bool active)
{
  RigObjectsSelection *selection = tool->view->engine->objects_selection;
  GList *l;

  if (tool->active == active)
    return;

  tool->active = active;

  if (active)
    {
      tool->objects_selection_closure =
        rig_objects_selection_add_event_callback (selection,
                                                  objects_selection_event_cb,
                                                  tool,
                                                  NULL); /* destroy notify */

      for (l = selection->objects; l; l = l->next)
        {
          objects_selection_event_cb (selection,
                                      RIG_OBJECTS_SELECTION_ADD_EVENT,
                                      l->data,
                                      tool);
        }
    }
  else
    {
      for (l = selection->objects; l; l = l->next)
        {
          objects_selection_event_cb (selection,
                                      RIG_OBJECTS_SELECTION_REMOVE_EVENT,
                                      l->data,
                                      tool);
        }

      rut_closure_disconnect (tool->objects_selection_closure);
      tool->objects_selection_closure = NULL;
    }
}