diff options
author | David Robillard <d@drobilla.net> | 2013-12-19 03:55:00 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2013-12-19 03:55:00 +0000 |
commit | 70b4a4a14879f9c7e85e77fa64c58051e954f8b8 (patch) | |
tree | e2976086106c688a4ceedca3f7674c25f4dc8c2b /src | |
parent | a47e984e2c08364eae88c2ea5a9edb15883bb3fe (diff) | |
download | jalv-70b4a4a14879f9c7e85e77fa64c58051e954f8b8.tar.gz jalv-70b4a4a14879f9c7e85e77fa64c58051e954f8b8.tar.bz2 jalv-70b4a4a14879f9c7e85e77fa64c58051e954f8b8.zip |
Add --no-menu option to jalv.gtk.
git-svn-id: http://svn.drobilla.net/lad/trunk/jalv@5187 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-rw-r--r-- | src/jalv_gtk.c | 47 | ||||
-rw-r--r-- | src/jalv_internal.h | 1 |
2 files changed, 30 insertions, 18 deletions
diff --git a/src/jalv_gtk.c b/src/jalv_gtk.c index 29df231..e35a9a2 100644 --- a/src/jalv_gtk.c +++ b/src/jalv_gtk.c @@ -89,6 +89,8 @@ jalv_init(int* argc, char*** argv, JalvOptions* opts) "Dump plugin <=> UI communication", NULL }, { "show-hidden", 's', 0, G_OPTION_ARG_NONE, &opts->show_hidden, "Show controls for ports with notOnGUI property on generic UI", NULL }, + { "no-menu", 'n', 0, G_OPTION_ARG_NONE, &opts->no_menu, + "Do not show Jalv menu on window", NULL }, { "generic-ui", 'g', 0, G_OPTION_ARG_NONE, &opts->generic_ui, "Use Jalv generic UI and not the plugin UI", NULL}, { "buffer-size", 'b', 0, G_OPTION_ARG_INT, &opts->buffer_size, @@ -757,21 +759,9 @@ build_control_widget(Jalv* jalv, GtkWidget* window) } } -int -jalv_open_ui(Jalv* jalv) +static void +build_menu(Jalv* jalv, GtkWidget* window, GtkWidget* vbox) { - GtkWidget* window = gtk_window_new(GTK_WINDOW_TOPLEVEL); - jalv->window = window; - jalv->has_ui = TRUE; - - g_signal_connect(window, "destroy", - G_CALLBACK(on_window_destroy), jalv); - - LilvNode* name = lilv_plugin_get_name(jalv->plugin); - gtk_window_set_title(GTK_WINDOW(window), lilv_node_as_string(name)); - lilv_node_free(name); - - GtkWidget* vbox = new_box(false, 0); GtkWidget* menu_bar = gtk_menu_bar_new(); GtkWidget* file = gtk_menu_item_new_with_mnemonic("_File"); GtkWidget* file_menu = gtk_menu_new(); @@ -799,10 +789,6 @@ jalv_open_ui(Jalv* jalv) jalv_load_presets(jalv, add_preset_to_menu, presets_menu); - gtk_window_set_role(GTK_WINDOW(window), "plugin_ui"); - gtk_container_add(GTK_CONTAINER(window), vbox); - gtk_box_pack_start(GTK_BOX(vbox), menu_bar, FALSE, FALSE, 0); - g_signal_connect(G_OBJECT(quit), "activate", G_CALLBACK(on_quit_activate), window); @@ -812,6 +798,31 @@ jalv_open_ui(Jalv* jalv) g_signal_connect(G_OBJECT(save_preset), "activate", G_CALLBACK(on_save_preset_activate), jalv); + gtk_box_pack_start(GTK_BOX(vbox), menu_bar, FALSE, FALSE, 0); +} + +int +jalv_open_ui(Jalv* jalv) +{ + GtkWidget* window = gtk_window_new(GTK_WINDOW_TOPLEVEL); + jalv->window = window; + jalv->has_ui = TRUE; + + g_signal_connect(window, "destroy", + G_CALLBACK(on_window_destroy), jalv); + + LilvNode* name = lilv_plugin_get_name(jalv->plugin); + gtk_window_set_title(GTK_WINDOW(window), lilv_node_as_string(name)); + lilv_node_free(name); + + GtkWidget* vbox = new_box(false, 0); + gtk_window_set_role(GTK_WINDOW(window), "plugin_ui"); + gtk_container_add(GTK_CONTAINER(window), vbox); + + if (!jalv->opts.no_menu) { + build_menu(jalv, window, vbox); + } + /* Create/show alignment to contain UI (whether custom or generic) */ GtkWidget* alignment = gtk_alignment_new(0.5, 0.5, 1.0, 1.0); gtk_box_pack_start(GTK_BOX(vbox), alignment, TRUE, TRUE, 0); diff --git a/src/jalv_internal.h b/src/jalv_internal.h index 5bcb175..4952d4f 100644 --- a/src/jalv_internal.h +++ b/src/jalv_internal.h @@ -92,6 +92,7 @@ typedef struct { int dump; ///< Dump communication iff true int generic_ui; ///< Use generic UI iff true int show_hidden; ///< Show controls for notOnGUI ports + int no_menu; ///< Hide menu iff true } JalvOptions; typedef struct { |