MCPcopy Create free account
hub / github.com/ProgerXP/Notepad2e / EditLinenumDlgProc

Function EditLinenumDlgProc

src/Edit.c:5319–5410  ·  view source on GitHub ↗

============================================================================= EditLinenumDlgProc()

Source from the content-addressed store, hash-verified

5317// EditLinenumDlgProc()
5318//
5319INT_PTR CALLBACK EditLinenumDlgProc ( HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam )
5320{
5321 switch ( umsg ) {
5322 case WM_INITDIALOG: {
5323 //int iPos;
5324 int iCurLine = ( int ) SendMessage ( hwndEdit, SCI_LINEFROMPOSITION, SendMessage ( hwndEdit, SCI_GETCURRENTPOS, 0, 0 ) , 0 ) + 1;
5325 SetDlgItemInt ( hwnd, IDC_LINENUM, iCurLine, FALSE );
5326 // HL_Get_offset ( hwndEdit, &iPos );
5327 // SetDlgItemInt ( hwnd, IDC_POSNUM, iPos, FALSE );
5328 SendDlgItemMessage ( hwnd, IDC_LINENUM, EM_LIMITTEXT, 15, 0 );
5329 SendDlgItemMessage ( hwnd, IDC_COLNUM, EM_LIMITTEXT, 15, 0 );
5330 SendDlgItemMessage ( hwnd, IDC_POSNUM, EM_LIMITTEXT, 15, 0 );
5331 CenterDlgInParent ( hwnd );
5332 }
5333 return TRUE;
5334 case WM_COMMAND:
5335 switch ( LOWORD ( wParam ) ) {
5336 case IDOK: {
5337 int iNewCol ;
5338 int iNewLine ;
5339 int iMaxLine ;
5340 int iMaxPos ;
5341 int iNewPos ;
5342 TCHAR wsLine[0xff];
5343 TCHAR wsCol[0xff];
5344 TCHAR wsPos[0xff];
5345 //////////////////////////////////////////////////////////////////////////
5346 GetDlgItemText ( hwnd , IDC_LINENUM , wsLine , 0xff );
5347 GetDlgItemText ( hwnd , IDC_COLNUM , wsCol , 0xff );
5348 GetDlgItemText ( hwnd , IDC_POSNUM , wsPos , 0xff );
5349 iMaxLine = SendMessage ( hwndEdit , SCI_GETLINECOUNT, 0, 0 );
5350 iMaxPos = SendMessage ( hwndEdit , SCI_GETTEXTLENGTH, 0, 0 );
5351 //////////////////////////////////////////////////////////////////////////
5352 if ( !HL_Is_Empty ( wsPos ) ) {
5353 if ( HL_Get_goto_number ( wsPos , &iNewPos , TRUE ) &&
5354 iNewPos >= 0 &&
5355 iNewPos < iMaxPos ) {
5356 HL_Jump_offset ( hwndEdit, iNewPos );
5357 EndDialog ( hwnd, IDOK );
5358 } else {
5359 PostMessage ( hwnd, WM_NEXTDLGCTL,
5360 ( WPARAM ) ( GetDlgItem ( hwnd, IDC_POSNUM ) ), 1 );
5361 }
5362 } else if (
5363 HL_Get_goto_number ( wsLine , &iNewLine , FALSE )
5364 ) {
5365 if ( !HL_Is_Empty ( wsCol ) ) {
5366 if ( ! HL_Get_goto_number ( wsCol , &iNewCol , FALSE ) || iNewCol <= 0 ) {
5367 PostMessage ( hwnd, WM_NEXTDLGCTL,
5368 ( WPARAM ) ( GetDlgItem ( hwnd, IDC_COLNUM ) ), 1 );
5369 break;
5370 }
5371 } else {
5372 iNewCol = 1;
5373 }
5374 /////
5375 if ( iNewLine > 0
5376 && iNewLine <= iMaxLine

Callers

nothing calls this directly

Calls 5

CenterDlgInParentFunction · 0.85
HL_Is_EmptyFunction · 0.85
HL_Get_goto_numberFunction · 0.85
HL_Jump_offsetFunction · 0.85
EditJumpToFunction · 0.85

Tested by

no test coverage detected