Discussions related to Visual Prolog
User avatar
Ferenc Nagy
VIP Member
Posts: 215
Joined: 24 Apr 2007 12:26

My experiences with colorful Scintilla controls

Unread post by Ferenc Nagy »

At first I have to express my acknowledgments to Dominique F. Pannier and Thomas Linder Puls for their valuable answers.
I summarize briefly my results with colorful display using Scintilla controls.

I restricted my problem to monospace fonts inherited from the parent window of the scintilla control.
The kernel of the task is the appending of styled text.

Code: Select all

predicates     % Append styled text to the end of the contents of the control.     appendStyledText:(string Text, sci_style) procedure.   clauses % Append styled text to the end of the contents of the control.     appendStyledText(Text,UsedStyle) :-         styleNumSym(UsedStyle,_Sym),         P1=used_lexer:currentPos,         used_lexer:addText(Text),         used_lexer:startStyling(P1,31), % Wired-in magic constant         used_lexer:setStyling(string::length(Text),UsedStyle),         !.     % Use plain style instead of unregistered style.     appendStyledText(Text,_) :-         styleNumSym(style_plain,_Sym),         appendStyledText(Text,style_plain),         !.     % Restore settings if plain style is missing.     appendStyledText(Text,_) :-         restoreSettings(),         appendStyledText(Text,style_plain).  
The styleNumSym calls serve for checking whether style is defined.
If it is not defined then the plain style is used.
If the plain style is not defined then the default setting are restored.

Dominique's has solved a syntax coloring task. My goal is paint the lines according to their importance. I have defined the following default styles:

Code: Select all

constants     style_plain : sci_style = 0.     style_title : sci_style = 1.     style_table_header : sci_style = 2.     style_table_body : sci_style = 3.     style_table_footer : sci_style = 4.     style_name_and_value  = 5.     style_error  = 6.     style_warning  = 7.
The styles are defined in the following domains and facts:

Code: Select all

domains     color3 = rgb(integer, integer, integer).     lex_style=les(         sci_style,         string Symbol,         color3 ForeGround, color3 Background,         boolean IsBold, boolean IsUnderlined, boolean IsItalic).   class facts - default_settings     default_setting:(lex_style) nondeterm.   clauses     default_setting(les(style_plain,"plain",rgb(0,0,0),rgb(255,255,255),false,false,false)).     default_setting(les(style_title,"title",rgb(0,0,255),rgb(255,255,255),true,false,false)).     default_setting(les(style_table_header,"table header",rgb(0,255,0),rgb(255,255,255),false,true,false)).     default_setting(les(style_table_body,"table body",rgb(0,255,255),rgb(255,255,255),false,false,false)).     default_setting(les(style_table_footer,"table footer",rgb(0,255,0),rgb(255,255,255),false,false,true)).     default_setting(les(style_name_and_value,"name and value",rgb(0,0,255),rgb(255,255,255),false,false,true)).     default_setting(les(style_error,"error",rgb(255,0,0),rgb(255,255,0),true,false,false)).     default_setting(les(style_warning,"warning",rgb(255,0,255),rgb(255,255,0),true,false,false)).
I intend to publish the whole test program.

Image
TIA, Regards,
Frank Nagy
User avatar
Ferenc Nagy
VIP Member
Posts: 215
Joined: 24 Apr 2007 12:26

Lost font properties

Unread post by Ferenc Nagy »

I have lost font size and background colors when I copied some lines from Scintilla (Scilex) control to MSWord. Where and how can I do a lossless copy?
Attachments
Only the foreground colors remained after Copy from Scilex and Paste to Word.
Only the foreground colors remained after Copy from Scilex and Paste to Word.
Copy with loss.PNG (20.57 KiB) Viewed 3082 times
TIA, Regards,
Frank Nagy
Post Reply