diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/mainwindow.c | 9 | ||||
-rw-r--r-- | src/sc_interp.c | 11 | ||||
-rw-r--r-- | src/sc_interp.h | 1 | ||||
-rw-r--r-- | src/sc_parse.c | 7 | ||||
-rw-r--r-- | src/sc_parse.h | 2 |
5 files changed, 26 insertions, 4 deletions
diff --git a/src/mainwindow.c b/src/mainwindow.c index 2033926..03cb4f2 100644 --- a/src/mainwindow.c +++ b/src/mainwindow.c @@ -43,6 +43,7 @@ #include "pr_clock.h" #include "slide_sorter.h" #include "sc_parse.h" +#include "sc_interp.h" /* Update a slide, once it's been edited in some way. */ @@ -1577,7 +1578,6 @@ static struct frame *create_frame(struct presentation *p, double x, double y, { struct frame *parent; struct frame *fr; - char geom[256]; parent = p->cur_edit_slide->top; @@ -1594,12 +1594,10 @@ static struct frame *create_frame(struct presentation *p, double x, double y, fr = add_subframe(parent); /* Add to SC */ - snprintf(geom, 255, "%.1fux%.1fu+%.1f+%.1f", w, h, x, y); fr->scblocks = sc_block_append_inside(p->cur_edit_slide->scblocks, - "f", strdup(geom), NULL); + "f", NULL, NULL); sc_block_set_frame(fr->scblocks, fr); sc_block_append_inside(fr->scblocks, NULL, NULL, strdup("")); - printf("new block is %p\n", fr->scblocks); fr->x = x; fr->y = y; @@ -1608,6 +1606,8 @@ static struct frame *create_frame(struct presentation *p, double x, double y, fr->is_image = 0; fr->empty = 1; + update_geom(fr); + return fr; } @@ -1634,6 +1634,7 @@ static void do_resize(struct presentation *p, double x, double y, fr->y = y; fr->w = w; fr->h = h; + update_geom(fr); rerender_slide(p); redraw_editor(p); diff --git a/src/sc_interp.c b/src/sc_interp.c index 7dbe5f4..111c126 100644 --- a/src/sc_interp.c +++ b/src/sc_interp.c @@ -297,6 +297,17 @@ void sc_interp_destroy(SCInterpreter *scin) } +void update_geom(struct frame *fr) +{ + char geom[256]; + snprintf(geom, 255, "%.1fux%.1fu+%.1f+%.1f", + fr->w, fr->h, fr->x, fr->y); + + /* FIXME: What if there are other options? */ + sc_block_set_options(fr->scblocks, strdup(geom)); +} + + static LengthUnits get_units(const char *t) { size_t len = strlen(t); diff --git a/src/sc_interp.h b/src/sc_interp.h index 648df91..19c5ed8 100644 --- a/src/sc_interp.h +++ b/src/sc_interp.h @@ -47,5 +47,6 @@ extern PangoFontDescription *sc_interp_get_fontdesc(SCInterpreter *scin); extern double *sc_interp_get_fgcol(SCInterpreter *scin); extern int sc_interp_get_ascent(SCInterpreter *scin); extern int sc_interp_get_height(SCInterpreter *scin); +extern void update_geom(struct frame *fr); #endif /* SC_INTERP_H */ diff --git a/src/sc_parse.c b/src/sc_parse.c index 0696e15..a37775d 100644 --- a/src/sc_parse.c +++ b/src/sc_parse.c @@ -453,6 +453,13 @@ SCBlock *sc_parse(const char *sc) } +void sc_block_set_options(SCBlock *bl, char *opt) +{ + free(bl->options); + bl->options = opt; +} + + SCBlock *find_last_child(SCBlock *bl) { if ( bl == NULL ) return NULL; diff --git a/src/sc_parse.h b/src/sc_parse.h index 549d2ab..5bd50d8 100644 --- a/src/sc_parse.h +++ b/src/sc_parse.h @@ -53,6 +53,8 @@ extern void sc_block_set_frame(SCBlock *bl, struct frame *fr); extern SCBlock *find_last_child(SCBlock *bl); + +extern void sc_block_set_options(SCBlock *bl, char *opt); extern void sc_insert_text(SCBlock *b1, int o1, const char *t); extern void sc_delete_text(SCBlock *b1, int o1, SCBlock *b2, int o2); |