diff --git a/src/editor/f_main.pas b/src/editor/f_main.pas
index 22d9877b8f9c94bb8bf6a3d98f6f783b0dc5c731..2bf10e67abbf1a555c9616463e212a1e3cda4082 100644 (file)
--- a/src/editor/f_main.pas
+++ b/src/editor/f_main.pas
// Панель применения свойств:
PanelPropApply: TPanel;
bApplyProperty: TButton;
+ MapTestTimer: TTimer;
// Редактор свойств объектов:
vleObjectProperty: TValueListEditor;
procedure RenderPanelPaint(Sender: TObject);
procedure RenderPanelResize(Sender: TObject);
procedure Splitter1Moved(Sender: TObject);
+ procedure MapTestCheck(Sender: TObject);
procedure vleObjectPropertyEditButtonClick(Sender: TObject);
procedure vleObjectPropertyApply(Sender: TObject);
procedure vleObjectPropertyGetPickList(Sender: TObject; const KeyName: String; Values: TStrings);
var
MainForm: TMainForm;
- EditorDir: String;
+ StartMap: String;
OpenedMap: String;
OpenedWAD: String;
UndoBuffer: Array of Array of TUndoRec = nil;
+ MapTestProcess: TProcessUTF8;
+ MapTestFile: String;
{$R *.lfm}
procedure ErrorMessageBox(str: String);
begin
- MessageBox(0, PChar(str), PChar(_lc[I_MSG_ERROR]),
+ Application.MessageBox(PChar(str), PChar(_lc[I_MSG_ERROR]),
MB_ICONINFORMATION or MB_OK or MB_DEFBUTTON1);
end;
if aWAD = _lc[I_WAD_SPECIAL_MAP] then
begin // Файл карты
g_ProcessResourceStr(OpenedMap, @fn, nil, nil);
- //FileName := EditorDir+'maps\'+ExtractFileName(fn);
FileName := fn;
ResourceName := ':'+SectionName+'\'+aTex;
end
end
else
begin // Внешний WAD
- FileName := EditorDir+'wads/'+aWAD;
+ FileName := WadsDir + DirectorySeparator + aWAD;
ResourceName := aWAD+':'+SectionName+'\'+aTex;
end;
s := g_ExtractFilePathName(RecentFiles[n]);
OpenMap(fn, s)
end
- else if MessageBox(0, PChar(_lc[I_MSG_DEL_RECENT_PROMT]), PChar(_lc[I_MSG_DEL_RECENT]), MB_ICONQUESTION or MB_YESNO) = idYes then
+ else if Application.MessageBox(PChar(_lc[I_MSG_DEL_RECENT_PROMT]), PChar(_lc[I_MSG_DEL_RECENT]), MB_ICONQUESTION or MB_YESNO) = idYes then
begin
RecentFiles.Delete(n);
RefreshRecentMenu();
begin
Randomize();
- EditorDir := ExtractFilePath(Application.ExeName);
-
e_WriteLog('Doom 2D: Forever Editor version ' + EDITOR_VERSION, MSG_NOTIFY);
e_WriteLog('Build date: ' + EDITOR_BUILDDATE + ' ' + EDITOR_BUILDTIME, MSG_NOTIFY);
e_WriteLog('Build hash: ' + g_GetBuildHash(), MSG_NOTIFY);
DotSize := 2
else
DotSize := 1;
- OpenDialog.InitialDir := config.ReadStr('Editor', 'LastOpenDir', EditorDir);
- SaveDialog.InitialDir := config.ReadStr('Editor', 'LastSaveDir', EditorDir);
+ OpenDialog.InitialDir := config.ReadStr('Editor', 'LastOpenDir', MapsDir);
+ SaveDialog.InitialDir := config.ReadStr('Editor', 'LastSaveDir', MapsDir);
s := config.ReadStr('Editor', 'Language', '');
gLanguage := s;
procedure TMainForm.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
begin
- CanClose := MessageBox(0, PChar(_lc[I_MSG_EXIT_PROMT]),
+ CanClose := Application.MessageBox(PChar(_lc[I_MSG_EXIT_PROMT]),
PChar(_lc[I_MSG_EXIT]),
MB_ICONQUESTION or MB_YESNO or
MB_DEFBUTTON1) = idYes;
FormResize(Sender);
end;
+procedure TMainForm.MapTestCheck(Sender: TObject);
+begin
+ if MapTestProcess <> nil then
+ begin
+ if MapTestProcess.Running = false then
+ begin
+ if MapTestProcess.ExitCode <> 0 then
+ Application.MessageBox(PChar(_lc[I_MSG_EXEC_ERROR]), 'FIXME', MB_OK or MB_ICONERROR);
+ SysUtils.DeleteFile(MapTestFile);
+ MapTestFile := '';
+ FreeAndNil(MapTestProcess);
+ tbTestMap.Enabled := True;
+ end;
+ end;
+end;
+
procedure TMainForm.aMapOptionsExecute(Sender: TObject);
var
ResName: String;
if OpenedMap = '' then
Exit;
- if MessageBox(0, PChar(_lc[I_MSG_REOPEN_MAP_PROMT]),
+ if Application.MessageBox(PChar(_lc[I_MSG_REOPEN_MAP_PROMT]),
PChar(_lc[I_MENU_FILE_REOPEN]), MB_ICONQUESTION or MB_YESNO) <> idYes then
Exit;
if i = -1 then
Exit;
- if MessageBox(0, PChar(Format(_lc[I_MSG_DEL_TEXTURE_PROMT],
+ if Application.MessageBox(PChar(Format(_lc[I_MSG_DEL_TEXTURE_PROMT],
[SelectedTexture()])),
PChar(_lc[I_MSG_DEL_TEXTURE]),
MB_ICONQUESTION or MB_YESNO or
procedure TMainForm.aNewMapExecute(Sender: TObject);
begin
- if (MessageBox(0, PChar(_lc[I_MSG_CLEAR_MAP_PROMT]),
- PChar(_lc[I_MSG_CLEAR_MAP]),
- MB_ICONQUESTION or MB_YESNO or
- MB_DEFBUTTON1) = mrYes) then
+ if Application.MessageBox(PChar(_lc[I_MSG_CLEAR_MAP_PROMT]), PChar(_lc[I_MSG_CLEAR_MAP]), MB_ICONQUESTION or MB_YESNO or MB_DEFBUTTON1) = mrYes then
FullClear();
end;
MainForm.ActiveControl := RenderPanel;
// Язык:
- if gLanguage = '' then
+ if (gLanguage = '') and not (fsModal in SelectLanguageForm.FormState) then
begin
lang := SelectLanguageForm.ShowModal();
case lang of
1: gLanguage := LANGUAGE_ENGLISH;
- else gLanguage := LANGUAGE_RUSSIAN;
+ 2: gLanguage := LANGUAGE_RUSSIAN;
+ else gLanguage := LANGUAGE_ENGLISH;
end;
config := TConfig.CreateFile(CfgFileName);
Exit;
MapName := SelectMapForm.lbMapList.Items[SelectMapForm.lbMapList.ItemIndex];
- if MessageBox(0, PChar(Format(_lc[I_MSG_DELETE_MAP_PROMT], [MapName, OpenDialog.FileName])), PChar(_lc[I_MSG_DELETE_MAP]), MB_ICONQUESTION or MB_YESNO or MB_DEFBUTTON2) <> mrYes then
+ if Application.MessageBox(PChar(Format(_lc[I_MSG_DELETE_MAP_PROMT], [MapName, OpenDialog.FileName])), PChar(_lc[I_MSG_DELETE_MAP]), MB_ICONQUESTION or MB_YESNO or MB_DEFBUTTON2) <> mrYes then
Exit;
g_DeleteResource(FileName, '', MapName, res);
if res <> 0 then
begin
- MessageBox(0, PChar('Cant delete map res=' + IntToStr(res)), PChar('Map not deleted!'), MB_ICONINFORMATION or MB_OK or MB_DEFBUTTON1);
+ Application.MessageBox(PChar('Cant delete map res=' + IntToStr(res)), PChar('Map not deleted!'), MB_ICONINFORMATION or MB_OK or MB_DEFBUTTON1);
Exit
end;
- MessageBox(
- 0,
+ Application.MessageBox(
PChar(Format(_lc[I_MSG_MAP_DELETED_PROMT], [MapName])),
PChar(_lc[I_MSG_MAP_DELETED]),
MB_ICONINFORMATION or MB_OK or MB_DEFBUTTON1
end;
procedure TMainForm.OnIdle(Sender: TObject; var Done: Boolean);
+ var f: AnsiString;
begin
// FIXME: this is a shitty hack
if not gDataLoaded then
MainForm.FormResize(nil);
end;
Draw();
+ if StartMap <> '' then
+ begin
+ f := StartMap;
+ StartMap := '';
+ OpenMap(f, '');
+ end;
end;
procedure TMainForm.miMapPreviewClick(Sender: TObject);
proc: TProcessUTF8;
res: Boolean;
begin
+ // Ignore while map testing in progress
+ if MapTestProcess <> nil then
+ Exit;
+
// Сохраняем временную карту:
time := 0;
repeat
end;
if res then
begin
- Application.Minimize();
- proc.WaitOnExit();
- end;
- if (not res) or (proc.ExitCode < 0) then
+ tbTestMap.Enabled := False;
+ MapTestFile := newWAD;
+ MapTestProcess := proc;
+ end
+ else
begin
- MessageBox(0, 'FIXME',
- PChar(_lc[I_MSG_EXEC_ERROR]),
- MB_OK or MB_ICONERROR);
+ Application.MessageBox(PChar(_lc[I_MSG_EXEC_ERROR]), 'FIXME', MB_OK or MB_ICONERROR);
+ SysUtils.DeleteFile(newWAD);
+ proc.Free();
end;
- proc.Free();
-
- SysUtils.DeleteFile(newWAD);
- Application.Restore();
end;
procedure TMainForm.sbVerticalScroll(Sender: TObject;