+2001-02-23 Dekel Tsur <dekelts@tau.ac.il>
+
+ * lyxrc.C: Add language_command_local, language_use_babel and
+ language_global_options.
+
+ * lyxfont.C (latexWriteStartChanges): Use language_command_local.
+
+ * buffer.C (makeLaTeXFile): Use language_use_babel and
+ language_global_options.
+
2001-02-23 Juergen Vigna <jug@sad.it>
* lyxfunc.C (Dispatch): removed the whole part of the switch statement
ofs << "\n";
}
+bool use_babel;
void Buffer::makeLaTeXFile(string const & fname,
string const & original_path,
options += "landscape,";
// language should be a parameter to \documentclass
- bool use_babel = false;
+ use_babel = false;
+ string language_options;
if (params.language->babel() == "hebrew"
&& default_language->babel() != "hebrew")
// This seems necessary
features.UsedLanguages.insert(default_language);
+
+ if (lyxrc.language_use_babel ||
#ifdef DO_USE_DEFAULT_LANGUAGE
- if (params.language->lang() != "default" ||
- !features.UsedLanguages.empty()) {
+ params.language->lang() != "default" ||
#endif
+ params.language->lang() != lyxrc.default_language ||
+ !features.UsedLanguages.empty()) {
use_babel = true;
for (LaTeXFeatures::LanguageList::const_iterator cit =
features.UsedLanguages.begin();
cit != features.UsedLanguages.end(); ++cit)
- options += (*cit)->babel() + ",";
- options += params.language->babel() + ',';
-#ifdef DO_USE_DEFAULT_LANGUAGE
+ language_options += (*cit)->babel() + ',';
+ language_options += params.language->babel();
+ if (lyxrc.language_global_options)
+ options += language_options + ',';
}
-#endif
// the user-defined options
if (!params.options.empty()) {
// We try to load babel late, in case it interferes
// with other packages.
if (use_babel) {
- ofs << lyxrc.language_package << endl;
+ string tmp = lyxrc.language_package;
+ if (!lyxrc.language_global_options
+ && tmp == "\\usepackage{babel}")
+ tmp = "\\usepackage[" +
+ language_options + "]{babel}";
+ ofs << tmp << "\n";
texrow.newline();
}
+2001-02-23 Dekel Tsur <dekelts@tau.ac.il>
+
+ * FormPreferences.C: Handle lyxrc.language_use_babel and
+ lyxrc.language_global_options.
+
2001-02-23 Angus Leeming <a.leeming@ic.ac.uk>
* FormPreferences(GetFrom, GetTo): use size_type rather than int.
string const FormPreferences::Converters::GetFrom() const
{
- Formats::FormatList::size_type const i =
+ ::Formats::FormatList::size_type const i =
fl_get_choice(dialog_->choice_from);
if (i > 0 && i <= local_formats.size())
string const FormPreferences::Converters::GetTo() const
{
- Formats::FormatList::size_type const i =
+ ::Formats::FormatList::size_type const i =
fl_get_choice(dialog_->choice_from);
if (i > 0 && i <= local_formats.size())
button = fl_get_button(dialog_->check_rtl_support);
lyxrc.rtl_support = static_cast<bool>(button);
+ button = fl_get_button(dialog_->check_mark_foreign);
+ lyxrc.mark_foreign_language = static_cast<bool>(button);
+
button = fl_get_button(dialog_->check_auto_begin);
lyxrc.language_auto_begin = static_cast<bool>(button);
button = fl_get_button(dialog_->check_auto_end);
lyxrc.language_auto_end = static_cast<bool>(button);
- button = fl_get_button(dialog_->check_mark_foreign);
- lyxrc.mark_foreign_language = static_cast<bool>(button);
+ button = fl_get_button(dialog_->check_use_babel);
+ lyxrc.language_use_babel = static_cast<bool>(button);
+
+ button = fl_get_button(dialog_->check_global_options);
+ lyxrc.language_global_options = static_cast<bool>(button);
lyxrc.language_package = fl_get_input(dialog_->input_package);
lyxrc.language_command_begin = fl_get_input(dialog_->input_command_begin);
setPreHandler(dialog_->check_mark_foreign);
setPreHandler(dialog_->check_auto_begin);
setPreHandler(dialog_->check_auto_end);
+ setPreHandler(dialog_->check_use_babel);
+ setPreHandler(dialog_->check_global_options);
setPreHandler(dialog_->input_command_begin);
setPreHandler(dialog_->input_command_end);
str = lyxrc.getDescription(LyXRC::RC_KBMAP_SECONDARY);
else if (ob == dialog_->check_rtl_support)
str = lyxrc.getDescription(LyXRC::RC_RTL_SUPPORT);
+ else if (ob == dialog_->check_mark_foreign)
+ str = lyxrc.getDescription(LyXRC::RC_MARK_FOREIGN_LANGUAGE);
else if (ob == dialog_->check_auto_begin)
str = lyxrc.getDescription(LyXRC::RC_LANGUAGE_AUTO_BEGIN);
else if (ob == dialog_->check_auto_end)
str = lyxrc.getDescription(LyXRC::RC_LANGUAGE_AUTO_END);
- else if (ob == dialog_->check_mark_foreign)
- str = lyxrc.getDescription(LyXRC::RC_MARK_FOREIGN_LANGUAGE);
+ else if (ob == dialog_->check_use_babel)
+ str = lyxrc.getDescription(LyXRC::RC_LANGUAGE_USE_BABEL);
+ else if (ob == dialog_->check_global_options)
+ str = lyxrc.getDescription(LyXRC::RC_LANGUAGE_GLOBAL_OPTIONS);
else if (ob == dialog_->input_package)
str = lyxrc.getDescription(LyXRC::RC_LANGUAGE_PACKAGE);
else if (ob == dialog_->input_command_begin)
}
fl_set_button(dialog_->check_rtl_support, lyxrc.rtl_support);
- fl_set_button(dialog_->check_auto_begin, lyxrc.language_auto_begin);
- fl_set_button(dialog_->check_auto_end, lyxrc.language_auto_end);
fl_set_button(dialog_->check_mark_foreign,
lyxrc.mark_foreign_language);
+ fl_set_button(dialog_->check_auto_begin, lyxrc.language_auto_begin);
+ fl_set_button(dialog_->check_auto_end, lyxrc.language_auto_end);
+ fl_set_button(dialog_->check_use_babel, lyxrc.language_use_babel);
+ fl_set_button(dialog_->check_global_options,
+ lyxrc.language_global_options);
fl_set_input(dialog_->input_package,
lyxrc.language_package.c_str());
fl_set_object_callback(obj, C_FormBaseInputCB, 0);
{
char const * const dummy = N_("RtL support|#R");
- fdui->check_rtl_support = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 154, 161, 30, 30, idex(_(dummy)));
+ fdui->check_rtl_support = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 140, 161, 30, 30, idex(_(dummy)));
fl_set_button_shortcut(obj, scex(_(dummy)), 1);
}
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_callback(obj, C_FormBaseInputCB, 0);
{
char const * const dummy = N_("Mark foreign|#M");
- fdui->check_mark_foreign = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 154, 187, 30, 30, idex(_(dummy)));
+ fdui->check_mark_foreign = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 140, 187, 30, 30, idex(_(dummy)));
fl_set_button_shortcut(obj, scex(_(dummy)), 1);
}
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_callback(obj, C_FormBaseInputCB, 0);
{
char const * const dummy = N_("Auto begin|#b");
- fdui->check_auto_begin = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 362, 161, 30, 30, idex(_(dummy)));
+ fdui->check_auto_begin = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 265, 161, 30, 30, idex(_(dummy)));
fl_set_button_shortcut(obj, scex(_(dummy)), 1);
}
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_callback(obj, C_FormBaseInputCB, 0);
{
char const * const dummy = N_("Auto finish|#f");
- fdui->check_auto_end = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 362, 187, 30, 30, idex(_(dummy)));
+ fdui->check_auto_end = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 265, 187, 30, 30, idex(_(dummy)));
fl_set_button_shortcut(obj, scex(_(dummy)), 1);
}
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_callback(obj, C_FormBaseInputCB, 0);
fdui->button_kbmap2_browse = obj = fl_add_button(FL_NORMAL_BUTTON, 341, 128, 90, 30, _("Browse"));
fl_set_object_callback(obj, C_FormBaseInputCB, 0);
+ {
+ char const * const dummy = N_("Use babel|#U");
+ fdui->check_use_babel = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 390, 161, 30, 30, idex(_(dummy)));
+ fl_set_button_shortcut(obj, scex(_(dummy)), 1);
+ }
+ fl_set_object_lsize(obj, FL_NORMAL_SIZE);
+ fl_set_object_lalign(obj, FL_ALIGN_LEFT);
+ fl_set_object_callback(obj, C_FormBaseInputCB, 0);
+ {
+ char const * const dummy = N_("Global|#G");
+ fdui->check_global_options = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 390, 187, 30, 30, idex(_(dummy)));
+ fl_set_button_shortcut(obj, scex(_(dummy)), 1);
+ }
+ fl_set_object_lsize(obj, FL_NORMAL_SIZE);
+ fl_set_object_lalign(obj, FL_ALIGN_LEFT);
+ fl_set_object_callback(obj, C_FormBaseInputCB, 0);
fl_end_form();
fdui->form->fdui = fdui;
FL_OBJECT *input_kbmap2;
FL_OBJECT *button_kbmap1_browse;
FL_OBJECT *button_kbmap2_browse;
+ FL_OBJECT *check_use_babel;
+ FL_OBJECT *check_global_options;
};
struct FD_form_colors {
~FD_form_colors();
Name: form_language
Width: 450
Height: 360
-Number of Objects: 14
+Number of Objects: 16
--------------------
class: FL_BOX
--------------------
class: FL_CHECKBUTTON
type: PUSH_BUTTON
-box: 154 161 30 30
+box: 140 161 30 30
boxtype: FL_NO_BOX
colors: FL_COL1 FL_YELLOW
alignment: FL_ALIGN_LEFT
--------------------
class: FL_CHECKBUTTON
type: PUSH_BUTTON
-box: 154 187 30 30
+box: 140 187 30 30
boxtype: FL_NO_BOX
colors: FL_COL1 FL_YELLOW
alignment: FL_ALIGN_LEFT
--------------------
class: FL_CHECKBUTTON
type: PUSH_BUTTON
-box: 362 161 30 30
+box: 265 161 30 30
boxtype: FL_NO_BOX
colors: FL_COL1 FL_YELLOW
alignment: FL_ALIGN_LEFT
--------------------
class: FL_CHECKBUTTON
type: PUSH_BUTTON
-box: 362 187 30 30
+box: 265 187 30 30
boxtype: FL_NO_BOX
colors: FL_COL1 FL_YELLOW
alignment: FL_ALIGN_LEFT
callback: C_FormBaseInputCB
argument: 0
+--------------------
+class: FL_CHECKBUTTON
+type: PUSH_BUTTON
+box: 390 161 30 30
+boxtype: FL_NO_BOX
+colors: FL_COL1 FL_YELLOW
+alignment: FL_ALIGN_LEFT
+style: FL_NORMAL_STYLE
+size: FL_NORMAL_SIZE
+lcol: FL_BLACK
+label: Use babel|#U
+shortcut:
+resize: FL_RESIZE_ALL
+gravity: FL_NoGravity FL_NoGravity
+name: check_use_babel
+callback: C_FormBaseInputCB
+argument: 0
+
+--------------------
+class: FL_CHECKBUTTON
+type: PUSH_BUTTON
+box: 390 187 30 30
+boxtype: FL_NO_BOX
+colors: FL_COL1 FL_YELLOW
+alignment: FL_ALIGN_LEFT
+style: FL_NORMAL_STYLE
+size: FL_NORMAL_SIZE
+lcol: FL_BLACK
+label: Global|#G
+shortcut:
+resize: FL_RESIZE_ALL
+gravity: FL_NoGravity FL_NoGravity
+name: check_global_options
+callback: C_FormBaseInputCB
+argument: 0
+
=============== FORM ===============
Name: form_colors
Width: 450
}
+extern bool use_babel;
+
int InsetQuotes::Latex(Buffer const * buf, ostream & os,
bool /*fragile*/, bool) const
{
- string doclang = buf->GetLanguage()->lang();
+ string const doclang = buf->GetLanguage()->lang();
int quoteind = quote_index[side][language];
string qstr;
if (lyxrc.fontenc == "T1") {
qstr = latex_quote_t1[times][quoteind];
+#ifdef DO_USE_DEFAULT_LANGUAGE
} else if (doclang == "default") {
+#else
+ } else if (!use_babel) {
+#endif
qstr = latex_quote_ot1[times][quoteind];
} else if (language == InsetQuotes::FrenchQ
&& times == InsetQuotes::DoubleQ
count += 3;
}
} else {
- string tmp = '{' +
- subst(lyxrc.language_command_begin,
+ string tmp =
+ subst(lyxrc.language_command_local,
"$$lang", language()->babel());
os << tmp;
count += tmp.length();
{ "\\language_auto_end", LyXRC::RC_LANGUAGE_AUTO_END },
{ "\\language_command_begin", LyXRC::RC_LANGUAGE_COMMAND_BEGIN },
{ "\\language_command_end", LyXRC::RC_LANGUAGE_COMMAND_END },
+ { "\\language_command_local", LyXRC::RC_LANGUAGE_COMMAND_LOCAL },
+ { "\\language_global_options", LyXRC::RC_LANGUAGE_GLOBAL_OPTIONS },
{ "\\language_package", LyXRC::RC_LANGUAGE_PACKAGE },
+ { "\\language_use_babel", LyXRC::RC_LANGUAGE_USE_BABEL },
{ "\\lastfiles", LyXRC::RC_LASTFILES },
{ "\\make_backup", LyXRC::RC_MAKE_BACKUP },
{ "\\mark_foreign_language", LyXRC::RC_MARK_FOREIGN_LANGUAGE },
rtl_support = false;
auto_number = true;
mark_foreign_language = true;
- language_package = "\\usepackage{babel}";
language_auto_begin = true;
language_auto_end = true;
+ language_global_options = true;
+ language_use_babel = true;
+ language_package = "\\usepackage{babel}";
language_command_begin = "\\selectlanguage{$$lang}";
language_command_end = "\\selectlanguage{$$lang}";
+ language_command_local = "\\foreignlanguage{$$lang}{";
default_language = "english";
//
new_ask_filename = false;
if (lexrc.next())
language_auto_end = lexrc.GetBool();
break;
+ case RC_LANGUAGE_GLOBAL_OPTIONS:
+ if (lexrc.next())
+ language_global_options = lexrc.GetBool();
+ break;
+ case RC_LANGUAGE_USE_BABEL:
+ if (lexrc.next())
+ language_use_babel = lexrc.GetBool();
+ break;
case RC_LANGUAGE_COMMAND_BEGIN:
if (lexrc.next())
language_command_begin = lexrc.GetString();
if (lexrc.next())
language_command_end = lexrc.GetString();
break;
+ case RC_LANGUAGE_COMMAND_LOCAL:
+ if (lexrc.next())
+ language_command_local = lexrc.GetString();
+ break;
case RC_RTL_SUPPORT:
if (lexrc.next())
rtl_support = lexrc.GetBool();
os << "\\language_package \"" << language_package
<< "\"\n";
}
+ case RC_LANGUAGE_GLOBAL_OPTIONS:
+ if (language_global_options
+ != system_lyxrc.language_global_options) {
+ os << "\\language_global_options \""
+ << tostr(language_global_options)
+ << "\"\n";
+ }
+ case RC_LANGUAGE_USE_BABEL:
+ if (language_use_babel != system_lyxrc.language_use_babel) {
+ os << "\\language_use_babel \""
+ << tostr(language_use_babel)
+ << "\"\n";
+ }
case RC_LANGUAGE_COMMAND_BEGIN:
if (language_command_begin
!= system_lyxrc.language_command_begin) {
os << "\\language_command_end \"" << language_command_end
<< "\"\n";
}
+ case RC_LANGUAGE_COMMAND_LOCAL:
+ if (language_command_local
+ != system_lyxrc.language_command_local) {
+ os << "\\language_command_local \""
+ << language_command_local
+ << "\"\n";
+ }
case RC_LANGUAGE_AUTO_BEGIN:
if (language_auto_begin != system_lyxrc.language_auto_begin) {
os << "\\language_auto_begin "
case RC_LANGUAGE_PACKAGE:
str = N_("The latex command for loading the language package. E.g. \"\\usepackage{babel}\", \"\\usepackage{omega}\".");
break;
+
+ case RC_LANGUAGE_GLOBAL_OPTIONS:
+ str = N_("De-select if you don't want the language(s) used as an argument to \\documentclass.");
+ break;
+
+ case RC_LANGUAGE_USE_BABEL:
+ str = N_("De-select if you don't want babel to be used when the language of the document is the default language.");
+ break;
case RC_LANGUAGE_AUTO_BEGIN:
str = N_("Select if a language switching command is needed at the beginning of the document.");
case RC_LANGUAGE_COMMAND_END:
str = N_("The latex command for changing back to the language of the document.");
break;
-
+
+ case RC_LANGUAGE_COMMAND_LOCAL:
+ str = N_("The latex command for local changing of the language.");
+ break;
+
case RC_DATE_INSERT_FORMAT:
//xgettext:no-c-format
str = N_("This accepts the normal strftime formats; see man strftime for full details. E.g.\"%A, %e. %B %Y\".");
RC_LANGUAGE_AUTO_END,
RC_LANGUAGE_COMMAND_BEGIN,
RC_LANGUAGE_COMMAND_END,
+ RC_LANGUAGE_COMMAND_LOCAL,
+ RC_LANGUAGE_GLOBAL_OPTIONS,
+ RC_LANGUAGE_USE_BABEL,
RC_DATE_INSERT_FORMAT,
RC_SHOW_BANNER,
RC_WHEEL_JUMP,
///
string language_command_end;
///
+ string language_command_local;
+ ///
+ bool language_global_options;
+ ///
+ bool language_use_babel;
+ ///
bool rtl_support;
///
bool auto_number;