Best practive for dependency incjection
Hello list, I am used to test the code I while I am writing it. The big advantage is, that the code is quality tested. The immediate advantage is, that it gives a simple method to run the code, to see how it works at all, without firering up the whole application. Being new with C++ I try to transfer this approach from other languages like Java or Ruby. Depencency injection is important, to be able to replace dependencies by mock objects. However with C++ it is necessary to mangage the memory usage. For dependency injection this brings up the question, when and where to free the memory. Do you have a policy how to deal with this for Lyx in special and is there a good tutorial how to handle that with C++ in general? THX \Elmar -- Elmar Hinz Freiherr-vom-Stein-Str. 1 33014 Bad Driburg TYPO3 community contact: t.3.e.l.m.a...@.g.m.a.i.l.dot.c.o.m personal contact: e.l.m.a.r.dot.h.i.n...@.g.m.a.i.l.dot.c.o.m
Re: Source view window
Edwin Leuven wrote: no i use 4.8.4 in the patch i send, i used QHBoxLayout (which inherits from QBoxLayout) and that worked fine for me? okok :) the fact that editing .ui file in vim took me shorter time than finding how to setup QHBoxLayout in designer suggest that i should keep respectful distance from this stuff ;) p
Re: LyX 2.0.6 Binaries
Am 06.05.2013 um 00:01 schrieb Jean-Marc Lasgouttes lasgout...@lyx.org: Le 05/05/13 23:12, Stephan Witt a écrit : Am 05.05.2013 um 22:57 schrieb Jean-Marc Lasgouttes lasgout...@lyx.org: Le 05/05/13 21:52, Stephan Witt a écrit : This would lead to a LyX running on Lion or Mountain Lion only. The SDK for 10.6 (Snow Leopard) I don't have anymore. @JMarc Sorry, I didn't remember the problem well… It is ::unsetenv with return type void used in unsetEnv(). The hack I've used to build on 10.5 is this: That does not correspond to what is explained here https://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man3/setenv.3.html but there has to be a reason. This is the relevant contents of stdlib.h: #if __DARWIN_UNIX03 intunsetenv(const char *) __DARWIN_ALIAS(unsetenv); #else /* !__DARWIN_UNIX03 */ void unsetenv(const char *); #endif /* __DARWIN_UNIX03 */ I don't have the time to search for the reason __DARWIN_UNIX03 not being defined. I read here https://stat.ethz.ch/pipermail/r-devel/2007-January/044227.html that adding -D_APPLE_C_SOURCE to CPPFLAGS should be enough. This didn't help. But adding -D_XOPEN_SOURCE does the trick. Thanks for the pointer. Stephan
Re: Best practive for dependency incjection
Elmar Hinz wrote: However with C++ it is necessary to mangage the memory usage. For dependency injection this brings up the question, when and where to free the memory. Do you have a policy how to deal with this for Lyx in special and is there a good tutorial how to handle that with C++ in general? There is no special policy, because we don't use this type of pattern. To be honest we don't have any testing framework (except autotest tools which have nothing to do with traditional unit testing). IIRC there were few discussions but no one ever came with realistic plan. Pavel
Re: Updated Feature Description of “Toolbar customization dialog”
Dear Jason, Updates are no longer allowed at this time. Regards, Liviu On Mon, May 6, 2013 at 3:33 AM, Jason jasonwu2...@gmail.com wrote: Hello there, I created a detailed description of what features I'd like to include in “Toolbar customization dialog”. Link: http://goo.gl/YTetM Please kindly take a look and give me any suggestions (things to add? remove or change), thanks in advance. My proposal is also updated. link: http://www.google-melange.com/gsoc/proposal/review/google/gsoc2013/jasonwu2011/6001 Thank you. Jason -- Do you know how to read? http://www.alienetworks.com/srtest.cfm http://goodies.xfce.org/projects/applications/xfce4-dict#speed-reader Do you know how to write? http://garbl.home.comcast.net/~garbl/stylemanual/e.htm#e-mail
Re: [LyX master] Revert tex2lyx/text.cpp: fix a typo spotted by clang
Le lun. 06 mai 2013 01:54:23 CEST, Uwe Stöhr a écrit : commit 1b32a0502e9206813b6b41365848673d8ac70b03 Author: Uwe Stöhr uwesto...@lyx.org Date: Mon May 6 01:54:17 2013 +0200 Revert tex2lyx/text.cpp: fix a typo spotted by clang This reverts commit 055b425b646e748e0c35f0eef89e03e6126a143d. This requires much more work and i don't have time to do this now Yes, I tried that too :) JMarc
Re: Best practive for dependency incjection
Hello Pavel. IIRC there were few discussions but no one ever came with realistic plan. I don't think it needs a big plan at all. Each test is independed, so you can even mix tests from different frameworks. Also testing has already been started. Simply proceed instead of big plans. Especially the sources are completely independet from the tests and should be. The important point is, that testing leads to restructure the source step by step in the spirit of more independency of each class. That makes them better maintainable and reusable. Because of this independence of the tests from the sources it makes sense to put the tests in it's own directory tree: src/go/here/ tests/unit/go/here/ tests/behaviour/go/here/ tests/integration/go/here/ I will evaluate if it's possible to move the existing tests out of the sources as on of the next steps. Regards \Elmar -- Elmar Hinz Freiherr-vom-Stein-Str. 1 33014 Bad Driburg TYPO3 community contact: t.3.e.l.m.a...@.g.m.a.i.l.dot.c.o.m personal contact: e.l.m.a.r.dot.h.i.n...@.g.m.a.i.l.dot.c.o.m
Re: Best practive for dependency incjection
Elmar Hinz wrote: The important point is, that testing leads to restructure the source step by step in the spirit of more independency of each class. That restructure is probably what I called plans if I understand your aim... P
Re: Best practive for dependency incjection
On Mon, May 6, 2013 at 11:27 AM, Pavel Sanda sa...@lyx.org wrote: Elmar Hinz wrote: The important point is, that testing leads to restructure the source step by step in the spirit of more independency of each class. That restructure is probably what I called plans if I understand your aim... P The little difference is, that I would take the path of wild growing instead of big plans in the case of testing. The reason is, that I trust in self optimization, that inherits testing. It's the permanent search for the best solution. To work with big plans, you need strong organization. That can be conserved for other matters, where it is more in need. :) \Elmar -- Elmar Hinz Freiherr-vom-Stein-Str. 1 33014 Bad Driburg TYPO3 community contact: t.3.e.l.m.a...@.g.m.a.i.l.dot.c.o.m personal contact: e.l.m.a.r.dot.h.i.n...@.g.m.a.i.l.dot.c.o.m
Re: [LyX master] support for \mbox and \fbox
29/04/2013 01:16, Uwe Stöhr: Am 17.04.2013 13:03, schrieb Jean-Marc Lasgouttes: Please find enclosed a patch that should fix the remaining problems (apply on top of the previous one). I refrained from rewriting large parts of the code due to your comment below on doing too complicated things. There is code duplication in GuiBox and the logic is often very difficult to understand. I will commit the pair of patches if they work for you. I found now the time to test and your patch does not help. One still gets 0pt as length. You can test this by inserting a box, setting its inner box to makebox and not checking the width and eventually pressing Apply. In the View source window you must in this case see \mbox{} if it works. Did you apply the TWO patches as I wrote? The first patch makes empty lengths work in general and the second patch uses them in InsetBox (actually, a small part of the second patch should go to the first one). Here I do not see any problem with \mbox{}. I attach again the two patches for simplicity. JMarc From cff706e8401b90f1dc81b2966c6cb498fcfe4c27 Mon Sep 17 00:00:00 2001 From: Jean-Marc Lasgouttes lasgout...@lyx.org Date: Mon, 15 Apr 2013 12:35:11 +0200 Subject: [PATCH 1/2] Improve support for empty lengths Parse empty string as empty length Output empty length as empty string when it makes sense (not for LaTeX strings, for example). --- src/Length.cpp | 13 +++-- src/lengthcommon.cpp | 10 -- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/src/Length.cpp b/src/Length.cpp index f8eb920..bb9ec6a 100644 --- a/src/Length.cpp +++ b/src/Length.cpp @@ -19,6 +19,7 @@ #include LyXRC.h #include support/docstream.h +#include support/lassert.h #include sstream #include iomanip @@ -67,7 +68,8 @@ void Length::swap(Length rhs) string const Length::asString() const { ostringstream os; - os val_ unit_name[unit_]; // setw? + if (unit_ != UNIT_NONE) + os val_ unit_name[unit_]; // setw? return os.str(); } @@ -75,7 +77,8 @@ string const Length::asString() const docstring const Length::asDocstring() const { odocstringstream os; - os val_ unit_name[unit_]; // setw? + if (unit_ != UNIT_NONE) + os val_ unit_name[unit_]; // setw? return os.str(); } @@ -102,6 +105,9 @@ string const Length::asLatexString() const case PPH: os val_ / 100.0 \\paperheight; break; + case UNIT_NONE: + // One should not try to ouput latex code for an empty length + LASSERT(false, break); default: os val_ unit_name[unit_]; break; @@ -363,6 +369,9 @@ GlueLength::GlueLength(string const data) string const GlueLength::asString() const { + if (len_.empty()) + return string(); + ostringstream buffer; buffer len_.value(); diff --git a/src/lengthcommon.cpp b/src/lengthcommon.cpp index 217c22b..72f5bbf 100644 --- a/src/lengthcommon.cpp +++ b/src/lengthcommon.cpp @@ -236,8 +236,11 @@ bool isValidGlueLength(string const data, GlueLength * result) // forward approach leads to very long, tedious code that would be // much harder to understand and maintain. (AS) - if (data.empty()) + if (data.empty()) { + if (result) + *result = GlueLength(); return true; + } string buffer = ltrim(data); // To make isValidGlueLength recognize negative values as @@ -306,8 +309,11 @@ bool isValidLength(string const data, Length * result) // The parser may seem overkill for lengths without // glue, but since we already have it, using it is // easier than writing something from scratch. - if (data.empty()) + if (data.empty()) { + if (result) + *result = Length(); return true; + } string buffer = data; int pattern_index = 0; -- 1.7.0.4 From e791d046cc876c062692531c67857336cba960ea Mon Sep 17 00:00:00 2001 From: Jean-Marc Lasgouttes lasgout...@lyx.org Date: Wed, 17 Apr 2013 11:30:25 +0200 Subject: [PATCH 2/2] Fix empty width support for Box inset * InsetBox and GuiBox: Use proper empty length instead of the broken -9.99col% trick * some slight changes to the logic of GuiBox to make sure that values are set as needed. * lengthToWidget(): handle properly the empty length case. All the other related Qt helpers did it already, it was probably an oversight. Also set the default_unit parameter as optional (not needed in this patch actually, but I got carried away :) * allow generating LaTeX code for an empty length, since some broken code does that. --- src/Length.cpp |4 +-- src/frontends/qt4/GuiBox.cpp | 41 ++--- src/frontends/qt4/qt_helpers.cpp | 20 -- src/frontends/qt4/qt_helpers.h | 12 +++--- src/insets/InsetBox.cpp |9 +++ 5 files changed, 46 insertions(+), 40 deletions(-) diff --git a/src/Length.cpp b/src/Length.cpp index bb9ec6a..10cdd29 100644 --- a/src/Length.cpp +++ b/src/Length.cpp @@ -19,7 +19,6 @@ #include LyXRC.h #include support/docstream.h -#include support/lassert.h
Re: Updated Feature Description of “Toolbar customization dialog”
Thanks for the note. Actually I only added a feature description in addition to my original proposal, is that ok? Jason On Mon, May 6, 2013 at 3:00 AM, Liviu Andronic landronim...@gmail.comwrote: Dear Jason, Updates are no longer allowed at this time. Regards, Liviu On Mon, May 6, 2013 at 3:33 AM, Jason jasonwu2...@gmail.com wrote: Hello there, I created a detailed description of what features I'd like to include in “Toolbar customization dialog”. Link: http://goo.gl/YTetM Please kindly take a look and give me any suggestions (things to add? remove or change), thanks in advance. My proposal is also updated. link: http://www.google-melange.com/gsoc/proposal/review/google/gsoc2013/jasonwu2011/6001 Thank you. Jason -- Do you know how to read? http://www.alienetworks.com/srtest.cfm http://goodies.xfce.org/projects/applications/xfce4-dict#speed-reader Do you know how to write? http://garbl.home.comcast.net/~garbl/stylemanual/e.htm#e-mail
Server down?
The server is unresponsive for me. Can anyone else reproduce? Scott
Re: Server down?
Le 06/05/13 19:16, Scott Kostyshak a écrit : The server is unresponsive for me. Can anyone else reproduce? It wors for me. Is it better now? JMarc
Re: Server down?
On Mon, May 6, 2013 at 2:39 PM, Jean-Marc Lasgouttes lasgout...@lyx.org wrote: Le 06/05/13 19:16, Scott Kostyshak a écrit : The server is unresponsive for me. Can anyone else reproduce? It wors for me. Is it better now? Yes, everything is working well now. Scott
Re: Source view window
Le 05/05/13 12:01, Pavel Sanda a écrit : Edwin Leuven wrote: On May 5, 2013, at 08:22 , Pavel Sanda sa...@lyx.org wrote: Pavel Sanda wrote: There are still quirks with not enough minimum size. I finally solved those too, fixed few typos and it's now in. could also go into branch i suppose? Not so sure, I had to do nasty things in vim in order to push boxlayout back into ui file since my designer (qt 4.8) seem not to provide this layout (you use qt 5?). It may have implications for older qt version we claim to support in 2.0 series. What about this different logic instead? It relies on the size/height of the window, not on the dock position. Of course, I know nothing about Qt, so some things are probably horrible. However, it seems to work. JMarc From 33de49fb8927f0077f30143bfdde3e3741c38b22 Mon Sep 17 00:00:00 2001 From: Jean-Marc Lasgouttes lasgout...@lyx.org Date: Mon, 6 May 2013 23:50:23 +0200 Subject: [PATCH] Another try at making the source view dock arrange itself. Warning: I do not know what I am doing. --- src/frontends/qt4/GuiViewSource.cpp | 8 src/frontends/qt4/GuiViewSource.h | 6 -- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/frontends/qt4/GuiViewSource.cpp b/src/frontends/qt4/GuiViewSource.cpp index 0875c82..dbb31f7 100644 --- a/src/frontends/qt4/GuiViewSource.cpp +++ b/src/frontends/qt4/GuiViewSource.cpp @@ -228,13 +228,15 @@ void ViewSourceWidget::updateDefaultFormat() } -void ViewSourceWidget::dockLocationChanged(Qt::DockWidgetArea area) +void ViewSourceWidget::resizeEvent (QResizeEvent * event) { - if (area == Qt::RightDockWidgetArea || area == Qt::LeftDockWidgetArea) { + QSize const sh = formLayout-sizeHint(); + if (width() * sh.height() height() * sh.width()) { layout_-setDirection(QBoxLayout::TopToBottom); } else { layout_-setDirection(QBoxLayout::LeftToRight); } + QWidget::resizeEvent(event); } @@ -244,8 +246,6 @@ GuiViewSource::GuiViewSource(GuiView parent, { widget_ = new ViewSourceWidget; setWidget(widget_); - connect(this, SIGNAL(dockLocationChanged(Qt::DockWidgetArea)), - widget_, SLOT(dockLocationChanged(Qt::DockWidgetArea))); } diff --git a/src/frontends/qt4/GuiViewSource.h b/src/frontends/qt4/GuiViewSource.h index 1722ac9..5e19fe2 100644 --- a/src/frontends/qt4/GuiViewSource.h +++ b/src/frontends/qt4/GuiViewSource.h @@ -40,6 +40,10 @@ public: /// void setBufferView(BufferView const * bv); +protected: + /// + void resizeEvent (QResizeEvent * event); + public Q_SLOTS: /// update content void updateView(); @@ -49,8 +53,6 @@ public Q_SLOTS: void updateDefaultFormat(); /// void contentsChanged(); - /// - void dockLocationChanged(Qt::DockWidgetArea area); private: /// -- 1.8.1.2
Re: Source view window
Jean-Marc Lasgouttes wrote: What about this different logic instead? It relies on the size/height of the window, not on the dock position. No strong preference here. P
Re: Beamer goto buttons and text hyperlinks
On Tue, Apr 23, 2013 at 11:32 AM, Jean-Marc Lasgouttes lasgout...@lyx.org wrote: We could maybe have an inset that is only a button when no extra text is needed and a collapsablme inset otherwise. Somethin in between InsetCommand and InsetCollapsable. How difficult would it be to implement this new inset? Scott
Best practive for dependency incjection
Hello list, I am used to test the code I while I am writing it. The big advantage is, that the code is quality tested. The immediate advantage is, that it gives a simple method to run the code, to see how it works at all, without firering up the whole application. Being new with C++ I try to transfer this approach from other languages like Java or Ruby. Depencency injection is important, to be able to replace dependencies by mock objects. However with C++ it is necessary to mangage the memory usage. For dependency injection this brings up the question, when and where to free the memory. Do you have a policy how to deal with this for Lyx in special and is there a good tutorial how to handle that with C++ in general? THX \Elmar -- Elmar Hinz Freiherr-vom-Stein-Str. 1 33014 Bad Driburg TYPO3 community contact: t.3.e.l.m.a...@.g.m.a.i.l.dot.c.o.m personal contact: e.l.m.a.r.dot.h.i.n...@.g.m.a.i.l.dot.c.o.m
Re: Source view window
Edwin Leuven wrote: > no i use 4.8.4 > > in the patch i send, i used QHBoxLayout (which inherits from QBoxLayout) and > that worked fine for me? okok :) the fact that editing .ui file in vim took me shorter time than finding how to setup QHBoxLayout in designer suggest that i should keep respectful distance from this stuff ;) p
Re: LyX 2.0.6 Binaries
Am 06.05.2013 um 00:01 schrieb Jean-Marc Lasgouttes: > Le 05/05/13 23:12, Stephan Witt a écrit : >> Am 05.05.2013 um 22:57 schrieb Jean-Marc Lasgouttes : >> >>> Le 05/05/13 21:52, Stephan Witt a écrit : This would lead to a LyX running on Lion or Mountain Lion only. The SDK for 10.6 (Snow Leopard) I don't have anymore. >>> @JMarc Sorry, I didn't remember the problem well… It is ::unsetenv with return type void used in unsetEnv(). The hack I've used to build on 10.5 is this: >>> >>> That does not correspond to what is explained here >>> https://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man3/setenv.3.html >>> but there has to be a reason. >> >> This is the relevant contents of stdlib.h: >> >> #if __DARWIN_UNIX03 >> intunsetenv(const char *) __DARWIN_ALIAS(unsetenv); >> #else /* !__DARWIN_UNIX03 */ >> void unsetenv(const char *); >> #endif /* __DARWIN_UNIX03 */ >> >> I don't have the time to search for the reason __DARWIN_UNIX03 not being >> defined. > > I read here > https://stat.ethz.ch/pipermail/r-devel/2007-January/044227.html > that adding -D_APPLE_C_SOURCE to CPPFLAGS should be enough. This didn't help. But adding -D_XOPEN_SOURCE does the trick. Thanks for the pointer. Stephan
Re: Best practive for dependency incjection
Elmar Hinz wrote: > However with C++ it is necessary to mangage the memory usage. For dependency > injection this brings up the question, when and where to free the memory. > > Do you have a policy how to deal with this for Lyx in special and is there a > good tutorial how to handle that with C++ in general? There is no special policy, because we don't use this type of pattern. To be honest we don't have any testing framework (except autotest tools which have nothing to do with traditional unit testing). IIRC there were few discussions but no one ever came with realistic plan. Pavel
Re: Updated Feature Description of “Toolbar customization dialog”
Dear Jason, Updates are no longer allowed at this time. Regards, Liviu On Mon, May 6, 2013 at 3:33 AM, Jasonwrote: > Hello there, > > I created a detailed description of what features I'd like to include in > “Toolbar customization dialog”. Link: http://goo.gl/YTetM Please kindly take > a look and give me any suggestions (things to add? remove or change), thanks > in advance. > > My proposal is also updated. link: > http://www.google-melange.com/gsoc/proposal/review/google/gsoc2013/jasonwu2011/6001 > > Thank you. > > Jason -- Do you know how to read? http://www.alienetworks.com/srtest.cfm http://goodies.xfce.org/projects/applications/xfce4-dict#speed-reader Do you know how to write? http://garbl.home.comcast.net/~garbl/stylemanual/e.htm#e-mail
Re: [LyX master] Revert "tex2lyx/text.cpp: fix a typo spotted by clang"
Le lun. 06 mai 2013 01:54:23 CEST, Uwe Stöhr a écrit : commit 1b32a0502e9206813b6b41365848673d8ac70b03 Author: Uwe StöhrDate: Mon May 6 01:54:17 2013 +0200 Revert "tex2lyx/text.cpp: fix a typo spotted by clang" This reverts commit 055b425b646e748e0c35f0eef89e03e6126a143d. This requires much more work and i don't have time to do this now Yes, I tried that too :) JMarc
Re: Best practive for dependency incjection
Hello Pavel. IIRC there were few discussions but no one ever came with realistic plan. > I don't think it needs a big plan at all. Each test is independed, so you can even mix tests from different frameworks. Also testing has already been started. Simply proceed instead of big plans. Especially the sources are completely independet from the tests and should be. The important point is, that testing leads to restructure the source step by step in the spirit of more independency of each class. That makes them better maintainable and reusable. Because of this independence of the tests from the sources it makes sense to put the tests in it's own directory tree: src/go/here/ tests/unit/go/here/ tests/behaviour/go/here/ tests/integration/go/here/ I will evaluate if it's possible to move the existing tests out of the sources as on of the next steps. Regards \Elmar -- Elmar Hinz Freiherr-vom-Stein-Str. 1 33014 Bad Driburg TYPO3 community contact: t.3.e.l.m.a...@.g.m.a.i.l.dot.c.o.m personal contact: e.l.m.a.r.dot.h.i.n...@.g.m.a.i.l.dot.c.o.m
Re: Best practive for dependency incjection
Elmar Hinz wrote: > The important point is, that testing leads to restructure the source step by > step in the spirit of more independency of each class. That "restructure" is probably what I called plans if I understand your aim... P
Re: Best practive for dependency incjection
On Mon, May 6, 2013 at 11:27 AM, Pavel Sandawrote: > Elmar Hinz wrote: > > The important point is, that testing leads to restructure the source > step by > > step in the spirit of more independency of each class. > > That "restructure" is probably what I called plans if I understand your > aim... > P > The little difference is, that I would take the path of "wild growing" instead of big plans in the case of testing. The reason is, that I trust in self optimization, that inherits testing. It's the permanent search for the best solution. To work with big plans, you need strong organization. That can be conserved for other matters, where it is more in need. :) \Elmar -- Elmar Hinz Freiherr-vom-Stein-Str. 1 33014 Bad Driburg TYPO3 community contact: t.3.e.l.m.a...@.g.m.a.i.l.dot.c.o.m personal contact: e.l.m.a.r.dot.h.i.n...@.g.m.a.i.l.dot.c.o.m
Re: [LyX master] support for \mbox and \fbox
29/04/2013 01:16, Uwe Stöhr: Am 17.04.2013 13:03, schrieb Jean-Marc Lasgouttes: Please find enclosed a patch that should fix the remaining problems (apply on top of the previous one). I refrained from rewriting large parts of the code due to your comment below on doing too complicated things. There is code duplication in GuiBox and the logic is often very difficult to understand. I will commit the pair of patches if they work for you. I found now the time to test and your patch does not help. One still gets "0pt" as length. You can test this by inserting a box, setting its inner box to makebox and not checking the width and eventually pressing Apply. In the View source window you must in this case see \mbox{} if it works. Did you apply the TWO patches as I wrote? The first patch makes empty lengths work in general and the second patch uses them in InsetBox (actually, a small part of the second patch should go to the first one). Here I do not see any problem with \mbox{}. I attach again the two patches for simplicity. JMarc >From cff706e8401b90f1dc81b2966c6cb498fcfe4c27 Mon Sep 17 00:00:00 2001 From: Jean-Marc LasgouttesDate: Mon, 15 Apr 2013 12:35:11 +0200 Subject: [PATCH 1/2] Improve support for empty lengths Parse empty string as empty length Output empty length as empty string when it makes sense (not for LaTeX strings, for example). --- src/Length.cpp | 13 +++-- src/lengthcommon.cpp | 10 -- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/src/Length.cpp b/src/Length.cpp index f8eb920..bb9ec6a 100644 --- a/src/Length.cpp +++ b/src/Length.cpp @@ -19,6 +19,7 @@ #include "LyXRC.h" #include "support/docstream.h" +#include "support/lassert.h" #include #include @@ -67,7 +68,8 @@ void Length::swap(Length & rhs) string const Length::asString() const { ostringstream os; - os << val_ << unit_name[unit_]; // setw? + if (unit_ != UNIT_NONE) + os << val_ << unit_name[unit_]; // setw? return os.str(); } @@ -75,7 +77,8 @@ string const Length::asString() const docstring const Length::asDocstring() const { odocstringstream os; - os << val_ << unit_name[unit_]; // setw? + if (unit_ != UNIT_NONE) + os << val_ << unit_name[unit_]; // setw? return os.str(); } @@ -102,6 +105,9 @@ string const Length::asLatexString() const case PPH: os << val_ / 100.0 << "\\paperheight"; break; + case UNIT_NONE: + // One should not try to ouput latex code for an empty length + LASSERT(false, break); default: os << val_ << unit_name[unit_]; break; @@ -363,6 +369,9 @@ GlueLength::GlueLength(string const & data) string const GlueLength::asString() const { + if (len_.empty()) + return string(); + ostringstream buffer; buffer << len_.value(); diff --git a/src/lengthcommon.cpp b/src/lengthcommon.cpp index 217c22b..72f5bbf 100644 --- a/src/lengthcommon.cpp +++ b/src/lengthcommon.cpp @@ -236,8 +236,11 @@ bool isValidGlueLength(string const & data, GlueLength * result) // forward approach leads to very long, tedious code that would be // much harder to understand and maintain. (AS) - if (data.empty()) + if (data.empty()) { + if (result) + *result = GlueLength(); return true; + } string buffer = ltrim(data); // To make isValidGlueLength recognize negative values as @@ -306,8 +309,11 @@ bool isValidLength(string const & data, Length * result) // The parser may seem overkill for lengths without // glue, but since we already have it, using it is // easier than writing something from scratch. - if (data.empty()) + if (data.empty()) { + if (result) + *result = Length(); return true; + } string buffer = data; int pattern_index = 0; -- 1.7.0.4 >From e791d046cc876c062692531c67857336cba960ea Mon Sep 17 00:00:00 2001 From: Jean-Marc Lasgouttes Date: Wed, 17 Apr 2013 11:30:25 +0200 Subject: [PATCH 2/2] Fix empty width support for Box inset * InsetBox and GuiBox: Use proper empty length instead of the broken -9.99col% trick * some slight changes to the logic of GuiBox to make sure that values are set as needed. * lengthToWidget(): handle properly the empty length case. All the other related Qt helpers did it already, it was probably an oversight. Also set the default_unit parameter as optional (not needed in this patch actually, but I got carried away :) * allow generating LaTeX code for an empty length, since some broken code does that. --- src/Length.cpp |4 +-- src/frontends/qt4/GuiBox.cpp | 41 ++--- src/frontends/qt4/qt_helpers.cpp | 20 -- src/frontends/qt4/qt_helpers.h | 12 +++--- src/insets/InsetBox.cpp |9 +++ 5 files changed, 46 insertions(+), 40 deletions(-) diff --git a/src/Length.cpp b/src/Length.cpp index bb9ec6a..10cdd29 100644 --- a/src/Length.cpp +++ b/src/Length.cpp @@ -19,7 +19,6 @@ #include "LyXRC.h" #include
Re: Updated Feature Description of “Toolbar customization dialog”
Thanks for the note. Actually I only added a feature description in addition to my original proposal, is that ok? Jason On Mon, May 6, 2013 at 3:00 AM, Liviu Andronicwrote: > Dear Jason, > Updates are no longer allowed at this time. > > Regards, > Liviu > > On Mon, May 6, 2013 at 3:33 AM, Jason wrote: > > Hello there, > > > > I created a detailed description of what features I'd like to include in > > “Toolbar customization dialog”. Link: http://goo.gl/YTetM Please kindly > take > > a look and give me any suggestions (things to add? remove or change), > thanks > > in advance. > > > > My proposal is also updated. link: > > > http://www.google-melange.com/gsoc/proposal/review/google/gsoc2013/jasonwu2011/6001 > > > > Thank you. > > > > Jason > > > > -- > Do you know how to read? > http://www.alienetworks.com/srtest.cfm > http://goodies.xfce.org/projects/applications/xfce4-dict#speed-reader > Do you know how to write? > http://garbl.home.comcast.net/~garbl/stylemanual/e.htm#e-mail >
Server down?
The server is unresponsive for me. Can anyone else reproduce? Scott
Re: Server down?
Le 06/05/13 19:16, Scott Kostyshak a écrit : The server is unresponsive for me. Can anyone else reproduce? It wors for me. Is it better now? JMarc
Re: Server down?
On Mon, May 6, 2013 at 2:39 PM, Jean-Marc Lasgoutteswrote: > Le 06/05/13 19:16, Scott Kostyshak a écrit : > >> The server is unresponsive for me. Can anyone else reproduce? > > It wors for me. Is it better now? Yes, everything is working well now. Scott
Re: Source view window
Le 05/05/13 12:01, Pavel Sanda a écrit : Edwin Leuven wrote: On May 5, 2013, at 08:22 , Pavel Sandawrote: Pavel Sanda wrote: There are still quirks with not enough minimum size. I finally solved those too, fixed few typos and it's now in. could also go into branch i suppose? Not so sure, I had to do nasty things in vim in order to push boxlayout back into ui file since my designer (qt 4.8) seem not to provide this layout (you use qt 5?). It may have implications for older qt version we claim to support in 2.0 series. What about this different logic instead? It relies on the size/height of the window, not on the dock position. Of course, I know nothing about Qt, so some things are probably horrible. However, it seems to work. JMarc >From 33de49fb8927f0077f30143bfdde3e3741c38b22 Mon Sep 17 00:00:00 2001 From: Jean-Marc Lasgouttes Date: Mon, 6 May 2013 23:50:23 +0200 Subject: [PATCH] Another try at making the source view dock arrange itself. Warning: I do not know what I am doing. --- src/frontends/qt4/GuiViewSource.cpp | 8 src/frontends/qt4/GuiViewSource.h | 6 -- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/frontends/qt4/GuiViewSource.cpp b/src/frontends/qt4/GuiViewSource.cpp index 0875c82..dbb31f7 100644 --- a/src/frontends/qt4/GuiViewSource.cpp +++ b/src/frontends/qt4/GuiViewSource.cpp @@ -228,13 +228,15 @@ void ViewSourceWidget::updateDefaultFormat() } -void ViewSourceWidget::dockLocationChanged(Qt::DockWidgetArea area) +void ViewSourceWidget::resizeEvent (QResizeEvent * event) { - if (area == Qt::RightDockWidgetArea || area == Qt::LeftDockWidgetArea) { + QSize const & sh = formLayout->sizeHint(); + if (width() * sh.height() < height() * sh.width()) { layout_->setDirection(QBoxLayout::TopToBottom); } else { layout_->setDirection(QBoxLayout::LeftToRight); } + QWidget::resizeEvent(event); } @@ -244,8 +246,6 @@ GuiViewSource::GuiViewSource(GuiView & parent, { widget_ = new ViewSourceWidget; setWidget(widget_); - connect(this, SIGNAL(dockLocationChanged(Qt::DockWidgetArea)), - widget_, SLOT(dockLocationChanged(Qt::DockWidgetArea))); } diff --git a/src/frontends/qt4/GuiViewSource.h b/src/frontends/qt4/GuiViewSource.h index 1722ac9..5e19fe2 100644 --- a/src/frontends/qt4/GuiViewSource.h +++ b/src/frontends/qt4/GuiViewSource.h @@ -40,6 +40,10 @@ public: /// void setBufferView(BufferView const * bv); +protected: + /// + void resizeEvent (QResizeEvent * event); + public Q_SLOTS: /// update content void updateView(); @@ -49,8 +53,6 @@ public Q_SLOTS: void updateDefaultFormat(); /// void contentsChanged(); - /// - void dockLocationChanged(Qt::DockWidgetArea area); private: /// -- 1.8.1.2
Re: Source view window
Jean-Marc Lasgouttes wrote: > What about this different logic instead? It relies on the size/height of > the window, not on the dock position. No strong preference here. P
Re: Beamer goto buttons and text hyperlinks
On Tue, Apr 23, 2013 at 11:32 AM, Jean-Marc Lasgoutteswrote: > We could maybe have an inset that is only a button when no extra text is > needed and a collapsablme inset otherwise. Somethin in between InsetCommand > and InsetCollapsable. How difficult would it be to implement this new inset? Scott