From 8f785ba9d356a1c06339d3308eb5f820818606e2 Mon Sep 17 00:00:00 2001 From: owomomo Date: Mon, 5 Oct 2020 21:32:47 +0800 Subject: [PATCH] Fix issue #101 the note of separator shifts after reload. --- src/drivers/win/ramwatch.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/drivers/win/ramwatch.cpp b/src/drivers/win/ramwatch.cpp index fe37af4f..fd294bf9 100644 --- a/src/drivers/win/ramwatch.cpp +++ b/src/drivers/win/ramwatch.cpp @@ -1659,6 +1659,16 @@ void SeparatorCache::Init(HWND hBox) GetObject((HANDLE)SendMessage(hBox, WM_GETFONT, NULL, NULL), sizeof(logFont), &logFont); sepFon = (HFONT)CreateFontIndirect((logFont.lfWeight = FW_SEMIBOLD, &logFont)); } + + // if watches exists before separator cache initialize, + // recalculate their values as they are porbably incorrect. + if (WatchCount) + { + separatorCache.clear(); + for (int i = 0; i < WatchCount; ++i) + if (rswatches[i].Type == 'S') + separatorCache[i] = SeparatorCache(RamWatchHWnd, rswatches[i].comment); + } } void SeparatorCache::DeInit() @@ -1670,6 +1680,8 @@ void SeparatorCache::DeInit() sepPen = NULL; sepPenSel = NULL; sepFon = NULL; + + separatorCache.clear(); }