forked from mia/Aegisub
Use PersistLocation for saving and restoring DialogStyleEditor's position
Originally committed to SVN as r5720.
This commit is contained in:
parent
9ccd06b610
commit
cbcc581cea
3 changed files with 19 additions and 70 deletions
|
@ -50,16 +50,18 @@
|
||||||
#include "ass_override.h"
|
#include "ass_override.h"
|
||||||
#include "ass_style.h"
|
#include "ass_style.h"
|
||||||
#include "ass_style_storage.h"
|
#include "ass_style_storage.h"
|
||||||
|
#include "colour_button.h"
|
||||||
#include "compat.h"
|
#include "compat.h"
|
||||||
#include "dialog_style_editor.h"
|
#include "dialog_style_editor.h"
|
||||||
#include "include/aegisub/context.h"
|
|
||||||
#include "help_button.h"
|
#include "help_button.h"
|
||||||
|
#include "include/aegisub/context.h"
|
||||||
|
#include "include/aegisub/subtitles_provider.h"
|
||||||
#include "libresrc/libresrc.h"
|
#include "libresrc/libresrc.h"
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
|
#include "persist_location.h"
|
||||||
#include "selection_controller.h"
|
#include "selection_controller.h"
|
||||||
#include "subs_grid.h"
|
#include "subs_grid.h"
|
||||||
#include "subs_preview.h"
|
#include "subs_preview.h"
|
||||||
#include "include/aegisub/subtitles_provider.h"
|
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "validators.h"
|
#include "validators.h"
|
||||||
|
|
||||||
|
@ -352,7 +354,8 @@ DialogStyleEditor::DialogStyleEditor (wxWindow *parent, AssStyle *style, agi::Co
|
||||||
// Set sizer
|
// Set sizer
|
||||||
MainSizer->SetSizeHints(this);
|
MainSizer->SetSizeHints(this);
|
||||||
SetSizer(MainSizer);
|
SetSizer(MainSizer);
|
||||||
LoadPosition();
|
|
||||||
|
persist.reset(new PersistLocation(this, "Tool/Style Editor"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Destructor
|
/// @brief Destructor
|
||||||
|
@ -361,8 +364,6 @@ DialogStyleEditor::~DialogStyleEditor () {
|
||||||
delete work;
|
delete work;
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////
|
|
||||||
// Event table
|
|
||||||
BEGIN_EVENT_TABLE(DialogStyleEditor, wxDialog)
|
BEGIN_EVENT_TABLE(DialogStyleEditor, wxDialog)
|
||||||
EVT_BUTTON(wxID_APPLY, DialogStyleEditor::OnApply)
|
EVT_BUTTON(wxID_APPLY, DialogStyleEditor::OnApply)
|
||||||
EVT_BUTTON(wxID_OK, DialogStyleEditor::OnOK)
|
EVT_BUTTON(wxID_OK, DialogStyleEditor::OnOK)
|
||||||
|
@ -389,41 +390,12 @@ BEGIN_EVENT_TABLE(DialogStyleEditor, wxDialog)
|
||||||
EVT_SPINCTRL(TEXT_ALPHA_4, DialogStyleEditor::OnSpinPreviewUpdate)
|
EVT_SPINCTRL(TEXT_ALPHA_4, DialogStyleEditor::OnSpinPreviewUpdate)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
|
void DialogStyleEditor::OnApply (wxCommandEvent &event) { Apply(true, false); }
|
||||||
|
void DialogStyleEditor::OnOK (wxCommandEvent &event) { Apply(true, true); }
|
||||||
/// @brief Event redirectors
|
void DialogStyleEditor::OnCancel (wxCommandEvent &event) { Apply(false, true); }
|
||||||
/// @param event
|
|
||||||
///
|
|
||||||
void DialogStyleEditor::OnApply (wxCommandEvent &event) { Apply(true,false); }
|
|
||||||
|
|
||||||
/// @brief DOCME
|
|
||||||
/// @param event
|
|
||||||
///
|
|
||||||
void DialogStyleEditor::OnOK (wxCommandEvent &event) { SavePosition(); Apply(true,true); }
|
|
||||||
|
|
||||||
/// @brief DOCME
|
|
||||||
/// @param event
|
|
||||||
///
|
|
||||||
void DialogStyleEditor::OnCancel (wxCommandEvent &event) { SavePosition(); Apply(false,true); }
|
|
||||||
|
|
||||||
/// @brief DOCME
|
|
||||||
/// @param event
|
|
||||||
///
|
|
||||||
void DialogStyleEditor::OnSetColor1 (wxCommandEvent &event) { OnSetColor(1); }
|
void DialogStyleEditor::OnSetColor1 (wxCommandEvent &event) { OnSetColor(1); }
|
||||||
|
|
||||||
/// @brief DOCME
|
|
||||||
/// @param event
|
|
||||||
///
|
|
||||||
void DialogStyleEditor::OnSetColor2 (wxCommandEvent &event) { OnSetColor(2); }
|
void DialogStyleEditor::OnSetColor2 (wxCommandEvent &event) { OnSetColor(2); }
|
||||||
|
|
||||||
/// @brief DOCME
|
|
||||||
/// @param event
|
|
||||||
///
|
|
||||||
void DialogStyleEditor::OnSetColor3 (wxCommandEvent &event) { OnSetColor(3); }
|
void DialogStyleEditor::OnSetColor3 (wxCommandEvent &event) { OnSetColor(3); }
|
||||||
|
|
||||||
/// @brief DOCME
|
|
||||||
/// @param event
|
|
||||||
///
|
|
||||||
void DialogStyleEditor::OnSetColor4 (wxCommandEvent &event) { OnSetColor(4); }
|
void DialogStyleEditor::OnSetColor4 (wxCommandEvent &event) { OnSetColor(4); }
|
||||||
|
|
||||||
/// @brief Replace Style
|
/// @brief Replace Style
|
||||||
|
@ -698,25 +670,3 @@ int DialogStyleEditor::AlignToControl (int n) {
|
||||||
default: return 7;
|
default: return 7;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Load and save window position for the session
|
|
||||||
///
|
|
||||||
void DialogStyleEditor::SavePosition() {
|
|
||||||
use_saved_position = true;
|
|
||||||
saved_position = GetRect();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @brief DOCME
|
|
||||||
///
|
|
||||||
void DialogStyleEditor::LoadPosition() {
|
|
||||||
if (use_saved_position)
|
|
||||||
SetSize(saved_position);
|
|
||||||
else
|
|
||||||
CentreOnParent();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// DOCME
|
|
||||||
wxRect DialogStyleEditor::saved_position;
|
|
||||||
|
|
||||||
/// DOCME
|
|
||||||
bool DialogStyleEditor::use_saved_position = false;
|
|
||||||
|
|
|
@ -42,12 +42,14 @@
|
||||||
#include <wx/textctrl.h>
|
#include <wx/textctrl.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "colour_button.h"
|
#include <libaegisub/scoped_ptr.h>
|
||||||
|
|
||||||
namespace agi { struct Context; }
|
namespace agi { struct Context; }
|
||||||
class AssStyle;
|
class AssStyle;
|
||||||
class SubtitlesPreview;
|
|
||||||
class AssStyleStorage;
|
class AssStyleStorage;
|
||||||
|
class ColourButton;
|
||||||
|
class PersistLocation;
|
||||||
|
class SubtitlesPreview;
|
||||||
|
|
||||||
/// DOCME
|
/// DOCME
|
||||||
/// @class DialogStyleEditor
|
/// @class DialogStyleEditor
|
||||||
|
@ -56,6 +58,7 @@ class AssStyleStorage;
|
||||||
/// DOCME
|
/// DOCME
|
||||||
class DialogStyleEditor : public wxDialog {
|
class DialogStyleEditor : public wxDialog {
|
||||||
agi::Context *c;
|
agi::Context *c;
|
||||||
|
agi::scoped_ptr<PersistLocation> persist;
|
||||||
|
|
||||||
/// DOCME
|
/// DOCME
|
||||||
bool isLocal;
|
bool isLocal;
|
||||||
|
@ -143,15 +146,6 @@ class DialogStyleEditor : public wxDialog {
|
||||||
/// DOCME
|
/// DOCME
|
||||||
wxSizer *MainSizer;
|
wxSizer *MainSizer;
|
||||||
|
|
||||||
|
|
||||||
/// DOCME
|
|
||||||
static wxRect saved_position;
|
|
||||||
|
|
||||||
/// DOCME
|
|
||||||
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);
|
||||||
|
|
|
@ -375,6 +375,11 @@
|
||||||
"Language" : "en_US"
|
"Language" : "en_US"
|
||||||
},
|
},
|
||||||
"Style Editor" : {
|
"Style Editor" : {
|
||||||
|
"Last" : {
|
||||||
|
"X" : -1,
|
||||||
|
"Y" : -1
|
||||||
|
},
|
||||||
|
"Maximized" : false,
|
||||||
"Preview Text" : "Aegisub\\N0123 月語"
|
"Preview Text" : "Aegisub\\N0123 月語"
|
||||||
},
|
},
|
||||||
"Style Manager" : {
|
"Style Manager" : {
|
||||||
|
|
Loading…
Reference in a new issue