Re: [Better patch] Re: Bug: Problem with "Navigate" menu and Branches

2003-10-27 Thread Martin Vermeer
On Sat, Oct 25, 2003 at 11:28:00AM +0200, Alfredo Braunstein spake thusly:
 
> Martin Vermeer wrote:
> 
> > The problem was indeed, that if the target paragraph is inside an
> > inset, then in lyxfunc.C dispatch() LFUN_GOTO_PARAGRAPH we have
> > a call to setCursor() which takes its 'this' from the main LyXText of
> > the document, while the paragraph is in the internal LyXText of the
> > inset. Obviously doesn't work, as the debugging code in text.C -- a
> > homebrew distance() function -- told me in no uncertain terms.
> > 
> > (BTW should we be using a std::distance() that hangs in this way
> > instead of giving a clear error?)
> > 
> > Now I modified lyxfunc.C so it takes the correct LyXText in this case,
> > and indeed distance() works OK now. Only... the cursor doesn't
> > actually get positioned. In fact it doesn't budge at all. Bummer.
> 
> Inset locking. If I'm not mistaken, you have to call BufferView::lockInset
> with the inset your lyxtext is in (or the top level inset, I don't
> remember). The current cursor handling is distributed, that is: every
> insettext has a cursor. If there is no top-inset locked, the cursor in the
> top insettext is used and all others ignored. If there is some inset
> locked, then you go down that path in the tree and ask the question again.
> Or something like that (:-)). Try to experiment a little with inset
> locking.
> 
> Luckily at some time we will switch to an extern, global cursor handling
> (that will hold directly all the path in the tree)...
> 
> Regards, Alfredo
 
OK Alfredo, I tried to look at this. In fact, BufferView::lockInset
gets called, but fails. I have now the following code in lyxfunc.C:

   1417 if (view()->theLockingInset())
   1418 view()->unlockInset(view()->theLockingInset());
   1419 
   1420 InsetOld * inset = par->inInset();
   1421 if (inset) {
   1422 UpdatableInset * ins = static_cast(inset);
   1423 if (!view()->lockInset(ins))
   1424 lyxerr[Debug::INSETS] << "Cannot lock inset" << endl;
   1425 FuncRequest cmd(view(), LFUN_INSET_EDIT, "left");
   1426 ins->dispatch(cmd);
   1427 ins->getLyXText(view())->setCursor(par.pit(), 0);
   1428 break;
   1429 }
   1430 
   1431 // Set the cursor
   1432 view()->getLyXText()->setCursor(par.pit(), 0);
   1433 view()->switchKeyMap();
   1434 owner->view_state_changed();


I am getting two messages "Cannot lock inset", one from the above
(which however seems to defer to 'its' textinset too), the
other from the dispatch of the textinset:

590 dispatch_result
591 InsetText::priv_dispatch(FuncRequest const & cmd,
592  idx_type & idx, pos_type & pos)
593 {
594 BufferView * bv = cmd.view();
595 setViewCache(bv);
596 
597 switch (cmd.action) {
598 case LFUN_INSET_EDIT: {
599 UpdatableInset::priv_dispatch(cmd, idx, pos);
600 
601 if (!bv->lockInset(this)) {
602 lyxerr[Debug::INSETS] << "Cannot lock inset" << endl;
603 return DISPATCHED;
604 }

The nature of the failure to lock is in the following loop in BufferView.C:

445 // then do a deep look at the inset and lock the right one
446 ParagraphList::iterator pit = buffer()->paragraphs().begin();
447 ParagraphList::iterator pend = buffer()->paragraphs().end();
448 for (int par = 0; pit != pend; ++pit, ++par) {
449 InsetList::iterator it = pit->insetlist.begin();
450 InsetList::iterator end = pit->insetlist.end();
451 for (; it != end; ++it) {
452 if (it->inset == inset) {
453 text->setCursorIntern(par, it->pos);
454 theLockingInset(inset);
455 return true;
456 }
457 }
458 }
460 return false;

I established that indeed this loop drops through. So the textinset
(inside the branch inset) is not part of any insetlist of any par in
this paragraphlist (should this parlist be using ParIterator?).

Wondering,

- Martin 



pgp0.pgp
Description: PGP signature


Re: [Better patch] Re: Bug: Problem with "Navigate" menu and Branches

2003-10-25 Thread Alfredo Braunstein
Martin Vermeer wrote:

> The problem was indeed, that if the target paragraph is inside an
> inset, then in lyxfunc.C dispatch() LFUN_GOTO_PARAGRAPH we have
> a call to setCursor() which takes its 'this' from the main LyXText of
> the document, while the paragraph is in the internal LyXText of the
> inset. Obviously doesn't work, as the debugging code in text.C -- a
> homebrew distance() function -- told me in no uncertain terms.
> 
> (BTW should we be using a std::distance() that hangs in this way
> instead of giving a clear error?)
> 
> Now I modified lyxfunc.C so it takes the correct LyXText in this case,
> and indeed distance() works OK now. Only... the cursor doesn't
> actually get positioned. In fact it doesn't budge at all. Bummer.

Inset locking. If I'm not mistaken, you have to call BufferView::lockInset
with the inset your lyxtext is in (or the top level inset, I don't
remember). The current cursor handling is distributed, that is: every
insettext has a cursor. If there is no top-inset locked, the cursor in the
top insettext is used and all others ignored. If there is some inset
locked, then you go down that path in the tree and ask the question again.
Or something like that (:-)). Try to experiment a little with inset
locking.

Luckily at some time we will switch to an extern, global cursor handling
(that will hold directly all the path in the tree)...

Regards, Alfredo





Re: [Better patch] Re: Bug: Problem with "Navigate" menu and Branches

2003-10-25 Thread Martin Vermeer
On Fri, Oct 24, 2003 at 11:24:22AM -0700, Kayvan A. Sylvan spake thusly:

> > With or without, I propose to check this in. It solves the critical
> > side of the problem even while lacking a desirable feature.
> 
> I agree. We should continue to hammer at this, though. Anybody else have
> any ideas?

So I'll just check it in. If there is anything fishy with it (but how
could there be, seeing as it is that this doesn't work at all right
now) above and beyond the lacking navigation capability, we'll hear
about it soon enough ;-)

- Martin


pgp0.pgp
Description: PGP signature


Re: [Better patch] Re: Bug: Problem with "Navigate" menu and Branches

2003-10-24 Thread Kayvan A. Sylvan
On Fri, Oct 24, 2003 at 11:24:29AM +0300, Martin Vermeer wrote:
> 
> Now I modified lyxfunc.C so it takes the correct LyXText in this case,
> and indeed distance() works OK now. Only... the cursor doesn't
> actually get positioned. In fact it doesn't budge at all. Bummer.
> 
> So we still cannot navigate through the Nav menu to headers inside
> branch insets. Which is what we really want, don't we?

Hi Martin. Thank you for continuing to work on this. Yes, being able
to navigate to headers that are inside insets would be great.

> With or without, I propose to check this in. It solves the critical
> side of the problem even while lacking a desirable feature.

I agree. We should continue to hammer at this, though. Anybody else have
any ideas?

---Kayvan
-- 
Kayvan A. Sylvan  | Proud husband of   | Father to my kids:
Sylvan Associates, Inc.   | Laura Isabella Sylvan  | Katherine Yelena (8/8/89)
http://sylvan.com/~kayvan | "crown of her husband" | Robin Gregory (2/28/92)


[Better patch] Re: Bug: Problem with "Navigate" menu and Branches

2003-10-24 Thread Martin Vermeer
Kayvan and Lars,

here is a more complete patch which however still does not satisfy me.

It does the following things:

1) suppresses the menu shortcut for sectioning headers inside (branch,
note) insets;

2) prevents the "hanging" of LyX in the std:distance function in
text.C: parOffset().

The problem was indeed, that if the target paragraph is inside an
inset, then in lyxfunc.C dispatch() LFUN_GOTO_PARAGRAPH we have
a call to setCursor() which takes its 'this' from the main LyXText of
the document, while the paragraph is in the internal LyXText of the
inset. Obviously doesn't work, as the debugging code in text.C -- a
homebrew distance() function -- told me in no uncertain terms.

(BTW should we be using a std::distance() that hangs in this way
instead of giving a clear error?)

Now I modified lyxfunc.C so it takes the correct LyXText in this case,
and indeed distance() works OK now. Only... the cursor doesn't
actually get positioned. In fact it doesn't budge at all. Bummer.

So we still cannot navigate through the Nav menu to headers inside
branch insets. Which is what we really want, don't we?

Lars, I suppose you know the core best. Any suggestions?

With or without, I propose to check this in. It solves the critical
side of the problem even while lacking a desirable feature.

- Martin

-- 
Martin Vermeer  [EMAIL PROTECTED]
Helsinki University of Technology 
Dept. of Surveying, Inst. of Geodesy
P.O. Box 1200, FIN-02015 HUT, Finland
:wq
Index: MenuBackend.C
===
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/MenuBackend.C,v
retrieving revision 1.91
diff -u -p -r1.91 MenuBackend.C
--- MenuBackend.C   14 Oct 2003 21:30:19 -  1.91
+++ MenuBackend.C   24 Oct 2003 07:13:07 -
@@ -536,8 +536,9 @@ void expandToc2(Menu & tomenu,
string label(4 * max(0, toc_list[i].depth - depth),' ');
label += limit_string_length(toc_list[i].str);
if (toc_list[i].depth == depth
-   && ++shortcut_count <= 9) {
-   label += '|' + tostr(shortcut_count);
+   && shortcut_count < 9) {
+   if (label.find(tostr(shortcut_count + 1)) != 
string::npos)
+   label += '|' + tostr(++shortcut_count);
}
tomenu.add(MenuItem(MenuItem::Command, label,
FuncRequest(toc_list[i].action(;
@@ -553,9 +554,10 @@ void expandToc2(Menu & tomenu,
string label(4 * max(0, toc_list[pos].depth - depth), ' ');
label += limit_string_length(toc_list[pos].str);
if (toc_list[pos].depth == depth &&
-   ++shortcut_count <= 9)
-   label += '|' + tostr(shortcut_count);
-
+   shortcut_count < 9) {
+   if (label.find(tostr(shortcut_count + 1)) != 
string::npos)
+   label += '|' + tostr(++shortcut_count);
+   }
if (new_pos == pos + 1) {
tomenu.add(MenuItem(MenuItem::Command,
label, 
FuncRequest(toc_list[pos].action(;
Index: lyxfunc.C
===
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyxfunc.C,v
retrieving revision 1.521
diff -u -p -r1.521 lyxfunc.C
--- lyxfunc.C   23 Oct 2003 08:15:55 -  1.521
+++ lyxfunc.C   24 Oct 2003 07:13:07 -
@@ -814,7 +814,7 @@ FuncStatus LyXFunc::getStatus(FuncReques
// solution, we consider only the first action of the sequence
if (ev.action == LFUN_SEQUENCE) {
// argument contains ';'-terminated commands
-#warning LyXAction arguements not handled here.
+#warning LyXAction arguments not handled here.
flag = getStatus(FuncRequest(lyxaction.lookupFunc(token(ev.argument, 
';', 0;
}
 
@@ -1411,12 +1411,16 @@ void LyXFunc::dispatch(FuncRequest const
 
if (view()->theLockingInset())
view()->unlockInset(view()->theLockingInset());
+
+   LyXText * lt = view()->getLyXText();
if (par->inInset()) {
FuncRequest cmd(view(), LFUN_INSET_EDIT, "left");
par->inInset()->dispatch(cmd);
+   lt = par->inInset()->getLyXText(view());
}
+
// Set the cursor
-   view()->getLyXText()->setCursor(par.pit(), 0);
+   lt->setCursor(par.pit(), 0);
view()->switchKeyMap();
owner->view_state_changed();
 
Index: lyxtext.h
===
RCS file: /u

[Patch] Re: Bug: Problem with "Navigate" menu and Branches

2003-10-23 Thread Martin Vermeer
On Thu, Oct 23, 2003 at 12:42:43AM -0700, Kayvan A. Sylvan spake thusly:

BTW it seems my patch of this morning never made it to the list.
Attached, fixes at least the error message caused by the menu shortcuts.

The problem that my other post refers to, it that LyX still freezes
(endless loop, apparently in text.C:2122 std::distance()) if you click
on one of the sectioning headers in the Nav menu, if it is within a
branch inset. *Very* unpleasant.

- Martin 

Index: MenuBackend.C
===
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/MenuBackend.C,v
retrieving revision 1.91
diff -u -p -r1.91 MenuBackend.C
--- MenuBackend.C   14 Oct 2003 21:30:19 -  1.91
+++ MenuBackend.C   23 Oct 2003 08:54:47 -
@@ -536,8 +536,9 @@ void expandToc2(Menu & tomenu,
string label(4 * max(0, toc_list[i].depth - depth),' ');
label += limit_string_length(toc_list[i].str);
if (toc_list[i].depth == depth
-   && ++shortcut_count <= 9) {
-   label += '|' + tostr(shortcut_count);
+   && shortcut_count < 9) {
+   if (label.find(tostr(shortcut_count + 1)) != 
string::npos)
+   label += '|' + tostr(++shortcut_count);
}
tomenu.add(MenuItem(MenuItem::Command, label,
FuncRequest(toc_list[i].action(;
@@ -553,9 +554,10 @@ void expandToc2(Menu & tomenu,
string label(4 * max(0, toc_list[pos].depth - depth), ' ');
label += limit_string_length(toc_list[pos].str);
if (toc_list[pos].depth == depth &&
-   ++shortcut_count <= 9)
-   label += '|' + tostr(shortcut_count);
-
+   shortcut_count < 9) {
+   if (label.find(tostr(shortcut_count + 1)) != 
string::npos)
+   label += '|' + tostr(++shortcut_count);
+   }
if (new_pos == pos + 1) {
tomenu.add(MenuItem(MenuItem::Command,
label, 
FuncRequest(toc_list[pos].action(;


pgp0.pgp
Description: PGP signature


Re: Bug: Problem with "Navigate" menu and Branches

2003-10-23 Thread Martin Vermeer
On Thu, Oct 23, 2003 at 12:42:43AM -0700, Kayvan A. Sylvan spake thusly:
 
> Do not let your heart be troubled. It is a step in the right direction.
> You've done good work! The one remaining issue is with the Navigate menu
> when a branch encloses a Chapter or Section.

Kayvan,

I tried to analyse the problem of going to a sectioning header inside
a branch by clicking on it in the Nav menu (and LyX freezing up), and
the problem seems to be located here in text.C:

   2120 int LyXText::parOffset(ParagraphList::iterator pit) const
   2121 {
   2122 return std::distance(ownerParagraphs().begin(), pit);
   2123 }

which is called from text2.C:

   1263 void LyXText::setCursor(ParagraphList::iterator pit, pos_type pos)
   1264 {
   1265 setCursor(parOffset(pit), pos);
   1266 }

...from lyxfunc.C:

   1400 ParIterator par = owner->buffer()->getParFromID(id);
   ...
   1416 // Set the cursor
   1417 view()->getLyXText()->setCursor(par.pit(), 0);

...setting the cursor.

The std::distance function doesn't seem to go anywhere when pit (I
assume pointing to the sectioning header) is inside an inset, and
ownerParagraphs pointing... where? The start of the main text? Are
these even iterators on the same container?

Experts, HELP!

- Martin



pgp0.pgp
Description: PGP signature


[Patch] Re: Bug: Problem with "Navigate" menu and Branches

2003-10-23 Thread Martin Vermeer
On Thu, Oct 23, 2003 at 12:42:43AM -0700, Kayvan A. Sylvan spake thusly:
> 
> On Thu, Oct 23, 2003 at 09:18:28AM +0300, Martin Vermeer wrote:
> > > Somewhere near the beginning of the document, in the "Teacher Edition"
> > > branch, in an ERT inset, I put:
> > > 
> > >\teachermanualtrue
> > > 
> > > Now, it's easy to generate both versions of the document.
> > > 
> > >   ---Kayvan
> > 
> > Yes... this is precisely the kind of trickery that Branches was meant
> > to make unnecessary :-(
> > 
> 
> Hey Martin,
> 
> Do not let your heart be troubled. It is a step in the right direction.
> You've done good work! The one remaining issue is with the Navigate menu
> when a branch encloses a Chapter or Section.
> 
> Even with the trickery above, it's easier for me to use the Branches UI to
> include and exclude these conditional parts than it would be to
> do it all in ERT.
> 
> Best regards,
> 
>   ---Kayvan

It wasn't meant negatively... but we must try to fix this. The
attached simple patch simply suppresses shortcuts that are not in the
label. It thus suppresses the error message.

What it doesn't fix, is that LyX goes into some endless loop when
clicking on an in-branch header in the Nav menu. That's trickier...

- Martin

Index: MenuBackend.C
===
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/MenuBackend.C,v
retrieving revision 1.91
diff -u -p -r1.91 MenuBackend.C
--- MenuBackend.C   14 Oct 2003 21:30:19 -  1.91
+++ MenuBackend.C   23 Oct 2003 08:54:47 -
@@ -536,8 +536,9 @@ void expandToc2(Menu & tomenu,
string label(4 * max(0, toc_list[i].depth - depth),' ');
label += limit_string_length(toc_list[i].str);
if (toc_list[i].depth == depth
-   && ++shortcut_count <= 9) {
-   label += '|' + tostr(shortcut_count);
+   && shortcut_count < 9) {
+   if (label.find(tostr(shortcut_count + 1)) != 
string::npos)
+   label += '|' + tostr(++shortcut_count);
}
tomenu.add(MenuItem(MenuItem::Command, label,
FuncRequest(toc_list[i].action(;
@@ -553,9 +554,10 @@ void expandToc2(Menu & tomenu,
string label(4 * max(0, toc_list[pos].depth - depth), ' ');
label += limit_string_length(toc_list[pos].str);
if (toc_list[pos].depth == depth &&
-   ++shortcut_count <= 9)
-   label += '|' + tostr(shortcut_count);
-
+   shortcut_count < 9) {
+   if (label.find(tostr(shortcut_count + 1)) != 
string::npos)
+   label += '|' + tostr(++shortcut_count);
+   }
if (new_pos == pos + 1) {
tomenu.add(MenuItem(MenuItem::Command,
label, 
FuncRequest(toc_list[pos].action(;


pgp0.pgp
Description: PGP signature


Re: Bug: Problem with "Navigate" menu and Branches

2003-10-23 Thread Kayvan A. Sylvan
On Thu, Oct 23, 2003 at 09:18:28AM +0300, Martin Vermeer wrote:
> > Somewhere near the beginning of the document, in the "Teacher Edition"
> > branch, in an ERT inset, I put:
> > 
> >\teachermanualtrue
> > 
> > Now, it's easy to generate both versions of the document.
> > 
> > ---Kayvan
> 
> Yes... this is precisely the kind of trickery that Branches was meant
> to make unnecessary :-(
> 

Hey Martin,

Do not let your heart be troubled. It is a step in the right direction.
You've done good work! The one remaining issue is with the Navigate menu
when a branch encloses a Chapter or Section.

Even with the trickery above, it's easier for me to use the Branches UI to
include and exclude these conditional parts than it would be to
do it all in ERT.

Best regards,

---Kayvan
-- 
Kayvan A. Sylvan  | Proud husband of   | Father to my kids:
Sylvan Associates, Inc.   | Laura Isabella Sylvan  | Katherine Yelena (8/8/89)
http://sylvan.com/~kayvan | "crown of her husband" | Robin Gregory (2/28/92)


Re: Bug: Problem with "Navigate" menu and Branches

2003-10-22 Thread Martin Vermeer
On Wed, Oct 22, 2003 at 08:00:41PM -0700, Kayvan A. Sylvan spake thusly:
> 
> On Sun, Sep 21, 2003 at 09:04:56AM -0700, Kayvan A. Sylvan wrote:
> 
> > My usage is for a section (or even a Chapter) that is included in one
> > version (with the branch enabled) and not included in another version.
> > 
> > For example: Imagine an academic book that has a "Teacher's Enhanced
> > Edition" where each Chapter contains a section called "Answers to the
> > exercises" and maybe even an additional Chapter devoted to teaching
> > methods for the overall material. These would all be inside a 
> > "Teacher Edition" branch inset.
> 
> The original bug is still there, but I have a hackish workaround for
> the above desired usage.
> 
> In the LaTeX preamble, I add:
> 
> \newif\ifteachermanual
> \teachermanualfalse
> 
> Then, around the "answers to the exercises" section, I put (in ERT):
> 
> \ifteachermanual
> 
> [... section contents ...]
> 
> \fi
> 
> Somewhere near the beginning of the document, in the "Teacher Edition"
> branch, in an ERT inset, I put:
> 
>\teachermanualtrue
> 
> Now, it's easy to generate both versions of the document.
> 
>   ---Kayvan

Yes... this is precisely the kind of trickery that Branches was meant
to make unnecessary :-(

- Martin


pgp0.pgp
Description: PGP signature


Re: Bug: Problem with "Navigate" menu and Branches

2003-10-22 Thread Kayvan A. Sylvan
On Sun, Sep 21, 2003 at 09:04:56AM -0700, Kayvan A. Sylvan wrote:

> My usage is for a section (or even a Chapter) that is included in one
> version (with the branch enabled) and not included in another version.
> 
> For example: Imagine an academic book that has a "Teacher's Enhanced
> Edition" where each Chapter contains a section called "Answers to the
> exercises" and maybe even an additional Chapter devoted to teaching
> methods for the overall material. These would all be inside a 
> "Teacher Edition" branch inset.

The original bug is still there, but I have a hackish workaround for
the above desired usage.

In the LaTeX preamble, I add:

\newif\ifteachermanual
\teachermanualfalse

Then, around the "answers to the exercises" section, I put (in ERT):

\ifteachermanual

[... section contents ...]

\fi

Somewhere near the beginning of the document, in the "Teacher Edition"
branch, in an ERT inset, I put:

   \teachermanualtrue

Now, it's easy to generate both versions of the document.

---Kayvan
-- 
Kayvan A. Sylvan  | Proud husband of   | Father to my kids:
Sylvan Associates, Inc.   | Laura Isabella Sylvan  | Katherine Yelena (8/8/89)
http://sylvan.com/~kayvan | "crown of her husband" | Robin Gregory (2/28/92)


Re: Bug: Problem with "Navigate" menu and Branches

2003-10-20 Thread Kayvan A. Sylvan
> Kayvan> It's not quite right.
> 
> Is the problem identical with 1.3.x (with note inset)? If it is, could
> you send a small test file.

I don't know if it's identical with Note insets. I can not test with 1.3.x
right now.

I have attached an example file.

-- 
Kayvan A. Sylvan  | Proud husband of   | Father to my kids:
Sylvan Associates, Inc.   | Laura Isabella Sylvan  | Katherine Yelena (8/8/89)
http://sylvan.com/~kayvan | "crown of her husband" | Robin Gregory (2/28/92)
#LyX 1.4.0cvs created this file. For more info see http://www.lyx.org/
\lyxformat 225
\textclass article
\language english
\inputencoding auto
\fontscheme default
\graphics default
\paperfontsize default
\spacing single 
\papersize Default
\paperpackage a4
\use_geometry 0
\use_amsmath 1
\use_natbib 0
\use_numerical_citations 0
\paperorientation portrait
\branch testbranch
\selected 1
\color none
\end_branch
\secnumdepth 3
\tocdepth 3
\paragraph_separation indent
\defskip medskip
\quotes_language english
\quotes_times 2
\papercolumns 1
\papersides 1
\paperpagestyle default
\tracking_changes 0
\end_header

\begin_layout Section

Test
\end_layout

\begin_layout Standard

This is garbage notes.
\end_layout

\begin_layout Section

Another
\end_layout

\begin_layout Standard

Yo yo yo!
\end_layout

\begin_layout Standard


\begin_inset Branch testbranch
collapsed false

\begin_layout Section

This section is inside testbranch
\end_layout

\begin_layout Standard

Testing
\end_layout

\end_inset 


\end_layout

\begin_layout Section

Yet another section
\end_layout

\begin_layout Standard

lkjlkjl.
\end_layout

\end_document


Re: Bug: Problem with "Navigate" menu and Branches

2003-10-20 Thread Jean-Marc Lasgouttes
> "Kayvan" == Kayvan A Sylvan <[EMAIL PROTECTED]> writes:

Kayvan> On Mon, Oct 20, 2003 at 02:56:15PM +0200, Jean-Marc Lasgouttes
Kayvan> wrote:
>> > "Kayvan" == Kayvan A Sylvan <[EMAIL PROTECTED]> writes:
>> 
Kayvan> Does anyone have any ideas for how to fix this? The problem in
Kayvan> a nutshell is that Branches that contain Chapters break the
Kayvan> Navigatie menu.
>>  Could you try the following patch? I only tested the equivalent
>> patch on 1.3.x (since I cannot run 1.4.x yet), so I am not sure
>> that it does what you want.
>> 
>> JMarc

Kayvan> It's not quite right.

Is the problem identical with 1.3.x (with note inset)? If it is, could
you send a small test file.

It may be worth opening a new bug.

JMarc



Re: Bug: Problem with "Navigate" menu and Branches

2003-10-20 Thread Kayvan A. Sylvan
On Mon, Oct 20, 2003 at 02:56:15PM +0200, Jean-Marc Lasgouttes wrote:
> > "Kayvan" == Kayvan A Sylvan <[EMAIL PROTECTED]> writes:
> 
> Kayvan> Does anyone have any ideas for how to fix this? The problem in
> Kayvan> a nutshell is that Branches that contain Chapters break the
> Kayvan> Navigatie menu.
> 
> Could you try the following patch? I only tested the equivalent patch
> on 1.3.x (since I cannot run 1.4.x yet), so I am not sure that it does
> what you want.
> 
> JMarc

It's not quite right.

It produces a Navigate menu like this for my case (section in Branch inset):

1. section one title.
2. section two
3. Three
4. Four
5. Section 5

The section in question is between "Four" and "Section 5" above.
Clicking on "4. Four" I see the following menu:

4. Four
4.1 Here is a subsection
4.2 Another one
4.3 And another
1. This is the section I want

Clicking on the "1." causes LyX to hang.
 
Thanks for looking at this. I am standing by to test another patch or
to help you debug this.

---Kayvan
-- 
Kayvan A. Sylvan  | Proud husband of   | Father to my kids:
Sylvan Associates, Inc.   | Laura Isabella Sylvan  | Katherine Yelena (8/8/89)
http://sylvan.com/~kayvan | "crown of her husband" | Robin Gregory (2/28/92)


Re: Bug: Problem with "Navigate" menu and Branches

2003-10-20 Thread Jean-Marc Lasgouttes
> "Kayvan" == Kayvan A Sylvan <[EMAIL PROTECTED]> writes:

Kayvan> Does anyone have any ideas for how to fix this? The problem in
Kayvan> a nutshell is that Branches that contain Chapters break the
Kayvan> Navigatie menu.

Could you try the following patch? I only tested the equivalent patch
on 1.3.x (since I cannot run 1.4.x yet), so I am not sure that it does
what you want.

JMarc

Index: src/ChangeLog
===
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/ChangeLog,v
retrieving revision 1.1636
diff -u -p -r1.1636 ChangeLog
--- src/ChangeLog	18 Oct 2003 14:43:54 -	1.1636
+++ src/ChangeLog	20 Oct 2003 12:54:25 -
@@ -1,3 +1,8 @@
+2003-10-20  Jean-Marc Lasgouttes  <[EMAIL PROTECTED]>
+
+	* toc.C (getTocList): increase depth when headings are found
+	inside insets; remove unused variable
+
 2003-10-18  Martin Vermeer  <[EMAIL PROTECTED]>
 
 	* text3.C: fix one crash due to wrong cursor def
Index: src/toc.C
===
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/toc.C,v
retrieving revision 1.36
diff -u -p -r1.36 toc.C
--- src/toc.C	6 Oct 2003 15:42:42 -	1.36
+++ src/toc.C	20 Oct 2003 12:54:25 -
@@ -69,7 +69,6 @@ TocList const getTocList(Buffer const & 
 	TocList toclist;
 
 	BufferParams const & bufparams = buf.params();
-	LyXTextClass const & textclass = bufparams.getLyXTextClass();
 
 	ParConstIterator pit = buf.par_iterator_begin();
 	ParConstIterator end = buf.par_iterator_end();
@@ -78,7 +77,9 @@ TocList const getTocList(Buffer const & 
 		int const toclevel = pit->layout()->toclevel;
 		if (toclevel > 0 &&  toclevel <= bufparams.tocdepth) {
 			// insert this into the table of contents
-			TocItem const item(pit->id(), toclevel - 1, pit->asString(buf, true));
+			TocItem const item(pit->id(), 
+	   toclevel - 1 + pit.size() - 1, 
+	   pit->asString(buf, true));
 			toclist["TOC"].push_back(item);
 		}
 


Re: Bug: Problem with "Navigate" menu and Branches

2003-10-18 Thread Martin Vermeer
On Fri, Oct 17, 2003 at 08:46:01AM +0200, Andre Poenitz spake thusly:

...

> > Does anyone have any ideas for how to fix this? The problem in a nutshell
> > is that Branches that contain Chapters break the Navigatie menu.
> 
> Same for note insets...
> 
> Andre'

So, turn shortcuts off if there is such an inset... (I suppose it's
enough in MenuBackend to test if some TOC list entry starts with
digit 1 when shortcut_count > 1)

- Martin



pgp0.pgp
Description: PGP signature


Re: Bug: Problem with "Navigate" menu and Branches

2003-10-16 Thread Andre Poenitz
On Thu, Oct 16, 2003 at 01:05:32PM -0700, Kayvan A. Sylvan wrote:
> On Sat, Sep 20, 2003 at 10:57:36PM -0700, Kayvan A. Sylvan wrote:
> > Load the document below with current CVS.
> > 
> > Click on the Navigate menu. You will see something like:
> > 
> > _1_ Test
> > _2_ Another
> > _3_ Section 3
> >  1  Section inside branch
> > 
> > and the message on the console:
> > 
> > Menu warning: menu entry "1 Section inside branch" does not contain shortcut `4'.
> > 
> > It makes no difference if the "Test" branch is active or not.
> 
> Does anyone have any ideas for how to fix this? The problem in a nutshell
> is that Branches that contain Chapters break the Navigatie menu.

Same for note insets...

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: Bug: Problem with "Navigate" menu and Branches

2003-10-16 Thread Kayvan A. Sylvan
On Sat, Sep 20, 2003 at 10:57:36PM -0700, Kayvan A. Sylvan wrote:
> Load the document below with current CVS.
> 
> Click on the Navigate menu. You will see something like:
> 
> _1_ Test
> _2_ Another
> _3_ Section 3
>  1  Section inside branch
> 
> and the message on the console:
> 
> Menu warning: menu entry "1 Section inside branch" does not contain shortcut `4'.
> 
> It makes no difference if the "Test" branch is active or not.

Does anyone have any ideas for how to fix this? The problem in a nutshell
is that Branches that contain Chapters break the Navigatie menu.

-- 
Kayvan A. Sylvan  | Proud husband of   | Father to my kids:
Sylvan Associates, Inc.   | Laura Isabella Sylvan  | Katherine Yelena (8/8/89)
http://sylvan.com/~kayvan | "crown of her husband" | Robin Gregory (2/28/92)


Re: Bug: Problem with "Navigate" menu and Branches

2003-09-22 Thread Andre Poenitz
On Mon, Sep 22, 2003 at 09:31:58AM +0300, Martin Vermeer wrote:
> > I don't know. Is there some way of making the Chapter/Section numbering
> > global to the document instead of local to the insets? I really don't
> > know the code, so I'm just tossing out ideas.
> 
> Hmmm. LyX kernel experts? What about changing ParagraphList::iterator
> into ParIterator in LyXText:setCounter/LyXText::updateCounters? Is
> that the Right Idea (tm) or a dead end?

Good idea, especially if you manage to get rid of the 'caption hack'.

Andre'


Re: Bug: Problem with "Navigate" menu and Branches

2003-09-21 Thread Martin Vermeer
On Sun, Sep 21, 2003 at 01:53:08PM -0700, Kayvan A. Sylvan spake thusly:
> 
> On Sun, Sep 21, 2003 at 07:40:08PM +0300, Martin Vermeer wrote:
> > > 
> > > I don't really agree with limiting this.
> > > 
> > > It certainly breaks the principle of least surprise.
> > > 
> > > The Section numbering on-screen should just continue as normal. In this way,
> > > there might be a discrepancy between what you see on screen and the printed
> > > version (depending on which branches are enabled), but that's not a problem.
> > 
> > Yes, I agree -- but how does one achieve that?  Once that works,
> > getting the labels in the nav menu to work properly is a small thing
> > by comparison.
> 
> I don't know. Is there some way of making the Chapter/Section numbering
> global to the document instead of local to the insets? I really don't
> know the code, so I'm just tossing out ideas.

Hmmm. LyX kernel experts? What about changing ParagraphList::iterator
into ParIterator in LyXText:setCounter/LyXText::updateCounters? Is
that the Right Idea (tm) or a dead end?

I know I was fighting with this when working on Counters, to get float
numbers working, but failed -- as you can see it's still Figure #.

- Martin



pgp0.pgp
Description: PGP signature


Re: Bug: Problem with "Navigate" menu and Branches

2003-09-21 Thread Kayvan A. Sylvan
On Sun, Sep 21, 2003 at 07:40:08PM +0300, Martin Vermeer wrote:
> > 
> > I don't really agree with limiting this.
> > 
> > It certainly breaks the principle of least surprise.
> > 
> > The Section numbering on-screen should just continue as normal. In this way,
> > there might be a discrepancy between what you see on screen and the printed
> > version (depending on which branches are enabled), but that's not a problem.
> 
> Yes, I agree -- but how does one achieve that?  Once that works,
> getting the labels in the nav menu to work properly is a small thing
> by comparison.

I don't know. Is there some way of making the Chapter/Section numbering
global to the document instead of local to the insets? I really don't
know the code, so I'm just tossing out ideas.


-- 
Kayvan A. Sylvan  | Proud husband of   | Father to my kids:
Sylvan Associates, Inc.   | Laura Isabella Sylvan  | Katherine Yelena (8/8/89)
http://sylvan.com/~kayvan | "crown of her husband" | Robin Gregory (2/28/92)


Re: Bug: Problem with "Navigate" menu and Branches

2003-09-21 Thread Martin Vermeer
On Sun, Sep 21, 2003 at 09:04:56AM -0700, Kayvan A. Sylvan spake thusly:
 > 
> > Actually you shouldn't use Branches like that. My idea was that the
> > inset should be *in* the Section layout paragraph, not *contain* it.
> > As you see, also the numbering doesn't work. 
> 
> Why shouldn't I want to use branches like that, though?
> 
> My usage is for a section (or even a Chapter) that is included in one
> version (with the branch enabled) and not included in another version.
> 
> For example: Imagine an academic book that has a "Teacher's Enhanced
> Edition" where each Chapter contains a section called "Answers to the
> exercises" and maybe even an additional Chapter devoted to teaching
> methods for the overall material. These would all be inside a 
> "Teacher Edition" branch inset.

Ah, I see. Yes, this could be useful. John had an example of an
enumeration which similarly didn't work in the current paradigm.
 
> > Is there a way to limit what kind of layouts are admitted within a
> > particular inset? If so, this is the place to use it. And the inset
> > should "inherit" the outside, large Section font. How to do that?
> > 
> > - Martin
> 
> I don't really agree with limiting this.
> 
> It certainly breaks the principle of least surprise.
> 
> The Section numbering on-screen should just continue as normal. In this way,
> there might be a discrepancy between what you see on screen and the printed
> version (depending on which branches are enabled), but that's not a problem.

Yes, I agree -- but how does one achieve that?  Once that works,
getting the labels in the nav menu to work properly is a small thing
by comparison.

> 
>   ---Kayvan

- Martin



pgp0.pgp
Description: PGP signature


Re: Bug: Problem with "Navigate" menu and Branches

2003-09-21 Thread Kayvan A. Sylvan
On Sun, Sep 21, 2003 at 06:10:09PM +0300, Martin Vermeer wrote:
> On Sat, Sep 20, 2003 at 10:57:36PM -0700, Kayvan A. Sylvan spake thusly:
> > 
> > Load the document below with current CVS.
> > 
> > Click on the Navigate menu. You will see something like:
> > 
> > _1_ Test
> > _2_ Another
> > _3_ Section 3
> >  1  Section inside branch
> > 
> > and the message on the console:
> > 
> > Menu warning: menu entry "1 Section inside branch" does not contain shortcut `4'.
> > 
> > It makes no difference if the "Test" branch is active or not.
> > 
> > ---Kayvan
> 
> Actually you shouldn't use Branches like that. My idea was that the
> inset should be *in* the Section layout paragraph, not *contain* it.
> As you see, also the numbering doesn't work. 

Why shouldn't I want to use branches like that, though?

My usage is for a section (or even a Chapter) that is included in one
version (with the branch enabled) and not included in another version.

For example: Imagine an academic book that has a "Teacher's Enhanced
Edition" where each Chapter contains a section called "Answers to the
exercises" and maybe even an additional Chapter devoted to teaching
methods for the overall material. These would all be inside a 
"Teacher Edition" branch inset.

> Is there a way to limit what kind of layouts are admitted within a
> particular inset? If so, this is the place to use it. And the inset
> should "inherit" the outside, large Section font. How to do that?
> 
> - Martin

I don't really agree with limiting this.

It certainly breaks the principle of least surprise.

The Section numbering on-screen should just continue as normal. In this way,
there might be a discrepancy between what you see on screen and the printed
version (depending on which branches are enabled), but that's not a problem.

---Kayvan
-- 
Kayvan A. Sylvan  | Proud husband of   | Father to my kids:
Sylvan Associates, Inc.   | Laura Isabella Sylvan  | Katherine Yelena (8/8/89)
http://sylvan.com/~kayvan | "crown of her husband" | Robin Gregory (2/28/92)


Re: Bug: Problem with "Navigate" menu and Branches

2003-09-21 Thread Martin Vermeer
On Sat, Sep 20, 2003 at 10:57:36PM -0700, Kayvan A. Sylvan spake thusly:
> 
> Load the document below with current CVS.
> 
> Click on the Navigate menu. You will see something like:
> 
> _1_ Test
> _2_ Another
> _3_ Section 3
>  1  Section inside branch
> 
> and the message on the console:
> 
> Menu warning: menu entry "1 Section inside branch" does not contain shortcut `4'.
> 
> It makes no difference if the "Test" branch is active or not.
> 
>   ---Kayvan

Actually you shouldn't use Branches like that. My idea was that the
inset should be *in* the Section layout paragraph, not *contain* it.
As you see, also the numbering doesn't work. 

Is there a way to limit what kind of layouts are admitted within a
particular inset? If so, this is the place to use it. And the inset
should "inherit" the outside, large Section font. How to do that?

- Martin



pgp0.pgp
Description: PGP signature


Bug: Problem with "Navigate" menu and Branches

2003-09-20 Thread Kayvan A. Sylvan
Load the document below with current CVS.

Click on the Navigate menu. You will see something like:

_1_ Test
_2_ Another
_3_ Section 3
 1  Section inside branch

and the message on the console:

Menu warning: menu entry "1 Section inside branch" does not contain shortcut `4'.

It makes no difference if the "Test" branch is active or not.

---Kayvan
-- 
Kayvan A. Sylvan  | Proud husband of   | Father to my kids:
Sylvan Associates, Inc.   | Laura Isabella Sylvan  | Katherine Yelena (8/8/89)
http://sylvan.com/~kayvan | "crown of her husband" | Robin Gregory (2/28/92)
#LyX 1.4.0cvs created this file. For more info see http://www.lyx.org/
\lyxformat 225
\textclass article
\language english
\inputencoding auto
\fontscheme default
\graphics default
\paperfontsize default
\spacing single 
\papersize Default
\paperpackage a4
\use_geometry 0
\use_amsmath 1
\use_natbib 0
\use_numerical_citations 0
\paperorientation portrait
\branch Test
\selected 1
\color none
\end_branch
\secnumdepth 3
\tocdepth 3
\paragraph_separation indent
\defskip medskip
\quotes_language english
\quotes_times 2
\papercolumns 1
\papersides 1
\paperpagestyle default
\tracking_changes 0
\end_header

\begin_layout Section

Test
\end_layout

\begin_layout Standard

Testing.
\end_layout

\begin_layout Section

Another
\end_layout

\begin_layout Standard

And again.
\end_layout

\begin_layout Section

Section 3
\end_layout

\begin_layout Standard

Hum-dee-dee hum-dee-dee!
\end_layout

\begin_layout Standard


\begin_inset Branch Test
collapsed false

\begin_layout Section

Section inside branch
\end_layout

\begin_layout Standard

Yo yo!
\end_layout

\end_inset 


\end_layout

\end_document