On 18/09/2009 09:07, Guenter Milde wrote:
On 2009-09-17, Afief Halumi wrote:

One thing I do miss in Lyx though is the ability to take up my stylus
and draw whatever physical experiment is being explained and having
the drawing automatically appear in lyx.

What I currently do whenever a drawing comes up is the following: start
inkscape, draw, save file(make sure to remember the name), add float,
add image, browse for file, ...

I would appreciate some pointers on how to implement this feature. I
think a simple Qt4 drawing area in a separate window should do for the
interface, and as for saving $filename_files/image$num.png sounds
reasonable.

* You can create a keybinding for "add float, add image" with
   "command-sequence; ..." (the tricky bit is not to insert the image into
   the caption).

* In my view, instead of coding one more crippled drawing editor (which I
   would have to learn to use), a better integration with external editors
   is the way to go. This also allows users the choice between several
   editors and file formats.

* A vector image should be saved in a vector format (e.g. an inkscape
   drawing as *.svg. LyX can work with inkscape's native format.)

* There is the [edit in external editor] menu item available with
   right-click on the image (already pointed out).
   However, currently this will fail with a non-existing file.

Idea:
   enable image generation via the "external edit" feature:

1. The user inserts a graphic with a new file name.
2. LyX shows the box with file name and "file not found!"

3. With right-click and "external edit", LyX should call the associated
    editor with the new file name instead of reporting a missing
    file.¹


¹ Unfortunately, inkscape is "ill behaved" in this respect:
   Most editors (e.g. LyX) open a new buffer and associate it with the
   given file name if called with a non-existing file.
   `inkscape nonexisting.svg` will report an error. This can be worked
   around with a wrapper script:

      if "filename" does not exit:
       copy a template file to "filename"
      call inkscape "filename"

That sounds like a very good idea. You are a long term user and contributor Gunter, why not going the extra step and become a LyX developper? ;-)

Abdel.

Reply via email to