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"),
};
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;
}
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()
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;
class ModifyTargetGUI : public BC_Window
{
public:
- ModifyTargetGUI(ModifyTargetThread *thread);
+ ModifyTargetGUI(ModifyTargetThread *thread, int allow_resize=0);
~ModifyTargetGUI();
virtual void create_objects() {}
virtual void update() {}
+ virtual int resize_event(int w, int h);
void create_objects(BC_TextBox *&text_box);
ModifyTargetThread *thread;
ModifyTargetPatternsGUI(ModifyTargetThread *thread);
~ModifyTargetPatternsGUI();
void create_objects();
+ int resize_event(int w, int h);
void update();
BC_ScrollTextBox *scroll_text_box;
+ BC_OKButton *ok_button;
+ BC_CancelButton *cancel_button;
+ int text_rowsz;
};
class ModifyTargetFileSizeGUI : public ModifyTargetGUI