aboutsummaryrefslogtreecommitdiff
path: root/src/mainwindow.c
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.org.uk>2011-10-03 15:11:14 +0200
committerThomas White <taw@bitwiz.org.uk>2011-10-03 15:11:14 +0200
commit7c04fa7edd76c6a06121a88b8a346d45917af0dc (patch)
treebfcf21d8f2941667c08eb76215a5dde89a4fb470 /src/mainwindow.c
parentf4ff26c955729f8b068c64fff806216eb6e34bd4 (diff)
More fun with methods
Diffstat (limited to 'src/mainwindow.c')
-rw-r--r--src/mainwindow.c35
1 files changed, 14 insertions, 21 deletions
diff --git a/src/mainwindow.c b/src/mainwindow.c
index 54f098e..df9ce49 100644
--- a/src/mainwindow.c
+++ b/src/mainwindow.c
@@ -38,6 +38,7 @@
#include "slideshow.h"
#include "stylesheet.h"
#include "loadsave.h"
+#include "tool_select.h"
#include "tool_text.h"
@@ -397,7 +398,7 @@ static gint add_furniture(GtkWidget *widget, struct presentation *p)
g_free(name);
if ( sty == NULL ) return 0;
- p->text_tool->create_default(p, sty);
+ p->text_tool->create_default(p, sty, p->text_tool);
return 0;
}
@@ -543,6 +544,12 @@ static void redraw_object(struct object *o)
}
+static void redraw_overlay(struct presentation *p)
+{
+ gdk_window_invalidate_rect(p->drawingarea->window, NULL, FALSE);
+}
+
+
static gboolean im_commit_sig(GtkIMContext *im, gchar *str,
struct presentation *p)
{
@@ -653,34 +660,16 @@ static gboolean button_press_sig(GtkWidget *da, GdkEventButton *event,
}
- /* FIXME: Tool is responsible for this */
- if ( p->editing_object && p->editing_object->empty ) {
- delete_object(p->editing_object);
- }
-
gtk_widget_grab_focus(GTK_WIDGET(da));
- redraw_object(p->editing_object);
+ redraw_overlay(p);
return FALSE;
}
-static void draw_editing_box(cairo_t *cr, double xmin, double ymin,
- double width, double height)
-{
- cairo_new_path(cr);
- cairo_rectangle(cr, xmin-5.0, ymin-5.0, width+10.0, height+10.0);
- cairo_set_source_rgb(cr, 0.0, 0.69, 1.0);
- cairo_set_line_width(cr, 0.5);
- cairo_stroke(cr);
-}
-
-
static void draw_editing_bits(cairo_t *cr, struct presentation *p,
struct object *o)
{
- draw_editing_box(cr, o->x, o->y, o->bb_width, o->bb_height);
-
- o->draw_editing_overlay(cr, o);
+ p->cur_tool->draw_editing_overlay(cr, o);
/* Draw margins */
cairo_move_to(cr, o->style->margin_left, -p->border_offs_y);
@@ -955,6 +944,10 @@ int open_mainwindow(struct presentation *p)
p->slide_width + 20,
p->slide_height + 20);
+ p->select_tool = initialise_select_tool();
+ p->text_tool = initialise_text_tool(p->drawingarea);
+ p->cur_tool = p->select_tool;
+
gtk_widget_set_can_focus(GTK_WIDGET(p->drawingarea), TRUE);
gtk_widget_add_events(GTK_WIDGET(p->drawingarea),
GDK_POINTER_MOTION_HINT_MASK