From 5495b8803f7d76d3a49109bce652f3518af158c3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Lars=20Gullik=20Bj=C3=B8nnes?= Date: Wed, 30 Aug 2000 04:38:32 +0000 Subject: [PATCH] sorry no time for change log, add some const declare ShowMessage in lyx_cb.h and use that instead of the extern git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@992 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/converter.C | 25 +++++++++++++------------ src/converter.h | 15 +++++++++++---- src/exporter.C | 20 +++++++++----------- src/exporter.h | 9 ++++++--- src/lyx_cb.C | 6 +++--- src/lyx_cb.h | 7 +++++++ 6 files changed, 49 insertions(+), 33 deletions(-) diff --git a/src/converter.C b/src/converter.C index cf38de44bf..c1af3b5872 100644 --- a/src/converter.C +++ b/src/converter.C @@ -31,17 +31,13 @@ #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 Formats::formats; @@ -49,7 +45,8 @@ vector Converter::commands; ////////////////////////////////////////////////////////////////////////////// -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; @@ -73,12 +70,14 @@ Format::Format(string const & n) : name(n), in_degree(0) } } + 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); @@ -147,9 +146,8 @@ Format * Formats::GetFormat(string const & 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); @@ -159,6 +157,7 @@ string Formats::PrettyName(string const & name) return format; } + ////////////////////////////////////////////////////////////////////////////// void Converter::Add(string const & from, string const & to, string const & command, string const & flags) @@ -179,7 +178,8 @@ void Converter::Add(string const & from, string const & to, ++Formats::GetFormat(to)->in_degree; } -vector< pair > + +vector< pair > const Converter::GetReachable(string const & from, bool only_viewable) { vector< pair > result; @@ -233,8 +233,8 @@ bool Converter::convert(Buffer * buffer, string const & from_file, 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; @@ -336,7 +336,7 @@ bool Converter::convert(Buffer * buffer, string const & from_file, } -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()) @@ -344,6 +344,7 @@ string Converter::SplitFormat(string const & str, string & format) return using_format; } + bool Converter::runLaTeX(Buffer * buffer, string const & command) { diff --git a/src/converter.h b/src/converter.h index 02588fee2b..3300b6ffcd 100644 --- a/src/converter.h +++ b/src/converter.h @@ -22,7 +22,9 @@ 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) {} @@ -40,8 +42,10 @@ struct Command { std::vector::iterator previous; }; +/// class Format { public: + /// Format() : in_degree(0) {} /// Format(string const & n); @@ -55,6 +59,7 @@ public: int in_degree; }; +/// class Formats { public: /// @@ -71,13 +76,14 @@ public: Format * GetFormat(string const & name); /// static - string PrettyName(string const & name); + string const PrettyName(string const & name); private: /// static std::map formats; }; +/// class Converter { public: /// @@ -86,15 +92,16 @@ public: string const & command, string const & flags); /// static - std::vector > GetReachable(string const & from, - bool only_viewable = false); + std::vector > 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 diff --git a/src/exporter.C b/src/exporter.C index 3d29b191ac..a7847ffbb6 100644 --- a/src/exporter.C +++ b/src/exporter.C @@ -21,22 +21,17 @@ #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); @@ -91,18 +86,21 @@ bool Exporter::Preview(Buffer * buffer, string const & format0) } -vector > Exporter::GetExportableFormats(Buffer * buffer) +vector > const +Exporter::GetExportableFormats(Buffer const * buffer) { return Converter::GetReachable(BufferExtension(buffer), false); } -vector > Exporter::GetViewableFormats(Buffer * buffer) +vector > 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"; diff --git a/src/exporter.h b/src/exporter.h index ce57770b2e..3ca20c1e22 100644 --- a/src/exporter.h +++ b/src/exporter.h @@ -21,6 +21,7 @@ class Buffer; +/// class Exporter { public: /// @@ -32,13 +33,15 @@ public: bool Preview(Buffer * buffer, string const & format); /// static - std::vector > GetExportableFormats(Buffer * buffer); + std::vector > const + GetExportableFormats(Buffer const * buffer); /// static - std::vector > GetViewableFormats(Buffer * buffer); + std::vector > const + GetViewableFormats(Buffer const * buffer); /// static - string BufferExtension(Buffer * buffer); + string const BufferExtension(Buffer const * buffer); }; //#define NEW_EXPORT 1 diff --git a/src/lyx_cb.C b/src/lyx_cb.C index c5e2f5fb0d..da971808f2 100644 --- a/src/lyx_cb.C +++ b/src/lyx_cb.C @@ -14,7 +14,7 @@ #include #include -#include "LString.h" +//#include "LString.h" #include FORMS_H_LOCATION #include "lyx.h" #include "layout_forms.h" @@ -163,8 +163,8 @@ void MenuLayoutSave(); 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, diff --git a/src/lyx_cb.h b/src/lyx_cb.h index d15e788e18..cc9bb3f42b 100644 --- a/src/lyx_cb.h +++ b/src/lyx_cb.h @@ -2,6 +2,8 @@ #ifndef LYX_CB_H #define LYX_CB_H +#include "LString.h" + class BufferParams; /// @@ -15,6 +17,11 @@ extern bool toggleall; 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 -- 2.39.5