mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2024-11-12 23:26:10 -05:00
Add a Reset Bookmarks menu (empty the bookmarks), similar to Reset Session
This commit is contained in:
parent
0f72a0f683
commit
7b904bf803
@ -418,9 +418,11 @@ AppFrame::AppFrame() :
|
||||
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();
|
||||
@ -1407,7 +1409,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);
|
||||
@ -1434,7 +1436,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) {
|
||||
@ -1454,7 +1456,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) {
|
||||
@ -1476,6 +1478,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;
|
||||
}
|
||||
|
@ -43,9 +43,10 @@
|
||||
#define wxID_SET_DB_OFFSET 2012
|
||||
#define wxID_ABOUT_CUBICSDR 2013
|
||||
|
||||
#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
|
||||
|
@ -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");
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user