Show online manual on F1, closes #24

This commit is contained in:
Alexander Kojevnikov 2012-09-19 22:26:42 -07:00
parent 7214286028
commit f073eec154
11 changed files with 30 additions and 15 deletions

View File

@ -14,21 +14,21 @@ EXTRA_DIST = \
dist/osx/Info.plist \
dist/osx/README.md \
dist/osx/Spek.icns \
dist/osx/about.png \
dist/osx/bundle.sh \
dist/osx/close.png \
dist/osx/help.png \
dist/osx/open.png \
dist/osx/save.png \
dist/win/README.md \
dist/win/SpekInstallDir.wxs \
dist/win/SpekInstallDirDlg.wxs
dist/win/about.ico \
dist/win/banner.bmp \
dist/win/bundle.bat \
dist/win/bundle.sh \
dist/win/close.ico \
dist/win/dialog.bmp \
dist/win/fix-msi.js \
dist/win/help.ico \
dist/win/open.ico \
dist/win/save.ico \
dist/win/spek.ico \

BIN
dist/osx/about.png vendored

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

BIN
dist/osx/help.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

BIN
dist/win/about.ico vendored

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

BIN
dist/win/help.ico vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

2
dist/win/spek.rc vendored
View File

@ -1,5 +1,5 @@
aaaa ICON "spek.ico"
about ICON "about.ico"
help ICON "help.ico"
open ICON "open.ico"
save ICON "save.ico"
close ICON "close.ico"

View File

@ -37,8 +37,8 @@ wxBitmap SpekArtProvider::CreateBitmap(
if (id == ART_SPEK) {
return wxArtProvider::GetBitmap(wxT("spek"), client, size);
}
if (id == ART_ABOUT) {
return wxArtProvider::GetBitmap(wxT("gtk-about"), client, size);
if (id == ART_HELP) {
return wxArtProvider::GetBitmap(wxT("gtk-help"), client, size);
}
if (id == ART_OPEN) {
return wxArtProvider::GetBitmap(wxT("gtk-open"), client, size);
@ -51,8 +51,8 @@ wxBitmap SpekArtProvider::CreateBitmap(
}
#endif
#ifdef OS_WIN
if (id == ART_ABOUT) {
return wxIcon(wxT("about"), wxBITMAP_TYPE_ICO_RESOURCE, 24, 24);
if (id == ART_HELP) {
return wxIcon(wxT("help"), wxBITMAP_TYPE_ICO_RESOURCE, 24, 24);
}
if (id == ART_OPEN) {
return wxIcon(wxT("open"), wxBITMAP_TYPE_ICO_RESOURCE, 24, 24);
@ -65,8 +65,8 @@ wxBitmap SpekArtProvider::CreateBitmap(
}
#endif
#ifdef OS_OSX
if (id == ART_ABOUT) {
return wxBitmap(wxT("about"), wxBITMAP_TYPE_PNG_RESOURCE);
if (id == ART_HELP) {
return wxBitmap(wxT("help"), wxBITMAP_TYPE_PNG_RESOURCE);
}
if (id == ART_OPEN) {
return wxBitmap(wxT("open"), wxBITMAP_TYPE_PNG_RESOURCE);

View File

@ -24,7 +24,7 @@
#define ART_SPEK wxT("art-spek")
#define ART_OPEN wxT("art-open")
#define ART_SAVE wxT("art-save")
#define ART_ABOUT wxT("art-about")
#define ART_HELP wxT("art-help")
#define ART_CLOSE wxT("art-close")
void spek_artwork_init();

View File

@ -127,6 +127,9 @@ void SpekSpectrogram::on_char(wxKeyEvent& evt)
this->urange = MIN(this->urange + 1, MAX_RANGE);
} else if (CS && dn) {
this->urange = MAX(this->urange - 1, this->lrange + 1);
} else {
evt.Skip();
return;
}
start();

View File

@ -45,6 +45,7 @@ BEGIN_EVENT_TABLE(SpekWindow, wxFrame)
EVT_MENU(wxID_SAVE, SpekWindow::on_save)
EVT_MENU(wxID_EXIT, SpekWindow::on_exit)
EVT_MENU(wxID_PREFERENCES, SpekWindow::on_preferences)
EVT_MENU(wxID_HELP, SpekWindow::on_help)
EVT_MENU(wxID_ABOUT, SpekWindow::on_about)
EVT_COMMAND(-1, SPEK_NOTIFY_EVENT, SpekWindow::on_notify)
END_EVENT_TABLE()
@ -97,13 +98,16 @@ SpekWindow::SpekWindow(const wxString& path) :
wxMenu *menu_edit = new wxMenu();
wxMenuItem *menu_edit_prefs = new wxMenuItem(menu_edit, wxID_PREFERENCES);
menu_edit_prefs->SetItemLabel(menu_edit_prefs->GetItemLabelText() + wxT("\tCtrl+E"));
menu_edit_prefs->SetItemLabel(menu_edit_prefs->GetItemLabelText() + wxT("\tCtrl-E"));
menu_edit->Append(menu_edit_prefs);
menu->Append(menu_edit, _("&Edit"));
wxMenu *menu_help = new wxMenu();
wxMenuItem *menu_help_contents = new wxMenuItem(
menu_help, wxID_HELP, _("&Help") + wxT("\tF1"));
menu_help->Append(menu_help_contents);
wxMenuItem *menu_help_about = new wxMenuItem(menu_help, wxID_ABOUT);
menu_help_about->SetItemLabel(menu_help_about->GetItemLabelText() + wxT("\tF1"));
menu_help_about->SetItemLabel(menu_help_about->GetItemLabelText() + wxT("\tShift-F1"));
menu_help->Append(menu_help_about);
menu->Append(menu_help, _("&Help"));
@ -125,10 +129,10 @@ SpekWindow::SpekWindow(const wxString& path) :
#if wxCHECK_VERSION(2, 9, 1)
toolbar->AddStretchableSpace();
toolbar->AddTool(
wxID_ABOUT,
wxID_HELP,
wxEmptyString,
wxArtProvider::GetBitmap(ART_ABOUT, wxART_TOOLBAR),
menu_help_about->GetItemLabelText()
wxArtProvider::GetBitmap(ART_HELP, wxART_TOOLBAR),
_("Help")
);
#endif
toolbar->Realize();
@ -305,6 +309,13 @@ void SpekWindow::on_preferences(wxCommandEvent& event)
dlg.ShowModal();
}
void SpekWindow::on_help(wxCommandEvent& event)
{
wxLaunchDefaultBrowser(
wxString::Format(wxT("http://spek-project.org/man-%s.html"), wxT(PACKAGE_VERSION))
);
}
void SpekWindow::on_about(wxCommandEvent& event)
{
wxAboutDialogInfo info;

View File

@ -34,6 +34,7 @@ private:
void on_save(wxCommandEvent& event);
void on_exit(wxCommandEvent& event);
void on_preferences(wxCommandEvent& event);
void on_help(wxCommandEvent& event);
void on_about(wxCommandEvent& event);
void on_notify(wxCommandEvent& event);
void on_visit(wxCommandEvent& event);