Skip to content

Commit

Permalink
Git & Svn Plugins: use the standard character to idicate the change t…
Browse files Browse the repository at this point in the history
…ype (M for modified, D for deleted etc)

Svn plugin: display the file icon next to its name in the view
  • Loading branch information
eranif committed Feb 8, 2018
1 parent d9fcf13 commit 036c61a
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 34 deletions.
4 changes: 2 additions & 2 deletions LiteEditor.workspace
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@
<Project Name="SampleWorksapce" ConfigName="Debug"/>
<Project Name="SmartCompletion" ConfigName="Win_x64_Debug"/>
</WorkspaceConfiguration>
<WorkspaceConfiguration Name="CMake_Release" Selected="no">
<WorkspaceConfiguration Name="CMake_Release" Selected="yes">
<Environment/>
<Project Name="ZoomNavigator" ConfigName="DebugUnicode"/>
<Project Name="wxsqlite3" ConfigName="Win_x86_Release"/>
Expand Down Expand Up @@ -196,7 +196,7 @@
<Project Name="SampleWorksapce" ConfigName="Debug"/>
<Project Name="SmartCompletion" ConfigName="Win_x64_Debug"/>
</WorkspaceConfiguration>
<WorkspaceConfiguration Name="CMake_Debug" Selected="yes">
<WorkspaceConfiguration Name="CMake_Debug" Selected="no">
<Environment/>
<Project Name="AutoSave" ConfigName="Win_x64_Debug"/>
<Project Name="CCTest" ConfigName="CMake_Debug"/>
Expand Down
6 changes: 3 additions & 3 deletions Subversion2/subversion2.wxcp
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@
"border": 2,
"gbSpan": "1,1",
"gbPosition": "0,0",
"m_styles": ["wxDV_ROW_LINES", "wxDV_MULTIPLE", "wxDV_SINGLE"],
"m_styles": ["wxDV_VERT_RULES", "wxDV_HORIZ_RULES", "wxDV_MULTIPLE"],
"m_sizerFlags": ["wxALL", "wxLEFT", "wxRIGHT", "wxTOP", "wxBOTTOM", "wxEXPAND"],
"m_properties": [{
"type": "winid",
Expand Down Expand Up @@ -409,7 +409,7 @@
}, {
"type": "choice",
"m_label": "Column Type",
"m_selection": 0,
"m_selection": 2,
"m_options": ["bitmap", "check", "text", "icontext", "progress", "choice"]
}, {
"type": "multi-string",
Expand Down Expand Up @@ -451,7 +451,7 @@
}, {
"type": "choice",
"m_label": "Column Type",
"m_selection": 2,
"m_selection": 3,
"m_options": ["bitmap", "check", "text", "icontext", "progress", "choice"]
}, {
"type": "multi-string",
Expand Down
6 changes: 3 additions & 3 deletions Subversion2/subversion2_ui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ SubversionPageBase::SubversionPageBase(wxWindow* parent, wxWindowID id, const wx
wxBoxSizer* boxSizer27 = new wxBoxSizer(wxVERTICAL);
m_splitterPageLeft->SetSizer(boxSizer27);

m_dvListCtrl = new wxDataViewListCtrl(m_splitterPageLeft, wxID_ANY, wxDefaultPosition, wxDLG_UNIT(m_splitterPageLeft, wxSize(-1,-1)), wxDV_ROW_LINES|wxDV_MULTIPLE|wxDV_SINGLE);
m_dvListCtrl = new wxDataViewListCtrl(m_splitterPageLeft, wxID_ANY, wxDefaultPosition, wxDLG_UNIT(m_splitterPageLeft, wxSize(-1,-1)), wxDV_VERT_RULES|wxDV_HORIZ_RULES|wxDV_MULTIPLE);

boxSizer27->Add(m_dvListCtrl, 1, wxALL|wxEXPAND, WXC_FROM_DIP(2));

m_dvListCtrl->AppendBitmapColumn(_("?"), m_dvListCtrl->GetColumnCount(), wxDATAVIEW_CELL_INERT, WXC_FROM_DIP(32), wxALIGN_LEFT, wxDATAVIEW_COL_RESIZABLE);
m_dvListCtrl->AppendTextColumn(_("File"), wxDATAVIEW_CELL_INERT, WXC_FROM_DIP(-2), wxALIGN_LEFT, wxDATAVIEW_COL_RESIZABLE);
m_dvListCtrl->AppendTextColumn(_("?"), wxDATAVIEW_CELL_INERT, WXC_FROM_DIP(32), wxALIGN_LEFT, wxDATAVIEW_COL_RESIZABLE);
m_dvListCtrl->AppendIconTextColumn(_("File"), wxDATAVIEW_CELL_INERT, WXC_FROM_DIP(-2), wxALIGN_LEFT, wxDATAVIEW_COL_RESIZABLE);
m_splitterPageRight = new wxPanel(m_splitter17, wxID_ANY, wxDefaultPosition, wxDLG_UNIT(m_splitter17, wxSize(-1,-1)), wxTAB_TRAVERSAL);
m_splitter17->SplitVertically(m_splitterPageLeft, m_splitterPageRight, 0);

Expand Down
43 changes: 24 additions & 19 deletions Subversion2/subversion_view.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,9 @@ SubversionView::SubversionView(wxWindow* parent, Subversion2* plugin)
, m_fileExplorerLastBaseImgIdx(-1)
, m_codeliteEcho(NULL)
{
BitmapLoader *bmpLoader = clGetManager()->GetStdIcons();
m_standardBitmaps = bmpLoader->MakeStandardMimeMap();

CreatGUIControls();
m_themeHelper = new ThemeHandlerHelper(this);
EventNotifier::Get()->Connect(wxEVT_WORKSPACE_LOADED, wxCommandEventHandler(SubversionView::OnWorkspaceLoaded),
Expand Down Expand Up @@ -368,31 +371,33 @@ void SubversionView::UpdateTree(const wxArrayString& modifiedFiles, const wxArra
wxWindowUpdateLocker locker(m_dvListCtrl);
ClearAll();

BitmapLoader* bmpLoader = clGetManager()->GetStdIcons();
wxBitmap modifiedBmp = bmpLoader->LoadBitmap(wxT("modified"));
wxBitmap newBmp = bmpLoader->LoadBitmap(wxT("plus"));
wxBitmap deletedBmp = bmpLoader->LoadBitmap(wxT("minus"));
wxBitmap conflictBmp = bmpLoader->LoadBitmap(wxT("warning"));
wxBitmap lockedBmp = bmpLoader->LoadBitmap(wxT("lock"));

DoAddNode(modifiedBmp, modifiedFiles);
DoAddNode(newBmp, newFiles);
DoAddNode(deletedBmp, deletedFiles);
DoAddNode(conflictBmp, conflictedFiles);
DoAddNode(lockedBmp, lockedFiles);
// DoAddNode(svnUNVERSIONED_FILES, UNVERSIONED_IMG_ID, SvnTreeData::SvnNodeTypeUnversionedRoot,
// unversionedFiles);

// DoLinkEditor();
//BitmapLoader* bmpLoader = clGetManager()->GetStdIcons();
//wxBitmap modifiedBmp = bmpLoader->LoadBitmap(wxT("modified"));
//wxBitmap newBmp = bmpLoader->LoadBitmap(wxT("plus"));
//wxBitmap deletedBmp = bmpLoader->LoadBitmap(wxT("minus"));
//wxBitmap conflictBmp = bmpLoader->LoadBitmap(wxT("warning"));
//wxBitmap lockedBmp = bmpLoader->LoadBitmap(wxT("lock"));

DoAddNode("M", modifiedFiles);
DoAddNode("A", newFiles);
DoAddNode("D", deletedFiles);
DoAddNode("C", conflictedFiles);
DoAddNode("L", lockedFiles);
//DoLinkEditor();
}
}

void SubversionView::DoAddNode(const wxBitmap& bmp, const wxArrayString& files)
void SubversionView::DoAddNode(const wxString& status, const wxArrayString& files)
{
std::for_each(files.begin(), files.end(), [&](const wxString& filepath) {
FileExtManager::FileType type = FileExtManager::GetType(filepath, FileExtManager::TypeText);
wxBitmap bmp = m_standardBitmaps[FileExtManager::TypeText];
if(m_standardBitmaps.count(type)) {
bmp = m_standardBitmaps[type];
}
wxVector<wxVariant> cols;
cols.push_back(wxVariant(bmp));
cols.push_back(filepath);
cols.push_back(status);
cols.push_back(::MakeIconText(filepath, bmp));
m_dvListCtrl->AppendItem(cols, (wxUIntPtr) new SvnTreeData(SvnTreeData::SvnNodeTypeFile, filepath));
});
}
Expand Down
6 changes: 4 additions & 2 deletions Subversion2/subversion_view.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ Subclass of SubversionPageBase, which is generated by wxFormBuilder.
#include "svninfo.h"
#include "svntreedata.h"
#include "theme_handler_helper.h"
#include "bitmap_loader.h"

class Subversion2;
class wxMenu;
Expand Down Expand Up @@ -77,7 +78,8 @@ class SubversionView : public SubversionPageBase
ThemeHandlerHelper* m_themeHelper;
wxFileName m_workspaceFile;
IProcess* m_codeliteEcho;

BitmapLoader::BitmapMap_t m_standardBitmaps;

public:
enum { SvnInfo_Tag, SvnInfo_Branch, SvnInfo_Info };

Expand All @@ -97,7 +99,7 @@ class SubversionView : public SubversionPageBase
virtual void OnUpdateUI(wxStyledTextEvent& event);
void CreatGUIControls();
void ClearAll();
void DoAddNode(const wxBitmap& bmp, const wxArrayString& files);
void DoAddNode(const wxString& status, const wxArrayString& files);
int DoGetIconIndex(const wxString& filename);
void DoGetSelectedFiles(wxArrayString& paths);
void DoGetAllFiles(wxArrayString& paths);
Expand Down
2 changes: 1 addition & 1 deletion git/GitConsole.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ void GitConsole::UpdateTreeView(const wxString& output)

if(kind != eGitFile::kUntrackedFile) {
cols.clear();
cols.push_back(wxVariant(statusBmp));
cols.push_back(wxString() << chX);
cols.push_back(MakeIconText(filename, bmp));
m_dvListCtrl->AppendItem(cols, (wxUIntPtr) new GitClientData(filenameFullpath, kind));
}
Expand Down
4 changes: 2 additions & 2 deletions git/gitui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2139,11 +2139,11 @@ GitConsoleBase::GitConsoleBase(wxWindow* parent, wxWindowID id, const wxPoint& p
wxBoxSizer* boxSizer94 = new wxBoxSizer(wxVERTICAL);
m_splitterPageTreeView->SetSizer(boxSizer94);

m_dvListCtrl = new wxDataViewListCtrl(m_splitterPageTreeView, wxID_ANY, wxDefaultPosition, wxDLG_UNIT(m_splitterPageTreeView, wxSize(-1,-1)), wxDV_ROW_LINES|wxDV_MULTIPLE);
m_dvListCtrl = new wxDataViewListCtrl(m_splitterPageTreeView, wxID_ANY, wxDefaultPosition, wxDLG_UNIT(m_splitterPageTreeView, wxSize(-1,-1)), wxDV_VERT_RULES|wxDV_HORIZ_RULES|wxDV_MULTIPLE);

boxSizer94->Add(m_dvListCtrl, 1, wxALL|wxEXPAND, WXC_FROM_DIP(2));

m_dvListCtrl->AppendBitmapColumn(_("?"), m_dvListCtrl->GetColumnCount(), wxDATAVIEW_CELL_INERT, WXC_FROM_DIP(48), wxALIGN_LEFT, wxDATAVIEW_COL_RESIZABLE);
m_dvListCtrl->AppendTextColumn(_("?"), wxDATAVIEW_CELL_INERT, WXC_FROM_DIP(48), wxALIGN_LEFT, wxDATAVIEW_COL_RESIZABLE);
m_dvListCtrl->AppendIconTextColumn(_("File"), wxDATAVIEW_CELL_INERT, WXC_FROM_DIP(-2), wxALIGN_LEFT, wxDATAVIEW_COL_RESIZABLE);
m_splitterPage96 = new wxPanel(m_splitter, wxID_ANY, wxDefaultPosition, wxDLG_UNIT(m_splitter, wxSize(-1,-1)), wxTAB_TRAVERSAL);
m_splitter->SplitVertically(m_splitterPageTreeView, m_splitterPage96, 250);
Expand Down
4 changes: 2 additions & 2 deletions git/gitui.wxcp
Original file line number Diff line number Diff line change
Expand Up @@ -12418,7 +12418,7 @@
"border": 2,
"gbSpan": "1,1",
"gbPosition": "0,0",
"m_styles": ["wxDV_ROW_LINES", "wxDV_MULTIPLE"],
"m_styles": ["wxDV_VERT_RULES", "wxDV_HORIZ_RULES", "wxDV_MULTIPLE"],
"m_sizerFlags": ["wxALL", "wxLEFT", "wxRIGHT", "wxTOP", "wxBOTTOM", "wxEXPAND"],
"m_properties": [{
"type": "winid",
Expand Down Expand Up @@ -12518,7 +12518,7 @@
}, {
"type": "choice",
"m_label": "Column Type",
"m_selection": 0,
"m_selection": 2,
"m_options": ["bitmap", "check", "text", "icontext", "progress", "choice"]
}, {
"type": "multi-string",
Expand Down

0 comments on commit 036c61a

Please sign in to comment.