aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.org.uk>2016-05-17 22:56:55 +0200
committerThomas White <taw@bitwiz.org.uk>2016-05-17 22:56:55 +0200
commitac97e289f8555a09c5302bdc8631721505807ef2 (patch)
treef42af9922f02c576cf9c143cfa97f809823669c9
parent4ea72c5e6d460864527642e0c265f4ff1f70b6fe (diff)
Advance slide from narrative window
-rw-r--r--src/frame.c6
-rw-r--r--src/frame.h3
-rw-r--r--src/narrative_window.c10
-rw-r--r--src/sc_editor.c9
-rw-r--r--src/sc_editor.h1
-rw-r--r--src/slideshow.c17
-rw-r--r--src/slideshow.h2
7 files changed, 32 insertions, 16 deletions
diff --git a/src/frame.c b/src/frame.c
index ebc6857..fb849a4 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -1010,3 +1010,9 @@ Paragraph *current_para(struct frame *fr)
return NULL;
}
+
+void *get_para_bvp(Paragraph *para)
+{
+ if ( para->type != PARA_TYPE_CALLBACK ) return NULL;
+ return para->bvp;
+}
diff --git a/src/frame.h b/src/frame.h
index e128d09..0eb562b 100644
--- a/src/frame.h
+++ b/src/frame.h
@@ -161,4 +161,7 @@ extern SCBlock *block_at_cursor(struct frame *fr, int para, size_t pos);
extern int get_sc_pos(struct frame *fr, int pn, size_t pos,
SCBlock **bl, size_t *ppos);
+
+extern void *get_para_bvp(Paragraph *para);
+
#endif /* FRAME_H */
diff --git a/src/narrative_window.c b/src/narrative_window.c
index 88bff88..e0d1293 100644
--- a/src/narrative_window.c
+++ b/src/narrative_window.c
@@ -210,10 +210,18 @@ static void prev_para_sig(GSimpleAction *action, GVariant *parameter,
static void ss_next_para(SlideShow *ss, void *vp)
{
NarrativeWindow *nw = vp;
+ SCBlock *ns;
+
sc_editor_set_cursor_para(nw->sceditor,
sc_editor_get_cursor_para(nw->sceditor)+1);
pr_clock_set_pos(nw->pr_clock, sc_editor_get_cursor_para(nw->sceditor),
sc_editor_get_num_paras(nw->sceditor));
+ ns = sc_editor_get_cursor_bvp(nw->sceditor);
+ if ( ns != NULL ) {
+ nw->sel_slide = ns;
+ slideshow_rerender(nw->show);
+ redraw_slideshow(nw->show);
+ }
update_toolbar(nw);
}
@@ -242,7 +250,7 @@ static void ss_changed_link(SlideShow *ss, void *vp)
}
-static SCBlock *ss_cur_slide(SlideShow *ss, void *vp)
+static SCBlock *ss_cur_slide(void *vp)
{
NarrativeWindow *nw = vp;
return nw->sel_slide;
diff --git a/src/sc_editor.c b/src/sc_editor.c
index 76be18d..37bba88 100644
--- a/src/sc_editor.c
+++ b/src/sc_editor.c
@@ -1612,6 +1612,15 @@ int sc_editor_get_cursor_para(SCEditor *e)
}
+void *sc_editor_get_cursor_bvp(SCEditor *e)
+{
+ Paragraph *para;
+ if ( e->cursor_frame == NULL ) return 0;
+ para = e->cursor_frame->paras[e->cursor_para];
+ return get_para_bvp(para);
+}
+
+
void sc_editor_set_cursor_para(SCEditor *e, signed int pos)
{
double h;
diff --git a/src/sc_editor.h b/src/sc_editor.h
index cef3423..e5e415d 100644
--- a/src/sc_editor.h
+++ b/src/sc_editor.h
@@ -184,6 +184,7 @@ extern SCBlock *split_paragraph_at_cursor(SCEditor *e);
extern void sc_editor_set_para_highlight(SCEditor *e, int para_highlight);
extern int sc_editor_get_cursor_para(SCEditor *e);
+extern void *sc_editor_get_cursor_bvp(SCEditor *e);
extern void sc_editor_set_cursor_para(SCEditor *e, signed int pos);
extern int sc_editor_get_num_paras(SCEditor *e);
diff --git a/src/slideshow.c b/src/slideshow.c
index 2f84cc7..9e334d4 100644
--- a/src/slideshow.c
+++ b/src/slideshow.c
@@ -42,7 +42,6 @@ struct _slideshow
struct presentation *p;
struct sscontrolfuncs ssc;
void *vp; /* Controller's private word */
- SCBlock *cur_slide;
GtkWidget *window;
GtkWidget *drawingarea;
GdkCursor *blank_cursor;
@@ -81,8 +80,8 @@ void slideshow_rerender(SlideShow *ss)
stylesheets[0] = ss->p->stylesheet;
stylesheets[1] = NULL;
- n = slide_number(ss->p, ss->cur_slide);
- ss->surface = render_sc(sc_block_child(ss->cur_slide),
+ n = slide_number(ss->p, ss->ssc.current_slide(ss->vp));
+ ss->surface = render_sc(sc_block_child(ss->ssc.current_slide(ss->vp)),
ss->slide_width, ss->slide_height,
ss->p->slide_width, ss->p->slide_height,
stylesheets, NULL, ss->p->is, ISZ_SLIDESHOW, n,
@@ -140,8 +139,6 @@ static gboolean ss_draw_sig(GtkWidget *da, cairo_t *cr, SlideShow *ss)
void change_proj_slide(SlideShow *ss, SCBlock *np)
{
- ss->cur_slide = np;
-
slideshow_rerender(ss);
redraw_slideshow(ss);
}
@@ -173,7 +170,7 @@ void toggle_slideshow_link(SlideShow *ss)
{
ss->linked = 1 - ss->linked;
if ( ss->linked ) {
- change_proj_slide(ss, ss->ssc.current_slide(ss, ss->vp));
+ change_proj_slide(ss, ss->ssc.current_slide(ss->vp));
}
ss->ssc.changed_link(ss, ss->vp);
}
@@ -240,13 +237,6 @@ static gboolean ss_realize_sig(GtkWidget *w, SlideShow *ss)
}
-SCBlock *slideshow_slide(SlideShow *ss)
-{
- if ( ss == NULL ) return NULL;
- return ss->cur_slide;
-}
-
-
SlideShow *try_start_slideshow(struct presentation *p,
struct sscontrolfuncs ssc, void *vp)
{
@@ -264,7 +254,6 @@ SlideShow *try_start_slideshow(struct presentation *p,
ss->vp = vp;
ss->blank = 0;
ss->p = p;
- ss->cur_slide = ss->ssc.current_slide(ss, vp);
if ( ss->inhibit == NULL ) {
ss->inhibit = inhibit_prepare();
diff --git a/src/slideshow.h b/src/slideshow.h
index 5124808..5c8b808 100644
--- a/src/slideshow.h
+++ b/src/slideshow.h
@@ -39,7 +39,7 @@ struct sscontrolfuncs
/* Controller should return what it thinks is the current slide
* (this might not be what is on the screen, e.g. if the display
* is unlinked) */
- SCBlock *(*current_slide)(SlideShow *ss, void *vp);
+ SCBlock *(*current_slide)(void *vp);
/* Controller should update whatever visual representation of
* whether or not the display is linked */