Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ TheIDE » U++ TheIDE: CodeEditor, Assist++, Topic++ » Started my second attempt at redesigning CSyntax
Started my second attempt at redesigning CSyntax [message #47828] Fri, 07 April 2017 15:22 Go to next message
cbpporter is currently offline  cbpporter
Messages: 1265
Registered: September 2007
Senior Veteran
The CSyntax class from CodeEditor is good enough for what TheIDE needs and is very close to covering my needs too, but not quite.

Over a year ago I proposed a change but no one was on board. So I forked it and have been using the forked version since.

But it is quite the hassle to update the fork when U++ gets new updates.

So I'm going back to my original proposal, this time more refined, and I will implement it and post it.

I also want to add a dark color scheme to CodeEditor.

U++ comes with Chameleon skins, 2 custom ones, so maybe it is also time to add a standard "dark" skin to U++? It is very "fashionable" these days to have dark GUIs.
Re: Started my second attempt at redesigning CSyntax [message #47880 is a reply to message #47828] Sun, 16 April 2017 13:41 Go to previous messageGo to next message
Klugier is currently offline  Klugier
Messages: 450
Registered: September 2012
Location: Poland, Kraków
Senior Member
Hello,

Some time ago I was thinking about adding theme manager to TheIDE. In my opinion the simplest version would be just adding array ctrl in "Syntax highlight options". In this array we will have the list of themes. Users should be able to edit, import and export such theme. By default TheIDE should bring two themes white (default) and dark.

I am personally "black on white" guy, so this feature is not important for me - but it is something that we should invest. I know that a lot of people likes to code in dark environment.

I am looking forward to your changes in CodeEditor. Do you plan to improve TheIDE as well?

Sincerely,
Klugier


Ultimate++ - one framework to rule them all.

[Updated on: Sun, 16 April 2017 17:57]

Report message to a moderator

Re: Started my second attempt at redesigning CSyntax [message #47884 is a reply to message #47828] Mon, 17 April 2017 17:09 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 2740
Registered: August 2008
Location: Basque Country
Senior Veteran
It is interesting.

A possible addition would be to add the possibility of printing or copying to clipboard in color.


Best regards
Koldo
Re: Started my second attempt at redesigning CSyntax [message #47899 is a reply to message #47880] Thu, 20 April 2017 10:47 Go to previous messageGo to next message
cbpporter is currently offline  cbpporter
Messages: 1265
Registered: September 2007
Senior Veteran
Klugier wrote on Sun, 16 April 2017 14:41
Do you plan to improve TheIDE as well?

No Smile
Re: Started my second attempt at redesigning CSyntax [message #47904 is a reply to message #47899] Thu, 20 April 2017 22:22 Go to previous messageGo to next message
Klugier is currently offline  Klugier
Messages: 450
Registered: September 2012
Location: Poland, Kraków
Senior Member
cbpporter wrote on Thu, 20 April 2017 10:47
Klugier wrote on Sun, 16 April 2017 14:41
Do you plan to improve TheIDE as well?

No Smile


I am, so sad Sad Well, it did not hurt to ask Smile Maybe next time.


Ultimate++ - one framework to rule them all.
Re: Started my second attempt at redesigning CSyntax [message #47905 is a reply to message #47904] Thu, 20 April 2017 22:28 Go to previous messageGo to next message
cbpporter is currently offline  cbpporter
Messages: 1265
Registered: September 2007
Senior Veteran
But I do plan to steal the debugger from TheIDE for my own IDE Smile .

But the current debugger is bad.

So there is a very small chance I can improve it an the changes come back to TheIDE.
Re: Started my second attempt at redesigning CSyntax [message #48169 is a reply to message #47905] Tue, 30 May 2017 11:43 Go to previous messageGo to next message
cbpporter is currently offline  cbpporter
Messages: 1265
Registered: September 2007
Senior Veteran
Sorry, didn't have time before.

But I updated U++ yesterday and my sample CodeEditor test case gets all the CodeEditor::Bar offset wrong, so I must go on an fix this.

But... Ouch...

index.php?t=getfile&id=5300&private=0
  • Attachment: ce8.png
    (Size: 121.13KB, Downloaded 90 times)
Re: Started my second attempt at redesigning CSyntax [message #48173 is a reply to message #48169] Tue, 30 May 2017 13:15 Go to previous messageGo to next message
cbpporter is currently offline  cbpporter
Messages: 1265
Registered: September 2007
Senior Veteran
The first step was to fix the offsets.

I'm still working on the exact pixel sizes, but "ceb1" is before/wrong one and "ceb2" is after/corrected.

I submitted this to redmine before, but the feedback was that I'm using pixel counts and not scaling.

But I'm not sure how to scale up pixel counts.

Let's say in CodeEditor, I have a 6 pixel wide line changed marked, a 12 pixel wide breakpoint icon and 2 pixels of padding.

What and how am I supposed to scale this up?

Should the 6 pixel wide line changed marker be larger than 6 pixels with zoom? Should the icon scale up? The padding?
  • Attachment: ceb1.png
    (Size: 36.34KB, Downloaded 12 times)
Re: Started my second attempt at redesigning CSyntax [message #48174 is a reply to message #48173] Tue, 30 May 2017 13:16 Go to previous messageGo to next message
cbpporter is currently offline  cbpporter
Messages: 1265
Registered: September 2007
Senior Veteran
After image...

Only one attachment/message.
  • Attachment: ceb2.png
    (Size: 28.86KB, Downloaded 10 times)
Re: Started my second attempt at redesigning CSyntax [message #48175 is a reply to message #48174] Tue, 30 May 2017 13:25 Go to previous messageGo to next message
cbpporter is currently offline  cbpporter
Messages: 1265
Registered: September 2007
Senior Veteran
Here is a screenshot with scaling of 150%.

Is this the expected result? Unfortunately, I never bothered with scaling before and am inexperienced...
index.php?t=getfile&id=5303&private=0

  • Attachment: ceb3.png
    (Size: 30.35KB, Downloaded 78 times)
Re: Started my second attempt at redesigning CSyntax [message #48176 is a reply to message #48175] Tue, 30 May 2017 16:12 Go to previous messageGo to next message
cbpporter is currently offline  cbpporter
Messages: 1265
Registered: September 2007
Senior Veteran
So my problem is that CSyntax is a bit too married to a specific languages. If the C++ highlighter covers 90% of what you need and the C# highlighter covers 90% of what you need and if you could selectively merge the two you would get full coverage, you are fine, but you can't. I tried in the past, but the only solution was to fork CodeEditor. I don't want to do that anymore.

So rather than CSyntax knowing that you are doing C++, CSyntax has no idea that it is C++.

I have broken highlight into multiple options:
class CSyntaxOptions {
public:
	int lang = 0;
	
	bool SlashBlockComments = false;
	bool SlashLineComment = false;
	bool PoundLineComment = false;
	bool PoundHexa = false;
	bool DashInId = false;
	bool CapitalizeId = false;
	bool Macros = false;


I'll continue adding options. Using this, you can build your language on the fly: you could highlight a language with capitalized IDs with dashes inside, macros and only pound comments. And you can do this without touching CodeEditor.

But I have on important question:
What is HIGHLIGHT_CALC? The only reason I have "lang" in the structure is to handle HIGHLIGHT_CALC. I don't know what it is, so I can't give it a good name.
Re: Started my second attempt at redesigning CSyntax [message #48190 is a reply to message #48176] Wed, 31 May 2017 14:52 Go to previous messageGo to next message
cbpporter is currently offline  cbpporter
Messages: 1265
Registered: September 2007
Senior Veteran
So, phase one is done.

I maintained current CodeEditor API and capabilities, but completely decoupled highlight options from language.

But beyond the current capabilities, you can also create custom languages:
CSyntaxOptions newLang = CSyntax::GetSyntaxDesc(CSyntax::HIGHLIGHT_CPP);
newLang.SlashBlockComments = false; // remove /* */ comments
newLang.SlashLineComment = false;   // remove // comments
newLang.PoundLineComment = true;    // the new way to comment is #
newLang.DashInId = true;            // still C++, but a-b is a valid identifier
newLang.Keywords << "event";
newLang.MacroList << "beginregion" << "endregion";

RegisterCSyntax("foo", newLang, "*.foo", "Best language");


Other than adding new languages like this, the main use is to allow semantic highlighting: U++ identifiers are no longer static and once per syntax. Each CodeEditor can be assigned a separate derivative syntax descriptor with a different U++ identifier list.

Now comes phase two: adding the new capabilities, in short binary literals, 100'000 numerical identifiers, #region #endregion, some extra colors and customizable macro markers/language.

Two things that I won't add for now but do kind of need are code folding and nested comment highlighting (I tried and failed).
Re: Started my second attempt at redesigning CSyntax [message #48240 is a reply to message #48190] Fri, 09 June 2017 11:36 Go to previous message
cbpporter is currently offline  cbpporter
Messages: 1265
Registered: September 2007
Senior Veteran
Almost done, but I'm facing massive regression with highlighting when compared to my forked CodeEditor.

And I have one major problem: I'm trying to make each editor have a separate name list for highlighting. With the old editor, that list is static and I did a hack: overwrite the static list on each tab change.

Now the list is no longer static, but EditorSyntaxes are created on the fly and I can't make them all point to the same list on creation.
Previous Topic: Infinite loop in Parser
Goto Forum:
  


Current Time: Sun Jun 25 22:54:33 CEST 2017

Total time taken to generate the page: 0.00924 seconds