Made detached video window remember its last position/maximized state - #492

Originally committed to SVN as r1692.
This commit is contained in:
Rodrigo Braz Monteiro 2008-01-12 03:29:45 +00:00
parent 30fc5aa32f
commit 8a6f04512b
3 changed files with 24 additions and 3 deletions

View File

@ -55,6 +55,12 @@ DialogDetachedVideo::DialogDetachedVideo(FrameMain *par)
// Set parent
parent = par;
// Set up window
int x = Options.AsInt(_T("Detached video last x"));
int y = Options.AsInt(_T("Detached video last y"));
if (x != -1 && y != -1) SetPosition(wxPoint(x,y));
if (Options.AsBool(_T("Detached video maximized"))) Maximize();
// Set obscure stuff
SetExtraStyle(GetExtraStyle() & (~wxWS_EX_BLOCK_EVENTS) | wxWS_EX_PROCESS_UI_UPDATES);
@ -85,6 +91,8 @@ DialogDetachedVideo::DialogDetachedVideo(FrameMain *par)
/////////////
// Destructor
DialogDetachedVideo::~DialogDetachedVideo() {
Options.SetBool(_T("Detached video maximized"),IsMaximized());
Options.Save();
}
@ -93,6 +101,7 @@ DialogDetachedVideo::~DialogDetachedVideo() {
BEGIN_EVENT_TABLE(DialogDetachedVideo,wxDialog)
EVT_KEY_DOWN(DialogDetachedVideo::OnKey)
EVT_CLOSE(DialogDetachedVideo::OnClose)
EVT_MOVE(DialogDetachedVideo::OnMove)
END_EVENT_TABLE()
@ -109,9 +118,17 @@ void DialogDetachedVideo::OnKey(wxKeyEvent &event) {
// Close window
void DialogDetachedVideo::OnClose(wxCloseEvent &event) {
FrameMain *par = parent;
Options.SetBool(_T("Detached video"),false);
Destroy();
par->detachedVideo = NULL;
par->SetDisplayMode(-1,-1);
Options.SetBool(_T("Detached video"),false);
Options.Save();
}
///////////////
// Move window
void DialogDetachedVideo::OnMove(wxMoveEvent &event) {
wxPoint pos = event.GetPosition();
Options.SetInt(_T("Detached video last x"),pos.x);
Options.SetInt(_T("Detached video last y"),pos.y);
}

View File

@ -55,6 +55,7 @@ private:
void OnKey(wxKeyEvent &event);
void OnClose(wxCloseEvent &event);
void OnMove(wxMoveEvent &event);
public:
DialogDetachedVideo(FrameMain *parent);

View File

@ -148,7 +148,6 @@ void OptionsManager::LoadDefaults(bool onlyDefaults) {
SetModificationType(MOD_VIDEO);
SetBool(_T("Show keyframes on video slider"),true);
SetBool(_T("Show overscan mask"),false);
SetBool(_T("Detached video"),false);
// Video Provider (Advanced)
SetModificationType(MOD_VIDEO_RELOAD);
@ -333,6 +332,10 @@ void OptionsManager::LoadDefaults(bool onlyDefaults) {
SetInt(_T("Audio Sample Rate"),0);
SetBool(_T("Video Visual Realtime"),true);
SetBool(_T("Detached video"),false);
SetInt(_T("Detached video last x"),-1);
SetInt(_T("Detached video last y"),-1);
SetBool(_T("Detached video maximized"),false);
SetInt(_T("Timing processor key start before thres"),5);
SetInt(_T("Timing processor key start after thres"),4);