Skip to content

Commit

Permalink
Magnetic 2.2 Windows r12
Browse files Browse the repository at this point in the history
  • Loading branch information
David Kinder committed Jul 15, 2007
1 parent 5230b04 commit 62471e2
Show file tree
Hide file tree
Showing 24 changed files with 198 additions and 219 deletions.
2 changes: 1 addition & 1 deletion MakeDist.bat
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"\Program Files\Zip\zip" \Temp\MagneticSrc.zip Dos32\allegro.c Dos32\makefile
"\Program Files\Zip\zip" -r \Temp\MagneticSrc.zip Win\* -x Win\Release\*
pushd \Programs
"\Program Files\Zip\zip" \Temp\MagneticSrc.zip Libraries\mfc\BCMenu.*
"\Program Files\Zip\zip" \Temp\MagneticSrc.zip Libraries\mfc\MenuBar.*
"\Program Files\Zip\zip" \Temp\MagneticSrc.zip Libraries\mfc\ColourButton.*
popd

Expand Down
12 changes: 6 additions & 6 deletions Win/HintDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ static char THIS_FILE[] = __FILE__;
// Implementation of the CHintDialog dialog
/////////////////////////////////////////////////////////////////////////////

CHintDialog::CHintDialog(CWnd* pParent) : CDialog(CHintDialog::IDD,pParent)
CHintDialog::CHintDialog(CWnd* pParent) : BaseDialog(CHintDialog::IDD,pParent)
{
//{{AFX_DATA_INIT(CHintDialog)
//}}AFX_DATA_INIT
Expand All @@ -40,7 +40,7 @@ CHintDialog::CHintDialog(CWnd* pParent) : CDialog(CHintDialog::IDD,pParent)

void CHintDialog::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
BaseDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CHintDialog)
DDX_Control(pDX, IDC_TOPICS, m_topicButton);
DDX_Control(pDX, IDC_SHOWHINT, m_hintButton);
Expand All @@ -49,7 +49,7 @@ void CHintDialog::DoDataExchange(CDataExchange* pDX)
//}}AFX_DATA_MAP
}

BEGIN_MESSAGE_MAP(CHintDialog, CDialog)
BEGIN_MESSAGE_MAP(CHintDialog, BaseDialog)
//{{AFX_MSG_MAP(CHintDialog)
ON_WM_SIZE()
ON_WM_GETMINMAXINFO()
Expand Down Expand Up @@ -163,12 +163,12 @@ BOOL CHintDialog::DestroyWindow()
GetWindowPlacement(&Place);
pApp->GetHintsRect() = Place.rcNormalPosition;

return CDialog::DestroyWindow();
return BaseDialog::DestroyWindow();
}

BOOL CHintDialog::OnInitDialog()
{
CDialog::OnInitDialog();
BaseDialog::OnInitDialog();

CMagneticApp* pApp = (CMagneticApp*)AfxGetApp();
SetIcon(pApp->LoadIcon(IDR_MAINFRAME),TRUE);
Expand Down Expand Up @@ -196,7 +196,7 @@ BOOL CHintDialog::OnInitDialog()

void CHintDialog::OnSize(UINT nType, int cx, int cy)
{
CDialog::OnSize(nType,cx,cy);
BaseDialog::OnSize(nType,cx,cy);
if (GetDlgItem(IDOK)->GetSafeHwnd())
LayoutControls();
}
Expand Down
4 changes: 3 additions & 1 deletion Win/HintDialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
//
/////////////////////////////////////////////////////////////////////////////

#include "Dialogs.h"

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
Expand All @@ -34,7 +36,7 @@ class CHintListBox : public CListBox
};

// Dialog for showing hints
class CHintDialog : public CDialog
class CHintDialog : public BaseDialog
{
// Construction
public:
Expand Down
72 changes: 48 additions & 24 deletions Win/Magnetic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
/////////////////////////////////////////////////////////////////////////////

#include "StdAfx.h"
#include <MultiMon.h>
#include <string.h>
#include <stdlib.h>
#include <memory>
Expand All @@ -19,6 +20,7 @@
#include "MagneticView.h"
#include "MainFrm.h"
#include "OptionsDlg.h"
#include "Dialogs.h"

#ifdef _DEBUG
#define new DEBUG_NEW
Expand Down Expand Up @@ -58,15 +60,33 @@ BOOL CMagneticApp::InitInstance()
SetRegistryKey(_T("David Kinder"));
LoadStdProfileSettings();

// Load Magnetic display settings
m_LogFont.lfHeight = GetProfileInt("Display","Font Size",-16);
NONCLIENTMETRICS ncm;
::ZeroMemory(&ncm,sizeof ncm);
ncm.cbSize = sizeof ncm;
::SystemParametersInfo(SPI_GETNONCLIENTMETRICS,sizeof ncm,&ncm,0);

CDC* dc = CWnd::GetDesktopWindow()->GetDC();
int fontSize = -MulDiv(10,dc->GetDeviceCaps(LOGPIXELSY),72);
CWnd::GetDesktopWindow()->ReleaseDC(dc);

CRect screen = GetScreenSize();
int scalePics = 100;
int scaleTitles = 100;
if ((screen.Width() > 800) && (screen.Height() > 600))
{
scalePics = 200;
scaleTitles = 150;
}

// Load Magnetic display settings
m_LogFont.lfHeight = GetProfileInt("Display","Font Size",fontSize);
m_LogFont.lfCharSet = ANSI_CHARSET;
m_LogFont.lfOutPrecision = OUT_TT_PRECIS;
m_LogFont.lfClipPrecision = CLIP_DEFAULT_PRECIS;
m_LogFont.lfQuality = PROOF_QUALITY;
m_LogFont.lfPitchAndFamily = DEFAULT_PITCH|FF_DONTCARE;
strncpy(m_LogFont.lfFaceName,
GetProfileString("Display","Font Name","Times New Roman"),LF_FACESIZE);
strncpy(m_LogFont.lfFaceName,GetProfileString(
"Display","Font Name",ncm.lfMessageFont.lfFaceName),LF_FACESIZE);
m_Margins.cx = 8;
m_Margins.cy = 4;

Expand All @@ -86,9 +106,9 @@ BOOL CMagneticApp::InitInstance()
m_PicTopLeft.y = GetProfileInt("Picture","Top",0);

m_ShowGfx = (ShowGraphics)GetProfileInt("Picture","Show",
ShowGraphics::SeparateWindow);
m_dScaleFactor = (double)GetProfileInt("Picture","Scale",100)*0.01;
m_dScaleTitles = (double)GetProfileInt("Titles","Scale",100)*0.01;
ShowGraphics::MainWindow);
m_dScaleFactor = (double)GetProfileInt("Picture","Scale",scalePics)*0.01;
m_dScaleTitles = (double)GetProfileInt("Titles","Scale",scaleTitles)*0.01;
m_dGamma = (double)GetProfileInt("Picture","Gamma",100)*0.01;
m_ForeColour = GetProfileInt("Display","Foreground",~0);
m_BackColour = GetProfileInt("Display","Background",~0);
Expand Down Expand Up @@ -128,10 +148,10 @@ BOOL CMagneticApp::InitInstance()
::SHChangeNotify(SHCNE_ASSOCCHANGED,SHCNF_IDLIST,0,0);

// Create file dialog for loading games
m_pNewGameDialog = new CFileDialog(TRUE,NULL,
m_pNewGameDialog = new SimpleFileDialog(TRUE,NULL,
GetProfileString("Settings","Last File",""),
OFN_FILEMUSTEXIST|OFN_HIDEREADONLY|OFN_ENABLESIZING,
"Magnetic Files (*.mag)|*.mag|All Files (*.*)|*.*||",NULL,0);
"Magnetic Files (*.mag)|*.mag|All Files (*.*)|*.*||",NULL);
if (m_pNewGameDialog == NULL)
return FALSE;
m_pNewGameDialog->m_ofn.lpstrTitle = "Open a Magnetic Scrolls game";
Expand All @@ -147,18 +167,9 @@ BOOL CMagneticApp::InitInstance()
if (!ProcessShellCommand(cmdInfo))
return FALSE;

CMenu* pMenu = m_pMainWnd->GetMenu();
if (pMenu)
pMenu->DestroyMenu();
HMENU hMenu = ((CMainFrame*)m_pMainWnd)->NewMenu();
pMenu = CMenu::FromHandle(hMenu);
m_pMainWnd->SetMenu(pMenu);
((CMainFrame*)m_pMainWnd)->m_hMenuDefault = hMenu;

m_pMainWnd->ShowWindow(SW_SHOW);
m_pMainWnd->ShowWindow(SW_SHOW);
m_pMainWnd->UpdateWindow();
m_pMainWnd->DragAcceptFiles();

return TRUE;
}

Expand Down Expand Up @@ -322,6 +333,19 @@ void CMagneticApp::OnUpdateRecentFileMenu(CCmdUI* pCmdUI)
}
}

CRect CMagneticApp::GetScreenSize()
{
MONITORINFO monInfo;
::ZeroMemory(&monInfo,sizeof monInfo);
monInfo.cbSize = sizeof monInfo;

HMONITOR mon = ::MonitorFromWindow(AfxGetMainWnd()->GetSafeHwnd(),MONITOR_DEFAULTTOPRIMARY);
if (::GetMonitorInfo(mon,&monInfo))
return monInfo.rcMonitor;

return CRect(0,0,::GetSystemMetrics(SM_CXSCREEN),::GetSystemMetrics(SM_CYSCREEN));
}

/////////////////////////////////////////////////////////////////////////////
// Get and set program settings
/////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -474,7 +498,7 @@ void CMagneticApp::SetGameLoaded(int iLoaded)
// CAboutDlg dialog class
/////////////////////////////////////////////////////////////////////////////

class CAboutDlg : public CDialog
class CAboutDlg : public BaseDialog
{
public:
CAboutDlg();
Expand All @@ -499,28 +523,28 @@ class CAboutDlg : public CDialog
DECLARE_MESSAGE_MAP()
};

CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
CAboutDlg::CAboutDlg() : BaseDialog(CAboutDlg::IDD)
{
//{{AFX_DATA_INIT(CAboutDlg)
//}}AFX_DATA_INIT
}

void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
BaseDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAboutDlg)
//}}AFX_DATA_MAP
}

BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
BEGIN_MESSAGE_MAP(CAboutDlg, BaseDialog)
//{{AFX_MSG_MAP(CAboutDlg)
// No message handlers
//}}AFX_MSG_MAP
END_MESSAGE_MAP()

BOOL CAboutDlg::OnInitDialog()
{
CDialog::OnInitDialog();
BaseDialog::OnInitDialog();

// Get the static logo bitmap control
CRect logoRect;
Expand Down
2 changes: 2 additions & 0 deletions Win/Magnetic.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ class CMagneticApp : public CWinApp
void SetGameLoaded(int iLoaded);

protected:
CRect GetScreenSize(void);

// File dialog data
CFileDialog* m_pNewGameDialog;

Expand Down
28 changes: 13 additions & 15 deletions Win/Magnetic.rc
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ IDR_MAINFRAME ICON "res\\magnetic.ico"
//

IDR_MAINFRAME BITMAP "res\\Toolbar.bmp"
IDB_TOOLBAR32 BITMAP "res\\Toolbar32.bmp"
IDB_LOGO BITMAP "res\\Logo.bmp"

/////////////////////////////////////////////////////////////////////////////
Expand All @@ -86,13 +87,10 @@ BEGIN
BUTTON ID_FILE_SCRIPT
BUTTON ID_FILE_RECORD
BUTTON ID_FILE_PLAYBACK
SEPARATOR
BUTTON ID_VIEW_FONT
BUTTON ID_VIEW_OPTIONS
BUTTON ID_VIEW_SCROLLBACK
SEPARATOR
BUTTON ID_HELP
BUTTON ID_APP_ABOUT
END


Expand Down Expand Up @@ -122,13 +120,13 @@ BEGIN
MENUITEM SEPARATOR
MENUITEM "&Font...\tCtrl+F", ID_VIEW_FONT
MENUITEM "&Options...\tCtrl+T", ID_VIEW_OPTIONS
MENUITEM "S&crollback...\tCtrl+L", ID_VIEW_SCROLLBACK
MENUITEM "S&crollback\tCtrl+L", ID_VIEW_SCROLLBACK
END
POPUP "&Help"
BEGIN
MENUITEM "&Help Topics...\tF1", ID_HELP
MENUITEM "Magnetic &Help\tF1", ID_HELP
MENUITEM SEPARATOR
MENUITEM "&About Magnetic...", ID_APP_ABOUT
MENUITEM "&About Magnetic", ID_APP_ABOUT
END
END

Expand Down Expand Up @@ -164,16 +162,16 @@ STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION |
CAPTION "About Magnetic"
FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
CONTROL 129,IDC_LOGO,"Static",SS_BITMAP |
SS_SUNKEN,6,4,70,88,WS_EX_CLIENTEDGE
CONTROL 129,IDC_LOGO,"Static",SS_BITMAP | SS_SUNKEN,6,4,70,88,
WS_EX_CLIENTEDGE
GROUPBOX "Credits",IDC_CREDITS,94,4,178,89
LTEXT "Magnetic v2.2, an interpreter for Magnetic Scrolls games. Copyright � 1997-2004 Niclas Karlsson.",
IDC_STATIC,99,16,165,16
LTEXT "Magnetic is released under the terms of the GNU General Public License.",
IDC_STATIC,100,35,160,16
LTEXT "Magnetic was written by Niclas Karlsson,\nDavid Kinder, Stefan Meier and Paul David Doherty.",
IDC_STATIC,99,54,170,16
LTEXT "Magnetic for Windows Release 10.\nWindows version written by David Kinder.",
IDC_STATIC,99,54,171,16
LTEXT "Magnetic for Windows Release 12.\nWindows version written by David Kinder.",
IDC_STATIC,99,73,141,16
DEFPUSHBUTTON "OK",IDOK,159,98,48,14,WS_GROUP
END
Expand Down Expand Up @@ -237,7 +235,7 @@ BEGIN
BS_AUTOCHECKBOX | WS_TABSTOP,17,151,109,8
CONTROL "Make randomness predictable",IDC_PREDICT,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,17,164,117,8
LTEXT "Random seed",IDC_SEED_LABEL,23,180,45,8
LTEXT "Random seed",IDC_SEED_LABEL,23,180,46,8
EDITTEXT IDC_SEED,74,178,43,12,ES_AUTOHSCROLL
END

Expand Down Expand Up @@ -270,8 +268,8 @@ END
//

VS_VERSION_INFO VERSIONINFO
FILEVERSION 2,2,0,9
PRODUCTVERSION 2,2,0,9
FILEVERSION 2,2,0,12
PRODUCTVERSION 2,2,0,12
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
Expand All @@ -289,12 +287,12 @@ BEGIN
VALUE "Comments", "Windows version by David Kinder"
VALUE "CompanyName", "Magnetic Scrolls"
VALUE "FileDescription", "Magnetic Scrolls Interpreter"
VALUE "FileVersion", "2, 2, 0, 9"
VALUE "FileVersion", "2, 2, 0, 12"
VALUE "InternalName", "Magnetic"
VALUE "LegalCopyright", "Copyright (C) 1997-2004 Niclas Karlsson"
VALUE "OriginalFilename", "Magnetic.exe"
VALUE "ProductName", "Magnetic Scrolls Interpreter"
VALUE "ProductVersion", "2, 2, 0, 9"
VALUE "ProductVersion", "2, 2, 0, 12"
END
END
BLOCK "VarFileInfo"
Expand Down
Loading

0 comments on commit 62471e2

Please sign in to comment.