mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-05 13:26:21 +00:00
insetfloat work + stuff
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2388 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
fd836612cb
commit
e952d33e0b
@ -1,3 +1,18 @@
|
||||
2001-07-30 Lars Gullik Bjønnes <larsbj@birdstep.com>
|
||||
|
||||
* converter.[hC] + affected fiels: move to (inital-char)lowercase
|
||||
function names.
|
||||
|
||||
* ParagraphParameters.C (ParagraphParameters): remove commented code
|
||||
|
||||
* PainterBase.[Ch]: remove commented code
|
||||
|
||||
* LaTeXFeatures.h: add "bool floats" for float.sty
|
||||
|
||||
* LaTeXFeatures.C (LaTeXFeatures): init floats
|
||||
(require): handle float
|
||||
(getPackages): do it with floats
|
||||
|
||||
2001-07-30 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
|
||||
|
||||
* BufferView_pimpl.C (Dispatch): improve handling of
|
||||
|
@ -52,6 +52,7 @@ LaTeXFeatures::LaTeXFeatures(BufferParams const & p, LyXTextClass::size_type n)
|
||||
prettyref = false;
|
||||
chess = false;
|
||||
natbib = false;
|
||||
floats = false;
|
||||
|
||||
// commands
|
||||
lyx = false;
|
||||
@ -126,6 +127,8 @@ void LaTeXFeatures::require(string const & name)
|
||||
binom = true;
|
||||
} else if (name == "natbib") {
|
||||
natbib = true;
|
||||
} else if (name == "float") {
|
||||
floats = true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -260,23 +263,24 @@ string const LaTeXFeatures::getPackages() const
|
||||
packages << "\\usepackage{prettyref}\n";
|
||||
|
||||
// float.sty
|
||||
// We only need float.sty if we use non builtin floats. This includes
|
||||
// modified table and figure floats. (Lgb)
|
||||
// We only need float.sty if we use non builtin floats, or if we
|
||||
// use the "H" modifier. This includes modified table and
|
||||
// figure floats. (Lgb)
|
||||
if (!usedFloats.empty()) {
|
||||
bool use_float = false;
|
||||
UsedFloats::const_iterator beg = usedFloats.begin();
|
||||
UsedFloats::const_iterator end = usedFloats.end();
|
||||
for (; beg != end; ++beg) {
|
||||
Floating const & fl = floatList.getType((*beg));
|
||||
if (!fl.type().empty() && !fl.builtin()) {
|
||||
use_float = true;
|
||||
const_cast<LaTeXFeatures *>(this)->floats = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (use_float)
|
||||
packages << "\\usepackage{float}\n";
|
||||
}
|
||||
|
||||
if (floats) {
|
||||
packages << "\\usepackage{float}\n";
|
||||
}
|
||||
|
||||
// natbib.sty
|
||||
if (natbib) {
|
||||
packages << "\\usepackage[";
|
||||
|
@ -95,7 +95,9 @@ struct LaTeXFeatures {
|
||||
bool chess; // chess.sty
|
||||
///
|
||||
bool natbib; // natbib.sty
|
||||
|
||||
///
|
||||
bool floats; // float.sty
|
||||
|
||||
///
|
||||
bool lyx;
|
||||
///
|
||||
|
@ -90,55 +90,6 @@ PainterBase & PainterBase::buttonFrame(int x, int y, int w, int h)
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
PainterBase & PainterBase::rectText(int x, int baseline,
|
||||
string const & str,
|
||||
LyXFont const & font,
|
||||
LColor::color back,
|
||||
LColor::color frame, bool draw,
|
||||
int & width, int & ascent, int & descent)
|
||||
{
|
||||
#if 0
|
||||
static int const d = 2;
|
||||
width = lyxfont::width(str, font) + d * 2 + 2;
|
||||
ascent = lyxfont::maxAscent(font) + d;
|
||||
descent = lyxfont::maxDescent(font) + d;
|
||||
#else
|
||||
lyxfont::rectText(str, font, width, axcent, descent);
|
||||
#endif
|
||||
if (!draw) return *this;
|
||||
|
||||
rectangle(x, baseline - ascent, width, ascent + descent, frame);
|
||||
fillRectangle(x + 1, baseline - ascent + 1, width - 1,
|
||||
ascent + descent - 1, back);
|
||||
#if 0
|
||||
text(x + d, baseline, str, font);
|
||||
#else
|
||||
text(x + 2, baseline, str, font);
|
||||
#endif
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
PainterBase & PainterBase::buttonText(int x, int baseline,
|
||||
string const & str,
|
||||
LyXFont const & font, bool draw,
|
||||
int & width, int & ascent, int & descent)
|
||||
{
|
||||
#if 0
|
||||
width = lyxfont::width(str, font) + 8;
|
||||
ascent = lyxfont::maxAscent(font) + 3;
|
||||
descent = lyxfont::maxDescent(font) + 3;
|
||||
#else
|
||||
lyxfont::buttonText(str, font, width, ascent, descent);
|
||||
#endif
|
||||
if (!draw) return *this;
|
||||
|
||||
button(x, baseline - ascent, width, descent + ascent);
|
||||
text(x + 4, baseline, str, font);
|
||||
return *this;
|
||||
}
|
||||
#else
|
||||
PainterBase & PainterBase::rectText(int x, int baseline,
|
||||
string const & str,
|
||||
LyXFont const & font,
|
||||
@ -171,4 +122,3 @@ PainterBase & PainterBase::buttonText(int x, int baseline,
|
||||
text(x + 4, baseline, str, font);
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
|
@ -162,43 +162,16 @@ public:
|
||||
/// Draw a char at position x, y (y is the baseline)
|
||||
virtual PainterBase & text(int x, int y, char c, LyXFont const & f)=0;
|
||||
|
||||
#if 0
|
||||
/** Draws a string and encloses it inside a rectangle. Returns
|
||||
the size of the rectangle. If draw is false, we only calculate
|
||||
the size. */
|
||||
virtual PainterBase & rectText(int x, int baseline,
|
||||
string const & string,
|
||||
LyXFont const & font,
|
||||
LColor::color back,
|
||||
LColor::color frame, bool draw = true,
|
||||
int & width = PainterBase::dummy1,
|
||||
int & ascent = PainterBase::dummy2,
|
||||
int & descent = PainterBase::dummy3);
|
||||
|
||||
/** Draw a string and encloses it inside a button frame. Returns
|
||||
the size of the frame. If draw is false, we only calculate
|
||||
the size. */
|
||||
virtual PainterBase & buttonText(int x, int baseline, string const & s,
|
||||
LyXFont const & font, bool draw = true,
|
||||
int & width = PainterBase::dummy1,
|
||||
int & ascent = PainterBase::dummy2,
|
||||
int & descent = PainterBase::dummy3);
|
||||
#else
|
||||
/** Draws a string and encloses it inside a rectangle. Returns
|
||||
the size of the rectangle. If draw is false, we only calculate
|
||||
the size. */
|
||||
/** Draws a string and encloses it inside a rectangle. */
|
||||
PainterBase & rectText(int x, int baseline,
|
||||
string const & string,
|
||||
LyXFont const & font,
|
||||
LColor::color back,
|
||||
string const & string,
|
||||
LyXFont const & font,
|
||||
LColor::color back,
|
||||
LColor::color frame);
|
||||
|
||||
/** Draw a string and encloses it inside a button frame. Returns
|
||||
the size of the frame. If draw is false, we only calculate
|
||||
the size. */
|
||||
/** Draw a string and encloses it inside a button frame. */
|
||||
PainterBase & buttonText(int x, int baseline, string const & s,
|
||||
LyXFont const & font);
|
||||
#endif
|
||||
protected:
|
||||
///
|
||||
WorkArea & owner;
|
||||
|
@ -15,10 +15,6 @@ ShareContainer<ParameterStruct> ParagraphParameters::container;
|
||||
ParagraphParameters::ParagraphParameters()
|
||||
{
|
||||
ParameterStruct tmp;
|
||||
#if 0
|
||||
tmp.appendix = false;
|
||||
tmp.align = LYX_ALIGN_BLOCK;
|
||||
#endif
|
||||
set_from_struct(tmp);
|
||||
}
|
||||
|
||||
|
@ -209,7 +209,7 @@ pair<Buffer::LogType, string> const Buffer::getLogName(void) const
|
||||
string const bname =
|
||||
AddName(path, OnlyFilename(
|
||||
ChangeExtension(filename,
|
||||
formats.Extension("literate") + ".out")));
|
||||
formats.extension("literate") + ".out")));
|
||||
|
||||
// If no Latex log or Build log is newer, show Build log
|
||||
|
||||
|
322
src/converter.C
322
src/converter.C
@ -66,7 +66,7 @@ bool Format::dummy() const
|
||||
}
|
||||
|
||||
|
||||
bool Format::IsChildFormat() const
|
||||
bool Format::isChildFormat() const
|
||||
{
|
||||
if (name_.empty())
|
||||
return false;
|
||||
@ -74,7 +74,7 @@ bool Format::IsChildFormat() const
|
||||
}
|
||||
|
||||
|
||||
string const Format::ParentFormat() const
|
||||
string const Format::parentFormat() const
|
||||
{
|
||||
return name_.substr(0, name_.length() - 1);
|
||||
}
|
||||
@ -83,7 +83,7 @@ string const Format::ParentFormat() const
|
||||
|
||||
// This method should return a reference, and throw an exception
|
||||
// if the format named name cannot be found (Lgb)
|
||||
Format const * Formats::GetFormat(string const & name) const
|
||||
Format const * Formats::getFormat(string const & name) const
|
||||
{
|
||||
FormatList::const_iterator cit =
|
||||
find_if(formatlist.begin(), formatlist.end(),
|
||||
@ -95,7 +95,7 @@ Format const * Formats::GetFormat(string const & name) const
|
||||
}
|
||||
|
||||
|
||||
int Formats::GetNumber(string const & name) const
|
||||
int Formats::getNumber(string const & name) const
|
||||
{
|
||||
FormatList::const_iterator cit =
|
||||
find_if(formatlist.begin(), formatlist.end(),
|
||||
@ -107,14 +107,14 @@ int Formats::GetNumber(string const & name) const
|
||||
}
|
||||
|
||||
|
||||
void Formats::Add(string const & name)
|
||||
void Formats::add(string const & name)
|
||||
{
|
||||
if (!GetFormat(name))
|
||||
Add(name, name, name, string());
|
||||
if (!getFormat(name))
|
||||
add(name, name, name, string());
|
||||
}
|
||||
|
||||
|
||||
void Formats::Add(string const & name, string const & extension,
|
||||
void Formats::add(string const & name, string const & extension,
|
||||
string const & prettyname, string const & shortcut)
|
||||
{
|
||||
FormatList::iterator it =
|
||||
@ -130,7 +130,7 @@ void Formats::Add(string const & name, string const & extension,
|
||||
}
|
||||
|
||||
|
||||
void Formats::Delete(string const & name)
|
||||
void Formats::erase(string const & name)
|
||||
{
|
||||
FormatList::iterator it =
|
||||
find_if(formatlist.begin(), formatlist.end(),
|
||||
@ -140,15 +140,15 @@ void Formats::Delete(string const & name)
|
||||
}
|
||||
|
||||
|
||||
void Formats::Sort()
|
||||
void Formats::sort()
|
||||
{
|
||||
sort(formatlist.begin(), formatlist.end());
|
||||
std::sort(formatlist.begin(), formatlist.end());
|
||||
}
|
||||
|
||||
|
||||
void Formats::SetViewer(string const & name, string const & command)
|
||||
void Formats::setViewer(string const & name, string const & command)
|
||||
{
|
||||
Add(name);
|
||||
add(name);
|
||||
FormatList::iterator it =
|
||||
find_if(formatlist.begin(), formatlist.end(),
|
||||
lyx::compare_memfun(&Format::name, name));
|
||||
@ -157,20 +157,20 @@ void Formats::SetViewer(string const & name, string const & command)
|
||||
}
|
||||
|
||||
|
||||
bool Formats::View(Buffer const * buffer, string const & filename,
|
||||
bool Formats::view(Buffer const * buffer, string const & filename,
|
||||
string const & format_name) const
|
||||
{
|
||||
if (filename.empty())
|
||||
return false;
|
||||
|
||||
Format const * format = GetFormat(format_name);
|
||||
Format const * format = getFormat(format_name);
|
||||
if (format && format->viewer().empty() &&
|
||||
format->IsChildFormat())
|
||||
format = GetFormat(format->ParentFormat());
|
||||
format->isChildFormat())
|
||||
format = getFormat(format->parentFormat());
|
||||
if (!format || format->viewer().empty()) {
|
||||
WriteAlert(_("Can not view file"),
|
||||
_("No information for viewing ")
|
||||
+ PrettyName(format_name));
|
||||
+ prettyName(format_name));
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -207,9 +207,9 @@ bool Formats::View(Buffer const * buffer, string const & filename,
|
||||
}
|
||||
|
||||
|
||||
string const Formats::PrettyName(string const & name) const
|
||||
string const Formats::prettyName(string const & name) const
|
||||
{
|
||||
Format const * format = GetFormat(name);
|
||||
Format const * format = getFormat(name);
|
||||
if (format)
|
||||
return format->prettyname();
|
||||
else
|
||||
@ -217,9 +217,9 @@ string const Formats::PrettyName(string const & name) const
|
||||
}
|
||||
|
||||
|
||||
string const Formats::Extension(string const & name) const
|
||||
string const Formats::extension(string const & name) const
|
||||
{
|
||||
Format const * format = GetFormat(name);
|
||||
Format const * format = getFormat(name);
|
||||
if (format)
|
||||
return format->extension();
|
||||
else
|
||||
@ -228,7 +228,7 @@ string const Formats::Extension(string const & name) const
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void Converter::ReadFlags()
|
||||
void Converter::readFlags()
|
||||
{
|
||||
string flag_list(flags);
|
||||
while (!flag_list.empty()) {
|
||||
@ -250,7 +250,7 @@ void Converter::ReadFlags()
|
||||
parselog = flag_value;
|
||||
}
|
||||
if (!result_dir.empty() && result_file.empty())
|
||||
result_file = "index." + formats.Extension(to);
|
||||
result_file = "index." + formats.extension(to);
|
||||
//if (!contains(command, token_from))
|
||||
// latex = true;
|
||||
}
|
||||
@ -282,57 +282,58 @@ private:
|
||||
};
|
||||
|
||||
|
||||
Converter const * Converters::GetConverter(string const & from,
|
||||
#warning why is a pointer returned and not a const reference? (Lgb)
|
||||
Converter const * Converters::getConverter(string const & from,
|
||||
string const & to)
|
||||
{
|
||||
ConverterList::const_iterator cit =
|
||||
find_if(converterlist.begin(), converterlist.end(),
|
||||
find_if(converterlist_.begin(), converterlist_.end(),
|
||||
compare_Converter(from, to));
|
||||
if (cit != converterlist.end())
|
||||
if (cit != converterlist_.end())
|
||||
return &(*cit);
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int Converters::GetNumber(string const & from, string const & to)
|
||||
int Converters::getNumber(string const & from, string const & to)
|
||||
{
|
||||
ConverterList::const_iterator cit =
|
||||
find_if(converterlist.begin(), converterlist.end(),
|
||||
find_if(converterlist_.begin(), converterlist_.end(),
|
||||
compare_Converter(from, to));
|
||||
if (cit != converterlist.end())
|
||||
return cit - converterlist.begin();
|
||||
if (cit != converterlist_.end())
|
||||
return cit - converterlist_.begin();
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
void Converters::Add(string const & from, string const & to,
|
||||
void Converters::add(string const & from, string const & to,
|
||||
string const & command, string const & flags)
|
||||
{
|
||||
formats.Add(from);
|
||||
formats.Add(to);
|
||||
ConverterList::iterator it = find_if(converterlist.begin(),
|
||||
converterlist.end(),
|
||||
formats.add(from);
|
||||
formats.add(to);
|
||||
ConverterList::iterator it = find_if(converterlist_.begin(),
|
||||
converterlist_.end(),
|
||||
compare_Converter(from, to));
|
||||
|
||||
Converter converter(from, to, command, flags);
|
||||
if (it != converterlist.end() && !flags.empty() && flags[0] == '*') {
|
||||
if (it != converterlist_.end() && !flags.empty() && flags[0] == '*') {
|
||||
converter = *it;
|
||||
converter.command = command;
|
||||
converter.flags = flags;
|
||||
}
|
||||
converter.ReadFlags();
|
||||
converter.readFlags();
|
||||
|
||||
if (converter.latex && (latex_command.empty() || to == "dvi"))
|
||||
latex_command = subst(command, token_from, "");
|
||||
if (converter.latex && (latex_command_.empty() || to == "dvi"))
|
||||
latex_command_ = subst(command, token_from, "");
|
||||
// If we have both latex & pdflatex, we set latex_command to latex.
|
||||
// The latex_command is used to update the .aux file when running
|
||||
// a converter that uses it.
|
||||
|
||||
if (it == converterlist.end())
|
||||
converterlist.push_back(converter);
|
||||
else {
|
||||
if (it == converterlist_.end()) {
|
||||
converterlist_.push_back(converter);
|
||||
} else {
|
||||
converter.From = it->From;
|
||||
converter.To = it->To;
|
||||
*it = converter;
|
||||
@ -340,13 +341,13 @@ void Converters::Add(string const & from, string const & to,
|
||||
}
|
||||
|
||||
|
||||
void Converters::Delete(string const & from, string const & to)
|
||||
void Converters::erase(string const & from, string const & to)
|
||||
{
|
||||
ConverterList::iterator it = find_if(converterlist.begin(),
|
||||
converterlist.end(),
|
||||
ConverterList::iterator it = find_if(converterlist_.begin(),
|
||||
converterlist_.end(),
|
||||
compare_Converter(from, to));
|
||||
if (it != converterlist.end())
|
||||
converterlist.erase(it);
|
||||
if (it != converterlist_.end())
|
||||
converterlist_.erase(it);
|
||||
}
|
||||
|
||||
|
||||
@ -357,70 +358,75 @@ void Converters::Delete(string const & from, string const & to)
|
||||
// adding/deleting a format in FormPreferences (the latter calls can be
|
||||
// eliminated if the formats in the Formats class are stored using a map or
|
||||
// a list (instead of a vector), but this will cause other problems).
|
||||
void Converters::Update(Formats const & formats)
|
||||
void Converters::update(Formats const & formats)
|
||||
{
|
||||
for (ConverterList::iterator it = converterlist.begin();
|
||||
it != converterlist.end(); ++it) {
|
||||
it->From = formats.GetFormat(it->from);
|
||||
it->To = formats.GetFormat(it->to);
|
||||
ConverterList::iterator it = converterlist_.begin();
|
||||
ConverterList::iterator end = converterlist_.end();
|
||||
for (; it != end; ++it) {
|
||||
it->From = formats.getFormat(it->from);
|
||||
it->To = formats.getFormat(it->to);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// This method updates the pointers From and To in the last converter.
|
||||
// It is called when adding a new converter in FormPreferences
|
||||
void Converters::UpdateLast(Formats const & formats)
|
||||
void Converters::updateLast(Formats const & formats)
|
||||
{
|
||||
if (converterlist.begin() != converterlist.end()) {
|
||||
ConverterList::iterator it = converterlist.end()-1;
|
||||
it->From = formats.GetFormat(it->from);
|
||||
it->To = formats.GetFormat(it->to);
|
||||
if (converterlist_.begin() != converterlist_.end()) {
|
||||
ConverterList::iterator it = converterlist_.end() - 1;
|
||||
it->From = formats.getFormat(it->from);
|
||||
it->To = formats.getFormat(it->to);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Converters::Sort()
|
||||
void Converters::sort()
|
||||
{
|
||||
sort(converterlist.begin(), converterlist.end());
|
||||
std::sort(converterlist_.begin(), converterlist_.end());
|
||||
}
|
||||
|
||||
|
||||
int Converters::BFS_init(string const & start, bool clear_visited)
|
||||
int Converters::bfs_init(string const & start, bool clear_visited)
|
||||
{
|
||||
int const s = formats.GetNumber(start);
|
||||
int const s = formats.getNumber(start);
|
||||
if (s < 0)
|
||||
return s;
|
||||
|
||||
Q = queue<int>();
|
||||
Q_ = queue<int>();
|
||||
if (clear_visited)
|
||||
fill(visited.begin(), visited.end(), false);
|
||||
if (visited[s] == false) {
|
||||
Q.push(s);
|
||||
visited[s] = true;
|
||||
fill(visited_.begin(), visited_.end(), false);
|
||||
if (visited_[s] == false) {
|
||||
Q_.push(s);
|
||||
visited_[s] = true;
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
|
||||
vector<Format const *> const
|
||||
Converters::GetReachableTo(string const & target, bool clear_visited)
|
||||
Converters::getReachableTo(string const & target, bool clear_visited)
|
||||
{
|
||||
vector<Format const *> result;
|
||||
int const s = BFS_init(target, clear_visited);
|
||||
int const s = bfs_init(target, clear_visited);
|
||||
if (s < 0)
|
||||
return result;
|
||||
|
||||
while (!Q.empty()) {
|
||||
int const i = Q.front();
|
||||
Q.pop();
|
||||
if (i != s || target != "lyx")
|
||||
result.push_back(&formats.Get(i));
|
||||
for (vector<int>::iterator it = vertices[i].in_vertices.begin();
|
||||
it != vertices[i].in_vertices.end(); ++it)
|
||||
if (!visited[*it]) {
|
||||
visited[*it] = true;
|
||||
Q.push(*it);
|
||||
while (!Q_.empty()) {
|
||||
int const i = Q_.front();
|
||||
Q_.pop();
|
||||
if (i != s || target != "lyx") {
|
||||
result.push_back(&formats.get(i));
|
||||
}
|
||||
|
||||
vector<int>::iterator it = vertices_[i].in_vertices.begin();
|
||||
vector<int>::iterator end = vertices_[i].in_vertices.end();
|
||||
for (; it != end; ++it) {
|
||||
if (!visited_[*it]) {
|
||||
visited_[*it] = true;
|
||||
Q_.push(*it);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
@ -428,28 +434,32 @@ Converters::GetReachableTo(string const & target, bool clear_visited)
|
||||
|
||||
|
||||
vector<Format const *> const
|
||||
Converters::GetReachable(string const & from, bool only_viewable,
|
||||
Converters::getReachable(string const & from, bool only_viewable,
|
||||
bool clear_visited)
|
||||
{
|
||||
vector<Format const *> result;
|
||||
|
||||
if (BFS_init(from, clear_visited) < 0)
|
||||
if (bfs_init(from, clear_visited) < 0)
|
||||
return result;
|
||||
|
||||
while (!Q.empty()) {
|
||||
int const i = Q.front();
|
||||
Q.pop();
|
||||
Format const & format = formats.Get(i);
|
||||
while (!Q_.empty()) {
|
||||
int const i = Q_.front();
|
||||
Q_.pop();
|
||||
Format const & format = formats.get(i);
|
||||
if (format.name() == "lyx")
|
||||
continue;
|
||||
if (!only_viewable || !format.viewer().empty() ||
|
||||
format.IsChildFormat())
|
||||
format.isChildFormat())
|
||||
result.push_back(&format);
|
||||
for (vector<int>::iterator it = vertices[i].out_vertices.begin();
|
||||
it != vertices[i].out_vertices.end(); ++it)
|
||||
if (!visited[*it]) {
|
||||
visited[*it] = true;
|
||||
Q.push(*it);
|
||||
|
||||
vector<int>::const_iterator cit =
|
||||
vertices_[i].out_vertices.begin();
|
||||
vector<int>::const_iterator end =
|
||||
vertices_[i].out_vertices.end();
|
||||
for (; cit != end; ++cit)
|
||||
if (!visited_[*cit]) {
|
||||
visited_[*cit] = true;
|
||||
Q_.push(*cit);
|
||||
}
|
||||
}
|
||||
|
||||
@ -457,27 +467,32 @@ Converters::GetReachable(string const & from, bool only_viewable,
|
||||
}
|
||||
|
||||
|
||||
bool Converters::IsReachable(string const & from, string const & to)
|
||||
bool Converters::isReachable(string const & from, string const & to)
|
||||
{
|
||||
if (from == to)
|
||||
return true;
|
||||
|
||||
int const s = BFS_init(from);
|
||||
int const t = formats.GetNumber(to);
|
||||
int const s = bfs_init(from);
|
||||
int const t = formats.getNumber(to);
|
||||
if (s < 0 || t < 0)
|
||||
return false;
|
||||
|
||||
while (!Q.empty()) {
|
||||
int const i = Q.front();
|
||||
Q.pop();
|
||||
while (!Q_.empty()) {
|
||||
int const i = Q_.front();
|
||||
Q_.pop();
|
||||
if (i == t)
|
||||
return true;
|
||||
for (vector<int>::iterator it = vertices[i].out_vertices.begin();
|
||||
it != vertices[i].out_vertices.end(); ++it)
|
||||
if (!visited[*it]) {
|
||||
visited[*it] = true;
|
||||
Q.push(*it);
|
||||
|
||||
vector<int>::const_iterator cit =
|
||||
vertices_[i].out_vertices.begin();
|
||||
vector<int>::const_iterator end =
|
||||
vertices_[i].out_vertices.end();
|
||||
for (; cit != end; ++cit) {
|
||||
if (!visited_[*cit]) {
|
||||
visited_[*cit] = true;
|
||||
Q_.push(*cit);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
@ -485,14 +500,14 @@ bool Converters::IsReachable(string const & from, string const & to)
|
||||
|
||||
|
||||
Converters::EdgePath const
|
||||
Converters::GetPath(string const & from, string const & to)
|
||||
Converters::getPath(string const & from, string const & to)
|
||||
{
|
||||
EdgePath path;
|
||||
if (from == to)
|
||||
return path;
|
||||
|
||||
int const s = BFS_init(from);
|
||||
int t = formats.GetNumber(to);
|
||||
int const s = bfs_init(from);
|
||||
int t = formats.getNumber(to);
|
||||
if (s < 0 || t < 0)
|
||||
return path;
|
||||
|
||||
@ -500,21 +515,26 @@ Converters::GetPath(string const & from, string const & to)
|
||||
vector<int> prev_vertex(formats.size());
|
||||
|
||||
bool found = false;
|
||||
while (!Q.empty()) {
|
||||
int const i = Q.front();
|
||||
Q.pop();
|
||||
while (!Q_.empty()) {
|
||||
int const i = Q_.front();
|
||||
Q_.pop();
|
||||
if (i == t) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
for (vector<int>::iterator it = vertices[i].out_vertices.begin();
|
||||
it != vertices[i].out_vertices.end(); ++it)
|
||||
if (!visited[*it]) {
|
||||
int const j = *it;
|
||||
visited[j] = true;
|
||||
Q.push(j);
|
||||
int const k = it - vertices[i].out_vertices.begin();
|
||||
prev_edge[j] = vertices[i].out_edges[k];
|
||||
|
||||
vector<int>::const_iterator beg =
|
||||
vertices_[i].out_vertices.begin();
|
||||
vector<int>::const_iterator cit = beg;
|
||||
vector<int>::const_iterator end =
|
||||
vertices_[i].out_vertices.end();
|
||||
for (; cit != end; ++cit)
|
||||
if (!visited_[*cit]) {
|
||||
int const j = *cit;
|
||||
visited_[j] = true;
|
||||
Q_.push(j);
|
||||
int const k = cit - beg;
|
||||
prev_edge[j] = vertices_[i].out_edges[k];
|
||||
prev_vertex[j] = i;
|
||||
}
|
||||
}
|
||||
@ -530,11 +550,11 @@ Converters::GetPath(string const & from, string const & to)
|
||||
}
|
||||
|
||||
|
||||
bool Converters::UsePdflatex(EdgePath const & path)
|
||||
bool Converters::usePdflatex(EdgePath const & path)
|
||||
{
|
||||
for (EdgePath::const_iterator cit = path.begin();
|
||||
cit != path.end(); ++cit) {
|
||||
Converter const & conv = converterlist[*cit];
|
||||
Converter const & conv = converterlist_[*cit];
|
||||
if (conv.latex)
|
||||
return contains(conv.to, "pdf");
|
||||
}
|
||||
@ -542,23 +562,23 @@ bool Converters::UsePdflatex(EdgePath const & path)
|
||||
}
|
||||
|
||||
|
||||
bool Converters::Convert(Buffer const * buffer,
|
||||
bool Converters::convert(Buffer const * buffer,
|
||||
string const & from_file, string const & to_file_base,
|
||||
string const & from_format, string const & to_format,
|
||||
string & to_file)
|
||||
{
|
||||
to_file = ChangeExtension(to_file_base,
|
||||
formats.Extension(to_format));
|
||||
formats.extension(to_format));
|
||||
|
||||
if (from_format == to_format)
|
||||
return Move(from_file, to_file, false);
|
||||
return move(from_file, to_file, false);
|
||||
|
||||
EdgePath edgepath = GetPath(from_format, to_format);
|
||||
EdgePath edgepath = getPath(from_format, to_format);
|
||||
if (edgepath.empty()) {
|
||||
WriteAlert(_("Can not convert file"),
|
||||
_("No information for converting from ")
|
||||
+ formats.PrettyName(from_format) + _(" to ")
|
||||
+ formats.PrettyName(to_format));
|
||||
+ formats.prettyName(from_format) + _(" to ")
|
||||
+ formats.prettyName(to_format));
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -572,7 +592,7 @@ bool Converters::Convert(Buffer const * buffer,
|
||||
string outfile = from_file;
|
||||
for (EdgePath::const_iterator cit = edgepath.begin();
|
||||
cit != edgepath.end(); ++cit) {
|
||||
Converter const & conv = converterlist[*cit];
|
||||
Converter const & conv = converterlist_[*cit];
|
||||
bool dummy = conv.To->dummy() && conv.to != "program";
|
||||
if (!dummy)
|
||||
lyxerr[Debug::FILES] << "Converting from "
|
||||
@ -593,11 +613,11 @@ bool Converters::Convert(Buffer const * buffer,
|
||||
return false;
|
||||
} else {
|
||||
if (conv.need_aux && !run_latex
|
||||
&& !latex_command.empty()) {
|
||||
&& !latex_command_.empty()) {
|
||||
lyxerr[Debug::FILES]
|
||||
<< "Running " << latex_command
|
||||
<< "Running " << latex_command_
|
||||
<< " to update aux file"<< endl;
|
||||
runLaTeX(buffer, latex_command);
|
||||
runLaTeX(buffer, latex_command_);
|
||||
}
|
||||
|
||||
string infile2 = (conv.original_dir)
|
||||
@ -657,7 +677,7 @@ bool Converters::Convert(Buffer const * buffer,
|
||||
}
|
||||
}
|
||||
|
||||
Converter const & conv = converterlist[edgepath.back()];
|
||||
Converter const & conv = converterlist_[edgepath.back()];
|
||||
if (conv.To->dummy())
|
||||
return true;
|
||||
|
||||
@ -679,12 +699,12 @@ bool Converters::Convert(Buffer const * buffer,
|
||||
}
|
||||
return true;
|
||||
} else
|
||||
return Move(outfile, to_file, conv.latex);
|
||||
return move(outfile, to_file, conv.latex);
|
||||
}
|
||||
|
||||
// If from = /path/file.ext and to = /path2/file2.ext2 then this method
|
||||
// moves each /path/file*.ext file to /path2/file2*.ext2'
|
||||
bool Converters::Move(string const & from, string const & to, bool copy)
|
||||
bool Converters::move(string const & from, string const & to, bool copy)
|
||||
{
|
||||
if (from == to)
|
||||
return true;
|
||||
@ -716,39 +736,41 @@ bool Converters::Move(string const & from, string const & to, bool copy)
|
||||
return no_errors;
|
||||
}
|
||||
|
||||
bool Converters::Convert(Buffer const * buffer,
|
||||
|
||||
bool Converters::convert(Buffer const * buffer,
|
||||
string const & from_file, string const & to_file_base,
|
||||
string const & from_format, string const & to_format)
|
||||
{
|
||||
string to_file;
|
||||
return Convert(buffer, from_file, to_file_base, from_format, to_format,
|
||||
return convert(buffer, from_file, to_file_base, from_format, to_format,
|
||||
to_file);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Converters::BuildGraph()
|
||||
void Converters::buildGraph()
|
||||
{
|
||||
vertices = vector<Vertex>(formats.size());
|
||||
visited.resize(formats.size());
|
||||
vertices_ = vector<Vertex>(formats.size());
|
||||
visited_.resize(formats.size());
|
||||
|
||||
for (ConverterList::iterator it = converterlist.begin();
|
||||
it != converterlist.end(); ++it) {
|
||||
int const s = formats.GetNumber(it->from);
|
||||
int const t = formats.GetNumber(it->to);
|
||||
vertices[t].in_vertices.push_back(s);
|
||||
vertices[s].out_vertices.push_back(t);
|
||||
vertices[s].out_edges.push_back(it - converterlist.begin());
|
||||
for (ConverterList::iterator it = converterlist_.begin();
|
||||
it != converterlist_.end(); ++it) {
|
||||
int const s = formats.getNumber(it->from);
|
||||
int const t = formats.getNumber(it->to);
|
||||
vertices_[t].in_vertices.push_back(s);
|
||||
vertices_[s].out_vertices.push_back(t);
|
||||
vertices_[s].out_edges.push_back(it - converterlist_.begin());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool Converters::FormatIsUsed(string const & format)
|
||||
bool Converters::formatIsUsed(string const & format)
|
||||
{
|
||||
for (ConverterList::const_iterator cit = converterlist.begin();
|
||||
cit != converterlist.end(); ++cit)
|
||||
ConverterList::const_iterator cit = converterlist_.begin();
|
||||
ConverterList::const_iterator end = converterlist_.end();
|
||||
for (; cit != end; ++cit) {
|
||||
if (cit->from == format || cit->to == format)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -928,7 +950,7 @@ string const Converters::dvips_options(Buffer const * buffer)
|
||||
result += ' ' + buffer->params.paperwidth;
|
||||
result += ',' + buffer->params.paperheight;
|
||||
} else {
|
||||
string paper_option = papersize(buffer);
|
||||
string const paper_option = papersize(buffer);
|
||||
if (paper_option != "letter" ||
|
||||
buffer->params.orientation != BufferParams::ORIENTATION_LANDSCAPE) {
|
||||
// dvips won't accept -t letter -t landscape. In all other
|
||||
@ -951,7 +973,7 @@ string const Converters::dvipdfm_options(Buffer const * buffer)
|
||||
return result;
|
||||
|
||||
if (buffer->params.papersize2 != BufferParams::VM_PAPER_CUSTOM) {
|
||||
string paper_size = papersize(buffer);
|
||||
string const paper_size = papersize(buffer);
|
||||
if (paper_size != "b5" && paper_size != "foolscap")
|
||||
result = "-p "+ paper_size;
|
||||
|
||||
@ -963,7 +985,7 @@ string const Converters::dvipdfm_options(Buffer const * buffer)
|
||||
}
|
||||
|
||||
|
||||
vector<Converters::Vertex> Converters::vertices;
|
||||
vector<Converters::Vertex> Converters::vertices_;
|
||||
|
||||
|
||||
/// The global instance
|
||||
|
@ -34,9 +34,9 @@ public:
|
||||
///
|
||||
bool dummy() const;
|
||||
///
|
||||
bool IsChildFormat() const;
|
||||
bool isChildFormat() const;
|
||||
///
|
||||
string const ParentFormat() const;
|
||||
string const parentFormat() const;
|
||||
///
|
||||
string const & name() const {
|
||||
return name_;
|
||||
@ -77,7 +77,7 @@ private:
|
||||
inline
|
||||
bool operator<(Format const & a, Format const & b)
|
||||
{
|
||||
return compare_no_case(a.prettyname(),b.prettyname()) < 0;
|
||||
return compare_no_case(a.prettyname(), b.prettyname()) < 0;
|
||||
}
|
||||
|
||||
|
||||
@ -89,31 +89,31 @@ public:
|
||||
///
|
||||
typedef FormatList::const_iterator const_iterator;
|
||||
///
|
||||
Format const & Get(FormatList::size_type i) const {
|
||||
Format const & get(FormatList::size_type i) const {
|
||||
return formatlist[i];
|
||||
}
|
||||
///
|
||||
Format const * GetFormat(string const & name) const;
|
||||
Format const * getFormat(string const & name) const;
|
||||
///
|
||||
int GetNumber(string const & name) const;
|
||||
int getNumber(string const & name) const;
|
||||
///
|
||||
void Add(string const & name);
|
||||
void add(string const & name);
|
||||
///
|
||||
void Add(string const & name, string const & extension,
|
||||
void add(string const & name, string const & extension,
|
||||
string const & prettyname, string const & shortcut);
|
||||
///
|
||||
void Delete(string const & name);
|
||||
void erase(string const & name);
|
||||
///
|
||||
void Sort();
|
||||
void sort();
|
||||
///
|
||||
void SetViewer(string const & name, string const & command);
|
||||
void setViewer(string const & name, string const & command);
|
||||
///
|
||||
bool View(Buffer const * buffer, string const & filename,
|
||||
bool view(Buffer const * buffer, string const & filename,
|
||||
string const & format_name) const;
|
||||
///
|
||||
string const PrettyName(string const & name) const;
|
||||
string const prettyName(string const & name) const;
|
||||
///
|
||||
string const Extension(string const & name) const;
|
||||
string const extension(string const & name) const;
|
||||
///
|
||||
const_iterator begin() const {
|
||||
return formatlist.begin();
|
||||
@ -142,7 +142,7 @@ public:
|
||||
: from(f), to(t), command(c), flags(l), From(0), To(0),
|
||||
latex(false), original_dir(false), need_aux(false) {}
|
||||
///
|
||||
void ReadFlags();
|
||||
void readFlags();
|
||||
///
|
||||
string from;
|
||||
///
|
||||
@ -182,40 +182,40 @@ public:
|
||||
///
|
||||
typedef std::vector<int> EdgePath;
|
||||
///
|
||||
Converter const & Get(int i) const {
|
||||
return converterlist[i];
|
||||
Converter const & get(int i) const {
|
||||
return converterlist_[i];
|
||||
}
|
||||
///
|
||||
Converter const * GetConverter(string const & from, string const & to);
|
||||
Converter const * getConverter(string const & from, string const & to);
|
||||
///
|
||||
int GetNumber(string const & from, string const & to);
|
||||
int getNumber(string const & from, string const & to);
|
||||
///
|
||||
void Add(string const & from, string const & to,
|
||||
void add(string const & from, string const & to,
|
||||
string const & command, string const & flags);
|
||||
//
|
||||
void Delete(string const & from, string const & to);
|
||||
void erase(string const & from, string const & to);
|
||||
///
|
||||
void Sort();
|
||||
void sort();
|
||||
///
|
||||
std::vector<Format const *> const
|
||||
GetReachableTo(string const & target, bool clear_visited);
|
||||
getReachableTo(string const & target, bool clear_visited);
|
||||
///
|
||||
std::vector<Format const *> const
|
||||
GetReachable(string const & from, bool only_viewable,
|
||||
getReachable(string const & from, bool only_viewable,
|
||||
bool clear_visited);
|
||||
///
|
||||
bool IsReachable(string const & from, string const & to);
|
||||
bool isReachable(string const & from, string const & to);
|
||||
///
|
||||
EdgePath const GetPath(string const & from, string const & to);
|
||||
EdgePath const getPath(string const & from, string const & to);
|
||||
///
|
||||
bool UsePdflatex(EdgePath const & path);
|
||||
bool usePdflatex(EdgePath const & path);
|
||||
///
|
||||
bool Convert(Buffer const * buffer,
|
||||
bool convert(Buffer const * buffer,
|
||||
string const & from_file, string const & to_file_base,
|
||||
string const & from_format, string const & to_format,
|
||||
string & to_file);
|
||||
///
|
||||
bool Convert(Buffer const * buffer,
|
||||
bool convert(Buffer const * buffer,
|
||||
string const & from_file, string const & to_file_base,
|
||||
string const & from_format, string const & to_format);
|
||||
///
|
||||
@ -225,19 +225,19 @@ public:
|
||||
///
|
||||
string const dvipdfm_options(Buffer const * buffer);
|
||||
///
|
||||
void Update(Formats const & formats);
|
||||
void update(Formats const & formats);
|
||||
///
|
||||
void UpdateLast(Formats const & formats);
|
||||
void updateLast(Formats const & formats);
|
||||
///
|
||||
void BuildGraph();
|
||||
void buildGraph();
|
||||
///
|
||||
bool FormatIsUsed(string const & format);
|
||||
bool formatIsUsed(string const & format);
|
||||
///
|
||||
const_iterator begin() const {
|
||||
return converterlist.begin();
|
||||
return converterlist_.begin();
|
||||
}
|
||||
const_iterator end() const {
|
||||
return converterlist.end();
|
||||
return converterlist_.end();
|
||||
}
|
||||
private:
|
||||
///
|
||||
@ -246,9 +246,9 @@ private:
|
||||
///
|
||||
bool runLaTeX(Buffer const * buffer, string const & command);
|
||||
///
|
||||
ConverterList converterlist;
|
||||
ConverterList converterlist_;
|
||||
///
|
||||
string latex_command;
|
||||
string latex_command_;
|
||||
///
|
||||
struct Vertex {
|
||||
std::vector<int> in_vertices;
|
||||
@ -257,15 +257,15 @@ private:
|
||||
};
|
||||
///
|
||||
static
|
||||
std::vector<Vertex> vertices;
|
||||
std::vector<Vertex> vertices_;
|
||||
///
|
||||
std::vector<bool> visited;
|
||||
std::vector<bool> visited_;
|
||||
///
|
||||
std::queue<int> Q;
|
||||
std::queue<int> Q_;
|
||||
///
|
||||
int BFS_init(string const & start, bool clear_visited = true);
|
||||
int bfs_init(string const & start, bool clear_visited = true);
|
||||
///
|
||||
bool Move(string const & from, string const & to, bool copy);
|
||||
bool move(string const & from, string const & to, bool copy);
|
||||
};
|
||||
|
||||
extern Formats formats;
|
||||
|
@ -37,9 +37,9 @@ bool Exporter::Export(Buffer * buffer, string const & format,
|
||||
for (vector<string>::const_iterator it = backends.begin();
|
||||
it != backends.end(); ++it) {
|
||||
Converters::EdgePath p =
|
||||
converters.GetPath(*it, format);
|
||||
converters.getPath(*it, format);
|
||||
if (!p.empty()) {
|
||||
lyxrc.pdf_mode = converters.UsePdflatex(p);
|
||||
lyxrc.pdf_mode = converters.usePdflatex(p);
|
||||
backend_format = *it;
|
||||
break;
|
||||
}
|
||||
@ -47,7 +47,7 @@ bool Exporter::Export(Buffer * buffer, string const & format,
|
||||
if (backend_format.empty()) {
|
||||
WriteAlert(_("Can not export file"),
|
||||
_("No information for exporting to ")
|
||||
+ formats.PrettyName(format));
|
||||
+ formats.prettyName(format));
|
||||
return false;
|
||||
}
|
||||
} else
|
||||
@ -57,7 +57,7 @@ bool Exporter::Export(Buffer * buffer, string const & format,
|
||||
if (!buffer->tmppath.empty())
|
||||
filename = AddName(buffer->tmppath, filename);
|
||||
filename = ChangeExtension(filename,
|
||||
formats.Extension(backend_format));
|
||||
formats.extension(backend_format));
|
||||
|
||||
// Ascii backend
|
||||
if (backend_format == "text")
|
||||
@ -81,14 +81,14 @@ bool Exporter::Export(Buffer * buffer, string const & format,
|
||||
string outfile_base = (put_in_tempdir)
|
||||
? filename : buffer->getLatexName(false);
|
||||
|
||||
if (!converters.Convert(buffer, filename, outfile_base,
|
||||
if (!converters.convert(buffer, filename, outfile_base,
|
||||
backend_format, format, result_file))
|
||||
return false;
|
||||
|
||||
if (!put_in_tempdir)
|
||||
ShowMessage(buffer,
|
||||
_("Document exported as ")
|
||||
+ formats.PrettyName(format)
|
||||
+ formats.prettyName(format)
|
||||
+ _(" to file `")
|
||||
+ MakeDisplayPath(result_file) +'\'');
|
||||
return true;
|
||||
@ -106,7 +106,7 @@ bool Exporter::Preview(Buffer * buffer, string const & format)
|
||||
string result_file;
|
||||
if (!Export(buffer, format, true, result_file))
|
||||
return false;
|
||||
return formats.View(buffer, result_file, format);
|
||||
return formats.view(buffer, result_file, format);
|
||||
}
|
||||
|
||||
|
||||
@ -115,7 +115,7 @@ bool Exporter::IsExportable(Buffer const * buffer, string const & format)
|
||||
vector<string> backends = Backends(buffer);
|
||||
for (vector<string>::const_iterator it = backends.begin();
|
||||
it != backends.end(); ++it)
|
||||
if (converters.IsReachable(*it, format))
|
||||
if (converters.isReachable(*it, format))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
@ -126,11 +126,11 @@ Exporter::GetExportableFormats(Buffer const * buffer, bool only_viewable)
|
||||
{
|
||||
vector<string> backends = Backends(buffer);
|
||||
vector<Format const *> result =
|
||||
converters.GetReachable(backends[0], only_viewable, true);
|
||||
converters.getReachable(backends[0], only_viewable, true);
|
||||
for (vector<string>::const_iterator it = backends.begin() + 1;
|
||||
it != backends.end(); ++it) {
|
||||
vector<Format const *> r =
|
||||
converters.GetReachable(*it, only_viewable, false);
|
||||
converters.getReachable(*it, only_viewable, false);
|
||||
result.insert(result.end(), r.begin(), r.end());
|
||||
}
|
||||
return result;
|
||||
|
@ -44,6 +44,7 @@ class InsetInfo;
|
||||
class InsetTabular;
|
||||
class InsetCommand;
|
||||
class InsetMinipage;
|
||||
class InsetFloat;
|
||||
class Paragraph;
|
||||
|
||||
/** Container of all dialogs and signals a LyXView needs or uses to access them
|
||||
@ -124,6 +125,8 @@ public:
|
||||
///
|
||||
SigC::Signal1<void, InsetMinipage *> updateMinipage;
|
||||
///
|
||||
SigC::Signal1<void, InsetFloat *> showFloat;
|
||||
///
|
||||
SigC::Signal0<void> showParagraph;
|
||||
///
|
||||
SigC::Signal0<void> updateParagraph;
|
||||
|
@ -1,3 +1,12 @@
|
||||
2001-07-30 Lars Gullik Bjønnes <larsbj@birdstep.com>
|
||||
|
||||
* Makefile.am (libcontrollers_la_SOURCES): add ControlFloat.h and
|
||||
ControlFloat.C
|
||||
|
||||
* GUI.h: add class GUIFloat
|
||||
|
||||
* ControlFloat.[Ch]: new files
|
||||
|
||||
2001-07-30 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
|
||||
|
||||
* ControlPrint.C: #include Lassert.h here.
|
||||
|
@ -25,12 +25,14 @@
|
||||
#include "buffer.h"
|
||||
#include "insets/inseterror.h"
|
||||
|
||||
|
||||
ControlError::ControlError(LyXView & lv, Dialogs & d)
|
||||
: ControlInset<InsetError, string>(lv, d)
|
||||
{
|
||||
d_.showError.connect(SigC::slot(this, &ControlError::showInset));
|
||||
}
|
||||
|
||||
|
||||
string const ControlError::getParams(InsetError const & inset)
|
||||
{
|
||||
return inset.getContents();
|
||||
|
66
src/frontends/controllers/ControlFloat.C
Normal file
66
src/frontends/controllers/ControlFloat.C
Normal file
@ -0,0 +1,66 @@
|
||||
/* This file is part of
|
||||
* ======================================================
|
||||
*
|
||||
* LyX, The Document Processor
|
||||
*
|
||||
* Copyright 2001 The LyX Team.
|
||||
*
|
||||
* ======================================================
|
||||
*
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation
|
||||
#endif
|
||||
|
||||
#include "ViewBase.h"
|
||||
#include "ButtonControllerBase.h"
|
||||
#include "ControlFloat.h"
|
||||
#include "Dialogs.h"
|
||||
#include "LyXView.h"
|
||||
#include "buffer.h"
|
||||
#include "BufferView.h"
|
||||
#include "insets/insetfloat.h"
|
||||
|
||||
using std::vector;
|
||||
using SigC::slot;
|
||||
|
||||
|
||||
ControlFloat::ControlFloat(LyXView & lv, Dialogs & d)
|
||||
: ControlInset<InsetFloat, FloatParams>(lv, d)
|
||||
{
|
||||
d_.showFloat.connect(slot(this, &ControlFloat::showInset));
|
||||
|
||||
// We could have an extra method updateInset that calls
|
||||
// view().update() rather than view().show(), but I don't see why
|
||||
// it is really needed.
|
||||
//d_.updateFloat.connect(slot(this, &ControlFloat::showInset));
|
||||
}
|
||||
|
||||
|
||||
void ControlFloat::applyParamsToInset()
|
||||
{
|
||||
inset()->placement(params().placement);
|
||||
}
|
||||
|
||||
|
||||
void ControlFloat::applyParamsNoInset()
|
||||
{}
|
||||
|
||||
|
||||
FloatParams const ControlFloat::getParams(InsetFloat const & inset)
|
||||
{
|
||||
return FloatParams(inset);
|
||||
}
|
||||
|
||||
|
||||
FloatParams::FloatParams()
|
||||
: placement("htbp")
|
||||
{}
|
||||
|
||||
|
||||
FloatParams::FloatParams(InsetFloat const & inset)
|
||||
: placement(inset.placement())
|
||||
{}
|
63
src/frontends/controllers/ControlFloat.h
Normal file
63
src/frontends/controllers/ControlFloat.h
Normal file
@ -0,0 +1,63 @@
|
||||
// -*- C++ -*-
|
||||
/* This file is part of
|
||||
* ======================================================
|
||||
*
|
||||
* LyX, The Document Processor
|
||||
*
|
||||
* Copyright 2001 The LyX Team.
|
||||
*
|
||||
*======================================================
|
||||
*
|
||||
* \file ControlFloat.h
|
||||
*/
|
||||
|
||||
#ifndef CONTROLFLOAT_H
|
||||
#define CONTROLFLOAT_H
|
||||
|
||||
#include <vector>
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
#include "ControlInset.h"
|
||||
|
||||
class InsetFloat;
|
||||
|
||||
///
|
||||
struct FloatParams {
|
||||
///
|
||||
FloatParams();
|
||||
///
|
||||
FloatParams(InsetFloat const &);
|
||||
///
|
||||
string placement;
|
||||
};
|
||||
|
||||
|
||||
inline
|
||||
bool operator==(FloatParams const & p1, FloatParams const & p2)
|
||||
{
|
||||
return p1.placement == p2.placement;
|
||||
}
|
||||
|
||||
|
||||
/** A controller for Minipage dialogs.
|
||||
*/
|
||||
class ControlFloat : public ControlInset<InsetFloat, FloatParams> {
|
||||
public:
|
||||
///
|
||||
ControlFloat(LyXView &, Dialogs &);
|
||||
private:
|
||||
/// Dispatch the changed parameters to the kernel.
|
||||
virtual void applyParamsToInset();
|
||||
///
|
||||
virtual void applyParamsNoInset();
|
||||
/// get the parameters from the string passed to createInset.
|
||||
virtual FloatParams const getParams(string const &)
|
||||
{ return FloatParams(); }
|
||||
/// get the parameters from the inset passed to showInset.
|
||||
virtual FloatParams const getParams(InsetFloat const &);
|
||||
};
|
||||
|
||||
#endif
|
@ -71,15 +71,17 @@ MinipageParams::MinipageParams(InsetMinipage const & inset)
|
||||
: width(inset.width()), pos(inset.pos())
|
||||
{}
|
||||
|
||||
bool MinipageParams::operator==(MinipageParams const & o) const
|
||||
|
||||
bool operator==(MinipageParams const & p1, MinipageParams const & p2)
|
||||
{
|
||||
return (width == o.width && pos == o.pos);
|
||||
return (p1.width == p2.width && p1.pos == p2.pos);
|
||||
}
|
||||
|
||||
bool MinipageParams::operator!=(MinipageParams const & o) const
|
||||
{
|
||||
return !(*this == o);
|
||||
}
|
||||
|
||||
//bool operator!=(MinipageParams const & p1, MinipageParams const & p2)
|
||||
//{
|
||||
// return !(p1 == p2);
|
||||
//}
|
||||
|
||||
namespace minipage {
|
||||
|
||||
@ -87,7 +89,7 @@ vector<string> const getUnits()
|
||||
{
|
||||
vector<string> units;
|
||||
const char * str;
|
||||
for(int i=0;(str=stringFromUnit(i));++i)
|
||||
for(int i=0; (str = stringFromUnit(i)); ++i)
|
||||
units.push_back(str);
|
||||
|
||||
return units;
|
||||
|
@ -33,11 +33,6 @@ struct MinipageParams {
|
||||
MinipageParams();
|
||||
///
|
||||
MinipageParams(InsetMinipage const &);
|
||||
///
|
||||
bool operator==(MinipageParams const &) const;
|
||||
///
|
||||
bool operator!=(MinipageParams const &) const;
|
||||
|
||||
///
|
||||
string width;
|
||||
///
|
||||
@ -45,8 +40,11 @@ struct MinipageParams {
|
||||
};
|
||||
|
||||
|
||||
class InsetMinipage;
|
||||
class MinipageParams;
|
||||
///
|
||||
bool operator==(MinipageParams const &, MinipageParams const &);
|
||||
///
|
||||
//bool operator!=(MinipageParams const &, MinipageParams const &);
|
||||
|
||||
|
||||
/** A controller for Minipage dialogs.
|
||||
*/
|
||||
|
@ -223,6 +223,20 @@ public:
|
||||
};
|
||||
|
||||
|
||||
/** Specialization for Float dialog
|
||||
*/
|
||||
class ControlFloat;
|
||||
|
||||
template <class GUIview, class GUIbc>
|
||||
class GUIFloat :
|
||||
public GUI<ControlFloat, GUIview, NoRepeatedApplyReadOnlyPolicy, GUIbc> {
|
||||
public:
|
||||
///
|
||||
GUIFloat(LyXView & lv, Dialogs & d)
|
||||
: GUI<ControlFloat, GUIview, NoRepeatedApplyReadOnlyPolicy, GUIbc>(lv, d) {}
|
||||
};
|
||||
|
||||
|
||||
/** Specialization for Preamble dialog
|
||||
*/
|
||||
class ControlPreamble;
|
||||
|
@ -40,6 +40,8 @@ libcontrollers_la_SOURCES=\
|
||||
ControlError.C \
|
||||
ControlExternal.h \
|
||||
ControlExternal.C \
|
||||
ControlFloat.h \
|
||||
ControlFloat.C \
|
||||
ControlGraphics.h \
|
||||
ControlGraphics.C \
|
||||
ControlInclude.C \
|
||||
|
@ -1,3 +1,18 @@
|
||||
2001-07-30 Lars Gullik Bjønnes <larsbj@birdstep.com>
|
||||
|
||||
* forms/makefile (SRCS): add form_float.fd
|
||||
|
||||
* forms/form_float.fd: new file
|
||||
|
||||
* form_float.[Ch]: new files
|
||||
|
||||
* Makefile.am (libxforms_la_SOURCES): add FormFloat.C,
|
||||
FormFloat.h, form_float.C and form_float.h
|
||||
|
||||
* FormFloat.[Ch]: new files
|
||||
|
||||
* Dialogs.C: init GUIFloat is well
|
||||
|
||||
2001-07-29 Asger Alstrup Nielsen <alstrup@alstrup>
|
||||
|
||||
* FormToc.C (updateType): Fix problem with TOC that couldn't be
|
||||
|
@ -26,9 +26,10 @@
|
||||
#include "ControlCharacter.h"
|
||||
#include "ControlCitation.h"
|
||||
#include "ControlError.h"
|
||||
#include "ControlExternal.h"
|
||||
#include "ControlExternal.h"
|
||||
#include "ControlFloat.h"
|
||||
#include "ControlGraphics.h"
|
||||
#include "insets/insetgraphicsParams.h"
|
||||
#include "insets/insetgraphicsParams.h"
|
||||
#include "ControlInclude.h"
|
||||
#include "ControlIndex.h"
|
||||
#include "ControlLog.h"
|
||||
@ -55,7 +56,8 @@
|
||||
#include "form_character.h"
|
||||
#include "form_citation.h"
|
||||
#include "form_error.h"
|
||||
#include "form_external.h"
|
||||
#include "form_external.h"
|
||||
#include "form_float.h"
|
||||
#include "form_graphics.h"
|
||||
#include "form_include.h"
|
||||
#include "form_index.h"
|
||||
@ -77,7 +79,8 @@
|
||||
#include "FormCharacter.h"
|
||||
#include "FormCitation.h"
|
||||
#include "FormError.h"
|
||||
#include "FormExternal.h"
|
||||
#include "FormExternal.h"
|
||||
#include "FormFloat.h"
|
||||
#include "FormGraphics.h"
|
||||
#include "FormInclude.h"
|
||||
#include "FormIndex.h"
|
||||
@ -121,6 +124,7 @@ Dialogs::Dialogs(LyXView * lv)
|
||||
add(new GUIIndex<FormIndex, xformsBC>(*lv, *this));
|
||||
add(new GUILog<FormLog, xformsBC>(*lv, *this));
|
||||
add(new GUIMinipage<FormMinipage, xformsBC>(*lv, *this));
|
||||
add(new GUIFloat<FormFloat, xformsBC>(*lv, *this));
|
||||
add(new GUIPreamble<FormPreamble, xformsBC>(*lv, *this));
|
||||
add(new GUIPrint<FormPrint, xformsBC>(*lv, *this));
|
||||
add(new GUIRef<FormRef, xformsBC>(*lv, *this));
|
||||
|
113
src/frontends/xforms/FormFloat.C
Normal file
113
src/frontends/xforms/FormFloat.C
Normal file
@ -0,0 +1,113 @@
|
||||
/* This file is part of
|
||||
* ======================================================
|
||||
*
|
||||
* LyX, The Document Processor
|
||||
*
|
||||
* Copyright 2001 The LyX Team.
|
||||
*
|
||||
* ======================================================
|
||||
*
|
||||
* \file FormFloat.C
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation
|
||||
#endif
|
||||
|
||||
#include "xformsBC.h"
|
||||
#include "ControlFloat.h"
|
||||
#include "FormFloat.h"
|
||||
#include "form_float.h"
|
||||
#include "support/lstrings.h"
|
||||
|
||||
typedef FormCB<ControlFloat, FormDB<FD_form_float> > base_class;
|
||||
|
||||
FormFloat::FormFloat(ControlFloat & c)
|
||||
: base_class(c, _("Float Options"))
|
||||
{}
|
||||
|
||||
|
||||
#warning Needs to be implemented. (Lgb)
|
||||
// A way to set to float default is missing.
|
||||
// A way to set "force[!]" is missing.
|
||||
// Also there are two groups of buttons [Here] and [top,bottom,page,here],
|
||||
// is is not really possible to choose from both groups. So this should
|
||||
// be disallowed by the dialog too.
|
||||
|
||||
void FormFloat::build()
|
||||
{
|
||||
dialog_.reset(build_float());
|
||||
|
||||
// Manage the ok, apply and cancel/close buttons
|
||||
bc().setOK(dialog_->button_ok);
|
||||
bc().setApply(dialog_->button_apply);
|
||||
bc().setCancel(dialog_->button_cancel);
|
||||
bc().setRestore(dialog_->button_restore);
|
||||
|
||||
bc().addReadOnly(dialog_->radio_top);
|
||||
bc().addReadOnly(dialog_->radio_bottom);
|
||||
bc().addReadOnly(dialog_->radio_page);
|
||||
bc().addReadOnly(dialog_->radio_here);
|
||||
bc().addReadOnly(dialog_->Here);
|
||||
}
|
||||
|
||||
|
||||
void FormFloat::apply()
|
||||
{
|
||||
string placement;
|
||||
if (fl_get_button(dialog_->Here)) {
|
||||
placement += "H";
|
||||
} else {
|
||||
if (fl_get_button(dialog_->radio_top)) {
|
||||
placement += "t";
|
||||
}
|
||||
if (fl_get_button(dialog_->radio_bottom)) {
|
||||
placement += "b";
|
||||
}
|
||||
if (fl_get_button(dialog_->radio_page)) {
|
||||
placement += "p";
|
||||
}
|
||||
if (fl_get_button(dialog_->radio_here)) {
|
||||
placement += "h";
|
||||
}
|
||||
}
|
||||
controller().params().placement = placement;
|
||||
}
|
||||
|
||||
|
||||
void FormFloat::update()
|
||||
{
|
||||
bool top = false;
|
||||
bool bottom = false;
|
||||
bool page = false;
|
||||
bool here = false;
|
||||
bool Here = false;
|
||||
|
||||
string placement(controller().params().placement);
|
||||
|
||||
if (contains(placement, "H")) {
|
||||
Here = true;
|
||||
} else {
|
||||
if (contains(placement, "t")) {
|
||||
top = true;
|
||||
}
|
||||
if (contains(placement, "b")) {
|
||||
bottom = true;
|
||||
}
|
||||
if (contains(placement, "p")) {
|
||||
page = true;
|
||||
}
|
||||
if (contains(placement, "h")) {
|
||||
here = true;
|
||||
}
|
||||
}
|
||||
fl_set_button(dialog_->radio_top, top);
|
||||
fl_set_button(dialog_->radio_bottom, bottom);
|
||||
fl_set_button(dialog_->radio_page, page);
|
||||
fl_set_button(dialog_->radio_here, here);
|
||||
fl_set_button(dialog_->Here, Here);
|
||||
|
||||
}
|
||||
|
46
src/frontends/xforms/FormFloat.h
Normal file
46
src/frontends/xforms/FormFloat.h
Normal file
@ -0,0 +1,46 @@
|
||||
// -*- C++ -*-
|
||||
/* This file is part of
|
||||
* ======================================================
|
||||
*
|
||||
* LyX, The Document Processor
|
||||
*
|
||||
* Copyright 2001 The LyX Team.
|
||||
*
|
||||
*======================================================
|
||||
*
|
||||
* \file FormFloat.h
|
||||
*/
|
||||
|
||||
#ifndef FORMFLOAT_H
|
||||
#define FORMFLOAT_H
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
#include "FormBase.h"
|
||||
|
||||
class ControlFloat;
|
||||
struct FD_form_float;
|
||||
|
||||
/** This class provides an XForms implementation of the Float
|
||||
Dialog.
|
||||
*/
|
||||
class FormFloat : public FormCB<ControlFloat, FormDB<FD_form_float> > {
|
||||
public:
|
||||
///
|
||||
FormFloat(ControlFloat &);
|
||||
|
||||
private:
|
||||
/// Set the Params variable for the Controller.
|
||||
virtual void apply();
|
||||
/// Build the dialog.
|
||||
virtual void build();
|
||||
/// Update dialog before/whilst showing it.
|
||||
virtual void update();
|
||||
|
||||
/// Fdesign generated method
|
||||
FD_form_float * build_float();
|
||||
};
|
||||
|
||||
#endif // FORMFLOAT_H
|
@ -27,14 +27,11 @@ struct FD_form_minipage;
|
||||
/** This class provides an XForms implementation of the Minipage
|
||||
Dialog.
|
||||
*/
|
||||
class ControlMinipage;
|
||||
struct FD_form_minipage;
|
||||
|
||||
class FormMinipage : public FormCB<ControlMinipage, FormDB<FD_form_minipage> > {
|
||||
class FormMinipage
|
||||
: public FormCB<ControlMinipage, FormDB<FD_form_minipage> > {
|
||||
public:
|
||||
///
|
||||
FormMinipage(ControlMinipage &);
|
||||
|
||||
private:
|
||||
/// Set the Params variable for the Controller.
|
||||
virtual void apply();
|
||||
|
@ -957,8 +957,8 @@ FD_form_converters const * FormPreferences::Converters::dialog()
|
||||
void FormPreferences::Converters::apply() const
|
||||
{
|
||||
converters = local_converters;
|
||||
converters.Update(formats);
|
||||
converters.BuildGraph();
|
||||
converters.update(formats);
|
||||
converters.buildGraph();
|
||||
}
|
||||
|
||||
|
||||
@ -1023,7 +1023,7 @@ bool FormPreferences::Converters::input(FL_OBJECT const * const ob)
|
||||
return Add();
|
||||
|
||||
} else if (ob == dialog_->button_delete) {
|
||||
return Delete();
|
||||
return erase();
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -1033,14 +1033,14 @@ bool FormPreferences::Converters::input(FL_OBJECT const * const ob)
|
||||
void FormPreferences::Converters::update()
|
||||
{
|
||||
local_converters = converters;
|
||||
local_converters.Update(local_formats);
|
||||
local_converters.update(local_formats);
|
||||
UpdateBrowser();
|
||||
}
|
||||
|
||||
|
||||
void FormPreferences::Converters::UpdateBrowser()
|
||||
{
|
||||
local_converters.Sort();
|
||||
local_converters.sort();
|
||||
|
||||
fl_freeze_form(dialog_->form);
|
||||
fl_clear_browser(dialog_->browser_all);
|
||||
@ -1062,10 +1062,10 @@ bool FormPreferences::Converters::Add()
|
||||
string const command = fl_get_input(dialog_->input_converter);
|
||||
string const flags = fl_get_input(dialog_->input_flags);
|
||||
|
||||
Converter const * old = local_converters.GetConverter(from, to);
|
||||
local_converters.Add(from, to, command, flags);
|
||||
Converter const * old = local_converters.getConverter(from, to);
|
||||
local_converters.add(from, to, command, flags);
|
||||
if (!old) {
|
||||
local_converters.UpdateLast(local_formats);
|
||||
local_converters.updateLast(local_formats);
|
||||
UpdateBrowser();
|
||||
}
|
||||
setEnabled(dialog_->button_add, false);
|
||||
@ -1081,14 +1081,14 @@ bool FormPreferences::Converters::Browser()
|
||||
|
||||
fl_freeze_form(dialog_->form);
|
||||
|
||||
Converter const & c = local_converters.Get(i-1);
|
||||
int j = local_formats.GetNumber(c.from);
|
||||
Converter const & c = local_converters.get(i - 1);
|
||||
int j = local_formats.getNumber(c.from);
|
||||
if (j >= 0)
|
||||
fl_set_choice(dialog_->choice_from, j+1);
|
||||
fl_set_choice(dialog_->choice_from, j + 1);
|
||||
|
||||
j = local_formats.GetNumber(c.to);
|
||||
j = local_formats.getNumber(c.to);
|
||||
if (j >= 0)
|
||||
fl_set_choice(dialog_->choice_to, j+1);
|
||||
fl_set_choice(dialog_->choice_to, j + 1);
|
||||
|
||||
fl_set_input(dialog_->input_converter, c.command.c_str());
|
||||
fl_set_input(dialog_->input_flags, c.flags.c_str());
|
||||
@ -1104,12 +1104,12 @@ bool FormPreferences::Converters::Browser()
|
||||
}
|
||||
|
||||
|
||||
bool FormPreferences::Converters::Delete()
|
||||
bool FormPreferences::Converters::erase()
|
||||
{
|
||||
string const from = GetFrom();
|
||||
string const to = GetTo();
|
||||
|
||||
local_converters.Delete(from, to);
|
||||
local_converters.erase(from, to);
|
||||
UpdateBrowser();
|
||||
return true;
|
||||
}
|
||||
@ -1119,7 +1119,7 @@ bool FormPreferences::Converters::Input()
|
||||
{
|
||||
string const from = GetFrom();
|
||||
string const to = GetTo();
|
||||
int const sel = local_converters.GetNumber(from, to);
|
||||
int const sel = local_converters.getNumber(from, to);
|
||||
|
||||
fl_freeze_form(dialog_->form);
|
||||
|
||||
@ -1157,7 +1157,7 @@ string const FormPreferences::Converters::GetFrom() const
|
||||
fl_get_choice(dialog_->choice_from);
|
||||
|
||||
if (i > 0 && i <= local_formats.size())
|
||||
return local_formats.Get(i-1).name();
|
||||
return local_formats.get(i - 1).name();
|
||||
else {
|
||||
lyxerr << "FormPreferences::Converters::GetFrom: No choice!"
|
||||
<< endl;
|
||||
@ -1172,7 +1172,7 @@ string const FormPreferences::Converters::GetTo() const
|
||||
fl_get_choice(dialog_->choice_to);
|
||||
|
||||
if (i > 0 && i <= local_formats.size())
|
||||
return local_formats.Get(i-1).name();
|
||||
return local_formats.get(i - 1).name();
|
||||
else {
|
||||
lyxerr << "FormPreferences::Converters::GetTo: No choice!"
|
||||
<< endl;
|
||||
@ -1289,7 +1289,7 @@ bool FormPreferences::Formats::input(FL_OBJECT const * const ob)
|
||||
return Add();
|
||||
|
||||
} else if (ob == dialog_->button_delete) {
|
||||
return Delete();
|
||||
return erase();
|
||||
}
|
||||
|
||||
return false;
|
||||
@ -1305,7 +1305,7 @@ void FormPreferences::Formats::update()
|
||||
|
||||
void FormPreferences::Formats::UpdateBrowser()
|
||||
{
|
||||
local_formats.Sort();
|
||||
local_formats.sort();
|
||||
|
||||
fl_freeze_form(dialog_->form);
|
||||
fl_deselect_browser(dialog_->browser_all);
|
||||
@ -1320,7 +1320,7 @@ void FormPreferences::Formats::UpdateBrowser()
|
||||
|
||||
// Mustn't forget to update the Formats available to the converters_
|
||||
parent_.converters_.UpdateChoices();
|
||||
local_converters.Update(local_formats);
|
||||
local_converters.update(local_formats);
|
||||
}
|
||||
|
||||
|
||||
@ -1332,10 +1332,10 @@ bool FormPreferences::Formats::Add()
|
||||
string const shortcut = fl_get_input(dialog_->input_shrtcut);
|
||||
string const viewer = fl_get_input(dialog_->input_viewer);
|
||||
|
||||
Format const * old = local_formats.GetFormat(name);
|
||||
Format const * old = local_formats.getFormat(name);
|
||||
string const old_prettyname = old ? old->prettyname() : string();
|
||||
local_formats.Add(name, extension, prettyname, shortcut);
|
||||
local_formats.SetViewer(name, viewer);
|
||||
local_formats.add(name, extension, prettyname, shortcut);
|
||||
local_formats.setViewer(name, viewer);
|
||||
if (!old || prettyname != old_prettyname) {
|
||||
UpdateBrowser();
|
||||
if (old)
|
||||
@ -1354,7 +1354,7 @@ bool FormPreferences::Formats::Browser()
|
||||
|
||||
fl_freeze_form(dialog_->form);
|
||||
|
||||
Format const & f = local_formats.Get(i-1);
|
||||
Format const & f = local_formats.get(i - 1);
|
||||
|
||||
fl_set_input(dialog_->input_format, f.name().c_str());
|
||||
fl_set_input(dialog_->input_gui_name, f.prettyname().c_str());
|
||||
@ -1373,17 +1373,17 @@ bool FormPreferences::Formats::Browser()
|
||||
}
|
||||
|
||||
|
||||
bool FormPreferences::Formats::Delete()
|
||||
bool FormPreferences::Formats::erase()
|
||||
{
|
||||
string const name = fl_get_input(dialog_->input_format);
|
||||
|
||||
if (local_converters.FormatIsUsed(name)) {
|
||||
if (local_converters.formatIsUsed(name)) {
|
||||
parent_.printWarning(_("Cannot remove a Format used by a Converter. Remove the converter first."));
|
||||
setEnabled(dialog_->button_delete, false);
|
||||
return false;
|
||||
}
|
||||
|
||||
local_formats.Delete(name);
|
||||
local_formats.erase(name);
|
||||
UpdateBrowser();
|
||||
return true;
|
||||
}
|
||||
@ -1392,7 +1392,7 @@ bool FormPreferences::Formats::Delete()
|
||||
bool FormPreferences::Formats::Input()
|
||||
{
|
||||
string const name = fl_get_input(dialog_->input_format);
|
||||
int const sel = local_formats.GetNumber(name);
|
||||
int const sel = local_formats.getNumber(name);
|
||||
fl_freeze_form(dialog_->form);
|
||||
|
||||
if (sel < 0) {
|
||||
|
@ -236,7 +236,7 @@ private:
|
||||
///
|
||||
bool Browser();
|
||||
///
|
||||
bool Delete();
|
||||
bool erase();
|
||||
///
|
||||
bool Input();
|
||||
///
|
||||
@ -278,7 +278,7 @@ private:
|
||||
///
|
||||
void UpdateBrowser();
|
||||
///
|
||||
bool Delete();
|
||||
bool erase();
|
||||
///
|
||||
bool Input();
|
||||
|
||||
|
@ -66,6 +66,10 @@ libxforms_la_SOURCES = \
|
||||
FormExternal.h \
|
||||
form_external.C \
|
||||
form_external.h \
|
||||
FormFloat.C \
|
||||
FormFloat.h \
|
||||
form_float.C \
|
||||
form_float.h \
|
||||
FormGraphics.C \
|
||||
FormGraphics.h \
|
||||
form_graphics.C \
|
||||
|
@ -285,23 +285,6 @@ extern "C" void C_Toolbar_ToolbarCB(FL_OBJECT * ob, long data)
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
// What are we supposed to do with that??
|
||||
int Toolbar::get_toolbar_func(string const & func)
|
||||
{
|
||||
int action = lyxaction.LookupFunc(func);
|
||||
if (action == -1) {
|
||||
if (func == "separator"){
|
||||
action = TOOL_SEPARATOR;
|
||||
} else if (func == "layouts"){
|
||||
action = TOOL_LAYOUTS;
|
||||
} else action = 0;
|
||||
}
|
||||
return action;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
namespace {
|
||||
|
||||
void setPixmap(FL_OBJECT * obj, int action, int buttonwidth, int height) {
|
||||
|
@ -43,11 +43,6 @@ public:
|
||||
clean();
|
||||
}
|
||||
|
||||
#if 0
|
||||
///
|
||||
int get_toolbar_func(string const & func);
|
||||
#endif
|
||||
|
||||
/// (re)sets the toolbar
|
||||
void set(bool doingmain = false);
|
||||
|
||||
|
94
src/frontends/xforms/form_float.C
Normal file
94
src/frontends/xforms/form_float.C
Normal file
@ -0,0 +1,94 @@
|
||||
// File modified by fdfix.sh for use by lyx (with xforms >= 0.88) and gettext
|
||||
#include <config.h>
|
||||
#include "lyx_gui_misc.h"
|
||||
#include "gettext.h"
|
||||
|
||||
/* Form definition file generated with fdesign. */
|
||||
|
||||
#include FORMS_H_LOCATION
|
||||
#include <stdlib.h>
|
||||
#include "form_float.h"
|
||||
#include "FormFloat.h"
|
||||
|
||||
FD_form_float::~FD_form_float()
|
||||
{
|
||||
if ( form->visible ) fl_hide_form( form );
|
||||
fl_free_form( form );
|
||||
}
|
||||
|
||||
|
||||
FD_form_float * FormFloat::build_float()
|
||||
{
|
||||
FL_OBJECT *obj;
|
||||
FD_form_float *fdui = new FD_form_float;
|
||||
|
||||
fdui->form = fl_bgn_form(FL_NO_BOX, 360, 200);
|
||||
fdui->form->u_vdata = this;
|
||||
obj = fl_add_box(FL_FLAT_BOX, 0, 0, 360, 200, "");
|
||||
obj = fl_add_frame(FL_ENGRAVED_FRAME, 10, 100, 340, 50, "");
|
||||
obj = fl_add_labelframe(FL_ENGRAVED_FRAME, 10, 20, 340, 80, _("Placement"));
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_lstyle(obj, FL_BOLD_STYLE);
|
||||
{
|
||||
char const * const dummy = N_("Top of the page|#T");
|
||||
fdui->radio_top = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 20, 30, 152, 30, idex(_(dummy)));
|
||||
fl_set_button_shortcut(obj, scex(_(dummy)), 1);
|
||||
}
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_callback(obj, C_FormBaseInputCB, 0);
|
||||
{
|
||||
char const * const dummy = N_("Bottom of the page|#B");
|
||||
fdui->radio_bottom = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 20, 60, 152, 30, idex(_(dummy)));
|
||||
fl_set_button_shortcut(obj, scex(_(dummy)), 1);
|
||||
}
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_callback(obj, C_FormBaseInputCB, 0);
|
||||
{
|
||||
char const * const dummy = N_("Page of floats|#P");
|
||||
fdui->radio_page = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 190, 30, 152, 30, idex(_(dummy)));
|
||||
fl_set_button_shortcut(obj, scex(_(dummy)), 1);
|
||||
}
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_callback(obj, C_FormBaseInputCB, 0);
|
||||
{
|
||||
char const * const dummy = N_("Cancel|^[");
|
||||
fdui->button_cancel = obj = fl_add_button(FL_NORMAL_BUTTON, 280, 160, 70, 30, idex(_(dummy)));
|
||||
fl_set_button_shortcut(obj, scex(_(dummy)), 1);
|
||||
}
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_callback(obj, C_FormBaseCancelCB, 0);
|
||||
{
|
||||
char const * const dummy = N_("Apply|#A");
|
||||
fdui->button_apply = obj = fl_add_button(FL_NORMAL_BUTTON, 200, 160, 70, 30, idex(_(dummy)));
|
||||
fl_set_button_shortcut(obj, scex(_(dummy)), 1);
|
||||
}
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_callback(obj, C_FormBaseApplyCB, 0);
|
||||
fdui->button_ok = obj = fl_add_button(FL_RETURN_BUTTON, 120, 160, 70, 30, _("OK"));
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_callback(obj, C_FormBaseOKCB, 0);
|
||||
{
|
||||
char const * const dummy = N_("Restore|#R");
|
||||
fdui->button_restore = obj = fl_add_button(FL_NORMAL_BUTTON, 10, 160, 80, 30, idex(_(dummy)));
|
||||
fl_set_button_shortcut(obj, scex(_(dummy)), 1);
|
||||
}
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_callback(obj, C_FormBaseRestoreCB, 0);
|
||||
fdui->radio_here = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 190, 60, 152, 30, _("Here, if possible#i"));
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_callback(obj, C_FormBaseInputCB, 0);
|
||||
{
|
||||
char const * const dummy = N_("Here, definitely|#H");
|
||||
fdui->Here = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 20, 110, 152, 30, idex(_(dummy)));
|
||||
fl_set_button_shortcut(obj, scex(_(dummy)), 1);
|
||||
}
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_callback(obj, C_FormBaseInputCB, 0);
|
||||
fl_end_form();
|
||||
|
||||
fdui->form->fdui = fdui;
|
||||
|
||||
return fdui;
|
||||
}
|
||||
/*---------------------------------------*/
|
||||
|
31
src/frontends/xforms/form_float.h
Normal file
31
src/frontends/xforms/form_float.h
Normal file
@ -0,0 +1,31 @@
|
||||
// File modified by fdfix.sh for use by lyx (with xforms >= 0.88) and gettext
|
||||
/** Header file generated with fdesign **/
|
||||
|
||||
#ifndef FD_form_float_h_
|
||||
#define FD_form_float_h_
|
||||
|
||||
/** Callbacks, globals and object handlers **/
|
||||
extern "C" void C_FormBaseInputCB(FL_OBJECT *, long);
|
||||
extern "C" void C_FormBaseCancelCB(FL_OBJECT *, long);
|
||||
extern "C" void C_FormBaseApplyCB(FL_OBJECT *, long);
|
||||
extern "C" void C_FormBaseOKCB(FL_OBJECT *, long);
|
||||
extern "C" void C_FormBaseRestoreCB(FL_OBJECT *, long);
|
||||
|
||||
|
||||
/**** Forms and Objects ****/
|
||||
struct FD_form_float {
|
||||
~FD_form_float();
|
||||
|
||||
FL_FORM *form;
|
||||
FL_OBJECT *radio_top;
|
||||
FL_OBJECT *radio_bottom;
|
||||
FL_OBJECT *radio_page;
|
||||
FL_OBJECT *button_cancel;
|
||||
FL_OBJECT *button_apply;
|
||||
FL_OBJECT *button_ok;
|
||||
FL_OBJECT *button_restore;
|
||||
FL_OBJECT *radio_here;
|
||||
FL_OBJECT *Here;
|
||||
};
|
||||
|
||||
#endif /* FD_form_float_h_ */
|
232
src/frontends/xforms/forms/form_float.fd
Normal file
232
src/frontends/xforms/forms/form_float.fd
Normal file
@ -0,0 +1,232 @@
|
||||
Magic: 13000
|
||||
|
||||
Internal Form Definition File
|
||||
(do not change)
|
||||
|
||||
Number of forms: 1
|
||||
Unit of measure: FL_COORD_PIXEL
|
||||
|
||||
=============== FORM ===============
|
||||
Name: form_float
|
||||
Width: 360
|
||||
Height: 200
|
||||
Number of Objects: 12
|
||||
|
||||
--------------------
|
||||
class: FL_BOX
|
||||
type: FLAT_BOX
|
||||
box: 0 0 360 200
|
||||
boxtype: FL_FLAT_BOX
|
||||
colors: FL_COL1 FL_COL1
|
||||
alignment: FL_ALIGN_CENTER
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_DEFAULT_SIZE
|
||||
lcol: FL_BLACK
|
||||
label:
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name:
|
||||
callback:
|
||||
argument:
|
||||
|
||||
--------------------
|
||||
class: FL_FRAME
|
||||
type: ENGRAVED_FRAME
|
||||
box: 10 100 340 50
|
||||
boxtype: FL_NO_BOX
|
||||
colors: FL_BLACK FL_COL1
|
||||
alignment: FL_ALIGN_CENTER
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_DEFAULT_SIZE
|
||||
lcol: FL_BLACK
|
||||
label:
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name:
|
||||
callback:
|
||||
argument:
|
||||
|
||||
--------------------
|
||||
class: FL_LABELFRAME
|
||||
type: ENGRAVED_FRAME
|
||||
box: 10 20 340 80
|
||||
boxtype: FL_NO_BOX
|
||||
colors: FL_BLACK FL_COL1
|
||||
alignment: FL_ALIGN_TOP_LEFT
|
||||
style: FL_BOLD_STYLE
|
||||
size: FL_NORMAL_SIZE
|
||||
lcol: FL_BLACK
|
||||
label: Placement
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name:
|
||||
callback:
|
||||
argument:
|
||||
|
||||
--------------------
|
||||
class: FL_CHECKBUTTON
|
||||
type: PUSH_BUTTON
|
||||
box: 20 30 152 30
|
||||
boxtype: FL_NO_BOX
|
||||
colors: FL_COL1 FL_YELLOW
|
||||
alignment: FL_ALIGN_CENTER
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_NORMAL_SIZE
|
||||
lcol: FL_BLACK
|
||||
label: Top of the page|#T
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: radio_top
|
||||
callback: C_FormBaseInputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
class: FL_CHECKBUTTON
|
||||
type: PUSH_BUTTON
|
||||
box: 20 60 152 30
|
||||
boxtype: FL_NO_BOX
|
||||
colors: FL_COL1 FL_YELLOW
|
||||
alignment: FL_ALIGN_CENTER
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_NORMAL_SIZE
|
||||
lcol: FL_BLACK
|
||||
label: Bottom of the page|#B
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: radio_bottom
|
||||
callback: C_FormBaseInputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
class: FL_CHECKBUTTON
|
||||
type: PUSH_BUTTON
|
||||
box: 190 30 152 30
|
||||
boxtype: FL_NO_BOX
|
||||
colors: FL_COL1 FL_YELLOW
|
||||
alignment: FL_ALIGN_CENTER
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_NORMAL_SIZE
|
||||
lcol: FL_BLACK
|
||||
label: Page of floats|#P
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: radio_page
|
||||
callback: C_FormBaseInputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
class: FL_BUTTON
|
||||
type: NORMAL_BUTTON
|
||||
box: 280 160 70 30
|
||||
boxtype: FL_UP_BOX
|
||||
colors: FL_COL1 FL_COL1
|
||||
alignment: FL_ALIGN_CENTER
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_NORMAL_SIZE
|
||||
lcol: FL_BLACK
|
||||
label: Cancel|^[
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: button_cancel
|
||||
callback: C_FormBaseCancelCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
class: FL_BUTTON
|
||||
type: NORMAL_BUTTON
|
||||
box: 200 160 70 30
|
||||
boxtype: FL_UP_BOX
|
||||
colors: FL_COL1 FL_COL1
|
||||
alignment: FL_ALIGN_CENTER
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_NORMAL_SIZE
|
||||
lcol: FL_BLACK
|
||||
label: Apply|#A
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: button_apply
|
||||
callback: C_FormBaseApplyCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
class: FL_BUTTON
|
||||
type: RETURN_BUTTON
|
||||
box: 120 160 70 30
|
||||
boxtype: FL_UP_BOX
|
||||
colors: FL_COL1 FL_COL1
|
||||
alignment: FL_ALIGN_CENTER
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_NORMAL_SIZE
|
||||
lcol: FL_BLACK
|
||||
label: OK
|
||||
shortcut: ^M
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: button_ok
|
||||
callback: C_FormBaseOKCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
class: FL_BUTTON
|
||||
type: NORMAL_BUTTON
|
||||
box: 10 160 80 30
|
||||
boxtype: FL_UP_BOX
|
||||
colors: FL_COL1 FL_COL1
|
||||
alignment: FL_ALIGN_CENTER
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_NORMAL_SIZE
|
||||
lcol: FL_BLACK
|
||||
label: Restore|#R
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: button_restore
|
||||
callback: C_FormBaseRestoreCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
class: FL_CHECKBUTTON
|
||||
type: PUSH_BUTTON
|
||||
box: 190 60 152 30
|
||||
boxtype: FL_NO_BOX
|
||||
colors: FL_COL1 FL_YELLOW
|
||||
alignment: FL_ALIGN_CENTER
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_NORMAL_SIZE
|
||||
lcol: FL_BLACK
|
||||
label: Here, if possible#i
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: radio_here
|
||||
callback: C_FormBaseInputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
class: FL_CHECKBUTTON
|
||||
type: PUSH_BUTTON
|
||||
box: 20 110 152 30
|
||||
boxtype: FL_NO_BOX
|
||||
colors: FL_COL1 FL_YELLOW
|
||||
alignment: FL_ALIGN_CENTER
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_NORMAL_SIZE
|
||||
lcol: FL_BLACK
|
||||
label: Here, definitely|#H
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: Here
|
||||
callback: C_FormBaseInputCB
|
||||
argument: 0
|
||||
|
||||
==============================
|
||||
create_the_forms
|
@ -28,6 +28,7 @@ SRCS = form_aboutlyx.fd \
|
||||
form_error.fd \
|
||||
form_external.fd \
|
||||
form_filedialog.fd \
|
||||
form_float.fd \
|
||||
form_graphics.fd \
|
||||
form_include.fd \
|
||||
form_index.fd \
|
||||
|
@ -106,7 +106,7 @@ string const findTargetFormat(string const & from)
|
||||
FormatList::const_iterator end = formats.end();
|
||||
|
||||
for (; iter != end; ++iter) {
|
||||
if (converters.IsReachable(from, *iter))
|
||||
if (converters.isReachable(from, *iter))
|
||||
break;
|
||||
}
|
||||
|
||||
@ -140,7 +140,7 @@ GraphicsCacheItem::convertImage(string const & filename)
|
||||
// Remove the temp file, we only want the name...
|
||||
lyx::unlink(tempfile);
|
||||
|
||||
bool result = converters.Convert(0, filename, tempfile, from, to);
|
||||
bool result = converters.convert(0, filename, tempfile, from, to);
|
||||
tempfile.append(".xpm");
|
||||
|
||||
// For now we are synchronous
|
||||
|
@ -49,8 +49,8 @@ bool Importer::Import(LyXView * lv, string const & filename,
|
||||
if (find(loaders.begin(), loaders.end(), format) == loaders.end()) {
|
||||
for (vector<string>::const_iterator it = loaders.begin();
|
||||
it != loaders.end(); ++it) {
|
||||
if (converters.IsReachable(format, *it)) {
|
||||
if (!converters.Convert(0, filename, filename,
|
||||
if (converters.isReachable(format, *it)) {
|
||||
if (!converters.convert(0, filename, filename,
|
||||
format, *it))
|
||||
return false;
|
||||
loader_format = *it;
|
||||
@ -60,7 +60,7 @@ bool Importer::Import(LyXView * lv, string const & filename,
|
||||
if (loader_format.empty()) {
|
||||
WriteAlert(_("Can not import file"),
|
||||
_("No information for importing from ")
|
||||
+ formats.PrettyName(format));
|
||||
+ formats.prettyName(format));
|
||||
return false;
|
||||
}
|
||||
} else
|
||||
@ -76,7 +76,7 @@ bool Importer::Import(LyXView * lv, string const & filename,
|
||||
bool as_paragraphs = loader_format == "textparagraph";
|
||||
string filename2 = (loader_format == format) ? filename
|
||||
: ChangeExtension(filename,
|
||||
formats.Extension(loader_format));
|
||||
formats.extension(loader_format));
|
||||
InsertAsciiFile(lv->view(), filename2, as_paragraphs);
|
||||
lv->getLyXFunc()->dispatch(LFUN_MARK_OFF);
|
||||
}
|
||||
@ -104,11 +104,11 @@ vector<Format const *> const Importer::GetImportableFormats()
|
||||
{
|
||||
vector<string> loaders = Loaders();
|
||||
vector<Format const *> result =
|
||||
converters.GetReachableTo(loaders[0], true);
|
||||
converters.getReachableTo(loaders[0], true);
|
||||
for (vector<string>::const_iterator it = loaders.begin() + 1;
|
||||
it != loaders.end(); ++it) {
|
||||
vector<Format const *> r =
|
||||
converters.GetReachableTo(*it, false);
|
||||
converters.getReachableTo(*it, false);
|
||||
result.insert(result.end(), r.begin(), r.end());
|
||||
}
|
||||
return result;
|
||||
|
@ -1,3 +1,7 @@
|
||||
2001-07-30 Lars Gullik Bjønnes <larsbj@birdstep.com>
|
||||
|
||||
* insetfloat.C: handliign of RMB on label added.
|
||||
|
||||
2001-07-30 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
|
||||
|
||||
* insetgraphicsParams.C: #include LOstream.h here.
|
||||
|
@ -1943,7 +1943,7 @@ void InsetFig::preview(string const & p)
|
||||
tfname += ".eps";
|
||||
string buf1 = OnlyPath(owner->fileName());
|
||||
string buf2 = os::external_path(MakeAbsPath(tfname, buf1));
|
||||
if (!formats.View(owner, buf2, "eps"))
|
||||
if (!formats.view(owner, buf2, "eps"))
|
||||
lyxerr << "Can't view " << buf2 << endl;
|
||||
}
|
||||
|
||||
|
@ -173,9 +173,7 @@ public:
|
||||
/// returns true the inset can hold an inset of given type
|
||||
virtual bool insetAllowed(Inset::Code) const { return false; }
|
||||
/// wrapper around the above
|
||||
bool insetAllowed(Inset * in) const {
|
||||
return insetAllowed(in->lyxCode());
|
||||
}
|
||||
bool insetAllowed(Inset * in) const;
|
||||
///
|
||||
virtual void write(Buffer const *, std::ostream &) const = 0;
|
||||
///
|
||||
@ -273,24 +271,19 @@ public:
|
||||
virtual LyXCursor const & cursor(BufferView * bview) const;
|
||||
/// id functions
|
||||
int id() const;
|
||||
///
|
||||
void id(int id_arg);
|
||||
|
||||
/// used to toggle insets
|
||||
// is the inset open?
|
||||
virtual bool isOpen() const { return false; }
|
||||
#if 0
|
||||
/// open or close the inset, depending on the bool
|
||||
virtual void open(BufferView *, bool) {}
|
||||
#else
|
||||
/// open the inset
|
||||
virtual void open(BufferView *) {}
|
||||
#endif
|
||||
/// close the inset
|
||||
virtual void close(BufferView *) {}
|
||||
/// check if the font of the char we want inserting is correct
|
||||
/// and modify it if it is not.
|
||||
virtual bool checkInsertChar(LyXFont &) { return true; }
|
||||
|
||||
virtual bool checkInsertChar(LyXFont &);
|
||||
protected:
|
||||
///
|
||||
mutable int top_x;
|
||||
@ -313,6 +306,19 @@ private:
|
||||
};
|
||||
|
||||
|
||||
inline
|
||||
bool Inset::insetAllowed(Inset * in) const
|
||||
{
|
||||
return insetAllowed(in->lyxCode());
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
bool Inset::checkInsertChar(LyXFont &)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// Updatable Insets. These insets can be locked and receive
|
||||
// directly user interaction. Currently used only for mathed.
|
||||
// Note that all pure methods from Inset class are pure here too.
|
||||
@ -451,7 +457,9 @@ public:
|
||||
// needed for spellchecking text
|
||||
///
|
||||
virtual string const selectNextWord(BufferView *, float & value) const;
|
||||
///
|
||||
virtual void selectSelectedWord(BufferView *) { return; }
|
||||
///
|
||||
virtual void toggleSelection(BufferView *, bool /*kill_selection*/) {
|
||||
return;
|
||||
}
|
||||
@ -460,6 +468,7 @@ public:
|
||||
///
|
||||
virtual bool searchForward(BufferView *, string const &,
|
||||
bool const & = true, bool const & = false);
|
||||
///
|
||||
virtual bool searchBackward(BufferView *, string const &,
|
||||
bool const & = true, bool const & = false);
|
||||
|
||||
|
@ -38,22 +38,12 @@ int InsetButton::ascent(BufferView * bv, LyXFont const &) const
|
||||
int descent;
|
||||
string const s = getScreenLabel(bv->buffer());
|
||||
|
||||
#if 0
|
||||
if (editable()) {
|
||||
bv->painter().buttonText(0, 0, s, font,
|
||||
false, width, ascent, descent);
|
||||
} else {
|
||||
bv->painter().rectText(0, 0, s, font,
|
||||
LColor::commandbg, LColor::commandframe,
|
||||
false, width, ascent, descent);
|
||||
}
|
||||
#else
|
||||
if (editable()) {
|
||||
lyxfont::buttonText(s, font, width, ascent, descent);
|
||||
} else {
|
||||
lyxfont::rectText(s, font, width, ascent, descent);
|
||||
}
|
||||
#endif
|
||||
|
||||
return ascent;
|
||||
}
|
||||
|
||||
@ -70,22 +60,12 @@ int InsetButton::descent(BufferView * bv, LyXFont const &) const
|
||||
int descent;
|
||||
string const s = getScreenLabel(bv->buffer());
|
||||
|
||||
#if 0
|
||||
if (editable()) {
|
||||
bv->painter().buttonText(0, 0, s, font,
|
||||
false, width, ascent, descent);
|
||||
} else {
|
||||
bv->painter().rectText(0, 0, s, font,
|
||||
LColor::commandbg, LColor::commandframe,
|
||||
false, width, ascent, descent);
|
||||
}
|
||||
#else
|
||||
if (editable()) {
|
||||
lyxfont::buttonText(s, font, width, ascent, descent);
|
||||
} else {
|
||||
lyxfont::rectText(s, font, width, ascent, descent);
|
||||
}
|
||||
#endif
|
||||
|
||||
return descent;
|
||||
}
|
||||
|
||||
@ -102,22 +82,12 @@ int InsetButton::width(BufferView * bv, LyXFont const &) const
|
||||
int descent;
|
||||
string const s = getScreenLabel(bv->buffer());
|
||||
|
||||
#if 0
|
||||
if (editable()) {
|
||||
bv->painter().buttonText(0, 0, s, font,
|
||||
false, width, ascent, descent);
|
||||
} else {
|
||||
bv->painter().rectText(0, 0, s, font,
|
||||
LColor::commandbg, LColor::commandframe,
|
||||
false, width, ascent, descent);
|
||||
}
|
||||
#else
|
||||
if (editable()) {
|
||||
lyxfont::buttonText(s, font, width, ascent, descent);
|
||||
} else {
|
||||
lyxfont::rectText(s, font, width, ascent, descent);
|
||||
}
|
||||
#endif
|
||||
|
||||
return width + 4;
|
||||
}
|
||||
|
||||
@ -134,27 +104,12 @@ void InsetButton::draw(BufferView * bv, LyXFont const &,
|
||||
|
||||
string const s = getScreenLabel(bv->buffer());
|
||||
|
||||
#if 0
|
||||
int width;
|
||||
if (editable()) {
|
||||
pain.buttonText(int(x) + 2, baseline, s, font, true, width);
|
||||
} else {
|
||||
pain.rectText(int(x) + 2, baseline, s, font,
|
||||
LColor::commandbg, LColor::commandframe,
|
||||
true, width);
|
||||
}
|
||||
#else
|
||||
if (editable()) {
|
||||
pain.buttonText(int(x) + 2, baseline, s, font);
|
||||
} else {
|
||||
pain.rectText(int(x) + 2, baseline, s, font,
|
||||
LColor::commandbg, LColor::commandframe);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
x += width + 4;
|
||||
#else
|
||||
x += width(bv, font);
|
||||
#endif
|
||||
}
|
||||
|
@ -38,17 +38,11 @@ InsetCollapsable::InsetCollapsable(bool collapsed)
|
||||
: UpdatableInset(), collapsed_(collapsed),
|
||||
button_length(0), button_top_y(0), button_bottom_y(0),
|
||||
label("Label"),
|
||||
#if 0
|
||||
draw_label(label),
|
||||
#endif
|
||||
#if 0
|
||||
autocollapse(false),
|
||||
#endif
|
||||
oldWidth(0), need_update(FULL),
|
||||
inlined(false)
|
||||
#if 0
|
||||
, change_label_with_text(false)
|
||||
#endif
|
||||
{
|
||||
inset.setOwner(this);
|
||||
inset.setAutoBreakRows(true);
|
||||
@ -63,17 +57,11 @@ InsetCollapsable::InsetCollapsable(InsetCollapsable const & in, bool same_id)
|
||||
framecolor(in.framecolor), labelfont(in.labelfont),
|
||||
button_length(0), button_top_y(0), button_bottom_y(0),
|
||||
label(in.label),
|
||||
#if 0
|
||||
draw_label(label),
|
||||
#endif
|
||||
#if 0
|
||||
autocollapse(in.autocollapse),
|
||||
#endif
|
||||
oldWidth(0), need_update(FULL),
|
||||
inlined(in.inlined)
|
||||
#if 0
|
||||
, change_label_with_text(in.change_label_with_text)
|
||||
#endif
|
||||
{
|
||||
inset.init(&(in.inset), same_id);
|
||||
inset.setOwner(this);
|
||||
@ -115,44 +103,25 @@ void InsetCollapsable::read(Buffer const * buf, LyXLex & lex)
|
||||
}
|
||||
}
|
||||
inset.read(buf, lex);
|
||||
#if 0
|
||||
if (collapsed_ && change_label_with_text) {
|
||||
draw_label = get_new_label();
|
||||
} else {
|
||||
draw_label = label;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
//int InsetCollapsable::ascent_collapsed(Painter & pain) const
|
||||
int InsetCollapsable::ascent_collapsed() const
|
||||
{
|
||||
int width = 0;
|
||||
int ascent = 0;
|
||||
int descent = 0;
|
||||
#if 0
|
||||
pain.buttonText(0, 0, draw_label, labelfont, false,
|
||||
width, ascent, descent);
|
||||
#else
|
||||
lyxfont::buttonText(label, labelfont, width, ascent, descent);
|
||||
#endif
|
||||
return ascent;
|
||||
}
|
||||
|
||||
|
||||
//int InsetCollapsable::descent_collapsed(Painter & pain) const
|
||||
int InsetCollapsable::descent_collapsed() const
|
||||
{
|
||||
int width = 0;
|
||||
int ascent = 0;
|
||||
int descent = 0;
|
||||
#if 0
|
||||
pain.buttonText(0, 0, draw_label, labelfont, false,
|
||||
width, ascent, descent);
|
||||
#else
|
||||
lyxfont::buttonText(label, labelfont, width, ascent, descent);
|
||||
#endif
|
||||
return descent;
|
||||
}
|
||||
|
||||
@ -163,12 +132,7 @@ int InsetCollapsable::width_collapsed() const
|
||||
int width;
|
||||
int ascent;
|
||||
int descent;
|
||||
#if 0
|
||||
pain.buttonText(TEXT_TO_INSET_OFFSET, 0, draw_label, labelfont, false,
|
||||
width, ascent, descent);
|
||||
#else
|
||||
lyxfont::buttonText(label, labelfont, width, ascent, descent);
|
||||
#endif
|
||||
return width + (2*TEXT_TO_INSET_OFFSET);
|
||||
}
|
||||
|
||||
@ -203,18 +167,12 @@ int InsetCollapsable::width(BufferView * bv, LyXFont const & font) const
|
||||
}
|
||||
|
||||
|
||||
void InsetCollapsable::draw_collapsed(Painter & pain, int baseline, float & x) const
|
||||
void InsetCollapsable::draw_collapsed(Painter & pain,
|
||||
int baseline, float & x) const
|
||||
{
|
||||
#if 0
|
||||
int width = 0;
|
||||
pain.buttonText(int(x) + TEXT_TO_INSET_OFFSET,
|
||||
baseline, draw_label, labelfont, true, width);
|
||||
x += width + TEXT_TO_INSET_OFFSET;
|
||||
#else
|
||||
pain.buttonText(int(x) + TEXT_TO_INSET_OFFSET,
|
||||
baseline, label, labelfont);
|
||||
x += width_collapsed();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -292,9 +250,6 @@ void InsetCollapsable::edit(BufferView * bv, int xp, int yp,
|
||||
UpdatableInset::edit(bv, xp, yp, button);
|
||||
|
||||
if (collapsed_) {
|
||||
#if 0
|
||||
draw_label = label;
|
||||
#endif
|
||||
collapsed_ = false;
|
||||
if (!bv->lockInset(this))
|
||||
return;
|
||||
@ -322,9 +277,6 @@ void InsetCollapsable::edit(BufferView * bv, bool front)
|
||||
UpdatableInset::edit(bv, front);
|
||||
|
||||
if (collapsed_) {
|
||||
#if 0
|
||||
draw_label = label;
|
||||
#endif
|
||||
collapsed_ = false;
|
||||
if (!bv->lockInset(this))
|
||||
return;
|
||||
@ -386,21 +338,11 @@ void InsetCollapsable::insetButtonRelease(BufferView * bv,
|
||||
if ((x >= 0) && (x < button_length) &&
|
||||
(y >= button_top_y) && (y <= button_bottom_y)) {
|
||||
if (collapsed_) {
|
||||
#if 0
|
||||
draw_label = label;
|
||||
#endif
|
||||
collapsed_ = false;
|
||||
inset.insetButtonRelease(bv, 0, 0, button);
|
||||
inset.setUpdateStatus(bv, InsetText::FULL);
|
||||
bv->updateInset(this, false);
|
||||
} else {
|
||||
#if 0
|
||||
if (change_label_with_text) {
|
||||
draw_label = get_new_label();
|
||||
} else {
|
||||
draw_label = label;
|
||||
}
|
||||
#endif
|
||||
collapsed_ = true;
|
||||
bv->unlockInset(this);
|
||||
bv->updateInset(this, false);
|
||||
@ -639,22 +581,6 @@ Inset * InsetCollapsable::getInsetFromID(int id_arg) const
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
void InsetCollapsable::open(BufferView * bv, bool flag)
|
||||
{
|
||||
if (flag == !collapsed_)
|
||||
return;
|
||||
collapsed_ = !flag;
|
||||
#if 0
|
||||
if (collapsed_ && change_label_with_text) {
|
||||
draw_label = get_new_label();
|
||||
} else {
|
||||
draw_label = label;
|
||||
}
|
||||
#endif
|
||||
bv->updateInset(this, false);
|
||||
}
|
||||
#else
|
||||
void InsetCollapsable::open(BufferView * bv)
|
||||
{
|
||||
if (!collapsed_) return;
|
||||
@ -671,47 +597,9 @@ void InsetCollapsable::close(BufferView * bv)
|
||||
collapsed_ = true;
|
||||
bv->updateInset(this, false);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if 0
|
||||
void InsetCollapsable::setLabel(string const & l, bool flag)
|
||||
{
|
||||
label = l;
|
||||
change_label_with_text = flag;
|
||||
if (collapsed_ && change_label_with_text) {
|
||||
draw_label = get_new_label();
|
||||
} else {
|
||||
draw_label = label;
|
||||
}
|
||||
}
|
||||
#else
|
||||
void InsetCollapsable::setLabel(string const & l)
|
||||
{
|
||||
label = l;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if 0
|
||||
string const InsetCollapsable::get_new_label() const
|
||||
{
|
||||
string la;
|
||||
Paragraph::size_type const max_length = 15;
|
||||
|
||||
int n = std::min(max_length, inset.paragraph()->size());
|
||||
int i = 0;
|
||||
int j = 0;
|
||||
for(; i < n && j < inset.paragraph()->size(); ++j) {
|
||||
if (inset.paragraph()->isInset(j))
|
||||
continue;
|
||||
la += inset.paragraph()->getChar(j);
|
||||
++i;
|
||||
}
|
||||
if ((i > 0) && (j < inset.paragraph()->size()))
|
||||
la += "...";
|
||||
if (la.empty())
|
||||
la = label;
|
||||
return la;
|
||||
}
|
||||
#endif
|
||||
|
@ -128,13 +128,8 @@ public:
|
||||
///
|
||||
void setFont(BufferView *, LyXFont const &, bool toggleall = false,
|
||||
bool selectall = false);
|
||||
#if 0
|
||||
///
|
||||
void setLabel(string const & l, bool flag = false);
|
||||
#else
|
||||
///
|
||||
void setLabel(string const & l);
|
||||
#endif
|
||||
///
|
||||
void setLabelFont(LyXFont & f) { labelfont = f; }
|
||||
#if 0
|
||||
@ -173,15 +168,10 @@ public:
|
||||
LyXCursor const & cursor(BufferView *) const;
|
||||
///
|
||||
bool isOpen() const { return !collapsed_; }
|
||||
#if 0
|
||||
///
|
||||
void open(BufferView *, bool);
|
||||
#else
|
||||
///
|
||||
void open(BufferView *);
|
||||
///
|
||||
void close(BufferView *);
|
||||
#endif
|
||||
///
|
||||
string const selectNextWord(BufferView * bv, float & value) const {
|
||||
return inset.selectNextWord(bv, value);
|
||||
@ -227,10 +217,6 @@ public:
|
||||
///
|
||||
InsetText inset;
|
||||
protected:
|
||||
#if 0
|
||||
///
|
||||
string const get_new_label() const;
|
||||
#endif
|
||||
///
|
||||
mutable int button_length;
|
||||
///
|
||||
@ -240,10 +226,6 @@ protected:
|
||||
private:
|
||||
///
|
||||
string label;
|
||||
#if 0
|
||||
///
|
||||
mutable string draw_label;
|
||||
#endif
|
||||
#if 0
|
||||
///
|
||||
bool autocollapse;
|
||||
@ -256,10 +238,6 @@ private:
|
||||
mutable UpdateCodes need_update;
|
||||
///
|
||||
bool inlined;
|
||||
#if 0
|
||||
///
|
||||
bool change_label_with_text;
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -20,11 +20,14 @@
|
||||
#include "lyxtext.h"
|
||||
#include "insets/insettext.h"
|
||||
#include "support/LOstream.h"
|
||||
#include "support/lstrings.h"
|
||||
#include "FloatList.h"
|
||||
#include "LaTeXFeatures.h"
|
||||
#include "debug.h"
|
||||
#include "Floating.h"
|
||||
#include "buffer.h"
|
||||
#include "LyXView.h"
|
||||
#include "frontends/Dialogs.h"
|
||||
|
||||
using std::ostream;
|
||||
using std::endl;
|
||||
@ -118,6 +121,12 @@ InsetFloat::InsetFloat(InsetFloat const & in, bool same_id)
|
||||
{}
|
||||
|
||||
|
||||
InsetFloat::~InsetFloat()
|
||||
{
|
||||
hideDialog();
|
||||
}
|
||||
|
||||
|
||||
void InsetFloat::write(Buffer const * buf, ostream & os) const
|
||||
{
|
||||
os << "Float " // getInsetName()
|
||||
@ -175,6 +184,10 @@ void InsetFloat::read(Buffer const * buf, LyXLex & lex)
|
||||
|
||||
void InsetFloat::validate(LaTeXFeatures & features) const
|
||||
{
|
||||
if (contains(placement(), "H")) {
|
||||
features.floats = true;
|
||||
}
|
||||
|
||||
features.usedFloats.insert(floatType_);
|
||||
InsetCollapsable::validate(features);
|
||||
}
|
||||
@ -249,8 +262,18 @@ bool InsetFloat::insetAllowed(Inset::Code code) const
|
||||
}
|
||||
|
||||
|
||||
bool InsetFloat::showInsetDialog(BufferView * bv) const
|
||||
{
|
||||
if (!inset.showInsetDialog(bv)) {
|
||||
bv->owner()->getDialogs()->showFloat(const_cast<InsetFloat *>(this));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void InsetFloat::insetButtonRelease(BufferView * bv, int x, int y, int button)
|
||||
{
|
||||
#if 0
|
||||
if (x >= top_x
|
||||
&& x < button_length
|
||||
&& y >= button_top_y
|
||||
@ -263,6 +286,13 @@ void InsetFloat::insetButtonRelease(BufferView * bv, int x, int y, int button)
|
||||
} else {
|
||||
InsetCollapsable::insetButtonRelease(bv, x, y, button);
|
||||
}
|
||||
#else
|
||||
if (button == 3) {
|
||||
showInsetDialog(bv);
|
||||
return;
|
||||
}
|
||||
InsetCollapsable::insetButtonRelease(bv, x, y, button);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -17,6 +17,7 @@
|
||||
#endif
|
||||
|
||||
#include "insetcollapsable.h"
|
||||
#include <sigc++/signal_system.h>
|
||||
|
||||
class Painter;
|
||||
|
||||
@ -30,6 +31,8 @@ public:
|
||||
///
|
||||
InsetFloat(InsetFloat const &, bool same_id = false);
|
||||
///
|
||||
~InsetFloat();
|
||||
///
|
||||
void write(Buffer const * buf, std::ostream & os) const;
|
||||
///
|
||||
void read(Buffer const * buf, LyXLex & lex);
|
||||
@ -59,6 +62,10 @@ public:
|
||||
void wide(bool w);
|
||||
///
|
||||
bool wide() const;
|
||||
///
|
||||
bool showInsetDialog(BufferView *) const;
|
||||
///
|
||||
SigC::Signal0<void> hideDialog;
|
||||
private:
|
||||
///
|
||||
string floatType_;
|
||||
|
@ -582,7 +582,7 @@ InsetGraphics::prepareFile(Buffer const *buf) const
|
||||
outfile = RemoveExtension(relname);
|
||||
}
|
||||
|
||||
converters.Convert(buf, params.filename, outfile, extension, image_target);
|
||||
converters.convert(buf, params.filename, outfile, extension, image_target);
|
||||
|
||||
return outfile;
|
||||
}
|
||||
|
@ -111,15 +111,12 @@ void InsetMinipage::write(Buffer const * buf, ostream & os) const
|
||||
|
||||
void InsetMinipage::read(Buffer const * buf, LyXLex & lex)
|
||||
{
|
||||
//string token;
|
||||
|
||||
if (lex.IsOK()) {
|
||||
lex.next();
|
||||
string const token = lex.GetString();
|
||||
if (token == "position") {
|
||||
lex.next();
|
||||
pos_ = static_cast<Position>(lex.GetInteger());
|
||||
//token = string();
|
||||
} else {
|
||||
lyxerr << "InsetMinipage::Read: Missing 'position'-tag!"
|
||||
<< endl;
|
||||
@ -128,14 +125,11 @@ void InsetMinipage::read(Buffer const * buf, LyXLex & lex)
|
||||
}
|
||||
}
|
||||
if (lex.IsOK()) {
|
||||
//if (token.empty()) {
|
||||
lex.next();
|
||||
string const token = lex.GetString();
|
||||
//}
|
||||
if (token == "inner_position") {
|
||||
lex.next();
|
||||
inner_pos_ = static_cast<InnerPosition>(lex.GetInteger());
|
||||
//token = string();
|
||||
} else {
|
||||
lyxerr << "InsetMinipage::Read: Missing 'inner_position'-tag!"
|
||||
<< endl;
|
||||
@ -144,14 +138,11 @@ void InsetMinipage::read(Buffer const * buf, LyXLex & lex)
|
||||
}
|
||||
}
|
||||
if (lex.IsOK()) {
|
||||
//if (token.empty()) {
|
||||
lex.next();
|
||||
string const token = lex.GetString();
|
||||
//}
|
||||
if (token == "height") {
|
||||
lex.next();
|
||||
height_ = lex.GetString();
|
||||
//token = string();
|
||||
} else {
|
||||
lyxerr << "InsetMinipage::Read: Missing 'height'-tag!"
|
||||
<< endl;
|
||||
@ -160,14 +151,11 @@ void InsetMinipage::read(Buffer const * buf, LyXLex & lex)
|
||||
}
|
||||
}
|
||||
if (lex.IsOK()) {
|
||||
//if (token.empty()) {
|
||||
lex.next();
|
||||
string const token = lex.GetString();
|
||||
//}
|
||||
if (token == "width") {
|
||||
lex.next();
|
||||
width_ = lex.GetString();
|
||||
//token = string();
|
||||
} else {
|
||||
lyxerr << "InsetMinipage::Read: Missing 'width'-tag!"
|
||||
<< endl;
|
||||
@ -175,8 +163,6 @@ void InsetMinipage::read(Buffer const * buf, LyXLex & lex)
|
||||
lex.pushToken(token);
|
||||
}
|
||||
}
|
||||
//if (!token.empty())
|
||||
// lex.pushToken(token);
|
||||
InsetCollapsable::read(buf, lex);
|
||||
}
|
||||
|
||||
|
@ -289,11 +289,6 @@ private:
|
||||
UpdatableInset::RESULT moveDown(BufferView *);
|
||||
///
|
||||
void setCharFont(Buffer const *, int pos, LyXFont const & font);
|
||||
#if 0
|
||||
///What's that ??? Not used, not implemented!
|
||||
///
|
||||
string const getText(int);
|
||||
#endif
|
||||
///
|
||||
bool checkAndActivateInset(BufferView * bv, bool behind);
|
||||
///
|
||||
|
@ -109,11 +109,7 @@ bool operator>(LyXCursor const & a, LyXCursor const & b)
|
||||
inline
|
||||
bool operator>=(LyXCursor const & a, LyXCursor const & b)
|
||||
{
|
||||
#if 0
|
||||
return (a > b || a == b);
|
||||
#else
|
||||
return !(a < b);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -121,11 +117,7 @@ bool operator>=(LyXCursor const & a, LyXCursor const & b)
|
||||
inline
|
||||
bool operator<=(LyXCursor const & a, LyXCursor const & b)
|
||||
{
|
||||
#if 0
|
||||
return (a < b || a == b);
|
||||
#else
|
||||
return !(a > b);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -12,13 +12,8 @@
|
||||
|
||||
#include "Lsstream.h"
|
||||
|
||||
#if 0
|
||||
#include <time.h>
|
||||
#include <locale.h>
|
||||
#else
|
||||
#include <ctime>
|
||||
#include <clocale>
|
||||
#endif
|
||||
|
||||
#include <utility>
|
||||
#include <algorithm>
|
||||
@ -1373,16 +1368,10 @@ string const LyXFunc::dispatch(int ac,
|
||||
|
||||
case LFUN_GOTOFILEROW:
|
||||
{
|
||||
#if 0
|
||||
char file_name[100];
|
||||
int row;
|
||||
::sscanf(argument.c_str(), " %s %d", file_name, &row);
|
||||
#else
|
||||
string file_name;
|
||||
int row;
|
||||
istringstream istr(argument.c_str());
|
||||
istr >> file_name >> row;
|
||||
#endif
|
||||
// Must replace extension of the file to be .lyx and get full path
|
||||
string const s(ChangeExtension(file_name, ".lyx"));
|
||||
|
||||
@ -1922,7 +1911,7 @@ void LyXFunc::doImport(string const & argument)
|
||||
initpath = trypath;
|
||||
}
|
||||
|
||||
string const text = _("Select ") + formats.PrettyName(format)
|
||||
string const text = _("Select ") + formats.prettyName(format)
|
||||
+ _(" file to import");
|
||||
|
||||
FileDialog fileDlg(owner, text,
|
||||
@ -1932,9 +1921,9 @@ void LyXFunc::doImport(string const & argument)
|
||||
make_pair(string(_("Examples")),
|
||||
string(AddPath(system_lyxdir, "examples"))));
|
||||
|
||||
string const extension = "*." + formats.Extension(format)
|
||||
+ "| " + formats.PrettyName(format)
|
||||
+ " (*." + formats.Extension(format) + ")";
|
||||
string const extension = "*." + formats.extension(format)
|
||||
+ "| " + formats.prettyName(format)
|
||||
+ " (*." + formats.extension(format) + ")";
|
||||
|
||||
FileDialog::Result result = fileDlg.Select(initpath,
|
||||
extension);
|
||||
|
26
src/lyxrc.C
26
src/lyxrc.C
@ -875,9 +875,9 @@ int LyXRC::read(string const & filename)
|
||||
if (lexrc.next())
|
||||
flags = lexrc.GetString();
|
||||
if (command.empty() || command == "none")
|
||||
converters.Delete(from, to);
|
||||
converters.erase(from, to);
|
||||
else
|
||||
converters.Add(from, to, command, flags);
|
||||
converters.add(from, to, command, flags);
|
||||
break;
|
||||
}
|
||||
case RC_VIEWER: {
|
||||
@ -886,7 +886,7 @@ int LyXRC::read(string const & filename)
|
||||
format = lexrc.GetString();
|
||||
if (lexrc.next())
|
||||
command = lexrc.GetString();
|
||||
formats.SetViewer(format, command);
|
||||
formats.setViewer(format, command);
|
||||
break;
|
||||
}
|
||||
case RC_FORMAT: {
|
||||
@ -900,14 +900,14 @@ int LyXRC::read(string const & filename)
|
||||
if (lexrc.next())
|
||||
shortcut = lexrc.GetString();
|
||||
if (prettyname.empty()) {
|
||||
if (converters.FormatIsUsed(format))
|
||||
if (converters.formatIsUsed(format))
|
||||
lyxerr << "Can't delete format "
|
||||
<< format << endl;
|
||||
else
|
||||
formats.Delete(format);
|
||||
formats.erase(format);
|
||||
|
||||
} else
|
||||
formats.Add(format, extension, prettyname,
|
||||
formats.add(format, extension, prettyname,
|
||||
shortcut);
|
||||
break;
|
||||
}
|
||||
@ -926,8 +926,8 @@ int LyXRC::read(string const & filename)
|
||||
}
|
||||
|
||||
/// Update converters data-structures
|
||||
converters.Update(formats);
|
||||
converters.BuildGraph();
|
||||
converters.update(formats);
|
||||
converters.buildGraph();
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -1540,7 +1540,7 @@ void LyXRC::output(ostream & os) const
|
||||
for (Formats::const_iterator cit = formats.begin();
|
||||
cit != formats.end(); ++cit) {
|
||||
Format const * format =
|
||||
system_formats.GetFormat(cit->name());
|
||||
system_formats.getFormat(cit->name());
|
||||
if (!format ||
|
||||
format->extension() != cit->extension() ||
|
||||
format->prettyname() != cit->prettyname() ||
|
||||
@ -1554,14 +1554,14 @@ void LyXRC::output(ostream & os) const
|
||||
// New/modifed formats
|
||||
for (Formats::const_iterator cit = system_formats.begin();
|
||||
cit != system_formats.end(); ++cit)
|
||||
if (!formats.GetFormat(cit->name()))
|
||||
if (!formats.getFormat(cit->name()))
|
||||
os << "\\format \"" << cit->name()
|
||||
<< "\" \"\" \"\" \"\"\n";
|
||||
case RC_VIEWER:
|
||||
for (Formats::const_iterator cit = formats.begin();
|
||||
cit != formats.end(); ++cit) {
|
||||
Format const * format =
|
||||
system_formats.GetFormat(cit->name());
|
||||
system_formats.getFormat(cit->name());
|
||||
if ((!format || format->viewer() != cit->viewer()) &&
|
||||
(format || !cit->viewer().empty()))
|
||||
os << "\\viewer \"" << cit->name() << "\" \""
|
||||
@ -1577,7 +1577,7 @@ void LyXRC::output(ostream & os) const
|
||||
for (Converters::const_iterator cit = converters.begin();
|
||||
cit != converters.end(); ++cit) {
|
||||
Converter const * converter =
|
||||
system_converters.GetConverter(cit->from,
|
||||
system_converters.getConverter(cit->from,
|
||||
cit->to);
|
||||
if (!converter ||
|
||||
converter->command != cit->command ||
|
||||
@ -1591,7 +1591,7 @@ void LyXRC::output(ostream & os) const
|
||||
// New/modifed converters
|
||||
for (Converters::const_iterator cit = system_converters.begin();
|
||||
cit != system_converters.end(); ++cit)
|
||||
if (!converters.GetConverter(cit->from, cit->to))
|
||||
if (!converters.getConverter(cit->from, cit->to))
|
||||
os << "\\converter \"" << cit->from
|
||||
<< "\" \"" << cit->to << "\" \"\" \"\"\n";
|
||||
}
|
||||
|
@ -193,6 +193,7 @@ public:
|
||||
|
||||
/// give and set the LyXText status
|
||||
text_status status() const;
|
||||
///
|
||||
void status(BufferView *, text_status) const;
|
||||
|
||||
private:
|
||||
|
14
src/texrow.C
14
src/texrow.C
@ -75,20 +75,6 @@ bool TexRow::getIdFromRow(int row, int & id, int & pos) const
|
||||
find_if(rowlist.begin(), rowlist.end(), same_rownumber(vt));
|
||||
|
||||
if (cit != rowlist.end()) {
|
||||
#if 0
|
||||
RowList::iterator kit = rowlist.begin();
|
||||
RowList::iterator end = rowlist.end();
|
||||
// Increase the pos of all rows with the
|
||||
// same id (and where the pos is larger)
|
||||
// to avoid putting errorinsets at the
|
||||
// same pos.
|
||||
for (; kit != end; ++kit) {
|
||||
if (&(*kit) != &(*cit)
|
||||
&& kit->id() == cit->id()
|
||||
&& kit->pos() >= cit->pos())
|
||||
kit->pos(kit->pos() + 1);
|
||||
}
|
||||
#endif
|
||||
id = cit->id();
|
||||
pos = cit->pos();
|
||||
return true;
|
||||
|
23
src/text.C
23
src/text.C
@ -3179,19 +3179,9 @@ void LyXText::getVisibleRow(BufferView * bview, int y_offset, int x_offset,
|
||||
ww,
|
||||
y_offset + y_top + 2 * defaultHeight(),
|
||||
LColor::pagebreak,
|
||||
Painter::line_onoffdash)
|
||||
#if 0
|
||||
.rectText(0,
|
||||
0,
|
||||
_("Page Break (top)"),
|
||||
pb_font,
|
||||
backgroundColor(),
|
||||
backgroundColor(), false, w, a, d);
|
||||
#else
|
||||
;
|
||||
Painter::line_onoffdash);
|
||||
lyxfont::rectText(_("Page Break (top)"), pb_font,
|
||||
w, a, d);
|
||||
#endif
|
||||
pain.rectText((ww - w)/2,
|
||||
y_offset + y_top + 2 * defaultHeight() + d,
|
||||
_("Page Break (top)"),
|
||||
@ -3376,18 +3366,9 @@ void LyXText::getVisibleRow(BufferView * bview, int y_offset, int x_offset,
|
||||
pain
|
||||
.line(0, y_place, ww, y_place,
|
||||
LColor::pagebreak,
|
||||
Painter::line_onoffdash)
|
||||
#if 0
|
||||
.rectText(0, 0,
|
||||
_("Page Break (bottom)"),
|
||||
pb_font,
|
||||
backgroundColor(),
|
||||
backgroundColor(), false, w, a, d);
|
||||
#else
|
||||
;
|
||||
Painter::line_onoffdash);
|
||||
lyxfont::rectText(_("Page Break (bottom)"), pb_font,
|
||||
w, a, d);
|
||||
#endif
|
||||
pain.rectText((ww - w) / 2, y_place + d,
|
||||
_("Page Break (bottom)"),
|
||||
pb_font,
|
||||
|
18
src/text2.C
18
src/text2.C
@ -423,15 +423,14 @@ void LyXText::makeFontEntriesLayoutSpecific(Buffer const * buf,
|
||||
LyXLayout const & layout =
|
||||
textclasslist.Style(buf->params.textclass, par->getLayout());
|
||||
|
||||
LyXFont layoutfont, tmpfont;
|
||||
for (Paragraph::size_type pos = 0;
|
||||
pos < par->size(); ++pos) {
|
||||
LyXFont layoutfont;
|
||||
for (Paragraph::size_type pos = 0; pos < par->size(); ++pos) {
|
||||
if (pos < beginningOfMainBody(buf, par))
|
||||
layoutfont = layout.labelfont;
|
||||
else
|
||||
layoutfont = layout.font;
|
||||
|
||||
tmpfont = par->getFontSettings(buf->params, pos);
|
||||
LyXFont tmpfont = par->getFontSettings(buf->params, pos);
|
||||
tmpfont.reduce(layoutfont);
|
||||
par->setFont(pos, tmpfont);
|
||||
}
|
||||
@ -2162,19 +2161,24 @@ void LyXText::setCurrentFont(BufferView * bview) const
|
||||
void LyXText::setCursorFromCoordinates(BufferView * bview, int x, int y) const
|
||||
{
|
||||
LyXCursor old_cursor = cursor;
|
||||
|
||||
|
||||
#if 0
|
||||
// Get the row first.
|
||||
|
||||
Row * row = getRowNearY(y);
|
||||
cursor.par(row->par());
|
||||
|
||||
bool bound = false;
|
||||
int column = getColumnNearX(bview, row, x, bound);
|
||||
|
||||
cursor.par(row->par());
|
||||
cursor.pos(row->pos() + column);
|
||||
cursor.x(x);
|
||||
cursor.y(y + row->baseline());
|
||||
cursor.row(row);
|
||||
cursor.boundary(bound);
|
||||
#else
|
||||
setCursorFromCoordinates(bview, cursor, x, y);
|
||||
#endif
|
||||
setCurrentFont(bview);
|
||||
deleteEmptyParagraphMechanism(bview, old_cursor);
|
||||
}
|
||||
@ -2187,7 +2191,7 @@ void LyXText::setCursorFromCoordinates(BufferView * bview, LyXCursor & cur,
|
||||
|
||||
Row * row = getRowNearY(y);
|
||||
bool bound = false;
|
||||
int column = getColumnNearX(bview, row, x, bound);
|
||||
int const column = getColumnNearX(bview, row, x, bound);
|
||||
|
||||
cur.par(row->par());
|
||||
cur.pos(row->pos() + column);
|
||||
|
@ -368,11 +368,7 @@ int Trans::Load(LyXLex & lex)
|
||||
|
||||
if (lex.next(true)) {
|
||||
string string_to = lex.text();
|
||||
#if 0
|
||||
keymap_[key_from] = string_to;
|
||||
#else
|
||||
keymap_[key_from] = string_to;
|
||||
#endif
|
||||
if (lyxerr.debugging(Debug::KBMAP))
|
||||
lyxerr << "\t`" << string_to << "'"
|
||||
<< endl;
|
||||
|
Loading…
Reference in New Issue
Block a user