Re: GNOME::Editor



Martijn van Beers wrote:
> 
> What I have so far is:
> 
> module GNOME {
>   interface Editor {
>     typedef unsigned long FileID;
> 
>     FileID OpenFile (in string path);
>     void SaveFile (in FileID id);
>     void CloseFile (in FileID id);
> 
>     void GotoLine (in FileID id, in unsigned long line);
>     void Scroll (in FileID id, in long nroflines);
>   }

You may want to look at some IDL Tom Tromey posted a loooong time ago
for a suggested editor interface. it was a bit more well thought out,
in that it was set up to let you iterate over various entities such as
words and lines, that the editor knew about. Also, editors were not
limited to being text editors; rather, text editors were a particular
subclass of editors that know about characters, words, lines, etc. 
(One could imagine a graphics editor being based on a similar iteration
interface). A source editor could be a further subclass of a text editor 
which knows about functions, expressions, etc.

Addressing some of the things in this interface specifically, GotoLine
and Scroll seem almost redundant with each other, and would be if there
were a "long CurrentLine(in FileID id);".

Also, using typedef'd longs instead of a proper opaque data type to pass
around files seems odd. Why not have a GNOME::Editor::File abstraction? Or
better yet, GNOME::Editor::Buffer, since text editors can edit more than
just files.

 - Maciej



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]