diff --git a/PowerEditor/src/ScintillaComponent/columnEditor.cpp b/PowerEditor/src/ScintillaComponent/columnEditor.cpp index 48088fe39..56a6f53b2 100644 --- a/PowerEditor/src/ScintillaComponent/columnEditor.cpp +++ b/PowerEditor/src/ScintillaComponent/columnEditor.cpp @@ -42,9 +42,10 @@ void ColumnEditorDlg::display(bool toShow) const intptr_t CALLBACK ColumnEditorDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam) { - static HBRUSH hRedBrush = NULL; + static HBRUSH hRedBrush = nullptr; static int whichFlashRed = 0; - static COLORREF rgbRed = RGB(255, 0, 0); + constexpr COLORREF rgbRed = RGB(255, 0, 0); + static HWND hCurrentBalloonTip = nullptr; switch (message) { @@ -166,9 +167,19 @@ intptr_t CALLBACK ColumnEditorDlg::run_dlgProc(UINT message, WPARAM wParam, LPAR { switch (LOWORD(wParam)) { - case IDCANCEL: // Close - display(false); + case IDCANCEL: // in case of ESC keystroke + { + if (hCurrentBalloonTip && IsWindowVisible(hCurrentBalloonTip)) // if current baloon tip shown, just hide it + { + ShowWindow(hCurrentBalloonTip, SW_HIDE); + } + else // if current baloon tip doesn't show, we hide Column Editor dialog + { + display(false); + } + return TRUE; + } case IDOK: { @@ -529,12 +540,38 @@ intptr_t CALLBACK ColumnEditorDlg::run_dlgProc(UINT message, WPARAM wParam, LPAR case WM_TIMER: { - if(wParam == IDT_COL_FLASH_TIMER) + static int idRedraw = 0; + + if (wParam == IDT_COL_FLASH_TIMER) { KillTimer(_hSelf, IDT_COL_FLASH_TIMER); - int idRedraw = whichFlashRed; // keep the ID for the one whose flash is ending... + + idRedraw = whichFlashRed; // keep the ID for the one whose flash is ending... whichFlashRed = 0; // must be 0 before the redraw, otherwise it will maintain color redrawDlgItem(idRedraw, true); // redraw the just the one that was flashed + + // Remember the latest/current baloon tip handle + hCurrentBalloonTip = [](HWND hEditControl) -> HWND { + HWND hTooltip = FindWindowEx(NULL, NULL, L"tooltips_class32", NULL); + + while (hTooltip) + { + HWND hParent = GetParent(hTooltip); + if (hParent == hEditControl || hParent == GetParent(hEditControl)) + { + return hTooltip; + } + hTooltip = FindWindowEx(NULL, hTooltip, L"tooltips_class32", NULL); + } + return NULL; + }(GetDlgItem(_hSelf, idRedraw)); + } + + if (wParam == IDC_COL_BALLONTIP_TIMER) + { + KillTimer(_hSelf, IDC_COL_BALLONTIP_TIMER); + + SendMessage(GetDlgItem(_hSelf, idRedraw), EM_HIDEBALLOONTIP, 0, 0); } break; @@ -766,6 +803,8 @@ int ColumnEditorDlg::sendValidationErrorMessage(int whichFlashRed, int formatCho SendMessage(GetDlgItem(_hSelf, whichFlashRed), EM_SHOWBALLOONTIP, 0, (LPARAM)&ebt); SetTimer(_hSelf, IDT_COL_FLASH_TIMER, 250, NULL); + SetTimer(_hSelf, IDC_COL_BALLONTIP_TIMER, 3500, NULL); + redrawDlgItem(whichFlashRed); return whichFlashRed; diff --git a/PowerEditor/src/ScintillaComponent/columnEditor.rc b/PowerEditor/src/ScintillaComponent/columnEditor.rc index 03b7793b7..bbda341e7 100644 --- a/PowerEditor/src/ScintillaComponent/columnEditor.rc +++ b/PowerEditor/src/ScintillaComponent/columnEditor.rc @@ -25,28 +25,28 @@ EXSTYLE WS_EX_DLGMODALFRAME | WS_EX_WINDOWEDGE CAPTION "Column / Multi-Selection Editor" FONT 8, L"MS Shell Dlg", 0, 0, 0x0 BEGIN - CONTROL "&Text to Insert",IDC_COL_TEXT_RADIO,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP | WS_GROUP,13,6,124,10 - CONTROL "&Number to Insert",IDC_COL_NUM_RADIO,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP | WS_GROUP,13,68,204,10 + CONTROL "&Text to Insert",IDC_COL_TEXT_RADIO,"Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,13,6,124,10 + CONTROL "&Number to Insert",IDC_COL_NUM_RADIO,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,13,68,204,10 GROUPBOX "",IDC_COL_TEXT_GRP_STATIC,8,14,124,46 EDITTEXT IDC_COL_TEXT_EDIT,20,32,97,12,ES_AUTOHSCROLL - GROUPBOX "",IDC_COL_NUM_GRP_STATIC,8,77,204,130 - RTEXT "&Initial number:",IDC_COL_INITNUM_STATIC,10,89,76,8 - EDITTEXT IDC_COL_INITNUM_EDIT,90,87,38,12,ES_LEFT - RTEXT "Increase b&y:",IDC_COL_INCRNUM_STATIC,10,106,75,8 - EDITTEXT IDC_COL_INCREASENUM_EDIT,90,104,38,12,ES_LEFT - RTEXT "&Repeat:",IDC_COL_REPEATNUM_STATIC,10,123,75,8 - EDITTEXT IDC_COL_REPEATNUM_EDIT,90,121,38,12,ES_LEFT - RTEXT "&Leading:",IDC_COL_LEADING_STATIC,10,140,75,8 - COMBOBOX IDC_COL_LEADING_COMBO,90,138,100,30,CBS_DROPDOWNLIST | WS_TABSTOP + GROUPBOX "Format",IDC_COL_FORMAT_GRP_STATIC,16,86,188,44,BS_CENTER + CONTROL "&Dec",IDC_COL_DEC_RADIO,"Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,27,99,50,10 + CONTROL "&Hex",IDC_COL_HEX_RADIO,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,110,99,50,10 + CONTROL "&Oct",IDC_COL_OCT_RADIO,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,27,114,50,10 + CONTROL "&Bin",IDC_COL_BIN_RADIO,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,110,114,50,10 + COMBOBOX IDC_COL_HEXUC_COMBO,150,97,40,10,CBS_DROPDOWNLIST | WS_TABSTOP - GROUPBOX "Format",IDC_COL_FORMAT_GRP_STATIC,16,155,188,44,BS_CENTER - CONTROL "&Dec",IDC_COL_DEC_RADIO,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,27,168,50,10 - CONTROL "&Hex",IDC_COL_HEX_RADIO,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,110,168,50,10 - CONTROL "&Oct",IDC_COL_OCT_RADIO,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,27,183,50,10 - CONTROL "&Bin",IDC_COL_BIN_RADIO,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,110,183,50,10 - COMBOBOX IDC_COL_HEXUC_COMBO,150,166,40,10,CBS_DROPDOWNLIST | WS_TABSTOP + GROUPBOX "",IDC_COL_NUM_GRP_STATIC,8,77,204,130 + RTEXT "&Initial number:",IDC_COL_INITNUM_STATIC,10,140,76,8 + EDITTEXT IDC_COL_INITNUM_EDIT,90,138,38,12 + RTEXT "Increase b&y:",IDC_COL_INCRNUM_STATIC,10,157,75,8 + EDITTEXT IDC_COL_INCREASENUM_EDIT,90,155,38,12 + RTEXT "&Repeat:",IDC_COL_REPEATNUM_STATIC,10,174,75,8 + EDITTEXT IDC_COL_REPEATNUM_EDIT,90,172,38,12 + RTEXT "&Leading:",IDC_COL_LEADING_STATIC,10,191,75,8 + COMBOBOX IDC_COL_LEADING_COMBO,90,189,100,30,CBS_DROPDOWNLIST | WS_TABSTOP DEFPUSHBUTTON "OK",IDOK,142,18,70,14 PUSHBUTTON "Cancel",IDCANCEL,142,36,70,14 diff --git a/PowerEditor/src/ScintillaComponent/columnEditor_rc.h b/PowerEditor/src/ScintillaComponent/columnEditor_rc.h index 1f70265b8..516358536 100644 --- a/PowerEditor/src/ScintillaComponent/columnEditor_rc.h +++ b/PowerEditor/src/ScintillaComponent/columnEditor_rc.h @@ -37,6 +37,7 @@ #define IDC_COL_REPEATNUM_EDIT (IDD_COLUMNEDIT + 17) #define IDC_COL_LEADING_STATIC (IDD_COLUMNEDIT + 18) #define IDC_COL_LEADING_COMBO (IDD_COLUMNEDIT + 19) - #define IDT_COL_FLASH_TIMER (IDD_COLUMNEDIT + 20) - #define IDC_COL_HEXUC_COMBO (IDD_COLUMNEDIT + 21) + #define IDC_COL_HEXUC_COMBO (IDD_COLUMNEDIT + 20) + #define IDT_COL_FLASH_TIMER (IDD_COLUMNEDIT + 21) + #define IDC_COL_BALLONTIP_TIMER (IDD_COLUMNEDIT + 22) #endif// COLUMNEDITOR_RC_H