mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 10:00:33 +00:00
spellchecker cleanup - fscked knows why pspell is broken, I am TOTALLY
baffled by that one. Various other cleanups, including a fixed version of lyxlex that doesn't destroy the preamble ... git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4854 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
ac51eb8283
commit
7c98b3bd37
@ -236,6 +236,7 @@ BufferView::UpdateCodes operator|(BufferView::UpdateCodes uc1,
|
||||
(static_cast<int>(uc1) | static_cast<int>(uc2));
|
||||
}
|
||||
|
||||
|
||||
bool BufferView::dispatch(kb_action action, string const & argument)
|
||||
{
|
||||
return pimpl_->dispatch(action, argument);
|
||||
|
@ -1,7 +1,8 @@
|
||||
// -*- C++ -*-
|
||||
/** \file
|
||||
* Copyright 2002 the LyX Team
|
||||
* Read the file COPYING
|
||||
/**
|
||||
* \file BufferView.h
|
||||
* Copyright 2002 the LyX Team
|
||||
* Read the file COPYING
|
||||
*
|
||||
* \author Lars Gullik Bjønnes
|
||||
*/
|
||||
|
@ -58,7 +58,7 @@ bool BufferView::insertLyXFile(string const & filen)
|
||||
// Copyright CHT Software Service GmbH
|
||||
// Uwe C. Schroeder
|
||||
//
|
||||
// Insert a Lyxformat - file into current buffer
|
||||
// Insert a LyXformat - file into current buffer
|
||||
//
|
||||
// Moved from lyx_cb.C (Lgb)
|
||||
{
|
||||
|
@ -1571,7 +1571,7 @@ bool BufferView::Pimpl::dispatch(kb_action action, string const & argument)
|
||||
break;
|
||||
|
||||
case LFUN_GOTONOTE:
|
||||
gotoInset(Inset::IGNORE_CODE, false);
|
||||
gotoInset(Inset::NOTE_CODE, false);
|
||||
break;
|
||||
|
||||
case LFUN_REFERENCE_GOTO:
|
||||
@ -2814,12 +2814,16 @@ bool BufferView::Pimpl::dispatch(kb_action action, string const & argument)
|
||||
}
|
||||
break;
|
||||
|
||||
case LFUN_INSET_TABULAR:
|
||||
case LFUN_TABULAR_INSERT:
|
||||
{
|
||||
if (argument.empty()) {
|
||||
owner_->getDialogs()->showTabularCreate();
|
||||
break;
|
||||
}
|
||||
|
||||
int r = 2;
|
||||
int c = 2;
|
||||
if (!argument.empty())
|
||||
::sscanf(argument.c_str(),"%d%d", &r, &c);
|
||||
::sscanf(argument.c_str(),"%d%d", &r, &c);
|
||||
InsetTabular * new_inset =
|
||||
new InsetTabular(*buffer_, r, c);
|
||||
bool const rtl =
|
||||
|
@ -1,3 +1,45 @@
|
||||
2002-08-04 John Levon <levon@movementarian.org>
|
||||
|
||||
* BufferView.h:
|
||||
* BufferView.C: cosmetic change
|
||||
|
||||
* BufferView_pimpl.C: s/IGNORE_CODE/NOTE_CODE/
|
||||
|
||||
* bufferlist.C:
|
||||
* buffer.h:
|
||||
* buffer.C:
|
||||
* lyxcb.h:
|
||||
* lyxcb.C:
|
||||
* lyxserver.C:
|
||||
* lyxvc.C:
|
||||
* vc-backend.C:
|
||||
* BufferView2.C: purge all "Lyx" not "LyX" strings
|
||||
|
||||
* lyxcursor.h:
|
||||
* lyxcursor.C: attempt to add some documentation
|
||||
|
||||
* lyxfunc.C:
|
||||
* commandtags.h:
|
||||
* LyXAction.C:
|
||||
* ToolbarDefaults.C:
|
||||
* BufferView_pimpl.C: remove LFUN_DIALOG_TABULAR_INSERT and
|
||||
merge with LFUN_TABULAR_INSERT
|
||||
|
||||
* Makefile.am:
|
||||
* SpellBase.h:
|
||||
* ispell.h:
|
||||
* ispell.C:
|
||||
* pspell.h:
|
||||
* pspell.C: split up i/pspell implementations into separate
|
||||
files, many cleanups
|
||||
|
||||
* lyxlex.C: unrevert, with a proper fix for prefix.length() == 0
|
||||
|
||||
* text2.C: some cleanup
|
||||
|
||||
* lyxfunc.C: don't check for isp_command == "none" any more, it
|
||||
didn't make any sense
|
||||
|
||||
2002-08-02 John Levon <levon@movementarian.org>
|
||||
|
||||
* buffer.C: s/lyxconvert/lyx2lyx/
|
||||
|
@ -365,12 +365,9 @@ void LyXAction::init()
|
||||
{ LFUN_SHIFT_TAB, "tab-backward", "", Noop },
|
||||
{ LFUN_TAB, "tab-forward", "", Noop },
|
||||
{ LFUN_TABINSERT, "tab-insert", "", Noop },
|
||||
{ LFUN_DIALOG_TABULAR_INSERT, "dialog-tabular-insert",
|
||||
N_("Insert Table"), Noop },
|
||||
{ LFUN_TABULAR_INSERT, "table-insert", N_("Insert Table"), Noop },
|
||||
{ LFUN_TABULAR_FEATURE, "tabular-feature",
|
||||
N_("Tabular Features"), Noop },
|
||||
{ LFUN_INSET_TABULAR, "tabular-insert",
|
||||
N_("Insert a new Tabular Inset"), Noop },
|
||||
#if 0
|
||||
{ LFUN_INSET_THEOREM, "theorem-insert", "", Noop },
|
||||
#endif
|
||||
|
@ -177,10 +177,11 @@ lyx_SOURCES = \
|
||||
paragraph.h \
|
||||
paragraph_pimpl.C \
|
||||
paragraph_pimpl.h \
|
||||
sp_base.h \
|
||||
sp_spell.C \
|
||||
sp_ispell.h \
|
||||
sp_pspell.h \
|
||||
SpellBase.h \
|
||||
ispell.h \
|
||||
ispell.C \
|
||||
pspell.h \
|
||||
pspell.C \
|
||||
tabular.C \
|
||||
tabular.h \
|
||||
tabular-old.C \
|
||||
|
61
src/SpellBase.h
Normal file
61
src/SpellBase.h
Normal file
@ -0,0 +1,61 @@
|
||||
// -*- C++ -*-
|
||||
/**
|
||||
* \file SpellBase.h
|
||||
* Copyright 2002 the LyX Team
|
||||
* Read the file COPYING
|
||||
*
|
||||
* \author unknown
|
||||
*/
|
||||
|
||||
#ifndef SPELL_BASE_H
|
||||
#define SPELL_BASE_H
|
||||
|
||||
#include "LString.h" // can't forward declare...
|
||||
|
||||
class BufferParams;
|
||||
|
||||
/**
|
||||
* Base class of all spell checker implementations.
|
||||
*/
|
||||
class SpellBase {
|
||||
public:
|
||||
|
||||
/// the result from checking a single word
|
||||
enum Result {
|
||||
OK = 1, //< word is correct
|
||||
ROOT, //< root of given word was found
|
||||
COMPOUNDWORD, //< word found through compound formation
|
||||
UNKNOWN, //< word not found
|
||||
MISSED, //< not found, with suggestions
|
||||
IGNORE //< number of other ignored "word"
|
||||
};
|
||||
|
||||
virtual ~SpellBase() {}
|
||||
|
||||
/// return true if the spellchecker instance still exists
|
||||
virtual bool alive() = 0;
|
||||
|
||||
/// clean up on messy exit
|
||||
virtual void cleanUp() = 0;
|
||||
|
||||
/// check the given word and return the result
|
||||
virtual enum Result check(string const &) = 0;
|
||||
|
||||
/// finish this spellchecker instance
|
||||
virtual void close() = 0;
|
||||
|
||||
/// insert the given word into the personal dictionary
|
||||
virtual void insert(string const &) = 0;
|
||||
|
||||
/// accept the given word temporarily
|
||||
virtual void accept(string const &) = 0;
|
||||
|
||||
/// return the next near miss after a MISSED result
|
||||
virtual string const nextMiss() = 0;
|
||||
|
||||
/// give an error message on messy exit
|
||||
virtual string const error() = 0;
|
||||
|
||||
};
|
||||
|
||||
#endif // SPELL_BASE_H
|
@ -91,7 +91,7 @@ void ToolbarDefaults::init()
|
||||
add(SEPARATOR);
|
||||
|
||||
add(LFUN_INSET_GRAPHICS);
|
||||
add(LFUN_DIALOG_TABULAR_INSERT);
|
||||
add(LFUN_TABULAR_INSERT);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1810,7 +1810,7 @@ bool Buffer::save() const
|
||||
}
|
||||
|
||||
if (writeFile(fileName())) {
|
||||
markLyxClean();
|
||||
markClean();
|
||||
removeAutosaveFile(fileName());
|
||||
} else {
|
||||
// Saving failed, so backup is not backup
|
||||
|
16
src/buffer.h
16
src/buffer.h
@ -35,9 +35,6 @@ class LaTeXFeatures;
|
||||
class Language;
|
||||
class ParIterator;
|
||||
|
||||
// When lyx 1.3.x starts we should enable this
|
||||
// btw. we should also test this with 1.2 so that we
|
||||
// do not get any surprises. (Lgb)
|
||||
#define NO_COMPABILITY 1
|
||||
|
||||
///
|
||||
@ -200,15 +197,15 @@ public:
|
||||
Language const * getLanguage() const;
|
||||
///
|
||||
int runChktex();
|
||||
///
|
||||
bool isLyxClean() const;
|
||||
/// return true if the main lyx file does not need saving
|
||||
bool isClean() const;
|
||||
///
|
||||
bool isBakClean() const;
|
||||
///
|
||||
bool isDepClean(string const & name) const;
|
||||
|
||||
///
|
||||
void markLyxClean() const;
|
||||
/// mark the main lyx file as not needing saving
|
||||
void markClean() const;
|
||||
|
||||
///
|
||||
void markBakClean();
|
||||
@ -394,6 +391,7 @@ public:
|
||||
}
|
||||
return tmp;
|
||||
}
|
||||
|
||||
///
|
||||
Inset * operator*() { return *it; }
|
||||
|
||||
@ -463,7 +461,7 @@ Language const * Buffer::getLanguage() const
|
||||
|
||||
|
||||
inline
|
||||
bool Buffer::isLyxClean() const
|
||||
bool Buffer::isClean() const
|
||||
{
|
||||
return lyx_clean;
|
||||
}
|
||||
@ -477,7 +475,7 @@ bool Buffer::isBakClean() const
|
||||
|
||||
|
||||
inline
|
||||
void Buffer::markLyxClean() const
|
||||
void Buffer::markClean() const
|
||||
{
|
||||
if (!lyx_clean) {
|
||||
lyx_clean = true;
|
||||
|
@ -141,7 +141,7 @@ bool BufferList::qwriteAll()
|
||||
BufferStorage::iterator it = bstore.begin();
|
||||
BufferStorage::iterator end = bstore.end();
|
||||
for (; it != end; ++it) {
|
||||
if (!(*it)->isLyxClean()) {
|
||||
if (!(*it)->isClean()) {
|
||||
string fname;
|
||||
if ((*it)->isUnnamed())
|
||||
fname = OnlyFilename((*it)->fileName());
|
||||
@ -181,7 +181,7 @@ bool BufferList::close(Buffer * buf)
|
||||
if (buf->getUser())
|
||||
buf->getUser()->insetUnlock();
|
||||
|
||||
if (buf->paragraph && !buf->isLyxClean() && !quitting) {
|
||||
if (buf->paragraph && !buf->isClean() && !quitting) {
|
||||
if (buf->getUser())
|
||||
buf->getUser()->owner()->prohibitInput();
|
||||
string fname;
|
||||
@ -301,7 +301,7 @@ void BufferList::emergencyWrite(Buffer * buf)
|
||||
|
||||
|
||||
// No need to save if the buffer has not changed.
|
||||
if (buf->isLyxClean())
|
||||
if (buf->isClean())
|
||||
return;
|
||||
|
||||
lyxerr << fmt(_("lyx: Attempting to save document %s as..."),
|
||||
@ -316,7 +316,7 @@ void BufferList::emergencyWrite(Buffer * buf)
|
||||
s += ".emergency";
|
||||
lyxerr << " " << s << endl;
|
||||
if (buf->writeFile(s)) {
|
||||
buf->markLyxClean();
|
||||
buf->markClean();
|
||||
lyxerr << _(" Save seems successful. Phew.") << endl;
|
||||
return;
|
||||
} else {
|
||||
@ -329,7 +329,7 @@ void BufferList::emergencyWrite(Buffer * buf)
|
||||
s += ".emergency";
|
||||
lyxerr << " " << s << endl;
|
||||
if (buf->writeFile(s)) {
|
||||
buf->markLyxClean();
|
||||
buf->markClean();
|
||||
lyxerr << _(" Save seems successful. Phew.") << endl;
|
||||
return;
|
||||
}
|
||||
@ -343,7 +343,7 @@ void BufferList::emergencyWrite(Buffer * buf)
|
||||
s += ".emergency";
|
||||
lyxerr << " " << s << endl;
|
||||
if (buf->writeFile(s)) {
|
||||
buf->markLyxClean();
|
||||
buf->markClean();
|
||||
lyxerr << _(" Save seems successful. Phew.") << endl;
|
||||
return;
|
||||
}
|
||||
|
@ -250,7 +250,7 @@ enum kb_action {
|
||||
LFUN_INSET_GRAPHICS, // Lgb 20000226
|
||||
LFUN_INSET_FOOTNOTE, // Jug 20000307
|
||||
LFUN_PARAGRAPH_SPACING, // Lgb 20000411
|
||||
LFUN_INSET_TABULAR, // Jug 20000412
|
||||
LFUN_TABULAR_INSERT, // Jug 20000412
|
||||
LFUN_LOFVIEW, // 230 // Dekel 20000519
|
||||
LFUN_LOTVIEW, // Dekel 20000519
|
||||
LFUN_LOAVIEW, // Dekel 20000519
|
||||
@ -275,7 +275,6 @@ enum kb_action {
|
||||
LFUN_UPDATE, // Dekel 20000805
|
||||
LFUN_INDEX_INSERT, // Angus 20000803
|
||||
LFUN_SCREEN_FONT_UPDATE, // ARRae 20000813
|
||||
LFUN_DIALOG_TABULAR_INSERT, // 250 // Jug 20000825 (old table-insert)
|
||||
LFUN_GOTO_PARAGRAPH, // Dekel 20000826
|
||||
LFUN_REFERENCE_GOTO, // Dekel 20010114
|
||||
LFUN_BOOKMARK_SAVE, // Dekel 20010127
|
||||
|
@ -1,3 +1,7 @@
|
||||
2002-08-04 John Levon <levon@movementarian.org>
|
||||
|
||||
* LyXView.C: isLyxClean->isClean
|
||||
|
||||
2002-08-02 Edwin Leuven <leuven@fee.uva.nl>
|
||||
|
||||
* Dialogs.[Ch] (updateParagraph): converted back to a signal again.
|
||||
|
@ -184,7 +184,7 @@ void LyXView::updateWindowTitle()
|
||||
string const cur_title = buffer()->fileName();
|
||||
if (!cur_title.empty()) {
|
||||
title += ": " + MakeDisplayPath(cur_title, 30);
|
||||
if (!buffer()->isLyxClean())
|
||||
if (!buffer()->isClean())
|
||||
title += _(" (changed)");
|
||||
if (buffer()->isReadonly())
|
||||
title += _(" (read only)");
|
||||
|
@ -1,3 +1,10 @@
|
||||
2002-08-04 John Levon <levon@movementarian.org>
|
||||
|
||||
* ControlSpellchecker.h:
|
||||
* ControlSpellchecker.C: some cleanups
|
||||
|
||||
* ControlTabularCreate.C: s/LFUN_INSET_TABULAR/LFUN_TABULAR_INSERT/
|
||||
|
||||
2002-08-02 Edwin Leuven <leuven@fee.uva.nl>
|
||||
|
||||
* ControlParagraph.[Ch] (changedParagraph): new method invoked when
|
||||
|
@ -1,13 +1,8 @@
|
||||
/* This file is part of
|
||||
* ======================================================
|
||||
*
|
||||
* LyX, The Document Processor
|
||||
*
|
||||
* Copyright 2001 The LyX Team.
|
||||
*
|
||||
* ======================================================
|
||||
*
|
||||
/**
|
||||
* \file ControlSpellchecker.C
|
||||
* Copyright 2001 the LyX Team
|
||||
* Read the file COPYING
|
||||
*
|
||||
* \author Edwin Leuven <leuven@fee.uva.nl>
|
||||
*/
|
||||
|
||||
@ -33,28 +28,15 @@
|
||||
|
||||
#include "support/lstrings.h"
|
||||
|
||||
# include "sp_ispell.h"
|
||||
#include "ispell.h"
|
||||
#ifdef USE_PSPELL
|
||||
# include "sp_pspell.h"
|
||||
#endif
|
||||
|
||||
#include <sys/types.h> // needed by <sys/select.h> at least on freebsd
|
||||
|
||||
#ifdef HAVE_SYS_SELECT_H
|
||||
# ifdef HAVE_STRINGS_H
|
||||
// <strings.h> is needed at least on AIX because FD_ZERO uses bzero().
|
||||
// BUT we cannot include both string.h and strings.h on Irix 6.5 :(
|
||||
# ifdef _AIX
|
||||
# include <strings.h>
|
||||
# endif
|
||||
# endif
|
||||
#include <sys/select.h>
|
||||
# include "pspell.h"
|
||||
#endif
|
||||
|
||||
ControlSpellchecker::ControlSpellchecker(LyXView & lv, Dialogs & d)
|
||||
: ControlDialogBD(lv, d),
|
||||
rtl_(false), newval_(0.0), oldval_(0), newvalue_(0), count_(0),
|
||||
stop_(false), result_(SpellBase::ISP_OK), speller_(0)
|
||||
stop_(false), speller_(0)
|
||||
{}
|
||||
|
||||
|
||||
@ -87,12 +69,7 @@ void ControlSpellchecker::setParams()
|
||||
rtl_ = lv_.buffer()->params.language->RightToLeft();
|
||||
}
|
||||
|
||||
if (speller_->error() != 0) {
|
||||
#if 0
|
||||
message_ = speller_->error();
|
||||
// show error message
|
||||
view().partialUpdate(2);
|
||||
#endif
|
||||
if (!speller_->error().empty()) {
|
||||
clearParams();
|
||||
return;
|
||||
}
|
||||
@ -102,7 +79,7 @@ void ControlSpellchecker::setParams()
|
||||
|
||||
void ControlSpellchecker::check()
|
||||
{
|
||||
result_ = SpellBase::ISP_OK;
|
||||
SpellBase::Result res = SpellBase::OK;
|
||||
stop_ = false;
|
||||
|
||||
// clear any old selection
|
||||
@ -110,8 +87,7 @@ void ControlSpellchecker::check()
|
||||
lv_.view()->toggleSelection(true);
|
||||
lv_.view()->update(text, BufferView::SELECT);
|
||||
|
||||
while ((result_==SpellBase::ISP_OK || result_==SpellBase::ISP_IGNORE) &&
|
||||
!stop_) {
|
||||
while ((res == SpellBase::OK || res == SpellBase::IGNORE) && !stop_) {
|
||||
word_ = lv_.view()->nextWord(newval_);
|
||||
|
||||
if (word_.empty()) {
|
||||
@ -131,14 +107,14 @@ void ControlSpellchecker::check()
|
||||
|
||||
if (!speller_->alive()) clearParams();
|
||||
|
||||
result_ = speller_->check(word_);
|
||||
res = speller_->check(word_);
|
||||
}
|
||||
|
||||
if (!stop_ && !word_.empty())
|
||||
lv_.view()->selectLastWord();
|
||||
|
||||
// set suggestions
|
||||
if (result_!=SpellBase::ISP_OK && result_!=SpellBase::ISP_IGNORE) {
|
||||
if (res != SpellBase::OK && res != SpellBase::IGNORE) {
|
||||
view().partialUpdate(1);
|
||||
}
|
||||
}
|
||||
@ -167,24 +143,20 @@ void ControlSpellchecker::insert()
|
||||
|
||||
string ControlSpellchecker::getSuggestion()
|
||||
{
|
||||
// this is needed because string tmp = nextmiss()
|
||||
// segfaults when nextMiss is 0
|
||||
string tmp;
|
||||
char const * w = speller_->nextMiss();
|
||||
string miss(speller_->nextMiss());
|
||||
|
||||
if (w!=0) {
|
||||
tmp = w;
|
||||
if (rtl_) std::reverse(tmp.begin(), tmp.end());
|
||||
}
|
||||
if (rtl_)
|
||||
std::reverse(miss.begin(), miss.end());
|
||||
|
||||
return tmp;
|
||||
return miss;
|
||||
}
|
||||
|
||||
|
||||
string ControlSpellchecker::getWord()
|
||||
{
|
||||
string tmp = word_;
|
||||
if (rtl_) std::reverse(tmp.begin(), tmp.end());
|
||||
if (rtl_)
|
||||
std::reverse(tmp.begin(), tmp.end());
|
||||
return tmp;
|
||||
}
|
||||
|
||||
@ -247,6 +219,5 @@ void ControlSpellchecker::clearParams()
|
||||
count_ = 0;
|
||||
message_.erase();
|
||||
stop_ = false;
|
||||
result_ = SpellBase::ISP_OK;
|
||||
speller_ = 0;
|
||||
}
|
||||
|
@ -20,8 +20,9 @@
|
||||
#endif
|
||||
|
||||
#include "ControlDialog_impl.h"
|
||||
#include "sp_base.h"
|
||||
|
||||
class SpellBase;
|
||||
|
||||
/** A controller for Spellchecker dialogs.
|
||||
*/
|
||||
class ControlSpellchecker : public ControlDialogBD {
|
||||
@ -93,9 +94,6 @@ private:
|
||||
/// set to true to stop checking
|
||||
bool stop_;
|
||||
|
||||
/// spellchecker status
|
||||
enum SpellBase::spellStatus result_;
|
||||
|
||||
/// The actual spellchecker object
|
||||
SpellBase * speller_;
|
||||
|
||||
|
@ -53,5 +53,5 @@ void ControlTabularCreate::apply()
|
||||
|
||||
string const val(tostr(params().first) + " " + tostr(params().second));
|
||||
|
||||
lv_.getLyXFunc()->dispatch(LFUN_INSET_TABULAR, val);
|
||||
lv_.getLyXFunc()->dispatch(LFUN_TABULAR_INSERT, val);
|
||||
}
|
||||
|
@ -60,6 +60,7 @@ void FormBase::redraw()
|
||||
|
||||
void FormBase::show()
|
||||
{
|
||||
lyxerr << "show" << endl;
|
||||
if (!form()) {
|
||||
build();
|
||||
}
|
||||
|
@ -23,7 +23,8 @@ typedef FormCB<ControlSpellchecker, FormDB<FD_spellchecker> > base_class;
|
||||
|
||||
FormSpellchecker::FormSpellchecker(ControlSpellchecker & c, Dialogs & d)
|
||||
: base_class(c, d, _("LyX: Spellchecker"), false)
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void FormSpellchecker::build()
|
||||
@ -129,9 +130,8 @@ void FormSpellchecker::partialUpdate(int id)
|
||||
case 2:
|
||||
// show exit message
|
||||
fl_show_messages(controller().getMessage().c_str());
|
||||
hide();
|
||||
//hide();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -208,7 +208,7 @@ void XFormsView::show_view_state()
|
||||
// placed in BufferView. If "all BufferViews" then LyXGUI (I think) should
|
||||
// run "prohibitInput" on all LyXViews which will run prohibitInput on all
|
||||
// BufferViews. Or is it perhaps just the (input in) BufferViews in the
|
||||
// current LyxView that should be prohibited (Lgb) (This applies to
|
||||
// current LyXView that should be prohibited (Lgb) (This applies to
|
||||
// "allowInput" as well.)
|
||||
void XFormsView::prohibitInput() const
|
||||
{
|
||||
|
@ -1,3 +1,8 @@
|
||||
2002-08-04 John Levon <levon@movementarian.org>
|
||||
|
||||
* inset.h:
|
||||
* insetnote.h: s/IGNORE_CODE/NOTE_CODE/
|
||||
|
||||
2002-08-02 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* insetcommandparams.[Ch] (preview): new methods returning and setting
|
||||
|
@ -66,7 +66,7 @@ public:
|
||||
///
|
||||
LABEL_CODE, // 10
|
||||
///
|
||||
IGNORE_CODE,
|
||||
NOTE_CODE,
|
||||
///
|
||||
ACCENT_CODE,
|
||||
///
|
||||
|
@ -34,7 +34,7 @@ public:
|
||||
///
|
||||
string const editMessage() const;
|
||||
///
|
||||
Inset::Code lyxCode() const { return Inset::IGNORE_CODE; }
|
||||
Inset::Code lyxCode() const { return Inset::NOTE_CODE; }
|
||||
///
|
||||
void write(Buffer const *, std::ostream &) const;
|
||||
///
|
||||
|
@ -1,14 +1,10 @@
|
||||
/* This file is part of
|
||||
* ======================================================
|
||||
/**
|
||||
* \file ispell.C
|
||||
* Copyright 2002 the LyX Team
|
||||
* Read the file COPYING
|
||||
*
|
||||
* LyX, The Document Processor
|
||||
*
|
||||
* Copyright 2001 The LyX Team.
|
||||
*
|
||||
* ======================================================
|
||||
*
|
||||
* \file sp_pspell.C
|
||||
* \author Kevin Atkinson
|
||||
* \author unknown
|
||||
* \author John Levon <levon@movementarian.org>
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
@ -23,6 +19,7 @@
|
||||
#include <fcntl.h>
|
||||
#include <cstdio>
|
||||
|
||||
// FIXME: do we need any of this horrible gook ?
|
||||
#if TIME_WITH_SYS_TIME
|
||||
# include <sys/time.h>
|
||||
# include <ctime>
|
||||
@ -51,7 +48,7 @@
|
||||
#include "language.h"
|
||||
#include "debug.h"
|
||||
#include "encoding.h"
|
||||
#include "sp_ispell.h"
|
||||
#include "ispell.h"
|
||||
|
||||
#ifndef CXX_GLOBAL_CSTD
|
||||
using std::strcpy;
|
||||
@ -67,169 +64,9 @@ namespace {
|
||||
pid_t isp_pid = -1;
|
||||
}
|
||||
|
||||
///
|
||||
// ------------------- start special pspell code/class --------------------
|
||||
///
|
||||
#ifdef USE_PSPELL
|
||||
|
||||
#include "support/LAssert.h"
|
||||
|
||||
#define USE_ORIGINAL_MANAGER_FUNCS 1
|
||||
# include <pspell/pspell.h>
|
||||
|
||||
#include "sp_pspell.h"
|
||||
|
||||
|
||||
PSpell::PSpell()
|
||||
: sc(0), els(0), spell_error_object(0), flag(ISP_UNKNOWN),
|
||||
alive_(false)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
PSpell::PSpell(BufferParams const & params, string const & lang)
|
||||
: sc(0), els(0), spell_error_object(0), flag(ISP_UNKNOWN),
|
||||
alive_(false)
|
||||
{
|
||||
initialize(params, lang);
|
||||
}
|
||||
|
||||
|
||||
PSpell::~PSpell()
|
||||
{
|
||||
cleanUp();
|
||||
close();
|
||||
if (els)
|
||||
delete_pspell_string_emulation(els);
|
||||
}
|
||||
|
||||
|
||||
void PSpell::initialize(BufferParams const &, string const & lang)
|
||||
{
|
||||
PspellConfig * config = new_pspell_config();
|
||||
config->replace("language-tag", lang.c_str());
|
||||
spell_error_object = new_pspell_manager(config);
|
||||
if (pspell_error_number(spell_error_object) != 0) {
|
||||
error_ = pspell_error_message(spell_error_object);
|
||||
} else {
|
||||
error_ = 0;
|
||||
sc = to_pspell_manager(spell_error_object);
|
||||
spell_error_object = 0;
|
||||
alive_ = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void PSpell::cleanUp()
|
||||
{
|
||||
if (spell_error_object) {
|
||||
delete_pspell_can_have_error(spell_error_object);
|
||||
spell_error_object = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
enum PSpell::spellStatus PSpell::check(string const & word)
|
||||
{
|
||||
if (!sc)
|
||||
return flag;
|
||||
|
||||
int word_ok = pspell_manager_check(sc, word.c_str());
|
||||
lyx::Assert(word_ok != -1);
|
||||
|
||||
if (word_ok) {
|
||||
flag = ISP_OK;
|
||||
} else {
|
||||
PspellWordList const * sugs =
|
||||
pspell_manager_suggest(sc, word.c_str());
|
||||
lyx::Assert(sugs != 0);
|
||||
els = pspell_word_list_elements(sugs);
|
||||
if (pspell_word_list_empty(sugs))
|
||||
flag = ISP_UNKNOWN;
|
||||
else
|
||||
flag = ISP_MISSED;
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
|
||||
void PSpell::close()
|
||||
{
|
||||
if (sc)
|
||||
pspell_manager_save_all_word_lists(sc);
|
||||
}
|
||||
|
||||
|
||||
void PSpell::insert(string const & word)
|
||||
{
|
||||
if (sc)
|
||||
pspell_manager_add_to_personal(sc, word.c_str());
|
||||
}
|
||||
|
||||
|
||||
void PSpell::accept(string const & word)
|
||||
{
|
||||
if (sc)
|
||||
pspell_manager_add_to_session(sc, word.c_str());
|
||||
}
|
||||
|
||||
|
||||
void PSpell::store(string const & mis, string const & cor)
|
||||
{
|
||||
if (sc)
|
||||
pspell_manager_store_replacement(sc, mis.c_str(), cor.c_str());
|
||||
}
|
||||
|
||||
|
||||
char const * PSpell::nextMiss()
|
||||
{
|
||||
if (els)
|
||||
return pspell_string_emulation_next(els);
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
char const * PSpell::error()
|
||||
{
|
||||
return error_;
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
///
|
||||
// ------------------- start special ispell code/class --------------------
|
||||
///
|
||||
|
||||
ISpell::ISpell()
|
||||
: str(0), flag(ISP_UNKNOWN)
|
||||
{}
|
||||
|
||||
|
||||
ISpell::ISpell(BufferParams const & params, string const & lang)
|
||||
: str(0), flag(ISP_UNKNOWN)
|
||||
{
|
||||
initialize(params, lang);
|
||||
}
|
||||
|
||||
|
||||
ISpell::~ISpell()
|
||||
{
|
||||
delete[] str;
|
||||
}
|
||||
|
||||
|
||||
char const * ISpell::nextMiss()
|
||||
{
|
||||
if (str == 0 || *(e+1) == '\0') return 0;
|
||||
b = e + 2;
|
||||
e = strpbrk(b, ",\n");
|
||||
*e = '\0';
|
||||
return b;
|
||||
}
|
||||
|
||||
|
||||
void ISpell::initialize(BufferParams const & params, string const & lang)
|
||||
: str(0)
|
||||
{
|
||||
static char o_buf[BUFSIZ]; // jc: it could be smaller
|
||||
int pipein[2];
|
||||
@ -363,6 +200,9 @@ void ISpell::initialize(BufferParams const & params, string const & lang)
|
||||
// Hmm...what are we using this id msg for? Nothing? (Lgb)
|
||||
// Actually I used it to tell if it's truly Ispell or if it's
|
||||
// aspell -- (kevinatk@home.com)
|
||||
// But no code actually used the results for anything useful
|
||||
// so I removed it again. Perhaps we can remove this code too.
|
||||
// - jbl
|
||||
char buf[2048];
|
||||
fd_set infds;
|
||||
struct timeval tv;
|
||||
@ -386,15 +226,8 @@ void ISpell::initialize(BufferParams const & params, string const & lang)
|
||||
// there is only one fd in infds.
|
||||
fgets(buf, 2048, in);
|
||||
|
||||
// determine if the spell checker is really Aspell
|
||||
if (strstr(buf, "Aspell"))
|
||||
actual_spell_checker = ASC_ASPELL;
|
||||
else
|
||||
actual_spell_checker = ASC_ISPELL;
|
||||
|
||||
fputs("!\n", out); // Set terse mode (silently accept correct words)
|
||||
|
||||
|
||||
} else if (retval == 0) {
|
||||
// timeout. Give nice message to user.
|
||||
lyxerr << "Ispell read timed out, what now?" << endl;
|
||||
@ -426,6 +259,12 @@ void ISpell::initialize(BufferParams const & params, string const & lang)
|
||||
}
|
||||
|
||||
|
||||
ISpell::~ISpell()
|
||||
{
|
||||
delete[] str;
|
||||
}
|
||||
|
||||
|
||||
/* FIXME: this is a minimalist solution until the above
|
||||
* code is able to work with forkedcall.h. We only need
|
||||
* to reap the zombies here.
|
||||
@ -439,6 +278,19 @@ void reapSpellchecker(void)
|
||||
}
|
||||
|
||||
|
||||
string const ISpell::nextMiss()
|
||||
{
|
||||
if (str == 0 || *(e+1) == '\0')
|
||||
return "";
|
||||
char * b = e + 2;
|
||||
e = strpbrk(b, ",\n");
|
||||
*e = '\0';
|
||||
if (b)
|
||||
return b;
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
bool ISpell::alive()
|
||||
{
|
||||
return isp_pid != -1;
|
||||
@ -451,10 +303,12 @@ void ISpell::cleanUp()
|
||||
}
|
||||
|
||||
|
||||
enum ISpell::spellStatus ISpell::check(string const & word)
|
||||
enum ISpell::Result ISpell::check(string const & word)
|
||||
{
|
||||
//Please rewrite to use string.
|
||||
// FIXME Please rewrite to use string.
|
||||
|
||||
Result res;
|
||||
|
||||
::fputs(word.c_str(), out);
|
||||
::fputc('\n', out);
|
||||
|
||||
@ -463,43 +317,46 @@ enum ISpell::spellStatus ISpell::check(string const & word)
|
||||
|
||||
// I think we have to check if ispell is still alive here because
|
||||
// the signal-handler could have disabled blocking on the fd
|
||||
if (!alive()) return ISP_UNKNOWN;
|
||||
if (!alive())
|
||||
return UNKNOWN;
|
||||
|
||||
switch (*buf) {
|
||||
case '*': // Word found
|
||||
flag = ISP_OK;
|
||||
case '*':
|
||||
res = OK;
|
||||
break;
|
||||
case '+': // Word found through affix removal
|
||||
flag = ISP_ROOT;
|
||||
case '+':
|
||||
res = ROOT;
|
||||
break;
|
||||
case '-': // Word found through compound formation
|
||||
flag = ISP_COMPOUNDWORD;
|
||||
case '-':
|
||||
res = COMPOUNDWORD;
|
||||
break;
|
||||
case '\n': // Number or when in terse mode: no problems
|
||||
flag = ISP_IGNORE;
|
||||
case '\n':
|
||||
res = IGNORE;
|
||||
break;
|
||||
case '#': // Not found, no near misses and guesses
|
||||
flag = ISP_UNKNOWN;
|
||||
res = UNKNOWN;
|
||||
break;
|
||||
case '?': // Not found, and no near misses, but guesses (guesses are ignored)
|
||||
case '&': // Not found, but we have near misses
|
||||
{
|
||||
flag = ISP_MISSED;
|
||||
res = MISSED;
|
||||
char * p = strpbrk(buf, ":");
|
||||
str = new char[strlen(p) + 1];
|
||||
e = str;
|
||||
strcpy(str, p);
|
||||
break;
|
||||
}
|
||||
default: // This shouldn't happend, but you know Murphy
|
||||
flag = ISP_UNKNOWN;
|
||||
default: // This shouldn't happen, but you know Murphy
|
||||
res = UNKNOWN;
|
||||
}
|
||||
|
||||
*buf = 0;
|
||||
if (flag!= ISP_IGNORE) {
|
||||
while (*buf!= '\n') fgets(buf, 255, in); /* wait for ispell to finish */
|
||||
if (res != IGNORE) {
|
||||
/* wait for ispell to finish */
|
||||
while (*buf!= '\n')
|
||||
fgets(buf, 255, in);
|
||||
}
|
||||
return flag;
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
@ -533,19 +390,9 @@ void ISpell::accept(string const & word)
|
||||
}
|
||||
|
||||
|
||||
void ISpell::store(string const & mis, string const & cor)
|
||||
string const ISpell::error()
|
||||
{
|
||||
if (actual_spell_checker == ASC_ASPELL) {
|
||||
::fputs("$$ra ", out);
|
||||
::fputs(mis.c_str(), out);
|
||||
::fputc(',', out);
|
||||
::fputs(cor.c_str(), out);
|
||||
::fputc('\n', out);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
char const * ISpell::error()
|
||||
{
|
||||
return error_;
|
||||
if (error_)
|
||||
return error_;
|
||||
return "";
|
||||
}
|
68
src/ispell.h
Normal file
68
src/ispell.h
Normal file
@ -0,0 +1,68 @@
|
||||
// -*- C++ -*-
|
||||
/**
|
||||
* \file sp_ispell.h
|
||||
* Copyright 2002 the LyX Team
|
||||
* Read the file COPYING
|
||||
*
|
||||
* \author unknown
|
||||
*/
|
||||
|
||||
#ifndef SP_ISPELL_H
|
||||
#define SP_ISPELL_H
|
||||
|
||||
#include <cstdio>
|
||||
|
||||
#include "SpellBase.h"
|
||||
|
||||
class BufferParams;
|
||||
|
||||
/// i/a spell process-based spellchecker
|
||||
class ISpell : public SpellBase {
|
||||
public:
|
||||
ISpell(BufferParams const & params, string const & lang);
|
||||
|
||||
~ISpell();
|
||||
|
||||
/// return true if the spellchecker instance still exists
|
||||
virtual bool alive();
|
||||
|
||||
/// clean up on messy exit
|
||||
virtual void cleanUp();
|
||||
|
||||
/// check the given word and return the result
|
||||
virtual enum Result check(string const & word);
|
||||
|
||||
/// finish this spellchecker instance
|
||||
virtual void close();
|
||||
|
||||
/// insert the given word into the personal dictionary
|
||||
virtual void insert(string const & word);
|
||||
|
||||
/// accept the given word temporarily
|
||||
virtual void accept(string const & word);
|
||||
|
||||
/// return the next near miss after a MISSED result
|
||||
virtual string const nextMiss();
|
||||
|
||||
/// give an error message on messy exit
|
||||
virtual string const error();
|
||||
|
||||
private:
|
||||
/// instream to communicate with ispell
|
||||
FILE * in;
|
||||
/// outstream to communicate with ispell
|
||||
FILE * out;
|
||||
/// spell error
|
||||
char const * error_;
|
||||
/// the fd of the outgoing pipe
|
||||
int isp_fd;
|
||||
|
||||
// vileness below ... please FIXME
|
||||
/// str ???
|
||||
char * str;
|
||||
/// e ???
|
||||
char * e;
|
||||
|
||||
};
|
||||
|
||||
#endif // ISPELL_H
|
@ -317,7 +317,7 @@ void AutoSave(BufferView * bv)
|
||||
// create new file with template
|
||||
// SERVERCMD !
|
||||
//
|
||||
Buffer * NewLyxFile(string const & filename)
|
||||
Buffer * NewFile(string const & filename)
|
||||
{
|
||||
// Split argument by :
|
||||
string name;
|
||||
|
@ -27,7 +27,7 @@ void QuitLyX();
|
||||
///
|
||||
void AutoSave(BufferView * bv);
|
||||
///
|
||||
Buffer * NewLyxFile(string const & filename);
|
||||
Buffer * NewFile(string const & filename);
|
||||
///
|
||||
void InsertAsciiFile(BufferView * bv, string const & f, bool asParagraph);
|
||||
///
|
||||
|
@ -1,12 +1,10 @@
|
||||
/* This file is part of
|
||||
* ======================================================
|
||||
/**
|
||||
* \file lyxcursor.C
|
||||
* Copyright 1995-2001 the LyX Team
|
||||
* Read the file COPYING
|
||||
*
|
||||
* LyX, The Document Processor
|
||||
*
|
||||
* Copyright 1995 Matthias Ettrich
|
||||
* Copyright 1995-2001 The LyX Team.
|
||||
*
|
||||
* ====================================================== */
|
||||
* \author Matthias Ettrich
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
|
121
src/lyxcursor.h
121
src/lyxcursor.h
@ -1,13 +1,11 @@
|
||||
// -*- C++ -*-
|
||||
/* This file is part of
|
||||
* ======================================================
|
||||
/**
|
||||
* \file lyxcursor.h
|
||||
* Copyright 1995-2001 the LyX Team
|
||||
* Read the file COPYING
|
||||
*
|
||||
* LyX, The Document Processor
|
||||
*
|
||||
* Copyright 1995 Matthias Ettrich
|
||||
* Copyright 1995-2001 The LyX Team.
|
||||
*
|
||||
* ====================================================== */
|
||||
* \author Matthias Ettrich
|
||||
*/
|
||||
|
||||
#ifndef LYXCURSOR_H
|
||||
#define LYXCURSOR_H
|
||||
@ -21,79 +19,109 @@
|
||||
class Paragraph;
|
||||
class Row;
|
||||
|
||||
/** All these variables should be explained. Matthias?
|
||||
/**
|
||||
* The cursor class describes the position of a cursor within a document.
|
||||
* Several cursors exist within LyX; for example, when locking an inset,
|
||||
* the position of the cursor in the containing inset is stored.
|
||||
*
|
||||
* FIXME: true ?
|
||||
*/
|
||||
class LyXCursor {
|
||||
public:
|
||||
///
|
||||
LyXCursor();
|
||||
///
|
||||
/// set the paragraph that contains this cursor
|
||||
void par(Paragraph * p);
|
||||
///
|
||||
/// return the paragraph this cursor is in
|
||||
Paragraph * par() const;
|
||||
///
|
||||
/// set the position within the paragraph
|
||||
void pos(lyx::pos_type p);
|
||||
///
|
||||
/// return the position within the paragraph
|
||||
lyx::pos_type pos() const;
|
||||
///
|
||||
/// FIXME
|
||||
void boundary(bool b);
|
||||
///
|
||||
/// FIXME
|
||||
bool boundary() const;
|
||||
///
|
||||
/// set the x position in pixels
|
||||
void x(int i);
|
||||
///
|
||||
/// return the x position in pixels
|
||||
int x() const;
|
||||
///
|
||||
/// set the stored next-line position when at the end of a row
|
||||
void ix(int i);
|
||||
///
|
||||
/**
|
||||
* Return the x position of the start of the next row, when this
|
||||
* cursor is at the end of the previous row, for insets that take
|
||||
* a full row.
|
||||
*
|
||||
* FIXME: explain why we need this ?
|
||||
*/
|
||||
int ix() const;
|
||||
///
|
||||
/// set the cached x position
|
||||
void x_fix(int i);
|
||||
///
|
||||
/**
|
||||
* Return the cached x position of the cursor. This is used for when
|
||||
* we have text like :
|
||||
*
|
||||
* blah blah blah blah| blah blah blah
|
||||
* blah blah blah
|
||||
* blah blah blah blah blah blah
|
||||
*
|
||||
* When we move onto row 3, we would like to be vertically aligned
|
||||
* with where we were in row 1, despite the fact that row 2 is
|
||||
* shorter than x()
|
||||
*/
|
||||
int x_fix() const;
|
||||
///
|
||||
/// set the y position in pixels
|
||||
void y(int i);
|
||||
///
|
||||
/// return the y position in pixels
|
||||
int y() const;
|
||||
///
|
||||
/// set the stored next-line y position when at the end of a row
|
||||
void iy(int i);
|
||||
///
|
||||
/**
|
||||
* Return the y position of the start of the next row, when this
|
||||
* cursor is at the end of the previous row, for insets that take
|
||||
* a full row.
|
||||
*
|
||||
* FIXME: explain why we need this ? especially for y...
|
||||
*/
|
||||
int iy() const;
|
||||
///
|
||||
/// set the row of the paragraph the cursor is in
|
||||
void row(Row * r);
|
||||
///
|
||||
/// return the row of the paragraph this cursor is in
|
||||
Row * row() const;
|
||||
///
|
||||
/// set the stored next row
|
||||
void irow(Row * r);
|
||||
///
|
||||
/**
|
||||
* Return the next row, when this
|
||||
* cursor is at the end of the previous row, for insets that take
|
||||
* a full row.
|
||||
*
|
||||
* FIXME: explain why we need this ? especially for y...
|
||||
*/
|
||||
Row * irow() const;
|
||||
private:
|
||||
/// The paragraph the cursor is in.
|
||||
Paragraph * par_;
|
||||
/// The position inside the paragraph
|
||||
lyx::pos_type pos_;
|
||||
///
|
||||
/// FIXME
|
||||
bool boundary_;
|
||||
///
|
||||
/// the pixel x position
|
||||
int x_;
|
||||
/// the x position of the position before the inset when we put
|
||||
/// the cursor on the end of the row before, otherwise equal to x.
|
||||
/// the stored next-row x position
|
||||
int ix_;
|
||||
///
|
||||
/// the cached x position
|
||||
int x_fix_;
|
||||
///
|
||||
/// the pixel y position
|
||||
int y_;
|
||||
/// the y position of the position before the inset when we put
|
||||
/// the cursor on the end of the row before, otherwise equal to y.
|
||||
/// the stored next-row y position
|
||||
int iy_;
|
||||
///
|
||||
/// the containing row
|
||||
Row * row_;
|
||||
/// the row of the position before the inset when we put
|
||||
/// the cursor on the end of the row before, otherwise equal to row.
|
||||
/// the containing row for the next line
|
||||
Row * irow_;
|
||||
};
|
||||
|
||||
///
|
||||
/// these three dictate the others
|
||||
inline
|
||||
bool operator==(LyXCursor const & a, LyXCursor const & b)
|
||||
{
|
||||
@ -102,29 +130,25 @@ bool operator==(LyXCursor const & a, LyXCursor const & b)
|
||||
&& a.boundary() == b.boundary();
|
||||
}
|
||||
|
||||
///
|
||||
inline
|
||||
bool operator!=(LyXCursor const & a, LyXCursor const & b)
|
||||
{
|
||||
return !(a == b);
|
||||
}
|
||||
|
||||
///
|
||||
/// only compares y() and pos(). Can this be done in another way?
|
||||
inline
|
||||
bool operator<(LyXCursor const & a, LyXCursor const & b)
|
||||
{
|
||||
// Can this be done in a nother way?
|
||||
return (a.y() < b.y() && a.pos() < b.pos());
|
||||
}
|
||||
|
||||
///
|
||||
inline
|
||||
bool operator>(LyXCursor const & a, LyXCursor const & b)
|
||||
{
|
||||
return b < a;
|
||||
}
|
||||
|
||||
///
|
||||
inline
|
||||
bool operator>=(LyXCursor const & a, LyXCursor const & b)
|
||||
{
|
||||
@ -132,11 +156,10 @@ bool operator>=(LyXCursor const & a, LyXCursor const & b)
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
inline
|
||||
bool operator<=(LyXCursor const & a, LyXCursor const & b)
|
||||
{
|
||||
return !(a > b);
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif // LYXCURSOR_H
|
||||
|
@ -345,9 +345,6 @@ FuncStatus LyXFunc::getStatus(kb_action action,
|
||||
case LFUN_REDO:
|
||||
disable = buf->redostack.empty();
|
||||
break;
|
||||
case LFUN_SPELLCHECK:
|
||||
disable = lyxrc.isp_command == "none";
|
||||
break;
|
||||
#ifndef HAVE_LIBAIKSAURUS
|
||||
case LFUN_THESAURUS_ENTRY:
|
||||
disable = true;
|
||||
@ -514,8 +511,7 @@ FuncStatus LyXFunc::getStatus(kb_action action,
|
||||
case LFUN_INSET_FOOTNOTE:
|
||||
code = Inset::FOOT_CODE;
|
||||
break;
|
||||
case LFUN_DIALOG_TABULAR_INSERT:
|
||||
case LFUN_INSET_TABULAR:
|
||||
case LFUN_TABULAR_INSERT:
|
||||
code = Inset::TABULAR_CODE;
|
||||
break;
|
||||
case LFUN_INSET_EXTERNAL:
|
||||
@ -546,7 +542,7 @@ FuncStatus LyXFunc::getStatus(kb_action action,
|
||||
code = Inset::CAPTION_CODE;
|
||||
break;
|
||||
case LFUN_INSERT_NOTE:
|
||||
code = Inset::IGNORE_CODE;
|
||||
code = Inset::NOTE_CODE;
|
||||
break;
|
||||
case LFUN_INSERT_LABEL:
|
||||
code = Inset::LABEL_CODE;
|
||||
@ -1052,10 +1048,6 @@ void LyXFunc::dispatch(kb_action action, string argument, bool verbose)
|
||||
break;
|
||||
}
|
||||
|
||||
case LFUN_DIALOG_TABULAR_INSERT:
|
||||
owner->getDialogs()->showTabularCreate();
|
||||
break;
|
||||
|
||||
case LFUN_AUTOSAVE:
|
||||
AutoSave(owner->view().get());
|
||||
break;
|
||||
@ -1195,7 +1187,7 @@ void LyXFunc::dispatch(kb_action action, string argument, bool verbose)
|
||||
case LFUN_FILE_NEW:
|
||||
{
|
||||
// servercmd: argument must be <file>:<template>
|
||||
Buffer * tmpbuf = NewLyxFile(argument);
|
||||
Buffer * tmpbuf = NewFile(argument);
|
||||
if (tmpbuf)
|
||||
owner->view()->buffer(tmpbuf);
|
||||
}
|
||||
@ -1249,8 +1241,7 @@ void LyXFunc::dispatch(kb_action action, string argument, bool verbose)
|
||||
break; // RVDK_PATCH_5
|
||||
|
||||
case LFUN_SPELLCHECK:
|
||||
if (lyxrc.isp_command != "none")
|
||||
owner->getDialogs()->showSpellchecker();
|
||||
owner->getDialogs()->showSpellchecker();
|
||||
break;
|
||||
|
||||
// --- lyxserver commands ----------------------------
|
||||
|
60
src/lyxlex.C
60
src/lyxlex.C
@ -1,15 +1,14 @@
|
||||
/* This file is part of
|
||||
* ======================================================
|
||||
/**
|
||||
* \file lyxlex.C
|
||||
* Copyright 1996-2002 the LyX Team
|
||||
* Read the file COPYING
|
||||
*
|
||||
* LyX, The Document Processor
|
||||
* Generalized simple lexical analyzer.
|
||||
* It can be used for simple syntax parsers, like lyxrc,
|
||||
* texclass and others to come.
|
||||
*
|
||||
* Copyright 1996-2001 The LyX Team.
|
||||
*
|
||||
* Generalized simple lexical analizer.
|
||||
* It can be used for simple syntax parsers, like lyxrc,
|
||||
* texclass and others to come. [asierra30/03/96]
|
||||
*
|
||||
* ====================================================== */
|
||||
* \author Alejandro Aguilar Sierra <asierra@servidor.unam.mx>
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
@ -168,29 +167,28 @@ string const LyXLex::getLongString(string const & endtoken)
|
||||
|
||||
// We do a case independent comparison, like search_kw
|
||||
// does.
|
||||
if (compare_ascii_no_case(token, endtoken) != 0) {
|
||||
string tmpstr = getString();
|
||||
if (firstline) {
|
||||
unsigned int i = 0;
|
||||
while (i < tmpstr.length()
|
||||
&& tmpstr[i] == ' ') {
|
||||
++i;
|
||||
prefix += ' ';
|
||||
}
|
||||
firstline = false;
|
||||
lyxerr[Debug::PARSER] << "Prefix = `" << prefix
|
||||
<< '\'' << endl;
|
||||
}
|
||||
|
||||
if (!prefix.empty()
|
||||
&& prefixIs(tmpstr, prefix)) {
|
||||
tmpstr.erase(0, prefix.length() - 1);
|
||||
}
|
||||
str += ltrim(tmpstr, "\t") + '\n';
|
||||
}
|
||||
else // token == endtoken
|
||||
if (compare_ascii_no_case(token, endtoken) == 0)
|
||||
break;
|
||||
|
||||
string tmpstr = getString();
|
||||
if (firstline) {
|
||||
string::size_type i(tmpstr.find_first_not_of(' '));
|
||||
if (i != string::npos)
|
||||
prefix = tmpstr.substr(0, i);
|
||||
firstline = false;
|
||||
lyxerr[Debug::PARSER]
|
||||
<< "Prefix = `" << prefix << "\'" << endl;
|
||||
}
|
||||
|
||||
// further lines in long strings may have the same
|
||||
// whitespace prefix as the first line. Remove it.
|
||||
if (prefix.length() && prefixIs(tmpstr, prefix)) {
|
||||
tmpstr.erase(0, prefix.length() - 1);
|
||||
}
|
||||
|
||||
str += ltrim(tmpstr, "\t") + '\n';
|
||||
}
|
||||
|
||||
if (!isOK()) {
|
||||
printError("Long string not ended by `" + endtoken + '\'');
|
||||
}
|
||||
|
@ -298,7 +298,7 @@ void LyXComm::read_ready()
|
||||
if (rerrno != 0) {
|
||||
lyxerr << "LyXComm: " << strerror(rerrno) << endl;
|
||||
if (!lsbuf.empty()) {
|
||||
lyxerr << "LyxComm: truncated command: "
|
||||
lyxerr << "LyXComm: truncated command: "
|
||||
<< lsbuf << endl;
|
||||
lsbuf.erase();
|
||||
}
|
||||
@ -505,7 +505,7 @@ void LyXServer::callback(LyXServer * serv, string const & msg)
|
||||
|
||||
|
||||
/* ---F+------------------------------------------------------------------ *\
|
||||
Function : LyxNotifyClient
|
||||
Function : LyXNotifyClient
|
||||
Called by : WorkAreaKeyPress
|
||||
Purpose : send a notify messge to a client
|
||||
Parameters: s - string to send
|
||||
|
10
src/lyxvc.C
10
src/lyxvc.C
@ -108,7 +108,7 @@ void LyXVC::registrer()
|
||||
}
|
||||
|
||||
// If the document is changed, we might want to save it
|
||||
if (!vcs->owner()->isLyxClean() &&
|
||||
if (!vcs->owner()->isClean() &&
|
||||
Alert::askQuestion(_("Changes in document:"),
|
||||
MakeDisplayPath(filename, 50),
|
||||
_("Save document and proceed?"))) {
|
||||
@ -118,7 +118,7 @@ void LyXVC::registrer()
|
||||
|
||||
// Maybe the save fails, or we answered "no". In both cases,
|
||||
// the document will be dirty, and we abort.
|
||||
if (!vcs->owner()->isLyxClean()) {
|
||||
if (!vcs->owner()->isClean()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -141,7 +141,7 @@ void LyXVC::registrer()
|
||||
void LyXVC::checkIn()
|
||||
{
|
||||
// If the document is changed, we might want to save it
|
||||
if (!vcs->owner()->isLyxClean() &&
|
||||
if (!vcs->owner()->isClean() &&
|
||||
Alert::askQuestion(_("Changes in document:"),
|
||||
MakeDisplayPath(vcs->owner()->fileName(), 50),
|
||||
_("Save document and proceed?"))) {
|
||||
@ -151,7 +151,7 @@ void LyXVC::checkIn()
|
||||
|
||||
// Maybe the save fails, or we answered "no". In both cases,
|
||||
// the document will be dirty, and we abort.
|
||||
if (!vcs->owner()->isLyxClean()) {
|
||||
if (!vcs->owner()->isClean()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -171,7 +171,7 @@ void LyXVC::checkIn()
|
||||
void LyXVC::checkOut()
|
||||
{
|
||||
lyxerr[Debug::LYXVC] << "LyXVC: checkOut" << endl;
|
||||
if (!vcs->owner()->isLyxClean()
|
||||
if (!vcs->owner()->isClean()
|
||||
&& !Alert::askQuestion(_("Changes in document:"),
|
||||
MakeDisplayPath(vcs->owner()->fileName(), 50),
|
||||
_("Ignore changes and proceed with check out?"))) {
|
||||
|
130
src/pspell.C
Normal file
130
src/pspell.C
Normal file
@ -0,0 +1,130 @@
|
||||
/**
|
||||
* \file pspell.C
|
||||
* Copyright 2001 the LyX Team
|
||||
* Read the file COPYING
|
||||
*
|
||||
* \author Kevin Atkinson
|
||||
* \author John Levon <levon@movementarian.org>
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation
|
||||
#endif
|
||||
|
||||
#ifdef USE_PSPELL
|
||||
|
||||
#include "support/LAssert.h"
|
||||
|
||||
#define USE_ORIGINAL_MANAGER_FUNCS 1
|
||||
#include <pspell/pspell.h>
|
||||
|
||||
#include "pspell.h"
|
||||
|
||||
|
||||
PSpell::PSpell(BufferParams const & params, string const & lang)
|
||||
: sc(0), els(0), spell_error_object(0), alive_(false)
|
||||
{
|
||||
PspellConfig * config = new_pspell_config();
|
||||
config->replace("language-tag", lang.c_str());
|
||||
spell_error_object = new_pspell_manager(config);
|
||||
if (pspell_error_number(spell_error_object) == 0) {
|
||||
sc = to_pspell_manager(spell_error_object);
|
||||
spell_error_object = 0;
|
||||
alive_ = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
PSpell::~PSpell()
|
||||
{
|
||||
cleanUp();
|
||||
close();
|
||||
if (els)
|
||||
delete_pspell_string_emulation(els);
|
||||
}
|
||||
|
||||
|
||||
void PSpell::cleanUp()
|
||||
{
|
||||
if (spell_error_object) {
|
||||
delete_pspell_can_have_error(spell_error_object);
|
||||
spell_error_object = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
enum PSpell::Result PSpell::check(string const & word)
|
||||
{
|
||||
Result res = UNKNOWN;
|
||||
|
||||
if (!sc)
|
||||
return res;
|
||||
|
||||
int word_ok = pspell_manager_check(sc, word.c_str());
|
||||
lyx::Assert(word_ok != -1);
|
||||
|
||||
if (word_ok) {
|
||||
res = OK;
|
||||
} else {
|
||||
PspellWordList const * sugs =
|
||||
pspell_manager_suggest(sc, word.c_str());
|
||||
lyx::Assert(sugs != 0);
|
||||
els = pspell_word_list_elements(sugs);
|
||||
if (pspell_word_list_empty(sugs))
|
||||
res = UNKNOWN;
|
||||
else
|
||||
res = MISSED;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
void PSpell::close()
|
||||
{
|
||||
if (sc)
|
||||
pspell_manager_save_all_word_lists(sc);
|
||||
}
|
||||
|
||||
|
||||
void PSpell::insert(string const & word)
|
||||
{
|
||||
if (sc)
|
||||
pspell_manager_add_to_personal(sc, word.c_str());
|
||||
}
|
||||
|
||||
|
||||
void PSpell::accept(string const & word)
|
||||
{
|
||||
if (sc)
|
||||
pspell_manager_add_to_session(sc, word.c_str());
|
||||
}
|
||||
|
||||
|
||||
string const PSpell::nextMiss()
|
||||
{
|
||||
char const * str = 0;
|
||||
|
||||
if (els)
|
||||
str = pspell_string_emulation_next(els);
|
||||
if (str)
|
||||
return str;
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
string const PSpell::error()
|
||||
{
|
||||
char const * err = 0;
|
||||
|
||||
if (pspell_error_number(spell_error_object) != 0) {
|
||||
err = pspell_error_message(spell_error_object);
|
||||
}
|
||||
|
||||
if (err)
|
||||
return err;
|
||||
return "";
|
||||
}
|
||||
|
||||
#endif // USE_PSPELL
|
66
src/pspell.h
Normal file
66
src/pspell.h
Normal file
@ -0,0 +1,66 @@
|
||||
/**
|
||||
* \file pspell.h
|
||||
* Copyright 2001 the LyX Team
|
||||
* Read the file COPYING
|
||||
*
|
||||
* \author Kevin Atkinson
|
||||
* \author John Levon <levon@movementarian.org>
|
||||
*/
|
||||
|
||||
#ifndef LYX_PSPELL_H
|
||||
#define LYX_PSPELL_H
|
||||
|
||||
#include "SpellBase.h"
|
||||
|
||||
class PspellManager;
|
||||
class PspellStringEmulation;
|
||||
class PspellCanHaveError;
|
||||
|
||||
class BufferParams;
|
||||
|
||||
|
||||
class PSpell : public SpellBase {
|
||||
public:
|
||||
/**
|
||||
* Initialise the spellchecker with the given buffer params and language.
|
||||
*/
|
||||
PSpell(BufferParams const & params, string const & lang);
|
||||
|
||||
virtual ~PSpell();
|
||||
|
||||
/// return true if the spellchecker instance still exists
|
||||
virtual bool alive() { return alive_; }
|
||||
|
||||
/// clean up on messy exit
|
||||
virtual void cleanUp();
|
||||
|
||||
/// check the given word and return the result
|
||||
virtual enum Result check(string const & word);
|
||||
|
||||
/// finish this spellchecker instance
|
||||
virtual void close();
|
||||
|
||||
/// insert the given word into the personal dictionary
|
||||
virtual void insert(string const & word);
|
||||
|
||||
/// accept the given word temporarily
|
||||
virtual void accept(string const & word);
|
||||
|
||||
/// return the next near miss after a MISSED result
|
||||
virtual string const nextMiss();
|
||||
|
||||
/// give an error message on messy exit
|
||||
virtual string const error();
|
||||
|
||||
private:
|
||||
/// main manager
|
||||
PspellManager * sc;
|
||||
/// FIXME
|
||||
PspellStringEmulation * els;
|
||||
/// FIXME
|
||||
PspellCanHaveError * spell_error_object;
|
||||
/// initialised properly ?
|
||||
bool alive_;
|
||||
};
|
||||
|
||||
#endif // PSPELL_H
|
@ -1,49 +0,0 @@
|
||||
// -*- C++ -*-
|
||||
#ifndef SP_BASE_H
|
||||
#define SP_BASE_H
|
||||
|
||||
// needed for pid_t typedef
|
||||
#include <sys/types.h>
|
||||
#include "LString.h" // can't forward declare...
|
||||
|
||||
class BufferParams;
|
||||
|
||||
class SpellBase
|
||||
{
|
||||
public:
|
||||
|
||||
/// status
|
||||
enum spellStatus {
|
||||
ISP_OK = 1,
|
||||
ISP_ROOT,
|
||||
ISP_COMPOUNDWORD,
|
||||
ISP_UNKNOWN,
|
||||
ISP_MISSED,
|
||||
ISP_IGNORE
|
||||
};
|
||||
|
||||
virtual ~SpellBase() {}
|
||||
|
||||
virtual void initialize(BufferParams const & , string const &) = 0;
|
||||
|
||||
virtual bool alive() = 0;
|
||||
|
||||
virtual void cleanUp() = 0;
|
||||
|
||||
virtual enum spellStatus check(string const &) = 0;
|
||||
|
||||
virtual void close() = 0;
|
||||
|
||||
virtual void insert(string const &) = 0;
|
||||
|
||||
virtual void accept(string const &) = 0;
|
||||
|
||||
virtual void store(string const & , string const &) = 0;
|
||||
|
||||
virtual char const * error() = 0;
|
||||
|
||||
virtual char const * nextMiss() = 0;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
@ -1,69 +0,0 @@
|
||||
#ifndef SP_ISPELL_H
|
||||
#define SP_ISPELL_H
|
||||
|
||||
#include <cstdio>
|
||||
|
||||
#include "sp_base.h"
|
||||
|
||||
class BufferParams;
|
||||
|
||||
|
||||
class ISpell : public SpellBase
|
||||
{
|
||||
public:
|
||||
///
|
||||
enum ActualSpellChecker {
|
||||
ASC_ISPELL,
|
||||
ASC_ASPELL
|
||||
};
|
||||
///
|
||||
ISpell();
|
||||
///
|
||||
ISpell(BufferParams const & params, string const & lang);
|
||||
///
|
||||
~ISpell();
|
||||
|
||||
/// initialize spell checker
|
||||
void initialize(BufferParams const & params, string const & lang);
|
||||
///
|
||||
bool alive();
|
||||
/// clean up after error
|
||||
void cleanUp();
|
||||
/// check word
|
||||
enum spellStatus check(string const & word);
|
||||
/// close spellchecker
|
||||
void close();
|
||||
///
|
||||
void insert(string const & word);
|
||||
///
|
||||
void accept(string const & word);
|
||||
/// store replacement
|
||||
void store(string const & mis, string const & cor);
|
||||
///
|
||||
char const * nextMiss();
|
||||
///
|
||||
char const * error();
|
||||
|
||||
private:
|
||||
///
|
||||
ActualSpellChecker actual_spell_checker;
|
||||
/// instream to communicate with ispell
|
||||
FILE * in;
|
||||
/// outstream to communicate with ispell
|
||||
FILE * out;
|
||||
/// spell error
|
||||
char const * error_;
|
||||
/// ?
|
||||
int isp_fd;
|
||||
///
|
||||
char * str;
|
||||
///
|
||||
spellStatus flag;
|
||||
///
|
||||
char * b;
|
||||
///
|
||||
char * e;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
@ -1,58 +0,0 @@
|
||||
#ifndef SP_PSPELL_H
|
||||
#define SP_PSPELL_H
|
||||
|
||||
#include "sp_base.h"
|
||||
|
||||
class PspellManager;
|
||||
class PspellStringEmulation;
|
||||
class PspellCanHaveError;
|
||||
|
||||
class BufferParams;
|
||||
|
||||
|
||||
class PSpell : public SpellBase
|
||||
{
|
||||
public:
|
||||
///
|
||||
PSpell();
|
||||
///
|
||||
PSpell(BufferParams const & params, string const & lang);
|
||||
///
|
||||
~PSpell();
|
||||
/// initialize spell checker
|
||||
void initialize(BufferParams const & params, string const & lang);
|
||||
///
|
||||
bool alive() { return alive_; }
|
||||
/// clean up after error
|
||||
void cleanUp();
|
||||
/// check word
|
||||
enum spellStatus check(string const & word);
|
||||
/// close spellchecker
|
||||
void close();
|
||||
///
|
||||
void insert(string const & word);
|
||||
///
|
||||
void accept(string const & word);
|
||||
/// store replacement
|
||||
void store(string const & mis, string const & cor);
|
||||
///
|
||||
char const * nextMiss();
|
||||
///
|
||||
char const * error();
|
||||
|
||||
private:
|
||||
///
|
||||
PspellManager * sc;
|
||||
///
|
||||
PspellStringEmulation * els;
|
||||
///
|
||||
PspellCanHaveError * spell_error_object;
|
||||
///
|
||||
spellStatus flag;
|
||||
///
|
||||
const char * error_;
|
||||
///
|
||||
bool alive_;
|
||||
};
|
||||
|
||||
#endif
|
66
src/text2.C
66
src/text2.C
@ -45,7 +45,6 @@
|
||||
|
||||
using std::vector;
|
||||
using std::copy;
|
||||
using std::find;
|
||||
using std::endl;
|
||||
using std::find;
|
||||
using std::pair;
|
||||
@ -968,30 +967,26 @@ string const LyXText::selectionAsString(Buffer const * buffer,
|
||||
bool label) const
|
||||
{
|
||||
if (!selection.set()) return string();
|
||||
string result;
|
||||
|
||||
// Special handling if the whole selection is within one paragraph
|
||||
if (selection.start.par() == selection.end.par()) {
|
||||
result += selection.start.par()->asString(buffer,
|
||||
selection.start.pos(),
|
||||
selection.end.pos(),
|
||||
label);
|
||||
return result;
|
||||
// should be const ...
|
||||
Paragraph * startpar(selection.start.par());
|
||||
Paragraph * endpar(selection.end.par());
|
||||
pos_type const startpos(selection.start.pos());
|
||||
pos_type const endpos(selection.end.pos());
|
||||
|
||||
if (startpar == endpar) {
|
||||
return startpar->asString(buffer, startpos, endpos, label);
|
||||
}
|
||||
|
||||
// The selection spans more than one paragraph
|
||||
string result;
|
||||
|
||||
// First paragraph in selection
|
||||
result += selection.start.par()->asString(buffer,
|
||||
selection.start.pos(),
|
||||
selection.start.par()->size(),
|
||||
label)
|
||||
+ "\n\n";
|
||||
result += startpar->asString(buffer, startpos, startpar->size(), label) + "\n\n";
|
||||
|
||||
// The paragraphs in between (if any)
|
||||
LyXCursor tmpcur(selection.start);
|
||||
tmpcur.par(tmpcur.par()->next());
|
||||
while (tmpcur.par() != selection.end.par()) {
|
||||
while (tmpcur.par() != endpar) {
|
||||
result += tmpcur.par()->asString(buffer, 0,
|
||||
tmpcur.par()->size(),
|
||||
label) + "\n\n";
|
||||
@ -999,8 +994,7 @@ string const LyXText::selectionAsString(Buffer const * buffer,
|
||||
}
|
||||
|
||||
// Last paragraph in selection
|
||||
result += selection.end.par()->asString(buffer, 0,
|
||||
selection.end.pos(), label);
|
||||
result += endpar->asString(buffer, 0, endpos, label);
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -2229,6 +2223,30 @@ void LyXText::setCursorFromCoordinates(BufferView * bview, int x, int y) const
|
||||
}
|
||||
|
||||
|
||||
namespace {
|
||||
|
||||
/**
|
||||
* return true if the cursor given is at the end of a row,
|
||||
* and the next row is filled by an inset that spans an entire
|
||||
* row.
|
||||
*/
|
||||
bool beforeFullRowInset(Row & row, LyXCursor & cur) {
|
||||
if (!row.next())
|
||||
return false;
|
||||
Row const & next = *row.next();
|
||||
|
||||
if (next.pos() != cur.pos() || next.par() != cur.par())
|
||||
return false;
|
||||
if (!cur.par()->isInset(cur.pos()))
|
||||
return false;
|
||||
Inset const * inset = cur.par()->getInset(cur.pos());
|
||||
if (inset->needFullRow() || inset->display())
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void LyXText::setCursorFromCoordinates(BufferView * bview, LyXCursor & cur,
|
||||
int x, int y) const
|
||||
{
|
||||
@ -2242,16 +2260,8 @@ void LyXText::setCursorFromCoordinates(BufferView * bview, LyXCursor & cur,
|
||||
cur.x(x);
|
||||
cur.y(y + row->baseline());
|
||||
cur.row(row);
|
||||
Inset * ins;
|
||||
if (row->next() && row->next()->pos() == cur.pos() &&
|
||||
cur.par() == row->next()->par() &&
|
||||
cur.par()->getChar(cur.pos()) == Paragraph::META_INSET &&
|
||||
(ins=cur.par()->getInset(cur.pos())) &&
|
||||
(ins->needFullRow() || ins->display()))
|
||||
{
|
||||
// we enter here if we put the cursor on the end of the row before
|
||||
// a inset which uses a full row and in that case we HAVE to calculate
|
||||
// the right (i) values.
|
||||
|
||||
if (beforeFullRowInset(*row, cur)) {
|
||||
pos_type last = rowLastPrintable(row);
|
||||
float x = getCursorX(bview, row->next(), cur.pos(), last, bound);
|
||||
cur.ix(int(x));
|
||||
|
@ -173,7 +173,7 @@ void RCS::checkIn(string const & msg)
|
||||
|
||||
void RCS::checkOut()
|
||||
{
|
||||
owner_->markLyxClean();
|
||||
owner_->markClean();
|
||||
doVCCommand("co -q -l \""
|
||||
+ OnlyFilename(owner_->fileName()) + "\"", owner_->filePath());
|
||||
owner_->getUser()->owner()->getLyXFunc()->dispatch(LFUN_MENURELOAD);
|
||||
@ -185,7 +185,7 @@ void RCS::revert()
|
||||
doVCCommand("co -f -u" + version() + " \""
|
||||
+ OnlyFilename(owner_->fileName()) + "\"", owner_->filePath());
|
||||
// We ignore changes and just reload!
|
||||
owner_->markLyxClean();
|
||||
owner_->markClean();
|
||||
owner_->getUser()->owner()
|
||||
->getLyXFunc()->dispatch(LFUN_MENURELOAD);
|
||||
}
|
||||
@ -317,7 +317,7 @@ void CVS::revert()
|
||||
|
||||
doVCCommand("rm -f \"" + fil + "\"; cvs update \"" + fil + "\"",
|
||||
owner_->filePath());
|
||||
owner_->markLyxClean();
|
||||
owner_->markClean();
|
||||
owner_->getUser()->owner()
|
||||
->getLyXFunc()->dispatch(LFUN_MENURELOAD);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user