#include "LyXView.h"
#include "minibuffer.h"
#include "lyx_gui_misc.h"
+#include "lyx_cb.h"
using std::map;
using std::vector;
using std::queue;
using std::stack;
-extern void ShowMessage(Buffer * buf,
- string const & msg1,
- string const & msg2 = string(),
- string const & msg3 = string(), int delay = 6);
-
//////////////////////////////////////////////////////////////////////////////
map<string, Format> Formats::formats;
//////////////////////////////////////////////////////////////////////////////
-Format::Format(string const & n) : name(n), in_degree(0)
+Format::Format(string const & n)
+ : name(n), in_degree(0)
{
struct Item {
char const * name;
}
}
+
void Formats::Add(string const & name)
{
if (formats.find(name) == formats.end())
formats[name] = Format(name);
}
+
void Formats::SetViewer(string const & name, string const & command)
{
Add(name);
return 0;
}
-string Formats::PrettyName(string const & name)
+string const Formats::PrettyName(string const & name)
{
-
string format;
Converter::SplitFormat(name, format);
Format * f = GetFormat(format);
return format;
}
+
//////////////////////////////////////////////////////////////////////////////
void Converter::Add(string const & from, string const & to,
string const & command, string const & flags)
++Formats::GetFormat(to)->in_degree;
}
-vector< pair<string,string> >
+
+vector< pair<string,string> > const
Converter::GetReachable(string const & from, bool only_viewable)
{
vector< pair<string,string> > result;
string const & to_format)
{
- string using_format, format;
- using_format = SplitFormat(to_format, format);
+ string format;
+ string using_format = SplitFormat(to_format, format);
string from_format = GetExtension(from_file);
if (from_format == format)
return true;
}
-string Converter::SplitFormat(string const & str, string & format)
+string const Converter::SplitFormat(string const & str, string & format)
{
string using_format = split(str, format, ':');
if (format.empty())
return using_format;
}
+
bool Converter::runLaTeX(Buffer * buffer, string const & command)
{
class Buffer;
+///
struct Command {
+ ///
Command(string const & f, string const & t, string const & c,
bool o)
: from(f), to(t), command(c), original_dir(o) {}
std::vector<Command>::iterator previous;
};
+///
class Format {
public:
+ ///
Format() : in_degree(0) {}
///
Format(string const & n);
int in_degree;
};
+///
class Formats {
public:
///
Format * GetFormat(string const & name);
///
static
- string PrettyName(string const & name);
+ string const PrettyName(string const & name);
private:
///
static
std::map<string, Format> formats;
};
+///
class Converter {
public:
///
string const & command, string const & flags);
///
static
- std::vector<std::pair<string, string> > GetReachable(string const & from,
- bool only_viewable = false);
+ std::vector<std::pair<string, string> > const
+ GetReachable(string const & from,
+ bool only_viewable = false);
///
static
bool convert(Buffer * buffer, string const & from_file,
string const & to_format);
///
static
- string SplitFormat(string const & str, string & format);
+ string const SplitFormat(string const & str, string & format);
private:
///
static
#include "converter.h"
#include "buffer.h"
+#include "lyx_cb.h"
#include "support/path.h"
-
using std::vector;
using std::pair;
-extern void ShowMessage(Buffer * buf,
- string const & msg1,
- string const & msg2 = string(),
- string const & msg3 = string(), int delay = 6);
-
bool Exporter::Export(Buffer * buffer, string const & format0,
bool put_in_tempdir)
{
- string using_format, format;
- using_format = Converter::SplitFormat(format0, format);
+ string format;
+ string using_format = Converter::SplitFormat(format0, format);
string filename = buffer->fileName();
string backend_format = BufferExtension(buffer);
}
-vector<pair<string, string> > Exporter::GetExportableFormats(Buffer * buffer)
+vector<pair<string, string> > const
+Exporter::GetExportableFormats(Buffer const * buffer)
{
return Converter::GetReachable(BufferExtension(buffer), false);
}
-vector<pair<string, string> > Exporter::GetViewableFormats(Buffer * buffer)
+vector<pair<string, string> > const
+Exporter::GetViewableFormats(Buffer const * buffer)
{
return Converter::GetReachable(BufferExtension(buffer), true);
}
-string Exporter::BufferExtension(Buffer * buffer)
+
+string const Exporter::BufferExtension(Buffer const * buffer)
{
if (buffer->isLinuxDoc())
return "sgml";
class Buffer;
+///
class Exporter {
public:
///
bool Preview(Buffer * buffer, string const & format);
///
static
- std::vector<std::pair<string, string> > GetExportableFormats(Buffer * buffer);
+ std::vector<std::pair<string, string> > const
+ GetExportableFormats(Buffer const * buffer);
///
static
- std::vector<std::pair<string, string> > GetViewableFormats(Buffer * buffer);
+ std::vector<std::pair<string, string> > const
+ GetViewableFormats(Buffer const * buffer);
///
static
- string BufferExtension(Buffer * buffer);
+ string const BufferExtension(Buffer const * buffer);
};
//#define NEW_EXPORT 1
#include <algorithm>
#include <iostream>
-#include "LString.h"
+//#include "LString.h"
#include FORMS_H_LOCATION
#include "lyx.h"
#include "layout_forms.h"
void ShowMessage(Buffer * buf,
string const & msg1,
- string const & msg2 = string(),
- string const & msg3 = string(), int delay = 6)
+ string const & msg2,
+ string const & msg3, int delay)
{
if (lyxrc.use_gui) {
buf->getUser()->owner()->getMiniBuffer()->Set(msg1, msg2,
#ifndef LYX_CB_H
#define LYX_CB_H
+#include "LString.h"
+
class BufferParams;
///
extern bool BindFileSet;
///
extern LyXFont UserFreeFont(BufferParams const & params);
+///
+void ShowMessage(Buffer * buf,
+ string const & msg1,
+ string const & msg2 = string(),
+ string const & msg3 = string(), int delay = 6);
#endif