Re: [PATCH] minor bibitem tweaks

2005-06-06 Thread Juergen Spitzmueller
Martin Vermeer wrote:
 Yes, I know... I can live with this for 1.4.

I'll commit the minimalist version. This is clearly an improvement, everything 
else is ambiguous.

Jürgen


Re: [PATCH] minor bibitem tweaks

2005-06-06 Thread Juergen Spitzmueller
Martin Vermeer wrote:
> Yes, I know... I can live with this for 1.4.

I'll commit the minimalist version. This is clearly an improvement, everything 
else is ambiguous.

Jürgen


Re: [PATCH] minor bibitem tweaks

2005-06-05 Thread Juergen Spitzmueller
Martin Vermeer wrote:
 Forget this. Try this (tested):

It's still not ideal. Ideally, the cursor should jump over pos 0 (that is, 
go to lastpos of the par above or, in the other direction, jump from the 
lastpos to pos 1), and it should be possible to merge two lines with 
backspace (In your version does, bacjspace behaves like del).
It should just behave like an itemize or enumerate label (just like it is in 
1.3). I'm not sure this is possible with workarounds like this.

Jürgen


Re: [PATCH] minor bibitem tweaks

2005-06-05 Thread Martin Vermeer
On Sun, Jun 05, 2005 at 02:30:59PM +0200, Juergen Spitzmueller wrote:
 Martin Vermeer wrote:
  Forget this. Try this (tested):
 
 It's still not ideal. Ideally, the cursor should jump over pos 0 (that is, 
 go to lastpos of the par above or, in the other direction, jump from the 
 lastpos to pos 1), and it should be possible to merge two lines with 
 backspace (In your version does, bacjspace behaves like del).
 It should just behave like an itemize or enumerate label (just like it is in 
 1.3). I'm not sure this is possible with workarounds like this.

Yes, I know... I can live with this for 1.4.

- Martin



pgpm9iqXdLskT.pgp
Description: PGP signature


Re: [PATCH] minor bibitem tweaks

2005-06-05 Thread Juergen Spitzmueller
Martin Vermeer wrote:
> Forget this. Try this (tested):

It's still not ideal. Ideally, the cursor should "jump over" pos 0 (that is, 
go to lastpos of the par above or, in the other direction, jump from the 
lastpos to pos 1), and it should be possible to merge two lines with 
backspace (In your version does, bacjspace behaves like del).
It should just behave like an itemize or enumerate label (just like it is in 
1.3). I'm not sure this is possible with workarounds like this.

Jürgen


Re: [PATCH] minor bibitem tweaks

2005-06-05 Thread Martin Vermeer
On Sun, Jun 05, 2005 at 02:30:59PM +0200, Juergen Spitzmueller wrote:
> Martin Vermeer wrote:
> > Forget this. Try this (tested):
> 
> It's still not ideal. Ideally, the cursor should "jump over" pos 0 (that is, 
> go to lastpos of the par above or, in the other direction, jump from the 
> lastpos to pos 1), and it should be possible to merge two lines with 
> backspace (In your version does, bacjspace behaves like del).
> It should just behave like an itemize or enumerate label (just like it is in 
> 1.3). I'm not sure this is possible with workarounds like this.

Yes, I know... I can live with this for 1.4.

- Martin



pgpm9iqXdLskT.pgp
Description: PGP signature


Re: [PATCH] minor bibitem tweaks

2005-06-04 Thread Martin Vermeer
On Sat, Jun 04, 2005 at 05:06:34PM +0200, Juergen Spitzmueller wrote:
 The following patch refines a bit the bibitem de-goosing. 
 
 First, it moves the cursor after the bibitem when it has been inserted (as it 
 is in 1.3 and also with any other inset). Second, it disables the lfun 
 outside the bibliography environment. Currently, it is possible to place 
 bibitems in senseless places. Actually, the lfun makes less sense in almost 
 all cases, since in Bibliography, it is inserted automatically.

Actually, considering this, do you _ever_ want to insert a bibitem
manually? 

Note that even with this patch, you may till find bibitems in senseless
places if you after insertion change the layout type of the paragraph.
(The same applies for optarg.)
 
 I'll commit on monday if I do not get objections.
 
 Jürgen

- Martin



pgpzFz5pSISqT.pgp
Description: PGP signature


Re: [PATCH] minor bibitem tweaks

2005-06-04 Thread Juergen Spitzmueller
Martin Vermeer wrote:
 Actually, considering this, do you _ever_ want to insert a bibitem
 manually?

Probably not (I could inside the Bibliography layout, since LaTeX accepts 
multiple bibitems in one line, but that does not make much sense).

 Note that even with this patch, you may till find bibitems in senseless
 places if you after insertion change the layout type of the paragraph.
 (The same applies for optarg.)

I know. There are still other glitches remaining (one is that you can still 
move the cursor in front of the bibitem and type something, which triggers a 
new bibitem).

Since I didn't find a satisfying solution for those problems, I'll leave them 
for now.

Jürgen


Re: [PATCH] minor bibitem tweaks

2005-06-04 Thread Martin Vermeer
On Sat, Jun 04, 2005 at 06:01:55PM +0200, Juergen Spitzmueller wrote:
 Martin Vermeer wrote:
  Actually, considering this, do you _ever_ want to insert a bibitem
  manually?
 
 Probably not (I could inside the Bibliography layout, since LaTeX accepts 
 multiple bibitems in one line, but that does not make much sense).
 
  Note that even with this patch, you may till find bibitems in senseless
  places if you after insertion change the layout type of the paragraph.
  (The same applies for optarg.)
 
 I know. There are still other glitches remaining (one is that you can still 
 move the cursor in front of the bibitem and type something, which triggers a 
 new bibitem).

Actually that is easy to suppress, if suppressing is what we want: in
text3.C in the LFUN_SELFINSERT switch item, test for a bibitem inset in pos 0
and don't insert if one is found.
 
 Since I didn't find a satisfying solution for those problems, I'll leave them 
 for now.
 
 Jürgen

- Martin



pgpDchZAgZJqs.pgp
Description: PGP signature


Re: [PATCH] minor bibitem tweaks

2005-06-04 Thread Juergen Spitzmueller
Martin Vermeer wrote:
 Actually that is easy to suppress, if suppressing is what we want: in
 text3.C in the LFUN_SELFINSERT switch item, test for a bibitem inset in pos
 0 and don't insert if one is found.

But then you can still insert other items. The ideal solution would be if the 
position would not be reachable (as in 1.3).

Jürgen


Re: [PATCH] minor bibitem tweaks

2005-06-04 Thread Juergen Spitzmueller
Juergen Spitzmueller wrote:
 But then you can still insert other items

 ... other insets, of course. 

Jürgen


Re: [PATCH] minor bibitem tweaks

2005-06-04 Thread Martin Vermeer
On Sat, Jun 04, 2005 at 07:57:53PM +0200, Juergen Spitzmueller wrote:
 Martin Vermeer wrote:
  Actually that is easy to suppress, if suppressing is what we want: in
  text3.C in the LFUN_SELFINSERT switch item, test for a bibitem inset in pos
  0 and don't insert if one is found.
 
 But then you can still insert other items. The ideal solution would be if the 
 position would not be reachable (as in 1.3).
 
 Jürgen

Something along these lines, then? (Untested)

- Martin

Index: text.C
===
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/text.C,v
retrieving revision 1.602
diff -u -p -r1.602 text.C
--- text.C  31 May 2005 14:40:26 -  1.602
+++ text.C  4 Jun 2005 19:08:12 -
@@ -1679,6 +1679,9 @@ bool LyXText::redoParagraph(pit_type con
int const w = maxwidth_ - leftMargin(pit) - rightMargin(par);
MetricsInfo mi(bv(), getFont(par, ii-pos), w);
ii-inset-metrics(mi, dim);
+   if (ii != par.insetlist.begin() 
+   ii-inset-lyxCode() == InsetBase::BIBITEM_CODE)
+   par.insetlist.erase(ii-pos);
}
 
// rebreak the paragraph




pgpEnW85x8eHm.pgp
Description: PGP signature


Re: [PATCH] minor bibitem tweaks

2005-06-04 Thread Martin Vermeer
On Sat, Jun 04, 2005 at 10:09:57PM +0300, Martin Vermeer wrote:
 On Sat, Jun 04, 2005 at 07:57:53PM +0200, Juergen Spitzmueller wrote:
 
 Something along these lines, then? (Untested)
 
 - Martin

Forget this. Try this (tested): 

- Martin

Index: text.C
===
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/text.C,v
retrieving revision 1.602
diff -u -p -r1.602 text.C
--- text.C  31 May 2005 14:40:26 -  1.602
+++ text.C  4 Jun 2005 20:44:39 -
@@ -1661,8 +1661,12 @@ bool LyXText::redoParagraph(pit_type con
// Insist on it being in pos 0
 par.getChar(0) == Paragraph::META_INSET) {
InsetBase * inset = par.insetlist.begin()-inset;
-   if (inset-lyxCode() == InsetBase::BIBITEM_CODE)
+   if (inset-lyxCode() == InsetBase::BIBITEM_CODE) {
hasbibitem = true;
+   if (bv()-cursor().pit() == pit 
+   bv()-cursor().pos() == 0)
+   bv()-cursor().posRight();
+   }
}
if (!hasbibitem) {
InsetBibitem * inset(new



pgpPybuiMwYdZ.pgp
Description: PGP signature


Re: [PATCH] minor bibitem tweaks

2005-06-04 Thread Martin Vermeer
On Sat, Jun 04, 2005 at 05:06:34PM +0200, Juergen Spitzmueller wrote:
> The following patch refines a bit the bibitem de-goosing. 
> 
> First, it moves the cursor after the bibitem when it has been inserted (as it 
> is in 1.3 and also with any other inset). Second, it disables the lfun 
> outside the bibliography environment. Currently, it is possible to place 
> bibitems in senseless places. Actually, the lfun makes less sense in almost 
> all cases, since in Bibliography, it is inserted automatically.

Actually, considering this, do you _ever_ want to insert a bibitem
manually? 

Note that even with this patch, you may till find bibitems in senseless
places if you after insertion change the layout type of the paragraph.
(The same applies for optarg.)
 
> I'll commit on monday if I do not get objections.
> 
> Jürgen

- Martin



pgpzFz5pSISqT.pgp
Description: PGP signature


Re: [PATCH] minor bibitem tweaks

2005-06-04 Thread Juergen Spitzmueller
Martin Vermeer wrote:
> Actually, considering this, do you _ever_ want to insert a bibitem
> manually?

Probably not (I could inside the Bibliography layout, since LaTeX accepts 
multiple bibitems in one line, but that does not make much sense).

> Note that even with this patch, you may till find bibitems in senseless
> places if you after insertion change the layout type of the paragraph.
> (The same applies for optarg.)

I know. There are still other glitches remaining (one is that you can still 
move the cursor in front of the bibitem and type something, which triggers a 
new bibitem).

Since I didn't find a satisfying solution for those problems, I'll leave them 
for now.

Jürgen


Re: [PATCH] minor bibitem tweaks

2005-06-04 Thread Martin Vermeer
On Sat, Jun 04, 2005 at 06:01:55PM +0200, Juergen Spitzmueller wrote:
> Martin Vermeer wrote:
> > Actually, considering this, do you _ever_ want to insert a bibitem
> > manually?
> 
> Probably not (I could inside the Bibliography layout, since LaTeX accepts 
> multiple bibitems in one line, but that does not make much sense).
> 
> > Note that even with this patch, you may till find bibitems in senseless
> > places if you after insertion change the layout type of the paragraph.
> > (The same applies for optarg.)
> 
> I know. There are still other glitches remaining (one is that you can still 
> move the cursor in front of the bibitem and type something, which triggers a 
> new bibitem).

Actually that is easy to suppress, if suppressing is what we want: in
text3.C in the LFUN_SELFINSERT switch item, test for a bibitem inset in pos 0
and don't insert if one is found.
 
> Since I didn't find a satisfying solution for those problems, I'll leave them 
> for now.
> 
> Jürgen

- Martin



pgpDchZAgZJqs.pgp
Description: PGP signature


Re: [PATCH] minor bibitem tweaks

2005-06-04 Thread Juergen Spitzmueller
Martin Vermeer wrote:
> Actually that is easy to suppress, if suppressing is what we want: in
> text3.C in the LFUN_SELFINSERT switch item, test for a bibitem inset in pos
> 0 and don't insert if one is found.

But then you can still insert other items. The ideal solution would be if the 
position would not be reachable (as in 1.3).

Jürgen


Re: [PATCH] minor bibitem tweaks

2005-06-04 Thread Juergen Spitzmueller
Juergen Spitzmueller wrote:
> But then you can still insert other items

 ... other insets, of course. 

Jürgen


Re: [PATCH] minor bibitem tweaks

2005-06-04 Thread Martin Vermeer
On Sat, Jun 04, 2005 at 07:57:53PM +0200, Juergen Spitzmueller wrote:
> Martin Vermeer wrote:
> > Actually that is easy to suppress, if suppressing is what we want: in
> > text3.C in the LFUN_SELFINSERT switch item, test for a bibitem inset in pos
> > 0 and don't insert if one is found.
> 
> But then you can still insert other items. The ideal solution would be if the 
> position would not be reachable (as in 1.3).
> 
> Jürgen

Something along these lines, then? (Untested)

- Martin

Index: text.C
===
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/text.C,v
retrieving revision 1.602
diff -u -p -r1.602 text.C
--- text.C  31 May 2005 14:40:26 -  1.602
+++ text.C  4 Jun 2005 19:08:12 -
@@ -1679,6 +1679,9 @@ bool LyXText::redoParagraph(pit_type con
int const w = maxwidth_ - leftMargin(pit) - rightMargin(par);
MetricsInfo mi(bv(), getFont(par, ii->pos), w);
ii->inset->metrics(mi, dim);
+   if (ii != par.insetlist.begin() 
+  && ii->inset->lyxCode() == InsetBase::BIBITEM_CODE)
+   par.insetlist.erase(ii->pos);
}
 
// rebreak the paragraph




pgpEnW85x8eHm.pgp
Description: PGP signature


Re: [PATCH] minor bibitem tweaks

2005-06-04 Thread Martin Vermeer
On Sat, Jun 04, 2005 at 10:09:57PM +0300, Martin Vermeer wrote:
> On Sat, Jun 04, 2005 at 07:57:53PM +0200, Juergen Spitzmueller wrote:
 
> Something along these lines, then? (Untested)
> 
> - Martin

Forget this. Try this (tested): 

- Martin

Index: text.C
===
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/text.C,v
retrieving revision 1.602
diff -u -p -r1.602 text.C
--- text.C  31 May 2005 14:40:26 -  1.602
+++ text.C  4 Jun 2005 20:44:39 -
@@ -1661,8 +1661,12 @@ bool LyXText::redoParagraph(pit_type con
// Insist on it being in pos 0
&& par.getChar(0) == Paragraph::META_INSET) {
InsetBase * inset = par.insetlist.begin()->inset;
-   if (inset->lyxCode() == InsetBase::BIBITEM_CODE)
+   if (inset->lyxCode() == InsetBase::BIBITEM_CODE) {
hasbibitem = true;
+   if (bv()->cursor().pit() == pit 
+  && bv()->cursor().pos() == 0)
+   bv()->cursor().posRight();
+   }
}
if (!hasbibitem) {
InsetBibitem * inset(new



pgpPybuiMwYdZ.pgp
Description: PGP signature