Skip to content

ATF Code Editor Sample

Gary edited this page Mar 17, 2015 · 4 revisions

Table of Contents

Description

CodeEditor is a code editor that uses the ActiproSoftare SyntaxEditor to provide an editing Control. It provides language syntax sensitive editing for plain text, C#, Lua, Squirrel, Python, XML, COLLADA and Cg files.

For a description of the sample's programming, see Code Editor Programming Discussion.

ATF Features Demonstrated by CodeEditor

  • Use of Managed Extensibility Framework (MEF) to put applications together.
  • Use of the application shell framework, including CommandService, SettingsService, ControlHostService and WindowLayoutService.
  • Use of FileDialogService, StandardFileCommands and StandardFileExitCommand to provide standard menus.
  • Use of PerforceService, SourceControlCommands and SourceControlContext to provide source control.
  • Use of a third party control (ActiproSoftare SyntaxEditor) that conforms to the ISyntaxEditorControl to provide most of the editor functions. See the files in the Atf.SyntaxEditorControl project for more details.

Run CodeEditor

  1. Double-click the CodeEditor.exe in \bin\wws_atf\Release.
  2. A dialog appears with an empty text window.

Menu Options

  • File:
    • New: create a new file of various types using submenus for the language options.
    • Open: open an existing file of various types using submenus for the language options.
    • Save: save the active file.
    • Save As ...: save the active file to a selected path.
    • Save All: save all the open files.
    • Close: close the active file.
    • Source Control: select its various submenu items to perform standard source control operations, such as adding, checking in or out, refreshing files.
    • Recent Files: open a recently opened file.
    • Exit: exit CodeEditor.
  • Edit:
    • Undo and Redo: undo or redo the last editing operation.
    • Cut, Copy, Paste and Delete: performs these editing operations.
    • Find and Replace...: display a Find/Replace dialog with the usual options.
    • Go to: display a dialog to enter a line number to go to.
    • Keyboard Shortcuts: use the Customize Keyboard Shortcuts window to set up keyboard shortcuts.
    • Load or Save Settings: use the Load and Save Settings window to save current CodeEditor application settings or load application settings from a file.
    • Preferences: set application preferences, such as command icon size.
  • Window:
    • Tile Horizontal: tile window panes horizontally.
    • Tile Vertical: tile window panes vertically.
    • Tile Overlapping: overlap window panes horizontally.
    • Layouts:
      • Save Layout As...: associate the current layout with a name.
      • Manage Layouts...: show a list of layouts and manage the list.
    • Lock/Unlock UI Layout: lock or unlock the window layout.
    • List of checked menu items; check to display the corresponding control.
  • Help: its About menu item displays a dialog describing CodeEditor.

Toolbar Options

The toolbar contains buttons for most of the commands in the menus. For instance, all of the various Save commands are available, as well as the Edit commands.

How to Use CodeEditor

Create a new file by clicking File > New > language. Or open an existing file by clicking File > Open > language. Enter text and perform the usual editing operations.

After creating content, you can save it with the various save options under the File menu or toolbar.

CodeEditor Modules

Modules perform these functions:

  • Program.cs: Contains the Main program. It creates a TypeCatalog listing the ATF components used.
  • Editors.cs: Sets up the ActiproSoftare SyntaxEditor control that does the editing. Sets up document clients for the different language types the editor supports.
  • CodeDocument.cs: Defines the CodeDocument class, which implements the IDocument interface. Editors.cs creates a CodeDocument instance for every open document. CodeDocument performs the general document actions such as saving and reading text to and from files.
  • SourceControlContext.cs: Defines the SourceControlContext class, which implements ISourceControlContext. The PerforceService, SourceControlCommands and SourceControlContext components actually do the source control management work.

Topics in this section

Clone this wiki locally