]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/Toolbars.C
get rid of broken_header.h and some unneeded tests
[lyx.git] / src / frontends / Toolbars.C
index 2a3a935eb0d40477ee366ca4298b008b918b722c..344c2248fe4d299a42c3017ba5696f21e306d433 100644 (file)
 
 #include "Toolbars.h"
 
+#include "buffer.h"
+#include "bufferparams.h"
 #include "debug.h"
 #include "funcrequest.h"
 #include "FuncStatus.h"
+#include "gettext.h"
 #include "lyxfunc.h"
+#include "lyxtextclass.h"
 #include "LyXView.h"
 
 using std::endl;
@@ -151,3 +155,26 @@ void Toolbars::update()
        if (layout_)
                layout_->setEnabled(enable);
 }
+
+
+void layoutSelected(LyXView & lv, string const & name)
+{
+       LyXTextClass const & tc = lv.buffer()->params().getLyXTextClass();
+
+       LyXTextClass::const_iterator it  = tc.begin();
+       LyXTextClass::const_iterator const end = tc.end();
+       for (; it != end; ++it) {
+               string const & itname = (*it)->name();
+               // Yes, the _() is correct
+               if (_(itname) == name) {
+                       FuncRequest const func(LFUN_LAYOUT, itname,
+                                              FuncRequest::UI);
+                       lv.getLyXFunc().dispatch(func);
+                       return;
+               }
+       }
+       lyxerr << "ERROR (layoutSelected): layout not found!"
+              << endl;
+}
+
+