[dia/dia-next: 28/59] Move canvas logic to a seperate class



commit b85d520f09af5ad7f42ea553aaa87bf1250789e7
Author: Zander Brown <zbrown gnome org>
Date:   Thu Dec 27 01:11:09 2018 +0000

    Move canvas logic to a seperate class

 app/Makefile.am      |   2 +
 app/dia-canvas.c     | 251 +++++++++++++++++++++++++++++++++++++++++++++++++++
 app/dia-canvas.h     |  22 +++++
 app/disp_callbacks.c |   6 +-
 app/disp_callbacks.h |   2 +-
 app/display.c        |  35 ++++++-
 app/display.h        |  16 +++-
 app/interface.c      | 186 ++------------------------------------
 app/interface.h      |   9 ++
 9 files changed, 343 insertions(+), 186 deletions(-)
---
diff --git a/app/Makefile.am b/app/Makefile.am
index 674fc80e..7c05f03f 100644
--- a/app/Makefile.am
+++ b/app/Makefile.am
@@ -125,6 +125,8 @@ dia_core_files = \
        connectionpoint_ops.c \
        disp_callbacks.c \
        disp_callbacks.h \
+       dia-canvas.c \
+       dia-canvas.h \
        display.c \
        display.h \
        select.c \
diff --git a/app/dia-canvas.c b/app/dia-canvas.c
new file mode 100644
index 00000000..664eb3ff
--- /dev/null
+++ b/app/dia-canvas.c
@@ -0,0 +1,251 @@
+/* Minimal reimplementation of GtkList, prototyped in Vala */
+
+
+#include <glib.h>
+#include <gtk/gtk.h>
+
+#include "dia-canvas.h"
+#include "disp_callbacks.h"
+#include "toolbox.h"
+#include "display.h"
+#include "interface.h"
+#include "object.h"
+
+typedef struct _DiaCanvasPrivate DiaCanvasPrivate;
+
+struct _DiaCanvasPrivate {
+  DDisplayBox *disp_box;
+};
+
+G_DEFINE_TYPE_WITH_CODE (DiaCanvas, dia_canvas, GTK_TYPE_DRAWING_AREA,
+                         G_ADD_PRIVATE (DiaCanvas))
+
+enum {
+  PROP_DDISPLAY = 1,
+  N_PROPS
+};
+static GParamSpec* properties[N_PROPS];
+
+
+GtkWidget *
+dia_canvas_new (DDisplay *ddisp)
+{
+  return g_object_new (DIA_TYPE_CANVAS,
+                       "ddisplay", display_box_new (ddisp),
+                       NULL);
+}
+
+DDisplay *
+dia_canvas_get_ddisplay (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;
+}
+
+static gboolean
+dia_canvas_drag_drop (GtkWidget      *self,
+                      GdkDragContext *context,
+                      gint            x,
+                      gint            y,
+                      guint           time)
+{
+  if (gtk_drag_get_source_widget (context) != NULL) {
+    /* we only accept drops from the same instance of the application,
+     * as the drag data is a pointer in our address space */
+    return TRUE;
+  }
+  gtk_drag_finish (context, FALSE, FALSE, time);
+  return FALSE;
+}
+
+static void
+dia_canvas_drag_data_received (GtkWidget        *self,
+                               GdkDragContext   *context,
+                               gint              x,
+                               gint              y,
+                               GtkSelectionData *data,
+                               guint             info,
+                               guint             time)
+{
+  DDisplay *ddisp = dia_canvas_get_ddisplay (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,
+                          object_get_type ((gchar *) tooldata->extra_data),
+                          tooldata->user_data);
+
+    gtk_drag_finish (context, TRUE, FALSE, time);
+  } else {
+    dia_dnd_file_drag_data_received (self, context, x, y, data, info, time, ddisp);
+  }
+  /* ensure the right window has the focus for text editing */
+  gtk_window_present (GTK_WINDOW (ddisp->shell));
+}
+
+/*!
+ * Called when the widget's window "size, position or stacking"
+ * changes. Needs GDK_STRUCTURE_MASK set.
+ */
+static void
+dia_canvas_size_allocate (GtkWidget     *self,
+                          GtkAllocation *alloc)
+{
+  int width, height;
+  DDisplay *ddisp = dia_canvas_get_ddisplay (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.
+     */
+    width = height = 0;
+  }
+
+  /* Only do this when size is really changing */
+  if (width != alloc->width || height != alloc->height) {
+    g_message ("Canvas size change...\n");
+    ddisplay_resize_canvas (ddisp, alloc->width, alloc->height);
+    ddisplay_update_scrollbars(ddisp);
+  }
+
+  /* If the UI is not integrated, resizing should set the resized
+   * window as active.  With integrated UI, there is only one window.
+   */
+  if (is_integrated_ui () == 0)
+    display_set_active(ddisp);
+
+  GTK_WIDGET_CLASS (dia_canvas_parent_class)->size_allocate (self, alloc);
+}
+
+static gboolean
+dia_canvas_draw (GtkWidget *self,
+                 cairo_t   *ctx)
+{
+  GSList *l;
+  Rectangle *r, totrect;
+  DiaInteractiveRendererInterface *renderer;
+  DDisplay *ddisp = dia_canvas_get_ddisplay (DIA_CANVAS (self));
+
+  g_return_val_if_fail (ddisp->renderer != NULL, FALSE);
+
+  /* Renders updates to pixmap + copies display_areas to canvas(screen) */
+  renderer = DIA_GET_INTERACTIVE_RENDERER_INTERFACE (ddisp->renderer);
+
+  /* Only update if update_areas exist */
+  l = ddisp->update_areas;
+  if (l != NULL)
+  {
+    totrect = *(Rectangle *) l->data;
+  
+    g_return_val_if_fail (   renderer->clip_region_clear != NULL
+                          && renderer->clip_region_add_rect != NULL, FALSE);
+
+    renderer->clip_region_clear (ddisp->renderer);
+
+    while(l!=NULL) {
+      r = (Rectangle *) l->data;
+
+      rectangle_union(&totrect, r);
+      renderer->clip_region_add_rect (ddisp->renderer, r);
+      
+      l = g_slist_next(l);
+    }
+    /* Free update_areas list: */
+    l = ddisp->update_areas;
+    while(l!=NULL) {
+      g_free(l->data);
+      l = g_slist_next(l);
+    }
+    g_slist_free(ddisp->update_areas);
+    ddisp->update_areas = NULL;
+
+    totrect.left -= 0.1;
+    totrect.right += 0.1;
+    totrect.top -= 0.1;
+    totrect.bottom += 0.1;
+    
+    ddisplay_render_pixmap(ddisp, &totrect);
+  }
+
+  dia_interactive_renderer_paint (ddisp->renderer,
+                                  ctx,
+                                  gtk_widget_get_allocated_width (self),
+                                  gtk_widget_get_allocated_height (self));
+
+  return FALSE;
+}
+
+static void
+dia_canvas_set_property (GObject      *object,
+                         guint         property_id,
+                         const GValue *value,
+                         GParamSpec   *pspec)
+{
+  DiaCanvas *self = DIA_CANVAS (object);
+  DiaCanvasPrivate *priv = dia_canvas_get_instance_private (self);
+  DDisplayBox *box;
+  switch (property_id) {
+    case PROP_DDISPLAY:
+      box = g_value_get_boxed (value);
+      priv->disp_box = display_box_new (box->ddisp);
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+      break;
+  }
+}
+
+static void
+dia_canvas_class_init (DiaCanvasClass *klass)
+{
+  GObjectClass   *object_class = G_OBJECT_CLASS (klass);
+  GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+
+  object_class->set_property = dia_canvas_set_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);
+
+  g_object_class_install_properties (object_class,
+                                     N_PROPS,
+                                     properties);
+
+  widget_class->drag_drop = dia_canvas_drag_drop;
+  widget_class->drag_data_received = dia_canvas_drag_data_received;
+  widget_class->size_allocate = dia_canvas_size_allocate;
+  widget_class->draw = dia_canvas_draw;
+
+  gtk_widget_class_set_css_name (widget_class, "dia-canvas");
+}
+
+static void
+dia_canvas_init (DiaCanvas * self)
+{
+  gtk_widget_add_events (GTK_WIDGET (self),
+                         GDK_POINTER_MOTION_MASK |
+                         GDK_POINTER_MOTION_HINT_MASK |
+                         GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | 
+                         GDK_ENTER_NOTIFY_MASK | GDK_KEY_PRESS_MASK |
+                         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);
+
+  canvas_setup_drag_dest (GTK_WIDGET (self));
+}
diff --git a/app/dia-canvas.h b/app/dia-canvas.h
new file mode 100644
index 00000000..275e753d
--- /dev/null
+++ b/app/dia-canvas.h
@@ -0,0 +1,22 @@
+#ifndef __DIACANVAS_H__
+#define __DIACANVAS_H__
+
+#include <glib.h>
+#include <gtk/gtk.h>
+#include "display.h"
+
+G_BEGIN_DECLS
+
+#define DIA_TYPE_CANVAS (dia_canvas_get_type ())
+G_DECLARE_DERIVABLE_TYPE (DiaCanvas, dia_canvas, DIA, CANVAS, GtkDrawingArea)
+
+struct _DiaCanvasClass {
+  GtkDrawingAreaClass parent_class;
+};
+
+GtkWidget       *dia_canvas_new                 (DDisplay  *ddisp);
+DDisplay        *dia_canvas_get_ddisplay        (DiaCanvas *self);
+
+G_END_DECLS
+
+#endif
diff --git a/app/disp_callbacks.c b/app/disp_callbacks.c
index a888a6fb..2ef37476 100644
--- a/app/disp_callbacks.c
+++ b/app/disp_callbacks.c
@@ -47,6 +47,7 @@
 #include "object.h"
 #include "disp_callbacks.h"
 #include "create.h"
+#include "dia-canvas.h"
 
 typedef struct {
        GdkEvent *event; /* Button down event which may be holding */
@@ -687,8 +688,8 @@ hold_timeout_handler(gpointer data)
  */
 gint
 ddisplay_canvas_events (GtkWidget *canvas,
-                       GdkEvent  *event,
-                       DDisplay *ddisp)
+                        GdkEvent  *event,
+                        gpointer   data)
 {
   GdkEventMotion *mevent;
   GdkEventButton *bevent;
@@ -705,6 +706,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));
   
   return_val = FALSE;
  
diff --git a/app/disp_callbacks.h b/app/disp_callbacks.h
index 84c5a25a..4058791d 100644
--- a/app/disp_callbacks.h
+++ b/app/disp_callbacks.h
@@ -27,7 +27,7 @@ gint ddisplay_focus_out_event (GtkWidget *widget, GdkEventFocus *event,
 void ddisplay_realize (GtkWidget *widget, gpointer data);
 void ddisplay_unrealize (GtkWidget *widget, gpointer data);
 
-gint ddisplay_canvas_events (GtkWidget *, GdkEvent *, DDisplay *ddisp);
+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);
diff --git a/app/display.c b/app/display.c
index 0b5ef0c9..888fd7de 100644
--- a/app/display.c
+++ b/app/display.c
@@ -48,6 +48,39 @@
 #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_return_val_if_fail (src != NULL, NULL);
+
+  dest->ddisp = src->ddisp;
+
+  return dest;
+}
+
+static void
+display_box_free (gpointer box)
+{
+  g_slice_free (DDisplayBox, box);
+}
+
+DDisplayBox *
+display_box_new (DDisplay *ddisp)
+{
+  DDisplayBox *dest = g_slice_new (DDisplayBox);
+
+  g_return_val_if_fail (ddisp != NULL, NULL);
+
+  dest->ddisp = ddisp;
+
+  return dest;
+}
+
+G_DEFINE_BOXED_TYPE (DDisplayBox, ddisplay, display_box_copy, display_box_free)
+
 static GdkCursor *current_cursor = NULL;
 
 GdkCursor *default_cursor = NULL;
@@ -1016,7 +1049,7 @@ ddisplay_active_diagram(void)
   return ddisp->diagram;
 }
 
-static void 
+void 
 ddisp_destroy(DDisplay *ddisp)
 {
   g_signal_handlers_disconnect_by_func (ddisp->diagram, selection_changed, ddisp);
diff --git a/app/display.h b/app/display.h
index 929e8905..ad373c87 100644
--- a/app/display.h
+++ b/app/display.h
@@ -112,8 +112,20 @@ struct _DDisplay {
 
 extern GdkCursor *default_cursor;
 
-DDisplay *new_display(Diagram *dia);
-DDisplay *copy_display(DDisplay *orig_ddisp);
+typedef struct _DDisplayBox DDisplayBox;
+
+struct _DDisplayBox {
+  DDisplay *ddisp;
+};
+
+#define DIA_TYPE_DISPLAY (ddisplay_get_type ())
+
+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);
+
 /* Normal destroy is done through shell widget destroy event. */
 void ddisplay_really_destroy(DDisplay *ddisp); 
 void ddisplay_transform_coords_double(DDisplay *ddisp,
diff --git a/app/interface.c b/app/interface.c
index 2ffeb819..fabeb48c 100644
--- a/app/interface.c
+++ b/app/interface.c
@@ -47,8 +47,9 @@
 
 #include <gdk-pixbuf/gdk-pixbuf.h>
 #include "dia-app-icons.h"
+#include "dia-canvas.h"
 
-static void
+void
 dia_dnd_file_drag_data_received (GtkWidget        *widget,
                                  GdkDragContext   *context,
                                  gint              x,
@@ -279,46 +280,6 @@ create_zoom_widget(DDisplay *ddisp) {
   return combo;
 }
 
-static gboolean
-display_drop_callback(GtkWidget *widget, GdkDragContext *context,
-                     gint x, gint y, guint time)
-{
-  if (gtk_drag_get_source_widget(context) != NULL) {
-    /* we only accept drops from the same instance of the application,
-     * as the drag data is a pointer in our address space */
-    return TRUE;
-  }
-  gtk_drag_finish (context, FALSE, FALSE, time);
-  return FALSE;
-}
-
-static void
-display_data_received_callback (GtkWidget *widget, 
-                               GdkDragContext *context,
-                               gint x, 
-                               gint y, 
-                               GtkSelectionData *data,
-                               guint info, 
-                               guint time, 
-                               DDisplay *ddisp)
-{
-  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,
-                        object_get_type((gchar *)tooldata->extra_data),
-                        tooldata->user_data);
-
-    gtk_drag_finish (context, TRUE, FALSE, time);
-  } else {
-    dia_dnd_file_drag_data_received (widget, context, x, y, data, info, time, ddisp);
-  }
-  /* ensure the right window has the focus for text editing */
-  gtk_window_present(GTK_WINDOW(ddisp->shell));
-}
-
 /**
  * @param button The notebook close button.
  * @param user_data Container widget (e.g. VBox).
@@ -334,141 +295,6 @@ close_notebook_page_callback (GtkButton *button,
   ddisplay_close (ddisp);
 }
 
-/*!
- * Called when the widget's window "size, position or stacking"
- * changes. Needs GDK_STRUCTURE_MASK set.
- */
-static gboolean
-canvas_configure_event (GtkWidget         *widget,
-                       GdkEventConfigure *cevent,
-                       DDisplay          *ddisp)
-{
-  gboolean new_size = FALSE;
-  int width, height;
-
-  g_return_val_if_fail (widget == ddisp->canvas, FALSE);
-
-
-  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.
-     */
-    width = height = 0;
-  }
-
-  /* Only do this when size is really changing */
-  if (width != cevent->width || height != cevent->height) {
-    g_print ("Canvas size change...\n");
-    ddisplay_resize_canvas (ddisp, cevent->width, cevent->height);
-    ddisplay_update_scrollbars(ddisp);
-    /* on resize stop further propagation - does not help */
-    new_size = TRUE;
-  }
-
-  /* If the UI is not integrated, resizing should set the resized
-   * window as active.  With integrated UI, there is only one window.
-   */
-  if (is_integrated_ui () == 0)
-    display_set_active(ddisp);
-
-  /* continue propagation with FALSE */
-  return new_size;
-}
-
-static gboolean
-canvas_draw (GtkWidget      *widget,
-             cairo_t        *ctx,
-             DDisplay       *ddisp)
-{
-  GSList *l;
-  Rectangle *r, totrect;
-  DiaInteractiveRendererInterface *renderer;
-
-  g_return_val_if_fail (ddisp->renderer != NULL, FALSE);
-
-  /* Renders updates to pixmap + copies display_areas to canvas(screen) */
-  renderer = DIA_GET_INTERACTIVE_RENDERER_INTERFACE (ddisp->renderer);
-
-  /* Only update if update_areas exist */
-  l = ddisp->update_areas;
-  if (l != NULL)
-  {
-    totrect = *(Rectangle *) l->data;
-  
-    g_return_val_if_fail (   renderer->clip_region_clear != NULL
-                          && renderer->clip_region_add_rect != NULL, FALSE);
-
-    renderer->clip_region_clear (ddisp->renderer);
-
-    while(l!=NULL) {
-      r = (Rectangle *) l->data;
-
-      rectangle_union(&totrect, r);
-      renderer->clip_region_add_rect (ddisp->renderer, r);
-      
-      l = g_slist_next(l);
-    }
-    /* Free update_areas list: */
-    l = ddisp->update_areas;
-    while(l!=NULL) {
-      g_free(l->data);
-      l = g_slist_next(l);
-    }
-    g_slist_free(ddisp->update_areas);
-    ddisp->update_areas = NULL;
-
-    totrect.left -= 0.1;
-    totrect.right += 0.1;
-    totrect.top -= 0.1;
-    totrect.bottom += 0.1;
-    
-    ddisplay_render_pixmap(ddisp, &totrect);
-  }
-
-  dia_interactive_renderer_paint (ddisp->renderer,
-                                  ctx,
-                                  gtk_widget_get_allocated_width (widget),
-                                  gtk_widget_get_allocated_height (widget));
-
-  return FALSE;
-}
-
-static GtkWidget *
-create_canvas (DDisplay *ddisp)
-{
-  GtkWidget *canvas = gtk_drawing_area_new();
-
-  /* Dia's canvas does it's double buffering alone so switch off GTK's */
-  gtk_widget_set_double_buffered (canvas, FALSE);
-
-  gtk_widget_set_events (canvas,
-                        GDK_EXPOSURE_MASK | 
-                        GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK |
-                        GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | 
-                        GDK_STRUCTURE_MASK | GDK_ENTER_NOTIFY_MASK |
-                        GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK);
-  g_signal_connect (G_OBJECT (canvas), "configure-event",
-                   G_CALLBACK (canvas_configure_event), ddisp);
-  g_signal_connect (G_OBJECT (canvas), "draw",
-                    G_CALLBACK (canvas_draw), ddisp);
-  gtk_widget_set_can_focus (canvas, TRUE);
-  g_signal_connect (G_OBJECT (canvas), "event",
-                    G_CALLBACK(ddisplay_canvas_events),
-                    ddisp);
-
-  canvas_setup_drag_dest (canvas);
-  g_signal_connect (G_OBJECT (canvas), "drag_drop",
-                   G_CALLBACK(display_drop_callback), NULL);
-  g_signal_connect (G_OBJECT (canvas), "drag_data_received",
-                   G_CALLBACK(display_data_received_callback), ddisp);
-  g_object_set_data (G_OBJECT (canvas), "user_data", (gpointer) ddisp);
-
-  return canvas;
-}
-
 /* Shared helper functions for both UI cases
  */
 static void
@@ -507,9 +333,9 @@ _ddisplay_setup_scrollbars (DDisplay *ddisp, GtkWidget *table, int width, int he
   ddisp->hsbdata = GTK_ADJUSTMENT (gtk_adjustment_new (0, 0, width, 1, (width-1)/4, width-1));
   ddisp->vsbdata = GTK_ADJUSTMENT (gtk_adjustment_new (0, 0, height, 1, (height-1)/4, height-1));
 
-  ddisp->hsb = gtk_hscrollbar_new (ddisp->hsbdata);
+  ddisp->hsb = gtk_scrollbar_new (GTK_ORIENTATION_HORIZONTAL, ddisp->hsbdata);
   gtk_widget_set_can_focus (ddisp->hsb, FALSE);
-  ddisp->vsb = gtk_vscrollbar_new (ddisp->vsbdata);
+  ddisp->vsb = gtk_scrollbar_new (GTK_ORIENTATION_VERTICAL, ddisp->vsbdata);
   gtk_widget_set_can_focus (ddisp->vsb, FALSE);
 
   /*  set up the scrollbar observers  */
@@ -631,7 +457,7 @@ use_integrated_ui_for_display_shell(DDisplay *ddisp, char *title)
   _ddisplay_setup_scrollbars (ddisp, table, width, height);
   _ddisplay_setup_navigation (ddisp, table, TRUE);
 
-  ddisp->canvas = create_canvas (ddisp);
+  ddisp->canvas = dia_canvas_new (ddisp);
 
   /*  place all remaining widgets (no 'origin' anymore, since navigation is top-left */
   gtk_widget_set_hexpand (ddisp->canvas, TRUE);
@@ -759,7 +585,7 @@ create_display_shell(DDisplay *ddisp,
   _ddisplay_setup_scrollbars (ddisp, table, width, height);
   _ddisplay_setup_navigation (ddisp, table, FALSE);
 
-  ddisp->canvas = create_canvas (ddisp);
+  ddisp->canvas = dia_canvas_new (ddisp);
 
   /*  pack all remaining widgets  */
   gtk_grid_attach (GTK_GRID (table), ddisp->origin, 0, 0, 1, 1);
diff --git a/app/interface.h b/app/interface.h
index 9e9b9c0a..a3b9cf30 100644
--- a/app/interface.h
+++ b/app/interface.h
@@ -59,4 +59,13 @@ void fill_sheet_menu(void);
 
 void close_notebook_page_callback (GtkButton *button, gpointer user_data);
 
+void dia_dnd_file_drag_data_received (GtkWidget        *widget,
+                                      GdkDragContext   *context,
+                                      gint              x,
+                                      gint              y,
+                                      GtkSelectionData *data,
+                                      guint             info,
+                                      guint             time,
+                                      DDisplay         *ddisp);
+
 #endif /* INTERFACE_H */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]