mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-18 21:45:24 +00:00
branch: Fix bug #6672
part 1: Notes, Footnotes, and Marginals are unnecessarily truncated. part 2: Add tooltips to the outliner. see r34286, r34287. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_6_X@34555 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
5181271d71
commit
2cf9915cda
@ -501,14 +501,16 @@ void Changes::addToToc(DocIterator const & cdit, Buffer const & buffer) const
|
||||
Toc::iterator it = change_list.item(0, author);
|
||||
if (it == change_list.end()) {
|
||||
change_list.push_back(TocItem(dit, 0, author));
|
||||
change_list.push_back(TocItem(dit, 1, str));
|
||||
change_list.push_back(TocItem(dit, 1, str,
|
||||
support::wrapParas(str, 4)));
|
||||
continue;
|
||||
}
|
||||
for (++it; it != change_list.end(); ++it) {
|
||||
if (it->depth() == 0 && it->str() != author)
|
||||
break;
|
||||
}
|
||||
change_list.insert(it, TocItem(dit, 1, str));
|
||||
change_list.insert(it, TocItem(dit, 1, str,
|
||||
support::wrapParas(str, 4)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -44,8 +44,8 @@ namespace lyx {
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
TocItem::TocItem(DocIterator const & dit, int d, docstring const & s)
|
||||
: dit_(dit), depth_(d), str_(s)
|
||||
TocItem::TocItem(DocIterator const & dit, int d, docstring const & s,
|
||||
docstring const & t) : dit_(dit), depth_(d), str_(s), tooltip_(t)
|
||||
{
|
||||
}
|
||||
|
||||
@ -68,6 +68,12 @@ docstring const & TocItem::str() const
|
||||
}
|
||||
|
||||
|
||||
docstring const & TocItem::tooltip() const
|
||||
{
|
||||
return tooltip_;
|
||||
}
|
||||
|
||||
|
||||
docstring const TocItem::asString() const
|
||||
{
|
||||
return docstring(4 * depth_, ' ') + str_;
|
||||
|
@ -42,7 +42,8 @@ public:
|
||||
///
|
||||
TocItem(DocIterator const & dit,
|
||||
int depth,
|
||||
docstring const & s
|
||||
docstring const & s,
|
||||
docstring const & t = docstring()
|
||||
);
|
||||
///
|
||||
~TocItem() {}
|
||||
@ -53,6 +54,8 @@ public:
|
||||
///
|
||||
docstring const & str() const;
|
||||
///
|
||||
docstring const & tooltip() const;
|
||||
///
|
||||
docstring const asString() const;
|
||||
|
||||
/// the action corresponding to the goTo above
|
||||
@ -67,6 +70,9 @@ protected:
|
||||
|
||||
/// Full item string
|
||||
docstring str_;
|
||||
|
||||
/// The tooltip string
|
||||
docstring tooltip_;
|
||||
};
|
||||
|
||||
|
||||
|
@ -155,6 +155,7 @@ void TocModel::updateItem(DocIterator const & dit)
|
||||
QModelIndex index = modelIndex(dit);
|
||||
TocItem const & toc_item = tocItem(index);
|
||||
model_->setData(index, toqstr(toc_item.str()), Qt::DisplayRole);
|
||||
model_->setData(index, toqstr(toc_item.tooltip()), Qt::ToolTipRole);
|
||||
}
|
||||
|
||||
|
||||
@ -184,6 +185,7 @@ void TocModel::reset(Toc const & toc)
|
||||
QModelIndex top_level_item = model_->index(current_row, 0);
|
||||
model_->setData(top_level_item, toqstr(item.str()), Qt::DisplayRole);
|
||||
model_->setData(top_level_item, index, Qt::UserRole);
|
||||
model_->setData(top_level_item, toqstr(item.tooltip()), Qt::ToolTipRole);
|
||||
|
||||
LYXERR(Debug::GUI, "Toc: at depth " << item.depth()
|
||||
<< ", added item " << item.str());
|
||||
@ -225,6 +227,7 @@ void TocModel::populate(unsigned int & index, QModelIndex const & parent)
|
||||
child_item = model_->index(current_row, 0, parent);
|
||||
model_->setData(child_item, toqstr(item.str()), Qt::DisplayRole);
|
||||
model_->setData(child_item, index, Qt::UserRole);
|
||||
model_->setData(child_item, toqstr(item.tooltip()), Qt::ToolTipRole);
|
||||
populate(index, child_item);
|
||||
if (index >= end)
|
||||
break;
|
||||
|
@ -291,7 +291,7 @@ void InsetBranch::addToToc(DocIterator const & cpit)
|
||||
|
||||
Toc & toc = buffer().tocBackend().toc("branch");
|
||||
docstring const str = params_.branch + ": " + text().getPar(0).asString();
|
||||
toc.push_back(TocItem(pit, 0, str));
|
||||
toc.push_back(TocItem(pit, 0, str, toolTipText()));
|
||||
// Proceed with the rest of the inset.
|
||||
InsetCollapsable::addToToc(cpit);
|
||||
}
|
||||
|
@ -136,11 +136,7 @@ docstring InsetCollapsable::toolTip(BufferView const & bv, int x, int y) const
|
||||
if (x > xo(bv) + dim.wid || y > yo(bv) + dim.des || isOpen(bv))
|
||||
return docstring();
|
||||
|
||||
OutputParams rp(&buffer().params().encoding());
|
||||
odocstringstream ods;
|
||||
InsetText::plaintext(ods, rp);
|
||||
docstring const content_tip = ods.str();
|
||||
return support::wrapParas(content_tip, 4);
|
||||
return toolTipText();
|
||||
}
|
||||
|
||||
|
||||
|
@ -71,8 +71,8 @@ void InsetFoot::addToToc(DocIterator const & cpit)
|
||||
|
||||
Toc & toc = buffer().tocBackend().toc("footnote");
|
||||
docstring str;
|
||||
str = custom_label_ + ": " + getNewLabel(str);
|
||||
toc.push_back(TocItem(pit, 0, str));
|
||||
str = custom_label_ + ": " + text().getPar(0).asString();
|
||||
toc.push_back(TocItem(pit, 0, str, toolTipText()));
|
||||
// Proceed with the rest of the inset.
|
||||
InsetFootlike::addToToc(cpit);
|
||||
}
|
||||
|
@ -76,8 +76,8 @@ void InsetMarginal::addToToc(DocIterator const & cpit)
|
||||
|
||||
Toc & toc = buffer().tocBackend().toc("marginalnote");
|
||||
docstring str;
|
||||
str = getNewLabel(str);
|
||||
toc.push_back(TocItem(pit, 0, str));
|
||||
str = text().getPar(0).asString();
|
||||
toc.push_back(TocItem(pit, 0, str, toolTipText()));
|
||||
// Proceed with the rest of the inset.
|
||||
InsetFootlike::addToToc(cpit);
|
||||
}
|
||||
|
@ -230,8 +230,8 @@ void InsetNote::addToToc(DocIterator const & cpit)
|
||||
Toc & toc = buffer().tocBackend().toc("note");
|
||||
docstring str;
|
||||
str = notetranslator_loc().find(params_.type) + from_ascii(": ")
|
||||
+ getNewLabel(str);
|
||||
toc.push_back(TocItem(pit, 0, str));
|
||||
+ text().getPar(0).asString();
|
||||
toc.push_back(TocItem(pit, 0, str, toolTipText()));
|
||||
// Proceed with the rest of the inset.
|
||||
InsetCollapsable::addToToc(cpit);
|
||||
}
|
||||
|
@ -3,7 +3,7 @@
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author Jürgen Vigna
|
||||
* \author Jürgen Vigna
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
@ -537,7 +537,8 @@ void InsetText::addToToc(DocIterator const & cdit)
|
||||
// insert this into the table of contents
|
||||
if (tocstring.empty())
|
||||
tocstring = par.asString(AS_STR_LABEL | AS_STR_INSETS);
|
||||
toc.push_back(TocItem(dit, toclevel - min_toclevel, tocstring));
|
||||
toc.push_back(TocItem(dit, toclevel - min_toclevel,
|
||||
tocstring, tocstring));
|
||||
}
|
||||
|
||||
// And now the list of changes.
|
||||
@ -636,4 +637,17 @@ docstring InsetText::contextMenu(BufferView const &, int, int) const
|
||||
}
|
||||
|
||||
|
||||
|
||||
docstring InsetText::toolTipText() const
|
||||
{
|
||||
OutputParams rp(&buffer().params().encoding());
|
||||
odocstringstream ods;
|
||||
// do not remove InsetText::, otherwise there
|
||||
// will be no tooltip text for InsetNotes
|
||||
InsetText::plaintext(ods, rp);
|
||||
docstring const content_tip = ods.str();
|
||||
return support::wrapParas(content_tip, 4);
|
||||
}
|
||||
|
||||
|
||||
} // namespace lyx
|
||||
|
@ -162,6 +162,8 @@ public:
|
||||
bool insertCompletion(Cursor & cur, docstring const & s, bool finished);
|
||||
///
|
||||
void completionPosAndDim(Cursor const &, int & x, int & y, Dimension & dim) const;
|
||||
/// returns the text to be used as tooltip
|
||||
docstring toolTipText() const;
|
||||
|
||||
///
|
||||
virtual docstring contextMenu(BufferView const & bv, int x, int y) const;
|
||||
|
@ -38,6 +38,11 @@ What's new
|
||||
- Layout and template file for document class article(IEEEtran) has been
|
||||
updated for IEEEtran 1.7a.
|
||||
|
||||
- Do not unnecessarily truncate the text of notes, footnotes and marginals
|
||||
(bug 6672, part 1).
|
||||
|
||||
- Tooltips are added to the outliner (bug 6672, part 2).
|
||||
|
||||
|
||||
* DOCUMENTATION AND LOCALIZATION
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user