aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.org.uk>2013-08-27 22:29:31 +0200
committerThomas White <taw@bitwiz.org.uk>2013-08-27 22:29:31 +0200
commitc1041289e6684efc6c0b44b31adc771eda895b8d (patch)
tree77c6875014771c18f1a8ab5487a2b5bce4c6bc67 /src
parent369e65fa8ff77e5378990146e75530147e6c8e8a (diff)
Add "Insert->(slide template)->Everything"
Diffstat (limited to 'src')
-rw-r--r--src/mainwindow.c37
1 files changed, 33 insertions, 4 deletions
diff --git a/src/mainwindow.c b/src/mainwindow.c
index cd210db..283bdc8 100644
--- a/src/mainwindow.c
+++ b/src/mainwindow.c
@@ -179,11 +179,9 @@ static void do_slide_update(struct presentation *p, PangoContext *pc)
}
-static gint add_furniture(GtkWidget *widget, struct menu_pl *pl)
+static void add_furniture_real(struct presentation *p, struct style *sty)
{
struct frame *fr;
- struct style *sty = pl->sty;
- struct presentation *p = pl->p;
fr = add_subframe(p->cur_edit_slide->top);
fr->style = sty;
@@ -196,6 +194,23 @@ static gint add_furniture(GtkWidget *widget, struct menu_pl *pl)
fr->pos = 0;
p->cursor_pos = 0;
+}
+
+
+static gint add_furniture(GtkWidget *widget, struct menu_pl *pl)
+{
+ struct style *sty = pl->sty;
+ struct presentation *p = pl->p;
+
+ if ( sty != NULL ) {
+ add_furniture_real(p, sty);
+ } else {
+ int i;
+ for ( i=0; i<pl->st->n_styles; i++ ) {
+ add_furniture_real(p, pl->st->styles[i]);
+ }
+ }
+
/* FIXME: What if the user mixes templates? */
p->cur_edit_slide->st = pl->st;
p->cur_edit_slide->top->style = pl->st->top_style;
@@ -209,7 +224,6 @@ static gint add_furniture(GtkWidget *widget, struct menu_pl *pl)
static void update_style_menus(struct presentation *p)
{
GtkWidget *menu;
- GtkWidget *item;
struct slide_template *t;
TemplateIterator *iter;
int i, j, k, n_j, n_k;
@@ -231,6 +245,7 @@ static void update_style_menus(struct presentation *p)
{
n_k += t->n_styles;
n_j++;
+ n_k++; /* For "Everything" */
}
p->menu_rebuild_list = calloc(n_j, sizeof(GtkWidget *));
@@ -246,6 +261,7 @@ static void update_style_menus(struct presentation *p)
t = template_next(p->ss, iter) )
{
GtkWidget *submenu;
+ GtkWidget *item;
submenu = gtk_menu_new();
item = gtk_menu_item_new_with_label(t->name);
@@ -253,6 +269,19 @@ static void update_style_menus(struct presentation *p)
gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), submenu);
p->menu_rebuild_list[j++] = item;
+ p->menu_path_list[k].p = p;
+ p->menu_path_list[k].sty = NULL;
+ p->menu_path_list[k].st = t;
+ item = gtk_menu_item_new_with_label("Everything");
+ gtk_menu_shell_append(GTK_MENU_SHELL(submenu), item);
+ g_signal_connect(G_OBJECT(item), "activate",
+ G_CALLBACK(add_furniture),
+ &p->menu_path_list[k]);
+ k++;
+
+ item = gtk_separator_menu_item_new();
+ gtk_menu_shell_append(GTK_MENU_SHELL(submenu), item);
+
for ( i=0; i<t->n_styles; i++ ) {
struct style *s = t->styles[i];