- 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>
206 lines
5.3 KiB
C++
206 lines
5.3 KiB
C++
//----------------------------------------------------------------------------
|
|
// ObjectWindows - (C) Copyright 1991, 1993 by Borland International
|
|
//----------------------------------------------------------------------------
|
|
#include <owl\owlpch.h>
|
|
#include <owl\applicat.h>
|
|
#include <math.h>
|
|
#include "appbtnba.h"
|
|
#include "applaunc.rh"
|
|
|
|
DEFINE_RESPONSE_TABLE1(TAppButtonBar, TToolBox)
|
|
EV_WM_RBUTTONDOWN,
|
|
EV_WM_LBUTTONUP,
|
|
EV_WM_LBUTTONDOWN,
|
|
EV_WM_MOUSEMOVE,
|
|
END_RESPONSE_TABLE;
|
|
|
|
const int TAppButtonBar::AppButtonIdBase = 500;
|
|
|
|
|
|
void TAppButtonBar::SetupWindow()
|
|
{
|
|
TToolBox::SetupWindow();
|
|
DragState = 0;
|
|
OrigCursor = 0;
|
|
DragCursor = ::LoadCursor(GetModule()->GetInstance(),
|
|
MAKEINTRESOURCE(IDC_DRAG_BUTTON));
|
|
CM_PROPERTIES = ::RegisterWindowMessage("CM_PROPERTIES");
|
|
CM_BUTTON_PRESSED = ::RegisterWindowMessage("CM_BUTTON_PRESSED");
|
|
CM_BUTTON_DRAG = ::RegisterWindowMessage("CM_BUTTON_DRAG");
|
|
|
|
}
|
|
|
|
//
|
|
// MoveButton(). Move a button, specified by 'srcLoc', to another location,
|
|
// specified by 'destLoc'. The button to be 'moved' is removed from the
|
|
// button bar and then a new one (with same characteristics) is re-inserted into
|
|
// the proper place. Assumes that all the buttons will be re-ided after call.
|
|
//
|
|
void
|
|
TAppButtonBar::MoveButton(int srcLoc, int destLoc, const string& iconPath )
|
|
{
|
|
TAppButton* toMove = ButtonWithId(IdFromLoc(srcLoc));
|
|
TAppButton* toInsertBefore = ButtonWithId(IdFromLoc(destLoc));
|
|
TAppButton* newButton = new TAppButton(GetApplication()->GetInstance(),
|
|
iconPath, IdFromLoc(srcLoc));
|
|
|
|
if (toInsertBefore)
|
|
Insert(*newButton, Before, toInsertBefore);
|
|
else
|
|
Insert(*newButton, Before, GadgetWithId(IDB_APPREMOVER));
|
|
delete Remove(*toMove);
|
|
}
|
|
|
|
//
|
|
// ChangeOrientation(). Change layout of application buttons (vertical or
|
|
// horizontal).
|
|
//
|
|
void
|
|
TAppButtonBar::ChangeOrientation(TTileDirection direction)
|
|
{
|
|
SetDirection(direction);
|
|
}
|
|
|
|
//
|
|
// DestroyButton(). Delete a button given by location.
|
|
//
|
|
void
|
|
TAppButtonBar::DestroyButton(int loc)
|
|
{
|
|
TAppButton* b = ButtonWithId(IdFromLoc(loc));
|
|
Remove(*b);
|
|
delete b;
|
|
}
|
|
|
|
//
|
|
// Return button with given 'real' id.
|
|
//
|
|
TAppButton*
|
|
TAppButtonBar::ButtonWithId(int id)
|
|
{
|
|
TAppButton* b = TYPESAFE_DOWNCAST(FirstGadget(), TAppButton);
|
|
while (b) {
|
|
if (b->RealId == id)
|
|
return b;
|
|
else
|
|
b = TYPESAFE_DOWNCAST(NextGadget(*b), TAppButton);
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
//
|
|
// Flush(). Remove all buttons from button bar.
|
|
//
|
|
void
|
|
TAppButtonBar::Flush(int del)
|
|
{
|
|
TGadget* g = FirstGadget();
|
|
while (g) {
|
|
Remove(*g);
|
|
if (del)
|
|
delete g;
|
|
g = FirstGadget();
|
|
}
|
|
}
|
|
|
|
//
|
|
// EvRButtonDown(). Send message (CM_PROPERTIES) to main window so
|
|
// properties dialog can be displayed for this button.
|
|
//
|
|
void
|
|
TAppButtonBar::EvRButtonDown(UINT /*modKeys*/, TPoint& point)
|
|
{
|
|
TAppButton* temp;
|
|
if ((temp = TYPESAFE_DOWNCAST(GadgetFromPoint(point), TAppButton)) != 0)
|
|
Parent->PostMessage(CM_PROPERTIES, temp->RealId, 0);
|
|
}
|
|
|
|
//
|
|
// EvLButtonUp(). If a drag was in program send a message, CM_BUTTON_DRAG,
|
|
// to main window. If button was simple pressed send message,
|
|
// CM_BUTTON_PRESSED, to main window so selected app can be run.
|
|
//
|
|
void
|
|
TAppButtonBar::EvLButtonUp(UINT modKeys, TPoint& point)
|
|
{
|
|
TAppButton* temp = TYPESAFE_DOWNCAST(GadgetFromPoint(point), TAppButton);
|
|
|
|
if (DragState == 2) {
|
|
TPoint screenPoint(point);
|
|
|
|
ClientToScreen(screenPoint);
|
|
ResetOrigCursor();
|
|
if ((temp && temp->RealId != DragButtonId) || !temp &&
|
|
Parent->GetWindowRect().Contains(screenPoint))
|
|
Parent->PostMessage(CM_BUTTON_DRAG, DragButtonId,
|
|
MAKELPARAM(point.x, point.y));
|
|
} else {
|
|
if (temp != 0)
|
|
Parent->PostMessage(CM_BUTTON_PRESSED, temp->RealId, LPARAM(HWindow));
|
|
}
|
|
DragState = 0;
|
|
TToolBox::EvLButtonUp(modKeys, point);
|
|
}
|
|
|
|
//
|
|
// EvLButtonDown(). Indicate that a possible button drag is in progress.
|
|
//
|
|
void
|
|
TAppButtonBar::EvLButtonDown(UINT modKeys, TPoint& point)
|
|
{
|
|
TAppButton* temp = TYPESAFE_DOWNCAST(GadgetFromPoint(point), TAppButton);
|
|
if (temp && temp->GetId() != IDB_APPREMOVER) {
|
|
DragButtonId = temp->RealId;
|
|
DragState = 1;
|
|
StartDragPoint = point;
|
|
}
|
|
TToolBox::EvLButtonDown(modKeys, point);
|
|
}
|
|
|
|
//
|
|
// EvMouseMove(). If dragging, set the cursor. A check is made
|
|
// to see if we have moved far enough to regard the mouse move as a drag.
|
|
//
|
|
void
|
|
TAppButtonBar::EvMouseMove(UINT modKeys, TPoint& point)
|
|
{
|
|
if (DragState == 1 && (abs(point.x - StartDragPoint.x) > 5 ||
|
|
abs(point.y - StartDragPoint.y) > 5)) {
|
|
DragState = 2;
|
|
SetDragCursor();
|
|
}
|
|
TToolBox::EvMouseMove(modKeys, point);
|
|
}
|
|
|
|
//
|
|
// ReDraw(). Begin a layout session. Then move window so everthing gets
|
|
// drawn again.
|
|
//
|
|
void
|
|
TAppButtonBar::ReDraw()
|
|
{
|
|
LayoutSession();
|
|
}
|
|
|
|
//
|
|
// SetDragCursor(). Change cursor to button drag cursor.
|
|
//
|
|
void
|
|
TAppButtonBar::SetDragCursor()
|
|
{
|
|
if (!OrigCursor)
|
|
OrigCursor = ::GetCursor();
|
|
::SetCursor(DragCursor);
|
|
}
|
|
|
|
//
|
|
// ResetOrigCursor(). Change cursor back to whatever is was before.
|
|
//
|
|
void
|
|
TAppButtonBar::ResetOrigCursor()
|
|
{
|
|
if (OrigCursor)
|
|
::SetCursor(OrigCursor);
|
|
OrigCursor = 0;
|
|
}
|