Re: [patch] fix bug 1473: Implement phantom in math
Am Samstag, 6. Mai 2006 19:43 schrieb Enrico Forestieri: This patch works. OK, it is in now. Edwin/Abdel: I added a FIXME for you in src/frontends/qt4/QDelimiterDialog.C. I take that you mean the backslash problem. Yes. Is there any glitch with my proposed fix for it? It might hide another bug, so I want to investigate that. After all, the current code worked at some point, and it should be possible to use \\ instead of \backslash. It seems to work well in both 1.4 and 1.5. You will have \backslash in a latex file instead of \\ but it may even help to avoid confusion in an eqnarray, for example. I'll have a look. Georg
Re: [patch] fix bug 1473: Implement phantom in math
Am Samstag, 6. Mai 2006 19:43 schrieb Enrico Forestieri: > This patch works. OK, it is in now. Edwin/Abdel: I added a FIXME for you in src/frontends/qt4/QDelimiterDialog.C. > I take that you mean the "backslash" problem. Yes. > Is there any glitch with my proposed fix for it? It might hide another bug, so I want to investigate that. After all, the current code worked at some point, and it should be possible to use \\ instead of \backslash. > It seems to work > well in both 1.4 and 1.5. You will have "\backslash" in a latex > file instead of "\\" but it may even help to avoid confusion in > an eqnarray, for example. I'll have a look. Georg
Re: [patch] fix bug 1473: Implement phantom in math
Am Montag, 1. Mai 2006 20:21 schrieb Enrico Forestieri: I just discovered another small problem. When using the GUI for fixed size delimiters and there is a selection: 1) if the left delimiter is empty, hitting insert produces nothing; 2) if the right delimiter is empty, hitting insert the selection is replaced. This updated patch should work better. If it does, it goes in. It does not yet address the backspace problem, I will look at that later. Georg Log: Implement GUI for fixed size math delimiters (by Enrico Forestieri and me): * src/lfuns.h (enum kb_action): New lfun LFUN_MATH_BIGDELIM * src/LyXAction.C (void LyXAction::init): New lfun LFUN_MATH_BIGDELIM * src/mathed/math_nestinset.C (void MathNestInset::doDispatch): remove debug message (void MathNestInset::doDispatch): remove LFUN_MATH_DELIM test for multiple cells (now in getStatus) (void MathNestInset::doDispatch): Handle LFUN_MATH_BIGDELIM (bool MathNestInset::getStatus): Disable LFUN_MATH_DELIM and LFUN_MATH_BIGDELIM when the selection spans multiple cells * src/frontends/qt3/ui/QDelimiterDialogBase.ui Added a combobox for selecting delimiter size. * src/frontends/qt3/QDelimiterDialog.[Ch] (fix_name, QDelimiterDialog, insertClicked, size_selected): Allow for fixed size delimiters. * src/frontends/gtk/GMathDelim.C: Add FIXME commnent for fixed size delimiters * src/frontends/qt4/QDelimiterDialog.C: ditto * src/frontends/xforms/FormMathsDelim.C: ditto * src/frontends/controllers/ControlMath.[Ch]: Added dispatchBigDelim() to deal with fixed size delimiters. * src/text3.C (void LyXText::dispatch): Handle LFUN_MATH_BIGDELIM (bool LyXText::getStatus): ditto * src/ToolbarBackend.C (string const ToolbarBackend::getIcon): Handle LFUN_MATH_BIGDELIM Index: src/LyXAction.C === --- src/LyXAction.C (Revision 13802) +++ src/LyXAction.C (Arbeitskopie) @@ -212,6 +212,7 @@ void LyXAction::init() { LFUN_MARK_ON, mark-on, ReadOnly }, { LFUN_MARK_TOGGLE, mark-toggle, ReadOnly }, { LFUN_MATH_DELIM, math-delim, Noop }, + { LFUN_MATH_BIGDELIM, math-bigdelim, Noop }, { LFUN_MATH_DISPLAY, math-display, Noop }, { LFUN_MATH_INSERT, math-insert, Noop }, { LFUN_MATH_SUBSCRIPT, math-subscript, Noop }, Index: src/mathed/math_nestinset.C === --- src/mathed/math_nestinset.C (Revision 13802) +++ src/mathed/math_nestinset.C (Arbeitskopie) @@ -848,7 +848,6 @@ void MathNestInset::doDispatch(LCursor } case LFUN_MATH_DELIM: { - lyxerr MathNestInset::LFUN_MATH_DELIM endl; string ls; string rs = lyx::support::split(cmd.argument, ls, ' '); // Reasonable default values @@ -857,9 +856,37 @@ void MathNestInset::doDispatch(LCursor if (rs.empty()) rs = ')'; recordUndo(cur, Undo::ATOMIC); - // Don't do this with multi-cell selections - if (cur.selBegin().idx() == cur.selEnd().idx()) - cur.handleNest(MathAtom(new MathDelimInset(ls, rs))); + cur.handleNest(MathAtom(new MathDelimInset(ls, rs))); + break; + } + + case LFUN_MATH_BIGDELIM: { + string const lname = cmd.getArg(0); + string const ldelim = cmd.getArg(1); + string const rname = cmd.getArg(2); + string const rdelim = cmd.getArg(3); + latexkeys const * l = in_word_set(lname); + bool const have_l = l l-inset == big + MathBigInset::isBigInsetDelim(ldelim); + l = in_word_set(rname); + bool const have_r = l l-inset == big + MathBigInset::isBigInsetDelim(rdelim); + // We mimic LFUN_MATH_DELIM in case we have an empty left + // or right delimiter. + if (have_l || have_r) { + recordUndo(cur, Undo::ATOMIC); + string const selection = grabAndEraseSelection(cur); + selClearOrDel(cur); + if (have_l) +cur.insert(MathAtom(new MathBigInset(lname, +ldelim))); + cur.niceInsert(selection); + if (have_r) +cur.insert(MathAtom(new MathBigInset(rname, +rdelim))); + } + // Don't call cur.undispatched() if we did nothing, this would + // lead to infinite recursion via LyXText::dispatch(). break; } @@ -917,7 +944,7 @@ void MathNestInset::doDispatch(LCursor } -bool MathNestInset::getStatus(LCursor /*cur*/, FuncRequest const cmd, +bool MathNestInset::getStatus(LCursor cur, FuncRequest const cmd, FuncStatus flag) const { // the font related toggles @@ -993,6 +1020,13 @@ bool MathNestInset::getStatus(LCursor case LFUN_MATH_MATRIX: flag.enabled(currentMode() == MATH_MODE); break; + + case LFUN_MATH_DELIM: + case LFUN_MATH_BIGDELIM: + // Don't do this with multi-cell selections + flag.enabled(cur.selBegin().idx() == cur.selEnd().idx()); + break; + default: ret = false; break; Index:
Re: [patch] fix bug 1473: Implement phantom in math
On Sat, May 06, 2006 at 02:18:47PM +0200, Georg Baum wrote: Am Montag, 1. Mai 2006 20:21 schrieb Enrico Forestieri: I just discovered another small problem. When using the GUI for fixed size delimiters and there is a selection: 1) if the left delimiter is empty, hitting insert produces nothing; 2) if the right delimiter is empty, hitting insert the selection is replaced. This updated patch should work better. If it does, it goes in. It does not yet address the backspace problem, I will look at that later. This patch works. I take that you mean the backslash problem. Is there any glitch with my proposed fix for it? It seems to work well in both 1.4 and 1.5. You will have \backslash in a latex file instead of \\ but it may even help to avoid confusion in an eqnarray, for example. -- Enrico
Re: [patch] fix bug 1473: Implement phantom in math
Am Montag, 1. Mai 2006 20:21 schrieb Enrico Forestieri: > I just discovered another small problem. > > When using the GUI for fixed size delimiters and there is a selection: > > 1) if the left delimiter is empty, hitting insert produces nothing; > > 2) if the right delimiter is empty, hitting insert the selection is >replaced. This updated patch should work better. If it does, it goes in. It does not yet address the backspace problem, I will look at that later. Georg Log: Implement GUI for fixed size math delimiters (by Enrico Forestieri and me): * src/lfuns.h (enum kb_action): New lfun LFUN_MATH_BIGDELIM * src/LyXAction.C (void LyXAction::init): New lfun LFUN_MATH_BIGDELIM * src/mathed/math_nestinset.C (void MathNestInset::doDispatch): remove debug message (void MathNestInset::doDispatch): remove LFUN_MATH_DELIM test for multiple cells (now in getStatus) (void MathNestInset::doDispatch): Handle LFUN_MATH_BIGDELIM (bool MathNestInset::getStatus): Disable LFUN_MATH_DELIM and LFUN_MATH_BIGDELIM when the selection spans multiple cells * src/frontends/qt3/ui/QDelimiterDialogBase.ui Added a combobox for selecting delimiter size. * src/frontends/qt3/QDelimiterDialog.[Ch] (fix_name, QDelimiterDialog, insertClicked, size_selected): Allow for fixed size delimiters. * src/frontends/gtk/GMathDelim.C: Add FIXME commnent for fixed size delimiters * src/frontends/qt4/QDelimiterDialog.C: ditto * src/frontends/xforms/FormMathsDelim.C: ditto * src/frontends/controllers/ControlMath.[Ch]: Added dispatchBigDelim() to deal with fixed size delimiters. * src/text3.C (void LyXText::dispatch): Handle LFUN_MATH_BIGDELIM (bool LyXText::getStatus): ditto * src/ToolbarBackend.C (string const ToolbarBackend::getIcon): Handle LFUN_MATH_BIGDELIM Index: src/LyXAction.C === --- src/LyXAction.C (Revision 13802) +++ src/LyXAction.C (Arbeitskopie) @@ -212,6 +212,7 @@ void LyXAction::init() { LFUN_MARK_ON, "mark-on", ReadOnly }, { LFUN_MARK_TOGGLE, "mark-toggle", ReadOnly }, { LFUN_MATH_DELIM, "math-delim", Noop }, + { LFUN_MATH_BIGDELIM, "math-bigdelim", Noop }, { LFUN_MATH_DISPLAY, "math-display", Noop }, { LFUN_MATH_INSERT, "math-insert", Noop }, { LFUN_MATH_SUBSCRIPT, "math-subscript", Noop }, Index: src/mathed/math_nestinset.C === --- src/mathed/math_nestinset.C (Revision 13802) +++ src/mathed/math_nestinset.C (Arbeitskopie) @@ -848,7 +848,6 @@ void MathNestInset::doDispatch(LCursor & } case LFUN_MATH_DELIM: { - lyxerr << "MathNestInset::LFUN_MATH_DELIM" << endl; string ls; string rs = lyx::support::split(cmd.argument, ls, ' '); // Reasonable default values @@ -857,9 +856,37 @@ void MathNestInset::doDispatch(LCursor & if (rs.empty()) rs = ')'; recordUndo(cur, Undo::ATOMIC); - // Don't do this with multi-cell selections - if (cur.selBegin().idx() == cur.selEnd().idx()) - cur.handleNest(MathAtom(new MathDelimInset(ls, rs))); + cur.handleNest(MathAtom(new MathDelimInset(ls, rs))); + break; + } + + case LFUN_MATH_BIGDELIM: { + string const lname = cmd.getArg(0); + string const ldelim = cmd.getArg(1); + string const rname = cmd.getArg(2); + string const rdelim = cmd.getArg(3); + latexkeys const * l = in_word_set(lname); + bool const have_l = l && l->inset == "big" && + MathBigInset::isBigInsetDelim(ldelim); + l = in_word_set(rname); + bool const have_r = l && l->inset == "big" && + MathBigInset::isBigInsetDelim(rdelim); + // We mimic LFUN_MATH_DELIM in case we have an empty left + // or right delimiter. + if (have_l || have_r) { + recordUndo(cur, Undo::ATOMIC); + string const selection = grabAndEraseSelection(cur); + selClearOrDel(cur); + if (have_l) +cur.insert(MathAtom(new MathBigInset(lname, +ldelim))); + cur.niceInsert(selection); + if (have_r) +cur.insert(MathAtom(new MathBigInset(rname, +rdelim))); + } + // Don't call cur.undispatched() if we did nothing, this would + // lead to infinite recursion via LyXText::dispatch(). break; } @@ -917,7 +944,7 @@ void MathNestInset::doDispatch(LCursor & } -bool MathNestInset::getStatus(LCursor & /*cur*/, FuncRequest const & cmd, +bool MathNestInset::getStatus(LCursor & cur, FuncRequest const & cmd, FuncStatus & flag) const { // the font related toggles @@ -993,6 +1020,13 @@ bool MathNestInset::getStatus(LCursor & case LFUN_MATH_MATRIX: flag.enabled(currentMode() == MATH_MODE); break; + + case LFUN_MATH_DELIM: + case LFUN_MATH_BIGDELIM: + // Don't do this with multi-cell selections + flag.enabled(cur.selBegin().idx() == cur.selEnd().idx()); + break; + default: ret =
Re: [patch] fix bug 1473: Implement phantom in math
On Sat, May 06, 2006 at 02:18:47PM +0200, Georg Baum wrote: > Am Montag, 1. Mai 2006 20:21 schrieb Enrico Forestieri: > > I just discovered another small problem. > > > > When using the GUI for fixed size delimiters and there is a selection: > > > > 1) if the left delimiter is empty, hitting insert produces nothing; > > > > 2) if the right delimiter is empty, hitting insert the selection is > >replaced. > > This updated patch should work better. If it does, it goes in. It does not > yet address the backspace problem, I will look at that later. This patch works. I take that you mean the "backslash" problem. Is there any glitch with my proposed fix for it? It seems to work well in both 1.4 and 1.5. You will have "\backslash" in a latex file instead of "\\" but it may even help to avoid confusion in an eqnarray, for example. -- Enrico
Re: [patch] fix bug 1473: Implement phantom in math
Am Donnerstag, 27. April 2006 14:12 schrieb Enrico Forestieri: Well, here is the result of my effort. I also attach separately a diff against src/frontends/qt3/ui/moc/Makefile.in and src/frontends/qt3/moc/Makefile.in as svn diff doesn't seem to have catched them. I had to patch them because qt_helpers.h was not found after I edited QDelimiterDialogBase.ui with the Qt3 designer. Includes from Qt3 .ui files are put into the .h file, not the .C file as it was done by Qt2. I solved this problem already with the Qt2 - Qt3 conversion this morning. Please, someone should have a look at QDelimiterDialogBase.ui as I managed to break it wrt resizing and don't know what else (Abdel?). Sorry guys, but I have never programmed Qt or used designer before. I don't know how it happened, but you did more than just inserting the size combo. I guess this was not intended? I removed the additional changes, and now it works. Something as to be done also for Qt4 and gtk, but I leave this to someone more knowledgeable than me, as I risk to do more damage than good ;-) I added FIXMEs. IMO this work is still unfinished, as when there is a selection the fixed size delimiters should be placed at the left and right of it. Instead, currently the selection is replaced by the delimiters. I solved that problem by introducing a new lfun. Apart from that I also changed the code in QDelimiterDialog.C a bit: Translate the combobox items and use static arrays for the delimiter names. The latter has the advantage that it can be easily adapted: Want to support biggg? Just add it to bigleft, bigright and biggui, no other code changes required. The attached patch works well here. If I don't get objections I will put it in tomorrow. Georg Log: Implement GUI for fixed size math delimiters (by Enrico Forestieri and me): * src/lfuns.h (enum kb_action): New lfun LFUN_MATH_BIGDELIM * src/LyXAction.C (void LyXAction::init): New lfun LFUN_MATH_BIGDELIM * src/mathed/math_nestinset.C (void MathNestInset::doDispatch): remove debug message (void MathNestInset::doDispatch): remove LFUN_MATH_DELIM test for multiple cells (now in getStatus) (void MathNestInset::doDispatch): Handle LFUN_MATH_BIGDELIM (bool MathNestInset::getStatus): Disable LFUN_MATH_DELIM and LFUN_MATH_BIGDELIM when the selection spans multiple cells * src/frontends/qt3/ui/QDelimiterDialogBase.ui Added a combobox for selecting delimiter size. * src/frontends/qt3/QDelimiterDialog.[Ch] (fix_name, QDelimiterDialog, insertClicked, size_selected): Allow for fixed size delimiters. * src/frontends/gtk/GMathDelim.C: Add FIXME commnent for fixed size delimiters * src/frontends/qt4/QDelimiterDialog.C: ditto * src/frontends/xforms/FormMathsDelim.C: ditto * src/frontends/controllers/ControlMath.[Ch]: Added dispatchBigDelim() to deal with fixed size delimiters. * src/text3.C (void LyXText::dispatch): Handle LFUN_MATH_BIGDELIM (bool LyXText::getStatus): ditto * src/ToolbarBackend.C (string const ToolbarBackend::getIcon): Handle LFUN_MATH_BIGDELIM Index: src/LyXAction.C === --- src/LyXAction.C (Revision 13785) +++ src/LyXAction.C (Arbeitskopie) @@ -212,6 +212,7 @@ void LyXAction::init() { LFUN_MARK_ON, mark-on, ReadOnly }, { LFUN_SETMARK, mark-toggle, ReadOnly }, { LFUN_MATH_DELIM, math-delim, Noop }, + { LFUN_MATH_BIGDELIM, math-bigdelim, Noop }, { LFUN_MATH_DISPLAY, math-display, Noop }, { LFUN_INSERT_MATH, math-insert, Noop }, { LFUN_SUBSCRIPT, math-subscript, Noop }, Index: src/mathed/math_nestinset.C === --- src/mathed/math_nestinset.C (Revision 13786) +++ src/mathed/math_nestinset.C (Arbeitskopie) @@ -848,7 +848,6 @@ void MathNestInset::doDispatch(LCursor } case LFUN_MATH_DELIM: { - lyxerr MathNestInset::LFUN_MATH_DELIM endl; string ls; string rs = lyx::support::split(cmd.argument, ls, ' '); // Reasonable default values @@ -857,9 +856,34 @@ void MathNestInset::doDispatch(LCursor if (rs.empty()) rs = ')'; recordUndo(cur, Undo::ATOMIC); - // Don't do this with multi-cell selections - if (cur.selBegin().idx() == cur.selEnd().idx()) - cur.handleNest(MathAtom(new MathDelimInset(ls, rs))); + cur.handleNest(MathAtom(new MathDelimInset(ls, rs))); + break; + } + + case LFUN_MATH_BIGDELIM: { + string const lname = cmd.getArg(0); + string const ldelim = cmd.getArg(1); + string const rname = cmd.getArg(2); + string const rdelim = cmd.getArg(3); + latexkeys const * l = in_word_set(lname); + if (l l-inset == big + MathBigInset::isBigInsetDelim(ldelim)) { + // Simply replace the selection by the delimiter if + // we have only one. Insert the delimiters around the +
Re: [patch] fix bug 1473: Implement phantom in math
On Mon, May 01, 2006 at 03:08:06PM +0200, Georg Baum wrote: Am Donnerstag, 27. April 2006 14:12 schrieb Enrico Forestieri: Please, someone should have a look at QDelimiterDialogBase.ui as I managed to break it wrt resizing and don't know what else (Abdel?). Sorry guys, but I have never programmed Qt or used designer before. I don't know how it happened, but you did more than just inserting the size combo. I guess this was not intended? I removed the additional changes, and now it works. I remember that designer won't let me adding the combobox without breaking the layout containing the checkbox Keep matched, so I broke it, added the combobox and restored it. But clearly I did something wrong. IMO this work is still unfinished, as when there is a selection the fixed size delimiters should be placed at the left and right of it. Instead, currently the selection is replaced by the delimiters. I solved that problem by introducing a new lfun. It works well. Apart from that I also changed the code in QDelimiterDialog.C a bit: Translate the combobox items and use static arrays for the delimiter names. The latter has the advantage that it can be easily adapted: Want to support biggg? Just add it to bigleft, bigright and biggui, no other code changes required. The attached patch works well here. If I don't get objections I will put it in tomorrow. There is a small problem with the \ delimiter as it isn't recognized. Please find attached an updated patch fixing that. The problem with \ is also in 1.4. I attach a patch for this, too. -- Enrico Index: src/LyXAction.C === --- src/LyXAction.C (revision 13787) +++ src/LyXAction.C (working copy) @@ -212,6 +212,7 @@ void LyXAction::init() { LFUN_MARK_ON, mark-on, ReadOnly }, { LFUN_SETMARK, mark-toggle, ReadOnly }, { LFUN_MATH_DELIM, math-delim, Noop }, + { LFUN_MATH_BIGDELIM, math-bigdelim, Noop }, { LFUN_MATH_DISPLAY, math-display, Noop }, { LFUN_INSERT_MATH, math-insert, Noop }, { LFUN_SUBSCRIPT, math-subscript, Noop }, Index: src/mathed/math_nestinset.C === --- src/mathed/math_nestinset.C (revision 13787) +++ src/mathed/math_nestinset.C (working copy) @@ -848,7 +848,6 @@ void MathNestInset::doDispatch(LCursor } case LFUN_MATH_DELIM: { - lyxerr MathNestInset::LFUN_MATH_DELIM endl; string ls; string rs = lyx::support::split(cmd.argument, ls, ' '); // Reasonable default values @@ -857,9 +856,34 @@ void MathNestInset::doDispatch(LCursor if (rs.empty()) rs = ')'; recordUndo(cur, Undo::ATOMIC); - // Don't do this with multi-cell selections - if (cur.selBegin().idx() == cur.selEnd().idx()) - cur.handleNest(MathAtom(new MathDelimInset(ls, rs))); + cur.handleNest(MathAtom(new MathDelimInset(ls, rs))); + break; + } + + case LFUN_MATH_BIGDELIM: { + string const lname = cmd.getArg(0); + string const ldelim = cmd.getArg(1); + string const rname = cmd.getArg(2); + string const rdelim = cmd.getArg(3); + latexkeys const * l = in_word_set(lname); + if (l l-inset == big + MathBigInset::isBigInsetDelim(ldelim)) { + // Simply replace the selection by the delimiter if + // we have only one. Insert the delimiters around the + // selection otherwise. + recordUndo(cur, Undo::ATOMIC); + string const selection = grabAndEraseSelection(cur); + selClearOrDel(cur); + cur.insert(MathAtom(new MathBigInset(lname, ldelim))); + latexkeys const * l = in_word_set(rname); + if (l l-inset == big + MathBigInset::isBigInsetDelim(rdelim)) + cur.niceInsert(selection); + cur.insert(MathAtom(new MathBigInset(rname, + rdelim))); + } + // Don't call cur.undispatched() if we did nothing, this would + // lead to infinite recursion via LyXText::dispatch(). break; } @@ -917,7 +941,7 @@ void MathNestInset::doDispatch(LCursor } -bool MathNestInset::getStatus(LCursor /*cur*/, FuncRequest const cmd, +bool MathNestInset::getStatus(LCursor cur, FuncRequest const cmd, FuncStatus flag) const { // the font related toggles @@ -993,6 +1017,13 @@ bool
Re: [patch] fix bug 1473: Implement phantom in math
Am Montag, 1. Mai 2006 18:23 schrieb Enrico Forestieri: There is a small problem with the \ delimiter as it isn't recognized. Please find attached an updated patch fixing that. The problem with \ is also in 1.4. I attach a patch for this, too. Do I understand you correctly that \ is broken for variable delimiters, too, and that your patch fixes it for all fixed and variable delimiters? Georg
Re: [patch] fix bug 1473: Implement phantom in math
On Mon, May 01, 2006 at 07:54:05PM +0200, Georg Baum wrote: Am Montag, 1. Mai 2006 18:23 schrieb Enrico Forestieri: There is a small problem with the \ delimiter as it isn't recognized. Please find attached an updated patch fixing that. The problem with \ is also in 1.4. I attach a patch for this, too. Do I understand you correctly that \ is broken for variable delimiters, too, and that your patch fixes it for all fixed and variable delimiters? Right. -- Enrico
Re: [patch] fix bug 1473: Implement phantom in math
On Mon, May 01, 2006 at 08:09:05PM +0200, Enrico Forestieri wrote: On Mon, May 01, 2006 at 07:54:05PM +0200, Georg Baum wrote: Am Montag, 1. Mai 2006 18:23 schrieb Enrico Forestieri: There is a small problem with the \ delimiter as it isn't recognized. Please find attached an updated patch fixing that. The problem with \ is also in 1.4. I attach a patch for this, too. Do I understand you correctly that \ is broken for variable delimiters, too, and that your patch fixes it for all fixed and variable delimiters? Right. I just discovered another small problem. When using the GUI for fixed size delimiters and there is a selection: 1) if the left delimiter is empty, hitting insert produces nothing; 2) if the right delimiter is empty, hitting insert the selection is replaced. -- Enrico
Re: [patch] fix bug 1473: Implement phantom in math
Am Donnerstag, 27. April 2006 14:12 schrieb Enrico Forestieri: > Well, here is the result of my effort. I also attach separately a diff > against src/frontends/qt3/ui/moc/Makefile.in and > src/frontends/qt3/moc/Makefile.in as "svn diff" doesn't seem to have > catched them. I had to patch them because "qt_helpers.h" was not found > after I edited QDelimiterDialogBase.ui with the Qt3 designer. Includes from Qt3 .ui files are put into the .h file, not the .C file as it was done by Qt2. I solved this problem already with the Qt2 -> Qt3 conversion this morning. > Please, someone should have a look at QDelimiterDialogBase.ui as I > managed to break it wrt resizing and don't know what else (Abdel?). > Sorry guys, but I have never programmed Qt or used designer before. I don't know how it happened, but you did more than just inserting the size combo. I guess this was not intended? I removed the additional changes, and now it works. > Something as to be done also for Qt4 and gtk, but I leave this to > someone more knowledgeable than me, as I risk to do more damage than > good ;-) I added FIXMEs. > IMO this work is still unfinished, as when there is a selection the > fixed size delimiters should be placed at the left and right of it. > Instead, currently the selection is replaced by the delimiters. I solved that problem by introducing a new lfun. Apart from that I also changed the code in QDelimiterDialog.C a bit: Translate the combobox items and use static arrays for the delimiter names. The latter has the advantage that it can be easily adapted: Want to support biggg? Just add it to bigleft, bigright and biggui, no other code changes required. The attached patch works well here. If I don't get objections I will put it in tomorrow. Georg Log: Implement GUI for fixed size math delimiters (by Enrico Forestieri and me): * src/lfuns.h (enum kb_action): New lfun LFUN_MATH_BIGDELIM * src/LyXAction.C (void LyXAction::init): New lfun LFUN_MATH_BIGDELIM * src/mathed/math_nestinset.C (void MathNestInset::doDispatch): remove debug message (void MathNestInset::doDispatch): remove LFUN_MATH_DELIM test for multiple cells (now in getStatus) (void MathNestInset::doDispatch): Handle LFUN_MATH_BIGDELIM (bool MathNestInset::getStatus): Disable LFUN_MATH_DELIM and LFUN_MATH_BIGDELIM when the selection spans multiple cells * src/frontends/qt3/ui/QDelimiterDialogBase.ui Added a combobox for selecting delimiter size. * src/frontends/qt3/QDelimiterDialog.[Ch] (fix_name, QDelimiterDialog, insertClicked, size_selected): Allow for fixed size delimiters. * src/frontends/gtk/GMathDelim.C: Add FIXME commnent for fixed size delimiters * src/frontends/qt4/QDelimiterDialog.C: ditto * src/frontends/xforms/FormMathsDelim.C: ditto * src/frontends/controllers/ControlMath.[Ch]: Added dispatchBigDelim() to deal with fixed size delimiters. * src/text3.C (void LyXText::dispatch): Handle LFUN_MATH_BIGDELIM (bool LyXText::getStatus): ditto * src/ToolbarBackend.C (string const ToolbarBackend::getIcon): Handle LFUN_MATH_BIGDELIM Index: src/LyXAction.C === --- src/LyXAction.C (Revision 13785) +++ src/LyXAction.C (Arbeitskopie) @@ -212,6 +212,7 @@ void LyXAction::init() { LFUN_MARK_ON, "mark-on", ReadOnly }, { LFUN_SETMARK, "mark-toggle", ReadOnly }, { LFUN_MATH_DELIM, "math-delim", Noop }, + { LFUN_MATH_BIGDELIM, "math-bigdelim", Noop }, { LFUN_MATH_DISPLAY, "math-display", Noop }, { LFUN_INSERT_MATH, "math-insert", Noop }, { LFUN_SUBSCRIPT, "math-subscript", Noop }, Index: src/mathed/math_nestinset.C === --- src/mathed/math_nestinset.C (Revision 13786) +++ src/mathed/math_nestinset.C (Arbeitskopie) @@ -848,7 +848,6 @@ void MathNestInset::doDispatch(LCursor & } case LFUN_MATH_DELIM: { - lyxerr << "MathNestInset::LFUN_MATH_DELIM" << endl; string ls; string rs = lyx::support::split(cmd.argument, ls, ' '); // Reasonable default values @@ -857,9 +856,34 @@ void MathNestInset::doDispatch(LCursor & if (rs.empty()) rs = ')'; recordUndo(cur, Undo::ATOMIC); - // Don't do this with multi-cell selections - if (cur.selBegin().idx() == cur.selEnd().idx()) - cur.handleNest(MathAtom(new MathDelimInset(ls, rs))); + cur.handleNest(MathAtom(new MathDelimInset(ls, rs))); + break; + } + + case LFUN_MATH_BIGDELIM: { + string const lname = cmd.getArg(0); + string const ldelim = cmd.getArg(1); + string const rname = cmd.getArg(2); + string const rdelim = cmd.getArg(3); + latexkeys const * l = in_word_set(lname); + if (l && l->inset == "big" && + MathBigInset::isBigInsetDelim(ldelim)) { + // Simply replace the selection by the delimiter if + // we
Re: [patch] fix bug 1473: Implement phantom in math
On Mon, May 01, 2006 at 03:08:06PM +0200, Georg Baum wrote: > Am Donnerstag, 27. April 2006 14:12 schrieb Enrico Forestieri: > > Please, someone should have a look at QDelimiterDialogBase.ui as I > > managed to break it wrt resizing and don't know what else (Abdel?). > > Sorry guys, but I have never programmed Qt or used designer before. > > I don't know how it happened, but you did more than just inserting the > size combo. I guess this was not intended? I removed the additional > changes, and now it works. I remember that designer won't let me adding the combobox without breaking the layout containing the checkbox "Keep matched", so I broke it, added the combobox and restored it. But clearly I did something wrong. > > IMO this work is still unfinished, as when there is a selection the > > fixed size delimiters should be placed at the left and right of it. > > Instead, currently the selection is replaced by the delimiters. > > I solved that problem by introducing a new lfun. It works well. > Apart from that I also changed the code in QDelimiterDialog.C a bit: > Translate the combobox items and use static arrays for the delimiter > names. The latter has the advantage that it can be easily adapted: Want > to support biggg? Just add it to bigleft, bigright and biggui, no other > code changes required. > > The attached patch works well here. If I don't get objections I will put > it in tomorrow. There is a small problem with the "\" delimiter as it isn't recognized. Please find attached an updated patch fixing that. The problem with "\" is also in 1.4. I attach a patch for this, too. -- Enrico Index: src/LyXAction.C === --- src/LyXAction.C (revision 13787) +++ src/LyXAction.C (working copy) @@ -212,6 +212,7 @@ void LyXAction::init() { LFUN_MARK_ON, "mark-on", ReadOnly }, { LFUN_SETMARK, "mark-toggle", ReadOnly }, { LFUN_MATH_DELIM, "math-delim", Noop }, + { LFUN_MATH_BIGDELIM, "math-bigdelim", Noop }, { LFUN_MATH_DISPLAY, "math-display", Noop }, { LFUN_INSERT_MATH, "math-insert", Noop }, { LFUN_SUBSCRIPT, "math-subscript", Noop }, Index: src/mathed/math_nestinset.C === --- src/mathed/math_nestinset.C (revision 13787) +++ src/mathed/math_nestinset.C (working copy) @@ -848,7 +848,6 @@ void MathNestInset::doDispatch(LCursor & } case LFUN_MATH_DELIM: { - lyxerr << "MathNestInset::LFUN_MATH_DELIM" << endl; string ls; string rs = lyx::support::split(cmd.argument, ls, ' '); // Reasonable default values @@ -857,9 +856,34 @@ void MathNestInset::doDispatch(LCursor & if (rs.empty()) rs = ')'; recordUndo(cur, Undo::ATOMIC); - // Don't do this with multi-cell selections - if (cur.selBegin().idx() == cur.selEnd().idx()) - cur.handleNest(MathAtom(new MathDelimInset(ls, rs))); + cur.handleNest(MathAtom(new MathDelimInset(ls, rs))); + break; + } + + case LFUN_MATH_BIGDELIM: { + string const lname = cmd.getArg(0); + string const ldelim = cmd.getArg(1); + string const rname = cmd.getArg(2); + string const rdelim = cmd.getArg(3); + latexkeys const * l = in_word_set(lname); + if (l && l->inset == "big" && + MathBigInset::isBigInsetDelim(ldelim)) { + // Simply replace the selection by the delimiter if + // we have only one. Insert the delimiters around the + // selection otherwise. + recordUndo(cur, Undo::ATOMIC); + string const selection = grabAndEraseSelection(cur); + selClearOrDel(cur); + cur.insert(MathAtom(new MathBigInset(lname, ldelim))); + latexkeys const * l = in_word_set(rname); + if (l && l->inset == "big" && + MathBigInset::isBigInsetDelim(rdelim)) + cur.niceInsert(selection); + cur.insert(MathAtom(new MathBigInset(rname, + rdelim))); + } + // Don't call cur.undispatched() if we did nothing, this would + // lead to infinite recursion via LyXText::dispatch(). break; } @@ -917,7 +941,7 @@ void MathNestInset::doDispatch(LCursor & } -bool MathNestInset::getStatus(LCursor & /*cur*/, FuncRequest const & cmd, +bool MathNestInset::getStatus(LCursor & cur, FuncRequest const & cmd, FuncStatus & flag) const { //
Re: [patch] fix bug 1473: Implement phantom in math
Am Montag, 1. Mai 2006 18:23 schrieb Enrico Forestieri: > There is a small problem with the "\" delimiter as it isn't recognized. > Please find attached an updated patch fixing that. The problem with "\" > is also in 1.4. I attach a patch for this, too. Do I understand you correctly that "\" is broken for variable delimiters, too, and that your patch fixes it for all fixed and variable delimiters? Georg
Re: [patch] fix bug 1473: Implement phantom in math
On Mon, May 01, 2006 at 07:54:05PM +0200, Georg Baum wrote: > Am Montag, 1. Mai 2006 18:23 schrieb Enrico Forestieri: > > > There is a small problem with the "\" delimiter as it isn't recognized. > > Please find attached an updated patch fixing that. The problem with "\" > > is also in 1.4. I attach a patch for this, too. > > Do I understand you correctly that "\" is broken for variable delimiters, > too, and that your patch fixes it for all fixed and variable delimiters? Right. -- Enrico
Re: [patch] fix bug 1473: Implement phantom in math
On Mon, May 01, 2006 at 08:09:05PM +0200, Enrico Forestieri wrote: > On Mon, May 01, 2006 at 07:54:05PM +0200, Georg Baum wrote: > > > Am Montag, 1. Mai 2006 18:23 schrieb Enrico Forestieri: > > > > > There is a small problem with the "\" delimiter as it isn't recognized. > > > Please find attached an updated patch fixing that. The problem with "\" > > > is also in 1.4. I attach a patch for this, too. > > > > Do I understand you correctly that "\" is broken for variable delimiters, > > too, and that your patch fixes it for all fixed and variable delimiters? > > Right. I just discovered another small problem. When using the GUI for fixed size delimiters and there is a selection: 1) if the left delimiter is empty, hitting insert produces nothing; 2) if the right delimiter is empty, hitting insert the selection is replaced. -- Enrico
Re: [patch] fix bug 1473: Implement phantom in math
Am Donnerstag, 27. April 2006 20:18 schrieb Andre Poenitz: On Thu, Apr 27, 2006 at 09:24:42AM +0200, Georg Baum wrote: In any case, all magic should go to interpret() Co., not to LCursor::plainInsert(). That works for one-character delimiters, but not for things like \Vert. It should be possible to introduce a second interpret method that is called from LCursor::macroModeClose() and LCursor::insert(). Would that be OK with you? Yes. If you want I'll revert the changes to plainInsert, Please. but I am not going to implement the cell based solution, since I don't like it UI-wise at all. Fine with me as long as no special case math stuff goes to LCursor. Here is the patch that is going in soon. There is still a bit of math stuff in LCursor::macroModeClose(), but that is no surprise since the whole method is math-specific. Georg Log: Code cleanup of \bigl related stuff: * src/cursor.C (LCursor::plainInsert): Move special \bigl stuff from here to MathNestInset::interpret (LCursor::macroModeClose): try to intepret the current macro before it is simply inserted * src/mathed/math_nestinset.C (MathNestInset::doDispatch): try to intepret the argument of LFUN_SELFINSERT also if it is longer than one character * src/mathed/math_nestinset.[Ch] (MathNestInset::interpret): new, moved from LCursor::plainInsert Index: src/cursor.C === --- src/cursor.C (Revision 13784) +++ src/cursor.C (Arbeitskopie) @@ -35,7 +35,6 @@ #include insets/insettabular.h #include insets/insettext.h -#include mathed/math_biginset.h #include mathed/math_data.h #include mathed/math_inset.h #include mathed/math_scriptinset.h @@ -652,22 +651,6 @@ void LCursor::markErase() void LCursor::plainInsert(MathAtom const t) { - // Create a MathBigInset from cell()[pos() - 1] and t if possible - if (!empty() pos() 0 cell()[pos() - 1]-asUnknownInset()) { - string const name = asString(t); - if (MathBigInset::isBigInsetDelim(name)) { - string prev = asString(cell()[pos() - 1]); - if (prev[0] == '\\') { -prev = prev.substr(1); -latexkeys const * l = in_word_set(prev); -if (l l-inset == big) { - cell()[pos() - 1] = - MathAtom(new MathBigInset(prev, name)); - return; -} - } - } - } cell().insert(pos(), t); ++pos(); } @@ -877,6 +860,9 @@ bool LCursor::macroModeClose() if (macro macro-getInsetName() == name) lyxerr can't enter recursive macro endl; + MathNestInset * const in = inset().asMathInset()-asNestInset(); + if (in in-interpret(*this, s)) + return true; plainInsert(createMathInset(name)); return true; } Index: src/mathed/math_nestinset.C === --- src/mathed/math_nestinset.C (Revision 13784) +++ src/mathed/math_nestinset.C (Arbeitskopie) @@ -664,7 +664,8 @@ void MathNestInset::doDispatch(LCursor case LFUN_SELFINSERT: if (cmd.argument.size() != 1) { recordUndo(cur); - cur.insert(cmd.argument); + if (!interpret(cur, cmd.argument)) +cur.insert(cmd.argument); break; } // Don't record undo steps if we are in macro mode and @@ -1146,7 +1147,7 @@ bool MathNestInset::interpret(LCursor } // One character big delimiters. The others are handled in - // LCursor::plainInsert. + // the other interpret() method. latexkeys const * l = in_word_set(name.substr(1)); if (name[0] == '\\' l l-inset == big) { string delim; @@ -1251,8 +1252,8 @@ bool MathNestInset::interpret(LCursor } } - if (c == '{' || c == '}' || c == '' || c == '$' || c == '#' || c == '%' - || c == '_' || c == '^') { + if (c == '{' || c == '}' || c == '' || c == '$' || c == '#' || + c == '%' || c == '_' || c == '^') { cur.niceInsert(createMathInset(string(1, c))); return true; } @@ -1269,6 +1270,29 @@ bool MathNestInset::interpret(LCursor } +bool MathNestInset::interpret(LCursor cur, string const str) +{ + // Create a MathBigInset from cur.cell()[cur.pos() - 1] and t if + // possible + if (!cur.empty() cur.pos() 0 + cur.cell()[cur.pos() - 1]-asUnknownInset()) { + if (MathBigInset::isBigInsetDelim(str)) { + string prev = asString(cur.cell()[cur.pos() - 1]); + if (prev[0] == '\\') { +prev = prev.substr(1); +latexkeys const * l = in_word_set(prev); +if (l l-inset == big) { + cur.cell()[cur.pos() - 1] = + MathAtom(new MathBigInset(prev, str)); + return true; +} + } + } + } + return false; +} + + bool MathNestInset::script(LCursor cur, bool up, string const save_selection) { Index: src/mathed/math_nestinset.h === --- src/mathed/math_nestinset.h (Revision 13784) +++ src/mathed/math_nestinset.h (Arbeitskopie) @@ -107,12 +107,18 @@ protected: /// void handleFont2(LCursor cur, std::string
Re: [patch] fix bug 1473: Implement phantom in math
Am Donnerstag, 27. April 2006 20:18 schrieb Andre Poenitz: > On Thu, Apr 27, 2006 at 09:24:42AM +0200, Georg Baum wrote: > > > In any case, all magic should go to interpret() & Co., not to > > > LCursor::plainInsert(). > > > > That works for one-character delimiters, but not for things like \Vert. It > > should be possible to introduce a second interpret method that is called > > from LCursor::macroModeClose() and LCursor::insert(). Would that be OK with > > you? > > Yes. > > > If you want I'll revert the changes to plainInsert, > > Please. > > > but I am not going to implement the cell based solution, since I don't > > like it UI-wise at all. > > Fine with me as long as no special case math stuff goes to LCursor. Here is the patch that is going in soon. There is still a bit of math stuff in LCursor::macroModeClose(), but that is no surprise since the whole method is math-specific. Georg Log: Code cleanup of \bigl related stuff: * src/cursor.C (LCursor::plainInsert): Move special \bigl stuff from here to MathNestInset::interpret (LCursor::macroModeClose): try to intepret the current macro before it is simply inserted * src/mathed/math_nestinset.C (MathNestInset::doDispatch): try to intepret the argument of LFUN_SELFINSERT also if it is longer than one character * src/mathed/math_nestinset.[Ch] (MathNestInset::interpret): new, moved from LCursor::plainInsert Index: src/cursor.C === --- src/cursor.C (Revision 13784) +++ src/cursor.C (Arbeitskopie) @@ -35,7 +35,6 @@ #include "insets/insettabular.h" #include "insets/insettext.h" -#include "mathed/math_biginset.h" #include "mathed/math_data.h" #include "mathed/math_inset.h" #include "mathed/math_scriptinset.h" @@ -652,22 +651,6 @@ void LCursor::markErase() void LCursor::plainInsert(MathAtom const & t) { - // Create a MathBigInset from cell()[pos() - 1] and t if possible - if (!empty() && pos() > 0 && cell()[pos() - 1]->asUnknownInset()) { - string const name = asString(t); - if (MathBigInset::isBigInsetDelim(name)) { - string prev = asString(cell()[pos() - 1]); - if (prev[0] == '\\') { -prev = prev.substr(1); -latexkeys const * l = in_word_set(prev); -if (l && l->inset == "big") { - cell()[pos() - 1] = - MathAtom(new MathBigInset(prev, name)); - return; -} - } - } - } cell().insert(pos(), t); ++pos(); } @@ -877,6 +860,9 @@ bool LCursor::macroModeClose() if (macro && macro->getInsetName() == name) lyxerr << "can't enter recursive macro" << endl; + MathNestInset * const in = inset().asMathInset()->asNestInset(); + if (in && in->interpret(*this, s)) + return true; plainInsert(createMathInset(name)); return true; } Index: src/mathed/math_nestinset.C === --- src/mathed/math_nestinset.C (Revision 13784) +++ src/mathed/math_nestinset.C (Arbeitskopie) @@ -664,7 +664,8 @@ void MathNestInset::doDispatch(LCursor & case LFUN_SELFINSERT: if (cmd.argument.size() != 1) { recordUndo(cur); - cur.insert(cmd.argument); + if (!interpret(cur, cmd.argument)) +cur.insert(cmd.argument); break; } // Don't record undo steps if we are in macro mode and @@ -1146,7 +1147,7 @@ bool MathNestInset::interpret(LCursor & } // One character big delimiters. The others are handled in - // LCursor::plainInsert. + // the other interpret() method. latexkeys const * l = in_word_set(name.substr(1)); if (name[0] == '\\' && l && l->inset == "big") { string delim; @@ -1251,8 +1252,8 @@ bool MathNestInset::interpret(LCursor & } } - if (c == '{' || c == '}' || c == '&' || c == '$' || c == '#' || c == '%' - || c == '_' || c == '^') { + if (c == '{' || c == '}' || c == '&' || c == '$' || c == '#' || + c == '%' || c == '_' || c == '^') { cur.niceInsert(createMathInset(string(1, c))); return true; } @@ -1269,6 +1270,29 @@ bool MathNestInset::interpret(LCursor & } +bool MathNestInset::interpret(LCursor & cur, string const & str) +{ + // Create a MathBigInset from cur.cell()[cur.pos() - 1] and t if + // possible + if (!cur.empty() && cur.pos() > 0 && + cur.cell()[cur.pos() - 1]->asUnknownInset()) { + if (MathBigInset::isBigInsetDelim(str)) { + string prev = asString(cur.cell()[cur.pos() - 1]); + if (prev[0] == '\\') { +prev = prev.substr(1); +latexkeys const * l = in_word_set(prev); +if (l && l->inset == "big") { + cur.cell()[cur.pos() - 1] = + MathAtom(new MathBigInset(prev, str)); + return true; +} + } + } + } + return false; +} + + bool MathNestInset::script(LCursor & cur, bool up, string const & save_selection) { Index: src/mathed/math_nestinset.h === --- src/mathed/math_nestinset.h (Revision 13784) +++ src/mathed/math_nestinset.h
Re: [patch] fix bug 1473: Implement phantom in math
Enrico Forestieri wrote: Now I am beginning to understand the magic. So, after AC_SUBST(FOO, [bar]) I only need to write myvar = $(FOO) in Makefile.am and I will find FOO = @FOO@ ... myvar = $(FOO) in Makefile.in. Cool. There should be a better way than info autoconf to try to learn all these exciting features. You don't want to really know them. The auto* stuff started as a well meant effort to overcome differences of different unix flavours, but is overcomplicated and too slow now. Georg
Re: [patch] fix bug 1473: Implement phantom in math
Enrico Forestieri wrote: > Now I am beginning to understand the magic. So, after > > AC_SUBST(FOO, [bar]) > > I only need to write > > myvar = $(FOO) > > in Makefile.am and I will find > > FOO = @FOO@ > ... > myvar = $(FOO) > > in Makefile.in. Cool. There should be a better way than "info autoconf" > to try to learn all these exciting features. You don't want to really know them. The auto* stuff started as a well meant effort to overcome differences of different unix flavours, but is overcomplicated and too slow now. Georg
Re: [patch] fix bug 1473: Implement phantom in math
Andre Poenitz wrote: Restricting input in cell is something we stubled over already in e.g. the number of macro arguments. So it looks like some generic solution is wanted, i.e. something like a 'cell property'. This is not the only problem: If we made the delimiter a cell we would have bad UI IMHO: Enter the inset and type somthing. Then leave it, and it will change from a cell to something else with different dimensions. This is the case for macros already, but to use your words: That does not make it any better. In the case of macros there is a need to edit the arguments, but big delimiters are IMHO more like symbols (and it is to my knowledge not possible to change the delimiter of a \left...\right combination after inserting it, so that would be consistent). In any case, all magic should go to interpret() Co., not to LCursor::plainInsert(). That works for one-character delimiters, but not for things like \Vert. It should be possible to introduce a second interpret method that is called from LCursor::macroModeClose() and LCursor::insert(). Would that be OK with you? If you want I'll revert the changes to plainInsert, but I am not going to implement the cell based solution, since I don't like it UI-wise at all. Georg
Re: [patch] fix bug 1473: Implement phantom in math
Jean-Marc Lasgouttes wrote: Georg == Georg Baum [EMAIL PROTECTED] writes: Georg If you want I'll revert the changes to plainInsert, but I am Georg not going to implement the cell based solution, since I don't Georg like it UI-wise at all. What do you want to do UI-wise? Nothing. The expert UI (typing \bigl( or \bigr\Vert) works, and Enrico wanted to modify the existing delimiter dialog of the math panel to cover fixed size delimiters as well. If André does not agree to the plainInsert - extra interpret method change it will not be possible to insert delimiters with more than one character like \bigr\Vert at all (well it will be possible, but they will not be recognized and displayed in red). This is IMHO still better than the cell based solution with changing on-screen display. Georg
Re: [patch] fix bug 1473: Implement phantom in math
Andre Poenitz wrote: On Wed, Apr 26, 2006 at 09:30:51AM +0200, Georg Baum wrote: Andre Poenitz wrote: Is it? I thought also the item to the left or right was considered. Then the attached patch should make it work, but it does not. Hm, so then there is some hardcoded trickery to show symbols like \alpha somewhere. Somthing like that existed at least at some point of time. It does still exist, but the method is called infoize2. The attached works and goes in now. Georg Log: * src/mathed/math_biginset.[Ch] (infoize2): Implement to show name if the cursor is to the rightIndex: src/mathed/math_biginset.C === --- src/mathed/math_biginset.C (Revision 13752) +++ src/mathed/math_biginset.C (Arbeitskopie) @@ -98,6 +98,12 @@ void MathBigInset::normalize(NormalStrea } +void MathBigInset::infoize2(std::ostream os) const +{ + os name_; +} + + bool MathBigInset::isBigInsetDelim(string const delim) { // mathed_draw_deco must handle these Index: src/mathed/math_biginset.h === --- src/mathed/math_biginset.h (Revision 13752) +++ src/mathed/math_biginset.h (Arbeitskopie) @@ -32,6 +32,8 @@ public: /// void normalize(NormalStream os) const; /// + void infoize2(std::ostream os) const; + /// static bool isBigInsetDelim(std::string const ); private:
Re: [patch] fix bug 1473: Implement phantom in math
Georg == Georg Baum [EMAIL PROTECTED] writes: Georg If you want I'll revert the changes to plainInsert, but I am Georg not going to implement the cell based solution, since I don't Georg like it UI-wise at all. What do you want to do UI-wise? JMarc
Re: [patch] fix bug 1473: Implement phantom in math
On Thu, Apr 27, 2006 at 10:42:58AM +0200, Georg Baum wrote: Jean-Marc Lasgouttes wrote: Georg == Georg Baum [EMAIL PROTECTED] writes: Georg If you want I'll revert the changes to plainInsert, but I am Georg not going to implement the cell based solution, since I don't Georg like it UI-wise at all. What do you want to do UI-wise? Nothing. The expert UI (typing \bigl( or \bigr\Vert) works, and Enrico wanted to modify the existing delimiter dialog of the math panel to cover fixed size delimiters as well. Well, here is the result of my effort. I also attach separately a diff against src/frontends/qt3/ui/moc/Makefile.in and src/frontends/qt3/moc/Makefile.in as svn diff doesn't seem to have catched them. I had to patch them because qt_helpers.h was not found after I edited QDelimiterDialogBase.ui with the Qt3 designer. Please, someone should have a look at QDelimiterDialogBase.ui as I managed to break it wrt resizing and don't know what else (Abdel?). Sorry guys, but I have never programmed Qt or used designer before. Something as to be done also for Qt4 and gtk, but I leave this to someone more knowledgeable than me, as I risk to do more damage than good ;-) IMO this work is still unfinished, as when there is a selection the fixed size delimiters should be placed at the left and right of it. Instead, currently the selection is replaced by the delimiters. I am sorry but I fear that this is beyond my capabilities, yet. Log: * src/frontends/qt3/QDelimiterDialog.[Ch] (fix_name, QDelimiterDialog, insertClicked, size_selected): Allow for fixed size delimiters. * src/frontends/qt3/ui/QDelimiterDialogBase.ui: Added a combobox for selecting delimiter size. * src/frontends/controllers/ControlMath.[Ch]: Added dispatchBigDelim() to deal with fixed size delimiters. * src/frontends/qt3/moc/Makefile.in, src/frontends/qt3/ui/moc/Makefile.in: Added -I$(top_srcdir)/src/frontends/qt3 to DEFAULT_INCLUDES. -- Enrico Index: src/frontends/qt3/QDelimiterDialog.C === --- src/frontends/qt3/QDelimiterDialog.C(revision 13757) +++ src/frontends/qt3/QDelimiterDialog.C(working copy) @@ -21,6 +21,7 @@ #include qlabel.h #include qpixmap.h #include qcheckbox.h +#include qcombobox.h using std::string; @@ -59,7 +60,7 @@ string do_match(const string str) } -string fix_name(const string str) +string fix_name(const string str, bool big) { if (str == slash) return /; @@ -67,7 +68,10 @@ string fix_name(const string str) return \\; if (str == empty) return .; - return str; + if (!big || str == ( || str == ) || str == [ || str == ]) + return str; + + return \\ + str; } } // namespace anon @@ -89,11 +93,19 @@ QDelimiterDialog::QDelimiterDialog(QMath leftIP-add(QPixmap(toqstr(empty_xpm)), empty, empty); rightIP-add(QPixmap(toqstr(empty_xpm)), empty, empty); + delimSize-insertItem(Variable size); + delimSize-insertItem(big size); + delimSize-insertItem(Big size); + delimSize-insertItem(bigg size); + delimSize-insertItem(Bigg size); + size_ = 0; // Leave these std:: qualifications alone ! connect(leftIP, SIGNAL(button_clicked(const std::string )), this, SLOT(ldelim_clicked(const std::string ))); connect(rightIP, SIGNAL(button_clicked(const std::string )), this, SLOT(rdelim_clicked(const std::string ))); + connect(delimSize, SIGNAL(activated(int)), + this, SLOT(size_selected(int)) ); ldelim_clicked((); rdelim_clicked()); } @@ -101,7 +113,34 @@ QDelimiterDialog::QDelimiterDialog(QMath void QDelimiterDialog::insertClicked() { - form_-controller().dispatchDelim(fix_name(left_) + ' ' + fix_name(right_)); + switch (size_) { + default: + case 0: + form_-controller().dispatchDelim( + fix_name(left_, false) + + ' ' + fix_name(right_, false)); + break; + case 1: + form_-controller().dispatchBigDelim( + \\bigl + fix_name(left_, true) + + \\bigr + fix_name(right_, true)); + break; + case 2: + form_-controller().dispatchBigDelim( + \\Bigl + fix_name(left_, true) + + \\Bigr + fix_name(right_, true)); + break; + case 3: + form_-controller().dispatchBigDelim( + \\biggl + fix_name(left_, true) + +
Re: [patch] fix bug 1473: Implement phantom in math
Enrico Forestieri a écrit : On Thu, Apr 27, 2006 at 10:42:58AM +0200, Georg Baum wrote: Jean-Marc Lasgouttes wrote: Georg == Georg Baum [EMAIL PROTECTED] writes: Georg If you want I'll revert the changes to plainInsert, but I am Georg not going to implement the cell based solution, since I don't Georg like it UI-wise at all. What do you want to do UI-wise? Nothing. The expert UI (typing \bigl( or \bigr\Vert) works, and Enrico wanted to modify the existing delimiter dialog of the math panel to cover fixed size delimiters as well. Well, here is the result of my effort. I also attach separately a diff against src/frontends/qt3/ui/moc/Makefile.in and src/frontends/qt3/moc/Makefile.in as svn diff doesn't seem to have catched them. I had to patch them because qt_helpers.h was not found after I edited QDelimiterDialogBase.ui with the Qt3 designer. Please, someone should have a look at QDelimiterDialogBase.ui as I managed to break it wrt resizing and don't know what else (Abdel?). Sorry Enrico, I don't have a working Qt3 designer at hand. Besides, I am not very good at UI neither. Had you chosen to begin with a Qt4 implementation (which is simpler) I surely would be able to help you ;-) Sorry guys, but I have never programmed Qt or used designer before. The code seems fine at a first glance. Something as to be done also for Qt4 and gtk, but I leave this to someone more knowledgeable than me, as I risk to do more damage than good ;-) I'll do the Qt4 part once the Qt3 one is committed. IMO this work is still unfinished, as when there is a selection the fixed size delimiters should be placed at the left and right of it. Instead, currently the selection is replaced by the delimiters. I am sorry but I fear that this is beyond my capabilities, yet. I am sorry I can't help you there. Abdel.
Re: [patch] fix bug 1473: Implement phantom in math
Enrico Forestieri wrote: Well, here is the result of my effort. I also attach separately a diff against src/frontends/qt3/ui/moc/Makefile.in and src/frontends/qt3/moc/Makefile.in as svn diff doesn't seem to have catched them. I had to patch them because qt_helpers.h was not found after I edited QDelimiterDialogBase.ui with the Qt3 designer. You should have patched the Makefile.am's, they would have been in the diff (but I wonder why the include path needs to be altered at all). IMO this work is still unfinished, as when there is a selection the fixed size delimiters should be placed at the left and right of it. Instead, currently the selection is replaced by the delimiters. I am sorry but I fear that this is beyond my capabilities, yet. That should not be difficult. I'll have a look after André told whether the current approach is acceptable at all. Georg
Re: [patch] fix bug 1473: Implement phantom in math
On Thu, Apr 27, 2006 at 09:24:42AM +0200, Georg Baum wrote: In any case, all magic should go to interpret() Co., not to LCursor::plainInsert(). That works for one-character delimiters, but not for things like \Vert. It should be possible to introduce a second interpret method that is called from LCursor::macroModeClose() and LCursor::insert(). Would that be OK with you? Yes. If you want I'll revert the changes to plainInsert, Please. but I am not going to implement the cell based solution, since I don't like it UI-wise at all. Fine with me as long as no special case math stuff goes to LCursor. Andre'
Re: [patch] fix bug 1473: Implement phantom in math
On Thu, Apr 27, 2006 at 09:55:20AM +0200, Georg Baum wrote: Hm, so then there is some hardcoded trickery to show symbols like \alpha somewhere. Somthing like that existed at least at some point of time. It does still exist, but the method is called infoize2. The attached works and goes in now. Ah... infoize2. I forgot about it. Indeed, that's the proper solution. Andre'
Re: [patch] fix bug 1473: Implement phantom in math
On Thu, Apr 27, 2006 at 05:40:25PM +0200, Georg Baum wrote: Enrico Forestieri wrote: Well, here is the result of my effort. I also attach separately a diff against src/frontends/qt3/ui/moc/Makefile.in and src/frontends/qt3/moc/Makefile.in as svn diff doesn't seem to have catched them. I had to patch them because qt_helpers.h was not found after I edited QDelimiterDialogBase.ui with the Qt3 designer. You should have patched the Makefile.am's, they would have been in the diff (but I wonder why the include path needs to be altered at all). Do you mean that Makefile.in is deliberately ignored and that only Makefile.am needs modifications? (Yes, I am an ignorant but well supported by a bit of logic ;-) ) IMO this work is still unfinished, as when there is a selection the fixed size delimiters should be placed at the left and right of it. Instead, currently the selection is replaced by the delimiters. I am sorry but I fear that this is beyond my capabilities, yet. That should not be difficult. I'll have a look after André told whether the current approach is acceptable at all. Thanks, Georg. I spent quite some time on QDelimiterDialogBase.ui but was not able to fix it. I think that it needs to be cured by a Qt guru. -- Enrico
Re: [patch] fix bug 1473: Implement phantom in math
On Thu, Apr 27, 2006 at 05:24:07PM +0200, Abdelrazak Younes wrote: Enrico Forestieri a écrit : On Thu, Apr 27, 2006 at 10:42:58AM +0200, Georg Baum wrote: Jean-Marc Lasgouttes wrote: Georg == Georg Baum [EMAIL PROTECTED] writes: Georg If you want I'll revert the changes to plainInsert, but I am Georg not going to implement the cell based solution, since I don't Georg like it UI-wise at all. What do you want to do UI-wise? Nothing. The expert UI (typing \bigl( or \bigr\Vert) works, and Enrico wanted to modify the existing delimiter dialog of the math panel to cover fixed size delimiters as well. Well, here is the result of my effort. I also attach separately a diff against src/frontends/qt3/ui/moc/Makefile.in and src/frontends/qt3/moc/Makefile.in as svn diff doesn't seem to have catched them. I had to patch them because qt_helpers.h was not found after I edited QDelimiterDialogBase.ui with the Qt3 designer. Please, someone should have a look at QDelimiterDialogBase.ui as I managed to break it wrt resizing and don't know what else (Abdel?). Sorry Enrico, I don't have a working Qt3 designer at hand. Besides, I am not very good at UI neither. Had you chosen to begin with a Qt4 implementation (which is simpler) I surely would be able to help you ;-) Gulp! Do you mean that I should abadon Qt3 after all the hard work to adapt it to my needs and start again with Qt4? I could do it but not in the current year ;-) Sorry guys, but I have never programmed Qt or used designer before. The code seems fine at a first glance. Thanks, but all credit goes to Qt. Have you ever tried directly programming at the X11 level? No? Then you don't know what you are missing ;-) Something as to be done also for Qt4 and gtk, but I leave this to someone more knowledgeable than me, as I risk to do more damage than good ;-) I'll do the Qt4 part once the Qt3 one is committed. Good boy! IMO this work is still unfinished, as when there is a selection the fixed size delimiters should be placed at the left and right of it. Instead, currently the selection is replaced by the delimiters. I am sorry but I fear that this is beyond my capabilities, yet. I am sorry I can't help you there. I don't think it is difficult, only I don't know how to do it. -- Enrico
Re: [patch] fix bug 1473: Implement phantom in math
Enrico Forestieri [EMAIL PROTECTED] writes: | On Thu, Apr 27, 2006 at 05:40:25PM +0200, Georg Baum wrote: | Enrico Forestieri wrote: | | Well, here is the result of my effort. I also attach separately a diff | against src/frontends/qt3/ui/moc/Makefile.in and | src/frontends/qt3/moc/Makefile.in as svn diff doesn't seem to have | catched them. I had to patch them because qt_helpers.h was not found | after I edited QDelimiterDialogBase.ui with the Qt3 designer. Shouldn't that just include ../qt_helpers.h? | You should have patched the Makefile.am's, they would have been in the diff | (but I wonder why the include path needs to be altered at all). | | Do you mean that Makefile.in is deliberately ignored and that only | Makefile.am needs modifications? (Yes, I am an ignorant but well | supported by a bit of logic ;-) ) Makefile.in in created by automake Makefile is created by configure neither of those are in svn. -- Lgb
Re: [patch] fix bug 1473: Implement phantom in math
On Thursday 27 April 2006 20:14, Enrico Forestieri wrote: Do you mean that Makefile.in is deliberately ignored and that only Makefile.am needs modifications? (Yes, I am an ignorant but well supported by a bit of logic ;-) ) This even I know the answer ;-) Makefile.am is transformed by automake tools to Makefile.in is transformed by configure to Makefile There are some words missing in the above explanation but I think you get the idea this way. The bottom line is that Makefile.am is the original file, all other Makefile* are transformations from it. :-) -- José Abílio
Re: [patch] fix bug 1473: Implement phantom in math
On Thu, Apr 27, 2006 at 09:56:07PM +0200, Lars Gullik Bjønnes wrote: Enrico Forestieri [EMAIL PROTECTED] writes: | On Thu, Apr 27, 2006 at 05:40:25PM +0200, Georg Baum wrote: | Enrico Forestieri wrote: | | Well, here is the result of my effort. I also attach separately a diff | against src/frontends/qt3/ui/moc/Makefile.in and | src/frontends/qt3/moc/Makefile.in as svn diff doesn't seem to have | catched them. I had to patch them because qt_helpers.h was not found | after I edited QDelimiterDialogBase.ui with the Qt3 designer. Shouldn't that just include ../qt_helpers.h? The original QDelimiterDialogBase.ui had include location=globalconfig.h/include include location=localqt_helpers.h/include whereas after the Qt3 designer I find includes include location=global impldecl=in declarationconfig.h/include include location=local impldecl=in declarationqt_helpers.h/include /includes However, in src/frontends/qt3/ui/QDelimiterDialogBase.h there is no trace of those includes when it is produced from the Qt2 .ui, but I see #include config.h #include qt_helpers.h when it comes from the Qt3 .ui. Seems that the Qt2 .ui doesn't produce the expected result. | You should have patched the Makefile.am's, they would have been in the diff | (but I wonder why the include path needs to be altered at all). | | Do you mean that Makefile.in is deliberately ignored and that only | Makefile.am needs modifications? (Yes, I am an ignorant but well | supported by a bit of logic ;-) ) Makefile.in in created by automake Makefile is created by configure neither of those are in svn. Now I am beginning to understand the magic. So, after AC_SUBST(FOO, [bar]) I only need to write myvar = $(FOO) in Makefile.am and I will find FOO = @FOO@ ... myvar = $(FOO) in Makefile.in. Cool. There should be a better way than info autoconf to try to learn all these exciting features. -- Enrico
Re: [patch] fix bug 1473: Implement phantom in math
On Thu, Apr 27, 2006 at 08:59:49PM +0100, Jose' Matos wrote: On Thursday 27 April 2006 20:14, Enrico Forestieri wrote: Do you mean that Makefile.in is deliberately ignored and that only Makefile.am needs modifications? (Yes, I am an ignorant but well supported by a bit of logic ;-) ) This even I know the answer ;-) Makefile.am is transformed by automake tools to Makefile.in is transformed by configure to Makefile There are some words missing in the above explanation but I think you get the idea this way. The bottom line is that Makefile.am is the original file, all other Makefile* are transformations from it. :-) It is surprising how one can successfully use something even without fully understanding it, isn't it? Thanks for your explanation, Josè. -- Enrico
Re: [patch] fix bug 1473: Implement phantom in math
Andre Poenitz wrote: > Restricting input in cell is something we stubled over already in e.g. > the number of macro arguments. > > So it looks like some generic solution is wanted, i.e. something like a > 'cell property'. This is not the only problem: If we made the delimiter a cell we would have bad UI IMHO: Enter the inset and type somthing. Then leave it, and it will change from a cell to something else with different dimensions. This is the case for macros already, but to use your words: That does not make it any better. In the case of macros there is a need to edit the arguments, but big delimiters are IMHO more like symbols (and it is to my knowledge not possible to change the delimiter of a \left...\right combination after inserting it, so that would be consistent). > In any case, all magic should go to interpret() & Co., not to > LCursor::plainInsert(). That works for one-character delimiters, but not for things like \Vert. It should be possible to introduce a second interpret method that is called from LCursor::macroModeClose() and LCursor::insert(). Would that be OK with you? If you want I'll revert the changes to plainInsert, but I am not going to implement the cell based solution, since I don't like it UI-wise at all. Georg
Re: [patch] fix bug 1473: Implement phantom in math
Jean-Marc Lasgouttes wrote: >> "Georg" == Georg Baum >> <[EMAIL PROTECTED]> >> writes: > > Georg> If you want I'll revert the changes to plainInsert, but I am > Georg> not going to implement the cell based solution, since I don't > Georg> like it UI-wise at all. > > What do you want to do UI-wise? Nothing. The expert UI (typing \bigl( or \bigr\Vert) works, and Enrico wanted to modify the existing delimiter dialog of the math panel to cover fixed size delimiters as well. If André does not agree to the plainInsert -> extra interpret method change it will not be possible to insert delimiters with more than one character like \bigr\Vert at all (well it will be possible, but they will not be recognized and displayed in red). This is IMHO still better than the cell based solution with changing on-screen display. Georg
Re: [patch] fix bug 1473: Implement phantom in math
Andre Poenitz wrote: > On Wed, Apr 26, 2006 at 09:30:51AM +0200, Georg Baum wrote: >> Andre Poenitz wrote: >> > Is it? I thought also the item to the left or right was considered. >> >> Then the attached patch should make it work, but it does not. > > Hm, so then there is some hardcoded trickery to show symbols like > \alpha somewhere. > > Somthing like that existed at least at some point of time. It does still exist, but the method is called infoize2. The attached works and goes in now. Georg Log: * src/mathed/math_biginset.[Ch] (infoize2): Implement to show name if the cursor is to the rightIndex: src/mathed/math_biginset.C === --- src/mathed/math_biginset.C (Revision 13752) +++ src/mathed/math_biginset.C (Arbeitskopie) @@ -98,6 +98,12 @@ void MathBigInset::normalize(NormalStrea } +void MathBigInset::infoize2(std::ostream & os) const +{ + os << name_; +} + + bool MathBigInset::isBigInsetDelim(string const & delim) { // mathed_draw_deco must handle these Index: src/mathed/math_biginset.h === --- src/mathed/math_biginset.h (Revision 13752) +++ src/mathed/math_biginset.h (Arbeitskopie) @@ -32,6 +32,8 @@ public: /// void normalize(NormalStream & os) const; /// + void infoize2(std::ostream & os) const; + /// static bool isBigInsetDelim(std::string const &); private:
Re: [patch] fix bug 1473: Implement phantom in math
> "Georg" == Georg Baum <[EMAIL PROTECTED]> writes: Georg> If you want I'll revert the changes to plainInsert, but I am Georg> not going to implement the cell based solution, since I don't Georg> like it UI-wise at all. What do you want to do UI-wise? JMarc
Re: [patch] fix bug 1473: Implement phantom in math
On Thu, Apr 27, 2006 at 10:42:58AM +0200, Georg Baum wrote: > Jean-Marc Lasgouttes wrote: > > >> "Georg" == Georg Baum > >> <[EMAIL PROTECTED]> > >> writes: > > > > Georg> If you want I'll revert the changes to plainInsert, but I am > > Georg> not going to implement the cell based solution, since I don't > > Georg> like it UI-wise at all. > > > > What do you want to do UI-wise? > > Nothing. The expert UI (typing \bigl( or \bigr\Vert) works, and Enrico > wanted to modify the existing delimiter dialog of the math panel to cover > fixed size delimiters as well. Well, here is the result of my effort. I also attach separately a diff against src/frontends/qt3/ui/moc/Makefile.in and src/frontends/qt3/moc/Makefile.in as "svn diff" doesn't seem to have catched them. I had to patch them because "qt_helpers.h" was not found after I edited QDelimiterDialogBase.ui with the Qt3 designer. Please, someone should have a look at QDelimiterDialogBase.ui as I managed to break it wrt resizing and don't know what else (Abdel?). Sorry guys, but I have never programmed Qt or used designer before. Something as to be done also for Qt4 and gtk, but I leave this to someone more knowledgeable than me, as I risk to do more damage than good ;-) IMO this work is still unfinished, as when there is a selection the fixed size delimiters should be placed at the left and right of it. Instead, currently the selection is replaced by the delimiters. I am sorry but I fear that this is beyond my capabilities, yet. Log: * src/frontends/qt3/QDelimiterDialog.[Ch] (fix_name, QDelimiterDialog, insertClicked, size_selected): Allow for fixed size delimiters. * src/frontends/qt3/ui/QDelimiterDialogBase.ui: Added a combobox for selecting delimiter size. * src/frontends/controllers/ControlMath.[Ch]: Added dispatchBigDelim() to deal with fixed size delimiters. * src/frontends/qt3/moc/Makefile.in, src/frontends/qt3/ui/moc/Makefile.in: Added -I$(top_srcdir)/src/frontends/qt3 to DEFAULT_INCLUDES. -- Enrico Index: src/frontends/qt3/QDelimiterDialog.C === --- src/frontends/qt3/QDelimiterDialog.C(revision 13757) +++ src/frontends/qt3/QDelimiterDialog.C(working copy) @@ -21,6 +21,7 @@ #include #include #include +#include using std::string; @@ -59,7 +60,7 @@ string do_match(const string & str) } -string fix_name(const string & str) +string fix_name(const string & str, bool big) { if (str == "slash") return "/"; @@ -67,7 +68,10 @@ string fix_name(const string & str) return "\\"; if (str == "empty") return "."; - return str; + if (!big || str == "(" || str == ")" || str == "[" || str == "]") + return str; + + return "\\" + str; } } // namespace anon @@ -89,11 +93,19 @@ QDelimiterDialog::QDelimiterDialog(QMath leftIP->add(QPixmap(toqstr(empty_xpm)), "empty", "empty"); rightIP->add(QPixmap(toqstr(empty_xpm)), "empty", "empty"); + delimSize->insertItem("Variable size"); + delimSize->insertItem("big size"); + delimSize->insertItem("Big size"); + delimSize->insertItem("bigg size"); + delimSize->insertItem("Bigg size"); + size_ = 0; // Leave these std:: qualifications alone ! connect(leftIP, SIGNAL(button_clicked(const std::string &)), this, SLOT(ldelim_clicked(const std::string &))); connect(rightIP, SIGNAL(button_clicked(const std::string &)), this, SLOT(rdelim_clicked(const std::string &))); + connect(delimSize, SIGNAL(activated(int)), + this, SLOT(size_selected(int)) ); ldelim_clicked("("); rdelim_clicked(")"); } @@ -101,7 +113,34 @@ QDelimiterDialog::QDelimiterDialog(QMath void QDelimiterDialog::insertClicked() { - form_->controller().dispatchDelim(fix_name(left_) + ' ' + fix_name(right_)); + switch (size_) { + default: + case 0: + form_->controller().dispatchDelim( + fix_name(left_, false) + + ' ' + fix_name(right_, false)); + break; + case 1: + form_->controller().dispatchBigDelim( + "\\bigl" + fix_name(left_, true) + + "\\bigr" + fix_name(right_, true)); + break; + case 2: + form_->controller().dispatchBigDelim( + "\\Bigl" + fix_name(left_, true) + + "\\Bigr" + fix_name(right_, true)); + break; + case 3: + form_->controller().dispatchBigDelim( +
Re: [patch] fix bug 1473: Implement phantom in math
Enrico Forestieri a écrit : On Thu, Apr 27, 2006 at 10:42:58AM +0200, Georg Baum wrote: Jean-Marc Lasgouttes wrote: "Georg" == Georg Baum <[EMAIL PROTECTED]> writes: Georg> If you want I'll revert the changes to plainInsert, but I am Georg> not going to implement the cell based solution, since I don't Georg> like it UI-wise at all. What do you want to do UI-wise? Nothing. The expert UI (typing \bigl( or \bigr\Vert) works, and Enrico wanted to modify the existing delimiter dialog of the math panel to cover fixed size delimiters as well. Well, here is the result of my effort. I also attach separately a diff against src/frontends/qt3/ui/moc/Makefile.in and src/frontends/qt3/moc/Makefile.in as "svn diff" doesn't seem to have catched them. I had to patch them because "qt_helpers.h" was not found after I edited QDelimiterDialogBase.ui with the Qt3 designer. Please, someone should have a look at QDelimiterDialogBase.ui as I managed to break it wrt resizing and don't know what else (Abdel?). Sorry Enrico, I don't have a working Qt3 designer at hand. Besides, I am not very good at UI neither. Had you chosen to begin with a Qt4 implementation (which is simpler) I surely would be able to help you ;-) Sorry guys, but I have never programmed Qt or used designer before. The code seems fine at a first glance. Something as to be done also for Qt4 and gtk, but I leave this to someone more knowledgeable than me, as I risk to do more damage than good ;-) I'll do the Qt4 part once the Qt3 one is committed. IMO this work is still unfinished, as when there is a selection the fixed size delimiters should be placed at the left and right of it. Instead, currently the selection is replaced by the delimiters. I am sorry but I fear that this is beyond my capabilities, yet. I am sorry I can't help you there. Abdel.
Re: [patch] fix bug 1473: Implement phantom in math
Enrico Forestieri wrote: > Well, here is the result of my effort. I also attach separately a diff > against src/frontends/qt3/ui/moc/Makefile.in and > src/frontends/qt3/moc/Makefile.in as "svn diff" doesn't seem to have > catched them. I had to patch them because "qt_helpers.h" was not found > after I edited QDelimiterDialogBase.ui with the Qt3 designer. You should have patched the Makefile.am's, they would have been in the diff (but I wonder why the include path needs to be altered at all). > IMO this work is still unfinished, as when there is a selection the > fixed size delimiters should be placed at the left and right of it. > Instead, currently the selection is replaced by the delimiters. > I am sorry but I fear that this is beyond my capabilities, yet. That should not be difficult. I'll have a look after André told whether the current approach is acceptable at all. Georg
Re: [patch] fix bug 1473: Implement phantom in math
On Thu, Apr 27, 2006 at 09:24:42AM +0200, Georg Baum wrote: > > In any case, all magic should go to interpret() & Co., not to > > LCursor::plainInsert(). > > That works for one-character delimiters, but not for things like \Vert. It > should be possible to introduce a second interpret method that is called > from LCursor::macroModeClose() and LCursor::insert(). Would that be OK with > you? Yes. > If you want I'll revert the changes to plainInsert, Please. > but I am not going to implement the cell based solution, since I don't > like it UI-wise at all. Fine with me as long as no special case math stuff goes to LCursor. Andre'
Re: [patch] fix bug 1473: Implement phantom in math
On Thu, Apr 27, 2006 at 09:55:20AM +0200, Georg Baum wrote: > > Hm, so then there is some hardcoded trickery to show symbols like > > \alpha somewhere. > > > > Somthing like that existed at least at some point of time. > > It does still exist, but the method is called infoize2. The attached works > and goes in now. Ah... infoize2. I forgot about it. Indeed, that's the proper solution. Andre'
Re: [patch] fix bug 1473: Implement phantom in math
On Thu, Apr 27, 2006 at 05:40:25PM +0200, Georg Baum wrote: > Enrico Forestieri wrote: > > > Well, here is the result of my effort. I also attach separately a diff > > against src/frontends/qt3/ui/moc/Makefile.in and > > src/frontends/qt3/moc/Makefile.in as "svn diff" doesn't seem to have > > catched them. I had to patch them because "qt_helpers.h" was not found > > after I edited QDelimiterDialogBase.ui with the Qt3 designer. > > You should have patched the Makefile.am's, they would have been in the diff > (but I wonder why the include path needs to be altered at all). Do you mean that Makefile.in is deliberately ignored and that only Makefile.am needs modifications? (Yes, I am an ignorant but well supported by a bit of logic ;-) ) > > IMO this work is still unfinished, as when there is a selection the > > fixed size delimiters should be placed at the left and right of it. > > Instead, currently the selection is replaced by the delimiters. > > I am sorry but I fear that this is beyond my capabilities, yet. > > That should not be difficult. I'll have a look after André told whether the > current approach is acceptable at all. Thanks, Georg. I spent quite some time on QDelimiterDialogBase.ui but was not able to fix it. I think that it needs to be cured by a Qt guru. -- Enrico
Re: [patch] fix bug 1473: Implement phantom in math
On Thu, Apr 27, 2006 at 05:24:07PM +0200, Abdelrazak Younes wrote: > Enrico Forestieri a écrit : > >On Thu, Apr 27, 2006 at 10:42:58AM +0200, Georg Baum wrote: > >>Jean-Marc Lasgouttes wrote: > >> > "Georg" == Georg Baum > <[EMAIL PROTECTED]> > writes: > >>>Georg> If you want I'll revert the changes to plainInsert, but I am > >>>Georg> not going to implement the cell based solution, since I don't > >>>Georg> like it UI-wise at all. > >>> > >>>What do you want to do UI-wise? > >>Nothing. The expert UI (typing \bigl( or \bigr\Vert) works, and Enrico > >>wanted to modify the existing delimiter dialog of the math panel to cover > >>fixed size delimiters as well. > > > >Well, here is the result of my effort. I also attach separately a diff > >against src/frontends/qt3/ui/moc/Makefile.in and > >src/frontends/qt3/moc/Makefile.in as "svn diff" doesn't seem to have > >catched them. I had to patch them because "qt_helpers.h" was not found > >after I edited QDelimiterDialogBase.ui with the Qt3 designer. > > > >Please, someone should have a look at QDelimiterDialogBase.ui as I > >managed to break it wrt resizing and don't know what else (Abdel?). > > Sorry Enrico, I don't have a working Qt3 designer at hand. Besides, I am > not very good at UI neither. Had you chosen to begin with a Qt4 > implementation (which is simpler) I surely would be able to help you ;-) Gulp! Do you mean that I should abadon Qt3 after all the hard work to adapt it to my needs and start again with Qt4? I could do it but not in the current year ;-) > >Sorry guys, but I have never programmed Qt or used designer before. > > The code seems fine at a first glance. Thanks, but all credit goes to Qt. Have you ever tried directly programming at the X11 level? No? Then you don't know what you are missing ;-) > >Something as to be done also for Qt4 and gtk, but I leave this to > >someone more knowledgeable than me, as I risk to do more damage than > >good ;-) > > I'll do the Qt4 part once the Qt3 one is committed. Good boy! > >IMO this work is still unfinished, as when there is a selection the > >fixed size delimiters should be placed at the left and right of it. > >Instead, currently the selection is replaced by the delimiters. > >I am sorry but I fear that this is beyond my capabilities, yet. > > I am sorry I can't help you there. I don't think it is difficult, only I don't know how to do it. -- Enrico
Re: [patch] fix bug 1473: Implement phantom in math
Enrico Forestieri <[EMAIL PROTECTED]> writes: | On Thu, Apr 27, 2006 at 05:40:25PM +0200, Georg Baum wrote: | > Enrico Forestieri wrote: | > | > > Well, here is the result of my effort. I also attach separately a diff | > > against src/frontends/qt3/ui/moc/Makefile.in and | > > src/frontends/qt3/moc/Makefile.in as "svn diff" doesn't seem to have | > > catched them. I had to patch them because "qt_helpers.h" was not found | > > after I edited QDelimiterDialogBase.ui with the Qt3 designer. Shouldn't that just include "../qt_helpers.h"? | > You should have patched the Makefile.am's, they would have been in the diff | > (but I wonder why the include path needs to be altered at all). | | Do you mean that Makefile.in is deliberately ignored and that only | Makefile.am needs modifications? (Yes, I am an ignorant but well | supported by a bit of logic ;-) ) Makefile.in in created by automake Makefile is created by configure neither of those are in svn. -- Lgb
Re: [patch] fix bug 1473: Implement phantom in math
On Thursday 27 April 2006 20:14, Enrico Forestieri wrote: > Do you mean that Makefile.in is deliberately ignored and that only > Makefile.am needs modifications? (Yes, I am an ignorant but well > supported by a bit of logic ;-) ) This even I know the answer ;-) Makefile.am is transformed by automake tools to Makefile.in is transformed by configure to Makefile There are some words missing in the above explanation but I think you get the idea this way. The bottom line is that Makefile.am is the original file, all other Makefile* are transformations from it. :-) -- José Abílio
Re: [patch] fix bug 1473: Implement phantom in math
On Thu, Apr 27, 2006 at 09:56:07PM +0200, Lars Gullik Bjønnes wrote: > Enrico Forestieri <[EMAIL PROTECTED]> writes: > > | On Thu, Apr 27, 2006 at 05:40:25PM +0200, Georg Baum wrote: > | > Enrico Forestieri wrote: > | > > | > > Well, here is the result of my effort. I also attach separately a diff > | > > against src/frontends/qt3/ui/moc/Makefile.in and > | > > src/frontends/qt3/moc/Makefile.in as "svn diff" doesn't seem to have > | > > catched them. I had to patch them because "qt_helpers.h" was not found > | > > after I edited QDelimiterDialogBase.ui with the Qt3 designer. > > Shouldn't that just include "../qt_helpers.h"? The original QDelimiterDialogBase.ui had config.h qt_helpers.h whereas after the Qt3 designer I find config.h qt_helpers.h However, in src/frontends/qt3/ui/QDelimiterDialogBase.h there is no trace of those includes when it is produced from the Qt2 .ui, but I see #include #include "qt_helpers.h" when it comes from the Qt3 .ui. Seems that the Qt2 .ui doesn't produce the expected result. > | > You should have patched the Makefile.am's, they would have been in the > diff > | > (but I wonder why the include path needs to be altered at all). > | > | Do you mean that Makefile.in is deliberately ignored and that only > | Makefile.am needs modifications? (Yes, I am an ignorant but well > | supported by a bit of logic ;-) ) > > Makefile.in in created by automake > Makefile is created by configure > > neither of those are in svn. Now I am beginning to understand the magic. So, after AC_SUBST(FOO, [bar]) I only need to write myvar = $(FOO) in Makefile.am and I will find FOO = @FOO@ ... myvar = $(FOO) in Makefile.in. Cool. There should be a better way than "info autoconf" to try to learn all these exciting features. -- Enrico
Re: [patch] fix bug 1473: Implement phantom in math
On Thu, Apr 27, 2006 at 08:59:49PM +0100, Jose' Matos wrote: > On Thursday 27 April 2006 20:14, Enrico Forestieri wrote: > > Do you mean that Makefile.in is deliberately ignored and that only > > Makefile.am needs modifications? (Yes, I am an ignorant but well > > supported by a bit of logic ;-) ) > > This even I know the answer ;-) > > Makefile.am is transformed by automake tools to > Makefile.in is transformed by configure to > Makefile > > There are some words missing in the above explanation but I think you get > the idea this way. > > The bottom line is that Makefile.am is the original file, all other > Makefile* are transformations from it. :-) It is surprising how one can successfully use something even without fully understanding it, isn't it? Thanks for your explanation, Josè. -- Enrico
Re: [patch] fix bug 1473: Implement phantom in math
Andre Poenitz wrote: On Mon, Apr 17, 2006 at 08:57:54PM +0200, Georg Baum wrote: That is not possible with this approach, since the status line info is only obtained if the cursor is inside an inset. Is it? I thought also the item to the left or right was considered. Then the attached patch should make it work, but it does not. GeorgIndex: src/mathed/math_biginset.h === --- src/mathed/math_biginset.h (Revision 13741) +++ src/mathed/math_biginset.h (Arbeitskopie) @@ -32,6 +32,8 @@ public: /// void normalize(NormalStream os) const; /// + void infoize(std::ostream os) const; + /// static bool isBigInsetDelim(std::string const ); private: Index: src/mathed/math_biginset.C === --- src/mathed/math_biginset.C (Revision 13741) +++ src/mathed/math_biginset.C (Arbeitskopie) @@ -98,6 +98,12 @@ void MathBigInset::normalize(NormalStrea } +void MathBigInset::infoize(std::ostream os) const +{ + os name_; +} + + bool MathBigInset::isBigInsetDelim(string const delim) { // mathed_draw_deco must handle these
Re: [patch] fix bug 1473: Implement phantom in math
Andre Poenitz wrote: Doing special case mathed stuff is not the business of LCursor. I know that there is already mathed related stuff there but that does not make it any better. Moreover, _plainInsert_ is intended to insert stuff without any fuss. So what else do you propose? I know that this solution is not optimal, but could not find a better one. Georg
Re: [patch] fix bug 1473: Implement phantom in math
On Wed, Apr 26, 2006 at 09:32:59AM +0200, Georg Baum wrote: Andre Poenitz wrote: Doing special case mathed stuff is not the business of LCursor. I know that there is already mathed related stuff there but that does not make it any better. Moreover, _plainInsert_ is intended to insert stuff without any fuss. So what else do you propose? I know that this solution is not optimal, but could not find a better one. Restricting input in cell is something we stubled over already in e.g. the number of macro arguments. So it looks like some generic solution is wanted, i.e. something like a 'cell property'. In any case, all magic should go to interpret() Co., not to LCursor::plainInsert(). Andre'
Re: [patch] fix bug 1473: Implement phantom in math
On Wed, Apr 26, 2006 at 09:30:51AM +0200, Georg Baum wrote: Andre Poenitz wrote: On Mon, Apr 17, 2006 at 08:57:54PM +0200, Georg Baum wrote: That is not possible with this approach, since the status line info is only obtained if the cursor is inside an inset. Is it? I thought also the item to the left or right was considered. Then the attached patch should make it work, but it does not. Hm, so then there is some hardcoded trickery to show symbols like \alpha somewhere. Somthing like that existed at least at some point of time. Andre'
Re: [patch] fix bug 1473: Implement phantom in math
Andre Poenitz wrote: > On Mon, Apr 17, 2006 at 08:57:54PM +0200, Georg Baum wrote: >> That is not possible with this approach, since the status line info is >> only obtained if the cursor is inside an inset. > > Is it? I thought also the item to the left or right was considered. Then the attached patch should make it work, but it does not. GeorgIndex: src/mathed/math_biginset.h === --- src/mathed/math_biginset.h (Revision 13741) +++ src/mathed/math_biginset.h (Arbeitskopie) @@ -32,6 +32,8 @@ public: /// void normalize(NormalStream & os) const; /// + void infoize(std::ostream & os) const; + /// static bool isBigInsetDelim(std::string const &); private: Index: src/mathed/math_biginset.C === --- src/mathed/math_biginset.C (Revision 13741) +++ src/mathed/math_biginset.C (Arbeitskopie) @@ -98,6 +98,12 @@ void MathBigInset::normalize(NormalStrea } +void MathBigInset::infoize(std::ostream & os) const +{ + os << name_; +} + + bool MathBigInset::isBigInsetDelim(string const & delim) { // mathed_draw_deco must handle these
Re: [patch] fix bug 1473: Implement phantom in math
Andre Poenitz wrote: > Doing special case mathed stuff is not the business of LCursor. > > I know that there is already mathed related stuff there but that > does not make it any better. > > Moreover, _plainInsert_ is intended to insert stuff without any fuss. So what else do you propose? I know that this solution is not optimal, but could not find a better one. Georg
Re: [patch] fix bug 1473: Implement phantom in math
On Wed, Apr 26, 2006 at 09:32:59AM +0200, Georg Baum wrote: > Andre Poenitz wrote: > > > Doing special case mathed stuff is not the business of LCursor. > > > > I know that there is already mathed related stuff there but that > > does not make it any better. > > > > Moreover, _plainInsert_ is intended to insert stuff without any fuss. > > So what else do you propose? I know that this solution is not optimal, but > could not find a better one. Restricting input in cell is something we stubled over already in e.g. the number of macro arguments. So it looks like some generic solution is wanted, i.e. something like a 'cell property'. In any case, all magic should go to interpret() & Co., not to LCursor::plainInsert(). Andre'
Re: [patch] fix bug 1473: Implement phantom in math
On Wed, Apr 26, 2006 at 09:30:51AM +0200, Georg Baum wrote: > Andre Poenitz wrote: > > > On Mon, Apr 17, 2006 at 08:57:54PM +0200, Georg Baum wrote: > >> That is not possible with this approach, since the status line info is > >> only obtained if the cursor is inside an inset. > > > > Is it? I thought also the item to the left or right was considered. > > Then the attached patch should make it work, but it does not. Hm, so then there is some hardcoded trickery to show symbols like \alpha somewhere. Somthing like that existed at least at some point of time. Andre'
Re: [patch] fix bug 1473: Implement phantom in math
On Sat, Apr 15, 2006 at 10:22:21AM +0200, Lars Gullik Bjønnes wrote: | if (s == tfrac) | return MathAtom(new MathTfracInset); | + if (s == hphantom) | + return MathAtom(new MathPhantomInset(MathPhantomInset::hphantom)); Eventually something must be done with this if .. if ... if list The problem is that there is no unique constructor signature for all cases. Andre'
Re: [patch] fix bug 1473: Implement phantom in math
On Sat, Apr 15, 2006 at 07:49:25PM +0200, Georg Baum wrote: The alternative to this approach (storing the delimiter as uneditable string) would be to make the delimiter a normal cell. The advantage of that is that MathNestInset and LCursor don't need to be touched, but the disadvantage would be that one would ned to disable a lot of stuff in the delimiter box. It would certainly be surprising for the user to see that normal characters where disabled in a normal looking math box. Opinions? Should I polish this version, or do we want to do it differently? Probably differently. No need to disable lots of things, just ignore garbage. This is a feature for advanced users anyway. Index: src/cursor.C void LCursor::plainInsert(MathAtom const t) { + // Create a MathBigInset from cell()[pos() - 1] and t if possible + if (!empty() pos() 0 cell()[pos() - 1]-asUnknownInset()) { + string const name = asString(t); + if (MathBigInset::isBigInsetDelim(name)) { + string prev = asString(cell()[pos() - 1]); + if (prev[0] == '\\') { + prev = prev.substr(1); + latexkeys const * l = in_word_set(prev); + if (l l-inset == big) { + cell()[pos() - 1] = + createMathInset(prev, name); + return; + } + } + } + } cell().insert(pos(), t); ++pos(); } This function is called _plain_Insert. Andre'
Re: [patch] fix bug 1473: Implement phantom in math
On Thu, Apr 20, 2006 at 11:55:38AM +0200, Georg Baum wrote: Make MathBigInset working * src/cursor.C (LCursor::plainInsert): combine the previous math atom with the new one to a MathBigInset if possible Doing special case mathed stuff is not the business of LCursor. I know that there is already mathed related stuff there but that does not make it any better. Moreover, _plainInsert_ is intended to insert stuff without any fuss. Andre'
Re: [patch] fix bug 1473: Implement phantom in math
On Mon, Apr 17, 2006 at 08:57:54PM +0200, Georg Baum wrote: That is not possible with this approach, since the status line info is only obtained if the cursor is inside an inset. Is it? I thought also the item to the left or right was considered. Andre'
Re: [patch] fix bug 1473: Implement phantom in math
On Thu, Apr 20, 2006 at 03:54:24PM +0200, Enrico Forestieri wrote: On Thu, Apr 20, 2006 at 11:55:38AM +0200, Georg Baum wrote: Enrico Forestieri wrote: I am not able to generate a bigger { by \bigl\{ in mathed (I must use \bigl\lbrace for that) because I think that the code dealing with \bigl has not a chance of viewing \{, being it transformed to {}. This is currently beyond my capabilities (but I continue learning). Only a tiny bit was missing: The transformation of { and } to \{ and \}, respectively in MathNestInset::interpret. I am going to ccommit the attached patch. This is perfect! I tested it and think that this should also go in 1.4. This is far from perfect apart from appearance *sigh* Andre'
Re: [patch] fix bug 1473: Implement phantom in math
On Sat, Apr 15, 2006 at 10:22:21AM +0200, Lars Gullik Bjønnes wrote: > | if (s == "tfrac") > | return MathAtom(new MathTfracInset); > | + if (s == "hphantom") > | + return MathAtom(new > MathPhantomInset(MathPhantomInset::hphantom)); > > Eventually something must be done with this if .. if ... if list The problem is that there is no unique constructor signature for all cases. Andre'
Re: [patch] fix bug 1473: Implement phantom in math
On Sat, Apr 15, 2006 at 07:49:25PM +0200, Georg Baum wrote: > The alternative to this approach (storing the delimiter as uneditable > string) would be to make the delimiter a normal cell. The advantage of > that is that MathNestInset and LCursor don't need to be touched, but the > disadvantage would be that one would ned to disable a lot of stuff in the > delimiter box. It would certainly be surprising for the user to see that > normal characters where disabled in a normal looking math box. > > Opinions? Should I polish this version, or do we want to do it > differently? Probably differently. No need to disable lots of things, just ignore garbage. This is a feature for advanced users anyway. Index: src/cursor.C void LCursor::plainInsert(MathAtom const & t) { + // Create a MathBigInset from cell()[pos() - 1] and t if possible + if (!empty() && pos() > 0 && cell()[pos() - 1]->asUnknownInset()) { + string const name = asString(t); + if (MathBigInset::isBigInsetDelim(name)) { + string prev = asString(cell()[pos() - 1]); + if (prev[0] == '\\') { + prev = prev.substr(1); + latexkeys const * l = in_word_set(prev); + if (l && l->inset == "big") { + cell()[pos() - 1] = + createMathInset(prev, name); + return; + } + } + } + } cell().insert(pos(), t); ++pos(); } This function is called _plain_Insert. Andre'
Re: [patch] fix bug 1473: Implement phantom in math
On Thu, Apr 20, 2006 at 11:55:38AM +0200, Georg Baum wrote: > Make MathBigInset working > * src/cursor.C > (LCursor::plainInsert): combine the previous math atom with the new > one to a MathBigInset if possible Doing special case mathed stuff is not the business of LCursor. I know that there is already mathed related stuff there but that does not make it any better. Moreover, _plainInsert_ is intended to insert stuff without any fuss. Andre'
Re: [patch] fix bug 1473: Implement phantom in math
On Mon, Apr 17, 2006 at 08:57:54PM +0200, Georg Baum wrote: > That is not possible with this approach, since the status line info is > only obtained if the cursor is inside an inset. Is it? I thought also the item to the left or right was considered. Andre'
Re: [patch] fix bug 1473: Implement phantom in math
On Thu, Apr 20, 2006 at 03:54:24PM +0200, Enrico Forestieri wrote: > On Thu, Apr 20, 2006 at 11:55:38AM +0200, Georg Baum wrote: > > Enrico Forestieri wrote: > > > > > I am not able to generate a bigger "{" by "\bigl\{" in mathed (I must > > > use "\bigl\lbrace" for that) because I think that the code dealing > > > with \bigl has not a chance of viewing \{, being it transformed to {}. > > > This is currently beyond my capabilities (but I continue learning). > > > > Only a tiny bit was missing: The transformation of { and } to \{ and \}, > > respectively in MathNestInset::interpret. I am going to ccommit the > > attached patch. > > This is perfect! I tested it and think that this should also go in 1.4. This is far from perfect apart from appearance *sigh* Andre'
Re: [patch] fix bug 1473: Implement phantom in math
Georg Baum [EMAIL PROTECTED] writes: | Angus Leeming wrote: | | The .ui files were all generated and maintained with Qt2's designer, yes. | However, LyX 1.5 has dropped support for Qt2 so you should feel free to | use Qt3's designer with the .ui files in the qt2 tree. Perhaps someone | might rename the qt2 directory as qt3 to avoid confusion? | | Lars wanted to do that. and unless you have a lot of logical modification, I can just do that. Shall I? | | | Georg | | -- Lgb
Re: [patch] fix bug 1473: Implement phantom in math
Lars Gullik Bjønnes wrote: Georg Baum [EMAIL PROTECTED] writes: | Angus Leeming wrote: | | The .ui files were all generated and maintained with Qt2's designer, | yes. | However, LyX 1.5 has dropped support for Qt2 so you should feel free | to use Qt3's designer with the .ui files in the qt2 tree. Perhaps | someone might rename the qt2 directory as qt3 to avoid confusion? | | Lars wanted to do that. and unless you have a lot of logical modification, I can just do that. Shall I? Yes please. Georg
Re: [patch] fix bug 1473: Implement phantom in math
Georg Baum <[EMAIL PROTECTED]> writes: | Angus Leeming wrote: | | > The .ui files were all generated and maintained with Qt2's designer, yes. | > However, LyX 1.5 has dropped support for Qt2 so you should feel free to | > use Qt3's designer with the .ui files in the qt2 tree. Perhaps someone | > might rename the qt2 directory as qt3 to avoid confusion? | | Lars wanted to do that. and unless you have a lot of logical modification, I can just do that. Shall I? | | | Georg | | -- Lgb
Re: [patch] fix bug 1473: Implement phantom in math
Lars Gullik Bjønnes wrote: > Georg Baum <[EMAIL PROTECTED]> > writes: > > | Angus Leeming wrote: > | > | > The .ui files were all generated and maintained with Qt2's designer, > | > yes. > | > However, LyX 1.5 has dropped support for Qt2 so you should feel free > | > to use Qt3's designer with the .ui files in the qt2 tree. Perhaps > | > someone might rename the qt2 directory as qt3 to avoid confusion? > | > | Lars wanted to do that. > > and unless you have a lot of logical modification, I can just do that. > Shall I? Yes please. Georg
Re: [patch] fix bug 1473: Implement phantom in math
Enrico Forestieri [EMAIL PROTECTED] writes: Perhaps the old file was generated with an older designer and I don't know if my changes would be compatible with Qt2. The .ui files were all generated and maintained with Qt2's designer, yes. However, LyX 1.5 has dropped support for Qt2 so you should feel free to use Qt3's designer with the .ui files in the qt2 tree. Perhaps someone might rename the qt2 directory as qt3 to avoid confusion? Angus
Re: [patch] fix bug 1473: Implement phantom in math
Angus Leeming wrote: The .ui files were all generated and maintained with Qt2's designer, yes. However, LyX 1.5 has dropped support for Qt2 so you should feel free to use Qt3's designer with the .ui files in the qt2 tree. Perhaps someone might rename the qt2 directory as qt3 to avoid confusion? Lars wanted to do that. Georg
Re: [patch] fix bug 1473: Implement phantom in math
Enrico Forestieri <[EMAIL PROTECTED]> writes: > Perhaps the old file was generated with an older designer and I don't > know if my changes would be compatible with Qt2. The .ui files were all generated and maintained with Qt2's designer, yes. However, LyX 1.5 has dropped support for Qt2 so you should feel free to use Qt3's designer with the .ui files in the qt2 tree. Perhaps someone might rename the qt2 directory as qt3 to avoid confusion? Angus
Re: [patch] fix bug 1473: Implement phantom in math
Angus Leeming wrote: > The .ui files were all generated and maintained with Qt2's designer, yes. > However, LyX 1.5 has dropped support for Qt2 so you should feel free to > use Qt3's designer with the .ui files in the qt2 tree. Perhaps someone > might rename the qt2 directory as qt3 to avoid confusion? Lars wanted to do that. Georg
Re: [patch] fix bug 1473: Implement phantom in math
Enrico Forestieri wrote: That's strange. I see the same thing in Windows, Debian and Solaris. It is independent of the fonts chosen for display. Now I see that you meant \{ etc without \bigl. This is the same here. The reason is that \lbrace and \rbrace are recognized as a symbol of the cmsy font, and \{ and \} are drawn in the normal math font. I attach here a LyX file and a png image showing how I see it on screen. Also, unrecognized latex commands are shown in a red italic type. That is normal. Georg
Re: [patch] fix bug 1473: Implement phantom in math
On Fri, Apr 21, 2006 at 09:17:43AM +0200, Georg Baum wrote: Enrico Forestieri wrote: That's strange. I see the same thing in Windows, Debian and Solaris. It is independent of the fonts chosen for display. Now I see that you meant \{ etc without \bigl. This is the same here. The reason is that \lbrace and \rbrace are recognized as a symbol of the cmsy font, and \{ and \} are drawn in the normal math font. I attach here a LyX file and a png image showing how I see it on screen. Also, unrecognized latex commands are shown in a red italic type. That is normal. You mean it's a 1.4 regression, I suppose :( -- Enrico
Re: [patch] fix bug 1473: Implement phantom in math
On Thu, Apr 20, 2006 at 06:56:57PM +0200, Georg Baum wrote: Enrico Forestieri wrote: This is perfect! I tested it and think that this should also go in 1.4. Jean-Marc will tell. What is missing now is support for these in the math panel. It should not be too difficult to add, I would simply make a copy of the existing delimiters dialog. The images are all there already. Do you want to have a go? I thought about it and my idea is to retain the existing delimiter dialog but placing a combobox next to the Keep matched checkbox. The default combobox item would be Variable size, and the other items would be labeled big size, Big size, and so on. The combobox activated() signal would be connected to a slot function recording the choice. Now, when the Insert button is clicked, the code inserting \leftldelim and \rightrdelim should be changed to instead insert \biglldelim and \bigrrdelim according to the recorded choice. This is the theory, but in practice I am a Qt ignorant and have no idea of what I should do to achieve that goal. Moreover, I think that I should tweak QDelimiterDialogBase.ui and this is a big problem as I don't grok that format. My intuition says that probably there is some GUI for dealing with .ui files (designer? Yes, I really mean that I know next to nothing about programming Qt). In conclusion, I think that you would do in a few minutes what I would need a few weeks to do... -- Enrico
Re: [patch] fix bug 1473: Implement phantom in math
Enrico Forestieri wrote: You mean it's a 1.4 regression, I suppose :( Ah yes, I forgot already that we had tt font in 1.3. Georg PS: It's no smiley day.
Re: [patch] fix bug 1473: Implement phantom in math
Enrico Forestieri wrote: I thought about it and my idea is to retain the existing delimiter dialog but placing a combobox next to the Keep matched checkbox. The default combobox item would be Variable size, and the other items would be labeled big size, Big size, and so on. For example. The combobox activated() signal would be connected to a slot function recording the choice. Now, when the Insert button is clicked, the code inserting \leftldelim and \rightrdelim should be changed to instead insert \biglldelim and \bigrrdelim according to the recorded choice. This is the theory, but in practice I am a Qt ignorant and have no idea of what I should do to achieve that goal. Moreover, I think that I should tweak QDelimiterDialogBase.ui and this is a big problem as I don't grok that format. My intuition says that probably there is some GUI for dealing with .ui files (designer? Yes, I really mean that I know next to nothing about programming Qt). Yes, designer is the GUI for .ui files, and it is pretty easy to use. In conclusion, I think that you would do in a few minutes what I would need a few weeks to do... You seem to overestimate my qt knowledge, I only program qt from time to time. I still think that this case is easy to do even for a qt newby: There are a few signals in the math dialog already, and it should not be too difficult to simply copy one and make it do what you want. Of course I don't want to force you to do something that you don't like, but I really think that it is not too difficult. Georg
Re: [patch] fix bug 1473: Implement phantom in math
On Fri, Apr 21, 2006 at 04:54:57PM +0200, Georg Baum wrote: Enrico Forestieri wrote: I thought about it and my idea is to retain the existing delimiter dialog but placing a combobox next to the Keep matched checkbox. The default combobox item would be Variable size, and the other items would be labeled big size, Big size, and so on. For example. The combobox activated() signal would be connected to a slot function recording the choice. Now, when the Insert button is clicked, the code inserting \leftldelim and \rightrdelim should be changed to instead insert \biglldelim and \bigrrdelim according to the recorded choice. This is the theory, but in practice I am a Qt ignorant and have no idea of what I should do to achieve that goal. Moreover, I think that I should tweak QDelimiterDialogBase.ui and this is a big problem as I don't grok that format. My intuition says that probably there is some GUI for dealing with .ui files (designer? Yes, I really mean that I know next to nothing about programming Qt). Yes, designer is the GUI for .ui files, and it is pretty easy to use. Indeed. I was able to add the combobox even almost without knowing what I was doing. Then I saved the file and did a diff with the old version. Too much things seem to have changed for a so simple addition and I feel nervous when I can't understand what is happening. Perhaps the old file was generated with an older designer and I don't know if my changes would be compatible with Qt2. In conclusion, I think that you would do in a few minutes what I would need a few weeks to do... You seem to overestimate my qt knowledge, I only program qt from time to time. I still think that this case is easy to do even for a qt newby: There are a few signals in the math dialog already, and it should not be too difficult to simply copy one and make it do what you want. My impression is that Qt is orders of magnitude easier to program than Xlib, and I have already successfully hacked X11 programs in the past. So, I think it is not a too big mouthful for me. Of course I don't want to force you to do something that you don't like, but I really think that it is not too difficult. Then you are using the wrong tactic, as you have to tell that it is very difficult to stimulate me ;-) (the no smiley day has passed, now) -- Enrico
Re: [patch] fix bug 1473: Implement phantom in math
Enrico Forestieri wrote: > That's strange. I see the same thing in Windows, Debian and Solaris. > It is independent of the fonts chosen for display. Now I see that you meant \{ etc without \bigl. This is the same here. The reason is that \lbrace and \rbrace are recognized as a symbol of the cmsy font, and \{ and \} are drawn in the normal math font. > I attach here a LyX file and a png image showing how I see it on screen. > Also, unrecognized latex commands are shown in a red italic type. That is normal. Georg
Re: [patch] fix bug 1473: Implement phantom in math
On Fri, Apr 21, 2006 at 09:17:43AM +0200, Georg Baum wrote: > Enrico Forestieri wrote: > > > That's strange. I see the same thing in Windows, Debian and Solaris. > > It is independent of the fonts chosen for display. > > Now I see that you meant \{ etc without \bigl. This is the same here. The > reason is that \lbrace and \rbrace are recognized as a symbol of the cmsy > font, and \{ and \} are drawn in the normal math font. > > > I attach here a LyX file and a png image showing how I see it on screen. > > Also, unrecognized latex commands are shown in a red italic type. > > That is normal. You mean it's a 1.4 regression, I suppose :( -- Enrico
Re: [patch] fix bug 1473: Implement phantom in math
On Thu, Apr 20, 2006 at 06:56:57PM +0200, Georg Baum wrote: > Enrico Forestieri wrote: > > > This is perfect! I tested it and think that this should also go in 1.4. > > Jean-Marc will tell. What is missing now is support for these in the math > panel. It should not be too difficult to add, I would simply make a copy of > the existing delimiters dialog. The images are all there already. Do you > want to have a go? I thought about it and my idea is to retain the existing delimiter dialog but placing a combobox next to the "Keep matched" checkbox. The default combobox item would be "Variable size", and the other items would be labeled "big size", "Big size", and so on. The combobox activated() signal would be connected to a slot function recording the choice. Now, when the Insert button is clicked, the code inserting \left and \right should be changed to instead insert \bigl and \bigr according to the recorded choice. This is the theory, but in practice I am a Qt ignorant and have no idea of what I should do to achieve that goal. Moreover, I think that I should tweak QDelimiterDialogBase.ui and this is a big problem as I don't grok that format. My intuition says that probably there is some GUI for dealing with .ui files (designer? Yes, I really mean that I know next to nothing about programming Qt). In conclusion, I think that you would do in a few minutes what I would need a few weeks to do... -- Enrico
Re: [patch] fix bug 1473: Implement phantom in math
Enrico Forestieri wrote: > You mean it's a 1.4 regression, I suppose :( Ah yes, I forgot already that we had tt font in 1.3. Georg PS: It's no smiley day.
Re: [patch] fix bug 1473: Implement phantom in math
Enrico Forestieri wrote: > I thought about it and my idea is to retain the existing delimiter > dialog but placing a combobox next to the "Keep matched" checkbox. > The default combobox item would be "Variable size", and the other > items would be labeled "big size", "Big size", and so on. For example. > The combobox activated() signal would be connected to a slot function > recording the choice. Now, when the Insert button is clicked, the > code inserting \left and \right should be changed > to instead insert \bigl and \bigr according to the > recorded choice. > > This is the theory, but in practice I am a Qt ignorant and have no > idea of what I should do to achieve that goal. Moreover, I think > that I should tweak QDelimiterDialogBase.ui and this is a big > problem as I don't grok that format. My intuition says that > probably there is some GUI for dealing with .ui files (designer? > Yes, I really mean that I know next to nothing about programming Qt). Yes, designer is the GUI for .ui files, and it is pretty easy to use. > In conclusion, I think that you would do in a few minutes what > I would need a few weeks to do... You seem to overestimate my qt knowledge, I only program qt from time to time. I still think that this case is easy to do even for a qt newby: There are a few signals in the math dialog already, and it should not be too difficult to simply copy one and make it do what you want. Of course I don't want to force you to do something that you don't like, but I really think that it is not too difficult. Georg
Re: [patch] fix bug 1473: Implement phantom in math
On Fri, Apr 21, 2006 at 04:54:57PM +0200, Georg Baum wrote: > Enrico Forestieri wrote: > > > I thought about it and my idea is to retain the existing delimiter > > dialog but placing a combobox next to the "Keep matched" checkbox. > > The default combobox item would be "Variable size", and the other > > items would be labeled "big size", "Big size", and so on. > > For example. > > > The combobox activated() signal would be connected to a slot function > > recording the choice. Now, when the Insert button is clicked, the > > code inserting \left and \right should be changed > > to instead insert \bigl and \bigr according to the > > recorded choice. > > > > This is the theory, but in practice I am a Qt ignorant and have no > > idea of what I should do to achieve that goal. Moreover, I think > > that I should tweak QDelimiterDialogBase.ui and this is a big > > problem as I don't grok that format. My intuition says that > > probably there is some GUI for dealing with .ui files (designer? > > Yes, I really mean that I know next to nothing about programming Qt). > > Yes, designer is the GUI for .ui files, and it is pretty easy to use. Indeed. I was able to add the combobox even almost without knowing what I was doing. Then I saved the file and did a diff with the old version. Too much things seem to have changed for a so simple addition and I feel nervous when I can't understand what is happening. Perhaps the old file was generated with an older designer and I don't know if my changes would be compatible with Qt2. > > In conclusion, I think that you would do in a few minutes what > > I would need a few weeks to do... > > You seem to overestimate my qt knowledge, I only program qt from time to > time. I still think that this case is easy to do even for a qt newby: There > are a few signals in the math dialog already, and it should not be too > difficult to simply copy one and make it do what you want. My impression is that Qt is orders of magnitude easier to program than Xlib, and I have already successfully hacked X11 programs in the past. So, I think it is not a too big mouthful for me. > Of course I don't want to force you to do something that you don't like, but > I really think that it is not too difficult. Then you are using the wrong tactic, as you have to tell that it is very difficult to stimulate me ;-) (the no smiley day has passed, now) -- Enrico
Re: [patch] fix bug 1473: Implement phantom in math
Enrico Forestieri wrote: I am not able to generate a bigger { by \bigl\{ in mathed (I must use \bigl\lbrace for that) because I think that the code dealing with \bigl has not a chance of viewing \{, being it transformed to {}. This is currently beyond my capabilities (but I continue learning). Only a tiny bit was missing: The transformation of { and } to \{ and \}, respectively in MathNestInset::interpret. I am going to ccommit the attached patch. Georg Log: Make MathBigInset working * src/cursor.C (LCursor::plainInsert): combine the previous math atom with the new one to a MathBigInset if possible * src/mathed/math_biginset.[Ch] (MathBigInset::name): implement (MathBigInset::isBigInsetDelim): new, test whether a given token is a valid MathBigInset delimiter * src/mathed/math_biginset.C (MathBigInset::size): handle Big, Bigg and Biggg (MathBigInset::increase): ditto (MathBigInset::draw): fix deco drawing (MathBigInset::write): append space if necessary * src/mathed/math_factory.C (createMathInset): handle l-inset == big * src/mathed/math_parser.C (Token::asInput): return a token as input, stolen from tex2lyx (void Parser::parse1): Create a MathBigInset when needed * src/mathed/math_support.C: (deco_table): add lbrace and rbrace * src/mathed/math_nestinset.C (MathNestInset::interpret): combine the previous math atom with the new character to a MathBigInset if possible * src/ParagraphParameters.C (findToken): move from here * src/support/lstrings.[Ch] (findToken): to here * lib/symbols: add MathBigInset symbolsIndex: src/cursor.C === --- src/cursor.C (Revision 13698) +++ src/cursor.C (Arbeitskopie) @@ -35,10 +35,12 @@ #include insets/insettabular.h #include insets/insettext.h +#include mathed/math_biginset.h #include mathed/math_data.h #include mathed/math_inset.h #include mathed/math_scriptinset.h #include mathed/math_macrotable.h +#include mathed/math_parser.h #include support/limited_stack.h @@ -650,6 +652,22 @@ void LCursor::markErase() void LCursor::plainInsert(MathAtom const t) { + // Create a MathBigInset from cell()[pos() - 1] and t if possible + if (!empty() pos() 0 cell()[pos() - 1]-asUnknownInset()) { + string const name = asString(t); + if (MathBigInset::isBigInsetDelim(name)) { + string prev = asString(cell()[pos() - 1]); + if (prev[0] == '\\') { +prev = prev.substr(1); +latexkeys const * l = in_word_set(prev); +if (l l-inset == big) { + cell()[pos() - 1] = + MathAtom(new MathBigInset(prev, name)); + return; +} + } + } + } cell().insert(pos(), t); ++pos(); } Index: src/mathed/math_biginset.h === --- src/mathed/math_biginset.h (Revision 13698) +++ src/mathed/math_biginset.h (Arbeitskopie) @@ -16,12 +16,14 @@ #include string -/// Inset for \bigl Co. +/// Inset for \\bigl Co. class MathBigInset : public MathDimInset { public: /// MathBigInset(std::string const name, std::string const delim); /// + std::string name() const; + /// void metrics(MetricsInfo mi, Dimension dim) const; /// void draw(PainterInfo pi, int x, int y) const; @@ -29,6 +31,8 @@ public: void write(WriteStream os) const; /// void normalize(NormalStream os) const; + /// + static bool isBigInsetDelim(std::string const ); private: virtual std::auto_ptrInsetBase doClone() const; @@ -37,9 +41,9 @@ private: /// double increase() const; - /// \bigl or what? + /// \\bigl or what? std::string const name_; - /// ( or [ or Vert... + /// ( or [ or \\Vert... std::string const delim_; }; Index: src/mathed/math_factory.C === --- src/mathed/math_factory.C (Revision 13698) +++ src/mathed/math_factory.C (Arbeitskopie) @@ -276,6 +276,10 @@ MathAtom createMathInset(string const return MathAtom(new MathFontOldInset(l)); if (inset == matrix) return MathAtom(new MathAMSArrayInset(s)); + if (inset == big) + // we can't create a MathBigInset, since the argument + // is missing. + return MathAtom(new MathUnknownInset(s)); return MathAtom(new MathSymbolInset(l)); } Index: src/mathed/math_parser.C === --- src/mathed/math_parser.C (Revision 13698) +++ src/mathed/math_parser.C (Arbeitskopie) @@ -40,6 +40,7 @@ following hack as starting point to writ #include math_parser.h #include math_arrayinset.h +#include math_biginset.h #include math_braceinset.h #include math_charinset.h #include math_colorinset.h @@ -256,6 +257,8 @@ public: char character() const { return char_; } /// string asString() const { return cs_.size() ? cs_ :
Re: [patch] fix bug 1473: Implement phantom in math
On Thu, Apr 20, 2006 at 11:55:38AM +0200, Georg Baum wrote: Enrico Forestieri wrote: I am not able to generate a bigger { by \bigl\{ in mathed (I must use \bigl\lbrace for that) because I think that the code dealing with \bigl has not a chance of viewing \{, being it transformed to {}. This is currently beyond my capabilities (but I continue learning). Only a tiny bit was missing: The transformation of { and } to \{ and \}, respectively in MathNestInset::interpret. I am going to ccommit the attached patch. This is perfect! I tested it and think that this should also go in 1.4. The only glitch is that \{ and \} are different from \lbrace and \rbrace on screen. I don't like that \{ and \} are in italic, too. This is of secondary importance, though. Many thanks, Georg -- Enrico
Re: [patch] fix bug 1473: Implement phantom in math
Enrico Forestieri wrote: This is perfect! I tested it and think that this should also go in 1.4. Jean-Marc will tell. What is missing now is support for these in the math panel. It should not be too difficult to add, I would simply make a copy of the existing delimiters dialog. The images are all there already. Do you want to have a go? The only glitch is that \{ and \} are different from \lbrace and \rbrace on screen. I don't like that \{ and \} are in italic, too. This is of secondary importance, though. Not here. I get the same results on screen. Are you sure that you don't have parts from an old patch applied? Georg
Re: [patch] fix bug 1473: Implement phantom in math
On Thu, Apr 20, 2006 at 06:56:57PM +0200, Georg Baum wrote: Enrico Forestieri wrote: This is perfect! I tested it and think that this should also go in 1.4. Jean-Marc will tell. What is missing now is support for these in the math panel. It should not be too difficult to add, I would simply make a copy of the existing delimiters dialog. The images are all there already. Do you want to have a go? Sure. I am not having so fun by a decade now. When I'll fail I'll ask for help, though ;-) The only glitch is that \{ and \} are different from \lbrace and \rbrace on screen. I don't like that \{ and \} are in italic, too. This is of secondary importance, though. Not here. I get the same results on screen. Are you sure that you don't have parts from an old patch applied? That's strange. I see the same thing in Windows, Debian and Solaris. It is independent of the fonts chosen for display. I attach here a LyX file and a png image showing how I see it on screen. Also, unrecognized latex commands are shown in a red italic type. -- Enrico #LyX 1.4.2svn created this file. For more info see http://www.lyx.org/ \lyxformat 245 \begin_document \begin_header \textclass article \language english \inputencoding auto \fontscheme default \graphics default \paperfontsize default \papersize default \use_geometry false \use_amsmath 1 \cite_engine basic \use_bibtopic false \paperorientation portrait \secnumdepth 3 \tocdepth 3 \paragraph_separation indent \defskip medskip \quotes_language english \papercolumns 1 \papersides 1 \paperpagestyle default \tracking_changes false \output_changes false \end_header \begin_body \begin_layout Standard \begin_inset Formula \[ \{\lbrace\rbrace\}\] \end_inset \end_layout \end_body \end_document braces.png Description: PNG image
Re: [patch] fix bug 1473: Implement phantom in math
Enrico Forestieri wrote: > I am not able to generate a bigger "{" by "\bigl\{" in mathed (I must > use "\bigl\lbrace" for that) because I think that the code dealing > with \bigl has not a chance of viewing \{, being it transformed to {}. > This is currently beyond my capabilities (but I continue learning). Only a tiny bit was missing: The transformation of { and } to \{ and \}, respectively in MathNestInset::interpret. I am going to ccommit the attached patch. Georg Log: Make MathBigInset working * src/cursor.C (LCursor::plainInsert): combine the previous math atom with the new one to a MathBigInset if possible * src/mathed/math_biginset.[Ch] (MathBigInset::name): implement (MathBigInset::isBigInsetDelim): new, test whether a given token is a valid MathBigInset delimiter * src/mathed/math_biginset.C (MathBigInset::size): handle Big, Bigg and Biggg (MathBigInset::increase): ditto (MathBigInset::draw): fix deco drawing (MathBigInset::write): append space if necessary * src/mathed/math_factory.C (createMathInset): handle l->inset == "big" * src/mathed/math_parser.C (Token::asInput): return a token as input, stolen from tex2lyx (void Parser::parse1): Create a MathBigInset when needed * src/mathed/math_support.C: (deco_table): add lbrace and rbrace * src/mathed/math_nestinset.C (MathNestInset::interpret): combine the previous math atom with the new character to a MathBigInset if possible * src/ParagraphParameters.C (findToken): move from here * src/support/lstrings.[Ch] (findToken): to here * lib/symbols: add MathBigInset symbolsIndex: src/cursor.C === --- src/cursor.C (Revision 13698) +++ src/cursor.C (Arbeitskopie) @@ -35,10 +35,12 @@ #include "insets/insettabular.h" #include "insets/insettext.h" +#include "mathed/math_biginset.h" #include "mathed/math_data.h" #include "mathed/math_inset.h" #include "mathed/math_scriptinset.h" #include "mathed/math_macrotable.h" +#include "mathed/math_parser.h" #include "support/limited_stack.h" @@ -650,6 +652,22 @@ void LCursor::markErase() void LCursor::plainInsert(MathAtom const & t) { + // Create a MathBigInset from cell()[pos() - 1] and t if possible + if (!empty() && pos() > 0 && cell()[pos() - 1]->asUnknownInset()) { + string const name = asString(t); + if (MathBigInset::isBigInsetDelim(name)) { + string prev = asString(cell()[pos() - 1]); + if (prev[0] == '\\') { +prev = prev.substr(1); +latexkeys const * l = in_word_set(prev); +if (l && l->inset == "big") { + cell()[pos() - 1] = + MathAtom(new MathBigInset(prev, name)); + return; +} + } + } + } cell().insert(pos(), t); ++pos(); } Index: src/mathed/math_biginset.h === --- src/mathed/math_biginset.h (Revision 13698) +++ src/mathed/math_biginset.h (Arbeitskopie) @@ -16,12 +16,14 @@ #include -/// Inset for \bigl & Co. +/// Inset for \\bigl & Co. class MathBigInset : public MathDimInset { public: /// MathBigInset(std::string const & name, std::string const & delim); /// + std::string name() const; + /// void metrics(MetricsInfo & mi, Dimension & dim) const; /// void draw(PainterInfo & pi, int x, int y) const; @@ -29,6 +31,8 @@ public: void write(WriteStream & os) const; /// void normalize(NormalStream & os) const; + /// + static bool isBigInsetDelim(std::string const &); private: virtual std::auto_ptr doClone() const; @@ -37,9 +41,9 @@ private: /// double increase() const; - /// \bigl or what? + /// \\bigl or what? std::string const name_; - /// ( or [ or Vert... + /// ( or [ or \\Vert... std::string const delim_; }; Index: src/mathed/math_factory.C === --- src/mathed/math_factory.C (Revision 13698) +++ src/mathed/math_factory.C (Arbeitskopie) @@ -276,6 +276,10 @@ MathAtom createMathInset(string const & return MathAtom(new MathFontOldInset(l)); if (inset == "matrix") return MathAtom(new MathAMSArrayInset(s)); + if (inset == "big") + // we can't create a MathBigInset, since the argument + // is missing. + return MathAtom(new MathUnknownInset(s)); return MathAtom(new MathSymbolInset(l)); } Index: src/mathed/math_parser.C === --- src/mathed/math_parser.C (Revision 13698) +++ src/mathed/math_parser.C (Arbeitskopie) @@ -40,6 +40,7 @@ following hack as starting point to writ #include "math_parser.h" #include "math_arrayinset.h" +#include "math_biginset.h" #include "math_braceinset.h" #include "math_charinset.h" #include "math_colorinset.h" @@ -256,6 +257,8 @@ public: char character() const { return char_; } ///
Re: [patch] fix bug 1473: Implement phantom in math
On Thu, Apr 20, 2006 at 11:55:38AM +0200, Georg Baum wrote: > Enrico Forestieri wrote: > > > I am not able to generate a bigger "{" by "\bigl\{" in mathed (I must > > use "\bigl\lbrace" for that) because I think that the code dealing > > with \bigl has not a chance of viewing \{, being it transformed to {}. > > This is currently beyond my capabilities (but I continue learning). > > Only a tiny bit was missing: The transformation of { and } to \{ and \}, > respectively in MathNestInset::interpret. I am going to ccommit the > attached patch. This is perfect! I tested it and think that this should also go in 1.4. The only glitch is that \{ and \} are different from \lbrace and \rbrace on screen. I don't like that \{ and \} are in italic, too. This is of secondary importance, though. Many thanks, Georg -- Enrico
Re: [patch] fix bug 1473: Implement phantom in math
Enrico Forestieri wrote: > This is perfect! I tested it and think that this should also go in 1.4. Jean-Marc will tell. What is missing now is support for these in the math panel. It should not be too difficult to add, I would simply make a copy of the existing delimiters dialog. The images are all there already. Do you want to have a go? > The only glitch is that \{ and \} are different from \lbrace and > \rbrace on screen. I don't like that \{ and \} are in italic, too. > This is of secondary importance, though. Not here. I get the same results on screen. Are you sure that you don't have parts from an old patch applied? Georg
Re: [patch] fix bug 1473: Implement phantom in math
On Thu, Apr 20, 2006 at 06:56:57PM +0200, Georg Baum wrote: > Enrico Forestieri wrote: > > > This is perfect! I tested it and think that this should also go in 1.4. > > Jean-Marc will tell. What is missing now is support for these in the math > panel. It should not be too difficult to add, I would simply make a copy of > the existing delimiters dialog. The images are all there already. Do you > want to have a go? Sure. I am not having so fun by a decade now. When I'll fail I'll ask for help, though ;-) > > The only glitch is that \{ and \} are different from \lbrace and > > \rbrace on screen. I don't like that \{ and \} are in italic, too. > > This is of secondary importance, though. > > Not here. I get the same results on screen. Are you sure that you don't have > parts from an old patch applied? That's strange. I see the same thing in Windows, Debian and Solaris. It is independent of the fonts chosen for display. I attach here a LyX file and a png image showing how I see it on screen. Also, unrecognized latex commands are shown in a red italic type. -- Enrico #LyX 1.4.2svn created this file. For more info see http://www.lyx.org/ \lyxformat 245 \begin_document \begin_header \textclass article \language english \inputencoding auto \fontscheme default \graphics default \paperfontsize default \papersize default \use_geometry false \use_amsmath 1 \cite_engine basic \use_bibtopic false \paperorientation portrait \secnumdepth 3 \tocdepth 3 \paragraph_separation indent \defskip medskip \quotes_language english \papercolumns 1 \papersides 1 \paperpagestyle default \tracking_changes false \output_changes false \end_header \begin_body \begin_layout Standard \begin_inset Formula \[ \{\lbrace\rbrace\}\] \end_inset \end_layout \end_body \end_document braces.png Description: PNG image
Re: [patch] fix bug 1473: Implement phantom in math
On Tue, Apr 18, 2006 at 07:06:10AM +0200, Enrico Forestieri wrote: On Mon, Apr 17, 2006 at 08:57:54PM +0200, Georg Baum wrote: Am Montag, 17. April 2006 18:24 schrieb Enrico Forestieri: It would also be nice having a report in the status line about the size of the delimiter when the cursor is next to it. That is not possible with this approach, since the status line info is only obtained if the cursor is inside an inset. Ok, I think one can live with that. However, even converting it to 1.4, I don't obtain correct results loading it in 1.5. I also attach here a test file test-1.4.lyx and the results I obtain with 1.4 (test-1.4.png) and 1.5 (test-1.5.png). The reason was a stupid mistake I made. Please try the attached, updated patch. I intend to commit this unless I get objections regarding the general approach. This patch works with both 1.4 and 1.5. However, there is a problem with brackets. Bigger { and } can be created on screen but the generated latex is wrong. For example one obtains \Bigl { and \Bigr } instead of the correct \Bigl\{ and \Bigr\}. Conversely, when loading a file containing \Bigl\{, this is not rendered on screen. Please, try the attached LyX document. I created the first two brackets with an unpatched version of LyX and added the second couple with a patched one. Other constructs such as \bigl\Vert seem to work. Thank you for your efforts Georg, I wish I could be more helpful here. I can be of some help, perhaps ;-) Please try the attached patch, updated from yours. I solved the problem of loading a file containing \Bigl\{ and solved the problem of generating a bigger { or } within LyX, introducing \lbrace and \rbrace, which seemingly you forgot. I am not able to generate a bigger { by \bigl\{ in mathed (I must use \bigl\lbrace for that) because I think that the code dealing with \bigl has not a chance of viewing \{, being it transformed to {}. This is currently beyond my capabilities (but I continue learning). -- Enrico Index: src/cursor.C === --- src/cursor.C(revision 13692) +++ src/cursor.C(working copy) @@ -35,10 +35,12 @@ #include insets/insettabular.h #include insets/insettext.h +#include mathed/math_biginset.h #include mathed/math_data.h #include mathed/math_inset.h #include mathed/math_scriptinset.h #include mathed/math_macrotable.h +#include mathed/math_parser.h #include support/limited_stack.h @@ -650,6 +652,22 @@ void LCursor::markErase() void LCursor::plainInsert(MathAtom const t) { + // Create a MathBigInset from cell()[pos() - 1] and t if possible + if (!empty() pos() 0 cell()[pos() - 1]-asUnknownInset()) { + string const name = asString(t); + if (MathBigInset::isBigInsetDelim(name)) { + string prev = asString(cell()[pos() - 1]); + if (prev[0] == '\\') { + prev = prev.substr(1); + latexkeys const * l = in_word_set(prev); + if (l l-inset == big) { + cell()[pos() - 1] = + MathAtom(new MathBigInset(prev, name)); + return; + } + } + } + } cell().insert(pos(), t); ++pos(); } Index: src/mathed/math_biginset.h === --- src/mathed/math_biginset.h (revision 13692) +++ src/mathed/math_biginset.h (working copy) @@ -16,12 +16,14 @@ #include string -/// Inset for \bigl Co. +/// Inset for \\bigl Co. class MathBigInset : public MathDimInset { public: /// MathBigInset(std::string const name, std::string const delim); /// + std::string name() const; + /// void metrics(MetricsInfo mi, Dimension dim) const; /// void draw(PainterInfo pi, int x, int y) const; @@ -29,6 +31,8 @@ public: void write(WriteStream os) const; /// void normalize(NormalStream os) const; + /// + static bool isBigInsetDelim(std::string const ); private: virtual std::auto_ptrInsetBase doClone() const; @@ -37,9 +41,9 @@ private: /// double increase() const; - /// \bigl or what? + /// \\bigl or what? std::string const name_; - /// ( or [ or Vert... + /// ( or [ or \\Vert... std::string const delim_; }; Index: src/mathed/math_factory.C === --- src/mathed/math_factory.C (revision 13692) +++ src/mathed/math_factory.C (working copy) @@ -276,6 +276,10 @@ MathAtom createMathInset(string const return MathAtom(new MathFontOldInset(l));
Re: [patch] fix bug 1473: Implement phantom in math
On Tue, Apr 18, 2006 at 07:06:10AM +0200, Enrico Forestieri wrote: > On Mon, Apr 17, 2006 at 08:57:54PM +0200, Georg Baum wrote: > > > Am Montag, 17. April 2006 18:24 schrieb Enrico Forestieri: > > > > It would also be nice having a report in the status line about the > > > size of the delimiter when the cursor is next to it. > > > > That is not possible with this approach, since the status line info is > > only obtained if the cursor is inside an inset. > > Ok, I think one can live with that. > > > > However, even converting it to 1.4, I don't obtain correct results > > > loading it in 1.5. I also attach here a test file test-1.4.lyx and > > > the results I obtain with 1.4 (test-1.4.png) and 1.5 (test-1.5.png). > > > > The reason was a stupid mistake I made. Please try the attached, updated > > patch. I intend to commit this unless I get objections regarding the > > general approach. > > This patch works with both 1.4 and 1.5. However, there is a problem > with brackets. Bigger "{" and "}" can be created on screen but the > generated latex is wrong. For example one obtains "\Bigl {" and > "\Bigr }" instead of the correct "\Bigl\{" and "\Bigr\}". > Conversely, when loading a file containing "\Bigl\{", this is not > rendered on screen. > > Please, try the attached LyX document. I created the first two > brackets with an unpatched version of LyX and added the second couple > with a patched one. > > Other constructs such as \bigl\Vert seem to work. > > Thank you for your efforts Georg, I wish I could be more helpful here. I can be of some help, perhaps ;-) Please try the attached patch, updated from yours. I solved the problem of loading a file containing "\Bigl\{" and solved the problem of generating a bigger "{" or "}" within LyX, introducing "\lbrace" and "\rbrace", which seemingly you forgot. I am not able to generate a bigger "{" by "\bigl\{" in mathed (I must use "\bigl\lbrace" for that) because I think that the code dealing with \bigl has not a chance of viewing \{, being it transformed to {}. This is currently beyond my capabilities (but I continue learning). -- Enrico Index: src/cursor.C === --- src/cursor.C(revision 13692) +++ src/cursor.C(working copy) @@ -35,10 +35,12 @@ #include "insets/insettabular.h" #include "insets/insettext.h" +#include "mathed/math_biginset.h" #include "mathed/math_data.h" #include "mathed/math_inset.h" #include "mathed/math_scriptinset.h" #include "mathed/math_macrotable.h" +#include "mathed/math_parser.h" #include "support/limited_stack.h" @@ -650,6 +652,22 @@ void LCursor::markErase() void LCursor::plainInsert(MathAtom const & t) { + // Create a MathBigInset from cell()[pos() - 1] and t if possible + if (!empty() && pos() > 0 && cell()[pos() - 1]->asUnknownInset()) { + string const name = asString(t); + if (MathBigInset::isBigInsetDelim(name)) { + string prev = asString(cell()[pos() - 1]); + if (prev[0] == '\\') { + prev = prev.substr(1); + latexkeys const * l = in_word_set(prev); + if (l && l->inset == "big") { + cell()[pos() - 1] = + MathAtom(new MathBigInset(prev, name)); + return; + } + } + } + } cell().insert(pos(), t); ++pos(); } Index: src/mathed/math_biginset.h === --- src/mathed/math_biginset.h (revision 13692) +++ src/mathed/math_biginset.h (working copy) @@ -16,12 +16,14 @@ #include -/// Inset for \bigl & Co. +/// Inset for \\bigl & Co. class MathBigInset : public MathDimInset { public: /// MathBigInset(std::string const & name, std::string const & delim); /// + std::string name() const; + /// void metrics(MetricsInfo & mi, Dimension & dim) const; /// void draw(PainterInfo & pi, int x, int y) const; @@ -29,6 +31,8 @@ public: void write(WriteStream & os) const; /// void normalize(NormalStream & os) const; + /// + static bool isBigInsetDelim(std::string const &); private: virtual std::auto_ptr doClone() const; @@ -37,9 +41,9 @@ private: /// double increase() const; - /// \bigl or what? + /// \\bigl or what? std::string const name_; - /// ( or [ or Vert... + /// ( or [ or \\Vert... std::string const delim_; }; Index: src/mathed/math_factory.C === --- src/mathed/math_factory.C (revision 13692) +++ src/mathed/math_factory.C (working copy) @@ -276,6 +276,10 @@ MathAtom
Re: [patch] fix bug 1473: Implement phantom in math
Am Sonntag, 16. April 2006 00:02 schrieb Enrico Forestieri: I think that your approach is the correct the one. The patch works, but the dimension of \bigl( is a bit smaller of ( on screen and this seems odd. Perhaps a tuning is needed. Have a look at MathBigInset::increase(). What would you suggest? Does the size of the delimiters depend on the screen font zoom factor (it should)? However, when I tried to load an existing .lyx file, I got a lot of errors printed to the console and the equations were screwed up. This is strange. Can you destill this to a minimal example file and send it to me? Georg
Re: [patch] fix bug 1473: Implement phantom in math
Am Sonntag, 16. April 2006 11:59 schrieb Lars Gullik Bjønnes: Georg Baum [EMAIL PROTECTED] writes: | Am Samstag, 15. April 2006 10:22 schrieb Lars Gullik Bjønnes: | Eventually something must be done with this if .. if ... if list | | Using a map or an unordered_map seems like a solution, not right now | perhaps. | | I am not sure. What would you store in the map? The problem is that we | sometimes need arguments to the inset constructors. You can store functions to run. And that would mean to create a function for each inset? I don't think it would be better than the if ... if chain. At least it would be a lot more to write. Georg