- BORLAND/: Borland C++ 4.52 (chosen over 4.5 by byte-match: CODE/RP/CW32.LIB
is identical to 4.52's install lib). BCC32/TLINK32/TLIB/MAKE run natively on
Win11; CODE/BT/OPT.MAK is the shipped BTL4OPT.EXE's exact flag recipe
(extender = Borland PowerPack DPMI32, not Phar Lap TNT).
- restoration/source410/: the literal 1995-form reconstruction of the missing
BT game source (never mixed into CODE/). Round 1-3 state:
* 6 of 10 surviving original TUs COMPILE CLEAN under the period toolchain
(BTMSSN, BTCNSL, BTSCNRL, BTTEAM, BTL4MODE, BTL4ARND) - first builds
since 1996.
* BT_L4/BTL4APP.CPP pilot reconstruction: 12/12 functions, Fail() lands on
its binary-recorded line 400 exactly.
* BT/BTCNSL.HPP: console wire IDs recovered from the binary's ctors
(Killed=9, Damaged=10, ScoreUpdate=13, DeathWithoutHonor=15 [T1];
TeamScore=12 flagged [T4]).
* MUNGA/: 8 engine-header backfills back-dated from the BT412 WinTesla tree
(VDATA numbering decomp-verified; AUDREND's OpenAL-era virtual removed -
the period compiler is the drift detector).
* Tooling: backdate.py (WinTesla->1995 header transform), compile410.sh
(per-TU verification sweep under authentic OPT.MAK flags).
* README: corrected roadmap - MECH.HPP is the capstone grown with the mech
TU reconstructions; BTREG.CPP green = the header-family milestone.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
270 lines
5.6 KiB
C++
270 lines
5.6 KiB
C++
//----------------------------------------------------------------------------
|
|
// ObjectWindows
|
|
// (C) Copyright 1991, 1994 by Borland International, All Rights Reserved
|
|
//
|
|
// Implementation of class TScrollBar. This defines the basic
|
|
// behavior of all scrollbar controls.
|
|
//----------------------------------------------------------------------------
|
|
#pragma hdrignore SECTION
|
|
#include <owl/owlpch.h>
|
|
#include <owl/scrollba.h>
|
|
|
|
#if !defined(SECTION) || SECTION == 1
|
|
|
|
DEFINE_RESPONSE_TABLE1(TScrollBar, TControl)
|
|
EV_WM_VSCROLL,
|
|
EV_WM_HSCROLL,
|
|
END_RESPONSE_TABLE;
|
|
|
|
//
|
|
// constructor for a TScrollBar object
|
|
//
|
|
// if the size attribute(H for horizontal scrollbars, W for vertical) is
|
|
// zero, the attribute is set to the appropriate system metric
|
|
//
|
|
TScrollBar::TScrollBar(TWindow* parent,
|
|
int id,
|
|
int x, int y, int w, int h,
|
|
bool isHScrollBar,
|
|
TModule* module)
|
|
:
|
|
TControl(parent, id, 0, x, y, w, h, module)
|
|
{
|
|
LineMagnitude = 1;
|
|
PageMagnitude = 10;
|
|
|
|
if (isHScrollBar) {
|
|
Attr.Style |= SBS_HORZ;
|
|
|
|
if (Attr.H == 0)
|
|
Attr.H = GetSystemMetrics(SM_CYHSCROLL);
|
|
}
|
|
else {
|
|
Attr.Style |= SBS_VERT;
|
|
|
|
if (Attr.W == 0)
|
|
Attr.W = GetSystemMetrics(SM_CXVSCROLL);
|
|
}
|
|
}
|
|
|
|
TScrollBar::TScrollBar(TWindow* parent,
|
|
int resourceId,
|
|
TModule* module)
|
|
:
|
|
TControl(parent, resourceId, module)
|
|
{
|
|
LineMagnitude = 1;
|
|
PageMagnitude = 10;
|
|
}
|
|
|
|
//
|
|
// transfers state information for a TScrollbar
|
|
//
|
|
// direction specifies whether data is to be read from or written to the
|
|
// buffer, or whether the data element size is simply to be returned
|
|
//
|
|
// the return value is the size (in bytes) of the transfer data
|
|
//
|
|
uint
|
|
TScrollBar::Transfer(void* buffer, TTransferDirection direction)
|
|
{
|
|
TScrollBarData* scrollBuff = (TScrollBarData*)buffer;
|
|
|
|
if (direction == tdGetData) {
|
|
GetRange(scrollBuff->LowValue, scrollBuff->HighValue);
|
|
scrollBuff->Position = GetPosition();
|
|
}
|
|
else if (direction == tdSetData) {
|
|
SetRange(scrollBuff->LowValue, scrollBuff->HighValue);
|
|
SetPosition(scrollBuff->Position);
|
|
}
|
|
|
|
return sizeof(TScrollBarData);
|
|
}
|
|
|
|
//
|
|
// Return name of predefined Windows scrollbar class
|
|
//
|
|
char far *
|
|
TScrollBar::GetClassName()
|
|
{
|
|
return "SCROLLBAR";
|
|
}
|
|
|
|
//
|
|
// initialize the scrollbar to the default range of 0 .. 100
|
|
//
|
|
void
|
|
TScrollBar::SetupWindow()
|
|
{
|
|
SetRange(0, 100);
|
|
TControl::SetupWindow();
|
|
}
|
|
|
|
//
|
|
// sets the position of the thumb
|
|
//
|
|
void
|
|
TScrollBar::SetPosition(int thumbPos)
|
|
{
|
|
int min, max;
|
|
GetRange(min, max);
|
|
|
|
//
|
|
// constrain "thumbPos" to be in the range "min .. max"
|
|
//
|
|
if (thumbPos > max)
|
|
thumbPos = max;
|
|
|
|
else if (thumbPos < min)
|
|
thumbPos = min;
|
|
|
|
if (thumbPos != GetPosition())
|
|
::SetScrollPos(HWindow, SB_CTL, thumbPos, true);
|
|
}
|
|
|
|
//
|
|
// changes the position of the thumb by "delta" and returns the new position
|
|
//
|
|
int
|
|
TScrollBar::DeltaPos(int delta)
|
|
{
|
|
if (delta != 0)
|
|
SetPosition(GetPosition() + delta);
|
|
|
|
return GetPosition();
|
|
}
|
|
|
|
//
|
|
// changes the position of the thumb by "LineMagnitude"
|
|
//
|
|
void
|
|
TScrollBar::SBLineUp()
|
|
{
|
|
DeltaPos(-LineMagnitude);
|
|
}
|
|
|
|
//
|
|
// changes the position of the thumb by "LineMagnitude"
|
|
//
|
|
void
|
|
TScrollBar::SBLineDown()
|
|
{
|
|
DeltaPos(LineMagnitude);
|
|
}
|
|
|
|
//
|
|
// changes the position of the thumb by "PageMagnitude"
|
|
//
|
|
void
|
|
TScrollBar::SBPageUp()
|
|
{
|
|
DeltaPos(-PageMagnitude);
|
|
}
|
|
|
|
//
|
|
// changes the position of the thumb by "PageMagnitude"
|
|
//
|
|
void
|
|
TScrollBar::SBPageDown()
|
|
{
|
|
DeltaPos(PageMagnitude);
|
|
}
|
|
|
|
//
|
|
// moves the thumb to the new position
|
|
//
|
|
void
|
|
TScrollBar::SBThumbPosition(int thumbPos)
|
|
{
|
|
SetPosition(thumbPos);
|
|
}
|
|
|
|
//
|
|
// moves the thumb to the new position
|
|
//
|
|
void
|
|
TScrollBar::SBThumbTrack(int thumbPos)
|
|
{
|
|
SetPosition(thumbPos);
|
|
}
|
|
|
|
//
|
|
// moves the thumb to the top of the scrollbar
|
|
//
|
|
void
|
|
TScrollBar::SBTop()
|
|
{
|
|
int min, max;
|
|
GetRange(min, max);
|
|
SetPosition(min);
|
|
}
|
|
|
|
//
|
|
// moves the thumb to the bottom of the scrollbar
|
|
//
|
|
void
|
|
TScrollBar::SBBottom()
|
|
{
|
|
int min, max;
|
|
GetRange(min, max);
|
|
SetPosition(max);
|
|
}
|
|
|
|
void
|
|
TScrollBar::SBEndScroll()
|
|
{
|
|
}
|
|
|
|
void
|
|
TScrollBar::EvHScroll(uint scrollCode, uint thumbPos, HWND /*hWndCtl*/)
|
|
{
|
|
switch (scrollCode) {
|
|
case SB_LINEDOWN: SBLineDown(); break;
|
|
case SB_LINEUP: SBLineUp(); break;
|
|
case SB_PAGEDOWN: SBPageDown(); break;
|
|
case SB_PAGEUP: SBPageUp(); break;
|
|
case SB_TOP: SBTop(); break;
|
|
case SB_BOTTOM: SBBottom(); break;
|
|
case SB_THUMBPOSITION: SBThumbPosition(thumbPos); break;
|
|
case SB_THUMBTRACK: SBThumbTrack(thumbPos); break;
|
|
case SB_ENDSCROLL: SBEndScroll();
|
|
}
|
|
}
|
|
|
|
void
|
|
TScrollBar::EvVScroll(uint scrollCode, uint thumbPos, HWND hWndCtl)
|
|
{
|
|
EvHScroll(scrollCode, thumbPos, hWndCtl);
|
|
}
|
|
|
|
#endif
|
|
#if !defined(SECTION) || SECTION == 2
|
|
|
|
IMPLEMENT_STREAMABLE1(TScrollBar, TControl);
|
|
|
|
//
|
|
// Reads an instance of TScrollBar from the passed ipstream.
|
|
//
|
|
void*
|
|
TScrollBar::Streamer::Read(ipstream& is, uint32 /*version*/) const
|
|
{
|
|
ReadBaseObject((TControl*)GetObject(), is);
|
|
is >> GetObject()->LineMagnitude
|
|
>> GetObject()->PageMagnitude;
|
|
return GetObject();
|
|
}
|
|
|
|
//
|
|
// Writes the TScrollBar to the passed opstream.
|
|
//
|
|
void
|
|
TScrollBar::Streamer::Write(opstream& os) const
|
|
{
|
|
WriteBaseObject((TControl*)GetObject(), os);
|
|
os << GetObject()->LineMagnitude
|
|
<< GetObject()->PageMagnitude;
|
|
}
|
|
|
|
#endif
|