LMMS
Loading...
Searching...
No Matches
gtk_main_win.h
Go to the documentation of this file.
1/* Calf DSP Library Utility Application - calfjackhost
2 * GUI - main window
3 *
4 * Copyright (C) 2007-2011 Krzysztof Foltman
5 *
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.
10 *
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.
15 *
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.
20 */
21#ifndef __CALF_MAIN_WIN_H
22#define __CALF_MAIN_WIN_H
23
24#include "gui.h"
25#include "gui_config.h"
26#include <calf/connector.h>
27#include <calf/jackhost.h>
28
29#include <calf/ctl_led.h>
30#include <calf/ctl_vumeter.h>
31#include <calf/ctl_meterscale.h>
32#include <calf/ctl_buttons.h>
33
34//#include <calf/giface.h>
35//#include <calf/gui.h>
36//#include <calf/preset.h>
37//#include <calf/gtk_main_win.h>
38//#include <calf/jackhost.h>
39#include <iostream>
40#include <fstream>
41
42namespace calf_plugins {
43
44 class gtk_main_window;
45 struct image_factory;
46
48 {
49 int id;
51 jack_host *plugin;
56 std::vector<GtkWidget *> audio_in, audio_out;
57
59 : id()
60 , main_win()
61 , plugin()
62 , gui_win()
63 , gui_widget()
64 , connector()
65 , strip_table()
66 , name()
67 , entry()
68 , button()
69 , con()
70 , midi_in()
71 , extra()
72 , leftBG()
73 , rightBG()
74 , inBox()
75 , outBox()
76 {}
77
78 };
79
81 {
82 public:
84 {
86 std::string name;
87 add_plugin_params(gtk_main_window *_main_win, const std::string &_name)
88 : main_win(_main_win), name(_name) {}
89 };
90
91 public:
92 GtkWindow *toplevel;
93 GtkWidget *all_vbox;
94 GtkWidget *strips_table;
95 GtkUIManager *ui_mgr;
96 GtkActionGroup *std_actions, *plugin_actions;
97 GtkIconFactory *factory;
98 std::map<plugin_ctl_iface *, plugin_strip *> plugins;
99 std::vector<jack_host *> plugin_queue;
106
107 protected:
108 GtkWidget *progress_window;
110
111 protected:
112 plugin_strip *create_strip(jack_host *plugin);
113 void update_strip(plugin_ctl_iface *plugin);
114 void sort_strips();
115 static gboolean on_idle(void *data);
116 std::string make_plugin_list(GtkActionGroup *actions);
117 static void add_plugin_action(GtkWidget *src, gpointer data);
118 void display_error(const char *error, const char *filename);
119 void on_config_change();
120 GtkWidget *create_vu_meter();
121 GtkWidget *create_meter_scale();
123 GtkWidget *create_progress_window();
124
125 public:
127 void set_owner(main_window_owner_iface *_owner) { owner = _owner; }
128 void new_plugin(const char *name) { owner->new_plugin(name); }
129 void add_plugin(jack_host *plugin);
130 void del_plugin(plugin_ctl_iface *plugin);
131 void rename_plugin(plugin_ctl_iface *plugin, std::string name);
132 void set_window(plugin_ctl_iface *iface, plugin_gui_window *window);
133 void refresh_all_presets(bool builtin_too);
134 void refresh_plugin(plugin_ctl_iface *plugin);
135 void refresh_plugin_param(plugin_ctl_iface *plugin, int param_no);
136 void on_closed();
137 void open_gui(plugin_ctl_iface *plugin);
138 void create();
139 void create_status_icon();
140 void open_file();
141 bool save_file();
142 bool save_file_as();
144 void show_rack_ears(bool show);
145 void show_vu_meters(bool show);
146 void register_icons();
148 virtual void report_progress(float percentage, const std::string &message);
150 virtual void add_condition(const std::string &name);
152 virtual void show_error(const std::string &text);
153
155 GtkListStore *get_styles();
156 void load_style(std::string path);
157
158 private:
159 static const GtkActionEntry actions[];
160 static void on_open_action(GtkWidget *widget, gtk_main_window *main);
161 static void on_save_action(GtkWidget *widget, gtk_main_window *main);
162 static void on_save_as_action(GtkWidget *widget, gtk_main_window *main);
163 static void on_preferences_action(GtkWidget *widget, gtk_main_window *main);
164 static void on_reorder_action(GtkWidget *widget, gtk_main_window *main);
165 static void on_exit_action(GtkWidget *widget, gtk_main_window *main);
166 static void on_edit_title(GtkWidget *label, GdkEventButton *event, plugin_strip *strip);
167 static void on_activate_entry(GtkWidget *entry, plugin_strip *strip);
168 static gboolean on_blur_entry(GtkWidget *entry, GdkEvent *event, plugin_strip *strip);
169 static void on_table_clicked(GtkWidget *table, GdkEvent *event);
170 };
171};
172
173#endif
static void message(int level, const char *fmt,...)
Definition adplugdb.cpp:120
Definition connector.h:41
Definition gtk_main_win.h:81
static void on_save_action(GtkWidget *widget, gtk_main_window *main)
Definition gtk_main_win.cpp:72
GtkUIManager * ui_mgr
Definition gtk_main_win.h:95
void on_closed()
Called to clean up when host quits.
Definition gtk_main_win.cpp:965
static void on_activate_entry(GtkWidget *entry, plugin_strip *strip)
Definition gtk_main_win.cpp:309
void create()
Create the actual window associated with this interface.
Definition gtk_main_win.cpp:825
void register_icons()
Definition gtk_main_win.cpp:654
void update_strip(plugin_ctl_iface *plugin)
Definition gtk_main_win.cpp:625
bool draw_rackmounts
Definition gtk_main_win.h:101
main_window_owner_iface * owner
Definition gtk_main_win.h:103
calf_utils::config_notifier_iface * notifier
Definition gtk_main_win.h:104
bool save_file_as()
Definition gtk_main_win.cpp:1066
void open_gui(plugin_ctl_iface *plugin)
Definition gtk_main_win.cpp:632
void display_error(const char *error, const char *filename)
Definition gtk_main_win.cpp:1094
bool is_closed
Definition gtk_main_win.h:100
virtual void add_condition(const std::string &name)
Mark condition as true.
Definition gtk_main_win.cpp:1141
window_update_controller refresh_controller
Definition gtk_main_win.h:109
void refresh_all_presets(bool builtin_too)
Refresh preset lists on all windows (if, for example, a new preset has been created).
Definition gtk_main_win.cpp:219
static void on_preferences_action(GtkWidget *widget, gtk_main_window *main)
Definition gtk_main_win.cpp:87
GtkWidget * all_vbox
Definition gtk_main_win.h:93
static void on_reorder_action(GtkWidget *widget, gtk_main_window *main)
Definition gtk_main_win.cpp:82
void refresh_plugin_param(plugin_ctl_iface *plugin, int param_no)
Refresh the plugin UI.
Definition gtk_main_win.cpp:954
void del_plugin(plugin_ctl_iface *plugin)
Remove the plugin from the window.
Definition gtk_main_win.cpp:175
GtkWidget * create_progress_window()
Create a toplevel window with progress bar.
Definition gtk_main_win.cpp:1102
int source_id
Definition gtk_main_win.h:102
plugin_strip * create_strip(jack_host *plugin)
Definition gtk_main_win.cpp:350
void create_status_icon()
Create the actual window associated with this interface.
Definition gtk_main_win.cpp:916
static void on_save_as_action(GtkWidget *widget, gtk_main_window *main)
Definition gtk_main_win.cpp:77
GtkWidget * create_meter_scale()
Definition gtk_main_win.cpp:333
void new_plugin(const char *name)
Definition gtk_main_win.h:128
static gboolean on_idle(void *data)
Definition gtk_main_win.cpp:991
GtkActionGroup * std_actions
Definition gtk_main_win.h:96
void on_config_change()
Definition gtk_main_win.cpp:935
GtkWidget * create_vu_meter()
Definition gtk_main_win.cpp:323
void show_vu_meters(bool show)
Definition gtk_main_win.cpp:281
void rename_plugin(plugin_ctl_iface *plugin, std::string name)
Definition gtk_main_win.cpp:196
void add_plugin(jack_host *plugin)
Add the plugin to the window.
Definition gtk_main_win.cpp:160
virtual void show_error(const std::string &text)
Display an error dialog.
Definition gtk_main_win.cpp:1146
static gboolean on_blur_entry(GtkWidget *entry, GdkEvent *event, plugin_strip *strip)
Definition gtk_main_win.cpp:317
GtkWidget * strips_table
Definition gtk_main_win.h:94
static void on_open_action(GtkWidget *widget, gtk_main_window *main)
Definition gtk_main_win.cpp:67
void load_style(std::string path)
Definition gtk_main_win.cpp:1173
bool save_file()
Default save file operation.
Definition gtk_main_win.cpp:1052
GtkListStore * get_styles()
Definition gtk_main_win.cpp:1153
void sort_strips()
Definition gtk_main_win.cpp:594
GtkActionGroup * plugin_actions
Definition gtk_main_win.h:96
void refresh_plugin(plugin_ctl_iface *plugin)
Refresh the plugin UI.
Definition gtk_main_win.cpp:943
void set_window(plugin_ctl_iface *iface, plugin_gui_window *window)
Bind the plugin window to the plugin.
Definition gtk_main_win.cpp:207
GtkIconFactory * factory
Definition gtk_main_win.h:97
virtual void report_progress(float percentage, const std::string &message)
Implementation of progress_report_iface function.
Definition gtk_main_win.cpp:1112
image_factory images
Definition gtk_main_win.h:154
std::map< plugin_ctl_iface *, plugin_strip * > plugins
Definition gtk_main_win.h:98
static void add_plugin_action(GtkWidget *src, gpointer data)
Definition gtk_main_win.cpp:683
static void on_table_clicked(GtkWidget *table, GdkEvent *event)
Definition gtk_main_win.cpp:346
static void on_edit_title(GtkWidget *label, GdkEventButton *event, plugin_strip *strip)
Definition gtk_main_win.cpp:302
gtk_main_window()
Definition gtk_main_win.cpp:26
GtkWindow * toplevel
Definition gtk_main_win.h:92
std::string make_plugin_list(GtkActionGroup *actions)
Definition gtk_main_win.cpp:694
void open_file()
Default open file operation.
Definition gtk_main_win.cpp:1029
std::vector< jack_host * > plugin_queue
Definition gtk_main_win.h:99
static void on_exit_action(GtkWidget *widget, gtk_main_window *main)
Definition gtk_main_win.cpp:155
void show_rack_ears(bool show)
Definition gtk_main_win.cpp:264
window_state winstate
Definition gtk_main_win.h:105
GtkWidget * progress_window
Definition gtk_main_win.h:108
static const GtkActionEntry actions[]
Definition gtk_main_win.h:159
void set_owner(main_window_owner_iface *_owner)
Set owner pointer.
Definition gtk_main_win.h:127
gui_environment()
Definition gui.cpp:502
static char filename[]
Definition features.c:5
static const char * name
Definition pugl.h:1582
JSAMPIMAGE data
Definition jpeglib.h:945
Definition benchmark.cpp:53
int main(int argc, char **argv)
Definition main.cpp:247
gtk_main_window * main_win
Definition gtk_main_win.h:85
std::string name
Definition gtk_main_win.h:86
add_plugin_params(gtk_main_window *_main_win, const std::string &_name)
Definition gtk_main_win.h:87
Definition gui.h:45
Interface used by the plugin to communicate with the main hosting window.
Definition gui.h:263
Interface for host-GUI-plugin interaction (should be really split in two, but ... meh).
Definition giface.h:389
Definition gtk_main_win.h:48
jack_host * plugin
Definition gtk_main_win.h:51
int id
Definition gtk_main_win.h:49
gtk_main_window * main_win
Definition gtk_main_win.h:50
GtkWidget * con
Definition gtk_main_win.h:55
GtkWidget * button
Definition gtk_main_win.h:55
GtkWidget * strip_table
Definition gtk_main_win.h:55
GtkWidget * leftBG
Definition gtk_main_win.h:55
std::vector< GtkWidget * > audio_out
Definition gtk_main_win.h:56
plugin_gui_window * gui_win
Definition gtk_main_win.h:52
GtkWidget * rightBG
Definition gtk_main_win.h:55
GtkWidget * inBox
Definition gtk_main_win.h:55
std::vector< GtkWidget * > audio_in
Definition gtk_main_win.h:56
GtkWidget * outBox
Definition gtk_main_win.h:55
plugin_gui_widget * gui_widget
Definition gtk_main_win.h:53
GtkWidget * entry
Definition gtk_main_win.h:55
plugin_strip()
Definition gtk_main_win.h:58
GtkWidget * midi_in
Definition gtk_main_win.h:55
GtkWidget * extra
Definition gtk_main_win.h:55
GtkWidget * name
Definition gtk_main_win.h:55
calf_connector * connector
Definition gtk_main_win.h:54
Definition gui.h:320
Definition gui_config.h:20
Definition gui_config.h:26
const char * text
Definition swell-functions.h:167
int error
Definition extract.c:1038