summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorerihel <erihel@gmail.com>2013-02-09 21:00:07 +0100
committererihel <erihel@gmail.com>2013-02-09 21:00:07 +0100
commit6f64770714c20a24a2edfd55777e05a047e61d0e (patch)
tree6a9119eb5714008e3573c179cddfbb1690f43d4c /src
parent209c6412ae149cc7c503fd7da384f344a830423c (diff)
downloadcolobot-6f64770714c20a24a2edfd55777e05a047e61d0e.tar.gz
colobot-6f64770714c20a24a2edfd55777e05a047e61d0e.tar.bz2
colobot-6f64770714c20a24a2edfd55777e05a047e61d0e.zip
* Fixes to ingame editor
* Fixes to editor window. It's now possible to resize, move and press buttons
Diffstat (limited to 'src')
-rw-r--r--src/graphics/engine/text.cpp8
-rw-r--r--src/object/brain.cpp2
-rw-r--r--src/script/script.cpp3
-rw-r--r--src/ui/edit.cpp4
-rw-r--r--src/ui/studio.cpp40
5 files changed, 29 insertions, 28 deletions
diff --git a/src/graphics/engine/text.cpp b/src/graphics/engine/text.cpp
index da1a290..dfe7a3c 100644
--- a/src/graphics/engine/text.cpp
+++ b/src/graphics/engine/text.cpp
@@ -682,11 +682,13 @@ void CText::DrawCharAndAdjustPos(UTF8Char ch, FontType font, float size, Math::P
int width = 1;
if (ch.c1 > 0 && ch.c1 < 32) { // FIXME add support for chars with code 9 10 23
- ch.c1 = ' ';
+ if (ch.c1 == '\t') {
+ ch.c1 = ':';
+ } else {
+ ch.c1 = ' ';
+ }
ch.c2 = 0;
ch.c3 = 0;
- if (ch.c1 == '\t')
- width = 4;
}
auto it = cf->cache.find(ch);
diff --git a/src/object/brain.cpp b/src/object/brain.cpp
index d3c0e0b..bc47cb3 100644
--- a/src/object/brain.cpp
+++ b/src/object/brain.cpp
@@ -255,7 +255,7 @@ bool CBrain::EventProcess(const Event &event)
if ( m_object->GetSelect() && // robot selected?
m_studio != 0 ) // current issue?
{
- // m_studio->EventProcess(event);
+ m_studio->EventProcess(event);
if ( action == EVENT_OBJECT_PROGRUN )
{
diff --git a/src/script/script.cpp b/src/script/script.cpp
index f58e66d..50ce830 100644
--- a/src/script/script.cpp
+++ b/src/script/script.cpp
@@ -3346,7 +3346,6 @@ void CScript::ColorizeScript(Ui::CEdit* edit)
cursor1 = bt->GetStart();
cursor2 = bt->GetEnd();
-
color = Gfx::FONT_HIGHLIGHT_NONE;
if ( type >= TokenKeyWord && type < TokenKeyWord+100 )
{
@@ -3376,7 +3375,7 @@ void CScript::ColorizeScript(Ui::CEdit* edit)
color =Gfx::FONT_HIGHLIGHT_CONST;
}
- if ( cursor1 < cursor2 && color != 0 )
+ if ( cursor1 < cursor2 && color != Gfx::FONT_HIGHLIGHT_NONE )
{
edit->SetFormat(cursor1, cursor2, color);
}
diff --git a/src/ui/edit.cpp b/src/ui/edit.cpp
index 639215a..a1d213f 100644
--- a/src/ui/edit.cpp
+++ b/src/ui/edit.cpp
@@ -935,10 +935,10 @@ void CEdit::Draw()
pos.x = m_pos.x+(10.0f/640.0f);
if ( m_bAutoIndent )
{
+ const char *s = "\t"; // line | dotted
for ( j=0 ; j<m_lineIndent[i] ; j++ )
{
- char s = '\t'; // line | dotted
- m_engine->GetText()->DrawText(&s, m_fontType, m_fontSize, pos, 1.0f, Gfx::TEXT_ALIGN_LEFT, 0);
+ m_engine->GetText()->DrawText(s, m_fontType, m_fontSize, pos, 1.0f, Gfx::TEXT_ALIGN_LEFT, 0);
pos.x += indentLength;
}
}
diff --git a/src/ui/studio.cpp b/src/ui/studio.cpp
index 2f58c95..7aa2d22 100644
--- a/src/ui/studio.cpp
+++ b/src/ui/studio.cpp
@@ -114,7 +114,7 @@ bool CStudio::EventProcess(const Event &event)
if ( pw == nullptr ) return false;
edit = static_cast<CEdit*>(pw->SearchControl(EVENT_STUDIO_EDIT));
- if ( edit == 0 ) return false;
+ if ( edit == nullptr ) return false;
if ( event.type == pw->GetEventTypeClose() )
{
@@ -692,7 +692,7 @@ void CStudio::AdjustEditScript()
dim.x = wdim.x-0.02f;
dim.y = wdim.y-0.22f-hList;
edit = static_cast< CEdit* >(pw->SearchControl(EVENT_STUDIO_EDIT));
- if ( edit != 0 )
+ if ( edit != nullptr )
{
edit->SetPos(pos);
edit->SetDim(dim);
@@ -703,7 +703,7 @@ void CStudio::AdjustEditScript()
dim.x = wdim.x-0.02f;
dim.y = hList;
list = static_cast< CList* >(pw->SearchControl(EVENT_STUDIO_LIST));
- if ( list != 0 )
+ if ( list != nullptr )
{
list->SetPos(pos);
list->SetDim(dim);
@@ -716,56 +716,56 @@ void CStudio::AdjustEditScript()
pos.y = wpos.y+wdim.y-dim.y-0.06f;
pos.x = wpos.x+0.01f;
button = static_cast< CButton* >(pw->SearchControl(EVENT_STUDIO_NEW));
- if ( button != 0 )
+ if ( button != nullptr )
{
button->SetPos(pos);
button->SetDim(dim);
}
pos.x = wpos.x+0.05f;
button = static_cast< CButton* >(pw->SearchControl(EVENT_STUDIO_OPEN));
- if ( button != 0 )
+ if ( button != nullptr )
{
button->SetPos(pos);
button->SetDim(dim);
}
pos.x = wpos.x+0.09f;
button = static_cast< CButton* >(pw->SearchControl(EVENT_STUDIO_SAVE));
- if ( button != 0 )
+ if ( button != nullptr )
{
button->SetPos(pos);
button->SetDim(dim);
}
pos.x = wpos.x+0.14f;
button = static_cast< CButton* >(pw->SearchControl(EVENT_STUDIO_UNDO));
- if ( button != 0 )
+ if ( button != nullptr )
{
button->SetPos(pos);
button->SetDim(dim);
}
pos.x = wpos.x+0.19f;
button = static_cast< CButton* >(pw->SearchControl(EVENT_STUDIO_CUT));
- if ( button != 0 )
+ if ( button != nullptr )
{
button->SetPos(pos);
button->SetDim(dim);
}
pos.x = wpos.x+0.23f;
button = static_cast< CButton* >(pw->SearchControl(EVENT_STUDIO_COPY));
- if ( button != 0 )
+ if ( button != nullptr )
{
button->SetPos(pos);
button->SetDim(dim);
}
pos.x = wpos.x+0.27f;
button = static_cast< CButton* >(pw->SearchControl(EVENT_STUDIO_PASTE));
- if ( button != 0 )
+ if ( button != nullptr )
{
button->SetPos(pos);
button->SetDim(dim);
}
pos.x = wpos.x+0.32f;
slider = static_cast< CSlider* >(pw->SearchControl(EVENT_STUDIO_SIZE));
- if ( slider != 0 )
+ if ( slider != nullptr )
{
ppos = pos;
ddim.x = dim.x*0.7f;
@@ -777,21 +777,21 @@ void CStudio::AdjustEditScript()
}
pos.x = wpos.x+0.36f;
group = static_cast< CGroup* >(pw->SearchControl(EVENT_LABEL1));
- if ( group != 0 )
+ if ( group != nullptr )
{
group->SetPos(pos);
group->SetDim(dim);
}
pos.x = wpos.x+0.40f;
button = static_cast< CButton* >(pw->SearchControl(EVENT_STUDIO_TOOL));
- if ( button != 0 )
+ if ( button != nullptr )
{
button->SetPos(pos);
button->SetDim(dim);
}
pos.x = wpos.x+0.44f;
button = static_cast< CButton* >(pw->SearchControl(EVENT_STUDIO_HELP));
- if ( button != 0 )
+ if ( button != nullptr )
{
button->SetPos(pos);
button->SetDim(dim);
@@ -802,14 +802,14 @@ void CStudio::AdjustEditScript()
dim.x = 80.0f/640.0f;
dim.y = 25.0f/480.0f;
button = static_cast< CButton* >(pw->SearchControl(EVENT_STUDIO_OK));
- if ( button != 0 )
+ if ( button != nullptr )
{
button->SetPos(pos);
button->SetDim(dim);
}
pos.x = wpos.x+0.14f;
button = static_cast< CButton* >(pw->SearchControl(EVENT_STUDIO_CANCEL));
- if ( button != 0 )
+ if ( button != nullptr )
{
button->SetPos(pos);
button->SetDim(dim);
@@ -817,28 +817,28 @@ void CStudio::AdjustEditScript()
pos.x = wpos.x+0.28f;
dim.x = dim.y*0.75f;
button = static_cast< CButton* >(pw->SearchControl(EVENT_STUDIO_COMPILE));
- if ( button != 0 )
+ if ( button != nullptr )
{
button->SetPos(pos);
button->SetDim(dim);
}
pos.x = wpos.x+0.28f+dim.x*1;
button = static_cast< CButton* >(pw->SearchControl(EVENT_STUDIO_RUN));
- if ( button != 0 )
+ if ( button != nullptr )
{
button->SetPos(pos);
button->SetDim(dim);
}
pos.x = wpos.x+0.28f+dim.x*2;
button = static_cast< CButton* >(pw->SearchControl(EVENT_STUDIO_REALTIME));
- if ( button != 0 )
+ if ( button != nullptr )
{
button->SetPos(pos);
button->SetDim(dim);
}
pos.x = wpos.x+0.28f+dim.x*3;
button = static_cast< CButton* >(pw->SearchControl(EVENT_STUDIO_STEP));
- if ( button != 0 )
+ if ( button != nullptr )
{
button->SetPos(pos);
button->SetDim(dim);