[dia/dia-next: 57/59] Rename DDisplay to DiaDisplay, inherit GObject
- From: Zander <zbrown src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dia/dia-next: 57/59] Rename DDisplay to DiaDisplay, inherit GObject
- Date: Wed, 9 Jan 2019 18:39:05 +0000 (UTC)
commit a4130256e4aba007e1a79d3fc90005bf74a66717
Author: Zander Brown <zbrown gnome org>
Date: Wed Jan 9 12:13:06 2019 +0000
Rename DDisplay to DiaDisplay, inherit GObject
Eventually this should probably be a GtkWidget (such as a GtkGrid)
app/app_procs.c | 10 +-
app/commands.c | 240 +++++++-------
app/connectionpoint_ops.c | 22 +-
app/connectionpoint_ops.h | 4 +-
app/cursor.c | 2 +-
app/dia-application.c | 6 +-
app/dia-canvas.c | 74 +++--
app/dia-canvas.h | 4 +-
app/dia-props.c | 8 +-
app/dia.def | 30 +-
app/diagram.c | 56 ++--
app/diagram_tree_view.c | 12 +-
app/disp_callbacks.c | 208 ++++++------
app/disp_callbacks.h | 29 +-
app/display.c | 593 ++++++++++++++++++----------------
app/display.h | 134 ++++----
app/filedlg.c | 24 +-
app/filedlg.h | 2 +-
app/find-and-replace.c | 14 +-
app/grid.c | 70 ++--
app/grid.h | 8 +-
app/handle_ops.c | 10 +-
app/handle_ops.h | 4 +-
app/interface.c | 110 +++----
app/interface.h | 4 +-
app/layer_dialog.c | 12 +-
app/load_save.c | 2 +-
app/menus.c | 16 +-
app/navigation.c | 11 +-
app/navigation.h | 2 +-
app/object_ops.c | 6 +-
app/object_ops.h | 4 +-
app/pagesetup.c | 2 +-
app/preferences.c | 2 +-
app/properties-dialog.c | 2 +-
app/recent_files.c | 2 +-
app/ruler.c | 16 +-
app/ruler.h | 16 +-
app/select.c | 26 +-
app/textedit.c | 46 +--
app/textedit.h | 10 +-
app/toolbox.c | 1 -
app/tools/create_object.c | 106 +++---
app/tools/magnify.c | 42 +--
app/tools/modify_tool.c | 274 ++++++++--------
app/tools/scroll_tool.c | 52 +--
app/tools/textedit_tool.c | 42 +--
app/tools/tool.c | 20 +-
app/tools/tool.h | 20 +-
app/undo.c | 2 +-
objects/UML/class_dialog.c | 4 +-
objects/UML/class_operations_dialog.c | 2 +
objects/UML/dia-uml-parameter.h | 2 +-
plug-ins/python/diamodule.c | 16 +-
plug-ins/python/pydia-diagram.c | 13 +-
plug-ins/python/pydia-display.c | 136 ++++----
plug-ins/python/pydia-display.h | 4 +-
57 files changed, 1304 insertions(+), 1285 deletions(-)
---
diff --git a/app/app_procs.c b/app/app_procs.c
index 134122e1..3af6c914 100644
--- a/app/app_procs.c
+++ b/app/app_procs.c
@@ -503,9 +503,9 @@ handle_initial_diagram(const char *in_file_name,
if (diagram != NULL) {
diagram_update_extents(diagram);
if (app_is_interactive()) {
- layer_dialog_set_diagram(diagram);
+ layer_dialog_set_diagram(diagram);
/* the display initial diagram holds two references */
- new_display(diagram);
+ dia_display_new (diagram);
} else {
g_object_unref(diagram);
}
@@ -773,7 +773,7 @@ app_init (int argc, char **argv)
/* Init cursors: */
default_cursor = gdk_cursor_new (GDK_LEFT_PTR);
- ddisplay_set_all_cursor (default_cursor);
+ dia_display_set_all_cursor (default_cursor);
}
dia_register_plugins ();
@@ -865,7 +865,7 @@ app_init (int argc, char **argv)
/* I think this is done in diagram_init() with a call to
* layer_dialog_update_diagram_list() */
layer_dialog_set_diagram(diagram);
- new_display(diagram);
+ dia_display_new (diagram);
}
}
}
@@ -1019,7 +1019,7 @@ app_exit(void)
slist = dia->displays;
while (slist!=NULL) {
- DDisplay *ddisp = (DDisplay *)slist->data;
+ DiaDisplay *ddisp = (DiaDisplay *)slist->data;
slist = g_slist_next(slist);
gtk_widget_destroy(ddisp->shell);
diff --git a/app/commands.c b/app/commands.c
index cb065e5b..7007d607 100644
--- a/app/commands.c
+++ b/app/commands.c
@@ -101,7 +101,7 @@ file_pagesetup_callback (GtkAction *action)
{
Diagram *dia;
- dia = ddisplay_active_diagram();
+ dia = dia_display_active_diagram();
if (!dia) return;
create_page_setup_dlg(dia);
}
@@ -110,12 +110,12 @@ void
file_print_callback (GtkAction *_action)
{
Diagram *dia;
- DDisplay *ddisp;
+ DiaDisplay *ddisp;
GtkAction *action;
- dia = ddisplay_active_diagram();
+ dia = dia_display_active_diagram();
if (!dia) return;
- ddisp = ddisplay_active();
+ ddisp = dia_display_active();
if (!ddisp) return;
action = menus_get_action ("FilePrintGTK");
@@ -136,8 +136,8 @@ void
file_close_callback (GtkAction *action)
{
/* some people use tear-off menus and insist to close non existing displays */
- if (ddisplay_active())
- ddisplay_close(ddisplay_active());
+ if (dia_display_active())
+ dia_display_close(dia_display_active());
}
void
@@ -150,7 +150,7 @@ file_new_callback (GtkAction *action)
name = g_strdup_printf(_("Diagram%d.dia"), untitled_nr++);
filename = g_filename_from_utf8(name, -1, NULL, NULL, NULL);
dia = new_diagram(filename);
- new_display(dia);
+ dia_display_new (dia);
dia_diagram_add (dia); /* notify DiagramTree etc. */
g_free (name);
g_free (filename);
@@ -171,7 +171,7 @@ file_preferences_callback (GtkAction *action)
*/
static void
-insert_text(DDisplay *ddisp, Focus *focus, const gchar *text)
+insert_text(DiaDisplay *ddisp, Focus *focus, const gchar *text)
{
ObjectChange *change = NULL;
int modified = FALSE, any_modified = FALSE;
@@ -217,7 +217,7 @@ received_clipboard_text_handler(GtkClipboard *clipboard,
const gchar *text,
gpointer data)
{
- DDisplay *ddisp = (DDisplay *)data;
+ DiaDisplay *ddisp = (DiaDisplay *)data;
Focus *focus = get_active_focus((DiagramData *) ddisp->diagram);
if (text == NULL) return;
@@ -236,11 +236,11 @@ received_clipboard_text_handler(GtkClipboard *clipboard,
* Callback for gtk_clipboard_request_image
*/
static void
-received_clipboard_image_handler(GtkClipboard *clipboard,
- GdkPixbuf *pixbuf,
- gpointer data)
+received_clipboard_image_handler (GtkClipboard *clipboard,
+ GdkPixbuf *pixbuf,
+ gpointer data)
{
- DDisplay *ddisp = (DDisplay *)data;
+ DiaDisplay *ddisp = (DiaDisplay *)data;
Diagram *dia = ddisp->diagram;
GList *list = dia->data->selected;
ObjectChange *change = NULL;
@@ -274,7 +274,7 @@ received_clipboard_image_handler(GtkClipboard *clipboard,
Handle *handle2;
DiaObject *obj;
- pt = ddisplay_get_clicked_position(ddisp);
+ pt = dia_display_get_clicked_position (ddisp);
snap_to_grid(ddisp, &pt.x, &pt.y);
if ( ((type = object_get_type ("Standard - Image")) != NULL)
@@ -294,7 +294,7 @@ received_clipboard_image_handler(GtkClipboard *clipboard,
diagram_select(dia, obj);
object_add_updates(obj, dia);
- ddisplay_do_update_menu_sensitivity(ddisp);
+ dia_display_do_update_menu_sensitivity (disp);
diagram_flush(dia);
} else {
message_warning (_("No selected object can take an image."));
@@ -313,7 +313,7 @@ received_clipboard_content_handler (GtkClipboard *clipboard,
GtkSelectionData *selection_data,
gpointer user_data)
{
- DDisplay *ddisp = (DDisplay *)user_data;
+ DiaDisplay *ddisp = (DiaDisplay *)user_data;
GdkAtom type_atom;
gchar *type_name;
gint len;
@@ -362,12 +362,12 @@ void
edit_paste_image_callback (GtkAction *action)
{
GtkClipboard *clipboard = gtk_clipboard_get(GDK_NONE);
- DDisplay *ddisp;
+ DiaDisplay *ddisp;
GdkAtom *targets;
gint n_targets;
gboolean done = FALSE;
- ddisp = ddisplay_active();
+ ddisp = dia_display_active();
if (!ddisp) return;
if (gtk_clipboard_wait_for_targets (clipboard, &targets, &n_targets)) {
@@ -525,9 +525,9 @@ void
edit_copy_callback (GtkAction *action)
{
GList *copy_list;
- DDisplay *ddisp;
+ DiaDisplay *ddisp;
- ddisp = ddisplay_active();
+ ddisp = dia_display_active();
if (!ddisp) return;
if (textedit_mode(ddisp)) {
@@ -577,7 +577,7 @@ edit_copy_callback (GtkAction *action)
cnp_store_objects(object_copy_list(copy_list), 1);
g_list_free(copy_list);
- ddisplay_do_update_menu_sensitivity(ddisp);
+ dia_display_do_update_menu_sensitivity (ddisp);
}
}
@@ -585,10 +585,10 @@ void
edit_cut_callback (GtkAction *action)
{
GList *cut_list;
- DDisplay *ddisp;
+ DiaDisplay *ddisp;
Change *change;
- ddisp = ddisplay_active();
+ ddisp = dia_display_active ();
if (!ddisp) return;
if (textedit_mode(ddisp)) {
@@ -602,7 +602,7 @@ edit_cut_callback (GtkAction *action)
change = undo_delete_objects_children(ddisp->diagram, cut_list);
(change->apply)(change, ddisp->diagram);
- ddisplay_do_update_menu_sensitivity(ddisp);
+ dia_display_do_update_menu_sensitivity (ddisp);
diagram_flush(ddisp->diagram);
diagram_modified(ddisp->diagram);
@@ -615,13 +615,13 @@ void
edit_paste_callback (GtkAction *action)
{
GList *paste_list;
- DDisplay *ddisp;
+ DiaDisplay *ddisp;
Point paste_corner;
Point delta;
Change *change;
int generation = 0;
- ddisp = ddisplay_active();
+ ddisp = dia_display_active();
if (!ddisp) return;
if (textedit_mode(ddisp)) {
#ifndef GDK_WINDOWING_X11
@@ -678,11 +678,11 @@ void
edit_duplicate_callback (GtkAction *action)
{
GList *duplicate_list;
- DDisplay *ddisp;
+ DiaDisplay *ddisp;
Point delta;
Change *change;
- ddisp = ddisplay_active();
+ ddisp = dia_display_active ();
if (!ddisp || textedit_mode(ddisp)) return;
duplicate_list = object_copy_list(diagram_get_sorted_selected(ddisp->diagram));
@@ -703,13 +703,13 @@ edit_duplicate_callback (GtkAction *action)
diagram_flush(ddisp->diagram);
- ddisplay_do_update_menu_sensitivity(ddisp);
+ dia_display_do_update_menu_sensitivity (ddisp);
}
void
objects_move_up_layer(GtkAction *action)
{
- DDisplay *ddisp = ddisplay_active();
+ DiaDisplay *ddisp = dia_display_active ();
GList *selected_list;
Change *change;
@@ -725,13 +725,13 @@ objects_move_up_layer(GtkAction *action)
diagram_flush(ddisp->diagram);
- ddisplay_do_update_menu_sensitivity(ddisp);
+ dia_display_do_update_menu_sensitivity (ddisp);
}
void
objects_move_down_layer(GtkAction *action)
{
- DDisplay *ddisp = ddisplay_active();
+ DiaDisplay *ddisp = dia_display_active ();
GList *selected_list;
Change *change;
@@ -749,14 +749,14 @@ objects_move_down_layer(GtkAction *action)
diagram_flush(ddisp->diagram);
- ddisplay_do_update_menu_sensitivity(ddisp);
+ dia_display_do_update_menu_sensitivity (ddisp);
}
void
edit_copy_text_callback (GtkAction *action)
{
Focus *focus;
- DDisplay *ddisp = ddisplay_active();
+ DiaDisplay *ddisp = dia_display_active ();
DiaObject *obj;
GPtrArray *textprops;
TextProperty *prop;
@@ -793,13 +793,13 @@ void
edit_cut_text_callback (GtkAction *action)
{
Focus *focus;
- DDisplay *ddisp;
+ DiaDisplay *ddisp;
DiaObject *obj;
GPtrArray *textprops;
TextProperty *prop;
ObjectChange *change;
- ddisp = ddisplay_active();
+ ddisp = dia_display_active ();
if (!ddisp) return;
focus = get_active_focus((DiagramData *) ddisp->diagram);
@@ -839,9 +839,9 @@ edit_cut_text_callback (GtkAction *action)
void
edit_paste_text_callback (GtkAction *action)
{
- DDisplay *ddisp;
+ DiaDisplay *ddisp;
- ddisp = ddisplay_active();
+ ddisp = dia_display_active ();
if (!ddisp) return;
#ifndef GDK_WINDOWING_X11
@@ -857,7 +857,7 @@ void
edit_delete_callback (GtkAction *action)
{
GList *delete_list;
- DDisplay *ddisp;
+ DiaDisplay *ddisp;
/* Avoid crashing while moving or resizing and deleting ... */
if (gdk_pointer_is_grabbed ()) {
@@ -865,7 +865,7 @@ edit_delete_callback (GtkAction *action)
return;
}
- ddisp = ddisplay_active();
+ ddisp = dia_display_active ();
if (!ddisp) return;
if (textedit_mode(ddisp)) {
ObjectChange *change = NULL;
@@ -886,7 +886,7 @@ edit_delete_callback (GtkAction *action)
diagram_modified(ddisp->diagram);
diagram_update_extents(ddisp->diagram);
- ddisplay_do_update_menu_sensitivity(ddisp);
+ dia_display_do_update_menu_sensitivity (ddisp);
diagram_flush(ddisp->diagram);
undo_set_transactionpoint(ddisp->diagram->undo);
@@ -897,7 +897,7 @@ edit_undo_callback (GtkAction *action)
{
Diagram *dia;
- dia = ddisplay_active_diagram();
+ dia = dia_display_active_diagram ();
if (!dia) return;
/* Handle text undo edit here! */
@@ -914,7 +914,7 @@ edit_redo_callback (GtkAction *action)
Diagram *dia;
/* Handle text undo edit here! */
- dia = ddisplay_active_diagram();
+ dia = dia_display_active_diagram ();
if (!dia) return;
undo_apply_to_next_tp(dia->undo);
@@ -933,8 +933,8 @@ help_manual_callback (GtkAction *action)
const char *dentry;
GError *error = NULL;
GdkScreen *screen;
- DDisplay *ddisp;
- ddisp = ddisplay_active();
+ DiaDisplay *ddisp;
+ ddisp = dia_display_active ();
screen = ddisp ? gtk_widget_get_screen (GTK_WIDGET(ddisp->shell))
: gdk_screen_get_default ();
if (gtk_show_uri(screen, "ghelp:dia", gtk_get_current_event_time (), NULL)) {
@@ -1060,23 +1060,23 @@ help_about_callback (GtkAction *action)
void
view_zoom_in_callback (GtkAction *action)
{
- DDisplay *ddisp;
+ DiaDisplay *ddisp;
- ddisp = ddisplay_active();
+ ddisp = dia_display_active ();
if (!ddisp) return;
- ddisplay_zoom_middle(ddisp, M_SQRT2);
+ dia_display_zoom_middle (ddisp, M_SQRT2);
}
void
view_zoom_out_callback (GtkAction *action)
{
- DDisplay *ddisp;
+ DiaDisplay *ddisp;
- ddisp = ddisplay_active();
+ ddisp = dia_display_active ();
if (!ddisp) return;
- ddisplay_zoom_middle(ddisp, M_SQRT1_2);
+ dia_display_zoom_middle (ddisp, M_SQRT1_2);
}
void
@@ -1091,28 +1091,28 @@ view_zoom_set_callback (GtkAction *action)
void
view_show_cx_pts_callback (GtkToggleAction *action)
{
- DDisplay *ddisp;
+ DiaDisplay *ddisp;
int old_val;
- ddisp = ddisplay_active();
+ ddisp = dia_display_active ();
if (!ddisp) return;
old_val = ddisp->show_cx_pts;
ddisp->show_cx_pts = gtk_toggle_action_get_active (action);
if (old_val != ddisp->show_cx_pts) {
- ddisplay_add_update_all(ddisp);
- ddisplay_flush(ddisp);
+ dia_display_add_update_all (ddisp);
+ dia_display_flush (ddisp);
}
}
void
view_unfullscreen (void)
{
- DDisplay *ddisp;
+ DiaDisplay *ddisp;
GtkToggleAction *item;
- ddisp = ddisplay_active();
+ ddisp = dia_display_active ();
if (!ddisp) return;
/* find the menuitem */
@@ -1125,10 +1125,10 @@ view_unfullscreen (void)
void
view_fullscreen_callback (GtkToggleAction *action)
{
- DDisplay *ddisp;
+ DiaDisplay *ddisp;
int fs;
- ddisp = ddisplay_active();
+ ddisp = dia_display_active ();
if (!ddisp) return;
fs = gtk_toggle_action_get_active (action);
@@ -1142,67 +1142,67 @@ view_fullscreen_callback (GtkToggleAction *action)
void
view_aa_callback (GtkToggleAction *action)
{
- DDisplay *ddisp;
+ DiaDisplay *ddisp;
int aa;
- ddisp = ddisplay_active();
+ ddisp = dia_display_active ();
if (!ddisp) return;
aa = gtk_toggle_action_get_active (action);
if (aa != ddisp->aa_renderer) {
- ddisplay_set_renderer(ddisp, aa);
- ddisplay_add_update_all(ddisp);
- ddisplay_flush(ddisp);
+ dia_display_set_renderer (ddisp, aa);
+ dia_display_add_update_all (ddisp);
+ dia_display_flush (ddisp);
}
}
void
view_visible_grid_callback (GtkToggleAction *action)
{
- DDisplay *ddisp;
+ DiaDisplay *ddisp;
guint old_val;
- ddisp = ddisplay_active();
+ ddisp = dia_display_active ();
if (!ddisp) return;
old_val = ddisp->grid.visible;
ddisp->grid.visible = gtk_toggle_action_get_active (action);
if (old_val != ddisp->grid.visible) {
- ddisplay_add_update_all(ddisp);
- ddisplay_flush(ddisp);
+ dia_display_add_update_all (ddisp);
+ dia_display_flush (ddisp);
}
}
void
view_snap_to_grid_callback (GtkToggleAction *action)
{
- DDisplay *ddisp;
+ DiaDisplay *ddisp;
- ddisp = ddisplay_active();
+ ddisp = dia_display_active ();
if (!ddisp) return;
- ddisplay_set_snap_to_grid(ddisp, gtk_toggle_action_get_active (action));
+ dia_display_set_snap_to_grid (ddisp, gtk_toggle_action_get_active (action));
}
void
view_snap_to_objects_callback (GtkToggleAction *action)
{
- DDisplay *ddisp;
+ DiaDisplay *ddisp;
- ddisp = ddisplay_active();
+ ddisp = dia_display_active ();
if (!ddisp) return;
- ddisplay_set_snap_to_objects(ddisp, gtk_toggle_action_get_active (action));
+ dia_display_set_snap_to_objects (ddisp, gtk_toggle_action_get_active (action));
}
void
view_toggle_rulers_callback (GtkToggleAction *action)
{
- DDisplay *ddisp;
+ DiaDisplay *ddisp;
- ddisp = ddisplay_active();
+ ddisp = dia_display_active ();
if (!ddisp) return;
if (!gtk_toggle_action_get_active (action)) {
@@ -1219,9 +1219,9 @@ view_toggle_rulers_callback (GtkToggleAction *action)
void
view_toggle_scrollbars_callback (GtkToggleAction *action)
{
- DDisplay *ddisp;
+ DiaDisplay *ddisp;
- ddisp = ddisplay_active();
+ ddisp = dia_display_active ();
if (!ddisp) return;
if (gtk_toggle_action_get_active (action)) {
@@ -1237,50 +1237,50 @@ view_new_view_callback (GtkAction *action)
{
Diagram *dia;
- dia = ddisplay_active_diagram();
+ dia = dia_display_active_diagram ();
if (!dia) return;
- new_display(dia);
+ dia_display_new (dia);
}
extern void
view_clone_view_callback (GtkAction *action)
{
- DDisplay *ddisp;
+ DiaDisplay *ddisp;
- ddisp = ddisplay_active();
+ ddisp = dia_display_active ();
if (!ddisp) return;
- copy_display(ddisp);
+ dia_display_copy (ddisp);
}
void
view_show_all_callback (GtkAction *action)
{
- DDisplay *ddisp;
+ DiaDisplay *ddisp;
- ddisp = ddisplay_active();
+ ddisp = dia_display_active ();
if (!ddisp) return;
- ddisplay_show_all (ddisp);
+ dia_display_show_all (ddisp);
}
void
view_redraw_callback (GtkAction *action)
{
- DDisplay *ddisp;
- ddisp = ddisplay_active();
+ DiaDisplay *ddisp;
+ ddisp = dia_display_active ();
if (!ddisp) return;
- ddisplay_add_update_all(ddisp);
- ddisplay_flush(ddisp);
+ dia_display_add_update_all (ddisp);
+ dia_display_flush (ddisp);
}
void
view_diagram_properties_callback (GtkAction *action)
{
- DDisplay *ddisp;
+ DiaDisplay *ddisp;
- ddisp = ddisplay_active();
+ ddisp = dia_display_active ();
if (!ddisp) return;
diagram_properties_show(ddisp->diagram);
}
@@ -1308,7 +1308,7 @@ layers_add_layer_callback (GtkAction *action)
{
Diagram *dia;
- dia = ddisplay_active_diagram();
+ dia = dia_display_active_diagram ();
if (!dia) return;
diagram_edit_layer (dia, NULL);
@@ -1319,7 +1319,7 @@ layers_rename_layer_callback (GtkAction *action)
{
Diagram *dia;
- dia = ddisplay_active_diagram();
+ dia = dia_display_active_diagram ();
if (!dia) return;
diagram_edit_layer (dia, dia->data->active_layer);
@@ -1328,75 +1328,75 @@ layers_rename_layer_callback (GtkAction *action)
void
objects_place_over_callback (GtkAction *action)
{
- diagram_place_over_selected(ddisplay_active_diagram());
+ diagram_place_over_selected (dia_display_active_diagram());
}
void
objects_place_under_callback (GtkAction *action)
{
- diagram_place_under_selected(ddisplay_active_diagram());
+ diagram_place_under_selected (dia_display_active_diagram());
}
void
objects_place_up_callback (GtkAction *action)
{
- diagram_place_up_selected(ddisplay_active_diagram());
+ diagram_place_up_selected (dia_display_active_diagram());
}
void
objects_place_down_callback (GtkAction *action)
{
- DDisplay *ddisp = ddisplay_active();
+ DiaDisplay *ddisp = dia_display_active ();
if (!ddisp || textedit_mode(ddisp)) return;
- diagram_place_down_selected(ddisplay_active_diagram());
+ diagram_place_down_selected (dia_display_active_diagram());
}
void
objects_parent_callback (GtkAction *action)
{
- DDisplay *ddisp = ddisplay_active();
+ DiaDisplay *ddisp = dia_display_active ();
if (!ddisp || textedit_mode(ddisp)) return;
- diagram_parent_selected(ddisplay_active_diagram());
+ diagram_parent_selected (dia_display_active_diagram());
}
void
objects_unparent_callback (GtkAction *action)
{
- DDisplay *ddisp = ddisplay_active();
+ DiaDisplay *ddisp = dia_display_active ();
if (!ddisp || textedit_mode(ddisp)) return;
- diagram_unparent_selected(ddisplay_active_diagram());
+ diagram_unparent_selected (dia_display_active_diagram());
}
void
objects_unparent_children_callback (GtkAction *action)
{
- DDisplay *ddisp = ddisplay_active();
+ DiaDisplay *ddisp = dia_display_active ();
if (!ddisp || textedit_mode(ddisp)) return;
- diagram_unparent_children_selected(ddisplay_active_diagram());
+ diagram_unparent_children_selected (dia_display_active_diagram());
}
void
objects_group_callback (GtkAction *action)
{
- DDisplay *ddisp = ddisplay_active();
+ DiaDisplay *ddisp = dia_display_active ();
if (!ddisp || textedit_mode(ddisp)) return;
- diagram_group_selected(ddisplay_active_diagram());
- ddisplay_do_update_menu_sensitivity(ddisp);
+ diagram_group_selected (dia_display_active_diagram());
+ dia_display_do_update_menu_sensitivity (ddisp);
}
void
objects_ungroup_callback (GtkAction *action)
{
- DDisplay *ddisp = ddisplay_active();
+ DiaDisplay *ddisp = dia_display_active ();
if (!ddisp || textedit_mode(ddisp)) return;
- diagram_ungroup_selected(ddisplay_active_diagram());
- ddisplay_do_update_menu_sensitivity(ddisp);
+ diagram_ungroup_selected (dia_display_active_diagram());
+ dia_display_do_update_menu_sensitivity (ddisp);
}
void
@@ -1404,8 +1404,8 @@ dialogs_properties_callback (GtkAction *action)
{
Diagram *dia;
- dia = ddisplay_active_diagram();
- if (!dia || textedit_mode(ddisplay_active())) return;
+ dia = dia_display_active_diagram ();
+ if (!dia || textedit_mode(dia_display_active ())) return;
if (dia->data->selected != NULL) {
object_list_properties_show(dia, dia->data->selected);
@@ -1417,7 +1417,7 @@ dialogs_properties_callback (GtkAction *action)
void
dialogs_layers_callback (GtkAction *action)
{
- layer_dialog_set_diagram(ddisplay_active_diagram());
+ layer_dialog_set_diagram (dia_display_active_diagram());
layer_dialog_show();
}
@@ -1430,7 +1430,7 @@ objects_align_h_callback (GtkAction *action)
Diagram *dia;
GList *objects;
- DDisplay *ddisp = ddisplay_active();
+ DiaDisplay *ddisp = dia_display_active ();
if (!ddisp || textedit_mode(ddisp)) return;
/* HACK align is suffix to action name */
@@ -1455,7 +1455,7 @@ objects_align_h_callback (GtkAction *action)
return;
}
- dia = ddisplay_active_diagram();
+ dia = dia_display_active_diagram ();
if (!dia) return;
objects = dia->data->selected;
@@ -1477,7 +1477,7 @@ objects_align_v_callback (GtkAction *action)
Diagram *dia;
GList *objects;
- DDisplay *ddisp = ddisplay_active();
+ DiaDisplay *ddisp = dia_display_active ();
if (!ddisp || textedit_mode(ddisp)) return;
/* HACK align is suffix to action name */
@@ -1502,7 +1502,7 @@ objects_align_v_callback (GtkAction *action)
return;
}
- dia = ddisplay_active_diagram();
+ dia = dia_display_active_diagram ();
if (!dia) return;
objects = dia->data->selected;
@@ -1522,7 +1522,7 @@ objects_align_connected_callback (GtkAction *action)
Diagram *dia;
GList *objects;
- dia = ddisplay_active_diagram();
+ dia = dia_display_active_diagram ();
if (!dia) return;
objects = dia->data->selected;
@@ -1550,6 +1550,6 @@ dia_file_open (const gchar *filename,
if (diagram != NULL) {
diagram_update_extents(diagram);
layer_dialog_set_diagram(diagram);
- new_display(diagram);
+ dia_display_new (diagram);
}
}
diff --git a/app/connectionpoint_ops.c b/app/connectionpoint_ops.c
index 44173e36..3befb43e 100644
--- a/app/connectionpoint_ops.c
+++ b/app/connectionpoint_ops.c
@@ -32,16 +32,16 @@ static GdkRGBA connectionpoint_color = { 0.4, 0.4, 1.0, 1.0 };
#define CP_SZ (CONNECTIONPOINT_SIZE/2)
static void
-connectionpoint_draw(ConnectionPoint *conpoint,
- DDisplay *ddisp,
- DiaRenderer *renderer,
- DiaInteractiveRendererInterface *irenderer,
- GdkRGBA *color)
+connectionpoint_draw (ConnectionPoint *conpoint,
+ DiaDisplay *ddisp,
+ DiaRenderer *renderer,
+ DiaInteractiveRendererInterface *irenderer,
+ GdkRGBA *color)
{
int x,y;
Point *point = &conpoint->pos;
- ddisplay_transform_coords(ddisp, point->x, point->y, &x, &y);
+ dia_display_transform_coords (ddisp, point->x, point->y, &x, &y);
irenderer->draw_pixel_line (renderer,
x-CP_SZ,y-CP_SZ,
@@ -55,7 +55,7 @@ connectionpoint_draw(ConnectionPoint *conpoint,
}
void
-object_draw_connectionpoints(DiaObject *obj, DDisplay *ddisp)
+object_draw_connectionpoints (DiaObject *obj, DiaDisplay *ddisp)
{
int i;
static GdkRGBA midpoint_color = { 1.0, 0.0, 0.0, 1.0 };
@@ -75,8 +75,8 @@ object_draw_connectionpoints(DiaObject *obj, DDisplay *ddisp)
if (dia_object_get_num_connections(obj) > 1)
{
const Rectangle *bbox = dia_object_get_bounding_box (obj);
- real w = ddisplay_transform_length (ddisp, bbox->right - bbox->left);
- real h = ddisplay_transform_length (ddisp, bbox->bottom - bbox->top);
+ real w = dia_display_transform_length (ddisp, bbox->right - bbox->left);
+ real h = dia_display_transform_length (ddisp, bbox->bottom - bbox->top);
int n = dia_object_get_num_connections(obj);
/* just comparing the sizes is still drawing more CPs than useful - try 50% */
@@ -177,7 +177,7 @@ diagram_update_connections_object(Diagram *dia, DiaObject *obj,
}
void
-ddisplay_connect_selected(DDisplay *ddisp)
+dia_display_connect_selected (DiaDisplay *ddisp)
{
GList *list;
@@ -189,7 +189,7 @@ ddisplay_connect_selected(DDisplay *ddisp)
for (i=0; i<selected_obj->num_handles; i++) {
if (selected_obj->handles[i]->connect_type != HANDLE_NONCONNECTABLE) {
- object_connect_display(ddisp, selected_obj, selected_obj->handles[i], FALSE);
+ object_connect_display(ddisp, selected_obj, selected_obj->handles[i], FALSE);
}
}
diff --git a/app/connectionpoint_ops.h b/app/connectionpoint_ops.h
index df8c0d20..79d50096 100644
--- a/app/connectionpoint_ops.h
+++ b/app/connectionpoint_ops.h
@@ -24,13 +24,13 @@
G_BEGIN_DECLS
-void object_draw_connectionpoints(DiaObject *obj, DDisplay *ddisp);
+void object_draw_connectionpoints(DiaObject *obj, DiaDisplay *ddisp);
void connectionpoint_add_update(ConnectionPoint *conpoint,
Diagram *dia);
void diagram_update_connections_selection(Diagram *dia);
void diagram_update_connections_object(Diagram *dia, DiaObject *obj,
int update_nonmoved);
-void ddisplay_connect_selected(DDisplay *ddisp);
+void dia_display_connect_selected(DiaDisplay *ddisp);
void diagram_unconnect_selected(Diagram *dia);
G_END_DECLS
diff --git a/app/cursor.c b/app/cursor.c
index db266b6d..29d2abca 100644
--- a/app/cursor.c
+++ b/app/cursor.c
@@ -83,7 +83,7 @@ get_cursor(DiaCursorType ctype)
if (cursors[ctype].gdk_cursor_number != DIA_CURSOR) {
new_cursor = gdk_cursor_new(cursors[ctype].gdk_cursor_number);
} else {
- DDisplay *active_display = ddisplay_active ();
+ DiaDisplay *active_display = dia_display_active ();
if (active_display != NULL)
new_cursor = create_cursor(gtk_widget_get_window(active_display->canvas),
cursors[ctype].data,
diff --git a/app/dia-application.c b/app/dia-application.c
index cc9e422d..8ece9762 100644
--- a/app/dia-application.c
+++ b/app/dia-application.c
@@ -37,9 +37,9 @@ struct _DiaApplicationClass
void (*diagram_change) (DiaApplication *app, Diagram *diagram, guint flags);
void (*diagram_remove) (DiaApplication *app, Diagram *diagram);
- void (*display_add) (DiaApplication *app, DDisplay *display);
- void (*display_change) (DiaApplication *app, DDisplay *display, guint flags);
- void (*display_remove) (DiaApplication *app, DDisplay *display);
+ void (*display_add) (DiaApplication *app, DiaDisplay *display);
+ void (*display_change) (DiaApplication *app, DiaDisplay *display, guint flags);
+ void (*display_remove) (DiaApplication *app, DiaDisplay *display);
};
/**
diff --git a/app/dia-canvas.c b/app/dia-canvas.c
index d81ba334..c6ec17e7 100644
--- a/app/dia-canvas.c
+++ b/app/dia-canvas.c
@@ -11,39 +11,36 @@
typedef struct _DiaCanvasPrivate DiaCanvasPrivate;
struct _DiaCanvasPrivate {
- DDisplayBox *disp_box;
+ DiaDisplay *display;
};
G_DEFINE_TYPE_WITH_CODE (DiaCanvas, dia_canvas, GTK_TYPE_DRAWING_AREA,
G_ADD_PRIVATE (DiaCanvas))
enum {
- PROP_DDISPLAY = 1,
+ PROP_DISPLAY = 1,
N_PROPS
};
static GParamSpec* properties[N_PROPS];
-
GtkWidget *
-dia_canvas_new (DDisplay *ddisp)
+dia_canvas_new (DiaDisplay *ddisp)
{
return g_object_new (DIA_TYPE_CANVAS,
- "ddisplay", display_box_new (ddisp),
+ "display", ddisp,
NULL);
}
-DDisplay *
-dia_canvas_get_ddisplay (DiaCanvas *self)
+DiaDisplay *
+dia_canvas_get_display (DiaCanvas *self)
{
DiaCanvasPrivate *priv;
- DDisplayBox *box;
g_return_val_if_fail (self != NULL, NULL);
priv = dia_canvas_get_instance_private (DIA_CANVAS (self));
- box = priv->disp_box;
- return box->ddisp;
+ return priv->display;
}
static gboolean
@@ -71,13 +68,13 @@ dia_canvas_drag_data_received (GtkWidget *self,
guint info,
guint time)
{
- DDisplay *ddisp = dia_canvas_get_ddisplay (DIA_CANVAS (self));
+ DiaDisplay *ddisp = dia_canvas_get_display (DIA_CANVAS (self));
if (gtk_selection_data_get_format (data) == 8 &&
gtk_selection_data_get_length (data) == sizeof (ToolButtonData *) &&
gtk_drag_get_source_widget (context) != NULL) {
ToolButtonData *tooldata = *(ToolButtonData **) gtk_selection_data_get_data (data);
/* g_message("Tool drop %s at (%d, %d)", (gchar *)tooldata->extra_data, x, y);*/
- ddisplay_drop_object (ddisp, x, y,
+ dia_display_drop_object (ddisp, x, y,
object_get_type ((gchar *) tooldata->extra_data),
tooldata->user_data);
@@ -98,14 +95,14 @@ dia_canvas_size_allocate (GtkWidget *self,
GtkAllocation *alloc)
{
int width, height;
- DDisplay *ddisp = dia_canvas_get_ddisplay (DIA_CANVAS (self));
+ DiaDisplay *ddisp = dia_canvas_get_display (DIA_CANVAS (self));
if (ddisp->renderer) {
width = dia_renderer_get_width_pixels (ddisp->renderer);
height = dia_renderer_get_height_pixels (ddisp->renderer);
} else {
/* We can continue even without a renderer here because
- * ddisplay_resize_canvas () does the setup for us.
+ * dia_display_resize_canvas () does the setup for us.
*/
width = height = 0;
}
@@ -113,8 +110,8 @@ dia_canvas_size_allocate (GtkWidget *self,
/* Only do this when size is really changing */
if (width != alloc->width || height != alloc->height) {
g_message ("Canvas size change...");
- ddisplay_resize_canvas (ddisp, alloc->width, alloc->height);
- ddisplay_update_scrollbars(ddisp);
+ dia_display_resize_canvas (ddisp, alloc->width, alloc->height);
+ dia_display_update_scrollbars(ddisp);
}
/* If the UI is not integrated, resizing should set the resized
@@ -133,7 +130,7 @@ dia_canvas_draw (GtkWidget *self,
GSList *l;
Rectangle *r, totrect;
DiaInteractiveRendererInterface *renderer;
- DDisplay *ddisp = dia_canvas_get_ddisplay (DIA_CANVAS (self));
+ DiaDisplay *ddisp = dia_canvas_get_display (DIA_CANVAS (self));
g_return_val_if_fail (ddisp->renderer != NULL, FALSE);
@@ -173,7 +170,7 @@ dia_canvas_draw (GtkWidget *self,
totrect.top -= 0.1;
totrect.bottom += 0.1;
- ddisplay_render_pixmap(ddisp, &totrect);
+ dia_display_render_pixmap(ddisp, &totrect);
}
dia_interactive_renderer_paint (ddisp->renderer,
@@ -192,11 +189,29 @@ dia_canvas_set_property (GObject *object,
{
DiaCanvas *self = DIA_CANVAS (object);
DiaCanvasPrivate *priv = dia_canvas_get_instance_private (self);
- DDisplayBox *box;
+
+ switch (property_id) {
+ case PROP_DISPLAY:
+ priv->display = g_value_get_object (value);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
+static void
+dia_canvas_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ DiaCanvas *self = DIA_CANVAS (object);
+ DiaCanvasPrivate *priv = dia_canvas_get_instance_private (self);
+
switch (property_id) {
- case PROP_DDISPLAY:
- box = g_value_get_boxed (value);
- priv->disp_box = display_box_new (box->ddisp);
+ case PROP_DISPLAY:
+ g_value_set_object (value, priv->display);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -211,13 +226,14 @@ dia_canvas_class_init (DiaCanvasClass *klass)
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
object_class->set_property = dia_canvas_set_property;
+ object_class->get_property = dia_canvas_get_property;
- properties[PROP_DDISPLAY] =
- g_param_spec_boxed ("ddisplay",
- "DDisplay",
- "Editor this canvas is part of",
- DIA_TYPE_DISPLAY,
- G_PARAM_CONSTRUCT_ONLY | G_PARAM_WRITABLE);
+ properties[PROP_DISPLAY] =
+ g_param_spec_object ("display",
+ "Display",
+ "Editor this canvas is part of",
+ DIA_TYPE_DISPLAY,
+ G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE);
g_object_class_install_properties (object_class,
N_PROPS,
@@ -242,7 +258,7 @@ dia_canvas_init (DiaCanvas * self)
GDK_KEY_RELEASE_MASK);
gtk_widget_set_can_focus (GTK_WIDGET (self), TRUE);
g_signal_connect (G_OBJECT (self), "event",
- G_CALLBACK (ddisplay_canvas_events), NULL);
+ G_CALLBACK (dia_display_canvas_events), NULL);
canvas_setup_drag_dest (GTK_WIDGET (self));
}
diff --git a/app/dia-canvas.h b/app/dia-canvas.h
index 275e753d..56f9bf01 100644
--- a/app/dia-canvas.h
+++ b/app/dia-canvas.h
@@ -14,8 +14,8 @@ struct _DiaCanvasClass {
GtkDrawingAreaClass parent_class;
};
-GtkWidget *dia_canvas_new (DDisplay *ddisp);
-DDisplay *dia_canvas_get_ddisplay (DiaCanvas *self);
+GtkWidget *dia_canvas_new (DiaDisplay *ddisp);
+DiaDisplay *dia_canvas_get_display (DiaCanvas *self);
G_END_DECLS
diff --git a/app/dia-props.c b/app/dia-props.c
index e14e0670..5aa170e0 100644
--- a/app/dia-props.c
+++ b/app/dia-props.c
@@ -48,7 +48,7 @@ static void
diagram_properties_update_sensitivity(GtkToggleButton *widget,
gpointer userdata)
{
- Diagram *dia = ddisplay_active_diagram();
+ Diagram *dia = dia_display_active_diagram();
gboolean dyn_grid, square_grid, hex_grid;
if (!dia)
@@ -84,7 +84,7 @@ create_diagram_properties_dialog(Diagram *dia)
dialog = gtk_dialog_new_with_buttons(
_("Diagram Properties"),
- GTK_WINDOW(ddisplay_active()->shell),
+ GTK_WINDOW(dia_display_active()->shell),
GTK_DIALOG_DESTROY_WITH_PARENT,
_("Close"), GTK_RESPONSE_CANCEL,
_("Apply"), GTK_RESPONSE_APPLY,
@@ -302,7 +302,7 @@ diagram_properties_show(Diagram *dia)
diagram_properties_retrieve(dia);
gtk_window_set_transient_for(GTK_WINDOW(dialog),
- GTK_WINDOW (ddisplay_active()->shell));
+ GTK_WINDOW (dia_display_active()->shell));
gtk_widget_show(dialog);
}
@@ -311,7 +311,7 @@ diagram_properties_respond(GtkWidget *widget,
gint response_id,
gpointer user_data)
{
- Diagram *active_diagram = ddisplay_active_diagram();
+ Diagram *active_diagram = dia_display_active_diagram();
if (response_id == GTK_RESPONSE_OK ||
response_id == GTK_RESPONSE_APPLY) {
diff --git a/app/dia.def b/app/dia.def
index b94c1c1d..f6b3208d 100644
--- a/app/dia.def
+++ b/app/dia.def
@@ -1,20 +1,20 @@
EXPORTS
; all these exports are only required for pydia
- ddisplay_active
- ddisplay_add_update_all
- ddisplay_close
- ddisplay_flush
- ddisplay_resize_canvas
- ddisplay_scroll
- ddisplay_scroll_down
- ddisplay_scroll_left
- ddisplay_scroll_right
- ddisplay_scroll_up
- ddisplay_set_origo
- ddisplay_set_title
- ddisplay_show_all
- ddisplay_zoom
- new_display
+ dia_display_active
+ dia_display_add_update_all
+ dia_display_close
+ dia_display_flush
+ dia_display_resize_canvas
+ dia_display_scroll
+ dia_display_scroll_down
+ dia_display_scroll_left
+ dia_display_scroll_right
+ dia_display_scroll_up
+ dia_display_set_origo
+ dia_display_set_title
+ dia_display_show_all
+ dia_display_zoom
+ dia_display_new
diagram_add_update
diagram_add_update_all
diagram_find_clicked_object
diff --git a/app/diagram.c b/app/diagram.c
index bd138761..2528eeb2 100644
--- a/app/diagram.c
+++ b/app/diagram.c
@@ -413,9 +413,9 @@ diagram_modified(Diagram *dia)
g_free (extra);
displays = dia->displays;
while (displays!=NULL) {
- DDisplay *ddisp = (DDisplay *) displays->data;
+ DiaDisplay *ddisp = (DiaDisplay *) displays->data;
- ddisplay_set_title(ddisp, title);
+ dia_display_set_title (ddisp, title);
displays = g_slist_next(displays);
}
@@ -536,13 +536,13 @@ object_within_parent(DiaObject *obj, DiaObject *p)
/*
This is the real implementation of the sensitivity update.
- TODO: move it to the DDisplay as it belongs to it IMHO
+ TODO: move it to the DiaDisplay as it belongs to it IMHO
*/
void
diagram_update_menu_sensitivity (Diagram *dia)
{
gint selected_count = dia ? g_list_length (dia->data->selected) : 0;
- DDisplay *ddisp = ddisplay_active();
+ DiaDisplay *ddisp = dia_display_active();
gboolean focus_active = dia ? (get_active_focus(dia->data) != NULL) : FALSE;
gboolean textedit_active = ddisp ? textedit_mode(ddisp) : FALSE;
GtkAction *action;
@@ -656,13 +656,13 @@ diagram_update_menu_sensitivity (Diagram *dia)
void
-diagram_add_ddisplay(Diagram *dia, DDisplay *ddisp)
+diagram_add_display(Diagram *dia, DiaDisplay *ddisp)
{
dia->displays = g_slist_prepend(dia->displays, ddisp);
}
void
-diagram_remove_ddisplay(Diagram *dia, DDisplay *ddisp)
+diagram_remove_display(Diagram *dia, DiaDisplay *ddisp)
{
dia->displays = g_slist_remove(dia->displays, ddisp);
@@ -819,7 +819,7 @@ diagram_select_list(Diagram *dia, GList *list)
list = g_list_next(list);
}
if (get_active_focus((DiagramData*) dia) == NULL) {
- textedit_activate_first(ddisplay_active());
+ textedit_activate_first(dia_display_active());
}
g_signal_handlers_unblock_by_func (dia, DIA_DIAGRAM_DATA_GET_CLASS (dia)->selection_changed, NULL);
g_signal_emit_by_name (dia, "selection_changed", g_list_length (dia->data->selected));
@@ -854,13 +854,13 @@ void
diagram_add_update_all(Diagram *dia)
{
GSList *l;
- DDisplay *ddisp;
+ DiaDisplay *ddisp;
l = dia->displays;
while (l!=NULL) {
- ddisp = (DDisplay *) l->data;
+ ddisp = (DiaDisplay *) l->data;
- ddisplay_add_update_all(ddisp);
+ dia_display_add_update_all(ddisp);
l = g_slist_next(l);
}
@@ -870,13 +870,13 @@ void
diagram_add_update(Diagram *dia, const Rectangle *update)
{
GSList *l;
- DDisplay *ddisp;
+ DiaDisplay *ddisp;
l = dia->displays;
while (l!=NULL) {
- ddisp = (DDisplay *) l->data;
+ ddisp = (DiaDisplay *) l->data;
- ddisplay_add_update(ddisp, update);
+ dia_display_add_update(ddisp, update);
l = g_slist_next(l);
}
@@ -892,13 +892,13 @@ diagram_add_update_with_border(Diagram *dia, const Rectangle *update,
int pixel_border)
{
GSList *l;
- DDisplay *ddisp;
+ DiaDisplay *ddisp;
l = dia->displays;
while (l!=NULL) {
- ddisp = (DDisplay *) l->data;
+ ddisp = (DiaDisplay *) l->data;
- ddisplay_add_update_with_border(ddisp, update, pixel_border);
+ dia_display_add_update_with_border(ddisp, update, pixel_border);
l = g_slist_next(l);
}
@@ -909,13 +909,13 @@ diagram_add_update_pixels(Diagram *dia, Point *point,
int pixel_width, int pixel_height)
{
GSList *l;
- DDisplay *ddisp;
+ DiaDisplay *ddisp;
l = dia->displays;
while (l!=NULL) {
- ddisp = (DDisplay *) l->data;
+ ddisp = (DiaDisplay *) l->data;
- ddisplay_add_update_pixels(ddisp, point, pixel_width, pixel_height);
+ dia_display_add_update_pixels(ddisp, point, pixel_width, pixel_height);
l = g_slist_next(l);
}
@@ -925,12 +925,12 @@ void
diagram_flush(Diagram *dia)
{
GSList *l;
- DDisplay *ddisp;
+ DiaDisplay *ddisp;
l = dia->displays;
while (l!=NULL) {
- ddisp = (DDisplay *) l->data;
+ ddisp = (DiaDisplay *) l->data;
- ddisplay_flush(ddisp);
+ dia_display_flush(ddisp);
l = g_slist_next(l);
}
@@ -1025,13 +1025,13 @@ diagram_update_extents(Diagram *dia)
if (data_update_extents(dia->data)) {
/* Update scrollbars because extents were changed: */
GSList *l;
- DDisplay *ddisp;
+ DiaDisplay *ddisp;
l = dia->displays;
while (l!=NULL) {
- ddisp = (DDisplay *) l->data;
+ ddisp = (DiaDisplay *) l->data;
- ddisplay_update_scrollbars(ddisp);
+ dia_display_update_scrollbars(ddisp);
l = g_slist_next(l);
}
@@ -1473,16 +1473,16 @@ static void
diagram_update_for_filename(Diagram *dia)
{
GSList *l;
- DDisplay *ddisp;
+ DiaDisplay *ddisp;
char *title;
title = diagram_get_name(dia);
l = dia->displays;
while (l!=NULL) {
- ddisp = (DDisplay *) l->data;
+ ddisp = (DiaDisplay *) l->data;
- ddisplay_set_title(ddisp, title);
+ dia_display_set_title(ddisp, title);
l = g_slist_next(l);
}
diff --git a/app/diagram_tree_view.c b/app/diagram_tree_view.c
index 810e3227..4cd094bd 100644
--- a/app/diagram_tree_view.c
+++ b/app/diagram_tree_view.c
@@ -112,12 +112,12 @@ _dtv_button_press (GtkWidget *widget,
gtk_tree_model_get (model, &iter, OBJECT_COLUMN, &object, -1);
gtk_tree_model_get (model, &iter, DIAGRAM_COLUMN, &diagram, -1);
- if (object && diagram && ddisplay_active_diagram() == diagram) {
- if (event->button == 1 && event->type == GDK_2BUTTON_PRESS) /* double-click 'locates' */
- ddisplay_present_object (ddisplay_active(), object);
+ if (object && diagram && dia_display_active_diagram() == diagram) {
+ if (event->button == 1 && event->type == GDK_2BUTTON_PRESS) /* double-click 'locates' */
+ dia_display_present_object (dia_display_active(), object);
}
if (diagram)
- g_object_unref(diagram);
+ g_object_unref(diagram);
gtk_tree_path_free (path);
}
}
@@ -380,9 +380,9 @@ _dtv_locate_item (GtkAction *action,
for (displays = diagram->displays;
displays != NULL; displays = g_slist_next (displays)) {
- DDisplay *ddisp = (DDisplay *)displays->data;
+ DiaDisplay *ddisp = (DiaDisplay *)displays->data;
- ddisplay_present_object (ddisp, object);
+ dia_display_present_object (ddisp, object);
}
}
/* drop all references got from the model */
diff --git a/app/disp_callbacks.c b/app/disp_callbacks.c
index 50c69216..ea6126a4 100644
--- a/app/disp_callbacks.c
+++ b/app/disp_callbacks.c
@@ -51,27 +51,25 @@
#include "dia-canvas.h"
typedef struct {
- GdkEvent *event; /* Button down event which may be holding */
- DDisplay *ddisp; /* DDisplay where event occurred */
- guint tag; /* Tag for timeout */
+ GdkEvent *event; /* Button down event which may be holding */
+ DiaDisplay *ddisp; /* DiaDisplay where event occurred */
+ guint tag; /* Tag for timeout */
} HoldTimeoutData;
static HoldTimeoutData hold_data = {NULL, NULL, 0};
-
-
static void
object_menu_item_proxy(GtkWidget *widget, gpointer data)
{
DiaMenuItem *dia_menu_item;
ObjectChange *obj_change;
DiaObject *obj;
- DDisplay *ddisp = ddisplay_active();
+ DiaDisplay *ddisp = dia_display_active();
Point last_clicked_pos;
if (!ddisp) return;
- last_clicked_pos = ddisplay_get_clicked_position(ddisp);
+ last_clicked_pos = dia_display_get_clicked_position(ddisp);
obj = (DiaObject *)ddisp->diagram->data->selected->data;
dia_menu_item = (DiaMenuItem *) data;
@@ -136,7 +134,7 @@ static void
_follow_link_callback (GtkAction *action, gpointer data)
{
DiaObject *obj;
- DDisplay *ddisp = ddisplay_active();
+ DiaDisplay *ddisp = dia_display_active();
gchar *url;
if (!ddisp) return;
@@ -175,7 +173,7 @@ add_follow_link_menu_item (GtkMenu *menu)
static void
_convert_to_path_callback (GtkAction *action, gpointer data)
{
- DDisplay *ddisp = ddisplay_active();
+ DiaDisplay *ddisp = dia_display_active();
GList *selected, *list;
ObjectChange *change_list = NULL;
@@ -223,7 +221,7 @@ add_convert_to_path_menu_item (GtkMenu *menu)
static void
_combine_to_path_callback (GtkAction *action, gpointer data)
{
- DDisplay *ddisp = ddisplay_active();
+ DiaDisplay *ddisp = dia_display_active();
GList *cut_list;
DiaObject *obj;
Diagram *dia;
@@ -250,7 +248,7 @@ _combine_to_path_callback (GtkAction *action, gpointer data)
(change->apply)(change, ddisp->diagram);
undo_set_transactionpoint(ddisp->diagram->undo);
}
- ddisplay_do_update_menu_sensitivity(ddisp);
+ dia_display_do_update_menu_sensitivity(ddisp);
diagram_flush(dia);
g_list_free (cut_list);
}
@@ -363,7 +361,7 @@ static DiaMenu empty_menu = {
};
static void
-popup_object_menu(DDisplay *ddisp, GdkEvent *event)
+popup_object_menu (DiaDisplay *ddisp, GdkEvent *event)
{
Diagram *diagram;
DiaObject *obj;
@@ -387,7 +385,7 @@ popup_object_menu(DDisplay *ddisp, GdkEvent *event)
return;
}
- last_clicked_pos = ddisplay_get_clicked_position(ddisp);
+ last_clicked_pos = dia_display_get_clicked_position(ddisp);
obj = (DiaObject *)g_list_first(selected_list)->data;
/* Possibly react differently at a handle? */
@@ -469,15 +467,15 @@ popup_object_menu(DDisplay *ddisp, GdkEvent *event)
}
gint
-ddisplay_focus_in_event(GtkWidget *widget, GdkEventFocus *event, gpointer data)
+dia_display_focus_in_event (GtkWidget *widget, GdkEventFocus *event, gpointer data)
{
- DDisplay *ddisp;
+ DiaDisplay *ddisp;
g_return_val_if_fail (widget != NULL, FALSE);
g_return_val_if_fail (event != NULL, FALSE);
g_return_val_if_fail (data != NULL, FALSE);
- ddisp = (DDisplay *)data;
+ ddisp = (DiaDisplay *)data;
g_assert (event->in == TRUE);
@@ -487,9 +485,9 @@ ddisplay_focus_in_event(GtkWidget *widget, GdkEventFocus *event, gpointer data)
}
gint
-ddisplay_focus_out_event(GtkWidget *widget, GdkEventFocus *event,gpointer data)
+dia_display_focus_out_event (GtkWidget *widget, GdkEventFocus *event,gpointer data)
{
- DDisplay *ddisp;
+ DiaDisplay *ddisp;
int return_val;
g_return_val_if_fail (widget != NULL, FALSE);
@@ -498,7 +496,7 @@ ddisplay_focus_out_event(GtkWidget *widget, GdkEventFocus *event,gpointer data)
return_val = FALSE;
- ddisp = (DDisplay *)data;
+ ddisp = (DiaDisplay *)data;
g_assert (event->in == FALSE);
@@ -508,28 +506,28 @@ ddisplay_focus_out_event(GtkWidget *widget, GdkEventFocus *event,gpointer data)
}
void
-ddisplay_realize(GtkWidget *widget, gpointer data)
+dia_display_realize (GtkWidget *widget, gpointer data)
{
- DDisplay *ddisp;
+ DiaDisplay *ddisp;
g_return_if_fail(widget != NULL);
g_return_if_fail(data != NULL);
- ddisp = (DDisplay *)data;
+ ddisp = (DiaDisplay *)data;
gtk_im_context_set_client_window(GTK_IM_CONTEXT(ddisp->im_context),
gtk_widget_get_window(widget));
}
void
-ddisplay_unrealize (GtkWidget *widget, gpointer data)
+dia_display_unrealize (GtkWidget *widget, gpointer data)
{
- DDisplay *ddisp;
+ DiaDisplay *ddisp;
g_return_if_fail (widget != NULL);
g_return_if_fail (data != NULL);
- ddisp = (DDisplay *) data;
+ ddisp = (DiaDisplay *) data;
if (ddisp->im_context)
gtk_im_context_set_client_window(GTK_IM_CONTEXT(ddisp->im_context),
@@ -537,7 +535,7 @@ ddisplay_unrealize (GtkWidget *widget, gpointer data)
}
void
-ddisplay_popup_menu(DDisplay *ddisp, GdkEventButton *event)
+dia_display_popup_menu (DiaDisplay *ddisp, GdkEventButton *event)
{
GtkWidget *menu;
@@ -547,7 +545,7 @@ ddisplay_popup_menu(DDisplay *ddisp, GdkEventButton *event)
event->button, event->time);
}
static void
-handle_key_event(DDisplay *ddisp, Focus *focus,
+handle_key_event (DiaDisplay *ddisp, Focus *focus,
guint keystate, guint keysym,
const gchar *str, int strlen)
{
@@ -582,8 +580,9 @@ handle_key_event(DDisplay *ddisp, Focus *focus,
void
-ddisplay_im_context_commit(GtkIMContext *context, const gchar *str,
- DDisplay *ddisp)
+dia_display_im_context_commit (GtkIMContext *context,
+ const gchar *str,
+ DiaDisplay *ddisp)
{
/* When using IM, we'll not get many key events past the IM filter,
mostly IM Commits.
@@ -594,20 +593,20 @@ ddisplay_im_context_commit(GtkIMContext *context, const gchar *str,
Focus *focus = get_active_focus((DiagramData *) ddisp->diagram);
- ddisplay_im_context_preedit_reset(ddisp, focus);
+ dia_display_im_context_preedit_reset(ddisp, focus);
if (focus != NULL)
handle_key_event(ddisp, focus, 0, 0, str, g_utf8_strlen(str,-1));
}
void
-ddisplay_im_context_preedit_changed(GtkIMContext *context,
- DDisplay *ddisp)
+dia_display_im_context_preedit_changed(GtkIMContext *context,
+ DiaDisplay *ddisp)
{
gint cursor_pos;
Focus *focus = get_active_focus((DiagramData *) ddisp->diagram);
- ddisplay_im_context_preedit_reset(ddisp, focus);
+ dia_display_im_context_preedit_reset (ddisp, focus);
gtk_im_context_get_preedit_string(context, &ddisp->preedit_string,
&ddisp->preedit_attrs, &cursor_pos);
@@ -616,13 +615,13 @@ ddisplay_im_context_preedit_changed(GtkIMContext *context,
handle_key_event(ddisp, focus, 0, 0, ddisp->preedit_string,
g_utf8_strlen(ddisp->preedit_string,-1));
} else {
- ddisplay_im_context_preedit_reset(ddisp, focus);
+ dia_display_im_context_preedit_reset(ddisp, focus);
}
}
}
static void
-_scroll_page (DDisplay *ddisp, Direction dir)
+_scroll_page (DiaDisplay *ddisp, Direction dir)
{
Point delta = {0, 0};
@@ -640,29 +639,29 @@ _scroll_page (DDisplay *ddisp, Direction dir)
delta.y = ddisp->diagram->data->paper.height * ddisp->diagram->data->paper.scaling;
break;
}
- ddisplay_scroll(ddisp, &delta);
- ddisplay_flush(ddisp);
+ dia_display_scroll(ddisp, &delta);
+ dia_display_flush(ddisp);
}
static void
-_scroll_step (DDisplay *ddisp, guint keyval)
+_scroll_step (DiaDisplay *ddisp, guint keyval)
{
switch (keyval) {
case GDK_KEY_Up :
- ddisplay_scroll_up(ddisp);
- ddisplay_flush(ddisp);
+ dia_display_scroll_up(ddisp);
+ dia_display_flush(ddisp);
break;
case GDK_KEY_Down:
- ddisplay_scroll_down(ddisp);
- ddisplay_flush(ddisp);
+ dia_display_scroll_down(ddisp);
+ dia_display_flush(ddisp);
break;
case GDK_KEY_Left:
- ddisplay_scroll_left(ddisp);
- ddisplay_flush(ddisp);
+ dia_display_scroll_left(ddisp);
+ dia_display_flush(ddisp);
break;
case GDK_KEY_Right:
- ddisplay_scroll_right(ddisp);
- ddisplay_flush(ddisp);
+ dia_display_scroll_right(ddisp);
+ dia_display_flush(ddisp);
break;
default :
g_assert_not_reached ();
@@ -685,7 +684,7 @@ hold_remove_handler(void)
* If this function is called, then the button must still be down,
* indicating that the user has pressed and held the button, but not moved
* the pointer (mouse).
- * Dynamic data is cleaned up in ddisplay_canvas_events
+ * Dynamic data is cleaned up in dia_display_canvas_events
*/
static gboolean
hold_timeout_handler(gpointer data)
@@ -699,7 +698,7 @@ hold_timeout_handler(gpointer data)
/** Main input handler for a diagram canvas.
*/
gint
-ddisplay_canvas_events (GtkWidget *canvas,
+dia_display_canvas_events (GtkWidget *canvas,
GdkEvent *event,
gpointer data)
{
@@ -718,7 +717,7 @@ ddisplay_canvas_events (GtkWidget *canvas,
int key_handled;
int im_context_used;
static gboolean moving = FALSE;
- DDisplay *ddisp = dia_canvas_get_ddisplay (DIA_CANVAS (canvas));
+ DiaDisplay *ddisp = dia_canvas_get_display (DIA_CANVAS (canvas));
return_val = FALSE;
@@ -734,45 +733,45 @@ ddisplay_canvas_events (GtkWidget *canvas,
{
case GDK_SCROLL_UP:
if (sevent->state & GDK_SHIFT_MASK)
- ddisplay_scroll_left(ddisp);
+ dia_display_scroll_left(ddisp);
else if (sevent->state & GDK_CONTROL_MASK) {
- ddisplay_untransform_coords(ddisp, (int)sevent->x, (int)sevent->y, &middle.x, &middle.y);
+ dia_display_untransform_coords(ddisp, (int)sevent->x, (int)sevent->y, &middle.x,
&middle.y);
/* zooming with the wheel in small steps 1^(1/8) */
- ddisplay_zoom_centered(ddisp, &middle, 1.090508);
+ dia_display_zoom_centered(ddisp, &middle, 1.090508);
}
else
- ddisplay_scroll_up(ddisp);
+ dia_display_scroll_up(ddisp);
break;
case GDK_SCROLL_DOWN:
if (sevent->state & GDK_SHIFT_MASK)
- ddisplay_scroll_right(ddisp);
+ dia_display_scroll_right(ddisp);
else if (sevent->state & GDK_CONTROL_MASK) {
- ddisplay_untransform_coords(ddisp, (int)sevent->x, (int)sevent->y, &middle.x, &middle.y);
+ dia_display_untransform_coords(ddisp, (int)sevent->x, (int)sevent->y, &middle.x,
&middle.y);
/* zooming with the wheel in small steps 1/(1^(1/8)) */
- ddisplay_zoom_centered(ddisp, &middle, 0.917004);
+ dia_display_zoom_centered(ddisp, &middle, 0.917004);
}
else
- ddisplay_scroll_down(ddisp);
+ dia_display_scroll_down(ddisp);
break;
case GDK_SCROLL_LEFT:
- ddisplay_scroll_left(ddisp);
+ dia_display_scroll_left(ddisp);
break;
case GDK_SCROLL_RIGHT:
- ddisplay_scroll_right(ddisp);
+ dia_display_scroll_right(ddisp);
break;
default:
break;
}
- ddisplay_flush (ddisp);
+ dia_display_flush (ddisp);
break;
case GDK_FOCUS_CHANGE: {
- GdkEventFocus *focus = (GdkEventFocus*)event;
- hold_remove_handler();
- if (focus->in) {
- display_set_active(ddisp);
- ddisplay_do_update_menu_sensitivity(ddisp);
- }
+ GdkEventFocus *focus = (GdkEventFocus*)event;
+ hold_remove_handler();
+ if (focus->in) {
+ display_set_active(ddisp);
+ dia_display_do_update_menu_sensitivity(ddisp);
+ }
break;
}
case GDK_2BUTTON_PRESS:
@@ -802,8 +801,8 @@ ddisplay_canvas_events (GtkWidget *canvas,
case GDK_BUTTON_PRESS:
display_set_active(ddisp);
bevent = (GdkEventButton *) event;
-
- ddisplay_set_clicked_point (ddisp, bevent->x, bevent->y);
+
+ dia_display_set_clicked_point (ddisp, bevent->x, bevent->y);
switch (bevent->button)
{
@@ -841,7 +840,7 @@ ddisplay_canvas_events (GtkWidget *canvas,
popup_object_menu(ddisp, event);
break;
}
- ddisplay_popup_menu(ddisp, bevent);
+ dia_display_popup_menu(ddisp, bevent);
break;
}
else {
@@ -930,7 +929,7 @@ ddisplay_canvas_events (GtkWidget *canvas,
case GDK_KEY_Escape:
textedit_deactivate_focus();
tool_reset ();
- ddisplay_do_update_menu_sensitivity(ddisp);
+ dia_display_do_update_menu_sensitivity(ddisp);
break;
default:
/*! key event not swallowed by the input method ? */
@@ -958,19 +957,19 @@ ddisplay_canvas_events (GtkWidget *canvas,
case GDK_KEY_Home :
case GDK_KEY_KP_Home :
/* match upper left corner of the diagram with it's view */
- ddisplay_set_origo(ddisp, ddisp->diagram->data->extents.left,
ddisp->diagram->data->extents.top);
- ddisplay_update_scrollbars(ddisp);
- ddisplay_add_update_all(ddisp);
+ dia_display_set_origo(ddisp, ddisp->diagram->data->extents.left,
ddisp->diagram->data->extents.top);
+ dia_display_update_scrollbars(ddisp);
+ dia_display_add_update_all(ddisp);
break;
case GDK_KEY_End :
case GDK_KEY_KP_End :
/* match lower right corner of the diagram with it's view */
visible = &ddisp->visible;
- ddisplay_set_origo(ddisp,
+ dia_display_set_origo(ddisp,
ddisp->diagram->data->extents.right - (visible->right - visible->left),
ddisp->diagram->data->extents.bottom - (visible->bottom - visible->top));
- ddisplay_update_scrollbars(ddisp);
- ddisplay_add_update_all(ddisp);
+ dia_display_update_scrollbars(ddisp);
+ dia_display_add_update_all(ddisp);
break;
case GDK_KEY_Page_Up :
case GDK_KEY_KP_Page_Up :
@@ -993,7 +992,7 @@ ddisplay_canvas_events (GtkWidget *canvas,
object_add_updates_list(objects, dia);
object_list_nudge(objects, dia, dir,
/* step one pixel or more with <ctrl> */
- ddisplay_untransform_length (ddisp, (state & GDK_SHIFT_MASK) ? 10 : 1));
+ dia_display_untransform_length (ddisp, (state & GDK_SHIFT_MASK) ? 10 :
1));
diagram_update_connections_selection(dia);
object_add_updates_list(objects, dia);
diagram_modified(dia);
@@ -1006,11 +1005,11 @@ ddisplay_canvas_events (GtkWidget *canvas,
break;
case GDK_KEY_KP_Add:
case GDK_KEY_plus:
- ddisplay_zoom_middle(ddisp, M_SQRT2);
+ dia_display_zoom_middle(ddisp, M_SQRT2);
break;
case GDK_KEY_KP_Subtract:
case GDK_KEY_minus:
- ddisplay_zoom_middle(ddisp, M_SQRT1_2);
+ dia_display_zoom_middle(ddisp, M_SQRT1_2);
break;
case GDK_KEY_Shift_L:
case GDK_KEY_Shift_R:
@@ -1068,50 +1067,43 @@ ddisplay_canvas_events (GtkWidget *canvas,
}
gint
-ddisplay_hsb_update (GtkAdjustment *adjustment,
- DDisplay *ddisp)
+dia_display_hsb_update (GtkAdjustment *adjustment,
+ DiaDisplay *ddisp)
{
- ddisplay_set_origo(ddisp, gtk_adjustment_get_value (adjustment), ddisp->origo.y);
- ddisplay_add_update_all(ddisp);
- ddisplay_flush(ddisp);
+ dia_display_set_origo(ddisp, gtk_adjustment_get_value (adjustment), ddisp->origo.y);
+ dia_display_add_update_all(ddisp);
+ dia_display_flush(ddisp);
return FALSE;
}
gint
-ddisplay_vsb_update (GtkAdjustment *adjustment,
- DDisplay *ddisp)
+dia_display_vsb_update (GtkAdjustment *adjustment,
+ DiaDisplay *ddisp)
{
- ddisplay_set_origo(ddisp, ddisp->origo.x, gtk_adjustment_get_value (adjustment));
- ddisplay_add_update_all(ddisp);
- ddisplay_flush(ddisp);
+ dia_display_set_origo(ddisp, ddisp->origo.x, gtk_adjustment_get_value (adjustment));
+ dia_display_add_update_all(ddisp);
+ dia_display_flush(ddisp);
return FALSE;
}
gint
-ddisplay_delete (GtkWidget *widget, GdkEvent *event, gpointer data)
+dia_display_delete (GtkWidget *widget, GdkEvent *event, gpointer data)
{
- DDisplay *ddisp;
+ DiaDisplay *ddisp;
- ddisp = (DDisplay *)data;
+ ddisp = (DiaDisplay *)data;
- ddisplay_close(ddisp);
+ dia_display_close(ddisp);
return TRUE;
}
-void
-ddisplay_destroy (GtkWidget *widget, gpointer data)
-{
- DDisplay *ddisp;
-
- ddisp = (DDisplay *) data;
-
- ddisplay_really_destroy(ddisp);
-}
-
/* returns NULL if object cannot be created */
DiaObject *
-ddisplay_drop_object(DDisplay *ddisp, gint x, gint y, DiaObjectType *otype,
- gpointer user_data)
+dia_display_drop_object (DiaDisplay *ddisp,
+ gint x,
+ gint y,
+ DiaObjectType *otype,
+ gpointer user_data)
{
Point droppoint;
Point droppoint_orig;
@@ -1121,7 +1113,7 @@ ddisplay_drop_object(DDisplay *ddisp, gint x, gint y, DiaObjectType *otype,
real click_distance;
gboolean avoid_reset;
- ddisplay_untransform_coords(ddisp, x, y, &droppoint.x, &droppoint.y);
+ dia_display_untransform_coords(ddisp, x, y, &droppoint.x, &droppoint.y);
/* save it before snap_to_grid modifies it */
droppoint_orig = droppoint;
@@ -1135,7 +1127,7 @@ ddisplay_drop_object(DDisplay *ddisp, gint x, gint y, DiaObjectType *otype,
if (!obj)
return NULL;
- click_distance = ddisplay_untransform_length(ddisp, 3.0);
+ click_distance = dia_display_untransform_length(ddisp, 3.0);
/* Notice that using diagram_find_clicked_object doesn't allow any object
* below the first to be a parent. This should be fixed.
@@ -1216,7 +1208,7 @@ ddisplay_drop_object(DDisplay *ddisp, gint x, gint y, DiaObjectType *otype,
object_connect_display(ddisp, obj, handle1, FALSE);
}
object_add_updates(obj, ddisp->diagram);
- ddisplay_do_update_menu_sensitivity(ddisp);
+ dia_display_do_update_menu_sensitivity (ddisp);
diagram_flush(ddisp->diagram);
list = g_list_prepend(NULL, obj);
diff --git a/app/disp_callbacks.h b/app/disp_callbacks.h
index 4058791d..fa27a5f8 100644
--- a/app/disp_callbacks.h
+++ b/app/disp_callbacks.h
@@ -20,25 +20,24 @@
#include "display.h"
-gint ddisplay_focus_in_event (GtkWidget *widget, GdkEventFocus *event,
+gint dia_display_focus_in_event (GtkWidget *widget, GdkEventFocus *event,
gpointer data);
-gint ddisplay_focus_out_event (GtkWidget *widget, GdkEventFocus *event,
+gint dia_display_focus_out_event (GtkWidget *widget, GdkEventFocus *event,
gpointer data);
-void ddisplay_realize (GtkWidget *widget, gpointer data);
-void ddisplay_unrealize (GtkWidget *widget, gpointer data);
+void dia_display_realize (GtkWidget *widget, gpointer data);
+void dia_display_unrealize (GtkWidget *widget, gpointer data);
-gint ddisplay_canvas_events (GtkWidget *, GdkEvent *, gpointer data);
-void ddisplay_popup_menu(DDisplay *ddisp, GdkEventButton *event);
-gint ddisplay_hsb_update (GtkAdjustment *adjustment, DDisplay *ddisp);
-gint ddisplay_vsb_update (GtkAdjustment *adjustment, DDisplay *ddisp);
-gint ddisplay_delete (GtkWidget *widget, GdkEvent *event, gpointer data);
-void ddisplay_destroy (GtkWidget *widget, gpointer data);
+gint dia_display_canvas_events (GtkWidget *, GdkEvent *, gpointer data);
+void dia_display_popup_menu(DiaDisplay *ddisp, GdkEventButton *event);
+gint dia_display_hsb_update (GtkAdjustment *adjustment, DiaDisplay *ddisp);
+gint dia_display_vsb_update (GtkAdjustment *adjustment, DiaDisplay *ddisp);
+gint dia_display_delete (GtkWidget *widget, GdkEvent *event, gpointer data);
-DiaObject *ddisplay_drop_object(DDisplay *ddisp, gint x, gint y, DiaObjectType *otype,
+DiaObject *dia_display_drop_object(DiaDisplay *ddisp, gint x, gint y, DiaObjectType *otype,
gpointer user_data);
-void ddisplay_im_context_commit(GtkIMContext *context, const gchar *str,
- DDisplay *ddisp);
-void ddisplay_im_context_preedit_changed(GtkIMContext *context,
- DDisplay *ddisp);
+void dia_display_im_context_commit(GtkIMContext *context, const gchar *str,
+ DiaDisplay *ddisp);
+void dia_display_im_context_preedit_changed(GtkIMContext *context,
+ DiaDisplay *ddisp);
#endif /* DISP_CALLBACKS_H */
diff --git a/app/display.c b/app/display.c
index 6339f612..030dfa00 100644
--- a/app/display.c
+++ b/app/display.c
@@ -48,53 +48,203 @@
#include "recent_files.h"
#include "filedlg.h"
-static gpointer
-display_box_copy (gpointer box)
-{
- DDisplayBox *src = (DDisplayBox *) box;
- DDisplayBox *dest = g_slice_new (DDisplayBox);
+G_DEFINE_TYPE (DiaDisplay, dia_display, G_TYPE_OBJECT)
- g_return_val_if_fail (src != NULL, NULL);
+enum {
+ PROP_DIAGRAM = 1,
+ N_PROPS
+};
+static GParamSpec* properties[N_PROPS];
- dest->ddisp = src->ddisp;
+static GdkCursor *current_cursor = NULL;
- return dest;
-}
+GdkCursor *default_cursor = NULL;
+
+static DiaDisplay *active_display = NULL;
+
+static void dia_display_free_update_areas (DiaDisplay *ddisp);
+static void initialize_display_widgets (DiaDisplay *ddisp);
+static void selection_changed (Diagram *dia, int n, DiaDisplay *ddisp);
+
+typedef struct _IRectangle {
+ int top, bottom;
+ int left,right;
+} IRectangle;
static void
-display_box_free (gpointer box)
+dia_display_finalize (GObject *obj)
{
- g_slice_free (DDisplayBox, box);
+ DiaDisplay *ddisp = DIA_DISPLAY (obj);
+
+ g_signal_handlers_disconnect_by_func (ddisp->diagram, selection_changed, ddisp);
+
+ g_object_unref (G_OBJECT (ddisp->im_context));
+ ddisp->im_context = NULL;
+
+ dia_display_im_context_preedit_reset (ddisp, get_active_focus ((DiagramData *) ddisp->diagram));
+
+ if (GTK_WINDOW (ddisp->shell) == gtk_window_get_transient_for (GTK_WINDOW (interface_get_toolbox_shell
()))) {
+ /* we have to break the connection otherwise the toolbox will be closed */
+ gtk_window_set_transient_for (GTK_WINDOW (interface_get_toolbox_shell ()), NULL);
+ }
+
+ /* This calls dia_display_really_destroy */
+ if (ddisp->is_standalone_window) {
+ gtk_widget_destroy (ddisp->shell);
+ } else {
+ gtk_widget_destroy (ddisp->container);
+
+ if (active_display == ddisp)
+ display_set_active (NULL);
+
+ if (ddisp->diagram) {
+ diagram_remove_display (ddisp->diagram, ddisp);
+ /* if we are the last user of the diagram it will be unref'ed */
+ g_clear_object (&ddisp->diagram);
+ }
+
+ g_clear_object (&ddisp->renderer);
+
+ /* Free update_areas list: */
+ dia_display_free_update_areas (ddisp);
+ }
}
-DDisplayBox *
-display_box_new (DDisplay *ddisp)
+static void
+dia_display_constructed (GObject *obj)
{
- DDisplayBox *dest = g_slice_new (DDisplayBox);
+ Rectangle visible;
+ int preset;
+ DiaDisplay *self = DIA_DISPLAY (obj);
- g_return_val_if_fail (ddisp != NULL, NULL);
+ /* Ideally this would be done in _init but taking the safe approach to
+ * porting for now */
- dest->ddisp = ddisp;
+ self->grid.visible = prefs.grid.visible;
+ preset = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (self->diagram), "show-grid"));
+ if (preset != 0)
+ self->grid.visible = (preset > 0 ? TRUE : FALSE);
+ self->grid.snap = prefs.grid.snap;
+ preset = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (self->diagram), "snap-to-grid"));
+ if (preset != 0)
+ self->grid.snap = (preset > 0 ? TRUE : FALSE);
+
+ self->show_cx_pts = prefs.show_cx_pts;
+ preset = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (self->diagram), "show-connection-points"));
+ if (preset != 0)
+ self->show_cx_pts = (preset > 0 ? TRUE : FALSE);
- return dest;
+ self->autoscroll = TRUE;
+ self->mainpoint_magnetism = prefs.snap_object;
+ preset = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (self->diagram), "snap-to-object"));
+ if (preset != 0)
+ self->mainpoint_magnetism = (preset > 0 ? TRUE : FALSE);
+
+ self->aa_renderer = prefs.view_antialiased;
+ preset = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (self->diagram), "antialiased"));
+ if (preset != 0)
+ self->aa_renderer = (preset > 0 ? TRUE : FALSE);
+
+ self->update_areas = NULL;
+
+ self->clicked_position.x = self->clicked_position.y = 0.0;
+
+ diagram_add_display (self->diagram, self);
+ g_signal_connect (self->diagram, "selection_changed", G_CALLBACK (selection_changed), self);
+ self->origo.x = 0.0;
+ self->origo.y = 0.0;
+ self->zoom_factor = prefs.new_view.zoom / 100.0 * DDISPLAY_NORMAL_ZOOM;
+ if ((self->diagram) && (self->diagram->data)) {
+ Rectangle *extents = &self->diagram->data->extents;
+
+ visible.left = extents->left;
+ visible.top = extents->top;
+ } else {
+ visible.left = 0.0;
+ visible.top = 0.0;
+ }
+ visible.right = visible.left + prefs.new_view.width / self->zoom_factor;
+ visible.bottom = visible.top + prefs.new_view.height / self->zoom_factor;
+
+ self->visible = visible;
+
+ initialize_display_widgets (self);
+
+ G_OBJECT_CLASS (dia_display_parent_class)->constructed (obj);
}
-G_DEFINE_BOXED_TYPE (DDisplayBox, ddisplay, display_box_copy, display_box_free)
+static void
+dia_display_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ DiaDisplay *self = DIA_DISPLAY (object);
+
+ switch (property_id) {
+ case PROP_DIAGRAM:
+ self->diagram = g_value_dup_object (value);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
-static GdkCursor *current_cursor = NULL;
+static void
+dia_display_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ DiaDisplay *self = DIA_DISPLAY (object);
+
+ switch (property_id) {
+ case PROP_DIAGRAM:
+ g_value_set_object (value, self->diagram);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
-GdkCursor *default_cursor = NULL;
+static void
+dia_display_class_init (DiaDisplayClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
-static DDisplay *active_display = NULL;
+ object_class->finalize = dia_display_finalize;
+ object_class->constructed = dia_display_constructed;
+ object_class->set_property = dia_display_set_property;
+ object_class->get_property = dia_display_get_property;
+ properties[PROP_DIAGRAM] = g_param_spec_object ("diagram",
+ NULL, NULL,
+ DIA_TYPE_DIAGRAM,
+ G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE);
-typedef struct _IRectangle {
- int top, bottom;
- int left,right;
-} IRectangle;
+ g_object_class_install_properties (object_class,
+ N_PROPS,
+ properties);
+}
static void
-update_zoom_status(DDisplay *ddisp)
+dia_display_init (DiaDisplay *self)
+{
+
+}
+
+DiaDisplay *
+dia_display_new (Diagram *diagram)
+{
+ return g_object_new (DIA_TYPE_DISPLAY,
+ "diagram", diagram,
+ NULL);
+}
+
+static void
+update_zoom_status(DiaDisplay *ddisp)
{
gchar* zoom_text;
@@ -119,7 +269,7 @@ update_zoom_status(DDisplay *ddisp)
}
static void
-selection_changed (Diagram* dia, int n, DDisplay* ddisp)
+selection_changed (Diagram* dia, int n, DiaDisplay* ddisp)
{
GtkStatusbar *statusbar;
guint context_id;
@@ -161,7 +311,7 @@ selection_changed (Diagram* dia, int n, DDisplay* ddisp)
gtk_statusbar_pop (statusbar, context_id);
}
/* selection-changed signal can also be emitted from outside of the dia core */
- ddisplay_do_update_menu_sensitivity (ddisp);
+ dia_display_do_update_menu_sensitivity (ddisp);
}
/** Initialize the various GTK-level thinks in a display after the internal
@@ -169,7 +319,7 @@ selection_changed (Diagram* dia, int n, DDisplay* ddisp)
* @param ddisp A display with all non-GTK/GDK items set.
*/
static void
-initialize_display_widgets(DDisplay *ddisp)
+initialize_display_widgets(DiaDisplay *ddisp)
{
Diagram *dia = ddisp->diagram;
gchar *filename;
@@ -178,10 +328,10 @@ initialize_display_widgets(DDisplay *ddisp)
ddisp->im_context = gtk_im_multicontext_new();
g_signal_connect (G_OBJECT (ddisp->im_context), "commit",
- G_CALLBACK (ddisplay_im_context_commit), ddisp);
+ G_CALLBACK (dia_display_im_context_commit), ddisp);
ddisp->preedit_string = NULL;
g_signal_connect (G_OBJECT (ddisp->im_context), "preedit_changed",
- G_CALLBACK (ddisplay_im_context_preedit_changed),
+ G_CALLBACK (dia_display_im_context_preedit_changed),
ddisp);
ddisp->preedit_attrs = NULL;
@@ -194,9 +344,9 @@ initialize_display_widgets(DDisplay *ddisp)
create_display_shell(ddisp, prefs.new_view.width, prefs.new_view.height,
filename, prefs.new_view.use_menu_bar);
- ddisplay_update_statusbar (ddisp);
+ dia_display_update_statusbar (ddisp);
- ddisplay_set_cursor(ddisp, current_cursor);
+ dia_display_set_cursor(ddisp, current_cursor);
}
/** Make a copy of an existing display. The original does not need to have
@@ -207,14 +357,16 @@ initialize_display_widgets(DDisplay *ddisp)
* new_display initializes before calling initialize_display_widgets()).
* @returns A newly allocated display, inserted into the diagram list, with
* same basic layout as the original.
+ *
+ * TODO: I don't like this function, can we kill it?
*/
-DDisplay *
-copy_display(DDisplay *orig_ddisp)
+DiaDisplay *
+dia_display_copy (DiaDisplay *orig_ddisp)
{
- DDisplay *ddisp;
+ DiaDisplay *ddisp;
Diagram *dia = orig_ddisp->diagram;
- ddisp = g_new0(DDisplay,1);
+ ddisp = g_object_new (DIA_TYPE_DISPLAY, NULL);
ddisp->diagram = orig_ddisp->diagram;
/* Every display has its own reference */
@@ -234,7 +386,7 @@ copy_display(DDisplay *orig_ddisp)
ddisp->clicked_position.x = ddisp->clicked_position.y = 0.0;
- diagram_add_ddisplay(dia, ddisp);
+ diagram_add_display(dia, ddisp);
g_signal_connect (dia, "selection_changed", G_CALLBACK(selection_changed), ddisp);
ddisp->origo = orig_ddisp->origo;
ddisp->zoom_factor = orig_ddisp->zoom_factor;
@@ -244,78 +396,8 @@ copy_display(DDisplay *orig_ddisp)
return ddisp; /* set the user data */
}
-
-/** Create a new display for a diagram, using prefs settings.
- * @param dia Otherwise initialize diagram to create a display for.
- * @returns A newly created display.
- */
-DDisplay *
-new_display(Diagram *dia)
-{
- DDisplay *ddisp;
- Rectangle visible;
- int preset;
-
- ddisp = g_new0(DDisplay,1);
-
- ddisp->diagram = dia;
- /* Every display has it's own reference */
- g_object_ref(dia);
-
- ddisp->grid.visible = prefs.grid.visible;
- preset = GPOINTER_TO_INT (g_object_get_data (G_OBJECT(dia), "show-grid"));
- if (preset != 0)
- ddisp->grid.visible = (preset > 0 ? TRUE : FALSE);
- ddisp->grid.snap = prefs.grid.snap;
- preset = GPOINTER_TO_INT (g_object_get_data (G_OBJECT(dia), "snap-to-grid"));
- if (preset != 0)
- ddisp->grid.snap = (preset > 0 ? TRUE : FALSE);
-
- ddisp->show_cx_pts = prefs.show_cx_pts;
- preset = GPOINTER_TO_INT (g_object_get_data (G_OBJECT(dia), "show-connection-points"));
- if (preset != 0)
- ddisp->show_cx_pts = (preset > 0 ? TRUE : FALSE);
-
- ddisp->autoscroll = TRUE;
- ddisp->mainpoint_magnetism = prefs.snap_object;
- preset = GPOINTER_TO_INT (g_object_get_data (G_OBJECT(dia), "snap-to-object"));
- if (preset != 0)
- ddisp->mainpoint_magnetism = (preset > 0 ? TRUE : FALSE);
-
- ddisp->aa_renderer = prefs.view_antialiased;
- preset = GPOINTER_TO_INT (g_object_get_data (G_OBJECT(dia), "antialiased"));
- if (preset != 0)
- ddisp->aa_renderer = (preset > 0 ? TRUE : FALSE);
-
- ddisp->update_areas = NULL;
-
- ddisp->clicked_position.x = ddisp->clicked_position.y = 0.0;
-
- diagram_add_ddisplay(dia, ddisp);
- g_signal_connect (dia, "selection_changed", G_CALLBACK(selection_changed), ddisp);
- ddisp->origo.x = 0.0;
- ddisp->origo.y = 0.0;
- ddisp->zoom_factor = prefs.new_view.zoom/100.0*DDISPLAY_NORMAL_ZOOM;
- if ((ddisp->diagram) && (ddisp->diagram->data)) {
- Rectangle *extents = &ddisp->diagram->data->extents;
-
- visible.left = extents->left;
- visible.top = extents->top;
- } else {
- visible.left = 0.0;
- visible.top = 0.0;
- }
- visible.right = visible.left + prefs.new_view.width/ddisp->zoom_factor;
- visible.bottom = visible.top + prefs.new_view.height/ddisp->zoom_factor;
-
- ddisp->visible = visible;
-
- initialize_display_widgets(ddisp);
- return ddisp; /* set the user data */
-}
-
void
-ddisplay_transform_coords_double(DDisplay *ddisp,
+dia_display_transform_coords_double(DiaDisplay *ddisp,
coord x, coord y,
double *xi, double *yi)
{
@@ -329,7 +411,7 @@ ddisplay_transform_coords_double(DDisplay *ddisp,
void
-ddisplay_transform_coords(DDisplay *ddisp,
+dia_display_transform_coords(DiaDisplay *ddisp,
coord x, coord y,
int *xi, int *yi)
{
@@ -345,21 +427,21 @@ ddisplay_transform_coords(DDisplay *ddisp,
/* Takes real length and returns pixel length */
real
-ddisplay_transform_length(DDisplay *ddisp, real len)
+dia_display_transform_length(DiaDisplay *ddisp, real len)
{
return len * ddisp->zoom_factor;
}
/* Takes pixel length and returns real length */
real
-ddisplay_untransform_length(DDisplay *ddisp, real len)
+dia_display_untransform_length(DiaDisplay *ddisp, real len)
{
return len / ddisp->zoom_factor;
}
void
-ddisplay_untransform_coords(DDisplay *ddisp,
+dia_display_untransform_coords(DiaDisplay *ddisp,
int xi, int yi,
coord *x, coord *y)
{
@@ -373,26 +455,26 @@ ddisplay_untransform_coords(DDisplay *ddisp,
void
-ddisplay_add_update_pixels(DDisplay *ddisp, Point *point,
+dia_display_add_update_pixels(DiaDisplay *ddisp, Point *point,
int pixel_width, int pixel_height)
{
Rectangle rect;
real size_x, size_y;
- size_x = ddisplay_untransform_length(ddisp, pixel_width+1);
- size_y = ddisplay_untransform_length(ddisp, pixel_height+1);
+ size_x = dia_display_untransform_length(ddisp, pixel_width+1);
+ size_y = dia_display_untransform_length(ddisp, pixel_height+1);
rect.left = point->x - size_x/2.0;
rect.top = point->y - size_y/2.0;
rect.right = point->x + size_x/2.0;
rect.bottom = point->y + size_y/2.0;
- ddisplay_add_update(ddisp, &rect);
+ dia_display_add_update(ddisp, &rect);
}
/** Free update_areas list */
static void
-ddisplay_free_update_areas(DDisplay *ddisp)
+dia_display_free_update_areas(DiaDisplay *ddisp)
{
GSList *l;
l = ddisp->update_areas;
@@ -408,41 +490,38 @@ ddisplay_free_update_areas(DDisplay *ddisp)
* Throws out old updates, since everything will be updated anyway.
*/
void
-ddisplay_add_update_all(DDisplay *ddisp)
+dia_display_add_update_all(DiaDisplay *ddisp)
{
if (ddisp->update_areas != NULL) {
- ddisplay_free_update_areas(ddisp);
+ dia_display_free_update_areas(ddisp);
}
- ddisplay_add_update(ddisp, &ddisp->visible);
+ dia_display_add_update(ddisp, &ddisp->visible);
}
/** Marks a rectangle for update, with a pixel border around it.
*/
void
-ddisplay_add_update_with_border(DDisplay *ddisp, const Rectangle *rect,
+dia_display_add_update_with_border(DiaDisplay *ddisp, const Rectangle *rect,
int pixel_border)
{
Rectangle r;
- real size = ddisplay_untransform_length(ddisp, pixel_border+1);
+ real size = dia_display_untransform_length(ddisp, pixel_border+1);
r.left = rect->left-size;
r.top = rect->top-size;
r.right = rect->right+size;
r.bottom = rect->bottom+size;
- ddisplay_add_update(ddisp, &r);
+ dia_display_add_update(ddisp, &r);
}
void
-ddisplay_add_update(DDisplay *ddisp, const Rectangle *rect)
+dia_display_add_update(DiaDisplay *ddisp, const Rectangle *rect)
{
Rectangle *r;
- int width, height;
if (!ddisp->renderer)
return; /* can happen at creation time of the diagram */
- width = dia_renderer_get_width_pixels (ddisp->renderer);
- height = dia_renderer_get_height_pixels (ddisp->renderer);
if (!rectangle_intersects(rect, &ddisp->visible))
return;
@@ -463,7 +542,7 @@ ddisplay_add_update(DDisplay *ddisp, const Rectangle *rect)
}
void
-ddisplay_flush(DDisplay *ddisp)
+dia_display_flush(DiaDisplay *ddisp)
{
/* if no update is queued, queue update
*
@@ -477,11 +556,11 @@ ddisplay_flush(DDisplay *ddisp)
}
static void
-ddisplay_obj_render(DiaObject *obj, DiaRenderer *renderer,
+dia_display_obj_render(DiaObject *obj, DiaRenderer *renderer,
int active_layer,
gpointer data)
{
- DDisplay *ddisp = (DDisplay *)data;
+ DiaDisplay *ddisp = (DiaDisplay *)data;
DiaInteractiveRendererInterface *irenderer =
DIA_GET_INTERACTIVE_RENDERER_INTERFACE (renderer);
DiaHighlightType hltype = data_object_get_highlight(DIA_DIAGRAM_DATA(ddisp->diagram), obj);
@@ -498,7 +577,7 @@ ddisplay_obj_render(DiaObject *obj, DiaRenderer *renderer,
}
void
-ddisplay_render_pixmap(DDisplay *ddisp, Rectangle *update)
+dia_display_render_pixmap(DiaDisplay *ddisp, Rectangle *update)
{
GList *list;
DiaObject *obj;
@@ -521,8 +600,8 @@ ddisplay_render_pixmap(DDisplay *ddisp, Rectangle *update)
if (update) {
int x0, y0, x1, y1;
- ddisplay_transform_coords (ddisp, update->left, update->top, &x0, &y0);
- ddisplay_transform_coords (ddisp, update->right, update->bottom, &x1, &y1);
+ dia_display_transform_coords (ddisp, update->left, update->top, &x0, &y0);
+ dia_display_transform_coords (ddisp, update->right, update->bottom, &x1, &y1);
renderer->fill_pixel_rect (ddisp->renderer,
x0, y0, x1-x0, y1-y0,
&ddisp->diagram->data->bg_color);
@@ -541,7 +620,7 @@ ddisplay_render_pixmap(DDisplay *ddisp, Rectangle *update)
timer = g_timer_new();
#endif
data_render(ddisp->diagram->data, ddisp->renderer, update,
- ddisplay_obj_render, (gpointer) ddisp);
+ dia_display_obj_render, (gpointer) ddisp);
#ifdef TRACES
g_print ("data_render(%g%%) took %g seconds\n", ddisp->zoom_factor * 5.0, g_timer_elapsed (timer, NULL));
g_timer_destroy (timer);
@@ -560,7 +639,7 @@ ddisplay_render_pixmap(DDisplay *ddisp, Rectangle *update)
}
void
-ddisplay_update_scrollbars(DDisplay *ddisp)
+dia_display_update_scrollbars(DiaDisplay *ddisp)
{
Rectangle *extents = &ddisp->diagram->data->extents;
Rectangle *visible = &ddisp->visible;
@@ -592,7 +671,7 @@ ddisplay_update_scrollbars(DDisplay *ddisp)
}
void
-ddisplay_set_origo(DDisplay *ddisp, coord x, coord y)
+dia_display_set_origo(DiaDisplay *ddisp, coord x, coord y)
{
Rectangle *extents = &ddisp->diagram->data->extents;
Rectangle *visible = &ddisp->visible;
@@ -615,14 +694,14 @@ ddisplay_set_origo(DDisplay *ddisp, coord x, coord y)
visible->left = ddisp->origo.x;
visible->top = ddisp->origo.y;
- visible->right = ddisp->origo.x + ddisplay_untransform_length(ddisp, width);
- visible->bottom = ddisp->origo.y + ddisplay_untransform_length(ddisp, height);
+ visible->right = ddisp->origo.x + dia_display_untransform_length(ddisp, width);
+ visible->bottom = ddisp->origo.y + dia_display_untransform_length(ddisp, height);
- ddisplay_update_rulers (ddisp, extents, visible);
+ dia_display_update_rulers (ddisp, extents, visible);
}
void
-ddisplay_zoom(DDisplay *ddisp, Point *point, real magnify)
+dia_display_zoom(DiaDisplay *ddisp, Point *point, real magnify)
{
Rectangle *visible;
real width, height, old_zoom;
@@ -649,11 +728,11 @@ ddisplay_zoom(DDisplay *ddisp, Point *point, real magnify)
height = (visible->bottom - visible->top)/magnify;
- ddisplay_set_origo(ddisp, point->x - width/2.0, point->y - height/2.0);
+ dia_display_set_origo(ddisp, point->x - width/2.0, point->y - height/2.0);
- ddisplay_update_scrollbars(ddisp);
- ddisplay_add_update_all(ddisp);
- ddisplay_flush(ddisp);
+ dia_display_update_scrollbars(ddisp);
+ dia_display_add_update_all(ddisp);
+ dia_display_flush(ddisp);
update_zoom_status (ddisp);
}
@@ -661,7 +740,7 @@ ddisplay_zoom(DDisplay *ddisp, Point *point, real magnify)
/* Zoom around the middle point of the visible area
*/
void
-ddisplay_zoom_middle(DDisplay *ddisp, real magnify)
+dia_display_zoom_middle(DiaDisplay *ddisp, real magnify)
{
Point middle;
Rectangle *visible;
@@ -670,7 +749,7 @@ ddisplay_zoom_middle(DDisplay *ddisp, real magnify)
middle.x = visible->left*0.5 + visible->right*0.5;
middle.y = visible->top*0.5 + visible->bottom*0.5;
- ddisplay_zoom (ddisp, &middle, magnify);
+ dia_display_zoom (ddisp, &middle, magnify);
}
/*
@@ -680,7 +759,7 @@ ddisplay_zoom_middle(DDisplay *ddisp, real magnify)
from "jumping" around while zooming in and out.
*/
void
-ddisplay_zoom_centered(DDisplay *ddisp, Point *point, real magnify)
+dia_display_zoom_centered(DiaDisplay *ddisp, Point *point, real magnify)
{
Rectangle *visible;
real width, height;
@@ -704,11 +783,11 @@ ddisplay_zoom_centered(DDisplay *ddisp, Point *point, real magnify)
ddisp->zoom_factor *= magnify;
/* set new origin based on the calculated ratios before zooming */
- ddisplay_set_origo(ddisp, point->x-(width*rx),point->y-(height*ry));
+ dia_display_set_origo(ddisp, point->x-(width*rx),point->y-(height*ry));
- ddisplay_update_scrollbars(ddisp);
- ddisplay_add_update_all(ddisp);
- ddisplay_flush(ddisp);
+ dia_display_update_scrollbars(ddisp);
+ dia_display_add_update_all(ddisp);
+ dia_display_flush(ddisp);
update_zoom_status (ddisp);
}
@@ -716,7 +795,7 @@ ddisplay_zoom_centered(DDisplay *ddisp, Point *point, real magnify)
/** Set the display's snap-to-grid setting, updating menu and button
* in the process */
void
-ddisplay_set_snap_to_grid(DDisplay *ddisp, gboolean snap)
+dia_display_set_snap_to_grid(DiaDisplay *ddisp, gboolean snap)
{
GtkToggleAction *snap_to_grid;
ddisp->grid.snap = snap;
@@ -726,12 +805,12 @@ ddisplay_set_snap_to_grid(DDisplay *ddisp, gboolean snap)
integrated_ui_toolbar_grid_snap_synchronize_to_display (ddisp);
/* Currently, this can cause double emit, but that's a small problem. */
gtk_toggle_action_set_active (snap_to_grid, ddisp->grid.snap);
- ddisplay_update_statusbar(ddisp);
+ dia_display_update_statusbar(ddisp);
}
/** Update the button showing whether snap-to-grid is on */
static void
-update_snap_grid_status(DDisplay *ddisp)
+update_snap_grid_status(DiaDisplay *ddisp)
{
if (ddisp->grid_status)
{
@@ -743,7 +822,7 @@ update_snap_grid_status(DDisplay *ddisp)
/** Set the display's mainpoint magnetism setting, updating menu and button
* in the process */
void
-ddisplay_set_snap_to_objects(DDisplay *ddisp, gboolean magnetic)
+dia_display_set_snap_to_objects(DiaDisplay *ddisp, gboolean magnetic)
{
GtkToggleAction *mainpoint_magnetism;
ddisp->mainpoint_magnetism = magnetic;
@@ -753,12 +832,12 @@ ddisplay_set_snap_to_objects(DDisplay *ddisp, gboolean magnetic)
integrated_ui_toolbar_object_snap_synchronize_to_display (ddisp);
/* Currently, this can cause double emit, but that's a small problem. */
gtk_toggle_action_set_active (mainpoint_magnetism, ddisp->mainpoint_magnetism);
- ddisplay_update_statusbar(ddisp);
+ dia_display_update_statusbar(ddisp);
}
/** Update the button showing whether mainpoint magnetism is on */
static void
-update_mainpoint_status(DDisplay *ddisp)
+update_mainpoint_status(DiaDisplay *ddisp)
{
if (ddisp->mainpoint_status)
{
@@ -769,7 +848,7 @@ update_mainpoint_status(DDisplay *ddisp)
/** Scroll display to where point x,y (window coords) is visible */
gboolean
-ddisplay_autoscroll(DDisplay *ddisp, int x, int y)
+dia_display_autoscroll(DiaDisplay *ddisp, int x, int y)
{
guint16 width, height;
Point scroll;
@@ -806,13 +885,13 @@ ddisplay_autoscroll(DDisplay *ddisp, int x, int y)
{
gboolean scrolled;
- scroll.x = ddisplay_untransform_length(ddisp, scroll.x);
- scroll.y = ddisplay_untransform_length(ddisp, scroll.y);
+ scroll.x = dia_display_untransform_length(ddisp, scroll.x);
+ scroll.y = dia_display_untransform_length(ddisp, scroll.y);
- scrolled = ddisplay_scroll(ddisp, &scroll);
+ scrolled = dia_display_scroll(ddisp, &scroll);
if (scrolled) {
- ddisplay_flush(ddisp);
+ dia_display_flush(ddisp);
return TRUE;
}
}
@@ -821,7 +900,7 @@ ddisplay_autoscroll(DDisplay *ddisp, int x, int y)
/** Scroll the display by delta (diagram coords) */
gboolean
-ddisplay_scroll(DDisplay *ddisp, Point *delta)
+dia_display_scroll(DiaDisplay *ddisp, Point *delta)
{
Rectangle *visible = &ddisp->visible;
real width = visible->right - visible->left;
@@ -850,58 +929,58 @@ ddisplay_scroll(DDisplay *ddisp, Point *delta)
if ( (new_origo.x != ddisp->origo.x) ||
(new_origo.y != ddisp->origo.y) ) {
- ddisplay_set_origo(ddisp, new_origo.x, new_origo.y);
- ddisplay_update_scrollbars(ddisp);
- ddisplay_add_update_all(ddisp);
+ dia_display_set_origo(ddisp, new_origo.x, new_origo.y);
+ dia_display_update_scrollbars(ddisp);
+ dia_display_add_update_all(ddisp);
return TRUE;
}
return FALSE;
}
-void ddisplay_scroll_up(DDisplay *ddisp)
+void dia_display_scroll_up(DiaDisplay *ddisp)
{
Point delta;
delta.x = 0;
delta.y = -(ddisp->visible.bottom - ddisp->visible.top)/4.0;
- ddisplay_scroll(ddisp, &delta);
+ dia_display_scroll(ddisp, &delta);
}
-void ddisplay_scroll_down(DDisplay *ddisp)
+void dia_display_scroll_down(DiaDisplay *ddisp)
{
Point delta;
delta.x = 0;
delta.y = (ddisp->visible.bottom - ddisp->visible.top)/4.0;
- ddisplay_scroll(ddisp, &delta);
+ dia_display_scroll(ddisp, &delta);
}
-void ddisplay_scroll_left(DDisplay *ddisp)
+void dia_display_scroll_left(DiaDisplay *ddisp)
{
Point delta;
delta.x = -(ddisp->visible.right - ddisp->visible.left)/4.0;
delta.y = 0;
- ddisplay_scroll(ddisp, &delta);
+ dia_display_scroll(ddisp, &delta);
}
-void ddisplay_scroll_right(DDisplay *ddisp)
+void dia_display_scroll_right(DiaDisplay *ddisp)
{
Point delta;
delta.x = (ddisp->visible.right - ddisp->visible.left)/4.0;
delta.y = 0;
- ddisplay_scroll(ddisp, &delta);
+ dia_display_scroll(ddisp, &delta);
}
/** Scroll display to have the diagram point p at the center.
* Returns TRUE if anything changed. */
gboolean
-ddisplay_scroll_center_point(DDisplay *ddisp, Point *p)
+dia_display_scroll_center_point(DiaDisplay *ddisp, Point *p)
{
Point center;
@@ -911,13 +990,13 @@ ddisplay_scroll_center_point(DDisplay *ddisp, Point *p)
center.y = (ddisp->visible.top+ddisp->visible.bottom)/2;
point_sub(p, ¢er);
- return ddisplay_scroll(ddisp, p);
+ return dia_display_scroll(ddisp, p);
}
/** Scroll display so that obj is centered.
* Returns TRUE if anything changed. */
gboolean
-ddisplay_scroll_to_object(DDisplay *ddisp, DiaObject *obj)
+dia_display_scroll_to_object(DiaDisplay *ddisp, DiaObject *obj)
{
Rectangle r = obj->bounding_box;
@@ -926,13 +1005,13 @@ ddisplay_scroll_to_object(DDisplay *ddisp, DiaObject *obj)
p.y = (r.top+r.bottom)/2;
display_set_active(ddisp);
- return ddisplay_scroll_center_point(ddisp, &p);
+ return dia_display_scroll_center_point(ddisp, &p);
}
/** Ensure the object is visible but minimize scrolling
*/
gboolean
-ddisplay_present_object(DDisplay *ddisp, DiaObject *obj)
+dia_display_present_object(DiaDisplay *ddisp, DiaObject *obj)
{
const Rectangle *r = dia_object_get_enclosing_box(obj);
const Rectangle *v = &ddisp->visible;
@@ -955,7 +1034,7 @@ ddisplay_present_object(DDisplay *ddisp, DiaObject *obj)
else if (r->bottom > v->bottom)
delta.y = r->bottom - v->bottom;
- ddisplay_scroll(ddisp, &delta);
+ dia_display_scroll(ddisp, &delta);
return TRUE;
}
return FALSE;
@@ -965,11 +1044,11 @@ ddisplay_present_object(DDisplay *ddisp, DiaObject *obj)
* Remember the last clicked point given in pixel coodinates
*/
void
-ddisplay_set_clicked_point(DDisplay *ddisp, int x, int y)
+dia_display_set_clicked_point(DiaDisplay *ddisp, int x, int y)
{
Point pt;
- ddisplay_untransform_coords(ddisp, x, y, &pt.x, &pt.y);
+ dia_display_untransform_coords(ddisp, x, y, &pt.x, &pt.y);
ddisp->clicked_position = pt;
}
@@ -977,13 +1056,13 @@ ddisplay_set_clicked_point(DDisplay *ddisp, int x, int y)
/*! Get the last clicked point in diagram coordinates
*/
Point
-ddisplay_get_clicked_position(DDisplay *ddisp)
+dia_display_get_clicked_position(DiaDisplay *ddisp)
{
return ddisp->clicked_position;
}
void
-ddisplay_set_renderer(DDisplay *ddisp, int aa_renderer)
+dia_display_set_renderer(DiaDisplay *ddisp, int aa_renderer)
{
int width, height;
GdkWindow *window = gtk_widget_get_window(ddisp->canvas);
@@ -1012,7 +1091,7 @@ ddisplay_set_renderer(DDisplay *ddisp, int aa_renderer)
}
void
-ddisplay_resize_canvas(DDisplay *ddisp,
+dia_display_resize_canvas(DiaDisplay *ddisp,
int width, int height)
{
if (ddisp->renderer==NULL) {
@@ -1028,57 +1107,33 @@ ddisplay_resize_canvas(DDisplay *ddisp,
dia_renderer_set_size(ddisp->renderer, gtk_widget_get_window(ddisp->canvas), width, height);
- ddisplay_set_origo(ddisp, ddisp->origo.x, ddisp->origo.y);
+ dia_display_set_origo(ddisp, ddisp->origo.x, ddisp->origo.y);
- ddisplay_add_update_all(ddisp);
- ddisplay_flush(ddisp);
+ dia_display_add_update_all(ddisp);
+ dia_display_flush(ddisp);
}
-DDisplay *
-ddisplay_active(void)
+DiaDisplay *
+dia_display_active(void)
{
return active_display;
}
Diagram *
-ddisplay_active_diagram(void)
+dia_display_active_diagram(void)
{
- DDisplay *ddisp = ddisplay_active ();
+ DiaDisplay *ddisp = dia_display_active ();
if (!ddisp) return NULL;
return ddisp->diagram;
}
-void
-ddisp_destroy(DDisplay *ddisp)
-{
- g_signal_handlers_disconnect_by_func (ddisp->diagram, selection_changed, ddisp);
-
- g_object_unref (G_OBJECT (ddisp->im_context));
- ddisp->im_context = NULL;
-
- ddisplay_im_context_preedit_reset(ddisp, get_active_focus((DiagramData *) ddisp->diagram));
-
- if (GTK_WINDOW(ddisp->shell) == gtk_window_get_transient_for(GTK_WINDOW(interface_get_toolbox_shell()))) {
- /* we have to break the connection otherwise the toolbox will be closed */
- gtk_window_set_transient_for(GTK_WINDOW(interface_get_toolbox_shell()), NULL);
- }
-
- /* This calls ddisplay_really_destroy */
- if (ddisp->is_standalone_window)
- gtk_widget_destroy (ddisp->shell);
- else {
- gtk_widget_destroy (ddisp->container);
- ddisplay_really_destroy (ddisp);
- }
-}
-
static void
are_you_sure_close_dialog_respond(GtkWidget *widget, /* the dialog */
gint response_id,
gpointer user_data) /* the display */
{
- DDisplay *ddisp = (DDisplay *)user_data;
+ DiaDisplay *ddisp = (DiaDisplay *)user_data;
gboolean close_ddisp = TRUE;
switch (response_id) {
@@ -1088,7 +1143,7 @@ are_you_sure_close_dialog_respond(GtkWidget *widget, /* the dialog */
/* we have to open the file dlg, close this one first */
gtk_widget_destroy(widget);
if (file_save_as(ddisp->diagram, ddisp))
- ddisp_destroy (ddisp);
+ g_object_unref (ddisp);
/* no way back */
return;
} else {
@@ -1103,7 +1158,7 @@ are_you_sure_close_dialog_respond(GtkWidget *widget, /* the dialog */
/* fall through */
case GTK_RESPONSE_NO :
if (close_ddisp)
- ddisp_destroy (ddisp);
+ g_object_unref (ddisp);
/* fall through */
case GTK_RESPONSE_CANCEL :
case GTK_RESPONSE_NONE :
@@ -1116,7 +1171,7 @@ are_you_sure_close_dialog_respond(GtkWidget *widget, /* the dialog */
}
void
-ddisplay_close(DDisplay *ddisp)
+dia_display_close (DiaDisplay *ddisp)
{
Diagram *dia;
GtkWidget *dialog, *button;
@@ -1128,7 +1183,7 @@ ddisplay_close(DDisplay *ddisp)
if ( (g_slist_length(dia->displays) > 1) ||
(!diagram_is_modified(dia)) ) {
- ddisp_destroy(ddisp);
+ g_object_unref (ddisp);
return;
}
@@ -1159,14 +1214,14 @@ ddisplay_close(DDisplay *ddisp)
gtk_dialog_set_default_response (GTK_DIALOG(dialog), GTK_RESPONSE_YES);
g_signal_connect (G_OBJECT (dialog), "response",
- G_CALLBACK(are_you_sure_close_dialog_respond),
- ddisp);
+ G_CALLBACK (are_you_sure_close_dialog_respond),
+ ddisp);
gtk_widget_show_all(dialog);
}
void
-display_update_menu_state(DDisplay *ddisp)
+display_update_menu_state(DiaDisplay *ddisp)
{
GtkToggleAction *rulers;
GtkToggleAction *visible_grid;
@@ -1184,7 +1239,7 @@ display_update_menu_state(DDisplay *ddisp)
gtk_action_set_sensitive (menus_get_action ("ViewAntialiased"),
g_type_from_name ("DiaCairoInteractiveRenderer") != 0);
- ddisplay_do_update_menu_sensitivity (ddisp);
+ dia_display_do_update_menu_sensitivity (ddisp);
gtk_toggle_action_set_active (rulers, display_get_rulers_showing(ddisp));
@@ -1204,7 +1259,7 @@ display_update_menu_state(DDisplay *ddisp)
}
void
-ddisplay_do_update_menu_sensitivity (DDisplay *ddisp)
+dia_display_do_update_menu_sensitivity (DiaDisplay *ddisp)
{
Diagram *dia;
@@ -1217,34 +1272,8 @@ ddisplay_do_update_menu_sensitivity (DDisplay *ddisp)
diagram_update_menu_sensitivity (dia);
}
-
-
-/* This is called when ddisp->shell is destroyed... */
-void
-ddisplay_really_destroy(DDisplay *ddisp)
-{
- if (active_display == ddisp)
- display_set_active(NULL);
-
- if (ddisp->diagram) {
- diagram_remove_ddisplay(ddisp->diagram, ddisp);
- /* if we are the last user of the diagram it will be unref'ed */
- g_object_unref(ddisp->diagram);
- ddisp->diagram = NULL;
- }
-
- g_object_unref (ddisp->renderer);
- ddisp->renderer = NULL;
-
- /* Free update_areas list: */
- ddisplay_free_update_areas(ddisp);
-
- g_free(ddisp);
-}
-
-
void
-ddisplay_set_title(DDisplay *ddisp, char *title)
+dia_display_set_title (DiaDisplay *ddisp, char *title)
{
if (ddisp->is_standalone_window)
gtk_window_set_title (GTK_WINDOW (ddisp->shell), title);
@@ -1256,15 +1285,13 @@ ddisplay_set_title(DDisplay *ddisp, char *title)
gint num_pages = gtk_notebook_get_n_pages (notebook);
gint num;
GtkWidget *page;
- for (num = 0 ; num < num_pages ; num++)
- {
- page = gtk_notebook_get_nth_page (notebook,num);
- if (g_object_get_data (G_OBJECT (page), "DDisplay") == ddisp)
- {
- GtkLabel *label = g_object_get_data (G_OBJECT (page), "tab-label");
+ for (num = 0 ; num < num_pages ; num++) {
+ page = gtk_notebook_get_nth_page (notebook, num);
+ if (g_object_get_data (G_OBJECT (page), DIA_DISPLAY_DATA_HACK) == ddisp) {
+ GtkWidget *label = gtk_notebook_get_tab_label (GTK_NOTEBOOK (notebook), page);
/* not using the passed in title here, because it may be too long */
- gchar *name = diagram_get_name(ddisp->diagram);
- gtk_label_set_text(label,name);
+ gchar *name = diagram_get_name (ddisp->diagram);
+ gtk_label_set_label (GTK_LABEL (label), name);
g_free(name);
break;
}
@@ -1280,10 +1307,10 @@ ddisplay_set_title(DDisplay *ddisp, char *title)
}
void
-ddisplay_set_all_cursor(GdkCursor *cursor)
+dia_display_set_all_cursor(GdkCursor *cursor)
{
Diagram *dia;
- DDisplay *ddisp;
+ DiaDisplay *ddisp;
GList *list;
GSList *slist;
@@ -1295,9 +1322,9 @@ ddisplay_set_all_cursor(GdkCursor *cursor)
slist = dia->displays;
while (slist != NULL) {
- ddisp = (DDisplay *) slist->data;
+ ddisp = (DiaDisplay *) slist->data;
- ddisplay_set_cursor(ddisp, cursor);
+ dia_display_set_cursor(ddisp, cursor);
slist = g_slist_next(slist);
}
@@ -1307,7 +1334,7 @@ ddisplay_set_all_cursor(GdkCursor *cursor)
}
void
-ddisplay_set_cursor(DDisplay *ddisp, GdkCursor *cursor)
+dia_display_set_cursor(DiaDisplay *ddisp, GdkCursor *cursor)
{
if (gtk_widget_get_window(ddisp->canvas))
gdk_window_set_cursor(gtk_widget_get_window(ddisp->canvas), cursor);
@@ -1315,7 +1342,7 @@ ddisplay_set_cursor(DDisplay *ddisp, GdkCursor *cursor)
/** Returns whether the rulers are currently showing on the display.
*/
-gboolean display_get_rulers_showing(DDisplay *ddisp) {
+gboolean display_get_rulers_showing(DiaDisplay *ddisp) {
return ddisp->rulers_are_showing;
}
@@ -1327,7 +1354,7 @@ gboolean display_get_rulers_showing(DDisplay *ddisp) {
* when GTK_WIDGET_IS_VISIBLE(w) will indicate true.
* @param ddisp The display to show the rulers on.
*/
-void display_rulers_show (DDisplay *ddisp)
+void display_rulers_show (DiaDisplay *ddisp)
{
if (ddisp)
{
@@ -1351,7 +1378,7 @@ void display_rulers_show (DDisplay *ddisp)
* when GTK_WIDGET_IS_VISIBLE(w) will indicate false.
* @param ddisp The display to hide the rulers on.
*/
-void display_rulers_hide (DDisplay *ddisp)
+void display_rulers_hide (DiaDisplay *ddisp)
{
if (ddisp)
{
@@ -1369,7 +1396,7 @@ void display_rulers_hide (DDisplay *ddisp)
}
void
-ddisplay_update_statusbar(DDisplay *ddisp)
+dia_display_update_statusbar(DiaDisplay *ddisp)
{
update_zoom_status (ddisp);
update_snap_grid_status (ddisp);
@@ -1377,7 +1404,7 @@ ddisplay_update_statusbar(DDisplay *ddisp)
}
void
-display_set_active(DDisplay *ddisp)
+display_set_active(DiaDisplay *ddisp)
{
if (ddisp != active_display) {
active_display = ddisp;
@@ -1408,7 +1435,7 @@ display_set_active(DDisplay *ddisp)
for (num = 0 ; num < num_pages ; num++)
{
page = gtk_notebook_get_nth_page (notebook,num);
- if (g_object_get_data (G_OBJECT (page), "DDisplay") == ddisp)
+ if (g_object_get_data (G_OBJECT (page), DIA_DISPLAY_DATA_HACK) == ddisp)
{
gtk_notebook_set_current_page (notebook,num);
break;
@@ -1422,10 +1449,10 @@ display_set_active(DDisplay *ddisp)
update_zoom_status (ddisp);
/* Snap to grid */
- ddisplay_set_snap_to_grid (ddisp, ddisp->grid.snap); /* menus */
+ dia_display_set_snap_to_grid (ddisp, ddisp->grid.snap); /* menus */
/* Object snapping */
- ddisplay_set_snap_to_objects (ddisp, ddisp->mainpoint_magnetism);
+ dia_display_set_snap_to_objects (ddisp, ddisp->mainpoint_magnetism);
display_update_menu_state (ddisp);
@@ -1440,7 +1467,7 @@ display_set_active(DDisplay *ddisp)
}
void
-ddisplay_im_context_preedit_reset(DDisplay *ddisp, Focus *focus)
+dia_display_im_context_preedit_reset(DiaDisplay *ddisp, Focus *focus)
{
if (ddisp->preedit_string != NULL) {
if (focus != NULL) {
@@ -1469,7 +1496,7 @@ ddisplay_im_context_preedit_reset(DDisplay *ddisp, Focus *focus)
* focus is active (i.e. no text is being edited).
*/
Focus *
-ddisplay_active_focus(DDisplay *ddisp)
+dia_display_active_focus(DiaDisplay *ddisp)
{
/* The functions doing the transition rely on this being slightly
* out of sync with get_active_focus(). But we would not need the
@@ -1488,13 +1515,13 @@ ddisplay_active_focus(DDisplay *ddisp)
* this display.
*/
void
-ddisplay_set_active_focus(DDisplay *ddisp, Focus *focus)
+dia_display_set_active_focus(DiaDisplay *ddisp, Focus *focus)
{
ddisp->active_focus = focus;
}
void
-ddisplay_show_all (DDisplay *ddisp)
+dia_display_show_all (DiaDisplay *ddisp)
{
Diagram *dia;
real magnify_x, magnify_y;
@@ -1534,10 +1561,10 @@ ddisplay_show_all (DDisplay *ddisp)
(dia->data->extents.bottom - dia->data->extents.top) / 2.0;
}
- ddisplay_zoom (ddisp, &middle,
+ dia_display_zoom (ddisp, &middle,
((magnify_x<magnify_y)?magnify_x:magnify_y)/1.05);
- ddisplay_update_scrollbars(ddisp);
- ddisplay_add_update_all(ddisp);
- ddisplay_flush(ddisp);
+ dia_display_update_scrollbars(ddisp);
+ dia_display_add_update_all(ddisp);
+ dia_display_flush(ddisp);
}
diff --git a/app/display.h b/app/display.h
index ad373c87..e67ee8f3 100644
--- a/app/display.h
+++ b/app/display.h
@@ -20,10 +20,11 @@
#include <gtk/gtk.h>
-typedef struct _DDisplay DDisplay;
-
#include "geometry.h"
#include "diagram.h"
+
+typedef struct _DiaDisplay DiaDisplay;
+
#include "grid.h"
#include "diarenderer.h"
@@ -37,6 +38,8 @@ G_BEGIN_DECLS
#define DDISPLAY_NORMAL_ZOOM 20.0
#define DDISPLAY_MIN_ZOOM 0.2
+#define DIA_DISPLAY_DATA_HACK "DiaDisplay"
+
/* The zoom amount should be uniform. Pixels per cm should be defined by the
* renderer alone. But that'd take a lot of fiddling in renderers. */
/*
@@ -44,7 +47,9 @@ G_BEGIN_DECLS
#define DDISPLAY_NORMAL_ZOOM 1.0
#define DDISPLAY_MIN_ZOOM 0.01
*/
-struct _DDisplay {
+struct _DiaDisplay {
+ GObject parent;
+
Diagram *diagram; /* pointer to the associated diagram */
GtkWidget *shell; /* shell widget for this ddisplay */
@@ -59,7 +64,7 @@ struct _DDisplay {
/* menu bar widgets */
GtkMenuItem *rulers;
- GtkWidget *zoom_status;
+ GtkWidget *zoom_status;
GtkWidget *grid_status;
GtkWidget *mainpoint_status;
GtkWidget *modified_status;
@@ -75,7 +80,7 @@ struct _DDisplay {
Grid grid; /* the grid in this display */
- gboolean show_cx_pts; /* Connection points toggle boolean */
+ gboolean show_cx_pts; /* Connection points toggle boolean */
gboolean autoscroll;
gboolean mainpoint_magnetism; /* Mainpoints snapped from entire obj*/
@@ -112,99 +117,90 @@ struct _DDisplay {
extern GdkCursor *default_cursor;
-typedef struct _DDisplayBox DDisplayBox;
-
-struct _DDisplayBox {
- DDisplay *ddisp;
-};
-
-#define DIA_TYPE_DISPLAY (ddisplay_get_type ())
+#define DIA_TYPE_DISPLAY (dia_display_get_type ())
+G_DECLARE_FINAL_TYPE (DiaDisplay, dia_display, DIA, DISPLAY, GObject)
-DDisplay *new_display (Diagram *dia);
-DDisplay *copy_display (DDisplay *orig_ddisp);
-void ddisp_destroy (DDisplay *ddisp);
-GType ddisplay_get_type ();
-DDisplayBox *display_box_new (DDisplay *ddisp);
+DiaDisplay *dia_display_new (Diagram *diagram);
+DiaDisplay *dia_display_copy (DiaDisplay *self);
/* Normal destroy is done through shell widget destroy event. */
-void ddisplay_really_destroy(DDisplay *ddisp);
-void ddisplay_transform_coords_double(DDisplay *ddisp,
+void dia_display_transform_coords_double(DiaDisplay *ddisp,
coord x, coord y,
double *xi, double *yi);
-void ddisplay_transform_coords(DDisplay *ddisp,
+void dia_display_transform_coords(DiaDisplay *ddisp,
coord x, coord y,
int *xi, int *yi);
-void ddisplay_untransform_coords(DDisplay *ddisp,
+void dia_display_untransform_coords(DiaDisplay *ddisp,
int xi, int yi,
coord *x, coord *y);
-real ddisplay_transform_length(DDisplay *ddisp, real len);
-real ddisplay_untransform_length(DDisplay *ddisp, real len);
-void ddisplay_add_update_pixels(DDisplay *ddisp, Point *point,
+real dia_display_transform_length(DiaDisplay *ddisp, real len);
+real dia_display_untransform_length(DiaDisplay *ddisp, real len);
+void dia_display_add_update_pixels(DiaDisplay *ddisp, Point *point,
int pixel_width, int pixel_height);
-void ddisplay_add_update_all(DDisplay *ddisp);
-void ddisplay_add_update_with_border(DDisplay *ddisp, const Rectangle *rect,
+void dia_display_add_update_all(DiaDisplay *ddisp);
+void dia_display_add_update_with_border(DiaDisplay *ddisp, const Rectangle *rect,
int pixel_border);
-void ddisplay_add_update(DDisplay *ddisp, const Rectangle *rect);
-void ddisplay_flush(DDisplay *ddisp);
-void ddisplay_update_scrollbars(DDisplay *ddisp);
-void ddisplay_set_origo(DDisplay *ddisp,
+void dia_display_add_update(DiaDisplay *ddisp, const Rectangle *rect);
+void dia_display_flush(DiaDisplay *ddisp);
+void dia_display_update_scrollbars(DiaDisplay *ddisp);
+void dia_display_set_origo(DiaDisplay *ddisp,
coord x, coord y);
-void ddisplay_zoom(DDisplay *ddisp, Point *point,
+void dia_display_zoom(DiaDisplay *ddisp, Point *point,
real zoom_factor);
-void ddisplay_zoom_middle(DDisplay *ddisp, real magnify);
+void dia_display_zoom_middle(DiaDisplay *ddisp, real magnify);
-void ddisplay_zoom_centered(DDisplay *ddisp, Point *point, real magnify);
-void ddisplay_set_snap_to_grid(DDisplay *ddisp, gboolean snap);
-void ddisplay_set_snap_to_objects(DDisplay *ddisp, gboolean magnetic);
-void ddisplay_set_renderer(DDisplay *ddisp, int aa_renderer);
-void ddisplay_resize_canvas(DDisplay *ddisp,
+void dia_display_zoom_centered(DiaDisplay *ddisp, Point *point, real magnify);
+void dia_display_set_snap_to_grid(DiaDisplay *ddisp, gboolean snap);
+void dia_display_set_snap_to_objects(DiaDisplay *ddisp, gboolean magnetic);
+void dia_display_set_renderer(DiaDisplay *ddisp, int aa_renderer);
+void dia_display_resize_canvas(DiaDisplay *ddisp,
int width,
int height);
-void ddisplay_render_pixmap(DDisplay *ddisp, Rectangle *update);
+void dia_display_render_pixmap(DiaDisplay *ddisp, Rectangle *update);
-DDisplay *ddisplay_active(void);
-Diagram *ddisplay_active_diagram(void);
+DiaDisplay *dia_display_active(void);
+Diagram *dia_display_active_diagram(void);
-void ddisplay_close(DDisplay *ddisp);
+void dia_display_close(DiaDisplay *ddisp);
-void ddisplay_set_title(DDisplay *ddisp, char *title);
-void ddisplay_set_cursor(DDisplay *ddisp, GdkCursor *cursor);
-void ddisplay_set_all_cursor(GdkCursor *cursor);
+void dia_display_set_title(DiaDisplay *ddisp, char *title);
+void dia_display_set_cursor(DiaDisplay *ddisp, GdkCursor *cursor);
+void dia_display_set_all_cursor(GdkCursor *cursor);
-void ddisplay_set_clicked_point(DDisplay *ddisp, int x, int y);
-Point ddisplay_get_clicked_position(DDisplay *ddisp);
+void dia_display_set_clicked_point(DiaDisplay *ddisp, int x, int y);
+Point dia_display_get_clicked_position(DiaDisplay *ddisp);
-gboolean display_get_rulers_showing(DDisplay *ddisp);
-void display_rulers_show (DDisplay *ddisp);
-void display_rulers_hide (DDisplay *ddisp);
-void ddisplay_update_rulers (DDisplay *ddisp, const Rectangle *extents, const Rectangle *visible);
+gboolean display_get_rulers_showing(DiaDisplay *ddisp);
+void display_rulers_show (DiaDisplay *ddisp);
+void display_rulers_hide (DiaDisplay *ddisp);
+void dia_display_update_rulers (DiaDisplay *ddisp, const Rectangle *extents, const Rectangle *visible);
-gboolean ddisplay_scroll(DDisplay *ddisp, Point *delta);
-gboolean ddisplay_autoscroll(DDisplay *ddisp, int x, int y);
-void ddisplay_scroll_up(DDisplay *ddisp);
-void ddisplay_scroll_down(DDisplay *ddisp);
-void ddisplay_scroll_left(DDisplay *ddisp);
-void ddisplay_scroll_right(DDisplay *ddisp);
-gboolean ddisplay_scroll_center_point(DDisplay *ddisp, Point *p);
-gboolean ddisplay_scroll_to_object(DDisplay *ddisp, DiaObject *obj);
-gboolean ddisplay_present_object(DDisplay *ddisp, DiaObject *obj);
+gboolean dia_display_scroll(DiaDisplay *ddisp, Point *delta);
+gboolean dia_display_autoscroll(DiaDisplay *ddisp, int x, int y);
+void dia_display_scroll_up(DiaDisplay *ddisp);
+void dia_display_scroll_down(DiaDisplay *ddisp);
+void dia_display_scroll_left(DiaDisplay *ddisp);
+void dia_display_scroll_right(DiaDisplay *ddisp);
+gboolean dia_display_scroll_center_point(DiaDisplay *ddisp, Point *p);
+gboolean dia_display_scroll_to_object(DiaDisplay *ddisp, DiaObject *obj);
+gboolean dia_display_present_object(DiaDisplay *ddisp, DiaObject *obj);
-void ddisplay_show_all (DDisplay *ddisp);
+void dia_display_show_all (DiaDisplay *ddisp);
-void display_update_menu_state(DDisplay *ddisp);
-void ddisplay_update_statusbar(DDisplay *ddisp);
-void ddisplay_do_update_menu_sensitivity (DDisplay *ddisp);
+void display_update_menu_state(DiaDisplay *ddisp);
+void dia_display_update_statusbar(DiaDisplay *ddisp);
+void dia_display_do_update_menu_sensitivity (DiaDisplay *ddisp);
-void display_set_active(DDisplay *ddisp);
+void display_set_active(DiaDisplay *ddisp);
-void ddisplay_im_context_preedit_reset(DDisplay *ddisp, Focus *focus);
+void dia_display_im_context_preedit_reset(DiaDisplay *ddisp, Focus *focus);
-Focus *ddisplay_active_focus(DDisplay *ddisp);
-void ddisplay_set_active_focus(DDisplay *ddisp, Focus *focus);
+Focus *dia_display_active_focus(DiaDisplay *ddisp);
+void dia_display_set_active_focus(DiaDisplay *ddisp, Focus *focus);
-void diagram_add_ddisplay(Diagram *dia, DDisplay *ddisp);
-void diagram_remove_ddisplay(Diagram *dia, DDisplay *ddisp);
+void diagram_add_display(Diagram *dia, DiaDisplay *ddisp);
+void diagram_remove_display(Diagram *dia, DiaDisplay *ddisp);
G_END_DECLS
diff --git a/app/filedlg.c b/app/filedlg.c
index 8f6c373f..72d99c60 100644
--- a/app/filedlg.c
+++ b/app/filedlg.c
@@ -237,14 +237,14 @@ file_open_response_callback(GtkWidget *fs,
GSList *displays_head = displays;
diagram->displays = NULL;
for (; displays != NULL; displays = g_slist_next(displays)) {
- DDisplay *loaded_display = (DDisplay *)displays->data;
+ DiaDisplay *loaded_display = (DiaDisplay *)displays->data;
copy_display(loaded_display);
g_free(loaded_display);
}
g_slist_free(displays_head);
} else {
*/
- new_display(diagram);
+ dia_display_new (diagram);
}
}
}
@@ -260,7 +260,7 @@ void
file_open_callback(GtkAction *action)
{
if (!opendlg) {
- DDisplay *ddisp;
+ DiaDisplay *ddisp;
Diagram *dia = NULL;
GtkWindow *parent_window;
gchar *filename = NULL;
@@ -270,7 +270,7 @@ file_open_callback(GtkAction *action)
* <Display/File/Open. It wouldn't make any sense if invoked by
* <Toolbox>/File/Open ...
*/
- ddisp = ddisplay_active();
+ ddisp = dia_display_active();
if (ddisp) {
dia = ddisp->diagram;
parent_window = GTK_WINDOW(ddisp->shell);
@@ -425,7 +425,7 @@ file_save_as_response_callback(GtkWidget *fs,
gtk_widget_destroy(GTK_WIDGET(fs));
}
-static GtkWidget *file_save_as_dialog_prepare (Diagram *dia, DDisplay *ddisp);
+static GtkWidget *file_save_as_dialog_prepare (Diagram *dia, DiaDisplay *ddisp);
/**
* Respond to the File/Save As.. menu
@@ -437,11 +437,11 @@ static GtkWidget *file_save_as_dialog_prepare (Diagram *dia, DDisplay *ddisp);
void
file_save_as_callback(GtkAction *action)
{
- DDisplay *ddisp;
+ DiaDisplay *ddisp;
Diagram *dia;
GtkWidget *dlg;
- ddisp = ddisplay_active();
+ ddisp = dia_display_active();
if (!ddisp) return;
dia = ddisp->diagram;
@@ -451,7 +451,7 @@ file_save_as_callback(GtkAction *action)
}
gboolean
-file_save_as(Diagram *dia, DDisplay *ddisp)
+file_save_as (Diagram *dia, DiaDisplay *ddisp)
{
GtkWidget *dlg;
gint response;
@@ -467,7 +467,7 @@ file_save_as(Diagram *dia, DDisplay *ddisp)
}
static GtkWidget *
-file_save_as_dialog_prepare (Diagram *dia, DDisplay *ddisp)
+file_save_as_dialog_prepare (Diagram *dia, DiaDisplay *ddisp)
{
gchar *filename = NULL;
@@ -552,7 +552,7 @@ file_save_callback(GtkAction *action)
{
Diagram *diagram;
- diagram = ddisplay_active_diagram();
+ diagram = dia_display_active_diagram();
if (!diagram) return;
if (diagram->unsaved) {
@@ -732,11 +732,11 @@ file_export_response_callback(GtkWidget *fs,
void
file_export_callback(GtkAction *action)
{
- DDisplay *ddisp;
+ DiaDisplay *ddisp;
Diagram *dia;
gchar *filename = NULL;
- ddisp = ddisplay_active();
+ ddisp = dia_display_active();
if (!ddisp) return;
dia = ddisp->diagram;
diff --git a/app/filedlg.h b/app/filedlg.h
index ae981802..1eb3d8ff 100644
--- a/app/filedlg.h
+++ b/app/filedlg.h
@@ -29,6 +29,6 @@ void file_save_callback(GtkAction *action);
void file_save_as_callback(GtkAction *action);
void file_export_callback(GtkAction *action);
-gboolean file_save_as(Diagram *dia, DDisplay *ddisp);
+gboolean file_save_as (Diagram *dia, DiaDisplay *ddisp);
#endif
diff --git a/app/find-and-replace.c b/app/find-and-replace.c
index b545af7c..48ab47f4 100644
--- a/app/find-and-replace.c
+++ b/app/find-and-replace.c
@@ -380,7 +380,7 @@ fnr_respond (GtkWidget *widget, gint response_id, gpointer data)
{
const gchar *search = gtk_entry_get_text (g_object_get_data (G_OBJECT (widget), "search-entry"));
const gchar *replace;
- DDisplay *ddisp = (DDisplay*)data;
+ DiaDisplay *ddisp = (DiaDisplay*)data;
SearchData sd = { 0, };
sd.diagram = ddisp->diagram;
sd.flags = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON (
@@ -410,7 +410,7 @@ fnr_respond (GtkWidget *widget, gint response_id, gpointer data)
diagram_flush(ddisp->diagram);
}
diagram_select (ddisp->diagram, sd.last);
- ddisplay_present_object (ddisp, sd.last);
+ dia_display_present_object (ddisp, sd.last);
}
break;
case RESPONSE_REPLACE :
@@ -454,7 +454,7 @@ fnr_respond (GtkWidget *widget, gint response_id, gpointer data)
}
static void
-fnr_dialog_setup_common (GtkWidget *dialog, gboolean is_replace, DDisplay *ddisp)
+fnr_dialog_setup_common (GtkWidget *dialog, gboolean is_replace, DiaDisplay *ddisp)
{
GtkWidget *vbox;
GtkWidget *hbox;
@@ -524,10 +524,10 @@ fnr_dialog_setup_common (GtkWidget *dialog, gboolean is_replace, DDisplay *ddisp
void
edit_find_callback(GtkAction *action)
{
- DDisplay *ddisp;
+ DiaDisplay *ddisp;
GtkWidget *dialog;
- ddisp = ddisplay_active();
+ ddisp = dia_display_active();
if (!ddisp) return;
/* no static var, instead we are attaching the dialog to the diplay shell */
@@ -553,10 +553,10 @@ edit_find_callback(GtkAction *action)
void
edit_replace_callback(GtkAction *action)
{
- DDisplay *ddisp;
+ DiaDisplay *ddisp;
GtkWidget *dialog;
- ddisp = ddisplay_active();
+ ddisp = dia_display_active();
if (!ddisp) return;
/* no static var, instead we are attaching the dialog to the diplay shell */
diff --git a/app/grid.c b/app/grid.c
index 7ac60c0f..70f172b1 100644
--- a/app/grid.c
+++ b/app/grid.c
@@ -33,15 +33,15 @@
* grid mode.
*/
static void
-calculate_dynamic_grid(DDisplay *ddisp, real *width_x, real *width_y)
+calculate_dynamic_grid (DiaDisplay *ddisp, real *width_x, real *width_y)
{
- real zoom = ddisplay_untransform_length(ddisp, 1.0);
+ real zoom = dia_display_untransform_length (ddisp, 1.0);
real ret, tmp;
/* Twiddle zoom to make change-over appropriate */
zoom *= 5;
ret = pow(10, ceil(log10(zoom)));
/* dont' make it too small or huge (this is in pixels) */
- tmp = ddisplay_transform_length(ddisp, ret);
+ tmp = dia_display_transform_length (ddisp, ret);
if (tmp < 10.0)
ret *= 2.0;
else if (tmp > 35.0)
@@ -51,7 +51,7 @@ calculate_dynamic_grid(DDisplay *ddisp, real *width_x, real *width_y)
}
gboolean
-grid_step (DDisplay *ddisp, GtkOrientation orientation,
+grid_step (DiaDisplay *ddisp, GtkOrientation orientation,
real *start, int *ipos, gboolean *is_major)
{
real length;
@@ -69,7 +69,7 @@ grid_step (DDisplay *ddisp, GtkOrientation orientation,
if(major_count < 0) major_count -= major_lines * major_count;
major_count %= major_lines;
}
- ddisplay_transform_coords(ddisp,
+ dia_display_transform_coords(ddisp,
orientation == GTK_ORIENTATION_HORIZONTAL ? pos : 0,
orientation == GTK_ORIENTATION_VERTICAL ? pos : 0,
&x, &y);
@@ -82,7 +82,7 @@ grid_step (DDisplay *ddisp, GtkOrientation orientation,
}
static void
-grid_draw_horizontal_lines(DDisplay *ddisp, Rectangle *update, real length)
+grid_draw_horizontal_lines(DiaDisplay *ddisp, Rectangle *update, real length)
{
int x, y;
real pos;
@@ -95,8 +95,8 @@ grid_draw_horizontal_lines(DDisplay *ddisp, Rectangle *update, real length)
irenderer = DIA_GET_INTERACTIVE_RENDERER_INTERFACE (renderer);
pos = ceil( update->top / length ) * length;
- ddisplay_transform_coords(ddisp, update->left, pos, &x, &y);
- ddisplay_transform_coords(ddisp, update->right, update->bottom, &width, &height);
+ dia_display_transform_coords(ddisp, update->left, pos, &x, &y);
+ dia_display_transform_coords(ddisp, update->right, update->bottom, &width, &height);
/*
Explanatory note from Lawrence Withers (lwithers users sf net):
@@ -120,18 +120,18 @@ grid_draw_horizontal_lines(DDisplay *ddisp, Rectangle *update, real length)
DIA_RENDERER_GET_CLASS(renderer)->set_linestyle(renderer, LINESTYLE_SOLID, 0.0);
else
DIA_RENDERER_GET_CLASS(renderer)->set_linestyle(renderer, LINESTYLE_DOTTED,
- ddisplay_untransform_length(ddisp, 31));
+ dia_display_untransform_length(ddisp, 31));
major_count = (major_count+1)%major_lines;
}
irenderer->draw_pixel_line(renderer, x, y, width, y,
&ddisp->diagram->grid.colour);
pos += length;
- ddisplay_transform_coords(ddisp, update->left, pos, &x, &y);
+ dia_display_transform_coords(ddisp, update->left, pos, &x, &y);
}
}
static void
-grid_draw_vertical_lines(DDisplay *ddisp, Rectangle *update, real length)
+grid_draw_vertical_lines(DiaDisplay *ddisp, Rectangle *update, real length)
{
int x = 0, y = 0;
real pos;
@@ -144,7 +144,7 @@ grid_draw_vertical_lines(DDisplay *ddisp, Rectangle *update, real length)
irenderer = DIA_GET_INTERACTIVE_RENDERER_INTERFACE (renderer);
pos = ceil( update->left / length ) * length;
- ddisplay_transform_coords(ddisp, update->right, update->bottom, &width, &height);
+ dia_display_transform_coords(ddisp, update->right, update->bottom, &width, &height);
if (major_lines) {
major_count = ROUND (pos/length);
@@ -153,13 +153,13 @@ grid_draw_vertical_lines(DDisplay *ddisp, Rectangle *update, real length)
}
while (x < width) {
- ddisplay_transform_coords(ddisp, pos, update->top, &x, &y);
+ dia_display_transform_coords(ddisp, pos, update->top, &x, &y);
if (major_lines) {
if (major_count == 0)
DIA_RENDERER_GET_CLASS(renderer)->set_linestyle(renderer, LINESTYLE_SOLID, 0.0);
else
DIA_RENDERER_GET_CLASS(renderer)->set_linestyle(renderer, LINESTYLE_DOTTED,
- ddisplay_untransform_length(ddisp, 31));
+ dia_display_untransform_length(ddisp, 31));
major_count = (major_count+1)%major_lines;
}
irenderer->draw_pixel_line(renderer, x, y, x, height,
@@ -169,7 +169,7 @@ grid_draw_vertical_lines(DDisplay *ddisp, Rectangle *update, real length)
}
static void
-grid_draw_hex(DDisplay *ddisp, Rectangle *update, real length)
+grid_draw_hex(DiaDisplay *ddisp, Rectangle *update, real length)
{
real horiz_pos, vert_pos;
int to_x, to_y, x, y;
@@ -183,8 +183,8 @@ grid_draw_hex(DDisplay *ddisp, Rectangle *update, real length)
while (vert_pos <= update->bottom) {
horiz_pos = ceil( (update->left) / (3 * length) ) * length * 3 - length * 2.5;
while (horiz_pos <= update->right) {
- ddisplay_transform_coords(ddisp, horiz_pos, vert_pos, &x, &y);
- ddisplay_transform_coords(ddisp, horiz_pos + length, vert_pos, &to_x, &y);
+ dia_display_transform_coords(ddisp, horiz_pos, vert_pos, &x, &y);
+ dia_display_transform_coords(ddisp, horiz_pos + length, vert_pos, &to_x, &y);
irenderer->draw_pixel_line(renderer,
x, y, to_x, y,
@@ -200,8 +200,8 @@ grid_draw_hex(DDisplay *ddisp, Rectangle *update, real length)
while (vert_pos <= update->bottom) {
horiz_pos = ceil( (update->left) / (3 * length) ) * length * 3 - length;
while (horiz_pos <= update->right) {
- ddisplay_transform_coords(ddisp, horiz_pos, vert_pos, &x, &y);
- ddisplay_transform_coords(ddisp, horiz_pos+length, vert_pos, &to_x, &y);
+ dia_display_transform_coords(ddisp, horiz_pos, vert_pos, &x, &y);
+ dia_display_transform_coords(ddisp, horiz_pos+length, vert_pos, &to_x, &y);
irenderer->draw_pixel_line(renderer,
x, y, to_x, y,
@@ -217,15 +217,15 @@ grid_draw_hex(DDisplay *ddisp, Rectangle *update, real length)
while (vert_pos <= update->bottom) {
horiz_pos = ceil( (update->left) / (3 * length) ) * length * 3 - length * 2.5;
while (horiz_pos <= update->right) {
- ddisplay_transform_coords(ddisp, horiz_pos + length, vert_pos, &x, &y);
- ddisplay_transform_coords(ddisp, horiz_pos + 1.5 * length, vert_pos + length * sqrt(3) * 0.5, &to_x,
&to_y);
+ dia_display_transform_coords(ddisp, horiz_pos + length, vert_pos, &x, &y);
+ dia_display_transform_coords(ddisp, horiz_pos + 1.5 * length, vert_pos + length * sqrt(3) * 0.5,
&to_x, &to_y);
irenderer->draw_pixel_line(renderer,
x, y, to_x, to_y,
&ddisp->diagram->grid.colour);
- ddisplay_transform_coords(ddisp, horiz_pos, vert_pos, &x, &y);
- ddisplay_transform_coords(ddisp, horiz_pos - 0.5 * length, vert_pos + length * sqrt(3) * 0.5, &to_x,
&to_y);
+ dia_display_transform_coords(ddisp, horiz_pos, vert_pos, &x, &y);
+ dia_display_transform_coords(ddisp, horiz_pos - 0.5 * length, vert_pos + length * sqrt(3) * 0.5,
&to_x, &to_y);
irenderer->draw_pixel_line(renderer,
x, y, to_x, to_y,
@@ -241,15 +241,15 @@ grid_draw_hex(DDisplay *ddisp, Rectangle *update, real length)
while (vert_pos <= update->bottom) {
horiz_pos = ceil( (update->left) / (3 * length) ) * length * 3 - length;
while (horiz_pos <= update->right) {
- ddisplay_transform_coords(ddisp, horiz_pos, vert_pos, &x, &y);
- ddisplay_transform_coords(ddisp, horiz_pos - 0.5 * length, vert_pos + 0.5 * sqrt(3) * length, &to_x,
&to_y);
+ dia_display_transform_coords(ddisp, horiz_pos, vert_pos, &x, &y);
+ dia_display_transform_coords(ddisp, horiz_pos - 0.5 * length, vert_pos + 0.5 * sqrt(3) * length,
&to_x, &to_y);
irenderer->draw_pixel_line(renderer,
x, y, to_x, to_y,
&ddisp->diagram->grid.colour);
- ddisplay_transform_coords(ddisp, horiz_pos + length, vert_pos, &x, &y);
- ddisplay_transform_coords(ddisp, horiz_pos + 1.5 * length, vert_pos + 0.5 * sqrt(3) * length, &to_x,
&to_y);
+ dia_display_transform_coords(ddisp, horiz_pos + length, vert_pos, &x, &y);
+ dia_display_transform_coords(ddisp, horiz_pos + 1.5 * length, vert_pos + 0.5 * sqrt(3) * length,
&to_x, &to_y);
irenderer->draw_pixel_line(renderer,
x, y, to_x, to_y,
@@ -263,7 +263,7 @@ grid_draw_hex(DDisplay *ddisp, Rectangle *update, real length)
}
void
-grid_draw(DDisplay *ddisp, Rectangle *update)
+grid_draw(DiaDisplay *ddisp, Rectangle *update)
{
Grid *grid = &ddisp->grid;
DiaRenderer *renderer = ddisp->renderer;
@@ -287,8 +287,8 @@ grid_draw(DDisplay *ddisp, Rectangle *update)
if (ddisp->diagram->grid.hex) {
grid_draw_hex(ddisp, update, width_w);
} else {
- if (ddisplay_transform_length(ddisp, width_y) >= 2.0 &&
- ddisplay_transform_length(ddisp, width_x) >= 2.0) {
+ if (dia_display_transform_length(ddisp, width_y) >= 2.0 &&
+ dia_display_transform_length(ddisp, width_x) >= 2.0) {
/* Vertical lines: */
grid_draw_vertical_lines(ddisp, update, width_x);
/* Horizontal lines: */
@@ -299,7 +299,7 @@ grid_draw(DDisplay *ddisp, Rectangle *update)
}
void
-pagebreak_draw(DDisplay *ddisp, Rectangle *update)
+pagebreak_draw(DiaDisplay *ddisp, Rectangle *update)
{
DiaRenderer *renderer = ddisp->renderer;
DiaInteractiveRendererInterface *irenderer;
@@ -320,7 +320,7 @@ pagebreak_draw(DDisplay *ddisp, Rectangle *update)
DIA_RENDERER_GET_CLASS(renderer)->set_linestyle(renderer, LINESTYLE_SOLID, 0.0);
else
DIA_RENDERER_GET_CLASS(renderer)->set_linestyle(renderer, LINESTYLE_DOTTED,
- ddisplay_untransform_length(ddisp, 31));
+ dia_display_untransform_length(ddisp, 31));
if (dia->data->paper.fitto) {
origx = dia->data->extents.left;
@@ -330,7 +330,7 @@ pagebreak_draw(DDisplay *ddisp, Rectangle *update)
/* vertical lines ... */
pos = origx + ceil((update->left - origx) / pwidth) * pwidth;
while (pos <= update->right) {
- ddisplay_transform_coords(ddisp, pos,0,&x,&y);
+ dia_display_transform_coords(ddisp, pos,0,&x,&y);
irenderer->draw_pixel_line(renderer,
x, 0, x, height,
&dia->pagebreak_color);
@@ -339,7 +339,7 @@ pagebreak_draw(DDisplay *ddisp, Rectangle *update)
/* Horizontal lines: */
pos = origy + ceil((update->top - origy) / pheight) * pheight;
while (pos <= update->bottom) {
- ddisplay_transform_coords(ddisp, 0,pos,&x,&y);
+ dia_display_transform_coords(ddisp, 0,pos,&x,&y);
irenderer->draw_pixel_line(renderer,
0, y, width, y,
&dia->pagebreak_color);
@@ -349,7 +349,7 @@ pagebreak_draw(DDisplay *ddisp, Rectangle *update)
}
void
-snap_to_grid(DDisplay *ddisp, coord *x, coord *y)
+snap_to_grid(DiaDisplay *ddisp, coord *x, coord *y)
{
if (ddisp->grid.snap) {
if (ddisp->diagram->grid.hex) {
diff --git a/app/grid.h b/app/grid.h
index 13a6c712..0b4c5249 100644
--- a/app/grid.h
+++ b/app/grid.h
@@ -30,11 +30,11 @@ struct _Grid {
#include "display.h"
-void grid_draw(DDisplay *ddisp, Rectangle *update);
-void pagebreak_draw(DDisplay *ddisp, Rectangle *update);
-void snap_to_grid(DDisplay *ddisp, coord *x, coord *y);
+void grid_draw (DiaDisplay *ddisp, Rectangle *update);
+void pagebreak_draw (DiaDisplay *ddisp, Rectangle *update);
+void snap_to_grid (DiaDisplay *ddisp, coord *x, coord *y);
-gboolean grid_step (DDisplay *ddisp, GtkOrientation orientation,
+gboolean grid_step (DiaDisplay *ddisp, GtkOrientation orientation,
real *start, int *ipos, gboolean *is_major);
#endif /* GRID_H */
diff --git a/app/handle_ops.c b/app/handle_ops.c
index 1b80c703..69a72a9a 100644
--- a/app/handle_ops.c
+++ b/app/handle_ops.c
@@ -46,7 +46,7 @@ static const GdkRGBA handle_color_connected[NUM_HANDLE_TYPES<<1] =
};
void
-handle_draw(Handle *handle, DDisplay *ddisp)
+handle_draw(Handle *handle, DiaDisplay *ddisp)
{
gboolean some_selected;
int x,y;
@@ -55,7 +55,7 @@ handle_draw(Handle *handle, DDisplay *ddisp)
DIA_GET_INTERACTIVE_RENDERER_INTERFACE (ddisp->renderer);
const GdkRGBA *color;
- ddisplay_transform_coords(ddisp, handle->pos.x, handle->pos.y, &x, &y);
+ dia_display_transform_coords(ddisp, handle->pos.x, handle->pos.y, &x, &y);
/* change handle color to reflect different behaviour for multiple selected */
/* this code relies on the fact that only selected objects get their handles drawn */
some_selected = g_list_length (ddisp->diagram->data->selected) > 1;
@@ -111,7 +111,7 @@ handle_add_update(Handle *handle, Diagram *dia)
/* Call this after diagram_find_closest_handle() */
int
-handle_is_clicked(DDisplay *ddisp, Handle *handle, Point *pos)
+handle_is_clicked(DiaDisplay *ddisp, Handle *handle, Point *pos)
{
real dx, dy;
int idx, idy;
@@ -122,8 +122,8 @@ handle_is_clicked(DDisplay *ddisp, Handle *handle, Point *pos)
dx = ABS(handle->pos.x - pos->x);
dy = ABS(handle->pos.y - pos->y);
- idx = ddisplay_transform_length(ddisp, dx);
- idy = ddisplay_transform_length(ddisp, dy);
+ idx = dia_display_transform_length(ddisp, dx);
+ idy = dia_display_transform_length(ddisp, dy);
return (idx<(HANDLE_SIZE+1)/2) && (idy<(HANDLE_SIZE+1)/2);
}
diff --git a/app/handle_ops.h b/app/handle_ops.h
index 54ffcf02..f71df6a2 100644
--- a/app/handle_ops.h
+++ b/app/handle_ops.h
@@ -21,8 +21,8 @@
#include "diatypes.h"
#include "display.h"
-void handle_draw(Handle *handle, DDisplay *ddisp);
+void handle_draw(Handle *handle, DiaDisplay *ddisp);
void handle_add_update(Handle *handle, Diagram *dia);
-int handle_is_clicked(DDisplay *ddisp, Handle *handle, Point *pos);
+int handle_is_clicked(DiaDisplay *ddisp, Handle *handle, Point *pos);
#endif /* HANDLE_OPS_H */
diff --git a/app/interface.c b/app/interface.c
index 14c5329d..1a2a4262 100644
--- a/app/interface.c
+++ b/app/interface.c
@@ -57,7 +57,7 @@ dia_dnd_file_drag_data_received (GtkWidget *widget,
GtkSelectionData *data,
guint info,
guint time,
- DDisplay *ddisp)
+ DiaDisplay *ddisp)
{
switch (gdk_drag_context_get_selected_action(context))
{
@@ -99,9 +99,9 @@ dia_dnd_file_drag_data_received (GtkWidget *widget,
diagram_update_extents(diagram);
layer_dialog_set_diagram(diagram);
- if (diagram->displays == NULL) {
- new_display(diagram);
- }
+ if (diagram->displays == NULL) {
+ dia_display_new (diagram);
+ }
}
pFrom = strstr(pTo, "file:");
@@ -138,28 +138,28 @@ int is_integrated_ui (void)
static void
grid_toggle_snap(GtkWidget *widget, gpointer data)
{
- DDisplay *ddisp = (DDisplay *)data;
- ddisplay_set_snap_to_grid(ddisp,
- gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)));
+ DiaDisplay *ddisp = (DiaDisplay *)data;
+ dia_display_set_snap_to_grid (ddisp,
+ gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)));
}
static void
interface_toggle_mainpoint_magnetism(GtkWidget *widget, gpointer data)
{
- DDisplay *ddisp = (DDisplay *)data;
- ddisplay_set_snap_to_objects(ddisp,
- gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)));
- ddisplay_add_update_all(ddisp);
- ddisplay_flush(ddisp);
+ DiaDisplay *ddisp = (DiaDisplay *)data;
+ dia_display_set_snap_to_objects (ddisp,
+ gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)));
+ dia_display_add_update_all(ddisp);
+ dia_display_flush(ddisp);
}
static gint
origin_button_press(GtkWidget *widget, GdkEventButton *event, gpointer data)
{
- DDisplay *ddisp = (DDisplay *)data;
+ DiaDisplay *ddisp = (DiaDisplay *)data;
display_set_active(ddisp);
- ddisplay_popup_menu(ddisp, event);
+ dia_display_popup_menu (ddisp, event);
/* stop the signal emission so the button doesn't grab the
* pointer from us */
@@ -171,21 +171,21 @@ origin_button_press(GtkWidget *widget, GdkEventButton *event, gpointer data)
void
view_zoom_set (float factor)
{
- DDisplay *ddisp;
+ DiaDisplay *ddisp;
real scale;
- ddisp = ddisplay_active();
+ ddisp = dia_display_active();
if (!ddisp) return;
scale = ((real) factor)/1000.0 * DDISPLAY_NORMAL_ZOOM;
- ddisplay_zoom_middle(ddisp, scale / ddisp->zoom_factor);
+ dia_display_zoom_middle(ddisp, scale / ddisp->zoom_factor);
}
static void
zoom_activate_callback(GtkWidget *item, gpointer user_data)
{
- DDisplay *ddisp = (DDisplay *)user_data;
+ DiaDisplay *ddisp = (DiaDisplay *)user_data;
const gchar *zoom_text =
gtk_entry_get_text(GTK_ENTRY(g_object_get_data(G_OBJECT(ddisp->zoom_status), "user_data")));
float zoom_amount, magnify;
@@ -206,13 +206,13 @@ zoom_activate_callback(GtkWidget *item, gpointer user_data)
g_free(zoomamount);
magnify = (zoom_amount*DDISPLAY_NORMAL_ZOOM/100.0)/ddisp->zoom_factor;
if (fabs(magnify - 1.0) > 0.000001) {
- ddisplay_zoom_middle(ddisp, magnify);
+ dia_display_zoom_middle (ddisp, magnify);
}
}
}
static void
-zoom_add_zoom_amount(GtkWidget *menu, gchar *text, DDisplay *ddisp)
+zoom_add_zoom_amount (GtkWidget *menu, gchar *text, DiaDisplay *ddisp)
{
GtkWidget *menuitem = gtk_menu_item_new_with_label(text);
gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
@@ -225,7 +225,7 @@ zoom_add_zoom_amount(GtkWidget *menu, gchar *text, DDisplay *ddisp)
static void
zoom_popup_menu(GtkWidget *button, GdkEventButton *event, gpointer user_data) {
/* display_set_active(ddisp); */
- /* ddisplay_popup_menu(ddisp, event); */
+ /* dia_display_popup_menu(ddisp, event); */
GtkMenu *menu = GTK_MENU(user_data);
@@ -237,7 +237,7 @@ zoom_popup_menu(GtkWidget *button, GdkEventButton *event, gpointer user_data) {
}
static GtkWidget*
-create_zoom_widget(DDisplay *ddisp) {
+create_zoom_widget(DiaDisplay *ddisp) {
GtkWidget *combo;
GtkWidget *entry;
GtkWidget *menu;
@@ -289,16 +289,16 @@ close_notebook_page_callback (GtkButton *button,
gpointer user_data)
{
GtkBox *page = user_data;
- DDisplay *ddisp = g_object_get_data (G_OBJECT (page), "DDisplay");
+ DiaDisplay *ddisp = g_object_get_data (G_OBJECT (page), DIA_DISPLAY_DATA_HACK);
/* When the page widget is destroyed it removes itself from the notebook */
- ddisplay_close (ddisp);
+ dia_display_close (ddisp);
}
/* Shared helper functions for both UI cases
*/
static void
-_ddisplay_setup_rulers (DDisplay *ddisp, GtkWidget *shell, GtkWidget *table)
+_dia_display_setup_rulers (DiaDisplay *ddisp, GtkWidget *shell, GtkWidget *table)
{
ddisp->hrule = dia_ruler_new (GTK_ORIENTATION_HORIZONTAL, shell, ddisp);
ddisp->vrule = dia_ruler_new (GTK_ORIENTATION_VERTICAL, shell, ddisp);
@@ -310,7 +310,7 @@ _ddisplay_setup_rulers (DDisplay *ddisp, GtkWidget *shell, GtkWidget *table)
gtk_grid_attach (GTK_GRID (table), ddisp->vrule, 0, 1, 1, 1);
}
static void
-_ddisplay_setup_events (DDisplay *ddisp, GtkWidget *shell)
+_dia_display_setup_events (DiaDisplay *ddisp, GtkWidget *shell)
{
gtk_widget_set_events (shell,
GDK_POINTER_MOTION_MASK |
@@ -318,16 +318,16 @@ _ddisplay_setup_events (DDisplay *ddisp, GtkWidget *shell)
GDK_FOCUS_CHANGE_MASK);
g_signal_connect (G_OBJECT (shell), "focus_out_event",
- G_CALLBACK (ddisplay_focus_out_event), ddisp);
+ G_CALLBACK (dia_display_focus_out_event), ddisp);
g_signal_connect (G_OBJECT (shell), "focus_in_event",
- G_CALLBACK (ddisplay_focus_in_event), ddisp);
+ G_CALLBACK (dia_display_focus_in_event), ddisp);
g_signal_connect (G_OBJECT (shell), "realize",
- G_CALLBACK (ddisplay_realize), ddisp);
+ G_CALLBACK (dia_display_realize), ddisp);
g_signal_connect (G_OBJECT (shell), "unrealize",
- G_CALLBACK (ddisplay_unrealize), ddisp);
+ G_CALLBACK (dia_display_unrealize), ddisp);
}
static void
-_ddisplay_setup_scrollbars (DDisplay *ddisp, GtkWidget *table, int width, int height)
+_dia_display_setup_scrollbars (DiaDisplay *ddisp, GtkWidget *table, int width, int height)
{
/* The adjustment datums */
ddisp->hsbdata = GTK_ADJUSTMENT (gtk_adjustment_new (0, 0, width, 1, (width-1)/4, width-1));
@@ -340,9 +340,9 @@ _ddisplay_setup_scrollbars (DDisplay *ddisp, GtkWidget *table, int width, int he
/* set up the scrollbar observers */
g_signal_connect (G_OBJECT (ddisp->hsbdata), "value_changed",
- G_CALLBACK(ddisplay_hsb_update), ddisp);
+ G_CALLBACK(dia_display_hsb_update), ddisp);
g_signal_connect (G_OBJECT (ddisp->vsbdata), "value_changed",
- G_CALLBACK(ddisplay_vsb_update), ddisp);
+ G_CALLBACK(dia_display_vsb_update), ddisp);
/* harder to change position in the table, but we did not do it for years ;) */
gtk_widget_set_hexpand (ddisp->hsb, TRUE);
@@ -354,7 +354,7 @@ _ddisplay_setup_scrollbars (DDisplay *ddisp, GtkWidget *table, int width, int he
gtk_widget_show (ddisp->vsb);
}
static void
-_ddisplay_setup_navigation (DDisplay *ddisp, GtkWidget *table, gboolean top_left)
+_dia_display_setup_navigation (DiaDisplay *ddisp, GtkWidget *table, gboolean top_left)
{
GtkWidget *navigation_button;
@@ -380,7 +380,7 @@ _ddisplay_setup_navigation (DDisplay *ddisp, GtkWidget *table, gboolean top_left
* @param title
*/
static void
-use_integrated_ui_for_display_shell(DDisplay *ddisp, char *title)
+use_integrated_ui_for_display_shell(DiaDisplay *ddisp, char *title)
{
GtkWidget *table;
GtkWidget *label; /* Text label for the notebook page */
@@ -428,34 +428,29 @@ use_integrated_ui_for_display_shell(DDisplay *ddisp, char *title)
gtk_widget_show (image);
/* Set events for new tab page */
- _ddisplay_setup_events (ddisp, ddisp->container);
+ _dia_display_setup_events (ddisp, ddisp->container);
notebook_page_index = gtk_notebook_append_page (GTK_NOTEBOOK(ui.diagram_notebook),
ddisp->container,
tab_label_container);
- g_object_set_data (G_OBJECT (ddisp->container), "DDisplay", ddisp);
- g_object_set_data (G_OBJECT (ddisp->container), "tab-label", label);
- g_object_set_data (G_OBJECT (ddisp->container), "window", ui.main_window);
+ g_object_set_data (G_OBJECT (ddisp->container), DIA_DISPLAY_DATA_HACK, ddisp);
/* the table containing all widgets */
table = gtk_grid_new ();
- gtk_grid_set_column_spacing (GTK_GRID (table), 2);
- gtk_grid_set_row_spacing (GTK_GRID (table), 2);
- gtk_container_set_border_width (GTK_CONTAINER (table), 2);
gtk_box_pack_start (GTK_BOX (ddisp->container), table, TRUE, TRUE, 0);
/* scrollbars, rulers, canvas, menu popup button */
ddisp->origin = NULL;
- _ddisplay_setup_rulers (ddisp, ddisp->container, table);
+ _dia_display_setup_rulers (ddisp, ddisp->container, table);
/* Get the width/height of the Notebook child area */
/* TODO: Fix width/height hardcoded values */
width = 100;
height = 100;
- _ddisplay_setup_scrollbars (ddisp, table, width, height);
- _ddisplay_setup_navigation (ddisp, table, TRUE);
+ _dia_display_setup_scrollbars (ddisp, table, width, height);
+ _dia_display_setup_navigation (ddisp, table, TRUE);
ddisp->canvas = dia_canvas_new (ddisp);
@@ -497,7 +492,7 @@ use_integrated_ui_for_display_shell(DDisplay *ddisp, char *title)
* @param use_mbar Flag to indicate whether to add a menubar to the window
*/
void
-create_display_shell(DDisplay *ddisp,
+create_display_shell(DiaDisplay *ddisp,
int width, int height,
char *title, int use_mbar)
{
@@ -541,18 +536,13 @@ create_display_shell(DDisplay *ddisp,
g_object_set_data (G_OBJECT (ddisp->shell), "user_data", (gpointer) ddisp);
- _ddisplay_setup_events (ddisp, ddisp->shell);
+ _dia_display_setup_events (ddisp, ddisp->shell);
/* following two not shared with integrated UI */
g_signal_connect (G_OBJECT (ddisp->shell), "delete_event",
- G_CALLBACK (ddisplay_delete), ddisp);
- g_signal_connect (G_OBJECT (ddisp->shell), "destroy",
- G_CALLBACK (ddisplay_destroy), ddisp);
+ G_CALLBACK (dia_display_delete), ddisp);
/* the table containing all widgets */
table = gtk_grid_new ();
- gtk_grid_set_column_spacing (GTK_GRID (table), 2);
- gtk_grid_set_row_spacing (GTK_GRID (table), 2);
- gtk_container_set_border_width (GTK_CONTAINER (table), 2);
if (use_mbar)
{
root_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 1);
@@ -581,9 +571,9 @@ create_display_shell(DDisplay *ddisp,
gtk_frame_set_shadow_type (GTK_FRAME (ddisp->origin), GTK_SHADOW_OUT);
}
- _ddisplay_setup_rulers (ddisp, ddisp->shell, table);
- _ddisplay_setup_scrollbars (ddisp, table, width, height);
- _ddisplay_setup_navigation (ddisp, table, FALSE);
+ _dia_display_setup_rulers (ddisp, ddisp->shell, table);
+ _dia_display_setup_scrollbars (ddisp, table, width, height);
+ _dia_display_setup_navigation (ddisp, table, FALSE);
ddisp->canvas = dia_canvas_new (ddisp);
@@ -697,7 +687,7 @@ create_display_shell(DDisplay *ddisp,
* @param ddisp The display to hide the rulers on.
*/
void
-ddisplay_update_rulers (DDisplay *ddisp,
+dia_display_update_rulers (DiaDisplay *ddisp,
const Rectangle *extents,
const Rectangle *visible)
{
@@ -842,8 +832,7 @@ create_integrated_ui (void)
G_CALLBACK (toolbox_destroy),
window);
- main_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 1);
- gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 1);
+ main_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_container_add (GTK_CONTAINER (window), main_vbox);
gtk_widget_show (main_vbox);
@@ -940,8 +929,7 @@ create_toolbox ()
g_signal_connect (G_OBJECT (window), "destroy",
G_CALLBACK (toolbox_destroy), window);
- main_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 1);
- gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 1);
+ main_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_container_add (GTK_CONTAINER (window), main_vbox);
wrapbox = dia_toolbox_new();
diff --git a/app/interface.h b/app/interface.h
index 3b891870..64655d7d 100644
--- a/app/interface.h
+++ b/app/interface.h
@@ -38,7 +38,7 @@ void integrated_ui_layer_view_show (gboolean show);
int is_integrated_ui (void);
-void create_display_shell(DDisplay *ddisp,
+void create_display_shell(DiaDisplay *ddisp,
int width, int height,
char *title, int use_mbar);
@@ -64,6 +64,6 @@ void dia_dnd_file_drag_data_received (GtkWidget *widget,
GtkSelectionData *data,
guint info,
guint time,
- DDisplay *ddisp);
+ DiaDisplay *ddisp);
#endif /* INTERFACE_H */
diff --git a/app/layer_dialog.c b/app/layer_dialog.c
index 981e7f52..37bf4b40 100644
--- a/app/layer_dialog.c
+++ b/app/layer_dialog.c
@@ -1040,7 +1040,7 @@ static void
edit_layer_add_ok_callback (GtkWidget *w, gpointer client_data)
{
EditLayerDialog *dialog = (EditLayerDialog *) client_data;
- Diagram *dia = ddisplay_active_diagram();
+ Diagram *dia = dia_display_active_diagram();
Layer *layer;
int pos = data_layer_get_index (dia->data, dia->data->active_layer) + 1;
@@ -1067,7 +1067,7 @@ static void
edit_layer_rename_ok_callback (GtkWidget *w, gpointer client_data)
{
EditLayerDialog *dialog = (EditLayerDialog *) client_data;
- Diagram *dia = ddisplay_active_diagram();
+ Diagram *dia = dia_display_active_diagram();
Layer *layer = dia->data->active_layer;
g_free (layer->name);
@@ -1133,11 +1133,11 @@ layer_dialog_edit_layer (DiaLayerWidget *layer_widget, Diagram *dia, Layer *laye
/* handle the wm close signal */
g_signal_connect (G_OBJECT (dialog->dialog), "delete_event",
- G_CALLBACK (edit_layer_delete_callback),
- dialog);
+ G_CALLBACK (edit_layer_delete_callback),
+ dialog);
g_signal_connect (G_OBJECT (dialog->dialog), "destroy",
- G_CALLBACK (gtk_widget_destroy),
- &dialog->dialog);
+ G_CALLBACK (gtk_widget_destroy),
+ &dialog->dialog);
/* the main vbox */
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 1);
diff --git a/app/load_save.c b/app/load_save.c
index 24b22fea..1f23219f 100644
--- a/app/load_save.c
+++ b/app/load_save.c
@@ -949,7 +949,7 @@ diagram_data_write_doc(DiagramData *data, const char *filename, DiaContext *ctx)
if (g_slist_length(diagram->displays) == 1) {
xmlNodePtr dispinfo;
/* store some display attributes */
- DDisplay *ddisp = diagram->displays->data;
+ DiaDisplay *ddisp = diagram->displays->data;
attr = new_attribute((ObjectNode)tree, "display");
dispinfo = data_add_composite(attr, "display", ctx);
diff --git a/app/menus.c b/app/menus.c
index 4e0e8fbf..fb573b7d 100644
--- a/app/menus.c
+++ b/app/menus.c
@@ -350,7 +350,7 @@ load_accels(void)
void
integrated_ui_toolbar_object_snap_synchronize_to_display(gpointer param)
{
- DDisplay *ddisp = param;
+ DiaDisplay *ddisp = param;
if (ddisp && ddisp->common_toolbar)
{
GtkToggleButton *b = g_object_get_data (G_OBJECT (ddisp->common_toolbar),
@@ -368,10 +368,10 @@ integrated_ui_toolbar_object_snap_synchronize_to_display(gpointer param)
static void
integrated_ui_toolbar_object_snap_toggle(GtkToggleButton *b, gpointer *not_used)
{
- DDisplay *ddisp = ddisplay_active ();
+ DiaDisplay *ddisp = dia_display_active ();
if (ddisp)
{
- ddisplay_set_snap_to_objects (ddisp, gtk_toggle_button_get_active (b));
+ dia_display_set_snap_to_objects (ddisp, gtk_toggle_button_get_active (b));
}
}
@@ -382,7 +382,7 @@ integrated_ui_toolbar_object_snap_toggle(GtkToggleButton *b, gpointer *not_used)
void
integrated_ui_toolbar_grid_snap_synchronize_to_display(gpointer param)
{
- DDisplay *ddisp = param;
+ DiaDisplay *ddisp = param;
if (ddisp && ddisp->common_toolbar)
{
GtkToggleButton *b = g_object_get_data (G_OBJECT (ddisp->common_toolbar),
@@ -400,10 +400,10 @@ integrated_ui_toolbar_grid_snap_synchronize_to_display(gpointer param)
static void
integrated_ui_toolbar_grid_snap_toggle(GtkToggleButton *b, gpointer *not_used)
{
- DDisplay *ddisp = ddisplay_active ();
+ DiaDisplay *ddisp = dia_display_active ();
if (ddisp)
{
- ddisplay_set_snap_to_grid (ddisp, gtk_toggle_button_get_active (b));
+ dia_display_set_snap_to_grid (ddisp, gtk_toggle_button_get_active (b));
}
}
@@ -1150,12 +1150,12 @@ plugin_callback (GtkWidget *widget, gpointer data)
}
/* and finally invoke it */
if (cbf->callback) {
- DDisplay *ddisp = NULL;
+ DiaDisplay *ddisp = NULL;
DiagramData* diadata = NULL;
ObjectChange *change;
/* stuff from the toolbox menu should never get a diagram to modify */
if (strncmp (cbf->menupath, TOOLBOX_MENU, strlen (TOOLBOX_MENU)) != 0) {
- ddisp = ddisplay_active();
+ ddisp = dia_display_active();
diadata = ddisp ? ddisp->diagram->data : NULL;
}
change = cbf->callback (diadata, ddisp ? ddisp->diagram->filename : NULL, 0, cbf->user_data);
diff --git a/app/navigation.c b/app/navigation.c
index 9deecb3e..a9d76b6e 100644
--- a/app/navigation.c
+++ b/app/navigation.c
@@ -58,7 +58,7 @@ struct _NavigationWindow
cairo_surface_t *surface;
/*display to navigate*/
- DDisplay * ddisp;
+ DiaDisplay * ddisp;
};
typedef struct _NavigationWindow NavigationWindow;
@@ -99,7 +99,7 @@ static char * nav_xpm[] = {
};
GtkWidget *
-navigation_popup_new (DDisplay *ddisp)
+navigation_popup_new (DiaDisplay *ddisp)
{
GtkWidget * button;
@@ -108,7 +108,6 @@ navigation_popup_new (DDisplay *ddisp)
GtkStyle * style;
button = gtk_button_new ();
- gtk_container_set_border_width (GTK_CONTAINER (button), 0);
gtk_button_set_relief (GTK_BUTTON(button), GTK_RELIEF_NONE);
g_signal_connect (G_OBJECT (button), "pressed",
G_CALLBACK (on_button_navigation_popup_pressed), ddisp);
@@ -147,7 +146,7 @@ on_button_navigation_popup_pressed (GtkButton * button, gpointer _ddisp)
memset (nav, 0, sizeof(NavigationWindow));
/*--Retrieve the diagram's data*/
- nav->ddisp = (DDisplay *) _ddisp;
+ nav->ddisp = (DiaDisplay *) _ddisp;
data = nav->ddisp->diagram->data;
/*--Calculate sizes*/
@@ -170,8 +169,8 @@ on_button_navigation_popup_pressed (GtkButton * button, gpointer _ddisp)
nav->height = MIN( nav->max_size, (rect.bottom - rect.top) * zoom);
/*size: display canvas <--> frame cursor*/
- diagram_width = (int) ddisplay_transform_length (nav->ddisp, (rect.right - rect.left));
- diagram_height = (int) ddisplay_transform_length (nav->ddisp, (rect.bottom - rect.top));
+ diagram_width = (int) dia_display_transform_length (nav->ddisp, (rect.right - rect.left));
+ diagram_height = (int) dia_display_transform_length (nav->ddisp, (rect.bottom - rect.top));
if (diagram_width * diagram_height == 0)
return; /* don't crash with no size, i.e. empty diagram */
diff --git a/app/navigation.h b/app/navigation.h
index 558744ec..cc64ab5c 100644
--- a/app/navigation.h
+++ b/app/navigation.h
@@ -40,6 +40,6 @@
*
* Returns: a new #GtkButton.
**/
-GtkWidget * navigation_popup_new (DDisplay *ddisp);
+GtkWidget * navigation_popup_new (DiaDisplay *ddisp);
#endif
diff --git a/app/object_ops.c b/app/object_ops.c
index 3d4f0497..29a2d6da 100644
--- a/app/object_ops.c
+++ b/app/object_ops.c
@@ -78,7 +78,7 @@ object_add_updates_list(GList *list, Diagram *dia)
* in this call (anded to the display-wide setting).
*/
ConnectionPoint *
-object_find_connectpoint_display(DDisplay *ddisp, Point *pos,
+object_find_connectpoint_display(DiaDisplay *ddisp, Point *pos,
DiaObject *notthis, gboolean snap_to_objects)
{
real distance;
@@ -90,7 +90,7 @@ object_find_connectpoint_display(DDisplay *ddisp, Point *pos,
diagram_find_closest_connectionpoint(ddisp->diagram, &connectionpoint,
pos, notthis);
- distance = ddisplay_transform_length(ddisp, distance);
+ distance = dia_display_transform_length(ddisp, distance);
if (distance < OBJECT_CONNECT_DISTANCE) {
return connectionpoint;
}
@@ -119,7 +119,7 @@ object_find_connectpoint_display(DDisplay *ddisp, Point *pos,
/* pushes undo info */
void
-object_connect_display(DDisplay *ddisp, DiaObject *obj, Handle *handle,
+object_connect_display(DiaDisplay *ddisp, DiaObject *obj, Handle *handle,
gboolean snap_to_objects)
{
ConnectionPoint *connectionpoint;
diff --git a/app/object_ops.h b/app/object_ops.h
index 82a3cc71..d9f1be9a 100644
--- a/app/object_ops.h
+++ b/app/object_ops.h
@@ -34,12 +34,12 @@
void object_add_updates(DiaObject *obj, Diagram *dia);
void object_add_updates_list(GList *list, Diagram *dia);
-ConnectionPoint *object_find_connectpoint_display(DDisplay *ddisp,
+ConnectionPoint *object_find_connectpoint_display(DiaDisplay *ddisp,
Point *pos,
DiaObject *notthis,
gboolean snap_to_objects);
-void object_connect_display(DDisplay *ddisp, DiaObject *obj,
+void object_connect_display(DiaDisplay *ddisp, DiaObject *obj,
Handle *handle, gboolean snap_to_objects);
/* Adds Undo info for connected objects. */
diff --git a/app/pagesetup.c b/app/pagesetup.c
index f56b1191..bcc2d61e 100644
--- a/app/pagesetup.c
+++ b/app/pagesetup.c
@@ -75,7 +75,7 @@ create_page_setup_dlg(Diagram *dia)
g_object_ref(ps->dia);
ps->window = gtk_dialog_new_with_buttons(
_("Page Setup"),
- GTK_WINDOW (ddisplay_active()->shell),
+ GTK_WINDOW (dia_display_active()->shell),
GTK_DIALOG_DESTROY_WITH_PARENT,
_("Close"), GTK_RESPONSE_CLOSE,
_("Apply"), GTK_RESPONSE_APPLY,
diff --git a/app/preferences.c b/app/preferences.c
index ca889ba3..a2dbabcc 100644
--- a/app/preferences.c
+++ b/app/preferences.c
@@ -765,7 +765,7 @@ update_floating_toolbox(DiaPrefData *pref, gpointer ptr)
GSList *displays;
for (displays = diagram->displays; displays != NULL;
displays = g_slist_next(displays)) {
- DDisplay *ddisp = (DDisplay *)displays->data;
+ DiaDisplay *ddisp = (DiaDisplay *)displays->data;
gtk_window_set_transient_for(GTK_WINDOW(interface_get_toolbox_shell()),
GTK_WINDOW(ddisp->shell));
}
diff --git a/app/properties-dialog.c b/app/properties-dialog.c
index d250d3e9..d6f09612 100644
--- a/app/properties-dialog.c
+++ b/app/properties-dialog.c
@@ -223,7 +223,7 @@ object_list_properties_show(Diagram *dia, GList *objects)
{
GtkWidget *properties;
DiaObject *one_obj;
- GtkWidget *parent = ddisplay_active() ? ddisplay_active()->shell : NULL;
+ GtkWidget *parent = dia_display_active() ? dia_display_active()->shell : NULL;
if (!dialog)
create_dialog(parent);
clear_dialog_globals();
diff --git a/app/recent_files.c b/app/recent_files.c
index d8a5e0cd..e8f26710 100644
--- a/app/recent_files.c
+++ b/app/recent_files.c
@@ -159,7 +159,7 @@ open_recent_file_callback(GtkWidget *widget, gpointer data)
diagram_update_extents(diagram);
layer_dialog_set_diagram(diagram);
if (diagram->displays == NULL) {
- new_display(diagram);
+ dia_display_new (diagram);
}
} else
recent_file_history_remove (filename);
diff --git a/app/ruler.c b/app/ruler.c
index 1a289a27..85dc8755 100644
--- a/app/ruler.c
+++ b/app/ruler.c
@@ -41,7 +41,7 @@ typedef struct _DiaRuler
{
GtkDrawingArea parent;
- DDisplay *ddisp;
+ DiaDisplay *ddisp;
GtkOrientation orientation;
gdouble lower;
@@ -121,13 +121,13 @@ dia_ruler_draw (GtkWidget *widget,
if (ruler->position > ruler->lower && ruler->position < ruler->upper) {
real pos = ruler->position;
if (ruler->orientation == GTK_ORIENTATION_VERTICAL) {
- ddisplay_transform_coords (ruler->ddisp, 0, pos, &x, &y);
+ dia_display_transform_coords (ruler->ddisp, 0, pos, &x, &y);
cairo_move_to (cr, 3*dx, y);
cairo_line_to (cr, 2*dx, y - dx);
cairo_line_to (cr, 2*dx, y + dx);
cairo_fill (cr);
} else {
- ddisplay_transform_coords (ruler->ddisp, pos, 0, &x, &y);
+ dia_display_transform_coords (ruler->ddisp, pos, 0, &x, &y);
cairo_move_to (cr, x, 3*dy);
cairo_line_to (cr, x + dy, 2*dy);
cairo_line_to (cr, x - dy, 2*dy);
@@ -158,9 +158,9 @@ dia_ruler_motion_notify (GtkWidget *widget,
if (ruler->orientation == GTK_ORIENTATION_HORIZONTAL)
{
/* get old position in display coordinates */
- ddisplay_transform_coords (ruler->ddisp, ruler->position, 0, &x0, &y0);
+ dia_display_transform_coords (ruler->ddisp, ruler->position, 0, &x0, &y0);
/* update ruler position with original coords */
- ddisplay_untransform_coords (ruler->ddisp, x, y, &ruler->position, &tmp);
+ dia_display_untransform_coords (ruler->ddisp, x, y, &ruler->position, &tmp);
/* reuse x,y to restrict invalidation */
y0 = y = 0;
x0 = MAX(x0 - height/2, 0);
@@ -169,8 +169,8 @@ dia_ruler_motion_notify (GtkWidget *widget,
}
else
{
- ddisplay_transform_coords (ruler->ddisp, 0, ruler->position, &x0, &y0);
- ddisplay_untransform_coords (ruler->ddisp, x, y, &tmp, &ruler->position);
+ dia_display_transform_coords (ruler->ddisp, 0, ruler->position, &x0, &y0);
+ dia_display_untransform_coords (ruler->ddisp, x, y, &tmp, &ruler->position);
x0 = x = 0;
y0 = MAX(y0 - width/2, 0);
y = MAX(y - width/2, 0);
@@ -205,7 +205,7 @@ dia_ruler_init (DiaRuler *rule)
}
GtkWidget *
-dia_ruler_new (GtkOrientation orientation, GtkWidget *shell, DDisplay *ddisp)
+dia_ruler_new (GtkOrientation orientation, GtkWidget *shell, DiaDisplay *ddisp)
{
GtkWidget *rule = g_object_new (DIA_TYPE_RULER, NULL);
/* calculate from style settings */
diff --git a/app/ruler.h b/app/ruler.h
index 8dc758bf..b14dcf5b 100644
--- a/app/ruler.h
+++ b/app/ruler.h
@@ -4,13 +4,13 @@
#include "display.h"
-GtkWidget *dia_ruler_new (GtkOrientation orientation,
- GtkWidget *shell,
- DDisplay *ddisp);
+GtkWidget *dia_ruler_new (GtkOrientation orientation,
+ GtkWidget *shell,
+ DiaDisplay *ddisp);
-void dia_ruler_set_range (GtkWidget *ruler,
- gdouble lower,
- gdouble upper,
- gdouble position,
- gdouble max_size);
+void dia_ruler_set_range (GtkWidget *ruler,
+ gdouble lower,
+ gdouble upper,
+ gdouble position,
+ gdouble max_size);
#endif
diff --git a/app/select.c b/app/select.c
index 738562ec..1e7f0ec4 100644
--- a/app/select.c
+++ b/app/select.c
@@ -35,7 +35,7 @@ select_all_callback(GtkAction *action)
{
Diagram *dia;
GList *objects;
- DDisplay * ddisp = ddisplay_active();
+ DiaDisplay * ddisp = dia_display_active();
if (!ddisp || textedit_mode(ddisp)) return;
dia = ddisp->diagram;
@@ -52,7 +52,7 @@ select_all_callback(GtkAction *action)
objects = g_list_next(objects);
}
- ddisplay_do_update_menu_sensitivity(ddisp);
+ dia_display_do_update_menu_sensitivity(ddisp);
object_add_updates_list(dia->data->selected, dia);
diagram_flush(dia);
}
@@ -61,14 +61,14 @@ void
select_none_callback(GtkAction *action)
{
Diagram * dia;
- DDisplay * ddisp = ddisplay_active();
+ DiaDisplay * ddisp = dia_display_active();
if (!ddisp || textedit_mode(ddisp)) return;
dia = ddisp->diagram;
diagram_remove_all_selected(dia, TRUE);
- ddisplay_do_update_menu_sensitivity(ddisp);
+ dia_display_do_update_menu_sensitivity(ddisp);
object_add_updates_list(dia->data->selected, dia);
diagram_flush(dia);
}
@@ -78,7 +78,7 @@ select_invert_callback(GtkAction *action)
{
Diagram *dia;
GList *tmp;
- DDisplay * ddisp = ddisplay_active();
+ DiaDisplay * ddisp = dia_display_active();
if (!ddisp || textedit_mode(ddisp)) return;
dia = ddisp->diagram;
@@ -95,7 +95,7 @@ select_invert_callback(GtkAction *action)
}
}
- ddisplay_do_update_menu_sensitivity(ddisp);
+ dia_display_do_update_menu_sensitivity(ddisp);
object_add_updates_list(dia->data->selected, dia);
diagram_flush(dia);
@@ -108,7 +108,7 @@ void
select_connected_callback(GtkAction *action)
{
Diagram *dia;
- DDisplay * ddisp = ddisplay_active();
+ DiaDisplay * ddisp = dia_display_active();
GList *objects, *tmp;
if (!ddisp || textedit_mode(ddisp)) return;
@@ -150,7 +150,7 @@ select_connected_callback(GtkAction *action)
}
}
- ddisplay_do_update_menu_sensitivity(ddisp);
+ dia_display_do_update_menu_sensitivity(ddisp);
object_add_updates_list(dia->data->selected, dia);
diagram_flush(dia);
}
@@ -201,7 +201,7 @@ select_transitively(Diagram *dia, DiaObject *obj)
void
select_transitive_callback(GtkAction *action)
{
- DDisplay *ddisp = ddisplay_active();
+ DiaDisplay *ddisp = dia_display_active();
Diagram *dia;
GList *objects, *tmp;
@@ -214,7 +214,7 @@ select_transitive_callback(GtkAction *action)
select_transitively(dia, (DiaObject *)tmp->data);
}
- ddisplay_do_update_menu_sensitivity(ddisp);
+ dia_display_do_update_menu_sensitivity(ddisp);
object_add_updates_list(dia->data->selected, dia);
diagram_flush(dia);
}
@@ -224,7 +224,7 @@ select_same_type_callback(GtkAction *action)
{
/* For now, do a brute force version: Check vs. all earlier selected.
Later, we should really sort the selecteds first to avoid n^2 */
- DDisplay *ddisp = ddisplay_active();
+ DiaDisplay *ddisp = dia_display_active();
Diagram *dia;
GList *objects, *tmp, *tmp2;
@@ -250,7 +250,7 @@ select_same_type_callback(GtkAction *action)
}
}
- ddisplay_do_update_menu_sensitivity(ddisp);
+ dia_display_do_update_menu_sensitivity(ddisp);
object_add_updates_list(dia->data->selected, dia);
diagram_flush(dia);
}
@@ -258,7 +258,7 @@ select_same_type_callback(GtkAction *action)
void
select_style_callback(GtkAction *action, GtkRadioAction *current, gpointer user_data)
{
- DDisplay *ddisp = ddisplay_active();
+ DiaDisplay *ddisp = dia_display_active();
if (!ddisp || textedit_mode(ddisp)) return;
/* simply set the selection style to the value of `action' */
diff --git a/app/textedit.c b/app/textedit.c
index 6bd282f5..97644793 100644
--- a/app/textedit.c
+++ b/app/textedit.c
@@ -54,13 +54,13 @@ typedef struct TextEditChange {
Text *text;
} TextEditChange;
-static void textedit_end_edit(DDisplay *ddisp, Focus *focus);
+static void textedit_end_edit(DiaDisplay *ddisp, Focus *focus);
/** Returns TRUE if the given display is currently in text-edit mode. */
gboolean
-textedit_mode(DDisplay *ddisp)
+textedit_mode(DiaDisplay *ddisp)
{
- return ddisplay_active_focus(ddisp) != NULL;
+ return dia_display_active_focus(ddisp) != NULL;
}
/** Perform the necessary changes to the display according to whether
@@ -71,7 +71,7 @@ textedit_mode(DDisplay *ddisp)
* @param ddisp The display to set according to mode.
*/
static void
-textedit_display_change(DDisplay *ddisp)
+textedit_display_change(DiaDisplay *ddisp)
{
}
@@ -81,7 +81,7 @@ textedit_display_change(DDisplay *ddisp)
* @param ddisp The display that editing happens in.
*/
static void
-textedit_enter(DDisplay *ddisp)
+textedit_enter(DiaDisplay *ddisp)
{
if (textedit_mode(ddisp)) {
return;
@@ -98,13 +98,13 @@ textedit_enter(DDisplay *ddisp)
* @param ddisp The display that editing happens in.
*/
static void
-textedit_exit(DDisplay *ddisp)
+textedit_exit(DiaDisplay *ddisp)
{
if (!textedit_mode(ddisp)) {
return;
}
- if (ddisplay_active_focus(ddisp) != NULL) {
- textedit_end_edit(ddisp, ddisplay_active_focus(ddisp));
+ if (dia_display_active_focus(ddisp) != NULL) {
+ textedit_end_edit(ddisp, dia_display_active_focus(ddisp));
}
/* Set object-edit menus */
/* Set object-edit key-event handler */
@@ -119,13 +119,13 @@ textedit_exit(DDisplay *ddisp)
* @param focus The text focus to edit
*/
static void
-textedit_begin_edit(DDisplay *ddisp, Focus *focus)
+textedit_begin_edit(DiaDisplay *ddisp, Focus *focus)
{
g_assert(dia_object_is_selected(focus_get_object(focus)));
if (!textedit_mode(ddisp)) {
textedit_enter(ddisp);
}
- ddisplay_set_active_focus(ddisp, focus);
+ dia_display_set_active_focus(ddisp, focus);
highlight_object(focus->obj, DIA_HIGHLIGHT_TEXT_EDIT, ddisp->diagram);
object_add_updates(focus->obj, ddisp->diagram);
}
@@ -137,7 +137,7 @@ textedit_begin_edit(DDisplay *ddisp, Focus *focus)
* @param focus The text focus to stop editing
*/
static void
-textedit_end_edit(DDisplay *ddisp, Focus *focus)
+textedit_end_edit(DiaDisplay *ddisp, Focus *focus)
{
/* During destruction of the diagram the display may already be gone */
if (!ddisp)
@@ -151,12 +151,12 @@ textedit_end_edit(DDisplay *ddisp, Focus *focus)
highlight_object_off(focus->obj, ddisp->diagram);
object_add_updates(focus->obj, ddisp->diagram);
diagram_object_modified(ddisp->diagram, focus->obj);
- ddisplay_set_active_focus(ddisp, NULL);
+ dia_display_set_active_focus(ddisp, NULL);
}
/** Move the text edit focus either backwards or forwards. */
Focus *
-textedit_move_focus(DDisplay *ddisp, Focus *focus, gboolean forwards)
+textedit_move_focus(DiaDisplay *ddisp, Focus *focus, gboolean forwards)
{
g_return_val_if_fail (ddisp != NULL, NULL);
if (focus != NULL) {
@@ -182,7 +182,7 @@ textedit_move_focus(DDisplay *ddisp, Focus *focus, gboolean forwards)
* with doing request_focus(), which merely puts one in the focus list).
*/
void
-textedit_activate_focus(DDisplay *ddisp, Focus *focus, Point *clicked)
+textedit_activate_focus(DiaDisplay *ddisp, Focus *focus, Point *clicked)
{
Focus *old_focus = get_active_focus((DiagramData *) ddisp->diagram);
if (old_focus != NULL) {
@@ -203,7 +203,7 @@ textedit_activate_focus(DDisplay *ddisp, Focus *focus, Point *clicked)
* Returns true if there is something to text edit.
*/
gboolean
-textedit_activate_object(DDisplay *ddisp, DiaObject *obj, Point *clicked)
+textedit_activate_object(DiaDisplay *ddisp, DiaObject *obj, Point *clicked)
{
Focus *new_focus;
@@ -232,7 +232,7 @@ textedit_activate_object(DDisplay *ddisp, DiaObject *obj, Point *clicked)
* text to edit, otherwise it will take us out of text-edit mode.
*/
gboolean
-textedit_activate_first(DDisplay *ddisp)
+textedit_activate_first(DiaDisplay *ddisp)
{
Focus *new_focus = NULL;
GList *tmp, *selected = diagram_get_sorted_selected(ddisp->diagram);
@@ -269,14 +269,14 @@ textedit_activate_first(DDisplay *ddisp)
void
textedit_deactivate_focus(void)
{
- if (ddisplay_active() != NULL) {
- DiagramData *dia = (DiagramData *) ddisplay_active()->diagram;
+ if (dia_display_active() != NULL) {
+ DiagramData *dia = (DiagramData *) dia_display_active()->diagram;
Focus *focus = get_active_focus(dia);
if (focus != NULL) {
remove_focus_on_diagram(dia);
}
/* This also ends the edit */
- textedit_exit(ddisplay_active());
+ textedit_exit(dia_display_active());
}
}
@@ -291,8 +291,8 @@ textedit_remove_focus(DiaObject *obj, Diagram *diagram)
/* TODO: make sure the focus is deactivated */
}
/* This also ends the edit */
- if (ddisplay_active() != NULL) {
- textedit_exit(ddisplay_active());
+ if (dia_display_active() != NULL) {
+ textedit_exit(dia_display_active());
}
}
@@ -308,8 +308,8 @@ textedit_remove_focus_all(Diagram *diagram)
}
reset_foci_on_diagram((DiagramData *) diagram);
/* This also ends the edit */
- if (ddisplay_active() != NULL) {
- textedit_exit(ddisplay_active());
+ if (dia_display_active() != NULL) {
+ textedit_exit(dia_display_active());
}
}
diff --git a/app/textedit.h b/app/textedit.h
index 2e2b63d9..1a7fad2f 100644
--- a/app/textedit.h
+++ b/app/textedit.h
@@ -24,12 +24,12 @@
#include "diatypes.h"
#include "display.h"
-Focus *textedit_move_focus(DDisplay *ddisp, Focus *focus, gboolean forwards);
+Focus *textedit_move_focus(DiaDisplay *ddisp, Focus *focus, gboolean forwards);
-gboolean textedit_mode(DDisplay *ddisp);
-void textedit_activate_focus(DDisplay *ddisp, Focus *focus, Point *clicked);
-gboolean textedit_activate_object(DDisplay *ddisp, DiaObject *obj, Point *clicked);
-gboolean textedit_activate_first(DDisplay *ddisp);
+gboolean textedit_mode(DiaDisplay *ddisp);
+void textedit_activate_focus(DiaDisplay *ddisp, Focus *focus, Point *clicked);
+gboolean textedit_activate_object(DiaDisplay *ddisp, DiaObject *obj, Point *clicked);
+gboolean textedit_activate_first(DiaDisplay *ddisp);
void textedit_deactivate_focus(void);
void textedit_remove_focus(DiaObject *obj, Diagram *diagram);
void textedit_remove_focus_all(Diagram *diagram);
diff --git a/app/toolbox.c b/app/toolbox.c
index 62eaf047..a986e1c8 100644
--- a/app/toolbox.c
+++ b/app/toolbox.c
@@ -301,7 +301,6 @@ fill_sheet_wbox (DiaToolbox *self, DiaSheet *sheet)
button = gtk_radio_button_new (tool_group);
gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (button), FALSE);
- gtk_container_set_border_width (GTK_CONTAINER (button), 0);
tool_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (button));
gtk_container_add (GTK_CONTAINER (button), image);
diff --git a/app/tools/create_object.c b/app/tools/create_object.c
index 1c38b334..c8f33ae3 100644
--- a/app/tools/create_object.c
+++ b/app/tools/create_object.c
@@ -34,16 +34,16 @@
static void create_button_press (DiaTool *tool,
GdkEventButton *event,
- DDisplayBox *ddisp);
+ DiaDisplay *ddisp);
static void create_button_release (DiaTool *tool,
GdkEventButton *event,
- DDisplayBox *ddisp);
+ DiaDisplay *ddisp);
static void create_motion (DiaTool *tool,
GdkEventMotion *event,
- DDisplayBox *ddisp);
+ DiaDisplay *ddisp);
static void create_double_click (DiaTool *tool,
GdkEventButton *event,
- DDisplayBox *ddisp);
+ DiaDisplay *ddisp);
G_DEFINE_TYPE (DiaCreateTool, dia_create_tool, DIA_TYPE_TOOL)
@@ -60,7 +60,7 @@ activate (DiaTool *tool)
self->moving = FALSE;
- ddisplay_set_all_cursor (get_cursor (CURSOR_CREATE));
+ dia_display_set_all_cursor (get_cursor (CURSOR_CREATE));
}
static void
@@ -70,7 +70,7 @@ deactivate (DiaTool *tool)
if (real_tool->moving) { /* should not get here, but see bug #619246 */
gdk_pointer_ungrab (GDK_CURRENT_TIME);
- ddisplay_set_all_cursor (default_cursor);
+ dia_display_set_all_cursor (default_cursor);
}
}
@@ -122,7 +122,7 @@ dia_create_tool_class_init (DiaCreateToolClass *klass)
properties[PROP_INVERT_PERSISTENCE] = g_param_spec_boolean ("invert-persistence",
NULL, NULL,
FALSE,
- G_PARAM_READWRITE);
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
g_object_class_install_properties (object_class,
N_PROPS,
@@ -160,7 +160,7 @@ dia_create_tool_new (DiaObjectType *objtype,
static void
create_button_press (DiaTool *tool,
GdkEventButton *event,
- DDisplayBox *ddisp)
+ DiaDisplay *ddisp)
{
DiaCreateTool *self = DIA_CREATE_TOOL (tool);
Point clickedpoint, origpoint;
@@ -168,13 +168,13 @@ create_button_press (DiaTool *tool,
Handle *handle2;
DiaObject *obj;
- ddisplay_untransform_coords (ddisp->ddisp,
- (int)event->x, (int)event->y,
- &clickedpoint.x, &clickedpoint.y);
+ dia_display_untransform_coords (ddisp,
+ (int)event->x, (int)event->y,
+ &clickedpoint.x, &clickedpoint.y);
origpoint = clickedpoint;
- snap_to_grid (ddisp->ddisp, &clickedpoint.x, &clickedpoint.y);
+ snap_to_grid (ddisp, &clickedpoint.x, &clickedpoint.y);
obj = dia_object_default_create (self->objtype, &clickedpoint,
self->user_data,
@@ -189,13 +189,13 @@ create_button_press (DiaTool *tool,
return;
}
- diagram_add_object (ddisp->ddisp->diagram, obj);
+ diagram_add_object (ddisp->diagram, obj);
/* Try a connect */
if (handle1 != NULL &&
handle1->connect_type != HANDLE_NONCONNECTABLE) {
ConnectionPoint *connectionpoint;
- connectionpoint = object_find_connectpoint_display (ddisp->ddisp,
+ connectionpoint = object_find_connectpoint_display (ddisp,
&origpoint, obj, TRUE);
if (connectionpoint != NULL) {
(obj->ops->move)(obj, &origpoint);
@@ -204,31 +204,31 @@ create_button_press (DiaTool *tool,
if (!(event->state & GDK_SHIFT_MASK)) {
/* Not Multi-select => remove current selection */
- diagram_remove_all_selected (ddisp->ddisp->diagram, TRUE);
+ diagram_remove_all_selected (ddisp->diagram, TRUE);
}
- diagram_select (ddisp->ddisp->diagram, obj);
+ diagram_select (ddisp->diagram, obj);
/* Connect first handle if possible: */
if ((handle1!= NULL) &&
(handle1->connect_type != HANDLE_NONCONNECTABLE)) {
- object_connect_display (ddisp->ddisp, obj, handle1, TRUE);
+ object_connect_display (ddisp, obj, handle1, TRUE);
}
- object_add_updates (obj, ddisp->ddisp->diagram);
- ddisplay_do_update_menu_sensitivity (ddisp->ddisp);
- diagram_flush (ddisp->ddisp->diagram);
+ object_add_updates (obj, ddisp->diagram);
+ dia_display_do_update_menu_sensitivity (ddisp);
+ diagram_flush (ddisp->diagram);
if (handle2 != NULL) {
self->handle = handle2;
self->moving = TRUE;
self->last_to = handle2->pos;
- gdk_pointer_grab (gtk_widget_get_window (ddisp->ddisp->canvas), FALSE,
+ gdk_pointer_grab (gtk_widget_get_window (ddisp->canvas), FALSE,
GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON1_MOTION_MASK | GDK_BUTTON_RELEASE_MASK,
NULL, NULL, event->time);
- ddisplay_set_all_cursor (get_cursor (CURSOR_SCROLL));
+ dia_display_set_all_cursor (get_cursor (CURSOR_SCROLL));
} else {
- diagram_update_extents (ddisp->ddisp->diagram);
+ diagram_update_extents (ddisp->diagram);
self->moving = FALSE;
}
@@ -237,14 +237,14 @@ create_button_press (DiaTool *tool,
static void
create_double_click (DiaTool *tool,
GdkEventButton *event,
- DDisplayBox *ddisp)
+ DiaDisplay *ddisp)
{
}
static void
create_button_release (DiaTool *tool,
GdkEventButton *event,
- DDisplayBox *ddisp)
+ DiaDisplay *ddisp)
{
DiaCreateTool *self = DIA_CREATE_TOOL (tool);
GList *list = NULL;
@@ -260,14 +260,14 @@ create_button_release (DiaTool *tool,
if (self->moving) {
gdk_pointer_ungrab (event->time);
- object_add_updates (self->obj, ddisp->ddisp->diagram);
+ object_add_updates (self->obj, ddisp->diagram);
self->obj->ops->move_handle (self->obj,
self->handle,
&self->last_to,
NULL,
HANDLE_MOVE_CREATE_FINAL,
0);
- object_add_updates (self->obj, ddisp->ddisp->diagram);
+ object_add_updates (self->obj, ddisp->diagram);
}
parent_candidates = layer_find_objects_containing_rectangle (obj->parent_layer,
@@ -277,8 +277,8 @@ create_button_release (DiaTool *tool,
for (; parent_candidates != NULL; parent_candidates = g_list_next(parent_candidates)) {
DiaObject *parent_obj = (DiaObject *) parent_candidates->data;
if (obj != parent_obj && object_within_parent (obj, parent_obj)) {
- Change *change = undo_parenting (ddisp->ddisp->diagram, parent_obj, obj, TRUE);
- (change->apply)(change, ddisp->ddisp->diagram);
+ Change *change = undo_parenting (ddisp->diagram, parent_obj, obj, TRUE);
+ (change->apply)(change, ddisp->diagram);
break;
/*
obj->parent = parent_obj;
@@ -290,13 +290,13 @@ create_button_release (DiaTool *tool,
list = g_list_prepend (list, self->obj);
- undo_insert_objects (ddisp->ddisp->diagram, list, 1);
+ undo_insert_objects (ddisp->diagram, list, 1);
if (self->moving) {
if (self->handle->connect_type != HANDLE_NONCONNECTABLE) {
- object_connect_display (ddisp->ddisp, self->obj, self->handle, TRUE);
- diagram_update_connections_selection (ddisp->ddisp->diagram);
- diagram_flush (ddisp->ddisp->diagram);
+ object_connect_display (ddisp, self->obj, self->handle, TRUE);
+ diagram_update_connections_selection (ddisp->diagram);
+ diagram_flush (ddisp->diagram);
}
self->moving = FALSE;
self->handle = NULL;
@@ -305,33 +305,33 @@ create_button_release (DiaTool *tool,
{
/* remove position from status bar */
- GtkStatusbar *statusbar = GTK_STATUSBAR (ddisp->ddisp->modified_status);
+ GtkStatusbar *statusbar = GTK_STATUSBAR (ddisp->modified_status);
guint context_id = gtk_statusbar_get_context_id (statusbar, "ObjectPos");
gtk_statusbar_pop (statusbar, context_id);
}
- highlight_reset_all (ddisp->ddisp->diagram);
+ highlight_reset_all (ddisp->diagram);
reset = prefs.reset_tools_after_create != self->invert_persistence;
/* kind of backward: first starting editing to see if it is possible at all, than GUI reflection */
- if (textedit_activate_object (ddisp->ddisp, obj, NULL) && reset) {
+ if (textedit_activate_object (ddisp, obj, NULL) && reset) {
gtk_action_activate (menus_get_action ("ToolsTextedit"));
reset = FALSE; /* don't switch off textedit below */
}
- diagram_update_extents (ddisp->ddisp->diagram);
- diagram_modified (ddisp->ddisp->diagram);
+ diagram_update_extents (ddisp->diagram);
+ diagram_modified (ddisp->diagram);
- undo_set_transactionpoint (ddisp->ddisp->diagram->undo);
+ undo_set_transactionpoint (ddisp->diagram->undo);
if (reset)
tool_reset();
- ddisplay_set_all_cursor (default_cursor);
- ddisplay_do_update_menu_sensitivity (ddisp->ddisp);
+ dia_display_set_all_cursor (default_cursor);
+ dia_display_do_update_menu_sensitivity (ddisp);
}
static void
create_motion (DiaTool *tool,
GdkEventMotion *event,
- DDisplayBox *ddisp)
+ DiaDisplay *ddisp)
{
DiaCreateTool *self = DIA_CREATE_TOOL (tool);
Point to;
@@ -343,7 +343,7 @@ create_motion (DiaTool *tool,
if (!self->moving)
return;
- ddisplay_untransform_coords (ddisp->ddisp, event->x, event->y, &to.x, &to.y);
+ dia_display_untransform_coords (ddisp, event->x, event->y, &to.x, &to.y);
/* make sure the new object is restricted to its parent */
parent_handle_move_out_check(self->obj, &to);
@@ -351,30 +351,30 @@ create_motion (DiaTool *tool,
/* Move to ConnectionPoint if near: */
if (self->handle != NULL &&
self->handle->connect_type != HANDLE_NONCONNECTABLE) {
- connectionpoint = object_find_connectpoint_display (ddisp->ddisp,
+ connectionpoint = object_find_connectpoint_display (ddisp,
&to, self->obj, TRUE);
if (connectionpoint != NULL) {
to = connectionpoint->pos;
- highlight_object(connectionpoint->object, DIA_HIGHLIGHT_CONNECTIONPOINT, ddisp->ddisp->diagram);
- ddisplay_set_all_cursor(get_cursor(CURSOR_CONNECT));
+ highlight_object(connectionpoint->object, DIA_HIGHLIGHT_CONNECTIONPOINT, ddisp->diagram);
+ dia_display_set_all_cursor(get_cursor(CURSOR_CONNECT));
}
}
if (connectionpoint == NULL) {
/* No connectionopoint near, then snap to grid (if enabled) */
- snap_to_grid (ddisp->ddisp, &to.x, &to.y);
- highlight_reset_all (ddisp->ddisp->diagram);
- ddisplay_set_all_cursor (get_cursor (CURSOR_SCROLL));
+ snap_to_grid (ddisp, &to.x, &to.y);
+ highlight_reset_all (ddisp->diagram);
+ dia_display_set_all_cursor (get_cursor (CURSOR_SCROLL));
}
- object_add_updates (self->obj, ddisp->ddisp->diagram);
+ object_add_updates (self->obj, ddisp->diagram);
self->obj->ops->move_handle (self->obj, self->handle, &to, connectionpoint,
HANDLE_MOVE_CREATE, 0);
- object_add_updates (self->obj, ddisp->ddisp->diagram);
+ object_add_updates (self->obj, ddisp->diagram);
/* Put current mouse position in status bar */
- statusbar = GTK_STATUSBAR (ddisp->ddisp->modified_status);
+ statusbar = GTK_STATUSBAR (ddisp->modified_status);
context_id = gtk_statusbar_get_context_id (statusbar, "ObjectPos");
postext = g_strdup_printf ("%.3f, %.3f - %.3f, %.3f",
@@ -388,7 +388,7 @@ create_motion (DiaTool *tool,
g_free(postext);
- diagram_flush (ddisp->ddisp->diagram);
+ diagram_flush (ddisp->diagram);
self->last_to = to;
diff --git a/app/tools/magnify.c b/app/tools/magnify.c
index 2295df5d..b8e60148 100644
--- a/app/tools/magnify.c
+++ b/app/tools/magnify.c
@@ -38,14 +38,14 @@ G_DEFINE_TYPE (DiaMagnifyTool, dia_magnify_tool, DIA_TYPE_TOOL)
static void
magnify_button_press (DiaTool *self,
GdkEventButton *event,
- DDisplayBox *ddisp)
+ DiaDisplay *ddisp)
{
DiaMagnifyTool *tool = DIA_MAGNIFY_TOOL (self);
tool->x = tool->oldx = event->x;
tool->y = tool->oldy = event->y;
tool->box_active = TRUE;
tool->moved = FALSE;
- gdk_pointer_grab (gtk_widget_get_window(ddisp->ddisp->canvas), FALSE,
+ gdk_pointer_grab (gtk_widget_get_window(ddisp->canvas), FALSE,
GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON1_MOTION_MASK | GDK_BUTTON_RELEASE_MASK,
NULL, NULL, event->time);
}
@@ -53,7 +53,7 @@ magnify_button_press (DiaTool *self,
static void
magnify_button_release (DiaTool *self,
GdkEventButton *event,
- DDisplayBox *ddisp)
+ DiaDisplay *ddisp)
{
DiaMagnifyTool *tool = DIA_MAGNIFY_TOOL (self);
Rectangle *visible;
@@ -64,15 +64,15 @@ magnify_button_release (DiaTool *self,
tool->box_active = FALSE;
- dia_interactive_renderer_set_selection (ddisp->ddisp->renderer,
+ dia_interactive_renderer_set_selection (ddisp->renderer,
FALSE, 0, 0, 0, 0);
- ddisplay_flush (ddisp->ddisp);
+ dia_display_flush (ddisp);
- visible = &ddisp->ddisp->visible;
+ visible = &ddisp->visible;
- ddisplay_untransform_coords (ddisp->ddisp, tool->x, tool->y, &p1.x, &p1.y);
- ddisplay_untransform_coords (ddisp->ddisp, event->x, event->y, &p2.x, &p2.y);
+ dia_display_untransform_coords (ddisp, tool->x, tool->y, &p1.x, &p1.y);
+ dia_display_untransform_coords (ddisp, event->x, event->y, &p2.x, &p2.y);
tl.x = MIN(p1.x, p2.x);
tl.y = MIN(p1.y, p2.y);
@@ -82,8 +82,8 @@ magnify_button_release (DiaTool *self,
if (tool->moved) {
if (idiff <= 4) {
- ddisplay_add_update_all (ddisp->ddisp);
- ddisplay_flush (ddisp->ddisp);
+ dia_display_add_update_all (ddisp);
+ dia_display_flush (ddisp);
} else if (!(event->state & GDK_CONTROL_MASK)) {
/* the whole zoom rect should be visible, not just it's square equivalent */
real fh = fabs(p2.y - p1.y) / (visible->bottom - visible->top);
@@ -91,18 +91,18 @@ magnify_button_release (DiaTool *self,
factor = 1.0 / MAX(fh, fw);
tl.x += (visible->right - visible->left)/(2.0*factor);
tl.y += (visible->bottom - visible->top)/(2.0*factor);
- ddisplay_zoom (ddisp->ddisp, &tl, factor);
+ dia_display_zoom (ddisp, &tl, factor);
} else {
factor = diff / (visible->right - visible->left);
tl.x = tl.x * factor + tl.x;
tl.y = tl.y * factor + tl.y;
- ddisplay_zoom (ddisp->ddisp, &tl, factor);
+ dia_display_zoom (ddisp, &tl, factor);
}
} else {
if (event->state & GDK_SHIFT_MASK)
- ddisplay_zoom (ddisp->ddisp, &tl, 0.5);
+ dia_display_zoom (ddisp, &tl, 0.5);
else
- ddisplay_zoom (ddisp->ddisp, &tl, 2.0);
+ dia_display_zoom (ddisp, &tl, 2.0);
}
gdk_pointer_ungrab (event->time);
@@ -113,7 +113,7 @@ typedef struct intPoint { int x,y; } intPoint;
static void
magnify_motion (DiaMagnifyTool *self,
GdkEventMotion *event,
- DDisplayBox *ddisp)
+ DiaDisplay *ddisp)
{
DiaMagnifyTool *tool = DIA_MAGNIFY_TOOL (self);
intPoint tl, br;
@@ -124,10 +124,10 @@ magnify_motion (DiaMagnifyTool *self,
tl.x = MIN (tool->x, event->x); tl.y = MIN (tool->y, event->y);
br.x = MAX (tool->x, event->x); br.y = MAX (tool->y, event->y);
- dia_interactive_renderer_set_selection (ddisp->ddisp->renderer,
+ dia_interactive_renderer_set_selection (ddisp->renderer,
TRUE,
tl.x, tl.y, br.x - tl.x, br.y - tl.y);
- ddisplay_flush (ddisp->ddisp);
+ dia_display_flush (ddisp);
}
}
@@ -135,14 +135,14 @@ void
set_zoom_out (DiaTool *tool)
{
((DiaMagnifyTool *)tool)->zoom_out = TRUE;
- ddisplay_set_all_cursor(get_cursor(CURSOR_ZOOM_OUT));
+ dia_display_set_all_cursor(get_cursor(CURSOR_ZOOM_OUT));
}
void
set_zoom_in (DiaTool *tool)
{
((DiaMagnifyTool *)tool)->zoom_out = FALSE;
- ddisplay_set_all_cursor(get_cursor(CURSOR_ZOOM_IN));
+ dia_display_set_all_cursor(get_cursor(CURSOR_ZOOM_IN));
}
static void
@@ -151,13 +151,13 @@ activate (DiaTool *self)
DIA_MAGNIFY_TOOL (self)->box_active = FALSE;
DIA_MAGNIFY_TOOL (self)->zoom_out = FALSE;
- ddisplay_set_all_cursor(get_cursor(CURSOR_ZOOM_IN));
+ dia_display_set_all_cursor(get_cursor(CURSOR_ZOOM_IN));
}
static void
deactivate (DiaTool *tool)
{
- ddisplay_set_all_cursor(default_cursor);
+ dia_display_set_all_cursor(default_cursor);
}
static void
diff --git a/app/tools/modify_tool.c b/app/tools/modify_tool.c
index a82a93ed..1ff3039e 100644
--- a/app/tools/modify_tool.c
+++ b/app/tools/modify_tool.c
@@ -63,27 +63,27 @@ struct _DiaModifyTool {
G_DEFINE_TYPE (DiaModifyTool, dia_modify_tool, DIA_TYPE_TOOL)
-static DiaObject *click_select_object(DDisplayBox *ddisp, Point *clickedpoint,
+static DiaObject *click_select_object (DiaDisplay *ddisp, Point *clickedpoint,
GdkEventButton *event);
-static int do_if_clicked_handle (DDisplayBox *ddisp,
+static int do_if_clicked_handle (DiaDisplay *ddisp,
DiaModifyTool *tool,
Point *clickedpoint,
GdkEventButton *event);
static void modify_button_press (DiaTool *tool,
GdkEventButton *event,
- DDisplayBox *ddisp);
+ DiaDisplay *ddisp);
static void modify_button_hold (DiaTool *tool,
GdkEventButton *event,
- DDisplayBox *ddisp);
+ DiaDisplay *ddisp);
static void modify_button_release (DiaTool *tool,
GdkEventButton *event,
- DDisplayBox *ddisp);
+ DiaDisplay *ddisp);
static void modify_motion (DiaTool *tool,
GdkEventMotion *event,
- DDisplayBox *ddisp);
+ DiaDisplay *ddisp);
static void modify_double_click (DiaTool *tool,
GdkEventButton *event,
- DDisplayBox *ddisp);
+ DiaDisplay *ddisp);
static void
activate (DiaTool *self)
@@ -159,18 +159,18 @@ gdk_event_to_dia_ModifierKeys(guint event_state)
}
static DiaObject *
-click_select_object(DDisplayBox *ddisp, Point *clickedpoint,
+click_select_object(DiaDisplay *ddisp, Point *clickedpoint,
GdkEventButton *event)
{
Diagram *diagram;
real click_distance;
DiaObject *obj;
- diagram = ddisp->ddisp->diagram;
+ diagram = ddisp->diagram;
/* Find the closest object to select it: */
- click_distance = ddisplay_untransform_length (ddisp->ddisp, 3.0);
+ click_distance = dia_display_untransform_length (ddisp, 3.0);
obj = diagram_find_clicked_object(diagram, clickedpoint,
click_distance);
@@ -185,17 +185,17 @@ click_select_object(DDisplayBox *ddisp, Point *clickedpoint,
/*printf("Not already selected\n");*/
if (!(event->state & GDK_SHIFT_MASK)) {
- /* Not Multi-select => remove current selection */
- diagram_remove_all_selected(diagram, TRUE);
+ /* Not Multi-select => remove current selection */
+ diagram_remove_all_selected(diagram, TRUE);
}
diagram_select(diagram, obj);
/* To be removed once text edit mode is stable. By then,
* we don't want to automatically edit selected objects.
- textedit_activate_object(ddisp, obj, clickedpoint);
- */
+ * textedit_activate_object(ddisp, obj, clickedpoint);
+ */
- ddisplay_do_update_menu_sensitivity (ddisp->ddisp);
+ dia_display_do_update_menu_sensitivity (ddisp);
object_add_updates_list(diagram->data->selected, diagram);
diagram_flush(diagram);
@@ -210,12 +210,12 @@ click_select_object(DDisplayBox *ddisp, Point *clickedpoint,
diagram_flush(diagram);
if (event->state & GDK_SHIFT_MASK) { /* Multi-select */
- /* Remove the selected selected */
- ddisplay_do_update_menu_sensitivity (ddisp->ddisp);
- diagram_unselect_object(diagram, (DiaObject *)already->data);
- diagram_flush(ddisp->ddisp->diagram);
+ /* Remove the selected selected */
+ dia_display_do_update_menu_sensitivity (ddisp);
+ diagram_unselect_object(diagram, (DiaObject *)already->data);
+ diagram_flush (ddisp->diagram);
} else {
- return obj;
+ return obj;
}
}
} /* Else part moved to allow union/intersection select */
@@ -232,27 +232,27 @@ time_micro()
return tv.tv_sec*G_USEC_PER_SEC+tv.tv_usec;
}
-static int do_if_clicked_handle(DDisplayBox *ddisp, DiaModifyTool *tool,
+static int do_if_clicked_handle (DiaDisplay *ddisp, DiaModifyTool *tool,
Point *clickedpoint, GdkEventButton *event)
{
DiaObject *obj;
Handle *handle;
handle = NULL;
- diagram_find_closest_handle(ddisp->ddisp->diagram, &handle, &obj, clickedpoint);
- if (handle_is_clicked (ddisp->ddisp, handle, clickedpoint)) {
+ diagram_find_closest_handle (ddisp->diagram, &handle, &obj, clickedpoint);
+ if (handle_is_clicked (ddisp, handle, clickedpoint)) {
tool->state = STATE_MOVE_HANDLE;
tool->break_connections = TRUE;
tool->last_to = handle->pos;
tool->handle = handle;
tool->object = obj;
- gdk_pointer_grab (gtk_widget_get_window(ddisp->ddisp->canvas),
+ gdk_pointer_grab (gtk_widget_get_window (ddisp->canvas),
FALSE,
GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON1_MOTION_MASK | GDK_BUTTON_RELEASE_MASK,
NULL, NULL, event->time);
tool->start_at = handle->pos;
tool->start_time = time_micro();
- ddisplay_set_all_cursor(get_cursor(CURSOR_SCROLL));
+ dia_display_set_all_cursor(get_cursor(CURSOR_SCROLL));
return TRUE;
}
return FALSE;
@@ -261,19 +261,19 @@ static int do_if_clicked_handle(DDisplayBox *ddisp, DiaModifyTool *tool,
static void
modify_button_press (DiaTool *self,
GdkEventButton *event,
- DDisplayBox *ddisp)
+ DiaDisplay *ddisp)
{
DiaModifyTool *tool = DIA_MODIFY_TOOL (self);
Point clickedpoint;
DiaObject *clicked_obj;
gboolean some_selected;
- ddisplay_untransform_coords (ddisp->ddisp,
+ dia_display_untransform_coords (ddisp,
(int) event->x, (int) event->y,
&clickedpoint.x, &clickedpoint.y);
/* don't got to single handle movement if there is more than one object selected */
- some_selected = g_list_length (ddisp->ddisp->diagram->data->selected) > 1;
+ some_selected = g_list_length (ddisp->diagram->data->selected) > 1;
if (!some_selected && do_if_clicked_handle (ddisp, tool, &clickedpoint, event))
return;
@@ -288,12 +288,12 @@ modify_button_press (DiaTool *self,
point_sub(&tool->move_compensate, &clickedpoint);
tool->break_connections = TRUE; /* unconnect when not grabbing handles, just setting to
* FALSE is not enough. Need to refine the move op, too. */
- gdk_pointer_grab (gtk_widget_get_window(ddisp->ddisp->canvas), FALSE,
+ gdk_pointer_grab (gtk_widget_get_window (ddisp->canvas), FALSE,
GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON1_MOTION_MASK | GDK_BUTTON_RELEASE_MASK,
NULL, NULL, event->time);
tool->start_at = clickedpoint;
tool->start_time = time_micro();
- ddisplay_set_all_cursor(get_cursor(CURSOR_SCROLL));
+ dia_display_set_all_cursor(get_cursor(CURSOR_SCROLL));
} else {
tool->state = STATE_BOX_SELECT;
tool->start_box = clickedpoint;
@@ -301,15 +301,15 @@ modify_button_press (DiaTool *self,
tool->x1 = tool->x2 = (int) event->x;
tool->y1 = tool->y2 = (int) event->y;
- dia_interactive_renderer_set_selection (ddisp->ddisp->renderer,
+ dia_interactive_renderer_set_selection (ddisp->renderer,
TRUE,
tool->x1,
tool->y1,
tool->x2 - tool->x1,
tool->y2 - tool->y1);
- ddisplay_flush (ddisp->ddisp);
+ dia_display_flush (ddisp);
- gdk_pointer_grab (gtk_widget_get_window (ddisp->ddisp->canvas), FALSE,
+ gdk_pointer_grab (gtk_widget_get_window (ddisp->canvas), FALSE,
GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON1_MOTION_MASK | GDK_BUTTON_RELEASE_MASK,
NULL, NULL, event->time);
}
@@ -319,7 +319,7 @@ modify_button_press (DiaTool *self,
static void
modify_button_hold (DiaTool *self,
GdkEventButton *event,
- DDisplayBox *ddisp)
+ DiaDisplay *ddisp)
{
DiaModifyTool *tool = DIA_MODIFY_TOOL (self);
Point clickedpoint;
@@ -328,13 +328,13 @@ modify_button_hold (DiaTool *self,
case STATE_MOVE_OBJECT:
/* A button hold is as if user was moving object - if it is
* a text object and can be edited, then the move is cancelled */
- ddisplay_untransform_coords (ddisp->ddisp,
+ dia_display_untransform_coords (ddisp,
(int)event->x, (int)event->y,
&clickedpoint.x, &clickedpoint.y);
if (tool->object != NULL &&
- diagram_is_selected (ddisp->ddisp->diagram, tool->object)) {
- if (textedit_activate_object (ddisp->ddisp, tool->object, &clickedpoint)) {
+ diagram_is_selected (ddisp->diagram, tool->object)) {
+ if (textedit_activate_object (ddisp, tool->object, &clickedpoint)) {
/* Return tool to normal state - object is text and is in edit */
gdk_pointer_ungrab (event->time);
tool->orig_pos = NULL;
@@ -358,26 +358,26 @@ modify_button_hold (DiaTool *self,
static void
modify_double_click (DiaTool *self,
GdkEventButton *event,
- DDisplayBox *ddisp)
+ DiaDisplay *ddisp)
{
Point clickedpoint;
DiaObject *clicked_obj;
- ddisplay_untransform_coords (ddisp->ddisp,
+ dia_display_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->ddisp->diagram, ddisp->ddisp->diagram->data->selected);
+ 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->ddisp);
- diagram_remove_all_selected(ddisp->ddisp->diagram, TRUE);
- diagram_flush(ddisp->ddisp->diagram);
+ dia_display_do_update_menu_sensitivity (ddisp);
+ diagram_remove_all_selected (ddisp->diagram, TRUE);
+ diagram_flush (ddisp->diagram);
}
}
}
@@ -396,7 +396,7 @@ modify_double_click (DiaTool *self,
*/
static gboolean
-modify_move_already (DiaModifyTool *tool, DDisplay *ddisp, Point *to)
+modify_move_already (DiaModifyTool *tool, DiaDisplay *ddisp, Point *to)
{
static gboolean settings_taken = FALSE;
static int double_click_time = 250;
@@ -427,8 +427,8 @@ modify_move_already (DiaModifyTool *tool, DDisplay *ddisp, Point *to)
return TRUE;
}
}
- if (ddisplay_transform_length (ddisp, dist) > MIN_PIXELS) {
- return (ddisplay_transform_length (ddisp, dist) > MIN_PIXELS);
+ if (dia_display_transform_length (ddisp, dist) > MIN_PIXELS) {
+ return (dia_display_transform_length (ddisp, dist) > MIN_PIXELS);
} else {
return FALSE;
}
@@ -437,7 +437,7 @@ modify_move_already (DiaModifyTool *tool, DDisplay *ddisp, Point *to)
static void
modify_motion (DiaTool *self,
GdkEventMotion *event,
- DDisplayBox *ddisp)
+ DiaDisplay *ddisp)
{
DiaModifyTool *tool = DIA_MODIFY_TOOL (self);
Point to;
@@ -446,25 +446,25 @@ modify_motion (DiaTool *self,
ConnectionPoint *connectionpoint = NULL;
ObjectChange *objchange = NULL;
- ddisplay_untransform_coords (ddisp->ddisp, event->x, event->y, &to.x, &to.y);
+ dia_display_untransform_coords (ddisp, event->x, event->y, &to.x, &to.y);
if (tool->state==STATE_NONE) {
DiaObject *obj = NULL;
Handle *handle = NULL;
- diagram_find_closest_handle (ddisp->ddisp->diagram, &handle, &obj, &to);
+ diagram_find_closest_handle (ddisp->diagram, &handle, &obj, &to);
if (handle && handle->type != HANDLE_NON_MOVABLE
&& handle->id >= HANDLE_RESIZE_NW && handle->id <= HANDLE_RESIZE_SE
- && handle_is_clicked (ddisp->ddisp, handle, &to)
- && g_list_length (ddisp->ddisp->diagram->data->selected) == 1)
- ddisplay_set_all_cursor(get_cursor(CURSOR_DIRECTION_0 + handle->id));
+ && handle_is_clicked (ddisp, handle, &to)
+ && g_list_length (ddisp->diagram->data->selected) == 1)
+ dia_display_set_all_cursor(get_cursor(CURSOR_DIRECTION_0 + handle->id));
else
- ddisplay_set_all_cursor(get_cursor(CURSOR_POINT));
+ dia_display_set_all_cursor(get_cursor(CURSOR_POINT));
return; /* Fast path... */
}
- auto_scroll = ddisplay_autoscroll (ddisp->ddisp, event->x, event->y);
+ auto_scroll = dia_display_autoscroll (ddisp, event->x, event->y);
- if (!modify_move_already (tool, ddisp->ddisp, &to)) return;
+ if (!modify_move_already (tool, ddisp, &to)) return;
switch (tool->state) {
case STATE_MOVE_OBJECT:
@@ -475,7 +475,7 @@ modify_motion (DiaTool *self,
DiaObject *obj;
/* consider non-selected children affected */
- pla = list = parent_list_affected(ddisp->ddisp->diagram->data->selected);
+ pla = list = parent_list_affected (ddisp->diagram->data->selected);
tool->orig_pos = g_new(Point, g_list_length(list));
i=0;
while (list != NULL) {
@@ -487,7 +487,7 @@ modify_motion (DiaTool *self,
}
if (tool->break_connections)
- diagram_unconnect_selected(ddisp->ddisp->diagram); /* Pushes UNDO info */
+ diagram_unconnect_selected (ddisp->diagram); /* Pushes UNDO info */
if (gdk_event_to_dia_ModifierKeys (event->state) & MODIFIER_CONTROL) {
full_delta = to;
@@ -496,7 +496,7 @@ modify_motion (DiaTool *self,
}
point_add(&to, &tool->move_compensate);
- snap_to_grid (ddisp->ddisp, &to.x, &to.y);
+ snap_to_grid (ddisp, &to.x, &to.y);
now = tool->object->position;
@@ -512,19 +512,19 @@ modify_motion (DiaTool *self,
}
}
- object_add_updates_list(ddisp->ddisp->diagram->data->selected, ddisp->ddisp->diagram);
- objchange = object_list_move_delta(ddisp->ddisp->diagram->data->selected, &delta);
+ object_add_updates_list (ddisp->diagram->data->selected, ddisp->diagram);
+ objchange = object_list_move_delta (ddisp->diagram->data->selected, &delta);
if (objchange != NULL) {
- undo_object_change(ddisp->ddisp->diagram, tool->object, objchange);
+ undo_object_change (ddisp->diagram, tool->object, objchange);
}
- object_add_updates_list(ddisp->ddisp->diagram->data->selected, ddisp->ddisp->diagram);
+ object_add_updates_list (ddisp->diagram->data->selected, ddisp->diagram);
- object_add_updates(tool->object, ddisp->ddisp->diagram);
+ object_add_updates (tool->object, ddisp->diagram);
/* Put current mouse position in status bar */
{
gchar *postext;
- GtkStatusbar *statusbar = GTK_STATUSBAR (ddisp->ddisp->modified_status);
+ GtkStatusbar *statusbar = GTK_STATUSBAR (ddisp->modified_status);
guint context_id = gtk_statusbar_get_context_id (statusbar, "ObjectPos");
gtk_statusbar_pop (statusbar, context_id);
postext = g_strdup_printf("%.3f, %.3f - %.3f, %.3f",
@@ -539,8 +539,8 @@ modify_motion (DiaTool *self,
g_free(postext);
}
- diagram_update_connections_selection(ddisp->ddisp->diagram);
- diagram_flush(ddisp->ddisp->diagram);
+ diagram_update_connections_selection(ddisp->diagram);
+ diagram_flush(ddisp->diagram);
break;
case STATE_MOVE_HANDLE:
full_delta = to;
@@ -556,10 +556,10 @@ modify_motion (DiaTool *self,
if (gdk_event_to_dia_ModifierKeys (event->state) & MODIFIER_CONTROL)
vertical = (fabs(full_delta.x) < fabs(full_delta.y));
- highlight_reset_all(ddisp->ddisp->diagram);
+ highlight_reset_all(ddisp->diagram);
if ((tool->handle->connect_type != HANDLE_NONCONNECTABLE)) {
/* Move to ConnectionPoint if near: */
- connectionpoint = object_find_connectpoint_display (ddisp->ddisp,
+ connectionpoint = object_find_connectpoint_display (ddisp,
&to,
tool->object, TRUE);
if (connectionpoint != NULL) {
@@ -570,24 +570,24 @@ modify_motion (DiaTool *self,
} else {
type = DIA_HIGHLIGHT_CONNECTIONPOINT;
}
- highlight_object(connectionpoint->object, type, ddisp->ddisp->diagram);
- ddisplay_set_all_cursor(get_cursor(CURSOR_CONNECT));
+ highlight_object (connectionpoint->object, type, ddisp->diagram);
+ dia_display_set_all_cursor (get_cursor (CURSOR_CONNECT));
}
}
if (connectionpoint == NULL) {
/* No connectionopoint near, then snap to grid (if enabled) */
- snap_to_grid (ddisp->ddisp, &to.x, &to.y);
- ddisplay_set_all_cursor(get_cursor(CURSOR_SCROLL));
+ snap_to_grid (ddisp, &to.x, &to.y);
+ dia_display_set_all_cursor (get_cursor (CURSOR_SCROLL));
}
if (tool->break_connections) {
/* break connections to the handle currently selected. */
if (tool->handle->connected_to!=NULL) {
- Change *change = undo_unconnect (ddisp->ddisp->diagram,
+ Change *change = undo_unconnect (ddisp->diagram,
tool->object,
tool->handle);
- (change->apply)(change, ddisp->ddisp->diagram);
+ (change->apply)(change, ddisp->diagram);
}
}
@@ -601,14 +601,14 @@ modify_motion (DiaTool *self,
}
if (tool->orig_pos == NULL) {
- tool->orig_pos = g_new(Point, 1);
+ tool->orig_pos = g_new (Point, 1);
*tool->orig_pos = tool->handle->pos;
}
/* Put current mouse position in status bar */
{
gchar *postext;
- GtkStatusbar *statusbar = GTK_STATUSBAR (ddisp->ddisp->modified_status);
+ GtkStatusbar *statusbar = GTK_STATUSBAR (ddisp->modified_status);
guint context_id = gtk_statusbar_get_context_id (statusbar, "ObjectPos");
if (tool->object) { /* play safe */
@@ -625,7 +625,7 @@ modify_motion (DiaTool *self,
g_free(postext);
}
- object_add_updates(tool->object, ddisp->ddisp->diagram);
+ object_add_updates (tool->object, ddisp->diagram);
/* Handle undo */
if (tool->object)
@@ -633,32 +633,32 @@ modify_motion (DiaTool *self,
&to, connectionpoint,
HANDLE_MOVE_USER,
gdk_event_to_dia_ModifierKeys(event->state));
if (objchange != NULL) {
- undo_object_change(ddisp->ddisp->diagram, tool->object, objchange);
+ undo_object_change (ddisp->diagram, tool->object, objchange);
}
- object_add_updates(tool->object, ddisp->ddisp->diagram);
+ object_add_updates (tool->object, ddisp->diagram);
- diagram_update_connections_selection(ddisp->ddisp->diagram);
- diagram_flush(ddisp->ddisp->diagram);
+ diagram_update_connections_selection (ddisp->diagram);
+ diagram_flush (ddisp->diagram);
break;
case STATE_BOX_SELECT:
tool->end_box = to;
- ddisplay_transform_coords (ddisp->ddisp,
+ dia_display_transform_coords (ddisp,
MIN (tool->start_box.x, tool->end_box.x),
MIN (tool->start_box.y, tool->end_box.y),
&tool->x1, &tool->y1);
- ddisplay_transform_coords (ddisp->ddisp,
+ dia_display_transform_coords (ddisp,
MAX(tool->start_box.x, tool->end_box.x),
MAX(tool->start_box.y, tool->end_box.y),
&tool->x2, &tool->y2);
- dia_interactive_renderer_set_selection (ddisp->ddisp->renderer,
+ dia_interactive_renderer_set_selection (ddisp->renderer,
TRUE,
tool->x1,
tool->y1,
tool->x2 - tool->x1,
tool->y2 - tool->y1);
- ddisplay_flush (ddisp->ddisp);
+ dia_display_flush (ddisp);
break;
case STATE_NONE:
@@ -674,7 +674,7 @@ modify_motion (DiaTool *self,
/** Find the list of objects selected by current rubberbanding.
* The list should be freed after use. */
static GList *
-find_selected_objects(DDisplayBox *ddisp, DiaModifyTool *tool)
+find_selected_objects(DiaDisplay *ddisp, DiaModifyTool *tool)
{
Rectangle r;
r.left = MIN(tool->start_box.x, tool->end_box.x);
@@ -685,17 +685,17 @@ find_selected_objects(DDisplayBox *ddisp, DiaModifyTool *tool)
if (prefs.reverse_rubberbanding_intersects &&
tool->start_box.x > tool->end_box.x) {
return
- layer_find_objects_intersecting_rectangle(ddisp->ddisp->diagram->data->active_layer, &r);
+ layer_find_objects_intersecting_rectangle(ddisp->diagram->data->active_layer, &r);
} else {
return
- layer_find_objects_in_rectangle(ddisp->ddisp->diagram->data->active_layer, &r);
+ layer_find_objects_in_rectangle (ddisp->diagram->data->active_layer, &r);
}
}
static void
modify_button_release (DiaTool *self,
GdkEventButton *event,
- DDisplayBox *ddisp)
+ DiaDisplay *ddisp)
{
DiaModifyTool *tool = DIA_MODIFY_TOOL (self);
Point *dest_pos, to;
@@ -704,11 +704,11 @@ modify_button_release (DiaTool *self,
ObjectChange *objchange;
tool->break_connections = FALSE;
- ddisplay_set_all_cursor(default_cursor);
+ dia_display_set_all_cursor(default_cursor);
/* remove position from status bar */
{
- GtkStatusbar *statusbar = GTK_STATUSBAR (ddisp->ddisp->modified_status);
+ GtkStatusbar *statusbar = GTK_STATUSBAR (ddisp->modified_status);
guint context_id = gtk_statusbar_get_context_id (statusbar, "ObjectPos");
gtk_statusbar_pop (statusbar, context_id);
}
@@ -717,36 +717,36 @@ modify_button_release (DiaTool *self,
/* Return to normal state */
gdk_pointer_ungrab (event->time);
- ddisplay_untransform_coords (ddisp->ddisp, event->x, event->y, &to.x, &to.y);
- if (!modify_move_already (tool, ddisp->ddisp, &to)) {
+ dia_display_untransform_coords (ddisp, event->x, event->y, &to.x, &to.y);
+ if (!modify_move_already (tool, ddisp, &to)) {
tool->orig_pos = NULL;
tool->state = STATE_NONE;
return;
}
- diagram_update_connections_selection(ddisp->ddisp->diagram);
+ diagram_update_connections_selection (ddisp->diagram);
if (tool->orig_pos != NULL) {
/* consider the non-selected children affected */
- list = parent_list_affected (ddisp->ddisp->diagram->data->selected);
- dest_pos = g_new(Point, g_list_length(list));
+ list = parent_list_affected (ddisp->diagram->data->selected);
+ dest_pos = g_new (Point, g_list_length(list));
i=0;
while (list != NULL) {
- DiaObject *obj = (DiaObject *) list->data;
- dest_pos[i] = obj->position;
- list = g_list_next(list); i++;
+ DiaObject *obj = (DiaObject *) list->data;
+ dest_pos[i] = obj->position;
+ list = g_list_next(list); i++;
}
- undo_move_objects(ddisp->ddisp->diagram, tool->orig_pos, dest_pos,
- parent_list_affected(ddisp->ddisp->diagram->data->selected));
+ undo_move_objects (ddisp->diagram, tool->orig_pos, dest_pos,
+ parent_list_affected (ddisp->diagram->data->selected));
}
- ddisplay_connect_selected (ddisp->ddisp); /* pushes UNDO info */
- diagram_update_extents(ddisp->ddisp->diagram);
- diagram_modified(ddisp->ddisp->diagram);
- diagram_flush(ddisp->ddisp->diagram);
+ dia_display_connect_selected (ddisp); /* pushes UNDO info */
+ diagram_update_extents (ddisp->diagram);
+ diagram_modified (ddisp->diagram);
+ diagram_flush (ddisp->diagram);
- undo_set_transactionpoint(ddisp->ddisp->diagram->undo);
+ undo_set_transactionpoint (ddisp->diagram->undo);
tool->orig_pos = NULL;
tool->state = STATE_NONE;
@@ -756,34 +756,34 @@ modify_button_release (DiaTool *self,
tool->state = STATE_NONE;
if (tool->orig_pos != NULL) {
- undo_move_handle(ddisp->ddisp->diagram, tool->handle, tool->object,
+ undo_move_handle (ddisp->diagram, tool->handle, tool->object,
*tool->orig_pos, tool->last_to, gdk_event_to_dia_ModifierKeys(event->state));
}
/* Final move: */
- object_add_updates(tool->object, ddisp->ddisp->diagram);
- objchange = tool->object->ops->move_handle(tool->object, tool->handle,
+ object_add_updates (tool->object, ddisp->diagram);
+ objchange = tool->object->ops->move_handle (tool->object, tool->handle,
&tool->last_to, NULL,
HANDLE_MOVE_USER_FINAL,gdk_event_to_dia_ModifierKeys(event->state));
if (objchange != NULL) {
- undo_object_change(ddisp->ddisp->diagram, tool->object, objchange);
+ undo_object_change (ddisp->diagram, tool->object, objchange);
}
- object_add_updates(tool->object, ddisp->ddisp->diagram);
+ object_add_updates(tool->object, ddisp->diagram);
/* Connect if possible: */
if (tool->handle->connect_type != HANDLE_NONCONNECTABLE) {
- object_connect_display (ddisp->ddisp, tool->object, tool->handle, TRUE); /* pushes UNDO info */
- diagram_update_connections_selection (ddisp->ddisp->diagram);
+ object_connect_display (ddisp, tool->object, tool->handle, TRUE); /* pushes UNDO info */
+ diagram_update_connections_selection (ddisp->diagram);
}
- highlight_reset_all(ddisp->ddisp->diagram);
- diagram_flush(ddisp->ddisp->diagram);
+ highlight_reset_all (ddisp->diagram);
+ diagram_flush (ddisp->diagram);
- diagram_modified(ddisp->ddisp->diagram);
- diagram_update_extents(ddisp->ddisp->diagram);
+ diagram_modified (ddisp->diagram);
+ diagram_update_extents (ddisp->diagram);
- undo_set_transactionpoint(ddisp->ddisp->diagram->undo);
+ undo_set_transactionpoint (ddisp->diagram->undo);
if (tool->orig_pos != NULL) {
g_free(tool->orig_pos);
@@ -795,18 +795,18 @@ modify_button_release (DiaTool *self,
gdk_pointer_ungrab (event->time);
/* Remove last box: */
- dia_interactive_renderer_set_selection (ddisp->ddisp->renderer,
+ dia_interactive_renderer_set_selection (ddisp->renderer,
FALSE, 0, 0, 0, 0);
{
GList *list, *list_to_free;
- list = list_to_free = find_selected_objects(ddisp, tool);
+ list = list_to_free = find_selected_objects (ddisp, tool);
if (selection_style == SELECT_REPLACE &&
!(event->state & GDK_SHIFT_MASK)) {
/* Not Multi-select => Remove all selected */
- diagram_remove_all_selected(ddisp->ddisp->diagram, TRUE);
+ diagram_remove_all_selected (ddisp->diagram, TRUE);
}
if (selection_style == SELECT_INTERSECTION) {
@@ -815,37 +815,37 @@ modify_button_release (DiaTool *self,
while (list != NULL) {
DiaObject *obj = (DiaObject *)list->data;
- if (diagram_is_selected(ddisp->ddisp->diagram, obj)) {
- intersection = g_list_append(intersection, obj);
+ if (diagram_is_selected (ddisp->diagram, obj)) {
+ intersection = g_list_append (intersection, obj);
}
- list = g_list_next(list);
+ list = g_list_next (list);
}
list = intersection;
- diagram_remove_all_selected(ddisp->ddisp->diagram, TRUE);
+ diagram_remove_all_selected (ddisp->diagram, TRUE);
while (list != NULL) {
DiaObject *obj = (DiaObject *)list->data;
- diagram_select(ddisp->ddisp->diagram, obj);
+ diagram_select (ddisp->diagram, obj);
- list = g_list_next(list);
+ list = g_list_next (list);
}
- g_list_free(intersection);
+ g_list_free (intersection);
} else {
while (list != NULL) {
DiaObject *obj = (DiaObject *)list->data;
if (selection_style == SELECT_REMOVE) {
- if (diagram_is_selected(ddisp->ddisp->diagram, obj))
- diagram_unselect_object(ddisp->ddisp->diagram, obj);
+ if (diagram_is_selected(ddisp->diagram, obj))
+ diagram_unselect_object(ddisp->diagram, obj);
} else if (selection_style == SELECT_INVERT) {
- if (diagram_is_selected(ddisp->ddisp->diagram, obj))
- diagram_unselect_object(ddisp->ddisp->diagram, obj);
+ if (diagram_is_selected(ddisp->diagram, obj))
+ diagram_unselect_object(ddisp->diagram, obj);
else
- diagram_select(ddisp->ddisp->diagram, obj);
+ diagram_select(ddisp->diagram, obj);
} else {
- if (!diagram_is_selected(ddisp->ddisp->diagram, obj))
- diagram_select(ddisp->ddisp->diagram, obj);
+ if (!diagram_is_selected(ddisp->diagram, obj))
+ diagram_select(ddisp->diagram, obj);
}
list = g_list_next(list);
@@ -856,8 +856,8 @@ modify_button_release (DiaTool *self,
}
- ddisplay_do_update_menu_sensitivity (ddisp->ddisp);
- ddisplay_flush (ddisp->ddisp);
+ dia_display_do_update_menu_sensitivity (ddisp);
+ dia_display_flush (ddisp);
tool->state = STATE_NONE;
break;
diff --git a/app/tools/scroll_tool.c b/app/tools/scroll_tool.c
index e6ebb514..816fe121 100644
--- a/app/tools/scroll_tool.c
+++ b/app/tools/scroll_tool.c
@@ -26,16 +26,16 @@
static void scroll_button_press (DiaTool *tool,
GdkEventButton *event,
- DDisplayBox *ddisp);
+ DiaDisplay *ddisp);
static void scroll_button_release (DiaTool *tool,
GdkEventButton *event,
- DDisplayBox *ddisp);
+ DiaDisplay *ddisp);
static void scroll_motion (DiaTool *tool,
GdkEventMotion *event,
- DDisplayBox *ddisp);
+ DiaDisplay *ddisp);
static void scroll_double_click (DiaTool *tool,
GdkEventButton *event,
- DDisplayBox *ddisp);
+ DiaDisplay *ddisp);
G_DEFINE_TYPE (DiaScrollTool, dia_scroll_tool, DIA_TYPE_TOOL)
@@ -47,13 +47,13 @@ activate (DiaTool *tool)
self->scrolling = FALSE;
self->use_hand = TRUE;
- ddisplay_set_all_cursor (get_cursor (CURSOR_GRAB));
+ dia_display_set_all_cursor (get_cursor (CURSOR_GRAB));
}
static void
deactivate (DiaTool *tool)
{
- ddisplay_set_all_cursor (default_cursor);
+ dia_display_set_all_cursor (default_cursor);
}
static void
@@ -78,7 +78,7 @@ dia_scroll_tool_init (DiaScrollTool *self)
static void
scroll_double_click (DiaTool *tool,
GdkEventButton *event,
- DDisplayBox *ddisp)
+ DiaDisplay *ddisp)
{
/* Do nothing */
}
@@ -86,20 +86,20 @@ scroll_double_click (DiaTool *tool,
static void
scroll_button_press (DiaTool *tool,
GdkEventButton *event,
- DDisplayBox *ddisp)
+ DiaDisplay *ddisp)
{
DiaScrollTool *self = DIA_SCROLL_TOOL (tool);
Point clickedpoint;
self->use_hand = (event->state & GDK_SHIFT_MASK) == 0;
if (self->use_hand)
- ddisplay_set_all_cursor (get_cursor(CURSOR_GRABBING));
+ dia_display_set_all_cursor (get_cursor (CURSOR_GRABBING));
else
- ddisplay_set_all_cursor (get_cursor(CURSOR_SCROLL));
+ dia_display_set_all_cursor (get_cursor (CURSOR_SCROLL));
- ddisplay_untransform_coords (ddisp->ddisp,
- (int)event->x, (int)event->y,
- &clickedpoint.x, &clickedpoint.y);
+ dia_display_untransform_coords (ddisp,
+ (int)event->x, (int)event->y,
+ &clickedpoint.x, &clickedpoint.y);
self->scrolling = TRUE;
self->last_pos = clickedpoint;
@@ -108,7 +108,7 @@ scroll_button_press (DiaTool *tool,
static void
scroll_motion (DiaTool *tool,
GdkEventMotion *event,
- DDisplayBox *ddisp)
+ DiaDisplay *ddisp)
{
DiaScrollTool *self = DIA_SCROLL_TOOL (tool);
Point to;
@@ -120,17 +120,17 @@ scroll_motion (DiaTool *tool,
if ((event->state & GDK_SHIFT_MASK) == 0) {
if (!self->use_hand) {
self->use_hand = TRUE;
- ddisplay_set_all_cursor(get_cursor(CURSOR_GRAB));
+ dia_display_set_all_cursor (get_cursor (CURSOR_GRAB));
}
} else
if (self->use_hand) {
self->use_hand = FALSE;
- ddisplay_set_all_cursor(get_cursor(CURSOR_SCROLL));
+ dia_display_set_all_cursor (get_cursor (CURSOR_SCROLL));
}
return;
}
- ddisplay_untransform_coords (ddisp->ddisp, event->x, event->y, &to.x, &to.y);
+ dia_display_untransform_coords (ddisp, event->x, event->y, &to.x, &to.y);
if (self->use_hand) {
delta = self->last_pos;
@@ -140,32 +140,32 @@ scroll_motion (DiaTool *tool,
point_add(&self->last_pos, &delta);
/* we use this so you can scroll past the edge of the image */
- point_add(&delta, &ddisp->ddisp->origo);
- ddisplay_set_origo (ddisp->ddisp, delta.x, delta.y);
- ddisplay_update_scrollbars (ddisp->ddisp);
- ddisplay_add_update_all(ddisp->ddisp);
+ point_add(&delta, &ddisp->origo);
+ dia_display_set_origo (ddisp, delta.x, delta.y);
+ dia_display_update_scrollbars (ddisp);
+ dia_display_add_update_all(ddisp);
} else {
delta = to;
point_sub(&delta, &self->last_pos);
point_scale(&delta, 0.5);
- ddisplay_scroll (ddisp->ddisp, &delta);
+ dia_display_scroll (ddisp, &delta);
self->last_pos = to;
}
- ddisplay_flush (ddisp->ddisp);
+ dia_display_flush (ddisp);
}
static void
scroll_button_release (DiaTool *tool,
GdkEventButton *event,
- DDisplayBox *ddisp)
+ DiaDisplay *ddisp)
{
DiaScrollTool *self = DIA_SCROLL_TOOL (tool);
self->use_hand = (event->state & GDK_SHIFT_MASK) == 0;
if (self->use_hand) {
- ddisplay_set_all_cursor(get_cursor(CURSOR_GRAB));
+ dia_display_set_all_cursor(get_cursor(CURSOR_GRAB));
} else
- ddisplay_set_all_cursor(get_cursor(CURSOR_SCROLL));
+ dia_display_set_all_cursor(get_cursor(CURSOR_SCROLL));
self->scrolling = FALSE;
}
diff --git a/app/tools/textedit_tool.c b/app/tools/textedit_tool.c
index c9adabaf..b8105748 100644
--- a/app/tools/textedit_tool.c
+++ b/app/tools/textedit_tool.c
@@ -33,15 +33,15 @@ G_DEFINE_TYPE (DiaTextEditTool, dia_text_edit_tool, DIA_TYPE_TOOL)
* by clicking an object.
*/
static DiaObject *
-click_select_object (DDisplay *ddisp,
+click_select_object (DiaDisplay *ddisp,
Point *clickedpoint,
GdkEventButton *event)
{
- real click_distance = ddisplay_untransform_length(ddisp, 3.0);
+ real click_distance = dia_display_untransform_length(ddisp, 3.0);
Diagram *diagram = ddisp->diagram;
DiaObject *obj;
- ddisplay_untransform_coords(ddisp,
+ dia_display_untransform_coords(ddisp,
(int)event->x, (int)event->y,
&clickedpoint->x, &clickedpoint->y);
@@ -60,7 +60,7 @@ click_select_object (DDisplay *ddisp,
}
diagram_select (diagram, obj);
}
- ddisplay_do_update_menu_sensitivity (ddisp);
+ dia_display_do_update_menu_sensitivity (ddisp);
object_add_updates_list (diagram->data->selected, diagram);
diagram_flush (diagram);
@@ -73,19 +73,19 @@ click_select_object (DDisplay *ddisp,
static void
text_edit_button_press (DiaTool *tool,
GdkEventButton *event,
- DDisplayBox *ddisp)
+ DiaDisplay *ddisp)
{
DiaTextEditTool *self = DIA_TEXT_EDIT_TOOL (tool);
Point clickedpoint;
- Diagram *diagram = ddisp->ddisp->diagram;
- DiaObject *obj = click_select_object (ddisp->ddisp, &clickedpoint, event);
+ Diagram *diagram = ddisp->diagram;
+ DiaObject *obj = click_select_object (ddisp, &clickedpoint, event);
if (obj) {
if (obj != self->object)
textedit_deactivate_focus ();
/* set cursor position */
- if (textedit_activate_object (ddisp->ddisp, obj, &clickedpoint)) {
+ if (textedit_activate_object (ddisp, obj, &clickedpoint)) {
self->object = obj;
self->start_at = clickedpoint;
self->state = STATE_TEXT_SELECT;
@@ -103,13 +103,13 @@ text_edit_button_press (DiaTool *tool,
static void
text_edit_button_release (DiaTool *tool,
GdkEventButton *event,
- DDisplayBox *ddisp)
+ DiaDisplay *ddisp)
{
Point clickedpoint;
- DiaObject *obj = click_select_object (ddisp->ddisp, &clickedpoint, event);
+ DiaObject *obj = click_select_object (ddisp, &clickedpoint, event);
if (obj) {
- ddisplay_do_update_menu_sensitivity (ddisp->ddisp);
+ dia_display_do_update_menu_sensitivity (ddisp);
DIA_TEXT_EDIT_TOOL (tool)->state = STATE_TEXT_EDIT;
/* no selection in the text editing yes */
@@ -123,7 +123,7 @@ text_edit_button_release (DiaTool *tool,
static void
text_edit_motion (DiaTool *tool,
GdkEventMotion *event,
- DDisplayBox *ddisp)
+ DiaDisplay *ddisp)
{
/* if we implement text selection here we could update the visual feedback */
}
@@ -131,7 +131,7 @@ text_edit_motion (DiaTool *tool,
static void
text_edit_double_click (DiaTool *tool,
GdkEventButton *event,
- DDisplayBox *ddisp)
+ DiaDisplay *ddisp)
{
/* if we implment text selection this should select a word */
}
@@ -139,31 +139,31 @@ text_edit_double_click (DiaTool *tool,
static void
activate (DiaTool *tool)
{
- DDisplay *ddisp;
+ DiaDisplay *ddisp;
- ddisplay_set_all_cursor (get_cursor (CURSOR_XTERM));
+ dia_display_set_all_cursor (get_cursor (CURSOR_XTERM));
- ddisp = ddisplay_active();
+ ddisp = dia_display_active();
if (ddisp) {
if (textedit_activate_first (ddisp)) {
/* set the focus to the canvas area */
gtk_widget_grab_focus (ddisp->canvas);
}
- ddisplay_flush (ddisp);
+ dia_display_flush (ddisp);
/* the above may have entered the textedit mode, just update in any case */
- ddisplay_do_update_menu_sensitivity (ddisp);
+ dia_display_do_update_menu_sensitivity (ddisp);
}
}
static void
deactivate (DiaTool *tool)
{
- DDisplay *ddisp = ddisplay_active ();
+ DiaDisplay *ddisp = dia_display_active ();
if (ddisp) {
textedit_deactivate_focus ();
- ddisplay_flush (ddisp);
+ dia_display_flush (ddisp);
}
- ddisplay_set_all_cursor (default_cursor);
+ dia_display_set_all_cursor (default_cursor);
}
static void
diff --git a/app/tools/tool.c b/app/tools/tool.c
index 04647af1..19a03f1b 100644
--- a/app/tools/tool.c
+++ b/app/tools/tool.c
@@ -139,44 +139,44 @@ dia_tool_deactivate (DiaTool *self)
void
dia_tool_button_press (DiaTool *self,
GdkEventButton *event,
- DDisplay *ddisp)
+ DiaDisplay *ddisp)
{
- g_signal_emit (self, signals[BUTTON_PRESS], 0, event, display_box_new (ddisp));
+ g_signal_emit (self, signals[BUTTON_PRESS], 0, event, ddisp);
}
void
dia_tool_button_hold (DiaTool *self,
GdkEventButton *event,
- DDisplay *ddisp)
+ DiaDisplay *ddisp)
{
- g_signal_emit (self, signals[BUTTON_HOLD], 0, event, display_box_new (ddisp));
+ g_signal_emit (self, signals[BUTTON_HOLD], 0, event, ddisp);
}
void
dia_tool_double_click (DiaTool *self,
GdkEventButton *event,
- DDisplay *ddisp)
+ DiaDisplay *ddisp)
{
- g_signal_emit (self, signals[DOUBLE_CLICK], 0, event, display_box_new (ddisp));
+ g_signal_emit (self, signals[DOUBLE_CLICK], 0, event, ddisp);
}
void
dia_tool_button_release (DiaTool *self,
GdkEventButton *event,
- DDisplay *ddisp)
+ DiaDisplay *ddisp)
{
- g_signal_emit (self, signals[BUTTON_RELEASE], 0, event, display_box_new (ddisp));
+ g_signal_emit (self, signals[BUTTON_RELEASE], 0, event, ddisp);
}
void
dia_tool_motion (DiaTool *self,
GdkEventMotion *event,
- DDisplay *ddisp)
+ DiaDisplay *ddisp)
{
- g_signal_emit (self, signals[MOTION], 0, event, display_box_new (ddisp));
+ g_signal_emit (self, signals[MOTION], 0, event, ddisp);
}
void
diff --git a/app/tools/tool.h b/app/tools/tool.h
index 2f55a361..8447c332 100644
--- a/app/tools/tool.h
+++ b/app/tools/tool.h
@@ -45,11 +45,11 @@ struct _DiaToolClass {
void (* activate) (DiaTool *);
void (* deactivate) (DiaTool *);
- void (* button_press) (DiaTool *, GdkEventButton *, DDisplayBox *ddisp);
- void (* button_hold) (DiaTool *, GdkEventButton *, DDisplayBox *ddisp);
- void (* double_click) (DiaTool *, GdkEventButton *, DDisplayBox *ddisp);
- void (* button_release) (DiaTool *, GdkEventButton *, DDisplayBox *ddisp);
- void (* motion) (DiaTool *, GdkEventMotion *, DDisplayBox *ddisp);
+ void (* button_press) (DiaTool *, GdkEventButton *, DiaDisplay *ddisp);
+ void (* button_hold) (DiaTool *, GdkEventButton *, DiaDisplay *ddisp);
+ void (* double_click) (DiaTool *, GdkEventButton *, DiaDisplay *ddisp);
+ void (* button_release) (DiaTool *, GdkEventButton *, DiaDisplay *ddisp);
+ void (* motion) (DiaTool *, GdkEventMotion *, DiaDisplay *ddisp);
};
struct _ToolState {
@@ -79,11 +79,11 @@ void tool_options_dialog_show (GType type,
void dia_tool_activate (DiaTool *self);
void dia_tool_deactivate (DiaTool *self);
-void dia_tool_button_press (DiaTool *self, GdkEventButton *, DDisplay *ddisp);
-void dia_tool_button_hold (DiaTool *self, GdkEventButton *, DDisplay *ddisp);
-void dia_tool_double_click (DiaTool *self, GdkEventButton *, DDisplay *ddisp);
-void dia_tool_button_release (DiaTool *self, GdkEventButton *, DDisplay *ddisp);
-void dia_tool_motion (DiaTool *self, GdkEventMotion *, DDisplay *ddisp);
+void dia_tool_button_press (DiaTool *self, GdkEventButton *, DiaDisplay *ddisp);
+void dia_tool_button_hold (DiaTool *self, GdkEventButton *, DiaDisplay *ddisp);
+void dia_tool_double_click (DiaTool *self, GdkEventButton *, DiaDisplay *ddisp);
+void dia_tool_button_release (DiaTool *self, GdkEventButton *, DiaDisplay *ddisp);
+void dia_tool_motion (DiaTool *self, GdkEventMotion *, DiaDisplay *ddisp);
G_END_DECLS
diff --git a/app/undo.c b/app/undo.c
index 55201f28..6cdbf25c 100644
--- a/app/undo.c
+++ b/app/undo.c
@@ -259,7 +259,7 @@ undo_clear(UndoStack *stack)
void
undo_update_menus(UndoStack *stack)
{
- ddisplay_do_update_menu_sensitivity(ddisplay_active());
+ dia_display_do_update_menu_sensitivity(dia_display_active());
}
/** Marks the undo stack at the time of a save.
diff --git a/objects/UML/class_dialog.c b/objects/UML/class_dialog.c
index 257b5f7e..f50287ea 100644
--- a/objects/UML/class_dialog.c
+++ b/objects/UML/class_dialog.c
@@ -211,7 +211,7 @@ class_create_page(GtkWidget *notebook, UMLClass *umlclass)
}
static void
-style_create_page(GtkNotebook *notebook, UMLClass *umlclass)
+style_create_page(GtkWidget *notebook, UMLClass *umlclass)
{
UMLClassDialog *prop_dialog;
GtkWidget *page_label;
@@ -336,7 +336,7 @@ style_create_page(GtkNotebook *notebook, UMLClass *umlclass)
gtk_widget_show_all (vbox);
gtk_widget_show (page_label);
- gtk_notebook_append_page(notebook, vbox, page_label);
+ gtk_notebook_append_page(GTK_NOTEBOOK (notebook), vbox, page_label);
}
diff --git a/objects/UML/class_operations_dialog.c b/objects/UML/class_operations_dialog.c
index 7e429ed1..3d12b15e 100644
--- a/objects/UML/class_operations_dialog.c
+++ b/objects/UML/class_operations_dialog.c
@@ -20,6 +20,8 @@
#include <gtk/gtk.h>
+#include "uml.h"
+
void
list_box_separators (GtkListBoxRow *row,
GtkListBoxRow *before,
diff --git a/objects/UML/dia-uml-parameter.h b/objects/UML/dia-uml-parameter.h
index eaca94c8..e0064724 100644
--- a/objects/UML/dia-uml-parameter.h
+++ b/objects/UML/dia-uml-parameter.h
@@ -27,7 +27,7 @@ struct _DiaUmlParameter {
UMLParameterKind kind; /**< Not currently used */
};
-DiaUmlParameter *dia_uml_parameter_new ();
+DiaUmlParameter *dia_uml_parameter_new (void);
/** calculated the 'formated' representation */
gchar *dia_uml_parameter_format (DiaUmlParameter *param);
diff --git a/plug-ins/python/diamodule.c b/plug-ins/python/diamodule.c
index 6b424b9e..bd4bf817 100644
--- a/plug-ins/python/diamodule.c
+++ b/plug-ins/python/diamodule.c
@@ -221,15 +221,15 @@ PyDia_RegisteredSheets(PyObject *self, PyObject *args)
static PyObject *
PyDia_ActiveDisplay(PyObject *self, PyObject *args)
{
- DDisplay *disp;
+ DiaDisplay *disp;
- if (!PyArg_ParseTuple(args, ":dia.active_display"))
- return NULL;
- disp = ddisplay_active();
- if (disp)
- return PyDiaDisplay_New(disp);
- Py_INCREF(Py_None);
- return Py_None;
+ if (!PyArg_ParseTuple(args, ":dia.active_display"))
+ return NULL;
+ disp = dia_display_active();
+ if (disp)
+ return PyDiaDisplay_New(disp);
+ Py_INCREF(Py_None);
+ return Py_None;
}
static PyObject *
diff --git a/plug-ins/python/pydia-diagram.c b/plug-ins/python/pydia-diagram.c
index 447e6a1e..9e88a994 100644
--- a/plug-ins/python/pydia-diagram.c
+++ b/plug-ins/python/pydia-diagram.c
@@ -332,12 +332,13 @@ PyDiaDiagram_Save(PyDiaDiagram *self, PyObject *args)
static PyObject *
PyDiaDiagram_Display(PyDiaDiagram *self, PyObject *args)
{
- DDisplay *disp;
+ DiaDisplay *disp;
- if (!PyArg_ParseTuple(args, ":Diagram.display"))
- return NULL;
- disp = new_display(self->dia);
- return PyDiaDisplay_New(disp);
+ if (!PyArg_ParseTuple(args, ":Diagram.display"))
+ return NULL;
+
+ disp = dia_display_new (self->dia);
+ return PyDiaDisplay_New(disp);
}
/*
@@ -573,7 +574,7 @@ PyDiaDiagram_GetAttr(PyDiaDiagram *self, gchar *attr)
ret = PyTuple_New(g_slist_length(self->dia->displays));
for (i = 0, tmp = self->dia->displays; tmp; i++, tmp = tmp->next)
- PyTuple_SetItem(ret, i, PyDiaDisplay_New((DDisplay *)tmp->data));
+ PyTuple_SetItem(ret, i, PyDiaDisplay_New((DiaDisplay *)tmp->data));
return ret;
}
diff --git a/plug-ins/python/pydia-display.c b/plug-ins/python/pydia-display.c
index 1e8b063c..503e1baf 100644
--- a/plug-ins/python/pydia-display.c
+++ b/plug-ins/python/pydia-display.c
@@ -26,7 +26,7 @@
#include <structmember.h> /* PyMemberDef */
PyObject *
-PyDiaDisplay_New(DDisplay *disp)
+PyDiaDisplay_New(DiaDisplay *disp)
{
PyDiaDisplay *self;
@@ -68,132 +68,132 @@ PyDiaDisplay_Str(PyDiaDisplay *self)
static PyObject *
PyDiaDisplay_AddUpdateAll(PyDiaDisplay *self, PyObject *args)
{
- if (!PyArg_ParseTuple(args, ":Display.add_update_all"))
- return NULL;
- ddisplay_add_update_all(self->disp);
- Py_INCREF(Py_None);
- return Py_None;
+ if (!PyArg_ParseTuple(args, ":Display.add_update_all"))
+ return NULL;
+ dia_display_add_update_all(self->disp);
+ Py_INCREF(Py_None);
+ return Py_None;
}
static PyObject *
PyDiaDisplay_Flush(PyDiaDisplay *self, PyObject *args)
{
- if (!PyArg_ParseTuple(args, ":Display.flush"))
- return NULL;
- ddisplay_flush(self->disp);
- Py_INCREF(Py_None);
- return Py_None;
+ if (!PyArg_ParseTuple(args, ":Display.flush"))
+ return NULL;
+ dia_display_flush(self->disp);
+ Py_INCREF(Py_None);
+ return Py_None;
}
static PyObject *
PyDiaDisplay_SetOrigion(PyDiaDisplay *self, PyObject *args)
{
- double x, y;
+ double x, y;
- if (!PyArg_ParseTuple(args, "dd:Display.set_origion", &x, &y))
- return NULL;
- ddisplay_set_origo(self->disp, x, y);
- Py_INCREF(Py_None);
- return Py_None;
+ if (!PyArg_ParseTuple(args, "dd:Display.set_origion", &x, &y))
+ return NULL;
+ dia_display_set_origo(self->disp, x, y);
+ Py_INCREF(Py_None);
+ return Py_None;
}
static PyObject *
PyDiaDisplay_Zoom(PyDiaDisplay *self, PyObject *args)
{
- Point p;
- double zoom;
-
- if (!PyArg_ParseTuple(args, "(dd)d:Display.zoom", &p.x, &p.y, &zoom))
- return NULL;
- ddisplay_zoom(self->disp, &p, zoom);
- Py_INCREF(Py_None);
- return Py_None;
+ Point p;
+ double zoom;
+
+ if (!PyArg_ParseTuple(args, "(dd)d:Display.zoom", &p.x, &p.y, &zoom))
+ return NULL;
+ dia_display_zoom(self->disp, &p, zoom);
+ Py_INCREF(Py_None);
+ return Py_None;
}
static PyObject *
PyDiaDisplay_ResizeCanvas(PyDiaDisplay *self, PyObject *args)
{
- int width, height;
+ int width, height;
- if (!PyArg_ParseTuple(args, "ii:Display.resize_canvas", &width,&height))
- return NULL;
- ddisplay_resize_canvas(self->disp, width, height);
- Py_INCREF(Py_None);
- return Py_None;
+ if (!PyArg_ParseTuple(args, "ii:Display.resize_canvas", &width,&height))
+ return NULL;
+ dia_display_resize_canvas(self->disp, width, height);
+ Py_INCREF(Py_None);
+ return Py_None;
}
static PyObject *
PyDiaDisplay_Close(PyDiaDisplay *self, PyObject *args)
{
- if (!PyArg_ParseTuple(args, ":Display.close"))
- return NULL;
- ddisplay_close(self->disp);
- Py_INCREF(Py_None);
- return Py_None;
+ if (!PyArg_ParseTuple(args, ":Display.close"))
+ return NULL;
+ dia_display_close(self->disp);
+ Py_INCREF(Py_None);
+ return Py_None;
}
static PyObject *
PyDiaDisplay_SetTitle(PyDiaDisplay *self, PyObject *args)
{
- gchar *title;
+ gchar *title;
- if (!PyArg_ParseTuple(args, "s:Display.set_title", &title))
- return NULL;
- ddisplay_set_title(self->disp, title);
- Py_INCREF(Py_None);
- return Py_None;
+ if (!PyArg_ParseTuple(args, "s:Display.set_title", &title))
+ return NULL;
+ dia_display_set_title(self->disp, title);
+ Py_INCREF(Py_None);
+ return Py_None;
}
static PyObject *
PyDiaDisplay_Scroll(PyDiaDisplay *self, PyObject *args)
{
- Point delta;
+ Point delta;
- if (!PyArg_ParseTuple(args, "dd:Display.scroll", &delta.x, &delta.y))
- return NULL;
- ddisplay_scroll(self->disp, &delta);
- Py_INCREF(Py_None);
- return Py_None;
+ if (!PyArg_ParseTuple(args, "dd:Display.scroll", &delta.x, &delta.y))
+ return NULL;
+ dia_display_scroll(self->disp, &delta);
+ Py_INCREF(Py_None);
+ return Py_None;
}
static PyObject *
PyDiaDisplay_ScrollUp(PyDiaDisplay *self, PyObject *args)
{
- if (!PyArg_ParseTuple(args, ":Display.scroll_up"))
- return NULL;
- ddisplay_scroll_up(self->disp);
- Py_INCREF(Py_None);
- return Py_None;
+ if (!PyArg_ParseTuple(args, ":Display.scroll_up"))
+ return NULL;
+ dia_display_scroll_up(self->disp);
+ Py_INCREF(Py_None);
+ return Py_None;
}
static PyObject *
PyDiaDisplay_ScrollDown(PyDiaDisplay *self, PyObject *args)
{
- if (!PyArg_ParseTuple(args, ":Display.scroll_down"))
- return NULL;
- ddisplay_scroll_down(self->disp);
- Py_INCREF(Py_None);
- return Py_None;
+ if (!PyArg_ParseTuple(args, ":Display.scroll_down"))
+ return NULL;
+ dia_display_scroll_down(self->disp);
+ Py_INCREF(Py_None);
+ return Py_None;
}
static PyObject *
PyDiaDisplay_ScrollLeft(PyDiaDisplay *self, PyObject *args)
{
- if (!PyArg_ParseTuple(args, ":Display.scroll_left"))
- return NULL;
- ddisplay_scroll_left(self->disp);
- Py_INCREF(Py_None);
- return Py_None;
+ if (!PyArg_ParseTuple(args, ":Display.scroll_left"))
+ return NULL;
+ dia_display_scroll_left(self->disp);
+ Py_INCREF(Py_None);
+ return Py_None;
}
static PyObject *
PyDiaDisplay_ScrollRight(PyDiaDisplay *self, PyObject *args)
{
- if (!PyArg_ParseTuple(args, ":Display.scroll_right"))
- return NULL;
- ddisplay_scroll_right(self->disp);
- Py_INCREF(Py_None);
- return Py_None;
+ if (!PyArg_ParseTuple(args, ":Display.scroll_right"))
+ return NULL;
+ dia_display_scroll_right(self->disp);
+ Py_INCREF(Py_None);
+ return Py_None;
}
static PyMethodDef PyDiaDisplay_Methods[] = {
diff --git a/plug-ins/python/pydia-display.h b/plug-ins/python/pydia-display.h
index 807fa3d4..4d9781b8 100644
--- a/plug-ins/python/pydia-display.h
+++ b/plug-ins/python/pydia-display.h
@@ -26,12 +26,12 @@
typedef struct {
PyObject_HEAD
- DDisplay *disp;
+ DiaDisplay *disp;
} PyDiaDisplay;
extern PyTypeObject PyDiaDisplay_Type;
-PyObject *PyDiaDisplay_New(DDisplay *disp);
+PyObject *PyDiaDisplay_New(DiaDisplay *disp);
#endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]