2001-03-27 16:03:28 +00:00
|
|
|
|
/* This file is part of
|
|
|
|
|
* ======================================================
|
|
|
|
|
*
|
|
|
|
|
* LyX, The Document Processor
|
|
|
|
|
*
|
|
|
|
|
* Copyright 2001 The LyX Team.
|
|
|
|
|
*
|
|
|
|
|
* ======================================================
|
|
|
|
|
*
|
2001-03-29 15:00:20 +00:00
|
|
|
|
* \author J<EFBFBD>rgen Vigna, jug@sad.it
|
2001-03-27 16:03:28 +00:00
|
|
|
|
* \author Angus Leeming, a.leeming@ic.ac.uk
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
|
#pragma implementation
|
|
|
|
|
#endif
|
|
|
|
|
|
2001-04-26 18:40:38 +00:00
|
|
|
|
#include "ViewBase.h"
|
|
|
|
|
#include "ButtonControllerBase.h"
|
2001-03-27 16:03:28 +00:00
|
|
|
|
#include "ControlMinipage.h"
|
|
|
|
|
#include "Dialogs.h"
|
|
|
|
|
#include "LyXView.h"
|
|
|
|
|
#include "buffer.h"
|
2001-06-25 00:06:33 +00:00
|
|
|
|
#include "BufferView.h"
|
2001-03-27 16:03:28 +00:00
|
|
|
|
|
2001-03-28 12:59:29 +00:00
|
|
|
|
using std::vector;
|
2001-03-27 16:03:28 +00:00
|
|
|
|
using SigC::slot;
|
|
|
|
|
|
2001-03-29 15:00:20 +00:00
|
|
|
|
// sorry this is just a temporary hack we should include vspace.h! (Jug)
|
|
|
|
|
extern const char * stringFromUnit(int);
|
|
|
|
|
|
2001-03-27 16:03:28 +00:00
|
|
|
|
ControlMinipage::ControlMinipage(LyXView & lv, Dialogs & d)
|
|
|
|
|
: ControlInset<InsetMinipage, MinipageParams>(lv, d)
|
|
|
|
|
{
|
|
|
|
|
d_.showMinipage.connect(slot(this, &ControlMinipage::showInset));
|
2001-03-28 12:59:29 +00:00
|
|
|
|
|
|
|
|
|
// We could have an extra method updateInset that calls
|
|
|
|
|
// view().update() rather than view().show(), but I don't see why
|
|
|
|
|
// it is really needed.
|
2001-03-27 16:03:28 +00:00
|
|
|
|
d_.updateMinipage.connect(slot(this, &ControlMinipage::showInset));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void ControlMinipage::applyParamsToInset()
|
|
|
|
|
{
|
|
|
|
|
inset()->width(params().width);
|
|
|
|
|
inset()->pos(params().pos);
|
2001-03-28 12:59:29 +00:00
|
|
|
|
|
|
|
|
|
lv_.view()->updateInset(inset(), true);
|
2001-03-27 16:03:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void ControlMinipage::applyParamsNoInset()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MinipageParams const ControlMinipage::getParams(InsetMinipage const & inset)
|
|
|
|
|
{
|
|
|
|
|
return MinipageParams(inset);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MinipageParams::MinipageParams()
|
2001-03-29 15:00:20 +00:00
|
|
|
|
: pos(InsetMinipage::top)
|
2001-03-27 16:03:28 +00:00
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
MinipageParams::MinipageParams(InsetMinipage const & inset)
|
2001-03-29 15:00:20 +00:00
|
|
|
|
: width(inset.width()), pos(inset.pos())
|
2001-03-27 16:03:28 +00:00
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
bool MinipageParams::operator==(MinipageParams const & o) const
|
|
|
|
|
{
|
2001-03-29 15:00:20 +00:00
|
|
|
|
return (width == o.width && pos == o.pos);
|
2001-03-27 16:03:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool MinipageParams::operator!=(MinipageParams const & o) const
|
|
|
|
|
{
|
|
|
|
|
return !(*this == o);
|
|
|
|
|
}
|
2001-03-28 12:59:29 +00:00
|
|
|
|
|
|
|
|
|
namespace minipage {
|
|
|
|
|
|
|
|
|
|
vector<string> const getUnits()
|
|
|
|
|
{
|
|
|
|
|
vector<string> units;
|
2001-03-29 15:00:20 +00:00
|
|
|
|
const char * str;
|
|
|
|
|
for(int i=0;(str=stringFromUnit(i));++i)
|
|
|
|
|
units.push_back(str);
|
2001-03-28 12:59:29 +00:00
|
|
|
|
|
|
|
|
|
return units;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace minipage
|