rgheck wrote:
Abdelrazak Younes wrote:
In any event, the SignalSlot machinery seems to be unused at present, so I can't find an example of its use. But the moment I try to use it, I get linking errors. It's enough to add this:
   static Signal modified;
   ~InsetLabel() { modified.fire()
to InsetLabel.h (with the #include, of course), and then:

You forgot to declare the static member somewhere (in InsetLabel.cpp in my original patch):

Index: InsetLabel.cpp
===================================================================
--- InsetLabel.cpp    (revision 22331)
+++ InsetLabel.cpp    (working copy)
@@ -27,10 +27,13 @@

 namespace lyx {

+Signal InsetLabel::modified;


Removing the "static" keyword doesn't help (not that we'd want to do that). I'm not sure what's wrong here.

The whole patch causing this issue is below.

The slot in GuiRef does not need to be static AFAICS.

OK, thanks. I'll try that and do a bit of testing.

Hum, after reading the code, I think we are on the wrong track. The reason why this is so slow is that we reconstruct a vector of full strings each time we call 'getLabelList()'. If we just reconstruct a vector of pointer I forecast that it will be fast enough. If that is not the case, we can implement a cache based solution as Juergen suggested.

What I would do:
1) Instead of constructing the vector of labels, construct a vector of Insets:

  /// Construct a vector of label type insets.
  /// \return true if the generated vector is changed from
  /// previous call.
  bool Buffer::getLabelList(vector<Inset const *> & list) const;

  /// \return true if the Inset is of label type.
  bool Inset::isLabelType() const { return false; }

  /// Add elements to the passed list.
  /// \return true if the additional elements are changed since
  /// last call. (note that we don't need Buffer passing anymore)
  bool Inset::getLabelList(vector<docstring> & list) const {}

2) When we are about to show the label string list, we construct it only if there something changed i.e. if Buffer::getLabelList() returns true.

3) If there is a still a performance problem, then we maintain a cache somewhere:

 map<Buffer const *, vector<Inset const *> > LabelCache;

What do you think? It's probably more work but I think it will pay at the end.

Abdel.

Reply via email to