15
					
						
						« kdy: 29. 06. 2015, 15:59:45 »
					 
					
					Už jsem na to přišel jak to funguje.
Hned na začátku je
DLGPROC procs[NUM_PAGES] =
{
	&IMsgsDlgProc,
	&PlyDlgProc,
	&VictDlgProc,
	&DisDlgProc,
	&MapDlgProc,
	&UnitDlgProc,
	&TrigDlgProc
};
Ty procedury jsou ale nadeklarované a nadefinované v jiném souboru - editors.h:
extern struct PropSheetData
{
	int pindex;			//current player number
	class Player *p;			//current player struct
	int sel0, sel1;	//page dependant, should be reset on SETACTIVE
	HWND statusbar;
	HWND mapview;
	HMENU menu;
	UINT tformat, ecformat, mcformat;	//clipboard formats
} propdata;
INT_PTR CALLBACK IMsgsDlgProc(HWND page, UINT msg, WPARAM wParam, LPARAM lParam);
INT_PTR CALLBACK PlyDlgProc(HWND page, UINT msg, WPARAM wParam, LPARAM lParam);
INT_PTR CALLBACK VictDlgProc(HWND page, UINT msg, WPARAM wParam, LPARAM lParam);
INT_PTR CALLBACK DisDlgProc(HWND page, UINT msg, WPARAM wParam, LPARAM lParam);
INT_PTR CALLBACK MapDlgProc(HWND page, UINT msg, WPARAM wParam, LPARAM lParam);
INT_PTR CALLBACK UnitDlgProc(HWND page, UINT msg, WPARAM wParam, LPARAM lParam);
INT_PTR CALLBACK TrigDlgProc(HWND page, UINT msg, WPARAM wParam, LPARAM lParam);
A dále je definice v modulech, např. unitedit.cpp
BOOL Units_HandleInit(HWND dialog)
{
	Combo_Fill(dialog, IDC_U_LIST_PLAYERS, Player::names, NUM_PLAYERS);
	Combo_Fill(dialog, IDC_U_ROTATE, rotates, NUM_ROTATES);
	Combo_Fill(dialog, IDC_U_SORT, sorts, NUM_SORTS);
	SendDlgItemMessage(dialog, IDC_U_SORT, CB_SETCURSEL, 0, 0);
	LCombo_Fill(dialog, IDC_U_TYPE, esdata.unitgroups.head(), L"All");
	UnitList_FillGroup(GetDlgItem(dialog, IDC_U_UNIT), NULL);
	//set edit control limits
	SendDlgItemMessage(dialog, IDC_U_X, EM_SETLIMITTEXT, 5, 0);
	SendDlgItemMessage(dialog, IDC_U_Y, EM_SETLIMITTEXT, 5, 0);
	return TRUE;
}
INT_PTR CALLBACK UnitDlgProc(HWND dialog, UINT msg, WPARAM wParam, LPARAM lParam)
{
	INT_PTR ret = FALSE;
	try
	{
		switch (msg)
		{
		case WM_INITDIALOG:
			ret = Units_HandleInit(dialog);
			break;
		case WM_COMMAND:
			ret = 0;
			Units_HandleCommand(dialog, HIWORD(wParam), LOWORD(wParam), (HWND)lParam);
			break;
		case WM_NOTIFY:
			{
				NMHDR *header = (NMHDR*)lParam;
				switch (header->code)
				{
				case PSN_SETACTIVE:
					SendDlgItemMessage(
						dialog, IDC_U_LIST_PLAYERS, CB_SETCURSEL, propdata.pindex, 0);
					Units_Reset(dialog);
					break;
				case PSN_KILLACTIVE:
					Units_Save(dialog);
					SendMessage(
						propdata.mapview, MAP_UnhighlightPoint, MAP_UNHIGHLIGHT_ALL, 0);
				}
			}
			break;
		case WM_VKEYTOITEM:
			if (LOWORD(wParam) == VK_DELETE)
				Units_HandleDelete(dialog);
			ret = -1;
			break;
		case AOKTS_Loading:
			Units_Reset(dialog);
			break;
		case AOKTS_Saving:
			Units_Save(dialog);
			break;
		case MAP_Click:
			Units_HandleMapClick(dialog, LOWORD(lParam), HIWORD(lParam));
			break;
		}
	}
	catch (std::exception& ex)
	{
		// Show a user-friendly message, bug still crash to allow getting all
		// the debugging info.
		unhandledExceptionAlert(dialog, msg, ex);
		throw;
	}
	return ret;
}