summaryrefslogtreecommitdiffstats
path: root/src/ui
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/README.txt1
-rw-r--r--src/ui/button.cpp1
-rw-r--r--src/ui/button.h1
-rw-r--r--src/ui/check.cpp1
-rw-r--r--src/ui/color.cpp1
-rw-r--r--src/ui/color.h1
-rw-r--r--src/ui/compass.cpp1
-rw-r--r--src/ui/compass.h1
-rw-r--r--src/ui/control.cpp17
-rw-r--r--src/ui/control.h1
-rw-r--r--src/ui/displayinfo.cpp1
-rw-r--r--src/ui/displayinfo.h1
-rw-r--r--src/ui/displaytext.cpp1
-rw-r--r--src/ui/edit.cpp108
-rw-r--r--src/ui/edit.h3
-rw-r--r--src/ui/editvalue.cpp1
-rw-r--r--src/ui/editvalue.h1
-rw-r--r--src/ui/gauge.cpp1
-rw-r--r--src/ui/gauge.h23
-rw-r--r--src/ui/group.cpp1
-rw-r--r--src/ui/group.h1
-rw-r--r--src/ui/image.cpp1
-rw-r--r--src/ui/image.h1
-rw-r--r--src/ui/interface.cpp30
-rw-r--r--src/ui/interface.h83
-rw-r--r--src/ui/key.cpp1
-rw-r--r--src/ui/label.cpp4
-rw-r--r--src/ui/label.h13
-rw-r--r--src/ui/list.cpp164
-rw-r--r--src/ui/list.h1
-rw-r--r--src/ui/maindialog.cpp221
-rw-r--r--src/ui/maindialog.h2
-rw-r--r--src/ui/mainmap.cpp17
-rw-r--r--src/ui/mainmap.h62
-rw-r--r--src/ui/mainshort.h47
-rw-r--r--src/ui/map.cpp45
-rw-r--r--src/ui/map.h143
-rw-r--r--src/ui/scroll.cpp1
-rw-r--r--src/ui/scroll.h65
-rw-r--r--src/ui/shortcut.cpp1
-rw-r--r--src/ui/shortcut.h21
-rw-r--r--src/ui/slider.cpp1
-rw-r--r--src/ui/slider.h69
-rw-r--r--src/ui/studio.cpp28
-rw-r--r--src/ui/target.cpp1
-rw-r--r--src/ui/target.h19
-rw-r--r--src/ui/window.cpp1
-rw-r--r--src/ui/window.h1
48 files changed, 715 insertions, 496 deletions
diff --git a/src/ui/README.txt b/src/ui/README.txt
index a159ed5..05f72a1 100644
--- a/src/ui/README.txt
+++ b/src/ui/README.txt
@@ -2,3 +2,4 @@
* \dir src/ui
* \brief 2D user interface controls
*/
+
diff --git a/src/ui/button.cpp b/src/ui/button.cpp
index a68b34d..348382d 100644
--- a/src/ui/button.cpp
+++ b/src/ui/button.cpp
@@ -245,3 +245,4 @@ bool CButton::GetRepeat()
}
}
+
diff --git a/src/ui/button.h b/src/ui/button.h
index a9aa020..b71ef4a 100644
--- a/src/ui/button.h
+++ b/src/ui/button.h
@@ -51,3 +51,4 @@ protected:
};
}
+
diff --git a/src/ui/check.cpp b/src/ui/check.cpp
index 761264d..362c930 100644
--- a/src/ui/check.cpp
+++ b/src/ui/check.cpp
@@ -163,3 +163,4 @@ void CCheck::Draw()
}
}
+
diff --git a/src/ui/color.cpp b/src/ui/color.cpp
index fd05bd9..623ff89 100644
--- a/src/ui/color.cpp
+++ b/src/ui/color.cpp
@@ -223,3 +223,4 @@ Gfx::Color CColor::GetColor()
}
+
diff --git a/src/ui/color.h b/src/ui/color.h
index ec2c537..fe96b87 100644
--- a/src/ui/color.h
+++ b/src/ui/color.h
@@ -54,3 +54,4 @@ protected:
};
}
+
diff --git a/src/ui/compass.cpp b/src/ui/compass.cpp
index ac97cb8..d0fe96f 100644
--- a/src/ui/compass.cpp
+++ b/src/ui/compass.cpp
@@ -171,3 +171,4 @@ float CCompass::GetDirection()
}
+
diff --git a/src/ui/compass.h b/src/ui/compass.h
index 18546e5..956631a 100644
--- a/src/ui/compass.h
+++ b/src/ui/compass.h
@@ -49,3 +49,4 @@ protected:
}
+
diff --git a/src/ui/control.cpp b/src/ui/control.cpp
index 6dc92cd..7c77c95 100644
--- a/src/ui/control.cpp
+++ b/src/ui/control.cpp
@@ -75,10 +75,13 @@ bool CControl::Create(Math::Point pos, Math::Point dim, int icon, EventType even
GetResource(RES_EVENT, m_eventType, text);
str_text = std::string(text);
auto p = str_text.find("\\");
- if ( p == std::string::npos ) {
+ if ( p == std::string::npos )
+ {
if ( icon != -1 )
m_tooltip = str_text;
- } else {
+ }
+ else
+ {
m_tooltip = str_text.substr(p + 1);
}
@@ -174,15 +177,18 @@ int CControl::GetIcon()
void CControl::SetName(std::string name, bool bTooltip)
{
- if ( bTooltip ) {
+ if ( bTooltip )
+ {
auto p = name.find("\\");
if ( p == std::string::npos )
m_name = name;
- else {
+ else
+ {
m_tooltip = name.substr(p + 1);
m_name = name.substr(0, p);
}
- } else
+ }
+ else
m_name = name;
}
@@ -832,3 +838,4 @@ bool CControl::Detect(Math::Point pos)
}
}
+
diff --git a/src/ui/control.h b/src/ui/control.h
index 7f5077d..aee7d1c 100644
--- a/src/ui/control.h
+++ b/src/ui/control.h
@@ -141,3 +141,4 @@ protected:
};
} // namespace Ui
+
diff --git a/src/ui/displayinfo.cpp b/src/ui/displayinfo.cpp
index f83ff5a..3aa3d73 100644
--- a/src/ui/displayinfo.cpp
+++ b/src/ui/displayinfo.cpp
@@ -1214,3 +1214,4 @@ void CDisplayInfo::CreateObjectsFile()
}
+
diff --git a/src/ui/displayinfo.h b/src/ui/displayinfo.h
index ab42d62..eea50b7 100644
--- a/src/ui/displayinfo.h
+++ b/src/ui/displayinfo.h
@@ -95,3 +95,4 @@ protected:
} // namespace Ui
+
diff --git a/src/ui/displaytext.cpp b/src/ui/displaytext.cpp
index 630b385..d88674a 100644
--- a/src/ui/displaytext.cpp
+++ b/src/ui/displaytext.cpp
@@ -606,3 +606,4 @@ CObject* CDisplayText::SearchToto()
}
}
+
diff --git a/src/ui/edit.cpp b/src/ui/edit.cpp
index c9831dd..6fd1735 100644
--- a/src/ui/edit.cpp
+++ b/src/ui/edit.cpp
@@ -263,7 +263,7 @@ bool CEdit::EventProcess(const Event &event)
if ( event.type == EVENT_MOUSE_MOVE )
{
- if ( Detect(event.mousePos) &&
+ if ( Detect(event.mousePos) &&
event.mousePos.x < m_pos.x+m_dim.x-(m_bMulti?MARGX+SCROLL_WIDTH:0.0f) )
{
if ( m_bEdit )
@@ -782,13 +782,16 @@ void CEdit::HyperJump(std::string name, std::string marker)
sMarker = marker;
//? sprintf(filename, "help\\%s.txt", name);
-
- if ( name[0] == '%' ) {
+
+ if ( name[0] == '%' )
+ {
filename = GetProfile().GetUserBasedPath(name, "") + ".txt";
- } else {
+ }
+ else
+ {
filename = std::string("help/") + CApplication::GetInstancePointer()->GetLanguageChar() + "/" + name + std::string(".txt");
}
-
+
if ( ReadText(filename) )
{
Justif();
@@ -1249,7 +1252,7 @@ void CEdit::SetText(const char *text, bool bNew)
{
int i, j, font;
bool bBOL;
-
+
if ( !bNew ) UndoMemorize(OPERUNDO_SPEC);
m_len = strlen(text);
@@ -1387,10 +1390,11 @@ int CEdit::GetTextLength()
std::string GetNameParam(std::string cmd, int rank)
{
- std::vector<std::string> results;
+ std::vector<std::string> results;
boost::split(results, cmd, boost::is_any_of(" ;"));
-
- if (results.size() > static_cast<unsigned int>(rank)) {
+
+ if (results.size() > static_cast<unsigned int>(rank))
+ {
return results.at(rank);
}
@@ -1402,11 +1406,12 @@ std::string GetNameParam(std::string cmd, int rank)
int GetValueParam(std::string cmd, int rank)
{
- std::vector<std::string> results;
+ std::vector<std::string> results;
boost::split(results, cmd, boost::is_any_of(" ;"));
int return_value = 0;
-
- if (results.size() > static_cast<unsigned int>(rank)) {
+
+ if (results.size() > static_cast<unsigned int>(rank))
+ {
return_value = atoi(results.at(rank).c_str());
}
@@ -1419,7 +1424,8 @@ void CEdit::FreeImage()
{
std::string filename;
- for (int i = 0 ; i < m_imageTotal; i++ ) {
+ for (int i = 0 ; i < m_imageTotal; i++ )
+ {
filename = GetProfile().GetUserBasedPath(m_image[i].name, "diagram") + ".png";
m_engine->DeleteTexture(filename);
}
@@ -1448,12 +1454,14 @@ bool CEdit::ReadText(std::string filename, int addSize)
bool bInSoluce, bBOL;
if ( filename[0] == 0 ) return false;
+
boost::replace_all(filename, "\\", "/");
-
+
/* This is ugly but doesn't require many changes in code. If file doesn't
exists it's posible filename is absolute not full path */
std::string path = filename;
- if (!fs::exists(path)) {
+ if (!fs::exists(path))
+ {
path = CApplication::GetInstancePointer()->GetDataDirPath() + "/" + filename;
}
@@ -1484,10 +1492,11 @@ bool CEdit::ReadText(std::string filename, int addSize)
m_format.clear();
m_format.reserve(m_maxChar+1);
- for (i = 0; i <= m_maxChar+1; i++) {
+ for (i = 0; i <= m_maxChar+1; i++)
+ {
m_format.push_back(0);
}
-
+
fclose(file);
bInSoluce = false;
@@ -1951,7 +1960,8 @@ void CEdit::SetMaxChar(int max)
m_format.clear();
m_format.reserve(m_maxChar+1);
- for (int i = 0; i <= m_maxChar+1; i++) {
+ for (int i = 0; i <= m_maxChar+1; i++)
+ {
m_format.push_back(0);
}
@@ -2142,10 +2152,12 @@ bool CEdit::GetDisplaySpec()
void CEdit::SetMultiFont(bool bMulti)
{
m_format.clear();
-
- if (bMulti) {
+
+ if (bMulti)
+ {
m_format.reserve(m_maxChar+1);
- for (int i = 0; i <= m_maxChar+1; i++) {
+ for (int i = 0; i <= m_maxChar+1; i++)
+ {
m_format.push_back(0);
}
}
@@ -2522,26 +2534,33 @@ bool CEdit::Copy(bool memorize_cursor)
c1 = m_cursor1;
c2 = m_cursor2;
- if ( c1 > c2 ) {
+ if ( c1 > c2 )
+ {
Math::Swap(c1, c2); // always c1 <= c2
}
- if ( c1 == c2 ) {
- while ( c1 > 0 ) {
- if ( m_text[c1 - 1] == '\n' ) {
+ if ( c1 == c2 )
+ {
+ while ( c1 > 0 )
+ {
+ if ( m_text[c1 - 1] == '\n' )
+ {
break;
}
c1--;
}
- while ( c2 < m_len ) {
+ while ( c2 < m_len )
+ {
c2++;
- if ( m_text[c2 - 1] == '\n' ) {
+ if ( m_text[c2 - 1] == '\n' )
+ {
break;
}
}
}
- if ( c1 == c2 ) {
+ if ( c1 == c2 )
+ {
return false;
}
@@ -2553,8 +2572,9 @@ bool CEdit::Copy(bool memorize_cursor)
text[len] = 0;
widgetSetClipboardText(text);
delete []text;
-
- if (memorize_cursor) {
+
+ if (memorize_cursor)
+ {
m_cursor1 = c1;
m_cursor2 = c2;
}
@@ -2569,28 +2589,33 @@ bool CEdit::Paste()
char c;
char* text;
- if ( !m_bEdit ) {
+ if ( !m_bEdit )
+ {
return false;
}
text = widgetGetClipboardText();
-
- if ( text == nullptr ) {
+
+ if ( text == nullptr )
+ {
return false;
}
UndoMemorize(OPERUNDO_SPEC);
- for ( unsigned int i = 0; i < strlen(text); i++ ) {
+ for ( unsigned int i = 0; i < strlen(text); i++ )
+ {
c = text[i];
- if ( c == '\r' ) {
+ if ( c == '\r' )
+ {
continue;
}
- if ( c == '\t' && m_bAutoIndent ) {
+ if ( c == '\t' && m_bAutoIndent )
+ {
continue;
}
InsertOne(c);
}
-
+
free(text);
Justif();
ColumnFix();
@@ -2603,7 +2628,8 @@ bool CEdit::Paste()
bool CEdit::Undo()
{
- if ( !m_bEdit ) {
+ if ( !m_bEdit )
+ {
return false;
}
@@ -2617,7 +2643,8 @@ void CEdit::Insert(char character)
{
int i, level, tab;
- if ( !m_bEdit ) {
+ if ( !m_bEdit )
+ {
return;
}
@@ -3219,7 +3246,7 @@ bool CEdit::SetFormat(int cursor1, int cursor2, int format)
void CEdit::UpdateScroll()
{
float value;
-
+
if ( m_scroll != nullptr )
{
if ( m_lineTotal <= m_lineVisible )
@@ -3243,3 +3270,4 @@ void CEdit::UpdateScroll()
}
}
+
diff --git a/src/ui/edit.h b/src/ui/edit.h
index df4f143..acdf72c 100644
--- a/src/ui/edit.h
+++ b/src/ui/edit.h
@@ -239,7 +239,7 @@ protected:
void UndoFlush();
void UndoMemorize(OperUndo oper);
bool UndoRecall();
-
+
void UpdateScroll();
protected:
@@ -294,3 +294,4 @@ protected:
}
+
diff --git a/src/ui/editvalue.cpp b/src/ui/editvalue.cpp
index 6397a73..3fb9b79 100644
--- a/src/ui/editvalue.cpp
+++ b/src/ui/editvalue.cpp
@@ -369,3 +369,4 @@ float CEditValue::GetMaxValue()
}
}
+
diff --git a/src/ui/editvalue.h b/src/ui/editvalue.h
index 5d6e643..2734847 100644
--- a/src/ui/editvalue.h
+++ b/src/ui/editvalue.h
@@ -85,3 +85,4 @@ protected:
}
+
diff --git a/src/ui/gauge.cpp b/src/ui/gauge.cpp
index c98e3b6..a8ee41c 100644
--- a/src/ui/gauge.cpp
+++ b/src/ui/gauge.cpp
@@ -144,3 +144,4 @@ float CGauge::GetLevel()
}
+
diff --git a/src/ui/gauge.h b/src/ui/gauge.h
index a2b689a..3dbeef8 100644
--- a/src/ui/gauge.h
+++ b/src/ui/gauge.h
@@ -31,24 +31,23 @@ namespace Ui {
class CGauge : public CControl
{
- public:
- CGauge();
- virtual ~CGauge();
+public:
+ CGauge();
+ virtual ~CGauge();
- bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventType);
+ bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventType);
- bool EventProcess(const Event &event);
+ bool EventProcess(const Event &event);
- void Draw();
+ void Draw();
- void SetLevel(float level);
- float GetLevel();
+ void SetLevel(float level);
+ float GetLevel();
- protected:
-
- protected:
- float m_level;
+protected:
+ float m_level;
};
}
+
diff --git a/src/ui/group.cpp b/src/ui/group.cpp
index c3c7028..908ac19 100644
--- a/src/ui/group.cpp
+++ b/src/ui/group.cpp
@@ -639,3 +639,4 @@ void CGroup::Draw()
}
+
diff --git a/src/ui/group.h b/src/ui/group.h
index fd31716..89996cc 100644
--- a/src/ui/group.h
+++ b/src/ui/group.h
@@ -46,3 +46,4 @@ protected:
}
+
diff --git a/src/ui/image.cpp b/src/ui/image.cpp
index 94b9586..9a14789 100644
--- a/src/ui/image.cpp
+++ b/src/ui/image.cpp
@@ -151,3 +151,4 @@ void CImage::Draw()
}
+
diff --git a/src/ui/image.h b/src/ui/image.h
index c40828c..fd71e33 100644
--- a/src/ui/image.h
+++ b/src/ui/image.h
@@ -52,3 +52,4 @@ protected:
}
+
diff --git a/src/ui/interface.cpp b/src/ui/interface.cpp
index 893cd05..845579e 100644
--- a/src/ui/interface.cpp
+++ b/src/ui/interface.cpp
@@ -47,8 +47,10 @@ CInterface::~CInterface()
void CInterface::Flush()
{
- for (int i = 0; i < MAXCONTROL; i++ ) {
- if ( m_table[i] != nullptr ) {
+ for (int i = 0; i < MAXCONTROL; i++ )
+ {
+ if ( m_table[i] != nullptr )
+ {
delete m_table[i];
m_table[i] = nullptr;
}
@@ -58,7 +60,8 @@ void CInterface::Flush()
int CInterface::GetNextFreeControl()
{
- for (int i = 10; i < MAXCONTROL-1; i++) {
+ for (int i = 10; i < MAXCONTROL-1; i++)
+ {
if (m_table[i] == nullptr)
return i;
}
@@ -92,7 +95,8 @@ CWindow* CInterface::CreateWindows(Math::Point pos, Math::Point dim, int icon, E
if (eventMsg == EVENT_NULL)
eventMsg = GetUniqueEventType();
- switch (eventMsg) {
+ switch (eventMsg)
+ {
case EVENT_WINDOW0: index = 0; break;
case EVENT_WINDOW1: index = 1; break;
case EVENT_WINDOW2: index = 2; break;
@@ -249,9 +253,12 @@ CMap* CInterface::CreateMap(Math::Point pos, Math::Point dim, int icon, EventTyp
bool CInterface::DeleteControl(EventType eventMsg)
{
- for (int i = 0; i < MAXCONTROL; i++) {
- if ( m_table[i] != nullptr ) {
- if (eventMsg == m_table[i]->GetEventType()) {
+ for (int i = 0; i < MAXCONTROL; i++)
+ {
+ if ( m_table[i] != nullptr )
+ {
+ if (eventMsg == m_table[i]->GetEventType())
+ {
delete m_table[i];
m_table[i] = nullptr;
return true;
@@ -265,8 +272,10 @@ bool CInterface::DeleteControl(EventType eventMsg)
CControl* CInterface::SearchControl(EventType eventMsg)
{
- for (int i = 0; i < MAXCONTROL; i++) {
- if (m_table[i] != nullptr) {
+ for (int i = 0; i < MAXCONTROL; i++)
+ {
+ if (m_table[i] != nullptr)
+ {
if (eventMsg == m_table[i]->GetEventType())
return m_table[i];
}
@@ -326,4 +335,5 @@ void CInterface::Draw()
}
}
-}
+} // namespace Ui
+
diff --git a/src/ui/interface.h b/src/ui/interface.h
index ebc80e7..d5734f0 100644
--- a/src/ui/interface.h
+++ b/src/ui/interface.h
@@ -55,48 +55,49 @@ const int MAXCONTROL = 100;
class CInterface
{
- public:
- CInterface();
- ~CInterface();
-
- bool EventProcess(const Event &event);
- bool GetTooltip(Math::Point pos, std::string &name);
-
- void Flush();
- CButton* CreateButton(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
- CColor* CreateColor(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
- CCheck* CreateCheck(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
- CKey* CreateKey(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
- CGroup* CreateGroup(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
- CImage* CreateImage(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
- CEdit* CreateEdit(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
- CEditValue* CreateEditValue(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
- CScroll* CreateScroll(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
- CSlider* CreateSlider(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
- CShortcut* CreateShortcut(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
- CCompass* CreateCompass(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
- CTarget* CreateTarget(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
- CMap* CreateMap(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
-
- CWindow* CreateWindows(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
- CList* CreateList(Math::Point pos, Math::Point dim, int icon, EventType eventMsg, float expand=1.2f);
- CLabel* CreateLabel(Math::Point pos, Math::Point dim, int icon, EventType eventMsg, std::string name);
-
- bool DeleteControl(EventType eventMsg);
- CControl* SearchControl(EventType eventMsg);
-
- void Draw();
-
- protected:
- int GetNextFreeControl();
- template <typename T> inline T* CreateControl(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
-
- CEventQueue* m_event;
- Gfx::CEngine* m_engine;
- Gfx::CCamera* m_camera;
-
- CControl* m_table[MAXCONTROL];
+public:
+ CInterface();
+ ~CInterface();
+
+ bool EventProcess(const Event &event);
+ bool GetTooltip(Math::Point pos, std::string &name);
+
+ void Flush();
+ CButton* CreateButton(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
+ CColor* CreateColor(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
+ CCheck* CreateCheck(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
+ CKey* CreateKey(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
+ CGroup* CreateGroup(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
+ CImage* CreateImage(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
+ CEdit* CreateEdit(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
+ CEditValue* CreateEditValue(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
+ CScroll* CreateScroll(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
+ CSlider* CreateSlider(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
+ CShortcut* CreateShortcut(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
+ CCompass* CreateCompass(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
+ CTarget* CreateTarget(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
+ CMap* CreateMap(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
+
+ CWindow* CreateWindows(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
+ CList* CreateList(Math::Point pos, Math::Point dim, int icon, EventType eventMsg, float expand=1.2f);
+ CLabel* CreateLabel(Math::Point pos, Math::Point dim, int icon, EventType eventMsg, std::string name);
+
+ bool DeleteControl(EventType eventMsg);
+ CControl* SearchControl(EventType eventMsg);
+
+ void Draw();
+
+protected:
+ int GetNextFreeControl();
+ template <typename T> inline T* CreateControl(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
+
+ CEventQueue* m_event;
+ Gfx::CEngine* m_engine;
+ Gfx::CCamera* m_camera;
+
+ CControl* m_table[MAXCONTROL];
};
}
+
diff --git a/src/ui/key.cpp b/src/ui/key.cpp
index b181f70..1f8cff5 100644
--- a/src/ui/key.cpp
+++ b/src/ui/key.cpp
@@ -214,3 +214,4 @@ InputBinding CKey::GetBinding()
} // namespace Ui
+
diff --git a/src/ui/label.cpp b/src/ui/label.cpp
index b5195b5..76a95f2 100644
--- a/src/ui/label.cpp
+++ b/src/ui/label.cpp
@@ -66,7 +66,8 @@ void CLabel::Draw()
pos.y = m_pos.y + m_dim.y / 2.0f;
- switch (m_textAlign) {
+ switch (m_textAlign)
+ {
case Gfx::TEXT_ALIGN_LEFT: pos.x = m_pos.x; break;
case Gfx::TEXT_ALIGN_CENTER: pos.x = m_pos.x + m_dim.x / 2.0f; break;
case Gfx::TEXT_ALIGN_RIGHT: pos.x = m_pos.x + m_dim.x; break;
@@ -76,3 +77,4 @@ void CLabel::Draw()
}
}
+
diff --git a/src/ui/label.h b/src/ui/label.h
index c9e1050..305aca2 100644
--- a/src/ui/label.h
+++ b/src/ui/label.h
@@ -29,15 +29,16 @@ namespace Ui {
class CLabel : public CControl
{
- public:
- CLabel();
- virtual ~CLabel();
+public:
+ CLabel();
+ virtual ~CLabel();
- bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
- bool EventProcess(const Event &event);
+ bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
+ bool EventProcess(const Event &event);
- void Draw();
+ void Draw();
};
}
+
diff --git a/src/ui/list.cpp b/src/ui/list.cpp
index 7593582..f6c3ed9 100644
--- a/src/ui/list.cpp
+++ b/src/ui/list.cpp
@@ -33,13 +33,15 @@ CList::CList() : CControl()
m_button[i] = nullptr;
m_scroll = nullptr;
- for (int i = 0; i < LISTMAXTOTAL; i++) {
+ for (int i = 0; i < LISTMAXTOTAL; i++)
+ {
m_text[i][0] = 0;
m_check[i] = false;
m_enable[i] = true;
}
- for (int i = 0; i < 10; i++) {
+ for (int i = 0; i < 10; i++)
+ {
m_tabs[i] = 0.0f;
m_justifs[i] = Gfx::TEXT_ALIGN_LEFT;
}
@@ -57,7 +59,8 @@ CList::CList() : CControl()
CList::~CList()
{
- for (int i = 0; i < LISTMAXDISPLAY; i++) {
+ for (int i = 0; i < LISTMAXDISPLAY; i++)
+ {
if (m_button[i] != nullptr)
delete m_button[i];
}
@@ -103,8 +106,10 @@ bool CList::MoveAdjust()
Math::Point ipos, idim, ppos, ddim;
float marging, h;
- for (int i = 0; i < LISTMAXDISPLAY; i++) {
- if (m_button[i] != nullptr) {
+ for (int i = 0; i < LISTMAXDISPLAY; i++)
+ {
+ if (m_button[i] != nullptr)
+ {
delete m_button[i];
m_button[i] = nullptr;
}
@@ -142,7 +147,8 @@ bool CList::MoveAdjust()
ppos.y = ipos.y + idim.y - h;
ddim.x = idim.x - SCROLL_WIDTH;
ddim.y = h;
- for (int i = 0; i < m_displayLine; i++) {
+ for (int i = 0; i < m_displayLine; i++)
+ {
m_button[i] = new CButton();
m_button[i]->Create(ppos, ddim, -1, EVENT_NULL);
m_button[i]->SetTextAlign(Gfx::TEXT_ALIGN_LEFT);
@@ -154,7 +160,8 @@ bool CList::MoveAdjust()
m_eventButton[i] = m_button[i]->GetEventType();
}
- if ( m_scroll != nullptr ) {
+ if ( m_scroll != nullptr )
+ {
ppos.x = ipos.x + idim.x - SCROLL_WIDTH;
ppos.y = ipos.y;
ddim.x = SCROLL_WIDTH;
@@ -206,8 +213,10 @@ void CList::SetDim(Math::Point dim)
bool CList::SetState(int state, bool bState)
{
- if (state & STATE_ENABLE) {
- for (int i = 0; i < m_displayLine; i++) {
+ if (state & STATE_ENABLE)
+ {
+ for (int i = 0; i < m_displayLine; i++)
+ {
if (m_button[i] != nullptr)
m_button[i]->SetState(state, bState);
}
@@ -221,8 +230,10 @@ bool CList::SetState(int state, bool bState)
bool CList::SetState(int state)
{
- if (state & STATE_ENABLE) {
- for (int i = 0; i < m_displayLine; i++) {
+ if (state & STATE_ENABLE)
+ {
+ for (int i = 0; i < m_displayLine; i++)
+ {
if (m_button[i] != nullptr)
m_button[i]->SetState(state);
}
@@ -236,8 +247,10 @@ bool CList::SetState(int state)
bool CList::ClearState(int state)
{
- if (state & STATE_ENABLE) {
- for (int i = 0; i < m_displayLine; i++) {
+ if (state & STATE_ENABLE)
+ {
+ for (int i = 0; i < m_displayLine; i++)
+ {
if (m_button[i] != nullptr)
m_button[i]->ClearState(state);
}
@@ -254,15 +267,20 @@ bool CList::ClearState(int state)
bool CList::EventProcess(const Event &event)
{
int i;
- if (m_bBlink && event.type == EVENT_FRAME) {
+ if (m_bBlink && event.type == EVENT_FRAME)
+ {
i = m_selectLine-m_firstLine;
- if (i >= 0 && i < 4 && m_button[i] != nullptr) {
+ if (i >= 0 && i < 4 && m_button[i] != nullptr)
+ {
m_blinkTime += event.rTime;
- if (Math::Mod(m_blinkTime, 0.7f) < 0.3f) {
+ if (Math::Mod(m_blinkTime, 0.7f) < 0.3f)
+ {
m_button[i]->ClearState(STATE_ENABLE);
m_button[i]->ClearState(STATE_CHECK);
- } else {
+ }
+ else
+ {
m_button[i]->SetState(STATE_ENABLE);
m_button[i]->SetState(STATE_CHECK);
}
@@ -274,7 +292,8 @@ bool CList::EventProcess(const Event &event)
if ((m_state & STATE_ENABLE) == 0)
return true;
- if (event.type == EVENT_MOUSE_WHEEL && event.mouseWheel.dir == WHEEL_UP && Detect(event.mousePos)) {
+ if (event.type == EVENT_MOUSE_WHEEL && event.mouseWheel.dir == WHEEL_UP && Detect(event.mousePos))
+ {
if (m_firstLine > 0)
m_firstLine--;
UpdateScroll();
@@ -282,7 +301,8 @@ bool CList::EventProcess(const Event &event)
return true;
}
- if (event.type == EVENT_MOUSE_WHEEL && event.mouseWheel.dir == WHEEL_DOWN && Detect(event.mousePos)) {
+ if (event.type == EVENT_MOUSE_WHEEL && event.mouseWheel.dir == WHEEL_DOWN && Detect(event.mousePos))
+ {
if (m_firstLine < m_totalLine - m_displayLine)
m_firstLine++;
UpdateScroll();
@@ -292,9 +312,11 @@ bool CList::EventProcess(const Event &event)
CControl::EventProcess(event);
- if (event.type == EVENT_MOUSE_MOVE && Detect(event.mousePos)) {
+ if (event.type == EVENT_MOUSE_MOVE && Detect(event.mousePos))
+ {
m_engine->SetMouseType(Gfx::ENG_MOUSE_NORM);
- for (i = 0; i < m_displayLine; i++) {
+ for (i = 0; i < m_displayLine; i++)
+ {
if (i + m_firstLine >= m_totalLine)
break;
if (m_button[i] != nullptr)
@@ -302,16 +324,20 @@ bool CList::EventProcess(const Event &event)
}
}
- if (m_bSelectCap) {
- for (i = 0; i < m_displayLine; i++) {
+ if (m_bSelectCap)
+ {
+ for (i = 0; i < m_displayLine; i++)
+ {
if (i + m_firstLine >= m_totalLine)
break;
- if (m_button[i] != nullptr) {
+ if (m_button[i] != nullptr)
+ {
if (!m_button[i]->EventProcess(event))
return false;
- if (event.type == m_eventButton[i]) {
+ if (event.type == m_eventButton[i])
+ {
SetSelect(m_firstLine + i);
Event newEvent = event;
@@ -322,11 +348,13 @@ bool CList::EventProcess(const Event &event)
}
}
- if (m_scroll != nullptr) {
+ if (m_scroll != nullptr)
+ {
if (!m_scroll->EventProcess(event))
return false;
- if (event.type == m_eventScroll) {
+ if (event.type == m_eventScroll)
+ {
MoveScroll();
UpdateButton();
}
@@ -354,10 +382,12 @@ void CList::Draw()
dp = 0.5f / 256.0f;
- if (m_icon != -1) {
+ if (m_icon != -1)
+ {
dim = m_dim;
- if (m_icon == 0) {
+ if (m_icon == 0)
+ {
m_engine->SetTexture("button2.png");
m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
@@ -365,7 +395,9 @@ void CList::Draw()
uv1.y = 64.0f / 256.0f; // u-v texture
uv2.x = 160.0f / 256.0f;
uv2.y = 96.0f / 256.0f;
- } else {
+ }
+ else
+ {
m_engine->SetTexture("button2.png");
m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
@@ -374,7 +406,8 @@ void CList::Draw()
uv2.x = 156.0f / 256.0f;
uv2.y = 92.0f / 256.0f;
- if (m_button[0] != nullptr) {
+ if (m_button[0] != nullptr)
+ {
dim = m_button[0]->GetDim();
dim.y *= m_displayLine; // background sounds spot behind
}
@@ -390,9 +423,11 @@ void CList::Draw()
DrawIcon(m_pos, dim, uv1, uv2, corner, 8.0f / 256.0f);
}
- if ( m_totalLine < m_displayLine ) { // no buttons to the bottom?
+ if ( m_totalLine < m_displayLine ) // no buttons to the bottom?
+ {
i = m_totalLine;
- if ( m_button[i] != 0 ) {
+ if ( m_button[i] != 0 )
+ {
pos = m_button[i]->GetPos();
dim = m_button[i]->GetDim();
pos.y += dim.y * 1.1f;
@@ -413,11 +448,13 @@ void CList::Draw()
}
}
- for (i = 0; i < m_displayLine; i++) {
+ for (i = 0; i < m_displayLine; i++)
+ {
if ( i + m_firstLine >= m_totalLine )
break;
- if ( m_button[i] != nullptr ) {
+ if ( m_button[i] != nullptr )
+ {
if ( !m_bBlink && i + m_firstLine < m_totalLine )
m_button[i]->SetState(STATE_ENABLE, m_enable[i+m_firstLine] && (m_state & STATE_ENABLE) );
@@ -426,22 +463,27 @@ void CList::Draw()
// draws text in the box
pos = m_button[i]->GetPos();
dim = m_button[i]->GetDim();
- if ( m_tabs[0] == 0.0f ) {
+ if ( m_tabs[0] == 0.0f )
+ {
ppos.x = pos.x + dim.y * 0.5f;
ppos.y = pos.y + dim.y * 0.5f;
ppos.y -= m_engine->GetText()->GetHeight(m_fontType, m_fontSize) / 2.0f;
ddim.x = dim.x-dim.y;
DrawCase(m_text[i + m_firstLine], ppos, ddim.x, Gfx::TEXT_ALIGN_LEFT);
- } else {
+ }
+ else
+ {
ppos.x = pos.x + dim.y * 0.5f;
ppos.y = pos.y + dim.y * 0.5f;
ppos.y -= m_engine->GetText()->GetHeight(m_fontType, m_fontSize) / 2.0f;
pb = m_text[i + m_firstLine];
- for (int j = 0; j < 10; j++) {
+ for (int j = 0; j < 10; j++)
+ {
pe = strchr(pb, '\t');
if ( pe == 0 )
strcpy(text, pb);
- else {
+ else
+ {
strncpy(text, pb, pe - pb);
text[pe - pb] = 0;
}
@@ -454,7 +496,8 @@ void CList::Draw()
}
}
- if ( (m_state & STATE_EXTEND) && i < m_totalLine) {
+ if ( (m_state & STATE_EXTEND) && i < m_totalLine)
+ {
pos = m_button[i]->GetPos();
dim = m_button[i]->GetDim();
pos.x += dim.x - dim.y * 0.75f;
@@ -464,7 +507,8 @@ void CList::Draw()
dim.x -= 4.0f / 640.0f;
dim.y -= 4.0f / 480.0f;
- if ( m_check[i + m_firstLine] ) {
+ if ( m_check[i + m_firstLine] )
+ {
m_engine->SetTexture("button1.png");
m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
uv1.x = 64.0f / 256.0f;
@@ -487,15 +531,20 @@ void CList::Draw()
uv2.x -= dp;
uv2.y -= dp;
DrawIcon(pos, dim, uv1, uv2); // draws v
- } else {
+ }
+ else
+ {
m_engine->SetTexture("button1.png");
m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_WHITE); // was D3DSTATETTw
- if ( i + m_firstLine == m_selectLine ) {
+ if ( i + m_firstLine == m_selectLine )
+ {
uv1.x =224.0f / 256.0f; // <
uv1.y =192.0f / 256.0f;
uv2.x =256.0f / 256.0f;
uv2.y =224.0f / 256.0f;
- } else {
+ }
+ else
+ {
uv1.x = 96.0f / 256.0f; // x
uv1.y = 32.0f / 256.0f;
uv2.x =128.0f / 256.0f;
@@ -560,7 +609,8 @@ void CList::SetSelect(int i)
{
if ( m_bSelectCap )
m_selectLine = i;
- else {
+ else
+ {
m_firstLine = i;
UpdateScroll();
}
@@ -603,8 +653,10 @@ void CList::SetBlink(bool bEnable)
i = m_selectLine-m_firstLine;
- if (i >= 0 && i < 4 && m_button[i] != nullptr) {
- if ( !bEnable ) {
+ if (i >= 0 && i < 4 && m_button[i] != nullptr)
+ {
+ if ( !bEnable )
+ {
m_button[i]->SetState(STATE_CHECK);
m_button[i]->ClearState(STATE_ENABLE);
}
@@ -744,17 +796,21 @@ void CList::UpdateButton()
state = CControl::GetState();
j = m_firstLine;
- for (i = 0; i < m_displayLine; i++) {
+ for (i = 0; i < m_displayLine; i++)
+ {
if (m_button[i] == nullptr)
continue;
m_button[i]->SetState(STATE_CHECK, (j == m_selectLine));
- if ( j < m_totalLine ) {
+ if ( j < m_totalLine )
+ {
//? m_button[i]->SetName(m_text[j]);
m_button[i]->SetName(" "); // blank button
m_button[i]->SetState(STATE_ENABLE, (state & STATE_ENABLE));
- } else {
+ }
+ else
+ {
m_button[i]->SetName(" "); // blank button
m_button[i]->ClearState(STATE_ENABLE);
}
@@ -771,11 +827,14 @@ void CList::UpdateScroll()
if (m_scroll == nullptr)
return;
- if (m_totalLine <= m_displayLine) {
+ if (m_totalLine <= m_displayLine)
+ {
ratio = 1.0f;
value = 0.0f;
step = 0.0f;
- } else {
+ }
+ else
+ {
ratio = static_cast<float>(m_displayLine) / m_totalLine;
if ( ratio > 1.0f ) ratio = 1.0f;
@@ -817,3 +876,4 @@ void CList::MoveScroll()
} // namespace Ui
+
diff --git a/src/ui/list.h b/src/ui/list.h
index 3d2e517..a2e033f 100644
--- a/src/ui/list.h
+++ b/src/ui/list.h
@@ -122,3 +122,4 @@ class CList : public CControl
} // namespace Ui
+
diff --git a/src/ui/maindialog.cpp b/src/ui/maindialog.cpp
index 696c156..dfc2d52 100644
--- a/src/ui/maindialog.cpp
+++ b/src/ui/maindialog.cpp
@@ -174,8 +174,10 @@ CMainDialog::CMainDialog()
m_sceneDir = "levels";
+
+ // TODO: replace NDEBUG with something like BUILD_TYPE == "DEBUG"/"RELEASE"
#ifdef NDEBUG
- m_savegameDir = GetSystemUtils()->savegameDirectoryLocation();
+ m_savegameDir = GetSystemUtils()->GetSavegameDirectoryLocation();
#else
m_savegameDir = "savegame";
#endif
@@ -756,7 +758,8 @@ pb->SetState(STATE_SHADOW);
m_phase != PHASE_SETUPcs &&
m_phase != PHASE_SETUPss )
{
- if (!m_sound->IsPlayingMusic()) {
+ if (!m_sound->IsPlayingMusic())
+ {
m_sound->PlayMusic("Intro1.ogg", false);
}
}
@@ -1623,7 +1626,7 @@ pos.y -= 0.048f;
}
if ( m_phase == PHASE_READ ||
- m_phase == PHASE_READs )
+ m_phase == PHASE_READs )
{
pos.x = 0.10f;
pos.y = 0.10f;
@@ -2029,14 +2032,15 @@ bool CMainDialog::EventProcess(const Event &event)
m_phase != PHASE_SETUPcs &&
m_phase != PHASE_SETUPss )
{
- if (!m_sound->IsPlayingMusic()) {
+ if (!m_sound->IsPlayingMusic())
+ {
m_sound->PlayMusic("Intro2.ogg", true);
}
}
if ( m_phase == PHASE_WELCOME1 ||
- m_phase == PHASE_WELCOME2 ||
- m_phase == PHASE_WELCOME3 )
+ m_phase == PHASE_WELCOME2 ||
+ m_phase == PHASE_WELCOME3 )
{
float intensity;
int mode = Gfx::ENG_RSTATE_TCOLOR_WHITE;
@@ -2627,15 +2631,18 @@ bool CMainDialog::EventProcess(const Event &event)
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5));
if ( pw == 0 ) break;
pc = static_cast<CCheck*>(pw->SearchControl(EVENT_INTERFACE_FULL));
- if ( pc == 0 ) break;
-
- if ( pc->TestState(STATE_CHECK) ) {
- m_setupFull = false;
- pc->ClearState(STATE_CHECK);
- } else {
- m_setupFull = true;
- pc->SetState(STATE_CHECK);
- }
+ if ( pc == 0 ) break;
+
+ if ( pc->TestState(STATE_CHECK) )
+ {
+ m_setupFull = false;
+ pc->ClearState(STATE_CHECK);
+ }
+ else
+ {
+ m_setupFull = true;
+ pc->SetState(STATE_CHECK);
+ }
UpdateApply();
break;
@@ -2647,7 +2654,7 @@ bool CMainDialog::EventProcess(const Event &event)
if ( pb == 0 ) break;
pb->ClearState(STATE_PRESS);
pb->ClearState(STATE_HILIGHT);
- // TODO: uncomment when changing display is implemented
+ // TODO: uncomment when changing display is implemented
//ChangeDisplay();
UpdateApply();
break;
@@ -4297,16 +4304,19 @@ void CMainDialog::DefPerso()
bool CMainDialog::IsIOReadScene()
{
fs::directory_iterator end_iter;
-
+
fs::path saveDir(m_savegameDir + "/" + m_main->GetGamerName());
- if (fs::exists(saveDir) && fs::is_directory(saveDir)) {
- for( fs::directory_iterator dir_iter(saveDir) ; dir_iter != end_iter ; ++dir_iter) {
- if ( fs::is_directory(dir_iter->status()) && fs::exists(dir_iter->path() / "data.sav") ) {
+ if (fs::exists(saveDir) && fs::is_directory(saveDir))
+ {
+ for( fs::directory_iterator dir_iter(saveDir) ; dir_iter != end_iter ; ++dir_iter)
+ {
+ if ( fs::is_directory(dir_iter->status()) && fs::exists(dir_iter->path() / "data.sav") )
+ {
return true;
}
}
}
-
+
return false;
}
@@ -4390,27 +4400,34 @@ void CMainDialog::IOReadList()
if ( pl == 0 ) return;
pl->Flush();
-
+
fs::path saveDir(m_savegameDir + "/" + m_main->GetGamerName());
m_saveList.clear();
-
- if (fs::exists(saveDir) && fs::is_directory(saveDir)) {
- for( fs::directory_iterator dir_iter(saveDir) ; dir_iter != end_iter ; ++dir_iter) {
- if ( fs::is_directory(dir_iter->status()) && fs::exists(dir_iter->path() / "data.sav") ) {
-
+
+ if (fs::exists(saveDir) && fs::is_directory(saveDir))
+ {
+ for( fs::directory_iterator dir_iter(saveDir) ; dir_iter != end_iter ; ++dir_iter)
+ {
+ if ( fs::is_directory(dir_iter->status()) && fs::exists(dir_iter->path() / "data.sav") )
+ {
+
file = fopen((dir_iter->path() / "data.sav").make_preferred().string().c_str(), "r");
if ( file == NULL ) continue;
- while ( fgets(line, 500, file) != NULL ) {
- for ( i=0 ; i<500 ; i++ ) {
+ while ( fgets(line, 500, file) != NULL )
+ {
+ for ( i=0 ; i<500 ; i++ )
+ {
if ( line[i] == '\t' ) line[i] = ' '; // replaces tab by space
- if ( line[i] == '/' && line[i+1] == '/' ) {
+ if ( line[i] == '/' && line[i+1] == '/' )
+ {
line[i] = 0;
break;
}
}
- if ( Cmd(line, "Title") ) {
+ if ( Cmd(line, "Title") )
+ {
OpString(line, "text", name);
break;
}
@@ -4422,9 +4439,10 @@ void CMainDialog::IOReadList()
}
}
}
-
- // zly indeks
- if ( m_phase == PHASE_WRITE || m_phase == PHASE_WRITEs ) {
+
+ // invalid index
+ if ( m_phase == PHASE_WRITE || m_phase == PHASE_WRITEs )
+ {
GetResource(RES_TEXT, RT_IO_NEW, name);
pl->SetItemName(m_saveList.size(), name);
}
@@ -4453,22 +4471,24 @@ void CMainDialog::IOUpdateList()
sel = pl->GetSelect();
max = pl->GetTotal();
- if (m_saveList.size() <= static_cast<unsigned int>(sel)) {
+ if (m_saveList.size() <= static_cast<unsigned int>(sel))
return;
- }
-
+
std::string filename = (m_saveList.at(sel) / "screen.png").make_preferred().string();
if ( m_phase == PHASE_WRITE || m_phase == PHASE_WRITEs )
{
- if ( sel < max-1 ) {
+ if ( sel < max-1 )
+ {
pi->SetFilenameImage(filename.c_str());
}
- else {
+ else
+ {
pi->SetFilenameImage("");
}
pb = static_cast<CButton*>(pw->SearchControl(EVENT_INTERFACE_IODELETE));
- if ( pb != nullptr ) {
+ if ( pb != nullptr )
+ {
pb->SetState(STATE_ENABLE, sel < max-1);
}
}
@@ -4500,11 +4520,13 @@ void CMainDialog::IODeleteScene()
try
{
- if (fs::exists(m_saveList.at(sel)) && fs::is_directory(m_saveList.at(sel))) {
+ if (fs::exists(m_saveList.at(sel)) && fs::is_directory(m_saveList.at(sel)))
+ {
fs::remove_all(m_saveList.at(sel));
}
}
- catch (std::exception & e) {
+ catch (std::exception & e)
+ {
GetLogger()->Error("Error removing save %s : %s\n", pl->GetItemName(sel), e.what());
}
@@ -4516,8 +4538,10 @@ std::string clearName(char *name)
{
std::string ret;
int len = strlen(name);
- for (int i = 0; i < len; i++) {
- if (isalnum(name[i])) {
+ for (int i = 0; i < len; i++)
+ {
+ if (isalnum(name[i]))
+ {
ret += name[i];
}
}
@@ -4542,19 +4566,24 @@ bool CMainDialog::IOWriteScene()
if ( pe == nullptr ) return false;
sel = pl->GetSelect();
- if ( sel == -1 ) {
+ if ( sel == -1 )
+ {
return false;
}
-
+
fs::path dir;
pe->GetText(info, 100);
- if (static_cast<unsigned int>(sel) >= m_saveList.size()) {
+ if (static_cast<unsigned int>(sel) >= m_saveList.size())
+ {
dir = fs::path(m_savegameDir) / m_main->GetGamerName() / ("save" + clearName(info));
- } else {
+ }
+ else
+ {
dir = m_saveList.at(sel);
- }
-
- if (!fs::exists(dir)) {
+ }
+
+ if (!fs::exists(dir))
+ {
fs::create_directories(dir);
}
@@ -4585,7 +4614,8 @@ bool CMainDialog::IOReadScene()
if ( pl == nullptr ) return false;
sel = pl->GetSelect();
- if ( sel == -1 || m_saveList.size() <= static_cast<unsigned int>(sel) ) {
+ if ( sel == -1 || m_saveList.size() <= static_cast<unsigned int>(sel) )
+ {
return false;
}
@@ -4593,33 +4623,42 @@ bool CMainDialog::IOReadScene()
std::string fileCbot = (m_saveList.at(sel) / "cbot.run").make_preferred().string();
file = fopen(fileName.c_str(), "r");
- if ( file == NULL ) {
+ if ( file == NULL )
+ {
return false;
}
- while ( fgets(line, 500, file) != NULL ) {
- for ( i=0 ; i<500 ; i++ ) {
+ while ( fgets(line, 500, file) != NULL )
+ {
+ for ( i=0 ; i<500 ; i++ )
+ {
if ( line[i] == '\t' ) line[i] = ' '; // replaces tab by space
- if ( line[i] == '/' && line[i+1] == '/' ) {
+ if ( line[i] == '/' && line[i+1] == '/' )
+ {
line[i] = 0;
break;
}
}
- if ( Cmd(line, "Mission") ) {
+ if ( Cmd(line, "Mission") )
+ {
OpString(line, "base", m_sceneName);
m_sceneRank = OpInt(line, "rank", 0);
- if ( strcmp(m_sceneName, "user") == 0 ) {
+ if ( strcmp(m_sceneName, "user") == 0 )
+ {
m_sceneRank = m_sceneRank%100;
OpString(line, "dir", dir);
- for ( i=0 ; i<m_userTotal ; i++ ) {
- if ( strcmp(m_userList[i].c_str(), dir) == 0 ) {
+ for ( i=0 ; i<m_userTotal ; i++ )
+ {
+ if ( strcmp(m_userList[i].c_str(), dir) == 0 )
+ {
m_sceneRank += (i+1)*100;
break;
}
}
- if ( m_sceneRank/100 == 0 ) {
+ if ( m_sceneRank/100 == 0 )
+ {
fclose(file);
return false;
}
@@ -5126,10 +5165,11 @@ void CMainDialog::UpdateDisplayMode()
m_app->GetVideoResolutionList(modes, true, true);
int i = 0;
std::stringstream mode_text;
- for (Math::IntPoint mode : modes) {
- mode_text.str("");
- mode_text << mode.x << "x" << mode.y;
- pl->SetItemName(i++, mode_text.str().c_str());
+ for (Math::IntPoint mode : modes)
+ {
+ mode_text.str("");
+ mode_text << mode.x << "x" << mode.y;
+ pl->SetItemName(i++, mode_text.str().c_str());
}
pl->SetSelect(m_setupSelMode);
@@ -5535,25 +5575,29 @@ void CMainDialog::SetupMemorize()
GetProfile().SetLocalProfileInt("Setup", "Sound3D", m_sound->GetSound3D());
GetProfile().SetLocalProfileInt("Setup", "EditIndentMode", m_engine->GetEditIndentMode());
GetProfile().SetLocalProfileInt("Setup", "EditIndentValue", m_engine->GetEditIndentValue());
-
+
/* screen setup */
if (m_setupFull)
- GetProfile().SetLocalProfileInt("Setup", "Fullscreen", 1);
+ GetProfile().SetLocalProfileInt("Setup", "Fullscreen", 1);
else
- GetProfile().SetLocalProfileInt("Setup", "Fullscreen", 0);
-
+ GetProfile().SetLocalProfileInt("Setup", "Fullscreen", 0);
+
CList *pl;
CWindow *pw;
pw = static_cast<CWindow *>(m_interface->SearchControl(EVENT_WINDOW5));
- if ( pw != 0 ) {
- pl = static_cast<CList *>(pw->SearchControl(EVENT_LIST2));
- if ( pl != 0 ) {
- GetProfile().SetLocalProfileInt("Setup", "Resolution", pl->GetSelect());
- }
- } else {
+ if ( pw != 0 )
+ {
+ pl = static_cast<CList *>(pw->SearchControl(EVENT_LIST2));
+ if ( pl != 0 )
+ {
+ GetProfile().SetLocalProfileInt("Setup", "Resolution", pl->GetSelect());
+ }
+ }
+ else
+ {
// TODO: Default value
}
-
+
std::stringstream key;
for (int i = 0; i < INPUT_SLOT_MAX; i++)
{
@@ -5765,7 +5809,7 @@ void CMainDialog::SetupRecall()
{
m_sound->SetMusicVolume(iValue);
}
-
+
if ( GetProfile().GetLocalProfileInt("Setup", "Sound3D", iValue) )
{
m_sound->SetSound3D(iValue == 1);
@@ -5813,13 +5857,15 @@ void CMainDialog::SetupRecall()
{
m_bDeleteGamer = iValue;
}
-
- if ( GetProfile().GetLocalProfileInt("Setup", "Resolution", iValue) ) {
- m_setupSelMode = iValue;
+
+ if ( GetProfile().GetLocalProfileInt("Setup", "Resolution", iValue) )
+ {
+ m_setupSelMode = iValue;
}
-
- if ( GetProfile().GetLocalProfileInt("Setup", "Fullscreen", iValue) ) {
- m_setupFull = (iValue == 1);
+
+ if ( GetProfile().GetLocalProfileInt("Setup", "Fullscreen", iValue) )
+ {
+ m_setupFull = (iValue == 1);
}
}
@@ -6584,7 +6630,7 @@ void CMainDialog::WriteGamerPerso(char *gamer)
if ( file == NULL ) return;
m_main->SetNumericLocale();
-
+
sprintf(line, "Head face=%d glasses=%d hair=%.2f;%.2f;%.2f;%.2f\n",
m_perso.face, m_perso.glasses,
m_perso.colorHair.r, m_perso.colorHair.g, m_perso.colorHair.b, m_perso.colorHair.a);
@@ -6596,7 +6642,7 @@ void CMainDialog::WriteGamerPerso(char *gamer)
fputs(line, file);
fclose(file);
-
+
m_main->RestoreNumericLocale();
}
@@ -6615,7 +6661,7 @@ void CMainDialog::ReadGamerPerso(char *gamer)
sprintf(filename, "%s/%s/face.gam", m_savegameDir.c_str(), gamer);
file = fopen(filename, "r");
if ( file == NULL ) return;
-
+
m_main->SetNumericLocale();
while ( fgets(line, 100, file) != NULL )
@@ -6649,7 +6695,7 @@ void CMainDialog::ReadGamerPerso(char *gamer)
}
fclose(file);
-
+
m_main->RestoreNumericLocale();
}
@@ -6836,3 +6882,4 @@ bool CMainDialog::NextMission()
} // namespace Ui
+
diff --git a/src/ui/maindialog.h b/src/ui/maindialog.h
index afdf94f..96aff2a 100644
--- a/src/ui/maindialog.h
+++ b/src/ui/maindialog.h
@@ -262,7 +262,7 @@ protected:
Math::Point m_partiPos[10];
SceneInfo m_sceneInfo[MAXSCENE];
-
+
std::vector<fs::path> m_saveList;
};
diff --git a/src/ui/mainmap.cpp b/src/ui/mainmap.cpp
index 1143a77..8c81160 100644
--- a/src/ui/mainmap.cpp
+++ b/src/ui/mainmap.cpp
@@ -55,7 +55,8 @@ void CMainMap::CreateMap()
Math::Point pos, dim;
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW1));
- if (pw == nullptr) {
+ if (pw == nullptr)
+ {
pos.x = 0.0f;
pos.y = 0.0f;
dim.x = 0.0f;
@@ -106,7 +107,8 @@ void CMainMap::FloorColorMap(Gfx::Color floor, Gfx::Color water)
return;
pm = static_cast<CMap*>(pw->SearchControl(EVENT_OBJECT_MAP));
- if (pm != nullptr) {
+ if (pm != nullptr)
+ {
pm->SetFloorColor(floor);
pm->SetWaterColor(water);
}
@@ -124,9 +126,12 @@ void CMainMap::ShowMap(bool bShow)
if (pw == nullptr)
return;
- if (bShow) {
+ if (bShow)
+ {
DimMap();
- } else {
+ }
+ else
+ {
pm = static_cast<CMap*>(pw->SearchControl(EVENT_OBJECT_MAP));
if (pm != nullptr)
pm->ClearState(STATE_VISIBLE);
@@ -164,7 +169,8 @@ void CMainMap::DimMap()
pm->SetDim(dim);
ps = static_cast<CSlider*>(pw->SearchControl(EVENT_OBJECT_MAPZOOM));
- if (ps != nullptr) {
+ if (ps != nullptr)
+ {
ps->SetState(STATE_VISIBLE, (m_mapMode != 0));
dim.x = SCROLL_WIDTH;
@@ -392,3 +398,4 @@ void CMainMap::SetHighlight(CObject* pObj)
}
+
diff --git a/src/ui/mainmap.h b/src/ui/mainmap.h
index 9d0d72f..9b20548 100644
--- a/src/ui/mainmap.h
+++ b/src/ui/mainmap.h
@@ -34,37 +34,37 @@ namespace Ui {
class CMainMap
{
- public:
- CMainMap();
- ~CMainMap();
-
- void UpdateMap();
- void CreateMap();
- void SetFixImage(const char *filename);
- void FloorColorMap(Gfx::Color floor, Gfx::Color water);
- void ShowMap(bool bShow);
- void DimMap();
- float GetZoomMap();
- void ZoomMap(float zoom);
- void ZoomMap();
- void MapEnable(bool bEnable);
- bool GetShowMap();
- bool GetFixImage();
- CObject* DetectMap(Math::Point pos, bool &bInMap);
- void SetHighlight(CObject* pObj);
- void SetToy(bool bToy);
- void SetFixParam(float zoom, float ox, float oy, float angle, int mode, bool bDebug);
-
- protected:
- void CenterMap();
-
- protected:
- CEventQueue* m_event;
- Gfx::CEngine* m_engine;
- CInterface* m_interface;
-
- int m_mapMode;
- bool m_bFixImage;
+public:
+ CMainMap();
+ ~CMainMap();
+
+ void UpdateMap();
+ void CreateMap();
+ void SetFixImage(const char *filename);
+ void FloorColorMap(Gfx::Color floor, Gfx::Color water);
+ void ShowMap(bool bShow);
+ void DimMap();
+ float GetZoomMap();
+ void ZoomMap(float zoom);
+ void ZoomMap();
+ void MapEnable(bool bEnable);
+ bool GetShowMap();
+ bool GetFixImage();
+ CObject* DetectMap(Math::Point pos, bool &bInMap);
+ void SetHighlight(CObject* pObj);
+ void SetToy(bool bToy);
+ void SetFixParam(float zoom, float ox, float oy, float angle, int mode, bool bDebug);
+
+protected:
+ void CenterMap();
+
+protected:
+ CEventQueue* m_event;
+ Gfx::CEngine* m_engine;
+ CInterface* m_interface;
+
+ int m_mapMode;
+ bool m_bFixImage;
};
}
diff --git a/src/ui/mainshort.h b/src/ui/mainshort.h
index d679eb0..b185aed 100644
--- a/src/ui/mainshort.h
+++ b/src/ui/mainshort.h
@@ -34,29 +34,30 @@ namespace Ui {
class CMainShort
{
- public:
- CMainShort();
- ~CMainShort();
-
- void SetMode(bool bBuilding);
- void FlushShortcuts();
- bool CreateShortcuts();
- bool UpdateShortcuts();
- void SelectShortcut(EventType event);
- void SelectNext();
- CObject* DetectShort(Math::Point pos);
- void SetHighlight(CObject* pObj);
-
- protected:
-
- protected:
- CEventQueue* m_event;
- Gfx::CEngine* m_engine;
- CInterface* m_interface;
- CRobotMain* m_main;
-
- CObject* m_shortcuts[20];
- bool m_bBuilding;
+public:
+ CMainShort();
+ ~CMainShort();
+
+ void SetMode(bool bBuilding);
+ void FlushShortcuts();
+ bool CreateShortcuts();
+ bool UpdateShortcuts();
+ void SelectShortcut(EventType event);
+ void SelectNext();
+ CObject* DetectShort(Math::Point pos);
+ void SetHighlight(CObject* pObj);
+
+protected:
+
+protected:
+ CEventQueue* m_event;
+ Gfx::CEngine* m_engine;
+ CInterface* m_interface;
+ CRobotMain* m_main;
+
+ CObject* m_shortcuts[20];
+ bool m_bBuilding;
};
}
+
diff --git a/src/ui/map.cpp b/src/ui/map.cpp
index 33d0fb1..c5f0062 100644
--- a/src/ui/map.cpp
+++ b/src/ui/map.cpp
@@ -187,14 +187,17 @@ bool CMap::EventProcess(const Event &event)
if ( event.type == EVENT_FRAME )
m_time += event.rTime;
- if ( event.type == EVENT_MOUSE_MOVE && Detect(event.mousePos) ) {
+ if ( event.type == EVENT_MOUSE_MOVE && Detect(event.mousePos) )
+ {
m_engine->SetMouseType(Gfx::ENG_MOUSE_NORM);
if ( DetectObject(event.mousePos, bInMap) != 0 )
m_engine->SetMouseType(Gfx::ENG_MOUSE_HAND);
}
- if ( event.type == EVENT_MOUSE_BUTTON_DOWN && event.mouseButton.button == MOUSE_BUTTON_LEFT ) {
- if ( CControl::Detect(event.mousePos) ) {
+ if ( event.type == EVENT_MOUSE_BUTTON_DOWN && event.mouseButton.button == MOUSE_BUTTON_LEFT )
+ {
+ if ( CControl::Detect(event.mousePos) )
+ {
SelectObject(event.mousePos);
return false;
}
@@ -228,11 +231,13 @@ void CMap::SetHighlight(CObject* pObj)
if ( pObj == nullptr )
return;
- for (int i = 0; i < MAPMAXOBJECT; i++) {
+ for (int i = 0; i < MAPMAXOBJECT; i++)
+ {
if ( !m_map[i].bUsed )
continue;
- if ( m_map[i].object == pObj ) {
+ if ( m_map[i].object == pObj )
+ {
m_highlightRank = i;
break;
}
@@ -262,7 +267,8 @@ CObject* CMap::DetectObject(Math::Point pos, bool &bInMap)
min = 10000.0f;
best = -1;
- for (int i = MAPMAXOBJECT - 1; i >= 0; i--) {
+ for (int i = MAPMAXOBJECT - 1; i >= 0; i--)
+ {
if ( !m_map[i].bUsed )
continue;
if ( m_map[i].color == MAPCOLOR_BBOX && !m_bRadar )
@@ -273,7 +279,8 @@ CObject* CMap::DetectObject(Math::Point pos, bool &bInMap)
dist = Math::Point(m_map[i].pos.x - pos.x, m_map[i].pos.y - pos.y).Length();
if ( dist > m_half / m_zoom * 8.0f / 100.0f )
continue; // too far?
- if ( dist < min ) {
+ if ( dist < min )
+ {
min = dist;
best = i;
}
@@ -337,13 +344,15 @@ void CMap::Draw()
if ( m_map[i].bUsed ) // selection:
DrawFocus(m_map[i].pos, m_map[i].dir, m_map[i].type, m_map[i].color);
- for ( i=0 ; i<m_totalFix ; i++ ) { // fixed objects:
+ for ( i=0 ; i<m_totalFix ; i++ ) // fixed objects:
+ {
if ( i == m_highlightRank )
continue;
DrawObject(m_map[i].pos, m_map[i].dir, m_map[i].type, m_map[i].color, false, false);
}
- for ( i=MAPMAXOBJECT-2 ; i>m_totalMove ; i-- ) { // moving objects:
+ for ( i=MAPMAXOBJECT-2 ; i>m_totalMove ; i-- ) // moving objects:
+ {
if ( i == m_highlightRank )
continue;
DrawObject(m_map[i].pos, m_map[i].dir, m_map[i].type, m_map[i].color, false, false);
@@ -353,7 +362,8 @@ void CMap::Draw()
if ( m_map[i].bUsed && i != m_highlightRank ) // selection:
DrawObject(m_map[i].pos, m_map[i].dir, m_map[i].type, m_map[i].color, true, false);
- if ( m_highlightRank != -1 && m_map[m_highlightRank].bUsed ) {
+ if ( m_highlightRank != -1 && m_map[m_highlightRank].bUsed )
+ {
i = m_highlightRank;
DrawObject(m_map[i].pos, m_map[i].dir, m_map[i].type, m_map[i].color, false, true);
DrawHighlight(m_map[i].pos);
@@ -375,23 +385,27 @@ Math::Point CMap::MapInter(Math::Point pos, float dir)
p1.y -= pos.y;
limit = m_mapPos.x + m_mapDim.x - pos.x;
- if ( p1.x > limit ) { // exceeds the right?
+ if ( p1.x > limit ) // exceeds the right?
+ {
p1.y = limit*p1.y/p1.x;
p1.x = limit;
}
limit = m_mapPos.y * 0.75f + m_mapDim.y * 0.75f - pos.y;
- if ( p1.y > limit ) { // exceeds the top?
+ if ( p1.y > limit ) // exceeds the top?
+ {
p1.x = limit * p1.x / p1.y;
p1.y = limit;
}
limit = m_mapPos.x - pos.x;
- if ( p1.x < limit ) { // exceeds the left?
+ if ( p1.x < limit ) // exceeds the left?
+ {
p1.y = limit * p1.y / p1.x;
p1.x = limit;
}
limit = m_mapPos.y * 0.75f - pos.y;
- if ( p1.y < limit ) { // exceeds the bottom?
+ if ( p1.y < limit ) // exceeds the bottom?
+ {
p1.x = limit * p1.x / p1.y;
p1.y = limit;
}
@@ -1152,7 +1166,7 @@ void CMap::UpdateObject(CObject* pObj)
pos.z = ppos.y;
dir += m_angle;
}
-
+
color = MAPCOLOR_NULL;
if ( type == OBJECT_BASE )
{
@@ -1303,3 +1317,4 @@ void CMap::UpdateObject(CObject* pObj)
}
}
+
diff --git a/src/ui/map.h b/src/ui/map.h
index 258dcdf..4ebe688 100644
--- a/src/ui/map.h
+++ b/src/ui/map.h
@@ -69,78 +69,79 @@ struct MapObject
class CMap : public CControl
{
- public:
- CMap();
- ~CMap();
-
- bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
- bool EventProcess(const Event &event);
- void Draw();
-
- void UpdateTerrain();
- void UpdateTerrain(int bx, int by, int ex, int ey);
-
- void SetFixImage(const char *filename);
- bool GetFixImage();
-
- void SetOffset(float ox, float oy);
- void SetAngle(float angle);
- void SetMode(int mode);
- void SetToy(bool bToy);
- void SetDebug(bool bDebug);
-
- void SetZoom(float value);
- float GetZoom();
-
- void SetEnable(bool bEnable);
- bool GetEnable();
-
- void SetFloorColor(Gfx::Color color);
- void SetWaterColor(Gfx::Color color);
-
- void FlushObject();
- void UpdateObject(CObject* pObj);
-
- CObject* DetectObject(Math::Point pos, bool &bInMap);
- void SetHighlight(CObject* pObj);
-
- protected:
- Math::Point AdjustOffset(Math::Point offset);
- void SelectObject(Math::Point pos);
- Math::Point MapInter(Math::Point pos, float dir);
- void DrawFocus(Math::Point pos, float dir, ObjectType type, MapColor color);
- void DrawObject(Math::Point pos, float dir, ObjectType type, MapColor color, bool bSelect, bool bHilite);
- void DrawObjectIcon(Math::Point pos, Math::Point dim, MapColor color, ObjectType type, bool bHilite);
- void DrawHighlight(Math::Point pos);
- void DrawTriangle(Math::Point p1, Math::Point p2, Math::Point p3, Math::Point uv1, Math::Point uv2);
- void DrawPenta(Math::Point p1, Math::Point p2, Math::Point p3, Math::Point p4, Math::Point p5, Math::Point uv1, Math::Point uv2);
- void DrawVertex(Math::Point uv1, Math::Point uv2, float zoom);
-
- protected:
- Gfx::CTerrain* m_terrain;
- Gfx::CWater* m_water;
- CRobotMain* m_main;
-
- bool m_bEnable;
- float m_time;
- float m_half;
- float m_zoom;
- Math::Point m_offset;
- float m_angle;
- Gfx::Color m_floorColor;
- Gfx::Color m_waterColor;
- MapObject m_map[MAPMAXOBJECT];
- int m_totalFix;
- int m_totalMove;
- int m_highlightRank;
- Math::Point m_mapPos;
- Math::Point m_mapDim;
- bool m_bRadar;
- char m_fixImage[100];
- int m_mode;
- bool m_bToy;
- bool m_bDebug;
+public:
+ CMap();
+ ~CMap();
+
+ bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
+ bool EventProcess(const Event &event);
+ void Draw();
+
+ void UpdateTerrain();
+ void UpdateTerrain(int bx, int by, int ex, int ey);
+
+ void SetFixImage(const char *filename);
+ bool GetFixImage();
+
+ void SetOffset(float ox, float oy);
+ void SetAngle(float angle);
+ void SetMode(int mode);
+ void SetToy(bool bToy);
+ void SetDebug(bool bDebug);
+
+ void SetZoom(float value);
+ float GetZoom();
+
+ void SetEnable(bool bEnable);
+ bool GetEnable();
+
+ void SetFloorColor(Gfx::Color color);
+ void SetWaterColor(Gfx::Color color);
+
+ void FlushObject();
+ void UpdateObject(CObject* pObj);
+
+ CObject* DetectObject(Math::Point pos, bool &bInMap);
+ void SetHighlight(CObject* pObj);
+
+protected:
+ Math::Point AdjustOffset(Math::Point offset);
+ void SelectObject(Math::Point pos);
+ Math::Point MapInter(Math::Point pos, float dir);
+ void DrawFocus(Math::Point pos, float dir, ObjectType type, MapColor color);
+ void DrawObject(Math::Point pos, float dir, ObjectType type, MapColor color, bool bSelect, bool bHilite);
+ void DrawObjectIcon(Math::Point pos, Math::Point dim, MapColor color, ObjectType type, bool bHilite);
+ void DrawHighlight(Math::Point pos);
+ void DrawTriangle(Math::Point p1, Math::Point p2, Math::Point p3, Math::Point uv1, Math::Point uv2);
+ void DrawPenta(Math::Point p1, Math::Point p2, Math::Point p3, Math::Point p4, Math::Point p5, Math::Point uv1, Math::Point uv2);
+ void DrawVertex(Math::Point uv1, Math::Point uv2, float zoom);
+
+protected:
+ Gfx::CTerrain* m_terrain;
+ Gfx::CWater* m_water;
+ CRobotMain* m_main;
+
+ bool m_bEnable;
+ float m_time;
+ float m_half;
+ float m_zoom;
+ Math::Point m_offset;
+ float m_angle;
+ Gfx::Color m_floorColor;
+ Gfx::Color m_waterColor;
+ MapObject m_map[MAPMAXOBJECT];
+ int m_totalFix;
+ int m_totalMove;
+ int m_highlightRank;
+ Math::Point m_mapPos;
+ Math::Point m_mapDim;
+ bool m_bRadar;
+ char m_fixImage[100];
+ int m_mode;
+ bool m_bToy;
+ bool m_bDebug;
};
}
+
diff --git a/src/ui/scroll.cpp b/src/ui/scroll.cpp
index ff7451d..b3422ec 100644
--- a/src/ui/scroll.cpp
+++ b/src/ui/scroll.cpp
@@ -467,3 +467,4 @@ float CScroll::GetArrowStep()
}
}
+
diff --git a/src/ui/scroll.h b/src/ui/scroll.h
index 57d6f8f..c115aa4 100644
--- a/src/ui/scroll.h
+++ b/src/ui/scroll.h
@@ -34,51 +34,52 @@ const float SCROLL_WIDTH = (15.0f/640.0f);
class CScroll : public CControl
{
- public:
- CScroll();
- ~CScroll();
+public:
+ CScroll();
+ ~CScroll();
- bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
+ bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
- void SetPos(Math::Point pos);
- void SetDim(Math::Point dim);
+ void SetPos(Math::Point pos);
+ void SetDim(Math::Point dim);
- bool SetState(int state, bool bState);
- bool SetState(int state);
- bool ClearState(int state);
+ bool SetState(int state, bool bState);
+ bool SetState(int state);
+ bool ClearState(int state);
- bool EventProcess(const Event &event);
- void Draw();
+ bool EventProcess(const Event &event);
+ void Draw();
- void SetVisibleValue(float value);
- float GetVisibleValue();
+ void SetVisibleValue(float value);
+ float GetVisibleValue();
- void SetVisibleRatio(float value);
- float GetVisibleRatio();
+ void SetVisibleRatio(float value);
+ float GetVisibleRatio();
- void SetArrowStep(float step);
- float GetArrowStep();
+ void SetArrowStep(float step);
+ float GetArrowStep();
- protected:
- void MoveAdjust();
- void AdjustGlint();
- void DrawVertex(Math::Point pos, Math::Point dim, int icon);
+protected:
+ void MoveAdjust();
+ void AdjustGlint();
+ void DrawVertex(Math::Point pos, Math::Point dim, int icon);
- protected:
- CButton* m_buttonUp;
- CButton* m_buttonDown;
+protected:
+ CButton* m_buttonUp;
+ CButton* m_buttonDown;
- float m_visibleValue;
- float m_visibleRatio;
- float m_step;
+ float m_visibleValue;
+ float m_visibleRatio;
+ float m_step;
- bool m_bCapture;
- Math::Point m_pressPos;
- float m_pressValue;
+ bool m_bCapture;
+ Math::Point m_pressPos;
+ float m_pressValue;
- EventType m_eventUp;
- EventType m_eventDown;
+ EventType m_eventUp;
+ EventType m_eventDown;
};
}
+
diff --git a/src/ui/shortcut.cpp b/src/ui/shortcut.cpp
index 4462140..7231d5d 100644
--- a/src/ui/shortcut.cpp
+++ b/src/ui/shortcut.cpp
@@ -237,3 +237,4 @@ void CShortcut::DrawVertex(int icon, float zoom)
}
}
+
diff --git a/src/ui/shortcut.h b/src/ui/shortcut.h
index 7e7899e..6495ba0 100644
--- a/src/ui/shortcut.h
+++ b/src/ui/shortcut.h
@@ -27,22 +27,23 @@ namespace Ui {
class CShortcut : public CControl
{
- public:
- CShortcut();
- ~CShortcut();
+public:
+ CShortcut();
+ ~CShortcut();
- bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventType);
+ bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventType);
- bool EventProcess(const Event &event);
+ bool EventProcess(const Event &event);
- void Draw();
+ void Draw();
- protected:
- void DrawVertex(int icon, float zoom);
+protected:
+ void DrawVertex(int icon, float zoom);
- protected:
- float m_time;
+protected:
+ float m_time;
};
}
+
diff --git a/src/ui/slider.cpp b/src/ui/slider.cpp
index f516e70..33293d1 100644
--- a/src/ui/slider.cpp
+++ b/src/ui/slider.cpp
@@ -581,3 +581,4 @@ float CSlider::GetArrowStep()
}
+
diff --git a/src/ui/slider.h b/src/ui/slider.h
index 4912453..bc38aec 100644
--- a/src/ui/slider.h
+++ b/src/ui/slider.h
@@ -29,54 +29,55 @@ class CButton;
class CSlider : public CControl
{
- public:
- CSlider();
- ~CSlider();
+public:
+ CSlider();
+ ~CSlider();
- bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
+ bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
- void SetPos(Math::Point pos);
- void SetDim(Math::Point dim);
+ void SetPos(Math::Point pos);
+ void SetDim(Math::Point dim);
- bool SetState(int state, bool bState);
- bool SetState(int state);
- bool ClearState(int state);
+ bool SetState(int state, bool bState);
+ bool SetState(int state);
+ bool ClearState(int state);
- bool EventProcess(const Event &event);
- void Draw();
+ bool EventProcess(const Event &event);
+ void Draw();
- void SetLimit(float min, float max);
+ void SetLimit(float min, float max);
- void SetVisibleValue(float value);
- float GetVisibleValue();
+ void SetVisibleValue(float value);
+ float GetVisibleValue();
- void SetArrowStep(float step);
- float GetArrowStep();
+ void SetArrowStep(float step);
+ float GetArrowStep();
- protected:
- void MoveAdjust();
- void AdjustGlint();
- void DrawVertex(Math::Point pos, Math::Point dim, int icon);
+protected:
+ void MoveAdjust();
+ void AdjustGlint();
+ void DrawVertex(Math::Point pos, Math::Point dim, int icon);
- protected:
- CButton* m_buttonLeft;
- CButton* m_buttonRight;
+protected:
+ CButton* m_buttonLeft;
+ CButton* m_buttonRight;
- float m_min;
- float m_max;
- float m_visibleValue;
- float m_step;
+ float m_min;
+ float m_max;
+ float m_visibleValue;
+ float m_step;
- bool m_bHoriz;
- float m_marginButton;
+ bool m_bHoriz;
+ float m_marginButton;
- bool m_bCapture;
- Math::Point m_pressPos;
- float m_pressValue;
+ bool m_bCapture;
+ Math::Point m_pressPos;
+ float m_pressValue;
- EventType m_eventUp;
- EventType m_eventDown;
+ EventType m_eventUp;
+ EventType m_eventDown;
};
}
+
diff --git a/src/ui/studio.cpp b/src/ui/studio.cpp
index 5027924..24a64c4 100644
--- a/src/ui/studio.cpp
+++ b/src/ui/studio.cpp
@@ -1511,7 +1511,7 @@ void CStudio::UpdateDialogList()
fs::path path;
int i = 0;
char time[100];
-
+
pw = static_cast< CWindow* >(m_interface->SearchControl(EVENT_WINDOW9));
if ( pw == nullptr ) return;
pl = static_cast< CList* >(pw->SearchControl(EVENT_DIALOG_LIST));
@@ -1520,12 +1520,15 @@ void CStudio::UpdateDialogList()
path = fs::path(SearchDirectory(false));
fs::directory_iterator end_iter;
- if ( fs::exists(path) && fs::is_directory(path) ) {
- for( fs::directory_iterator file(path); file != end_iter; file++) {
- if (fs::is_regular_file(file->status()) ) {
+ if ( fs::exists(path) && fs::is_directory(path) )
+ {
+ for( fs::directory_iterator file(path); file != end_iter; file++)
+ {
+ if (fs::is_regular_file(file->status()) )
+ {
std::ostringstream temp;
TimeToAscii(fs::last_write_time(file->path()), time);
- temp << file->path().filename().string() << '\t' << fs::file_size(file->path()) << " \t" << time;
+ temp << file->path().filename().string() << '\t' << fs::file_size(file->path()) << " \t" << time;
pl->SetItemName(i++, temp.str().c_str());
}
}
@@ -1538,15 +1541,19 @@ void CStudio::UpdateDialogList()
std::string CStudio::SearchDirectory(bool bCreate)
{
char dir[MAX_FNAME];
- if ( m_main->GetIOPublic() ) {
+ if ( m_main->GetIOPublic() )
+ {
sprintf(dir, "%s/", m_main->GetPublicDir());
- } else {
+ }
+ else
+ {
sprintf(dir, "%s/%s/Program/", m_main->GetSavegameDir(), m_main->GetGamerName());
}
-
+
fs::path path = fs::path(dir);
-
- if ( bCreate ) {
+
+ if ( bCreate )
+ {
fs::create_directory(path);
}
@@ -1629,3 +1636,4 @@ bool CStudio::WriteProgram()
}
}
+
diff --git a/src/ui/target.cpp b/src/ui/target.cpp
index cc74750..455c530 100644
--- a/src/ui/target.cpp
+++ b/src/ui/target.cpp
@@ -272,3 +272,4 @@ CObject* CTarget::DetectFriendObject(Math::Point pos)
}
}
+
diff --git a/src/ui/target.h b/src/ui/target.h
index 054524b..2344e59 100644
--- a/src/ui/target.h
+++ b/src/ui/target.h
@@ -36,19 +36,20 @@ namespace Ui {
class CTarget : public CControl
{
- public:
- CTarget();
- ~CTarget();
+public:
+ CTarget();
+ ~CTarget();
- bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
+ bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
- bool EventProcess(const Event &event);
- void Draw();
- bool GetTooltip(Math::Point pos, std::string &name);
+ bool EventProcess(const Event &event);
+ void Draw();
+ bool GetTooltip(Math::Point pos, std::string &name);
- protected:
- CObject* DetectFriendObject(Math::Point pos);
+protected:
+ CObject* DetectFriendObject(Math::Point pos);
};
}
+
diff --git a/src/ui/window.cpp b/src/ui/window.cpp
index 1820642..8005939 100644
--- a/src/ui/window.cpp
+++ b/src/ui/window.cpp
@@ -1579,3 +1579,4 @@ void CWindow::DrawHach(Math::Point pos, Math::Point dim)
}
}
+
diff --git a/src/ui/window.h b/src/ui/window.h
index 6cb6e5d..87805e2 100644
--- a/src/ui/window.h
+++ b/src/ui/window.h
@@ -151,3 +151,4 @@ protected:
}
+