aboutsummaryrefslogtreecommitdiff
path: root/src/slide_window.c
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.org.uk>2016-04-24 15:06:20 +0200
committerThomas White <taw@bitwiz.org.uk>2016-04-24 15:06:20 +0200
commite90d663864cb60067f90b964adc2686aba69e333 (patch)
tree0e02a4550cedd2dfc370c346b7596dc84ec61a2b /src/slide_window.c
parentd8aca50e2ba6bfec052da5ab406899fa00fb607e (diff)
Fix slide numbers
Diffstat (limited to 'src/slide_window.c')
-rw-r--r--src/slide_window.c37
1 files changed, 24 insertions, 13 deletions
diff --git a/src/slide_window.c b/src/slide_window.c
index 659c0bd..a627ff1 100644
--- a/src/slide_window.c
+++ b/src/slide_window.c
@@ -54,6 +54,11 @@ struct _slidewindow
GtkToolItem *bnext;
GtkToolItem *blast;
+ /* The slide being displayed. Note that the SCEditor is using the
+ * child of this block, but we need to keep a record of it for changing
+ * the slide. */
+ SCBlock *scblocks;
+
SCEditor *sceditor;
struct menu_pl *style_menu;
@@ -64,14 +69,11 @@ struct _slidewindow
};
-#define CUR_SLIDE(sw) (sc_editor_get_scblock(sw->sceditor))
-
-
static void update_toolbar(SlideWindow *sw)
{
int cur_slide_number;
- cur_slide_number = slide_number(sw->p, CUR_SLIDE(sw));
+ cur_slide_number = slide_number(sw->p, sw->scblocks);
if ( cur_slide_number == 0 ) {
gtk_widget_set_sensitive(GTK_WIDGET(sw->bfirst), FALSE);
gtk_widget_set_sensitive(GTK_WIDGET(sw->bprev), FALSE);
@@ -102,7 +104,7 @@ struct menu_pl
static gint UNUSED add_furniture(GtkWidget *widget, struct menu_pl *pl)
{
- sc_block_append_end(CUR_SLIDE(pl->sw),
+ sc_block_append_end(pl->sw->scblocks,
strdup(pl->style_name), NULL, NULL);
//do_slide_update(pl->p, pl->sw->pc); FIXME
@@ -239,7 +241,7 @@ static void add_slide_sig(GSimpleAction *action, GVariant *parameter, gpointer v
{
SlideWindow *sw = vp;
SCBlock *new;
- new = sc_block_insert_after(CUR_SLIDE(sw), "slide", NULL, NULL);
+ new = sc_block_insert_after(sw->scblocks, "slide", NULL, NULL);
change_edit_slide(sw, new);
}
@@ -298,10 +300,18 @@ void slidewindow_notes_closed(SlideWindow *sw)
/* Change the editor's slide to "np" */
void change_edit_slide(SlideWindow *sw, SCBlock *np)
{
+ SCBlock *ch;
+
update_toolbar(sw);
- sc_editor_set_slidenum(sw->sceditor, 1+slide_number(sw->p, np));
- sc_editor_set_scblock(sw->sceditor, np);
+ sc_editor_set_slidenum(sw->sceditor, slide_number(sw->p, np));
+
+ ch = sc_block_child(np);
+ if ( ch == NULL ) {
+ ch = sc_block_append_inside(sw->scblocks, NULL, NULL, "");
+ }
+ sc_editor_set_scblock(sw->sceditor, ch);
+ sw->scblocks = np;
if ( sw->notes != NULL ) notes_set_slide(sw->notes, np);
@@ -320,7 +330,7 @@ static void change_slide_first(SlideWindow *sw)
static void change_slide_backwards(SlideWindow *sw)
{
SCBlock *tt;
- tt = prev_slide(sw->p, CUR_SLIDE(sw));
+ tt = prev_slide(sw->p, sw->scblocks);
if ( tt == NULL ) return;
change_edit_slide(sw, tt);
}
@@ -329,7 +339,7 @@ static void change_slide_backwards(SlideWindow *sw)
static void change_slide_forwards(SlideWindow *sw)
{
SCBlock *tt;
- tt = next_slide(sw->p, CUR_SLIDE(sw));
+ tt = next_slide(sw->p, sw->scblocks);
if ( tt == NULL ) return;
change_edit_slide(sw, tt);
}
@@ -377,7 +387,7 @@ static void open_notes_sig(GSimpleAction *action, GVariant *parameter,
gpointer vp)
{
SlideWindow *sw = vp;
- sw->notes = open_notes(sw, CUR_SLIDE(sw));
+ sw->notes = open_notes(sw, sw->scblocks);
}
@@ -462,7 +472,7 @@ static void ss_changed_link(SlideShow *ss, void *vp)
static SCBlock *ss_cur_slide(SlideShow *ss, void *vp)
{
SlideWindow *sw = vp;
- return CUR_SLIDE(sw);
+ return sw->scblocks;
}
@@ -612,12 +622,13 @@ SlideWindow *slide_window_open(struct presentation *p, SCBlock *scblocks)
stylesheets[0] = p->stylesheet;
stylesheets[1] = NULL;
+ sw->scblocks = scblocks;
ch = sc_block_child(scblocks);
if ( ch == NULL ) {
ch = sc_block_append_inside(scblocks, NULL, NULL, "");
}
-
sw->sceditor = sc_editor_new(ch, stylesheets, p->lang);
+
scroll = gtk_scrolled_window_new(NULL, NULL);
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scroll),
GTK_POLICY_AUTOMATIC,