File:  [RetroPC.NET] / np2 / win9x / dialog / d_about.cpp
Revision 1.13: download - view: text, annotated - select for diffs
Sun Dec 24 22:21:38 2006 JST (18 years, 10 months ago) by yui
Branches: MAIN
CVS tags: VER_0_82_x64, VER_0_82, HEAD
added win64 project

#include	"compiler.h"
#include	"resource.h"
#include	"np2.h"
#include	"oemtext.h"
#include	"np2class.h"
#include	"dialog.h"
#include	"dialogs.h"
#include	"np2ver.h"
#include	"pccore.h"
#include	"np2info.h"


static	SIZE	aboutsize;

static const OEMCHAR str_np2title[] = OEMTEXT(PROJECTNAME) \
										OEMTEXT(PROJECTSUBNAME) \
										OEMTEXT("  ");
static const OEMCHAR np2infostr[] = OEMTEXT("CPU: %CPU% %CLOCK%\nMEM: %MEM1%\nGDC: %GDC%\n     %GDC2%\nTEXT: %TEXT%\nGRPH: %GRPH%\nSOUND: %EXSND%\n\nBIOS: %BIOS%\nRHYTHM: %RHYTHM%\n\nSCREEN: %DISP%");


static void about_init(HWND hWnd) {

	OEMCHAR	work[128];
	RECT	rectwindow;
	RECT	rectclient;
	POINT	pt;
	RECT	parent;

	milstr_ncpy(work, str_np2title, NELEMENTS(work));
	milstr_ncat(work, np2version, NELEMENTS(work));
#if defined(NP2VER_WIN9X)
	milstr_ncat(work, NP2VER_WIN9X, NELEMENTS(work));
#endif
#if defined(OSLANG_UTF8)
	TCHAR	tchr[128];
	oemtotchar(tchr, NELEMENTS(tchr), work, -1);
	SetDlgItemText(hWnd, IDC_NP2VER, tchr);
#else
	SetDlgItemText(hWnd, IDC_NP2VER, work);
#endif
	GetWindowRect(hWnd, &rectwindow);
	GetClientRect(hWnd, &rectclient);
	aboutsize.cx = rectwindow.right - rectwindow.left;
	aboutsize.cy = rectwindow.bottom - rectwindow.top;
	pt.x = 0;
	pt.y = 0;
	ClientToScreen(GetParent(hWnd), &pt);
	GetClientRect(GetParent(hWnd), &parent);
	np2class_move(hWnd,
					pt.x + ((parent.right - parent.left - aboutsize.cx) / 2),
					pt.y + ((parent.bottom - parent.top - aboutsize.cy) / 2),
					aboutsize.cx,
					aboutsize.cy + 60 - (rectclient.bottom - rectclient.top));

	SetFocus(GetDlgItem(hWnd, IDOK));
}

static void about_more(HWND hWnd) {

	OEMCHAR	infostr[1024];
	RECT	rect;

	np2info(infostr, np2infostr, NELEMENTS(infostr), NULL);
#if defined(OSLANG_UTF8)
	TCHAR	tchr[1024];
	oemtotchar(tchr, NELEMENTS(tchr), infostr, -1);
	SetDlgItemText(hWnd, IDC_NP2INFO, tchr);
#else
	SetDlgItemText(hWnd, IDC_NP2INFO, infostr);
#endif
	EnableWindow(GetDlgItem(hWnd, IDC_MORE), FALSE);
	GetWindowRect(hWnd, &rect);
	np2class_move(hWnd, rect.left, rect.top, aboutsize.cx, aboutsize.cy);
	SetFocus(GetDlgItem(hWnd, IDOK));
}

LRESULT CALLBACK AboutDialogProc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp) {

	switch (msg) {
		case WM_INITDIALOG:
			about_init(hWnd);
			return(FALSE);

		case WM_COMMAND:
			switch (LOWORD(wp)) {
				case IDOK:
					EndDialog(hWnd, IDOK);
					break;

				case IDC_MORE:
					about_more(hWnd);
					break;

				default:
					return(FALSE);
			}
			break;

		case WM_CLOSE:
			PostMessage(hWnd, WM_COMMAND, IDOK, 0);
			break;

		default:
			return(FALSE);
	}
	return(TRUE);
}


RetroPC.NET-CVS <cvs@retropc.net>