- Added line nrs to script richedit

This commit is contained in:
HarrievG 2021-07-14 23:32:28 +02:00
parent b9833e7e6e
commit 5c3d95efee

View file

@ -361,7 +361,7 @@ LRESULT CALLBACK rvDebuggerWindow::ScriptWndProc ( HWND wnd, UINT msg, WPARAM wp
GetWindowRect(window->mWndToolbar, &rect);
MoveWindow(window->mWndMargin, 0, 0, window->mMarginSize, window->mSplitterRect.top - (rect.bottom - rect.top), TRUE);
SendMessage(window->mWndScript, EM_SETMARGINS, EC_LEFTMARGIN | EC_RIGHTMARGIN, MAKELONG(s18, s10));
SendMessage(window->mWndScript, EM_SETMARGINS, EC_LEFTMARGIN | EC_RIGHTMARGIN, MAKELONG(s18*2.25, s10));
}
}
@ -412,10 +412,40 @@ LRESULT CALLBACK rvDebuggerWindow::MarginWndProc ( HWND wnd, UINT msg, WPARAM wp
PAINTSTRUCT ps;
RECT rect;
GetClientRect ( wnd, &rect );
dc = BeginPaint( wnd, &ps );
FillRect( dc, &rect, GetSysColorBrush( COLOR_3DSHADOW ) );
dc = BeginPaint ( wnd, &ps );
FillRect ( dc, &rect, GetSysColorBrush ( COLOR_3DSHADOW ) );
//draw line nrs
int iMaxNumberOfLines = ( (rect.bottom - rect.top ) ) + 1;
int iFirstVisibleLine = SendMessage( window->mWndScript, EM_GETFIRSTVISIBLELINE, 0, 0 );
HFONT hf = CreateFont( height, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "Courier New" );
HFONT hfOld = ( HFONT ) SelectObject( dc, hf );
SetBkMode( dc, OPAQUE );
SetBkColor(dc, GetSysColor( COLOR_3DFACE ));
SetTextColor( dc, RGB( 0, 0, 255 ) );
RECT lnrRect = rect;
lnrRect.left += rect.right - rect.left;
lnrRect.right += rect.right - rect.left;
FillRect( dc, &lnrRect, GetSysColorBrush( COLOR_3DFACE ) );
for (int i = 0; i < iMaxNumberOfLines; ++i )
{
int c;
POINTL pos;
c = SendMessage( window->mWndScript, EM_LINEINDEX, iFirstVisibleLine + i , 0 );
SendMessage( window->mWndScript, EM_POSFROMCHAR, ( WPARAM ) &pos, c );
RECT t = rect;
t.bottom += pos.y - t.top;
t.top = pos.y;
t.left += rect.right - rect.left;
t.right += rect.right - rect.left;
idStr lntxt( iFirstVisibleLine + i + 1);
DrawText( dc, lntxt, lntxt.Length(), &t, DT_RIGHT );
}
DeleteObject( hf );
//draw breakpoints
if ( window->mScripts.Num ( ) )
{
for ( int i = 0; i < window->mClient->GetBreakpointCount(); i ++ )
@ -430,7 +460,7 @@ LRESULT CALLBACK rvDebuggerWindow::MarginWndProc ( HWND wnd, UINT msg, WPARAM wp
c = SendMessage ( window->mWndScript, EM_LINEINDEX, bp->GetLineNumber ( ) - 1, 0 );
SendMessage ( window->mWndScript, EM_POSFROMCHAR, (WPARAM)&pos, c );
ImageList_DrawEx ( window->mTmpImageList, 2, dc, rect.left, pos.y, width, height, CLR_NONE, CLR_NONE, ILD_NORMAL );
ImageList_DrawEx ( window->mTmpImageList, 2, dc, rect.left, pos.y, width, height, CLR_NONE, CLR_NONE, ILD_NORMAL );
}
}
@ -1432,7 +1462,7 @@ LRESULT CALLBACK rvDebuggerWindow::WndProc ( HWND wnd, UINT msg, WPARAM wparam,
MoveWindow ( window->mWndScriptList, rect.left, rect.top, rect.right-rect.left, rect.bottom-rect.top, TRUE );
MoveWindow ( window->mWndBreakList, rect.left, rect.top, rect.right-rect.left, rect.bottom-rect.top, TRUE );
SendMessage(window->mWndScript, EM_SETMARGINS, EC_LEFTMARGIN | EC_RIGHTMARGIN, MAKELONG(s18, s10));
SendMessage(window->mWndScript, EM_SETMARGINS, EC_LEFTMARGIN | EC_RIGHTMARGIN, MAKELONG(s18*2.25, s10));
SendMessage(window->mWndCallstack, EM_SETMARGINS, EC_LEFTMARGIN | EC_RIGHTMARGIN, MAKELONG(s18, s10));
SendMessage(window->mWndOutput, EM_SETMARGINS, EC_LEFTMARGIN | EC_RIGHTMARGIN, MAKELONG(s18, s10));
SendMessage(window->mWndConsole, EM_SETMARGINS, EC_LEFTMARGIN | EC_RIGHTMARGIN, MAKELONG(s18, s10));