C4DT Editors

Revision as of 11:44, 19 April 2010 by Mortimer (talk | contribs)

Introduction

As of now, you should have created an OpenClonk project and be sitting in front of something that is quite comparable to the original Clonk Editor. On the left side you have the Project Explorer (or on the right side or wherever you like, since all views can be freely arranged in Eclipse). You can use it to navigate packets as you'd do when using the editor.

Unlike the editor though, files are generally openend not it an external program but in a tab in the Eclipse window. You can still set programs to handle specific files by either using the Open With command in the context menu of the Project Explorer or by setting a program in the preferences. The first method works on a file-by-file basis so you could tell Eclipse to open a specific graphics file with Photoshop while opening others with Paint. The second method (Preferences -> General -> Editors -> File Associations) sets a file association for all files of that type.

Eclipse provides different internal editors for different file types. For Clonk-specific files, C4DT adds some more to the list. Among those are a

  • C4Script Editor
  • Landscape.txt Editor
  • Ini Files Editor (DefCore.txt, ActMap.txt etc)

All editors provided by C4DT offer suitable syntax highlighting. Apart from that they include special support for the types of files they were intended for:

  • The C4Script Editor is supposed to help you write scripts more quickly by displaying errors and warnings contained in the script as soon as you save them and offering you a list of identifiers you can insert in specific places. It also tries to make writing properly formatted scripts easier by automatically inserting closing brackets and indenting. In addition to that it also strives to make navigation among and in scripts easier by hyperlinking between them and providing an outline of the script.
  • The Landscape.txt Editor is tailored for editing - surprise! - Landscape.txt files. Sadly, it doesn't offer a live preview on how the generated map would look like so it's probably a good idea to use Mape instead. There are plans to include similar functionality directly in Eclipse though.
  • The Ini Files Editor also includes support for hyperlinks.

Navigation

Navigating to and between scripts quickly is very important. Because of that, C4DT adds several navigation features:

  • Hyperlinks in scripts and ini files: All valid identifiers can be turned into links by pressing Ctrl while hovering over the identifier with your mouse. When you click on them the declaration location of the thing the identifier is referring to will be opened. This works for variables, functions, definitions and also for StringTbl entries ($BlaBla$).
    Identifiers in ini editors can also be turned into hyperlinks.
  • Open Object Dialog: The Open Object dialog can be activated using the Clonk menu in the main menu. As soon as you start typing the dialog starts listing definitions that match the typed text.
  • Going back and forward: When clicking on hyperlinks or navigating to other files by any other means you will always be able to go back to the original file by either pressing Alt+Left or using the yellow arrows in the toolbar.


Getting Content Assistance

When you are editing a script you can invoke a list offering you identifiers to insert. This list is context-sensitive so it will display different options depending on whether the cursor is inside a function or not or whether you are invoking it after having written '->'. The short cut for the Content Assist list is Ctrl+Space but like any other short cut it can be changed in the preferences.