]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/xforms/XFormsToolbar.C
Change glob() API to accept a dir parameter.
[lyx.git] / src / frontends / xforms / XFormsToolbar.C
index aa965320e8da09e09ff613ff63a02a034fc37acd..ccee31a916989d0a83ffd05f9378ebc8ebea209e 100644 (file)
@@ -38,6 +38,8 @@
 #include <sstream>
 #include <vector>
 
+using boost::shared_ptr;
+
 using std::distance;
 using std::endl;
 using std::string;
@@ -143,8 +145,8 @@ void XFormsToolbar::toolbarItem::generateInactivePixmaps()
        int idummy;
        Window win;
 
-        XGetGeometry(display, active_pixmap, &win, &idummy, &idummy,
-                     &width, &height, &uidummy, &uidummy);
+       XGetGeometry(display, active_pixmap, &win, &idummy, &idummy,
+                    &width, &height, &uidummy, &uidummy);
 
        // Produce a darker shade of the button background as the
        // inactive color. Note the 'hsv.v - 0.2'.
@@ -190,7 +192,7 @@ void XFormsToolbar::toolbarItem::generateInactivePixmaps()
 Toolbars::ToolbarPtr make_toolbar(ToolbarBackend::Toolbar const & tbb,
                                  LyXView & owner)
 {
-       using lyx::frontend::XFormsToolbar
+       using lyx::frontend::XFormsToolbar;
        return Toolbars::ToolbarPtr(new XFormsToolbar(tbb, owner));
 }
 
@@ -200,14 +202,13 @@ namespace frontend {
 
 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
@@ -235,9 +236,9 @@ XFormsToolbar::XFormsToolbar(ToolbarBackend::Toolbar const & tbb,
 
        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));
 
@@ -249,7 +250,6 @@ XFormsToolbar::XFormsToolbar(ToolbarBackend::Toolbar const & tbb,
        ToolbarBackend::item_iterator end = tbb.items.end();
        for (; it != end; ++it)
                add(it->first, it->second);
-
 }
 
 
@@ -276,7 +276,7 @@ void C_ToolbarCB(FL_OBJECT * ob, long ac)
 
        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"
@@ -521,20 +521,7 @@ void XLayoutBox::selected()
 {
        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