mirror of https://github.com/odrling/Aegisub
Fix #607: Have style editor save its position and size during the session, similar to how several other dialogues already do. The stored position is not persistent, it is lost when Aegisub is closed.
Originally committed to SVN as r3019.
This commit is contained in:
parent
c74a02e57d
commit
4b41b4ca4a
|
@ -356,7 +356,7 @@ DialogStyleEditor::DialogStyleEditor (wxWindow *parent, AssStyle *_style, Subtit
|
||||||
// Set sizer
|
// Set sizer
|
||||||
MainSizer->SetSizeHints(this);
|
MainSizer->SetSizeHints(this);
|
||||||
SetSizer(MainSizer);
|
SetSizer(MainSizer);
|
||||||
CenterOnParent();
|
LoadPosition();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -399,8 +399,8 @@ END_EVENT_TABLE()
|
||||||
/////////////////////
|
/////////////////////
|
||||||
// Event redirectors
|
// Event redirectors
|
||||||
void DialogStyleEditor::OnApply (wxCommandEvent &event) { Apply(true,false); }
|
void DialogStyleEditor::OnApply (wxCommandEvent &event) { Apply(true,false); }
|
||||||
void DialogStyleEditor::OnOK (wxCommandEvent &event) { Apply(true,true); }
|
void DialogStyleEditor::OnOK (wxCommandEvent &event) { SavePosition(); Apply(true,true); }
|
||||||
void DialogStyleEditor::OnCancel (wxCommandEvent &event) { Apply(false,true); }
|
void DialogStyleEditor::OnCancel (wxCommandEvent &event) { SavePosition(); Apply(false,true); }
|
||||||
void DialogStyleEditor::OnSetColor1 (wxCommandEvent &event) { OnSetColor(1); }
|
void DialogStyleEditor::OnSetColor1 (wxCommandEvent &event) { OnSetColor(1); }
|
||||||
void DialogStyleEditor::OnSetColor2 (wxCommandEvent &event) { OnSetColor(2); }
|
void DialogStyleEditor::OnSetColor2 (wxCommandEvent &event) { OnSetColor(2); }
|
||||||
void DialogStyleEditor::OnSetColor3 (wxCommandEvent &event) { OnSetColor(3); }
|
void DialogStyleEditor::OnSetColor3 (wxCommandEvent &event) { OnSetColor(3); }
|
||||||
|
@ -687,3 +687,23 @@ int DialogStyleEditor::AlignToControl (int n) {
|
||||||
default: return 7;
|
default: return 7;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////
|
||||||
|
// Load and save window position for the session
|
||||||
|
void DialogStyleEditor::SavePosition() {
|
||||||
|
use_saved_position = true;
|
||||||
|
saved_position = GetRect();
|
||||||
|
}
|
||||||
|
void DialogStyleEditor::LoadPosition() {
|
||||||
|
if (use_saved_position)
|
||||||
|
SetSize(saved_position);
|
||||||
|
else
|
||||||
|
CentreOnParent();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////
|
||||||
|
// Static class data saving position
|
||||||
|
wxRect DialogStyleEditor::saved_position;
|
||||||
|
bool DialogStyleEditor::use_saved_position = false;
|
||||||
|
|
|
@ -100,6 +100,11 @@ private:
|
||||||
ColourButton *previewButton;
|
ColourButton *previewButton;
|
||||||
wxSizer *MainSizer;
|
wxSizer *MainSizer;
|
||||||
|
|
||||||
|
static wxRect saved_position;
|
||||||
|
static bool use_saved_position;
|
||||||
|
void SavePosition();
|
||||||
|
void LoadPosition();
|
||||||
|
|
||||||
void SetBitmapColor (int n,wxColour color);
|
void SetBitmapColor (int n,wxColour color);
|
||||||
int AlignToControl (int n);
|
int AlignToControl (int n);
|
||||||
int ControlToAlign (int n);
|
int ControlToAlign (int n);
|
||||||
|
|
Loading…
Reference in New Issue