From 564640cac2b03f147735e6649a28744d8e54168b Mon Sep 17 00:00:00 2001 From: Timothy Warren Date: Fri, 10 May 2019 16:35:09 -0400 Subject: [PATCH] Select files from sidebar! --- Makefile | 3 ++- src/base/SFTP.h | 7 ------- src/widgets/FilePane.cpp | 19 +++++++++++++------ 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/Makefile b/Makefile index 294adc5..5aa13ae 100644 --- a/Makefile +++ b/Makefile @@ -16,8 +16,9 @@ dev: all build: @mkdir -p build + ./cmake.sh Tyro -run: +run: build ifneq ($(OS),Darwin) ./$(PROGRAM) else diff --git a/src/base/SFTP.h b/src/base/SFTP.h index ecf23cc..e40c73d 100644 --- a/src/base/SFTP.h +++ b/src/base/SFTP.h @@ -1,10 +1,3 @@ -/** - * File: SFTP.h - * Author: twarren - * - * Created on April 6, 2015, 2:22 PM - */ - #pragma once #include "src/common.h" diff --git a/src/widgets/FilePane.cpp b/src/widgets/FilePane.cpp index ba8ee07..9c21364 100644 --- a/src/widgets/FilePane.cpp +++ b/src/widgets/FilePane.cpp @@ -1,4 +1,7 @@ #include "src/widgets/FilePane.h" +#include "src/widgets/MainFrame.h" + +extern MainFrame *Glob_main_frame; enum { @@ -16,6 +19,7 @@ FilePane::FilePane( const wxString &name ) : wxTreeListCtrl(parent, id, pos, size, style, name) { + this->BindEvents(); this->InitImageList(); this->SetImageList(this->img_list); @@ -92,16 +96,16 @@ void FilePane::CreateTree(const wxString &path, wxTreeListItem &root, int level) } // Remove the directory component closest to the root - filename.RemoveDir(0); + /* filename.RemoveDir(0); wxArrayString folders = filename.GetDirs(); - wxLogDebug(item); - wxTreeListItem newRootNode = root; for (const wxString &curr_folder: folders) { + wxLogDebug(curr_folder); + // Check if directory has already been created it = find(examined.begin(), examined.end(), curr_folder); @@ -122,7 +126,7 @@ void FilePane::CreateTree(const wxString &path, wxTreeListItem &root, int level) newRootNode = current; this->CreateTree(curr_folder, root); - } + } */ } } @@ -134,9 +138,12 @@ void FilePane::CreateTree(const wxString &path, wxTreeListItem &root, int level) void FilePane::OpenFileInEditor(wxTreeListEvent& event) { wxTreeListItem item = event.GetItem(); - auto path = this->GetItemText(item, 0); + auto data = (wxStringClientData*)this->GetItemData(item); + const wxString& path = data->GetData(); - wxLogMessage(path); + wxString path_arr [1] = { path }; + auto files = wxArrayString(1, *path_arr); + Glob_main_frame->OpenFiles(files); } /**