Commit f35c9392 authored by twanvl's avatar twanvl

Moved resources to better filenames;

Updated HoverButton, now an actual custom control, added focused and down states;
Added Help->Website
parent 4badaeb3
...@@ -37,6 +37,8 @@ menu: ...@@ -37,6 +37,8 @@ menu:
cards tab: &Cards cards tab: &Cards
help: &Help help: &Help
index: &Index... F1
website: &Website...
about: &About Not Quite Magic Set Editor... about: &About Not Quite Magic Set Editor...
# symbol editor # symbol editor
...@@ -84,6 +86,9 @@ help: ...@@ -84,6 +86,9 @@ help:
new window: Creates another window to edit the same set new window: Creates another window to edit the same set
help: help:
index:
website:
about:
# symbol editor # symbol editor
......
...@@ -90,6 +90,7 @@ Settings::Settings() ...@@ -90,6 +90,7 @@ Settings::Settings()
, card_notes_height (40) , card_notes_height (40)
, updates_url (_("http://magicseteditor.sourceforge.net/updates")) , updates_url (_("http://magicseteditor.sourceforge.net/updates"))
, check_updates (CHECK_IF_CONNECTED) , check_updates (CHECK_IF_CONNECTED)
, website_url (_("http://magicseteditor.sourceforge.net/"))
{} {}
void Settings::addRecentFile(const String& filename) { void Settings::addRecentFile(const String& filename) {
...@@ -158,6 +159,7 @@ IMPLEMENT_REFLECTION(Settings) { ...@@ -158,6 +159,7 @@ IMPLEMENT_REFLECTION(Settings) {
REFLECT(apprentice_location); REFLECT(apprentice_location);
REFLECT(updates_url); REFLECT(updates_url);
REFLECT(check_updates); REFLECT(check_updates);
REFLECT(website_url);
REFLECT(game_settings); REFLECT(game_settings);
REFLECT(stylesheet_settings); REFLECT(stylesheet_settings);
REFLECT(default_stylesheet_settings); REFLECT(default_stylesheet_settings);
......
...@@ -125,6 +125,7 @@ class Settings { ...@@ -125,6 +125,7 @@ class Settings {
// --------------------------------------------------- : Update checking // --------------------------------------------------- : Update checking
String updates_url; String updates_url;
CheckUpdates check_updates; CheckUpdates check_updates;
String website_url;
// --------------------------------------------------- : The io // --------------------------------------------------- : The io
......
...@@ -14,12 +14,12 @@ ...@@ -14,12 +14,12 @@
// ----------------------------------------------------------------------------- : About window // ----------------------------------------------------------------------------- : About window
AboutWindow::AboutWindow(Window* parent) AboutWindow::AboutWindow(Window* parent)
: wxDialog(parent, wxID_ANY, _TITLE_("about"), wxDefaultPosition, wxSize(510,340), wxCLIP_CHILDREN | wxDEFAULT_DIALOG_STYLE) : wxDialog(parent, wxID_ANY, _TITLE_("about"), wxDefaultPosition, wxSize(510,340), wxCLIP_CHILDREN | wxDEFAULT_DIALOG_STYLE | wxTAB_TRAVERSAL)
, logo (load_resource_image(_("about"))) , logo (load_resource_image(_("about")))
, logo2(load_resource_image(_("two"))) , logo2(load_resource_image(_("two")))
{ {
// init controls // init controls
wxButton* ok_button = new HoverButton(this, wxID_OK, _("btn_ok")); wxControl* ok_button = new HoverButton(this, wxID_OK, _("btn_ok"));
wxSize bs = ok_button->GetSize(), ws = GetClientSize(); wxSize bs = ok_button->GetSize(), ws = GetClientSize();
ok_button->Move(ws.GetWidth() - bs.GetWidth(), ws.GetHeight() - bs.GetHeight()); // align bottom right ok_button->Move(ws.GetWidth() - bs.GetWidth(), ws.GetHeight() - bs.GetHeight()); // align bottom right
} }
...@@ -65,22 +65,81 @@ END_EVENT_TABLE () ...@@ -65,22 +65,81 @@ END_EVENT_TABLE ()
HoverButton::HoverButton(Window* parent, int id, const String& name) HoverButton::HoverButton(Window* parent, int id, const String& name)
: normal(load_resource_image(name + _("_NORMAL"))) : wxControl(parent, id, wxDefaultPosition, wxDefaultSize, wxNO_BORDER)
, hover (load_resource_image(name + _("_HOVER"))) , bg_normal(load_resource_image(name + _("_normal")))
, bg_hover (load_resource_image(name + _("_hover")))
, bg_focus (load_resource_image(name + _("_focus")))
, bg_down (load_resource_image(name + _("_down")))
, hover(false), focus(false), mouse_down(false), key_down(false)
, last_drawn(nullptr)
{ {
Create(parent, id, normal, wxDefaultPosition, wxSize(normal.GetWidth(), normal.GetHeight()), 0); SetSize(DoGetBestSize());
} }
void HoverButton::onMouseEnter(wxMouseEvent&) { void HoverButton::onMouseEnter(wxMouseEvent&) {
SetBitmapLabel(hover); hover = true;
Refresh(false); refreshIfNeeded();
} }
void HoverButton::onMouseLeave(wxMouseEvent&) { void HoverButton::onMouseLeave(wxMouseEvent&) {
SetBitmapLabel(normal); hover = false;
Refresh(false); refreshIfNeeded();
}
void HoverButton::onFocus(wxFocusEvent&) {
focus = true;
refreshIfNeeded();
}
void HoverButton::onKillFocus(wxFocusEvent&) {
focus = false;
refreshIfNeeded();
}
void HoverButton::onLeftDown(wxMouseEvent&) {
mouse_down = true;
SetFocus();
CaptureMouse();
refreshIfNeeded();
}
void HoverButton::onLeftUp(wxMouseEvent&) {
if (HasCapture()) ReleaseMouse();
if (mouse_down && hover) {
mouse_down = false;
refreshIfNeeded();
wxCommandEvent evt(wxEVT_COMMAND_BUTTON_CLICKED, GetId());
ProcessEvent(evt);
}
mouse_down = false;
}
void HoverButton::onKeyDown(wxKeyEvent& ev) {
int code = ev.GetKeyCode();
if (code == WXK_RETURN || code == WXK_SPACE) {
key_down = true;
refreshIfNeeded();
} else {
ev.Skip();
}
}
void HoverButton::onKeyUp(wxKeyEvent& ev) {
int code = ev.GetKeyCode();
if (code == WXK_RETURN || code == WXK_SPACE) {
key_down = false;
refreshIfNeeded();
wxCommandEvent evt(wxEVT_COMMAND_BUTTON_CLICKED, GetId());
ProcessEvent(evt);
}
}
wxSize HoverButton::DoGetBestSize() const {
return wxSize(bg_normal.GetWidth(), bg_normal.GetHeight());
}
const Bitmap* HoverButton::toDraw() const {
return (mouse_down && hover) || key_down ? &bg_down
: hover ? &bg_hover
: focus ? &bg_focus
: &bg_normal;
}
void HoverButton::refreshIfNeeded() {
if (last_drawn != toDraw()) Refresh(false);
} }
void HoverButton::onFocus(wxFocusEvent&) {}
void HoverButton::onKillFocus(wxFocusEvent&) {}
void HoverButton::onPaint(wxPaintEvent&) { void HoverButton::onPaint(wxPaintEvent&) {
wxPaintDC dc(this); wxPaintDC dc(this);
...@@ -95,13 +154,21 @@ void HoverButton::draw(DC& dc) { ...@@ -95,13 +154,21 @@ void HoverButton::draw(DC& dc) {
dc.SetBrush(Color(240,247,255)); dc.SetBrush(Color(240,247,255));
dc.DrawRectangle(0, 0, ws.GetWidth(), ws.GetHeight()); dc.DrawRectangle(0, 0, ws.GetWidth(), ws.GetHeight());
// draw button // draw button
dc.DrawBitmap(GetBitmapLabel(), 0, 0); dc.DrawBitmap(*toDraw(), 0, 0);
last_drawn = toDraw();
}
int HoverButton::drawDelta() const {
return (mouse_down && hover) || key_down ? 2 : 0;
} }
BEGIN_EVENT_TABLE(HoverButton, wxBitmapButton) BEGIN_EVENT_TABLE(HoverButton, wxControl)
EVT_ENTER_WINDOW (HoverButton::onMouseEnter) EVT_ENTER_WINDOW (HoverButton::onMouseEnter)
EVT_LEAVE_WINDOW (HoverButton::onMouseLeave) EVT_LEAVE_WINDOW (HoverButton::onMouseLeave)
EVT_PAINT (HoverButton::onPaint) EVT_PAINT (HoverButton::onPaint)
EVT_SET_FOCUS (HoverButton::onFocus) EVT_SET_FOCUS (HoverButton::onFocus)
EVT_KILL_FOCUS (HoverButton::onKillFocus) EVT_KILL_FOCUS (HoverButton::onKillFocus)
EVT_LEFT_DOWN (HoverButton::onLeftDown)
EVT_LEFT_UP (HoverButton::onLeftUp)
EVT_KEY_DOWN (HoverButton::onKeyDown)
EVT_KEY_UP (HoverButton::onKeyUp)
END_EVENT_TABLE () END_EVENT_TABLE ()
...@@ -31,23 +31,34 @@ class AboutWindow : public wxDialog { ...@@ -31,23 +31,34 @@ class AboutWindow : public wxDialog {
// ----------------------------------------------------------------------------- : Button with image and hover effect // ----------------------------------------------------------------------------- : Button with image and hover effect
// A button that changes images on mouseenter/leave // A button that changes images on mouseenter/leave
class HoverButton : public wxBitmapButton { class HoverButton : public wxControl {
public: public:
HoverButton(Window* parent, int id, const String& name); HoverButton(Window* parent, int id, const String& name);
private: private:
DECLARE_EVENT_TABLE(); DECLARE_EVENT_TABLE();
Bitmap normal, hover; /// Bitmaps for the states of the button Bitmap bg_normal, bg_hover, bg_focus, bg_down; /// Bitmaps for the states of the button
bool hover, focus, mouse_down, key_down;
void onMouseEnter(wxMouseEvent&); void onMouseEnter(wxMouseEvent&);
void onMouseLeave(wxMouseEvent&); void onMouseLeave(wxMouseEvent&);
void onFocus (wxFocusEvent& ev); void onFocus (wxFocusEvent& ev);
void onKillFocus (wxFocusEvent& ev); void onKillFocus (wxFocusEvent& ev);
void onPaint (wxPaintEvent&); void onPaint (wxPaintEvent&);
void onLeftUp (wxMouseEvent&);
void onLeftDown (wxMouseEvent&);
void onKeyDown (wxKeyEvent&);
void onKeyUp (wxKeyEvent&);
virtual wxSize DoGetBestSize() const;
const Bitmap* last_drawn;
const Bitmap* toDraw() const;
void refreshIfNeeded();
protected: protected:
virtual void draw(DC& dc); virtual void draw(DC& dc);
int drawDelta() const;
}; };
......
...@@ -27,6 +27,7 @@ SetP new_set_window(Window* parent) { ...@@ -27,6 +27,7 @@ SetP new_set_window(Window* parent) {
NewSetWindow::NewSetWindow(Window* parent) NewSetWindow::NewSetWindow(Window* parent)
: wxDialog(parent, wxID_ANY, _("New set"), wxDefaultPosition, wxSize(530,320), wxDEFAULT_DIALOG_STYLE) : wxDialog(parent, wxID_ANY, _("New set"), wxDefaultPosition, wxSize(530,320), wxDEFAULT_DIALOG_STYLE)
{ {
wxBusyCursor wait;
// init controls // init controls
game_list = new PackageList (this, ID_GAME_LIST); game_list = new PackageList (this, ID_GAME_LIST);
stylesheet_list = new PackageList (this, ID_STYLESHEET_LIST); stylesheet_list = new PackageList (this, ID_STYLESHEET_LIST);
...@@ -53,6 +54,7 @@ NewSetWindow::NewSetWindow(Window* parent) ...@@ -53,6 +54,7 @@ NewSetWindow::NewSetWindow(Window* parent)
} }
void NewSetWindow::onGameSelect(wxCommandEvent&) { void NewSetWindow::onGameSelect(wxCommandEvent&) {
wxBusyCursor wait;
GameP game = game_list->getSelection<Game>(); GameP game = game_list->getSelection<Game>();
settings.default_game = game->name(); settings.default_game = game->name();
GameSettings& gs = settings.gameSettingsFor(*game); GameSettings& gs = settings.gameSettingsFor(*game);
......
...@@ -67,10 +67,10 @@ void CardsPanel::onChangeSet() { ...@@ -67,10 +67,10 @@ void CardsPanel::onChangeSet() {
void CardsPanel::initUI(wxToolBar* tb, wxMenuBar* mb) { void CardsPanel::initUI(wxToolBar* tb, wxMenuBar* mb) {
// Toolbar // Toolbar
tb->AddTool(ID_FORMAT_BOLD, _(""), load_resource_tool_image(_("format_bold")), wxNullBitmap, wxITEM_CHECK, _TOOL_("bold")); tb->AddTool(ID_FORMAT_BOLD, _(""), load_resource_tool_image(_("bold")), wxNullBitmap, wxITEM_CHECK, _TOOL_("bold"));
tb->AddTool(ID_FORMAT_ITALIC, _(""), load_resource_tool_image(_("format_italic")), wxNullBitmap, wxITEM_CHECK, _TOOL_("italic")); tb->AddTool(ID_FORMAT_ITALIC, _(""), load_resource_tool_image(_("italic")), wxNullBitmap, wxITEM_CHECK, _TOOL_("italic"));
tb->AddTool(ID_FORMAT_SYMBOL, _(""), load_resource_tool_image(_("format_symbol")), wxNullBitmap, wxITEM_CHECK, _TOOL_("symbols")); tb->AddTool(ID_FORMAT_SYMBOL, _(""), load_resource_tool_image(_("symbol")), wxNullBitmap, wxITEM_CHECK, _TOOL_("symbols"));
tb->AddTool(ID_FORMAT_REMINDER, _(""), load_resource_tool_image(_("format_reminder")), wxNullBitmap, wxITEM_CHECK, _TOOL_("reminder text")); tb->AddTool(ID_FORMAT_REMINDER, _(""), load_resource_tool_image(_("reminder")), wxNullBitmap, wxITEM_CHECK, _TOOL_("reminder text"));
tb->AddSeparator(); tb->AddSeparator();
tb->AddTool(ID_CARD_ADD, _(""), load_resource_tool_image(_("card_add")), wxNullBitmap, wxITEM_NORMAL,_TOOL_("add card")); tb->AddTool(ID_CARD_ADD, _(""), load_resource_tool_image(_("card_add")), wxNullBitmap, wxITEM_NORMAL,_TOOL_("add card"));
tb->AddTool(ID_CARD_REMOVE, _(""), load_resource_tool_image(_("card_del")), wxNullBitmap, wxITEM_NORMAL,_TOOL_("remove card")); tb->AddTool(ID_CARD_REMOVE, _(""), load_resource_tool_image(_("card_del")), wxNullBitmap, wxITEM_NORMAL,_TOOL_("remove card"));
...@@ -100,10 +100,10 @@ void CardsPanel::initUI(wxToolBar* tb, wxMenuBar* mb) { ...@@ -100,10 +100,10 @@ void CardsPanel::initUI(wxToolBar* tb, wxMenuBar* mb) {
mb->Insert(2, menuCard, _("&Cards")); mb->Insert(2, menuCard, _("&Cards"));
IconMenu* menuFormat = new IconMenu(); IconMenu* menuFormat = new IconMenu();
menuFormat->Append(ID_FORMAT_BOLD, _("format_bold"), _("Bold\tCtrl+B"), _("Makes the selected text bold"), wxITEM_CHECK); menuFormat->Append(ID_FORMAT_BOLD, _("bold"), _("Bold\tCtrl+B"), _("Makes the selected text bold"), wxITEM_CHECK);
menuFormat->Append(ID_FORMAT_ITALIC, _("format_italic"), _("Italic\tCtrl+I"), _("Makes the selected text italic"), wxITEM_CHECK); menuFormat->Append(ID_FORMAT_ITALIC, _("italic"), _("Italic\tCtrl+I"), _("Makes the selected text italic"), wxITEM_CHECK);
menuFormat->Append(ID_FORMAT_SYMBOL, _("format_symbol"), _("Symbols\tCtrl+M"), _("Draws the selected text with symbols"), wxITEM_CHECK); menuFormat->Append(ID_FORMAT_SYMBOL, _("symbol"), _("Symbols\tCtrl+M"), _("Draws the selected text with symbols"), wxITEM_CHECK);
menuFormat->Append(ID_FORMAT_REMINDER, _("format_reminder"), _("Reminder Text\tCtrl+R"), _("Show reminder text for the selected keyword"), wxITEM_CHECK); menuFormat->Append(ID_FORMAT_REMINDER, _("reminder"), _("Reminder Text\tCtrl+R"), _("Show reminder text for the selected keyword"), wxITEM_CHECK);
mb->Insert(3, menuFormat, _("&Format")); mb->Insert(3, menuFormat, _("&Format"));
} }
......
...@@ -34,16 +34,16 @@ void SetInfoPanel::onChangeSet() { ...@@ -34,16 +34,16 @@ void SetInfoPanel::onChangeSet() {
void SetInfoPanel::initUI(wxToolBar* tb, wxMenuBar* mb) { void SetInfoPanel::initUI(wxToolBar* tb, wxMenuBar* mb) {
// Toolbar // Toolbar
tb->AddTool(ID_FORMAT_BOLD, _(""), load_resource_tool_image(_("format_bold")), wxNullBitmap, wxITEM_CHECK, _("Bold")); tb->AddTool(ID_FORMAT_BOLD, _(""), load_resource_tool_image(_("bold")), wxNullBitmap, wxITEM_CHECK, _("Bold"));
tb->AddTool(ID_FORMAT_ITALIC, _(""), load_resource_tool_image(_("format_italic")), wxNullBitmap, wxITEM_CHECK, _("Italic")); tb->AddTool(ID_FORMAT_ITALIC, _(""), load_resource_tool_image(_("italic")), wxNullBitmap, wxITEM_CHECK, _("Italic"));
tb->AddTool(ID_FORMAT_SYMBOL, _(""), load_resource_tool_image(_("format_symbol")), wxNullBitmap, wxITEM_CHECK, _("Symbols")); tb->AddTool(ID_FORMAT_SYMBOL, _(""), load_resource_tool_image(_("symbol")), wxNullBitmap, wxITEM_CHECK, _("Symbols"));
tb->Realize(); tb->Realize();
// Menus // Menus
IconMenu* menuFormat = new IconMenu(); IconMenu* menuFormat = new IconMenu();
menuFormat->Append(ID_FORMAT_BOLD, _("format_bold"), _("Bold\tCtrl+B"), _("Makes the selected text bold"), wxITEM_CHECK); menuFormat->Append(ID_FORMAT_BOLD, _("bold"), _("Bold\tCtrl+B"), _("Makes the selected text bold"), wxITEM_CHECK);
menuFormat->Append(ID_FORMAT_ITALIC, _("format_italic"), _("Italic\tCtrl+I"), _("Makes the selected text italic"), wxITEM_CHECK); menuFormat->Append(ID_FORMAT_ITALIC, _("italic"), _("Italic\tCtrl+I"), _("Makes the selected text italic"), wxITEM_CHECK);
menuFormat->Append(ID_FORMAT_SYMBOL, _("format_symbol"), _("Symbols\tCtrl+M"), _("Draws the selected text with symbols"), wxITEM_CHECK); menuFormat->Append(ID_FORMAT_SYMBOL, _("symbol"), _("Symbols\tCtrl+M"), _("Draws the selected text with symbols"), wxITEM_CHECK);
menuFormat->Append(ID_FORMAT_REMINDER, _("format_reminder"), _("Reminder Text\tCtrl+R"), _("Show reminder text for the selected keyword"), wxITEM_CHECK); menuFormat->Append(ID_FORMAT_REMINDER, _("reminder"), _("Reminder Text\tCtrl+R"), _("Show reminder text for the selected keyword"), wxITEM_CHECK);
mb->Insert(2, menuFormat, _("&Format")); mb->Insert(2, menuFormat, _("&Format"));
} }
......
...@@ -48,9 +48,9 @@ SetWindow::SetWindow(Window* parent, const SetP& set) ...@@ -48,9 +48,9 @@ SetWindow::SetWindow(Window* parent, const SetP& set)
// initialize menu bar // initialize menu bar
wxMenuBar* menuBar = new wxMenuBar(); wxMenuBar* menuBar = new wxMenuBar();
IconMenu* menuFile = new IconMenu(); IconMenu* menuFile = new IconMenu();
menuFile->Append(ID_FILE_NEW, _("file_new"), _MENU_("new set"), _HELP_("new set")); menuFile->Append(ID_FILE_NEW, _("new"), _MENU_("new set"), _HELP_("new set"));
menuFile->Append(ID_FILE_OPEN, _("file_open"), _MENU_("open set"), _HELP_("open set")); menuFile->Append(ID_FILE_OPEN, _("open"), _MENU_("open set"), _HELP_("open set"));
menuFile->Append(ID_FILE_SAVE, _("file_save"), _MENU_("save set"), _HELP_("save set")); menuFile->Append(ID_FILE_SAVE, _("save"), _MENU_("save set"), _HELP_("save set"));
menuFile->Append(ID_FILE_SAVE_AS, _MENU_("save set as"), _HELP_("save set as")); menuFile->Append(ID_FILE_SAVE_AS, _MENU_("save set as"), _HELP_("save set as"));
IconMenu* menuExport = new IconMenu(); IconMenu* menuExport = new IconMenu();
menuExport->Append(ID_FILE_EXPORT_HTML, _("&HTML..."), _("Export the set to a HTML file")); menuExport->Append(ID_FILE_EXPORT_HTML, _("&HTML..."), _("Export the set to a HTML file"));
...@@ -71,14 +71,14 @@ SetWindow::SetWindow(Window* parent, const SetP& set) ...@@ -71,14 +71,14 @@ SetWindow::SetWindow(Window* parent, const SetP& set)
menuBar->Append(menuFile, _MENU_("file")); menuBar->Append(menuFile, _MENU_("file"));
IconMenu* menuEdit = new IconMenu(); IconMenu* menuEdit = new IconMenu();
menuEdit->Append(ID_EDIT_UNDO, _("edit_undo"), _MENU_1_("undo",wxEmptyString), _HELP_("undo")); menuEdit->Append(ID_EDIT_UNDO, _("undo"), _MENU_1_("undo",wxEmptyString), _HELP_("undo"));
menuEdit->Append(ID_EDIT_REDO, _("edit_redo"), _MENU_1_("redo",wxEmptyString), _HELP_("redo")); menuEdit->Append(ID_EDIT_REDO, _("redo"), _MENU_1_("redo",wxEmptyString), _HELP_("redo"));
menuEdit->AppendSeparator(); menuEdit->AppendSeparator();
menuEdit->Append(ID_EDIT_CUT, _("edit_cut"), _MENU_("cut"), _HELP_("cut")); menuEdit->Append(ID_EDIT_CUT, _("cut"), _MENU_("cut"), _HELP_("cut"));
menuEdit->Append(ID_EDIT_COPY, _("edit_copy"), _MENU_("copy"), _HELP_("copy")); menuEdit->Append(ID_EDIT_COPY, _("copy"), _MENU_("copy"), _HELP_("copy"));
menuEdit->Append(ID_EDIT_PASTE, _("edit_paste"), _MENU_("paste"), _HELP_("paste")); menuEdit->Append(ID_EDIT_PASTE, _("paste"), _MENU_("paste"), _HELP_("paste"));
menuEdit->AppendSeparator(); menuEdit->AppendSeparator();
menuEdit->Append(ID_EDIT_FIND, _("edit_find"), _MENU_("find"), _("")); menuEdit->Append(ID_EDIT_FIND, _("find"), _MENU_("find"), _(""));
menuEdit->Append(ID_EDIT_FIND_NEXT, _MENU_("find next"), _("")); menuEdit->Append(ID_EDIT_FIND_NEXT, _MENU_("find next"), _(""));
menuEdit->Append(ID_EDIT_REPLACE, _MENU_("replace"), _("")); menuEdit->Append(ID_EDIT_REPLACE, _MENU_("replace"), _(""));
menuEdit->AppendSeparator(); menuEdit->AppendSeparator();
...@@ -91,9 +91,10 @@ SetWindow::SetWindow(Window* parent, const SetP& set) ...@@ -91,9 +91,10 @@ SetWindow::SetWindow(Window* parent, const SetP& set)
menuBar->Append(menuWindow, _MENU_("window")); menuBar->Append(menuWindow, _MENU_("window"));
IconMenu* menuHelp = new IconMenu(); IconMenu* menuHelp = new IconMenu();
menuHelp->Append(ID_HELP_INDEX, _("help"), _("&Index..\tF1"), _("")); menuHelp->Append(ID_HELP_INDEX, _("help"), _MENU_("index"), _HELP_("index"));
menuHelp->Append(ID_HELP_WEBSITE, _MENU_("website"), _HELP_("website"));
menuHelp->AppendSeparator(); menuHelp->AppendSeparator();
menuHelp->Append(ID_HELP_ABOUT, _MENU_("about"), _("")); menuHelp->Append(ID_HELP_ABOUT, _MENU_("about"), _HELP_("about"));
menuBar->Append(menuHelp, _MENU_("help")); menuBar->Append(menuHelp, _MENU_("help"));
SetMenuBar(menuBar); SetMenuBar(menuBar);
...@@ -105,16 +106,16 @@ SetWindow::SetWindow(Window* parent, const SetP& set) ...@@ -105,16 +106,16 @@ SetWindow::SetWindow(Window* parent, const SetP& set)
// tool bar // tool bar
wxToolBar* tb = CreateToolBar(wxTB_FLAT | wxNO_BORDER | wxTB_HORIZONTAL); wxToolBar* tb = CreateToolBar(wxTB_FLAT | wxNO_BORDER | wxTB_HORIZONTAL);
tb->SetToolBitmapSize(wxSize(18,18)); tb->SetToolBitmapSize(wxSize(18,18));
tb->AddTool(ID_FILE_NEW, _(""), load_resource_tool_image(_("file_new")), wxNullBitmap, wxITEM_NORMAL, _TOOL_("new set"), _HELP_("new set")); tb->AddTool(ID_FILE_NEW, _(""), load_resource_tool_image(_("new")), wxNullBitmap, wxITEM_NORMAL, _TOOL_("new set"), _HELP_("new set"));
tb->AddTool(ID_FILE_OPEN, _(""), load_resource_tool_image(_("file_open")), wxNullBitmap, wxITEM_NORMAL, _TOOL_("open set"), _HELP_("open set")); tb->AddTool(ID_FILE_OPEN, _(""), load_resource_tool_image(_("open")), wxNullBitmap, wxITEM_NORMAL, _TOOL_("open set"), _HELP_("open set"));
tb->AddTool(ID_FILE_SAVE, _(""), load_resource_tool_image(_("file_save")), wxNullBitmap, wxITEM_NORMAL, _TOOL_("save set"), _HELP_("save set")); tb->AddTool(ID_FILE_SAVE, _(""), load_resource_tool_image(_("save")), wxNullBitmap, wxITEM_NORMAL, _TOOL_("save set"), _HELP_("save set"));
tb->AddSeparator(); tb->AddSeparator();
tb->AddTool(ID_EDIT_CUT, _(""), load_resource_tool_image(_("edit_cut")), wxNullBitmap, wxITEM_NORMAL, _TOOL_("cut")); tb->AddTool(ID_EDIT_CUT, _(""), load_resource_tool_image(_("cut")), wxNullBitmap, wxITEM_NORMAL, _TOOL_("cut"));
tb->AddTool(ID_EDIT_COPY, _(""), load_resource_tool_image(_("edit_copy")), wxNullBitmap, wxITEM_NORMAL, _TOOL_("copy")); tb->AddTool(ID_EDIT_COPY, _(""), load_resource_tool_image(_("copy")), wxNullBitmap, wxITEM_NORMAL, _TOOL_("copy"));
tb->AddTool(ID_EDIT_PASTE, _(""), load_resource_tool_image(_("edit_paste")), wxNullBitmap, wxITEM_NORMAL, _TOOL_("paste")); tb->AddTool(ID_EDIT_PASTE, _(""), load_resource_tool_image(_("paste")), wxNullBitmap, wxITEM_NORMAL, _TOOL_("paste"));
tb->AddSeparator(); tb->AddSeparator();
tb->AddTool(ID_EDIT_UNDO, _(""), load_resource_tool_image(_("edit_undo")), wxNullBitmap, wxITEM_NORMAL, _TOOL_1_("undo",wxEmptyString)); tb->AddTool(ID_EDIT_UNDO, _(""), load_resource_tool_image(_("undo")), wxNullBitmap, wxITEM_NORMAL, _TOOL_1_("undo",wxEmptyString));
tb->AddTool(ID_EDIT_REDO, _(""), load_resource_tool_image(_("edit_redo")), wxNullBitmap, wxITEM_NORMAL, _TOOL_1_("redo",wxEmptyString)); tb->AddTool(ID_EDIT_REDO, _(""), load_resource_tool_image(_("redo")), wxNullBitmap, wxITEM_NORMAL, _TOOL_1_("redo",wxEmptyString));
tb->AddSeparator(); tb->AddSeparator();
tb->Realize(); tb->Realize();
...@@ -546,6 +547,10 @@ void SetWindow::onHelpIndex(wxCommandEvent&) { ...@@ -546,6 +547,10 @@ void SetWindow::onHelpIndex(wxCommandEvent&) {
// wnd->Show(); // wnd->Show();
} }
void SetWindow::onHelpWebsite(wxCommandEvent&) {
wxLaunchDefaultBrowser(settings.website_url);
}
void SetWindow::onHelpAbout(wxCommandEvent&) { void SetWindow::onHelpAbout(wxCommandEvent&) {
AboutWindow wnd(this); AboutWindow wnd(this);
wnd.ShowModal(); wnd.ShowModal();
...@@ -592,6 +597,7 @@ BEGIN_EVENT_TABLE(SetWindow, wxFrame) ...@@ -592,6 +597,7 @@ BEGIN_EVENT_TABLE(SetWindow, wxFrame)
EVT_MENU (ID_WINDOW_NEW, SetWindow::onWindowNewWindow) EVT_MENU (ID_WINDOW_NEW, SetWindow::onWindowNewWindow)
EVT_TOOL_RANGE (ID_WINDOW_MIN, ID_WINDOW_MAX, SetWindow::onWindowSelect) EVT_TOOL_RANGE (ID_WINDOW_MIN, ID_WINDOW_MAX, SetWindow::onWindowSelect)
EVT_MENU (ID_HELP_INDEX, SetWindow::onHelpIndex) EVT_MENU (ID_HELP_INDEX, SetWindow::onHelpIndex)
EVT_MENU (ID_HELP_WEBSITE, SetWindow::onHelpWebsite)
EVT_MENU (ID_HELP_ABOUT, SetWindow::onHelpAbout) EVT_MENU (ID_HELP_ABOUT, SetWindow::onHelpAbout)
EVT_TOOL_RANGE (ID_CHILD_MIN, ID_CHILD_MAX, SetWindow::onChildMenu) EVT_TOOL_RANGE (ID_CHILD_MIN, ID_CHILD_MAX, SetWindow::onChildMenu)
EVT_GALLERY_SELECT (ID_FIELD_LIST, SetWindow::onChildMenu) // for StatsPanel, because it is not a EVT_TOOL EVT_GALLERY_SELECT (ID_FIELD_LIST, SetWindow::onChildMenu) // for StatsPanel, because it is not a EVT_TOOL
......
...@@ -139,6 +139,7 @@ class SetWindow : public wxFrame, public SetView { ...@@ -139,6 +139,7 @@ class SetWindow : public wxFrame, public SetView {
// --------------------------------------------------- : Window events - menu - help // --------------------------------------------------- : Window events - menu - help
void onHelpIndex (wxCommandEvent&); void onHelpIndex (wxCommandEvent&);
void onHelpWebsite (wxCommandEvent&);
void onHelpAbout (wxCommandEvent&); void onHelpAbout (wxCommandEvent&);
// --------------------------------------------------- : Window events - other // --------------------------------------------------- : Window events - other
......
...@@ -58,9 +58,9 @@ void SymbolWindow::init(Window* parent, SymbolP symbol) { ...@@ -58,9 +58,9 @@ void SymbolWindow::init(Window* parent, SymbolP symbol) {
// Menu bar // Menu bar
wxMenuBar* menuBar = new wxMenuBar(); wxMenuBar* menuBar = new wxMenuBar();
IconMenu* menuFile = new IconMenu(); IconMenu* menuFile = new IconMenu();
menuFile->Append(ID_FILE_NEW, _("file_new"), _MENU_("new symbol"), _HELP_("new symbol")); menuFile->Append(ID_FILE_NEW, _("new"), _MENU_("new symbol"), _HELP_("new symbol"));
menuFile->Append(ID_FILE_OPEN, _("file_open"), _MENU_("open symbol"), _HELP_("open symbol")); menuFile->Append(ID_FILE_OPEN, _("open"), _MENU_("open symbol"), _HELP_("open symbol"));
menuFile->Append(ID_FILE_SAVE, _("file_save"), _MENU_("save symbol"), _HELP_("save symbol")); menuFile->Append(ID_FILE_SAVE, _("save"), _MENU_("save symbol"), _HELP_("save symbol"));
menuFile->Append(ID_FILE_SAVE_AS, _MENU_("save symbol as"), _HELP_("save symbol as")); menuFile->Append(ID_FILE_SAVE_AS, _MENU_("save symbol as"), _HELP_("save symbol as"));
menuFile->AppendSeparator(); menuFile->AppendSeparator();
menuFile->Append(ID_FILE_STORE, _("apply"), _MENU_("store symbol"), _HELP_("store symbol")); menuFile->Append(ID_FILE_STORE, _("apply"), _MENU_("store symbol"), _HELP_("store symbol"));
...@@ -69,8 +69,8 @@ void SymbolWindow::init(Window* parent, SymbolP symbol) { ...@@ -69,8 +69,8 @@ void SymbolWindow::init(Window* parent, SymbolP symbol) {
menuBar->Append(menuFile, _MENU_("file")); menuBar->Append(menuFile, _MENU_("file"));
IconMenu* menuEdit = new IconMenu(); IconMenu* menuEdit = new IconMenu();
menuEdit->Append(ID_EDIT_UNDO, _("edit_undo"), _MENU_1_("undo",wxEmptyString), _HELP_("undo")); menuEdit->Append(ID_EDIT_UNDO, _("undo"), _MENU_1_("undo",wxEmptyString), _HELP_("undo"));
menuEdit->Append(ID_EDIT_REDO, _("edit_redo"), _MENU_1_("redo",wxEmptyString), _HELP_("redo")); menuEdit->Append(ID_EDIT_REDO, _("redo"), _MENU_1_("redo",wxEmptyString), _HELP_("redo"));
menuEdit->AppendSeparator(); menuEdit->AppendSeparator();
menuEdit->Append(ID_EDIT_DUPLICATE, _("duplicate"), _MENU_("duplicate"), _HELP_("duplicate")); menuEdit->Append(ID_EDIT_DUPLICATE, _("duplicate"), _MENU_("duplicate"), _HELP_("duplicate"));
menuBar->Append(menuEdit, _MENU_("edit")); menuBar->Append(menuEdit, _MENU_("edit"));
...@@ -93,8 +93,8 @@ void SymbolWindow::init(Window* parent, SymbolP symbol) { ...@@ -93,8 +93,8 @@ void SymbolWindow::init(Window* parent, SymbolP symbol) {
wxToolBar* tb = CreateToolBar(wxTB_FLAT | wxNO_BORDER | wxTB_HORIZONTAL | wxTB_TEXT); wxToolBar* tb = CreateToolBar(wxTB_FLAT | wxNO_BORDER | wxTB_HORIZONTAL | wxTB_TEXT);
tb->AddTool(ID_FILE_STORE, _("Store"), load_resource_tool_image(_("apply")), wxNullBitmap, wxITEM_NORMAL, _TOOL_("store symbol"), _HELP_("store symbol")); tb->AddTool(ID_FILE_STORE, _("Store"), load_resource_tool_image(_("apply")), wxNullBitmap, wxITEM_NORMAL, _TOOL_("store symbol"), _HELP_("store symbol"));
tb->AddSeparator(); tb->AddSeparator();
tb->AddTool(ID_EDIT_UNDO, _("Undo"), load_resource_tool_image(_("edit_undo")), wxNullBitmap, wxITEM_NORMAL, _TOOL_1_("undo",wxEmptyString)); tb->AddTool(ID_EDIT_UNDO, _("Undo"), load_resource_tool_image(_("undo")), wxNullBitmap, wxITEM_NORMAL, _TOOL_1_("undo",wxEmptyString));
tb->AddTool(ID_EDIT_REDO, _("Redo"), load_resource_tool_image(_("edit_redo")), wxNullBitmap, wxITEM_NORMAL, _TOOL_1_("redo",wxEmptyString)); tb->AddTool(ID_EDIT_REDO, _("Redo"), load_resource_tool_image(_("redo")), wxNullBitmap, wxITEM_NORMAL, _TOOL_1_("redo",wxEmptyString));
tb->Realize(); tb->Realize();
// Edit mode toolbar // Edit mode toolbar
......
...@@ -90,7 +90,7 @@ Image load_resource_image(const String& name) { ...@@ -90,7 +90,7 @@ Image load_resource_image(const String& name) {
return wxImage(stream); return wxImage(stream);
#elif defined(__linux__) #elif defined(__linux__)
static String path = wxStandardPaths::Get().GetDataDir() + _("/resource/"); static String path = wxStandardPaths::Get().GetDataDir() + _("/resource/");
String file = path + name.Lower(); String file = path + name; // if the name is in upper case, fix the call
wxImage resource; wxImage resource;
if (wxFileExists(file + _(".png"))) resource.LoadFile(file + _(".png")); if (wxFileExists(file + _(".png"))) resource.LoadFile(file + _(".png"));
else if (wxFileExists(file + _(".bmp"))) resource.LoadFile(file + _(".bmp")); else if (wxFileExists(file + _(".bmp"))) resource.LoadFile(file + _(".bmp"));
......
...@@ -16,28 +16,34 @@ ...@@ -16,28 +16,34 @@
#include <wx/dcbuffer.h> #include <wx/dcbuffer.h>
#include <wx/filename.h> #include <wx/filename.h>
// 2007-02-06: New HoverButton, hopefully this on works on GTK
#define USE_HOVERBUTTON
// ----------------------------------------------------------------------------- : WelcomeWindow // ----------------------------------------------------------------------------- : WelcomeWindow
WelcomeWindow::WelcomeWindow() WelcomeWindow::WelcomeWindow()
: Frame(nullptr, wxID_ANY, _TITLE_("magic set editor"), wxDefaultPosition, wxSize(480,340), wxDEFAULT_DIALOG_STYLE) : Frame(nullptr, wxID_ANY, _TITLE_("magic set editor"), wxDefaultPosition, wxSize(480,340), wxDEFAULT_DIALOG_STYLE | wxTAB_TRAVERSAL | wxCLIP_CHILDREN )
, logo (load_resource_image(_("about"))) , logo (load_resource_image(_("about")))
, logo2(load_resource_image(_("two"))) , logo2(load_resource_image(_("two")))
{ {
SetIcon(load_resource_icon(_("app"))); SetIcon(load_resource_icon(_("app")));
// init controls // init controls
#ifdef __WXMSW__ #ifdef USE_HOVERBUTTON
wxButton* new_set = new HoverButtonExt(this, ID_FILE_NEW, load_resource_image(_("welcome_new")), _BUTTON_("new set"), _HELP_("new set")); wxControl* new_set = new HoverButtonExt(this, ID_FILE_NEW, load_resource_image(_("welcome_new")), _BUTTON_("new set"), _HELP_("new set"));
wxButton* open_set = new HoverButtonExt(this, ID_FILE_OPEN, load_resource_image(_("welcome_open")), _BUTTON_("open set"), _HELP_("open set")); wxControl* open_set = new HoverButtonExt(this, ID_FILE_OPEN, load_resource_image(_("welcome_open")), _BUTTON_("open set"), _HELP_("open set"));
#else #else
// For now, hover buttons don't work on GTK wxControl* new_set = new wxButton(this, ID_FILE_NEW, _BUTTON_("new set"));
wxButton* new_set = new wxButton(this, ID_FILE_NEW, _BUTTON_("new set")); wxControl* open_set = new wxButton(this, ID_FILE_OPEN, _BUTTON_("open set"));
wxButton* open_set = new wxButton(this, ID_FILE_OPEN, _BUTTON_("open set"));
#endif #endif
wxButton* open_last = 0; wxControl* open_last = nullptr;
if (!settings.recent_sets.empty()) { if (!settings.recent_sets.empty()) {
wxFileName n(settings.recent_sets.front()); wxFileName n(settings.recent_sets.front());
#ifdef USE_HOVERBUTTON
open_last = new HoverButtonExt(this, ID_FILE_RECENT, load_resource_image(_("welcome_last")), _BUTTON_("last opened set"), _("Open '") + n.GetName() + _("'")); open_last = new HoverButtonExt(this, ID_FILE_RECENT, load_resource_image(_("welcome_last")), _BUTTON_("last opened set"), _("Open '") + n.GetName() + _("'"));
#else
open_last = new wxButton(this, ID_FILE_RECENT, _BUTTON_("last opened set"));
#endif
} }
wxSizer* s1 = new wxBoxSizer(wxHORIZONTAL); wxSizer* s1 = new wxBoxSizer(wxHORIZONTAL);
...@@ -121,13 +127,14 @@ HoverButtonExt::HoverButtonExt(Window* parent, int id, const wxImage& icon, cons ...@@ -121,13 +127,14 @@ HoverButtonExt::HoverButtonExt(Window* parent, int id, const wxImage& icon, cons
void HoverButtonExt::draw(DC& dc) { void HoverButtonExt::draw(DC& dc) {
// draw button // draw button
// HoverButton::draw(dc); HoverButton::draw(dc);
int d = drawDelta();
// icon // icon
if (icon.Ok()) dc.DrawBitmap(icon, 7, 7); if (icon.Ok()) dc.DrawBitmap(icon, d+7, d+7);
// text // text
dc.SetTextForeground(*wxBLACK); dc.SetTextForeground(*wxBLACK);
dc.SetFont(font_large); dc.SetFont(font_large);
dc.DrawText(label, 44, 7); dc.DrawText(label, d+44, d+7);
dc.SetFont(font_small); dc.SetFont(font_small);
dc.DrawText(sub_label, 45, 28); dc.DrawText(sub_label, d+45, d+28);
} }
...@@ -19,22 +19,22 @@ icon/symbol ICON "icon/symbol.ico" ...@@ -19,22 +19,22 @@ icon/symbol ICON "icon/symbol.ico"
cursor/rot_text CURSOR "cursor/rot_text.cur" cursor/rot_text CURSOR "cursor/rot_text.cur"
tool/new BITMAP "tool/file_new.bmp" tool/new BITMAP "tool/new.bmp"
tool/open BITMAP "tool/file_open.bmp" tool/open BITMAP "tool/open.bmp"
tool/save BITMAP "tool/file_save.bmp" tool/save BITMAP "tool/save.bmp"
tool/undo BITMAP "tool/edit_undo.bmp" tool/undo BITMAP "tool/undo.bmp"
tool/redo BITMAP "tool/edit_redo.bmp" tool/redo BITMAP "tool/redo.bmp"
tool/cut BITMAP "tool/edit_cut.bmp" tool/cut BITMAP "tool/cut.bmp"
tool/copy BITMAP "tool/edit_copy.bmp" tool/copy BITMAP "tool/copy.bmp"
tool/paste BITMAP "tool/edit_paste.bmp" tool/paste BITMAP "tool/paste.bmp"
tool/find BITMAP "tool/edit_find.bmp" tool/find BITMAP "tool/find.bmp"
tool/bold BITMAP "tool/format_bold.bmp" tool/bold BITMAP "tool/bold.bmp"
tool/italic BITMAP "tool/format_italic.bmp" tool/italic BITMAP "tool/italic.bmp"
tool/symbol BITMAP "tool/format_symbol.bmp" tool/symbol BITMAP "tool/symbol.bmp"
tool/reminder BITMAP "tool/format_reminder.bmp" tool/reminder BITMAP "tool/reminder.bmp"
tool/no_auto BITMAP "tool/format_no_auto.bmp" tool/no_auto BITMAP "tool/no_auto.bmp"
tool/card_add BITMAP "tool/card_add.bmp" tool/card_add BITMAP "tool/card_add.bmp"
tool/card_add_multiple BITMAP "tool/card_add_multiple.bmp" tool/card_add_multiple BITMAP "tool/card_add_multiple.bmp"
...@@ -111,8 +111,12 @@ about IMAGE "../common/about.png" ...@@ -111,8 +111,12 @@ about IMAGE "../common/about.png"
two IMAGE "../common/two_beta.png" two IMAGE "../common/two_beta.png"
btn_normal IMAGE "../common/btn_normal.png" btn_normal IMAGE "../common/btn_normal.png"
btn_hover IMAGE "../common/btn_hover.png" btn_hover IMAGE "../common/btn_hover.png"
btn_focus IMAGE "../common/btn_focus.png"
btn_down IMAGE "../common/btn_down.png"
btn_ok_normal IMAGE "../common/btn_ok_normal.png" btn_ok_normal IMAGE "../common/btn_ok_normal.png"
btn_ok_hover IMAGE "../common/btn_ok_hover.png" btn_ok_hover IMAGE "../common/btn_ok_hover.png"
btn_ok_focus IMAGE "../common/btn_ok_focus.png"
btn_ok_down IMAGE "../common/btn_ok_down.png"
//about_xmas IMAGE "about-xmas.png" //about_xmas IMAGE "about-xmas.png"
//two_xmas IMAGE "two_beta-xmas.png" //two_xmas IMAGE "two_beta-xmas.png"
......
...@@ -339,6 +339,12 @@ SCRIPT_FUNCTION(contains) { ...@@ -339,6 +339,12 @@ SCRIPT_FUNCTION(contains) {
SCRIPT_RETURN(input.find(match) != String::npos); SCRIPT_RETURN(input.find(match) != String::npos);
} }
SCRIPT_FUNCTION(format) {
SCRIPT_PARAM(String, format);
SCRIPT_PARAM(String, input);
SCRIPT_RETURN(format_string(_("%") + replace_all(format, _("%"), _("")), input));
}
// ----------------------------------------------------------------------------- : Tagged stuff // ----------------------------------------------------------------------------- : Tagged stuff
String replace_tag_contents(String input, const String& tag, const ScriptValueP& contents, Context& ctx) { String replace_tag_contents(String input, const String& tag, const ScriptValueP& contents, Context& ctx) {
...@@ -582,6 +588,7 @@ void init_script_functions(Context& ctx) { ...@@ -582,6 +588,7 @@ void init_script_functions(Context& ctx) {
ctx.setVariable(_("to title"), script_to_title); ctx.setVariable(_("to title"), script_to_title);
ctx.setVariable(_("substring"), script_substring); ctx.setVariable(_("substring"), script_substring);
ctx.setVariable(_("contains"), script_contains); ctx.setVariable(_("contains"), script_contains);
ctx.setVariable(_("format"), script_format);
ctx.setVariable(_("tag contents"), script_tag_contents); ctx.setVariable(_("tag contents"), script_tag_contents);
ctx.setVariable(_("remove tag"), script_tag_remove); ctx.setVariable(_("remove tag"), script_tag_remove);
ctx.setVariable(_("tag contents rule"), script_tag_contents_rule); ctx.setVariable(_("tag contents rule"), script_tag_contents_rule);
......
...@@ -60,8 +60,10 @@ enum MenuID { ...@@ -60,8 +60,10 @@ enum MenuID {
, ID_WINDOW_MAX = 220 , ID_WINDOW_MAX = 220
// Help menu (MainWindow) // Help menu (MainWindow)
, ID_HELP_INDEX = 301 , ID_HELP_INDEX = wxID_HELP_CONTENTS
, ID_HELP_ABOUT , ID_HELP_WEBSITE = 301
, ID_HELP_DOCUMENTATION
, ID_HELP_ABOUT = wxID_ABOUT
// Mode menu (SymbolWindow) // Mode menu (SymbolWindow)
, ID_MODE_MIN = 401 , ID_MODE_MIN = 401
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment