From c22e55b99a38d405fb79184106261229bd2d1855 Mon Sep 17 00:00:00 2001 From: krzys-h Date: Thu, 10 Jul 2014 16:52:29 +0200 Subject: Removed some unused code related to Quit button The button itself has been removed a long time ago --- src/ui/studio.cpp | 10 ---------- 1 file changed, 10 deletions(-) (limited to 'src/ui/studio.cpp') diff --git a/src/ui/studio.cpp b/src/ui/studio.cpp index f83704e..91e4ea2 100644 --- a/src/ui/studio.cpp +++ b/src/ui/studio.cpp @@ -573,10 +573,6 @@ void CStudio::StartEditScript(CScript *script, std::string name, int rank) m_bRealTime = m_bRunning; m_script->SetStepMode(!m_bRealTime); - button = static_cast< CButton* >(m_interface->SearchControl(EVENT_BUTTON_QUIT)); - 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); @@ -877,12 +873,6 @@ bool CStudio::StopEditScript(bool bCancel) m_interface->DeleteControl(EVENT_WINDOW3); - button = static_cast< CButton* >(m_interface->SearchControl(EVENT_BUTTON_QUIT)); - if ( button != 0 ) - { - button->SetState(STATE_VISIBLE); - } - m_pause->SetPause(m_bInitPause); m_sound->MuteAll(false); m_main->SetEditLock(false, true); -- cgit v1.2.3-1-g7c22 From c29ef4ec41cc062c4dbc14af8736c5e1c7c25f02 Mon Sep 17 00:00:00 2001 From: krzys-h Date: Sat, 27 Sep 2014 16:49:00 +0200 Subject: Fixed some warnings Removed unused variables and fixed signed/unsigned comparation warnings --- src/ui/studio.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'src/ui/studio.cpp') diff --git a/src/ui/studio.cpp b/src/ui/studio.cpp index 91e4ea2..52bb8d6 100644 --- a/src/ui/studio.cpp +++ b/src/ui/studio.cpp @@ -850,7 +850,6 @@ bool CStudio::StopEditScript(bool bCancel) { CWindow* pw; CEdit* edit; - CButton* button; pw = static_cast< CWindow* >(m_interface->SearchControl(EVENT_WINDOW3)); if ( pw == nullptr ) return false; -- cgit v1.2.3-1-g7c22 From 9fd6cf54492cedd7f6231a0b1d0655120cb1c4d7 Mon Sep 17 00:00:00 2001 From: krzys-h Date: Tue, 14 Oct 2014 15:11:37 +0200 Subject: Changed all occurences of PPC in the code to TerranovaTeam --- src/ui/studio.cpp | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) (limited to 'src/ui/studio.cpp') diff --git a/src/ui/studio.cpp b/src/ui/studio.cpp index 91e4ea2..6f3145f 100644 --- a/src/ui/studio.cpp +++ b/src/ui/studio.cpp @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012 Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "ui/studio.h" -- cgit v1.2.3-1-g7c22 From 0fb1cb11d4675f17023de43b3ffed6314ce31e8c Mon Sep 17 00:00:00 2001 From: krzys-h Date: Sun, 19 Oct 2014 13:33:19 +0200 Subject: Changed max and default font size Min font size is 9, max is now 24 (previously 21) Default size is now 19 (previously 9) Closes #330 --- src/ui/studio.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/ui/studio.cpp') diff --git a/src/ui/studio.cpp b/src/ui/studio.cpp index 6f3145f..5400265 100644 --- a/src/ui/studio.cpp +++ b/src/ui/studio.cpp @@ -169,7 +169,7 @@ bool CStudio::EventProcess(const Event &event) { slider = static_cast< CSlider* >(pw->SearchControl(EVENT_STUDIO_SIZE)); if ( slider == nullptr ) return false; - m_main->SetFontSize(9.0f+slider->GetVisibleValue()*12.0f); + m_main->SetFontSize(9.0f+slider->GetVisibleValue()*15.0f); ViewEditScript(); } @@ -636,7 +636,7 @@ void CStudio::StartEditScript(CScript *script, std::string name, int rank) button->SetState(STATE_SHADOW); slider = pw->CreateSlider(pos, dim, 0, EVENT_STUDIO_SIZE); slider->SetState(STATE_SHADOW); - slider->SetVisibleValue((m_main->GetFontSize()-9.0f)/6.0f); + slider->SetVisibleValue((m_main->GetFontSize()-9.0f)/15.0f); pw->CreateGroup(pos, dim, 19, EVENT_LABEL1); // SatCom logo button = pw->CreateButton(pos, dim, 128+57, EVENT_STUDIO_TOOL); button->SetState(STATE_SHADOW); -- cgit v1.2.3-1-g7c22 From c0ac60e4facfc9d7a588dd2a23fe548b7212975b Mon Sep 17 00:00:00 2001 From: krzys-h Date: Mon, 20 Oct 2014 21:15:39 +0200 Subject: Fixed save directories in things not yet refactored to use PHYSFS --- src/ui/studio.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ui/studio.cpp') diff --git a/src/ui/studio.cpp b/src/ui/studio.cpp index abe4e5c..01ffd6a 100644 --- a/src/ui/studio.cpp +++ b/src/ui/studio.cpp @@ -1533,7 +1533,7 @@ std::string CStudio::SearchDirectory(bool bCreate) } else { - sprintf(dir, "%s/%s/Program/", m_main->GetSavegameDir(), m_main->GetGamerName()); + sprintf(dir, "%s/%s/Program/", m_main->GetPHYSFSSavegameDir(), m_main->GetGamerName()); } fs::path path = fs::path(dir); -- cgit v1.2.3-1-g7c22 From f68e7df8d6d774c747a557719460b6d588588305 Mon Sep 17 00:00:00 2001 From: krzys-h Date: Wed, 29 Oct 2014 21:06:59 +0100 Subject: Fixed program saving (#352) --- src/ui/studio.cpp | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) (limited to 'src/ui/studio.cpp') diff --git a/src/ui/studio.cpp b/src/ui/studio.cpp index 01ffd6a..acfe720 100644 --- a/src/ui/studio.cpp +++ b/src/ui/studio.cpp @@ -24,6 +24,8 @@ #include "app/app.h" +#include "common/resources/resourcemanager.h" + #include "common/event.h" #include "common/misc.h" @@ -1523,8 +1525,8 @@ void CStudio::UpdateDialogList() // Constructs the name of the folder or open/save. // If the folder does not exist, it will be created. - -std::string CStudio::SearchDirectory(bool bCreate) +//TODO: Refactor to PHYSFS +std::string CStudio::SearchDirectory(bool bCreate, bool physfsReady) { char dir[MAX_FNAME]; if ( m_main->GetIOPublic() ) @@ -1533,17 +1535,21 @@ std::string CStudio::SearchDirectory(bool bCreate) } else { - sprintf(dir, "%s/%s/Program/", m_main->GetPHYSFSSavegameDir(), m_main->GetGamerName()); + sprintf(dir, "%s/%s/Program/", m_main->GetSavegameDir(), m_main->GetGamerName()); } - fs::path path = fs::path(dir); - if ( bCreate ) { - fs::create_directory(path); + fs::path path = fs::path(dir); + fs::create_directories(path); } - return path.make_preferred().string(); + std::string dir2 = dir; + if(physfsReady) { + boost::replace_all(dir2, CResourceManager::GetSaveLocation()+"/", ""); + } + CLogger::GetInstancePointer()->Debug("%s -> %s\n", dir, dir2.c_str()); + return dir2; } // Reads a new program. @@ -1569,7 +1575,7 @@ bool CStudio::ReadProgram() { strcat(filename, ".txt"); } - strcpy(dir, SearchDirectory(true).c_str()); + strcpy(dir, SearchDirectory(true, true).c_str()); strcat(dir, filename); pw = static_cast< CWindow* >(m_interface->SearchControl(EVENT_WINDOW3)); @@ -1607,7 +1613,7 @@ bool CStudio::WriteProgram() { strcat(filename, ".txt"); } - strcpy(dir, SearchDirectory(true).c_str()); + strcpy(dir, SearchDirectory(true, true).c_str()); strcat(dir, filename); pw = static_cast< CWindow* >(m_interface->SearchControl(EVENT_WINDOW3)); @@ -1615,6 +1621,8 @@ bool CStudio::WriteProgram() pe = static_cast< CEdit* >(pw->SearchControl(EVENT_STUDIO_EDIT)); if ( pe == nullptr ) return false; + CLogger::GetInstancePointer()->Debug("%s\n", dir); + if ( !pe->WriteText(std::string(dir)) ) return false; m_script->SetFilename(filename); -- cgit v1.2.3-1-g7c22 From d6d08797ca4559fef3e74d747b8dde55153d823e Mon Sep 17 00:00:00 2001 From: krzys-h Date: Wed, 29 Oct 2014 21:13:12 +0100 Subject: I forgot to remove some debug stuff --- src/ui/studio.cpp | 3 --- 1 file changed, 3 deletions(-) (limited to 'src/ui/studio.cpp') diff --git a/src/ui/studio.cpp b/src/ui/studio.cpp index acfe720..93fd050 100644 --- a/src/ui/studio.cpp +++ b/src/ui/studio.cpp @@ -1548,7 +1548,6 @@ std::string CStudio::SearchDirectory(bool bCreate, bool physfsReady) if(physfsReady) { boost::replace_all(dir2, CResourceManager::GetSaveLocation()+"/", ""); } - CLogger::GetInstancePointer()->Debug("%s -> %s\n", dir, dir2.c_str()); return dir2; } @@ -1620,8 +1619,6 @@ bool CStudio::WriteProgram() if ( pw == nullptr ) return false; pe = static_cast< CEdit* >(pw->SearchControl(EVENT_STUDIO_EDIT)); if ( pe == nullptr ) return false; - - CLogger::GetInstancePointer()->Debug("%s\n", dir); if ( !pe->WriteText(std::string(dir)) ) return false; -- cgit v1.2.3-1-g7c22 From 11a874207935f86248c0b9034a11b415ee14b1cf Mon Sep 17 00:00:00 2001 From: krzys-h Date: Sat, 1 Nov 2014 14:02:39 +0100 Subject: #335, #348, #352 I don't know what I'm doing anymore :/ I should set up dev envrioment on Windows so I don't have to commit every time I want somebody on Windows to test if my changes work --- src/ui/studio.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/ui/studio.cpp') diff --git a/src/ui/studio.cpp b/src/ui/studio.cpp index 93fd050..efdbbbc 100644 --- a/src/ui/studio.cpp +++ b/src/ui/studio.cpp @@ -1546,7 +1546,10 @@ std::string CStudio::SearchDirectory(bool bCreate, bool physfsReady) std::string dir2 = dir; if(physfsReady) { - boost::replace_all(dir2, CResourceManager::GetSaveLocation()+"/", ""); + std::string savedir = CResourceManager::GetSaveLocation()+"/"; + boost::replace_all(dir2, "\\", "/"); + boost::replace_all(savedir, "\\", "/"); + boost::replace_all(dir2, savedir, ""); } return dir2; } -- cgit v1.2.3-1-g7c22