#include "Buffer.h"
#include "BufferParams.h"
#include "LyXRC.h"
-#include "debug.h"
-#include "gettext.h"
#include "ServerSocket.h"
-#include "frontends/Application.h"
#include "frontends/alert.h" //to be removed?
+#include "support/debug.h"
#include "support/filetools.h"
+#include "support/gettext.h"
#include "support/lstrings.h"
#include "support/os.h"
#include "support/Systemcall.h"
-using std::find_if;
-using std::string;
-using std::distance;
-
+using namespace std;
+using namespace lyx::support;
namespace lyx {
-using support::absolutePath;
-using support::bformat;
-using support::compare_ascii_no_case;
-using support::contains;
-using support::FileName;
-using support::libScriptSearch;
-using support::makeDisplayPath;
-using support::onlyPath;
-using support::quoteName;
-using support::subst;
-using support::Systemcall;
-using support::token;
-
namespace Alert = frontend::Alert;
namespace os = support::os;
string const token_socket_format("$$a");
-class FormatNamesEqual : public std::unary_function<Format, bool> {
+class FormatNamesEqual : public unary_function<Format, bool> {
public:
FormatNamesEqual(string const & name)
: name_(name) {}
};
-class FormatExtensionsEqual : public std::unary_function<Format, bool> {
+class FormatExtensionsEqual : public unary_function<Format, bool> {
public:
FormatExtensionsEqual(string const & extension)
: extension_(extension) {}
if (filename.empty())
return string();
- string const format = support::getFormatFromContents(filename);
+ string const format = filename.guessFormatFromContents();
if (!format.empty())
return format;
// try to find a format from the file extension.
- string const ext(support::getExtension(filename.absFilename()));
+ string const ext = getExtension(filename.absFilename());
if (!ext.empty()) {
// this is ambigous if two formats have the same extension,
// but better than nothing
find_if(formatlist.begin(), formatlist.end(),
FormatExtensionsEqual(ext));
if (cit != formats.end()) {
- LYXERR(Debug::GRAPHICS)
- << "\twill guess format from file extension: "
- << ext << " -> " << cit->name() << std::endl;
+ LYXERR(Debug::GRAPHICS, "\twill guess format from file extension: "
+ << ext << " -> " << cit->name());
return cit->name();
}
}
return string();
}
-namespace {
-string fixCommand(string const & cmd, string const & ext,
+static string fixCommand(string const & cmd, string const & ext,
os::auto_open_mode mode)
{
// configure.py says we do not want a viewer/editor
return cmd;
}
-}
void Formats::setAutoOpen()
{
command = subst(command, token_from_format, quoteName(filename.toFilesystemEncoding()));
command = subst(command, token_path_format, quoteName(onlyPath(filename.toFilesystemEncoding())));
command = subst(command, token_socket_format, quoteName(theServerSocket().address()));
- LYXERR(Debug::FILES) << "Executing command: " << command << std::endl;
+ LYXERR(Debug::FILES, "Executing command: " << command);
// FIXME UNICODE utf8 can be wrong for files
buffer.message(_("Executing command: ") + from_utf8(command));
command = subst(command, token_from_format, quoteName(filename.toFilesystemEncoding()));
command = subst(command, token_path_format, quoteName(onlyPath(filename.toFilesystemEncoding())));
command = subst(command, token_socket_format, quoteName(theServerSocket().address()));
- LYXERR(Debug::FILES) << "Executing command: " << command << std::endl;
+ LYXERR(Debug::FILES, "Executing command: " << command);
// FIXME UNICODE utf8 can be wrong for files
buffer.message(_("Executing command: ") + from_utf8(command));