Module: editor-manager-internals Synopsis: Environment-Editor Interface Author: Scott McKay, Hugh Greene Copyright: Original Code is Copyright (c) 1995-2004 Functional Objects, Inc. All rights reserved. License: Functional Objects Library Public License Version 1.0 Dual-license: GNU Lesser General Public License Warranty: Distributed WITHOUT WARRANTY OF ANY KIND /// Editor commands define open abstract class () sealed each-subclass slot editor-command-title :: false-or() = #f, init-keyword: title:; // For choosing among multiple editor frames... sealed slot editor-command-frame = #f, init-keyword: editor-frame:; end class ; define method make (class :: subclass(), #rest initargs, #key server) => (command :: ) let editor = server | current-editor(); let class = class-for-editor-command(editor, class); if (class) apply(next-method, class, server: editor, initargs) else error(make(, editor: editor, command: class)) end end method make; define open generic class-for-editor-command (editor :: , class :: subclass()) => (class :: false-or(subclass())); define method class-for-editor-command (editor :: , class :: subclass()) => (class == #f) #f end method class-for-editor-command; /// Commands for hacking editor windows define open abstract class () end class ; // Open a new editor window define open abstract class () keyword title: = "Open a new editor window"; end class ; // Close an editor window define open abstract class () keyword title: = "Open an existing editor window"; end class ; /// Commands for hacking files define open abstract class () sealed constant slot editor-command-pathname :: false-or(), required-init-keyword: pathname:; sealed slot editor-command-start-line :: = 0, init-keyword: start-line:; sealed slot editor-command-start-column :: = 0, init-keyword: start-column:; sealed slot editor-command-end-line :: = 0, init-keyword: end-line:; sealed slot editor-command-end-column :: = 0, init-keyword: end-column:; end class ; define method initialize (command :: , #key end-line, end-column) => () unless (end-line) editor-command-end-line(command) := editor-command-start-line(command) end; unless (end-column) editor-command-end-column(command) := editor-command-start-column(command) end; end method initialize; // Open a file within an editor define open abstract class () keyword title: = "Open the given file at the given location"; end class ; // Open a new file within an editor define open abstract class () keyword title: = "Create a new file"; end class ; // Close a file within an editor define open abstract class () keyword title: = "Close the given file"; end class ; // Insert some text define open abstract class () sealed constant slot editor-command-text :: , required-init-keyword: text:; keyword title: = "Insert the given text at the given location"; end class ; // Delete some text define open abstract class () keyword title: = "Delete the given selection"; end class ; /// Commands for hacking projects define open abstract class () sealed constant slot editor-command-project, required-init-keyword: project:; end class ; // Edit a set of definitions define open abstract class () sealed constant slot editor-command-definitions :: , required-init-keyword: definitions:; keyword title: = "Edit the source for the given definitions"; end class ; // Save some files within an editor define open abstract class () sealed constant slot editor-command-pathnames :: = #[], init-keyword: pathnames:; sealed constant slot editor-command-reason :: false-or() = #f, init-keyword: reason:; sealed constant slot editor-command-exit-label :: false-or() = #f, init-keyword: exit-label:; keyword title: = "Save the given files for the given reason"; end class ;