Permalink
Browse files

Modify and Delete waypoints in the Route Properties window.

  • Loading branch information...
1 parent 03931f1 commit eec467a2efe88badcc1ab6b47e87e4c411e638f6 @JesperWe JesperWe committed Jun 19, 2012
Showing with 176 additions and 101 deletions.
  1. +3 −0 include/chcanv.h
  2. +2 −0 include/routemanagerdialog.h
  3. +5 −0 include/routeprop.h
  4. +25 −32 src/chcanv.cpp
  5. +10 −6 src/routemanagerdialog.cpp
  6. +131 −63 src/routeprop.cpp
View
@@ -275,6 +275,9 @@ class ChartCanvas: public wxWindow
bool PurgeGLCanvasChartCache(ChartBase *pc);
+ void RemovePointFromRoute( RoutePoint* point, Route* route );
+
+
private:
ViewPort VPoint;
void PositionConsole(void);
@@ -55,6 +55,8 @@ class RouteManagerDialog : public wxDialog {
void UpdateWptListCtrl(RoutePoint *rp_select = NULL, bool b_retain_sort = false);
void UpdateLayListCtrl();
void OnTabSwitch(wxNotebookEvent& event);
+ static void RouteManagerDialog::WptShowPropertiesDialog( RoutePoint* wp, wxWindow* parent );
+
private:
void Create();
View
@@ -86,6 +86,9 @@ class HyperlinkList;
#define ID_STARTTIMECTL 7011
#define ID_TIMEZONESEL 7012
#define ID_TRACKLISTCTRL 7013
+#define ID_RCLK_MENU_COPY_TEXT 7014
+#define ID_RCLK_MENU_EDIT_WP 7015
+#define ID_RCLK_MENU_DELETE 7016
#define ID_MARKPROP 8000
#define SYMBOL_MARKPROP_STYLE wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX
@@ -153,6 +156,8 @@ class RouteProp: public wxDialog
void OnRoutepropSplitClick( wxCommandEvent& event );
void OnRoutepropExtendClick( wxCommandEvent& event );
void OnRoutepropCopyTxtClick( wxCommandEvent& event );
+ void OnRoutePropRightClick( wxListEvent &event );
+ void OnRoutePropMenuSelected( wxCommandEvent &event );
bool IsThisRouteExtendable();
bool IsThisTrackExtendable();
void OnEvtColDragEnd(wxListEvent& event);
View
@@ -7903,7 +7903,7 @@ void ChartCanvas::CanvasPopupMenu( int x, int y, int seltype )
#endif
if( seltype & SELTYPE_TRACKSEGMENT ) {
- pdef_menu->Append( ID_TK_MENU_PROPERTIES, _( "Track Properties" ) );
+ pdef_menu->Append( ID_TK_MENU_PROPERTIES, _( "Track Properties..." ) );
pdef_menu->Append( ID_TK_MENU_DELETE, _( "Delete Track" ) );
pdef_menu->AppendSeparator();
@@ -7916,7 +7916,7 @@ void ChartCanvas::CanvasPopupMenu( int x, int y, int seltype )
pdef_menu->Append( ID_RT_MENU_APPEND, _( "Append Waypoint" ) );
pdef_menu->Append( ID_RT_MENU_DELETE, _( "Delete Route" ) );
pdef_menu->Append( ID_RT_MENU_REVERSE, _( "Reverse Route" ) );
- pdef_menu->Append( ID_RT_MENU_PROPERTIES, _( "Route Properties" ) );
+ pdef_menu->Append( ID_RT_MENU_PROPERTIES, _( "Route Properties..." ) );
if( m_pSelectedRoute ) {
pdef_menu->Enable( ID_RT_MENU_ACTIVATE, !m_pSelectedRoute->m_bRtIsActive );
@@ -8187,6 +8187,28 @@ void ChartCanvas::ShowObjectQueryWindow( int x, int y, float zlat, float zlon )
}
}
+void ChartCanvas::RemovePointFromRoute( RoutePoint* point, Route* route ) {
+ // Rebuild the route selectables
+ pSelect->DeleteAllSelectableRoutePoints( route );
+ pSelect->DeleteAllSelectableRouteSegments( route );
+
+ route->RemovePoint( point );
+
+ // Check for 1 point routes
+ if( route->GetnPoints() <= 1 ) {
+ pConfig->DeleteConfigRoute( route );
+ g_pRouteMan->DeleteRoute( route );
+ route = NULL;
+ }
+ // Add this point back into the selectables
+ pSelect->AddSelectableRoutePoint( point->m_lat, point->m_lon, point );
+
+ if( pRoutePropDialog && ( pRoutePropDialog->IsShown() ) ) {
+ pRoutePropDialog->SetRouteAndUpdate( route );
+ pRoutePropDialog->UpdateProperties();
+ }
+}
+
void ChartCanvas::PopupMenuHandler( wxCommandEvent& event )
{
RoutePoint *pLast;
@@ -8632,36 +8654,7 @@ void ChartCanvas::PopupMenuHandler( wxCommandEvent& event )
case ID_RT_MENU_REMPOINT:
if( m_pSelectedRoute ) {
if( m_pSelectedRoute->m_bIsInLayer ) break;
-
- // Rebuild the route selectables
- pSelect->DeleteAllSelectableRoutePoints( m_pSelectedRoute );
- pSelect->DeleteAllSelectableRouteSegments( m_pSelectedRoute );
-
- m_pSelectedRoute->RemovePoint( m_pFoundRoutePoint );
-
- // Check for 1 point routes
- if( m_pSelectedRoute->GetnPoints() > 1 ) {
- /* All this is done by Route::RemovePoint()
- pSelect->AddAllSelectableRouteSegments ( m_pSelectedRoute );
- pSelect->AddAllSelectableRoutePoints ( m_pSelectedRoute );
-
- pConfig->UpdateRoute ( m_pSelectedRoute );
- m_pSelectedRoute->RebuildGUIDList(); // ensure the GUID list is intact and good
- */
- } else {
- pConfig->DeleteConfigRoute( m_pSelectedRoute );
- g_pRouteMan->DeleteRoute( m_pSelectedRoute );
- m_pSelectedRoute = NULL;
- }
- // Add this point back into the selectables
- pSelect->AddSelectableRoutePoint( m_pFoundRoutePoint->m_lat,
- m_pFoundRoutePoint->m_lon, m_pFoundRoutePoint );
-
- if( pRoutePropDialog && ( pRoutePropDialog->IsShown() ) ) {
- pRoutePropDialog->SetRouteAndUpdate( m_pSelectedRoute );
- pRoutePropDialog->UpdateProperties();
- }
-
+ RemovePointFromRoute( m_pFoundRoutePoint, m_pSelectedRoute );
}
break;
View
@@ -1807,8 +1807,16 @@ void RouteManagerDialog::OnWptPropertiesClick( wxCommandEvent &event )
if( !wp ) return;
- if( NULL == pMarkPropDialog ) // There is one global instance of the MarkProp Dialog
- pMarkPropDialog = new MarkInfoImpl( GetParent() );
+ WptShowPropertiesDialog( wp, GetParent() );
+
+ UpdateWptListCtrl();
+ m_bNeedConfigFlush = true;
+}
+
+void RouteManagerDialog::WptShowPropertiesDialog( RoutePoint* wp, wxWindow* parent )
+{
+ // There is one global instance of the MarkProp Dialog
+ if( NULL == pMarkPropDialog ) pMarkPropDialog = new MarkInfoImpl( parent );
pMarkPropDialog->SetRoutePoint( wp );
pMarkPropDialog->UpdateProperties();
@@ -1821,10 +1829,6 @@ void RouteManagerDialog::OnWptPropertiesClick( wxCommandEvent &event )
if( !pMarkPropDialog->IsShown() ) pMarkPropDialog->ShowModal();
- // waypoint might have changed
- UpdateWptListCtrl();
-
- m_bNeedConfigFlush = true;
}
void RouteManagerDialog::OnWptZoomtoClick( wxCommandEvent &event )
Oops, something went wrong.

0 comments on commit eec467a

Please sign in to comment.