Select files from sidebar!

This commit is contained in:
Timothy Warren 2019-05-10 16:35:09 -04:00
parent 45cc064ec8
commit 564640cac2
3 changed files with 15 additions and 14 deletions

View File

@ -16,8 +16,9 @@ dev: all
build: build:
@mkdir -p build @mkdir -p build
./cmake.sh Tyro
run: run: build
ifneq ($(OS),Darwin) ifneq ($(OS),Darwin)
./$(PROGRAM) ./$(PROGRAM)
else else

View File

@ -1,10 +1,3 @@
/**
* File: SFTP.h
* Author: twarren
*
* Created on April 6, 2015, 2:22 PM
*/
#pragma once #pragma once
#include "src/common.h" #include "src/common.h"

View File

@ -1,4 +1,7 @@
#include "src/widgets/FilePane.h" #include "src/widgets/FilePane.h"
#include "src/widgets/MainFrame.h"
extern MainFrame *Glob_main_frame;
enum enum
{ {
@ -16,6 +19,7 @@ FilePane::FilePane(
const wxString &name const wxString &name
) : wxTreeListCtrl(parent, id, pos, size, style, name) ) : wxTreeListCtrl(parent, id, pos, size, style, name)
{ {
this->BindEvents();
this->InitImageList(); this->InitImageList();
this->SetImageList(this->img_list); 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 // Remove the directory component closest to the root
filename.RemoveDir(0); /* filename.RemoveDir(0);
wxArrayString folders = filename.GetDirs(); wxArrayString folders = filename.GetDirs();
wxLogDebug(item);
wxTreeListItem newRootNode = root; wxTreeListItem newRootNode = root;
for (const wxString &curr_folder: folders) for (const wxString &curr_folder: folders)
{ {
wxLogDebug(curr_folder);
// Check if directory has already been created // Check if directory has already been created
it = find(examined.begin(), examined.end(), curr_folder); it = find(examined.begin(), examined.end(), curr_folder);
@ -122,7 +126,7 @@ void FilePane::CreateTree(const wxString &path, wxTreeListItem &root, int level)
newRootNode = current; newRootNode = current;
this->CreateTree(curr_folder, root); this->CreateTree(curr_folder, root);
} } */
} }
} }
@ -134,9 +138,12 @@ void FilePane::CreateTree(const wxString &path, wxTreeListItem &root, int level)
void FilePane::OpenFileInEditor(wxTreeListEvent& event) void FilePane::OpenFileInEditor(wxTreeListEvent& event)
{ {
wxTreeListItem item = event.GetItem(); 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);
} }
/** /**