mirror of
https://github.com/notepad-plus-plus/notepad-plus-plus.git
synced 2025-07-31 01:34:58 +02:00
GUI Enhancement: Column Editor
- fix override warnings - replace SendMessage check with isCheckedOrNot - make translation consistent Fix #13667, close #13668
This commit is contained in:
parent
8250a81d6e
commit
41af936855
@ -1282,15 +1282,15 @@ You can define several column markers by using white space to separate the diffe
|
|||||||
<ColumnEditor title="Column Editor">
|
<ColumnEditor title="Column Editor">
|
||||||
<Item id="2023" name="&Text to Insert"/>
|
<Item id="2023" name="&Text to Insert"/>
|
||||||
<Item id="2033" name="&Number to Insert"/>
|
<Item id="2033" name="&Number to Insert"/>
|
||||||
<Item id="2030" name="&Initial number :"/>
|
<Item id="2030" name="&Initial number:"/>
|
||||||
<Item id="2031" name="Increase b&y :"/>
|
<Item id="2031" name="Increase b&y:"/>
|
||||||
<Item id="2038" name="&Leading :"/>
|
<Item id="2038" name="&Leading:"/>
|
||||||
<ComboBox id="2039">
|
<ComboBox id="2039">
|
||||||
<Element name="None"/>
|
<Element name="None"/>
|
||||||
<Element name="Zeros"/>
|
<Element name="Zeros"/>
|
||||||
<Element name="Spaces"/>
|
<Element name="Spaces"/>
|
||||||
</ComboBox>
|
</ComboBox>
|
||||||
<Item id="2036" name="&Repeat :"/>
|
<Item id="2036" name="&Repeat:"/>
|
||||||
<Item id="2032" name="Format"/>
|
<Item id="2032" name="Format"/>
|
||||||
<Item id="2024" name="&Dec"/>
|
<Item id="2024" name="&Dec"/>
|
||||||
<Item id="2025" name="&Oct"/>
|
<Item id="2025" name="&Oct"/>
|
||||||
|
@ -1282,15 +1282,15 @@ You can define several column markers by using white space to separate the diffe
|
|||||||
<ColumnEditor title="Column Editor">
|
<ColumnEditor title="Column Editor">
|
||||||
<Item id="2023" name="&Text to Insert"/>
|
<Item id="2023" name="&Text to Insert"/>
|
||||||
<Item id="2033" name="&Number to Insert"/>
|
<Item id="2033" name="&Number to Insert"/>
|
||||||
<Item id="2030" name="&Initial number :"/>
|
<Item id="2030" name="&Initial number:"/>
|
||||||
<Item id="2031" name="Increase b&y :"/>
|
<Item id="2031" name="Increase b&y:"/>
|
||||||
<Item id="2038" name="&Leading :"/>
|
<Item id="2038" name="&Leading:"/>
|
||||||
<ComboBox id="2039">
|
<ComboBox id="2039">
|
||||||
<Element name="None"/>
|
<Element name="None"/>
|
||||||
<Element name="Zeros"/>
|
<Element name="Zeros"/>
|
||||||
<Element name="Spaces"/>
|
<Element name="Spaces"/>
|
||||||
</ComboBox>
|
</ComboBox>
|
||||||
<Item id="2036" name="&Repeat :"/>
|
<Item id="2036" name="&Repeat:"/>
|
||||||
<Item id="2032" name="Format"/>
|
<Item id="2032" name="Format"/>
|
||||||
<Item id="2024" name="&Dec"/>
|
<Item id="2024" name="&Dec"/>
|
||||||
<Item id="2025" name="&Oct"/>
|
<Item id="2025" name="&Oct"/>
|
||||||
|
@ -15,8 +15,8 @@
|
|||||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
|
||||||
#include <vector>
|
//#include <vector>
|
||||||
#include <algorithm>
|
//#include <algorithm>
|
||||||
#include "columnEditor.h"
|
#include "columnEditor.h"
|
||||||
#include "ScintillaEditView.h"
|
#include "ScintillaEditView.h"
|
||||||
|
|
||||||
@ -78,7 +78,7 @@ intptr_t CALLBACK ColumnEditorDlg::run_dlgProc(UINT message, WPARAM wParam, LPAR
|
|||||||
::SendDlgItemMessage(_hSelf, format, BM_SETCHECK, TRUE, 0);
|
::SendDlgItemMessage(_hSelf, format, BM_SETCHECK, TRUE, 0);
|
||||||
|
|
||||||
switchTo(colEditParam._mainChoice);
|
switchTo(colEditParam._mainChoice);
|
||||||
goToCenter();
|
goToCenter(SWP_SHOWWINDOW | SWP_NOSIZE);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@ -148,7 +148,7 @@ intptr_t CALLBACK ColumnEditorDlg::run_dlgProc(UINT message, WPARAM wParam, LPAR
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
case WM_COMMAND :
|
case WM_COMMAND:
|
||||||
{
|
{
|
||||||
switch (wParam)
|
switch (wParam)
|
||||||
{
|
{
|
||||||
@ -187,7 +187,7 @@ intptr_t CALLBACK ColumnEditorDlg::run_dlgProc(UINT message, WPARAM wParam, LPAR
|
|||||||
auto endPos = (*_ppEditView)->execute(SCI_GETLENGTH);
|
auto endPos = (*_ppEditView)->execute(SCI_GETLENGTH);
|
||||||
auto endLine = (*_ppEditView)->execute(SCI_LINEFROMPOSITION, endPos);
|
auto endLine = (*_ppEditView)->execute(SCI_LINEFROMPOSITION, endPos);
|
||||||
|
|
||||||
int lineAllocatedLen = 1024;
|
constexpr int lineAllocatedLen = 1024;
|
||||||
TCHAR *line = new TCHAR[lineAllocatedLen];
|
TCHAR *line = new TCHAR[lineAllocatedLen];
|
||||||
|
|
||||||
for (size_t i = cursorLine ; i <= static_cast<size_t>(endLine); ++i)
|
for (size_t i = cursorLine ; i <= static_cast<size_t>(endLine); ++i)
|
||||||
@ -280,7 +280,7 @@ intptr_t CALLBACK ColumnEditorDlg::run_dlgProc(UINT message, WPARAM wParam, LPAR
|
|||||||
}
|
}
|
||||||
assert(numbers.size() > 0);
|
assert(numbers.size() > 0);
|
||||||
|
|
||||||
int lineAllocatedLen = 1024;
|
constexpr int lineAllocatedLen = 1024;
|
||||||
TCHAR *line = new TCHAR[lineAllocatedLen];
|
TCHAR *line = new TCHAR[lineAllocatedLen];
|
||||||
|
|
||||||
UCHAR f = format & MASK_FORMAT;
|
UCHAR f = format & MASK_FORMAT;
|
||||||
@ -494,11 +494,11 @@ void ColumnEditorDlg::switchTo(bool toText)
|
|||||||
UCHAR ColumnEditorDlg::getFormat()
|
UCHAR ColumnEditorDlg::getFormat()
|
||||||
{
|
{
|
||||||
UCHAR f = 0; // Dec by default
|
UCHAR f = 0; // Dec by default
|
||||||
if (BST_CHECKED == ::SendDlgItemMessage(_hSelf, IDC_COL_HEX_RADIO, BM_GETCHECK, 0, 0))
|
if (isCheckedOrNot(IDC_COL_HEX_RADIO))
|
||||||
f = 1;
|
f = 1;
|
||||||
else if (BST_CHECKED == ::SendDlgItemMessage(_hSelf, IDC_COL_OCT_RADIO, BM_GETCHECK, 0, 0))
|
else if (isCheckedOrNot(IDC_COL_OCT_RADIO))
|
||||||
f = 2;
|
f = 2;
|
||||||
else if (BST_CHECKED == ::SendDlgItemMessage(_hSelf, IDC_COL_BIN_RADIO, BM_GETCHECK, 0, 0))
|
else if (isCheckedOrNot(IDC_COL_BIN_RADIO))
|
||||||
f = 3;
|
f = 3;
|
||||||
return f;
|
return f;
|
||||||
}
|
}
|
||||||
|
@ -29,27 +29,26 @@ public :
|
|||||||
ColumnEditorDlg() = default;
|
ColumnEditorDlg() = default;
|
||||||
void init(HINSTANCE hInst, HWND hPere, ScintillaEditView **ppEditView);
|
void init(HINSTANCE hInst, HWND hPere, ScintillaEditView **ppEditView);
|
||||||
|
|
||||||
virtual void create(int dialogID, bool isRTL = false, bool msgDestParent = true) {
|
void create(int dialogID, bool isRTL = false, bool msgDestParent = true) override {
|
||||||
StaticDialog::create(dialogID, isRTL, msgDestParent);
|
StaticDialog::create(dialogID, isRTL, msgDestParent);
|
||||||
};
|
};
|
||||||
|
|
||||||
void doDialog(bool isRTL = false) {
|
void doDialog(bool isRTL = false) {
|
||||||
if (!isCreated())
|
if (!isCreated())
|
||||||
create(IDD_COLUMNEDIT, isRTL);
|
create(IDD_COLUMNEDIT, isRTL);
|
||||||
bool isTextMode = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, IDC_COL_TEXT_RADIO, BM_GETCHECK, 0, 0));
|
const bool isTextMode = isCheckedOrNot(IDC_COL_TEXT_RADIO);
|
||||||
display();
|
display();
|
||||||
::SetFocus(::GetDlgItem(_hSelf, isTextMode?IDC_COL_TEXT_EDIT:IDC_COL_INITNUM_EDIT));
|
::SetFocus(::GetDlgItem(_hSelf, isTextMode?IDC_COL_TEXT_EDIT:IDC_COL_INITNUM_EDIT));
|
||||||
};
|
};
|
||||||
|
|
||||||
virtual void display(bool toShow = true) const;
|
void display(bool toShow = true) const override;
|
||||||
void switchTo(bool toText);
|
void switchTo(bool toText);
|
||||||
UCHAR getFormat();
|
UCHAR getFormat();
|
||||||
ColumnEditorParam::leadingChoice getLeading();
|
ColumnEditorParam::leadingChoice getLeading();
|
||||||
|
|
||||||
protected :
|
protected :
|
||||||
virtual intptr_t CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam);
|
intptr_t CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam) override;
|
||||||
|
|
||||||
private :
|
private :
|
||||||
ScintillaEditView **_ppEditView = nullptr;
|
ScintillaEditView **_ppEditView = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -19,34 +19,34 @@
|
|||||||
#include "columnEditor_rc.h"
|
#include "columnEditor_rc.h"
|
||||||
|
|
||||||
|
|
||||||
IDD_COLUMNEDIT DIALOGEX 26, 41, 223, 221
|
IDD_COLUMNEDIT DIALOGEX 0, 0, 220, 214
|
||||||
STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||||
EXSTYLE WS_EX_DLGMODALFRAME | WS_EX_WINDOWEDGE
|
EXSTYLE WS_EX_DLGMODALFRAME | WS_EX_WINDOWEDGE
|
||||||
CAPTION "Column / Multi-Selection Editor"
|
CAPTION "Column / Multi-Selection Editor"
|
||||||
FONT 8, TEXT("MS Shell Dlg"), 0, 0, 0x0
|
FONT 8, TEXT("MS Shell Dlg"), 0, 0, 0x0
|
||||||
BEGIN
|
BEGIN
|
||||||
GROUPBOX "",IDC_COL_TEXT_GRP_STATIC,12,14,124,50
|
CONTROL "&Text to Insert",IDC_COL_TEXT_RADIO,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP | WS_GROUP,13,6,124,10
|
||||||
GROUPBOX "",IDC_COL_NUM_GRP_STATIC,12,79,204,135
|
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_TABSTOP | WS_GROUP,7,5,124,9
|
|
||||||
CONTROL "&Number to Insert",IDC_COL_NUM_RADIO,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP | WS_GROUP, 7,70,204,9
|
|
||||||
EDITTEXT IDC_COL_TEXT_EDIT,25,32,97,14,ES_AUTOHSCROLL
|
|
||||||
RTEXT "&Initial number :",IDC_COL_INITNUM_STATIC,15,91,76,8
|
|
||||||
EDITTEXT IDC_COL_INITNUM_EDIT,95,89,38,12,ES_NUMBER
|
|
||||||
|
|
||||||
RTEXT "Increase b&y :",IDC_COL_INCRNUM_STATIC,16,108,75,8
|
GROUPBOX "",IDC_COL_TEXT_GRP_STATIC,8,14,124,46
|
||||||
EDITTEXT IDC_COL_INCREASENUM_EDIT,95,106,38,12,ES_NUMBER
|
EDITTEXT IDC_COL_TEXT_EDIT,20,32,97,12,ES_AUTOHSCROLL
|
||||||
|
|
||||||
RTEXT "&Repeat :",IDC_COL_REPEATNUM_STATIC,16,125,75,8
|
GROUPBOX "",IDC_COL_NUM_GRP_STATIC,8,77,204,130
|
||||||
EDITTEXT IDC_COL_REPEATNUM_EDIT,95,123,38,12,ES_NUMBER
|
RTEXT "&Initial number:",IDC_COL_INITNUM_STATIC,10,89,76,8
|
||||||
|
EDITTEXT IDC_COL_INITNUM_EDIT,90,87,38,12,ES_NUMBER
|
||||||
|
RTEXT "Increase b&y:",IDC_COL_INCRNUM_STATIC,10,106,75,8
|
||||||
|
EDITTEXT IDC_COL_INCREASENUM_EDIT,90,104,38,12,ES_NUMBER
|
||||||
|
RTEXT "&Repeat:",IDC_COL_REPEATNUM_STATIC,10,123,75,8
|
||||||
|
EDITTEXT IDC_COL_REPEATNUM_EDIT,90,121,38,12,ES_NUMBER
|
||||||
|
RTEXT "&Leading:",IDC_COL_LEADING_STATIC,10,140,75,8
|
||||||
|
COMBOBOX IDC_COL_LEADING_COMBO,90,138,100,30,CBS_DROPDOWNLIST | WS_TABSTOP
|
||||||
|
|
||||||
RTEXT "&Leading :",IDC_COL_LEADING_STATIC,16,142,75,8
|
GROUPBOX "Format",IDC_COL_FORMAT_GRP_STATIC,16,155,188,44,BS_CENTER
|
||||||
COMBOBOX IDC_COL_LEADING_COMBO,95,140,100,30,CBS_DROPDOWNLIST | WS_TABSTOP
|
CONTROL "&Dec",IDC_COL_DEC_RADIO,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,27,168,70,10
|
||||||
|
CONTROL "&Hex",IDC_COL_HEX_RADIO,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,122,168,70,10
|
||||||
|
CONTROL "&Oct",IDC_COL_OCT_RADIO,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,27,183,70,10
|
||||||
|
CONTROL "&Bin",IDC_COL_BIN_RADIO,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,122,183,70,10
|
||||||
|
|
||||||
CONTROL "&Dec",IDC_COL_DEC_RADIO,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,30,175,70,10
|
DEFPUSHBUTTON "OK",IDOK,142,18,70,14
|
||||||
CONTROL "&Hex",IDC_COL_HEX_RADIO,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,124,175,70,10
|
PUSHBUTTON "Cancel",IDCANCEL,142,36,70,14
|
||||||
CONTROL "&Oct",IDC_COL_OCT_RADIO,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,30,189,70,10
|
|
||||||
CONTROL "&Bin",IDC_COL_BIN_RADIO,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,124,189,70,10
|
|
||||||
GROUPBOX "Format",IDC_COL_FORMAT_GRP_STATIC,20,163,188,44,BS_CENTER
|
|
||||||
DEFPUSHBUTTON "OK",IDOK,145,13,70,14,BS_NOTIFY
|
|
||||||
PUSHBUTTON "Cancel",IDCANCEL,145,36,70,14,BS_NOTIFY
|
|
||||||
END
|
END
|
||||||
|
Loading…
x
Reference in New Issue
Block a user