On Thu, Oct 04, 2007 at 10:44:48PM +0200, Helge Hafting wrote: > Martin Vermeer wrote: > > On Thu, Oct 04, 2007 at 10:42:35AM +0200, Helge Hafting wrote: > > > >> Richard Heck wrote:
... > >>> 1. There should be an "Invisible" geometry for charstyle insets, in which > >>> they simply draw the text and give no other indication that the text so > >>> drawn is any different from any other text. Invisible should be the > >>> default, unless overridden in the layout file. It should be possible to > >>> toggle this globally. Perhaps mouseover should cause some sort of visible > >>> change, too, to make the insets "discoverable". > >>> > >> How about having insets normally invisible, but having the boundaries > >> appear > >> in some way whenever the cursor goes inside? That way we > >> don't break up reading normally, but we see the boundaries when editing, > >> and that is the time this is necessary. > >> > >> Helge Hafting > >> > > > > Like this? > > > Almost! A text with many charstyles is now much easier to read. > > The only thing I could ask for here, is to see the borders also when > the cursor is right in front of the inset, because the "delete" key > will delete the entire inset if used at that point. That is obvious if > the frame is there, not so if it isn't. The attached tries to do this. The lower corners will be drawn also when the cursor is just in front or behind the inset. Unfortunately this doesn't work right, because of the way LyX renders stuff: if you move the cursor left or right, nothing will get re-rendered. When you move out of/into the inset, re-rendering happens, but when moving from neighbour to non-neighbour position (or the reverse) nothing happens. I see no easy solution to this. Abdel? (BTW there is also a real bug when miving the cursor up or down out of a charstyle inset.) - Martin
Index: InsetCollapsable.cpp =================================================================== --- InsetCollapsable.cpp (revision 20769) +++ InsetCollapsable.cpp (working copy) @@ -289,24 +289,30 @@ const int xx1 = x + TEXT_TO_INSET_OFFSET - 1; const int xx2 = x + textdim.wid - TEXT_TO_INSET_OFFSET + 1; - pi.pain.line(xx1, y + desc - 4, - xx1, y + desc, - layout_.labelfont.color()); - if (internalStatus() == Open) - pi.pain.line(xx1, y + desc, - xx2, y + desc, + Cursor & cur = pi.base.bv->cursor(); + if (geometry() != Corners + || cur.isInside(this) + || cur.nextInset() == this + || cur.prevInset() == this) { + pi.pain.line(xx1, y + desc - 4, + xx1, y + desc, layout_.labelfont.color()); - else { - // Make status_ value visible: - pi.pain.line(xx1, y + desc, - xx1 + 4, y + desc, + if (internalStatus() == Open) + pi.pain.line(xx1, y + desc, + xx2, y + desc, + layout_.labelfont.color()); + else { + // Make status_ value visible: + pi.pain.line(xx1, y + desc, + xx1 + 4, y + desc, + layout_.labelfont.color()); + pi.pain.line(xx2 - 4, y + desc, + xx2, y + desc, + layout_.labelfont.color()); + } + pi.pain.line(x + textdim.wid - 3, y + desc, x + textdim.wid - 3, y + desc - 4, layout_.labelfont.color()); - pi.pain.line(xx2 - 4, y + desc, - xx2, y + desc, - layout_.labelfont.color()); } - pi.pain.line(x + textdim.wid - 3, y + desc, x + textdim.wid - 3, y + desc - 4, - layout_.labelfont.color()); // the label below the text. Can be toggled. if (geometry() == SubLabel) { @@ -326,7 +332,6 @@ } // a visual cue when the cursor is inside the inset - Cursor & cur = pi.base.bv->cursor(); if (cur.isInside(this)) { y -= textdim.asc; y += 3;