mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-05 13:26:21 +00:00
Place inset content on the button when collapsed
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8169 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
b06de5044f
commit
d6c55f8b50
@ -1,3 +1,11 @@
|
||||
|
||||
2003-12-01 Martin Vermeer <martin.vermeer@hut.fi>
|
||||
|
||||
* insetcollapsable.[Ch]:
|
||||
* insetert.[Ch]:
|
||||
* insetcharstyle.C: place inset content on the button when
|
||||
collapsed.
|
||||
|
||||
2003-12-01 Michael Schmitt <michael.schmitt@teststep.org>
|
||||
|
||||
* insetvspace.C: remove VSpace::NONE; increase inset width
|
||||
|
@ -92,8 +92,8 @@ void InsetCharStyle::setButtonLabel()
|
||||
{
|
||||
LyXFont font(params_.labelfont);
|
||||
font.realize(LyXFont(LyXFont::ALL_SANE));
|
||||
font.decSize();
|
||||
setLabel("Style: " + params_.type);
|
||||
string const s = "Style: " + params_.type;
|
||||
setLabel(isOpen() ? s : getNewLabel(s) );
|
||||
setLabelFont(font);
|
||||
}
|
||||
|
||||
|
@ -35,6 +35,7 @@ using lyx::graphics::PreviewLoader;
|
||||
using std::endl;
|
||||
using std::string;
|
||||
using std::max;
|
||||
using std::min;
|
||||
using std::ostream;
|
||||
|
||||
|
||||
@ -260,6 +261,30 @@ bool InsetCollapsable::hitButton(FuncRequest const & cmd) const
|
||||
}
|
||||
|
||||
|
||||
string const InsetCollapsable::getNewLabel(string const & l) const
|
||||
{
|
||||
string la;
|
||||
pos_type const max_length = 15;
|
||||
pos_type const p_siz = inset.paragraphs().begin()->size();
|
||||
pos_type const n = min(max_length, p_siz);
|
||||
pos_type i = 0;
|
||||
pos_type j = 0;
|
||||
for( ; i < n && j < p_siz; ++j) {
|
||||
if (inset.paragraphs().begin()->isInset(j))
|
||||
continue;
|
||||
la += inset.paragraphs().begin()->getChar(j);
|
||||
++i;
|
||||
}
|
||||
if (inset.paragraphs().size() > 1 || (i > 0 && j < p_siz)) {
|
||||
la += "...";
|
||||
}
|
||||
if (la.empty()) {
|
||||
la = l;
|
||||
}
|
||||
return la;
|
||||
}
|
||||
|
||||
|
||||
void InsetCollapsable::edit(BufferView * bv, bool left)
|
||||
{
|
||||
lyxerr << "InsetCollapsable: edit left/right" << endl;
|
||||
|
@ -51,6 +51,8 @@ public:
|
||||
///
|
||||
bool hitButton(FuncRequest const &) const;
|
||||
///
|
||||
std::string const getNewLabel(std::string const & l) const;
|
||||
///
|
||||
EDITABLE editable() const;
|
||||
/// can we go further down on mouse click?
|
||||
bool descendable() const { return isOpen(); }
|
||||
|
@ -451,33 +451,9 @@ InsetERT::priv_dispatch(FuncRequest const & cmd, idx_type & idx, pos_type & pos)
|
||||
}
|
||||
|
||||
|
||||
string const InsetERT::getNewLabel() const
|
||||
{
|
||||
string la;
|
||||
pos_type const max_length = 15;
|
||||
pos_type const p_siz = inset.paragraphs().begin()->size();
|
||||
pos_type const n = min(max_length, p_siz);
|
||||
pos_type i = 0;
|
||||
pos_type j = 0;
|
||||
for( ; i < n && j < p_siz; ++j) {
|
||||
if (inset.paragraphs().begin()->isInset(j))
|
||||
continue;
|
||||
la += inset.paragraphs().begin()->getChar(j);
|
||||
++i;
|
||||
}
|
||||
if (inset.paragraphs().size() > 1 || (i > 0 && j < p_siz)) {
|
||||
la += "...";
|
||||
}
|
||||
if (la.empty()) {
|
||||
la = _("ERT");
|
||||
}
|
||||
return la;
|
||||
}
|
||||
|
||||
|
||||
void InsetERT::setButtonLabel() const
|
||||
{
|
||||
setLabel(status_ == Collapsed ? getNewLabel() : _("ERT"));
|
||||
setLabel(status_ == Collapsed ? getNewLabel(_("ERT")) : _("ERT"));
|
||||
}
|
||||
|
||||
|
||||
|
@ -119,8 +119,6 @@ private:
|
||||
///
|
||||
void init();
|
||||
///
|
||||
std::string const getNewLabel() const;
|
||||
///
|
||||
void setButtonLabel() const;
|
||||
///
|
||||
void setLatexFont(BufferView *);
|
||||
|
Loading…
Reference in New Issue
Block a user