The Meta-Environment API
00001 #ifndef __ASF_EDITOR_UTILS__ 00002 #define __ASF_EDITOR_UTILS__ 00003 00004 #include <editing.tb> 00005 #include <asf-namespace.h> 00006 00007 process EditEquations(ModuleId: module-id) is 00008 let 00009 AlreadyExists: bool, 00010 Available: bool, 00011 EditorType: term, 00012 Event: attribute-changed-event, 00013 HasAttribute: bool, 00014 Path: str, 00015 Editable: bool, 00016 Sid: session-id, 00017 Tree: term, 00018 Modulename: str 00019 in 00020 EditorType := equations-editor 00021 . GetModulePath(ModuleId, ASF_NAMESPACE, Path?) 00022 . MM-GetAttribute(ModuleId, SDF_NAMESPACE, "name", Modulename?) 00023 . Edit(Path, Sid?) 00024 . 00025 if not-equal(Sid, UNDEFINED) then 00026 EditText(Sid, EditorType, AlreadyExists?) 00027 . snd-msg(te-set-tooltip(Sid, Modulename)) 00028 . snd-msg(equations-editor-started(ModuleId, Sid)) 00029 . 00030 if equal(AlreadyExists, false) then 00031 MM-HasAttribute(ModuleId, ASF_NAMESPACE, "editable", HasAttribute?) 00032 . 00033 if equal(HasAttribute, true) then 00034 MM-GetAttribute(ModuleId, ASF_NAMESPACE, "editable", Editable?) 00035 else 00036 Editable := true 00037 fi 00038 . snd-msg(te-set-editable(Sid, Editable)) 00039 . snd-msg(em-bind-session(Sid, ModuleId)) 00040 . rec-msg(em-session-bound(Sid, ModuleId)) 00041 . GetASFParseTree(ModuleId, Tree?) 00042 . SE-UpdateTree(Sid, Tree) 00043 . MM-Subscribe-Attribute-Changed(ModuleId,ASF_NAMESPACE,"status",available,parsed) 00044 . 00045 ( 00046 MenuSelected(Sid, EditorType) 00047 + 00048 MouseClicked(Sid) 00049 + 00050 rec-msg(te-contents-changed(Sid)) 00051 . MM-SetAttribute(ModuleId, ASF_NAMESPACE, "status", edited) 00052 . RemoveSummaryFor(Path) 00053 + 00054 rec-msg(te-contents-saved(Sid)) 00055 . UpdateTextRepository(Sid) 00056 . MM-SetAttribute(ModuleId, ASF_NAMESPACE, "status", available) 00057 . UpdateEquationsStructure(Sid) 00058 + 00059 rec-note(mm-attribute-changed(Event?)) 00060 . UpdateEquationsStructure(Sid) 00061 ) 00062 * 00063 EditorDisconnected(Sid) 00064 . DeleteSession(Sid) 00065 else 00066 tau 00067 fi 00068 else 00069 tau 00070 fi 00071 endlet 00072 00073 process UpdateEquationsStructure(Sid: session-id) is 00074 let 00075 ModuleId: module-id, 00076 Slices: list, 00077 Tree: term 00078 in 00079 GetModuleId(Sid, ModuleId?) 00080 . GetASFParseTree(ModuleId, Tree?) 00081 . SE-UpdateTree(Sid, Tree) 00082 endlet 00083 00084 #endif /* __ASF_EDITOR_UTILS__ */