mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 05:16:21 +00:00
simplificatons
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2329 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
d2e5c09218
commit
3ce727041d
@ -51,9 +51,11 @@
|
||||
#include "insets/insetmarginal.h"
|
||||
#include "insets/insetminipage.h"
|
||||
#include "insets/insetfloat.h"
|
||||
#include "insets/insetlist.h"
|
||||
#include "insets/insettabular.h"
|
||||
#if 0
|
||||
#include "insets/insettheorem.h"
|
||||
#include "insets/insetlist.h"
|
||||
#endif
|
||||
#include "insets/insetcaption.h"
|
||||
#include "insets/insetfloatlist.h"
|
||||
#include "insets/insetspecialchar.h"
|
||||
@ -2744,6 +2746,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument)
|
||||
}
|
||||
break;
|
||||
|
||||
#if 0
|
||||
case LFUN_INSET_LIST:
|
||||
insertAndEditInset(new InsetList);
|
||||
break;
|
||||
@ -2751,7 +2754,8 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument)
|
||||
case LFUN_INSET_THEOREM:
|
||||
insertAndEditInset(new InsetTheorem);
|
||||
break;
|
||||
|
||||
#endif
|
||||
|
||||
case LFUN_INSET_CAPTION:
|
||||
{
|
||||
// Do we have a locking inset...
|
||||
|
@ -1,3 +1,22 @@
|
||||
2001-07-25 Lars Gullik Bjønnes <larsbj@birdstep.com>
|
||||
|
||||
* text2.C (toggleInset): call open/close
|
||||
|
||||
2001-07-24 Lars Gullik Bjønnes <larsbj@birdstep.com>
|
||||
|
||||
* lyxfunc.C (dispatch): add debug for the disabled case
|
||||
|
||||
* font.C (buttonText): make similar to rectText
|
||||
|
||||
* buffer.C (readInset): comment out parsing of insetlist and
|
||||
insttheorem
|
||||
|
||||
* PainterBase.C (rectText): small correction
|
||||
|
||||
* BufferView_pimpl.C: comment out insettheorem and insetlist
|
||||
* LyXAction.C: ditto
|
||||
* commandtags.h: ditto
|
||||
|
||||
2001-07-24 Juergen Vigna <jug@sad.it>
|
||||
|
||||
* text.C (draw): honor the ignore_language.
|
||||
|
@ -275,7 +275,9 @@ void LyXAction::init()
|
||||
{ LFUN_END, "line-end", N_("Go to end of line"), ReadOnly },
|
||||
{ LFUN_ENDSEL, "line-end-select",
|
||||
N_("Select to end of line"), ReadOnly },
|
||||
#if 0
|
||||
{ LFUN_INSET_LIST, "list-insert", "", Noop },
|
||||
#endif
|
||||
{ LFUN_QUIT, "lyx-quit", N_("Exit"), NoBuffer },
|
||||
{ LFUN_INSET_MARGINAL, "marginalnote-insert",
|
||||
N_("Insert Marginalnote"), Noop },
|
||||
@ -378,7 +380,9 @@ void LyXAction::init()
|
||||
#endif
|
||||
{ LFUN_INSET_TEXT, "text-insert",
|
||||
N_("Insert a new Text Inset"), Noop },
|
||||
#if 0
|
||||
{ LFUN_INSET_THEOREM, "theorem-insert", "", Noop },
|
||||
#endif
|
||||
{ LFUN_TOC_INSERT, "toc-insert",
|
||||
N_("Insert table of contents"), Noop },
|
||||
{ LFUN_TOCVIEW, "toc-view",
|
||||
|
@ -153,7 +153,7 @@ PainterBase & PainterBase::rectText(int x, int baseline,
|
||||
rectangle(x, baseline - ascent, width, ascent + descent, frame);
|
||||
fillRectangle(x + 1, baseline - ascent + 1, width - 1,
|
||||
ascent + descent - 1, back);
|
||||
text(x + 2, baseline, str, font);
|
||||
text(x + 3, baseline, str, font);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
@ -74,9 +74,11 @@
|
||||
#include "insets/insetmarginal.h"
|
||||
#include "insets/insetminipage.h"
|
||||
#include "insets/insetfloat.h"
|
||||
#include "insets/insetlist.h"
|
||||
#include "insets/insettabular.h"
|
||||
#if 0
|
||||
#include "insets/insettheorem.h"
|
||||
#include "insets/insetlist.h"
|
||||
#endif
|
||||
#include "insets/insetcaption.h"
|
||||
#include "insets/insetfloatlist.h"
|
||||
#include "support/textutils.h"
|
||||
@ -1469,10 +1471,12 @@ void Buffer::readInset(LyXLex & lex, Paragraph *& par,
|
||||
lex.next();
|
||||
string tmptok = lex.GetString();
|
||||
inset = new InsetFloat(tmptok);
|
||||
#if 0
|
||||
} else if (tmptok == "List") {
|
||||
inset = new InsetList;
|
||||
} else if (tmptok == "Theorem") {
|
||||
inset = new InsetList;
|
||||
#endif
|
||||
} else if (tmptok == "Caption") {
|
||||
inset = new InsetCaption;
|
||||
} else if (tmptok == "GRAPHICS") {
|
||||
|
@ -277,8 +277,11 @@ enum kb_action {
|
||||
LFUN_INSET_MINIPAGE, // Lgb 20000627
|
||||
LFUN_INSET_FLOAT, // Lgb 20000627
|
||||
LFUN_INSET_WIDE_FLOAT, // Lgb 20010531
|
||||
// temporarily removed
|
||||
#if 0
|
||||
LFUN_INSET_LIST, // Lgb 20000627
|
||||
LFUN_INSET_THEOREM, // Lgb 20000630
|
||||
#endif
|
||||
LFUN_CITATION_CREATE, // 240 // Angus 20000705
|
||||
LFUN_INSET_CAPTION, // Lgb 20000718
|
||||
LFUN_SWITCHBUFFER, // and where is this comming from?
|
||||
|
@ -224,9 +224,11 @@ void lyxfont::rectText(string const & str, LyXFont const & font,
|
||||
void lyxfont::buttonText(string const & str, LyXFont const & font,
|
||||
int & width, int & ascent, int & descent)
|
||||
{
|
||||
width = lyxfont::width(str, font) + 8;
|
||||
ascent = lyxfont::maxAscent(font) + 3;
|
||||
descent = lyxfont::maxDescent(font) + 3;
|
||||
static int const d = 3;
|
||||
|
||||
width = lyxfont::width(str, font) + d * 2 + 2;
|
||||
ascent = lyxfont::maxAscent(font) + d;
|
||||
descent = lyxfont::maxDescent(font) + d;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,3 +1,17 @@
|
||||
2001-07-25 Lars Gullik Bjønnes <larsbj@birdstep.com>
|
||||
|
||||
* insetcollapsable.h: remove autocollapsable (no users), remove
|
||||
draw_label, change_label_with_text and companion code. Remove args
|
||||
from some methods.
|
||||
* insetert.[Ch]: move here instead (only user)
|
||||
|
||||
* inset.h: rename private variable name to name_, make
|
||||
selectNextWord return a const string. make getInsetName return a
|
||||
string const &. Remove bool from open, add close.
|
||||
|
||||
* Makefile.am: don't compile insetlist, insetsection
|
||||
and insettheorem
|
||||
|
||||
2001-07-24 Juergen Vigna <jug@sad.it>
|
||||
|
||||
* insetert.C (InsetERT): put init after the paragraph initialization,
|
||||
|
@ -52,8 +52,6 @@ libinsets_la_SOURCES = \
|
||||
insetlabel.h \
|
||||
insetlatexaccent.C \
|
||||
insetlatexaccent.h \
|
||||
insetlist.C \
|
||||
insetlist.h \
|
||||
insetmarginal.h \
|
||||
insetmarginal.C \
|
||||
insetminipage.C \
|
||||
@ -66,17 +64,19 @@ libinsets_la_SOURCES = \
|
||||
insetquotes.h \
|
||||
insetref.C \
|
||||
insetref.h \
|
||||
insetsection.h \
|
||||
insetsection.C \
|
||||
insetspecialchar.C \
|
||||
insetspecialchar.h \
|
||||
insettabular.C \
|
||||
insettabular.h \
|
||||
insettext.C \
|
||||
insettext.h \
|
||||
insettheorem.C \
|
||||
insettheorem.h \
|
||||
insettoc.C \
|
||||
insettoc.h \
|
||||
inseturl.C \
|
||||
inseturl.h
|
||||
# insetlist.C \
|
||||
# insetlist.h \
|
||||
# insetsection.h \
|
||||
# insetsection.C \
|
||||
# insettheorem.C \
|
||||
# insettheorem.h \
|
||||
|
@ -40,7 +40,7 @@ Inset::Inset()
|
||||
|
||||
|
||||
Inset::Inset(Inset const & in, bool same_id)
|
||||
: top_x(0), top_baseline(0), scx(0), owner_(0), name(in.name),
|
||||
: top_x(0), top_baseline(0), scx(0), owner_(0), name_(in.name_),
|
||||
background_color_(in.background_color_)
|
||||
{
|
||||
if (same_id)
|
||||
@ -311,12 +311,15 @@ int UpdatableInset::getMaxWidth(BufferView * bv, UpdatableInset const *) const
|
||||
return bv->workWidth();
|
||||
}
|
||||
|
||||
|
||||
LyXCursor const & Inset::cursor(BufferView * bv) const
|
||||
{
|
||||
return bv->text->cursor;
|
||||
}
|
||||
|
||||
string UpdatableInset::selectNextWord(BufferView *bv, float & value) const
|
||||
|
||||
string const UpdatableInset::selectNextWord(BufferView *bv,
|
||||
float & value) const
|
||||
{
|
||||
// we have to unlock ourself in this function by default!
|
||||
bv->unlockInset(const_cast<UpdatableInset *>(this));
|
||||
@ -324,6 +327,7 @@ string UpdatableInset::selectNextWord(BufferView *bv, float & value) const
|
||||
return string();
|
||||
}
|
||||
|
||||
|
||||
bool UpdatableInset::searchForward(BufferView * bv, string const &,
|
||||
bool const &, bool const &)
|
||||
{
|
||||
@ -332,6 +336,7 @@ bool UpdatableInset::searchForward(BufferView * bv, string const &,
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool UpdatableInset::searchBackward(BufferView * bv, string const &,
|
||||
bool const &, bool const &)
|
||||
{
|
||||
|
@ -96,8 +96,10 @@ public:
|
||||
TABULAR_CODE,
|
||||
///
|
||||
EXTERNAL_CODE,
|
||||
#if 0
|
||||
///
|
||||
THEOREM_CODE,
|
||||
#endif
|
||||
///
|
||||
CAPTION_CODE,
|
||||
///
|
||||
@ -220,9 +222,9 @@ public:
|
||||
///
|
||||
virtual bool needFullRow() const { return false; }
|
||||
///
|
||||
void setInsetName(string const & s) { name = s; }
|
||||
void setInsetName(string const & s) { name_ = s; }
|
||||
///
|
||||
string const getInsetName() const { return name; }
|
||||
string const & getInsetName() const { return name_; }
|
||||
///
|
||||
void setOwner(Inset * inset) { owner_ = inset; }
|
||||
///
|
||||
@ -276,8 +278,16 @@ public:
|
||||
/// used to toggle insets
|
||||
// is the inset open?
|
||||
virtual bool isOpen() const { return false; }
|
||||
// open or close the inset, depending on the bool
|
||||
#if 0
|
||||
/// open or close the inset, depending on the bool
|
||||
virtual void open(BufferView *, bool) {}
|
||||
#else
|
||||
/// open the inset
|
||||
virtual void open(BufferView *) {}
|
||||
#endif
|
||||
/// close the inset
|
||||
virtual void close(BufferView *) {}
|
||||
|
||||
protected:
|
||||
///
|
||||
mutable int top_x;
|
||||
@ -294,7 +304,7 @@ private:
|
||||
///
|
||||
Inset * owner_;
|
||||
///
|
||||
string name;
|
||||
string name_;
|
||||
///
|
||||
LColor::color background_color_;
|
||||
};
|
||||
@ -437,7 +447,7 @@ public:
|
||||
///
|
||||
// needed for spellchecking text
|
||||
///
|
||||
virtual string selectNextWord(BufferView *, float & value) const;
|
||||
virtual string const selectNextWord(BufferView *, float & value) const;
|
||||
virtual void selectSelectedWord(BufferView *) { return; }
|
||||
virtual void toggleSelection(BufferView *, bool /*kill_selection*/) {
|
||||
return;
|
||||
|
@ -36,9 +36,18 @@ using std::max;
|
||||
InsetCollapsable::InsetCollapsable(bool collapsed)
|
||||
: UpdatableInset(), collapsed_(collapsed),
|
||||
button_length(0), button_top_y(0), button_bottom_y(0),
|
||||
label("Label"), draw_label(label), autocollapse(false),
|
||||
label("Label"),
|
||||
#if 0
|
||||
draw_label(label),
|
||||
#endif
|
||||
#if 0
|
||||
autocollapse(false),
|
||||
#endif
|
||||
oldWidth(0), need_update(FULL),
|
||||
inlined(false), change_label_with_text(false)
|
||||
inlined(false)
|
||||
#if 0
|
||||
, change_label_with_text(false)
|
||||
#endif
|
||||
{
|
||||
inset.setOwner(this);
|
||||
inset.setAutoBreakRows(true);
|
||||
@ -52,9 +61,18 @@ InsetCollapsable::InsetCollapsable(InsetCollapsable const & in, bool same_id)
|
||||
: UpdatableInset(in, same_id), collapsed_(in.collapsed_),
|
||||
framecolor(in.framecolor), labelfont(in.labelfont),
|
||||
button_length(0), button_top_y(0), button_bottom_y(0),
|
||||
label(in.label), draw_label(label), autocollapse(in.autocollapse),
|
||||
label(in.label),
|
||||
#if 0
|
||||
draw_label(label),
|
||||
#endif
|
||||
#if 0
|
||||
autocollapse(in.autocollapse),
|
||||
#endif
|
||||
oldWidth(0), need_update(FULL),
|
||||
inlined(in.inlined), change_label_with_text(in.change_label_with_text)
|
||||
inlined(in.inlined)
|
||||
#if 0
|
||||
, change_label_with_text(in.change_label_with_text)
|
||||
#endif
|
||||
{
|
||||
inset.init(&(in.inset), same_id);
|
||||
inset.setOwner(this);
|
||||
@ -101,16 +119,18 @@ void InsetCollapsable::read(Buffer const * buf, LyXLex & lex)
|
||||
}
|
||||
}
|
||||
inset.read(buf, lex);
|
||||
#if 0
|
||||
if (collapsed_ && change_label_with_text) {
|
||||
draw_label = get_new_label();
|
||||
} else {
|
||||
draw_label = label;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
//int InsetCollapsable::ascent_collapsed(Painter & pain) const
|
||||
int InsetCollapsable::ascent_collapsed(Painter & /*pain*/) const
|
||||
int InsetCollapsable::ascent_collapsed() const
|
||||
{
|
||||
int width = 0;
|
||||
int ascent = 0;
|
||||
@ -119,14 +139,14 @@ int InsetCollapsable::ascent_collapsed(Painter & /*pain*/) const
|
||||
pain.buttonText(0, 0, draw_label, labelfont, false,
|
||||
width, ascent, descent);
|
||||
#else
|
||||
lyxfont::buttonText(draw_label, labelfont, width, ascent, descent);
|
||||
lyxfont::buttonText(label, labelfont, width, ascent, descent);
|
||||
#endif
|
||||
return ascent;
|
||||
}
|
||||
|
||||
|
||||
//int InsetCollapsable::descent_collapsed(Painter & pain) const
|
||||
int InsetCollapsable::descent_collapsed(Painter & /*pain*/) const
|
||||
int InsetCollapsable::descent_collapsed() const
|
||||
{
|
||||
int width = 0;
|
||||
int ascent = 0;
|
||||
@ -135,14 +155,14 @@ int InsetCollapsable::descent_collapsed(Painter & /*pain*/) const
|
||||
pain.buttonText(0, 0, draw_label, labelfont, false,
|
||||
width, ascent, descent);
|
||||
#else
|
||||
lyxfont::buttonText(draw_label, labelfont, width, ascent, descent);
|
||||
lyxfont::buttonText(label, labelfont, width, ascent, descent);
|
||||
#endif
|
||||
return descent;
|
||||
}
|
||||
|
||||
|
||||
//int InsetCollapsable::width_collapsed(Painter & pain) const
|
||||
int InsetCollapsable::width_collapsed(Painter & /*pain*/) const
|
||||
int InsetCollapsable::width_collapsed() const
|
||||
{
|
||||
int width;
|
||||
int ascent;
|
||||
@ -151,24 +171,24 @@ int InsetCollapsable::width_collapsed(Painter & /*pain*/) const
|
||||
pain.buttonText(TEXT_TO_INSET_OFFSET, 0, draw_label, labelfont, false,
|
||||
width, ascent, descent);
|
||||
#else
|
||||
lyxfont::buttonText(draw_label, labelfont, width, ascent, descent);
|
||||
lyxfont::buttonText(label, labelfont, width, ascent, descent);
|
||||
#endif
|
||||
return width + (2*TEXT_TO_INSET_OFFSET);
|
||||
}
|
||||
|
||||
|
||||
int InsetCollapsable::ascent(BufferView * bv, LyXFont const &) const
|
||||
int InsetCollapsable::ascent(BufferView * /*bv*/, LyXFont const &) const
|
||||
{
|
||||
return ascent_collapsed(bv->painter());
|
||||
return ascent_collapsed();
|
||||
}
|
||||
|
||||
|
||||
int InsetCollapsable::descent(BufferView * bv, LyXFont const & font) const
|
||||
{
|
||||
if (collapsed_)
|
||||
return descent_collapsed(bv->painter());
|
||||
return descent_collapsed();
|
||||
|
||||
return descent_collapsed(bv->painter())
|
||||
return descent_collapsed()
|
||||
+ inset.descent(bv, font)
|
||||
+ inset.ascent(bv, font)
|
||||
+ TEXT_TO_BOTTOM_OFFSET;
|
||||
@ -178,9 +198,9 @@ int InsetCollapsable::descent(BufferView * bv, LyXFont const & font) const
|
||||
int InsetCollapsable::width(BufferView * bv, LyXFont const & font) const
|
||||
{
|
||||
if (collapsed_)
|
||||
return width_collapsed(bv->painter());
|
||||
return width_collapsed();
|
||||
|
||||
int widthCollapsed = width_collapsed(bv->painter());
|
||||
int widthCollapsed = width_collapsed();
|
||||
|
||||
return (inset.width(bv, font) > widthCollapsed) ?
|
||||
inset.width(bv, font) : widthCollapsed;
|
||||
@ -193,14 +213,11 @@ void InsetCollapsable::draw_collapsed(Painter & pain, int baseline, float & x) c
|
||||
int width = 0;
|
||||
pain.buttonText(int(x) + TEXT_TO_INSET_OFFSET,
|
||||
baseline, draw_label, labelfont, true, width);
|
||||
#else
|
||||
pain.buttonText(int(x) + TEXT_TO_INSET_OFFSET,
|
||||
baseline, draw_label, labelfont);
|
||||
#endif
|
||||
#if 0
|
||||
x += width + TEXT_TO_INSET_OFFSET;
|
||||
#else
|
||||
x += width_collapsed(pain) + TEXT_TO_INSET_OFFSET;
|
||||
pain.buttonText(int(x) + TEXT_TO_INSET_OFFSET,
|
||||
baseline, label, labelfont);
|
||||
x += width_collapsed();
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -213,10 +230,10 @@ void InsetCollapsable::draw(BufferView * bv, LyXFont const & f,
|
||||
|
||||
Painter & pain = bv->painter();
|
||||
|
||||
button_length = width_collapsed(pain);
|
||||
button_length = width_collapsed();
|
||||
button_top_y = -ascent(bv, f);
|
||||
button_bottom_y = -ascent(bv, f) + ascent_collapsed(pain) +
|
||||
descent_collapsed(pain);
|
||||
button_bottom_y = -ascent(bv, f) + ascent_collapsed() +
|
||||
descent_collapsed();
|
||||
|
||||
if (collapsed_) {
|
||||
draw_collapsed(pain, baseline, x);
|
||||
@ -263,11 +280,11 @@ void InsetCollapsable::draw(BufferView * bv, LyXFont const & f,
|
||||
top_x = int(x);
|
||||
top_baseline = baseline;
|
||||
|
||||
int const bl = baseline - ascent(bv, f) + ascent_collapsed(pain);
|
||||
int const bl = baseline - ascent(bv, f) + ascent_collapsed();
|
||||
|
||||
draw_collapsed(pain, bl, old_x);
|
||||
inset.draw(bv, f,
|
||||
bl + descent_collapsed(pain) + inset.ascent(bv, f),
|
||||
bl + descent_collapsed() + inset.ascent(bv, f),
|
||||
x, cleared);
|
||||
need_update = NONE;
|
||||
}
|
||||
@ -279,7 +296,9 @@ void InsetCollapsable::edit(BufferView * bv, int xp, int yp,
|
||||
UpdatableInset::edit(bv, xp, yp, button);
|
||||
|
||||
if (collapsed_) {
|
||||
#if 0
|
||||
draw_label = label;
|
||||
#endif
|
||||
collapsed_ = false;
|
||||
if (!bv->lockInset(this))
|
||||
return;
|
||||
@ -293,8 +312,8 @@ void InsetCollapsable::edit(BufferView * bv, int xp, int yp,
|
||||
} else {
|
||||
LyXFont font(LyXFont::ALL_SANE);
|
||||
int yy = ascent(bv, font) + yp -
|
||||
(ascent_collapsed(bv->painter()) +
|
||||
descent_collapsed(bv->painter()) +
|
||||
(ascent_collapsed() +
|
||||
descent_collapsed() +
|
||||
inset.ascent(bv, font));
|
||||
inset.edit(bv, xp, yy, button);
|
||||
}
|
||||
@ -307,7 +326,9 @@ void InsetCollapsable::edit(BufferView * bv, bool front)
|
||||
UpdatableInset::edit(bv, front);
|
||||
|
||||
if (collapsed_) {
|
||||
#if 0
|
||||
draw_label = label;
|
||||
#endif
|
||||
collapsed_ = false;
|
||||
if (!bv->lockInset(this))
|
||||
return;
|
||||
@ -332,6 +353,7 @@ Inset::EDITABLE InsetCollapsable::editable() const
|
||||
|
||||
void InsetCollapsable::insetUnlock(BufferView * bv)
|
||||
{
|
||||
#if 0
|
||||
if (autocollapse) {
|
||||
if (change_label_with_text) {
|
||||
draw_label = get_new_label();
|
||||
@ -340,6 +362,7 @@ void InsetCollapsable::insetUnlock(BufferView * bv)
|
||||
}
|
||||
collapsed_ = true;
|
||||
}
|
||||
#endif
|
||||
inset.insetUnlock(bv);
|
||||
if (scroll())
|
||||
scroll(bv, 0.0F);
|
||||
@ -353,8 +376,8 @@ void InsetCollapsable::insetButtonPress(BufferView * bv, int x, int y,
|
||||
if (!collapsed_ && (y > button_bottom_y)) {
|
||||
LyXFont font(LyXFont::ALL_SANE);
|
||||
int yy = ascent(bv, font) + y -
|
||||
(ascent_collapsed(bv->painter()) +
|
||||
descent_collapsed(bv->painter()) +
|
||||
(ascent_collapsed() +
|
||||
descent_collapsed() +
|
||||
inset.ascent(bv, font));
|
||||
inset.insetButtonPress(bv, x, yy, button);
|
||||
}
|
||||
@ -367,17 +390,21 @@ void InsetCollapsable::insetButtonRelease(BufferView * bv,
|
||||
if ((x >= 0) && (x < button_length) &&
|
||||
(y >= button_top_y) && (y <= button_bottom_y)) {
|
||||
if (collapsed_) {
|
||||
#if 0
|
||||
draw_label = label;
|
||||
#endif
|
||||
collapsed_ = false;
|
||||
inset.insetButtonRelease(bv, 0, 0, button);
|
||||
inset.setUpdateStatus(bv, InsetText::FULL);
|
||||
bv->updateInset(this, false);
|
||||
} else {
|
||||
#if 0
|
||||
if (change_label_with_text) {
|
||||
draw_label = get_new_label();
|
||||
} else {
|
||||
draw_label = label;
|
||||
}
|
||||
#endif
|
||||
collapsed_ = true;
|
||||
bv->unlockInset(this);
|
||||
bv->updateInset(this, false);
|
||||
@ -385,8 +412,8 @@ void InsetCollapsable::insetButtonRelease(BufferView * bv,
|
||||
} else if (!collapsed_ && (y > button_bottom_y)) {
|
||||
LyXFont font(LyXFont::ALL_SANE);
|
||||
int yy = ascent(bv, font) + y -
|
||||
(ascent_collapsed(bv->painter()) +
|
||||
descent_collapsed(bv->painter()) +
|
||||
(ascent_collapsed() +
|
||||
descent_collapsed() +
|
||||
inset.ascent(bv, font));
|
||||
inset.insetButtonRelease(bv, x, yy, button);
|
||||
}
|
||||
@ -399,8 +426,8 @@ void InsetCollapsable::insetMotionNotify(BufferView * bv,
|
||||
if (y > button_bottom_y) {
|
||||
LyXFont font(LyXFont::ALL_SANE);
|
||||
int yy = ascent(bv, font) + y -
|
||||
(ascent_collapsed(bv->painter()) +
|
||||
descent_collapsed(bv->painter()) +
|
||||
(ascent_collapsed() +
|
||||
descent_collapsed() +
|
||||
inset.ascent(bv, font));
|
||||
inset.insetMotionNotify(bv, x, yy, state);
|
||||
}
|
||||
@ -431,7 +458,7 @@ int InsetCollapsable::getMaxWidth(BufferView * bv,
|
||||
return w;
|
||||
}
|
||||
// should be at least 30 pixels !!!
|
||||
return max(30, w - width_collapsed(bv->painter()));
|
||||
return max(30, w - width_collapsed());
|
||||
}
|
||||
|
||||
|
||||
@ -615,20 +642,43 @@ Inset * InsetCollapsable::getInsetFromID(int id_arg) const
|
||||
return inset.getInsetFromID(id_arg);
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
void InsetCollapsable::open(BufferView * bv, bool flag)
|
||||
{
|
||||
if (flag == !collapsed_)
|
||||
return;
|
||||
collapsed_ = !flag;
|
||||
#if 0
|
||||
if (collapsed_ && change_label_with_text) {
|
||||
draw_label = get_new_label();
|
||||
} else {
|
||||
draw_label = label;
|
||||
}
|
||||
#endif
|
||||
bv->updateInset(this, false);
|
||||
}
|
||||
#else
|
||||
void InsetCollapsable::open(BufferView * bv)
|
||||
{
|
||||
if (!collapsed_) return;
|
||||
|
||||
collapsed_ = false;
|
||||
bv->updateInset(this, false);
|
||||
}
|
||||
|
||||
|
||||
void InsetCollapsable::close(BufferView * bv)
|
||||
{
|
||||
if (collapsed_) return;
|
||||
|
||||
collapsed_ = true;
|
||||
bv->updateInset(this, false);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if 0
|
||||
void InsetCollapsable::setLabel(string const & l, bool flag)
|
||||
{
|
||||
label = l;
|
||||
@ -639,16 +689,24 @@ void InsetCollapsable::setLabel(string const & l, bool flag)
|
||||
draw_label = label;
|
||||
}
|
||||
}
|
||||
#else
|
||||
void InsetCollapsable::setLabel(string const & l)
|
||||
{
|
||||
label = l;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
string InsetCollapsable::get_new_label() const
|
||||
#if 0
|
||||
string const InsetCollapsable::get_new_label() const
|
||||
{
|
||||
string la;
|
||||
Paragraph::size_type const max_length = 15;
|
||||
|
||||
int n = std::min(max_length, inset.paragraph()->size());
|
||||
int i,j;
|
||||
for(i=0,j=0; i < n && j < inset.paragraph()->size(); ++j) {
|
||||
int i = 0;
|
||||
int j = 0;
|
||||
for(; i < n && j < inset.paragraph()->size(); ++j) {
|
||||
if (inset.paragraph()->isInset(j))
|
||||
continue;
|
||||
la += inset.paragraph()->getChar(j);
|
||||
@ -660,3 +718,4 @@ string InsetCollapsable::get_new_label() const
|
||||
la = label;
|
||||
return la;
|
||||
}
|
||||
#endif
|
||||
|
@ -130,12 +130,19 @@ public:
|
||||
///
|
||||
void setFont(BufferView *, LyXFont const &, bool toggleall = false,
|
||||
bool selectall = false);
|
||||
#if 0
|
||||
///
|
||||
void setLabel(string const & l, bool flag = false);
|
||||
#else
|
||||
///
|
||||
void setLabel(string const & l);
|
||||
#endif
|
||||
///
|
||||
void setLabelFont(LyXFont & f) { labelfont = f; }
|
||||
#if 0
|
||||
///
|
||||
void setAutoCollapse(bool f) { autocollapse = f; }
|
||||
#endif
|
||||
///
|
||||
int getMaxWidth(BufferView *, UpdatableInset const *) const;
|
||||
///
|
||||
@ -168,9 +175,17 @@ public:
|
||||
LyXCursor const & cursor(BufferView *) const;
|
||||
///
|
||||
bool isOpen() const { return !collapsed_; }
|
||||
void open(BufferView *, bool);
|
||||
#if 0
|
||||
///
|
||||
string selectNextWord(BufferView * bv, float & value) const {
|
||||
void open(BufferView *, bool);
|
||||
#else
|
||||
///
|
||||
void open(BufferView *);
|
||||
///
|
||||
void close(BufferView *);
|
||||
#endif
|
||||
///
|
||||
string const selectNextWord(BufferView * bv, float & value) const {
|
||||
return inset.selectNextWord(bv, value);
|
||||
}
|
||||
void selectSelectedWord(BufferView * bv) {
|
||||
@ -191,11 +206,11 @@ public:
|
||||
|
||||
protected:
|
||||
///
|
||||
int ascent_collapsed(Painter &) const;
|
||||
int ascent_collapsed() const;
|
||||
///
|
||||
int descent_collapsed(Painter &) const;
|
||||
int descent_collapsed() const;
|
||||
///
|
||||
int width_collapsed(Painter &) const;
|
||||
int width_collapsed() const;
|
||||
///
|
||||
void draw_collapsed(Painter & pain, int , float &) const;
|
||||
///
|
||||
@ -211,9 +226,10 @@ public:
|
||||
///
|
||||
InsetText inset;
|
||||
protected:
|
||||
#if 0
|
||||
///
|
||||
string get_new_label() const;
|
||||
|
||||
string const get_new_label() const;
|
||||
#endif
|
||||
///
|
||||
mutable int button_length;
|
||||
///
|
||||
@ -223,10 +239,14 @@ protected:
|
||||
private:
|
||||
///
|
||||
string label;
|
||||
#if 0
|
||||
///
|
||||
mutable string draw_label;
|
||||
#endif
|
||||
#if 0
|
||||
///
|
||||
bool autocollapse;
|
||||
#endif
|
||||
///
|
||||
mutable int oldWidth;
|
||||
///
|
||||
@ -235,8 +255,10 @@ private:
|
||||
mutable UpdateCodes need_update;
|
||||
///
|
||||
bool inlined;
|
||||
#if 0
|
||||
///
|
||||
bool change_label_with_text;
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -27,7 +27,11 @@ using std::ostream;
|
||||
|
||||
void InsetERT::init()
|
||||
{
|
||||
#if 0
|
||||
setLabel(_("666"), true);
|
||||
#else
|
||||
setLabel(_("666"));
|
||||
#endif
|
||||
labelfont = LyXFont(LyXFont::ALL_SANE);
|
||||
labelfont.decSize();
|
||||
labelfont.decSize();
|
||||
@ -72,6 +76,17 @@ InsetERT::InsetERT(string const & contents, bool collapsed)
|
||||
}
|
||||
|
||||
|
||||
void InsetERT::read(Buffer const * buf, LyXLex & lex)
|
||||
{
|
||||
InsetCollapsable::read(buf, lex);
|
||||
if (collapsed_) {
|
||||
setLabel(get_new_label());
|
||||
} else {
|
||||
setLabel(_("666"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void InsetERT::write(Buffer const * buf, ostream & os) const
|
||||
{
|
||||
os << getInsetName() << "\n";
|
||||
@ -123,6 +138,21 @@ void InsetERT::edit(BufferView * bv, bool)
|
||||
}
|
||||
|
||||
|
||||
void InsetERT::insetButtonRelease(BufferView * bv,
|
||||
int x, int y, int button)
|
||||
{
|
||||
if ((x >= 0) && (x < button_length) &&
|
||||
(y >= button_top_y) && (y <= button_bottom_y)) {
|
||||
if (collapsed_) {
|
||||
setLabel(_("666"));
|
||||
} else {
|
||||
setLabel(get_new_label());
|
||||
}
|
||||
}
|
||||
InsetCollapsable::insetButtonRelease(bv, x, y, button);
|
||||
}
|
||||
|
||||
|
||||
int InsetERT::latex(Buffer const *, std::ostream & os, bool /*fragile*/,
|
||||
bool /*free_spc*/) const
|
||||
{
|
||||
@ -180,7 +210,8 @@ InsetERT::localDispatch(BufferView * bv, kb_action action, string const & arg)
|
||||
}
|
||||
switch(action) {
|
||||
case LFUN_BREAKPARAGRAPH:
|
||||
case LFUN_BREAKPARAGRAPHKEEPLAYOUT: {
|
||||
case LFUN_BREAKPARAGRAPHKEEPLAYOUT:
|
||||
{
|
||||
#ifndef NO_LATEX
|
||||
LyXFont font(LyXFont::ALL_SANE);
|
||||
font.setLatex (LyXFont::ON);
|
||||
@ -191,9 +222,32 @@ InsetERT::localDispatch(BufferView * bv, kb_action action, string const & arg)
|
||||
#endif
|
||||
inset.setFont(bv, font);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
string const InsetERT::get_new_label() const
|
||||
{
|
||||
string la;
|
||||
Paragraph::size_type const max_length = 15;
|
||||
|
||||
int const n = std::min(max_length, inset.paragraph()->size());
|
||||
int i = 0;
|
||||
int j = 0;
|
||||
for(; i < n && j < inset.paragraph()->size(); ++j) {
|
||||
if (inset.paragraph()->isInset(j))
|
||||
continue;
|
||||
la += inset.paragraph()->getChar(j);
|
||||
++i;
|
||||
}
|
||||
if ((i > 0) && (j < inset.paragraph()->size()))
|
||||
la += "...";
|
||||
if (la.empty())
|
||||
la = _("666");
|
||||
return la;
|
||||
}
|
||||
|
@ -20,7 +20,7 @@
|
||||
|
||||
#include "insetcollapsable.h"
|
||||
|
||||
/** A colapsable text inset
|
||||
/** A collapsable text inset for LaTeX insertions.
|
||||
|
||||
To write full ert (including styles and other insets) in a given
|
||||
space.
|
||||
@ -32,6 +32,8 @@ public:
|
||||
///
|
||||
InsetERT(string const & contents, bool collapsed);
|
||||
///
|
||||
void read(Buffer const * buf, LyXLex & lex);
|
||||
///
|
||||
void write(Buffer const * buf, std::ostream & os) const;
|
||||
///
|
||||
string const editMessage() const;
|
||||
@ -47,8 +49,10 @@ public:
|
||||
///
|
||||
void edit(BufferView * bv, bool front = true);
|
||||
///
|
||||
void insetButtonRelease(BufferView * bv, int x, int y, int button);
|
||||
///
|
||||
int latex(Buffer const *, std::ostream &, bool fragile,
|
||||
bool free_spc) const;
|
||||
bool free_spc) const;
|
||||
///
|
||||
int ascii(Buffer const *,
|
||||
std::ostream &, int linelen = 0) const;
|
||||
@ -62,6 +66,8 @@ public:
|
||||
private:
|
||||
///
|
||||
void init();
|
||||
///
|
||||
string const get_new_label() const;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -29,7 +29,9 @@ InsetFootlike::InsetFootlike()
|
||||
font.decSize();
|
||||
font.setColor(LColor::collapsable);
|
||||
setLabelFont(font);
|
||||
#if 0
|
||||
setAutoCollapse(false);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -45,7 +45,9 @@ InsetList::InsetList()
|
||||
font.decSize();
|
||||
font.setColor(LColor::collapsable);
|
||||
setLabelFont(font);
|
||||
#if 0
|
||||
setAutoCollapse(false);
|
||||
#endif
|
||||
setInsetName("List");
|
||||
}
|
||||
|
||||
|
@ -68,7 +68,9 @@ InsetMinipage::InsetMinipage()
|
||||
font.decSize();
|
||||
font.setColor(LColor::collapsable);
|
||||
setLabelFont(font);
|
||||
#if 0
|
||||
setAutoCollapse(false);
|
||||
#endif
|
||||
// just for experimentation :)
|
||||
setBackgroundColor(LColor::red);
|
||||
setInsetName("Minipage");
|
||||
@ -173,7 +175,7 @@ void InsetMinipage::read(Buffer const * buf, LyXLex & lex)
|
||||
int InsetMinipage::ascent(BufferView * bv, LyXFont const & font) const
|
||||
{
|
||||
if (collapsed_)
|
||||
return ascent_collapsed(bv->painter());
|
||||
return ascent_collapsed();
|
||||
else {
|
||||
// Take placement into account.
|
||||
int i = 0;
|
||||
@ -197,7 +199,7 @@ int InsetMinipage::ascent(BufferView * bv, LyXFont const & font) const
|
||||
int InsetMinipage::descent(BufferView * bv, LyXFont const & font) const
|
||||
{
|
||||
if (collapsed_)
|
||||
return descent_collapsed(bv->painter());
|
||||
return descent_collapsed();
|
||||
else {
|
||||
// Take placement into account.
|
||||
int i = 0;
|
||||
|
@ -33,8 +33,9 @@ void InsetNote::init()
|
||||
font.decSize();
|
||||
font.setColor(LColor::note);
|
||||
setLabelFont(font);
|
||||
|
||||
#if 0
|
||||
setAutoCollapse(false);
|
||||
#endif
|
||||
setBackgroundColor(LColor::note);
|
||||
|
||||
setLabel(_("note"));
|
||||
|
@ -1279,6 +1279,7 @@ void InsetTabular::setPos(BufferView * bv, int x, int y) const
|
||||
tabular->GetAdditionalWidth(actcell - 1));
|
||||
#else
|
||||
// Jürgen, you should check that this is correct. (Lgb)
|
||||
#warning Jürgen, please check. (Lgb)
|
||||
for (; !tabular->IsLastCellInRow(actcell) && lx < x; ++actcell) {
|
||||
lx += tabular->GetWidthOfColumn(actcell + 1)
|
||||
+ tabular->GetAdditionalWidth(actcell);
|
||||
@ -1502,10 +1503,8 @@ bool InsetTabular::movePrevCell(BufferView * bv, bool lock)
|
||||
}
|
||||
|
||||
|
||||
bool InsetTabular::Delete()
|
||||
bool InsetTabular::deletable()
|
||||
{
|
||||
#warning Is this func correctly named? Or should it be "deletable"? (Lgb?)
|
||||
#warning I guess this could be 'deletable'! (Jug)
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -2029,6 +2028,7 @@ void InsetTabular::openLayoutDialog(BufferView * bv) const
|
||||
const_cast<InsetTabular *>(this));
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// functions returns:
|
||||
// 0 ... disabled
|
||||
@ -2340,11 +2340,6 @@ bool InsetTabular::cutSelection()
|
||||
if (!hasSelection())
|
||||
return false;
|
||||
|
||||
//int sel_col_start;
|
||||
//int sel_col_end;
|
||||
//int sel_row_start;
|
||||
//int sel_row_end;
|
||||
|
||||
int sel_col_start = tabular->column_of_cell(sel_cell_start);
|
||||
int sel_col_end = tabular->column_of_cell(sel_cell_end);
|
||||
if (sel_col_start > sel_col_end) {
|
||||
@ -2356,15 +2351,9 @@ bool InsetTabular::cutSelection()
|
||||
int sel_row_start = tabular->row_of_cell(sel_cell_start);
|
||||
int sel_row_end = tabular->row_of_cell(sel_cell_end);
|
||||
if (sel_row_start > sel_row_end) {
|
||||
//int tmp = sel_row_start;
|
||||
//sel_row_start = sel_row_end;
|
||||
//sel_row_end = tmp;
|
||||
swap(sel_row_start, sel_row_end);
|
||||
}
|
||||
if (sel_cell_start > sel_cell_end) {
|
||||
//int tmp = sel_cell_start;
|
||||
//sel_cell_start = sel_cell_end;
|
||||
//sel_cell_end = tmp;
|
||||
swap(sel_cell_start, sel_cell_end);
|
||||
}
|
||||
for (int i = sel_row_start; i <= sel_row_end; ++i) {
|
||||
@ -2422,6 +2411,7 @@ void InsetTabular::getSelection(int & srow, int & erow, int & scol, int & ecol)
|
||||
ecol = tabular->right_column_of_cell(sel_cell_end);
|
||||
}
|
||||
|
||||
|
||||
Paragraph * InsetTabular::getParFromID(int id) const
|
||||
{
|
||||
Paragraph * result;
|
||||
@ -2434,6 +2424,7 @@ Paragraph * InsetTabular::getParFromID(int id) const
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Paragraph * InsetTabular::firstParagraph() const
|
||||
{
|
||||
if (the_locking_inset)
|
||||
@ -2441,6 +2432,7 @@ Paragraph * InsetTabular::firstParagraph() const
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
LyXCursor const & InsetTabular::cursor(BufferView * bv) const
|
||||
{
|
||||
if (the_locking_inset)
|
||||
@ -2465,11 +2457,10 @@ Inset * InsetTabular::getInsetFromID(int id_arg) const
|
||||
}
|
||||
|
||||
|
||||
string InsetTabular::selectNextWord(BufferView * bv, float & value) const
|
||||
string const InsetTabular::selectNextWord(BufferView * bv, float & value) const
|
||||
{
|
||||
if (the_locking_inset) {
|
||||
string str;
|
||||
str = the_locking_inset->selectNextWord(bv, value);
|
||||
string const str(the_locking_inset->selectNextWord(bv, value));
|
||||
if (!str.empty())
|
||||
return str;
|
||||
if (tabular->IsLastCell(actcell)) {
|
||||
@ -2483,19 +2474,19 @@ string InsetTabular::selectNextWord(BufferView * bv, float & value) const
|
||||
UpdatableInset * inset =
|
||||
static_cast<UpdatableInset*>(tabular->GetCellInset(actcell));
|
||||
inset->edit(bv, 0, 0, 0);
|
||||
string str = selectNextWordInt(bv, value);
|
||||
string const str(selectNextWordInt(bv, value));
|
||||
if (!str.empty())
|
||||
resetPos(bv);
|
||||
return str;
|
||||
}
|
||||
|
||||
|
||||
string InsetTabular::selectNextWordInt(BufferView * bv, float & value) const
|
||||
{
|
||||
// when entering this function the inset should be ALWAYS locked!
|
||||
lyx::Assert(the_locking_inset);
|
||||
|
||||
string str;
|
||||
str = the_locking_inset->selectNextWord(bv, value);
|
||||
string const str(the_locking_inset->selectNextWord(bv, value));
|
||||
if (!str.empty())
|
||||
return str;
|
||||
|
||||
@ -2521,6 +2512,7 @@ void InsetTabular::selectSelectedWord(BufferView * bv)
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
void InsetTabular::toggleSelection(BufferView * bv, bool kill_selection)
|
||||
{
|
||||
if (the_locking_inset) {
|
||||
@ -2546,13 +2538,14 @@ bool InsetTabular::searchForward(BufferView * bv, string const & str,
|
||||
UpdatableInset * inset =
|
||||
static_cast<UpdatableInset*>(tabular->GetCellInset(actcell));
|
||||
inset->edit(bv);
|
||||
bool res = searchForward(bv, str, cs, mw);
|
||||
bool const res = searchForward(bv, str, cs, mw);
|
||||
updateLocal(bv, NONE, false);
|
||||
nodraw(false);
|
||||
bv->updateInset(const_cast<InsetTabular *>(this), false);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
bool InsetTabular::searchBackward(BufferView * bv, string const & str,
|
||||
bool const & cs, bool const & mw)
|
||||
{
|
||||
@ -2570,7 +2563,7 @@ bool InsetTabular::searchBackward(BufferView * bv, string const & str,
|
||||
UpdatableInset * inset =
|
||||
static_cast<UpdatableInset*>(tabular->GetCellInset(actcell));
|
||||
inset->edit(bv, false);
|
||||
bool res = searchBackward(bv, str, cs, mw);
|
||||
bool const res = searchBackward(bv, str, cs, mw);
|
||||
nodraw(false);
|
||||
bv->updateInset(const_cast<InsetTabular *>(this), false);
|
||||
return res;
|
||||
|
@ -212,7 +212,7 @@ public:
|
||||
///
|
||||
LyXCursor const & cursor(BufferView *) const;
|
||||
///
|
||||
string selectNextWord(BufferView *, float & value) const;
|
||||
string const selectNextWord(BufferView *, float & value) const;
|
||||
void selectSelectedWord(BufferView *);
|
||||
void toggleSelection(BufferView *, bool kill_selection);
|
||||
///
|
||||
@ -256,8 +256,8 @@ private:
|
||||
bool moveNextCell(BufferView *, bool lock = false);
|
||||
///
|
||||
bool movePrevCell(BufferView *, bool lock = false);
|
||||
/// Delete what?
|
||||
bool Delete();
|
||||
///
|
||||
bool deletable();
|
||||
///
|
||||
int getCellXPos(int cell) const;
|
||||
///
|
||||
@ -294,7 +294,8 @@ private:
|
||||
///
|
||||
bool isRightToLeft(BufferView *);
|
||||
///
|
||||
void getSelection(int & scol, int & ecol, int & srow, int & erow) const;
|
||||
void getSelection(int & scol, int & ecol,
|
||||
int & srow, int & erow) const;
|
||||
///
|
||||
string selectNextWordInt(BufferView *, float & value) const;
|
||||
|
||||
|
@ -2028,7 +2028,7 @@ Inset * InsetText::getInsetFromID(int id_arg) const
|
||||
}
|
||||
|
||||
|
||||
string InsetText::selectNextWord(BufferView * bv, float & value) const
|
||||
string const InsetText::selectNextWord(BufferView * bv, float & value) const
|
||||
{
|
||||
bool clear = false;
|
||||
string str;
|
||||
|
@ -225,7 +225,7 @@ public:
|
||||
///
|
||||
void paragraph(Paragraph *);
|
||||
///
|
||||
string selectNextWord(BufferView *, float & value) const;
|
||||
string const selectNextWord(BufferView *, float & value) const;
|
||||
void selectSelectedWord(BufferView *);
|
||||
void toggleSelection(BufferView *, bool kill_selection);
|
||||
///
|
||||
|
@ -42,7 +42,9 @@ InsetTheorem::InsetTheorem()
|
||||
font.decSize();
|
||||
font.setColor(LColor::collapsable);
|
||||
setLabelFont(font);
|
||||
#if 0
|
||||
setAutoCollapse(false);
|
||||
#endif
|
||||
setInsetName("Theorem");
|
||||
}
|
||||
|
||||
|
@ -12,8 +12,14 @@
|
||||
|
||||
#include "Lsstream.h"
|
||||
|
||||
#if 0
|
||||
#include <time.h>
|
||||
#include <locale.h>
|
||||
#else
|
||||
#include <ctime>
|
||||
#include <clocale>
|
||||
#endif
|
||||
|
||||
#include <utility>
|
||||
#include <algorithm>
|
||||
|
||||
@ -53,9 +59,11 @@
|
||||
#include "insets/insetmarginal.h"
|
||||
#include "insets/insetminipage.h"
|
||||
#include "insets/insetfloat.h"
|
||||
#if 0
|
||||
#include "insets/insetlist.h"
|
||||
#include "insets/insettabular.h"
|
||||
#include "insets/insettheorem.h"
|
||||
#endif
|
||||
#include "insets/insettabular.h"
|
||||
#include "insets/insetcaption.h"
|
||||
#include "mathed/formulamacro.h"
|
||||
#include "mathed/math_cursor.h"
|
||||
@ -631,10 +639,10 @@ func_status::value_type LyXFunc::getStatus(int ac,
|
||||
case LFUN_INSET_LIST:
|
||||
code = Inset::LIST_CODE;
|
||||
break;
|
||||
#endif
|
||||
case LFUN_INSET_THEOREM:
|
||||
code = Inset::THEOREM_CODE;
|
||||
break;
|
||||
#endif
|
||||
case LFUN_INSET_CAPTION:
|
||||
code = Inset::CAPTION_CODE;
|
||||
break;
|
||||
@ -797,9 +805,13 @@ string const LyXFunc::dispatch(int ac,
|
||||
owner->view()->hideCursor();
|
||||
|
||||
// We cannot use this function here
|
||||
if (getStatus(ac, do_not_use_this_arg) & func_status::Disabled)
|
||||
if (getStatus(ac, do_not_use_this_arg) & func_status::Disabled) {
|
||||
lyxerr << "LyXFunc::Dispatch: "
|
||||
<< lyxaction.getActionName(ac)
|
||||
<< " [" << ac << "] is disabled ad this location"
|
||||
<< endl;
|
||||
goto exit_with_message;
|
||||
|
||||
}
|
||||
|
||||
if (owner->view()->available() && owner->view()->theLockingInset()) {
|
||||
UpdatableInset::RESULT result;
|
||||
|
10
src/text2.C
10
src/text2.C
@ -372,6 +372,7 @@ void LyXText::insertParagraph(BufferView * bview, Paragraph * par,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Inset * LyXText::getInset() const
|
||||
{
|
||||
Inset * inset = 0;
|
||||
@ -384,6 +385,7 @@ Inset * LyXText::getInset() const
|
||||
return inset;
|
||||
}
|
||||
|
||||
|
||||
void LyXText::toggleInset(BufferView * bview)
|
||||
{
|
||||
Inset * inset = getInset();
|
||||
@ -394,7 +396,15 @@ void LyXText::toggleInset(BufferView * bview)
|
||||
// do we want to keep this?? (JMarc)
|
||||
if (inset->editable() != Inset::HIGHLY_EDITABLE)
|
||||
setCursorParUndo(bview);
|
||||
|
||||
if (inset->isOpen()) {
|
||||
inset->close(bview);
|
||||
} else {
|
||||
inset->open(bview);
|
||||
}
|
||||
#if 0
|
||||
inset->open(bview, !inset->isOpen());
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user