updates to minipage inset

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1756 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 2001-03-14 14:53:55 +00:00
parent 9356012089
commit a097c6236f
5 changed files with 102 additions and 9 deletions

View File

@ -1,3 +1,8 @@
2001-03-14 Lars Gullik Bjønnes <larsbj@trylle.birdstep.com>
* insetminipage.h: add pos, inner_pos, width and height. + getters
and setters for all of them.
2001-03-13 Dekel Tsur <dekelts@tau.ac.il> 2001-03-13 Dekel Tsur <dekelts@tau.ac.il>
* insetinclude.C (Latex): Do not exit when the textclass of the * insetinclude.C (Latex): Do not exit when the textclass of the

View File

@ -3,7 +3,7 @@
* *
* LyX, The Document Processor * LyX, The Document Processor
* *
* Copyright (C) 1998 The LyX Team. * Copyright 1998-2001 The LyX Team.
* *
* ====================================================== * ======================================================
*/ */
@ -32,9 +32,9 @@ using std::endl;
using std::max; using std::max;
InsetCollapsable::InsetCollapsable() InsetCollapsable::InsetCollapsable()
: UpdatableInset() : UpdatableInset(), inset(new InsetText)
{ {
inset = new InsetText; //inset = new InsetText;
inset->setOwner(this); inset->setOwner(this);
collapsed = true; collapsed = true;
label = "Label"; label = "Label";
@ -84,7 +84,7 @@ void InsetCollapsable::Read(Buffer const * buf, LyXLex & lex)
{ {
if (lex.IsOK()) { if (lex.IsOK()) {
lex.next(); lex.next();
string token = lex.GetString(); string const token = lex.GetString();
if (token == "collapsed") { if (token == "collapsed") {
lex.next(); lex.next();
collapsed = lex.GetBool(); collapsed = lex.GetBool();
@ -222,7 +222,7 @@ void InsetCollapsable::Edit(BufferView * bv, int x, int y, unsigned int button)
} else if (!collapsed) { } else if (!collapsed) {
if (!bv->lockInset(this)) if (!bv->lockInset(this))
return; return;
inset->Edit(bv, x-widthCollapsed, y, button); inset->Edit(bv, x - widthCollapsed, y, button);
} }
} }
@ -248,7 +248,7 @@ void InsetCollapsable::InsetUnlock(BufferView * bv)
void InsetCollapsable::InsetButtonPress(BufferView * bv,int x,int y,int button) void InsetCollapsable::InsetButtonPress(BufferView * bv,int x,int y,int button)
{ {
if (!collapsed && (x >= button_length)) { if (!collapsed && (x >= button_length)) {
inset->InsetButtonPress(bv, x-widthCollapsed, y, button); inset->InsetButtonPress(bv, x - widthCollapsed, y, button);
} }
} }
@ -268,7 +268,7 @@ void InsetCollapsable::InsetButtonRelease(BufferView * bv,
bv->updateInset(this, false); bv->updateInset(this, false);
} }
} else if (!collapsed && (x >= button_length) && (y >= button_top_y)) { } else if (!collapsed && (x >= button_length) && (y >= button_top_y)) {
inset->InsetButtonRelease(bv, x-widthCollapsed, y, button); inset->InsetButtonRelease(bv, x - widthCollapsed, y, button);
} }
} }

View File

@ -40,7 +40,7 @@ InsetExternal::InsetExternal()
: view(0) : view(0)
{ {
tempname = lyx::tempName(string(), "lyxext"); tempname = lyx::tempName(string(), "lyxext");
ExternalTemplateManager::Templates::const_iterator i1; //ExternalTemplateManager::Templates::const_iterator i1;
params_.templ = ExternalTemplateManager::get().getTemplates().begin()->second; params_.templ = ExternalTemplateManager::get().getTemplates().begin()->second;
} }

View File

@ -55,7 +55,8 @@ using std::endl;
// (Lgb) // (Lgb)
InsetMinipage::InsetMinipage() InsetMinipage::InsetMinipage()
: InsetCollapsable() : InsetCollapsable(), pos_(center),
inner_pos_(inner_center)
{ {
setLabel(_("minipage")); setLabel(_("minipage"));
LyXFont font(LyXFont::ALL_SANE); LyXFont font(LyXFont::ALL_SANE);
@ -111,3 +112,51 @@ bool InsetMinipage::InsertInsetAllowed(Inset * in) const
} }
return true; return true;
} }
InsetMinipage::Position InsetMinipage::pos() const
{
return pos_;
}
void InsetMinipage::pos(InsetMinipage::Position p)
{
pos_ = p;
}
InsetMinipage::InnerPosition InsetMinipage::innerPos() const
{
return inner_pos_;
}
void InsetMinipage::innerPos(InsetMinipage::InnerPosition ip)
{
inner_pos_ = ip;
}
LyXLength const & InsetMinipage::height() const
{
return height_;
}
void InsetMinipage::height(LyXLength const & ll)
{
height_ = ll;
}
LyXLength const & InsetMinipage::width() const
{
return width_;
}
void InsetMinipage::width(LyXLength const & ll)
{
width_ = ll;
}

View File

@ -17,12 +17,26 @@
#endif #endif
#include "insetcollapsable.h" #include "insetcollapsable.h"
#include "vspace.h"
/** The minipage inset /** The minipage inset
*/ */
class InsetMinipage : public InsetCollapsable { class InsetMinipage : public InsetCollapsable {
public: public:
///
enum Position {
center,
top,
bottom
};
///
enum InnerPosition {
inner_center,
inner_top,
inner_bottom,
inner_stretch
};
/// ///
InsetMinipage(); InsetMinipage();
/// ///
@ -37,6 +51,31 @@ public:
string const EditMessage() const; string const EditMessage() const;
/// ///
bool InsertInsetAllowed(Inset * inset) const; bool InsertInsetAllowed(Inset * inset) const;
///
Position pos() const;
///
void pos(Position);
///
InnerPosition innerPos() const;
///
void innerPos(InnerPosition);
///
LyXLength const & height() const;
///
void height(LyXLength const &);
///
LyXLength const & width() const;
///
void width(LyXLength const &);
private:
///
Position pos_;
///
InnerPosition inner_pos_;
///
LyXLength height_;
///
LyXLength width_;
}; };
#endif #endif