- 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>
654 lines
22 KiB
Plaintext
654 lines
22 KiB
Plaintext
##{cheader.snp}
|
|
#include <owl\owlpch.h>
|
|
#pragma hdrstop
|
|
|
|
##@OPT_APPL_DRAGDROP 2
|
|
#include <dir.h>
|
|
|
|
##QUERY_FILE_H [[FileName]]
|
|
#include "[[FileName]]"
|
|
##--BEGIN-- @QUERY_APPL_MODEL != VALUE_DIALOG
|
|
##OPT_DV_RESET
|
|
##OPT_DV_NEXT
|
|
##QUERY_DV_TVIEW [[WindowClient]]
|
|
##<<*WindowClient QUERY_FILE_H [[FileName]]
|
|
#include "[[FileName]]" // Definition of client class.
|
|
##--END-- @QUERY_APPL_MODEL != VALUE_DIALOG
|
|
##--BEGIN-- @QUERY_APPL_MODEL == VALUE_DIALOG
|
|
##QUERY_WIND_CLIENT [[Client]]
|
|
##<<*Client QUERY_FILE_H [[Filename]]
|
|
#include "[[Filename]]" // Definition of client class.
|
|
##--END-- @QUERY_APPL_MODEL == VALUE_DIALOG
|
|
##--BEGIN-- ((@QUERY_APPL_MODEL != VALUE_DIALOG) || ((@QUERY_APPL_MODEL == VALUE_DIALOG) && @QUERY_APPL_DLGCLIENT_MENU))
|
|
## :<<TDialog QUERY_FILE_H [[Filename]]
|
|
#include "[[Filename]]" // Definition of about dialog.
|
|
##--END-- ((@QUERY_APPL_MODEL != VALUE_DIALOG) || ((@QUERY_APPL_MODEL == VALUE_DIALOG) && @QUERY_APPL_DLGCLIENT_MENU))
|
|
|
|
|
|
##--BEGIN-- @OPT_APPL_HELP
|
|
##--BEGIN-- @QUERY_APPL_COMMENT == VALUE_VERBOSE
|
|
//
|
|
// Generated help file.
|
|
//
|
|
##--END-- @QUERY_APPL_COMMENT == VALUE_VERBOSE
|
|
##@QUERY_APPL_HELP [[HelpFile]]
|
|
const char HelpFileName[] = "[[HelpFile]].hlp";
|
|
|
|
|
|
##--END-- @OPT_APPL_HELP
|
|
##{cdragdrp.owl}
|
|
//{{[[TApplication]] Implementation}}
|
|
|
|
|
|
##--BEGIN-- @QUERY_APPL_OLE_AUTO
|
|
//
|
|
// OLE's ITypeInfo browses this symbol table for a list of all data,
|
|
// properties, and methods exposed by this automated class.
|
|
//
|
|
##@QUERY_APPL_OLE != VALUE_NOOLE
|
|
DEFINE_AUTOAGGREGATE([[TApplication]], OcApp->Aggregate)
|
|
##@QUERY_APPL_OLE == VALUE_NOOLE
|
|
DEFINE_AUTOCLASS([[TApplication]])
|
|
EXPOSE_APPLICATION([[TApplication]], "Application", "Application object", 0)
|
|
EXPOSE_QUIT("Quit", "Quit application", 0)
|
|
//{{[[TApplication]]SYM_TBL_BEGIN}}
|
|
//{{[[TApplication]]SYM_TBL_END}}
|
|
##@QUERY_APPL_OLE != VALUE_NOOLE
|
|
END_AUTOAGGREGATE([[TApplication]], tfAppObject | tfCanCreate, "[[TApplication]]", 0, 0);
|
|
##@QUERY_APPL_OLE == VALUE_NOOLE
|
|
END_AUTOCLASS([[TApplication]], tfAppObject | tfCanCreate, "[[TApplication]]", 0, 0);
|
|
|
|
|
|
##--END-- @QUERY_APPL_OLE_AUTO
|
|
##((@QUERY_APPL_OLE != VALUE_NOOLE) || @QUERY_APPL_OLE_AUTO) 2
|
|
DEFINE_APP_DICTIONARY(AppDictionary);
|
|
|
|
##((@QUERY_APPL_OLE == VALUE_NOOLE) && @QUERY_APPL_OLE_AUTO)
|
|
static TPointer<TRegistrar> Registrar;
|
|
##((@QUERY_APPL_OLE != VALUE_NOOLE)
|
|
static TPointer<TOcRegistrar> Registrar;
|
|
|
|
##--BEGIN-- ((@QUERY_APPL_OLE != VALUE_NOOLE) || @QUERY_APPL_OLE_AUTO)
|
|
REGISTRATION_FORMAT_BUFFER(100)
|
|
|
|
BEGIN_REGISTRATION(ApplicationReg)
|
|
##@QUERY_OLE_GUID [[GUID]]
|
|
REGDATA(clsid, "{[[GUID]]}")
|
|
##--BEGIN-- @QUERY_PRJ_NAME [[AppTitle]]
|
|
##((@QUERY_APPL_OLE == VALUE_SERVER) || (@QUERY_APPL_OLE == VALUE_OLEBOTH) || @QUERY_APPL_OLE_AUTO) 2
|
|
REGDATA(appname, "[[AppTitle]] Server")
|
|
REGDATA(description, "[[AppTitle]] Server Application")
|
|
##((@QUERY_APPL_OLE == VALUE_CONTAINER) && !@QUERY_APPL_OLE_AUTO) 2
|
|
REGDATA(appname, "[[AppTitle]] Container")
|
|
REGDATA(description, "[[AppTitle]] Container Application")
|
|
##@QUERY_APPL_OLE_AUTO
|
|
REGDATA(progid, "[[AppTitle]].Application.1")
|
|
##--END-- @QUERY_PRJ_NAME [[AppTitle]]
|
|
##@QUERY_APPL_OLE_AUTO
|
|
REGDATA(cmdline, "/Automation")
|
|
##!@QUERY_APPL_OLE_AUTO
|
|
REGDATA(cmdline, "")
|
|
##--BEGIN-- ((@QUERY_APPL_OLE == VALUE_SERVER) || (@QUERY_APPL_OLE == VALUE_OLEBOTH))
|
|
REGDATA(usage, ocrMultipleUse)
|
|
##--BEGIN-- @QUERY_APPL_OLE_AUTO
|
|
// REGDATA(debugger, "TDW")
|
|
##--END-- @QUERY_APPL_OLE_AUTO
|
|
##--END-- ((@QUERY_APPL_OLE == VALUE_SERVER) || (@QUERY_APPL_OLE == VALUE_OLEBOTH))
|
|
END_REGISTRATION
|
|
|
|
##--END-- @QUERY_APPL_OLE != VALUE_NOOLE
|
|
##--BEGIN-- @QUERY_APPL_MODEL == VALUE_DIALOG
|
|
##: @QUERY_APPL_DLGCLIENT [[DLogClient]]
|
|
DEFINE_DOC_TEMPLATE_CLASS(TFileDocument, [[DLogClient]], DlgDTPL);
|
|
DlgDTPL __dlogClnt("All Files (*.*)", "*.*", 0, "TXT", dtAutoDelete | dtUpdateDir);
|
|
|
|
|
|
##--END-- @QUERY_APPL_MODEL == VALUE_DIALOG
|
|
##@QUERY_APPL_OLE != VALUE_NOOLE
|
|
##: {AddOleDV.SNP}
|
|
##*
|
|
##@QUERY_APPL_OLE == VALUE_NOOLE
|
|
##: {AddDocV.SNP}
|
|
##*
|
|
|
|
|
|
##--BEGIN-- @QUERY_APPL_COMMENT == VALUE_VERBOSE
|
|
//
|
|
// Build a response table for all messages/commands handled
|
|
// by the application.
|
|
//
|
|
##--END-- @QUERY_APPL_COMMENT == VALUE_VERBOSE
|
|
DEFINE_RESPONSE_TABLE1([[TApplication]], TApplication)
|
|
//{{[[TApplication]]RSP_TBL_BEGIN}}
|
|
EV_OWLVIEW(dnCreate, EvNewView),
|
|
EV_OWLVIEW(dnClose, EvCloseView),
|
|
##:DBResponse(\\"[[TApplication]]", "CM_HELPABOUT", "CmHelpAbout", "", "COMMAND")
|
|
EV_COMMAND(CM_HELPABOUT, CmHelpAbout),
|
|
##@OPT_APPL_HELP 2
|
|
##:DBResponse(\\"[[TApplication]]", "CM_HELPCONTENTS", "CmHelpContents", "", "COMMAND")
|
|
##:DBResponse(\\"[[TApplication]]", "CM_HELPUSING", "CmHelpUsing", "", "COMMAND")
|
|
EV_COMMAND(CM_HELPCONTENTS, CmHelpContents),
|
|
EV_COMMAND(CM_HELPUSING, CmHelpUsing),
|
|
##@OPT_APPL_PRINTING 6
|
|
##:DBResponse(\\"[[TApplication]]", "CM_FILEPRINT", "CmFilePrint", "", "COMMAND")
|
|
##:DBResponse(\\"[[TApplication]]", "CM_FILEPRINTERSETUP", "CmFilePrintSetup", "", "COMMAND")
|
|
##:DBResponse(\\"[[TApplication]]", "CM_FILEPRINTPREVIEW", "CmFilePrintPreview", "", "COMMAND")
|
|
##:DBResponse(\\"[[TApplication]]", "CM_FILEPRINT", "CmPrintEnable", "", "ENABLER")
|
|
##:DBResponse(\\"[[TApplication]]", "CM_FILEPRINTERSETUP", "CmPrintEnable", "", "ENABLER")
|
|
##:DBResponse(\\"[[TApplication]]", "CM_FILEPRINTPREVIEW", "CmPrintEnable", "", "ENABLER")
|
|
EV_COMMAND(CM_FILEPRINT, CmFilePrint),
|
|
EV_COMMAND(CM_FILEPRINTERSETUP, CmFilePrintSetup),
|
|
EV_COMMAND(CM_FILEPRINTPREVIEW, CmFilePrintPreview),
|
|
EV_COMMAND_ENABLE(CM_FILEPRINT, CmPrintEnable),
|
|
EV_COMMAND_ENABLE(CM_FILEPRINTERSETUP, CmPrintEnable),
|
|
EV_COMMAND_ENABLE(CM_FILEPRINTPREVIEW, CmPrintEnable),
|
|
##@OPT_APPL_DRAGDROP
|
|
##:DBResponse(\\"[[TApplication]]", "", "", "WM_DROPFILES", "")
|
|
EV_WM_DROPFILES,
|
|
##@OPT_APPL_PRINTING
|
|
##:DBResponse(\\"[[TApplication]]", "", "", "WM_WININICHANGE", "")
|
|
EV_WM_WININICHANGE,
|
|
//{{[[TApplication]]RSP_TBL_END}}
|
|
END_RESPONSE_TABLE;
|
|
|
|
|
|
##--BEGIN-- @QUERY_APPL_COMMENT == VALUE_VERBOSE
|
|
//////////////////////////////////////////////////////////
|
|
// [[TApplication]]
|
|
// =====
|
|
//
|
|
##--END-- @QUERY_APPL_COMMENT == VALUE_VERBOSE
|
|
##((@QUERY_APPL_OLE == VALUE_NOOLE) && (@QUERY_APPL_OLE_AUTO))
|
|
[[TApplication]]::[[TApplication]] () : TApplication(::ApplicationReg["appname"], ::Module, &::AppDictionary)
|
|
##@QUERY_APPL_OLE != VALUE_NOOLE
|
|
[[TApplication]]::[[TApplication]] () : TApplication(::ApplicationReg["appname"], ::Module, &::AppDictionary)
|
|
##((@QUERY_APPL_OLE == VALUE_NOOLE) && (!@QUERY_APPL_OLE_AUTO))
|
|
##QUERY_WIND_TITLE [[Title]]
|
|
[[TApplication]]::[[TApplication]] () : TApplication("[[Title]]")
|
|
{
|
|
##@OPT_APPL_HELP 4
|
|
HelpState = false;
|
|
ContextHelp = false;
|
|
HelpCursor = 0;
|
|
|
|
##@OPT_APPL_PRINTING 3
|
|
Printer = 0;
|
|
Printing = 0;
|
|
|
|
SetDocManager(new TDocManager(dmSDI, this));
|
|
|
|
// INSERT>> Your constructor code here.
|
|
}
|
|
|
|
|
|
[[TApplication]]::~[[TApplication]] ()
|
|
{
|
|
##@OPT_APPL_PRINTING 3
|
|
if (Printer)
|
|
delete Printer;
|
|
|
|
// INSERT>> Your destructor code here.
|
|
}
|
|
|
|
|
|
##--BEGIN-- @OPT_APPL_HELP
|
|
bool [[TApplication]]::CanClose ()
|
|
{
|
|
bool result = TApplication::CanClose();
|
|
|
|
##--BEGIN-- @QUERY_APPL_COMMENT == VALUE_VERBOSE
|
|
//
|
|
// Close the help engine if we used it.
|
|
//
|
|
##--END-- @QUERY_APPL_COMMENT == VALUE_VERBOSE
|
|
if (result && HelpState)
|
|
GetMainWindow()->WinHelp(HelpFileName, HELP_QUIT, 0L);
|
|
|
|
return result;
|
|
}
|
|
|
|
|
|
##--END-- @OPT_APPL_HELP
|
|
|
|
|
|
##(((@QUERY_APPL_MODEL == VALUE_DIALOG) && @QUERY_APPL_DLGCLIENT_MENU) || (@QUERY_APPL_MODEL != VALUE_DIALOG))
|
|
##--BEGIN-- @OPT_APPL_TOOLBAR
|
|
void [[TApplication]]::CreateGadgets (TControlBar *cb, bool server)
|
|
{
|
|
if (!server) {
|
|
cb->Insert(*new TButtonGadget(CM_FILENEW, CM_FILENEW));
|
|
cb->Insert(*new TButtonGadget(CM_FILEOPEN, CM_FILEOPEN));
|
|
cb->Insert(*new TButtonGadget(CM_FILESAVE, CM_FILESAVE));
|
|
cb->Insert(*new TSeparatorGadget(6));
|
|
}
|
|
|
|
cb->Insert(*new TButtonGadget(CM_EDITCUT, CM_EDITCUT));
|
|
cb->Insert(*new TButtonGadget(CM_EDITCOPY, CM_EDITCOPY));
|
|
cb->Insert(*new TButtonGadget(CM_EDITPASTE, CM_EDITPASTE));
|
|
cb->Insert(*new TSeparatorGadget(6));
|
|
cb->Insert(*new TButtonGadget(CM_EDITUNDO, CM_EDITUNDO));
|
|
cb->Insert(*new TSeparatorGadget(6));
|
|
cb->Insert(*new TButtonGadget(CM_EDITFIND, CM_EDITFIND));
|
|
cb->Insert(*new TButtonGadget(CM_EDITFINDNEXT, CM_EDITFINDNEXT));
|
|
##--BEGIN-- @OPT_APPL_PRINTING
|
|
|
|
if (!server) {
|
|
cb->Insert(*new TSeparatorGadget(6));
|
|
cb->Insert(*new TButtonGadget(CM_FILEPRINT, CM_FILEPRINT));
|
|
cb->Insert(*new TButtonGadget(CM_FILEPRINTPREVIEW, CM_FILEPRINTPREVIEW));
|
|
}
|
|
##--END-- @OPT_APPL_PRINTING
|
|
##@OPT_APPL_HELP 3
|
|
|
|
cb->Insert(*new TSeparatorGadget(6));
|
|
cb->Insert(*new TButtonGadget(CM_HELPCONTENTS, CM_HELPCONTENTS));
|
|
|
|
##@QUERY_APPL_COMMENT == VALUE_VERBOSE
|
|
// Add fly-over help hints.
|
|
cb->SetHintMode(TGadgetWindow::EnterHints);
|
|
}
|
|
|
|
|
|
##@QUERY_APPL_OLE == VALUE_NOOLE
|
|
void [[TApplication]]::SetupSpeedBar (TDecoratedFrame *frame)
|
|
##@QUERY_APPL_OLE != VALUE_NOOLE
|
|
void [[TApplication]]::SetupSpeedBar (TOleFrame *frame)
|
|
{
|
|
##--BEGIN-- @QUERY_APPL_COMMENT == VALUE_VERBOSE
|
|
//
|
|
// Create default toolbar New and associate toolbar buttons with commands.
|
|
//
|
|
##--END-- @QUERY_APPL_COMMENT == VALUE_VERBOSE
|
|
TControlBar* cb = new TControlBar(frame);
|
|
CreateGadgets(cb);
|
|
|
|
##@QUERY_APPL_COMMENT == VALUE_VERBOSE
|
|
// Setup the toolbar ID used by OLE 2 for toolbar negotiation.
|
|
cb->Attr.Id = IDW_TOOLBAR;
|
|
|
|
frame->Insert(*cb, TDecoratedFrame::Top);
|
|
}
|
|
|
|
|
|
##--END-- @OPT_APPL_TOOLBAR
|
|
##--BEGIN-- @QUERY_APPL_COMMENT == VALUE_VERBOSE
|
|
//////////////////////////////////////////////////////////
|
|
// [[TApplication]]
|
|
// =====
|
|
// Application intialization.
|
|
//
|
|
##--END-- @QUERY_APPL_COMMENT == VALUE_VERBOSE
|
|
void [[TApplication]]::InitMainWindow ()
|
|
{
|
|
if (nCmdShow != SW_HIDE)
|
|
##@QUERY_APPL_STARTUP == VALUE_NORMAL
|
|
nCmdShow = (nCmdShow != SW_SHOWMINNOACTIVE) ? SW_SHOWNORMAL : nCmdShow;
|
|
##@QUERY_APPL_STARTUP == VALUE_MIN
|
|
nCmdShow = (nCmdShow != SW_SHOWMINNOACTIVE) ? SW_SHOWMINIMIZED : nCmdShow;
|
|
##@QUERY_APPL_STARTUP == VALUE_MAX
|
|
nCmdShow = (nCmdShow != SW_SHOWMINNOACTIVE) ? SW_SHOWMAXIMIZED : nCmdShow;
|
|
|
|
##@OPT_APPL_STATUSBAR
|
|
SDIDecFrame *frame = new SDIDecFrame(0, GetName(), 0, true, this);
|
|
##!@OPT_APPL_STATUSBAR
|
|
SDIDecFrame *frame = new SDIDecFrame(0, GetName(), 0, false, this);
|
|
|
|
##QUERY_WIND_STYLE [[StyleAttributes]]
|
|
##StyleAttributes != "" 3
|
|
// Override the default window style for the main window.
|
|
[[StyleAttributes]]
|
|
|
|
##QUERY_WIND_BACKGRND [[BackgroundColor]]
|
|
##BackgroundColor != "" 3
|
|
// Change the window's background color
|
|
frame->SetBkgndColor([[BackgroundColor]]);
|
|
|
|
##--BEGIN-- @QUERY_APPL_COMMENT == VALUE_VERBOSE
|
|
//
|
|
// Assign ICON w/ this application.
|
|
//
|
|
##--END-- @QUERY_APPL_COMMENT == VALUE_VERBOSE
|
|
frame->SetIcon(this, IDI_SDIAPPLICATION);
|
|
|
|
##(((@QUERY_APPL_MODEL == VALUE_DIALOG) && @QUERY_APPL_DLGCLIENT_MENU) || (@QUERY_APPL_MODEL != VALUE_DIALOG))
|
|
##--BEGIN-- @QUERY_APPL_COMMENT == VALUE_VERBOSE
|
|
//
|
|
// Menu associated with window and accelerator table associated with table.
|
|
//
|
|
##--END-- @QUERY_APPL_COMMENT == VALUE_VERBOSE
|
|
##(((@QUERY_APPL_MODEL == VALUE_DIALOG) && @QUERY_APPL_DLGCLIENT_MENU) || (@QUERY_APPL_MODEL != VALUE_DIALOG)) 2
|
|
frame->AssignMenu(SDI_MENU);
|
|
|
|
##(((@QUERY_APPL_MODEL == VALUE_DIALOG) && @QUERY_APPL_DLGCLIENT_MENU) || (@QUERY_APPL_MODEL != VALUE_DIALOG))
|
|
##--BEGIN-- @QUERY_APPL_COMMENT == VALUE_VERBOSE
|
|
//
|
|
// Associate with the accelerator table.
|
|
//
|
|
##--END-- @QUERY_APPL_COMMENT == VALUE_VERBOSE
|
|
##(((@QUERY_APPL_MODEL == VALUE_DIALOG) && @QUERY_APPL_DLGCLIENT_MENU) || (@QUERY_APPL_MODEL != VALUE_DIALOG)) 2
|
|
frame->Attr.AccelTable = SDI_MENU;
|
|
|
|
##(((@QUERY_APPL_MODEL == VALUE_DIALOG) && @QUERY_APPL_DLGCLIENT_MENU) || (@QUERY_APPL_MODEL != VALUE_DIALOG))
|
|
##@OPT_APPL_TOOLBAR
|
|
SetupSpeedBar(frame);
|
|
##@OPT_APPL_STATUSBAR 7
|
|
|
|
TStatusBar *sb = new TStatusBar(frame, TGadget::Recessed,
|
|
TStatusBar::CapsLock |
|
|
TStatusBar::NumLock |
|
|
TStatusBar::ScrollLock |
|
|
TStatusBar::Overtype);
|
|
frame->Insert(*sb, TDecoratedFrame::Bottom);
|
|
|
|
SetMainWindow(frame);
|
|
|
|
##(((@QUERY_APPL_MODEL == VALUE_DIALOG) && @QUERY_APPL_DLGCLIENT_MENU) || (@QUERY_APPL_MODEL != VALUE_DIALOG)) 2
|
|
frame->SetMenuDescr(TMenuDescr(SDI_MENU));
|
|
|
|
##--BEGIN-- @QUERY_APPL_CONTROL==VALUE_3D
|
|
##--BEGIN-- @QUERY_APPL_COMMENT == VALUE_VERBOSE
|
|
//
|
|
// Windows 3-D controls.
|
|
//
|
|
##--END-- @QUERY_APPL_COMMENT == VALUE_VERBOSE
|
|
EnableCtl3d(true);
|
|
##--END-- @QUERY_APPL_CONTROL==VALUE_3D
|
|
##--BEGIN-- @QUERY_APPL_CONTROL==VALUE_BWCC
|
|
##--BEGIN-- @QUERY_APPL_COMMENT == VALUE_VERBOSE
|
|
//
|
|
// Borland Windows custom controls.
|
|
//
|
|
##--END-- @QUERY_APPL_COMMENT == VALUE_VERBOSE
|
|
EnableBWCC();
|
|
##--END-- @QUERY_APPL_CONTROL==VALUE_BWCC
|
|
}
|
|
|
|
|
|
##--BEGIN-- @QUERY_APPL_MODEL == VALUE_DIALOG
|
|
##--BEGIN-- @QUERY_APPL_COMMENT == VALUE_VERBOSE
|
|
//////////////////////////////////////////////////////////
|
|
// [[TApplication]]
|
|
// =====
|
|
// Application instance initialization.
|
|
//
|
|
##--END-- @QUERY_APPL_COMMENT == VALUE_VERBOSE
|
|
void [[TApplication]]::InitInstance ()
|
|
{
|
|
TApplication::InitInstance();
|
|
GetDocManager()->CreateAnyDoc(0, dtNewDoc);
|
|
}
|
|
|
|
|
|
##--END-- @QUERY_APPL_MODEL == VALUE_DIALOG
|
|
##--BEGIN-- @QUERY_APPL_COMMENT == VALUE_VERBOSE
|
|
//////////////////////////////////////////////////////////
|
|
// [[TApplication]]
|
|
// =====
|
|
// Response Table handlers:
|
|
//
|
|
##--END-- @QUERY_APPL_COMMENT == VALUE_VERBOSE
|
|
void [[TApplication]]::EvNewView (TView& view)
|
|
{
|
|
GetMainWindow()->SetClientWindow(view.GetWindow());
|
|
if (!view.IsOK())
|
|
GetMainWindow()->SetClientWindow(0);
|
|
else if (view.GetViewMenu())
|
|
GetMainWindow()->MergeMenu(*view.GetViewMenu());
|
|
##--BEGIN-- ((@QUERY_APPL_OLE == VALUE_SERVER) || (@QUERY_APPL_OLE == VALUE_OLEBOTH))
|
|
|
|
TOleView* ov = TYPESAFE_DOWNCAST(&view, TOleView);
|
|
if (!ov || !ov->GetOcRemView())
|
|
OcApp->SetOption(amEmbedding, false);
|
|
##--END-- ((@QUERY_APPL_OLE == VALUE_SERVER) || (@QUERY_APPL_OLE == VALUE_OLEBOTH))
|
|
}
|
|
|
|
|
|
void [[TApplication]]::EvCloseView (TView&)
|
|
{
|
|
GetMainWindow()->SetClientWindow(0);
|
|
##QUERY_WIND_TITLE [[Title]]
|
|
GetMainWindow()->SetCaption("[[Title]]");
|
|
}
|
|
|
|
|
|
//{{SDIDecFrame Implementation}}
|
|
|
|
|
|
##@QUERY_APPL_OLE != VALUE_NOOLE 2
|
|
SDIDecFrame::SDIDecFrame (TWindow *, const char far *title, TWindow *clientWnd, bool trackMenuSelection, TModule *module)
|
|
: TOleFrame(title, clientWnd, trackMenuSelection, module)
|
|
##@QUERY_APPL_OLE == VALUE_NOOLE 2
|
|
SDIDecFrame::SDIDecFrame (TWindow *parent, const char far *title, TWindow *clientWnd, bool trackMenuSelection, TModule *module)
|
|
: TDecoratedFrame(parent, title, clientWnd, trackMenuSelection, module)
|
|
{
|
|
// INSERT>> Your constructor code here.
|
|
|
|
}
|
|
|
|
|
|
SDIDecFrame::~SDIDecFrame ()
|
|
{
|
|
// INSERT>> Your destructor code here.
|
|
|
|
}
|
|
##--BEGIN-- @OPT_APPL_PRINTING
|
|
|
|
|
|
##--BEGIN-- @QUERY_APPL_COMMENT == VALUE_VERBOSE
|
|
//////////////////////////////////////////////////////////
|
|
// [[TApplication]]
|
|
// ==========
|
|
// Menu File Print command
|
|
##--END-- @QUERY_APPL_COMMENT == VALUE_VERBOSE
|
|
void [[TApplication]]::CmFilePrint ()
|
|
{
|
|
##--BEGIN-- @QUERY_APPL_COMMENT == VALUE_VERBOSE
|
|
//
|
|
// Create Printer object if not already created.
|
|
//
|
|
##--END-- @QUERY_APPL_COMMENT == VALUE_VERBOSE
|
|
if (!Printer)
|
|
Printer = new TPrinter(this);
|
|
|
|
##--BEGIN-- @QUERY_APPL_COMMENT == VALUE_VERBOSE
|
|
//
|
|
// Create Printout window and set characteristics.
|
|
//
|
|
##--END-- @QUERY_APPL_COMMENT == VALUE_VERBOSE
|
|
APXPrintOut printout(Printer, "Title", GetMainWindow()->GetClientWindow());
|
|
printout.SetBanding(true);
|
|
|
|
Printing++;
|
|
|
|
##--BEGIN-- @QUERY_APPL_COMMENT == VALUE_VERBOSE
|
|
//
|
|
// Bring up the Print dialog and print the document.
|
|
//
|
|
##--END-- @QUERY_APPL_COMMENT == VALUE_VERBOSE
|
|
Printer->Print(GetWindowPtr(GetActiveWindow()), printout, true);
|
|
|
|
Printing--;
|
|
}
|
|
|
|
|
|
##--BEGIN-- @QUERY_APPL_COMMENT == VALUE_VERBOSE
|
|
//////////////////////////////////////////////////////////
|
|
// [[TApplication]]
|
|
// ==========
|
|
// Menu File Print Setup command
|
|
##--END-- @QUERY_APPL_COMMENT == VALUE_VERBOSE
|
|
void [[TApplication]]::CmFilePrintSetup ()
|
|
{
|
|
if (!Printer)
|
|
Printer = new TPrinter(this);
|
|
|
|
##--BEGIN-- @QUERY_APPL_COMMENT == VALUE_VERBOSE
|
|
//
|
|
// Bring up the Print Setup dialog.
|
|
//
|
|
##--END-- @QUERY_APPL_COMMENT == VALUE_VERBOSE
|
|
Printer->Setup(GetMainWindow());
|
|
}
|
|
|
|
|
|
##--BEGIN-- @QUERY_APPL_COMMENT == VALUE_VERBOSE
|
|
//////////////////////////////////////////////////////////
|
|
// [[TApplication]]
|
|
// ==========
|
|
// Menu File Print Preview command
|
|
##--END-- @QUERY_APPL_COMMENT == VALUE_VERBOSE
|
|
void [[TApplication]]::CmFilePrintPreview ()
|
|
{
|
|
SDIDecFrame *sdiFrame = TYPESAFE_DOWNCAST(GetMainWindow(), SDIDecFrame);
|
|
if (sdiFrame) {
|
|
if (!Printer)
|
|
Printer = new TPrinter(this);
|
|
|
|
Printing++;
|
|
|
|
PreviewWindow *prevW = new PreviewWindow(sdiFrame, Printer, sdiFrame->GetClientWindow(), "Print Preview", new TLayoutWindow(0));
|
|
prevW->Create();
|
|
|
|
BeginModal(GetMainWindow());
|
|
|
|
Printing--;
|
|
|
|
##@QUERY_APPL_COMMENT == VALUE_VERBOSE
|
|
// Now that printing is off we can invalidate because the edit window to repaint.
|
|
GetMainWindow()->SetRedraw(true);
|
|
GetMainWindow()->Invalidate();
|
|
|
|
##@QUERY_APPL_COMMENT == VALUE_VERBOSE 2
|
|
// We must destroy the preview window explicitly. Otherwise, the window will not be destroyed until
|
|
// it's parent the MainWindow is destroyed.
|
|
prevW->Destroy();
|
|
delete prevW;
|
|
}
|
|
}
|
|
|
|
|
|
##--BEGIN-- @QUERY_APPL_COMMENT == VALUE_VERBOSE
|
|
//////////////////////////////////////////////////////////
|
|
// [[TApplication]]
|
|
// ==========
|
|
// Menu enabler used by Print, Print Setup and Print Preview.
|
|
##--END-- @QUERY_APPL_COMMENT == VALUE_VERBOSE
|
|
void [[TApplication]]::CmPrintEnable (TCommandEnabler &tce)
|
|
{
|
|
##--BEGIN-- @QUERY_APPL_COMMENT == VALUE_VERBOSE
|
|
// If we have a Printer already created just test if all is okay.
|
|
// Otherwise create a Printer object and make sure the printer
|
|
// really exists and then delete the Printer object.
|
|
##--END-- @QUERY_APPL_COMMENT == VALUE_VERBOSE
|
|
if (!Printer) {
|
|
Printer = new TPrinter(this);
|
|
|
|
tce.Enable(Printer->GetSetup().Error == 0);
|
|
} else
|
|
tce.Enable(Printer->GetSetup().Error == 0);
|
|
}
|
|
##--END-- @OPT_APPL_PRINTING
|
|
##--END-- (@QUERY_APPL_MODEL == VALUE_SDI)
|
|
##--BEGIN-- @OPT_APPL_HELP
|
|
|
|
|
|
##--BEGIN-- @QUERY_APPL_COMMENT == VALUE_VERBOSE
|
|
//////////////////////////////////////////////////////////
|
|
// [[TApplication]]
|
|
// =====
|
|
// Menu Help Contents command
|
|
##--END-- @QUERY_APPL_COMMENT == VALUE_VERBOSE
|
|
void [[TApplication]]::CmHelpContents ()
|
|
{
|
|
##--BEGIN-- @QUERY_APPL_COMMENT == VALUE_VERBOSE
|
|
//
|
|
// Show the help table of contents.
|
|
//
|
|
##--END-- @QUERY_APPL_COMMENT == VALUE_VERBOSE
|
|
HelpState = GetMainWindow()->WinHelp(HelpFileName, HELP_CONTENTS, 0L);
|
|
}
|
|
|
|
|
|
##--BEGIN-- @QUERY_APPL_COMMENT == VALUE_VERBOSE
|
|
//////////////////////////////////////////////////////////
|
|
// [[TApplication]]
|
|
// =====
|
|
// Menu Help Using Help command
|
|
##--END-- @QUERY_APPL_COMMENT == VALUE_VERBOSE
|
|
void [[TApplication]]::CmHelpUsing ()
|
|
{
|
|
##--BEGIN-- @QUERY_APPL_COMMENT == VALUE_VERBOSE
|
|
//
|
|
// Display the contents of the Windows help file.
|
|
//
|
|
##--END-- @QUERY_APPL_COMMENT == VALUE_VERBOSE
|
|
HelpState = GetMainWindow()->WinHelp(HelpFileName, HELP_HELPONHELP, 0L);
|
|
}
|
|
##--END-- @OPT_APPL_HELP
|
|
|
|
|
|
##--BEGIN-- @QUERY_APPL_COMMENT == VALUE_VERBOSE
|
|
//////////////////////////////////////////////////////////
|
|
// [[TApplication]]
|
|
// ===========
|
|
##--END-- @QUERY_APPL_COMMENT == VALUE_VERBOSE
|
|
##@QUERY_TARGET_NAME [[Target]]
|
|
// Menu Help About [[Target]] command
|
|
void [[TApplication]]::CmHelpAbout ()
|
|
{
|
|
##"" [[TDialog]]
|
|
##--BEGIN-- ((@QUERY_APPL_MODEL != VALUE_DIALOG) || ((@QUERY_APPL_MODEL == VALUE_DIALOG) && @QUERY_APPL_DLGCLIENT_MENU))
|
|
## --BEGIN-- @QUERY_APPL_COMMENT == VALUE_VERBOSE
|
|
//
|
|
// Show the modal dialog.
|
|
//
|
|
## --END-- @QUERY_APPL_COMMENT == VALUE_VERBOSE
|
|
## :<<TDialog QUERY_CLASS_NAME TDialog
|
|
##((@QUERY_APPL_OLE == VALUE_SERVER) || (@QUERY_APPL_OLE == VALUE_OLEBOTH))
|
|
[[TDialog]](&TWindow(::GetFocus(), this)).Execute();
|
|
##((@QUERY_APPL_OLE != VALUE_SERVER) && (@QUERY_APPL_OLE != VALUE_OLEBOTH))
|
|
[[TDialog]](GetMainWindow()).Execute();
|
|
##--END-- ((@QUERY_APPL_MODEL != VALUE_DIALOG) || ((@QUERY_APPL_MODEL == VALUE_DIALOG) && @QUERY_APPL_DLGCLIENT_MENU))
|
|
}
|
|
##--BEGIN-- @OPT_APPL_DRAGDROP
|
|
|
|
|
|
void [[TApplication]]::InitInstance ()
|
|
{
|
|
TApplication::InitInstance();
|
|
|
|
##:@QUERY_APPL_COMMENT == VALUE_VERBOSE
|
|
// Accept files via drag/drop in the frame window.
|
|
GetMainWindow()->DragAcceptFiles(true);
|
|
}
|
|
|
|
|
|
void [[TApplication]]::EvDropFiles (TDropInfo drop)
|
|
{
|
|
##@QUERY_APPL_COMMENT == VALUE_VERBOSE
|
|
// Tell DragQueryFile the file interested in (0) and the length of your buffer.
|
|
int fileLength = drop.DragQueryFileNameLen(0) + 1;
|
|
char *fileName = new char[fileLength];
|
|
|
|
drop.DragQueryFile(0, fileName, fileLength);
|
|
|
|
##@QUERY_APPL_COMMENT == VALUE_VERBOSE
|
|
// Open the file that was dropped.
|
|
AddFile(fileName);
|
|
##@QUERY_APPL_COMMENT == VALUE_VERBOSE
|
|
// Release the memory allocated for this handle with DragFinish.
|
|
drop.DragFinish();
|
|
}
|
|
|
|
|
|
void [[TApplication]]::AddFile (const char *FileName)
|
|
{
|
|
TDocTemplate* tpl = GetDocManager()->MatchTemplate(FileName);
|
|
if (tpl)
|
|
tpl->CreateDoc(FileName);
|
|
}
|
|
##--END-- @OPT_APPL_DRAGDROP
|
|
|
|
|
|
##{main.owl}
|