Source

gdt / SpriteEd / MAINWIN.CPP

Full commit
/* Code to handle the main window */

#include <Owl\OwlAll.H>
#include <Windows.H> // For Windows message constants directly
#define DLSTDINC_NOLOHIMAKE /* Daybo Logic mustn't make HI LO macros */
#include "Stds\DLStdInc.H" // Daybo Logic standard inclusions
#pragma hdrstop

#include "SpriteEd.RH" // Resources
#include "AboutBox.H" // About box
#include "ImgDim.H" // Image dimensions dialog
#include "MainWin.H" // Main window
#include "CoppsRes.H" // Technical resource definitions
#include "EdWin.H" // Graphical sprite editing window
//---------------------------------------------------------------------------
int TMainWindow::HighMDIIndex = 0;
//---------------------------------------------------------------------------
TMainWindow::TMainWindow() // Constructor
:
	TMDIClient()
{
	_imgDimDlg = new TImgDimDlg(this); // Create image dimensions dialog
}
//---------------------------------------------------------------------------
TMainWindow::~TMainWindow() // Destructor
{
	delete _imgDimDlg; // Kill owned dialog that was here all along
}
//---------------------------------------------------------------------------
TMDIChild* TMainWindow::InitChild()
{
	return new TEdWin(*this, ++HighMDIIndex);
}
//---------------------------------------------------------------------------
NATIVEBOOLTYPE TMainWindow::CanClose()
{
	return TRUE;
}
//---------------------------------------------------------------------------
NATIVEBOOLTYPE TMainWindow::CloseChildren()
{
	NATIVEBOOLTYPE result;

   TEdWin::SetExpressClose(TRUE);
   result = TMDIClient::CloseChildren();
   TEdWin::SetExpressClose(FALSE);
   HighMDIIndex = 0;
   return result;
}
//---------------------------------------------------------------------------
void TMainWindow::CmFileNew()
{
  TMDIChild* child = InitChild();
  child->SetIcon(0, IDI_SPRITE);

  TMDIChild* curChild = GetActiveMDIChild();
  if (curChild && (curChild->GetWindowLong(GWL_STYLE) & WS_MAXIMIZE))
    child->Attr.Style |= WS_MAXIMIZE;

  child->Create();
}
//---------------------------------------------------------------------------
void TMainWindow::CmHelpAbout() // Click on Help | About handler
{
	TAboutBox aboutbox(this); // about box on stack
   aboutbox.Execute();
   return;
}
//---------------------------------------------------------------------------
void TMainWindow::CmFileExit() // Click on File | Exit handler
{
	SendMessage(WM_CLOSE);
}
//---------------------------------------------------------------------------
void TMainWindow::EvGetMinMaxInfo(MINMAXINFO far & s) // Force window to stay between certain metrics
{
	/* For some reason, this is never executed */

	s.ptMinTrackSize.x = 400;
   s.ptMinTrackSize.y = 300;
}
//---------------------------------------------------------------------------
void TMainWindow::CmImageAttribs()
{
   _imgDimDlg->Execute(); /* show modally.  This dialog is a member by the way */
}
//---------------------------------------------------------------------------