mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
small general cleanup
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7321 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
a739b5e45d
commit
934a082963
@ -35,13 +35,13 @@
|
|||||||
#include "support/LOstream.h"
|
#include "support/LOstream.h"
|
||||||
|
|
||||||
using namespace lyx::support;
|
using namespace lyx::support;
|
||||||
|
using namespace lyx::graphics;
|
||||||
|
|
||||||
using std::vector;
|
using std::vector;
|
||||||
using std::ostream;
|
using std::ostream;
|
||||||
using std::endl;
|
using std::endl;
|
||||||
using std::max;
|
using std::max;
|
||||||
|
|
||||||
namespace grfx = lyx::graphics;
|
|
||||||
|
|
||||||
InsetCollapsable::InsetCollapsable(BufferParams const & bp, bool collapsed)
|
InsetCollapsable::InsetCollapsable(BufferParams const & bp, bool collapsed)
|
||||||
: UpdatableInset(), collapsed_(collapsed), inset(bp),
|
: UpdatableInset(), collapsed_(collapsed), inset(bp),
|
||||||
@ -425,7 +425,7 @@ void InsetCollapsable::getCursorPos(BufferView * bv, int & x, int & y) const
|
|||||||
UpdatableInset * InsetCollapsable::getLockingInset() const
|
UpdatableInset * InsetCollapsable::getLockingInset() const
|
||||||
{
|
{
|
||||||
UpdatableInset * in = inset.getLockingInset();
|
UpdatableInset * in = inset.getLockingInset();
|
||||||
if (const_cast<InsetText *>(&inset) == in)
|
if (&inset == in)
|
||||||
return const_cast<InsetCollapsable *>(this);
|
return const_cast<InsetCollapsable *>(this);
|
||||||
return in;
|
return in;
|
||||||
}
|
}
|
||||||
@ -587,7 +587,7 @@ InsetCollapsable::selectNextWordToSpellcheck(BufferView * bv, float & value) con
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetCollapsable::addPreview(grfx::PreviewLoader & loader) const
|
void InsetCollapsable::addPreview(PreviewLoader & loader) const
|
||||||
{
|
{
|
||||||
inset.addPreview(loader);
|
inset.addPreview(loader);
|
||||||
}
|
}
|
||||||
|
@ -50,6 +50,7 @@
|
|||||||
|
|
||||||
|
|
||||||
using namespace lyx::support;
|
using namespace lyx::support;
|
||||||
|
using namespace lyx::graphics;
|
||||||
|
|
||||||
using std::vector;
|
using std::vector;
|
||||||
using std::ostream;
|
using std::ostream;
|
||||||
@ -59,7 +60,6 @@ using std::endl;
|
|||||||
using std::swap;
|
using std::swap;
|
||||||
using std::max;
|
using std::max;
|
||||||
|
|
||||||
namespace grfx = lyx::graphics;
|
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
@ -193,8 +193,7 @@ InsetTabular::InsetTabular(InsetTabular const & tab)
|
|||||||
|
|
||||||
InsetTabular::~InsetTabular()
|
InsetTabular::~InsetTabular()
|
||||||
{
|
{
|
||||||
InsetTabularMailer mailer(*this);
|
InsetTabularMailer(*this).hideDialog();
|
||||||
mailer.hideDialog();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -516,8 +515,7 @@ bool InsetTabular::unlockInsetInInset(BufferView * bv, UpdatableInset * inset,
|
|||||||
if (the_locking_inset->unlockInsetInInset(bv, inset, lr)) {
|
if (the_locking_inset->unlockInsetInInset(bv, inset, lr)) {
|
||||||
if (inset->lyxCode() == TABULAR_CODE &&
|
if (inset->lyxCode() == TABULAR_CODE &&
|
||||||
!the_locking_inset->getFirstLockingInsetOfType(TABULAR_CODE)) {
|
!the_locking_inset->getFirstLockingInsetOfType(TABULAR_CODE)) {
|
||||||
InsetTabularMailer mailer(*this);
|
InsetTabularMailer(*this).updateDialog(bv);
|
||||||
mailer.updateDialog(bv);
|
|
||||||
oldcell = actcell;
|
oldcell = actcell;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@ -985,13 +983,11 @@ Inset::RESULT InsetTabular::localDispatch(FuncRequest const & cmd)
|
|||||||
case LFUN_ENDBUFSEL:
|
case LFUN_ENDBUFSEL:
|
||||||
break;
|
break;
|
||||||
case LFUN_LAYOUT_TABULAR: {
|
case LFUN_LAYOUT_TABULAR: {
|
||||||
InsetTabularMailer mailer(*this);
|
InsetTabularMailer(*this).showDialog(bv);
|
||||||
mailer.showDialog(bv);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case LFUN_INSET_DIALOG_UPDATE: {
|
case LFUN_INSET_DIALOG_UPDATE: {
|
||||||
InsetTabularMailer mailer(*this);
|
InsetTabularMailer(*this).updateDialog(bv);
|
||||||
mailer.updateDialog(bv);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case LFUN_TABULAR_FEATURE:
|
case LFUN_TABULAR_FEATURE:
|
||||||
@ -1448,9 +1444,7 @@ void InsetTabular::resetPos(BufferView * bv) const
|
|||||||
if ((!the_locking_inset ||
|
if ((!the_locking_inset ||
|
||||||
!the_locking_inset->getFirstLockingInsetOfType(TABULAR_CODE)) &&
|
!the_locking_inset->getFirstLockingInsetOfType(TABULAR_CODE)) &&
|
||||||
actcell != oldcell) {
|
actcell != oldcell) {
|
||||||
InsetTabular * inset = const_cast<InsetTabular *>(this);
|
InsetTabularMailer(*this).updateDialog(bv);
|
||||||
InsetTabularMailer mailer(*inset);
|
|
||||||
mailer.updateDialog(bv);
|
|
||||||
oldcell = actcell;
|
oldcell = actcell;
|
||||||
}
|
}
|
||||||
in_reset_pos = 0;
|
in_reset_pos = 0;
|
||||||
@ -2031,8 +2025,7 @@ void InsetTabular::tabularFeatures(BufferView * bv,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
InsetTabularMailer mailer(*this);
|
InsetTabularMailer(*this).updateDialog(bv);
|
||||||
mailer.updateDialog(bv);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2097,26 +2090,14 @@ LyXText * InsetTabular::getLyXText(BufferView const * bv,
|
|||||||
{
|
{
|
||||||
if (the_locking_inset)
|
if (the_locking_inset)
|
||||||
return the_locking_inset->getLyXText(bv, recursive);
|
return the_locking_inset->getLyXText(bv, recursive);
|
||||||
#if 0
|
|
||||||
// if we're locked lock the actual insettext and return it's LyXText!!!
|
|
||||||
if (locked) {
|
|
||||||
UpdatableInset * inset =
|
|
||||||
static_cast<UpdatableInset*>(tabular.getCellInset(actcell));
|
|
||||||
inset->edit(const_cast<BufferView *>(bv), 0, 0, 0);
|
|
||||||
return the_locking_inset->getLyXText(bv, recursive);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
return Inset::getLyXText(bv, recursive);
|
return Inset::getLyXText(bv, recursive);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool InsetTabular::showInsetDialog(BufferView * bv) const
|
bool InsetTabular::showInsetDialog(BufferView * bv) const
|
||||||
{
|
{
|
||||||
if (!the_locking_inset || !the_locking_inset->showInsetDialog(bv)) {
|
if (!the_locking_inset || !the_locking_inset->showInsetDialog(bv))
|
||||||
InsetTabular * tmp = const_cast<InsetTabular *>(this);
|
InsetTabularMailer(*this).showDialog(bv);
|
||||||
InsetTabularMailer mailer(*tmp);
|
|
||||||
mailer.showDialog(bv);
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2131,9 +2112,7 @@ void InsetTabular::openLayoutDialog(BufferView * bv) const
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
InsetTabular * tmp = const_cast<InsetTabular *>(this);
|
InsetTabularMailer(*this).showDialog(bv);
|
||||||
InsetTabularMailer mailer(*tmp);
|
|
||||||
mailer.showDialog(bv);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2476,11 +2455,11 @@ Inset * InsetTabular::getInsetFromID(int id_arg) const
|
|||||||
if (id_arg == id())
|
if (id_arg == id())
|
||||||
return const_cast<InsetTabular *>(this);
|
return const_cast<InsetTabular *>(this);
|
||||||
|
|
||||||
Inset * result;
|
for (int i = 0; i < tabular.rows(); ++i) {
|
||||||
for(int i = 0; i < tabular.rows(); ++i) {
|
for (int j = 0; j < tabular.columns(); ++j) {
|
||||||
for(int j = 0; j < tabular.columns(); ++j) {
|
Inset * inset = tabular.getCellInset(i, j)->getInsetFromID(id_arg);
|
||||||
if ((result = tabular.getCellInset(i, j)->getInsetFromID(id_arg)))
|
if (inset)
|
||||||
return result;
|
return inset;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@ -2505,9 +2484,8 @@ InsetTabular::selectNextWordToSpellcheck(BufferView * bv, float & value) const
|
|||||||
++actcell;
|
++actcell;
|
||||||
}
|
}
|
||||||
// otherwise we have to lock the next inset and ask for it's selecttion
|
// otherwise we have to lock the next inset and ask for it's selecttion
|
||||||
UpdatableInset * inset =
|
tabular.getCellInset(actcell)
|
||||||
static_cast<UpdatableInset*>(tabular.getCellInset(actcell));
|
->localDispatch(FuncRequest(bv, LFUN_INSET_EDIT));
|
||||||
inset->localDispatch(FuncRequest(bv, LFUN_INSET_EDIT));
|
|
||||||
WordLangTuple word(selectNextWordInt(bv, value));
|
WordLangTuple word(selectNextWordInt(bv, value));
|
||||||
nodraw(false);
|
nodraw(false);
|
||||||
if (!word.word().empty())
|
if (!word.word().empty())
|
||||||
@ -2531,40 +2509,31 @@ WordLangTuple InsetTabular::selectNextWordInt(BufferView * bv, float & value) co
|
|||||||
}
|
}
|
||||||
|
|
||||||
// otherwise we have to lock the next inset and ask for it's selecttion
|
// otherwise we have to lock the next inset and ask for it's selecttion
|
||||||
UpdatableInset * inset =
|
++actcell;
|
||||||
static_cast<UpdatableInset*>(tabular.getCellInset(++actcell));
|
tabular.getCellInset(actcell)
|
||||||
inset->localDispatch(FuncRequest(bv, LFUN_INSET_EDIT));
|
->localDispatch(FuncRequest(bv, LFUN_INSET_EDIT));
|
||||||
return selectNextWordInt(bv, value);
|
return selectNextWordInt(bv, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetTabular::selectSelectedWord(BufferView * bv)
|
void InsetTabular::selectSelectedWord(BufferView * bv)
|
||||||
{
|
{
|
||||||
if (the_locking_inset) {
|
if (the_locking_inset)
|
||||||
the_locking_inset->selectSelectedWord(bv);
|
the_locking_inset->selectSelectedWord(bv);
|
||||||
return;
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetTabular::toggleSelection(BufferView * bv, bool kill_selection)
|
void InsetTabular::toggleSelection(BufferView * bv, bool kill_selection)
|
||||||
{
|
{
|
||||||
if (the_locking_inset) {
|
if (the_locking_inset)
|
||||||
the_locking_inset->toggleSelection(bv, kill_selection);
|
the_locking_inset->toggleSelection(bv, kill_selection);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetTabular::markErased()
|
void InsetTabular::markErased()
|
||||||
{
|
{
|
||||||
int cell = 0;
|
for (int cell = 0; cell < tabular.getNumberOfCells(); ++cell)
|
||||||
|
tabular.getCellInset(cell)->markErased();
|
||||||
while (cell < tabular.getNumberOfCells()) {
|
|
||||||
InsetText * inset = tabular.getCellInset(cell);
|
|
||||||
inset->markErased();
|
|
||||||
++cell;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2675,6 +2644,7 @@ bool InsetTabular::forceDefaultParagraphs(Inset const * in) const
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool InsetTabular::insertAsciiString(BufferView * bv, string const & buf,
|
bool InsetTabular::insertAsciiString(BufferView * bv, string const & buf,
|
||||||
bool usePaste)
|
bool usePaste)
|
||||||
{
|
{
|
||||||
@ -2728,7 +2698,7 @@ bool InsetTabular::insertAsciiString(BufferView * bv, string const & buf,
|
|||||||
rows = loctab->rows();
|
rows = loctab->rows();
|
||||||
int const columns = loctab->columns();
|
int const columns = loctab->columns();
|
||||||
|
|
||||||
while ((cell < cells) && (p < len) && (row < rows) &&
|
while (cell < cells && p < len && row < rows &&
|
||||||
(p = buf.find_first_of("\t\n", p)) != string::npos)
|
(p = buf.find_first_of("\t\n", p)) != string::npos)
|
||||||
{
|
{
|
||||||
if (p >= len)
|
if (p >= len)
|
||||||
@ -2763,7 +2733,7 @@ bool InsetTabular::insertAsciiString(BufferView * bv, string const & buf,
|
|||||||
op = p;
|
op = p;
|
||||||
}
|
}
|
||||||
// check for the last cell if there is no trailing '\n'
|
// check for the last cell if there is no trailing '\n'
|
||||||
if ((cell < cells) && (op < len)) {
|
if (cell < cells && op < len) {
|
||||||
InsetText * ti = loctab->getCellInset(cell);
|
InsetText * ti = loctab->getCellInset(cell);
|
||||||
LyXFont const font = ti->getLyXText(bv)->
|
LyXFont const font = ti->getLyXText(bv)->
|
||||||
getFont(bv->buffer(), ti->paragraphs.begin(), 0);
|
getFont(bv->buffer(), ti->paragraphs.begin(), 0);
|
||||||
@ -2774,7 +2744,7 @@ bool InsetTabular::insertAsciiString(BufferView * bv, string const & buf,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetTabular::addPreview(grfx::PreviewLoader & loader) const
|
void InsetTabular::addPreview(PreviewLoader & loader) const
|
||||||
{
|
{
|
||||||
int const rows = tabular.rows();
|
int const rows = tabular.rows();
|
||||||
int const columns = tabular.columns();
|
int const columns = tabular.columns();
|
||||||
@ -2786,10 +2756,10 @@ void InsetTabular::addPreview(grfx::PreviewLoader & loader) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
string const InsetTabularMailer:: name_("tabular");
|
string const InsetTabularMailer::name_("tabular");
|
||||||
|
|
||||||
InsetTabularMailer::InsetTabularMailer(InsetTabular & inset)
|
InsetTabularMailer::InsetTabularMailer(InsetTabular const & inset)
|
||||||
: inset_(inset)
|
: inset_(const_cast<InsetTabular &>(inset))
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
@ -351,7 +351,7 @@ private:
|
|||||||
class InsetTabularMailer : public MailInset {
|
class InsetTabularMailer : public MailInset {
|
||||||
public:
|
public:
|
||||||
///
|
///
|
||||||
InsetTabularMailer(InsetTabular & inset);
|
InsetTabularMailer(InsetTabular const & inset);
|
||||||
///
|
///
|
||||||
virtual InsetBase & inset() const { return inset_; }
|
virtual InsetBase & inset() const { return inset_; }
|
||||||
///
|
///
|
||||||
|
@ -72,13 +72,12 @@ using std::pair;
|
|||||||
using std::for_each;
|
using std::for_each;
|
||||||
|
|
||||||
using namespace lyx::support;
|
using namespace lyx::support;
|
||||||
|
using namespace lyx::graphics;
|
||||||
using namespace bv_funcs;
|
using namespace bv_funcs;
|
||||||
|
|
||||||
using lyx::pos_type;
|
using lyx::pos_type;
|
||||||
using lyx::textclass_type;
|
using lyx::textclass_type;
|
||||||
|
|
||||||
namespace grfx = lyx::graphics;
|
|
||||||
|
|
||||||
// These functions should probably go into bufferview_funcs somehow (Jug)
|
// These functions should probably go into bufferview_funcs somehow (Jug)
|
||||||
|
|
||||||
void InsetText::saveLyXTextState() const
|
void InsetText::saveLyXTextState() const
|
||||||
@ -2299,7 +2298,7 @@ void InsetText::appendParagraphs(Buffer * buffer, ParagraphList & plist)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetText::addPreview(grfx::PreviewLoader & loader) const
|
void InsetText::addPreview(PreviewLoader & loader) const
|
||||||
{
|
{
|
||||||
ParagraphList::const_iterator pit = paragraphs.begin();
|
ParagraphList::const_iterator pit = paragraphs.begin();
|
||||||
ParagraphList::const_iterator pend = paragraphs.end();
|
ParagraphList::const_iterator pend = paragraphs.end();
|
||||||
|
Loading…
Reference in New Issue
Block a user