DEADSOFTWARE

Main: Prompt to remove file from recent list
authorbinarymaster <x86corez@gmail.com>
Thu, 28 Sep 2017 20:22:44 +0000 (23:22 +0300)
committerbinarymaster <x86corez@gmail.com>
Thu, 28 Sep 2017 20:28:48 +0000 (23:28 +0300)
src/editor/f_main.pas
src/editor/g_language.pas

index 8bdab7d638cc7c829574a91ebb9c7a3bc960a1cd..ef9e19d2ee9c59c7ffd0bdeae5e12aedfa9221cc 100644 (file)
@@ -2501,6 +2501,7 @@ procedure TMainForm.aRecentFileExecute(Sender: TObject);
 var
   n, pw: Integer;
   s, fn: String;
 var
   n, pw: Integer;
   s, fn: String;
+  b: Boolean;
 begin
   s := LowerCase((Sender as TMenuItem).Caption);
   Delete(s, Pos('&', s), 1);
 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));
 
   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
   
   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);
         OpenMap(fn, s);
+        b := True;
+      end;
     end
   else // Only wad name
     if (FileExists(s)) then
     end
   else // Only wad name
     if (FileExists(s)) then
+    begin
       OpenMap(s, '');
       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);
 end;
 
 procedure TMainForm.aEditorOptionsExecute(Sender: TObject);
index 456ab9b63d3aa1d73c1d4e03af0e33c8908b4d20..8c6de06a7cf7209bc3ff500affa6087aba12a6f9 100644 (file)
@@ -304,6 +304,8 @@ Type
     I_MSG_DEL_TEXTURE,
     I_MSG_DEL_TEXTURE_PROMT,
     I_MSG_DEL_TEXTURE_CANT,
     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,
     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.',
                                        'Нельзя удалить используемую текстуру. Замените её на каждой панели с ней.'),
                                        'Удалить текстуру "%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?',
     ('MSG CLEAR MAP',                  'New map',
                                        'Новая карта'),
     ('MSG CLEAR MAP PROMT',            'Clear the entire map?',