Making a Blitz Code Editor

BlitzMax Forums/BlitzMax Programming/Making a Blitz Code Editor

Hardcoal(Posted 2013) [#1]
I Think Im going to give a shot making my own Code Editor.
Ill be Glad to get help since I dont know much about This Subject and maybe Im over my head..

Im going to use MaxGuI for that

My Concept will be a type of Flowchart To Code approach

Ill also release my progress exe for review

First Step learning MaxGUI..

Please tell me your opinions.
Then ill see if there is a point..


Brucey(Posted 2013) [#2]
Good luck ! :-)


Jesse(Posted 2013) [#3]
I don't know much about the subject but I think there is a reason why mark went with Qt5 instead of MaxGui for Monkey. I think one of the big problems was with the undo which was giving problems since day one and was do to the way events are handled. I recommend you look at the community source code as well as the official to help you get an idea what you are getting into. I wanted to do something like that a while ago but with my limited knowledge of MaxGui it made it a very slow progress so I gave up on it.

If you decide to do it, I wish you good luck with it.


Derron(Posted 2013) [#4]
For an code editor there might be better alternatives than maxgui.

Just kick brucey's ... aehh just beg brucey to continue his work on the qt wrapper and/or wxmax.

In the case of wxmax you get scintilla which is one of the more famous "textareas with highlighting support".


@Jesse:
Undo support is in all cases and languages a thing you as the code should care for yourself (or use a package which provides support for undo of its components itself). As long as your app recognizes changes (you are typing characters into it...) your app should be able to "undo" that things.
Whether you record "keypresses" or log delta-values etc - is your personal style.

@maxgui itself:
As soon as you want some really custom stuff and stay crossplatform you will not have much fun. Sure you can place some buttons etc but as soon as you want to have a more modern look for your editor you will have to code to much extra components other frameworks just offer already. Sure, they are no "system defaults" (scrollable panels, accordion-panels etc) but users are using such things since years and expect a program to offer such new "defaults".
Do not get me wrong, for simple tools and Single-Document-Editors/Viewers you will find MaxGUI easy to use. As soon as it gets more complex you will like the approach QT/WXWindows provide.

bye
Ron


GfK(Posted 2013) [#5]
About maxgui: what he said. ^^


Jesse(Posted 2013) [#6]
it was not the undo/redo I was emphasizing but the inability of the editor to work correctly as a result of the MaxGui events.


Hardcoal(Posted 2013) [#7]
Just doing my first step on this so the first thing i want to do
is a Window with a Button Written Compile :)

All the rest will see.

QT works in cpp I dont know cpp so... for now I leave it.

Ill go MaxGui for now.

Ok first help. Im trying to drag a button with mouse..
also it seems only to recognize mouse actions when the mouse is over the blitz exe window and not while the mouse is above a maxgui window.


Brucey(Posted 2013) [#8]
Drag a button? You mean like, click on a GUI button and drag with the mouse? What would you expect to happen when you did this - return a move/drag event?


Muttley(Posted 2013) [#9]
@Hardcoal: Good luck. If nothing else it will be a great learning experience!

@Jesse and @Derron:
I coincidently have already written a command stack module which can be used for supporting unlimited (well, until you run out of memory) undo/redo commands, plus recording and playing back macros.

Project page is here: https://bitbucket.org/muttley/muttley.commandstack


Hardcoal(Posted 2013) [#10]
Ok ive spent like 1 hour on my new Editor and soon the release will come.
Dont expect more then Compile,Load And Save buttons
and the price will be 0.0001$ but you dont have to pay it..


Hardcoal(Posted 2013) [#11]
Ok here is the first Version of my Editor

https://www.dropbox.com/s/je8gyvbvf8wtzbp/BMCoder.exe

Ziggy should not be worried at this point. :p..

just put bmk.exe where this BMCoder.exe is and it should work

If ill get some nice words ill have the power to proceed


Derron(Posted 2013) [#12]
I will not test the .exe here but I think "just put bmk.exe where this BMCoder.exe is" will not work for all of us.

a) if you put the bmk.exe somewhere and call it from that directory it will be able to run.
b) but bmk.exe now won't know where the rest of the blitzmax files is located... baemm error

So if it works for you: you surely have blitzmax/bin set in the windows-path-environment-variable (just open a command prompt and enter "bmk" - if it runs, you have set the path). If that is the case, you do not need to copy "bmk.exe" to your editor. Your editor just would have to execute "bmk".

Better and more future proof is to have a variable holding the path to the blitzmax directory.
then just execute "BMPath/bin/bmk.exe" for Win and "BMPath/bin/bmk" for linux etc.
Argh... just have a look how the community edition of the editor does handle that. Then replace the whole Process-Pipeline as it sometimes eat some responses and your editor will not get all (compile) error messages etc. .


bye
Ron


Hardcoal(Posted 2013) [#13]
Thanks Derron.
Its really only my first first steps.
I didnt plan to use BMK this way. Just wanted to show Im doing something.
Tnx for all the advices I will use them in the future.

Making just another editor is not my point.
but i have to pass the first steps first.

for example how do I present the debug window in my editor?

anyone?..


Derron(Posted 2013) [#14]
"debug window" ?

You have to code the window yourself.


bye
Ron


ziggy(Posted 2013) [#15]
You'll have to create a debugger front end, get the debug info from the running application (if possible using threads to avoid the debug pipes i/o operations make your ide irresponsive) and, once all this information is ordered and available, present it using your own interface. I would sugget you to take a look to the MaxIde debugging code.


Hardcoal(Posted 2013) [#16]
Soryy, What I meant Is how do I make the BMK Cmd console output appear inside a maxgui window..

A debugger is another story..


ziggy(Posted 2013) [#17]
Launch the compiler as a process, and read its output using pipes. You can then send the read output directly to any Gui gadget. Take a look at MaxIde.


Hardcoal(Posted 2013) [#18]
tnx ziggy!


matibee(Posted 2013) [#19]
(Currently working On Editor And Type Of GameMaker)


Am I having some kind of fake memory hallucination here, or does the terms of the Blitzmax license forbid this? I'm sure I remember reading that it must not be used to develop other game-dev languages or game-maker type programs (obviously to prevent Blitz being used to develop rival development systems.)

I'm also sure no-one would give a monkey's <-- see what I did there, but nevertheless, licenses are licenses are licenses when all said and done.


ziggy(Posted 2013) [#20]
I supose that if the developed tool requieres BlitzMax, it's ok


Hardcoal(Posted 2013) [#21]
matibee
Tnx for the info.. Didnt know..

Does it makes sense to purchess a software for developing and telling you what to do or not to do!

Anyway I can do what ever I please as long as I dont release anything
that may break the terms

If ill get to the point where Ill need legal permissions
I will ask Blitz Research for that.


Yasha(Posted 2013) [#22]
I don't think that is the case. For a start, wasn't the Leadwerks 2.X series a BlitzMax creation?


Hardcoal(Posted 2013) [#23]
Yasha
I dont know about Leadwerks but still if blitzmax see it self as a serious developing tool
its not right to tell people what type of exe they should create!
GameEditor or what ever..
As long as I dont use any part of blitz file like bmk or whatever
then the EXE result should be my business.

But im very far from this point anyway.
and my first use of an editor will be a personal use.


Derron(Posted 2013) [#24]
@matibee:

did not find your "hallucination" aka "terms".
I found "Blitz says that it needs Internet Explorer 4 installed but I have IE 6!" on the help page but hmm that is ...aehh...funny.

So it seems I do not have to accept something special when buying the product, also there is no licence (I do not remember one) to review before buying.
All things you just are able to read AFTER buying something can be regarded as "nice to read but does not matter" for most European countries.
It is a "surprising limitation" which a normal customer can ignore legally.
--> welcome to problems of globally acting companies.

Even in the case of such terms... think it means: do not "wrap" the compiler into another binary and sell that as custom product (as the mods are mostly "free" now). In the case of an complete game engine run with a lua script (check the forums) it should still be considered legal - there is done enough "custom" work to make it running. If there would be an "gameengine.Run()" single command that one would not be able to sell its tool as there would surely be more than just one version of such tools.


bye
Ron


nitti(Posted 2013) [#25]
I would first get comfortable with blitzmax compiling from the commandline.

then I would look into gtk+ for developing an editor.
then you only need a compile button that runs some terminal command.

in short : I would use an well established opensource language/framework to make a general editor in; one that happens to know how to compile a bmx file.


Hardcoal(Posted 2013) [#26]
hey nitti
Tnx for the advice.
Im just experimenting at this point.
see where it goes.


Yasha(Posted 2013) [#27]
To expand upon nitti's point, if you're serious about making a practical editor, you might want to take a look at the Scintilla editing component. It seems to be pretty much the framework of choice among open source editor developers. IDEal and Notepad++ both use it, apparently.

On the other hand if you want to learn editor coding, it probably provides most of the stuff you wanted to learn about writing for yourself, so in that case you might ignore it.

(Full disclosure: never used it, no idea how complete it is.)


ziggy(Posted 2013) [#28]
Regarding Scintilla, it's a good component, but it's implementation is, IMHO not on pair with the mono.texteditor component.

If you want some advise from a modest editor coder like me, a proper source editor design should separate several areas:
1.- Text rendering component
2.- Source code
3.- Tokenizer --> Lexer --> AST

All of this areas have to be separated, so you don't need to be allocating the whole GUI stuff just to get AST information of a given document that can be used just to provide information for other documents on request (solving intellisense queries, determining datatype members, etc.) A single LEXER can have a collection of SourceCode documents to build a global language framework, then each TextRenderer can take the Lexer and a single Source to display text properly formatted, etc etc etc.

It's not realy an easy development and, if you want to provide a complex AST structure, you end up creating almost 50% of a compiler, specialy if the language has datatype inference and you have to evaluate expression results.

I would suggest you to take a look to the monodevelop source code, as it is very well structured. Other areas of interest would be to examine the scintilla component. It's a performance beast and it's very stable but, in my honest opinion, it does not provide the better class design and it's aging a bit compared to more modern developments.


Hardcoal(Posted 2013) [#29]
First Thanks all for the good advices

Anything that requires to learn another language is too much for me at this point.
Believe me. if ill see im going somewhere with this its another story.
I will release my progress very often which will give me some energy..
also if people will like what I do they I will be glad to join.
My vision is very interesting both on my game editor and on this code editor.
since I find todays code editors very hard to manage for big projects
and i know what I want more or less
it will be very interesting to see what ill get.
I love this part when you experiment and suddenly it hits you!
I love it since its the juice of all Creation.


ziggy(Posted 2013) [#30]
Just out of curiosity, if you want to know more or less how "work" is distributes when you modify something on Jungle Ide,that's how the process is done:



i've tried to explain how information and execution threads are organized. You press the "A" key, and everything is recalculated using the aforementioned flow. That's possible becouse the lexer, source code, and editor component are different components. If you start mixing them on a single class, that's a very good way to fail


Hardcoal(Posted 2013) [#31]
Wow ziggy nice scheme. Certainly may help althow I understand nothing
of it at this point but its clear :)
I dont know what lexer is intellisense provider etc..
Please dont try to explain at this point.
I prefer to encounter problems and ask questions.
but having the big picture is very important.

Any way Ziggy in my editor if you downloaded it
You can notice I put Button "<" and button ">"
This is for what I really miss in your editor
those buttons are Back And forward like in a webbrowser.
I want when I goto a function (like your shift+f2) Pressing backward will return me
to the point I was.
So lets say you are inside a function and the function calls another function
and the another function calls another and so on...
I want to be able by pressing back button to go back to the start of my digging.
Similar to a web browser shortcut pressing.

Also you dont have a play button to execute the last compiled version (without compiling)

This stuff I want in my editor for sure.

Ive updated my progress btw

https://www.dropbox.com/s/je8gyvbvf8wtzbp/BMCoder.exe

Also Ziggy I understand Im suppose to build my own parser for the Text Code
Its not something that comes with blitzmax like bmk right?