[LyX/master] Reduce whitespace differences to LyX

2015-11-15 Thread Georg Baum
commit 1da21bec7140f118ce191b64f7609d0b5e114ed4
Author: Georg Baum 
Date:   Fri Nov 13 21:54:00 2015 +0100

Reduce whitespace differences to LyX

LyX writes an empty line between \end_layout and \begin_layout, so we should
do so as well.

diff --git a/development/tools/gen_lfuns.py b/development/tools/gen_lfuns.py
index d087b93..fc037d9 100755
--- a/development/tools/gen_lfuns.py
+++ b/development/tools/gen_lfuns.py
@@ -328,39 +328,37 @@ def write_fields(file, lfun):
 file.write("\\begin_layout Subsection*\n")
 file.write(lfun["name"] + "\n")
 file.write("\\end_layout\n")
-#file.write("\n")
+file.write("\n")
 if lfun["action"] != "":
 file.write("\\begin_layout Description\n")
 file.write("Action " + lfun["action"] + "\n")
-#file.write("\n")
 file.write("\\end_layout\n")
-#file.write("\n")
+file.write("\n")
 if lfun["notion"] != "":
 file.write("\\begin_layout Description\n")
 file.write("Notion " + lfun["notion"] + "\n")
 file.write("\\end_layout\n")
-#file.write("\n")
+file.write("\n")
 if lfun["syntax"] != "":
 file.write("\\begin_layout Description\n")
 file.write("Syntax " + lfun["syntax"] + "\n")
 file.write("\\end_layout\n")
-#file.write("\n")
+file.write("\n")
 if lfun["params"] != "":
 file.write("\\begin_layout Description\n")
 file.write("Params " + lfun["params"] + "\n")
 file.write("\\end_layout\n")
-#file.write("\n")
+file.write("\n")
 if lfun["sample"] != "":
 file.write("\\begin_layout Description\n")
 file.write("Sample " + lfun["sample"] + "\n")
 file.write("\\end_layout\n")
-#file.write("\n")
+file.write("\n")
 if lfun["origin"] != "":
 file.write("\\begin_layout Description\n")
 file.write("Origin " + lfun["origin"] + "\n")
 file.write("\\end_layout\n")
-#file.write("\n")
-file.write("\n")
+file.write("\n")
 
 def write_sections(file,lfuns):
 """Write sections of LFUNs"""
@@ -378,6 +376,7 @@ def write_sections(file,lfuns):
 file.write("\\begin_layout Section\n")
 file.write(section_headings[val] + "\n")
 file.write("\\end_layout\n")
+file.write("\n")
 for lf in lfuns:
 if lf["type"] == val:
 write_fields(file, lf)


[LyX/master] Fix sorting

2015-11-15 Thread Georg Baum
commit 5060b5b76eb88a98e65238e1b55a9f0b7ab3e2b9
Author: Georg Baum 
Date:   Sat Nov 14 10:25:07 2015 +0100

Fix sorting

No single translation has been changed, but pt_BR and pt_PT are now 
correctly
sorted. This removes the artifical diffs that running
make ../lib/layouttranslations
did produce previously.

diff --git a/lib/layouttranslations b/lib/layouttranslations
index becc5dc..325b9a2 100644
--- a/lib/layouttranslations
+++ b/lib/layouttranslations
@@ -986,85 +986,85 @@ Translation pl
"Theorem" "Twierdzenie"
 End
 
-Translation pt_PT
+Translation pt_BR
"Acknowledgement" "Agradecimento"
"Algorithm" "Algoritmo"
"Assumption" "Suposição"
"Axiom" "Axioma"
"Case" "Caso"
-   "Chart" "Mapa"
+   "Chart" "Chart"
"Claim" "Afirmação"
"Conclusion" "Conclusão"
"Condition" "Condição"
-   "Conjecture" "Conjectura"
+   "Conjecture" "Conjetura"
"Corollary" "Corolário"
"Criterion" "Critério"
"Definition" "Definição"
"Example" "Exemplo"
"Exercise" "Exercício"
-   "Fact" "Facto"
-   "Graph[[mathematical]]" "Grafo"
+   "Fact" "Fato"
+   "Graph[[mathematical]]" "Graph"
"Lemma" "Lema"
"List of Algorithms" "Lista de Algoritmos"
-   "List of Charts" "Lista de Mapas"
-   "List of Graphs[[mathematical]]" "Lista de Grafos"
+   "List of Charts" "Lista de Charts"
+   "List of Graphs[[mathematical]]" "Lista de Graphs"
"List of Schemes" "Lista de Esquemas"
-   "List of Tableaux" "Lista de Quadros"
+   "List of Tableaux" "Lista de Tableaux"
"Listing" "Listagem"
-   "Listings[[List of Listings]]" "Lista de Listagens"
+   "Listings[[List of Listings]]" "Listagens"
"Notation" "Notação"
"Note" "Nota"
"Problem" "Problema"
"Proof" "Prova"
"Property" "Propriedade"
"Proposition" "Proposição"
-   "Question" "Questão"
+   "Question" "Pergunta"
"Remark" "Observação"
"Scheme" "Esquema"
"Solution" "Solução"
-   "Summary" "Sumário"
-   "Tableau" "Quadro"
+   "Summary" "Resumo"
+   "Tableau" "Tableau"
"Theorem" "Teorema"
 End
 
-Translation pt_BR
+Translation pt_PT
"Acknowledgement" "Agradecimento"
"Algorithm" "Algoritmo"
"Assumption" "Suposição"
"Axiom" "Axioma"
"Case" "Caso"
-   "Chart" "Chart"
+   "Chart" "Mapa"
"Claim" "Afirmação"
"Conclusion" "Conclusão"
"Condition" "Condição"
-   "Conjecture" "Conjetura"
+   "Conjecture" "Conjectura"
"Corollary" "Corolário"
"Criterion" "Critério"
"Definition" "Definição"
"Example" "Exemplo"
"Exercise" "Exercício"
-   "Fact" "Fato"
-   "Graph[[mathematical]]" "Graph"
+   "Fact" "Facto"
+   "Graph[[mathematical]]" "Grafo"
"Lemma" "Lema"
"List of Algorithms" "Lista de Algoritmos"
-   "List of Charts" "Lista de Charts"
-   "List of Graphs[[mathematical]]" "Lista de Graphs"
+   "List of Charts" "Lista de Mapas"
+   "List of Graphs[[mathematical]]" "Lista de Grafos"
"List of Schemes" "Lista de Esquemas"
-   "List of Tableaux" "Lista de Tableaux"
+   "List of Tableaux" "Lista de Quadros"
"Listing" "Listagem"
-   "Listings[[List of Listings]]" "Listagens"
+   "Listings[[List of Listings]]" "Lista de Listagens"
"Notation" "Notação"
"Note" "Nota"
"Problem" "Problema"
"Proof" "Prova"
"Property" "Propriedade"
"Proposition" "Proposição"
-   "Question" "Pergunta"
+   "Question" "Questão"
"Remark" "Observação"
"Scheme" "Esquema"
"Solution" "Solução"
-   "Summary" "Resumo"
-   "Tableau" "Tableau"
+   "Summary" "Sumário"
+   "Tableau" "Quadro"
"Theorem" "Teorema"
 End
 


[LyX/master] Add experimental mode to save files with LyX

2015-11-15 Thread Georg Baum
commit 3ab58d155cbb5d5df3e01f81f2c7bb55617ea8ed
Author: Georg Baum 
Date:   Sat Nov 14 10:14:59 2015 +0100

Add experimental mode to save files with LyX

Thanks Scott for the idea to modify the document. This seems to work, but I 
am
not surer whether it is safe in all cases, so better warn if this is used.

diff --git a/development/tools/updatedocs.py b/development/tools/updatedocs.py
index ab47062..902248a 100644
--- a/development/tools/updatedocs.py
+++ b/development/tools/updatedocs.py
@@ -16,7 +16,7 @@
 import os, re, string, sys, subprocess, shutil
 
 
-def convertdir(docdir, prefix, lyx2lyx, systemlyxdir):
+def convertdir(docdir, prefix, lyx2lyx, lyx, systemlyxdir):
 olddir = os.getcwd()
 os.chdir(docdir)
 for i in os.listdir("."):
@@ -24,7 +24,7 @@ def convertdir(docdir, prefix, lyx2lyx, systemlyxdir):
 if i != 'attic':
 subdir = os.path.join(docdir, i)
 subprefix = os.path.join(prefix, i)
-convertdir(subdir, subprefix, lyx2lyx, systemlyxdir)
+convertdir(subdir, subprefix, lyx2lyx, lyx, systemlyxdir)
 continue
 (base, ext) = os.path.splitext(i)
 if ext != ".lyx":
@@ -38,6 +38,12 @@ def convertdir(docdir, prefix, lyx2lyx, systemlyxdir):
 cmd = [lyx2lyx, old, '-s', systemlyxdir, '-o', i]
 sys.stderr.write('Converting %s\n' % os.path.join(prefix, i))
 subprocess.call(cmd)
+if lyx != '':
+# This is a hack, but without modifying the doc LyX refuses to 
save and stays open
+# FIXME: Is self-insert a; char-delete-backward always a noop?
+#What if change-tracking is enabled?
+cmd = [lyx, '-f', '-x', 'command-sequence self-insert a; 
char-delete-backward; buffer-write; lyx-quit', i]
+subprocess.call(cmd)
 os.chdir(olddir)
 
 
@@ -46,10 +52,15 @@ def main(argv):
 toolsdir = os.path.dirname(argv[0])
 lyx2lyx = os.path.abspath(os.path.join(toolsdir, 
"../../lib/lyx2lyx/lyx2lyx"))
 systemlyxdir = os.path.abspath(os.path.join(toolsdir, "../../lib"))
+if len(argv) > 1:
+sys.stderr.write('Warning: Converting with LyX is experimental. Check 
the results carefully.\n'))
+lyx = os.path.abspath(argv[1])
+else:
+lyx = ''
 docpaths = ['../../lib/doc', '../../lib/examples', '../../lib/templates', 
'../../development/MacOSX/ReadMe']
 for docpath in docpaths:
 docdir = os.path.abspath(os.path.join(toolsdir, docpath))
-convertdir(docdir, '', lyx2lyx, systemlyxdir)
+convertdir(docdir, '', lyx2lyx, lyx, systemlyxdir)
 
 return 0
 


[LyX/master] Amend 789745df

2015-11-15 Thread Guillaume Munch
commit 7b07788278b8e81aeef42ed0c25c26f352d6d0d0
Author: Guillaume Munch 
Date:   Sun Nov 15 12:15:02 2015 +

Amend 789745df

Remove warning. Actually the auxiliary function is not necessary since its
actual contents have been relocated as TexRow::prepend() during dev.

diff --git a/src/frontends/qt4/GuiViewSource.cpp 
b/src/frontends/qt4/GuiViewSource.cpp
index 4a0381d..e528222 100644
--- a/src/frontends/qt4/GuiViewSource.cpp
+++ b/src/frontends/qt4/GuiViewSource.cpp
@@ -164,27 +164,12 @@ void ViewSourceWidget::updateView()
short_delay : long_delay);
 }
 
+
 void ViewSourceWidget::updateViewNow()
 {
update_timer_->start(0);
 }
 
-namespace {
-
-QString prependTexRow(TexRow const & texrow, QString const & content)
-{
-   QStringList list = content.split(QChar('\n'));
-   docstring_list dlist;
-   for (QStringList::const_iterator it = list.begin(); it != list.end(); 
++it)
-   dlist.push_back(from_utf8(fromqstr(*it)));
-   texrow.prepend(dlist);
-   QString qstr;
-   for (docstring_list::iterator it = dlist.begin(); it != dlist.end(); 
++it)
-   qstr += toqstr(*it) + '\n';
-   return qstr;
-}
-
-} // anon namespace
 
 void ViewSourceWidget::realUpdateView()
 {
@@ -217,8 +202,18 @@ void ViewSourceWidget::realUpdateView()
QString old = document_->toPlainText();
QString qcontent = toqstr(content);
 #ifdef DEVEL_VERSION
-   if (texrow_.get() && lyx::lyxerr.debugging(Debug::LATEX))
-   qcontent = prependTexRow(*texrow_, qcontent);
+   // output tex<->row correspondences in the source panel if the "-dbg 
latex"
+   // option is given.
+   if (texrow_.get() && lyx::lyxerr.debugging(Debug::LATEX)) {
+   QStringList list = qcontent.split(QChar('\n'));
+   docstring_list dlist;
+   for (QStringList::const_iterator it = list.begin(); it != 
list.end(); ++it)
+   dlist.push_back(from_utf8(fromqstr(*it)));
+   texrow_->prepend(dlist);
+   qcontent.clear();
+   for (docstring_list::iterator it = dlist.begin(); it != 
dlist.end(); ++it)
+   qcontent += toqstr(*it) + '\n';
+   }
 #endif
// prevent gotoCursor()
viewSourceTV->blockSignals(true);


[LyX/master] installer: support texindy

2015-11-15 Thread Uwe Stöhr
commit 1f0488bf360e1f1c8a93376161450db2a6a5a814
Author: Uwe Stöhr 
Date:   Mon Nov 16 04:04:11 2015 +0100

installer: support texindy

texindy requires some more Perl and unfortunately the path tho the perl.exe 
in Windows' PATh environment variable.
The new EnvVarUpdate.nsh contains a function to modify Windows environment 
variables easily.

diff --git a/development/Win32/packaging/installer/include/EnvVarUpdate.nsh 
b/development/Win32/packaging/installer/include/EnvVarUpdate.nsh
new file mode 100644
index 000..3968200
--- /dev/null
+++ b/development/Win32/packaging/installer/include/EnvVarUpdate.nsh
@@ -0,0 +1,327 @@
+/**
+ *  EnvVarUpdate.nsh
+ *: Environmental Variables: append, prepend, and remove entries
+ *
+ * WARNING: If you use StrFunc.nsh header then include it before this file
+ *  with all required definitions. This is to avoid conflicts
+ *
+ *  Usage:
+ *${EnvVarUpdate} "ResultVar" "EnvVarName" "Action" "RegLoc" "PathString"
+ *
+ *  Credits:
+ *  Version 1.0 
+ *  * Cal Turney (turnec2)
+ *  * Amir Szekely (KiCHiK) and e-circ for developing the forerunners of this
+ *function: AddToPath, un.RemoveFromPath, AddToEnvVar, un.RemoveFromEnvVar,
+ *WriteEnvStr, and un.DeleteEnvStr
+ *  * Diego Pedroso (deguix) for StrTok
+ *  * Kevin English (kenglish_hi) for StrContains
+ *  * Hendri Adriaens (Smile2Me), Diego Pedroso (deguix), and Dan Fuhry  
+ *(dandaman32) for StrReplace
+ *
+ *  Version 1.1 (compatibility with StrFunc.nsh)
+ *  * techtonik
+ *
+ *  
http://nsis.sourceforge.net/Environmental_Variables:_append%2C_prepend%2C_and_remove_entries
+ *
+ */
+
+
+!ifndef ENVVARUPDATE_FUNCTION
+!define ENVVARUPDATE_FUNCTION
+!verbose push
+!verbose 3
+!include "LogicLib.nsh"
+!include "WinMessages.NSH"
+!include "StrFunc.nsh"
+
+;  Fix for conflict if StrFunc.nsh is already includes in main file 
---
+!macro _IncludeStrFunction StrFuncName
+  !ifndef ${StrFuncName}_INCLUDED
+${${StrFuncName}}
+  !endif
+  !ifndef Un${StrFuncName}_INCLUDED
+${Un${StrFuncName}}
+  !endif
+  !define un.${StrFuncName} "${Un${StrFuncName}}"
+!macroend
+
+!insertmacro _IncludeStrFunction StrTok
+!insertmacro _IncludeStrFunction StrStr
+!insertmacro _IncludeStrFunction StrRep
+
+; -- Macro Definitions 

+!macro _EnvVarUpdateConstructor ResultVar EnvVarName Action Regloc PathString
+  Push "${EnvVarName}"
+  Push "${Action}"
+  Push "${RegLoc}"
+  Push "${PathString}"
+Call EnvVarUpdate
+  Pop "${ResultVar}"
+!macroend
+!define EnvVarUpdate '!insertmacro "_EnvVarUpdateConstructor"'
+ 
+!macro _unEnvVarUpdateConstructor ResultVar EnvVarName Action Regloc PathString
+  Push "${EnvVarName}"
+  Push "${Action}"
+  Push "${RegLoc}"
+  Push "${PathString}"
+Call un.EnvVarUpdate
+  Pop "${ResultVar}"
+!macroend
+!define un.EnvVarUpdate '!insertmacro "_unEnvVarUpdateConstructor"'
+; -- Macro Definitions 
end-
+ 
+;--- EnvVarUpdate 
start
+!define hklm_all_users 'HKLM "SYSTEM\CurrentControlSet\Control\Session 
Manager\Environment"'
+!define hkcu_current_user  'HKCU "Environment"'
+ 
+!macro EnvVarUpdate UN
+ 
+Function ${UN}EnvVarUpdate
+ 
+  Push $0
+  Exch 4
+  Exch $1
+  Exch 3
+  Exch $2
+  Exch 2
+  Exch $3
+  Exch
+  Exch $4
+  Push $5
+  Push $6
+  Push $7
+  Push $8
+  Push $9
+  Push $R0
+ 
+  /* After this point:
+  -
+ $0 = ResultVar (returned)
+ $1 = EnvVarName(input)
+ $2 = Action(input)
+ $3 = RegLoc(input)
+ $4 = PathString(input)
+ $5 = Orig EnvVar   (read from registry)
+ $6 = Len of $0 (temp)
+ $7 = tempstr1  (temp)
+ $8 = Entry counter (temp)
+ $9 = tempstr2  (temp)
+ $R0 = tempChar (temp)  */
+ 
+  ; Step 1:  Read contents of EnvVarName from RegLoc
+  ;
+  ; Check for empty EnvVarName
+  ${If} $1 == ""
+SetErrors
+DetailPrint "ERROR: EnvVarName is blank"
+Goto EnvVarUpdate_Restore_Vars
+  ${EndIf}
+ 
+  ; Check for valid Action
+  ${If}$2 != "A"
+  ${AndIf} $2 != "P"
+  ${AndIf} $2 != "R"
+SetErrors
+DetailPrint "ERROR: Invalid Action - must be A, P, or R"
+Goto EnvVarUpdate_Restore_Vars
+  ${EndIf}
+ 
+  ${If} $3 == HKLM
+ReadRegStr $5 ${hklm_all_users} $1 ; Get EnvVarName from all users 
into $5
+  ${ElseIf} $3 == HKCU
+ReadRegStr $5 ${hkcu_current_user} $1  ; Read EnvVarName from current user 
into $5
+  ${Else}
+SetErrors
+DetailPrint 'ERROR: Action is [$3] but must be "HKLM" or HKCU"'
+Goto EnvVarUpdate_Restore_Vars
+  ${EndIf}
+ 
+  ; Check for empty PathString
+  ${If} $4 == ""
+SetErrors
+DetailPrint "ERROR: PathString is blank"
+Goto EnvVarUpdate_Restore_Vars
+  ${EndIf}
+ 
+  ; Make sure we've got some 

[LyX/master] Factor out multiply used ColorSorter.

2015-11-15 Thread Juergen Spitzmueller
commit b423c59d3ca9e002fff51b8e22ee40c8a8bdf260
Author: Juergen Spitzmueller 
Date:   Mon Nov 16 08:19:16 2015 +0100

Factor out multiply used ColorSorter.

This cures one problem of monolithic build (where the function was
ambiguous)

diff --git a/src/frontends/qt4/GuiBox.cpp b/src/frontends/qt4/GuiBox.cpp
index 0999039..e4d4256 100644
--- a/src/frontends/qt4/GuiBox.cpp
+++ b/src/frontends/qt4/GuiBox.cpp
@@ -103,16 +103,6 @@ static QList colors()
 }
 
 
-namespace {
-
-bool ColorSorter(ColorCode lhs, ColorCode rhs)
-{
-   return support::compare_no_case(lcolor.getGUIName(lhs), 
lcolor.getGUIName(rhs)) < 0;
-}
-
-} // namespace anon
-
-
 GuiBox::GuiBox(QWidget * parent) : InsetParamsWidget(parent)
 {
setupUi(this);
diff --git a/src/frontends/qt4/GuiCharacter.cpp 
b/src/frontends/qt4/GuiCharacter.cpp
index c673d2d..e016876 100644
--- a/src/frontends/qt4/GuiCharacter.cpp
+++ b/src/frontends/qt4/GuiCharacter.cpp
@@ -192,12 +192,6 @@ void fillComboColor(QComboBox * combo, QList const & 
list)
combo->addItem(qt_("Reset"), "inherit");
 }
 
-
-bool ColorSorter(ColorCode lhs, ColorCode rhs)
-{
-   return support::compare_no_case(lcolor.getGUIName(lhs), 
lcolor.getGUIName(rhs)) < 0;
-}
-
 } // namespace anon
 
 GuiCharacter::GuiCharacter(GuiView & lv)
diff --git a/src/frontends/qt4/GuiPrefs.cpp b/src/frontends/qt4/GuiPrefs.cpp
index a076402..2c99dee 100644
--- a/src/frontends/qt4/GuiPrefs.cpp
+++ b/src/frontends/qt4/GuiPrefs.cpp
@@ -1115,19 +1115,6 @@ void PrefScreenFonts::selectTypewriter(const QString & 
name)
 /
 
 
-namespace {
-
-struct ColorSorter
-{
-   bool operator()(ColorCode lhs, ColorCode rhs) const {
-   return
-   compare_no_case(lcolor.getGUIName(lhs), 
lcolor.getGUIName(rhs)) < 0;
-   }
-};
-
-} // namespace anon
-
-
 PrefColors::PrefColors(GuiPreferences * form)
: PrefModule(catLookAndFeel, N_("Colors"), form)
 {
@@ -1164,7 +1151,7 @@ PrefColors::PrefColors(GuiPreferences * form)
continue;
lcolors_.push_back(lc);
}
-   sort(lcolors_.begin(), lcolors_.end(), ColorSorter());
+   qSort(lcolors_.begin(), lcolors_.end(), ColorSorter);
vector::const_iterator cit = lcolors_.begin();
vector::const_iterator const end = lcolors_.end();
for (; cit != end; ++cit) {
diff --git a/src/frontends/qt4/qt_helpers.cpp b/src/frontends/qt4/qt_helpers.cpp
index 4eacaca..c1294e5 100644
--- a/src/frontends/qt4/qt_helpers.cpp
+++ b/src/frontends/qt4/qt_helpers.cpp
@@ -213,6 +213,12 @@ QString formatLocFPNumber(double d)
 }
 
 
+bool ColorSorter(ColorCode lhs, ColorCode rhs)
+{
+   return compare_no_case(lcolor.getGUIName(lhs), lcolor.getGUIName(rhs)) 
< 0;
+}
+
+
 void setValid(QWidget * widget, bool valid)
 {
if (valid) {
diff --git a/src/frontends/qt4/qt_helpers.h b/src/frontends/qt4/qt_helpers.h
index fcdcd53..d4afc78 100644
--- a/src/frontends/qt4/qt_helpers.h
+++ b/src/frontends/qt4/qt_helpers.h
@@ -13,6 +13,7 @@
 #ifndef QTHELPERS_H
 #define QTHELPERS_H
 
+#include "ColorSet.h"
 #include "Length.h"
 #include "support/qstring_helpers.h"
 #include "support/filetools.h"
@@ -73,6 +74,9 @@ void doubleToWidget(QLineEdit * input, std::string const & 
value,
  */
 QString formatLocFPNumber(double d);
 
+/// Method to sort colors by GUI name in combo widgets
+bool ColorSorter(ColorCode lhs, ColorCode rhs);
+
 /// colors a widget red if invalid
 void setValid(QWidget * widget, bool valid);
 


[LyX/master] Rename function that was ambiguous from a monolithic perspective.

2015-11-15 Thread Juergen Spitzmueller
commit 2a223b093382d37eacdcf258c28a66b1b2486b44
Author: Juergen Spitzmueller 
Date:   Mon Nov 16 08:20:54 2015 +0100

Rename function that was ambiguous from a monolithic perspective.

Cures one monolithic build issue with CMake.

diff --git a/src/support/debug.cpp b/src/support/debug.cpp
index f44f7fc..538b487 100644
--- a/src/support/debug.cpp
+++ b/src/support/debug.cpp
@@ -31,14 +31,14 @@ namespace lyx {
 
 namespace {
 
-struct ErrorItem {
+struct DebugErrorItem {
Debug::Type level;
char const * name;
char const * desc;
 };
 
 
-ErrorItem errorTags[] = {
+DebugErrorItem errorTags[] = {
{ Debug::NONE,  "none",  N_("No debugging messages")},
{ Debug::INFO,  "info",  N_("General information")},
{ Debug::INIT,  "init",  N_("Program initialisation")},


[LyX/master] Assure we use docstring.

2015-11-15 Thread Juergen Spitzmueller
commit 78c706e02d065301d895af5551937638921a0f97
Author: Juergen Spitzmueller 
Date:   Mon Nov 16 08:21:53 2015 +0100

Assure we use docstring.

Cures another monolithic build error with CMake.

diff --git a/src/frontends/qt4/GuiBibtex.cpp b/src/frontends/qt4/GuiBibtex.cpp
index 556b79c..8c35ced 100644
--- a/src/frontends/qt4/GuiBibtex.cpp
+++ b/src/frontends/qt4/GuiBibtex.cpp
@@ -329,10 +329,10 @@ void GuiBibtex::updateContents()
 
docstring const & btprint = params_["btprint"];
int btp = 0;
-   if ((bibtopic && btprint == "btPrintNotCited") ||
-  (!bibtopic && btprint == "btPrintAll"))
+   if ((bibtopic && btprint == from_ascii("btPrintNotCited")) ||
+  (!bibtopic && btprint == from_ascii("btPrintAll")))
btp = 1;
-   else if (bibtopic && btprint == "btPrintAll")
+   else if (bibtopic && btprint == from_ascii("btPrintAll"))
btp = 2;
 
btPrintCO->setCurrentIndex(btp);


[LyX/master] Simplify use of Buffer::getBackupName().

2015-11-15 Thread Richard Heck
commit 9efa43d2be7dcff0c1152b6f6a45801cfdd6d70e
Author: Richard Heck 
Date:   Fri Nov 13 17:12:52 2015 -0500

Simplify use of Buffer::getBackupName().

Previous versions of this code used the string in a different way,
but now it is sufficient just to return a FileName.

diff --git a/src/Buffer.cpp b/src/Buffer.cpp
index f907d6c..b1807ed 100644
--- a/src/Buffer.cpp
+++ b/src/Buffer.cpp
@@ -1306,7 +1306,7 @@ Buffer::ReadStatus Buffer::convertLyXFormat(FileName 
const & fn,
 }
 
 
-string Buffer::getBackupName() const {
+FileName Buffer::getBackupName() const {
FileName const & fn = fileName();
string const fname = fn.onlyFileNameWithoutExt();
string const fext  = fn.extension();
@@ -1337,7 +1337,7 @@ string Buffer::getBackupName() const {
backup.set(addName(fpath, addExtension(newbackname, fext)));
v++;
}
-   return v < 100 ? backup.absFileName() : "";
+   return v < 100 ? backup : FileName();
 }
 
 
@@ -1402,11 +1402,8 @@ bool Buffer::save() const
 
FileName backupName;
if (lyxrc.make_backup || d->need_format_backup) {
-   if (d->need_format_backup) {
-   string backup_name = getBackupName();
-   if (!backup_name.empty())
-   backupName.set(backup_name);
-   }
+   if (d->need_format_backup)
+   backupName = getBackupName();
 
// If we for some reason failed to find a backup name in case of
// a format change, this will still set one. It's the best we 
can
diff --git a/src/Buffer.h b/src/Buffer.h
index 7dd9365..7450790 100644
--- a/src/Buffer.h
+++ b/src/Buffer.h
@@ -268,7 +268,7 @@ private:
ReadStatus convertLyXFormat(support::FileName const & fn,
support::FileName & tmpfile, int from_format);
/// get appropriate name for backing up files from older versions
-   std::string getBackupName() const;
+   support::FileName getBackupName() const;
//@}
 
 public:


[LyX/master] We need to show the error message in the case in which we copied the file due to a format change, as well.

2015-11-15 Thread Richard Heck
commit fb2c558f674ba22dc66fda1cac937e903f26c7cd
Author: Richard Heck 
Date:   Sun Nov 15 12:24:37 2015 -0500

We need to show the error message in the case in which we copied the
file due to a format change, as well.

diff --git a/src/Buffer.cpp b/src/Buffer.cpp
index b1807ed..eac9821 100644
--- a/src/Buffer.cpp
+++ b/src/Buffer.cpp
@@ -1333,7 +1333,7 @@ FileName Buffer::getBackupName() const {
v = 1000;
break;
}
-   string newbackname = backname + "-" + convert(v);
+   string const newbackname = backname + "-" + convert(v);
backup.set(addName(fpath, addExtension(newbackname, fext)));
v++;
}
@@ -1401,7 +1401,8 @@ bool Buffer::save() const
bool made_backup = true;
 
FileName backupName;
-   if (lyxrc.make_backup || d->need_format_backup) {
+   bool const needBackup = lyxrc.make_backup || d->need_format_backup;
+   if (needBackup) {
if (d->need_format_backup)
backupName = getBackupName();
 
@@ -1458,8 +1459,8 @@ bool Buffer::save() const
}
// else we saved the file, but failed to move it to the right location.
 
-   if (lyxrc.make_backup && made_backup && !symlink) {
-   // the original file was moved to filename.lyx~, so it will look
+   if (needBackup && made_backup && !symlink) {
+   // the original file was moved to some new location, so it will 
look
// to the user as if it was deleted. (see bug #9234.) we could 
try
// to restore it, but that would basically mean trying to do 
again
// what we just failed to do. better to leave things as they 
are.