#include "support/convert.h"
#include "support/debug.h"
+#include "support/docstream.h"
#include "support/gettext.h"
#include "support/lstrings.h"
-#include "support/docstream.h"
#include "frontends/Application.h"
}
+docstring InsetFloat::toolTip(BufferView const & bv, int x, int y) const
+{
+ if (InsetCollapsable::toolTip(bv, x, y).empty())
+ return docstring();
+
+ docstring default_tip;
+ if (isOpen())
+ default_tip = _("Left-click to collapse the inset");
+ else
+ default_tip = _("Left-click to open the inset");
+ OutputParams rp(&buffer().params().encoding());
+ docstring caption_tip = getCaptionText(rp);
+ if (!isOpen() && !caption_tip.empty())
+ return caption_tip + '\n' + default_tip;
+ return default_tip;
+}
+
+
void InsetFloat::doDispatch(Cursor & cur, FuncRequest & cmd)
{
switch (cmd.action) {
case LFUN_INSET_MODIFY:
case LFUN_INSET_DIALOG_UPDATE:
- flag.enabled(true);
+ flag.setEnabled(true);
return true;
default:
void InsetFloat::updateLabels(ParIterator const & it)
{
- Counters & cnts = buffer().params().documentClass().counters();
+ Counters & cnts = buffer().masterBuffer()->params().documentClass().counters();
string const saveflt = cnts.current_float();
bool const savesubflt = cnts.isSubfloat();
- bool const subflt = it.innerInsetOfType(FLOAT_CODE);
+ bool const subflt = (it.innerInsetOfType(FLOAT_CODE)
+ || it.innerInsetOfType(WRAP_CODE));
// floats can only embed subfloats of their own kind
if (subflt)
params_.type = saveflt;
}
+docstring InsetFloat::getCaptionText(OutputParams const & runparams) const
+{
+ if (paragraphs().empty())
+ return docstring();
+
+ ParagraphList::const_iterator pit = paragraphs().begin();
+ for (; pit != paragraphs().end(); ++pit) {
+ InsetList::const_iterator it = pit->insetList().begin();
+ for (; it != pit->insetList().end(); ++it) {
+ Inset & inset = *it->inset;
+ if (inset.lyxCode() == CAPTION_CODE) {
+ odocstringstream ods;
+ InsetCaption * ins =
+ static_cast<InsetCaption *>(it->inset);
+ ins->getCaptionText(ods, runparams);
+ return ods.str();
+ }
+ }
+ }
+ return docstring();
+}
+
+
void InsetFloat::string2params(string const & in, InsetFloatParams & params)
{
params = InsetFloatParams();