Files
TeslaRel410/BORLAND/BC45/EXAMPLES/OWL/OWLAPPS/GDIDEMO/GDIDEMO.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

160 lines
3.9 KiB
C++

//----------------------------------------------------------------------------
// ObjectWindows - (C) Copyright 1991, 1993 by Borland International
// A GDI demo program
//----------------------------------------------------------------------------
#include <owl\owlpch.h>
#include <owl\applicat.h>
#include <owl\mdi.h>
#include <string.h>
#include "demobase.h"
#include "line.h"
#include "fontx.h"
#include "bitblt.h"
#include "arty.h"
// Menu bar constants
const int MenuId = 100; // Resource Id of the menubar
const int MoveToLineToDemoId= 201; // Demo->MoveToDemo Id
const int FontDemoId = 202; // Demo->Font Demo Id
const int BitBltDemoId = 203; // Demo->BitBlt Demo Id
const int ArtyDemoId = 204; // Demo->Arty Demo Id
const int IconId = 100; // Resource Id of the program icon
IMPLEMENT_CASTABLE1(TBaseDemoWindow, TWindow);
//----------------------------------------------------------------------------
class TGdiDemoWindow : public TMDIClient {
public:
TGdiDemoWindow() : TMDIClient() { Attr.Style |= WS_TABSTOP; }
protected:
void SetupWindow();
void CmMoveToLineToDemo();
void CmFontDemo();
void CmBitBltDemo();
void CmArtyDemo();
void EvTimer(UINT TimerId);
void EvDestroy();
DECLARE_RESPONSE_TABLE(TGdiDemoWindow);
};
DEFINE_RESPONSE_TABLE1(TGdiDemoWindow, TMDIClient)
EV_COMMAND(MoveToLineToDemoId, CmMoveToLineToDemo),
EV_COMMAND(FontDemoId, CmFontDemo),
EV_COMMAND(BitBltDemoId, CmBitBltDemo),
EV_COMMAND(ArtyDemoId, CmArtyDemo),
EV_WM_TIMER,
EV_WM_DESTROY,
END_RESPONSE_TABLE;
//
// Setup the main demo window, and try to allocate its timer
//
void
TGdiDemoWindow::SetupWindow()
{
TMDIClient::SetupWindow();
int result = IDRETRY;
while (SetTimer(0, 50, 0) == 0 && result == IDRETRY)
result = MessageBox("Could not Create Timer", "GDIDemo", MB_RETRYCANCEL);
if (result == IDCANCEL)
PostQuitMessage(0);
}
//
// In response to a demo command, create one of the demo windows as the client
// of an mdi child frame. Turn of the icon for the mdi child to allow the
// client to paint itself when iconic.
//
void
TGdiDemoWindow::CmMoveToLineToDemo()
{
TMDIChild* child = new TMDIChild(*this, "MoveTo/LineTo Window",
new TMoveToLineToWindow);
child->SetIcon(0, 0);
child->Create();
}
void
TGdiDemoWindow::CmFontDemo()
{
TMDIChild* child = new TMDIChild(*this, "Font Window", new TFontWindow);;
child->SetIcon(GetApplication(), 101);
child->Create();
}
void
TGdiDemoWindow::CmBitBltDemo()
{
TMDIChild* child = new TMDIChild(*this, "BitBlt Window", new TBitBltWindow);
child->SetIcon(0, 0);
child->Create();
}
void
TGdiDemoWindow::CmArtyDemo()
{
TMDIChild* child = new TMDIChild(*this, "Arty Window", new TArtyWindow);
child->SetIcon(0, 0);
child->Create();
}
//
// Get client demo window from mdi child frame using typesafe downcasting
//
void
ChildTimers(TWindow* p, void*)
{
TFrameWindow* frame = TYPESAFE_DOWNCAST(p, TFrameWindow);
CHECK(frame);
TBaseDemoWindow* demoWin = TYPESAFE_DOWNCAST(frame->GetClientWindow(), TBaseDemoWindow);
CHECK(demoWin);
demoWin->TimerTick();
}
//
// In response to WMTimer messages, each MDI child window's TimerTick
// Method is called.
//
void
TGdiDemoWindow::EvTimer(UINT)
{
ForEach(ChildTimers, 0);
}
void
TGdiDemoWindow::EvDestroy()
{
KillTimer(0);
TMDIClient::EvDestroy();
}
//----------------------------------------------------------------------------
class TGdiDemoApp : public TApplication {
public:
TGdiDemoApp() : TApplication() {}
void InitMainWindow();
};
void
TGdiDemoApp::InitMainWindow()
{
MainWindow = new TMDIFrame("GDI Demo", MenuId, *new TGdiDemoWindow);
MainWindow->SetIcon(this, IconId);
}
int
OwlMain(int /*argc*/, char* /*argv*/ [])
{
return TGdiDemoApp().Run();
}