Lazarus

Miscellaneous => Other => Topic started by: john60 on July 03, 2018, 09:25:01 am

Title: Text editor wanted
Post by: john60 on July 03, 2018, 09:25:01 am
I'm not sure of the best place to ask - I hope this is OK

I'm looking for a FPC/Lazarus text editor with some simple code editing features.
Nothing fancy - but must provide full PD source code for me to expand on and
be well annotated or documented.
It should be procedural based making minimal use of objects if it must use any.

If such a thing exists I'd welcome a heads up.
TIA


Title: Re: Text editor wanted
Post by: Handoko on July 03, 2018, 10:07:26 am
Hello john60,
Welcome to the forum.

Have you tried TSynEdit or ATSynEdit? You can use them to create your own editors.
Read more:
http://wiki.freepascal.org/TSynEdit
http://wiki.freepascal.org/ATSynEdit

Users use TSynEdit/ATSynEdit to create many text editors, like:

FreeEdit:
https://forum.lazarus.freepascal.org/index.php/topic,10318.msg50973.html

Mini Edit:
https://github.com/parmaja/miniedit

CudaText:
http://uvviewsoft.com/cudatext/index.html

And these are some others Pascal-written text editors:
http://texteditors.org/cgi-bin/wiki.pl?action=browse&diff=1&id=Qed-Pascal
https://sourceforge.net/projects/filthyeditor/
https://sourceforge.net/projects/gleditor/

As far as I know, all the names mentioned above are free with source code. But it doesn't mean they are in the Public Domain. Make sure you read their license first before you fork them.
Title: Re: Text editor wanted
Post by: Guva on July 03, 2018, 02:55:11 pm
Basic template for creating editor, with tabbed support http://freepascal.ru/forum/viewtopic.php?f=10&t=11265
Title: Re: Text editor wanted
Post by: john60 on July 04, 2018, 11:23:13 am
Hi Handoko

Thanks for the helpful post.
I just took a quick look at leeledumbos freeedt program - that may well be enough
scaffolding to kickstart my own editor so thanks for that. I can't see any copyright messages
so I'll try and contact him.

I did look at synedit but it's really too complex/object based for my use.

This thread went off topic real fast (from my request right into everyone elses favourite editor)
I hope that's not normal on the forum.

Title: Re: Text editor wanted
Post by: marcov on July 04, 2018, 11:47:52 am
You are right, and I'm sorry I participated in that,  being a moderator and all that. I cleaned the thread a bit.

Handoko's answer is fairly complete, it only misses the most basic one, TMemo :-)

The only advanced thing to add I can think of is that there might be some Delphi codebases that use the Scintilla editor DLL that are portable to Lazarus. Most people prefer synedit though, because the stability and bug status of Windows builds of Scintilla seem to constantly change.
Title: Re: Text editor wanted
Post by: fred on July 04, 2018, 11:55:22 am
There is also Notepas https://github.com/beNative/Notepas (https://github.com/beNative/Notepas)
Title: Re: Text editor wanted
Post by: john60 on July 05, 2018, 09:27:37 am
marcov - no problem - it's a tempting subject for people to wade in I guess.

After looking at all the examples I've
decided it's best to start from scratch as my needs are just a little bit
different from the norm anyway.

I was hoping to find something that would help kickstart my editor but
given my constraints It was a bit of a long shot anyway.

Thanks for all the input everyone.
Title: Re: Text editor wanted
Post by: 440bx on July 05, 2018, 12:26:55 pm
I was hoping to find something that would help kickstart my editor but
given my constraints It was a bit of a long shot anyway.

I'm just curious, you mention "constraints", would it be ok to ask what the constraints are ?  while I'm asking questions, what features do you want to have in your editor ?

Thanks
Title: Re: Text editor wanted
Post by: Martin_fr on July 05, 2018, 01:03:25 pm
I'm looking for a FPC/Lazarus text editor with some simple code editing features.
Nothing fancy - but must provide full PD source code for me to expand on and
be well annotated or documented.
It should be procedural based making minimal use of objects if it must use any.

PD or opensource + gpl/mpl/...?

When you say you are looking for an editor that you can modify...
Do you look for:
1 - an editor component, such a TMemo, TSynEdit, ATSynEdit....
  That has no menu, or anything, just the text handling
2 - a app with menu to load/save/copy/paste....

If 2, then does it matter if the component is OO (or otherwise needs experience to read the code)?

There are various editors based on SynEdit/AtSynEdit. They may make a good starting point.

It really depends what feature you want to add.
You may not have to touch the code in SynEdit (And synedit is highly configurable). Though it lacks documentation (there is some doc in Spanish, afaik).
Title: Re: Text editor wanted
Post by: john60 on July 05, 2018, 03:33:34 pm
Just so we're clear - I've decided to build from scratch so this thread is now a conversation rather than request.
(I've spent the morning putting it together and starting the docs so I'm committed)

Sure 440bx - my constraints are that it must eventually be re-written in a new programming language
(and system which I'm still researching for.) That means I want to avoid anything like objects or complex
features such as overloading or data encapsulation or whatever  to make the porting as easy as I can.
(Hence my call for procedural code)
The editor fits into a new IDE. The fewer objects I use the better although I may just use synedit
in the short term to help me create the structure.

In terms of editor features - some standard stuff and other stuff specific to my design.
I may decide to make the IDE open source at some point which is why I'm keen to use lazarus/fpc.





 
Title: Re: Text editor wanted
Post by: john60 on July 05, 2018, 03:40:40 pm
Hi Martin_fr
Quote
There are various editors based on SynEdit/AtSynEdit. They may make a good starting point.
...
It really depends what feature you want to add.
You may not have to touch the code in SynEdit (And synedit is highly configurable). Though it lacks documentation (there is some doc in Spanish, afaik).

I've made a hole to drop a synedit window in for now but as you say - no docs. And I don't have time to waste trawling through
hierarchical code most of which I have no interest in or use for. I was hoping for something more basic - perhaps a very old
pre-delphi editor or something along those lines that would compile without too much effort. It was a long shot but worth a try.


 
Title: Re: Text editor wanted
Post by: Martin_fr on July 05, 2018, 06:12:48 pm
If you have specific questions on SynEdit config/usage, then ask them here.

Some very basic info: http://wiki.lazarus.freepascal.org/SynEdit

Also go into the example folder of your IDE, there are a very few examples.
(there is one for searching in the text, but that example is in svn only / next release / it works with older synedit too though)
Title: Re: Text editor wanted
Post by: 440bx on July 05, 2018, 07:10:23 pm
Hi Martin_fr
Quote
There are various editors based on SynEdit/AtSynEdit. They may make a good starting point.
...
It really depends what feature you want to add.
You may not have to touch the code in SynEdit (And synedit is highly configurable). Though it lacks documentation (there is some doc in Spanish, afaik).

I've made a hole to drop a synedit window in for now but as you say - no docs. And I don't have time to waste trawling through
hierarchical code most of which I have no interest in or use for. I was hoping for something more basic - perhaps a very old
pre-delphi editor or something along those lines that would compile without too much effort. It was a long shot but worth a try.

Hello John60,

Your request reminded me of Turbo Pascal Editor Toolbox which used to be a Borland product way way back.  I found a place where you can download it from (looks legit but, I can't assure anything beyond "looks").  https://winworldpc.com/product/turbo-pascal-toolbox/40 (https://winworldpc.com/product/turbo-pascal-toolbox/40)

I had that software (legally purchased) and was quite pleased with the code.  It has code for 3 or 4 editors of varying abilities, from really simple to one that closely mimicked the one in the Turbo Pascal IDE of the time.

Hopefully that will be helpful to you
Title: Re: Text editor wanted
Post by: Handoko on July 05, 2018, 07:12:05 pm
Hi Martin_fr
Quote
...
It really depends what feature you want to add.
You may not have to touch the code in SynEdit (And synedit is highly configurable). Though it lacks documentation (there is some doc in Spanish, afaik).

I've made a hole to drop a synedit window in for now but as you say - no docs. And I don't have time to waste trawling through...

Using TSynEdit isn't as hard as you think.

I wrote a small program to organize my data. At the beginning it used TMemo, it worked and I was happy with it. I knew TSynEdit and I knew it offers more features than TMemo but I was too lazy to try new things. But I often heard people were talking about TSynEdit or CudaText in this forum. So I decided to try TSynEdit. Not much tutorials can be found. But after some reading and testing the example codes I can find, wow it's not as hard as I thought. Now, I have modified my program to use TSynEdit.

As a programmer you should try anything you can touch and explore any new possibilities. Don't just limit yourself in the area you feel comfort. Well, if the project you're going to build is a commercial app or it's has a deadline, you should use the things you already familiar with. But if it is a hobby-project lack of documentation should not be the reason not to try it.
Title: Re: Text editor wanted
Post by: john60 on July 05, 2018, 10:01:31 pm

hi

440bx - I have to time manage very tightly because of other commitments so I made a start this morning and have a basic working one now (lazarus is good that way)  after a sort. I'll allot another couple of hours over the weekend for this to move it on and finish the basic docs so I'm committed now.

I do wish I'd thought of TP myself though.
I'll take a look at your link anyway - if only to remind me of things I may have forgotten.
   
Title: Re: Text editor wanted
Post by: john60 on July 05, 2018, 10:27:38 pm
hi handoko

It's not difficulty in using it that is the issue - it's the replacement code I'd need to write to replace it.
Since that isn't possible yet (the entire system doesn't exist and won't for some time) I need to
limit the complexity of the environment.
No it's not a hobby software project its an entire system - processor upwards.



 
Title: Re: Text editor wanted
Post by: Martin_fr on July 05, 2018, 11:16:57 pm
Well we still dont know what you aim for as end product (and understandable, you may not be allowed to say...)

Other point you might need to consider. Do you need/prefer:
- a system drawn editor (tmemo)
- a custom drawn editor (synedit)

The first just tells windows (or the OS) to do the job. It is limited to what the OS offers, and functions/look may vary by platform.

SynEdit is highly customizable. It has lots of hooks to add extra code...
If you make a copy of it, then you can also strip a lot of code out.

Btw, there is an other version of SynEdit, that has a different internal design (but I know little about it / I do not even know if it is still maintained, or works with the current Lazarus / I do not think it will be any easier).
http://wiki.lazarus.freepascal.org/SynEdit#SynEdit_2.0_port
Title: Re: Text editor wanted
Post by: john60 on July 06, 2018, 09:27:50 am
martin_fr

I'm sure synedit does whatever you use it for very well - it's only use to me is as a stop-gap
to speed up development. If it had a good VHDL add on that would be useful - for now.

Sure I can tell you what I'm doing - there's no mystery - I'm creating a complete new
computer system from scratch.
I'm using lazarus to create some tools that will run on windows and linux to aid in development
and testing.  Those tools will need converting to the new system at some stage so the
simpler the code the better. That means avoiding anything undocumented or object based where
possible. It also means other things you'd normally just drag and drop are no good to me.
Like I said before - what I'm doing is a little bit different.



   
Title: Re: Text editor wanted
Post by: Martin_fr on July 06, 2018, 11:37:57 am
I'm sure synedit does whatever you use it for very well - it's only use to me is as a stop-gap
to speed up development. If it had a good VHDL add on that would be useful - for now.
You mean a highlighter?
I do not know of any existing one, but there is a tutorial http://wiki.lazarus.freepascal.org/SynEdit_Highlighter
Sample files are in the example folder.

Or you mean word completion? That you need to do yourself, but there is an example (in the example folder) on the completion add on too.

Quote
Those tools will need converting to the new system at some stage so the
simpler the code the better. That means avoiding anything undocumented or object based where
possible. It also means other things you'd normally just drag and drop are no good to me.
Like I said before - what I'm doing is a little bit different.

It depends how different. If the entire cpu/memory arch is different, and you need to change the way memory is accessed, then this will make it very hard.

Also for synedit to work, you need at least a true monospaced font. If you will not have that, then you are in trouble.

As for adapting the OS calls, that should be moderate work.
- IIRC All text drawing is done in one single unit (you may consider looking at 2): textdrawer.pas (you dont need all of it, just some)
- gutters can be removed, if you do not want to port them
- caret is in one place, and can be either system, or custom drawn
- word completion, if used would need to open an extra window
- then need to provide or fake input from the OS (keydown/up/press), mouse, focus

It is quite a list, but the mandatory parts come with any editor.

--------------------
Btw, you may want to look at mse ide too: I don't know how complex their editor is. But mse is all custom drawn (no LCL). Maybe that will be easier to port. No idea.

Title: Re: Text editor wanted
Post by: john60 on July 06, 2018, 04:34:54 pm
VHDL would have been a handy addition but it doesn't matter.
The simple FPC highlighting will do for now.  I may take a look at the do-it yourself highlighter later.
I don't ever use word/code  completion.
By different I do mean very. 
The OS doesn't work the way you're used to any more than the hardware so
"Porting" to the system is porting concepts not code then writing from scratch.
Once again - avoiding bells and whistles is key.

I could use some icons for the buttons though  - is there a freely usable set for that
do you know?
Title: Re: Text editor wanted
Post by: Handoko on July 06, 2018, 04:52:46 pm
It is very easy to find free images from the Internet, but many of them have some license restrictions.

You may try OpenClipart first, it's license is in CC Zero Public Domain:
https://openclipart.org/
Title: Re: Text editor wanted
Post by: john60 on July 07, 2018, 10:08:03 am
Thanks - those are a bit "flowery" for my needs but I found a set by mark james that will do nicely
at http://famfamfam.com/
Title: Re: Text editor wanted
Post by: wp on July 07, 2018, 10:22:15 am
icons8 has a huge collection in various styles: https://icons8.com/icon/new-icons/all. Free, but you must provide an attribution link to their site (https://icons8.com/license/).
Title: Re: Text editor wanted
Post by: M.A.R.C. on June 22, 2019, 08:39:36 am
Oh! I didn't see this discussion before. I have been working on something similar to IDE for an FPGA architecture and using VHDL as language.

This work has near to 10 years. I did use Synedit for the VHDL code editor. See attached images to have a look.
Title: Re: Text editor wanted
Post by: john60 on August 09, 2019, 11:02:42 pm
very nice M.A.R.C.
If you're ever interested in sharing let me know
I'd love to take a closer look.

I use Vivado for VHDL but something a bit "cleaner" has advantages.
I can also see other uses if what I'm seeing is what I think I'm seeing.




Title: Re: Text editor wanted
Post by: Handoko on August 10, 2019, 04:31:06 am
M.A.R.C's SBA Creator is open source, it can be found here:
https://sourceforge.net/projects/sbacreator/
Title: Re: Text editor wanted
Post by: avra on August 10, 2019, 09:05:54 am
M.A.R.C's SBA Creator is open source
I do not see sources of SBA Creator. Only VHDL examples, VHDL libs, and binary setups.

I would be interested if there is source for synthesis part of SBA Creator:
https://bfc64698-a-62cb3a1a-s-sites.googlegroups.com/site/simplebusarchitecture/examples/SBA_Imagen3.png

If it is available somewhere please let me know...
Title: Re: Text editor wanted
Post by: john60 on August 10, 2019, 01:12:10 pm
As you say - Miguel has very generously made this open source (I havnt had time to look yet but)
try here avra:
http://sba.accesus.com/software-tools/sba-creator
Title: Re: Text editor wanted
Post by: valdir.marcos on August 10, 2019, 02:14:38 pm
I would be interested if there is source for synthesis part of SBA Creator:
https://bfc64698-a-62cb3a1a-s-sites.googlegroups.com/site/simplebusarchitecture/examples/SBA_Imagen3.png
Image is attached just to ease the thread reading.
Title: Re: Text editor wanted
Post by: Edson on August 10, 2019, 04:58:23 pm
I'm using lazarus to create some tools that will run on windows and linux to aid in development
and testing.  Those tools will need converting to the new system at some stage so the
simpler the code the better. That means avoiding anything undocumented or object based where
possible.

This remimd me, the compiler I'm creating in Lazarus, to be self-compiled later. Not objects, not advanced features: http://blog.pucp.edu.pe/blog/tito/2019/01/05/crea-tu-propio-compilador-casero-parte-1/
Title: Re: Text editor wanted
Post by: M.A.R.C. on August 11, 2019, 06:16:51 am
very nice M.A.R.C.
If you're ever interested in sharing let me know
I'd love to take a closer look.

I use Vivado for VHDL but something a bit "cleaner" has advantages.
I can also see other uses if what I'm seeing is what I think I'm seeing.

M.A.R.C's SBA Creator is open source, it can be found here:
https://sourceforge.net/projects/sbacreator/

Sorry but the SBA System Creator is not open source, SBA is. We decided to make the tool open only to a reduced number of collaborators in our group. But is free.

The code editor in the SBAcreator is enhanced by Synedit. It has several kinds of highlighters for VHDL, Verilog, TCL, and others, plug-ins support, but I hope to add more useful abilities in the future.

Regards,

M.A.R.C.
Title: Re: Text editor wanted
Post by: avra on August 12, 2019, 09:08:15 am
As you say - Miguel has very generously made this open source (I havnt had time to look yet but)
try here avra:
http://sba.accesus.com/software-tools/sba-creator
I did find that link but as already said, it is only for binary setup, VHDL examples and VHDL libs. No source of Synthesis node like editor.

I would be interested if there is source for synthesis part of SBA Creator:
https://bfc64698-a-62cb3a1a-s-sites.googlegroups.com/site/simplebusarchitecture/examples/SBA_Imagen3.png
Image is attached just to ease the thread reading.
Yes, thanks. That is what I am after. Node like editor for Lazarus.
TinyPortal © 2005-2018