Ugly progress commit
This commit is contained in:
parent
d774f08e71
commit
45cc064ec8
@ -141,7 +141,7 @@
|
|||||||
},
|
},
|
||||||
"lisp": {
|
"lisp": {
|
||||||
"name": "Lisp",
|
"name": "Lisp",
|
||||||
"file_pattern": "*.lsp;*.lisp",
|
"file_pattern": "*.lsp;*.lisp;*.scm",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"not defun + - * / = < > <= >= princ eval apply funcall quote identity function complement backquote lambda set setq setf defun defmacro gensym make symbol intern symbol name symbol value symbol plist get getf putprop remprop hash make array aref car cdr caar cadr cdar cddr caaar caadr cadar caddr cdaar cdadr cddar cdddr caaaar caaadr caadar caaddr cadaar cadadr caddar cadddr cdaaar cdaadr cdadar cdaddr cddaar cddadr cdddar cddddr cons list append reverse last nth nthcdr member assoc subst sublis nsubst nsublis remove length list length mapc mapcar mapl maplist mapcan mapcon rplaca rplacd nconc delete atom symbolp numberp boundp null listp consp minusp zerop plusp evenp oddp eq eql equal cond case and or let l if prog prog1 prog2 progn go return do dolist dotimes catch throw error cerror break continue errset baktrace evalhook truncate float rem min max abs sin cos tan expt exp sqrt random logand logior logxor lognot bignums logeqv lognand lognor logorc2 logtest logbitp logcount integer length nil"
|
"not defun + - * / = < > <= >= princ eval apply funcall quote identity function complement backquote lambda set setq setf defun defmacro gensym make symbol intern symbol name symbol value symbol plist get getf putprop remprop hash make array aref car cdr caar cadr cdar cddr caaar caadr cadar caddr cdaar cdadr cddar cdddr caaaar caaadr caadar caaddr cadaar cadadr caddar cadddr cdaaar cdaadr cdadar cdaddr cddaar cddadr cdddar cddddr cons list append reverse last nth nthcdr member assoc subst sublis nsubst nsublis remove length list length mapc mapcar mapl maplist mapcan mapcon rplaca rplacd nconc delete atom symbolp numberp boundp null listp consp minusp zerop plusp evenp oddp eq eql equal cond case and or let l if prog prog1 prog2 progn go return do dolist dotimes catch throw error cerror break continue errset baktrace evalhook truncate float rem min max abs sin cos tan expt exp sqrt random logand logior logxor lognot bignums logeqv lognand lognor logorc2 logtest logbitp logcount integer length nil"
|
||||||
],
|
],
|
||||||
|
@ -51,7 +51,7 @@ public:
|
|||||||
this->InitLexerMap();
|
this->InitLexerMap();
|
||||||
Glob_config = wxConfigBase::Get();
|
Glob_config = wxConfigBase::Get();
|
||||||
Glob_menu_bar = new TyroMenu();
|
Glob_menu_bar = new TyroMenu();
|
||||||
Glob_main_frame = new MainFrame(0L, APP_NAME, this->CalculateWindowSize());
|
Glob_main_frame = new MainFrame(nullptr, APP_NAME, this->CalculateWindowSize());
|
||||||
#ifndef TRAVIS
|
#ifndef TRAVIS
|
||||||
Glob_pref_pane = new PrefPane();
|
Glob_pref_pane = new PrefPane();
|
||||||
#endif
|
#endif
|
||||||
@ -80,7 +80,7 @@ public:
|
|||||||
int OnExit()
|
int OnExit()
|
||||||
{
|
{
|
||||||
// Deallocate config object
|
// Deallocate config object
|
||||||
delete wxConfigBase::Set((wxConfigBase *) NULL);
|
delete wxConfigBase::Set((wxConfigBase *) nullptr);
|
||||||
|
|
||||||
return close(true);
|
return close(true);
|
||||||
}
|
}
|
||||||
|
@ -97,7 +97,7 @@ void EditPane::ApplyTheme(string lang, string theme)
|
|||||||
this->SetLexer(wxSTC_LEX_NULL);
|
this->SetLexer(wxSTC_LEX_NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (theme != "")
|
if ( ! theme.empty())
|
||||||
{
|
{
|
||||||
theme_config->SetTheme(theme);
|
theme_config->SetTheme(theme);
|
||||||
}
|
}
|
||||||
@ -115,7 +115,7 @@ void EditPane::ApplyTheme(string lang, string theme)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (lang != "")
|
if ( ! lang.empty())
|
||||||
{
|
{
|
||||||
string typeMap[] = {"null", "int", "unsigned int", "double", "string", "boolean", "array", "object"};
|
string typeMap[] = {"null", "int", "unsigned int", "double", "string", "boolean", "array", "object"};
|
||||||
stringstream output;
|
stringstream output;
|
||||||
@ -272,7 +272,7 @@ void EditPane::BindEvents()
|
|||||||
}
|
}
|
||||||
}, wxID_ANY);
|
}, wxID_ANY);
|
||||||
|
|
||||||
this->Bind(wxEVT_STC_CHARADDED, &EditPane::OnCharAdded, this, wxID_ANY);
|
// this->Bind(wxEVT_STC_CHARADDED, &EditPane::OnCharAdded, this, wxID_ANY);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -316,14 +316,14 @@ void EditPane::_ApplyTheme(JsonValue &lexer_map)
|
|||||||
wxFONTFLAG_ANTIALIASED
|
wxFONTFLAG_ANTIALIASED
|
||||||
);
|
);
|
||||||
|
|
||||||
static const wxColor default_background = theme_config->GetThemeColor("background", "default");
|
static const wxColor default_background = this->theme_config->GetThemeColor("background", "default");
|
||||||
static const wxColor default_foreground = theme_config->GetThemeColor("foreground", "default");
|
static const wxColor default_foreground = this->theme_config->GetThemeColor("foreground", "default");
|
||||||
wxColor line_number_background = ( ! theme_config->GetThemeValue("line_numbers", "background").isNull())
|
wxColor line_number_background = ( ! this->theme_config->GetThemeValue("line_numbers", "background").isNull())
|
||||||
? (theme_config->GetThemeColor("line_numbers", "background"))
|
? (this->theme_config->GetThemeColor("line_numbers", "background"))
|
||||||
: default_background;
|
: default_background;
|
||||||
|
|
||||||
wxColor line_number_foreground = ( ! theme_config->GetThemeValue("line_numbers", "foreground").isNull())
|
wxColor line_number_foreground = ( ! this->theme_config->GetThemeValue("line_numbers", "foreground").isNull())
|
||||||
? (theme_config->GetThemeColor("line_numbers", "foreground"))
|
? (this->theme_config->GetThemeColor("line_numbers", "foreground"))
|
||||||
: default_foreground;
|
: default_foreground;
|
||||||
|
|
||||||
// Set default colors/ fonts
|
// Set default colors/ fonts
|
||||||
@ -452,7 +452,7 @@ void EditPane::_ApplyTheme(JsonValue &lexer_map)
|
|||||||
*/
|
*/
|
||||||
string EditPane::GetCurrentLang()
|
string EditPane::GetCurrentLang()
|
||||||
{
|
{
|
||||||
return lang_config->GetCurrentLangName();
|
return this->lang_config->GetCurrentLangName();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -464,8 +464,8 @@ string EditPane::GetCurrentLang()
|
|||||||
void EditPane::SetCurrentLang(string name)
|
void EditPane::SetCurrentLang(string name)
|
||||||
{
|
{
|
||||||
// Update the current lang in the config
|
// Update the current lang in the config
|
||||||
string langKey = lang_config->GetLangByName(name);
|
string langKey = this->lang_config->GetLangByName(name);
|
||||||
lang_config->SetLang(langKey);
|
this->lang_config->SetLang(langKey);
|
||||||
|
|
||||||
// Re-highlight the page with the new langauge
|
// Re-highlight the page with the new langauge
|
||||||
this->ApplyTheme(langKey);
|
this->ApplyTheme(langKey);
|
||||||
|
@ -20,8 +20,8 @@ FilePane::FilePane(
|
|||||||
this->SetImageList(this->img_list);
|
this->SetImageList(this->img_list);
|
||||||
|
|
||||||
wxString defaultPath(".");
|
wxString defaultPath(".");
|
||||||
wxFileName fname(defaultPath);
|
wxFileName filename(defaultPath);
|
||||||
fname.MakeAbsolute(defaultPath);
|
filename.MakeAbsolute(defaultPath);
|
||||||
wxTreeListItem root = this->GetRootItem();
|
wxTreeListItem root = this->GetRootItem();
|
||||||
this->CreateTree(defaultPath, root);
|
this->CreateTree(defaultPath, root);
|
||||||
|
|
||||||
@ -41,6 +41,7 @@ FilePane::~FilePane()
|
|||||||
void FilePane::BindEvents()
|
void FilePane::BindEvents()
|
||||||
{
|
{
|
||||||
this->Bind(wxEVT_TREELIST_ITEM_EXPANDING, &FilePane::OpenFolder, this, wxID_ANY);
|
this->Bind(wxEVT_TREELIST_ITEM_EXPANDING, &FilePane::OpenFolder, this, wxID_ANY);
|
||||||
|
this->Bind(wxEVT_TREELIST_ITEM_ACTIVATED, &FilePane::OpenFileInEditor, this, wxID_ANY);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FilePane::OpenFolder(wxTreeListEvent& event)
|
void FilePane::OpenFolder(wxTreeListEvent& event)
|
||||||
@ -59,39 +60,68 @@ void FilePane::OpenFolder(wxTreeListEvent& event)
|
|||||||
* @param wxString &path
|
* @param wxString &path
|
||||||
* @param wxTreeListItem &root
|
* @param wxTreeListItem &root
|
||||||
*/
|
*/
|
||||||
void FilePane::CreateTree(const wxString &path, wxTreeListItem &root)
|
void FilePane::CreateTree(const wxString &path, wxTreeListItem &root, int level)
|
||||||
{
|
{
|
||||||
wxArrayString *files = new wxArrayString();
|
// So yeah, this doesn't really work right.
|
||||||
|
// It seems I need to create a tree from the list of file paths,
|
||||||
|
// after which this should be much simpler.
|
||||||
|
// @TODO Fix
|
||||||
|
|
||||||
|
auto *files = new wxArrayString();
|
||||||
wxDir::GetAllFiles(path, files);
|
wxDir::GetAllFiles(path, files);
|
||||||
|
|
||||||
vector<wxString> examined;
|
vector<wxString> examined;
|
||||||
vector<wxString>::iterator it;
|
vector<wxString>::iterator it;
|
||||||
|
|
||||||
for (wxString filename : *files)
|
for (const wxString &item : *files)
|
||||||
{
|
{
|
||||||
wxFileName fname(filename);
|
wxFileName filename(item);
|
||||||
|
|
||||||
// For loose files, just add directly to the tree
|
// For loose files, just add directly to the tree
|
||||||
if (fname.GetDirCount() == 1)
|
if (filename.GetDirCount() == 1)
|
||||||
{
|
{
|
||||||
this->AppendItem(root, fname.GetFullName(), Icon_File, Icon_File);
|
auto fullFileName = filename.GetFullPath();
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
fname.RemoveDir(0);
|
|
||||||
wxArrayString folders = fname.GetDirs();
|
|
||||||
wxString curr_folder = folders[0];
|
|
||||||
|
|
||||||
|
auto fileData = new wxStringClientData();
|
||||||
|
fileData->SetData(fullFileName);
|
||||||
|
|
||||||
|
examined.push_back(fullFileName);
|
||||||
|
|
||||||
|
this->AppendItem(root, filename.GetFullName(), Icon_File, Icon_File, fileData);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Remove the directory component closest to the root
|
||||||
|
filename.RemoveDir(0);
|
||||||
|
|
||||||
|
wxArrayString folders = filename.GetDirs();
|
||||||
|
|
||||||
|
wxLogDebug(item);
|
||||||
|
|
||||||
|
wxTreeListItem newRootNode = root;
|
||||||
|
|
||||||
|
for (const wxString &curr_folder: folders)
|
||||||
|
{
|
||||||
|
// Check if directory has already been created
|
||||||
it = find(examined.begin(), examined.end(), curr_folder);
|
it = find(examined.begin(), examined.end(), curr_folder);
|
||||||
|
|
||||||
// If the directory already exists, continue;
|
|
||||||
if (it != examined.end()) continue;
|
if (it != examined.end()) continue;
|
||||||
|
|
||||||
wxTreeListItem current = this->AppendItem(root, curr_folder, Icon_FolderClosed, Icon_FolderOpened);
|
// Create the directory node if it doesn't exist
|
||||||
|
auto fileData = new wxStringClientData();
|
||||||
|
fileData->SetData(curr_folder);
|
||||||
|
|
||||||
|
wxTreeListItem current = this->AppendItem(
|
||||||
|
newRootNode,
|
||||||
|
curr_folder,
|
||||||
|
Icon_FolderClosed,
|
||||||
|
Icon_FolderOpened,
|
||||||
|
fileData);
|
||||||
examined.push_back(curr_folder);
|
examined.push_back(curr_folder);
|
||||||
|
|
||||||
// Recurse to create sub dirs
|
newRootNode = current;
|
||||||
this->CreateTree(fname.GetPath(), current);
|
|
||||||
|
this->CreateTree(curr_folder, root);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -101,6 +131,14 @@ void FilePane::CreateTree(const wxString &path, wxTreeListItem &root)
|
|||||||
|
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
|
void FilePane::OpenFileInEditor(wxTreeListEvent& event)
|
||||||
|
{
|
||||||
|
wxTreeListItem item = event.GetItem();
|
||||||
|
auto path = this->GetItemText(item, 0);
|
||||||
|
|
||||||
|
wxLogMessage(path);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create the image list object for the file pane widget
|
* Create the image list object for the file pane widget
|
||||||
*/
|
*/
|
||||||
@ -122,10 +160,10 @@ void FilePane::InitImageList()
|
|||||||
wxART_FOLDER_OPEN
|
wxART_FOLDER_OPEN
|
||||||
};
|
};
|
||||||
|
|
||||||
for (unsigned n = 0; n < WXSIZEOF(icons); n++)
|
for (auto icon : icons)
|
||||||
{
|
{
|
||||||
this->img_list->Add(
|
this->img_list->Add(
|
||||||
wxArtProvider::GetIcon(icons[n], wxART_LIST, iconSize)
|
wxArtProvider::GetIcon(icon, wxART_LIST, iconSize)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
class FilePane : public wxTreeListCtrl {
|
class FilePane : public wxTreeListCtrl {
|
||||||
public:
|
public:
|
||||||
FilePane(
|
explicit FilePane(
|
||||||
wxWindow *parent,
|
wxWindow *parent,
|
||||||
wxWindowID id=wxID_ANY,
|
wxWindowID id=wxID_ANY,
|
||||||
const wxPoint &pos=wxDefaultPosition,
|
const wxPoint &pos=wxDefaultPosition,
|
||||||
@ -12,13 +12,14 @@ public:
|
|||||||
long style=wxTL_DEFAULT_STYLE,
|
long style=wxTL_DEFAULT_STYLE,
|
||||||
const wxString &name=wxTreeListCtrlNameStr
|
const wxString &name=wxTreeListCtrlNameStr
|
||||||
);
|
);
|
||||||
~FilePane();
|
~FilePane() override;
|
||||||
private:
|
private:
|
||||||
wxString curr_path = "";
|
wxString curr_path = "";
|
||||||
wxImageList *img_list = nullptr;
|
wxImageList *img_list = nullptr;
|
||||||
void BindEvents();
|
void BindEvents();
|
||||||
void OpenFolder(wxTreeListEvent& event);
|
void OpenFolder(wxTreeListEvent& event);
|
||||||
|
void OpenFileInEditor(wxTreeListEvent& event);
|
||||||
void InitImageList();
|
void InitImageList();
|
||||||
void CreateTree(const wxString &path, wxTreeListItem &root);
|
void CreateTree(const wxString &path, wxTreeListItem &root, int level = 0);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -475,7 +475,7 @@ void MainFrame::OnAbout(wxCommandEvent &WXUNUSED(event))
|
|||||||
|
|
||||||
info.SetDescription(desc);
|
info.SetDescription(desc);
|
||||||
|
|
||||||
info.SetCopyright(" (C) 2015");
|
info.SetCopyright(" (C) 2015-2019");
|
||||||
|
|
||||||
wxAboutBox(info);
|
wxAboutBox(info);
|
||||||
}
|
}
|
||||||
|
@ -88,7 +88,7 @@ void TyroMenu::SetupLangMenu()
|
|||||||
{
|
{
|
||||||
StringMap languages = lang_config->GetLangList();
|
StringMap languages = lang_config->GetLangList();
|
||||||
|
|
||||||
for (auto lang: languages)
|
for (const auto lang: languages)
|
||||||
{
|
{
|
||||||
langMenu->Append(wxID_ANY, lang.second, "Highlight file as " + lang.second, wxITEM_RADIO);
|
langMenu->Append(wxID_ANY, lang.second, "Highlight file as " + lang.second, wxITEM_RADIO);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user