From 504269e903064ad048b41a28e604d20d8396e7bd Mon Sep 17 00:00:00 2001 From: twanvl Date: Tue, 6 Feb 2007 21:48:49 +0000 Subject: [PATCH] Moved resources to better filenames; Updated HoverButton, now an actual custom control, added focused and down states; Added Help->Website git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@196 0fc631ac-6414-0410-93d0-97cfa31319b6 --- data/en.mse-locale/locale | 5 + src/data/settings.cpp | 2 + src/data/settings.hpp | 1 + src/gui/about_window.cpp | 93 +++++++++++++++--- src/gui/about_window.hpp | 15 ++- src/gui/new_window.cpp | 2 + src/gui/set/cards_panel.cpp | 16 +-- src/gui/set/set_info_panel.cpp | 14 +-- src/gui/set/window.cpp | 44 +++++---- src/gui/set/window.hpp | 1 + src/gui/symbol/window.cpp | 14 +-- src/gui/util.cpp | 2 +- src/gui/welcome_window.cpp | 33 ++++--- src/render/symbol/filter.cpp | 2 +- src/resource/common/btn_down.png | Bin 0 -> 1202 bytes src/resource/common/btn_focus.png | Bin 0 -> 1291 bytes src/resource/common/btn_ok_down.png | Bin 0 -> 1326 bytes src/resource/common/btn_ok_focus.png | Bin 0 -> 1391 bytes src/resource/msw/mse.rc | 32 +++--- .../msw/tool/{format_bold.bmp => bold.bmp} | Bin .../msw/tool/{edit_copy.bmp => copy.bmp} | Bin .../msw/tool/{edit_cut.bmp => cut.bmp} | Bin .../msw/tool/{edit_find.bmp => find.bmp} | Bin .../tool/{format_italic.bmp => italic.bmp} | Bin .../msw/tool/{file_new.bmp => new.bmp} | Bin .../tool/{format_no_auto.bmp => no_auto.bmp} | Bin .../msw/tool/{file_open.bmp => open.bmp} | Bin .../msw/tool/{edit_paste.bmp => paste.bmp} | Bin .../msw/tool/{edit_redo.bmp => redo.bmp} | Bin .../{format_reminder.bmp => reminder.bmp} | Bin .../msw/tool/{file_save.bmp => save.bmp} | Bin .../tool/{format_symbol.bmp => symbol.bmp} | Bin .../msw/tool/{edit_undo.bmp => undo.bmp} | Bin src/script/functions.cpp | 7 ++ src/script/parser.cpp | 2 +- src/util/window_id.hpp | 6 +- 36 files changed, 203 insertions(+), 88 deletions(-) create mode 100644 src/resource/common/btn_down.png create mode 100644 src/resource/common/btn_focus.png create mode 100644 src/resource/common/btn_ok_down.png create mode 100644 src/resource/common/btn_ok_focus.png rename src/resource/msw/tool/{format_bold.bmp => bold.bmp} (100%) rename src/resource/msw/tool/{edit_copy.bmp => copy.bmp} (100%) rename src/resource/msw/tool/{edit_cut.bmp => cut.bmp} (100%) rename src/resource/msw/tool/{edit_find.bmp => find.bmp} (100%) rename src/resource/msw/tool/{format_italic.bmp => italic.bmp} (100%) rename src/resource/msw/tool/{file_new.bmp => new.bmp} (100%) rename src/resource/msw/tool/{format_no_auto.bmp => no_auto.bmp} (100%) rename src/resource/msw/tool/{file_open.bmp => open.bmp} (100%) rename src/resource/msw/tool/{edit_paste.bmp => paste.bmp} (100%) rename src/resource/msw/tool/{edit_redo.bmp => redo.bmp} (100%) rename src/resource/msw/tool/{format_reminder.bmp => reminder.bmp} (100%) rename src/resource/msw/tool/{file_save.bmp => save.bmp} (100%) rename src/resource/msw/tool/{format_symbol.bmp => symbol.bmp} (100%) rename src/resource/msw/tool/{edit_undo.bmp => undo.bmp} (100%) diff --git a/data/en.mse-locale/locale b/data/en.mse-locale/locale index 275328e7..5070d932 100644 --- a/data/en.mse-locale/locale +++ b/data/en.mse-locale/locale @@ -37,6 +37,8 @@ menu: cards tab: &Cards help: &Help + index: &Index... F1 + website: &Website... about: &About Not Quite Magic Set Editor... # symbol editor @@ -84,6 +86,9 @@ help: new window: Creates another window to edit the same set help: + index: + website: + about: # symbol editor diff --git a/src/data/settings.cpp b/src/data/settings.cpp index a9b80275..ea7d0063 100644 --- a/src/data/settings.cpp +++ b/src/data/settings.cpp @@ -90,6 +90,7 @@ Settings::Settings() , card_notes_height (40) , updates_url (_("http://magicseteditor.sourceforge.net/updates")) , check_updates (CHECK_IF_CONNECTED) + , website_url (_("http://magicseteditor.sourceforge.net/")) {} void Settings::addRecentFile(const String& filename) { @@ -158,6 +159,7 @@ IMPLEMENT_REFLECTION(Settings) { REFLECT(apprentice_location); REFLECT(updates_url); REFLECT(check_updates); + REFLECT(website_url); REFLECT(game_settings); REFLECT(stylesheet_settings); REFLECT(default_stylesheet_settings); diff --git a/src/data/settings.hpp b/src/data/settings.hpp index 58e1e102..9aa79b83 100644 --- a/src/data/settings.hpp +++ b/src/data/settings.hpp @@ -125,6 +125,7 @@ class Settings { // --------------------------------------------------- : Update checking String updates_url; CheckUpdates check_updates; + String website_url; // --------------------------------------------------- : The io diff --git a/src/gui/about_window.cpp b/src/gui/about_window.cpp index 265a7e3b..390b61d4 100644 --- a/src/gui/about_window.cpp +++ b/src/gui/about_window.cpp @@ -14,12 +14,12 @@ // ----------------------------------------------------------------------------- : About window 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"))) , logo2(load_resource_image(_("two"))) { // 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(); ok_button->Move(ws.GetWidth() - bs.GetWidth(), ws.GetHeight() - bs.GetHeight()); // align bottom right } @@ -65,22 +65,81 @@ END_EVENT_TABLE () HoverButton::HoverButton(Window* parent, int id, const String& name) - : normal(load_resource_image(name + _("_NORMAL"))) - , hover (load_resource_image(name + _("_HOVER"))) + : wxControl(parent, id, wxDefaultPosition, wxDefaultSize, wxNO_BORDER) + , 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&) { - SetBitmapLabel(hover); - Refresh(false); + hover = true; + refreshIfNeeded(); } void HoverButton::onMouseLeave(wxMouseEvent&) { - SetBitmapLabel(normal); - Refresh(false); + hover = 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&) { wxPaintDC dc(this); @@ -95,13 +154,21 @@ void HoverButton::draw(DC& dc) { dc.SetBrush(Color(240,247,255)); dc.DrawRectangle(0, 0, ws.GetWidth(), ws.GetHeight()); // 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_LEAVE_WINDOW (HoverButton::onMouseLeave) EVT_PAINT (HoverButton::onPaint) EVT_SET_FOCUS (HoverButton::onFocus) 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 () diff --git a/src/gui/about_window.hpp b/src/gui/about_window.hpp index b83dc43c..1e789887 100644 --- a/src/gui/about_window.hpp +++ b/src/gui/about_window.hpp @@ -31,23 +31,34 @@ class AboutWindow : public wxDialog { // ----------------------------------------------------------------------------- : Button with image and hover effect // A button that changes images on mouseenter/leave -class HoverButton : public wxBitmapButton { +class HoverButton : public wxControl { public: HoverButton(Window* parent, int id, const String& name); private: 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 onMouseLeave(wxMouseEvent&); void onFocus (wxFocusEvent& ev); void onKillFocus (wxFocusEvent& ev); 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: virtual void draw(DC& dc); + int drawDelta() const; }; diff --git a/src/gui/new_window.cpp b/src/gui/new_window.cpp index 3a45251e..d22aa541 100644 --- a/src/gui/new_window.cpp +++ b/src/gui/new_window.cpp @@ -27,6 +27,7 @@ SetP new_set_window(Window* parent) { NewSetWindow::NewSetWindow(Window* parent) : wxDialog(parent, wxID_ANY, _("New set"), wxDefaultPosition, wxSize(530,320), wxDEFAULT_DIALOG_STYLE) { + wxBusyCursor wait; // init controls game_list = new PackageList (this, ID_GAME_LIST); stylesheet_list = new PackageList (this, ID_STYLESHEET_LIST); @@ -53,6 +54,7 @@ NewSetWindow::NewSetWindow(Window* parent) } void NewSetWindow::onGameSelect(wxCommandEvent&) { + wxBusyCursor wait; GameP game = game_list->getSelection(); settings.default_game = game->name(); GameSettings& gs = settings.gameSettingsFor(*game); diff --git a/src/gui/set/cards_panel.cpp b/src/gui/set/cards_panel.cpp index 3ace0c43..aea41d07 100644 --- a/src/gui/set/cards_panel.cpp +++ b/src/gui/set/cards_panel.cpp @@ -67,10 +67,10 @@ void CardsPanel::onChangeSet() { void CardsPanel::initUI(wxToolBar* tb, wxMenuBar* mb) { // Toolbar - tb->AddTool(ID_FORMAT_BOLD, _(""), load_resource_tool_image(_("format_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_SYMBOL, _(""), load_resource_tool_image(_("format_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_BOLD, _(""), load_resource_tool_image(_("bold")), wxNullBitmap, wxITEM_CHECK, _TOOL_("bold")); + tb->AddTool(ID_FORMAT_ITALIC, _(""), load_resource_tool_image(_("italic")), wxNullBitmap, wxITEM_CHECK, _TOOL_("italic")); + tb->AddTool(ID_FORMAT_SYMBOL, _(""), load_resource_tool_image(_("symbol")), wxNullBitmap, wxITEM_CHECK, _TOOL_("symbols")); + tb->AddTool(ID_FORMAT_REMINDER, _(""), load_resource_tool_image(_("reminder")), wxNullBitmap, wxITEM_CHECK, _TOOL_("reminder text")); tb->AddSeparator(); 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")); @@ -100,10 +100,10 @@ void CardsPanel::initUI(wxToolBar* tb, wxMenuBar* mb) { mb->Insert(2, menuCard, _("&Cards")); 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_ITALIC, _("format_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_REMINDER, _("format_reminder"), _("Reminder Text\tCtrl+R"), _("Show reminder text for the selected keyword"), wxITEM_CHECK); + menuFormat->Append(ID_FORMAT_BOLD, _("bold"), _("Bold\tCtrl+B"), _("Makes the selected text bold"), wxITEM_CHECK); + menuFormat->Append(ID_FORMAT_ITALIC, _("italic"), _("Italic\tCtrl+I"), _("Makes the selected text italic"), wxITEM_CHECK); + menuFormat->Append(ID_FORMAT_SYMBOL, _("symbol"), _("Symbols\tCtrl+M"), _("Draws the selected text with symbols"), 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")); } diff --git a/src/gui/set/set_info_panel.cpp b/src/gui/set/set_info_panel.cpp index 42725101..5a4096c3 100644 --- a/src/gui/set/set_info_panel.cpp +++ b/src/gui/set/set_info_panel.cpp @@ -34,16 +34,16 @@ void SetInfoPanel::onChangeSet() { void SetInfoPanel::initUI(wxToolBar* tb, wxMenuBar* mb) { // Toolbar - tb->AddTool(ID_FORMAT_BOLD, _(""), load_resource_tool_image(_("format_bold")), wxNullBitmap, wxITEM_CHECK, _("Bold")); - tb->AddTool(ID_FORMAT_ITALIC, _(""), load_resource_tool_image(_("format_italic")), wxNullBitmap, wxITEM_CHECK, _("Italic")); - tb->AddTool(ID_FORMAT_SYMBOL, _(""), load_resource_tool_image(_("format_symbol")), wxNullBitmap, wxITEM_CHECK, _("Symbols")); + tb->AddTool(ID_FORMAT_BOLD, _(""), load_resource_tool_image(_("bold")), wxNullBitmap, wxITEM_CHECK, _("Bold")); + tb->AddTool(ID_FORMAT_ITALIC, _(""), load_resource_tool_image(_("italic")), wxNullBitmap, wxITEM_CHECK, _("Italic")); + tb->AddTool(ID_FORMAT_SYMBOL, _(""), load_resource_tool_image(_("symbol")), wxNullBitmap, wxITEM_CHECK, _("Symbols")); tb->Realize(); // Menus 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_ITALIC, _("format_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_REMINDER, _("format_reminder"), _("Reminder Text\tCtrl+R"), _("Show reminder text for the selected keyword"), wxITEM_CHECK); + menuFormat->Append(ID_FORMAT_BOLD, _("bold"), _("Bold\tCtrl+B"), _("Makes the selected text bold"), wxITEM_CHECK); + menuFormat->Append(ID_FORMAT_ITALIC, _("italic"), _("Italic\tCtrl+I"), _("Makes the selected text italic"), wxITEM_CHECK); + menuFormat->Append(ID_FORMAT_SYMBOL, _("symbol"), _("Symbols\tCtrl+M"), _("Draws the selected text with symbols"), 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")); } diff --git a/src/gui/set/window.cpp b/src/gui/set/window.cpp index 1843f593..b6a72d0c 100644 --- a/src/gui/set/window.cpp +++ b/src/gui/set/window.cpp @@ -48,9 +48,9 @@ SetWindow::SetWindow(Window* parent, const SetP& set) // initialize menu bar wxMenuBar* menuBar = new wxMenuBar(); IconMenu* menuFile = new IconMenu(); - menuFile->Append(ID_FILE_NEW, _("file_new"), _MENU_("new set"), _HELP_("new set")); - menuFile->Append(ID_FILE_OPEN, _("file_open"), _MENU_("open set"), _HELP_("open set")); - menuFile->Append(ID_FILE_SAVE, _("file_save"), _MENU_("save set"), _HELP_("save set")); + menuFile->Append(ID_FILE_NEW, _("new"), _MENU_("new set"), _HELP_("new set")); + menuFile->Append(ID_FILE_OPEN, _("open"), _MENU_("open set"), _HELP_("open 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")); IconMenu* menuExport = new IconMenu(); 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) menuBar->Append(menuFile, _MENU_("file")); IconMenu* menuEdit = new IconMenu(); - menuEdit->Append(ID_EDIT_UNDO, _("edit_undo"), _MENU_1_("undo",wxEmptyString), _HELP_("undo")); - menuEdit->Append(ID_EDIT_REDO, _("edit_redo"), _MENU_1_("redo",wxEmptyString), _HELP_("redo")); + menuEdit->Append(ID_EDIT_UNDO, _("undo"), _MENU_1_("undo",wxEmptyString), _HELP_("undo")); + menuEdit->Append(ID_EDIT_REDO, _("redo"), _MENU_1_("redo",wxEmptyString), _HELP_("redo")); menuEdit->AppendSeparator(); - menuEdit->Append(ID_EDIT_CUT, _("edit_cut"), _MENU_("cut"), _HELP_("cut")); - menuEdit->Append(ID_EDIT_COPY, _("edit_copy"), _MENU_("copy"), _HELP_("copy")); - menuEdit->Append(ID_EDIT_PASTE, _("edit_paste"), _MENU_("paste"), _HELP_("paste")); + menuEdit->Append(ID_EDIT_CUT, _("cut"), _MENU_("cut"), _HELP_("cut")); + menuEdit->Append(ID_EDIT_COPY, _("copy"), _MENU_("copy"), _HELP_("copy")); + menuEdit->Append(ID_EDIT_PASTE, _("paste"), _MENU_("paste"), _HELP_("paste")); 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_REPLACE, _MENU_("replace"), _("")); menuEdit->AppendSeparator(); @@ -91,9 +91,10 @@ SetWindow::SetWindow(Window* parent, const SetP& set) menuBar->Append(menuWindow, _MENU_("window")); 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->Append(ID_HELP_ABOUT, _MENU_("about"), _("")); + menuHelp->Append(ID_HELP_ABOUT, _MENU_("about"), _HELP_("about")); menuBar->Append(menuHelp, _MENU_("help")); SetMenuBar(menuBar); @@ -105,16 +106,16 @@ SetWindow::SetWindow(Window* parent, const SetP& set) // tool bar wxToolBar* tb = CreateToolBar(wxTB_FLAT | wxNO_BORDER | wxTB_HORIZONTAL); 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_OPEN, _(""), load_resource_tool_image(_("file_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_NEW, _(""), load_resource_tool_image(_("new")), wxNullBitmap, wxITEM_NORMAL, _TOOL_("new set"), _HELP_("new 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(_("save")), wxNullBitmap, wxITEM_NORMAL, _TOOL_("save set"), _HELP_("save set")); tb->AddSeparator(); - tb->AddTool(ID_EDIT_CUT, _(""), load_resource_tool_image(_("edit_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_PASTE, _(""), load_resource_tool_image(_("edit_paste")), wxNullBitmap, wxITEM_NORMAL, _TOOL_("paste")); + tb->AddTool(ID_EDIT_CUT, _(""), load_resource_tool_image(_("cut")), wxNullBitmap, wxITEM_NORMAL, _TOOL_("cut")); + tb->AddTool(ID_EDIT_COPY, _(""), load_resource_tool_image(_("copy")), wxNullBitmap, wxITEM_NORMAL, _TOOL_("copy")); + tb->AddTool(ID_EDIT_PASTE, _(""), load_resource_tool_image(_("paste")), wxNullBitmap, wxITEM_NORMAL, _TOOL_("paste")); tb->AddSeparator(); - tb->AddTool(ID_EDIT_UNDO, _(""), load_resource_tool_image(_("edit_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_UNDO, _(""), load_resource_tool_image(_("undo")), wxNullBitmap, wxITEM_NORMAL, _TOOL_1_("undo",wxEmptyString)); + tb->AddTool(ID_EDIT_REDO, _(""), load_resource_tool_image(_("redo")), wxNullBitmap, wxITEM_NORMAL, _TOOL_1_("redo",wxEmptyString)); tb->AddSeparator(); tb->Realize(); @@ -546,6 +547,10 @@ void SetWindow::onHelpIndex(wxCommandEvent&) { // wnd->Show(); } +void SetWindow::onHelpWebsite(wxCommandEvent&) { + wxLaunchDefaultBrowser(settings.website_url); +} + void SetWindow::onHelpAbout(wxCommandEvent&) { AboutWindow wnd(this); wnd.ShowModal(); @@ -592,6 +597,7 @@ BEGIN_EVENT_TABLE(SetWindow, wxFrame) EVT_MENU (ID_WINDOW_NEW, SetWindow::onWindowNewWindow) EVT_TOOL_RANGE (ID_WINDOW_MIN, ID_WINDOW_MAX, SetWindow::onWindowSelect) EVT_MENU (ID_HELP_INDEX, SetWindow::onHelpIndex) + EVT_MENU (ID_HELP_WEBSITE, SetWindow::onHelpWebsite) EVT_MENU (ID_HELP_ABOUT, SetWindow::onHelpAbout) 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 diff --git a/src/gui/set/window.hpp b/src/gui/set/window.hpp index d23c32ba..816154b5 100644 --- a/src/gui/set/window.hpp +++ b/src/gui/set/window.hpp @@ -139,6 +139,7 @@ class SetWindow : public wxFrame, public SetView { // --------------------------------------------------- : Window events - menu - help void onHelpIndex (wxCommandEvent&); + void onHelpWebsite (wxCommandEvent&); void onHelpAbout (wxCommandEvent&); // --------------------------------------------------- : Window events - other diff --git a/src/gui/symbol/window.cpp b/src/gui/symbol/window.cpp index 75962cdc..dc7d86d2 100644 --- a/src/gui/symbol/window.cpp +++ b/src/gui/symbol/window.cpp @@ -58,9 +58,9 @@ void SymbolWindow::init(Window* parent, SymbolP symbol) { // Menu bar wxMenuBar* menuBar = new wxMenuBar(); IconMenu* menuFile = new IconMenu(); - menuFile->Append(ID_FILE_NEW, _("file_new"), _MENU_("new symbol"), _HELP_("new symbol")); - menuFile->Append(ID_FILE_OPEN, _("file_open"), _MENU_("open symbol"), _HELP_("open symbol")); - menuFile->Append(ID_FILE_SAVE, _("file_save"), _MENU_("save symbol"), _HELP_("save symbol")); + menuFile->Append(ID_FILE_NEW, _("new"), _MENU_("new symbol"), _HELP_("new symbol")); + menuFile->Append(ID_FILE_OPEN, _("open"), _MENU_("open symbol"), _HELP_("open 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->AppendSeparator(); menuFile->Append(ID_FILE_STORE, _("apply"), _MENU_("store symbol"), _HELP_("store symbol")); @@ -69,8 +69,8 @@ void SymbolWindow::init(Window* parent, SymbolP symbol) { menuBar->Append(menuFile, _MENU_("file")); IconMenu* menuEdit = new IconMenu(); - menuEdit->Append(ID_EDIT_UNDO, _("edit_undo"), _MENU_1_("undo",wxEmptyString), _HELP_("undo")); - menuEdit->Append(ID_EDIT_REDO, _("edit_redo"), _MENU_1_("redo",wxEmptyString), _HELP_("redo")); + menuEdit->Append(ID_EDIT_UNDO, _("undo"), _MENU_1_("undo",wxEmptyString), _HELP_("undo")); + menuEdit->Append(ID_EDIT_REDO, _("redo"), _MENU_1_("redo",wxEmptyString), _HELP_("redo")); menuEdit->AppendSeparator(); menuEdit->Append(ID_EDIT_DUPLICATE, _("duplicate"), _MENU_("duplicate"), _HELP_("duplicate")); menuBar->Append(menuEdit, _MENU_("edit")); @@ -93,8 +93,8 @@ void SymbolWindow::init(Window* parent, SymbolP symbol) { 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->AddSeparator(); - tb->AddTool(ID_EDIT_UNDO, _("Undo"), load_resource_tool_image(_("edit_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_UNDO, _("Undo"), load_resource_tool_image(_("undo")), wxNullBitmap, wxITEM_NORMAL, _TOOL_1_("undo",wxEmptyString)); + tb->AddTool(ID_EDIT_REDO, _("Redo"), load_resource_tool_image(_("redo")), wxNullBitmap, wxITEM_NORMAL, _TOOL_1_("redo",wxEmptyString)); tb->Realize(); // Edit mode toolbar diff --git a/src/gui/util.cpp b/src/gui/util.cpp index ebfd4cdf..2d83bb29 100644 --- a/src/gui/util.cpp +++ b/src/gui/util.cpp @@ -90,7 +90,7 @@ Image load_resource_image(const String& name) { return wxImage(stream); #elif defined(__linux__) 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; if (wxFileExists(file + _(".png"))) resource.LoadFile(file + _(".png")); else if (wxFileExists(file + _(".bmp"))) resource.LoadFile(file + _(".bmp")); diff --git a/src/gui/welcome_window.cpp b/src/gui/welcome_window.cpp index 83170b43..b00c3750 100644 --- a/src/gui/welcome_window.cpp +++ b/src/gui/welcome_window.cpp @@ -16,28 +16,34 @@ #include #include +// 2007-02-06: New HoverButton, hopefully this on works on GTK +#define USE_HOVERBUTTON + // ----------------------------------------------------------------------------- : 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"))) , logo2(load_resource_image(_("two"))) { SetIcon(load_resource_icon(_("app"))); // init controls - #ifdef __WXMSW__ - wxButton* 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")); + #ifdef USE_HOVERBUTTON + wxControl* new_set = new HoverButtonExt(this, ID_FILE_NEW, load_resource_image(_("welcome_new")), _BUTTON_("new set"), _HELP_("new set")); + wxControl* open_set = new HoverButtonExt(this, ID_FILE_OPEN, load_resource_image(_("welcome_open")), _BUTTON_("open set"), _HELP_("open set")); #else - // For now, hover buttons don't work on GTK - wxButton* new_set = new wxButton(this, ID_FILE_NEW, _BUTTON_("new set")); - wxButton* open_set = new wxButton(this, ID_FILE_OPEN, _BUTTON_("open set")); + wxControl* new_set = new wxButton(this, ID_FILE_NEW, _BUTTON_("new set")); + wxControl* open_set = new wxButton(this, ID_FILE_OPEN, _BUTTON_("open set")); #endif - wxButton* open_last = 0; + wxControl* open_last = nullptr; if (!settings.recent_sets.empty()) { wxFileName n(settings.recent_sets.front()); - open_last = new HoverButtonExt(this, ID_FILE_RECENT, load_resource_image(_("welcome_last")), _BUTTON_("last opened set"), _("Open '") + n.GetName() + _("'")); + #ifdef USE_HOVERBUTTON + 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); @@ -121,13 +127,14 @@ HoverButtonExt::HoverButtonExt(Window* parent, int id, const wxImage& icon, cons void HoverButtonExt::draw(DC& dc) { // draw button -// HoverButton::draw(dc); + HoverButton::draw(dc); + int d = drawDelta(); // icon - if (icon.Ok()) dc.DrawBitmap(icon, 7, 7); + if (icon.Ok()) dc.DrawBitmap(icon, d+7, d+7); // text dc.SetTextForeground(*wxBLACK); dc.SetFont(font_large); - dc.DrawText(label, 44, 7); + dc.DrawText(label, d+44, d+7); dc.SetFont(font_small); - dc.DrawText(sub_label, 45, 28); + dc.DrawText(sub_label, d+45, d+28); } diff --git a/src/render/symbol/filter.cpp b/src/render/symbol/filter.cpp index 870b4315..a381898f 100644 --- a/src/render/symbol/filter.cpp +++ b/src/render/symbol/filter.cpp @@ -24,7 +24,7 @@ void filter_symbol(Image& symbol, const SymbolFilter& filter) { alpha = (Byte*) malloc (sizeof(Byte) * width * height); memset(alpha, 255, width * height); symbol.SetAlpha(alpha); - } + } for (UInt y = 0 ; y < width ; ++y) { for (UInt x = 0 ; x < height ; ++x) { // Determine set diff --git a/src/resource/common/btn_down.png b/src/resource/common/btn_down.png new file mode 100644 index 0000000000000000000000000000000000000000..6ff44f0575ba62fd60cead94a532e6a8bfae8e15 GIT binary patch literal 1202 zcmeAS@N?(olHy`uVBq!ia0vp^hk@9FgAGVJX!#TXDb50q$YKTtKA;5OVaDV6D^fs$ zC9V-A&iT2ysd*&~44qoNKn*PZo-U3d6?5L+z3m+mD8c%{*tpMBE22kAu*=jjgntt2 zMdvR9g0^3thmE0a z_Q%5M-TO@4?>F0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n}D z1LLfmnw1OrM6P(g@f#16?SCI?yDvpNSJ8`Pxrc`Sgas%2S&TGogA)*~)`0!x%7Art zIJ;Qyt?WF_%4Q;W<(6``-*B-X3@K*FSZ;$B_iqu;SM(xT?t23hFt5wQVx+0-xz5CG zsyh&{j^o@lR%i2DEv!60%L*$tmqWw1LtwI`!@^}YXm*XslCS7RvfKmx6JR{l7L<$%Wd+EgYJl%MLC$A zk_wCR?E%l*U#(_SvYPWZSeeSD&~kjz9LQc>EL*M`^dedAzUy}&w!_7u9IV^*HtUJc zA3QeY-0m}d5Tn(>;{|Jd$L0~SPi`t>`&-}bU~RXxcFK}#GVzH&x>A?v|=zq=Xn zTovd=vfO(2A0V{%vM3jIeZNCN#U9WmvZNWRST$ISw?OrULBG0liQK%6+kNHN&bT02 zqXp}Rl8EOidXX&G;UX7t_Od89wSBjt>Pr{w{Oo(!du8lD$srh`7nHk{kTxT^Z;~4n z4qsuBAe-+!)dkciNOPl~uKa#)a?!J1969UP9A~<3H z{SEmKZL(nc7c&6|Xfr;UOdMO5;M+0p5o9Uee-8RcM?Ycx{S|}<3qrKmfIg9Ayog2c zz7^B(!jBqhc>fmkk&J%ATDS19V7}re_(~f+`U!i*&1AuRtyu6iVruj=qqSn<##cE8 kU)`ugKYV>|gb29(1KAe+wyW5e`v3p{07*qoM6N<$g2*m;4FCWD literal 0 HcmV?d00001 diff --git a/src/resource/common/btn_ok_focus.png b/src/resource/common/btn_ok_focus.png new file mode 100644 index 0000000000000000000000000000000000000000..d2936ba98425db7f5d3bbd93895fda908b74322e GIT binary patch literal 1391 zcmV-#1(5oQP)pF33NqRbVF}#ZDnqB004<9jRpV!1q?|r=|Ds9mg zflwnzC~go4mX<~+q7++2qvg@R$8+wU8F!(}E)#eB!A$by?A^I{a`&6V*=6pPq{RyJFyrm=H5! zL85gOEbPU^o($~GtzaRx^wyAc6(V)KH??Ha^u#OwZ56ewMl2~vQmxv(e>?Ou+X6I?#w~PxvL^-Nz2eUl96VO9`TU%{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