docstring const ASpell::error()
{
char const * err = 0;
-
+
if (spell_error_object && aspell_error_number(spell_error_object) != 0) {
err = aspell_error_message(spell_error_object);
}
}
-bool reverseDirectionNeeded(Cursor const & cur)
+bool reverseDirectionNeeded(Cursor const & cur)
{
/*
* We determine the directions based on the direction of the
if (params().outputChanges) {
bool dvipost = LaTeXFeatures::isAvailable("dvipost");
bool xcolorsoul = LaTeXFeatures::isAvailable("soul") &&
- LaTeXFeatures::isAvailable("xcolor");
-
+ LaTeXFeatures::isAvailable("xcolor");
+
if (!dvipost && !xcolorsoul) {
Alert::warning(_("Changes not shown in LaTeX output"),
- _("Changes will not be highlighted in LaTeX output, "
- "because neither dvipost nor xcolor/soul are installed.\n"
- "Please install these packages or redefine "
- "\\lyxadded and \\lyxdeleted in the LaTeX preamble."));
+ _("Changes will not be highlighted in LaTeX output, "
+ "because neither dvipost nor xcolor/soul are installed.\n"
+ "Please install these packages or redefine "
+ "\\lyxadded and \\lyxdeleted in the LaTeX preamble."));
} else if (!xcolorsoul) {
Alert::warning(_("Changes not shown in LaTeX output"),
- _("Changes will not be highlighted in LaTeX output "
- "when using pdflatex, because xcolor and soul are not installed.\n"
- "Please install both packages or redefine "
- "\\lyxadded and \\lyxdeleted in the LaTeX preamble."));
+ _("Changes will not be highlighted in LaTeX output "
+ "when using pdflatex, because xcolor and soul are not installed.\n"
+ "Please install both packages or redefine "
+ "\\lyxadded and \\lyxdeleted in the LaTeX preamble."));
}
}
}
ostringstream command;
command << os::python()
- << ' ' << quoteName(lyx2lyx.toFilesystemEncoding())
- << " -t " << convert<string>(LYX_FORMAT)
- << " -o " << quoteName(tmpfile.toFilesystemEncoding())
- << ' ' << quoteName(filename.toFilesystemEncoding());
+ << ' ' << quoteName(lyx2lyx.toFilesystemEncoding())
+ << " -t " << convert<string>(LYX_FORMAT)
+ << " -o " << quoteName(tmpfile.toFilesystemEncoding())
+ << ' ' << quoteName(filename.toFilesystemEncoding());
string const command_str = command.str();
LYXERR(Debug::INFO) << "Running '"
backupName = FileName(fileName() + '~');
if (!lyxrc.backupdir_path.empty())
backupName = FileName(addName(lyxrc.backupdir_path,
- subst(os::internal_path(backupName.absFilename()), '/', '!')));
+ subst(os::internal_path(backupName.absFilename()), '/', '!')));
try {
fs::copy_file(encodedFilename, backupName.toFilesystemEncoding(), false);
madeBackup = true;
} catch (fs::filesystem_error const & fe) {
Alert::error(_("Backup failure"),
- bformat(_("Cannot create backup file %1$s.\n"
- "Please check whether the directory exists and is writeable."),
- from_utf8(backupName.absFilename())));
+ bformat(_("Cannot create backup file %1$s.\n"
+ "Please check whether the directory exists and is writeable."),
+ from_utf8(backupName.absFilename())));
LYXERR(Debug::DEBUG) << "Fs error: " << fe.what() << endl;
}
}
!params().language->babel().empty()) {
// FIXME UNICODE
os << from_utf8(subst(lyxrc.language_command_begin,
- "$$lang",
- params().language->babel()))
+ "$$lang",
+ params().language->babel()))
<< '\n';
texrow().newline();
}
if (!lyxrc.language_auto_end &&
!params().language->babel().empty()) {
os << from_utf8(subst(lyxrc.language_command_end,
- "$$lang",
- params().language->babel()))
+ "$$lang",
+ params().language->babel()))
<< '\n';
texrow().newline();
}
LYXERR(Debug::LATEX) << "makeDocBookFile..." << endl;
//ofstream ofs;
- odocfstream ofs;
+ odocfstream ofs;
if (!openFileWrite(ofs, fname))
return;
if (runparams.flavor == OutputParams::XML)
os << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
- // FIXME UNICODE
+ // FIXME UNICODE
os << "<!DOCTYPE " << from_ascii(top_element) << ' ';
- // FIXME UNICODE
+ // FIXME UNICODE
if (! tclass.class_header().empty())
- os << from_ascii(tclass.class_header());
+ os << from_ascii(tclass.class_header());
else if (runparams.flavor == OutputParams::XML)
os << "PUBLIC \"-//OASIS//DTD DocBook XML//EN\" "
<< "\"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd\"";
preamble += features.getLyXSGMLEntities();
if (!preamble.empty()) {
- os << "\n [ " << preamble << " ]";
+ os << "\n [ " << preamble << " ]";
}
os << ">\n\n";
}
if (params().outputChanges) {
bool dvipost = LaTeXFeatures::isAvailable("dvipost");
bool xcolorsoul = LaTeXFeatures::isAvailable("soul") &&
- LaTeXFeatures::isAvailable("xcolor");
-
- if (features.runparams().flavor == OutputParams::LATEX) {
+ LaTeXFeatures::isAvailable("xcolor");
+
+ if (features.runparams().flavor == OutputParams::LATEX) {
if (dvipost) {
features.require("ct-dvipost");
features.require("dvipost");
features.require("ct-xcolor-soul");
features.require("soul");
features.require("xcolor");
- } else {
+ } else {
features.require("ct-none");
}
} else if (features.runparams().flavor == OutputParams::PDFLATEX ) {
} else {
features.require("ct-none");
}
- }
+ }
}
// AMS Style is at document level
\return \c false if method fails.
*/
ReadStatus readFile(Lexer &, support::FileName const & filename,
- bool fromString = false);
+ bool fromString = false);
/// Use the Pimpl idiom to hide the internals.
class Impl;
if (!getTextClass().isTeXClassAvailable()) {
docstring const msg =
bformat(_("The layout file requested by this document,\n"
- "%1$s.layout,\n"
- "is not usable. This is probably because a LaTeX\n"
- "class or style file required by it is not\n"
- "available. See the Customization documentation\n"
- "for more information.\n"), from_utf8(classname));
+ "%1$s.layout,\n"
+ "is not usable. This is probably because a LaTeX\n"
+ "class or style file required by it is not\n"
+ "available. See the Customization documentation\n"
+ "for more information.\n"), from_utf8(classname));
frontend::Alert::warning(_("Document class not available"),
msg + _("LyX will not be able to produce output."));
}
<< "\n\\papersides " << sides
<< "\n\\paperpagestyle " << pagestyle << '\n';
if (!listings_params.empty())
- os << "\\listings_params \"" <<
+ os << "\\listings_params \"" <<
InsetListingsParams(listings_params).encodedString() << "\"\n";
for (int i = 0; i < 4; ++i) {
if (user_defined_bullet(i) != ITEMIZE_DEFAULTS[i]) {
}
// custom, A3, B3 and B4 paper sizes need geometry
- bool nonstandard_papersize = papersize == PAPER_B3
+ bool nonstandard_papersize = papersize == PAPER_B3
|| papersize == PAPER_B4
|| papersize == PAPER_A3
|| papersize == PAPER_CUSTOM;
if (!buffer_)
return;
-
+
LYXERR(Debug::INFO) << BOOST_CURRENT_FUNCTION
- << "Buffer addr: " << buffer_ << endl;
+ << "Buffer addr: " << buffer_ << endl;
cursor_.push(buffer_->inset());
cursor_.resetAnchor();
buffer_->text().setCurrentFont(cursor_);
// example if this Buffer has been modified by another view.
cursor_.fixIfBroken();
}
- updateMetrics(false);
+ updateMetrics(false);
if (graphics::Previews::status() != LyXRC::PREVIEW_OFF)
graphics::Previews::get().generateBufferPreviews(*buffer_);
}
return true;
}
- if (flags == Update::FitCursor
+ if (flags == Update::FitCursor
|| flags == (Update::Decoration | Update::FitCursor)) {
bool const fit_cursor = fitCursor();
// tell the frontend to update the screen if needed.
{
// tenatively save bookmark, id and pos will be used to
// acturately locate a bookmark in a 'live' lyx session.
- // pit and pos will be updated with bottom level pit/pos
+ // pit and pos will be updated with bottom level pit/pos
// when lyx exits.
LyX::ref().session().bookmarks().save(
FileName(buffer_->fileName()),
}
}
// if top_id == 0, or searching through top_id failed
- // This is the case for a 'restored' bookmark when only bottom
+ // This is the case for a 'restored' bookmark when only bottom
// (document level) pit was saved. Because of this, bookmark
// restoration is inaccurate. If a bookmark was within an inset,
// it will be restored to the left of the outmost inset that contains
it.pit() = bottom_pit;
it.pos() = min(bottom_pos, it.paragraph().size());
setCursor(it);
- return boost::make_tuple(it.pit(), it.pos(),
+ return boost::make_tuple(it.pit(), it.pos(),
it.paragraph().id());
}
// both methods fail
if (buffer_->params().outputChanges) {
bool dvipost = LaTeXFeatures::isAvailable("dvipost");
bool xcolorsoul = LaTeXFeatures::isAvailable("soul") &&
- LaTeXFeatures::isAvailable("xcolor");
-
+ LaTeXFeatures::isAvailable("xcolor");
+
if (!dvipost && !xcolorsoul) {
Alert::warning(_("Changes not shown in LaTeX output"),
- _("Changes will not be highlighted in LaTeX output, "
- "because neither dvipost nor xcolor/soul are installed.\n"
- "Please install these packages or redefine "
- "\\lyxadded and \\lyxdeleted in the LaTeX preamble."));
+ _("Changes will not be highlighted in LaTeX output, "
+ "because neither dvipost nor xcolor/soul are installed.\n"
+ "Please install these packages or redefine "
+ "\\lyxadded and \\lyxdeleted in the LaTeX preamble."));
} else if (!xcolorsoul) {
Alert::warning(_("Changes not shown in LaTeX output"),
- _("Changes will not be highlighted in LaTeX output "
- "when using pdflatex, because xcolor and soul are not installed.\n"
- "Please install both packages or redefine "
- "\\lyxadded and \\lyxdeleted in the LaTeX preamble."));
+ _("Changes will not be highlighted in LaTeX output "
+ "when using pdflatex, because xcolor and soul are not installed.\n"
+ "Please install both packages or redefine "
+ "\\lyxadded and \\lyxdeleted in the LaTeX preamble."));
}
}
break;
Inset * const inset = iit->inset;
if (inset->covers(*this, x, y)) {
if (!inset->descendable())
- // No need to go further down if the inset is not
+ // No need to go further down if the inset is not
// descendable.
return inset;
Text const * inner_text = inset->getText(i);
if (inner_text) {
// Try deeper.
- Inset const * inset_deeper =
+ Inset const * inset_deeper =
getCoveringInset(*inner_text, x, y);
if (inset_deeper)
return inset_deeper;
// make sure we stay within the screen...
cmd.y = min(max(cmd.y, -1), height_);
-
+
if (cmd.action == LFUN_MOUSE_MOTION && cmd.button() == mouse_button::none) {
-
+
// Get inset under mouse, if there is one.
- Inset const * covering_inset =
+ Inset const * covering_inset =
getCoveringInset(buffer_->text(), cmd.x, cmd.y);
if (covering_inset == last_inset_)
// Same inset, no need to do anything...
// not expose the button for redraw. We adjust here the metrics dimension
// to enable a full redraw.
// FIXME: It is possible to redraw only the area around the button!
- if (need_redraw
+ if (need_redraw
&& metrics_info_.update_strategy == SingleParUpdate) {
- // FIXME: It should be possible to redraw only the area around
+ // FIXME: It should be possible to redraw only the area around
// the button by doing this:
//
//metrics_info_.singlepar = false;
// This should be changed if it is further utilized.
return need_redraw;
}
-
+
// Build temporary cursor.
Inset * inset = buffer_->text().editXY(cur, cmd.x, cmd.y);
if (tmc_it == text_metrics_.end()) {
tmc_it = text_metrics_.insert(
make_pair(t, TextMetrics(this, const_cast<Text *>(t)))).first;
- }
+ }
return tmc_it->second;
}
if (need_anchor_change)
cur.resetAnchor();
-
+
if (!changed)
return false;
// position is in the nucleus of the inset, notifyCursorLeaves
// will kill the script inset itself. So we check all the
// elements of the cursor to make sure that they are correct.
- // For an example, see bug 2933:
- // http://bugzilla.lyx.org/show_bug.cgi?id=2933
+ // For an example, see bug 2933:
+ // http://bugzilla.lyx.org/show_bug.cgi?id=2933
// The code below could maybe be moved to a DocIterator method.
//lyxerr << "cur before " << cur <<std::endl;
DocIterator dit(cur.inset());
anchor_ref_ = int(buftext.paragraphs().size() - 1);
offset_ref_ = 0;
}
-
+
// If the paragraph metrics has changed, we can not
// use the singlepar optimisation.
if (singlepar
// Rebreak anchor paragraph.
if (!singlepar)
tm.redoParagraph(pit);
-
+
// Clear out the position cache in case of full screen redraw.
if (!singlepar)
coord_cache_.clear();
<< "size: " << size
<< endl;
- metrics_info_ = ViewMetricsInfo(pit1, pit2, y1, y2,
+ metrics_info_ = ViewMetricsInfo(pit1, pit2, y1, y2,
singlepar? SingleParUpdate: FullScreenUpdate, size);
if (lyxerr.debugging(Debug::WORKAREA)) {
* is a sliding window of the entire document rendering.
* It is the official interface between the LyX core and
* the frontend WorkArea.
- *
+ *
* \sa WorkArea
* \sa Buffer
* \sa CoordCache
* When merging two adjacent changes, the changetime is not considered,
* only the equality of the change type and author is checked (in method
* isSimilarTo(...)). If two changes are in fact merged (in method merge()),
- * the later change time is preserved.
+ * the later change time is preserved.
*/
bool Change::isSimilarTo(Change const & change)
if (l.type == Change::UNCHANGED) {
return true;
}
-
+
return l.author == r.author &&
l.changetime == r.changetime;
}
Change const & Changes::lookup(pos_type const pos) const
{
static Change const noChange = Change(Change::UNCHANGED);
-
+
ChangeTable::const_iterator it = table_.begin();
ChangeTable::const_iterator const end = table_.end();
(it + 1)->range.start = it->range.start;
(it + 1)->change.changetime = max(it->change.changetime,
- (it + 1)->change.changetime);
+ (it + 1)->change.changetime);
table_.erase(it);
// start again
it = table_.begin();
if (change.type == Change::DELETED) {
docstring str = "\\lyxdeleted{" +
bparams.authors().get(change.author).name() + "}{" +
- chgTime + "}{";
+ chgTime + "}{";
os << str;
column += str.size();
} else if (change.type == Change::INSERTED) {
/// output latex to mark a transition between two change types
/// returns length of text outputted
static int latexMarkChange(odocstream & os, BufferParams const & bparams,
- Change const & oldChange, Change const & change);
+ Change const & oldChange, Change const & change);
/// output .lyx file format for transitions between changes
static void lyxMarkChange(std::ostream & os, int & column,
bool Converters::convert(Buffer const * buffer,
- FileName const & from_file, FileName const & to_file,
- FileName const & orig_from,
- string const & from_format, string const & to_format,
- ErrorList & errorList, int conversionflags)
+ FileName const & from_file, FileName const & to_file,
+ FileName const & orig_from,
+ string const & from_format, string const & to_format,
+ ErrorList & errorList, int conversionflags)
{
if (from_format == to_format)
return move(from_format, from_file, to_file, false);
// FIXME UNICODE
string const infile2 = (conv.original_dir)
? infile.absFilename() : to_utf8(makeRelPath(from_utf8(infile.absFilename()),
- from_utf8(path)));
+ from_utf8(path)));
string const outfile2 = (conv.original_dir)
? outfile.absFilename() : to_utf8(makeRelPath(from_utf8(outfile.absFilename()),
- from_utf8(path)));
+ from_utf8(path)));
string command = conv.command;
command = subst(command, token_from, quoteName(infile2));
};
///
bool convert(Buffer const * buffer,
- support::FileName const & from_file, support::FileName const & to_file,
- support::FileName const & orig_from,
- std::string const & from_format, std::string const & to_format,
- ErrorList & errorList, int conversionflags = none);
+ support::FileName const & from_file, support::FileName const & to_file,
+ support::FileName const & orig_from,
+ std::string const & from_format, std::string const & to_format,
+ ErrorList & errorList, int conversionflags = none);
///
void update(Formats const & formats);
///
public:
CacheItem() {}
CacheItem(FileName const & orig_from, string const & to_format,
- time_t t, unsigned long c)
+ time_t t, unsigned long c)
: timestamp(t), checksum(c)
{
std::ostringstream os;
<< '-' << to_format;
cache_name = FileName(addName(cache_dir.absFilename(), os.str()));
LYXERR(Debug::FILES) << "Add file cache item " << orig_from
- << ' ' << to_format << ' ' << cache_name
- << ' ' << timestamp << ' ' << checksum
- << '.' << std::endl;
+ << ' ' << to_format << ' ' << cache_name
+ << ' ' << timestamp << ' ' << checksum
+ << '.' << std::endl;
}
~CacheItem() {}
FileName cache_name;
converted_file.empty())
return;
LYXERR(Debug::FILES) << BOOST_CURRENT_FUNCTION << ' ' << orig_from
- << ' ' << to_format << ' ' << converted_file
- << std::endl;
+ << ' ' << to_format << ' ' << converted_file
+ << std::endl;
// Is the file in the cache already?
CacheItem * item = pimpl_->find(orig_from, to_format);
Mover const & mover = getMover(to_format);
if (item) {
LYXERR(Debug::FILES) << "ConverterCache::add(" << orig_from << "):\n"
- "The file is already in the cache."
- << std::endl;
+ "The file is already in the cache."
+ << std::endl;
// First test for timestamp
if (timestamp == item->timestamp) {
LYXERR(Debug::FILES) << "Same timestamp."
- << std::endl;
+ << std::endl;
return;
} else {
// Maybe the contents is still the same?
unsigned long const checksum = support::sum(orig_from);
if (checksum == item->checksum) {
LYXERR(Debug::FILES) << "Same checksum."
- << std::endl;
+ << std::endl;
return;
}
item->checksum = checksum;
}
if (!mover.copy(converted_file, item->cache_name, 0600))
LYXERR(Debug::FILES) << "ConverterCache::add("
- << orig_from << "):\n"
- "Could not copy file."
- << std::endl;
+ << orig_from << "):\n"
+ "Could not copy file."
+ << std::endl;
} else {
CacheItem new_item(orig_from, to_format, timestamp,
support::sum(orig_from));
format_cache.cache[to_format] = new_item;
} else
LYXERR(Debug::FILES) << "ConverterCache::add("
- << orig_from << "):\n"
- "Could not copy file."
- << std::endl;
+ << orig_from << "):\n"
+ "Could not copy file."
+ << std::endl;
}
}
if (!lyxrc.use_converter_cache || orig_from.empty())
return;
LYXERR(Debug::FILES) << BOOST_CURRENT_FUNCTION << ' ' << orig_from
- << ' ' << to_format << std::endl;
+ << ' ' << to_format << std::endl;
CacheType::iterator const it1 = pimpl_->cache.find(orig_from);
if (it1 == pimpl_->cache.end())
if (!lyxrc.use_converter_cache || orig_from.empty())
return false;
LYXERR(Debug::FILES) << BOOST_CURRENT_FUNCTION << ' ' << orig_from
- << ' ' << to_format << std::endl;
+ << ' ' << to_format << std::endl;
CacheItem * const item = pimpl_->find(orig_from, to_format);
if (!item) {
string const & to_format) const
{
LYXERR(Debug::FILES) << BOOST_CURRENT_FUNCTION << ' ' << orig_from
- << ' ' << to_format << std::endl;
+ << ' ' << to_format << std::endl;
CacheItem * const item = pimpl_->find(orig_from, to_format);
BOOST_ASSERT(item);
if (!lyxrc.use_converter_cache || orig_from.empty() || dest.empty())
return false;
LYXERR(Debug::FILES) << BOOST_CURRENT_FUNCTION << ' ' << orig_from
- << ' ' << to_format << ' ' << dest << std::endl;
+ << ' ' << to_format << ' ' << dest << std::endl;
CacheItem * const item = pimpl_->find(orig_from, to_format);
BOOST_ASSERT(item);
* the cache if it is not already in or not up to date.
*/
void add(support::FileName const & orig_from, std::string const & to_format,
- support::FileName const & converted_file) const;
+ support::FileName const & converted_file) const;
/// Remove a file from the cache.
void remove(support::FileName const & orig_from,
- std::string const & to_format) const;
+ std::string const & to_format) const;
/// Remove all cached \p from_format -> \p to_format conversions
void remove_all(std::string const & from_format,
- std::string const & to_format) const;
+ std::string const & to_format) const;
/**
* Returns \c true if \c orig_from converted to \c to_format is in
* the cache and up to date.
*/
bool inCache(support::FileName const & orig_from,
- std::string const & to_format) const;
+ std::string const & to_format) const;
/// Get the name of the cached file
support::FileName const & cacheName(support::FileName const & orig_from,
- std::string const & to_format) const;
+ std::string const & to_format) const;
/// Copy the file from the cache to \p dest
bool copy(support::FileName const & orig_from, std::string const & to_format,
- support::FileName const & dest) const;
+ support::FileName const & dest) const;
private:
/** Make the c-tor, d-tor private so we can control how many objects
docstring const numbertype(label, i + 1, j - i - 1);
docstring const counter(label, j + 1, k - j - 1);
docstring const rep = labelItem(counter, numbertype);
- label = docstring(label, 0, i) + rep
+ label = docstring(label, 0, i) + rep
+ docstring(label, k + 1, docstring::npos);
//lyxerr << " : " << " (" << counter << ","
// << numbertype << ") -> " << label << endl;
odocstringstream ods;
ods << '\n';
// only add blank line if we're not in an ERT or Listings inset
- if (par.ownerCode() != Inset::ERT_CODE
+ if (par.ownerCode() != Inset::ERT_CODE
&& par.ownerCode() != Inset::LISTINGS_CODE)
ods << '\n';
return ods.str();
// If empty cell, and not part of a big cell
if (lastpos() == 0 && inset().nargs() == 1) {
popLeft();
- // Directly delete empty cell: [|[]] => [|]
+ // Directly delete empty cell: [|[]] => [|]
if (inMathed()) {
plainErase();
resetAnchor();
bool one_cell = inset().nargs() == 1;
if (one_cell && lastpos() == 0) {
popLeft();
- // Directly delete empty cell: [|[]] => [|]
+ // Directly delete empty cell: [|[]] => [|]
if (inMathed()) {
plainErase();
resetAnchor();
// If we are in an inset which returns forceDefaultParagraphs,
// set the paragraphs to default
if (cur.inset().forceDefaultParagraphs(cur.idx())) {
- Layout_ptr const layout =
+ Layout_ptr const layout =
buffer.params().getTextClass().defaultLayout();
ParagraphList::iterator const end = insertion.end();
- for (ParagraphList::iterator par = insertion.begin();
+ for (ParagraphList::iterator par = insertion.begin();
par != end; ++par)
par->layout(layout);
}
}
tmpbuf->setChange(Change(buffer.params().trackChanges ?
- Change::INSERTED : Change::UNCHANGED));
+ Change::INSERTED : Change::UNCHANGED));
}
bool const empty = pars[pit].empty();
void putClipboard(ParagraphList const & paragraphs, textclass_type textclass,
- docstring const & plaintext)
+ docstring const & plaintext)
{
// For some strange reason gcc 3.2 and 3.3 do not accept
// Buffer buffer(string(), false);
// to the buffer language.
if (it->ownerCode() == Inset::ERT_CODE || it->ownerCode() == Inset::LISTINGS_CODE) {
it->changeLanguage(buf.params(), latex_language,
- buf.getLanguage());
+ buf.getLanguage());
}
it->setInsetOwner(0);
}
asciiSel += pit->asString(buffer, false);
if (asciiSel.size() > 25) {
asciiSel.replace(22, docstring::npos,
- from_ascii("..."));
+ from_ascii("..."));
break;
}
}
cur.pit() = endpit;
// sometimes necessary
- if (doclear
+ if (doclear
&& text->paragraphs()[begpit].stripLeadingSpaces(bp.trackChanges))
cur.fixIfBroken();
void copySelection(Cursor & cur, docstring const & plaintext)
{
// In tablemode, because copy and paste actually use special table stack
- // we do not attemp to get selected paragraphs under cursor. Instead, a
+ // we do not attemp to get selected paragraphs under cursor. Instead, a
// paragraph with the plain text version is generated so that table cells
// can be pasted as pure text somewhere else.
if (cur.selBegin().idx() != cur.selEnd().idx()) {
LYXERR(Debug::ACTION) << BOOST_CURRENT_FUNCTION << ": `"
<< to_utf8(cur.selectionAsString(true)) << "'."
<< endl;
-
+
if (cur.selection())
copySelectionToStack(cur, selectionBuffer);
// tell X whether we now have a valid selection
return;
recordUndo(cur);
pasteParagraphList(cur, selectionBuffer[0].first,
- selectionBuffer[0].second, errorList);
+ selectionBuffer[0].second, errorList);
cur.setSelection();
}
* they get merged.
* \param realcut If this is true: Push the selection to the cut buffer and
* system clipboard. Set this to false to only delete the
- * selection.
+ * selection.
*/
void cutSelection(Cursor & cur, bool doclear = true, bool realcut = true);
/// Push the current selection to the cut buffer and the system clipboard.
* It changes layouts and character styles.
*/
void switchBetweenClasses(textclass_type c1, textclass_type c2,
- InsetText & in, ErrorList &);
+ InsetText & in, ErrorList &);
/// Get the current selection as a string. Does not change the selection.
/// Does only work if the whole selection is in mathed.
bool DocIterator::fixIfBroken()
{
bool fixed = false;
-
+
for (size_t i = slices_.size() - 1; i != 0; --i)
if (!slices_[i].isValid()) {
pop_back();
fixed = true;
}
- // The top level CursorSlice should always be valid.
+ // The top level CursorSlice should always be valid.
BOOST_ASSERT(slices_[0].isValid());
if (idx() > lastidx()) {
Encoding::Encoding(string const & n, string const & l, string const & i,
- bool f, Encoding::Package p)
+ bool f, Encoding::Package p)
: Name_(n), LatexName_(l), iconvName_(i), fixedwidth_(f), package_(p)
{
if (n == "ascii") {
bool Encodings::is_arabic_special(char_type c)
{
return (c >= 0x0621 && c <= 0x0625) ||
- c == 0x0627 || c == 0x0629 ||
- c == 0x062f || c == 0x0648 ||
+ c == 0x0627 || c == 0x0629 ||
+ c == 0x062f || c == 0x0648 ||
(c >= 0x0630 && c <= 0x0632) ||
- c == 0x0649;
+ c == 0x0649;
}
info.force = true;
else
lyxerr << "Ignoring unknown flag `" << flag
- << "' for symbol `0x"
- << std::hex << symbol << std::dec
+ << "' for symbol `0x"
+ << std::hex << symbol << std::dec
<< "'." << endl;
}
fixedwidth = false;
else
lex.printError("Encodings::read: "
- "Unknown width: `$$Token'");
+ "Unknown width: `$$Token'");
lex.next();
string const p = lex.getString();
Encoding::Package package;
package = Encoding::CJK;
else
lex.printError("Encodings::read: "
- "Unknown package: `$$Token'");
+ "Unknown package: `$$Token'");
LYXERR(Debug::INFO) << "Reading encoding " << name << endl;
encodinglist[name] = Encoding(name, latexname,
- iconvname, fixedwidth,
- package);
+ iconvname, fixedwidth,
+ package);
if (lex.lex() != et_end)
lex.printError("Encodings::read: "
"missing end");
Encoding() {}
///
Encoding(std::string const & n, std::string const & l,
- std::string const & i, bool f, Package p);
+ std::string const & i, bool f, Package p);
///
void init() const;
///
/// \param encfile encodings definition file
/// \param symbolsfile unicode->LaTeX mapping file
void read(support::FileName const & encfile,
- support::FileName const & symbolsfile);
+ support::FileName const & symbolsfile);
/// Get encoding from LyX name \p name
Encoding const * getFromLyXName(std::string const & name) const;
/// Get encoding from LaTeX name \p name
os << lcolor.getGUIName(color()) << ", ";
if (emph() != INHERIT)
os << bformat(_("Emphasis %1$s, "),
- _(GUIMiscNames[emph()]));
+ _(GUIMiscNames[emph()]));
if (underbar() != INHERIT)
os << bformat(_("Underline %1$s, "),
- _(GUIMiscNames[underbar()]));
+ _(GUIMiscNames[underbar()]));
if (noun() != INHERIT)
os << bformat(_("Noun %1$s, "),
- _(GUIMiscNames[noun()]));
+ _(GUIMiscNames[noun()]));
if (bits == inherit)
os << _("Default") << ", ";
if (!params || (language() != params->language))
os << bformat(_("Language: %1$s, "),
- _(language()->display()));
+ _(language()->display()));
if (number() != OFF)
os << bformat(_(" Number %1$s"),
- _(GUIMiscNames[number()]));
+ _(GUIMiscNames[number()]));
return rtrim(os.str(), ", ");
}
/// Writes the head of the LaTeX needed to impose this font
// Returns number of chars written.
int Font::latexWriteStartChanges(odocstream & os, BufferParams const & bparams,
- OutputParams const & runparams,
- Font const & base,
- Font const & prev) const
+ OutputParams const & runparams,
+ Font const & base,
+ Font const & prev) const
{
bool env = false;
if (language()->lang() == "farsi") {
os << "\\textFR{";
count += 8;
- } else if (!isRightToLeft() &&
+ } else if (!isRightToLeft() &&
base.language()->lang() == "farsi") {
os << "\\textLR{";
count += 8;
}
// When the current language is Hebrew, Arabic, or Farsi
- // the numbers are written Left-to-Right. ArabTeX package
+ // the numbers are written Left-to-Right. ArabTeX package
// reorders the number automatically but the packages used
// for Hebrew and Farsi (Arabi) do not.
- if (number() == ON && prev.number() != ON
- && (language()->lang() == "hebrew"
+ if (number() == ON && prev.number() != ON
+ && (language()->lang() == "hebrew"
|| language()->lang() == "farsi")) {
os << "{\\beginL ";
count += 9;
// Returns number of chars written
// This one corresponds to latexWriteStartChanges(). (Asger)
int Font::latexWriteEndChanges(odocstream & os, BufferParams const & bparams,
- OutputParams const & runparams,
- Font const & base,
- Font const & next) const
+ OutputParams const & runparams,
+ Font const & base,
+ Font const & next) const
{
int count = 0;
bool env = false;
}
// When the current language is Hebrew, Arabic, or Farsi
- // the numbers are written Left-to-Right. ArabTeX package
+ // the numbers are written Left-to-Right. ArabTeX package
// reorders the number automatically but the packages used
// for Hebrew and Farsi (Arabi) do not.
- if (number() == ON && next.number() != ON
- && (language()->lang() == "hebrew"
+ if (number() == ON && next.number() != ON
+ && (language()->lang() == "hebrew"
|| language()->lang() == "farsi")) {
os << "\\endL}";
count += 6;
font state active now.
*/
int latexWriteStartChanges(odocstream &, BufferParams const & bparams,
- OutputParams const & runparams,
- Font const & base,
- Font const & prev) const;
+ OutputParams const & runparams,
+ Font const & base,
+ Font const & prev) const;
/** Writes the tail of the LaTeX needed to change to this font.
Returns number of chars written. Base is the font state we want
to achieve.
*/
int latexWriteEndChanges(odocstream &, BufferParams const & bparams,
- OutputParams const & runparams,
- Font const & base,
- Font const & next) const;
+ OutputParams const & runparams,
+ Font const & base,
+ Font const & next) const;
/// Build GUI description of font state
Format::Format(string const & n, string const & e, string const & p,
string const & s, string const & v, string const & ed,
- int flags)
+ int flags)
: name_(n), extension_(e), prettyname_(p), shortcut_(s), viewer_(v),
editor_(ed), flags_(flags)
{}
void Formats::add(string const & name, string const & extension,
string const & prettyname, string const & shortcut,
- string const & viewer, string const & editor,
- int flags)
+ string const & viewer, string const & editor,
+ int flags)
{
FormatList::iterator it =
find_if(formatlist.begin(), formatlist.end(),
FormatNamesEqual(name));
if (it == formatlist.end())
formatlist.push_back(Format(name, extension, prettyname,
- shortcut, viewer, editor, flags));
+ shortcut, viewer, editor, flags));
else
*it = Format(name, extension, prettyname, shortcut, viewer,
editor, flags);
void add(std::string const & name);
///
void add(std::string const & name, std::string const & extension,
- std::string const & prettyname, std::string const & shortcut,
- std::string const & viewer, std::string const & editor,
- int flags);
+ std::string const & prettyname, std::string const & shortcut,
+ std::string const & viewer, std::string const & editor,
+ int flags);
///
void erase(std::string const & name);
///
it->func.origin = FuncRequest::KEYBOARD;
return;
} else if (!it->table.get()) {
- lyxerr << "Error: New binding for '"
+ lyxerr << "Error: New binding for '"
<< to_utf8(seq->print(false))
<< "' is overriding old binding..."
<< endl;
/**
* print all available keysyms
- * @param forgui true if the string should use translations and
- * special characters.
+ * @param forgui true if the string should use translations and
+ * special characters.
*/
docstring const print(bool forgui) const;
/**
* Return the current sequence as a string.
- * @param forgui true if the string should use translations and
- * special characters.
+ * @param forgui true if the string should use translations and
+ * special characters.
* @see parse()
*/
docstring const print(bool forgui) const;
/**
* Return the current sequence and available options as
* a string. No options are added if no curmap kb map exists.
- * @param forgui true if the string should use translations and
- * special characters.
+ * @param forgui true if the string should use translations and
+ * special characters.
*/
docstring const printOptions(bool forgui) const;
head.update();
// Can't just check if anything has changed because it might
// have aborted on error last time... in which cas we need
- // to re-run latex and collect the error messages
+ // to re-run latex and collect the error messages
// (even if they are the same).
if (!fs::exists(output_file.toFilesystemEncoding())) {
LYXERR(Debug::DEPEND)
// A second latex run is needed.
FileName const idxfile(changeExtension(file.absFilename(), ".idx"));
rerun = fs::exists(idxfile.toFilesystemEncoding()) &&
- fs::is_empty(idxfile.toFilesystemEncoding());
+ fs::is_empty(idxfile.toFilesystemEncoding());
// run makeindex
if (head.haschanged(idxfile)) {
bool LaTeX::runMakeIndex(string const & f, OutputParams const & runparams,
- string const & params)
+ string const & params)
{
LYXERR(Debug::LATEX)
<< "idx file has been made, running makeindex on file "
<< f << endl;
string tmp = lyxrc.index_command + ' ';
-
+
tmp = subst(tmp, "$$lang", runparams.document_language);
tmp += quoteName(f);
tmp += params;
// Sometimes, filenames are broken across lines.
// We care for that and save suspicious lines.
- // Here we exclude some cases where we are sure
+ // Here we exclude some cases where we are sure
// that there is no continued filename
if (!lastline.empty()) {
static regex package_info("Package \\w+ Info: .*");
found_file = false;
// (6) "Writing nomenclature file file.ext"
} else if (regex_match(token, sub, regnomencl) ||
- regex_match(token, sub, regoldnomencl))
+ regex_match(token, sub, regoldnomencl))
// check for dot
found_file = checkLineBreak(sub.str(1), head);
// (7) "\tf@toc=\write<nr>" (for MikTeX)
///
bool runMakeIndex(std::string const &, OutputParams const &,
- std::string const & = std::string());
+ std::string const & = std::string());
///
bool runMakeIndexNomencl(support::FileName const &, OutputParams const &,
- std::string const &, std::string const &);
+ std::string const &, std::string const &);
///
std::vector<Aux_Info> const scanAuxFiles(support::FileName const &);
// shadecolor for shaded
if (mustProvide("framed") && mustProvide("color")) {
RGBColor c = RGBColor(lcolor.getX11Name(Color::shadedbg));
- packages << "\\definecolor{shadecolor}{rgb}{"
+ packages << "\\definecolor{shadecolor}{rgb}{"
<< c.r/255 << ',' << c.g/255 << ',' << c.b/255 << "}\n";
}
}
// amssymb.sty
- if (mustProvide("amssymb")
+ if (mustProvide("amssymb")
|| params_.use_amsmath == BufferParams::package_on)
packages << "\\usepackage{amssymb}\n";
// esint must be after amsmath and wasysym, since it will redeclare
// inconsistent integral symbols
- if (mustProvide("esint")
+ if (mustProvide("esint")
&& params_.use_esint != BufferParams::package_off)
packages << "\\usepackage{esint}\n";
// but don't use the compatibility option since it is
// incompatible to other packages.
packages << "\\usepackage{nomencl}\n"
- "% the following is useful when we have the old nomencl.sty package\n"
- "\\providecommand{\\printnomenclature}{\\printglossary}\n"
- "\\providecommand{\\makenomenclature}{\\makeglossary}\n"
- "\\makenomenclature\n";
+ "% the following is useful when we have the old nomencl.sty package\n"
+ "\\providecommand{\\printnomenclature}{\\printglossary}\n"
+ "\\providecommand{\\makenomenclature}{\\makeglossary}\n"
+ "\\makenomenclature\n";
}
if (mustProvide("listings"))
packages << "\\usepackage{listings}\n";
-
+
return packages.str();
}
}
if (mustProvide("ct-xcolor-soul")) {
RGBColor cadd = RGBColor(lcolor.getX11Name(Color::addedtext));
- macros << "\\providecolor{lyxadded}{rgb}{"
+ macros << "\\providecolor{lyxadded}{rgb}{"
<< cadd.r/255 << ',' << cadd.g/255 << ',' << cadd.b/255 << "}\n";
RGBColor cdel = RGBColor(lcolor.getX11Name(Color::deletedtext));
- macros << "\\providecolor{lyxdeleted}{rgb}{"
+ macros << "\\providecolor{lyxdeleted}{rgb}{"
<< cdel.r/255 << ',' << cdel.g/255 << ',' << cdel.b/255 << "}\n";
macros << "\\newcommand{\\lyxadded}[3]{\\color{lyxadded}{#3}}\n"
///
bool operator!=(Length const & l1, Length const & l2);
/** Test whether \p data represents a valid length.
- *
+ *
* \returns whether \p data is a valid length
* \param data Length in LyX format. Since the only difference between LyX
* and LaTeX format is the representation of length variables as units (e.g.
c = cc;
// skip ','s
- if (c == ',')
+ if (c == ',')
continue;
if (c == commentChar) {
int Lexer::Pimpl::lex()
{
//NOTE: possible bug.
- if (next() && status == LEX_TOKEN)
+ if (next() && status == LEX_TOKEN)
return search_kw(getString().c_str());
return status;
}
bool Lexer::Pimpl::inputAvailable()
{
- return is.good();
+ return is.good();
}
docstring const Lexer::getDocString() const
{
lastReadOk_ = pimpl_->status == LEX_DATA || pimpl_->status == LEX_TOKEN;
-
+
if (lastReadOk_)
return pimpl_->getDocString();
};
/** Generalized simple lexical analizer.
- Use the method isOK() to check if there is still data available
+ Use the method isOK() to check if there is still data available
for lexing. Use one of the the operators void* or ! to test if
the last reading operation was successful.
-
+
Example:
int readParam(LyxLex &lex) {
if (lex) param = p; // only use the input if reading was successful
}
return param;
- }
+ }
@see LyXRC.cpp for an example of usage.
*/
/// stream is open and end of stream is not reached
/// FIXME: test also if pushTok is not empty
- /// FIXME: the method should be renamed to something like
+ /// FIXME: the method should be renamed to something like
/// dataAvailable(), in order to reflect the real behavior
bool isOK() const;
/// FIXME: The next two operators should be replaced by one method
- /// called e.g. lastReadOk(), in order to reflect the real
+ /// called e.g. lastReadOk(), in order to reflect the real
/// behavior
/// last read operation was successful.
operator void const *() const;
/// are we using the GUI at all?
-/**
+/**
* We default to true and this is changed to false when the export feature is used.
*/
bool use_gui = true;
/// The main application class private implementation.
-struct LyX::Singletons
+struct LyX::Singletons
{
Singletons()
{
// The system converters copy after reading lyxrc.defaults.
Converters system_converters_;
-
+
///
Movers movers_;
-
+
///
Movers system_movers_;
};
Server & LyX::server()
{
BOOST_ASSERT(pimpl_->lyx_server_.get());
- return *pimpl_->lyx_server_.get();
+ return *pimpl_->lyx_server_.get();
}
-Server const & LyX::server() const
+Server const & LyX::server() const
{
BOOST_ASSERT(pimpl_->lyx_server_.get());
- return *pimpl_->lyx_server_.get();
+ return *pimpl_->lyx_server_.get();
}
if (it != pimpl_->messages_.end())
return it->second;
- std::pair<map<string, Messages>::iterator, bool> result =
+ std::pair<map<string, Messages>::iterator, bool> result =
pimpl_->messages_.insert(std::make_pair(language, Messages(language)));
BOOST_ASSERT(result.second);
easyParse(argc, argv);
try { support::init_package(to_utf8(from_local8bit(argv[0])),
- cl_system_support, cl_user_support,
- support::top_build_dir_is_one_level_up);
+ cl_system_support, cl_user_support,
+ support::top_build_dir_is_one_level_up);
} catch (support::ExceptionMessage const & message) {
if (message.type_ == support::ErrorException) {
Alert::error(message.title_, message.details_);
Buffer * buf = *I;
bool success = false;
buf->dispatch(batch_command, &success);
- final_success |= success;
+ final_success |= success;
}
prepareExit();
return !final_success;
// Note: socket callback must be registered after init(argc, argv)
// such that package().temp_dir() is properly initialized.
pimpl_->lyx_server_.reset(new Server(&pimpl_->lyxfunc_, lyxrc.lyxpipes));
- pimpl_->lyx_socket_.reset(new ServerSocket(&pimpl_->lyxfunc_,
+ pimpl_->lyx_socket_.reset(new ServerSocket(&pimpl_->lyxfunc_,
FileName(package().temp_dir().absFilename() + "/lyxsocket")));
// Start the real execution loop.
exit_status = pimpl_->application_->exec();
-
+
prepareExit();
// Restore original font resources after Application is destroyed.
posy = convert<int>(val);
}
- if (!geometryArg.empty())
+ if (!geometryArg.empty())
{
width = 0;
height = 0;
lyxrc.sans_font_name = pimpl_->application_->sansFontName();
if (lyxrc.typewriter_font_name.empty())
- lyxrc.typewriter_font_name
+ lyxrc.typewriter_font_name
= pimpl_->application_->typewriterFontName();
}
}
LYXERR(Debug::INIT) << "LyX tmp dir: `"
- << package().temp_dir().absFilename()
- << '\'' << endl;
+ << package().temp_dir().absFilename()
+ << '\'' << endl;
LYXERR(Debug::INIT) << "Reading session information '.lyx/session'..." << endl;
pimpl_->session_.reset(new Session(lyxrc.num_lastfiles));
LYXERR(Debug::INIT) << "About to read " << name << "..." << endl;
-
+
FileName ui_path;
if (include) {
ui_path = libFileSearch("ui", name, "inc");
}
else
ui_path = libFileSearch("ui", name, "ui");
-
+
if (ui_path.empty()) {
LYXERR(Debug::INIT) << "Could not find " << name << endl;
showFileError(name);
// Read the encodings file `name'
bool LyX::readEncodingsFile(string const & enc_name,
- string const & symbols_name)
+ string const & symbols_name)
{
LYXERR(Debug::INIT) << "About to read " << enc_name << " and "
- << symbols_name << "..." << endl;
+ << symbols_name << "..." << endl;
FileName const symbols_path = libFileSearch(string(), symbols_name);
if (symbols_path.empty()) {
///
KeyMap & topLevelKeymap();
KeyMap const & topLevelKeymap() const;
-
+
///
Converters & converters();
Converters & systemConverters();
/// \param enc_name encodings definition file
/// \param symbols_name unicode->LaTeX mapping file
bool readEncodingsFile(std::string const & enc_name,
- std::string const & symbols_name);
+ std::string const & symbols_name);
/// parsing of non-gui LyX options.
void easyParse(int & argc, char * argv[]);
/// shows up a parsing error on screen
// see http://bugzilla.lyx.org/show_bug.cgi?id=3092
if (bm.bottom_pit != new_pit || bm.bottom_pos != new_pos || bm.top_id != new_id )
const_cast<BookmarksSection::Bookmark &>(bm).updatePos(new_pit, new_pos, new_id);
- }
+ }
}
menuWrite(lyx_view_->buffer());
lyx_view_->message(str + _(" done."));
} else {
- writeAs(lyx_view_->buffer());
+ writeAs(lyx_view_->buffer());
}
updateFlags = Update::None;
break;
// when the target is in the parent or another child document.
lyx_view_->buffer()->setParentName(parentfilename);
setMessage(bformat(_("Opening child document %1$s..."),
- makeDisplayPath(filename.absFilename())));
+ makeDisplayPath(filename.absFilename())));
} else
setMessage(_("Document not loaded."));
break;
case LFUN_PREFERENCES_SAVE: {
lyxrc.write(makeAbsPath("preferences",
- package().user_support().absFilename()),
- false);
+ package().user_support().absFilename()),
+ false);
break;
}
if (defaults.writeFile(FileName(defaults.fileName())))
setMessage(bformat(_("Document defaults saved in %1$s"),
- makeDisplayPath(fname)));
+ makeDisplayPath(fname)));
else
setErrorMessage(from_ascii(N_("Unable to save document defaults")));
break;
void handleKeyFunc(kb_action action);
/// goto a bookmark
/// openFile: whether or not open a file if the file is not opened
- /// switchToBuffer: whether or not switch to buffer if the buffer is
+ /// switchToBuffer: whether or not switch to buffer if the buffer is
/// not the current buffer
void gotoBookmark(unsigned int idx, bool openFile, bool switchToBuffer);
}
} else {
formats.add(format, extension, prettyname,
- shortcut, viewer, editor, flgs);
+ shortcut, viewer, editor, flgs);
}
break;
}
class Lexer;
/// This contains the runtime configuration of LyX
-class LyXRC //: public noncopyable
+class LyXRC //: public noncopyable
// after 1.1.6 I will use a LyXRCStruct here and then this can be made
// noncopyable again. For now I want to minimise changes. ARRae 20001010
{
docstring const label = convert<docstring>(i) + ". "
+ makeDisplayPath(bm.bookmark(i).filename.absFilename(), 20)
+ char_type('|') + convert<docstring>(i);
- tomenu.add(MenuItem(MenuItem::Command, label, FuncRequest(LFUN_BOOKMARK_GOTO,
+ tomenu.add(MenuItem(MenuItem::Command, label, FuncRequest(LFUN_BOOKMARK_GOTO,
convert<docstring>(i))));
}
}
// frontends are not supposed to turn on/off toolbars, if they cannot
// update ToolbarBackend::flags. That is to say, ToolbarsBackend::flags
// should reflect the true state of toolbars.
- //
- // menu is displayed as
+ //
+ // menu is displayed as
// on/off review
- // and
+ // and
// review (auto)
// in the case of auto.
if (cit->flags & ToolbarInfo::AUTO)
/// returns the status of the lfun associated with this entry
void status(FuncStatus const & status) { status_ = status; }
/**
- * returns the binding associated to this action.
+ * returns the binding associated to this action.
* Use the native UI format when \c forgui is true.
*/
docstring const binding(bool forgui) const;
#endif
setlocale(LC_CTYPE, oldCTYPE.c_str());
- std::pair<TranslationCache::iterator, bool> result =
+ std::pair<TranslationCache::iterator, bool> result =
cache_.insert(std::make_pair(m, translated));
BOOST_ASSERT(result.second);
private:
///
std::string lang_;
- /// Did we warn about unavailable locale already?
+ /// Did we warn about unavailable locale already?
mutable bool warned_;
///
typedef std::map<std::string, docstring> TranslationCache;
using support::quoteName;
bool Mover::copy(support::FileName const & from, support::FileName const & to,
- unsigned long int mode) const
+ unsigned long int mode) const
{
return do_copy(from, to, to.absFilename(), mode);
}
bool Mover::rename(support::FileName const & from,
- support::FileName const & to) const
+ support::FileName const & to) const
{
return do_rename(from, to, to.absFilename());
}
protected:
virtual bool
do_copy(support::FileName const & from, support::FileName const & to,
- std::string const &, unsigned long int mode) const;
+ std::string const &, unsigned long int mode) const;
virtual bool
do_rename(support::FileName const & from, support::FileName const & to,
private:
virtual bool
do_copy(support::FileName const & from, support::FileName const & to,
- std::string const & latex, unsigned long int mode) const;
+ std::string const & latex, unsigned long int mode) const;
virtual bool
do_rename(support::FileName const & from, support::FileName const & to,
copy (e.g. in insets): \code
int InsetFoo::latex(..., OutputParams const & runparams_in) const
{
- OutputParams runparams(runparams_in);
+ OutputParams runparams(runparams_in);
runparams.inComment = true;
...
InsetBla::latex(..., runparams);
*/
bool inComment;
- /** allow output of only part of the top-level paragraphs
+ /** allow output of only part of the top-level paragraphs
* par_begin: beginning paragraph
*/
pit_type par_begin;
- /** allow output of only part of the top-level paragraphs
+ /** allow output of only part of the top-level paragraphs
* par_end: par_end-1 is the ending paragraph
* if par_begin=par_end, output all paragraphs
*/
pit_type par_end;
- /** whether or not do actual file copying and image conversion
+ /** whether or not do actual file copying and image conversion
* This mode will be used to preview the source code
*/
bool dryrun;
/// Output the surrogate pair formed by \p c and \p next to \p os.
/// \return the number of characters written.
int latexSurrogatePair(odocstream & os, value_type c, value_type next,
- Encoding const &);
+ Encoding const &);
/// Output a space in appropriate formatting (or a surrogate pair
/// if the next character is a combining character).
/// \return whether a surrogate pair was output.
bool simpleTeXBlanks(Encoding const &,
- odocstream &, TexRow & texrow,
+ odocstream &, TexRow & texrow,
pos_type & i,
unsigned int & column,
Font const & font,
Layout const & style);
///
void simpleTeXSpecialChars(Buffer const &, BufferParams const &,
- odocstream &,
- TexRow & texrow, OutputParams const &,
- Font & running_font,
+ odocstream &,
+ TexRow & texrow, OutputParams const &,
+ Font & running_font,
Font & basefont,
Font const & outerfont,
bool & open_font,
// Update the font table.
FontTable search_font(pos, Font());
- for (FontList::iterator it
+ for (FontList::iterator it
= lower_bound(fontlist.begin(), fontlist.end(), search_font, matchFT());
it != fontlist.end(); ++it)
{
void Paragraph::Pimpl::insertInset(pos_type pos, Inset * inset,
- Change const & change)
+ Change const & change)
{
BOOST_ASSERT(inset);
BOOST_ASSERT(pos >= 0 && pos <= size());
if (trackChanges) {
Change change = changes_.lookup(pos);
- // set the character to DELETED if
+ // set the character to DELETED if
// a) it was previously unchanged or
// b) it was inserted by a co-author
bool Paragraph::Pimpl::simpleTeXBlanks(Encoding const & encoding,
- odocstream & os, TexRow & texrow,
- pos_type & i,
+ odocstream & os, TexRow & texrow,
+ pos_type & i,
unsigned int & column,
Font const & font,
Layout const & style)
void Paragraph::insert(pos_type start, docstring const & str,
- Font const & font, Change const & change)
+ Font const & font, Change const & change)
{
for (size_t i = 0, n = str.size(); i != n ; ++i)
insertChar(start + i, str[i], font, change);
void Paragraph::insertChar(pos_type pos, Paragraph::value_type c,
- bool trackChanges)
+ bool trackChanges)
{
pimpl_->insertChar(pos, c, Change(trackChanges ?
- Change::INSERTED : Change::UNCHANGED));
+ Change::INSERTED : Change::UNCHANGED));
}
void Paragraph::insertChar(pos_type pos, Paragraph::value_type c,
- Font const & font, bool trackChanges)
+ Font const & font, bool trackChanges)
{
pimpl_->insertChar(pos, c, Change(trackChanges ?
- Change::INSERTED : Change::UNCHANGED));
+ Change::INSERTED : Change::UNCHANGED));
setFont(pos, font);
}
void Paragraph::insertChar(pos_type pos, Paragraph::value_type c,
- Font const & font, Change const & change)
+ Font const & font, Change const & change)
{
pimpl_->insertChar(pos, c, change);
setFont(pos, font);
void Paragraph::insertInset(pos_type pos, Inset * inset,
- Change const & change)
+ Change const & change)
{
pimpl_->insertInset(pos, inset, change);
}
void Paragraph::insertInset(pos_type pos, Inset * inset,
- Font const & font, Change const & change)
+ Font const & font, Change const & change)
{
pimpl_->insertInset(pos, inset, change);
setFont(pos, font);
// This could go to ParagraphParameters if we want to
int Paragraph::startTeXParParams(BufferParams const & bparams,
- odocstream & os, TexRow & texrow,
+ odocstream & os, TexRow & texrow,
bool moving_arg) const
{
int column = 0;
// This could go to ParagraphParameters if we want to
-int Paragraph::endTeXParParams(BufferParams const & bparams,
- odocstream & os, TexRow & texrow,
+int Paragraph::endTeXParParams(BufferParams const & bparams,
+ odocstream & os, TexRow & texrow,
bool moving_arg) const
{
int column = 0;
}
if (!asdefault)
- column += startTeXParParams(bparams, os,
+ column += startTeXParParams(bparams, os,
texrow,
runparams.moving_arg);
}
}
++column;
-
+
value_type const c = getChar(i);
// Fully instantiated font
i != body_pos - 1)
{
column += font.latexWriteStartChanges(os, bparams,
- runparams, basefont,
- last_font);
+ runparams, basefont,
+ last_font);
running_font = font;
open_font = true;
}
}
if (!asdefault) {
- column += endTeXParParams(bparams, os, texrow,
+ column += endTeXParParams(bparams, os, texrow,
runparams.moving_arg);
}
if (c == ' ')
break;
os << sgml::escapeChar(c);
- }
+ }
}
return i;
}
value_type c = getChar(i);
if (style->pass_thru)
- os.put(c);
+ os.put(c);
else
- os << sgml::escapeChar(c);
+ os << sgml::escapeChar(c);
}
font_old = font;
}
int Paragraph::checkBiblio(bool track_changes)
{
//FIXME From JS:
- //This is getting more and more a mess. ...We really should clean
+ //This is getting more and more a mess. ...We really should clean
//up this bibitem issue for 1.6. See also bug 2743.
// Add bibitem insets if necessary
//have to erase one.
if (hasbibitem && erasedInsetPosition < 0)
return 0;
-
- //There was an InsetBibitem at the beginning and we did have to
+
+ //There was an InsetBibitem at the beginning and we did have to
//erase one. So we give its properties to the beginning inset.
if (hasbibitem) {
- InsetBibitem * inset =
+ InsetBibitem * inset =
static_cast<InsetBibitem *>(insetlist.begin()->inset);
if (!oldkey.empty())
inset->setParam("key", oldkey);
inset->setParam("label", oldlabel);
return -erasedInsetPosition;
}
-
+
//There was no inset at the beginning, so we need to create one with
//the key and label of the one we erased.
InsetBibitem * inset(new InsetBibitem(InsetCommandParams("bibitem")));
void validate(LaTeXFeatures &) const;
///
- int startTeXParParams(BufferParams const &, odocstream &, TexRow &,
+ int startTeXParParams(BufferParams const &, odocstream &, TexRow &,
bool) const;
///
- int endTeXParParams(BufferParams const &, odocstream &, TexRow &,
+ int endTeXParParams(BufferParams const &, odocstream &, TexRow &,
bool) const;
pos_type endpos, Font_size def_size) const;
///
void insert(pos_type pos, docstring const & str,
- Font const & font, Change const & change);
+ Font const & font, Change const & change);
///
void insertChar(pos_type pos, value_type c, bool trackChanges);
///
void insertChar(pos_type pos, value_type c,
- Font const &, bool trackChanges);
+ Font const &, bool trackChanges);
///
void insertChar(pos_type pos, value_type c,
- Font const &, Change const & change);
+ Font const &, Change const & change);
///
void insertInset(pos_type pos, Inset * inset,
- Change const & change);
+ Change const & change);
///
void insertInset(pos_type pos, Inset * inset,
- Font const &, Change const & change);
+ Font const &, Change const & change);
///
bool insetAllowed(Inset_code code);
///
/// returns -1 if inset not found
int getPositionOfInset(Inset const * inset) const;
- /// returns true if at least one line break or line separator has been deleted
+ /// returns true if at least one line break or line separator has been deleted
/// at the beginning of the paragraph (either physically or logically)
bool stripLeadingSpaces(bool trackChanges);
/// The painter and others use this
RowList const & rows() const { return rows_; }
/// The painter and others use this
- std::vector<bool> const & rowChangeStatus() const
+ std::vector<bool> const & rowChangeStatus() const
{ return row_change_status_; }
///
void updateRowChangeStatus();
// bool duplex;
/** Test that all the fields contain valid entries. It's unlikely
- that the internal code will get this wrong however new ports
+ that the internal code will get this wrong however new ports
and external scripts might drive the wrong values in.
*/
void testInvariant() const;
} // namespace lyx
-#endif // SERVER_H
+#endif // SERVER_H
getline(is, tmp);
if (tmp == "" || tmp[0] == '#' || tmp[0] == ' ' || !absolutePath(tmp))
continue;
-
+
// read lastfiles
FileName const file(tmp);
if (fs::exists(file.toFilesystemEncoding()) &&
!fs::is_directory(file.toFilesystemEncoding()) &&
lastfiles.size() < num_lastfiles)
lastfiles.push_back(file);
- else
+ else
LYXERR(Debug::INIT) << "LyX: Warning: Ignore last file: " << tmp << endl;
} while (is.good());
}
value >> posx;
value >> posy;
toolbars.push_back(boost::make_tuple(key, ToolbarInfo(state, location, posx, posy)));
- } else
+ } else
LYXERR(Debug::INIT) << "LyX: Warning: Ignore toolbar info: " << tmp << endl;
} catch (...) {
LYXERR(Debug::INIT) << "LyX: Warning: unknown Toolbar info: " << tmp << endl;
/// top_id is determined when a bookmark is restored from session; and
/// bottom_pit and bottom_pos are determined from top_id when a bookmark
/// is save to session. (What a mess! :-)
- ///
+ ///
/// TODO: bottom level pit and pos will be replaced by StableDocIterator
class Bookmark {
public:
: filename(f), bottom_pit(pit), bottom_pos(pos), top_id(id), top_pos(tpos) {}
/// set bookmark top_id, this is because newly loaded bookmark
/// may have zero par_id and par_pit can change during editing, see bug 3092
- void updatePos(pit_type pit, pos_type pos, int id) {
+ void updatePos(pit_type pit, pos_type pos, int id) {
bottom_pit = pit;
bottom_pos = pos;
top_id = id;
state(ON), location(NOTSET), posx(0), posy(0) { }
///
ToolbarInfo(int s, int loc, int x=0, int y=0) :
- state(static_cast<State>(s)),
+ state(static_cast<State>(s)),
location(static_cast<Location>(loc)),
posx(x),
posy(y)
/// y-position of the toolbar
int posy;
-
+
/// potentially, icons
};
///
LastFilesSection & lastFiles() { return last_files; }
-
+
///
LastFilesSection const & lastFiles() const { return last_files; }
///
LastOpenedSection const & lastOpened() const { return last_opened; }
-
+
///
LastFilePosSection & lastFilePos() { return last_file_pos; }
-
+
///
LastFilePosSection const & lastFilePos() const { return last_file_pos; }
bool endsBeforeEndOfPar = (endPos < pars_[endPit].size());
// first, accept/reject changes within each individual paragraph (do not consider end-of-par)
-
+
for (pit_type pit = begPit; pit <= endPit; ++pit) {
pos_type parSize = pars_[pit].size();
continue;
// do not consider last paragraph if the cursor ends at pos 0
- if (pit == endPit && endPos == 0)
+ if (pit == endPit && endPos == 0)
break; // last iteration anyway
pos_type left = (pit == begPit ? begPos : 0);
pars_[pit].rejectChanges(cur.buffer().params(), left, right);
}
}
-
+
// next, accept/reject imaginary end-of-par characters
-
+
for (pit_type pit = begPit; pit <= endPit; ++pit) {
pos_type pos = pars_[pit].size();
deleteEmptyParagraphMechanism(begPit, endPit, cur.buffer().params().trackChanges);
- //
+ //
finishUndo();
cur.clearSelection();
void Text::acceptChanges(BufferParams const & bparams)
{
- pit_type pars_size = static_cast<pit_type>(pars_.size());
+ pit_type pars_size = static_cast<pit_type>(pars_.size());
// first, accept changes within each individual paragraph
// (do not consider end-of-par)
for (pit_type pit = 0; pit < pars_size; ++pit) {
- if (!pars_[pit].empty()) // prevent assertion failure
+ if (!pars_[pit].empty()) // prevent assertion failure
pars_[pit].acceptChanges(bparams, 0, pars_[pit].size());
}
pit_type pars_size = static_cast<pit_type>(pars_.size());
// first, reject changes within each individual paragraph
- // (do not consider end-of-par)
+ // (do not consider end-of-par)
for (pit_type pit = 0; pit < pars_size; ++pit) {
- if (!pars_[pit].empty()) // prevent assertion failure
+ if (!pars_[pit].empty()) // prevent assertion failure
pars_[pit].rejectChanges(bparams, 0, pars_[pit].size());
}
pos_type pos = (pit == begPit ? begPos : 0);
right = (pit == endPit ? endPos : parSize);
- // process sequences of modified characters; in change
+ // process sequences of modified characters; in change
// tracking mode, this approach results in much better
// usability than changing case on a char-by-char basis
docstring changes;
cur.text()->setCursor(cur.top(), cur.pit(), cur.pos());
checkBufferStructure(cur.buffer(), cur);
}
-
+
return needsUpdate;
}
Paragraph const & prevpar = prevcur.paragraph();
// is it an empty paragraph?
- if (cur.lastpos() == 0
+ if (cur.lastpos() == 0
|| (cur.lastpos() == 1 && par.isSeparator(0))) {
recordUndo(cur, Undo::ATOMIC, prevcur.pit(), cur.pit());
plist.erase(boost::next(plist.begin(), cur.pit()));
needsUpdate = true;
}
// is previous par empty?
- else if (prevcur.lastpos() == 0
+ else if (prevcur.lastpos() == 0
|| (prevcur.lastpos() == 1 && prevpar.isSeparator(0))) {
recordUndo(cur, Undo::ATOMIC, prevcur.pit(), cur.pit());
plist.erase(boost::next(plist.begin(), prevcur.pit()));
// types of insets and take our abbreviation from them.
if (name.empty()) {
Inset::Code const codes[] = {
- Inset::FLOAT_CODE,
+ Inset::FLOAT_CODE,
Inset::WRAP_CODE,
Inset::FOOT_CODE
};
}
}
}
-
+
// Create a correct prefix for prettyref
if (name == "theorem")
name = from_ascii("thm");
name = from_ascii("fn");
else if (name == "listing")
name = from_ascii("lst");
-
+
if (!name.empty())
text = name.substr(0, 3) + ':' + text;
bool bound = false;
int xx = x;
- pos_type const pos = row.pos()
+ pos_type const pos = row.pos()
+ tm.getColumnNearX(pit, row, xx, bound);
LYXERR(Debug::DEBUG)
Paragraph & par = cur.paragraph();
- // Get the positions of the characters to be transposed.
+ // Get the positions of the characters to be transposed.
pos_type pos1 = pos - 1;
pos_type pos2 = pos;
char_type char1 = par.getChar(pos1);
Font const font1 =
par.getFontSettings(cur.buffer().params(), pos1);
-
+
char_type char2 = par.getChar(pos2);
Font const font2 =
par.getFontSettings(cur.buffer().params(), pos2);
/// just selects the word the cursor is in
void selectWord(Cursor & cur, word_location loc);
- /// what type of change operation to make
+ /// what type of change operation to make
enum ChangeOp {
ACCEPT,
REJECT
/// FIXME: cleanup to use BufferView::getCoveringInset() and
/// setCursorFromCoordinates() instead of checkInsetHit().
Inset * editXY(Cursor & cur, int x, int y);
-
+
/// Move cursor one line up.
/**
* Returns true if an update is needed after the move.
pos_type pos, Font const & fnt)
{
BOOST_ASSERT(!pars_[pit].isInset(pos) ||
- !pars_[pit].getInset(pos)->noFontChange());
+ !pars_[pit].getInset(pos)->noFontChange());
Font font = fnt;
Layout_ptr const & layout = pars_[pit].layout();
pos_type pos, Font const & font, bool toggleall)
{
BOOST_ASSERT(pars_[pit].isInset(pos) &&
- pars_[pit].getInset(pos)->noFontChange());
+ pars_[pit].getInset(pos)->noFontChange());
Inset * const inset = pars_[pit].getInset(pos);
DocIterator dit = doc_iterator_begin(*inset);
// And resolve it completely
real_current_font.realize(layoutfont);
- // if there is no selection that's all we need to do
+ // if there is no selection that's all we need to do
if (!cur.selection())
return;
recordUndoSelection(cur);
setFont(cur.buffer(), cur.selectionBegin(), cur.selectionEnd(), font,
- toggleall);
+ toggleall);
}
{
BOOST_ASSERT(this == cur.text());
BOOST_ASSERT(inset);
- cur.paragraph().insertInset(cur.pos(), inset,
+ cur.paragraph().insertInset(cur.pos(), inset,
Change(cur.buffer().params().trackChanges ?
- Change::INSERTED : Change::UNCHANGED));
+ Change::INSERTED : Change::UNCHANGED));
}
if (cur.boundary() && pos > 0 && pos < cur.lastpos()) {
--pos;
- // We may have just moved to the previous row ---
+ // We may have just moved to the previous row ---
// we're going to be needing its bidi tables!
bidi.computeTables(par, cur.buffer(), cur.textRow());
}
* from which we are entering. Otherwise, cursor placement goes awry,
* and when we exit from the beginning, we'll be placed *after* the
* inset.
- */
+ */
if (!front)
--cur.pos();
inset->edit(cur, front);
// If checkAndActivateInset returns true, that means that
// the cursor was placed inside it, so we're done
if (!checkAndActivateInset(cur, false)) {
- if (!cur.boundary() &&
- cur.textRow().pos() == cur.pos()
+ if (!cur.boundary() &&
+ cur.textRow().pos() == cur.pos()
// FIXME: the following two conditions are copied
// from cursorRight; however, isLineSeparator()
// is definitely wrong here, isNewline I'm not sure
// about. I'm leaving them as comments for now,
// until we understand why they should or shouldn't
// be here.
- /*&&
+ /*&&
!cur.paragraph().isLineSeparator(cur.pos()-1) &&
!cur.paragraph().isNewline(cur.pos() - 1)*/) {
- updateNeeded |= setCursor(cur, cur.pit(), cur.pos(),
+ updateNeeded |= setCursor(cur, cur.pit(), cur.pos(),
true, true);
}
- updateNeeded |= setCursor(cur, cur.pit(),cur.pos() - 1,
+ updateNeeded |= setCursor(cur, cur.pit(),cur.pos() - 1,
true, false);
}
return updateNeeded;
true, false);
bool updateNeeded = false;
- // If checkAndActivateInset returns true, that means that
+ // If checkAndActivateInset returns true, that means that
// the cursor was placed inside it, so we're done
if (!checkAndActivateInset(cur, true)) {
if (cur.textRow().endpos() == cur.pos() + 1 &&
cur.setTargetX();
// We want to keep the x-target on subsequent up movements
// that cross beyond the end of short lines. Thus a special
- // handling when the cursor is at the end of line: Use the new
+ // handling when the cursor is at the end of line: Use the new
// x-target only if the old one was before the end of line.
- if (cur.pos() != pm.rows()[row].endpos()
+ if (cur.pos() != pm.rows()[row].endpos()
|| (!isWithinRtlParagraph(cur) && x < cur.targetX())
|| (isWithinRtlParagraph(cur) && x > cur.targetX())) {
cur.setTargetX();
// We want to keep the x-target on subsequent down movements
// that cross beyond the end of short lines. Thus a special
- // handling when the cursor is at the end of line: Use the new
+ // handling when the cursor is at the end of line: Use the new
// x-target only if the old one was before the end of line.
- if (cur.pos() != pm.rows()[row].endpos()
+ if (cur.pos() != pm.rows()[row].endpos()
|| (!isWithinRtlParagraph(cur) && x < cur.targetX())
|| (isWithinRtlParagraph(cur) && x > cur.targetX())) {
Cursor dummy = cur;
if (dummy == old)
++dummy.pos();
-
+
bool const changed = cur.bv().checkDepm(dummy, old);
// Make sure that cur gets back whatever happened to dummy(Lgb)
}
// don't delete anything if this is the only remaining paragraph within the given range
- // note: Text::acceptOrRejectChanges() sets the cursor to 'first' after calling DEPM
+ // note: Text::acceptOrRejectChanges() sets the cursor to 'first' after calling DEPM
if (first == last)
continue;
std::swap(pars_[pit], pars_[pit + 1]);
ParIterator begin(cur);
- // begin.pos() (== cur.pos()) may point beyond the end of the
+ // begin.pos() (== cur.pos()) may point beyond the end of the
// paragraph referenced by begin. This would cause a crash
// in updateLabels()
begin.pos() = 0;
std::swap(pars_[pit], pars_[pit - 1]);
ParIterator end = ParIterator(cur);
- // end.pos() (== cur.pos()) may point beyond the end of the
+ // end.pos() (== cur.pos()) may point beyond the end of the
// paragraph referenced by end. This would cause a crash
// in boost::next()
end.pos() = 0;
// FIXME (Abdel 01/02/2006):
// What follows would be a partial fix for bug 2154:
// http://bugzilla.lyx.org/show_bug.cgi?id=2154
- // This automatically put the label inset _after_ a
+ // This automatically put the label inset _after_ a
// numbered section. It should be possible to extend the mechanism
// to any kind of LateX environement.
// The correct way to fix that bug would be at LateX generation.
break;
case LFUN_CHARS_TRANSPOSE:
- charsTranspose(cur);
+ charsTranspose(cur);
break;
case LFUN_PASTE:
case LFUN_CLIPBOARD_PASTE:
cur.clearSelection();
pasteClipboard(cur, bv->buffer()->errorList("Paste"),
- cmd.argument() == "paragraph");
+ cmd.argument() == "paragraph");
bv->buffer()->errors("Paste");
break;
case LFUN_PRIMARY_SELECTION_PASTE:
pasteString(cur, theSelection().get(),
- cmd.argument() == "paragraph");
+ cmd.argument() == "paragraph");
break;
case LFUN_UNICODE_INSERT: {
}
break;
}
-
+
case LFUN_QUOTE_INSERT: {
Paragraph & par = cur.paragraph();
pos_type pos = cur.pos();
pars.push_back(Paragraph());
pars.back().setInsetOwner(pars[0].inInset());
pars.back().layout(tclass.defaultLayout());
-
+
}
// reposition the cursor to the caption
// update flag treatment.
if (singleParUpdate) {
// Inserting characters does not change par height
- ParagraphMetrics const & pms
+ ParagraphMetrics const & pms
= cur.bv().parMetrics(cur.bottom().text(), cur.bottom().pit());
if (pms.dim().height()
== olddim.height()) {
//
//if (cur.result().update() != Update::FitCursor)
// cur.noUpdate();
- //
+ //
// But some LFUNs do not set Update::FitCursor when needed, so we
// do it for all. This is not very harmfull as FitCursor will provoke
// a full redraw only if needed but still, a proper review of all LFUN
if (tmp.empty()) {
lexrc.printError("Could not find input"
- "file: " + inc);
+ "file: " + inc);
error = true;
} else if (read(tmp, true)) {
lexrc.printError("Error reading input"
if (real_file.empty()) {
lyxerr << "TextClassList::Read: unable to find "
- "textclass file `"
+ "textclass file `"
<< to_utf8(makeDisplayPath(real_file.absFilename(), 1000))
<< "'. Exiting." << endl;
return false;
if (!lex.isOK()) {
lyxerr << "TextClassList::Read: unable to open "
- "textclass file `"
+ "textclass file `"
<< to_utf8(makeDisplayPath(real_file.absFilename(), 1000))
<< "'\nCheck your installation. LyX can't continue."
<< endl;
// returns: whole string, classtype (not used here), first option, description
BOOST_ASSERT(sub.size()==4);
// now, add the layout to textclass.
- TextClass tmpl(textclass, sub.str(2)==""?textclass:sub.str(2),
+ TextClass tmpl(textclass, sub.str(2)==""?textclass:sub.str(2),
sub.str(3) + " <" + path + ">", true);
if (lyxerr.debugging(Debug::TCLASS))
tmpl.load(path);
// If .layout is not in local directory, or an invalid layout is found, return false
return make_pair(false, textclass_type(0));
}
-
+
// Global variable: textclass table.
TextClassList textclasslist;
/// Read textclass list. Returns false if this fails.
bool read();
-
- /// add a textclass from user local directory.
- /// Return ture/false, and textclass number
- std::pair<bool, textclass_type> const
- addTextClass(std::string const & textclass, std::string const & path);
+
+ /// add a textclass from user local directory.
+ /// Return ture/false, and textclass number
+ std::pair<bool, textclass_type> const
+ addTextClass(std::string const & textclass, std::string const & path);
private:
///
//lyxerr << "Text::metrics: width: " << mi.base.textwidth
// << " maxWidth: " << max_width_ << "\nfont: " << mi.base.font << endl;
-
+
bool changed = false;
unsigned int h = 0;
main_text_ = (text_ == &buffer.text());
bool changed = false;
- // FIXME This check ought to be done somewhere else. It is the reason
+ // FIXME This check ought to be done somewhere else. It is the reason
// why text_ is not const. But then, where else to do it?
// Well, how can you end up with either (a) a biblio environment that
// has no InsetBibitem or (b) a biblio environment with more than one
if (label.empty())
return 0;
- FontMetrics const & fm
+ FontMetrics const & fm
= theFontMetrics(text_->getLabelFont(buffer, par));
return max(0, fm.width(label) - w);
maxasc += int(layoutasc * 2 / (2 + pars[pit].getDepth()));
maxdesc += int(layoutdesc * 2 / (2 + pars[pit].getDepth()));
- // FIXME: the correct way is to do the following is to move the
- // following code in another method specially tailored for the
+ // FIXME: the correct way is to do the following is to move the
+ // following code in another method specially tailored for the
// main Text. The following test is thus bogus.
// Top and bottom margin of the document (only at top-level)
if (main_text_) {
return 0;
}
- frontend::FontMetrics const & fm
+ frontend::FontMetrics const & fm
= theFontMetrics(text_->getLabelFont(buffer, par));
while (vc < end && tmpx <= x) {
private:
- ///
+ ///
ParagraphMetrics & parMetrics(pit_type, bool redo_paragraph);
/// the minimum space a manual label needs on the screen in pixels
/// returns pos in given par at given x coord.
pos_type x2pos(pit_type pit, int row, int x) const;
-
+
// FIXME: is there a need for this?
//int pos2x(pit_type pit, pos_type pos) const;
void TocBackend::updateItem(ParConstIterator const & par_it)
{
- // TODO should not happen,
+ // TODO should not happen,
// a call to TocBackend::update() is missing somewhere
if (toc("tableofcontents").empty())
return;
if (inset.lyxCode() == Inset::OPTARG_CODE) {
if (!tocstring.empty())
break;
- Paragraph const & par =
+ Paragraph const & par =
*static_cast<InsetOptArg&>(inset).paragraphs().begin();
if (!toc_item->par_it_->getLabelstring().empty())
tocstring = toc_item->par_it_->getLabelstring() + ' ';
case Inset::OPTARG_CODE: {
if (!tocstring.empty())
break;
- Paragraph const & par =
+ Paragraph const & par =
*static_cast<InsetOptArg&>(inset).paragraphs().begin();
if (!pit->getLabelstring().empty())
tocstring = pit->getLabelstring() + ' ';
/// the action corresponding to the goTo above
FuncRequest action() const;
-
+
protected:
/// Current position of item.
ParConstIterator par_it_;
void writePlaintextTocList(std::string const & type, odocstream & os) const;
private:
- ///
+ ///
TocList tocs_;
///
Buffer const * buffer_;
TO_ICONPALETTE,
TO_LAST
};
-
+
struct keyword_item toolTags[TO_LAST - 1] = {
{ "end", TO_ENDTOOLBAR },
{ "iconpalette", TO_ICONPALETTE },
add(ToolbarItem(ToolbarItem::POPUPMENU, name, label));
}
break;
-
+
case TO_ICONPALETTE:
if (lex.next(true)) {
string const name = lex.getString();
add(ToolbarItem(ToolbarItem::ICONPALETTE, name, label));
}
break;
-
+
case TO_LAYOUTS:
add(ToolbarItem(ToolbarItem::LAYOUTS,
FuncRequest(kb_action(ToolbarItem::LAYOUTS))));
break;
-
+
case TO_TABLEINSERT:
if (lex.next(true)) {
docstring const tooltip = lex.getDocString();
FuncRequest(kb_action(ToolbarItem::TABLEINSERT)), tooltip));
}
break;
-
+
case TO_ENDTOOLBAR:
quit = true;
break;
TO_ENDTOOLBARSET,
TO_LAST
};
-
+
struct keyword_item toolTags[TO_LAST - 1] = {
{ "end", TO_ENDTOOLBARSET },
{ "toolbar", TO_TOOLBAR }
LAYOUTS,
/// a special widget to insert tabulars
TABLEINSERT,
- ///
+ ///
POPUPMENU,
///
ICONPALETTE
docstring const & match(char_type c);
///
void insertException(KmodException & exclist, char_type c,
- docstring const & data, bool = false,
+ docstring const & data, bool = false,
tex_accent = TEX_NOACCENT);
///
void freeException(KmodException & exclist);
setCaptionLabels(icap, type, label, counters);
if (icap.lyxCode() == Inset::CAPTION_CODE) {
// We found a caption!
- counters.step(counter);
+ counters.step(counter);
int number = counters.value(counter);
InsetCaption & ic = static_cast<InsetCaption &>(icap);
ic.setType(type);
InsetList::iterator end = par.insetlist.end();
for (; it != end; ++it) {
Inset & inset = *it->inset;
- if (inset.lyxCode() == Inset::FLOAT_CODE
+ if (inset.lyxCode() == Inset::FLOAT_CODE
|| inset.lyxCode() == Inset::WRAP_CODE) {
docstring const name = inset.name();
if (name.empty())
Point getPos(BufferView const & bv, DocIterator const & dit, bool boundary)
{
CursorSlice const & bot = dit.bottom();
- CoordCache::ParPosCache::const_iterator cache_it =
+ CoordCache::ParPosCache::const_iterator cache_it =
bv.coordCache().getParPos().find(bot.text());
if (cache_it == bv.coordCache().getParPos().end())
return Point(-1, -1);
// FIXME UNICODE: We don't know the encoding of the file
docstring file_content = from_utf8(tmpstr);
if (file_content.empty()) {
- Alert::error(_("Reading not UTF-8 encoded file"),
+ Alert::error(_("Reading not UTF-8 encoded file"),
_("The file is not UTF-8 encoded.\n"
"It will be read as local 8Bit-encoded.\n"
"If this does not give the correct result\n"
"to UTF-8 with a program other than LyX.\n"));
file_content = from_local8bit(tmpstr);
}
-
+
return normalize_kc(file_content);
}
// -*- C++ -*-
/**
* \file debug.h
- *
+ *
* FIXME: It would be nice if, in lyx::use_gui mode, instead of
* outputting to the console, we would pipe all messages onto a file
* and visualise the contents dynamically in a Qt window if needed.
InsetCollapsable::CollapseStatus st;
InsetERTMailer::string2params(to_utf8(cmd.argument()), st);
return new InsetERT(params, st);
-
+
} else if (name == "listings") {
InsetListingsParams par;
InsetListingsMailer::string2params(to_utf8(cmd.argument()), par);
std::pair<bool, docstring> const askForText_pimpl(docstring const & msg, docstring const & dflt);
} // namespace lyx
-
{
LyXView & view = gui().createRegisteredView();
int view_id = view.id();
-
+
theLyXFunc().setLyXView(&view);
/*int workArea_id_ =*/ gui().newWorkArea(width, height, view_id);
common to all frontends.
Model/View/Controller separation in LyX:
-
+
1) The Model: \c Buffer
The Buffer is the in-memory representation of a LyX file format. The
is represented on screen. There is one unique Buffer per opened LyX
file.
-
+
2) The Controller: \c BufferView / \c Painter
- The BufferView is a tool used by the view that translates a part of
+ The BufferView is a tool used by the view that translates a part of
the Buffer contents into drawing routines. The BufferView asks each
inset of the Buffer to draw itself onto the screen using the Painter.
There can be only one Buffer displayed in a BufferView. While there
The \c Painter is just a virtual interface to formalize each kind of
drawing routines (text, line, rectangle, etc).
-
+
The \c BufferView also contains a Cursor which may or may not be
visible on screen. The cursor is really just a bookmark to remember
where the next Buffer insertion/deletion is going to take place.
-
+
3) The View: \c WorkArea (and it's qt4 specialisation GuiWorkArea)
This contains the real screen area where the drawing is done by the
- select char
- etc.
-
+
4) The Window: \c LyXView (and its qt4 specialisation \c GuiView)
-
+
This is a full window containing a menubar, toolbars, a tabbar and a
WorkArea. One LyXView could in theory contain multiple WorkArea
(ex: with split window) but this number is limited to one only for
the WorkArea to switch to this another Buffer.
With a TabWidget, each Tab would own its own \c WorkArea. Clicking on a tab
- would switch a WorkArea instead of a Buffer.
+ would switch a WorkArea instead of a Buffer.
*/
class Application
{
LyXView & createView(unsigned int width, unsigned int height,
int posx, int posy, int maximized,
unsigned int iconSizeXY, const std::string & geometryArg);
-
- ///
+
+ ///
LyXView const * currentView() const;
- ///
+ ///
LyXView * currentView();
///
namespace lyx {
-namespace support { class FileFilterList; }
+namespace support { class FileFilterList; }
/**
///
virtual LyXView& view(int id) const = 0;
///
- std::vector<int> const & viewIds()
- {
- return view_ids_;
+ std::vector<int> const & viewIds()
+ {
+ return view_ids_;
}
if (hadBuffer)
disconnectBuffer();
- bool const loaded =
+ bool const loaded =
work_area_->bufferView().loadLyXFile(filename, tolastfiles);
updateToc();
bool const review =
lyx::getStatus(FuncRequest(LFUN_CHANGES_TRACK)).enabled() &&
lyx::getStatus(FuncRequest(LFUN_CHANGES_TRACK)).onoff(true);
-
+
toolbars_->update(math, table, review);
// update redaonly status of open dialogs. This could also be in
// updateMenubar(), but since updateToolbars() and updateMenubar()
/// return the current WorkArea (the one that has the focus).
frontend::WorkArea const * currentWorkArea() const;
- /// FIXME: This non-const access is needed because of
+ /// FIXME: This non-const access is needed because of
/// a mis-designed \c ControlSpellchecker.
frontend::WorkArea * currentWorkArea();
virtual int maxAscent() const { return 1; }
virtual int maxDescent() const { return 1; }
-
+
virtual Dimension const defaultDimension() const { return Dimension(1, 1, 1); }
virtual int width(char_type) const { return 1; }
virtual int ascent(char_type) const { return 1; }
-
+
int descent(char_type) const { return 1; }
-
+
virtual int lbearing(char_type) const { return 1; }
-
+
virtual int rbearing(char_type) const { return 1; }
-
+
virtual int width(docstring const & s) const { return s.size(); }
-
+
virtual int signedWidth(docstring const & s) const
{
if (s.size() && s[0] == '-')
return -width(s.substr(1, s.length() - 1));
return width(s);
}
-
+
virtual Dimension const dimension(char_type) const { return Dimension(1, 1, 1); }
virtual void rectText(docstring const &,
int & /*width*/, int & /*ascent*/, int & /*descent*/) const {}
-
+
virtual void buttonText(docstring const &,
int & /*width*/, int & /*ascent*/, int & /*descent*/) const {}
};
}
-void Painter::buttonText(int x, int y, docstring const & str,
+void Painter::buttonText(int x, int y, docstring const & str,
Font const & font, bool mouseHover)
{
int width;
unsigned int flags = static_cast<unsigned int>(tbinfo.flags);
- // Remove default.ui positions. Only when a valid postion is stored
+ // Remove default.ui positions. Only when a valid postion is stored
// in the session file the default.ui value will be overwritten
unsigned int save = flags;
TurnOffFlag(TOP);
}
/*
std::cout << "State " << info.state << " FLAGS: " << flags
- << " ON:" << (flags & ToolbarBackend::ON)
+ << " ON:" << (flags & ToolbarBackend::ON)
<< " OFF:" << (flags & ToolbarBackend::OFF)
- << " L:" << (flags & ToolbarBackend::LEFT)
- << " R:" << (flags & ToolbarBackend::RIGHT)
- << " T:" << (flags & ToolbarBackend::TOP)
- << " B:" << (flags & ToolbarBackend::BOTTOM)
- << " MA:" << (flags & ToolbarBackend::MATH)
- << " RE:" << (flags & ToolbarBackend::REVIEW)
- << " TB:" << (flags & ToolbarBackend::TABLE)
- << " AU:" << (flags & ToolbarBackend::AUTO)
+ << " L:" << (flags & ToolbarBackend::LEFT)
+ << " R:" << (flags & ToolbarBackend::RIGHT)
+ << " T:" << (flags & ToolbarBackend::TOP)
+ << " B:" << (flags & ToolbarBackend::BOTTOM)
+ << " MA:" << (flags & ToolbarBackend::MATH)
+ << " RE:" << (flags & ToolbarBackend::REVIEW)
+ << " TB:" << (flags & ToolbarBackend::TABLE)
+ << " AU:" << (flags & ToolbarBackend::AUTO)
<< std::endl;
*/
// now set the flags
ToolbarInfo::Flags Toolbars::getToolbarState(string const & name)
-{
+{
ToolbarBackend::Toolbars::const_iterator cit = toolbarbackend.begin();
ToolbarBackend::Toolbars::const_iterator end = toolbarbackend.end();
return;
}
- // No need to do anything if this is the current view. The BufferView
+ // No need to do anything if this is the current view. The BufferView
// metrics are already up to date.
if (&lyx_view_ != theApp()->currentView()) {
// FIXME: it would be nice to optimize for the off-screen case.
// In order to avoid bad surprise in the middle of an operation, we better stop
// the blinking cursor.
- if (!(cmd.action == LFUN_MOUSE_MOTION
+ if (!(cmd.action == LFUN_MOUSE_MOTION
&& cmd.button() == mouse_button::none))
stopBlinkingCursor();
if (needRedraw)
redraw();
-
+
// Skip these when selecting
if (cmd.action != LFUN_MOUSE_MOTION) {
lyx_view_.updateLayoutChoice();
}
// GUI tweaks except with mouse motion with no button pressed.
- if (!(cmd.action == LFUN_MOUSE_MOTION
+ if (!(cmd.action == LFUN_MOUSE_MOTION
&& cmd.button() == mouse_button::none)) {
// Slight hack: this is only called currently when we
// clicked somewhere, so we force through the display
void WorkArea::updateScrollbar()
{
- buffer_view_->updateScrollbar();
+ buffer_view_->updateScrollbar();
ScrollbarParameters const & scroll_ = buffer_view_->scrollbarParameters();
setScrollbarParams(scroll_.height, scroll_.position,
scroll_.lineScrollHeight);
/// \return true if has the keyboard input focus.
virtual bool hasFocus() const = 0;
-
+
/// return the width of the work area in pixels
virtual int width() const = 0;
namespace frontend {
ControlCommand::ControlCommand(Dialog & dialog, string const & command_name,
- string const & lfun_name)
+ string const & lfun_name)
: Dialog::Controller(dialog), params_(command_name),
lfun_name_(lfun_name)
{}
'Apply'.
*/
ControlCommand(Dialog &, std::string const & command_name,
- std::string const & lfun_name);
+ std::string const & lfun_name);
///
virtual ~ControlCommand() {}
///
// Apply the BufferParams.
dispatch_bufferparams(kernel(), params(), LFUN_BUFFER_PARAMS_APPLY);
-
+
// redo the numbering if necessary
if (new_secnumdepth != old_secnumdepth)
updateLabels(kernel().buffer());
bool const ControlDocument::isFontAvailable(std::string const & font) const
{
- if (font == "default" || font == "cmr"
+ if (font == "default" || font == "cmr"
|| font == "cmss" || font == "cmtt")
// these are standard
return true;
else if (font == "lmodern" || font == "lmss" || font == "lmtt")
return LaTeXFeatures::isAvailable("lmodern");
- else if (font == "times" || font == "palatino"
+ else if (font == "times" || font == "palatino"
|| font == "helvet" || font == "courier")
return LaTeXFeatures::isAvailable("psnfss");
else if (font == "cmbr" || font == "cmtl")
else if (font == "utopia")
return LaTeXFeatures::isAvailable("utopia")
|| LaTeXFeatures::isAvailable("fourier");
- else if (font == "beraserif" || font == "berasans"
+ else if (font == "beraserif" || font == "berasans"
|| font == "beramono")
return LaTeXFeatures::isAvailable("bera");
else
external::Template const * const et_ptr =
etm.getTemplateByName(template_name);
- if (et_ptr)
+ if (et_ptr)
return et_ptr->fileRegExp;
return string();
docstring const title = _("Select external file");
docstring const bufpath = lyx::from_utf8(kernel().bufferFilepath());
- FileFilterList const filter =
+ FileFilterList const filter =
FileFilterList(lyx::from_utf8(getTemplateFilters(lyx::to_utf8(template_name))));
std::pair<docstring, docstring> dir1(_("Documents|#o#O"),
///
external::Template getTemplate(int) const;
///
- std::string const
+ std::string const
getTemplateFilters(std::string const & template_name) const;
///
docstring const browse(docstring const & input_file,
: Dialog::Controller(dialog)
{
// FIXME: Ideally, those unicode codepoints would be defined
- // in "lib/symbols". Unfortunately, some of those are already
+ // in "lib/symbols". Unfortunately, some of those are already
// defined with non-unicode ids for use within mathed.
// FIXME 2: We should fill-in this map with the parsed "symbols"
// file done in MathFactory.cpp.
{
map<string, MathSymbol>::const_iterator it =
math_symbols_.find(tex_name);
-
+
static MathSymbol unknown_symbol;
if (it == math_symbols_.end())
return unknown_symbol;
-
+
return it->second;
}
{
map<char_type, string>::const_iterator it =
tex_names_.find(math_symbol);
-
+
static string empty_string;
if (it == tex_names_.end())
return empty_string;
-
+
return it->second;
}
"Downarrow", "Uparrow", "Updownarrow", "Leftrightarrow",
"Longleftrightarrow", "Longleftarrow", "Longrightarrow",
"longleftrightarrow", "longleftarrow", "longrightarrow",
- "leftharpoondown", "rightharpoondown",
+ "leftharpoondown", "rightharpoondown",
"mapsto", "longmapsto",
"nwarrow", "nearrow",
- "leftharpoonup", "rightharpoonup",
+ "leftharpoonup", "rightharpoonup",
"hookleftarrow", "hookrightarrow",
"swarrow", "searrow",
"rightleftharpoons",
int const nr_latex_ams_misc = sizeof(latex_ams_misc) / sizeof(char const *);
char const * latex_ams_arrows[] = {
- "dashleftarrow", "dashrightarrow",
+ "dashleftarrow", "dashrightarrow",
"leftleftarrows", "leftrightarrows",
"rightrightarrows", "rightleftarrows",
"Lleftarrow", "Rrightarrow",
"leqq", "geqq",
"leqslant", "geqslant",
"eqslantless", "eqslantgtr",
- "lesssim", "gtrsim",
+ "lesssim", "gtrsim",
"lessapprox", "gtrapprox",
"approxeq", "triangleq",
"lessdot", "gtrdot",
"thicksim", "thickapprox",
"backsim", "backsimeq",
"subseteqq", "supseteqq",
- "Subset", "Supset",
+ "Subset", "Supset",
"sqsubset", "sqsupset",
- "preccurlyeq", "succcurlyeq",
- "curlyeqprec", "curlyeqsucc",
- "precsim", "succsim",
- "precapprox", "succapprox",
- "vartriangleleft", "vartriangleright",
+ "preccurlyeq", "succcurlyeq",
+ "curlyeqprec", "curlyeqsucc",
+ "precsim", "succsim",
+ "precapprox", "succapprox",
+ "vartriangleleft", "vartriangleright",
"trianglelefteq", "trianglerighteq",
- "bumpeq", "Bumpeq",
+ "bumpeq", "Bumpeq",
"doteqdot", "risingdotseq", "fallingdotseq",
"vDash", "Vvdash", "Vdash",
- "shortmid", "shortparallel",
+ "shortmid", "shortparallel",
"smallsmile", "smallfrown",
"blacktriangleleft", "blacktriangleright",
- "because", "therefore",
+ "because", "therefore",
"backepsilon",
"varpropto",
"between",
bool ControlParagraph::canIndent() const
{
- return kernel().buffer().params().paragraph_separation ==
+ return kernel().buffer().params().paragraph_separation ==
BufferParams::PARSEP_INDENT;
}
///
bool canApply() const { return true; }
- /// The title displayed by the dialog reflects source type.
+ /// The title displayed by the dialog reflects source type.
docstring const title() const;
/** get the source code of selected paragraphs, or the whole document
try {
RegexMatch rm(im, "h.*o", false);
-
+
cout << rm("hello") << endl;
cout << rm("hei") << endl;
}
current_font_ = bulletpaneCO->currentIndex();
return;
}
-
+
// unselect previous item
selectItem(current_font_, current_char_, false);
current_font_ = -1;
/// This template class that encapsulates a given Widget inside a
/// DockWidget and presents a Dialog::View interface
template<class Controller, class Widget>
-class DockView : public QDockWidget, public Dialog::View
+class DockView : public QDockWidget, public Dialog::View
{
public:
DockView(
void apply() {}
void hide() { QDockWidget::hide(); }
void show() { QDockWidget::show(); }
- bool isVisible() const
+ bool isVisible() const
{ return QDockWidget::isVisible(); }
void redraw() {}
void update()
setColumnCount(nr_cols);
resetCellSize();
updateGeometry();
- // emit signal
+ // emit signal
colsChanged(nr_cols);
}
setRowCount(nr_rows);
resetCellSize();
updateGeometry();
- // emit signal
+ // emit signal
rowsChanged(nr_rows);
}
docstring const startsWith = from_utf8(
makeAbsPath(to_utf8(suggested), to_utf8(path)).absFilename());
result.second = from_utf8(internal_path(fromqstr(
- QFileDialog::getOpenFileName(qApp->focusWidget(),
+ QFileDialog::getOpenFileName(qApp->focusWidget(),
toqstr(title_), toqstr(startsWith), toqstr(filters.as_string()) ))));
#else
LyXFileDialog dlg(title_, path, filters, private_->b1, private_->b2);
//} // namespace lyx
#include "FloatPlacement_moc.cpp"
-
-
QString const str = qApp->clipboard()->text(QClipboard::Clipboard)
.normalized(QString::NormalizationForm_KC);
LYXERR(Debug::ACTION) << "GuiClipboard::getAsText(): `"
- << fromqstr(str) << "'" << endl;
+ << fromqstr(str) << "'" << endl;
if (str.isNull())
return docstring();
void GuiClipboard::put(string const & lyx, docstring const & text)
{
LYXERR(Debug::ACTION) << "GuiClipboard::put(`" << lyx << "' `"
- << to_utf8(text) << "')" << endl;
+ << to_utf8(text) << "')" << endl;
// We don't convert the encoding of lyx since the encoding of the
// clipboard contents is specified in the data itself
QMimeData * data = new QMimeData;
if (f.realShape() != Font::SMALLCAPS_SHAPE) {
metrics.reset(new GuiFontMetrics(font));
}
- else {
+ else {
// handle small caps ourselves ...
Font smallfont = f;
smallfont.decSize().decSize().setShape(Font::UP_SHAPE);
/// Hold info about a particular font
-class GuiFontLoader : public FontLoader
+class GuiFontLoader : public FontLoader
{
public:
///
GuiFontLoader();
-
+
/// Destructor
virtual ~GuiFontLoader() {}
namespace
{
template<class T>
- void updateIds(std::map<int, T*> const & stdmap, std::vector<int> & ids)
+ void updateIds(std::map<int, T*> const & stdmap, std::vector<int> & ids)
{
ids.clear();
typename std::map<int, T*>::const_iterator it;
// TODO: return false when close event was ignored
// e.g. quitWriteAll()->'Cancel'
// maybe we need something like 'bool closeView()'
- it->second->close();
+ it->second->close();
// unregisterd by the CloseEvent
}
/// Multiple views container.
/**
* Warning: This must not be a smart pointer as the destruction of the
- * object is handled by Qt when the view is closed
+ * object is handled by Qt when the view is closed
* \sa Qt::WA_DeleteOnClose attribute.
*/
std::map<int, GuiView *> views_;
QString const str = qApp->clipboard()->text(QClipboard::Selection)
.normalized(QString::NormalizationForm_KC);
LYXERR(Debug::ACTION) << "GuiSelection::get: " << fromqstr(str)
- << endl;
+ << endl;
if (str.isNull())
return docstring();
LYXERR(Debug::ACTION) << "GuiSelection::put: " << to_utf8(str) << endl;
qApp->clipboard()->setText(toqstr(externalLineEnding(str)),
- QClipboard::Selection);
+ QClipboard::Selection);
}
void clearTabbar()
{
- for (int i = tabbar->count() - 1; i >= 0; --i)
+ for (int i = tabbar->count() - 1; i >= 0; --i)
tabbar->removeTab(i);
}
};
QMenu* toolBarPopup(GuiView *parent)
{
- // FIXME: translation
+ // FIXME: translation
QMenu* menu = new QMenu(parent);
QActionGroup *iconSizeGroup = new QActionGroup(parent);
// Then also the moveEvent, resizeEvent, and the
// code for floatingGeometry_ can be removed;
// adjust GuiView::setGeometry()
-
+
QRect normal_geometry;
int maximized;
#ifdef Q_WS_WIN
normal_geometry = updateFloatingGeometry();
QDesktopWidget& dw = *qApp->desktop();
- QRect desk = dw.availableGeometry(dw.primaryScreen());
+ QRect desk = dw.availableGeometry(dw.primaryScreen());
// Qt bug on Linux: load completely maximized, vert max. save-> frameGeometry().height() is wrong
if (isMaximized() && desk.width() <= frameGeometry().width() && desk.height() <= frameGeometry().height()) {
maximized = CompletelyMaximized;
// maximizing does not work when the window is allready hor. or vert. maximized
// Tested only on KDE
- int dh = frameGeometry().height() - height();
- if (desk.height() <= normal_geometry.height() + dh)
+ int dh = frameGeometry().height() - height();
+ if (desk.height() <= normal_geometry.height() + dh)
normal_geometry.setHeight(normal_geometry.height() - 1);
int dw = frameGeometry().width() - width();
- if (desk.width() <= normal_geometry.width() + dw)
+ if (desk.width() <= normal_geometry.width() + dw)
normal_geometry.setWidth(normal_geometry.width() - 1);
} else if (desk.height() <= frameGeometry().height()) {
- maximized = VerticallyMaximized;
+ maximized = VerticallyMaximized;
} else if (desk.width() <= frameGeometry().width()) {
maximized = HorizontallyMaximized;
} else {
}
getToolbars().saveToolbarInfo();
}
-
+
void GuiView::setGeometry(unsigned int width,
unsigned int height,
if (width != 0 && height != 0) {
if (posx != -1 && posy != -1) {
// if there are startup positioning problems:
- // http://doc.trolltech.com/4.2/qdesktopwidget.html
+ // http://doc.trolltech.com/4.2/qdesktopwidget.html
QDesktopWidget& dw = *qApp->desktop();
if (dw.isVirtualDesktop()) {
if(!dw.geometry().contains(posx, posy)) {
} else {
#ifndef Q_WS_WIN
// TODO How to set by the window manager?
- // setWindowState(Qt::WindowVerticallyMaximized);
+ // setWindowState(Qt::WindowVerticallyMaximized);
// is not possible
QDesktopWidget& dw = *qApp->desktop();
QRect desk = dw.availableGeometry(dw.primaryScreen());
- if (maximized == VerticallyMaximized)
+ if (maximized == VerticallyMaximized)
resize(width, desk.height());
if (maximized == HorizontallyMaximized)
resize(desk.width(), height);
// we compensate the drift when storing the position
d.posx_offset = 0;
d.posy_offset = 0;
- if (width != 0 && height != 0)
+ if (width != 0 && height != 0)
if (posx != -1 && posy != -1) {
#ifdef Q_WS_WIN
d.posx_offset = posx - normalGeometry().x();
cur_title = view()->buffer()->fileName();
}
- // avoid unnecessary tabbar rebuild:
+ // avoid unnecessary tabbar rebuild:
// check if something has changed
- if (d.tabnames == names && d.cur_title == cur_title)
+ if (d.tabnames == names && d.cur_title == cur_title)
return;
d.tabnames = names;
d.cur_title = cur_title;
// rebuild tabbar and function map from scratch
if (names.size() > 1) {
for(size_t i = 0; i < names.size(); i++) {
- tabbar.addTab(toqstr(makeDisplayPath(names[i], 30)));
+ tabbar.addTab(toqstr(makeDisplayPath(names[i], 30)));
// set current tab
if (names[i] == cur_title)
tabbar.setCurrentIndex(i);
/// populate a toplevel menu and all its children on demand
void updateMenu(QAction *);
- void currentTabChanged (int index);
+ void currentTabChanged (int index);
/// slots to change the icon size
void smallSizedIcons();
void GuiWorkArea::paintEvent(QPaintEvent * ev)
{
- QRect const rc = ev->rect();
+ QRect const rc = ev->rect();
/*
LYXERR(Debug::PAINTING) << "paintEvent begin: x: " << rc.x()
<< " y: " << rc.y()
}
}
- // Hide the cursor during the kana-kanji transformation.
+ // Hide the cursor during the kana-kanji transformation.
if (preedit_string.empty())
startBlinkingCursor();
else
// last_width : for checking if last preedit string was/wasn't empty.
static bool last_width = false;
if (!last_width && preedit_string.empty()) {
- // if last_width is last length of preedit string.
+ // if last_width is last length of preedit string.
e->accept();
return;
}
// that we are in selecting mode in the input method.
// FIXME: rLength == preedit_length is not a changing condition
// FIXME: should be put out of the loop.
- if (pos >= rStart
+ if (pos >= rStart
&& pos < rStart + rLength
&& !(cursor_pos < rLength && rLength == preedit_length))
ps = Painter::preedit_selecting;
///
double_click dc_event_;
- ///
+ ///
CursorWidget * cursor_;
///
void updateScreen();
void IconPalette::updateParent()
{
bool enable = false;
- for (int i = 0; i < actions_.size(); ++i)
+ for (int i = 0; i < actions_.size(); ++i)
if (actions_.at(i)->isEnabled()) {
enable = true;
break;
void ButtonMenu::updateParent()
{
bool enable = false;
- for (int i = 0; i < actions_.size(); ++i)
+ for (int i = 0; i < actions_.size(); ++i)
if (actions_.at(i)->isEnabled()) {
enable = true;
break;
void mouseReleaseEvent(QMouseEvent *);
void mousePressEvent(QMouseEvent *);
void paintEvent(QPaintEvent *);
-
+
private:
//! update the geometry
void resetGeometry();
//! row of pointer
int bottom_;
//! column of pointer
- int right_;
+ int right_;
//! the lyxview we need to dispatch the funcrequest
LyXView & lyxView_;
//! widget under mouse
} // namespace lyx
#include "LyXFileDialog_moc.cpp"
-
list_->setColumnCount(1);
// Hide the pointless list header
list_->header()->hide();
-// QStringList HeaderLabels;
-// HeaderLabels << QString("Category");
-// list_->setHeaderLabels(HeaderLabels);
+// QStringList HeaderLabels;
+// HeaderLabels << QString("Category");
+// list_->setHeaderLabels(HeaderLabels);
connect(list_, SIGNAL(currentItemChanged (QTreeWidgetItem*, QTreeWidgetItem*)),
this, SLOT(switchPanel(QTreeWidgetItem *, QTreeWidgetItem*)));
// add the special units to the height choice
// width needs different handling
box_gui_tokens_special_length(ids_spec_, gui_names_spec_);
- for (unsigned int i = 1; i < gui_names_spec_.size(); ++i)
+ for (unsigned int i = 1; i < gui_names_spec_.size(); ++i)
dialog_->heightUnitsLC->addItem(toqstr(gui_names_spec_[i]));
bcview().addReadOnly(dialog_->typeCO);
#include "QBox_moc.cpp"
-
form, SLOT(slotOK()));
connect(closePB, SIGNAL(clicked()),
form, SLOT(slotClose()));
- connect(branchCO, SIGNAL( activated(int) ),
+ connect(branchCO, SIGNAL( activated(int) ),
this, SLOT( change_adaptor() ) );
}
void QCitation::apply(int const choice, bool const full, bool const force,
- QString before, QString after)
+ QString before, QString after)
{
if (cited_keys_.isEmpty())
return;
selected_model_.setStringList(cited_keys_);
}
-
+
QString QCitation::textBefore()
{
return toqstr(params()["before"]);
Qt::CaseSensitive: Qt::CaseInsensitive;
QStringList keys;
// If new string (str) contains the last searched one...
- if (!last_searched_string.isEmpty() && str.size() > 1
+ if (!last_searched_string.isEmpty() && str.size() > 1
&& str.contains(last_searched_string, qtcase))
// ... then only search within already found list.
keys = available_model_.stringList();
virtual void apply(int const choice, bool const full, bool const force,
QString before, QString after);
-private:
+private:
/// available keys.
QStringListModel available_model_;
{
return QDialog::isVisible();
}
-
+
void QCitationDialog::on_okPB_clicked()
{
void QCitationDialog::update()
{
if (selectedLV->selectionModel()->selectedIndexes().isEmpty()) {
- if (availableLV->selectionModel()->selectedIndexes().isEmpty()
+ if (availableLV->selectionModel()->selectedIndexes().isEmpty()
&& availableLV->model()->rowCount() > 0)
availableLV->setCurrentIndex(availableLV->model()->index(0,0));
updateInfo(availableLV->currentIndex());
QStringList sty = form_->citationStyles(curr);
- bool const basic_engine =
+ bool const basic_engine =
(form_->getEngine() == biblio::ENGINE_BASIC);
citationStyleCO->setEnabled(!sty.isEmpty() && !basic_engine);
void QCitationDialog::setButtons()
{
int const arows = availableLV->model()->rowCount();
- addPB->setEnabled(arows > 0 &&
+ addPB->setEnabled(arows > 0 &&
availableLV->currentIndex().isValid() &&
!isSelected(availableLV->currentIndex()));
{
if (!idx.isValid())
return;
-
+
selectedLV->selectionModel()->reset();
update();
}
{
QModelIndex idx = selectedLV->currentIndex();
int nrows = selectedLV->model()->rowCount();
-
+
form_->deleteKey(idx);
- if (idx.row() == nrows - 1)
+ if (idx.row() == nrows - 1)
idx = idx.sibling(idx.row() - 1, idx.column());
if (nrows>1)
leftLW->setViewMode(QListView::IconMode);
rightLW->setViewMode(QListView::IconMode);
-
+
typedef std::map<char_type, QListWidgetItem *> ListItems;
ListItems list_items;
// The last element is the empty one.
tex_code_ = left_str + ' ' + right_str;
else {
tex_code_ = bigleft[size] + ' '
- + left_str + ' '
+ + left_str + ' '
+ bigright[size] + ' '
+ right_str;
}
QString command = '"' + tex_code_ + '"';
command.replace(' ', "\" \"");
form_->controller().dispatchBigDelim(fromqstr(command));
- }
+ }
}
-
+
void QDelimiterDialog::on_sizeCO_activated(int index)
{
updateTeXCode(index);
};
-char const * tex_fonts_sans_gui[] = { N_("Default"), N_("Computer Modern Sans"), N_("Latin Modern Sans"),
+char const * tex_fonts_sans_gui[] = { N_("Default"), N_("Computer Modern Sans"), N_("Latin Modern Sans"),
N_("Helvetica"), N_("Avant Garde"), N_("Bera Sans"), N_("CM Bright"), ""
};
-char const * const tex_fonts_monospaced[] = {"default", "cmtt", "lmtt", "courier", "beramono",
+char const * const tex_fonts_monospaced[] = {"default", "cmtt", "lmtt", "courier", "beramono",
"luximono", "cmtl", ""
};
{
QString preamble = toqstr(params.preamble);
// Nothing to do if the params and preamble are unchanged.
- if (id == current_id_
+ if (id == current_id_
&& preamble == preambleTE->document()->toPlainText())
return;
QTextCursor cur = preambleTE->textCursor();
// Save the coords before switching to the new one.
- preamble_coords_[current_id_] =
+ preamble_coords_[current_id_] =
make_pair(cur.position(), preambleTE->verticalScrollBar()->value());
// Save the params address for further use.
{
// Save the coords before closing.
QTextCursor cur = preambleTE->textCursor();
- preamble_coords_[current_id_] =
+ preamble_coords_[current_id_] =
make_pair(cur.position(), preambleTE->verticalScrollBar()->value());
e->accept();
}
void QDocumentDialog::romanChanged(int item)
{
string const font = tex_fonts_roman[item];
-
+
fontModule->fontScCB->setEnabled(
form_->controller().providesSC(font));
fontModule->fontOsfCB->setEnabled(
QTreeWidgetItem * item = 0;
for ( ; cit != end ; ++cit) {
int const toclevel = (*cit)->toclevel;
- if (toclevel != Layout::NOT_IN_TOC
+ if (toclevel != Layout::NOT_IN_TOC
&& (*cit)->labeltype == LABEL_COUNTER) {
item = new QTreeWidgetItem(numberingModule->tocTW);
item->setText(0, qt_((*cit)->name()));
textLayoutModule->twoColumnCB->setChecked(
params.columns == 2);
-
+
// break listings_params to multiple lines
string lstparams =
InsetListingsParams(params.listings_params).separatedParams();
form, SLOT(slotClose()));
connect(errorsLW, SIGNAL( itemActivated(QListWidgetItem *)),
form, SLOT(slotClose()));
- connect( errorsLW, SIGNAL( itemClicked(QListWidgetItem *)),
+ connect( errorsLW, SIGNAL( itemClicked(QListWidgetItem *)),
this, SLOT(select_adaptor(QListWidgetItem *)));
}
void QExternalDialog::browseClicked()
{
int const choice = externalCO->currentIndex();
- docstring const template_name =
+ docstring const template_name =
from_utf8(form_->controller().getTemplate(choice).lyxName);
docstring const str =
form_->controller().browse(qstring_to_ucs4(fileED->text()),
dialog_->displayGB->setChecked(igp.display != graphics::NoDisplay);
// the output section (width/height)
-
+
dialog_->Scale->setText(toqstr(igp.scale));
//igp.scale defaults to 100, so we treat it as empty
bool const scaleChecked = !igp.scale.empty() && igp.scale != "100";
dialog_->scaleCB->setChecked(scaleChecked);
dialog_->scaleCB->blockSignals(false);
dialog_->Scale->setEnabled(scaleChecked);
-
- lengthAutoToWidgets(dialog_->Width, dialog_->widthUnit, igp.width,
+
+ lengthAutoToWidgets(dialog_->Width, dialog_->widthUnit, igp.width,
unitDefault);
- bool const widthChecked = !dialog_->Width->text().isEmpty() &&
+ bool const widthChecked = !dialog_->Width->text().isEmpty() &&
dialog_->Width->text() != "auto";
dialog_->WidthCB->blockSignals(true);
dialog_->WidthCB->setChecked(widthChecked);
dialog_->WidthCB->blockSignals(false);
dialog_->Width->setEnabled(widthChecked);
dialog_->widthUnit->setEnabled(widthChecked);
-
- lengthAutoToWidgets(dialog_->Height, dialog_->heightUnit, igp.height,
+
+ lengthAutoToWidgets(dialog_->Height, dialog_->heightUnit, igp.height,
unitDefault);
- bool const heightChecked = !dialog_->Height->text().isEmpty()
+ bool const heightChecked = !dialog_->Height->text().isEmpty()
&& dialog_->Height->text() != "auto";
dialog_->HeightCB->blockSignals(true);
dialog_->HeightCB->setChecked(heightChecked);
dialog_->HeightCB->blockSignals(false);
dialog_->Height->setEnabled(heightChecked);
dialog_->heightUnit->setEnabled(heightChecked);
-
+
dialog_->scaleCB->setEnabled(!widthChecked && !heightChecked);
dialog_->WidthCB->setEnabled(!scaleChecked);
dialog_->HeightCB->setEnabled(!scaleChecked);
dialog_->aspectratio->setEnabled(widthChecked && heightChecked);
-
+
dialog_->setAutoText();
dialog_->angle->setText(toqstr(igp.rotateAngle));
if (!dialog_->displayGB->isChecked())
igp.display = graphics::NoDisplay;
-
+
//the graphics section
if (dialog_->scaleCB->isChecked() && !dialog_->Scale->text().isEmpty()) {
igp.scale = fromqstr(dialog_->Scale->text());
igp.keepAspectRatio = false;
} else {
igp.scale = string();
- igp.width = dialog_->WidthCB->isChecked() ?
+ igp.width = dialog_->WidthCB->isChecked() ?
//Note that this works even if dialog_->Width is "auto", since in
//that case we get "0pt".
- Length(widgetsToLength(dialog_->Width, dialog_->widthUnit)):
+ Length(widgetsToLength(dialog_->Width, dialog_->widthUnit)):
Length("0pt");
- igp.height = dialog_->HeightCB->isChecked() ?
+ igp.height = dialog_->HeightCB->isChecked() ?
Length(widgetsToLength(dialog_->Height, dialog_->heightUnit)) :
Length("0pt");
igp.keepAspectRatio = dialog_->aspectratio->isEnabled() &&
form, SLOT(slotClose()));
connect(restorePB, SIGNAL(clicked()),
form, SLOT(slotRestore()));
-
+
//graphics pane
connect(filename, SIGNAL(textChanged(const QString &)),
this, SLOT(change_adaptor()));
this, SLOT(change_adaptor()));
connect(Scale, SIGNAL(textChanged(const QString &)),
this, SLOT(change_adaptor()));
-
+
filename->setValidator(new PathValidator(true, filename));
setFocusProxy(filename);
-
+
QDoubleValidator * scaleValidator = new DoubleAutoValidator(Scale);
scaleValidator->setBottom(0);
scaleValidator->setDecimals(256); //I guess that will do
this, SLOT(change_bb()));
connect(getPB, SIGNAL(clicked()),
this, SLOT(change_adaptor()));
-
+
lbX->setValidator(new QDoubleValidator(lbX));
lbY->setValidator(new QDoubleValidator(lbY));
rtX->setValidator(new QDoubleValidator(rtX));
void QGraphicsDialog::setAutoText() {
if (scaleCB->isChecked()) return;
- if (!Scale->isEnabled() && Scale->text() != "100")
+ if (!Scale->isEnabled() && Scale->text() != "100")
Scale->setText(QString("auto"));
setAutoTextCB(WidthCB, Width, widthUnit);
Scale->setText("100");
Scale->setFocus(Qt::OtherFocusReason);
}
-
+
WidthCB->setDisabled(setScale);
WidthCB->blockSignals(true);
WidthCB->setChecked(false);
WidthCB->blockSignals(false);
Width->setEnabled(false);
widthUnit->setEnabled(false);
-
+
HeightCB->setDisabled(setScale);
HeightCB->blockSignals(true);
HeightCB->setChecked(false);
HeightCB->blockSignals(false);
Height->setEnabled(false);
heightUnit->setEnabled(false);
-
+
aspectratio->setDisabled(true);
aspectratio->setChecked(true);
-
+
setAutoText();
}
widthUnit->setEnabled(setWidth);
if (setWidth)
Width->setFocus(Qt::OtherFocusReason);
-
+
bool const setHeight = HeightCB->isChecked();
aspectratio->setEnabled(setWidth && setHeight);
aspectratio->blockSignals(true);
aspectratio->setChecked(!(setWidth && setHeight));
aspectratio->blockSignals(false);
-
+
scaleCB->setEnabled(!setWidth && !setHeight);
//already will be unchecked, so don't need to do that
- Scale->setEnabled((!setWidth && !setHeight) //=scaleCB->isEnabled()
+ Scale->setEnabled((!setWidth && !setHeight) //=scaleCB->isEnabled()
&& scaleCB->isChecked()); //should be false, but let's check
-
+
setAutoText();
}
heightUnit->setEnabled(setHeight);
if (setHeight)
Height->setFocus(Qt::OtherFocusReason);
-
+
bool const setWidth = WidthCB->isChecked();
aspectratio->setEnabled(setWidth && setHeight);
aspectratio->blockSignals(true);
aspectratio->setChecked(!(setWidth && setHeight));
aspectratio->blockSignals(false);
-
+
scaleCB->setEnabled(!setWidth && !setHeight);
//already unchecked
- Scale->setEnabled((!setWidth && !setHeight) //=scaleCB->isEnabled()
+ Scale->setEnabled((!setWidth && !setHeight) //=scaleCB->isEnabled()
&& scaleCB->isChecked()); //should be false
-
+
setAutoText();
}
// the rest is put to the extra edit box.
string extra = getStringFromVector(pars);
dialog_->listingsED->setPlainText(toqstr(InsetListingsParams(extra).separatedParams()));
- }
+ }
}
connect(okPB, SIGNAL(clicked()), form, SLOT(slotOK()));
connect(closePB, SIGNAL(clicked()), form, SLOT(slotClose()));
- connect( keywordED, SIGNAL(textChanged(const QString &)),
+ connect( keywordED, SIGNAL(textChanged(const QString &)),
this, SLOT(change_adaptor()));
setFocusProxy(keywordED);
<< text_[i].unicode() << endl;
}
}
-
+
// Only one UCS4 character at the end.
docstring ucs4_text = qstring_to_ucs4(text_);
return ucs4_text[0];
tmpkey += Qt::CTRL;
if (mod & key_modifier::alt)
tmpkey += Qt::ALT;
-
+
QKeySequence seq(tmpkey);
- return qstring_to_ucs4(seq.toString(forgui ? QKeySequence::NativeText
+ return qstring_to_ucs4(seq.toString(forgui ? QKeySequence::NativeText
: QKeySequence::PortableText));
}
int const pixels = img.depth() > 8 ?
img.width() * img.height() : img.numColors();
- unsigned int *data = img.depth() > 8 ?
+ unsigned int *data = img.depth() > 8 ?
reinterpret_cast<unsigned int *>(img.bits()) :
reinterpret_cast<unsigned int *>(&img.colorTable()[0]);
kb_action action;
char const * arg;
char const * label;
- QAction::MenuRole role;
+ QAction::MenuRole role;
};
MacMenuEntry entries[] = {
- {LFUN_DIALOG_SHOW, "aboutlyx", "About LyX",
+ {LFUN_DIALOG_SHOW, "aboutlyx", "About LyX",
QAction::AboutRole},
- {LFUN_DIALOG_SHOW, "prefs", "Preferences",
+ {LFUN_DIALOG_SHOW, "prefs", "Preferences",
QAction::PreferencesRole},
- {LFUN_RECONFIGURE, "", "Reconfigure",
+ {LFUN_RECONFIGURE, "", "Reconfigure",
QAction::ApplicationSpecificRole},
{LFUN_LYX_QUIT, "", "Quit LyX", QAction::QuitRole}
};
const size_t num_entries = sizeof(entries) / sizeof(MacMenuEntry);
- // the special menu for MenuBackend.
+ // the special menu for MenuBackend.
Menu special;
for (size_t i = 0 ; i < num_entries ; ++i) {
- FuncRequest const func(entries[i].action,
+ FuncRequest const func(entries[i].action,
from_utf8(entries[i].arg));
- special.add(MenuItem(MenuItem::Command,
- from_utf8(entries[i].label),
+ special.add(MenuItem(MenuItem::Command,
+ from_utf8(entries[i].label),
func));
}
menubackend_.specialMenu(special);
Menu::const_iterator cit = menubackend_.specialMenu().begin();
Menu::const_iterator end = menubackend_.specialMenu().end();
for (size_t i = 0 ; cit != end ; ++cit, ++i) {
- Action * action = new Action(*owner_, cit->label(),
+ Action * action = new Action(*owner_, cit->label(),
cit->func());
action->setMenuRole(entries[i].role);
qMenu->addAction(action);
{
if (!isDrawingEnabled())
return;
-
+
// double the size if needed
static QVector<QPoint> points(32);
if (np > points.size())
points.resize(2 * np);
-
+
bool antialias = false;
for (int i = 0; i < np; ++i) {
points[i].setX(xp[i]);
points[i].setY(yp[i]);
- if (i != 0)
+ if (i != 0)
antialias |= xp[i-1] != xp[i] && yp[i-1] != yp[i];
}
- setQPainterPen(col, ls, lw);
+ setQPainterPen(col, ls, lw);
bool const text_is_antialiased = renderHints() & TextAntialiasing;
setRenderHint(Antialiasing, antialias && text_is_antialiased);
drawPolyline(points.data(), np);
} // namespace frontend
} // namespace lyx
-
owner_->backend().expand(fromLyxMenu, topLevelMenu_, owner_->view()->buffer());
if (!owner_->backend().hasMenu(topLevelMenu_.name())) {
- LYXERR(Debug::GUI) << "\tWARNING: menu seems empty"
+ LYXERR(Debug::GUI) << "\tWARNING: menu seems empty"
<< to_utf8(topLevelMenu_.name()) << endl;
}
populate(this, &topLevelMenu_);
ToolbarInfo const & tbinfo = toolbarbackend.getToolbar(item.name_);
ToolbarInfo::item_iterator it = tbinfo.items.begin();
ToolbarInfo::item_iterator const end = tbinfo.items.end();
- for (; it != end; ++it)
+ for (; it != end; ++it)
if (!getStatus(it->func_).unknown()) {
Action * action = new Action(owner_,
getIcon(it->func_),
else
tbinfo.state = ToolbarSection::ToolbarInfo::OFF;
}
- //
+ //
// no need to save it here.
Qt::ToolBarArea loc = owner_.toolBarArea(this);
tbinfo.location = ToolbarSection::ToolbarInfo::LEFT;
else
tbinfo.location = ToolbarSection::ToolbarInfo::NOTSET;
-
- // save toolbar position. They are not used to restore toolbar position
+
+ // save toolbar position. They are not used to restore toolbar position
// now because move(x,y) does not work for toolbar.
tbinfo.posx = pos().x();
tbinfo.posy = pos().y();
: form_(form)
{
setupUi(this);
-
+
connect(okPB, SIGNAL(clicked()), form, SLOT(slotOK()));
connect(applyPB, SIGNAL(clicked()), form_, SLOT(slotApply()));
connect(closePB, SIGNAL(clicked()), form, SLOT(slotClose()));
-
+
connect(languageCO, SIGNAL(currentIndexChanged(int)), this, SLOT(change_adaptor()));
connect(dialectCO, SIGNAL(currentIndexChanged(int)), this, SLOT(change_adaptor()));
connect(inlineCB, SIGNAL(clicked()), this, SLOT(change_adaptor()));
connect(spaceCB, SIGNAL(clicked()), this, SLOT(change_adaptor()));
connect(spaceInStringCB, SIGNAL(clicked()), this, SLOT(change_adaptor()));
connect(extendedcharsCB, SIGNAL(clicked()), this, SLOT(change_adaptor()));
-
+
connect(listingsED, SIGNAL(textChanged()), this, SLOT(change_adaptor()));
connect(listingsED, SIGNAL(textChanged()), this, SLOT(validate_listings_params()));
}
}
}
-
+
bool float_ = floatCB->isChecked();
string placement;
if (placementLE->isEnabled())
string numberfontsize = font_sizes[numberFontSizeCO->currentIndex()];
string firstline = fromqstr(firstlineLE->text());
string lastline = fromqstr(lastlineLE->text());
-
+
string fontsize = font_sizes[fontsizeCO->currentIndex()];
string fontstyle = font_styles[fontstyleCO->currentIndex()];
string basicstyle;
void QListings::build_dialog()
{
dialog_.reset(new QListingsDialog(this));
-
+
bcview().setOK(dialog_->okPB);
bcview().setApply(dialog_->applyPB);
bcview().setCancel(dialog_->closePB);
void QListings::update_contents()
{
- // set default values
+ // set default values
dialog_->listingsTB->setPlainText(
qt_("Input listings parameters on the right. Enter ? for a list of parameters."));
dialog_->languageCO->setCurrentIndex(findToken(languages, "no language"));
std::string construct_params();
protected Q_SLOTS:
virtual void change_adaptor();
- /// AFAIK, QValidator only works for QLineEdit so
+ /// AFAIK, QValidator only works for QLineEdit so
/// I have to validate listingsED (QTextEdit) manually.
void validate_listings_params();
/// turn off inline when float is clicked
connect(closePB, SIGNAL(clicked()),
form, SLOT(slotClose()));
- connect( updatePB, SIGNAL( clicked() ),
+ connect( updatePB, SIGNAL( clicked() ),
this, SLOT( updateClicked() ) );
}
setFormat(index, length, warningFormat);
index = text.indexOf(exprWarning, index + length);
}
- // ! error
+ // ! error
QRegExp exprError("^!.*$");
index = text.indexOf(exprError);
while (index >= 0) {
connect(okPB, SIGNAL(clicked()), form, SLOT(slotOK()));
connect(closePB, SIGNAL(clicked()), form, SLOT(slotClose()));
connect(symbolED, SIGNAL(textChanged(const QString&)),
- this, SLOT(change_adaptor()));
+ this, SLOT(change_adaptor()));
connect(descriptionTE, SIGNAL(textChanged()),
- this, SLOT(change_adaptor()));
+ this, SLOT(change_adaptor()));
setFocusProxy(descriptionTE);
}
connect(alignRightRB, SIGNAL(clicked()), this, SLOT(change_adaptor()));
connect(alignCenterRB, SIGNAL(clicked()), this, SLOT(change_adaptor()));
connect(linespacing, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
- connect(linespacing, SIGNAL(activated(int)),
+ connect(linespacing, SIGNAL(activated(int)),
this, SLOT(enableLinespacingValue(int)));
- connect(linespacingValue, SIGNAL(textChanged(const QString &)),
+ connect(linespacingValue, SIGNAL(textChanged(const QString &)),
this, SLOT(change_adaptor()));
connect(indentCB, SIGNAL(clicked()), this, SLOT(change_adaptor()));
- connect(labelWidth, SIGNAL(textChanged(const QString &)),
+ connect(labelWidth, SIGNAL(textChanged(const QString &)),
this, SLOT(change_adaptor()));
linespacingValue->setValidator(new QDoubleValidator(linespacingValue));
}
}
- lyxerr << BOOST_CURRENT_FUNCTION << "Unknown alignment "
+ lyxerr << BOOST_CURRENT_FUNCTION << "Unknown alignment "
<< align << std::endl;
}
LyXAlignment QParagraphDialog::getAlignmentFromDialog()
{
- if (alignDefaultCB->isChecked())
+ if (alignDefaultCB->isChecked())
return LYX_ALIGN_LAYOUT;
LyXAlignment alignment = LYX_ALIGN_NONE;
QPRadioMap::const_iterator it = radioMap.begin();
// alignment
LyXAlignment newAlignment = params.align();
LyXAlignment defaultAlignment = controller().alignDefault();
- bool alignmentIsDefault =
+ bool alignmentIsDefault =
newAlignment == LYX_ALIGN_LAYOUT || newAlignment == defaultAlignment;
dialog_->alignDefaultCB->blockSignals(true);
dialog_->alignDefaultCB->setChecked(alignmentIsDefault);
namespace lyx {
namespace frontend {
-
+
class QParagraph;
class QParagraphDialog : public QDialog, public Ui::QParagraphUi {
flags |= Format::vector;
form_->formats().add(name, extension, prettyname, shortcut, viewer,
- editor, flags);
+ editor, flags);
form_->formats().sort();
form_->converters().update(form_->formats());
connect(closePB, SIGNAL(clicked()), this, SLOT(reset_dialog()));
connect(this, SIGNAL(rejected()), this, SLOT(reset_dialog()));
- connect(typeCO, SIGNAL(activated(int)),
+ connect(typeCO, SIGNAL(activated(int)),
this, SLOT(changed_adaptor()));
- connect(referenceED, SIGNAL(textChanged(const QString &)),
+ connect(referenceED, SIGNAL(textChanged(const QString &)),
this, SLOT(changed_adaptor()));
- connect(nameED, SIGNAL(textChanged(const QString &)),
+ connect(nameED, SIGNAL(textChanged(const QString &)),
this, SLOT(changed_adaptor()));
- connect(refsLW, SIGNAL(itemClicked(QListWidgetItem *)),
+ connect(refsLW, SIGNAL(itemClicked(QListWidgetItem *)),
this, SLOT(refHighlighted(QListWidgetItem *)));
connect(refsLW, SIGNAL(itemSelectionChanged()),
this, SLOT(selectionChanged()));
- connect(refsLW, SIGNAL(itemActivated(QListWidgetItem *)),
+ connect(refsLW, SIGNAL(itemActivated(QListWidgetItem *)),
this, SLOT(refSelected(QListWidgetItem *)));
connect(sortCB, SIGNAL(clicked(bool)),
this, SLOT(sortToggled(bool)));
- connect(gotoPB, SIGNAL(clicked()),
+ connect(gotoPB, SIGNAL(clicked()),
this, SLOT(gotoClicked()));
- connect(updatePB, SIGNAL(clicked()),
+ connect(updatePB, SIGNAL(clicked()),
this, SLOT(updateClicked()));
- connect(bufferCO, SIGNAL(activated(int)),
+ connect(bufferCO, SIGNAL(activated(int)),
this, SLOT(updateClicked()));
setFocusProxy(refsLW);
{
if (form_->readOnly())
return;
-
+
QList<QListWidgetItem *> selections = refsLW->selectedItems();
if (selections.isEmpty())
return;
void QRef::apply()
{
InsetCommandParams & params = controller().params();
-
+
last_reference_ = dialog_->referenceED->text();
params.setCmdName(InsetRef::getName(dialog_->typeCO->currentIndex()));
dialog_->refsLW->blockSignals(true);
dialog_->referenceED->blockSignals(true);
dialog_->refsLW->setUpdatesEnabled(false);
-
+
dialog_->refsLW->clear();
// need this because Qt will send a highlight() here for
/// went to a reference ?
bool at_ref_;
-
+
/// the last reference entered or examined
QString last_reference_;
#include "QSearch_moc.cpp"
-
connect(closePB, SIGNAL(clicked()),
form, SLOT(slotClose()));
- connect( formatLW, SIGNAL( itemClicked(QListWidgetItem *) ),
+ connect( formatLW, SIGNAL( itemClicked(QListWidgetItem *) ),
this, SLOT( slotFormatHighlighted(QListWidgetItem *) ) );
- connect( formatLW, SIGNAL( itemActivated(QListWidgetItem *) ),
+ connect( formatLW, SIGNAL( itemActivated(QListWidgetItem *) ),
this, SLOT( slotFormatSelected(QListWidgetItem *) ) );
- connect( formatLW, SIGNAL( itemClicked(QListWidgetItem *) ),
+ connect( formatLW, SIGNAL( itemClicked(QListWidgetItem *) ),
this, SLOT( changed_adaptor() ) );
- connect( commandCO, SIGNAL( textChanged(const QString&) ),
+ connect( commandCO, SIGNAL( textChanged(const QString&) ),
this, SLOT( changed_adaptor() ) );
}
if (e->y() < height() - e->x()) {
if (left_.enabled) {
setLeft(!left_.set);
- // emit signal
+ // emit signal
leftSet(left_.set);
}
} else {
if (bottom_.enabled) {
setBottom(!bottom_.set);
- // emit signal
+ // emit signal
bottomSet(bottom_.set);
}
}
if (e->y() < height() - e->x()) {
if (top_.enabled) {
setTop(!top_.set);
- // emit signal
+ // emit signal
topSet(top_.set);
}
} else {
if (right_.enabled) {
setRight(!right_.set);
- // emit signal
+ // emit signal
rightSet(right_.set);
}
}
}
update();
- // emit signal
+ // emit signal
clicked();
}
/////////////////////////////////////////////////////////////////////
//
-// QShowFile
+// QShowFile
//
/////////////////////////////////////////////////////////////////////
interlinespaceED->setValidator(new LengthValidator(interlinespaceED));
connect(topspaceED, SIGNAL(returnPressed()),
- this, SLOT(topspace_changed()));
+ this, SLOT(topspace_changed()));
connect(topspaceUnit, SIGNAL(selectionChanged(lyx::Length::UNIT)),
- this, SLOT(topspace_changed()));
+ this, SLOT(topspace_changed()));
connect(topspaceCO, SIGNAL(activated(int)), this, SLOT(topspace_changed()));
connect(bottomspaceED, SIGNAL(returnPressed()),
- this, SLOT(bottomspace_changed()));
+ this, SLOT(bottomspace_changed()));
connect(bottomspaceUnit, SIGNAL(selectionChanged(lyx::Length::UNIT)),
- this, SLOT(bottomspace_changed()));
+ this, SLOT(bottomspace_changed()));
connect(bottomspaceCO, SIGNAL(activated(int)), this, SLOT(bottomspace_changed()));
connect(interlinespaceED, SIGNAL(returnPressed()),
- this, SLOT(interlinespace_changed()));
+ this, SLOT(interlinespace_changed()));
connect(interlinespaceUnit, SIGNAL(selectionChanged(lyx::Length::UNIT)),
- this, SLOT(interlinespace_changed()));
+ this, SLOT(interlinespace_changed()));
connect(interlinespaceCO, SIGNAL(activated(int)), this, SLOT(interlinespace_changed()));
connect(booktabsRB, SIGNAL(clicked(bool)), this, SLOT(booktabsChanged(bool)));
connect(borderDefaultRB, SIGNAL(clicked(bool)), this, SLOT(booktabsChanged(bool)));
dialog_->topspaceCO->setCurrentIndex(1);
} else {
dialog_->topspaceCO->setCurrentIndex(2);
- lengthToWidgets(dialog_->topspaceED,
+ lengthToWidgets(dialog_->topspaceED,
dialog_->topspaceUnit,
tabular.row_info[row].top_space.asString(),
default_unit);
}
- dialog_->topspaceED->setEnabled(!isReadonly
+ dialog_->topspaceED->setEnabled(!isReadonly
&& (dialog_->topspaceCO->currentIndex() == 2));
- dialog_->topspaceUnit->setEnabled(!isReadonly
+ dialog_->topspaceUnit->setEnabled(!isReadonly
&& (dialog_->topspaceCO->currentIndex() == 2));
dialog_->topspaceCO->setEnabled(!isReadonly);
dialog_->bottomspaceCO->setCurrentIndex(1);
} else {
dialog_->bottomspaceCO->setCurrentIndex(2);
- lengthToWidgets(dialog_->bottomspaceED,
+ lengthToWidgets(dialog_->bottomspaceED,
dialog_->bottomspaceUnit,
tabular.row_info[row].bottom_space.asString(),
default_unit);
}
- dialog_->bottomspaceED->setEnabled(!isReadonly
+ dialog_->bottomspaceED->setEnabled(!isReadonly
&& (dialog_->bottomspaceCO->currentIndex() == 2));
- dialog_->bottomspaceUnit->setEnabled(!isReadonly
+ dialog_->bottomspaceUnit->setEnabled(!isReadonly
&& (dialog_->bottomspaceCO->currentIndex() == 2));
dialog_->bottomspaceCO->setEnabled(!isReadonly);
dialog_->interlinespaceCO->setCurrentIndex(1);
} else {
dialog_->interlinespaceCO->setCurrentIndex(2);
- lengthToWidgets(dialog_->interlinespaceED,
+ lengthToWidgets(dialog_->interlinespaceED,
dialog_->interlinespaceUnit,
tabular.row_info[row].interline_space.asString(),
default_unit);
}
- dialog_->interlinespaceED->setEnabled(!isReadonly
+ dialog_->interlinespaceED->setEnabled(!isReadonly
&& (dialog_->interlinespaceCO->currentIndex() == 2));
- dialog_->interlinespaceUnit->setEnabled(!isReadonly
+ dialog_->interlinespaceUnit->setEnabled(!isReadonly
&& (dialog_->interlinespaceCO->currentIndex() == 2));
dialog_->interlinespaceCO->setEnabled(!isReadonly);
break;
case 2:
controller().set(Tabular::SET_TOP_SPACE,
- widgetsToLength(dialog_->topspaceED,
+ widgetsToLength(dialog_->topspaceED,
dialog_->topspaceUnit));
break;
}
break;
case 2:
controller().set(Tabular::SET_BOTTOM_SPACE,
- widgetsToLength(dialog_->bottomspaceED,
+ widgetsToLength(dialog_->bottomspaceED,
dialog_->bottomspaceUnit));
break;
}
break;
case 2:
controller().set(Tabular::SET_INTERLINE_SPACE,
- widgetsToLength(dialog_->interlinespaceED,
+ widgetsToLength(dialog_->interlinespaceED,
dialog_->interlinespaceUnit));
break;
}
} // namespace lyx
#include "QTabular_moc.cpp"
-
bool QToc::canOutline(int type) const
{
- if (type < 0)
+ if (type < 0)
return false;
return ControlToc::canOutline(type);
void QToc::goTo(int type, QModelIndex const & index)
{
- if (type < 0 || !index.isValid()
+ if (type < 0 || !index.isValid()
|| index.model() != toc_models_[type]) {
LYXERR(Debug::GUI)
<< "QToc::goTo(): QModelIndex is invalid!"
BOOST_ASSERT(type >= 0 && type < int(toc_models_.size()));
TocIterator const it = toc_models_[type]->tocIterator(index);
-
+
LYXERR(Debug::GUI) << "QToc::goTo " << to_utf8(it->str()) << endl;
ControlToc::goTo(*it);
void update();
///
bool canOutline(int type) const;
-
+
QStandardItemModel * tocModel(int type);
///
QModelIndex const getCurrentIndex(int type) const;
void LaTeXHighlighter::highlightBlock(QString const & text)
{
- // $ $
+ // $ $
QRegExp exprMath("\\$[^\\$]*\\$");
int index = text.indexOf(exprMath);
while (index >= 0) {
TocIterator const TocModel::tocIterator(QModelIndex const & index) const
{
TocMap::const_iterator map_it = toc_map_.find(index);
- BOOST_ASSERT(map_it != toc_map_.end());
+ BOOST_ASSERT(map_it != toc_map_.end());
return map_it->second;
}
if (map_it == model_map_.end())
return QModelIndex();
-
+
return map_it->second;
}
++iter;
}
-
+
setHeaderData(0, Qt::Horizontal, QVariant("title"), Qt::DisplayRole);
// emit headerDataChanged();
}
QModelIndex const & parent)
{
int curdepth = iter->depth() + 1;
-
+
int current_row;
QModelIndex child_item;
--iter;
return;
}
-
+
maxdepth_ = max(maxdepth_, iter->depth());
mindepth_ = min(mindepth_, iter->depth());
current_row = rowCount(parent);
using support::FileName;
using support::libFileSearch;
-
+
namespace frontend {
TocWidget::TocWidget(QToc * form, QWidget * parent)
connect(form, SIGNAL(modelReset()),
SLOT(updateGui()));
-
+
FileName icon_path = libFileSearch("images", "promote.xpm");
moveOutTB->setIcon(QIcon(toqstr(icon_path.absFilename())));
icon_path = libFileSearch("images", "demote.xpm");
moveDownTB->setIcon(QIcon(toqstr(icon_path.absFilename())));
icon_path = libFileSearch("images", "reload.xpm");
updateTB->setIcon(QIcon(toqstr(icon_path.absFilename())));
-
+
// avoid flickering
tocTV->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
{
depth_ = depth;
- // expanding and then collapsing is probably better,
+ // expanding and then collapsing is probably better,
// but my qt 4.1.2 doesn't have expandAll()..
- //tocTV->expandAll();
+ //tocTV->expandAll();
QModelIndexList indices = tocTV->model()->match(
tocTV->model()->index(0,0),
- Qt::DisplayRole, "*", -1,
+ Qt::DisplayRole, "*", -1,
Qt::MatchWildcard|Qt::MatchRecursive);
-
+
int size = indices.size();
for (int i = 0; i < size; i++) {
QModelIndex index = indices[i];
- if (getIndexDepth(index) < depth_)
- tocTV->expand(index);
+ if (getIndexDepth(index) < depth_)
+ tocTV->expand(index);
else
- tocTV->collapse(index);
+ tocTV->collapse(index);
}
}
disconnectSelectionModel();
tocTV->setCurrentIndex(index);
- tocTV->scrollTo(index);
+ tocTV->scrollTo(index);
reconnectSelectionModel();
}
if (toc_model) {
LYXERR(Debug::GUI)
- << "form_->tocModel()->rowCount "
+ << "form_->tocModel()->rowCount "
<< toc_model->rowCount()
<< "\nform_->tocModel()->columnCount "
<< toc_model->columnCount()
void TocWidget::disconnectSelectionModel()
{
disconnect(tocTV->selectionModel(),
- SIGNAL(currentChanged(const QModelIndex &,
+ SIGNAL(currentChanged(const QModelIndex &,
const QModelIndex &)),
this,
SLOT(selectionChanged(const QModelIndex &,
}
-DoubleAutoValidator::DoubleAutoValidator(QWidget * parent) :
+DoubleAutoValidator::DoubleAutoValidator(QWidget * parent) :
QDoubleValidator(parent) {}
DoubleAutoValidator::DoubleAutoValidator(double bottom,
- double top, int decimals, QObject * parent) :
+ double top, int decimals, QObject * parent) :
QDoubleValidator(bottom, top, decimals, parent) {}
} // namespace lyx
#include "Validator_moc.cpp"
-
Q_OBJECT
public:
DoubleAutoValidator(QWidget * parent);
- DoubleAutoValidator(double bottom, double top, int decimals,
+ DoubleAutoValidator(double bottom, double top, int decimals,
QObject * parent);
QValidator::State validate(QString & input, int & pos) const;
};
// Forward declarations
class LyXRC;
-namespace frontend { class KernelDocType; }
+namespace frontend { class KernelDocType; }
/** A class to ascertain whether the data passed to the @c validate()
void lengthToWidgets(QLineEdit * input, LengthCombo * combo,
- Length const & len, Length::UNIT defaultUnit)
+ Length const & len, Length::UNIT defaultUnit)
{
combo->setCurrentItem(Length(len).unit());
input->setText(toqstr(convert<string>(Length(len).value())));
}
-void lengthAutoToWidgets(QLineEdit * input, LengthCombo * combo,
+void lengthAutoToWidgets(QLineEdit * input, LengthCombo * combo,
Length const & len, Length::UNIT defaultUnit)
{
- if (len.value() == 0)
+ if (len.value() == 0)
lengthToWidgets(input, combo, "auto", defaultUnit);
else
lengthToWidgets(input, combo, len, defaultUnit);
//NOTE "CB" here because we probably will want one of these
//for labeled sets, as well.
-void setAutoTextCB(QCheckBox * checkBox, QLineEdit * lineEdit,
- LengthCombo * lengthCombo)
+void setAutoTextCB(QCheckBox * checkBox, QLineEdit * lineEdit,
+ LengthCombo * lengthCombo)
{
- if (!checkBox->isChecked())
+ if (!checkBox->isChecked())
lengthToWidgets(lineEdit, lengthCombo,
- "auto", lengthCombo->currentLengthItem());
+ "auto", lengthCombo->currentLengthItem());
else if (lineEdit->text() == "auto")
lengthToWidgets(lineEdit, lengthCombo, string(),
- lengthCombo->currentLengthItem());
+ lengthCombo->currentLengthItem());
}
//FIXME It would be nice if defaultUnit were a default argument
/// method to set widgets from a Length
-void lengthToWidgets(QLineEdit * input, LengthCombo * combo,
+void lengthToWidgets(QLineEdit * input, LengthCombo * combo,
Length const & len, Length::UNIT default_unit);
/// method to set widgets from a string
void lengthToWidgets(QLineEdit * input, LengthCombo * combo,
std::string const & len, Length::UNIT default_unit);
/// method to set widgets from a Length with optional "auto" if zero
-void lengthAutoToWidgets(QLineEdit * input, LengthCombo * combo,
+void lengthAutoToWidgets(QLineEdit * input, LengthCombo * combo,
Length const & len, Length::UNIT defaultUnit);
//FIXME setAutoTextCB should really take an argument, as indicated, that
//determines what text is to be written for "auto". But making
//that work involves more extensive revisions than we now want
//to make, since "auto" also appears in update_contents() (see
-//QGraphics.cpp).
+//QGraphics.cpp).
//The right way to do this, I think, would be to define a class
-//checkedLengthSet (and a partnering labeledLengthSete) that encapsulated
+//checkedLengthSet (and a partnering labeledLengthSete) that encapsulated
//the checkbox, line edit, and length combo together, and then made e.g.
//lengthToWidgets, widgetsToLength, etc, all public methods of that class.
//Perhaps even the validator could be exposed through it.
* checkbox is unchecked and clearing the line edit if it previously
* said "text".
*/
-void setAutoTextCB(QCheckBox * checkBox, QLineEdit * lineEdit,
+void setAutoTextCB(QCheckBox * checkBox, QLineEdit * lineEdit,
LengthCombo * lengthCombo/*, string text = "auto"*/);
if (ConverterCache::get().inCache(filename, to_)) {
LYXERR(Debug::GRAPHICS) << "\tNo conversion needed (file in file cache)!"
- << endl;
+ << endl;
file_to_load_ = ConverterCache::get().cacheName(filename, to_);
loadImage();
return;
// If this occurs, move ${outfile}.0 to ${outfile}
// and delete ${outfile}.? (ignore errors)
script << "if not os.path.isfile(outfile):\n"
- " if os.path.isfile(outfile + '.0'):\n"
- " os.rename(outfile + '.0', outfile)\n"
- " import glob\n"
- " for file in glob.glob(outfile + '.?'):\n"
- " unlinkNoThrow(file)\n"
- " else:\n"
- " sys.exit(1)\n\n";
+ " if os.path.isfile(outfile + '.0'):\n"
+ " os.rename(outfile + '.0', outfile)\n"
+ " import glob\n"
+ " for file in glob.glob(outfile + '.?'):\n"
+ " unlinkNoThrow(file)\n"
+ " else:\n"
+ " sys.exit(1)\n\n";
// Delete the infile
script << "unlinkNoThrow(infile)\n\n";
typedef Converters::EdgePath EdgePath;
script << "#!/usr/bin/env python\n"
- "# -*- coding: utf-8 -*-\n"
- "import os, shutil, sys, locale\n\n"
- "def unlinkNoThrow(file):\n"
- " ''' remove a file, do not throw if an error occurs '''\n"
- " try:\n"
- " os.unlink(file)\n"
- " except:\n"
- " pass\n\n"
- "def utf8ToDefaultEncoding(file):\n"
- " ''' if possible, convert to the default encoding '''\n"
- " try:\n"
- " language, output_encoding = locale.getdefaultlocale()\n"
- " if output_encoding == None:\n"
- " output_encoding = 'latin1'\n"
- " return unicode(file, 'utf8').encode(output_encoding)\n"
- " except:\n"
- " return file\n\n";
+ "# -*- coding: utf-8 -*-\n"
+ "import os, shutil, sys, locale\n\n"
+ "def unlinkNoThrow(file):\n"
+ " ''' remove a file, do not throw if an error occurs '''\n"
+ " try:\n"
+ " os.unlink(file)\n"
+ " except:\n"
+ " pass\n\n"
+ "def utf8ToDefaultEncoding(file):\n"
+ " ''' if possible, convert to the default encoding '''\n"
+ " try:\n"
+ " language, output_encoding = locale.getdefaultlocale()\n"
+ " if output_encoding == None:\n"
+ " output_encoding = 'latin1'\n"
+ " return unicode(file, 'utf8').encode(output_encoding)\n"
+ " except:\n"
+ " return file\n\n";
// we do not use ChangeExtension because this is a basename
// which may nevertheless contain a '.'
script << "infile = utf8ToDefaultEncoding("
<< quoteName(from_file.absFilename(), quote_python)
<< ")\n"
- "outfile = " << quoteName(outfile, quote_python) << "\n"
- "shutil.copy(infile, outfile)\n";
+ "outfile = " << quoteName(outfile, quote_python) << "\n"
+ "shutil.copy(infile, outfile)\n";
// Some converters (e.g. lilypond) can only output files to the
// current directory, so we need to change the current directory.
ostringstream os;
os << support::os::python() << ' '
<< libScriptSearch("$$s/scripts/convertDefault.py",
- quote_python) << ' ';
+ quote_python) << ' ';
if (!from_format.empty())
os << from_format << ':';
// The extra " quotes around infile and outfile are needed
// Store these names in the python script
script << "infile = " << quoteName(infile, quote_python) << "\n"
- "infile_base = " << quoteName(infile_base, quote_python) << "\n"
- "outfile = " << quoteName(outfile, quote_python) << '\n';
+ "infile_base = " << quoteName(infile_base, quote_python) << "\n"
+ "outfile = " << quoteName(outfile, quote_python) << '\n';
// See comment about extra " quotes above (although that
// applies only for the first loop run here).
namespace lyx {
using support::FileName;
-
+
namespace graphics {
class Loader::Impl : public boost::signals::trackable {
} // namespace graphics
} // namespace lyx
-
// FIXME UNICODE
string relToMasterPath = support::onlyPath(
to_utf8(support::makeRelPath(from_utf8(absname),
- from_utf8(masterpath))));
+ from_utf8(masterpath))));
if (relToMasterPath == "./")
relToMasterPath.clear();
// FIXME UNICODE
string relToParentPath = support::onlyPath(
to_utf8(support::makeRelPath(from_utf8(absname),
- from_utf8(parentpath))));
+ from_utf8(parentpath))));
if (relToParentPath == "./")
relToParentPath.clear();
string::size_type const send = s.find("\")", spos);
string const file_template = s.substr(spos + 12, send - (spos + 12));
string const file = doSubstitution(params, buffer,
- file_template, false,
- external_in_tmpdir, what);
+ file_template, false,
+ external_in_tmpdir, what);
string contents;
FileName const absfile(
string const & format,
Buffer const & buffer,
ExportData & exportdata,
- bool external_in_tmpdir,
- bool dryrun)
+ bool external_in_tmpdir,
+ bool dryrun)
{
Template const * const et_ptr = getTemplatePtr(params);
if (!et_ptr)
ErrorList el;
bool const success =
theConverters().convert(&buffer, temp_file, abs_to_file,
- params.filename, from_format, to_format, el,
- Converters::try_default | Converters::try_cache);
+ params.filename, from_format, to_format, el,
+ Converters::try_default | Converters::try_cache);
if (!success)
LYXERR(Debug::EXTERNAL)
if (!dryrun || support::contains(cit->second.product, "$$Contents"))
updateExternal(params, format, buffer, exportdata,
- external_in_tmpdir, dryrun);
+ external_in_tmpdir, dryrun);
bool const use_latex_path = format == "LaTeX";
string str = doSubstitution(params, buffer, cit->second.product,
/// return the number of characters; in case of multiple lines of
/// output, add PLAINTEXT_NEWLINE to the number of chars in the last line
virtual int plaintext(Buffer const &, odocstream &,
- OutputParams const &) const = 0;
+ OutputParams const &) const = 0;
/// docbook output
virtual int docbook(Buffer const &, odocstream & os,
- OutputParams const &) const;
+ OutputParams const &) const;
/// the string that is passed to the TOC
virtual void textString(Buffer const &, odocstream &) const {}
AlignCenter,
AlignRight
};
-
+
/// should we have a non-filled line before this inset?
virtual DisplayType display() const { return Inline; }
/// should we break lines after this inset?
InsetCommandParams p("bibitem");
InsetCommandMailer::string2params("bibitem", to_utf8(cmd.argument()), p);
if (p.getCmdName().empty()) {
- cur.noUpdate();
+ cur.noUpdate();
break;
}
if (p["key"] != params()["key"])
int InsetBibitem::plaintext(Buffer const &, odocstream & os,
- OutputParams const &) const
+ OutputParams const &) const
{
odocstringstream oss;
oss << '[' << getCounter() << "] ";
// FIXME: this font is used unitialized for now but should be set to
// a proportional font. Here is what Georg Baum has to say about it:
/*
- bibitemWidest() is supposed to find the bibitem with the widest label in the
- output, because that is needed as an argument of the bibliography
- environment to dtermine the correct indentation. To be 100% correct we
- would need the metrics of the font that is used in the output, but usually
+ bibitemWidest() is supposed to find the bibitem with the widest label in the
+ output, because that is needed as an argument of the bibliography
+ environment to dtermine the correct indentation. To be 100% correct we
+ would need the metrics of the font that is used in the output, but usually
we don't have access to these.
- In practice, any proportional font is probably good enough, since we don't
- need to know the final with, we only need to know the which label is the
+ In practice, any proportional font is probably good enough, since we don't
+ need to know the final with, we only need to know the which label is the
widest.
- Unless there is an easy way to get the metrics of the output font I suggest
+ Unless there is an easy way to get the metrics of the output font I suggest
to use a hardcoded font like "Times" or so.
- It is very important that the result of this function is the same both with
- and without GUI. After thinking about this it is clear that no Font
- metrics should be used here, since these come from the gui. If we can't
- easily get the LaTeX font metrics we should make our own poor mans front
- metrics replacement, e.g. by hardcoding the metrics of the standard TeX
+ It is very important that the result of this function is the same both with
+ and without GUI. After thinking about this it is clear that no Font
+ metrics should be used here, since these come from the gui. If we can't
+ easily get the LaTeX font metrics we should make our own poor mans front
+ metrics replacement, e.g. by hardcoding the metrics of the standard TeX
font.
*/
Font font;
for (; it != end; ++it) {
if (it->bibitem()) {
docstring const label = it->bibitem()->getBibLabel();
-
+
// FIXME: we can't be sure using the following that the GUI
- // version and the command-line version will give the same
+ // version and the command-line version will give the same
// result.
//
//int const wx = use_gui?
// theFontMetrics(font).width(label): label.size();
//
// So for now we just use the label size in order to be sure
- // that GUI and no-GUI gives the same bibitem (even if that is
+ // that GUI and no-GUI gives the same bibitem (even if that is
// potentially the wrong one.
int const wx = label.size();
else
// FIXME UNICODE
return to_utf8(makeRelPath(from_utf8(fname),
- from_utf8(buffer.getMasterBuffer()->filePath())));
+ from_utf8(buffer.getMasterBuffer()->filePath())));
}
}
typedef map<docstring, docstring> VarMap;
- /// remove whitespace characters, optionally a single comma,
+ /// remove whitespace characters, optionally a single comma,
/// and further whitespace characters from the stream.
/// @return true if a comma was found, false otherwise
///
bool removeWSAndComma(idocfstream & ifs) {
char_type ch;
- if (!ifs)
+ if (!ifs)
return false;
// skip whitespace
ifs.get(ch);
} while (ifs && isSpace(ch));
- if (!ifs)
+ if (!ifs)
return false;
if (ch != ',') {
/// delimChars, and remove further whitespace characters.
///
/// @return true if a string of length > 0 could be read.
- ///
- bool readTypeOrKey(docstring & val, idocfstream & ifs,
+ ///
+ bool readTypeOrKey(docstring & val, idocfstream & ifs,
docstring const & delimChars, charCase chCase) {
char_type ch;
val.clear();
- if (!ifs)
+ if (!ifs)
return false;
// skip whitespace
ifs.get(ch);
} while (ifs && isSpace(ch));
- if (!ifs)
+ if (!ifs)
return false;
- // read value
+ // read value
while (ifs && !isSpace(ch) && delimChars.find(ch) == docstring::npos) {
if (chCase == makeLowerCase) {
val += lowercase(ch);
}
/// read subsequent bibtex values that are delimited with a #-character.
- /// Concatenate all parts and replace names with the associated string in
+ /// Concatenate all parts and replace names with the associated string in
/// the variable strings.
/// @return true if reading was successfull (all single parts were delimited
/// correctly)
val.clear();
- if (!ifs)
+ if (!ifs)
return false;
do {
ifs.get(ch);
while (ifs && (nestLevel > 0 || ch != delim)) {
val += ch;
-
+
// update nesting level
switch (ch) {
case '{':
return false;
// continue reading next value on concatenate with '#'
- } while (ch == '#');
+ } while (ch == '#');
ifs.putback(ch);
for (vector<FileName>::const_iterator it = files.begin();
it != files.end(); ++ it) {
// This bibtex parser is a first step to parse bibtex files
- // more precisely.
- //
+ // more precisely.
+ //
// - it reads the whole bibtex entry and does a syntax check
// (matching delimiters, missing commas,...
// - it recovers from errors starting with the next @-character
- // - it reads @string definitions and replaces them in the
+ // - it reads @string definitions and replaces them in the
// field values.
- // - it accepts more characters in keys or value names than
+ // - it accepts more characters in keys or value names than
// bibtex does.
//
// TODOS:
- // - the entries are split into name = value pairs by the
- // parser. These have to be merged again because of the
+ // - the entries are split into name = value pairs by the
+ // parser. These have to be merged again because of the
// way lyx treats the entries ( pair<...>(...) ). The citation
// mechanism in lyx should be changed such that it can use
// the split entries.
// InsetBibitem can generate non-ASCII keys, and nonstandard
// 8bit clean bibtex forks exist.
idocfstream ifs(it->toFilesystemEncoding().c_str(),
- std::ios_base::in,
- buffer.params().encoding().iconvName());
-
+ std::ios_base::in,
+ buffer.params().encoding().iconvName());
+
char_type ch;
VarMap strings;
while (ifs) {
ifs.get(ch);
- if (!ifs)
+ if (!ifs)
break;
- if (ch != '@')
+ if (ch != '@')
continue;
docstring entryType;
ifs.ignore(std::numeric_limits<int>::max(), '\n');
continue;
- }
+ }
ifs.get(ch);
- if (!ifs)
+ if (!ifs)
break;
if ((ch != '(') && (ch != '{')) {
// process the entry
if (entryType == from_ascii("string")) {
- // read string and add it to the strings map
+ // read string and add it to the strings map
// (or replace it's old value)
docstring name;
docstring value;
} else if (entryType == from_ascii("preamble")) {
- // preamble definitions are discarded.
+ // preamble definitions are discarded.
// can they be of any use in lyx?
docstring value;
if (!readTypeOrKey(key, ifs, from_ascii(",})"), keepCase) || !ifs)
continue;
- // now we have a key, so we will add an entry
+ // now we have a key, so we will add an entry
// (even if it's empty, as bibtex does)
- //
+ //
// all items must be separated by a comma. If
// it is missing the scanning of this entry is
// stopped and the next is searched.
}
// read field value
- if (!readValue(value, ifs, strings))
+ if (!readValue(value, ifs, strings))
break;
// append field to the total entry string.
//
- // TODO: Here is where the fields can be put in
+ // TODO: Here is where the fields can be put in
// a more intelligent structure that preserves
// the already known parts.
fields += commaNewline;
fields += name + from_ascii(" = {") + value + '}';
- if (!commaNewline.length())
- commaNewline = from_ascii(",\n");
+ if (!commaNewline.length())
+ commaNewline = from_ascii(",\n");
readNext = removeWSAndComma(ifs);
}
int InsetBox::latex(Buffer const & buf, odocstream & os,
- OutputParams const & runparams) const
+ OutputParams const & runparams) const
{
BoxType btype = boxtranslator().find(params_.type);
int InsetBox::plaintext(Buffer const & buf, odocstream & os,
- OutputParams const & runparams) const
+ OutputParams const & runparams) const
{
BoxType const btype = boxtranslator().find(params_.type);
int InsetBox::docbook(Buffer const & buf, odocstream & os,
- OutputParams const & runparams) const
+ OutputParams const & runparams) const
{
return InsetText::docbook(buf, os, runparams);
}
int InsetBranch::latex(Buffer const & buf, odocstream & os,
- OutputParams const & runparams) const
+ OutputParams const & runparams) const
{
return isBranchSelected(buf) ?
InsetText::latex(buf, os, runparams) : 0;
int InsetBranch::plaintext(Buffer const & buf, odocstream & os,
- OutputParams const & runparams) const
+ OutputParams const & runparams) const
{
if (!isBranchSelected(buf))
return 0;
int InsetBranch::docbook(Buffer const & buf, odocstream & os,
- OutputParams const & runparams) const
+ OutputParams const & runparams) const
{
return isBranchSelected(buf) ?
InsetText::docbook(buf, os, runparams) : 0;
bool showInsetDialog(BufferView *) const;
///
int latex(Buffer const &, odocstream &,
- OutputParams const &) const;
+ OutputParams const &) const;
///
int plaintext(Buffer const &, odocstream &,
- OutputParams const &) const;
+ OutputParams const &) const;
///
int docbook(Buffer const &, odocstream &,
- OutputParams const &) const;
+ OutputParams const &) const;
///
void textString(Buffer const & buf, odocstream &) const;
///
int InsetCaption::latex(Buffer const & buf, odocstream & os,
- OutputParams const & runparams_in) const
+ OutputParams const & runparams_in) const
{
// This is a bit too simplistic to take advantage of
// caption options we must add more later. (Lgb)
int InsetCaption::plaintext(Buffer const & buf, odocstream & os,
- OutputParams const & runparams) const
+ OutputParams const & runparams) const
{
computeFullLabel(buf);
int InsetCaption::docbook(Buffer const & buf, odocstream & os,
- OutputParams const & runparams) const
+ OutputParams const & runparams) const
{
int ret;
os << "<title>";
int InsetCaption::getArgument(Buffer const & buf, odocstream & os,
- OutputParams const & runparams) const
+ OutputParams const & runparams) const
{
return InsetText::latex(buf, os, runparams);
}
int InsetCaption::getOptArg(Buffer const & buf, odocstream & os,
- OutputParams const & runparams) const
+ OutputParams const & runparams) const
{
return latexOptArgInsets(buf, paragraphs()[0], os, runparams, 1);
}
virtual bool wide() const { return false; }
///
int latex(Buffer const & buf, odocstream & os,
- OutputParams const &) const;
+ OutputParams const &) const;
///
int plaintext(Buffer const & buf, odocstream & os,
- OutputParams const & runparams) const;
+ OutputParams const & runparams) const;
///
int docbook(Buffer const & buf, odocstream & os,
- OutputParams const & runparams) const;
+ OutputParams const & runparams) const;
/// return the mandatory argument (LaTeX format) only
int getArgument(Buffer const & buf, odocstream & os,
- OutputParams const &) const;
+ OutputParams const &) const;
/// return the optional argument(s) only
int getOptArg(Buffer const & buf, odocstream & os,
- OutputParams const &) const;
+ OutputParams const &) const;
///
void setCount(int c) { counter_ = c; }
///
{
setInlined();
switch (cmd.action) {
-
+
case LFUN_MOUSE_RELEASE:
if (cmd.button() == mouse_button::button3)
params_.show_label = !params_.show_label;
int InsetCharStyle::latex(Buffer const & buf, odocstream & os,
- OutputParams const & runparams) const
+ OutputParams const & runparams) const
{
if (!undefined()) {
// FIXME UNICODE
int InsetCharStyle::plaintext(Buffer const & buf, odocstream & os,
- OutputParams const & runparams) const
+ OutputParams const & runparams) const
{
return InsetText::plaintext(buf, os, runparams);
}
int InsetCharStyle::docbook(Buffer const & buf, odocstream & os,
- OutputParams const & runparams) const
+ OutputParams const & runparams) const
{
ParagraphList::const_iterator beg = paragraphs().begin();
ParagraphList::const_iterator par = paragraphs().begin();
ParagraphList::const_iterator end = paragraphs().end();
if (!undefined())
- // FIXME UNICODE
- sgml::openTag(os, params_.latexname,
- par->getID(buf, runparams) + params_.latexparam);
+ // FIXME UNICODE
+ sgml::openTag(os, params_.latexname,
+ par->getID(buf, runparams) + params_.latexparam);
for (; par != end; ++par) {
par->simpleDocBookOnePar(buf, os, runparams,
bool forceDefaultParagraphs(idx_type) const { return true; }
///
int latex(Buffer const &, odocstream &,
- OutputParams const &) const;
+ OutputParams const &) const;
///
int plaintext(Buffer const &, odocstream &,
- OutputParams const &) const;
+ OutputParams const &) const;
///
int docbook(Buffer const &, odocstream &,
- OutputParams const &) const;
+ OutputParams const &) const;
/// the string that is passed to the TOC
virtual void textString(Buffer const &, odocstream &) const;
///
int InsetCitation::plaintext(Buffer const & buffer, odocstream & os,
- OutputParams const &) const
+ OutputParams const &) const
{
docstring str;
}
int InsetCitation::docbook(Buffer const &, odocstream & os,
- OutputParams const &) const
+ OutputParams const &) const
{
os << "<citation>"
- << cleanupWhitespace(getParam("key"))
- << "</citation>";
+ << cleanupWhitespace(getParam("key"))
+ << "</citation>";
return 0;
}
// citations and then changes his mind, turning natbib support off. The output
// should revert to \cite[]{}
int InsetCitation::latex(Buffer const & buffer, odocstream & os,
- OutputParams const &) const
+ OutputParams const &) const
{
biblio::CiteEngine cite_engine = buffer.params().getEngine();
// FIXME UNICODE
Inset::Code lyxCode() const { return Inset::CITE_CODE; }
///
int latex(Buffer const &, odocstream &,
- OutputParams const &) const;
+ OutputParams const &) const;
///
int plaintext(Buffer const &, odocstream &,
- OutputParams const &) const;
+ OutputParams const &) const;
///
int docbook(Buffer const &, odocstream &,
- OutputParams const &) const;
+ OutputParams const &) const;
/// the string that is passed to the TOC
virtual int textString(Buffer const &, odocstream &,
OutputParams const &) const;
InsetCollapsable::InsetCollapsable(InsetCollapsable const & rhs)
- : InsetText(rhs),
+ : InsetText(rhs),
labelfont_(rhs.labelfont_),
button_dim(rhs.button_dim),
topx(rhs.topx),
if (status() == Open) {
InsetText::metrics(mi, textdim_);
// This expression should not contain mi.base.texwidth
- openinlined_ = !hasFixedWidth()
+ openinlined_ = !hasFixedWidth()
&& textdim_.wid < 0.5 * mi.base.bv->workWidth();
if (openinlined_) {
// Correct for button width, and re-fit
}
-void InsetCollapsable::cursorPos(BufferView const & bv,
+void InsetCollapsable::cursorPos(BufferView const & bv,
CursorSlice const & sl, bool boundary, int & x, int & y) const
{
BOOST_ASSERT(status() != Collapsed);
int InsetCommand::latex(Buffer const &, odocstream & os,
- OutputParams const &) const
+ OutputParams const &) const
{
os << getCommand();
return 0;
int InsetCommand::plaintext(Buffer const & buf, odocstream & os,
- OutputParams const &) const
+ OutputParams const &) const
{
docstring const str = "[" + buf.B_("LaTeX Command: ") + from_utf8(getCmdName()) + "]";
os << str;
int InsetCommand::docbook(Buffer const &, odocstream &,
- OutputParams const &) const
+ OutputParams const &) const
{
return 0;
}
if (info_->optional[i])
return to_utf8(params_[i]);
lyxerr << "Programming error: get nonexisting option in "
- << name_ << " inset." << endl;;
+ << name_ << " inset." << endl;;
return string();
}
}
// Happens in InsetCitation
lyxerr << "Programming error: get nonexisting second option in "
- << name_ << " inset." << endl;;
+ << name_ << " inset." << endl;;
return string();
}
return;
}
lyxerr << "Programming error: set nonexisting option in "
- << name_ << " inset." << endl;;
+ << name_ << " inset." << endl;;
}
}
// Happens in InsetCitation
lyxerr << "Programming error: set nonexisting second option in "
- << name_ << " inset." << endl;;
+ << name_ << " inset." << endl;;
}
int InsetERT::plaintext(Buffer const &, odocstream &,
- OutputParams const &) const
+ OutputParams const &) const
{
return 0; // do not output TeX code
}
OutputParams const &) const;
///
int plaintext(Buffer const &, odocstream &,
- OutputParams const &) const;
+ OutputParams const &) const;
///
int docbook(Buffer const &, odocstream &,
OutputParams const &) const;
int InsetEnvironment::latex(Buffer const & buf, odocstream & os,
- OutputParams const & runparams) const
+ OutputParams const & runparams) const
{
// FIXME UNICODE
os << from_utf8(layout_->latexheader);
int InsetEnvironment::plaintext(Buffer const & buf, odocstream & os,
- OutputParams const & runparams) const
+ OutputParams const & runparams) const
{
os << '[' << to_utf8(name()) << ":\n";
InsetText::plaintext(buf, os, runparams);
Inset::Code lyxCode() const { return Inset::ENVIRONMENT_CODE; }
///
int latex(Buffer const &, odocstream &,
- OutputParams const &) const;
+ OutputParams const &) const;
///
int plaintext(Buffer const &, odocstream &,
- OutputParams const &) const;
+ OutputParams const &) const;
///
virtual docstring const editMessage() const;
///
int InsetExternal::latex(Buffer const & buf, odocstream & os,
- OutputParams const & runparams) const
+ OutputParams const & runparams) const
{
if (params_.draft) {
// FIXME UNICODE
if (cit != et.formats.end()) {
return external::writeExternal(params_, "PDFLaTeX",
- buf, os,
- *(runparams.exportdata),
- external_in_tmpdir,
- dryrun);
- }
+ buf, os,
+ *(runparams.exportdata),
+ external_in_tmpdir,
+ dryrun);
+ }
}
return external::writeExternal(params_, "LaTeX", buf, os,
- *(runparams.exportdata),
- external_in_tmpdir,
- dryrun);
+ *(runparams.exportdata),
+ external_in_tmpdir,
+ dryrun);
}
int InsetExternal::plaintext(Buffer const & buf, odocstream & os,
- OutputParams const & runparams) const
+ OutputParams const & runparams) const
{
os << '\n'; // output external material on a new line
external::writeExternal(params_, "Ascii", buf, os,
- *(runparams.exportdata), false,
- runparams.dryrun || runparams.inComment);
+ *(runparams.exportdata), false,
+ runparams.dryrun || runparams.inComment);
return PLAINTEXT_NEWLINE;
}
int InsetExternal::docbook(Buffer const & buf, odocstream & os,
- OutputParams const & runparams) const
+ OutputParams const & runparams) const
{
return external::writeExternal(params_, "DocBook", buf, os,
*(runparams.exportdata), false,
- runparams.dryrun || runparams.inComment);
+ runparams.dryrun || runparams.inComment);
}
/// \returns the number of rows (\n's) of generated code.
int latex(Buffer const &, odocstream &,
- OutputParams const &) const;
+ OutputParams const &) const;
///
int plaintext(Buffer const &, odocstream &,
- OutputParams const &) const;
+ OutputParams const &) const;
///
int docbook(Buffer const &, odocstream &,
- OutputParams const &) const;
+ OutputParams const &) const;
/// Update needed features for this inset.
virtual void validate(LaTeXFeatures & features) const;
int InsetFloat::latex(Buffer const & buf, odocstream & os,
- OutputParams const & runparams) const
+ OutputParams const & runparams) const
{
FloatList const & floats = buf.params().getTextClass().floats();
string tmptype = (params_.wide ? params_.type + "*" : params_.type);
int InsetFloat::plaintext(Buffer const & buf, odocstream & os,
- OutputParams const & runparams) const
+ OutputParams const & runparams) const
{
os << '[' << buf.B_("float") << ' ' << floatName(params_.type, buf.params()) << ":\n";
InsetText::plaintext(buf, os, runparams);
int InsetFloat::docbook(Buffer const & buf, odocstream & os,
- OutputParams const & runparams) const
+ OutputParams const & runparams) const
{
- // FIXME UNICODE
- os << '<' << from_ascii(params_.type) << '>';
+ // FIXME UNICODE
+ os << '<' << from_ascii(params_.type) << '>';
int const i = InsetText::docbook(buf, os, runparams);
os << "</" << from_ascii(params_.type) << '>';
virtual bool wide() const { return false; }
///
int latex(Buffer const &, odocstream &,
- OutputParams const &) const;
+ OutputParams const &) const;
///
int plaintext(Buffer const &, odocstream &,
- OutputParams const &) const;
+ OutputParams const &) const;
///
int docbook(Buffer const &, odocstream &,
- OutputParams const &) const;
+ OutputParams const &) const;
///
virtual docstring const editMessage() const;
///
if (lex.eatLine()) {
setParam("type", lex.getDocString());
LYXERR(Debug::INSETS) << "FloatList::float_type: "
- << to_ascii(getParam("type")) << endl;
+ << to_ascii(getParam("type")) << endl;
if (!floats.typeExist(to_ascii(getParam("type"))))
lex.printError("InsetFloatList: Unknown float type: `$$Token'");
} else
int InsetFloatList::latex(Buffer const & buf, odocstream & os,
- OutputParams const &) const
+ OutputParams const &) const
{
FloatList const & floats = buf.params().getTextClass().floats();
FloatList::const_iterator cit = floats[to_ascii(getParam("type"))];
int InsetFloatList::plaintext(Buffer const & buffer, odocstream & os,
- OutputParams const &) const
+ OutputParams const &) const
{
os << getScreenLabel(buffer) << "\n\n";
void read(Buffer const &, Lexer &);
///
int latex(Buffer const &, odocstream &,
- OutputParams const &) const;
+ OutputParams const &) const;
///
int docbook(Buffer const &, odocstream &,
- OutputParams const &) const { return 0; }
+ OutputParams const &) const { return 0; }
///
int plaintext(Buffer const &, odocstream &,
- OutputParams const & runparams) const;
+ OutputParams const & runparams) const;
///
void validate(LaTeXFeatures & features) const;
private:
int InsetFoot::latex(Buffer const & buf, odocstream & os,
- OutputParams const & runparams_in) const
+ OutputParams const & runparams_in) const
{
OutputParams runparams = runparams_in;
// footnotes in titling commands like \title have moving arguments
int InsetFoot::plaintext(Buffer const & buf, odocstream & os,
- OutputParams const & runparams) const
+ OutputParams const & runparams) const
{
os << '[' << buf.B_("footnote") << ":\n";
InsetText::plaintext(buf, os, runparams);
int InsetFoot::docbook(Buffer const & buf, odocstream & os,
- OutputParams const & runparams) const
+ OutputParams const & runparams) const
{
os << "<footnote>";
int const i = InsetText::docbook(buf, os, runparams);
docstring name() const { return from_ascii("Foot"); }
///
int latex(Buffer const &, odocstream &,
- OutputParams const &) const;
+ OutputParams const &) const;
///
int plaintext(Buffer const &, odocstream &,
- OutputParams const &) const;
+ OutputParams const &) const;
///
int docbook(Buffer const &, odocstream &,
- OutputParams const &) const;
+ OutputParams const &) const;
///
virtual docstring const editMessage() const;
protected:
// FIXME (Abdel 12/08/06): Is there a need to show these errors?
ErrorList el;
if (theConverters().convert(&buf, temp_file, to_file, params().filename,
- from, to, el,
- Converters::try_default | Converters::try_cache)) {
+ from, to, el,
+ Converters::try_default | Converters::try_cache)) {
runparams.exportdata->addExternalFile(tex_format,
to_file, output_to_file);
runparams.exportdata->addExternalFile("dvi",
int InsetGraphics::latex(Buffer const & buf, odocstream & os,
- OutputParams const & runparams) const
+ OutputParams const & runparams) const
{
// If there is no file specified or not existing,
// just output a message about it in the latex output.
params().filename.relFilename(buf.filePath());
bool const file_exists = !params().filename.empty() &&
- isFileReadable(params().filename);
+ isFileReadable(params().filename);
string const message = file_exists ?
string() : string("bb = 0 0 200 100, draft, type=eps");
// if !message.empty() then there was no existing file
int InsetGraphics::plaintext(Buffer const & buf, odocstream & os,
- OutputParams const &) const
+ OutputParams const &) const
{
// No graphics in ascii output. Possible to use gifscii to convert
// images to ascii approximation.
// FIXME: We have no idea what the encoding of the filename is
docstring const str = bformat(buf.B_("Graphics file: %1$s"),
- from_utf8(params().filename.absFilename()));
+ from_utf8(params().filename.absFilename()));
os << '<' << str << '>';
return 2 + str.size();
namespace {
int writeImageObject(char * format, odocstream & os, OutputParams const & runparams,
- docstring const graphic_label, docstring const attributes)
+ docstring const graphic_label, docstring const attributes)
{
if (runparams.flavor != OutputParams::XML) {
os << "<![ %output.print."
- << format
- << "; ["
- << std::endl;
+ << format
+ << "; ["
+ << std::endl;
}
os <<"<imageobject><imagedata fileref=\"&"
<< graphic_label
- << ";."
- << format
- << "\" "
- << attributes;
+ << ";."
+ << format
+ << "\" "
+ << attributes;
if (runparams.flavor == OutputParams::XML) {
os << " role=\"" << format << "\"/>" ;
}
fragile commands by adding a #\protect# before.
*/
int latex(Buffer const &, odocstream &,
- OutputParams const &) const;
+ OutputParams const &) const;
///
int plaintext(Buffer const &, odocstream &,
- OutputParams const &) const;
+ OutputParams const &) const;
///
int docbook(Buffer const &, odocstream &,
- OutputParams const &) const;
+ OutputParams const &) const;
/** Tell LyX what the latex features you need i.e. what latex packages
you need to be included.
int InsetHFill::plaintext(Buffer const &, odocstream & os,
- OutputParams const &) const
+ OutputParams const &) const
{
os << " ";
- return 5;
+ return 5;
}
Inset::Code lyxCode() const { return Inset::HFILL_CODE; }
///
int plaintext(Buffer const &, odocstream &,
- OutputParams const &) const;
+ OutputParams const &) const;
///
int docbook(Buffer const &, odocstream &,
OutputParams const &) const;
break;
case LFUN_MOUSE_RELEASE:
- if (!cur.selection())
+ if (!cur.selection())
InsetIncludeMailer(*this).showDialog(&cur.bv());
break;
}
-bool isInputOrInclude(InsetCommandParams const & params)
+bool isInputOrInclude(InsetCommandParams const & params)
{
Types const t = type(params);
return (t == INPUT) || (t == INCLUDE);
}
if (token != "\\end_inset") {
lex.printError("Missing \\end_inset at this point. "
- "Read: `$$Token'");
+ "Read: `$$Token'");
}
}
return 0;
Buffer * childBuffer = theBufferList().getBuffer(included_file);
-
+
//FIXME RECURSIVE INCLUDES
if (childBuffer == & buffer)
return 0;
int InsetInclude::latex(Buffer const & buffer, odocstream & os,
- OutputParams const & runparams) const
+ OutputParams const & runparams) const
{
string incfile(to_utf8(params_["filename"]));
return 0;
FileName const included_file(includedFilename(buffer, params_));
-
+
//Check we're not trying to include ourselves.
//FIXME RECURSIVE INCLUDE
//This isn't sufficient, as the inclusion could be downstream.
//But it'll have to do for now.
if (isInputOrInclude(params_) &&
- buffer.fileName() == included_file.absFilename())
+ buffer.fileName() == included_file.absFilename())
{
- Alert::error(_("Recursive input"),
- bformat(_("Attempted to include file %1$s in itself! "
- "Ignoring inclusion."), from_utf8(incfile)));
+ Alert::error(_("Recursive input"),
+ bformat(_("Attempted to include file %1$s in itself! "
+ "Ignoring inclusion."), from_utf8(incfile)));
return 0;
}
if (!absolutePath(incfile)) {
// FIXME UNICODE
incfile = to_utf8(makeRelPath(from_utf8(included_file.absFilename()),
- from_utf8(m_buffer->filePath())));
+ from_utf8(m_buffer->filePath())));
}
// write it to a file (so far the complete file)
string const exportfile = changeExtension(incfile, ".tex");
- string const mangled =
+ string const mangled =
DocFileName(changeExtension(included_file.absFilename(),".tex")).
mangledFilename();
FileName const writefile(makeAbsPath(mangled, m_buffer->temppath()));
if (runparams.inComment || runparams.dryrun) {
//Don't try to load or copy the file if we're
//in a comment or doing a dryrun
- } else if (isInputOrInclude(params_) &&
- isLyXFilename(included_file.absFilename())) {
+ } else if (isInputOrInclude(params_) &&
+ isLyXFilename(included_file.absFilename())) {
//if it's a LyX file and we're inputting or including,
//try to load it so we can write the associated latex
if (!loadIfNeeded(buffer, params_))
return false;
-
+
Buffer * tmp = theBufferList().getBuffer(included_file.absFilename());
if (tmp->params().textclass != m_buffer->params().textclass) {
runparams.encoding = oldEnc;
} else {
// In this case, it's not a LyX file, so we copy the file
- // to the temp dir, so that .aux files etc. are not created
- // in the original dir. Files included by this file will be
+ // to the temp dir, so that .aux files etc. are not created
+ // in the original dir. Files included by this file will be
// found via input@path, see ../Buffer.cpp.
unsigned long const checksum_in = sum(included_file);
unsigned long const checksum_out = sum(writefile);
int InsetInclude::plaintext(Buffer const & buffer, odocstream & os,
- OutputParams const &) const
+ OutputParams const &) const
{
if (isVerbatim(params_) || isListings(params_)) {
os << '[' << getScreenLabel(buffer) << '\n';
int InsetInclude::docbook(Buffer const & buffer, odocstream & os,
- OutputParams const & runparams) const
+ OutputParams const & runparams) const
{
string incfile = to_utf8(params_["filename"]);
//This isn't sufficient, as the inclusion could be downstream.
//But it'll have to do for now.
if (buffer.fileName() == included_file) {
- Alert::error(_("Recursive input"),
- bformat(_("Attempted to include file %1$s in itself! "
- "Ignoring inclusion."), from_utf8(incfile)));
+ Alert::error(_("Recursive input"),
+ bformat(_("Attempted to include file %1$s in itself! "
+ "Ignoring inclusion."), from_utf8(incfile)));
return 0;
}
<< '&' << include_label << ';'
<< "\" format=\"linespecific\">";
} else
- os << '&' << include_label << ';';
+ os << '&' << include_label << ';';
return 0;
}
void read(Buffer const &, Lexer &);
///
int latex(Buffer const &, odocstream &,
- OutputParams const &) const;
+ OutputParams const &) const;
///
int plaintext(Buffer const &, odocstream &,
- OutputParams const &) const;
+ OutputParams const &) const;
///
int docbook(Buffer const &, odocstream &,
- OutputParams const &) const;
+ OutputParams const &) const;
///
void validate(LaTeXFeatures &) const;
///
void updateLabels(Buffer const & buffer) const;
///
bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const;
- /// if this inset contains lstinputlisting and has a caption,
+ /// if this inset contains lstinputlisting and has a caption,
/// update internal counter and passed counter
void updateCounter(Counters & counters);
protected:
OutputParams const &) const
{
os << "<indexterm><primary>"
- << sgml::escapeString(getParam("name"))
+ << sgml::escapeString(getParam("name"))
<< "</primary></indexterm>";
return 0;
}
int InsetLabel::latex(Buffer const &, odocstream & os,
- OutputParams const &) const
+ OutputParams const &) const
{
os << escape(getCommand());
return 0;
int InsetLabel::plaintext(Buffer const &, odocstream & os,
- OutputParams const &) const
+ OutputParams const &) const
{
docstring const str = getParam("name");
os << '<' << str << '>';
int InsetLabel::docbook(Buffer const & buf, odocstream & os,
- OutputParams const & runparams) const
+ OutputParams const & runparams) const
{
os << "<!-- anchor id=\""
- << sgml::cleanID(buf, runparams, getParam("name"))
- << "\" -->";
+ << sgml::cleanID(buf, runparams, getParam("name"))
+ << "\" -->";
return 0;
}
int InsetLine::latex(Buffer const &, odocstream & os,
- OutputParams const & runparams) const
+ OutputParams const & runparams) const
{
os << "\\lyxline{\\"
<< from_ascii(runparams.local_font->latexSize()) << '}';
int InsetLine::plaintext(Buffer const &, odocstream & os,
- OutputParams const &) const
+ OutputParams const &) const
{
os << "\n-------------------------------------------\n";
return PLAINTEXT_NEWLINE;
void draw(PainterInfo & pi, int x, int y) const;
int latex(Buffer const &, odocstream &,
- OutputParams const &) const;
+ OutputParams const &) const;
int plaintext(Buffer const &, odocstream &,
- OutputParams const &) const;
+ OutputParams const &) const;
int docbook(Buffer const &, odocstream &,
OutputParams const &) const;
}
os << code;
if (lstinline)
- os << *delimiter;
+ os << *delimiter;
else {
os << "\n\\end{lstlisting}\n\\endgroup\n";
lines += 3;
}
case LFUN_INSET_DIALOG_UPDATE:
InsetListingsMailer(*this).updateDialog(&cur.bv());
- break;
+ break;
case LFUN_MOUSE_RELEASE: {
if (cmd.button() == mouse_button::button3 && hitButton(cmd)) {
InsetListingsMailer(*this).showDialog(&cur.bv());
/// for option with value "true", "false".
/// if onoff is true,
/// "true": option
- /// "false":
+ /// "false":
/// "other": option="other"
/// onoff is false,
/// "true": option=true
par2 = par.substr(1);
unclosed = true;
}
-
+
switch (type_) {
case ALL:
}
// otherwise, produce a meaningful error message.
string matching_names;
- for (vector<string>::iterator it = lists.begin();
+ for (vector<string>::iterator it = lists.begin();
it != lists.end(); ++it) {
if (it->size() >= par2.size() && it->substr(0, par2.size()) == par2) {
if (matching_names.empty())
/// languages and language/dialect combinations
-char const * allowed_languages =
+char const * allowed_languages =
"no language\nABAP\n[R/2 4.3]ABAP\n[R/2 5.0]ABAP\n[R/3 3.1]ABAP\n"
"[R/3 4.6C]ABAP\n[R/3 6.10]ABAP\nACSL\nAda\n[2005]Ada\n[83]Ada\n"
"[95]Ada\nALGOL\n[60]ALGOL\n[68]ALGOL\nAssembler\n"
/// ListingsParam Validator.
-/// This class is aimed to be a singleton which is instantiated in
+/// This class is aimed to be a singleton which is instantiated in
/// \c InsetListingsParams::addParam().
// FIXME: transfer this validator to the frontend.
// FIXME: avoid the use of exception.
/// options copied from page 26 of listings manual
// FIXME: add default parameters ... (which is not used now)
- all_params_["float"] =
+ all_params_["float"] =
ListingsParam("false", true, SUBSETOF, "*tbph", empty_hint);
- all_params_["floatplacement"] =
+ all_params_["floatplacement"] =
ListingsParam("tbp", false, SUBSETOF, "tbp", empty_hint);
- all_params_["aboveskip"] =
+ all_params_["aboveskip"] =
ListingsParam("\\medskipamount", false, LENGTH, "", empty_hint);
- all_params_["belowskip"] =
+ all_params_["belowskip"] =
ListingsParam("\\medskipamount", false, LENGTH, "", empty_hint);
- all_params_["lineskip"] =
+ all_params_["lineskip"] =
ListingsParam("", false, LENGTH, "", empty_hint);
- all_params_["boxpos"] =
+ all_params_["boxpos"] =
ListingsParam("", false, SUBSETOF, "bct", empty_hint);
- all_params_["print"] =
+ all_params_["print"] =
ListingsParam("", false, TRUEFALSE, "", empty_hint);
- all_params_["firstline"] =
+ all_params_["firstline"] =
ListingsParam("", false, INTEGER, "", empty_hint);
- all_params_["lastline"] =
+ all_params_["lastline"] =
ListingsParam("", false, INTEGER, "", empty_hint);
all_params_["showlines"] =
ListingsParam("", false, TRUEFALSE, "", empty_hint);
- all_params_["emptylines"] =
+ all_params_["emptylines"] =
ListingsParam("", false, ALL, "", _(
"Expect a number with an optional * before it"));
- all_params_["gobble"] =
+ all_params_["gobble"] =
ListingsParam("", false, INTEGER, "", empty_hint);
- all_params_["style"] =
+ all_params_["style"] =
ListingsParam("", false, ALL, "", empty_hint);
- all_params_["language"] =
+ all_params_["language"] =
ListingsParam("", false, ONEOF, allowed_languages, empty_hint);
- all_params_["alsolanguage"] =
+ all_params_["alsolanguage"] =
ListingsParam("", false, ONEOF, allowed_languages, empty_hint);
- all_params_["defaultdialect"] =
+ all_params_["defaultdialect"] =
ListingsParam("", false, ONEOF, allowed_languages, empty_hint);
- all_params_["printpod"] =
+ all_params_["printpod"] =
ListingsParam("", false, TRUEFALSE, "", empty_hint);
- all_params_["usekeywordsintag"] =
+ all_params_["usekeywordsintag"] =
ListingsParam("", false, TRUEFALSE, "", empty_hint);
- all_params_["tagstyle"] =
+ all_params_["tagstyle"] =
ListingsParam("", false, ALL, "", style_hint);
- all_params_["markfirstintag"] =
+ all_params_["markfirstintag"] =
ListingsParam("", false, ALL, "", style_hint);
- all_params_["makemacrouse"] =
+ all_params_["makemacrouse"] =
ListingsParam("", false, TRUEFALSE, "", empty_hint);
- all_params_["basicstyle"] =
+ all_params_["basicstyle"] =
ListingsParam("", false, ALL, "", style_hint);
- all_params_["identifierstyle"] =
+ all_params_["identifierstyle"] =
ListingsParam("", false, ALL, "", style_hint);
- all_params_["commentstyle"] =
+ all_params_["commentstyle"] =
ListingsParam("", false, ALL, "", style_hint);
- all_params_["stringstyle"] =
+ all_params_["stringstyle"] =
ListingsParam("", false, ALL, "", style_hint);
- all_params_["keywordstyle"] =
+ all_params_["keywordstyle"] =
ListingsParam("", false, ALL, "", style_hint);
- all_params_["ndkeywordstyle"] =
+ all_params_["ndkeywordstyle"] =
ListingsParam("", false, ALL, "", style_hint);
- all_params_["classoffset"] =
+ all_params_["classoffset"] =
ListingsParam("", false, INTEGER, "", empty_hint);
- all_params_["texcsstyle"] =
+ all_params_["texcsstyle"] =
ListingsParam("", false, ALL, "", style_hint);
- all_params_["directivestyle"] =
+ all_params_["directivestyle"] =
ListingsParam("", false, ALL, "", style_hint);
- all_params_["emph"] =
+ all_params_["emph"] =
ListingsParam("", false, ALL, "", empty_hint);
- all_params_["moreemph"] =
+ all_params_["moreemph"] =
ListingsParam("", false, ALL, "", empty_hint);
- all_params_["deleteemph"] =
+ all_params_["deleteemph"] =
ListingsParam("", false, ALL, "", empty_hint);
- all_params_["emphstyle"] =
+ all_params_["emphstyle"] =
ListingsParam("", false, ALL, "", empty_hint);
- all_params_["delim"] =
+ all_params_["delim"] =
ListingsParam("", false, ALL, "", empty_hint);
- all_params_["moredelim"] =
+ all_params_["moredelim"] =
ListingsParam("", false, ALL, "", empty_hint);
- all_params_["deletedelim"] =
+ all_params_["deletedelim"] =
ListingsParam("", false, ALL, "", empty_hint);
- all_params_["extendedchars"] =
+ all_params_["extendedchars"] =
ListingsParam("", false, TRUEFALSE, "", empty_hint);
- all_params_["inputencoding"] =
+ all_params_["inputencoding"] =
ListingsParam("", false, ALL, "", empty_hint);
- all_params_["upquote"] =
+ all_params_["upquote"] =
ListingsParam("", false, TRUEFALSE, "", empty_hint);
- all_params_["tabsize"] =
+ all_params_["tabsize"] =
ListingsParam("", false, INTEGER, "", empty_hint);
- all_params_["showtabs"] =
+ all_params_["showtabs"] =
ListingsParam("", false, ALL, "", empty_hint);
- all_params_["tab"] =
+ all_params_["tab"] =
ListingsParam("", false, ALL, "", empty_hint);
- all_params_["showspaces"] =
+ all_params_["showspaces"] =
ListingsParam("", false, TRUEFALSE, "", empty_hint);
- all_params_["showstringspaces"] =
+ all_params_["showstringspaces"] =
ListingsParam("", false, TRUEFALSE, "", empty_hint);
- all_params_["formfeed"] =
+ all_params_["formfeed"] =
ListingsParam("", false, ALL, "", empty_hint);
- all_params_["numbers"] =
+ all_params_["numbers"] =
ListingsParam("", false, ONEOF, "none\nleft\nright", empty_hint);
- all_params_["stepnumber"] =
+ all_params_["stepnumber"] =
ListingsParam("", false, INTEGER, "", empty_hint);
- all_params_["numberfirstline"] =
+ all_params_["numberfirstline"] =
ListingsParam("", false, TRUEFALSE, "", empty_hint);
- all_params_["numberstyle"] =
+ all_params_["numberstyle"] =
ListingsParam("", false, ALL, "", style_hint);
- all_params_["numbersep"] =
+ all_params_["numbersep"] =
ListingsParam("", false, LENGTH, "", empty_hint);
- all_params_["numberblanklines"] =
+ all_params_["numberblanklines"] =
ListingsParam("", false, ALL, "", empty_hint);
- all_params_["firstnumber"] =
+ all_params_["firstnumber"] =
ListingsParam("", false, ALL, "", _("auto, last or a number"));
- all_params_["name"] =
+ all_params_["name"] =
ListingsParam("", false, ALL, "", empty_hint);
- all_params_["thelstnumber"] =
+ all_params_["thelstnumber"] =
ListingsParam("", false, ALL, "", empty_hint);
- all_params_["title"] =
+ all_params_["title"] =
ListingsParam("", false, ALL, "", empty_hint);
// this option is not handled in the parameter box
- all_params_["caption"] =
+ all_params_["caption"] =
ListingsParam("", false, ALL, "", _(
"This parameter should not be entered here. Please use caption "
"editbox (Include dialog) or insert->caption (listings inset)"));
// this option is not handled in the parameter box
- all_params_["label"] =
+ all_params_["label"] =
ListingsParam("", false, ALL, "",_(
"This parameter should not be entered here. Please use label "
"editbox (Include dialog) or insert->caption (listings inset)"));
- all_params_["nolol"] =
+ all_params_["nolol"] =
ListingsParam("", false, TRUEFALSE, "", empty_hint);
- all_params_["captionpos"] =
+ all_params_["captionpos"] =
ListingsParam("", false, SUBSETOF, "tb", empty_hint);
- all_params_["abovecaptionskip"] =
+ all_params_["abovecaptionskip"] =
ListingsParam("", false, LENGTH, "", empty_hint);
- all_params_["belowcaptionskip"] =
+ all_params_["belowcaptionskip"] =
ListingsParam("", false, LENGTH, "", empty_hint);
- all_params_["linewidth"] =
+ all_params_["linewidth"] =
ListingsParam("", false, LENGTH, "", empty_hint);
- all_params_["xleftmargin"] =
+ all_params_["xleftmargin"] =
ListingsParam("", false, LENGTH, "", empty_hint);
- all_params_["xrightmargin"] =
+ all_params_["xrightmargin"] =
ListingsParam("", false, LENGTH, "", empty_hint);
- all_params_["resetmargins"] =
+ all_params_["resetmargins"] =
ListingsParam("", false, TRUEFALSE, "", empty_hint);
- all_params_["breaklines"] =
+ all_params_["breaklines"] =
ListingsParam("", false, TRUEFALSE, "", empty_hint);
- all_params_["prebreak"] =
+ all_params_["prebreak"] =
ListingsParam("", false, ALL, "", empty_hint);
- all_params_["postbreak"] =
+ all_params_["postbreak"] =
ListingsParam("", false, ALL, "", empty_hint);
- all_params_["breakindent"] =
+ all_params_["breakindent"] =
ListingsParam("", false, LENGTH, "", empty_hint);
- all_params_["breakautoindent"] =
+ all_params_["breakautoindent"] =
ListingsParam("", false, TRUEFALSE, "", empty_hint);
- all_params_["frame"] =
+ all_params_["frame"] =
ListingsParam("", false, ALL, "", frame_hint);
- all_params_["frameround"] =
+ all_params_["frameround"] =
ListingsParam("", false, SUBSETOF, "tf", frameround_hint);
- all_params_["framesep"] =
+ all_params_["framesep"] =
ListingsParam("", false, LENGTH, "", empty_hint);
- all_params_["rulesep"] =
+ all_params_["rulesep"] =
ListingsParam("", false, LENGTH, "", empty_hint);
- all_params_["framerule"] =
+ all_params_["framerule"] =
ListingsParam("", false, LENGTH, "", empty_hint);
- all_params_["framexleftmargin"] =
+ all_params_["framexleftmargin"] =
ListingsParam("", false, LENGTH, "", empty_hint);
- all_params_["framexrightmargin"] =
+ all_params_["framexrightmargin"] =
ListingsParam("", false, LENGTH, "", empty_hint);
- all_params_["framextopmargin"] =
+ all_params_["framextopmargin"] =
ListingsParam("", false, LENGTH, "", empty_hint);
- all_params_["framexbottommargin"] =
+ all_params_["framexbottommargin"] =
ListingsParam("", false, LENGTH, "", empty_hint);
- all_params_["backgroundcolor"] =
+ all_params_["backgroundcolor"] =
ListingsParam("", false, ALL, "", color_hint );
- all_params_["rulecolor"] =
+ all_params_["rulecolor"] =
ListingsParam("", false, ALL, "", color_hint );
- all_params_["fillcolor"] =
+ all_params_["fillcolor"] =
ListingsParam("", false, ALL, "", color_hint );
- all_params_["rulesepcolor"] =
+ all_params_["rulesepcolor"] =
ListingsParam("", false, ALL, "", color_hint );
- all_params_["frameshape"] =
+ all_params_["frameshape"] =
ListingsParam("", false, ALL, "", empty_hint);
- all_params_["index"] =
+ all_params_["index"] =
ListingsParam("", false, ALL, "", empty_hint);
- all_params_["moreindex"] =
+ all_params_["moreindex"] =
ListingsParam("", false, ALL, "", empty_hint);
- all_params_["deleteindex"] =
+ all_params_["deleteindex"] =
ListingsParam("", false, ALL, "", empty_hint);
- all_params_["indexstyle"] =
+ all_params_["indexstyle"] =
ListingsParam("", false, ALL, "", empty_hint);
- all_params_["columns"] =
+ all_params_["columns"] =
ListingsParam("", false, ALL, "", empty_hint);
- all_params_["flexiblecolumns"] =
+ all_params_["flexiblecolumns"] =
ListingsParam("", false, ALL, "", empty_hint);
- all_params_["keepspaces"] =
+ all_params_["keepspaces"] =
ListingsParam("", false, TRUEFALSE, "", empty_hint);
- all_params_["basewidth"] =
+ all_params_["basewidth"] =
ListingsParam("", false, LENGTH, "", empty_hint);
- all_params_["fontadjust"] =
+ all_params_["fontadjust"] =
ListingsParam("", true, TRUEFALSE, "", empty_hint);
- all_params_["texcl"] =
+ all_params_["texcl"] =
ListingsParam("", false, TRUEFALSE, "", empty_hint);
- all_params_["mathescape"] =
+ all_params_["mathescape"] =
ListingsParam("", false, TRUEFALSE, "", empty_hint);
- all_params_["escapechar"] =
+ all_params_["escapechar"] =
ListingsParam("", false, ALL, "", empty_hint);
- all_params_["escapeinside"] =
+ all_params_["escapeinside"] =
ListingsParam("", false, ALL, "", empty_hint);
- all_params_["escepeinside"] =
+ all_params_["escepeinside"] =
ListingsParam("", false, ALL, "", empty_hint);
- all_params_["escepebegin"] =
+ all_params_["escepebegin"] =
ListingsParam("", false, ALL, "", empty_hint);
- all_params_["escepeend"] =
+ all_params_["escepeend"] =
ListingsParam("", false, ALL, "", empty_hint);
- all_params_["fancyvrb"] =
+ all_params_["fancyvrb"] =
ListingsParam("", false, TRUEFALSE, "", empty_hint);
- all_params_["fvcmdparams"] =
+ all_params_["fvcmdparams"] =
ListingsParam("", false, ALL, "", empty_hint);
- all_params_["morefvcmdparams"] =
+ all_params_["morefvcmdparams"] =
ListingsParam("", false, ALL, "", empty_hint);
- all_params_["keywordsprefix"] =
+ all_params_["keywordsprefix"] =
ListingsParam("", false, ALL, "", empty_hint);
- all_params_["keywords"] =
+ all_params_["keywords"] =
ListingsParam("", false, ALL, "", empty_hint);
- all_params_["morekeywords"] =
+ all_params_["morekeywords"] =
ListingsParam("", false, ALL, "", empty_hint);
- all_params_["deletekeywords"] =
+ all_params_["deletekeywords"] =
ListingsParam("", false, ALL, "", empty_hint);
- all_params_["ndkeywords"] =
+ all_params_["ndkeywords"] =
ListingsParam("", false, ALL, "", empty_hint);
- all_params_["morendkeywords"] =
+ all_params_["morendkeywords"] =
ListingsParam("", false, ALL, "", empty_hint);
- all_params_["deletendkeywords"] =
+ all_params_["deletendkeywords"] =
ListingsParam("", false, ALL, "", empty_hint);
- all_params_["texcs"] =
+ all_params_["texcs"] =
ListingsParam("", false, ALL, "", empty_hint);
- all_params_["moretexcs"] =
+ all_params_["moretexcs"] =
ListingsParam("", false, ALL, "", empty_hint);
- all_params_["deletetexcs"] =
+ all_params_["deletetexcs"] =
ListingsParam("", false, ALL, "", empty_hint);
- all_params_["directives"] =
+ all_params_["directives"] =
ListingsParam("", false, ALL, "", empty_hint);
- all_params_["moredirectives"] =
+ all_params_["moredirectives"] =
ListingsParam("", false, ALL, "", empty_hint);
- all_params_["deletedirectives"] =
+ all_params_["deletedirectives"] =
ListingsParam("", false, ALL, "", empty_hint);
- all_params_["sensitive"] =
+ all_params_["sensitive"] =
ListingsParam("", false, ALL, "", empty_hint);
- all_params_["alsoletter"] =
+ all_params_["alsoletter"] =
ListingsParam("", false, ALL, "", empty_hint);
- all_params_["alsodigit"] =
+ all_params_["alsodigit"] =
ListingsParam("", false, ALL, "", empty_hint);
- all_params_["alsoother"] =
+ all_params_["alsoother"] =
ListingsParam("", false, ALL, "", empty_hint);
- all_params_["otherkeywords"] =
+ all_params_["otherkeywords"] =
ListingsParam("", false, ALL, "", empty_hint);
- all_params_["tag"] =
+ all_params_["tag"] =
ListingsParam("", false, ALL, "", empty_hint);
- all_params_["string"] =
+ all_params_["string"] =
ListingsParam("", false, ALL, "", empty_hint);
- all_params_["morestring"] =
+ all_params_["morestring"] =
ListingsParam("", false, ALL, "", empty_hint);
- all_params_["deletestring"] =
+ all_params_["deletestring"] =
ListingsParam("", false, ALL, "", empty_hint);
- all_params_["comment"] =
+ all_params_["comment"] =
ListingsParam("", false, ALL, "", empty_hint);
- all_params_["morecomment"] =
+ all_params_["morecomment"] =
ListingsParam("", false, ALL, "", empty_hint);
- all_params_["deletecomment"] =
+ all_params_["deletecomment"] =
ListingsParam("", false, ALL, "", empty_hint);
- all_params_["keywordcomment"] =
+ all_params_["keywordcomment"] =
ListingsParam("", false, ALL, "", empty_hint);
- all_params_["morekeywordcomment"] =
+ all_params_["morekeywordcomment"] =
ListingsParam("", false, ALL, "", empty_hint);
- all_params_["deletekeywordcomment"] =
+ all_params_["deletekeywordcomment"] =
ListingsParam("", false, ALL, "", empty_hint);
- all_params_["keywordcommentsemicolon"] =
+ all_params_["keywordcommentsemicolon"] =
ListingsParam("", false, ALL, "", empty_hint);
- all_params_["podcomment"] =
+ all_params_["podcomment"] =
ListingsParam("", false, ALL, "", empty_hint);
ListingsParams::const_iterator it = all_params_.begin();
void InsetListingsParams::addParam(string const & key, string const & value)
-{
+{
if (key.empty())
return;
// if the parameter is surrounded with {}, good
else if (prefixIs(value, "{") && suffixIs(value, "}"))
params_[key] = value;
- // otherwise, check if {} is needed. Add {} to all values with
+ // otherwise, check if {} is needed. Add {} to all values with
// non-ascii/number characters, just to be safe
else {
bool has_special_char = false;
continue;
} else if (par[i] == '{' && par[i - 1] == '=')
braces ++;
- else if (par[i] == '}'
+ else if (par[i] == '}'
&& (i == par.size() - 1 || par[i + 1] == ',' || par[i + 1] == '\n'))
braces --;
-
+
if (isValue)
value += par[i];
else
string InsetListingsParams::encodedString() const
{
// Encode string!
- // '"' is handled differently because it will
+ // '"' is handled differently because it will
// terminate a lyx token.
string par = params();
// '"' is now " ==> '"' is now &quot;
par = subst(par, "&", "&");
// '"' is now &quot; ==> '"' is now &quot;
par = subst(par, "\"", """);
- return par;
+ return par;
}
/// valid parameter string
std::string params(std::string const & sep=",") const;
-
+
/// add key=value to params_
void addParam(std::string const & key, std::string const & value);
/// add a few parameters
void addParams(std::string const & par);
-
+
/// set params_ with par, throw an exception if par is valid
void setParams(std::string const & par);
/// get parameter from encoded string
void fromEncodedString(std::string const & par);
- ///
+ ///
bool isInline() const { return inline_; }
///
/// inline or normal listings
bool inline_;
- /// key-value pairs of the parameters
+ /// key-value pairs of the parameters
std::map<std::string, std::string> params_;
/// collapsable status
int InsetMarginal::latex(Buffer const & buf, odocstream & os,
- OutputParams const & runparams) const
+ OutputParams const & runparams) const
{
os << "%\n\\marginpar{";
int const i = InsetText::latex(buf, os, runparams);
int InsetMarginal::plaintext(Buffer const & buf, odocstream & os,
- OutputParams const & runparams) const
+ OutputParams const & runparams) const
{
os << '[' << buf.B_("margin") << ":\n";
InsetText::plaintext(buf, os, runparams);
int InsetMarginal::docbook(Buffer const & buf, odocstream & os,
- OutputParams const & runparams) const
+ OutputParams const & runparams) const
{
os << "<note role=\"margin\">";
int const i = InsetText::docbook(buf, os, runparams);
docstring name() const { return from_ascii("Marginal"); }
///
int latex(Buffer const &, odocstream &,
- OutputParams const &) const;
+ OutputParams const &) const;
///
int plaintext(Buffer const &, odocstream &,
- OutputParams const & runparams) const;
+ OutputParams const & runparams) const;
///
int docbook(Buffer const &, odocstream &,
- OutputParams const & runparams) const;
+ OutputParams const & runparams) const;
///
virtual docstring const editMessage() const;
protected:
int InsetNewline::plaintext(Buffer const &, odocstream & os,
- OutputParams const &) const
+ OutputParams const &) const
{
os << '\n';
return PLAINTEXT_NEWLINE;
newlines += static_cast<InsetNomencl const &>(*it).docbookGlossary(os);
++it;
} else if(it->lyxCode() == Inset::NOTE_CODE &&
- static_cast<InsetNote const &>(*it).params().type == InsetNoteParams::Note) {
+ static_cast<InsetNote const &>(*it).params().type == InsetNoteParams::Note) {
// Don't output anything nested in note insets
size_t const depth = it.depth();
++it;
int InsetNote::plaintext(Buffer const & buf, odocstream & os,
- OutputParams const & runparams_in) const
+ OutputParams const & runparams_in) const
{
if (params_.type == InsetNoteParams::Note)
return 0;
int InsetNote::docbook(Buffer const & buf, odocstream & os,
- OutputParams const & runparams_in) const
+ OutputParams const & runparams_in) const
{
if (params_.type == InsetNoteParams::Note)
return 0;
// Return how many newlines we issued.
//return int(count(str.begin(), str.end(), '\n'));
- return n + 1 + 2;
+ return n + 1 + 2;
}
int InsetOptArg::latex(Buffer const &, odocstream &,
- OutputParams const &) const
+ OutputParams const &) const
{
return 0;
}
int InsetOptArg::plaintext(Buffer const &, odocstream &,
- OutputParams const &) const
+ OutputParams const &) const
{
return 0; // do not output optional arguments
}
int InsetOptArg::docbook(Buffer const &, odocstream &,
- OutputParams const &) const
+ OutputParams const &) const
{
return 0;
}
/// Standard LaTeX output -- short-circuited
int latex(Buffer const &, odocstream &,
- OutputParams const &) const;
+ OutputParams const &) const;
/// Standard plain text output -- short-circuited
int plaintext(Buffer const &, odocstream &,
- OutputParams const &) const;
+ OutputParams const &) const;
/// Standard DocBook output -- short-circuited
int docbook(Buffer const &, odocstream &,
- OutputParams const &) const;
+ OutputParams const &) const;
/// Outputting the optional parameter of a LaTeX command
int latexOptional(Buffer const &, odocstream &,
int InsetPagebreak::latex(Buffer const &, odocstream & os,
- OutputParams const &) const
+ OutputParams const &) const
{
os << from_ascii(getCmdName()) << "{}";
return 0;
int InsetPagebreak::plaintext(Buffer const &, odocstream & os,
- OutputParams const &) const
+ OutputParams const &) const
{
os << '\n';
return PLAINTEXT_NEWLINE;
int InsetPagebreak::docbook(Buffer const &, odocstream & os,
- OutputParams const &) const
+ OutputParams const &) const
{
os << '\n';
return 0;
void draw(PainterInfo & pi, int x, int y) const;
int latex(Buffer const &, odocstream &,
- OutputParams const &) const;
+ OutputParams const &) const;
int plaintext(Buffer const &, odocstream &,
- OutputParams const &) const;
+ OutputParams const &) const;
int docbook(Buffer const &, odocstream &,
- OutputParams const &) const;
+ OutputParams const &) const;
void read(Buffer const &, Lexer & lex);
InsetClearPage() {}
docstring insetLabel() const { return _("Clear Page"); }
-
+
std::string getCmdName() const { return "\\clearpage"; }
private:
InsetClearDoublePage() {}
docstring insetLabel() const { return _("Clear Double Page"); }
-
+
std::string getCmdName() const { return "\\cleardoublepage"; }
private:
#endif
else
retdisp = lyx::from_ascii(disp);
-
+
// in french, spaces are added inside double quotes
if (times_ == DoubleQ && prefixIs(loclang->code(), "fr")) {
if (side_ == LeftQ)
int InsetQuotes::latex(Buffer const &, odocstream & os,
- OutputParams const & runparams) const
+ OutputParams const & runparams) const
{
const int quoteind = quote_index[side_][language_];
string qstr;
int InsetQuotes::plaintext(Buffer const & buf, odocstream & os,
- OutputParams const &) const
+ OutputParams const &) const
{
docstring const str = dispString(buf.params().language);
os << str;
int InsetQuotes::docbook(Buffer const &, odocstream & os,
- OutputParams const &) const
+ OutputParams const &) const
{
if (times_ == DoubleQ) {
if (side_ == LeftQ)
case LFUN_MOUSE_RELEASE:
// Eventually trigger dialog with button 3 not 1
if (cmd.button() == mouse_button::button3)
- lyx::dispatch(FuncRequest(LFUN_LABEL_GOTO,
+ lyx::dispatch(FuncRequest(LFUN_LABEL_GOTO,
getParam("reference")));
- else
+ else
InsetCommand::doDispatch(cur, cmd);
break;
int InsetRef::latex(Buffer const &, odocstream & os,
- OutputParams const &) const
+ OutputParams const &) const
{
// Don't output p_["name"], this is only used in docbook
InsetCommandParams p(getCmdName());
int InsetRef::plaintext(Buffer const &, odocstream & os,
- OutputParams const &) const
+ OutputParams const &) const
{
docstring const str = getParam("reference");
os << '[' << str << ']';
int InsetRef::docbook(Buffer const & buf, odocstream & os,
- OutputParams const & runparams) const
+ OutputParams const & runparams) const
{
docstring const & name = getParam("name");
if (name.empty()) {
if (runparams.flavor == OutputParams::XML) {
- os << "<xref linkend=\""
- << sgml::cleanID(buf, runparams, getParam("reference"))
+ os << "<xref linkend=\""
+ << sgml::cleanID(buf, runparams, getParam("reference"))
<< "\" />";
} else {
- os << "<xref linkend=\""
- << sgml::cleanID(buf, runparams, getParam("reference"))
+ os << "<xref linkend=\""
+ << sgml::cleanID(buf, runparams, getParam("reference"))
<< "\">";
}
} else {
- os << "<link linkend=\""
+ os << "<link linkend=\""
<< sgml::cleanID(buf, runparams, getParam("reference"))
- << "\">"
+ << "\">"
<< getParam("name")
<< "</link>";
}
switch (kind_) {
case THIN:
case NEGTHIN:
- dim.wid = fm.width(char_type('x')) / 3;
+ dim.wid = fm.width(char_type('x')) / 3;
break;
case PROTECTED:
case NORMAL:
- dim.wid = fm.width(char_type('x'));
+ dim.wid = fm.width(char_type('x'));
break;
case QUAD:
dim.wid = 20;
int InsetSpace::latex(Buffer const &, odocstream & os,
- OutputParams const & runparams) const
+ OutputParams const & runparams) const
{
switch (kind_) {
case NORMAL:
int InsetSpace::plaintext(Buffer const &, odocstream & os,
- OutputParams const &) const
+ OutputParams const &) const
{
os << ' ';
return 1;
int InsetSpace::docbook(Buffer const &, odocstream & os,
- OutputParams const &) const
+ OutputParams const &) const
{
switch (kind_) {
case NORMAL:
void read(Buffer const &, Lexer & lex);
///
int latex(Buffer const &, odocstream &,
- OutputParams const &) const;
+ OutputParams const &) const;
///
int plaintext(Buffer const &, odocstream &,
- OutputParams const &) const;
+ OutputParams const &) const;
///
int docbook(Buffer const &, odocstream &,
- OutputParams const &) const;
+ OutputParams const &) const;
/// the string that is passed to the TOC
virtual int textString(Buffer const &, odocstream &,
OutputParams const &) const;
case MENU_SEPARATOR: s = " x "; break;
case HYPHENATION: s = "-"; break;
}
- docstring ds(s.begin(), s.end());
+ docstring ds(s.begin(), s.end());
dim.wid = fm.width(ds);
if (kind_ == HYPHENATION && dim.wid > 5)
dim.wid -= 2; // to make it look shorter
case LDOTS:
{
font.setColor(Color::special);
- string ell = ". . . ";
- docstring dell(ell.begin(), ell.end());
+ string ell = ". . . ";
+ docstring dell(ell.begin(), ell.end());
pi.pain.text(x, y, dell, font);
break;
}
theFontMetrics(font);
// A triangle the width and height of an 'x'
- int w = fm.width(char_type('x'));
+ int w = fm.width(char_type('x'));
int ox = fm.width(char_type(' ')) + x;
int h = fm.ascent(char_type('x'));
int xp[4], yp[4];
int InsetSpecialChar::plaintext(Buffer const &, odocstream & os,
- OutputParams const &) const
+ OutputParams const &) const
{
switch (kind_) {
case HYPHENATION:
int InsetSpecialChar::docbook(Buffer const &, odocstream & os,
- OutputParams const &) const
+ OutputParams const &) const
{
switch (kind_) {
case HYPHENATION:
void read(Buffer const &, Lexer & lex);
///
int latex(Buffer const &, odocstream &,
- OutputParams const &) const;
+ OutputParams const &) const;
///
int plaintext(Buffer const &, odocstream &,
- OutputParams const &) const;
+ OutputParams const &) const;
///
int docbook(Buffer const &, odocstream &,
- OutputParams const &) const;
+ OutputParams const &) const;
/// the string that is passed to the TOC
virtual int textString(Buffer const &, odocstream &,
OutputParams const &) const;
int InsetTOC::plaintext(Buffer const & buffer, odocstream & os,
- OutputParams const &) const
+ OutputParams const &) const
{
os << getScreenLabel(buffer) << "\n\n";
int InsetTOC::docbook(Buffer const &, odocstream & os,
- OutputParams const &) const
+ OutputParams const &) const
{
if (getCmdName() == "tableofcontents")
os << "<toc></toc>";
DisplayType display() const { return AlignCenter; }
///
int plaintext(Buffer const &, odocstream &,
- OutputParams const &) const;
+ OutputParams const &) const;
///
int docbook(Buffer const &, odocstream &,
- OutputParams const &) const;
+ OutputParams const &) const;
private:
virtual std::auto_ptr<Inset> doClone() const;
};
getTokenValue(line, "topline", row_info[i].top_line);
getTokenValue(line, "bottomline", row_info[i].bottom_line);
getTokenValue(line, "topspace", row_info[i].top_space,
- row_info[i].top_space_default);
+ row_info[i].top_space_default);
getTokenValue(line, "bottomspace", row_info[i].bottom_space,
- row_info[i].bottom_space_default);
+ row_info[i].bottom_space_default);
getTokenValue(line, "interlinespace", row_info[i].interline_space,
- row_info[i].interline_space_default);
+ row_info[i].interline_space_default);
getTokenValue(line, "endfirsthead", row_info[i].endfirsthead);
getTokenValue(line, "endhead", row_info[i].endhead);
getTokenValue(line, "endfoot", row_info[i].endfoot);
}
++ret;
}
-
+
for (col_type j = 0; j < columns_; ++j) {
if (isPartOfMultiColumn(i, j))
continue;
bool Tabular::plaintextTopHLine(odocstream & os, row_type row,
- vector<unsigned int> const & clen) const
+ vector<unsigned int> const & clen) const
{
idx_type const fcell = getFirstCellInRow(row);
idx_type const n = numberOfCellsInRow(fcell) + fcell;
bool Tabular::plaintextBottomHLine(odocstream & os, row_type row,
- vector<unsigned int> const & clen) const
+ vector<unsigned int> const & clen) const
{
idx_type const fcell = getFirstCellInRow(row);
idx_type const n = numberOfCellsInRow(fcell) + fcell;
void Tabular::plaintext(Buffer const & buf, odocstream & os,
- OutputParams const & runparams, int const depth,
- bool onlydata, unsigned char delim) const
+ OutputParams const & runparams, int const depth,
+ bool onlydata, unsigned char delim) const
{
// first calculate the width of the single columns
vector<unsigned int> clen(columns_);
if (onlydata && j > 0)
os << delim;
plaintextPrintCell(buf, os, runparams,
- cell, i, j, clen, onlydata);
+ cell, i, j, clen, onlydata);
++cell;
}
os << endl;
case LFUN_MOUSE_PRESS:
//lyxerr << "# InsetTabular::MousePress\n" << cur.bv().cursor() << endl;
- if (cmd.button() == mouse_button::button1
- || (cmd.button() == mouse_button::button3
+ if (cmd.button() == mouse_button::button1
+ || (cmd.button() == mouse_button::button3
&& (&bvcur.selBegin().inset() != this || !tablemode(bvcur)))) {
if (!bvcur.selection() && !cur.bv().mouseSetCursor(cur))
cur.noUpdate();
cmd = FuncRequest(LFUN_PASTE, "0");
} else {
cmd = FuncRequest(LFUN_PRIMARY_SELECTION_PASTE,
- "paragraph");
+ "paragraph");
}
doDispatch(cur, cmd);
}
case Tabular::TOGGLE_ROTATE_CELL:
case Tabular::SET_ROTATE_CELL:
- status.setOnOff(!oneCellHasRotationState(false,
+ status.setOnOff(!oneCellHasRotationState(false,
sel_row_start, sel_row_end, sel_col_start, sel_col_end));
break;
case Tabular::UNSET_ROTATE_CELL:
- status.setOnOff(!oneCellHasRotationState(true,
+ status.setOnOff(!oneCellHasRotationState(true,
sel_row_start, sel_row_end, sel_col_start, sel_col_end));
break;
int InsetTabular::latex(Buffer const & buf, odocstream & os,
- OutputParams const & runparams) const
+ OutputParams const & runparams) const
{
return tabular.latex(buf, os, runparams);
}
int InsetTabular::plaintext(Buffer const & buf, odocstream & os,
- OutputParams const & runparams) const
+ OutputParams const & runparams) const
{
os << '\n'; // output table on a new line
int const dp = runparams.linelen > 0 ? runparams.depth : 0;
int InsetTabular::docbook(Buffer const & buf, odocstream & os,
- OutputParams const & runparams) const
+ OutputParams const & runparams) const
{
int ret = 0;
Inset * master = 0;
if (tmp == what.substr(0, tmp.length())) {
//if (!compare(tabularFeatures[i].feature.c_str(), what.c_str(),
- //tabularFeatures[i].feature.length()))
+ //tabularFeatures[i].feature.length()))
action = tabularFeature[i].action;
break;
}
}
bool InsetTabular::oneCellHasRotationState(bool rotated,
- row_type row_start, row_type row_end,
+ row_type row_start, row_type row_end,
col_type col_start, col_type col_end) const {
for (row_type i = row_start; i <= row_end; ++i) {
for (col_type j = col_start; j <= col_end; ++j) {
- if (tabular.getRotateCell(tabular.getCellNumber(i, j))
+ if (tabular.getRotateCell(tabular.getCellNumber(i, j))
== rotated) {
return true;
}
{
bool oneNotRotated = oneCellHasRotationState(false,
sel_row_start, sel_row_end, sel_col_start, sel_col_end);
-
+
for (row_type i = sel_row_start; i <= sel_row_end; ++i)
for (col_type j = sel_col_start; j <= sel_col_end; ++j)
- tabular.setRotateCell(tabular.getCellNumber(i, j),
+ tabular.setRotateCell(tabular.getCellNumber(i, j),
oneNotRotated);
}
break;
tabular.setCellInset(r2, c2, inset);
// FIXME: change tracking (MG)
inset->setChange(Change(cur.buffer().params().trackChanges ?
- Change::INSERTED : Change::UNCHANGED));
+ Change::INSERTED : Change::UNCHANGED));
cur.pos() = 0;
}
}
Paragraph & par = inset->text_.getPar(0);
Font const font = inset->text_.getFont(buffer, par, 0);
inset->setText(buf.substr(op, p - op), font,
- buffer.params().trackChanges);
+ buffer.params().trackChanges);
++cols;
++cell;
}
Paragraph & par = inset->text_.getPar(0);
Font const font = inset->text_.getFont(buffer, par, 0);
inset->setText(buf.substr(op, p - op), font,
- buffer.params().trackChanges);
+ buffer.params().trackChanges);
}
cols = ocol;
++row;
//
// A helper struct for tables
-//
+//
class Tabular {
public:
///
int docbook(Buffer const & buf, odocstream & os, OutputParams const &) const;
///
void plaintext(Buffer const &, odocstream &,
- OutputParams const & runparams, int const depth,
- bool onlydata, unsigned char delim) const;
+ OutputParams const & runparams, int const depth,
+ bool onlydata, unsigned char delim) const;
///
bool isMultiColumn(idx_type cell) const;
///
// helper functions for plain text
///
bool plaintextTopHLine(odocstream &, row_type row,
- std::vector<unsigned int> const &) const;
+ std::vector<unsigned int> const &) const;
///
bool plaintextBottomHLine(odocstream &, row_type row,
- std::vector<unsigned int> const &) const;
+ std::vector<unsigned int> const &) const;
///
void plaintextPrintCell(Buffer const &, odocstream &,
- OutputParams const &,
- idx_type cell, row_type row, col_type column,
- std::vector<unsigned int> const &,
- bool onlydata) const;
+ OutputParams const &,
+ idx_type cell, row_type row, col_type column,
+ std::vector<unsigned int> const &,
+ bool onlydata) const;
/// auxiliary function for docbook
int docbookRow(Buffer const & buf, odocstream & os, row_type,
OutputParams const &) const;
DisplayType display() const { return tabular.isLongTabular() ? AlignCenter : Inline; }
///
int latex(Buffer const &, odocstream &,
- OutputParams const &) const;
+ OutputParams const &) const;
///
int plaintext(Buffer const &, odocstream &,
- OutputParams const &) const;
+ OutputParams const &) const;
///
int docbook(Buffer const &, odocstream &,
- OutputParams const &) const;
+ OutputParams const &) const;
///
void validate(LaTeXFeatures & features) const;
///
/// test the rotation state of the give cell range.
bool oneCellHasRotationState(bool rotated,
- row_type row_start, row_type row_end,
+ row_type row_start, row_type row_end,
col_type col_start, col_type col_end) const;
///
Buffer const * buffer_;
int InsetText::latex(Buffer const & buf, odocstream & os,
- OutputParams const & runparams) const
+ OutputParams const & runparams) const
{
TexRow texrow;
latexParagraphs(buf, paragraphs(), os, texrow, runparams);
int InsetText::plaintext(Buffer const & buf, odocstream & os,
- OutputParams const & runparams) const
+ OutputParams const & runparams) const
{
ParagraphList::const_iterator beg = paragraphs().begin();
ParagraphList::const_iterator end = paragraphs().end();
int InsetText::docbook(Buffer const & buf, odocstream & os,
- OutputParams const & runparams) const
+ OutputParams const & runparams) const
{
docbookParagraphs(paragraphs(), buf, os, runparams);
return 0;
std::distance(pl.begin(), ins) - 1);
for_each(pit, plist.end(),
- bind(&ParagraphList::push_back, ref(pl), _1));
+ bind(&ParagraphList::push_back, ref(pl), _1));
}
int InsetUrl::latex(Buffer const &, odocstream & os,
- OutputParams const & runparams) const
+ OutputParams const & runparams) const
{
docstring const & name = getParam("name");
if (!name.empty())
int InsetUrl::plaintext(Buffer const &, odocstream & os,
- OutputParams const &) const
+ OutputParams const &) const
{
odocstringstream oss;
int InsetUrl::docbook(Buffer const &, odocstream & os,
- OutputParams const &) const
+ OutputParams const &) const
{
- os << "<ulink url=\""
+ os << "<ulink url=\""
<< subst(getParam("target"), from_ascii("&"), from_ascii("&"))
- << "\">"
+ << "\">"
<< getParam("name")
<< "</ulink>";
return 0;
DisplayType display() const { return Inline; }
///
int latex(Buffer const &, odocstream &,
- OutputParams const &) const;
+ OutputParams const &) const;
///
int plaintext(Buffer const &, odocstream &,
- OutputParams const &) const;
+ OutputParams const &) const;
///
int docbook(Buffer const &, odocstream &,
- OutputParams const &) const;
+ OutputParams const &) const;
/// the string that is passed to the TOC
virtual int textString(Buffer const &, odocstream &,
OutputParams const &) const;
int InsetVSpace::latex(Buffer const & buf, odocstream & os,
- OutputParams const &) const
+ OutputParams const &) const
{
os << from_ascii(space_.asLatexCommand(buf.params())) << '\n';
return 1;
int InsetVSpace::plaintext(Buffer const &, odocstream & os,
- OutputParams const &) const
+ OutputParams const &) const
{
os << "\n\n";
return PLAINTEXT_NEWLINE;
int InsetVSpace::docbook(Buffer const &, odocstream & os,
- OutputParams const &) const
+ OutputParams const &) const
{
os << '\n';
return 1;
void draw(PainterInfo & pi, int x, int y) const;
///
int latex(Buffer const &, odocstream &,
- OutputParams const &) const;
+ OutputParams const &) const;
///
int plaintext(Buffer const &, odocstream &,
- OutputParams const &) const;
+ OutputParams const &) const;
///
int docbook(Buffer const &, odocstream &,
- OutputParams const &) const;
+ OutputParams const &) const;
///
void read(Buffer const &, Lexer & lex);
///
int InsetWrap::latex(Buffer const & buf, odocstream & os,
- OutputParams const & runparams) const
+ OutputParams const & runparams) const
{
os << "\\begin{floating" << from_ascii(params_.type) << '}';
if (!params_.placement.empty())
int InsetWrap::plaintext(Buffer const & buf, odocstream & os,
- OutputParams const & runparams) const
+ OutputParams const & runparams) const
{
os << '[' << buf.B_("wrap") << ' ' << floatName(params_.type, buf.params()) << ":\n";
InsetText::plaintext(buf, os, runparams);
int InsetWrap::docbook(Buffer const & buf, odocstream & os,
- OutputParams const & runparams) const
+ OutputParams const & runparams) const
{
- // FIXME UNICODE
- os << '<' << from_ascii(params_.type) << '>';
+ // FIXME UNICODE
+ os << '<' << from_ascii(params_.type) << '>';
int const i = InsetText::docbook(buf, os, runparams);
os << "</" << from_ascii(params_.type) << '>';
return i;
Inset::Code lyxCode() const { return Inset::WRAP_CODE; }
///
int latex(Buffer const &, odocstream &,
- OutputParams const &) const;
+ OutputParams const &) const;
///
int plaintext(Buffer const &, odocstream &,
- OutputParams const &) const;
+ OutputParams const &) const;
///
int docbook(Buffer const &, odocstream &,
- OutputParams const &) const;
+ OutputParams const &) const;
///
virtual docstring const editMessage() const;
///
/// render state, exact meaning of state is render-specific
void setRenderState(int state) { state_ = state; }
/// get render state
- int renderState() const { return state_; }
+ int renderState() const { return state_; }
/// equivalent to dynamic_cast
virtual RenderButton * asButton() { return 0; }
font.decSize();
frontend::FontMetrics const & fm =
theFontMetrics(font);
-
+
if (editable_)
fm.buttonText(text_, dim.wid, dim.asc, dim.des);
else
msgFont.setFamily(Font::SANS_FAMILY);
// FIXME UNICODE
- docstring const justname =
+ docstring const justname =
from_utf8(onlyFilename(params_.filename.absFilename()));
if (!justname.empty()) {
msgFont.setSize(Font::SIZE_FOOTNOTE);
{
if (str.empty()) {
frontend::Alert::error(_("Search error"),
- _("Search string is empty"));
+ _("Search string is empty"));
return false;
}
return bv->buffer();
int striked = ssize - cur.paragraph().eraseChars(pos, pos + ssize,
buf.params().trackChanges);
cur.paragraph().insert(pos, replacestr, font,
- Change(buf.params().trackChanges ?
- Change::INSERTED : Change::UNCHANGED));
+ Change(buf.params().trackChanges ?
+ Change::INSERTED : Change::UNCHANGED));
for (int i = 0; i < rsize + striked; ++i)
cur.forwardChar();
++num;
}
// avoid crash (assertion violation) if the imaginary end-of-par
- // character of the last paragraph of the document is marked as changed
+ // character of the last paragraph of the document is marked as changed
if (cur == et) {
cur = ok;
}
int InsetFormulaMacro::latex(Buffer const &, odocstream & os,
- OutputParams const & runparams) const
+ OutputParams const & runparams) const
{
//lyxerr << "InsetFormulaMacro::latex" << endl;
WriteStream wi(os, runparams.moving_arg, true);
int InsetFormulaMacro::plaintext(Buffer const &, odocstream & os,
- OutputParams const &) const
+ OutputParams const &) const
{
odocstringstream oss;
WriteStream wi(oss, false, true);
int InsetFormulaMacro::docbook(Buffer const & buf, ostream & os,
- OutputParams const & runparams) const
+ OutputParams const & runparams) const
{
return plaintext(buf, os, runparams);
}
void write(Buffer const &, std::ostream & os) const;
///
int latex(Buffer const &, odocstream & os,
- OutputParams const &) const;
+ OutputParams const &) const;
///
int plaintext(Buffer const &, odocstream &,
- OutputParams const &) const;
+ OutputParams const &) const;
///
int docbook(Buffer const &, odocstream &,
- OutputParams const &) const;
+ OutputParams const &) const;
///
std::auto_ptr<Inset> clone() const;
int InsetMath::plaintext(Buffer const &, odocstream &,
- OutputParams const &) const
+ OutputParams const &) const
{
// all math plain text output shall take place in InsetMathHull
BOOST_ASSERT(false);
void InsetMath::mathmlize(MathStream & os) const
{
- NormalStream ns(os.os());
- normalize(ns);
+ NormalStream ns(os.os());
+ normalize(ns);
}
/// plain text output in ucs4 encoding
int plaintext(Buffer const &, odocstream &,
- OutputParams const &) const;
+ OutputParams const &) const;
/// dump content to stderr for debugging
virtual void dump() const;
docstring const delim = (delim_ == "\\|") ? from_ascii("Vert") :
(delim_ == "\\\\") ? from_ascii("\\") : support::ltrim(delim_, "\\");
mathed_draw_deco(pi, x + 1, y - dim_.ascent(), 4, dim_.height(),
- delim);
+ delim);
setPosCache(pi, x, y);
}
{
if (name.size() == 1) {
char_type const c = name[0];
- if (c == '<' || c == '(' || c == '[' || c == '.'
+ if (c == '<' || c == '(' || c == '[' || c == '.'
|| c == '>' || c == ')' || c == ']' || c == '/' || c == '|')
return name;
}
int m = x + dim_.wid / 2;
FracChanger dummy(pi.base);
if (kind_ == NICEFRAC) {
- cell(0).draw(pi, x + 2,
+ cell(0).draw(pi, x + 2,
y - cell(0).descent() - 5);
cell(1).draw(pi, x + cell(0).width() + 5,
y + cell(1).ascent() / 2);
- pi.pain.line(x + cell(0).width(),
- y + dim_.des - 2,
- x + cell(0).width() + 5,
+ pi.pain.line(x + cell(0).width(),
+ y + dim_.des - 2,
+ x + cell(0).width() + 5,
y - dim_.asc + 2, Color::math);
} else {
- cell(0).draw(pi, m - cell(0).width() / 2,
+ cell(0).draw(pi, m - cell(0).width() / 2,
y - cell(0).descent() - 2 - 5);
cell(1).draw(pi, m - cell(1).width() / 2,
y + cell(1).ascent() + 2 - 5);
}
if (kind_ == FRAC || kind_ == OVER)
- pi.pain.line(x + 1, y - 5,
+ pi.pain.line(x + 1, y - 5,
x + dim_.wid - 2, y - 5, Color::math);
drawMarkers(pi, x, y);
}
// background of mathed under focus is not painted because
// selection at the top level of nested inset is difficult to handle.
if (!editing(pi.base.bv))
- pi.pain.fillRectangle(x + 1, y - ascent() + 1, width() - 2,
+ pi.pain.fillRectangle(x + 1, y - ascent() + 1, width() - 2,
ascent() + descent() - 1, Color::mathbg);
if (use_preview_) {
left ? idxFirst(cur) : idxLast(cur);
// The inset formula dimension is not necessarily the same as the
// one of the instant preview image, so we have to indicate to the
- // BufferView that a metrics update is needed.
+ // BufferView that a metrics update is needed.
cur.updateFlags(Update::Force);
}
int InsetMathHull::plaintext(Buffer const &, odocstream & os,
- OutputParams const &) const
+ OutputParams const &) const
{
if (0 && display()) {
Dimension dim;
int InsetMathHull::docbook(Buffer const & buf, odocstream & os,
- OutputParams const & runparams) const
+ OutputParams const & runparams) const
{
MathStream ms(os);
int res = 0;
void read(Buffer const &, Lexer & lex);
///
int plaintext(Buffer const &, odocstream &,
- OutputParams const &) const;
+ OutputParams const &) const;
///
int docbook(Buffer const &, odocstream &,
- OutputParams const &) const;
+ OutputParams const &) const;
/// the string that is passed to the TOC
virtual void textString(Buffer const &, odocstream &) const;
}
-bool InsetMathNest::script(Cursor & cur, bool up,
+bool InsetMathNest::script(Cursor & cur, bool up,
docstring const & save_selection)
{
// Hack to get \^ and \_ working
int InsetMathRef::docbook(Buffer const & buf, odocstream & os,
- OutputParams const & runparams) const
+ OutputParams const & runparams) const
{
if (cell(1).empty()) {
os << "<xref linkend=\""
else {
nuc().setXY(*pi.base.bv, x + dxx(), y);
if (editing(pi.base.bv))
- pi.draw(x + dxx(), y, char_type('.'));
+ pi.draw(x + dxx(), y, char_type('.'));
}
ScriptChanger dummy(pi.base);
if (hasUp())
/// is it being drawn?
bool locked() const { return lockCount_ != 0; }
///
- void unlock() const { --lockCount_; BOOST_ASSERT(lockCount_ >= 0); }
+ void unlock() const { --lockCount_; BOOST_ASSERT(lockCount_ >= 0); }
///
bool operator==(MacroData const & x) const {
}
///
bool operator!=(MacroData const & x) const { return !operator==(x); }
-
+
private:
///
docstring def_;
int sshift() const { return sshift_; }
/// superscript kerning
int kerning() const { return kerning_; }
- ///
+ ///
void swap(MathData & ar) { base_type::swap(ar); }
protected:
using std::vector;
-/// This class is the value of a macro argument, technically
+/// This class is the value of a macro argument, technically
/// a wrapper of the cells of MathMacro.
class MathMacroArgumentValue : public InsetMath {
public:
///
- MathMacroArgumentValue(MathMacro const & mathMacro, size_t idx)
+ MathMacroArgumentValue(MathMacro const & mathMacro, size_t idx)
: mathMacro_(mathMacro), idx_(idx) {}
///
bool metrics(MetricsInfo & mi, Dimension & dim) const;
///
void draw(PainterInfo &, int x, int y) const;
-
+
private:
std::auto_ptr<Inset> doClone() const;
MathMacro const & mathMacro_;
};
-auto_ptr<Inset> MathMacroArgumentValue::doClone() const
+auto_ptr<Inset> MathMacroArgumentValue::doClone() const
{
return auto_ptr<Inset>(new MathMacroArgumentValue(*this));
}
-bool MathMacroArgumentValue::metrics(MetricsInfo & mi, Dimension & dim) const
+bool MathMacroArgumentValue::metrics(MetricsInfo & mi, Dimension & dim) const
{
// unlock outer macro in arguments, and lock it again later
MacroData const & macro = MacroTable::globalMacros().get(mathMacro_.name());
}
-void MathMacroArgumentValue::draw(PainterInfo & pi, int x, int y) const
+void MathMacroArgumentValue::draw(PainterInfo & pi, int x, int y) const
{
// unlock outer macro in arguments, and lock it again later
MacroData const & macro = MacroTable::globalMacros().get(mathMacro_.name());
mathed_string_dim(mi.base.font, "Unknown: " + name(), dim);
} else {
MacroData const & macro = MacroTable::globalMacros().get(name());
-
+
if (macroBackup_ != macro)
updateExpansion();
-
+
if (macro.locked()) {
mathed_string_dim(mi.base.font, "Self reference: " + name(), dim);
} else if (editing(mi.base.bv)) {
drawStrRed(pi, x, y, "Unknown: " + name());
} else {
MacroData const & macro = MacroTable::globalMacros().get(name());
-
+
// warm up cache
for (size_t i = 0; i < nargs(); ++i)
cell(i).setXY(*pi.base.bv, x, y);
-
+
if (macro.locked()) {
// FIXME UNICODE
drawStrRed(pi, x, y, "Self reference: " + name());
expanded_.draw(pi, x, y);
macro.unlock();
}
-
- // edit mode changed?
+
+ // edit mode changed?
if (editing_ != editing(pi.base.bv) || macroBackup_ != macro)
pi.base.bv->cursor().updateFlags(Update::Force);
}
}
-bool MathMacro::idxFirst(Cursor & cur) const
+bool MathMacro::idxFirst(Cursor & cur) const
{
cur.updateFlags(Update::Force);
return InsetMathNest::idxFirst(cur);
}
-bool MathMacro::idxLast(Cursor & cur) const
+bool MathMacro::idxLast(Cursor & cur) const
{
cur.updateFlags(Update::Force);
return InsetMathNest::idxLast(cur);
void MathMacro::updateExpansion() const
{
MacroData const & macro = MacroTable::globalMacros().get(name());
-
+
// create MathMacroArgumentValue object pointing to the cells of the macro
vector<MathData> values(nargs());
- for (size_t i = 0; i != nargs(); ++i)
+ for (size_t i = 0; i != nargs(); ++i)
values[i].insert(0, MathAtom(new MathMacroArgumentValue(*this, i)));
macro.expand(values, expanded_);
asArray(macro.def(), tmpl_);
lyxerr << "MathMacroArgument::MathMacroArgument: wrong Argument id: "
<< n << endl;
}
- // The profiler tells us not to use
+ // The profiler tells us not to use
// str_ = '#' + convert<docstring>(n);
// so we do the conversion of n to ASCII manually.
// This works because 1 <= n <= 9.
+ theFontMetrics(mi.base.font).width(dp);
dim.asc = std::max(cell(0).ascent(), cell(1).ascent()) + 7;
dim.des = std::max(cell(0).descent(), cell(1).descent()) + 7;
-
+
if (lockMacro)
MacroTable::globalMacros().get(name_).unlock();
-
+
if (dim_ == dim)
return false;
dim_ = dim;
bool lockMacro = MacroTable::globalMacros().has(name_);
if (lockMacro)
MacroTable::globalMacros().get(name_).lock();
-
+
setPosCache(p, x, y);
// label
cell(1).draw(pi, x + 8 + w0, y + 1);
pi.pain.rectangle(x + w0 + 6, y - dim_.ascent() + 3,
w1 + 4, dim_.height() - 6, Color::mathline);
-
+
if (lockMacro)
MacroTable::globalMacros().get(name_).unlock();
}
int MathMacroTemplate::plaintext(Buffer const & buf, odocstream & os,
- OutputParams const &) const
+ OutputParams const &) const
{
static docstring const str = '[' + buf.B_("math macro") + ']';
void write(WriteStream & os) const;
///
int plaintext(Buffer const &, odocstream &,
- OutputParams const &) const;
+ OutputParams const &) const;
/// Number of arguments
int numargs() const;
docstring const & cs = t.cs();
// FIXME: For some strange reason, the stream operator instanciate
// a new Token before outputting the contents of t.cs().
- // Because of this the line
+ // Because of this the line
// os << '\\' << cs;
// below becomes recursive.
// In order to avoid that we return early:
const_cast<OutputParams&>(runparams).par_begin = 0;
const_cast<OutputParams&>(runparams).par_end = 0;
}
-
+
while (par != pend) {
Layout_ptr const & style = par->layout();
ParagraphList::const_iterator lastpar = par;
pit->getFontSettings(bparams, i).language()->encoding();
if (encoding->package() == Encoding::inputenc &&
switchEncoding(os, bparams, false,
- *(runparams.encoding), *encoding) > 0) {
+ *(runparams.encoding), *encoding) > 0) {
runparams.encoding = encoding;
os << '\n';
texrow.newline();
par = TeXOnePar(buf, paragraphs, par, os, texrow,
runparams, everypar);
} else if (layout->isEnvironment() ||
- !par->params().leftIndent().zero()) {
+ !par->params().leftIndent().zero()) {
par = TeXEnvironment(buf, paragraphs, par, os,
texrow, runparams);
} else {
int switchEncoding(odocstream & os, BufferParams const & bparams,
- bool moving_arg, Encoding const & oldEnc,
- Encoding const & newEnc)
+ bool moving_arg, Encoding const & oldEnc,
+ Encoding const & newEnc)
{
if ((bparams.inputenc != "auto" || moving_arg)
&& bparams.inputenc != "default")
/// Export up to \p number optarg insets
int latexOptArgInsets(Buffer const & buf, Paragraph const & par,
- odocstream & os, OutputParams const & runparams,
- int number);
+ odocstream & os, OutputParams const & runparams,
+ int number);
/** Export \p paragraphs of buffer \p buf to LaTeX.
Don't use a temporary stringstream for \p os if the final output is
/// Switch the encoding of \p os from \p oldEnc to \p newEnc if needed.
/// \return the number of characters written to \p os.
int switchEncoding(odocstream & os, BufferParams const & bparams,
- bool moving_arg, Encoding const & oldEnc,
- Encoding const & newEnc);
+ bool moving_arg, Encoding const & oldEnc,
+ Encoding const & newEnc);
} // namespace lyx
// Move over the end-of-par change information
tmp->setChange(tmp->size(), par.lookupChange(par.size()));
par.setChange(par.size(), Change(bparams.trackChanges ?
- Change::INSERTED : Change::UNCHANGED));
+ Change::INSERTED : Change::UNCHANGED));
if (pos) {
// Make sure that we keep the language when
// Move over the end-of-par change information
tmp.setChange(tmp.size(), par.lookupChange(par.size()));
par.setChange(par.size(), Change(bparams.trackChanges ?
- Change::INSERTED : Change::UNCHANGED));
+ Change::INSERTED : Change::UNCHANGED));
}
}
int const w = max_witdh_ - leftMargin() - right_margin;
MetricsInfo mi(&bv_, font, w);
inset->metrics(mi, dim);
- if (inset->width() > dim.wid)
+ if (inset->width() > dim.wid)
lyxerr << "Error: inset " << to_ascii(inset->getInsetName())
<< " draw width " << inset->width()
<< "> metrics width " << dim.wid << "." << std::endl;
- if (inset->ascent() > dim.asc)
+ if (inset->ascent() > dim.asc)
lyxerr << "Error: inset " << to_ascii(inset->getInsetName())
<< " draw ascent " << inset->ascent()
<< "> metrics ascent " << dim.asc << "." << std::endl;
- if (inset->descent() > dim.des)
+ if (inset->descent() > dim.des)
lyxerr << "Error: inset " << to_ascii(inset->getInsetName())
<< " draw ascent " << inset->descent()
<< "> metrics descent " << dim.des << "." << std::endl;
* Arabic characters, but rather paint them one at a time.
* See also http://thread.gmane.org/gmane.editors.lyx.devel/79740
*/
- if (hebrew)
+ if (hebrew)
break;
/* FIXME: these checks are irrelevant, since 'arabic' and
FontMetrics const & fm = theFontMetrics(bv_.buffer()->params().getFont());
int const length = fm.maxAscent() / 2;
Color::color col = par_.isInserted(par_.size()) ? Color::addedtext : Color::deletedtext;
-
+
pain_.line(int(x_) + 1, yo_ + 2, int(x_) + 1, yo_ + 2 - length, col,
- Painter::line_solid, Painter::line_thick);
+ Painter::line_solid, Painter::line_thick);
pain_.line(int(x_) + 1 - length, yo_ + 2, int(x_) + 1, yo_ + 2, col,
- Painter::line_solid, Painter::line_thick);
+ Painter::line_solid, Painter::line_thick);
}
// draw an endlabel
// We also don't paint across things like tables
if (running_strikeout && (highly_editable_inset || !is_struckout)) {
// Calculate 1/3 height of the buffer's default font
- FontMetrics const & fm
+ FontMetrics const & fm
= theFontMetrics(bv_.buffer()->params().getFont());
int const middle = yo_ - fm.maxAscent() / 3;
pain_.line(last_strikeout_x, middle, int(x_), middle,
// if we reach the end of a struck out range, paint it
if (running_strikeout) {
// calculate 1/3 height of the buffer's default font
- FontMetrics const & fm
+ FontMetrics const & fm
= theFontMetrics(bv_.buffer()->params().getFont());
int const middle = yo_ - fm.maxAscent() / 3;
pain_.line(last_strikeout_x, middle, int(x_), middle,
for (int i = cur.depth() - 1; --i >= 0; ) {
Inset * const in = &cur[i].inset();
if (in) {
- InsetText * t =
+ InsetText * t =
const_cast<InsetText *>(in->asTextInset());
if (t)
return !t->wide();
bool cursor_on_row = CursorOnRow(pi, pit, rit, text);
bool in_inset_alone_on_row =
innerCursorOnRow(pi, pit, rit, text);
- bool leftEdgeFixed =
+ bool leftEdgeFixed =
(par.getAlign() == LYX_ALIGN_LEFT ||
par.getAlign() == LYX_ALIGN_BLOCK);
bool inNarrowIns = inNarrowInset(pi);
// Clear background of this row
// (if paragraph background was not cleared)
if (!repaintAll &&
- (!(in_inset_alone_on_row && leftEdgeFixed)
+ (!(in_inset_alone_on_row && leftEdgeFixed)
|| row_has_changed)) {
pi.pain.fillRectangle(x, y - rit->ascent(),
rp.maxWidth(), rit->height(),
rp.paintChangeBar();
if (rit == rb)
rp.paintFirst();
- rp.paintText();
+ rp.paintText();
if (rit + 1 == re)
rp.paintLast();
}
Text & text = buffer.text();
bool const select = bv.cursor().selection();
ViewMetricsInfo const & vi = bv.viewMetricsInfo();
-
+
PainterInfo pi(const_cast<BufferView *>(&bv), pain);
// Should the whole screen, including insets, be refreshed?
// FIXME: We should also distinguish DecorationUpdate to avoid text
// This flag cannot be set from within same inset:
bool repaintAll = refreshInside;
for (int pit = 0; pit < int(text.paragraphs().size()); ++pit) {
- ParagraphMetrics const & pmi
+ ParagraphMetrics const & pmi
= pi.base.bv->parMetrics(&text, pit);
y += pmi.ascent();
paintPar(pi, text, pit, x, y, repaintAll);
void sgml::openTag(odocstream & os, string const & name, string const & attribute)
{
- // FIXME UNICODE
+ // FIXME UNICODE
// This should be fixed in layout files later.
string param = subst(attribute, "<", "\"");
param = subst(param, ">", "\"");
// On windows it is not possible to create files with '<', '>' or '?'
// in the name.
static string const keep = "abcdefghijklmnopqrstuvwxyz"
- "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
- "+,-0123456789;=";
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ "+,-0123456789;=";
string::size_type pos = 0;
while ((pos = mname.find_first_not_of(keep, pos)) != string::npos)
mname[pos++] = '_';
in_cd_ = iconv_open(ucs4_codeset, encoding.c_str());
if (in_cd_ == (iconv_t)(-1)) {
fprintf(stderr, "Error %d returned from iconv_open(in_cd_): %s\n",
- errno, strerror(errno));
+ errno, strerror(errno));
fflush(stderr);
throw lyx::iconv_codecvt_facet_exception();
}
out_cd_ = iconv_open(encoding.c_str(), ucs4_codeset);
if (out_cd_ == (iconv_t)(-1)) {
fprintf(stderr, "Error %d returned from iconv_open(out_cd_): %s\n",
- errno, strerror(errno));
+ errno, strerror(errno));
fflush(stderr);
throw lyx::iconv_codecvt_facet_exception();
}
if (in_cd_ != (iconv_t)(-1))
if (iconv_close(in_cd_) == -1) {
fprintf(stderr, "Error %d returned from iconv_close(in_cd_): %s\n",
- errno, strerror(errno));
+ errno, strerror(errno));
fflush(stderr);
}
if (out_cd_ != (iconv_t)(-1))
if (iconv_close(out_cd_) == -1) {
fprintf(stderr, "Error %d returned from iconv_close(out_cd_): %s\n",
- errno, strerror(errno));
+ errno, strerror(errno));
fflush(stderr);
}
}
&inbytesleft, &to_next, &outbytesleft);
if (retval == base::error) {
fprintf(stderr,
- "Error %d returned from iconv when converting from %s to %s: %s\n",
- errno, ucs4_codeset, encoding_.c_str(),
- strerror(errno));
+ "Error %d returned from iconv when converting from %s to %s: %s\n",
+ errno, ucs4_codeset, encoding_.c_str(),
+ strerror(errno));
fputs("Converted input:", stderr);
for (intern_type const * i = from; i < from_next; ++i) {
unsigned int const c = *i;
&outbytesleft);
if (retval == base::error) {
fprintf(stderr,
- "Error %d returned from iconv when converting from %s to %s: %s\n",
- errno, encoding_.c_str(), ucs4_codeset,
- strerror(errno));
+ "Error %d returned from iconv when converting from %s to %s: %s\n",
+ errno, encoding_.c_str(), ucs4_codeset,
+ strerror(errno));
fputs("Converted input:", stderr);
for (extern_type const * i = from; i < from_next; ++i) {
// extern_type may be signed, avoid output of
imbue(locale);
}
-
+
idocfstream::idocfstream(const char* s, std::ios_base::openmode mode,
- string const & encoding)
+ string const & encoding)
: base()
{
// We must imbue the stream before openening the file
odocfstream::odocfstream(const char* s, std::ios_base::openmode mode,
- string const & encoding)
+ string const & encoding)
: base()
{
// We must imbue the stream before openening the file
// Returns the real name of file name in directory path, with optional
// extension ext.
FileName const fileSearch(string const & path, string const & name,
- string const & ext, search_mode mode)
+ string const & ext, search_mode mode)
{
// if `name' is an absolute path, we ignore the setting of `path'
// Expand Environmentvariables in 'name'
token(l, '_', 0) + '_' + name,
ext);
if (!tmpold.empty()) {
- lyxerr << "i18nLibFileSearch: File `" << tmpold
+ lyxerr << "i18nLibFileSearch: File `" << tmpold
<< "' has been found by the old method" <<endl;
return tmpold;
}
(command.size() - start_script) : pos2 - start_script;
// Does this script file exist?
- string const script =
+ string const script =
libFileSearch(".", command.substr(start_script, size_script)).absFilename();
if (script.empty()) {
// If file is from LyXDir, display it as if it were relative.
string const system = package().system_support().absFilename();
if (prefixIs(str, system) && str != system)
- return from_utf8("[" + str.erase(0, system.length()) + "]");
+ return from_utf8("[" + str.erase(0, system.length()) + "]");
// replace /home/blah with ~/
string const home = package().home_dir().absFilename();
<< '\'' << endl;
if (c.first != -1)
return FileName(os::internal_path(rtrim(to_utf8(from_filesystem8bit(c.second)),
- "\n\r")));
+ "\n\r")));
else
return FileName();
}
Will overwrite an already existing unzipped file without warning.
*/
FileName const unzipFile(FileName const & zipped_file,
- std::string const & unzipped_file = std::string());
+ std::string const & unzipped_file = std::string());
/// Returns true is path is absolute
bool absolutePath(std::string const & path);
int err = errno;
::close(infile);
boost::throw_exception(filesystem_path_error(
- "boost::filesystem::copy_file",
- source, target,
- fs::lookup_errno(err)));
+ "boost::filesystem::copy_file",
+ source, target,
+ fs::lookup_errno(err)));
}
int const flags = O_WRONLY | O_CREAT | (noclobber ? O_EXCL : O_TRUNC);
int err = errno;
- ::close(infile);
- ::close(outfile);
+ ::close(infile);
+ ::close(outfile);
if (in == -1 || out == -1)
boost::throw_exception(
}
}
-
int support::kill(int pid, int sig)
{
#ifdef _WIN32
- if (pid == (int)GetCurrentProcessId())
+ if (pid == (int)GetCurrentProcessId())
return -raise(sig);
HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, TRUE, pid);
if (!hProcess) {
docstring const escape(docstring const & lab)
{
char_type hexdigit[16] = { '0', '1', '2', '3', '4', '5', '6', '7',
- '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
+ '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
docstring enc;
for (docstring::size_type i = 0; i < lab.length(); ++i) {
char_type c = lab[i];
vector<string> const getVectorFromString(string const & str,
- string const & delim)
+ string const & delim)
{
return getVectorFromStringT<string>(str, delim);
}
vector<docstring> const getVectorFromString(docstring const & str,
- docstring const & delim)
+ docstring const & delim)
{
return getVectorFromStringT<docstring>(str, delim);
}
bool rename(FileName const & from, FileName const & to);
/// copy a file, returns false it it fails
bool copy(FileName const & from, FileName const & to,
- unsigned long int mode = (unsigned long int)-1);
+ unsigned long int mode = (unsigned long int)-1);
/// generates a checksum of a file
unsigned long sum(FileName const & file);
/// FIXME: some point to this hmm ?
#include <windows.h>
#include <io.h>
#include <windef.h>
-#include <shellapi.h>
+#include <shellapi.h>
#include <shlwapi.h>
#include <sys/cygwin.h>
if (var == "TEMP")
temp_seen = true;
-
+
if (GetEnvironmentVariable(var.c_str(), curval, 2) == 0
&& GetLastError() == ERROR_ENVVAR_NOT_FOUND) {
/* Convert to Windows style where necessary */
#ifdef X_DISPLAY_MISSING
// Windows only: Add BaKoMa TrueType font resources
string const fonts_dir = addPath(package().system_support().absFilename(), "fonts");
-
+
for (int i = 0 ; i < num_fonts_truetype ; ++i) {
string const font_current = to_local8bit(from_utf8(convert_path(
addName(fonts_dir, win_fonts_truetype[i] + ".ttf"),
#ifdef X_DISPLAY_MISSING
// Windows only: Remove BaKoMa TrueType font resources
string const fonts_dir = addPath(package().system_support().absFilename(), "fonts");
-
+
for(int i = 0 ; i < num_fonts_truetype ; ++i) {
string const font_current = to_local8bit(from_utf8(convert_path(
addName(fonts_dir, win_fonts_truetype[i] + ".ttf"),
(void)mode;
LSRolesMask role = kLSRolesAll;
FSRef outAppRef;
- OSStatus status =
+ OSStatus status =
LSGetApplicationForInfo(kLSUnknownType, kLSUnknownCreator,
cfs_ext, role, &outAppRef, NULL);
CFRelease(cfs_ext);
#ifdef __APPLE__
// Reference: http://developer.apple.com/documentation/Carbon/Reference/LaunchServicesReference/
FSRef fileref;
- OSStatus status =
+ OSStatus status =
FSPathMakeRef((UInt8 *) filename.c_str(), &fileref, NULL);
if (status != 0)
return false;
-
+
// this is what we would like to do but it seems that the
// viewer for PDF is often quicktime...
//LSRolesMask role = (mode == VIEW) ? kLSRolesViewer : kLSRolesEditor;
inLaunchSpec.asyncRefCon = NULL;
status = LSOpenFromRefSpec(&inLaunchSpec, NULL);
- return status != kLSApplicationNotFoundErr;
+ return status != kLSApplicationNotFoundErr;
#else
// silence compiler warnings
(void)filename;
#include <direct.h> // _getdrive
#include <shlobj.h> // SHGetFolderPath
#include <windef.h>
-#include <shellapi.h>
+#include <shellapi.h>
#include <shlwapi.h>
// Must define SHGFP_TYPE_CURRENT for older versions of MinGW.
* shell scripts failed, for mysterious reasons...
*
* I've chosen for now, therefore, to simply add Ruurd's original
- * code as-is. A wrapper program hidecmd.c has been added to
+ * code as-is. A wrapper program hidecmd.c has been added to
* development/Win32 which hides the console window of lyx when
* lyx is invoked as a parameter of hidecmd.exe.
*/
{
// Windows only: Add BaKoMa TrueType font resources
string const fonts_dir = addPath(package().system_support().absFilename(), "fonts");
-
+
for (int i = 0 ; i < num_fonts_truetype ; ++i) {
string const font_current =
addName(fonts_dir, win_fonts_truetype[i] + ".ttf");
{
// Windows only: Remove BaKoMa TrueType font resources
string const fonts_dir = addPath(package().system_support().absFilename(), "fonts");
-
+
for(int i = 0 ; i < num_fonts_truetype ; ++i) {
string const font_current =
addName(fonts_dir, win_fonts_truetype[i] + ".ttf");
{
// This does not properly convert surrogate pairs
QString s;
- int i = static_cast<int>(str.size());
+ int i = static_cast<int>(str.size());
s.resize(i);
for (; --i >= 0;)
s[i] = ucs4_to_qchar(str[i]);
// FIXME UNICODE encoding of name may be wrong (makeAbsPath expects
// utf8)
name = to_utf8(makeRelPath(from_utf8(makeAbsPath(name, getMasterFilePath()).absFilename()),
- from_utf8(getParentFilePath())));
+ from_utf8(getParentFilePath())));
}
check_space(p, os, context);
else if (t.character() == '[' && noweb_mode &&
- p.next_token().character() == '[') {
+ p.next_token().character() == '[') {
// These can contain underscores
p.putback();
string const s = p.getFullOpt() + ']';
eat_whitespace(p, os, context, false);
string name = p.get_token().cs();
eat_whitespace(p, os, context, false);
-
- // parameter text
+
+ // parameter text
bool simple = true;
string paramtext;
int arity = 0;
// # found
p.get_token();
paramtext += "#";
-
+
// followed by number?
if (p.next_token().cat() == catOther) {
char c = p.getChar();
simple = false;
}
}
-
+
// only output simple (i.e. compatible) macro as FormulaMacros
string ert = "\\def\\" + name + ' ' + paramtext + '{' + p.verbatim_item() + '}';
if (simple) {
}
else if (t.cs() == "i" || t.cs() == "j" || t.cs() == "l" ||
- t.cs() == "L") {
+ t.cs() == "L") {
context.check_layout(os);
os << "\\i \\" << t.cs() << "{}\n";
skip_braces(p); // eat {}
string const ert = name + '{' + command + '}' +
opt1 + opt2 +
'{' + p.verbatim_item() + '}';
-
+
if (opt2.empty()) {
context.check_layout(os);
begin_inset(os, "FormulaMacro");
}
case Down: {
// Go down out of current header:
- if (finish != end)
+ if (finish != end)
++finish;
// Find next same-level header:
for (; finish != end; ++finish) {