2002-03-11 17:00:41 +00:00
|
|
|
/**
|
|
|
|
* \file FormPreferences.C
|
|
|
|
* Copyright 2000-2001 The LyX Team.
|
|
|
|
* See the file COPYING.
|
2000-11-13 10:35:02 +00:00
|
|
|
*
|
2002-03-11 17:00:41 +00:00
|
|
|
* \author Angus Leeming, a.leeming@ic.ac.uk
|
2000-06-12 11:55:12 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <config.h>
|
2000-07-27 10:26:38 +00:00
|
|
|
|
2002-04-23 08:16:27 +00:00
|
|
|
#ifdef __GNUG__
|
2000-07-27 10:26:38 +00:00
|
|
|
#pragma implementation
|
|
|
|
#endif
|
|
|
|
|
2000-06-12 11:55:12 +00:00
|
|
|
#include "FormPreferences.h"
|
2002-06-13 13:43:51 +00:00
|
|
|
#include "forms/form_preferences.h"
|
2002-08-14 19:19:47 +00:00
|
|
|
|
|
|
|
#include "combox.h"
|
|
|
|
#include "Color.h"
|
|
|
|
#include "input_validators.h"
|
|
|
|
#include "forms_gettext.h"
|
|
|
|
#include "xforms_helpers.h"
|
|
|
|
#include "helper_funcs.h"
|
2002-03-22 15:24:32 +00:00
|
|
|
|
|
|
|
#include "buffer.h"
|
|
|
|
#include "converter.h"
|
|
|
|
#include "debug.h"
|
2001-04-24 17:33:01 +00:00
|
|
|
#include "language.h"
|
2002-04-29 16:16:35 +00:00
|
|
|
#include "frnt_lang.h"
|
2002-03-22 15:24:32 +00:00
|
|
|
#include "lyxlex.h"
|
2000-06-12 11:55:12 +00:00
|
|
|
#include "lyxrc.h"
|
2002-03-22 15:24:32 +00:00
|
|
|
#include "LColor.h"
|
|
|
|
#include "Lsstream.h"
|
2002-08-07 08:11:41 +00:00
|
|
|
#include "funcrequest.h"
|
2002-03-22 15:24:32 +00:00
|
|
|
|
2002-08-14 19:19:47 +00:00
|
|
|
#include "frontends/LyXView.h"
|
|
|
|
#include "frontends/Dialogs.h"
|
2002-02-16 15:59:55 +00:00
|
|
|
|
2000-11-06 11:20:22 +00:00
|
|
|
#include "support/lyxfunctional.h"
|
2000-11-15 03:22:08 +00:00
|
|
|
#include "support/lyxmanip.h"
|
2002-02-16 15:59:55 +00:00
|
|
|
#include "support/filetools.h"
|
|
|
|
#include "support/LAssert.h"
|
2000-11-06 11:20:22 +00:00
|
|
|
|
2002-02-27 09:59:52 +00:00
|
|
|
#include "graphics/GraphicsCache.h"
|
|
|
|
|
2002-05-29 16:21:03 +00:00
|
|
|
#include <boost/bind.hpp>
|
|
|
|
|
2002-06-13 13:43:51 +00:00
|
|
|
#include FORMS_H_LOCATION
|
2002-03-22 15:24:32 +00:00
|
|
|
#include <utility>
|
|
|
|
#include <iomanip>
|
|
|
|
#include <X11/Xlib.h>
|
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
using std::endl;
|
2000-11-03 09:47:02 +00:00
|
|
|
using std::pair;
|
2000-11-21 21:51:25 +00:00
|
|
|
using std::make_pair;
|
2000-11-13 10:35:02 +00:00
|
|
|
using std::max;
|
2000-11-21 21:51:25 +00:00
|
|
|
using std::min;
|
2000-10-30 11:33:05 +00:00
|
|
|
using std::vector;
|
2002-02-16 15:59:55 +00:00
|
|
|
using std::setw;
|
|
|
|
using std::setfill;
|
|
|
|
|
2000-11-08 09:39:46 +00:00
|
|
|
extern string system_lyxdir;
|
2000-11-13 10:35:02 +00:00
|
|
|
extern string user_lyxdir;
|
2000-06-12 11:55:12 +00:00
|
|
|
|
2001-03-20 01:22:46 +00:00
|
|
|
namespace {
|
|
|
|
|
2000-11-21 15:46:13 +00:00
|
|
|
// These should probably go inside the class definition...
|
2001-03-20 01:22:46 +00:00
|
|
|
Formats local_formats;
|
|
|
|
Converters local_converters;
|
|
|
|
|
|
|
|
} // namespace anon
|
|
|
|
|
2000-11-09 15:28:42 +00:00
|
|
|
|
2002-06-18 15:44:30 +00:00
|
|
|
FormPreferences::FormPreferences(LyXView & lv, Dialogs & d)
|
|
|
|
: FormBaseBI(&lv, &d, _("Preferences"), false),
|
2000-11-14 13:46:01 +00:00
|
|
|
colors_(*this), converters_(*this), inputs_misc_(*this),
|
2002-03-21 21:21:28 +00:00
|
|
|
formats_(*this), interface_(*this), language_(*this),
|
2000-11-14 13:46:01 +00:00
|
|
|
lnf_misc_(*this), outputs_misc_(*this), paths_(*this),
|
2001-07-13 11:50:39 +00:00
|
|
|
printer_(*this), screen_fonts_(*this), spelloptions_(*this)
|
2000-06-12 11:55:12 +00:00
|
|
|
{
|
|
|
|
// let the dialog be shown
|
|
|
|
// This is a permanent connection so we won't bother
|
|
|
|
// storing a copy because we won't be disconnecting.
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-11-10 17:29:47 +00:00
|
|
|
void FormPreferences::redraw()
|
|
|
|
{
|
2000-11-14 02:01:57 +00:00
|
|
|
if (!(form() && form()->visible))
|
2000-11-10 17:29:47 +00:00
|
|
|
return;
|
2000-11-14 02:01:57 +00:00
|
|
|
fl_redraw_form(form());
|
2000-11-10 17:29:47 +00:00
|
|
|
|
2000-11-13 10:35:02 +00:00
|
|
|
FL_FORM * form2 = fl_get_active_folder(dialog_->tabfolder_prefs);
|
2000-11-14 02:01:57 +00:00
|
|
|
if (!(form2 && form2->visible))
|
2000-11-10 17:29:47 +00:00
|
|
|
return;
|
2000-11-14 02:01:57 +00:00
|
|
|
fl_redraw_form(form2);
|
2000-11-10 17:29:47 +00:00
|
|
|
|
2000-11-13 10:35:02 +00:00
|
|
|
FL_FORM * form3 = 0;
|
2000-11-14 02:01:57 +00:00
|
|
|
if (form2 == converters_tab_->form)
|
2002-01-17 10:53:14 +00:00
|
|
|
form3 = fl_get_active_folder(converters_tab_->tabfolder_inner);
|
2000-11-10 17:29:47 +00:00
|
|
|
|
2000-11-14 02:01:57 +00:00
|
|
|
else if (form2 == look_n_feel_tab_->form)
|
2002-01-17 10:53:14 +00:00
|
|
|
form3 = fl_get_active_folder(look_n_feel_tab_->tabfolder_inner);
|
2000-11-10 17:29:47 +00:00
|
|
|
|
2000-11-14 02:01:57 +00:00
|
|
|
else if (form2 == inputs_tab_->form)
|
2002-01-17 10:53:14 +00:00
|
|
|
form3 = fl_get_active_folder(inputs_tab_->tabfolder_inner);
|
2000-11-10 17:29:47 +00:00
|
|
|
|
2000-11-14 02:01:57 +00:00
|
|
|
else if (form2 == outputs_tab_->form)
|
2002-01-17 10:53:14 +00:00
|
|
|
form3 = fl_get_active_folder(outputs_tab_->tabfolder_inner);
|
2000-11-10 17:29:47 +00:00
|
|
|
|
2000-11-21 21:51:25 +00:00
|
|
|
else if (form2 == lang_opts_tab_->form)
|
2002-01-17 10:53:14 +00:00
|
|
|
form3 = fl_get_active_folder(lang_opts_tab_->tabfolder_inner);
|
2000-11-10 17:29:47 +00:00
|
|
|
|
2000-11-13 10:35:02 +00:00
|
|
|
if (form3 && form3->visible)
|
2000-11-21 15:46:13 +00:00
|
|
|
fl_redraw_form(form3);
|
2000-11-10 17:29:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-10-27 10:04:51 +00:00
|
|
|
FL_FORM * FormPreferences::form() const
|
|
|
|
{
|
2002-07-17 15:34:00 +00:00
|
|
|
return dialog_.get() ? dialog_->form : 0;
|
2000-10-27 10:04:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void FormPreferences::ok()
|
|
|
|
{
|
2001-03-15 13:37:04 +00:00
|
|
|
FormBaseDeprecated::ok();
|
2000-11-13 10:35:02 +00:00
|
|
|
|
2001-03-05 19:02:40 +00:00
|
|
|
if (colors_.modifiedXformsPrefs) {
|
2000-11-17 00:07:41 +00:00
|
|
|
string const filename =
|
|
|
|
AddName(user_lyxdir, "preferences.xform");
|
2001-03-05 19:02:40 +00:00
|
|
|
colors_.modifiedXformsPrefs = !XformsColor::write(filename);
|
2000-11-13 10:35:02 +00:00
|
|
|
}
|
2002-03-21 21:21:28 +00:00
|
|
|
|
2002-08-13 17:43:40 +00:00
|
|
|
lv_->dispatch(FuncRequest(LFUN_SAVEPREFERENCES));
|
2000-10-27 10:04:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-10-10 04:12:56 +00:00
|
|
|
void FormPreferences::hide()
|
|
|
|
{
|
2000-10-11 07:59:25 +00:00
|
|
|
// We need to hide the active tabfolder otherwise we get a
|
2001-09-27 09:39:25 +00:00
|
|
|
// BadDrawable error from X window and LyX crashes without saving.
|
2002-01-17 10:53:14 +00:00
|
|
|
FL_FORM * inner_form = fl_get_active_folder(dialog_->tabfolder_prefs);
|
2002-07-17 15:34:00 +00:00
|
|
|
if (inner_form && inner_form->visible)
|
2002-01-17 10:53:14 +00:00
|
|
|
fl_hide_form(inner_form);
|
2001-03-15 13:37:04 +00:00
|
|
|
FormBaseDeprecated::hide();
|
2000-10-10 04:12:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-06-12 11:55:12 +00:00
|
|
|
void FormPreferences::build()
|
|
|
|
{
|
2002-06-13 13:43:51 +00:00
|
|
|
dialog_.reset(build_preferences(this));
|
2000-08-14 05:24:35 +00:00
|
|
|
|
2000-11-28 06:46:06 +00:00
|
|
|
// Manage the restore, save, apply and cancel/close buttons
|
2001-03-15 13:37:04 +00:00
|
|
|
bc().setOK(dialog_->button_ok);
|
|
|
|
bc().setApply(dialog_->button_apply);
|
2002-03-12 14:11:15 +00:00
|
|
|
bc().setCancel(dialog_->button_close);
|
2001-04-03 14:30:58 +00:00
|
|
|
bc().setRestore(dialog_->button_restore);
|
2000-08-14 05:24:35 +00:00
|
|
|
|
2002-03-11 09:54:42 +00:00
|
|
|
// Allow the base class to control messages
|
|
|
|
setMessageWidget(dialog_->text_warning);
|
2002-03-21 21:21:28 +00:00
|
|
|
|
2000-10-03 05:53:25 +00:00
|
|
|
// build the tab folders
|
2002-06-13 13:43:51 +00:00
|
|
|
converters_tab_.reset(build_preferences_inner_tab(this));
|
|
|
|
look_n_feel_tab_.reset(build_preferences_inner_tab(this));
|
|
|
|
inputs_tab_.reset(build_preferences_inner_tab(this));
|
|
|
|
outputs_tab_.reset(build_preferences_inner_tab(this));
|
|
|
|
lang_opts_tab_.reset(build_preferences_inner_tab(this));
|
2000-10-03 05:53:25 +00:00
|
|
|
|
|
|
|
// build actual tabfolder contents
|
|
|
|
// these will become nested tabfolders
|
2000-11-14 13:46:01 +00:00
|
|
|
colors_.build();
|
|
|
|
converters_.build();
|
|
|
|
formats_.build();
|
|
|
|
inputs_misc_.build();
|
|
|
|
interface_.build();
|
|
|
|
language_.build();
|
|
|
|
lnf_misc_.build();
|
|
|
|
outputs_misc_.build();
|
|
|
|
paths_.build();
|
|
|
|
printer_.build();
|
|
|
|
screen_fonts_.build();
|
2001-07-13 11:50:39 +00:00
|
|
|
spelloptions_.build();
|
2000-07-28 04:59:45 +00:00
|
|
|
|
|
|
|
// Now add them to the tabfolder
|
2000-06-12 11:55:12 +00:00
|
|
|
fl_addto_tabfolder(dialog_->tabfolder_prefs,
|
2000-11-21 21:51:25 +00:00
|
|
|
_("Look & Feel"),
|
2000-10-03 05:53:25 +00:00
|
|
|
look_n_feel_tab_->form);
|
2000-11-03 17:05:42 +00:00
|
|
|
fl_addto_tabfolder(dialog_->tabfolder_prefs,
|
2000-11-21 21:51:25 +00:00
|
|
|
_("Lang Opts"),
|
|
|
|
lang_opts_tab_->form);
|
2000-11-03 17:05:42 +00:00
|
|
|
fl_addto_tabfolder(dialog_->tabfolder_prefs,
|
2002-01-12 03:08:26 +00:00
|
|
|
_("Conversion"),
|
2000-11-03 17:05:42 +00:00
|
|
|
converters_tab_->form);
|
2000-10-03 05:53:25 +00:00
|
|
|
fl_addto_tabfolder(dialog_->tabfolder_prefs,
|
|
|
|
_("Inputs"),
|
|
|
|
inputs_tab_->form);
|
2000-06-12 11:55:12 +00:00
|
|
|
fl_addto_tabfolder(dialog_->tabfolder_prefs,
|
2000-10-03 05:53:25 +00:00
|
|
|
_("Outputs"),
|
|
|
|
outputs_tab_->form);
|
|
|
|
|
|
|
|
// now build the nested tabfolders
|
|
|
|
// Starting with look and feel
|
2002-01-17 10:53:14 +00:00
|
|
|
fl_addto_tabfolder(look_n_feel_tab_->tabfolder_inner,
|
2000-06-12 11:55:12 +00:00
|
|
|
_("Screen Fonts"),
|
2000-11-14 13:46:01 +00:00
|
|
|
screen_fonts_.dialog()->form);
|
2002-01-17 10:53:14 +00:00
|
|
|
fl_addto_tabfolder(look_n_feel_tab_->tabfolder_inner,
|
2000-10-11 07:59:25 +00:00
|
|
|
_("Interface"),
|
2000-11-14 13:46:01 +00:00
|
|
|
interface_.dialog()->form);
|
2002-01-17 10:53:14 +00:00
|
|
|
fl_addto_tabfolder(look_n_feel_tab_->tabfolder_inner,
|
2000-11-10 17:29:47 +00:00
|
|
|
_("Colors"),
|
2000-11-14 13:46:01 +00:00
|
|
|
colors_.dialog()->form);
|
2002-01-17 10:53:14 +00:00
|
|
|
fl_addto_tabfolder(look_n_feel_tab_->tabfolder_inner,
|
2000-10-27 10:04:51 +00:00
|
|
|
_("Misc"),
|
2000-11-14 13:46:01 +00:00
|
|
|
lnf_misc_.dialog()->form);
|
2000-10-03 05:53:25 +00:00
|
|
|
|
2000-11-03 17:05:42 +00:00
|
|
|
// then build converters
|
2002-01-17 10:53:14 +00:00
|
|
|
fl_addto_tabfolder(converters_tab_->tabfolder_inner,
|
2000-11-03 17:05:42 +00:00
|
|
|
_("Formats"),
|
2000-11-14 13:46:01 +00:00
|
|
|
formats_.dialog()->form);
|
2002-01-17 10:53:14 +00:00
|
|
|
fl_addto_tabfolder(converters_tab_->tabfolder_inner,
|
2000-11-03 17:05:42 +00:00
|
|
|
_("Converters"),
|
2000-11-14 13:46:01 +00:00
|
|
|
converters_.dialog()->form);
|
2000-11-03 17:05:42 +00:00
|
|
|
|
2000-10-03 05:53:25 +00:00
|
|
|
// then build inputs
|
2002-01-17 10:53:14 +00:00
|
|
|
// Paths should probably go in a few inner_tab called Files
|
|
|
|
fl_addto_tabfolder(inputs_tab_->tabfolder_inner,
|
2000-06-12 11:55:12 +00:00
|
|
|
_("Paths"),
|
2000-11-14 13:46:01 +00:00
|
|
|
paths_.dialog()->form);
|
2002-01-17 10:53:14 +00:00
|
|
|
fl_addto_tabfolder(inputs_tab_->tabfolder_inner,
|
2000-10-30 11:33:05 +00:00
|
|
|
_("Misc"),
|
2000-11-14 13:46:01 +00:00
|
|
|
inputs_misc_.dialog()->form);
|
2000-06-12 11:55:12 +00:00
|
|
|
|
2000-10-03 05:53:25 +00:00
|
|
|
// then building outputs
|
2002-01-17 10:53:14 +00:00
|
|
|
fl_addto_tabfolder(outputs_tab_->tabfolder_inner,
|
2000-10-03 05:53:25 +00:00
|
|
|
_("Printer"),
|
2000-11-14 13:46:01 +00:00
|
|
|
printer_.dialog()->form);
|
2002-01-17 10:53:14 +00:00
|
|
|
fl_addto_tabfolder(outputs_tab_->tabfolder_inner,
|
2000-10-27 10:04:51 +00:00
|
|
|
_("Misc"),
|
2000-11-14 13:46:01 +00:00
|
|
|
outputs_misc_.dialog()->form);
|
2000-06-12 11:55:12 +00:00
|
|
|
|
2000-10-27 10:04:51 +00:00
|
|
|
// then building usage
|
2002-01-17 10:53:14 +00:00
|
|
|
fl_addto_tabfolder(lang_opts_tab_->tabfolder_inner,
|
2000-10-27 10:04:51 +00:00
|
|
|
_("Spell checker"),
|
2001-07-13 11:50:39 +00:00
|
|
|
spelloptions_.dialog()->form);
|
2002-01-17 10:53:14 +00:00
|
|
|
fl_addto_tabfolder(lang_opts_tab_->tabfolder_inner,
|
2000-10-27 10:04:51 +00:00
|
|
|
_("Language"),
|
2000-11-14 13:46:01 +00:00
|
|
|
language_.dialog()->form);
|
2000-06-12 11:55:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void FormPreferences::apply()
|
|
|
|
{
|
|
|
|
// set the new lyxrc entries
|
|
|
|
// many of these need to trigger other functions when the assignment
|
|
|
|
// is made. For example, screen zoom and font types. These could be
|
|
|
|
// handled either by signals/slots in lyxrc or just directly call the
|
|
|
|
// associated functions here.
|
2000-08-14 05:24:35 +00:00
|
|
|
// There are other problems with this scheme. We really should check
|
|
|
|
// what we copy to make sure that it really is necessary to do things
|
|
|
|
// like update the screen fonts because that flushes the textcache
|
2000-11-14 13:46:01 +00:00
|
|
|
// and other stuff which may cost us a lot on slower/high-load
|
|
|
|
// machines.
|
2000-10-27 10:04:51 +00:00
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
colors_.apply();
|
|
|
|
formats_.apply(); // Must be before converters_.apply()
|
|
|
|
converters_.apply();
|
|
|
|
inputs_misc_.apply();
|
|
|
|
interface_.apply();
|
|
|
|
language_.apply();
|
|
|
|
lnf_misc_.apply();
|
|
|
|
outputs_misc_.apply();
|
|
|
|
paths_.apply();
|
|
|
|
printer_.apply();
|
|
|
|
screen_fonts_.apply();
|
2001-07-13 11:50:39 +00:00
|
|
|
spelloptions_.apply();
|
2000-10-27 10:04:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-03-11 09:54:42 +00:00
|
|
|
string const FormPreferences::getFeedback(FL_OBJECT * ob)
|
2000-10-27 10:04:51 +00:00
|
|
|
{
|
2001-04-24 15:25:26 +00:00
|
|
|
lyx::Assert(ob);
|
2000-11-07 06:41:13 +00:00
|
|
|
|
2002-07-17 15:34:00 +00:00
|
|
|
if (ob->form->fdui == colors_.dialog())
|
|
|
|
return colors_.feedback(ob);
|
|
|
|
if (ob->form->fdui == converters_.dialog())
|
|
|
|
return converters_.feedback(ob);
|
|
|
|
if (ob->form->fdui == formats_.dialog())
|
|
|
|
return formats_.feedback(ob);
|
|
|
|
if (ob->form->fdui == inputs_misc_.dialog())
|
|
|
|
return inputs_misc_.feedback(ob);
|
|
|
|
if (ob->form->fdui == interface_.dialog())
|
|
|
|
return interface_.feedback(ob);
|
|
|
|
if (ob->form->fdui == language_.dialog())
|
|
|
|
return language_.feedback(ob);
|
|
|
|
if (ob->form->fdui == lnf_misc_.dialog())
|
|
|
|
return lnf_misc_.feedback(ob);
|
|
|
|
if (ob->form->fdui == outputs_misc_.dialog())
|
|
|
|
return outputs_misc_.feedback(ob);
|
|
|
|
if (ob->form->fdui == paths_.dialog())
|
|
|
|
return paths_.feedback(ob);
|
|
|
|
if (ob->form->fdui == printer_.dialog())
|
|
|
|
return printer_.feedback(ob);
|
|
|
|
if (ob->form->fdui == screen_fonts_.dialog())
|
|
|
|
return screen_fonts_.feedback(ob);
|
|
|
|
if (ob->form->fdui == spelloptions_.dialog())
|
|
|
|
return spelloptions_.feedback(ob);
|
|
|
|
|
|
|
|
return string();
|
2000-11-02 14:47:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool FormPreferences::input(FL_OBJECT * ob, long)
|
2000-10-27 10:04:51 +00:00
|
|
|
{
|
2001-04-24 15:25:26 +00:00
|
|
|
lyx::Assert(ob);
|
2002-03-21 21:21:28 +00:00
|
|
|
|
2000-10-27 10:04:51 +00:00
|
|
|
// whatever checks you need to ensure the user hasn't entered
|
|
|
|
// some totally ridiculous value somewhere. Change activate to suit.
|
|
|
|
// comments before each test describe what is _valid_
|
|
|
|
|
2000-11-21 21:51:25 +00:00
|
|
|
if (ob->form->fdui == colors_.dialog()) {
|
|
|
|
colors_.input(ob);
|
|
|
|
return true;
|
2002-07-17 15:34:00 +00:00
|
|
|
}
|
|
|
|
if (ob->form->fdui == converters_.dialog())
|
2000-11-14 13:46:01 +00:00
|
|
|
return converters_.input(ob);
|
2002-07-17 15:34:00 +00:00
|
|
|
if (ob->form->fdui == formats_.dialog())
|
2000-11-14 13:46:01 +00:00
|
|
|
return formats_.input(ob);
|
2002-07-17 15:34:00 +00:00
|
|
|
if (ob->form->fdui == interface_.dialog())
|
2000-11-14 13:46:01 +00:00
|
|
|
return interface_.input(ob);
|
2002-07-17 15:34:00 +00:00
|
|
|
if (ob->form->fdui == language_.dialog())
|
2000-11-14 13:46:01 +00:00
|
|
|
return language_.input(ob);
|
2002-07-17 15:34:00 +00:00
|
|
|
if (ob->form->fdui == paths_.dialog())
|
2000-11-14 13:46:01 +00:00
|
|
|
return paths_.input(ob);
|
2002-07-17 15:34:00 +00:00
|
|
|
if (ob->form->fdui == screen_fonts_.dialog())
|
2000-11-14 13:46:01 +00:00
|
|
|
return screen_fonts_.input();
|
2002-07-17 15:34:00 +00:00
|
|
|
if (ob->form->fdui == spelloptions_.dialog())
|
2001-07-13 11:50:39 +00:00
|
|
|
return spelloptions_.input(ob);
|
2000-10-27 10:04:51 +00:00
|
|
|
|
2000-11-10 17:29:47 +00:00
|
|
|
return true;
|
2000-10-27 10:04:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-10-30 21:53:29 +00:00
|
|
|
void FormPreferences::update()
|
|
|
|
{
|
2001-03-15 13:37:04 +00:00
|
|
|
if (!dialog_.get()) return;
|
2002-03-21 21:21:28 +00:00
|
|
|
|
2000-10-30 21:53:29 +00:00
|
|
|
// read lyxrc entries
|
2000-11-14 13:46:01 +00:00
|
|
|
colors_.update();
|
|
|
|
formats_.update(); // Must be before converters_.update()
|
|
|
|
converters_.update();
|
|
|
|
inputs_misc_.update();
|
|
|
|
interface_.update();
|
|
|
|
language_.update();
|
|
|
|
lnf_misc_.update();
|
|
|
|
outputs_misc_.update();
|
|
|
|
paths_.update();
|
|
|
|
printer_.update();
|
|
|
|
screen_fonts_.update();
|
2001-07-13 11:50:39 +00:00
|
|
|
spelloptions_.update();
|
2000-11-14 13:46:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-03-15 13:37:04 +00:00
|
|
|
FormPreferences::Colors::Colors(FormPreferences & p)
|
2001-08-01 11:14:24 +00:00
|
|
|
: modifiedXformsPrefs(false), parent_(p)
|
2001-03-15 13:37:04 +00:00
|
|
|
{}
|
|
|
|
|
|
|
|
|
2002-06-13 13:43:51 +00:00
|
|
|
FD_preferences_colors const * FormPreferences::Colors::dialog()
|
2000-11-14 13:46:01 +00:00
|
|
|
{
|
2001-03-15 13:37:04 +00:00
|
|
|
return dialog_.get();
|
2000-10-30 21:53:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
void FormPreferences::Colors::apply()
|
2000-10-30 11:33:05 +00:00
|
|
|
{
|
2000-11-10 17:29:47 +00:00
|
|
|
bool modifiedText = false;
|
|
|
|
bool modifiedBackground = false;
|
|
|
|
|
2001-03-05 19:02:40 +00:00
|
|
|
for (vector<XformsColor>::const_iterator cit = xformsColorDB.begin();
|
|
|
|
cit != xformsColorDB.end(); ++cit) {
|
2000-11-13 10:35:02 +00:00
|
|
|
RGBColor col;
|
2001-07-12 11:11:10 +00:00
|
|
|
fl_getmcolor(cit->colorID, &col.r, &col.g, &col.b);
|
|
|
|
if (col != cit->color()) {
|
2001-03-05 19:02:40 +00:00
|
|
|
modifiedXformsPrefs = true;
|
2001-07-12 11:11:10 +00:00
|
|
|
if (cit->colorID == FL_BLACK)
|
2000-11-10 17:29:47 +00:00
|
|
|
modifiedText = true;
|
2001-07-12 11:11:10 +00:00
|
|
|
if (cit->colorID == FL_COL1)
|
2000-11-10 17:29:47 +00:00
|
|
|
modifiedBackground = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-03-05 19:02:40 +00:00
|
|
|
if (modifiedXformsPrefs) {
|
|
|
|
for (vector<XformsColor>::const_iterator cit =
|
2002-03-21 21:21:28 +00:00
|
|
|
xformsColorDB.begin();
|
2001-03-05 19:02:40 +00:00
|
|
|
cit != xformsColorDB.end(); ++cit) {
|
2001-07-12 11:11:10 +00:00
|
|
|
fl_mapcolor(cit->colorID, cit->r, cit->g, cit->b);
|
2000-11-10 17:29:47 +00:00
|
|
|
|
2001-07-12 11:11:10 +00:00
|
|
|
if (modifiedText && cit->colorID == FL_BLACK) {
|
2000-11-21 15:46:13 +00:00
|
|
|
AdjustVal(FL_INACTIVE, FL_BLACK, 0.5);
|
2000-11-10 17:29:47 +00:00
|
|
|
}
|
|
|
|
|
2001-07-12 11:11:10 +00:00
|
|
|
if (modifiedBackground && cit->colorID == FL_COL1) {
|
2000-11-21 15:46:13 +00:00
|
|
|
AdjustVal(FL_MCOL, FL_COL1, 0.1);
|
|
|
|
AdjustVal(FL_TOP_BCOL, FL_COL1, 0.1);
|
|
|
|
AdjustVal(FL_LEFT_BCOL, FL_COL1, 0.1);
|
2000-11-10 17:29:47 +00:00
|
|
|
|
2000-11-21 15:46:13 +00:00
|
|
|
AdjustVal(FL_RIGHT_BCOL, FL_COL1, -0.5);
|
|
|
|
AdjustVal(FL_BOTTOM_BCOL, FL_COL1, -0.5);
|
2000-11-29 15:06:42 +00:00
|
|
|
}
|
|
|
|
|
2001-07-12 11:11:10 +00:00
|
|
|
if (cit->colorID == GUI_COLOR_CURSOR) {
|
2000-11-29 15:06:42 +00:00
|
|
|
fl_mapcolor(GUI_COLOR_CURSOR,
|
2001-07-12 11:11:10 +00:00
|
|
|
cit->r, cit->g, cit->b);
|
2002-03-13 11:26:36 +00:00
|
|
|
setCursorColor(GUI_COLOR_CURSOR);
|
2000-11-29 15:06:42 +00:00
|
|
|
}
|
2000-11-10 17:29:47 +00:00
|
|
|
}
|
2002-08-13 14:40:38 +00:00
|
|
|
parent_.lv_->getDialogs().redrawGUI();
|
2000-11-10 17:29:47 +00:00
|
|
|
}
|
2000-11-15 18:02:45 +00:00
|
|
|
|
|
|
|
// Now do the same for the LyX LColors...
|
2000-11-17 00:07:41 +00:00
|
|
|
for (vector<NamedColor>::const_iterator cit = lyxColorDB.begin();
|
|
|
|
cit != lyxColorDB.end(); ++cit) {
|
2001-07-12 11:11:10 +00:00
|
|
|
LColor::color lc = lcolor.getFromGUIName(cit->getname());
|
2000-11-29 19:18:28 +00:00
|
|
|
if (lc == LColor::inherit) continue;
|
2000-11-15 18:02:45 +00:00
|
|
|
|
2000-12-04 14:10:44 +00:00
|
|
|
// Create a valid X11 name of the form "#rrggbb"
|
2001-07-12 11:11:10 +00:00
|
|
|
string const hexname = X11hexname(cit->color());
|
2002-03-21 21:21:28 +00:00
|
|
|
|
2000-12-04 14:10:44 +00:00
|
|
|
if (lcolor.getX11Name(lc) != hexname) {
|
2000-11-29 15:06:42 +00:00
|
|
|
lyxerr[Debug::GUI]
|
|
|
|
<< "FormPreferences::Colors::apply: "
|
|
|
|
<< "resetting LColor " << lcolor.getGUIName(lc)
|
|
|
|
<< " from \"" << lcolor.getX11Name(lc)
|
2000-12-04 14:10:44 +00:00
|
|
|
<< "\" to \"" << hexname << "\"."
|
2000-11-29 15:06:42 +00:00
|
|
|
<< endl;
|
2000-11-21 15:46:13 +00:00
|
|
|
|
2000-12-04 14:10:44 +00:00
|
|
|
string const s = lcolor.getLyXName(lc) + string(" ") +
|
|
|
|
hexname;
|
2002-08-13 17:43:40 +00:00
|
|
|
parent_.lv_->dispatch(FuncRequest(LFUN_SET_COLOR, s));
|
2000-11-15 18:02:45 +00:00
|
|
|
}
|
|
|
|
}
|
2000-10-30 11:33:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
void FormPreferences::Colors::build()
|
2000-10-27 10:04:51 +00:00
|
|
|
{
|
2002-06-14 09:17:11 +00:00
|
|
|
dialog_.reset(build_preferences_colors(&parent_));
|
2000-11-03 09:47:02 +00:00
|
|
|
|
2000-11-29 15:06:42 +00:00
|
|
|
fl_set_object_color(dialog_->button_color,
|
|
|
|
GUI_COLOR_CHOICE, GUI_COLOR_CHOICE);
|
2000-11-21 15:46:13 +00:00
|
|
|
|
2000-11-29 15:06:42 +00:00
|
|
|
fl_set_object_color(dialog_->dial_hue, GUI_COLOR_HUE_DIAL, FL_BLACK);
|
2000-11-21 15:46:13 +00:00
|
|
|
fl_set_dial_bounds(dialog_->dial_hue, 0.0, 360.0);
|
2000-12-04 14:10:44 +00:00
|
|
|
fl_set_dial_step(dialog_->dial_hue, 1.0);
|
|
|
|
fl_set_dial_return(dialog_->dial_hue, FL_RETURN_CHANGED);
|
2000-11-21 15:46:13 +00:00
|
|
|
|
|
|
|
fl_set_slider_bounds(dialog_->slider_saturation, 0.0, 1.0);
|
2000-12-04 14:10:44 +00:00
|
|
|
fl_set_slider_step(dialog_->slider_saturation, 0.01);
|
2000-11-21 15:46:13 +00:00
|
|
|
fl_set_slider_return(dialog_->slider_saturation, FL_RETURN_CHANGED);
|
2000-12-04 14:10:44 +00:00
|
|
|
|
2000-11-21 15:46:13 +00:00
|
|
|
fl_set_slider_bounds(dialog_->slider_value, 0.0, 1.0);
|
2000-12-04 14:10:44 +00:00
|
|
|
fl_set_slider_step(dialog_->slider_value, 0.01);
|
2000-11-21 15:46:13 +00:00
|
|
|
fl_set_slider_return(dialog_->slider_value, FL_RETURN_CHANGED);
|
2002-03-21 21:21:28 +00:00
|
|
|
|
2000-12-04 14:10:44 +00:00
|
|
|
fl_set_slider_bounds(dialog_->slider_red, 0.0, 255.0);
|
|
|
|
fl_set_slider_step(dialog_->slider_red, 1.0);
|
|
|
|
fl_set_slider_return(dialog_->slider_red, FL_RETURN_CHANGED);
|
2002-03-21 21:21:28 +00:00
|
|
|
|
2000-12-04 14:10:44 +00:00
|
|
|
fl_set_slider_bounds(dialog_->slider_green, 0.0, 255.0);
|
|
|
|
fl_set_slider_step(dialog_->slider_green, 1.0);
|
|
|
|
fl_set_slider_return(dialog_->slider_green, FL_RETURN_CHANGED);
|
2002-03-21 21:21:28 +00:00
|
|
|
|
2000-12-04 14:10:44 +00:00
|
|
|
fl_set_slider_bounds(dialog_->slider_blue, 0.0, 255.0);
|
|
|
|
fl_set_slider_step(dialog_->slider_blue, 1.0);
|
|
|
|
fl_set_slider_return(dialog_->slider_blue, FL_RETURN_CHANGED);
|
2002-03-11 09:54:42 +00:00
|
|
|
|
2000-11-15 18:02:45 +00:00
|
|
|
// set up the feedback mechanism
|
2002-03-11 09:54:42 +00:00
|
|
|
setPrehandler(dialog_->browser_lyx_objs);
|
|
|
|
setPrehandler(dialog_->button_color);
|
|
|
|
setPrehandler(dialog_->button_modify);
|
|
|
|
setPrehandler(dialog_->dial_hue);
|
|
|
|
setPrehandler(dialog_->slider_saturation);
|
|
|
|
setPrehandler(dialog_->slider_value);
|
|
|
|
setPrehandler(dialog_->slider_red);
|
|
|
|
setPrehandler(dialog_->slider_green);
|
|
|
|
setPrehandler(dialog_->slider_blue);
|
|
|
|
setPrehandler(dialog_->radio_rgb);
|
|
|
|
setPrehandler(dialog_->radio_hsv);
|
2000-11-03 09:47:02 +00:00
|
|
|
}
|
|
|
|
|
2002-08-07 08:11:41 +00:00
|
|
|
|
2000-11-08 09:39:46 +00:00
|
|
|
string const
|
2000-11-14 13:46:01 +00:00
|
|
|
FormPreferences::Colors::feedback(FL_OBJECT const * const ob) const
|
2000-11-03 17:05:42 +00:00
|
|
|
{
|
2002-07-28 22:50:13 +00:00
|
|
|
if (ob == dialog_->browser_lyx_objs)
|
2002-07-17 15:34:00 +00:00
|
|
|
return _("LyX objects that can be assigned a color.");
|
2000-11-10 17:29:47 +00:00
|
|
|
|
2002-07-28 22:50:13 +00:00
|
|
|
if (ob == dialog_->button_modify)
|
2002-07-17 15:34:00 +00:00
|
|
|
return _("Modify the LyX object's color. Note: you must then \"Apply\" the change.");
|
2000-12-04 14:10:44 +00:00
|
|
|
|
2002-07-17 15:34:00 +00:00
|
|
|
if (ob == dialog_->dial_hue ||
|
|
|
|
ob == dialog_->slider_saturation ||
|
|
|
|
ob == dialog_->slider_value ||
|
|
|
|
ob == dialog_->slider_red ||
|
|
|
|
ob == dialog_->slider_green ||
|
|
|
|
ob == dialog_->slider_blue)
|
|
|
|
return _("Find a new color.");
|
2000-12-04 14:10:44 +00:00
|
|
|
|
2002-07-28 22:50:13 +00:00
|
|
|
if (ob == dialog_->radio_rgb || ob == dialog_->radio_hsv)
|
2002-07-17 15:34:00 +00:00
|
|
|
return _("Toggle between RGB and HSV color spaces.");
|
2000-11-10 17:29:47 +00:00
|
|
|
|
2002-07-17 15:34:00 +00:00
|
|
|
return string();
|
2000-11-03 17:05:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-11-21 21:51:25 +00:00
|
|
|
void FormPreferences::Colors::input(FL_OBJECT const * const ob)
|
2000-11-03 17:05:42 +00:00
|
|
|
{
|
2000-12-04 14:10:44 +00:00
|
|
|
if (ob == dialog_->browser_lyx_objs) {
|
2000-11-21 15:46:13 +00:00
|
|
|
InputBrowserLyX();
|
2002-03-21 21:21:28 +00:00
|
|
|
|
2000-11-21 15:46:13 +00:00
|
|
|
} else if (ob == dialog_->dial_hue ||
|
|
|
|
ob == dialog_->slider_saturation ||
|
|
|
|
ob == dialog_->slider_value) {
|
|
|
|
InputHSV();
|
2000-11-10 17:29:47 +00:00
|
|
|
|
2000-12-04 14:10:44 +00:00
|
|
|
} else if (ob == dialog_->slider_red ||
|
|
|
|
ob == dialog_->slider_green ||
|
|
|
|
ob == dialog_->slider_blue) {
|
|
|
|
InputRGB();
|
2000-11-10 17:29:47 +00:00
|
|
|
|
2001-10-23 09:39:01 +00:00
|
|
|
} else if (ob == dialog_->radio_rgb ||
|
|
|
|
ob == dialog_->radio_hsv) {
|
2000-12-04 14:10:44 +00:00
|
|
|
SwitchColorSpace();
|
2000-11-13 10:35:02 +00:00
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
} else if (ob == dialog_->button_modify) {
|
2000-11-21 15:46:13 +00:00
|
|
|
Modify();
|
2000-11-10 17:29:47 +00:00
|
|
|
}
|
|
|
|
}
|
2000-11-03 17:05:42 +00:00
|
|
|
|
2000-11-10 17:29:47 +00:00
|
|
|
|
2000-11-17 00:07:41 +00:00
|
|
|
void FormPreferences::Colors::AdjustVal(int colAdjust, int colParent,
|
|
|
|
double addVal) const
|
2000-11-10 17:29:47 +00:00
|
|
|
{
|
2000-11-13 10:35:02 +00:00
|
|
|
RGBColor rgb;
|
2000-11-17 00:07:41 +00:00
|
|
|
fl_getmcolor(colParent, &rgb.r, &rgb.g, &rgb.b);
|
2000-11-10 17:29:47 +00:00
|
|
|
|
2000-11-17 00:07:41 +00:00
|
|
|
HSVColor hsv(rgb);
|
2000-11-10 17:29:47 +00:00
|
|
|
hsv.v += addVal;
|
2002-02-16 15:59:55 +00:00
|
|
|
hsv.v = min(1.0, max(0.0, hsv.v));
|
2000-11-10 17:29:47 +00:00
|
|
|
|
2000-11-17 00:07:41 +00:00
|
|
|
rgb = RGBColor(hsv);
|
|
|
|
fl_mapcolor(colAdjust, rgb.r, rgb.g, rgb.b);
|
2000-11-10 17:29:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-11-21 21:51:25 +00:00
|
|
|
void FormPreferences::Colors::InputBrowserLyX() const
|
2000-11-10 17:29:47 +00:00
|
|
|
{
|
2000-11-21 21:51:25 +00:00
|
|
|
vector<NamedColor>::size_type const selLyX =
|
|
|
|
fl_get_browser(dialog_->browser_lyx_objs);
|
|
|
|
if (selLyX < 1) return;
|
2000-11-10 17:29:47 +00:00
|
|
|
|
2000-11-15 18:02:45 +00:00
|
|
|
// Is the choice an Xforms color...
|
2000-12-04 14:10:44 +00:00
|
|
|
RGBColor col;
|
2000-11-10 17:29:47 +00:00
|
|
|
|
2002-02-16 15:59:55 +00:00
|
|
|
if (selLyX - 1 < xformsColorDB.size()) {
|
2001-03-05 19:02:40 +00:00
|
|
|
vector<XformsColor>::size_type const i = selLyX - 1;
|
|
|
|
col = xformsColorDB[i].color();
|
2000-11-21 21:51:25 +00:00
|
|
|
}
|
2000-11-21 15:46:13 +00:00
|
|
|
// or a LyX Logical color?
|
2000-11-21 21:51:25 +00:00
|
|
|
else {
|
|
|
|
vector<NamedColor>::size_type const i = selLyX - 1 -
|
2001-03-05 19:02:40 +00:00
|
|
|
xformsColorDB.size();
|
2000-12-04 14:10:44 +00:00
|
|
|
col = lyxColorDB[i].color();
|
2000-11-17 00:07:41 +00:00
|
|
|
}
|
|
|
|
|
2000-12-04 14:10:44 +00:00
|
|
|
fl_freeze_form(dialog_->form);
|
2000-11-21 15:46:13 +00:00
|
|
|
|
2000-12-04 14:10:44 +00:00
|
|
|
fl_mapcolor(GUI_COLOR_CHOICE, col.r, col.g, col.b);
|
|
|
|
fl_redraw_object(dialog_->button_color);
|
2000-11-17 00:07:41 +00:00
|
|
|
|
2000-12-04 14:10:44 +00:00
|
|
|
// Display either RGB or HSV but not both!
|
|
|
|
SwitchColorSpace();
|
2002-03-21 21:21:28 +00:00
|
|
|
|
2000-12-04 14:10:44 +00:00
|
|
|
// Deactivate the modify button to begin with...
|
2001-03-05 19:02:40 +00:00
|
|
|
setEnabled(dialog_->button_modify, false);
|
2002-03-21 21:21:28 +00:00
|
|
|
|
2000-12-04 14:10:44 +00:00
|
|
|
fl_unfreeze_form(dialog_->form);
|
2000-11-10 17:29:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-12-04 14:10:44 +00:00
|
|
|
void FormPreferences::Colors::InputHSV()
|
2000-11-10 17:29:47 +00:00
|
|
|
{
|
2000-12-04 14:10:44 +00:00
|
|
|
double const hue = fl_get_dial_value(dialog_->dial_hue);
|
|
|
|
double const sat = fl_get_slider_value(dialog_->slider_saturation);
|
|
|
|
double const val = fl_get_slider_value(dialog_->slider_value);
|
2000-11-10 17:29:47 +00:00
|
|
|
|
2000-12-06 22:24:17 +00:00
|
|
|
int const h = int(hue);
|
|
|
|
int const s = int(100.0 * sat);
|
|
|
|
int const v = int(100.0 * val);
|
2002-03-21 21:21:28 +00:00
|
|
|
|
2000-12-04 14:10:44 +00:00
|
|
|
string const label = tostr(h) + string(", ") + tostr(s) + string(", ") +
|
|
|
|
tostr(v);
|
|
|
|
fl_set_object_label(dialog_->text_color_values, label.c_str());
|
2000-11-10 17:29:47 +00:00
|
|
|
|
2000-12-04 14:10:44 +00:00
|
|
|
RGBColor col = HSVColor(hue, sat, val);
|
2002-03-21 21:21:28 +00:00
|
|
|
|
2000-12-04 14:10:44 +00:00
|
|
|
fl_freeze_form(dialog_->form);
|
|
|
|
|
|
|
|
fl_mapcolor(GUI_COLOR_CHOICE, col.r, col.g, col.b);
|
|
|
|
fl_redraw_object(dialog_->button_color);
|
2000-11-21 15:46:13 +00:00
|
|
|
|
2000-12-04 14:10:44 +00:00
|
|
|
col = HSVColor(hue, 1.0, 1.0);
|
|
|
|
col.r = max(col.r, 0);
|
|
|
|
fl_mapcolor(GUI_COLOR_HUE_DIAL, col.r, col.g, col.b);
|
2000-11-21 15:46:13 +00:00
|
|
|
fl_redraw_object(dialog_->dial_hue);
|
|
|
|
|
2000-12-04 14:10:44 +00:00
|
|
|
// Ascertain whether to activate the Modify button.
|
|
|
|
vector<NamedColor>::size_type const selLyX =
|
|
|
|
fl_get_browser(dialog_->browser_lyx_objs);
|
|
|
|
|
|
|
|
fl_unfreeze_form(dialog_->form);
|
|
|
|
if (selLyX < 1) return;
|
2002-03-21 21:21:28 +00:00
|
|
|
|
2000-12-04 14:10:44 +00:00
|
|
|
fl_getmcolor(GUI_COLOR_CHOICE, &col.r, &col.g, &col.b);
|
|
|
|
bool modify = false;
|
2002-03-21 21:21:28 +00:00
|
|
|
|
2000-12-04 14:10:44 +00:00
|
|
|
// Is the choice an Xforms color...
|
2002-02-16 15:59:55 +00:00
|
|
|
if (selLyX - 1 < xformsColorDB.size()) {
|
2001-03-05 19:02:40 +00:00
|
|
|
vector<XformsColor>::size_type const i = selLyX - 1;
|
|
|
|
modify = (xformsColorDB[i].color() != col);
|
2000-12-04 14:10:44 +00:00
|
|
|
}
|
|
|
|
// or a LyX Logical color?
|
|
|
|
else {
|
|
|
|
vector<NamedColor>::size_type const i = selLyX - 1 -
|
2001-03-05 19:02:40 +00:00
|
|
|
xformsColorDB.size();
|
2000-12-04 14:10:44 +00:00
|
|
|
modify = (lyxColorDB[i].color() != col);
|
|
|
|
}
|
2000-11-10 17:29:47 +00:00
|
|
|
|
2001-03-05 19:02:40 +00:00
|
|
|
setEnabled(dialog_->button_modify, modify);
|
2000-11-10 17:29:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-12-04 14:10:44 +00:00
|
|
|
void FormPreferences::Colors::InputRGB()
|
2000-11-13 10:35:02 +00:00
|
|
|
{
|
2000-12-06 22:24:17 +00:00
|
|
|
int const red = int(fl_get_slider_value(dialog_->slider_red));
|
|
|
|
int const green = int(fl_get_slider_value(dialog_->slider_green));
|
|
|
|
int const blue = int(fl_get_slider_value(dialog_->slider_blue));
|
2000-11-21 15:46:13 +00:00
|
|
|
|
2000-12-04 14:10:44 +00:00
|
|
|
string const label = tostr(red) + string(", ") + tostr(green) +
|
|
|
|
string(", ") + tostr(blue);
|
|
|
|
fl_set_object_label(dialog_->text_color_values, label.c_str());
|
2002-03-21 21:21:28 +00:00
|
|
|
|
2000-11-21 15:46:13 +00:00
|
|
|
fl_freeze_form(dialog_->form);
|
|
|
|
|
2000-12-04 14:10:44 +00:00
|
|
|
RGBColor col = RGBColor(red, green, blue);
|
2000-11-29 15:06:42 +00:00
|
|
|
fl_mapcolor(GUI_COLOR_CHOICE, col.r, col.g, col.b);
|
2000-11-21 15:46:13 +00:00
|
|
|
fl_redraw_object(dialog_->button_color);
|
|
|
|
|
2000-12-04 14:10:44 +00:00
|
|
|
// Ascertain whether to activate the Modify button.
|
|
|
|
vector<NamedColor>::size_type const selLyX =
|
|
|
|
fl_get_browser(dialog_->browser_lyx_objs);
|
2000-11-21 15:46:13 +00:00
|
|
|
|
2000-12-04 14:10:44 +00:00
|
|
|
fl_unfreeze_form(dialog_->form);
|
|
|
|
if (selLyX < 1) return;
|
2002-03-21 21:21:28 +00:00
|
|
|
|
2000-12-04 14:10:44 +00:00
|
|
|
bool modify = false;
|
2002-03-21 21:21:28 +00:00
|
|
|
|
2000-12-04 14:10:44 +00:00
|
|
|
// Is the choice an Xforms color...
|
2002-02-16 15:59:55 +00:00
|
|
|
if (selLyX - 1 < xformsColorDB.size()) {
|
2001-03-05 19:02:40 +00:00
|
|
|
vector<XformsColor>::size_type const i = selLyX - 1;
|
|
|
|
modify = (xformsColorDB[i].color() != col);
|
2000-12-04 14:10:44 +00:00
|
|
|
}
|
|
|
|
// or a LyX Logical color?
|
|
|
|
else {
|
|
|
|
vector<NamedColor>::size_type const i = selLyX - 1 -
|
2001-03-05 19:02:40 +00:00
|
|
|
xformsColorDB.size();
|
2000-12-04 14:10:44 +00:00
|
|
|
modify = (lyxColorDB[i].color() != col);
|
2000-11-15 18:02:45 +00:00
|
|
|
}
|
2000-11-13 10:35:02 +00:00
|
|
|
|
2001-03-05 19:02:40 +00:00
|
|
|
setEnabled(dialog_->button_modify, modify);
|
2000-11-03 17:05:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
void FormPreferences::Colors::LoadBrowserLyX()
|
2000-11-10 17:29:47 +00:00
|
|
|
{
|
2002-08-07 08:11:41 +00:00
|
|
|
if (!dialog_->browser_lyx_objs->visible)
|
|
|
|
return;
|
2000-11-21 15:46:13 +00:00
|
|
|
|
2001-03-05 19:02:40 +00:00
|
|
|
// First, define the modifiable xforms colors
|
|
|
|
xformsColorDB.clear();
|
|
|
|
XformsColor xcol;
|
2000-11-10 17:29:47 +00:00
|
|
|
|
2000-12-06 09:49:54 +00:00
|
|
|
xcol.name = _("GUI background");
|
2000-11-10 17:29:47 +00:00
|
|
|
xcol.colorID = FL_COL1;
|
2000-11-15 18:02:45 +00:00
|
|
|
fl_getmcolor(FL_COL1, &xcol.r, &xcol.g, &xcol.b);
|
2000-11-10 17:29:47 +00:00
|
|
|
|
2001-03-05 19:02:40 +00:00
|
|
|
xformsColorDB.push_back(xcol);
|
2000-11-10 17:29:47 +00:00
|
|
|
|
2000-12-06 09:49:54 +00:00
|
|
|
xcol.name = _("GUI text");
|
2000-11-10 17:29:47 +00:00
|
|
|
xcol.colorID = FL_BLACK;
|
2000-11-15 18:02:45 +00:00
|
|
|
fl_getmcolor(FL_BLACK, &xcol.r, &xcol.g, &xcol.b);
|
2000-11-10 17:29:47 +00:00
|
|
|
|
2001-03-05 19:02:40 +00:00
|
|
|
xformsColorDB.push_back(xcol);
|
2000-11-10 17:29:47 +00:00
|
|
|
|
2000-12-06 09:49:54 +00:00
|
|
|
xcol.name = _("GUI selection");
|
2000-11-10 17:29:47 +00:00
|
|
|
xcol.colorID = FL_YELLOW;
|
2000-11-15 18:02:45 +00:00
|
|
|
fl_getmcolor(FL_YELLOW, &xcol.r, &xcol.g, &xcol.b);
|
2000-11-10 17:29:47 +00:00
|
|
|
|
2001-03-05 19:02:40 +00:00
|
|
|
xformsColorDB.push_back(xcol);
|
2000-11-10 17:29:47 +00:00
|
|
|
|
2000-12-06 09:49:54 +00:00
|
|
|
xcol.name = _("GUI pointer");
|
2000-11-29 15:06:42 +00:00
|
|
|
xcol.colorID = GUI_COLOR_CURSOR;
|
|
|
|
fl_getmcolor(GUI_COLOR_CURSOR, &xcol.r, &xcol.g, &xcol.b);
|
|
|
|
|
2001-03-05 19:02:40 +00:00
|
|
|
xformsColorDB.push_back(xcol);
|
2000-11-29 15:06:42 +00:00
|
|
|
|
2000-11-15 18:02:45 +00:00
|
|
|
// Now create the the LyX LColors database
|
2000-11-21 15:46:13 +00:00
|
|
|
lyxColorDB.clear();
|
2000-11-17 00:07:41 +00:00
|
|
|
for (int i=0; i<LColor::ignore; ++i) {
|
2000-11-15 18:02:45 +00:00
|
|
|
LColor::color lc = static_cast<LColor::color>(i);
|
2000-11-17 00:07:41 +00:00
|
|
|
if (lc == LColor::none
|
2000-11-15 18:02:45 +00:00
|
|
|
|| lc == LColor::black
|
|
|
|
|| lc == LColor::white
|
|
|
|
|| lc == LColor::red
|
|
|
|
|| lc == LColor::green
|
|
|
|
|| lc == LColor::blue
|
|
|
|
|| lc == LColor::cyan
|
|
|
|
|| lc == LColor::magenta
|
|
|
|
|| lc == LColor::yellow
|
|
|
|
|| lc == LColor::inherit
|
2000-11-17 00:07:41 +00:00
|
|
|
|| lc == LColor::ignore) continue;
|
2000-11-15 18:02:45 +00:00
|
|
|
|
2000-11-17 00:07:41 +00:00
|
|
|
string const name = lcolor.getX11Name(lc);
|
2000-11-21 15:46:13 +00:00
|
|
|
Display * display = fl_get_display();;
|
|
|
|
Colormap const colormap = fl_state[fl_get_vclass()].colormap;
|
|
|
|
XColor xcol, ccol;
|
|
|
|
|
|
|
|
if (XLookupColor(display, colormap, name.c_str(), &xcol, &ccol)
|
|
|
|
== 0) {
|
2000-12-04 14:10:44 +00:00
|
|
|
lyxerr << "FormPreferences::Colors::LoadBrowserLyX:\n"
|
2000-11-21 15:46:13 +00:00
|
|
|
<< "LColor " << lcolor.getLyXName(lc)
|
|
|
|
<< ": X can't find color \"" << name
|
|
|
|
<< "\". Set to \"black\"!" << endl;
|
|
|
|
|
|
|
|
string const arg = lcolor.getLyXName(lc) + " black";
|
2002-08-13 17:43:40 +00:00
|
|
|
parent_.lv_->dispatch(FuncRequest(LFUN_SET_COLOR, arg));
|
2000-11-21 15:46:13 +00:00
|
|
|
continue;
|
|
|
|
}
|
2000-11-15 18:02:45 +00:00
|
|
|
|
2000-11-21 15:46:13 +00:00
|
|
|
// X has found the color. Now find the "appropriate" X11 name
|
|
|
|
// for this color.
|
|
|
|
|
|
|
|
// Note that X stores the RGB values in the range 0 - 65535
|
|
|
|
// whilst we require them in the range 0 - 255.
|
|
|
|
RGBColor col;
|
2001-01-23 13:36:23 +00:00
|
|
|
col.r = xcol.red / 256;
|
|
|
|
col.g = xcol.green / 256;
|
|
|
|
col.b = xcol.blue / 256;
|
2000-11-21 15:46:13 +00:00
|
|
|
|
2000-12-04 14:10:44 +00:00
|
|
|
// Create a valid X11 name of the form "#rrggbb" and change the
|
|
|
|
// LColor X11name to this. Don't want to trigger a redraw,
|
|
|
|
// as we're just changing the name not the RGB values.
|
|
|
|
// Also reset the system_lcolor names, so that we don't output
|
|
|
|
// unnecessary changes.
|
|
|
|
string const hexname = X11hexname(col);
|
2000-11-21 15:46:13 +00:00
|
|
|
|
2000-12-04 14:10:44 +00:00
|
|
|
if (lcolor.getX11Name(lc) != hexname) {
|
|
|
|
lcolor.setColor(lc, hexname);
|
|
|
|
system_lcolor.setColor(lc, hexname);
|
|
|
|
}
|
2000-10-27 10:04:51 +00:00
|
|
|
|
2000-12-04 14:10:44 +00:00
|
|
|
// Finally, push the color onto the database
|
|
|
|
NamedColor ncol(lcolor.getGUIName(lc), col);
|
|
|
|
lyxColorDB.push_back(ncol);
|
|
|
|
}
|
2000-10-27 10:04:51 +00:00
|
|
|
|
2000-12-04 14:10:44 +00:00
|
|
|
// Now construct the browser
|
|
|
|
FL_OBJECT * colbr = dialog_->browser_lyx_objs;
|
|
|
|
fl_freeze_form(dialog_->form);
|
|
|
|
fl_clear_browser(colbr);
|
2001-03-05 19:02:40 +00:00
|
|
|
for (vector<XformsColor>::const_iterator cit = xformsColorDB.begin();
|
|
|
|
cit != xformsColorDB.end(); ++cit) {
|
2001-07-12 11:11:10 +00:00
|
|
|
fl_addto_browser(colbr, cit->getname().c_str());
|
2000-12-04 14:10:44 +00:00
|
|
|
}
|
|
|
|
for (vector<NamedColor>::const_iterator cit = lyxColorDB.begin();
|
|
|
|
cit != lyxColorDB.end(); ++cit) {
|
2001-07-12 11:11:10 +00:00
|
|
|
fl_addto_browser(colbr, cit->getname().c_str());
|
2000-11-21 15:46:13 +00:00
|
|
|
}
|
|
|
|
|
2000-12-04 14:10:44 +00:00
|
|
|
// just to be safe...
|
|
|
|
fl_set_browser_topline(dialog_->browser_lyx_objs, 1);
|
|
|
|
fl_select_browser_line(dialog_->browser_lyx_objs, 1);
|
|
|
|
fl_unfreeze_form(dialog_->form);
|
2000-11-21 15:46:13 +00:00
|
|
|
|
2000-12-04 14:10:44 +00:00
|
|
|
InputBrowserLyX();
|
2000-11-21 15:46:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-11-21 21:51:25 +00:00
|
|
|
void FormPreferences::Colors::Modify()
|
2000-10-30 11:33:05 +00:00
|
|
|
{
|
2000-11-21 21:51:25 +00:00
|
|
|
vector<NamedColor>::size_type const selLyX =
|
|
|
|
fl_get_browser(dialog_->browser_lyx_objs);
|
2002-07-17 15:34:00 +00:00
|
|
|
if (selLyX < 1)
|
|
|
|
return;
|
2000-11-28 06:46:06 +00:00
|
|
|
|
2000-12-04 14:10:44 +00:00
|
|
|
RGBColor col;
|
|
|
|
fl_getmcolor(GUI_COLOR_CHOICE, &col.r, &col.g, &col.b);
|
2000-11-28 06:46:06 +00:00
|
|
|
|
|
|
|
// Is the choice an Xforms color...
|
2002-02-16 15:59:55 +00:00
|
|
|
if (selLyX - 1 < xformsColorDB.size()) {
|
2001-03-05 19:02:40 +00:00
|
|
|
vector<XformsColor>::size_type const i = selLyX - 1;
|
|
|
|
xformsColorDB[i].r = col.r;
|
|
|
|
xformsColorDB[i].g = col.g;
|
|
|
|
xformsColorDB[i].b = col.b;
|
2000-11-28 06:46:06 +00:00
|
|
|
}
|
|
|
|
// or a LyX Logical color?
|
|
|
|
else {
|
2000-11-21 21:51:25 +00:00
|
|
|
vector<NamedColor>::size_type const i = selLyX - 1 -
|
2001-03-05 19:02:40 +00:00
|
|
|
xformsColorDB.size();
|
2000-12-04 14:10:44 +00:00
|
|
|
lyxColorDB[i].r = col.r;
|
|
|
|
lyxColorDB[i].g = col.g;
|
|
|
|
lyxColorDB[i].b = col.b;
|
2000-11-28 06:46:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
fl_freeze_form(dialog_->form);
|
2002-03-21 21:21:28 +00:00
|
|
|
setEnabled(dialog_->button_modify, false);
|
2000-11-14 13:46:01 +00:00
|
|
|
fl_unfreeze_form(dialog_->form);
|
2000-11-10 17:29:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-12-04 14:10:44 +00:00
|
|
|
void FormPreferences::Colors::SwitchColorSpace() const
|
2000-11-10 17:29:47 +00:00
|
|
|
{
|
2001-10-23 09:39:01 +00:00
|
|
|
bool const hsv = fl_get_button(dialog_->radio_hsv);
|
2000-11-10 17:29:47 +00:00
|
|
|
|
2000-12-04 14:10:44 +00:00
|
|
|
RGBColor col;
|
|
|
|
fl_getmcolor(GUI_COLOR_CHOICE, &col.r, &col.g, &col.b);
|
2000-11-10 17:29:47 +00:00
|
|
|
|
2000-12-04 14:10:44 +00:00
|
|
|
fl_freeze_form(dialog_->form);
|
2000-11-21 15:46:13 +00:00
|
|
|
|
2001-10-23 09:39:01 +00:00
|
|
|
if (hsv) {
|
2000-12-04 14:10:44 +00:00
|
|
|
fl_hide_object(dialog_->slider_red);
|
|
|
|
fl_hide_object(dialog_->slider_blue);
|
|
|
|
fl_hide_object(dialog_->slider_green);
|
|
|
|
fl_show_object(dialog_->dial_hue);
|
|
|
|
fl_show_object(dialog_->slider_saturation);
|
|
|
|
fl_show_object(dialog_->slider_value);
|
2000-11-21 15:46:13 +00:00
|
|
|
|
2000-12-04 14:10:44 +00:00
|
|
|
HSVColor hsv = HSVColor(col);
|
|
|
|
hsv.h = max(hsv.h, 0.0);
|
2002-03-21 21:21:28 +00:00
|
|
|
|
2000-12-04 14:10:44 +00:00
|
|
|
fl_set_dial_value(dialog_->dial_hue, hsv.h);
|
|
|
|
fl_set_slider_value(dialog_->slider_saturation, hsv.s);
|
|
|
|
fl_set_slider_value(dialog_->slider_value, hsv.v);
|
|
|
|
|
|
|
|
col = HSVColor(hsv.h, 1.0, 1.0);
|
2002-07-17 15:34:00 +00:00
|
|
|
col.r = max(col.r, 0);
|
2000-12-04 14:10:44 +00:00
|
|
|
fl_mapcolor(GUI_COLOR_HUE_DIAL, col.r, col.g, col.b);
|
|
|
|
fl_redraw_object(dialog_->dial_hue);
|
|
|
|
|
|
|
|
// Adjust the label a bit, but not the actual values.
|
|
|
|
// Means that toggling from one space to the other has no
|
|
|
|
// effect on the final color.
|
|
|
|
int const h = int(hsv.h);
|
2002-07-17 15:34:00 +00:00
|
|
|
int const s = int(100 * hsv.s);
|
|
|
|
int const v = int(100 * hsv.v);
|
|
|
|
string const label = tostr(h) + ", " + tostr(s) +
|
|
|
|
", " + tostr(v);
|
2000-12-04 14:10:44 +00:00
|
|
|
fl_set_object_label(dialog_->text_color_values, label.c_str());
|
2002-03-21 21:21:28 +00:00
|
|
|
|
2000-11-21 15:46:13 +00:00
|
|
|
} else {
|
2000-12-04 14:10:44 +00:00
|
|
|
fl_show_object(dialog_->slider_red);
|
|
|
|
fl_show_object(dialog_->slider_blue);
|
|
|
|
fl_show_object(dialog_->slider_green);
|
|
|
|
fl_hide_object(dialog_->dial_hue);
|
|
|
|
fl_hide_object(dialog_->slider_saturation);
|
|
|
|
fl_hide_object(dialog_->slider_value);
|
2000-11-21 15:46:13 +00:00
|
|
|
|
2000-12-04 14:10:44 +00:00
|
|
|
fl_set_slider_value(dialog_->slider_red, col.r);
|
|
|
|
fl_set_slider_value(dialog_->slider_green, col.g);
|
|
|
|
fl_set_slider_value(dialog_->slider_blue, col.b);
|
2000-11-21 15:46:13 +00:00
|
|
|
|
2000-12-04 14:10:44 +00:00
|
|
|
// Adjust the label a bit. Same reasoning as above.
|
|
|
|
int const r = int(col.r);
|
|
|
|
int const g = int(col.g);
|
|
|
|
int const b = int(col.b);
|
2002-07-17 15:34:00 +00:00
|
|
|
string const label = tostr(r) + ", " + tostr(g) +
|
|
|
|
", " + tostr(b);
|
2000-12-04 14:10:44 +00:00
|
|
|
fl_set_object_label(dialog_->text_color_values, label.c_str());
|
|
|
|
}
|
2002-03-21 21:21:28 +00:00
|
|
|
|
2000-11-21 15:46:13 +00:00
|
|
|
fl_unfreeze_form(dialog_->form);
|
|
|
|
}
|
|
|
|
|
2000-12-04 14:10:44 +00:00
|
|
|
string const FormPreferences::Colors::X11hexname(RGBColor const & col) const
|
2000-11-21 15:46:13 +00:00
|
|
|
{
|
2000-12-04 14:10:44 +00:00
|
|
|
ostringstream ostr;
|
|
|
|
|
2002-02-16 15:59:55 +00:00
|
|
|
ostr << "#" << std::setbase(16) << setfill('0')
|
|
|
|
<< setw(2) << col.r
|
|
|
|
<< setw(2) << col.g
|
|
|
|
<< setw(2) << col.b;
|
2000-12-04 14:10:44 +00:00
|
|
|
|
|
|
|
return ostr.str().c_str();
|
2000-11-03 09:47:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-03-15 13:37:04 +00:00
|
|
|
FormPreferences::Converters::Converters(FormPreferences & p)
|
|
|
|
: parent_(p)
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
2002-06-13 13:43:51 +00:00
|
|
|
FD_preferences_converters const * FormPreferences::Converters::dialog()
|
2000-11-14 13:46:01 +00:00
|
|
|
{
|
2001-03-15 13:37:04 +00:00
|
|
|
return dialog_.get();
|
2000-11-14 13:46:01 +00:00
|
|
|
}
|
2000-11-03 09:47:02 +00:00
|
|
|
|
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
void FormPreferences::Converters::apply() const
|
2000-11-09 15:28:42 +00:00
|
|
|
{
|
2000-11-13 10:35:02 +00:00
|
|
|
converters = local_converters;
|
2001-07-30 11:56:00 +00:00
|
|
|
converters.update(formats);
|
|
|
|
converters.buildGraph();
|
2000-11-09 15:28:42 +00:00
|
|
|
}
|
2000-11-03 17:05:42 +00:00
|
|
|
|
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
void FormPreferences::Converters::build()
|
2000-11-03 17:05:42 +00:00
|
|
|
{
|
2002-06-14 09:17:11 +00:00
|
|
|
dialog_.reset(build_preferences_converters(&parent_));
|
2000-11-09 15:28:42 +00:00
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
fl_set_input_return(dialog_->input_converter, FL_RETURN_CHANGED);
|
|
|
|
fl_set_input_return(dialog_->input_flags, FL_RETURN_CHANGED);
|
2000-11-09 15:28:42 +00:00
|
|
|
|
|
|
|
// set up the feedback mechanism
|
2002-03-11 09:54:42 +00:00
|
|
|
setPrehandler(dialog_->browser_all);
|
|
|
|
setPrehandler(dialog_->button_delete);
|
|
|
|
setPrehandler(dialog_->button_add);
|
|
|
|
setPrehandler(dialog_->input_converter);
|
|
|
|
setPrehandler(dialog_->choice_from);
|
|
|
|
setPrehandler(dialog_->choice_to);
|
|
|
|
setPrehandler(dialog_->input_flags);
|
2000-11-03 09:47:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-11-04 10:00:12 +00:00
|
|
|
string const
|
2000-11-17 00:07:41 +00:00
|
|
|
FormPreferences::Converters::feedback(FL_OBJECT const * const ob) const
|
2000-11-03 17:05:42 +00:00
|
|
|
{
|
2002-07-28 22:50:13 +00:00
|
|
|
if (ob == dialog_->browser_all)
|
2002-07-17 15:34:00 +00:00
|
|
|
return _("All the currently defined converters known to LyX.");
|
|
|
|
|
|
|
|
if (ob == dialog_->choice_from)
|
|
|
|
return _("Convert \"from\" this format");
|
|
|
|
|
|
|
|
if (ob == dialog_->choice_to)
|
|
|
|
return _("Convert \"to\" this format");
|
2000-11-09 15:28:42 +00:00
|
|
|
|
2002-07-17 15:34:00 +00:00
|
|
|
if (ob == dialog_->input_converter)
|
|
|
|
return _("The conversion command. $$i is the input file name, "
|
2002-07-28 22:50:13 +00:00
|
|
|
"$$b is the file name without its extension and $$o is "
|
|
|
|
"the name of the output file. $$s can be used as path to "
|
|
|
|
"LyX's own collection of conversion scripts.");
|
2002-07-17 15:34:00 +00:00
|
|
|
|
|
|
|
if (ob == dialog_->input_flags)
|
|
|
|
return _("Extra information for the Converter class, whether and "
|
2002-07-28 22:50:13 +00:00
|
|
|
"how to parse the result, and various other things.");
|
2002-07-17 15:34:00 +00:00
|
|
|
|
|
|
|
if (ob == dialog_->button_delete)
|
|
|
|
return _("Remove the current converter from the list of available "
|
2002-07-28 22:50:13 +00:00
|
|
|
"converters. Note: you must then \"Apply\" the change.");
|
2002-07-17 15:34:00 +00:00
|
|
|
|
|
|
|
if (ob == dialog_->button_add) {
|
2000-11-21 21:51:25 +00:00
|
|
|
if (string(ob->label) == _("Add"))
|
2002-07-17 15:34:00 +00:00
|
|
|
return _("Add the current converter to the list of available "
|
2002-07-28 22:50:13 +00:00
|
|
|
"converters. Note: you must then \"Apply\" the change.");
|
2000-11-21 21:51:25 +00:00
|
|
|
else
|
2002-07-17 15:34:00 +00:00
|
|
|
return _("Modify the contents of the current converter. "
|
2002-07-28 22:50:13 +00:00
|
|
|
"Note: you must then \"Apply\" the change.");
|
2000-11-09 15:28:42 +00:00
|
|
|
}
|
|
|
|
|
2002-07-17 15:34:00 +00:00
|
|
|
return string();
|
2000-11-09 15:28:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-11-17 00:07:41 +00:00
|
|
|
bool FormPreferences::Converters::input(FL_OBJECT const * const ob)
|
2000-11-09 15:28:42 +00:00
|
|
|
{
|
2002-07-17 15:34:00 +00:00
|
|
|
if (ob == dialog_->browser_all)
|
2000-11-14 13:46:01 +00:00
|
|
|
return Browser();
|
2000-11-09 15:28:42 +00:00
|
|
|
|
2002-07-17 15:34:00 +00:00
|
|
|
if (ob == dialog_->choice_from
|
2000-11-14 13:46:01 +00:00
|
|
|
|| ob == dialog_->choice_to
|
|
|
|
|| ob == dialog_->input_converter
|
2002-07-17 15:34:00 +00:00
|
|
|
|| ob == dialog_->input_flags)
|
2000-11-14 13:46:01 +00:00
|
|
|
return Input();
|
2000-11-09 15:28:42 +00:00
|
|
|
|
2002-07-28 22:50:13 +00:00
|
|
|
if (ob == dialog_->button_add)
|
2000-11-14 13:46:01 +00:00
|
|
|
return Add();
|
2000-11-09 15:28:42 +00:00
|
|
|
|
2002-07-28 22:50:13 +00:00
|
|
|
if (ob == dialog_->button_delete)
|
2001-07-30 11:56:00 +00:00
|
|
|
return erase();
|
2000-11-09 15:28:42 +00:00
|
|
|
|
2000-11-10 17:29:47 +00:00
|
|
|
return true;
|
2000-11-03 17:05:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
void FormPreferences::Converters::update()
|
2000-11-08 09:39:46 +00:00
|
|
|
{
|
2000-11-13 10:35:02 +00:00
|
|
|
local_converters = converters;
|
2001-07-30 11:56:00 +00:00
|
|
|
local_converters.update(local_formats);
|
2000-11-14 13:46:01 +00:00
|
|
|
UpdateBrowser();
|
2000-11-09 15:28:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
void FormPreferences::Converters::UpdateBrowser()
|
2000-11-13 10:35:02 +00:00
|
|
|
{
|
2001-07-30 11:56:00 +00:00
|
|
|
local_converters.sort();
|
2000-11-09 15:28:42 +00:00
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
fl_freeze_form(dialog_->form);
|
|
|
|
fl_clear_browser(dialog_->browser_all);
|
|
|
|
for (::Converters::const_iterator cit = local_converters.begin();
|
2000-11-13 10:35:02 +00:00
|
|
|
cit != local_converters.end(); ++cit) {
|
2001-07-12 11:11:10 +00:00
|
|
|
string const name = cit->From->prettyname() + " -> "
|
|
|
|
+ cit->To->prettyname();
|
2000-11-14 13:46:01 +00:00
|
|
|
fl_addto_browser(dialog_->browser_all, name.c_str());
|
2000-11-13 10:35:02 +00:00
|
|
|
}
|
2000-11-14 13:46:01 +00:00
|
|
|
Input();
|
|
|
|
fl_unfreeze_form(dialog_->form);
|
2000-11-13 10:35:02 +00:00
|
|
|
}
|
2000-11-09 15:28:42 +00:00
|
|
|
|
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
bool FormPreferences::Converters::Add()
|
2000-11-13 10:35:02 +00:00
|
|
|
{
|
2000-11-21 15:46:13 +00:00
|
|
|
string const from = GetFrom();
|
|
|
|
string const to = GetTo();
|
|
|
|
string const command = fl_get_input(dialog_->input_converter);
|
|
|
|
string const flags = fl_get_input(dialog_->input_flags);
|
2000-11-13 10:35:02 +00:00
|
|
|
|
2001-07-30 11:56:00 +00:00
|
|
|
Converter const * old = local_converters.getConverter(from, to);
|
|
|
|
local_converters.add(from, to, command, flags);
|
2000-11-13 10:35:02 +00:00
|
|
|
if (!old) {
|
2001-07-30 11:56:00 +00:00
|
|
|
local_converters.updateLast(local_formats);
|
2000-11-14 13:46:01 +00:00
|
|
|
UpdateBrowser();
|
2000-11-08 09:39:46 +00:00
|
|
|
}
|
2001-03-05 19:02:40 +00:00
|
|
|
setEnabled(dialog_->button_add, false);
|
2000-11-13 10:35:02 +00:00
|
|
|
|
2000-11-09 15:28:42 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-03-21 21:21:28 +00:00
|
|
|
bool FormPreferences::Converters::Browser()
|
2000-11-09 15:28:42 +00:00
|
|
|
{
|
2000-11-21 15:46:13 +00:00
|
|
|
int const i = fl_get_browser(dialog_->browser_all);
|
|
|
|
if (i <= 0) return false;
|
2000-11-09 15:28:42 +00:00
|
|
|
|
2000-11-21 15:46:13 +00:00
|
|
|
fl_freeze_form(dialog_->form);
|
2000-11-09 15:28:42 +00:00
|
|
|
|
2001-07-30 11:56:00 +00:00
|
|
|
Converter const & c = local_converters.get(i - 1);
|
|
|
|
int j = local_formats.getNumber(c.from);
|
2000-11-13 10:35:02 +00:00
|
|
|
if (j >= 0)
|
2001-07-30 11:56:00 +00:00
|
|
|
fl_set_choice(dialog_->choice_from, j + 1);
|
2000-11-09 15:28:42 +00:00
|
|
|
|
2001-07-30 11:56:00 +00:00
|
|
|
j = local_formats.getNumber(c.to);
|
2000-11-13 10:35:02 +00:00
|
|
|
if (j >= 0)
|
2001-07-30 11:56:00 +00:00
|
|
|
fl_set_choice(dialog_->choice_to, j + 1);
|
2000-11-09 15:28:42 +00:00
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
fl_set_input(dialog_->input_converter, c.command.c_str());
|
|
|
|
fl_set_input(dialog_->input_flags, c.flags.c_str());
|
2000-11-09 15:28:42 +00:00
|
|
|
|
2000-11-21 15:46:13 +00:00
|
|
|
fl_set_object_label(dialog_->button_add, idex(_("Modify|#M")));
|
2001-06-12 11:32:34 +00:00
|
|
|
fl_set_button_shortcut(dialog_->button_add, scex(_("Modify|#M")), 1);
|
2000-11-09 15:28:42 +00:00
|
|
|
|
2001-03-05 19:02:40 +00:00
|
|
|
setEnabled(dialog_->button_add, false);
|
|
|
|
setEnabled(dialog_->button_delete, true);
|
2002-03-21 21:21:28 +00:00
|
|
|
|
2000-11-21 15:46:13 +00:00
|
|
|
fl_unfreeze_form(dialog_->form);
|
2000-11-09 15:28:42 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-07-30 11:56:00 +00:00
|
|
|
bool FormPreferences::Converters::erase()
|
2000-11-09 15:28:42 +00:00
|
|
|
{
|
2000-11-21 15:46:13 +00:00
|
|
|
string const from = GetFrom();
|
|
|
|
string const to = GetTo();
|
2000-11-09 15:28:42 +00:00
|
|
|
|
2001-07-30 11:56:00 +00:00
|
|
|
local_converters.erase(from, to);
|
2000-11-14 13:46:01 +00:00
|
|
|
UpdateBrowser();
|
2000-11-09 15:28:42 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
bool FormPreferences::Converters::Input()
|
2000-11-09 15:28:42 +00:00
|
|
|
{
|
2000-11-21 15:46:13 +00:00
|
|
|
string const from = GetFrom();
|
|
|
|
string const to = GetTo();
|
2001-07-30 11:56:00 +00:00
|
|
|
int const sel = local_converters.getNumber(from, to);
|
2002-03-21 21:21:28 +00:00
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
fl_freeze_form(dialog_->form);
|
2000-11-09 15:28:42 +00:00
|
|
|
|
2000-11-13 10:35:02 +00:00
|
|
|
if (sel < 0) {
|
2001-06-12 11:32:34 +00:00
|
|
|
fl_set_object_label(dialog_->button_add, idex(_("Add|#A")));
|
2002-03-21 21:21:28 +00:00
|
|
|
fl_set_button_shortcut(dialog_->button_add,
|
2001-06-12 11:32:34 +00:00
|
|
|
scex(_("Add|#A")), 1);
|
2000-11-09 15:28:42 +00:00
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
fl_deselect_browser(dialog_->browser_all);
|
2001-03-05 19:02:40 +00:00
|
|
|
setEnabled(dialog_->button_delete, false);
|
2000-11-09 15:28:42 +00:00
|
|
|
|
|
|
|
} else {
|
2001-06-12 11:32:34 +00:00
|
|
|
fl_set_object_label(dialog_->button_add, idex(_("Modify|#M")));
|
2000-11-21 15:46:13 +00:00
|
|
|
fl_set_button_shortcut(dialog_->button_add,
|
2002-03-21 16:59:12 +00:00
|
|
|
scex(_("Modify|#M")), 1);
|
2002-03-21 21:21:28 +00:00
|
|
|
|
2000-11-13 10:35:02 +00:00
|
|
|
int top = max(sel-5, 0);
|
2000-11-14 13:46:01 +00:00
|
|
|
fl_set_browser_topline(dialog_->browser_all, top);
|
|
|
|
fl_select_browser_line(dialog_->browser_all, sel+1);
|
2001-03-05 19:02:40 +00:00
|
|
|
setEnabled(dialog_->button_delete, true);
|
2000-11-09 15:28:42 +00:00
|
|
|
}
|
|
|
|
|
2002-07-28 22:50:13 +00:00
|
|
|
string const command = rtrim(fl_get_input(dialog_->input_converter));
|
2001-03-05 19:02:40 +00:00
|
|
|
bool const enable = !(command.empty() || from == to);
|
|
|
|
setEnabled(dialog_->button_add, enable);
|
2000-11-13 10:35:02 +00:00
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
fl_unfreeze_form(dialog_->form);
|
2000-11-13 10:35:02 +00:00
|
|
|
return false;
|
2000-11-09 15:28:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
string const FormPreferences::Converters::GetFrom() const
|
2000-11-09 15:28:42 +00:00
|
|
|
{
|
2001-02-25 10:22:54 +00:00
|
|
|
::Formats::FormatList::size_type const i =
|
2001-02-23 17:20:28 +00:00
|
|
|
fl_get_choice(dialog_->choice_from);
|
|
|
|
|
2001-01-25 13:20:19 +00:00
|
|
|
if (i > 0 && i <= local_formats.size())
|
2001-07-30 11:56:00 +00:00
|
|
|
return local_formats.get(i - 1).name();
|
2002-07-17 15:34:00 +00:00
|
|
|
|
|
|
|
lyxerr << "FormPreferences::Converters::GetFrom: No choice!" << endl;
|
|
|
|
return "???";
|
2000-11-13 10:35:02 +00:00
|
|
|
}
|
2000-11-09 15:28:42 +00:00
|
|
|
|
2000-11-13 10:35:02 +00:00
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
string const FormPreferences::Converters::GetTo() const
|
2000-11-13 10:35:02 +00:00
|
|
|
{
|
2001-02-25 10:22:54 +00:00
|
|
|
::Formats::FormatList::size_type const i =
|
2001-06-12 11:32:34 +00:00
|
|
|
fl_get_choice(dialog_->choice_to);
|
2001-02-23 17:20:28 +00:00
|
|
|
|
2001-01-25 13:20:19 +00:00
|
|
|
if (i > 0 && i <= local_formats.size())
|
2001-07-30 11:56:00 +00:00
|
|
|
return local_formats.get(i - 1).name();
|
2002-07-17 15:34:00 +00:00
|
|
|
|
|
|
|
lyxerr << "FormPreferences::Converters::GetTo: No choice!" << endl;
|
|
|
|
return "???";
|
2000-11-09 15:28:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
void FormPreferences::Converters::UpdateChoices() const
|
2000-11-09 15:28:42 +00:00
|
|
|
{
|
|
|
|
string choice;
|
2000-11-14 13:46:01 +00:00
|
|
|
for (::Formats::const_iterator cit = local_formats.begin();
|
2000-11-21 15:46:13 +00:00
|
|
|
cit != local_formats.end(); ++cit) {
|
2000-11-13 10:35:02 +00:00
|
|
|
if (!choice.empty())
|
2000-11-09 15:28:42 +00:00
|
|
|
choice += " | ";
|
|
|
|
else
|
|
|
|
choice += " ";
|
2001-07-12 11:11:10 +00:00
|
|
|
choice += cit->prettyname();
|
2000-11-09 15:28:42 +00:00
|
|
|
}
|
|
|
|
choice += " ";
|
|
|
|
|
2000-11-21 15:46:13 +00:00
|
|
|
fl_clear_choice(dialog_->choice_from);
|
|
|
|
fl_addto_choice(dialog_->choice_from, choice.c_str());
|
2000-11-09 15:28:42 +00:00
|
|
|
|
2000-11-21 15:46:13 +00:00
|
|
|
fl_clear_choice(dialog_->choice_to);
|
|
|
|
fl_addto_choice(dialog_->choice_to, choice.c_str());
|
2000-11-09 15:28:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-02-16 15:59:55 +00:00
|
|
|
FormPreferences::Formats::Formats(FormPreferences & p)
|
2001-03-15 13:37:04 +00:00
|
|
|
: parent_(p)
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
2002-06-13 13:43:51 +00:00
|
|
|
FD_preferences_formats const * FormPreferences::Formats::dialog()
|
2000-11-14 13:46:01 +00:00
|
|
|
{
|
2001-03-15 13:37:04 +00:00
|
|
|
return dialog_.get();
|
2000-11-14 13:46:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void FormPreferences::Formats::apply() const
|
2000-11-06 11:20:22 +00:00
|
|
|
{
|
2000-11-13 10:35:02 +00:00
|
|
|
formats = local_formats;
|
2000-11-06 11:20:22 +00:00
|
|
|
}
|
2000-11-03 09:47:02 +00:00
|
|
|
|
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
void FormPreferences::Formats::build()
|
2000-11-03 09:47:02 +00:00
|
|
|
{
|
2002-06-14 09:17:11 +00:00
|
|
|
dialog_.reset(build_preferences_formats(&parent_));
|
2000-11-03 09:47:02 +00:00
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
fl_set_input_return(dialog_->input_format, FL_RETURN_CHANGED);
|
|
|
|
fl_set_input_return(dialog_->input_viewer, FL_RETURN_CHANGED);
|
|
|
|
fl_set_input_return(dialog_->input_shrtcut, FL_RETURN_CHANGED);
|
|
|
|
fl_set_input_return(dialog_->input_gui_name, FL_RETURN_CHANGED);
|
|
|
|
fl_set_input_return(dialog_->input_extension, FL_RETURN_CHANGED);
|
2000-11-03 09:47:02 +00:00
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
fl_set_input_filter(dialog_->input_format, fl_lowercase_filter);
|
2000-11-06 11:20:22 +00:00
|
|
|
|
2000-11-09 15:28:42 +00:00
|
|
|
// set up the feedback mechanism
|
2002-03-11 09:54:42 +00:00
|
|
|
setPrehandler(dialog_->browser_all);
|
|
|
|
setPrehandler(dialog_->input_format);
|
|
|
|
setPrehandler(dialog_->input_gui_name);
|
|
|
|
setPrehandler(dialog_->button_delete);
|
|
|
|
setPrehandler(dialog_->button_add);
|
|
|
|
setPrehandler(dialog_->input_extension);
|
|
|
|
setPrehandler(dialog_->input_viewer);
|
|
|
|
setPrehandler(dialog_->input_shrtcut);
|
2000-11-03 09:47:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-11-08 09:39:46 +00:00
|
|
|
string const
|
2000-11-21 15:46:13 +00:00
|
|
|
FormPreferences::Formats::feedback(FL_OBJECT const * const ob) const
|
2000-11-03 09:47:02 +00:00
|
|
|
{
|
2002-07-28 22:50:13 +00:00
|
|
|
if (ob == dialog_->browser_all)
|
2002-07-17 15:34:00 +00:00
|
|
|
return _("All the currently defined formats known to LyX.");
|
|
|
|
|
|
|
|
if (ob == dialog_->input_format)
|
|
|
|
return _("The format identifier.");
|
2000-11-03 09:47:02 +00:00
|
|
|
|
2002-07-17 15:34:00 +00:00
|
|
|
if (ob == dialog_->input_gui_name)
|
|
|
|
return _("The format name as it will appear in the menus.");
|
|
|
|
|
|
|
|
if (ob == dialog_->input_shrtcut)
|
|
|
|
return _("The keyboard accelerator. Use a letter in the GUI name. "
|
2002-07-28 22:50:13 +00:00
|
|
|
"Case sensitive.");
|
2002-07-17 15:34:00 +00:00
|
|
|
|
|
|
|
if (ob == dialog_->input_extension)
|
|
|
|
return _("Used to recognize the file. E.g., ps, pdf, tex.");
|
|
|
|
|
|
|
|
if (ob == dialog_->input_viewer)
|
|
|
|
return _("The command used to launch the viewer application.");
|
|
|
|
|
|
|
|
if (ob == dialog_->button_delete)
|
|
|
|
return _("Remove the current format from the list of available "
|
2002-07-28 22:50:13 +00:00
|
|
|
"formats. Note: you must then \"Apply\" the change.");
|
2002-07-17 15:34:00 +00:00
|
|
|
|
2002-07-28 22:50:13 +00:00
|
|
|
if (ob == dialog_->button_add) {
|
2000-11-21 21:51:25 +00:00
|
|
|
if (string(ob->label) == _("Add"))
|
2002-07-17 15:34:00 +00:00
|
|
|
return _("Add the current format to the list of available "
|
2002-07-28 22:50:13 +00:00
|
|
|
"formats. Note: you must then \"Apply\" the change.");
|
2000-11-21 21:51:25 +00:00
|
|
|
else
|
2002-07-17 15:34:00 +00:00
|
|
|
return _("Modify the contents of the current format. Note: "
|
2002-07-28 22:50:13 +00:00
|
|
|
"you must then \"Apply\" the change.");
|
2000-11-09 15:28:42 +00:00
|
|
|
}
|
|
|
|
|
2002-07-17 15:34:00 +00:00
|
|
|
return string();
|
2000-11-03 09:47:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
bool FormPreferences::Formats::input(FL_OBJECT const * const ob)
|
2000-11-03 09:47:02 +00:00
|
|
|
{
|
2002-07-28 22:50:13 +00:00
|
|
|
if (ob == dialog_->browser_all)
|
2000-11-14 13:46:01 +00:00
|
|
|
return Browser();
|
2000-11-08 09:39:46 +00:00
|
|
|
|
2002-07-17 15:34:00 +00:00
|
|
|
if (ob == dialog_->input_format
|
|
|
|
|| ob == dialog_->input_gui_name
|
|
|
|
|| ob == dialog_->input_shrtcut
|
|
|
|
|| ob == dialog_->input_extension
|
|
|
|
|| ob == dialog_->input_viewer)
|
2000-11-14 13:46:01 +00:00
|
|
|
return Input();
|
2000-11-08 09:39:46 +00:00
|
|
|
|
2002-07-28 22:50:13 +00:00
|
|
|
if (ob == dialog_->button_add)
|
2000-11-14 13:46:01 +00:00
|
|
|
return Add();
|
2000-11-08 09:39:46 +00:00
|
|
|
|
2002-07-28 22:50:13 +00:00
|
|
|
if (ob == dialog_->button_delete)
|
2001-07-30 11:56:00 +00:00
|
|
|
return erase();
|
2000-11-09 15:28:42 +00:00
|
|
|
|
|
|
|
return false;
|
2000-11-03 09:47:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
void FormPreferences::Formats::update()
|
2000-11-08 09:39:46 +00:00
|
|
|
{
|
2000-11-13 10:35:02 +00:00
|
|
|
local_formats = formats;
|
2000-11-14 13:46:01 +00:00
|
|
|
UpdateBrowser();
|
2000-11-13 10:35:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
void FormPreferences::Formats::UpdateBrowser()
|
2000-11-13 10:35:02 +00:00
|
|
|
{
|
2001-07-30 11:56:00 +00:00
|
|
|
local_formats.sort();
|
2000-11-13 10:35:02 +00:00
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
fl_freeze_form(dialog_->form);
|
|
|
|
fl_deselect_browser(dialog_->browser_all);
|
|
|
|
fl_clear_browser(dialog_->browser_all);
|
|
|
|
for (::Formats::const_iterator cit = local_formats.begin();
|
2000-11-13 10:35:02 +00:00
|
|
|
cit != local_formats.end(); ++cit)
|
2000-11-14 13:46:01 +00:00
|
|
|
fl_addto_browser(dialog_->browser_all,
|
2001-07-12 11:11:10 +00:00
|
|
|
cit->prettyname().c_str());
|
2000-11-13 10:35:02 +00:00
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
Input();
|
|
|
|
fl_unfreeze_form(dialog_->form);
|
2000-11-08 09:39:46 +00:00
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
// Mustn't forget to update the Formats available to the converters_
|
|
|
|
parent_.converters_.UpdateChoices();
|
2001-07-30 11:56:00 +00:00
|
|
|
local_converters.update(local_formats);
|
2000-11-08 09:39:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
bool FormPreferences::Formats::Add()
|
2000-11-08 09:39:46 +00:00
|
|
|
{
|
2000-11-21 15:46:13 +00:00
|
|
|
string const name = fl_get_input(dialog_->input_format);
|
|
|
|
string const prettyname = fl_get_input(dialog_->input_gui_name);
|
|
|
|
string const extension = fl_get_input(dialog_->input_extension);
|
|
|
|
string const shortcut = fl_get_input(dialog_->input_shrtcut);
|
|
|
|
string const viewer = fl_get_input(dialog_->input_viewer);
|
2000-11-08 09:39:46 +00:00
|
|
|
|
2001-07-30 11:56:00 +00:00
|
|
|
Format const * old = local_formats.getFormat(name);
|
2000-11-21 15:46:13 +00:00
|
|
|
string const old_prettyname = old ? old->prettyname() : string();
|
2001-07-30 11:56:00 +00:00
|
|
|
local_formats.add(name, extension, prettyname, shortcut);
|
|
|
|
local_formats.setViewer(name, viewer);
|
2000-11-13 10:35:02 +00:00
|
|
|
if (!old || prettyname != old_prettyname) {
|
2000-11-14 13:46:01 +00:00
|
|
|
UpdateBrowser();
|
2000-11-13 10:35:02 +00:00
|
|
|
if (old)
|
2000-11-14 13:46:01 +00:00
|
|
|
parent_.converters_.UpdateBrowser();
|
2000-11-09 15:28:42 +00:00
|
|
|
}
|
2001-03-05 19:02:40 +00:00
|
|
|
setEnabled(dialog_->button_add, false);
|
2000-11-09 15:28:42 +00:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2000-11-08 09:39:46 +00:00
|
|
|
|
|
|
|
|
2002-03-21 21:21:28 +00:00
|
|
|
bool FormPreferences::Formats::Browser()
|
2000-11-09 15:28:42 +00:00
|
|
|
{
|
2000-11-21 15:46:13 +00:00
|
|
|
int const i = fl_get_browser(dialog_->browser_all);
|
2002-07-17 15:34:00 +00:00
|
|
|
if (i <= 0)
|
|
|
|
return false;
|
2000-11-08 09:39:46 +00:00
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
fl_freeze_form(dialog_->form);
|
2000-11-08 09:39:46 +00:00
|
|
|
|
2001-07-30 11:56:00 +00:00
|
|
|
Format const & f = local_formats.get(i - 1);
|
2000-11-08 09:39:46 +00:00
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
fl_set_input(dialog_->input_format, f.name().c_str());
|
|
|
|
fl_set_input(dialog_->input_gui_name, f.prettyname().c_str());
|
|
|
|
fl_set_input(dialog_->input_shrtcut, f.shortcut().c_str());
|
|
|
|
fl_set_input(dialog_->input_extension, f.extension().c_str());
|
|
|
|
fl_set_input(dialog_->input_viewer, f.viewer().c_str());
|
2000-11-08 09:39:46 +00:00
|
|
|
|
2000-11-21 15:46:13 +00:00
|
|
|
fl_set_object_label(dialog_->button_add, idex(_("Modify|#M")));
|
|
|
|
fl_set_button_shortcut(dialog_->button_add, scex(_("Modify|#M")), 1);
|
2000-11-08 09:39:46 +00:00
|
|
|
|
2001-03-05 19:02:40 +00:00
|
|
|
setEnabled(dialog_->button_add, false);
|
|
|
|
setEnabled(dialog_->button_delete, true);
|
2002-03-21 21:21:28 +00:00
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
fl_unfreeze_form(dialog_->form);
|
2000-11-09 15:28:42 +00:00
|
|
|
return false;
|
2000-11-08 09:39:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-07-30 11:56:00 +00:00
|
|
|
bool FormPreferences::Formats::erase()
|
2000-11-08 09:39:46 +00:00
|
|
|
{
|
2000-11-21 15:46:13 +00:00
|
|
|
string const name = fl_get_input(dialog_->input_format);
|
2000-11-08 09:39:46 +00:00
|
|
|
|
2001-07-30 11:56:00 +00:00
|
|
|
if (local_converters.formatIsUsed(name)) {
|
2002-07-17 15:34:00 +00:00
|
|
|
parent_.postWarning(_("Cannot remove a Format used by a Converter. "
|
2002-07-28 22:50:13 +00:00
|
|
|
"Remove the converter first."));
|
2001-03-05 19:02:40 +00:00
|
|
|
setEnabled(dialog_->button_delete, false);
|
2000-11-09 15:28:42 +00:00
|
|
|
return false;
|
2000-11-08 09:39:46 +00:00
|
|
|
}
|
2000-11-09 15:28:42 +00:00
|
|
|
|
2001-07-30 11:56:00 +00:00
|
|
|
local_formats.erase(name);
|
2000-11-14 13:46:01 +00:00
|
|
|
UpdateBrowser();
|
2000-11-08 09:39:46 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
bool FormPreferences::Formats::Input()
|
2000-11-08 09:39:46 +00:00
|
|
|
{
|
2000-11-21 15:46:13 +00:00
|
|
|
string const name = fl_get_input(dialog_->input_format);
|
2001-07-30 11:56:00 +00:00
|
|
|
int const sel = local_formats.getNumber(name);
|
2000-11-14 13:46:01 +00:00
|
|
|
fl_freeze_form(dialog_->form);
|
2000-11-08 09:39:46 +00:00
|
|
|
|
2000-11-13 10:35:02 +00:00
|
|
|
if (sel < 0) {
|
2000-11-21 15:46:13 +00:00
|
|
|
fl_set_object_label(dialog_->button_add,
|
2002-03-21 16:59:12 +00:00
|
|
|
idex(_("Add|#A")));
|
2000-11-21 15:46:13 +00:00
|
|
|
fl_set_button_shortcut(dialog_->button_add,
|
2002-03-21 16:59:12 +00:00
|
|
|
scex(_("Add|#A")), 1);
|
2000-11-08 09:39:46 +00:00
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
fl_deselect_browser(dialog_->browser_all);
|
2001-03-05 19:02:40 +00:00
|
|
|
setEnabled(dialog_->button_delete, false);
|
2000-11-08 09:39:46 +00:00
|
|
|
|
|
|
|
} else {
|
2000-11-21 15:46:13 +00:00
|
|
|
fl_set_object_label(dialog_->button_add,
|
2002-03-21 16:59:12 +00:00
|
|
|
idex(_("Modify|#M")));
|
2000-11-21 15:46:13 +00:00
|
|
|
fl_set_button_shortcut(dialog_->button_add,
|
2002-03-21 16:59:12 +00:00
|
|
|
scex(_("Modify|#M")), 1);
|
2000-11-08 09:39:46 +00:00
|
|
|
|
2000-11-21 21:51:25 +00:00
|
|
|
int const top = max(sel-5, 0);
|
2000-11-14 13:46:01 +00:00
|
|
|
fl_set_browser_topline(dialog_->browser_all, top);
|
|
|
|
fl_select_browser_line(dialog_->browser_all, sel+1);
|
2000-11-08 09:39:46 +00:00
|
|
|
|
2001-03-05 19:02:40 +00:00
|
|
|
setEnabled(dialog_->button_add, true);
|
|
|
|
setEnabled(dialog_->button_delete, true);
|
2000-11-08 09:39:46 +00:00
|
|
|
}
|
|
|
|
|
2000-11-21 15:46:13 +00:00
|
|
|
string const prettyname = fl_get_input(dialog_->input_gui_name);
|
2001-03-05 19:02:40 +00:00
|
|
|
bool const enable = !(name.empty() || prettyname.empty());
|
|
|
|
setEnabled(dialog_->button_add, enable);
|
2000-11-13 10:35:02 +00:00
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
fl_unfreeze_form(dialog_->form);
|
2000-11-13 10:35:02 +00:00
|
|
|
return false;
|
2000-11-08 09:39:46 +00:00
|
|
|
}
|
2000-11-03 09:47:02 +00:00
|
|
|
|
|
|
|
|
2002-02-16 15:59:55 +00:00
|
|
|
FormPreferences::InputsMisc::InputsMisc(FormPreferences & p)
|
2001-03-15 13:37:04 +00:00
|
|
|
: parent_(p)
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
2002-06-13 13:43:51 +00:00
|
|
|
FD_preferences_inputs_misc const * FormPreferences::InputsMisc::dialog()
|
2000-11-14 13:46:01 +00:00
|
|
|
{
|
2001-03-15 13:37:04 +00:00
|
|
|
return dialog_.get();
|
2000-11-14 13:46:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void FormPreferences::InputsMisc::apply() const
|
2000-10-30 11:33:05 +00:00
|
|
|
{
|
2000-11-04 10:00:12 +00:00
|
|
|
lyxrc.date_insert_format =
|
2000-11-14 13:46:01 +00:00
|
|
|
fl_get_input(dialog_->input_date_format);
|
2000-10-30 11:33:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
void FormPreferences::InputsMisc::build()
|
2000-10-30 11:33:05 +00:00
|
|
|
{
|
2002-06-14 09:17:11 +00:00
|
|
|
dialog_.reset(build_preferences_inputs_misc(&parent_));
|
2000-10-30 11:33:05 +00:00
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
fl_set_input_return(dialog_->input_date_format, FL_RETURN_CHANGED);
|
2000-10-30 21:53:29 +00:00
|
|
|
|
|
|
|
// set up the feedback mechanism
|
2002-03-11 09:54:42 +00:00
|
|
|
setPrehandler(dialog_->input_date_format);
|
2000-10-30 11:33:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-11-04 10:00:12 +00:00
|
|
|
string const
|
2000-11-14 13:46:01 +00:00
|
|
|
FormPreferences::InputsMisc::feedback(FL_OBJECT const * const ob) const
|
2000-10-30 11:33:05 +00:00
|
|
|
{
|
2000-11-21 15:46:13 +00:00
|
|
|
if (ob == dialog_->input_date_format)
|
2002-07-17 15:34:00 +00:00
|
|
|
return lyxrc.getDescription(LyXRC::RC_DATE_INSERT_FORMAT);
|
|
|
|
return string();
|
2000-10-30 11:33:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
void FormPreferences::InputsMisc::update()
|
2000-10-30 11:33:05 +00:00
|
|
|
{
|
2000-11-14 13:46:01 +00:00
|
|
|
fl_set_input(dialog_->input_date_format,
|
2000-10-30 11:33:05 +00:00
|
|
|
lyxrc.date_insert_format.c_str());
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-02-16 15:59:55 +00:00
|
|
|
FormPreferences::Interface::Interface(FormPreferences & p)
|
2001-03-15 13:37:04 +00:00
|
|
|
: parent_(p)
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
2002-06-13 13:43:51 +00:00
|
|
|
FD_preferences_interface const * FormPreferences::Interface::dialog()
|
2000-11-14 13:46:01 +00:00
|
|
|
{
|
2001-03-15 13:37:04 +00:00
|
|
|
return dialog_.get();
|
2000-11-14 13:46:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void FormPreferences::Interface::apply() const
|
2000-10-27 10:04:51 +00:00
|
|
|
{
|
2002-01-10 15:14:22 +00:00
|
|
|
lyxrc.popup_normal_font =
|
|
|
|
fl_get_input(dialog_->input_popup_normal_font);
|
|
|
|
lyxrc.popup_bold_font = fl_get_input(dialog_->input_popup_bold_font);
|
|
|
|
lyxrc.popup_font_encoding =
|
|
|
|
fl_get_input(dialog_->input_popup_font_encoding);
|
2000-11-14 13:46:01 +00:00
|
|
|
lyxrc.bind_file = fl_get_input(dialog_->input_bind_file);
|
|
|
|
lyxrc.ui_file = fl_get_input(dialog_->input_ui_file);
|
2000-10-13 05:57:05 +00:00
|
|
|
lyxrc.override_x_deadkeys =
|
2000-11-14 13:46:01 +00:00
|
|
|
fl_get_button(dialog_->check_override_x_dead_keys);
|
2000-10-27 10:04:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
void FormPreferences::Interface::build()
|
2000-10-27 10:04:51 +00:00
|
|
|
{
|
2002-06-14 09:17:11 +00:00
|
|
|
dialog_.reset(build_preferences_interface(&parent_));
|
2000-10-27 10:04:51 +00:00
|
|
|
|
2002-01-10 15:14:22 +00:00
|
|
|
fl_set_input_return(dialog_->input_popup_normal_font, FL_RETURN_CHANGED);
|
|
|
|
fl_set_input_return(dialog_->input_popup_bold_font, FL_RETURN_CHANGED);
|
|
|
|
fl_set_input_return(dialog_->input_popup_font_encoding, FL_RETURN_CHANGED);
|
2000-11-14 13:46:01 +00:00
|
|
|
fl_set_input_return(dialog_->input_bind_file, FL_RETURN_CHANGED);
|
|
|
|
fl_set_input_return(dialog_->input_ui_file, FL_RETURN_CHANGED);
|
2000-10-30 21:53:29 +00:00
|
|
|
|
|
|
|
// set up the feedback mechanism
|
2002-03-11 09:54:42 +00:00
|
|
|
setPrehandler(dialog_->input_popup_normal_font);
|
|
|
|
setPrehandler(dialog_->input_popup_bold_font);
|
|
|
|
setPrehandler(dialog_->input_popup_font_encoding);
|
|
|
|
setPrehandler(dialog_->input_bind_file);
|
|
|
|
setPrehandler(dialog_->button_bind_file_browse);
|
|
|
|
setPrehandler(dialog_->input_ui_file);
|
|
|
|
setPrehandler(dialog_->button_ui_file_browse);
|
|
|
|
setPrehandler(dialog_->check_override_x_dead_keys);
|
2000-10-27 10:04:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-11-04 10:00:12 +00:00
|
|
|
string const
|
2000-11-21 15:46:13 +00:00
|
|
|
FormPreferences::Interface::feedback(FL_OBJECT const * const ob) const
|
2000-10-27 10:04:51 +00:00
|
|
|
{
|
2002-01-10 15:14:22 +00:00
|
|
|
if (ob == dialog_->input_popup_normal_font)
|
2002-07-17 15:34:00 +00:00
|
|
|
return lyxrc.getDescription(LyXRC::RC_POPUP_NORMAL_FONT);
|
|
|
|
if (ob == dialog_->input_popup_bold_font)
|
|
|
|
return lyxrc.getDescription(LyXRC::RC_POPUP_BOLD_FONT);
|
|
|
|
if (ob == dialog_->input_popup_font_encoding)
|
|
|
|
return lyxrc.getDescription(LyXRC::RC_POPUP_FONT_ENCODING);
|
|
|
|
if (ob == dialog_->input_bind_file)
|
|
|
|
return lyxrc.getDescription(LyXRC::RC_BINDFILE);
|
|
|
|
if (ob == dialog_->input_ui_file)
|
|
|
|
return lyxrc.getDescription(LyXRC::RC_UIFILE);
|
|
|
|
if (ob == dialog_->check_override_x_dead_keys)
|
|
|
|
return lyxrc.getDescription(LyXRC::RC_OVERRIDE_X_DEADKEYS);
|
|
|
|
return string();
|
2000-10-27 10:04:51 +00:00
|
|
|
}
|
2000-10-25 10:19:25 +00:00
|
|
|
|
2000-10-27 10:04:51 +00:00
|
|
|
|
2000-11-21 15:46:13 +00:00
|
|
|
bool FormPreferences::Interface::input(FL_OBJECT const * const ob)
|
2000-11-14 13:46:01 +00:00
|
|
|
{
|
2000-11-21 15:46:13 +00:00
|
|
|
if (ob == dialog_->button_bind_file_browse) {
|
2000-12-11 09:46:09 +00:00
|
|
|
string dir = AddName(system_lyxdir, "bind");
|
2002-04-02 17:04:23 +00:00
|
|
|
string name = _("Sys Bind|#S#s");
|
2000-11-14 13:46:01 +00:00
|
|
|
pair<string,string> dir1(name, dir);
|
|
|
|
|
2000-12-11 09:46:09 +00:00
|
|
|
dir = AddName(user_lyxdir, "bind");
|
2002-04-02 17:04:23 +00:00
|
|
|
name = _("User Bind|#U#u");
|
2000-11-14 13:46:01 +00:00
|
|
|
pair<string,string> dir2(name, dir);
|
|
|
|
|
2000-11-21 15:46:13 +00:00
|
|
|
parent_.browse(dialog_->input_bind_file,
|
2002-04-02 17:04:23 +00:00
|
|
|
_("Bind file"), "*.bind", dir1, dir2);
|
2002-03-21 21:21:28 +00:00
|
|
|
|
2000-11-21 15:46:13 +00:00
|
|
|
} else if (ob == dialog_->button_ui_file_browse) {
|
2000-12-11 09:46:09 +00:00
|
|
|
string dir = AddName(system_lyxdir, "ui");
|
2002-04-02 17:04:23 +00:00
|
|
|
string name = _("Sys UI|#S#s");
|
2000-11-14 13:46:01 +00:00
|
|
|
pair<string,string> dir1(name, dir);
|
|
|
|
|
2000-12-11 09:46:09 +00:00
|
|
|
dir = AddName(user_lyxdir, "ui");
|
2002-04-02 17:04:23 +00:00
|
|
|
name = _("User UI|#U#u");
|
2000-11-14 13:46:01 +00:00
|
|
|
pair<string,string> dir2(name, dir);
|
|
|
|
|
2000-11-21 15:46:13 +00:00
|
|
|
parent_.browse(dialog_->input_ui_file,
|
2002-04-02 17:04:23 +00:00
|
|
|
_("UI file"), "*.ui", dir1, dir2);
|
2000-11-14 13:46:01 +00:00
|
|
|
}
|
2002-03-21 21:21:28 +00:00
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void FormPreferences::Interface::update()
|
2000-10-27 10:04:51 +00:00
|
|
|
{
|
2002-01-10 15:14:22 +00:00
|
|
|
fl_set_input(dialog_->input_popup_normal_font,
|
|
|
|
lyxrc.popup_normal_font.c_str());
|
|
|
|
fl_set_input(dialog_->input_popup_bold_font,
|
|
|
|
lyxrc.popup_bold_font.c_str());
|
|
|
|
fl_set_input(dialog_->input_popup_font_encoding,
|
|
|
|
lyxrc.popup_font_encoding.c_str());
|
2000-11-14 13:46:01 +00:00
|
|
|
fl_set_input(dialog_->input_bind_file,
|
2000-10-27 10:04:51 +00:00
|
|
|
lyxrc.bind_file.c_str());
|
2000-11-14 13:46:01 +00:00
|
|
|
fl_set_input(dialog_->input_ui_file,
|
2000-10-27 10:04:51 +00:00
|
|
|
lyxrc.ui_file.c_str());
|
2000-11-14 13:46:01 +00:00
|
|
|
fl_set_button(dialog_->check_override_x_dead_keys,
|
2000-10-27 10:04:51 +00:00
|
|
|
lyxrc.override_x_deadkeys);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-02-16 15:59:55 +00:00
|
|
|
FormPreferences::Language::Language(FormPreferences & p)
|
2001-03-15 13:37:04 +00:00
|
|
|
: parent_(p)
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
2002-06-13 13:43:51 +00:00
|
|
|
FD_preferences_language const * FormPreferences::Language::dialog()
|
2000-11-14 13:46:01 +00:00
|
|
|
{
|
2001-03-15 13:37:04 +00:00
|
|
|
return dialog_.get();
|
2000-11-14 13:46:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void FormPreferences::Language::apply()
|
2000-10-30 11:33:05 +00:00
|
|
|
{
|
2002-04-29 16:16:35 +00:00
|
|
|
int const pos = combo_default_lang->get();
|
|
|
|
lyxrc.default_language = lang_[pos-1];
|
2000-10-30 11:33:05 +00:00
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
int button = fl_get_button(dialog_->check_use_kbmap);
|
2000-11-21 15:46:13 +00:00
|
|
|
string const name_1 = fl_get_input(dialog_->input_kbmap1);
|
|
|
|
string const name_2 = fl_get_input(dialog_->input_kbmap2);
|
|
|
|
if (button)
|
|
|
|
button = !(name_1.empty() && name_2.empty());
|
2000-10-30 11:33:05 +00:00
|
|
|
lyxrc.use_kbmap = static_cast<bool>(button);
|
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
if (lyxrc.use_kbmap) {
|
|
|
|
lyxrc.primary_kbmap = name_1;
|
|
|
|
lyxrc.secondary_kbmap = name_2;
|
2000-10-30 11:33:05 +00:00
|
|
|
}
|
2002-03-21 21:21:28 +00:00
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
button = fl_get_button(dialog_->check_rtl_support);
|
2000-10-30 11:33:05 +00:00
|
|
|
lyxrc.rtl_support = static_cast<bool>(button);
|
|
|
|
|
2001-02-25 10:22:54 +00:00
|
|
|
button = fl_get_button(dialog_->check_mark_foreign);
|
|
|
|
lyxrc.mark_foreign_language = static_cast<bool>(button);
|
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
button = fl_get_button(dialog_->check_auto_begin);
|
2000-10-30 11:33:05 +00:00
|
|
|
lyxrc.language_auto_begin = static_cast<bool>(button);
|
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
button = fl_get_button(dialog_->check_auto_end);
|
2000-10-30 11:33:05 +00:00
|
|
|
lyxrc.language_auto_end = static_cast<bool>(button);
|
|
|
|
|
2001-02-25 10:22:54 +00:00
|
|
|
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);
|
2000-10-30 11:33:05 +00:00
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
lyxrc.language_package = fl_get_input(dialog_->input_package);
|
|
|
|
lyxrc.language_command_begin = fl_get_input(dialog_->input_command_begin);
|
|
|
|
lyxrc.language_command_end = fl_get_input(dialog_->input_command_end);
|
2000-11-08 09:39:46 +00:00
|
|
|
|
|
|
|
// Ensure that all is self-consistent.
|
2000-11-14 13:46:01 +00:00
|
|
|
update();
|
2000-10-30 11:33:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
void FormPreferences::Language::build()
|
2000-10-27 10:04:51 +00:00
|
|
|
{
|
2002-06-14 09:17:11 +00:00
|
|
|
dialog_.reset(build_preferences_language(&parent_));
|
2000-10-30 11:33:05 +00:00
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
fl_set_input_return(dialog_->input_package, FL_RETURN_CHANGED);
|
|
|
|
fl_set_input_return(dialog_->input_command_begin, FL_RETURN_CHANGED);
|
|
|
|
fl_set_input_return(dialog_->input_command_end, FL_RETURN_CHANGED);
|
2000-10-30 11:33:05 +00:00
|
|
|
|
2002-04-29 16:16:35 +00:00
|
|
|
// Store the lang identifiers for later
|
2002-04-30 15:07:03 +00:00
|
|
|
vector<frnt::LanguagePair> const langs = frnt::getLanguageData(false);
|
2002-04-29 16:16:35 +00:00
|
|
|
lang_ = getSecond(langs);
|
|
|
|
|
2000-10-30 21:53:29 +00:00
|
|
|
// The default_language is a combo-box and has to be inserted manually
|
2000-11-14 13:46:01 +00:00
|
|
|
fl_freeze_form(dialog_->form);
|
|
|
|
fl_addto_form(dialog_->form);
|
2000-10-30 11:33:05 +00:00
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
FL_OBJECT * obj = dialog_->choice_default_lang;
|
|
|
|
fl_deactivate_object(dialog_->choice_default_lang);
|
2001-03-15 13:37:04 +00:00
|
|
|
combo_default_lang.reset(new Combox(FL_COMBOX_DROPLIST));
|
2000-11-29 15:06:42 +00:00
|
|
|
combo_default_lang->add(obj->x, obj->y, obj->w, obj->h, 400,
|
2002-01-17 10:53:14 +00:00
|
|
|
parent_.lang_opts_tab_->tabfolder_inner,
|
2000-11-29 15:06:42 +00:00
|
|
|
parent_.dialog_->tabfolder_prefs);
|
2000-10-30 21:53:29 +00:00
|
|
|
combo_default_lang->shortcut("#L",1);
|
2000-11-14 13:46:01 +00:00
|
|
|
combo_default_lang->setcallback(ComboCB, &parent_);
|
2000-11-08 09:39:46 +00:00
|
|
|
|
2002-04-29 16:16:35 +00:00
|
|
|
vector<frnt::LanguagePair>::const_iterator lit = langs.begin();
|
|
|
|
vector<frnt::LanguagePair>::const_iterator lend = langs.end();
|
|
|
|
for (; lit != lend; ++lit) {
|
2002-04-30 15:07:03 +00:00
|
|
|
combo_default_lang->addto(lit->first);
|
2000-11-08 09:39:46 +00:00
|
|
|
}
|
2002-04-29 16:16:35 +00:00
|
|
|
combo_default_lang->select(1);
|
2000-11-08 09:39:46 +00:00
|
|
|
|
2000-10-30 21:53:29 +00:00
|
|
|
fl_end_form();
|
2000-11-14 13:46:01 +00:00
|
|
|
fl_unfreeze_form(dialog_->form);
|
2000-10-30 21:53:29 +00:00
|
|
|
|
|
|
|
// set up the feedback mechanism
|
2002-03-11 09:54:42 +00:00
|
|
|
setPrehandler(dialog_->input_package);
|
|
|
|
setPrehandler(dialog_->check_use_kbmap);
|
2000-10-30 21:53:29 +00:00
|
|
|
|
2000-11-02 14:47:47 +00:00
|
|
|
// This is safe, as nothing is done to the pointer, other than
|
|
|
|
// to use its address in a block-if statement.
|
2000-11-29 15:06:42 +00:00
|
|
|
// No it's not! Leads to crash.
|
2002-03-11 09:54:42 +00:00
|
|
|
// setPrehandler(
|
2002-03-21 21:21:28 +00:00
|
|
|
// reinterpret_cast<FL_OBJECT *>(combo_default_lang),
|
2000-11-21 15:46:13 +00:00
|
|
|
// C_FormPreferencesFeedbackCB);
|
2000-11-15 18:02:45 +00:00
|
|
|
|
2002-03-11 09:54:42 +00:00
|
|
|
setPrehandler(dialog_->input_kbmap1);
|
|
|
|
setPrehandler(dialog_->input_kbmap2);
|
|
|
|
setPrehandler(dialog_->check_rtl_support);
|
|
|
|
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);
|
2000-11-08 09:39:46 +00:00
|
|
|
|
|
|
|
// Activate/Deactivate the input fields dependent on the state of the
|
|
|
|
// buttons.
|
2000-11-21 15:46:13 +00:00
|
|
|
input(0);
|
2000-10-30 21:53:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-11-04 10:00:12 +00:00
|
|
|
string const
|
2000-11-14 13:46:01 +00:00
|
|
|
FormPreferences::Language::feedback(FL_OBJECT const * const ob) const
|
2000-10-30 11:33:05 +00:00
|
|
|
{
|
2001-03-15 13:37:04 +00:00
|
|
|
if (reinterpret_cast<Combox const *>(ob) == combo_default_lang.get())
|
2002-07-17 15:34:00 +00:00
|
|
|
return lyxrc.getDescription(LyXRC::RC_DEFAULT_LANGUAGE);
|
|
|
|
if (ob == dialog_->check_use_kbmap)
|
|
|
|
return lyxrc.getDescription(LyXRC::RC_KBMAP);
|
|
|
|
if (ob == dialog_->input_kbmap1)
|
|
|
|
return lyxrc.getDescription(LyXRC::RC_KBMAP_PRIMARY);
|
|
|
|
if (ob == dialog_->input_kbmap2)
|
|
|
|
return lyxrc.getDescription(LyXRC::RC_KBMAP_SECONDARY);
|
|
|
|
if (ob == dialog_->check_rtl_support)
|
|
|
|
return lyxrc.getDescription(LyXRC::RC_RTL_SUPPORT);
|
|
|
|
if (ob == dialog_->check_mark_foreign)
|
|
|
|
return lyxrc.getDescription(LyXRC::RC_MARK_FOREIGN_LANGUAGE);
|
|
|
|
if (ob == dialog_->check_auto_begin)
|
|
|
|
return lyxrc.getDescription(LyXRC::RC_LANGUAGE_AUTO_BEGIN);
|
|
|
|
if (ob == dialog_->check_auto_end)
|
|
|
|
return lyxrc.getDescription(LyXRC::RC_LANGUAGE_AUTO_END);
|
|
|
|
if (ob == dialog_->check_use_babel)
|
|
|
|
return lyxrc.getDescription(LyXRC::RC_LANGUAGE_USE_BABEL);
|
|
|
|
if (ob == dialog_->check_global_options)
|
|
|
|
return lyxrc.getDescription(LyXRC::RC_LANGUAGE_GLOBAL_OPTIONS);
|
|
|
|
if (ob == dialog_->input_package)
|
|
|
|
return lyxrc.getDescription(LyXRC::RC_LANGUAGE_PACKAGE);
|
|
|
|
if (ob == dialog_->input_command_begin)
|
|
|
|
return lyxrc.getDescription(LyXRC::RC_LANGUAGE_COMMAND_BEGIN);
|
|
|
|
if (ob == dialog_->input_command_end)
|
|
|
|
return lyxrc.getDescription(LyXRC::RC_LANGUAGE_COMMAND_END);
|
|
|
|
return string();
|
2000-10-30 11:33:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-11-21 15:46:13 +00:00
|
|
|
bool FormPreferences::Language::input(FL_OBJECT const * const ob)
|
2000-10-30 11:33:05 +00:00
|
|
|
{
|
|
|
|
bool activate = true;
|
2000-10-30 21:53:29 +00:00
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
// !ob if function is called from Language::build() to de/activate
|
2000-11-09 15:28:42 +00:00
|
|
|
// objects,
|
|
|
|
// otherwise the function is called by an xforms CB via input().
|
2000-11-14 13:46:01 +00:00
|
|
|
if (!ob || ob == dialog_->check_use_kbmap) {
|
2001-03-05 19:02:40 +00:00
|
|
|
bool const enable = fl_get_button(dialog_->check_use_kbmap);
|
|
|
|
setEnabled(dialog_->button_kbmap1_browse, enable);
|
|
|
|
setEnabled(dialog_->button_kbmap2_browse, enable);
|
|
|
|
setEnabled(dialog_->input_kbmap1, enable);
|
|
|
|
setEnabled(dialog_->input_kbmap2, enable);
|
2000-10-30 11:33:05 +00:00
|
|
|
}
|
|
|
|
|
2000-11-15 03:22:08 +00:00
|
|
|
if (ob == dialog_->button_kbmap1_browse) {
|
2000-12-11 09:46:09 +00:00
|
|
|
string const dir = AddName(system_lyxdir, "kbd");
|
2002-04-02 17:04:23 +00:00
|
|
|
string const name = _("Key maps|#K#k");
|
2000-11-15 03:22:08 +00:00
|
|
|
pair<string, string> dir1(name, dir);
|
2000-11-14 13:46:01 +00:00
|
|
|
|
2000-11-15 03:22:08 +00:00
|
|
|
parent_.browse(dialog_->input_kbmap1,
|
2002-04-02 17:04:23 +00:00
|
|
|
_("Keyboard map"), "*.kmap", dir1);
|
2000-11-15 03:22:08 +00:00
|
|
|
} else if (ob == dialog_->button_kbmap2_browse) {
|
2000-12-11 09:46:09 +00:00
|
|
|
string const dir = AddName(system_lyxdir, "kbd");
|
2002-04-02 17:04:23 +00:00
|
|
|
string const name = _("Key maps|#K#k");
|
2000-11-15 03:22:08 +00:00
|
|
|
pair<string, string> dir1(name, dir);
|
2000-11-14 13:46:01 +00:00
|
|
|
|
2000-11-15 03:22:08 +00:00
|
|
|
parent_.browse(dialog_->input_kbmap2,
|
2002-04-02 17:04:23 +00:00
|
|
|
_("Keyboard map"), "*.kmap", dir1);
|
2000-11-14 13:46:01 +00:00
|
|
|
}
|
|
|
|
|
2000-10-30 11:33:05 +00:00
|
|
|
return activate;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
void FormPreferences::Language::update()
|
2000-10-30 11:33:05 +00:00
|
|
|
{
|
2000-11-14 13:46:01 +00:00
|
|
|
fl_set_button(dialog_->check_use_kbmap,
|
2000-10-30 11:33:05 +00:00
|
|
|
lyxrc.use_kbmap);
|
|
|
|
|
2002-04-29 16:16:35 +00:00
|
|
|
int const pos = int(findPos(lang_, lyxrc.default_language));
|
2002-07-17 15:34:00 +00:00
|
|
|
combo_default_lang->select(pos + 1);
|
2000-10-30 11:33:05 +00:00
|
|
|
|
2000-11-04 10:00:12 +00:00
|
|
|
if (lyxrc.use_kbmap) {
|
2000-11-14 13:46:01 +00:00
|
|
|
fl_set_input(dialog_->input_kbmap1,
|
|
|
|
lyxrc.primary_kbmap.c_str());
|
|
|
|
fl_set_input(dialog_->input_kbmap2,
|
|
|
|
lyxrc.secondary_kbmap.c_str());
|
2000-10-30 21:53:29 +00:00
|
|
|
} else {
|
2000-11-14 13:46:01 +00:00
|
|
|
fl_set_input(dialog_->input_kbmap1, "");
|
|
|
|
fl_set_input(dialog_->input_kbmap2, "");
|
2000-10-30 21:53:29 +00:00
|
|
|
}
|
2002-03-21 21:21:28 +00:00
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
fl_set_button(dialog_->check_rtl_support, lyxrc.rtl_support);
|
|
|
|
fl_set_button(dialog_->check_mark_foreign,
|
2000-10-30 11:33:05 +00:00
|
|
|
lyxrc.mark_foreign_language);
|
2001-02-25 10:22:54 +00:00
|
|
|
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);
|
2000-10-30 11:33:05 +00:00
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
fl_set_input(dialog_->input_package,
|
2000-10-30 11:33:05 +00:00
|
|
|
lyxrc.language_package.c_str());
|
2000-11-14 13:46:01 +00:00
|
|
|
fl_set_input(dialog_->input_command_begin,
|
2000-10-30 11:33:05 +00:00
|
|
|
lyxrc.language_command_begin.c_str());
|
2000-11-14 13:46:01 +00:00
|
|
|
fl_set_input(dialog_->input_command_end,
|
2000-10-30 11:33:05 +00:00
|
|
|
lyxrc.language_command_end.c_str());
|
|
|
|
|
|
|
|
// Activate/Deactivate the input fields dependent on the state of the
|
|
|
|
// buttons.
|
2000-11-15 03:22:08 +00:00
|
|
|
input(0);
|
2000-11-14 13:46:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void FormPreferences::Language::ComboCB(int, void * v, Combox * combox)
|
|
|
|
{
|
2002-03-21 16:59:12 +00:00
|
|
|
FormPreferences * pre = static_cast<FormPreferences*>(v);
|
|
|
|
// This is safe, as nothing is done to the pointer, other than
|
|
|
|
// to use its address in a block-if statement.
|
|
|
|
pre->bc().valid(pre->input(reinterpret_cast<FL_OBJECT *>(combox), 0));
|
2000-10-27 10:04:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-02-16 15:59:55 +00:00
|
|
|
FormPreferences::LnFmisc::LnFmisc(FormPreferences & p)
|
2001-03-15 13:37:04 +00:00
|
|
|
: parent_(p)
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
2002-06-13 13:43:51 +00:00
|
|
|
FD_preferences_lnf_misc const * FormPreferences::LnFmisc::dialog()
|
2000-10-27 10:04:51 +00:00
|
|
|
{
|
2001-03-15 13:37:04 +00:00
|
|
|
return dialog_.get();
|
2000-11-14 13:46:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void FormPreferences::LnFmisc::apply() const
|
|
|
|
{
|
|
|
|
lyxrc.auto_region_delete =
|
|
|
|
fl_get_button(dialog_->check_auto_region_delete);
|
2000-10-27 10:04:51 +00:00
|
|
|
lyxrc.cursor_follows_scrollbar =
|
2000-11-14 13:46:01 +00:00
|
|
|
fl_get_button(dialog_->check_cursor_follows_scrollbar);
|
2001-09-07 10:11:02 +00:00
|
|
|
lyxrc.dialogs_iconify_with_main =
|
|
|
|
fl_get_button(dialog_->check_dialogs_iconify_with_main);
|
2002-06-27 17:48:09 +00:00
|
|
|
lyxrc.preview = fl_get_button(dialog_->check_preview_latex);
|
2000-10-27 10:04:51 +00:00
|
|
|
lyxrc.autosave = static_cast<unsigned int>
|
2000-11-14 13:46:01 +00:00
|
|
|
(fl_get_counter_value(dialog_->counter_autosave));
|
2000-10-27 10:04:51 +00:00
|
|
|
lyxrc.wheel_jump = static_cast<unsigned int>
|
2000-11-14 13:46:01 +00:00
|
|
|
(fl_get_counter_value(dialog_->counter_wm_jump));
|
2001-09-18 10:58:35 +00:00
|
|
|
|
2002-02-27 09:59:52 +00:00
|
|
|
string const old_value = lyxrc.display_graphics;
|
2001-09-18 10:58:35 +00:00
|
|
|
if (fl_get_button(dialog_->radio_display_monochrome)) {
|
|
|
|
lyxrc.display_graphics = "mono";
|
|
|
|
} else if (fl_get_button(dialog_->radio_display_grayscale)) {
|
|
|
|
lyxrc.display_graphics = "gray";
|
|
|
|
} else if (fl_get_button(dialog_->radio_display_color)) {
|
|
|
|
lyxrc.display_graphics = "color";
|
|
|
|
} else {
|
|
|
|
lyxrc.display_graphics = "no";
|
|
|
|
}
|
2002-06-25 15:59:10 +00:00
|
|
|
|
|
|
|
#ifdef WITH_WARNINGS
|
|
|
|
#warning FIXME!! The graphics cache no longer has a changeDisplay method.
|
|
|
|
#endif
|
|
|
|
#if 0
|
2002-02-27 09:59:52 +00:00
|
|
|
if (old_value != lyxrc.display_graphics) {
|
|
|
|
grfx::GCache & gc = grfx::GCache::get();
|
|
|
|
gc.changeDisplay();
|
|
|
|
}
|
2002-06-25 15:59:10 +00:00
|
|
|
#endif
|
2000-10-27 10:04:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
void FormPreferences::LnFmisc::build()
|
2000-10-27 10:04:51 +00:00
|
|
|
{
|
2002-06-14 09:17:11 +00:00
|
|
|
dialog_.reset(build_preferences_lnf_misc(&parent_));
|
2000-10-27 10:04:51 +00:00
|
|
|
|
2000-11-21 21:51:25 +00:00
|
|
|
fl_set_counter_step(dialog_->counter_autosave, 1, 10);
|
|
|
|
fl_set_counter_step(dialog_->counter_wm_jump, 1, 10);
|
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
fl_set_counter_return(dialog_->counter_autosave, FL_RETURN_CHANGED);
|
|
|
|
fl_set_counter_return(dialog_->counter_wm_jump, FL_RETURN_CHANGED);
|
2000-10-30 21:53:29 +00:00
|
|
|
|
|
|
|
// set up the feedback mechanism
|
2002-03-11 09:54:42 +00:00
|
|
|
setPrehandler(dialog_->check_auto_region_delete);
|
|
|
|
setPrehandler(dialog_->counter_autosave);
|
|
|
|
setPrehandler(dialog_->check_cursor_follows_scrollbar);
|
|
|
|
setPrehandler(dialog_->check_dialogs_iconify_with_main);
|
2002-06-27 17:48:09 +00:00
|
|
|
setPrehandler(dialog_->check_preview_latex);
|
2002-03-11 09:54:42 +00:00
|
|
|
setPrehandler(dialog_->counter_wm_jump);
|
|
|
|
setPrehandler(dialog_->radio_display_monochrome);
|
|
|
|
setPrehandler(dialog_->radio_display_grayscale);
|
|
|
|
setPrehandler(dialog_->radio_display_color);
|
|
|
|
setPrehandler(dialog_->radio_no_display);
|
2000-10-27 10:04:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
string const
|
|
|
|
FormPreferences::LnFmisc::feedback(FL_OBJECT const * const ob) const
|
2000-10-27 10:04:51 +00:00
|
|
|
{
|
2002-06-21 11:35:41 +00:00
|
|
|
if (ob == dialog_->check_auto_region_delete)
|
2002-07-17 15:34:00 +00:00
|
|
|
return lyxrc.getDescription(LyXRC::RC_AUTOREGIONDELETE);
|
|
|
|
if (ob == dialog_->check_cursor_follows_scrollbar)
|
|
|
|
return lyxrc.getDescription(LyXRC::RC_CURSOR_FOLLOWS_SCROLLBAR);
|
|
|
|
if (ob == dialog_->check_dialogs_iconify_with_main)
|
|
|
|
return lyxrc.getDescription(LyXRC::RC_DIALOGS_ICONIFY_WITH_MAIN);
|
|
|
|
if (ob == dialog_->check_preview_latex)
|
|
|
|
return lyxrc.getDescription(LyXRC::RC_PREVIEW);
|
|
|
|
if (ob == dialog_->counter_autosave)
|
|
|
|
return lyxrc.getDescription(LyXRC::RC_AUTOSAVE);
|
|
|
|
if (ob == dialog_->counter_wm_jump)
|
|
|
|
return lyxrc.getDescription(LyXRC::RC_WHEEL_JUMP);
|
|
|
|
if (ob == dialog_->radio_display_monochrome ||
|
2001-09-18 10:58:35 +00:00
|
|
|
ob == dialog_->radio_display_grayscale ||
|
|
|
|
ob == dialog_->radio_display_color ||
|
|
|
|
ob == dialog_->radio_no_display)
|
2002-07-17 15:34:00 +00:00
|
|
|
return lyxrc.getDescription(LyXRC::RC_DISPLAY_GRAPHICS);
|
|
|
|
return string();
|
2000-10-27 10:04:51 +00:00
|
|
|
}
|
|
|
|
|
2000-11-04 10:00:12 +00:00
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
void FormPreferences::LnFmisc::update()
|
2000-10-27 10:04:51 +00:00
|
|
|
{
|
2002-03-21 21:21:28 +00:00
|
|
|
fl_set_button(dialog_->check_auto_region_delete,
|
2000-10-27 10:04:51 +00:00
|
|
|
lyxrc.auto_region_delete);
|
2000-11-14 13:46:01 +00:00
|
|
|
fl_set_button(dialog_->check_cursor_follows_scrollbar,
|
2000-10-27 10:04:51 +00:00
|
|
|
lyxrc.cursor_follows_scrollbar);
|
2001-09-07 10:11:02 +00:00
|
|
|
fl_set_button(dialog_->check_dialogs_iconify_with_main,
|
|
|
|
lyxrc.dialogs_iconify_with_main);
|
2002-06-27 17:48:09 +00:00
|
|
|
fl_set_button(dialog_->check_preview_latex,
|
|
|
|
lyxrc.preview);
|
2000-11-14 13:46:01 +00:00
|
|
|
fl_set_counter_value(dialog_->counter_autosave, lyxrc.autosave);
|
|
|
|
fl_set_counter_value(dialog_->counter_wm_jump, lyxrc.wheel_jump);
|
2001-09-18 10:58:35 +00:00
|
|
|
|
|
|
|
if (lyxrc.display_graphics == "mono") {
|
|
|
|
fl_set_button(dialog_->radio_display_monochrome, 1);
|
|
|
|
} else if (lyxrc.display_graphics == "gray") {
|
|
|
|
fl_set_button(dialog_->radio_display_grayscale, 1);
|
|
|
|
} else if (lyxrc.display_graphics == "color") {
|
|
|
|
fl_set_button(dialog_->radio_display_color, 1);
|
|
|
|
} else {
|
|
|
|
fl_set_button(dialog_->radio_no_display, 1);
|
|
|
|
}
|
2000-11-14 13:46:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-02-16 15:59:55 +00:00
|
|
|
FormPreferences::OutputsMisc::OutputsMisc(FormPreferences & p)
|
2001-03-15 13:37:04 +00:00
|
|
|
: parent_(p)
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
2002-06-13 13:43:51 +00:00
|
|
|
FD_preferences_outputs_misc const * FormPreferences::OutputsMisc::dialog()
|
2000-11-14 13:46:01 +00:00
|
|
|
{
|
2001-03-15 13:37:04 +00:00
|
|
|
return dialog_.get();
|
2000-10-27 10:04:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
void FormPreferences::OutputsMisc::apply() const
|
2000-10-27 10:04:51 +00:00
|
|
|
{
|
|
|
|
lyxrc.ascii_linelen = static_cast<unsigned int>
|
2000-11-14 13:46:01 +00:00
|
|
|
(fl_get_counter_value(dialog_->counter_line_len));
|
|
|
|
lyxrc.fontenc = fl_get_input(dialog_->input_tex_encoding);
|
2000-10-27 10:04:51 +00:00
|
|
|
|
2000-11-15 03:22:08 +00:00
|
|
|
int const choice =
|
2000-11-14 13:46:01 +00:00
|
|
|
fl_get_choice(dialog_->choice_default_papersize) - 1;
|
2000-10-27 10:04:51 +00:00
|
|
|
lyxrc.default_papersize = static_cast<BufferParams::PAPER_SIZE>(choice);
|
2000-10-30 11:33:05 +00:00
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
lyxrc.ascii_roff_command = fl_get_input(dialog_->input_ascii_roff);
|
|
|
|
lyxrc.chktex_command = fl_get_input(dialog_->input_checktex);
|
2001-09-02 11:40:33 +00:00
|
|
|
lyxrc.view_dvi_paper_option = fl_get_input(dialog_->input_paperoption);
|
2001-09-21 10:41:09 +00:00
|
|
|
lyxrc.auto_reset_options = fl_get_button(dialog_->check_autoreset_classopt);
|
2000-10-27 10:04:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
void FormPreferences::OutputsMisc::build()
|
2000-10-27 10:04:51 +00:00
|
|
|
{
|
2002-06-14 09:17:11 +00:00
|
|
|
dialog_.reset(build_preferences_outputs_misc(&parent_));
|
2000-10-27 10:04:51 +00:00
|
|
|
|
2000-11-21 21:51:25 +00:00
|
|
|
fl_set_counter_step(dialog_->counter_line_len, 1, 10);
|
|
|
|
|
|
|
|
fl_set_counter_return(dialog_->counter_line_len, FL_RETURN_CHANGED);
|
|
|
|
fl_set_input_return(dialog_->input_tex_encoding, FL_RETURN_CHANGED);
|
|
|
|
fl_set_input_return(dialog_->input_ascii_roff, FL_RETURN_CHANGED);
|
|
|
|
fl_set_input_return(dialog_->input_checktex, FL_RETURN_CHANGED);
|
2001-09-03 17:29:52 +00:00
|
|
|
fl_set_input_return(dialog_->input_paperoption, FL_RETURN_CHANGED);
|
2000-11-21 21:51:25 +00:00
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
fl_addto_choice(dialog_->choice_default_papersize,
|
2002-05-01 09:46:36 +00:00
|
|
|
_(" default | US letter | US legal | US executive | A3 | A4 | A5 | B5 "));
|
2000-10-30 21:53:29 +00:00
|
|
|
|
|
|
|
// set up the feedback mechanism
|
2002-03-11 09:54:42 +00:00
|
|
|
setPrehandler(dialog_->counter_line_len);
|
|
|
|
setPrehandler(dialog_->input_tex_encoding);
|
|
|
|
setPrehandler(dialog_->choice_default_papersize);
|
|
|
|
setPrehandler(dialog_->input_ascii_roff);
|
|
|
|
setPrehandler(dialog_->input_checktex);
|
|
|
|
setPrehandler(dialog_->input_paperoption);
|
|
|
|
setPrehandler(dialog_->check_autoreset_classopt);
|
2000-10-27 10:04:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-11-04 10:00:12 +00:00
|
|
|
string const
|
2000-11-14 13:46:01 +00:00
|
|
|
FormPreferences::OutputsMisc::feedback(FL_OBJECT const * const ob) const
|
2000-10-27 10:04:51 +00:00
|
|
|
{
|
2000-11-15 03:22:08 +00:00
|
|
|
if (ob == dialog_->counter_line_len)
|
2002-07-17 15:34:00 +00:00
|
|
|
return lyxrc.getDescription(LyXRC::RC_ASCII_LINELEN);
|
|
|
|
if (ob == dialog_->input_tex_encoding)
|
|
|
|
return lyxrc.getDescription(LyXRC::RC_FONT_ENCODING);
|
|
|
|
if (ob == dialog_->input_ascii_roff)
|
|
|
|
return lyxrc.getDescription(LyXRC::RC_ASCIIROFF_COMMAND);
|
|
|
|
if (ob == dialog_->input_checktex)
|
|
|
|
return lyxrc.getDescription(LyXRC::RC_CHKTEX_COMMAND);
|
|
|
|
if (ob == dialog_->choice_default_papersize)
|
|
|
|
return lyxrc.getDescription(LyXRC::RC_DEFAULT_PAPERSIZE);
|
|
|
|
if (ob == dialog_->input_paperoption)
|
|
|
|
return lyxrc.getDescription(LyXRC::RC_VIEWDVI_PAPEROPTION);
|
|
|
|
if (ob == dialog_->check_autoreset_classopt)
|
|
|
|
return lyxrc.getDescription(LyXRC::RC_AUTORESET_OPTIONS);
|
|
|
|
return string();
|
2000-10-27 10:04:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
void FormPreferences::OutputsMisc::update()
|
2000-10-27 10:04:51 +00:00
|
|
|
{
|
2000-11-14 13:46:01 +00:00
|
|
|
fl_set_counter_value(dialog_->counter_line_len,
|
2000-10-27 10:04:51 +00:00
|
|
|
lyxrc.ascii_linelen);
|
2000-11-14 13:46:01 +00:00
|
|
|
fl_set_input(dialog_->input_tex_encoding,
|
2000-10-27 10:04:51 +00:00
|
|
|
lyxrc.fontenc.c_str());
|
2000-11-14 13:46:01 +00:00
|
|
|
fl_set_choice(dialog_->choice_default_papersize,
|
2000-10-27 10:04:51 +00:00
|
|
|
lyxrc.default_papersize+1);
|
2000-11-14 13:46:01 +00:00
|
|
|
fl_set_input(dialog_->input_ascii_roff,
|
2000-10-30 11:33:05 +00:00
|
|
|
lyxrc.ascii_roff_command.c_str());
|
2000-11-14 13:46:01 +00:00
|
|
|
fl_set_input(dialog_->input_checktex,
|
2000-10-30 11:33:05 +00:00
|
|
|
lyxrc.chktex_command.c_str());
|
2001-09-02 11:40:33 +00:00
|
|
|
fl_set_input(dialog_->input_paperoption,
|
2002-03-21 21:21:28 +00:00
|
|
|
lyxrc.view_dvi_paper_option.c_str());
|
2001-09-21 10:41:09 +00:00
|
|
|
fl_set_button(dialog_->check_autoreset_classopt,
|
2002-03-21 16:59:12 +00:00
|
|
|
lyxrc.auto_reset_options);
|
2001-09-21 10:41:09 +00:00
|
|
|
|
2000-10-27 10:04:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-02-16 15:59:55 +00:00
|
|
|
FormPreferences::Paths::Paths(FormPreferences & p)
|
2001-03-15 13:37:04 +00:00
|
|
|
: parent_(p)
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
2002-06-13 13:43:51 +00:00
|
|
|
FD_preferences_paths const * FormPreferences::Paths::dialog()
|
2000-10-27 10:04:51 +00:00
|
|
|
{
|
2001-03-15 13:37:04 +00:00
|
|
|
return dialog_.get();
|
2000-11-14 13:46:01 +00:00
|
|
|
}
|
|
|
|
|
2000-10-27 10:04:51 +00:00
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
void FormPreferences::Paths::apply()
|
|
|
|
{
|
|
|
|
lyxrc.document_path = fl_get_input(dialog_->input_default_path);
|
|
|
|
lyxrc.template_path = fl_get_input(dialog_->input_template_path);
|
|
|
|
|
|
|
|
int button = fl_get_button(dialog_->check_use_temp_dir);
|
|
|
|
string str = fl_get_input(dialog_->input_temp_dir);
|
2002-07-17 15:34:00 +00:00
|
|
|
if (!button)
|
|
|
|
str.erase();
|
2000-10-27 10:04:51 +00:00
|
|
|
|
|
|
|
lyxrc.use_tempdir = button;
|
|
|
|
lyxrc.tempdir_path = str;
|
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
button = fl_get_button(dialog_->check_last_files);
|
|
|
|
str = fl_get_input(dialog_->input_lastfiles);
|
2000-11-21 15:46:13 +00:00
|
|
|
if (!button) str.erase();
|
2002-03-21 21:21:28 +00:00
|
|
|
|
2000-10-27 10:04:51 +00:00
|
|
|
lyxrc.check_lastfiles = button;
|
|
|
|
lyxrc.lastfiles = str;
|
|
|
|
lyxrc.num_lastfiles = static_cast<unsigned int>
|
2000-11-14 13:46:01 +00:00
|
|
|
(fl_get_counter_value(dialog_->counter_lastfiles));
|
2000-10-27 10:04:51 +00:00
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
button = fl_get_button(dialog_->check_make_backups);
|
|
|
|
str = fl_get_input(dialog_->input_backup_path);
|
2002-07-17 15:34:00 +00:00
|
|
|
if (!button)
|
|
|
|
str.erase();
|
2000-10-27 10:04:51 +00:00
|
|
|
|
|
|
|
lyxrc.make_backup = button;
|
|
|
|
lyxrc.backupdir_path = str;
|
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
lyxrc.lyxpipes = fl_get_input(dialog_->input_serverpipe);
|
2000-10-27 10:04:51 +00:00
|
|
|
|
|
|
|
// update view
|
2000-11-14 13:46:01 +00:00
|
|
|
update();
|
2000-10-27 10:04:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
void FormPreferences::Paths::build()
|
2000-10-27 10:04:51 +00:00
|
|
|
{
|
2002-06-14 09:17:11 +00:00
|
|
|
dialog_.reset(build_preferences_paths(&parent_));
|
2000-10-27 10:04:51 +00:00
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
fl_set_input_return(dialog_->input_default_path, FL_RETURN_CHANGED);
|
|
|
|
fl_set_input_return(dialog_->input_template_path, FL_RETURN_CHANGED);
|
|
|
|
fl_set_input_return(dialog_->input_temp_dir, FL_RETURN_CHANGED);
|
|
|
|
fl_set_input_return(dialog_->input_lastfiles, FL_RETURN_CHANGED);
|
|
|
|
fl_set_input_return(dialog_->input_backup_path, FL_RETURN_CHANGED);
|
|
|
|
fl_set_counter_return(dialog_->counter_lastfiles, FL_RETURN_CHANGED);
|
|
|
|
fl_set_input_return(dialog_->input_serverpipe, FL_RETURN_CHANGED);
|
2000-10-30 21:53:29 +00:00
|
|
|
|
|
|
|
// set up the feedback mechanism
|
2002-03-11 09:54:42 +00:00
|
|
|
setPrehandler(dialog_->input_default_path);
|
|
|
|
setPrehandler(dialog_->counter_lastfiles);
|
|
|
|
setPrehandler(dialog_->input_template_path);
|
|
|
|
setPrehandler(dialog_->check_last_files);
|
|
|
|
setPrehandler(dialog_->input_lastfiles);
|
|
|
|
setPrehandler(dialog_->check_make_backups);
|
|
|
|
setPrehandler(dialog_->input_backup_path);
|
|
|
|
setPrehandler(dialog_->input_serverpipe);
|
|
|
|
setPrehandler(dialog_->input_temp_dir);
|
|
|
|
setPrehandler(dialog_->check_use_temp_dir);
|
2000-11-14 13:46:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
string const
|
2000-11-15 03:22:08 +00:00
|
|
|
FormPreferences::Paths::feedback(FL_OBJECT const * const ob) const
|
2000-10-27 10:04:51 +00:00
|
|
|
{
|
2000-11-15 03:22:08 +00:00
|
|
|
if (ob == dialog_->input_default_path)
|
2002-07-17 15:34:00 +00:00
|
|
|
return lyxrc.getDescription(LyXRC::RC_DOCUMENTPATH);
|
|
|
|
if (ob == dialog_->input_template_path)
|
|
|
|
return lyxrc.getDescription(LyXRC::RC_TEMPLATEPATH);
|
|
|
|
if (ob == dialog_->check_use_temp_dir)
|
|
|
|
return lyxrc.getDescription(LyXRC::RC_USETEMPDIR);
|
|
|
|
if (ob == dialog_->input_temp_dir)
|
|
|
|
return lyxrc.getDescription(LyXRC::RC_TEMPDIRPATH);
|
|
|
|
if (ob == dialog_->check_last_files)
|
|
|
|
return lyxrc.getDescription(LyXRC::RC_CHECKLASTFILES);
|
|
|
|
if (ob == dialog_->input_lastfiles)
|
|
|
|
return lyxrc.getDescription(LyXRC::RC_LASTFILES);
|
|
|
|
if (ob == dialog_->counter_lastfiles)
|
|
|
|
return lyxrc.getDescription(LyXRC::RC_NUMLASTFILES);
|
|
|
|
if (ob == dialog_->check_make_backups)
|
|
|
|
return lyxrc.getDescription(LyXRC::RC_MAKE_BACKUP);
|
|
|
|
if (ob == dialog_->input_backup_path)
|
|
|
|
return lyxrc.getDescription(LyXRC::RC_BACKUPDIR_PATH);
|
|
|
|
if (ob == dialog_->input_serverpipe)
|
|
|
|
return lyxrc.getDescription(LyXRC::RC_SERVERPIPE);
|
|
|
|
return string();
|
2000-10-27 10:04:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-11-15 03:22:08 +00:00
|
|
|
bool FormPreferences::Paths::input(FL_OBJECT const * const ob)
|
2000-10-27 10:04:51 +00:00
|
|
|
{
|
|
|
|
bool activate = true;
|
2002-03-21 21:21:28 +00:00
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
// !ob if function is called from Paths::update() to de/activate
|
|
|
|
// objects,
|
2000-11-09 15:28:42 +00:00
|
|
|
// otherwise the function is called by an xforms CB via input().
|
2000-11-14 13:46:01 +00:00
|
|
|
if (!ob || ob == dialog_->check_use_temp_dir) {
|
2001-03-05 19:02:40 +00:00
|
|
|
bool const enable = fl_get_button(dialog_->check_use_temp_dir);
|
|
|
|
setEnabled(dialog_->input_temp_dir, enable);
|
2000-10-27 10:04:51 +00:00
|
|
|
}
|
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
if (!ob || ob == dialog_->check_last_files) {
|
2001-03-05 19:02:40 +00:00
|
|
|
bool const enable = fl_get_button(dialog_->check_last_files);
|
|
|
|
setEnabled(dialog_->input_lastfiles, enable);
|
2000-10-27 10:04:51 +00:00
|
|
|
}
|
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
if (!ob || ob == dialog_->check_make_backups) {
|
2001-03-05 19:02:40 +00:00
|
|
|
bool const enable = fl_get_button(dialog_->check_make_backups);
|
|
|
|
setEnabled(dialog_->input_backup_path, enable);
|
2000-10-27 10:04:51 +00:00
|
|
|
}
|
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
if (!ob || ob == dialog_->input_default_path) {
|
2000-11-21 15:46:13 +00:00
|
|
|
string const name = fl_get_input(dialog_->input_default_path);
|
2002-01-10 10:05:45 +00:00
|
|
|
if (!name.empty() && !RWInfo::WriteableDir(name)) {
|
2002-03-11 09:54:42 +00:00
|
|
|
parent_.postWarning(RWInfo::ErrorMessage());
|
2000-10-27 10:04:51 +00:00
|
|
|
return false;
|
2000-11-15 18:02:45 +00:00
|
|
|
}
|
2000-10-27 10:04:51 +00:00
|
|
|
}
|
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
if (!ob || ob == dialog_->input_template_path) {
|
2000-11-21 15:46:13 +00:00
|
|
|
string const name = fl_get_input(dialog_->input_template_path);
|
2002-01-10 10:05:45 +00:00
|
|
|
if (!name.empty() && !RWInfo::ReadableDir(name)) {
|
2002-03-11 09:54:42 +00:00
|
|
|
parent_.postWarning(RWInfo::ErrorMessage());
|
2000-11-15 18:02:45 +00:00
|
|
|
return false;
|
|
|
|
}
|
2000-10-27 10:04:51 +00:00
|
|
|
}
|
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
if (!ob || ob == dialog_->input_temp_dir) {
|
2000-11-21 15:46:13 +00:00
|
|
|
string const name = fl_get_input(dialog_->input_temp_dir);
|
2000-11-14 13:46:01 +00:00
|
|
|
if (fl_get_button(dialog_->check_make_backups)
|
2000-10-27 10:04:51 +00:00
|
|
|
&& !name.empty()
|
2000-11-21 15:46:13 +00:00
|
|
|
&& !RWInfo::WriteableDir(name)) {
|
2002-03-11 09:54:42 +00:00
|
|
|
parent_.postWarning(RWInfo::ErrorMessage());
|
2000-10-27 10:04:51 +00:00
|
|
|
return false;
|
2000-11-15 18:02:45 +00:00
|
|
|
}
|
2000-10-27 10:04:51 +00:00
|
|
|
}
|
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
if (!ob || ob == dialog_->input_backup_path) {
|
2000-11-21 15:46:13 +00:00
|
|
|
string const name = fl_get_input(dialog_->input_backup_path);
|
2000-11-14 13:46:01 +00:00
|
|
|
if (fl_get_button(dialog_->check_make_backups)
|
2000-10-27 10:04:51 +00:00
|
|
|
&& !name.empty()
|
2000-11-21 15:46:13 +00:00
|
|
|
&& !RWInfo::WriteableDir(name)) {
|
2002-03-11 09:54:42 +00:00
|
|
|
parent_.postWarning(RWInfo::ErrorMessage());
|
2000-10-27 10:04:51 +00:00
|
|
|
return false;
|
2000-11-15 18:02:45 +00:00
|
|
|
}
|
2000-10-27 10:04:51 +00:00
|
|
|
}
|
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
if (!ob || ob == dialog_->input_lastfiles) {
|
2000-11-21 15:46:13 +00:00
|
|
|
string const name = fl_get_input(dialog_->input_lastfiles);
|
2000-11-14 13:46:01 +00:00
|
|
|
if (fl_get_button(dialog_->check_last_files)
|
2000-10-27 10:04:51 +00:00
|
|
|
&& !name.empty()
|
2000-11-21 15:46:13 +00:00
|
|
|
&& !RWInfo::WriteableFile(name)) {
|
2002-03-11 09:54:42 +00:00
|
|
|
parent_.postWarning(RWInfo::ErrorMessage());
|
2000-10-27 10:04:51 +00:00
|
|
|
return false;
|
2000-11-15 18:02:45 +00:00
|
|
|
}
|
2000-10-27 10:04:51 +00:00
|
|
|
}
|
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
if (!ob || ob == dialog_->input_serverpipe) {
|
2000-11-21 15:46:13 +00:00
|
|
|
string const name = fl_get_input(dialog_->input_serverpipe);
|
2000-11-04 10:00:12 +00:00
|
|
|
if (!name.empty()) {
|
2000-11-21 15:46:13 +00:00
|
|
|
// strip off the extension
|
2000-11-21 21:51:25 +00:00
|
|
|
string const str = ChangeExtension(name, "");
|
2000-11-21 15:46:13 +00:00
|
|
|
if (!RWInfo::WriteableFile(str + ".in")) {
|
2002-03-11 09:54:42 +00:00
|
|
|
parent_.postWarning(RWInfo::ErrorMessage());
|
2000-10-27 10:04:51 +00:00
|
|
|
return false;
|
2000-11-15 18:02:45 +00:00
|
|
|
}
|
2000-11-21 15:46:13 +00:00
|
|
|
if (!RWInfo::WriteableFile(str + ".out")) {
|
2002-03-11 09:54:42 +00:00
|
|
|
parent_.postWarning(RWInfo::ErrorMessage());
|
2000-10-27 10:04:51 +00:00
|
|
|
return false;
|
2000-11-15 18:02:45 +00:00
|
|
|
}
|
2000-10-27 10:04:51 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-11-15 03:22:08 +00:00
|
|
|
if (ob == dialog_->button_default_path_browse) {
|
|
|
|
parent_.browse(dialog_->input_default_path,
|
2002-04-02 17:04:23 +00:00
|
|
|
_("Default path"), string());
|
2000-11-15 03:22:08 +00:00
|
|
|
} else if (ob == dialog_->button_template_path_browse) {
|
|
|
|
parent_.browse(dialog_->input_template_path,
|
2002-04-02 17:04:23 +00:00
|
|
|
_("Template path"), string());
|
2000-11-15 03:22:08 +00:00
|
|
|
} else if (ob == dialog_->button_temp_dir_browse) {
|
|
|
|
parent_.browse(dialog_->input_temp_dir,
|
2002-04-02 17:04:23 +00:00
|
|
|
_("Temp dir"), string());
|
2000-11-15 03:22:08 +00:00
|
|
|
} else if (ob == dialog_->button_lastfiles_browse) {
|
2002-01-13 15:01:25 +00:00
|
|
|
pair<string, string> dir(_("User|#U#u"), user_lyxdir);
|
2000-11-15 03:22:08 +00:00
|
|
|
|
|
|
|
parent_.browse(dialog_->input_lastfiles,
|
2002-04-02 17:04:23 +00:00
|
|
|
_("Lastfiles"), string(), dir);
|
2000-11-15 03:22:08 +00:00
|
|
|
} else if (ob == dialog_->button_backup_path_browse) {
|
2000-11-21 15:46:13 +00:00
|
|
|
parent_.browse(dialog_->input_backup_path,
|
2002-04-02 17:04:23 +00:00
|
|
|
_("Backup path"), string());
|
2000-11-15 03:22:08 +00:00
|
|
|
} else if (ob == dialog_->button_serverpipe_browse) {
|
2000-11-21 15:46:13 +00:00
|
|
|
parent_.browse(dialog_->input_serverpipe,
|
2002-04-02 17:04:23 +00:00
|
|
|
_("LyX Server pipes"), string());
|
2000-11-14 13:46:01 +00:00
|
|
|
}
|
2002-03-21 21:21:28 +00:00
|
|
|
|
2000-10-27 10:04:51 +00:00
|
|
|
return activate;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
void FormPreferences::Paths::update()
|
2000-10-27 10:04:51 +00:00
|
|
|
{
|
2000-11-14 13:46:01 +00:00
|
|
|
fl_set_input(dialog_->input_default_path,
|
2000-10-27 10:04:51 +00:00
|
|
|
lyxrc.document_path.c_str());
|
2000-11-14 13:46:01 +00:00
|
|
|
fl_set_input(dialog_->input_template_path,
|
2000-10-27 10:04:51 +00:00
|
|
|
lyxrc.template_path.c_str());
|
|
|
|
|
2000-11-04 10:00:12 +00:00
|
|
|
string str;
|
2002-07-17 15:34:00 +00:00
|
|
|
if (lyxrc.make_backup)
|
|
|
|
str = lyxrc.backupdir_path;
|
2000-10-27 10:04:51 +00:00
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
fl_set_button(dialog_->check_make_backups,
|
2000-10-27 10:04:51 +00:00
|
|
|
lyxrc.make_backup);
|
2000-11-14 13:46:01 +00:00
|
|
|
fl_set_input(dialog_->input_backup_path, str.c_str());
|
2000-10-27 10:04:51 +00:00
|
|
|
|
|
|
|
str.erase();
|
2002-07-17 15:34:00 +00:00
|
|
|
if (lyxrc.use_tempdir)
|
|
|
|
str = lyxrc.tempdir_path;
|
2000-10-27 10:04:51 +00:00
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
fl_set_button(dialog_->check_use_temp_dir,
|
2000-10-27 10:04:51 +00:00
|
|
|
lyxrc.use_tempdir);
|
2000-11-14 13:46:01 +00:00
|
|
|
fl_set_input(dialog_->input_temp_dir, str.c_str());
|
2000-10-27 10:04:51 +00:00
|
|
|
|
|
|
|
str.erase();
|
2002-07-17 15:34:00 +00:00
|
|
|
if (lyxrc.check_lastfiles)
|
|
|
|
str = lyxrc.lastfiles;
|
2000-10-27 10:04:51 +00:00
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
fl_set_button(dialog_->check_last_files,
|
2002-03-21 21:21:28 +00:00
|
|
|
lyxrc.check_lastfiles);
|
2000-11-14 13:46:01 +00:00
|
|
|
fl_set_input(dialog_->input_lastfiles, str.c_str());
|
|
|
|
fl_set_counter_value(dialog_->counter_lastfiles,
|
2000-10-27 10:04:51 +00:00
|
|
|
lyxrc.num_lastfiles);
|
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
fl_set_input(dialog_->input_serverpipe, lyxrc.lyxpipes.c_str());
|
2000-10-27 10:04:51 +00:00
|
|
|
|
|
|
|
// Activate/Deactivate the input fields dependent on the state of the
|
|
|
|
// buttons.
|
2000-11-21 15:46:13 +00:00
|
|
|
input(0);
|
2000-10-27 10:04:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-03-15 13:37:04 +00:00
|
|
|
FormPreferences::Printer::Printer(FormPreferences & p)
|
|
|
|
: parent_(p)
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
2002-06-13 13:43:51 +00:00
|
|
|
FD_preferences_printer const * FormPreferences::Printer::dialog()
|
2000-10-27 10:04:51 +00:00
|
|
|
{
|
2001-03-15 13:37:04 +00:00
|
|
|
return dialog_.get();
|
2000-11-14 13:46:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void FormPreferences::Printer::apply() const
|
|
|
|
{
|
|
|
|
lyxrc.print_adapt_output = fl_get_button(dialog_->check_adapt_output);
|
|
|
|
lyxrc.print_command = fl_get_input(dialog_->input_command);
|
|
|
|
lyxrc.print_pagerange_flag = fl_get_input(dialog_->input_page_range);
|
|
|
|
lyxrc.print_copies_flag = fl_get_input(dialog_->input_copies);
|
|
|
|
lyxrc.print_reverse_flag = fl_get_input(dialog_->input_reverse);
|
|
|
|
lyxrc.print_to_printer = fl_get_input(dialog_->input_to_printer);
|
2000-10-27 10:04:51 +00:00
|
|
|
lyxrc.print_file_extension =
|
2000-11-14 13:46:01 +00:00
|
|
|
fl_get_input(dialog_->input_file_extension);
|
2000-10-27 10:04:51 +00:00
|
|
|
lyxrc.print_spool_command =
|
2000-11-14 13:46:01 +00:00
|
|
|
fl_get_input(dialog_->input_spool_command);
|
|
|
|
lyxrc.print_paper_flag = fl_get_input(dialog_->input_paper_type);
|
|
|
|
lyxrc.print_evenpage_flag = fl_get_input(dialog_->input_even_pages);
|
|
|
|
lyxrc.print_oddpage_flag = fl_get_input(dialog_->input_odd_pages);
|
|
|
|
lyxrc.print_collcopies_flag = fl_get_input(dialog_->input_collated);
|
|
|
|
lyxrc.print_landscape_flag = fl_get_input(dialog_->input_landscape);
|
|
|
|
lyxrc.print_to_file = fl_get_input(dialog_->input_to_file);
|
2000-10-27 10:04:51 +00:00
|
|
|
lyxrc.print_extra_options =
|
2000-11-14 13:46:01 +00:00
|
|
|
fl_get_input(dialog_->input_extra_options);
|
2000-10-27 10:04:51 +00:00
|
|
|
lyxrc.print_spool_printerprefix =
|
2000-11-14 13:46:01 +00:00
|
|
|
fl_get_input(dialog_->input_spool_prefix);
|
2000-10-27 10:04:51 +00:00
|
|
|
lyxrc.print_paper_dimension_flag =
|
2000-11-14 13:46:01 +00:00
|
|
|
fl_get_input(dialog_->input_paper_size);
|
|
|
|
lyxrc.printer = fl_get_input(dialog_->input_name);
|
2000-10-27 10:04:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-11-08 09:39:46 +00:00
|
|
|
string const
|
2000-11-14 13:46:01 +00:00
|
|
|
FormPreferences::Printer::feedback(FL_OBJECT const * const ob) const
|
2000-10-27 10:04:51 +00:00
|
|
|
{
|
2000-11-21 15:46:13 +00:00
|
|
|
if (ob == dialog_->input_command)
|
2002-07-17 15:34:00 +00:00
|
|
|
return lyxrc.getDescription(LyXRC::RC_PRINT_COMMAND);
|
|
|
|
if (ob == dialog_->check_adapt_output)
|
|
|
|
return lyxrc.getDescription(LyXRC::RC_PRINT_ADAPTOUTPUT);
|
|
|
|
if (ob == dialog_->input_to_printer)
|
|
|
|
return lyxrc.getDescription(LyXRC::RC_PRINTTOPRINTER);
|
|
|
|
if (ob == dialog_->input_to_file)
|
|
|
|
return lyxrc.getDescription(LyXRC::RC_PRINTTOFILE);
|
|
|
|
if (ob == dialog_->input_file_extension)
|
|
|
|
return lyxrc.getDescription(LyXRC::RC_PRINTFILEEXTENSION);
|
|
|
|
if (ob == dialog_->input_extra_options)
|
|
|
|
return lyxrc.getDescription(LyXRC::RC_PRINTEXSTRAOPTIONS);
|
|
|
|
if (ob == dialog_->input_spool_command)
|
|
|
|
return lyxrc.getDescription(LyXRC::RC_PRINTSPOOL_COMMAND);
|
|
|
|
if (ob == dialog_->input_spool_prefix)
|
|
|
|
return lyxrc.getDescription(LyXRC::RC_PRINTSPOOL_PRINTERPREFIX);
|
|
|
|
if (ob == dialog_->input_name)
|
|
|
|
return lyxrc.getDescription(LyXRC::RC_PRINTER);
|
|
|
|
if (ob == dialog_->input_even_pages)
|
|
|
|
return lyxrc.getDescription(LyXRC::RC_PRINTEVENPAGEFLAG);
|
|
|
|
if (ob == dialog_->input_odd_pages)
|
|
|
|
return lyxrc.getDescription(LyXRC::RC_PRINTODDPAGEFLAG);
|
|
|
|
if (ob == dialog_->input_page_range)
|
|
|
|
return lyxrc.getDescription(LyXRC::RC_PRINTPAGERANGEFLAG);
|
|
|
|
if (ob == dialog_->input_reverse)
|
|
|
|
return lyxrc.getDescription(LyXRC::RC_PRINTREVERSEFLAG);
|
|
|
|
if (ob == dialog_->input_landscape)
|
|
|
|
return lyxrc.getDescription(LyXRC::RC_PRINTLANDSCAPEFLAG);
|
|
|
|
if (ob == dialog_->input_copies)
|
|
|
|
return lyxrc.getDescription(LyXRC::RC_PRINTCOPIESFLAG);
|
|
|
|
if (ob == dialog_->input_collated)
|
|
|
|
return lyxrc.getDescription(LyXRC::RC_PRINTCOLLCOPIESFLAG);
|
|
|
|
if (ob == dialog_->input_paper_type)
|
|
|
|
return lyxrc.getDescription(LyXRC::RC_PRINTPAPERFLAG);
|
|
|
|
if (ob == dialog_->input_paper_size)
|
|
|
|
return lyxrc.getDescription(LyXRC::RC_PRINTPAPERDIMENSIONFLAG);
|
|
|
|
return string();
|
2000-10-27 10:04:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
void FormPreferences::Printer::build()
|
2000-10-27 10:04:51 +00:00
|
|
|
{
|
2002-06-14 09:17:11 +00:00
|
|
|
dialog_.reset(build_preferences_printer(&parent_));
|
2000-10-27 10:04:51 +00:00
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
fl_set_input_return(dialog_->input_command, FL_RETURN_CHANGED);
|
|
|
|
fl_set_input_return(dialog_->input_page_range, FL_RETURN_CHANGED);
|
|
|
|
fl_set_input_return(dialog_->input_copies, FL_RETURN_CHANGED);
|
|
|
|
fl_set_input_return(dialog_->input_reverse, FL_RETURN_CHANGED);
|
|
|
|
fl_set_input_return(dialog_->input_to_printer, FL_RETURN_CHANGED);
|
|
|
|
fl_set_input_return(dialog_->input_file_extension, FL_RETURN_CHANGED);
|
|
|
|
fl_set_input_return(dialog_->input_spool_command, FL_RETURN_CHANGED);
|
|
|
|
fl_set_input_return(dialog_->input_paper_type, FL_RETURN_CHANGED);
|
|
|
|
fl_set_input_return(dialog_->input_even_pages, FL_RETURN_CHANGED);
|
|
|
|
fl_set_input_return(dialog_->input_odd_pages, FL_RETURN_CHANGED);
|
|
|
|
fl_set_input_return(dialog_->input_collated, FL_RETURN_CHANGED);
|
|
|
|
fl_set_input_return(dialog_->input_landscape, FL_RETURN_CHANGED);
|
|
|
|
fl_set_input_return(dialog_->input_to_file, FL_RETURN_CHANGED);
|
|
|
|
fl_set_input_return(dialog_->input_extra_options, FL_RETURN_CHANGED);
|
|
|
|
fl_set_input_return(dialog_->input_spool_prefix, FL_RETURN_CHANGED);
|
|
|
|
fl_set_input_return(dialog_->input_paper_size, FL_RETURN_CHANGED);
|
|
|
|
fl_set_input_return(dialog_->input_name, FL_RETURN_CHANGED);
|
2000-10-30 21:53:29 +00:00
|
|
|
|
|
|
|
// set up the feedback mechanism
|
2002-03-11 09:54:42 +00:00
|
|
|
setPrehandler(dialog_->input_command);
|
|
|
|
setPrehandler(dialog_->input_page_range);
|
|
|
|
setPrehandler(dialog_->input_copies);
|
|
|
|
setPrehandler(dialog_->input_reverse);
|
|
|
|
setPrehandler(dialog_->input_to_printer);
|
|
|
|
setPrehandler(dialog_->input_file_extension);
|
|
|
|
setPrehandler(dialog_->input_spool_command);
|
|
|
|
setPrehandler(dialog_->input_paper_type);
|
|
|
|
setPrehandler(dialog_->input_even_pages);
|
|
|
|
setPrehandler(dialog_->input_odd_pages);
|
|
|
|
setPrehandler(dialog_->input_collated);
|
|
|
|
setPrehandler(dialog_->input_landscape);
|
|
|
|
setPrehandler(dialog_->input_to_file);
|
|
|
|
setPrehandler(dialog_->input_extra_options);
|
|
|
|
setPrehandler(dialog_->input_spool_prefix);
|
|
|
|
setPrehandler(dialog_->input_paper_size);
|
|
|
|
setPrehandler(dialog_->input_name);
|
|
|
|
setPrehandler(dialog_->check_adapt_output);
|
2000-11-14 13:46:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void FormPreferences::Printer::update()
|
|
|
|
{
|
|
|
|
fl_set_button(dialog_->check_adapt_output,
|
2000-10-27 10:04:51 +00:00
|
|
|
lyxrc.print_adapt_output);
|
2000-11-14 13:46:01 +00:00
|
|
|
fl_set_input(dialog_->input_command,
|
2000-10-27 10:04:51 +00:00
|
|
|
lyxrc.print_command.c_str());
|
2000-11-14 13:46:01 +00:00
|
|
|
fl_set_input(dialog_->input_page_range,
|
2000-10-27 10:04:51 +00:00
|
|
|
lyxrc.print_pagerange_flag.c_str());
|
2000-11-14 13:46:01 +00:00
|
|
|
fl_set_input(dialog_->input_copies,
|
2000-10-27 10:04:51 +00:00
|
|
|
lyxrc.print_copies_flag.c_str());
|
2000-11-14 13:46:01 +00:00
|
|
|
fl_set_input(dialog_->input_reverse,
|
2000-10-27 10:04:51 +00:00
|
|
|
lyxrc.print_reverse_flag.c_str());
|
2000-11-14 13:46:01 +00:00
|
|
|
fl_set_input(dialog_->input_to_printer,
|
2000-10-27 10:04:51 +00:00
|
|
|
lyxrc.print_to_printer.c_str());
|
2000-11-14 13:46:01 +00:00
|
|
|
fl_set_input(dialog_->input_file_extension,
|
2000-10-27 10:04:51 +00:00
|
|
|
lyxrc.print_file_extension.c_str());
|
2000-11-14 13:46:01 +00:00
|
|
|
fl_set_input(dialog_->input_spool_command,
|
2000-10-27 10:04:51 +00:00
|
|
|
lyxrc.print_spool_command.c_str());
|
2000-11-14 13:46:01 +00:00
|
|
|
fl_set_input(dialog_->input_paper_type,
|
2000-10-27 10:04:51 +00:00
|
|
|
lyxrc.print_paper_flag.c_str());
|
2000-11-14 13:46:01 +00:00
|
|
|
fl_set_input(dialog_->input_even_pages,
|
2000-10-27 10:04:51 +00:00
|
|
|
lyxrc.print_evenpage_flag.c_str());
|
2000-11-14 13:46:01 +00:00
|
|
|
fl_set_input(dialog_->input_odd_pages,
|
2000-10-27 10:04:51 +00:00
|
|
|
lyxrc.print_oddpage_flag.c_str());
|
2000-11-14 13:46:01 +00:00
|
|
|
fl_set_input(dialog_->input_collated,
|
2000-10-27 10:04:51 +00:00
|
|
|
lyxrc.print_collcopies_flag.c_str());
|
2000-11-14 13:46:01 +00:00
|
|
|
fl_set_input(dialog_->input_landscape,
|
2000-10-27 10:04:51 +00:00
|
|
|
lyxrc.print_landscape_flag.c_str());
|
2000-11-14 13:46:01 +00:00
|
|
|
fl_set_input(dialog_->input_to_file,
|
2000-10-27 10:04:51 +00:00
|
|
|
lyxrc.print_to_file.c_str());
|
2000-11-14 13:46:01 +00:00
|
|
|
fl_set_input(dialog_->input_extra_options,
|
2000-10-27 10:04:51 +00:00
|
|
|
lyxrc.print_extra_options.c_str());
|
2000-11-14 13:46:01 +00:00
|
|
|
fl_set_input(dialog_->input_spool_prefix,
|
2000-10-27 10:04:51 +00:00
|
|
|
lyxrc.print_spool_printerprefix.c_str());
|
2000-11-14 13:46:01 +00:00
|
|
|
fl_set_input(dialog_->input_paper_size,
|
2000-10-27 10:04:51 +00:00
|
|
|
lyxrc.print_paper_dimension_flag.c_str());
|
2000-11-14 13:46:01 +00:00
|
|
|
fl_set_input(dialog_->input_name,
|
2000-10-27 10:04:51 +00:00
|
|
|
lyxrc.printer.c_str());
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-02-16 15:59:55 +00:00
|
|
|
FormPreferences::ScreenFonts::ScreenFonts(FormPreferences & p)
|
2001-03-15 13:37:04 +00:00
|
|
|
: parent_(p)
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
2002-06-13 13:43:51 +00:00
|
|
|
FD_preferences_screen_fonts const * FormPreferences::ScreenFonts::dialog()
|
2000-11-14 13:46:01 +00:00
|
|
|
{
|
2001-03-15 13:37:04 +00:00
|
|
|
return dialog_.get();
|
2000-11-14 13:46:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void FormPreferences::ScreenFonts::apply() const
|
2000-10-27 10:04:51 +00:00
|
|
|
{
|
|
|
|
bool changed = false;
|
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
string str = fl_get_input(dialog_->input_roman);
|
2000-11-04 10:00:12 +00:00
|
|
|
if (lyxrc.roman_font_name != str) {
|
2000-10-27 10:04:51 +00:00
|
|
|
changed = true;
|
|
|
|
lyxrc.roman_font_name = str;
|
|
|
|
}
|
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
str = fl_get_input(dialog_->input_sans);
|
2000-11-04 10:00:12 +00:00
|
|
|
if (lyxrc.sans_font_name != str) {
|
2000-10-27 10:04:51 +00:00
|
|
|
changed = true;
|
|
|
|
lyxrc.sans_font_name = str;
|
|
|
|
}
|
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
str = fl_get_input(dialog_->input_typewriter);
|
2000-11-04 10:00:12 +00:00
|
|
|
if (lyxrc.typewriter_font_name != str) {
|
2000-10-27 10:04:51 +00:00
|
|
|
changed = true;
|
|
|
|
lyxrc.typewriter_font_name = str;
|
|
|
|
}
|
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
str = fl_get_input(dialog_->input_screen_encoding);
|
2000-11-04 10:00:12 +00:00
|
|
|
if (lyxrc.font_norm != str) {
|
2000-10-27 10:04:51 +00:00
|
|
|
changed = true;
|
|
|
|
lyxrc.font_norm = str;
|
|
|
|
}
|
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
bool button = fl_get_button(dialog_->check_scalable);
|
2000-11-04 10:00:12 +00:00
|
|
|
if (lyxrc.use_scalable_fonts != button) {
|
2000-10-27 10:04:51 +00:00
|
|
|
changed = true;
|
|
|
|
lyxrc.use_scalable_fonts = button;
|
|
|
|
}
|
|
|
|
|
2000-10-30 21:53:29 +00:00
|
|
|
unsigned int ivalue = static_cast<unsigned int>
|
2000-11-14 13:46:01 +00:00
|
|
|
(fl_get_counter_value(dialog_->counter_zoom));
|
2000-11-04 10:00:12 +00:00
|
|
|
if (lyxrc.zoom != ivalue) {
|
2000-10-30 21:53:29 +00:00
|
|
|
changed = true;
|
|
|
|
lyxrc.zoom = ivalue;
|
|
|
|
}
|
|
|
|
|
|
|
|
ivalue = static_cast<unsigned int>
|
2000-11-14 13:46:01 +00:00
|
|
|
(fl_get_counter_value(dialog_->counter_dpi));
|
2000-10-30 21:53:29 +00:00
|
|
|
if (lyxrc.dpi != ivalue) {
|
2000-10-27 10:04:51 +00:00
|
|
|
changed = true;
|
2000-10-30 21:53:29 +00:00
|
|
|
lyxrc.dpi = ivalue;
|
2000-10-27 10:04:51 +00:00
|
|
|
}
|
2002-03-21 21:21:28 +00:00
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
double dvalue = strToDbl(fl_get_input(dialog_->input_tiny));
|
2000-11-04 10:00:12 +00:00
|
|
|
if (lyxrc.font_sizes[LyXFont::SIZE_TINY] != dvalue) {
|
2000-10-27 10:04:51 +00:00
|
|
|
changed = true;
|
|
|
|
lyxrc.font_sizes[LyXFont::SIZE_TINY] = dvalue;
|
|
|
|
}
|
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
dvalue = strToDbl(fl_get_input(dialog_->input_script));
|
2000-11-04 10:00:12 +00:00
|
|
|
if (lyxrc.font_sizes[LyXFont::SIZE_SCRIPT] != dvalue) {
|
2000-10-27 10:04:51 +00:00
|
|
|
changed = true;
|
|
|
|
lyxrc.font_sizes[LyXFont::SIZE_SCRIPT] = dvalue;
|
|
|
|
}
|
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
dvalue = strToDbl(fl_get_input(dialog_->input_footnote));
|
2000-11-04 10:00:12 +00:00
|
|
|
if (lyxrc.font_sizes[LyXFont::SIZE_FOOTNOTE] != dvalue) {
|
2000-10-27 10:04:51 +00:00
|
|
|
changed = true;
|
|
|
|
lyxrc.font_sizes[LyXFont::SIZE_FOOTNOTE] = dvalue;
|
|
|
|
}
|
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
dvalue = strToDbl(fl_get_input(dialog_->input_small));
|
2000-11-04 10:00:12 +00:00
|
|
|
if (lyxrc.font_sizes[LyXFont::SIZE_SMALL] != dvalue) {
|
2000-10-27 10:04:51 +00:00
|
|
|
changed = true;
|
|
|
|
lyxrc.font_sizes[LyXFont::SIZE_SMALL] = dvalue;
|
|
|
|
}
|
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
dvalue = strToDbl(fl_get_input(dialog_->input_normal));
|
2000-11-04 10:00:12 +00:00
|
|
|
if (lyxrc.font_sizes[LyXFont::SIZE_NORMAL] != dvalue) {
|
2000-10-27 10:04:51 +00:00
|
|
|
changed = true;
|
|
|
|
lyxrc.font_sizes[LyXFont::SIZE_NORMAL] = dvalue;
|
|
|
|
}
|
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
dvalue = strToDbl(fl_get_input(dialog_->input_large));
|
2000-11-04 10:00:12 +00:00
|
|
|
if (lyxrc.font_sizes[LyXFont::SIZE_LARGE] != dvalue) {
|
2000-10-27 10:04:51 +00:00
|
|
|
changed = true;
|
|
|
|
lyxrc.font_sizes[LyXFont::SIZE_LARGE] = dvalue;
|
|
|
|
}
|
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
dvalue = strToDbl(fl_get_input(dialog_->input_larger));
|
2000-11-04 10:00:12 +00:00
|
|
|
if (lyxrc.font_sizes[LyXFont::SIZE_LARGER] != dvalue) {
|
2000-10-27 10:04:51 +00:00
|
|
|
changed = true;
|
|
|
|
lyxrc.font_sizes[LyXFont::SIZE_LARGER] = dvalue;
|
|
|
|
}
|
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
dvalue = strToDbl(fl_get_input(dialog_->input_largest));
|
2000-11-04 10:00:12 +00:00
|
|
|
if (lyxrc.font_sizes[LyXFont::SIZE_LARGEST] != dvalue) {
|
2000-10-27 10:04:51 +00:00
|
|
|
changed = true;
|
|
|
|
lyxrc.font_sizes[LyXFont::SIZE_LARGEST] = dvalue;
|
|
|
|
}
|
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
dvalue = strToDbl(fl_get_input(dialog_->input_huge));
|
2000-11-04 10:00:12 +00:00
|
|
|
if (lyxrc.font_sizes[LyXFont::SIZE_HUGE] != dvalue) {
|
2000-10-27 10:04:51 +00:00
|
|
|
changed = true;
|
|
|
|
lyxrc.font_sizes[LyXFont::SIZE_HUGE] = dvalue;
|
|
|
|
}
|
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
dvalue = strToDbl(fl_get_input(dialog_->input_huger));
|
2000-11-04 10:00:12 +00:00
|
|
|
if (lyxrc.font_sizes[LyXFont::SIZE_HUGER] != dvalue) {
|
2000-10-27 10:04:51 +00:00
|
|
|
changed = true;
|
|
|
|
lyxrc.font_sizes[LyXFont::SIZE_HUGER] = dvalue;
|
|
|
|
}
|
|
|
|
|
2000-11-04 10:00:12 +00:00
|
|
|
if (changed) {
|
2000-10-27 10:04:51 +00:00
|
|
|
// Now update the buffers
|
|
|
|
// Can anything below here affect the redraw process?
|
2002-08-13 17:43:40 +00:00
|
|
|
parent_.lv_->dispatch(FuncRequest(LFUN_SCREEN_FONT_UPDATE));
|
2000-10-27 10:04:51 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
void FormPreferences::ScreenFonts::build()
|
2000-10-27 10:04:51 +00:00
|
|
|
{
|
2002-06-14 09:17:11 +00:00
|
|
|
dialog_.reset(build_preferences_screen_fonts(&parent_));
|
2000-10-27 10:04:51 +00:00
|
|
|
|
2000-11-21 21:51:25 +00:00
|
|
|
fl_set_counter_step(dialog_->counter_zoom, 1, 10);
|
|
|
|
fl_set_counter_step(dialog_->counter_dpi, 1, 10);
|
|
|
|
|
|
|
|
fl_set_input_return(dialog_->input_roman, FL_RETURN_CHANGED);
|
|
|
|
fl_set_input_return(dialog_->input_sans, FL_RETURN_CHANGED);
|
|
|
|
fl_set_input_return(dialog_->input_typewriter, FL_RETURN_CHANGED);
|
|
|
|
fl_set_input_return(dialog_->input_screen_encoding, FL_RETURN_CHANGED);
|
|
|
|
fl_set_counter_return(dialog_->counter_zoom, FL_RETURN_CHANGED);
|
|
|
|
fl_set_counter_return(dialog_->counter_dpi, FL_RETURN_CHANGED);
|
|
|
|
fl_set_input_return(dialog_->input_tiny, FL_RETURN_CHANGED);
|
|
|
|
fl_set_input_return(dialog_->input_script, FL_RETURN_CHANGED);
|
|
|
|
fl_set_input_return(dialog_->input_footnote, FL_RETURN_CHANGED);
|
|
|
|
fl_set_input_return(dialog_->input_small, FL_RETURN_CHANGED);
|
|
|
|
fl_set_input_return(dialog_->input_normal, FL_RETURN_CHANGED);
|
|
|
|
fl_set_input_return(dialog_->input_large, FL_RETURN_CHANGED);
|
|
|
|
fl_set_input_return(dialog_->input_larger, FL_RETURN_CHANGED);
|
|
|
|
fl_set_input_return(dialog_->input_largest, FL_RETURN_CHANGED);
|
|
|
|
fl_set_input_return(dialog_->input_huge, FL_RETURN_CHANGED);
|
|
|
|
fl_set_input_return(dialog_->input_huger, FL_RETURN_CHANGED);
|
|
|
|
|
2000-12-06 22:24:17 +00:00
|
|
|
fl_set_input_filter(dialog_->input_tiny, fl_unsigned_float_filter);
|
|
|
|
fl_set_input_filter(dialog_->input_script, fl_unsigned_float_filter);
|
|
|
|
fl_set_input_filter(dialog_->input_footnote, fl_unsigned_float_filter);
|
|
|
|
fl_set_input_filter(dialog_->input_small, fl_unsigned_float_filter);
|
|
|
|
fl_set_input_filter(dialog_->input_normal, fl_unsigned_float_filter);
|
|
|
|
fl_set_input_filter(dialog_->input_large, fl_unsigned_float_filter);
|
|
|
|
fl_set_input_filter(dialog_->input_larger, fl_unsigned_float_filter);
|
|
|
|
fl_set_input_filter(dialog_->input_largest, fl_unsigned_float_filter);
|
|
|
|
fl_set_input_filter(dialog_->input_huge, fl_unsigned_float_filter);
|
|
|
|
fl_set_input_filter(dialog_->input_huger, fl_unsigned_float_filter);
|
2000-11-03 09:47:02 +00:00
|
|
|
|
2000-10-30 21:53:29 +00:00
|
|
|
// set up the feedback mechanism
|
2002-03-11 09:54:42 +00:00
|
|
|
setPrehandler(dialog_->input_roman);
|
|
|
|
setPrehandler(dialog_->input_sans);
|
|
|
|
setPrehandler(dialog_->input_typewriter);
|
|
|
|
setPrehandler(dialog_->counter_zoom);
|
|
|
|
setPrehandler(dialog_->counter_dpi);
|
|
|
|
setPrehandler(dialog_->check_scalable);
|
|
|
|
setPrehandler(dialog_->input_screen_encoding);
|
|
|
|
setPrehandler(dialog_->input_tiny);
|
|
|
|
setPrehandler(dialog_->input_script);
|
|
|
|
setPrehandler(dialog_->input_footnote);
|
|
|
|
setPrehandler(dialog_->input_small);
|
|
|
|
setPrehandler(dialog_->input_large);
|
|
|
|
setPrehandler(dialog_->input_larger);
|
|
|
|
setPrehandler(dialog_->input_largest);
|
|
|
|
setPrehandler(dialog_->input_normal);
|
|
|
|
setPrehandler(dialog_->input_huge);
|
|
|
|
setPrehandler(dialog_->input_huger);
|
2000-10-27 10:04:51 +00:00
|
|
|
}
|
|
|
|
|
2002-03-21 21:21:28 +00:00
|
|
|
|
2000-11-04 10:00:12 +00:00
|
|
|
string const
|
2000-11-21 15:46:13 +00:00
|
|
|
FormPreferences::ScreenFonts::feedback(FL_OBJECT const * const ob) const
|
2000-10-27 10:04:51 +00:00
|
|
|
{
|
2000-11-21 15:46:13 +00:00
|
|
|
if (ob == dialog_->input_roman)
|
2002-07-17 15:34:00 +00:00
|
|
|
return lyxrc.getDescription(LyXRC::RC_SCREEN_FONT_ROMAN);
|
|
|
|
if (ob == dialog_->input_sans)
|
|
|
|
return lyxrc.getDescription(LyXRC::RC_SCREEN_FONT_SANS);
|
|
|
|
if (ob == dialog_->input_typewriter)
|
|
|
|
return lyxrc.getDescription(LyXRC::RC_SCREEN_FONT_TYPEWRITER);
|
|
|
|
if (ob == dialog_->check_scalable)
|
|
|
|
return lyxrc.getDescription(LyXRC::RC_SCREEN_FONT_SCALABLE);
|
|
|
|
if (ob == dialog_->input_screen_encoding)
|
|
|
|
return lyxrc.getDescription(LyXRC::RC_SCREEN_FONT_ENCODING);
|
|
|
|
if (ob == dialog_->counter_zoom)
|
|
|
|
return lyxrc.getDescription(LyXRC::RC_SCREEN_ZOOM);
|
|
|
|
if (ob == dialog_->counter_dpi)
|
|
|
|
return lyxrc.getDescription(LyXRC::RC_SCREEN_DPI);
|
|
|
|
if (ob == dialog_->input_tiny
|
2000-11-14 13:46:01 +00:00
|
|
|
|| ob == dialog_->input_script
|
|
|
|
|| ob == dialog_->input_footnote
|
|
|
|
|| ob == dialog_->input_small
|
|
|
|
|| ob == dialog_->input_large
|
|
|
|
|| ob == dialog_->input_larger
|
|
|
|
|| ob == dialog_->input_larger
|
|
|
|
|| ob == dialog_->input_largest
|
|
|
|
|| ob == dialog_->input_normal
|
|
|
|
|| ob == dialog_->input_huge
|
2000-11-21 15:46:13 +00:00
|
|
|
|| ob == dialog_->input_huger)
|
2002-07-17 15:34:00 +00:00
|
|
|
return lyxrc.getDescription(LyXRC::RC_SCREEN_FONT_SIZES);
|
|
|
|
return string();
|
2000-10-27 10:04:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
bool FormPreferences::ScreenFonts::input()
|
2000-10-27 10:04:51 +00:00
|
|
|
{
|
|
|
|
bool activate = true;
|
|
|
|
string str;
|
|
|
|
|
|
|
|
// Make sure that all fonts all have positive entries
|
|
|
|
// Also note that an empty entry is returned as 0.0 by strToDbl
|
2000-11-14 13:46:01 +00:00
|
|
|
if (0.0 >= strToDbl(fl_get_input(dialog_->input_tiny))
|
|
|
|
|| 0.0 >= strToDbl(fl_get_input(dialog_->input_script))
|
|
|
|
|| 0.0 >= strToDbl(fl_get_input(dialog_->input_footnote))
|
|
|
|
|| 0.0 >= strToDbl(fl_get_input(dialog_->input_small))
|
|
|
|
|| 0.0 >= strToDbl(fl_get_input(dialog_->input_normal))
|
|
|
|
|| 0.0 >= strToDbl(fl_get_input(dialog_->input_large))
|
|
|
|
|| 0.0 >= strToDbl(fl_get_input(dialog_->input_larger))
|
|
|
|
|| 0.0 >= strToDbl(fl_get_input(dialog_->input_largest))
|
|
|
|
|| 0.0 >= strToDbl(fl_get_input(dialog_->input_huge))
|
|
|
|
|| 0.0 >= strToDbl(fl_get_input(dialog_->input_huger))) {
|
2000-10-27 10:04:51 +00:00
|
|
|
activate = false;
|
2002-04-02 17:04:23 +00:00
|
|
|
str = _("Fonts must be positive!");
|
2000-10-27 10:04:51 +00:00
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
} else if (strToDbl(fl_get_input(dialog_->input_tiny)) >
|
2002-03-21 16:59:12 +00:00
|
|
|
// Fontsizes -- tiny < script < footnote etc.
|
2000-11-14 13:46:01 +00:00
|
|
|
strToDbl(fl_get_input(dialog_->input_script)) ||
|
|
|
|
strToDbl(fl_get_input(dialog_->input_script)) >
|
|
|
|
strToDbl(fl_get_input(dialog_->input_footnote)) ||
|
|
|
|
strToDbl(fl_get_input(dialog_->input_footnote)) >
|
|
|
|
strToDbl(fl_get_input(dialog_->input_small)) ||
|
|
|
|
strToDbl(fl_get_input(dialog_->input_small)) >
|
|
|
|
strToDbl(fl_get_input(dialog_->input_normal)) ||
|
|
|
|
strToDbl(fl_get_input(dialog_->input_normal)) >
|
|
|
|
strToDbl(fl_get_input(dialog_->input_large)) ||
|
|
|
|
strToDbl(fl_get_input(dialog_->input_large)) >
|
|
|
|
strToDbl(fl_get_input(dialog_->input_larger)) ||
|
|
|
|
strToDbl(fl_get_input(dialog_->input_larger)) >
|
|
|
|
strToDbl(fl_get_input(dialog_->input_largest)) ||
|
|
|
|
strToDbl(fl_get_input(dialog_->input_largest)) >
|
|
|
|
strToDbl(fl_get_input(dialog_->input_huge)) ||
|
|
|
|
strToDbl(fl_get_input(dialog_->input_huge)) >
|
|
|
|
strToDbl(fl_get_input(dialog_->input_huger))) {
|
2000-10-27 10:04:51 +00:00
|
|
|
activate = false;
|
|
|
|
|
2002-04-02 17:04:23 +00:00
|
|
|
str = _("Fonts must be input in the order tiny > script> footnote > small > normal > large > larger > largest > huge > huger.");
|
2000-10-27 10:04:51 +00:00
|
|
|
}
|
|
|
|
|
2000-11-09 15:28:42 +00:00
|
|
|
if (!activate)
|
2002-03-11 09:54:42 +00:00
|
|
|
parent_.postWarning(str);
|
2002-03-21 21:21:28 +00:00
|
|
|
|
2000-10-27 10:04:51 +00:00
|
|
|
return activate;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
void FormPreferences::ScreenFonts::update()
|
2000-10-27 10:04:51 +00:00
|
|
|
{
|
2000-11-14 13:46:01 +00:00
|
|
|
fl_set_input(dialog_->input_roman,
|
2000-10-27 10:04:51 +00:00
|
|
|
lyxrc.roman_font_name.c_str());
|
2000-11-14 13:46:01 +00:00
|
|
|
fl_set_input(dialog_->input_sans,
|
2000-10-27 10:04:51 +00:00
|
|
|
lyxrc.sans_font_name.c_str());
|
2000-11-14 13:46:01 +00:00
|
|
|
fl_set_input(dialog_->input_typewriter,
|
2000-10-27 10:04:51 +00:00
|
|
|
lyxrc.typewriter_font_name.c_str());
|
2000-11-14 13:46:01 +00:00
|
|
|
fl_set_input(dialog_->input_screen_encoding,
|
2000-10-27 10:04:51 +00:00
|
|
|
lyxrc.font_norm.c_str());
|
2000-11-14 13:46:01 +00:00
|
|
|
fl_set_button(dialog_->check_scalable,
|
2000-10-27 10:04:51 +00:00
|
|
|
lyxrc.use_scalable_fonts);
|
2000-11-14 13:46:01 +00:00
|
|
|
fl_set_counter_value(dialog_->counter_zoom, lyxrc.zoom);
|
|
|
|
fl_set_counter_value(dialog_->counter_dpi, lyxrc.dpi);
|
|
|
|
fl_set_input(dialog_->input_tiny,
|
2000-10-27 10:04:51 +00:00
|
|
|
tostr(lyxrc.font_sizes[LyXFont::SIZE_TINY]).c_str());
|
2000-11-14 13:46:01 +00:00
|
|
|
fl_set_input(dialog_->input_script,
|
2000-10-27 10:04:51 +00:00
|
|
|
tostr(lyxrc.font_sizes[LyXFont::SIZE_SCRIPT]).c_str());
|
2000-11-14 13:46:01 +00:00
|
|
|
fl_set_input(dialog_->input_footnote,
|
2000-10-27 10:04:51 +00:00
|
|
|
tostr(lyxrc.font_sizes[LyXFont::SIZE_FOOTNOTE]).c_str());
|
2000-11-14 13:46:01 +00:00
|
|
|
fl_set_input(dialog_->input_small,
|
2000-10-27 10:04:51 +00:00
|
|
|
tostr(lyxrc.font_sizes[LyXFont::SIZE_SMALL]).c_str());
|
2000-11-14 13:46:01 +00:00
|
|
|
fl_set_input(dialog_->input_normal,
|
2000-10-27 10:04:51 +00:00
|
|
|
tostr(lyxrc.font_sizes[LyXFont::SIZE_NORMAL]).c_str());
|
2000-11-14 13:46:01 +00:00
|
|
|
fl_set_input(dialog_->input_large,
|
2000-10-27 10:04:51 +00:00
|
|
|
tostr(lyxrc.font_sizes[LyXFont::SIZE_LARGE]).c_str());
|
2000-11-14 13:46:01 +00:00
|
|
|
fl_set_input(dialog_->input_larger,
|
2000-10-27 10:04:51 +00:00
|
|
|
tostr(lyxrc.font_sizes[LyXFont::SIZE_LARGER]).c_str());
|
2000-11-14 13:46:01 +00:00
|
|
|
fl_set_input(dialog_->input_largest,
|
2000-10-27 10:04:51 +00:00
|
|
|
tostr(lyxrc.font_sizes[LyXFont::SIZE_LARGEST]).c_str());
|
2000-11-14 13:46:01 +00:00
|
|
|
fl_set_input(dialog_->input_huge,
|
2000-10-27 10:04:51 +00:00
|
|
|
tostr(lyxrc.font_sizes[LyXFont::SIZE_HUGE]).c_str());
|
2000-11-14 13:46:01 +00:00
|
|
|
fl_set_input(dialog_->input_huger,
|
2000-10-27 10:04:51 +00:00
|
|
|
tostr(lyxrc.font_sizes[LyXFont::SIZE_HUGER]).c_str());
|
2000-10-25 10:19:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-03-15 13:37:04 +00:00
|
|
|
|
2002-02-16 15:59:55 +00:00
|
|
|
FormPreferences::SpellOptions::SpellOptions(FormPreferences & p)
|
2001-03-15 13:37:04 +00:00
|
|
|
: parent_(p)
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
2002-06-13 13:43:51 +00:00
|
|
|
FD_preferences_spelloptions const * FormPreferences::SpellOptions::dialog()
|
2000-10-25 10:19:25 +00:00
|
|
|
{
|
2001-03-15 13:37:04 +00:00
|
|
|
return dialog_.get();
|
2000-11-14 13:46:01 +00:00
|
|
|
}
|
2000-10-25 10:19:25 +00:00
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
|
2001-07-13 11:50:39 +00:00
|
|
|
void FormPreferences::SpellOptions::apply()
|
2000-11-14 13:46:01 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
string choice = fl_get_choice_text(dialog_->choice_spell_command);
|
2002-07-28 22:50:13 +00:00
|
|
|
choice = trim(choice);
|
2002-03-21 21:21:28 +00:00
|
|
|
|
2000-10-25 10:19:25 +00:00
|
|
|
lyxrc.isp_command = choice;
|
|
|
|
|
2001-08-23 14:39:18 +00:00
|
|
|
#if 0
|
2000-10-25 10:19:25 +00:00
|
|
|
// If spell checker == "none", all other input set to off.
|
2000-11-14 13:46:01 +00:00
|
|
|
if (fl_get_choice(dialog_->choice_spell_command) == 1) {
|
2000-10-25 10:19:25 +00:00
|
|
|
lyxrc.isp_use_alt_lang = false;
|
|
|
|
lyxrc.isp_alt_lang.erase();
|
|
|
|
|
|
|
|
lyxrc.isp_use_esc_chars = false;
|
|
|
|
lyxrc.isp_esc_chars.erase();
|
|
|
|
|
|
|
|
lyxrc.isp_use_pers_dict = false;
|
|
|
|
lyxrc.isp_pers_dict.erase();
|
|
|
|
|
|
|
|
lyxrc.isp_accept_compound = false;
|
|
|
|
lyxrc.isp_use_input_encoding = false;
|
|
|
|
} else {
|
2001-08-23 14:39:18 +00:00
|
|
|
#else
|
2000-11-14 13:46:01 +00:00
|
|
|
int button = fl_get_button(dialog_->check_alt_lang);
|
|
|
|
choice = fl_get_input(dialog_->input_alt_lang);
|
2000-11-21 15:46:13 +00:00
|
|
|
if (button && choice.empty()) button = 0;
|
|
|
|
if (!button) choice.erase();
|
2000-10-25 10:19:25 +00:00
|
|
|
|
|
|
|
lyxrc.isp_use_alt_lang = static_cast<bool>(button);
|
|
|
|
lyxrc.isp_alt_lang = choice;
|
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
button = fl_get_button(dialog_->check_escape_chars);
|
|
|
|
choice = fl_get_input(dialog_->input_escape_chars);
|
2000-11-21 15:46:13 +00:00
|
|
|
if (button && choice.empty()) button = 0;
|
|
|
|
if (!button) choice.erase();
|
2002-03-21 21:21:28 +00:00
|
|
|
|
2000-10-25 10:19:25 +00:00
|
|
|
lyxrc.isp_use_esc_chars = static_cast<bool>(button);
|
|
|
|
lyxrc.isp_esc_chars = choice;
|
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
button = fl_get_button(dialog_->check_personal_dict);
|
|
|
|
choice = fl_get_input(dialog_->input_personal_dict);
|
2000-11-21 15:46:13 +00:00
|
|
|
if (button && choice.empty()) button = 0;
|
|
|
|
if (!button) choice.erase();
|
2000-10-25 10:19:25 +00:00
|
|
|
|
|
|
|
lyxrc.isp_use_pers_dict = static_cast<bool>(button);
|
|
|
|
lyxrc.isp_pers_dict = choice;
|
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
button = fl_get_button(dialog_->check_compound_words);
|
2000-10-25 10:19:25 +00:00
|
|
|
lyxrc.isp_accept_compound = static_cast<bool>(button);
|
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
button = fl_get_button(dialog_->check_input_enc);
|
2000-10-25 10:19:25 +00:00
|
|
|
lyxrc.isp_use_input_encoding = static_cast<bool>(button);
|
2001-08-23 14:39:18 +00:00
|
|
|
#endif
|
|
|
|
#if 0
|
2000-10-25 10:19:25 +00:00
|
|
|
}
|
2001-08-23 14:39:18 +00:00
|
|
|
#endif
|
2000-10-27 10:04:51 +00:00
|
|
|
|
|
|
|
// Reset view
|
2000-11-14 13:46:01 +00:00
|
|
|
update();
|
2000-06-12 11:55:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-07-13 11:50:39 +00:00
|
|
|
void FormPreferences::SpellOptions::build()
|
2000-06-12 11:55:12 +00:00
|
|
|
{
|
2002-06-14 09:17:11 +00:00
|
|
|
dialog_.reset(build_preferences_spelloptions(&parent_));
|
2000-10-25 10:19:25 +00:00
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
fl_addto_choice(dialog_->choice_spell_command,
|
2001-08-23 14:39:18 +00:00
|
|
|
_(" ispell | aspell "));
|
2000-11-21 21:51:25 +00:00
|
|
|
fl_set_input_return(dialog_->input_alt_lang, FL_RETURN_CHANGED);
|
|
|
|
fl_set_input_return(dialog_->input_escape_chars, FL_RETURN_CHANGED);
|
|
|
|
fl_set_input_return(dialog_->input_personal_dict, FL_RETURN_CHANGED);
|
2000-10-27 10:04:51 +00:00
|
|
|
|
2000-10-30 21:53:29 +00:00
|
|
|
// set up the feedback mechanism
|
2002-03-11 09:54:42 +00:00
|
|
|
setPrehandler(dialog_->choice_spell_command);
|
|
|
|
setPrehandler(dialog_->check_alt_lang);
|
|
|
|
setPrehandler(dialog_->input_alt_lang);
|
|
|
|
setPrehandler(dialog_->check_escape_chars);
|
|
|
|
setPrehandler(dialog_->input_escape_chars);
|
|
|
|
setPrehandler(dialog_->check_personal_dict);
|
|
|
|
setPrehandler(dialog_->input_personal_dict);
|
|
|
|
setPrehandler(dialog_->button_personal_dict);
|
|
|
|
setPrehandler(dialog_->check_compound_words);
|
|
|
|
setPrehandler(dialog_->check_input_enc);
|
2000-10-27 10:04:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-11-04 10:00:12 +00:00
|
|
|
string const
|
2001-07-13 11:50:39 +00:00
|
|
|
FormPreferences::SpellOptions::feedback(FL_OBJECT const * const ob) const
|
2000-10-27 10:04:51 +00:00
|
|
|
{
|
2000-11-15 03:22:08 +00:00
|
|
|
if (ob == dialog_->choice_spell_command)
|
2002-07-17 15:34:00 +00:00
|
|
|
return lyxrc.getDescription(LyXRC::RC_SPELL_COMMAND);
|
|
|
|
if (ob == dialog_->check_alt_lang)
|
|
|
|
return lyxrc.getDescription(LyXRC::RC_USE_ALT_LANG);
|
|
|
|
if (ob == dialog_->input_alt_lang)
|
|
|
|
return lyxrc.getDescription(LyXRC::RC_ALT_LANG);
|
|
|
|
if (ob == dialog_->check_escape_chars)
|
|
|
|
return lyxrc.getDescription(LyXRC::RC_USE_ESC_CHARS);
|
|
|
|
if (ob == dialog_->input_escape_chars)
|
|
|
|
return lyxrc.getDescription(LyXRC::RC_ESC_CHARS);
|
|
|
|
if (ob == dialog_->check_personal_dict)
|
|
|
|
return lyxrc.getDescription(LyXRC::RC_USE_PERS_DICT);
|
|
|
|
if (ob == dialog_->input_personal_dict)
|
|
|
|
return lyxrc.getDescription(LyXRC::RC_PERS_DICT);
|
|
|
|
if (ob == dialog_->check_compound_words)
|
|
|
|
return lyxrc.getDescription(LyXRC::RC_ACCEPT_COMPOUND);
|
|
|
|
if (ob == dialog_->check_input_enc)
|
|
|
|
return lyxrc.getDescription(LyXRC::RC_USE_INP_ENC);
|
|
|
|
return string();
|
2000-10-27 10:04:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-07-13 11:50:39 +00:00
|
|
|
bool FormPreferences::SpellOptions::input(FL_OBJECT const * const ob)
|
2000-10-27 10:04:51 +00:00
|
|
|
{
|
2001-07-13 11:50:39 +00:00
|
|
|
// !ob if function is called from updateSpellOptions() to de/activate
|
2000-11-09 15:28:42 +00:00
|
|
|
// objects,
|
|
|
|
// otherwise the function is called by an xforms CB via input().
|
2000-10-27 10:04:51 +00:00
|
|
|
|
2001-08-23 14:39:18 +00:00
|
|
|
#if 0
|
2000-10-27 10:04:51 +00:00
|
|
|
// If spell checker == "none", disable all input.
|
2000-11-14 13:46:01 +00:00
|
|
|
if (!ob || ob == dialog_->choice_spell_command) {
|
|
|
|
if (fl_get_choice(dialog_->choice_spell_command) == 1) {
|
2000-11-17 00:07:41 +00:00
|
|
|
fl_deactivate_object(dialog_->check_alt_lang);
|
|
|
|
fl_deactivate_object(dialog_->input_alt_lang);
|
|
|
|
fl_deactivate_object(dialog_->check_escape_chars);
|
|
|
|
fl_deactivate_object(dialog_->input_escape_chars);
|
|
|
|
fl_deactivate_object(dialog_->check_personal_dict);
|
|
|
|
fl_deactivate_object(dialog_->input_personal_dict);
|
|
|
|
fl_deactivate_object(dialog_->check_compound_words);
|
|
|
|
fl_deactivate_object(dialog_->check_input_enc);
|
2000-10-27 10:04:51 +00:00
|
|
|
return true;
|
|
|
|
} else {
|
2000-11-17 00:07:41 +00:00
|
|
|
fl_activate_object(dialog_->check_alt_lang);
|
|
|
|
fl_activate_object(dialog_->check_escape_chars);
|
|
|
|
fl_activate_object(dialog_->check_personal_dict);
|
|
|
|
fl_activate_object(dialog_->check_compound_words);
|
|
|
|
fl_activate_object(dialog_->check_input_enc);
|
2000-10-27 10:04:51 +00:00
|
|
|
}
|
|
|
|
}
|
2001-08-23 14:39:18 +00:00
|
|
|
#endif
|
2000-10-27 10:04:51 +00:00
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
if (!ob || ob == dialog_->check_alt_lang) {
|
2001-03-05 19:02:40 +00:00
|
|
|
bool const enable = fl_get_button(dialog_->check_alt_lang);
|
|
|
|
setEnabled(dialog_->input_alt_lang, enable);
|
2000-10-27 10:04:51 +00:00
|
|
|
}
|
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
if (!ob || ob == dialog_->check_escape_chars) {
|
2001-03-05 19:02:40 +00:00
|
|
|
bool const enable = fl_get_button(dialog_->check_escape_chars);
|
|
|
|
setEnabled(dialog_->input_escape_chars, enable);
|
2000-10-27 10:04:51 +00:00
|
|
|
}
|
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
if (!ob || ob == dialog_->check_personal_dict) {
|
2001-03-05 19:02:40 +00:00
|
|
|
bool const enable = fl_get_button(dialog_->check_personal_dict);
|
|
|
|
setEnabled(dialog_->input_personal_dict, enable);
|
2000-10-27 10:04:51 +00:00
|
|
|
}
|
2000-11-14 13:46:01 +00:00
|
|
|
|
2000-11-21 15:46:13 +00:00
|
|
|
if (ob == dialog_->button_personal_dict) {
|
2000-11-15 03:22:08 +00:00
|
|
|
parent_.browse(dialog_->input_personal_dict,
|
2002-04-02 17:04:23 +00:00
|
|
|
_("Personal dictionary"), "*.ispell");
|
2000-11-14 13:46:01 +00:00
|
|
|
}
|
2002-03-21 21:21:28 +00:00
|
|
|
|
2000-11-03 09:47:02 +00:00
|
|
|
return true; // All input is valid!
|
2000-10-25 10:19:25 +00:00
|
|
|
}
|
2000-10-11 07:59:25 +00:00
|
|
|
|
2000-10-25 10:19:25 +00:00
|
|
|
|
2001-07-13 11:50:39 +00:00
|
|
|
void FormPreferences::SpellOptions::update()
|
2000-10-25 10:19:25 +00:00
|
|
|
{
|
|
|
|
int choice = 1;
|
2001-08-23 14:39:18 +00:00
|
|
|
#if 0
|
2000-11-21 15:46:13 +00:00
|
|
|
if (lyxrc.isp_command == "none")
|
2000-10-25 10:19:25 +00:00
|
|
|
choice = 1;
|
2000-11-21 15:46:13 +00:00
|
|
|
else if (lyxrc.isp_command == "ispell")
|
2000-10-25 10:19:25 +00:00
|
|
|
choice = 2;
|
2000-11-21 15:46:13 +00:00
|
|
|
else if (lyxrc.isp_command == "aspell")
|
2000-10-25 10:19:25 +00:00
|
|
|
choice = 3;
|
2001-08-23 14:39:18 +00:00
|
|
|
#else
|
|
|
|
if (lyxrc.isp_command == "ispell")
|
|
|
|
choice = 1;
|
|
|
|
else if (lyxrc.isp_command == "aspell")
|
|
|
|
choice = 2;
|
|
|
|
#endif
|
2000-11-14 13:46:01 +00:00
|
|
|
fl_set_choice(dialog_->choice_spell_command, choice);
|
2002-03-21 21:21:28 +00:00
|
|
|
|
2000-11-08 09:39:46 +00:00
|
|
|
string str;
|
2002-07-17 15:34:00 +00:00
|
|
|
if (lyxrc.isp_use_alt_lang)
|
|
|
|
str = lyxrc.isp_alt_lang;
|
2000-10-25 10:19:25 +00:00
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
fl_set_button(dialog_->check_alt_lang,
|
2000-10-25 10:19:25 +00:00
|
|
|
lyxrc.isp_use_alt_lang);
|
2000-11-14 13:46:01 +00:00
|
|
|
fl_set_input(dialog_->input_alt_lang, str.c_str());
|
2002-03-21 21:21:28 +00:00
|
|
|
|
2000-10-27 10:04:51 +00:00
|
|
|
str.erase();
|
2002-07-17 15:34:00 +00:00
|
|
|
if (lyxrc.isp_use_esc_chars)
|
|
|
|
str = lyxrc.isp_esc_chars;
|
2000-10-25 10:19:25 +00:00
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
fl_set_button(dialog_->check_escape_chars,
|
2000-10-25 10:19:25 +00:00
|
|
|
lyxrc.isp_use_esc_chars);
|
2000-11-14 13:46:01 +00:00
|
|
|
fl_set_input(dialog_->input_escape_chars, str.c_str());
|
2000-10-25 10:19:25 +00:00
|
|
|
|
2000-10-27 10:04:51 +00:00
|
|
|
str.erase();
|
2002-07-17 15:34:00 +00:00
|
|
|
if (lyxrc.isp_use_pers_dict)
|
|
|
|
str = lyxrc.isp_pers_dict;
|
2000-10-25 10:19:25 +00:00
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
fl_set_button(dialog_->check_personal_dict,
|
2000-10-25 10:19:25 +00:00
|
|
|
lyxrc.isp_use_pers_dict);
|
2000-11-14 13:46:01 +00:00
|
|
|
fl_set_input(dialog_->input_personal_dict, str.c_str());
|
2000-10-25 10:19:25 +00:00
|
|
|
|
2000-11-14 13:46:01 +00:00
|
|
|
fl_set_button(dialog_->check_compound_words,
|
2000-10-25 10:19:25 +00:00
|
|
|
lyxrc.isp_accept_compound);
|
2000-11-14 13:46:01 +00:00
|
|
|
fl_set_button(dialog_->check_input_enc,
|
2000-10-25 10:19:25 +00:00
|
|
|
lyxrc.isp_use_input_encoding);
|
|
|
|
|
|
|
|
// Activate/Deactivate the input fields dependent on the state of the
|
|
|
|
// buttons.
|
2000-11-21 15:46:13 +00:00
|
|
|
input(0);
|
2000-06-12 11:55:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-11-15 18:02:45 +00:00
|
|
|
void FormPreferences::browse(FL_OBJECT * inpt,
|
2000-11-15 03:22:08 +00:00
|
|
|
string const & title,
|
2002-03-21 21:21:28 +00:00
|
|
|
string const & pattern,
|
2000-11-15 03:22:08 +00:00
|
|
|
pair<string,string> const & dir1,
|
|
|
|
pair<string,string> const & dir2)
|
2000-11-09 15:28:42 +00:00
|
|
|
{
|
2000-11-14 13:46:01 +00:00
|
|
|
// Get the filename from the dialog
|
|
|
|
string const filename = fl_get_input(inpt);
|
|
|
|
|
|
|
|
// Show the file browser dialog
|
|
|
|
string const new_filename =
|
2002-03-26 12:59:29 +00:00
|
|
|
browseFile(lv_, filename, title, pattern, dir1, dir2);
|
2000-11-14 13:46:01 +00:00
|
|
|
|
|
|
|
// Save the filename to the dialog
|
2000-11-15 03:22:08 +00:00
|
|
|
if (new_filename != filename && !new_filename.empty()) {
|
2000-11-14 13:46:01 +00:00
|
|
|
fl_set_input(inpt, new_filename.c_str());
|
2000-11-15 03:22:08 +00:00
|
|
|
input(inpt, 0);
|
2000-11-14 13:46:01 +00:00
|
|
|
}
|
2000-10-30 21:53:29 +00:00
|
|
|
}
|