Skip to content

Commit

Permalink
Run clang-format
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastien-rosset authored and leamas committed Aug 11, 2024
1 parent 056b558 commit 21e9875
Show file tree
Hide file tree
Showing 41 changed files with 1,902 additions and 1,894 deletions.
734 changes: 339 additions & 395 deletions android/androidUTIL.cpp

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion gui/include/gui/RoutePropDlgImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ class RoutePropDlgImpl : public RoutePropDlg {
const wxString& title = _("Route Properties"),
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxSize(550, 450),
long style = FRAME_WITH_LINKS_STYLE );
long style = FRAME_WITH_LINKS_STYLE);

private:
void SaveGeometry();
static bool instanceFlag;
Expand Down
29 changes: 15 additions & 14 deletions gui/include/gui/options.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
class wxGenericDirCtrl;
class MyConfig;
class ChartGroupsUI;
//class ConnectionParams;
// class ConnectionParams;
class PluginListPanel;
class ChartGroupArray;
class ChartGroup;
Expand Down Expand Up @@ -377,15 +377,16 @@ class options : private Uncopyable,
void ClearConfigList();
void BuildConfigList();
void OnConfigMouseSelected(wxMouseEvent &event);
void OnDialogInit(wxInitDialogEvent& event);

void OnDialogInit(wxInitDialogEvent &event);

bool GetNeedNew() { return m_bneedNew; }
void SetNeedNew(bool bnew) { m_bneedNew = bnew; }
int GetScrollRate() { return m_scrollRate; }
void SetForceNewToolbarOnCancel(bool val) { m_bForceNewToolbaronCancel = val; }
void SetForceNewToolbarOnCancel(bool val) {
m_bForceNewToolbaronCancel = val;
}

wxArrayString *GetSerialArray(){ return m_pSerialArray; }
wxArrayString *GetSerialArray() { return m_pSerialArray; }

// Should we show tooltips?
static bool ShowToolTips(void);
Expand Down Expand Up @@ -425,8 +426,9 @@ class options : private Uncopyable,
wxTextCtrl *pCmdSoundString;

wxChoice *m_pShipIconType, *m_pcTCDatasets;
wxSlider *m_pSlider_Zoom_Raster, *m_pSlider_GUI_Factor, *m_pSlider_Chart_Factor,
*m_pSlider_Ship_Factor, *m_pSlider_Text_Factor, *m_pSlider_ENCText_Factor;
wxSlider *m_pSlider_Zoom_Raster, *m_pSlider_GUI_Factor,
*m_pSlider_Chart_Factor, *m_pSlider_Ship_Factor, *m_pSlider_Text_Factor,
*m_pSlider_ENCText_Factor;
wxSlider *m_pMouse_Zoom_Slider;
wxSlider *m_pSlider_Zoom_Vector;
wxSlider *m_pSlider_CM93_Zoom;
Expand All @@ -447,7 +449,6 @@ class options : private Uncopyable,

void OnCanvasConfigSelectClick(int ID, bool selected);


bool b_haveWMM;
bool b_oldhaveWMM;
ColorScheme m_cs;
Expand Down Expand Up @@ -491,9 +492,9 @@ class options : private Uncopyable,
int m_nCharWidthMax;
wxBoxSizer *boxSizerCharts;
wxScrolledWindow *m_scrollWinChartList;
wxScrolledWindow* chartPanelWin;
wxBoxSizer* cmdButtonSizer;
wxStaticBox* loadedBox;
wxScrolledWindow *chartPanelWin;
wxBoxSizer *cmdButtonSizer;
wxStaticBox *loadedBox;
std::vector<OCPNChartDirPanel *> panelVector;
wxArrayString activeChartList;

Expand Down Expand Up @@ -661,7 +662,7 @@ class options : private Uncopyable,
ChartGroupsUI *groupsPanel;
wxImageList *m_topImgList;

wxCheckBox* m_persist_active_route_chkbox;
wxCheckBox *m_persist_active_route_chkbox;
wxScrolledWindow *m_pNMEAForm;
void resetMarStdList(bool bsetConfig, bool bsetStd);

Expand All @@ -688,7 +689,7 @@ class options : private Uncopyable,
wxSize m_sliderSize;
bool m_bneedNew;

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

DECLARE_EVENT_TABLE()
};
Expand Down Expand Up @@ -716,7 +717,7 @@ class CanvasConfigSelect : public wxPanel {
DECLARE_EVENT_TABLE()
};

class ChartGroupsUI : public wxScrolledWindow {
class ChartGroupsUI : public wxScrolledWindow {
public:
ChartGroupsUI(wxWindow *parent);
~ChartGroupsUI(void);
Expand Down
39 changes: 22 additions & 17 deletions gui/src/ConfigMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
#include "dychart.h"

#include <stdlib.h>
//#include <math.h>
// #include <math.h>
#include <time.h>
#include <locale>
#include <list>
Expand Down Expand Up @@ -463,7 +463,8 @@ ConfigPanel::ConfigPanel(OCPNConfigObject *config, wxWindow *parent,

SetMinSize(wxSize(-1, 6 * GetCharHeight()));

SetBackgroundColour(wxSystemSettings::GetColour(wxSystemColour::wxSYS_COLOUR_WINDOW));
SetBackgroundColour(
wxSystemSettings::GetColour(wxSystemColour::wxSYS_COLOUR_WINDOW));
// Connect(wxEVT_LEFT_DOWN,
// wxMouseEventHandler(ConfigPanel::OnConfigPanelMouseSelected), NULL, this);
}
Expand Down Expand Up @@ -501,7 +502,10 @@ ConfigMgr::ConfigMgr() {
LoadCatalog();
}

ConfigMgr::~ConfigMgr() { configList->Clear(); delete configList; }
ConfigMgr::~ConfigMgr() {
configList->Clear();
delete configList;
}

void ConfigMgr::Init() {
m_configDir = g_Platform->GetPrivateDataDir();
Expand Down Expand Up @@ -912,7 +916,7 @@ bool ConfigMgr::SaveTemplate(wxString fileName) {
for (const auto &mm : g_config_display_size_mm) {
st0.Append(wxString::Format(_T ( "%zu," ), mm));
}
st0.RemoveLast(); //Strip last comma
st0.RemoveLast(); // Strip last comma
conf->Write(_T ( "DisplaySizeMM" ), st0);
conf->Write(_T ( "DisplaySizeManual" ), g_config_display_size_manual);

Expand Down Expand Up @@ -1167,22 +1171,22 @@ bool ConfigMgr::CheckTemplateGUID(wxString GUID) {
return rv;
}

#define CHECK_INT(s, t) \
read_int = *t; \
#define CHECK_INT(s, t) \
read_int = *t; \
if (!conf.Read(s, &read_int)) wxLogMessage(s); \
if ((int)*t != read_int) return false;

#define CHECK_STR(s, t) \
val = t; \
conf.Read(s, &val); \
conf.Read(s, &val); \
if (!t.IsSameAs(val)) return false;

#define CHECK_STRP(s, t) \
conf.Read(s, &val); \
conf.Read(s, &val); \
if (!t->IsSameAs(val)) return false;

#define CHECK_FLT(s, t, eps) \
conf.Read(s, &val); \
conf.Read(s, &val); \
val.ToDouble(&dval); \
if (fabs(dval - *t) > eps) return false;

Expand Down Expand Up @@ -1342,8 +1346,9 @@ bool ConfigMgr::CheckTemplate(wxString fileName) {
// 2 = "Kilometers", 3 = "Meters"
CHECK_INT(_T ( "SpeedFormat" ),
&g_iSpeedFormat); // 0 = "kts"), 1 = "mph", 2 = "km/h", 3 = "m/s"
CHECK_INT(_T ( "WindSpeedFormat" ),
&g_iWindSpeedFormat); // 0 = "knots"), 1 = "m/s", 2 = "Mph", 3 = "km/h"
CHECK_INT(
_T ( "WindSpeedFormat" ),
&g_iWindSpeedFormat); // 0 = "knots"), 1 = "m/s", 2 = "Mph", 3 = "km/h"

// LIVE ETA OPTION
CHECK_INT(_T ( "LiveETA" ), &g_bShowLiveETA);
Expand Down Expand Up @@ -1598,14 +1603,14 @@ bool ConfigMgr::CheckTemplate(wxString fileName) {

// S57 template items

#define CHECK_BFN(s, t) \
conf.Read(s, &read_int); \
bval = t; \
bval0 = read_int != 0; \
#define CHECK_BFN(s, t) \
conf.Read(s, &read_int); \
bval = t; \
bval0 = read_int != 0; \
if (bval != bval0) return false;

#define CHECK_IFN(s, t) \
conf.Read(s, &read_int); \
#define CHECK_IFN(s, t) \
conf.Read(s, &read_int); \
if (read_int != t) return false;

#define CHECK_FFN(s, t) \
Expand Down
21 changes: 10 additions & 11 deletions gui/src/RoutePropDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,9 @@ EVT_CHAR(RoutePropDlg::OnKeyChar)
#endif
END_EVENT_TABLE()


extern Routeman *g_pRouteMan;
extern RoutePropDlgImpl *pRoutePropDialog;
extern RouteManagerDialog *pRouteManagerDialog;
extern Routeman* g_pRouteMan;
extern RoutePropDlgImpl* pRoutePropDialog;
extern RouteManagerDialog* pRouteManagerDialog;

RoutePropDlgCtx RoutePropDlg::GetDlgCtx() {
struct RoutePropDlgCtx ctx;
Expand Down Expand Up @@ -214,10 +213,9 @@ RoutePropDlg::RoutePropDlg(wxWindow* parent, wxWindowID id,
5);
#ifdef __ANDROID__
int ys = GetCharHeight();
m_dpDepartureDate->SetMinSize(wxSize(-1, ys * 15/10));
m_dpDepartureDate->SetMinSize(wxSize(-1, ys * 15 / 10));
#endif


#ifdef __WXGTK__
m_tpDepartureTime = new TimeCtrl(m_pnlBasic, wxID_ANY, wxDefaultDateTime,
wxDefaultPosition, wxDefaultSize);
Expand Down Expand Up @@ -284,9 +282,8 @@ RoutePropDlg::RoutePropDlg(wxWindow* parent, wxWindowID id,
m_stStyle->Wrap(-1);
bSizerStyle->Add(m_stStyle, 0, wxALL, 5);

wxString m_choiceStyleChoices[] = {_("Default"), _("Solid"),
_("Dot"), _("Long dash"),
_("Short dash")};
wxString m_choiceStyleChoices[] = {_("Default"), _("Solid"), _("Dot"),
_("Long dash"), _("Short dash")};
int m_choiceStyleNChoices = sizeof(m_choiceStyleChoices) / sizeof(wxString);
m_choiceStyle =
new wxChoice(m_pnlBasic, wxID_ANY, wxDefaultPosition, wxDefaultSize,
Expand Down Expand Up @@ -645,14 +642,16 @@ RoutePropDlg::RoutePropDlg(wxWindow* parent, wxWindowID id,
EVT_ROUTEMAN_DEL_TRK);
Bind(EVT_ROUTEMAN_DEL_TRK, [&](ObservedEvt& ev) {
auto t = std::const_pointer_cast<Track>(UnpackEvtPointer<Track>(ev));
RoutemanGui(*g_pRouteMan).DeleteTrack(t.get()); });
RoutemanGui(*g_pRouteMan).DeleteTrack(t.get());
});

wxDEFINE_EVENT(EVT_ROUTEMAN_DEL_ROUTE, ObservedEvt);
navobj_del_route_listener.Listen(navobj->evt_delete_route, this,
EVT_ROUTEMAN_DEL_ROUTE);
Bind(EVT_ROUTEMAN_DEL_ROUTE, [&](ObservedEvt& ev) {
auto r = std::const_pointer_cast<Route>(UnpackEvtPointer<Route>(ev));
g_pRouteMan->DeleteRoute(r.get(), navobj); });
g_pRouteMan->DeleteRoute(r.get(), navobj);
});
}

RoutePropDlg::~RoutePropDlg() {
Expand Down
23 changes: 11 additions & 12 deletions gui/src/RoutePropDlgImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -254,8 +254,7 @@ RoutePropDlgImpl::RoutePropDlgImpl(wxWindow* parent, wxWindowID id,
NULL, this);

#ifdef __WXOSX__
Connect(wxEVT_ACTIVATE,
wxActivateEventHandler(RoutePropDlgImpl::OnActivate),
Connect(wxEVT_ACTIVATE, wxActivateEventHandler(RoutePropDlgImpl::OnActivate),
NULL, this);
#endif
}
Expand All @@ -281,13 +280,13 @@ RoutePropDlgImpl* RoutePropDlgImpl::getInstance(wxWindow* parent) {
return single;
}

void RoutePropDlgImpl::OnActivate(wxActivateEvent& event){
wxFrame* pWin = wxDynamicCast(event.GetEventObject(), wxFrame);
long int style = pWin->GetWindowStyle();
if (event.GetActive())
pWin->SetWindowStyle(style | wxSTAY_ON_TOP);
else
pWin->SetWindowStyle(style ^ wxSTAY_ON_TOP);
void RoutePropDlgImpl::OnActivate(wxActivateEvent& event) {
wxFrame* pWin = wxDynamicCast(event.GetEventObject(), wxFrame);
long int style = pWin->GetWindowStyle();
if (event.GetActive())
pWin->SetWindowStyle(style | wxSTAY_ON_TOP);
else
pWin->SetWindowStyle(style ^ wxSTAY_ON_TOP);
}

void RoutePropDlgImpl::RecalculateSize(void) {
Expand Down Expand Up @@ -776,8 +775,7 @@ void RoutePropDlgImpl::WaypointsOnDataViewListCtrlSelectionChanged(
RoutePoint* prp = m_pRoute->GetPoint(selected_row + 1);
if (prp) {
if (gFrame->GetFocusCanvas()) {
gFrame->JumpToPosition(gFrame->GetFocusCanvas(), prp->m_lat,
prp->m_lon,
gFrame->JumpToPosition(gFrame->GetFocusCanvas(), prp->m_lat, prp->m_lon,
gFrame->GetFocusCanvas()->GetVPScale());
}
#ifdef __WXMSW__
Expand Down Expand Up @@ -916,7 +914,8 @@ void RoutePropDlgImpl::OnRoutePropMenuSelected(wxCommandEvent& event) {
RoutePoint* pRP = m_pRoute->GetPoint(
static_cast<int>(reinterpret_cast<long long>(selection.GetID())));

RouteManagerDialog::WptShowPropertiesDialog(std::vector<RoutePoint*> {pRP}, this);
RouteManagerDialog::WptShowPropertiesDialog(std::vector<RoutePoint*>{pRP},
this);
break;
}
}
Expand Down
Loading

0 comments on commit 21e9875

Please sign in to comment.