shithub: ft2-clone

Download patch

ref: a27852654d9784d36f24478dff46df1e74cb5065
parent: 53456ab178ac8f0e9399af1cf87122a2fc479fe8
author: Olav Sørensen <olav.sorensen@live.no>
date: Wed Jan 13 16:36:19 EST 2021

Don't cache scrollbar parameters (caused stupid bugs)

--- a/src/ft2_help.c
+++ b/src/ft2_help.c
@@ -438,9 +438,6 @@
 	fHlp_Nr = Nr;
 	fHlp_Line = 0;
 
-	// force update even if new pos value was to be the same as old
-	scrollBars[SB_HELP_SCROLL].oldPos = UINT32_MAX;
-
 	setScrollBarEnd(SB_HELP_SCROLL, subjLen[fHlp_Nr]);
 	setScrollBarPos(SB_HELP_SCROLL, 0, false);
 }
--- a/src/ft2_pattern_ed.c
+++ b/src/ft2_pattern_ed.c
@@ -362,10 +362,7 @@
 	{
 		cursor.ch = (uint8_t)(song.antChn - 1);
 		if (ui.pattChanScrollShown)
-		{
-			scrollBars[SB_CHAN_SCROLL].oldPos = UINT32_MAX; // kludge
 			setScrollBarPos(SB_CHAN_SCROLL, song.antChn, true);
-		}
 	}
 	else
 	{
@@ -386,10 +383,7 @@
 	{
 		cursor.ch = 0;
 		if (ui.pattChanScrollShown)
-		{
-			scrollBars[SB_CHAN_SCROLL].oldPos = UINT32_MAX; // kludge
 			setScrollBarPos(SB_CHAN_SCROLL, 0, true);
-		}
 	}
 	else
 	{
@@ -603,11 +597,6 @@
 			p->y = iSwitchY[i & 7];
 		}
 	}
-
-	// force update even if new values were to be the same as the old ones
-	scrollBars[SB_POS_ED].oldEnd = UINT32_MAX;
-	scrollBars[SB_POS_ED].oldPage = UINT32_MAX;
-	scrollBars[SB_POS_ED].oldPos = UINT32_MAX;
 }
 
 void patternEditorExtended(void)
--- a/src/ft2_scrollbars.c
+++ b/src/ft2_scrollbars.c
@@ -377,11 +377,6 @@
 	assert(scrollBarID < NUM_SCROLLBARS);
 	scrollBar_t *scrollBar = &scrollBars[scrollBarID];
 
-	if (scrollBar->oldPos == pos)
-		return;
-
-	scrollBar->oldPos = pos;
-
 	if (scrollBar->page == 0)
 	{
 		scrollBar->pos = 0;
@@ -429,11 +424,6 @@
 	if (end < 1)
 		end = 1;
 
-	if (scrollBar->oldEnd == end)
-		return;
-
-	scrollBar->oldEnd = end;
-
 	scrollBar->end = end;
 	
 	bool setPos = false;
@@ -466,11 +456,6 @@
 	if (pageLength < 1)
 		pageLength = 1;
 
-	if (scrollBar->oldPage == pageLength)
-		return;
-
-	scrollBar->oldPage = pageLength;
-
 	scrollBar->page = pageLength;
 	if (scrollBar->end > 0)
 	{
@@ -675,14 +660,6 @@
 
 void initializeScrollBars(void)
 {
-	scrollBar_t *scrollBar = scrollBars;
-	for (int32_t i = 0; i < NUM_SCROLLBARS; i++, scrollBar++)
-	{
-		scrollBar->oldEnd = UINT32_MAX;
-		scrollBar->oldPage = UINT32_MAX;
-		scrollBar->oldPos = UINT32_MAX;
-	}
-
 	// pattern editor
 	setScrollBarPageLength(SB_CHAN_SCROLL, 8);
 	setScrollBarEnd(SB_CHAN_SCROLL, 8);
--- a/src/ft2_scrollbars.h
+++ b/src/ft2_scrollbars.h
@@ -75,7 +75,6 @@
 	bool visible;
 	uint8_t state;
 	uint32_t pos, page, end;
-	uint32_t oldPos, oldPage, oldEnd;
 	uint16_t thumbX, thumbY, thumbW, thumbH, realThumbLength;
 } scrollBar_t;