From 036c61aa165f291099901d366ecd803add5924d5 Mon Sep 17 00:00:00 2001 From: Eran Date: Thu, 8 Feb 2018 11:53:14 +0200 Subject: [PATCH] Git & Svn Plugins: use the standard character to idicate the change type (M for modified, D for deleted etc) Svn plugin: display the file icon next to its name in the view --- LiteEditor.workspace | 4 +-- Subversion2/subversion2.wxcp | 6 ++--- Subversion2/subversion2_ui.cpp | 6 ++--- Subversion2/subversion_view.cpp | 43 ++++++++++++++++++--------------- Subversion2/subversion_view.h | 6 +++-- git/GitConsole.cpp | 2 +- git/gitui.cpp | 4 +-- git/gitui.wxcp | 4 +-- 8 files changed, 41 insertions(+), 34 deletions(-) diff --git a/LiteEditor.workspace b/LiteEditor.workspace index fa152b264f..184c24b4c5 100644 --- a/LiteEditor.workspace +++ b/LiteEditor.workspace @@ -137,7 +137,7 @@ - + @@ -196,7 +196,7 @@ - + diff --git a/Subversion2/subversion2.wxcp b/Subversion2/subversion2.wxcp index 492352c619..2771fb2aaf 100644 --- a/Subversion2/subversion2.wxcp +++ b/Subversion2/subversion2.wxcp @@ -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", @@ -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", @@ -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", diff --git a/Subversion2/subversion2_ui.cpp b/Subversion2/subversion2_ui.cpp index 929fef4201..079c0e90e1 100644 --- a/Subversion2/subversion2_ui.cpp +++ b/Subversion2/subversion2_ui.cpp @@ -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); diff --git a/Subversion2/subversion_view.cpp b/Subversion2/subversion_view.cpp index 021558bf76..f312bf2d13 100644 --- a/Subversion2/subversion_view.cpp +++ b/Subversion2/subversion_view.cpp @@ -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), @@ -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 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)); }); } diff --git a/Subversion2/subversion_view.h b/Subversion2/subversion_view.h index 03e5c1c462..4f1523543c 100644 --- a/Subversion2/subversion_view.h +++ b/Subversion2/subversion_view.h @@ -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; @@ -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 }; @@ -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); diff --git a/git/GitConsole.cpp b/git/GitConsole.cpp index 1929cb4079..192e3943e7 100644 --- a/git/GitConsole.cpp +++ b/git/GitConsole.cpp @@ -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)); } diff --git a/git/gitui.cpp b/git/gitui.cpp index dab3c90cfa..383cf3a830 100644 --- a/git/gitui.cpp +++ b/git/gitui.cpp @@ -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); diff --git a/git/gitui.wxcp b/git/gitui.wxcp index 1ad04f54ae..ed819a02e4 100644 --- a/git/gitui.wxcp +++ b/git/gitui.wxcp @@ -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", @@ -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",