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

119 lines
3.4 KiB
C++

//----------------------------------------------------------------------------
// ObjectWindows - (C) Copyright 1993 by Borland International
//
// Program Description:
// Interactive program to demonstrate TLayout window. It creates
// a frame window, colored child windows and a client window.
//
// The menu choice lets you bring up a dialog to let you set values for a
// TLayoutMetrics structure for the various child windows (the dialog is
// modeless, so you can layout several windows at the same time).
// A TLayoutMetrics (declared in layoutwi.h) has four TLayoutConstraints
// in it, X, Y, Width and Height. When the dialog comes up, you choose
// which constraint you want to select, then set the various members of
// that constraint.
// There are some constraints that you don't do with layout windows.
// For example, if you constrain the lmWidth edges of a X constraint, it
// will cause a error. (The lmWidth edge is best constrained through the
// Width constraint).
//
// Functionality Demonstrated:
// OWL: Low level use of TLayoutWindow and TLayoutMetrics
//----------------------------------------------------------------------------
#include <owl\owlpch.h>
#include <owl\framewin.h>
#include <owl\applicat.h>
#include <owl\layoutwi.h>
#include "layout.rh"
#include "layout.h"
#include "laydia.h"
TMyChildWindow::TMyChildWindow(TWindow* parent, int id, char far* title,
TColor color)
: TWindow(parent, title)
{
SetBkgndColor(color);
Attr.Style = WS_CHILD | WS_BORDER | WS_VISIBLE | WS_TABSTOP | WS_CLIPSIBLINGS;
Attr.Id = id;
static int i = 0;
Attr.X = 10 + i++ * 100;
Attr.Y = 10;
Attr.W = 100;
Attr.H = 100;
}
//----------------------------------------------------------------------------
DEFINE_RESPONSE_TABLE1(TMyLayout, TLayoutWindow)
EV_COMMAND(CM_LAYOUT, CmLayout),
EV_COMMAND(CM_RELAYOUT, CmReLayout),
END_RESPONSE_TABLE;
TMyLayout::TMyLayout(TWindow* parent)
: TLayoutWindow(parent, 0)
{
Attr.Style |= WS_BORDER;
static TColor ChildColor[] = {
RGB(0xFF, 0x00, 0x00),
RGB(0x00, 0xFF, 0x00),
RGB(0x00, 0x00, 0xFF),
RGB(0xFF, 0xFF, 0x00),
RGB(0x00, 0xFF, 0xFF),
RGB(0xFF, 0x00, 0xFF),
};
static char* ChildName[] = {
"Red",
"Green",
"Blue",
"Yellow",
"Cyan",
"Magenta",
};
for (int i = 0; i < MaxChildren; i++)
ChildInfo[i].Child = new TMyChildWindow(this, i+1, ChildName[i], ChildColor[i]);
ChildInfo[i].Child = 0;
LayoutDialog = new TLayoutDialog(this, "IDD_LAYOUT", ChildInfo);
}
void TMyLayout::CmLayout()
{
// Only one layout dialog at a time please
if (LayoutDialog->HWindow == 0){
LayoutDialog->Create();
}
}
// Re-layout all of the children. Not really needed
//
void TMyLayout::CmReLayout()
{
for (int i = 0; i < MaxChildren; i++)
SetChildLayoutMetrics(*ChildInfo[i].Child, ChildInfo[i].LayoutMetrics);
Layout();
}
void TMyLayout::SetupWindow()
{
TLayoutWindow::SetupWindow();
PostMessage(WM_COMMAND, CM_RELAYOUT);
}
//----------------------------------------------------------------------------
class TLayoutApp : public TApplication {
public:
void InitMainWindow() {
MainWindow = new TFrameWindow(0, "Layout Window", new TMyLayout(0));
MainWindow->AssignMenu("IDM_LAYOUT");
}
};
int OwlMain(int, char**)
{
return TLayoutApp().Run();
}