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++ » Questions about CodeEditor
Questions about CodeEditor [message #44738] Thu, 11 June 2015 10:12 Go to next message
cbpporter is currently offline  cbpporter
Messages: 1401
Registered: September 2007
Ultimate Contributor
Hi!

I need a a simple editor with syntax highlighting and I am trying to see if the CodeEditor class could make this task easier.

So far so good, but I can't figure out how to get it to try and highlight syntax using one of the supported cases, like HTML.

Is there an simple way to do it?

And what does the "F" in the top right corner of the package icon for CodeEditor mean?
Re: Questions about CodeEditor [message #44742 is a reply to message #44738] Fri, 12 June 2015 12:24 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
cbpporter wrote on Thu, 11 June 2015 10:12
Hi!

I need a a simple editor with syntax highlighting and I am trying to see if the CodeEditor class could make this task easier.

So far so good, but I can't figure out how to get it to try and highlight syntax using one of the supported cases, like HTML.

Is there an simple way to do it?


Sure. Check SqlCtrl/SqlConsole - it is using CodeEditor to edit SQL statements.

Quote:

And what does the "F" in the top right corner of the package icon for CodeEditor mean?

[/quote]

"FAST" - optimize the whole package for speed (in optimal build).

Mirek
Re: Questions about CodeEditor [message #44744 is a reply to message #44742] Fri, 12 June 2015 13:47 Go to previous messageGo to next message
cbpporter is currently offline  cbpporter
Messages: 1401
Registered: September 2007
Ultimate Contributor
Ahhh, thank you!

Managed to turn on C++ syntax highlighting.

Now I just need to produce a custom highlighter class...
Re: Questions about CodeEditor [message #44746 is a reply to message #44744] Sat, 13 June 2015 07:51 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
I recommend searching for LogSyntax and CreateLogSyntax...
Re: Questions about CodeEditor [message #44751 is a reply to message #44746] Tue, 16 June 2015 10:46 Go to previous messageGo to next message
cbpporter is currently offline  cbpporter
Messages: 1401
Registered: September 2007
Ultimate Contributor
Well I need to highlight something a bit more complex than C#, so I'm basing my class on CSyntax.

But before I need to update the tabbed code editor because it is not behaving correctly.

How are these controls designed?

Are you supposed to keep track of a list of open files with timestamps and cursor position?

I'm thinking of keeping an Array of CodeEditor instances, one per open file, and hiding the one that are not for the active tab.
Re: Questions about CodeEditor [message #44752 is a reply to message #44751] Tue, 16 June 2015 13:25 Go to previous messageGo to next message
cbpporter is currently offline  cbpporter
Messages: 1401
Registered: September 2007
Ultimate Contributor
So I registered my extension using RegisterCSyntax, added a new entry to the enum and added keywords and identifier names with LoadSyntax within CSyntax::InitKeywords() and...

somehow magically all my sources are highlighted with the proper keywords! I have no idea how it matches the registered extension with the keywords set, but I suspect that out of coincidence the indexes all match up...

I wont be able to use CSyntax forever so it ma be time to inherit form it.

And I need to figure out how colors are loaded, because me using code to overwrite colors only works one time because of the ONCELOCK and then when switching tabs the colors are restored to default.
Re: Questions about CodeEditor [message #44771 is a reply to message #44752] Tue, 23 June 2015 18:13 Go to previous messageGo to next message
cbpporter is currently offline  cbpporter
Messages: 1401
Registered: September 2007
Ultimate Contributor
I feel like I need to congratulate you on CodeEditor. It is a very strong and powerful class that has greatly simplified my work. Which isn't surprising in the very least, since U++ components are always good and useful, maybe sometimes not completely intuitive Smile.

I managed to create a minimal yet relatively feature full IDE in 700 lines of code, and this including a custom TreeCtrl::Paint. This IDE does not have the features of a 700 project but of one with thousands of lines of code and this is thanks to CodeEditor! Sure, the code will become larger when I move from enhancing CSyntax to adding a fully new Syntax class for my needs.

This is a slow burning project, but eventually I will need to add things like code browsers, got to/inspect and code completion.

Adding support for life update when changing the using statements (the #include equivalents) will be quite difficult and I'm thinking threads...
Re: Questions about CodeEditor [message #44774 is a reply to message #44771] Tue, 23 June 2015 22:17 Go to previous messageGo to next message
unodgs is currently offline  unodgs
Messages: 1366
Registered: November 2005
Location: Poland
Ultimate Contributor

Could you tell why you create your own ide? Is it suppose to replace theide or it's been created for sth else?
Re: Questions about CodeEditor [message #44775 is a reply to message #44774] Wed, 24 June 2015 08:30 Go to previous messageGo to next message
cbpporter is currently offline  cbpporter
Messages: 1401
Registered: September 2007
Ultimate Contributor
unodgs wrote on Tue, 23 June 2015 23:17
Could you tell why you create your own ide? Is it suppose to replace theide or it's been created for sth else?

Don't worry, it is for a language that does not have an IDE yet Cool.

I can create my standalone IDE using U++ or write an Eclipse plugin.

Guess which one is easier! Smile

[Updated on: Wed, 24 June 2015 08:32]

Report message to a moderator

Re: Questions about CodeEditor [message #44776 is a reply to message #44775] Wed, 24 June 2015 10:33 Go to previous messageGo to next message
unodgs is currently offline  unodgs
Messages: 1366
Registered: November 2005
Location: Poland
Ultimate Contributor

I'm not worried, just curious Smile I hope you'll post some screenshot here when it's ready.
PS: I tried once to write eclipse plugin - never finished, never tried again Wink
Re: Questions about CodeEditor [message #44778 is a reply to message #44776] Wed, 24 June 2015 13:06 Go to previous messageGo to next message
cbpporter is currently offline  cbpporter
Messages: 1401
Registered: September 2007
Ultimate Contributor
Sure, screenshots and eventually opensourced.

The goal of it is not for it to be the greatest IDE ever. It is to offer a relatively high entry standard: not to force people to use random editors and command line, but have a full featured IDE. Eventually someone else might make a better IDE and that's fine!

But until screenshots, it looks like TheIDE Smile. I guess there is no escaping the fact for now Smile.
Re: Questions about CodeEditor [message #44810 is a reply to message #44778] Thu, 02 July 2015 13:02 Go to previous messageGo to next message
cbpporter is currently offline  cbpporter
Messages: 1401
Registered: September 2007
Ultimate Contributor
So I finished my first version of the bare bones IDE and of syntax highlighting.

But there is one more feature I need to add: dynamic class name highlighting.

Currently I'm using the UPPNAME colors to highlight class names, but the list of known classes for each tab is different based on which classes you are using.

I need to find a way to:
1. change the list of classes for each tab based on a scan operation done on tab open
2. find some hooks in CodeEditor that would allow me to determine if a "using" statement has been changed and recolor the current tab efficiently.
Re: Questions about CodeEditor [message #44817 is a reply to message #44810] Thu, 02 July 2015 15:46 Go to previous messageGo to next message
cbpporter is currently offline  cbpporter
Messages: 1401
Registered: September 2007
Ultimate Contributor
BTW, since CodeEditor is capable of highlighting pretty much everything at various qualities, I suppose it is meant to highlight universal external sources, not U++ sources which are mostly C++.

So it needs to be updated to properly handle BOM files, together with saving the BOM bytes on each save if present at load time.

I'm going to try and implement this next.
Re: Questions about CodeEditor [message #44818 is a reply to message #44817] Thu, 02 July 2015 16:20 Go to previous messageGo to next message
cbpporter is currently offline  cbpporter
Messages: 1401
Registered: September 2007
Ultimate Contributor
Another thing I did not manage to figure out: when editing things like .h, pairs of #ifdef #endif are joined together by a vertical blue line.

But if I change the extension of the file, the blue line is no longer shown, but the pseudocomment detailing what macro what closed (// #ifdef foo) still appears.

What controls the decision to render the blue line or not.
Re: Questions about CodeEditor [message #44819 is a reply to message #44817] Thu, 02 July 2015 21:47 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
cbpporter wrote on Thu, 02 July 2015 15:46
BTW, since CodeEditor is capable of highlighting pretty much everything at various qualities, I suppose it is meant to highlight universal external sources, not U++ sources which are mostly C++.

So it needs to be updated to properly handle BOM files, together with saving the BOM bytes on each save if present at load time.

I'm going to try and implement this next.


Actually, there is already RM entry for that #1049
Re: Questions about CodeEditor [message #44820 is a reply to message #44818] Thu, 02 July 2015 21:51 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
cbpporter wrote on Thu, 02 July 2015 16:20
Another thing I did not manage to figure out: when editing things like .h, pairs of #ifdef #endif are joined together by a vertical blue line.

But if I change the extension of the file, the blue line is no longer shown, but the pseudocomment detailing what macro what closed (// #ifdef foo) still appears.

What controls the decision to render the blue line or not.


Unfortunately, this part is hardwired into

EditorBar::Paint(Draw& w)

Sad

(getting CodeEditor ready for client use was not the primary concern when virtualizing highlighting)

Mirek
Re: Questions about CodeEditor [message #44822 is a reply to message #44820] Fri, 03 July 2015 09:49 Go to previous messageGo to next message
cbpporter is currently offline  cbpporter
Messages: 1401
Registered: September 2007
Ultimate Contributor
Ah, found it! Hardcoded highlight. Thanks!

Editor shaping up real good.

Now with those blue bars it is begging for code folding Smile.
Re: Questions about CodeEditor [message #44823 is a reply to message #44822] Fri, 03 July 2015 10:27 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
cbpporter wrote on Fri, 03 July 2015 09:49
Ah, found it! Hardcoded highlight. Thanks!

Editor shaping up real good.

Now with those blue bars it is begging for code folding Smile.


Well... code folding is not out of question if general demand is high...

Mirek
Re: Questions about CodeEditor [message #46751 is a reply to message #44823] Tue, 26 July 2016 09:03 Go to previous message
slashupp is currently offline  slashupp
Messages: 231
Registered: July 2009
Experienced Member
just now spend 10 minutes looking for 'code folding' custom/preference option ...
(after fixing changes I made in wrong function)
it sure would be very handy
would it help if I name myself General Demand, and say I'm high?
Previous Topic: [solved] Next CodeEditor misery: selecting highlighted text colors does not work
Next Topic: [solved] Can we get TabBar::AddFrameToScroolBar
Goto Forum:
  


Current Time: Fri Mar 29 15:05:20 CET 2024

Total time taken to generate the page: 0.02222 seconds