dlg_filter.cpp
dlg_options.cpp
dlg_ptt.cpp
+ dlg_plugin.cpp
fdmdv2_main.cpp
fdmdv2_pa_wrapper.cpp
fdmdv2_plot.cpp
--- /dev/null
+//==========================================================================
+// Name: dlg_plugin.cpp
+// Purpose: Subclasses dialog GUI for PlugIn Config. Creates simple
+// wxWidgets dialog GUI to set a few text strings.
+// Date: Jan 2016
+// Authors: David Rowe
+//
+// License:
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License version 2.1,
+// as published by the Free Software Foundation. This program is
+// distributed in the hope that it will be useful, but WITHOUT ANY
+// WARRANTY; without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
+// License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, see <http://www.gnu.org/licenses/>.
+//
+//==========================================================================
+
+#include "dlg_plugin.h"
+#include "fdmdv2_main.h"
+
+#ifdef __WIN32__
+#include <wx/msw/registry.h>
+#endif
+#if defined(__FreeBSD__) || defined(__WXOSX__)
+#include <glob.h>
+#include <string.h>
+#endif
+
+#include <sstream>
+
+//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=
+// Class PlugInDlg
+//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=
+PlugInDlg::PlugInDlg(wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style) : wxDialog(parent, id, title, pos, size, style)
+{
+ wxBoxSizer* mainSizer = new wxBoxSizer(wxVERTICAL);
+ this->SetSizer(mainSizer);
+
+ wxStaticBoxSizer* staticBoxSizer28a = new wxStaticBoxSizer( new wxStaticBox(this, wxID_ANY, _("Param1")), wxVERTICAL);
+ m_txtCtrlPlugIn1 = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(300,-1), 0);
+ staticBoxSizer28a->Add(m_txtCtrlPlugIn1, 0, 0, 5);
+ mainSizer->Add(staticBoxSizer28a, 0, wxEXPAND, 5);
+
+ wxStaticBoxSizer* staticBoxSizer28b = new wxStaticBoxSizer( new wxStaticBox(this, wxID_ANY, _("Param2")), wxVERTICAL);
+ m_txtCtrlPlugIn2 = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(300,-1), 0);
+ staticBoxSizer28b->Add(m_txtCtrlPlugIn2, 0, 0, 5);
+ mainSizer->Add(staticBoxSizer28b, 0, wxEXPAND, 5);
+
+ //----------------------------------------------------------------------
+ // OK - Cancel - Apply
+ //----------------------------------------------------------------------
+
+ wxBoxSizer* boxSizer12 = new wxBoxSizer(wxHORIZONTAL);
+
+ m_buttonOK = new wxButton(this, wxID_OK, _("OK"), wxDefaultPosition, wxSize(-1,-1), 0);
+ m_buttonOK->SetDefault();
+ boxSizer12->Add(m_buttonOK, 0, wxLEFT|wxRIGHT|wxTOP|wxBOTTOM, 5);
+
+ m_buttonCancel = new wxButton(this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxSize(-1,-1), 0);
+ boxSizer12->Add(m_buttonCancel, 0, wxLEFT|wxRIGHT|wxTOP|wxBOTTOM, 5);
+
+ mainSizer->Add(boxSizer12, 0, wxLEFT|wxRIGHT|wxTOP|wxBOTTOM|wxALIGN_CENTER_HORIZONTAL, 5);
+
+ if ( GetSizer() )
+ {
+ GetSizer()->Fit(this);
+ }
+ Centre(wxBOTH);
+
+ // Connect events
+ this->Connect(wxEVT_INIT_DIALOG, wxInitDialogEventHandler(PlugInDlg::OnInitDialog), NULL, this);
+ m_buttonOK->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(PlugInDlg::OnOK), NULL, this);
+ m_buttonCancel->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(PlugInDlg::OnCancel), NULL, this);
+
+}
+
+//-------------------------------------------------------------------------
+// ~PlugInDlg()
+//-------------------------------------------------------------------------
+PlugInDlg::~PlugInDlg()
+{
+ // Disconnect Events
+ this->Disconnect(wxEVT_INIT_DIALOG, wxInitDialogEventHandler(PlugInDlg::OnInitDialog), NULL, this);
+ m_buttonOK->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(PlugInDlg::OnOK), NULL, this);
+ m_buttonCancel->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(PlugInDlg::OnCancel), NULL, this);
+}
+
+//-------------------------------------------------------------------------
+// OnInitDialog()
+//-------------------------------------------------------------------------
+void PlugInDlg::OnInitDialog(wxInitDialogEvent& event)
+{
+ ExchangeData(EXCHANGE_DATA_IN);
+}
+
+
+//-------------------------------------------------------------------------
+// ExchangeData()
+//-------------------------------------------------------------------------
+void PlugInDlg::ExchangeData(int inout)
+{
+ wxConfigBase *pConfig = wxConfigBase::Get();
+ wxString str;
+
+ if(inout == EXCHANGE_DATA_IN)
+ {
+ m_txtCtrlPlugIn1->SetValue(wxGetApp().m_txtPlugIn1);
+ m_txtCtrlPlugIn2->SetValue(wxGetApp().m_txtPlugIn2);
+ }
+ if(inout == EXCHANGE_DATA_OUT)
+ {
+ wxGetApp().m_txtPlugIn1 = m_txtCtrlPlugIn1->GetValue();
+ pConfig->Write(wxT("/PlugIn/txt1"), wxGetApp().m_txtPlugIn1);
+ wxGetApp().m_txtPlugIn2 = m_txtCtrlPlugIn2->GetValue();
+ pConfig->Write(wxT("/PlugIn/txt2"), wxGetApp().m_txtPlugIn2);
+ pConfig->Flush();
+ }
+ delete wxConfigBase::Set((wxConfigBase *) NULL);
+}
+
+
+//-------------------------------------------------------------------------
+// OnCancel()
+//-------------------------------------------------------------------------
+void PlugInDlg::OnCancel(wxCommandEvent& event)
+{
+ this->EndModal(wxID_CANCEL);
+}
+
+//-------------------------------------------------------------------------
+// OnClose()
+//-------------------------------------------------------------------------
+void PlugInDlg::OnOK(wxCommandEvent& event)
+{
+ ExchangeData(EXCHANGE_DATA_OUT);
+ this->EndModal(wxID_OK);
+}
--- /dev/null
+//==========================================================================
+// Name: dlg_ptt.h
+// Purpose: Subclasses dialog GUI for PTT Config.
+//
+// Created: May. 11, 2012
+// Authors: David Rowe, David Witten
+//
+// License:
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License version 2.1,
+// as published by the Free Software Foundation. This program is
+// distributed in the hope that it will be useful, but WITHOUT ANY
+// WARRANTY; without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
+// License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, see <http://www.gnu.org/licenses/>.
+//
+//==========================================================================
+#ifndef __PLUGIN_DIALOG__
+#define __PLUGIN_DIALOG__
+
+#include "fdmdv2_main.h"
+#include <wx/settings.h>
+#include <wx/xrc/xmlres.h>
+#include <wx/xrc/xh_bmp.h>
+#include <wx/dialog.h>
+#include <wx/sizer.h>
+#include <wx/statbox.h>
+#include <wx/checkbox.h>
+#include <wx/listbox.h>
+#include <wx/radiobut.h>
+#include <wx/button.h>
+#include <wx/spinctrl.h>
+
+//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=
+// Class PlugInDlg
+//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=
+class PlugInDlg : public wxDialog
+{
+ public:
+ PlugInDlg(wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Plugin Config"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize(450,300), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER);
+ virtual ~PlugInDlg();
+ void ExchangeData(int inout);
+
+ protected:
+
+ wxTextCtrl *m_txtCtrlPlugIn1;
+ wxTextCtrl *m_txtCtrlPlugIn2;
+ wxTextCtrl *m_txtCtrlPlugIn3;
+ /* Ok - Cance */
+
+ wxButton* m_buttonOK;
+ wxButton* m_buttonCancel;
+
+
+protected:
+
+ void OnOK(wxCommandEvent& event);
+ void OnCancel(wxCommandEvent& event);
+ virtual void OnInitDialog(wxInitDialogEvent& event);
+};
+
+#endif // __PLUGIN_DIALOG__
event.Enable(!m_RxRunning);
}
+//-------------------------------------------------------------------------
+// OnToolsPlugInCfg()
+//-------------------------------------------------------------------------
+void MainFrame::OnToolsPlugInCfg(wxCommandEvent& event)
+{
+ wxUnusedVar(event);
+ PlugInDlg *dlg = new PlugInDlg(NULL);
+ dlg->ShowModal();
+ delete dlg;
+}
+
+
//-------------------------------------------------------------------------
// OnHelpCheckUpdates()
//-------------------------------------------------------------------------
void MainFrame::OnHelpAbout(wxCommandEvent& event)
{
wxUnusedVar(event);
-#ifdef _USE_ABOUT_DIALOG
- int rv = 0;
- AboutDlg *dlg = new AboutDlg(NULL);
- rv = dlg->ShowModal();
- if(rv == wxID_OK)
- {
- dlg->ExchangeData(EXCHANGE_DATA_OUT);
- }
- delete dlg;
-#else
- wxString svnLatestRev("Can't determine latest SVN revision.");
-
- // Try to determine current SVN revision from the Internet
- wxURL url(wxT("http://svn.code.sf.net/p/freetel/code/freedv-dev/"));
-
- if(url.GetError() == wxURL_NOERR)
- {
- wxString htmldata;
- wxInputStream *in = url.GetInputStream();
-
- if(in && in->IsOk())
- {
- //printf("In OK\n");
- wxStringOutputStream html_stream(&htmldata);
- in->Read(html_stream);
- //wxLogDebug(htmldata);
-
- wxString s("<h2>p/freetel/code - Revision ");
- int startIndex = htmldata.find(s) + s.Length();
- int endIndex = htmldata.find(wxT(": /fdmdv2</h2>"));
- svnLatestRev = wxT("Latest svn revision: ") + htmldata.SubString(startIndex, endIndex-1);
- //printf("startIndex: %d endIndex: %d\n", startIndex, endIndex);
- }
- delete in;
- }
-
wxString msg;
msg.Printf( wxT("FreeDV %s\n\n")
- wxT("Open Source Narrow Band Digital Voice over Radio\n\n")
+ wxT("Open Source Digital Voice\n\n")
wxT("For Help and Support visit: http://freedv.org\n\n")
- wxT("How much have you spent on Ham gear this year? How did it compare to FreeDV? ")
- wxT("FreeDV repesents an open and free future for digital voice over Ham Radio. ")
- wxT("Please help by donating just $10 here: http://freedv.org\n\n")
-
wxT("GNU Public License V2.1\n\n")
wxT("Copyright (c) David Witten KD0EAG and David Rowe VK5DGR\n\n")
- wxT("svn revision: %s\n") + svnLatestRev, FREEDV_VERSION, SVN_REVISION);
+ wxT("svn revision: %s\n"), FREEDV_VERSION, SVN_REVISION);
wxMessageBox(msg, wxT("About"), wxOK | wxICON_INFORMATION, this);
-
-#endif // _USE_ABOUT_DIALOG
-#ifdef USE_SIMPLE_ABOUT_DIALOG
- wxUnusedVar(event);
- wxAboutDialogInfo info;
- info.SetCopyright(_("HAMLib Test"));
- info.SetLicence(_("GPL v2 or later"));
- info.SetDescription(_("Short description goes here"));
- ::wxAboutBox(info);
-#endif // USE_SIMPLE_ABOUT_DIALOG
-
}
// if we found a match, lets run the replace regexp and issue the system command
wxString event_str_rep = event_str;
-
+
if (re.Replace(&event_str_rep, regexp_replace) != 0) {
- //printf(" found match!\n");
+ fprintf(stderr, " found match! event_str: %s\n", (const char *)event_str.c_str());
found_match = true;
bool enableSystem = false;
if (spamTimer[rule].IsRunning()) {
enableSystem = false;
- //printf(" spam timer running\n");
+ fprintf(stderr, " spam timer running\n");
}
const char *event_out = event_str_rep.ToUTF8();
#include "varicode.h"
#include "sox_biquad.h"
#include "comp_prim.h"
+#include "dlg_plugin.h"
#define _USE_TIMER 1
#define _USE_ONIDLE 1
bool loadConfig();
bool saveConfig();
+ // Plugins -----------------------------------
+
+ wxString m_txtPlugIn1;
+ wxString m_txtPlugIn2;
+
// misc
bool m_testFrames;
void OnToolsOptions(wxCommandEvent& event);
void OnToolsOptionsUI(wxUpdateUIEvent& event);
+ void OnToolsPlugInCfg( wxCommandEvent& event );
+
void OnPlayFileToMicIn( wxCommandEvent& event );
void StopPlayFileToMicIn(void);
void OnRecFileFromRadio( wxCommandEvent& event );
m_menuItemFilter = new wxMenuItem(tools, wxID_ANY, wxString(_("&Filter")) , wxEmptyString, wxITEM_NORMAL);
tools->Append(m_menuItemFilter);
+ wxMenuItem* m_menuItemPlugIn;
+ m_menuItemPlugIn = new wxMenuItem(tools, wxID_ANY, wxString(_("PlugIn Config")) , wxEmptyString, wxITEM_NORMAL);
+ tools->Append(m_menuItemPlugIn);
+
wxMenuItem* m_menuItemPlayFileToMicIn;
m_menuItemPlayFileToMicIn = new wxMenuItem(tools, wxID_ANY, wxString(_("Start/Stop Play File - Mic In")) , wxEmptyString, wxITEM_NORMAL);
g_playFileToMicInEventId = m_menuItemPlayFileToMicIn->GetId();
this->Connect(m_menuItemOptions->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(TopFrame::OnToolsOptions));
this->Connect(m_menuItemOptions->GetId(), wxEVT_UPDATE_UI, wxUpdateUIEventHandler(TopFrame::OnToolsOptionsUI));
+ this->Connect(m_menuItemPlugIn->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(TopFrame::OnToolsPlugInCfg));
+
this->Connect(m_menuItemPlayFileToMicIn->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(TopFrame::OnPlayFileToMicIn));
this->Connect(m_menuItemRecFileFromRadio->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(TopFrame::OnRecFileFromRadio));
this->Connect(m_menuItemPlayFileFromRadio->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(TopFrame::OnPlayFileFromRadio));
this->Disconnect(wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(TopFrame::OnToolsOptions));
this->Disconnect(wxID_ANY, wxEVT_UPDATE_UI, wxUpdateUIEventHandler(TopFrame::OnToolsOptionsUI));
+ this->Disconnect(wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(TopFrame::OnToolsPlugInCfg));
+
this->Disconnect(wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(TopFrame::OnPlayFileToMicIn));
this->Disconnect(wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(TopFrame::OnRecFileFromRadio));
this->Disconnect(wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(TopFrame::OnPlayFileFromRadio));
virtual void OnToolsFilter( wxCommandEvent& event ) { event.Skip(); }
virtual void OnToolsFilterUI( wxUpdateUIEvent& event ) { event.Skip(); }
virtual void OnToolsOptions( wxCommandEvent& event ) { event.Skip(); }
+
+ virtual void OnToolsPlugInCfg( wxCommandEvent& event ) { event.Skip(); }
+
virtual void OnToolsUDP( wxCommandEvent& event ) { event.Skip(); }
virtual void OnToolsOptionsUI( wxUpdateUIEvent& event ) { event.Skip(); }
virtual void OnToolsComCfg( wxCommandEvent& event ) { event.Skip(); }