y1 += displacement->get_h() + 5;
add_subwindow(thumbnails = new ViewThumbnails(x1, y1, pwindow));
y1 += thumbnails->get_h() + 5;
- add_subwindow(perpetual = new PerpetualSession(x1, y1, pwindow));
+ PrefsAutostartLV2UI *autostart_lv2ui = new PrefsAutostartLV2UI(x1, y1,pwindow);
+ add_subwindow(autostart_lv2ui);
+ y1 += autostart_lv2ui->get_h() + 5;
+ PerpetualSession *perpetual = new PerpetualSession(x1, y1, pwindow);
+ add_subwindow(perpetual);
+ y1 += perpetual->get_h() + 5;
if( y < y1 ) y = y1;
}
}
+PrefsAutostartLV2UI::PrefsAutostartLV2UI(int x, int y, PreferencesWindow *pwindow)
+ : BC_CheckBox(x, y,
+ pwindow->thread->preferences->autostart_lv2ui, _("Auto start lv2 gui"))
+{
+ this->pwindow = pwindow;
+}
+int PrefsAutostartLV2UI::handle_event()
+{
+ pwindow->thread->preferences->autostart_lv2ui = get_value();
+ return 1;
+}
+
PerpetualSession::PerpetualSession(int x, int y, PreferencesWindow *pwindow)
: BC_CheckBox(x, y,
pwindow->thread->preferences->perpetual_session, _("Perpetual session"))
ViewThumbnails *thumbnails;
YuvColorSpace *yuv_color_space;
YuvColorRange *yuv_color_range;
- PerpetualSession *perpetual;
};
int id;
};
+class PrefsAutostartLV2UI : public BC_CheckBox
+{
+public:
+ PrefsAutostartLV2UI(int x, int y, PreferencesWindow *pwindow);
+ int handle_event();
+ PreferencesWindow *pwindow;
+};
+
class PerpetualSession : public BC_CheckBox
{
public:
class UseWarnVersion;
class BD_WarnRoot;
class PopupMenuBtnup;
+class GrabFocusPolicy;
class ActivateFocusPolicy;
class DeactivateFocusPolicy;
class ForwardRenderDisplacement;
class YuvColorSpaceItem;
class YuvColorRange;
class YuvColorRangeItem;
+class PrefsAutostartLV2UI;
class PerpetualSession;
#endif
int PluginFClientApply::handle_event()
{
- const char *text = fwin->text->get_text();
- if( text && fwin->selected ) {
- fwin->selected->set(text);
- fwin->selected->item_value->update();
- fwin->draw();
- fwin->ffmpeg->plugin->send_configure_change();
+ return fwin->update();
+}
+
+PluginFClientPot::PluginFClientPot(PluginFClientWindow *fwin, int x, int y)
+ : BC_FPot(x, y, 0.f, 0.f, 0.f)
+{
+ this->fwin = fwin;
+}
+
+int PluginFClient_Opt::get_range(float &fmn, float &fmx)
+{
+ switch( opt->type ) {
+ case AV_OPT_TYPE_INT:
+ case AV_OPT_TYPE_INT64:
+ case AV_OPT_TYPE_DOUBLE:
+ case AV_OPT_TYPE_FLOAT: break;
+ default: return 1;
+ }
+ const AVClass *filt_class = filter_class();
+ if( !filt_class || !filt_class->option ) return 1;
+ AVOptionRanges *r = 0;
+ void *obj = &filt_class;
+ if( av_opt_query_ranges(&r, obj, opt->name, AV_OPT_SEARCH_FAKE_OBJ) < 0 ) return 1;
+ int ret = 1;
+ if( r->nb_ranges == 1 ) {
+ fmn = r->range[0]->value_min;
+ fmx = r->range[0]->value_max;
+ ret = 0;
+ }
+ av_opt_freep_ranges(&r);
+ return ret;
+}
+
+float PluginFClient_Opt::get_float()
+{
+ char val[BCTEXTLEN]; val[0] = 0;
+ get(val, sizeof(val));
+ return atof(val);
+}
+
+void PluginFClient_Opt::set_float(float v)
+{
+ char val[BCTEXTLEN]; val[0] = 0;
+ sprintf(val, "%f", v);
+ set(val);
+}
+
+int PluginFClientPot::handle_event()
+{
+ if( fwin->selected ) {
+ fwin->selected->set_float(get_value());
+ fwin->update_selected();
+ return fwin->update();
+ }
+ return 1;
+}
+
+PluginFClientSlider::PluginFClientSlider(PluginFClientWindow *fwin, int x, int y)
+ : BC_FSlider(x, y, 0, fwin->get_w()-x-20, fwin->get_w()-x-20, 0.f, 0.f, 0.f)
+{
+ this->fwin = fwin;
+}
+
+int PluginFClientSlider::handle_event()
+{
+ if( fwin->selected ) {
+ fwin->selected->set_float(get_value());
+ fwin->update_selected();
+ return fwin->update();
}
return 1;
}
if( opt ) opt->get(val, sizeof(val));
text->update(val);
+ float v = 0, fmn = 0, fmx = 0;
+ if( opt && !opt->get_range(fmn, fmx) ) v = atof(val);
+ float p = (fmx-fmn) / slider->get_w();
+ slider->set_precision(p);
+ slider->update(slider->get_w(), v, fmn, fmx);
+ pot->set_precision(p);
+ pot->update(v, fmn, fmx);
panel->update();
}
+int PluginFClientWindow::update()
+{
+ const char *txt = text->get_text();
+ if( txt && selected ) {
+ selected->set(txt);
+ selected->item_value->update();
+ draw();
+ ffmpeg->plugin->send_configure_change();
+ }
+ return 1;
+}
+
+void PluginFClientWindow::update_selected()
+{
+ update(selected);
+}
+
int PluginFClient_OptPanel::selection_changed()
{
PluginFClient_Opt *opt = 0;
add_subwindow(apply = new PluginFClientApply(this, x1, y));
add_subwindow(text = new PluginFClientText(this, x0, y, x1-x0 - 8));
y += title->get_h() + 10;
+ add_subwindow(pot = new PluginFClientPot(this, x, y));
+ x1 = x + pot->get_w() + 10;
+ add_subwindow(slider = new PluginFClientSlider(this, x1, y+10));
+ y += pot->get_h() + 10;
panel_x = x; panel_y = y;
panel_w = get_w()-10 - panel_x;
int x0 = units->get_x() + units->get_w() + 8;
int y0 = units->get_y();
text->reposition_window(x0,y0, x1-x0-8);
+ x1 = pot->get_x() + pot->get_w() + 10;
+ int w1 = w - slider->get_x() - 20;
+ slider->set_pointer_motion_range(w1);
+ slider->reposition_window(x1, slider->get_y(), w1, slider->get_h());
panel_w = get_w()-10 - panel_x;
panel_h = get_h()-10 - panel_y;
panel->reposition_window(panel_x,panel_y, panel_w, panel_h);
return 1;
}
+
PluginFClient::PluginFClient(PluginClient *plugin, const char *name)
{
this->plugin = plugin;
int ranges(char *rp);
int units(ArrayList<const AVOption *> &opts);
int units(char *rp);
+ int get_range(float &fmn, float &fmx);
+ float get_float();
+ void set_float(float v);
+
const char *tip();
void *filter_config();
const AVClass *filter_class();
int handle_event();
};
+class PluginFClientPot : public BC_FPot
+{
+public:
+ PluginFClientPot(PluginFClientWindow *fwin, int x, int y);
+ int handle_event();
+ PluginFClientWindow *fwin;
+};
+
+class PluginFClientSlider : public BC_FSlider
+{
+public:
+ PluginFClientSlider(PluginFClientWindow *fwin, int x, int y);
+ int handle_event();
+ PluginFClientWindow *fwin;
+};
+
class PluginFClientWindow : public PluginClientWindow
{
public:
void create_objects();
void update(PluginFClient_Opt *oip);
+ int update();
+ void update_selected();
void draw();
int resize_event(int w, int h);
- PluginFClient *ffmpeg;
+ PluginFClient *ffmpeg;
PluginFClient_OptPanel *panel;
- int panel_x, panel_y, panel_w, panel_h;
+ int panel_x, panel_y, panel_w, panel_h;
BC_Title *type, *range;
- PluginFClient_Opt *selected;
+ PluginFClient_Opt *selected;
PluginFClientReset *reset;
PluginFClientUnits *units;
PluginFClientText *text;
PluginFClientApply *apply;
+ PluginFClientPot *pot;
+ PluginFClientSlider *slider;
};
class PluginFLogLevel {
char title[BCSTRLEN];
PluginFClient(PluginClient *plugin, const char *name);
- ~PluginFClient();
+ ~PluginFClient();
static bool is_audio(const AVFilter *fp);
static bool is_video(const AVFilter *fp);
return plugin->edl_to_local(position);
}
- void update_gui();
+ void update_gui();
char *to_upper(char *bp, const char *sp);
void save_data(KeyFrame *keyframe);
void read_data(KeyFrame *keyframe);
- void render_gui(void *data, int size);
+ void render_gui(void *data, int size);
int activate();
void reactivate();
- PluginFClientConfig curr_config;
- PLUGIN_CLASS_MEMBERS(PluginFClientConfig)
+ PluginFClientConfig curr_config;
+ PLUGIN_CLASS_MEMBERS(PluginFClientConfig)
};
class PluginFAClient : public PluginAClient, public PluginFClient
{
public:
PluginFAClient(PluginServer *server, const char *name);
- ~PluginFAClient();
+ ~PluginFAClient();
const char *plugin_title() { return PluginFClient::plugin_title(); }
PluginClientWindow *new_window() { return PluginFClient::new_window(); }
int activate();
void save_data(KeyFrame *keyframe) { PluginFClient::save_data(keyframe); }
void read_data(KeyFrame *keyframe) { PluginFClient::read_data(keyframe); }
void update_gui() { PluginFClient::update_gui(); }
- void render_gui(void *data, int size) { PluginFClient::render_gui(data, size); }
+ void render_gui(void *data, int size) { PluginFClient::render_gui(data, size); }
int is_realtime() { return 1; }
int is_multichannel() { return 1; }
int uses_gui() { return 1; }
int is_synthesis() { return 1; }
- int get_inchannels();
- int get_outchannels();
+ int get_inchannels();
+ int get_outchannels();
int process_buffer(int64_t size, Samples **buffer, int64_t start_position, int sample_rate);
};
{
public:
PluginFVClient(PluginServer *server, const char *name);
- ~PluginFVClient();
+ ~PluginFVClient();
const char *plugin_title() { return PluginFClient::plugin_title(); }
PluginClientWindow *new_window() { return PluginFClient::new_window(); }
int activate(int width, int height, int color_model);
void save_data(KeyFrame *keyframe) { PluginFClient::save_data(keyframe); }
void read_data(KeyFrame *keyframe) { PluginFClient::read_data(keyframe); }
void update_gui() { PluginFClient::update_gui(); }
- void render_gui(void *data, int size) { PluginFClient::render_gui(data, size); }
+ void render_gui(void *data, int size) { PluginFClient::render_gui(data, size); }
int is_realtime() { return 1; }
int is_multichannel() { return 1; }
#include "pluginlv2config.h"
#include "pluginlv2gui.h"
#include "pluginserver.h"
+#include "preferences.h"
#include "samples.h"
#include <ctype.h>
add_subwindow(panel);
panel->update();
show_window(1);
+
+ if( client->server->mwindow->preferences->autostart_lv2ui ) {
+ PluginLV2ParentUI *ui = get_ui();
+ ui->show();
+ }
}
int PluginLV2ClientWindow::resize_event(int w, int h)
cp += sprintf(cp, " )");
float v = opt->get_value();
sprintf(val, "%f", v);
+ float p = (max-min) / slider->get_w();
+ slider->set_precision(p);
slider->update(slider->get_w(), v, min, max);
+ pot->set_precision(p);
pot->update(v, min, max);
}
else {
use_thumbnails = 1;
keyframe_reticle = HAIRLINE_DRAGGING;
perpetual_session = 0;
+ autostart_lv2ui = 0;
trap_sigsegv = 1;
trap_sigintr = 1;
theme[0] = 0;
cache_size = that->cache_size;
project_smp = that->project_smp;
force_uniprocessor = that->force_uniprocessor;
+ autostart_lv2ui = that->autostart_lv2ui;
trap_sigsegv = that->trap_sigsegv;
trap_sigintr = that->trap_sigintr;
processors = that->processors;
index_count = defaults->get("INDEX_COUNT", index_count);
keyframe_reticle = defaults->get("KEYFRAME_RETICLE", keyframe_reticle);
perpetual_session = defaults->get("PERPETUAL_SESSION", perpetual_session);
+ autostart_lv2ui = defaults->get("AUTOSTART_LV2UI", autostart_lv2ui);
trap_sigsegv = defaults->get("TRAP_SIGSEGV", trap_sigsegv);
trap_sigintr = defaults->get("TRAP_SIGINTR", trap_sigintr);
defaults->update("USE_THUMBNAILS", use_thumbnails);
defaults->update("KEYFRAME_RETICLE", keyframe_reticle);
defaults->update("PERPETUAL_SESSION", perpetual_session);
+ defaults->update("AUTOSTART_LV2UI", autostart_lv2ui);
defaults->update("TRAP_SIGSEGV", trap_sigsegv);
defaults->update("TRAP_SIGINTR", trap_sigintr);
defaults->update("THEME", theme);
int perpetual_session;
int trap_sigsegv;
int trap_sigintr;
+ int autostart_lv2ui;
// Title of theme
char theme[BCTEXTLEN];
// plugin icon set