summaryrefslogtreecommitdiff
path: root/src/T2DLL/T2DlgItemScr.cpp
diff options
context:
space:
mode:
authorAsh Wolf <ninji@wuffs.org>2023-06-28 22:22:32 +0100
committerAsh Wolf <ninji@wuffs.org>2023-06-28 22:22:32 +0100
commitc0c336500955a23e344651e5412c9d9d441ef4ee (patch)
tree790769c748db307cf3314f6e896e2f61c68561a2 /src/T2DLL/T2DlgItemScr.cpp
parent37e364b2c6cc7487a1c888d256a73e5337bb7189 (diff)
downloadt2win-c0c336500955a23e344651e5412c9d9d441ef4ee.tar.gz
t2win-c0c336500955a23e344651e5412c9d9d441ef4ee.zip
first pass of T2DLL
Diffstat (limited to '')
-rw-r--r--src/T2DLL/T2DlgItemScr.cpp28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/T2DLL/T2DlgItemScr.cpp b/src/T2DLL/T2DlgItemScr.cpp
index 692c9a6..9f4cb21 100644
--- a/src/T2DLL/T2DlgItemScr.cpp
+++ b/src/T2DLL/T2DlgItemScr.cpp
@@ -48,7 +48,7 @@ T2DlgItemScr::T2DlgItemScr(T2TowerDoc* towerDoc, T2ImageObj* imageObj, CPalette*
mClickedArea = ScrollBarHittest(pt);
if (mClickedArea != 0) {
- if (mClickedArea == Area_SetAbsolute) {
+ if (mClickedArea == Area_Thumb) {
mMouseDownPoint = pt;
mMouseDownValue = mValue;
} else {
@@ -82,17 +82,17 @@ T2DlgItemScr::T2DlgItemScr(T2TowerDoc* towerDoc, T2ImageObj* imageObj, CPalette*
GetClientRect(clientRect);
switch (mClickedArea) {
- case Area_SetAbsolute: {
- int a, b;
+ case Area_Thumb: {
+ int thumbPosition, thumbSize;
clientRect.DeflateRect(0, 16);
- CalcScrollBarThumb(&a, &b);
+ CalcScrollBarThumb(&thumbPosition, &thumbSize);
- int val = PositionToValue(clientRect) - b;
+ int val = PositionToValue(clientRect) - thumbSize;
if (val == 0)
val = 1;
ScrollBarAction(
- Area_SetAbsolute,
+ Area_Thumb,
mMouseDownValue + ((PositionToValue(pt) - PositionToValue(mMouseDownPoint)) * (mRange - mPage)) / val
);
break;
@@ -123,10 +123,10 @@ T2DlgItemScr::T2DlgItemScr(T2TowerDoc* towerDoc, T2ImageObj* imageObj, CPalette*
}
}
-void T2DlgItemScr::CalcScrollBarThumb(int* a, int* b) const {
+void T2DlgItemScr::CalcScrollBarThumb(int* thumbPosition, int* thumbSize) const {
if (!IsScrollable()) {
- *a = 16;
- *b = 0;
+ *thumbPosition = 16;
+ *thumbSize = 0;
} else {
CRect clientRect;
GetClientRect(clientRect);
@@ -134,10 +134,10 @@ void T2DlgItemScr::CalcScrollBarThumb(int* a, int* b) const {
int value = PositionToValue(clientRect);
value -= 32;
- *b = (value * mPage) / mRange;
- if (*b < 10)
- *b = 10;
- *a = (((value - *b) * mValue) / (mRange - mPage)) + 16;
+ *thumbSize = (value * mPage) / mRange;
+ if (*thumbSize < 10)
+ *thumbSize = 10;
+ *thumbPosition = (((value - *thumbSize) * mValue) / (mRange - mPage)) + 16;
}
}
@@ -152,7 +152,7 @@ void T2DlgItemScr::ScrollBarAction(int area, int arg) {
case Area_PageUp:
mValue -= mPage / 2;
break;
- case Area_SetAbsolute:
+ case Area_Thumb:
mValue = arg;
break;
case Area_PageDown: