My favorites | Sign in
Project Home Downloads Source
Checkout   Browse   Changes    
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#include "MapEditor.h"

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();
}

void MapEditor::OnSaveMap()
{
CalculateAllPrompt();

if (!StoreAsXMLFile(_map, _map.GetName(),
AppendFileName(
AppendFileName(GetFileDirectory(GetExeFilePath()), "Mipmaps"),
_map.GetName() + ".map"
)))
{
Exclamation(t_("Error while saving map to file!"));
}

UpdateEditorCtrls();
}

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();
}

void MapEditor::OnViewMap()
{
WithPreviewLayout<TopWindow> dlg;
CtrlLayout(dlg, t_("Map Preview"));
dlg.Sizeable().MaximizeBox();
dlg.View.HighQuality(true);

if (!dlg.View.LoadMap(_map))
{
Exclamation(t_("Error while loading preview!"));
return;
}

dlg.Execute();
}

void MapEditor::OnMapProperties()
{
_map.OpenProperties();
UpdateEditorCtrls();
}

Change log

r4180 by Sc0rch on Nov 17, 2011   Diff
MapRender: First release
(FormEditorCommon, FormEditorProperties,
Map, MapBG, MapCommon, MapEditor,
MapRenderTest.
Go to: 
Project members, sign in to write a code review

Older revisions

All revisions of this file

File info

Size: 1836 bytes, 95 lines
Powered by Google Project Hosting