X-Git-Url: https://git.cinelerra-gg.org/git/?a=blobdiff_plain;f=cinelerra-5.1%2Fguicast%2Fbctextbox.C;h=128d514b92a0d5edbf2c1e8467946964753bb124;hb=b78b166faf60a1c7357f990b1e2fb0e70be29fee;hp=a7c8f5f7570ff1ce45d55bb65aaf1fded2da3007;hpb=7fd85fb66168f6b518c5f2d73e04036e87faa0e1;p=goodguy%2Fcinelerra.git diff --git a/cinelerra-5.1/guicast/bctextbox.C b/cinelerra-5.1/guicast/bctextbox.C index a7c8f5f7..128d514b 100644 --- a/cinelerra-5.1/guicast/bctextbox.C +++ b/cinelerra-5.1/guicast/bctextbox.C @@ -2487,6 +2487,7 @@ BC_PopupTextBoxText::~BC_PopupTextBoxText() int BC_PopupTextBoxText::handle_event() { + popup->list_item = -1; popup->handle_event(); return 1; } @@ -2500,10 +2501,10 @@ BC_PopupTextBoxList::BC_PopupTextBoxList(BC_PopupTextBox *popup, int x, int y) } int BC_PopupTextBoxList::handle_event() { - BC_ListBoxItem *item = get_selection(0, 0); - if(item) - { - popup->textbox->update(item->get_text()); + int k = get_selection_number(0, 0); + popup->list_item = k; + if( k >= 0 && k < popup->list_items->size() ) { + popup->textbox->update(popup->list_items->get(k)->get_text()); popup->textbox->set_text_row(0); popup->handle_event(); } @@ -2558,58 +2559,31 @@ void BC_PopupTextBox::update(const char *text) void BC_PopupTextBox::update_list(ArrayList *data) { + list_items = data; listbox->update(data, 0, 0, 1); } - -const char* BC_PopupTextBox::get_text() -{ - return textbox->get_text(); -} - -const wchar_t* BC_PopupTextBox::get_wtext() -{ - return textbox->get_wtext(); -} - -int BC_PopupTextBox::get_number() -{ - return listbox->get_selection_number(0, 0); -} - -int BC_PopupTextBox::get_x() -{ - return x; -} - -int BC_PopupTextBox::get_y() -{ - return y; -} - -int BC_PopupTextBox::get_w() -{ - return textbox->get_w() + listbox->get_w(); -} - -int BC_PopupTextBox::get_h() -{ - return textbox->get_h(); -} - -int BC_PopupTextBox::get_show_query() +int BC_PopupTextBox::handle_event() { - return listbox->get_show_query(); + return 1; } -void BC_PopupTextBox::set_show_query(int v) -{ - listbox->set_show_query(v); -} +const char *BC_PopupTextBox::get_text() { return textbox->get_text(); } +const wchar_t *BC_PopupTextBox::get_wtext() { return textbox->get_wtext(); } +int BC_PopupTextBox::get_number() { return list_item; } +void BC_PopupTextBox::set_number(int v) { list_item = v; } +int BC_PopupTextBox::get_x() { return x; } +int BC_PopupTextBox::get_y() { return y; } +int BC_PopupTextBox::get_w() { return textbox->get_w() + listbox->get_w(); } +int BC_PopupTextBox::get_h() { return textbox->get_h(); } +int BC_PopupTextBox::get_show_query() { return listbox->get_show_query(); } +void BC_PopupTextBox::set_show_query(int v) { listbox->set_show_query(v); } +int BC_PopupTextBox::get_back_color() { return textbox->get_back_color(); } +void BC_PopupTextBox::set_back_color(int v) { textbox->set_back_color(v); } -int BC_PopupTextBox::handle_event() +void BC_PopupTextBox::set_tooltip(const char *text) { - return 1; + listbox->set_tooltip(text); } void BC_PopupTextBox::reposition_window(int x, int y) @@ -2627,18 +2601,6 @@ void BC_PopupTextBox::reposition_window(int x, int y) } - - - - - - - - - - - - BC_TumbleTextBoxText::BC_TumbleTextBoxText(BC_TumbleTextBox *popup, int64_t default_value, int x, int y) : BC_TextBox(x, y, popup->text_w, 1, default_value) @@ -2684,14 +2646,9 @@ int BC_TumbleTextBoxText::button_press_event() - BC_TumbleTextBox::BC_TumbleTextBox(BC_WindowBase *parent_window, - int64_t default_value, - int64_t min, - int64_t max, - int x, - int y, - int text_w) + int64_t default_value, int64_t min, int64_t max, + int x, int y, int text_w) { reset(); this->x = x; @@ -2707,12 +2664,8 @@ BC_TumbleTextBox::BC_TumbleTextBox(BC_WindowBase *parent_window, } BC_TumbleTextBox::BC_TumbleTextBox(BC_WindowBase *parent_window, - int default_value, - int min, - int max, - int x, - int y, - int text_w) + int default_value, int min, int max, + int x, int y, int text_w) { reset(); this->x = x; @@ -2728,12 +2681,8 @@ BC_TumbleTextBox::BC_TumbleTextBox(BC_WindowBase *parent_window, } BC_TumbleTextBox::BC_TumbleTextBox(BC_WindowBase *parent_window, - float default_value_f, - float min_f, - float max_f, - int x, - int y, - int text_w) + float default_value_f, float min_f, float max_f, + int x, int y, int text_w, int precision) { reset(); this->x = x; @@ -2742,9 +2691,9 @@ BC_TumbleTextBox::BC_TumbleTextBox(BC_WindowBase *parent_window, this->max_f = max_f; this->default_value_f = default_value_f; this->text_w = text_w; + this->precision = precision; this->parent_window = parent_window; use_float = 1; - precision = 4; increment = 1; } @@ -2799,13 +2748,27 @@ int BC_TumbleTextBox::create_objects() x += textbox->get_w(); tumbler = use_float ? - (BC_Tumbler *)new BC_FTumbler(textbox, min_f, max_f, x, y) : - (BC_Tumbler *)new BC_ITumbler(textbox, min, max, x, y); + (BC_Tumbler *)new BC_FTextTumbler(this, min_f, max_f, x, y) : + (BC_Tumbler *)new BC_ITextTumbler(this, min, max, x, y); parent_window->add_subwindow(tumbler); tumbler->set_increment(increment); return 0; } +int BC_TumbleTextBox::handle_up_event() +{ + return use_float ? + ((BC_FTumbler *)tumbler)->BC_FTumbler::handle_up_event() : + ((BC_ITumbler *)tumbler)->BC_ITumbler::handle_up_event() ; +} + +int BC_TumbleTextBox::handle_down_event() +{ + return use_float ? + ((BC_FTumbler *)tumbler)->BC_FTumbler::handle_down_event() : + ((BC_ITumbler *)tumbler)->BC_ITumbler::handle_down_event() ; +} + const char* BC_TumbleTextBox::get_text() { return textbox->get_text(); @@ -2898,12 +2861,8 @@ void BC_TumbleTextBox::reposition_window(int x, int y) this->x = x; this->y = y; - textbox->reposition_window(x, - y, - text_w, - 1); - tumbler->reposition_window(x + textbox->get_w(), - y); + textbox->reposition_window(x, y, text_w, 1); + tumbler->reposition_window(x + textbox->get_w(), y); // if(flush) parent_window->flush(); }