X-Git-Url: https://git.cinelerra-gg.org/git/?p=goodguy%2Fcinelerra.git;a=blobdiff_plain;f=cinelerra-5.1%2Fcinelerra%2Feffectlist.C;h=819c08b7d5608b1944dadf5a23e11393d08080cc;hp=25e7c8c309a3c7c6d53a494c120178ffbc5adcb1;hb=83b70dd60863377cb281e6be5206304e10373e30;hpb=7fd85fb66168f6b518c5f2d73e04036e87faa0e1 diff --git a/cinelerra-5.1/cinelerra/effectlist.C b/cinelerra-5.1/cinelerra/effectlist.C index 25e7c8c3..819c08b7 100644 --- a/cinelerra-5.1/cinelerra/effectlist.C +++ b/cinelerra-5.1/cinelerra/effectlist.C @@ -24,102 +24,40 @@ #include "clip.h" #include "cstrdup.h" #include "effectlist.h" +#include "edl.h" #include "guicast.h" #include "language.h" +#include "localsession.h" #include "mwindow.h" #include "pluginserver.h" -EffectTipDialog::EffectTipDialog(MWindow *mwindow, AWindow *awindow) - : BC_DialogThread() -{ - this->mwindow = mwindow; - this->awindow = awindow; - effect = 0; - text = 0; -} - -EffectTipDialog::~EffectTipDialog() -{ - close_window(); - delete [] effect; - delete [] text; -} - -void EffectTipDialog::start(int x, int y, const char *effect, const char *text) -{ - close_window(); - AWindowGUI *gui = awindow->gui; - char string[BCTEXTLEN]; - sprintf(string, _("Effect info: %s"), _(effect)); - int effect_w = BC_Title::calculate_w(gui, string); - int text_w = BC_Title::calculate_w(gui, text); - int text_h = BC_Title::calculate_h(gui, text); - this->w = bmax(text_w + 30, bmax(effect_w + 30, 120)); - this->h = bmax(text_h + 100, 120); - this->x = x - this->w / 2; - this->y = y - this->h / 2; - delete [] this->effect; this->effect = cstrdup(string); - delete [] this->text; this->text = cstrdup(text); - BC_DialogThread::start(); -} - -BC_Window* EffectTipDialog::new_gui() -{ - AWindowGUI *gui = awindow->gui; - effect_gui = new EffectTipWindow(gui, this); - effect_gui->create_objects(); - return effect_gui; -}; - - -EffectTipWindow::EffectTipWindow(AWindowGUI *gui, EffectTipDialog *thread) - : BC_Window(_(PROGRAM_NAME ": Effect Info"), - thread->x + thread->w/2, thread->y + thread->h/2, - thread->w, thread->h, thread->w, thread->h, 0, 0, 1) -{ - this->gui = gui; - this->thread = thread; -} -EffectTipWindow::~EffectTipWindow() -{ -} - -void EffectTipWindow::create_objects() -{ - lock_window("EffectTipWindow::create_objects"); - int x = 10, y = 10; - BC_Title *title; - add_subwindow(title = new BC_Title(x, y, thread->effect)); - y += title->get_h() + 10; - add_subwindow(tip_text = new BC_Title(x+5, y, thread->text)); - add_subwindow(new BC_OKButton(this)); - show_window(1); - unlock_window(); -} EffectTipItem::EffectTipItem(AWindowGUI *gui) - : BC_MenuItem(_("Info")) + : BC_MenuItem("","i",'i') { this->gui = gui; + update(); } EffectTipItem::~EffectTipItem() { } + int EffectTipItem::handle_event() { - AssetPicon *result = (AssetPicon*)gui->asset_list->get_selection(0,0); - if( result && result->plugin ) { - const char *info = result->plugin->tip; - if( !info ) info = _("No info available"); - int cur_x, cur_y; - gui->get_abs_cursor(cur_x, cur_y, 0); - gui->awindow->effect_tip->start(cur_x, cur_y, - result->plugin->title, info); - } + int v = !gui->tip_info ? 1 : 0; + update(v); return 1; } +void EffectTipItem::update(int v) +{ + if( v >= 0 ) gui->tip_info = v; + else v = gui->tip_info; + const char *text = v ? _("Info off") : _("Info on"); + set_text(text); +} + EffectListMenu::EffectListMenu(MWindow *mwindow, AWindowGUI *gui) : BC_PopupMenu(0, 0, 0, "", 0) @@ -134,13 +72,14 @@ EffectListMenu:: ~EffectListMenu() void EffectListMenu::create_objects() { - add_item(new EffectTipItem(gui)); + add_item(info = new EffectTipItem(gui)); add_item(format = new AWindowListFormat(mwindow, gui)); add_item(new AWindowListSort(mwindow, gui)); } void EffectListMenu::update() { + info->update(); format->update(); }