From: binarymaster Date: Thu, 28 Sep 2017 20:22:44 +0000 (+0300) Subject: Main: Prompt to remove file from recent list X-Git-Url: http://deadsoftware.ru/gitweb?a=commitdiff_plain;h=71ef827e8608f2e426111ff0ddfb7019beba0e65;p=d2df-editor.git Main: Prompt to remove file from recent list --- diff --git a/src/editor/f_main.pas b/src/editor/f_main.pas index 8bdab7d..ef9e19d 100644 --- a/src/editor/f_main.pas +++ b/src/editor/f_main.pas @@ -2501,6 +2501,7 @@ procedure TMainForm.aRecentFileExecute(Sender: TObject); var n, pw: Integer; s, fn: String; + b: Boolean; begin s := LowerCase((Sender as TMenuItem).Caption); Delete(s, Pos('&', s), 1); @@ -2512,17 +2513,31 @@ begin s := RecentFiles[n]; pw := Pos('.wad:\', LowerCase(s)); + b := False; if pw > 0 then begin // Map name included fn := Copy(s, 1, pw + 3); Delete(s, 1, pw + 5); if (FileExists(fn)) then + begin OpenMap(fn, s); + b := True; + end; end else // Only wad name if (FileExists(s)) then + begin OpenMap(s, ''); + b := True; + end; + + if (not b) and (MessageBox(0, 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(); + end; end; procedure TMainForm.aEditorOptionsExecute(Sender: TObject); diff --git a/src/editor/g_language.pas b/src/editor/g_language.pas index 456ab9b..8c6de06 100644 --- a/src/editor/g_language.pas +++ b/src/editor/g_language.pas @@ -304,6 +304,8 @@ Type I_MSG_DEL_TEXTURE, I_MSG_DEL_TEXTURE_PROMT, I_MSG_DEL_TEXTURE_CANT, + I_MSG_DEL_RECENT, + I_MSG_DEL_RECENT_PROMT, I_MSG_CLEAR_MAP, I_MSG_CLEAR_MAP_PROMT, I_MSG_DELETE_MAP, @@ -1216,6 +1218,10 @@ Const 'Удалить текстуру "%s" ?'), ('MSG DEL TEXTURE CANT', 'Can''t delete texture in use. Replace it on all panels with this texture.', 'Нельзя удалить используемую текстуру. Замените её на каждой панели с ней.'), + ('MSG DEL RECENT', 'File does not longer exist', + 'Этого файла больше нет'), + ('MSG DEL RECENT PROMT', 'Remove entry from recent list?', + 'Убрать запись из истории?'), ('MSG CLEAR MAP', 'New map', 'Новая карта'), ('MSG CLEAR MAP PROMT', 'Clear the entire map?',