- 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>
202 lines
5.4 KiB
C++
202 lines
5.4 KiB
C++
//----------------------------------------------------------------------------
|
|
// ObjectWindows - (C) Copyright 1991, 1993 by Borland International
|
|
// Printing program example using Application Framework Libraries (OWL)
|
|
// This application displays and prints a Ruler using OWL printer classes.
|
|
//----------------------------------------------------------------------------
|
|
#include <owl\owlpch.h>
|
|
#include <owl\applicat.h>
|
|
#include <owl\framewin.h>
|
|
#include <owl\dc.h>
|
|
#include <owl\printer.h>
|
|
#include <owl\editfile.rh>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
// TWindowPrintout
|
|
|
|
class TWindowPrintout : public TPrintout {
|
|
public:
|
|
TWindowPrintout(const char* title, TWindow* window);
|
|
|
|
void GetDialogInfo(int& minPage, int& maxPage,
|
|
int& selFromPage, int& selToPage);
|
|
void PrintPage(int page, TRect& rect, unsigned flags);
|
|
void SetBanding(BOOL b) {Banding = b;}
|
|
BOOL HasPage(int pageNumber) {return pageNumber == 1;}
|
|
|
|
protected:
|
|
TWindow* Window;
|
|
BOOL Scale;
|
|
};
|
|
|
|
TWindowPrintout::TWindowPrintout(const char* title, TWindow* window)
|
|
: TPrintout(title)
|
|
{
|
|
Window = window;
|
|
Scale = TRUE;
|
|
}
|
|
|
|
void
|
|
TWindowPrintout::PrintPage(int, TRect& rect, unsigned)
|
|
{
|
|
// Conditionally scale the DC to the window so the printout will
|
|
// resemble the window
|
|
//
|
|
int prevMode;
|
|
TSize oldVExt, oldWExt;
|
|
if (Scale) {
|
|
prevMode = DC->SetMapMode(MM_ISOTROPIC);
|
|
TRect windowSize = Window->GetClientRect();
|
|
DC->SetViewportExt(PageSize, &oldVExt);
|
|
DC->SetWindowExt(windowSize.Size(), &oldWExt);
|
|
DC->IntersectClipRect(windowSize);
|
|
DC->DPtoLP(rect, 2);
|
|
}
|
|
|
|
// Call the window to paint itself
|
|
Window->Paint(*DC, FALSE, rect);
|
|
|
|
// Restore changes made to the DC
|
|
if (Scale) {
|
|
DC->SetWindowExt(oldWExt);
|
|
DC->SetViewportExt(oldVExt);
|
|
DC->SetMapMode(prevMode);
|
|
}
|
|
}
|
|
|
|
// Do not enable page range in the print dialog since only one page is
|
|
// available to be printed
|
|
//
|
|
void
|
|
TWindowPrintout::GetDialogInfo(int& minPage, int& maxPage,
|
|
int& selFromPage, int& selToPage)
|
|
{
|
|
minPage = 0;
|
|
maxPage = 0;
|
|
selFromPage = selToPage = 0;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
// TRulerWin
|
|
|
|
class TRulerWin : public TFrameWindow {
|
|
TPrinter* Printer;
|
|
public:
|
|
TRulerWin(TWindow* parent, const char* title, TModule* = 0);
|
|
~TRulerWin();
|
|
|
|
void Paint(TDC&, BOOL, TRect&);
|
|
|
|
void CmFilePrint();
|
|
void CmFilePrinterSetup();
|
|
|
|
DECLARE_RESPONSE_TABLE(TRulerWin);
|
|
};
|
|
|
|
DEFINE_RESPONSE_TABLE1(TRulerWin, TFrameWindow)
|
|
EV_COMMAND(CM_FILEPRINT, CmFilePrint),
|
|
EV_COMMAND(CM_FILEPRINTERSETUP, CmFilePrinterSetup),
|
|
END_RESPONSE_TABLE;
|
|
|
|
TRulerWin::TRulerWin(TWindow* parent, const char* title, TModule* module)
|
|
: TFrameWindow(parent, title, 0, FALSE, module)
|
|
{
|
|
AssignMenu("RulerMenu");
|
|
Attr.X = GetSystemMetrics(SM_CXSCREEN) / 8;
|
|
Attr.Y = GetSystemMetrics(SM_CYSCREEN) / 8;
|
|
Attr.H = Attr.Y * 6;
|
|
Attr.W = Attr.X * 6;
|
|
Printer = new TPrinter;
|
|
}
|
|
|
|
TRulerWin::~TRulerWin()
|
|
{
|
|
delete Printer;
|
|
}
|
|
|
|
void
|
|
TRulerWin::CmFilePrint() // Execute File:Print command
|
|
{
|
|
if (Printer) {
|
|
TWindowPrintout printout("Ruler Test", this);
|
|
printout.SetBanding(TRUE);
|
|
Printer->Print(this, printout, TRUE);
|
|
}
|
|
}
|
|
|
|
void
|
|
TRulerWin::CmFilePrinterSetup() // Execute File:Printer-setup command
|
|
{
|
|
if (Printer)
|
|
Printer->Setup(this);
|
|
}
|
|
|
|
// Paint window's contents on any dc, screen or printer or whatever...
|
|
//
|
|
void
|
|
TRulerWin::Paint(TDC& dc, BOOL, TRect&)
|
|
{
|
|
const UnitsPerInch = 100; // Display scale units per inch
|
|
const NumInches = 8; // Size of ruler in inches
|
|
const MarkFraction = 4; // Power of 2 to use for marks
|
|
const MarksPerInch = (1<<MarkFraction); // Number of markers for each inch
|
|
const LargeMarkerSize = UnitsPerInch/3; // Size of large, labeled markers
|
|
const SmallMarkerSize = UnitsPerInch/8; // Size of smallest markers
|
|
const MarkStep = (LargeMarkerSize-SmallMarkerSize) / MarkFraction;
|
|
|
|
dc.SaveDC();
|
|
dc.SetMapMode(MM_LOENGLISH);
|
|
int x1 = 0; //0.50 * UnitsPerInch;
|
|
int y1 = x1;
|
|
int x2 = x1 + NumInches * UnitsPerInch;
|
|
int y2 = y1 + 1*UnitsPerInch;
|
|
dc.Rectangle(x1, -y1, x2, -y2);
|
|
|
|
//
|
|
// Draw marks
|
|
//
|
|
y2 = y1 + SmallMarkerSize;
|
|
for (int marksPerInch = MarksPerInch; marksPerInch > 0; marksPerInch /= 2) {
|
|
for (int i = 0; i <= NumInches*marksPerInch - 1; i++) {
|
|
int x = x1 + (i * UnitsPerInch) / marksPerInch;
|
|
dc.MoveTo(x, -y1);
|
|
dc.LineTo(x, -y2);
|
|
}
|
|
y2 += MarkStep;
|
|
}
|
|
|
|
//
|
|
// Label the inch marks
|
|
//
|
|
y2 = y1 + LargeMarkerSize; // - text height
|
|
for (int i = 1; i <= NumInches - 1; i++) {
|
|
int x = x1 + i * UnitsPerInch; // - ( text width + 20%)
|
|
char s[3];
|
|
itoa(i, s, 10);
|
|
dc.TextOut(TPoint(x, -y2), s, strlen(s));
|
|
}
|
|
|
|
dc.RestoreDC();
|
|
}
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
// TRulerApp
|
|
|
|
class TRulerApp : public TApplication {
|
|
public:
|
|
TRulerApp() : TApplication() {}
|
|
void InitMainWindow() {
|
|
EnableCtl3d();
|
|
MainWindow = new TRulerWin(0, "Ruler Printing Demonstration");
|
|
}
|
|
};
|
|
|
|
int
|
|
OwlMain(int /*argc*/, char* /*argv*/ [])
|
|
{
|
|
return TRulerApp().Run();
|
|
}
|