Jean-Marc Lasgouttes wrote:
> > Second, every toolbar is updated every time through here EVEN IF IT IS
> > NOT DISPLAYED. I found this out because hiding the standard toolbar
> > made no difference. This is a waste.
>
> This should definitely be fixed.

How about the attached?

Jürgen
Index: src/frontends/qt4/QLToolbar.h
===================================================================
--- src/frontends/qt4/QLToolbar.h	(Revision 20591)
+++ src/frontends/qt4/QLToolbar.h	(Arbeitskopie)
@@ -81,7 +81,7 @@
 
 private:
 
-	std::vector<Action *> ActionVector;
+	std::vector<std::pair<QLToolbar *, Action *> > ActionVector;
 	GuiView & owner_;
 
 	boost::scoped_ptr<QLayoutBox> layout_;
Index: src/frontends/qt4/QLToolbar.cpp
===================================================================
--- src/frontends/qt4/QLToolbar.cpp	(Revision 20591)
+++ src/frontends/qt4/QLToolbar.cpp	(Arbeitskopie)
@@ -42,6 +42,8 @@
 
 namespace lyx {
 
+using std::make_pair;
+using std::pair;
 using std::string;
 using std::endl;
 using support::FileName;
@@ -227,7 +229,7 @@
 					it->func_,
 					it->label_);
 				panel->addButton(action);
-				ActionVector.push_back(action);
+				ActionVector.push_back(make_pair(this, action));
 				// use the icon of first action for the toolbar button
 				if (it == tbinfo->items.begin())
 					tb->setIcon(QPixmap(getIcon(it->func_).c_str()));
@@ -268,7 +270,7 @@
 					it->func_,
 					it->label_);
 				m->add(action);
-				ActionVector.push_back(action);
+				ActionVector.push_back(make_pair(this, action));
 			}
 		tb->setMenu(m);
 		addWidget(tb);
@@ -284,7 +286,7 @@
 			item.func_,
 			item.label_);
 		addAction(action);
-		ActionVector.push_back(action);
+		ActionVector.push_back(make_pair(this, action));
 		break;
 		}
 	default:
@@ -347,7 +349,8 @@
 	// This is a speed bottleneck because this is called on every keypress
 	// and update calls getStatus, which copies the cursor at least two times
 	for (size_t i = 0; i < ActionVector.size(); ++i)
-		ActionVector[i]->update();
+		if (ActionVector[i].first->isVisible())
+			ActionVector[i].second->update();
 
 	// emit signal
 	updated();

Reply via email to