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

Function MsgNotify

src/Notepad2.c:3977–4255  ·  view source on GitHub ↗

============================================================================= MsgNotify() - Handles WM_NOTIFY

Source from the content-addressed store, hash-verified

3975//
3976//
3977LRESULT MsgNotify ( HWND hwnd, WPARAM wParam, LPARAM lParam )
3978{
3979 LPNMHDR pnmh = ( LPNMHDR ) lParam;
3980 struct SCNotification *scn = ( struct SCNotification * ) lParam;
3981 switch ( pnmh->idFrom ) {
3982 case IDC_EDIT:
3983 switch ( pnmh->code ) {
3984 case SCN_UPDATEUI:
3985 if ( scn->updated & ~ ( SC_UPDATE_V_SCROLL | SC_UPDATE_H_SCROLL ) ) {
3986 UpdateToolbar();
3987 UpdateStatusbar();
3988 // Invalidate invalid selections
3989 // #pragma message("TODO: Remove check for invalid selections once fixed in Scintilla")
3990 if ( SendMessage ( hwndEdit, SCI_GETSELECTIONS, 0, 0 ) > 1 &&
3991 SendMessage ( hwndEdit, SCI_GETSELECTIONMODE, 0, 0 ) != SC_SEL_RECTANGLE ) {
3992 int iCurPos = ( int ) SendMessage ( hwndEdit, SCI_GETCURRENTPOS, 0, 0 );
3993 SendMessage ( hwndEdit, WM_CANCELMODE, 0, 0 );
3994 SendMessage ( hwndEdit, SCI_CLEARSELECTIONS, 0, 0 );
3995 SendMessage ( hwndEdit, SCI_SETSELECTION, ( WPARAM ) iCurPos, ( LPARAM ) iCurPos );
3996 }
3997 // Brace Match
3998 if ( bMatchBraces ) {
3999 int iPos;
4000 char c;
4001 int iEndStyled = ( int ) SendMessage ( hwndEdit, SCI_GETENDSTYLED, 0, 0 );
4002 if ( iEndStyled < ( int ) SendMessage ( hwndEdit, SCI_GETLENGTH, 0, 0 ) ) {
4003 int iLine = ( int ) SendMessage ( hwndEdit, SCI_LINEFROMPOSITION, iEndStyled, 0 );
4004 int iEndStyled = ( int ) SendMessage ( hwndEdit, SCI_POSITIONFROMLINE, iLine, 0 );
4005 SendMessage ( hwndEdit, SCI_COLOURISE, iEndStyled, -1 );
4006 }
4007 iPos = ( int ) SendMessage ( hwndEdit, SCI_GETCURRENTPOS, 0, 0 );
4008 c = ( char ) SendMessage ( hwndEdit, SCI_GETCHARAT, iPos, 0 );
4009 if ( StrChrA ( "()[]{}", c ) ) {
4010 int iBrace2 = ( int ) SendMessage ( hwndEdit, SCI_BRACEMATCH, iPos, 0 );
4011 if ( iBrace2 != -1 ) {
4012 int col1 = ( int ) SendMessage ( hwndEdit, SCI_GETCOLUMN, iPos, 0 );
4013 int col2 = ( int ) SendMessage ( hwndEdit, SCI_GETCOLUMN, iBrace2, 0 );
4014 SendMessage ( hwndEdit, SCI_BRACEHIGHLIGHT, iPos, iBrace2 );
4015 SendMessage ( hwndEdit, SCI_SETHIGHLIGHTGUIDE, min ( col1, col2 ), 0 );
4016 } else {
4017 SendMessage ( hwndEdit, SCI_BRACEBADLIGHT, iPos, 0 );
4018 SendMessage ( hwndEdit, SCI_SETHIGHLIGHTGUIDE, 0, 0 );
4019 }
4020 }
4021 // Try one before
4022 else {
4023 iPos = ( int ) SendMessage ( hwndEdit, SCI_POSITIONBEFORE, iPos, 0 );
4024 c = ( char ) SendMessage ( hwndEdit, SCI_GETCHARAT, iPos, 0 );
4025 if ( StrChrA ( "()[]{}", c ) ) {
4026 int iBrace2 = ( int ) SendMessage ( hwndEdit, SCI_BRACEMATCH, iPos, 0 );
4027 if ( iBrace2 != -1 ) {
4028 int col1 = ( int ) SendMessage ( hwndEdit, SCI_GETCOLUMN, iPos, 0 );
4029 int col2 = ( int ) SendMessage ( hwndEdit, SCI_GETCOLUMN, iBrace2, 0 );
4030 SendMessage ( hwndEdit, SCI_BRACEHIGHLIGHT, iPos, iBrace2 );
4031 SendMessage ( hwndEdit, SCI_SETHIGHLIGHTGUIDE, min ( col1, col2 ), 0 );
4032 } else {
4033 SendMessage ( hwndEdit, SCI_BRACEBADLIGHT, iPos, 0 );
4034 SendMessage ( hwndEdit, SCI_SETHIGHLIGHTGUIDE, 0, 0 );

Callers 1

MainWndProcFunction · 0.85

Calls 6

UpdateToolbarFunction · 0.85
UpdateStatusbarFunction · 0.85
UpdateLineNumberWidthFunction · 0.85
SetWindowTitleFunction · 0.85
HLS_on_notificationFunction · 0.85
EditFixPositionsFunction · 0.85

Tested by

no test coverage detected