Ejemplo n.º 1
0
/* Match and replace property values. */
static gboolean
_replace (DiaObject *obj, const SearchData *sd, const char *replacement)
{
  ObjectChange *obj_change;
  GPtrArray *plist = NULL;

  plist = _match_props (obj, sd, replacement);
  if (!plist)
    return FALSE;

  /* Refresh screen and free the list of modified properties. */
  obj_change = object_apply_props (obj, plist);
  prop_list_free (plist);

  if (obj_change)
    undo_object_change(sd->diagram, obj, obj_change);
    
  object_add_updates(obj, sd->diagram);
  diagram_update_connections_object(sd->diagram, obj, TRUE);
  diagram_modified(sd->diagram);
  diagram_object_modified(sd->diagram, obj);
  diagram_update_extents(sd->diagram);
  diagram_flush(sd->diagram);
  
  return TRUE;
}
Ejemplo n.º 2
0
static gint
properties_respond(GtkWidget *widget,
                   gint       response_id,
                   gpointer   data)
{
  ObjectChange *obj_change = NULL;
  gboolean set_tp = TRUE;
  GList *tmp;

  if (   response_id == GTK_RESPONSE_APPLY
      || response_id == GTK_RESPONSE_OK) {
    if ((current_objects != NULL) && (current_dia != NULL)) {
      object_add_updates_list(current_objects, current_dia);

      for (tmp = current_objects; tmp != NULL; tmp = tmp->next) {
	DiaObject *current_obj = (DiaObject*)tmp->data;
	obj_change = current_obj->ops->apply_properties_from_dialog(current_obj, object_part);
	object_add_updates(current_obj, current_dia);
	diagram_update_connections_object(current_dia, current_obj, TRUE);

	if (obj_change != NULL) {
	  undo_object_change(current_dia, current_obj, obj_change);
	  set_tp = set_tp && TRUE;
	} else
	  set_tp = FALSE;

	diagram_object_modified(current_dia, current_obj);
      }

      diagram_modified(current_dia);
      diagram_update_extents(current_dia);

      if (set_tp) {
	undo_set_transactionpoint(current_dia->undo);
      }  else {
	message_warning(_("This object doesn't support Undo/Redo.\n"
  			"Undo information erased."));
	undo_clear(current_dia->undo);
      }

      diagram_flush(current_dia);
    }
  }

  if (response_id != GTK_RESPONSE_APPLY) {
#ifdef G_OS_WIN32
    /* on windows we are not hiding the dialog, because shrinking when hidden does
     * not work (the dialog shows up with the same size as before, bug #333751) */
    gtk_widget_destroy (dialog);
#else
    properties_dialog_hide();
#endif
  }

  return 0;
}