#include <sstream>
#include <vector>
+using boost::shared_ptr;
+
using std::distance;
using std::endl;
using std::string;
XFormsToolbar::XFormsToolbar(ToolbarBackend::Toolbar const & tbb,
LyXView & o)
- : toolbar_(0),
- toolbar_buttons_(0),
+ : toolbar_buttons_(0),
owner_(static_cast<XFormsView &>(o)),
tooltip_(new Tooltips)
{
position_ = getPosition(tbb.flags);
- BoxList & boxlist = owner_.getBox(position_).children();
- toolbar_ = &boxlist.push_back(Box(0,0));
+ BoxList & boxlist = owner_.getBox(position_)->children();
+ toolbar_ = boxlist.push_back(Box(0,0));
// If the toolbar is horizontal, then it contains three
// vertically-aligned Boxes,the center one of which is to
toolbar_->children().push_back(Box(padding, padding));
- Box & toolbar_center = toolbar_->children().push_back(Box(0,0));
- toolbar_center.set(toolbar_orientation);
- toolbar_buttons_ = &toolbar_center.children();
+ shared_ptr<Box> toolbar_center = toolbar_->children().push_back(Box(0,0));
+ toolbar_center->set(toolbar_orientation);
+ toolbar_buttons_ = &toolbar_center->children();
toolbar_->children().push_back(Box(padding, padding));
ToolbarBackend::item_iterator end = tbb.items.end();
for (; it != end; ++it)
add(it->first, it->second);
-
}
XFormsToolbar * ptr = static_cast<XFormsToolbar *>(ob->u_vdata);
XFormsView & owner = ptr->owner_;
- owner.getLyXFunc().dispatch(ptr->funcs[ac], true);
+ owner.getLyXFunc().dispatch(ptr->funcs[ac]);
}
} // extern "C"
{
string const layoutguiname = getString(combox_);
- LyXTextClass const & tc = getTextClass(owner_);
-
- LyXTextClass::const_iterator it = tc.begin();
- LyXTextClass::const_iterator const end = tc.end();
- for (; it != end; ++it) {
- string const & name = (*it)->name();
- if (_(name) == layoutguiname) {
- owner_.getLyXFunc()
- .dispatch(FuncRequest(LFUN_LAYOUT, name),
- true);
- return;
- }
- }
- lyxerr << "ERROR (XLayoutBox::selected): layout not found!" << endl;
+ layoutSelected(owner_, layoutguiname);
}
} // namespace frontend