From a134cb75c5dd2570b9aeb1530701086d4f3f593d Mon Sep 17 00:00:00 2001 From: Piotr Dziwinski Date: Sat, 29 Dec 2012 15:01:57 +0100 Subject: Merge of master and dev --- src/ui/edit.cpp | 60 ++++++++++++++++++++++++++++----------------------- src/ui/edit.h | 2 ++ src/ui/maindialog.cpp | 20 ++++++++--------- 3 files changed, 45 insertions(+), 37 deletions(-) (limited to 'src/ui') diff --git a/src/ui/edit.cpp b/src/ui/edit.cpp index e14b19d..639215a 100644 --- a/src/ui/edit.cpp +++ b/src/ui/edit.cpp @@ -243,7 +243,7 @@ bool CEdit::EventProcess(const Event &event) Scroll(m_lineFirst-3, true); return true; } - if (event.type == EVENT_KEY_DOWN && + if (event.type == EVENT_MOUSE_WHEEL && event.mouseWheel.dir == WHEEL_DOWN && Detect(event.mousePos) ) { @@ -282,7 +282,7 @@ bool CEdit::EventProcess(const Event &event) } } - if ( m_scroll != 0 && !m_bGeneric ) + if ( m_scroll != nullptr && !m_bGeneric ) { m_scroll->EventProcess(event); @@ -1248,7 +1248,7 @@ void CEdit::SetText(const char *text, bool bNew) { int i, j, font; bool bBOL; - + if ( !bNew ) UndoMemorize(OPERUNDO_SPEC); m_len = strlen(text); @@ -2172,11 +2172,11 @@ void CEdit::Scroll() { float value; - if ( m_scroll != 0 ) + if ( m_scroll != nullptr ) { value = m_scroll->GetVisibleValue(); - value *= m_lineTotal-m_lineVisible; - Scroll(static_cast(value+0.5f), true); + value *= m_lineTotal - m_lineVisible; + Scroll(static_cast(value + 0.5f), true); } } @@ -3048,7 +3048,7 @@ bool CEdit::MinMaj(bool bMaj) void CEdit::Justif() { - float width, value, size, indentLength; + float width, size, indentLength; int i, j, line, indent; bool bDual, bString, bRem; @@ -3176,26 +3176,7 @@ void CEdit::Justif() m_lineFirst = 0; } - if ( m_scroll != 0 ) - { - if ( m_lineTotal <= m_lineVisible ) - { - m_scroll->SetVisibleRatio(1.0f); - m_scroll->SetVisibleValue(0.0f); - m_scroll->SetArrowStep(0.0f); - } - else - { - value = static_cast(m_lineVisible/m_lineTotal); - m_scroll->SetVisibleRatio(value); - - value = static_cast(m_lineFirst/(m_lineTotal-m_lineVisible)); - m_scroll->SetVisibleValue(value); - - value = static_cast(1.0f/(m_lineTotal-m_lineVisible)); - m_scroll->SetArrowStep(value); - } - } + UpdateScroll(); m_timeBlink = 0.0f; // lights the cursor immediately } @@ -3326,5 +3307,30 @@ bool CEdit::SetFormat(int cursor1, int cursor2, int format) return true; } +void CEdit::UpdateScroll() +{ + float value; + + if ( m_scroll != nullptr ) + { + if ( m_lineTotal <= m_lineVisible ) + { + m_scroll->SetVisibleRatio(1.0f); + m_scroll->SetVisibleValue(0.0f); + m_scroll->SetArrowStep(0.0f); + } + else + { + value = static_cast(m_lineVisible) / m_lineTotal; + m_scroll->SetVisibleRatio(value); + + value = static_cast(m_lineFirst) / (m_lineTotal - m_lineVisible); + m_scroll->SetVisibleValue(value); + + value = 1.0f / (m_lineTotal - m_lineVisible); + m_scroll->SetArrowStep(value); + } + } +} } diff --git a/src/ui/edit.h b/src/ui/edit.h index 35d8b2c..7247181 100644 --- a/src/ui/edit.h +++ b/src/ui/edit.h @@ -234,6 +234,8 @@ protected: void UndoFlush(); void UndoMemorize(OperUndo oper); bool UndoRecall(); + + void UpdateScroll(); protected: CScroll* m_scroll; // vertical scrollbar on the right diff --git a/src/ui/maindialog.cpp b/src/ui/maindialog.cpp index ebf7d10..68e7854 100644 --- a/src/ui/maindialog.cpp +++ b/src/ui/maindialog.cpp @@ -4305,8 +4305,8 @@ void CMainDialog::IOReadName() } } - // TODO: language letters - sprintf(op, "Title.%c", 'E' /*MAX_FNAME()*/ ); + // TODO: Fallback to an non-localized entry + sprintf(op, "Title.%c", m_app->GetLanguageChar() ); if ( Cmd(line, op) ) { OpString(line, "resume", resume); @@ -4701,8 +4701,8 @@ void CMainDialog::UpdateSceneChap(int &chap) } } - /* TODO: language letters */ - sprintf(op, "Title.%c", 'E' /*GetLanguageLetter()*/); + // TODO: Fallback to an non-localized entry + sprintf(op, "Title.%c", m_app->GetLanguageChar()); if ( Cmd(line, op) ) { OpString(line, "text", name); @@ -4748,8 +4748,8 @@ void CMainDialog::UpdateSceneChap(int &chap) } } - // TODO: language letters - sprintf(op, "Title.%c", 'E'/*GetLanguageLetter()*/); + // TODO: Fallback to an non-localized entry + sprintf(op, "Title.%c", m_app->GetLanguageChar()); if ( Cmd(line, op) ) { OpString(line, "text", name); @@ -4851,8 +4851,8 @@ void CMainDialog::UpdateSceneList(int chap, int &sel) } } - // TODO: language letters - sprintf(op, "Title.%c", 'E' /*MAX_FNAME()*/); + // TODO: Fallback to an non-localized entry + sprintf(op, "Title.%c", m_app->GetLanguageChar()); if ( Cmd(line, op) ) { OpString(line, "text", name); @@ -4996,8 +4996,8 @@ void CMainDialog::UpdateSceneResume(int rank) } } - // TODO: language letters - sprintf(op, "Resume.%c", 'E' /*MAX_FNAME()*/); + // TODO: Fallback to an non-localized entry + sprintf(op, "Resume.%c", m_app->GetLanguageChar()); if ( Cmd(line, op) ) { OpString(line, "text", name); -- cgit v1.2.3-1-g7c22