- 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>
200 lines
6.9 KiB
C++
200 lines
6.9 KiB
C++
// BDE - (C) Copyright 1994 by Borland International
|
|
|
|
#include "address.h"
|
|
|
|
//======================================================================
|
|
// Name: WinMsg(Msg, TypeMsg, TypeBtn);
|
|
//
|
|
// Input: pMsg - The message to display.
|
|
// TypeMsg - The type of messagebox to use (i.e. Stop,
|
|
// Information,
|
|
// TypeBtn - The buttons to use (i.e. Yes, No, OK, ...)
|
|
//
|
|
// Return: Response from the user.
|
|
//
|
|
// Description: Display a message box & return a value representing
|
|
// the button the user pressed. Standard windows input is
|
|
// required for the type of message, and button(s), to use.
|
|
//======================================================================
|
|
UINT16
|
|
WinMsg (pCHAR pMsg, UINT16 TypeMsg, UINT16 TypeBtn)
|
|
{
|
|
return(MessageBox(hMainWnd, (LPSTR) pMsg, "AddressBook Manager",
|
|
(WORD) TypeBtn | TypeMsg | MB_APPLMODAL));
|
|
}
|
|
|
|
//======================================================================
|
|
// Name: ChangeEntryMode(hCur);
|
|
//
|
|
// Input: hCur - Handle to the cursor
|
|
//
|
|
// Return: None.
|
|
//
|
|
// Description: Swap the data entry mode. This will either switch from
|
|
// "modify a record" to "add a record," or visa-versa.
|
|
//======================================================================
|
|
void
|
|
ChangeEntryMode (hDBICur hCur)
|
|
{
|
|
UINT16 iShow1;
|
|
UINT16 iShow2;
|
|
UINT16 iShow3;
|
|
char szString[150];
|
|
|
|
if (NewRecMode)
|
|
{
|
|
// Change the mode flag
|
|
NewRecMode = FALSE;
|
|
|
|
// Show the startup resources
|
|
iShow1 = SW_SHOW;
|
|
|
|
// Hide the OK and Cancel buttons
|
|
iShow2 = SW_HIDE;
|
|
|
|
// Enable the menu options
|
|
iShow3 = MF_ENABLED;
|
|
}
|
|
else
|
|
{
|
|
// Change the mode flag
|
|
NewRecMode = TRUE;
|
|
|
|
// Hide the startup resources
|
|
iShow1 = SW_HIDE;
|
|
|
|
// Show the OK and Cancel buttons
|
|
iShow2 = SW_SHOW;
|
|
|
|
// Disable the menu options
|
|
iShow3 = MF_GRAYED;
|
|
}
|
|
|
|
// These resources are shown when the app starts
|
|
ShowWindow(GetDlgItem(hMainWnd, ID_ADD_REC), iShow1);
|
|
|
|
// These menu options are enabled when the app starts
|
|
EnableMenuItem(GetMenu(hMainWnd), ID_ADD_REC, iShow3);
|
|
EnableMenuItem(GetMenu(hMainWnd), ID_NEW, iShow3);
|
|
EnableMenuItem(GetMenu(hMainWnd), ID_OPEN, iShow3);
|
|
|
|
// Check if the table is empty
|
|
if((AtBOF(hCur) && AtEOF(hCur)))
|
|
{
|
|
iShow3 = MF_GRAYED;
|
|
}
|
|
|
|
ShowWindow(GetDlgItem(hMainWnd, ID_DEL_REC), iShow1);
|
|
ShowWindow(GetDlgItem(hMainWnd, ID_FIRST_REC), iShow1);
|
|
ShowWindow(GetDlgItem(hMainWnd, ID_PREV_REC), iShow1);
|
|
ShowWindow(GetDlgItem(hMainWnd, ID_NEXT_REC), iShow1);
|
|
ShowWindow(GetDlgItem(hMainWnd, ID_LAST_REC), iShow1);
|
|
ShowWindow(GetDlgItem(hMainWnd, ID_MOD_REC), iShow1);
|
|
ShowWindow(GetDlgItem(hMainWnd, ID_UNDO_REC), iShow1);
|
|
ShowWindow(GetDlgItem(hMainWnd, ID_ORDER), iShow1);
|
|
ShowWindow(GetDlgItem(hMainWnd, ID_SEARCH), iShow1);
|
|
ShowWindow(GetDlgItem(hMainWnd, ID_RANGE), iShow1);
|
|
ShowWindow(GetDlgItem(hMainWnd, IDS_DATABASE_HDR), iShow1);
|
|
|
|
|
|
EnableMenuItem(GetMenu(hMainWnd), ID_FIRST_REC, iShow3);
|
|
EnableMenuItem(GetMenu(hMainWnd), ID_PREV_REC, iShow3);
|
|
EnableMenuItem(GetMenu(hMainWnd), ID_NEXT_REC, iShow3);
|
|
EnableMenuItem(GetMenu(hMainWnd), ID_LAST_REC, iShow3);
|
|
EnableMenuItem(GetMenu(hMainWnd), ID_DEL_REC, iShow3);
|
|
EnableMenuItem(GetMenu(hMainWnd), ID_MOD_REC, iShow3);
|
|
EnableMenuItem(GetMenu(hMainWnd), ID_ORDER, iShow3);
|
|
EnableMenuItem(GetMenu(hMainWnd), ID_RANGE, iShow3);
|
|
EnableMenuItem(GetMenu(hMainWnd), ID_CLEAR_RANGE, iShow3);
|
|
EnableMenuItem(GetMenu(hMainWnd), ID_SEARCH, iShow3);
|
|
EnableMenuItem(GetMenu(hMainWnd), ID_UNDO_REC, iShow3);
|
|
|
|
// These resources need to be disabled while in add record mode
|
|
EnableWindow(GetDlgItem(hMainWnd, ID_ORDER), !NewRecMode);
|
|
EnableWindow(GetDlgItem(hMainWnd, ID_RANGE), !NewRecMode);
|
|
EnableWindow(GetDlgItem(hMainWnd, ID_SEARCH), !NewRecMode);
|
|
|
|
// These resources are hidden when the application starts
|
|
ShowWindow(GetDlgItem(hMainWnd, IDOK), iShow2);
|
|
ShowWindow(GetDlgItem(hMainWnd, IDCANCEL), iShow2);
|
|
EnableWindow(GetDlgItem(hMainWnd, IDCANCEL), NewRecMode);
|
|
EnableWindow(GetDlgItem(hMainWnd, IDOK), NewRecMode);
|
|
|
|
if(NewRecMode)
|
|
{
|
|
LoadString(hInst, IDS_MAIN, szString, 150);
|
|
SetDlgItemText(hMainWnd, IDS_NEW_REC_DESC, (pCHAR)szString);
|
|
}
|
|
ShowWindow(GetDlgItem(hMainWnd, IDS_NEW_REC_DESC), iShow2);
|
|
}
|
|
|
|
//=====================================================================
|
|
// Function:
|
|
// MakeFullPath (pszDirectory, pszRelativeDirectory)
|
|
//
|
|
// Input: pszDirectory - String to contain the path to the tables
|
|
// directory.
|
|
// pszRelativeDirectory - String which contains the relative offset
|
|
// from the current directory.
|
|
//
|
|
// Return: int - If the directory exists
|
|
//
|
|
// Description:
|
|
// This function is used to get the fully qualified path to
|
|
// the directory which will contain the tables. This function
|
|
// will only work when pszRelativeDirectory contains either "."
|
|
// an absolute path, or <..\\..>\\TABLES.
|
|
//=====================================================================
|
|
int
|
|
MakeFullPath (pCHAR pszDirectory, pCHAR pszRelativeDirectory)
|
|
{
|
|
int iExists; // Does the directory exist?
|
|
int iLen; // Length of the path
|
|
int iLoop; // Loop counter
|
|
int iDepth = 0;
|
|
|
|
// Assume absolute path if second character is a ':'
|
|
if (pszRelativeDirectory[1] == ':')
|
|
{
|
|
strcpy(pszDirectory, pszRelativeDirectory);
|
|
}
|
|
else if (!strcmp(pszRelativeDirectory, "."))
|
|
{
|
|
// Get the current working directory
|
|
getcwd(pszDirectory, DBIMAXPATHLEN);
|
|
}
|
|
else
|
|
{
|
|
// Get the current working directory
|
|
getcwd(pszDirectory, DBIMAXPATHLEN);
|
|
|
|
iLen = strlen(pszDirectory);
|
|
|
|
// Remove relative parts of the path.
|
|
iDepth = 0;
|
|
while (!strncmp(&pszRelativeDirectory[iDepth * 3], "..\\", 3))
|
|
{
|
|
for (iLoop = iLen; iLoop > -1; iLoop = iLoop - 1)
|
|
{
|
|
if (pszDirectory[iLoop] == '\\')
|
|
{
|
|
break;
|
|
}
|
|
}
|
|
iLen = iLoop - 1;
|
|
iDepth++;
|
|
}
|
|
|
|
// Copy the 'TABLES' directory to form the full path to the tables.
|
|
// Need to move szDirectory past the '\\' and szTblDirectory
|
|
// past the '..\\'.
|
|
strcpy(&pszDirectory[iLoop+1], &pszRelativeDirectory[(3 * iDepth)]);
|
|
}
|
|
|
|
// Check if the directory exists
|
|
iExists = access(pszDirectory, 00);
|
|
|
|
return iExists;
|
|
}
|
|
|