- 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>
107 lines
2.7 KiB
C++
107 lines
2.7 KiB
C++
//----------------------------------------------------------------------------
|
|
// ObjectWindows - (C) Copyright 1991, 1993 by Borland International
|
|
//----------------------------------------------------------------------------
|
|
#include <owl\owlpch.h>
|
|
#include <owl\gdiobjec.h>
|
|
#include <owl\dc.h>
|
|
#include "appbtn.h"
|
|
#include "applaunc.rh"
|
|
|
|
int TAppButton::ButtonPixelSize = 32;
|
|
|
|
//
|
|
// Constructor. Construct from a bitmap and id.
|
|
//
|
|
TAppButton::TAppButton(const TBitmap& bitmap, int id)
|
|
: TButtonGadget(0, CM_DUMMY), RealId(id)
|
|
{
|
|
CreateGlyph(bitmap);
|
|
}
|
|
|
|
//
|
|
// Constructor. Construct given path to icon file and id. An HINSTANCE
|
|
// is passed for use in extracting the icon from the given file.
|
|
//
|
|
TAppButton::TAppButton(HINSTANCE hInst, const string& iconPath, int id)
|
|
: TButtonGadget(0, CM_DUMMY, Command, TRUE), RealId(id), Glyph(0)
|
|
{
|
|
if (hInst)
|
|
HInst = hInst;
|
|
|
|
TBitmap bitmap(TScreenDC(), TAppButton::ButtonPixelSize,
|
|
TAppButton::ButtonPixelSize);
|
|
BitmapFromIconPath(iconPath, bitmap);
|
|
CreateGlyph(bitmap);
|
|
}
|
|
|
|
//
|
|
// Destructor. Delete the glyph that was created in ctor.
|
|
//
|
|
TAppButton::~TAppButton()
|
|
{
|
|
delete Glyph;
|
|
}
|
|
|
|
//
|
|
// GetGlyphDib(). OWL calls this virtual to get the bitmap to be drawn on
|
|
// the button.
|
|
//
|
|
TDib*
|
|
TAppButton::GetGlyphDib()
|
|
{
|
|
return Glyph;
|
|
}
|
|
|
|
//
|
|
// ReleaseGlyphDib(). Called by OWL to delete the dib returned by
|
|
// GetGlyphDib(). Since the dib is created in the constructor it
|
|
// is not deleted here.
|
|
//
|
|
void
|
|
TAppButton::ReleaseGlyphDib(TDib*)
|
|
{
|
|
}
|
|
|
|
//
|
|
// CreateGlyph(). Create and return a dib, created from given bitmap.
|
|
//
|
|
void
|
|
TAppButton::CreateGlyph(const TBitmap& bitmap)
|
|
{
|
|
delete Glyph;
|
|
Glyph = new TDib(bitmap);
|
|
}
|
|
|
|
//
|
|
// BitmapFromIconPath(). Create a TBitmap from an icon, specified by
|
|
// 'iconPath'.
|
|
//
|
|
void
|
|
TAppButton::BitmapFromIconPath(const string& iconPath, TBitmap& bitmap)
|
|
{
|
|
int freeIcon = 0;
|
|
|
|
// extract icon from source.
|
|
//
|
|
HICON icon = ExtractIcon(HInst, iconPath.c_str(), 0);
|
|
|
|
// Use question icon if icon could not be found.
|
|
//
|
|
if (!icon || (int)icon == 1)
|
|
icon = LoadIcon(0, IDI_QUESTION);
|
|
else
|
|
freeIcon = 1;
|
|
|
|
// create bitmap from icon to be used with button gadget.
|
|
//
|
|
TMemoryDC memDC; // screen capatable DC.
|
|
|
|
memDC.SelectObject(bitmap); // Use given bitmap to draw into.
|
|
// Initialize bitmap with button-face color.
|
|
memDC.TextRect(0, 0, TAppButton::ButtonPixelSize, TAppButton::ButtonPixelSize,
|
|
GetSysColor(COLOR_WINDOW));
|
|
memDC.DrawIcon(0, 0, TIcon(icon));
|
|
if (freeIcon)
|
|
::DestroyIcon(icon);
|
|
}
|