*
* \author Jürgen Vigna
* \author Rob Lahaye
+ * \author Martin Vermeer
+ * \author Jürgen Spitzmüller
*
- * Full author contact details are available in file CREDITS
+ * Full author contact details are available in file CREDITS.
*/
#include <config.h>
-
-#include "ControlDocument.h"
#include "FormDocument.h"
+#include "ControlDocument.h"
#include "forms/form_document.h"
-#include "xformsBC.h"
-#include "ButtonController.h"
#include "bmtable.h"
#include "checkedwidgets.h"
+#include "ColorHandler.h"
+#include "combox.h"
+#include "FormColorpicker.h"
#include "input_validators.h" // fl_unsigned_float_filter
+#include "Tooltips.h"
#include "xforms_helpers.h"
+#include "xformsBC.h"
-#include "CutAndPaste.h"
-#include "debug.h"
+#include "controllers/ButtonController.h"
+#include "controllers/frnt_lang.h"
+#include "controllers/helper_funcs.h"
+
+#include "Bullet.h"
+#include "bufferparams.h"
#include "language.h"
#include "lyxrc.h"
#include "lyxtextclasslist.h"
#include "tex-strings.h"
+#include "vspace.h"
-#include "controllers/frnt_lang.h"
-#include "controllers/helper_funcs.h"
-
-#include "support/lstrings.h" // contains_functor, getStringFromVector
+#include "support/tostr.h"
+#include "support/lstrings.h" // contains, getStringFromVector
#include "support/filetools.h" // LibFileSearch
-#include XPM_H_LOCATION
-#include FORMS_H_LOCATION
-#include "combox.h"
+#include "lyx_xpm.h"
#include <boost/bind.hpp>
-#include <functional>
+#include <iomanip>
+
+using lyx::support::bformat;
+using lyx::support::contains;
+using lyx::support::getStringFromVector;
+using lyx::support::getVectorFromString;
+using lyx::support::LibFileSearch;
-using std::bind2nd;
+using boost::bind;
+
+using std::endl;
+using std::string;
using std::vector;
+namespace {
+
+#if FL_VERSION == 0 || (FL_REVISION == 0 && FL_FIXLEVEL < 2)
+bool const scalableTabfolders = false;
+#else
+bool const scalableTabfolders = true;
+#endif
+
+
+} // namespace anon
+
+
typedef FormCB<ControlDocument, FormDB<FD_document> > base_class;
FormDocument::FormDocument()
- : base_class(_("Document Layout"), false),
+ : base_class(_("Document Settings"), scalableTabfolders),
ActCell(0), Confirmed(0),
current_bullet_panel(0), current_bullet_depth(0), fbullet(0)
{}
LyXTextClassList::const_iterator tit = textclasslist.begin();
LyXTextClassList::const_iterator tend = textclasslist.end();
for (; tit != tend; ++tit) {
- fl_addto_combox(obj, tit->description().c_str());
+ if (tit->isTeXClassAvailable()) {
+ fl_addto_combox(obj, tit->description().c_str());
+ } else {
+ string item = bformat(_("Unavailable: %1$s"), tit->description());
+ fl_addto_combox(obj, item.c_str());
+ }
}
fl_set_combox_browser_height(obj, 400);
fl_addto_choice(class_->choice_spacing,
- _(" Single | OneHalf | Double | Custom "));
+ _(" Single | OneHalf | Double | Custom ").c_str());
fl_addto_choice(class_->choice_fontsize, "default|10|11|12");
for (int n = 0; tex_fonts[n][0]; ++n) {
fl_addto_choice(class_->choice_fonts,tex_fonts[n]);
vector<string>::iterator ret =
std::remove_if(units_vec.begin(),
units_vec.end(),
- bind2nd(contains_functor(), "%"));
+ bind(contains<char>, _1, '%'));
units_vec.erase(ret, units_vec.end());
string const units = getStringFromVector(units_vec, "|");
fl_addto_choice(class_->choice_pagestyle,
"default|empty|plain|headings|fancy");
fl_addto_choice(class_->choice_skip,
- _(" SmallSkip | MedSkip | BigSkip | Length "));
+ _(" SmallSkip | MedSkip | BigSkip | Length ").c_str());
fl_addto_choice(class_->choice_skip_units, units.c_str());
// Set input filters on doc spacing to make it accept only
fl_addto_choice(paper_->choice_papersize,
_(" Default | Custom | US letter | US legal "
- "| US executive | A3 | A4 | A5 | B3 | B4 | B5 "));
+ "| US executive | A3 | A4 | A5 "
+ "| B3 | B4 | B5 ").c_str());
fl_addto_choice(paper_->choice_paperpackage,
_(" None "
"| Small Margins "
"| Very small Margins "
- "| Very wide Margins "));
+ "| Very wide Margins ").c_str());
fl_addto_choice(paper_->choice_custom_width_units, units.c_str());
fl_addto_choice(paper_->choice_custom_height_units, units.c_str());
bcview().addReadOnly(language_->combox_language);
bcview().addReadOnly(language_->choice_inputenc);
bcview().addReadOnly(language_->choice_quotes_language);
- bcview().addReadOnly(language_->radio_single);
- bcview().addReadOnly(language_->radio_double);
fl_addto_choice(language_->choice_inputenc,
"default|auto|latin1|latin2|latin3|latin4|latin5|latin9"
fl_addto_choice(language_->choice_quotes_language,
_(" ``text'' | ''text'' | ,,text`` | ,,text'' |"
- " «text» | »text« "));
+ " <<text>> | >>text<< ").c_str());
// the document options form
options_.reset(build_document_options(this));
bcview().addReadOnly(options_->counter_tocdepth);
bcview().addReadOnly(options_->choice_ams_math);
bcview().addReadOnly(options_->check_use_natbib);
+ bcview().addReadOnly(options_->check_use_jurabib);
bcview().addReadOnly(options_->choice_citation_format);
bcview().addReadOnly(options_->input_float_placement);
bcview().addReadOnly(options_->choice_postscript_driver);
+
+ // set up the tooltips for optionss form
+ string str = _("Use the natbib styles for natural sciences and arts");
+ tooltips().init(options_->check_use_natbib, str);
+ str = _("Use the jurabib styles for law and humanities");
+ tooltips().init(options_->check_use_jurabib, str);
// trigger an input event for cut&paste with middle mouse button.
setPrehandler(options_->input_float_placement);
fl_set_input_return(options_->input_float_placement, FL_RETURN_CHANGED);
fl_addto_choice(options_->choice_ams_math,
- _("Never | Automatically | Yes "));
+ _(" Never | Automatically | Yes ").c_str());
for (int n = 0; tex_graphics[n][0]; ++n) {
fl_addto_choice(options_->choice_postscript_driver,
tex_graphics[n]);
}
fl_addto_choice(options_->choice_citation_format,
- _(" Author-year | Numerical "));
+ _(" Author-year | Numerical ").c_str());
// the document bullets form
bullets_.reset(build_document_bullet(this));
fl_set_input_return(bullets_->input_latex, FL_RETURN_CHANGED);
fl_addto_choice(bullets_->choice_size,
- _(" Default | Tiny | Smallest | Smaller | Small |"
- " Normal | Large | Larger | Largest | Huge | Huger "));
+ _(" Default | Tiny | Smallest | Smaller "
+ "| Small | Normal | Large | Larger | Largest "
+ "| Huge | Huger ").c_str());
fl_set_choice(bullets_->choice_size, 1);
fl_set_input_maxchars(bullets_->input_latex, 80);
fl_set_bmtable_pixmap_file(bullets_->bmtable_panel, 6, 6,
bmtablefile.c_str());
- fl_addto_tabfolder(dialog_->tabfolder,_("Document"),
+ picker_.reset(new FormColorpicker);
+
+ // the document branches form
+ branch_.reset(build_document_branch(this));
+
+ fl_set_object_color(branch_->button_color,
+ GUI_COLOR_CHOICE, GUI_COLOR_CHOICE);
+
+ bcview().addReadOnly(branch_->input_all_branches);
+ bcview().addReadOnly(branch_->button_add_branch);
+ bcview().addReadOnly(branch_->button_remove_branch);
+ bcview().addReadOnly(branch_->button_select);
+ bcview().addReadOnly(branch_->button_deselect);
+ bcview().addReadOnly(branch_->button_modify);
+ bcview().addReadOnly(branch_->browser_all_branches);
+
+ // set up the tooltips for branches form
+ str = _("Enter the name of a new branch.");
+ tooltips().init(branch_->input_all_branches, str);
+ str = _("Add a new branch to the document.");
+ tooltips().init(branch_->button_add_branch, str);
+ str = _("Remove the selected branch from the document.");
+ tooltips().init(branch_->button_remove_branch, str);
+ str = _("Activate the selected branch for output.");
+ tooltips().init(branch_->button_select, str);
+ str = _("Deactivate the selected activated branch.");
+ tooltips().init(branch_->button_deselect, str);
+ str = _("Available branches for this document.");
+ tooltips().init(branch_->browser_all_branches, str);
+ str = _("Activated branches. Content will occur in the document\'s output");
+ tooltips().init(branch_->browser_selection, str);
+ str = _("Modify background color of branch inset");
+ tooltips().init(branch_->button_modify, str);
+ str = _("Background color of branch inset");
+ tooltips().init(branch_->button_color, str);
+
+ // Handle middle mouse paint:
+ setPrehandler(branch_->input_all_branches);
+ fl_set_input_return(branch_->input_all_branches, FL_RETURN_CHANGED);
+
+ // Enable the tabfolder to be rescaled correctly.
+ if (scalableTabfolders)
+ fl_set_tabfolder_autofit(dialog_->tabfolder, FL_FIT);
+
+ // Stack tabs
+ fl_addto_tabfolder(dialog_->tabfolder,_("Document").c_str(),
class_->form);
- fl_addto_tabfolder(dialog_->tabfolder,_("Paper"),
+ fl_addto_tabfolder(dialog_->tabfolder,_("Paper").c_str(),
paper_->form);
- fl_addto_tabfolder(dialog_->tabfolder,_("Language"),
+ fl_addto_tabfolder(dialog_->tabfolder,_("Language").c_str(),
language_->form);
- fl_addto_tabfolder(dialog_->tabfolder,_("Extra"),
+ fl_addto_tabfolder(dialog_->tabfolder,_("Extra").c_str(),
options_->form);
- fbullet = fl_addto_tabfolder(dialog_->tabfolder,_("Bullets"),
+ fbullet = fl_addto_tabfolder(dialog_->tabfolder,_("Bullets").c_str(),
bullets_->form);
- // work-around xforms bug re update of folder->x, folder->y coords.
- setPrehandler(dialog_->tabfolder);
-
if ((XpmVersion < 4) || (XpmVersion == 4 && XpmRevision < 7)) {
lyxerr << _("Your version of libXpm is older than 4.7.\n"
"The `bullet' tab of the document dialog "
fl_deactivate_object(fbullet);
fl_set_object_lcol(fbullet, FL_INACTIVE);
}
+
+ fl_addto_tabfolder(dialog_->tabfolder,_("Branches").c_str(),
+ branch_->form);
}
language_apply(params);
options_apply(params);
bullets_apply(params);
+ branch_apply(params);
}
language_update(params);
options_update(params);
bullets_update(params);
+ branch_update(params);
}
// Default unit choice is cm if metric, inches if US paper.
// If papersize is default, check the lyxrc-settings
int const paperchoice = fl_get_choice(paper_->choice_papersize);
- bool const metric = (paperchoice == 1 && lyxrc.default_papersize > BufferParams::PAPER_EXECUTIVEPAPER)
+ bool const metric = (paperchoice == 1 && lyxrc.default_papersize > PAPER_EXECUTIVEPAPER)
|| paperchoice == 2 || paperchoice > 5;
string const default_unit = metric ? "cm" : "in";
if (getString(class_->input_skip).empty())
} else if (ob == options_->check_use_natbib) {
setEnabled(options_->choice_citation_format,
fl_get_button(options_->check_use_natbib));
+ if (fl_get_button(options_->check_use_natbib))
+ fl_set_button(options_->check_use_jurabib, 0);
+
+ } else if (ob == options_->check_use_jurabib) {
+ if (fl_get_button(options_->check_use_jurabib))
+ fl_set_button(options_->check_use_natbib, 0);
+ setEnabled(options_->choice_citation_format,
+ fl_get_button(options_->check_use_natbib));
+ } else if (ob == branch_->browser_all_branches ||
+ ob == branch_->browser_selection ||
+ ob == branch_->button_add_branch ||
+ ob == branch_->button_remove_branch ||
+ ob == branch_->button_modify ||
+ ob == branch_->button_select ||
+ ob == branch_->button_deselect) {
+ branch_input(ob);
} else if (ob == dialog_->button_save_defaults) {
apply();
controller().saveAsDefault();
} else if (ob == paper_->radio_landscape) {
fl_set_choice(paper_->choice_paperpackage,
- BufferParams::PACKAGE_NONE + 1);
+ PACKAGE_NONE + 1);
} else if (ob == paper_->choice_papersize) {
int const paperchoice = fl_get_choice(paper_->choice_papersize);
// Default unit choice is cm if metric, inches if US paper.
// If papersize is default, use the lyxrc-settings
- bool const metric = (defsize && lyxrc.default_papersize > BufferParams::PAPER_EXECUTIVEPAPER)
+ bool const metric = (defsize && lyxrc.default_papersize > PAPER_EXECUTIVEPAPER)
|| paperchoice == 2 || paperchoice > 5;
string const default_unit = metric ? "cm" : "in";
if (getString(paper_->input_custom_width).empty())
fl_set_button(paper_->check_use_geometry, 1);
fl_set_choice(paper_->choice_paperpackage,
- BufferParams::PACKAGE_NONE + 1);
+ PACKAGE_NONE + 1);
bool const use_geom = fl_get_button(paper_->check_use_geometry);
setEnabled(paper_->input_top_margin, use_geom);
// either default papersize (preferences) or document
// papersize has to be A4
bool const enable = ( fl_get_choice(paper_->choice_papersize) == 1
- && lyxrc.default_papersize == BufferParams::PAPER_A4PAPER )
+ && lyxrc.default_papersize == PAPER_A4PAPER )
|| fl_get_choice(paper_->choice_papersize) == 7;
if (!enable)
fl_set_choice(paper_->choice_paperpackage,
- BufferParams::PACKAGE_NONE + 1);
+ PACKAGE_NONE + 1);
setEnabled(paper_->choice_paperpackage,
enable && fl_get_button(paper_->radio_portrait));
}
}
+void FormDocument::rebuild_all_branches_browser()
+{
+ typedef BranchList::const_iterator const_iterator;
+
+ fl_clear_browser(branch_->browser_all_branches);
+
+ const_iterator const begin = branchlist_.begin();
+ const_iterator const end = branchlist_.end();
+ for (const_iterator it = begin; it != end; ++it) {
+ fl_addto_browser(branch_->browser_all_branches,
+ it->getBranch().c_str());
+ }
+}
+
+
+void FormDocument::rebuild_selected_branches_browser()
+{
+ typedef BranchList::const_iterator const_iterator;
+
+ fl_clear_browser(branch_->browser_selection);
+
+ const_iterator const begin = branchlist_.begin();
+ const_iterator const end = branchlist_.end();
+ for (const_iterator it = begin; it != end; ++it) {
+ if (it->getSelected())
+ fl_addto_browser(branch_->browser_selection,
+ it->getBranch().c_str());
+ }
+}
+
+
+namespace {
+
+RGBColor get_current_color(FL_OBJECT * browser, BranchList const & branchlist)
+{
+ BOOST_ASSERT(browser && browser->objclass == FL_BROWSER);
+
+ RGBColor color;
+
+ int const i = fl_get_browser(browser);
+ string const branch_name = fl_get_browser_line(browser, i);
+ Branch const * branch = branchlist.find(branch_name);
+ if (!branch)
+ return color;
+
+ string const x11hexname = branch->getColor();
+ if (x11hexname[0] == '#') {
+ color = RGBColor(x11hexname);
+ } else{
+ fl_getmcolor(FL_COL1, &color.r, &color.g, &color.b);
+ }
+ return color;
+}
+
+} // namespace anon
+
+
+void FormDocument::branch_input(FL_OBJECT * ob)
+{
+ if (ob == branch_->button_add_branch) {
+ string const new_branch =
+ getString(branch_->input_all_branches);
+
+ if (!new_branch.empty() && branchlist_.add(new_branch)) {
+
+ fl_set_input(branch_->input_all_branches, "");
+ rebuild_all_branches_browser();
+ }
+
+ } else if (ob == branch_->button_remove_branch) {
+ unsigned i = fl_get_browser(branch_->browser_all_branches);
+ string const current_branch =
+ fl_get_browser_line(branch_->browser_all_branches, i);
+ if (!current_branch.empty() &&
+ branchlist_.remove(current_branch)) {
+
+ rebuild_all_branches_browser();
+ rebuild_selected_branches_browser();
+ }
+
+ } else if (ob == branch_->button_select ||
+ ob == branch_->button_deselect) {
+
+ bool const selecting = ob == branch_->button_select;
+ string current_branch;
+
+ // When selecting, take highlighted item from left browser,
+ // when deselecting, from right browser:
+ if (selecting) {
+ int const i = fl_get_browser(branch_->browser_all_branches);
+ current_branch =
+ fl_get_browser_line(branch_->browser_all_branches, i);
+ } else {
+ int const i = fl_get_browser(branch_->browser_selection);
+ current_branch =
+ fl_get_browser_line(branch_->browser_selection, i);
+ }
+ Branch * branch = branchlist_.find(current_branch);
+
+ if (branch && branch->setSelected(selecting))
+ rebuild_selected_branches_browser();
+
+ } else if (ob == branch_->button_modify) {
+ RGBColor const before =
+ get_current_color(branch_->browser_all_branches,
+ branchlist_);
+ RGBColor const after = picker_->requestColor(before);
+ if (before != after) {
+ fl_mapcolor(GUI_COLOR_CHOICE,
+ after.r, after.g, after.b);
+ fl_redraw_object(branch_->button_color);
+
+ string const branch_name =
+ getString(branch_->browser_all_branches);
+ Branch * branch = branchlist_.find(branch_name);
+ if (branch)
+ branch->setColor(X11hexname(after));
+ }
+
+ } else if (ob == branch_->browser_all_branches) {
+ RGBColor rgb =
+ get_current_color(branch_->browser_all_branches,
+ branchlist_);
+
+ fl_mapcolor(GUI_COLOR_CHOICE, rgb.r, rgb.g, rgb.b);
+ fl_redraw_object(branch_->button_color);
+ }
+ setEnabled(branch_->button_select,
+ (fl_get_browser(branch_->browser_all_branches) > 0));
+ setEnabled(branch_->button_deselect,
+ (fl_get_browser(branch_->browser_selection) > 0));
+ setEnabled(branch_->button_remove_branch,
+ (fl_get_browser(branch_->browser_all_branches) > 0));
+ setEnabled(branch_->button_modify,
+ (fl_get_browser(branch_->browser_all_branches) > 0));
+}
+
+
bool FormDocument::class_apply(BufferParams ¶ms)
{
bool redo = false;
else
params.sides = LyXTextClass::OneSide;
- Spacing tmpSpacing = params.spacing;
+ Spacing tmpSpacing = params.spacing();
switch (fl_get_choice(class_->choice_spacing)) {
case 1:
- lyxerr[Debug::INFO] << "Spacing: SINGLE\n";
- params.spacing.set(Spacing::Single);
+ lyxerr[Debug::INFO] << "Spacing: SINGLE" << endl;
+ params.spacing().set(Spacing::Single);
break;
case 2:
- lyxerr[Debug::INFO] << "Spacing: ONEHALF\n";
- params.spacing.set(Spacing::Onehalf);
+ lyxerr[Debug::INFO] << "Spacing: ONEHALF" << endl;
+ params.spacing().set(Spacing::Onehalf);
break;
case 3:
- lyxerr[Debug::INFO] << "Spacing: DOUBLE\n";
- params.spacing.set(Spacing::Double);
+ lyxerr[Debug::INFO] << "Spacing: DOUBLE" << endl;
+ params.spacing().set(Spacing::Double);
break;
case 4:
- lyxerr[Debug::INFO] << "Spacing: OTHER\n";
- params.spacing.set(Spacing::Other,
+ lyxerr[Debug::INFO] << "Spacing: OTHER" << endl;
+ params.spacing().set(Spacing::Other,
getString(class_->input_spacing));
break;
}
- if (tmpSpacing != params.spacing)
+ if (tmpSpacing != params.spacing())
redo = true;
params.options = getString(class_->input_extra);
void FormDocument::paper_apply(BufferParams & params)
{
- params.papersize2 = char(fl_get_choice(paper_->choice_papersize) - 1);
+ params.papersize2 = VMARGIN_PAPER_TYPE(fl_get_choice(paper_->choice_papersize) - 1);
params.paperpackage =
- char(fl_get_choice(paper_->choice_paperpackage) - 1);
+ PAPER_PACKAGES(fl_get_choice(paper_->choice_paperpackage) - 1);
// set params.papersize from params.papersize2 and params.paperpackage
params.setPaperStuff();
params.use_geometry = fl_get_button(paper_->check_use_geometry);
if (fl_get_button(paper_->radio_landscape))
- params.orientation = BufferParams::ORIENTATION_LANDSCAPE;
+ params.orientation = ORIENTATION_LANDSCAPE;
else
- params.orientation = BufferParams::ORIENTATION_PORTRAIT;
+ params.orientation = ORIENTATION_PORTRAIT;
params.paperwidth =
getLengthFromWidgets(paper_->input_custom_width,
break;
}
params.quotes_language = lga;
- if (fl_get_button(language_->radio_single))
- params.quotes_times = InsetQuotes::SingleQ;
- else
- params.quotes_times = InsetQuotes::DoubleQ;
int const pos = fl_get_combox(language_->combox_language);
Language const * new_language = languages.getLanguage(lang_[pos-1]);
params.use_natbib = fl_get_button(options_->check_use_natbib);
params.use_numerical_citations =
fl_get_choice(options_->choice_citation_format) - 1;
+ params.use_jurabib = fl_get_button(options_->check_use_jurabib);
int tmpchar = int(fl_get_counter_value(options_->counter_secnumdepth));
if (params.secnumdepth != tmpchar)
BufferParams & buf_params = controller().params();
for (int i = 0; i < 4; ++i) {
- params.user_defined_bullets[i] = buf_params.temp_bullets[i];
+ params.user_defined_bullet(i) = buf_params.temp_bullet(i);
}
}
+void FormDocument::branch_apply(BufferParams & params)
+{
+ params.branchlist() = branchlist_;
+}
+
+
void FormDocument::UpdateClassParams(BufferParams const & params)
{
// These are the params that have to be updated on any class change
fl_set_choice_text(class_->choice_pagestyle,
params.pagestyle.c_str());
+ fl_set_input(class_->input_extra, tclass.options().c_str());
}
void FormDocument::class_update(BufferParams const & params)
bool const length_input = pos == 4;
if (length_input) {
int const paperchoice = fl_get_choice(paper_->choice_papersize);
- bool const metric = (paperchoice == 1 && lyxrc.default_papersize > BufferParams::PAPER_EXECUTIVEPAPER)
+ bool const metric = (paperchoice == 1 && lyxrc.default_papersize > PAPER_EXECUTIVEPAPER)
|| paperchoice == 2 || paperchoice > 5;
string const default_unit = metric ? "cm" : "in";
string const length = params.getDefSkip().asLyXCommand();
fl_set_input(class_->input_extra, params.options.c_str());
- switch (params.spacing.getSpace()) {
+ switch (params.spacing().getSpace()) {
case Spacing::Other:
pos = 4;
break;
bool const spacing_input = pos == 4;
setEnabled(class_->input_spacing, spacing_input);
- string const input = spacing_input ? tostr(params.spacing.getValue()) : string();
+ string const input = spacing_input ? tostr(params.spacing().getValue()) : string();
fl_set_input(class_->input_spacing, input.c_str());
}
fl_set_choice_text(language_->choice_inputenc, params.inputenc.c_str());
fl_set_choice(language_->choice_quotes_language, params.quotes_language + 1);
- fl_set_button(language_->radio_single, 0);
- fl_set_button(language_->radio_double, 0);
- if (params.quotes_times == InsetQuotes::SingleQ)
- fl_set_button(language_->radio_single, 1);
- else
- fl_set_button(language_->radio_double, 1);
}
fl_set_choice(options_->choice_citation_format,
int(params.use_numerical_citations)+1);
setEnabled(options_->choice_citation_format, params.use_natbib);
+ fl_set_button(options_->check_use_jurabib, params.use_jurabib);
fl_set_counter_value(options_->counter_secnumdepth, params.secnumdepth);
fl_set_counter_value(options_->counter_tocdepth, params.tocdepth);
if (!params.float_placement.empty())
fl_set_button(paper_->radio_landscape, 0);
setEnabled(paper_->radio_landscape, !useCustom);
- if (params.orientation == BufferParams::ORIENTATION_LANDSCAPE)
+ if (params.orientation == ORIENTATION_LANDSCAPE)
fl_set_button(paper_->radio_landscape, 1);
else
fl_set_button(paper_->radio_portrait, 1);
//either default papersize (preferences)
//or document papersize has to be A4
(paperchoice == 7
- || paperchoice == 1 && lyxrc.default_papersize == BufferParams::PAPER_A4PAPER)
+ || paperchoice == 1 && lyxrc.default_papersize == PAPER_A4PAPER)
&& fl_get_button(paper_->radio_portrait));
// Default unit choice is cm if metric, inches if US paper.
- bool const metric = (paperchoice == 1 && lyxrc.default_papersize > BufferParams::PAPER_EXECUTIVEPAPER)
+ bool const metric = (paperchoice == 1 && lyxrc.default_papersize > PAPER_EXECUTIVEPAPER)
|| paperchoice == 2 || paperchoice > 5;
string const default_unit = metric ? "cm" : "in";
updateWidgetsFromLengthString(paper_->input_custom_width,
fl_set_button(bullets_->radio_depth_1, 1);
fl_set_input(bullets_->input_latex,
- params.user_defined_bullets[0].getText().c_str());
+ params.user_defined_bullet(0).getText().c_str());
fl_set_choice(bullets_->choice_size,
- params.user_defined_bullets[0].getSize() + 2);
+ params.user_defined_bullet(0).getSize() + 2);
+}
+
+
+void FormDocument::branch_update(BufferParams const & params)
+{
+ if (!branch_.get())
+ return;
+
+ branchlist_ = params.branchlist();
+
+ rebuild_all_branches_browser();
+ string const current_branch =
+ fl_get_browser_maxline(branch_->browser_all_branches) == 0 ?
+ "none" :
+ fl_get_browser_line(branch_->browser_all_branches, 1);
+
+ // display proper selection...
+ rebuild_selected_branches_browser();
+
+ // display proper colour...
+ RGBColor rgb;
+ string x11hexname;
+ if (current_branch == "none")
+ x11hexname = "none";
+ else {
+ Branch * branch = branchlist_.find(current_branch);
+ if (branch)
+ x11hexname = branch->getColor();
+ }
+
+ if (x11hexname[0] == '#') {
+ rgb = RGBColor(x11hexname);
+ } else {
+ fl_getmcolor(FL_COL1, &rgb.r, &rgb.g, &rgb.b);
+ }
+ fl_mapcolor(GUI_COLOR_CHOICE, rgb.r, rgb.g, rgb.b);
+ fl_redraw_object(branch_->button_color);
+
+ setEnabled(branch_->button_select,
+ (fl_get_browser(branch_->browser_all_branches) > 0));
+ setEnabled(branch_->button_deselect,
+ (fl_get_browser(branch_->browser_selection) > 0));
+ setEnabled(branch_->button_remove_branch,
+ (fl_get_browser(branch_->browser_all_branches) > 0));
+ setEnabled(branch_->button_modify,
+ (fl_get_browser(branch_->browser_all_branches) > 0));
}
BufferParams & param = controller().params();
// convert from 1-6 range to -1-4
- param.temp_bullets[current_bullet_depth].setSize(fl_get_choice(ob) - 2);
+ param.temp_bullet(current_bullet_depth).setSize(fl_get_choice(ob) - 2);
fl_set_input(bullets_->input_latex,
- param.temp_bullets[current_bullet_depth].getText().c_str());
+ param.temp_bullet(current_bullet_depth).getText().c_str());
}
{
BufferParams & param = controller().params();
- param.temp_bullets[current_bullet_depth].
+ param.temp_bullet(current_bullet_depth).
setText(getString(bullets_->input_latex));
}
switch (fl_get_button_numb(ob)) {
case 3:
// right mouse button resets to default
- param.temp_bullets[data] = ITEMIZE_DEFAULTS[data];
+ param.temp_bullet(data) = ITEMIZE_DEFAULTS[data];
default:
current_bullet_depth = data;
fl_set_input(bullets_->input_latex,
- param.temp_bullets[data].getText().c_str());
+ param.temp_bullet(data).getText().c_str());
fl_set_choice(bullets_->choice_size,
- param.temp_bullets[data].getSize() + 2);
+ param.temp_bullet(data).getSize() + 2);
}
}
/* try to keep the button held down till another is pushed */
/* fl_set_bmtable(ob, 1, bmtable_button); */
- param.temp_bullets[current_bullet_depth].setFont(current_bullet_panel);
- param.temp_bullets[current_bullet_depth].setCharacter(bmtable_button);
+ param.temp_bullet(current_bullet_depth).setFont(current_bullet_panel);
+ param.temp_bullet(current_bullet_depth).setCharacter(bmtable_button);
fl_set_input(bullets_->input_latex,
- param.temp_bullets[current_bullet_depth].getText().c_str());
+ param.temp_bullet(current_bullet_depth).getText().c_str());
}