Ejemplo n.º 1
0
static void
modify_double_click(ModifyTool *tool, GdkEventButton *event,
		    DDisplay *ddisp)
{
  Point clickedpoint;
  DiaObject *clicked_obj;

  ddisplay_untransform_coords(ddisp,
			      (int)event->x, (int)event->y,
			      &clickedpoint.x, &clickedpoint.y);

  clicked_obj = click_select_object(ddisp, &clickedpoint, event);

  if ( clicked_obj != NULL ) {
    object_list_properties_show(ddisp->diagram, ddisp->diagram->data->selected);
  } else { /* No object selected */
    /*printf("didn't select object\n");*/
    if (!(event->state & GDK_SHIFT_MASK)) {
      /* Not Multi-select => Remove all selected */
      ddisplay_do_update_menu_sensitivity(ddisp);
      diagram_remove_all_selected(ddisp->diagram, TRUE);
      diagram_flush(ddisp->diagram);
    }
  }
}
Ejemplo n.º 2
0
void
object_properties_show(Diagram *dia, DiaObject *obj)
{
  GList *tmp = NULL;
  tmp = g_list_append(tmp, obj);
  object_list_properties_show(dia, tmp);
  g_list_free(tmp);
}
Ejemplo n.º 3
0
void
properties_hide_if_shown(Diagram *dia, DiaObject *obj)
{
  if (g_list_find(current_objects, obj)) {
    if (g_list_length(current_objects) == 1)
      /* If obj is the only object shown, then we hide the dialog. */
      properties_dialog_hide();
    else {
      /* else we remove this object and recreate the dialog. */
      GList *tmp = g_list_copy(current_objects);
      tmp = g_list_remove(tmp, obj);
      object_list_properties_show(dia, tmp);
      g_list_free(tmp);
    }
  }
}
Ejemplo n.º 4
0
static void
_dtv_showprops_item (GtkAction *action,
                     DiagramTreeView *dtv)
{
  GList *selected = NULL;
  GtkTreeSelection *selection;
  GtkTreeModel     *model;
  GList            *rows, *r;
  Diagram          *diagram = NULL;

  selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (dtv));
  rows = gtk_tree_selection_get_selected_rows (selection, &model);
  r = rows;
  while (r) {
    GtkTreeIter     iter;

    if (gtk_tree_model_get_iter (model, &iter, r->data)) {
      DiaObject *object;
      Diagram   *current_diagram;

      gtk_tree_model_get (model, &iter, DIAGRAM_COLUMN, &current_diagram, -1);
      gtk_tree_model_get (model, &iter, OBJECT_COLUMN, &object, -1);
      if (object)
        selected = g_list_append (selected, object);
      if (!diagram) /* keep the reference */
        diagram = current_diagram;
      else if (diagram == current_diagram) /* still the same */
        g_object_unref (current_diagram);
      else {
        g_object_unref (current_diagram);
	break; /* can only handle one diagram's objects */
      } 
    }
    r = g_list_next (r);
  }

  if (diagram && selected)
    object_list_properties_show (diagram, selected);
  else if (diagram)
    diagram_properties_show(diagram);
  if (diagram)
    g_object_unref(diagram);

  g_list_foreach (rows, (GFunc) gtk_tree_path_free, NULL);
  g_list_free (rows);
}
Ejemplo n.º 5
0
/** Give focus to the first focusable widget found in `widget'.
 * @param widget Some (possibly composite) widget.
 */
static void
properties_give_focus(GtkWidget *widget, gpointer data)
{
#if GTK_CHECK_VERSION(2,20,0)
  if (gtk_widget_get_can_focus(widget)) {
#else
  if (GTK_WIDGET_CAN_FOCUS(widget)) {
#endif
    gtk_widget_grab_focus(widget);
  } else {
    if (GTK_IS_CONTAINER(widget)) {
      gtk_container_foreach(GTK_CONTAINER(widget), properties_give_focus, data);
    }
  }
}

static void
clear_dialog_globals()
{
  if (object_part != NULL) {
    gtk_container_remove(GTK_CONTAINER(dialog_vbox), object_part);
    object_part = NULL;
  }
  g_list_free(current_objects);
  current_objects = NULL;
  current_dia = NULL;
}

void
object_properties_show(Diagram *dia, DiaObject *obj)
{
  GList *tmp = NULL;
  tmp = g_list_append(tmp, obj);
  object_list_properties_show(dia, tmp);
  g_list_free(tmp);
}