On Sun, 28 Feb 1999, Andre' Poenitz wrote:
> > Joacim> (The bus drivers are on strike in Sweden, so I'm stuck at home
> > Joacim> and have started working on my "vy"-client again -- a vi-like
> > Joacim> mode for LyX using lyxserver -- as a pastime)
> >
> > That's what I'd call a pervert project :)
>
> You call "Being able to type and edit text smoothly" 'pervert'? ;-)
>
> No, seriously, something I miss in LyX are vi keybindings.
> Editing text quickly, finding text quickly, repeating commands
> are a definite plus of any "document processing system"...
I've come to the conclusion that I need guesstimately twice as many
lyxfunctions to do anything serious about it, and the lyxserver interface
is just too slow (inserting one character, x, involves sending
"LYXCMD:vy:insert-self x\n", an overhead of a factor 23 in bandwidth, not
to mention the cpu cycles to parse the string in LyX). Having multiple
clipboard buffers would also make things easier. What I miss most is more
functions for moving to beginnings and ends of higher-level elements like
sentences, headings... And functions for telling if the cursor is at the
end or beginning one, or functions for selecting all of the current word,
sentence, paragraph etc.. I'd be better off with an object that has direct
access to (perhaps a subset of) the objects and methods.
An alternative to lyx-server could be to have one lyxfunction that finds
and loads a module that is linked against the executable, call a function
in the module, handing it pointers to the necessary high-level objects.
(or having a fixed interface that the dynamic object accesses the main
executable through).
Enclosed is a tarball with a few c++ files that I've been experimenting
with lately. The experiment files consists of:
One main.C: the main executable. main knows just about nothing about the
others; all it knows is that they are subclassing an abstract class
defined in:
interface.h: included by main.C and the dynamic objects, defines two
abstract classes: "class Thing" (the dynamic objects), and class Core
(interface to main). The dynamic objects subclasses Thing, and main has
a "class MainCore : public virtual Core"-object that it hands to the
dynamic objects to play with.
SomeThing.C: a simple dynamic object
OtherThing.C: another simple dynamic object that has an extra protected method
called by:
Crocodile.C (ran out on inspiration): yet another dynamic object that
is subclassing and linked against OtherThing and accesses the extra
method defined in the parent.
NoseyThing.C: A nosey dynamic object that is bypassing the interface and
accesses a global function defined in main.C (declared in main.h)
directly.
a couple of .h-files: other.h (for OtherThing.C and Crocodile.C) and main.h
(for main.C and NoseyThing.C
and a makefile.
Needless to say, this is not very portable, and all the binaries must be
built from the same compiler, even if on the same target machine (they are
deliberatly using different naming conventions, even if they were using the
same naming conventions it still wouldn't be a good idea to mix object
files from different c++ compilers). It is however a way to implement
modules, developed by themselves, in LyX.
Having an interface consisting only of `extern "C" ...'-declared functions,
and never pass objects across the interface would make it portable...but
uglier.
The (dyn) objects are instantiated by their "new_Thing" functions defined
in each dyn.obj. sourcefile. (ELF has it's init() and fini(), so I've read,
but I never got it to work :P) It would be nice to connect these to a
"Thing::operator new()", but I have no idea how that is done. (I would need
"new" to take an argument...don't think that's possible. A
"Thing::Thing(string filename)" ...would have to replace its own "this" ?:-P)
Joacim
-
With both feet on the ground, you won't get very far.
-- Loesje
dyn++/...