From: Jean-Marc Lasgouttes Date: Wed, 24 Oct 2001 13:21:20 +0000 (+0000) Subject: code cleanup X-Git-Tag: 1.6.10~20432 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=e97277c99ca2fc304158b2790c3682059829409c;p=features.git code cleanup git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2933 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/po/POTFILES.in b/po/POTFILES.in index 8d7fe324da..57027f7668 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -1,21 +1,24 @@ -src/buffer.C -src/bufferlist.C src/BufferView2.C -src/bufferview_funcs.C src/BufferView_pimpl.C src/Chktex.C src/ColorHandler.C -src/converter.C src/CutAndPaste.C +src/FontLoader.C +src/LColor.C +src/LaTeX.C +src/LyXAction.C +src/LyXSendto.C +src/LyXView.C +src/MenuBackend.C +src/buffer.C +src/bufferlist.C +src/bufferview_funcs.C +src/converter.C src/debug.C src/exporter.C -src/ext_l10n.h -src/figure_form.C src/figureForm.C -src/FontLoader.C -src/frontends/controllers/biblio.C +src/figure_form.C src/frontends/controllers/ButtonController.h -src/frontends/controllers/character.C src/frontends/controllers/ControlAboutlyx.C src/frontends/controllers/ControlBibtex.C src/frontends/controllers/ControlCharacter.C @@ -28,6 +31,8 @@ src/frontends/controllers/ControlSearch.C src/frontends/controllers/ControlSpellchecker.C src/frontends/controllers/ControlTexinfo.C src/frontends/controllers/ControlThesaurus.C +src/frontends/controllers/biblio.C +src/frontends/controllers/character.C src/frontends/controllers/helper_funcs.C src/frontends/gnome/FormCitation.C src/frontends/gnome/FormIndex.C @@ -36,7 +41,6 @@ src/frontends/gnome/FormRef.C src/frontends/gnome/FormToc.C src/frontends/gnome/Menubar_pimpl.C src/frontends/qt2/FileDialog.C -src/frontends/qt2/lengthcombo.C src/frontends/qt2/QAbout.C src/frontends/qt2/QBibitem.C src/frontends/qt2/QBibtex.C @@ -45,8 +49,8 @@ src/frontends/qt2/QCharacter.C src/frontends/qt2/QCitation.C src/frontends/qt2/QCitationDialog.C src/frontends/qt2/QDocument.C -src/frontends/qt2/QError.C src/frontends/qt2/QERT.C +src/frontends/qt2/QError.C src/frontends/qt2/QExternal.C src/frontends/qt2/QExternalDialog.C src/frontends/qt2/QGraphics.C @@ -68,86 +72,87 @@ src/frontends/qt2/QThesaurus.C src/frontends/qt2/QToc.C src/frontends/qt2/QURL.C src/frontends/qt2/QVCLog.C -src/frontends/xforms/combox.C +src/frontends/qt2/lengthcombo.C src/frontends/xforms/FileDialog.C -src/frontends/xforms/form_aboutlyx.C src/frontends/xforms/FormAboutlyx.C -src/frontends/xforms/form_bibitem.C src/frontends/xforms/FormBibitem.C -src/frontends/xforms/form_bibtex.C src/frontends/xforms/FormBibtex.C -src/frontends/xforms/form_browser.C -src/frontends/xforms/form_character.C src/frontends/xforms/FormCharacter.C -src/frontends/xforms/form_citation.C src/frontends/xforms/FormCitation.C -src/frontends/xforms/form_document.C src/frontends/xforms/FormDocument.C -src/frontends/xforms/form_error.C -src/frontends/xforms/FormError.C -src/frontends/xforms/form_ert.C src/frontends/xforms/FormERT.C -src/frontends/xforms/form_external.C +src/frontends/xforms/FormError.C src/frontends/xforms/FormExternal.C -src/frontends/xforms/form_filedialog.C src/frontends/xforms/FormFiledialog.C -src/frontends/xforms/form_float.C src/frontends/xforms/FormFloat.C -src/frontends/xforms/form_graphics.C src/frontends/xforms/FormGraphics.C -src/frontends/xforms/form_include.C src/frontends/xforms/FormInclude.C -src/frontends/xforms/form_index.C src/frontends/xforms/FormIndex.C src/frontends/xforms/FormLog.C src/frontends/xforms/FormMathsBitmap.C -src/frontends/xforms/form_maths_deco.C src/frontends/xforms/FormMathsDeco.C -src/frontends/xforms/form_maths_delim.C src/frontends/xforms/FormMathsDelim.C -src/frontends/xforms/form_maths_matrix.C src/frontends/xforms/FormMathsMatrix.C -src/frontends/xforms/form_maths_panel.C src/frontends/xforms/FormMathsPanel.C -src/frontends/xforms/form_maths_space.C src/frontends/xforms/FormMathsSpace.C -src/frontends/xforms/form_minipage.C src/frontends/xforms/FormMinipage.C -src/frontends/xforms/form_paragraph.C src/frontends/xforms/FormParagraph.C -src/frontends/xforms/form_preamble.C src/frontends/xforms/FormPreamble.C -src/frontends/xforms/form_preferences.C src/frontends/xforms/FormPreferences.C -src/frontends/xforms/form_print.C src/frontends/xforms/FormPrint.C -src/frontends/xforms/form_ref.C src/frontends/xforms/FormRef.C -src/frontends/xforms/form_search.C src/frontends/xforms/FormSearch.C -src/frontends/xforms/form_spellchecker.C src/frontends/xforms/FormSpellchecker.C -src/frontends/xforms/form_tabular.C src/frontends/xforms/FormTabular.C -src/frontends/xforms/form_tabular_create.C src/frontends/xforms/FormTabularCreate.C -src/frontends/xforms/form_texinfo.C src/frontends/xforms/FormTexinfo.C -src/frontends/xforms/form_thesaurus.C src/frontends/xforms/FormThesaurus.C -src/frontends/xforms/form_toc.C src/frontends/xforms/FormToc.C -src/frontends/xforms/form_url.C src/frontends/xforms/FormUrl.C src/frontends/xforms/FormVCLog.C -src/frontends/xforms/input_validators.C src/frontends/xforms/Menubar_pimpl.C +src/frontends/xforms/combox.C +src/frontends/xforms/form_aboutlyx.C +src/frontends/xforms/form_bibitem.C +src/frontends/xforms/form_bibtex.C +src/frontends/xforms/form_browser.C +src/frontends/xforms/form_character.C +src/frontends/xforms/form_citation.C +src/frontends/xforms/form_document.C +src/frontends/xforms/form_error.C +src/frontends/xforms/form_ert.C +src/frontends/xforms/form_external.C +src/frontends/xforms/form_filedialog.C +src/frontends/xforms/form_float.C +src/frontends/xforms/form_graphics.C +src/frontends/xforms/form_include.C +src/frontends/xforms/form_index.C +src/frontends/xforms/form_maths_deco.C +src/frontends/xforms/form_maths_delim.C +src/frontends/xforms/form_maths_matrix.C +src/frontends/xforms/form_maths_panel.C +src/frontends/xforms/form_maths_space.C +src/frontends/xforms/form_minipage.C +src/frontends/xforms/form_paragraph.C +src/frontends/xforms/form_preamble.C +src/frontends/xforms/form_preferences.C +src/frontends/xforms/form_print.C +src/frontends/xforms/form_ref.C +src/frontends/xforms/form_search.C +src/frontends/xforms/form_spellchecker.C +src/frontends/xforms/form_tabular.C +src/frontends/xforms/form_tabular_create.C +src/frontends/xforms/form_texinfo.C +src/frontends/xforms/form_thesaurus.C +src/frontends/xforms/form_toc.C +src/frontends/xforms/form_url.C +src/frontends/xforms/input_validators.C src/frontends/xforms/xforms_helpers.C src/gettext.h src/importer.C src/insets/figinset.C -src/insets/insetbib.C src/insets/inset.C +src/insets/insetbib.C src/insets/insetcaption.C src/insets/inseterror.C src/insets/insetert.C @@ -172,25 +177,19 @@ src/insets/insettoc.C src/insets/inseturl.C src/kbsequence.C src/language.C -src/LaTeX.C src/layout.C -src/LColor.C -src/LyXAction.C src/lyx_cb.C +src/lyx_gui_misc.C +src/lyx_main.C src/lyxfind.C src/lyxfont.C src/lyxfunc.C -src/lyx_gui_misc.C -src/lyx_main.C src/lyxrc.C -src/LyXSendto.C src/lyxvc.C -src/LyXView.C -src/mathed/formulabase.C src/mathed/formula.C +src/mathed/formulabase.C src/mathed/formulamacro.C src/mathed/math_cursor.C -src/MenuBackend.C src/minibuffer.C src/paragraph.C src/print_form.C @@ -199,6 +198,6 @@ src/support/getUserName.C src/support/path.C src/support/path.h src/tabular.C -src/text2.C src/text.C +src/text2.C src/ext_l10n.h diff --git a/src/support/ChangeLog b/src/support/ChangeLog index a5b0038526..74201625ad 100644 --- a/src/support/ChangeLog +++ b/src/support/ChangeLog @@ -1,3 +1,7 @@ +2001-10-24 Andre Poenitz + + * filetools.C: code style cleanup + 2001-10-23 Angus Leeming * os.h: remove spurious punctuation. diff --git a/src/support/filetools.C b/src/support/filetools.C index e21eb0da48..761ef5f0a8 100644 --- a/src/support/filetools.C +++ b/src/support/filetools.C @@ -150,7 +150,7 @@ bool IsDirWriteable (string const & path) { lyxerr[Debug::FILES] << "IsDirWriteable: " << path << endl; - string const tmpfl(lyx::tempName(path, "lyxwritetest")); + string const tmpfl(lyx::tempName(path, "lyxwritetest")); if (tmpfl.empty()) return false; @@ -273,14 +273,12 @@ string const FileSearch(string const & path, string const & name, string const LibFileSearch(string const & dir, string const & name, string const & ext) { - string fullname = FileSearch(AddPath(user_lyxdir, dir), - name, ext); + string fullname = FileSearch(AddPath(user_lyxdir, dir), name, ext); if (!fullname.empty()) return fullname; if (!build_lyxdir.empty()) - fullname = FileSearch(AddPath(build_lyxdir, dir), - name, ext); + fullname = FileSearch(AddPath(build_lyxdir, dir), name, ext); if (!fullname.empty()) return fullname; @@ -295,8 +293,8 @@ i18nLibFileSearch(string const & dir, string const & name, // this comment is from intl/dcigettext.c. We try to mimick this // behaviour here. /* The highest priority value is the `LANGUAGE' environment - variable. But we don't use the value if the currently - selected locale is the C locale. This is a GNU extension. */ + variable. But we don't use the value if the currently + selected locale is the C locale. This is a GNU extension. */ string const lc_all = GetEnv("LC_ALL"); string lang = GetEnv("LANGUAGE"); @@ -324,33 +322,33 @@ i18nLibFileSearch(string const & dir, string const & name, string const GetEnv(string const & envname) { - // f.ex. what about error checking? - char const * const ch = getenv(envname.c_str()); - string const envstr = !ch ? "" : ch; - return envstr; + // f.ex. what about error checking? + char const * const ch = getenv(envname.c_str()); + string const envstr = !ch ? "" : ch; + return envstr; } string const GetEnvPath(string const & name) { #ifndef __EMX__ - string const pathlist = subst(GetEnv(name), ':', ';'); + string const pathlist = subst(GetEnv(name), ':', ';'); #else - string const pathlist = os::slashify_path(GetEnv(name)); + string const pathlist = os::slashify_path(GetEnv(name)); #endif - return strip(pathlist, ';'); + return strip(pathlist, ';'); } bool PutEnv(string const & envstr) { // CHECK Look at and fix this. - // f.ex. what about error checking? + // f.ex. what about error checking? #if HAVE_PUTENV - // this leaks, but what can we do about it? - // Is doing a getenv() and a free() of the older value - // a good idea? (JMarc) + // this leaks, but what can we do about it? + // Is doing a getenv() and a free() of the older value + // a good idea? (JMarc) // Actually we don't have to leak...calling putenv like this // should be enough: ... and this is obviously not enough if putenv // does not make a copy of the string. It is also not very wise to @@ -371,21 +369,21 @@ bool PutEnv(string const & envstr) //int retval = lyx::putenv(envstr.c_str()); #else #ifdef HAVE_SETENV - string varname; - string const str = envstr.split(varname,'='); - int const retval = ::setenv(varname.c_str(), str.c_str(), true); + string varname; + string const str = envstr.split(varname,'='); + int const retval = ::setenv(varname.c_str(), str.c_str(), true); #else // No environment setting function. Can this happen? int const retval = 1; //return an error condition. #endif #endif - return retval == 0; + return retval == 0; } bool PutEnvPath(string const & envstr) { - return PutEnv(envstr); + return PutEnv(envstr); } @@ -471,7 +469,9 @@ int DestroyTmpDir(string const & tmpdir, bool Allfiles) #ifdef __EMX__ Path p(user_lyxdir); #endif - if (Allfiles && DeleteAllFilesInDir(tmpdir)) return -1; + if (Allfiles && DeleteAllFilesInDir(tmpdir)) { + return -1; + } if (lyx::rmdir(tmpdir)) { WriteFSAlert(_("Error! Couldn't delete temporary directory:"), tmpdir); @@ -511,25 +511,23 @@ string const CreateLyXTmpDir(string const & deflt) if ((!deflt.empty()) && (deflt != "/tmp")) { if (lyx::mkdir(deflt, 0777)) { #ifdef __EMX__ - Path p(user_lyxdir); + Path p(user_lyxdir); #endif - string const t(CreateTmpDir(deflt, "lyx_tmpdir")); - return t; + return CreateTmpDir(deflt, "lyx_tmpdir"); } else - return deflt; + return deflt; } else { #ifdef __EMX__ Path p(user_lyxdir); #endif - string const t(CreateTmpDir("/tmp", "lyx_tmpdir")); - return t; + return CreateTmpDir("/tmp", "lyx_tmpdir"); } } int DestroyLyXTmpDir(string const & tmpdir) { - return DestroyTmpDir (tmpdir, false); // Why false? + return DestroyTmpDir (tmpdir, false); // Why false? } @@ -691,13 +689,15 @@ string const ExpandPath(string const & path) if (Temp == ".") { return lyx::getcwd() /*GetCWD()*/ + '/' + RTemp; - } else if (Temp == "~") { + } + if (Temp == "~") { return GetEnvPath("HOME") + '/' + RTemp; - } else if (Temp == "..") { + } + if (Temp == "..") { return MakeAbsPath(copy); - } else - // Don't know how to handle this - return copy; + } + // Don't know how to handle this + return copy; } @@ -874,14 +874,16 @@ string const MakeRelPath(string const & abspath, string const & basepath) string::size_type j = i; while (j < baselen) { if (basepath[j] == '/') { - if (j + 1 == baselen) break; + if (j + 1 == baselen) + break; buf += "../"; } ++j; } // Append relative stuff from common directory to abspath - if (abspath[i] == '/') ++i; + if (abspath[i] == '/') + ++i; for (; i < abslen; ++i) buf += abspath[i]; // Remove trailing / @@ -921,8 +923,7 @@ string const AddPath(string const & path, string const & path_2) Strips path off if no_path == true. If no extension on oldname, just appends. */ -string const -ChangeExtension(string const & oldname, string const & extension) +string const ChangeExtension(string const & oldname, string const & extension) { string::size_type const last_slash = oldname.rfind('/'); string::size_type last_dot = oldname.rfind('.'); @@ -1044,8 +1045,7 @@ cmdret const do_popen(string const & cmd) } // namespace anon -string const -findtexfile(string const & fil, string const & /*format*/) +string const findtexfile(string const & fil, string const & /*format*/) { /* There is no problem to extend this function too use other methods to look for files. It could be setup to look @@ -1081,13 +1081,13 @@ findtexfile(string const & fil, string const & /*format*/) // tfm - TFMFONTS, TEXFONTS // This means that to use kpsewhich in the best possible way we // should help it by setting additional path in the approp. envir.var. - string const kpsecmd = "kpsewhich " + fil; + string const kpsecmd = "kpsewhich " + fil; - cmdret const c = do_popen(kpsecmd); - - lyxerr[Debug::LATEX] << "kpse status = " << c.first << "\n" - << "kpse result = `" << strip(c.second, '\n') - << "'" << endl; + cmdret const c = do_popen(kpsecmd); + + lyxerr[Debug::LATEX] << "kpse status = " << c.first << "\n" + << "kpse result = `" << strip(c.second, '\n') + << "'" << endl; if (c.first != -1) return os::internal_path(strip(strip(c.second, '\n'), '\r')); else