]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/Action.C
enable Font cache only for MacOSX and inline width() for other platform.
[lyx.git] / src / frontends / qt4 / Action.C
index edfc308f1958d9349b936065db6d1ffef9aed542..c58ced887ed0a6440bb1e34bfc7d23bbbbec6c26 100644 (file)
 
 #include <config.h>
 
-#include "BufferView.h"
+#include "Action.h"
+
 #include "lyx_cb.h"
 #include "lyxfunc.h"
 #include "FuncStatus.h"
-
 #include "debug.h"
 
-#include <boost/bind.hpp>
-
 #include "frontends/LyXView.h"
-#include "qt_helpers.h"
 
-#include "Action.h"
+#include "qt_helpers.h"
 
 #include "support/lstrings.h"
 
+#include <boost/bind.hpp>
+
+
 using std::string;
 using std::endl;
 
@@ -41,25 +41,25 @@ int const statusbar_timer_value = 3000;
 
 Action::Action(LyXView & lyxView, string const & text,
                FuncRequest const & func, string const & tooltip)
-               : QAction(this), lyxView_(lyxView), func_(func)
+       : QAction(this), func_(func), lyxView_(lyxView)
 {
-       setText(tr(toqstr(text)));
-       setToolTip(tr(toqstr(tooltip)));
+       setText(toqstr(text));
+       setToolTip(toqstr(tooltip));
        setStatusTip(toqstr(tooltip));
        connect(this, SIGNAL(triggered()), this, SLOT(action()));
-       this->setCheckable(true);
+       update();
 }
 
 Action::Action(LyXView & lyxView, string const & icon, string const & text,
                FuncRequest const & func, string const & tooltip)
-               : QAction(this), lyxView_(lyxView), func_(func)
+               : QAction(this), func_(func), lyxView_(lyxView)
 {
        setIcon(QPixmap(icon.c_str()));
-       setText(tr(toqstr(text)));
-       setToolTip(tr(toqstr(tooltip)));
+       setText(toqstr(text));
+       setToolTip(toqstr(tooltip));
        setStatusTip(toqstr(tooltip));
        connect(this, SIGNAL(triggered()), this, SLOT(action()));
-       this->setCheckable(true);
+       update();
 }
 
 /*
@@ -73,8 +73,17 @@ void Action::update()
 {
        FuncStatus const status = lyxView_.getLyXFunc().getStatus(func_);
 
-       this->setChecked(status.onoff(true));
-       this->setEnabled(status.enabled());
+       if (status.onoff(true)) {
+               setCheckable(true);
+               setChecked(true);
+       } else if (status.onoff(false)) {
+               setCheckable(true);
+               setChecked(false);
+       } else {
+               setCheckable(false);
+       }
+
+       setEnabled(status.enabled());
 }