a few small new features

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2289 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jean-Marc Lasgouttes 2001-07-20 09:38:19 +00:00
parent 251921c456
commit 76a135cf07
15 changed files with 198 additions and 186 deletions

View File

@ -1,3 +1,7 @@
2001-07-19 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
* ui/default.ui: change a shortcut
2001-07-19 Angus Leeming <a.leeming@ic.ac.uk> 2001-07-19 Angus Leeming <a.leeming@ic.ac.uk>
* chkconfig.ltx: test for the presence of natbib. * chkconfig.ltx: test for the presence of natbib.

View File

@ -45,7 +45,7 @@ Menuset
Item "Close|C" "buffer-close" Item "Close|C" "buffer-close"
Item "Save|S" "buffer-write" Item "Save|S" "buffer-write"
Item "Save As...|A" "buffer-write-as" Item "Save As...|A" "buffer-write-as"
Item "Revert to Saved|d" "buffer-reload" Item "Revert to Saved|R" "buffer-reload"
Submenu "Version Control|V" "file_vc" Submenu "Version Control|V" "file_vc"
Separator Separator
Submenu "Import|I" "file_import" Submenu "Import|I" "file_import"
@ -217,6 +217,7 @@ Menuset
Item "Subscript|u" "command-sequence math-insert _;math-mode;" Item "Subscript|u" "command-sequence math-insert _;math-mode;"
Item "HFill|H" "hfill-insert" Item "HFill|H" "hfill-insert"
Item "Hyphenation Point|P" "hyphenation-point-insert" Item "Hyphenation Point|P" "hyphenation-point-insert"
Item "Hyphenation break|k" "hyphenation-break-insert"
Item "Protected Blank|B" "protected-space-insert" Item "Protected Blank|B" "protected-space-insert"
Item "Linebreak|L" "break-line" Item "Linebreak|L" "break-line"
Item "Ellipsis|i" "dots-insert" Item "Ellipsis|i" "dots-insert"

View File

@ -1520,19 +1520,23 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument)
} }
case LFUN_HYPHENATION: case LFUN_HYPHENATION:
hyphenationPoint(); specialChar(InsetSpecialChar::HYPHENATION);
break;
case LFUN_HYPHENATION_BREAK:
specialChar(InsetSpecialChar::HYPHENATION_BREAK);
break; break;
case LFUN_LDOTS: case LFUN_LDOTS:
ldots(); specialChar(InsetSpecialChar::LDOTS);
break; break;
case LFUN_END_OF_SENTENCE: case LFUN_END_OF_SENTENCE:
endOfSentenceDot(); specialChar(InsetSpecialChar::END_OF_SENTENCE);
break; break;
case LFUN_MENU_SEPARATOR: case LFUN_MENU_SEPARATOR:
menuSeparator(); specialChar(InsetSpecialChar::MENU_SEPARATOR);
break; break;
case LFUN_HFILL: case LFUN_HFILL:
@ -3015,24 +3019,21 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument)
case LFUN_INDEX_CREATE: case LFUN_INDEX_CREATE:
{ {
InsetCommandParams p( "index" ); InsetCommandParams p("index");
if (argument.empty()) { if (argument.empty()) {
// Get the word immediately preceding the cursor // Get word or selection
Paragraph::size_type curpos = bv_->getLyXText()->selectWordWhenUnderCursor(bv_);
bv_->getLyXText()->cursor.pos() - 1;
string const curstring =
bv_->getLyXText()->selectionAsString(buffer_);
string curstring; p.setContents(curstring);
if (curpos >= 0 )
curstring = bv_->getLyXText()
->cursor.par()->getWord(curpos);
p.setContents( curstring );
} else { } else {
p.setContents( argument ); p.setContents(argument);
} }
owner_->getDialogs()->createIndex( p.getAsString() ); owner_->getDialogs()->createIndex(p.getAsString());
} }
break; break;
@ -3051,14 +3052,11 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument)
case LFUN_INDEX_INSERT_LAST: case LFUN_INDEX_INSERT_LAST:
{ {
// Get word immediately preceding the cursor // Get word or selection
Paragraph::size_type curpos = bv_->getLyXText()->selectWordWhenUnderCursor(bv_);
bv_->getLyXText()->cursor.pos() - 1;
// Can't do that at the beginning of a paragraph
if (curpos < 0) break;
string const curstring(bv_->getLyXText() string const curstring =
->cursor.par()->getWord(curpos)); bv_->getLyXText()->selectionAsString(buffer_);
InsetCommandParams p("index", curstring); InsetCommandParams p("index", curstring);
InsetIndex * inset = new InsetIndex(p); InsetIndex * inset = new InsetIndex(p);
@ -3252,6 +3250,12 @@ void BufferView::Pimpl::protectedBlank(LyXText * lt)
update(lt, BufferView::SELECT|BufferView::FITCUR); update(lt, BufferView::SELECT|BufferView::FITCUR);
InsetSpecialChar * new_inset = InsetSpecialChar * new_inset =
new InsetSpecialChar(InsetSpecialChar::PROTECTED_SEPARATOR); new InsetSpecialChar(InsetSpecialChar::PROTECTED_SEPARATOR);
#ifdef WITH_WARNINGS
#warning Why is this code different from specialChar() below? (JMarc)
// the code in specialChar is a generic version of what used to exist
// for other special chars. I did not merge this case because of the
// call to updateInset(), but what does it do?
#endif
if (!insertInset(new_inset)) if (!insertInset(new_inset))
delete new_inset; delete new_inset;
else else
@ -3259,8 +3263,7 @@ void BufferView::Pimpl::protectedBlank(LyXText * lt)
} }
} }
void BufferView::Pimpl::specialChar(InsetSpecialChar::Kind kind)
void BufferView::Pimpl::menuSeparator()
{ {
if (available()) { if (available()) {
LyXText * lt = bv_->getLyXText(); LyXText * lt = bv_->getLyXText();
@ -3268,43 +3271,7 @@ void BufferView::Pimpl::menuSeparator()
hideCursor(); hideCursor();
update(lt, BufferView::SELECT|BufferView::FITCUR); update(lt, BufferView::SELECT|BufferView::FITCUR);
InsetSpecialChar * new_inset = InsetSpecialChar * new_inset =
new InsetSpecialChar(InsetSpecialChar::MENU_SEPARATOR); new InsetSpecialChar(kind);
insertInset(new_inset);
}
}
void BufferView::Pimpl::endOfSentenceDot()
{
if (available()) {
hideCursor();
update(bv_->getLyXText(), BufferView::SELECT|BufferView::FITCUR);
InsetSpecialChar * new_inset =
new InsetSpecialChar(InsetSpecialChar::END_OF_SENTENCE);
insertInset(new_inset);
}
}
void BufferView::Pimpl::ldots()
{
if (available()) {
hideCursor();
update(bv_->getLyXText(), BufferView::SELECT|BufferView::FITCUR);
InsetSpecialChar * new_inset =
new InsetSpecialChar(InsetSpecialChar::LDOTS);
insertInset(new_inset);
}
}
void BufferView::Pimpl::hyphenationPoint()
{
if (available()) {
hideCursor();
update(bv_->getLyXText(), BufferView::SELECT|BufferView::FITCUR);
InsetSpecialChar * new_inset =
new InsetSpecialChar(InsetSpecialChar::HYPHENATION);
insertInset(new_inset); insertInset(new_inset);
} }
} }

View File

@ -11,6 +11,7 @@
#include "frontends/Timeout.h" #include "frontends/Timeout.h"
#include "WorkArea.h" #include "WorkArea.h"
#include "paragraph.h" #include "paragraph.h"
#include "insets/insetspecialchar.h"
#ifdef __GNUG__ #ifdef __GNUG__
#pragma interface #pragma interface
@ -131,19 +132,13 @@ private:
bool open_new_inset(UpdatableInset * new_inset, bool behind = false); bool open_new_inset(UpdatableInset * new_inset, bool behind = false);
/// ///
void protectedBlank(LyXText * lt); void protectedBlank(LyXText * lt);
///
void specialChar(InsetSpecialChar::Kind);
/// ///
void newline(); void newline();
/// ///
void hfill(); void hfill();
/// ///
void menuSeparator();
///
void endOfSentenceDot();
///
void ldots();
///
void hyphenationPoint();
///
void insertNote(); void insertNote();
/// ///
void gotoInset(std::vector<Inset::Code> const & codes, void gotoInset(std::vector<Inset::Code> const & codes,

View File

@ -1,3 +1,21 @@
2001-07-19 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
* BufferView_pimpl.C (specialChar): new method. Obsoletes
menuSeparator(), endOfSentenceDot(), ldots() and
hyphenationPoint(), which are therefore removed.
(Dispatch): handle LFUN_HYPHENATION_BREAK.
* LyXAction.C (init):
* commandtags.h: add LFUN_HYPHENATION_BREAK.
* paragraph.C (getWord): removed.
* BufferView_pimpl.C (Dispatch): use last word or selection for
LFUN_INDEX_INSERT_LAST and LFUN_INDEX_CREATE.
* lyx_main.C (queryUserLyXDir): do not ask before creating
user_dir, except if it has been named explicitely.
2001-07-20 Angus Leeming <a.leeming@ic.ac.uk> 2001-07-20 Angus Leeming <a.leeming@ic.ac.uk>
* BufferView_pimpl.C (updateScrollbar): Fix crash when reading in * BufferView_pimpl.C (updateScrollbar): Fix crash when reading in

View File

@ -232,6 +232,8 @@ void LyXAction::init()
{ LFUN_HTMLURL, "html-insert", "", Noop }, { LFUN_HTMLURL, "html-insert", "", Noop },
{ LFUN_HYPHENATION, "hyphenation-point-insert", { LFUN_HYPHENATION, "hyphenation-point-insert",
N_("Insert hyphenation point"), Noop }, N_("Insert hyphenation point"), Noop },
{ LFUN_HYPHENATION_BREAK, "hyphenation-break-insert",
N_("Insert hyphenation break"), Noop },
{ LFUN_INDEX_CREATE, "index-insert", { LFUN_INDEX_CREATE, "index-insert",
N_("Insert index item"), Noop }, N_("Insert index item"), Noop },
{ LFUN_INDEX_INSERT_LAST, "index-insert-last", { LFUN_INDEX_INSERT_LAST, "index-insert-last",

View File

@ -51,6 +51,7 @@ enum kb_action {
LFUN_GOTONOTE, LFUN_GOTONOTE,
LFUN_INSET_TOGGLE, LFUN_INSET_TOGGLE,
LFUN_HYPHENATION, LFUN_HYPHENATION,
LFUN_HYPHENATION_BREAK,
LFUN_HFILL, LFUN_HFILL,
LFUN_DEPTH, LFUN_DEPTH,
LFUN_FREE, // 30 LFUN_FREE, // 30

View File

@ -1,3 +1,13 @@
2001-07-19 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
* insetspecialchar.[Ch]: add support for HYPHENATION_BREAK. some
reformatting
* insetquotes.C: general cleanup
(dispString): add spaces inside french double quotes.
(latex): ditto. Moreover, treat first the case where the frenchb
or french options have been given.
2001-07-19 Angus Leeming <a.leeming@ic.ac.uk> 2001-07-19 Angus Leeming <a.leeming@ic.ac.uk>
* insetcite.[Ch] (latex, validate): new methods, required for natbib * insetcite.[Ch] (latex, validate): new methods, required for natbib

View File

@ -73,25 +73,25 @@ InsetQuotes::InsetQuotes(string const & str)
} }
InsetQuotes::InsetQuotes(InsetQuotes::quote_language l, InsetQuotes::InsetQuotes(quote_language l,
InsetQuotes::quote_side s, quote_side s,
InsetQuotes::quote_times t) quote_times t)
: language(l), side(s), times(t) : language_(l), side_(s), times_(t)
{} {}
InsetQuotes::InsetQuotes(char c, BufferParams const & params) InsetQuotes::InsetQuotes(char c, BufferParams const & params)
: language(params.quotes_language), times(params.quotes_times) : language_(params.quotes_language), times_(params.quotes_times)
{ {
// Decide whether left or right // Decide whether left or right
switch (c) { switch (c) {
case ' ': case '(': case '{': case '[': case '-': case ':': case ' ': case '(': case '{': case '[': case '-': case ':':
case Paragraph::META_HFILL: case Paragraph::META_HFILL:
case Paragraph::META_NEWLINE: case Paragraph::META_NEWLINE:
side = InsetQuotes::LeftQ; // left quote side_ = LeftQ; // left quote
break; break;
default: default:
side = InsetQuotes::RightQ; // right quote side_ = RightQ; // right quote
} }
} }
@ -109,47 +109,47 @@ void InsetQuotes::parseString(string const & s)
for (i = 0; i < 6; ++i) { for (i = 0; i < 6; ++i) {
if (str[0] == language_char[i]) { if (str[0] == language_char[i]) {
language = InsetQuotes::quote_language(i); language_ = quote_language(i);
break; break;
} }
} }
if (i >= 6) { if (i >= 6) {
lyxerr << "ERROR (InsetQuotes::InsetQuotes):" lyxerr << "ERROR (InsetQuotes::InsetQuotes):"
" bad language specification." << endl; " bad language specification." << endl;
language = InsetQuotes::EnglishQ; language_ = EnglishQ;
} }
for (i = 0; i < 2; ++i) { for (i = 0; i < 2; ++i) {
if (str[1] == side_char[i]) { if (str[1] == side_char[i]) {
side = InsetQuotes::quote_side(i); side_ = quote_side(i);
break; break;
} }
} }
if (i >= 2) { if (i >= 2) {
lyxerr << "ERROR (InsetQuotes::InsetQuotes):" lyxerr << "ERROR (InsetQuotes::InsetQuotes):"
" bad side specification." << endl; " bad side specification." << endl;
side = InsetQuotes::LeftQ; side_ = LeftQ;
} }
for (i = 0; i < 2; ++i) { for (i = 0; i < 2; ++i) {
if (str[2] == times_char[i]) { if (str[2] == times_char[i]) {
times = InsetQuotes::quote_times(i); times_ = quote_times(i);
break; break;
} }
} }
if (i >= 2) { if (i >= 2) {
lyxerr << "ERROR (InsetQuotes::InsetQuotes):" lyxerr << "ERROR (InsetQuotes::InsetQuotes):"
" bad times specification." << endl; " bad times specification." << endl;
times = InsetQuotes::DoubleQ; times_ = DoubleQ;
} }
} }
string const InsetQuotes::dispString() const string const InsetQuotes::dispString(Language const * doclang) const
{ {
string disp; string disp;
disp += quote_char[quote_index[side][language]]; disp += quote_char[quote_index[side_][language_]];
if (times == InsetQuotes::DoubleQ) if (times_ == DoubleQ)
disp += disp; disp += disp;
if (lyxrc.font_norm_type == LyXRC::ISO_8859_1 if (lyxrc.font_norm_type == LyXRC::ISO_8859_1
@ -158,6 +158,14 @@ string const InsetQuotes::dispString() const
disp = '«'; disp = '«';
else if (disp == ">>") else if (disp == ">>")
disp = '»'; disp = '»';
// in french, spaces are added inside double quotes
if (times_ == DoubleQ && doclang->code() == "fr") {
if (side_ == LeftQ)
disp += " ";
else
disp = " " + disp;
}
return disp; return disp;
} }
@ -175,9 +183,9 @@ int InsetQuotes::descent(BufferView *, LyXFont const & font) const
} }
int InsetQuotes::width(BufferView *, LyXFont const & font) const int InsetQuotes::width(BufferView * bv, LyXFont const & font) const
{ {
string text = dispString(); string text = dispString(bv->buffer()->getLanguage());
int w = 0; int w = 0;
for (string::size_type i = 0; i < text.length(); ++i) { for (string::size_type i = 0; i < text.length(); ++i) {
@ -207,7 +215,7 @@ LyXFont const InsetQuotes::convertFont(LyXFont const & f) const
void InsetQuotes::draw(BufferView * bv, LyXFont const & font, void InsetQuotes::draw(BufferView * bv, LyXFont const & font,
int baseline, float & x, bool) const int baseline, float & x, bool) const
{ {
string text = dispString(); string text = dispString(bv->buffer()->getLanguage());
bv->painter().text(int(x), baseline, text, font); bv->painter().text(int(x), baseline, text, font);
x += width(bv, font); x += width(bv, font);
@ -217,9 +225,9 @@ void InsetQuotes::draw(BufferView * bv, LyXFont const & font,
void InsetQuotes::write(Buffer const *, ostream & os) const void InsetQuotes::write(Buffer const *, ostream & os) const
{ {
string text; string text;
text += language_char[language]; text += language_char[language_];
text += side_char[side]; text += side_char[side_];
text += times_char[times]; text += times_char[times_];
os << "Quotes " << text; os << "Quotes " << text;
} }
@ -241,27 +249,33 @@ extern bool use_babel;
int InsetQuotes::latex(Buffer const * buf, ostream & os, int InsetQuotes::latex(Buffer const * buf, ostream & os,
bool /*fragile*/, bool) const bool /*fragile*/, bool) const
{ {
string const doclang = buf->getLanguage()->lang(); string const doclang = buf->getLanguage()->babel();
int quoteind = quote_index[side][language]; int quoteind = quote_index[side_][language_];
string qstr; string qstr;
if (lyxrc.fontenc == "T1") { if (language_ == FrenchQ && times_ == DoubleQ) {
qstr = latex_quote_t1[times][quoteind]; if (doclang == "frenchb") {
if (side_ == LeftQ)
qstr = "\\og "; //the spaces are important here
else
qstr = " \\fg "; //and here
} else if (doclang == "french") {
if (side_ == LeftQ)
qstr = "<< "; //the spaces are important here
else
qstr = " >>"; //and here
}
} else if (lyxrc.fontenc == "T1") {
qstr = latex_quote_t1[times_][quoteind];
#ifdef DO_USE_DEFAULT_LANGUAGE #ifdef DO_USE_DEFAULT_LANGUAGE
} else if (doclang == "default") { } else if (doclang == "default") {
#else #else
} else if (!use_babel) { } else if (!use_babel) {
#endif #endif
qstr = latex_quote_ot1[times][quoteind]; qstr = latex_quote_ot1[times_][quoteind];
} else if (language == InsetQuotes::FrenchQ } else {
&& times == InsetQuotes::DoubleQ qstr = latex_quote_babel[times_][quoteind];
&& doclang == "frenchb") { }
if (side == InsetQuotes::LeftQ)
qstr = "\\og{}";
else
qstr = " \\fg{}";
} else
qstr = latex_quote_babel[times][quoteind];
// Always guard against unfortunate ligatures (!` ?`) // Always guard against unfortunate ligatures (!` ?`)
if (prefixIs(qstr, "`")) if (prefixIs(qstr, "`"))
@ -288,13 +302,13 @@ int InsetQuotes::linuxdoc(Buffer const *, ostream & os) const
int InsetQuotes::docBook(Buffer const *, ostream & os) const int InsetQuotes::docBook(Buffer const *, ostream & os) const
{ {
if (times == InsetQuotes::DoubleQ) { if (times_ == DoubleQ) {
if (side == InsetQuotes::LeftQ) if (side_ == LeftQ)
os << "&ldquo;"; os << "&ldquo;";
else else
os << "&rdquo;"; os << "&rdquo;";
} else { } else {
if (side == InsetQuotes::LeftQ) if (side_ == LeftQ)
os << "&lsquo;"; os << "&lsquo;";
else else
os << "&rsquo;"; os << "&rsquo;";
@ -305,11 +319,11 @@ int InsetQuotes::docBook(Buffer const *, ostream & os) const
void InsetQuotes::validate(LaTeXFeatures & features) const void InsetQuotes::validate(LaTeXFeatures & features) const
{ {
char type = quote_char[quote_index[side][language]]; char type = quote_char[quote_index[side_][language_]];
if (features.bufferParams().language->lang() == "default" if (features.bufferParams().language->lang() == "default"
&& lyxrc.fontenc != "T1") { && lyxrc.fontenc != "T1") {
if (times == InsetQuotes::SingleQ) if (times_ == SingleQ)
switch (type) { switch (type) {
case ',': features.quotesinglbase = true; break; case ',': features.quotesinglbase = true; break;
case '<': features.guilsinglleft = true; break; case '<': features.guilsinglleft = true; break;
@ -329,7 +343,7 @@ void InsetQuotes::validate(LaTeXFeatures & features) const
Inset * InsetQuotes::clone(Buffer const &, bool) const Inset * InsetQuotes::clone(Buffer const &, bool) const
{ {
return new InsetQuotes(language, side, times); return new InsetQuotes(language_, side_, times_);
} }

View File

@ -19,6 +19,7 @@
#include "inset.h" #include "inset.h"
class BufferParams; class BufferParams;
class Language;
struct LaTeXFeatures; struct LaTeXFeatures;
@ -102,11 +103,11 @@ public:
Inset::Code lyxCode() const; Inset::Code lyxCode() const;
private: private:
/// ///
quote_language language; quote_language language_;
/// ///
quote_side side; quote_side side_;
/// ///
quote_times times; quote_times times_;
/** The parameters of the constructor are the language, the /** The parameters of the constructor are the language, the
side and the multiplicity of the quote. side and the multiplicity of the quote.
@ -115,7 +116,7 @@ private:
/// ///
void parseString(string const &); void parseString(string const &);
/// ///
string const dispString() const; string const dispString(Language const *) const;
}; };
#endif #endif

View File

@ -50,6 +50,10 @@ int InsetSpecialChar::width(BufferView *, LyXFont const & font) const
w -= 2; // to make it look shorter w -= 2; // to make it look shorter
return w; return w;
} }
case HYPHENATION_BREAK:
{
return lyxfont::width('|', font);
}
case END_OF_SENTENCE: case END_OF_SENTENCE:
{ {
return lyxfont::width('.', font); return lyxfont::width('.', font);
@ -86,6 +90,13 @@ void InsetSpecialChar::draw(BufferView * bv, LyXFont const & f,
x += width(bv, font); x += width(bv, font);
break; break;
} }
case HYPHENATION_BREAK:
{
font.setColor(LColor::special);
pain.text(int(x), baseline, "|", font);
x += width(bv, font);
break;
}
case END_OF_SENTENCE: case END_OF_SENTENCE:
{ {
font.setColor(LColor::special); font.setColor(LColor::special);
@ -148,10 +159,21 @@ void InsetSpecialChar::write(Buffer const *, ostream & os) const
{ {
string command; string command;
switch (kind) { switch (kind) {
case HYPHENATION: command = "\\-"; break; case HYPHENATION:
case END_OF_SENTENCE: command = "\\@."; break; command = "\\-";
case LDOTS: command = "\\ldots{}"; break; break;
case MENU_SEPARATOR: command = "\\menuseparator"; break; case HYPHENATION_BREAK:
command = "\\textcompwordmark{}";
break;
case END_OF_SENTENCE:
command = "\\@.";
break;
case LDOTS:
command = "\\ldots{}";
break;
case MENU_SEPARATOR:
command = "\\menuseparator";
break;
case PROTECTED_SEPARATOR: case PROTECTED_SEPARATOR:
//command = "\\protected_separator"; //command = "\\protected_separator";
command = "~"; command = "~";
@ -169,6 +191,8 @@ void InsetSpecialChar::read(Buffer const *, LyXLex & lex)
if (command == "\\-") if (command == "\\-")
kind = HYPHENATION; kind = HYPHENATION;
else if (command == "\\textcompwordmark{}")
kind = HYPHENATION_BREAK;
else if (command == "\\@.") else if (command == "\\@.")
kind = END_OF_SENTENCE; kind = END_OF_SENTENCE;
else if (command == "\\ldots{}") else if (command == "\\ldots{}")
@ -187,11 +211,24 @@ int InsetSpecialChar::latex(Buffer const *, ostream & os, bool /*fragile*/,
bool free_space) const bool free_space) const
{ {
switch (kind) { switch (kind) {
case HYPHENATION: os << "\\-"; break; case HYPHENATION:
case END_OF_SENTENCE: os << "\\@."; break; os << "\\-";
case LDOTS: os << "\\ldots{}"; break; break;
case MENU_SEPARATOR: os << "\\lyxarrow{}"; break; case HYPHENATION_BREAK:
case PROTECTED_SEPARATOR: os << (free_space ? " " : "~"); break; os << "\\textcompwordmark{}";
break;
case END_OF_SENTENCE:
os << "\\@.";
break;
case LDOTS:
os << "\\ldots{}";
break;
case MENU_SEPARATOR:
os << "\\lyxarrow{}";
break;
case PROTECTED_SEPARATOR:
os << (free_space ? " " : "~");
break;
} }
return 0; return 0;
} }
@ -200,11 +237,21 @@ int InsetSpecialChar::latex(Buffer const *, ostream & os, bool /*fragile*/,
int InsetSpecialChar::ascii(Buffer const *, ostream & os, int) const int InsetSpecialChar::ascii(Buffer const *, ostream & os, int) const
{ {
switch (kind) { switch (kind) {
case HYPHENATION: break; case HYPHENATION:
case END_OF_SENTENCE: os << "."; break; case HYPHENATION_BREAK:
case LDOTS: os << "..."; break; break;
case MENU_SEPARATOR: os << "->"; break; case END_OF_SENTENCE:
case PROTECTED_SEPARATOR: os << " "; break; os << ".";
break;
case LDOTS:
os << "...";
break;
case MENU_SEPARATOR:
os << "->";
break;
case PROTECTED_SEPARATOR:
os << " ";
break;
} }
return 0; return 0;
} }

View File

@ -28,6 +28,8 @@ public:
enum Kind { enum Kind {
/// Optional hyphenation point (\-) /// Optional hyphenation point (\-)
HYPHENATION, HYPHENATION,
/// Hyphenation break point (\textcompwordmark)
HYPHENATION_BREAK,
/// ... (\ldots) /// ... (\ldots)
LDOTS, LDOTS,
/// End of sentence punctuation (\@) /// End of sentence punctuation (\@)

View File

@ -550,15 +550,13 @@ void LyX::queryUserLyXDir(bool explicit_userdir)
first_start = false; first_start = false;
return; return;
} else { } else {
first_start = true; first_start = !explicit_userdir;
} }
// Nope // If the user specified explicitely a directory, ask whether
// Different wording if the user specifically requested a directory // to create it (otherwise, always create it)
if (!AskQuestion( explicit_userdir if (explicit_userdir &&
? _("You have specified an invalid LyX directory.") !AskQuestion(_("You have specified an invalid LyX directory."),
: _("You don't have a personal LyX directory.") ,
_("It is needed to keep your own configuration."), _("It is needed to keep your own configuration."),
_("Should I try to set it up for you (recommended)?"))) { _("Should I try to set it up for you (recommended)?"))) {
lyxerr << _("Running without personal LyX directory.") << endl; lyxerr << _("Running without personal LyX directory.") << endl;

View File

@ -707,52 +707,6 @@ Paragraph::getUChar(BufferParams const & bparams,
} }
// return an string of the current word, and the end of the word in lastpos.
string const Paragraph::getWord(Paragraph::size_type & lastpos) const
{
lyx::Assert(lastpos >= 0);
// the current word is defined as starting at the first character
// from the immediate left of lastpospos which meets the definition
// of IsLetter(), continuing to the last character to the right
// of this meeting IsLetter.
string theword;
// grab a word
// move back until we have a letter
//there's no real reason to have firstpos & lastpos as
//separate variables as this is written, but maybe someon
// will want to return firstpos in the future.
//since someone might have typed a punctuation first
int firstpos = lastpos;
while ((firstpos >= 0) && !isLetter(firstpos))
--firstpos;
// now find the beginning by looking for a nonletter
while ((firstpos>= 0) && isLetter(firstpos))
--firstpos;
// the above is now pointing to the preceeding non-letter
++firstpos;
lastpos = firstpos;
// so copy characters into theword until we get a nonletter
// note that this can easily exceed lastpos, wich means
// that if used in the middle of a word, the whole word
// is included
while (isLetter(lastpos)) theword += getChar(lastpos++);
return theword;
}
void Paragraph::setFont(Paragraph::size_type pos, void Paragraph::setFont(Paragraph::size_type pos,
LyXFont const & font) LyXFont const & font)
{ {

View File

@ -260,8 +260,6 @@ public:
void setChar(size_type pos, value_type c); void setChar(size_type pos, value_type c);
/// ///
void setFont(size_type pos, LyXFont const & font); void setFont(size_type pos, LyXFont const & font);
///
string const getWord(size_type &) const;
/// Returns the height of the highest font in range /// Returns the height of the highest font in range
LyXFont::FONT_SIZE highestFontInRange(size_type startpos, LyXFont::FONT_SIZE highestFontInRange(size_type startpos,
size_type endpos) const; size_type endpos) const;