aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/notes.c42
-rw-r--r--src/notes.h7
-rw-r--r--src/slide_window.c11
-rw-r--r--src/slide_window.h1
4 files changed, 32 insertions, 29 deletions
diff --git a/src/notes.c b/src/notes.c
index 78b138d..6ec0773 100644
--- a/src/notes.c
+++ b/src/notes.c
@@ -31,50 +31,44 @@
#include <gtk/gtk.h>
#include "presentation.h"
+#include "notes.h"
-#if 0 /* FIXME */
struct notes
{
GtkWidget *window;
GtkWidget *v;
- struct slide *slide;
+ struct slide *cur_slide;
+ SlideWindow *sw;
};
-static void set_notes_title(struct presentation *p)
-{
- gtk_window_set_title(GTK_WINDOW(p->notes->window), "Colloquium notes");
-}
-
-
-static void update_notes(struct presentation *p)
+static void update_notes(struct notes *notes)
{
GtkTextBuffer *tb;
const char *ntext;
SCBlock *ch;
- if ( p->notes == NULL ) return;
+ if ( notes == NULL ) return;
- ch = sc_block_child(p->cur_edit_slide->notes);
+ ch = sc_block_child(notes->cur_slide->notes);
if ( ch != NULL ) {
ntext = sc_block_contents(ch);
} else {
ntext = "NOTES ERROR";
}
- tb = gtk_text_view_get_buffer(GTK_TEXT_VIEW(p->notes->v));
+ tb = gtk_text_view_get_buffer(GTK_TEXT_VIEW(notes->v));
gtk_text_buffer_set_text(tb, ntext, -1);
}
-void grab_current_notes(struct presentation *p)
+void grab_current_notes(struct notes *n)
{
gchar *text;
GtkTextBuffer *tb;
GtkTextIter i1, i2;
SCBlock *ch;
- struct notes *n = p->notes;
if ( n == NULL ) return;
@@ -83,7 +77,7 @@ void grab_current_notes(struct presentation *p)
gtk_text_buffer_get_end_iter(tb, &i2);
text = gtk_text_buffer_get_text(tb, &i1, &i2, TRUE);
- ch = sc_block_child(n->slide->notes);
+ ch = sc_block_child(n->cur_slide->notes);
if ( ch != NULL ) {
sc_block_set_contents(ch, text);
} else {
@@ -96,7 +90,7 @@ void notes_set_slide(struct notes *notes, struct slide *np)
{
if ( notes == NULL ) return;
grab_current_notes(notes);
- notes->slide = np;
+ notes->cur_slide = np;
update_notes(notes);
}
@@ -104,19 +98,21 @@ void notes_set_slide(struct notes *notes, struct slide *np)
static gint close_notes_sig(GtkWidget *w, struct notes *notes)
{
grab_current_notes(notes);
- notes->p->notes = NULL;
+ slidewindow_notes_closed(notes->sw);
return FALSE;
}
-void open_notes(SlideWindow *sw)
+struct notes *open_notes(SlideWindow *sw, struct slide *slide)
{
struct notes *n;
GtkWidget *sc;
PangoFontDescription *desc;
n = malloc(sizeof(struct notes));
- if ( n == NULL ) return;
+ if ( n == NULL ) return NULL;
+ n->sw = sw;
+ n->cur_slide = slide;
n->window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_default_size(GTK_WINDOW(n->window), 800, 256);
@@ -133,16 +129,16 @@ void open_notes(SlideWindow *sw)
gtk_container_add(GTK_CONTAINER(sc), n->v);
g_signal_connect(G_OBJECT(n->v), "destroy",
- G_CALLBACK(close_notes_sig), p);
+ G_CALLBACK(close_notes_sig), n);
- set_notes_title(p);
+ gtk_window_set_title(GTK_WINDOW(n->window), "Colloquium notes");
gtk_widget_show_all(n->window);
- update_notes(notes);
+ update_notes(n);
+ return n;
}
-#endif
void attach_notes(struct slide *s)
{
SCBlock *bl = s->scblocks;
diff --git a/src/notes.h b/src/notes.h
index 31c5e3a..426cb7e 100644
--- a/src/notes.h
+++ b/src/notes.h
@@ -29,12 +29,11 @@
struct notes;
-extern void open_notes(struct presentation *p);
+extern struct notes *open_notes(SlideWindow *sw, struct slide *slide);
-extern void notify_notes_slide_changed(struct presentation *p,
- struct slide *np);
+extern void notes_set_slide(struct notes *n, struct slide *np);
-extern void grab_current_notes(struct presentation *p);
+extern void grab_current_notes(struct notes *n);
extern void attach_notes(struct slide *s);
diff --git a/src/slide_window.c b/src/slide_window.c
index 5552c4d..f262875 100644
--- a/src/slide_window.c
+++ b/src/slide_window.c
@@ -64,6 +64,7 @@ struct _slidewindow
struct slide *cur_slide; /* FIXME: SPOT inside SCEditor */
SlideShow *show;
+ struct notes *notes;
};
@@ -326,6 +327,12 @@ void slidewindow_slideshow_ended(SlideWindow *sw)
}
+void slidewindow_notes_closed(SlideWindow *sw)
+{
+ sw->notes = NULL;
+}
+
+
/* Change the editor's slide to "np" */
void change_edit_slide(SlideWindow *sw, struct slide *np)
{
@@ -336,7 +343,7 @@ void change_edit_slide(SlideWindow *sw, struct slide *np)
sc_editor_set_slidenum(sw->sceditor, slide_number(sw->p, np));
sc_editor_set_scblock(sw->sceditor, np->scblocks);
- // FIXME notify_notes_slide_changed(sw->p, np);
+ if ( sw->notes != NULL ) notes_set_slide(sw->notes, np);
if ( slideshow_linked(sw->show) ) {
change_proj_slide(sw->show, np);
@@ -414,7 +421,7 @@ static void open_notes_sig(GSimpleAction *action, GVariant *parameter,
gpointer vp)
{
SlideWindow *sw = vp;
- // FIXME open_notes(sw->p);
+ sw->notes = open_notes(sw, sw->cur_slide);
}
diff --git a/src/slide_window.h b/src/slide_window.h
index e0393fe..72a2f24 100644
--- a/src/slide_window.h
+++ b/src/slide_window.h
@@ -41,5 +41,6 @@ extern void change_slide_last(SlideWindow *sw);
extern struct slide *slidewindow_get_slide(SlideWindow *sw);
extern void slidewindow_redraw(SlideWindow *sw);
extern void slidewindow_slideshow_ended(SlideWindow *sw);
+extern void slidewindow_notes_closed(SlideWindow *sw);
#endif /* SLIDEWINDOW_H */