- 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>
234 lines
7.4 KiB
C++
234 lines
7.4 KiB
C++
//
|
|
//----------------------------------------------------------------------------
|
|
// ObjectComponents
|
|
// (C) Copyright 1994 by Borland International, All Rights Reserved
|
|
//
|
|
// Definition of TOcPart class
|
|
//----------------------------------------------------------------------------
|
|
#if !defined(OCF_OCPART_H)
|
|
#define OCF_OCPART_H
|
|
|
|
#if !defined(OCF_BOLEINTF_H)
|
|
# include <ocf/boleintf.h>
|
|
#endif
|
|
#if !defined(OCF_OCOBJECT_H)
|
|
# include <ocf/ocobject.h>
|
|
#endif
|
|
#if !defined(OCF_AUTODEFS_H)
|
|
# include <ocf/autodefs.h>
|
|
#endif
|
|
#if !defined(CLASSLIB_VECTIMP_H)
|
|
# include <classlib/vectimp.h>
|
|
#endif
|
|
#if !defined(OSL_GEOMETRY_H)
|
|
# include <osl/geometry.h>
|
|
#endif
|
|
|
|
// Classes referenced
|
|
//
|
|
class _ICLASS TOcStorage;
|
|
class _ICLASS TOcDocument;
|
|
class TOcVerb;
|
|
|
|
//
|
|
// OC part class represents an embeded or linked part in a document
|
|
//
|
|
class _ICLASS TOcPart : public TUnknown, private IBSite {
|
|
public:
|
|
TOcPart(TOcDocument& document, TOcInitInfo far& initInfo, TRect pos,
|
|
int id = 0);
|
|
TOcPart(TOcDocument& document, const char far* name);
|
|
|
|
void Delete();
|
|
|
|
bool operator ==(const TOcPart& other) {return ToBool(&other == this);}
|
|
|
|
// Delegated doc functions from TOcDocument
|
|
//
|
|
IBPart* GetBPartI() {return BPartI;}
|
|
bool Save(bool SameAsLoad = true, bool remember = true);
|
|
bool Load();
|
|
int Detach();
|
|
void FinishLoading();
|
|
|
|
// Position & size information
|
|
//
|
|
TPoint GetPos() const {return Pos;}
|
|
void SetPos(const TPoint& pos);
|
|
TSize GetSize() const;
|
|
void SetSize(const TSize& size);
|
|
TRect GetRect() const {return TRect(Pos, Size);}
|
|
void UpdateRect();
|
|
bool IsVisible(const TRect& logicalRect) const
|
|
{return ToBool(IsVisible() && logicalRect.Touches(GetRect()));}
|
|
|
|
// Flag accessor functions
|
|
//
|
|
void Select(bool select)
|
|
{if (select) Flags |= Selected; else Flags &= ~Selected;}
|
|
bool IsSelected() const {return ToBool(Flags&Selected);}
|
|
void SetVisible(bool visible)
|
|
{if (visible) Flags |= Visible; else Flags &= ~Visible;}
|
|
bool IsVisible() const {return ToBool(Flags&Visible);}
|
|
bool IsActive() const {return ToBool(Flags&Active);}
|
|
void SetActive() {Flags |= Active;}
|
|
bool IsLink() const {return ToBool(Flags&Link);}
|
|
|
|
// Naming
|
|
//
|
|
TString GetName() {return Name;}
|
|
void Rename();
|
|
|
|
// Pass thru functions to corresponding IBPart
|
|
//
|
|
bool Save(IStorage* storage, bool sameAsLoad, bool remember);
|
|
bool Draw(HDC dc, const TRect& pos, const TRect& clip, TOcAspect aspect = asDefault);
|
|
bool Activate(bool activate);
|
|
bool Show(bool show) {return HRSucceeded(BPartI->Show(show));}
|
|
bool Open(bool open) {return HRSucceeded(BPartI->Open(open));}
|
|
HWND OpenInPlace(HWND hwnd) {return BPartI->OpenInPlace(hwnd);}
|
|
bool CanOpenInPlace() {return HRSucceeded(BPartI->CanOpenInPlace());}
|
|
bool Close();
|
|
bool SetHost(IBContainer far* container)
|
|
{return HRSucceeded(BPartI->SetHost(container));}
|
|
|
|
bool EnumVerbs(const TOcVerb&);
|
|
bool DoVerb(uint);
|
|
LPCOLESTR GetServerName(TOcPartName partName)
|
|
{return const_cast<LPOLESTR>(BPartI->GetName((TOcPartName)partName));}
|
|
HRESULT QueryServer(const IID far& iid, void far* far* iface);
|
|
|
|
bool SetFormatData(TOcFormatInfo far* fmt, HANDLE data, bool release);
|
|
|
|
// Object reference & lifetime managment
|
|
// For internal OCF use only
|
|
//
|
|
ulong _IFUNC AddRef() {return GetOuter()->AddRef();}
|
|
ulong _IFUNC Release() {return GetOuter()->Release();}
|
|
HRESULT _IFUNC QueryInterface(const GUID far& iid, void far*far* iface)
|
|
{return GetOuter()->QueryInterface(iid, iface);}
|
|
|
|
protected:
|
|
~TOcPart();
|
|
|
|
void Init(TOcInitInfo far& initInfo); // ctor helper
|
|
|
|
// TUnknown virtual overrides
|
|
//
|
|
HRESULT QueryObject(const IID far& iid, void far* far* iface);
|
|
|
|
// IBSite implementation for BOle to use
|
|
//
|
|
HRESULT _IFUNC SiteShow(bool);
|
|
HRESULT _IFUNC DiscardUndo();
|
|
HRESULT _IFUNC GetSiteRect(TRect far*, TRect far*);
|
|
HRESULT _IFUNC SetSiteRect(const TRect far*);
|
|
HRESULT _IFUNC SetSiteExtent(const TSize far*);
|
|
HRESULT _IFUNC GetZoom(TOcScaleInfo far* scale);
|
|
void _IFUNC Invalidate(TOcInvalidate);
|
|
void _IFUNC OnSetFocus(bool set);
|
|
HRESULT _IFUNC Init(IBDataProvider far*, IBPart far*, LPCOLESTR, bool);
|
|
void _IFUNC Disconnect();
|
|
|
|
protected:
|
|
IUnknown* BPart; // Our corresponding helper object & interfaces
|
|
IBPart* BPartI;
|
|
IBLinkable* BLPartI;
|
|
|
|
TOcDocument& OcDocument; // The OC document we are imbeded in
|
|
TOcStorage* Storage; // The storage we are in
|
|
|
|
#if defined(BI_DATA_NEAR)
|
|
string& Name; // Name of this part
|
|
TPoint& Pos; // position of this part in the document
|
|
TSize& Size; // Keep our idea of size independently
|
|
#else
|
|
string Name;
|
|
TPoint Pos;
|
|
TSize Size;
|
|
#endif
|
|
enum TFlag { Visible=0x01, Selected=0x02, Active=0x04, Link=0x08, Closing=0x10 };
|
|
uint16 Flags; // Is this part Selected/Visible/Active/ALink?
|
|
|
|
friend class TOcPartCollection;
|
|
};
|
|
|
|
//
|
|
// Container of parts with iterator
|
|
//
|
|
class TOcPartCollection : private TCVectorImp<TOcPart*> {
|
|
private:
|
|
typedef TCVectorImp<TOcPart*> Base;
|
|
friend class TOcPartCollectionIter;
|
|
public:
|
|
TOcPartCollection();
|
|
~TOcPartCollection();
|
|
void operator delete(void* ptr) {TStandardAllocator::operator delete(ptr);}
|
|
|
|
void Clear();
|
|
int Add(TOcPart* const& part) {return Base::Add(part);}
|
|
int IsEmpty() const {return Base::IsEmpty();}
|
|
unsigned Find(TOcPart* const& part) const {return Base::Find(part);}
|
|
virtual unsigned Count() const {return Base::Count();}
|
|
int Detach(TOcPart* const& part, int del = 0);
|
|
|
|
TOcPart* Locate(TPoint& point);
|
|
bool SelectAll(bool select = false);
|
|
};
|
|
|
|
//
|
|
//
|
|
//
|
|
class TOcPartCollectionIter : private TCVectorIteratorImp<TOcPart*> {
|
|
private:
|
|
typedef TCVectorIteratorImp<TOcPart*> Base;
|
|
public:
|
|
TOcPartCollectionIter(const TOcPartCollection& c) : Base(c) {}
|
|
operator int() const {return Base::operator int();}
|
|
TOcPart* Current() const {return Base::Current();}
|
|
TOcPart* operator ++(int) {return Base::operator ++(0);}
|
|
TOcPart* operator ++() {return Base::operator ++();}
|
|
void Restart() {Base::Restart();}
|
|
void Restart(unsigned start, unsigned stop) {Base::Restart(start, stop);}
|
|
};
|
|
|
|
//
|
|
//
|
|
//
|
|
class TOcVerb {
|
|
public:
|
|
TOcVerb();
|
|
|
|
public:
|
|
LPCOLESTR TypeName;
|
|
LPCOLESTR VerbName;
|
|
uint VerbIndex;
|
|
bool CanDirty;
|
|
};
|
|
|
|
//
|
|
// View/Data change info
|
|
//
|
|
class TOcPartChangeInfo {
|
|
public:
|
|
TOcPartChangeInfo(TOcPart* part, TOcInvalidate type = invView)
|
|
: Part(part), Type(type) {}
|
|
|
|
bool IsDataChange() {return Type & invData;}
|
|
bool IsViewChange() {return Type & invView;}
|
|
|
|
void SetDataChange() {Type |= invData;}
|
|
void SetViewChange() {Type |= invView;}
|
|
|
|
TOcPart* GetPart() {return Part;}
|
|
void SetPart(TOcPart* part) {Part = part;}
|
|
|
|
int GetType() {return Type;}
|
|
|
|
protected:
|
|
int Type; // what type of change
|
|
TOcPart* Part;
|
|
};
|
|
#endif
|
|
|