1 /* Calf DSP Library Utility Application - calfjackhost
4 * Copyright (C) 2007-2011 Krzysztof Foltman
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General
17 * Public License along with this program; if not, write to the
18 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02111-1307, USA.
21 #ifndef __CALF_MAIN_WIN_H
22 #define __CALF_MAIN_WIN_H
25 #include "gui_config.h"
26 #include <calf/connector.h>
27 #include <calf/jackhost.h>
29 namespace calf_plugins
{
31 class gtk_main_window
;
36 gtk_main_window
*main_win
;
38 plugin_gui_window
*gui_win
;
39 calf_connector
*connector
;
40 GtkWidget
*strip_table
, *name
, *button
, *con
, *midi_in
, *extra
, *leftBox
, *rightBox
, *inBox
, *outBox
;
41 std::vector
<GtkWidget
*> audio_in
, audio_out
;
44 class gtk_main_window
: public main_window_iface
, public gui_environment
, public calf_utils::config_listener_iface
47 struct add_plugin_params
49 gtk_main_window
*main_win
;
51 add_plugin_params(gtk_main_window
*_main_win
, const std::string
&_name
)
52 : main_win(_main_win
), name(_name
) {}
58 GtkWidget
*strips_table
;
60 GtkActionGroup
*std_actions
, *plugin_actions
;
61 std::map
<plugin_ctl_iface
*, plugin_strip
*> plugins
;
62 std::vector
<jack_host
*> plugin_queue
;
66 main_window_owner_iface
*owner
;
67 calf_utils::config_notifier_iface
*notifier
;
70 GtkWidget
*progress_window
;
71 window_update_controller refresh_controller
;
74 plugin_strip
*create_strip(jack_host
*plugin
);
75 void update_strip(plugin_ctl_iface
*plugin
);
77 static gboolean
on_idle(void *data
);
78 std::string
make_plugin_list(GtkActionGroup
*actions
);
79 static void add_plugin_action(GtkWidget
*src
, gpointer data
);
80 void display_error(const char *error
, const char *filename
);
81 void on_config_change();
82 /// Create a toplevel window with progress bar
83 GtkWidget
*create_progress_window();
87 void set_owner(main_window_owner_iface
*_owner
) { owner
= _owner
; }
88 void new_plugin(const char *name
) { owner
->new_plugin(name
); }
89 void add_plugin(jack_host
*plugin
);
90 void del_plugin(plugin_ctl_iface
*plugin
);
91 void set_window(plugin_ctl_iface
*iface
, plugin_gui_window
*window
);
92 void refresh_all_presets(bool builtin_too
);
93 void refresh_plugin(plugin_ctl_iface
*plugin
);
95 void open_gui(plugin_ctl_iface
*plugin
);
100 void save_file_from_sighandler();
101 void show_rack_ears(bool show
);
102 void show_vu_meters(bool show
);
103 /// Implementation of progress_report_iface function
104 virtual void report_progress(float percentage
, const std::string
&message
);
105 /// Mark condition as true
106 virtual void add_condition(const std::string
&name
);
107 /// Display an error dialog
108 virtual void show_error(const std::string
&text
);
110 static const GtkActionEntry actions
[];
111 static void on_open_action(GtkWidget
*widget
, gtk_main_window
*main
);
112 static void on_save_action(GtkWidget
*widget
, gtk_main_window
*main
);
113 static void on_save_as_action(GtkWidget
*widget
, gtk_main_window
*main
);
114 static void on_preferences_action(GtkWidget
*widget
, gtk_main_window
*main
);
115 static void on_reorder_action(GtkWidget
*widget
, gtk_main_window
*main
);
116 static void on_exit_action(GtkWidget
*widget
, gtk_main_window
*main
);