From da5d4edeb3a41462ec987cb4994a6897823f3f76 Mon Sep 17 00:00:00 2001 From: Piotr Dziwinski Date: Tue, 18 Sep 2012 17:52:36 +0200 Subject: Fixed invalid text alignment --- src/ui/edit.cpp | 10 +++++----- src/ui/key.cpp | 2 +- src/ui/label.cpp | 4 ++-- src/ui/list.cpp | 8 ++++---- src/ui/list.h | 2 +- src/ui/slider.cpp | 4 ++-- src/ui/studio.cpp | 8 ++++---- 7 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/ui/edit.cpp b/src/ui/edit.cpp index a4d5961..c1e7e5a 100644 --- a/src/ui/edit.cpp +++ b/src/ui/edit.cpp @@ -941,7 +941,7 @@ void CEdit::Draw() for ( j=0 ; jGetText()->DrawText(&s, m_fontType, m_fontSize, pos, 1.0f, Gfx::TEXT_ALIGN_RIGHT, 0); + m_engine->GetText()->DrawText(&s, m_fontType, m_fontSize, pos, 1.0f, Gfx::TEXT_ALIGN_LEFT, 0); pos.x += indentLength; } } @@ -1063,7 +1063,7 @@ void CEdit::Draw() if ( !m_bMulti || !m_bDisplaySpec ) eol = 0; if ( m_format.size() == 0 ) { - m_engine->GetText()->DrawText(std::string(m_text+beg), m_fontType, size, ppos, m_dim.x, Gfx::TEXT_ALIGN_RIGHT, eol); + m_engine->GetText()->DrawText(std::string(m_text+beg), m_fontType, size, ppos, m_dim.x, Gfx::TEXT_ALIGN_LEFT, eol); } else { @@ -1072,7 +1072,7 @@ void CEdit::Draw() size, ppos, m_dim.x, - Gfx::TEXT_ALIGN_RIGHT, + Gfx::TEXT_ALIGN_LEFT, eol); } @@ -1104,14 +1104,14 @@ void CEdit::Draw() if ( m_format.size() == 0 ) { m_engine->GetText()->SizeText(std::string(m_text+m_lineOffset[i]), m_fontType, - size, pos, Gfx::TEXT_ALIGN_RIGHT, + size, pos, Gfx::TEXT_ALIGN_LEFT, start, end); } else { m_engine->GetText()->SizeText(std::string(m_text+m_lineOffset[i]), std::vector(m_format.begin()+m_lineOffset[i], m_format.end()), - size, pos, Gfx::TEXT_ALIGN_RIGHT, + size, pos, Gfx::TEXT_ALIGN_LEFT, start, end); } diff --git a/src/ui/key.cpp b/src/ui/key.cpp index b38b2f4..ea1b964 100644 --- a/src/ui/key.cpp +++ b/src/ui/key.cpp @@ -215,7 +215,7 @@ void CKey::Draw() pos.x = m_pos.x + (214.0f / 640.0f); pos.y = m_pos.y + m_dim.y * 0.5f; pos.y -= h; - m_engine->GetText()->DrawText(std::string(m_name), m_fontType, m_fontSize, pos, m_dim.x, Gfx::TEXT_ALIGN_RIGHT, 0); + m_engine->GetText()->DrawText(std::string(m_name), m_fontType, m_fontSize, pos, m_dim.x, Gfx::TEXT_ALIGN_LEFT, 0); } diff --git a/src/ui/label.cpp b/src/ui/label.cpp index c5da211..d7b9cbe 100644 --- a/src/ui/label.cpp +++ b/src/ui/label.cpp @@ -69,9 +69,9 @@ void CLabel::Draw() pos.y = m_pos.y + m_dim.y / 2.0f; switch (m_textAlign) { - case Gfx::TEXT_ALIGN_RIGHT: pos.x = m_pos.x; break; + 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_LEFT: pos.x = m_pos.x + m_dim.x; break; + case Gfx::TEXT_ALIGN_RIGHT: pos.x = m_pos.x + m_dim.x; break; } m_engine->GetText()->DrawText(std::string(m_name), m_fontType, m_fontSize, pos, m_dim.x, m_textAlign, 0); diff --git a/src/ui/list.cpp b/src/ui/list.cpp index 80609d7..7bebb81 100644 --- a/src/ui/list.cpp +++ b/src/ui/list.cpp @@ -43,7 +43,7 @@ CList::CList() : CControl() for (int i = 0; i < 10; i++) { m_tabs[i] = 0.0f; - m_justifs[i] = Gfx::TEXT_ALIGN_RIGHT; + m_justifs[i] = Gfx::TEXT_ALIGN_LEFT; } m_totalLine = 0; @@ -128,7 +128,7 @@ bool CList::MoveAdjust() 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_RIGHT); + m_button[i]->SetTextAlign(Gfx::TEXT_ALIGN_LEFT); m_button[i]->SetState(STATE_SIMPLY); m_button[i]->SetFontType(m_fontType); m_button[i]->SetFontSize(m_fontSize); @@ -414,7 +414,7 @@ void CList::Draw() 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_RIGHT); + DrawCase(m_text[i + m_firstLine], ppos, ddim.x, Gfx::TEXT_ALIGN_LEFT); } else { ppos.x = pos.x + dim.y * 0.5f; ppos.y = pos.y + dim.y * 0.5f; @@ -504,7 +504,7 @@ void CList::DrawCase(char *text, Math::Point pos, float width, Gfx::TextAlign ju { if (justif == Gfx::TEXT_ALIGN_CENTER) pos.x += width / 2.0f; - else if (justif == Gfx::TEXT_ALIGN_LEFT) + else if (justif == Gfx::TEXT_ALIGN_RIGHT) pos.x += width; m_engine->GetText()->DrawText(std::string(text), m_fontType, m_fontSize, pos, width, justif, 0); } diff --git a/src/ui/list.h b/src/ui/list.h index 2fc5e4d..4b866f6 100644 --- a/src/ui/list.h +++ b/src/ui/list.h @@ -78,7 +78,7 @@ class CList : public CControl void SetEnable(int i, bool bEnable); bool GetEnable(int i); - void SetTabs(int i, float pos, Gfx::TextAlign justif=Gfx::TEXT_ALIGN_CENTER); + void SetTabs(int i, float pos, Gfx::TextAlign justif=Gfx::TEXT_ALIGN_LEFT); float GetTabs(int i); void ShowSelect(bool bFixed); diff --git a/src/ui/slider.cpp b/src/ui/slider.cpp index 4394cc2..869fa42 100644 --- a/src/ui/slider.cpp +++ b/src/ui/slider.cpp @@ -471,7 +471,7 @@ void CSlider::Draw() h = m_engine->GetText()->GetHeight(m_fontType, m_fontSize); pos.x = m_pos.x+m_dim.x+(10.0f/640.0f); pos.y = m_pos.y+(m_dim.y-h)/2.0f; - m_engine->GetText()->DrawText(text, m_fontType, m_fontSize, pos, m_dim.x, Gfx::TEXT_ALIGN_RIGHT, 0); + m_engine->GetText()->DrawText(text, m_fontType, m_fontSize, pos, m_dim.x, Gfx::TEXT_ALIGN_LEFT, 0); } else { @@ -484,7 +484,7 @@ void CSlider::Draw() dim.x = 50.0f/640.0f; dim.y = 16.0f/480.0f; sprintf(text, "%d", (int)(m_min+(m_visibleValue*(m_max-m_min)))); - m_engine->GetText()->DrawText(text, m_fontType, m_fontSize, pos, dim.x, Gfx::TEXT_ALIGN_RIGHT, 0); + m_engine->GetText()->DrawText(text, m_fontType, m_fontSize, pos, dim.x, Gfx::TEXT_ALIGN_LEFT, 0); } } } diff --git a/src/ui/studio.cpp b/src/ui/studio.cpp index 7473a18..cde00c7 100644 --- a/src/ui/studio.cpp +++ b/src/ui/studio.cpp @@ -1090,14 +1090,14 @@ void CStudio::StartDialog(StudioDialog type) { GetResource(RES_TEXT, RT_IO_LIST, name); pla = pw->CreateLabel(pos, dim, 0, EVENT_DIALOG_LABEL1, name); - pla->SetTextAlign(Gfx::TEXT_ALIGN_RIGHT); + pla->SetTextAlign(Gfx::TEXT_ALIGN_LEFT); pli = pw->CreateList(pos, dim, 0, EVENT_DIALOG_LIST); pli->SetState(STATE_SHADOW); GetResource(RES_TEXT, RT_IO_NAME, name); pla = pw->CreateLabel(pos, dim, 0, EVENT_DIALOG_LABEL2, name); - pla->SetTextAlign(Gfx::TEXT_ALIGN_RIGHT); + pla->SetTextAlign(Gfx::TEXT_ALIGN_LEFT); pe = pw->CreateEdit(pos, dim, 0, EVENT_DIALOG_EDIT); pe->SetState(STATE_SHADOW); @@ -1108,7 +1108,7 @@ void CStudio::StartDialog(StudioDialog type) GetResource(RES_TEXT, RT_IO_DIR, name); pla = pw->CreateLabel(pos, dim, 0, EVENT_DIALOG_LABEL3, name); - pla->SetTextAlign(Gfx::TEXT_ALIGN_RIGHT); + pla->SetTextAlign(Gfx::TEXT_ALIGN_LEFT); pc = pw->CreateCheck(pos, dim, 0, EVENT_DIALOG_CHECK1); GetResource(RES_TEXT, RT_IO_PRIVATE, name); @@ -1233,7 +1233,7 @@ void CStudio::AdjustDialog() pli->SetPos(ppos); pli->SetDim(ddim); pli->SetTabs(0, ddim.x-(50.0f+130.0f+16.0f)/640.0f); - pli->SetTabs(1, 50.0f/640.0f, Gfx::TEXT_ALIGN_LEFT); + pli->SetTabs(1, 50.0f/640.0f, Gfx::TEXT_ALIGN_RIGHT); pli->SetTabs(2, 130.0f/640.0f); //? pli->ShowSelect(); } -- cgit v1.2.3-1-g7c22