mirror of
https://github.com/alexkay/spek.git
synced 2025-06-14 14:22:10 +03:00
Open file dialogue
This commit is contained in:
parent
7e5ca1765a
commit
4f8de5bdea
@ -77,6 +77,22 @@ SpekWindow::SpekWindow(const wxString& title) : wxFrame(NULL, -1, title)
|
|||||||
|
|
||||||
void SpekWindow::OnOpen(wxCommandEvent& WXUNUSED(event))
|
void SpekWindow::OnOpen(wxCommandEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
|
static wxString cur_dir = wxGetHomeDir();
|
||||||
|
wxFileDialog *dlg = new wxFileDialog(
|
||||||
|
this,
|
||||||
|
_("Open File"),
|
||||||
|
cur_dir,
|
||||||
|
wxEmptyString,
|
||||||
|
wxT("*.*"),
|
||||||
|
wxFD_OPEN
|
||||||
|
);
|
||||||
|
|
||||||
|
if (dlg->ShowModal() == wxID_OK) {
|
||||||
|
cur_dir = dlg->GetDirectory();
|
||||||
|
Open(dlg->GetPath());
|
||||||
|
}
|
||||||
|
|
||||||
|
dlg->Destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpekWindow::OnSave(wxCommandEvent& WXUNUSED(event))
|
void SpekWindow::OnSave(wxCommandEvent& WXUNUSED(event))
|
||||||
@ -95,3 +111,7 @@ void SpekWindow::OnPreferences(wxCommandEvent& WXUNUSED(event))
|
|||||||
void SpekWindow::OnAbout(wxCommandEvent& WXUNUSED(event))
|
void SpekWindow::OnAbout(wxCommandEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SpekWindow::Open(const wxString& path)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
@ -26,14 +26,15 @@ class SpekWindow : public wxFrame
|
|||||||
public:
|
public:
|
||||||
SpekWindow(const wxString& title);
|
SpekWindow(const wxString& title);
|
||||||
|
|
||||||
protected:
|
private:
|
||||||
void OnOpen(wxCommandEvent& event);
|
void OnOpen(wxCommandEvent& event);
|
||||||
void OnSave(wxCommandEvent& event);
|
void OnSave(wxCommandEvent& event);
|
||||||
void OnExit(wxCommandEvent& event);
|
void OnExit(wxCommandEvent& event);
|
||||||
void OnPreferences(wxCommandEvent& event);
|
void OnPreferences(wxCommandEvent& event);
|
||||||
void OnAbout(wxCommandEvent& event);
|
void OnAbout(wxCommandEvent& event);
|
||||||
|
|
||||||
private:
|
void Open(const wxString& path);
|
||||||
|
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -110,23 +110,6 @@ namespace Spek {
|
|||||||
title = _("Spek - %s").printf (Path.get_basename (file_name));
|
title = _("Spek - %s").printf (Path.get_basename (file_name));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void on_file_open () {
|
|
||||||
var chooser = new FileChooserDialog (
|
|
||||||
_("Open File"), this, FileChooserAction.OPEN,
|
|
||||||
Stock.CANCEL, ResponseType.CANCEL,
|
|
||||||
Stock.OPEN, ResponseType.ACCEPT, null);
|
|
||||||
chooser.set_default_response (ResponseType.ACCEPT);
|
|
||||||
chooser.select_multiple = false;
|
|
||||||
chooser.set_current_folder (cur_dir);
|
|
||||||
chooser.add_filter (filter_all);
|
|
||||||
chooser.add_filter (filter_audio);
|
|
||||||
chooser.set_filter (filter_audio);
|
|
||||||
if (chooser.run () == ResponseType.ACCEPT) {
|
|
||||||
open_file (chooser.get_filename ());
|
|
||||||
}
|
|
||||||
chooser.destroy ();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void on_file_save () {
|
private void on_file_save () {
|
||||||
var chooser = new FileChooserDialog (
|
var chooser = new FileChooserDialog (
|
||||||
_("Save Spectrogram"), this, FileChooserAction.SAVE,
|
_("Save Spectrogram"), this, FileChooserAction.SAVE,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user