Example #1
0
void MapEditor::OnChangeLevel()
{
	int row = LevelList.GetCurrentRow();
	if (row < 0) return;

	_map.GetLevels()[row].WhenCalculate = THISBACK1(OnLevelMapCalc, row);
	_map.GetLevels()[row].WhenMapList = THISBACK(OnLevelMapList);
	_map.GetLevels()[row].OpenProperties();

	UpdateLevelList();
}
Example #2
0
void MapEditor::OnRemoveLevel()
{
	int row = LevelList.GetCurrentRow();
	if (row < 0) return;

	if (!PromptYesNo(t_("Remove the selected level from map?")))
		return;

	if (!PromptYesNo(t_("No undo for this action. Are you sure?")))
		return;

	_map.GetLevels().Remove(row);
	UpdateLevelList();
}
Example #3
0
void MapEditor::OnNewMap()
{
	int r = PromptYesNoCancel(t_("Save current map before creating new map?"));

	if (r == IDYES)
		OnSaveMap();

	if (r == IDCANCEL)
		return;

	_map.Clear();

	UpdateLevelList();
	UpdateEditorCtrls();
}
Example #4
0
void MapEditor::OnAddLevel()
{
	int row = LevelList.GetRowCount();

	Level level;
	level.SetName(NFormat(t_("Level #%d"), _map.GetLevels().GetCount() + 1));

	level.WhenMapList = THISBACK(OnLevelMapList);
	level.WhenCalculate = THISBACK1(OnLevelMapCalc, row);
	if (level.OpenProperties() != IDOK)
		return;

	_map.GetLevels().Add(level);

	UpdateLevelList();
}
Example #5
0
void MapEditor::OnLoadMap()
{
	WithMapLoadLayout<TopWindow> dlg;
	CtrlLayoutOKCancel(dlg, t_("Load Map..."));

	String dir = AppendFileName( GetFileDirectory(GetExeFilePath()), "Mipmaps");
	Vector<String> files = GetDirectoryFiles(dir, "*.map");
	Sort(files);

	if (files.GetCount() <= 0)
	{
		Exclamation(t_("No any file to load!"));
		return;
	}

	for (int i = 0; i < files.GetCount(); ++i)
		dlg.MapList.Add(files[i], files[i]);
	dlg.MapList.SetIndex(0);

	if (dlg.Execute() != IDOK)
		return;

	String fp = AppendFileName(dir, (~dlg.MapList).ToString());

	if (!FileExists(fp))
	{
		Exclamation(NFormat(t_("File not found: %s"), fp));
		return;
	}

	if (!LoadFromXMLFile(_map, fp))
	{
		Exclamation(NFormat(t_("Error while loading map from file: %s"), fp));
		return;
	}

	UpdateLevelList();
	UpdateEditorCtrls();
}
Example #6
0
void CNB_Select_Level_Panel::PerformLayout()
{
	BaseClass::PerformLayout();

	UpdateLevelList();
}