Error in CSED 1.03 Source File CSED.BAS

Started by Nick Melnick, December 01, 2014, 09:10:09 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Nick Melnick

In function CSED_CreateMdiChild, the line beginning with "RedrawWindow pSed.hwndClient" is commented out.
Uncomment it, otherwise:
o un-maximized child windows are not displayed properly
o Files opened from the "Recent Files" menu will not have properly displayed children
o Files opened from the toolbar's open file dropdown WILL have properly displayed children (?)

IMHO, the source files CSED_PRINT.inc and CSED_TOOLBARS.inc should be updated to reflect the bug
fixes presented in this thread.

This may not be the proper thread for this (dated) question, but I've been fooling around with
code improvements in SED 2.02 & 2.03 because I still use them when I want split window capability.
It reminded me of the fact that none of the SED releases ever responded to Bold or Italic font
settings (although Underline always worked). PBSITE (the predecessor to SED) and CSED both do
this properly.
Debugging to find the problem is leading to a dead end since everything seems to be doing what it
should to produce these font settings.

So - does anyone out there have any idea what might be causing this issue???
(Its not the Scintilla DLL, every version up to the latest has been tried)

José Roca


Nick Melnick

I have also noticed that when a child is not maximized and slowly sized downwards vertically, it sizes in "steps".
This can be fixed by changing the %FALSE parameter of the MoveWindow call in the WM_SIZE message
in CSED_MDIWindowProc to %TRUE and catching the WM_ERASEBKGND message and returning %TRUE.

Nick Melnick

Found the problem with SED's font formatting.
Much of the code in SCI_SetOptions had to be restructured.

Theo Gottwald

What exactly did you change, Nick?
I could not understand what changes are needed in PRINT and TOOLBARS etc.

Nick Melnick

PRINT had the following 2 lines reversed, making the character "<" print as garbage:
REPLACE "&" WITH "&amp;" IN txt
REPLACE "<" WITH "&lt;" IN txt

TOOLBARS required the modifications posted in 'CSED - Modification' replies #67 & #69.

The way that the code was structured in the SCI_SetOptions sub would only allow Bold or Italic to
be shown if you unchecked 'use always the default font' and chose a particular item to modify.
In other words, using the default font setting was bypassed and had no effect. Jose got it right in CSED.
My changes are shown below. Just paste it over the relevant existing code:


         ' Set the Comments style
         SciMsg pSci, %SCI_STYLESETFONT, %SCE_B_COMMENT, BYVAL IIF&(g_tSciColorsAndFonts.UseAlwaysDefaultFont,_
                  VARPTR(g_tSciColorsAndFonts.DefaultFontName), VARPTR(g_tSciColorsAndFonts.CommentFontName))
         SCI_SetCharset pSci, %SCE_B_COMMENT, IIF$(g_tSciColorsAndFonts.UseAlwaysDefaultFont,_
                  g_tSciColorsAndFonts.DefaultFontCharset, g_tSciColorsAndFonts.CommentFontCharset)
         SciMsg pSci, %SCI_STYLESETBOLD, %SCE_B_COMMENT, IIF&(g_tSciColorsAndFonts.UseAlwaysDefaultFont,_
                  g_tSciColorsAndFonts.DefaultFontBold, g_tSciColorsAndFonts.CommentFontBold)
         SciMsg pSci, %SCI_STYLESETITALIC, %SCE_B_COMMENT, IIF&(g_tSciColorsAndFonts.UseAlwaysDefaultFont,_
                  g_tSciColorsAndFonts.DefaultFontItalic, g_tSciColorsAndFonts.CommentFontItalic)
         SciMsg pSci, %SCI_STYLESETUNDERLINE, %SCE_B_COMMENT, IIF&(g_tSciColorsAndFonts.UseAlwaysDefaultFont,_
                  g_tSciColorsAndFonts.DefaultFontUnderline, g_tSciColorsAndFonts.CommentFontUnderline)

         SciMsg pSci, %SCI_STYLESETFORE, %SCE_B_COMMENT, g_tSciColorsAndFonts.CommentForeColor
         SciMsg pSci, %SCI_STYLESETCASE, %SCE_B_COMMENT, EdOpt.DefaultCase

         SciMsg pSci, %SCI_STYLESETSIZE, %SCE_B_COMMENT, IIF&(g_tSciColorsAndFonts.UseAlwaysDefaultFontSize,_
                  g_tSciColorsAndFonts.DefaultFontSize, g_tSciColorsAndFonts.CommentFontSize)

         SciMsg pSci, %SCI_STYLESETBACK, %SCE_B_COMMENT, IIF&(g_tSciColorsAndFonts.UseAlwaysDefaultBackColor,_
                  g_tSciColorsAndFonts.DefaultBackColor, g_tSciColorsAndFonts.CommentBackColor)

         ' Set the Keywords style
         SciMsg pSci, %SCI_STYLESETFONT, %SCE_B_KEYWORD, BYVAL IIF&(g_tSciColorsAndFonts.UseAlwaysDefaultFont,_
                  VARPTR(g_tSciColorsAndFonts.DefaultFontName), VARPTR(g_tSciColorsAndFonts.KeywordFontName))
         SCI_SetCharset pSci, %SCE_B_KEYWORD, IIF$(g_tSciColorsAndFonts.UseAlwaysDefaultFont,_
                  g_tSciColorsAndFonts.DefaultFontCharset, g_tSciColorsAndFonts.KeywordFontCharset)
         SciMsg pSci, %SCI_STYLESETBOLD, %SCE_B_KEYWORD, IIF&(g_tSciColorsAndFonts.UseAlwaysDefaultFont,_
                  g_tSciColorsAndFonts.DefaultFontBold, g_tSciColorsAndFonts.KeywordFontBold)
         SciMsg pSci, %SCI_STYLESETITALIC, %SCE_B_KEYWORD, IIF&(g_tSciColorsAndFonts.UseAlwaysDefaultFont,_
                  g_tSciColorsAndFonts.DefaultFontItalic, g_tSciColorsAndFonts.KeywordFontItalic)
         SciMsg pSci, %SCI_STYLESETUNDERLINE, %SCE_B_KEYWORD, IIF&(g_tSciColorsAndFonts.UseAlwaysDefaultFont,_
                  g_tSciColorsAndFonts.DefaultFontUnderline, g_tSciColorsAndFonts.KeywordFontUnderline)

         SciMsg pSci, %SCI_STYLESETFORE, %SCE_B_KEYWORD, g_tSciColorsAndFonts.KeywordForeColor
         SciMsg pSci, %SCI_STYLESETCASE, %SCE_B_KEYWORD, EdOpt.KeywordCase

         SciMsg pSci, %SCI_STYLESETSIZE, %SCE_B_KEYWORD, IIF&(g_tSciColorsAndFonts.UseAlwaysDefaultFontSize,_
                  g_tSciColorsAndFonts.DefaultFontSize, g_tSciColorsAndFonts.KeywordFontSize)

         SciMsg pSci, %SCI_STYLESETBACK, %SCE_B_KEYWORD, IIF&(g_tSciColorsAndFonts.UseAlwaysDefaultBackColor,_
                  g_tSciColorsAndFonts.DefaultBackColor, g_tSciColorsAndFonts.KeywordBackColor)

         ' Set the Constants style
         SciMsg pSci, %SCI_STYLESETFONT, %SCE_B_CONSTANT, BYVAL IIF&(g_tSciColorsAndFonts.UseAlwaysDefaultFont,_
                  VARPTR(g_tSciColorsAndFonts.DefaultFontName), VARPTR(g_tSciColorsAndFonts.ConstantFontName))
         SCI_SetCharset pSci, %SCE_B_CONSTANT, IIF$(g_tSciColorsAndFonts.UseAlwaysDefaultFont,_
                  g_tSciColorsAndFonts.DefaultFontCharset, g_tSciColorsAndFonts.ConstantFontCharset)
         SciMsg pSci, %SCI_STYLESETBOLD, %SCE_B_CONSTANT, IIF&(g_tSciColorsAndFonts.UseAlwaysDefaultFont,_
                  g_tSciColorsAndFonts.DefaultFontBold, g_tSciColorsAndFonts.ConstantFontBold)
         SciMsg pSci, %SCI_STYLESETITALIC, %SCE_B_CONSTANT, IIF&(g_tSciColorsAndFonts.UseAlwaysDefaultFont,_
                  g_tSciColorsAndFonts.DefaultFontItalic, g_tSciColorsAndFonts.ConstantFontItalic)
         SciMsg pSci, %SCI_STYLESETUNDERLINE, %SCE_B_CONSTANT, IIF&(g_tSciColorsAndFonts.UseAlwaysDefaultFont,_
                  g_tSciColorsAndFonts.DefaultFontUnderline, g_tSciColorsAndFonts.ConstantFontUnderline)

         SciMsg pSci, %SCI_STYLESETFORE, %SCE_B_CONSTANT, g_tSciColorsAndFonts.ConstantForeColor
         SciMsg pSci, %SCI_STYLESETCASE, %SCE_B_CONSTANT, EdOpt.DefaultCase

         SciMsg pSci, %SCI_STYLESETSIZE, %SCE_B_CONSTANT, IIF&(g_tSciColorsAndFonts.UseAlwaysDefaultFontSize,_
                  g_tSciColorsAndFonts.DefaultFontSize, g_tSciColorsAndFonts.ConstantFontSize)

         SciMsg pSci, %SCI_STYLESETBACK, %SCE_B_CONSTANT, IIF&(g_tSciColorsAndFonts.UseAlwaysDefaultBackColor,_
                  g_tSciColorsAndFonts.DefaultBackColor, g_tSciColorsAndFonts.ConstantBackColor)

         ' Set the Identifiers style
         SciMsg pSci, %SCI_STYLESETFONT, %SCE_B_IDENTIFIER, BYVAL IIF&(g_tSciColorsAndFonts.UseAlwaysDefaultFont,_
                  VARPTR(g_tSciColorsAndFonts.DefaultFontName), VARPTR(g_tSciColorsAndFonts.IdentifierFontName))
         SCI_SetCharset pSci, %SCE_B_IDENTIFIER, IIF$(g_tSciColorsAndFonts.UseAlwaysDefaultFont,_
                  g_tSciColorsAndFonts.DefaultFontCharset, g_tSciColorsAndFonts.IdentifierFontCharset)
         SciMsg pSci, %SCI_STYLESETBOLD, %SCE_B_IDENTIFIER, IIF&(g_tSciColorsAndFonts.UseAlwaysDefaultFont,_
                  g_tSciColorsAndFonts.DefaultFontBold, g_tSciColorsAndFonts.IdentifierFontBold)
         SciMsg pSci, %SCI_STYLESETITALIC, %SCE_B_IDENTIFIER, IIF&(g_tSciColorsAndFonts.UseAlwaysDefaultFont,_
                  g_tSciColorsAndFonts.DefaultFontItalic, g_tSciColorsAndFonts.IdentifierFontItalic)
         SciMsg pSci, %SCI_STYLESETUNDERLINE, %SCE_B_IDENTIFIER, IIF&(g_tSciColorsAndFonts.UseAlwaysDefaultFont,_
                  g_tSciColorsAndFonts.DefaultFontUnderline, g_tSciColorsAndFonts.IdentifierFontUnderline)

         SciMsg pSci, %SCI_STYLESETFORE, %SCE_B_IDENTIFIER, g_tSciColorsAndFonts.IdentifierForeColor
         SciMsg pSci, %SCI_STYLESETCASE, %SCE_B_IDENTIFIER, EdOpt.DefaultCase

         SciMsg pSci, %SCI_STYLESETSIZE, %SCE_B_IDENTIFIER, IIF&(g_tSciColorsAndFonts.UseAlwaysDefaultFontSize,_
                  g_tSciColorsAndFonts.DefaultFontSize, g_tSciColorsAndFonts.DefaultFontSize)

         SciMsg pSci, %SCI_STYLESETBACK, %SCE_B_IDENTIFIER, IIF&(g_tSciColorsAndFonts.UseAlwaysDefaultBackColor,_
                  g_tSciColorsAndFonts.DefaultBackColor, g_tSciColorsAndFonts.IdentifierBackColor)

         ' Set the Numbers style
         SciMsg pSci, %SCI_STYLESETFONT, %SCE_B_NUMBER, BYVAL IIF&(g_tSciColorsAndFonts.UseAlwaysDefaultFont,_
                  VARPTR(g_tSciColorsAndFonts.DefaultFontName), VARPTR(g_tSciColorsAndFonts.NumberFontName))
         SCI_SetCharset pSci, %SCE_B_NUMBER, IIF$(g_tSciColorsAndFonts.UseAlwaysDefaultFont,_
                  g_tSciColorsAndFonts.DefaultFontCharset, g_tSciColorsAndFonts.NumberFontCharset)
         SciMsg pSci, %SCI_STYLESETBOLD, %SCE_B_NUMBER, IIF&(g_tSciColorsAndFonts.UseAlwaysDefaultFont,_
                  g_tSciColorsAndFonts.DefaultFontBold, g_tSciColorsAndFonts.NumberFontBold)
         SciMsg pSci, %SCI_STYLESETITALIC, %SCE_B_NUMBER, IIF&(g_tSciColorsAndFonts.UseAlwaysDefaultFont,_
                  g_tSciColorsAndFonts.DefaultFontItalic, g_tSciColorsAndFonts.NumberFontItalic)
         SciMsg pSci, %SCI_STYLESETUNDERLINE, %SCE_B_NUMBER, IIF&(g_tSciColorsAndFonts.UseAlwaysDefaultFont,_
                  g_tSciColorsAndFonts.DefaultFontUnderline, g_tSciColorsAndFonts.NumberFontUnderline)

         SciMsg pSci, %SCI_STYLESETFORE, %SCE_B_NUMBER, g_tSciColorsAndFonts.NumberForeColor
         SciMsg pSci, %SCI_STYLESETCASE, %SCE_B_NUMBER, EdOpt.DefaultCase

         SciMsg pSci, %SCI_STYLESETSIZE, %SCE_B_NUMBER, IIF&(g_tSciColorsAndFonts.UseAlwaysDefaultFontSize,_
                  g_tSciColorsAndFonts.DefaultFontSize, g_tSciColorsAndFonts.NumberFontSize)

         SciMsg pSci, %SCI_STYLESETBACK, %SCE_B_NUMBER, IIF&(g_tSciColorsAndFonts.UseAlwaysDefaultBackColor,_
                  g_tSciColorsAndFonts.DefaultBackColor, g_tSciColorsAndFonts.NumberBackColor)

         ' Set the Operators style
         SciMsg pSci, %SCI_STYLESETFONT, %SCE_B_OPERATOR, BYVAL IIF&(g_tSciColorsAndFonts.UseAlwaysDefaultFont,_
                  VARPTR(g_tSciColorsAndFonts.DefaultFontName), VARPTR(g_tSciColorsAndFonts.OperatorFontName))
         SCI_SetCharset pSci, %SCE_B_OPERATOR, IIF$(g_tSciColorsAndFonts.UseAlwaysDefaultFont,_
                  g_tSciColorsAndFonts.DefaultFontCharset, g_tSciColorsAndFonts.OperatorFontCharset)
         SciMsg pSci, %SCI_STYLESETBOLD, %SCE_B_OPERATOR, IIF&(g_tSciColorsAndFonts.UseAlwaysDefaultFont,_
                  g_tSciColorsAndFonts.DefaultFontBold, g_tSciColorsAndFonts.OperatorFontBold)
         SciMsg pSci, %SCI_STYLESETITALIC, %SCE_B_OPERATOR, IIF&(g_tSciColorsAndFonts.UseAlwaysDefaultFont,_
                  g_tSciColorsAndFonts.DefaultFontItalic, g_tSciColorsAndFonts.OperatorFontItalic)
         SciMsg pSci, %SCI_STYLESETUNDERLINE, %SCE_B_OPERATOR, IIF&(g_tSciColorsAndFonts.UseAlwaysDefaultFont,_
                  g_tSciColorsAndFonts.DefaultFontUnderline, g_tSciColorsAndFonts.OperatorFontUnderline)

         SciMsg pSci, %SCI_STYLESETFORE, %SCE_B_OPERATOR, g_tSciColorsAndFonts.OperatorForeColor
         SciMsg pSci, %SCI_STYLESETCASE, %SCE_B_OPERATOR, EdOpt.DefaultCase

         SciMsg pSci, %SCI_STYLESETSIZE, %SCE_B_OPERATOR, IIF&(g_tSciColorsAndFonts.UseAlwaysDefaultFontSize,_
                  g_tSciColorsAndFonts.DefaultFontSize, g_tSciColorsAndFonts.OperatorFontSize)

         SciMsg pSci, %SCI_STYLESETBACK, %SCE_B_OPERATOR, IIF&(g_tSciColorsAndFonts.UseAlwaysDefaultBackColor,_
                  g_tSciColorsAndFonts.DefaultBackColor, g_tSciColorsAndFonts.OperatorBackColor)

         ' Set the Preprocessor style
         SciMsg pSci, %SCI_STYLESETFONT, %SCE_B_PREPROCESSOR, BYVAL IIF&(g_tSciColorsAndFonts.UseAlwaysDefaultFont,_
                  VARPTR(g_tSciColorsAndFonts.DefaultFontName), VARPTR(g_tSciColorsAndFonts.PreprocessorFontName))
         SCI_SetCharset pSci, %SCE_B_PREPROCESSOR, IIF$(g_tSciColorsAndFonts.UseAlwaysDefaultFont,_
                  g_tSciColorsAndFonts.DefaultFontCharset, g_tSciColorsAndFonts.PreprocessorFontCharset)
         SciMsg pSci, %SCI_STYLESETBOLD, %SCE_B_PREPROCESSOR, IIF&(g_tSciColorsAndFonts.UseAlwaysDefaultFont,_
                  g_tSciColorsAndFonts.DefaultFontBold, g_tSciColorsAndFonts.PreprocessorFontBold)
         SciMsg pSci, %SCI_STYLESETITALIC, %SCE_B_PREPROCESSOR, IIF&(g_tSciColorsAndFonts.UseAlwaysDefaultFont,_
                  g_tSciColorsAndFonts.DefaultFontItalic, g_tSciColorsAndFonts.PreprocessorFontItalic)
         SciMsg pSci, %SCI_STYLESETUNDERLINE, %SCE_B_PREPROCESSOR, IIF&(g_tSciColorsAndFonts.UseAlwaysDefaultFont,_
                  g_tSciColorsAndFonts.DefaultFontUnderline, g_tSciColorsAndFonts.PreprocessorFontUnderline)

         SciMsg pSci, %SCI_STYLESETFORE, %SCE_B_PREPROCESSOR, g_tSciColorsAndFonts.PreprocessorForeColor
         SciMsg pSci, %SCI_STYLESETCASE, %SCE_B_PREPROCESSOR, EdOpt.DefaultCase

         SciMsg pSci, %SCI_STYLESETSIZE, %SCE_B_PREPROCESSOR, IIF&(g_tSciColorsAndFonts.UseAlwaysDefaultFontSize,_
                  g_tSciColorsAndFonts.DefaultFontSize, g_tSciColorsAndFonts.PreprocessorFontSize)

         SciMsg pSci, %SCI_STYLESETBACK, %SCE_B_PREPROCESSOR, IIF&(g_tSciColorsAndFonts.UseAlwaysDefaultBackColor,_
                  g_tSciColorsAndFonts.DefaultBackColor, g_tSciColorsAndFonts.PreprocessorBackColor)

         ' Set the Strings style
         SciMsg pSci, %SCI_STYLESETFONT, %SCE_B_STRING, BYVAL IIF&(g_tSciColorsAndFonts.UseAlwaysDefaultFont,_
                  VARPTR(g_tSciColorsAndFonts.DefaultFontName), VARPTR(g_tSciColorsAndFonts.StringFontName))
         SCI_SetCharset pSci, %SCE_B_STRING, IIF$(g_tSciColorsAndFonts.UseAlwaysDefaultFont,_
                  g_tSciColorsAndFonts.DefaultFontCharset, g_tSciColorsAndFonts.StringFontCharset)
         SciMsg pSci, %SCI_STYLESETBOLD, %SCE_B_STRING, IIF&(g_tSciColorsAndFonts.UseAlwaysDefaultFont,_
                  g_tSciColorsAndFonts.DefaultFontBold, g_tSciColorsAndFonts.StringFontBold)
         SciMsg pSci, %SCI_STYLESETITALIC, %SCE_B_STRING, IIF&(g_tSciColorsAndFonts.UseAlwaysDefaultFont,_
                  g_tSciColorsAndFonts.DefaultFontItalic, g_tSciColorsAndFonts.StringFontItalic)
         SciMsg pSci, %SCI_STYLESETUNDERLINE, %SCE_B_STRING, IIF&(g_tSciColorsAndFonts.UseAlwaysDefaultFont,_
                  g_tSciColorsAndFonts.DefaultFontUnderline, g_tSciColorsAndFonts.StringFontUnderline)

         SciMsg pSci, %SCI_STYLESETFORE, %SCE_B_STRING, g_tSciColorsAndFonts.StringForeColor
         SciMsg pSci, %SCI_STYLESETCASE, %SCE_B_STRING, EdOpt.DefaultCase

         SciMsg pSci, %SCI_STYLESETSIZE, %SCE_B_STRING, IIF&(g_tSciColorsAndFonts.UseAlwaysDefaultFontSize,_
                  g_tSciColorsAndFonts.DefaultFontSize, g_tSciColorsAndFonts.StringFontSize)

         SciMsg pSci, %SCI_STYLESETBACK, %SCE_B_STRING, IIF&(g_tSciColorsAndFonts.UseAlwaysDefaultBackColor,_
                  g_tSciColorsAndFonts.DefaultBackColor, g_tSciColorsAndFonts.StringBackColor)

         ' Set the lexer


If there's any interest, I can upload a SED 2.03 executable containing code enhancements such as
smoother splitting, enhanced text display, total use of direct calls, etc...

Theo Gottwald

#6
Of course there is interest. A friend of mine told me that he had the problem that the background of the Sctintilla was blinking with the cursor on Win 8.1.
I could not see this in my own tests. Do you have an idea where it could come from?
I don't even understand how i could make the background blink with the cursor :-).

Nick Melnick

Theo, that goes on my list of the strangest things I've heard of.
I assume you have Win8 and it works OK for you. First thing that comes
to mind, is that your friend desperately needs a video driver update.

Attached, is the modified SED 2.03 executable. Back up your original exe guys.

Nick Melnick

#8
[EDIT] Fixed options bug
Thought I'd mention that <ctrl+space>  will switch the focus between open split views.
This happens automatically when a window is split.