2000-07-24 13:53:19 +00:00
|
|
|
|
/* This file is part of
|
|
|
|
|
* ======================================================
|
|
|
|
|
*
|
|
|
|
|
* LyX, The Document Processor
|
|
|
|
|
*
|
|
|
|
|
* Copyright 1995 Matthias Ettrich
|
2001-05-30 13:53:44 +00:00
|
|
|
|
* Copyright 1995-2001 The LyX Team.
|
2000-07-24 13:53:19 +00:00
|
|
|
|
*
|
|
|
|
|
* This file is Copyright 1996-1998
|
|
|
|
|
* Lars Gullik Bj<EFBFBD>nnes
|
|
|
|
|
*
|
|
|
|
|
* ====================================================== */
|
|
|
|
|
|
|
|
|
|
// Added pseudo-action handling, asierra 180296
|
|
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
|
#pragma implementation "Toolbar.h"
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#include "Toolbar.h"
|
|
|
|
|
#include "Toolbar_pimpl.h"
|
|
|
|
|
#include "debug.h"
|
|
|
|
|
#include "LyXAction.h"
|
|
|
|
|
|
|
|
|
|
using std::endl;
|
|
|
|
|
|
|
|
|
|
extern LyXAction lyxaction;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Toolbar::Toolbar(LyXView * o, int x, int y, ToolbarDefaults const &tbd)
|
|
|
|
|
{
|
|
|
|
|
pimpl_ = new Pimpl(o, x, y);
|
|
|
|
|
|
|
|
|
|
pimpl_->reset();
|
|
|
|
|
|
|
|
|
|
// extracts the toolbar actions from tbd
|
|
|
|
|
for (ToolbarDefaults::const_iterator cit = tbd.begin();
|
|
|
|
|
cit != tbd.end(); ++cit) {
|
|
|
|
|
pimpl_->add((*cit));
|
|
|
|
|
lyxerr[Debug::GUI] << "tool action: "
|
|
|
|
|
<< (*cit) << endl;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2000-11-21 15:46:13 +00:00
|
|
|
|
|
2000-07-24 13:53:19 +00:00
|
|
|
|
Toolbar::~Toolbar()
|
|
|
|
|
{
|
|
|
|
|
delete pimpl_;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void Toolbar::set(bool doingmain)
|
|
|
|
|
{
|
|
|
|
|
pimpl_->set(doingmain);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void Toolbar::activate()
|
|
|
|
|
{
|
|
|
|
|
pimpl_->activate();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void Toolbar::deactivate()
|
|
|
|
|
{
|
|
|
|
|
pimpl_->deactivate();
|
|
|
|
|
}
|
|
|
|
|
|
2000-08-24 23:10:28 +00:00
|
|
|
|
|
2000-07-24 13:53:19 +00:00
|
|
|
|
void Toolbar::update()
|
|
|
|
|
{
|
|
|
|
|
pimpl_->update();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2000-08-24 23:10:28 +00:00
|
|
|
|
void Toolbar::setLayout(int layout)
|
|
|
|
|
{
|
2000-07-24 13:53:19 +00:00
|
|
|
|
pimpl_->setLayout(layout);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2000-08-24 23:10:28 +00:00
|
|
|
|
void Toolbar::updateLayoutList(bool force)
|
|
|
|
|
{
|
2000-07-24 13:53:19 +00:00
|
|
|
|
pimpl_->updateLayoutList(force);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2000-08-24 23:10:28 +00:00
|
|
|
|
void Toolbar::openLayoutList()
|
|
|
|
|
{
|
2000-07-24 13:53:19 +00:00
|
|
|
|
pimpl_->openLayoutList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void Toolbar::clearLayoutList()
|
|
|
|
|
{
|
|
|
|
|
pimpl_->clearLayoutList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void Toolbar::push(int nth)
|
|
|
|
|
{
|
2000-08-24 23:10:28 +00:00
|
|
|
|
pimpl_->push(nth);
|
|
|
|
|
}
|
2000-07-24 13:53:19 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void Toolbar::add(string const & func, bool doclean)
|
|
|
|
|
{
|
2000-11-21 15:46:13 +00:00
|
|
|
|
int const tf = lyxaction.LookupFunc(func);
|
2000-07-24 13:53:19 +00:00
|
|
|
|
|
|
|
|
|
if (tf == -1) {
|
|
|
|
|
lyxerr << "Toolbar::add: no LyX command called`"
|
|
|
|
|
<< func << "'exists!" << endl;
|
|
|
|
|
} else {
|
|
|
|
|
pimpl_->add(tf, doclean);
|
|
|
|
|
}
|
|
|
|
|
}
|