1 /*
2  * Copyright (C) 2018-2021 Alexandros Theodotou <alex at zrythm dot org>
3  *
4  * This file is part of Zrythm
5  *
6  * Zrythm is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU Affero General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * Zrythm 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
14  * GNU Affero General Public License for more details.
15  *
16  * You should have received a copy of the GNU Affero General Public License
17  * along with Zrythm.  If not, see <https://www.gnu.org/licenses/>.
18  */
19 /*
20   Copyright 2007-2016 David Robillard <http://drobilla.net>
21 
22   Permission to use, copy, modify, and/or distribute this software for any
23   purpose with or without fee is hereby granted, provided that the above
24   copyright notice and this permission notice appear in all copies.
25 
26   THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
27   WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
28   MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
29   ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
30   WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
31   ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
32   OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
33 */
34 
35 /**
36  * \file
37  *
38  * LV2 plugin window.
39  */
40 
41 #ifndef __PLUGINS_LV2_GTK_H__
42 #define __PLUGINS_LV2_GTK_H__
43 
44 typedef struct Lv2Plugin Lv2Plugin;
45 typedef struct Lv2Control Lv2Control;
46 typedef struct PluginGtkPresetMenu
47   PluginGtkPresetMenu;
48 
49 #include <stdint.h>
50 
51 #include <gtk/gtk.h>
52 
53 #include <lilv/lilv.h>
54 
55 /**
56  * @addtogroup plugins
57  *
58  * @{
59  */
60 
61 /**
62  * Called when there is a UI port event from the
63  * plugin.
64  */
65 void
66 lv2_gtk_ui_port_event(
67   Lv2Plugin*  plugin,
68   uint32_t    port_index,
69   uint32_t    buffer_size,
70   uint32_t    protocol,
71   const void* buffer);
72 
73 /**
74  * Called by generic UI callbacks when e.g. a slider
75  * changes value.
76  */
77 void
78 lv2_gtk_set_float_control (
79   Lv2Plugin * lv2_plugin,
80   Port *      port,
81   float       value);
82 
83 /**
84  * Opens the LV2 plugin's UI (either wrapped with
85  * suil or external).
86  *
87  * Use plugin_gtk_*() for generic UIs.
88  */
89 int
90 lv2_gtk_open_ui (
91   Lv2Plugin* plugin);
92 
93 PluginGtkPresetMenu*
94 lv2_gtk_get_bank_menu (
95   Lv2Plugin* plugin,
96   PluginGtkPresetMenu* menu,
97   const LilvNode* bank);
98 
99 void
100 lv2_gtk_on_save_activate (
101   Lv2Plugin * plugin);
102 
103 int
104 lv2_gtk_add_preset_to_menu (
105   Lv2Plugin*      plugin,
106   const LilvNode* node,
107   const LilvNode* title,
108   void*           data);
109 
110 /**
111  * Called by plugin_gtk_on_save_preset_activate()
112  * on accept.
113  */
114 void
115 lv2_gtk_on_save_preset_activate (
116   GtkWidget*   widget,
117   Lv2Plugin *  plugin,
118   const char * path,
119   const char * uri,
120   bool         add_prefix);
121 
122 GtkWidget*
123 lv2_gtk_build_control_widget (
124   Lv2Plugin* plugin, GtkWindow* window);
125 
126 void
127 lv2_gtk_on_delete_preset_activate (
128   GtkWidget* widget,
129   Lv2Plugin * plugin);
130 
131 /**
132  * @}
133  */
134 
135 #endif
136