summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: fb6bceb)
raw | patch | inline | side by side (parent: fb6bceb)
author | binarymaster <x86corez@gmail.com> | |
Fri, 29 Sep 2017 20:17:35 +0000 (23:17 +0300) | ||
committer | binarymaster <x86corez@gmail.com> | |
Fri, 29 Sep 2017 20:17:35 +0000 (23:17 +0300) |
http://doom2d.org/forum/viewtopic.php?f=12&t=1588
src/editor/f_main.lfm | patch | blob | history | |
src/editor/f_main.pas | patch | blob | history |
diff --git a/src/editor/f_main.lfm b/src/editor/f_main.lfm
index ade3a7fc534c7949a6752a2e0096dca0e2879810..0a7bf85a18f92d62b20f50899da3ae527afe6f60 100644 (file)
--- a/src/editor/f_main.lfm
+++ b/src/editor/f_main.lfm
Height = 480
Top = 255
Width = 672
+ AllowDropFiles = True
Caption = '2'
ClientHeight = 460
ClientWidth = 672
OnCloseQuery = FormCloseQuery
OnCreate = FormCreate
OnDestroy = FormDestroy
+ OnDropFiles = FormDropFiles
OnKeyDown = FormKeyDown
OnKeyUp = FormKeyUp
OnResize = FormResize
diff --git a/src/editor/f_main.pas b/src/editor/f_main.pas
index 63f31f4a83d7edc3aaa77513e34b171e75e1f2e1..c5821c4fb5608f62e0321fdbe65fa418501d2e69 100644 (file)
--- a/src/editor/f_main.pas
+++ b/src/editor/f_main.pas
procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
+ procedure FormDropFiles(Sender: TObject; const FileNames: array of String);
procedure FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
procedure FormResize(Sender: TObject);
procedure lbTextureListClick(Sender: TObject);
procedure OnIdle(Sender: TObject; var Done: Boolean);
public
procedure RefreshRecentMenu();
+ procedure OpenMapFile(FileName: String);
end;
const
slInvalidTextures.Free;
end;
+procedure TMainForm.FormDropFiles(Sender: TObject;
+ const FileNames: array of String);
+begin
+ if Length(FileNames) <> 1 then
+ Exit;
+
+ OpenMapFile(FileNames[0]);
+end;
+
procedure TMainForm.RenderPanelResize(Sender: TObject);
begin
if MainForm.Visible then
if OpenDialog.Execute() then
begin
- if (Pos('.ini', LowerCase(ExtractFileName(OpenDialog.FileName))) > 0) then
- begin // INI карты:
- FullClear();
+ OpenMapFile(OpenDialog.FileName);
+ OpenDialog.InitialDir := ExtractFileDir(OpenDialog.FileName);
+ end;
+end;
- pLoadProgress.Left := (RenderPanel.Width div 2)-(pLoadProgress.Width div 2);
- pLoadProgress.Top := (RenderPanel.Height div 2)-(pLoadProgress.Height div 2);
- pLoadProgress.Show();
+procedure TMainForm.OpenMapFile(FileName: String);
+begin
+ if (Pos('.ini', LowerCase(ExtractFileName(FileName))) > 0) then
+ begin // INI карты:
+ FullClear();
- OpenedMap := '';
- OpenedWAD := '';
+ pLoadProgress.Left := (RenderPanel.Width div 2)-(pLoadProgress.Width div 2);
+ pLoadProgress.Top := (RenderPanel.Height div 2)-(pLoadProgress.Height div 2);
+ pLoadProgress.Show();
- LoadMapOld(OpenDialog.FileName);
+ OpenedMap := '';
+ OpenedWAD := '';
- MainForm.Caption := Format('%s - %s', [FormCaption, ExtractFileName(OpenDialog.FileName)]);
+ LoadMapOld(FileName);
- pLoadProgress.Hide();
- MainForm.FormResize(Self);
- end
- else // Карты из WAD:
- begin
- OpenMap(OpenDialog.FileName, '');
- end;
+ MainForm.Caption := Format('%s - %s', [FormCaption, ExtractFileName(FileName)]);
- OpenDialog.InitialDir := ExtractFileDir(OpenDialog.FileName);
- end;
+ pLoadProgress.Hide();
+ MainForm.FormResize(Self);
+ end
+ else // Карты из WAD:
+ begin
+ OpenMap(FileName, '');
+ end;
end;
procedure TMainForm.FormActivate(Sender: TObject);