Skip to content

Commit

Permalink
Merge branch 'master' of github.com:OpenCPN/OpenCPN into span
Browse files Browse the repository at this point in the history
  • Loading branch information
bdbcat committed Jan 17, 2025
2 parents fb991b5 + 7b3c531 commit 60468c0
Show file tree
Hide file tree
Showing 44 changed files with 2,304 additions and 1,176 deletions.
10 changes: 8 additions & 2 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ jobs:
run: cmake --build build --config ${{env.BUILD_TYPE}}

- name: Test
continue-on-error: true
working-directory: build
run: make run-tests
...
run: |
if make run-tests; then
true
else
cd test && ctest --rerun-failed --output-on-failure || :
fi
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -776,7 +776,7 @@ set(GUI_HDRS
${GUI_HDR_DIR}/concanv.h
${GUI_HDR_DIR}/ConfigMgr.h
${GUI_HDR_DIR}/connection_edit.h
${GUI_HDR_DIR}/connections_dialog.h
${GUI_HDR_DIR}/connections_dlg.h
${GUI_HDR_DIR}/conn_params_panel.h
${GUI_HDR_DIR}/DetailSlider.h
${GUI_HDR_DIR}/displays.h
Expand Down Expand Up @@ -894,7 +894,7 @@ set(GUI_SRC
${GUI_SRC_DIR}/concanv.cpp
${GUI_SRC_DIR}/ConfigMgr.cpp
${GUI_SRC_DIR}/connection_edit.cpp
${GUI_SRC_DIR}/connections_dialog.cpp
${GUI_SRC_DIR}/connections_dlg.cpp
${GUI_SRC_DIR}/conn_params_panel.cpp
${GUI_SRC_DIR}/DetailSlider.cpp
${GUI_SRC_DIR}/displays.cpp
Expand Down
954 changes: 755 additions & 199 deletions buildwin/winConfig.bat

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion gui/include/gui/connection_edit.h
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ class ConnectionEditDialog : public wxDialog {
wxRadioButton *m_rbOIgnore, *m_rbTypeCAN;
wxStaticText *m_stBTPairs, *m_stNetProto, *m_stNetAddr, *m_stNetPort;
wxStaticText *m_stSerPort, *m_stSerBaudrate, *m_stSerProtocol;
wxStaticText *m_stPriority, *m_stFilterSec, *m_stPrecision;
wxStaticText *m_stFilterSec, *m_stPrecision;
wxStaticText *m_stTalkerIdText;
wxStaticText *m_stNetComment, *m_stSerialComment, *m_stCANSource,
*m_stAuthToken;
Expand Down
98 changes: 0 additions & 98 deletions gui/include/gui/connections_dialog.h

This file was deleted.

40 changes: 40 additions & 0 deletions gui/include/gui/connections_dlg.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// TBD

#ifndef CONNECT_NEW_DLG__
#define CONNECT_NEW_DLG__

#include <functional>

#include <wx/panel.h>
#include <wx/scrolwin.h>
#include "model/conn_params.h"
#include "observable_evtvar.h"

class ConnectionsDlg : public wxPanel {
public:
ConnectionsDlg(wxWindow* parent,
const std::vector<ConnectionParams*>& connections);

/**
* Traverse root's children and invoke Apply if they implement ApplyCancel
*/
void ApplySettings();

/**
* Traverse root's children and invoke Cancel if they implement ApplyCancel
*/
void CancelSettings();

void OnResize();

private:
void DoApply(wxWindow* root);
void DoCancel(wxWindow* root);

const std::vector<ConnectionParams*>& m_connections;
std::function<void()> m_on_exit;
EventVar m_evt_add_connection;
ObsListener m_add_connection_lstnr;
};

#endif // CONNECT_NEW_DLG__
2 changes: 2 additions & 0 deletions gui/include/gui/ocpn_frame.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
#include "model/comm_appmsg_bus.h"
#include "bbox.h"
#include "comm_overflow_dlg.h"
#include "connections_dlg.h"
#include "color_handler.h"
#include "gui_lib.h"
#include "load_errors_dlg.h"
Expand Down Expand Up @@ -410,6 +411,7 @@ class MyFrame : public wxFrame {
ObsListener m_evt_drv_msg_listener;

CommOverflowDlg comm_overflow_dlg;
ConnectionsDlg* m_connections_dlg;

DECLARE_EVENT_TABLE()
};
Expand Down
16 changes: 5 additions & 11 deletions gui/include/gui/options.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,17 @@
#endif

#include <memory>
#include <vector>

#include <wx/listbook.h>
#include <wx/dirctrl.h>
#include <wx/frame.h>
#include <wx/spinctrl.h>
#include <wx/listctrl.h>
#include <wx/choice.h>
#include <wx/collpane.h>
#include <wx/clrpicker.h>
#include <wx/colourdata.h>
#include "connections_dialog.h"

#if wxUSE_TIMEPICKCTRL
#include <wx/timectrl.h>
Expand All @@ -53,18 +54,11 @@
#include "time_textbox.h"
#endif

#include <vector>

#if wxCHECK_VERSION(2, 9, 0)
#include <wx/frame.h>
#else
#include "scrollingdialog.h"
#endif

#include "chartdbs.h"
#include "pluginmanager.h" // FIXME: Refactor
#include "connections_dlg.h"

#ifndef __OCPN__ANDROID__
#ifndef __ANDROID__
#define __OCPN__OPTIONS_USE_LISTBOOK__
#endif

Expand Down Expand Up @@ -689,7 +683,7 @@ class options : private Uncopyable,
wxSize m_sliderSize;
bool m_bneedNew;

std::shared_ptr<ConnectionsDialog> comm_dialog;
std::shared_ptr<ConnectionsDlg> comm_dialog;

DECLARE_EVENT_TABLE()
};
Expand Down
33 changes: 19 additions & 14 deletions gui/src/MarkInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1753,28 +1753,33 @@ bool MarkInfoDlg::SaveChanges() {
} else {
m_pRoutePoint->SetETD(wxEmptyString);
}

// Here is some logic....
// If the Markname is completely numeric, and is part of a route,
// If the name has 3 numeric characters, and is part of a route,
// Then declare it to be of attribute m_bDynamicName = true
// This is later used for re-numbering points on actions like
// Insert Point, Delete Point, Append Point, etc

if (m_pRoutePoint->m_bIsInRoute) {
bool b_name_is_numeric = true;
for (unsigned int i = 0; i < m_pRoutePoint->GetName().Len(); i++) {
if (i < 2 && wxChar('N') == m_pRoutePoint->GetName()[0] &&
wxChar('M') == m_pRoutePoint->GetName()[1] &&
m_pRoutePoint->GetName().Len() > 2)
continue;
if (wxChar('0') > m_pRoutePoint->GetName()[i])
b_name_is_numeric = false;
if (wxChar('9') < m_pRoutePoint->GetName()[i])
b_name_is_numeric = false;
if (m_pRoutePoint->GetName().Len() >= 2) {
wxString substring = m_pRoutePoint->GetName().Left(2);
if (substring == "NM") {
substring = m_pRoutePoint->GetName().substr(2, 3);
} else {
substring = m_pRoutePoint->GetName().Left(3);
}
for (unsigned int i = 0; i < substring.Len(); i++) {
if (b_name_is_numeric == true) {
b_name_is_numeric = wxIsdigit(substring[i]);
}
}
m_pRoutePoint->m_bDynamicName = b_name_is_numeric;
} else {
m_pRoutePoint->m_bDynamicName = false;
}

m_pRoutePoint->m_bDynamicName = b_name_is_numeric;
} else
} else {
m_pRoutePoint->m_bDynamicName = false;
}

if (m_pRoutePoint->m_bIsInRoute) {
// Update the route segment selectables
Expand Down
3 changes: 2 additions & 1 deletion gui/src/TTYWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ TTYWindow::TTYWindow(wxWindow* parent, int n_lines,
: m_window_destroy_listener(listener), m_tty_scroll(NULL) {
wxFrame::Create(
parent, -1, _T("Title"), wxDefaultPosition, wxDefaultSize,
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxFRAME_FLOAT_ON_PARENT);
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxFRAME_FLOAT_ON_PARENT,
"NmeaDebugWindow");

wxBoxSizer* bSizerOuterContainer = new wxBoxSizer(wxVERTICAL);
SetSizer(bSizerOuterContainer);
Expand Down
18 changes: 18 additions & 0 deletions gui/src/canvasMenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
#include "model/config_vars.h"
#include "model/cutil.h"
#include "model/georef.h"
#include "model/gui.h"
#include "model/mdns_cache.h"
#include "model/mdns_query.h"
#include "model/nav_object_database.h"
Expand All @@ -67,6 +68,7 @@
#include "navutil.h"
#include "ocpn_frame.h"
#include "OCPNPlatform.h"
#include "NMEALogWindow.h"
#include "peer_client_dlg.h"
#include "pluginmanager.h"
#include "Quilt.h"
Expand Down Expand Up @@ -207,6 +209,9 @@ enum {
ID_DEF_MENU_CURRENTINFO,
ID_DEF_ZERO_XTE,

ID_DEF_MENU_DEBUG,
ID_DGB_MENU_NMEA_WINDOW,

ID_DEF_MENU_GROUPBASE, // Must be last entry, as chart group identifiers are
// created dynamically

Expand Down Expand Up @@ -322,6 +327,8 @@ void CanvasMenuHandler::CanvasPopupMenu(int x, int y, int seltype) {
#else
wxMenu *subMenuRedo = new wxMenu("Redo...Ctrl-Y");
#endif
wxMenu *subMenuDebug = new wxMenu("");
MenuAppend1(subMenuDebug, ID_DGB_MENU_NMEA_WINDOW, "Show NMEA log window");

wxMenu *menuFocus = contextMenu; // This is the one that will be shown

Expand Down Expand Up @@ -703,6 +710,8 @@ void CanvasMenuHandler::CanvasPopupMenu(int x, int y, int seltype) {
}
}
}
if (g_enable_root_menu_debug)
contextMenu->AppendSubMenu(subMenuDebug, _("Debug"));

if (seltype & SELTYPE_ROUTESEGMENT) {
if (!g_bBasicMenus && m_pSelectedRoute) {
Expand Down Expand Up @@ -1491,6 +1500,15 @@ void CanvasMenuHandler::PopupMenuHandler(wxCommandEvent &event) {

break;
}

case ID_DGB_MENU_NMEA_WINDOW: {
if (!wxWindow::FindWindowByName("NmeaDebugWindow")) {
auto top_window = wxWindow::FindWindowByName(kTopLevelWindowName);
NMEALogWindow::GetInstance().Create(top_window, 35);
}
wxWindow::FindWindowByName("NmeaDebugWindow")->Show();
} break;

case ID_RT_MENU_REVERSE: {
if (m_pSelectedRoute->m_bIsInLayer) break;

Expand Down
10 changes: 10 additions & 0 deletions gui/src/chcanv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
#include "model/conn_params.h"
#include "model/cutil.h"
#include "model/geodesic.h"
#include "model/gui.h"
#include "model/idents.h"
#include "model/multiplexer.h"
#include "model/nav_object_database.h"
Expand Down Expand Up @@ -82,6 +83,7 @@
#include "mbtiles.h"
#include "MUIBar.h"
#include "navutil.h"
#include "NMEALogWindow.h"
#include "OCPN_AUIManager.h"
#include "ocpndc.h"
#include "ocpn_frame.h"
Expand Down Expand Up @@ -3000,6 +3002,14 @@ void ChartCanvas::OnKeyDown(wxKeyEvent &event) {
break;
}

case 'E':
if (!wxWindow::FindWindowByName("NmeaDebugWindow")) {
auto top_window = wxWindow::FindWindowByName(kTopLevelWindowName);
NMEALogWindow::GetInstance().Create(top_window, 35);
}
wxWindow::FindWindowByName("NmeaDebugWindow")->Show();
break;

case 'L':
SetShowENCLights(!GetShowENCLights());
ReloadVP();
Expand Down
Loading

0 comments on commit 60468c0

Please sign in to comment.