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 /// Editors define variable *all-editors* :: = make(); define open abstract primary class () sealed constant slot editor-name :: , required-init-keyword: name:; sealed constant slot editor-title :: , required-init-keyword: title:; end class ; define method find-editor-of-class (class :: subclass()) => (editor :: ) let editor = find-value(*all-editors*, method (e) object-class(e) == class end); editor | error(make()) end method find-editor-of-class; define method register-editor-class (class :: subclass(), #rest initargs) => (editor :: ) let editor = find-value(*all-editors*, method (e) object-class(e) == class end); if (editor) editor else let editor = apply(make, class, initargs); add!(*all-editors*, editor); editor end end method register-editor-class; define method unregister-editor-class (class :: subclass()) => () let editor = find-value(*all-editors*, method (e) object-class(e) == class end); when (editor) remove!(*all-editors*, editor) end end method unregister-editor-class; define variable *current-editor* :: false-or() = #f; define function current-editor () => (editor :: ) *current-editor* | error(make()) end function current-editor; define function current-editor-setter (editor :: ) => (editor :: ) *current-editor* := editor; note-editor-selected(editor); editor end function current-editor-setter; define open generic note-editor-selected (editor :: ) => (); define method note-editor-selected (editor :: ) => () #f end method note-editor-selected; /// Error classes define open abstract class () end class ; define open abstract class (, ) end class ; define open abstract class (, ) end class ; // Nobody has selected an editor to use define sealed class () end class ; define abstract class () sealed constant slot %editor, required-init-keyword: editor:; sealed constant slot %command, required-init-keyword: command:; end class ; // The selected editor doesn't support this command define sealed class (, ) end class ; // The command didn't successfully run define sealed class (, ) end class ;