|
|
|
@ -54,8 +54,19 @@ intptr_t CALLBACK ColumnEditorDlg::run_dlgProc(UINT message, WPARAM wParam, LPAR
|
|
|
|
|
if (colEditParam._repeatNum != -1)
|
|
|
|
|
::SetDlgItemInt(_hSelf, IDC_COL_REPEATNUM_EDIT, colEditParam._repeatNum, FALSE);
|
|
|
|
|
|
|
|
|
|
::SendDlgItemMessage(_hSelf, IDC_COL_LEADZERO_CHECK, BM_SETCHECK, colEditParam._isLeadingZeros, 0);
|
|
|
|
|
|
|
|
|
|
::SendDlgItemMessage(_hSelf, IDC_COL_LEADING_COMBO, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(TEXT("None")));
|
|
|
|
|
::SendDlgItemMessage(_hSelf, IDC_COL_LEADING_COMBO, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(TEXT("Zeros")));
|
|
|
|
|
::SendDlgItemMessage(_hSelf, IDC_COL_LEADING_COMBO, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(TEXT("Spaces")));
|
|
|
|
|
WPARAM curSel = 0;
|
|
|
|
|
switch (colEditParam._leadingChoice)
|
|
|
|
|
{
|
|
|
|
|
case ColumnEditorParam::noneLeading: { curSel = 0; break; }
|
|
|
|
|
case ColumnEditorParam::zeroLeading : { curSel = 1; break; }
|
|
|
|
|
case ColumnEditorParam::spaceLeading : { curSel = 2; break; }
|
|
|
|
|
default : { curSel = 0; break; }
|
|
|
|
|
}
|
|
|
|
|
::SendMessage(::GetDlgItem(_hSelf, IDC_COL_LEADING_COMBO), CB_SETCURSEL, curSel, 0);
|
|
|
|
|
|
|
|
|
|
int format = IDC_COL_DEC_RADIO;
|
|
|
|
|
if (colEditParam._formatChoice == 1)
|
|
|
|
|
format = IDC_COL_HEX_RADIO;
|
|
|
|
@ -230,7 +241,7 @@ intptr_t CALLBACK ColumnEditorDlg::run_dlgProc(UINT message, WPARAM wParam, LPAR
|
|
|
|
|
if (colInfos.size() > 0)
|
|
|
|
|
{
|
|
|
|
|
std::sort(colInfos.begin(), colInfos.end(), SortInPositionOrder());
|
|
|
|
|
(*_ppEditView)->columnReplace(colInfos, initialNumber, increaseNumber, repeat, format);
|
|
|
|
|
(*_ppEditView)->columnReplace(colInfos, initialNumber, increaseNumber, repeat, format, getLeading());
|
|
|
|
|
std::sort(colInfos.begin(), colInfos.end(), SortInSelectOrder());
|
|
|
|
|
(*_ppEditView)->setMultiSelections(colInfos);
|
|
|
|
|
}
|
|
|
|
@ -266,9 +277,7 @@ intptr_t CALLBACK ColumnEditorDlg::run_dlgProc(UINT message, WPARAM wParam, LPAR
|
|
|
|
|
int lineAllocatedLen = 1024;
|
|
|
|
|
TCHAR *line = new TCHAR[lineAllocatedLen];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UCHAR f = format & MASK_FORMAT;
|
|
|
|
|
bool isZeroLeading = (MASK_ZERO_LEADING & format) != 0;
|
|
|
|
|
|
|
|
|
|
int base = 10;
|
|
|
|
|
if (f == BASE_16)
|
|
|
|
@ -303,7 +312,7 @@ intptr_t CALLBACK ColumnEditorDlg::run_dlgProc(UINT message, WPARAM wParam, LPAR
|
|
|
|
|
//
|
|
|
|
|
// Calcule generic_string
|
|
|
|
|
//
|
|
|
|
|
int2str(str, stringSize, numbers.at(i - cursorLine), base, nb, isZeroLeading);
|
|
|
|
|
int2str(str, stringSize, numbers.at(i - cursorLine), base, nb, getLeading());
|
|
|
|
|
|
|
|
|
|
if (lineEndCol < cursorCol)
|
|
|
|
|
{
|
|
|
|
@ -356,14 +365,6 @@ intptr_t CALLBACK ColumnEditorDlg::run_dlgProc(UINT message, WPARAM wParam, LPAR
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
case IDC_COL_LEADZERO_CHECK:
|
|
|
|
|
{
|
|
|
|
|
ColumnEditorParam& colEditParam = NppParameters::getInstance()._columnEditParam;
|
|
|
|
|
bool isLeadingZeros = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, IDC_COL_LEADZERO_CHECK, BM_GETCHECK, 0, 0));
|
|
|
|
|
colEditParam._isLeadingZeros = isLeadingZeros;
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
default :
|
|
|
|
|
{
|
|
|
|
|
switch (HIWORD(wParam))
|
|
|
|
@ -427,6 +428,17 @@ intptr_t CALLBACK ColumnEditorDlg::run_dlgProc(UINT message, WPARAM wParam, LPAR
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case CBN_SELCHANGE:
|
|
|
|
|
{
|
|
|
|
|
if (LOWORD(wParam) == IDC_COL_LEADING_COMBO)
|
|
|
|
|
{
|
|
|
|
|
ColumnEditorParam& colEditParam = NppParameters::getInstance()._columnEditParam;
|
|
|
|
|
colEditParam._leadingChoice = getLeading();
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
@ -455,7 +467,8 @@ void ColumnEditorDlg::switchTo(bool toText)
|
|
|
|
|
::EnableWindow(::GetDlgItem(_hSelf, IDC_COL_HEX_RADIO), !toText);
|
|
|
|
|
::EnableWindow(::GetDlgItem(_hSelf, IDC_COL_OCT_RADIO), !toText);
|
|
|
|
|
::EnableWindow(::GetDlgItem(_hSelf, IDC_COL_BIN_RADIO), !toText);
|
|
|
|
|
::EnableWindow(::GetDlgItem(_hSelf, IDC_COL_LEADZERO_CHECK), !toText);
|
|
|
|
|
::EnableWindow(::GetDlgItem(_hSelf, IDC_COL_LEADING_STATIC), !toText);
|
|
|
|
|
::EnableWindow(::GetDlgItem(_hSelf, IDC_COL_LEADING_COMBO), !toText);
|
|
|
|
|
|
|
|
|
|
::SetFocus(toText?hText:hNum);
|
|
|
|
|
|
|
|
|
@ -472,7 +485,6 @@ void ColumnEditorDlg::switchTo(bool toText)
|
|
|
|
|
|
|
|
|
|
UCHAR ColumnEditorDlg::getFormat()
|
|
|
|
|
{
|
|
|
|
|
bool isLeadingZeros = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, IDC_COL_LEADZERO_CHECK, BM_GETCHECK, 0, 0));
|
|
|
|
|
UCHAR f = 0; // Dec by default
|
|
|
|
|
if (BST_CHECKED == ::SendDlgItemMessage(_hSelf, IDC_COL_HEX_RADIO, BM_GETCHECK, 0, 0))
|
|
|
|
|
f = 1;
|
|
|
|
@ -480,5 +492,31 @@ UCHAR ColumnEditorDlg::getFormat()
|
|
|
|
|
f = 2;
|
|
|
|
|
else if (BST_CHECKED == ::SendDlgItemMessage(_hSelf, IDC_COL_BIN_RADIO, BM_GETCHECK, 0, 0))
|
|
|
|
|
f = 3;
|
|
|
|
|
return (f | (isLeadingZeros?MASK_ZERO_LEADING:0));
|
|
|
|
|
return f;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ColumnEditorParam::leadingChoice ColumnEditorDlg::getLeading()
|
|
|
|
|
{
|
|
|
|
|
ColumnEditorParam::leadingChoice leading = ColumnEditorParam::noneLeading;
|
|
|
|
|
int curSel = static_cast<int>(::SendDlgItemMessage(_hSelf, IDC_COL_LEADING_COMBO, CB_GETCURSEL, 0, 0));
|
|
|
|
|
switch (curSel)
|
|
|
|
|
{
|
|
|
|
|
case 0:
|
|
|
|
|
default:
|
|
|
|
|
{
|
|
|
|
|
leading = ColumnEditorParam::noneLeading;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case 1:
|
|
|
|
|
{
|
|
|
|
|
leading = ColumnEditorParam::zeroLeading;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case 2:
|
|
|
|
|
{
|
|
|
|
|
leading = ColumnEditorParam::spaceLeading;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return leading;
|
|
|
|
|
}
|