aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.org.uk>2011-08-10 23:00:53 +0200
committerThomas White <taw@bitwiz.org.uk>2011-08-10 23:00:53 +0200
commitaf7eb5322812b47a32ac3c246812fdc870163b6c (patch)
treea86f8953a37f50cf41228b1080f0231cd82c0655 /src
parent87d1c1c339768b8c9cde14e40b955e618ee4540f (diff)
Update after stylesheet change
Diffstat (limited to 'src')
-rw-r--r--src/objects.c29
-rw-r--r--src/objects.h1
-rw-r--r--src/stylesheet.c4
3 files changed, 34 insertions, 0 deletions
diff --git a/src/objects.c b/src/objects.c
index 6b99005..a97b769 100644
--- a/src/objects.c
+++ b/src/objects.c
@@ -31,6 +31,7 @@
#include "presentation.h"
#include "objects.h"
+#include "mainwindow.h"
static struct object *new_object(enum objtype t, struct layout_element *le)
@@ -227,6 +228,34 @@ void position_caret(struct object *o, double x, double y)
}
+void notify_style_update(struct presentation *p, struct text_style *ts)
+{
+ int i;
+ int changed = 0;
+
+ for ( i=0; i<p->num_slides; i++ ) {
+
+ int j;
+ struct slide *s;
+
+ s = p->slides[i];
+
+ for ( j=0; j<p->slides[i]->num_objects; j++ ) {
+
+ if ( s->objects[j]->type != TEXT ) continue;
+
+ s->object_seq++;
+ if ( p->view_slide == s ) changed = 1;
+ break;
+
+ }
+
+ }
+
+ if ( changed ) notify_slide_changed(p);
+}
+
+
void delete_object(struct object *o)
{
remove_object_from_slide(o->parent, o);
diff --git a/src/objects.h b/src/objects.h
index 32ac4ee..9ac58d0 100644
--- a/src/objects.h
+++ b/src/objects.h
@@ -65,6 +65,7 @@ extern struct object *add_text_object(struct slide *s, double x, double y,
struct text_style *ts);
extern void insert_text(struct object *o, char *t);
extern void set_text_style(struct object *o, struct text_style *ts);
+extern void notify_style_update(struct presentation *p, struct text_style *ts);
extern void handle_text_backspace(struct object *o);
extern void move_cursor_left(struct object *o);
extern void move_cursor_right(struct object *o);
diff --git a/src/stylesheet.c b/src/stylesheet.c
index 3905865..92a0b11 100644
--- a/src/stylesheet.c
+++ b/src/stylesheet.c
@@ -86,6 +86,8 @@ static void text_font_set_sig(GtkFontButton *widget,
font = gtk_font_button_get_font_name(widget);
free(s->cur_text_style->font);
s->cur_text_style->font = strdup(font);
+
+ notify_style_update(s->p, s->cur_text_style);
}
@@ -100,6 +102,8 @@ static void text_colour_set_sig(GtkColorButton *widget,
s->cur_text_style->colour = gdk_color_to_string(&col);
al = gtk_color_button_get_alpha(widget);
s->cur_text_style->alpha = (double)al / 65535.0;
+
+ notify_style_update(s->p, s->cur_text_style);
}