bin folder tweaks
[goodguy/history.git] / cinelerra-5.1 / cinelerra / binfolder.C
index 868f1c209fef07e6e7df568d7fe19680066a27c3..68f8cb0bc9be746844a0dae6ca15d591a8e481e5 100644 (file)
@@ -57,12 +57,12 @@ const char *BinFolderTarget::types[] = {
 
 const char *BinFolderOp::types[] = {
        N_("Around"),
-       N_("Eq"),
-       N_("Ge"),
-       N_("Gt"),
-       N_("Ne"),
-       N_("Le"),
-       N_("Lt"),
+       N_("Eq  =="),
+       N_("Ge  >="),
+       N_("Gt  > "),
+       N_("Ne  !="),
+       N_("Le  <="),
+       N_("Lt  < "),
        N_("Matches"),
 };
 
@@ -1890,10 +1890,10 @@ void ModifyTargetThread::handle_close_event(int result)
        target = 0;
 }
 
-ModifyTargetGUI::ModifyTargetGUI(ModifyTargetThread *thread)
+ModifyTargetGUI::ModifyTargetGUI(ModifyTargetThread *thread, int allow_resize)
  : BC_Window(_(PROGRAM_NAME ": Modify target"),
                thread->wx, thread->wy, thread->ww, thread->wh,
-               -1, -1, 0, 0, 1)
+               -1, -1, allow_resize, 0, 1)
 {
        this->thread = thread;
 }
@@ -1914,11 +1914,17 @@ void ModifyTargetGUI::create_objects(BC_TextBox *&text_box)
        unlock_window();
 }
 
+int ModifyTargetGUI::resize_event(int w, int h)
+{
+       return BC_WindowBase::resize_event(w, h);
+}
+
 ModifyTargetPatternsGUI::ModifyTargetPatternsGUI(ModifyTargetThread *thread)
- : ModifyTargetGUI(thread)
+ : ModifyTargetGUI(thread, 1)
 {
        this->thread = thread;
        scroll_text_box = 0;
+       text_rowsz = 0;
 }
 
 ModifyTargetPatternsGUI::~ModifyTargetPatternsGUI()
@@ -1932,17 +1938,33 @@ void ModifyTargetPatternsGUI::create_objects()
        BinFolderTargetPatterns *target = (BinFolderTargetPatterns *)thread->target;
        int x = 10, y = 10;
        int text_font = MEDIUMFONT;
-       int text_rowsz = get_text_ascent(text_font)+1 + get_text_descent(text_font)+1;
-       int th = get_h() - BC_OKButton::calculate_h() - y - 10;
+       text_rowsz = get_text_ascent(text_font)+1 + get_text_descent(text_font)+1;
+       int th = get_h() - y - BC_OKButton::calculate_h() - 20;
        int rows = th / text_rowsz;
-       scroll_text_box = new BC_ScrollTextBox(this, x, y, get_w()-20, rows, target->text);
+       int text_len = strlen(target->text);
+       if( text_len < BCTEXTLEN ) text_len = BCTEXTLEN;
+       scroll_text_box = new BC_ScrollTextBox(this, x, y, get_w()-20, rows,
+               target->text, 2*text_len);
        scroll_text_box->create_objects();
-       add_subwindow(new BC_OKButton(this));
-       add_subwindow(new BC_CancelButton(this));
+       add_subwindow(ok_button = new BC_OKButton(this));
+       add_subwindow(cancel_button = new BC_CancelButton(this));
        show_window();
        unlock_window();
 }
 
+int ModifyTargetPatternsGUI::resize_event(int w, int h)
+{
+       int tx = scroll_text_box->get_x();
+       int ty = scroll_text_box->get_y();
+       int th = h - ty - BC_OKButton::calculate_h() - 20;
+       int tw = w - 20;
+       int rows = th / text_rowsz;
+       scroll_text_box->reposition_window(tx, ty, tw, rows);
+       ok_button->resize_event(w, h);
+       cancel_button->resize_event(w, h);
+       return 1;
+}
+
 void ModifyTargetPatternsGUI::update()
 {
        BinFolderTargetPatterns *target = (BinFolderTargetPatterns *)thread->target;