# DRAKON Editor 1.31

DRAKON helps people understand programs.

Some tutorials can be found in the examples folder. Open the .drn files with the DRAKON Editor.

## FAQ

Q: Where is the "Save" button?

A: DRAKON Editor does not have one. It saves your changes as you do them.

Q: How can I scroll the main window?

A: There are several ways to do it: 1. Drag with the mouse wheel pressed. 2. Scroll your mouse wheel (with and without the Shift key pressed). 3. Drag with both mouse keys pressed.

Q: Does DRAKON Editor use a proprietary binary file format?

A: No. DRAKON Editor keeps your data in an Sqlite database file. There are free viewers that can browse and edit such files. See docs/drn_file_format.html for details.

Q: Can I write real programs with DRAKON Editor?

A: Yes! Currently, Java, Processing.org, C#, Plain C, C++, Python, Tcl, Javascript, Lua, Erlang, Verilog and AutoHotkey are supported. Tutorials can be found in the examples/language folders.

Q: Export to PNG does not work and hangs. I hate you!

A: Export to PNG works, but on Windows it is ungodly slow. We apologize. Please do not minimize or place any other windows on top of the DRAKON Editor in the process.

Q: How to change the fonts?

A: To change the screen font, go to File/File properties... and choose the Canvas font.

To change the font in the exported PDF:

1. Put a .ttf file to the fonts folder.
2. Go to File/File properties... and choose the PDF font.

## Installation

DRAKON Editor does not require any installation besides unzipping. It requires, however, tcl to be present on your computer:

- Windows and Mac OS: download and install ActiveTcl 8.6: http://www.activestate.com/activetcl/downloads
- Linux: install the following packages: tcl8.6, tk8.6, tcllib, libsqlite3-tcl, libtk-img.

## Running DRAKON Editor

Windows: double click on the drakon_editor.tcl file.

Linux and Mac OS: run the following command from the terminal:

        ./drakon_editor.tcl

or, to open a specific file:

        ./drakon_editor.tcl [file name]

## Shortcuts

Mac users use Command instead of Control for the following shortcuts.

Action | Shortcut
Canvas
Scroll/pan | Move mouse with the wheel or middle button pressed.
Scroll/pan up and down | Mouse wheel.
Scroll/pan left and right | Shift + Mouse wheel.
Zoom in and out | Control + Mouse wheel.
Editing
Smart mode | Drag items with the mouse when the Shift key is pressed.
Edit text | Double click on text.
Select all | Control + A
Delete selected objects | Del or Backspace
Copy | Control + C
Cut | Control + X
Paste | Control + V
Undo | Control + Z
Redo | Control + Y
Edit diagram description | Control + D
Search
Show/hide search panel | Control + F
Jump to diagram | Control + G
Jump to item | Control + I
Diagram
Verify diagram | Control + R
Generate code | Control + B
Adding items
Action item | A
If item | I
Horizontal line | H
Vertical line | V
Loop start item | L
Loop end item | E
Select item | S
Case item | C
Branch item | B
Address item | D
Insertion item | N
Tidy up | Control + T
Edit text in the selected icon | F2
Edit secondary text | F3
Call hierarchy | Control + E

## drakon_gen.tcl

drakon_gen.tcl is a command-line utility that generates code from a .drn file.

Usage example:

    ./drakon_gen.tcl -in examples/Python/python_demo.drn

This one will generate a file called python_demo.py in examples/Python.

    ./drakon_gen.tcl -in examples/Python/python_demo.drn -out .

This one will generate a file called python_demo.py and put it in the current folder.

In order for code generation to work, the .drn files must have a programming language selected in its properties.

To choose the language for the .drn file, open it in DRAKON Editor, go to File / File properties...

## Wish a feature? Report a bug?

Your feedback is greatly appreciated. Please write to
drakon.editor@gmail.com

## What's new in version 1.31

- State machine methods can now return values.
- State machines were added to the Python code generator.
- C# state machines were rewritten and improved.

## What's new in version 1.30

- Removed "this" keyword from state machine methods in JavaScript. No need to have a machine's reference to call its methods as delegates.
- Added "state machine" to the available diagram types in the Create diagram dialog.

## What's new in version 1.29

- Cleaner state machines for Lua and JavaScript.
- The encoding of output files is UTF-8.
- Language selection from menu: File > Global settings > Language
- UTOPIST tasks in JavaScript code generator.
- Added a generator for nools rules engine.
- DrakonLua and DrakonJs, subsets of Lua and JavaScript with a cleaner and unified syntax.
- Fixed bug with insertion of parallel paths.
- Added -folder -ext options to drakon_gen.

## What's new in version 1.27

- Go language support.
- Nice foreach code generation for Java, C#, Python, Tcl, Lua, D.
- Better boolean short-circuit detection.
- C/C++ code generator does not generate redundant return statements anymore.
- Erlang generator does not emit throw when no default clause is present in a select statement.
- JavaScript code generator: different foreach for objects and arrays.
- Stricter handling of select keyword inside select icon.

## What's new in version 1.26

- Massive improvements to the Erlang code generator: receive statement, select/case macroicon produces "case X of" statement, visual supervision tree.
- A bug fixed in the JavaScript code generator.
- Added a warning before export to PNG.

## What's new in version 1.25

- Syntax highlighting.
- Improvements to the C# state machine generator.

## What's new in version 1.24

- Setting zoom for all diagrams.
- Bug fixes, including a problem with Mac shortcuts, AutoHotkey etc.

## What's new in version 1.23

- Code generation for the AutoHotkey language.
- Code generation for the Verilog language.
- Code generation for state machines (finite automata) in Lua and JavaScript.
- Improvements in the JavaScript generator: better iteration, support for method functions and "closure" namespaces.
- State machines and ERIL support in the code generator for the C language.
- More flexibility added to "Select-Case" icons. It is now possible to put any condition in a "Case" icon, not just a value.
- Other small improvements in code generation for several languages.
- Bug fixes.
- Switch to Tcl/Tk 8.6. It's a major change in system requirements. DRAKON Editor now needs Tcl/Tk 8.6 to run. Tcl/Tk 8.5 is not supported any more.

## What's new in version 1.22

- A bug fix related to inline comment icons in Erlang diagrams.
- The content of the "if" icon in Erlang is not limited to the guard syntax any more.
- State-machine support for Erlang: gen_fsm-based and standalone state-machines.
- D language support.

## What's new in version 1.21

- State-machine (finite automata) support for C# code generation.
- ERIL language support for C# and Tcl code generation. (Entity-relationship and inheritance diagrams.)
- Hyperlinks in text. (Available through context meny, "Links".)
- Minor bug fixes.

## What's new in version 1.20

- Bug fixes.
- Call hierarchy.
- Added support for Processing.org programming language.
- Go to branch within a silhouette diagram.
- The color of icons can be changed.

## What's new in version 1.19

- Automatic width for "If" icons has been reduced. Icons take less diagram space.
- Modal dialogs improved on Linux.

## What's new in version 1.18

- DRAKON Editor now supports the full set of DRAKON icons.
- Uniform spacing rules in the advanced editing mode (with Shift pressed).
- Entity-Relationship diagram type added.
- Canvas can be scrolled with mouse drag when both mouse buttons are pressed.
- Added more shortcuts: F2 edits primary text, F3 edits secondary text.

## What's new in version 1.17

- Code generation: warnings removed for C# and Lua compilers.
- User can now define custome text instead of "YES", "NO" and "End".
- Color themes can be changed from Global settings.
- Icon widths get adjusted automatically for the whole skewer after the text is changed for a single icon.
- Note comments got a better visual style.
- Loop end icons can have text.

## What's new in version 1.15

- Fixed a bug in the code generator.
- Some metaprogramming features for the C language.

## What's new in version 1.14

- Fixed Lua source code generator.
- Double mouse wheel click invokes View / See All.

## What's new in version 1.13

- Code generation for Lua language.

## What's new in version 1.12

- Open/Save file dialogs for .drn files and for export remember the last directory.
- Inserting "if", "branch", "select" and "loop" items made easier.
- Ctrl-X, Ctrl-C, Ctrl-V, Ctrl-A shortcuts fixed for non-English keyboard layouts.
- Added menu items: Edit/Tidy up, Edit/Tidy up all diagrams. The shortcut for Tidy up is Ctrl-T.
- Colors config in scripts/colors.tcl.

## What's new in version 1.11

- Text in Action and Insertion icons is now left-aligned.
- Diagrams now look neat and tidy. The Edit/Adjust icon sizes menu command sets equal width to the icons on the same vertical.
- Fixed the bug about extracting class names in C++.
- Qt support: now you can explicitly mark the diagram as a signal or a slot (see QtC++ folder).

## What's new in version 1.10

- A few minor usability improvements.
- Javascript language support.
- Erlang language support.

## What's new in version 1.9

- Fast insertion of items using keyboard shortcuts.
- The list of previously opened files.
- Custom fonts.
- Java language support.
- C# language support.
- Code generation for Python and Tcl without goto simulation.

## What's new in version 1.8

- The performance of the Smart mode has been significantly improved.

## What's new in version 1.7

- "Smart" editing mode.
  To activate the Smart mode, hold SHIFT while dragging items around on the canvas.
  When you drag an item in the Smart mode, all connected lines and items also move consistently. The diagram structure is preserved.

## What's new in version 1.6

- Fixed a code generation bug (occuring with Insertion icons).
- Resolved Ubuntu 11.x incompatibility issues.

## What's new in version 1.5

- More improvements in the interface:

- If you grab a line by its end and drag, all the connected items will also move.
- The flat list of diagrams has been replaced with a tree.
- "Find all references", "Go to definition", "Jump to diagram", "Jump to item" etc.

- Code generation for:

- Plain C
- C++
- Python 2.x and 3.x
- Tcl

## What's new in version 1.4

- Verification according to the rules of the DRAKON language (DRAKON-1).
- Creation of silhouette diagrams made easier.
- Address icons can be directed towards a branch using the context menu.
- Address icons update their text when the target branch gets renamed.

## What's new in version 1.3

- A massive amount of usability improvements.
- Export to PNG.
- Export to PDF with colors.

## What's new in version 1.2

- Zoom.
- Search.
- Colored icons.
- Many user interface improvements.

## License

DRAKON Editor is PUBLIC DOMAIN except some third-party components (pdf4tcl, Liberation fonts).

## Authors

Stepan Mitkin, Alexander Ilyin, Maas-Maarten Zeeman, Vasil Dyadov, Vasili Bachiashvili.

http://drakon-editor.sourceforge.net/

https://github.com/stepan-mitkin/drakon_editor

drakon.editor@gmail.com

1 August 2018.