From 8deb1305726966b3b583865dec1ba7ba1327d8cb Mon Sep 17 00:00:00 2001 From: Piotr Dziwinski Date: Tue, 3 Dec 2013 00:11:26 +0100 Subject: Changed char[] to std::string in restext Experimental changes --- src/ui/studio.cpp | 48 ++++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-) (limited to 'src/ui/studio.cpp') diff --git a/src/ui/studio.cpp b/src/ui/studio.cpp index e44a465..ba28a0a 100644 --- a/src/ui/studio.cpp +++ b/src/ui/studio.cpp @@ -97,7 +97,6 @@ bool CStudio::EventProcess(const Event &event) CWindow* pw; CEdit* edit; CSlider* slider; - char res[100]; if ( m_dialog != SD_NULL ) // dialogue exists? { @@ -184,17 +183,17 @@ bool CStudio::EventProcess(const Event &event) if ( event.type == EVENT_STUDIO_COMPILE ) // compile? { - char buffer[100]; - if ( m_script->GetScript(edit) ) // compile { + std::string res; GetResource(RES_TEXT, RT_STUDIO_COMPOK, res); SetInfoText(res, false); } else { - m_script->GetError(buffer); - SetInfoText(buffer, false); + std::string error; + m_script->GetError(error); + SetInfoText(error, false); } } @@ -218,9 +217,9 @@ bool CStudio::EventProcess(const Event &event) } else { - char buffer[100]; - m_script->GetError(buffer); - SetInfoText(buffer, false); + std::string error; + m_script->GetError(error); + SetInfoText(error, false); } } } @@ -344,7 +343,6 @@ bool CStudio::EventFrame(const Event &event) CList* list; float time; int cursor1, cursor2, iCursor1, iCursor2; - char res[100]; m_time += event.rTime; m_fixInfoTextTime -= event.rTime; @@ -363,6 +361,7 @@ bool CStudio::EventFrame(const Event &event) m_bRunning = false; UpdateFlux(); // stop AdjustEditScript(); + std::string res; GetResource(RES_TEXT, RT_STUDIO_PROGSTOP, res); SetInfoText(res, false); @@ -558,7 +557,6 @@ void CStudio::StartEditScript(CScript *script, std::string name, int rank) CButton* button; CSlider* slider; CList* list; - char res[100]; m_script = script; m_rank = rank; @@ -575,28 +573,33 @@ void CStudio::StartEditScript(CScript *script, std::string name, int rank) m_script->SetStepMode(!m_bRealTime); button = static_cast< CButton* >(m_interface->SearchControl(EVENT_BUTTON_QUIT)); - if ( button != 0 ) - { + if (button != nullptr) button->ClearState(STATE_VISIBLE); - } pos = m_editFinalPos = m_editActualPos = m_main->GetWindowPos(); dim = m_editFinalDim = m_editActualDim = m_main->GetWindowDim(); pw = m_interface->CreateWindows(pos, dim, 8, EVENT_WINDOW3); - if ( pw == nullptr ) return; + if (pw == nullptr) + return; + pw->SetState(STATE_SHADOW); pw->SetRedim(true); // before SetName! pw->SetMovable(true); pw->SetClosable(true); + + std::string res; GetResource(RES_TEXT, RT_STUDIO_TITLE, res); pw->SetName(res); + pw->SetMinDim(Math::Point(0.49f, 0.50f)); pw->SetMaximized(m_bEditMaximized); pw->SetMinimized(m_bEditMinimized); m_main->SetEditFull(m_bEditMaximized); edit = pw->CreateEdit(pos, dim, 0, EVENT_STUDIO_EDIT); - if ( edit == 0 ) return; + if (edit == nullptr) + return; + edit->SetState(STATE_SHADOW); edit->SetInsideScroll(false); //? if ( m_bRunning ) edit->SetEdit(false); @@ -851,7 +854,6 @@ bool CStudio::StopEditScript(bool bCancel) CWindow* pw; CEdit* edit; CButton* button; - char buffer[100]; pw = static_cast< CWindow* >(m_interface->SearchControl(EVENT_WINDOW3)); if ( pw == nullptr ) return false; @@ -863,8 +865,9 @@ bool CStudio::StopEditScript(bool bCancel) { if ( !m_script->GetScript(edit) ) // compile { - m_script->GetError(buffer); - SetInfoText(buffer, false); + std::string error; + m_script->GetError(error); + SetInfoText(error, false); return false; } } @@ -892,8 +895,6 @@ bool CStudio::StopEditScript(bool bCancel) void CStudio::SetInfoText(std::string text, bool bClickable) { - char res[100]; - if ( bClickable && m_fixInfoTextTime > 0.0f ) return; if ( !bClickable ) m_fixInfoTextTime = 8.0f; @@ -911,6 +912,7 @@ void CStudio::SetInfoText(std::string text, bool bClickable) if ( bClickable ) { + std::string res; GetResource(RES_TEXT, RT_STUDIO_LISTTT, res); list->SetTooltip(res); list->SetState(STATE_ENABLE); @@ -1029,7 +1031,7 @@ void CStudio::StartDialog(StudioDialog type) CList* pli; CEdit* pe; Math::Point pos, dim; - char name[100]; + std::string name; m_dialog = type; @@ -1476,8 +1478,6 @@ void CStudio::UpdateDialogPublic() CWindow* pw; CCheck* pc; CLabel* pl; - char name[100]; - //char text[MAX_FNAME+100]; pw = static_cast< CWindow* >(m_interface->SearchControl(EVENT_WINDOW9)); if ( pw == nullptr ) return; @@ -1497,7 +1497,7 @@ void CStudio::UpdateDialogPublic() pl = static_cast< CLabel* >(pw->SearchControl(EVENT_DIALOG_LABEL1)); if ( pl != 0 ) { - GetResource(RES_TEXT, RT_IO_LIST, name); + //? GetResource(RES_TEXT, RT_IO_LIST, name); pl->SetName(SearchDirectory(false).c_str(), false); } } -- cgit v1.2.3-1-g7c22