]> git.lyx.org Git - lyx.git/commitdiff
fix parse error in FormPreferences, make LyX be able to compile with gcc 2.97, use...
authorLars Gullik Bjønnes <larsbj@gullik.org>
Wed, 15 Nov 2000 03:22:08 +0000 (03:22 +0000)
committerLars Gullik Bjønnes <larsbj@gullik.org>
Wed, 15 Nov 2000 03:22:08 +0000 (03:22 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1218 a592a061-630c-0410-9148-cb99ea01b6c8

22 files changed:
ANNOUNCE
ChangeLog
Makefile.am
UPGRADING
configure.in
src/DepTable.C
src/LyXAction.C
src/Variables.C
src/buffer.C
src/bufferlist.C
src/filedlg.C
src/frontends/xforms/Dialogs.C
src/frontends/xforms/FormPreferences.C
src/frontends/xforms/FormPreferences.h
src/insets/insetgraphicsParams.C
src/mathed/formula.C
src/support/lstrings.C
src/support/lyxfunctional.h
src/support/tempname.C
src/tabular.C
src/tracer.C
src/tracer.h

index 56fc3240b37f1ed32ed0b5db0595b91a28f49ebf..260fb301c76002c16ea2adbc6b030ef0674cc17a 100644 (file)
--- a/ANNOUNCE
+++ b/ANNOUNCE
@@ -1,4 +1,4 @@
-Public release of LyX version 1.1.5cvs
+Public release of LyX version 1.1.6pre
 ===================================
 
 What is LyX?
@@ -67,8 +67,8 @@ with mirrors at
        
 The source code package is available at:
 
-        ftp://ftp.lyx.org/pub/lyx/stable/lyx-1.1.5.tar.gz
-       ftp://ftp.devel.lyx.org/pub/lyx/lyx-1.1.5.tar.gz
+        ftp://ftp.lyx.org/pub/lyx/stable/lyx-1.1.6.tar.gz
+       ftp://ftp.devel.lyx.org/pub/lyx/lyx-1.1.6.tar.gz
 
 and at the mirrors listed above.
 
index 04414eaea6949d39a12a086b8da1a37c035d29a9..85c617512e210a6fee1ac917b093c351cfc200dd 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,38 @@
+2000-11-15  Lars Gullik Bjønnes  <larsbj@lyx.org>
+
+       * src/support/lyxfunctional.h: make back_insert_fun_iterator(s)
+       match the requirements from the standard better. This is required
+       to work with gnu libstdc++-v3
+
+       * src/frontends/xforms/FormPreferences.C: add explict pair
+       arguments to browse calls. include support/lyxmanip.h remvoe
+       extern fmt. whitespace changes. reorder variables in
+       FormPreferences.h, to match initalizaton order.
+
+       * several files: constify more local variables.
+       
+       * src/buffer.C: remove some commented functions.
+
+       * src/DepTable.C (remove_files_with_extension): temporary
+       work around for gcc 2.97 
+       * src/filedlg.C (find): ditto
+       * src/Variables.C (set): ditto
+       * src/LyXAction.C (searchActionArg): ditto
+       (retrieveActionArg): ditto
+
+       * configure.in: check for mktemp too
+
+       * UPGRADING: prepare for 1.1.6
+
+       * Makefile.am (lgbtags): add backup tags for when etags are
+       different than usual.
+
+       * ANNOUNCE: prepare for 1.1.6
+
+       * src/support/tempname.C (make_tempfile): new function, wrapper
+       around mkstemp and mktemp. Only mkstemp has been tested.
+       (tempName): call it.
+       
 2000-11-14  Rob Lahaye  <lahaye@postech.edu>
        
        * default.ui: capitalized some menu items to improve shortcuts.
index a8269cf2616d14b475c5fe34bf9fef2437fe6864..2f016bb9c0453d04d83c1f06d04a6ed0d7e9808a 100644 (file)
@@ -54,3 +54,6 @@ sourcedoc:
        mkdir sourcedoc
        cd sourcedoc ; \
        doc++ -p `find ../$(top_srcdir)/src -name \*.h`
+
+lgbtags:
+       etags --totals=yes --recurse=yes -o TAGS $(top_srcdir)/*
index 033d975939adf384f1ab6068734b9a263e236ad3..6a393331f17829ef70820b6717f1b4afebfb8b6b 100644 (file)
--- a/UPGRADING
+++ b/UPGRADING
@@ -1,4 +1,4 @@
-How do I upgrade my existing LyX system to version 1.1.5?
+How do I upgrade my existing LyX system to version 1.1.6?
 ---------------------------------------------------------
 
 If you upgrade from version 0.12.0 or 1.0.x, you shouldn't have 
@@ -14,9 +14,9 @@ Document transfer
 -----------------
 
 In general, you don't need to convert any documents saved with LyX
-v0.10, v0.12.0 or v1.0.x to use them with LyX v1.1.5.
+v0.10, v0.12.0 or v1.0.x to use them with LyX v1.1.6.
 
-LyX v1.1.5 can read all documents saved with lyx-0.12.0 and later correctly.
+LyX v1.1.6 can read all documents saved with lyx-0.12.0 and later correctly.
 Documents saved with lyx-0.10.x are read correctly up to the old math 
 mode, which is not supported anymore. If you have documents with such 
 math formulas, you convert it using the program COLD, written by Preben 
@@ -27,5 +27,5 @@ Rhandol. COLD can be found at:
 
 or at one of LyX archive mirror sites listed in README.
 
-Documents saved with LyX version 1.1.5 can be read correctly by 
+Documents saved with LyX version 1.1.6 can be read correctly by 
 LyX v0.12.0 and v1.0.x, except for new and a couple of changed features.
index 5aeaf8a50ca5273d360234ec5af5d1857f050197..ab4610c12dbc397ef388fc0e605333243fefca38 100644 (file)
@@ -253,7 +253,7 @@ if test "x$lyx_broken_headers" = "xyes"; then
     [Define on SunOS 4 and SCO, were some functions are missing from the headers])
 fi
 AC_CHECK_FUNCS(memmove memset strchr putenv setenv mkfifo snprintf vsnprintf)
-AC_CHECK_FUNCS(mkstemp)
+AC_CHECK_FUNCS(mkstemp mktemp)
 
 dnl Until this is fixed in autoconf we provide our own version
 LYX_FUNC_SELECT_ARGTYPES
index e493d794aaab18d137bd5057ae5ef6efce5372cc..bd70a1971a381c3ea4234603f53f63fac0e615e0 100644 (file)
@@ -113,7 +113,8 @@ bool DepTable::exist(string const & fil) const
 void DepTable::remove_files_with_extension(string const & suf)
 {
        DepList tmp;
-       for (DepList::const_iterator cit = deplist.begin();
+       // we want const_iterator (Lgb)
+       for (DepList::iterator cit = deplist.begin();
             cit != deplist.end(); ++cit) {
                if (!suffixIs((*cit).first, suf))
                        tmp[(*cit).first] = (*cit).second;
index 83db2268812101477cc0227e7b7d60096215ea45..f5231c0b43bd65e62d3d78ba4ef1507bb6df2189 100644 (file)
@@ -453,7 +453,8 @@ LyXAction::LyXAction()
 // if it doesn't exist.
 int LyXAction::searchActionArg(kb_action action, string const & arg) const
 {
-       arg_map::const_iterator pit = lyx_arg_map.find(action);
+       // we really want to use const_iterator (Lgb)
+       arg_map::iterator pit = lyx_arg_map.find(action);
 
        if (pit == lyx_arg_map.end()) {
                // the action does not have any pseudoactions
@@ -462,8 +463,9 @@ int LyXAction::searchActionArg(kb_action action, string const & arg) const
                                      << endl;
                return LFUN_UNKNOWN_ACTION;
        }
-       
-       arg_item::const_iterator aci = (*pit).second.find(arg);
+
+       // we really want to use const_iterator (Lgb)
+       arg_item::iterator aci = (*pit).second.find(arg);
 
        if (aci == (*pit).second.end()) {
                // the action does not have any pseudoactions with this arg
@@ -518,8 +520,9 @@ int LyXAction::getPseudoAction(kb_action action, string const & arg) const
 kb_action LyXAction::retrieveActionArg(int pseudo, string & arg) const
 {
        arg.erase(); // clear it to be sure.
-       
-       pseudo_map::const_iterator pit = lyx_pseudo_map.find(pseudo);
+
+       // we really want to use const_iterator (Lgb)
+       pseudo_map::iterator pit = lyx_pseudo_map.find(pseudo);
 
        if (pit != lyx_pseudo_map.end()) {
                lyxerr[Debug::ACTION] << "Found the pseudoaction: ["
index c20ed86bdbae361590da1ec9f741c0f22e5f36ef..f2dc8ddc2fd6b9c4ed63fed4e0d6b1beb83fcecc 100644 (file)
 
 void Variables::set(string const & var, string const & val)
 {
-  Vars::const_iterator cit = vars_.find(var);
-  if (cit != vars_.end()) 
-    vars_.erase(var);
-  vars_[var] = val;;
+       // We want to use const_iterator (Lgb)
+       Vars::iterator cit = vars_.find(var);
+       if (cit != vars_.end()) 
+               vars_.erase(var);
+       vars_[var] = val;;
 }
 
 
index 869ab7d367bece7cc9a95b7e2a0a80637cbc3d30..95622846bb015a0e84f2cfc84917612b60b0ed0d 100644 (file)
@@ -1265,225 +1265,6 @@ bool Buffer::writeFile(string const & fname, bool flag) const
 }
 
 
-#if 0
-void Buffer::writeFileAscii(string const & fname, int linelen) 
-{
-       Inset * inset;
-       char c;
-       char footnoteflag = 0;
-       char depth = 0;
-       string tmp;
-       LyXParagraph::size_type i;
-       int j;
-       int ltype = 0;
-       int ltype_depth = 0;
-       int actcell = 0;
-       int actpos = 0;
-       int currlinelen = 0;
-       int fpos = 0;
-       bool ref_printed = false;
-
-       ofstream ofs(fname.c_str());
-       if (!ofs) {
-               WriteFSAlert(_("Error: Cannot write file:"), fname);
-               return;
-       }
-
-       string const fname1 = lyx::tempName(); //TmpFileName();
-       LyXParagraph * par = paragraph;
-       while (par) {
-               int noparbreak = 0;
-               int islatex = 0;
-               if (
-#ifndef NEW_INSETS
-                       par->footnoteflag != LyXParagraph::NO_FOOTNOTE ||
-#endif
-                   !par->previous
-#ifndef NEW_INSETS
-                   || par->previous->footnoteflag == LyXParagraph::NO_FOOTNOTE
-#endif
-                       ){
-
-#ifndef NEW_INSETS
-                       /* begins a footnote environment ? */ 
-                       if (footnoteflag != par->footnoteflag) {
-                               footnoteflag = par->footnoteflag;
-                               if (footnoteflag) {
-                                       j = strlen(string_footnotekinds[par->footnotekind])+4;
-                                       if (currlinelen + j > linelen)
-                                               ofs << "\n";
-                                       ofs << "(["
-                                           << string_footnotekinds[par->footnotekind] << "] ";
-                                       currlinelen += j;
-                               }
-                       }
-#endif
-        
-                       /* begins or ends a deeper area ?*/ 
-                       if (depth != par->depth) {
-                               if (par->depth > depth) {
-                                       while (par->depth > depth) {
-                                               ++depth;
-                                       }
-                               }
-                               else {
-                                       while (par->depth < depth) {
-                                               --depth;
-                                       }
-                               }
-                       }
-        
-                       /* First write the layout */
-                       tmp = textclasslist.NameOfLayout(params.textclass, par->layout);
-                       if (tmp == "Itemize") {
-                               ltype = 1;
-                               ltype_depth = depth+1;
-                       } else if (tmp == "Enumerate") {
-                               ltype = 2;
-                               ltype_depth = depth+1;
-                       } else if (contains(tmp, "ection")) {
-                               ltype = 3;
-                               ltype_depth = depth+1;
-                       } else if (contains(tmp, "aragraph")) {
-                               ltype = 4;
-                               ltype_depth = depth+1;
-                       } else if (tmp == "Description") {
-                               ltype = 5;
-                               ltype_depth = depth+1;
-                       } else if (tmp == "Abstract") {
-                               ltype = 6;
-                               ltype_depth = 0;
-                       } else if (tmp == "Bibliography") {
-                               ltype = 7;
-                               ltype_depth = 0;
-                       } else {
-                               ltype = 0;
-                               ltype_depth = 0;
-                       }
-        
-                       /* maybe some vertical spaces */ 
-
-                       /* the labelwidthstring used in lists */ 
-        
-                       /* some lines? */ 
-        
-                       /* some pagebreaks? */ 
-        
-                       /* noindent ? */ 
-        
-                       /* what about the alignment */ 
-               } else {
-#ifndef NEW_INSETS
-                       /* dummy layout, that means a footnote ended */ 
-                       footnoteflag = LyXParagraph::NO_FOOTNOTE;
-                       ofs << ") ";
-                       noparbreak = 1;
-#else
-                       lyxerr << "Should this ever happen?" << endl;
-#endif
-               }
-      
-               LyXFont font1 =
-                       LyXFont(LyXFont::ALL_INHERIT, params.language);
-                actcell = 0;
-               for (i = 0, actpos = 1; i < par->size(); ++i, ++actpos) {
-                       if (!i && !footnoteflag && !noparbreak){
-                               ofs << "\n\n";
-                               for (j = 0; j < depth; ++j)
-                                       ofs << "  ";
-                               currlinelen = depth * 2;
-                               switch (ltype) {
-                               case 0: /* Standard */
-                               case 4: /* (Sub)Paragraph */
-                                case 5: /* Description */
-                                       break;
-                               case 6: /* Abstract */
-                                       ofs << "Abstract\n\n";
-                                       break;
-                               case 7: /* Bibliography */
-                                       if (!ref_printed) {
-                                               ofs << "References\n\n";
-                                               ref_printed = true;
-                                       }
-                                       break;
-                               default:
-                                       ofs << par->labelstring << " ";
-                                       break;
-                               }
-                               if (ltype_depth > depth) {
-                                       for (j = ltype_depth - 1; j > depth; --j)
-                                               ofs << "  ";
-                                       currlinelen += (ltype_depth-depth)*2;
-                               }
-                       }
-                       LyXFont font2 = par->GetFontSettings(params, i);
-                       if (font1.latex() != font2.latex()) {
-                               if (font2.latex() == LyXFont::OFF)
-                                       islatex = 0;
-                               else
-                                       islatex = 1;
-                       } else {
-                               islatex = 0;
-                       }
-                       c = par->GetChar(i);
-                       if (islatex)
-                               continue;
-                       switch (c) {
-                       case LyXParagraph::META_INSET:
-                               if ((inset = par->GetInset(i))) {
-                                       fpos = ofs.tellp();
-                                       inset->Ascii(this, ofs);
-                                       currlinelen += (ofs.tellp() - fpos);
-                                       actpos += (ofs.tellp() - fpos) - 1;
-                               }
-                               break;
-                       case LyXParagraph::META_NEWLINE:
-                               ofs << "\n";
-                               for (j = 0; j < depth; ++j)
-                                       ofs << "  ";
-                               currlinelen = depth * 2;
-                               if (ltype_depth > depth) {
-                                       for (j = ltype_depth;
-                                           j > depth; --j)
-                                               ofs << "  ";
-                                       currlinelen += (ltype_depth - depth) * 2;
-                               }
-                               break;
-                       case LyXParagraph::META_HFILL: 
-                               ofs << "\t";
-                               break;
-                       case '\\':
-                               ofs << "\\";
-                               break;
-                       default:
-                               if (currlinelen > linelen - 10
-                                    && c == ' ' && i + 2 < par->size()) {
-                                       ofs << "\n";
-                                       for (j = 0; j < depth; ++j)
-                                               ofs << "  ";
-                                       currlinelen = depth * 2;
-                                       if (ltype_depth > depth) {
-                                               for (j = ltype_depth;
-                                                   j > depth; --j)
-                                                       ofs << "  ";
-                                               currlinelen += (ltype_depth-depth)*2;
-                                       }
-                               } else if (c != '\0')
-                                       ofs << c;
-                               else if (c == '\0')
-                                       lyxerr.debug() << "writeAsciiFile: NULL char in structure." << endl;
-                               ++currlinelen;
-                               break;
-                       }
-               }
-               par = par->next;
-       }
-   
-       ofs << "\n";
-}
-//----------------------------------------------------------------------------
-#else
-//----------------------------------------------------------------------------
 string const Buffer::asciiParagraph(LyXParagraph const * par,
                                    unsigned int linelen) const
 {
@@ -1722,7 +1503,7 @@ void Buffer::writeFileAscii(ostream & ofs, int linelen)
        }
        ofs << "\n";
 }
-#endif
+
 
 void Buffer::makeLaTeXFile(string const & fname, 
                           string const & original_path,
index bbb10a162bdc6bd55a139d9c2769ec0f52fd9364..3f4477636478f3fe8f20590692be00d5112c1ee7 100644 (file)
@@ -72,8 +72,8 @@ Buffer * BufferStorage::newBuffer(string const & s, bool ronly)
 {
        Buffer * tmpbuf = new Buffer(s, ronly);
        tmpbuf->params.useClassDefaults();
-       lyxerr.debug() << "Assigning to buffer "
-                      << container.size() << endl;
+       lyxerr[Debug::INFO] << "Assigning to buffer "
+                           << container.size() << endl;
        container.push_back(tmpbuf);
        return tmpbuf;
 }
@@ -107,7 +107,7 @@ bool BufferList::QwriteAll()
                        else
                                fname = MakeDisplayPath((*it)->fileName(), 50);
                        bool reask = true;
-                       while(reask) {
+                       while (reask) {
                                switch (AskConfirmation(_("Changes in document:"),
                                                       fname,
                                                       _("Save document?"))) {
index 7f86d018c2f77723d8f1687775342c824b598bd8..aa2293747d2637a609b6deec84868d293005bee6 100644 (file)
@@ -81,7 +81,8 @@ class UserCache {
 public:
        /// seeks user name from group ID
        string const & find(uid_t ID) const {
-               Users::const_iterator cit = users.find(ID);
+               // We really want to use const_iterator. (Lgb)
+               Users::iterator cit = users.find(ID);
                if (cit == users.end()) {
                        add(ID);
                        return users[ID];
@@ -97,6 +98,7 @@ private:
        mutable Users users;
 };
 
+
 void UserCache::add(uid_t ID) const 
 {
        string pszNewName;
@@ -128,15 +130,19 @@ private:
        mutable Groups groups;
 };
 
-       string const & GroupCache::find(gid_t ID) const 
-       {
-               Groups::const_iterator cit = groups.find(ID);
-               if (cit == groups.end()) {
-                       add(ID);
-                       return groups[ID];
-               }
-               return (*cit).second;
+
+string const & GroupCache::find(gid_t ID) const 
+{
+       // We really want to use const_iterator. (Lgb)
+       Groups::iterator cit = groups.find(ID);
+       if (cit == groups.end()) {
+               add(ID);
+               return groups[ID];
        }
+       return (*cit).second;
+}
+
+
 void GroupCache::add(gid_t ID) const 
 {
        string pszNewName;
@@ -150,11 +156,13 @@ void GroupCache::add(gid_t ID) const
        // adds new node
        groups[ID] = pszNewName;
 }
-       
+
+
 // static instances
 static UserCache lyxUserCache;
 static GroupCache lyxGroupCache;
 
+
 // some "C" wrappers around callbacks
 extern "C" void C_LyXFileDlg_FileDlgCB(FL_OBJECT *, long lArgument);
 extern "C" void C_LyXFileDlg_DoubleClickCB(FL_OBJECT *, long);
@@ -192,7 +200,7 @@ void LyXFileDlg::Reread()
        if (!pDirectory) {
                WriteFSAlert(_("Warning! Couldn't open directory."), 
                             pszDirectory);
-               pszDirectory = lyx::getcwd(); //GetCWD();
+               pszDirectory = lyx::getcwd();
                pDirectory = ::opendir(pszDirectory.c_str());
        }
 
@@ -331,7 +339,7 @@ void LyXFileDlg::Reread()
        // Add them to directory box
        for (DirEntries::const_iterator cit = direntries.begin();
             cit != direntries.end(); ++cit) {
-               string temp = line + (*cit).pszDisplayed;
+               string const temp = line + (*cit).pszDisplayed;
                fl_add_browser_line(pFileDlgForm->List, temp.c_str());
        }
        fl_set_browser_topline(pFileDlgForm->List, iDepth);
@@ -450,7 +458,6 @@ bool LyXFileDlg::RunDialog()
        
         // event loop
         while(true) {
-
                 FL_OBJECT * pObject = fl_do_forms();
 
                 if (pObject == pFileDlgForm->Ready) {
@@ -530,7 +537,7 @@ extern "C" void C_LyXFileDlg_FileDlgCB(FL_OBJECT * ob, long data)
 void LyXFileDlg::HandleListHit()
 {
        // set info line
-       int iSelect = fl_get_browser(pFileDlgForm->List);
+       int const iSelect = fl_get_browser(pFileDlgForm->List);
        if (iSelect > iDepth)  {
                SetInfoLine(direntries[iSelect - iDepth - 1].pszLsEntry);
        } else {
@@ -547,11 +554,13 @@ void LyXFileDlg::DoubleClickCB(FL_OBJECT *, long)
                pCurrentDlg->Force(false);
 }
 
+
 extern "C" void C_LyXFileDlg_DoubleClickCB(FL_OBJECT * ob, long data)
 {
        LyXFileDlg::DoubleClickCB(ob, data);
 }
 
+
 // Handle double click from list
 bool LyXFileDlg::HandleDoubleClick()
 {
@@ -559,7 +568,7 @@ bool LyXFileDlg::HandleDoubleClick()
 
        // set info line
        bool isDir = true;
-       int iSelect = fl_get_browser(pFileDlgForm->List);
+       int const iSelect = fl_get_browser(pFileDlgForm->List);
        if (iSelect > iDepth)  {
                pszTemp = direntries[iSelect - iDepth - 1].pszName;
                SetInfoLine(direntries[iSelect - iDepth - 1].pszLsEntry);
@@ -608,7 +617,7 @@ bool LyXFileDlg::HandleOK()
 {
        // mask was changed
        string pszTemp = fl_get_input(pFileDlgForm->PatBox);
-       if (pszTemp!= pszMask) {
+       if (pszTemp != pszMask) {
                SetMask(pszTemp);
                Reread();
                return false;
@@ -623,12 +632,13 @@ bool LyXFileDlg::HandleOK()
        }
        
        // Handle return from list
-       int select = fl_get_browser(pFileDlgForm->List);
+       int const select = fl_get_browser(pFileDlgForm->List);
        if (select > iDepth) {
-               string temp = direntries[select - iDepth - 1].pszName;
+               string const temp = direntries[select - iDepth - 1].pszName;
                if (!suffixIs(temp, '/')) {
                        // If user didn't type anything, use browser
-                       string name = fl_get_input(pFileDlgForm->Filename);
+                       string const name =
+                               fl_get_input(pFileDlgForm->Filename);
                        if (name.empty()) {
                                fl_set_input(pFileDlgForm->Filename, temp.c_str());
                        }
@@ -689,21 +699,22 @@ string const LyXFileDlg::Select(string const & title, string const & path,
 
        // highlight the suggested file in the browser, if it exists.
        int sel = 0;
-       string filename = OnlyFilename(suggested);
-       if( !filename.empty() ) {
-               for( int i = 0; 
-                    i < fl_get_browser_maxline(pFileDlgForm->List); ++i ) {
-                       string s = fl_get_browser_line(pFileDlgForm->List, i+1);
+       string const filename = OnlyFilename(suggested);
+       if (!filename.empty()) {
+               for (int i = 0; 
+                    i < fl_get_browser_maxline(pFileDlgForm->List); ++i) {
+                       string s =
+                               fl_get_browser_line(pFileDlgForm->List, i + 1);
                        s = strip(frontStrip(s));
-                       if( s == filename ) {
-                               sel = i+1;
+                       if (s == filename) {
+                               sel = i + 1;
                                break;
                        }
                }
        }
        
-       if( sel != 0 ) fl_select_browser_line(pFileDlgForm->List, sel);
-       int top = max(sel - 5, 1);
+       if (sel != 0) fl_select_browser_line(pFileDlgForm->List, sel);
+       int const top = max(sel - 5, 1);
        fl_set_browser_topline(pFileDlgForm->List, top);
 
        // checks whether dialog can be started
@@ -711,7 +722,7 @@ string const LyXFileDlg::Select(string const & title, string const & path,
        pCurrentDlg = this;
 
        // runs dialog
-       SetInfoLine (string());
+       SetInfoLine(string());
        fl_set_input(pFileDlgForm->Filename, suggested.c_str());
        fl_set_button(pFileDlgForm->Cancel, 0);
        fl_set_button(pFileDlgForm->Ready, 0);
index 38cb1374e7667aaa5f8f2a5f9ce520df254d87e0..aa300df61d7dc60758ef741e349c80b9c74d7f77 100644 (file)
@@ -26,7 +26,7 @@
 #include "FormTabularCreate.h"
 #include "FormToc.h"
 #include "FormUrl.h"
-#include "debug.h"
+//#include "debug.h"
 
 #ifdef __GNUG__
 #pragma implementation
@@ -73,7 +73,7 @@ Dialogs::~Dialogs()
        for (vector<DialogBase *>::iterator iter = dialogs_.begin();
             iter != dialogs_.end();
             ++iter) {
-               lyxerr << "delete *iter" << endl;
+               //lyxerr << "delete *iter" << endl;
                delete *iter;
        }
 }
index bd6f7fae0d529b575c728d6d1ee37cb15f1277ca..a30b43b608c1bf052f0f5e1769b50f5050799d94 100644 (file)
  * FormPreferences Interface Class Implementation
  */
 
-#include <utility>
 #include <config.h>
 
+#include <utility>
+
 #include FORMS_H_LOCATION
 
 #ifdef __GNUG_
@@ -42,6 +43,7 @@
 #include "xform_macros.h"
 #include "converter.h"
 #include "support/lyxfunctional.h"
+#include "support/lyxmanip.h"
 
 
 #ifdef SIGC_CXX_NAMESPACES
@@ -55,8 +57,8 @@ using std::pair;
 using std::max;
 using std::sort;
 using std::vector;
+using std::make_pair;
 
-extern string fmt(char const * fmtstr ...);
 extern string system_lyxdir;
 extern string user_lyxdir;
 extern Languages languages;
@@ -517,8 +519,10 @@ bool FormPreferences::Colors::input( FL_OBJECT const * const ob )
                return Database();
 
        } else if (ob == dialog_->button_browse) {
-               return parent_.browse( dialog_->input_name,
-                                     _("X11 color database"), "*.txt" );
+               return parent_.browse(dialog_->input_name,
+                                     _("X11 color database"), "*.txt",
+                                     make_pair(string(), string()),
+                                     make_pair(string(), string()));
 
        } else if (ob == dialog_->browser_lyx_objs) {
                return BrowserLyX();
@@ -1670,20 +1674,22 @@ bool FormPreferences::Language::input( FL_OBJECT const * const ob )
                }
        }
 
-       if( ob == dialog_->button_kbmap1_browse ) {
+       if (ob == dialog_->button_kbmap1_browse) {
                string dir  = system_lyxdir + string("kbd");
                string name = N_("Key maps");
-               pair<string,string> dir1(name, dir);
+               pair<string, string> dir1(name, dir);
 
-               parent_.browse( dialog_->input_kbmap1,
-                               _("Keyboard map"), "*.kmap", dir1 );
-       } else if( ob == dialog_->button_kbmap2_browse ) {
+               parent_.browse(dialog_->input_kbmap1,
+                               _("Keyboard map"), "*.kmap", dir1,
+                               pair<string, string>());
+       } else if (ob == dialog_->button_kbmap2_browse) {
                string dir  = system_lyxdir + string("kbd");
                string name = N_("Key maps");
-               pair<string,string> dir1(name, dir);
+               pair<string, string> dir1(name, dir);
 
-               parent_.browse( dialog_->input_kbmap2,
-                               _("Keyboard map"), "*.kmap", dir1 );
+               parent_.browse(dialog_->input_kbmap2,
+                               _("Keyboard map"), "*.kmap", dir1,
+                               pair<string, string>());
        }
 
        return activate;
@@ -1722,7 +1728,7 @@ void FormPreferences::Language::update()
 
        // Activate/Deactivate the input fields dependent on the state of the
        // buttons.
-       input( 0 );
+       input(0);
 }
 
 
@@ -1731,7 +1737,7 @@ void FormPreferences::Language::ComboCB(int, void * v, Combox * combox)
     FormPreferences * pre = static_cast<FormPreferences*>(v);
     // This is safe, as nothing is done to the pointer, other than
     // to use its address in a block-if statement.
-    pre->bc_.valid( pre->input( reinterpret_cast<FL_OBJECT *>(combox), 0 ));
+    pre->bc_.valid(pre->input( reinterpret_cast<FL_OBJECT *>(combox), 0));
 }
 
 
@@ -1767,14 +1773,14 @@ void FormPreferences::LnFmisc::build()
        fl_set_counter_return(dialog_->counter_wm_jump, FL_RETURN_CHANGED);
 
        // set up the feedback mechanism
-       parent_.setPreHandler( dialog_->check_banner );
-       parent_.setPreHandler( dialog_->check_auto_region_delete );
-       parent_.setPreHandler( dialog_->check_exit_confirm );
-       parent_.setPreHandler( dialog_->check_display_shrtcuts );
-       parent_.setPreHandler( dialog_->counter_autosave );
-       parent_.setPreHandler( dialog_->check_ask_new_file );
-       parent_.setPreHandler( dialog_->check_cursor_follows_scrollbar );
-       parent_.setPreHandler( dialog_->counter_wm_jump );
+       parent_.setPreHandler(dialog_->check_banner);
+       parent_.setPreHandler(dialog_->check_auto_region_delete);
+       parent_.setPreHandler(dialog_->check_exit_confirm);
+       parent_.setPreHandler(dialog_->check_display_shrtcuts);
+       parent_.setPreHandler(dialog_->counter_autosave);
+       parent_.setPreHandler(dialog_->check_ask_new_file);
+       parent_.setPreHandler(dialog_->check_cursor_follows_scrollbar);
+       parent_.setPreHandler(dialog_->counter_wm_jump);
 }
 
 
@@ -1783,22 +1789,22 @@ FormPreferences::LnFmisc::feedback(FL_OBJECT const * const ob) const
 {
        string str;
 
-       if (ob == dialog_->check_banner )
-               str = lyxrc.getDescription( LyXRC::RC_SHOW_BANNER );
-       else if (ob == dialog_->check_auto_region_delete )
-               str = lyxrc.getDescription( LyXRC::RC_AUTOREGIONDELETE );
-       else if (ob == dialog_->check_exit_confirm )
-               str = lyxrc.getDescription( LyXRC::RC_EXIT_CONFIRMATION );
-       else if (ob == dialog_->check_display_shrtcuts )
-               str = lyxrc.getDescription( LyXRC::RC_DISPLAY_SHORTCUTS );
-       else if (ob == dialog_->check_ask_new_file )
-               str = lyxrc.getDescription( LyXRC::RC_NEW_ASK_FILENAME );
-       else if (ob == dialog_->check_cursor_follows_scrollbar )
-               str = lyxrc.getDescription( LyXRC::RC_CURSOR_FOLLOWS_SCROLLBAR );
-       else if (ob == dialog_->counter_autosave )
-               str = lyxrc.getDescription( LyXRC::RC_AUTOSAVE );
-       else if (ob == dialog_->counter_wm_jump )
-               str = lyxrc.getDescription( LyXRC::RC_WHEEL_JUMP );
+       if (ob == dialog_->check_banner)
+               str = lyxrc.getDescription(LyXRC::RC_SHOW_BANNER);
+       else if (ob == dialog_->check_auto_region_delete)
+               str = lyxrc.getDescription(LyXRC::RC_AUTOREGIONDELETE);
+       else if (ob == dialog_->check_exit_confirm)
+               str = lyxrc.getDescription(LyXRC::RC_EXIT_CONFIRMATION);
+       else if (ob == dialog_->check_display_shrtcuts)
+               str = lyxrc.getDescription(LyXRC::RC_DISPLAY_SHORTCUTS);
+       else if (ob == dialog_->check_ask_new_file)
+               str = lyxrc.getDescription(LyXRC::RC_NEW_ASK_FILENAME);
+       else if (ob == dialog_->check_cursor_follows_scrollbar)
+               str = lyxrc.getDescription(LyXRC::RC_CURSOR_FOLLOWS_SCROLLBAR);
+       else if (ob == dialog_->counter_autosave)
+               str = lyxrc.getDescription(LyXRC::RC_AUTOSAVE);
+       else if (ob == dialog_->counter_wm_jump)
+               str = lyxrc.getDescription(LyXRC::RC_WHEEL_JUMP);
 
        return str;
 }
@@ -1831,7 +1837,7 @@ void FormPreferences::OutputsMisc::apply() const
                (fl_get_counter_value(dialog_->counter_line_len));
        lyxrc.fontenc = fl_get_input(dialog_->input_tex_encoding);
 
-       int choice =
+       int const choice =
                fl_get_choice(dialog_->choice_default_papersize) - 1;
        lyxrc.default_papersize = static_cast<BufferParams::PAPER_SIZE>(choice);
 
@@ -1869,16 +1875,16 @@ FormPreferences::OutputsMisc::feedback(FL_OBJECT const * const ob) const
 {
        string str;
 
-       if (ob == dialog_->counter_line_len )
-               str = lyxrc.getDescription( LyXRC::RC_ASCII_LINELEN );
-       else if (ob == dialog_->input_tex_encoding )
-               str = lyxrc.getDescription( LyXRC::RC_FONT_ENCODING );
-       else if (ob == dialog_->input_ascii_roff )
-               str = lyxrc.getDescription( LyXRC::RC_ASCIIROFF_COMMAND );
-       else if (ob == dialog_->input_checktex )
-               str = lyxrc.getDescription( LyXRC::RC_CHKTEX_COMMAND );
-       else if (ob == dialog_->choice_default_papersize )
-               str = lyxrc.getDescription( LyXRC::RC_DEFAULT_PAPERSIZE );
+       if (ob == dialog_->counter_line_len)
+               str = lyxrc.getDescription(LyXRC::RC_ASCII_LINELEN);
+       else if (ob == dialog_->input_tex_encoding)
+               str = lyxrc.getDescription(LyXRC::RC_FONT_ENCODING);
+       else if (ob == dialog_->input_ascii_roff)
+               str = lyxrc.getDescription(LyXRC::RC_ASCIIROFF_COMMAND);
+       else if (ob == dialog_->input_checktex)
+               str = lyxrc.getDescription(LyXRC::RC_CHKTEX_COMMAND);
+       else if (ob == dialog_->choice_default_papersize)
+               str = lyxrc.getDescription(LyXRC::RC_DEFAULT_PAPERSIZE);
 
        return str;
 }
@@ -1953,36 +1959,36 @@ void FormPreferences::Paths::build()
        fl_set_input_return(dialog_->input_serverpipe, FL_RETURN_CHANGED);
 
        // set up the feedback mechanism
-       parent_.setPreHandler( dialog_->input_default_path );
-       parent_.setPreHandler( dialog_->counter_lastfiles );
-       parent_.setPreHandler( dialog_->input_template_path );
-       parent_.setPreHandler( dialog_->check_last_files );
-       parent_.setPreHandler( dialog_->input_lastfiles );
-       parent_.setPreHandler( dialog_->check_make_backups );
-       parent_.setPreHandler( dialog_->input_backup_path );
-       parent_.setPreHandler( dialog_->input_serverpipe );
-       parent_.setPreHandler( dialog_->input_temp_dir );
-       parent_.setPreHandler( dialog_->check_use_temp_dir );
+       parent_.setPreHandler(dialog_->input_default_path);
+       parent_.setPreHandler(dialog_->counter_lastfiles);
+       parent_.setPreHandler(dialog_->input_template_path);
+       parent_.setPreHandler(dialog_->check_last_files);
+       parent_.setPreHandler(dialog_->input_lastfiles);
+       parent_.setPreHandler(dialog_->check_make_backups);
+       parent_.setPreHandler(dialog_->input_backup_path);
+       parent_.setPreHandler(dialog_->input_serverpipe);
+       parent_.setPreHandler(dialog_->input_temp_dir);
+       parent_.setPreHandler(dialog_->check_use_temp_dir);
 }
 
 
 string const
-FormPreferences::Paths::feedback( FL_OBJECT const * const ob ) const
+FormPreferences::Paths::feedback(FL_OBJECT const * const ob) const
 {
        string str;
 
-       if (ob == dialog_->input_default_path )
-               str = lyxrc.getDescription( LyXRC::RC_DOCUMENTPATH );
-       else if (ob == dialog_->input_template_path )
-               str = lyxrc.getDescription( LyXRC::RC_TEMPLATEPATH );
+       if (ob == dialog_->input_default_path)
+               str = lyxrc.getDescription(LyXRC::RC_DOCUMENTPATH);
+       else if (ob == dialog_->input_template_path)
+               str = lyxrc.getDescription(LyXRC::RC_TEMPLATEPATH);
        else if (ob == dialog_->check_use_temp_dir )
-               str = lyxrc.getDescription( LyXRC::RC_USETEMPDIR );
-       else if (ob == dialog_->input_temp_dir )
-               str = lyxrc.getDescription( LyXRC::RC_TEMPDIRPATH );
-       else if (ob == dialog_->check_last_files )
-               str = lyxrc.getDescription( LyXRC::RC_CHECKLASTFILES );
-       else if (ob == dialog_->input_lastfiles )
-               str = lyxrc.getDescription( LyXRC::RC_LASTFILES );
+               str = lyxrc.getDescription(LyXRC::RC_USETEMPDIR);
+       else if (ob == dialog_->input_temp_dir)
+               str = lyxrc.getDescription(LyXRC::RC_TEMPDIRPATH);
+       else if (ob == dialog_->check_last_files)
+               str = lyxrc.getDescription(LyXRC::RC_CHECKLASTFILES);
+       else if (ob == dialog_->input_lastfiles)
+               str = lyxrc.getDescription(LyXRC::RC_LASTFILES);
        else if (ob == dialog_->counter_lastfiles )
                str = lyxrc.getDescription( LyXRC::RC_NUMLASTFILES );
        else if (ob == dialog_->check_make_backups )
@@ -1996,7 +2002,7 @@ FormPreferences::Paths::feedback( FL_OBJECT const * const ob ) const
 }
 
 
-bool FormPreferences::Paths::input( FL_OBJECT const * const ob )
+bool FormPreferences::Paths::input(FL_OBJECT const * const ob)
 {
        bool activate = true;
        
@@ -2085,24 +2091,33 @@ bool FormPreferences::Paths::input( FL_OBJECT const * const ob )
                }
        }
 
-       if( ob == dialog_->button_default_path_browse ) {
-               parent_.browse( dialog_->input_default_path,
-                               _("Default path"), string() );
-       } else if( ob == dialog_->button_template_path_browse ) {
-               parent_.browse( dialog_->input_template_path,
-                               _("Template path"), string() );
-       } else if( ob == dialog_->button_temp_dir_browse ) {
-               parent_.browse( dialog_->input_temp_dir,
-                               _("Temp dir"), string() );
-       } else if( ob == dialog_->button_lastfiles_browse ) {
-               pair<string,string> dir(_("User"), user_lyxdir);
-
-               parent_.browse( dialog_->input_lastfiles,
-                               _("Lastfiles"), string(), dir );
-       } else if( ob == dialog_->button_backup_path_browse ) {
+       if (ob == dialog_->button_default_path_browse) {
+               parent_.browse(dialog_->input_default_path,
+                               _("Default path"), string(),
+                               pair<string, string>(),
+                               pair<string, string>());
+       } else if (ob == dialog_->button_template_path_browse) {
+               parent_.browse(dialog_->input_template_path,
+                               _("Template path"), string(),
+                               pair<string, string>(),
+                               pair<string, string>());
+       } else if (ob == dialog_->button_temp_dir_browse) {
+               parent_.browse(dialog_->input_temp_dir,
+                              _("Temp dir"), string(),
+                              pair<string, string>(),
+                              pair<string, string>());
+       } else if (ob == dialog_->button_lastfiles_browse) {
+               pair<string, string> dir(_("User"), user_lyxdir);
+
+               parent_.browse(dialog_->input_lastfiles,
+                               _("Lastfiles"), string(), dir,
+                               pair<string, string>());
+       } else if (ob == dialog_->button_backup_path_browse) {
                parent_.browse( dialog_->input_backup_path,
-                               _("Backup path"), string() );
-       } else if( ob == dialog_->button_serverpipe_browse ) {
+                               _("Backup path"), string(),
+                               pair<string, string>(),
+                               pair<string, string>());
+       } else if (ob == dialog_->button_serverpipe_browse) {
                // Not sure how to do this!!!
        }
        
@@ -2480,23 +2495,23 @@ void FormPreferences::ScreenFonts::build()
                            fl_unsigned_int_filter);
 
        // set up the feedback mechanism
-       parent_.setPreHandler( dialog_->input_roman );
-       parent_.setPreHandler( dialog_->input_sans );
-       parent_.setPreHandler( dialog_->input_typewriter );
-       parent_.setPreHandler( dialog_->counter_zoom );
-       parent_.setPreHandler( dialog_->counter_dpi );
-       parent_.setPreHandler( dialog_->check_scalable );
-       parent_.setPreHandler( dialog_->input_screen_encoding );
-       parent_.setPreHandler( dialog_->input_tiny );
-       parent_.setPreHandler( dialog_->input_script );
-       parent_.setPreHandler( dialog_->input_footnote );
-       parent_.setPreHandler( dialog_->input_small );
-       parent_.setPreHandler( dialog_->input_large );
-       parent_.setPreHandler( dialog_->input_larger );
-       parent_.setPreHandler( dialog_->input_largest );
-       parent_.setPreHandler( dialog_->input_normal );
-       parent_.setPreHandler( dialog_->input_huge );
-       parent_.setPreHandler( dialog_->input_huger );
+       parent_.setPreHandler(dialog_->input_roman);
+       parent_.setPreHandler(dialog_->input_sans);
+       parent_.setPreHandler(dialog_->input_typewriter);
+       parent_.setPreHandler(dialog_->counter_zoom);
+       parent_.setPreHandler(dialog_->counter_dpi);
+       parent_.setPreHandler(dialog_->check_scalable);
+       parent_.setPreHandler(dialog_->input_screen_encoding);
+       parent_.setPreHandler(dialog_->input_tiny);
+       parent_.setPreHandler(dialog_->input_script);
+       parent_.setPreHandler(dialog_->input_footnote);
+       parent_.setPreHandler(dialog_->input_small);
+       parent_.setPreHandler(dialog_->input_large);
+       parent_.setPreHandler(dialog_->input_larger);
+       parent_.setPreHandler(dialog_->input_largest);
+       parent_.setPreHandler(dialog_->input_normal);
+       parent_.setPreHandler(dialog_->input_huge);
+       parent_.setPreHandler(dialog_->input_huger);
 }
 
        
@@ -2581,7 +2596,7 @@ bool FormPreferences::ScreenFonts::input()
        }
 
        if (!activate)
-               parent_.printWarning( str );
+               parent_.printWarning(str);
        
        return activate;
 }
@@ -2634,7 +2649,7 @@ void FormPreferences::SpellChecker::apply()
 {
 
        string choice = fl_get_choice_text(dialog_->choice_spell_command);
-       choice = strip( frontStrip( choice ) );
+       choice = strip(frontStrip(choice));
        
        lyxrc.isp_command = choice;
 
@@ -2702,16 +2717,16 @@ void FormPreferences::SpellChecker::build()
                            FL_RETURN_CHANGED);
 
        // set up the feedback mechanism
-       parent_.setPreHandler( dialog_->choice_spell_command );
-       parent_.setPreHandler( dialog_->check_alt_lang );
-       parent_.setPreHandler( dialog_->input_alt_lang );
-       parent_.setPreHandler( dialog_->check_escape_chars );
-       parent_.setPreHandler( dialog_->input_escape_chars );
-       parent_.setPreHandler( dialog_->check_personal_dict );
-       parent_.setPreHandler( dialog_->input_personal_dict );
-       parent_.setPreHandler( dialog_->button_personal_dict );
-       parent_.setPreHandler( dialog_->check_compound_words );
-       parent_.setPreHandler( dialog_->check_input_enc );
+       parent_.setPreHandler(dialog_->choice_spell_command);
+       parent_.setPreHandler(dialog_->check_alt_lang);
+       parent_.setPreHandler(dialog_->input_alt_lang);
+       parent_.setPreHandler(dialog_->check_escape_chars);
+       parent_.setPreHandler(dialog_->input_escape_chars);
+       parent_.setPreHandler(dialog_->check_personal_dict);
+       parent_.setPreHandler(dialog_->input_personal_dict);
+       parent_.setPreHandler(dialog_->button_personal_dict);
+       parent_.setPreHandler(dialog_->check_compound_words);
+       parent_.setPreHandler(dialog_->check_input_enc);
 }
 
 
@@ -2720,24 +2735,24 @@ FormPreferences::SpellChecker::feedback(FL_OBJECT const * const ob) const
 {
        string str;
 
-       if (ob == dialog_->choice_spell_command )
-               str = lyxrc.getDescription( LyXRC::RC_SPELL_COMMAND );
-       else if (ob == dialog_->check_alt_lang )
-               str = lyxrc.getDescription( LyXRC::RC_USE_ALT_LANG );
-       else if (ob == dialog_->input_alt_lang )
-               str = lyxrc.getDescription( LyXRC::RC_ALT_LANG );
-       else if (ob == dialog_->check_escape_chars )
-               str = lyxrc.getDescription( LyXRC::RC_USE_ESC_CHARS );
-       else if (ob == dialog_->input_escape_chars )
-               str = lyxrc.getDescription( LyXRC::RC_ESC_CHARS );
+       if (ob == dialog_->choice_spell_command)
+               str = lyxrc.getDescription(LyXRC::RC_SPELL_COMMAND);
+       else if (ob == dialog_->check_alt_lang)
+               str = lyxrc.getDescription(LyXRC::RC_USE_ALT_LANG);
+       else if (ob == dialog_->input_alt_lang)
+               str = lyxrc.getDescription(LyXRC::RC_ALT_LANG);
+       else if (ob == dialog_->check_escape_chars)
+               str = lyxrc.getDescription(LyXRC::RC_USE_ESC_CHARS);
+       else if (ob == dialog_->input_escape_chars)
+               str = lyxrc.getDescription(LyXRC::RC_ESC_CHARS);
        else if (ob == dialog_->check_personal_dict )
-               str = lyxrc.getDescription( LyXRC::RC_USE_PERS_DICT );
-       else if (ob == dialog_->input_personal_dict )
-               str = lyxrc.getDescription( LyXRC::RC_PERS_DICT );
+               str = lyxrc.getDescription(LyXRC::RC_USE_PERS_DICT);
+       else if (ob == dialog_->input_personal_dict)
+               str = lyxrc.getDescription(LyXRC::RC_PERS_DICT);
        else if (ob == dialog_->check_compound_words )
-               str = lyxrc.getDescription( LyXRC::RC_ACCEPT_COMPOUND );
-       else if (ob == dialog_->check_input_enc )
-               str = lyxrc.getDescription( LyXRC::RC_USE_INP_ENC );
+               str = lyxrc.getDescription(LyXRC::RC_ACCEPT_COMPOUND);
+       else if (ob == dialog_->check_input_enc)
+               str = lyxrc.getDescription(LyXRC::RC_USE_INP_ENC);
 
        return str;
 }
@@ -2807,8 +2822,10 @@ bool FormPreferences::SpellChecker::input( FL_OBJECT const * const ob )
        }
 
        if( ob == dialog_->button_personal_dict) {
-               parent_.browse( dialog_->input_personal_dict,
-                               _("Personal dictionary"), "*.ispell" );
+               parent_.browse(dialog_->input_personal_dict,
+                              _("Personal dictionary"), "*.ispell",
+                              pair<string, string>(),
+                              pair<string, string>());
        }
        
        return true; // All input is valid!
@@ -2858,7 +2875,7 @@ void FormPreferences::SpellChecker::update()
 }
 
 
-bool FormPreferences::WriteableDir( string const & name )
+bool FormPreferences::WriteableDir(string const & name)
 {
        bool success = true;
        string str;
@@ -2880,13 +2897,13 @@ bool FormPreferences::WriteableDir( string const & name )
        }
 
        if (!success)
-               printWarning( str );
+               printWarning(str);
        
        return success;
 }
 
 
-bool FormPreferences::ReadableDir( string const & name )
+bool FormPreferences::ReadableDir(string const & name)
 {
        bool success = true;
        string str;
@@ -2936,25 +2953,11 @@ bool FormPreferences::WriteableFile(string const & name,
                str = N_("WARNING! The absolute path is required.");
        }
 
-#if 0
-       // This is not a nice way to use FileInfo (Lgb)
-       FileInfo d;
-       
-       {
-               FileInfo d1(dir);
-               FileInfo d2(name);
-               if (d2.isDir() )
-                       d = d2;
-               else
-                       d = d1;
-       }
-#else
-       // This should be equivalent (Lgb)
        FileInfo d(name);
        if (!d.isDir()) {
                d.newFile(dir);
        }
-#endif
+
        if (success && !d.isDir()) {
                success = false;
                str = N_("WARNING! Directory does not exist.");
@@ -2965,7 +2968,7 @@ bool FormPreferences::WriteableFile(string const & name,
                str = N_("WARNING! Cannot write to this directory.");
        }
 
-       FileInfo f(name+suffix);
+       FileInfo f(name + suffix);
        if (success && (dir == name || f.isDir())) {
                success = false;
                str = N_("WARNING! A file is required, not a directory.");
@@ -3015,7 +3018,7 @@ bool FormPreferences::ReadableFile(string const & name,
                str = N_("WARNING! Cannot read from this directory.");
        }
 
-       FileInfo f(name+suffix);
+       FileInfo f(name + suffix);
        if (success && (dir == name || f.isDir())) {
                success = false;
                str = N_("WARNING! A file is required, not a directory.");
@@ -3038,35 +3041,35 @@ bool FormPreferences::ReadableFile(string const & name,
 }
 
 
-void FormPreferences::printWarning( string const & warning )
+void FormPreferences::printWarning(string const & warning)
 {
        warningPosted = true;
 
-       string str = formatted( warning, dialog_->text_warning->w-10,
-                               FL_SMALL_SIZE, FL_NORMAL_STYLE );
+       string const str = formatted(warning, dialog_->text_warning->w - 10,
+                                    FL_SMALL_SIZE, FL_NORMAL_STYLE);
 
        fl_set_object_label(dialog_->text_warning, str.c_str());
        fl_set_object_lsize(dialog_->text_warning, FL_SMALL_SIZE);
 }
 
 
-bool FormPreferences::browse( FL_OBJECT * inpt,
-                             string const & title,
-                             string const & pattern, 
-                             pair<string,string> const & dir1,
-                             pair<string,string> const & dir2 )
+bool FormPreferences::browse(FL_OBJECT * inpt,
+                            string const & title,
+                            string const & pattern, 
+                            pair<string,string> const & dir1,
+                            pair<string,string> const & dir2)
 {
        // Get the filename from the dialog
        string const filename = fl_get_input(inpt);
 
        // Show the file browser dialog
        string const new_filename =
-               browseFile(filename, title, pattern, dir1, dir2 );
+               browseFile(filename, title, pattern, dir1, dir2);
 
        // Save the filename to the dialog
-       if (new_filename != filename && ! new_filename.empty()) {
+       if (new_filename != filename && !new_filename.empty()) {
                fl_set_input(inpt, new_filename.c_str());
-               input( inpt, 0 );
+               input(inpt, 0);
        }
        
        return true;
@@ -3074,35 +3077,35 @@ bool FormPreferences::browse( FL_OBJECT * inpt,
 
 
 string const
-FormPreferences::browseFile( string const & filename,
-                            string const & title,
-                            string const & pattern, 
-                            pair<string,string> const & dir1,
-                            pair<string,string> const & dir2 ) const
+FormPreferences::browseFile(string const & filename,
+                           string const & title,
+                           string const & pattern, 
+                           pair<string,string> const & dir1,
+                           pair<string,string> const & dir2) const
 {
        string lastPath = ".";
-       if( !filename.empty() ) lastPath = OnlyPath(filename);
+       if (!filename.empty()) lastPath = OnlyPath(filename);
 
        LyXFileDlg fileDlg;
 
-       if( !dir1.second.empty() ) {
-               FileInfo fileInfo( dir1.second );
-               if( fileInfo.isOK() && fileInfo.isDir() )
-                       fileDlg.SetButton( 0, dir1.first, dir1.second );
+       if (!dir1.second.empty()) {
+               FileInfo fileInfo(dir1.second);
+               if (fileInfo.isOK() && fileInfo.isDir())
+                       fileDlg.SetButton(0, dir1.first, dir1.second);
        }
 
-       if( !dir2.second.empty() ) {
-               FileInfo fileInfo( dir2.second );
-               if( fileInfo.isOK() && fileInfo.isDir() )
-                   fileDlg.SetButton( 1, dir2.first, dir2.second );
+       if (!dir2.second.empty()) {
+               FileInfo fileInfo(dir2.second);
+               if (fileInfo.isOK() && fileInfo.isDir())
+                   fileDlg.SetButton(1, dir2.first, dir2.second);
        }
 
        bool error = false;
        string buf;
        do {
-               string p = fileDlg.Select(title,
+               string const p = fileDlg.Select(title,
                                          lastPath,
-                                         pattern, filename );
+                                         pattern, filename);
 
                if (p.empty()) return p;
 
@@ -3136,7 +3139,7 @@ int FormPreferences::FeedbackCB(FL_OBJECT * ob, int event,
        // Don't Assert this one, as it can happen quite reasonably when things
        // are being deleted in the d-tor.
        //Assert(ob->form);
-       if( !ob->form ) return 0;
+       if (!ob->form) return 0;
 
        FormPreferences * pre =
                static_cast<FormPreferences*>(ob->form->u_vdata);
@@ -3150,15 +3153,15 @@ void FormPreferences::Feedback(FL_OBJECT * ob, int event)
 {
        Assert(ob);
 
-       switch( event ) {
+       switch (event) {
        case FL_ENTER:
                warningPosted = false;
-               feedback( ob );
+               feedback(ob);
                break;
 
        case FL_LEAVE:
-               if( !warningPosted )
-                       fl_set_object_label( dialog_->text_warning, "" );
+               if (!warningPosted)
+                       fl_set_object_label(dialog_->text_warning, "");
                break;
 
        default:
@@ -3170,5 +3173,6 @@ void FormPreferences::Feedback(FL_OBJECT * ob, int event)
 void FormPreferences::setPreHandler(FL_OBJECT * ob) const
 {
        Assert(ob);
-       fl_set_object_prehandler( ob, C_FormPreferencesFeedbackCB );
+       fl_set_object_prehandler(ob, C_FormPreferencesFeedbackCB);
 }
+
index 81b202f30f678d9d3ad51e40896d831cb5628aef..dee26afaf2cf9386520b3ad24816432f1475f090 100644 (file)
@@ -21,6 +21,7 @@
 
 #include "FormBase.h"
 #include "Color.h"
+#include "LString.h"
 
 #ifdef __GNUG_
 #pragma interface
@@ -104,22 +105,20 @@ private:
         */
        
        ///
-       bool browse( FL_OBJECT * input,
-                    string const & title, string const & pattern, 
-                    std::pair<string,string> const & dir1 =
-                       std::pair<string,string>(),
-                    std::pair<string,string> const & dir2 =
-                       std::pair<string,string>() );
+       bool browse(FL_OBJECT * input,
+                   string const & title, string const & pattern, 
+                   std::pair<string,string> const & dir1 //=
+                   //std::pair<string,string>()
+                   ,
+                   std::pair<string,string> const & dir2 //=
+                   //std::pair<string,string>()
+               );
        /// called from browse()
        string const browseFile( string const & filename,
                                 string const & title, string const & pattern, 
                                 std::pair<string,string> const & dir1,
                                 std::pair<string,string> const & dir2 ) const;
 
-       /** Flag whether a warning has been posted to the text window.
-           If so, don't redraw the window when the mouse leaves an object. */
-       bool warningPosted;
-       
        /// Type definitions from the fdesign produced header file.
        FD_form_preferences * build_preferences();
        ///
@@ -151,17 +150,21 @@ private:
 
        /// Real GUI implementation.
        FD_form_preferences * dialog_;
+       /// Converters tabfolder
+       FD_form_outer_tab * converters_tab_;
        /// reLyX and other import/input stuff
        FD_form_outer_tab * inputs_tab_;
        /// HCI configuration
        FD_form_outer_tab * look_n_feel_tab_;
-       /// Converters tabfolder
-       FD_form_outer_tab * converters_tab_;
        /// Outputs tabfolder
        FD_form_outer_tab * outputs_tab_;
        /// Spellchecker, language stuff, etc
        FD_form_outer_tab * usage_tab_;
 
+       /** Flag whether a warning has been posted to the text window.
+           If so, don't redraw the window when the mouse leaves an object. */
+       bool warningPosted;
+       
        /** Each tab folder is encapsulated in its own class.
         */
 
@@ -571,10 +574,10 @@ private:
        ///
        Converters converters_;
        ///
-       Formats formats_;
-       ///
        InputsMisc inputs_misc_;
        ///
+       Formats formats_;
+       ///
        Interface interface_;
        ///
        Language language_;
index 8ac312521afeb2d3c5b36480955f44a27b7c78e7..c9a14418fd57678548f3b453d286aeacd2adc5bd 100644 (file)
@@ -339,7 +339,9 @@ void InsetGraphicsParams::Write(Buffer const * buf, ostream & os) const
                os << " rotateAngle " << rotateAngle << endl;
 }
 
-static void readResize(InsetGraphicsParams * igp, bool height,
+
+static
+void readResize(InsetGraphicsParams * igp, bool height,
                        string const & token)
 {
        InsetGraphicsParams::Resize resize = InsetGraphicsParams::DEFAULT_SIZE;
@@ -369,7 +371,9 @@ static void readResize(InsetGraphicsParams * igp, bool height,
                igp->widthResize = resize;
 }
 
-static void readOrigin(InsetGraphicsParams * igp, string const & token)
+
+static
+void readOrigin(InsetGraphicsParams * igp, string const & token)
 { // TODO: complete this function.
        igp->rotateOrigin = originTranslator.find(token);
 }
index 674de866f1a85a54f128c735c3298888252b4cad..1c7c4f9a82fd7969d5ff110d72c841f301b3222f 100644 (file)
@@ -54,7 +54,6 @@ using std::isdigit;
 using std::isalpha;
 #endif
 
-//extern char * mathed_label;
 extern string mathed_label;
 
 extern char const * latex_special_chars;
index 5592d825b38b7e6f557bc9d0543ca1c7becc3517..77ca7f0662fc4638d5114458144d4f6ffa9ef848 100644 (file)
@@ -175,7 +175,7 @@ string const lowercase(string const & a)
        }
 #else
        // We want to use this one. (Lgb)
-       transform(tmp.begin(), tmp.end(), tmp.begin(), tolower);
+       transform(tmp.begin(), tmp.end(), tmp.begin(), lowercase);
 #endif
        return tmp;
 }
@@ -193,7 +193,7 @@ string const uppercase(string const & a)
        }
 #else
        // We want to use this one. (Lgb)
-       transform(tmp.begin(), tmp.end(), tmp.begin(), toupper);
+       transform(tmp.begin(), tmp.end(), tmp.begin(), uppercase);
 #endif
        return tmp;
 }
index 262ca4e007120b44c8503635641e01e8e978671b..50d7ed22432d9fb0a6f806f3e9d513786c168847 100644 (file)
@@ -3,6 +3,8 @@
 #ifndef LYX_FUNCTIONAL_H
 #define LYX_FUNCTIONAL_H
 
+#include <iterator>
+
 //namespace lyx {
 
 template<class R, class C, class A>
@@ -50,21 +52,28 @@ class_fun(C & c, void(C::*f)(A))
 template <class Cont, class Type, class MemRet>
 class back_insert_fun_iterator {
 protected:
-       Cont & container;
+       Cont * container;
        MemRet(Type::*pmf)();
 public:
+       typedef Cont container_type;
+       typedef std::output_iterator_tag iterator_category;
+       typedef void value_type;
+       typedef void difference_type;
+       typedef void pointer;
+       typedef void reference;
+       
        back_insert_fun_iterator(Cont & x, MemRet(Type::*p)())
-               : container(x), pmf(p) {}
+               : container(&x), pmf(p) {}
 
        back_insert_fun_iterator &
        operator=(Type * val) {
-               container.push_back((val->*pmf)());
+               container->push_back((val->*pmf)());
                return *this;
        }
 
        back_insert_fun_iterator &
        operator=(Type & val) {
-               container.push_back((val.*pmf)());
+               container->push_back((val.*pmf)());
                return *this;
        }
 
@@ -83,21 +92,30 @@ public:
 template <class Cont, class Type, class MemRet>
 class const_back_insert_fun_iterator {
 protected:
-       Cont & container;
+       Cont * container;
        MemRet(Type::*pmf)() const;
 public:
+       typedef Cont container_type;
+       typedef std::output_iterator_tag iterator_category;
+       typedef void value_type;
+       typedef void difference_type;
+       typedef void pointer;
+       typedef void reference;
+       
        const_back_insert_fun_iterator(Cont & x, MemRet(Type::*p)() const)
-               : container(x), pmf(p) {}
-
+               : container(&x), pmf(p) {}
+       
+       ~const_back_insert_fun_iterator() {}
+      
        const_back_insert_fun_iterator &
        operator=(Type const * val) {
-               container.push_back((val->*pmf)());
+               container->push_back((val->*pmf)());
                return *this;
        }
 
        const_back_insert_fun_iterator &
        operator=(Type const & val) {
-               container.push_back((val.*pmf)());
+               container->push_back((val.*pmf)());
                return *this;
        }
 
index 8139a32b6364f4bcba14f1844e071acfd245043f..72316279418e6669e82a711e91c9f0acaf077570 100644 (file)
@@ -12,6 +12,22 @@ using std::endl;
 
 extern string system_tempdir;
 
+static inline
+int make_tempfile(char * templ) 
+{
+#ifdef HAVE_MKSTEMP
+       return ::mkstemp(templ);
+#else
+#ifdef HAVE_MKTEMP
+       // This probably just barely works...
+       ::mktemp(templ);
+       return ::open(templ, O_CREAT | O_EXCL, S_IRUSR | S_IWUSR);
+#else
+#warning FIX FIX FIX
+#endif
+#endif
+}
+       
 string const lyx::tempName(string const & dir, string const & mask)
 {
        string const tmpdir(dir.empty() ? system_tempdir : dir);
@@ -24,7 +40,7 @@ string const lyx::tempName(string const & dir, string const & mask)
        tmpfl.copy(tmpl, string::npos);
        tmpl[tmpfl.length()] = '\0'; // terminator
        
-       int const tmpf = ::mkstemp(tmpl);
+       int const tmpf = make_tempfile(tmpl);
        if (tmpf != -1) {
                string const t(tmpl);
                ::close(tmpf);
index 9e64f3a33e07cbb383f4e6a4022a8ab41abcb773..cc6744465c7b5e9472280d363243939d1ba1bed1 100644 (file)
@@ -342,6 +342,8 @@ void LyXTabular::set_row_column_number_info(bool oldformat)
     }
 #else
     // Isn't this the same as the while above? (Lgb)
+#warning Please check this Jürgen.
+    // if ok please delete the #if 0 section above. (Lgb)
     for (int row = 0, column = 0, c = 0;
         c < numberofcells && row < rows_ && column < columns_;) {
        rowofcell[c] = row;
@@ -2364,12 +2366,7 @@ static
 inline
 void print_n_chars(ostream & os, unsigned char ch, int n)
 {
-#if 0
-       for (int i = 0; i < n; ++i)
-               os << ch;
-#else
        os << string(n, ch);
-#endif
 }
 
 
@@ -2390,6 +2387,8 @@ int LyXTabular::AsciiTopHLine(ostream & os, int row,
        return 0;
 #else
     // Isn't this equivalent? (Lgb)
+#warning Please check this Jürgen.
+    // If ok please delete the abofe #if 0 section. (Lgb)
     for (int i = fcell; i < n; ++i) {
            if (TopLine(i))
                    return 0;
@@ -2444,6 +2443,8 @@ int LyXTabular::AsciiBottomHLine(ostream & os, int row,
        return 0;
 #else
     // Isn't this equivalent? (Lgb)
+#warning Please check this Jürgen.
+    // If ok, please delete the above #if 0 section. (Lgb)
     for (int i = fcell; i < n; ++i) {
        if (BottomLine(i))
            return 0;
index eff168456998a071e60e1199d47ef70c8a00833c..4191c8569df8bfeb2ecd65883f761e512e4a0282 100644 (file)
@@ -18,4 +18,4 @@
 
 #include "tracer.h"
 
-int DebugTracer::depth = 0;
+int Trace::depth = 0;
index 1e2ced161e492305a1655de3ce3c8de5436192b5..b01f652f800213d15b7b72478ee2e96fb883512d 100644 (file)
 #include "LString.h"
 
 ///
-class DebugTracer {
+class Trace {
 public:
        ///
        explicit
-       DebugTracer(string const & s) : str(s) {
-               lyxerr << string(depth, ' ') << "Trace begin : "
+       Trace(string const & s) : str(s) {
+               lyxerr << string(depth, ' ') << "TRACE IN: "
                       << str << std::endl;
-               ++depth;
+               depth += 2;
                
        }
        ///
-       ~DebugTracer() {
-               --depth;
-               lyxerr << string(depth, ' ') << "Trace end : "
+       ~Trace() {
+               depth -= 2;
+               lyxerr << string(depth, ' ') << "TRACE OUT: "
                       << str << std::endl;
        }
 private:
@@ -43,4 +43,11 @@ private:
        static int depth;
 };
 
+// To avoid wrong usage:
+// Trace("BufferView::update");  // wrong
+// Trace t("BufferView::update"); // right
+// we add this macro:
+///
+#define Trace(x) unnamed_Trace;
+// Tip gotten from Bobby Schmidt's column in C/C++ Users Journal
 #endif