2015-04-02 18:00:50 -04:00
|
|
|
#ifndef TYROEDIT_PANE_H
|
|
|
|
#define TYROEDIT_PANE_H
|
|
|
|
|
2015-04-07 17:08:28 -04:00
|
|
|
#include "../wx_common.h"
|
2015-04-14 17:00:48 -04:00
|
|
|
#include "../settings/Config.h"
|
2015-04-10 15:11:15 -04:00
|
|
|
|
|
|
|
#include <wx/stc/stc.h>
|
|
|
|
|
2015-04-02 18:00:50 -04:00
|
|
|
class EditPane: public wxStyledTextCtrl
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
EditPane(
|
2015-04-21 14:07:04 -04:00
|
|
|
wxWindow *parent,
|
2015-04-02 18:00:50 -04:00
|
|
|
wxWindowID id = wxID_ANY,
|
|
|
|
const wxPoint &post = wxDefaultPosition,
|
2015-04-24 16:55:10 -04:00
|
|
|
const wxSize &size = wxDefaultSize
|
2015-04-02 18:00:50 -04:00
|
|
|
);
|
|
|
|
~EditPane();
|
2015-04-17 16:55:48 -04:00
|
|
|
wxFileName fileName;
|
2015-04-16 17:03:27 -04:00
|
|
|
string GetLangByFile();
|
2015-04-17 16:55:48 -04:00
|
|
|
bool Load(wxString filePath);
|
|
|
|
void Highlight(wxString filePath);
|
2015-04-16 17:03:27 -04:00
|
|
|
bool SaveFile();
|
|
|
|
bool SaveFile(const wxString &filename);
|
2015-04-21 14:07:04 -04:00
|
|
|
void ApplyTheme(string lang, string theme="Solarized");
|
2015-04-02 18:00:50 -04:00
|
|
|
private:
|
2015-04-16 11:23:08 -04:00
|
|
|
StringConstMap lexerMap;
|
|
|
|
StringConstMap::iterator lexerMapIt;
|
2015-04-21 09:55:28 -04:00
|
|
|
TyroConfig *lang_config;
|
|
|
|
TyroConfig *theme_config;
|
2015-04-21 14:07:04 -04:00
|
|
|
JsonValue current_theme;
|
2015-04-13 13:01:25 -04:00
|
|
|
enum
|
|
|
|
{
|
2015-04-16 22:07:51 -04:00
|
|
|
MARGIN_FOLD,
|
2015-04-24 16:55:10 -04:00
|
|
|
MARGIN_SYMBOL,
|
2015-04-16 22:07:51 -04:00
|
|
|
MARGIN_LINE_NUMBERS
|
2015-04-13 13:01:25 -04:00
|
|
|
};
|
2015-04-17 16:55:48 -04:00
|
|
|
bool FileReadable();
|
|
|
|
bool FileWritable();
|
2015-04-16 17:03:27 -04:00
|
|
|
void BindEvents();
|
|
|
|
void OnMarginClick(wxStyledTextEvent &event);
|
2015-04-21 14:07:04 -04:00
|
|
|
void SetTheme(string theme_name);
|
|
|
|
JsonValue GetThemeValue(string type, string key);
|
|
|
|
wxColor GetThemeColor(string type, string key);
|
2015-04-21 09:55:28 -04:00
|
|
|
JsonValue GetKeywordList(string lang);
|
2015-04-22 16:57:10 -04:00
|
|
|
void _ApplyTheme(JsonValue lexer_map, int addtoi=0);
|
2015-04-02 18:00:50 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // TYRODOC_FRAME_H
|