diff -Nurb -x CVS -x version.C -x LaTeXConfig.lyx -x autom4te.cache -x pathscale -x po lyx-1.3.5/lib/chkconfig.ltx lyx-1.3.5-changebars/lib/chkconfig.ltx --- lyx-1.3.5/lib/chkconfig.ltx 2003-11-07 07:35:45.000000000 -0800 +++ lyx-1.3.5-changebars/lib/chkconfig.ltx 2004-11-12 15:37:10.806267415 -0800 @@ -228,6 +228,7 @@ \TestPackage{varioref} \TestPackage{prettyref} \TestPackage{natbib} +\TestPackage{dvipost} % The test for the graphics package is slightly more involved... \newcommand\groption{dvips} diff -Nurb -x CVS -x version.C -x LaTeXConfig.lyx -x autom4te.cache -x pathscale -x po lyx-1.3.5/lib/configure lyx-1.3.5-changebars/lib/configure --- lyx-1.3.5/lib/configure 2004-10-06 07:43:24.000000000 -0700 +++ lyx-1.3.5-changebars/lib/configure 2004-11-12 15:37:11.738169038 -0800 @@ -102,9 +102,9 @@ #### Searching some useful programs # Search LaTeX2e echo $ac_n "checking for a LaTeX2e program""... $ac_c" -echo "$ac_t""(latex latex2e)" +echo "$ac_t""(pplatex latex2e latex)" LATEX= -for ac_prog in latex latex2e +for ac_prog in pplatex latex2e latex do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog ; ac_word=$2 @@ -649,9 +649,9 @@ # Search for a program to convert dvi to ps echo $ac_n "checking for a DVI to PS converter""... $ac_c" -echo "$ac_t""(dvips)" +echo "$ac_t""(dvipspost)" dvi_to_ps_command= -for ac_prog in dvips +for ac_prog in dvipspost do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog ; ac_word=$2 @@ -682,7 +682,7 @@ dvi_to_ps_command=none fi -test $dvi_to_ps_command = "dvips" && dvi_to_ps_command="dvips -o \$\$o \$\$i" +test $dvi_to_ps_command = "dvipspost" && dvi_to_ps_command="dvipspost \$\$i \$\$o" # Search for a program to convert dvi to pdf echo $ac_n "checking for a DVI to PDF converter""... $ac_c" diff -Nurb -x CVS -x version.C -x LaTeXConfig.lyx -x autom4te.cache -x pathscale -x po lyx-1.3.5/lib/configure.cmd lyx-1.3.5-changebars/lib/configure.cmd --- lyx-1.3.5/lib/configure.cmd 2001-01-03 07:14:48.000000000 -0800 +++ lyx-1.3.5-changebars/lib/configure.cmd 2004-11-12 15:37:11.335211577 -0800 @@ -62,7 +62,7 @@ call SEARCH_PROG 'converter latex pdf2%pdflatex $$i|pdflatex2e $$i%"latex"' call SEARCH_PROG 'converter latex html%tth -t -e2 -L$$BaseName < $$i > $$o|latex2html -no_subdir -split 0 -show_section_numbers $$i|hevea -s $$i%"originaldir,needaux"' call SEARCH_PROG 'converter literate latex%noweave -delay -index $$i > $$o%""' -call SEARCH_PROG 'converter dvi ps%dvips -o $$o $$i%""' +call SEARCH_PROG 'converter dvi ps%dvipspost $$i $$o%""' call SEARCH_PROG 'converter ps pdf%ps2pdf $$i%""' call SEARCH_PROG 'converter ps fax%ksendfax $$i%""' /* call SEARCH_PROG 'converter ps tiff%gs -sDEVICE=tiffg3 -sOutputFile=$$o -dNOPAUSE $$i -c quit|gsos2 -sDEVICE=tiffg3 -sOutputFile=$$o -dNOPAUSE $$i -c quit%""' */ diff -Nurb -x CVS -x version.C -x LaTeXConfig.lyx -x autom4te.cache -x pathscale -x po lyx-1.3.5/lib/configure.m4 lyx-1.3.5-changebars/lib/configure.m4 --- lyx-1.3.5/lib/configure.m4 2004-06-11 07:42:02.000000000 -0700 +++ lyx-1.3.5-changebars/lib/configure.m4 2004-11-12 15:37:10.788269315 -0800 @@ -207,7 +207,7 @@ rm -f chklatex.ltx chklatex.log])dnl dnl # Search LaTeX2e -SEARCH_PROG([for a LaTeX2e program],LATEX,latex latex2e,CHECKLATEX2E,dnl +SEARCH_PROG([for a LaTeX2e program],LATEX,pplatex latex2e latex,CHECKLATEX2E,dnl [lyx_check_config=no]) latex_to_dvi=$LATEX test -z "$latex_to_dvi" && latex_to_dvi="none" @@ -273,8 +273,8 @@ test $ps_to_pdf_command = "ps2pdf" && ps_to_pdf_command="ps2pdf -dCompatibilityLevel=1.3 \$\$i" # Search for a program to convert dvi to ps -SEARCH_PROG([for a DVI to PS converter],dvi_to_ps_command,dvips) -test $dvi_to_ps_command = "dvips" && dvi_to_ps_command="dvips -o \$\$o \$\$i" +SEARCH_PROG([for a DVI to PS converter],dvi_to_ps_command,dvipspost) +test $dvi_to_ps_command = "dvipspost" && dvi_to_ps_command="dvipspost \$\$i \$\$o" # Search for a program to convert dvi to pdf SEARCH_PROG([for a DVI to PDF converter],dvi_to_pdf_command,dvipdfm) diff -Nurb -x CVS -x version.C -x LaTeXConfig.lyx -x autom4te.cache -x pathscale -x po lyx-1.3.5/lib/ui/default.ui lyx-1.3.5-changebars/lib/ui/default.ui --- lyx-1.3.5/lib/ui/default.ui 2003-01-16 02:41:13.000000000 -0800 +++ lyx-1.3.5-changebars/lib/ui/default.ui 2004-11-12 15:37:11.075239021 -0800 @@ -80,6 +80,7 @@ Item "Check TeX|h" "buffer-chktex" Item "Remove All Error Boxes|E" "error-remove-all" Item "Open/Close float|l" "inset-toggle" + Submenu "Change tracking|h" "edit_change" Separator Item "Preferences...|P" "dialog-preferences" Item "Reconfigure|R" "reconfigure" @@ -292,6 +293,12 @@ Item "ASCII as Paragraphs...|P" "file-insert-ascii-para" End + Menu "edit_change" + Item "Track changes|T" "track-changes" + Item "Merge changes ...|M" "merge-changes" + Item "Accept all changes|A" "accept-all-changes" + Item "Reject all changes|R" "reject-all-changes" + End # # LAYOUT MENU # diff -Nurb -x CVS -x version.C -x LaTeXConfig.lyx -x autom4te.cache -x pathscale -x po lyx-1.3.5/src/BufferView.C lyx-1.3.5-changebars/src/BufferView.C --- lyx-1.3.5/src/BufferView.C 2003-03-12 03:13:59.000000000 -0800 +++ lyx-1.3.5-changebars/src/BufferView.C 2004-11-12 15:37:10.653283565 -0800 @@ -29,6 +29,7 @@ #include "lyxlex.h" #include "lyxtext.h" #include "undo_funcs.h" +#include "changes.h" #include "frontends/Alert.h" #include "frontends/Dialogs.h" @@ -162,6 +163,12 @@ } +Change const BufferView::getCurrentChange() +{ + return pimpl_->getCurrentChange(); +} + + void BufferView::beforeChange(LyXText * text) { pimpl_->beforeChange(text); @@ -672,7 +679,7 @@ toggleSelection(false); tt->replaceSelectionWithString(this, replacestring); - tt->setSelectionOverString(this, replacestring); + tt->setSelectionRange(this, replacestring.length()); // Go back so that replacement string is also spellchecked for (string::size_type i = 0; i < replacestring.length() + 1; ++i) { diff -Nurb -x CVS -x version.C -x LaTeXConfig.lyx -x autom4te.cache -x pathscale -x po lyx-1.3.5/src/BufferView.h lyx-1.3.5-changebars/src/BufferView.h --- lyx-1.3.5/src/BufferView.h 2003-03-12 03:13:59.000000000 -0800 +++ lyx-1.3.5-changebars/src/BufferView.h 2004-11-12 15:37:11.465197854 -0800 @@ -21,6 +21,7 @@ #include +class Change; class LyXView; class LyXText; class TeXErrors; @@ -110,6 +111,8 @@ void restorePosition(unsigned int i); /// does the given bookmark have a saved position ? bool isSavedPosition(unsigned int i); + /// return the current change at the cursor + Change const getCurrentChange(); /** * This holds the mapping between buffer paragraphs and screen rows. diff -Nurb -x CVS -x version.C -x LaTeXConfig.lyx -x autom4te.cache -x pathscale -x po lyx-1.3.5/src/BufferView_pimpl.C lyx-1.3.5-changebars/src/BufferView_pimpl.C --- lyx-1.3.5/src/BufferView_pimpl.C 2004-04-19 02:59:57.000000000 -0700 +++ lyx-1.3.5-changebars/src/BufferView_pimpl.C 2004-11-12 15:37:11.439200599 -0800 @@ -41,6 +41,8 @@ #include "ParagraphParameters.h" #include "undo_funcs.h" #include "funcrequest.h" +#include "iterators.h" +#include "lyxfind.h" #include "insets/insetbib.h" #include "insets/insettext.h" @@ -627,6 +629,21 @@ } +Change const BufferView::Pimpl::getCurrentChange() +{ + if (!bv_->buffer()->params.tracking_changes) + return Change(Change::UNCHANGED); + + LyXText * t(bv_->getLyXText()); + + if (!t->selection.set()) + return Change(Change::UNCHANGED); + + LyXCursor const & cur(t->selection.start); + return cur.par()->lookupChangeFull(cur.pos()); +} + + void BufferView::Pimpl::beforeChange(LyXText * text) { toggleSelection(); @@ -925,6 +942,43 @@ } +void BufferView::Pimpl::trackChanges() +{ + Buffer * buf(bv_->buffer()); + bool const tracking(buf->params.tracking_changes); + + if (!tracking) { + ParIterator const end = buf->par_iterator_end(); + for (ParIterator it = buf->par_iterator_begin(); it != end; ++it) { + (*it)->trackChanges(); + } + buf->params.tracking_changes = true; + + // we cannot allow undos beyond the freeze point + buf->undostack.clear(); + } else { + bv_->update(bv_->text, BufferView::SELECT | BufferView::FITCUR); + bv_->text->setCursor(bv_, &(*buf->paragraphs.begin()), 0); +#warning changes FIXME + //moveCursorUpdate(false); + + bool found = lyxfind::findNextChange(bv_); + if (found) { + owner_->getDialogs().showMergeChanges(); + return; + } + + ParIterator const end = buf->par_iterator_end(); + for (ParIterator it = buf->par_iterator_begin(); it != end; ++it) { + (*it)->untrackChanges(); + } + buf->params.tracking_changes = false; + } + + buf->redostack.clear(); +} + + bool BufferView::Pimpl::dispatch(FuncRequest const & ev) { lyxerr[Debug::ACTION] << "BufferView::Pimpl::Dispatch:" @@ -1259,6 +1313,56 @@ } break; + case LFUN_TRACK_CHANGES: + trackChanges(); + break; + + case LFUN_MERGE_CHANGES: + owner_->getDialogs().showMergeChanges(); + break; + + case LFUN_ACCEPT_ALL_CHANGES: { + bv_->update(bv_->text, BufferView::SELECT | BufferView::FITCUR); + bv_->text->setCursor(bv_, &(*bv_->buffer()->paragraphs.begin()), 0); +#warning FIXME changes + //moveCursorUpdate(false); + + while (lyxfind::findNextChange(bv_)) { + bv_->getLyXText()->acceptChange(bv_); + } + update(bv_->text, + BufferView::SELECT | BufferView::FITCUR | BufferView::CHANGE); + break; + } + + case LFUN_REJECT_ALL_CHANGES: { + bv_->update(bv_->text, BufferView::SELECT | BufferView::FITCUR); + bv_->text->setCursor(bv_, &(*bv_->buffer()->paragraphs.begin()), 0); +#warning FIXME changes + //moveCursorUpdate(false); + + while (lyxfind::findNextChange(bv_)) { + bv_->getLyXText()->rejectChange(bv_); + } + update(bv_->text, + BufferView::SELECT | BufferView::FITCUR | BufferView::CHANGE); + break; + } + + case LFUN_ACCEPT_CHANGE: { + bv_->getLyXText()->acceptChange(bv_); + update(bv_->text, + BufferView::SELECT | BufferView::FITCUR | BufferView::CHANGE); + break; + } + + case LFUN_REJECT_CHANGE: { + bv_->getLyXText()->rejectChange(bv_); + update(bv_->text, + BufferView::SELECT | BufferView::FITCUR | BufferView::CHANGE); + break; + } + case LFUN_UNKNOWN_ACTION: ev.errorMessage(N_("Unknown function!")); break; diff -Nurb -x CVS -x version.C -x LaTeXConfig.lyx -x autom4te.cache -x pathscale -x po lyx-1.3.5/src/BufferView_pimpl.h lyx-1.3.5-changebars/src/BufferView_pimpl.h --- lyx-1.3.5/src/BufferView_pimpl.h 2003-12-04 02:43:37.000000000 -0800 +++ lyx-1.3.5-changebars/src/BufferView_pimpl.h 2004-11-12 15:37:12.366102750 -0800 @@ -23,6 +23,7 @@ #pragma interface #endif +class Change; class LyXView; class WorkArea; class LyXScreen; @@ -74,6 +75,8 @@ void cursorToggle(); /// bool available() const; + /// get the change at the cursor position + Change const getCurrentChange(); /// void beforeChange(LyXText *); /// @@ -106,6 +109,9 @@ bool viewDispatch(FuncRequest const & ev); private: + /// track changes for the document + void trackChanges(); + /// friend class BufferView; diff -Nurb -x CVS -x version.C -x LaTeXConfig.lyx -x autom4te.cache -x pathscale -x po lyx-1.3.5/src/CutAndPaste.C lyx-1.3.5-changebars/src/CutAndPaste.C --- lyx-1.3.5/src/CutAndPaste.C 2002-12-02 01:59:42.000000000 -0800 +++ lyx-1.3.5-changebars/src/CutAndPaste.C 2004-11-12 15:37:10.465303409 -0800 @@ -14,7 +14,6 @@ #endif #include "CutAndPaste.h" -//#include "debug.h" #include "BufferView.h" #include "buffer.h" #include "paragraph.h" @@ -26,11 +25,12 @@ #include "lyxtextclasslist.h" #include "undo_funcs.h" #include "paragraph_funcs.h" - +#include "debug.h" #include "insets/inseterror.h" #include "BoostFormat.h" - +#include +using std::endl; using std::pair; using lyx::pos_type; using lyx::textclass_type; @@ -58,6 +58,7 @@ namespace { +// FIXME: stupid name Paragraph * buf = 0; textclass_type textclass = 0; @@ -90,77 +91,89 @@ if (!startpar || (start > startpar->size())) return false; - if (realcut) - DeleteBuffer(); - - textclass = tc; - - if (!(*endpar) || startpar == (*endpar)) { - // only within one paragraph if (realcut) { - buf = new Paragraph; - buf->layout(startpar->layout()); + copySelection(startpar, *endpar, start, end, tc); } - pos_type i = start; - if (end > startpar->size()) - end = startpar->size(); - for (; i < end; ++i) { - if (realcut) - startpar->copyIntoMinibuffer(*current_view->buffer(), - start); - startpar->erase(start); - if (realcut) - buf->insertFromMinibuffer(buf->size()); + + if (!endpar || startpar == *endpar) { + if (startpar->erase(start, end)) { + // Some chars were erased, go to start to be safe + end = start; } - end = start - 1; - } else { - // more than one paragraph - breakParagraphConservative(current_view->buffer()->params, - *endpar, - end); - *endpar = (*endpar)->next(); + return true; + } + + bool actually_erased = false; + + // clear end/begin fragments of the first/last par in selection + actually_erased |= (startpar)->erase(start, startpar->size()); + if ((*endpar)->erase(0, end)) { + actually_erased = true; end = 0; + } - breakParagraphConservative(current_view->buffer()->params, - startpar, - start); + // Loop through the deleted pars if any, erasing as needed - // store the selection - if (realcut) { - buf = startpar->next(); - buf->previous(0); - } else { - startpar->next()->previous(0); + Paragraph * pit = startpar->next(); + + while (1) { + // *endpar can be 0 + if (!pit) + break; + + Paragraph * next = pit->next(); + + // "erase" the contents of the par + if (pit != *endpar) { + actually_erased |= pit->erase(0, pit->size()); + + // remove the par if it's now empty + if (actually_erased) { + pit->previous()->next(pit->next()); + if (next) { + next->previous(pit->previous()); + } + lyxerr << "deleting pit " << pit << endl; + + delete pit; + } } - (*endpar)->previous()->next(0); - // cut the selection - startpar->next(*endpar); + if (pit == *endpar) + break; - (*endpar)->previous(startpar); + pit = next; + } +#if 0 // FIXME: why for cut but not copy ? // the cut selection should begin with standard layout if (realcut) { buf->params().clear(); buf->bibkey = 0; - buf->layout(current_view->buffer()->params.getLyXTextClass().defaultLayout()); + buf->layout(textclasslist[buffer->params.textclass].defaultLayoutName()); } +#endif - // paste the paragraphs again, if possible - if (doclear) + if (!startpar->next()) + return true; + + Buffer * buffer = current_view->buffer(); + + if (doclear) { startpar->next()->stripLeadingSpaces(); + } + + if (!actually_erased) + return true; + + // paste the paragraphs again, if possible if (startpar->hasSameLayout(startpar->next()) || startpar->next()->empty()) { - mergeParagraph(current_view->buffer()->params, startpar); - (*endpar) = startpar; // this because endpar gets deleted here! - } - // this paragraph's are of noone's owner! - Paragraph * p = buf; - while (p) { - p->setInsetOwner(0); - p = p->next(); - } + mergeParagraph(buffer->params, startpar); + // this because endpar gets deleted here! + (*endpar) = startpar; } + return true; } @@ -192,6 +205,7 @@ Paragraph * tmppar = startpar; buf = new Paragraph(*tmppar, false); Paragraph * tmppar2 = buf; + tmppar2->cleanChanges(); while (tmppar != endpar && tmppar->next()) { @@ -199,6 +213,8 @@ tmppar2->next(new Paragraph(*tmppar, false)); tmppar2->next()->previous(tmppar2); tmppar2 = tmppar2->next(); + // reset change info + tmppar2->cleanChanges(); } tmppar2->next(0); @@ -337,7 +353,10 @@ // make the buf exactly the same layout than // the cursor paragraph buf->makeSameLayout(*par); - + // and enable change tracking if it is enabled for par + if ((*par)->tracking()) { + buf->trackChanges(Change::INSERTED); + } // find the end of the buffer Paragraph * lastbuffer = buf; while (lastbuffer->next()) @@ -349,15 +368,13 @@ // if necessary if (((*par)->size() > pos) || !(*par)->next()) { breakParagraphConservative( - current_view->buffer()->params, - *par, - pos); + current_view->buffer()->params, *par, pos); paste_the_end = true; } // set the end for redoing later *endpar = (*par)->next()->next(); - // paste it! + //paste it! lastbuffer->next((*par)->next()); (*par)->next()->previous(lastbuffer); @@ -367,20 +384,20 @@ if ((*par)->next() == lastbuffer) lastbuffer = *par; - mergeParagraph(current_view->buffer()->params, *par); + mergeParagraph(current_view->buffer()->params, *par, true); // store the new cursor position *par = lastbuffer; pos = lastbuffer->size(); // maybe some pasting if (lastbuffer->next() && paste_the_end) { if (lastbuffer->next()->hasSameLayout(lastbuffer)) { - mergeParagraph(current_view->buffer()->params, lastbuffer); - } else if (lastbuffer->next()->empty()) { + mergeParagraph(current_view->buffer()->params, lastbuffer,true); + } else if (!lastbuffer->next()->size()) { lastbuffer->next()->makeSameLayout(lastbuffer); - mergeParagraph(current_view->buffer()->params, lastbuffer); - } else if (lastbuffer->empty()) { + mergeParagraph(current_view->buffer()->params, lastbuffer,true); + } else if (!lastbuffer->size()) { lastbuffer->makeSameLayout(lastbuffer->next()); - mergeParagraph(current_view->buffer()->params, lastbuffer); + mergeParagraph(current_view->buffer()->params, lastbuffer,true); } else lastbuffer->next()->stripLeadingSpaces(); } diff -Nurb -x CVS -x version.C -x LaTeXConfig.lyx -x autom4te.cache -x pathscale -x po lyx-1.3.5/src/CutAndPaste.h lyx-1.3.5-changebars/src/CutAndPaste.h --- lyx-1.3.5/src/CutAndPaste.h 2002-07-21 14:20:53.000000000 -0700 +++ lyx-1.3.5-changebars/src/CutAndPaste.h 2004-11-12 15:37:10.622286837 -0800 @@ -24,7 +24,7 @@ /// class CutAndPaste { public: - /// + /// realcut == false is we actually want a delete static bool cutSelection(Paragraph * startpar, Paragraph ** endpar, int start, int & end, char tc, bool doclear = false, diff -Nurb -x CVS -x version.C -x LaTeXConfig.lyx -x autom4te.cache -x pathscale -x po lyx-1.3.5/src/LColor.C lyx-1.3.5-changebars/src/LColor.C --- lyx-1.3.5/src/LColor.C 2003-01-06 06:02:20.000000000 -0800 +++ lyx-1.3.5-changebars/src/LColor.C 2004-11-12 15:37:11.336211471 -0800 @@ -84,6 +84,9 @@ { error, N_("LaTeX error"), "error", "Red", "error" }, { eolmarker, N_("end-of-line marker"), "eolmarker", "Brown", "eolmarker" }, { appendixline, N_("appendix line"), "appendixline", "Brown", "appendixline" }, + { changebar, N_("change bar"), "changebar", "Blue", "changebar" }, + { strikeout, N_("Deleted text"), "strikeout", "Red", "strikeout" }, + { newtext, N_("Added text"), "newtext", "Blue", "newtext" }, { added_space, N_("added space markers"), "added_space", "Brown", "added_space" }, { topline, N_("top/bottom line"), "topline", "Brown", "topline" }, { tabularline, N_("tabular line"), "tabularline", "black", diff -Nurb -x CVS -x version.C -x LaTeXConfig.lyx -x autom4te.cache -x pathscale -x po lyx-1.3.5/src/LColor.h lyx-1.3.5-changebars/src/LColor.h --- lyx-1.3.5/src/LColor.h 2002-07-05 14:24:12.000000000 -0700 +++ lyx-1.3.5-changebars/src/LColor.h 2004-11-12 15:37:11.336211471 -0800 @@ -137,6 +137,12 @@ added_space, /// Appendix line color appendixline, + /// changebar color + changebar, + /// strike-out color + strikeout, + /// added text color + newtext, /// Top and bottom line color topline, /// Table line color diff -Nurb -x CVS -x version.C -x LaTeXConfig.lyx -x autom4te.cache -x pathscale -x po lyx-1.3.5/src/LaTeXFeatures.C lyx-1.3.5-changebars/src/LaTeXFeatures.C --- lyx-1.3.5/src/LaTeXFeatures.C 2003-05-02 05:13:07.000000000 -0700 +++ lyx-1.3.5-changebars/src/LaTeXFeatures.C 2004-11-12 15:37:11.903151621 -0800 @@ -174,10 +174,11 @@ "varioref", "prettyref", "float", - "wasy" + "wasy", + "dvipost" }; -const int nb_simplefeatures = sizeof(simplefeatures) / sizeof(char const *); +int const nb_simplefeatures = sizeof(simplefeatures) / sizeof(char const *); } @@ -210,10 +211,11 @@ // color.sty if (isRequired("color")) { if (params.graphicsDriver == "default") - packages << "\\usepackage{color}\n"; + packages << "\\usepackage[usenames]{color}\n"; else packages << "\\usepackage[" << params.graphicsDriver + << ",usenames" << "]{color}\n"; } diff -Nurb -x CVS -x version.C -x LaTeXConfig.lyx -x autom4te.cache -x pathscale -x po lyx-1.3.5/src/LyXAction.C lyx-1.3.5-changebars/src/LyXAction.C --- lyx-1.3.5/src/LyXAction.C 2003-01-06 06:02:20.000000000 -0800 +++ lyx-1.3.5-changebars/src/LyXAction.C 2004-11-12 15:37:10.201331276 -0800 @@ -413,6 +413,12 @@ { LFUN_FORKS_KILL, "kill-forks", N_("Kill the forked process with this PID"), NoBuffer }, { LFUN_TOOLTIPS_TOGGLE, "toggle-tooltips", "", NoBuffer }, + { LFUN_TRACK_CHANGES, "track-changes", N_("Begin tracking changes"), Noop }, + { LFUN_MERGE_CHANGES, "merge-changes", N_("Merge changes"), Noop }, + { LFUN_ACCEPT_CHANGE, "accept-change", N_("Accept selected change"), Noop }, + { LFUN_REJECT_CHANGE, "reject-change", N_("Reject selected change"), Noop }, + { LFUN_ACCEPT_ALL_CHANGES, "accept-all-changes", N_("Accept all changes"), Noop }, + { LFUN_REJECT_ALL_CHANGES, "reject-all-changes", N_("Reject all changes"), Noop }, { LFUN_NOACTION, "", "", Noop } }; diff -Nurb -x CVS -x version.C -x LaTeXConfig.lyx -x autom4te.cache -x pathscale -x po lyx-1.3.5/src/Makefile.am lyx-1.3.5-changebars/src/Makefile.am --- lyx-1.3.5/src/Makefile.am 2004-06-09 04:56:19.000000000 -0700 +++ lyx-1.3.5-changebars/src/Makefile.am 2004-11-12 15:37:11.011245776 -0800 @@ -87,6 +87,8 @@ ToolbarDefaults.C \ ToolbarDefaults.h \ WordLangTuple.h \ + author.C \ + author.h \ boost.C \ boost-inst.C \ box.h \ @@ -100,6 +102,8 @@ bufferparams.h \ bufferview_funcs.C \ bufferview_funcs.h \ + changes.C \ + changes.h \ chset.C \ chset.h \ commandtags.h \ diff -Nurb -x CVS -x version.C -x LaTeXConfig.lyx -x autom4te.cache -x pathscale -x po lyx-1.3.5/src/Makefile.in lyx-1.3.5-changebars/src/Makefile.in --- lyx-1.3.5/src/Makefile.in 2004-10-06 07:43:18.000000000 -0700 +++ lyx-1.3.5-changebars/src/Makefile.in 2004-11-12 15:37:11.797162810 -0800 @@ -308,6 +308,8 @@ ToolbarDefaults.C \ ToolbarDefaults.h \ WordLangTuple.h \ + author.C \ + author.h \ boost.C \ boost-inst.C \ box.h \ @@ -321,6 +323,8 @@ bufferparams.h \ bufferview_funcs.C \ bufferview_funcs.h \ + changes.C \ + changes.h \ chset.C \ chset.h \ commandtags.h \ @@ -455,20 +459,21 @@ MenuBackend.$(OBJEXT) paragraph_funcs.$(OBJEXT) \ ParagraphList.$(OBJEXT) ParagraphParameters.$(OBJEXT) \ Spacing.$(OBJEXT) TextCache.$(OBJEXT) Thesaurus.$(OBJEXT) \ - ToolbarDefaults.$(OBJEXT) boost.$(OBJEXT) boost-inst.$(OBJEXT) \ - box.$(OBJEXT) buffer.$(OBJEXT) bufferlist.$(OBJEXT) \ - bufferparams.$(OBJEXT) bufferview_funcs.$(OBJEXT) \ - chset.$(OBJEXT) converter.$(OBJEXT) counters.$(OBJEXT) \ - debug.$(OBJEXT) encoding.$(OBJEXT) exporter.$(OBJEXT) \ - gettext.$(OBJEXT) factory.$(OBJEXT) funcrequest.$(OBJEXT) \ - importer.$(OBJEXT) intl.$(OBJEXT) iterators.$(OBJEXT) \ - kbmap.$(OBJEXT) kbsequence.$(OBJEXT) language.$(OBJEXT) \ - lastfiles.$(OBJEXT) lengthcommon.$(OBJEXT) lyx_cb.$(OBJEXT) \ - lyx_main.$(OBJEXT) lyx_sty.$(OBJEXT) lyxcursor.$(OBJEXT) \ - lyxfont.$(OBJEXT) lyxfind.$(OBJEXT) lyxfunc.$(OBJEXT) \ - lyxgluelength.$(OBJEXT) lyxlayout.$(OBJEXT) lyxlength.$(OBJEXT) \ - lyxlex.$(OBJEXT) lyxlex_pimpl.$(OBJEXT) lyxrc.$(OBJEXT) \ - lyxrow.$(OBJEXT) lyxserver.$(OBJEXT) lyxtextclass.$(OBJEXT) \ + ToolbarDefaults.$(OBJEXT) author.$(OBJEXT) boost.$(OBJEXT) \ + boost-inst.$(OBJEXT) box.$(OBJEXT) buffer.$(OBJEXT) \ + bufferlist.$(OBJEXT) bufferparams.$(OBJEXT) \ + bufferview_funcs.$(OBJEXT) changes.$(OBJEXT) chset.$(OBJEXT) \ + converter.$(OBJEXT) counters.$(OBJEXT) debug.$(OBJEXT) \ + encoding.$(OBJEXT) exporter.$(OBJEXT) gettext.$(OBJEXT) \ + factory.$(OBJEXT) funcrequest.$(OBJEXT) importer.$(OBJEXT) \ + intl.$(OBJEXT) iterators.$(OBJEXT) kbmap.$(OBJEXT) \ + kbsequence.$(OBJEXT) language.$(OBJEXT) lastfiles.$(OBJEXT) \ + lengthcommon.$(OBJEXT) lyx_cb.$(OBJEXT) lyx_main.$(OBJEXT) \ + lyx_sty.$(OBJEXT) lyxcursor.$(OBJEXT) lyxfont.$(OBJEXT) \ + lyxfind.$(OBJEXT) lyxfunc.$(OBJEXT) lyxgluelength.$(OBJEXT) \ + lyxlayout.$(OBJEXT) lyxlength.$(OBJEXT) lyxlex.$(OBJEXT) \ + lyxlex_pimpl.$(OBJEXT) lyxrc.$(OBJEXT) lyxrow.$(OBJEXT) \ + lyxserver.$(OBJEXT) lyxtextclass.$(OBJEXT) \ lyxtextclasslist.$(OBJEXT) lyxvc.$(OBJEXT) main.$(OBJEXT) \ paragraph.$(OBJEXT) paragraph_pimpl.$(OBJEXT) ispell.$(OBJEXT) \ pspell.$(OBJEXT) sgml.$(OBJEXT) tabular.$(OBJEXT) \ @@ -505,20 +510,20 @@ @AMDEP_TRUE@ ./$(DEPDIR)/Spacing.Po ./$(DEPDIR)/TextCache.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/Thesaurus.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/ToolbarDefaults.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/boost-inst.Po ./$(DEPDIR)/boost.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/box.Po ./$(DEPDIR)/buffer.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/bufferlist.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/author.Po ./$(DEPDIR)/boost-inst.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/boost.Po ./$(DEPDIR)/box.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/buffer.Po ./$(DEPDIR)/bufferlist.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/bufferparams.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/bufferview_funcs.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/chset.Po ./$(DEPDIR)/converter.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/counters.Po ./$(DEPDIR)/debug.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/encoding.Po ./$(DEPDIR)/exporter.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/factory.Po ./$(DEPDIR)/funcrequest.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/gettext.Po ./$(DEPDIR)/importer.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/intl.Po ./$(DEPDIR)/ispell.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/iterators.Po ./$(DEPDIR)/kbmap.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/kbsequence.Po ./$(DEPDIR)/language.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/lastfiles.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/changes.Po ./$(DEPDIR)/chset.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/converter.Po ./$(DEPDIR)/counters.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/debug.Po ./$(DEPDIR)/encoding.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/exporter.Po ./$(DEPDIR)/factory.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/funcrequest.Po ./$(DEPDIR)/gettext.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/importer.Po ./$(DEPDIR)/intl.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/ispell.Po ./$(DEPDIR)/iterators.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/kbmap.Po ./$(DEPDIR)/kbsequence.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/language.Po ./$(DEPDIR)/lastfiles.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/lengthcommon.Po ./$(DEPDIR)/lyx_cb.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/lyx_main.Po ./$(DEPDIR)/lyx_sty.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/lyxcursor.Po ./$(DEPDIR)/lyxfind.Po \ @@ -662,6 +667,7 @@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TextCache.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Thesaurus.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ToolbarDefaults.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/author.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/boost-inst.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/boost.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/box.Po@am__quote@ @@ -669,6 +675,7 @@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bufferlist.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bufferparams.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bufferview_funcs.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/changes.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/chset.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/converter.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/counters.Po@am__quote@ diff -Nurb -x CVS -x version.C -x LaTeXConfig.lyx -x autom4te.cache -x pathscale -x po lyx-1.3.5/src/author.C lyx-1.3.5-changebars/src/author.C --- lyx-1.3.5/src/author.C 1969-12-31 16:00:00.000000000 -0800 +++ lyx-1.3.5-changebars/src/author.C 2004-11-12 15:37:11.421202499 -0800 @@ -0,0 +1,96 @@ +/** + * \file author.C + * This file is part of LyX, the document processor. + * Licence details can be found in the file COPYING. + * + * \author John Levon + * + * Full author contact details are available in file CREDITS + */ + +#include + +#include "author.h" + +#include "debug.h" + +#include "support/LAssert.h" +#include "support/LOstream.h" +#include "support/LIstream.h" +#include "support/lstrings.h" + +using std::endl; + +AuthorList authorlist; + +namespace { + int cur_id; +} + + +bool operator==(Author const & l, Author const & r) +{ + return l.name() == r.name() && l.email() == r.email(); +} + + +std::ostream & operator<<(std::ostream & os, Author const & a) +{ + os << "\"" << a.name() << "\" " << a.email(); + return os; +} + +std::istream & operator>>(std::istream & is, Author & a) +{ + string s; + getline(is, s); + a.name_ = trim(token(s, '\"', 1)); + a.email_ = trim(token(s, '\"', 2)); + lyxerr << "Read name " << a.name_ << " email " << a.email_ << endl; + return is; +} + + +int AuthorList::record(Author const & a) +{ + Authors::const_iterator it(authors_.begin()); + Authors::const_iterator itend(authors_.end()); + + for (; it != itend; ++it) { + if (it->second == a) + return it->first; + } + + lyxerr[Debug::CHANGES] << "Adding author " << a << endl; + + authors_[cur_id++] = a; + return cur_id - 1; +} + + +void AuthorList::record(int id, Author const & a) +{ + lyx::Assert(id < authors_.size()); + + authors_[id] = a; +} + + +Author const & AuthorList::get(int id) +{ + Authors::const_iterator it(authors_.find(id)); + lyx::Assert(it != authors_.end()); + return it->second; +} + + +AuthorList::Authors::const_iterator AuthorList::begin() const +{ + return authors_.begin(); +} + + +AuthorList::Authors::const_iterator AuthorList::end() const +{ + return authors_.end(); +} diff -Nurb -x CVS -x version.C -x LaTeXConfig.lyx -x autom4te.cache -x pathscale -x po lyx-1.3.5/src/author.h lyx-1.3.5-changebars/src/author.h --- lyx-1.3.5/src/author.h 1969-12-31 16:00:00.000000000 -0800 +++ lyx-1.3.5-changebars/src/author.h 2004-11-12 15:37:11.746168193 -0800 @@ -0,0 +1,70 @@ +/** + * \file author.h + * This file is part of LyX, the document processor. + * Licence details can be found in the file COPYING. + * + * \author John Levon + * + * Full author contact details are available in file CREDITS + */ + +#ifndef AUTHOR_H +#define AUTHOR_H + +#include +#include + +#include "LString.h" + +class Author { +public: + Author() {} + + Author(string n, string e) + : name_(n), email_(e) {} + + string const name() const { + return name_; + } + + string const email() const { + return email_; + } + + friend std::istream & operator>>(std::istream & os, Author & a); + +private: + string name_; + + string email_; +}; + + +class AuthorList { +public: + int record(Author const & a); + + void record(int id, Author const & a); + + Author const & get(int id); + + typedef std::map Authors; + + Authors::const_iterator begin() const; + + Authors::const_iterator end() const; + +private: + Authors authors_; +}; + +bool operator==(Author const & l, Author const & r); + +std::ostream & operator<<(std::ostream & os, Author const & a); + +std::istream & operator>>(std::istream & os, Author & a); + +/// singleton of all authors +extern AuthorList authorlist; + +#endif // AUTHOR_H diff -Nurb -x CVS -x version.C -x LaTeXConfig.lyx -x autom4te.cache -x pathscale -x po lyx-1.3.5/src/buffer.C lyx-1.3.5-changebars/src/buffer.C --- lyx-1.3.5/src/buffer.C 2004-08-02 03:21:53.000000000 -0700 +++ lyx-1.3.5-changebars/src/buffer.C 2004-11-12 15:37:12.332106338 -0800 @@ -45,6 +45,7 @@ #include "lyxtextclasslist.h" #include "sgml.h" #include "paragraph_funcs.h" +#include "author.h" #include "frontends/LyXView.h" @@ -282,6 +283,7 @@ #endif int unknown_layouts; int unknown_tokens; +vector author_ids; } // anon @@ -298,6 +300,7 @@ { unknown_layouts = 0; unknown_tokens = 0; + author_ids.clear(); int pos = 0; Paragraph::depth_type depth = 0; @@ -390,6 +393,13 @@ } +namespace { + // This stuff is, in the traditional LyX terminology, Super UGLY + // but this code is too b0rken to admit of a better solution yet + Change current_change; +}; + + bool Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par, Paragraph *& first_par, @@ -408,7 +418,7 @@ if (token[0] != '\\') { for (string::const_iterator cit = token.begin(); cit != token.end(); ++cit) { - par->insertChar(pos, (*cit), font); + par->insertChar(pos, (*cit), font, current_change); ++pos; } } else if (token == "\\layout") { @@ -498,6 +508,8 @@ else { par = new Paragraph(par); par->layout(params.getLyXTextClass().defaultLayout()); + if (params.tracking_changes) + par->trackChanges(); } pos = 0; par->layout(params.getLyXTextClass()[layoutname]); @@ -576,9 +588,9 @@ lex.next(); string const next_token = lex.getString(); if (next_token == "\\-") { - par->insertChar(pos, '-', font); + par->insertChar(pos, '-', font, current_change); } else if (next_token == "~") { - par->insertChar(pos, ' ', font); + par->insertChar(pos, ' ', font, current_change); } else { lex.printError("Token `$$Token' " "is in free space " @@ -589,16 +601,16 @@ } else { Inset * inset = new InsetSpecialChar; inset->read(this, lex); - par->insertInset(pos, inset, font); + par->insertInset(pos, inset, font, current_change); } ++pos; } else if (token == "\\i") { Inset * inset = new InsetLatexAccent; inset->read(this, lex); - par->insertInset(pos, inset, font); + par->insertInset(pos, inset, font, current_change); ++pos; } else if (token == "\\backslash") { - par->insertChar(pos, '\\', font); + par->insertChar(pos, '\\', font, current_change); ++pos; } else if (token == "\\begin_deeper") { ++depth; @@ -784,6 +796,21 @@ } else if (token == "\\use_numerical_citations") { lex.nextToken(); params.use_numerical_citations = lex.getInteger(); + } else if (token == "\\tracking_changes") { + lex.nextToken(); + params.tracking_changes = lex.getInteger(); + // mark the first paragraph + if (params.tracking_changes) + par->trackChanges(); + } else if (token == "\\author") { + lex.nextToken(); + istringstream ss(lex.getString()); + Author a; + ss >> a; + int aid(authorlist.record(a)); + lyxerr << "aid is " << aid << endl; + lyxerr << "listed aid is " << author_ids.size() << endl; + author_ids.push_back(authorlist.record(a)); } else if (token == "\\paperorientation") { int tmpret = lex.findToken(string_orientation); if (tmpret == -1) @@ -957,16 +984,37 @@ par->params().labelWidthString(lex.getString()); // do not delete this token, it is still needed! } else if (token == "\\newline") { - par->insertChar(pos, Paragraph::META_NEWLINE, font); + par->insertChar(pos, Paragraph::META_NEWLINE, font, current_change); ++pos; } else if (token == "\\LyXTable") { Inset * inset = new InsetTabular(*this); inset->read(this, lex); - par->insertInset(pos, inset, font); + par->insertInset(pos, inset, font, current_change); ++pos; } else if (token == "\\hfill") { - par->insertChar(pos, Paragraph::META_HFILL, font); + par->insertChar(pos, Paragraph::META_HFILL, font, current_change); ++pos; + } else if (token == "\\change_unchanged") { + // Hack ! Needed for empty paragraphs :/ + if (!pos) + par->cleanChanges(); + current_change = Change(Change::UNCHANGED); + } else if (token == "\\change_inserted") { + lex.nextToken(); + istringstream istr(lex.getString()); + int aid; + time_t ct; + istr >> aid; + istr >> ct; + current_change = Change(Change::INSERTED, author_ids[aid], ct); + } else if (token == "\\change_deleted") { + lex.nextToken(); + istringstream istr(lex.getString()); + int aid; + time_t ct; + istr >> aid; + istr >> ct; + current_change = Change(Change::DELETED, author_ids[aid], ct); } else if (token == "\\bibitem") { // ale970302 if (!par->bibkey) { InsetCommandParams p("bibitem", "dummy"); @@ -1033,13 +1081,13 @@ } else if (*cit == '\t') { if (!layout->free_spacing && !par->isFreeSpacing()) { // tabs are like spaces here - par->insertChar(pos, ' ', font); + par->insertChar(pos, ' ', font, current_change); ++pos; space_inserted = true; } else { const pos_type nb = 8 - pos % 8; for (pos_type a = 0; a < nb ; ++a) { - par->insertChar(pos, ' ', font); + par->insertChar(pos, ' ', font, current_change); ++pos; } space_inserted = true; @@ -1183,7 +1231,7 @@ } if (inset) { - par->insertInset(pos, inset, font); + par->insertInset(pos, inset, font, current_change); ++pos; } } @@ -1385,6 +1433,15 @@ // now write out the buffer paramters. params.writeFile(ofs); + // if we're tracking, list all possible authors + if (params.tracking_changes) { + AuthorList::Authors::const_iterator it = authorlist.begin(); + AuthorList::Authors::const_iterator end = authorlist.end(); + for (; it != end; ++it) { + ofs << "\\author " << it->second << "\n"; + } + } + Paragraph::depth_type depth = 0; // this will write out all the paragraphs @@ -2125,6 +2182,15 @@ texrow.newline(); } + // dvipost settings come after everything else + if (params.tracking_changes) { + preamble += "\\dvipostlayout\n"; + preamble += "\\dvipost{osstart color push Red}\n"; + preamble += "\\dvipost{osend color pop}\n"; + preamble += "\\dvipost{cbstart color push Blue}\n"; + preamble += "\\dvipost{cbend color pop} \n"; + } + os << preamble; if (only_preamble) @@ -3192,6 +3258,11 @@ { LyXTextClass const & tclass = params.getLyXTextClass(); + if (params.tracking_changes) { + features.require("dvipost"); + features.require("color"); + } + // AMS Style is at document level if (params.use_amsmath || tclass.provides(LyXTextClass::amsmath)) features.require("amsmath"); diff -Nurb -x CVS -x version.C -x LaTeXConfig.lyx -x autom4te.cache -x pathscale -x po lyx-1.3.5/src/bufferparams.C lyx-1.3.5-changebars/src/bufferparams.C --- lyx-1.3.5/src/bufferparams.C 2002-07-28 15:50:03.000000000 -0700 +++ lyx-1.3.5-changebars/src/bufferparams.C 2004-11-12 15:37:11.939147821 -0800 @@ -54,6 +54,7 @@ use_amsmath = false; use_natbib = false; use_numerical_citations = false; + tracking_changes = false; secnumdepth = 3; tocdepth = 3; language = default_language; @@ -178,6 +179,8 @@ } } } + + os << "\\tracking_changes " << tracking_changes << "\n"; } diff -Nurb -x CVS -x version.C -x LaTeXConfig.lyx -x autom4te.cache -x pathscale -x po lyx-1.3.5/src/bufferparams.h lyx-1.3.5-changebars/src/bufferparams.h --- lyx-1.3.5/src/bufferparams.h 2002-07-21 14:20:55.000000000 -0700 +++ lyx-1.3.5-changebars/src/bufferparams.h 2004-11-12 15:37:10.289321987 -0800 @@ -214,6 +214,8 @@ bool use_natbib; /// bool use_numerical_citations; + /// revision tracking for this buffer ? + bool tracking_changes; /// Time ago we agreed that this was a buffer property [ale990407] string parentname; private: diff -Nurb -x CVS -x version.C -x LaTeXConfig.lyx -x autom4te.cache -x pathscale -x po lyx-1.3.5/src/bufferview_funcs.C lyx-1.3.5-changebars/src/bufferview_funcs.C --- lyx-1.3.5/src/bufferview_funcs.C 2003-01-23 08:23:37.000000000 -0800 +++ lyx-1.3.5-changebars/src/bufferview_funcs.C 2004-11-12 15:37:12.248115205 -0800 @@ -25,6 +25,8 @@ #include "language.h" #include "gettext.h" #include "ParagraphParameters.h" +#include "author.h" +#include "changes.h" #include "frontends/Alert.h" @@ -148,12 +150,30 @@ ostringstream state; if (!bv->available()) - return ""; + return string(); - // I think we should only show changes from the default - // font. (Asger) LyXText * text = bv->getLyXText(); Buffer * buffer = bv->buffer(); + LyXCursor const & c(text->cursor); + + bool const show_change = buffer->params.tracking_changes + && c.pos() != c.par()->size() + && c.par()->lookupChange(c.pos()) != Change::UNCHANGED; + + if (show_change) { + Change change(c.par()->lookupChangeFull(c.pos())); + Author const & a(authorlist.get(change.author)); + state << _("Change: ") << a.name(); + if (!a.email().empty()) { + state << " (" << a.email() << ")"; + } + if (change.changetime) + state << _(" at ") << ctime(&change.changetime); + state << " : "; + } + + // I think we should only show changes from the default + // font. (Asger) LyXFont font = text->real_current_font; LyXFont const & defaultfont = buffer->params.getLyXTextClass().defaultfont(); diff -Nurb -x CVS -x version.C -x LaTeXConfig.lyx -x autom4te.cache -x pathscale -x po lyx-1.3.5/src/changes.C lyx-1.3.5-changebars/src/changes.C --- lyx-1.3.5/src/changes.C 1969-12-31 16:00:00.000000000 -0800 +++ lyx-1.3.5-changebars/src/changes.C 2004-11-12 15:37:11.011245776 -0800 @@ -0,0 +1,530 @@ +/** + * \file changes.C + * Copyright 2002 the LyX Team + * Read the file COPYING + * + * Record changes in a paragraph. + * + * \author John Levon + */ + +#include + +#ifdef __GNUG__ +#pragma implementation +#endif + +#include "changes.h" +#include "debug.h" +#include "author.h" + +#include "support/LAssert.h" +#include "support/LOstream.h" + +using std::vector; +using std::endl; +using lyx::pos_type; + +bool operator==(Change const & l, Change const & r) +{ + return l.type == r.type && l.author == r.author + && l.changetime == r.changetime; +} + + +bool operator!=(Change const & l, Change const & r) +{ + return !(l == r); +} + + +bool operator==(Changes::Range const & r1, Changes::Range const & r2) +{ + return r1.start == r2.start && r1.end == r2.end; +} + + +bool operator!=(Changes::Range const & r1, Changes::Range const & r2) +{ + return !(r1 == r2); +} + + +bool Changes::Range::contains(Range const & r) const +{ + return r.start >= start && r.end <= end; +} + + +bool Changes::Range::contained(Range const & r) const +{ + return r.contains(*this); +} + + +bool Changes::Range::contains(pos_type pos) const +{ + return pos >= start && pos < end; +} + + +bool Changes::Range::loose_contains(pos_type pos) const +{ + return pos >= start && pos <= end; +} + + +bool Changes::Range::intersects(Range const & r) const +{ + return contained(r) || contains(r) + || contains(r.start) || contains(r.end); +} + + +Changes::Changes(Change::Type type) + : empty_type_(type) +{ +} + + +Changes::~Changes() +{ +} + + +Changes::Changes(Changes const & c) +{ + table_ = c.table_; +} + + +void Changes::record(Change change, pos_type pos) +{ + lyxerr[Debug::CHANGES] << "record " << change.type + << " at pos " << pos << " with total " + << table_.size() << " changes." << endl; + + switch (change.type) { + case Change::INSERTED: + add(change, pos); + break; + case Change::DELETED: + del(change, pos); + break; + case Change::UNCHANGED: + set(Change::UNCHANGED, pos); + break; + } +} + + +void Changes::set(Change change, pos_type pos) +{ + set(change, pos, pos + 1); +} + + +void Changes::set(Change::Type type, pos_type pos) +{ + set(type, pos, pos + 1); +} + + +void Changes::set(Change::Type type, pos_type start, pos_type end) +{ + set(Change(type), start, end); +} + + +void Changes::set(Change change, pos_type start, pos_type end) +{ + ChangeTable::iterator it = table_.begin(); + + lyxerr[Debug::CHANGES] << "changeset of " << change.type + << " author " << change.author << " time " << change.changetime + << " in range " << start << "," << end << endl; + + Range const new_range(start, end); + + // remove all sub-ranges + for (; it != table_.end();) { + if (new_range != it->range && it->range.contained(new_range)) { + lyxerr[Debug::CHANGES] << "Removing subrange " + << it->range.start << "," << it->range.end << endl; + it = table_.erase(it); + } else { + ++it; + } + } + + it = table_.begin(); + ChangeTable::iterator itend = table_.end(); + + // find a super-range + for (; it != itend; ++it) { + if (it->range.contains(new_range)) + break; + } + + if (it == itend) { + lyxerr[Debug::CHANGES] << "Inserting change at end" << endl; + table_.push_back(ChangeRange(start, end, change)); + merge(); + return; + } + + if (change.type == it->change.type) { + lyxerr[Debug::CHANGES] << "Change set already." << endl; + it->change = change; + return; + } + + ChangeRange c(*it); + + lyxerr[Debug::CHANGES] << "Using change of type " << c.change.type + << " over " << c.range.start << "," << c.range.end << endl; + + // split head + if (c.range.start < start) { + it = table_.insert(it, ChangeRange(c.range.start, start, c.change)); + lyxerr[Debug::CHANGES] << "Splitting head of type " << c.change.type + << " over " << c.range.start << "," << start << endl; + ++it; + } + + // reset this as new type + it->range.start = start; + it->range.end = end; + it->change = change; + lyxerr[Debug::CHANGES] << "Resetting to new change" << endl; + + // split tail + if (c.range.end > end) { + ++it; + table_.insert(it, ChangeRange(end, c.range.end, c.change)); + lyxerr[Debug::CHANGES] << "Splitting tail of type " << c.change.type + << " over " << end << "," << c.range.end << endl; + } + + check(); + merge(); +} + + +void Changes::erase(pos_type pos) +{ + ChangeTable::iterator it = table_.begin(); + ChangeTable::iterator end = table_.end(); + + bool found = false; + + for (; it != end; ++it) { + Range & range(it->range); + + lyxerr[Debug::CHANGES] << "era:Range of type " << it->change.type << " is " + << it->range.start << "," << it->range.end << endl; + + if (range.contains(pos)) { + found = true; + --range.end; + continue; + } + + if (found) { + --range.start; + --range.end; + } + } + check(); + merge(); +} + + +void Changes::del(Change change, ChangeTable::size_type pos) +{ + // this case happens when building from .lyx + if (table_.empty()) { + set(change, pos); + return; + } + + ChangeTable::iterator it = table_.begin(); + + for (; it != table_.end(); ++it) { + Range & range(it->range); + + if (range.contains(pos)) { + if (it->change.type != Change::INSERTED) { + set(change, pos); + } else { + erase(pos); + } + break; + } else if (range.loose_contains(pos) && it + 1 == table_.end()) { + // this case happens when building from .lyx + set(change, pos); + break; + } + } +} + + +void Changes::add(Change change, ChangeTable::size_type pos) +{ + ChangeTable::iterator it = table_.begin(); + ChangeTable::iterator end = table_.end(); + + bool found = false; + + for (; it != end; ++it) { + Range & range(it->range); + + if (!found && range.loose_contains(pos)) { + found = true; + lyxerr[Debug::CHANGES] << "Found range of " + << range.start << "," << range.end << endl; + ++range.end; + continue; + } + + if (found) { + ++range.start; + ++range.end; + } + } + set(change, pos); +} + + +Change const Changes::lookupFull(pos_type pos) const +{ + if (!table_.size()) { + lyxerr[Debug::CHANGES] << "Empty, type is " << empty_type_ << endl; + return Change(empty_type_); + } + + ChangeTable::const_iterator it = table_.begin(); + ChangeTable::const_iterator end = table_.end(); + + for (; it != end; ++it) { + if (it->range.contains(pos)) + return it->change; + } + + check(); + lyx::Assert(0); + return Change(Change::UNCHANGED); +} + + +Change::Type Changes::lookup(pos_type pos) const +{ + if (!table_.size()) { + lyxerr[Debug::CHANGES] << "Empty, type is " << empty_type_ << endl; + return empty_type_; + } + + ChangeTable::const_iterator it = table_.begin(); + ChangeTable::const_iterator end = table_.end(); + + for (; it != end; ++it) { + if (it->range.contains(pos)) + return it->change.type; + } + + check(); + lyx::Assert(0); + return Change::UNCHANGED; +} + + +bool Changes::isChange(pos_type start, pos_type end) const +{ + if (!table_.size()) { + lyxerr[Debug::CHANGES] << "Empty, type is " << empty_type_ << endl; + return empty_type_ != Change::UNCHANGED; + } + + ChangeTable::const_iterator it = table_.begin(); + ChangeTable::const_iterator itend = table_.end(); + + for (; it != itend; ++it) { + lyxerr[Debug::CHANGES] << "Looking for " << start << "," + << end << " in " << it->range.start << "," + << it->range.end << "of type " << it->change.type << endl; + if (it->range.intersects(Range(start, end)) + && it->change.type != Change::UNCHANGED) { + lyxerr[Debug::CHANGES] << "Found intersection of " + << start << "," << end << " with " + << it->range.start << "," << it->range.end + << " of type " << it->change.type << endl; + return true; + } + } + + return false; +} + + +bool Changes::isChangeEdited(lyx::pos_type start, lyx::pos_type end) const +{ + if (!table_.size()) { + lyxerr[Debug::CHANGES] << "Empty, type is " << empty_type_ << endl; + return empty_type_ != Change::INSERTED; + } + + ChangeTable::const_iterator it = table_.begin(); + ChangeTable::const_iterator itend = table_.end(); + + for (; it != itend; ++it) { + if (it->range.intersects(Range(start, end ? end - 1 : 0)) + && it->change.type != Change::INSERTED) { + return true; + } + } + return false; +} + + +void Changes::merge() +{ + lyxerr[Debug::CHANGES] << "Starting merge" << endl; + ChangeTable::iterator it = table_.begin(); + + while (it != table_.end()) { + lyxerr[Debug::CHANGES] << "Range of type " << it->change.type << " is " + << it->range.start << "," << it->range.end << endl; + + if (it->range.start == it->range.end) { + lyxerr[Debug::CHANGES] << "Removing empty range for pos " + << it->range.start << endl; + table_.erase(it); + // start again + it = table_.begin(); + continue; + } + + if (it + 1 == table_.end()) + break; + + if (it->change == (it + 1)->change) { + lyxerr[Debug::CHANGES] << "Merging equal ranges " + << it->range.start << "," << it->range.end + << " and " << (it + 1)->range.start << "," + << (it + 1)->range.end << endl; + (it + 1)->range.start = it->range.start; + table_.erase(it); + // start again + it = table_.begin(); + continue; + } + + ++it; + } + + lyxerr[Debug::CHANGES] << "Merge ended" << endl; + check(); +} + + +void Changes::check() const +{ + ChangeTable::const_iterator it = table_.begin(); + ChangeTable::const_iterator end = table_.end(); + + bool dont_assert(true); + + lyxerr[Debug::CHANGES] << "Changelist:" << endl; + for (; it != end; ++it) { + lyxerr[Debug::CHANGES] << "Range of type " << it->change.type << " is " + << it->range.start << "," << it->range.end << " author " + << it->change.author << " time " << it->change.changetime << endl; + if (it + 1 == end) + break; + + Range const & range(it->range); + Range const & next((it + 1)->range); + if (range.end != next.start) + dont_assert = false; + } + lyxerr[Debug::CHANGES] << "End" << endl; + lyx::Assert(dont_assert); +} + + +int Changes::latexMarkChange(std::ostream & os, Change::Type old, Change::Type change) +{ + if (old == change) + return 0; + + string const start("\\changestart{}"); + string const end("\\changeend{}"); + string const son("\\overstrikeon{}"); + string const soff("\\overstrikeoff{}"); + + int column = 0; + + if (old == Change::DELETED) { + os << soff; + column += soff.length(); + } + + switch (change) { + case Change::UNCHANGED: + os << end; + column += end.length(); + break; + + case Change::DELETED: + if (old == Change::UNCHANGED) { + os << start; + column += start.length(); + } + os << son; + column += son.length(); + break; + + case Change::INSERTED: + if (old == Change::UNCHANGED) { + os << start; + column += start.length(); + } + break; + } + + return column; +} + + +void Changes::lyxMarkChange(std::ostream & os, int & column, time_t curtime, + Change const & old, Change const & change) +{ + if (old == change) + return; + + column = 0; + + switch (change.type) { + case Change::UNCHANGED: + os << "\n\\change_unchanged\n"; + break; + + case Change::DELETED: { + time_t t(change.changetime); + if (!t) + t = curtime; + os << "\n\\change_deleted " << change.author + << " " << t << "\n"; + + break; + } + + case Change::INSERTED: + time_t t(change.changetime); + if (!t) + t = curtime; + os << "\n\\change_inserted " << change.author + << " " << t << "\n"; + break; + } +} diff -Nurb -x CVS -x version.C -x LaTeXConfig.lyx -x autom4te.cache -x pathscale -x po lyx-1.3.5/src/changes.h lyx-1.3.5-changebars/src/changes.h --- lyx-1.3.5/src/changes.h 1969-12-31 16:00:00.000000000 -0800 +++ lyx-1.3.5-changebars/src/changes.h 2004-11-12 15:37:12.305109188 -0800 @@ -0,0 +1,153 @@ +/** + * \file changes.h + * Copyright 2002 the LyX Team + * Read the file COPYING + * + * Record changes in a paragraph. + * + * \author John Levon + */ + +#ifndef CHANGES_H +#define CHANGES_H + +#include + +#ifdef __GNUG__ +#pragma interface +#endif + +#include +#include +#include + +struct Change { + /// the type of change + enum Type { + UNCHANGED, // no change + INSERTED, // new text + DELETED // deleted text + }; + + Change(Type t = UNCHANGED, int a = 0, time_t ct = 0) + : type(t), author(a), changetime(ct) {} + + Type type; + + int author; + + time_t changetime; +}; + +bool operator==(Change const & l, Change const & r); +bool operator!=(Change const & l, Change const & r); + +class Changes { +public: + + Changes(Change::Type type); + + ~Changes(); + + Changes(Changes const &); + + /// reset "default" change type (for empty pars) + void reset(Change::Type type) { + empty_type_ = type; + } + + /// set the position to the given change + void set(Change change, lyx::pos_type pos); + + /// set the position to the given change + void set(Change::Type, lyx::pos_type pos); + + /// set the range to the given change + void set(Change::Type, lyx::pos_type start, lyx::pos_type end); + + /// set the range to the given change + void set(Change, lyx::pos_type start, lyx::pos_type end); + + /// mark the given change and adjust + void record(Change, lyx::pos_type pos); + + /// return the change type at the given position + Change::Type lookup(lyx::pos_type pos) const; + + /// return the change at the given position + Change const lookupFull(lyx::pos_type pos) const; + + /// return true if there is a change in the given range + bool isChange(lyx::pos_type start, lyx::pos_type end) const; + + /// return true if there is a deleted or unchanged range contained + bool isChangeEdited(lyx::pos_type start, lyx::pos_type end) const; + + /// remove the given entry + void erase(lyx::pos_type pos); + + /// output latex to mark a transition between two changetypes + /// returns length of text outputted + static int latexMarkChange(std::ostream & os, Change::Type old, Change::Type change); + + /// output .lyx file format for transitions between changes + static void lyxMarkChange(std::ostream & os, int & column, + time_t curtime, Change const & old, Change const & change); + +private: + struct Range { + Range(lyx::pos_type s, lyx::pos_type e) + : start(s), end(e) {} + + // does this range contain r ? + bool contains(Range const & r) const; + + // does this range contain pos ? + bool contains(lyx::pos_type pos) const; + + // does this range contain pos, or can it be appended ? + bool loose_contains(lyx::pos_type pos) const; + + // is this range contained within r ? + bool contained(Range const & r) const; + + // do the ranges intersect ? + bool intersects(Range const & r) const; + + lyx::pos_type start; + lyx::pos_type end; + }; + + friend bool operator==(Range const & r1, Range const & r2); + friend bool operator!=(Range const & r1, Range const & r2); + + struct ChangeRange { + ChangeRange(lyx::pos_type s, lyx::pos_type e, Change c) + : range(Range(s, e)), change(c) {} + Range range; + Change change; + }; + + typedef std::vector ChangeTable; + + /// our table of changes + ChangeTable table_; + + /// change type for an empty paragraph + Change::Type empty_type_; + + /// handle a delete + void del(Change change, ChangeTable::size_type pos); + + /// handle an add + void add(Change change, ChangeTable::size_type pos); + + /// merge neighbouring ranges + void merge(); + + /// consistency check + void check() const; + +}; + +#endif // CHANGES_H diff -Nurb -x CVS -x version.C -x LaTeXConfig.lyx -x autom4te.cache -x pathscale -x po lyx-1.3.5/src/commandtags.h lyx-1.3.5-changebars/src/commandtags.h --- lyx-1.3.5/src/commandtags.h 2002-11-29 05:22:38.000000000 -0800 +++ lyx-1.3.5-changebars/src/commandtags.h 2004-11-12 15:37:10.569292432 -0800 @@ -290,6 +290,12 @@ LFUN_MOUSE_TRIPLE, // André 9 Aug 2002 LFUN_EDIT, // André 16 Aug 2002 LFUN_INSET_WRAP, // Dekel 7 Apr 2002 + LFUN_TRACK_CHANGES, // Levon 20021001 (cool date !) + LFUN_MERGE_CHANGES, // Levon 20021016 + LFUN_ACCEPT_CHANGE, // Levon 20021016 + LFUN_REJECT_CHANGE, // Levon 20021016 + LFUN_ACCEPT_ALL_CHANGES, // Levon 20021016 + LFUN_REJECT_ALL_CHANGES, // Levon 20021016 LFUN_LASTACTION /* this marks the end of the table */ }; diff -Nurb -x CVS -x version.C -x LaTeXConfig.lyx -x autom4te.cache -x pathscale -x po lyx-1.3.5/src/debug.C lyx-1.3.5-changebars/src/debug.C --- lyx-1.3.5/src/debug.C 2004-04-20 05:26:39.000000000 -0700 +++ lyx-1.3.5-changebars/src/debug.C 2004-11-12 15:37:11.995141910 -0800 @@ -58,6 +58,7 @@ { Debug::WORKAREA, "workarea", N_("Workarea events")}, { Debug::INSETTEXT, "insettext", N_("Insettext/tabular messages")}, { Debug::GRAPHICS, "graphics", N_("Graphics conversion and loading")}, + { Debug::CHANGES, "changes", N_("Change tracking")}, { Debug::ANY, "any", N_("All debugging messages")} }; @@ -73,7 +74,7 @@ Debug::MATHED | Debug::FONT | Debug::TCLASS | Debug::LYXVC | Debug::LYXSERVER | Debug::ROFF | Debug::ACTION | Debug::LYXLEX | Debug::DEPEND | Debug::INSETS | Debug::FILES | Debug::WORKAREA | - Debug::INSETTEXT | Debug::GRAPHICS); + Debug::INSETTEXT | Debug::GRAPHICS | Debug::CHANGES); Debug::type Debug::value(string const & val) diff -Nurb -x CVS -x version.C -x LaTeXConfig.lyx -x autom4te.cache -x pathscale -x po lyx-1.3.5/src/debug.h lyx-1.3.5-changebars/src/debug.h --- lyx-1.3.5/src/debug.h 2002-03-21 09:25:09.000000000 -0800 +++ lyx-1.3.5-changebars/src/debug.h 2004-11-12 15:37:10.381312276 -0800 @@ -72,7 +72,9 @@ /// INSETTEXT = (1 << 20), /// - GRAPHICS = (1 << 21) + GRAPHICS = (1 << 21), + /// change tracking + CHANGES = (1 << 22) }; /// static type const ANY; diff -Nurb -x CVS -x version.C -x LaTeXConfig.lyx -x autom4te.cache -x pathscale -x po lyx-1.3.5/src/frontends/Dialogs.h lyx-1.3.5-changebars/src/frontends/Dialogs.h --- lyx-1.3.5/src/frontends/Dialogs.h 2002-09-10 03:18:57.000000000 -0700 +++ lyx-1.3.5-changebars/src/frontends/Dialogs.h 2004-11-12 15:37:11.650178327 -0800 @@ -126,6 +126,8 @@ void showLogFile(); /// display the top-level maths panel void showMathPanel(); + /// show the merge changes dialog + void showMergeChanges(); /// void showMinipage(InsetMinipage *); /// diff -Nurb -x CVS -x version.C -x LaTeXConfig.lyx -x autom4te.cache -x pathscale -x po lyx-1.3.5/src/frontends/controllers/ControlChanges.C lyx-1.3.5-changebars/src/frontends/controllers/ControlChanges.C --- lyx-1.3.5/src/frontends/controllers/ControlChanges.C 1969-12-31 16:00:00.000000000 -0800 +++ lyx-1.3.5-changebars/src/frontends/controllers/ControlChanges.C 2004-11-12 15:37:10.381312276 -0800 @@ -0,0 +1,82 @@ +/** + * \file ControlChanges.C + * This file is part of LyX, the document processor. + * Licence details can be found in the file COPYING. + * + * \author John Levon + * + * Full author contact details are available in file CREDITS + */ + +#include + +#ifdef __GNUG__ +#pragma implementation +#endif + +#include "ViewBase.h" +#include "ButtonControllerBase.h" +#include "ControlChanges.h" +#include "frontends/Dialogs.h" +#include "frontends/LyXView.h" +#include "buffer.h" +#include "lyxfind.h" +#include "lyxfunc.h" +#include "debug.h" +#include "BufferView.h" +#include "support/lstrings.h" +#include "funcrequest.h" +#include "author.h" + +ControlChanges::ControlChanges(LyXView & lv, Dialogs & d) + : ControlDialogBD(lv, d) +{ +} + + +void ControlChanges::find() +{ + lyxfind::findNextChange(bufferview()); +} + + +string const ControlChanges::getChangeDate() +{ + Change c(bufferview()->getCurrentChange()); + if (c.type == Change::UNCHANGED || !c.changetime) + return string(); + return ctime(&c.changetime); +} + + +string const ControlChanges::getChangeAuthor() +{ + Change c(bufferview()->getCurrentChange()); + if (c.type == Change::UNCHANGED) + return string(); + + Author const & a(authorlist.get(c.author)); + + string author(a.name()); + + if (!a.email().empty()) { + author += " ("; + author += a.email() + ")"; + } + + return author; +} + + +void ControlChanges::accept() +{ + lv_.dispatch(FuncRequest(LFUN_ACCEPT_CHANGE)); + lyxfind::findNextChange(bufferview()); +} + + +void ControlChanges::reject() +{ + lv_.dispatch(FuncRequest(LFUN_REJECT_CHANGE)); + lyxfind::findNextChange(bufferview()); +} diff -Nurb -x CVS -x version.C -x LaTeXConfig.lyx -x autom4te.cache -x pathscale -x po lyx-1.3.5/src/frontends/controllers/ControlChanges.h lyx-1.3.5-changebars/src/frontends/controllers/ControlChanges.h --- lyx-1.3.5/src/frontends/controllers/ControlChanges.h 1969-12-31 16:00:00.000000000 -0800 +++ lyx-1.3.5-changebars/src/frontends/controllers/ControlChanges.h 2004-11-12 15:37:11.012245671 -0800 @@ -0,0 +1,49 @@ +// -*- C++ -*- +/** + * \file ControlChanges.h + * This file is part of LyX, the document processor. + * Licence details can be found in the file COPYING. + * + * \author John Levon + * + * Full author contact details are available in file CREDITS + */ + +#ifndef CONTROLCHANGES_H +#define CONTROLCHANGES_H + +#ifdef __GNUG__ +#pragma interface +#endif + +#include "ControlDialog_impl.h" +#include "LString.h" + +/** + * A controller for the merge changes dialog. + */ +class ControlChanges : public ControlDialogBD { +public: + ControlChanges(LyXView &, Dialogs &); + + /// find the next merge chunk and highlight it + void find(); + + /// return date of change + string const getChangeDate(); + + /// return author of change + string const getChangeAuthor(); + + /// accept the current merge + void accept(); + + /// reject the current merge + void reject(); + +private: + /// not needed. + virtual void apply() {} +}; + +#endif // CONTROLCHANGES_H diff -Nurb -x CVS -x version.C -x LaTeXConfig.lyx -x autom4te.cache -x pathscale -x po lyx-1.3.5/src/frontends/controllers/Makefile.am lyx-1.3.5-changebars/src/frontends/controllers/Makefile.am --- lyx-1.3.5/src/frontends/controllers/Makefile.am 2002-11-14 18:41:54.000000000 -0800 +++ lyx-1.3.5-changebars/src/frontends/controllers/Makefile.am 2004-11-12 15:37:11.650178327 -0800 @@ -31,6 +31,8 @@ ControlButtons.h \ ControlCharacter.C \ ControlCharacter.h \ + ControlChanges.C \ + ControlChanges.h \ ControlCitation.C \ ControlCitation.h \ ControlCommand.C \ diff -Nurb -x CVS -x version.C -x LaTeXConfig.lyx -x autom4te.cache -x pathscale -x po lyx-1.3.5/src/frontends/controllers/Makefile.in lyx-1.3.5-changebars/src/frontends/controllers/Makefile.in --- lyx-1.3.5/src/frontends/controllers/Makefile.in 2004-10-06 07:43:19.000000000 -0700 +++ lyx-1.3.5-changebars/src/frontends/controllers/Makefile.in 2004-11-12 15:37:10.536295915 -0800 @@ -253,6 +253,8 @@ ControlButtons.h \ ControlCharacter.C \ ControlCharacter.h \ + ControlChanges.C \ + ControlChanges.h \ ControlCitation.C \ ControlCitation.h \ ControlCommand.C \ @@ -339,18 +341,18 @@ am_libcontrollers_la_OBJECTS = biblio.lo character.lo frnt_lang.lo \ tex_helpers.lo ButtonControllerBase.lo ButtonPolicies.lo \ ControlAboutlyx.lo ControlBibitem.lo ControlBibtex.lo \ - ControlButtons.lo ControlCharacter.lo ControlCitation.lo \ - ControlCommand.lo ControlCommandBuffer.lo ControlConnections.lo \ - ControlDialog_impl.lo ControlDocument.lo ControlError.lo \ - ControlERT.lo ControlExternal.lo ControlFloat.lo \ - ControlForks.lo ControlGraphics.lo ControlInclude.lo \ - ControlIndex.lo ControlLog.lo ControlMath.lo ControlMinipage.lo \ - ControlParagraph.lo ControlPreamble.lo ControlPrefs.lo \ - ControlPrint.lo ControlRef.lo ControlSearch.lo ControlSendto.lo \ - ControlShowFile.lo ControlSpellchecker.lo ControlTabular.lo \ - ControlTabularCreate.lo ControlTexinfo.lo ControlThesaurus.lo \ - ControlToc.lo ControlUrl.lo ControlVCLog.lo ControlWrap.lo \ - helper_funcs.lo + ControlButtons.lo ControlCharacter.lo ControlChanges.lo \ + ControlCitation.lo ControlCommand.lo ControlCommandBuffer.lo \ + ControlConnections.lo ControlDialog_impl.lo ControlDocument.lo \ + ControlError.lo ControlERT.lo ControlExternal.lo \ + ControlFloat.lo ControlForks.lo ControlGraphics.lo \ + ControlInclude.lo ControlIndex.lo ControlLog.lo ControlMath.lo \ + ControlMinipage.lo ControlParagraph.lo ControlPreamble.lo \ + ControlPrefs.lo ControlPrint.lo ControlRef.lo ControlSearch.lo \ + ControlSendto.lo ControlShowFile.lo ControlSpellchecker.lo \ + ControlTabular.lo ControlTabularCreate.lo ControlTexinfo.lo \ + ControlThesaurus.lo ControlToc.lo ControlUrl.lo ControlVCLog.lo \ + ControlWrap.lo helper_funcs.lo libcontrollers_la_OBJECTS = $(am_libcontrollers_la_OBJECTS) DEFS = @DEFS@ @@ -365,6 +367,7 @@ @AMDEP_TRUE@ ./$(DEPDIR)/ControlBibitem.Plo \ @AMDEP_TRUE@ ./$(DEPDIR)/ControlBibtex.Plo \ @AMDEP_TRUE@ ./$(DEPDIR)/ControlButtons.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/ControlChanges.Plo \ @AMDEP_TRUE@ ./$(DEPDIR)/ControlCharacter.Plo \ @AMDEP_TRUE@ ./$(DEPDIR)/ControlCitation.Plo \ @AMDEP_TRUE@ ./$(DEPDIR)/ControlCommand.Plo \ @@ -455,6 +458,7 @@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ControlBibitem.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ControlBibtex.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ControlButtons.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ControlChanges.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ControlCharacter.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ControlCitation.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ControlCommand.Plo@am__quote@ diff -Nurb -x CVS -x version.C -x LaTeXConfig.lyx -x autom4te.cache -x pathscale -x po lyx-1.3.5/src/frontends/qt2/Dialogs.C lyx-1.3.5-changebars/src/frontends/qt2/Dialogs.C --- lyx-1.3.5/src/frontends/qt2/Dialogs.C 2003-01-13 01:57:15.000000000 -0800 +++ lyx-1.3.5-changebars/src/frontends/qt2/Dialogs.C 2004-11-12 15:37:10.963250843 -0800 @@ -47,6 +47,7 @@ : aboutlyx(lv, d), bibitem(lv, d), bibtex(lv, d), + changes(lv, d), character(lv, d), citation(lv, d), document(lv, d), diff -Nurb -x CVS -x version.C -x LaTeXConfig.lyx -x autom4te.cache -x pathscale -x po lyx-1.3.5/src/frontends/qt2/Dialogs2.C lyx-1.3.5-changebars/src/frontends/qt2/Dialogs2.C --- lyx-1.3.5/src/frontends/qt2/Dialogs2.C 2003-01-31 05:50:21.000000000 -0800 +++ lyx-1.3.5-changebars/src/frontends/qt2/Dialogs2.C 2004-11-12 15:37:11.191226776 -0800 @@ -145,6 +145,10 @@ createMathPanel(); } +void Dialogs::showMergeChanges() +{ + pimpl_->changes.controller().show(); +} void Dialogs::showMinipage(InsetMinipage * im) { diff -Nurb -x CVS -x version.C -x LaTeXConfig.lyx -x autom4te.cache -x pathscale -x po lyx-1.3.5/src/frontends/qt2/Dialogs_impl.h lyx-1.3.5-changebars/src/frontends/qt2/Dialogs_impl.h --- lyx-1.3.5/src/frontends/qt2/Dialogs_impl.h 2003-07-03 06:36:25.000000000 -0700 +++ lyx-1.3.5-changebars/src/frontends/qt2/Dialogs_impl.h 2004-11-12 15:37:10.510298659 -0800 @@ -21,6 +21,7 @@ #include "ControlAboutlyx.h" #include "ControlBibitem.h" #include "ControlBibtex.h" +#include "ControlChanges.h" #include "ControlCharacter.h" #include "ControlCitation.h" #include "ControlDocument.h" @@ -57,6 +58,8 @@ #include "QBibitemDialog.h" #include "QBibtex.h" #include "QBibtexDialog.h" +#include "QChanges.h" +#include "QChangesDialog.h" #include "QCharacter.h" #include "QCharacterDialog.h" #include "QCitation.h" @@ -137,6 +140,9 @@ typedef GUI BibtexDialog; +typedef GUI +ChangesDialog; + typedef GUI CharacterDialog; @@ -230,6 +236,7 @@ AboutlyxDialog aboutlyx; BibitemDialog bibitem; BibtexDialog bibtex; + ChangesDialog changes; CharacterDialog character; CitationDialog citation; DocumentDialog document; diff -Nurb -x CVS -x version.C -x LaTeXConfig.lyx -x autom4te.cache -x pathscale -x po lyx-1.3.5/src/frontends/qt2/Makefile.am lyx-1.3.5-changebars/src/frontends/qt2/Makefile.am --- lyx-1.3.5/src/frontends/qt2/Makefile.am 2004-08-09 05:48:15.000000000 -0700 +++ lyx-1.3.5-changebars/src/frontends/qt2/Makefile.am 2004-11-12 15:37:10.644284515 -0800 @@ -28,6 +28,7 @@ QAbout.C QAbout.h \ QBibitem.C QBibitem.h \ QBibtex.C QBibtex.h \ + QChanges.C QChanges.h \ QCharacter.C QCharacter.h \ QCitation.C QCitation.h \ QDocument.C QDocument.h \ diff -Nurb -x CVS -x version.C -x LaTeXConfig.lyx -x autom4te.cache -x pathscale -x po lyx-1.3.5/src/frontends/qt2/Makefile.dialogs lyx-1.3.5-changebars/src/frontends/qt2/Makefile.dialogs --- lyx-1.3.5/src/frontends/qt2/Makefile.dialogs 2003-01-13 02:39:18.000000000 -0800 +++ lyx-1.3.5-changebars/src/frontends/qt2/Makefile.dialogs 2004-11-12 15:37:11.150231104 -0800 @@ -14,6 +14,7 @@ QAskForTextDialog.ui \ QBibitemDialogBase.ui \ QBibtexDialogBase.ui \ + QChangesDialogBase.ui \ QCharacterDialogBase.ui \ QCitationDialogBase.ui \ QDelimiterDialogBase.ui \ @@ -71,6 +72,7 @@ QBibitemDialog.C QBibitemDialog.h \ QBibtexDialog.C QBibtexDialog.h \ QBrowseBox.C QBrowseBox.h \ + QChangesDialog.C QChangesDialog.h \ QCharacterDialog.C QCharacterDialog.h \ QCitationDialog.C QCitationDialog.h \ QCommandBuffer.C QCommandBuffer.h \ diff -Nurb -x CVS -x version.C -x LaTeXConfig.lyx -x autom4te.cache -x pathscale -x po lyx-1.3.5/src/frontends/qt2/Makefile.in lyx-1.3.5-changebars/src/frontends/qt2/Makefile.in --- lyx-1.3.5/src/frontends/qt2/Makefile.in 2004-10-06 07:43:19.000000000 -0700 +++ lyx-1.3.5-changebars/src/frontends/qt2/Makefile.in 2004-11-12 15:37:12.226117527 -0800 @@ -237,6 +237,7 @@ QAskForTextDialog.ui \ QBibitemDialogBase.ui \ QBibtexDialogBase.ui \ + QChangesDialogBase.ui \ QCharacterDialogBase.ui \ QCitationDialogBase.ui \ QDelimiterDialogBase.ui \ @@ -295,6 +296,7 @@ QBibitemDialog.C QBibitemDialog.h \ QBibtexDialog.C QBibtexDialog.h \ QBrowseBox.C QBrowseBox.h \ + QChangesDialog.C QChangesDialog.h \ QCharacterDialog.C QCharacterDialog.h \ QCitationDialog.C QCitationDialog.h \ QCommandBuffer.C QCommandBuffer.h \ @@ -366,6 +368,7 @@ QAbout.C QAbout.h \ QBibitem.C QBibitem.h \ QBibtex.C QBibtex.h \ + QChanges.C QChanges.h \ QCharacter.C QCharacter.h \ QCitation.C QCitation.h \ QDocument.C QDocument.h \ @@ -423,27 +426,27 @@ am__objects_1 = BulletsModule.lo emptytable.lo FileDialog_private.lo \ iconpalette.lo io_callback.lo lengthcombo.lo QAboutDialog.lo \ QBibitemDialog.lo QBibtexDialog.lo QBrowseBox.lo \ - QCharacterDialog.lo QCitationDialog.lo QCommandBuffer.lo \ - QCommandEdit.lo QContentPane.lo QDelimiterDialog.lo \ - QDocumentDialog.lo QErrorDialog.lo QERTDialog.lo \ - QExternalDialog.lo QFloatDialog.lo QGraphicsDialog.lo \ - qgridview.lo QIncludeDialog.lo QIndexDialog.lo QLogDialog.lo \ - QLPopupMenu.lo QLPrintDialog.lo QMathDialog.lo \ - QMathMatrixDialog.lo QMinipageDialog.lo QParagraphDialog.lo \ - QPrefsDialog.lo QRefDialog.lo QSearchDialog.lo QSendtoDialog.lo \ - qsetborder.lo QShowFileDialog.lo QSpellcheckerDialog.lo \ - Qt2Base.lo QTabularCreateDialog.lo QTabularDialog.lo \ - QTexinfoDialog.lo QThesaurusDialog.lo QTocDialog.lo \ - qttableview.lo QtView.lo QURLDialog.lo QVCLogDialog.lo \ - QWrapDialog.lo Toolbar_pimpl.lo + QChangesDialog.lo QCharacterDialog.lo QCitationDialog.lo \ + QCommandBuffer.lo QCommandEdit.lo QContentPane.lo \ + QDelimiterDialog.lo QDocumentDialog.lo QErrorDialog.lo \ + QERTDialog.lo QExternalDialog.lo QFloatDialog.lo \ + QGraphicsDialog.lo qgridview.lo QIncludeDialog.lo \ + QIndexDialog.lo QLogDialog.lo QLPopupMenu.lo QLPrintDialog.lo \ + QMathDialog.lo QMathMatrixDialog.lo QMinipageDialog.lo \ + QParagraphDialog.lo QPrefsDialog.lo QRefDialog.lo \ + QSearchDialog.lo QSendtoDialog.lo qsetborder.lo \ + QShowFileDialog.lo QSpellcheckerDialog.lo Qt2Base.lo \ + QTabularCreateDialog.lo QTabularDialog.lo QTexinfoDialog.lo \ + QThesaurusDialog.lo QTocDialog.lo qttableview.lo QtView.lo \ + QURLDialog.lo QVCLogDialog.lo QWrapDialog.lo Toolbar_pimpl.lo am_libqt2_la_OBJECTS = Alert_pimpl.lo bulletstrings.lo Dialogs.lo \ Dialogs2.lo FileDialog.lo LyXKeySymFactory.lo \ LyXScreenFactory.lo Menubar_pimpl.lo Timeout_pimpl.lo QAbout.lo \ - QBibitem.lo QBibtex.lo QCharacter.lo QCitation.lo QDocument.lo \ - QError.lo QERT.lo QExternal.lo QFloat.lo QGraphics.lo \ - QInclude.lo QIndex.lo QLImage.lo QLog.lo QLPainter.lo \ - QLyXKeySym.lo QMath.lo QMinipage.lo QParagraph.lo QPrefs.lo \ - QPrint.lo QRef.lo QSearch.lo QSendto.lo QShowFile.lo \ + QBibitem.lo QBibtex.lo QChanges.lo QCharacter.lo QCitation.lo \ + QDocument.lo QError.lo QERT.lo QExternal.lo QFloat.lo \ + QGraphics.lo QInclude.lo QIndex.lo QLImage.lo QLog.lo \ + QLPainter.lo QLyXKeySym.lo QMath.lo QMinipage.lo QParagraph.lo \ + QPrefs.lo QPrint.lo QRef.lo QSearch.lo QSendto.lo QShowFile.lo \ QSpellchecker.lo QTabular.lo QTabularCreate.lo QTexinfo.lo \ QThesaurus.lo QToc.lo QURL.lo QVCLog.lo QWorkArea.lo QWrap.lo \ Qt2BC.lo WorkAreaFactory.lo lyx_gui.lo qcoloritem.lo \ @@ -470,7 +473,8 @@ @AMDEP_TRUE@ ./$(DEPDIR)/QBibitemDialog.Plo \ @AMDEP_TRUE@ ./$(DEPDIR)/QBibtex.Plo \ @AMDEP_TRUE@ ./$(DEPDIR)/QBibtexDialog.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/QBrowseBox.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/QBrowseBox.Plo ./$(DEPDIR)/QChanges.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/QChangesDialog.Plo \ @AMDEP_TRUE@ ./$(DEPDIR)/QCharacter.Plo \ @AMDEP_TRUE@ ./$(DEPDIR)/QCharacterDialog.Plo \ @AMDEP_TRUE@ ./$(DEPDIR)/QCitation.Plo \ @@ -610,6 +614,8 @@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/QBibtex.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/QBibtexDialog.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/QBrowseBox.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/QChanges.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/QChangesDialog.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/QCharacter.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/QCharacterDialog.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/QCitation.Plo@am__quote@ diff -Nurb -x CVS -x version.C -x LaTeXConfig.lyx -x autom4te.cache -x pathscale -x po lyx-1.3.5/src/frontends/qt2/QChanges.C lyx-1.3.5-changebars/src/frontends/qt2/QChanges.C --- lyx-1.3.5/src/frontends/qt2/QChanges.C 1969-12-31 16:00:00.000000000 -0800 +++ lyx-1.3.5-changebars/src/frontends/qt2/QChanges.C 2004-11-12 15:37:11.800162494 -0800 @@ -0,0 +1,75 @@ +/** + * \file QChanges.C + * This file is part of LyX, the document processor. + * Licence details can be found in the file COPYING. + * + * \author John Levon + * + * Full author contact details are available in file CREDITS + */ + +#include + +#ifdef __GNUG__ +#pragma implementation +#endif + +#include "ControlChanges.h" +#include "qt_helpers.h" + +#include +#include + +#include "QChangesDialog.h" +#include "QChanges.h" +#include "Qt2BC.h" +#include "debug.h" +#include + +typedef Qt2CB > base_class; + + +QChanges::QChanges() + : base_class(qt_("LyX: Merge Changes")) +{ +} + + +void QChanges::build_dialog() +{ + dialog_.reset(new QChangesDialog(this)); + + bc().setCancel(dialog_->closePB); + bc().addReadOnly(dialog_->acceptPB); + bc().addReadOnly(dialog_->rejectPB); +} + + +void QChanges::next() +{ + controller().find(); + + string text; + string author(controller().getChangeAuthor()); + string date(controller().getChangeDate()); + + if (!author.empty()) { + text += "Change by " + author + "\n\n"; + } + if (!date.empty()) { + text += "Change made at " + date + "\n"; + } + dialog_->changeTB->setText(toqstr(text)); +} + + +void QChanges::accept() +{ + controller().accept(); +} + + +void QChanges::reject() +{ + controller().reject(); +} diff -Nurb -x CVS -x version.C -x LaTeXConfig.lyx -x autom4te.cache -x pathscale -x po lyx-1.3.5/src/frontends/qt2/QChanges.h lyx-1.3.5-changebars/src/frontends/qt2/QChanges.h --- lyx-1.3.5/src/frontends/qt2/QChanges.h 1969-12-31 16:00:00.000000000 -0800 +++ lyx-1.3.5-changebars/src/frontends/qt2/QChanges.h 2004-11-12 15:37:11.568186982 -0800 @@ -0,0 +1,49 @@ +// -*- C++ -*- +/** + * \file QChanges.h + * This file is part of LyX, the document processor. + * Licence details can be found in the file COPYING. + * + * \author John Levon + * \author Kalle Dalheimer + * + * Full author contact details are available in file CREDITS + */ + +#ifndef QCHANGES_H +#define QCHANGES_H + +#ifdef __GNUG__ +#pragma interface +#endif + +#include "Qt2Base.h" + +class ControlChanges; +class QChangesDialog; + + +class QChanges + : public Qt2CB > +{ +public: + friend class QChangesDialog; + + QChanges(); + + void accept(); + + void reject(); + + void next(); + +private: + /// Apply changes + virtual void apply() {}; + ///update + virtual void update_contents() {}; + /// build the dialog + virtual void build_dialog(); +}; + +#endif // QCHANGES_H diff -Nurb -x CVS -x version.C -x LaTeXConfig.lyx -x autom4te.cache -x pathscale -x po lyx-1.3.5/src/frontends/qt2/QChangesDialog.C lyx-1.3.5-changebars/src/frontends/qt2/QChangesDialog.C --- lyx-1.3.5/src/frontends/qt2/QChangesDialog.C 1969-12-31 16:00:00.000000000 -0800 +++ lyx-1.3.5-changebars/src/frontends/qt2/QChangesDialog.C 2004-11-12 15:37:11.151230999 -0800 @@ -0,0 +1,57 @@ +/** + * \file QChangesDialog.C + * This file is part of LyX, the document processor. + * Licence details can be found in the file COPYING. + * + * \author John Levon + * + * Full author contact details are available in file CREDITS + */ + +#include + +#ifdef __GNUG__ +#pragma implementation +#endif + +#include "QChangesDialog.h" +#include "QChanges.h" +#include "qt_helpers.h" + +#include +#include +#include + +QChangesDialog::QChangesDialog(QChanges * form) + : QChangesDialogBase(0, 0, false, 0), + form_(form) +{ + connect(closePB, SIGNAL(clicked()), + form, SLOT(slotClose())); +} + + +void QChangesDialog::nextPressed() +{ + form_->next(); +} + + +void QChangesDialog::acceptPressed() +{ + form_->accept(); +} + + +void QChangesDialog::rejectPressed() +{ + form_->reject(); +} + + +void QChangesDialog::closeEvent(QCloseEvent * e) +{ + form_->slotWMHide(); + e->accept(); +} + diff -Nurb -x CVS -x version.C -x LaTeXConfig.lyx -x autom4te.cache -x pathscale -x po lyx-1.3.5/src/frontends/qt2/QChangesDialog.h lyx-1.3.5-changebars/src/frontends/qt2/QChangesDialog.h --- lyx-1.3.5/src/frontends/qt2/QChangesDialog.h 1969-12-31 16:00:00.000000000 -0800 +++ lyx-1.3.5-changebars/src/frontends/qt2/QChangesDialog.h 2004-11-12 15:37:10.201331276 -0800 @@ -0,0 +1,40 @@ +// -*- C++ -*- +/** + * \file QChangesDialog.h + * This file is part of LyX, the document processor. + * Licence details can be found in the file COPYING. + * + * \author John Levon + * + * Full author contact details are available in file CREDITS + */ + +#ifndef QCHANGESDIALOG_H +#define QCHANGESDIALOG_H + +#ifdef __GNUG__ +#pragma interface +#endif + +#include "ui/QChangesDialogBase.h" + +class QChanges; + +class QChangesDialog : public QChangesDialogBase { + Q_OBJECT +public: + QChangesDialog(QChanges * form); + +protected slots: + virtual void nextPressed(); + virtual void acceptPressed(); + virtual void rejectPressed(); + +protected: + virtual void closeEvent(QCloseEvent * e); + +private: + QChanges * form_; +}; + +#endif // QCHANGESDIALOG_H diff -Nurb -x CVS -x version.C -x LaTeXConfig.lyx -x autom4te.cache -x pathscale -x po lyx-1.3.5/src/frontends/qt2/moc/Makefile.in lyx-1.3.5-changebars/src/frontends/qt2/moc/Makefile.in --- lyx-1.3.5/src/frontends/qt2/moc/Makefile.in 2004-10-06 07:43:19.000000000 -0700 +++ lyx-1.3.5-changebars/src/frontends/qt2/moc/Makefile.in 2004-11-12 15:37:11.518192260 -0800 @@ -237,6 +237,7 @@ QAskForTextDialog.ui \ QBibitemDialogBase.ui \ QBibtexDialogBase.ui \ + QChangesDialogBase.ui \ QCharacterDialogBase.ui \ QCitationDialogBase.ui \ QDelimiterDialogBase.ui \ @@ -295,6 +296,7 @@ QBibitemDialog.C QBibitemDialog.h \ QBibtexDialog.C QBibtexDialog.h \ QBrowseBox.C QBrowseBox.h \ + QChangesDialog.C QChangesDialog.h \ QCharacterDialog.C QCharacterDialog.h \ QCitationDialog.C QCitationDialog.h \ QCommandBuffer.C QCommandBuffer.h \ @@ -362,14 +364,14 @@ am__objects_1 = BulletsModule_moc.lo emptytable_moc.lo \ FileDialog_private_moc.lo iconpalette_moc.lo io_callback_moc.lo \ lengthcombo_moc.lo QAboutDialog_moc.lo QBibitemDialog_moc.lo \ - QBibtexDialog_moc.lo QBrowseBox_moc.lo QCharacterDialog_moc.lo \ - QCitationDialog_moc.lo QCommandBuffer_moc.lo \ - QCommandEdit_moc.lo QContentPane_moc.lo QDelimiterDialog_moc.lo \ - QDocumentDialog_moc.lo QErrorDialog_moc.lo QERTDialog_moc.lo \ - QExternalDialog_moc.lo QFloatDialog_moc.lo \ - QGraphicsDialog_moc.lo qgridview_moc.lo QIncludeDialog_moc.lo \ - QIndexDialog_moc.lo QLogDialog_moc.lo QLPopupMenu_moc.lo \ - QLPrintDialog_moc.lo QMathDialog_moc.lo \ + QBibtexDialog_moc.lo QBrowseBox_moc.lo QChangesDialog_moc.lo \ + QCharacterDialog_moc.lo QCitationDialog_moc.lo \ + QCommandBuffer_moc.lo QCommandEdit_moc.lo QContentPane_moc.lo \ + QDelimiterDialog_moc.lo QDocumentDialog_moc.lo \ + QErrorDialog_moc.lo QERTDialog_moc.lo QExternalDialog_moc.lo \ + QFloatDialog_moc.lo QGraphicsDialog_moc.lo qgridview_moc.lo \ + QIncludeDialog_moc.lo QIndexDialog_moc.lo QLogDialog_moc.lo \ + QLPopupMenu_moc.lo QLPrintDialog_moc.lo QMathDialog_moc.lo \ QMathMatrixDialog_moc.lo QMinipageDialog_moc.lo \ QParagraphDialog_moc.lo QPrefsDialog_moc.lo QRefDialog_moc.lo \ QSearchDialog_moc.lo QSendtoDialog_moc.lo qsetborder_moc.lo \ @@ -394,6 +396,7 @@ @AMDEP_TRUE@ ./$(DEPDIR)/QBibitemDialog_moc.Plo \ @AMDEP_TRUE@ ./$(DEPDIR)/QBibtexDialog_moc.Plo \ @AMDEP_TRUE@ ./$(DEPDIR)/QBrowseBox_moc.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/QChangesDialog_moc.Plo \ @AMDEP_TRUE@ ./$(DEPDIR)/QCharacterDialog_moc.Plo \ @AMDEP_TRUE@ ./$(DEPDIR)/QCitationDialog_moc.Plo \ @AMDEP_TRUE@ ./$(DEPDIR)/QCommandBuffer_moc.Plo \ @@ -491,6 +494,7 @@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/QBibitemDialog_moc.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/QBibtexDialog_moc.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/QBrowseBox_moc.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/QChangesDialog_moc.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/QCharacterDialog_moc.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/QCitationDialog_moc.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/QCommandBuffer_moc.Plo@am__quote@ diff -Nurb -x CVS -x version.C -x LaTeXConfig.lyx -x autom4te.cache -x pathscale -x po lyx-1.3.5/src/frontends/qt2/ui/Makefile.in lyx-1.3.5-changebars/src/frontends/qt2/ui/Makefile.in --- lyx-1.3.5/src/frontends/qt2/ui/Makefile.in 2004-10-06 07:43:20.000000000 -0700 +++ lyx-1.3.5-changebars/src/frontends/qt2/ui/Makefile.in 2004-11-12 15:37:11.117234588 -0800 @@ -237,6 +237,7 @@ QAskForTextDialog.ui \ QBibitemDialogBase.ui \ QBibtexDialogBase.ui \ + QChangesDialogBase.ui \ QCharacterDialogBase.ui \ QCitationDialogBase.ui \ QDelimiterDialogBase.ui \ @@ -295,6 +296,7 @@ QBibitemDialog.C QBibitemDialog.h \ QBibtexDialog.C QBibtexDialog.h \ QBrowseBox.C QBrowseBox.h \ + QChangesDialog.C QChangesDialog.h \ QCharacterDialog.C QCharacterDialog.h \ QCitationDialog.C QCitationDialog.h \ QCommandBuffer.C QCommandBuffer.h \ @@ -370,25 +372,26 @@ NumberingModuleBase.lo PackagesModuleBase.lo PaperModuleBase.lo \ PreambleModuleBase.lo QAboutDialogBase.lo QAskForTextDialog.lo \ QBibitemDialogBase.lo QBibtexDialogBase.lo \ - QCharacterDialogBase.lo QCitationDialogBase.lo \ - QDelimiterDialogBase.lo QDocumentDialogBase.lo \ - QErrorDialogBase.lo QERTDialogBase.lo QExternalDialogBase.lo \ - QFloatDialogBase.lo QGraphicsDialogBase.lo \ - QIncludeDialogBase.lo QIndexDialogBase.lo QLogDialogBase.lo \ - QMathDialogBase.lo QMathMatrixDialogBase.lo \ - QMinipageDialogBase.lo QParagraphDialogBase.lo \ - QPrefAsciiModule.lo QPrefColorsModule.lo \ - QPrefConvertersModule.lo QPrefDateModule.lo \ - QPrefDisplayModule.lo QPrefFileformatsModule.lo \ - QPrefKeyboardModule.lo QPrefLanguageModule.lo \ - QPrefLatexModule.lo QPrefPathsModule.lo QPrefPrinterModule.lo \ - QPrefScreenFontsModule.lo QPrefsDialogBase.lo \ - QPrefSpellcheckerModule.lo QPrefUIModule.lo QPrintDialogBase.lo \ - QRefDialogBase.lo QSearchDialogBase.lo QSendtoDialogBase.lo \ - QShowFileDialogBase.lo QSpellcheckerDialogBase.lo \ - QTabularCreateDialogBase.lo QTabularDialogBase.lo \ - QTexinfoDialogBase.lo QThesaurusDialogBase.lo QTocDialogBase.lo \ - QURLDialogBase.lo QVCLogDialogBase.lo QWrapDialogBase.lo + QChangesDialogBase.lo QCharacterDialogBase.lo \ + QCitationDialogBase.lo QDelimiterDialogBase.lo \ + QDocumentDialogBase.lo QErrorDialogBase.lo QERTDialogBase.lo \ + QExternalDialogBase.lo QFloatDialogBase.lo \ + QGraphicsDialogBase.lo QIncludeDialogBase.lo \ + QIndexDialogBase.lo QLogDialogBase.lo QMathDialogBase.lo \ + QMathMatrixDialogBase.lo QMinipageDialogBase.lo \ + QParagraphDialogBase.lo QPrefAsciiModule.lo \ + QPrefColorsModule.lo QPrefConvertersModule.lo \ + QPrefDateModule.lo QPrefDisplayModule.lo \ + QPrefFileformatsModule.lo QPrefKeyboardModule.lo \ + QPrefLanguageModule.lo QPrefLatexModule.lo QPrefPathsModule.lo \ + QPrefPrinterModule.lo QPrefScreenFontsModule.lo \ + QPrefsDialogBase.lo QPrefSpellcheckerModule.lo QPrefUIModule.lo \ + QPrintDialogBase.lo QRefDialogBase.lo QSearchDialogBase.lo \ + QSendtoDialogBase.lo QShowFileDialogBase.lo \ + QSpellcheckerDialogBase.lo QTabularCreateDialogBase.lo \ + QTabularDialogBase.lo QTexinfoDialogBase.lo \ + QThesaurusDialogBase.lo QTocDialogBase.lo QURLDialogBase.lo \ + QVCLogDialogBase.lo QWrapDialogBase.lo nodist_libqt2ui_la_OBJECTS = $(am__objects_1) $(am__objects_2) libqt2ui_la_OBJECTS = $(nodist_libqt2ui_la_OBJECTS) @@ -411,6 +414,7 @@ @AMDEP_TRUE@ ./$(DEPDIR)/QAskForTextDialog.Plo \ @AMDEP_TRUE@ ./$(DEPDIR)/QBibitemDialogBase.Plo \ @AMDEP_TRUE@ ./$(DEPDIR)/QBibtexDialogBase.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/QChangesDialogBase.Plo \ @AMDEP_TRUE@ ./$(DEPDIR)/QCharacterDialogBase.Plo \ @AMDEP_TRUE@ ./$(DEPDIR)/QCitationDialogBase.Plo \ @AMDEP_TRUE@ ./$(DEPDIR)/QDelimiterDialogBase.Plo \ @@ -521,6 +525,7 @@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/QAskForTextDialog.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/QBibitemDialogBase.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/QBibtexDialogBase.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/QChangesDialogBase.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/QCharacterDialogBase.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/QCitationDialogBase.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/QDelimiterDialogBase.Plo@am__quote@ diff -Nurb -x CVS -x version.C -x LaTeXConfig.lyx -x autom4te.cache -x pathscale -x po lyx-1.3.5/src/frontends/qt2/ui/QChangesDialogBase.ui lyx-1.3.5-changebars/src/frontends/qt2/ui/QChangesDialogBase.ui --- lyx-1.3.5/src/frontends/qt2/ui/QChangesDialogBase.ui 1969-12-31 16:00:00.000000000 -0800 +++ lyx-1.3.5-changebars/src/frontends/qt2/ui/QChangesDialogBase.ui 2004-11-12 15:37:10.911256332 -0800 @@ -0,0 +1,199 @@ + +QChangesDialogBase +config.h +qt_helpers.h + + + QChangesDialogBase + + + + 0 + 0 + 240 + 272 + + + + + 5 + 5 + 0 + 0 + + + + Changes + + + true + + + + unnamed + + + + layout11 + + + + unnamed + + + + acceptPB + + + &Accept + + + + + rejectPB + + + &Reject + + + + + spacer3 + + + Horizontal + + + Expanding + + + + 237 + 31 + + + + + + + + spacer5 + + + Vertical + + + Expanding + + + + 31 + 43 + + + + + + layout10 + + + + unnamed + + + + nextPB + + + &Next Change + + + + + spacer4 + + + Horizontal + + + Expanding + + + + 201 + 20 + + + + + + closePB + + + &Close + + + Alt+C + + + true + + + + + + + changeTB + + + + 7 + 7 + 0 + 0 + + + + + + changeLA + + + Change: + + + + + + + closePB + clicked() + QChangesDialogBase + reject() + + + acceptPB + clicked() + QChangesDialogBase + acceptPressed() + + + rejectPB + clicked() + QChangesDialogBase + rejectPressed() + + + nextPB + clicked() + QChangesDialogBase + nextPressed() + + + + acceptPressed() + nextPressed() + rejectPressed() + + + diff -Nurb -x CVS -x version.C -x LaTeXConfig.lyx -x autom4te.cache -x pathscale -x po lyx-1.3.5/src/frontends/qt2/ui/moc/Makefile.in lyx-1.3.5-changebars/src/frontends/qt2/ui/moc/Makefile.in --- lyx-1.3.5/src/frontends/qt2/ui/moc/Makefile.in 2004-10-06 07:43:20.000000000 -0700 +++ lyx-1.3.5-changebars/src/frontends/qt2/ui/moc/Makefile.in 2004-11-12 15:37:11.739168932 -0800 @@ -237,6 +237,7 @@ QAskForTextDialog.ui \ QBibitemDialogBase.ui \ QBibtexDialogBase.ui \ + QChangesDialogBase.ui \ QCharacterDialogBase.ui \ QCitationDialogBase.ui \ QDelimiterDialogBase.ui \ @@ -295,6 +296,7 @@ QBibitemDialog.C QBibitemDialog.h \ QBibtexDialog.C QBibtexDialog.h \ QBrowseBox.C QBrowseBox.h \ + QChangesDialog.C QChangesDialog.h \ QCharacterDialog.C QCharacterDialog.h \ QCitationDialog.C QCitationDialog.h \ QCommandBuffer.C QCommandBuffer.h \ @@ -364,29 +366,30 @@ PackagesModuleBase_moc.lo PaperModuleBase_moc.lo \ PreambleModuleBase_moc.lo QAboutDialogBase_moc.lo \ QAskForTextDialog_moc.lo QBibitemDialogBase_moc.lo \ - QBibtexDialogBase_moc.lo QCharacterDialogBase_moc.lo \ - QCitationDialogBase_moc.lo QDelimiterDialogBase_moc.lo \ - QDocumentDialogBase_moc.lo QErrorDialogBase_moc.lo \ - QERTDialogBase_moc.lo QExternalDialogBase_moc.lo \ - QFloatDialogBase_moc.lo QGraphicsDialogBase_moc.lo \ - QIncludeDialogBase_moc.lo QIndexDialogBase_moc.lo \ - QLogDialogBase_moc.lo QMathDialogBase_moc.lo \ - QMathMatrixDialogBase_moc.lo QMinipageDialogBase_moc.lo \ - QParagraphDialogBase_moc.lo QPrefAsciiModule_moc.lo \ - QPrefColorsModule_moc.lo QPrefConvertersModule_moc.lo \ - QPrefDateModule_moc.lo QPrefDisplayModule_moc.lo \ - QPrefFileformatsModule_moc.lo QPrefKeyboardModule_moc.lo \ - QPrefLanguageModule_moc.lo QPrefLatexModule_moc.lo \ - QPrefPathsModule_moc.lo QPrefPrinterModule_moc.lo \ - QPrefScreenFontsModule_moc.lo QPrefsDialogBase_moc.lo \ - QPrefSpellcheckerModule_moc.lo QPrefUIModule_moc.lo \ - QPrintDialogBase_moc.lo QRefDialogBase_moc.lo \ - QSearchDialogBase_moc.lo QSendtoDialogBase_moc.lo \ - QShowFileDialogBase_moc.lo QSpellcheckerDialogBase_moc.lo \ - QTabularCreateDialogBase_moc.lo QTabularDialogBase_moc.lo \ - QTexinfoDialogBase_moc.lo QThesaurusDialogBase_moc.lo \ - QTocDialogBase_moc.lo QURLDialogBase_moc.lo \ - QVCLogDialogBase_moc.lo QWrapDialogBase_moc.lo + QBibtexDialogBase_moc.lo QChangesDialogBase_moc.lo \ + QCharacterDialogBase_moc.lo QCitationDialogBase_moc.lo \ + QDelimiterDialogBase_moc.lo QDocumentDialogBase_moc.lo \ + QErrorDialogBase_moc.lo QERTDialogBase_moc.lo \ + QExternalDialogBase_moc.lo QFloatDialogBase_moc.lo \ + QGraphicsDialogBase_moc.lo QIncludeDialogBase_moc.lo \ + QIndexDialogBase_moc.lo QLogDialogBase_moc.lo \ + QMathDialogBase_moc.lo QMathMatrixDialogBase_moc.lo \ + QMinipageDialogBase_moc.lo QParagraphDialogBase_moc.lo \ + QPrefAsciiModule_moc.lo QPrefColorsModule_moc.lo \ + QPrefConvertersModule_moc.lo QPrefDateModule_moc.lo \ + QPrefDisplayModule_moc.lo QPrefFileformatsModule_moc.lo \ + QPrefKeyboardModule_moc.lo QPrefLanguageModule_moc.lo \ + QPrefLatexModule_moc.lo QPrefPathsModule_moc.lo \ + QPrefPrinterModule_moc.lo QPrefScreenFontsModule_moc.lo \ + QPrefsDialogBase_moc.lo QPrefSpellcheckerModule_moc.lo \ + QPrefUIModule_moc.lo QPrintDialogBase_moc.lo \ + QRefDialogBase_moc.lo QSearchDialogBase_moc.lo \ + QSendtoDialogBase_moc.lo QShowFileDialogBase_moc.lo \ + QSpellcheckerDialogBase_moc.lo QTabularCreateDialogBase_moc.lo \ + QTabularDialogBase_moc.lo QTexinfoDialogBase_moc.lo \ + QThesaurusDialogBase_moc.lo QTocDialogBase_moc.lo \ + QURLDialogBase_moc.lo QVCLogDialogBase_moc.lo \ + QWrapDialogBase_moc.lo nodist_libqt2uimoc_la_OBJECTS = $(am__objects_1) libqt2uimoc_la_OBJECTS = $(nodist_libqt2uimoc_la_OBJECTS) @@ -409,6 +412,7 @@ @AMDEP_TRUE@ ./$(DEPDIR)/QAskForTextDialog_moc.Plo \ @AMDEP_TRUE@ ./$(DEPDIR)/QBibitemDialogBase_moc.Plo \ @AMDEP_TRUE@ ./$(DEPDIR)/QBibtexDialogBase_moc.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/QChangesDialogBase_moc.Plo \ @AMDEP_TRUE@ ./$(DEPDIR)/QCharacterDialogBase_moc.Plo \ @AMDEP_TRUE@ ./$(DEPDIR)/QCitationDialogBase_moc.Plo \ @AMDEP_TRUE@ ./$(DEPDIR)/QDelimiterDialogBase_moc.Plo \ @@ -505,6 +509,7 @@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/QAskForTextDialog_moc.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/QBibitemDialogBase_moc.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/QBibtexDialogBase_moc.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/QChangesDialogBase_moc.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/QCharacterDialogBase_moc.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/QCitationDialogBase_moc.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/QDelimiterDialogBase_moc.Plo@am__quote@ diff -Nurb -x CVS -x version.C -x LaTeXConfig.lyx -x autom4te.cache -x pathscale -x po lyx-1.3.5/src/frontends/xforms/Dialogs.C lyx-1.3.5-changebars/src/frontends/xforms/Dialogs.C --- lyx-1.3.5/src/frontends/xforms/Dialogs.C 2002-12-01 14:59:19.000000000 -0800 +++ lyx-1.3.5-changebars/src/frontends/xforms/Dialogs.C 2004-11-12 15:37:12.047136421 -0800 @@ -48,6 +48,7 @@ : aboutlyx(lv, d), bibitem(lv, d), bibtex(lv, d), + changes(lv, d), character(lv, d), citation(lv, d), document(lv, d), diff -Nurb -x CVS -x version.C -x LaTeXConfig.lyx -x autom4te.cache -x pathscale -x po lyx-1.3.5/src/frontends/xforms/Dialogs2.C lyx-1.3.5-changebars/src/frontends/xforms/Dialogs2.C --- lyx-1.3.5/src/frontends/xforms/Dialogs2.C 2003-01-31 05:50:21.000000000 -0800 +++ lyx-1.3.5-changebars/src/frontends/xforms/Dialogs2.C 2004-11-12 15:37:12.277112144 -0800 @@ -37,6 +37,12 @@ } +void Dialogs::showMergeChanges() +{ + pimpl_->changes.controller().show(); +} + + void Dialogs::showCharacter() { pimpl_->character.controller().show(); diff -Nurb -x CVS -x version.C -x LaTeXConfig.lyx -x autom4te.cache -x pathscale -x po lyx-1.3.5/src/frontends/xforms/Dialogs_impl.h lyx-1.3.5-changebars/src/frontends/xforms/Dialogs_impl.h --- lyx-1.3.5/src/frontends/xforms/Dialogs_impl.h 2003-07-03 06:36:25.000000000 -0700 +++ lyx-1.3.5-changebars/src/frontends/xforms/Dialogs_impl.h 2004-11-12 15:37:10.144337293 -0800 @@ -37,6 +37,10 @@ #include "FormBrowser.h" #include "forms/form_browser.h" +#include "ControlChanges.h" +#include "FormChanges.h" +#include "forms/form_changes.h" + #include "ControlCharacter.h" #include "FormCharacter.h" #include "forms/form_character.h" @@ -170,6 +174,9 @@ typedef GUI BibtexDialog; +typedef GUI +ChangesDialog; + typedef GUI CharacterDialog; @@ -271,6 +278,7 @@ AboutlyxDialog aboutlyx; BibitemDialog bibitem; BibtexDialog bibtex; + ChangesDialog changes; CharacterDialog character; CitationDialog citation; DocumentDialog document; diff -Nurb -x CVS -x version.C -x LaTeXConfig.lyx -x autom4te.cache -x pathscale -x po lyx-1.3.5/src/frontends/xforms/FormChanges.C lyx-1.3.5-changebars/src/frontends/xforms/FormChanges.C --- lyx-1.3.5/src/frontends/xforms/FormChanges.C 1969-12-31 16:00:00.000000000 -0800 +++ lyx-1.3.5-changebars/src/frontends/xforms/FormChanges.C 2004-11-12 15:37:10.806267415 -0800 @@ -0,0 +1,81 @@ +/** + * \file FormChanges.C + * This file is part of LyX, the document processor. + * Licence details can be found in the file COPYING. + * + * \author John Levon + * + * Full author contact details are available in file CREDITS + */ + +#include + +#ifdef __GNUG__ +#pragma implementation +#endif + +#include "xformsBC.h" +#include "ControlChanges.h" +#include "FormChanges.h" +#include "forms/form_changes.h" + +#include FORMS_H_LOCATION + +typedef FormCB > base_class; + +FormChanges::FormChanges() + : base_class(_("LyX: Merge changes")) +{} + + +void FormChanges::build() +{ + dialog_.reset(build_changes(this)); + + bc().setCancel(dialog_->button_close); + bc().addReadOnly(dialog_->button_accept); + bc().addReadOnly(dialog_->button_reject); +} + + +void FormChanges::update() +{ + fl_set_object_label(dialog_->author, ""); + fl_set_object_label(dialog_->date, ""); + // FIXME: enable/disable accept/reject +} + + +ButtonPolicy::SMInput FormChanges::input(FL_OBJECT * obj, long) +{ + if (obj == dialog_->button_accept) { + controller().accept(); + return ButtonPolicy::SMI_VALID; + } + + if (obj == dialog_->button_reject) { + controller().reject(); + return ButtonPolicy::SMI_VALID; + } + + if (obj != dialog_->button_next) + return ButtonPolicy::SMI_VALID; + + controller().find(); + + string author(controller().getChangeAuthor()); + string date(controller().getChangeDate()); + if (!date.empty()) { + date = _("Changed at : ") + date; + } + if (!author.empty()) { + author = _("Change made by : ") + author; + } + fl_set_object_label(dialog_->author, author.c_str()); + fl_set_object_label(dialog_->date, date.c_str()); + + // Yes, this is needed. + fl_redraw_form(form()); + + return ButtonPolicy::SMI_VALID; +} diff -Nurb -x CVS -x version.C -x LaTeXConfig.lyx -x autom4te.cache -x pathscale -x po lyx-1.3.5/src/frontends/xforms/FormChanges.h lyx-1.3.5-changebars/src/frontends/xforms/FormChanges.h --- lyx-1.3.5/src/frontends/xforms/FormChanges.h 1969-12-31 16:00:00.000000000 -0800 +++ lyx-1.3.5-changebars/src/frontends/xforms/FormChanges.h 2004-11-12 15:37:10.653283565 -0800 @@ -0,0 +1,43 @@ +// -*- C++ -*- +/** + * \file FormChanges.h + * This file is part of LyX, the document processor. + * Licence details can be found in the file COPYING. + * + * \author John Levon + * + * Full author contact details are available in file CREDITS + */ + +#ifndef FORMCHANGES_H +#define FORMCHANGES_H + +#ifdef __GNUG__ +#pragma interface +#endif + +#include "FormBase.h" + +class ControlChanges; +struct FD_changes; + +/** + * This class provides an XForms implementation of the Merge Changes Dialog. + */ +class FormChanges : public FormCB > { +public: + FormChanges(); + +private: + /// not needed. + virtual void apply() {} + /// Build the dialog + virtual void build(); + /// update the dialog + virtual void update(); + + /// Filter the inputs + virtual ButtonPolicy::SMInput input(FL_OBJECT *, long); +}; + +#endif // FORMCHANGES_H diff -Nurb -x CVS -x version.C -x LaTeXConfig.lyx -x autom4te.cache -x pathscale -x po lyx-1.3.5/src/frontends/xforms/FormPreferences.C lyx-1.3.5-changebars/src/frontends/xforms/FormPreferences.C --- lyx-1.3.5/src/frontends/xforms/FormPreferences.C 2003-04-14 07:27:10.000000000 -0700 +++ lyx-1.3.5-changebars/src/frontends/xforms/FormPreferences.C 2004-11-12 15:37:10.513298343 -0800 @@ -36,6 +36,7 @@ #include "LColor.h" #include "Lsstream.h" #include "funcrequest.h" +#include "author.h" #include "support/lyxfunctional.h" #include "support/lyxmanip.h" @@ -103,8 +104,9 @@ : base_class(_("Preferences"), scalableTabfolders), colors_(*this), converters_(*this), inputs_misc_(*this), formats_(*this), interface_(*this), language_(*this), - lnf_misc_(*this), outputs_misc_(*this), paths_(*this), - printer_(*this), screen_fonts_(*this), spelloptions_(*this) + lnf_misc_(*this), identity_(*this), outputs_misc_(*this), + paths_(*this), printer_(*this), screen_fonts_(*this), + spelloptions_(*this) { } @@ -181,6 +183,7 @@ interface_.build(); language_.build(); lnf_misc_.build(); + identity_.build(); outputs_misc_.build(); paths_.build(); printer_.build(); @@ -239,6 +242,9 @@ fl_addto_tabfolder(look_n_feel_tab_->tabfolder_inner, _("Misc"), lnf_misc_.dialog()->form); + fl_addto_tabfolder(look_n_feel_tab_->tabfolder_inner, + _("Identity"), + identity_.dialog()->form); // then build converters fl_addto_tabfolder(converters_tab_->tabfolder_inner, @@ -304,6 +310,7 @@ interface_.apply(rc); language_.apply(rc); lnf_misc_.apply(rc); + identity_.apply(rc); outputs_misc_.apply(rc); paths_.apply(rc); printer_.apply(rc); @@ -398,6 +405,7 @@ interface_.update(rc); language_.update(rc); lnf_misc_.update(rc); + identity_.update(rc); outputs_misc_.update(rc); paths_.update(rc); printer_.update(rc); @@ -1451,6 +1459,40 @@ } +FormPreferences::Identity::Identity(FormPreferences & p) + : parent_(p) +{} + + +FD_preferences_identity const * FormPreferences::Identity::dialog() +{ + return dialog_.get(); +} + + +void FormPreferences::Identity::apply(LyXRC & rc) const +{ + rc.user_name = fl_get_input(dialog_->input_user_name); + rc.user_email = fl_get_input(dialog_->input_user_email); + authorlist.record(0, Author(rc.user_name, rc.user_email)); +} + + +void FormPreferences::Identity::build() +{ + dialog_.reset(build_preferences_identity(&parent_)); + fl_set_input_return(dialog_->input_user_name, FL_RETURN_CHANGED); + fl_set_input_return(dialog_->input_user_email, FL_RETURN_CHANGED); +} + + +void FormPreferences::Identity::update(LyXRC const & rc) +{ + fl_set_input(dialog_->input_user_name, rc.user_name.c_str()); + fl_set_input(dialog_->input_user_email, rc.user_email.c_str()); +} + + FormPreferences::InputsMisc::InputsMisc(FormPreferences & p) : parent_(p) {} diff -Nurb -x CVS -x version.C -x LaTeXConfig.lyx -x autom4te.cache -x pathscale -x po lyx-1.3.5/src/frontends/xforms/FormPreferences.h lyx-1.3.5-changebars/src/frontends/xforms/FormPreferences.h --- lyx-1.3.5/src/frontends/xforms/FormPreferences.h 2002-12-01 14:59:21.000000000 -0800 +++ lyx-1.3.5-changebars/src/frontends/xforms/FormPreferences.h 2004-11-12 15:37:11.291216221 -0800 @@ -41,6 +41,7 @@ struct FD_preferences_interface; struct FD_preferences_language; struct FD_preferences_lnf_misc; +struct FD_preferences_identity; struct FD_preferences_inner_tab; struct FD_preferences_outputs_misc; struct FD_preferences_paths; @@ -336,6 +337,29 @@ /// friend class LnFmisc; + class Identity { + public: + /// + Identity(FormPreferences & p); + /// + FD_preferences_identity const * dialog(); + /// + void apply(LyXRC & rc) const; + /// + void build(); + /// + string const feedback(FL_OBJECT const * const) const; + /// + void update(LyXRC const & rc); + + private: + /// + FormPreferences & parent_; + /// + boost::scoped_ptr dialog_; + }; + friend class Identity; + /// class OutputsMisc { public: @@ -485,6 +509,8 @@ /// LnFmisc lnf_misc_; /// + Identity identity_; + /// OutputsMisc outputs_misc_; /// Paths paths_; diff -Nurb -x CVS -x version.C -x LaTeXConfig.lyx -x autom4te.cache -x pathscale -x po lyx-1.3.5/src/frontends/xforms/Makefile.am lyx-1.3.5-changebars/src/frontends/xforms/Makefile.am --- lyx-1.3.5/src/frontends/xforms/Makefile.am 2002-12-16 03:38:20.000000000 -0800 +++ lyx-1.3.5-changebars/src/frontends/xforms/Makefile.am 2004-11-12 15:37:10.874260237 -0800 @@ -66,6 +66,8 @@ FormBibtex.h \ FormBrowser.C \ FormBrowser.h \ + FormChanges.C \ + FormChanges.h \ FormCharacter.C \ FormCharacter.h \ FormCitation.C \ diff -Nurb -x CVS -x version.C -x LaTeXConfig.lyx -x autom4te.cache -x pathscale -x po lyx-1.3.5/src/frontends/xforms/Makefile.in lyx-1.3.5-changebars/src/frontends/xforms/Makefile.in --- lyx-1.3.5/src/frontends/xforms/Makefile.in 2004-10-06 07:43:20.000000000 -0700 +++ lyx-1.3.5-changebars/src/frontends/xforms/Makefile.in 2004-11-12 15:37:10.537295809 -0800 @@ -288,6 +288,8 @@ FormBibtex.h \ FormBrowser.C \ FormBrowser.h \ + FormChanges.C \ + FormChanges.h \ FormCharacter.C \ FormCharacter.h \ FormCitation.C \ @@ -399,10 +401,10 @@ Alert_pimpl.lo Color.lo ColorHandler.lo Dialogs.lo Dialogs2.lo \ DropDown.lo FileDialog.lo FontInfo.lo FormFiledialog.lo \ FormAboutlyx.lo FormBase.lo FormBibitem.lo FormBibtex.lo \ - FormBrowser.lo FormCharacter.lo FormCitation.lo FormDocument.lo \ - FormError.lo FormERT.lo FormExternal.lo FormFloat.lo \ - FormForks.lo FormGraphics.lo FormInclude.lo FormIndex.lo \ - FormLog.lo FormMathsBitmap.lo FormMathsDelim.lo \ + FormBrowser.lo FormChanges.lo FormCharacter.lo FormCitation.lo \ + FormDocument.lo FormError.lo FormERT.lo FormExternal.lo \ + FormFloat.lo FormForks.lo FormGraphics.lo FormInclude.lo \ + FormIndex.lo FormLog.lo FormMathsBitmap.lo FormMathsDelim.lo \ FormMathsMatrix.lo FormMathsPanel.lo FormMathsSpace.lo \ FormMathsStyle.lo FormMinipage.lo FormParagraph.lo \ FormPreamble.lo FormPreferences.lo FormPrint.lo FormRef.lo \ @@ -431,6 +433,7 @@ @AMDEP_TRUE@ ./$(DEPDIR)/FormBibitem.Plo \ @AMDEP_TRUE@ ./$(DEPDIR)/FormBibtex.Plo \ @AMDEP_TRUE@ ./$(DEPDIR)/FormBrowser.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/FormChanges.Plo \ @AMDEP_TRUE@ ./$(DEPDIR)/FormCharacter.Plo \ @AMDEP_TRUE@ ./$(DEPDIR)/FormCitation.Plo \ @AMDEP_TRUE@ ./$(DEPDIR)/FormDocument.Plo \ @@ -552,6 +555,7 @@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/FormBibitem.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/FormBibtex.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/FormBrowser.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/FormChanges.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/FormCharacter.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/FormCitation.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/FormDocument.Plo@am__quote@ diff -Nurb -x CVS -x version.C -x LaTeXConfig.lyx -x autom4te.cache -x pathscale -x po lyx-1.3.5/src/frontends/xforms/forms/Makefile.am lyx-1.3.5-changebars/src/frontends/xforms/forms/Makefile.am --- lyx-1.3.5/src/frontends/xforms/forms/Makefile.am 2003-12-05 06:03:42.000000000 -0800 +++ lyx-1.3.5-changebars/src/frontends/xforms/forms/Makefile.am 2004-11-12 15:37:11.074239126 -0800 @@ -11,6 +11,7 @@ form_bibitem.fd \ form_bibtex.fd \ form_browser.fd \ + form_changes.fd \ form_character.fd \ form_citation.fd \ form_document.fd \ diff -Nurb -x CVS -x version.C -x LaTeXConfig.lyx -x autom4te.cache -x pathscale -x po lyx-1.3.5/src/frontends/xforms/forms/Makefile.in lyx-1.3.5-changebars/src/frontends/xforms/forms/Makefile.in --- lyx-1.3.5/src/frontends/xforms/forms/Makefile.in 2004-10-06 07:43:20.000000000 -0700 +++ lyx-1.3.5-changebars/src/frontends/xforms/forms/Makefile.in 2004-11-12 15:37:11.064240182 -0800 @@ -234,6 +234,7 @@ form_bibitem.fd \ form_bibtex.fd \ form_browser.fd \ + form_changes.fd \ form_character.fd \ form_citation.fd \ form_document.fd \ @@ -281,16 +282,17 @@ libfdesign_la_LDFLAGS = libfdesign_la_LIBADD = am__objects_1 = form_aboutlyx.lo form_bibitem.lo form_bibtex.lo \ - form_browser.lo form_character.lo form_citation.lo \ - form_document.lo form_error.lo form_ert.lo form_external.lo \ - form_filedialog.lo form_float.lo form_forks.lo form_graphics.lo \ - form_include.lo form_index.lo form_maths_delim.lo \ - form_maths_matrix.lo form_maths_panel.lo form_maths_space.lo \ - form_maths_style.lo form_minipage.lo form_paragraph.lo \ - form_preamble.lo form_preferences.lo form_print.lo form_ref.lo \ - form_search.lo form_sendto.lo form_spellchecker.lo \ - form_tabular.lo form_tabular_create.lo form_texinfo.lo \ - form_thesaurus.lo form_toc.lo form_url.lo form_wrap.lo + form_browser.lo form_changes.lo form_character.lo \ + form_citation.lo form_document.lo form_error.lo form_ert.lo \ + form_external.lo form_filedialog.lo form_float.lo form_forks.lo \ + form_graphics.lo form_include.lo form_index.lo \ + form_maths_delim.lo form_maths_matrix.lo form_maths_panel.lo \ + form_maths_space.lo form_maths_style.lo form_minipage.lo \ + form_paragraph.lo form_preamble.lo form_preferences.lo \ + form_print.lo form_ref.lo form_search.lo form_sendto.lo \ + form_spellchecker.lo form_tabular.lo form_tabular_create.lo \ + form_texinfo.lo form_thesaurus.lo form_toc.lo form_url.lo \ + form_wrap.lo am__objects_2 = am_libfdesign_la_OBJECTS = $(am__objects_1) $(am__objects_2) libfdesign_la_OBJECTS = $(am_libfdesign_la_OBJECTS) @@ -305,6 +307,7 @@ @AMDEP_TRUE@ ./$(DEPDIR)/form_bibitem.Plo \ @AMDEP_TRUE@ ./$(DEPDIR)/form_bibtex.Plo \ @AMDEP_TRUE@ ./$(DEPDIR)/form_browser.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/form_changes.Plo \ @AMDEP_TRUE@ ./$(DEPDIR)/form_character.Plo \ @AMDEP_TRUE@ ./$(DEPDIR)/form_citation.Plo \ @AMDEP_TRUE@ ./$(DEPDIR)/form_document.Plo \ @@ -385,6 +388,7 @@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/form_bibitem.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/form_bibtex.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/form_browser.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/form_changes.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/form_character.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/form_citation.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/form_document.Plo@am__quote@ diff -Nurb -x CVS -x version.C -x LaTeXConfig.lyx -x autom4te.cache -x pathscale -x po lyx-1.3.5/src/frontends/xforms/forms/form_changes.fd lyx-1.3.5-changebars/src/frontends/xforms/forms/form_changes.fd --- lyx-1.3.5/src/frontends/xforms/forms/form_changes.fd 1969-12-31 16:00:00.000000000 -0800 +++ lyx-1.3.5-changebars/src/frontends/xforms/forms/form_changes.fd 2004-11-12 15:37:11.695173577 -0800 @@ -0,0 +1,160 @@ +Magic: 13000 + +Internal Form Definition File + (do not change) + +Number of forms: 1 +Unit of measure: FL_COORD_PIXEL + +=============== FORM =============== +Name: form_changes +Width: 400 +Height: 190 +Number of Objects: 8 + +-------------------- +class: FL_BOX +type: UP_BOX +box: 0 0 400 190 +boxtype: FL_UP_BOX +colors: FL_COL1 FL_COL1 +alignment: FL_ALIGN_CENTER +style: FL_NORMAL_STYLE +size: FL_DEFAULT_SIZE +lcol: FL_BLACK +label: +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: +callback: +argument: + +-------------------- +class: FL_BUTTON +type: NORMAL_BUTTON +box: 270 110 120 30 +boxtype: FL_UP_BOX +colors: FL_COL1 FL_COL1 +alignment: FL_ALIGN_CENTER +style: FL_NORMAL_STYLE +size: FL_NORMAL_SIZE +lcol: FL_BLACK +label: Reject change|#R +shortcut: +resize: FL_RESIZE_NONE +gravity: FL_SouthEast FL_SouthEast +name: button_reject +callback: C_FormBaseInputCB +argument: 0 + +-------------------- +class: FL_BUTTON +type: NORMAL_BUTTON +box: 10 110 100 30 +boxtype: FL_UP_BOX +colors: FL_COL1 FL_COL1 +alignment: FL_ALIGN_CENTER +style: FL_NORMAL_STYLE +size: FL_NORMAL_SIZE +lcol: FL_BLACK +label: Next change|#N +shortcut: +resize: FL_RESIZE_NONE +gravity: FL_SouthEast FL_SouthEast +name: button_next +callback: C_FormBaseInputCB +argument: 0 + +-------------------- +class: FL_BUTTON +type: NORMAL_BUTTON +box: 130 110 120 30 +boxtype: FL_UP_BOX +colors: FL_COL1 FL_COL1 +alignment: FL_ALIGN_CENTER +style: FL_NORMAL_STYLE +size: FL_NORMAL_SIZE +lcol: FL_BLACK +label: Accept change|#A +shortcut: +resize: FL_RESIZE_NONE +gravity: FL_SouthEast FL_SouthEast +name: button_accept +callback: C_FormBaseInputCB +argument: 0 + +-------------------- +class: FL_BUTTON +type: NORMAL_BUTTON +box: 310 150 80 30 +boxtype: FL_UP_BOX +colors: FL_COL1 FL_COL1 +alignment: FL_ALIGN_CENTER +style: FL_NORMAL_STYLE +size: FL_NORMAL_SIZE +lcol: FL_BLACK +label: Close|^[ +shortcut: +resize: FL_RESIZE_NONE +gravity: FL_SouthEast FL_SouthEast +name: button_close +callback: C_FormBaseCancelCB +argument: 0 + +-------------------- +class: FL_TEXT +type: NORMAL_TEXT +box: 10 10 150 20 +boxtype: FL_FLAT_BOX +colors: FL_COL1 FL_MCOL +alignment: FL_ALIGN_LEFT|FL_ALIGN_INSIDE +style: FL_NORMAL_STYLE +size: FL_NORMAL_SIZE +lcol: FL_BLACK +label: Accept change ? +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: +callback: +argument: + +-------------------- +class: FL_TEXT +type: NORMAL_TEXT +box: 10 40 380 30 +boxtype: FL_NO_BOX +colors: FL_COL1 FL_MCOL +alignment: FL_ALIGN_LEFT|FL_ALIGN_INSIDE +style: FL_NORMAL_STYLE +size: FL_NORMAL_SIZE +lcol: FL_BLACK +label: text +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: author +callback: +argument: + +-------------------- +class: FL_TEXT +type: NORMAL_TEXT +box: 10 70 380 30 +boxtype: FL_NO_BOX +colors: FL_COL1 FL_MCOL +alignment: FL_ALIGN_LEFT|FL_ALIGN_INSIDE +style: FL_NORMAL_STYLE +size: FL_NORMAL_SIZE +lcol: FL_BLACK +label: text +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: date +callback: +argument: + +============================== +-------------------- diff -Nurb -x CVS -x version.C -x LaTeXConfig.lyx -x autom4te.cache -x pathscale -x po lyx-1.3.5/src/frontends/xforms/forms/form_preferences.fd lyx-1.3.5-changebars/src/frontends/xforms/forms/form_preferences.fd --- lyx-1.3.5/src/frontends/xforms/forms/form_preferences.fd 2003-04-14 07:27:13.000000000 -0700 +++ lyx-1.3.5-changebars/src/frontends/xforms/forms/form_preferences.fd 2004-11-12 15:37:12.184121960 -0800 @@ -3,7 +3,7 @@ Internal Form Definition File (do not change) -Number of forms: 14 +Number of forms: 15 Unit of measure: FL_COORD_PIXEL SnapGrid: 5 @@ -1223,6 +1223,66 @@ argument: 0 =============== FORM =============== +Name: form_preferences_identity +Width: 450 +Height: 350 +Number of Objects: 3 + +-------------------- +class: FL_BOX +type: FLAT_BOX +box: 0 0 450 350 +boxtype: FL_FLAT_BOX +colors: FL_COL1 FL_COL1 +alignment: FL_ALIGN_CENTER +style: FL_NORMAL_STYLE +size: FL_DEFAULT_SIZE +lcol: FL_BLACK +label: +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: +callback: +argument: + +-------------------- +class: FL_INPUT +type: NORMAL_INPUT +box: 125 25 220 35 +boxtype: FL_DOWN_BOX +colors: FL_COL1 FL_MCOL +alignment: FL_ALIGN_LEFT +style: FL_NORMAL_STYLE +size: FL_DEFAULT_SIZE +lcol: FL_BLACK +label: Real name : |#R +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: input_user_name +callback: C_FormBaseInputCB +argument: 0 + +-------------------- +class: FL_INPUT +type: NORMAL_INPUT +box: 125 80 220 35 +boxtype: FL_DOWN_BOX +colors: FL_COL1 FL_MCOL +alignment: FL_ALIGN_LEFT +style: FL_NORMAL_STYLE +size: FL_DEFAULT_SIZE +lcol: FL_BLACK +label: Email address : |#E +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: input_user_email +callback: C_FormBaseInputCB +argument: 0 + +=============== FORM =============== Name: form_preferences_spelloptions Width: 450 Height: 360 diff -Nurb -x CVS -x version.C -x LaTeXConfig.lyx -x autom4te.cache -x pathscale -x po lyx-1.3.5/src/insets/inset.C lyx-1.3.5-changebars/src/insets/inset.C --- lyx-1.3.5/src/insets/inset.C 2002-12-01 14:59:24.000000000 -0800 +++ lyx-1.3.5-changebars/src/insets/inset.C 2004-11-12 15:37:11.076238915 -0800 @@ -361,6 +361,14 @@ } +bool UpdatableInset::nextChange(BufferView * bv, lyx::pos_type &) +{ + // we have to unlock ourself in this function by default! + bv->unlockInset(const_cast(this)); + return false; +} + + bool UpdatableInset::searchForward(BufferView * bv, string const &, bool, bool) { diff -Nurb -x CVS -x version.C -x LaTeXConfig.lyx -x autom4te.cache -x pathscale -x po lyx-1.3.5/src/insets/inset.h lyx-1.3.5-changebars/src/insets/inset.h --- lyx-1.3.5/src/insets/inset.h 2002-12-01 14:59:24.000000000 -0800 +++ lyx-1.3.5-changebars/src/insets/inset.h 2004-11-12 15:37:12.306109083 -0800 @@ -23,6 +23,7 @@ #include "LString.h" #include "LColor.h" #include "frontends/mouse_state.h" +#include "support/types.h" class LyXFont; class BufferView; @@ -335,7 +336,7 @@ /// // needed for spellchecking text /// - virtual bool allowSpellcheck() { return false; } + virtual bool allowSpellcheck() const { return false; } // should this inset be handled like a normal charater virtual bool isChar() const { return false; } @@ -361,6 +362,9 @@ minipage somewhere, it will be the width of this minipage */ virtual int latexTextWidth(BufferView *) const; + /// mark the inset contents as erased (for change tracking) + virtual void markErased() {} + /** Adds a LaTeX snippet to the Preview Loader for transformation * into a bitmap image. Does not start the laoding process. * @@ -519,16 +523,20 @@ /// // needed for spellchecking text /// - virtual bool allowSpellcheck() { return false; } + virtual bool allowSpellcheck() const { return false; } /// virtual WordLangTuple const selectNextWordToSpellcheck(BufferView *, float & value) const; /// - virtual void selectSelectedWord(BufferView *) { return; } + virtual void selectSelectedWord(BufferView *) {} /// virtual void toggleSelection(BufferView *, bool /*kill_selection*/) { return; } + + /// find the next change in the inset + virtual bool nextChange(BufferView * bv, lyx::pos_type & length); + /// // needed for search/replace functionality /// diff -Nurb -x CVS -x version.C -x LaTeXConfig.lyx -x autom4te.cache -x pathscale -x po lyx-1.3.5/src/insets/insetcollapsable.C lyx-1.3.5-changebars/src/insets/insetcollapsable.C --- lyx-1.3.5/src/insets/insetcollapsable.C 2002-11-24 07:19:56.000000000 -0800 +++ lyx-1.3.5-changebars/src/insets/insetcollapsable.C 2004-11-12 15:37:11.976143916 -0800 @@ -669,6 +669,24 @@ } +void InsetCollapsable::markErased() +{ + inset.markErased(); +} + + +bool InsetCollapsable::nextChange(BufferView * bv, lyx::pos_type & length) +{ + bool found = inset.nextChange(bv, length); + + if (first_after_edit && !found) + close(bv); + else if (!found) + first_after_edit = false; + return found; +} + + bool InsetCollapsable::searchForward(BufferView * bv, string const & str, bool cs, bool mw) { diff -Nurb -x CVS -x version.C -x LaTeXConfig.lyx -x autom4te.cache -x pathscale -x po lyx-1.3.5/src/insets/insetcollapsable.h lyx-1.3.5-changebars/src/insets/insetcollapsable.h --- lyx-1.3.5/src/insets/insetcollapsable.h 2002-09-25 07:26:10.000000000 -0700 +++ lyx-1.3.5-changebars/src/insets/insetcollapsable.h 2004-11-12 15:37:11.747168088 -0800 @@ -169,7 +169,7 @@ /// void close(BufferView *) const; /// - bool allowSpellcheck() { return inset.allowSpellcheck(); } + bool allowSpellcheck() const { return inset.allowSpellcheck(); } /// WordLangTuple const selectNextWordToSpellcheck(BufferView *, float &) const; @@ -181,6 +181,11 @@ void toggleSelection(BufferView * bv, bool kill_selection) { inset.toggleSelection(bv, kill_selection); } + + void markErased(); + + bool nextChange(BufferView * bv, lyx::pos_type & length); + /// bool searchForward(BufferView * bv, string const & str, bool = true, bool = false); diff -Nurb -x CVS -x version.C -x LaTeXConfig.lyx -x autom4te.cache -x pathscale -x po lyx-1.3.5/src/insets/insetert.C lyx-1.3.5-changebars/src/insets/insetert.C --- lyx-1.3.5/src/insets/insetert.C 2003-01-23 08:23:41.000000000 -0800 +++ lyx-1.3.5-changebars/src/insets/insetert.C 2004-11-12 15:37:10.912256226 -0800 @@ -351,6 +351,10 @@ while (par) { pos_type siz = par->size(); for (pos_type i = 0; i < siz; ++i) { + // ignore all struck out text + if (isDeletedText(par, i)) + continue; + Paragraph::value_type c = par->getChar(i); switch (c) { case Paragraph::META_NEWLINE: diff -Nurb -x CVS -x version.C -x LaTeXConfig.lyx -x autom4te.cache -x pathscale -x po lyx-1.3.5/src/insets/insetert.h lyx-1.3.5-changebars/src/insets/insetert.h --- lyx-1.3.5/src/insets/insetert.h 2002-09-25 07:26:10.000000000 -0700 +++ lyx-1.3.5-changebars/src/insets/insetert.h 2004-11-12 15:37:11.012245671 -0800 @@ -105,7 +105,7 @@ /// void close(BufferView *) const; /// - bool allowSpellcheck() { return false; } + bool allowSpellcheck() const { return false; } WordLangTuple const selectNextWordToSpellcheck(BufferView *, float &) const; diff -Nurb -x CVS -x version.C -x LaTeXConfig.lyx -x autom4te.cache -x pathscale -x po lyx-1.3.5/src/insets/insettabular.C lyx-1.3.5-changebars/src/insets/insettabular.C --- lyx-1.3.5/src/insets/insettabular.C 2003-01-23 08:23:42.000000000 -0800 +++ lyx-1.3.5-changebars/src/insets/insettabular.C 2004-11-12 15:37:11.015245354 -0800 @@ -1171,7 +1171,7 @@ setUndo(bv, Undo::DELETE, bv->text->cursor.par(), bv->text->cursor.par()->next()); - cutSelection(); + cutSelection(bv->buffer()->params); updateLocal(bv, INIT, true); break; case LFUN_COPY: @@ -2577,13 +2577,14 @@ *(tabular->GetCellInset(n2)) = *(paste_tabular->GetCellInset(n1)); tabular->GetCellInset(n2)->setOwner(this); tabular->GetCellInset(n2)->deleteLyXText(bv); + tabular->GetCellInset(n2)->markNew(); } } return true; } -bool InsetTabular::cutSelection() +bool InsetTabular::cutSelection(BufferParams const & bp) { if (!hasSelection()) return false; @@ -2606,7 +2607,7 @@ } for (int i = sel_row_start; i <= sel_row_end; ++i) { for (int j = sel_col_start; j <= sel_col_end; ++j) { - tabular->GetCellInset(tabular->GetCellNumber(i, j))->clear(); + tabular->GetCellInset(tabular->GetCellNumber(i, j))->clear(bp.tracking_changes); } } return true; @@ -2788,6 +2789,46 @@ } +void InsetTabular::markErased() +{ + int cell = 0; + + while (!tabular->IsLastCell(cell)) { + ++cell; + InsetText * inset = tabular->GetCellInset(cell); + inset->markErased(); + } +} + + +bool InsetTabular::nextChange(BufferView * bv, lyx::pos_type & length) +{ + if (the_locking_inset) { + if (the_locking_inset->nextChange(bv, length)) { + updateLocal(bv, CELL, false); + return true; + } + if (tabular->IsLastCell(actcell)) + return false; + ++actcell; + } + InsetText * inset = tabular->GetCellInset(actcell); + if (inset->nextChange(bv, length)) { + updateLocal(bv, FULL, false); + return true; + } + while (!tabular->IsLastCell(actcell)) { + ++actcell; + inset = tabular->GetCellInset(actcell); + if (inset->nextChange(bv, length)) { + updateLocal(bv, FULL, false); + return true; + } + } + return false; +} + + bool InsetTabular::searchForward(BufferView * bv, string const & str, bool cs, bool mw) { @@ -2911,12 +2952,14 @@ ocol = actcol; row = actrow; } + string::size_type op = 0; int cells = loctab->GetNumberOfCells(); p = 0; cols = ocol; rows = loctab->rows(); int const columns = loctab->columns(); + while ((cell < cells) && (p < len) && (row < rows) && (p = buf.find_first_of("\t\n", p)) != string::npos) { diff -Nurb -x CVS -x version.C -x LaTeXConfig.lyx -x autom4te.cache -x pathscale -x po lyx-1.3.5/src/insets/insettabular.h lyx-1.3.5-changebars/src/insets/insettabular.h --- lyx-1.3.5/src/insets/insettabular.h 2002-12-01 14:59:24.000000000 -0800 +++ lyx-1.3.5-changebars/src/insets/insettabular.h 2004-11-12 15:37:11.220223715 -0800 @@ -63,6 +63,7 @@ class Painter; class BufferView; class Buffer; +class BufferParams; class Paragraph; class InsetTabular : public UpdatableInset { @@ -208,7 +209,7 @@ /// LyXCursor const & cursor(BufferView *) const; /// - bool allowSpellcheck() { return true; } + bool allowSpellcheck() const { return true; } /// WordLangTuple const selectNextWordToSpellcheck(BufferView *, float & value) const; @@ -216,6 +217,11 @@ void selectSelectedWord(BufferView *); /// void toggleSelection(BufferView *, bool kill_selection); + + void markErased(); + + /// find next change + bool nextChange(BufferView *, lyx::pos_type & length); /// bool searchForward(BufferView *, string const &, bool = true, bool = false); @@ -316,7 +322,7 @@ /// bool pasteSelection(BufferView *); /// - bool cutSelection(); + bool cutSelection(BufferParams const & bp); /// bool isRightToLeft(BufferView *); /// diff -Nurb -x CVS -x version.C -x LaTeXConfig.lyx -x autom4te.cache -x pathscale -x po lyx-1.3.5/src/insets/insettext.C lyx-1.3.5-changebars/src/insets/insettext.C --- lyx-1.3.5/src/insets/insettext.C 2003-01-23 08:23:43.000000000 -0800 +++ lyx-1.3.5-changebars/src/insets/insettext.C 2004-11-12 15:37:11.869155210 -0800 @@ -146,6 +146,8 @@ { paragraphs.set(new Paragraph); paragraphs.begin()->layout(bp.getLyXTextClass().defaultLayout()); + if (bp.tracking_changes) + paragraphs.begin()->trackChanges(); init(); } @@ -208,8 +210,18 @@ } -void InsetText::clear() +void InsetText::clear(bool just_mark_erased) { + if (just_mark_erased) { + ParagraphList::iterator it = paragraphs.begin(); + ParagraphList::iterator end = paragraphs.end(); + for (; it != end; ++it) { + it->markErased(); + } + need_update = FULL; + return; + } + // This is a gross hack... LyXLayout_ptr old_layout = paragraphs.begin()->layout(); @@ -255,7 +267,10 @@ Paragraph::depth_type depth = 0; LyXFont font(LyXFont::ALL_INHERIT); - clear(); + clear(false); + + if (buf->params.tracking_changes) + paragraphs.begin()->trackChanges(); while (lex.isOK()) { lex.nextToken(); @@ -2129,9 +2144,24 @@ } +void InsetText::markNew(bool track_changes) +{ + ParagraphList::iterator pit = paragraphs.begin(); + ParagraphList::iterator pend = paragraphs.end(); + for (; pit != pend; ++pit) { + if (track_changes) { + pit->trackChanges(); + } else { + // no-op when not tracking + pit->cleanChanges(); + } + } +} + + void InsetText::setText(string const & data, LyXFont const & font) { - clear(); + clear(false); for (unsigned int i = 0; i < data.length(); ++i) paragraphs.begin()->insertChar(i, data[i], font); reinitLyXText(); @@ -2659,6 +2689,36 @@ } +bool InsetText::nextChange(BufferView * bv, lyx::pos_type & length) +{ + bool clear = false; + if (!lt) { + lt = getLyXText(bv); + clear = true; + } + if (the_locking_inset) { + if (the_locking_inset->nextChange(bv, length)) + return true; + lt->cursorRight(bv, true); + } + lyxfind::SearchResult result = + lyxfind::findNextChange(bv, lt, length); + + if (result == lyxfind::SR_FOUND) { + LyXCursor cur = lt->cursor; + bv->unlockInset(bv->theLockingInset()); + if (bv->lockInset(this)) + locked = true; + lt->cursor = cur; + lt->setSelectionRange(bv, length); + updateLocal(bv, SELECTION, false); + } + if (clear) + lt = 0; + return result != lyxfind::SR_NOT_FOUND; +} + + bool InsetText::searchForward(BufferView * bv, string const & str, bool cs, bool mw) { @@ -2681,7 +2741,7 @@ if (bv->lockInset(this)) locked = true; lt->cursor = cur; - lt->setSelectionOverString(bv, str); + lt->setSelectionRange(bv, str.length()); updateLocal(bv, SELECTION, false); } if (clear) @@ -2716,7 +2776,7 @@ if (bv->lockInset(this)) locked = true; lt->cursor = cur; - lt->setSelectionOverString(bv, str); + lt->setSelectionRange(bv, str.length()); updateLocal(bv, SELECTION, false); } if (clear) @@ -2776,12 +2836,16 @@ Paragraph * buf; Paragraph * tmpbuf = newpar; Paragraph * lastbuffer = buf = new Paragraph(*tmpbuf, false); + if (bparams.tracking_changes) + buf->cleanChanges(); while (tmpbuf->next()) { tmpbuf = tmpbuf->next(); lastbuffer->next(new Paragraph(*tmpbuf, false)); lastbuffer->next()->previous(lastbuffer); lastbuffer = lastbuffer->next(); + if (bparams.tracking_changes) + lastbuffer->cleanChanges(); } lastbuffer = &*(paragraphs.begin()); while (lastbuffer->next()) diff -Nurb -x CVS -x version.C -x LaTeXConfig.lyx -x autom4te.cache -x pathscale -x po lyx-1.3.5/src/insets/insettext.h lyx-1.3.5-changebars/src/insets/insettext.h --- lyx-1.3.5/src/insets/insettext.h 2002-09-25 07:26:12.000000000 -0700 +++ lyx-1.3.5-changebars/src/insets/insettext.h 2004-11-12 15:37:11.801162388 -0800 @@ -82,8 +82,8 @@ Inset * clone(Buffer const &, bool same_id = false) const; /// InsetText & operator=(InsetText const & it); - /// - void clear(); + /// empty inset to empty par, or just mark as erased + void clear(bool just_mark_erased); /// void read(Buffer const *, LyXLex &); /// @@ -220,7 +220,7 @@ /// void paragraph(Paragraph *); /// - bool allowSpellcheck() { return true; } + bool allowSpellcheck() const { return true; } /// WordLangTuple const selectNextWordToSpellcheck(BufferView *, float & value) const; @@ -228,6 +228,20 @@ void selectSelectedWord(BufferView *); /// void toggleSelection(BufferView *, bool kill_selection); + + /// mark as erased for change tracking + void markErased() { clear(true); }; + /** + * Mark as new. Used when pasting in tabular, and adding rows + * or columns. Note that pasting will ensure that tracking already + * happens, and this just resets the changes for the copied text, + * whereas for row/col add, we need to start tracking changes + * for the (empty) paragraph contained. + */ + void markNew(bool track_changes = false); + /// find next change + bool nextChange(BufferView *, lyx::pos_type & length); + /// bool searchForward(BufferView *, string const &, bool = true, bool = false); @@ -238,8 +252,9 @@ bool checkInsertChar(LyXFont &); /// void getDrawFont(LyXFont &) const; - /// - void appendParagraphs(BufferParams const & bparams, Paragraph *); + /// append text onto the existing text + void appendParagraphs(BufferParams const & bp, Paragraph *); + /// void addPreview(grfx::PreviewLoader &) const; diff -Nurb -x CVS -x version.C -x LaTeXConfig.lyx -x autom4te.cache -x pathscale -x po lyx-1.3.5/src/lyx_main.C lyx-1.3.5-changebars/src/lyx_main.C --- lyx-1.3.5/src/lyx_main.C 2004-04-22 05:56:05.000000000 -0700 +++ lyx-1.3.5-changebars/src/lyx_main.C 2004-11-12 15:37:11.187227199 -0800 @@ -38,6 +38,7 @@ #include "encoding.h" #include "converter.h" #include "lyxtextclasslist.h" +#include "author.h" #include "frontends/Alert.h" #include "frontends/lyx_gui.h" @@ -487,6 +488,9 @@ if (!readRcFile("preferences")) readRcFile("lyxrc"); + // set initial author + authorlist.record(Author(lyxrc.user_name, lyxrc.user_email)); + readEncodingsFile("encodings"); readLanguagesFile("languages"); diff -Nurb -x CVS -x version.C -x LaTeXConfig.lyx -x autom4te.cache -x pathscale -x po lyx-1.3.5/src/lyxfind.C lyx-1.3.5-changebars/src/lyxfind.C --- lyx-1.3.5/src/lyxfind.C 2002-08-08 14:08:02.000000000 -0700 +++ lyx-1.3.5-changebars/src/lyxfind.C 2004-11-12 15:37:10.466303304 -0800 @@ -16,8 +16,10 @@ #include "debug.h" #include "gettext.h" #include "insets/insettext.h" +#include "changes.h" using lyx::pos_type; +using std::endl; namespace lyxfind { @@ -97,7 +99,7 @@ bv->update(text, BufferView::SELECT|BufferView::FITCUR); bv->toggleSelection(false); text->replaceSelectionWithString(bv, replacestr); - text->setSelectionOverString(bv, replacestr); + text->setSelectionRange(bv, replacestr.length()); bv->update(text, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE); ++replace_count; } @@ -156,7 +158,7 @@ if (result == SR_FOUND) { bv->unlockInset(bv->theLockingInset()); bv->update(text, BufferView::SELECT|BufferView::FITCUR); - text->setSelectionOverString(bv, searchstr); + text->setSelectionRange(bv, searchstr.length()); bv->toggleSelection(false); bv->update(text, BufferView::SELECT|BufferView::FITCUR); } else if (result == SR_NOT_FOUND) { @@ -312,4 +314,128 @@ } } + +SearchResult nextChange(BufferView * bv, LyXText * text, pos_type & length) +{ + Paragraph * par = text->cursor.par(); + pos_type pos = text->cursor.pos(); + Paragraph * prev_par = par; + UpdatableInset * inset; + + while (par) { + if ((!par->size() || pos != par->size()) + && par->lookupChange(pos) != Change::UNCHANGED) + break; + + if (par->isInset(pos) && + (inset = (UpdatableInset *)par->getInset(pos)) && + (inset->isTextInset())) { + if (inset->nextChange(bv, length)) + return SR_FOUND_NOUPDATE; + } + + ++pos; + + if (pos >= par->size()) { + prev_par = par; + par = par->next(); + pos = 0; + } + } + + if (par) { + text->setCursor(bv, par, pos); + Change orig_change = par->lookupChangeFull(pos); + pos_type end = pos; + + for (; end != par->size(); ++end) { + Change change = par->lookupChangeFull(end); + if (change != orig_change) { + // slight UI optimisation: for replacements, we get + // text like : _old_new. Consider that as one change. + if (!(orig_change.type == Change::DELETED && + change.type == Change::INSERTED)) + break; + } + } + length = end - pos; + return SR_FOUND; + } else { + // make sure we end up at the end of the text, + // not the start point of the last search + text->setCursor(bv, prev_par, prev_par->size()); + return SR_NOT_FOUND; + } +} + + +SearchResult findNextChange(BufferView * bv, LyXText * text, pos_type & length) +{ + if (text->selection.set()) + text->cursor = text->selection.end; + + bv->toggleSelection(); + text->clearSelection(); + + return nextChange(bv, text, length); +} + + +bool findNextChange(BufferView * bv) +{ + if (!bv->available()) + return false; + + bv->hideCursor(); + bv->update(bv->getLyXText(), BufferView::SELECT | BufferView::FITCUR); + + pos_type length; + + if (bv->theLockingInset()) { + bool found = bv->theLockingInset()->nextChange(bv, length); + + // We found the stuff inside the inset so we don't have to + // do anything as the inset did all the update for us! + if (found) + return true; + + // We now are in the main text but if we did a forward + // search we have to put the cursor behind the inset. + bv->text->cursorRight(bv, true); + } + // If we arrive here we are in the main text again so we + // just start searching from the root LyXText at the position + // we are! + LyXText * text = bv->text; + + if (text->selection.set()) + text->cursor = text->selection.end; + + bv->toggleSelection(); + text->clearSelection(); + + SearchResult result = nextChange(bv, text, length); + + lyxerr << "Result is " << result << endl; + + bool found = true; + + // If we found the cursor inside an inset we will get back + // SR_FOUND_NOUPDATE and we don't have to do anything as the + // inset did it already. + if (result == SR_FOUND) { + bv->unlockInset(bv->theLockingInset()); + bv->update(text, BufferView::SELECT|BufferView::FITCUR); + text->setSelectionRange(bv, length); + bv->toggleSelection(false); + bv->update(text, BufferView::SELECT|BufferView::FITCUR); + } else if (result == SR_NOT_FOUND) { + bv->unlockInset(bv->theLockingInset()); + bv->update(text, BufferView::SELECT|BufferView::FITCUR); + found = false; + } + + return found; +} + } // end lyxfind namespace diff -Nurb -x CVS -x version.C -x LaTeXConfig.lyx -x autom4te.cache -x pathscale -x po lyx-1.3.5/src/lyxfind.h lyx-1.3.5-changebars/src/lyxfind.h --- lyx-1.3.5/src/lyxfind.h 2002-08-08 14:08:02.000000000 -0700 +++ lyx-1.3.5-changebars/src/lyxfind.h 2004-11-12 15:37:11.336211471 -0800 @@ -7,6 +7,7 @@ #endif #include "LString.h" +#include "support/types.h" class BufferView; class LyXText; @@ -49,5 +50,13 @@ string const & searchstr, bool forward, bool casesens = true, bool matchwrd = false); +/// find the next change in the buffer +bool findNextChange(BufferView * bv); + +SearchResult findNextChange(BufferView * bv, LyXText * text, lyx::pos_type & length); + +SearchResult nextChange(BufferView * bv, LyXText * text, lyx::pos_type & length); + } // end namespace LyXFind -#endif + +#endif // LYXFIND_H diff -Nurb -x CVS -x version.C -x LaTeXConfig.lyx -x autom4te.cache -x pathscale -x po lyx-1.3.5/src/lyxfunc.C lyx-1.3.5-changebars/src/lyxfunc.C --- lyx-1.3.5/src/lyxfunc.C 2004-04-29 09:14:24.000000000 -0700 +++ lyx-1.3.5-changebars/src/lyxfunc.C 2004-11-12 15:37:11.063240287 -0800 @@ -465,6 +465,13 @@ disable = !view()-> isSavedPosition(strToUnsignedInt(ev.argument)); break; + case LFUN_MERGE_CHANGES: + case LFUN_ACCEPT_CHANGE: + case LFUN_REJECT_CHANGE: + case LFUN_ACCEPT_ALL_CHANGES: + case LFUN_REJECT_ALL_CHANGES: + disable = !buf->params.tracking_changes; + break; case LFUN_INSET_TOGGLE: { LyXText * lt = view()->getLyXText(); disable = !(isEditableInset(lt->getInset()) @@ -627,6 +634,9 @@ if (ev.argument == buf->fileName()) flag.setOnOff(true); break; + case LFUN_TRACK_CHANGES: + flag.setOnOff(buf->params.tracking_changes); + break; default: break; } diff -Nurb -x CVS -x version.C -x LaTeXConfig.lyx -x autom4te.cache -x pathscale -x po lyx-1.3.5/src/lyxrc.C lyx-1.3.5-changebars/src/lyxrc.C --- lyx-1.3.5/src/lyxrc.C 2003-01-14 06:54:14.000000000 -0800 +++ lyx-1.3.5-changebars/src/lyxrc.C 2004-11-12 15:37:10.915255910 -0800 @@ -1,12 +1,10 @@ -/* This file is part of - * ====================================================== +/** + * \file lyxrc.C + * This file is part of LyX, the document processor. + * Licence details can be found in the file COPYING. * - * LyX, The Document Processor - * - * Copyright 1995 Matthias Ettrich - * Copyright 1995-2001 The LyX Team. - * - * ====================================================== */ + * Full author contact details are available in file CREDITS + */ #include @@ -27,10 +25,15 @@ #include "intl.h" #include "support/path.h" #include "support/filetools.h" +#include "support/LAssert.h" #include "converter.h" #include "gettext.h" #include "lyxlex.h" +#include +#include +#include + using std::ostream; using std::ofstream; using std::cout; @@ -148,6 +151,8 @@ { "\\use_pspell", LyXRC::RC_USE_PSPELL }, #endif { "\\use_tempdir", LyXRC::RC_USETEMPDIR }, + { "\\user_email", LyXRC::RC_USER_EMAIL }, + { "\\user_name", LyXRC::RC_USER_NAME }, { "\\view_dvi_paper_option", LyXRC::RC_VIEWDVI_PAPEROPTION }, { "\\viewer" ,LyXRC::RC_VIEWER}, { "\\wheel_jump", LyXRC::RC_WHEEL_JUMP } @@ -264,6 +269,17 @@ // should be moved from the LyXRC class). use_gui = true; pdf_mode = false; + + struct passwd * pw(getpwuid(geteuid())); + lyx::Assert(pw); + + user_name = pw->pw_gecos; + if (user_name.empty()) + user_name = pw->pw_name; + + user_email = GetEnv("EMAIL_ADDRESS"); + if (user_email.empty()) + user_email = GetEnv("EMAIL"); } @@ -1094,6 +1110,16 @@ } break; + case RC_USER_NAME: + if (lexrc.next()) + user_name = lexrc.getString(); + break; + + case RC_USER_EMAIL: + if (lexrc.next()) + user_email = lexrc.getString(); + break; + case RC_LAST: break; // this is just a dummy } } @@ -1261,6 +1287,12 @@ << '\n'; } + case RC_USER_NAME: + os << "\\user_name \"" << user_name << "\"\n"; + + case RC_USER_EMAIL: + os << "\\user_email " << user_email << "\n"; + case RC_SHOW_BANNER: if (show_banner != system_lyxrc.show_banner) { os << "\\show_banner " << tostr(show_banner) << '\n'; @@ -1798,6 +1830,7 @@ if (!converters.getConverter(cit->from, cit->to)) os << "\\converter \"" << cit->from << "\" \"" << cit->to << "\" \"\" \"\"\n"; + } os.flush(); } diff -Nurb -x CVS -x version.C -x LaTeXConfig.lyx -x autom4te.cache -x pathscale -x po lyx-1.3.5/src/lyxrc.h lyx-1.3.5-changebars/src/lyxrc.h --- lyx-1.3.5/src/lyxrc.h 2002-12-16 04:47:30.000000000 -0800 +++ lyx-1.3.5-changebars/src/lyxrc.h 2004-11-12 15:37:11.834158905 -0800 @@ -1,13 +1,11 @@ // -*- C++ -*- -/* This file is part of - * ====================================================== +/** + * \file lyxrc.h + * This file is part of LyX, the document processor. + * Licence details can be found in the file COPYING. * - * LyX, The Document Processor - * - * Copyright 1995 Matthias Ettrich - * Copyright 1995-2001 The LyX Team. - * - * ====================================================== */ + * Full author contact details are available in file CREDITS + */ #ifndef LYXRC_H #define LYXRC_H @@ -127,6 +125,8 @@ #ifdef USE_PSPELL RC_USE_PSPELL, #endif + RC_USER_NAME, + RC_USER_EMAIL, RC_LAST }; @@ -357,6 +357,10 @@ bool preview_hashed_labels; /// float preview_scale_factor; + /// user name + string user_name; + /// user email + string user_email; private: /// Is a bind file already (or currently) read? diff -Nurb -x CVS -x version.C -x LaTeXConfig.lyx -x autom4te.cache -x pathscale -x po lyx-1.3.5/src/lyxrow.C lyx-1.3.5-changebars/src/lyxrow.C --- lyx-1.3.5/src/lyxrow.C 2002-03-21 09:25:15.000000000 -0800 +++ lyx-1.3.5-changebars/src/lyxrow.C 2004-11-12 15:37:11.903151621 -0800 @@ -83,6 +83,18 @@ } +void Row::top_of_text(unsigned int top) +{ + top_of_text_ = top; +} + + +unsigned int Row::top_of_text() const +{ + return top_of_text_; +} + + void Row::baseline(unsigned int b) { baseline_ = b; diff -Nurb -x CVS -x version.C -x LaTeXConfig.lyx -x autom4te.cache -x pathscale -x po lyx-1.3.5/src/lyxrow.h lyx-1.3.5-changebars/src/lyxrow.h --- lyx-1.3.5/src/lyxrow.h 2002-12-01 14:59:17.000000000 -0800 +++ lyx-1.3.5-changebars/src/lyxrow.h 2004-11-12 15:37:10.569292432 -0800 @@ -53,6 +53,10 @@ /// unsigned short ascent_of_text() const; /// + void top_of_text(unsigned int top); + /// + unsigned int top_of_text() const; + /// void baseline(unsigned int b); /// unsigned int baseline() const; @@ -76,8 +80,10 @@ unsigned short height_; /// unsigned int width_; - /// + /// ascent from baseline including prelude space unsigned short ascent_of_text_; + /// the top of the real text in the row + unsigned int top_of_text_; /// unsigned int baseline_; /// diff -Nurb -x CVS -x version.C -x LaTeXConfig.lyx -x autom4te.cache -x pathscale -x po lyx-1.3.5/src/lyxtext.h lyx-1.3.5-changebars/src/lyxtext.h --- lyx-1.3.5/src/lyxtext.h 2002-12-01 13:10:36.000000000 -0800 +++ lyx-1.3.5-changebars/src/lyxtext.h 2004-11-12 15:37:11.119234376 -0800 @@ -281,6 +281,12 @@ /// returns the inset at cursor (if it exists), 0 otherwise Inset * getInset() const; + /// accept selected change + void acceptChange(BufferView * bv); + + /// reject selected change + void rejectChange(BufferView * bv); + /** 'selects" the next word, where the cursor is not in and returns this word as string. THe cursor will be moved to the beginning of this word. @@ -408,10 +414,11 @@ /* these things are for search and replace */ - /** sets the selection over the number of characters of string, - no check!! + /** + * Sets the selection from the current cursor position to length + * characters to the right. No safety checks. */ - void setSelectionOverString(BufferView *, string const & str); + void setSelectionRange(BufferView *, lyx::pos_type length); /** simple replacing. The font of the first selected character is used @@ -574,6 +581,9 @@ /// paint the selection background void paintRowSelection(DrawRowParams & p); + /// paint change bar + void paintChangeBar(DrawRowParams & p); + /// paint appendix marker void paintRowAppendix(DrawRowParams & p); diff -Nurb -x CVS -x version.C -x LaTeXConfig.lyx -x autom4te.cache -x pathscale -x po lyx-1.3.5/src/paragraph.C lyx-1.3.5-changebars/src/paragraph.C --- lyx-1.3.5/src/paragraph.C 2004-09-22 07:10:29.000000000 -0700 +++ lyx-1.3.5-changebars/src/paragraph.C 2004-11-12 15:37:10.898257704 -0800 @@ -1,4 +1,4 @@ -/* This file is part of +/** * ====================================================== * * LyX, The Document Processor @@ -28,6 +28,7 @@ #include "encoding.h" #include "ParameterStruct.h" #include "gettext.h" +#include "changes.h" #include "insets/insetbib.h" #include "insets/insetoptarg.h" @@ -42,6 +43,7 @@ #include #include #include +#include using std::ostream; using std::endl; @@ -63,6 +65,7 @@ char minibuffer_char; LyXFont minibuffer_font; +Change::Type minibuffer_changetype; Inset * minibuffer_inset; } // namespace anon @@ -242,6 +245,9 @@ LyXFont font1(LyXFont::ALL_INHERIT, bparams.language); + Change running_change = Change(Change::UNCHANGED); + time_t const curtime(time(0)); + int column = 0; for (pos_type i = 0; i < size(); ++i) { if (!i) { @@ -249,6 +255,10 @@ column = 0; } + Change change = pimpl_->lookupChangeFull(i); + Changes::lyxMarkChange(os, column, curtime, running_change, change); + running_change = change; + // Write font changes LyXFont font2 = getFontSettings(bparams, i); if (font2 != font1) { @@ -312,6 +322,15 @@ break; } } + + // to make reading work properly + if (!size()) { + running_change = pimpl_->lookupChange(0); + Changes::lyxMarkChange(os, column, curtime, + Change(Change::UNCHANGED), running_change); + } + Changes::lyxMarkChange(os, column, curtime, + running_change, Change(Change::UNCHANGED)); } @@ -328,6 +347,7 @@ minibuffer_char = getChar(pos); minibuffer_font = getFontSettings(bparams, pos); + minibuffer_changetype = lookupChange(pos); minibuffer_inset = 0; if (minibuffer_char == Paragraph::META_INSET) { if (getInset(pos)) { @@ -345,6 +365,8 @@ { minibuffer_char = getChar(pos); minibuffer_font = getFontSettings(bparams, pos); + minibuffer_changetype = lookupChange(pos); + lyxerr[Debug::CHANGES] << "cutFromMinibuffer minibuffer_changetype = " << minibuffer_changetype << endl; minibuffer_inset = 0; if (minibuffer_char == Paragraph::META_INSET) { if (getInset(pos)) { @@ -363,7 +385,7 @@ } -bool Paragraph::insertFromMinibuffer(pos_type pos) +bool Paragraph::insertFromMinibuffer(pos_type pos, bool hide) { if (minibuffer_char == Paragraph::META_INSET) { if (!insetAllowed(minibuffer_inset->lyxCode())) { @@ -375,7 +397,15 @@ if (!checkInsertChar(f)) { return false; } - insertChar(pos, minibuffer_char, f); + Change::Type thechange; + // thechange=Change::INSERTED; + if (1/*hide*/) { + //thechange=Change::UNCHANGED; + //thechange=pimpl_->lookupChange(pos); + thechange = minibuffer_changetype; + lyxerr[Debug::CHANGES] << "insertFromMinibuffer minibuffer_changetype = " << minibuffer_changetype << "at pos " << pos << endl; + } + insertChar(pos, minibuffer_char, f, thechange); } return true; } @@ -383,9 +413,15 @@ // end of minibuffer -void Paragraph::erase(pos_type pos) +void Paragraph::erase(pos_type pos, bool flag) { - pimpl_->erase(pos); + pimpl_->erase(pos, flag); +} + + +bool Paragraph::erase(pos_type start, pos_type end, bool flag) +{ + return pimpl_->erase(start, end, flag); } @@ -405,9 +441,11 @@ void Paragraph::insertChar(pos_type pos, Paragraph::value_type c, - LyXFont const & font) + LyXFont const & font, Change change) { - pimpl_->insertChar(pos, c, font); + lyxerr[Debug::CHANGES] << "calling pimpl_->insertChar with changetype " << change.type << endl; + pimpl_->insertChar(pos, c, font, change); + } @@ -418,9 +456,9 @@ } -void Paragraph::insertInset(pos_type pos, Inset * inset, LyXFont const & font) +void Paragraph::insertInset(pos_type pos, Inset * inset, LyXFont const & font, Change change) { - pimpl_->insertInset(pos, inset, font); + pimpl_->insertInset(pos, inset, font, change); } @@ -736,7 +774,7 @@ int i = 0; while (!empty() && (isNewline(0) || isLineSeparator(0))) { - erase(0); + pimpl_->eraseIntern(0); ++i; } @@ -1361,6 +1399,8 @@ // Do we have an open font change? bool open_font = false; + Change::Type running_change = Change::UNCHANGED; + texrow.start(this, 0); // if the paragraph is empty, the loop will not be entered at all @@ -1448,6 +1488,11 @@ open_font = true; } + Change::Type change = pimpl_->lookupChange(i); + + column += Changes::latexMarkChange(os, running_change, change); + running_change = change; + if (c == Paragraph::META_NEWLINE) { // newlines are handled differently here than // the default in SimpleTeXSpecialChars(). @@ -1477,10 +1522,14 @@ os, texrow, moving_arg, font, running_font, basefont, open_font, + running_change, *style, i, column, c); } } + column += Changes::latexMarkChange(os, + running_change, Change::UNCHANGED); + // If we have an open font definition, we have to close it if (open_font) { #ifdef FIXED_LANGUAGE_END_DETECTION @@ -1815,6 +1864,76 @@ } +void Paragraph::trackChanges(Change::Type type) +{ + pimpl_->trackChanges(type); +} + + +void Paragraph::untrackChanges() +{ + pimpl_->untrackChanges(); +} + + +void Paragraph::cleanChanges() +{ + pimpl_->cleanChanges(); +} + +void Paragraph::recordChanges(Change::Type changetype, lyx::pos_type pos) +{ + pimpl_->recordChanges(changetype, pos); +} + +bool Paragraph::tracking() const +{ + return pimpl_->tracking(); +} +Change::Type Paragraph::lookupChange(lyx::pos_type pos) const +{ + lyx::Assert(!size() || pos < size()); + return pimpl_->lookupChange(pos); +} + + +Change const Paragraph::lookupChangeFull(lyx::pos_type pos) const +{ + lyx::Assert(!size() || pos < size()); + return pimpl_->lookupChangeFull(pos); +} + + +bool Paragraph::isChanged(pos_type start, pos_type end) const +{ + return pimpl_->isChanged(start, end); +} + + +bool Paragraph::isChangeEdited(pos_type start, pos_type end) const +{ + return pimpl_->isChangeEdited(start, end); +} + + +void Paragraph::markErased() +{ + pimpl_->markErased(); +} + + +void Paragraph::acceptChange(pos_type start, pos_type end) +{ + return pimpl_->acceptChange(start, end); +} + + +void Paragraph::rejectChange(pos_type start, pos_type end) +{ + return pimpl_->rejectChange(start, end); +} + + lyx::pos_type Paragraph::size() const { return pimpl_->size(); diff -Nurb -x CVS -x version.C -x LaTeXConfig.lyx -x autom4te.cache -x pathscale -x po lyx-1.3.5/src/paragraph.h lyx-1.3.5-changebars/src/paragraph.h --- lyx-1.3.5/src/paragraph.h 2002-11-07 17:08:27.000000000 -0800 +++ lyx-1.3.5-changebars/src/paragraph.h 2004-11-12 15:37:11.016245249 -0800 @@ -20,6 +20,7 @@ #include "insets/inset.h" // Just for Inset::Code #include "support/types.h" +#include "changes.h" #include "LString.h" @@ -165,6 +166,39 @@ /// Paragraph const * next() const; + /// initialise tracking for this par + void trackChanges(Change::Type = Change::UNCHANGED); + + /// stop tracking + void untrackChanges(); + + /// record changes + void recordChanges(Change::Type changetype, lyx::pos_type pos); + /// set entire paragraph to new text for change tracking + void cleanChanges(); + /// is change tracking enabled? + bool tracking() const; + /// look up change type at given pos + Change::Type lookupChange(lyx::pos_type pos) const; + + /// look up change at given pos + Change const lookupChangeFull(lyx::pos_type pos) const; + + /// is there a change within the given range ? + bool isChanged(lyx::pos_type start, lyx::pos_type end) const; + + /// is there a non-addition in this range ? + bool isChangeEdited(lyx::pos_type start, lyx::pos_type end) const; + + /// accept change + void acceptChange(lyx::pos_type start, lyx::pos_type end); + + /// reject change + void rejectChange(lyx::pos_type start, lyx::pos_type end); + + /// mark whole par as erased + void markErased(); + /// void previous(Paragraph *); /// @@ -197,9 +231,13 @@ depth_type getMaxDepthAfter() const; /// void applyLayout(LyXLayout_ptr const & new_layout); - /// - void erase(lyx::pos_type pos); - /** Get unistantiated font setting. Returns the difference + + /// erase the char at the given position + void erase(lyx::pos_type pos, bool flag=true); + /// erase the given range. Returns true if actually erased. + bool erase(lyx::pos_type start, lyx::pos_type end, bool flag=true); + + /** Get uninstantiated font setting. Returns the difference between the characters font and the layoutfont. This is what is stored in the fonttable */ @@ -234,13 +272,13 @@ /// void insertChar(lyx::pos_type pos, value_type c); /// - void insertChar(lyx::pos_type pos, value_type c, LyXFont const &); + void insertChar(lyx::pos_type pos, value_type c, LyXFont const &, Change change = Change(Change::INSERTED)); /// bool checkInsertChar(LyXFont &); /// void insertInset(lyx::pos_type pos, Inset * inset); /// - void insertInset(lyx::pos_type pos, Inset * inset, LyXFont const &); + void insertInset(lyx::pos_type pos, Inset * inset, LyXFont const &, Change change = Change(Change::INSERTED)); /// bool insetAllowed(Inset::Code code); /// @@ -254,7 +292,8 @@ /// void cutIntoMinibuffer(BufferParams const &, lyx::pos_type pos); /// - bool insertFromMinibuffer(lyx::pos_type pos); + bool insertFromMinibuffer(lyx::pos_type pos, bool hide=false); + //bool insertFromMinibuffer(lyx::pos_type pos); /// bool isHfill(lyx::pos_type pos) const; @@ -294,6 +333,9 @@ /// //Counters & counters(); + friend void breakParagraph(BufferParams const & bparams, + Paragraph * par, lyx::pos_type pos, int flag); + private: /// LyXLayout_ptr layout_; @@ -312,4 +354,16 @@ Pimpl * pimpl_; }; -#endif + +inline bool isInsertedText(Paragraph const * par, lyx::pos_type pos) +{ + return par->lookupChange(pos) == Change::INSERTED; +} + + +inline bool isDeletedText(Paragraph const * par, lyx::pos_type pos) +{ + return par->lookupChange(pos) == Change::DELETED; +} + +#endif // PARAGRAPH_H diff -Nurb -x CVS -x version.C -x LaTeXConfig.lyx -x autom4te.cache -x pathscale -x po lyx-1.3.5/src/paragraph_funcs.C lyx-1.3.5-changebars/src/paragraph_funcs.C --- lyx-1.3.5/src/paragraph_funcs.C 2002-12-01 14:59:17.000000000 -0800 +++ lyx-1.3.5-changebars/src/paragraph_funcs.C 2004-11-12 15:37:11.869155210 -0800 @@ -11,10 +11,12 @@ #include #include "paragraph_funcs.h" +#include "paragraph_pimpl.h" #include "buffer.h" #include "ParagraphParameters.h" #include "lyxtextclasslist.h" #include "debug.h" +#include using lyx::pos_type; //using lyx::layout_type; @@ -34,6 +36,9 @@ // 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 @@ -73,13 +78,17 @@ pos_type pos_end = par->size() - 1; pos_type i = pos; pos_type j = pos; + for (; i <= pos_end; ++i) { + Change::Type change(par->lookupChange(i)); par->cutIntoMinibuffer(bparams, i); - if (tmp->insertFromMinibuffer(j - pos)) + if (tmp->insertFromMinibuffer(j - pos)) { + tmp->pimpl_->setChange(j - pos, change); ++j; } + } for (i = pos_end; i >= pos; --i) { - par->erase(i); + par->pimpl_->eraseIntern(i); } } @@ -102,38 +111,53 @@ par->setLabelWidthString(tmp->params().labelWidthString()); par->params().depth(tmp->params().depth()); } + + // subtle, but needed to get empty pars working right + if (bparams.tracking_changes) { + if (!par->size()) { + par->cleanChanges(); + } else if (!tmp->size()) { + tmp->cleanChanges(); + } + } } void breakParagraphConservative(BufferParams const & bparams, Paragraph * par, - pos_type pos) + pos_type pos, bool flag) { // create a new paragraph Paragraph * tmp = new Paragraph(par); tmp->makeSameLayout(par); - + if (par->tracking()) { + tmp->trackChanges(Change::UNCHANGED); +} // When can pos > Last()? // I guess pos == Last() is possible. if (par->size() > pos) { // copy everything behind the break-position to the new // paragraph pos_type pos_end = par->size() - 1; - for (pos_type i = pos, j = pos; i <= pos_end; ++i) { par->cutIntoMinibuffer(bparams, i); - if (tmp->insertFromMinibuffer(j - pos)) + if (tmp->insertFromMinibuffer(j - pos, true/*, flag*/)){ + if (par->tracking()) { + tmp->recordChanges(par->lookupChange(i),j-pos); + } ++j; } - + } for (pos_type k = pos_end; k >= pos; --k) { - par->erase(k); + //We have to erase the text without marking it + // as Changed::DELETED if (tracking()) is true. jkb030824 + par->erase(k, flag); } } } -void mergeParagraph(BufferParams const & bparams, Paragraph * par) +void mergeParagraph(BufferParams const & bparams, Paragraph * par, bool flag) { Paragraph * the_next = par->next(); @@ -144,11 +168,10 @@ pos_type pos_end = the_next->size() - 1; pos_type pos_insert = par->size(); - // ok, now copy the paragraph for (pos_type i = 0, j = 0; i <= pos_end; ++i) { the_next->cutIntoMinibuffer(bparams, i); - if (par->insertFromMinibuffer(pos_insert + j)) + if (par->insertFromMinibuffer(pos_insert + j,flag)) ++j; } diff -Nurb -x CVS -x version.C -x LaTeXConfig.lyx -x autom4te.cache -x pathscale -x po lyx-1.3.5/src/paragraph_funcs.h lyx-1.3.5-changebars/src/paragraph_funcs.h --- lyx-1.3.5/src/paragraph_funcs.h 2002-10-21 09:21:52.000000000 -0700 +++ lyx-1.3.5-changebars/src/paragraph_funcs.h 2004-11-12 15:37:12.184121960 -0800 @@ -26,13 +26,13 @@ /// void breakParagraphConservative(BufferParams const & bparams, Paragraph *, - lyx::pos_type pos); + lyx::pos_type pos, bool flag=false); /** * Append the next paragraph onto the tail of this one. * Be careful, this doesent make any check at all. */ -void mergeParagraph(BufferParams const & bparams, Paragraph *); +void mergeParagraph(BufferParams const & bparams, Paragraph *, bool flag=false); #if 0 diff -Nurb -x CVS -x version.C -x LaTeXConfig.lyx -x autom4te.cache -x pathscale -x po lyx-1.3.5/src/paragraph_pimpl.C lyx-1.3.5-changebars/src/paragraph_pimpl.C --- lyx-1.3.5/src/paragraph_pimpl.C 2003-01-08 01:03:31.000000000 -0800 +++ lyx-1.3.5-changebars/src/paragraph_pimpl.C 2004-11-12 15:37:10.382312171 -0800 @@ -22,7 +22,7 @@ #include "encoding.h" #include "lyxrc.h" #include "debug.h" - +#include #include "support/LAssert.h" using lyx::pos_type; @@ -74,12 +74,16 @@ id_ = p.id_; else id_ = paragraph_id++; + + if (p.tracking()) + changes_.reset(new Changes(*p.changes_.get())); } void Paragraph::Pimpl::clear() { text.clear(); +#warning changes ? } @@ -87,6 +91,171 @@ { lyx::Assert(par); text = par->pimpl_->text; + if (par->pimpl_->tracking()) { + changes_.reset(new Changes(*(par->pimpl_->changes_.get()))); + } +} + + +void Paragraph::Pimpl::trackChanges(Change::Type type) +{ + if (tracking()) { + lyxerr[Debug::CHANGES] << "already tracking for par " << id_ << endl; + return; + } + + lyxerr[Debug::CHANGES] << "track changes for par " + << id_ << " type " << type << endl; + changes_.reset(new Changes(type)); + changes_->set(type, 0, size()); +} + + +void Paragraph::Pimpl::recordChanges(Change::Type changetype, pos_type pos) +{ + if (tracking()){ + changes_->record(Change(changetype), pos); + } +} +void Paragraph::Pimpl::untrackChanges() +{ + changes_.reset(0); +} + +void Paragraph::Pimpl::cleanChanges() +{ + // if we're not tracking, we don't want to reset... + if (!tracking()) + return; + + changes_.reset(new Changes(Change::INSERTED)); + changes_->set(Change::INSERTED, 0, size()); +} + + +bool Paragraph::Pimpl::isChanged(pos_type start, pos_type end) const +{ + if (!tracking()) + return false; + + return changes_->isChange(start, end); +} + + +bool Paragraph::Pimpl::isChangeEdited(pos_type start, pos_type end) const +{ + if (!tracking()) + return false; + + return changes_->isChangeEdited(start, end); +} + + +void Paragraph::Pimpl::setChange(pos_type pos, Change::Type type) +{ + if (!tracking()) + return; + + changes_->set(type, pos); +} + + +Change::Type Paragraph::Pimpl::lookupChange(pos_type pos) const +{ + if (!tracking()) + return Change::UNCHANGED; + + return changes_->lookup(pos); +} + + +Change const Paragraph::Pimpl::lookupChangeFull(pos_type pos) const +{ + if (!tracking()) + return Change(Change::UNCHANGED); + + return changes_->lookupFull(pos); +} + + +void Paragraph::Pimpl::markErased() +{ + lyx::Assert(tracking()); + + // FIXME: we should actually remove INSERTED chars. + // difficult because owning insettexts/tabulars need + // to update themselves when rows etc. change + changes_->set(Change::DELETED, 0, size()); + changes_->reset(Change::DELETED); +} + + +void Paragraph::Pimpl::acceptChange(pos_type start, pos_type end) +{ + if (!tracking()) + return; + + if (!size()) { + changes_.reset(new Changes(Change::UNCHANGED)); + return; + } + + lyxerr << "acceptchange" << endl; + pos_type i = start; + + for (; i < end; ++i) { + switch (lookupChange(i)) { + case Change::UNCHANGED: + break; + + case Change::INSERTED: + changes_->set(Change::UNCHANGED, i); + break; + + case Change::DELETED: + eraseIntern(i); + changes_->erase(i); + --end; + --i; + break; + } + } + + lyxerr << "endacceptchange" << endl; + changes_->reset(Change::UNCHANGED); +} + + +void Paragraph::Pimpl::rejectChange(pos_type start, pos_type end) +{ + if (!tracking()) + return; + + if (!size()) { + changes_.reset(new Changes(Change::UNCHANGED)); + return; + } + + pos_type i = start; + + for (; i < end; ++i) { + switch (lookupChange(i)) { + case Change::UNCHANGED: + break; + + case Change::INSERTED: + eraseIntern(i); + changes_->erase(i); + --end; + --i; + break; + + case Change::DELETED: + changes_->set(Change::UNCHANGED, i); + break; + } + } + changes_->reset(Change::UNCHANGED); } @@ -109,15 +278,22 @@ void Paragraph::Pimpl::setChar(pos_type pos, value_type c) { +#warning changes text[pos] = c; } void Paragraph::Pimpl::insertChar(pos_type pos, value_type c, - LyXFont const & font) + LyXFont const & font, Change change) { lyx::Assert(pos <= size()); + if (tracking()) { + changes_->record(change, pos); + + + } + // This is actually very common when parsing buffers (and // maybe inserting ascii text) if (pos == size()) { @@ -147,12 +323,12 @@ void Paragraph::Pimpl::insertInset(pos_type pos, - Inset * inset, LyXFont const & font) + Inset * inset, LyXFont const & font, Change change) { lyx::Assert(inset); lyx::Assert(pos <= size()); - insertChar(pos, META_INSET, font); + insertChar(pos, META_INSET, font, change); lyx::Assert(text[pos] == META_INSET); // Add a new entry in the insetlist. @@ -164,9 +340,37 @@ } -void Paragraph::Pimpl::erase(pos_type pos) +bool Paragraph::Pimpl::erasePos(pos_type pos, bool flag) { lyx::Assert(pos < size()); + + if (tracking()) { + Change::Type changetype(changes_->lookup(pos)); + //Mark text as Change::DELETED unless flag is not true. + //By default flag is true. + if (flag) + { + changes_->record(Change(Change::DELETED), pos); + + + // only allow the actual removal if it was /new/ text + if (changetype != Change::INSERTED) { + if (text[pos] == Paragraph::META_INSET) { + Inset * i(owner_->getInset(pos)); + i->markErased(); + } + return false; + } + } + } + + eraseIntern(pos); + return true; +} + + +void Paragraph::Pimpl::eraseIntern(pos_type pos) +{ // if it is an inset, delete the inset entry if (text[pos] == Paragraph::META_INSET) { owner_->insetlist.erase(pos); @@ -209,6 +413,30 @@ } +void Paragraph::Pimpl::erase(pos_type pos, bool flag) +{ + erasePos(pos, flag); +} + + +bool Paragraph::Pimpl::erase(pos_type start, pos_type end, bool flag) +{ + pos_type i = start; + pos_type count = end - start; + bool any_erased = false; + + while (count) { + if (!erasePos(i, flag)) { + ++i; + } else { + any_erased = true; + } + --count; + } + return any_erased; +} + + void Paragraph::Pimpl::simpleTeXBlanks(ostream & os, TexRow & texrow, pos_type const i, unsigned int & column, @@ -279,6 +507,7 @@ LyXFont & running_font, LyXFont & basefont, bool & open_font, + Change::Type & running_change, LyXLayout const & style, pos_type & i, unsigned int & column, @@ -294,7 +523,17 @@ switch (c) { case Paragraph::META_INSET: { Inset * inset = owner_->getInset(i); - if (inset) { + + // FIXME: remove this check + if (!inset) + break; + + if (inset->isTextInset()) { + column += Changes::latexMarkChange(os, running_change, + Change::UNCHANGED); + running_change = Change::UNCHANGED; + } + bool close = false; int const len = os.tellp(); //ostream::pos_type const len = os.tellp(); @@ -339,7 +578,6 @@ column += int(os.tellp()) - len; } } - } break; case Paragraph::META_NEWLINE: diff -Nurb -x CVS -x version.C -x LaTeXConfig.lyx -x autom4te.cache -x pathscale -x po lyx-1.3.5/src/paragraph_pimpl.h lyx-1.3.5-changebars/src/paragraph_pimpl.h --- lyx-1.3.5/src/paragraph_pimpl.h 2003-01-08 01:03:31.000000000 -0800 +++ lyx-1.3.5-changebars/src/paragraph_pimpl.h 2004-11-12 15:37:10.874260237 -0800 @@ -1,13 +1,9 @@ // -*- C++ -*- -/* This file is part of - * ====================================================== - * - * LyX, The Document Processor - * - * Copyright 1995 Matthias Ettrich - * Copyright 1995-2001 The LyX Team. - * - * ====================================================== */ +/** + * \file paragraph_pimpl.h + * Copyright 1995-2002 the LyX Team + * Read the file COPYING + */ #ifndef PARAGRAPH_PIMPL_H #define PARAGRAPH_PIMPL_H @@ -18,8 +14,11 @@ #include "paragraph.h" #include "ParagraphParameters.h" +#include "changes.h" #include "counters.h" +#include + class LyXLayout; struct Paragraph::Pimpl { @@ -42,16 +41,54 @@ void clear(); /// void setContentsFromPar(Paragraph const * par); + /// set tracking mode + void trackChanges(Change::Type type = Change::UNCHANGED); + /// stop tracking + void untrackChanges(); + /// set all text as new for change mode + void cleanChanges(); + /// record changes + void recordChanges(Change::Type changetype, lyx::pos_type pos); + /// look up change type at given pos + Change::Type lookupChange(lyx::pos_type pos) const; + /// look up change at given pos + Change const lookupChangeFull(lyx::pos_type pos) const; + /// is there a change in the given range ? + bool isChanged(lyx::pos_type start, lyx::pos_type end) const; + /// is there a non-addition in this range ? + bool isChangeEdited(lyx::pos_type start, lyx::pos_type end) const; + + /// set change at pos + void setChange(lyx::pos_type pos, Change::Type type); + + /// mark as erased + void markErased(); + + /// accept change + void acceptChange(lyx::pos_type start, lyx::pos_type end); + + /// reject change + void rejectChange(lyx::pos_type start, lyx::pos_type end); + + /// are we tracking changes ? + bool tracking() const { + return changes_.get(); + } + /// value_type getChar(lyx::pos_type pos) const; /// void setChar(lyx::pos_type pos, value_type c); /// - void insertChar(lyx::pos_type pos, value_type c, LyXFont const & font); + void insertChar(lyx::pos_type pos, value_type c, LyXFont const & font, Change change = Change(Change::INSERTED)); /// - void insertInset(lyx::pos_type pos, Inset * inset, LyXFont const & font); - /// - void erase(lyx::pos_type pos); + void insertInset(lyx::pos_type pos, Inset * inset, LyXFont const & font, Change change = Change(Change::INSERTED)); + /// definite erase + void eraseIntern(lyx::pos_type pos); + /// erase the given position + void erase(lyx::pos_type pos, bool flag=true); + /// erase the given range + bool erase(lyx::pos_type start, lyx::pos_type end, bool flag=true); /// LyXFont const realizeFont(LyXFont const & font, BufferParams const & bparams) const; @@ -115,6 +152,7 @@ typedef std::vector FontList; /// FontList fontlist; + /// Paragraph * TeXDeeper(Buffer const *, BufferParams const &, std::ostream &, TexRow & texrow); @@ -130,6 +168,7 @@ bool moving_arg, LyXFont & font, LyXFont & running_font, LyXFont & basefont, bool & open_font, + Change::Type & running_change, LyXLayout const & style, lyx::pos_type & i, unsigned int & column, value_type const c); @@ -148,9 +187,15 @@ ParagraphParameters params; private: + /// erase at the given position. Returns true if it was actually erased + bool erasePos(lyx::pos_type pos, bool=false); + /// match a string against a particular point in the paragraph bool isTextAt(string const & str, lyx::pos_type pos) const; + /// for recording and looking up changes in revision tracking mode + boost::scoped_ptr changes_; + /// Who owns us? Paragraph * owner_; /// diff -Nurb -x CVS -x version.C -x LaTeXConfig.lyx -x autom4te.cache -x pathscale -x po lyx-1.3.5/src/tabular.C lyx-1.3.5-changebars/src/tabular.C --- lyx-1.3.5/src/tabular.C 2003-01-08 01:03:31.000000000 -0800 +++ lyx-1.3.5-changebars/src/tabular.C 2004-11-12 15:37:11.942147505 -0800 @@ -270,7 +270,9 @@ cell_info = c_info; ++row; for (int j = 0; j < columns_; ++j) { - cell_info[row][j].inset.clear(); + cell_info[row][j].inset.clear(false); + if (bp.tracking_changes) + cell_info[row][j].inset.markNew(true); } #endif Reinit(); @@ -321,8 +323,9 @@ cell_info = c_info; //++column; for (int i = 0; i < rows_; ++i) { - //cell_info[i][column].inset.clear(); - cell_info[i][column + 1].inset.clear(); + cell_info[i][column + 1].inset.clear(false); + if (bp.tracking_changes) + cell_info[i][column + 1].inset.markNew(true); } Reinit(); } @@ -1555,7 +1558,7 @@ cellinfo_of_cell(cell+i)->multicolumn = CELL_PART_OF_MULTICOLUMN; cellinfo_of_cell(cell)->inset.appendParagraphs(buffer->params, cellinfo_of_cell(cell+i)->inset.paragraph()); - cellinfo_of_cell(cell+i)->inset.clear(); + cellinfo_of_cell(cell+i)->inset.clear(false); } #else for (number--; number > 0; --number) { diff -Nurb -x CVS -x version.C -x LaTeXConfig.lyx -x autom4te.cache -x pathscale -x po lyx-1.3.5/src/text.C lyx-1.3.5-changebars/src/text.C --- lyx-1.3.5/src/text.C 2004-09-23 03:07:43.000000000 -0700 +++ lyx-1.3.5-changebars/src/text.C 2004-11-12 15:37:12.078133149 -0800 @@ -50,7 +50,12 @@ namespace { -int const LYX_PAPER_MARGIN = 20; +/// top, right, bottom pixel margin +int const PAPER_MARGIN = 20; +/// margin for changebar +int const CHANGEBAR_MARGIN = 10; +/// left margin +int const LEFT_MARGIN = PAPER_MARGIN + CHANGEBAR_MARGIN; } // namespace anon @@ -245,6 +250,9 @@ // Returns the paragraph position of the last character in the specified row pos_type LyXText::rowLast(Row const * row) const { + if (!row->par()->size()) + return 0; + if (!row->next() || row->next()->par() != row->par()) { return row->par()->size() - 1; } else { @@ -260,8 +268,8 @@ Inset * ins; // we have to consider a space on the last position in this case! if (row->next() && row->par() == row->next()->par() && - row->next()->par()->getChar(last+1) == Paragraph::META_INSET && - (ins=row->next()->par()->getInset(last+1)) && + row->next()->par()->getChar(last + 1) == Paragraph::META_INSET && + (ins=row->next()->par()->getInset(last + 1)) && (ins->needFullRow() || ins->display())) { ignore_the_space_on_the_last_position = false; @@ -533,7 +541,7 @@ if (orig_font.language() == p.bv->buffer()->params.language) return; - int const y = p.yo + p.row->height() - 1; + int const y = p.yo + p.row->baseline() + 1; p.pain->line(int(orig_x), y, int(p.x), y, LColor::language); } @@ -609,7 +617,7 @@ { pos_type pos = vis2log(vpos); pos_type const last = rowLastPrintable(p.row); - LyXFont const & orig_font = getFont(p.bv->buffer(), p.row->par(), pos); + LyXFont orig_font(getFont(p.bv->buffer(), p.row->par(), pos)); // first character string str; @@ -618,6 +626,10 @@ unsigned char c = str[0]; str[0] = transformChar(c, p.row->par(), pos); } + + bool prev_struckout(isDeletedText(p.row->par(), pos)); + bool prev_newtext(isInsertedText(p.row->par(), pos)); + ++vpos; // collect as much similar chars as we can @@ -627,6 +639,12 @@ if (!IsPrintableNonspace(c)) break; + if (prev_struckout != isDeletedText(p.row->par(), pos)) + break; + + if (prev_newtext != isInsertedText(p.row->par(), pos)) + break; + if (arabic && Encodings::IsComposeChar_arabic(c)) break; if (hebrew && Encodings::IsComposeChar_hebrew(c)) @@ -641,6 +659,12 @@ ++vpos; } + if (prev_struckout) { + orig_font.setColor(LColor::strikeout); + } else if (prev_newtext) { + orig_font.setColor(LColor::newtext); + } + // Draw text and set the new x position p.pain->text(int(p.x), p.yo + p.row->baseline(), str, orig_font); p.x += font_metrics::width(str, orig_font); @@ -702,7 +726,7 @@ if ((row->par()->getChar(row->pos()) == Paragraph::META_INSET) && (ins=row->par()->getInset(row->pos())) && (ins->needFullRow() || ins->display())) - return LYX_PAPER_MARGIN; + return LEFT_MARGIN; LyXTextClass const & tclass = bview->buffer()->params.getLyXTextClass(); @@ -710,7 +734,7 @@ string parindent = layout->parindent; - int x = LYX_PAPER_MARGIN; + int x = LEFT_MARGIN; x += font_metrics::signedWidth(tclass.leftmargin(), tclass.defaultfont()); @@ -894,12 +918,12 @@ if ((row->par()->getChar(row->pos()) == Paragraph::META_INSET) && (ins=row->par()->getInset(row->pos())) && (ins->needFullRow() || ins->display())) - return LYX_PAPER_MARGIN; + return PAPER_MARGIN; LyXTextClass const & tclass = buf->params.getLyXTextClass(); LyXLayout_ptr const & layout = row->par()->layout(); - int x = LYX_PAPER_MARGIN + int x = PAPER_MARGIN + font_metrics::signedWidth(tclass.rightmargin(), tclass.defaultfont()); @@ -1312,8 +1336,8 @@ LyXLayout_ptr const & layout = firstpar->layout(); - // as max get the first character of this row then it can increes but not - // decrees the height. Just some point to start with so we don't have to + // as max get the first character of this row then it can increase but not + // decrease the height. Just some point to start with so we don't have to // do the assignment below too often. LyXFont font = getFont(bview->buffer(), par, row_ptr->pos()); LyXFont::FONT_SIZE const tmpsize = font.size(); @@ -1407,7 +1431,7 @@ // the paper margins if (!row_ptr->par()->previous() && bv_owner) - maxasc += LYX_PAPER_MARGIN; + maxasc += PAPER_MARGIN; // add the vertical spaces, that the user added maxasc += getLengthMarkerHeight(bview, firstpar->params().spaceTop()); @@ -1517,7 +1541,7 @@ { // the paper margins if (!par->next() && bv_owner) - maxdesc += LYX_PAPER_MARGIN; + maxdesc += PAPER_MARGIN; // add the vertical spaces, that the user added maxdesc += getLengthMarkerHeight(bview, firstpar->params().spaceBottom()); @@ -1578,6 +1602,9 @@ row_ptr->baseline(maxasc + labeladdon); height += row_ptr->height(); + + row_ptr->top_of_text(row_ptr->baseline() - font_metrics::maxAscent(font)); + float x = 0; if (layout->margintype != MARGIN_RIGHT_ADDRESS_BOX) { float dummy; @@ -1722,6 +1749,12 @@ void LyXText::breakParagraph(BufferView * bview, char keep_layout) { + // allow only if at start or end, or all previous is new text + //Why? JKB030826 + //if (cursor.pos() && cursor.pos() != cursor.par()->size() + // && cursor.par()->isChangeEdited(0, cursor.pos())) + // return; + LyXTextClass const & tclass = bview->buffer()->params.getLyXTextClass(); LyXLayout_ptr const & layout = cursor.par()->layout(); @@ -1740,7 +1773,7 @@ // It is better to erase the space (Dekel) if (cursor.pos() < cursor.par()->size() && cursor.par()->isLineSeparator(cursor.pos())) - cursor.par()->erase(cursor.pos()); + cursor.par()->erase(cursor.pos(),false); // cursor.pos(cursor.pos() + 1); // break the paragraph @@ -1799,7 +1832,7 @@ while (!cursor.par()->next()->empty() && cursor.par()->next()->isNewline(0)) - cursor.par()->next()->erase(0); + cursor.par()->next()->erase(0, false); insertParagraph(bview, cursor.par()->next(), cursor.row()); @@ -2386,6 +2419,48 @@ } +void LyXText::acceptChange(BufferView * bv) +{ + if (!selection.set() && cursor.par()->size()) + return; + + bv->hideCursor(); + + if (selection.start.par() == selection.end.par()) { + LyXCursor & startc = selection.start; + LyXCursor & endc = selection.end; + setUndo(bv, Undo::INSERT, startc.par(), startc.par()->next()); + startc.par()->acceptChange(startc.pos(), endc.pos()); + finishUndo(); + clearSelection(); + redoParagraphs(bv, startc, startc.par()->next()); + setCursorIntern(bv, startc.par(), 0); + } +#warning handle multi par selection +} + + +void LyXText::rejectChange(BufferView * bv) +{ + if (!selection.set() && cursor.par()->size()) + return; + + bv->hideCursor(); + + if (selection.start.par() == selection.end.par()) { + LyXCursor & startc = selection.start; + LyXCursor & endc = selection.end; + setUndo(bv, Undo::INSERT, startc.par(), startc.par()->next()); + startc.par()->rejectChange(startc.pos(), endc.pos()); + finishUndo(); + clearSelection(); + redoParagraphs(bv, startc, startc.par()->next()); + setCursorIntern(bv, startc.par(), 0); + } +#warning handle multi par selection +} + + // This function is only used by the spellchecker for NextWord(). // It doesn't handle LYX_ACCENTs and probably never will. WordLangTuple const @@ -2419,24 +2494,32 @@ } // Now, skip until we have real text (will jump paragraphs) - while ((cursor.par()->size() > cursor.pos() - && (!cursor.par()->isLetter(cursor.pos())) - && (!cursor.par()->isInset(cursor.pos()) || - !cursor.par()->getInset(cursor.pos())->allowSpellcheck())) - || (cursor.par()->size() == cursor.pos() - && cursor.par()->next())) - { - if (cursor.pos() == cursor.par()->size()) { - cursor.par(cursor.par()->next()); + while (1) { + Paragraph * cpar(cursor.par()); + pos_type const cpos(cursor.pos()); + + if (cpos == cpar->size()) { + if (cpar->next()) { + cursor.par(cpar->next()); cursor.pos(0); - } else - cursor.pos(cursor.pos() + 1); + continue; + } + break; + } + + bool const is_bad_inset(cpar->isInset(cpos) + && !cpar->getInset(cpos)->allowSpellcheck()); + + if (cpar->isLetter(cpos) && !isDeletedText(cpar, cpos) + && !is_bad_inset) + break; + + cursor.pos(cpos + 1); } // now check if we hit an inset so it has to be a inset containing text! if (cursor.pos() < cursor.par()->size() && - cursor.par()->isInset(cursor.pos())) - { + cursor.par()->isInset(cursor.pos())) { // lock the inset! cursor.par()->getInset(cursor.pos())->edit(bview); // now call us again to do the above trick @@ -2459,7 +2542,8 @@ // and find the end of the word (insets like optional hyphens // and ligature break are part of a word) while (cursor.pos() < cursor.par()->size() - && (cursor.par()->isLetter(cursor.pos()))) + && cursor.par()->isLetter(cursor.pos()) + && !isDeletedText(cursor.par(), cursor.pos())) cursor.pos(cursor.pos() + 1); // Finally, we copy the word to a string and return it @@ -2624,6 +2708,7 @@ break; } } +#warning changes par->setChar(pos, c); checkParagraph(bview, par, pos); @@ -2647,23 +2732,31 @@ // First decide if it is possible to transpose at all - // We are at the beginning of a paragraph. - if (tmppos == 0) return; + if (tmppos == 0 || tmppos == tmppar->size()) + return; - // We are at the end of a paragraph. - if (tmppos == tmppar->size() - 1) return; + if (isDeletedText(tmppar, tmppos - 1) + || isDeletedText(tmppar, tmppos)) + return; unsigned char c1 = tmppar->getChar(tmppos); unsigned char c2 = tmppar->getChar(tmppos - 1); - if (c1 != Paragraph::META_INSET - && c2 != Paragraph::META_INSET) { - tmppar->setChar(tmppos, c2); - tmppar->setChar(tmppos - 1, c1); - } // We should have an implementation that handles insets // as well, but that will have to come later. (Lgb) - checkParagraph(const_cast(&bview), tmppar, tmppos); + if (c1 == Paragraph::META_INSET || c2 == Paragraph::META_INSET) + return; + + bool const erased = tmppar->erase(tmppos - 1, tmppos + 1); + pos_type const ipos(erased ? tmppos - 1 : tmppos + 1); + + tmppar->insertChar(ipos, c1); + tmppar->insertChar(ipos + 1, c2); + + /* fugly */ + BufferView * bv(const_cast(&bview)); + + checkParagraph(bv, tmppar, tmppos); } @@ -2717,6 +2810,10 @@ // The cursor is at the beginning of a paragraph, // so the the backspace will collapse two paragraphs into one. + // but it's not allowed unless it's new + if (cursor.par()->isChangeEdited(0, cursor.par()->size())) + return; + // we may paste some paragraphs // is it an empty paragraph? @@ -3188,6 +3285,23 @@ } +void LyXText::paintChangeBar(DrawRowParams & p) +{ + pos_type const start = p.row->pos(); + pos_type const end = rowLastPrintable(p.row); + + if (!p.row->par()->isChanged(start, end)) + return; + + int const height = (p.row->next() + ? p.row->height() + p.row->next()->top_of_text() + : p.row->baseline()); + + p.pain->fillRectangle(4, p.yo, 5, + height, LColor::changebar); +} + + void LyXText::paintRowAppendix(DrawRowParams & p) { // FIXME: can be just p.width ? @@ -3216,12 +3330,15 @@ next_depth = p.row->next()->par()->getDepth(); for (Paragraph::depth_type i = 1; i <= depth; ++i) { - int const x = (LYX_PAPER_MARGIN / 5) * i + p.xo; + int x = (PAPER_MARGIN / 5) * i + p.xo; + // only consider the changebar space if we're drawing outer left + if (!p.xo) + x += CHANGEBAR_MARGIN; int const h = p.yo + p.row->height() - 1 - (i - next_depth - 1) * 3; p.pain->line(x, p.yo, x, h, LColor::depthbar); - int const w = LYX_PAPER_MARGIN / 5; + int const w = PAPER_MARGIN / 5; if (i > prev_depth) { p.pain->fillRectangle(x, p.yo, w, 2, LColor::depthbar); @@ -3356,7 +3473,7 @@ // think about the margins if (!p.row->previous() && bv_owner) - y_top += LYX_PAPER_MARGIN; + y_top += PAPER_MARGIN; // draw a top pagebreak if (parparams.pagebreakTop()) { @@ -3442,6 +3559,8 @@ x = ww - leftMargin(p.bv, p.row) - font_metrics::width(str, font); } + if (layout->align == LYX_ALIGN_CENTER) + x = ww/2 - font_metrics::width(str, font)/2; p.pain->text(int(x), p.yo + p.row->baseline() - @@ -3518,7 +3637,7 @@ // think about the margins if (!p.row->next() && bv_owner) - y_bottom -= LYX_PAPER_MARGIN; + y_bottom -= PAPER_MARGIN; int const ww = p.bv->workWidth(); @@ -3566,7 +3685,7 @@ LyXFont const font = getLabelFont(buffer, par); int const size = int(0.75 * font_metrics::maxAscent(font)); int const y = (p.yo + p.row->baseline()) - size; - int x = is_rtl ? LYX_PAPER_MARGIN : ww - LYX_PAPER_MARGIN - size; + int x = is_rtl ? LEFT_MARGIN : ww - PAPER_MARGIN - size; if (p.row->fill() <= size) x += (size - p.row->fill() + 1) * (is_rtl ? -1 : 1); @@ -3616,16 +3735,42 @@ LyXLayout_ptr const & layout = par->layout(); + bool running_strikeout = false; + bool is_struckout = false; + float last_strikeout_x = 0.0; + pos_type vpos = p.row->pos(); while (vpos <= last) { if (p.x > p.bv->workWidth()) break; pos_type pos = vis2log(vpos); + if (p.x + singleWidth(p.bv, par, pos) < 0) { p.x += singleWidth(p.bv, par, pos); ++vpos; continue; } + + is_struckout = isDeletedText(par, pos); + + if (is_struckout && !running_strikeout) { + running_strikeout = true; + last_strikeout_x = p.x; + } + + bool const highly_editable_inset = par->isInset(pos) + && isHighlyEditableInset(par->getInset(pos)); + + // if we reach the end of a struck out range, paint it + // we also don't paint across things like tables + if (running_strikeout && (highly_editable_inset || !is_struckout)) { + int const middle = p.yo + p.row->top_of_text() + + ((p.row->baseline() - p.row->top_of_text()) / 2); + p.pain->line(int(last_strikeout_x), middle, int(p.x), middle, + LColor::strikeout, Painter::line_solid, Painter::line_thin); + running_strikeout = false; + } + if (main_body > 0 && pos == main_body - 1) { int const lwidth = font_metrics::width(layout->labelsep, getLabelFont(buffer, par)); @@ -3675,6 +3820,15 @@ break; } } + + // if we reach the end of a struck out range, paint it + if (running_strikeout) { + int const middle = p.yo + p.row->top_of_text() + + ((p.row->baseline() - p.row->top_of_text()) / 2); + p.pain->line(int(last_strikeout_x), middle, int(p.x), middle, + LColor::strikeout, Painter::line_solid, Painter::line_thin); + running_strikeout = false; + } } @@ -3719,6 +3873,9 @@ // environment depth brackets paintRowDepthBar(p); + // changebar + paintChangeBar(p); + // draw any stuff wanted for a first row of a paragraph if (!row->pos()) { paintFirstRow(p); @@ -3772,6 +3929,12 @@ !row->par()->isLineSeparator(main_body - 1))) main_body = 0; + // check for empty row + if (!row->par()->size()) { + x = int(tmpx); + return 0; + } + while (vc <= last && tmpx <= x) { c = vis2log(vc); last_tmpx = tmpx; @@ -3816,9 +3979,7 @@ : false; // If lastrow is false, we don't need to compute // the value of rtl. - if (row->pos() > last) // Row is empty? - c = row->pos(); - else if (lastrow && + if (lastrow && ((rtl && left_side && vc == row->pos() && x < tmpx - 5) || (!rtl && !left_side && vc == last + 1 && x > tmpx + 5))) c = last + 1; diff -Nurb -x CVS -x version.C -x LaTeXConfig.lyx -x autom4te.cache -x pathscale -x po lyx-1.3.5/src/text2.C lyx-1.3.5-changebars/src/text2.C --- lyx-1.3.5/src/text2.C 2004-04-29 09:15:12.000000000 -0700 +++ lyx-1.3.5-changebars/src/text2.C 2004-11-12 15:37:10.138337926 -0800 @@ -1495,7 +1495,8 @@ // cutSelection can invalidate the cursor so we need to set // it anew. (Lgb) - cursor = selection.start; + // we prefer the end for when tracking changes + cursor = selection.end; // need a valid cursor. (Lgb) clearSelection(); @@ -1559,14 +1560,13 @@ } -// sets the selection over the number of characters of string, no check!! -void LyXText::setSelectionOverString(BufferView * bview, string const & str) +void LyXText::setSelectionRange(BufferView * bview, lyx::pos_type length) { - if (str.empty()) + if (!length) return; selection.cursor = cursor; - for (string::size_type i = 0; i < str.length(); ++i) + while (length--) cursorRight(bview); setSelection(bview); } @@ -1803,7 +1803,11 @@ pos_type last = rowLastPrintable(old_row); - if (pos > last + 1) { + // None of these should happen, but we're scaredy-cats + if (pos > par->size()) { + pos = 0; + cur.pos(0); + } else if (pos > last + 1) { // This shouldn't happen. pos = last + 1; cur.pos(pos); @@ -2189,7 +2193,7 @@ && old_cursor.pos() < old_cursor.par()->size() && old_cursor.par()->isLineSeparator(old_cursor.pos()) && old_cursor.par()->isLineSeparator(old_cursor.pos() - 1)) { - old_cursor.par()->erase(old_cursor.pos() - 1); + old_cursor.par()->erase(old_cursor.pos() - 1, false); redoParagraphs(bview, old_cursor, old_cursor.par()->next()); #ifdef WITH_WARNINGS