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) - Added sorting functionality to Styles Manager, for both storage and current script. (AMZ)
- Tweaked the layout of Subtitles Edit area. (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) - 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 =========================== = 1.10 beta - 2006.08.07 ===========================

View file

@ -52,7 +52,7 @@
/////////////// ///////////////
// Constructor // Constructor
DialogSearchReplace::DialogSearchReplace (wxWindow *parent,bool _hasReplace,wxString name) 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 // Setup
hasReplace = _hasReplace; hasReplace = _hasReplace;
@ -61,9 +61,10 @@ DialogSearchReplace::DialogSearchReplace (wxWindow *parent,bool _hasReplace,wxSt
wxSizer *FindSizer = new wxFlexGridSizer(2,2,5,15); wxSizer *FindSizer = new wxFlexGridSizer(2,2,5,15);
wxArrayString FindHistory = Options.GetRecentList(_T("Recent find")); wxArrayString FindHistory = Options.GetRecentList(_T("Recent find"));
FindEdit = new wxComboBox(this,-1,_T(""),wxDefaultPosition,wxSize(300,20),FindHistory,wxCB_DROPDOWN); 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(new wxStaticText(this,-1,_("Find what:")),0,wxRIGHT | wxALIGN_CENTER_VERTICAL,0);
FindSizer->Add(FindEdit,0,wxRIGHT,0); FindSizer->Add(FindEdit,0,wxRIGHT,0);
FindEdit->SetSelection(0);
if (hasReplace) { if (hasReplace) {
wxArrayString ReplaceHistory = Options.GetRecentList(_T("Recent replace")); wxArrayString ReplaceHistory = Options.GetRecentList(_T("Recent replace"));
ReplaceEdit = new wxComboBox(this,-1,_T(""),wxDefaultPosition,wxSize(300,20),ReplaceHistory,wxCB_DROPDOWN); ReplaceEdit = new wxComboBox(this,-1,_T(""),wxDefaultPosition,wxSize(300,20),ReplaceHistory,wxCB_DROPDOWN);
@ -153,6 +154,7 @@ void DialogSearchReplace::UpdateSettings() {
Options.Save(); Options.Save();
} }
/////////////// ///////////////
// Event table // Event table
BEGIN_EVENT_TABLE(DialogSearchReplace,wxDialog) 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 // Find next
void DialogSearchReplace::OnFindNext (wxCommandEvent &event) { void DialogSearchReplace::OnFindNext (wxCommandEvent &event) {
@ -539,8 +553,8 @@ void SearchReplaceEngine::OpenDialog (bool replace) {
if (diag) { if (diag) {
// it's the right type so give focus // it's the right type so give focus
if(replace == hasReplace) { if(replace == hasReplace) {
diag->FindEdit->SetFocus();
diag->Show(); diag->Show();
diag->SetFocus();
OnDialogOpen(); OnDialogOpen();
return; return;
} }
@ -549,6 +563,7 @@ void SearchReplaceEngine::OpenDialog (bool replace) {
} }
// create new one // create new one
diag = new DialogSearchReplace(((AegisubApp*)wxTheApp)->frame,replace,title); diag = new DialogSearchReplace(((AegisubApp*)wxTheApp)->frame,replace,title);
diag->FindEdit->SetFocus();
diag->Show(); diag->Show();
hasReplace = replace; hasReplace = replace;
} }

View file

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

View file

@ -72,7 +72,7 @@
// FrameMain constructor // FrameMain constructor
FrameMain::FrameMain (wxArrayString args) FrameMain::FrameMain (wxArrayString args)
: wxFrame ((wxFrame*)NULL,-1,_T(""),wxDefaultPosition,wxSize(800,600),wxDEFAULT_FRAME_STYLE | wxCLIP_CHILDREN) : wxFrame ((wxFrame*)NULL,-1,_T(""),wxDefaultPosition,wxSize(800,600),wxDEFAULT_FRAME_STYLE | wxCLIP_CHILDREN)
{ {
// Initialize flags // Initialize flags
HasSelection = false; HasSelection = false;
@ -100,6 +100,7 @@ FrameMain::FrameMain (wxArrayString args)
// Contents // Contents
curMode = -1; curMode = -1;
InitContents(); InitContents();
if (Options.AsBool(_T("Maximized"))) Maximize(true);
Show(); Show();
// Splash screen // Splash screen

View file

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

View file

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