Re: CharStyle discussion

2003-12-09 Thread Andre Poenitz
On Mon, Dec 08, 2003 at 02:08:03PM -0500, Kuba Ober wrote:
> Oh yes, then certainly it will work like that. Another way of doing it is 
> instead of having character style insets just have character style flags and 
> have the core do the job. I.e. have "bold on" and "bold off" flags.

This does not work well with user defined styles and we don't have the
memory to associate each individual character with arbitrary data.

Andre'

-- 
Those who desire to give up Freedom in order to gain Security, will not have,
nor do they deserve, either one. (T. Jefferson or B. Franklin or both...)


Re: CharStyle discussion

2003-12-09 Thread Martin Vermeer
On Tue, Dec 09, 2003 at 08:18:34AM +0100, Andre Poenitz spake thusly:
 
> On Mon, Dec 08, 2003 at 02:08:03PM -0500, Kuba Ober wrote:
> > Oh yes, then certainly it will work like that. Another way of doing it is 
> > instead of having character style insets just have character style flags and 
> > have the core do the job. I.e. have "bold on" and "bold off" flags.
> 
> This does not work well with user defined styles and we don't have the
> memory to associate each individual character with arbitrary data.
> 
> Andre'

Actually I don't think that's the way it would be done. I did study
the possibility to implement charstyles as ranges after John wrote his
write-up, and came to the conclusion that indeed it would be doable in
this way using mostly the existing char attribute infrastructure. 

The only thing to store for a character belonging to a charstyle would
be a number pointer to an entry in the textclass'es charstyle list.
(User-definable charstyles would complicate this a little, but not
much.)

In this approach, an LCS would be kept separately from the physical
char attributes, but be merged with them at some suitable point using
the realize() method to get the display font. This means that every
LCS would consist of a bit pattern of physical character attributes.
It would certainly have worked, but LCS's would not be
nestable/overlappable, i.e., a character could only belong to one at a
time. Not a real limitation IMHO.

Still I like the inset approach more.

- Martin



pgp0.pgp
Description: PGP signature


Re: annoying mathed-behaviour (was Re: The current char style UI)

2003-12-09 Thread Martin Vermeer
On Mon, Dec 08, 2003 at 11:40:48AM +0100, Andre Poenitz spake thusly:

> Index: math_cursor.C
> ===
> RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_cursor.C,v
> retrieving revision 1.368
> diff -u -p -r1.368 math_cursor.C
> --- math_cursor.C 1 Nov 2003 15:45:18 -   1.368
> +++ math_cursor.C 8 Dec 2003 10:37:07 -
> @@ -436,8 +436,12 @@ bool MathCursor::backspace()
>   }
>   }
>  
> - --pos();
> - plainErase();
> + if (hasPrevAtom() && prevAtom()->nargs() > 0)
> + left(true);
> + else {
> + --pos();
> + plainErase();
> + }
>   return true;
>  }
>  

Wot?!? That's *six* lines!

(Okokok, only four lines essentially changed.)

Seems to work. Put it in, nice feature.

- Martin

BTW should we have symmetric behaviour? I.e. pressing 'delete' on the
inside of the right of a parentheses pair would 'melt' the pair. But
it seems this is already bound...

Anyway, see attached.

- Martin

Index: math_cursor.C
===
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_cursor.C,v
retrieving revision 1.368
diff -u -p -r1.368 math_cursor.C
--- math_cursor.C   1 Nov 2003 15:45:18 -   1.368
+++ math_cursor.C   9 Dec 2003 08:49:07 -
@@ -462,13 +466,22 @@ bool MathCursor::erase()
if (pos() == size()) {
if (inset()->ncols() == 1 && inset()->nrows() == 1 && depth() == 1 && 
size() == 0)
return false;
-   else{
-   inset()->idxGlue(idx());
+   else {
+   if (inset()->ncols() == 1 && inset()->nrows() == 1)
+   pullArg();
+   else {
+   inset()->idxGlue(idx());
+   }
return true;
}
}
 
-   plainErase();
+   if (hasNextAtom() && nextAtom()->nargs() > 0)
+   right(true);
+   else {
+   plainErase();
+   }
+
return true;
 }
 


pgp0.pgp
Description: PGP signature


Re: annoying mathed-behaviour (was Re: The current char style UI)

2003-12-09 Thread Andre Poenitz
On Tue, Dec 09, 2003 at 11:04:41AM +0200, Martin Vermeer wrote:
> On Mon, Dec 08, 2003 at 11:40:48AM +0100, Andre Poenitz spake thusly:
> 
> > Index: math_cursor.C
> > ===
> > RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_cursor.C,v
> > retrieving revision 1.368
> > diff -u -p -r1.368 math_cursor.C
> > --- math_cursor.C   1 Nov 2003 15:45:18 -   1.368
> > +++ math_cursor.C   8 Dec 2003 10:37:07 -
> > @@ -436,8 +436,12 @@ bool MathCursor::backspace()
> > }
> > }
> >  
> > -   --pos();
> > -   plainErase();
> > +   if (hasPrevAtom() && prevAtom()->nargs() > 0)
> > +   left(true);
> > +   else {
> > +   --pos();
> > +   plainErase();
> > +   }
> > return true;
> >  }
> >  
> 
> Wot?!? That's *six* lines!
> 
> (Okokok, only four lines essentially changed.)

No. Two added. (if & left).

> Seems to work. Put it in, nice feature.
> 
> - Martin
> 
> BTW should we have symmetric behaviour? I.e. pressing 'delete' on the
> inside of the right of a parentheses pair would 'melt' the pair. But
> it seems this is already bound...

bound? What?

Andre'


Re: annoying mathed-behaviour (was Re: The current char style UI)

2003-12-09 Thread Martin Vermeer
On Tue, Dec 09, 2003 at 10:31:51AM +0100, Andre Poenitz spake thusly:
 
> > BTW should we have symmetric behaviour? I.e. pressing 'delete' on the
> > inside of the right of a parentheses pair would 'melt' the pair. But
> > it seems this is already bound...
> 
> bound? What?

To deleting a matrix row if empty. The patch works around that.

- Martin


pgp0.pgp
Description: PGP signature


Correct filenames for TeX picture

2003-12-09 Thread Vitaly Lipatov
I guess we have to convert filenames of any graphics in 7 bit 
clean form like this path does. It resolves problems with 
russian names of files with graphics inserted in LyX.

--- /home/lav/RPM/BUILD/lyx-1.3.3/src/insets/insetgraphics.C
2003-09-30 23:55:18 +0400
+++ src/insets/insetgraphics.C  2003-10-27 01:52:16 +0300
@@ -629,6 +629,7 @@
subst(temp_file, ".", "_"), ext_tmp);
// now we have any_dir_file.ext
temp_file = MakeAbsPath(temp_file, buf->tmppath);
+   temp_file = MakeLatexName(temp_file);
lyxerr[Debug::GRAPHICS]
<< "\tchanged to: " << temp_file << endl;
 

-- 
Lav
Vitaly Lipatov
GNU! ALT Linux Team! LaTeX! LyX!


Thoughts on InsetExternal

2003-12-09 Thread Angus Leeming
Here is my list of things to do with InsetExternal, together with a 
rationale for my preference.

* What should we do if generation of the output file fails? My choice 
is to do nothing. If the external_templates file defines the 
generated latex as '\includegraphics[options]{your_file}' or as 
'\input{your_file}' then the latex compiler will fail to compile the 
file and the user will be notified. Should the user wish to be tricky 
and generate more complex latex then he is still free to do so but is 
on his own.

* InsetGraphics has a 'draft' option that leads to the output 
displaying a box containing the filename. I guess that this is 
generally useful and that InsetExternal should both have a 'draft' 
option and generate appropriate LaTeX itself. Whilst we could output 
\includegraphics[draft]{your_file}, we couldn't output 
\input[draft]{your_file}. Best therefore to have something like 
\fbox{your_file}) Moreover, if 'draft' is set, there is no need to 
convert your_file.ext to some appropriate format.

* Currently, the LyXRC::preview option that can be set from the 
Preferences dialog applies to all insets. I'm of the opinion that 
only mathed should respect this option. All other insets 
(InsetExternal and InsetInclude) state explicitly whether they want a 
preview generated and I think that this should override the LyXRC 
variable. Thoughts? (Presumably this would mean renaming the LyXRC 
variable to preview_math or somesuch.)

* If the user specifies that he'd like to see a preview of the 
external file and if the generation of the preview fails, then he's 
left with an incorrect diagnostic message. The preview code needs 
re-working if this is to be corrected.

-- 
Angus



Re: Compilation failure in checkedwodgets.C with qt 2.3.0

2003-12-09 Thread Jean-Marc Lasgouttes
> "Jean-Marc" == Jean-Marc Lasgouttes <[EMAIL PROTECTED]> writes:

Jean-Marc> I get the following error when compiling:

Angus' fix allowed me to go further, and then I needed the patch below
(already committed) to finish.

The problem now is that with lyx-qt, I get a crash as soon as I try to
create an external inset. The relevant part of the backtrace is

#2  0x0831dde2 in lyx::external::Template::Template (this=0xbfffdcd0, 
[EMAIL PROTECTED])
at ../../../../lyx-devel/src/frontends/controllers/ControlExternal.C:134
#3  0x0824dcd8 in ControlExternal::getTemplate (this=0x852d538, i=-1)
at ../../../../lyx-devel/src/frontends/controllers/ControlExternal.C:134
#4  0x0819b1dc in QExternal::updateTemplate (this=0x8558350)
at ../../../../lyx-devel/src/frontends/qt2/QExternal.C:379
#5  0x0819af84 in QExternal::update_contents (this=0x8558350)
at ../../../../lyx-devel/src/frontends/qt2/QExternal.C:353

Note the id=-1 in #3.

Angus?

JMarc

Index: ChangeLog
===
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/qt2/ChangeLog,v
retrieving revision 1.625
diff -u -p -r1.625 ChangeLog
--- ChangeLog	9 Dec 2003 10:33:55 -	1.625
+++ ChangeLog	9 Dec 2003 13:18:11 -
@@ -1,3 +1,8 @@
+2003-12-09  Jean-Marc Lasgouttes  <[EMAIL PROTECTED]>
+
+	* lengthvalidator.[Ch] (LengthValidator): change the constructor to
+	take a QWidget* instead of QObject*.
+
 2003-12-09  Angus Leeming  <[EMAIL PROTECTED]>
 
 	* checkedwidgets.C (setWarningColor): new function that should
Index: lengthvalidator.C
===
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/qt2/lengthvalidator.C,v
retrieving revision 1.1
diff -u -p -r1.1 lengthvalidator.C
--- lengthvalidator.C	5 Dec 2003 02:49:22 -	1.1
+++ lengthvalidator.C	9 Dec 2003 13:18:11 -
@@ -22,7 +22,7 @@ using lyx::support::isStrDbl;
 using std::string;
 
 
-LengthValidator::LengthValidator(QObject * parent, const char * name)
+LengthValidator::LengthValidator(QWidget * parent, const char * name)
 	: QValidator(parent, name),
 	  no_bottom_(true)
 {}
Index: lengthvalidator.h
===
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/qt2/lengthvalidator.h,v
retrieving revision 1.1
diff -u -p -r1.1 lengthvalidator.h
--- lengthvalidator.h	5 Dec 2003 02:49:22 -	1.1
+++ lengthvalidator.h	9 Dec 2003 13:18:11 -
@@ -20,7 +20,7 @@ class Q_EXPORT LengthValidator : public 
 {
 	Q_OBJECT
 public:
-	LengthValidator(QObject * parent, const char *name = 0);
+	LengthValidator(QWidget * parent, const char *name = 0);
 
 	QValidator::State validate(QString &, int &) const;
 


Re: word-backward/forward in mathed

2003-12-09 Thread Jean-Marc Lasgouttes
> "Andre" == Andre Poenitz <[EMAIL PROTECTED]> writes:

Andre> On Mon, Dec 08, 2003 at 10:12:16AM +0100, Jean-Marc Lasgouttes
Andre> wrote:
>> What word-backward/forward could to is jump over insets instead of
>> entering them. The equivalent of a 'word' in mathed is an inset (a
>> block) IMO.

Andre> It does so already.

What I meant is that it could work like char-backward/forward,
_except_ that it would not enter insets. This means that a 'word' is
an inset.

JMarc


Re: word-backward/forward in mathed

2003-12-09 Thread Christian Ridderström
On Mon, 8 Dec 2003, Andre Poenitz wrote:

> > While on the subject, something's rotten in Denmark.. mathed, since
> > 
> > line-beginning/end
> > 
> > behave the same as
> > 
> > word-backward/forward
> > 
> > as far as I can tell.
> 
> Such things could be proven quickly by looking at the source.

Aha! A challenge, well, AFAIC tell they do the same thing, i.e.
case LFUN_END:
case LFUN_WORDRIGHT:
result = mathcursor->end(sel) ? DispatchResult(true, true) : 
DispatchResult(false, FINISHED_RIGHT);
break;

and

case LFUN_HOME:
case LFUN_WORDLEFT:
result = mathcursor->home(sel) ? DispatchResult(true, true) : 
DispatchResult(true, FINISHED);
break;

> > Both move the cursor to the first or last position 
> > of the mathed box, and this seems pointless to me.
> 
> Better idea?

Some... in the text below, I'll refer to keyboard shortcuts instead of 
LFUNs because it's shorter (for Andre: C-Left = word-backward etc).
Another reason is that this is what the user sees --- I'm looking at 
this from the view of a user, and not from how it is implemented.

Now, since HOME === C-Left, and END === C-Right in MathEd, we have room to 
change the behaviour of either pair without the user loosing functionality.

I started thinking about what kind of movements I would like to get 
for these shortcuts, and unfortunately it's not that obvious... it gets 
really complicated when you realize that math-insets corresponds to much 
more than simple mathematical expressions. One way to go forward here 
would be to start looking at what kind of expressions and movment 
operations are most common etc, but that'll take time...

So, if we want a quick "fix" (it's not like anything *really* is broken,
the mathed-interface works quite nice in general), I'd like to suggest 
that we try the following:

The behaviour of HOME/END seems ok, so let's keep that and find a new 
behaviour for C-Left/Right. My original complaint was that Left/Right 
produces small movements, and C-Left/Right too large movements, so I want 
something in between.

For C-Left/Right, I would like to try something that "skips sub-insets", 
just like S-Left/Right does if the cursor is next to a sub-inset (without 
selecting anything of course). I'll try to illustrate what I'd like using 
an example based on this equation:

a + ( b + c ) + d

where (b+c) is what I call a sub-inset. The equation was created by typing

"a+", M-m (, "b+c", Right, "+d" 

I will use a '|' to indicate the cursor position, so:

a|+ ( b + c ) + d

means that the cursor is just after the first 'a'. I'll use the following 
notation to indicate the cursor position before a movement, the 
shortcut that is used and the desired position aftewards:

a|+ ( b + c ) + d   [Right] a +|( b + c ) + d

Now, pressing C-Right, I'd like this to happen:

a +|( b + c ) + d   [C-Right]   a + ( b + c )|+ d

where the sub-inset '( b + c)' was skipped over. If there is no sub-inset, 
it should go to the end like here:

a + ( b + c )|+ d   [C-Right]   a + ( b + c ) + d|

Going in the other direction, C-Left should move until it has skipped one 
sub-inset or reached the beginning, i.e. like this:

a + ( b + c ) + d|  [C-Left]a +|( b + c ) + d

I hope you can understand what I mean with these examples.

/Christian

-- 
Christian Ridderström   http://www.md.kth.se/~chr




Re: Compilation failure in checkedwodgets.C with qt 2.3.0

2003-12-09 Thread Angus Leeming
Jean-Marc Lasgouttes wrote:
> The problem now is that with lyx-qt, I get a crash as soon as I try
> to create an external inset. The relevant part of the backtrace is

Does the attached cure it?

-- 
AngusIndex: src/frontends/qt2/QExternal.C
===
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/qt2/QExternal.C,v
retrieving revision 1.36
diff -u -p -r1.36 QExternal.C
--- src/frontends/qt2/QExternal.C	8 Dec 2003 13:00:16 -	1.36
+++ src/frontends/qt2/QExternal.C	9 Dec 2003 13:40:30 -
@@ -375,8 +375,8 @@ void QExternal::update_contents()
 
 void QExternal::updateTemplate()
 {
-	external::Template templ =
-		controller().getTemplate(dialog_->externalCO->currentItem());
+	int const item = std::max(0, dialog_->externalCO->currentItem());
+	external::Template templ = controller().getTemplate(item);
 	dialog_->externalTV->setText(toqstr(templ.helpText));
 
 	// Ascertain which (if any) transformations the template supports
@@ -441,8 +441,8 @@ void QExternal::apply()
 	params.filename.set(fromqstr(dialog_->fileED->text()),
 			kernel().bufferFilepath());
 
-	params.settemplate(controller().getTemplate(
-   dialog_->externalCO->currentItem()).lyxName);
+	int const item = std::max(0, dialog_->externalCO->currentItem());
+	params.settemplate(controller().getTemplate(item).lyxName);
 
 	getDisplay(params.display, params.lyxscale,
 		   *dialog_->displayCB, *dialog_->showCO,


Re: CharStyle discussion

2003-12-09 Thread Christian Ridderström
On Mon, 8 Dec 2003, Andre Poenitz wrote:

> On Fri, Dec 05, 2003 at 08:19:16PM +0100, Christian Ridderström wrote:
> > > > You need to fix your window manager? SCNR
> > > 
> > > Indeed. Save a few small changes I use the same configuration as 14
> > > years ago.
> > 
> > ok... and all new WM features since then are just crap? ;)
> 
> Maybe it's just their documentation. 
> 
> For one, I've not yet figured out how to bind e.g.
> 
>  'Ctrl-Left' to 'move mouse cursor one virtual screen to the left'

I'm using Sawfish, and I've got that function bound to S-M-Left.

> and
> 
>  'Alt-Left' to 'move mouse cursor half a virtual screen to the left,
> going to the next screen to the left when necessary'

Sorry, I haven't seen this function though...

> > > It could be made less intrusive like the pink corners of the math boxes
> > > (instead of a 'solid' box...)
> > 
> > Those corners are nice... which reminds me, do you remember that problem 
> > with extra space after the math-inset (the one where the extra space made 
> > you think that there was a real space, and then at the printout you got 
> > stuff like "in this formula C=2you have")
> 
> Yes, I run into this regularly myself. But that's just the usual 2 point
> box space acculmulated by nested boxes...  Maybe going down to 1 would
> help already...

I'm not sure if I was clear enough, but I was worried that we might get 
into similar problems if we put a box around something that's in 
emaphasis for instance.

> > > This holds for a novel or such, but even the random science paper has
> > > structure. And, btw, if you only have flat text you'll never see a box
> > > even with all-boxes.
> > 
> > Now I'm confused... I don't write novels, but I am a book-aholic, and 
> > there's quite often markup (italics, bold etc) even in them. Some modern 
> > novels look awful due to too much markup btw.
> 
> The average novel I read is just flat text with a heading every 20
> pages or so. 
Oh come on, I'm sure you'll find italics more often than every 20 pages ;)
Anyway, to illustrate what I mean, look at this link:
http://www.baen.com/chapters/W29/0671319590___2.htm

The first italic word is in the 4th paragraph, and the next in the 5th, 
and then in the 7th. 

> > Anyway, this markup would show up as boxes wouldn't it?
> 
> Yes.
> 
> > (and thus possibly impede the writer of that text).

Of course, this will only be an example of something annoying if the 
emphasis is highlighted using boxes in LyX. Additionally, any distraction 
is considerably reduced if the box is only shown when the cursor is 
actually inside such a box (when the cursor is outside the emphasized 
text, that text is only shown as in italics).

Somewhat related... if someone says something, like in the 9th paragraph
"Ah, there, Little Bite!"
is this something that would end up as a character style, i.e. as a style
indicating that this is something that is said.

(If it is, then any dialog will be swamped with this kind of character 
style).

> You lost me. If too much markup in a novel annoys you, so why do you
> try to use 'people need lots of markup in novels' as an argument? 

Sorry, I should have said bad typography... the example I was thinking of 
used lots of different fonts AND font sizes - urk!

/Christian

-- 
Christian Ridderström   http://www.md.kth.se/~chr




Re: Compilation failure in checkedwidgets.C with qt 2.3.0

2003-12-09 Thread Jean-Marc Lasgouttes
> "Angus" == Angus Leeming <[EMAIL PROTECTED]> writes:

Angus> Jean-Marc Lasgouttes wrote:
>> The problem now is that with lyx-qt, I get a crash as soon as I try
>> to create an external inset. The relevant part of the backtrace is

Angus> Does the attached cure it?

It cures the crash, but there is still a problem: template popup shows
an empty entry, but the help text is the chess one.

We have to find out why the popup is not initialized correctly,
instead of trying to workaround bad values.

This is with gcc2.96+stlport+qt2.3, BTW.

JMarc


Re: word-backward/forward in mathed

2003-12-09 Thread Christian Ridderström
On Mon, 8 Dec 2003, Andre Poenitz wrote:
>  
> > In fact, even inside \textrm{adsfas asdf asfd} word-backward/forward
> > doesn't work (i.e. go to the next word separated by a space).
> 
> Mathed has almost no idea what a 'word' or a 'space' is.

With the risk of being troublemaker, maybe \textrm{} should induce an 
editing mode that's more like in TextEd? I really like what we have so 
far, i.e. you press C-m and get a text-like inset, where Space works etc.

But icing on the cake would be to have C-Left/Right go to word boundaris 
inside this 'text-inset', and similarly, S-C-Left/Right should select up 
to word boundaries.

Anyway, just a thought.

/Christian

-- 
Christian Ridderström   http://www.md.kth.se/~chr




Re: Thoughts on InsetExternal

2003-12-09 Thread Andre Poenitz
On Tue, Dec 09, 2003 at 12:15:46PM +, Angus Leeming wrote:
> Here is my list of things to do with InsetExternal, together with a 
> rationale for my preference.
> 
> * What should we do if generation of the output file fails? My choice 
> is to do nothing. If the external_templates file defines the 
> generated latex as '\includegraphics[options]{your_file}' or as 
> '\input{your_file}' then the latex compiler will fail to compile the 
> file and the user will be notified. Should the user wish to be tricky 
> and generate more complex latex then he is still free to do so but is 
> on his own.
>
> * InsetGraphics has a 'draft' option that leads to the output 
> displaying a box containing the filename. I guess that this is 
> generally useful and that InsetExternal should both have a 'draft' 
> option and generate appropriate LaTeX itself. Whilst we could output 
> \includegraphics[draft]{your_file}, we couldn't output 
> \input[draft]{your_file}. Best therefore to have something like 
> \fbox{your_file}) Moreover, if 'draft' is set, there is no need to 
> convert your_file.ext to some appropriate format.
> 
> * Currently, the LyXRC::preview option that can be set from the 
> Preferences dialog applies to all insets. I'm of the opinion that 
> only mathed should respect this option. All other insets 
> (InsetExternal and InsetInclude) state explicitly whether they want a 
> preview generated and I think that this should override the LyXRC 
> variable. Thoughts? (Presumably this would mean renaming the LyXRC 
> variable to preview_math or somesuch.)

Everything fine as far as I am concerned.

> * If the user specifies that he'd like to see a preview of the 
> external file and if the generation of the preview fails, then he's 
> left with an incorrect diagnostic message. The preview code needs 
> re-working if this is to be corrected.

Well, minor annoyance...

Andre'


Re: word-backward/forward in mathed

2003-12-09 Thread Andre Poenitz
On Tue, Dec 09, 2003 at 02:28:42PM +0100, Christian Ridderström wrote:
> I will use a '|' to indicate the cursor position, so:
> 
>   a|+ ( b + c ) + d
> 
> means that the cursor is just after the first 'a'. I'll use the following 
> notation to indicate the cursor position before a movement, the 
> shortcut that is used and the desired position aftewards:
> 
>   a|+ ( b + c ) + d   [Right] a +|( b + c ) + d
> 
> Now, pressing C-Right, I'd like this to happen:
> 
> a +|( b + c ) + d   [C-Right]   a + ( b + c )|+ d
> 
> where the sub-inset '( b + c)' was skipped over. If there is no sub-inset, 
> it should go to the end like here:
> 
> a + ( b + c )|+ d   [C-Right]   a + ( b + c ) + d|
> 
> Going in the other direction, C-Left should move until it has skipped one 
> sub-inset or reached the beginning, i.e. like this:
> 
> a + ( b + c ) + d|  [C-Left]a +|( b + c ) + d
> 
> I hope you can understand what I mean with these examples.

I think so. But this requires quite a lot of special code as far as I
can tell with no really predictable results...

Well, as I won't use that feature I should not care too much. So if you
code it up and the result is not overly ugly and you get support for
that feature of one or two other users I would apply that patch.

Andre'


Re: CharStyle discussion

2003-12-09 Thread Andre Poenitz
On Tue, Dec 09, 2003 at 02:46:35PM +0100, Christian Ridderström wrote:
> On Mon, 8 Dec 2003, Andre Poenitz wrote:
> 
> > On Fri, Dec 05, 2003 at 08:19:16PM +0100, Christian Ridderström wrote:
> > > > > You need to fix your window manager? SCNR
> > > > 
> > > > Indeed. Save a few small changes I use the same configuration as 14
> > > > years ago.
> > > 
> > > ok... and all new WM features since then are just crap? ;)
> > 
> > Maybe it's just their documentation. 
> > 
> > For one, I've not yet figured out how to bind e.g.
> > 
> >  'Ctrl-Left' to 'move mouse cursor one virtual screen to the left'
> 
> I'm using Sawfish, and I've got that function bound to S-M-Left.
> 
> > and
> > 
> >  'Alt-Left' to 'move mouse cursor half a virtual screen to the left,
> > going to the next screen to the left when necessary'
> 
> Sorry, I haven't seen this function though...

In Fvwm2 it's:

Key LeftA   M  Scroll -100 +0
Key LeftA   SM CursorMove -1 +0
Key LeftA   C  CursorMove -50 +0

(50 is 'half a screen'). 

Pretty covienient if you use X as an 'xterm multiplexer' with 4 xterms
per virtual screen (or two long ones...)

> > Yes, I run into this regularly myself. But that's just the usual 2 point
> > box space acculmulated by nested boxes...  Maybe going down to 1 would
> > help already...
> 
> I'm not sure if I was clear enough, but I was worried that we might get 
> into similar problems if we put a box around something that's in 
> emaphasis for instance.

Probably. But the pink corners could overlap to the outside instead of
requiring additional space
 
> Anyway, to illustrate what I mean, look at this link:
>   http://www.baen.com/chapters/W29/0671319590___2.htm
> 
> The first italic word is in the 4th paragraph, and the next in the 5th, 
> and then in the 7th. 

So we have less than one box per paragraph. Doesn't sound overly
complicated...

Andre'


Re: word-backward/forward in mathed

2003-12-09 Thread Andre Poenitz
On Tue, Dec 09, 2003 at 02:53:49PM +0100, Christian Ridderström wrote:
> On Mon, 8 Dec 2003, Andre Poenitz wrote:
> >  
> > > In fact, even inside \textrm{adsfas asdf asfd} word-backward/forward
> > > doesn't work (i.e. go to the next word separated by a space).
> > 
> > Mathed has almost no idea what a 'word' or a 'space' is.
> 
> With the risk of being troublemaker, maybe \textrm{} should induce an 
> editing mode that's more like in TextEd? I really like what we have so 
> far, i.e. you press C-m and get a text-like inset, where Space works etc.
> 
> But icing on the cake would be to have C-Left/Right go to word boundaris 
> inside this 'text-inset', and similarly, S-C-Left/Right should select up 
> to word boundaries.
> 
> Anyway, just a thought.

Feel free to implement it.

Btw, i the long run I expect mathed and non-math insets properly
nestable, so we'd have an InsetText in mathed with all its
functionality...

Andre'


Re: Compilation failure in checkedwidgets.C with qt 2.3.0

2003-12-09 Thread Angus Leeming
Jean-Marc Lasgouttes wrote:
> It cures the crash, but there is still a problem: template popup
> shows an empty entry, but the help text is the chess one.
> 
> We have to find out why the popup is not initialized correctly,
> instead of trying to workaround bad values.

Sure. I thought you wanted to try it out...

-- 
Angus



Re: word-backward/forward in mathed

2003-12-09 Thread Christian Ridderström
On Tue, 9 Dec 2003, Andre Poenitz wrote:

> > With the risk of being troublemaker, maybe \textrm{} should induce an 
> > editing mode that's more like in TextEd? I really like what we have so 
> > far, i.e. you press C-m and get a text-like inset, where Space works etc.
> > 
> > But icing on the cake would be to have C-Left/Right go to word boundaris 
> > inside this 'text-inset', and similarly, S-C-Left/Right should select up 
> > to word boundaries.
> > 
> > Anyway, just a thought.
> 
> Feel free to implement it.
> 
> Btw, i the long run I expect mathed and non-math insets properly
> nestable, so we'd have an InsetText in mathed with all its
> functionality...

That' much better, and since I assume the TextInset would automatically 
inherit the "right" behaviour of the keyboard shortcuts. Implementing the 
above would therefore be a waste of time in the long run.

/Christian

-- 
Dr. Christian Ridderström, +46-8-768 39 44   http://www.md.kth.se/~chr



Re: Compilation failure in checkedwidgets.C with qt 2.3.0

2003-12-09 Thread Jean-Marc Lasgouttes
> "Angus" == Angus Leeming <[EMAIL PROTECTED]> writes:

Angus> Jean-Marc Lasgouttes wrote:
>> It cures the crash, but there is still a problem: template popup
>> shows an empty entry, but the help text is the chess one.
>> 
>> We have to find out why the popup is not initialized correctly,
>> instead of trying to workaround bad values.

Angus> Sure. I thought you wanted to try it out...

So, it appears that when I enter QExternal::update_contents(),
params.templatename() is empty. Where is it supposed to get a
reasonable value when creating an inset? I guess it should default to
the first one, or something.

JMarc


Re: Thoughts on InsetExternal

2003-12-09 Thread Angus Leeming
Andre Poenitz wrote:
>> * If the user specifies that he'd like to see a preview of the
>> external file and if the generation of the preview fails, then he's
>> left with an incorrect diagnostic message. The preview code needs
>> re-working if this is to be corrected.
> 
> Well, minor annoyance...

You'd be amazed at how many complaints I used to get (mainly from John 
;-) about the quality of the diagnostic messages output by 
InsetGraphics...

-- 
Angus



Re: Thoughts on InsetExternal

2003-12-09 Thread Andre Poenitz
On Tue, Dec 09, 2003 at 02:22:10PM +, Angus Leeming wrote:
> You'd be amazed at how many complaints I used to get (mainly from John 
> ;-)

Probably not.

Andre'


Re: Compilation failure in checkedwidgets.C with qt 2.3.0

2003-12-09 Thread Angus Leeming
Jean-Marc Lasgouttes wrote:

>> "Angus" == Angus Leeming <[EMAIL PROTECTED]> writes:
> 
> Angus> Jean-Marc Lasgouttes wrote:
>>> It cures the crash, but there is still a problem: template popup
>>> shows an empty entry, but the help text is the chess one.
>>> 
>>> We have to find out why the popup is not initialized correctly,
>>> instead of trying to workaround bad values.
> 
> Angus> Sure. I thought you wanted to try it out...
> 
> So, it appears that when I enter QExternal::update_contents(),
> params.templatename() is empty. Where is it supposed to get a
> reasonable value when creating an inset? I guess it should default
> to the first one, or something.

It should do so. That it doesn't means you've uncovered a bug.

My mental picture of the way forward is to disable the choice of 
template until the user attempts to select a file (either types it in 
or uses "Browse..."). Thereafter, we'd activate the chooser but use a 
'best guess' algorithm to try and deduce the template type from the 
file name. We'll get this wrong sometimes, so allow the user to still 
set the chooser explicitly.

Since the templates often have a list of recognized file extensions, 
we could use that to deduce the template type.

Wa'd'ya think?

-- 
Angus



Re: CharStyle discussion

2003-12-09 Thread Christian Ridderström
On Tue, 9 Dec 2003, Andre Poenitz wrote:

> > > Yes, I run into this regularly myself. But that's just the usual 2 point
> > > box space acculmulated by nested boxes...  Maybe going down to 1 would
> > > help already...
> > 
> > I'm not sure if I was clear enough, but I was worried that we might get 
> > into similar problems if we put a box around something that's in 
> > emaphasis for instance.
> 
> Probably. But the pink corners could overlap to the outside instead of
> requiring additional space

Do you mean that the corners would written 'on top' of the 
surrounding text? (Is that possible using the Qt and Xforms frontend btw?)

> > Anyway, to illustrate what I mean, look at this link:
> > http://www.baen.com/chapters/W29/0671319590___2.htm
> > 
> > The first italic word is in the 4th paragraph, and the next in the 5th, 
> > and then in the 7th. 
> 
> So we have less than one box per paragraph. Doesn't sound overly
> complicated...
> 

Are you trying to be difficult on purpose here?
You ignore the change in magnitude of how often it occurs (once every 20 
pages to a few times per page), and also the case of dialogs? If you are 
dead-set on using boxes, just say so ...

/Christian (getting tired of this thread)

-- 
Dr. Christian Ridderström, +46-8-768 39 44   http://www.md.kth.se/~chr



Re: CharStyle discussion

2003-12-09 Thread Andre Poenitz
On Tue, Dec 09, 2003 at 03:41:47PM +0100, Christian Ridderström wrote:
> On Tue, 9 Dec 2003, Andre Poenitz wrote:
> 
> > > > Yes, I run into this regularly myself. But that's just the usual 2 point
> > > > box space acculmulated by nested boxes...  Maybe going down to 1 would
> > > > help already...
> > > 
> > > I'm not sure if I was clear enough, but I was worried that we might get 
> > > into similar problems if we put a box around something that's in 
> > > emaphasis for instance.
> > 
> > Probably. But the pink corners could overlap to the outside instead of
> > requiring additional space
> 
> Do you mean that the corners would written 'on top' of the 
> surrounding text? (Is that possible using the Qt and Xforms frontend btw?)

This would be a possibility for the boxes containing the cursor.  This
means we wouldn't get this annoying gap. It is currently not possible,
but should not be too hard to implement.

> > > Anyway, to illustrate what I mean, look at this link:
> > >   http://www.baen.com/chapters/W29/0671319590___2.htm
> > > 
> > > The first italic word is in the 4th paragraph, and the next in the 5th, 
> > > and then in the 7th. 
> > 
> > So we have less than one box per paragraph. Doesn't sound overly
> > complicated...
> 
> Are you trying to be difficult on purpose here?

Not at all. The typical novel I read comes on dead trees and does not
have font changes every second paragraph...

> /Christian (getting tired of this thread)

So stop it.

Andre'


books (was Re: CharStyle discussion)

2003-12-09 Thread Christian Ridderström
On Tue, 9 Dec 2003, Andre Poenitz wrote:

> > > > Anyway, to illustrate what I mean, look at this link:
> > > > http://www.baen.com/chapters/W29/0671319590___2.htm
> > > > 
> > > > The first italic word is in the 4th paragraph, and the next in the 5th, 
> > > > and then in the 7th. 
> > > 
> > > So we have less than one box per paragraph. Doesn't sound overly
> > > complicated...
> > 
> > Are you trying to be difficult on purpose here?
> 
> Not at all. The typical novel I read comes on dead trees and does not
> have font changes every second paragraph...

Sigh, IMO you are being very difficult and possibly misunderstanding me 
on purpose. But just in case, the emphasis (italics) that you refer 
to as font changes, occur in the "dead tree" version as well...

The link allows you to read the first few chapters in order to see if you 
want to buy the book or not. It does not contain additional formatting 
compared to the book...

> So stop it.

I have

/Christian (signing off)

-- 
Christian Ridderström   http://www.md.kth.se/~chr




Re: [PATCH] Inset VSpace for tex2lyx

2003-12-09 Thread Georg Baum
Am Montag, 8. Dezember 2003 10:20 schrieb Andre Poenitz:
> On Sat, Dec 06, 2003 at 10:16:01PM +0100, Georg Baum wrote:
> > Comments?
>
> Looks good.

Attached is a rediffed version against current cvs.
Could you please apply this one?

Georg
Index: lib/ChangeLog
===
RCS file: /cvs/lyx/lyx-devel/lib/ChangeLog,v
retrieving revision 1.549
diff -u -p -r1.549 ChangeLog
--- lib/ChangeLog	2003/12/08 15:46:16	1.549
+++ lib/ChangeLog	2003/12/09 19:47:07
@@ -1,3 +1,7 @@
+2003-12-08  Georg Baum  <[EMAIL PROTECTED]>
+
+	* reLyX/syntax.default: add \psfrag and \psfrag*
+
 2003-12-08  Jean-Marc Lasgouttes  <[EMAIL PROTECTED]>
 
 	* CREDITS: add Ronald Florence
Index: lib/reLyX/syntax.default
===
RCS file: /cvs/lyx/lyx-devel/lib/reLyX/syntax.default,v
retrieving revision 1.7
diff -u -p -r1.7 syntax.default
--- lib/reLyX/syntax.default	2003/02/11 13:32:13	1.7
+++ lib/reLyX/syntax.default	2003/12/09 19:47:14
@@ -545,6 +545,8 @@ $$
 \providecommand{}[][]{}
 \providecommand*{}[][]{}
 \ps
+\psfrag{}[][][][]{translate}
+\psfrag*{}[][][][]{translate}
 \pushtabs
 % \put(,){} %picture
 % \qbezier[](,)(,)(,) %picture
Index: src/tex2lyx/ChangeLog
===
RCS file: /cvs/lyx/lyx-devel/src/tex2lyx/ChangeLog,v
retrieving revision 1.42
diff -u -p -r1.42 ChangeLog
--- src/tex2lyx/ChangeLog	2003/11/19 10:35:50	1.42
+++ src/tex2lyx/ChangeLog	2003/12/09 19:47:26
@@ -1,3 +1,9 @@
+2003-12-08  Georg Baum  <[EMAIL PROTECTED]>
+
+	* text.C: Use the new VSpace inset (fixes a bug with added_space top)
+	* text.C: Fix \= in tabbing env again
+	* text.C: Fix invocation of parse_command()
+
 2003-11-18  Georg Baum  <[EMAIL PROTECTED]>
 
 	* tex2lyx.C:
Index: src/tex2lyx/Makefile.am
===
RCS file: /cvs/lyx/lyx-devel/src/tex2lyx/Makefile.am,v
retrieving revision 1.15
diff -u -p -r1.15 Makefile.am
--- src/tex2lyx/Makefile.am	2003/10/17 23:41:14	1.15
+++ src/tex2lyx/Makefile.am	2003/12/09 19:47:26
@@ -18,6 +19,7 @@ BUILT_SOURCES = \
 	FloatList.C \
 	Floating.C \
 	counters.C \
+	lengthcommon.C \
 	lyxlayout.h \
 	lyxlayout.C \
 	lyxtextclass.C \
Index: src/tex2lyx/text.C
===
RCS file: /cvs/lyx/lyx-devel/src/tex2lyx/text.C,v
retrieving revision 1.28
diff -u -p -r1.28 text.C
--- src/tex2lyx/text.C	2003/11/19 10:35:50	1.28
+++ src/tex2lyx/text.C	2003/12/09 19:47:34
@@ -16,6 +16,7 @@
 #include "tex2lyx.h"
 #include "context.h"
 #include "FloatList.h"
+#include "lengthcommon.h"
 #include "support/lstrings.h"
 #include "support/tostr.h"
 #include "support/filetools.h"
@@ -103,45 +104,80 @@ map split_map(string con
 	return res;
 }
 
-// A simple function to translate a latex length to something lyx can
-// understand. Not perfect, but rather best-effort.
-string translate_len(string const & len)
+
+/*!
+ * Split a LaTeX length into value and unit.
+ * The latter can be a real unit like "pt", or a latex length variable
+ * like "\textwidth". The unit may contain additional stuff like glue
+ * lengths, but we don't care, because such lengths are ERT anyway.
+ * \return true if \param value and \param unit are valid.
+ */
+bool splitLatexLength(string const & len, string & value, string & unit)
 {
-	const string::size_type i = len.find_first_not_of(" -0123456789.,");
+	if (len.empty())
+		return false;
+	const string::size_type i = len.find_first_not_of(" -+0123456789.,");
 	//'4,5' is a valid LaTeX length number. Change it to '4.5'
 	string const length = lyx::support::subst(len, ',', '.');
-	// a normal length
-	if (i == string::npos || len[i]  != '\\')
-		return length;
-	double val;
+	if (i == string::npos)
+		return false;
 	if (i == 0) {
-		// We had something like \textwidth without a factor
-		val = 100;
+		if (len[0] == '\\') {
+			// We had something like \textwidth without a factor
+			value = "1.0";
+		} else {
+			return false;
+		}
 	} else {
-		istringstream iss(string(length, 0, i));
-		iss >> val;
-		val = val * 100;
+		value = trim(string(length, 0, i));
 	}
+	if (value == "-")
+		value = "-1.0";
+	// 'cM' is a valid LaTeX length unit. Change it to 'cm'
+	if (lyx::support::contains(len, '\\'))
+		unit = trim(string(len, i));
+	else
+		unit = lyx::support::lowercase(trim(string(len, i)));
+	return true;
+}
+
+
+// A simple function to translate a latex length to something lyx can
+// understand. Not perfect, but rather best-effort.
+string translate_len(string const & length)
+{
+	string unit;
+	string valstring;
+	// If the input is invalid, return what we have.
+	if (!splitLatexLength(length, valstring, unit))
+		return length;
+	// LyX uses percent values
+	double value;
+	istringstream iss(valstring);
+	iss >> value;
+	value *= 100;
 	ostringstream oss;
-	oss << val;
-	string const valstring = oss.str();
-	const string::size

Hmmm. One for JMarc

2003-12-09 Thread Angus Leeming
So, it appears that things have changed siznce qt-2.3.x:

g++ -DHAVE_CONFIG_H -I. -I../../../../src/frontends/qt2 -I../../../src 
-I../../../../src/ -I../../../../src/frontends/ -I../../../../images 
-I/usr/lib/qt3-gcc3.2/include -I../../../../boost 
-I../../../../src/frontends/controllers -I/usr/X11R6/include 
-DQT_CLEAN_NAMESPACE -DQT_GENUINE_STR -DQT_NO_TRANSLATION -g -O 
-fno-exceptions -W -Wall -c 
../../../../src/frontends/qt2/lengthvalidator.C -MT 
lengthvalidator.lo -MD -MP -MF .deps/lengthvalidator.TPlo
../../../../src/frontends/qt2/lengthvalidator.C: In constructor
   `LengthValidator::LengthValidator(QWidget*, const char*)':
../../../../src/frontends/qt2/lengthvalidator.C:28: no matching 
function for
   call to `QValidator::QValidator(QWidget*&, const char*&)'
/usr/lib/qt3-gcc3.2/include/qvalidator.h:64: candidates are:
   QValidator::QValidator(const QValidator&)
/usr/lib/qt3-gcc3.2/include/qvalidator.h:54:
   QValidator::QValidator(QObject*, const char* = 0)
make[5]: *** [lengthvalidator.lo] Error 1

Do we need a bit of #ifdef magic?

-- 
Angus



Re: Hmmm. One for JMarc

2003-12-09 Thread Angus Leeming
Angus Leeming wrote:

> So, it appears that things have changed siznce qt-2.3.x:

> ../../../../src/frontends/qt2/lengthvalidator.C: In constructor
>`LengthValidator::LengthValidator(QWidget*, const char*)':
> ../../../../src/frontends/qt2/lengthvalidator.C:28: no matching
> function for
>call to `QValidator::QValidator(QWidget*&, const char*&)'
> /usr/lib/qt3-gcc3.2/include/qvalidator.h:64: candidates are:
>QValidator::QValidator(const QValidator&)
> /usr/lib/qt3-gcc3.2/include/qvalidator.h:54:
>QValidator::QValidator(QObject*, const char* = 0)
> make[5]: *** [lengthvalidator.lo] Error 1
> 
> Do we need a bit of #ifdef magic?

I'm a bit lost here. QWidget derives from QObject, so why doesn't the 
QValidator constructor accept a QWidget pointer?

class Q_EXPORT QWidget : public QObject, public QPaintDevice {...};

C++-gurus?

Note that this attempt at brute force also fails:
LengthValidator::LengthValidator(QWidget * parent, const char * name)
: QValidator(static_cast(parent), name),
  no_bottom_(true)
{}
../../../../src/frontends/qt2/lengthvalidator.C: In constructor
   `LengthValidator::LengthValidator(QWidget*, const char*)':
../../../../src/frontends/qt2/lengthvalidator.C:26: invalid 
static_cast from
   type `QWidget*' to type `QObject*'


-- 
Angus



Re: Compilation failure in checkedwidgets.C with qt 2.3.0

2003-12-09 Thread Angus Leeming
Jean-Marc Lasgouttes wrote:

>> "Angus" == Angus Leeming <[EMAIL PROTECTED]> writes:
> 
> Angus> Jean-Marc Lasgouttes wrote:
>>> It cures the crash, but there is still a problem: template popup
>>> shows an empty entry, but the help text is the chess one.
>>> 
>>> We have to find out why the popup is not initialized correctly,
>>> instead of trying to workaround bad values.
> 
> Angus> Sure. I thought you wanted to try it out...
> 
> So, it appears that when I enter QExternal::update_contents(),
> params.templatename() is empty.

Either that, or it contains a file name that isn't in the list of 
recognized templates. See the comment in 
ControlExternal::getTemplateNumber.

The question is, is this behaviour useful? I think 'yes', which means 
that the best way to proceed is to add the unrecognized name to the 
combox. Thoughts?

Which doesn't solve your problem, however, because you're using a 
default-constructed params(), right? What is the content of 'data' 
passed here: (please don't bother answering this. I think I've found 
the problem, below).

bool ControlExternal::initialiseParams(string const & data)
{
params_.reset(new InsetExternalParams);
InsetExternalMailer::string2params(data, kernel().buf
fer(), *params_);
return true;
}

> Where is it supposed to get a
> reasonable value when creating an inset? 

I guess that it should go in here, in LyXFunc::dispatch (but doesn't).

case LFUN_DIALOG_SHOW_NEW_INSET: {
string const & name = argument;
string data;
if (name == "bibitem" ||
name == "bibtex" ||
name == "include" ||
name == "index" ||
name == "ref" ||
name == "toc" ||
name == "url") {
InsetCommandParams p(name);
data = InsetCommandMailer::params2string(name, p);
} else if (name == "citation") {
InsetCommandParams p("cite");
data = InsetCommandMailer::params2string(name, p);
} else if (name == "vspace") {
VSpace space;
data = InsetVSpaceMailer::params2string(space);
}
owner->getDialogs().show(name, data, 0);
break;
}

Adding
} else if (name == "external") {
InsetExternalParams p;
Buffer const & buffer = *owner->buffer();
data = InsetExternalMailer::params2string(p, buffer);

Fixes things for me. I guess that all the 'insets-with-dialogs' need 
to be added to this block.

> I guess it should default to the first one, or something.

See my question about an unrecognized template, above.

-- 
Angus



EDITABLE

2003-12-09 Thread Michael Schmitt
Just a short question (and hopefully also a short answer):

  What is the difference between a noneditable, and editable,
  and a highly editable inset?
Please enlighten me,

Michael



[patch] selection

2003-12-09 Thread Alfredo Braunstein
this patch reworks selection handling a bit:

- eliminates TextCursor::selection::start/end, in favour of
TextCursor::selStart()/selEnd(), that compute the start and end of the
selection on the fly from cursor and selection.cursor.

- moves xsel_cache to Bufferview (only the one in the top LyXText was used)

- cleans up calling code a bit.

Comments?

Alfredo
Index: BufferView.C
===
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/BufferView.C,v
retrieving revision 1.213
diff -u -r1.213 BufferView.C
--- BufferView.C	1 Dec 2003 13:35:36 -	1.213
+++ BufferView.C	10 Dec 2003 05:46:19 -
@@ -68,6 +68,12 @@
 }
 
 
+void BufferView::unsetXSel()
+{
+	pimpl_->xsel_cache_.set = false;
+}
+
+
 Buffer * BufferView::buffer() const
 {
 	return pimpl_->buffer_;
Index: BufferView.h
===
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/BufferView.h,v
retrieving revision 1.154
diff -u -r1.154 BufferView.h
--- BufferView.h	28 Nov 2003 15:08:36 -	1.154
+++ BufferView.h	10 Dec 2003 05:46:20 -
@@ -182,6 +182,9 @@
 	/// return target x position of cursor
 	int x_target() const;
 
+	/// clear the X selection
+	void unsetXSel();
+
 	/// access to cursor
 	LCursor & cursor();
 	/// access to cursor
Index: BufferView_pimpl.C
===
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/BufferView_pimpl.C,v
retrieving revision 1.473
diff -u -r1.473 BufferView_pimpl.C
--- BufferView_pimpl.C	2 Dec 2003 10:51:57 -	1.473
+++ BufferView_pimpl.C	10 Dec 2003 05:46:22 -
@@ -390,10 +390,10 @@
 
 	par = bv_->text()->cursor.par();
 	pos = bv_->text()->cursor.pos();
-	selstartpar = bv_->text()->selection.start.par();
-	selstartpos = bv_->text()->selection.start.pos();
-	selendpar = bv_->text()->selection.end.par();
-	selendpos = bv_->text()->selection.end.pos();
+	selstartpar = bv_->text()->selStart().par();
+	selstartpos = bv_->text()->selStart().pos();
+	selendpar = bv_->text()->selEnd().par();
+	selendpos = bv_->text()->selEnd().pos();
 	selection = bv_->text()->selection.set();
 	mark_set = bv_->text()->selection.mark();
 	bv_->text()->textwidth_ = bv_->workWidth();
@@ -526,20 +526,22 @@
 
 	LyXText * text = bv_->getLyXText();
 
-	if (text->selection.set() &&
-		(!bv_->text()->xsel_cache.set() ||
-		 text->selection.start != bv_->text()->xsel_cache.start ||
-		 text->selection.end != bv_->text()->xsel_cache.end))
+	if (!text->selection.set()) {
+		xsel_cache_.set = false;
+		return;
+	}
+
+	if (!xsel_cache_.set ||
+	text->cursor != xsel_cache_.cursor ||
+	text->selection.cursor != xsel_cache_.selection_cursor)
 	{
-		bv_->text()->xsel_cache = text->selection;
+		xsel_cache_.cursor = text->cursor;
+		xsel_cache_.selection_cursor = text->selection.cursor;
+		xsel_cache_.set = text->selection.set();
 		sel = text->selectionAsString(*bv_->buffer(), false);
-	} else if (!text->selection.set()) {
-		sel = string();
-		bv_->text()->xsel_cache.set(false);
-	}
-	if (!sel.empty()) {
-		workarea().putClipboard(sel);
-	}
+		if (!sel.empty())
+			workarea().putClipboard(sel);
+	} 
 }
 
 
@@ -548,7 +550,7 @@
 	if (available()) {
 		screen().hideCursor();
 		bv_->getLyXText()->clearSelection();
-		bv_->text()->xsel_cache.set(false);
+		xsel_cache_.set = false;
 	}
 }
 
@@ -631,8 +633,8 @@
 	if (!text->selection.set())
 		return Change(Change::UNCHANGED);
 
-	return text->getPar(text->selection.start)
-		->lookupChangeFull(text->selection.start.pos());
+	return text->getPar(text->selStart())
+		->lookupChangeFull(text->selStart().pos());
 }
 
 
Index: BufferView_pimpl.h
===
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/BufferView_pimpl.h,v
retrieving revision 1.110
diff -u -r1.110 BufferView_pimpl.h
--- BufferView_pimpl.h	10 Nov 2003 18:15:52 -	1.110
+++ BufferView_pimpl.h	10 Dec 2003 05:46:23 -
@@ -193,7 +193,12 @@
 	void MenuInsertLyXFile(std::string const & filen);
 	/// our workarea
 	WorkArea & workarea() const;
-
+	/// this is used to handle XSelection events in the right manner
+	struct {
+		LyXCursor cursor;
+		LyXCursor selection_cursor;
+		bool set;
+	} xsel_cache_;
 	///
 	LCursor cursor_;
 };
Index: bufferview_funcs.C
===
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/bufferview_funcs.C,v
retrieving revision 1.127
diff -u -r1.127 bufferview_funcs.C
--- bufferview_funcs.C	1 Dec 2003 13:35:38 -	1.127
+++ bufferview_funcs.C	10 Dec 2003 05:46:25 -
@@ -301,7 +301,7 @@
 		text->setSelectionRange(length);
 		text->setSelection();
 		if (backwards)
-			text->cursor = text->selection.start;
+			std::swap(text->cursor, text->selection.cursor);
 	}
 
 	bv->fitCursor();
Index: lyxcursor.C
===
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyxcursor