diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/mainwindow.c | 50 | ||||
-rw-r--r-- | src/notes.c | 16 | ||||
-rw-r--r-- | src/notes.h | 5 | ||||
-rw-r--r-- | src/presentation.c | 121 | ||||
-rw-r--r-- | src/slide_sorter.c | 9 |
5 files changed, 35 insertions, 166 deletions
diff --git a/src/mainwindow.c b/src/mainwindow.c index aa74d4c..ab75cdc 100644 --- a/src/mainwindow.c +++ b/src/mainwindow.c @@ -1,7 +1,7 @@ /* * mainwindow.c * - * Copyright © 2013 Thomas White <taw@bitwiz.org.uk> + * Copyright © 2013-2014 Thomas White <taw@bitwiz.org.uk> * * This file is part of Colloquium. * @@ -892,9 +892,9 @@ static void draw_editing_box(cairo_t *cr, struct frame *fr) cairo_stroke(cr); cairo_new_path(cr); - ptot_w = fr->lop.pad_l + fr->lop.pad_r; - ptot_h = fr->lop.pad_t + fr->lop.pad_b; - cairo_rectangle(cr, xmin+fr->lop.pad_l, ymin+fr->lop.pad_t, + ptot_w = fr->pad_l + fr->pad_r; + ptot_h = fr->pad_t + fr->pad_b; + cairo_rectangle(cr, xmin+fr->pad_l, ymin+fr->pad_t, width-ptot_w, height-ptot_h); cairo_set_dash(cr, dash, 2, 0.0); cairo_set_source_rgb(cr, 0.0, 0.0, 0.0); @@ -961,10 +961,10 @@ static void draw_overlay(cairo_t *cr, struct presentation *p) draw_editing_box(cr, p->selection[i]); - x = p->selection[i]->lop.x; - y = p->selection[i]->lop.y; - w = p->selection[i]->lop.w; - h = p->selection[i]->lop.h; + x = p->selection[i]->x; + y = p->selection[i]->y; + w = p->selection[i]->w; + h = p->selection[i]->h; /* Draw resize handles */ /* FIXME: Not if this frame can't be resized */ @@ -1064,13 +1064,12 @@ void update_titlebar(struct presentation *p) static void insert_text(struct frame *fr, char *t, struct presentation *p) { +#warning Re-implement insert_text() and do_backspace() please +#if 0 char *tmp; size_t tlen, olen; int i; - /* If this is, say, the top level frame, do nothing */ - if ( fr->sc == NULL ) return; - tlen = strlen(t); olen = strlen(fr->sc); @@ -1107,11 +1106,13 @@ static void insert_text(struct frame *fr, char *t, struct presentation *p) p->cursor_pos = fr->pos; redraw_editor(p); fr->empty = 0; +#endif } static void do_backspace(struct frame *fr, struct presentation *p) { +#if 0 size_t tlen, olen; if ( fr == NULL ) return; @@ -1131,6 +1132,7 @@ static void do_backspace(struct frame *fr, struct presentation *p) p->cursor_pos = fr->pos; redraw_editor(p); fr->empty = 0; +#endif } @@ -1486,11 +1488,11 @@ static struct frame *create_frame(struct presentation *p, double x, double y, } fr = add_subframe(parent); - fr->sc = NULL; - fr->lop.x = x; - fr->lop.y = y; - fr->lop.w = w; - fr->lop.h = h; + fr->scblocks = NULL; + fr->x = x; + fr->y = y; + fr->w = w; + fr->h = h; fr->is_image = 0; fr->empty = 1; @@ -1516,10 +1518,10 @@ static void do_resize(struct presentation *p, double x, double y, } fr = p->selection[0]; - fr->lop.x = x; - fr->lop.y = y; - fr->lop.w = w; - fr->lop.h = h; + fr->x = x; + fr->y = y; + fr->w = w; + fr->h = h; rerender_slide(p); redraw_editor(p); @@ -1553,8 +1555,6 @@ static gboolean button_release_sig(GtkWidget *da, GdkEventButton *event, fr = create_frame(p, p->start_corner_x, p->start_corner_y, p->drag_corner_x - p->start_corner_x, p->drag_corner_y - p->start_corner_y); - fr->sc = strdup(""); - fr->sc_len = 1; rerender_slide(p); set_selection(p, fr); break; @@ -1583,6 +1583,8 @@ static gboolean button_release_sig(GtkWidget *da, GdkEventButton *event, static void move_cursor(struct presentation *p, signed int x, signed int y) { +#warning Re-implement move_cursor() please +#if 0 ssize_t pos = p->cursor_pos; /* FIXME: Advance past images etc */ @@ -1596,6 +1598,7 @@ static void move_cursor(struct presentation *p, signed int x, signed int y) p->selection[0]->pos = pos; p->cursor_pos = pos; +#endif } @@ -1890,8 +1893,7 @@ static void dnd_receive(GtkWidget *widget, GdkDragContext *drag_context, fr = create_frame(p, p->start_corner_x, p->start_corner_y, w, h); - fr->sc = sc; - fr->sc_len = len; + /* FIXME Add scblocks and link into structure */ fr->is_image = 1; fr->empty = 0; show_hierarchy(p->cur_edit_slide->top, ""); diff --git a/src/notes.c b/src/notes.c index 650c401..2e57d25 100644 --- a/src/notes.c +++ b/src/notes.c @@ -94,22 +94,6 @@ static gint close_notes_sig(GtkWidget *w, struct presentation *p) } -void write_notes(struct slide *s, struct serializer *ser) -{ - serialize_s(ser, "notes", s->notes); -} - - -void load_notes(struct ds_node *node, struct slide *s) -{ - char *v; - - if ( get_field_s(node, "notes", &v) ) return; - - s->notes = v; -} - - void open_notes(struct presentation *p) { struct notes *n; diff --git a/src/notes.h b/src/notes.h index 62c3c2e..89d050c 100644 --- a/src/notes.h +++ b/src/notes.h @@ -1,6 +1,6 @@ /* * notes.h - * + * * Copyright © 2013-2014 Thomas White <taw@bitwiz.org.uk> * * This file is part of Colloquium. @@ -34,9 +34,6 @@ extern void open_notes(struct presentation *p); extern void notify_notes_slide_changed(struct presentation *p, struct slide *np); -extern void write_notes(struct slide *s, struct serializer *ser); -extern void load_notes(struct ds_node *node, struct slide *s); - extern void grab_current_notes(struct presentation *p); #endif /* NOTES_H */ diff --git a/src/presentation.c b/src/presentation.c index a1b7a19..064dd38 100644 --- a/src/presentation.c +++ b/src/presentation.c @@ -312,21 +312,9 @@ struct presentation *new_presentation() } -static char *maybe_star(int i) -{ - if ( i ) { - return "*"; - } else { - return ""; - } -} - - int save_presentation(struct presentation *p, const char *filename) { FILE *fh; - int i; - struct serializer ser; char *old_fn; grab_current_notes(p); @@ -334,8 +322,7 @@ int save_presentation(struct presentation *p, const char *filename) fh = fopen(filename, "w"); if ( fh == NULL ) return 1; - fprintf(fh, "%s", p->ss); - fprintf(fh, "%s", p->sc); + /* FIXME: Save based on SCBlocks */ /* Slightly fiddly because someone might * do save_presentation(p, p->filename) */ @@ -350,118 +337,18 @@ int save_presentation(struct presentation *p, const char *filename) } -static struct slide *tree_to_slide(struct presentation *p, struct ds_node *root) -{ - struct slide *s; - char *sc; - - s = new_slide(); - s->parent = p; - - load_notes(root, s); - - get_field_s(root, "sc", &sc); - s->top = sc_unpack(sc, p->ss); - free(sc); - - return s; -} - - -static int tree_to_slides(struct ds_node *root, struct presentation *p) -{ - int i; - - for ( i=0; i<root->n_children; i++ ) { - - struct slide *s; - - s = tree_to_slide(p, root->children[i]); - if ( s != NULL ) { - insert_slide(p, s, p->num_slides); - } - - } - - return 0; -} - - -int tree_to_presentation(struct ds_node *root, struct presentation *p) -{ - struct ds_node *node; - char *check; - int i; - - p->cur_edit_slide = NULL; - p->cur_proj_slide = NULL; - - node = find_node(root, "slide-properties/width", 0); - if ( node == NULL ) return 1; - p->slide_width = strtod(node->value, &check); - if ( check == node->value ) { - fprintf(stderr, "Invalid slide width\n"); - return 1; - } - - node = find_node(root, "slide-properties/height", 0); - if ( node == NULL ) return 1; - p->slide_height = strtod(node->value, &check); - if ( check == node->value ) { - fprintf(stderr, "Invalid slide height\n"); - return 1; - } - - node = find_node(root, "stylesheet", 0); - if ( node != NULL ) { - free_stylesheet(p->ss); - p->ss = tree_to_stylesheet(node); - if ( p->ss == NULL ) { - fprintf(stderr, "Invalid style sheet\n"); - return 1; - } - } - - for ( i=0; i<p->num_slides; i++ ) { - free_slide(p->slides[i]); - p->num_slides = 0; - } - - node = find_node(root, "slides", 0); - if ( node != NULL ) { - tree_to_slides(node, p); - if ( p->num_slides == 0 ) { - fprintf(stderr, "Failed to load any slides\n"); - p->cur_edit_slide = add_slide(p, 0); - return 1; - } - } - - return 0; -} - - int load_presentation(struct presentation *p, const char *filename) { FILE *fh; - struct ds_node *root; - int r, i; + int r = 0; + int i; assert(p->completely_empty); fh = fopen(filename, "r"); if ( fh == NULL ) return 1; - root = new_ds_node("root"); - if ( root == NULL ) return 1; - - if ( deserialize_file(fh, root) ) { - fclose(fh); - return 1; - } - - r = tree_to_presentation(root, p); - free_ds_tree(root); + /* FIXME: Load presentation */ fclose(fh); diff --git a/src/slide_sorter.c b/src/slide_sorter.c index b76721b..dcbfc30 100644 --- a/src/slide_sorter.c +++ b/src/slide_sorter.c @@ -1,7 +1,7 @@ /* * slide_sorter.c * - * Copyright © 2013 Thomas White <taw@bitwiz.org.uk> + * Copyright © 2013-2014 Thomas White <taw@bitwiz.org.uk> * * This file is part of Colloquium. * @@ -366,8 +366,7 @@ static void dnd_receive(GtkWidget *widget, GdkDragContext *drag_context, if ( s != NULL ) { - /* FIXME: sc_unpack_with_notes() */ - s->top = sc_unpack(sc, n->p->ss); + /* FIXME: Do something */ s->rendered_thumb = render_slide(s, n->p->thumb_slide_width, @@ -416,8 +415,8 @@ static void dnd_get(GtkWidget *widget, GdkDragContext *drag_context, if ( target != GDK_NONE ) { char *sc; - /* FIXME: packed_sc_with_notes() */ - sc = packed_sc(n->p->slides[n->selection]->top, n->p->ss); + /* FIXME: packed sc */ + //sc = packed_sc(n->p->slides[n->selection]->top, n->p->ss); gtk_selection_data_set(seldata, target, 8, (guchar *)sc, strlen(sc)); |