From: binarymaster Date: Sat, 30 Sep 2017 17:05:27 +0000 (+0300) Subject: Menu: Add map reopen feature X-Git-Url: http://deadsoftware.ru/gitweb?a=commitdiff_plain;h=fe7bb30e30aa2c6d52bb6ad641b5f0ae10de329e;p=d2df-editor.git Menu: Add map reopen feature http://doom2d.org/forum/viewtopic.php?f=12&t=1947 --- diff --git a/src/editor/f_main.lfm b/src/editor/f_main.lfm index b44cafc..344fefb 100644 --- a/src/editor/f_main.lfm +++ b/src/editor/f_main.lfm @@ -1944,6 +1944,12 @@ object MainForm: TMainForm object miLine1: TMenuItem Caption = '-' end + object miReopenMap: TMenuItem + Caption = 'Открыть заново' + ImageIndex = 1 + ShortCut = 116 + OnClick = miReopenMapClick + end object miSaveMiniMap: TMenuItem Caption = 'Сохранить мини-карту' Bitmap.Data = { diff --git a/src/editor/f_main.pas b/src/editor/f_main.pas index 292bcda..82bd18d 100644 --- a/src/editor/f_main.pas +++ b/src/editor/f_main.pas @@ -26,6 +26,7 @@ type miSaveMapAs: TMenuItem; miOpenWadMap: TMenuItem; miLine1: TMenuItem; + miReopenMap: TMenuItem; miSaveMiniMap: TMenuItem; miDeleteMap: TMenuItem; miPackMap: TMenuItem; @@ -210,6 +211,7 @@ type procedure lbTextureListClick(Sender: TObject); procedure lbTextureListDrawItem(Control: TWinControl; Index: Integer; ARect: TRect; State: TOwnerDrawState); + procedure miReopenMapClick(Sender: TObject); procedure RenderPanelMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); procedure RenderPanelMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); procedure RenderPanelMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); @@ -385,7 +387,7 @@ const SELECTFLAG_SHOTPANEL = 7; SELECTFLAG_SELECTED = 8; - RECENT_FILES_MENU_START = 11; + RECENT_FILES_MENU_START = 12; CLIPBOARD_SIG = 'DF:ED'; @@ -4549,6 +4551,21 @@ begin end; end; +procedure TMainForm.miReopenMapClick(Sender: TObject); +var + FileName, Resource: String; +begin + if OpenedMap = '' then + Exit; + + if MessageBox(0, PChar(_lc[I_MSG_REOPEN_MAP_PROMT]), + PChar(_lc[I_MENU_FILE_REOPEN]), MB_ICONQUESTION or MB_YESNO) <> idYes then + Exit; + + g_ProcessResourceStr(OpenedMap, @FileName, nil, @Resource); + OpenMap(FileName, Resource); +end; + procedure TMainForm.vleObjectPropertyGetPickList(Sender: TObject; const KeyName: String; Values: TStrings); begin diff --git a/src/editor/g_language.pas b/src/editor/g_language.pas index af9b436..e1f7638 100644 --- a/src/editor/g_language.pas +++ b/src/editor/g_language.pas @@ -312,6 +312,7 @@ Type I_MSG_DELETE_MAP_PROMT, I_MSG_MAP_DELETED, I_MSG_MAP_DELETED_PROMT, + I_MSG_REOPEN_MAP_PROMT, I_MSG_EXEC_ERROR, I_MSG_SOUND_ERROR, I_MSG_WAD_ERROR, @@ -337,6 +338,7 @@ Type I_MENU_FILE_SAVE, I_MENU_FILE_SAVE_AS, I_MENU_FILE_OPEN_WAD, + I_MENU_FILE_REOPEN, I_MENU_FILE_SAVE_MINI, I_MENU_FILE_DELETE, I_MENU_FILE_PACK_MAP, @@ -1237,6 +1239,8 @@ Const 'Карта удалена'), ('MSG MAP DELETED PROMT', 'Map "%s" is deleted', 'Карта "%s" удалена'), + ('MSG REOPEN MAP PROMT', 'Reopen this map?', + 'Загрузить карту заново?'), ('MSG EXEC ERROR', 'Game start error', 'Ошибка запуска игры'), ('MSG SOUND ERROR', 'Can''t play sound', @@ -1285,6 +1289,8 @@ Const 'Сохранить карту как...'), ('MENU FILE OPEN WAD', 'Select Map', 'Выбрать карту'), + ('MENU FILE REOPEN', 'Reopen Map', + 'Открыть заново'), ('MENU FILE SAVE MINI', 'Save Mini-map', 'Сохранить мини-карту'), ('MENU FILE DELETE', 'Delete Map from WAD...', @@ -2025,6 +2031,7 @@ begin miSaveMap.Caption := _lc[I_MENU_FILE_SAVE]; miSaveMapAs.Caption := _lc[I_MENU_FILE_SAVE_AS]; miOpenWadMap.Caption := _lc[I_MENU_FILE_OPEN_WAD]; + miReopenMap.Caption := _lc[I_MENU_FILE_REOPEN]; miSaveMiniMap.Caption := _lc[I_MENU_FILE_SAVE_MINI]; miDeleteMap.Caption := _lc[I_MENU_FILE_DELETE]; miPackMap.Caption := _lc[I_MENU_FILE_PACK_MAP];