From ae183124e9317f3d183da746b93d75909c7b89b5 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Sat, 20 Oct 2018 10:02:31 +0200 Subject: Remove template stuff --- src/narrative_window.c | 59 ++--------------------------------- src/sc_interp.c | 84 -------------------------------------------------- src/sc_interp.h | 11 ------- 3 files changed, 2 insertions(+), 152 deletions(-) diff --git a/src/narrative_window.c b/src/narrative_window.c index 7a19562..ead78bd 100644 --- a/src/narrative_window.c +++ b/src/narrative_window.c @@ -185,59 +185,6 @@ static void delete_slide_sig(GSimpleAction *action, GVariant *parameter, } -static struct template_id *get_templates(Stylesheet *ss, int *n) -{ - /* FIXME: From JSON stylesheet */ - *n = 0; - return NULL; -} - - -static void update_template_menus(NarrativeWindow *nw) -{ - struct template_id *templates; - int i, n_templates; - - templates = get_templates(nw->p->stylesheet, &n_templates); - - for ( i=0; isceditor); - /* Get the template */ - templ = get_slide_template(nw->p->stylesheet); /* our copy */ - show_sc_blocks(templ); + /* FIXME: Template from JSON */ + templ = sc_parse("\\slide{}"); /* Link the new SCBlock in */ if ( nsblock != NULL ) { @@ -865,7 +811,6 @@ NarrativeWindow *narrative_window_new(struct presentation *p, GApplication *papp "win.last"); update_toolbar(nw); - update_template_menus(nw); scroll = gtk_scrolled_window_new(NULL, NULL); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scroll), diff --git a/src/sc_interp.c b/src/sc_interp.c index 7b996f6..05e9325 100644 --- a/src/sc_interp.c +++ b/src/sc_interp.c @@ -38,13 +38,6 @@ #include "utils.h" -struct template -{ - char *name; - SCBlock *bl; -}; - - struct sc_state { PangoFontDescription *fontdesc; @@ -63,10 +56,6 @@ struct sc_state double slide_height; struct frame *fr; /* The current frame */ - - int n_templates; - int max_templates; - struct template *templates; }; struct _scinterp @@ -615,14 +604,6 @@ SCInterpreter *sc_interp_new(PangoContext *pc, PangoLanguage *lang, scin->cbl = NULL; st = &scin->state[0]; - st->n_templates = 0; - st->max_templates = 16; - st->templates = malloc(16*sizeof(struct template)); - if ( st->templates == NULL ) { - free(scin->state); - free(scin); - return NULL; - } st->fr = NULL; st->paraspace[0] = 0.0; st->paraspace[1] = 0.0; @@ -660,8 +641,6 @@ SCInterpreter *sc_interp_new(PangoContext *pc, PangoLanguage *lang, void sc_interp_destroy(SCInterpreter *scin) { - /* FIXME: Free all templates */ - /* Empty the stack */ while ( scin->j > 0 ) { sc_interp_restore(scin); @@ -1265,66 +1244,3 @@ int sc_interp_add_blocks(SCInterpreter *scin, SCBlock *bl, Stylesheet *ss) return 0; } - -static int try_add_template(SCInterpreter *scin, const char *options, SCBlock *bl) -{ - struct sc_state *st = &scin->state[scin->j]; - char *nn; - char *comma; - int i; - - nn = strdup(options); - comma = strchr(nn, ','); - if ( comma != NULL ) { - comma[0] = '\0'; - } - - for ( i=0; in_templates; i++ ) { - if ( strcmp(st->templates[i].name, nn) == 0 ) { - fprintf(stderr, _("Duplicate template '%s'\n"), nn); - return 0; - } - } - - if ( st->max_templates == st->n_templates ) { - - struct template *templates_new; - - templates_new = realloc(st->templates, sizeof(struct template) - * (st->max_templates+16)); - if ( templates_new == NULL ) { - fprintf(stderr, _("Failed to add templates\n")); - return 1; - } - - st->templates = templates_new; - st->max_templates += 16; - - } - - i = st->n_templates++; - - st->templates[i].name = nn; - st->templates[i].bl = bl; - - return 0; -} - - -struct template_id *sc_interp_get_templates(SCInterpreter *scin, int *np) -{ - struct template_id *list; - int i; - - list = malloc(sizeof(struct template_id)*scin->state->n_templates); - if ( list == NULL ) return NULL; - - for ( i=0; istate->n_templates; i++ ) { - list[i].name = strdup(scin->state->templates[i].name); - list[i].friendlyname = strdup(scin->state->templates[i].name); - list[i].scblock = sc_block_copy(scin->state->templates[i].bl); - } - - *np = scin->state->n_templates; - return list; -} diff --git a/src/sc_interp.h b/src/sc_interp.h index b0bd689..7593226 100644 --- a/src/sc_interp.h +++ b/src/sc_interp.h @@ -87,15 +87,4 @@ extern int sc_interp_get_height(SCInterpreter *scin); extern void update_geom(struct frame *fr); -struct template_id -{ - char *name; - char *friendlyname; - SCBlock *scblock; -}; - -extern struct template_id *sc_interp_get_templates(SCInterpreter *scin, - int *np); - - #endif /* SC_INTERP_H */ -- cgit v1.2.3