diff --git a/aegisub/src/dialog_style_editor.cpp b/aegisub/src/dialog_style_editor.cpp index dc9e4c18d..5a3db7954 100644 --- a/aegisub/src/dialog_style_editor.cpp +++ b/aegisub/src/dialog_style_editor.cpp @@ -356,7 +356,7 @@ DialogStyleEditor::DialogStyleEditor (wxWindow *parent, AssStyle *_style, Subtit // Set sizer MainSizer->SetSizeHints(this); SetSizer(MainSizer); - CenterOnParent(); + LoadPosition(); } @@ -399,8 +399,8 @@ END_EVENT_TABLE() ///////////////////// // Event redirectors void DialogStyleEditor::OnApply (wxCommandEvent &event) { Apply(true,false); } -void DialogStyleEditor::OnOK (wxCommandEvent &event) { Apply(true,true); } -void DialogStyleEditor::OnCancel (wxCommandEvent &event) { Apply(false,true); } +void DialogStyleEditor::OnOK (wxCommandEvent &event) { SavePosition(); Apply(true,true); } +void DialogStyleEditor::OnCancel (wxCommandEvent &event) { SavePosition(); Apply(false,true); } void DialogStyleEditor::OnSetColor1 (wxCommandEvent &event) { OnSetColor(1); } void DialogStyleEditor::OnSetColor2 (wxCommandEvent &event) { OnSetColor(2); } void DialogStyleEditor::OnSetColor3 (wxCommandEvent &event) { OnSetColor(3); } @@ -687,3 +687,23 @@ int DialogStyleEditor::AlignToControl (int n) { 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; diff --git a/aegisub/src/dialog_style_editor.h b/aegisub/src/dialog_style_editor.h index 220c449ce..e9ca54947 100644 --- a/aegisub/src/dialog_style_editor.h +++ b/aegisub/src/dialog_style_editor.h @@ -100,6 +100,11 @@ private: ColourButton *previewButton; wxSizer *MainSizer; + static wxRect saved_position; + static bool use_saved_position; + void SavePosition(); + void LoadPosition(); + void SetBitmapColor (int n,wxColour color); int AlignToControl (int n); int ControlToAlign (int n);