Re: [PATCH 11/13] Use make_shared to create shared_ptr

2012-10-23 Thread Jean-Marc Lasgouttes

Le 23/10/12 01:21, Lars Gullik Bjønnes a écrit :

Anyhow... I am going to ditch the hole series. Pick what you want from
it if anything.

I just cannot stand the hostility.


Come on. André is bored and he feel happy to be rude like in the good 
old days. Nothing really personnal :)


Apart from the std:: namespace issue that seems a bit disruptive and 
controversial, the other patches make sense to me. Moving away from tr1 
in particular.


JMarc


Re: Ad. using namespace std - ref prob in c9b9748c

2012-10-23 Thread Abdelrazak Younes
On Tue, Oct 23, 2012 at 1:12 AM, Lars Gullik Bjønnes lar...@gullik.org wrote:
 Abdelrazak Younes you...@lyx.org writes:

 You mean using std::string everywhere? That does not sound nice.

 | +1

 I agree though that using std:: on other less used things is not a bad idea.

 | Not even that. The style is consistent right now...

 Is it? Or did you mean to write in-consistent?

No I really meant consistent.

 | If you let some
 | exception to slip in it will be worse at the end.

 if you disallow using namespace std, and do not use using std::xx to
 drag anything into current namespace you will not get any exceptions.
 but if you look now, you will find several std:: used even if using
 namespace std is in effect in the same file.

Then we should remove these std:: instance in cpp files.

Cheers,
Abdel.

PS: This is just peer review Lars, no hostility from my side. My LyX
work last couple of years doesn't allow me to veto anything.


Re: changeset/e94e9e41 makes trunk uncompilable

2012-10-23 Thread Kornel Benko
Am Dienstag, 23. Oktober 2012 um 00:57:16, schrieb Uwe Stöhr uwesto...@web.de
 Kornel,
 
 your commit
 http://www.lyx.org/trac/changeset/e94e9e415f4a6ea074ea8ee34deee57b2b5d4d17/lyxgit
 
 breaks for the the compilation using the
 build.bat
 in development/cmake/. Can you please have a look?
 
 thanks and regards
 Uwe

I need more info.
This is the standard way to use cmake as a command.
But maybe your path contains spaces? Does it help if you use
...
COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --target 
rebuild_cache 
...
(Added double quotes)

Kornel

signature.asc
Description: This is a digitally signed message part.


Re: [PATCH 11/13] Use make_shared to create shared_ptr

2012-10-23 Thread Lars Gullik Bjønnes
Jean-Marc Lasgouttes lasgout...@lyx.org writes:

| Le 23/10/12 01:21, Lars Gullik Bjønnes a écrit :
 Anyhow... I am going to ditch the hole series. Pick what you want from
 it if anything.

 I just cannot stand the hostility.

| Come on. André is bored and he feel happy to be rude like in the good
| old days. Nothing really personnal :)

I am pretty sure he means is personal, and I just cannot be bothered
with it.

| Apart from the std:: namespace issue that seems a bit disruptive and
| controversial, the other patches make sense to me. Moving away from
| tr1 in particular.

What I think you should do is to remove the using namespace std, and
add std:: wherever needed except for on string, as that really is all
over, and use using std::string for that.

-- 
   Lgb



Re: #8387: use nicer fonts in splash.lyx

2012-10-23 Thread Liviu Andronic
Hello
I proposed to use Latin Modern fonts in splash.lyx as:
- the default choice of fonts in LyX is bitmap, and ugly
- splash.lyx is is what a new user encounters first after installing LyX
- I mistakenly thought would be uncontroversial

Since there was no recent discussion on the subject, I'm opening it on
lyx-devel. (The discussions that Uwe refers to have concerned, to the
best of my knowledge, the default font used by LyX for _all_ new
documents, which is slightly different from this report.)

So are there good reasons _not_ to use LM fonts in splash.lyx? Regards
Liviu


On Mon, Oct 22, 2012 at 1:14 AM, LyX Ticket Tracker t...@lyx.org wrote:
 #8387: use nicer fonts in splash.lyx
 ---+
  Reporter:  landroni   |   Owner:  uwestoehr
  Type:  defect |  Status:  new
  Priority:  low|   Milestone:  2.0.6
 Component:  documentation  | Version:  2.0.4
  Severity:  minor  |  Resolution:
  Keywords:  patch  |
 ---+

 Comment (by uwestoehr):

  We had this discussion several times in the past and came to the
  conclusion that we should use a simple as possible document.

  Using Latin modern as in the other documentation files was once rejected
  because on some preinstalled TeX distributions on Linux Latin modern was
  not in the standard installation. I don't know if this is still the case.

  However, I don't see the benefit of a nice font here. The splash file is a
  short welcome file not telling about the details of the font handling.
  When viewing it as PDF it looks as beautiful as with Type1 fonts because
  now really every PDF viewer supports subpixel smoothing.
  But OK, if the decision was made, I will not block it as I'm a fan of the
  latin modern fonts. But can you please point me to the discussion? (I lost
  track the last months.)

 --
 Ticket URL: http://www.lyx.org/trac/ticket/8387#comment:2
 The LyX Project http://www.lyx.org/
 LyX -- The Document Processor



-- 
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: [PATCH 11/13] Use make_shared to create shared_ptr

2012-10-23 Thread Jean-Marc Lasgouttes

Le 23/10/2012 14:27, Lars Gullik Bjønnes a écrit :

C++11 would make the code look a lot nicer, esp. thru the use of range
based for, and auto:

 std::vectorstring::iterator at = somevec.begin();
 std::vectorstring::iterator end = someved.end();
 for (; at != end; ++at) {
 ...
 }

would be replaced with:

 for (auto  s: somevec) {
 ...
 }


We already have a foreach macro that is not to bad, but we do not use it 
much:

foreach (string  s, somevec) {
 ...
}

This is admittedly not as nice as real C++11, but if we converted code 
to use it, it would be trivial later to switch to the real thing.


Concerning auto, I am still not sure that I like it.

JMarc



Re: [PATCH 11/13] Use make_shared to create shared_ptr

2012-10-23 Thread Jean-Marc Lasgouttes

Le 23/10/2012 14:27, Lars Gullik Bjønnes a écrit :

| What I think you should do is to remove the using namespace std, and
| add std:: wherever needed except for on string, as that really is all
| over, and use using std::string for that.

A patch that does exactly that is attached.


I would not be against that. What do others think. I do not like much 
using namesapce std; either.


Lars, your patch still leaves many explicit std::string that were still 
here, but this would be easy enough to fix.


JMarc



Re: noweb-article and article class with noweb module

2012-10-23 Thread Jean-Marc Lasgouttes

Le 22/10/2012 19:32, Kayvan Sylvan a écrit :

Hi guys,

I'm trying to see if I can stop using literate-article and instead use
the article class (or any other layout) with the noweb module instead.

However, when I use the noweb module, the Scrap layout is not defined.


Did you really add the noweb module? Send us an example file if you 
cannot get it to work.


JMarc



Re: [PATCH 11/13] Use make_shared to create shared_ptr

2012-10-23 Thread Abdelrazak Younes
On Tue, Oct 23, 2012 at 3:12 PM, Jean-Marc Lasgouttes
lasgout...@lyx.org wrote:
 Le 23/10/2012 14:27, Lars Gullik Bjønnes a écrit :

 | What I think you should do is to remove the using namespace std, and
 | add std:: wherever needed except for on string, as that really is all
 | over, and use using std::string for that.

 A patch that does exactly that is attached.


 I would not be against that. What do others think.

I'd be against (sorry!)

 I do not like much using
 namesapce std; either.

I really don't understand the rationale, sorry. I'd consider very bad
style to create our own lyx::vector or lyx::iostream, so what's the
point?

Abdel.


Re: [PATCH 11/13] Use make_shared to create shared_ptr

2012-10-23 Thread Abdelrazak Younes
On Tue, Oct 23, 2012 at 2:27 PM, Lars Gullik Bjønnes lar...@gullik.org wrote:
 C++11 would make the code look a lot nicer, esp. thru the use of range
 based for, and auto:

 std::vectorstring::iterator at = somevec.begin();
 std::vectorstring::iterator end = someved.end();
 for (; at != end; ++at) {
 ...
 }

 would be replaced with:

 for (auto  s: somevec) {
 ...
 }

 and

 std::vectorstd::pairstring, string   vs = getVector();

 would be replaced with:

 auto  vs = getVector();

That would be nice indeed but we would then require a recent version
of gcc and msvc. Not a real problem for msvc but gcc is a problem if
we want to support older distribution.

Abdel.

 -



Re: [PATCH 11/13] Use make_shared to create shared_ptr

2012-10-23 Thread Jean-Marc Lasgouttes

Le 23/10/2012 15:41, Abdelrazak Younes a écrit :

I really don't understand the rationale, sorry. I'd consider very bad
style to create our own lyx::vector or lyx::iostream, so what's the
point?


FWIW, we already define lyx::assert, lyx::shared_ptr, lyx::bind.

I do not have a strong view on this anyway, my dislike of using 
namespace is of principle (just enough to have André come out of his 
cave and yell at me :).


JMarc


Re: changeset/e94e9e41 makes trunk uncompilable

2012-10-23 Thread Uwe Stöhr

Am 23.10.2012 10:17, schrieb Kornel Benko:


your commit
http://www.lyx.org/trac/changeset/e94e9e415f4a6ea074ea8ee34deee57b2b5d4d17/lyxgit
breaks for the the compilation using the
build.bat in development/cmake/. Can you please have a look?


I need more info.
This is the standard way to use cmake as a command.
But maybe your path contains spaces? Does it help if you use


The problem is the following:
when

COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --target rebuild_cache

is called my ${CMAKE_BINARY_DIR} is
D:\LyXGit\Master\compile-result

But after this call MSVC stops because it cannot find the file:

  Generating ui_WrapUi.h
  Generating Resources.qrc
  Microsoft (R) Build Engine Version 4.0.30319.1
  [Microsoft .NET Framework, Version 4.0.30319.269]
  Copyright (C) Microsoft Corporation 2007. All rights reserved.
MSBUILD : error MSB1009: Project file does not exist.
[D:\LyXGit\Master\compile-result\src\frontends\qt4\frontend_qt4.vcxproj]

Build FAILED.

D:\LyXGit\Master\compile-result\lyx.sln (LyX;tex2lyx target) (1) -
D:\LyXGit\Master\compile-result\src\LyX.vcxproj.metaproj (default target) (2)
 -
D:\LyXGit\Master\compile-result\src\frontends\qt4\frontend_qt4.vcxproj.metaproj (default target) 
(4) -

D:\LyXGit\Master\compile-result\src\frontends\qt4\frontend_qt4.vcxproj (default 
target) (11) -
(CustomBuild target) -
  MSBUILD : error MSB1009: Project file does not exist. 
[D:\LyXGit\Master\compile-result\src\frontends\qt4\frontend_qt4.vcxproj]


But this file exists in this folder and I can execute it manually.


(Added double quotes)


This doesn't help.

thanks and regards
Uwe


Re: [LyX master] Add support for the URW Classico (Optima) LaTeX font

2012-10-23 Thread Georg Baum
Juergen Spitzmueller wrote:

 The branch, master, has been updated.
 
 - Log -
 
 commit db1c1389e3caff69477a597d2e499a8115058150
 Author: Juergen Spitzmueller sp...@lyx.org
 Date:   Sun Oct 21 18:55:24 2012 +0200
 
 Add support for the URW Classico (Optima) LaTeX font
 
 Patch by Liviu Andronic
 
 diff --git a/development/FORMAT b/development/FORMAT
 index 33f9ce4..2cb24d3 100644
 --- a/development/FORMAT
 +++ b/development/FORMAT
 @@ -12,6 +12,11 @@ adjustments are made to tex2lyx and bugs are fixed in
 lyx2lyx.
  ---
  
  
 +2012-10-20 Liviu Andronic landronim...@gmail.com
 + * Format incremented to 445: support for the URW Classico font,
 +   an Optima clone.
 +   - \renewcommand{\sffamily}{uop}  \font_sans uop
 +

Please update src/tex2lyx/TODO.txt and the tex2lyx test cases with the new 
format (they are currently failing). The latter can be done using

make updatetests

in the src/tex2lyx sub folder of the build tree.


Georg




Re: [PATCH 11/13] Use make_shared to create shared_ptr

2012-10-23 Thread Lars Gullik Bjønnes
Jean-Marc Lasgouttes lasgout...@lyx.org writes:

| Le 23/10/2012 14:27, Lars Gullik Bjønnes a écrit :
 C++11 would make the code look a lot nicer, esp. thru the use of range
 based for, and auto:

  std::vectorstring::iterator at = somevec.begin();
  std::vectorstring::iterator end = someved.end();
  for (; at != end; ++at) {
  ...
  }

 would be replaced with:

  for (auto  s: somevec) {
  ...
  }

| We already have a foreach macro that is not to bad, but we do not use
| it much:
| foreach (string  s, somevec) {
|  ...
| }

| This is admittedly not as nice as real C++11, but if we converted code
| to use it, it would be trivial later to switch to the real thing.

| Concerning auto, I am still not sure that I like it.

Liking it took me some 5 seconds.

Auto suddenly makes it nice to work with the complex types you get in
C++.

Imagine:

auto func = [](){};
func();

try to figure out what type func really is. Do you care?

--
Lgb



Re: [PATCH 11/13] Use make_shared to create shared_ptr

2012-10-23 Thread Lars Gullik Bjønnes
Jean-Marc Lasgouttes lasgout...@lyx.org writes:

| Le 23/10/2012 15:41, Abdelrazak Younes a écrit :
 I really don't understand the rationale, sorry. I'd consider very bad
 style to create our own lyx::vector or lyx::iostream, so what's the
 point?

| FWIW, we already define lyx::assert, lyx::shared_ptr, lyx::bind.

To note: the lyx::shared_ptr is there _because_ of the using namespace
std, and the pollution that drags in on some compilers.

-- 
   Lgb



Re: [PATCH 11/13] Use make_shared to create shared_ptr

2012-10-23 Thread Lars Gullik Bjønnes
Abdelrazak Younes you...@lyx.org writes:

| On Tue, Oct 23, 2012 at 2:27 PM, Lars Gullik Bjønnes lar...@gullik.org 
wrote:
 C++11 would make the code look a lot nicer, esp. thru the use of range
 based for, and auto:

 std::vectorstring::iterator at = somevec.begin();
 std::vectorstring::iterator end = someved.end();
 for (; at != end; ++at) {
 ...
 }

 would be replaced with:

 for (auto  s: somevec) {
 ...
 }

 and

 std::vectorstd::pairstring, string   vs = getVector();

 would be replaced with:

 auto  vs = getVector();

| That would be nice indeed but we would then require a recent version
| of gcc and msvc. Not a real problem for msvc but gcc is a problem if
| we want to support older distribution.

Not too much. Quite a bit of C++11 is supported in compilers back to gcc
gcc 4.3, but not really useful until 4.6. (auto in 4.5, range based for
in 4.6).

CentOS 4 has gcc 4.4 (as gcc4) but is rather ancient in itself.

I am not suggesting to begin using C++11 now, but in about a year it
should be really possible.

msvc 11 has ok support I think, same with clang.

Do you have other compilers that people use regularly?

-- 
   Lgb



Re: [PATCH 11/13] Use make_shared to create shared_ptr

2012-10-23 Thread André Pönitz
On Tue, Oct 23, 2012 at 02:27:14PM +0200, Lars Gullik Bjønnes wrote:
 lar...@gullik.org (Lars Gullik Bjønnes) writes:
 
 | Jean-Marc Lasgouttes lasgout...@lyx.org writes:
 
 | | Le 23/10/12 01:21, Lars Gullik Bjønnes a écrit :
  Anyhow... I am going to ditch the hole series. Pick what you want from
  it if anything.
 
  I just cannot stand the hostility.
 
 | | Come on. André is bored and he feel happy to be rude like in the good
 | | old days. Nothing really personnal :)
 
 | I am pretty sure he means is personal, and I just cannot be bothered
 | with it.
 
 | | Apart from the std:: namespace issue that seems a bit disruptive and
 | | controversial, the other patches make sense to me. Moving away from
 | | tr1 in particular.
 
 | What I think you should do is to remove the using namespace std, and
 | add std:: wherever needed except for on string, as that really is all
 | over, and use using std::string for that.
 
 A patch that does exactly that is attached.
 
 C++11 would make the code look a lot nicer, esp. thru the use of range
 based for, and auto:
 
 std::vectorstring::iterator at = somevec.begin();
 std::vectorstring::iterator end = someved.end();
 for (; at != end; ++at) {
 ...
 }
 
 would be replaced with:
 
 for (auto  s: somevec) {
 ...
 }

Range-based for is certainly one of the (scores of) obviously cool
and useful features in C++11 (which is in general way more pragmatic
than 98/03) and I am all for using it - once it has been established
that it's supported by all the setups the project cares for. There
is even some chance it is.

Obligatory rude snide remark #1: It is nice to see the iterator-over-all
faction to be back at values, or references.

I also don't mind modest use of auto, preferably in cases where it is
a chore to write out the full type, such as having to namespace-qualify
it. Using auto instead of int or such is a bit of a stretch, though.

Obligatory rude snide remark #2: Luckily, having boost::auto has been
outlawed by The Committee.

Note, however, that the proposal to use range-based for is orthogonal to
the one of full namespace qualification, and I'd even argue it goes into
he opposite direction in spirit.

Obligatory rude snide remark #3: Omitted, for personal reasons.

Andre'


Ubuntu PPA for daily trunk and branch builds of LyX

2012-10-23 Thread Liviu Andronic
Dear all
Rob and I have set up an Ubuntu PPA [1] providing daily builds of 2.1
master (trunk) and 2.0.x (branch) GIT code. The packaging is still
considered experimental, so it would be great if those interested
could test the new set up and report any problems that might arise.
(From local testing and several user reports, the packages install and
work as expected.)

These builds are intended to help users and developers test the latest
bug fixes and feature additions to the code. The 2.0.x could also
potentially be used by users who have been hit by some bug in the
latest release, but which has been fixed in the 2.0.x GIT branch.
(Remember though that the 2.0.x branch may contain unreleased bugs and
regressions.)

Regards
Liviu

[1] https://launchpad.net/~lyx-devel/+archive/daily


Re: [PATCH 13/13] boost: changes to make it compile cleanly with gcc 4.8

2012-10-23 Thread Lars Gullik Bjønnes
lar...@gullik.org (Lars Gullik Bjønnes) writes:

| ---
|  boost/boost/lexical_cast.hpp  | 1 -
|  boost/boost/math/special_functions/fpclassify.hpp | 4 
|  boost/boost/math/special_functions/sign.hpp   | 2 --
|  boost/boost/regex/v4/regex_format.hpp | 2 --
|  boost/boost/regex/v4/regex_split.hpp  | 1 -
|  boost/boost/static_assert.hpp | 2 +-
|  boost/boost/tuple/detail/tuple_basic.hpp  | 1 -
|  7 files changed, 1 insertion(+), 12 deletions(-)

I'd really like to commit this one. Since current status makes it
very tiresome to work with. (warnings galore).

(If I have to redo this later on a boost upgrade is no problem.)

Ok?

-- 
   Lgb



Re: [PATCH 11/13] Use make_shared to create shared_ptr

2012-10-23 Thread Jean-Marc Lasgouttes

Le 23/10/12 21:21, Lars Gullik Bjønnes a écrit :

| FWIW, we already define lyx::assert, lyx::shared_ptr, lyx::bind.

To note: the lyx::shared_ptr is there _because_ of the using namespace
std, and the pollution that drags in on some compilers.


I know :)

JMarc



[PATCH 2/5] src/Format.cpp: use make_pair

2012-10-23 Thread larsbj
From: Lars Gullik Bjønnes lar...@gullik.org

Use make_pair(...) instead of pairT, U(...).
---
 src/Format.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/Format.cpp b/src/Format.cpp
index f031b68..71699d6 100644
--- a/src/Format.cpp
+++ b/src/Format.cpp
@@ -476,7 +476,7 @@ bool Formats::isZippedFile(support::FileName const  
filename) const {
return it-second.zipped;
string const  format = getFormatFromFile(filename);
bool zipped = (format == gzip || format == zip);
-   zipped_.insert(pairstring, ZippedInfo(fname, ZippedInfo(zipped, 
timestamp)));
+   zipped_.insert(make_pair(fname, ZippedInfo(zipped, timestamp)));
return zipped;
 }
 
-- 
1.8.0



[PATCH 3/5] src/lyxfind.cpp: cleanup formatting

2012-10-23 Thread larsbj
From: Lars Gullik Bjønnes lar...@gullik.org

Remove some eol space
re-indent where required
make some ?: constructs a bit easier to read.
---
 src/lyxfind.cpp | 177 ++--
 1 file changed, 96 insertions(+), 81 deletions(-)

diff --git a/src/lyxfind.cpp b/src/lyxfind.cpp
index b46abc7..dba41d7 100644
--- a/src/lyxfind.cpp
+++ b/src/lyxfind.cpp
@@ -94,7 +94,7 @@ private:
 
 
 int findForward(DocIterator  cur, MatchString const  match,
-bool find_del = true)
+   bool find_del = true)
 {
for (; cur; cur.forwardChar())
if (cur.inTexted()) {
@@ -107,7 +107,7 @@ int findForward(DocIterator  cur, MatchString const  
match,
 
 
 int findBackwards(DocIterator  cur, MatchString const  match,
-bool find_del = true)
+ bool find_del = true)
 {
while (cur) {
cur.backwardChar();
@@ -149,7 +149,7 @@ bool searchAllowed(docstring const  str)
 
 
 bool findOne(BufferView * bv, docstring const  searchstr,
-   bool case_sens, bool whole, bool forward, bool find_del = true)
+bool case_sens, bool whole, bool forward, bool find_del = true)
 {
if (!searchAllowed(searchstr))
return false;
@@ -158,8 +158,9 @@ bool findOne(BufferView * bv, docstring const  searchstr,
 
MatchString const match(searchstr, case_sens, whole);
 
-   int match_len = forward ? findForward(cur, match, find_del) :
- findBackwards(cur, match, find_del);
+   int match_len = forward
+   ? findForward(cur, match, find_del)
+   : findBackwards(cur, match, find_del);
 
if (match_len  0)
bv-putSelectionAt(cur, match_len, !forward);
@@ -193,11 +194,13 @@ int replaceAll(BufferView * bv,
pos_type const pos = cur.pos();
Font const font = cur.paragraph().getFontSettings(buf.params(), 
pos);
cur.recordUndo();
-   int striked = ssize - cur.paragraph().eraseChars(pos, pos + 
match_len,
-   
buf.params().trackChanges);
+   int striked = ssize -
+   cur.paragraph().eraseChars(pos, pos + match_len,
+  buf.params().trackChanges);
cur.paragraph().insert(pos, replacestr, font,
-  Change(buf.params().trackChanges ?
- Change::INSERTED : 
Change::UNCHANGED));
+  Change(buf.params().trackChanges
+ ? Change::INSERTED
+ : Change::UNCHANGED));
for (int i = 0; i  rsize + striked; ++i)
cur.forwardChar();
++num;
@@ -229,8 +232,8 @@ int replaceAll(BufferView * bv,
 // returns the number of replacements made (one, if any) and 
 // whether anything at all was done.
 pairbool, int replaceOne(BufferView * bv, docstring searchstr,
-   docstring const  replacestr, bool case_sens, 
-   bool whole, bool forward, bool findnext)
+  docstring const  replacestr, bool case_sens,
+  bool whole, bool forward, bool findnext)
 {
Cursor  cur = bv-cursor();
if (!cur.selection()) {
@@ -256,8 +259,9 @@ pairbool, int replaceOne(BufferView * bv, docstring 
searchstr,
bool have_selection = cur.selection();
docstring const selected = cur.selectionAsString(false);
bool match = 
-   case_sens ? searchstr == selected
-   : compare_no_case(searchstr, selected) == 0;
+   case_sens
+   ? searchstr == selected
+   : compare_no_case(searchstr, selected) == 0;
 
// no selection or current selection is not search word:
// just find the search word
@@ -286,7 +290,7 @@ pairbool, int replaceOne(BufferView * bv, docstring 
searchstr,
 
 
 docstring const find2string(docstring const  search,
-bool casesensitive, bool matchword, bool forward)
+   bool casesensitive, bool matchword, bool forward)
 {
odocstringstream ss;
ss  search  '\n'
@@ -298,8 +302,9 @@ docstring const find2string(docstring const  search,
 
 
 docstring const replace2string(docstring const  replace,
-   docstring const  search, bool casesensitive, bool matchword,
-   bool all, bool forward, bool findnext)
+  docstring const  search,
+  bool casesensitive, bool matchword,
+  bool all, bool forward, bool findnext)
 {
odocstringstream ss;
ss  replace  '\n'
@@ -363,7 +368,7 @@ bool lyxreplace(BufferView * bv,
replace_count = 

[PATCH 4/5] src/lyxfinc.cpp: use make_pair

2012-10-23 Thread larsbj
From: Lars Gullik Bjønnes lar...@gullik.org

Use make_pair(...) instead of pairT, U(...).
---
 src/lyxfind.cpp | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/lyxfind.cpp b/src/lyxfind.cpp
index dba41d7..a19724b 100644
--- a/src/lyxfind.cpp
+++ b/src/lyxfind.cpp
@@ -240,12 +240,12 @@ pairbool, int replaceOne(BufferView * bv, docstring 
searchstr,
// no selection, non-empty search string: find it
if (!searchstr.empty()) {
findOne(bv, searchstr, case_sens, whole, forward);
-   return pairbool, int(true, 0);
+   return make_pair(true, 0);
}
// empty search string
if (!cur.inTexted())
// bail in math
-   return pairbool, int(false, 0);
+   return make_pair(false, 0);
// select current word and treat it as the search string
cur.innerText()-selectWord(cur, WHOLE_WORD);
searchstr = cur.selectionAsString(false);
@@ -254,7 +254,7 @@ pairbool, int replaceOne(BufferView * bv, docstring 
searchstr,
// if we still don't have a search string, report the error
// and abort.
if (!searchAllowed(searchstr))
-   return pairbool, int(false, 0);
+   return make_pair(false, 0);

bool have_selection = cur.selection();
docstring const selected = cur.selectionAsString(false);
@@ -267,13 +267,13 @@ pairbool, int replaceOne(BufferView * bv, docstring 
searchstr,
// just find the search word
if (!have_selection || !match) {
findOne(bv, searchstr, case_sens, whole, forward);
-   return pairbool, int(true, 0);
+   return make_pair(true, 0);
}
 
// we're now actually ready to replace. if the buffer is
// read-only, we can't, though.
if (bv-buffer().isReadonly())
-   return pairbool, int(false, 0);
+   return make_pair(false, 0);
 
cap::replaceSelectionWithString(cur, replacestr);
if (forward) {
@@ -283,7 +283,7 @@ pairbool, int replaceOne(BufferView * bv, docstring 
searchstr,
if (findnext)
findOne(bv, searchstr, case_sens, whole, forward, false);
 
-   return pairbool, int(true, 1);
+   return make_pair(true, 1);
 }
 
 } // namespace anon
-- 
1.8.0



[PATCH 5/5] src/lyxfind.cpp: use local typedef to simplify

2012-10-23 Thread larsbj
From: Lars Gullik Bjønnes lar...@gullik.org

Use a local typedef pairstring, string P to avoid having to repeat
that multiple times.
---
 src/lyxfind.cpp | 72 -
 1 file changed, 40 insertions(+), 32 deletions(-)

diff --git a/src/lyxfind.cpp b/src/lyxfind.cpp
index a19724b..33dbd8a 100644
--- a/src/lyxfind.cpp
+++ b/src/lyxfind.cpp
@@ -495,54 +495,62 @@ typedef vectorpairstring, string  Escapes;
 /// @note Beware of order
 Escapes const  get_regexp_escapes()
 {
+   typedef std::pairstd::string, std::string P;
+
static Escapes escape_map;
if (escape_map.empty()) {
-   escape_map.push_back(pairstring, string($, _x_$));
-   escape_map.push_back(pairstring, string({, _x_{));
-   escape_map.push_back(pairstring, string(}, _x_}));
-   escape_map.push_back(pairstring, string([, _x_[));
-   escape_map.push_back(pairstring, string(], _x_]));
-   escape_map.push_back(pairstring, string((, _x_());
-   escape_map.push_back(pairstring, string(), _x_)));
-   escape_map.push_back(pairstring, string(+, _x_+));
-   escape_map.push_back(pairstring, string(*, _x_*));
-   escape_map.push_back(pairstring, string(., _x_.));
-   escape_map.push_back(pairstring, string(\\, 
(?:|backslash)));
-   escape_map.push_back(pairstring, string(~, 
(?:textasciitilde|sim)));
-   escape_map.push_back(pairstring, string(^, 
(?:\\^|textasciicircum\\{\\}|mathcircumflex)));
-   escape_map.push_back(pairstring, string(_x_, \\));
+   escape_map.push_back(P($, _x_$));
+   escape_map.push_back(P({, _x_{));
+   escape_map.push_back(P(}, _x_}));
+   escape_map.push_back(P([, _x_[));
+   escape_map.push_back(P(], _x_]));
+   escape_map.push_back(P((, _x_());
+   escape_map.push_back(P(), _x_)));
+   escape_map.push_back(P(+, _x_+));
+   escape_map.push_back(P(*, _x_*));
+   escape_map.push_back(P(., _x_.));
+   escape_map.push_back(P(\\, (?:|backslash)));
+   escape_map.push_back(P(~, (?:textasciitilde|sim)));
+   escape_map.push_back(P(^, 
(?:\\^|textasciicircum\\{\\}|mathcircumflex)));
+   escape_map.push_back(P(_x_, \\));
}
return escape_map;
 }
 
 /// A map of lyx escaped strings and their unescaped equivalent.
-Escapes const  get_lyx_unescapes() {
+Escapes const  get_lyx_unescapes()
+{
+   typedef std::pairstd::string, std::string P;
+
static Escapes escape_map;
if (escape_map.empty()) {
-   escape_map.push_back(pairstring, string(\\%, %));
-   escape_map.push_back(pairstring, string(\\mathcircumflex , 
^));
-   escape_map.push_back(pairstring, string(\\mathcircumflex, 
^));
-   escape_map.push_back(pairstring, string(\\backslash , 
\\));
-   escape_map.push_back(pairstring, string(\\backslash, \\));
-   escape_map.push_back(pairstring, string({, _x_));
-   escape_map.push_back(pairstring, string(}, _x_));
-   escape_map.push_back(pairstring, string(\\sim , ~));
-   escape_map.push_back(pairstring, string(\\sim, ~));
+   escape_map.push_back(P(\\%, %));
+   escape_map.push_back(P(\\mathcircumflex , ^));
+   escape_map.push_back(P(\\mathcircumflex, ^));
+   escape_map.push_back(P(\\backslash , \\));
+   escape_map.push_back(P(\\backslash, \\));
+   escape_map.push_back(P({, _x_));
+   escape_map.push_back(P(}, _x_));
+   escape_map.push_back(P(\\sim , ~));
+   escape_map.push_back(P(\\sim, ~));
}
return escape_map;
 }
 
 /// A map of escapes turning a regexp matching text to one matching latex.
-Escapes const  get_regexp_latex_escapes() {
+Escapes const  get_regexp_latex_escapes()
+{
+   typedef std::pairstd::string, std::string P;
+
static Escapes escape_map;
if (escape_map.empty()) {
-   escape_map.push_back(pairstring, string(, 
(?:|backslash|textbackslash\\{\\})));
-   escape_map.push_back(pairstring, 
string((?!textbackslash)\\{, \\{));
-   escape_map.push_back(pairstring, 
string((?!textbackslash\\{)\\}, \\}));
-   escape_map.push_back(pairstring, string(\\[, \\{\\[\\}));
-   escape_map.push_back(pairstring, string(\\], \\{\\]\\}));
-   escape_map.push_back(pairstring, string(\\^, 
(?:\\^|textasciicircum\\{\\}|mathcircumflex)));
-   escape_map.push_back(pairstring, string(%, \\%));
+   escape_map.push_back(P(, 

[PATCH 1/5] tests/boost.cpp: remove using namespace std

2012-10-23 Thread larsbj
From: Lars Gullik Bjønnes lar...@gullik.org

Trivial to remove the namespace injection.
---
 src/frontends/tests/boost.cpp | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/frontends/tests/boost.cpp b/src/frontends/tests/boost.cpp
index 09d701d..6151f1f 100644
--- a/src/frontends/tests/boost.cpp
+++ b/src/frontends/tests/boost.cpp
@@ -14,14 +14,12 @@
 #include iostream
 #include boost/assert.hpp
 
-using namespace std;
-
 namespace boost {
 
 #ifndef BOOST_NO_EXCEPTIONS
-void throw_exception(exception const  /*e*/)
+void throw_exception(std::exception const )
 {
-   cerrASSERTION VIOLATED IN biblio test;
+   std::cerr  ASSERTION VIOLATED IN biblio test;
BOOST_ASSERT(false);
 }
 #endif
-- 
1.8.0



Re: [PATCH 1/5] tests/boost.cpp: remove using namespace std

2012-10-23 Thread Jean-Marc Lasgouttes

Le 23/10/12 23:14, lar...@gullik.org a écrit :

From: Lars Gullik Bjønnes lar...@gullik.org

Trivial to remove the namespace injection.


I think that patches 2-5/5 are no brainers and you should commit them. 
For this one, I would wait until someone makes a decision.


JMarc



Re: [PATCH 11/13] Use make_shared to create shared_ptr

2012-10-23 Thread Jean-Marc Lasgouttes

Le 23/10/12 21:18, Lars Gullik Bjønnes a écrit :

| Concerning auto, I am still not sure that I like it.

Liking it took me some 5 seconds.

Auto suddenly makes it nice to work with the complex types you get in
C++.

Imagine:

auto func = [](){};
func();

try to figure out what type func really is. Do you care?


I care that I am wirting code with unknown types and suddenly I might be 
doing something awfully inefficient without knowing it. Plus I suspect 
that people who have not read the standard will not know wheat are the 
cases where auto is fine and where are the ones where you obviously 
can't because XXX.


JMarc

PS: are you really telling me that [](){} is something valid? Frightening.


Re: [PATCH 13/13] boost: changes to make it compile cleanly with gcc 4.8

2012-10-23 Thread Jean-Marc Lasgouttes

Le 23/10/12 23:05, Lars Gullik Bjønnes a écrit :

lar...@gullik.org (Lars Gullik Bjønnes) writes:

| ---
|  boost/boost/lexical_cast.hpp  | 1 -
|  boost/boost/math/special_functions/fpclassify.hpp | 4 
|  boost/boost/math/special_functions/sign.hpp   | 2 --
|  boost/boost/regex/v4/regex_format.hpp | 2 --
|  boost/boost/regex/v4/regex_split.hpp  | 1 -
|  boost/boost/static_assert.hpp | 2 +-
|  boost/boost/tuple/detail/tuple_basic.hpp  | 1 -
|  7 files changed, 1 insertion(+), 12 deletions(-)

I'd really like to commit this one. Since current status makes it
very tiresome to work with. (warnings galore).

(If I have to redo this later on a boost upgrade is no problem.)


Somehow I have not seen the patch. But I truest that it is OK if you say so.

JMarc



Re: [PATCH 11/13] Use make_shared to create shared_ptr

2012-10-23 Thread Lars Gullik Bjønnes
Jean-Marc Lasgouttes lasgout...@lyx.org writes:

| Le 23/10/12 21:18, Lars Gullik Bjønnes a écrit :
 | Concerning auto, I am still not sure that I like it.

 Liking it took me some 5 seconds.

 Auto suddenly makes it nice to work with the complex types you get in
 C++.

 Imagine:

 auto func = [](){};
 func();

 try to figure out what type func really is. Do you care?

| I care that I am wirting code with unknown types and suddenly I might
| be doing something awfully inefficient without knowing it. Plus I
| suspect that people who have not read the standard will not know wheat
| are the cases where auto is fine and where are the ones where you
| obviously can't because XXX.

| JMarc

| PS: are you really telling me that [](){} is something valid? Frightening.

:-) heh

That is the new lambda expressions in C++11. Yes, it looks weird at
first, but are not hard to get used to and lambdas are nice.

Shortest possible C++ program that call a function:

--
int main(){[](){}();}
--

  / capture list
 /  argument list
/  /function body
   /  //
auto lambda = [](...){ ... };

example:

---
#include vector
#include algorithm
#include iterator
#include iostream

// Compile on a newer gcc:
// g++ -std=c++11 lambda_and_more.cpp

int main() {
std::vectorint v({9,8,7,6,5,4,3,2,1}); 
std::for_each(v.begin(), v.end(), [](int i){std::cout  i;});
std::sort(v.begin(), v.end(), [](int lhs, int rhs){ return lhs  rhs; });
std::copy(v.begin(), v.end(), std::ostream_iteratorint(std::cout, ,));

int sum = 0;
std::for_each(v.begin(), v.end(), [](int i){ sum += i;});
std::cout  sum  std::endl;
}


-- 
   Lgb



FYI: compiling with gcc 4.8

2012-10-23 Thread Lars Gullik Bjønnes

(AMD Phenom(tm) II X6 1090T Processor)

gcc 4.7.2 (4.7.2 20120921 (Red Hat 4.7.2-2)):

time make CXX=/usr/bin/g++ -j6
real3m1.055s
user10m31.367s
sys 0m49.691s

size src/lyx
text   data bss dec   hexfilename
11339834   3133645416   11416586  ae340a src/lyx

ls -l ./src/lyx
169405554 ./src/lyx


gcc 4.8.0 (4.8.0 20121023 (experimental)):

time make -j6
real3m9.445s
user11m53.000s
sys 0m51.485s

size src/lyx
text   databss dec   hexfilename
11348213   31352   44504   11424069  ae5145 src/lyx

ls -l ./src/lyx
172783951 ./src/lyx

It seems that size and compile time not much has happened.
(a good thing)

No warnings¹ with gcc 4.7 nor with 4.8 (except one in Qt but I bet that
will get fixed when gcc comes closer to release)

¹ That is with my boost warnings removed patch applied.

-- 
   Lgb



Re: [PATCH 5/5] src/lyxfind.cpp: use local typedef to simplify

2012-10-23 Thread André Pönitz
On Tue, Oct 23, 2012 at 11:14:42PM +0200, lar...@gullik.org wrote:
 From: Lars Gullik Bjønnes lar...@gullik.org
 
 Use a local typedef pairstring, string P to avoid having to repeat
 that multiple times.
 ---
  src/lyxfind.cpp | 72 
 -
  1 file changed, 40 insertions(+), 32 deletions(-)
 
 diff --git a/src/lyxfind.cpp b/src/lyxfind.cpp
 index a19724b..33dbd8a 100644
 --- a/src/lyxfind.cpp
 +++ b/src/lyxfind.cpp
 @@ -495,54 +495,62 @@ typedef vectorpairstring, string  Escapes;
  /// @note Beware of order
  Escapes const  get_regexp_escapes()
  {
 + typedef std::pairstd::string, std::string P;
 +

Conveniently adding a std:: or three, so next time the discussion
comes up we can reasonably claim that it is used inconsistently
and the 'using' on top could go...

Andre'


Re: #8387: use nicer fonts in splash.lyx

2012-10-23 Thread Uwe Stöhr

Am 23.10.2012 11:59, schrieb Liviu Andronic:


I proposed to use Latin Modern fonts in splash.lyx as:
- the default choice of fonts in LyX is bitmap, and ugly


This is not true anymore. Please show me a screenshot where the font look pixeld in normal 
magnification.



So are there good reasons _not_ to use LM fonts in splash.lyx?


When the user sees this, he installed LyX for the first time. So when he plays a bit with it he 
might wonder why there is a special font and not the default one. The file itself doesn't state 
anything and the second step after the splash file is the tutorial where the user learns the basics 
of LyX  also the font things.

Therefore I tried to keep the splash file as simple as possible (no preamble in 
this file for example).

regards Uwe



Re: [PATCH 5/5] src/lyxfind.cpp: use local typedef to simplify

2012-10-23 Thread Lars Gullik Bjønnes
André Pönitz andre.poen...@mathematik.tu-chemnitz.de writes:

| On Tue, Oct 23, 2012 at 11:14:42PM +0200, lar...@gullik.org wrote:
 From: Lars Gullik Bjønnes lar...@gullik.org
 
 Use a local typedef pairstring, string P to avoid having to repeat
 that multiple times.
 ---
  src/lyxfind.cpp | 72
 -
  1 file changed, 40 insertions(+), 32 deletions(-)
 
 diff --git a/src/lyxfind.cpp b/src/lyxfind.cpp
 index a19724b..33dbd8a 100644
 --- a/src/lyxfind.cpp
 +++ b/src/lyxfind.cpp
 @@ -495,54 +495,62 @@ typedef vectorpairstring, string  Escapes;
  /// @note Beware of order
  Escapes const  get_regexp_escapes()
  {
 +typedef std::pairstd::string, std::string P;
 +

| Conveniently adding a std:: or three, so next time the discussion
| comes up we can reasonably claim that it is used inconsistently
| and the 'using' on top could go...

What is your agenda really?



Re: FYI: compiling with gcc 4.8

2012-10-23 Thread Lars Gullik Bjønnes
lar...@gullik.org (Lars Gullik Bjønnes) writes:

| gcc 4.8.0 (4.8.0 20121023 (experimental)):

| time make -j6
| real3m9.445s
| user11m53.000s
| sys 0m51.485s

| size src/lyx
| text   databss dec   hexfilename
| 11348213   31352   44504   11424069  ae5145 src/lyx

| ls -l ./src/lyx
| 172783951 ./src/lyx

gcc 4.8.0 (4.8.0 20121023 (experimental)) in gnu++11 mode:
(some warnings about deprecated auto_ptr)

time make -j6
real2m59.968s
user12m54.708s
sys 0m53.020s

size src/lyx
text   databss dec   hexfilename
11012251   31344   44408   11088003  a93083 src/lyx

ls -l src/lyx
180181591 Oct 24 02:52 src/lyx

-- 
   Lgb



[PATCH 2/2] config/lyxinclude.m4: add support for --enable-cxx11

2012-10-23 Thread Lars Gullik Bjønnes
Using --enable-cxx11 turns on C++11 mode in gcc.
---
 config/lyxinclude.m4 | 16 
 1 file changed, 16 insertions(+)

diff --git a/config/lyxinclude.m4 b/config/lyxinclude.m4
index e532c54..2e529ea 100644
--- a/config/lyxinclude.m4
+++ b/config/lyxinclude.m4
@@ -232,6 +232,10 @@ AC_ARG_ENABLE(pch,
enable_pch=no;)
 lyx_pch_comp=no
 
+AC_ARG_ENABLE(cxx11,
+  AC_HELP_STRING([--enable-cxx11],[enable C++11 mode]),,
+  enable_cxx11=no;)
+
 AC_ARG_ENABLE(assertions,
   AC_HELP_STRING([--enable-assertions],[add runtime sanity checks in the 
program]),,
   [AS_CASE([$build_type], [dev*|pre*], [enable_assertions=yes],
@@ -306,6 +310,18 @@ if test x$GXX = xyes; then
;;
 esac
   fi
+  if test x$enable_cxx11 = xyes ; then
+  case $gxx_version in
+ 4.3*|4.4*|4.5*|4.6*)
+ lyx_flags=$lyx_flags c++11-mode
+ CXXFLAGS=-std=gnu++0x $CXXFLAGS
+ ;;
+ 4.7*|4.8*)
+ lyx_flags=$lyx_flags c++11-mode
+ CXXFLAGS=-std=gnu++11 $CXXFLAGS
+ ;;
+  esac
+  fi
 fi
 test $lyx_pch_comp = yes  lyx_flags=$lyx_flags pch
 AM_CONDITIONAL(LYX_BUILD_PCH, test $lyx_pch_comp = yes)
-- 
1.8.0



[PATCH 1/2] support/Messages.cpp: add space to not be taken as user defined literal

2012-10-23 Thread Lars Gullik Bjønnes
In C++11 you are not allowed to have non-literal specifiers right
after a string literal.
---
 src/support/Messages.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/support/Messages.cpp b/src/support/Messages.cpp
index ca5c110..fdcaf66 100644
--- a/src/support/Messages.cpp
+++ b/src/support/Messages.cpp
@@ -119,7 +119,7 @@ bool Messages::available(string const  c)
// this loops at most twice
while (true) {
string const filen = locale_dir + / + code 
-   + /LC_MESSAGES/PACKAGE.mo;
+   + /LC_MESSAGES/ PACKAGE .mo;
if (FileName(filen).isReadableFile())
return true;
if (contains(code, '_'))
-- 
1.8.0



Re: [PATCH 11/13] Use make_shared to create shared_ptr

2012-10-23 Thread Jean-Marc Lasgouttes

Le 23/10/12 01:21, Lars Gullik Bjønnes a écrit :

Anyhow... I am going to ditch the hole series. Pick what you want from
it if anything.

I just cannot stand the hostility.


Come on. André is bored and he feel happy to be rude like in the good 
old days. Nothing really personnal :)


Apart from the std:: namespace issue that seems a bit disruptive and 
controversial, the other patches make sense to me. Moving away from tr1 
in particular.


JMarc


Re: Ad. "using namespace std" - ref prob in c9b9748c

2012-10-23 Thread Abdelrazak Younes
On Tue, Oct 23, 2012 at 1:12 AM, Lars Gullik Bjønnes  wrote:
> Abdelrazak Younes  writes:
>>>
>>> You mean using std::string everywhere? That does not sound nice.
>>
> | +1
>>
>>> I agree though that using std:: on other less used things is not a bad idea.
>>
> | Not even that. The style is consistent right now...
>
> Is it? Or did you mean to write in-consistent?

No I really meant consistent.

> | If you let some
> | exception to slip in it will be worse at the end.
>
> if you disallow using namespace std, and do not use "using std::xx" to
> drag anything into current namespace you will not get any exceptions.
> but if you look now, you will find several std:: used even if "using
> namespace std" is in effect in the same file.

Then we should remove these std:: instance in cpp files.

Cheers,
Abdel.

PS: This is just peer review Lars, no hostility from my side. My LyX
work last couple of years doesn't allow me to veto anything.


Re: changeset/e94e9e41 makes trunk uncompilable

2012-10-23 Thread Kornel Benko
Am Dienstag, 23. Oktober 2012 um 00:57:16, schrieb Uwe Stöhr 
> Kornel,
> 
> your commit
> http://www.lyx.org/trac/changeset/e94e9e415f4a6ea074ea8ee34deee57b2b5d4d17/lyxgit
> 
> breaks for the the compilation using the
> build.bat
> in development/cmake/. Can you please have a look?
> 
> thanks and regards
> Uwe

I need more info.
This is the standard way to use cmake as a command.
But maybe your path contains spaces? Does it help if you use
...
COMMAND ${CMAKE_COMMAND} --build "${CMAKE_BINARY_DIR}" --target 
rebuild_cache 
...
(Added double quotes)

Kornel

signature.asc
Description: This is a digitally signed message part.


Re: [PATCH 11/13] Use make_shared to create shared_ptr

2012-10-23 Thread Lars Gullik Bjønnes
Jean-Marc Lasgouttes  writes:

| Le 23/10/12 01:21, Lars Gullik Bjønnes a écrit :
>> Anyhow... I am going to ditch the hole series. Pick what you want from
>> it if anything.
>>
>> I just cannot stand the hostility.
>
| Come on. André is bored and he feel happy to be rude like in the good
| old days. Nothing really personnal :)

I am pretty sure he means is personal, and I just cannot be bothered
with it.

| Apart from the std:: namespace issue that seems a bit disruptive and
| controversial, the other patches make sense to me. Moving away from
| tr1 in particular.

What I think you should do is to remove the "using namespace std", and
add std:: wherever needed except for on string, as that really is all
over, and use "using std::string" for that.

-- 
   Lgb



Re: #8387: use nicer fonts in splash.lyx

2012-10-23 Thread Liviu Andronic
Hello
I proposed to use Latin Modern fonts in splash.lyx as:
- the default choice of fonts in LyX is bitmap, and ugly
- splash.lyx is is what a new user encounters first after installing LyX
- I mistakenly thought would be uncontroversial

Since there was no recent discussion on the subject, I'm opening it on
lyx-devel. (The discussions that Uwe refers to have concerned, to the
best of my knowledge, the default font used by LyX for _all_ new
documents, which is slightly different from this report.)

So are there good reasons _not_ to use LM fonts in splash.lyx? Regards
Liviu


On Mon, Oct 22, 2012 at 1:14 AM, LyX Ticket Tracker  wrote:
> #8387: use nicer fonts in splash.lyx
> ---+
>  Reporter:  landroni   |   Owner:  uwestoehr
>  Type:  defect |  Status:  new
>  Priority:  low|   Milestone:  2.0.6
> Component:  documentation  | Version:  2.0.4
>  Severity:  minor  |  Resolution:
>  Keywords:  patch  |
> ---+
>
> Comment (by uwestoehr):
>
>  We had this discussion several times in the past and came to the
>  conclusion that we should use a simple as possible document.
>
>  Using Latin modern as in the other documentation files was once rejected
>  because on some preinstalled TeX distributions on Linux Latin modern was
>  not in the standard installation. I don't know if this is still the case.
>
>  However, I don't see the benefit of a nice font here. The splash file is a
>  short welcome file not telling about the details of the font handling.
>  When viewing it as PDF it looks as beautiful as with Type1 fonts because
>  now really every PDF viewer supports subpixel smoothing.
>  But OK, if the decision was made, I will not block it as I'm a fan of the
>  latin modern fonts. But can you please point me to the discussion? (I lost
>  track the last months.)
>
> --
> Ticket URL: 
> The LyX Project 
> LyX -- The Document Processor



-- 
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: [PATCH 11/13] Use make_shared to create shared_ptr

2012-10-23 Thread Jean-Marc Lasgouttes

Le 23/10/2012 14:27, Lars Gullik Bjønnes a écrit :

C++11 would make the code look a lot nicer, esp. thru the use of range
based for, and auto:

 std::vector::iterator at = somevec.begin();
 std::vector::iterator end = someved.end();
 for (; at != end; ++at) {
 ...
 }

would be replaced with:

 for (auto & s: somevec) {
 ...
 }


We already have a foreach macro that is not to bad, but we do not use it 
much:

foreach (string & s, somevec) {
 ...
}

This is admittedly not as nice as real C++11, but if we converted code 
to use it, it would be trivial later to switch to the real thing.


Concerning auto, I am still not sure that I like it.

JMarc



Re: [PATCH 11/13] Use make_shared to create shared_ptr

2012-10-23 Thread Jean-Marc Lasgouttes

Le 23/10/2012 14:27, Lars Gullik Bjønnes a écrit :

| What I think you should do is to remove the "using namespace std", and
| add std:: wherever needed except for on string, as that really is all
| over, and use "using std::string" for that.

A patch that does exactly that is attached.


I would not be against that. What do others think. I do not like much 
"using namesapce std;" either.


Lars, your patch still leaves many explicit std::string that were still 
here, but this would be easy enough to fix.


JMarc



Re: noweb-article and article class with "noweb" module

2012-10-23 Thread Jean-Marc Lasgouttes

Le 22/10/2012 19:32, Kayvan Sylvan a écrit :

Hi guys,

I'm trying to see if I can stop using literate-article and instead use
the article class (or any other layout) with the "noweb" module instead.

However, when I use the "noweb" module, the Scrap layout is not defined.


Did you really add the noweb module? Send us an example file if you 
cannot get it to work.


JMarc



Re: [PATCH 11/13] Use make_shared to create shared_ptr

2012-10-23 Thread Abdelrazak Younes
On Tue, Oct 23, 2012 at 3:12 PM, Jean-Marc Lasgouttes
 wrote:
> Le 23/10/2012 14:27, Lars Gullik Bjønnes a écrit :
>
>> | What I think you should do is to remove the "using namespace std", and
>> | add std:: wherever needed except for on string, as that really is all
>> | over, and use "using std::string" for that.
>>
>> A patch that does exactly that is attached.
>
>
> I would not be against that. What do others think.

I'd be against (sorry!)

> I do not like much "using
> namesapce std;" either.

I really don't understand the rationale, sorry. I'd consider very bad
style to create our own lyx::vector or lyx::iostream, so what's the
point?

Abdel.


Re: [PATCH 11/13] Use make_shared to create shared_ptr

2012-10-23 Thread Abdelrazak Younes
On Tue, Oct 23, 2012 at 2:27 PM, Lars Gullik Bjønnes  wrote:
> C++11 would make the code look a lot nicer, esp. thru the use of range
> based for, and auto:
>
> std::vector::iterator at = somevec.begin();
> std::vector::iterator end = someved.end();
> for (; at != end; ++at) {
> ...
> }
>
> would be replaced with:
>
> for (auto & s: somevec) {
> ...
> }
>
> and
>
> std::vector > & vs = getVector();
>
> would be replaced with:
>
> auto & vs = getVector();

That would be nice indeed but we would then require a recent version
of gcc and msvc. Not a real problem for msvc but gcc is a problem if
we want to support older distribution.

Abdel.
>
> -
>


Re: [PATCH 11/13] Use make_shared to create shared_ptr

2012-10-23 Thread Jean-Marc Lasgouttes

Le 23/10/2012 15:41, Abdelrazak Younes a écrit :

I really don't understand the rationale, sorry. I'd consider very bad
style to create our own lyx::vector or lyx::iostream, so what's the
point?


FWIW, we already define lyx::assert, lyx::shared_ptr, lyx::bind.

I do not have a strong view on this anyway, my dislike of "using 
namespace" is of principle (just enough to have André come out of his 
cave and yell at me :).


JMarc


Re: changeset/e94e9e41 makes trunk uncompilable

2012-10-23 Thread Uwe Stöhr

Am 23.10.2012 10:17, schrieb Kornel Benko:


your commit
http://www.lyx.org/trac/changeset/e94e9e415f4a6ea074ea8ee34deee57b2b5d4d17/lyxgit
breaks for the the compilation using the
build.bat in development/cmake/. Can you please have a look?


I need more info.
This is the standard way to use cmake as a command.
But maybe your path contains spaces? Does it help if you use


The problem is the following:
when

COMMAND ${CMAKE_COMMAND} --build "${CMAKE_BINARY_DIR}" --target rebuild_cache

is called my ${CMAKE_BINARY_DIR} is
"D:\LyXGit\Master\compile-result"

But after this call MSVC stops because it cannot find the file:

  Generating ui_WrapUi.h
  Generating Resources.qrc
  Microsoft (R) Build Engine Version 4.0.30319.1
  [Microsoft .NET Framework, Version 4.0.30319.269]
  Copyright (C) Microsoft Corporation 2007. All rights reserved.
MSBUILD : error MSB1009: Project file does not exist.
[D:\LyXGit\Master\compile-result\src\frontends\qt4\frontend_qt4.vcxproj]

Build FAILED.

"D:\LyXGit\Master\compile-result\lyx.sln" (LyX;tex2lyx target) (1) ->
"D:\LyXGit\Master\compile-result\src\LyX.vcxproj.metaproj" (default target) (2)
 ->
"D:\LyXGit\Master\compile-result\src\frontends\qt4\frontend_qt4.vcxproj.metaproj" (default target) 
(4) ->

"D:\LyXGit\Master\compile-result\src\frontends\qt4\frontend_qt4.vcxproj" (default 
target) (11) ->
(CustomBuild target) ->
  MSBUILD : error MSB1009: Project file does not exist. 
[D:\LyXGit\Master\compile-result\src\frontends\qt4\frontend_qt4.vcxproj]


But this file exists in this folder and I can execute it manually.


(Added double quotes)


This doesn't help.

thanks and regards
Uwe


Re: [LyX master] Add support for the URW Classico (Optima) LaTeX font

2012-10-23 Thread Georg Baum
Juergen Spitzmueller wrote:

> The branch, master, has been updated.
> 
> - Log -
> 
> commit db1c1389e3caff69477a597d2e499a8115058150
> Author: Juergen Spitzmueller 
> Date:   Sun Oct 21 18:55:24 2012 +0200
> 
> Add support for the URW Classico (Optima) LaTeX font
> 
> Patch by Liviu Andronic
> 
> diff --git a/development/FORMAT b/development/FORMAT
> index 33f9ce4..2cb24d3 100644
> --- a/development/FORMAT
> +++ b/development/FORMAT
> @@ -12,6 +12,11 @@ adjustments are made to tex2lyx and bugs are fixed in
> lyx2lyx.
>  ---
>  
>  
> +2012-10-20 Liviu Andronic 
> + * Format incremented to 445: support for the URW Classico font,
> +   an Optima clone.
> +   - \renewcommand{\sffamily}{uop} > \font_sans uop
> +

Please update src/tex2lyx/TODO.txt and the tex2lyx test cases with the new 
format (they are currently failing). The latter can be done using

make updatetests

in the src/tex2lyx sub folder of the build tree.


Georg




Re: [PATCH 11/13] Use make_shared to create shared_ptr

2012-10-23 Thread Lars Gullik Bjønnes
Jean-Marc Lasgouttes  writes:

| Le 23/10/2012 14:27, Lars Gullik Bjønnes a écrit :
>> C++11 would make the code look a lot nicer, esp. thru the use of range
>> based for, and auto:
>>
>>  std::vector::iterator at = somevec.begin();
>>  std::vector::iterator end = someved.end();
>>  for (; at != end; ++at) {
>>  ...
>>  }
>>
>> would be replaced with:
>>
>>  for (auto & s: somevec) {
>>  ...
>>  }
>
| We already have a foreach macro that is not to bad, but we do not use
| it much:
| foreach (string & s, somevec) {
|  ...
| }
>
| This is admittedly not as nice as real C++11, but if we converted code
| to use it, it would be trivial later to switch to the real thing.
>
| Concerning auto, I am still not sure that I like it.

Liking it took me some 5 seconds.

Auto suddenly makes it nice to work with the complex types you get in
C++.

Imagine:

auto func = [](){};
func();

try to figure out what type func really is. Do you care?

--
Lgb



Re: [PATCH 11/13] Use make_shared to create shared_ptr

2012-10-23 Thread Lars Gullik Bjønnes
Jean-Marc Lasgouttes  writes:

| Le 23/10/2012 15:41, Abdelrazak Younes a écrit :
>> I really don't understand the rationale, sorry. I'd consider very bad
>> style to create our own lyx::vector or lyx::iostream, so what's the
>> point?
>
| FWIW, we already define lyx::assert, lyx::shared_ptr, lyx::bind.

To note: the lyx::shared_ptr is there _because_ of the "using namespace
std", and the pollution that drags in on some compilers.

-- 
   Lgb



Re: [PATCH 11/13] Use make_shared to create shared_ptr

2012-10-23 Thread Lars Gullik Bjønnes
Abdelrazak Younes  writes:

| On Tue, Oct 23, 2012 at 2:27 PM, Lars Gullik Bjønnes  
wrote:
>> C++11 would make the code look a lot nicer, esp. thru the use of range
>> based for, and auto:
>>
>> std::vector::iterator at = somevec.begin();
>> std::vector::iterator end = someved.end();
>> for (; at != end; ++at) {
>> ...
>> }
>>
>> would be replaced with:
>>
>> for (auto & s: somevec) {
>> ...
>> }
>>
>> and
>>
>> std::vector > & vs = getVector();
>>
>> would be replaced with:
>>
>> auto & vs = getVector();
>
| That would be nice indeed but we would then require a recent version
| of gcc and msvc. Not a real problem for msvc but gcc is a problem if
| we want to support older distribution.

Not too much. Quite a bit of C++11 is supported in compilers back to gcc
gcc 4.3, but not really useful until 4.6. (auto in 4.5, range based for
in 4.6).

CentOS 4 has gcc 4.4 (as gcc4) but is rather ancient in itself.

I am not suggesting to begin using C++11 now, but in about a year it
should be really possible.

msvc 11 has ok support I think, same with clang.

Do you have other compilers that people use regularly?

-- 
   Lgb



Re: [PATCH 11/13] Use make_shared to create shared_ptr

2012-10-23 Thread André Pönitz
On Tue, Oct 23, 2012 at 02:27:14PM +0200, Lars Gullik Bjønnes wrote:
> lar...@gullik.org (Lars Gullik Bjønnes) writes:
> 
> | Jean-Marc Lasgouttes  writes:
> >
> | | Le 23/10/12 01:21, Lars Gullik Bjønnes a écrit :
> >>> Anyhow... I am going to ditch the hole series. Pick what you want from
> >>> it if anything.
> >>>
> >>> I just cannot stand the hostility.
> >>
> | | Come on. André is bored and he feel happy to be rude like in the good
> | | old days. Nothing really personnal :)
> >
> | I am pretty sure he means is personal, and I just cannot be bothered
> | with it.
> >
> | | Apart from the std:: namespace issue that seems a bit disruptive and
> | | controversial, the other patches make sense to me. Moving away from
> | | tr1 in particular.
> >
> | What I think you should do is to remove the "using namespace std", and
> | add std:: wherever needed except for on string, as that really is all
> | over, and use "using std::string" for that.
> 
> A patch that does exactly that is attached.
> 
> C++11 would make the code look a lot nicer, esp. thru the use of range
> based for, and auto:
> 
> std::vector::iterator at = somevec.begin();
> std::vector::iterator end = someved.end();
> for (; at != end; ++at) {
> ...
> }
> 
> would be replaced with:
> 
> for (auto & s: somevec) {
> ...
> }

Range-based for is certainly one of the (scores of) "obviously cool
and useful" features in C++11 (which is in general way more pragmatic
than 98/03) and I am all for using it - once it has been established
that it's supported by all the setups the project cares for. There
is even some chance it is.

Obligatory rude snide remark #1: It is nice to see the iterator-over-all
faction to be back at values, or references.

I also don't mind modest use of "auto", preferably in cases where it is
a chore to write out the full type, such as having to namespace-qualify
it. Using "auto" instead of "int" or such is a bit of a stretch, though.

Obligatory rude snide remark #2: Luckily, having boost::auto has been
outlawed by The Committee.

Note, however, that the proposal to use range-based for is orthogonal to
the one of full namespace qualification, and I'd even argue it goes into
he opposite direction "in spirit".

Obligatory rude snide remark #3: Omitted, for personal reasons.

Andre'


Ubuntu PPA for daily trunk and branch builds of LyX

2012-10-23 Thread Liviu Andronic
Dear all
Rob and I have set up an Ubuntu PPA [1] providing daily builds of 2.1
master (trunk) and 2.0.x (branch) GIT code. The packaging is still
considered experimental, so it would be great if those interested
could test the new set up and report any problems that might arise.
(From local testing and several user reports, the packages install and
work as expected.)

These builds are intended to help users and developers test the latest
bug fixes and feature additions to the code. The 2.0.x could also
potentially be used by users who have been hit by some bug in the
latest release, but which has been fixed in the 2.0.x GIT branch.
(Remember though that the 2.0.x branch may contain unreleased bugs and
regressions.)

Regards
Liviu

[1] https://launchpad.net/~lyx-devel/+archive/daily


Re: [PATCH 13/13] boost: changes to make it compile cleanly with gcc 4.8

2012-10-23 Thread Lars Gullik Bjønnes
lar...@gullik.org (Lars Gullik Bjønnes) writes:

| ---
|  boost/boost/lexical_cast.hpp  | 1 -
|  boost/boost/math/special_functions/fpclassify.hpp | 4 
|  boost/boost/math/special_functions/sign.hpp   | 2 --
|  boost/boost/regex/v4/regex_format.hpp | 2 --
|  boost/boost/regex/v4/regex_split.hpp  | 1 -
|  boost/boost/static_assert.hpp | 2 +-
|  boost/boost/tuple/detail/tuple_basic.hpp  | 1 -
|  7 files changed, 1 insertion(+), 12 deletions(-)

I'd really like to commit this one. Since current status makes it
very tiresome to work with. (warnings galore).

(If I have to redo this later on a boost upgrade is no problem.)

Ok?

-- 
   Lgb



Re: [PATCH 11/13] Use make_shared to create shared_ptr

2012-10-23 Thread Jean-Marc Lasgouttes

Le 23/10/12 21:21, Lars Gullik Bjønnes a écrit :

| FWIW, we already define lyx::assert, lyx::shared_ptr, lyx::bind.

To note: the lyx::shared_ptr is there _because_ of the "using namespace
std", and the pollution that drags in on some compilers.


I know :)

JMarc



[PATCH 2/5] src/Format.cpp: use make_pair

2012-10-23 Thread larsbj
From: Lars Gullik Bjønnes 

Use make_pair(...) instead of pair(...).
---
 src/Format.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/Format.cpp b/src/Format.cpp
index f031b68..71699d6 100644
--- a/src/Format.cpp
+++ b/src/Format.cpp
@@ -476,7 +476,7 @@ bool Formats::isZippedFile(support::FileName const & 
filename) const {
return it->second.zipped;
string const & format = getFormatFromFile(filename);
bool zipped = (format == "gzip" || format == "zip");
-   zipped_.insert(pair(fname, ZippedInfo(zipped, 
timestamp)));
+   zipped_.insert(make_pair(fname, ZippedInfo(zipped, timestamp)));
return zipped;
 }
 
-- 
1.8.0



[PATCH 3/5] src/lyxfind.cpp: cleanup formatting

2012-10-23 Thread larsbj
From: Lars Gullik Bjønnes 

Remove some eol space
re-indent where required
make some ?: constructs a bit easier to read.
---
 src/lyxfind.cpp | 177 ++--
 1 file changed, 96 insertions(+), 81 deletions(-)

diff --git a/src/lyxfind.cpp b/src/lyxfind.cpp
index b46abc7..dba41d7 100644
--- a/src/lyxfind.cpp
+++ b/src/lyxfind.cpp
@@ -94,7 +94,7 @@ private:
 
 
 int findForward(DocIterator & cur, MatchString const & match,
-bool find_del = true)
+   bool find_del = true)
 {
for (; cur; cur.forwardChar())
if (cur.inTexted()) {
@@ -107,7 +107,7 @@ int findForward(DocIterator & cur, MatchString const & 
match,
 
 
 int findBackwards(DocIterator & cur, MatchString const & match,
-bool find_del = true)
+ bool find_del = true)
 {
while (cur) {
cur.backwardChar();
@@ -149,7 +149,7 @@ bool searchAllowed(docstring const & str)
 
 
 bool findOne(BufferView * bv, docstring const & searchstr,
-   bool case_sens, bool whole, bool forward, bool find_del = true)
+bool case_sens, bool whole, bool forward, bool find_del = true)
 {
if (!searchAllowed(searchstr))
return false;
@@ -158,8 +158,9 @@ bool findOne(BufferView * bv, docstring const & searchstr,
 
MatchString const match(searchstr, case_sens, whole);
 
-   int match_len = forward ? findForward(cur, match, find_del) :
- findBackwards(cur, match, find_del);
+   int match_len = forward
+   ? findForward(cur, match, find_del)
+   : findBackwards(cur, match, find_del);
 
if (match_len > 0)
bv->putSelectionAt(cur, match_len, !forward);
@@ -193,11 +194,13 @@ int replaceAll(BufferView * bv,
pos_type const pos = cur.pos();
Font const font = cur.paragraph().getFontSettings(buf.params(), 
pos);
cur.recordUndo();
-   int striked = ssize - cur.paragraph().eraseChars(pos, pos + 
match_len,
-   
buf.params().trackChanges);
+   int striked = ssize -
+   cur.paragraph().eraseChars(pos, pos + match_len,
+  buf.params().trackChanges);
cur.paragraph().insert(pos, replacestr, font,
-  Change(buf.params().trackChanges ?
- Change::INSERTED : 
Change::UNCHANGED));
+  Change(buf.params().trackChanges
+ ? Change::INSERTED
+ : Change::UNCHANGED));
for (int i = 0; i < rsize + striked; ++i)
cur.forwardChar();
++num;
@@ -229,8 +232,8 @@ int replaceAll(BufferView * bv,
 // returns the number of replacements made (one, if any) and 
 // whether anything at all was done.
 pair replaceOne(BufferView * bv, docstring searchstr,
-   docstring const & replacestr, bool case_sens, 
-   bool whole, bool forward, bool findnext)
+  docstring const & replacestr, bool case_sens,
+  bool whole, bool forward, bool findnext)
 {
Cursor & cur = bv->cursor();
if (!cur.selection()) {
@@ -256,8 +259,9 @@ pair replaceOne(BufferView * bv, docstring 
searchstr,
bool have_selection = cur.selection();
docstring const selected = cur.selectionAsString(false);
bool match = 
-   case_sens ? searchstr == selected
-   : compare_no_case(searchstr, selected) == 0;
+   case_sens
+   ? searchstr == selected
+   : compare_no_case(searchstr, selected) == 0;
 
// no selection or current selection is not search word:
// just find the search word
@@ -286,7 +290,7 @@ pair replaceOne(BufferView * bv, docstring 
searchstr,
 
 
 docstring const find2string(docstring const & search,
-bool casesensitive, bool matchword, bool forward)
+   bool casesensitive, bool matchword, bool forward)
 {
odocstringstream ss;
ss << search << '\n'
@@ -298,8 +302,9 @@ docstring const find2string(docstring const & search,
 
 
 docstring const replace2string(docstring const & replace,
-   docstring const & search, bool casesensitive, bool matchword,
-   bool all, bool forward, bool findnext)
+  docstring const & search,
+  bool casesensitive, bool matchword,
+  bool all, bool forward, bool findnext)
 {
odocstringstream ss;
ss << replace << '\n'
@@ -363,7 +368,7 @@ bool lyxreplace(BufferView * bv,
 

[PATCH 4/5] src/lyxfinc.cpp: use make_pair

2012-10-23 Thread larsbj
From: Lars Gullik Bjønnes 

Use make_pair(...) instead of pair(...).
---
 src/lyxfind.cpp | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/lyxfind.cpp b/src/lyxfind.cpp
index dba41d7..a19724b 100644
--- a/src/lyxfind.cpp
+++ b/src/lyxfind.cpp
@@ -240,12 +240,12 @@ pair replaceOne(BufferView * bv, docstring 
searchstr,
// no selection, non-empty search string: find it
if (!searchstr.empty()) {
findOne(bv, searchstr, case_sens, whole, forward);
-   return pair(true, 0);
+   return make_pair(true, 0);
}
// empty search string
if (!cur.inTexted())
// bail in math
-   return pair(false, 0);
+   return make_pair(false, 0);
// select current word and treat it as the search string
cur.innerText()->selectWord(cur, WHOLE_WORD);
searchstr = cur.selectionAsString(false);
@@ -254,7 +254,7 @@ pair replaceOne(BufferView * bv, docstring 
searchstr,
// if we still don't have a search string, report the error
// and abort.
if (!searchAllowed(searchstr))
-   return pair(false, 0);
+   return make_pair(false, 0);

bool have_selection = cur.selection();
docstring const selected = cur.selectionAsString(false);
@@ -267,13 +267,13 @@ pair replaceOne(BufferView * bv, docstring 
searchstr,
// just find the search word
if (!have_selection || !match) {
findOne(bv, searchstr, case_sens, whole, forward);
-   return pair(true, 0);
+   return make_pair(true, 0);
}
 
// we're now actually ready to replace. if the buffer is
// read-only, we can't, though.
if (bv->buffer().isReadonly())
-   return pair(false, 0);
+   return make_pair(false, 0);
 
cap::replaceSelectionWithString(cur, replacestr);
if (forward) {
@@ -283,7 +283,7 @@ pair replaceOne(BufferView * bv, docstring 
searchstr,
if (findnext)
findOne(bv, searchstr, case_sens, whole, forward, false);
 
-   return pair(true, 1);
+   return make_pair(true, 1);
 }
 
 } // namespace anon
-- 
1.8.0



[PATCH 5/5] src/lyxfind.cpp: use local typedef to simplify

2012-10-23 Thread larsbj
From: Lars Gullik Bjønnes 

Use a local typedef pair P to avoid having to repeat
that multiple times.
---
 src/lyxfind.cpp | 72 -
 1 file changed, 40 insertions(+), 32 deletions(-)

diff --git a/src/lyxfind.cpp b/src/lyxfind.cpp
index a19724b..33dbd8a 100644
--- a/src/lyxfind.cpp
+++ b/src/lyxfind.cpp
@@ -495,54 +495,62 @@ typedef vector > Escapes;
 /// @note Beware of order
 Escapes const & get_regexp_escapes()
 {
+   typedef std::pair P;
+
static Escapes escape_map;
if (escape_map.empty()) {
-   escape_map.push_back(pair("$", "_x_$"));
-   escape_map.push_back(pair("{", "_x_{"));
-   escape_map.push_back(pair("}", "_x_}"));
-   escape_map.push_back(pair("[", "_x_["));
-   escape_map.push_back(pair("]", "_x_]"));
-   escape_map.push_back(pair("(", "_x_("));
-   escape_map.push_back(pair(")", "_x_)"));
-   escape_map.push_back(pair("+", "_x_+"));
-   escape_map.push_back(pair("*", "_x_*"));
-   escape_map.push_back(pair(".", "_x_."));
-   escape_map.push_back(pair("\\", 
"(?:|backslash)"));
-   escape_map.push_back(pair("~", 
"(?:textasciitilde|sim)"));
-   escape_map.push_back(pair("^", 
"(?:\\^|textasciicircum\\{\\}|mathcircumflex)"));
-   escape_map.push_back(pair("_x_", "\\"));
+   escape_map.push_back(P("$", "_x_$"));
+   escape_map.push_back(P("{", "_x_{"));
+   escape_map.push_back(P("}", "_x_}"));
+   escape_map.push_back(P("[", "_x_["));
+   escape_map.push_back(P("]", "_x_]"));
+   escape_map.push_back(P("(", "_x_("));
+   escape_map.push_back(P(")", "_x_)"));
+   escape_map.push_back(P("+", "_x_+"));
+   escape_map.push_back(P("*", "_x_*"));
+   escape_map.push_back(P(".", "_x_."));
+   escape_map.push_back(P("\\", "(?:|backslash)"));
+   escape_map.push_back(P("~", "(?:textasciitilde|sim)"));
+   escape_map.push_back(P("^", 
"(?:\\^|textasciicircum\\{\\}|mathcircumflex)"));
+   escape_map.push_back(P("_x_", "\\"));
}
return escape_map;
 }
 
 /// A map of lyx escaped strings and their unescaped equivalent.
-Escapes const & get_lyx_unescapes() {
+Escapes const & get_lyx_unescapes()
+{
+   typedef std::pair P;
+
static Escapes escape_map;
if (escape_map.empty()) {
-   escape_map.push_back(pair("\\%", "%"));
-   escape_map.push_back(pair("\\mathcircumflex ", 
"^"));
-   escape_map.push_back(pair("\\mathcircumflex", 
"^"));
-   escape_map.push_back(pair("\\backslash ", 
"\\"));
-   escape_map.push_back(pair("\\backslash", "\\"));
-   escape_map.push_back(pair("{", "_x_<"));
-   escape_map.push_back(pair("}", "_x_>"));
-   escape_map.push_back(pair("\\sim ", "~"));
-   escape_map.push_back(pair("\\sim", "~"));
+   escape_map.push_back(P("\\%", "%"));
+   escape_map.push_back(P("\\mathcircumflex ", "^"));
+   escape_map.push_back(P("\\mathcircumflex", "^"));
+   escape_map.push_back(P("\\backslash ", "\\"));
+   escape_map.push_back(P("\\backslash", "\\"));
+   escape_map.push_back(P("{", "_x_<"));
+   escape_map.push_back(P("}", "_x_>"));
+   escape_map.push_back(P("\\sim ", "~"));
+   escape_map.push_back(P("\\sim", "~"));
}
return escape_map;
 }
 
 /// A map of escapes turning a regexp matching text to one matching latex.
-Escapes const & get_regexp_latex_escapes() {
+Escapes const & get_regexp_latex_escapes()
+{
+   typedef std::pair P;
+
static Escapes escape_map;
if (escape_map.empty()) {
-   escape_map.push_back(pair("", 
"(?:|backslash|textbackslash\\{\\})"));
-   escape_map.push_back(pair("(("(("\\[", "\\{\\[\\}"));
-   escape_map.push_back(pair("\\]", "\\{\\]\\}"));
-   escape_map.push_back(pair("\\^", 
"(?:\\^|textasciicircum\\{\\}|mathcircumflex)"));
-   escape_map.push_back(pair

[PATCH 1/5] tests/boost.cpp: remove using namespace std

2012-10-23 Thread larsbj
From: Lars Gullik Bjønnes 

Trivial to remove the namespace injection.
---
 src/frontends/tests/boost.cpp | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/frontends/tests/boost.cpp b/src/frontends/tests/boost.cpp
index 09d701d..6151f1f 100644
--- a/src/frontends/tests/boost.cpp
+++ b/src/frontends/tests/boost.cpp
@@ -14,14 +14,12 @@
 #include 
 #include 
 
-using namespace std;
-
 namespace boost {
 
 #ifndef BOOST_NO_EXCEPTIONS
-void throw_exception(exception const & /*e*/)
+void throw_exception(std::exception const &)
 {
-   cerr<<"ASSERTION VIOLATED IN biblio test";
+   std::cerr << "ASSERTION VIOLATED IN biblio test";
BOOST_ASSERT(false);
 }
 #endif
-- 
1.8.0



Re: [PATCH 1/5] tests/boost.cpp: remove using namespace std

2012-10-23 Thread Jean-Marc Lasgouttes

Le 23/10/12 23:14, lar...@gullik.org a écrit :

From: Lars Gullik Bjønnes 

Trivial to remove the namespace injection.


I think that patches 2-5/5 are no brainers and you should commit them. 
For this one, I would wait until someone makes a decision.


JMarc



Re: [PATCH 11/13] Use make_shared to create shared_ptr

2012-10-23 Thread Jean-Marc Lasgouttes

Le 23/10/12 21:18, Lars Gullik Bjønnes a écrit :

| Concerning auto, I am still not sure that I like it.

Liking it took me some 5 seconds.

Auto suddenly makes it nice to work with the complex types you get in
C++.

Imagine:

auto func = [](){};
func();

try to figure out what type func really is. Do you care?


I care that I am wirting code with unknown types and suddenly I might be 
doing something awfully inefficient without knowing it. Plus I suspect 
that people who have not read the standard will not know wheat are the 
cases where auto is fine and where are the ones where "you obviously 
can't because XXX".


JMarc

PS: are you really telling me that [](){} is something valid? Frightening.


Re: [PATCH 13/13] boost: changes to make it compile cleanly with gcc 4.8

2012-10-23 Thread Jean-Marc Lasgouttes

Le 23/10/12 23:05, Lars Gullik Bjønnes a écrit :

lar...@gullik.org (Lars Gullik Bjønnes) writes:

| ---
|  boost/boost/lexical_cast.hpp  | 1 -
|  boost/boost/math/special_functions/fpclassify.hpp | 4 
|  boost/boost/math/special_functions/sign.hpp   | 2 --
|  boost/boost/regex/v4/regex_format.hpp | 2 --
|  boost/boost/regex/v4/regex_split.hpp  | 1 -
|  boost/boost/static_assert.hpp | 2 +-
|  boost/boost/tuple/detail/tuple_basic.hpp  | 1 -
|  7 files changed, 1 insertion(+), 12 deletions(-)

I'd really like to commit this one. Since current status makes it
very tiresome to work with. (warnings galore).

(If I have to redo this later on a boost upgrade is no problem.)


Somehow I have not seen the patch. But I truest that it is OK if you say so.

JMarc



Re: [PATCH 11/13] Use make_shared to create shared_ptr

2012-10-23 Thread Lars Gullik Bjønnes
Jean-Marc Lasgouttes  writes:

| Le 23/10/12 21:18, Lars Gullik Bjønnes a écrit :
>> | Concerning auto, I am still not sure that I like it.
>>
>> Liking it took me some 5 seconds.
>>
>> Auto suddenly makes it nice to work with the complex types you get in
>> C++.
>>
>> Imagine:
>>
>> auto func = [](){};
>> func();
>>
>> try to figure out what type func really is. Do you care?
>
| I care that I am wirting code with unknown types and suddenly I might
| be doing something awfully inefficient without knowing it. Plus I
| suspect that people who have not read the standard will not know wheat
| are the cases where auto is fine and where are the ones where "you
| obviously can't because XXX".
>
| JMarc
>
| PS: are you really telling me that [](){} is something valid? Frightening.

:-) heh

That is the new lambda expressions in C++11. Yes, it looks weird at
first, but are not hard to get used to and lambdas are nice.

Shortest possible C++ program that call a function:

--
int main(){[](){}();}
--

  / capture list
 /  argument list
/  /function body
   /  //
auto lambda = [](...){ ... };

example:

---
#include 
#include 
#include 
#include 

// Compile on a newer gcc:
// g++ -std=c++11 lambda_and_more.cpp

int main() {
std::vector v({9,8,7,6,5,4,3,2,1}); 
std::for_each(v.begin(), v.end(), [](int i){std::cout << i;});
std::sort(v.begin(), v.end(), [](int lhs, int rhs){ return lhs < rhs; });
std::copy(v.begin(), v.end(), std::ostream_iterator(std::cout, ","));

int sum = 0;
std::for_each(v.begin(), v.end(), [&](int i){ sum += i;});
std::cout << sum << std::endl;
}


-- 
   Lgb



FYI: compiling with gcc 4.8

2012-10-23 Thread Lars Gullik Bjønnes

(AMD Phenom(tm) II X6 1090T Processor)

gcc 4.7.2 (4.7.2 20120921 (Red Hat 4.7.2-2)):

time make CXX=/usr/bin/g++ -j6
real3m1.055s
user10m31.367s
sys 0m49.691s

size src/lyx
text   data bss dec   hexfilename
11339834   3133645416   11416586  ae340a src/lyx

ls -l ./src/lyx
169405554 ./src/lyx


gcc 4.8.0 (4.8.0 20121023 (experimental)):

time make -j6
real3m9.445s
user11m53.000s
sys 0m51.485s

size src/lyx
text   databss dec   hexfilename
11348213   31352   44504   11424069  ae5145 src/lyx

ls -l ./src/lyx
172783951 ./src/lyx

It seems that size and compile time not much has happened.
(a good thing)

No warnings¹ with gcc 4.7 nor with 4.8 (except one in Qt but I bet that
will get fixed when gcc comes closer to release)

¹ That is with my boost warnings removed patch applied.

-- 
   Lgb



Re: [PATCH 5/5] src/lyxfind.cpp: use local typedef to simplify

2012-10-23 Thread André Pönitz
On Tue, Oct 23, 2012 at 11:14:42PM +0200, lar...@gullik.org wrote:
> From: Lars Gullik Bjønnes 
> 
> Use a local typedef pair P to avoid having to repeat
> that multiple times.
> ---
>  src/lyxfind.cpp | 72 
> -
>  1 file changed, 40 insertions(+), 32 deletions(-)
> 
> diff --git a/src/lyxfind.cpp b/src/lyxfind.cpp
> index a19724b..33dbd8a 100644
> --- a/src/lyxfind.cpp
> +++ b/src/lyxfind.cpp
> @@ -495,54 +495,62 @@ typedef vector > Escapes;
>  /// @note Beware of order
>  Escapes const & get_regexp_escapes()
>  {
> + typedef std::pair P;
> +

Conveniently adding a std:: or three, so next time the discussion
comes up we can reasonably claim that it is used "inconsistently"
and the 'using' on top could go...

Andre'


Re: #8387: use nicer fonts in splash.lyx

2012-10-23 Thread Uwe Stöhr

Am 23.10.2012 11:59, schrieb Liviu Andronic:


I proposed to use Latin Modern fonts in splash.lyx as:
- the default choice of fonts in LyX is bitmap, and ugly


This is not true anymore. Please show me a screenshot where the font look pixeld in normal 
magnification.



So are there good reasons _not_ to use LM fonts in splash.lyx?


When the user sees this, he installed LyX for the first time. So when he plays a bit with it he 
might wonder why there is a special font and not the default one. The file itself doesn't state 
anything and the second step after the splash file is the tutorial where the user learns the basics 
of LyX  also the font things.

Therefore I tried to keep the splash file as simple as possible (no preamble in 
this file for example).

regards Uwe



Re: [PATCH 5/5] src/lyxfind.cpp: use local typedef to simplify

2012-10-23 Thread Lars Gullik Bjønnes
André Pönitz  writes:

| On Tue, Oct 23, 2012 at 11:14:42PM +0200, lar...@gullik.org wrote:
>> From: Lars Gullik Bjønnes 
>> 
>> Use a local typedef pair P to avoid having to repeat
>> that multiple times.
>> ---
>>  src/lyxfind.cpp | 72
>> -
>>  1 file changed, 40 insertions(+), 32 deletions(-)
>> 
>> diff --git a/src/lyxfind.cpp b/src/lyxfind.cpp
>> index a19724b..33dbd8a 100644
>> --- a/src/lyxfind.cpp
>> +++ b/src/lyxfind.cpp
>> @@ -495,54 +495,62 @@ typedef vector > Escapes;
>>  /// @note Beware of order
>>  Escapes const & get_regexp_escapes()
>>  {
>> +typedef std::pair P;
>> +
>
| Conveniently adding a std:: or three, so next time the discussion
| comes up we can reasonably claim that it is used "inconsistently"
| and the 'using' on top could go...

What is your agenda really?



Re: FYI: compiling with gcc 4.8

2012-10-23 Thread Lars Gullik Bjønnes
lar...@gullik.org (Lars Gullik Bjønnes) writes:

| gcc 4.8.0 (4.8.0 20121023 (experimental)):
>
| time make -j6
| real3m9.445s
| user11m53.000s
| sys 0m51.485s
>
| size src/lyx
| text   databss dec   hexfilename
| 11348213   31352   44504   11424069  ae5145 src/lyx
>
| ls -l ./src/lyx
| 172783951 ./src/lyx

gcc 4.8.0 (4.8.0 20121023 (experimental)) in gnu++11 mode:
(some warnings about deprecated auto_ptr)

time make -j6
real2m59.968s
user12m54.708s
sys 0m53.020s

size src/lyx
text   databss dec   hexfilename
11012251   31344   44408   11088003  a93083 src/lyx

ls -l src/lyx
180181591 Oct 24 02:52 src/lyx

-- 
   Lgb



[PATCH 2/2] config/lyxinclude.m4: add support for --enable-cxx11

2012-10-23 Thread Lars Gullik Bjønnes
Using --enable-cxx11 turns on C++11 mode in gcc.
---
 config/lyxinclude.m4 | 16 
 1 file changed, 16 insertions(+)

diff --git a/config/lyxinclude.m4 b/config/lyxinclude.m4
index e532c54..2e529ea 100644
--- a/config/lyxinclude.m4
+++ b/config/lyxinclude.m4
@@ -232,6 +232,10 @@ AC_ARG_ENABLE(pch,
enable_pch=no;)
 lyx_pch_comp=no
 
+AC_ARG_ENABLE(cxx11,
+  AC_HELP_STRING([--enable-cxx11],[enable C++11 mode]),,
+  enable_cxx11=no;)
+
 AC_ARG_ENABLE(assertions,
   AC_HELP_STRING([--enable-assertions],[add runtime sanity checks in the 
program]),,
   [AS_CASE([$build_type], [dev*|pre*], [enable_assertions=yes],
@@ -306,6 +310,18 @@ if test x$GXX = xyes; then
;;
 esac
   fi
+  if test x$enable_cxx11 = xyes ; then
+  case $gxx_version in
+ 4.3*|4.4*|4.5*|4.6*)
+ lyx_flags="$lyx_flags c++11-mode"
+ CXXFLAGS="-std=gnu++0x $CXXFLAGS"
+ ;;
+ 4.7*|4.8*)
+ lyx_flags="$lyx_flags c++11-mode"
+ CXXFLAGS="-std=gnu++11 $CXXFLAGS"
+ ;;
+  esac
+  fi
 fi
 test "$lyx_pch_comp" = yes && lyx_flags="$lyx_flags pch"
 AM_CONDITIONAL(LYX_BUILD_PCH, test "$lyx_pch_comp" = yes)
-- 
1.8.0



[PATCH 1/2] support/Messages.cpp: add space to not be taken as user defined literal

2012-10-23 Thread Lars Gullik Bjønnes
In C++11 you are not allowed to have non-literal specifiers right
after a string literal.
---
 src/support/Messages.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/support/Messages.cpp b/src/support/Messages.cpp
index ca5c110..fdcaf66 100644
--- a/src/support/Messages.cpp
+++ b/src/support/Messages.cpp
@@ -119,7 +119,7 @@ bool Messages::available(string const & c)
// this loops at most twice
while (true) {
string const filen = locale_dir + "/" + code 
-   + "/LC_MESSAGES/"PACKAGE".mo";
+   + "/LC_MESSAGES/" PACKAGE ".mo";
if (FileName(filen).isReadableFile())
return true;
if (contains(code, '_'))
-- 
1.8.0