aboutsummaryrefslogtreecommitdiff
path: root/src/ld-window-main.c
diff options
context:
space:
mode:
authorPřemysl Janouch <p.janouch@gmail.com>2010-12-07 00:59:05 +0100
committerPřemysl Janouch <p.janouch@gmail.com>2010-12-10 22:36:41 +0100
commit3419680f2523414d4ac7349232eb92b627dd993a (patch)
tree12732dbe05f81d3a2a866446913b5bc5b15de25a /src/ld-window-main.c
parent37d898fb1a29f074747dbd9c81d6e2ad97d2e23e (diff)
downloadlogdiag-3419680f2523414d4ac7349232eb92b627dd993a.tar.gz
logdiag-3419680f2523414d4ac7349232eb92b627dd993a.tar.xz
logdiag-3419680f2523414d4ac7349232eb92b627dd993a.zip
Implement more of LdCanvas.
1. Add methods for coordinate translation between cairo/GtkWidget coordinates and LdDocument coordinates. 2. Draw the grid correctly (also make it significantly faster). 3. Place the canvas into a GtkScrolledWindow and register the set_scroll_adjustments signal in the GtkWidget base class. 4. Allow scrolling inside of an area of 200 x 200 units (for now). In the future, it should be possible to go to infinity.
Diffstat (limited to 'src/ld-window-main.c')
-rw-r--r--src/ld-window-main.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/ld-window-main.c b/src/ld-window-main.c
index bcacf3f..99910d8 100644
--- a/src/ld-window-main.c
+++ b/src/ld-window-main.c
@@ -97,6 +97,8 @@ struct _LdWindowMainPrivate
GtkWidget *toolbar;
LdLibrary *library;
+
+ GtkWidget *canvas_window;
LdCanvas *canvas;
GtkWidget *statusbar;
@@ -270,10 +272,9 @@ ld_window_main_init (LdWindowMain *self)
/* TODO in the future: GtkHPaned */
/* Canvas. */
- /* TODO: Put it into a GtkScrolledWindow. */
priv->canvas = ld_canvas_new ();
- /* TODO: To be able to draw a symbol menu over the canvas, we may:
+ /* XXX: To be able to draw a symbol menu over the canvas, we may:
* 1. Hook the expose-event and button-{press,release}-event signals.
* 2. Create a hook mechanism in the LdCanvas object.
* + The cairo context would not have to be created twice.
@@ -297,7 +298,10 @@ ld_window_main_init (LdWindowMain *self)
g_signal_handler_block (priv->canvas,
priv->symbol_menu.button_release_handler);
- gtk_box_pack_start (GTK_BOX (priv->hbox), GTK_WIDGET (priv->canvas),
+ priv->canvas_window = gtk_scrolled_window_new (NULL, NULL);
+ gtk_container_add (GTK_CONTAINER (priv->canvas_window),
+ GTK_WIDGET (priv->canvas));
+ gtk_box_pack_start (GTK_BOX (priv->hbox), GTK_WIDGET (priv->canvas_window),
TRUE, TRUE, 0);
priv->statusbar = gtk_statusbar_new ();