mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2025-09-04 22:27:49 -04:00
Merge pull request #596 from cjcliffe/vso_saving_bookmarks
Well, I think it works really well now, lets merge to master.
This commit is contained in:
commit
505ed18066
@ -417,6 +417,10 @@ AppFrame::AppFrame() :
|
|||||||
menu->Append(wxID_SAVEAS, "Save Session &As..");
|
menu->Append(wxID_SAVEAS, "Save Session &As..");
|
||||||
menu->AppendSeparator();
|
menu->AppendSeparator();
|
||||||
menu->Append(wxID_RESET, "&Reset Session");
|
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..");
|
||||||
|
|
||||||
#ifndef __APPLE__
|
#ifndef __APPLE__
|
||||||
menu->AppendSeparator();
|
menu->AppendSeparator();
|
||||||
@ -1121,6 +1125,7 @@ bool AppFrame::actionOnMenuReset(wxCommandEvent& event) {
|
|||||||
|
|
||||||
SetTitle(CUBICSDR_TITLE);
|
SetTitle(CUBICSDR_TITLE);
|
||||||
currentSessionFile = "";
|
currentSessionFile = "";
|
||||||
|
currentBookmarkFile = "";
|
||||||
bookmarkSplitter->Unsplit(bookmarkView);
|
bookmarkSplitter->Unsplit(bookmarkView);
|
||||||
bookmarkSplitter->SplitVertically(bookmarkView, mainVisSplitter, wxGetApp().getConfig()->getBookmarkSplit());
|
bookmarkSplitter->SplitVertically(bookmarkView, mainVisSplitter, wxGetApp().getConfig()->getBookmarkSplit());
|
||||||
hideBookmarksItem->Check(false);
|
hideBookmarksItem->Check(false);
|
||||||
@ -1401,6 +1406,77 @@ bool AppFrame::actionOnMenuLoadSave(wxCommandEvent& event) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//save mecanic for bookmark files
|
||||||
|
else if (event.GetId() == wxID_SAVE_BOOKMARK) {
|
||||||
|
|
||||||
|
if (!currentBookmarkFile.empty()) {
|
||||||
|
wxGetApp().getBookmarkMgr().saveToFile(currentBookmarkFile, false, true);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
wxFileDialog saveFileDialog(this, _("Save XML Bookmark file"), "", "", "XML files (*.xml)|*.xml", wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
|
||||||
|
if (saveFileDialog.ShowModal() == wxID_CANCEL) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Make sure the file name actually ends in .xml
|
||||||
|
std::string fileName = saveFileDialog.GetPath().ToStdString();
|
||||||
|
std::string lcFileName = fileName;
|
||||||
|
|
||||||
|
std::transform(lcFileName.begin(), lcFileName.end(), lcFileName.begin(), ::tolower);
|
||||||
|
|
||||||
|
if (lcFileName.find_last_of(".xml") != lcFileName.length() - 1) {
|
||||||
|
fileName.append(".xml");
|
||||||
|
}
|
||||||
|
|
||||||
|
wxGetApp().getBookmarkMgr().saveToFile(fileName, false, true);
|
||||||
|
currentBookmarkFile = fileName;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if (event.GetId() == wxID_OPEN_BOOKMARK) {
|
||||||
|
|
||||||
|
wxFileDialog openFileDialog(this, _("Open XML Bookmark file"), "", "", "XML files (*.xml)|*.xml", wxFD_OPEN | wxFD_FILE_MUST_EXIST);
|
||||||
|
if (openFileDialog.ShowModal() == wxID_CANCEL) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (wxGetApp().getBookmarkMgr().loadFromFile(openFileDialog.GetPath().ToStdString(), false, true)) {
|
||||||
|
|
||||||
|
wxGetApp().getBookmarkMgr().updateBookmarks();
|
||||||
|
wxGetApp().getBookmarkMgr().updateActiveList();
|
||||||
|
|
||||||
|
currentBookmarkFile = openFileDialog.GetPath().ToStdString();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
//failure at loading.
|
||||||
|
currentBookmarkFile = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if (event.GetId() == wxID_SAVEAS_BOOKMARK) {
|
||||||
|
|
||||||
|
wxFileDialog saveFileDialog(this, _("Save XML Bookmark file"), "", "", "XML files (*.xml)|*.xml", wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
|
||||||
|
if (saveFileDialog.ShowModal() == wxID_CANCEL) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Make sure the file name actually ends in .xml
|
||||||
|
std::string fileName = saveFileDialog.GetPath().ToStdString();
|
||||||
|
std::string lcFileName = fileName;
|
||||||
|
|
||||||
|
std::transform(lcFileName.begin(), lcFileName.end(), lcFileName.begin(), ::tolower);
|
||||||
|
|
||||||
|
if (lcFileName.find_last_of(".xml") != lcFileName.length() - 1) {
|
||||||
|
fileName.append(".xml");
|
||||||
|
}
|
||||||
|
|
||||||
|
wxGetApp().getBookmarkMgr().saveToFile(fileName, false, true);
|
||||||
|
currentBookmarkFile = fileName;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2153,6 +2229,11 @@ bool AppFrame::loadSession(std::string fileName) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Check if it is a session file, read the root node.
|
||||||
|
if (l.rootNode()->getName() != "cubicsdr_session") {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
wxGetApp().getDemodMgr().setActiveDemodulator(nullptr, false);
|
wxGetApp().getDemodMgr().setActiveDemodulator(nullptr, false);
|
||||||
|
|
||||||
wxGetApp().getDemodMgr().terminateAll();
|
wxGetApp().getDemodMgr().terminateAll();
|
||||||
|
@ -43,6 +43,10 @@
|
|||||||
#define wxID_SET_DB_OFFSET 2012
|
#define wxID_SET_DB_OFFSET 2012
|
||||||
#define wxID_ABOUT_CUBICSDR 2013
|
#define wxID_ABOUT_CUBICSDR 2013
|
||||||
|
|
||||||
|
#define wxID_OPEN_BOOKMARK 2020
|
||||||
|
#define wxID_SAVE_BOOKMARK 2021
|
||||||
|
#define wxID_SAVEAS_BOOKMARK 2022
|
||||||
|
|
||||||
#define wxID_MAIN_SPLITTER 2050
|
#define wxID_MAIN_SPLITTER 2050
|
||||||
#define wxID_VIS_SPLITTER 2051
|
#define wxID_VIS_SPLITTER 2051
|
||||||
#define wxID_BM_SPLITTER 2052
|
#define wxID_BM_SPLITTER 2052
|
||||||
@ -229,6 +233,7 @@ private:
|
|||||||
std::string currentTXantennaName;
|
std::string currentTXantennaName;
|
||||||
|
|
||||||
std::string currentSessionFile;
|
std::string currentSessionFile;
|
||||||
|
std::string currentBookmarkFile;
|
||||||
|
|
||||||
FFTVisualDataThread *waterfallDataThread;
|
FFTVisualDataThread *waterfallDataThread;
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
#include "BookmarkMgr.h"
|
#include "BookmarkMgr.h"
|
||||||
#include "CubicSDR.h"
|
#include "CubicSDR.h"
|
||||||
#include "DataTree.h"
|
#include "DataTree.h"
|
||||||
|
#include <wx/string.h>
|
||||||
|
|
||||||
#define BOOKMARK_RECENTS_MAX 25
|
#define BOOKMARK_RECENTS_MAX 25
|
||||||
|
|
||||||
@ -18,7 +19,8 @@ BookmarkMgr::BookmarkMgr() {
|
|||||||
//represents an empty BookMarkList that is returned by reference by some functions.
|
//represents an empty BookMarkList that is returned by reference by some functions.
|
||||||
const BookmarkList BookmarkMgr::emptyResults;
|
const BookmarkList BookmarkMgr::emptyResults;
|
||||||
|
|
||||||
void BookmarkMgr::saveToFile(std::string bookmarkFn, bool backup) {
|
void BookmarkMgr::saveToFile(std::string bookmarkFn, bool backup, bool useFullpath) {
|
||||||
|
|
||||||
DataTree s("cubicsdr_bookmarks");
|
DataTree s("cubicsdr_bookmarks");
|
||||||
DataNode *header = s.rootNode()->newChild("header");
|
DataNode *header = s.rootNode()->newChild("header");
|
||||||
header->newChild("version")->element()->set(wxString(CUBICSDR_VERSION).ToStdWstring());
|
header->newChild("version")->element()->set(wxString(CUBICSDR_VERSION).ToStdWstring());
|
||||||
@ -48,7 +50,21 @@ void BookmarkMgr::saveToFile(std::string bookmarkFn, bool backup) {
|
|||||||
*group->newChild("@expanded") = (getExpandState(bmd_i.first)?std::string("true"):std::string("false"));
|
*group->newChild("@expanded") = (getExpandState(bmd_i.first)?std::string("true"):std::string("false"));
|
||||||
|
|
||||||
for (auto &bm_i : bmd_i.second ) {
|
for (auto &bm_i : bmd_i.second ) {
|
||||||
group->newChildCloneFrom("modem", bm_i->node);
|
|
||||||
|
//if a matching demodulator exists, use its data instead to be be saved, because output_device could have been
|
||||||
|
//modified by the user. So, save that "live" version instead.
|
||||||
|
auto matchingDemod = wxGetApp().getDemodMgr().getLastDemodulatorWith(bm_i->type,
|
||||||
|
bm_i->label,
|
||||||
|
bm_i->frequency,
|
||||||
|
bm_i->bandwidth);
|
||||||
|
|
||||||
|
if (matchingDemod != nullptr) {
|
||||||
|
|
||||||
|
wxGetApp().getDemodMgr().saveInstance(group->newChild("modem"), matchingDemod);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
group->newChildCloneFrom("modem", bm_i->node);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -62,9 +78,18 @@ void BookmarkMgr::saveToFile(std::string bookmarkFn, bool backup) {
|
|||||||
recent_modems->newChildCloneFrom("modem", r_i->node);
|
recent_modems->newChildCloneFrom("modem", r_i->node);
|
||||||
}
|
}
|
||||||
|
|
||||||
wxFileName saveFile(wxGetApp().getConfig()->getConfigDir(), bookmarkFn);
|
wxFileName saveFile;
|
||||||
wxFileName saveFileBackup(wxGetApp().getConfig()->getConfigDir(), bookmarkFn + ".backup");
|
wxFileName saveFileBackup;
|
||||||
|
|
||||||
|
if (useFullpath) {
|
||||||
|
saveFile.Assign(bookmarkFn);
|
||||||
|
saveFileBackup.Assign(bookmarkFn + ".backup");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
saveFile.Assign(wxGetApp().getConfig()->getConfigDir(), bookmarkFn);
|
||||||
|
saveFileBackup.Assign(wxGetApp().getConfig()->getConfigDir(), bookmarkFn + ".backup");
|
||||||
|
}
|
||||||
|
|
||||||
if (saveFile.IsDirWritable()) {
|
if (saveFile.IsDirWritable()) {
|
||||||
// Hopefully leave at least a readable backup in case of failure..
|
// Hopefully leave at least a readable backup in case of failure..
|
||||||
if (backup && saveFile.FileExists() && (!saveFileBackup.FileExists() || saveFileBackup.IsFileWritable())) {
|
if (backup && saveFile.FileExists() && (!saveFileBackup.FileExists() || saveFileBackup.IsFileWritable())) {
|
||||||
@ -74,20 +99,28 @@ void BookmarkMgr::saveToFile(std::string bookmarkFn, bool backup) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BookmarkMgr::loadFromFile(std::string bookmarkFn, bool backup) {
|
bool BookmarkMgr::loadFromFile(std::string bookmarkFn, bool backup, bool useFullpath) {
|
||||||
wxFileName loadFile(wxGetApp().getConfig()->getConfigDir(), bookmarkFn);
|
|
||||||
wxFileName failFile(wxGetApp().getConfig()->getConfigDir(), bookmarkFn + ".failedload");
|
wxFileName loadFile;
|
||||||
wxFileName lastLoaded(wxGetApp().getConfig()->getConfigDir(), bookmarkFn + ".lastloaded");
|
wxFileName failFile;
|
||||||
wxFileName backupFile(wxGetApp().getConfig()->getConfigDir(), bookmarkFn + ".backup");
|
wxFileName lastLoaded;
|
||||||
|
wxFileName backupFile;
|
||||||
|
|
||||||
|
if (useFullpath) {
|
||||||
|
loadFile.Assign(bookmarkFn);
|
||||||
|
failFile.Assign(bookmarkFn + ".failedload");
|
||||||
|
lastLoaded.Assign(bookmarkFn + ".lastloaded");
|
||||||
|
backupFile.Assign(bookmarkFn + ".backup");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
loadFile.Assign(wxGetApp().getConfig()->getConfigDir(), bookmarkFn);
|
||||||
|
failFile.Assign(wxGetApp().getConfig()->getConfigDir(), bookmarkFn + ".failedload");
|
||||||
|
lastLoaded.Assign(wxGetApp().getConfig()->getConfigDir(), bookmarkFn + ".lastloaded");
|
||||||
|
backupFile.Assign(wxGetApp().getConfig()->getConfigDir(), bookmarkFn + ".backup");
|
||||||
|
}
|
||||||
|
|
||||||
DataTree s;
|
DataTree s;
|
||||||
bool loadStatusOk = true;
|
bool loadStatusOk = true;
|
||||||
|
|
||||||
// Clear any active data
|
|
||||||
bmData.clear();
|
|
||||||
clearRecents();
|
|
||||||
clearRanges();
|
|
||||||
bmDataSorted.clear();
|
|
||||||
|
|
||||||
// File exists but is not readable
|
// File exists but is not readable
|
||||||
if (loadFile.FileExists() && !loadFile.IsFileReadable()) {
|
if (loadFile.FileExists() && !loadFile.IsFileReadable()) {
|
||||||
@ -104,6 +137,17 @@ bool BookmarkMgr::loadFromFile(std::string bookmarkFn, bool backup) {
|
|||||||
if (!s.LoadFromFileXML(loadFile.GetFullPath(wxPATH_NATIVE).ToStdString())) {
|
if (!s.LoadFromFileXML(loadFile.GetFullPath(wxPATH_NATIVE).ToStdString())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Check if it is a bookmark file, read the root node.
|
||||||
|
if (s.rootNode()->getName() != "cubicsdr_bookmarks") {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Clear any active data
|
||||||
|
bmData.clear();
|
||||||
|
clearRecents();
|
||||||
|
clearRanges();
|
||||||
|
bmDataSorted.clear();
|
||||||
|
|
||||||
if (s.rootNode()->hasAnother("branches")) {
|
if (s.rootNode()->hasAnother("branches")) {
|
||||||
DataNode *branches = s.rootNode()->getNext("branches");
|
DataNode *branches = s.rootNode()->getNext("branches");
|
||||||
@ -528,9 +572,10 @@ BookmarkEntryPtr BookmarkMgr::nodeToBookmark(DataNode *node) {
|
|||||||
std::wstring BookmarkMgr::getBookmarkEntryDisplayName(BookmarkEntryPtr bmEnt) {
|
std::wstring BookmarkMgr::getBookmarkEntryDisplayName(BookmarkEntryPtr bmEnt) {
|
||||||
std::wstring dispName = bmEnt->label;
|
std::wstring dispName = bmEnt->label;
|
||||||
|
|
||||||
if (dispName == "") {
|
if (dispName == L"") {
|
||||||
std::string freqStr = frequencyToStr(bmEnt->frequency) + " " + bmEnt->type;
|
std::string freqStr = frequencyToStr(bmEnt->frequency) + " " + bmEnt->type;
|
||||||
dispName = wstring(freqStr.begin(),freqStr.end());
|
|
||||||
|
dispName = wxString(freqStr).ToStdWstring();
|
||||||
}
|
}
|
||||||
|
|
||||||
return dispName;
|
return dispName;
|
||||||
@ -539,9 +584,10 @@ std::wstring BookmarkMgr::getBookmarkEntryDisplayName(BookmarkEntryPtr bmEnt) {
|
|||||||
std::wstring BookmarkMgr::getActiveDisplayName(DemodulatorInstancePtr demod) {
|
std::wstring BookmarkMgr::getActiveDisplayName(DemodulatorInstancePtr demod) {
|
||||||
std::wstring activeName = demod->getDemodulatorUserLabel();
|
std::wstring activeName = demod->getDemodulatorUserLabel();
|
||||||
|
|
||||||
if (activeName == "") {
|
if (activeName == L"") {
|
||||||
std::string wstr = frequencyToStr(demod->getFrequency()) + " " + demod->getDemodulatorType();
|
std::string wstr = frequencyToStr(demod->getFrequency()) + " " + demod->getDemodulatorType();
|
||||||
activeName = std::wstring(wstr.begin(),wstr.end());
|
|
||||||
|
activeName = wxString(wstr).ToStdWstring();
|
||||||
}
|
}
|
||||||
|
|
||||||
return activeName;
|
return activeName;
|
||||||
|
@ -78,9 +78,10 @@ typedef std::map<std::string, bool> BookmarkExpandState;
|
|||||||
class BookmarkMgr {
|
class BookmarkMgr {
|
||||||
public:
|
public:
|
||||||
BookmarkMgr();
|
BookmarkMgr();
|
||||||
|
//if useFullpath = false, use the application config dir.
|
||||||
void saveToFile(std::string bookmarkFn, bool backup = true);
|
//else assume bookmarkFn is a full path and use it for location.
|
||||||
bool loadFromFile(std::string bookmarkFn, bool backup = true);
|
void saveToFile(std::string bookmarkFn, bool backup = true, bool useFullpath = false);
|
||||||
|
bool loadFromFile(std::string bookmarkFn, bool backup = true, bool useFullpath = false);
|
||||||
|
|
||||||
bool hasLastLoad(std::string bookmarkFn);
|
bool hasLastLoad(std::string bookmarkFn);
|
||||||
bool hasBackup(std::string bookmarkFn);
|
bool hasBackup(std::string bookmarkFn);
|
||||||
|
@ -526,12 +526,20 @@ DemodulatorInstancePtr DemodulatorMgr::loadInstance(DataNode *node) {
|
|||||||
|
|
||||||
//Attach to sound output:
|
//Attach to sound output:
|
||||||
std::map<int, RtAudio::DeviceInfo>::iterator i;
|
std::map<int, RtAudio::DeviceInfo>::iterator i;
|
||||||
|
|
||||||
|
bool matching_device_found = false;
|
||||||
|
|
||||||
for (i = outputDevices.begin(); i != outputDevices.end(); i++) {
|
for (i = outputDevices.begin(); i != outputDevices.end(); i++) {
|
||||||
if (i->second.name == output_device) {
|
if (i->second.name == output_device) {
|
||||||
newDemod->setOutputDevice(i->first);
|
newDemod->setOutputDevice(i->first);
|
||||||
|
matching_device_found = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//if no device is found, choose the first of the list anyway.
|
||||||
|
if (!matching_device_found) {
|
||||||
|
newDemod->setOutputDevice(outputDevices.begin()->first);
|
||||||
|
}
|
||||||
|
|
||||||
return newDemod;
|
return newDemod;
|
||||||
}
|
}
|
||||||
|
@ -78,7 +78,8 @@ public:
|
|||||||
|
|
||||||
if (name.length() == 0) {
|
if (name.length() == 0) {
|
||||||
std::string wstr = frequencyToStr(rangeEnt->startFreq) + " - " + frequencyToStr(rangeEnt->endFreq);
|
std::string wstr = frequencyToStr(rangeEnt->startFreq) + " - " + frequencyToStr(rangeEnt->endFreq);
|
||||||
name = std::wstring(wstr.begin(),wstr.end());
|
|
||||||
|
name = wxString(wstr).ToStdWstring();
|
||||||
}
|
}
|
||||||
|
|
||||||
m_questionText->SetLabelText(L"Are you sure you want to remove the range\n '" + name + L"'?");
|
m_questionText->SetLabelText(L"Are you sure you want to remove the range\n '" + name + L"'?");
|
||||||
@ -103,7 +104,8 @@ public:
|
|||||||
|
|
||||||
if (name.length() == 0) {
|
if (name.length() == 0) {
|
||||||
std::string wstr = frequencyToStr(rangeEnt->startFreq) + " - " + frequencyToStr(rangeEnt->endFreq);
|
std::string wstr = frequencyToStr(rangeEnt->startFreq) + " - " + frequencyToStr(rangeEnt->endFreq);
|
||||||
name = std::wstring(wstr.begin(),wstr.end());
|
|
||||||
|
name = wxString(wstr).ToStdWstring();
|
||||||
}
|
}
|
||||||
|
|
||||||
m_questionText->SetLabelText(L"Are you sure you want to update the range\n '" + name + L"' to the active range?");
|
m_questionText->SetLabelText(L"Are you sure you want to update the range\n '" + name + L"' to the active range?");
|
||||||
@ -311,9 +313,9 @@ wxTreeItemId BookmarkView::refreshBookmarks() {
|
|||||||
std::wstring fullText = labelVal +
|
std::wstring fullText = labelVal +
|
||||||
L" " + bmEnt->label +
|
L" " + bmEnt->label +
|
||||||
L" " + std::to_wstring(bmEnt->frequency) +
|
L" " + std::to_wstring(bmEnt->frequency) +
|
||||||
L" " + std::wstring(freqStr.begin(),freqStr.end()) +
|
L" " + wxString(freqStr).ToStdWstring() +
|
||||||
L" " + std::wstring(bwStr.begin(),bwStr.end()) +
|
L" " + wxString(bwStr).ToStdWstring() +
|
||||||
L" " + std::wstring(bmEnt->type.begin(),bmEnt->type.end());
|
L" " + wxString(bmEnt->type).ToStdWstring();
|
||||||
|
|
||||||
if (!isKeywordMatch(fullText, searchKeywords)) {
|
if (!isKeywordMatch(fullText, searchKeywords)) {
|
||||||
continue;
|
continue;
|
||||||
@ -379,9 +381,9 @@ void BookmarkView::doUpdateActiveList() {
|
|||||||
std::wstring fullText = activeLabel.ToStdWstring() +
|
std::wstring fullText = activeLabel.ToStdWstring() +
|
||||||
L" " + demod_i->getDemodulatorUserLabel() +
|
L" " + demod_i->getDemodulatorUserLabel() +
|
||||||
L" " + std::to_wstring(demod_i->getFrequency()) +
|
L" " + std::to_wstring(demod_i->getFrequency()) +
|
||||||
L" " + std::wstring(freqStr.begin(),freqStr.end()) +
|
L" " + wxString(freqStr).ToStdWstring() +
|
||||||
L" " + std::wstring(bwStr.begin(),bwStr.end()) +
|
L" " + wxString(bwStr).ToStdWstring() +
|
||||||
L" " + std::wstring(mtype.begin(),mtype.end());
|
L" " + wxString(mtype).ToStdWstring();
|
||||||
|
|
||||||
if (!isKeywordMatch(fullText, searchKeywords)) {
|
if (!isKeywordMatch(fullText, searchKeywords)) {
|
||||||
continue;
|
continue;
|
||||||
@ -418,9 +420,10 @@ void BookmarkView::doUpdateActiveList() {
|
|||||||
|
|
||||||
std::wstring labelVal = re_i->label;
|
std::wstring labelVal = re_i->label;
|
||||||
|
|
||||||
if (labelVal == "") {
|
if (labelVal == L"") {
|
||||||
std::string wstr = frequencyToStr(re_i->startFreq) + " - " + frequencyToStr(re_i->endFreq);
|
std::string wstr = frequencyToStr(re_i->startFreq) + " - " + frequencyToStr(re_i->endFreq);
|
||||||
labelVal = std::wstring(wstr.begin(),wstr.end());
|
|
||||||
|
labelVal = wxString(wstr).ToStdWstring();
|
||||||
}
|
}
|
||||||
|
|
||||||
wxTreeItemId itm = m_treeView->AppendItem(rangeBranch, labelVal);
|
wxTreeItemId itm = m_treeView->AppendItem(rangeBranch, labelVal);
|
||||||
@ -448,9 +451,10 @@ void BookmarkView::doUpdateActiveList() {
|
|||||||
std::wstring labelVal;
|
std::wstring labelVal;
|
||||||
bmr_i->node->child("user_label")->element()->get(labelVal);
|
bmr_i->node->child("user_label")->element()->get(labelVal);
|
||||||
|
|
||||||
if (labelVal == "") {
|
if (labelVal == L"") {
|
||||||
std::string wstr = frequencyToStr(bmr_i->frequency) + " " + bmr_i->type;
|
std::string str = frequencyToStr(bmr_i->frequency) + " " + bmr_i->type;
|
||||||
labelVal = std::wstring(wstr.begin(),wstr.end());
|
|
||||||
|
labelVal = wxString(str).ToStdWstring();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (searchKeywords.size()) {
|
if (searchKeywords.size()) {
|
||||||
@ -460,9 +464,10 @@ void BookmarkView::doUpdateActiveList() {
|
|||||||
|
|
||||||
std::wstring fullText = labelVal +
|
std::wstring fullText = labelVal +
|
||||||
L" " + std::to_wstring(bmr_i->frequency) +
|
L" " + std::to_wstring(bmr_i->frequency) +
|
||||||
L" " + std::wstring(freqStr.begin(),freqStr.end()) +
|
|
||||||
L" " + std::wstring(bwStr.begin(),bwStr.end()) +
|
L" " + wxString(freqStr).ToStdWstring() +
|
||||||
L" " + std::wstring(bmr_i->type.begin(),tvi->bookmarkEnt->type.end());
|
L" " + wxString(bwStr).ToStdWstring() +
|
||||||
|
L" " + wxString(bmr_i->type).ToStdWstring();
|
||||||
|
|
||||||
if (!isKeywordMatch(fullText, searchKeywords)) {
|
if (!isKeywordMatch(fullText, searchKeywords)) {
|
||||||
continue;
|
continue;
|
||||||
@ -971,7 +976,7 @@ void BookmarkView::rangeSelection(BookmarkRangeEntryPtr re) {
|
|||||||
|
|
||||||
std::string strFreq = frequencyToStr(re->startFreq) + "-" + frequencyToStr(re->endFreq);
|
std::string strFreq = frequencyToStr(re->startFreq) + "-" + frequencyToStr(re->endFreq);
|
||||||
|
|
||||||
m_frequencyVal->SetLabelText(std::wstring(strFreq.begin(),strFreq.end()));
|
m_frequencyVal->SetLabelText(wxString(strFreq));
|
||||||
|
|
||||||
showProps();
|
showProps();
|
||||||
|
|
||||||
@ -1473,16 +1478,16 @@ void BookmarkView::onSearchTextFocus( wxMouseEvent& event ) {
|
|||||||
|
|
||||||
|
|
||||||
void BookmarkView::onSearchText( wxCommandEvent& event ) {
|
void BookmarkView::onSearchText( wxCommandEvent& event ) {
|
||||||
wstring searchText = m_searchText->GetValue().Trim().Lower().ToStdWstring();
|
std::wstring searchText = m_searchText->GetValue().Trim().Lower().ToStdWstring();
|
||||||
|
|
||||||
searchKeywords.clear();
|
searchKeywords.clear();
|
||||||
|
|
||||||
if (searchText.length() != 0) {
|
if (searchText.length() != 0) {
|
||||||
std::wstringstream searchTextLo(searchText);
|
std::wstringstream searchTextLo(searchText);
|
||||||
wstring tmp;
|
std::wstring tmp;
|
||||||
|
|
||||||
while(std::getline(searchTextLo, tmp, L' ')) {
|
while(std::getline(searchTextLo, tmp, L' ')) {
|
||||||
if (tmp.length() != 0 && tmp.find(L"search.") == wstring::npos) {
|
if (tmp.length() != 0 && tmp.find(L"search.") == std::wstring::npos) {
|
||||||
searchKeywords.push_back(tmp);
|
searchKeywords.push_back(tmp);
|
||||||
// std::wcout << L"Keyword: " << tmp << '\n';
|
// std::wcout << L"Keyword: " << tmp << '\n';
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,8 @@
|
|||||||
|
|
||||||
#include "GLFont.h"
|
#include "GLFont.h"
|
||||||
|
|
||||||
|
#include <wx/string.h>
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
@ -245,11 +247,11 @@ void GLFont::loadFontOnce() {
|
|||||||
//Re-compute the resource dir.
|
//Re-compute the resource dir.
|
||||||
resourceFolder = fontDefFileName.GetPath();
|
resourceFolder = fontDefFileName.GetPath();
|
||||||
|
|
||||||
std::wstring fontDefFileNamePath = fontDefFileName.GetFullPath(wxPATH_NATIVE).ToStdWstring();
|
std::string fontDefFileNamePath = fontDefFileName.GetFullPath(wxPATH_NATIVE).ToStdString();
|
||||||
|
|
||||||
std::wifstream input;
|
std::wifstream input;
|
||||||
std::string inpFileStr(fontDefFileNamePath.begin(), fontDefFileNamePath.end());
|
|
||||||
input.open(inpFileStr, std::ios::in);
|
input.open(fontDefFileNamePath, std::ios::in);
|
||||||
|
|
||||||
std::wstring op;
|
std::wstring op;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user