X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fsupport%2Ffiletools.cpp;h=68c92d8daaa65fd5562c2db283c4c7ade4dcb45e;hb=de6ff1fec2b918a0bd09f48b17a2770bfc15aef7;hp=5891e79fec62c6b89346ed3e611a265e8a7bc1ca;hpb=d7320ad89b26bb89f8f133801c6a452005e5bff3;p=lyx.git diff --git a/src/support/filetools.cpp b/src/support/filetools.cpp index 5891e79fec..68c92d8daa 100644 --- a/src/support/filetools.cpp +++ b/src/support/filetools.cpp @@ -30,6 +30,7 @@ #include "support/gettext.h" #include "support/lstrings.h" #include "support/os.h" +#include "support/Messages.h" #include "support/Package.h" #include "support/Path.h" #include "support/Systemcall.h" @@ -282,7 +283,7 @@ FileName const i18nLibFileSearch(string const & dir, string const & name, each po file is able to tell us its name. (JMarc) */ - string lang = to_ascii(_(languageTestString())); + string lang = getGuiMessages().language(); string const language = getEnv("LANGUAGE"); if (!lang.empty() && !language.empty()) lang = language; @@ -1016,59 +1017,6 @@ FileName const findtexfile(string const & fil, string const & /*format*/) } -void readBB_lyxerrMessage(FileName const & file, bool & zipped, - string const & message) -{ - LYXERR(Debug::GRAPHICS, "[readBB_from_PSFile] " << message); - // FIXME: Why is this func deleting a file? (Lgb) - if (zipped) - file.removeFile(); -} - - -string const readBB_from_PSFile(FileName const & file) -{ - // in a (e)ps-file it's an entry like %%BoundingBox:23 45 321 345 - // It seems that every command in the header has an own line, - // getline() should work for all files. - // On the other hand some plot programs write the bb at the - // end of the file. Than we have in the header: - // %%BoundingBox: (atend) - // In this case we must check the end. - bool zipped = file.isZippedFile(); - FileName const file_ = zipped ? unzipFile(file) : file; - string const format = file_.guessFormatFromContents(); - - if (format != "eps" && format != "ps") { - readBB_lyxerrMessage(file_, zipped,"no(e)ps-format"); - return string(); - } - - static lyx::regex bbox_re( - "^%%BoundingBox:\\s*([[:digit:]]+)\\s+([[:digit:]]+)\\s+([[:digit:]]+)\\s+([[:digit:]]+)"); - ifstream is(file_.toFilesystemEncoding().c_str()); - while (is) { - string s; - getline(is,s); - lyx::smatch what; - if (regex_match(s, what, bbox_re)) { - // Our callers expect the tokens in the string - // separated by single spaces. - // FIXME: change return type from string to something - // sensible - ostringstream os; - os << what.str(1) << ' ' << what.str(2) << ' ' - << what.str(3) << ' ' << what.str(4); - string const bb = os.str(); - readBB_lyxerrMessage(file_, zipped, bb); - return bb; - } - } - readBB_lyxerrMessage(file_, zipped, "no bb found"); - return string(); -} - - int compare_timestamps(FileName const & file1, FileName const & file2) { // If the original is newer than the copy, then copy the original