diff --git a/CMakeLists.txt b/CMakeLists.txt index a817a1d..c38c471 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -304,6 +304,8 @@ SET (cubicsdr_sources src/forms/SDRDevices/SDRDevicesForm.cpp src/forms/SDRDevices/SDRDeviceAdd.cpp src/forms/SDRDevices/SDRDeviceAddForm.cpp + src/forms/Bookmark/BookmarkPanel.cpp + src/forms/Bookmark/BookmarkView.cpp external/rtaudio/RtAudio.cpp external/lodepng/lodepng.cpp external/tinyxml/tinyxml.cpp @@ -408,6 +410,8 @@ SET (cubicsdr_headers src/forms/SDRDevices/SDRDevicesForm.h src/forms/SDRDevices/SDRDeviceAdd.h src/forms/SDRDevices/SDRDeviceAddForm.h + src/forms/Bookmark/BookmarkPanel.h + src/forms/Bookmark/BookmarkView.h external/rtaudio/RtAudio.h external/lodepng/lodepng.h external/tinyxml/tinyxml.h @@ -495,6 +499,7 @@ set(REG_EXT "[^/]*([.]cpp|[.]c|[.]h|[.]hpp)$") SOURCE_GROUP("Base" REGULAR_EXPRESSION "src/${REG_EXT}") SOURCE_GROUP("Forms\\SDRDevices" REGULAR_EXPRESSION "src/forms/SDRDevices/${REG_EXT}") +SOURCE_GROUP("Forms\\Bookmark" REGULAR_EXPRESSION "src/forms/Bookmark/${REG_EXT}") SOURCE_GROUP("SDR" REGULAR_EXPRESSION "src/sdr/${REG_EXT}") IF(USE_HAMLIB) SOURCE_GROUP("Rig" REGULAR_EXPRESSION "src/rig/${REG_EXT}") diff --git a/src/AppFrame.cpp b/src/AppFrame.cpp index d9eb0ce..b15e9d2 100644 --- a/src/AppFrame.cpp +++ b/src/AppFrame.cpp @@ -375,6 +375,8 @@ AppFrame::AppFrame() : } i++; } + + wxGetApp().getDemodMgr().setOutputDevices(outputDevices); // // for (mdevices_i = outputDevices.begin(); mdevices_i != outputDevices.end(); mdevices_i++) { // wxMenuItem *itm = menu->AppendRadioItem(wxID_RT_AUDIO_DEVICE + mdevices_i->first, mdevices_i->second.name, wxT("Description?")); @@ -1649,35 +1651,10 @@ void AppFrame::saveSession(std::string fileName) { DataNode *demods = s.rootNode()->newChild("demodulators"); std::vector &instances = wxGetApp().getDemodMgr().getDemodulators(); - std::vector::iterator instance_i; - for (instance_i = instances.begin(); instance_i != instances.end(); instance_i++) { + + for (auto instance_i : instances) { DataNode *demod = demods->newChild("demodulator"); - *demod->newChild("bandwidth") = (*instance_i)->getBandwidth(); - *demod->newChild("frequency") = (*instance_i)->getFrequency(); - *demod->newChild("type") = (*instance_i)->getDemodulatorType(); - - demod->newChild("user_label")->element()->set((*instance_i)->getDemodulatorUserLabel()); - - *demod->newChild("squelch_level") = (*instance_i)->getSquelchLevel(); - *demod->newChild("squelch_enabled") = (*instance_i)->isSquelchEnabled() ? 1 : 0; - *demod->newChild("output_device") = outputDevices[(*instance_i)->getOutputDevice()].name; - *demod->newChild("gain") = (*instance_i)->getGain(); - *demod->newChild("muted") = (*instance_i)->isMuted() ? 1 : 0; - if ((*instance_i)->isDeltaLock()) { - *demod->newChild("delta_lock") = (*instance_i)->isDeltaLock() ? 1 : 0; - *demod->newChild("delta_ofs") = (*instance_i)->getDeltaLockOfs(); - } - if ((*instance_i) == wxGetApp().getDemodMgr().getLastActiveDemodulator()) { - *demod->newChild("active") = 1; - } - - ModemSettings saveSettings = (*instance_i)->readModemSettings(); - if (saveSettings.size()) { - DataNode *settingsNode = demod->newChild("settings"); - for (ModemSettings::const_iterator msi = saveSettings.begin(); msi != saveSettings.end(); msi++) { - *settingsNode->newChild(msi->first.c_str()) = msi->second; - } - } + wxGetApp().getDemodMgr().saveInstance(demod, instance_i); } //end for demodulators // Make sure the file name actually ends in .xml @@ -1751,7 +1728,6 @@ bool AppFrame::loadSession(std::string fileName) { DataNode *demodulators = l.rootNode()->getNext("demodulators"); - int numDemodulators = 0; std::vector demodsLoaded; while (demodulators->hasAnother("demodulator")) { @@ -1761,122 +1737,15 @@ bool AppFrame::loadSession(std::string fileName) { continue; } - long bandwidth = *demod->getNext("bandwidth"); - long long freq = *demod->getNext("frequency"); - float squelch_level = demod->hasAnother("squelch_level") ? (float) *demod->getNext("squelch_level") : 0; - int squelch_enabled = demod->hasAnother("squelch_enabled") ? (int) *demod->getNext("squelch_enabled") : 0; - int muted = demod->hasAnother("muted") ? (int) *demod->getNext("muted") : 0; - int delta_locked = demod->hasAnother("delta_lock") ? (int) *demod->getNext("delta_lock") : 0; - int delta_ofs = demod->hasAnother("delta_ofs") ? (int) *demod->getNext("delta_ofs") : 0; - std::string output_device = demod->hasAnother("output_device") ? string(*(demod->getNext("output_device"))) : ""; - float gain = demod->hasAnother("gain") ? (float) *demod->getNext("gain") : 1.0; + newDemod = wxGetApp().getDemodMgr().loadInstance(demod); - std::string type = "FM"; - - - DataNode *demodTypeNode = demod->hasAnother("type")?demod->getNext("type"):nullptr; - - if (demodTypeNode && demodTypeNode->element()->getDataType() == DATA_INT) { - int legacyType = *demodTypeNode; - int legacyStereo = demod->hasAnother("stereo") ? (int) *demod->getNext("stereo") : 0; - switch (legacyType) { // legacy demod ID - case 1: type = legacyStereo?"FMS":"FM"; break; - case 2: type = "AM"; break; - case 3: type = "LSB"; break; - case 4: type = "USB"; break; - case 5: type = "DSB"; break; - case 6: type = "ASK"; break; - case 7: type = "APSK"; break; - case 8: type = "BPSK"; break; - case 9: type = "DPSK"; break; - case 10: type = "PSK"; break; - case 11: type = "OOK"; break; - case 12: type = "ST"; break; - case 13: type = "SQAM"; break; - case 14: type = "QAM"; break; - case 15: type = "QPSK"; break; - case 16: type = "I/Q"; break; - default: type = "FM"; break; - } - } else if (demodTypeNode && demodTypeNode->element()->getDataType() == DATA_STRING) { - demodTypeNode->element()->get(type); - } - - //read the user label associated with the demodulator - std::wstring user_label = L""; - - DataNode *demodUserLabel = demod->hasAnother("user_label") ? demod->getNext("user_label") : nullptr; - - if (demodUserLabel) { - - demodUserLabel->element()->get(user_label); - } - - - ModemSettings mSettings; - - if (demod->hasAnother("settings")) { - DataNode *modemSettings = demod->getNext("settings"); - for (int msi = 0, numSettings = modemSettings->numChildren(); msi < numSettings; msi++) { - DataNode *settingNode = modemSettings->child(msi); - std::string keyName = settingNode->getName(); - std::string strSettingValue = settingNode->element()->toString(); - - if (keyName != "" && strSettingValue != "") { - mSettings[keyName] = strSettingValue; - } - } - } - - - - newDemod = wxGetApp().getDemodMgr().newThread(); - if (demod->hasAnother("active")) { loadedActiveDemod = newDemod; } - numDemodulators++; - newDemod->setDemodulatorType(type); - newDemod->setDemodulatorUserLabel(user_label); - newDemod->writeModemSettings(mSettings); - newDemod->setBandwidth(bandwidth); - newDemod->setFrequency(freq); - newDemod->setGain(gain); - newDemod->updateLabel(freq); - newDemod->setMuted(muted?true:false); - if (delta_locked) { - newDemod->setDeltaLock(true); - newDemod->setDeltaLockOfs(delta_ofs); - } - if (squelch_enabled) { - newDemod->setSquelchEnabled(true); - newDemod->setSquelchLevel(squelch_level); - } - - bool found_device = false; - std::map::iterator i; - for (i = outputDevices.begin(); i != outputDevices.end(); i++) { - if (i->second.name == output_device) { - newDemod->setOutputDevice(i->first); - found_device = true; - } - } - -// if (!found_device) { -// std::cout << "\tWarning: named output device '" << output_device << "' was not found. Using default output."; -// } - newDemod->run(); newDemod->setActive(true); demodsLoaded.push_back(newDemod); -// wxGetApp().bindDemodulator(newDemod); - - std::cout << "\tAdded demodulator at frequency " << newDemod->getFrequency() << " type " << type << std::endl; -// std::cout << "\t\tBandwidth: " << bandwidth << std::endl; -// std::cout << "\t\tSquelch Level: " << squelch_level << std::endl; -// std::cout << "\t\tSquelch Enabled: " << (squelch_enabled ? "true" : "false") << std::endl; -// std::cout << "\t\tOutput Device: " << output_device << std::endl; } if (demodsLoaded.size()) { diff --git a/src/demod/DemodulatorMgr.cpp b/src/demod/DemodulatorMgr.cpp index 61be65c..b312bf7 100644 --- a/src/demod/DemodulatorMgr.cpp +++ b/src/demod/DemodulatorMgr.cpp @@ -1,15 +1,17 @@ -#include #include #include -#include "CubicSDR.h" #include #include #include +#include "DemodulatorMgr.h" + #if USE_HAMLIB #include "RigThread.h" #endif +#include "DataTree.h" + bool demodFreqCompare (DemodulatorInstance *i, DemodulatorInstance *j) { return (i->getFrequency()getFrequency()); } bool inactiveCompare (DemodulatorInstance *i, DemodulatorInstance *j) { return (i->isActive()isActive()); } @@ -368,3 +370,136 @@ ModemSettings DemodulatorMgr::getLastModemSettings(std::string modemType) { void DemodulatorMgr::setLastModemSettings(std::string modemType, ModemSettings settings) { lastModemSettings[modemType] = settings; } + +void DemodulatorMgr::setOutputDevices(std::map devs) { + outputDevices = devs; +} + +void DemodulatorMgr::saveInstance(DataNode *node, DemodulatorInstance *inst) { + *node->newChild("bandwidth") = inst->getBandwidth(); + *node->newChild("frequency") = inst->getFrequency(); + *node->newChild("type") = inst->getDemodulatorType(); + + node->newChild("user_label")->element()->set(inst->getDemodulatorUserLabel()); + + *node->newChild("squelch_level") = inst->getSquelchLevel(); + *node->newChild("squelch_enabled") = inst->isSquelchEnabled() ? 1 : 0; + *node->newChild("output_device") = outputDevices[inst->getOutputDevice()].name; + *node->newChild("gain") = inst->getGain(); + *node->newChild("muted") = inst->isMuted() ? 1 : 0; + if (inst->isDeltaLock()) { + *node->newChild("delta_lock") = inst->isDeltaLock() ? 1 : 0; + *node->newChild("delta_ofs") = inst->getDeltaLockOfs(); + } + if (inst == getLastActiveDemodulator()) { + *node->newChild("active") = 1; + } + + ModemSettings saveSettings = inst->readModemSettings(); + if (saveSettings.size()) { + DataNode *settingsNode = node->newChild("settings"); + for (ModemSettings::const_iterator msi = saveSettings.begin(); msi != saveSettings.end(); msi++) { + *settingsNode->newChild(msi->first.c_str()) = msi->second; + } + } + +} + +DemodulatorInstance *DemodulatorMgr::loadInstance(DataNode *node) { + DemodulatorInstance *newDemod = nullptr; + + long bandwidth = *node->getNext("bandwidth"); + long long freq = *node->getNext("frequency"); + float squelch_level = node->hasAnother("squelch_level") ? (float) *node->getNext("squelch_level") : 0; + int squelch_enabled = node->hasAnother("squelch_enabled") ? (int) *node->getNext("squelch_enabled") : 0; + int muted = node->hasAnother("muted") ? (int) *node->getNext("muted") : 0; + int delta_locked = node->hasAnother("delta_lock") ? (int) *node->getNext("delta_lock") : 0; + int delta_ofs = node->hasAnother("delta_ofs") ? (int) *node->getNext("delta_ofs") : 0; + std::string output_device = node->hasAnother("output_device") ? string(*(node->getNext("output_device"))) : ""; + float gain = node->hasAnother("gain") ? (float) *node->getNext("gain") : 1.0; + + std::string type = "FM"; + + DataNode *demodTypeNode = node->hasAnother("type")?node->getNext("type"):nullptr; + + if (demodTypeNode && demodTypeNode->element()->getDataType() == DATA_INT) { + int legacyType = *demodTypeNode; + int legacyStereo = node->hasAnother("stereo") ? (int) *node->getNext("stereo") : 0; + switch (legacyType) { // legacy demod ID + case 1: type = legacyStereo?"FMS":"FM"; break; + case 2: type = "AM"; break; + case 3: type = "LSB"; break; + case 4: type = "USB"; break; + case 5: type = "DSB"; break; + case 6: type = "ASK"; break; + case 7: type = "APSK"; break; + case 8: type = "BPSK"; break; + case 9: type = "DPSK"; break; + case 10: type = "PSK"; break; + case 11: type = "OOK"; break; + case 12: type = "ST"; break; + case 13: type = "SQAM"; break; + case 14: type = "QAM"; break; + case 15: type = "QPSK"; break; + case 16: type = "I/Q"; break; + default: type = "FM"; break; + } + } else if (demodTypeNode && demodTypeNode->element()->getDataType() == DATA_STRING) { + demodTypeNode->element()->get(type); + } + + //read the user label associated with the demodulator + std::wstring user_label = L""; + + DataNode *demodUserLabel = node->hasAnother("user_label") ? node->getNext("user_label") : nullptr; + + if (demodUserLabel) { + demodUserLabel->element()->get(user_label); + } + + ModemSettings mSettings; + + if (node->hasAnother("settings")) { + DataNode *modemSettings = node->getNext("settings"); + for (int msi = 0, numSettings = modemSettings->numChildren(); msi < numSettings; msi++) { + DataNode *settingNode = modemSettings->child(msi); + std::string keyName = settingNode->getName(); + std::string strSettingValue = settingNode->element()->toString(); + + if (keyName != "" && strSettingValue != "") { + mSettings[keyName] = strSettingValue; + } + } + } + + newDemod = wxGetApp().getDemodMgr().newThread(); + + newDemod->setDemodulatorType(type); + newDemod->setDemodulatorUserLabel(user_label); + newDemod->writeModemSettings(mSettings); + newDemod->setBandwidth(bandwidth); + newDemod->setFrequency(freq); + newDemod->setGain(gain); + newDemod->updateLabel(freq); + newDemod->setMuted(muted?true:false); + if (delta_locked) { + newDemod->setDeltaLock(true); + newDemod->setDeltaLockOfs(delta_ofs); + } + if (squelch_enabled) { + newDemod->setSquelchEnabled(true); + newDemod->setSquelchLevel(squelch_level); + } + + bool found_device = false; + std::map::iterator i; + for (i = outputDevices.begin(); i != outputDevices.end(); i++) { + if (i->second.name == output_device) { + newDemod->setOutputDevice(i->first); + found_device = true; + } + } + + return newDemod; +} + diff --git a/src/demod/DemodulatorMgr.h b/src/demod/DemodulatorMgr.h index a993f84..348815e 100644 --- a/src/demod/DemodulatorMgr.h +++ b/src/demod/DemodulatorMgr.h @@ -6,6 +6,8 @@ #include "DemodulatorInstance.h" +class DataNode; + class DemodulatorMgr { public: DemodulatorMgr(); @@ -54,6 +56,10 @@ public: void updateLastState(); + void setOutputDevices(std::map devs); + void saveInstance(DataNode *node, DemodulatorInstance *inst); + DemodulatorInstance *loadInstance(DataNode *node); + private: void garbageCollect(); @@ -79,4 +85,5 @@ private: std::recursive_mutex demods_busy; std::map lastModemSettings; + std::map outputDevices; }; diff --git a/src/forms/Bookmark/BookmarkPanel.cpp b/src/forms/Bookmark/BookmarkPanel.cpp new file mode 100644 index 0000000..ea8d4a1 --- /dev/null +++ b/src/forms/Bookmark/BookmarkPanel.cpp @@ -0,0 +1,106 @@ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version Aug 23 2015) +// http://www.wxformbuilder.org/ +// +// PLEASE DO "NOT" EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#include "BookmarkPanel.h" + +/////////////////////////////////////////////////////////////////////////// + +BookmarkPanel::BookmarkPanel( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) : wxPanel( parent, id, pos, size, style ) +{ + wxBoxSizer* bSizer1; + bSizer1 = new wxBoxSizer( wxVERTICAL ); + + m_treeView = new wxTreeCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTR_DEFAULT_STYLE ); + bSizer1->Add( m_treeView, 5, wxEXPAND, 5 ); + + m_propPanel = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + wxFlexGridSizer* fgPropSizer; + fgPropSizer = new wxFlexGridSizer( 0, 2, 0, 0 ); + fgPropSizer->AddGrowableCol( 1 ); + fgPropSizer->SetFlexibleDirection( wxBOTH ); + fgPropSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); + + m_staticText1 = new wxStaticText( m_propPanel, wxID_ANY, wxT("Label"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText1->Wrap( -1 ); + fgPropSizer->Add( m_staticText1, 0, wxALIGN_RIGHT|wxALL, 5 ); + + m_labelText = new wxTextCtrl( m_propPanel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + fgPropSizer->Add( m_labelText, 0, wxALL|wxEXPAND|wxLEFT|wxTOP, 5 ); + + m_frequencyLabel = new wxStaticText( m_propPanel, wxID_ANY, wxT("Freq"), wxDefaultPosition, wxDefaultSize, 0 ); + m_frequencyLabel->Wrap( -1 ); + fgPropSizer->Add( m_frequencyLabel, 0, wxALIGN_RIGHT|wxALL, 5 ); + + m_frequencyVal = new wxStaticText( m_propPanel, wxID_ANY, wxT("FrequencyVal"), wxDefaultPosition, wxDefaultSize, 0 ); + m_frequencyVal->Wrap( -1 ); + fgPropSizer->Add( m_frequencyVal, 0, wxALL, 5 ); + + m_bandwidthLabel = new wxStaticText( m_propPanel, wxID_ANY, wxT("BW"), wxDefaultPosition, wxDefaultSize, 0 ); + m_bandwidthLabel->Wrap( -1 ); + fgPropSizer->Add( m_bandwidthLabel, 0, wxALIGN_RIGHT|wxALL, 5 ); + + m_bandwidthVal = new wxStaticText( m_propPanel, wxID_ANY, wxT("BandwidthVal"), wxDefaultPosition, wxDefaultSize, 0 ); + m_bandwidthVal->Wrap( -1 ); + fgPropSizer->Add( m_bandwidthVal, 0, wxALL, 5 ); + + m_modulationLabel = new wxStaticText( m_propPanel, wxID_ANY, wxT("Type"), wxDefaultPosition, wxDefaultSize, 0 ); + m_modulationLabel->Wrap( -1 ); + fgPropSizer->Add( m_modulationLabel, 0, wxALIGN_RIGHT|wxALL, 5 ); + + m_typeVal = new wxStaticText( m_propPanel, wxID_ANY, wxT("TypeVal"), wxDefaultPosition, wxDefaultSize, 0 ); + m_typeVal->Wrap( -1 ); + fgPropSizer->Add( m_typeVal, 0, wxALL, 5 ); + + + m_propPanel->SetSizer( fgPropSizer ); + m_propPanel->Layout(); + fgPropSizer->Fit( m_propPanel ); + bSizer1->Add( m_propPanel, 1, wxBOTTOM|wxEXPAND|wxTOP, 5 ); + + m_bookmarkButton = new wxButton( this, wxID_ANY, wxT("Bookmark"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizer1->Add( m_bookmarkButton, 0, wxALIGN_RIGHT|wxALL|wxEXPAND, 5 ); + + m_activateButton = new wxButton( this, wxID_ANY, wxT("Activate"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizer1->Add( m_activateButton, 0, wxALIGN_RIGHT|wxALL|wxEXPAND, 5 ); + + m_removeButton = new wxButton( this, wxID_ANY, wxT("Remove"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizer1->Add( m_removeButton, 0, wxALL|wxEXPAND, 5 ); + + + this->SetSizer( bSizer1 ); + this->Layout(); + + // Connect Events + m_treeView->Connect( wxEVT_COMMAND_TREE_BEGIN_LABEL_EDIT, wxTreeEventHandler( BookmarkPanel::onTreeBeginLabelEdit ), NULL, this ); + m_treeView->Connect( wxEVT_COMMAND_TREE_END_LABEL_EDIT, wxTreeEventHandler( BookmarkPanel::onTreeEndLabelEdit ), NULL, this ); + m_treeView->Connect( wxEVT_COMMAND_TREE_ITEM_ACTIVATED, wxTreeEventHandler( BookmarkPanel::onTreeActivate ), NULL, this ); + m_treeView->Connect( wxEVT_COMMAND_TREE_ITEM_COLLAPSED, wxTreeEventHandler( BookmarkPanel::onTreeCollapse ), NULL, this ); + m_treeView->Connect( wxEVT_COMMAND_TREE_ITEM_EXPANDED, wxTreeEventHandler( BookmarkPanel::onTreeExpanded ), NULL, this ); + m_treeView->Connect( wxEVT_COMMAND_TREE_SEL_CHANGED, wxTreeEventHandler( BookmarkPanel::onTreeSelect ), NULL, this ); + m_treeView->Connect( wxEVT_COMMAND_TREE_SEL_CHANGING, wxTreeEventHandler( BookmarkPanel::onTreeSelectChanging ), NULL, this ); + m_labelText->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( BookmarkPanel::onLabelText ), NULL, this ); + m_bookmarkButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BookmarkPanel::onBookmark ), NULL, this ); + m_activateButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BookmarkPanel::onActivate ), NULL, this ); + m_removeButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BookmarkPanel::onRemove ), NULL, this ); +} + +BookmarkPanel::~BookmarkPanel() +{ + // Disconnect Events + m_treeView->Disconnect( wxEVT_COMMAND_TREE_BEGIN_LABEL_EDIT, wxTreeEventHandler( BookmarkPanel::onTreeBeginLabelEdit ), NULL, this ); + m_treeView->Disconnect( wxEVT_COMMAND_TREE_END_LABEL_EDIT, wxTreeEventHandler( BookmarkPanel::onTreeEndLabelEdit ), NULL, this ); + m_treeView->Disconnect( wxEVT_COMMAND_TREE_ITEM_ACTIVATED, wxTreeEventHandler( BookmarkPanel::onTreeActivate ), NULL, this ); + m_treeView->Disconnect( wxEVT_COMMAND_TREE_ITEM_COLLAPSED, wxTreeEventHandler( BookmarkPanel::onTreeCollapse ), NULL, this ); + m_treeView->Disconnect( wxEVT_COMMAND_TREE_ITEM_EXPANDED, wxTreeEventHandler( BookmarkPanel::onTreeExpanded ), NULL, this ); + m_treeView->Disconnect( wxEVT_COMMAND_TREE_SEL_CHANGED, wxTreeEventHandler( BookmarkPanel::onTreeSelect ), NULL, this ); + m_treeView->Disconnect( wxEVT_COMMAND_TREE_SEL_CHANGING, wxTreeEventHandler( BookmarkPanel::onTreeSelectChanging ), NULL, this ); + m_labelText->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( BookmarkPanel::onLabelText ), NULL, this ); + m_bookmarkButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BookmarkPanel::onBookmark ), NULL, this ); + m_activateButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BookmarkPanel::onActivate ), NULL, this ); + m_removeButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BookmarkPanel::onRemove ), NULL, this ); + +} diff --git a/src/forms/Bookmark/BookmarkPanel.fbp b/src/forms/Bookmark/BookmarkPanel.fbp new file mode 100644 index 0000000..1899c8f --- /dev/null +++ b/src/forms/Bookmark/BookmarkPanel.fbp @@ -0,0 +1,1220 @@ + + + + + + C++ + 1 + source_name + 0 + 0 + res + UTF-8 + connect + BookmarkPanel + 1000 + none + 0 + BookmarkPanel + + . + + 1 + 1 + 1 + 1 + UI + 0 + 0 + + 0 + wxAUI_MGR_DEFAULT + + + 1 + 1 + impl_virtual + + + 0 + wxID_ANY + + + BookmarkPanel + + 169,471 + + + + + wxTAB_TRAVERSAL + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + bSizer1 + wxVERTICAL + none + + 5 + wxEXPAND + 5 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 0 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_treeView + 1 + + + protected + 1 + + Resizable + 1 + + wxTR_DEFAULT_STYLE + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + onTreeBeginLabelEdit + + + + onTreeEndLabelEdit + + onTreeActivate + onTreeCollapse + + onTreeExpanded + + + + + + + onTreeSelect + onTreeSelectChanging + + + + + + + 5 + wxBOTTOM|wxEXPAND|wxTOP + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_propPanel + 1 + + + protected + 1 + + Resizable + 1 + + + 0 + + + + wxTAB_TRAVERSAL + + + + + + + + + + + + + + + + + + + + + + + + + 2 + wxBOTH + 1 + + 0 + + fgPropSizer + wxFLEX_GROWMODE_SPECIFIED + none + 0 + 0 + + 5 + wxALIGN_RIGHT|wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Label + + 0 + + + 0 + + 1 + m_staticText1 + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxEXPAND|wxLEFT|wxTOP + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + + 0 + + 1 + m_labelText + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + onLabelText + + + + + + + + 5 + wxALIGN_RIGHT|wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Freq + + 0 + + + 0 + + 1 + m_frequencyLabel + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + FrequencyVal + + 0 + + + 0 + + 1 + m_frequencyVal + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_RIGHT|wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + BW + + 0 + + + 0 + + 1 + m_bandwidthLabel + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + BandwidthVal + + 0 + + + 0 + + 1 + m_bandwidthVal + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_RIGHT|wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Type + + 0 + + + 0 + + 1 + m_modulationLabel + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + TypeVal + + 0 + + + 0 + + 1 + m_typeVal + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_RIGHT|wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Bookmark + + 0 + + + 0 + + 1 + m_bookmarkButton + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + onBookmark + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_RIGHT|wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Activate + + 0 + + + 0 + + 1 + m_activateButton + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + onActivate + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Remove + + 0 + + + 0 + + 1 + m_removeButton + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + onRemove + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/forms/Bookmark/BookmarkPanel.h b/src/forms/Bookmark/BookmarkPanel.h new file mode 100644 index 0000000..97e5848 --- /dev/null +++ b/src/forms/Bookmark/BookmarkPanel.h @@ -0,0 +1,71 @@ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version Aug 23 2015) +// http://www.wxformbuilder.org/ +// +// PLEASE DO "NOT" EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#ifndef __BOOKMARKPANEL_H__ +#define __BOOKMARKPANEL_H__ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/////////////////////////////////////////////////////////////////////////// + + +/////////////////////////////////////////////////////////////////////////////// +/// Class BookmarkPanel +/////////////////////////////////////////////////////////////////////////////// +class BookmarkPanel : public wxPanel +{ + private: + + protected: + wxTreeCtrl* m_treeView; + wxPanel* m_propPanel; + wxStaticText* m_staticText1; + wxTextCtrl* m_labelText; + wxStaticText* m_frequencyLabel; + wxStaticText* m_frequencyVal; + wxStaticText* m_bandwidthLabel; + wxStaticText* m_bandwidthVal; + wxStaticText* m_modulationLabel; + wxStaticText* m_typeVal; + wxButton* m_bookmarkButton; + wxButton* m_activateButton; + wxButton* m_removeButton; + + // Virtual event handlers, overide them in your derived class + virtual void onTreeBeginLabelEdit( wxTreeEvent& event ) { event.Skip(); } + virtual void onTreeEndLabelEdit( wxTreeEvent& event ) { event.Skip(); } + virtual void onTreeActivate( wxTreeEvent& event ) { event.Skip(); } + virtual void onTreeCollapse( wxTreeEvent& event ) { event.Skip(); } + virtual void onTreeExpanded( wxTreeEvent& event ) { event.Skip(); } + virtual void onTreeSelect( wxTreeEvent& event ) { event.Skip(); } + virtual void onTreeSelectChanging( wxTreeEvent& event ) { event.Skip(); } + virtual void onLabelText( wxCommandEvent& event ) { event.Skip(); } + virtual void onBookmark( wxCommandEvent& event ) { event.Skip(); } + virtual void onActivate( wxCommandEvent& event ) { event.Skip(); } + virtual void onRemove( wxCommandEvent& event ) { event.Skip(); } + + + public: + + BookmarkPanel( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 169,471 ), long style = wxTAB_TRAVERSAL ); + ~BookmarkPanel(); + +}; + +#endif //__BOOKMARKPANEL_H__ diff --git a/src/forms/Bookmark/BookmarkView.cpp b/src/forms/Bookmark/BookmarkView.cpp new file mode 100644 index 0000000..f988604 --- /dev/null +++ b/src/forms/Bookmark/BookmarkView.cpp @@ -0,0 +1,50 @@ +#include "BookmarkView.h" + +BookmarkView::BookmarkView( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style) : BookmarkPanel(parent, id, pos, size, style) { + +} + +void BookmarkView::onTreeBeginLabelEdit( wxTreeEvent& event ) { + event.Skip(); +} + +void BookmarkView::onTreeEndLabelEdit( wxTreeEvent& event ) { + event.Skip(); +} + +void BookmarkView::onTreeActivate( wxTreeEvent& event ) { + event.Skip(); +} + +void BookmarkView::onTreeCollapse( wxTreeEvent& event ) { + event.Skip(); +} + +void BookmarkView::onTreeExpanded( wxTreeEvent& event ) { + event.Skip(); +} + +void BookmarkView::onTreeSelect( wxTreeEvent& event ) { + event.Skip(); +} + +void BookmarkView::onTreeSelectChanging( wxTreeEvent& event ) { + event.Skip(); +} + +void BookmarkView::onLabelText( wxCommandEvent& event ) { + event.Skip(); +} + +void BookmarkView::onBookmark( wxCommandEvent& event ) { + event.Skip(); +} + +void BookmarkView::onActivate( wxCommandEvent& event ) { + event.Skip(); +} + +void BookmarkView::onRemove( wxCommandEvent& event ) { + event.Skip(); +} + diff --git a/src/forms/Bookmark/BookmarkView.h b/src/forms/Bookmark/BookmarkView.h new file mode 100644 index 0000000..6ed3e17 --- /dev/null +++ b/src/forms/Bookmark/BookmarkView.h @@ -0,0 +1,26 @@ +#pragma once + +#include "BookmarkPanel.h" + +class BookmarkView : public BookmarkPanel { +public: + BookmarkView( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1, -1 ), long style = wxTAB_TRAVERSAL ); + + void updateActiveList(); + void saveToFile(std::string bookmarkFn); + void loadFromFile(std::string bookmarkFn); + +protected: + void onTreeBeginLabelEdit( wxTreeEvent& event ); + void onTreeEndLabelEdit( wxTreeEvent& event ); + void onTreeActivate( wxTreeEvent& event ); + void onTreeCollapse( wxTreeEvent& event ); + void onTreeExpanded( wxTreeEvent& event ); + void onTreeSelect( wxTreeEvent& event ); + void onTreeSelectChanging( wxTreeEvent& event ); + void onLabelText( wxCommandEvent& event ); + void onBookmark( wxCommandEvent& event ); + void onActivate( wxCommandEvent& event ); + void onRemove( wxCommandEvent& event ); + +}; \ No newline at end of file