]> git.lyx.org Git - features.git/blobdiff - src/frontends/xforms/FormDocument.C
Overhaul the branches code.
[features.git] / src / frontends / xforms / FormDocument.C
index 576e7672a178ad9c768f624598af438b4e4453e4..54d64115057cf9a2d95176244913c265d90b3299 100644 (file)
@@ -5,46 +5,57 @@
  *
  * \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 "controllers/frnt_lang.h"
-#include "controllers/helper_funcs.h"
+#include "vspace.h"
 
 #include "support/tostr.h"
 #include "support/lstrings.h" // contains_functor, getStringFromVector
 #include "support/filetools.h" // LibFileSearch
 
 #include "lyx_xpm.h"
-#include "lyx_forms.h"
-#include "combox.h"
 
-#include <boost/bind.hpp>
+#include <iomanip>
 
-#include <functional>
+using lyx::support::bformat;
+using lyx::support::contains_functor;
+using lyx::support::getStringFromVector;
+using lyx::support::getVectorFromString;
+using lyx::support::LibFileSearch;
 
 using std::bind2nd;
+using std::endl;
+using std::string;
 using std::vector;
 
 
@@ -56,6 +67,7 @@ bool const scalableTabfolders = false;
 bool const scalableTabfolders = true;
 #endif
 
+
 } // namespace anon
 
 
@@ -276,7 +288,7 @@ void FormDocument::build()
 
        fl_addto_choice(language_->choice_quotes_language,
                        _(" ``text'' | ''text'' | ,,text`` | ,,text'' |"
-                         " «text» | »text« ").c_str());
+                         " <<text>> | >>text<< ").c_str());
 
        // the document options form
        options_.reset(build_document_options(this));
@@ -296,7 +308,7 @@ void FormDocument::build()
        fl_set_input_return(options_->input_float_placement, FL_RETURN_CHANGED);
 
        fl_addto_choice(options_->choice_ams_math,
-                       _("Never | Automatically | Yes ").c_str());
+                       _(" Never | Automatically | Yes ").c_str());
 
        for (int n = 0; tex_graphics[n][0]; ++n) {
                fl_addto_choice(options_->choice_postscript_driver,
@@ -340,6 +352,46 @@ void FormDocument::build()
        fl_set_bmtable_pixmap_file(bullets_->bmtable_panel, 6, 6,
                                   bmtablefile.c_str());
 
+       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
+       string 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);
@@ -363,6 +415,9 @@ void FormDocument::build()
                fl_deactivate_object(fbullet);
                fl_set_object_lcol(fbullet, FL_INACTIVE);
        }
+
+       fl_addto_tabfolder(dialog_->tabfolder,_("Branches").c_str(),
+                                    branch_->form);
 }
 
 
@@ -375,6 +430,7 @@ void FormDocument::apply()
        language_apply(params);
        options_apply(params);
        bullets_apply(params);
+       branch_apply(params);
 }
 
 
@@ -392,6 +448,7 @@ void FormDocument::update()
        language_update(params);
        options_update(params);
        bullets_update(params);
+       branch_update(params);
 }
 
 
@@ -442,7 +499,7 @@ ButtonPolicy::SMInput FormDocument::input(FL_OBJECT * ob, long)
                // 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())
@@ -453,6 +510,15 @@ ButtonPolicy::SMInput FormDocument::input(FL_OBJECT * ob, long)
                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 ||
+                       ob == branch_->button_deselect) {
+               branch_input(ob);
        } else if (ob == dialog_->button_save_defaults) {
                apply();
                controller().saveAsDefault();
@@ -465,7 +531,7 @@ ButtonPolicy::SMInput FormDocument::input(FL_OBJECT * ob, long)
 
        } 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);
@@ -508,7 +574,7 @@ ButtonPolicy::SMInput FormDocument::input(FL_OBJECT * ob, long)
 
                // 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())
@@ -566,7 +632,7 @@ ButtonPolicy::SMInput FormDocument::input(FL_OBJECT * ob, long)
                        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);
@@ -590,11 +656,11 @@ ButtonPolicy::SMInput FormDocument::input(FL_OBJECT * ob, long)
                // 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));
        }
@@ -603,6 +669,136 @@ ButtonPolicy::SMInput FormDocument::input(FL_OBJECT * ob, long)
 }
 
 
+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 selected = ob == branch_->button_select;
+
+               int const i = fl_get_browser(branch_->browser_all_branches);
+               string const current_branch =
+                       fl_get_browser_line(branch_->browser_all_branches, i);
+
+               Branch * branch = branchlist_.find(current_branch);
+               
+               if (branch && branch->setSelected(selected))
+                       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 &params)
 {
        bool redo = false;
@@ -664,27 +860,27 @@ bool FormDocument::class_apply(BufferParams &params)
        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);
@@ -695,10 +891,10 @@ bool FormDocument::class_apply(BufferParams &params)
 
 void FormDocument::paper_apply(BufferParams & params)
 {
-       params.papersize2 = BufferParams::VMARGIN_PAPER_TYPE(fl_get_choice(paper_->choice_papersize) - 1);
+       params.papersize2 = VMARGIN_PAPER_TYPE(fl_get_choice(paper_->choice_papersize) - 1);
 
        params.paperpackage =
-               BufferParams::PAPER_PACKAGES(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();
@@ -706,9 +902,9 @@ void FormDocument::paper_apply(BufferParams & params)
        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,
@@ -822,11 +1018,17 @@ void FormDocument::bullets_apply(BufferParams & params)
        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
@@ -848,6 +1050,7 @@ void FormDocument::UpdateClassParams(BufferParams const & params)
        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)
@@ -888,7 +1091,7 @@ 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();
@@ -913,7 +1116,7 @@ void FormDocument::class_update(BufferParams const & params)
 
        fl_set_input(class_->input_extra, params.options.c_str());
 
-       switch (params.spacing.getSpace()) {
+       switch (params.spacing().getSpace()) {
        case Spacing::Other:
                pos = 4;
                break;
@@ -933,7 +1136,7 @@ void FormDocument::class_update(BufferParams const & params)
 
        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());
 }
 
@@ -997,7 +1200,7 @@ void FormDocument::paper_update(BufferParams const & params)
        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);
@@ -1005,11 +1208,11 @@ void FormDocument::paper_update(BufferParams const & params)
                   //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,
@@ -1085,9 +1288,55 @@ void FormDocument::bullets_update(BufferParams const & params)
 
        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));
 }
 
 
@@ -1107,9 +1356,9 @@ void FormDocument::ChoiceBulletSize(FL_OBJECT * ob, long /*data*/)
        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());
 }
 
 
@@ -1117,7 +1366,7 @@ void FormDocument::InputBulletLaTeX(FL_OBJECT *, long)
 {
        BufferParams & param = controller().params();
 
-       param.temp_bullets[current_bullet_depth].
+       param.temp_bullet(current_bullet_depth).
                setText(getString(bullets_->input_latex));
 }
 
@@ -1147,13 +1396,13 @@ void FormDocument::BulletDepth(FL_OBJECT * ob)
        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);
        }
 }
 
@@ -1222,10 +1471,10 @@ void FormDocument::BulletBMTable(FL_OBJECT * ob, long /*data*/)
 
        /* 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());
 }