Skip to content

Commit

Permalink
Updated Tools bitmap
Browse files Browse the repository at this point in the history
Fixed: "Recent Workspace"/"Recent Workspace" button should now remove non existing files
  • Loading branch information
eranif committed Nov 8, 2015
1 parent aaedcfe commit ad98bd0
Show file tree
Hide file tree
Showing 10 changed files with 568 additions and 159 deletions.
46 changes: 41 additions & 5 deletions CodeLite/cl_config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,25 @@ clConfig::clConfig(const wxString& filename)
} else {
m_root = new JSONRoot(cJSON_Object);
}

// Load the "Recent Items" cache
{
wxArrayString recentFiles;
JSONElement e = m_root->toElement();
if(e.hasNamedObject("RecentWorkspaces")) {
recentFiles = e.namedObject("RecentWorkspaces").toArrayString();
m_cacheRecentItems.insert(std::make_pair("RecentWorkspaces", recentFiles));
}
}

{
wxArrayString recentFiles;
JSONElement e = m_root->toElement();
if(e.hasNamedObject("RecentFiles")) {
recentFiles = e.namedObject("RecentFiles").toArrayString();
m_cacheRecentItems.insert(std::make_pair("RecentFiles", recentFiles));
}
}
}

clConfig::~clConfig() { wxDELETE(m_root); }
Expand Down Expand Up @@ -392,13 +411,28 @@ void clConfig::DoAddRecentItem(const wxString& propName, const wxString& filenam
if(recentItems.Index(filename) != wxNOT_FOUND) {
recentItems.Remove(filename);
}

if(!wxFileName(filename).FileExists()) {
// Don't add non existing file
return;
}

recentItems.Insert(filename, 0);

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

// Remove non existing items
wxArrayString existingFiles;
for(size_t i = 0; i < recentItems.size(); ++i) {
if(wxFileName(recentItems.Item(i)).FileExists()) {
existingFiles.Add(recentItems.Item(i));
}
}
recentItems.swap(existingFiles);

// Remove old node if exists
JSONElement e = m_root->toElement();
if(e.hasNamedObject(propName)) {
Expand All @@ -412,6 +446,7 @@ void clConfig::DoAddRecentItem(const wxString& propName, const wxString& filenam
if(m_cacheRecentItems.count(propName)) {
m_cacheRecentItems.erase(propName);
}

m_cacheRecentItems.insert(std::make_pair(propName, recentItems));
m_root->save(m_filename);
}
Expand All @@ -435,12 +470,13 @@ wxArrayString clConfig::DoGetRecentItems(const wxString& propName) const

// Try the cache first
if(m_cacheRecentItems.count(propName)) {
return m_cacheRecentItems.find(propName)->second;
}
recentItems = m_cacheRecentItems.find(propName)->second;

JSONElement e = m_root->toElement();
if(e.hasNamedObject(propName)) {
recentItems = e.namedObject(propName).toArrayString();
} else {
JSONElement e = m_root->toElement();
if(e.hasNamedObject(propName)) {
recentItems = e.namedObject(propName).toArrayString();
}
}
return recentItems;
}
Expand Down
4 changes: 2 additions & 2 deletions LiteEditor.workspace
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@
<Project Name="WebTools" ConfigName="DebugUnicode"/>
<Project Name="HelpPlugin" ConfigName="Win_x64_Debug"/>
</WorkspaceConfiguration>
<WorkspaceConfiguration Name="CMake_Debug" Selected="yes">
<WorkspaceConfiguration Name="CMake_Debug" Selected="no">
<Project Name="ZoomNavigator" ConfigName="Win_x86_Release"/>
<Project Name="wxsqlite3" ConfigName="Win_x86_Release"/>
<Project Name="wxshapeframework" ConfigName="Win_x86_Release"/>
Expand Down Expand Up @@ -279,7 +279,7 @@
<Project Name="WebTools" ConfigName="DebugUnicode"/>
<Project Name="HelpPlugin" ConfigName="Win_x64_Debug"/>
</WorkspaceConfiguration>
<WorkspaceConfiguration Name="Win_x64_Release" Selected="no">
<WorkspaceConfiguration Name="Win_x64_Release" Selected="yes">
<Project Name="abbreviation" ConfigName="Win_x64_Release"/>
<Project Name="CallGraph" ConfigName="Win_x64_Release"/>
<Project Name="CMakePlugin" ConfigName="Win_x64_Release"/>
Expand Down
4 changes: 2 additions & 2 deletions LiteEditor/WelcomePage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#include "event_notifier.h"
#include "plugin.h"
#include "editor_config.h"
#include "pluginmanager.h"

WelcomePage::WelcomePage(wxWindow* parent)
: WelcomePageBase(parent)
Expand Down Expand Up @@ -107,8 +108,7 @@ void WelcomePage::OnShowWorkspaceMenu(wxCommandEvent& event)
int
WelcomePage::DoGetPopupMenuSelection(wxCommandLinkButton* btn, const wxArrayString& strings, const wxString& menuTitle)
{
BitmapLoader bl;
BitmapLoader::BitmapMap_t bmps = bl.MakeStandardMimeMap();
BitmapLoader::BitmapMap_t bmps = PluginManager::Get()->GetStdIcons()->MakeStandardMimeMap();

m_idToName.clear();
wxUnusedVar(menuTitle);
Expand Down
Binary file modified Runtime/codelite-bitmaps.zip
Binary file not shown.
Binary file modified bitmaps/16-tools.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified bitmaps/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified bitmaps/24-tools.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified bitmaps/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 1 addition & 2 deletions svgs/create-humanity-icons.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,8 @@ public function copy() {
$OnSizeIcons[] = new ImageFile("status\\24\\network-offline.svg", "disconnected.svg");
$OnSizeIcons[] = new ImageFile("status\\24\\network-transmit-receive.svg", "connected.svg");
$OnSizeIcons[] = new ImageFile("apps\\24\\checkbox.svg", "checkbox.svg");
$OnSizeIcons[] = new ImageFile("places\\24\\folder-system.svg", "project.svg");
$OnSizeIcons[] = new ImageFile("status\\24\\media-playlist-repeat.svg", "repeat.svg");
$OnSizeIcons[] = new ImageFile("categories\\24\\applications-utilities.svg", "tools.svg");
$OnSizeIcons[] = new ImageFile("categories\\24\\preferences-other.svg", "tools.svg");

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

0 comments on commit ad98bd0

Please sign in to comment.