]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/xforms/Toolbar_pimpl.C
adjust
[lyx.git] / src / frontends / xforms / Toolbar_pimpl.C
index 8ba8157795b535c25dee3cec52e4910efdfbdc9c..dae43e651a1b96de5b3b063b6cec93d846436763 100644 (file)
@@ -4,7 +4,7 @@
  *           LyX, The Document Processor
  *
  *           Copyright 1995 Matthias Ettrich
- *           Copyright 1995-2000 The LyX Team.
+ *           Copyright 1995-2001 The LyX Team.
  *
  *           This file is Copyright 1996-1998
  *           Lars Gullik Bjønnes
 #endif
 
 #include "Toolbar_pimpl.h"
-#include "lyxfunc.h"
 #include "debug.h"
-#include "LyXView.h"
+#include "XFormsView.h"
+#include "lyxfunc.h"
+#include "func_status.h"
 #include "BufferView.h"
 #include "buffer.h"
 #include "LyXAction.h"
@@ -80,7 +81,7 @@ Toolbar::Pimpl::toolbarItem::operator=(toolbarItem const & ti) {
 
 
 Toolbar::Pimpl::Pimpl(LyXView * o, int x, int y)
-       : owner(o), sxpos(x), sypos(y)
+       : owner(static_cast<XFormsView *>(o)), sxpos(x), sypos(y)
 {
        combox = 0;
 #if FL_REVISION < 89
@@ -156,7 +157,7 @@ void Toolbar::Pimpl::layoutSelectedCB(int sel, void * arg, Combox *)
 void Toolbar::Pimpl::layoutSelected(int sel)
 {
        string const tmp = tostr(sel);
-       owner->getLyXFunc()->Dispatch(LFUN_LAYOUTNO, tmp);
+       owner->getLyXFunc()->dispatch(LFUN_LAYOUTNO, tmp);
 }
  
 
@@ -190,7 +191,7 @@ void Toolbar::Pimpl::update()
        for (; p != end; ++p) {
                if (p->icon) {
                        int status = owner->getLyXFunc()->getStatus(p->action);
-                       if (status & LyXFunc::ToggleOn) {
+                       if (status & func_status::ToggleOn) {
                                // I'd like to use a different color
                                // here, but then the problem is to
                                // know how to use transparency with
@@ -203,7 +204,7 @@ void Toolbar::Pimpl::update()
                                fl_set_object_boxtype(p->icon, FL_UP_BOX);
                        }
 
-                       if (status & LyXFunc::Disabled) {
+                       if (status & func_status::Disabled) {
                                // Is there a way here to specify a
                                // mask in order to show that the
                                // button is disabled? (JMarc)
@@ -236,10 +237,10 @@ void Toolbar::Pimpl::updateLayoutList(bool force)
                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()));
+                       if (cit->obsoleted_by().empty())
+                               combox->addline(_(cit->name()));
                        else
-                               combox->addline("@N" + _((*cit).name()));
+                               combox->addline("@N" + _(cit->name()));
                }
        }
        // we need to do this.
@@ -267,9 +268,9 @@ namespace {
 
 void ToolbarCB(FL_OBJECT * ob, long ac)
 {
-       LyXView * owner = static_cast<LyXView *>(ob->u_vdata);
+       XFormsView * owner = static_cast<XFormsView *>(ob->u_vdata);
        
-       string res = owner->getLyXFunc()->Dispatch(int(ac));
+       string res = owner->getLyXFunc()->dispatch(int(ac));
        if (!res.empty())
                lyxerr[Debug::GUI] << "ToolbarCB: Function returned: " 
                                   << res << endl;
@@ -284,23 +285,6 @@ extern "C" void C_Toolbar_ToolbarCB(FL_OBJECT * ob, long 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, int buttonwidth, int height) {
@@ -408,7 +392,7 @@ void Toolbar::Pimpl::set(bool doingmain)
 
                        // Set the tooltip
 #if FL_REVISION >= 89
-                       string help = _(lyxaction.helpText(item->action));
+                       string const help(_(lyxaction.helpText(item->action)));
                        fl_set_object_helper(obj, help.c_str());        
 #else
                        fl_set_object_posthandler(obj, C_Toolbar_BubblePost);
@@ -529,6 +513,7 @@ void Toolbar::Pimpl::reset()
        lightReset();
 }
 
+
 void Toolbar::Pimpl::lightReset() {
        xpos = sxpos - standardspacing;
        ypos = sypos;