Fix moving and resizing open/save dialog
* Fixed buffer overflow when resizing * Stop hard drive thrashing when moving/resizing1008-fix
parent
2d2990ff91
commit
86870167a6
|
@ -579,6 +579,8 @@ void CStudio::StartEditScript(CScript *script, std::string name, Program* progra
|
||||||
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW6));
|
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW6));
|
||||||
if (pw != nullptr) pw->ClearState(STATE_VISIBLE | STATE_ENABLE);
|
if (pw != nullptr) pw->ClearState(STATE_VISIBLE | STATE_ENABLE);
|
||||||
|
|
||||||
|
m_dialogPos = m_settings->GetIOPos();
|
||||||
|
m_dialogDim = m_settings->GetIODim();
|
||||||
m_windowPos = m_settings->GetWindowPos();
|
m_windowPos = m_settings->GetWindowPos();
|
||||||
m_windowDim = m_settings->GetWindowDim();
|
m_windowDim = m_settings->GetWindowDim();
|
||||||
m_bEditMaximized = m_settings->GetWindowMax();
|
m_bEditMaximized = m_settings->GetWindowMax();
|
||||||
|
@ -930,6 +932,8 @@ bool CStudio::StopEditScript(bool closeWithErrors)
|
||||||
m_main->SetEditLock(false, true);
|
m_main->SetEditLock(false, true);
|
||||||
m_camera->SetType(m_editCamera);
|
m_camera->SetType(m_editCamera);
|
||||||
|
|
||||||
|
m_settings->SetIOPos(m_dialogPos);
|
||||||
|
m_settings->SetIODim(m_dialogDim);
|
||||||
m_settings->SetWindowPos(m_windowPos);
|
m_settings->SetWindowPos(m_windowPos);
|
||||||
m_settings->SetWindowDim(m_windowDim);
|
m_settings->SetWindowDim(m_windowDim);
|
||||||
m_settings->SetWindowMax(m_bEditMaximized);
|
m_settings->SetWindowMax(m_bEditMaximized);
|
||||||
|
@ -1272,8 +1276,8 @@ void CStudio::AdjustDialog()
|
||||||
pw = static_cast< CWindow* >(m_interface->SearchControl(EVENT_WINDOW9));
|
pw = static_cast< CWindow* >(m_interface->SearchControl(EVENT_WINDOW9));
|
||||||
if ( pw == nullptr ) return;
|
if ( pw == nullptr ) return;
|
||||||
|
|
||||||
wpos = pw->GetPos();
|
m_dialogPos = wpos = pw->GetPos();
|
||||||
wdim = pw->GetDim();
|
m_dialogDim = wdim = pw->GetDim();
|
||||||
pw->SetPos(wpos); // to move the buttons on the titlebar
|
pw->SetPos(wpos); // to move the buttons on the titlebar
|
||||||
|
|
||||||
if ( m_dialog == SD_OPEN ||
|
if ( m_dialog == SD_OPEN ||
|
||||||
|
@ -1323,10 +1327,9 @@ void CStudio::AdjustDialog()
|
||||||
pe->SetPos(ppos);
|
pe->SetPos(ppos);
|
||||||
pe->SetDim(ddim);
|
pe->SetDim(ddim);
|
||||||
|
|
||||||
nch = static_cast< int >((ddim.x*640.0f-22.0f)/8.0f);
|
nch = static_cast< int >((ddim.x*640.0f-22.0f)/5.75f);
|
||||||
name = pe->GetText(100);
|
name = pe->GetText(nch); // truncates the text according to max
|
||||||
pe->SetMaxChar(nch);
|
pe->SetMaxChar(nch);
|
||||||
name[nch] = 0; // truncates the text according to max
|
|
||||||
pe->SetText(name);
|
pe->SetText(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1384,19 +1387,10 @@ void CStudio::AdjustDialog()
|
||||||
|
|
||||||
bool CStudio::EventDialog(const Event &event)
|
bool CStudio::EventDialog(const Event &event)
|
||||||
{
|
{
|
||||||
CWindow* pw;
|
|
||||||
Math::Point wpos, wdim;
|
|
||||||
|
|
||||||
pw = static_cast< CWindow* >(m_interface->SearchControl(EVENT_WINDOW9));
|
|
||||||
if ( pw == nullptr ) return false;
|
|
||||||
|
|
||||||
if ( event.type == EVENT_WINDOW9 ) // window is moved?
|
if ( event.type == EVENT_WINDOW9 ) // window is moved?
|
||||||
{
|
{
|
||||||
wpos = pw->GetPos();
|
|
||||||
wdim = pw->GetDim();
|
|
||||||
m_settings->SetIOPos(wpos);
|
|
||||||
m_settings->SetIODim(wdim);
|
|
||||||
AdjustDialog();
|
AdjustDialog();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( m_dialog == SD_OPEN ||
|
if ( m_dialog == SD_OPEN ||
|
||||||
|
@ -1441,6 +1435,9 @@ bool CStudio::EventDialog(const Event &event)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CWindow* pw = static_cast< CWindow* >(m_interface->SearchControl(EVENT_WINDOW9));
|
||||||
|
if ( pw == nullptr ) return false;
|
||||||
|
|
||||||
if ( event.type == EVENT_DIALOG_CANCEL ||
|
if ( event.type == EVENT_DIALOG_CANCEL ||
|
||||||
(event.type == EVENT_KEY_DOWN && event.GetData<KeyEventData>()->key == KEY(ESCAPE)) ||
|
(event.type == EVENT_KEY_DOWN && event.GetData<KeyEventData>()->key == KEY(ESCAPE)) ||
|
||||||
event.type == pw->GetEventTypeClose() )
|
event.type == pw->GetEventTypeClose() )
|
||||||
|
|
|
@ -110,6 +110,8 @@ protected:
|
||||||
Math::Point m_editFinalDim;
|
Math::Point m_editFinalDim;
|
||||||
Math::Point m_windowPos;
|
Math::Point m_windowPos;
|
||||||
Math::Point m_windowDim;
|
Math::Point m_windowDim;
|
||||||
|
Math::Point m_dialogPos;
|
||||||
|
Math::Point m_dialogDim;
|
||||||
|
|
||||||
float m_time;
|
float m_time;
|
||||||
float m_fixInfoTextTime;
|
float m_fixInfoTextTime;
|
||||||
|
|
Loading…
Reference in New Issue