Add a few more toolbar icons
This commit is contained in:
parent
2a1c5fe174
commit
65768692fb
@ -7,6 +7,7 @@
|
||||
TyroConfig::TyroConfig()
|
||||
{
|
||||
// Defines languages_json
|
||||
// Generated on compile from languages.json
|
||||
#include "../../config/languages_json.h"
|
||||
string json_string(languages_json);
|
||||
|
||||
@ -30,3 +31,8 @@ JsonValue TyroConfig::GetLang(string name)
|
||||
{
|
||||
return default_root.get(name, JsonValue());
|
||||
}
|
||||
|
||||
JsonValue TyroConfig::GetLangKeywords(string name)
|
||||
{
|
||||
return this->GetLang(name).get("keywords", JsonValue());
|
||||
}
|
@ -14,6 +14,7 @@ public:
|
||||
~TyroConfig();
|
||||
JsonValue GetRoot();
|
||||
JsonValue GetLang(string name);
|
||||
JsonValue GetLangKeywords(string name);
|
||||
private:
|
||||
JsonValue default_root;
|
||||
JsonReader reader;
|
||||
|
@ -36,7 +36,7 @@ bool EditPane::LoadAndHighlight(wxString filePath)
|
||||
}
|
||||
|
||||
// Get the list of keywords for the current language
|
||||
JsonValue keywords_array = config->GetLang("cpp").get("keywords", JsonValue());
|
||||
JsonValue keywords_array = config->GetLangKeywords("cpp");
|
||||
|
||||
this->StyleSetForeground (wxSTC_STYLE_DEFAULT, wxColor(101, 123, 131));
|
||||
this->StyleSetForeground(wxSTC_STYLE_INDENTGUIDE, wxColor(147, 161, 161));
|
||||
@ -74,8 +74,10 @@ bool EditPane::LoadAndHighlight(wxString filePath)
|
||||
|
||||
if (keywords_array.isArray())
|
||||
{
|
||||
this->SetKeyWords(0, keywords_array[0].asString());
|
||||
this->SetKeyWords(1, keywords_array[1].asString());
|
||||
for(int i = 0; i < keywords_array.size(); i++)
|
||||
{
|
||||
this->SetKeyWords(i, keywords_array[i].asString());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -48,19 +48,13 @@ void MainFrame::SetupStatusBar()
|
||||
void MainFrame::SetupToolbar()
|
||||
{
|
||||
// Icon files
|
||||
#ifdef __WXMAC__
|
||||
#include "../../resources/xpm/48/file-empty.xpm"
|
||||
#include "../../resources/xpm/48/folder.xpm"
|
||||
#include "../../resources/xpm/48/floppy.xpm"
|
||||
#include "../../resources/xpm/48/sign-error.xpm"
|
||||
#include "../../resources/xpm/48/wrench-screwdriver.xpm"
|
||||
#else
|
||||
#include "../../resources/xpm/24/file-empty.xpm"
|
||||
#include "../../resources/xpm/24/folder.xpm"
|
||||
#include "../../resources/xpm/24/floppy.xpm"
|
||||
#include "../../resources/xpm/24/sign-error.xpm"
|
||||
#include "../../resources/xpm/24/wrench-screwdriver.xpm"
|
||||
#endif
|
||||
#include "../../resources/xpm/file_add.xpm"
|
||||
#include "../../resources/xpm/folder.xpm"
|
||||
#include "../../resources/xpm/diskette.xpm"
|
||||
#include "../../resources/xpm/close.xpm"
|
||||
#include "../../resources/xpm/copy.xpm"
|
||||
#include "../../resources/xpm/scissors.xpm"
|
||||
#include "../../resources/xpm/clipboard.xpm"
|
||||
|
||||
CreateToolBar(wxNO_BORDER | wxTB_FLAT | wxTB_HORIZONTAL);
|
||||
|
||||
@ -68,17 +62,22 @@ void MainFrame::SetupToolbar()
|
||||
|
||||
vector<wxBitmap> bitmaps;
|
||||
|
||||
bitmaps.push_back(wxBitmap(file_empty));
|
||||
bitmaps.push_back(wxBitmap(file_add));
|
||||
bitmaps.push_back(wxBitmap(folder));
|
||||
bitmaps.push_back(wxBitmap(floppy));
|
||||
bitmaps.push_back(wxBitmap(sign_error));
|
||||
bitmaps.push_back(wxBitmap(wrench_screwdriver));
|
||||
bitmaps.push_back(wxBitmap(diskette));
|
||||
bitmaps.push_back(wxBitmap(close));
|
||||
bitmaps.push_back(wxBitmap(copy));
|
||||
bitmaps.push_back(wxBitmap(scissors));
|
||||
bitmaps.push_back(wxBitmap(clipboard));
|
||||
|
||||
toolBar->AddTool(wxID_NEW, "New", bitmaps[0], "New file");
|
||||
toolBar->AddTool(wxID_OPEN, "Open", bitmaps[1], "Open file");
|
||||
toolBar->AddTool(wxID_SAVE, "Save", bitmaps[2], "Save file");
|
||||
//toolBar->AddTool(wxID_CLOSE, "Close", bitmaps[3], "Close file");
|
||||
//toolBar->AddSeparator();
|
||||
toolBar->AddTool(wxID_CLOSE, "Close", bitmaps[3], "Close file");
|
||||
toolBar->AddSeparator();
|
||||
toolBar->AddTool(wxID_COPY, "Copy", bitmaps[4], "Copy");
|
||||
toolBar->AddTool(wxID_CUT, "Cut", bitmaps[5], "Cut");
|
||||
toolBar->AddTool(wxID_PASTE, "Paste", bitmaps[6], "Paste");
|
||||
//toolBar->AddTool(wxID_ANY, "Settings", bitmaps[4], "Change Settings");
|
||||
|
||||
toolBar->Realize();
|
||||
@ -263,6 +262,10 @@ void MainFrame::EnableEditControls()
|
||||
editMenu->Enable(wxID_SELECTALL, true);
|
||||
|
||||
toolBar->EnableTool(wxID_SAVE, true);
|
||||
toolBar->EnableTool(wxID_CLOSE, true);
|
||||
toolBar->EnableTool(wxID_COPY, true);
|
||||
toolBar->EnableTool(wxID_CUT, true);
|
||||
toolBar->EnableTool(wxID_PASTE, true);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -284,4 +287,8 @@ void MainFrame::DisableEditControls()
|
||||
editMenu->Enable(wxID_SELECTALL, false);
|
||||
|
||||
toolBar->EnableTool(wxID_SAVE, false);
|
||||
toolBar->EnableTool(wxID_CLOSE, false);
|
||||
toolBar->EnableTool(wxID_COPY, false);
|
||||
toolBar->EnableTool(wxID_CUT, false);
|
||||
toolBar->EnableTool(wxID_PASTE, false);
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ void TabContainer::AddTab()
|
||||
|
||||
EditPane *editor = new EditPane(this, wxID_ANY);
|
||||
|
||||
this->AddPage(editor, caption);
|
||||
this->AddPage(editor, caption, true);
|
||||
}
|
||||
|
||||
void TabContainer::AddTab(wxString filePath)
|
||||
@ -46,11 +46,17 @@ void TabContainer::AddTab(wxString filePath)
|
||||
|
||||
if (loaded_file)
|
||||
{
|
||||
this->AddPage(editor, caption);
|
||||
this->AddPage(editor, caption, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
// @TODO Add Error dialog here
|
||||
wxMessageDialog err(
|
||||
this,
|
||||
_T("Failed to open the specified file. Do you have permission to open it?"),
|
||||
_T("Could not open file."),
|
||||
wxOK|wxCENTER|wxICON_WARNING
|
||||
);
|
||||
err.ShowModal();
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user