Merge remote-tracking branch 'origin/master' into audio_recording

This commit is contained in:
vsonnier 2018-01-12 19:31:33 +01:00
commit 4d0f3a794d
4 changed files with 33 additions and 9 deletions

View File

@ -722,9 +722,11 @@ wxMenu *AppFrame::makeFileMenu() {
menu->AppendSeparator();
menu->Append(wxID_RESET, "&Reset Session");
menu->AppendSeparator();
menu->Append(wxID_OPEN_BOOKMARK, "Open Bookmark");
menu->Append(wxID_SAVE_BOOKMARK, "Save Bookmark");
menu->Append(wxID_SAVEAS_BOOKMARK, "Save Bookmark As..");
menu->Append(wxID_OPEN_BOOKMARKS, "Open Bookmarks");
menu->Append(wxID_SAVE_BOOKMARKS, "Save Bookmarks");
menu->Append(wxID_SAVEAS_BOOKMARKS, "Save Bookmarks As..");
menu->AppendSeparator();
menu->Append(wxID_RESET_BOOKMARKS, "Reset Bookmarks");
#ifndef __APPLE__
menu->AppendSeparator();
@ -1429,7 +1431,7 @@ bool AppFrame::actionOnMenuLoadSave(wxCommandEvent& event) {
}
//save mecanic for bookmark files
else if (event.GetId() == wxID_SAVE_BOOKMARK) {
else if (event.GetId() == wxID_SAVE_BOOKMARKS) {
if (!currentBookmarkFile.empty()) {
wxGetApp().getBookmarkMgr().saveToFile(currentBookmarkFile, false, true);
@ -1456,7 +1458,7 @@ bool AppFrame::actionOnMenuLoadSave(wxCommandEvent& event) {
return true;
}
else if (event.GetId() == wxID_OPEN_BOOKMARK) {
else if (event.GetId() == wxID_OPEN_BOOKMARKS) {
wxFileDialog openFileDialog(this, _("Open XML Bookmark file"), "", "", "XML files (*.xml)|*.xml", wxFD_OPEN | wxFD_FILE_MUST_EXIST);
if (openFileDialog.ShowModal() == wxID_CANCEL) {
@ -1476,7 +1478,7 @@ bool AppFrame::actionOnMenuLoadSave(wxCommandEvent& event) {
return true;
}
else if (event.GetId() == wxID_SAVEAS_BOOKMARK) {
else if (event.GetId() == wxID_SAVEAS_BOOKMARKS) {
wxFileDialog saveFileDialog(this, _("Save XML Bookmark file"), "", "", "XML files (*.xml)|*.xml", wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
if (saveFileDialog.ShowModal() == wxID_CANCEL) {
@ -1498,6 +1500,14 @@ bool AppFrame::actionOnMenuLoadSave(wxCommandEvent& event) {
return true;
}
else if (event.GetId() == wxID_RESET_BOOKMARKS) {
wxGetApp().getBookmarkMgr().resetBookmarks();
wxGetApp().getBookmarkMgr().updateBookmarks();
wxGetApp().getBookmarkMgr().updateActiveList();
return true;
}
return false;
}

View File

@ -44,9 +44,10 @@
#define wxID_ABOUT_CUBICSDR 2013
#define wxID_RECORDING_PATH 2014
#define wxID_OPEN_BOOKMARK 2020
#define wxID_SAVE_BOOKMARK 2021
#define wxID_SAVEAS_BOOKMARK 2022
#define wxID_OPEN_BOOKMARKS 2020
#define wxID_SAVE_BOOKMARKS 2021
#define wxID_SAVEAS_BOOKMARKS 2022
#define wxID_RESET_BOOKMARKS 2023
#define wxID_MAIN_SPLITTER 2050
#define wxID_VIS_SPLITTER 2051

View File

@ -238,6 +238,17 @@ bool BookmarkMgr::loadFromFile(std::string bookmarkFn, bool backup, bool useFull
return loadStatusOk;
}
void BookmarkMgr::resetBookmarks() {
// Clear any active data
bmData.clear();
clearRecents();
clearRanges();
bmDataSorted.clear();
wxGetApp().getAppFrame()->getBookmarkView()->loadDefaultRanges();
}
bool BookmarkMgr::hasLastLoad(std::string bookmarkFn) {
wxFileName lastLoaded(wxGetApp().getConfig()->getConfigDir(), bookmarkFn + ".lastloaded");

View File

@ -83,6 +83,8 @@ public:
void saveToFile(std::string bookmarkFn, bool backup = true, bool useFullpath = false);
bool loadFromFile(std::string bookmarkFn, bool backup = true, bool useFullpath = false);
void resetBookmarks();
bool hasLastLoad(std::string bookmarkFn);
bool hasBackup(std::string bookmarkFn);