X-Git-Url: https://git.cinelerra-gg.org/git/?a=blobdiff_plain;f=cinelerra-5.1%2Fguicast%2Fbctextbox.C;h=5d1257eb82cb44e949ca24c406b43684d278b1df;hb=3ac72077bee819333ea9e8c3c3307b529ecf3647;hp=ef3ffb1f587f652b3a4e43fc20583557d9077627;hpb=63ced327c156ea7fe4448a18b0b1b0f2571dce7e;p=goodguy%2Fhistory.git diff --git a/cinelerra-5.1/guicast/bctextbox.C b/cinelerra-5.1/guicast/bctextbox.C index ef3ffb1f..5d1257eb 100644 --- a/cinelerra-5.1/guicast/bctextbox.C +++ b/cinelerra-5.1/guicast/bctextbox.C @@ -176,6 +176,7 @@ int BC_TextBox::reset_parameters(int rows, int has_border, int font, int size) xscroll = 0; yscroll = 0; dirty = 1; + selection_active = 0; return 0; } @@ -673,6 +674,8 @@ void BC_TextBox::draw(int flush) highlight_letter1 <= row_end ) { int color = active && enabled && get_has_focus() ? resources->text_highlight : + selection_active ? + resources->text_selected_highlight : resources->text_inactive_highlight; if( unicode_active >= 0 ) color ^= LTBLUE; @@ -697,7 +700,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 @@ -2007,17 +2010,25 @@ void BC_TextBox::copy_selection(int clipboard_num) //printf(" BC_TextBox::copy_selection %d %d %d\n",highlight_letter1, highlight_letter2, clip_len); char ctext[4*clip_len+4]; clip_len = text_update(&wtext[highlight_letter1],clip_len, ctext,4*clip_len+4); - get_clipboard()->to_clipboard(ctext, clip_len, clipboard_num); + to_clipboard(ctext, clip_len, clipboard_num); + selection_active = 1; } +int BC_TextBox::selection_clear_event() +{ + if( !is_event_win() ) return 0; + selection_active = 0; + draw(1); + return 1; +} void BC_TextBox::paste_selection(int clipboard_num) { - int len = get_clipboard()->clipboard_len(clipboard_num); + int len = clipboard_len(clipboard_num); if( len > 0 ) { char cstring[len]; wchar_t wstring[len]; - get_clipboard()->from_clipboard(cstring, len, clipboard_num); --len; + from_clipboard(cstring, len, clipboard_num); --len; //printf("BC_TextBox::paste_selection %d '%*.*s'\n",len,len,len,cstring); len = BC_Resources::encode(BC_Resources::encoding, BC_Resources::wide_encoding, cstring,len, (char *)wstring,(len+1)*sizeof(wchar_t)) / sizeof(wchar_t); @@ -2313,10 +2324,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 +2352,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 +2370,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; } @@ -2587,19 +2598,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;