From bd6054bac955ff766abf404e3d743fa92e48a39c Mon Sep 17 00:00:00 2001 From: jeka Date: Sat, 21 Feb 2026 23:00:02 +0300 Subject: [PATCH] =?UTF-8?q?=D1=84=D0=B8=D0=BA=D1=81=20=D0=B3=D1=80=D0=B0?= =?UTF-8?q?=D1=84=D0=B8=D0=BA=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tools/etcpmon/etcpmon_graph.c | 13 +++++++++++-- tools/etcpmon/etcpmon_gui.c | 12 +++++++----- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/tools/etcpmon/etcpmon_graph.c b/tools/etcpmon/etcpmon_graph.c index ec06a0cd..18d911e1 100644 --- a/tools/etcpmon/etcpmon_graph.c +++ b/tools/etcpmon/etcpmon_graph.c @@ -81,10 +81,10 @@ void DrawGraph(HDC hdc, RECT* rc, struct etcpmon_app* app) int sc = 0; GetSelectedChannels(app, sel, &sc); int pad = 5; - int gl = pad + 45; /* левая граница графика */ + int gl = pad + 5; /* левая граница графика */ int gr = w - pad; /* правая граница */ int gt = pad; /* верх */ - int gb = h - 25; /* низ */ + int gb = h - 5; /* низ */ int gh = gb - gt; /* === Сетка === */ HPEN grid = CreatePen(PS_DOT, 1, GetSysColor(COLOR_BTNSHADOW)); @@ -141,6 +141,12 @@ void DrawGraph(HDC hdc, RECT* rc, struct etcpmon_app* app) LineTo(memDC, app->graph_cursor_x, gb); SelectObject(memDC, old); DeleteObject(cp); + + int cursor_rel_x = app->graph_cursor_x - startx; + if (cursor_rel_x >= 0 && cursor_rel_x < vis) { + int cursor_idx = (oldest + cursor_rel_x) % GRAPH_HISTORY_SIZE; + UpdateChannelValues(app, cursor_idx); + } } end: /* Копируем на экран */ @@ -225,6 +231,9 @@ LRESULT CALLBACK GraphWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa InvalidateRect(hWnd, NULL, FALSE); last_invalidate = now; } + + TRACKMOUSEEVENT tme = { sizeof(tme), TME_LEAVE, hWnd, 0 }; + TrackMouseEvent(&tme); } else { app->graph_cursor_active = 0; InvalidateRect(hWnd, NULL, FALSE); diff --git a/tools/etcpmon/etcpmon_gui.c b/tools/etcpmon/etcpmon_gui.c index ad06cae3..c09a6862 100644 --- a/tools/etcpmon/etcpmon_gui.c +++ b/tools/etcpmon/etcpmon_gui.c @@ -520,7 +520,7 @@ void etcpmon_gui_update_graph(struct etcpmon_app* app, struct etcpmon_rsp_metric InvalidateRect(app->hGraphWnd, NULL, FALSE); } - if (app->client) { + if (!app->graph_cursor_active && app->client) { struct metrics_history* h = etcpmon_client_get_history(app->client); if (h && h->count > 0) { int last_idx = (h->head - 1 + GRAPH_HISTORY_SIZE) % GRAPH_HISTORY_SIZE; @@ -551,10 +551,12 @@ static void on_metrics(struct etcpmon_rsp_metrics* metrics, if (app) { etcpmon_gui_update_metrics(app, metrics, links, links_count); etcpmon_client_add_to_history(app->client, metrics); - struct metrics_history* h = etcpmon_client_get_history(app->client); - if (h && h->count > 0) { - int last_idx = (h->head - 1 + GRAPH_HISTORY_SIZE) % GRAPH_HISTORY_SIZE; - UpdateChannelValues(app, last_idx); + if (!app->graph_cursor_active) { + struct metrics_history* h = etcpmon_client_get_history(app->client); + if (h && h->count > 0) { + int last_idx = (h->head - 1 + GRAPH_HISTORY_SIZE) % GRAPH_HISTORY_SIZE; + UpdateChannelValues(app, last_idx); + } } } }