picon dirs, new cinfinity picons, plugin info, rework text drawing, show msg, compres...
[goodguy/history.git] / cinelerra-5.1 / guicast / bctextbox.C
index bd43f1cdf31b0bb4c63c45a3f797807d74286f44..d377a448a0039398ee493a8ce2ced415b8bf05b3 100644 (file)
@@ -697,7 +697,7 @@ void BC_TextBox::draw(int flush)
                        int len = row_end - row_begin;
                        if( len > 0 ) {
                                set_color(enabled ? resources->text_default : DMGREY);
-                               draw_wtext(text_x, k + text_ascent, wtext_row, len, 0);
+                               draw_single_text(1, font, text_x, k + text_ascent, wtext_row, len);
                        }
 
 // Get ibeam location
@@ -2313,10 +2313,9 @@ void BC_ScrollTextBox::update_scrollbars()
                int xpos = get_x_pos();
                if( xpos != xscroll->get_value() )
                        xscroll->update_value(xpos);
-               int xlength = text_width + view_w/4;
-               if( xlength != xscroll->get_length() ||
+               if( text_width != xscroll->get_length() ||
                    view_w != xscroll->get_handlelength() )
-                       xscroll->update_length(xlength, xpos, view_w, 0);
+                       xscroll->update_length(text_width, xpos, view_w, 0);
        }
        if( yscroll ) {
                yscroll->reposition_window(x + w - yscroll->get_span(), y, text->get_h());
@@ -2342,8 +2341,9 @@ int BC_ScrollTextBoxText::motion_event()
 }
 
 BC_ScrollTextBoxXScroll::BC_ScrollTextBoxXScroll(BC_ScrollTextBox *gui)
- : BC_ScrollBar(gui->x, gui->y + gui->text->get_h(), SCROLL_HORIZ, gui->text->get_w(),
-               gui->text->get_text_width(MEDIUMFONT, gui->get_wtext()), 0, gui->w)
+ : BC_ScrollBar(gui->x, gui->y + gui->text->get_h(), SCROLL_HORIZ + SCROLL_STRETCH,
+       gui->text->get_w(), gui->text->get_text_width(MEDIUMFONT, gui->get_wtext()),
+       0, gui->w)
 {
        this->gui = gui;
 }
@@ -2359,8 +2359,8 @@ int BC_ScrollTextBoxXScroll::handle_event()
 }
 
 BC_ScrollTextBoxYScroll::BC_ScrollTextBoxYScroll(BC_ScrollTextBox *gui)
- : BC_ScrollBar(gui->x + gui->text->get_w(), gui->y, SCROLL_VERT, gui->text->get_h(),
-               gui->text->get_text_rows(), 0, gui->rows)
+ : BC_ScrollBar(gui->x + gui->text->get_w(), gui->y, SCROLL_VERT,
+       gui->text->get_h(), gui->text->get_text_rows(), 0, gui->rows)
 {
        this->gui = gui;
 }
@@ -2561,8 +2561,8 @@ BC_TumbleTextBoxText::BC_TumbleTextBoxText(BC_TumbleTextBox *popup,
 }
 
 BC_TumbleTextBoxText::BC_TumbleTextBoxText(BC_TumbleTextBox *popup,
-       float default_value, int x, int y)
- : BC_TextBox(x, y, popup->text_w, 1, default_value)
+       float default_value, int x, int y, int precision)
+ : BC_TextBox(x, y, popup->text_w, 1, default_value, 1, MEDIUMFONT, precision)
 {
        this->popup = popup;
 }
@@ -2587,19 +2587,10 @@ int BC_TumbleTextBoxText::handle_event()
 
 int BC_TumbleTextBoxText::button_press_event()
 {
-       if(is_event_win())
-       {
-               if(get_buttonpress() < 4) return BC_TextBox::button_press_event();
-
-               if(get_buttonpress() == 4)
-               {
-                       popup->tumbler->handle_up_event();
-               }
-               else
-               if(get_buttonpress() == 5)
-               {
-                       popup->tumbler->handle_down_event();
-               }
+       if( get_enabled() && is_event_win() ) {
+               if( get_buttonpress() < 4 ) return BC_TextBox::button_press_event();
+               if( get_buttonpress() == 4 )      popup->tumbler->handle_up_event();
+               else if( get_buttonpress() == 5 ) popup->tumbler->handle_down_event();
                return 1;
        }
        return 0;
@@ -2714,31 +2705,17 @@ int BC_TumbleTextBox::create_objects()
 {
        int x = this->x, y = this->y;
 
-       if(use_float)
-       {
-               parent_window->add_subwindow(textbox = new BC_TumbleTextBoxText(this,
-                       default_value_f, x, y));
-               textbox->set_precision(precision);
-       }
-       else
-               parent_window->add_subwindow(textbox = new BC_TumbleTextBoxText(this,
-                       default_value, x, y));
+       textbox = use_float ?
+               new BC_TumbleTextBoxText(this, default_value_f, x, y, precision) :
+               new BC_TumbleTextBoxText(this, default_value, x, y);
 
+       parent_window->add_subwindow(textbox);
        x += textbox->get_w();
 
-       if(use_float)
-               parent_window->add_subwindow(tumbler = new BC_FTumbler(textbox,
-                       min_f,
-                       max_f,
-                       x,
-                       y));
-       else
-               parent_window->add_subwindow(tumbler = new BC_ITumbler(textbox,
-                       min,
-                       max,
-                       x,
-                       y));
-
+       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);
+       parent_window->add_subwindow(tumbler);
        tumbler->set_increment(increment);
        return 0;
 }