Skip to content

Commit

Permalink
clock drawing fix
Browse files Browse the repository at this point in the history
  • Loading branch information
alabuzhev committed Jun 18, 2016
1 parent 0d3e62d commit 9cb499b
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 1 deletion.
4 changes: 4 additions & 0 deletions far/changelog
@@ -1,3 +1,7 @@
drkns 18.06.2016 13:55:55 +0200 - build 4715

1. С форума: неверная прорисовка часов с учетом региональных настроек.

drkns 18.06.2016 12:52:50 +0200 - build 4714

1. С форума: после копирования или переноса исчезают значки жестких ссылок на пассивной панели.
Expand Down
1 change: 1 addition & 0 deletions far/global.hpp
Expand Up @@ -74,6 +74,7 @@ class global: noncopyable
size_t PluginPanelsCount;
BOOL ProcessException;
string CurrentTime;
size_t LastShownTimeSize;
const wchar_t *HelpFileMask;
bool OnlyEditorViewerUsed; // -e or -v
#if defined(SYSLOG)
Expand Down
9 changes: 9 additions & 0 deletions far/interf.cpp
Expand Up @@ -578,10 +578,19 @@ void ShowTime()

if (const auto CurrentWindow = Global->WindowManager->GetCurrentWindow())
{
// TODO: This is rubbish, consider moving the clock drawing to the ScrBuf
if (Global->CurrentTime.size() < Global->LastShownTimeSize)
{
const auto CurrentClockPos = ScrX + 1 - static_cast<int>(Global->LastShownTimeSize);
matrix<FAR_CHAR_INFO> Char(1, 1);
Global->ScrBuf->Read(CurrentClockPos - 1, 0, CurrentClockPos - 1, 0, Char);
Global->ScrBuf->FillRect(CurrentClockPos, 0, CurrentClockPos + static_cast<int>(Global->LastShownTimeSize), 0, Char[0][0].Char, Char[0][0].Attributes);
}
GotoXY(static_cast<int>(ScrX + 1 - Global->CurrentTime.size()), 0);
int ModType=CurrentWindow->GetType();
SetColor(ModType==windowtype_viewer?COL_VIEWERCLOCK:(ModType==windowtype_editor?COL_EDITORCLOCK:COL_CLOCK));
Text(Global->CurrentTime);
Global->LastShownTimeSize = Global->CurrentTime.size();
}
}

Expand Down
2 changes: 1 addition & 1 deletion far/vbuild.m4
@@ -1 +1 @@
m4_define(BUILD,4714)m4_dnl
m4_define(BUILD,4715)m4_dnl

0 comments on commit 9cb499b

Please sign in to comment.