Tweaks to the find dialogue

Originally committed to SVN as r657.
This commit is contained in:
Rodrigo Braz Monteiro 2006-12-29 22:58:09 +00:00
parent 8f50ee08a7
commit fcdf986f81
6 changed files with 33 additions and 5 deletions

View file

@ -55,6 +55,8 @@ Please visit http://aegisub.net to download latest version
- Added sorting functionality to Styles Manager, for both storage and current script. (AMZ)
- Tweaked the layout of Subtitles Edit area. (AMZ)
- Actor and Effect fields now show a "ghosted" caption saying their name when they are not focused on and blank. (AMZ)
- Aegisub now remembers if it was maximized when it was last quit, and restores its state when opening again. (AMZ)
- A few minor tweaks to the Find dialogue. (AMZ)
= 1.10 beta - 2006.08.07 ===========================

View file

@ -52,7 +52,7 @@
///////////////
// Constructor
DialogSearchReplace::DialogSearchReplace (wxWindow *parent,bool _hasReplace,wxString name)
: wxDialog(parent, -1, name, wxDefaultPosition, wxDefaultSize, wxCAPTION | wxCLOSE_BOX, _T("SearchReplace"))
: wxDialog(parent, -1, name, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE, _T("SearchReplace"))
{
// Setup
hasReplace = _hasReplace;
@ -61,9 +61,10 @@ DialogSearchReplace::DialogSearchReplace (wxWindow *parent,bool _hasReplace,wxSt
wxSizer *FindSizer = new wxFlexGridSizer(2,2,5,15);
wxArrayString FindHistory = Options.GetRecentList(_T("Recent find"));
FindEdit = new wxComboBox(this,-1,_T(""),wxDefaultPosition,wxSize(300,20),FindHistory,wxCB_DROPDOWN);
//if (FindHistory.Count()) FindEdit->SetStringSelection(FindHistory[0]);
FindEdit->SetSelection(0);
FindSizer->Add(new wxStaticText(this,-1,_("Find what:")),0,wxRIGHT | wxALIGN_CENTER_VERTICAL,0);
FindSizer->Add(FindEdit,0,wxRIGHT,0);
FindEdit->SetSelection(0);
if (hasReplace) {
wxArrayString ReplaceHistory = Options.GetRecentList(_T("Recent replace"));
ReplaceEdit = new wxComboBox(this,-1,_T(""),wxDefaultPosition,wxSize(300,20),ReplaceHistory,wxCB_DROPDOWN);
@ -153,6 +154,7 @@ void DialogSearchReplace::UpdateSettings() {
Options.Save();
}
///////////////
// Event table
BEGIN_EVENT_TABLE(DialogSearchReplace,wxDialog)
@ -174,6 +176,18 @@ void DialogSearchReplace::OnClose (wxCommandEvent &event) {
}
///////
// Key
void DialogSearchReplace::OnKeyDown (wxKeyEvent &event) {
//if (event.GetKeyCode() == WXK_ESCAPE) {
// Search.OnDialogClose();
// // Just hide
// Show(false);
//}
event.Skip();
}
/////////////
// Find next
void DialogSearchReplace::OnFindNext (wxCommandEvent &event) {
@ -539,8 +553,8 @@ void SearchReplaceEngine::OpenDialog (bool replace) {
if (diag) {
// it's the right type so give focus
if(replace == hasReplace) {
diag->FindEdit->SetFocus();
diag->Show();
diag->SetFocus();
OnDialogOpen();
return;
}
@ -549,6 +563,7 @@ void SearchReplaceEngine::OpenDialog (bool replace) {
}
// create new one
diag = new DialogSearchReplace(((AegisubApp*)wxTheApp)->frame,replace,title);
diag->FindEdit->SetFocus();
diag->Show();
hasReplace = replace;
}

View file

@ -91,6 +91,8 @@ extern SearchReplaceEngine Search;
//////////////////////////
// Search & Replace class
class DialogSearchReplace : public wxDialog {
friend class SearchReplaceEngine;
private:
bool hasReplace;
@ -102,13 +104,16 @@ private:
wxRadioBox *Affect;
wxRadioBox *Field;
void UpdateDropDowns();
void OnClose (wxCommandEvent &event);
void OnFindNext (wxCommandEvent &event);
void OnReplaceNext (wxCommandEvent &event);
void OnReplaceAll (wxCommandEvent &event);
void OnSetFocus (wxFocusEvent &event);
void OnKillFocus (wxFocusEvent &event);
void UpdateDropDowns();
void OnKeyDown (wxKeyEvent &event);
public:
DialogSearchReplace(wxWindow *parent,bool hasReplace,wxString name);
~DialogSearchReplace();

View file

@ -100,6 +100,7 @@ FrameMain::FrameMain (wxArrayString args)
// Contents
curMode = -1;
InitContents();
if (Options.AsBool(_T("Maximized"))) Maximize(true);
Show();
// Splash screen

View file

@ -1254,6 +1254,10 @@ void FrameMain::OnCloseWindow (wxCloseEvent &event) {
bool canVeto = event.CanVeto();
int result = TryToCloseSubs(canVeto);
// Store maximization state
Options.SetBool(_T("Maximized"),IsMaximized());
Options.Save();
// Abort/destroy
if (canVeto) {
if (result == wxCANCEL) event.Veto();

View file

@ -223,6 +223,7 @@ void OptionsManager::LoadDefaults() {
SetInt(_T("Tips current"),0);
SetBool(_T("Show associations"),true);
SetBool(_T("Maximized"),false);
SetBool(_T("Find Match Case"),false);
SetBool(_T("Find RegExp"),false);