# Better code navigation, new units/states creation, new ways to open source code for editing, better integration with Lazarus project

**URL:** https://forum.castle-engine.io/t/better-code-navigation-new-units-states-creation-new-ways-to-open-source-code-for-editing-better-integration-with-lazarus-project/319
**Category:** News
**Created:** [April 3, 2021, 1:57am UTC](https://forum.castle-engine.io/t/better-code-navigation-new-units-states-creation-new-ways-to-open-source-code-for-editing-better-integration-with-lazarus-project/319 "2021-04-03T01:57:58Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![michalis](https://forum.castle-engine.io/user_avatar/forum.castle-engine.io/michalis/32/3_2.png) [@michalis](https://forum.castle-engine.io/u/michalis)
#### Post date: [April 3, 2021, 1:57am UTC](https://forum.castle-engine.io/t/better-code-navigation-new-units-states-creation-new-ways-to-open-source-code-for-editing-better-integration-with-lazarus-project/319/1 "2021-04-03T01:57:59Z")

</div>

| [![code_menu](https://castle-engine.io/wp/wp-content/uploads/2021/04/code_menu-200x113.png)](https://castle-engine.io/wp/wp-content/uploads/2021/04/code_menu.png "code\_menu") |
| [![new_state](https://castle-engine.io/wp/wp-content/uploads/2021/04/new_state-200x182.png)](https://castle-engine.io/wp/wp-content/uploads/2021/04/new_state.png "new\_state") |
| [![new_class](https://castle-engine.io/wp/wp-content/uploads/2021/04/new_class-200x134.png)](https://castle-engine.io/wp/wp-content/uploads/2021/04/new_class.png "new\_class") |
| [![new_empty](https://castle-engine.io/wp/wp-content/uploads/2021/04/new_empty-200x103.png)](https://castle-engine.io/wp/wp-content/uploads/2021/04/new_empty.png "new\_empty") |

I’ve done a number of improvements to our [editor](https://castle-engine.io/manual_editor.php) and [build tool](https://github.com/castle-engine/castle-engine/wiki/Build-Tool) to improve the advised organization of a CGE project and allow to comfortably edit Pascal code from CGE editor.

The goal of all these changes is to make editing CGE project easier. We want to turn the combo _“CGE editor + Lazarus”_ into something like _“Unity + Visual Studio”_. CGE editor can manage your project and invoke Lazarus for you to do actual editing of Pascal files. (For those of you that would prefer to use _Emacs_ or _VS Code_ or other editor for Pascal: this is of course coming soon too. First we just want to nail down the Lazarus experience.)

To edit the unit you have now various options:

- In CGE editor: enter the `code/` subdirectory, and double-click on a Pascal unit.

- In CGE editor: use menu item _“Code -\> Edit Unit …”_.

- In CGE editor: press F12 when some design is open. This will open the associated unit.

- In Lazarus: open the project in Lazarus, and open necessary units. All Pascal files found on the search path are automatically part of the LPI project.

Engine and editor changes:

1. All templates and most CGE examples now put the Pascal units in `code/` subdirectory. I found that it is a much better layout than keeping all Pascal files in a top-level directory (that gets “crowded” with files in larger projects).

2. All templates come with an initial `.gitignore` and `README.md` files. You can now push your new project to GitHub / GitLab etc. quicker.

3. New _Code_ menu in the editor, to edit Pascal code:

4. _“Regenerate Program”_ menu item (command-line: `castle-engine generate-program`) now generates also `castleautogenerated.pas` file that does some useful things:

5. When creating a new project, we ask for _Main State Name_. This makes the first state name configurable for _“Empty”_ and _“3D Model Viewer”_ templates.

I also have some small changes to mention, too small to deserve own news post:

1. More useful _“Basic”_ editor tab, it is no longer disjoint from _“Layout”_.

2. Initial log output is now better, with a line like `Platform: Android, OS: Android, CPU: arm (32-bit).`

3. Fixed `src/library/` compilation.
