Le 13/02/2012 19:32, Richard Heck a écrit :
The patch looks like common-sense to me, therefore I expect that some
people will disagree. After all, it removes a 'feature'. Therefore I
leave this a (short) time window for discussion.
This seems good to me. I have the same problem.
New version that actually shows that TOC is clickable, and makes
FloatList clickable (and do the right thing).
This basically sort out the use of Inset::hasSettings vs. Inset::clickable.
I will commit soon.
JMarc
Index: src/insets/InsetFloatList.cpp
===================================================================
--- src/insets/InsetFloatList.cpp (révision 40746)
+++ src/insets/InsetFloatList.cpp (copie de travail)
@@ -14,10 +14,13 @@
#include "Buffer.h"
#include "BufferParams.h"
+#include "BufferView.h"
+#include "Cursor.h"
#include "DispatchResult.h"
#include "Floating.h"
#include "FloatList.h"
#include "Font.h"
+#include "FuncRequest.h"
#include "Language.h"
#include "LaTeXFeatures.h"
#include "Lexer.h"
@@ -79,6 +82,21 @@
}
+void InsetFloatList::doDispatch(Cursor & cur, FuncRequest & cmd) {
+ switch (cmd.action()) {
+ case LFUN_MOUSE_RELEASE:
+ if (!cur.selection() && cmd.button() == mouse_button::button1) {
+ cur.bv().showDialog("toc", params2string(params()));
+ cur.dispatched();
+ }
+ break;
+
+ default:
+ InsetCommand::doDispatch(cur, cmd);
+ }
+}
+
+
void InsetFloatList::write(ostream & os) const
{
os << "FloatList " << to_ascii(getParam("type")) << "\n";
Index: src/insets/Inset.cpp
===================================================================
--- src/insets/Inset.cpp (révision 40746)
+++ src/insets/Inset.cpp (copie de travail)
@@ -347,7 +347,7 @@
// if the derived inset did not explicitly handle mouse_release,
// we assume we request the settings dialog
if (!cur.selection() && cmd.button() == mouse_button::button1
- && hasSettings()) {
+ && clickable(cmd.x(), cmd.y()) && hasSettings()) {
FuncRequest tmpcmd(LFUN_INSET_SETTINGS);
dispatch(cur, tmpcmd);
}
Index: src/insets/InsetVSpace.h
===================================================================
--- src/insets/InsetVSpace.h (révision 40746)
+++ src/insets/InsetVSpace.h (copie de travail)
@@ -37,8 +37,6 @@
static void string2params(std::string const &, VSpace &);
///
static std::string params2string(VSpace const &);
- ///
- bool clickable(int, int) const { return true; }
private:
///
void metrics(MetricsInfo & mi, Dimension & dim) const;
Index: src/insets/InsetTOC.h
===================================================================
--- src/insets/InsetTOC.h (révision 40746)
+++ src/insets/InsetTOC.h (copie de travail)
@@ -41,6 +41,8 @@
docstring xhtml(XHTMLStream & xs, OutputParams const &) const;
///
void doDispatch(Cursor & cur, FuncRequest & cmd);
+ ///
+ bool clickable(int, int) const { return true; }
//@}
/// \name Static public methods obligated for InsetCommand derived classes
Index: src/insets/InsetSpace.h
===================================================================
--- src/insets/InsetSpace.h (révision 40746)
+++ src/insets/InsetSpace.h (copie de travail)
@@ -151,8 +151,6 @@
bool isSpace() const { return true; }
///
std::string contextMenuName() const;
- ///
- bool clickable(int /* x */, int /* y */) const { return true; }
protected:
///
Inset * clone() const { return new InsetSpace(*this); }
Index: src/insets/InsetFloatList.h
===================================================================
--- src/insets/InsetFloatList.h (révision 40746)
+++ src/insets/InsetFloatList.h (copie de travail)
@@ -46,6 +46,10 @@
///
docstring xhtml(XHTMLStream &, OutputParams const &) const;
///
+ void doDispatch(Cursor & cur, FuncRequest & cmd);
+ ///
+ bool clickable(int, int) const { return true; }
+ ///
void validate(LaTeXFeatures & features) const;
//@}
Index: src/insets/InsetCommand.cpp
===================================================================
--- src/insets/InsetCommand.cpp (révision 40746)
+++ src/insets/InsetCommand.cpp (copie de travail)
@@ -80,7 +80,7 @@
void InsetCommand::metrics(MetricsInfo & mi, Dimension & dim) const
{
- button_.update(screenLabel(), editable() || hasSettings());
+ button_.update(screenLabel(), editable() || clickable(0, 0));
button_.metrics(mi, dim);
}
Index: src/insets/InsetTOC.cpp
===================================================================
--- src/insets/InsetTOC.cpp (révision 40746)
+++ src/insets/InsetTOC.cpp (copie de travail)
@@ -14,6 +14,7 @@
#include "Buffer.h"
#include "BufferParams.h"
+#include "BufferView.h"
#include "Cursor.h"
#include "DispatchResult.h"
#include "Font.h"
@@ -64,7 +65,7 @@
switch (cmd.action()) {
case LFUN_MOUSE_RELEASE:
if (!cur.selection() && cmd.button() == mouse_button::button1) {
- showInsetDialog(&cur.bv());
+ cur.bv().showDialog("toc", params2string(params()));
cur.dispatched();
}
break;