ID:95270
 
This is the first post in a series of component-by-component rundowns of parts of the DMIDE interface, describing what's done, and what we intend to do in the future. This one is on the code editor component. That is, this one:


The editor does, as you'd expect, edity-things. You can edit text just as a standard text control.

It does, however, have a few useful tricks up its sleeve.

For starters, automatic indentation. If you type the following DM code into Dreammaker:
a
b


...and then press Enter, Dreammaker will insert a tab at the next line - you're automatically indented to match the block you're in. DMIDE does this as well.

You can see in the screenshot that DMIDE is a tabbed editor - this is the first point of major difference from Dreammaker. Every time you open a file, you get a new tab at the top of the editor window. Clicking on a tab switches to that file. A * in the tab name indicates that the file has been modified since the last time it was saved or opened.

DMIDE does syntax highlighting, of course, like Dreammaker:


These colours will, in future, be configurable. At the moment you can change them by editing the source, but that's not exactly user friendly.

DMIDE does some tricks with the syntax highlighting that Dreammaker doesn't do. For example:


Unclosed strings get bright red highlighting so that you notice them.

If you've been paying attention, you may have noticed some circles with minus signs in them in the margin on the left. Here's an example with a few more of them:


Whatever could these do? Well, if you click on one:


And if you were to hold down ctrl-shift and click on the margin:


Code folding! You can hide blocks you're not interested in. The folding is entirely based on indent depth.

Syntax highlighting and code folding work on .dmf files, too.

The editor highlights matching brackets and parentheses. It's a subtle effect, but very useful:


Those are the principle features of the code editor. There is some other functionality - highlighting errors with red squigglies, and regex find/replace - that is in the code, but not exposed in the UI.

Future work will likely include the following:
- Exposing error-highlighting and regex find/replace to the UI
- A settings page, for adjusting the colour scheme and other features.
- Calltips and code-completion
In regards to the "Unclosed strings get bright red highlighting so that you notice them." bit - does it do this for things like unclosed parenthesis, brackets, etc.? I remember that being one of the more useful features in notepad++.
That's pretty cool, it's like a modernized DreamMaker.
Alright, you've gone and got me hooked. Now I've got to start following the development of this as well.

Most impressive by the way.
Can't wait to see how this project develops!
Very cool.
Can we get regions and automagic multiline comments for methods like seen in visual studio?
Looks nice, by any chance would future releases include something like .dmi editting?
DivineTraveller wrote:
In regards to the "Unclosed strings get bright red highlighting so that you notice them." bit - does it do this for things like unclosed parenthesis, brackets, etc.? I remember that being one of the more useful features in notepad++.

It's only strings at the moment (and only regular strings, not multiline strings (because it's obvious when those are unclosed)), but there's no reason in-principle why highlighting unmatched brackets/parentheses should be impossible - I thought about the problem after you mentioned it, and there's a reasonably simple algorithm, it just requires a little more bookkeeping than the strings. I'll see about getting that feature in at some point.

Note that it does highlight matching braces/brackets/parentheses, though, which can often make these kinds of mistakes somewhat more obvious.

EDIT: Just double-checked, it actually does highlight unmatched braces/parentheses/brackets the same way Notepad++ does. I hadn't noticed before because the style for 'bad brace highlight' and 'matched brace highlight' are the same.

Madcrackfiend wrote:
Alright, you've gone and got me hooked. Now I've got to start following the development of this as well.

Most impressive by the way.

If you're interested, you can grab the code out of the SVN repository at the Google Code page: http://code.google.com/p/dmide/ and can then run it. You'll need Python 2.6 and a few libraries, however.

Can we get regions and automagic multiline comments for methods like seen in visual studio?

Not sure precisely what you mean by those two features - if you describe 'em in more depth, I can give you an answer.

Looks nice, by any chance would future releases include something like .dmi editting?

There's been a dmi editor for DMIDE in the works for some time now - Skysaw is working on it, mostly. I'm not sure exactly how far progress on it has gotten, but it's definitely an item on the agenda.
Dream Maker 2.0.
Eh, would sure like to use DMIDE, no idea what I must install for it to run on windows, possible to give the names (Possibly Links?) to what I must download in order for it to work?

Got:
Python 2.6
wxPython
Qubic wrote:
Eh, would sure like to use DMIDE, no idea what I must install for it to run on windows, possible to give the names (Possibly Links?) to what I must download in order for it to work?

Got:
Python 2.6
wxPython

Psyco is used to speed up execution of the program - strictly speaking optional, but kind of handy.

I believe PIL used to be used for the in-progress icon editor, but I'm not certain whether that's still the case - I haven't had to set up my computer for DMIDE in a while, and the icon editor really isn't my field. Crashed would know better what's necessary.

If you've checked out DMIDE from the google code repository, try running 'dmide.py' in the top level to get DMIDE running. If it fails, it'll save an error log in that directory which should tell you what's missing.

We really need better instructions for running this.
Not sure if this helps, but I did get an error in the error log, which I have posted below... maybe that helps.



Traceback (most recent call last):
File "D:\DMIDE\dmide.py", line 18, in <module>
from core import sys, os, wx, DMIDE_Window, DMIDE_ArtFactory
File "D:\DMIDE\core\__init__.py", line 8, in <module>
import Image
ImportError: No module named Image

Qubic wrote:
Not sure if this helps, but I did get an error in the error log, which I have posted below... maybe that helps.



Traceback (most recent call last):
File "D:\DMIDE\dmide.py", line 18, in <module>
from core import sys, os, wx, DMIDE_Window, DMIDE_ArtFactory
File "D:\DMIDE\core\__init__.py", line 8, in <module>
import Image
ImportError: No module named Image


Yeah, you're missing some sort of image library. PIL would be my best bet - if you can track down Skyspark or Crashed, they would know better.