-----------------------
+2019-12-24 Jürgen Spitzmüller <spitz@lyx.org>
+ * Format incremented to 590: Add native changebar solution via buffer param
+ \change_bars.
+
2019-08-14 Jürgen Spitzmüller <spitz@lyx.org>
* Format incremented to 589: Height now is totalheight in graphics.
layouts/bxjsbook.layout \
layouts/bxjsreport.layout \
layouts/bxjsslide.layout \
- layouts/changebars.module \
layouts/chess.layout \
layouts/chessboard.module \
layouts/cl2emult.layout \
\TestPackage{CJK}
\TestPackage{calc}
\TestPackage{cancel}
+\TestPackage{changebar}
\TestPackage{chapterbib}
\TestPackage{chemgreek}
\TestPackage{chessboard}
#LyX 2.4 created this file. For more info see https://www.lyx.org/
-\lyxformat 583
+\lyxformat 590
\begin_document
\begin_header
\save_transient_properties true
\tablestyle default
\tracking_changes true
\output_changes false
+\change_bars false
\html_math_output 0
\html_css_as_file 0
\html_be_strict true
\end_layout
\begin_layout Standard
+
+\change_deleted -712698321 1577206802
To show the changes made in the output you need the \SpecialChar LaTeX
package
\series bold
or in the package manager of your \SpecialChar LaTeX
-system.
+\change_unchanged
+
\end_layout
\begin_layout Section
manual.
\end_layout
+\begin_layout Section
+
+\change_inserted -712698321 1577206827
+Change Tracking
+\end_layout
+
+\begin_layout Standard
+
+\change_inserted -712698321 1577206929
+Here you can do some settings related to change tracking (see sec.
+\begin_inset space ~
+\end_inset
+
+
+\begin_inset CommandInset ref
+LatexCommand ref
+reference "sec:Change-Tracking"
+plural "false"
+caps "false"
+noprefix "false"
+
+\end_inset
+
+).
+ Alternatively to the menu or toolbar, you can set here whether changes
+ are being tracked and whether they are shown in the output.
+\end_layout
+
+\begin_layout Standard
+
+\change_inserted -712698321 1577207214
+Additionally, you can advise LyX to place a change bar in the margin of
+ the output.
+ This might be useful to make changed passages more salient.
+\end_layout
+
\begin_layout Section
Numbering & TOC
\end_layout
#LyX 2.4 created this file. For more info see https://www.lyx.org/
-\lyxformat 583
+\lyxformat 590
\begin_document
\begin_header
\save_transient_properties true
\tablestyle default
\tracking_changes false
\output_changes false
+\change_bars false
\html_math_output 0
\html_css_as_file 0
\html_be_strict false
diese zur Beschreibung einer Änderung oft wichtig sind.
\end_layout
-\begin_layout Standard
-Um Änderungen in der Druckausgabe anzeigen zu können, benötigen Sie das
- \SpecialChar LaTeX
--Paket
-\series bold
-dvipost
-\series default
-
-\begin_inset Index idx
-status collapsed
-
-\begin_layout Plain Layout
-\SpecialChar LaTeX
--Paket ! dvipost
-\end_layout
-
-\end_inset
-
-.
- Sie finden es im \SpecialChar TeX
--Katalog,
-\begin_inset CommandInset citation
-LatexCommand cite
-key "TeX-Katalog"
-literal "true"
-
-\end_inset
-
-, oder im Paket-Manager Ihres \SpecialChar LaTeX
--Systems.
-\end_layout
-
\begin_layout Section
Vergleich von Dokumenten
\begin_inset CommandInset label
Handbuchs erklärt.
\end_layout
+\begin_layout Section
+Änderungsverfolgung
+\end_layout
+
+\begin_layout Standard
+Hier können Sie einige Einstellungen zur Änderungsverfolgung (vgl.
+ Abschnitt
+\begin_inset space ~
+\end_inset
+
+
+\begin_inset CommandInset ref
+LatexCommand ref
+reference "sec:Änderungsverfolgung"
+plural "false"
+caps "false"
+noprefix "false"
+
+\end_inset
+
+) vornehmen.
+ Alternativ zum Menü und der Werkzeugleiste können Sie hier bestimmen, ob
+ Änderungen aufgezeichnet werden und ob sie in der Ausgabe angezeigt werden.
+\end_layout
+
+\begin_layout Standard
+Zusätzlich können Sie hier einen Änderungsbalken aktivieren, der in der
+ Ausgabe in den Seitenrand gedruckt wird, um geänderte Stellen sichtbarer
+ zu machen.
+\end_layout
+
\begin_layout Section
Nummerierung
\begin_inset space ~
+++ /dev/null
-#\DeclareLyXModule[changebar.sty]{Change Tracking Bars}
-#\DeclareCategory{Annotation & Revision}
-#
-#DescriptionBegin
-#Enables LyX to add vertical change bars in the margin of PDF output
-#when Show Changes in Output is turned on and pdflatex output format is chosen.
-#DescriptionEnd
-#
-#Author: Paul A. Rubin (rubin@msu.edu)
-#Based on code proposed by Juergen Spitzmueller
-#(http://comments.gmane.org/gmane.editors.lyx.general/66666).
-#
-# Note: the \providecommand statements are necessary to avoid
-# error messages from the \renewcommand statements if change
-# tracking is turned off in the document.
-#
-
-Format 80
-
-AddToPreamble
- \usepackage{changebar}
- \providecommand{\lyxadded}[4][]{}
- \providecommand{\lyxdeleted}{}
- \renewcommand{\lyxadded}[4][]{
- {\protect\cbstart\color{lyxadded}{}#4\protect\cbend}
- }
- \renewcommand{\lyxdeleted}[4][]{%
- {\protect\cbstart\color{lyxdeleted}\sout{#4}\protect\cbend}
- }
-EndPreamble
document.body.insert(k, "\theight " + newheight)
i = j + 1
+
+def convert_changebars(document):
+ " Converts the changebars module to native solution "
+
+ if not "changebars" in document.get_module_list():
+ return
+
+ i = find_token(document.header, "\\output_changes", 0)
+ if i == -1:
+ document.warning("Malformed LyX document! Missing \\output_changes header.")
+ document.del_module("changebars")
+ return
+
+ document.header.insert(i, "\\change_bars true")
+ document.del_module("changebars")
+
+
+def revert_changebars(document):
+ " Converts native changebar param to module "
+
+ i = find_token(document.header, "\\change_bars", 0)
+ if i == -1:
+ document.warning("Malformed LyX document! Missing \\change_bars header.")
+ return
+
+ val = get_value(document.header, "\\change_bars", i)
+
+ if val == "true":
+ document.add_module("changebars")
+
+ del document.header[i]
+
+
##
# Conversion hub
#
[586, []],
[587, [convert_pagesizenames]],
[588, []],
- [589, [convert_totalheight]]
+ [589, [convert_totalheight]],
+ [590, [convert_changebars]]
]
-revert = [[588, [revert_totalheight]],
+revert = [[589, [revert_changebars]],
+ [588, [revert_totalheight]],
[587, [revert_memoir_endnotes,revert_enotez,revert_theendnotes]],
[586, [revert_pagesizenames]],
[585, [revert_dupqualicites]],
/// If there was an error when previewing, on the next preview we do
/// a fresh compile (e.g. in case the user installed a package that
/// was missing).
- bool preview_error_;
+ bool require_fresh_start_;
/// Cache the references associated to a label and their positions
/// in the buffer.
file_fully_loaded(false), file_format(LYX_FORMAT), need_format_backup(false),
ignore_parent(false), toc_backend(owner), macro_lock(false),
checksum_(0), wa_(0), gui_(0), undo_(*owner), bibinfo_cache_valid_(false),
- cite_labels_valid_(false), have_bibitems_(false), preview_error_(false),
+ cite_labels_valid_(false), have_bibitems_(false), require_fresh_start_(false),
inset(0), preview_loader_(0), cloned_buffer_(cloned_buffer),
clone_list_(0), doing_export(false),
tracked_changes_present_(0), externally_modified_(false), parent_buffer(0),
layout_position = cloned_buffer_->d->layout_position;
preview_file_ = cloned_buffer_->d->preview_file_;
preview_format_ = cloned_buffer_->d->preview_format_;
- preview_error_ = cloned_buffer_->d->preview_error_;
+ require_fresh_start_ = cloned_buffer_->d->require_fresh_start_;
tracked_changes_present_ = cloned_buffer_->d->tracked_changes_present_;
}
}
-bool Buffer::lastPreviewError() const
+bool Buffer::freshStartRequired() const
{
- return d->preview_error_;
+ return d->require_fresh_start_;
+}
+
+void Buffer::requireFreshStart(bool const b) const
+{
+ d->require_fresh_start_ = b;
}
Impl * theimpl = isClone() ? d->cloned_buffer_->d : d;
theimpl->preview_file_ = previewFile;
theimpl->preview_format_ = format;
- theimpl->preview_error_ = (status != ExportSuccess);
+ theimpl->require_fresh_start_ = (status != ExportSuccess);
if (status != ExportSuccess)
return status;
ExportStatus preview(std::string const & format) const;
/// true if there was a previous preview this session of this buffer and
/// there was an error on the previous preview of this buffer.
- bool lastPreviewError() const;
+ bool freshStartRequired() const;
+ ///
+ void requireFreshStart(bool const b) const;
private:
///
save_transient_properties = true;
track_changes = false;
output_changes = false;
+ change_bars = false;
use_default_options = true;
maintain_unincluded_children = false;
secnumdepth = 3;
lex >> track_changes;
} else if (token == "\\output_changes") {
lex >> output_changes;
+ } else if (token == "\\change_bars") {
+ lex >> change_bars;
} else if (token == "\\branch") {
lex.eatLine();
docstring branch = lex.getDocString();
<< (save_transient_properties ? convert<string>(output_changes) : "false")
<< '\n';
+ os << "\\change_bars "
+ << (save_transient_properties ? convert<string>(change_bars) : "false")
+ << '\n';
+
os << "\\html_math_output " << html_math_output << '\n'
<< "\\html_css_as_file " << html_css_as_file << '\n'
<< "\\html_be_strict " << convert<string>(html_be_strict) << '\n';
default:
break;
}
+ if (change_bars)
+ features.require("changebar");
}
// Floats with 'Here definitely' as default setting.
*/
bool output_changes;
///
+ bool change_bars;
+ ///
bool compressed;
/// the author list for the document
string const name = buffer.latexName();
LaTeX latex(command, runparams, FileName(makeAbsPath(name)),
buffer.filePath(), buffer.layoutPos(),
- buffer.isClone(), buffer.lastPreviewError());
+ buffer.isClone(), buffer.freshStartRequired());
TeXErrors terr;
// The connection closes itself at the end of the scope when latex is
// destroyed. One cannot close (and destroy) buffer while the converter is
"\\newcommand{\\lyxdot}{.}\n");
static docstring const changetracking_dvipost_def = from_ascii(
+ "%% Change tracking with dvipost\n"
+ "\\dvipostlayout\n"
+ "\\dvipost{osstart color push Red}\n"
+ "\\dvipost{osend color pop}\n"
+ "\\dvipost{cbstart color push Blue}\n"
+ "\\dvipost{cbrule 0pt}\n"
+ "\\dvipost{cbend color pop}\n"
+ "\\DeclareRobustCommand{\\lyxadded}[4][]{\\changestart#4\\changeend}\n"
+ "\\DeclareRobustCommand{\\lyxdeleted}[4][]{%\n"
+ "\\changestart\\overstrikeon#4\\overstrikeoff\\changeend}\n");
+
+static docstring const changetracking_dvipost_cb_def = from_ascii(
"%% Change tracking with dvipost\n"
"\\dvipostlayout\n"
"\\dvipost{osstart color push Red}\n"
"\\DeclareRobustCommand{\\lyxdeleted}[4][]{{\\color{lyxdeleted}\\lyxsout{#4}}}\n"
"\\DeclareRobustCommand{\\lyxsout}[1]{\\ifx\\\\#1\\else\\sout{#1}\\fi}\n");
+static docstring const changetracking_xcolor_ulem_cb_def = from_ascii(
+ "%% Change tracking with ulem and changebars\n"
+ "\\DeclareRobustCommand{\\lyxadded}[4][]{{%\n"
+ " \\protect\\cbstart\\color{lyxadded}{}#4%\n"
+ " \\protect\\cbend%\n"
+ "}}\n"
+ "\\DeclareRobustCommand{\\lyxdeleted}[4][]{{%\n"
+ " \\protect\\cbstart\\color{lyxdeleted}\\lyxsout{#4}%\n"
+ " \\protect\\cbend%\n"
+ "}}\n"
+ "\\DeclareRobustCommand{\\lyxsout}[1]{\\ifx\\\\#1\\else\\sout{#1}\\fi}\n");
+
static docstring const changetracking_xcolor_ulem_hyperref_def = from_ascii(
- "%% Change tracking with ulem\n"
+ "%% Change tracking with ulem and hyperref\n"
"\\DeclareRobustCommand{\\lyxadded}[4][]{{\\texorpdfstring{\\color{lyxadded}{}}{}#4}}\n"
"\\DeclareRobustCommand{\\lyxdeleted}[4][]{{\\texorpdfstring{\\color{lyxdeleted}\\lyxsout{#4}}{}}}\n"
"\\DeclareRobustCommand{\\lyxsout}[1]{\\ifx\\\\#1\\else\\sout{#1}\\fi}\n");
+static docstring const changetracking_xcolor_ulem_hyperref_cb_def = from_ascii(
+ "%% Change tracking with ulem, hyperref and changebars\n"
+ "\\DeclareRobustCommand{\\lyxadded}[4][]{{%\n"
+ " \\texorpdfstring{\\protect\\cbstart\\color{lyxadded}{}}{}#4%\n"
+ " \\texorpdfstring{\\protect\\cbend}{}%/n"
+ "}}\n"
+ "\\DeclareRobustCommand{\\lyxdeleted}[4][]{{%\n"
+ " \\texorpdfstring{\\protect\\cbstart\\color{lyxdeleted}\\lyxsout{#4}%\n"
+ " \\protect\\cbend}{}%\n"
+ "}}\n"
+ "\\DeclareRobustCommand{\\lyxsout}[1]{\\ifx\\\\#1\\else\\sout{#1}\\fi}\n");
+
static docstring const changetracking_tikz_math_sout_def = from_ascii(
"%% Strike out display math with tikz\n"
"\\usepackage{tikz}\n"
// The rest of these packages are somewhat more complicated
// than those above.
+ if (mustProvide("changebar") && !mustProvide("ct-dvipost")) {
+ packages << "\\usepackage{changebar}\n";
+ }
+
if (mustProvide("footnote")) {
if (isRequired("hyperref"))
packages << "\\usepackage{footnotehyper}\n";
macros << lyxref_def << '\n';
// change tracking
- if (mustProvide("ct-dvipost"))
- macros << changetracking_dvipost_def;
+ if (mustProvide("ct-dvipost")) {
+ if (isRequired("changebar"))
+ macros << changetracking_dvipost_cb_def;
+ else
+ macros << changetracking_dvipost_def;
+ }
if (mustProvide("ct-xcolor-ulem")) {
streamsize const prec = macros.os().precision(2);
macros.os().precision(prec);
- if (isRequired("hyperref"))
- macros << changetracking_xcolor_ulem_hyperref_def;
- else
- macros << changetracking_xcolor_ulem_def;
+ if (isRequired("changebar")) {
+ if (isRequired("hyperref"))
+ macros << changetracking_xcolor_ulem_hyperref_cb_def;
+ else
+ macros << changetracking_xcolor_ulem_cb_def;
+ } else {
+ if (isRequired("hyperref"))
+ macros << changetracking_xcolor_ulem_hyperref_def;
+ else
+ macros << changetracking_xcolor_ulem_def;
+ }
}
if (mustProvide("ct-tikz-math-sout"))
- macros << changetracking_tikz_math_sout_def;
+ macros << changetracking_tikz_math_sout_def;
if (mustProvide("ct-none"))
macros << changetracking_none_def;
connect(colorModule->delBoxBackgroundTB, SIGNAL(clicked()),
this, SLOT(deleteBoxBackgroundColor()));
+ // change tracking
+ changesModule = new UiWidget<Ui::ChangeTrackingUi>(this);
+ connect(changesModule->trackChangesCB, SIGNAL(clicked()),
+ this, SLOT(change_adaptor()));
+ connect(changesModule->outputChangesCB, SIGNAL(clicked()),
+ this, SLOT(change_adaptor()));
+ connect(changesModule->changeBarsCB, SIGNAL(clicked()),
+ this, SLOT(change_adaptor()));
// numbering
numberingModule = new UiWidget<Ui::NumberingUi>(this);
docPS->addPanel(marginsModule, N_("Page Margins"));
docPS->addPanel(langModule, N_("Language"));
docPS->addPanel(colorModule, N_("Colors"));
+ docPS->addPanel(changesModule, N_("Change Tracking"));
docPS->addPanel(numberingModule, N_("Numbering & TOC"));
docPS->addPanel(biblioModule, N_("Bibliography"));
docPS->addPanel(indicesModule, N_("Indexes"));
pdf.quoted_options = pdf.quoted_options_check(
fromqstr(pdfSupportModule->optionsLE->text()));
+ // change tracking
+ bp_.track_changes = changesModule->trackChangesCB->isChecked();
+ bp_.output_changes = changesModule->outputChangesCB->isChecked();
+ bool const cb_switched_off = (bp_.change_bars
+ && !changesModule->changeBarsCB->isChecked());
+ bp_.change_bars = changesModule->changeBarsCB->isChecked();
+ if (cb_switched_off)
+ // if change bars have been switched off,
+ // we need to ditch the aux file
+ buffer().requireFreshStart(true);
+
// reset trackers
nonModuleChanged_ = false;
shellescapeChanged_ = false;
pdfSupportModule->optionsLE->setText(
toqstr(pdf.quoted_options));
+ // change tracking
+ changesModule->trackChangesCB->setChecked(bp_.track_changes);
+ changesModule->outputChangesCB->setChecked(bp_.output_changes);
+ changesModule->changeBarsCB->setChecked(bp_.change_bars);
+
// Make sure that the bc is in the INITIAL state
if (bc().policy().buttonStatus(ButtonPolicy::RESTORE))
bc().restore();
#include "ui_BiblioUi.h"
#include "ui_ColorUi.h"
+#include "ui_ChangeTrackingUi.h"
#include "ui_DocumentUi.h"
#include "ui_FontUi.h"
#include "ui_LanguageUi.h"
UiWidget<Ui::MarginsUi> *marginsModule;
UiWidget<Ui::LanguageUi> *langModule;
UiWidget<Ui::ColorUi> *colorModule;
+ UiWidget<Ui::ChangeTrackingUi> *changesModule;
UiWidget<Ui::NumberingUi> *numberingModule;
UiWidget<Ui::BiblioUi> *biblioModule;
UiWidget<Ui::MathsUi> *mathsModule;
BranchUi.ui \
BulletsUi.ui \
ChangesUi.ui \
+ ChangeTrackingUi.ui \
CharacterUi.ui \
CitationUi.ui \
ColorUi.ui \
//h_notefontcolor;
//h_options;
h_output_changes = "false";
+ h_change_bars = "false";
h_output_sync = "0";
//h_output_sync_macro
h_papercolumns = "1";
}
}
+ else if (name == "changebar")
+ h_output_changes = "true";
+
else if (!in_lyx_preamble) {
if (options.empty())
h_preamble << "\\usepackage{" << name << '}';
os << "\\listings_params " << h_listings_params << "\n";
os << "\\tracking_changes " << h_tracking_changes << "\n"
<< "\\output_changes " << h_output_changes << "\n"
+ << "\\change_bars " << h_change_bars << "\n"
<< "\\html_math_output " << h_html_math_output << "\n"
<< "\\html_css_as_file " << h_html_css_as_file << "\n"
<< "\\html_be_strict " << h_html_be_strict << "\n"
std::string h_notefontcolor;
std::string h_options;
std::string h_output_changes;
+ std::string h_change_bars;
std::string h_output_sync;
std::string h_output_sync_macro;
std::string h_papercolumns;
// Do not remove the comment below, so we get merge conflict in
// independent branches. Instead add your own.
-#define LYX_FORMAT_LYX 589 // spitz: height > totalheight
-#define LYX_FORMAT_TEX2LYX 589
+#define LYX_FORMAT_LYX 590 // spitz: changebars
+#define LYX_FORMAT_TEX2LYX 590
#if LYX_FORMAT_TEX2LYX != LYX_FORMAT_LYX
#ifndef _MSC_VER