mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-25 14:04:25 +00:00
Add option to view only preamble when viewing source.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_2_0_X@40862 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
ec5a0965d3
commit
1b74e82b9c
140
src/Buffer.cpp
140
src/Buffer.cpp
@ -1338,7 +1338,7 @@ bool Buffer::write(ostream & ofs) const
|
|||||||
bool Buffer::makeLaTeXFile(FileName const & fname,
|
bool Buffer::makeLaTeXFile(FileName const & fname,
|
||||||
string const & original_path,
|
string const & original_path,
|
||||||
OutputParams const & runparams_in,
|
OutputParams const & runparams_in,
|
||||||
bool output_preamble, bool output_body) const
|
OutputWhat output) const
|
||||||
{
|
{
|
||||||
OutputParams runparams = runparams_in;
|
OutputParams runparams = runparams_in;
|
||||||
|
|
||||||
@ -1369,8 +1369,7 @@ bool Buffer::makeLaTeXFile(FileName const & fname,
|
|||||||
otexstream os(ofs, d->texrow);
|
otexstream os(ofs, d->texrow);
|
||||||
try {
|
try {
|
||||||
os.texrow().reset();
|
os.texrow().reset();
|
||||||
writeLaTeXSource(os, original_path,
|
writeLaTeXSource(os, original_path, runparams, output);
|
||||||
runparams, output_preamble, output_body);
|
|
||||||
}
|
}
|
||||||
catch (EncodingException & e) {
|
catch (EncodingException & e) {
|
||||||
odocstringstream ods;
|
odocstringstream ods;
|
||||||
@ -1415,7 +1414,7 @@ bool Buffer::makeLaTeXFile(FileName const & fname,
|
|||||||
void Buffer::writeLaTeXSource(otexstream & os,
|
void Buffer::writeLaTeXSource(otexstream & os,
|
||||||
string const & original_path,
|
string const & original_path,
|
||||||
OutputParams const & runparams_in,
|
OutputParams const & runparams_in,
|
||||||
bool const output_preamble, bool const output_body) const
|
OutputWhat output) const
|
||||||
{
|
{
|
||||||
// The child documents, if any, shall be already loaded at this point.
|
// The child documents, if any, shall be already loaded at this point.
|
||||||
|
|
||||||
@ -1430,6 +1429,11 @@ void Buffer::writeLaTeXSource(otexstream & os,
|
|||||||
validate(features);
|
validate(features);
|
||||||
LYXERR(Debug::LATEX, " Buffer validation done.");
|
LYXERR(Debug::LATEX, " Buffer validation done.");
|
||||||
|
|
||||||
|
bool const output_preamble =
|
||||||
|
output == FullSource || output == OnlyPreamble;
|
||||||
|
bool const output_body =
|
||||||
|
output == FullSource || output == OnlyBody;
|
||||||
|
|
||||||
// The starting paragraph of the coming rows is the
|
// The starting paragraph of the coming rows is the
|
||||||
// first paragraph of the document. (Asger)
|
// first paragraph of the document. (Asger)
|
||||||
if (output_preamble && runparams.nice) {
|
if (output_preamble && runparams.nice) {
|
||||||
@ -1600,7 +1604,7 @@ void Buffer::writeLaTeXSource(otexstream & os,
|
|||||||
|
|
||||||
void Buffer::makeDocBookFile(FileName const & fname,
|
void Buffer::makeDocBookFile(FileName const & fname,
|
||||||
OutputParams const & runparams,
|
OutputParams const & runparams,
|
||||||
bool const body_only) const
|
OutputWhat output) const
|
||||||
{
|
{
|
||||||
LYXERR(Debug::LATEX, "makeDocBookFile...");
|
LYXERR(Debug::LATEX, "makeDocBookFile...");
|
||||||
|
|
||||||
@ -1608,7 +1612,7 @@ void Buffer::makeDocBookFile(FileName const & fname,
|
|||||||
if (!openFileWrite(ofs, fname))
|
if (!openFileWrite(ofs, fname))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
writeDocBookSource(ofs, fname.absFileName(), runparams, body_only);
|
writeDocBookSource(ofs, fname.absFileName(), runparams, output);
|
||||||
|
|
||||||
ofs.close();
|
ofs.close();
|
||||||
if (ofs.fail())
|
if (ofs.fail())
|
||||||
@ -1618,7 +1622,7 @@ void Buffer::makeDocBookFile(FileName const & fname,
|
|||||||
|
|
||||||
void Buffer::writeDocBookSource(odocstream & os, string const & fname,
|
void Buffer::writeDocBookSource(odocstream & os, string const & fname,
|
||||||
OutputParams const & runparams,
|
OutputParams const & runparams,
|
||||||
bool const only_body) const
|
OutputWhat output) const
|
||||||
{
|
{
|
||||||
LaTeXFeatures features(*this, params(), runparams);
|
LaTeXFeatures features(*this, params(), runparams);
|
||||||
validate(features);
|
validate(features);
|
||||||
@ -1628,7 +1632,12 @@ void Buffer::writeDocBookSource(odocstream & os, string const & fname,
|
|||||||
DocumentClass const & tclass = params().documentClass();
|
DocumentClass const & tclass = params().documentClass();
|
||||||
string const top_element = tclass.latexname();
|
string const top_element = tclass.latexname();
|
||||||
|
|
||||||
if (!only_body) {
|
bool const output_preamble =
|
||||||
|
output == FullSource || output == OnlyPreamble;
|
||||||
|
bool const output_body =
|
||||||
|
output == FullSource || output == OnlyBody;
|
||||||
|
|
||||||
|
if (output_preamble) {
|
||||||
if (runparams.flavor == OutputParams::XML)
|
if (runparams.flavor == OutputParams::XML)
|
||||||
os << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
|
os << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
|
||||||
|
|
||||||
@ -1663,31 +1672,33 @@ void Buffer::writeDocBookSource(odocstream & os, string const & fname,
|
|||||||
os << ">\n\n";
|
os << ">\n\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
string top = top_element;
|
if (output_body) {
|
||||||
top += " lang=\"";
|
string top = top_element;
|
||||||
if (runparams.flavor == OutputParams::XML)
|
top += " lang=\"";
|
||||||
top += params().language->code();
|
if (runparams.flavor == OutputParams::XML)
|
||||||
else
|
top += params().language->code();
|
||||||
top += params().language->code().substr(0, 2);
|
else
|
||||||
top += '"';
|
top += params().language->code().substr(0, 2);
|
||||||
|
top += '"';
|
||||||
|
|
||||||
if (!params().options.empty()) {
|
if (!params().options.empty()) {
|
||||||
top += ' ';
|
top += ' ';
|
||||||
top += params().options;
|
top += params().options;
|
||||||
|
}
|
||||||
|
|
||||||
|
os << "<!-- " << ((runparams.flavor == OutputParams::XML)? "XML" : "SGML")
|
||||||
|
<< " file was created by LyX " << lyx_version
|
||||||
|
<< "\n See http://www.lyx.org/ for more information -->\n";
|
||||||
|
|
||||||
|
params().documentClass().counters().reset();
|
||||||
|
|
||||||
|
updateMacros();
|
||||||
|
|
||||||
|
sgml::openTag(os, top);
|
||||||
|
os << '\n';
|
||||||
|
docbookParagraphs(text(), *this, os, runparams);
|
||||||
|
sgml::closeTag(os, top_element);
|
||||||
}
|
}
|
||||||
|
|
||||||
os << "<!-- " << ((runparams.flavor == OutputParams::XML)? "XML" : "SGML")
|
|
||||||
<< " file was created by LyX " << lyx_version
|
|
||||||
<< "\n See http://www.lyx.org/ for more information -->\n";
|
|
||||||
|
|
||||||
params().documentClass().counters().reset();
|
|
||||||
|
|
||||||
updateMacros();
|
|
||||||
|
|
||||||
sgml::openTag(os, top);
|
|
||||||
os << '\n';
|
|
||||||
docbookParagraphs(text(), *this, os, runparams);
|
|
||||||
sgml::closeTag(os, top_element);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1701,7 +1712,7 @@ void Buffer::makeLyXHTMLFile(FileName const & fname,
|
|||||||
if (!openFileWrite(ofs, fname))
|
if (!openFileWrite(ofs, fname))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
writeLyXHTMLSource(ofs, runparams, body_only);
|
writeLyXHTMLSource(ofs, runparams, FullSource);
|
||||||
|
|
||||||
ofs.close();
|
ofs.close();
|
||||||
if (ofs.fail())
|
if (ofs.fail())
|
||||||
@ -1711,7 +1722,7 @@ void Buffer::makeLyXHTMLFile(FileName const & fname,
|
|||||||
|
|
||||||
void Buffer::writeLyXHTMLSource(odocstream & os,
|
void Buffer::writeLyXHTMLSource(odocstream & os,
|
||||||
OutputParams const & runparams,
|
OutputParams const & runparams,
|
||||||
bool const only_body) const
|
OutputWhat output) const
|
||||||
{
|
{
|
||||||
LaTeXFeatures features(*this, params(), runparams);
|
LaTeXFeatures features(*this, params(), runparams);
|
||||||
validate(features);
|
validate(features);
|
||||||
@ -1720,7 +1731,12 @@ void Buffer::writeLyXHTMLSource(odocstream & os,
|
|||||||
updateMacros();
|
updateMacros();
|
||||||
updateMacroInstances(OutputUpdate);
|
updateMacroInstances(OutputUpdate);
|
||||||
|
|
||||||
if (!only_body) {
|
bool const output_preamble =
|
||||||
|
output == FullSource || output == OnlyPreamble;
|
||||||
|
bool const output_body =
|
||||||
|
output == FullSource || output == OnlyBody;
|
||||||
|
|
||||||
|
if (output_preamble) {
|
||||||
os << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
|
os << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
|
||||||
<< "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN\" \"http://www.w3.org/TR/MathML2/dtd/xhtml-math11-f.dtd\">\n"
|
<< "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN\" \"http://www.w3.org/TR/MathML2/dtd/xhtml-math11-f.dtd\">\n"
|
||||||
// FIXME Language should be set properly.
|
// FIXME Language should be set properly.
|
||||||
@ -1764,14 +1780,19 @@ void Buffer::writeLyXHTMLSource(odocstream & os,
|
|||||||
<< ";\n";
|
<< ";\n";
|
||||||
os << "}\n</style>\n";
|
os << "}\n</style>\n";
|
||||||
}
|
}
|
||||||
os << "</head>\n<body>\n";
|
os << "</head>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
XHTMLStream xs(os);
|
if (output_body) {
|
||||||
params().documentClass().counters().reset();
|
os << "<body>\n";
|
||||||
xhtmlParagraphs(text(), *this, xs, runparams);
|
XHTMLStream xs(os);
|
||||||
if (!only_body)
|
params().documentClass().counters().reset();
|
||||||
os << "</body>\n</html>\n";
|
xhtmlParagraphs(text(), *this, xs, runparams);
|
||||||
|
os << "</body>\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (output_preamble)
|
||||||
|
os << "</html>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -3153,7 +3174,7 @@ void Buffer::changeRefsIfUnique(docstring const & from, docstring const & to,
|
|||||||
|
|
||||||
void Buffer::getSourceCode(odocstream & os, string const format,
|
void Buffer::getSourceCode(odocstream & os, string const format,
|
||||||
pit_type par_begin, pit_type par_end,
|
pit_type par_begin, pit_type par_end,
|
||||||
bool full_source) const
|
OutputWhat output) const
|
||||||
{
|
{
|
||||||
OutputParams runparams(¶ms().encoding());
|
OutputParams runparams(¶ms().encoding());
|
||||||
runparams.nice = true;
|
runparams.nice = true;
|
||||||
@ -3162,21 +3183,7 @@ void Buffer::getSourceCode(odocstream & os, string const format,
|
|||||||
// No side effect of file copying and image conversion
|
// No side effect of file copying and image conversion
|
||||||
runparams.dryrun = true;
|
runparams.dryrun = true;
|
||||||
|
|
||||||
if (full_source) {
|
if (output == CurrentParagraph) {
|
||||||
os << "% " << _("Preview source code") << "\n\n";
|
|
||||||
d->texrow.reset();
|
|
||||||
d->texrow.newline();
|
|
||||||
d->texrow.newline();
|
|
||||||
if (params().isDocBook())
|
|
||||||
writeDocBookSource(os, absFileName(), runparams, false);
|
|
||||||
else if (runparams.flavor == OutputParams::HTML)
|
|
||||||
writeLyXHTMLSource(os, runparams, false);
|
|
||||||
else {
|
|
||||||
// latex or literate
|
|
||||||
otexstream ots(os, d->texrow);
|
|
||||||
writeLaTeXSource(ots, string(), runparams, true, true);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
runparams.par_begin = par_begin;
|
runparams.par_begin = par_begin;
|
||||||
runparams.par_end = par_end;
|
runparams.par_end = par_end;
|
||||||
if (par_begin + 1 == par_end) {
|
if (par_begin + 1 == par_end) {
|
||||||
@ -3205,6 +3212,27 @@ void Buffer::getSourceCode(odocstream & os, string const format,
|
|||||||
otexstream ots(os, texrow);
|
otexstream ots(os, texrow);
|
||||||
latexParagraphs(*this, text(), ots, runparams);
|
latexParagraphs(*this, text(), ots, runparams);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
os << "% ";
|
||||||
|
if (output == FullSource)
|
||||||
|
os << _("Preview source code");
|
||||||
|
else if (output == OnlyPreamble)
|
||||||
|
os << _("Preview preamble");
|
||||||
|
else if (output == OnlyBody)
|
||||||
|
os << _("Preview body");
|
||||||
|
os << "\n\n";
|
||||||
|
d->texrow.reset();
|
||||||
|
d->texrow.newline();
|
||||||
|
d->texrow.newline();
|
||||||
|
if (params().isDocBook())
|
||||||
|
writeDocBookSource(os, absFileName(), runparams, output);
|
||||||
|
else if (runparams.flavor == OutputParams::HTML)
|
||||||
|
writeLyXHTMLSource(os, runparams, output);
|
||||||
|
else {
|
||||||
|
// latex or literate
|
||||||
|
otexstream ots(os, d->texrow);
|
||||||
|
writeLaTeXSource(ots, string(), runparams, output);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
21
src/Buffer.h
21
src/Buffer.h
@ -275,12 +275,18 @@ public:
|
|||||||
/// Fill in the ErrorList with the TeXErrors
|
/// Fill in the ErrorList with the TeXErrors
|
||||||
void bufferErrors(TeXErrors const &, ErrorList &) const;
|
void bufferErrors(TeXErrors const &, ErrorList &) const;
|
||||||
|
|
||||||
|
enum OutputWhat {
|
||||||
|
FullSource,
|
||||||
|
OnlyBody,
|
||||||
|
OnlyPreamble,
|
||||||
|
CurrentParagraph
|
||||||
|
};
|
||||||
|
|
||||||
/// Just a wrapper for writeLaTeXSource, first creating the ofstream.
|
/// Just a wrapper for writeLaTeXSource, first creating the ofstream.
|
||||||
bool makeLaTeXFile(support::FileName const & filename,
|
bool makeLaTeXFile(support::FileName const & filename,
|
||||||
std::string const & original_path,
|
std::string const & original_path,
|
||||||
OutputParams const &,
|
OutputParams const &,
|
||||||
bool output_preamble = true,
|
OutputWhat output = FullSource) const;
|
||||||
bool output_body = true) const;
|
|
||||||
/** Export the buffer to LaTeX.
|
/** Export the buffer to LaTeX.
|
||||||
If \p os is a file stream, and params().inputenc is "auto" or
|
If \p os is a file stream, and params().inputenc is "auto" or
|
||||||
"default", and the buffer contains text in different languages
|
"default", and the buffer contains text in different languages
|
||||||
@ -306,16 +312,15 @@ public:
|
|||||||
void writeLaTeXSource(otexstream & os,
|
void writeLaTeXSource(otexstream & os,
|
||||||
std::string const & original_path,
|
std::string const & original_path,
|
||||||
OutputParams const &,
|
OutputParams const &,
|
||||||
bool output_preamble = true,
|
OutputWhat output = FullSource) const;
|
||||||
bool output_body = true) const;
|
|
||||||
///
|
///
|
||||||
void makeDocBookFile(support::FileName const & filename,
|
void makeDocBookFile(support::FileName const & filename,
|
||||||
OutputParams const & runparams_in,
|
OutputParams const & runparams_in,
|
||||||
bool only_body = false) const;
|
OutputWhat output = FullSource) const;
|
||||||
///
|
///
|
||||||
void writeDocBookSource(odocstream & os, std::string const & filename,
|
void writeDocBookSource(odocstream & os, std::string const & filename,
|
||||||
OutputParams const & runparams_in,
|
OutputParams const & runparams_in,
|
||||||
bool only_body = false) const;
|
OutputWhat output = FullSource) const;
|
||||||
///
|
///
|
||||||
void makeLyXHTMLFile(support::FileName const & filename,
|
void makeLyXHTMLFile(support::FileName const & filename,
|
||||||
OutputParams const & runparams_in,
|
OutputParams const & runparams_in,
|
||||||
@ -323,7 +328,7 @@ public:
|
|||||||
///
|
///
|
||||||
void writeLyXHTMLSource(odocstream & os,
|
void writeLyXHTMLSource(odocstream & os,
|
||||||
OutputParams const & runparams_in,
|
OutputParams const & runparams_in,
|
||||||
bool only_body = false) const;
|
OutputWhat output = FullSource) const;
|
||||||
/// returns the main language for the buffer (document)
|
/// returns the main language for the buffer (document)
|
||||||
Language const * language() const;
|
Language const * language() const;
|
||||||
/// get l10n translated to the buffers language
|
/// get l10n translated to the buffers language
|
||||||
@ -560,7 +565,7 @@ public:
|
|||||||
/// get source code (latex/docbook) for some paragraphs, or all paragraphs
|
/// get source code (latex/docbook) for some paragraphs, or all paragraphs
|
||||||
/// including preamble
|
/// including preamble
|
||||||
void getSourceCode(odocstream & os, std::string const format,
|
void getSourceCode(odocstream & os, std::string const format,
|
||||||
pit_type par_begin, pit_type par_end, bool full_source) const;
|
pit_type par_begin, pit_type par_end, OutputWhat output) const;
|
||||||
|
|
||||||
/// Access to error list.
|
/// Access to error list.
|
||||||
/// This method is used only for GUI visualisation of Buffer related
|
/// This method is used only for GUI visualisation of Buffer related
|
||||||
|
@ -213,7 +213,7 @@ void BufferList::updateIncludedTeXfiles(string const & masterTmpDir,
|
|||||||
if (!(*it)->isDepClean(masterTmpDir)) {
|
if (!(*it)->isDepClean(masterTmpDir)) {
|
||||||
string writefile = addName(masterTmpDir, (*it)->latexName());
|
string writefile = addName(masterTmpDir, (*it)->latexName());
|
||||||
(*it)->makeLaTeXFile(FileName(writefile), masterTmpDir,
|
(*it)->makeLaTeXFile(FileName(writefile), masterTmpDir,
|
||||||
runparams, false);
|
runparams, Buffer::OnlyBody);
|
||||||
(*it)->markDepClean(masterTmpDir);
|
(*it)->markDepClean(masterTmpDir);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -49,8 +49,8 @@ ViewSourceWidget::ViewSourceWidget()
|
|||||||
{
|
{
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
|
|
||||||
connect(viewFullSourceCB, SIGNAL(clicked()),
|
connect(contentsCO, SIGNAL(activated(int)),
|
||||||
this, SLOT(fullSourceChanged()));
|
this, SLOT(contentsChanged()));
|
||||||
connect(autoUpdateCB, SIGNAL(toggled(bool)),
|
connect(autoUpdateCB, SIGNAL(toggled(bool)),
|
||||||
updatePB, SLOT(setDisabled(bool)));
|
updatePB, SLOT(setDisabled(bool)));
|
||||||
connect(autoUpdateCB, SIGNAL(toggled(bool)),
|
connect(autoUpdateCB, SIGNAL(toggled(bool)),
|
||||||
@ -90,7 +90,7 @@ static size_t crcCheck(docstring const & s)
|
|||||||
\param fullSource get full source code
|
\param fullSource get full source code
|
||||||
\return true if the content has changed since last call.
|
\return true if the content has changed since last call.
|
||||||
*/
|
*/
|
||||||
static bool getContent(BufferView const * view, bool fullSource,
|
static bool getContent(BufferView const * view, Buffer::OutputWhat output,
|
||||||
QString & qstr, string const format, bool force_getcontent)
|
QString & qstr, string const format, bool force_getcontent)
|
||||||
{
|
{
|
||||||
// get the *top* level paragraphs that contain the cursor,
|
// get the *top* level paragraphs that contain the cursor,
|
||||||
@ -108,7 +108,7 @@ static bool getContent(BufferView const * view, bool fullSource,
|
|||||||
if (par_begin > par_end)
|
if (par_begin > par_end)
|
||||||
swap(par_begin, par_end);
|
swap(par_begin, par_end);
|
||||||
odocstringstream ostr;
|
odocstringstream ostr;
|
||||||
view->buffer().getSourceCode(ostr, format, par_begin, par_end + 1, fullSource);
|
view->buffer().getSourceCode(ostr, format, par_begin, par_end + 1, output);
|
||||||
docstring s = ostr.str();
|
docstring s = ostr.str();
|
||||||
static size_t crc = 0;
|
static size_t crc = 0;
|
||||||
size_t newcrc = crcCheck(s);
|
size_t newcrc = crcCheck(s);
|
||||||
@ -129,7 +129,7 @@ void ViewSourceWidget::setBufferView(BufferView const * bv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ViewSourceWidget::fullSourceChanged()
|
void ViewSourceWidget::contentsChanged()
|
||||||
{
|
{
|
||||||
if (autoUpdateCB->isChecked())
|
if (autoUpdateCB->isChecked())
|
||||||
updateView();
|
updateView();
|
||||||
@ -150,8 +150,15 @@ void ViewSourceWidget::updateView()
|
|||||||
outputFormatCO->currentIndex()).toString());
|
outputFormatCO->currentIndex()).toString());
|
||||||
|
|
||||||
QString content;
|
QString content;
|
||||||
if (getContent(bv_, viewFullSourceCB->isChecked(), content,
|
Buffer::OutputWhat output = Buffer::CurrentParagraph;
|
||||||
format, force_getcontent_))
|
if (contentsCO->currentIndex() == 1)
|
||||||
|
output = Buffer::FullSource;
|
||||||
|
else if (contentsCO->currentIndex() == 2)
|
||||||
|
output = Buffer::OnlyPreamble;
|
||||||
|
else if (contentsCO->currentIndex() == 3)
|
||||||
|
output = Buffer::OnlyBody;
|
||||||
|
|
||||||
|
if (getContent(bv_, output, content, format, force_getcontent_))
|
||||||
document_->setPlainText(content);
|
document_->setPlainText(content);
|
||||||
|
|
||||||
CursorSlice beg = bv_->cursor().selectionBegin().bottom();
|
CursorSlice beg = bv_->cursor().selectionBegin().bottom();
|
||||||
@ -254,8 +261,9 @@ void GuiViewSource::saveSession() const
|
|||||||
{
|
{
|
||||||
Dialog::saveSession();
|
Dialog::saveSession();
|
||||||
QSettings settings;
|
QSettings settings;
|
||||||
settings.setValue(
|
// see below
|
||||||
sessionKey() + "/fullsource", widget_->viewFullSourceCB->isChecked());
|
// settings.setValue(
|
||||||
|
// sessionKey() + "/output", widget_->contentsCO->currentIndex());
|
||||||
settings.setValue(
|
settings.setValue(
|
||||||
sessionKey() + "/autoupdate", widget_->autoUpdateCB->isChecked());
|
sessionKey() + "/autoupdate", widget_->autoUpdateCB->isChecked());
|
||||||
}
|
}
|
||||||
@ -265,9 +273,9 @@ void GuiViewSource::restoreSession()
|
|||||||
{
|
{
|
||||||
DockView::restoreSession();
|
DockView::restoreSession();
|
||||||
// FIXME: Full source updating is too slow to be done at startup.
|
// FIXME: Full source updating is too slow to be done at startup.
|
||||||
//widget_->viewFullSourceCB->setChecked(
|
//widget_->outputCO-setCurrentIndex(
|
||||||
// settings.value(sessionKey() + "/fullsource", false).toBool());
|
// settings.value(sessionKey() + "/output", false).toInt());
|
||||||
widget_->viewFullSourceCB->setChecked(false);
|
widget_->contentsCO->setCurrentIndex(0);
|
||||||
QSettings settings;
|
QSettings settings;
|
||||||
widget_->autoUpdateCB->setChecked(
|
widget_->autoUpdateCB->setChecked(
|
||||||
settings.value(sessionKey() + "/autoupdate", true).toBool());
|
settings.value(sessionKey() + "/autoupdate", true).toBool());
|
||||||
|
@ -47,7 +47,7 @@ public Q_SLOTS:
|
|||||||
///
|
///
|
||||||
void updateDefaultFormat();
|
void updateDefaultFormat();
|
||||||
///
|
///
|
||||||
void fullSourceChanged();
|
void contentsChanged();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
///
|
///
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<ui version="4.0">
|
<ui version="4.0">
|
||||||
<class>ViewSourceUi</class>
|
<class>ViewSourceUi</class>
|
||||||
<widget class="QWidget" name="ViewSourceUi">
|
<widget class="QWidget" name="ViewSourceUi">
|
||||||
@ -5,15 +6,15 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>452</width>
|
<width>528</width>
|
||||||
<height>120</height>
|
<height>205</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout_2">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
<item row="0" column="0">
|
<item row="0" column="0" rowspan="5">
|
||||||
<widget class="QTextEdit" name="viewSourceTV">
|
<widget class="QTextEdit" name="viewSourceTV">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Ignored">
|
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Ignored">
|
||||||
@ -27,74 +28,86 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="1">
|
<item row="0" column="1">
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<widget class="QLabel" name="outputFormatLA">
|
||||||
<item row="0" column="0">
|
<property name="text">
|
||||||
<widget class="QLabel" name="outputFormatLA">
|
<string>F&ormat:</string>
|
||||||
<property name="text">
|
</property>
|
||||||
<string>&Output Format:</string>
|
<property name="buddy">
|
||||||
</property>
|
<cstring>outputFormatCO</cstring>
|
||||||
<property name="buddy">
|
</property>
|
||||||
<cstring>outputFormatCO</cstring>
|
</widget>
|
||||||
</property>
|
</item>
|
||||||
</widget>
|
<item row="0" column="2">
|
||||||
|
<widget class="QComboBox" name="outputFormatCO">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Select the output format</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1" colspan="2">
|
||||||
|
<widget class="QComboBox" name="contentsCO">
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Current Paragraph</string>
|
||||||
|
</property>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="1">
|
<item>
|
||||||
<widget class="QComboBox" name="outputFormatCO">
|
<property name="text">
|
||||||
<property name="toolTip">
|
<string>Complete Source</string>
|
||||||
<string>Select the output format</string>
|
</property>
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0" colspan="2">
|
<item>
|
||||||
<widget class="QCheckBox" name="viewFullSourceCB">
|
<property name="text">
|
||||||
<property name="cursor">
|
<string>Preamble Only</string>
|
||||||
<cursorShape>ArrowCursor</cursorShape>
|
</property>
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Complete source</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0" colspan="2">
|
<item>
|
||||||
<widget class="QCheckBox" name="autoUpdateCB">
|
<property name="text">
|
||||||
<property name="text">
|
<string>Body Only</string>
|
||||||
<string>Automatic update</string>
|
</property>
|
||||||
</property>
|
|
||||||
<property name="checked">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="0" colspan="2">
|
</widget>
|
||||||
<widget class="QPushButton" name="updatePB">
|
</item>
|
||||||
<property name="enabled">
|
<item row="2" column="1" colspan="2">
|
||||||
<bool>false</bool>
|
<widget class="QCheckBox" name="autoUpdateCB">
|
||||||
</property>
|
<property name="text">
|
||||||
<property name="text">
|
<string>Automatic update</string>
|
||||||
<string>&Update</string>
|
</property>
|
||||||
</property>
|
<property name="checked">
|
||||||
</widget>
|
<bool>true</bool>
|
||||||
</item>
|
</property>
|
||||||
<item row="4" column="0">
|
</widget>
|
||||||
<spacer>
|
</item>
|
||||||
<property name="orientation">
|
<item row="3" column="1" colspan="2">
|
||||||
<enum>Qt::Vertical</enum>
|
<widget class="QPushButton" name="updatePB">
|
||||||
</property>
|
<property name="enabled">
|
||||||
<property name="sizeHint" stdset="0">
|
<bool>false</bool>
|
||||||
<size>
|
</property>
|
||||||
<width>20</width>
|
<property name="text">
|
||||||
<height>17</height>
|
<string>&Update</string>
|
||||||
</size>
|
</property>
|
||||||
</property>
|
</widget>
|
||||||
</spacer>
|
</item>
|
||||||
</item>
|
<item row="4" column="1" colspan="2">
|
||||||
</layout>
|
<spacer>
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>85</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<tabstops>
|
<tabstops>
|
||||||
<tabstop>viewSourceTV</tabstop>
|
<tabstop>viewSourceTV</tabstop>
|
||||||
<tabstop>viewFullSourceCB</tabstop>
|
|
||||||
<tabstop>autoUpdateCB</tabstop>
|
<tabstop>autoUpdateCB</tabstop>
|
||||||
<tabstop>updatePB</tabstop>
|
<tabstop>updatePB</tabstop>
|
||||||
</tabstops>
|
</tabstops>
|
||||||
|
@ -710,7 +710,7 @@ void PreviewLoader::Impl::dumpPreamble(otexstream & os) const
|
|||||||
runparams.nice = true;
|
runparams.nice = true;
|
||||||
runparams.moving_arg = true;
|
runparams.moving_arg = true;
|
||||||
runparams.free_spacing = true;
|
runparams.free_spacing = true;
|
||||||
buffer_.writeLaTeXSource(os, buffer_.filePath(), runparams, true, false);
|
buffer_.writeLaTeXSource(os, buffer_.filePath(), runparams, Buffer::OnlyPreamble);
|
||||||
|
|
||||||
// FIXME! This is a HACK! The proper fix is to control the 'true'
|
// FIXME! This is a HACK! The proper fix is to control the 'true'
|
||||||
// passed to WriteStream below:
|
// passed to WriteStream below:
|
||||||
|
@ -618,7 +618,7 @@ void InsetInclude::latex(otexstream & os, OutputParams const & runparams) const
|
|||||||
runparams.par_begin = 0;
|
runparams.par_begin = 0;
|
||||||
runparams.par_end = tmp->paragraphs().size();
|
runparams.par_end = tmp->paragraphs().size();
|
||||||
if (!tmp->makeLaTeXFile(tmpwritefile, masterFileName(buffer()).
|
if (!tmp->makeLaTeXFile(tmpwritefile, masterFileName(buffer()).
|
||||||
onlyPath().absFileName(), runparams, false)) {
|
onlyPath().absFileName(), runparams, Buffer::OnlyBody)) {
|
||||||
docstring msg = bformat(_("Included file `%1$s' "
|
docstring msg = bformat(_("Included file `%1$s' "
|
||||||
"was not exported correctly.\nWarning: "
|
"was not exported correctly.\nWarning: "
|
||||||
"LaTeX export is probably incomplete."),
|
"LaTeX export is probably incomplete."),
|
||||||
@ -785,7 +785,7 @@ docstring InsetInclude::xhtml(XHTMLStream & xs, OutputParams const & rp) const
|
|||||||
if (all_pars) {
|
if (all_pars) {
|
||||||
op.par_begin = 0;
|
op.par_begin = 0;
|
||||||
op.par_end = 0;
|
op.par_end = 0;
|
||||||
ibuf->writeLyXHTMLSource(xs.os(), op, true);
|
ibuf->writeLyXHTMLSource(xs.os(), op, Buffer::OnlyBody);
|
||||||
} else
|
} else
|
||||||
xs << XHTMLStream::ESCAPE_NONE
|
xs << XHTMLStream::ESCAPE_NONE
|
||||||
<< "<!-- Included file: "
|
<< "<!-- Included file: "
|
||||||
@ -849,7 +849,7 @@ int InsetInclude::docbook(odocstream & os, OutputParams const & runparams) const
|
|||||||
LYXERR(Debug::LATEX, "exportfile:" << exportfile);
|
LYXERR(Debug::LATEX, "exportfile:" << exportfile);
|
||||||
LYXERR(Debug::LATEX, "writefile:" << writefile);
|
LYXERR(Debug::LATEX, "writefile:" << writefile);
|
||||||
|
|
||||||
tmp->makeDocBookFile(writefile, runparams, true);
|
tmp->makeDocBookFile(writefile, runparams, Buffer::OnlyBody);
|
||||||
}
|
}
|
||||||
|
|
||||||
runparams.exportdata->addExternalFile("docbook", writefile,
|
runparams.exportdata->addExternalFile("docbook", writefile,
|
||||||
|
@ -36,6 +36,7 @@ What's new
|
|||||||
|
|
||||||
- Graphics insets show filename as a tooltip now.
|
- Graphics insets show filename as a tooltip now.
|
||||||
|
|
||||||
|
- New option to show only the preamble when viewing source (bug 7860).
|
||||||
|
|
||||||
|
|
||||||
* DOCUMENTATION AND LOCALIZATION
|
* DOCUMENTATION AND LOCALIZATION
|
||||||
|
Loading…
Reference in New Issue
Block a user