2002-06-12 02:54:19 +00:00
|
|
|
|
/**
|
|
|
|
|
* \file Toolbar.C
|
2002-09-05 15:14:23 +00:00
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
|
* Licence details can be found in the file COPYING.
|
2002-03-21 21:21:28 +00:00
|
|
|
|
*
|
2002-09-05 14:10:50 +00:00
|
|
|
|
* \author Lars Gullik Bj<EFBFBD>nnes
|
|
|
|
|
*
|
|
|
|
|
* Full author contact details are available in file CREDITS
|
2002-06-12 02:54:19 +00:00
|
|
|
|
*/
|
2000-07-24 13:53:19 +00:00
|
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
|
#pragma implementation "Toolbar.h"
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#include "Toolbar.h"
|
2002-06-19 03:54:18 +00:00
|
|
|
|
#include "ToolbarDefaults.h"
|
2000-07-24 13:53:19 +00:00
|
|
|
|
#include "Toolbar_pimpl.h"
|
|
|
|
|
#include "debug.h"
|
|
|
|
|
#include "LyXAction.h"
|
|
|
|
|
|
|
|
|
|
using std::endl;
|
|
|
|
|
|
2002-08-12 14:28:43 +00:00
|
|
|
|
Toolbar::Toolbar(LyXView * o, int x, int y, ToolbarDefaults const &tbd)
|
2002-06-18 15:44:30 +00:00
|
|
|
|
: last_textclass_(-1)
|
2000-07-24 13:53:19 +00:00
|
|
|
|
{
|
2002-08-12 14:28:43 +00:00
|
|
|
|
pimpl_ = new Pimpl(o, x, y);
|
2000-07-24 13:53:19 +00:00
|
|
|
|
|
|
|
|
|
// extracts the toolbar actions from tbd
|
|
|
|
|
for (ToolbarDefaults::const_iterator cit = tbd.begin();
|
|
|
|
|
cit != tbd.end(); ++cit) {
|
|
|
|
|
pimpl_->add((*cit));
|
2002-07-22 20:52:40 +00:00
|
|
|
|
lyxerr[Debug::GUI] << "tool action: " << (*cit) << endl;
|
2000-07-24 13:53:19 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2000-11-21 15:46:13 +00:00
|
|
|
|
|
2000-07-24 13:53:19 +00:00
|
|
|
|
Toolbar::~Toolbar()
|
|
|
|
|
{
|
|
|
|
|
delete pimpl_;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void Toolbar::update()
|
|
|
|
|
{
|
|
|
|
|
pimpl_->update();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2002-03-02 16:39:54 +00:00
|
|
|
|
|
|
|
|
|
void Toolbar::setLayout(string const & layout)
|
2000-08-24 23:10:28 +00:00
|
|
|
|
{
|
2000-07-24 13:53:19 +00:00
|
|
|
|
pimpl_->setLayout(layout);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2002-06-18 15:44:30 +00:00
|
|
|
|
bool Toolbar::updateLayoutList(int textclass)
|
2000-08-24 23:10:28 +00:00
|
|
|
|
{
|
2002-06-18 15:44:30 +00:00
|
|
|
|
// update the layout display
|
|
|
|
|
if (last_textclass_ != textclass) {
|
|
|
|
|
pimpl_->updateLayoutList(true);
|
|
|
|
|
last_textclass_ = textclass;
|
|
|
|
|
return true;
|
|
|
|
|
} else {
|
|
|
|
|
pimpl_->updateLayoutList(false);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2000-07-24 13:53:19 +00:00
|
|
|
|
}
|
|
|
|
|
|
2002-03-21 21:21:28 +00:00
|
|
|
|
|
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();
|
|
|
|
|
}
|