2011-11-24 00:53:35 -06:00
|
|
|
#include "../Windows.hpp"
|
|
|
|
#include "../GUI.hpp"
|
|
|
|
|
|
|
|
#ifndef TTI_INFO_LARGE
|
|
|
|
#define TTI_INFO_LARGE 4
|
|
|
|
#endif
|
|
|
|
|
|
|
|
namespace NewArchive {
|
|
|
|
|
|
|
|
enum {TYPE_FAR, TYPE_DBPF};
|
|
|
|
void SetType(HWND hDlg, int type){
|
|
|
|
for(int i=IDC_NA_FARVERSIONTEXT; i<=IDC_NA_FARVERSION; i++)
|
|
|
|
EnableWindow(GetDlgItem(hDlg, i), type==TYPE_FAR);
|
|
|
|
for(int i=IDC_NA_DBPFVERSIONTEXT; i<=IDC_NA_DBPFCOMPRESS; i++)
|
|
|
|
EnableWindow(GetDlgItem(hDlg, i), type==TYPE_DBPF);
|
|
|
|
}
|
|
|
|
|
|
|
|
INT_PTR CALLBACK DlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam){
|
2012-04-06 13:27:40 -05:00
|
|
|
switch (message){
|
2011-11-24 00:53:35 -06:00
|
|
|
case WM_INITDIALOG: {
|
|
|
|
CenterDialog(hDlg);
|
|
|
|
|
|
|
|
//Fill the drop-down boxes
|
|
|
|
HWND hBox = GetDlgItem(hDlg, IDC_NA_TYPE);
|
|
|
|
SendMessage(hBox, CB_INSERTSTRING, -1, (LPARAM) L"FAR");
|
|
|
|
SendMessage(hBox, CB_INSERTSTRING, -1, (LPARAM) L"DBPF");
|
|
|
|
SendMessage(hBox, CB_SETCURSEL, 0, 0);
|
|
|
|
hBox = GetDlgItem(hDlg, IDC_NA_FARVERSION);
|
|
|
|
SendMessage(hBox, CB_INSERTSTRING, -1, (LPARAM) L"1a");
|
|
|
|
SendMessage(hBox, CB_INSERTSTRING, -1, (LPARAM) L"1b");
|
|
|
|
SendMessage(hBox, CB_INSERTSTRING, -1, (LPARAM) L"3");
|
|
|
|
SendMessage(hBox, CB_SETCURSEL, 0, 0);
|
|
|
|
hBox = GetDlgItem(hDlg, IDC_NA_DBPFVERSION);
|
|
|
|
SendMessage(hBox, CB_INSERTSTRING, -1, (LPARAM) L"1.0");
|
|
|
|
SendMessage(hBox, CB_INSERTSTRING, -1, (LPARAM) L"1.1");
|
|
|
|
SendMessage(hBox, CB_INSERTSTRING, -1, (LPARAM) L"2.0");
|
|
|
|
SendMessage(hBox, CB_SETCURSEL, 0, 0);
|
|
|
|
hBox = GetDlgItem(hDlg, IDC_NA_INDEXVERSION);
|
|
|
|
SendMessage(hBox, CB_INSERTSTRING, -1, (LPARAM) L"7.0");
|
|
|
|
SendMessage(hBox, CB_INSERTSTRING, -1, (LPARAM) L"7.1");
|
|
|
|
SendMessage(hBox, CB_INSERTSTRING, -1, (LPARAM) L"3.0");
|
|
|
|
SendMessage(hBox, CB_SETCURSEL, 0, 0);
|
|
|
|
|
|
|
|
//Create the tooltips
|
|
|
|
HWND FARInfo = CreateWindowEx(0, TOOLTIPS_CLASS, NULL,
|
2012-04-06 13:27:40 -05:00
|
|
|
WS_POPUP | TTS_NOPREFIX | TTS_BALLOON | TTS_ALWAYSTIP,
|
|
|
|
CW_USEDEFAULT, CW_USEDEFAULT,
|
|
|
|
CW_USEDEFAULT, CW_USEDEFAULT,
|
|
|
|
hDlg, NULL, hInst, NULL),
|
|
|
|
DBPFInfo = CreateWindowEx(0, TOOLTIPS_CLASS, NULL,
|
|
|
|
WS_POPUP | TTS_NOPREFIX | TTS_BALLOON | TTS_ALWAYSTIP,
|
|
|
|
CW_USEDEFAULT, CW_USEDEFAULT,
|
|
|
|
CW_USEDEFAULT, CW_USEDEFAULT,
|
|
|
|
hDlg, NULL, hInst, NULL);
|
2011-11-24 00:53:35 -06:00
|
|
|
|
|
|
|
TOOLINFO tinfo = {
|
|
|
|
sizeof(TOOLINFO), //cbSize
|
|
|
|
TTF_IDISHWND | TTF_SUBCLASS, //uFlags
|
|
|
|
hDlg, //hwnd
|
|
|
|
0, //uId
|
|
|
|
NULL, //rect
|
|
|
|
0 //hinst
|
|
|
|
};
|
|
|
|
|
|
|
|
tinfo.uId = (UINT_PTR) GetDlgItem(hDlg, IDC_NA_FARINFO);
|
|
|
|
tinfo.lpszText = (wchar_t*)
|
|
|
|
L"FAR version 1a is found in The Sims 1.\r\n\r\n"
|
|
|
|
L"Version 1b appears to be a mistake, in which it was intended to take on the version number 2.\r\n\r\n"
|
|
|
|
L"1b and 3 are both found exclusively in The Sims Online.";
|
2012-04-06 13:27:40 -05:00
|
|
|
SendMessage(FARInfo, TTM_SETMAXTIPWIDTH, 2000, 200);
|
|
|
|
SendMessage(FARInfo, TTM_SETTITLE, TTI_INFO_LARGE, (LPARAM) L"FAR version");
|
|
|
|
SendMessage(FARInfo, TTM_ADDTOOL, 0, (LPARAM) &tinfo);
|
2011-11-24 00:53:35 -06:00
|
|
|
SendMessage(FARInfo, TTM_SETDELAYTIME, TTDT_AUTOPOP, 12000);
|
|
|
|
tinfo.uId = (UINT_PTR) GetDlgItem(hDlg, IDC_NA_DBPFINFO);
|
|
|
|
tinfo.lpszText = (wchar_t*)
|
|
|
|
L"DBPF version numbers can be shortened to the form a.b;ix,y, where "
|
|
|
|
L"a.b is the Archive version and x.y is the Index version.\r\n\r\n"
|
|
|
|
L"DBPF 1.0;i7.0 is found in The Sims Online and SimCity 4.\r\n\r\n"
|
|
|
|
L"1.0;i7.0 and 1.1;i7.1 are found in The Sims 2.\r\n\r\n"
|
|
|
|
L"2.0;i3.0 is found in Spore.";
|
2012-04-06 13:27:40 -05:00
|
|
|
SendMessage(DBPFInfo, TTM_SETMAXTIPWIDTH, 2000, 200);
|
|
|
|
SendMessage(DBPFInfo, TTM_SETTITLE, TTI_INFO_LARGE, (LPARAM) L"DBPF version");
|
|
|
|
SendMessage(DBPFInfo, TTM_ADDTOOL, 0, (LPARAM) &tinfo);
|
2011-11-24 00:53:35 -06:00
|
|
|
SendMessage(DBPFInfo, TTM_SETDELAYTIME, TTDT_AUTOPOP, 20000);
|
|
|
|
|
|
|
|
SetType(hDlg, TYPE_FAR);
|
|
|
|
} return TRUE;
|
|
|
|
case WM_CTLCOLORSTATIC:
|
2012-04-06 13:27:40 -05:00
|
|
|
if((HWND) lParam == GetDlgItem(hDlg, IDC_NA_TYPETEXT)){
|
|
|
|
SetBkColor((HDC) wParam, GetSysColor(COLOR_WINDOW));
|
|
|
|
return (INT_PTR) GetSysColorBrush(COLOR_WINDOW);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case WM_COMMAND:
|
|
|
|
switch(LOWORD(wParam)){
|
2011-11-24 00:53:35 -06:00
|
|
|
case IDC_NA_TYPE:
|
|
|
|
if(HIWORD(wParam) == CBN_SELCHANGE)
|
|
|
|
SetType(hDlg, SendMessage((HWND)lParam, CB_GETCURSEL, 0, 0));
|
|
|
|
break;
|
|
|
|
case IDOK:
|
|
|
|
Archive::IsOpen = true;
|
|
|
|
Archive::IsModified = true;
|
|
|
|
|
|
|
|
Archive::Path[0] = '\0'; //No actual path
|
|
|
|
wcscpy(Archive::Filename, L"Untitled");
|
|
|
|
Archive::SetWorkspace();
|
|
|
|
|
|
|
|
EndDialog(hDlg, 0);
|
|
|
|
case IDCANCEL:
|
|
|
|
EndDialog(hDlg, 0);
|
|
|
|
} break;
|
|
|
|
case WM_CLOSE:
|
2012-04-06 13:27:40 -05:00
|
|
|
EndDialog(hDlg, 0);
|
2011-11-24 00:53:35 -06:00
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|