]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/xforms/Toolbar_pimpl.C
remove defaults stuff, let Qt handle no toolbar
[lyx.git] / src / frontends / xforms / Toolbar_pimpl.C
index 9a051dd33a27942959ef902c6ea322d2190d36ea..021f56e7a7a7a9dbc75d0de8c63eeb52e8a2cffa 100644 (file)
@@ -1,58 +1,65 @@
-/* This file is part of
- * ====================================================== 
- * 
- *           LyX, The Document Processor
+/**
+ * \file xforms/Toolbar_pimpl.C
+ * Copyright 1995 Matthias Ettrich
+ * Copyright 1996-1998 Lars Gullik Bjønnes
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
  *
- *           Copyright 1995 Matthias Ettrich
- *           Copyright 1995-2001 The LyX Team.
+ * \author Lars Gullik Bjønnes
  *
- *           This file is Copyright 1996-1998
- *           Lars Gullik Bjønnes
- *
- * ====================================================== */
+ * Full author contact details are available in file CREDITS
+ */
 
 //  Added pseudo-action handling, asierra 180296
 
 #include <config.h>
 
-#ifdef __GNUG__
-#pragma implementation
-#endif
 
 #include "Toolbar_pimpl.h"
 #include "debug.h"
-#include "LyXView.h"
+#include "XFormsView.h"
 #include "lyxfunc.h"
-#include "BufferView.h"
+#include "FuncStatus.h"
 #include "buffer.h"
+#include "funcrequest.h"
+#include "gettext.h"
+#include "Tooltips.h"
+#include FORMS_H_LOCATION
+#include "combox.h"
+#include "ToolbarBackend.h"
+#include "xforms_helpers.h"
+
 #include "LyXAction.h"
-#include "MathsSymbols.h" 
+
+#include "support/LAssert.h"
 #include "support/filetools.h"
-#include "support/lstrings.h" 
-#include "gettext.h"
+#include "support/lstrings.h"
 
 using std::endl;
 
-extern LyXAction lyxaction;
-
 // some constants
 const int standardspacing = 2; // the usual space between items
 const int sepspace = 6; // extra space
 const int buttonwidth = 30; // the standard button width
 const int height = 30; // the height of all items in the toolbar
 
-Toolbar::Pimpl::toolbarItem::toolbarItem() {
-       action = LFUN_NOACTION;
-       icon = 0;
-}
+Toolbar::Pimpl::toolbarItem::toolbarItem()
+       : action(LFUN_NOACTION), icon(0)
+{}
 
 
-Toolbar::Pimpl::toolbarItem::~toolbarItem() {
-       clean();
+Toolbar::Pimpl::toolbarItem::~toolbarItem()
+{
+       // Lars said here that ~XFormsView() dealt with the icons.
+       // This is not true. But enabling this causes crashes,
+       // because somehow we kill the same icon twice :(
+       // FIXME
+       //kill_icon();
 }
 
 
-void Toolbar::Pimpl::toolbarItem::clean() {
+void Toolbar::Pimpl::toolbarItem::kill_icon()
+{
        if (icon) {
                fl_delete_object(icon);
                fl_free_object(icon);
@@ -61,205 +68,179 @@ void Toolbar::Pimpl::toolbarItem::clean() {
 }
 
 
-Toolbar::Pimpl::toolbarItem & 
-Toolbar::Pimpl::toolbarItem::operator=(toolbarItem const & ti) {
-       // Are we assigning the object onto itself?
+Toolbar::Pimpl::toolbarItem &
+Toolbar::Pimpl::toolbarItem::operator=(toolbarItem const & ti)
+{
        if (this == &ti)
                return *this;
 
        // If we already have an icon, release it.
-       clean();
-    
-       // do we have to check icon too?
+       // But we don't copy the icon from ti
+       kill_icon();
+
        action = ti.action;
-       icon = 0; // locally we need to get the icon anew
-       
+
        return *this;
 }
 
 
 
 Toolbar::Pimpl::Pimpl(LyXView * o, int x, int y)
-       : owner(o), sxpos(x), sypos(y)
+       : owner_(static_cast<XFormsView *>(o)), combox_(0), xpos(x), ypos(y)
 {
-       combox = 0;
-#if FL_REVISION < 89
-       bubble_timer = 0;
-#endif
+       tooltip_ = new Tooltips();
 }
 
 
-namespace {
-
-#if FL_REVISION < 89
-// timer-cb for bubble-help (Matthias)
-void BubbleTimerCB(FL_OBJECT *, long data)
+Toolbar::Pimpl::~Pimpl()
 {
-       FL_OBJECT * ob = reinterpret_cast<FL_OBJECT*>(data);
-       // The trick we use to get the help text is to read the
-       // argument of the callback that has been registered for
-       // ToolBarCB.  (JMarc)
-       string help = _(lyxaction.helpText(ob->argument));
-       fl_show_oneliner(help.c_str(), ob->form->x + ob->x,
-                        ob->form->y + ob->y + ob->h);
-}
+       fl_freeze_form(owner_->getForm());
 
+       // G++ vector does not have clear defined
+       //toollist.clear();
+       toollist_.erase(toollist_.begin(), toollist_.end());
 
-extern "C" void C_Toolbar_BubbleTimerCB(FL_OBJECT * ob, long data)
-{
-       BubbleTimerCB(ob, data);
+       fl_unfreeze_form(owner_->getForm());
+       delete tooltip_;
 }
 
 
-// post_handler for bubble-help (Matthias)
-int BubblePost(FL_OBJECT *ob, int event,
-                       FL_Coord /*mx*/, FL_Coord /*my*/,
-                       int /*key*/, void * /*xev*/)
+void Toolbar::Pimpl::update()
 {
-       FL_OBJECT * bubble_timer = reinterpret_cast<FL_OBJECT *>(ob->u_cdata);
-       
-       // We do not test for empty help here, since this can never happen
-       if (event == FL_ENTER){
-               fl_set_object_callback(bubble_timer,
-                                      C_Toolbar_BubbleTimerCB,
-                                      reinterpret_cast<long>(ob));
-               fl_set_timer(bubble_timer, 1);
-       }
-       else if (event != FL_MOTION){
-               fl_set_timer(bubble_timer, 0);
-               fl_hide_oneliner();
+       ToolbarList::const_iterator p = toollist_.begin();
+       ToolbarList::const_iterator end = toollist_.end();
+       for (; p != end; ++p) {
+               if (p->action == ToolbarBackend::LAYOUTS && combox_) {
+                       LyXFunc const & lf = owner_->getLyXFunc();
+                       bool const disable =
+                               lf.getStatus(LFUN_LAYOUT).disabled();
+                       setEnabled(combox_, !disable);
+                       continue;
+               }
+
+               if (!p->icon)
+                       continue;
+
+               FuncStatus const status = owner_->getLyXFunc().getStatus(p->action);
+               if (status.onoff(true)) {
+                       // I'd like to use a different color
+                       // here, but then the problem is to
+                       // know how to use transparency with
+                       // Xpm library. It seems pretty
+                       // complicated to me (JMarc)
+                       fl_set_object_color(p->icon, FL_LEFT_BCOL, FL_BLUE);
+                       fl_set_object_boxtype(p->icon, FL_DOWN_BOX);
+               } else {
+                       fl_set_object_color(p->icon, FL_MCOL, FL_BLUE);
+                       fl_set_object_boxtype(p->icon, FL_UP_BOX);
+               }
+               if (status.disabled()) {
+                       // Is there a way here to specify a
+                       // mask in order to show that the
+                       // button is disabled? (JMarc)
+                       fl_deactivate_object(p->icon);
+               }
+               else
+                       fl_activate_object(p->icon);
        }
-       return 0;
 }
 
 
-extern "C" int C_Toolbar_BubblePost(FL_OBJECT * ob, int event,
-                                   FL_Coord /*mx*/, FL_Coord /*my*/, 
-                                   int key, void * xev)
+namespace {
+
+void C_layoutSelectedCB(FL_OBJECT * ob, long)
 {
-       return BubblePost(ob, event, 0, 0, key, xev);
+       if (!ob || !ob->u_vdata)
+               return;
+       Toolbar::Pimpl * ptr = static_cast<Toolbar::Pimpl *>(ob->u_vdata);
+       ptr->layoutSelected();
 }
-#endif
 
 } // namespace anon
 
 
-// this one is not "C" because combox callbacks are really C++ %-|
-void Toolbar::Pimpl::layoutSelectedCB(int sel, void * arg, Combox *)
+void Toolbar::Pimpl::layoutSelected()
 {
-       Toolbar::Pimpl * tb = reinterpret_cast<Toolbar::Pimpl *>(arg);
-
-       tb->layoutSelected(sel);
-}
-
+       if (!combox_)
+               return;
 
-void Toolbar::Pimpl::layoutSelected(int sel)
-{
-       string const tmp = tostr(sel);
-       owner->getLyXFunc()->Dispatch(LFUN_LAYOUTNO, tmp);
-}
+       string const & layoutguiname = getString(combox_);
+       LyXTextClass const & tc =
+               owner_->buffer()->params.getLyXTextClass();
 
-void Toolbar::Pimpl::activate()
-{
-       ToolbarList::const_iterator p = toollist.begin();
-       ToolbarList::const_iterator end = toollist.end();
-       for (; p != end; ++p) {
-               if (p->icon) {
-                       fl_activate_object(p->icon);
+       LyXTextClass::const_iterator end = tc.end();
+       for (LyXTextClass::const_iterator cit = tc.begin();
+            cit != end; ++cit) {
+               if (_((*cit)->name()) == layoutguiname) {
+                       owner_->getLyXFunc().dispatch(FuncRequest(LFUN_LAYOUT, (*cit)->name()), true);
+                       return;
                }
        }
+       lyxerr << "ERROR (Toolbar::Pimpl::layoutSelected): layout not found!"
+              << endl;
 }
 
 
-void Toolbar::Pimpl::deactivate()
+void Toolbar::Pimpl::setLayout(string const & layout)
 {
-       ToolbarList::const_iterator p = toollist.begin();
-       ToolbarList::const_iterator end = toollist.end();
-       for (; p != end; ++p) {
-               if (p->icon) {
-                       fl_deactivate_object(p->icon);
-               }
-       }
-}
+       if (!combox_)
+               return;
 
-void Toolbar::Pimpl::update()
-{
-       ToolbarList::const_iterator p = toollist.begin();
-       ToolbarList::const_iterator end = toollist.end();
-       for (; p != end; ++p) {
-               if (p->icon) {
-                       int status = owner->getLyXFunc()->getStatus(p->action);
-                       if (status & LyXFunc::ToggleOn) {
-                               // I'd like to use a different color
-                               // here, but then the problem is to
-                               // know how to use transparency with
-                               // Xpm library. It seems pretty
-                               // complicated to me (JMarc)
-                               fl_set_object_color(p->icon, FL_LEFT_BCOL, FL_BLUE);
-                               fl_set_object_boxtype(p->icon, FL_DOWN_BOX);
-                       } else {
-                               fl_set_object_color(p->icon, FL_MCOL, FL_BLUE);
-                               fl_set_object_boxtype(p->icon, FL_UP_BOX);
-                       }
+       LyXTextClass const & tc = owner_->buffer()->params.getLyXTextClass();
+       string const layoutname = _(tc[layout]->name());
 
-                       if (status & LyXFunc::Disabled) {
-                               // Is there a way here to specify a
-                               // mask in order to show that the
-                               // button is disabled? (JMarc)
-                               fl_deactivate_object(p->icon);
-                       }
-                       else
-                               fl_activate_object(p->icon);
+       int const nnames = fl_get_combox_maxitems(combox_);
+       for (int i = 1; i <= nnames; ++i) {
+               string const name = fl_get_combox_line(combox_, i);
+               if (name == layoutname) {
+                       fl_set_combox(combox_, i);
+                       break;
                }
        }
 }
 
 
-void Toolbar::Pimpl::setLayout(int layout) {
-       if (combox)
-               combox->select(layout+1);
-}
-
-
 void Toolbar::Pimpl::updateLayoutList(bool force)
 {
-       // Update the layout display
-       if (!combox) return;
+       if (!combox_)
+               return;
 
        // If textclass is different, we need to update the list
-       if (combox->empty() || force) {
-               combox->clear();
+       if (fl_get_combox_maxitems(combox_) == 0 || force) {
+               fl_clear_combox(combox_);
                LyXTextClass const & tc =
-                       textclasslist.TextClass(owner->buffer()->
-                                               params.textclass);
+                       owner_->buffer()->params.getLyXTextClass();
                LyXTextClass::const_iterator end = tc.end();
                for (LyXTextClass::const_iterator cit = tc.begin();
                     cit != end; ++cit) {
-                       if ((*cit).obsoleted_by().empty())
-                               combox->addline(_((*cit).name()));
-                       else
-                               combox->addline("@N" + _((*cit).name()));
+                       // ignore obsolete entries
+                       if ((*cit)->obsoleted_by().empty()) {
+                               string const & name = _((*cit)->name());
+                               fl_addto_combox(combox_, name.c_str());
+                       }
                }
        }
        // we need to do this.
-       combox->Redraw();
+       fl_redraw_object(combox_);
 }
 
 
 void Toolbar::Pimpl::clearLayoutList()
 {
-       if (combox) {
-               combox->clear();
-               combox->Redraw();
-       }
+       if (!combox_)
+               return;
+
+       fl_clear_combox(combox_);
+       fl_redraw_object(combox_);
 }
 
 
 void Toolbar::Pimpl::openLayoutList()
 {
-       if (combox)
-               combox->Show();
+       if (!combox_)
+               return;
+
+       fl_show_combox_browser(combox_);
 }
 
 
@@ -267,83 +248,52 @@ namespace {
 
 void ToolbarCB(FL_OBJECT * ob, long ac)
 {
-       LyXView * owner = static_cast<LyXView *>(ob->u_vdata);
-       
-       string res = owner->getLyXFunc()->Dispatch(int(ac));
-       if (!res.empty())
-               lyxerr[Debug::GUI] << "ToolbarCB: Function returned: " 
-                                  << res << endl;
+       XFormsView * owner = static_cast<XFormsView *>(ob->u_vdata);
+
+       owner->getLyXFunc().dispatch(int(ac), true);
 }
 
-} // namespace anon
 
+extern "C" {
 
-extern "C" void C_Toolbar_ToolbarCB(FL_OBJECT * ob, long data)
+void C_Toolbar_ToolbarCB(FL_OBJECT * ob, long data)
 {
        ToolbarCB(ob, data);
 }
 
-
-#if 0
-// What are we supposed to do with that??
-int Toolbar::get_toolbar_func(string const & func)
-{
-       int action = lyxaction.LookupFunc(func);
-       if (action == -1) {
-               if (func == "separator"){
-                       action = TOOL_SEPARATOR;
-               } else if (func == "layouts"){
-                        action = TOOL_LAYOUTS;
-                } else action = 0;
-       }
-       return action;
 }
-#endif
 
 
-namespace {
+void setPixmap(FL_OBJECT * obj, int action)
+{
+       string xpm_name;
+       FuncRequest ev = lyxaction.retrieveActionArg(action);
 
-void setPixmap(FL_OBJECT * obj, int action, int buttonwidth, int height) {
-       string name, arg, xpm_name;
-       kb_action act;
-
-       if (lyxaction.isPseudoAction(action)) {
-               act = lyxaction.retrieveActionArg(action, arg);
-               name = lyxaction.getActionName(act);
-               xpm_name = subst(name + ' ' + arg, ' ','_');
-       } else {
-               act = (kb_action)action;
-               name = lyxaction.getActionName(action);
+       string const name = lyxaction.getActionName(ev.action);
+       if (!ev.argument.empty())
+               xpm_name = subst(name + ' ' + ev.argument, ' ','_');
+       else
                xpm_name = name;
-       }
 
        string fullname = LibFileSearch("images", xpm_name, "xpm");
 
+       if (ev.action == LFUN_INSERT_MATH && !ev.argument.empty()) {
+               string arg = ev.argument.substr(1);
+               fullname = LibFileSearch("images/math/", arg, "xpm");
+       }
+
        if (!fullname.empty()) {
-               lyxerr[Debug::GUI] << "Full icon name is `" 
-                                      << fullname << "'" << endl;
+               lyxerr[Debug::GUI] << "Full icon name is `"
+                                  << fullname << '\'' << endl;
                fl_set_pixmapbutton_file(obj, fullname.c_str());
                return;
        }
 
-       if (act == LFUN_INSERT_MATH && !arg.empty()) {
-               char const ** pixmap = get_pixmap_from_symbol(arg.c_str(),
-                                                       buttonwidth,
-                                                       height);
-               if (pixmap) {
-                       lyxerr[Debug::GUI] << "Using mathed-provided icon"
-                                          << endl;
-                       fl_set_pixmapbutton_data(obj,
-                                                const_cast<char **>(pixmap));
-                       return;
-               }
-       }
-       
-       lyxerr << "Unable to find icon `" << xpm_name << "'" << endl;
+       lyxerr << "Unable to find icon `" << xpm_name << '\'' << endl;
        fullname = LibFileSearch("images", "unknown", "xpm");
        if (!fullname.empty()) {
-               lyxerr[Debug::GUI] << "Using default `unknown' icon" 
-                                      << endl;
+               lyxerr[Debug::GUI] << "Using default `unknown' icon"
+                                  << endl;
                fl_set_pixmapbutton_file(obj, fullname.c_str());
        }
 }
@@ -351,185 +301,71 @@ void setPixmap(FL_OBJECT * obj, int action, int buttonwidth, int height) {
 } // namespace anon
 
 
-void Toolbar::Pimpl::set(bool doingmain)
+void Toolbar::Pimpl::add(int action)
 {
-       // we shouldn't set if we have not cleaned
-       if (!cleaned) return;
-       
-       FL_OBJECT * obj;
-       
-       if (!doingmain) {
-               fl_freeze_form(owner->getForm());
-               fl_addto_form(owner->getForm());
-       }
-
-#if FL_REVISION < 89
-       // add the time if it don't exist
-       if (bubble_timer == 0)
-               bubble_timer = fl_add_timer(FL_HIDDEN_TIMER,
-                                           xpos, ypos, 0, 0, "Timer");
-#endif
-       
-       ToolbarList::iterator item = toollist.begin();
-       ToolbarList::iterator end = toollist.end();
-       for (; item != end; ++item) {
-               switch (item->action){
-               case ToolbarDefaults::SEPARATOR:
-                       xpos += sepspace;
-                       break;
-               case ToolbarDefaults::NEWLINE:
-                       // Not supported yet.
-                       break;
-               case ToolbarDefaults::LAYOUTS:
-                       xpos += standardspacing;
-                       if (!combox)
-                               combox = new Combox(FL_COMBOX_DROPLIST);
-                       combox->add(xpos, ypos, 135, height, 400);
-                       combox->setcallback(layoutSelectedCB, this);
-                       combox->resize(FL_RESIZE_ALL);
-                       combox->gravity(NorthWestGravity, NorthWestGravity);
-                       xpos += 135;
-                       break;
-               default:
-                       xpos += standardspacing;
-                       item->icon = obj = 
-                               fl_add_pixmapbutton(FL_NORMAL_BUTTON,
-                                                   xpos, ypos,
-                                                   buttonwidth,
-                                                   height, "");
-                       fl_set_object_resize(obj, FL_RESIZE_ALL);
-                       fl_set_object_gravity(obj,
-                                             NorthWestGravity,
-                                             NorthWestGravity);
-                       fl_set_object_callback(obj, C_Toolbar_ToolbarCB,
-                                              static_cast<long>(item->action));
-                       // Remove the blue feedback rectangle
-                       fl_set_pixmapbutton_focus_outline(obj, 0);
-
-                       // Set the tooltip
-#if FL_REVISION >= 89
-                       string help = _(lyxaction.helpText(item->action));
-                       fl_set_object_helper(obj, help.c_str());        
-#else
-                       fl_set_object_posthandler(obj, C_Toolbar_BubblePost);
-                       obj->u_cdata = reinterpret_cast<char *>(bubble_timer);
-#endif
-
-                       // The view that this object belongs to.
-                       obj->u_vdata = owner;
-
-                       setPixmap(obj, item->action, buttonwidth, height);
-                       // we must remember to update the positions
-                       xpos += buttonwidth;
-                       // ypos is constant
-                       /* Here will come a check to see if the new
-                        * pos is within the bounds of the main frame,
-                        * and perhaps wrap the toolbar if not.
-                        */
+       toolbarItem item;
+       item.action = action;
+
+       switch (action) {
+       case ToolbarBackend::SEPARATOR:
+               xpos += sepspace;
+               break;
+       case ToolbarBackend::NEWLINE:
+               // Not supported yet.
+               break;
+       case ToolbarBackend::LAYOUTS:
+               xpos += standardspacing;
+               if (combox_)
                        break;
-               }
-       }
 
-       if (!doingmain) {
-               fl_end_form();
-               fl_unfreeze_form(owner->getForm());
-               // Should be safe to do this here.
-               owner->updateLayoutChoice();
+               combox_ = fl_add_combox(FL_DROPLIST_COMBOX,
+                                       xpos, ypos, 135, height, "");
+               fl_set_combox_browser_height(combox_, 400);
+               fl_set_object_boxtype(combox_, FL_DOWN_BOX);
+               fl_set_object_color(combox_, FL_MCOL, FL_MCOL);
+               fl_set_object_gravity(combox_, FL_NorthWest, FL_NorthWest);
+               fl_set_object_resize(combox_, FL_RESIZE_ALL);
+
+               combox_->u_vdata = this;
+               fl_set_object_callback(combox_, C_layoutSelectedCB, 0);
+               xpos += 135;
+               break;
+       default: {
+               FL_OBJECT * obj;
+
+               xpos += standardspacing;
+               item.icon = obj =
+                       fl_add_pixmapbutton(FL_NORMAL_BUTTON,
+                                           xpos, ypos,
+                                           buttonwidth,
+                                           height, "");
+               fl_set_object_resize(obj, FL_RESIZE_ALL);
+               fl_set_object_gravity(obj,
+                                     NorthWestGravity,
+                                     NorthWestGravity);
+               fl_set_object_callback(obj, C_Toolbar_ToolbarCB,
+                                      static_cast<long>(action));
+               // Remove the blue feedback rectangle
+               fl_set_pixmapbutton_focus_outline(obj, 0);
+
+               // initialise the tooltip
+               string const tip = _(lyxaction.helpText(obj->argument));
+               tooltip_->init(obj, tip);
+
+               // The view that this object belongs to.
+               obj->u_vdata = owner_;
+
+               setPixmap(obj, action);
+               // we must remember to update the positions
+               xpos += buttonwidth;
+               // ypos is constant
+               /* Here will come a check to see if the new
+                * pos is within the bounds of the main frame,
+                * and perhaps wrap the toolbar if not.
+                */
+               break;
        }
-
-       // set the state of the icons
-       //update();
-
-       cleaned = false;
-}
-
-
-void Toolbar::Pimpl::add(int action, bool doclean)
-{
-       if (doclean && !cleaned) clean();
-
-       // this is what we do if we want to add to an existing
-       // toolbar.
-       if (!doclean && owner) {
-               // first "hide" the toolbar buttons. This is not a real hide
-               // actually it deletes and frees the button altogether.
-               lyxerr << "Toolbar::add: \"hide\" the toolbar buttons." 
-                      << endl;
-
-               lightReset();
-               
-               fl_freeze_form(owner->getForm());
-
-               ToolbarList::iterator p = toollist.begin();
-               ToolbarList::iterator end = toollist.end();
-               for (; p != end; ++p) {
-                       p->clean();
-               }
-
-               if (combox) {
-                       delete combox;
-                       combox = 0;
-               }
-               fl_unfreeze_form(owner->getForm());
-               cleaned = true; // this is not completely true, but OK anyway
-       }
-       
-       // there exist some special actions not part of
-       // kb_action: SEPARATOR, LAYOUTS
-
-       toolbarItem newItem;
-       newItem.action = action;
-       toollist.push_back(newItem);
-}
-
-
-void Toolbar::Pimpl::clean()
-{
-       //reset(); // I do not understand what this reset() is, anyway
-
-       //now delete all the objects..
-       if (owner)
-               fl_freeze_form(owner->getForm());
-
-       // G++ vector does not have clear defined
-       //toollist.clear();
-       toollist.erase(toollist.begin(), toollist.end());
-
-       lyxerr[Debug::GUI] << "Combox: " << combox << endl;
-       if (combox) {
-               delete combox;
-               combox = 0;
-       }
-
-       if (owner)
-               fl_unfreeze_form(owner->getForm());
-       lyxerr[Debug::GUI] << "toolbar cleaned" << endl;
-       cleaned = true;
-}
-
-
-void Toolbar::Pimpl::push(int nth)
-{
-       lyxerr[Debug::GUI] << "Toolbar::push: trying to trigger no `"
-                              << nth << '\'' << endl;
-       
-       if (nth <= 0 || nth >= int(toollist.size())) {
-               // item nth not found...
-               return;
        }
 
-       fl_trigger_object(toollist[nth - 1].icon);
-}
-
-
-void Toolbar::Pimpl::reset() 
-{
-       //toollist = 0; // what is this supposed to do?
-       cleaned = false;
-       lightReset();
-}
-
-void Toolbar::Pimpl::lightReset() {
-       xpos = sxpos - standardspacing;
-       ypos = sypos;
+       toollist_.push_back(item);
 }