Skip to content

Commit 780c4c5

Browse files
committed
Correct ContextMask API logic for double-click on object.
1 parent 0c9cb62 commit 780c4c5

1 file changed

Lines changed: 67 additions & 65 deletions

File tree

gui/src/chcanv.cpp

Lines changed: 67 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -8327,87 +8327,89 @@ bool ChartCanvas::MouseEventProcessObjects(wxMouseEvent &event) {
83278327
std::unique_ptr<HostApi> host_api = GetHostApi();
83288328
auto *api_121 = dynamic_cast<HostApi121 *>(host_api.get());
83298329

8330-
if (!(api_121->GetContextMenuMask() &
8331-
api_121->kContextMenuDisableWaypoint)) {
8332-
if (m_pRoutePointEditTarget) {
8333-
if (b_onRPtarget) {
8334-
ShowMarkPropertiesDialog(m_pRoutePointEditTarget);
8330+
if (m_pRoutePointEditTarget) {
8331+
if (b_onRPtarget) {
8332+
if ((api_121->GetContextMenuMask() &
8333+
api_121->kContextMenuDisableWaypoint))
83358334
return true;
8336-
} else {
8337-
m_pRoutePointEditTarget->m_bRPIsBeingEdited = false;
8338-
m_pRoutePointEditTarget->m_bPtIsSelected = false;
8339-
if (g_btouch)
8340-
RoutePointGui(*m_pRoutePointEditTarget).EnableDragHandle(false);
8341-
wxRect wp_rect;
8342-
RoutePointGui(*m_pRoutePointEditTarget)
8343-
.CalculateDCRect(m_dc_route, this, &wp_rect);
8344-
m_pRoutePointEditTarget = NULL; // cancel selection
8345-
RefreshRect(wp_rect, true);
8346-
return true;
8347-
}
8335+
ShowMarkPropertiesDialog(m_pRoutePointEditTarget);
8336+
return true;
83488337
} else {
8349-
auto node = rpSelList.begin();
8350-
if (node != rpSelList.end()) {
8351-
SelectItem *pFind = *node;
8352-
RoutePoint *frp = (RoutePoint *)pFind->m_pData1;
8353-
if (frp) {
8354-
wxArrayPtrVoid *proute_array =
8355-
g_pRouteMan->GetRouteArrayContaining(frp);
8356-
8357-
// Use route array (if any) to determine actual visibility for this
8358-
// point
8359-
bool brp_viz = false;
8360-
if (proute_array) {
8361-
for (unsigned int ir = 0; ir < proute_array->GetCount(); ir++) {
8362-
Route *pr = (Route *)proute_array->Item(ir);
8363-
if (pr->IsVisible()) {
8364-
brp_viz = true;
8365-
break;
8366-
}
8338+
m_pRoutePointEditTarget->m_bRPIsBeingEdited = false;
8339+
m_pRoutePointEditTarget->m_bPtIsSelected = false;
8340+
if (g_btouch)
8341+
RoutePointGui(*m_pRoutePointEditTarget).EnableDragHandle(false);
8342+
wxRect wp_rect;
8343+
RoutePointGui(*m_pRoutePointEditTarget)
8344+
.CalculateDCRect(m_dc_route, this, &wp_rect);
8345+
m_pRoutePointEditTarget = NULL; // cancel selection
8346+
RefreshRect(wp_rect, true);
8347+
return true;
8348+
}
8349+
} else {
8350+
auto node = rpSelList.begin();
8351+
if (node != rpSelList.end()) {
8352+
SelectItem *pFind = *node;
8353+
RoutePoint *frp = (RoutePoint *)pFind->m_pData1;
8354+
if (frp) {
8355+
wxArrayPtrVoid *proute_array =
8356+
g_pRouteMan->GetRouteArrayContaining(frp);
8357+
8358+
// Use route array (if any) to determine actual visibility for this
8359+
// point
8360+
bool brp_viz = false;
8361+
if (proute_array) {
8362+
for (unsigned int ir = 0; ir < proute_array->GetCount(); ir++) {
8363+
Route *pr = (Route *)proute_array->Item(ir);
8364+
if (pr->IsVisible()) {
8365+
brp_viz = true;
8366+
break;
83678367
}
8368-
delete proute_array;
8369-
if (!brp_viz &&
8370-
frp->IsShared()) // is not visible as part of route, but
8371-
// still exists as a waypoint
8372-
brp_viz = frp->IsVisible(); // so treat as isolated point
8373-
} else
8374-
brp_viz = frp->IsVisible(); // isolated point
8368+
}
8369+
delete proute_array;
8370+
if (!brp_viz &&
8371+
frp->IsShared()) // is not visible as part of route, but
8372+
// still exists as a waypoint
8373+
brp_viz = frp->IsVisible(); // so treat as isolated point
8374+
} else
8375+
brp_viz = frp->IsVisible(); // isolated point
83758376

8376-
if (brp_viz) {
8377-
ShowMarkPropertiesDialog(frp);
8377+
if (brp_viz) {
8378+
if ((api_121->GetContextMenuMask() &
8379+
api_121->kContextMenuDisableWaypoint))
83788380
return true;
8379-
}
8381+
8382+
ShowMarkPropertiesDialog(frp);
8383+
return true;
83808384
}
83818385
}
83828386
}
83838387
}
8384-
SelectItem *cursorItem;
83858388

8386-
if (!(api_121->GetContextMenuMask() & api_121->kContextMenuDisableRoute)) {
8387-
cursorItem =
8388-
pSelect->FindSelection(ctx, zlat, zlon, SELTYPE_ROUTESEGMENT);
8389+
SelectItem *cursorItem;
83898390

8390-
if (cursorItem) {
8391-
Route *pr = (Route *)cursorItem->m_pData3;
8392-
if (pr->IsVisible()) {
8393-
ShowRoutePropertiesDialog(_("Route Properties"), pr);
8394-
return true;
8395-
}
8391+
cursorItem = pSelect->FindSelection(ctx, zlat, zlon, SELTYPE_ROUTESEGMENT);
8392+
if (cursorItem) {
8393+
if ((api_121->GetContextMenuMask() & api_121->kContextMenuDisableRoute))
8394+
return true;
8395+
Route *pr = (Route *)cursorItem->m_pData3;
8396+
if (pr->IsVisible()) {
8397+
ShowRoutePropertiesDialog(_("Route Properties"), pr);
8398+
return true;
83968399
}
83978400
}
83988401

8399-
if (!(api_121->GetContextMenuMask() & api_121->kContextMenuDisableTrack)) {
8400-
cursorItem =
8401-
pSelect->FindSelection(ctx, zlat, zlon, SELTYPE_TRACKSEGMENT);
8402-
8403-
if (cursorItem) {
8404-
Track *pt = (Track *)cursorItem->m_pData3;
8405-
if (pt->IsVisible()) {
8406-
ShowTrackPropertiesDialog(pt);
8407-
return true;
8408-
}
8402+
cursorItem = pSelect->FindSelection(ctx, zlat, zlon, SELTYPE_TRACKSEGMENT);
8403+
if (cursorItem) {
8404+
if ((api_121->GetContextMenuMask() & api_121->kContextMenuDisableTrack))
8405+
return true;
8406+
Track *pt = (Track *)cursorItem->m_pData3;
8407+
if (pt->IsVisible()) {
8408+
ShowTrackPropertiesDialog(pt);
8409+
return true;
84098410
}
84108411
}
8412+
84118413
// Tide and current points
84128414
SelectItem *pFindCurrent = NULL;
84138415
SelectItem *pFindTide = NULL;

0 commit comments

Comments
 (0)