Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

Commit 46cfa95

Browse files
Merge pull request #1984 from bwmilby/bwm-clear-recents
[[ Bug 4382 ]] Add `Clear Recent Files` option to Open Recent File menu
2 parents 0ed7253 + b741c4a commit 46cfa95

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

Toolset/palettes/menubar/revmenubar.livecodescript

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@ end setupWindowMenu
194194
/*
195195
Generates the menu for the recent files
196196
*/
197+
constant kClearRecentFiles = "ClearTheRecentFileList"
197198
function revMenuBarRecentFiles
198199
# Get the recent file data
199200
local tRecentFiles
@@ -208,7 +209,12 @@ function revMenuBarRecentFiles
208209
put return & tab & revMenubarEscapeStackNameForMenu(tRecentFiles[x]["label"]) & "/|" & tRecentFiles[x]["filename"] after tMenu
209210
end if
210211
end repeat
211-
212+
213+
if tMenu is not empty then
214+
put return & tab & "-" after tMenu
215+
put return & tab & "Clear Recent Files" & "/|" & kClearRecentFiles after tMenu
216+
end if
217+
212218
return tMenu
213219
end revMenuBarRecentFiles
214220

@@ -1380,10 +1386,10 @@ private function revMenubarFileMenu pContext
13801386
put "&Open Stack.../O" & return after tFile
13811387

13821388
if revMenuBarRecentFiles() is not empty then
1383-
put "Open Recent File" & return after tFile
1389+
put "Open Recent File" & return after tFile
13841390
put revMenuBarRecentFiles() & return after tFile
13851391
else
1386-
put "(Open Recent File" & return after tFile
1392+
put "(Open Recent File" & return after tFile
13871393
end if
13881394

13891395
put enableMenuItem("&Close/W", the mode of the topStack <= 3 and the short name of the topstack is not "revMenubar") & return after tFile
@@ -2758,7 +2764,14 @@ on revMenubarFileMenuPick pWhich
27582764
end if
27592765
break
27602766
case "Open Recent File"
2761-
revIDEOpenStack item 2 of pWhich
2767+
local tRecentStack
2768+
put item 2 of pWhich into tRecentStack
2769+
if tRecentStack is kClearRecentFiles then
2770+
revIDESetPreference "cRecentStackPaths", empty
2771+
ideMessageSend "ideRecentFilesChanged"
2772+
else
2773+
revIDEOpenStack tRecentStack
2774+
end if
27622775
break
27632776
case "Import As Control"
27642777
put item 2 of pWhich into tType

notes/bugfix-4382.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Add `Clear Recent Files` option to Open Recent File menu

0 commit comments

Comments
 (0)