more compact code...

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@24126 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2008-04-05 12:56:43 +00:00
parent 0e5945667a
commit 37e0c52f1d

View File

@ -551,41 +551,31 @@ int LyXRC::read(Lexer & lexrc)
case RC_DEFAULT_PAPERSIZE: case RC_DEFAULT_PAPERSIZE:
if (lexrc.next()) { if (lexrc.next()) {
string const size = string const size = ascii_lowercase(lexrc.getString());
ascii_lowercase(lexrc.getString());
if (size == "usletter") if (size == "usletter")
default_papersize = default_papersize = PAPER_USLETTER;
PAPER_USLETTER;
else if (size == "legal") else if (size == "legal")
default_papersize = default_papersize = PAPER_USLEGAL;
PAPER_USLEGAL;
else if (size == "executive") else if (size == "executive")
default_papersize = default_papersize = PAPER_USEXECUTIVE;
PAPER_USEXECUTIVE;
else if (size == "a3") else if (size == "a3")
default_papersize = default_papersize = PAPER_A3;
PAPER_A3;
else if (size == "a4") else if (size == "a4")
default_papersize = default_papersize = PAPER_A4;
PAPER_A4;
else if (size == "a5") else if (size == "a5")
default_papersize = default_papersize = PAPER_A5;
PAPER_A5;
else if (size == "b5") else if (size == "b5")
default_papersize = default_papersize = PAPER_B5;
PAPER_B5;
else if (size == "default") else if (size == "default")
default_papersize = default_papersize = PAPER_DEFAULT;
PAPER_DEFAULT;
} }
break; break;
case RC_VIEWDVI_PAPEROPTION: case RC_VIEWDVI_PAPEROPTION:
if (lexrc.next()) { if (lexrc.next())
view_dvi_paper_option = lexrc.getString(); view_dvi_paper_option = lexrc.getString();
} else { else
view_dvi_paper_option.erase(); view_dvi_paper_option.erase();
}
break; break;
case RC_CHKTEX_COMMAND: case RC_CHKTEX_COMMAND:
@ -662,9 +652,8 @@ int LyXRC::read(Lexer & lexrc)
break; break;
case RC_USETEMPDIR: case RC_USETEMPDIR:
if (lexrc.next()) { if (lexrc.next())
lyxerr << "Ignoring obsolete use_tempdir flag." << endl; lyxerr << "Ignoring obsolete use_tempdir flag." << endl;
}
break; break;
case RC_USELASTFILEPOS: case RC_USELASTFILEPOS:
@ -747,21 +736,15 @@ int LyXRC::read(Lexer & lexrc)
break; break;
case RC_SCREEN_FONT_ROMAN_FOUNDRY: case RC_SCREEN_FONT_ROMAN_FOUNDRY:
if (lexrc.next()) { lexrc >> roman_font_foundry;
roman_font_foundry = lexrc.getString();
}
break; break;
case RC_SCREEN_FONT_SANS_FOUNDRY: case RC_SCREEN_FONT_SANS_FOUNDRY:
if (lexrc.next()) { lexrc >> sans_font_foundry;
sans_font_foundry = lexrc.getString();
}
break; break;
case RC_SCREEN_FONT_TYPEWRITER_FOUNDRY: case RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
if (lexrc.next()) { lexrc >> typewriter_font_foundry;
typewriter_font_foundry = lexrc.getString();
}
break; break;
case RC_SET_COLOR: case RC_SET_COLOR:
@ -798,9 +781,7 @@ int LyXRC::read(Lexer & lexrc)
} }
case RC_AUTOREGIONDELETE: case RC_AUTOREGIONDELETE:
// Auto region delete defaults to true // Auto region delete defaults to true
if (lexrc.next()) { lexrc >> auto_region_delete;
auto_region_delete = lexrc.getBool();
}
break; break;
case RC_SERVERPIPE: case RC_SERVERPIPE:
@ -811,9 +792,7 @@ int LyXRC::read(Lexer & lexrc)
break; break;
case RC_CURSOR_FOLLOWS_SCROLLBAR: case RC_CURSOR_FOLLOWS_SCROLLBAR:
if (lexrc.next()) { lexrc >> cursor_follows_scrollbar;
cursor_follows_scrollbar = lexrc.getBool();
}
break; break;
case RC_MACRO_EDIT_STYLE: case RC_MACRO_EDIT_STYLE:
@ -827,86 +806,55 @@ int LyXRC::read(Lexer & lexrc)
break; break;
case RC_DIALOGS_ICONIFY_WITH_MAIN: case RC_DIALOGS_ICONIFY_WITH_MAIN:
if (lexrc.next()) { lexrc >> dialogs_iconify_with_main;
dialogs_iconify_with_main = lexrc.getBool();
}
break; break;
case RC_PLAINTEXT_ROFF_COMMAND: case RC_PLAINTEXT_ROFF_COMMAND:
if (lexrc.next()) { lexrc >> plaintext_roff_command;
plaintext_roff_command = lexrc.getString();
}
break; break;
case RC_PLAINTEXT_LINELEN: case RC_PLAINTEXT_LINELEN:
if (lexrc.next()) { lexrc >> plaintext_linelen;
plaintext_linelen = lexrc.getInteger();
}
break; break;
// Spellchecker settings: // Spellchecker settings:
case RC_USE_SPELL_LIB: case RC_USE_SPELL_LIB:
if (lexrc.next()) { lexrc >> use_spell_lib;
use_spell_lib = lexrc.getBool();
}
break; break;
case RC_SPELL_COMMAND: case RC_SPELL_COMMAND:
if (lexrc.next()) { lexrc >> isp_command;
isp_command = lexrc.getString();
}
break; break;
case RC_ACCEPT_COMPOUND: case RC_ACCEPT_COMPOUND:
if (lexrc.next()) { lexrc >> isp_accept_compound;
isp_accept_compound = lexrc.getBool();
}
break; break;
case RC_USE_INP_ENC: case RC_USE_INP_ENC:
if (lexrc.next()) { lexrc >> isp_use_input_encoding;
isp_use_input_encoding = lexrc.getBool();
}
break; break;
case RC_USE_ALT_LANG: case RC_USE_ALT_LANG:
if (lexrc.next()) { lexrc >> isp_use_alt_lang;
isp_use_alt_lang = lexrc.getBool();
}
break; break;
case RC_USE_PERS_DICT: case RC_USE_PERS_DICT:
if (lexrc.next()) { lexrc >> isp_use_pers_dict;
isp_use_pers_dict = lexrc.getBool();
}
break; break;
case RC_USE_TOOLTIP: case RC_USE_TOOLTIP:
if (lexrc.next()) { lexrc >> use_tooltip;
use_tooltip = lexrc.getBool();
}
break; break;
case RC_USE_PIXMAP_CACHE: case RC_USE_PIXMAP_CACHE:
if (lexrc.next()) { lexrc >> use_pixmap_cache;
use_pixmap_cache = lexrc.getBool();
}
break; break;
case RC_USE_ESC_CHARS: case RC_USE_ESC_CHARS:
if (lexrc.next()) { lexrc >> isp_use_esc_chars;
isp_use_esc_chars = lexrc.getBool();
}
break; break;
case RC_ALT_LANG: case RC_ALT_LANG:
if (lexrc.next()) { lexrc >> isp_alt_lang;
isp_alt_lang = lexrc.getString();
}
break; break;
case RC_PERS_DICT: case RC_PERS_DICT:
if (lexrc.next()) { if (lexrc.next())
isp_pers_dict = os::internal_path(lexrc.getString()); isp_pers_dict = os::internal_path(lexrc.getString());
}
break; break;
case RC_ESC_CHARS: case RC_ESC_CHARS:
if (lexrc.next()) { lexrc >> isp_esc_chars;
isp_esc_chars = lexrc.getString();
}
break; break;
case RC_MAKE_BACKUP: case RC_MAKE_BACKUP:
if (lexrc.next()) { lexrc >> make_backup;
make_backup = lexrc.getBool();
}
break; break;
case RC_BACKUPDIR_PATH: case RC_BACKUPDIR_PATH:
if (lexrc.next()) { if (lexrc.next()) {
@ -915,69 +863,43 @@ int LyXRC::read(Lexer & lexrc)
} }
break; break;
case RC_DATE_INSERT_FORMAT: case RC_DATE_INSERT_FORMAT:
if (lexrc.next()) { lexrc >> date_insert_format;
date_insert_format = lexrc.getString();
}
break; break;
case RC_LANGUAGE_PACKAGE: case RC_LANGUAGE_PACKAGE:
if (lexrc.next()) { lexrc >> language_package;
language_package = lexrc.getString();
}
break; break;
case RC_LANGUAGE_AUTO_BEGIN: case RC_LANGUAGE_AUTO_BEGIN:
if (lexrc.next()) { lexrc >> language_auto_begin;
language_auto_begin = lexrc.getBool();
}
break; break;
case RC_LANGUAGE_AUTO_END: case RC_LANGUAGE_AUTO_END:
if (lexrc.next()) { lexrc >> language_auto_end;
language_auto_end = lexrc.getBool();
}
break; break;
case RC_LANGUAGE_GLOBAL_OPTIONS: case RC_LANGUAGE_GLOBAL_OPTIONS:
if (lexrc.next()) { lexrc >> language_global_options;
language_global_options = lexrc.getBool();
}
break; break;
case RC_LANGUAGE_USE_BABEL: case RC_LANGUAGE_USE_BABEL:
if (lexrc.next()) { lexrc >> language_use_babel;
language_use_babel = lexrc.getBool();
}
break; break;
case RC_LANGUAGE_COMMAND_BEGIN: case RC_LANGUAGE_COMMAND_BEGIN:
if (lexrc.next()) { lexrc >> language_command_begin;
language_command_begin = lexrc.getString();
}
break; break;
case RC_LANGUAGE_COMMAND_END: case RC_LANGUAGE_COMMAND_END:
if (lexrc.next()) { lexrc >> language_command_end;
language_command_end = lexrc.getString();
}
break; break;
case RC_LANGUAGE_COMMAND_LOCAL: case RC_LANGUAGE_COMMAND_LOCAL:
if (lexrc.next()) { lexrc >> language_command_local;
language_command_local = lexrc.getString();
}
break; break;
case RC_RTL_SUPPORT: case RC_RTL_SUPPORT:
if (lexrc.next()) { lexrc >> rtl_support;
rtl_support = lexrc.getBool();
}
break; break;
case RC_VISUAL_CURSOR: case RC_VISUAL_CURSOR:
if (lexrc.next()) { lexrc >> visual_cursor;
visual_cursor = lexrc.getBool();
}
break; break;
case RC_AUTO_NUMBER: case RC_AUTO_NUMBER:
if (lexrc.next()) { lexrc >> auto_number;
auto_number = lexrc.getBool();
}
break; break;
case RC_MARK_FOREIGN_LANGUAGE: case RC_MARK_FOREIGN_LANGUAGE:
if (lexrc.next()) { lexrc >> mark_foreign_language;
mark_foreign_language = lexrc.getBool();
}
break; break;
case RC_COPIER: { case RC_COPIER: {
@ -1037,12 +959,10 @@ int LyXRC::read(Lexer & lexrc)
<< format << "'." << endl; << format << "'." << endl;
} }
if (prettyname.empty()) { if (prettyname.empty()) {
if (theConverters().formatIsUsed(format)) { if (theConverters().formatIsUsed(format))
lyxerr << "Can't delete format " LYXERR0( "Can't delete format " << format);
<< format << endl; else
} else {
formats.erase(format); formats.erase(format);
}
} else { } else {
formats.add(format, extension, prettyname, formats.add(format, extension, prettyname,
shortcut, viewer, editor, flgs); shortcut, viewer, editor, flgs);
@ -1050,21 +970,15 @@ int LyXRC::read(Lexer & lexrc)
break; break;
} }
case RC_DEFAULT_LANGUAGE: case RC_DEFAULT_LANGUAGE:
if (lexrc.next()) { lexrc >> default_language;
default_language = lexrc.getString();
}
break; break;
case RC_LABEL_INIT_LENGTH: case RC_LABEL_INIT_LENGTH:
if (lexrc.next()) { lexrc >> label_init_length;
label_init_length = lexrc.getInteger();
}
break; break;
case RC_SHOW_BANNER: case RC_SHOW_BANNER:
if (lexrc.next()) { lexrc >> show_banner;
show_banner = lexrc.getBool();
}
break; break;
case RC_PREVIEW: case RC_PREVIEW:
@ -1085,81 +999,61 @@ int LyXRC::read(Lexer & lexrc)
break; break;
case RC_PREVIEW_HASHED_LABELS: case RC_PREVIEW_HASHED_LABELS:
if (lexrc.next()) { lexrc >> preview_hashed_labels;
preview_hashed_labels = lexrc.getBool();
}
break; break;
case RC_PREVIEW_SCALE_FACTOR: case RC_PREVIEW_SCALE_FACTOR:
if (lexrc.next()) { lexrc >> preview_scale_factor;
preview_scale_factor = lexrc.getString();
}
break; break;
case RC_USER_NAME: case RC_USER_NAME:
if (lexrc.next()) lexrc >> user_name;
user_name = lexrc.getString();
break; break;
case RC_USER_EMAIL: case RC_USER_EMAIL:
if (lexrc.next()) lexrc >> user_email;
user_email = lexrc.getString();
break; break;
case RC_PATH_PREFIX: case RC_PATH_PREFIX:
if (lexrc.next()) lexrc >> path_prefix;
path_prefix = lexrc.getString();
break; break;
case RC_USE_CONVERTER_CACHE: case RC_USE_CONVERTER_CACHE:
if (lexrc.next()) lexrc >> use_converter_cache;
use_converter_cache = lexrc.getBool();
break; break;
case RC_CONVERTER_CACHE_MAXAGE: case RC_CONVERTER_CACHE_MAXAGE:
if (lexrc.next()) lexrc >> converter_cache_maxage;
converter_cache_maxage =
convert<unsigned int>(lexrc.getString());
break; break;
case RC_SORT_LAYOUTS: case RC_SORT_LAYOUTS:
if (lexrc.next()) lexrc >> sort_layouts;
sort_layouts = lexrc.getBool();
break; break;
case RC_GROUP_LAYOUTS: case RC_GROUP_LAYOUTS:
if (lexrc.next()) lexrc >> group_layouts;
group_layouts = lexrc.getBool();
break; break;
case RC_FULL_SCREEN_LIMIT: case RC_FULL_SCREEN_LIMIT:
if (lexrc.next()) lexrc >> full_screen_limit;
full_screen_limit = lexrc.getBool();
break; break;
case RC_FULL_SCREEN_TOOLBARS: case RC_FULL_SCREEN_TOOLBARS:
if (lexrc.next()) lexrc >> full_screen_toolbars;
full_screen_toolbars = lexrc.getBool();
break; break;
case RC_FULL_SCREEN_SCROLLBAR: case RC_FULL_SCREEN_SCROLLBAR:
if (lexrc.next()) lexrc >> full_screen_scrollbar;
full_screen_scrollbar = lexrc.getBool();
break; break;
case RC_FULL_SCREEN_TABBAR: case RC_FULL_SCREEN_TABBAR:
if (lexrc.next()) lexrc >> full_screen_tabbar;
full_screen_tabbar = lexrc.getBool();
break; break;
case RC_FULL_SCREEN_WIDTH: case RC_FULL_SCREEN_WIDTH:
if (lexrc.next()) lexrc >> full_screen_width;
full_screen_width = lexrc.getInteger();
break; break;
case RC_OPEN_BUFFERS_IN_TABS: case RC_OPEN_BUFFERS_IN_TABS:
if (lexrc.next()) lexrc >> open_buffers_in_tabs;
open_buffers_in_tabs = lexrc.getBool();
break; break;
case RC_USE_BUNDLED_FORMAT: case RC_USE_BUNDLED_FORMAT:
if (lexrc.next()) lexrc >> use_bundled_format;
use_bundled_format = lexrc.getBool(); break;
break;
case RC_LAST: break; // this is just a dummy case RC_LAST:
break; // this is just a dummy
} }
} }