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>
This commit is contained in:
@@ -0,0 +1,381 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// ObjectWindows - (C) Copyright 1993,1994 by Borland International
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
//
|
||||
// This is an example of how to use TRACE macros in a program without
|
||||
// requiring an OWL diagnostic build.
|
||||
// Just define __TRACE (and/or __WARN) before any OWL headers
|
||||
// Then you can use TRACE() or WARN() directly
|
||||
//
|
||||
#define __TRACE
|
||||
|
||||
#include <owl\owlpch.h>
|
||||
#include <owl\applicat.h>
|
||||
#include <owl\layoutwi.h>
|
||||
#include <owl\layoutco.h>
|
||||
#include <owl\dialog.h>
|
||||
#include <owl\combobox.h>
|
||||
#include <owl\edit.h>
|
||||
#include <string.h>
|
||||
#include "layout.rh"
|
||||
#include "laydia.h"
|
||||
|
||||
|
||||
DEFINE_RESPONSE_TABLE1(TLayoutDialog, TDialog)
|
||||
EV_COMMAND(ID_LAYOUT, HandleLayout),
|
||||
EV_LBN_SELCHANGE(ID_WINDOWLIST, HandleWindowChange),
|
||||
END_RESPONSE_TABLE;
|
||||
|
||||
TLayoutDialog::TLayoutDialog(TLayoutWindow* parent,
|
||||
TResId resId,
|
||||
TChildInfo* childInfo)
|
||||
: TDialog(parent, resId),
|
||||
LayoutWindow(parent),
|
||||
ChildInfo(childInfo)
|
||||
{
|
||||
WindowList = new TListBox(this, ID_WINDOWLIST);
|
||||
|
||||
X1EdgeCombo = new TComboBox(this,ID_X1_MYEDGE);
|
||||
X2EdgeCombo = new TComboBox(this,ID_X2_MYEDGE);
|
||||
Y1EdgeCombo = new TComboBox(this,ID_Y1_MYEDGE);
|
||||
Y2EdgeCombo = new TComboBox(this,ID_Y2_MYEDGE);
|
||||
|
||||
X1OtherEdgeCombo = new TComboBox(this,ID_X1_OTHEREDGE);
|
||||
X2OtherEdgeCombo = new TComboBox(this,ID_X2_OTHEREDGE);
|
||||
Y1OtherEdgeCombo = new TComboBox(this,ID_Y1_OTHEREDGE);
|
||||
Y2OtherEdgeCombo = new TComboBox(this,ID_Y2_OTHEREDGE);
|
||||
|
||||
X1UnitsCombo = new TComboBox(this, ID_X1_UNITS);
|
||||
X2UnitsCombo = new TComboBox(this, ID_X2_UNITS);
|
||||
Y1UnitsCombo = new TComboBox(this, ID_Y1_UNITS);
|
||||
Y2UnitsCombo = new TComboBox(this, ID_Y2_UNITS);
|
||||
|
||||
X1ValueEdit = new TEdit(this,ID_X1_VALUE);
|
||||
X2ValueEdit = new TEdit(this,ID_X2_VALUE);
|
||||
Y1ValueEdit = new TEdit(this,ID_Y1_VALUE);
|
||||
Y2ValueEdit = new TEdit(this,ID_Y2_VALUE);
|
||||
|
||||
X1RelationCombo = new TComboBox(this, ID_X1_RELATIONSHIP);
|
||||
X2RelationCombo = new TComboBox(this, ID_X2_RELATIONSHIP);
|
||||
Y1RelationCombo = new TComboBox(this, ID_Y1_RELATIONSHIP);
|
||||
Y2RelationCombo = new TComboBox(this, ID_Y2_RELATIONSHIP);
|
||||
|
||||
X1RelWinCombo = new TComboBox(this, ID_X1_RELWIN);
|
||||
X2RelWinCombo = new TComboBox(this, ID_X2_RELWIN);
|
||||
Y1RelWinCombo = new TComboBox(this, ID_Y1_RELWIN);
|
||||
Y2RelWinCombo = new TComboBox(this, ID_Y2_RELWIN);
|
||||
}
|
||||
|
||||
|
||||
struct TEnumPair {
|
||||
char far* Name;
|
||||
uint32 Value;
|
||||
};
|
||||
#define ENUMPAIR(enum) {#enum, enum}
|
||||
|
||||
|
||||
//
|
||||
// For a valid constraint....
|
||||
// X2Edge must not be the same as X1 edge
|
||||
// Y2Edge must not be the same as Y1 edge
|
||||
// If X2Edge == lmWidth then lmLeft and lmRight relations don't make sense
|
||||
// if Y2Edge == lmHeight then lmAbove and lmBelow relations don't make sense
|
||||
//
|
||||
|
||||
TEnumPair X1EdgePairs[] = {
|
||||
ENUMPAIR(lmLeft),
|
||||
ENUMPAIR(lmCenter),
|
||||
ENUMPAIR(lmRight),
|
||||
};
|
||||
|
||||
TEnumPair X2EdgePairs[] = {
|
||||
ENUMPAIR(lmCenter),
|
||||
ENUMPAIR(lmRight),
|
||||
ENUMPAIR(lmWidth),
|
||||
};
|
||||
|
||||
TEnumPair Y1EdgePairs[] = {
|
||||
ENUMPAIR(lmTop),
|
||||
ENUMPAIR(lmCenter),
|
||||
ENUMPAIR(lmBottom),
|
||||
};
|
||||
|
||||
TEnumPair Y2EdgePairs[] = {
|
||||
ENUMPAIR(lmCenter),
|
||||
ENUMPAIR(lmBottom),
|
||||
ENUMPAIR(lmHeight),
|
||||
};
|
||||
|
||||
TEnumPair AllEdgePairs[] = {
|
||||
ENUMPAIR(lmLeft),
|
||||
ENUMPAIR(lmCenter),
|
||||
ENUMPAIR(lmRight),
|
||||
ENUMPAIR(lmTop),
|
||||
ENUMPAIR(lmBottom),
|
||||
ENUMPAIR(lmWidth),
|
||||
ENUMPAIR(lmHeight),
|
||||
};
|
||||
|
||||
|
||||
// Relations for all X edges
|
||||
TEnumPair XRelationPairs[] = {
|
||||
ENUMPAIR(lmAsIs),
|
||||
ENUMPAIR(lmAbsolute),
|
||||
ENUMPAIR(lmPercentOf),
|
||||
ENUMPAIR(lmSameAs),
|
||||
ENUMPAIR(lmLeftOf), //These should be disabled for lmWidth
|
||||
ENUMPAIR(lmRightOf),
|
||||
};
|
||||
|
||||
TEnumPair YRelationPairs[] = {
|
||||
ENUMPAIR(lmAsIs),
|
||||
ENUMPAIR(lmAbsolute),
|
||||
ENUMPAIR(lmPercentOf),
|
||||
ENUMPAIR(lmSameAs),
|
||||
ENUMPAIR(lmAbove), //These should be disabled for lmHeight
|
||||
ENUMPAIR(lmBelow),
|
||||
};
|
||||
|
||||
TEnumPair RelWinPairs[MaxWindows] = {
|
||||
ENUMPAIR(lmParent),
|
||||
};
|
||||
|
||||
TEnumPair UnitsPairs[] = {
|
||||
ENUMPAIR(lmPixels),
|
||||
ENUMPAIR(lmLayoutUnits),
|
||||
};
|
||||
|
||||
static void FillCombo(TComboBox* combo, TEnumPair* pairs, int count)
|
||||
{
|
||||
while (combo->DeleteString(0) > 0)
|
||||
;
|
||||
for (int i = 0; i < count; i++) {
|
||||
int index = combo->AddString(pairs[i].Name);
|
||||
combo->SetItemData(index, pairs[i].Value);
|
||||
}
|
||||
}
|
||||
|
||||
void TLayoutDialog::SetupWindow()
|
||||
{
|
||||
TDialog::SetupWindow();
|
||||
|
||||
// Fill the window list
|
||||
//
|
||||
for (int i = 0; ChildInfo[i].Child && i < MaxWindows-1; i++) {
|
||||
WindowList->AddString(ChildInfo[i].Child->Title);
|
||||
RelWinPairs[i+1].Name = ChildInfo[i].Child->Title;
|
||||
RelWinPairs[i+1].Value = uint32(ChildInfo[i].Child);
|
||||
}
|
||||
|
||||
FillCombo(X1EdgeCombo,X1EdgePairs,COUNTOF(X1EdgePairs));
|
||||
FillCombo(X2EdgeCombo,X2EdgePairs,COUNTOF(X2EdgePairs));
|
||||
FillCombo(Y1EdgeCombo,Y1EdgePairs,COUNTOF(Y1EdgePairs));
|
||||
FillCombo(Y2EdgeCombo,Y2EdgePairs,COUNTOF(Y2EdgePairs));
|
||||
|
||||
FillCombo(X1OtherEdgeCombo,AllEdgePairs,COUNTOF(AllEdgePairs));
|
||||
FillCombo(X2OtherEdgeCombo,AllEdgePairs,COUNTOF(AllEdgePairs));
|
||||
FillCombo(Y1OtherEdgeCombo,AllEdgePairs,COUNTOF(AllEdgePairs));
|
||||
FillCombo(Y2OtherEdgeCombo,AllEdgePairs,COUNTOF(AllEdgePairs));
|
||||
|
||||
FillCombo(X1UnitsCombo, UnitsPairs, COUNTOF(UnitsPairs));
|
||||
FillCombo(X2UnitsCombo, UnitsPairs, COUNTOF(UnitsPairs));
|
||||
FillCombo(Y1UnitsCombo, UnitsPairs, COUNTOF(UnitsPairs));
|
||||
FillCombo(Y2UnitsCombo, UnitsPairs, COUNTOF(UnitsPairs));
|
||||
|
||||
X1ValueEdit->SetText("");
|
||||
X2ValueEdit->SetText("");
|
||||
Y1ValueEdit->SetText("");
|
||||
Y2ValueEdit->SetText("");
|
||||
|
||||
FillCombo(X1RelationCombo, XRelationPairs, COUNTOF(XRelationPairs));
|
||||
FillCombo(X2RelationCombo, XRelationPairs, COUNTOF(XRelationPairs));
|
||||
FillCombo(Y1RelationCombo, YRelationPairs, COUNTOF(YRelationPairs));
|
||||
FillCombo(Y2RelationCombo, YRelationPairs, COUNTOF(YRelationPairs));
|
||||
|
||||
FillCombo(X1RelWinCombo, RelWinPairs, i+1);
|
||||
FillCombo(X2RelWinCombo, RelWinPairs, i+1);
|
||||
FillCombo(Y1RelWinCombo, RelWinPairs, i+1);
|
||||
FillCombo(Y2RelWinCombo, RelWinPairs, i+1);
|
||||
|
||||
// This call will result in a LBN_SELCHANGE Message being sent to the
|
||||
// window, which will result in HandleWindowChange being called.
|
||||
// This call can't be made until the above controls are setup, so wait until
|
||||
// the end here.
|
||||
//
|
||||
ChildNum = -1; // Flag to signal initial call to HandleWindowChange
|
||||
WindowList->SetSelIndex(0);
|
||||
HandleWindowChange();
|
||||
}
|
||||
|
||||
static void SelectItemData(TComboBox* combo, uint32 itemData)
|
||||
{
|
||||
int count = combo->GetCount();
|
||||
combo->SetSelIndex(-1); // Clear the selection
|
||||
for (int i = 0; i < count; i++)
|
||||
if (combo->GetItemData(i) == itemData) {
|
||||
combo->SetSelIndex(i);
|
||||
return;
|
||||
}
|
||||
TRACE("Couldn't find lmXxx (" << itemData <<") in list");
|
||||
}
|
||||
|
||||
static void SelectItemData(TComboBox* combo, TWindow* win)
|
||||
{
|
||||
#if defined(BI_MODEL_NEAR_DATA)
|
||||
if (OFFSETOF(win) == 0)
|
||||
SelectItemData(combo, uint32(0));
|
||||
else
|
||||
#endif
|
||||
SelectItemData(combo, uint32(win));
|
||||
}
|
||||
|
||||
//
|
||||
// Take a given layout constraint & shove it into the dialog
|
||||
//
|
||||
void TLayoutDialog::SetLayoutConstraint(TLayoutConstraint& lc, Constraint which)
|
||||
{
|
||||
char buff[20];
|
||||
|
||||
switch (which) {
|
||||
case X1:
|
||||
SelectItemData(X1EdgeCombo, lc.MyEdge);
|
||||
SelectItemData(X1RelationCombo, lc.Relationship);
|
||||
SelectItemData(X1RelWinCombo, lc.RelWin);
|
||||
SelectItemData(X1OtherEdgeCombo, lc.OtherEdge);
|
||||
SelectItemData(X1UnitsCombo, lc.Units);
|
||||
wsprintf(buff, "%d", lc.Value);
|
||||
X1ValueEdit->SetText(buff);
|
||||
break;
|
||||
|
||||
case X2:
|
||||
SelectItemData(X2EdgeCombo, lc.MyEdge);
|
||||
SelectItemData(X2RelationCombo, lc.Relationship);
|
||||
SelectItemData(X2RelWinCombo, lc.RelWin);
|
||||
SelectItemData(X2OtherEdgeCombo, lc.OtherEdge);
|
||||
SelectItemData(X2UnitsCombo, lc.Units);
|
||||
wsprintf(buff, "%d", lc.Value);
|
||||
X2ValueEdit->SetText(buff);
|
||||
break;
|
||||
|
||||
case Y1:
|
||||
SelectItemData(Y1EdgeCombo, lc.MyEdge);
|
||||
SelectItemData(Y1RelationCombo, lc.Relationship);
|
||||
SelectItemData(Y1RelWinCombo, lc.RelWin);
|
||||
SelectItemData(Y1OtherEdgeCombo, lc.OtherEdge);
|
||||
SelectItemData(Y1UnitsCombo, lc.Units);
|
||||
wsprintf(buff, "%d", lc.Value);
|
||||
Y1ValueEdit->SetText(buff);
|
||||
break;
|
||||
|
||||
case Y2:
|
||||
SelectItemData(Y2EdgeCombo, lc.MyEdge);
|
||||
SelectItemData(Y2RelationCombo, lc.Relationship);
|
||||
SelectItemData(Y2RelWinCombo, lc.RelWin);
|
||||
SelectItemData(Y2OtherEdgeCombo, lc.OtherEdge);
|
||||
SelectItemData(Y2UnitsCombo, lc.Units);
|
||||
wsprintf(buff, "%d", lc.Value);
|
||||
Y2ValueEdit->SetText(buff);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Retrieve a layout constraint from the dialog
|
||||
//
|
||||
void TLayoutDialog::GetLayoutConstraint(TLayoutConstraint& lc, Constraint which)
|
||||
{
|
||||
char buff[20];
|
||||
switch (which) {
|
||||
case X1:
|
||||
lc.MyEdge = (TEdge)X1EdgeCombo->GetItemData(X1EdgeCombo->GetSelIndex());
|
||||
lc.Relationship = (TRelationship)X1RelationCombo->GetItemData(X1RelationCombo->GetSelIndex());
|
||||
lc.RelWin = (TWindow*)X1RelWinCombo->GetItemData(X1RelWinCombo->GetSelIndex());
|
||||
lc.OtherEdge = (TEdge)X1OtherEdgeCombo->GetItemData(X1OtherEdgeCombo->GetSelIndex());
|
||||
lc.Units = (TMeasurementUnits)X1UnitsCombo->GetItemData(X1UnitsCombo->GetSelIndex());
|
||||
X1ValueEdit->GetText(buff, sizeof buff);
|
||||
lc.Value = atoi(buff);
|
||||
break;
|
||||
|
||||
case X2:
|
||||
lc.MyEdge = (TEdge)X2EdgeCombo->GetItemData(X2EdgeCombo->GetSelIndex());
|
||||
lc.Relationship = (TRelationship)X2RelationCombo->GetItemData(X2RelationCombo->GetSelIndex());
|
||||
lc.RelWin = (TWindow*)X2RelWinCombo->GetItemData(X2RelWinCombo->GetSelIndex());
|
||||
lc.OtherEdge = (TEdge)X2OtherEdgeCombo->GetItemData(X2OtherEdgeCombo->GetSelIndex());
|
||||
lc.Units = (TMeasurementUnits)X2UnitsCombo->GetItemData(X2UnitsCombo->GetSelIndex());
|
||||
X2ValueEdit->GetText(buff, sizeof buff);
|
||||
lc.Value = atoi(buff);
|
||||
break;
|
||||
|
||||
case Y1:
|
||||
lc.MyEdge = (TEdge)Y1EdgeCombo->GetItemData(Y1EdgeCombo->GetSelIndex());
|
||||
lc.Relationship = (TRelationship)Y1RelationCombo->GetItemData(Y1RelationCombo->GetSelIndex());
|
||||
lc.RelWin = (TWindow*)Y1RelWinCombo->GetItemData(Y1RelWinCombo->GetSelIndex());
|
||||
lc.OtherEdge = (TEdge)Y1OtherEdgeCombo->GetItemData(Y1OtherEdgeCombo->GetSelIndex());
|
||||
lc.Units = (TMeasurementUnits)Y1UnitsCombo->GetItemData(Y1UnitsCombo->GetSelIndex());
|
||||
Y1ValueEdit->GetText(buff, sizeof buff);
|
||||
lc.Value = atoi(buff);
|
||||
break;
|
||||
|
||||
case Y2:
|
||||
lc.MyEdge = (TEdge)Y2EdgeCombo->GetItemData(Y2EdgeCombo->GetSelIndex());
|
||||
lc.Relationship = (TRelationship)Y2RelationCombo->GetItemData(Y2RelationCombo->GetSelIndex());
|
||||
lc.RelWin = (TWindow*)Y2RelWinCombo->GetItemData(Y2RelWinCombo->GetSelIndex());
|
||||
lc.OtherEdge = (TEdge)Y2OtherEdgeCombo->GetItemData(Y2OtherEdgeCombo->GetSelIndex());
|
||||
lc.Units = (TMeasurementUnits)Y2UnitsCombo->GetItemData(Y2UnitsCombo->GetSelIndex());
|
||||
Y2ValueEdit->GetText(buff, sizeof buff);
|
||||
lc.Value = atoi(buff);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Window changed
|
||||
// Ask user to save current layout constraints?
|
||||
//
|
||||
void TLayoutDialog::HandleWindowChange()
|
||||
{
|
||||
if (ChildNum >= 0) {
|
||||
// Save all of the current settings, unless this is the first call
|
||||
//
|
||||
GetLayoutConstraint(ChildInfo[ChildNum].LayoutMetrics.X,X1);
|
||||
GetLayoutConstraint(ChildInfo[ChildNum].LayoutMetrics.Width,X2);
|
||||
GetLayoutConstraint(ChildInfo[ChildNum].LayoutMetrics.Y,Y1);
|
||||
GetLayoutConstraint(ChildInfo[ChildNum].LayoutMetrics.Height,Y2);
|
||||
}
|
||||
// Switch to new window
|
||||
//
|
||||
ChildNum = WindowList->GetSelIndex();
|
||||
if (ChildNum >= 0) {
|
||||
SetLayoutConstraint(ChildInfo[ChildNum].LayoutMetrics.X,X1);
|
||||
SetLayoutConstraint(ChildInfo[ChildNum].LayoutMetrics.Width,X2);
|
||||
SetLayoutConstraint(ChildInfo[ChildNum].LayoutMetrics.Y,Y1);
|
||||
SetLayoutConstraint(ChildInfo[ChildNum].LayoutMetrics.Height,Y2);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Get the constraints from each window, update child window
|
||||
//
|
||||
void TLayoutDialog::HandleLayout()
|
||||
{
|
||||
TLayoutMetrics& lm = ChildInfo[ChildNum].LayoutMetrics;
|
||||
|
||||
GetLayoutConstraint(lm.X,X1);
|
||||
GetLayoutConstraint(lm.Width,X2);
|
||||
GetLayoutConstraint(lm.Y,Y1);
|
||||
GetLayoutConstraint(lm.Height,Y2);
|
||||
|
||||
// Check some basic restrictions
|
||||
//
|
||||
if (lm.X.MyEdge == lm.Width.MyEdge) {
|
||||
MessageBox("X1.MyEdge can not be the same as X2.MyEdge");
|
||||
return;
|
||||
}
|
||||
if (lm.Y.MyEdge == lm.Height.MyEdge) {
|
||||
MessageBox("Y1.MyEdge can not be the same as Y2.MyEdge");
|
||||
return;
|
||||
}
|
||||
|
||||
Parent->PostMessage(WM_COMMAND, CM_RELAYOUT);
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// ObjectWindows - (C) Copyright 1993 by Borland International
|
||||
//----------------------------------------------------------------------------
|
||||
#ifndef __LAYDIA_H
|
||||
#define __LAYDIA_H
|
||||
|
||||
#ifndef __OWL_DIALOG_H
|
||||
#include <owl\dialog.h>
|
||||
#endif
|
||||
class _OWLCLASS TEdit;
|
||||
class _OWLCLASS TComboBox;
|
||||
class _OWLCLASS TListBox;
|
||||
|
||||
#define WM_SET_X (WM_USER + 100)
|
||||
|
||||
const int MaxWindows = 10;
|
||||
|
||||
struct TChildInfo {
|
||||
TWindow* Child;
|
||||
TLayoutMetrics LayoutMetrics;
|
||||
};
|
||||
|
||||
class TLayoutDialog : public TDialog {
|
||||
public:
|
||||
TLayoutDialog(TLayoutWindow* parent, TResId resId, TChildInfo* info);
|
||||
enum Constraint { X1, X2, Y1, Y2};
|
||||
|
||||
protected:
|
||||
char* Title;
|
||||
TLayoutWindow* LayoutWindow;
|
||||
|
||||
void SetupWindow();
|
||||
void HandleLayout();
|
||||
void HandleWindowChange();
|
||||
|
||||
void SetLayoutConstraint(TLayoutConstraint& lc, Constraint which);
|
||||
void GetLayoutConstraint(TLayoutConstraint& lc, Constraint which);
|
||||
|
||||
TChildInfo* ChildInfo;
|
||||
int ChildNum;
|
||||
|
||||
TListBox* WindowList;
|
||||
|
||||
TComboBox* X1EdgeCombo;
|
||||
TComboBox* X2EdgeCombo;
|
||||
TComboBox* Y1EdgeCombo;
|
||||
TComboBox* Y2EdgeCombo;
|
||||
|
||||
TComboBox* X1OtherEdgeCombo;
|
||||
TComboBox* X2OtherEdgeCombo;
|
||||
TComboBox* Y1OtherEdgeCombo;
|
||||
TComboBox* Y2OtherEdgeCombo;
|
||||
|
||||
TComboBox* X1UnitsCombo;
|
||||
TComboBox* X2UnitsCombo;
|
||||
TComboBox* Y1UnitsCombo;
|
||||
TComboBox* Y2UnitsCombo;
|
||||
|
||||
TEdit* X1ValueEdit;
|
||||
TEdit* X2ValueEdit;
|
||||
TEdit* Y1ValueEdit;
|
||||
TEdit* Y2ValueEdit;
|
||||
|
||||
TComboBox* X1RelationCombo;
|
||||
TComboBox* X2RelationCombo;
|
||||
TComboBox* Y1RelationCombo;
|
||||
TComboBox* Y2RelationCombo;
|
||||
|
||||
TComboBox* X1RelWinCombo;
|
||||
TComboBox* X2RelWinCombo;
|
||||
TComboBox* Y1RelWinCombo;
|
||||
TComboBox* Y2RelWinCombo;
|
||||
|
||||
DECLARE_RESPONSE_TABLE(TLayoutDialog);
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,118 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// 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();
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,49 @@
|
||||
//------------------------------------------------------------------------
|
||||
// ObjectWindows - (C) Copyright 1993 by Borland International
|
||||
//------------------------------------------------------------------------
|
||||
#ifndef __LAYOUT_H
|
||||
#define __LAYOUT_H
|
||||
|
||||
#ifndef __OWL_DECMDIFR_H
|
||||
#include <owl\decmdifr.h>
|
||||
#endif
|
||||
|
||||
#ifndef __OWL_COLOR_H
|
||||
#include <owl\color.h>
|
||||
#endif
|
||||
|
||||
#ifndef __LAYOUTRC_H
|
||||
#include "layout.rh"
|
||||
#endif
|
||||
#ifndef __LAYDIA_H
|
||||
#include "laydia.h"
|
||||
#endif
|
||||
|
||||
class TMyChildWindow : public TWindow {
|
||||
public:
|
||||
TMyChildWindow(TWindow* parent, int id, char far* title,
|
||||
TColor color);
|
||||
};
|
||||
|
||||
const int MaxChildren = 5;
|
||||
|
||||
class TMyLayout : public TLayoutWindow {
|
||||
public:
|
||||
TMyLayout(TWindow* parent);
|
||||
|
||||
protected:
|
||||
void SetupWindow();
|
||||
|
||||
private:
|
||||
void CmLayout();
|
||||
void CmReLayout();
|
||||
|
||||
private:
|
||||
TChildInfo ChildInfo[MaxChildren+1];
|
||||
|
||||
TLayoutDialog *LayoutDialog;
|
||||
|
||||
DECLARE_RESPONSE_TABLE(TMyLayout);
|
||||
};
|
||||
|
||||
#endif
|
||||
Binary file not shown.
@@ -0,0 +1,59 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// ObjectWindows - (C) Copyright 1993 by Borland International
|
||||
//----------------------------------------------------------------------------
|
||||
#include "layout.rh"
|
||||
|
||||
#include <owl\owlapp.rc> // default owl app icon
|
||||
|
||||
IDM_LAYOUT MENU
|
||||
{
|
||||
POPUP "&Layout"
|
||||
{
|
||||
MENUITEM "&Layout Tweaker...", CM_LAYOUT
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
IDD_LAYOUT DIALOG 2, 60, 339, 113
|
||||
STYLE WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Layout Tweaker"
|
||||
FONT 8, "MS Sans Serif"
|
||||
{
|
||||
CTEXT "Window", -1, 6, 6, 48, 8
|
||||
LISTBOX ID_WINDOWLIST, 6, 18, 51, 54, LBS_NOTIFY | LBS_NOINTEGRALHEIGHT | WS_BORDER | WS_TABSTOP
|
||||
RTEXT "MyEdge:", -1, 63, 17, 43, 9
|
||||
COMBOBOX ID_X1_MYEDGE, 108, 15, 54, 54, CBS_DROPDOWNLIST | WS_VSCROLL | WS_GROUP | WS_TABSTOP
|
||||
RTEXT "Relationship:", -1, 63, 32, 43, 9
|
||||
COMBOBOX ID_X1_RELATIONSHIP, 108, 30, 54, 76, CBS_DROPDOWNLIST | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP
|
||||
RTEXT "RelWin:", -1, 63, 47, 43, 9
|
||||
COMBOBOX ID_X1_RELWIN, 108, 45, 54, 72, CBS_DROPDOWNLIST | WS_VISIBLE | WS_TABSTOP
|
||||
RTEXT "OtherEdge:", -1, 63, 62, 43, 10
|
||||
COMBOBOX ID_X1_OTHEREDGE, 108, 60, 54, 60, CBS_DROPDOWNLIST | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP
|
||||
RTEXT "Abs,PerCent,Offset:", -1, 36, 77, 69, 9
|
||||
EDITTEXT ID_X1_VALUE, 108, 75, 36, 12
|
||||
RTEXT "Units:", -1, 83, 95, 23, 8
|
||||
COMBOBOX ID_X1_UNITS, 108, 93, 54, 40, CBS_DROPDOWNLIST | WS_VISIBLE | WS_TABSTOP
|
||||
DEFPUSHBUTTON "&Layout Now", ID_LAYOUT, 6, 93, 54, 14
|
||||
CTEXT "Horizontal 1", -1, 108, 6, 54, 8
|
||||
COMBOBOX ID_X2_MYEDGE, 165, 15, 54, 54, CBS_DROPDOWNLIST | WS_VSCROLL | WS_GROUP | WS_TABSTOP
|
||||
COMBOBOX ID_X2_RELATIONSHIP, 165, 30, 54, 76, CBS_DROPDOWNLIST | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP
|
||||
COMBOBOX ID_X2_RELWIN, 165, 45, 54, 72, CBS_DROPDOWNLIST | WS_VISIBLE | WS_TABSTOP
|
||||
COMBOBOX ID_X2_OTHEREDGE, 165, 60, 54, 60, CBS_DROPDOWNLIST | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP
|
||||
COMBOBOX ID_Y1_MYEDGE, 222, 15, 54, 54, CBS_DROPDOWNLIST | WS_VSCROLL | WS_GROUP | WS_TABSTOP
|
||||
COMBOBOX ID_Y1_RELATIONSHIP, 222, 30, 54, 76, CBS_DROPDOWNLIST | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP
|
||||
COMBOBOX ID_Y1_RELWIN, 222, 45, 54, 72, CBS_DROPDOWNLIST | WS_VISIBLE | WS_TABSTOP
|
||||
COMBOBOX ID_Y1_OTHEREDGE, 222, 60, 54, 60, CBS_DROPDOWNLIST | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP
|
||||
COMBOBOX ID_Y2_MYEDGE, 279, 15, 54, 54, CBS_DROPDOWNLIST | WS_VSCROLL | WS_GROUP | WS_TABSTOP
|
||||
COMBOBOX ID_Y2_RELATIONSHIP, 279, 30, 54, 76, CBS_DROPDOWNLIST | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP
|
||||
COMBOBOX ID_Y2_RELWIN, 279, 45, 54, 72, CBS_DROPDOWNLIST | WS_VISIBLE | WS_TABSTOP
|
||||
COMBOBOX ID_Y2_OTHEREDGE, 279, 60, 54, 60, CBS_DROPDOWNLIST | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP
|
||||
CTEXT "Horizontal 2", -1, 165, 6, 54, 8
|
||||
CTEXT "Vertical 1", -1, 222, 6, 54, 8
|
||||
CTEXT "Vertical 2", -1, 279, 6, 54, 8
|
||||
EDITTEXT ID_X2_VALUE, 165, 75, 36, 12
|
||||
EDITTEXT ID_Y1_VALUE, 222, 75, 36, 12
|
||||
EDITTEXT ID_Y2_VALUE, 279, 75, 36, 12
|
||||
COMBOBOX ID_X2_UNITS, 165, 93, 54, 40, CBS_DROPDOWNLIST | WS_VISIBLE | WS_TABSTOP
|
||||
COMBOBOX ID_Y1_UNITS, 222, 93, 54, 40, CBS_DROPDOWNLIST | WS_VISIBLE | WS_TABSTOP
|
||||
COMBOBOX ID_Y2_UNITS, 279, 93, 54, 40, CBS_DROPDOWNLIST | WS_VISIBLE | WS_TABSTOP
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// ObjectWindows - (C) Copyright 1993 by Borland International
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
// style dialog ids
|
||||
//
|
||||
#define ID_WS_POPUP 301
|
||||
#define ID_WS_MINIMIZE 302
|
||||
#define ID_WS_MAXIMIZE 303
|
||||
#define ID_WS_CAPTION 304
|
||||
#define ID_WS_BORDER 305
|
||||
#define ID_WS_DLGFRAME 306
|
||||
#define ID_WS_VSCROLL 307
|
||||
#define ID_WS_HSCROLL 308
|
||||
#define ID_WS_SYSMENU 309
|
||||
#define ID_WS_THICKFRAME 310
|
||||
#define ID_WS_MINIMIZEBOX 311
|
||||
#define ID_WS_MAXIMIZEBOX 312
|
||||
#define ID_WS_OVERLAPPEDWINDOW 313
|
||||
#define ID_WS_POPUPWINDOW 314
|
||||
#define ID_WS_CHILDWINDOW 315
|
||||
#define ID_WS_CLIPSIBLINGS 316
|
||||
#define ID_WS_CLIPCHILDREN 317
|
||||
#define ID_WS_VISIBLE 318
|
||||
#define ID_WS_DISABLED 319
|
||||
#define ID_WS_OVERLAPPED 320
|
||||
#define ID_WS_CHILD 321
|
||||
#define ID_CLEARALL 322
|
||||
|
||||
// change the metrics dialog
|
||||
//
|
||||
#define ID_X 101
|
||||
#define ID_Y 102
|
||||
#define ID_WIDTH 103
|
||||
#define ID_HEIGHT 104
|
||||
#define ID_LAYOUT 105
|
||||
#define ID_WINDOWLIST 108
|
||||
|
||||
#define ID_MYEDGE 110
|
||||
#define ID_RELWIN 111
|
||||
#define ID_RELATIONSHIP 112
|
||||
#define ID_OTHEREDGE 113
|
||||
#define ID_VALUE 114
|
||||
#define ID_UNITS 115
|
||||
#define ID_Y2_VALUE 127
|
||||
#define ID_Y2_OTHEREDGE 124
|
||||
#define ID_Y2_RELWIN 123
|
||||
#define ID_Y2_RELATIONSHIP 122
|
||||
#define ID_Y2_MYEDGE 121
|
||||
#define ID_Y1_UNITS 416
|
||||
#define ID_Y2_UNITS 130
|
||||
#define ID_Y1_VALUE 417
|
||||
#define ID_Y1_OTHEREDGE 413
|
||||
#define ID_Y1_RELWIN 415
|
||||
#define ID_Y1_RELATIONSHIP 414
|
||||
#define ID_Y1_MYEDGE 412
|
||||
#define ID_X2_UNITS 410
|
||||
#define ID_X2_VALUE 411
|
||||
#define ID_X2_OTHEREDGE 407
|
||||
#define ID_X2_RELWIN 409
|
||||
#define ID_X2_RELATIONSHIP 408
|
||||
#define ID_X2_MYEDGE 406
|
||||
#define ID_X1_UNITS 404
|
||||
#define ID_X1_VALUE 405
|
||||
#define ID_X1_OTHEREDGE 400
|
||||
#define ID_X1_RELWIN 403
|
||||
#define ID_X1_RELATIONSHIP 402
|
||||
#define ID_X1_MYEDGE 401
|
||||
|
||||
// Main window menu commands
|
||||
//
|
||||
#define CM_LAYOUT 201
|
||||
#define CM_RELAYOUT 202
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
#----------------------------------------------------------------------------
|
||||
# ObjectWindows - (C) Copyright 1991, 1993 by Borland International
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
EXERES = layout
|
||||
OBJEXE = layout.obj laydia.obj
|
||||
MODELS = mldf
|
||||
!include $(BCEXAMPLEDIR)\owlmake.gen
|
||||
Reference in New Issue
Block a user