Skip to content

Commit

Permalink
Merge pull request OpenCPN#32 from jongough/hilite-points
Browse files Browse the repository at this point in the history
Hilite points
  • Loading branch information
jongough committed May 28, 2015
2 parents f91cfe5 + 129d7fb commit b3b3f47
Show file tree
Hide file tree
Showing 20 changed files with 349 additions and 315 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ SET(CPACK_PACKAGE_CONTACT "Jon Gough")

SET(VERSION_MAJOR "0")
SET(VERSION_MINOR "3")
SET(VERSION_PATCH "0170")
SET(VERSION_DATE "27/05/2015")
SET(VERSION_PATCH "0190")
SET(VERSION_DATE "28/05/2015")

SET(BUNDLE_DATA FALSE)

Expand Down
4 changes: 2 additions & 2 deletions include/Path.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class Path : public wxObject
void CalculateDCRect(wxDC& dc_boundary, wxRect *prect, PlugIn_ViewPort &VP);
int GetnPoints(void){ return m_nPoints; }
wxBoundingBox GetBBox();
void SetnPoints(void){ m_nPoints = pODPointList->GetCount(); }
void SetnPoints(void){ m_nPoints = g_pODPointList->GetCount(); }
void SetHiLite( int width ) {m_hiliteWidth = width; }
void Reverse(bool bRenamePoints = false);
void RebuildGUIDList(void);
Expand Down Expand Up @@ -132,7 +132,7 @@ class Path : public wxObject
HyperlinkList *m_HyperlinkList;

wxArrayString ODPointGUIDList;
ODPointList *pODPointList;
ODPointList *g_pODPointList;

wxRect active_pt_rect;
wxString m_ActiveLineColour;
Expand Down
2 changes: 2 additions & 0 deletions include/pathmanagerdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ class PathManagerDialog : public wxDialog {
// void OnODPointSendToGPSClick(wxCommandEvent &event);
void OnODPointDeleteAllClick(wxCommandEvent &event);
void OnODPointSelected(wxListEvent &event);
void OnODPointDeSelected(wxListEvent &event);
void OnODPointToggleVisibility(wxMouseEvent &event);
void OnODPointColumnClicked(wxListEvent &event);

Expand All @@ -119,6 +120,7 @@ class PathManagerDialog : public wxDialog {
void OnClose(wxCloseEvent &event);
void OnOK(wxCommandEvent &event);
void DeSelectPaths( void );
void DeSelectODPoints( void );

// properties
wxNotebook *m_pNotebook;
Expand Down
4 changes: 2 additions & 2 deletions ocpnsrc/Layer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
WX_DEFINE_LIST(LayerList);

extern bool g_bShowLayers;
extern LayerList *pLayerList;
extern LayerList *g_pLayerList;

Layer::Layer( void )
{
Expand All @@ -46,7 +46,7 @@ Layer::Layer( void )
Layer::~Layer( void )
{
// Remove this layer from the global layer list
if( NULL != pLayerList ) pLayerList->DeleteObject( this );
if( NULL != g_pLayerList ) g_pLayerList->DeleteObject( this );

}

Expand Down
10 changes: 5 additions & 5 deletions ocpnsrc/chart1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ int g_restore_dbindex;
double g_ChartNotRenderScaleFactor;

RouteList *pRouteList;
LayerList *pLayerList;
LayerList *g_pLayerList;
bool g_bIsNewLayer;
int g_LayerIdx;
bool g_bLayerViz;
Expand Down Expand Up @@ -2106,7 +2106,7 @@ int MyApp::OnExit()

DeInitializeUserColors();

delete pLayerList;
delete g_pLayerList;

#ifdef USE_S57
delete m_pRegistrarMan;
Expand Down Expand Up @@ -3135,10 +3135,10 @@ void MyFrame::OnCloseWindow( wxCloseEvent& event )
}
delete g_pConnectionParams;

if(pLayerList){
if(g_pLayerList){
LayerList::iterator it;
while(pLayerList->GetCount()){
Layer *lay = pLayerList->GetFirst()->GetData();
while(g_pLayerList->GetCount()){
Layer *lay = g_pLayerList->GetFirst()->GetData();
delete lay; // automatically removes the layer from list, see Layer dtor
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/Boundary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ void Boundary::Draw( ocpnDC& dc, PlugIn_ViewPort &VP )
if ( m_bVisible ) {
dc.SetPen(*wxTRANSPARENT_PEN);
dc.SetBrush( *wxTheBrushList->FindOrCreateBrush( m_fillcol, wxCROSSDIAG_HATCH ) );
dc.DrawPolygon( pODPointList->GetCount(), m_bpts, 0, 0);
dc.DrawPolygon( g_pODPointList->GetCount(), m_bpts, 0, 0);
}

}
Expand Down Expand Up @@ -96,8 +96,8 @@ void Boundary::DrawGL( PlugIn_ViewPort &piVP )
if ( m_bVisible ) {
//dc.SetPen(*wxTRANSPARENT_PEN);
dc.SetBrush( *wxTheBrushList->FindOrCreateBrush( m_fillcol, wxBDIAGONAL_HATCH ) );
if ( pODPointList->GetCount() > 1 )
dc.DrawPolygonTessellated( pODPointList->GetCount(), m_bpts, 0, 0);
if ( g_pODPointList->GetCount() > 1 )
dc.DrawPolygonTessellated( g_pODPointList->GetCount(), m_bpts, 0, 0);
}
glEnd();
glDisable (GL_POLYGON_STIPPLE);
Expand Down
2 changes: 1 addition & 1 deletion src/BoundaryProp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#include "BoundaryProp.h"
#include "Boundary.h"

extern BoundaryList *pBoundaryList;
extern BoundaryList *g_pBoundaryList;


BoundaryProp::BoundaryProp()
Expand Down
16 changes: 8 additions & 8 deletions src/ODConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,17 @@ extern int g_LayerIdx;
extern bool g_bShowLayers;
extern wxString g_VisibleLayers;
extern wxString g_InvisibleLayers;
extern LayerList *pLayerList;
extern LayerList *g_pLayerList;
extern PointMan *pODPointMan;
extern PathList *pPathList;
extern PathList *g_pPathList;
extern int g_navobjbackups;

//ODConfig::ODConfig(const wxString &appName, const wxString &vendorName,
// const wxString &LocalFileName) : MyConfig( appName, vendorName, LocalFileName)
ODConfig::ODConfig(const wxString &appName, const wxString &vendorName, const wxString &LocalFileName)
{
//ODConfig *pCF = new MyConfig::MyConfig( wxString( _T("") ), wxString( _T("") ), gConfig_File );
//pODConfig->LoadMyConfig( 0 );
//g_pODConfig->LoadMyConfig( 0 );
m_sODNavObjSetFile = *g_pData;
m_sODNavObjSetFile += wxS( "ODnavobj.xml" );
m_sODNavObjSetChangesFile = m_sODNavObjSetFile + _T( ".changes" );
Expand Down Expand Up @@ -342,7 +342,7 @@ void ODConfig::ExportGPX( wxWindow* parent, bool bviz_only, bool blayer )
node = node->GetNext();
}
//Paths
wxPathListNode *node1 = pPathList->GetFirst();
wxPathListNode *node1 = g_pPathList->GetFirst();
while( node1 ) {
Path *pPath = node1->GetData();

Expand Down Expand Up @@ -428,7 +428,7 @@ void ODConfig::UI_ImportGPX( wxWindow* parent, bool islayer, wxString dirpath, b
laymsg.Printf( wxT("New layer %d: %s"), l->m_LayerID, l->m_LayerName.c_str() );
wxLogMessage( laymsg );

pLayerList->Insert( l );
g_pLayerList->Insert( l );
}

for( unsigned int i = 0; i < file_array.GetCount(); i++ ) {
Expand Down Expand Up @@ -505,12 +505,12 @@ bool ODConfig::ODPointIsInPathList( ODPoint *pr )
{
bool IsInList = false;

wxPathListNode *node1 = pPathList->GetFirst();
wxPathListNode *node1 = g_pPathList->GetFirst();
while( node1 ) {
Path *pPath = node1->GetData();
ODPointList *pODPointList = pPath->pODPointList;
ODPointList *g_pODPointList = pPath->g_pODPointList;

wxODPointListNode *node2 = pODPointList->GetFirst();
wxODPointListNode *node2 = g_pODPointList->GetFirst();
ODPoint *prp;

while( node2 ) {
Expand Down
34 changes: 17 additions & 17 deletions src/ODEventHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@

extern ocpn_draw_pi *g_ocpn_draw_pi;
extern PathManagerDialog *g_pPathManagerDialog;
extern ODSelect *pODSelect;
extern ODConfig *pODConfig;
extern ODSelect *g_pODSelect;
extern ODConfig *g_pODConfig;
extern PlugIn_ViewPort *g_pivp;
extern ChartCanvas *ocpncc1;
extern PathProp *g_pPathPropDialog;
Expand Down Expand Up @@ -139,7 +139,7 @@ void ODEventHandler::OnRolloverPopupTimerEvent( wxTimerEvent& event )
if( NULL == g_pRolloverPathSeg ) {
// Get a list of all selectable sgements, and search for the first visible segment as the rollover target.

SelectableItemList SelList = pODSelect->FindSelectionList( g_ocpn_draw_pi->m_cursor_lat, g_ocpn_draw_pi->m_cursor_lon,
SelectableItemList SelList = g_pODSelect->FindSelectionList( g_ocpn_draw_pi->m_cursor_lat, g_ocpn_draw_pi->m_cursor_lon,
SELTYPE_PATHSEGMENT );

wxSelectableItemListNode *node = SelList.GetFirst();
Expand Down Expand Up @@ -199,8 +199,8 @@ void ODEventHandler::OnRolloverPopupTimerEvent( wxTimerEvent& event )
// Compute and display cumulative distance from route start point to current
// leg end point.

if( segShow_point_a != pp->pODPointList->GetFirst()->GetData() ) {
wxODPointListNode *node = (pp->pODPointList)->GetFirst()->GetNext();
if( segShow_point_a != pp->g_pODPointList->GetFirst()->GetData() ) {
wxODPointListNode *node = (pp->g_pODPointList)->GetFirst()->GetNext();
ODPoint *pop;
float dist_to_endleg = 0;
wxString t;
Expand Down Expand Up @@ -233,7 +233,7 @@ void ODEventHandler::OnRolloverPopupTimerEvent( wxTimerEvent& event )
}
} else {
// Is the cursor still in select radius?
if( !pODSelect->IsSelectableSegmentSelected( g_ocpn_draw_pi->m_cursor_lat, g_ocpn_draw_pi->m_cursor_lon, g_pRolloverPathSeg ) )
if( !g_pODSelect->IsSelectableSegmentSelected( g_ocpn_draw_pi->m_cursor_lat, g_ocpn_draw_pi->m_cursor_lon, g_pRolloverPathSeg ) )
showRollover = false;
else
showRollover = true;
Expand Down Expand Up @@ -288,14 +288,14 @@ void ODEventHandler::PopupMenuHandler(wxCommandEvent& event )
// Insert new OCPN Point
m_pSelectedPath->InsertPointAfter( m_pFoundODPoint, m_cursor_lat, m_cursor_lon );

pODSelect->DeleteAllSelectableODPoints( m_pSelectedPath );
pODSelect->DeleteAllSelectablePathSegments( m_pSelectedPath );
g_pODSelect->DeleteAllSelectableODPoints( m_pSelectedPath );
g_pODSelect->DeleteAllSelectablePathSegments( m_pSelectedPath );

pODSelect->AddAllSelectablePathSegments( m_pSelectedPath );
pODSelect->AddAllSelectableODPoints( m_pSelectedPath );
g_pODSelect->AddAllSelectablePathSegments( m_pSelectedPath );
g_pODSelect->AddAllSelectableODPoints( m_pSelectedPath );

m_pSelectedPath->RebuildGUIDList(); // ensure the GUID list is intact and good
pODConfig->UpdatePath( m_pSelectedPath );
g_pODConfig->UpdatePath( m_pSelectedPath );

if( g_pPathPropDialog && ( g_pPathPropDialog->IsShown() ) ) {
g_pPathPropDialog->SetPathAndUpdate( m_pSelectedPath, true );
Expand Down Expand Up @@ -394,11 +394,11 @@ void ODEventHandler::PopupMenuHandler(wxCommandEvent& event )
m_pFoundODPoint->SetTypeString( wxT("OCPN Point") );
}

pODSelect->DeleteAllSelectableODPoints( m_pSelectedPath );
pODSelect->DeleteAllSelectablePathSegments( m_pSelectedPath );
g_pODSelect->DeleteAllSelectableODPoints( m_pSelectedPath );
g_pODSelect->DeleteAllSelectablePathSegments( m_pSelectedPath );

pODSelect->AddAllSelectablePathSegments( m_pSelectedPath );
pODSelect->AddAllSelectableODPoints( m_pSelectedPath );
g_pODSelect->AddAllSelectablePathSegments( m_pSelectedPath );
g_pODSelect->AddAllSelectableODPoints( m_pSelectedPath );

g_ocpn_draw_pi->m_bPathEditing = FALSE;
g_ocpn_draw_pi->m_bODPointEditing = FALSE;
Expand Down Expand Up @@ -458,8 +458,8 @@ void ODEventHandler::PopupMenuHandler(wxCommandEvent& event )
pODPointMan->DestroyODPoint( m_pFoundODPoint );
}
else {
pODConfig->DeleteODPoint( m_pFoundODPoint );
pODSelect->DeleteSelectablePoint( m_pFoundODPoint, SELTYPE_OCPNPOINT );
g_pODConfig->DeleteODPoint( m_pFoundODPoint );
g_pODSelect->DeleteSelectablePoint( m_pFoundODPoint, SELTYPE_OCPNPOINT );
if( NULL != pODPointMan )
pODPointMan->RemoveODPoint( m_pFoundODPoint );
}
Expand Down
Loading

0 comments on commit b3b3f47

Please sign in to comment.