Jean-Marc Lasgouttes wrote:

Michael> When I started to relabel a few variables, I noticed that
Michael> many of their uses will be removed in the long run. If I am
Michael> able to remove their use instantly (breaking CT sooner than
Michael> later), this will make thing much easier for me.

Why not just skip the relabel part?
Relabeling is fine as it points me to those places that have to be fixed. Please note that Abdel moved a lot of code from one file to another. Some of my previous change got lost this way :-(

To give you an impression of what I am going to do, here comes a first patch. It changes two variables in conformance to the LyX coding rules and - on that occasion - fixes a couple of places and adds FIXME markers to a couple of other places. If I am not allowed to do such things, I am afraid I will never manage to change the CT code. Please note that I did more or less the same changes at least twice in the past but did not really succeed in getting the code in the trunk.

Please veto now. Otherwise, the patch is on its way :-)

Michael
Index: src/insets/insettabular.C
===================================================================
--- src/insets/insettabular.C	(Revision 15260)
+++ src/insets/insettabular.C	(Arbeitskopie)
@@ -1847,7 +1847,8 @@
 		for (col_type j = cs; j <= ce; ++j) {
 			shared_ptr<InsetText> t
 				= cell(tabular.getCellNumber(i, j));
-			if (cur.buffer().params().tracking_changes)
+			if (cur.buffer().params().trackChanges)
+				// FIXME: Change tracking (MG)
 				t->markErased(true);
 			else
 				t->clear();
Index: src/insets/insettext.C
===================================================================
--- src/insets/insettext.C	(Revision 15260)
+++ src/insets/insettext.C	(Arbeitskopie)
@@ -80,8 +80,6 @@
 {
 	paragraphs().push_back(Paragraph());
 	paragraphs().back().layout(bp.getLyXTextClass().defaultLayout());
-	if (bp.tracking_changes)
-		paragraphs().back().trackChanges();
 	// Dispose of the infamous L-shaped cursor.
 	text_.current_font.setLanguage(bp.language);
 	text_.real_current_font.setLanguage(bp.language);
@@ -155,12 +153,6 @@
 {
 	clear();
 
-#ifdef WITH_WARNINGS
-#warning John, look here. Doesnt make much sense.
-#endif
-	if (buf.params().tracking_changes)
-		paragraphs().begin()->trackChanges();
-
 	// delete the initial paragraph
 	Paragraph oldpar = *paragraphs().begin();
 	paragraphs().clear();
Index: src/paragraph_pimpl.C
===================================================================
--- src/paragraph_pimpl.C	(Revision 15260)
+++ src/paragraph_pimpl.C	(Arbeitskopie)
@@ -533,7 +533,7 @@
 		// if dvipost is installed,
 		// and with dvi/ps (other formats don't work)
 		LaTeXFeatures features(buf, bparams, runparams);
-		bool const output = bparams.output_changes
+		bool const output = bparams.outputChanges
 			&& runparams.flavor == OutputParams::LATEX
 			&& features.isAvailable("dvipost");
 
Index: src/buffer.C
===================================================================
--- src/buffer.C	(Revision 15260)
+++ src/buffer.C	(Arbeitskopie)
@@ -1106,8 +1106,7 @@
 {
 	LyXTextClass const & tclass = params().getLyXTextClass();
 
-	if (features.isAvailable("dvipost") && params().tracking_changes
-	    && params().output_changes)
+	if (features.isAvailable("dvipost") && params().outputChanges)
 		features.require("dvipost");
 
 	// AMS Style is at document level
Index: src/CutAndPaste.C
===================================================================
--- src/CutAndPaste.C	(Revision 15260)
+++ src/CutAndPaste.C	(Arbeitskopie)
@@ -210,10 +210,8 @@
 		}
 
 		// reset change tracking status
-		if (buffer.params().tracking_changes)
-			tmpbuf->cleanChanges(Paragraph::trackingOn);
-		else
-			tmpbuf->cleanChanges(Paragraph::trackingOff);
+		// FIXME: Change tracking (MG)
+		// tmpbuf->cleanChanges(Paragraph::trackingOn/Off);
 	}
 
 	bool const empty = pars[pit].empty();
@@ -319,7 +317,8 @@
 	// only if either (1) change tracking is off, or (2) the para break
 	// is "blue"
 	for (pit_type pit = startpit; pit != endpit + 1;) {
-		bool const merge = !params.tracking_changes ||
+		// FIXME: Change tracking (MG)
+		bool const merge = !params.trackChanges ||
 			pars[pit].lookupChange(pars[pit].size()) ==
 			Change::INSERTED;
 		pos_type const left  = ( pit == startpit ? startpos : 0 );
Index: src/lyxfunc.C
===================================================================
--- src/lyxfunc.C	(Revision 15260)
+++ src/lyxfunc.C	(Arbeitskopie)
@@ -639,8 +639,7 @@
 	}
 
 	// Are we in a DELETED change-tracking region?
-	if (buf && buf->params().tracking_changes
-	    && lookupChangeType(cur, true) == Change::DELETED
+	if (buf && lookupChangeType(cur, true) == Change::DELETED
 	    && !lyxaction.funcHasFlag(cmd.action, LyXAction::ReadOnly)
 	    && !lyxaction.funcHasFlag(cmd.action, LyXAction::NoBuffer)) {
 		flag.message(lyx::from_utf8(N_("This portion of the document is deleted.")));
Index: src/bufferparams.C
===================================================================
--- src/bufferparams.C	(Revision 15260)
+++ src/bufferparams.C	(Arbeitskopie)
@@ -300,8 +300,8 @@
 	use_amsmath = AMS_AUTO;
 	cite_engine = biblio::ENGINE_BASIC;
 	use_bibtopic = false;
-	tracking_changes = false;
-	output_changes = false;
+	trackChanges = false;
+	outputChanges = false;
 	secnumdepth = 3;
 	tocdepth = 3;
 	language = default_language;
@@ -490,9 +490,9 @@
 	} else if (token == "\\use_bibtopic") {
 		lex >> use_bibtopic;
 	} else if (token == "\\tracking_changes") {
-		lex >> tracking_changes;
+		lex >> trackChanges;
 	} else if (token == "\\output_changes") {
-		lex >> output_changes;
+		lex >> outputChanges;
 	} else if (token == "\\branch") {
 		lex.next();
 		string branch = lex.getString();
@@ -699,10 +699,11 @@
 		}
 	}
 
-	os << "\\tracking_changes " << convert<string>(tracking_changes) << "\n";
-	os << "\\output_changes " << convert<string>(output_changes) << "\n";
+	os << "\\tracking_changes " << convert<string>(trackChanges) << "\n";
+	os << "\\output_changes " << convert<string>(outputChanges) << "\n";
 
-	if (tracking_changes) {
+	if (trackChanges) {
+		// FIXME: Change tracking (MG)
 		AuthorList::Authors::const_iterator it = pimpl_->authorlist.begin();
 		AuthorList::Authors::const_iterator end = pimpl_->authorlist.end();
 		for (; it != end; ++it) {
@@ -1084,7 +1085,7 @@
 	lyxpreamble += "\\makeatother\n";
 
 	// dvipost settings come after everything else
-	if (features.isAvailable("dvipost") && tracking_changes && output_changes) {
+	if (features.isAvailable("dvipost") && outputChanges) {
 		lyxpreamble +=
 			"\\dvipostlayout\n"
 			"\\dvipost{osstart color push Red}\n"
Index: src/tabular.C
===================================================================
--- src/tabular.C	(Revision 15260)
+++ src/tabular.C	(Arbeitskopie)
@@ -495,7 +495,8 @@
 	for (row_type i = row + 2; i < rows_; ++i)
 		swap(cell_info[i], old[i - 1]);
 
-	if (bp.tracking_changes)
+	if (bp.trackChanges)
+		// FIXME: Change Tracking (MG)
 		for (col_type j = 0; j < columns_; ++j)
 			cell_info[row + 1][j].inset->markNew(true);
 
@@ -523,7 +524,8 @@
 	row_info.insert(row_info.begin() + row, row_info[row]);
 	cell_info.insert(cell_info.begin() + row, cell_info[row]);
 
-	if (bp.tracking_changes)
+	if (bp.trackChanges)
+		// FIXME: Change Tracking (MG)
 		for (col_type j = 0; j < columns_; ++j)
 			cell_info[row + 1][j].inset->markNew(true);
 
@@ -555,7 +557,8 @@
 	//++column;
 	for (row_type i = 0; i < rows_; ++i) {
 		cell_info[i][column + 1].inset->clear();
-		if (bp.tracking_changes)
+		if (bp.trackChanges)
+			// FIXME: Change Tracking (MG)
 			cell_info[i][column + 1].inset->markNew(true);
 	}
 	fixCellNums();
@@ -585,7 +588,8 @@
 	for (row_type i = 0; i < rows_; ++i)
 		cell_info[i].insert(cell_info[i].begin() + column, cell_info[i][column]);
 
-	if (bp.tracking_changes)
+	if (bp.trackChanges)
+		// FIXME: Change Tracking (MG)
 		for (row_type i = 0; i < rows_; ++i)
 			cell_info[i][column + 1].inset->markNew(true);
 	fixCellNums();
Index: src/paragraph_funcs.C
===================================================================
--- src/paragraph_funcs.C	(Revision 15260)
+++ src/paragraph_funcs.C	(Arbeitskopie)
@@ -110,9 +110,6 @@
 	// remember to set the inset_owner
 	tmp->setInsetOwner(par.inInset());
 
-	if (bparams.tracking_changes)
-		tmp->trackChanges();
-
 	// this is an idea for a more userfriendly layout handling, I will
 	// see what the users say
 
@@ -187,7 +184,8 @@
 	}
 
 	// subtle, but needed to get empty pars working right
-	if (bparams.tracking_changes) {
+	if (bparams.trackChanges) {
+		// FIXME: Change tracking (MG)
 		if (!par.size()) {
 			par.cleanChanges();
 		} else if (!tmp->size()) {
@@ -205,9 +203,6 @@
 				       Paragraph());
 	Paragraph & par = pars[par_offset];
 
-	if (bparams.tracking_changes)
-		tmp.trackChanges();
-
 	tmp.makeSameLayout(par);
 
 	// When can pos > size()?
@@ -228,7 +223,8 @@
 		// If tracking changes, set all the text that is to be
 		// erased to Type::INSERTED.
 		for (pos_type k = pos_end; k >= pos; --k) {
-			if (bparams.tracking_changes)
+			if (bparams.trackChanges)
+				// FIXME: Change tracking (MG)
 				par.setChange(k, Change::INSERTED);
 			par.erase(k);
 		}
Index: src/text3.C
===================================================================
--- src/text3.C	(Revision 15260)
+++ src/text3.C	(Arbeitskopie)
@@ -1708,7 +1708,7 @@
 
 	case LFUN_CHANGE_ACCEPT:
 	case LFUN_CHANGE_REJECT:
-		enable = cur.buffer().params().tracking_changes;
+		enable = true; // FIXME: Change tracking (MG)
 		break;
 
 	case LFUN_WORD_DELETE_FORWARD:
Index: src/bufferparams.h
===================================================================
--- src/bufferparams.h	(Revision 15260)
+++ src/bufferparams.h	(Arbeitskopie)
@@ -226,15 +226,15 @@
 	///
 	bool use_bibtopic;
 	/// revision tracking for this buffer ?
-	bool tracking_changes;
+	bool trackChanges;
 	/** This param decides whether change tracking marks should be output
 	 *  (using the dvipost package) or if the current "state" of the
 	 *  document should be output instead. Since dvipost needs dvi
 	 *  specials, it only works with dvi/ps output (the param will be
-	 *  ignored with other output flavors and disabled when dbipost is
+	 *  ignored with other output flavors and disabled when dvipost is
 	 *  not installed).
 	 */
-	bool output_changes;
+	bool outputChanges;
 	/// Time ago we agreed that this was a buffer property [ale990407]
 	std::string parentname;
 	///
Index: src/BufferView.C
===================================================================
--- src/BufferView.C	(Revision 15260)
+++ src/BufferView.C	(Arbeitskopie)
@@ -501,7 +501,8 @@
 
 Change const BufferView::getCurrentChange()
 {
-	if (!buffer_->params().tracking_changes || !cursor_.selection())
+	if (!buffer_->params().trackChanges || !cursor_.selection())
+		// FIXME: Change tracking (MG)
 		return Change(Change::UNCHANGED);
 
 	DocIterator dit = cursor_.selectionBegin();
@@ -664,15 +665,14 @@
 
 	case LFUN_CHANGES_TRACK:
 		flag.enabled(true);
-		flag.setOnOff(buffer_->params().tracking_changes);
+		flag.setOnOff(buffer_->params().trackChanges);
 		break;
 
 	case LFUN_CHANGES_OUTPUT: {
 		OutputParams runparams;
 		LaTeXFeatures features(*buffer_, buffer_->params(), runparams);
-		flag.enabled(buffer_ && buffer_->params().tracking_changes
-			&& features.isAvailable("dvipost"));
-		flag.setOnOff(buffer_->params().output_changes);
+		flag.enabled(buffer_ && features.isAvailable("dvipost"));
+		flag.setOnOff(buffer_->params().outputChanges);
 		break;
 	}
 
@@ -680,7 +680,7 @@
 	case LFUN_CHANGE_NEXT:
 	case LFUN_ALL_CHANGES_ACCEPT:
 	case LFUN_ALL_CHANGES_REJECT:
-		flag.enabled(buffer_ && buffer_->params().tracking_changes);
+		flag.enabled(buffer_);
 		break;
 
 	case LFUN_BUFFER_TOGGLE_COMPRESSION: {
@@ -832,12 +832,11 @@
 	}
 
 	case LFUN_CHANGES_TRACK:
-		trackChanges();
+		buffer_->params().trackChanges = !buffer_->params().trackChanges;
 		break;
 
 	case LFUN_CHANGES_OUTPUT: {
-		bool const state = buffer_->params().output_changes;
-		buffer_->params().output_changes = !state;
+		buffer_->params().outputChanges = !buffer_->params().outputChanges;
 		break;
 	}
 
@@ -1426,33 +1425,3 @@
 	buffer_->errors("Parse");
 	resize();
 }
-
-
-void BufferView::trackChanges()
-{
-	bool const tracking = buffer_->params().tracking_changes;
-
-	if (!tracking) {
-		for_each(buffer_->par_iterator_begin(),
-			 buffer_->par_iterator_end(),
-			 bind(&Paragraph::trackChanges, _1, Change::UNCHANGED));
-		buffer_->params().tracking_changes = true;
-
-		// We cannot allow undos beyond the freeze point
-		buffer_->undostack().clear();
-	} else {
-		cursor_.setCursor(doc_iterator_begin(buffer_->inset()));
-		if (lyx::find::findNextChange(this)) {
-			showDialog("changes");
-			return;
-		}
-
-		for_each(buffer_->par_iterator_begin(),
-			 buffer_->par_iterator_end(),
-			 mem_fun_ref(&Paragraph::untrackChanges));
-
-		buffer_->params().tracking_changes = false;
-	}
-
-	buffer_->redostack().clear();
-}
Index: src/BufferView.h
===================================================================
--- src/BufferView.h	(Revision 15260)
+++ src/BufferView.h	(Arbeitskopie)
@@ -236,9 +236,6 @@
 	///
 	ScrollbarParameters scrollbarParameters_;
 
-	/// track changes for the document
-	void trackChanges();
-
 	///
 	ViewMetricsInfo metrics_info_;
 
Index: src/paragraph.C
===================================================================
--- src/paragraph.C	(Revision 15260)
+++ src/paragraph.C	(Arbeitskopie)
@@ -894,7 +894,7 @@
 	// output change tracking marks only if desired,
 	// if dvipost is installed,
 	// and with dvi/ps (other formats don't work)
-	bool const output = bparams.output_changes
+	bool const output = bparams.outputChanges
 		&& runparams.flavor == OutputParams::LATEX
 		&& features.isAvailable("dvipost");
 
Index: src/text.C
===================================================================
--- src/text.C	(Revision 15260)
+++ src/text.C	(Arbeitskopie)
@@ -1170,7 +1170,7 @@
 	updateLabels(cur.buffer(), current_it, last_it);
 
 	// Mark "carriage return" as inserted if change tracking:
-	if (cur.buffer().params().tracking_changes) {
+	if (cur.buffer().params().trackChanges) {
 		cur.paragraph().setChange(cur.paragraph().size(),
 			Change::INSERTED);
 	}
@@ -1670,7 +1670,7 @@
 		if (pars_[cur.pit()].layout() == pars_[scur.pit()].layout()) {
 			recordUndo(scur, Undo::DELETE, scur.pit());
 			needsUpdate = backspace(cur);
-			if (cur.buffer().params().tracking_changes) {
+			if (cur.buffer().params().trackChanges) {
 				// move forward after the paragraph break is DELETED
 				Paragraph & par = cur.paragraph();
 				if (par.lookupChange(par.size()) == Change::DELETED)
@@ -1774,7 +1774,7 @@
 		// the the backspace will collapse two paragraphs into
 		// one.
 
-		if (cur.pit() != 0 && cur.buffer().params().tracking_changes) {
+		if (cur.pit() != 0 && cur.buffer().params().trackChanges) {
 			// Previous paragraph, mark "carriage return" as
 			// deleted:
 			Paragraph & par = pars_[cur.pit() - 1];
@@ -2214,8 +2214,6 @@
 
 			Paragraph par;
 			par.params().depth(depth);
-			if (buf.params().tracking_changes)
-				par.trackChanges();
 			par.setFont(0, LyXFont(LyXFont::ALL_INHERIT, buf.params().language));
 			pars_.push_back(par);
 
@@ -2372,10 +2370,9 @@
 	Paragraph const & par = cur.paragraph();
 	std::ostringstream os;
 
-	bool const show_change = buf.params().tracking_changes
-		&& par.lookupChange(cur.pos()) != Change::UNCHANGED;
+	bool const show_change = par.lookupChange(cur.pos()) != Change::UNCHANGED;
 
-	if (buf.params().tracking_changes)
+	if (buf.params().trackChanges)
 		os << "[C] ";
 
 	if (show_change) {

Reply via email to