Files
TeslaRel410/BORLAND/BC45/EXAMPLES/OWL/OWLAPPS/CURSOR/CURSOR.CPP
T
CydandClaude Fable 5 63312e07f9 source410: literal 4.10 source reconstruction + BC++ 4.52 fleet toolchain archived
- 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>
2026-07-19 07:33:26 -05:00

205 lines
5.6 KiB
C++

//----------------------------------------------------------------------------
// ObjectWindows - (C) Copyright 1991, 1993 by Borland International
//----------------------------------------------------------------------------
#include <owl\owlpch.h>
#include <owl\applicat.h>
#include <owl\dialog.h>
#include <owl\framewin.h>
#include <stdlib.h>
#include "cursor.h"
class TCursorDlg : public TDialog {
public:
TCursorDlg(TWindow* parent, const char far* name);
void UpdateDialog();
BOOL ShouldUpdate() {return Update;}
protected:
void SetupWindow();
void CloseWindow(int);
void CmOk() {} // Override the meaning of OK & Cancel to do nothing.
void CmCancel() {}
private:
BOOL Update;
DECLARE_RESPONSE_TABLE(TCursorDlg);
};
DEFINE_RESPONSE_TABLE1(TCursorDlg, TDialog)
EV_COMMAND(IDOK, CmOk),
EV_COMMAND(IDCANCEL, CmCancel),
END_RESPONSE_TABLE;
TCursorDlg::TCursorDlg(TWindow* parent, const char far* name)
: TWindow(parent),
TDialog(parent, name),
Update(FALSE)
{
EnableAutoCreate();
}
void
TCursorDlg::SetupWindow()
{
TDialog::SetupWindow();
Update = TRUE;
}
void
TCursorDlg::CloseWindow(int retVal)
{
Update = FALSE; // disable updating
TDialog::CloseWindow(retVal);
}
void
TCursorDlg::UpdateDialog()
{
TPoint Point;
static TPoint prevPoint(-1,-1);
static HWND hPrevWnd = (HWND)-1;
static HWND hPrevParent = (HWND)-1;
HWND hWndFromPt;
HWND hParent = hPrevParent;
HWND hFocus;
static HWND hPrevFocus = (HWND)-1;
static TRect Rect;
static TRect prevRect(-1, -1, -1, -1);
char buffer[26];
if (Update) {
GetCursorPos(Point);
// If the cursor position has changed...
//
if (Point != prevPoint) {
prevPoint = Point;
SetDlgItemText(IDD_SX, ltoa(Point.x, buffer, 10));
SetDlgItemText(IDD_SY, ltoa(Point.y, buffer, 10));
if ((hWndFromPt = ::WindowFromPoint(Point)) != 0) {
// Set the x and y coordinates in terms
// of the client area of the underlying window.
//
::ScreenToClient(hWndFromPt, &Point);
SetDlgItemText(IDD_WX, ltoa(Point.x, buffer, 10));
SetDlgItemText(IDD_WY, ltoa(Point.y, buffer, 10));
if ((hParent = ::GetParent(hWndFromPt)) != 0) {
// Set the x and y coordinates in terms of the client area of
// the parent of the window.
//
Point = prevPoint;
::ScreenToClient(hParent, &Point);
SetDlgItemText(IDD_PX, ltoa(Point.x, buffer, 10));
SetDlgItemText(IDD_PY, ltoa(Point.y, buffer, 10));
} else {
// If the window has no parent,
// leave the x and y fields blank.
//
SetDlgItemText(IDD_PX, "");
SetDlgItemText(IDD_PY, "");
}
// If there is no window at the current point,
// the x and y coordinates should be blank
// in the dialog box.
//
} else {
SetDlgItemText(IDD_WX, "");
SetDlgItemText(IDD_WY, "");
}
// Update the display of the handle of the
// underlying window if necessary.
//
if (hWndFromPt != hPrevWnd)
SetDlgItemText(IDD_HW, itoa((UINT)hWndFromPt, buffer, 16));
// If the parent window has changed,
// update the display of its handle.
//
if (hParent != hPrevParent) {
if (!hWndFromPt || !hParent)
SetDlgItemText(IDD_HP, "");
else
SetDlgItemText(IDD_HP, itoa((UINT)hParent, buffer, 16));
} else {
// If there is no underlying window,
// do not display a handle for a parent.
//
if (!hWndFromPt)
SetDlgItemText(IDD_HP, "");
}
hPrevWnd = hWndFromPt;
hPrevParent = hParent;
}
// Update the focus display fields if necessary.
//
hFocus = ::GetFocus();
if (!hFocus) {
if (hFocus != hPrevFocus) {
SetDlgItemText(IDD_HF, "");
SetDlgItemText(IDD_LEFT, "");
SetDlgItemText(IDD_TOP, "");
SetDlgItemText(IDD_RIGHT, "");
SetDlgItemText(IDD_BOTTOM, "");
}
} else {
if (hFocus != hPrevFocus) {
SetDlgItemText(IDD_HF, itoa((UINT)hFocus, buffer, 16));
}
::GetWindowRect(hFocus, &Rect);
if (Rect != prevRect) {
prevRect = Rect;
SetDlgItemText(IDD_LEFT, ltoa(Rect.left, buffer, 10));
SetDlgItemText(IDD_TOP, ltoa(Rect.top, buffer, 10));
SetDlgItemText(IDD_RIGHT, ltoa(Rect.right, buffer, 10));
SetDlgItemText(IDD_BOTTOM, ltoa(Rect.bottom, buffer, 10));
}
}
hPrevFocus = hFocus;
}
}
//----------------------------------------------------------------------------
class TCursorApplication : public TApplication {
public:
TCursorApplication() : TApplication("Cursor Location App") {}
void InitMainWindow() {
EnableCtl3d();
Dialog = new TCursorDlg(0, "CursorDlg");
MainWindow = new TFrameWindow(0, "Cursor Location", Dialog, TRUE);
MainWindow->SetIcon(this, "CursorDlg");
MainWindow->Attr.Style &= ~(WS_MAXIMIZEBOX|WS_THICKFRAME);
}
BOOL IdleAction(long) {
if (Dialog && Dialog->ShouldUpdate())
Dialog->UpdateDialog();
return TRUE; // Keep calling us
}
private:
TCursorDlg* Dialog;
};
int
OwlMain(int /*argc*/, char* /*argv*/ [])
{
#if defined(__WIN32__)
if (!(::GetVersion()&0x80000000)) {
::MessageBox(0, "This is not a Win NT Example", "OWL Examples", MB_OK);
return 0;
}
#endif
return TCursorApplication().Run();
}