Skip to content

Commit ad98bd0

Browse files
committed
Updated Tools bitmap
Fixed: "Recent Workspace"/"Recent Workspace" button should now remove non existing files
1 parent aaedcfe commit ad98bd0

File tree

10 files changed

+568
-159
lines changed

10 files changed

+568
-159
lines changed

CodeLite/cl_config.cpp

Lines changed: 41 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,25 @@ clConfig::clConfig(const wxString& filename)
6464
} else {
6565
m_root = new JSONRoot(cJSON_Object);
6666
}
67+
68+
// Load the "Recent Items" cache
69+
{
70+
wxArrayString recentFiles;
71+
JSONElement e = m_root->toElement();
72+
if(e.hasNamedObject("RecentWorkspaces")) {
73+
recentFiles = e.namedObject("RecentWorkspaces").toArrayString();
74+
m_cacheRecentItems.insert(std::make_pair("RecentWorkspaces", recentFiles));
75+
}
76+
}
77+
78+
{
79+
wxArrayString recentFiles;
80+
JSONElement e = m_root->toElement();
81+
if(e.hasNamedObject("RecentFiles")) {
82+
recentFiles = e.namedObject("RecentFiles").toArrayString();
83+
m_cacheRecentItems.insert(std::make_pair("RecentFiles", recentFiles));
84+
}
85+
}
6786
}
6887

6988
clConfig::~clConfig() { wxDELETE(m_root); }
@@ -392,13 +411,28 @@ void clConfig::DoAddRecentItem(const wxString& propName, const wxString& filenam
392411
if(recentItems.Index(filename) != wxNOT_FOUND) {
393412
recentItems.Remove(filename);
394413
}
414+
415+
if(!wxFileName(filename).FileExists()) {
416+
// Don't add non existing file
417+
return;
418+
}
419+
395420
recentItems.Insert(filename, 0);
396421

397422
// Make sure the list does not go over 15 items
398423
while(recentItems.size() >= 15) {
399424
recentItems.RemoveAt(recentItems.size() - 1);
400425
}
401426

427+
// Remove non existing items
428+
wxArrayString existingFiles;
429+
for(size_t i = 0; i < recentItems.size(); ++i) {
430+
if(wxFileName(recentItems.Item(i)).FileExists()) {
431+
existingFiles.Add(recentItems.Item(i));
432+
}
433+
}
434+
recentItems.swap(existingFiles);
435+
402436
// Remove old node if exists
403437
JSONElement e = m_root->toElement();
404438
if(e.hasNamedObject(propName)) {
@@ -412,6 +446,7 @@ void clConfig::DoAddRecentItem(const wxString& propName, const wxString& filenam
412446
if(m_cacheRecentItems.count(propName)) {
413447
m_cacheRecentItems.erase(propName);
414448
}
449+
415450
m_cacheRecentItems.insert(std::make_pair(propName, recentItems));
416451
m_root->save(m_filename);
417452
}
@@ -435,12 +470,13 @@ wxArrayString clConfig::DoGetRecentItems(const wxString& propName) const
435470

436471
// Try the cache first
437472
if(m_cacheRecentItems.count(propName)) {
438-
return m_cacheRecentItems.find(propName)->second;
439-
}
473+
recentItems = m_cacheRecentItems.find(propName)->second;
440474

441-
JSONElement e = m_root->toElement();
442-
if(e.hasNamedObject(propName)) {
443-
recentItems = e.namedObject(propName).toArrayString();
475+
} else {
476+
JSONElement e = m_root->toElement();
477+
if(e.hasNamedObject(propName)) {
478+
recentItems = e.namedObject(propName).toArrayString();
479+
}
444480
}
445481
return recentItems;
446482
}

LiteEditor.workspace

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@
144144
<Project Name="WebTools" ConfigName="DebugUnicode"/>
145145
<Project Name="HelpPlugin" ConfigName="Win_x64_Debug"/>
146146
</WorkspaceConfiguration>
147-
<WorkspaceConfiguration Name="CMake_Debug" Selected="yes">
147+
<WorkspaceConfiguration Name="CMake_Debug" Selected="no">
148148
<Project Name="ZoomNavigator" ConfigName="Win_x86_Release"/>
149149
<Project Name="wxsqlite3" ConfigName="Win_x86_Release"/>
150150
<Project Name="wxshapeframework" ConfigName="Win_x86_Release"/>
@@ -279,7 +279,7 @@
279279
<Project Name="WebTools" ConfigName="DebugUnicode"/>
280280
<Project Name="HelpPlugin" ConfigName="Win_x64_Debug"/>
281281
</WorkspaceConfiguration>
282-
<WorkspaceConfiguration Name="Win_x64_Release" Selected="no">
282+
<WorkspaceConfiguration Name="Win_x64_Release" Selected="yes">
283283
<Project Name="abbreviation" ConfigName="Win_x64_Release"/>
284284
<Project Name="CallGraph" ConfigName="Win_x64_Release"/>
285285
<Project Name="CMakePlugin" ConfigName="Win_x64_Release"/>

LiteEditor/WelcomePage.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
#include "event_notifier.h"
3535
#include "plugin.h"
3636
#include "editor_config.h"
37+
#include "pluginmanager.h"
3738

3839
WelcomePage::WelcomePage(wxWindow* parent)
3940
: WelcomePageBase(parent)
@@ -107,8 +108,7 @@ void WelcomePage::OnShowWorkspaceMenu(wxCommandEvent& event)
107108
int
108109
WelcomePage::DoGetPopupMenuSelection(wxCommandLinkButton* btn, const wxArrayString& strings, const wxString& menuTitle)
109110
{
110-
BitmapLoader bl;
111-
BitmapLoader::BitmapMap_t bmps = bl.MakeStandardMimeMap();
111+
BitmapLoader::BitmapMap_t bmps = PluginManager::Get()->GetStdIcons()->MakeStandardMimeMap();
112112

113113
m_idToName.clear();
114114
wxUnusedVar(menuTitle);

Runtime/codelite-bitmaps.zip

-1.2 KB
Binary file not shown.

bitmaps/16-tools.png

-132 Bytes
Loading

bitmaps/[email protected]

-321 Bytes
Loading

bitmaps/24-tools.png

-284 Bytes
Loading

bitmaps/[email protected]

-489 Bytes
Loading

svgs/create-humanity-icons.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,8 @@ public function copy() {
5959
$OnSizeIcons[] = new ImageFile("status\\24\\network-offline.svg", "disconnected.svg");
6060
$OnSizeIcons[] = new ImageFile("status\\24\\network-transmit-receive.svg", "connected.svg");
6161
$OnSizeIcons[] = new ImageFile("apps\\24\\checkbox.svg", "checkbox.svg");
62-
$OnSizeIcons[] = new ImageFile("places\\24\\folder-system.svg", "project.svg");
6362
$OnSizeIcons[] = new ImageFile("status\\24\\media-playlist-repeat.svg", "repeat.svg");
64-
$OnSizeIcons[] = new ImageFile("categories\\24\\applications-utilities.svg", "tools.svg");
63+
$OnSizeIcons[] = new ImageFile("categories\\24\\preferences-other.svg", "tools.svg");
6564

6665
// 16x16 icons size
6766
$SmallIcons[] = new ImageFile("actions\\16\\document-new.svg", "16/file_new.svg");

0 commit comments

Comments
 (0)