Get rid of label_init_length. There is no way to set it from the GUI any

more. Worse, it was being used inconsistently. And we don't really need
it.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33786 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Richard Heck 2010-03-17 12:50:58 +00:00
parent d61d8d7edb
commit 8f5d4a3fcb
4 changed files with 16 additions and 36 deletions

View File

@ -111,7 +111,6 @@ LexerKeyword lyxrcTags[] = {
{ "\\kbmap", LyXRC::RC_KBMAP }, { "\\kbmap", LyXRC::RC_KBMAP },
{ "\\kbmap_primary", LyXRC::RC_KBMAP_PRIMARY }, { "\\kbmap_primary", LyXRC::RC_KBMAP_PRIMARY },
{ "\\kbmap_secondary", LyXRC::RC_KBMAP_SECONDARY }, { "\\kbmap_secondary", LyXRC::RC_KBMAP_SECONDARY },
{ "\\label_init_length", LyXRC::RC_LABEL_INIT_LENGTH },
{ "\\language_auto_begin", LyXRC::RC_LANGUAGE_AUTO_BEGIN }, { "\\language_auto_begin", LyXRC::RC_LANGUAGE_AUTO_BEGIN },
{ "\\language_auto_end", LyXRC::RC_LANGUAGE_AUTO_END }, { "\\language_auto_end", LyXRC::RC_LANGUAGE_AUTO_END },
{ "\\language_command_begin", LyXRC::RC_LANGUAGE_COMMAND_BEGIN }, { "\\language_command_begin", LyXRC::RC_LANGUAGE_COMMAND_BEGIN },
@ -314,7 +313,6 @@ void LyXRC::setDefaults()
mac_like_word_movement = false; mac_like_word_movement = false;
macro_edit_style = MACRO_EDIT_INLINE_BOX; macro_edit_style = MACRO_EDIT_INLINE_BOX;
dialogs_iconify_with_main = false; dialogs_iconify_with_main = false;
label_init_length = 3;
preview = PREVIEW_OFF; preview = PREVIEW_OFF;
preview_hashed_labels = false; preview_hashed_labels = false;
preview_scale_factor = 1.0; preview_scale_factor = 1.0;
@ -1077,10 +1075,6 @@ int LyXRC::read(Lexer & lexrc)
lexrc >> gui_language; lexrc >> gui_language;
break; break;
case RC_LABEL_INIT_LENGTH:
lexrc >> label_init_length;
break;
case RC_SHOW_BANNER: case RC_SHOW_BANNER:
lexrc >> show_banner; lexrc >> show_banner;
break; break;
@ -1523,14 +1517,6 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c
} }
if (tag != RC_LAST) if (tag != RC_LAST)
break; break;
case RC_LABEL_INIT_LENGTH:
if (ignore_system_lyxrc ||
label_init_length != system_lyxrc.label_init_length) {
os << "\\label_init_length " << label_init_length
<< '\n';
}
if (tag != RC_LAST)
break;
case RC_USER_NAME: case RC_USER_NAME:
os << "\\user_name \"" << user_name << "\"\n"; os << "\\user_name \"" << user_name << "\"\n";
@ -2708,7 +2694,6 @@ void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new)
case LyXRC::RC_KBMAP: case LyXRC::RC_KBMAP:
case LyXRC::RC_KBMAP_PRIMARY: case LyXRC::RC_KBMAP_PRIMARY:
case LyXRC::RC_KBMAP_SECONDARY: case LyXRC::RC_KBMAP_SECONDARY:
case LyXRC::RC_LABEL_INIT_LENGTH:
case LyXRC::RC_LANGUAGE_AUTO_BEGIN: case LyXRC::RC_LANGUAGE_AUTO_BEGIN:
case LyXRC::RC_LANGUAGE_AUTO_END: case LyXRC::RC_LANGUAGE_AUTO_END:
case LyXRC::RC_LANGUAGE_COMMAND_BEGIN: case LyXRC::RC_LANGUAGE_COMMAND_BEGIN:
@ -2963,10 +2948,6 @@ string const LyXRC::getDescription(LyXRCTags tag)
str = _("Use this to set the correct mapping file for your keyboard. You'll need this if you for instance want to type German documents on an American keyboard."); str = _("Use this to set the correct mapping file for your keyboard. You'll need this if you for instance want to type German documents on an American keyboard.");
break; break;
case RC_LABEL_INIT_LENGTH:
str = _("Maximum number of words in the initialization string for a new label");
break;
case RC_LANGUAGE_AUTO_BEGIN: case RC_LANGUAGE_AUTO_BEGIN:
str = _("Select if a language switching command is needed at the beginning of the document."); str = _("Select if a language switching command is needed at the beginning of the document.");
break; break;

View File

@ -96,7 +96,6 @@ public:
RC_KBMAP, RC_KBMAP,
RC_KBMAP_PRIMARY, RC_KBMAP_PRIMARY,
RC_KBMAP_SECONDARY, RC_KBMAP_SECONDARY,
RC_LABEL_INIT_LENGTH,
RC_LANGUAGE_AUTO_BEGIN, RC_LANGUAGE_AUTO_BEGIN,
RC_LANGUAGE_AUTO_END, RC_LANGUAGE_AUTO_END,
RC_LANGUAGE_COMMAND_BEGIN, RC_LANGUAGE_COMMAND_BEGIN,
@ -417,8 +416,6 @@ public:
/// ///
bool dialogs_iconify_with_main; bool dialogs_iconify_with_main;
/// ///
int label_init_length;
///
bool display_graphics; bool display_graphics;
/// ///
bool show_banner; bool show_banner;

View File

@ -1834,10 +1834,11 @@ docstring Text::getPossibleLabel(Cursor const & cur) const
docstring text; docstring text;
docstring par_text = pars_[pit].asString(); docstring par_text = pars_[pit].asString();
string piece;
// the return string of math matrices might contain linebreaks // The return string of math matrices might contain linebreaks
par_text = subst(par_text, '\n', '-'); par_text = subst(par_text, '\n', '-');
for (int i = 0; i < lyxrc.label_init_length; ++i) { int const numwords = 3;
for (int i = 0; i < numwords; ++i) {
if (par_text.empty()) if (par_text.empty())
break; break;
docstring head; docstring head;
@ -1847,12 +1848,13 @@ docstring Text::getPossibleLabel(Cursor const & cur) const
text += '-'; text += '-';
text += head; text += head;
} }
// Make sure it isn't too long
unsigned int const max_label_length = 32;
if (text.size() > max_label_length)
text.resize(max_label_length);
// No need for a prefix if the user said so. // Will contain the label prefix.
if (lyxrc.label_init_length <= 0)
return text;
// Will contain the label type.
docstring name; docstring name;
// For section, subsection, etc... // For section, subsection, etc...
@ -1866,7 +1868,7 @@ docstring Text::getPossibleLabel(Cursor const & cur) const
if (layout->latextype != LATEX_PARAGRAPH) if (layout->latextype != LATEX_PARAGRAPH)
name = layout->refprefix; name = layout->refprefix;
// for captions, we just take the caption type // For captions, we just take the caption type
Inset * caption_inset = cur.innerInsetOfType(CAPTION_CODE); Inset * caption_inset = cur.innerInsetOfType(CAPTION_CODE);
if (caption_inset) { if (caption_inset) {
string const & ftype = static_cast<InsetCaption *>(caption_inset)->type(); string const & ftype = static_cast<InsetCaption *>(caption_inset)->type();
@ -1886,9 +1888,8 @@ docstring Text::getPossibleLabel(Cursor const & cur) const
} }
if (!name.empty()) if (!name.empty())
// FIXME // FIXME refstyle
// we should allow customization of the separator or else change it // We should allow customization of the separator or else change it
// once we have refstyle
text = name + ':' + text; text = name + ':' + text;
return text; return text;

View File

@ -1275,8 +1275,9 @@ void InsetMathHull::doDispatch(Cursor & cur, FuncRequest & cmd)
cur.recordUndoInset(); cur.recordUndoInset();
row_type r = (type_ == hullMultline) ? nrows() - 1 : cur.row(); row_type r = (type_ == hullMultline) ? nrows() - 1 : cur.row();
docstring old_label = label(r); docstring old_label = label(r);
docstring const default_label = from_ascii( // FIXME refstyle
(lyxrc.label_init_length >= 0) ? "eq:" : ""); // Allow customization of this separator
docstring const default_label = from_ascii("eq:");
if (old_label.empty()) if (old_label.empty())
old_label = default_label; old_label = default_label;