From e27759aa56732ec1423a104333c1d88f5ddd7efb Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 17 May 2024 17:00:51 +0200 Subject: Adding upstream version 4.2.5. Signed-off-by: Daniel Baumann --- ui/win32/file_dlg_win32.cpp | 152 ++++++++++++++++++++++++++++++++++---------- ui/win32/file_dlg_win32.h | 31 +++++---- 2 files changed, 137 insertions(+), 46 deletions(-) (limited to 'ui/win32') diff --git a/ui/win32/file_dlg_win32.cpp b/ui/win32/file_dlg_win32.cpp index a301912e..6261c915 100644 --- a/ui/win32/file_dlg_win32.cpp +++ b/ui/win32/file_dlg_win32.cpp @@ -1383,7 +1383,8 @@ range_update_dynamics(HWND dlg_hwnd, packet_range_t *range) { bool filtered_active = false; TCHAR static_val[STATIC_LABEL_CHARS]; uint32_t ignored_cnt = 0, displayed_ignored_cnt = 0; - uint32_t displayed_cnt; + uint32_t depended_cnt = 0, displayed_depended_cnt = 0; + uint32_t label_cnt; bool range_valid = true; cur_ctrl = GetDlgItem(dlg_hwnd, EWFD_DISPLAYED_BTN); @@ -1393,43 +1394,50 @@ range_update_dynamics(HWND dlg_hwnd, packet_range_t *range) { /* RANGE_SELECT_ALL */ cur_ctrl = GetDlgItem(dlg_hwnd, EWFD_ALL_PKTS_CAP); EnableWindow(cur_ctrl, !filtered_active); + label_cnt = g_cf->count; if (range->remove_ignored) { - StringCchPrintf(static_val, STATIC_LABEL_CHARS, _T("%u"), g_cf->count - range->ignored_cnt); - } else { - StringCchPrintf(static_val, STATIC_LABEL_CHARS, _T("%u"), g_cf->count); + label_cnt -= range->ignored_cnt; } + StringCchPrintf(static_val, STATIC_LABEL_CHARS, _T("%u"), label_cnt); SetWindowText(cur_ctrl, static_val); cur_ctrl = GetDlgItem(dlg_hwnd, EWFD_ALL_PKTS_DISP); EnableWindow(cur_ctrl, filtered_active); if (range->include_dependents) - displayed_cnt = range->displayed_plus_dependents_cnt; + label_cnt = range->displayed_plus_dependents_cnt; else - displayed_cnt = range->displayed_cnt; + label_cnt = range->displayed_cnt; if (range->remove_ignored) { - StringCchPrintf(static_val, STATIC_LABEL_CHARS, _T("%u"), displayed_cnt - range->displayed_ignored_cnt); - } else { - StringCchPrintf(static_val, STATIC_LABEL_CHARS, _T("%u"), displayed_cnt); + label_cnt -= range->displayed_ignored_cnt; } + StringCchPrintf(static_val, STATIC_LABEL_CHARS, _T("%u"), label_cnt); SetWindowText(cur_ctrl, static_val); /* RANGE_SELECT_CURR */ cur_ctrl = GetDlgItem(dlg_hwnd, EWFD_SEL_PKT_CAP); EnableWindow(cur_ctrl, range->selection_range_cnt > 0 && !filtered_active); - if (range->remove_ignored) { - StringCchPrintf(static_val, STATIC_LABEL_CHARS, _T("%d"), range->selection_range_cnt - range->ignored_selection_range_cnt); + if (range->include_dependents) { + label_cnt = range->selected_plus_depends_cnt; } else { - StringCchPrintf(static_val, STATIC_LABEL_CHARS, _T("%d"), range->selection_range_cnt); + label_cnt = range->selection_range_cnt; } + if (range->remove_ignored) { + label_cnt -= range->ignored_selection_range_cnt; + } + StringCchPrintf(static_val, STATIC_LABEL_CHARS, _T("%d"), label_cnt); SetWindowText(cur_ctrl, static_val); cur_ctrl = GetDlgItem(dlg_hwnd, EWFD_SEL_PKT_DISP); EnableWindow(cur_ctrl, range->displayed_selection_range_cnt > 0 && filtered_active); - if (range->remove_ignored) { - StringCchPrintf(static_val, STATIC_LABEL_CHARS, _T("%d"), range->displayed_selection_range_cnt - range->displayed_ignored_selection_range_cnt); + if (range->include_dependents) { + label_cnt = range->displayed_selected_plus_depends_cnt; } else { - StringCchPrintf(static_val, STATIC_LABEL_CHARS, _T("%d"), range->displayed_selection_range_cnt); + label_cnt = range->displayed_selection_range_cnt; + } + if (range->remove_ignored) { + label_cnt -= range->displayed_ignored_selection_range_cnt; } + StringCchPrintf(static_val, STATIC_LABEL_CHARS, _T("%d"), label_cnt); SetWindowText(cur_ctrl, static_val); /* RANGE_SELECT_MARKED */ @@ -1438,20 +1446,28 @@ range_update_dynamics(HWND dlg_hwnd, packet_range_t *range) { cur_ctrl = GetDlgItem(dlg_hwnd, EWFD_MARKED_CAP); EnableWindow(cur_ctrl, g_cf->marked_count && !filtered_active); - if (range->remove_ignored) { - StringCchPrintf(static_val, STATIC_LABEL_CHARS, _T("%u"), g_cf->marked_count - range->ignored_marked_cnt); + if (range->include_dependents) { + label_cnt = range->marked_plus_depends_cnt; } else { - StringCchPrintf(static_val, STATIC_LABEL_CHARS, _T("%u"), g_cf->marked_count); + label_cnt = g_cf->marked_count; + } + if (range->remove_ignored) { + label_cnt -= range->ignored_marked_cnt; } + StringCchPrintf(static_val, STATIC_LABEL_CHARS, _T("%d"), label_cnt); SetWindowText(cur_ctrl, static_val); cur_ctrl = GetDlgItem(dlg_hwnd, EWFD_MARKED_DISP); EnableWindow(cur_ctrl, g_cf->marked_count && filtered_active); - if (range->remove_ignored) { - StringCchPrintf(static_val, STATIC_LABEL_CHARS, _T("%u"), range->displayed_marked_cnt - range->displayed_ignored_marked_cnt); + if (range->include_dependents) { + label_cnt = range->displayed_marked_plus_depends_cnt; } else { - StringCchPrintf(static_val, STATIC_LABEL_CHARS, _T("%u"), range->displayed_marked_cnt); + label_cnt = range->displayed_marked_cnt; + } + if (range->remove_ignored) { + label_cnt -= range->displayed_ignored_marked_cnt; } + StringCchPrintf(static_val, STATIC_LABEL_CHARS, _T("%d"), label_cnt); SetWindowText(cur_ctrl, static_val); /* RANGE_SELECT_MARKED_RANGE */ @@ -1460,20 +1476,28 @@ range_update_dynamics(HWND dlg_hwnd, packet_range_t *range) { cur_ctrl = GetDlgItem(dlg_hwnd, EWFD_FIRST_LAST_CAP); EnableWindow(cur_ctrl, range->mark_range_cnt && !filtered_active); - if (range->remove_ignored) { - StringCchPrintf(static_val, STATIC_LABEL_CHARS, _T("%u"), range->mark_range_cnt - range->ignored_mark_range_cnt); + if (range->include_dependents) { + label_cnt = range->mark_range_plus_depends_cnt; } else { - StringCchPrintf(static_val, STATIC_LABEL_CHARS, _T("%u"), range->mark_range_cnt); + label_cnt = range->mark_range_cnt; + } + if (range->remove_ignored) { + label_cnt -= range->ignored_mark_range_cnt; } + StringCchPrintf(static_val, STATIC_LABEL_CHARS, _T("%d"), label_cnt); SetWindowText(cur_ctrl, static_val); cur_ctrl = GetDlgItem(dlg_hwnd, EWFD_FIRST_LAST_DISP); EnableWindow(cur_ctrl, range->displayed_mark_range_cnt && filtered_active); - if (range->remove_ignored) { - StringCchPrintf(static_val, STATIC_LABEL_CHARS, _T("%u"), range->displayed_mark_range_cnt - range->displayed_ignored_mark_range_cnt); + if (range->include_dependents) { + label_cnt = range->displayed_mark_range_plus_depends_cnt; } else { - StringCchPrintf(static_val, STATIC_LABEL_CHARS, _T("%u"), range->displayed_mark_range_cnt); + label_cnt = range->displayed_mark_range_cnt; } + if (range->remove_ignored) { + label_cnt -= range->displayed_ignored_mark_range_cnt; + } + StringCchPrintf(static_val, STATIC_LABEL_CHARS, _T("%d"), label_cnt); SetWindowText(cur_ctrl, static_val); /* RANGE_SELECT_USER */ @@ -1484,20 +1508,29 @@ range_update_dynamics(HWND dlg_hwnd, packet_range_t *range) { cur_ctrl = GetDlgItem(dlg_hwnd, EWFD_RANGE_CAP); EnableWindow(cur_ctrl, !filtered_active); - if (range->remove_ignored) { - StringCchPrintf(static_val, STATIC_LABEL_CHARS, _T("%u"), range->user_range_cnt - range->ignored_user_range_cnt); + if (range->include_dependents) { + label_cnt = range->user_range_plus_depends_cnt; } else { - StringCchPrintf(static_val, STATIC_LABEL_CHARS, _T("%u"), range->user_range_cnt); + label_cnt = range->user_range_cnt; } + if (range->remove_ignored) { + label_cnt -= range->ignored_user_range_cnt; + } + StringCchPrintf(static_val, STATIC_LABEL_CHARS, _T("%d"), label_cnt); SetWindowText(cur_ctrl, static_val); cur_ctrl = GetDlgItem(dlg_hwnd, EWFD_RANGE_DISP); EnableWindow(cur_ctrl, filtered_active); + if (range->include_dependents) { + label_cnt = range->displayed_user_range_plus_depends_cnt; + } else { + label_cnt = range->displayed_user_range_cnt; + } if (range->remove_ignored) { - StringCchPrintf(static_val, STATIC_LABEL_CHARS, _T("%u"), range->displayed_user_range_cnt - range->displayed_ignored_user_range_cnt); + label_cnt -= range->displayed_ignored_user_range_cnt; } else { - StringCchPrintf(static_val, STATIC_LABEL_CHARS, _T("%u"), range->displayed_user_range_cnt); } + StringCchPrintf(static_val, STATIC_LABEL_CHARS, _T("%u"), label_cnt); SetWindowText(cur_ctrl, static_val); break; case CVT_SYNTAX_ERROR: @@ -1562,6 +1595,49 @@ range_update_dynamics(HWND dlg_hwnd, packet_range_t *range) { StringCchPrintf(static_val, STATIC_LABEL_CHARS, _T("%u"), displayed_ignored_cnt); SetWindowText(cur_ctrl, static_val); + /* RANGE_REMOVE_IGNORED_PACKETS */ + switch(range->process) { + case(range_process_all): + depended_cnt = 0; + displayed_depended_cnt = range->displayed_plus_dependents_cnt - range->displayed_cnt; + break; + case(range_process_selected): + depended_cnt = range->selected_plus_depends_cnt - range->selection_range_cnt; + displayed_depended_cnt = range->displayed_selected_plus_depends_cnt - range->displayed_selection_range_cnt; + break; + case(range_process_marked): + depended_cnt = range->marked_plus_depends_cnt - range->cf->marked_count; + displayed_depended_cnt = range->displayed_marked_plus_depends_cnt - range->displayed_marked_cnt; + break; + case(range_process_marked_range): + depended_cnt = range->mark_range_plus_depends_cnt - range->mark_range_cnt; + displayed_depended_cnt = range->displayed_mark_range_plus_depends_cnt - range->displayed_mark_range_cnt; + break; + case(range_process_user_range): + depended_cnt = range->user_range_plus_depends_cnt - range->user_range_cnt; + displayed_depended_cnt = range->displayed_user_range_plus_depends_cnt - range->displayed_user_range_cnt; + break; + default: + ws_assert_not_reached(); + } + + cur_ctrl = GetDlgItem(dlg_hwnd, EWFD_INCLUDE_DPD_CB); + if (filtered_active) { + EnableWindow(cur_ctrl, displayed_depended_cnt); + } else { + EnableWindow(cur_ctrl, depended_cnt); + } + + cur_ctrl = GetDlgItem(dlg_hwnd, EWFD_DEPENDED_CAP); + EnableWindow(cur_ctrl, depended_cnt && !filtered_active); + StringCchPrintf(static_val, STATIC_LABEL_CHARS, _T("%u"), depended_cnt); + SetWindowText(cur_ctrl, static_val); + + cur_ctrl = GetDlgItem(dlg_hwnd, EWFD_DEPENDED_DISP); + EnableWindow(cur_ctrl, displayed_depended_cnt && filtered_active); + StringCchPrintf(static_val, STATIC_LABEL_CHARS, _T("%u"), displayed_depended_cnt); + SetWindowText(cur_ctrl, static_val); + cur_ctrl = GetDlgItem(GetParent(dlg_hwnd), IDOK); EnableWindow(cur_ctrl, range_valid); } @@ -1610,6 +1686,10 @@ range_handle_wm_initdialog(HWND dlg_hwnd, packet_range_t *range) { ws_assert_not_reached(); } SendMessage(cur_ctrl, BM_SETCHECK, true, 0); + + /* Set the include depended upon checkbox */ + cur_ctrl = GetDlgItem(dlg_hwnd, EWFD_INCLUDE_DPD_CB); + SendMessage(cur_ctrl, BM_SETCHECK, range->include_dependents, 0); } static void @@ -1678,6 +1758,14 @@ range_handle_wm_command(HWND dlg_hwnd, HWND ctrl, WPARAM w_param, packet_range_t } range_update_dynamics(dlg_hwnd, range); break; + case (BN_CLICKED << 16) | EWFD_INCLUDE_DPD_CB: + if (SendMessage(ctrl, BM_GETCHECK, 0, 0) == BST_CHECKED) { + range->include_dependents = true; + } else { + range->include_dependents = false; + } + range_update_dynamics(dlg_hwnd, range); + break; } } diff --git a/ui/win32/file_dlg_win32.h b/ui/win32/file_dlg_win32.h index 0edee0bb..2bb2fb4d 100644 --- a/ui/win32/file_dlg_win32.h +++ b/ui/win32/file_dlg_win32.h @@ -142,20 +142,23 @@ void win32_export_file (HWND h_wnd, const wchar_t *title, capture_file *cf, expo #define EWFD_RANGE_BTN 1006 #define EWFD_RANGE_EDIT 1007 #define EWFD_REMOVE_IGN_CB 1008 - -#define EWFD_ALL_PKTS_CAP 1009 -#define EWFD_SEL_PKT_CAP 1010 -#define EWFD_MARKED_CAP 1011 -#define EWFD_FIRST_LAST_CAP 1012 -#define EWFD_RANGE_CAP 1013 -#define EWFD_IGNORED_CAP 1014 - -#define EWFD_ALL_PKTS_DISP 1015 -#define EWFD_SEL_PKT_DISP 1016 -#define EWFD_MARKED_DISP 1017 -#define EWFD_FIRST_LAST_DISP 1018 -#define EWFD_RANGE_DISP 1019 -#define EWFD_IGNORED_DISP 1020 +#define EWFD_INCLUDE_DPD_CB 1009 + +#define EWFD_ALL_PKTS_CAP 1010 +#define EWFD_SEL_PKT_CAP 1011 +#define EWFD_MARKED_CAP 1012 +#define EWFD_FIRST_LAST_CAP 1013 +#define EWFD_RANGE_CAP 1014 +#define EWFD_IGNORED_CAP 1015 +#define EWFD_DEPENDED_CAP 1016 + +#define EWFD_ALL_PKTS_DISP 1017 +#define EWFD_SEL_PKT_DISP 1018 +#define EWFD_MARKED_DISP 1019 +#define EWFD_FIRST_LAST_DISP 1020 +#define EWFD_RANGE_DISP 1021 +#define EWFD_IGNORED_DISP 1022 +#define EWFD_DEPENDED_DISP 1023 /* Merge dialog defines. Overlays Open dialog defines above. */ #define EWFD_MERGE_PREPEND_BTN 1050 -- cgit v1.2.3