aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/narrative_window.c10
-rw-r--r--src/sc_editor.c6
2 files changed, 14 insertions, 2 deletions
diff --git a/src/narrative_window.c b/src/narrative_window.c
index dd62cd6..88bff88 100644
--- a/src/narrative_window.c
+++ b/src/narrative_window.c
@@ -69,7 +69,7 @@ static void update_toolbar(NarrativeWindow *nw)
gtk_widget_set_sensitive(GTK_WIDGET(nw->bprev), TRUE);
}
- if ( cur_para == sc_editor_get_num_paras(nw->sceditor) ) {
+ if ( cur_para == sc_editor_get_num_paras(nw->sceditor)-1 ) {
gtk_widget_set_sensitive(GTK_WIDGET(nw->bnext), FALSE);
gtk_widget_set_sensitive(GTK_WIDGET(nw->blast), FALSE);
} else {
@@ -181,6 +181,8 @@ static void first_para_sig(GSimpleAction *action, GVariant *parameter,
{
NarrativeWindow *nw = vp;
sc_editor_set_cursor_para(nw->sceditor, 0);
+ pr_clock_set_pos(nw->pr_clock, sc_editor_get_cursor_para(nw->sceditor),
+ sc_editor_get_num_paras(nw->sceditor));
update_toolbar(nw);
}
@@ -193,6 +195,7 @@ static void ss_prev_para(SlideShow *ss, void *vp)
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));
+ update_toolbar(nw);
}
@@ -211,6 +214,7 @@ static void ss_next_para(SlideShow *ss, void *vp)
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));
+ update_toolbar(nw);
}
@@ -227,6 +231,9 @@ static void last_para_sig(GSimpleAction *action, GVariant *parameter,
{
NarrativeWindow *nw = vp;
sc_editor_set_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));
+ update_toolbar(nw);
}
@@ -262,6 +269,7 @@ static void start_slideshow_sig(GSimpleAction *action, GVariant *parameter,
if ( nw->show != NULL ) {
sc_editor_set_para_highlight(nw->sceditor, 1);
sc_editor_set_cursor_para(nw->sceditor, 0);
+ update_toolbar(nw);
}
}
diff --git a/src/sc_editor.c b/src/sc_editor.c
index a82ffc9..76be18d 100644
--- a/src/sc_editor.c
+++ b/src/sc_editor.c
@@ -89,6 +89,10 @@ static void vertical_adjust(GtkAdjustment *adj, SCEditor *e)
static void set_vertical_params(SCEditor *e)
{
if ( e->vadj == NULL ) return;
+ if ( e->scroll_pos < 0.0 ) e->scroll_pos = 0.0;
+ if ( e->scroll_pos > e->h - e->visible_height ) {
+ e->scroll_pos = e->h - e->visible_height;
+ }
gtk_adjustment_configure(e->vadj, e->scroll_pos, 0, e->h, 100,
e->visible_height, e->visible_height);
}
@@ -1619,7 +1623,7 @@ void sc_editor_set_cursor_para(SCEditor *e, signed int pos)
}
if ( pos < 0 ) {
- e->cursor_para = e->cursor_frame->n_paras;
+ e->cursor_para = e->cursor_frame->n_paras - 1;
} else if ( pos >= e->cursor_frame->n_paras ) {
e->cursor_para = e->cursor_frame->n_paras - 1;
} else {