forked from mia/Aegisub
Shuffle around the find dialog sizers to cut down on empty space
This commit is contained in:
parent
13851ff74d
commit
2d521fafc5
2 changed files with 40 additions and 38 deletions
|
@ -51,79 +51,82 @@
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
|
||||||
#include <wx/button.h>
|
#include <wx/button.h>
|
||||||
|
#include <wx/checkbox.h>
|
||||||
|
#include <wx/combobox.h>
|
||||||
#include <wx/msgdlg.h>
|
#include <wx/msgdlg.h>
|
||||||
|
#include <wx/radiobox.h>
|
||||||
#include <wx/regex.h>
|
#include <wx/regex.h>
|
||||||
#include <wx/sizer.h>
|
#include <wx/sizer.h>
|
||||||
#include <wx/stattext.h>
|
#include <wx/stattext.h>
|
||||||
#include <wx/string.h>
|
#include <wx/textctrl.h>
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
BUTTON_FIND_NEXT,
|
BUTTON_FIND_NEXT,
|
||||||
BUTTON_REPLACE_NEXT,
|
BUTTON_REPLACE_NEXT,
|
||||||
BUTTON_REPLACE_ALL,
|
BUTTON_REPLACE_ALL
|
||||||
CHECK_MATCH_CASE,
|
|
||||||
CHECK_REGEXP,
|
|
||||||
CHECK_UPDATE_VIDEO
|
|
||||||
};
|
};
|
||||||
|
|
||||||
DialogSearchReplace::DialogSearchReplace(agi::Context* c, bool withReplace)
|
DialogSearchReplace::DialogSearchReplace(agi::Context* c, bool withReplace)
|
||||||
: wxDialog(c->parent, -1, withReplace ? _("Replace") : _("Find"))
|
: wxDialog(c->parent, -1, withReplace ? _("Replace") : _("Find"))
|
||||||
, hasReplace(withReplace)
|
, hasReplace(withReplace)
|
||||||
{
|
{
|
||||||
wxSizer *FindSizer = new wxFlexGridSizer(2,2,5,15);
|
wxSizer *FindSizer = new wxFlexGridSizer(2, 2, 5, 15);
|
||||||
FindEdit = new wxComboBox(this,-1,"",wxDefaultPosition,wxSize(300,-1),lagi_MRU_wxAS("Find"),wxCB_DROPDOWN);
|
FindEdit = new wxComboBox(this, -1, "", wxDefaultPosition, wxSize(300, -1), lagi_MRU_wxAS("Find"), wxCB_DROPDOWN);
|
||||||
if (!FindEdit->IsListEmpty())
|
if (!FindEdit->IsListEmpty())
|
||||||
FindEdit->SetSelection(0);
|
FindEdit->SetSelection(0);
|
||||||
FindSizer->Add(new wxStaticText(this,-1,_("Find what:")),0,wxRIGHT | wxALIGN_CENTER_VERTICAL,0);
|
FindSizer->Add(new wxStaticText(this, -1, _("Find what:")), 0, wxALIGN_CENTER_VERTICAL);
|
||||||
FindSizer->Add(FindEdit,0,wxRIGHT,0);
|
FindSizer->Add(FindEdit);
|
||||||
if (hasReplace) {
|
if (hasReplace) {
|
||||||
ReplaceEdit = new wxComboBox(this,-1,"",wxDefaultPosition,wxSize(300,-1),lagi_MRU_wxAS("Replace"),wxCB_DROPDOWN);
|
ReplaceEdit = new wxComboBox(this, -1, "", wxDefaultPosition, wxSize(300, -1), lagi_MRU_wxAS("Replace"), wxCB_DROPDOWN);
|
||||||
FindSizer->Add(new wxStaticText(this,-1,_("Replace with:")),0,wxRIGHT | wxALIGN_CENTER_VERTICAL,0);
|
FindSizer->Add(new wxStaticText(this, -1, _("Replace with:")), 0, wxALIGN_CENTER_VERTICAL);
|
||||||
FindSizer->Add(ReplaceEdit,0,wxRIGHT,0);
|
FindSizer->Add(ReplaceEdit);
|
||||||
if (!ReplaceEdit->IsListEmpty())
|
if (!ReplaceEdit->IsListEmpty())
|
||||||
ReplaceEdit->SetSelection(0);
|
ReplaceEdit->SetSelection(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
wxSizer *OptionsSizer = new wxBoxSizer(wxVERTICAL);
|
wxSizer *OptionsSizer = new wxBoxSizer(wxVERTICAL);
|
||||||
CheckMatchCase = new wxCheckBox(this,CHECK_MATCH_CASE,_("&Match case"));
|
CheckMatchCase = new wxCheckBox(this, -1, _("&Match case"));
|
||||||
CheckRegExp = new wxCheckBox(this,CHECK_MATCH_CASE,_("&Use regular expressions"));
|
CheckRegExp = new wxCheckBox(this, -1, _("&Use regular expressions"));
|
||||||
CheckMatchCase->SetValue(OPT_GET("Tool/Search Replace/Match Case")->GetBool());
|
CheckMatchCase->SetValue(OPT_GET("Tool/Search Replace/Match Case")->GetBool());
|
||||||
CheckRegExp->SetValue(OPT_GET("Tool/Search Replace/RegExp")->GetBool());
|
CheckRegExp->SetValue(OPT_GET("Tool/Search Replace/RegExp")->GetBool());
|
||||||
OptionsSizer->Add(CheckMatchCase,0,wxBOTTOM,5);
|
OptionsSizer->Add(CheckMatchCase, wxSizerFlags().Border(wxBOTTOM));
|
||||||
OptionsSizer->Add(CheckRegExp,0,wxBOTTOM,5);
|
OptionsSizer->Add(CheckRegExp);
|
||||||
|
|
||||||
|
// Left sizer
|
||||||
|
wxSizer *LeftSizer = new wxBoxSizer(wxVERTICAL);
|
||||||
|
LeftSizer->Add(FindSizer, wxSizerFlags().DoubleBorder(wxBOTTOM));
|
||||||
|
LeftSizer->Add(OptionsSizer);
|
||||||
|
|
||||||
// Limits sizer
|
// Limits sizer
|
||||||
wxString field[] = { _("Text"), _("Style"), _("Actor"), _("Effect") };
|
wxString field[] = { _("Text"), _("Style"), _("Actor"), _("Effect") };
|
||||||
wxString affect[] = { _("All rows"), _("Selected rows") };
|
wxString affect[] = { _("All rows"), _("Selected rows") };
|
||||||
Field = new wxRadioBox(this,-1,_("In Field"),wxDefaultPosition,wxDefaultSize,countof(field), field);
|
Field = new wxRadioBox(this, -1, _("In Field"), wxDefaultPosition, wxDefaultSize, countof(field), field);
|
||||||
Affect = new wxRadioBox(this,-1,_("Limit to"),wxDefaultPosition,wxDefaultSize,countof(affect), affect);
|
Affect = new wxRadioBox(this, -1, _("Limit to"), wxDefaultPosition, wxDefaultSize, countof(affect), affect);
|
||||||
wxSizer *LimitSizer = new wxBoxSizer(wxHORIZONTAL);
|
wxSizer *LimitSizer = new wxBoxSizer(wxHORIZONTAL);
|
||||||
LimitSizer->Add(Field,1,wxEXPAND | wxRIGHT,5);
|
LimitSizer->Add(Field, wxSizerFlags().Border(wxRIGHT));
|
||||||
LimitSizer->Add(Affect,0,wxEXPAND | wxRIGHT,0);
|
LimitSizer->Add(Affect);
|
||||||
Field->SetSelection(OPT_GET("Tool/Search Replace/Field")->GetInt());
|
Field->SetSelection(OPT_GET("Tool/Search Replace/Field")->GetInt());
|
||||||
Affect->SetSelection(OPT_GET("Tool/Search Replace/Affect")->GetInt());
|
Affect->SetSelection(OPT_GET("Tool/Search Replace/Affect")->GetInt());
|
||||||
|
|
||||||
// Left sizer
|
|
||||||
wxSizer *LeftSizer = new wxBoxSizer(wxVERTICAL);
|
|
||||||
LeftSizer->Add(FindSizer,0,wxBOTTOM,10);
|
|
||||||
LeftSizer->Add(OptionsSizer,0,wxBOTTOM,5);
|
|
||||||
LeftSizer->Add(LimitSizer,0,wxEXPAND | wxBOTTOM,0);
|
|
||||||
|
|
||||||
// Buttons
|
// Buttons
|
||||||
wxSizer *ButtonSizer = new wxBoxSizer(wxVERTICAL);
|
wxSizer *ButtonSizer = new wxBoxSizer(wxVERTICAL);
|
||||||
wxButton *FindNext = new wxButton(this,BUTTON_FIND_NEXT,_("&Find next"));
|
wxButton *FindNext = new wxButton(this, BUTTON_FIND_NEXT, _("&Find next"));
|
||||||
FindNext->SetDefault();
|
FindNext->SetDefault();
|
||||||
ButtonSizer->Add(FindNext,0,wxEXPAND | wxBOTTOM,3);
|
ButtonSizer->Add(FindNext, wxSizerFlags().Border(wxBOTTOM));
|
||||||
if (hasReplace) {
|
if (hasReplace) {
|
||||||
ButtonSizer->Add(new wxButton(this,BUTTON_REPLACE_NEXT,_("Replace &next")),0,wxEXPAND | wxBOTTOM,3);
|
ButtonSizer->Add(new wxButton(this, BUTTON_REPLACE_NEXT, _("Replace &next")), wxSizerFlags().Border(wxBOTTOM));
|
||||||
ButtonSizer->Add(new wxButton(this,BUTTON_REPLACE_ALL,_("Replace &all")),0,wxEXPAND | wxBOTTOM,3);
|
ButtonSizer->Add(new wxButton(this, BUTTON_REPLACE_ALL, _("Replace &all")), wxSizerFlags().Border(wxBOTTOM));
|
||||||
}
|
}
|
||||||
ButtonSizer->Add(new wxButton(this,wxID_CANCEL),0,wxEXPAND | wxBOTTOM,20);
|
ButtonSizer->Add(new wxButton(this, wxID_CANCEL));
|
||||||
|
|
||||||
|
wxSizer *TopSizer = new wxBoxSizer(wxHORIZONTAL);
|
||||||
|
TopSizer->Add(LeftSizer, wxSizerFlags().Border());
|
||||||
|
TopSizer->Add(ButtonSizer, wxSizerFlags().Border());
|
||||||
|
|
||||||
// Main sizer
|
// Main sizer
|
||||||
wxSizer *MainSizer = new wxBoxSizer(wxHORIZONTAL);
|
wxSizer *MainSizer = new wxBoxSizer(wxVERTICAL);
|
||||||
MainSizer->Add(LeftSizer,0,wxEXPAND | wxALL,5);
|
MainSizer->Add(TopSizer);
|
||||||
MainSizer->Add(ButtonSizer,0,wxEXPAND | wxALL,5);
|
MainSizer->Add(LimitSizer, wxSizerFlags().Border());
|
||||||
SetSizerAndFit(MainSizer);
|
SetSizerAndFit(MainSizer);
|
||||||
CenterOnParent();
|
CenterOnParent();
|
||||||
|
|
||||||
|
|
|
@ -32,14 +32,13 @@
|
||||||
/// @ingroup secondary_ui
|
/// @ingroup secondary_ui
|
||||||
///
|
///
|
||||||
|
|
||||||
#include <wx/checkbox.h>
|
|
||||||
#include <wx/combobox.h>
|
|
||||||
#include <wx/dialog.h>
|
#include <wx/dialog.h>
|
||||||
#include <wx/radiobox.h>
|
|
||||||
#include <wx/string.h>
|
#include <wx/string.h>
|
||||||
#include <wx/textctrl.h>
|
|
||||||
|
|
||||||
namespace agi { struct Context; }
|
namespace agi { struct Context; }
|
||||||
|
class wxCheckBox;
|
||||||
|
class wxComboBox;
|
||||||
|
class wxRadioBox;
|
||||||
|
|
||||||
class SearchReplaceEngine {
|
class SearchReplaceEngine {
|
||||||
int curLine;
|
int curLine;
|
||||||
|
|
Loading…
Reference in a new issue