mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 10:00:33 +00:00
Move LFUN_CHANGES_TRACK and LFUN_CHANGES_OUTPUT to Buffer.cpp,
and record an undo call. This deals with the problem of marking the Buffer dirty, as well. Move LFUN_BUFFER_TOGGLE_COMPRESSION and LFUN_BUFFER_TOGGLE_OUTPUT_SYNC to Buffer.cpp, and add an undo call.
This commit is contained in:
parent
ba99ea5b88
commit
2c4ec33591
@ -2445,6 +2445,26 @@ bool Buffer::getStatus(FuncRequest const & cmd, FuncStatus & flag)
|
|||||||
enable = (d->preview_file_).exists() && !(d->preview_file_).isFileEmpty();
|
enable = (d->preview_file_).exists() && !(d->preview_file_).isFileEmpty();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case LFUN_CHANGES_TRACK:
|
||||||
|
flag.setEnabled(true);
|
||||||
|
flag.setOnOff(params().track_changes);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case LFUN_CHANGES_OUTPUT:
|
||||||
|
flag.setEnabled(true);
|
||||||
|
flag.setOnOff(params().output_changes);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case LFUN_BUFFER_TOGGLE_COMPRESSION: {
|
||||||
|
flag.setOnOff(params().compressed);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case LFUN_BUFFER_TOGGLE_OUTPUT_SYNC: {
|
||||||
|
flag.setOnOff(params().output_sync);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -2674,6 +2694,46 @@ void Buffer::dispatch(FuncRequest const & func, DispatchResult & dr)
|
|||||||
dr.setMessage(_("Error viewing the output file."));
|
dr.setMessage(_("Error viewing the output file."));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case LFUN_CHANGES_TRACK:
|
||||||
|
undo().recordUndoBufferParams(CursorData());
|
||||||
|
params().track_changes = !params().track_changes;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case LFUN_CHANGES_OUTPUT:
|
||||||
|
undo().recordUndoBufferParams(CursorData());
|
||||||
|
params().output_changes = !params().output_changes;
|
||||||
|
if (params().output_changes) {
|
||||||
|
bool dvipost = LaTeXFeatures::isAvailable("dvipost");
|
||||||
|
bool xcolorulem = LaTeXFeatures::isAvailable("ulem") &&
|
||||||
|
LaTeXFeatures::isAvailable("xcolor");
|
||||||
|
|
||||||
|
if (!dvipost && !xcolorulem) {
|
||||||
|
Alert::warning(_("Changes not shown in LaTeX output"),
|
||||||
|
_("Changes will not be highlighted in LaTeX output, "
|
||||||
|
"because neither dvipost nor xcolor/ulem are installed.\n"
|
||||||
|
"Please install these packages or redefine "
|
||||||
|
"\\lyxadded and \\lyxdeleted in the LaTeX preamble."));
|
||||||
|
} else if (!xcolorulem) {
|
||||||
|
Alert::warning(_("Changes not shown in LaTeX output"),
|
||||||
|
_("Changes will not be highlighted in LaTeX output "
|
||||||
|
"when using pdflatex, because xcolor and ulem are not installed.\n"
|
||||||
|
"Please install both packages or redefine "
|
||||||
|
"\\lyxadded and \\lyxdeleted in the LaTeX preamble."));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case LFUN_BUFFER_TOGGLE_COMPRESSION:
|
||||||
|
// turn compression on/off
|
||||||
|
undo().recordUndoBufferParams(CursorData());
|
||||||
|
params().compressed = !params().compressed;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case LFUN_BUFFER_TOGGLE_OUTPUT_SYNC:
|
||||||
|
undo().recordUndoBufferParams(CursorData());
|
||||||
|
params().output_sync = !params().output_sync;
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
dispatched = false;
|
dispatched = false;
|
||||||
break;
|
break;
|
||||||
|
@ -1124,16 +1124,6 @@ bool BufferView::getStatus(FuncRequest const & cmd, FuncStatus & flag)
|
|||||||
|| getInsetByCode<InsetRef>(cur, REF_CODE));
|
|| getInsetByCode<InsetRef>(cur, REF_CODE));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LFUN_CHANGES_TRACK:
|
|
||||||
flag.setEnabled(true);
|
|
||||||
flag.setOnOff(buffer_.params().track_changes);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case LFUN_CHANGES_OUTPUT:
|
|
||||||
flag.setEnabled(true);
|
|
||||||
flag.setOnOff(buffer_.params().output_changes);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case LFUN_CHANGES_MERGE:
|
case LFUN_CHANGES_MERGE:
|
||||||
case LFUN_CHANGE_NEXT:
|
case LFUN_CHANGE_NEXT:
|
||||||
case LFUN_CHANGE_PREVIOUS:
|
case LFUN_CHANGE_PREVIOUS:
|
||||||
@ -1146,16 +1136,6 @@ bool BufferView::getStatus(FuncRequest const & cmd, FuncStatus & flag)
|
|||||||
flag.setEnabled(true);
|
flag.setEnabled(true);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LFUN_BUFFER_TOGGLE_COMPRESSION: {
|
|
||||||
flag.setOnOff(buffer_.params().compressed);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case LFUN_BUFFER_TOGGLE_OUTPUT_SYNC: {
|
|
||||||
flag.setOnOff(buffer_.params().output_sync);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case LFUN_SCREEN_UP:
|
case LFUN_SCREEN_UP:
|
||||||
case LFUN_SCREEN_DOWN:
|
case LFUN_SCREEN_DOWN:
|
||||||
case LFUN_SCROLL:
|
case LFUN_SCROLL:
|
||||||
@ -1458,33 +1438,6 @@ void BufferView::dispatch(FuncRequest const & cmd, DispatchResult & dr)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case LFUN_CHANGES_TRACK:
|
|
||||||
buffer_.params().track_changes = !buffer_.params().track_changes;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case LFUN_CHANGES_OUTPUT:
|
|
||||||
buffer_.params().output_changes = !buffer_.params().output_changes;
|
|
||||||
if (buffer_.params().output_changes) {
|
|
||||||
bool dvipost = LaTeXFeatures::isAvailable("dvipost");
|
|
||||||
bool xcolorulem = LaTeXFeatures::isAvailable("ulem") &&
|
|
||||||
LaTeXFeatures::isAvailable("xcolor");
|
|
||||||
|
|
||||||
if (!dvipost && !xcolorulem) {
|
|
||||||
Alert::warning(_("Changes not shown in LaTeX output"),
|
|
||||||
_("Changes will not be highlighted in LaTeX output, "
|
|
||||||
"because neither dvipost nor xcolor/ulem are installed.\n"
|
|
||||||
"Please install these packages or redefine "
|
|
||||||
"\\lyxadded and \\lyxdeleted in the LaTeX preamble."));
|
|
||||||
} else if (!xcolorulem) {
|
|
||||||
Alert::warning(_("Changes not shown in LaTeX output"),
|
|
||||||
_("Changes will not be highlighted in LaTeX output "
|
|
||||||
"when using pdflatex, because xcolor and ulem are not installed.\n"
|
|
||||||
"Please install both packages or redefine "
|
|
||||||
"\\lyxadded and \\lyxdeleted in the LaTeX preamble."));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case LFUN_CHANGE_NEXT:
|
case LFUN_CHANGE_NEXT:
|
||||||
findNextChange(this);
|
findNextChange(this);
|
||||||
// FIXME: Move this LFUN to Buffer so that we don't have to do this:
|
// FIXME: Move this LFUN to Buffer so that we don't have to do this:
|
||||||
@ -1724,15 +1677,6 @@ void BufferView::dispatch(FuncRequest const & cmd, DispatchResult & dr)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LFUN_BUFFER_TOGGLE_COMPRESSION:
|
|
||||||
// turn compression on/off
|
|
||||||
buffer_.params().compressed = !buffer_.params().compressed;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case LFUN_BUFFER_TOGGLE_OUTPUT_SYNC:
|
|
||||||
buffer_.params().output_sync = !buffer_.params().output_sync;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case LFUN_SCREEN_UP:
|
case LFUN_SCREEN_UP:
|
||||||
case LFUN_SCREEN_DOWN: {
|
case LFUN_SCREEN_DOWN: {
|
||||||
Point p = getPos(cur);
|
Point p = getPos(cur);
|
||||||
|
Loading…
Reference in New Issue
Block a user