#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"
}
break;
+#if 0
case LFUN_INSET_LIST:
insertAndEditInset(new InsetList);
break;
case LFUN_INSET_THEOREM:
insertAndEditInset(new InsetTheorem);
break;
-
+#endif
+
case LFUN_INSET_CAPTION:
{
// Do we have a locking inset...
+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.
{ 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 },
#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",
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;
}
#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"
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") {
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?
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;
}
+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,
insetlabel.h \
insetlatexaccent.C \
insetlatexaccent.h \
- insetlist.C \
- insetlist.h \
insetmarginal.h \
insetmarginal.C \
insetminipage.C \
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 \
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)
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));
return string();
}
+
bool UpdatableInset::searchForward(BufferView * bv, string const &,
bool const &, bool const &)
{
return false;
}
+
bool UpdatableInset::searchBackward(BufferView * bv, string const &,
bool const &, bool const &)
{
TABULAR_CODE,
///
EXTERNAL_CODE,
+#if 0
///
THEOREM_CODE,
+#endif
///
CAPTION_CODE,
///
///
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; }
///
/// 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;
///
Inset * owner_;
///
- string name;
+ string name_;
///
LColor::color background_color_;
};
///
// 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;
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);
: 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);
}
}
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;
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;
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;
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;
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;
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
}
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);
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;
}
UpdatableInset::edit(bv, xp, yp, button);
if (collapsed_) {
+#if 0
draw_label = label;
+#endif
collapsed_ = false;
if (!bv->lockInset(this))
return;
} 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);
}
UpdatableInset::edit(bv, front);
if (collapsed_) {
+#if 0
draw_label = label;
+#endif
collapsed_ = false;
if (!bv->lockInset(this))
return;
void InsetCollapsable::insetUnlock(BufferView * bv)
{
+#if 0
if (autocollapse) {
if (change_label_with_text) {
draw_label = get_new_label();
}
collapsed_ = true;
}
+#endif
inset.insetUnlock(bv);
if (scroll())
scroll(bv, 0.0F);
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);
}
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);
} 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);
}
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);
}
return w;
}
// should be at least 30 pixels !!!
- return max(30, w - width_collapsed(bv->painter()));
+ return max(30, w - width_collapsed());
}
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;
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);
la = label;
return la;
}
+#endif
///
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;
///
LyXCursor const & cursor(BufferView *) const;
///
bool isOpen() const { return !collapsed_; }
+#if 0
+ ///
void open(BufferView *, bool);
+#else
+ ///
+ void open(BufferView *);
+ ///
+ void close(BufferView *);
+#endif
///
- string selectNextWord(BufferView * bv, float & value) const {
+ string const selectNextWord(BufferView * bv, float & value) const {
return inset.selectNextWord(bv, value);
}
void selectSelectedWord(BufferView * bv) {
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;
///
///
InsetText inset;
protected:
+#if 0
///
- string get_new_label() const;
-
+ string const get_new_label() const;
+#endif
///
mutable int button_length;
///
private:
///
string label;
+#if 0
///
mutable string draw_label;
+#endif
+#if 0
///
bool autocollapse;
+#endif
///
mutable int oldWidth;
///
mutable UpdateCodes need_update;
///
bool inlined;
+#if 0
///
bool change_label_with_text;
+#endif
};
#endif
void InsetERT::init()
{
+#if 0
setLabel(_("666"), true);
+#else
+ setLabel(_("666"));
+#endif
labelfont = LyXFont(LyXFont::ALL_SANE);
labelfont.decSize();
labelfont.decSize();
}
+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";
}
+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
{
}
switch(action) {
case LFUN_BREAKPARAGRAPH:
- case LFUN_BREAKPARAGRAPHKEEPLAYOUT: {
+ case LFUN_BREAKPARAGRAPHKEEPLAYOUT:
+ {
#ifndef NO_LATEX
LyXFont font(LyXFont::ALL_SANE);
font.setLatex (LyXFont::ON);
#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;
+}
#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.
///
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;
///
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;
private:
///
void init();
+ ///
+ string const get_new_label() const;
};
#endif
font.decSize();
font.setColor(LColor::collapsable);
setLabelFont(font);
+#if 0
setAutoCollapse(false);
+#endif
}
font.decSize();
font.setColor(LColor::collapsable);
setLabelFont(font);
+#if 0
setAutoCollapse(false);
+#endif
setInsetName("List");
}
font.decSize();
font.setColor(LColor::collapsable);
setLabelFont(font);
+#if 0
setAutoCollapse(false);
+#endif
// just for experimentation :)
setBackgroundColor(LColor::red);
setInsetName("Minipage");
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;
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;
font.decSize();
font.setColor(LColor::note);
setLabelFont(font);
-
+#if 0
setAutoCollapse(false);
+#endif
setBackgroundColor(LColor::note);
setLabel(_("note"));
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);
}
-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;
}
const_cast<InsetTabular *>(this));
}
+
//
// functions returns:
// 0 ... disabled
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) {
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) {
ecol = tabular->right_column_of_cell(sel_cell_end);
}
+
Paragraph * InsetTabular::getParFromID(int id) const
{
Paragraph * result;
return 0;
}
+
Paragraph * InsetTabular::firstParagraph() const
{
if (the_locking_inset)
return 0;
}
+
LyXCursor const & InsetTabular::cursor(BufferView * bv) const
{
if (the_locking_inset)
}
-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)) {
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;
return;
}
+
void InsetTabular::toggleSelection(BufferView * bv, bool kill_selection)
{
if (the_locking_inset) {
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)
{
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;
///
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);
///
bool moveNextCell(BufferView *, bool lock = false);
///
bool movePrevCell(BufferView *, bool lock = false);
- /// Delete what?
- bool Delete();
+ ///
+ bool deletable();
///
int getCellXPos(int cell) const;
///
///
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;
}
-string InsetText::selectNextWord(BufferView * bv, float & value) const
+string const InsetText::selectNextWord(BufferView * bv, float & value) const
{
bool clear = false;
string str;
///
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);
///
font.decSize();
font.setColor(LColor::collapsable);
setLabelFont(font);
+#if 0
setAutoCollapse(false);
+#endif
setInsetName("Theorem");
}
#include "Lsstream.h"
+#if 0
#include <time.h>
#include <locale.h>
+#else
+#include <ctime>
+#include <clocale>
+#endif
+
#include <utility>
#include <algorithm>
#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"
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;
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;
}
}
+
Inset * LyXText::getInset() const
{
Inset * inset = 0;
return inset;
}
+
void LyXText::toggleInset(BufferView * bview)
{
Inset * inset = getInset();
// 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
}