Files
TeslaRel410/BORLAND/BC45/EXAMPLES/CLASSLIB/TODO/TODODLGS.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

264 lines
7.2 KiB
C++

//---------------------------------------------------------------------
//
// TODODLGS.CPP - part of TODO example program
//
// Copyright (c) 1991, 1993 by Borland International
// All Rights Reserved.
//
//---------------------------------------------------------------------
#define STRICT
#include <windows.h>
#include <windowsx.h>
#include <string.h>
#include "tododlgs.h"
#include "tododefs.h"
//---------------------------------------------------------------------
//
// member functions for class AboutBox.
//
// not much needed here...
//
//---------------------------------------------------------------------
LPSTR AboutBox::GetDialogName()
{
return "AboutBox";
}
BOOL AboutBox::Dispatch( HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam )
{
switch( msg )
{
case WM_INITDIALOG:
return TRUE; // no initialization.
case WM_COMMAND:
if( GET_WM_COMMAND_ID(wParam, lParam) == IDOK ||
GET_WM_COMMAND_ID(wParam, lParam) == IDCANCEL )
{
EndDialog( hDlg, TRUE ); // selecting OK or Cancel
return TRUE; // terminates the dialog
}
default: // if we don't handle it, pass it
// to our parent.
return ModalDialog::Dispatch( hDlg, msg, wParam, lParam );
}
}
//---------------------------------------------------------------------
//
// member functions for class FileBox.
//
//---------------------------------------------------------------------
BOOL FileBox::GetOpenFileName( HWND handle, char *fileName, char *titleName )
{
ofn.hwndOwner = handle;
ofn.lpstrFile = fileName;
ofn.lpstrFileTitle = titleName;
ofn.Flags = OFN_FILEMUSTEXIST;
return ::GetOpenFileName( &ofn );
}
BOOL FileBox::GetSaveFileName( HWND handle, char *fileName, char *titleName )
{
ofn.hwndOwner = handle;
ofn.lpstrFile = fileName;
ofn.lpstrFileTitle = titleName;
ofn.Flags = OFN_OVERWRITEPROMPT;
return ::GetOpenFileName( &ofn );
}
OPENFILENAME FileBox::ofn =
{
sizeof(OPENFILENAME), // lStructSize
0, // hwndOwner
0, // hInstance
filters[0], // lpstrFilter
0, // lpstrCustomFilter
0, // nMaxCustFilter
0, // nFilterIndex
0, // lpstrFile
MAXPATH, // nMaxFile
0, // lpstrFileTitle
MAXFILE+MAXEXT, // nMaxFileTitle
0, // lpstrInitialDir
0, // lpstrTitle
0, // Flags
0, // nFileOffset
0, // nFileExtension
"tdo", // lpstrDefExt
0, // lCustData
0, // lpfnHook
0 // lpTemplateName
};
char *FileBox::filters[] =
{
"Todo Files (*.TDO)", "*.tdo",
"All Files (*.*)", "*.*",
""
};
//---------------------------------------------------------------------
//
// member functions for class EditBox.
//
//---------------------------------------------------------------------
LPSTR EditBox::GetDialogName()
{
return "TodoEdit";
}
//---------------------------------------------------------------------
//
// void EditBox::InitDlg( HWND hDlg );
//
// initializes the dialog box.
//
//---------------------------------------------------------------------
void EditBox::InitDlg( HWND hDlg )
{
// set up the current date edit field.
SetDlgItemText( hDlg, IDE_DATEENT,
Current.DateCreated.AsString().c_str() );
// set up the date due edit field.
SetDlgItemText( hDlg, IDE_DATEDUE,
Current.DateDue.AsString().c_str() );
// set up the text edit field
SetDlgItemText( hDlg, IDE_TEXT, Current.Text.c_str() );
// set up the correct radio button
Button = IDE_HIGH + 1 - Current.Priority;
CheckRadioButton( hDlg, IDE_LOW, IDE_HIGH, Button );
}
//---------------------------------------------------------------------
//
// void EditBox::CheckButton( HWND hDlg, WPARAM wParam );
//
// called when the user selects one of the radio buttons.
//
//---------------------------------------------------------------------
void EditBox::CheckButton( HWND hDlg, WPARAM wParam )
{
Button = wParam;
CheckRadioButton( hDlg, IDE_LOW, IDE_HIGH, Button );
}
//---------------------------------------------------------------------
//
// void EditBox::OkCmd( HWND hDlg );
//
// called when the user selects the OK button. Copies data from the
// dialog into the Todo entry and terminates the dialog.
//
//---------------------------------------------------------------------
void EditBox::OkCmd( HWND hDlg )
{
char temp[100 ];
// copy date created from dialog.
GetDlgItemText( hDlg, IDE_DATEENT, temp, sizeof( temp ) );
{
istrstream date( temp, sizeof( temp ) );
date >> Current.DateCreated;
}
// copy date due from dialog.
GetDlgItemText( hDlg, IDE_DATEDUE, temp, sizeof( temp ) );
{
istrstream date( temp, sizeof( temp ) );
date >> Current.DateDue;
}
// copy text from dialog
GetDlgItemText( hDlg, IDE_TEXT, temp, sizeof(temp) );
Current.Text = temp;
// copy priority from dialog.
Current.Priority = IDE_HIGH + 1 - Button;
// mark this entry as modified.
Current.Dirty = TRUE;
EndDialog( hDlg, TRUE );
}
//---------------------------------------------------------------------
//
// void EditBox::CancelCmd( HWND hDlg );
//
// called when the user selects the Cancel button. Terminates the
// dialog without changing any fields in the entry.
//
//---------------------------------------------------------------------
void EditBox::CancelCmd( HWND hDlg )
{
Result = 1;
EndDialog( hDlg, TRUE );
}
//---------------------------------------------------------------------
//
// BOOL EditBox::Dispatch( HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam );
//
// dispatches commands.
//
//---------------------------------------------------------------------
BOOL EditBox::Dispatch( HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam )
{
switch( msg )
{
case WM_INITDIALOG:
InitDlg( hDlg );
return TRUE;
case WM_COMMAND:
switch( GET_WM_COMMAND_ID(wParam, lParam) )
{
case IDE_LOW:
case IDE_MEDIUM:
case IDE_HIGH:
CheckButton( hDlg, GET_WM_COMMAND_ID(wParam, lParam) );
return TRUE;
case IDOK:
OkCmd( hDlg );
return TRUE;
case IDCANCEL:
CancelCmd( hDlg );
return TRUE;
}
}
return ModalDialog::Dispatch( hDlg, msg, wParam, lParam );
}