+#ifndef __PLUGINLV2GUI_H__
+#define __PLUGINLV2GUI_H__
-/*
- * CINELERRA
- * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-
-#ifndef __PLUGINLV2UI_H__
-#define __PLUGINLV2UI_H__
-
+#include "guicast.h"
#include "forkbase.h"
#include "pluginlv2gui.inc"
-#include "pluginlv2client.h"
+#include "pluginlv2ui.h"
+#include "pluginaclient.h"
+
+class PluginLV2ClientUI : public BC_GenericButton {
+public:
+ PluginLV2ClientWindow *gui;
+
+ PluginLV2ClientUI(PluginLV2ClientWindow *gui, int x, int y);
+ ~PluginLV2ClientUI();
+ int handle_event();
+};
-class PluginLV2GUI
+class PluginLV2ClientReset : public BC_GenericButton
{
public:
- PluginLV2GUI();
- ~PluginLV2GUI();
-
- void reset_gui(void);
- int init_gui(const char *path);
- void update_value(int idx, uint32_t bfrsz, uint32_t typ, const void *bfr);
- static void write_from_ui(void *the, uint32_t idx, uint32_t bfrsz,uint32_t typ,const void *bfr);
- void update_control(int idx, uint32_t bfrsz, uint32_t typ, const void *bfr);
- static uint32_t port_index(void *obj,const char *sym);
- static void touch(void *obj,uint32_t pidx,bool grabbed);
- static uint32_t uri_to_id(LV2_URID_Map_Handle handle, const char *map, const char *uri);
- static LV2_URID uri_table_map(LV2_URID_Map_Handle handle, const char *uri);
- static const char *uri_table_unmap(LV2_URID_Map_Handle handle, LV2_URID urid);
- void lv2ui_instantiate(void *parent);
- bool lv2ui_resizable();
- void host_update(PluginLV2ChildGUI *child);
- int run(int ac, char **av);
-
- PluginLV2ClientConfig config;
- PluginLV2UriTable uri_table;
- LV2_URI_Map_Feature *uri_map;
- LV2_Extension_Data_Feature *ext_data;
- LV2_URID_Map map;
- LV2_URID_Unmap unmap;
- Lv2Features ui_features;
- LilvNode *lv2_InputPort;
- LilvNode *lv2_ControlPort;
-
- LilvWorld *world;
- const LilvPlugin *lilv;
- LilvInstance *inst;
- LilvUIs* uis;
- const LilvUI *ui;
- const LilvNode *ui_type;
-
-#ifdef HAVE_LV2UI
- SuilInstance *sinst;
- SuilHost *ui_host;
-#endif
+ PluginLV2ClientWindow *gui;
- char title[BCSTRLEN];
- const char *gtk_type;
- uint32_t last, updates;
- int done, running;
+ PluginLV2ClientReset(PluginLV2ClientWindow *gui, int x, int y);
+ ~PluginLV2ClientReset();
+ int handle_event();
+};
- void start();
- void stop();
- int update_lv2(float *vals, int force);
- int redraw;
+class PluginLV2ClientText : public BC_TextBox {
+public:
+ PluginLV2ClientWindow *gui;
- void run_gui(PluginLV2ChildGUI *child=0);
+ PluginLV2ClientText(PluginLV2ClientWindow *gui, int x, int y, int w);
+ ~PluginLV2ClientText();
+ int handle_event();
};
-enum { NO_COMMAND,
- LV2_OPEN,
- LV2_LOAD,
- LV2_UPDATE,
- LV2_START,
- LV2_SET,
- NB_COMMANDS };
+class PluginLV2ClientApply : public BC_GenericButton {
+public:
+ PluginLV2ClientWindow *gui;
-typedef struct { int idx; float value; } control_t;
+ PluginLV2ClientApply(PluginLV2ClientWindow *gui, int x, int y);
+ ~PluginLV2ClientApply();
+ int handle_event();
+};
-class PluginLV2ParentGUI : public ForkParent
+class PluginLV2Client_OptPanel : public BC_ListBox
{
public:
- PluginLV2ParentGUI(PluginLV2ClientWindow *gui);
- ~PluginLV2ParentGUI();
- ForkChild* new_fork();
- void start_parent();
+ PluginLV2Client_OptPanel(PluginLV2ClientWindow *gui, int x, int y, int w, int h);
+ ~PluginLV2Client_OptPanel();
+
+ PluginLV2ClientWindow *gui;
+ ArrayList<BC_ListBoxItem*> items[2];
+ ArrayList<BC_ListBoxItem*> &opts;
+ ArrayList<BC_ListBoxItem*> &vals;
+
+ int selection_changed();
+ void update();
+};
- int handle_parent();
+class PluginLV2ClientPot : public BC_FPot
+{
+public:
+ PluginLV2ClientPot(PluginLV2ClientWindow *gui, int x, int y);
+ int handle_event();
PluginLV2ClientWindow *gui;
};
-class PluginLV2ChildGUI : public ForkChild
+class PluginLV2ClientSlider : public BC_FSlider
{
public:
- PluginLV2ChildGUI();
- ~PluginLV2ChildGUI();
+ PluginLV2ClientSlider(PluginLV2ClientWindow *gui, int x, int y);
+ int handle_event();
+ PluginLV2ClientWindow *gui;
+};
- int handle_child();
- void run();
- int run(int ac, char **av);
+class PluginLV2ClientWindow : public PluginClientWindow
+{
+public:
+ PluginLV2ClientWindow(PluginLV2Client *client);
+ ~PluginLV2ClientWindow();
+ void done_event(int result);
+
+ void create_objects();
+ int resize_event(int w, int h);
+ void update_selected();
+ void update_selected(float v);
+ int scalar(float f, char *rp);
+ void update(PluginLV2Client_Opt *opt);
+ void lv2_update();
+ void lv2_update(float *vals);
+ void lv2_ui_enable();
+ void lv2_set(int idx, float val);
+ PluginLV2ParentUI *find_ui();
+ PluginLV2ParentUI *get_ui();
+
+ PluginLV2Client *client;
+ PluginLV2ClientUI *client_ui;
+ PluginLV2ClientReset *reset;
+ PluginLV2ClientApply *apply;
+ PluginLV2ClientPot *pot;
+ PluginLV2ClientSlider *slider;
+ PluginLV2ClientText *text;
+ BC_Title *varbl, *range;
+ PluginLV2Client_OptPanel *panel;
+ PluginLV2Client_Opt *selected;
- PluginLV2GUI *lv2_gui;
-// Command tokens
};
#endif