diff options
author | Thomas White <taw@bitwiz.me.uk> | 2018-10-30 22:32:08 +0100 |
---|---|---|
committer | Thomas White <taw@bitwiz.me.uk> | 2018-10-30 22:32:08 +0100 |
commit | a82f00098daf0bd6caa5ab7ae8b376cb623d45ca (patch) | |
tree | f5fc33b04032c5aa7b1a39cdd5b26c34a2d1468b /src/narrative_window.c | |
parent | a287e0e566961f6ec29207daa32e0c3babaf68f2 (diff) |
Propagate stylesheet changes to slide windows
Diffstat (limited to 'src/narrative_window.c')
-rw-r--r-- | src/narrative_window.c | 43 |
1 files changed, 41 insertions, 2 deletions
diff --git a/src/narrative_window.c b/src/narrative_window.c index e2365f8..246dc1a 100644 --- a/src/narrative_window.c +++ b/src/narrative_window.c @@ -57,6 +57,8 @@ struct _narrative_window SCSlideshow *show; int show_no_slides; PRClock *pr_clock; + SlideWindow *slidewindows[16]; + int n_slidewindows; }; @@ -277,11 +279,18 @@ static gint load_ss_response_sig(GtkWidget *d, gint response, static void stylesheet_changed_sig(GtkWidget *da, NarrativeWindow *nw) { + int i; + /* It might have changed (been created) since last time */ sc_editor_set_stylesheet(nw->sceditor, nw->p->stylesheet); /* Full rerender, first block may have changed */ sc_editor_set_scblock(nw->sceditor, nw->dummy_top); + + /* Full rerender of all slide windows */ + for ( i=0; i<nw->n_slidewindows; i++ ) { + slide_window_update(nw->slidewindows[i]); + } } @@ -691,11 +700,17 @@ static int click_thumbnail(double x, double y, void *bvp, void *vp) { struct presentation *p = vp; SCBlock *scblocks = bvp; + NarrativeWindow *nw = p->narrative_window; if ( p->narrative_window->show != NULL ) { - sc_slideshow_set_slide(p->narrative_window->show, scblocks); + sc_slideshow_set_slide(nw->show, scblocks); } else { - slide_window_open(p, scblocks, p->narrative_window->app); + if ( nw->n_slidewindows >= 16 ) { + show_error(nw, _("Too many open slide windows")); + } else { + nw->slidewindows[nw->n_slidewindows++] = slide_window_open(p, scblocks, + p->narrative_window->app); + } } return 0; @@ -751,6 +766,29 @@ void update_titlebar(NarrativeWindow *nw) } +void narrative_window_sw_closed(NarrativeWindow *nw, SlideWindow *sw) +{ + int i; + int found = 0; + + for ( i=0; i<nw->n_slidewindows; i++ ) { + if ( nw->slidewindows[i] == sw ) { + + int j; + for ( j=i; j<nw->n_slidewindows-1; j++ ) { + nw->slidewindows[j] = nw->slidewindows[j+1]; + } + nw->n_slidewindows--; + found = 1; + } + } + + if ( !found ) { + fprintf(stderr, "Couldn't find slide window in narrative record\n"); + } +} + + NarrativeWindow *narrative_window_new(struct presentation *p, GApplication *papp) { NarrativeWindow *nw; @@ -772,6 +810,7 @@ NarrativeWindow *narrative_window_new(struct presentation *p, GApplication *papp nw->app = papp; nw->p = p; + nw->n_slidewindows = 0; nw->window = gtk_application_window_new(GTK_APPLICATION(app)); p->narrative_window = nw; |