mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-10 20:04:46 +00:00
towards saner frontends. Part I: the toolbar
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7357 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
4ba8a4d6f6
commit
3501eef8f8
@ -13,35 +13,36 @@
|
|||||||
|
|
||||||
#include "Toolbar.h"
|
#include "Toolbar.h"
|
||||||
#include "ToolbarBackend.h"
|
#include "ToolbarBackend.h"
|
||||||
#include "Toolbar_pimpl.h"
|
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include "LyXAction.h"
|
#include "LyXAction.h"
|
||||||
|
|
||||||
using std::endl;
|
using std::endl;
|
||||||
|
|
||||||
Toolbar::Toolbar(LyXView * o, int x, int y)
|
Toolbar::Toolbar()
|
||||||
: last_textclass_(-1)
|
: last_textclass_(-1)
|
||||||
{
|
{
|
||||||
pimpl_ = new Pimpl(o, x, y);
|
|
||||||
|
|
||||||
// extracts the toolbars from the backend
|
|
||||||
ToolbarBackend::Toolbars::const_iterator cit = toolbarbackend.begin();
|
|
||||||
ToolbarBackend::Toolbars::const_iterator end = toolbarbackend.end();
|
|
||||||
|
|
||||||
for (; cit != end; ++cit)
|
|
||||||
pimpl_->add(*cit);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Toolbar::~Toolbar()
|
Toolbar::~Toolbar()
|
||||||
{
|
{
|
||||||
delete pimpl_;
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Toolbar::init()
|
||||||
|
{
|
||||||
|
// extracts the toolbars from the backend
|
||||||
|
ToolbarBackend::Toolbars::const_iterator cit = toolbarbackend.begin();
|
||||||
|
ToolbarBackend::Toolbars::const_iterator end = toolbarbackend.end();
|
||||||
|
|
||||||
|
for (; cit != end; ++cit)
|
||||||
|
add(*cit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Toolbar::update(bool in_math, bool in_table)
|
void Toolbar::update(bool in_math, bool in_table)
|
||||||
{
|
{
|
||||||
pimpl_->update();
|
update();
|
||||||
|
|
||||||
// extracts the toolbars from the backend
|
// extracts the toolbars from the backend
|
||||||
ToolbarBackend::Toolbars::const_iterator cit = toolbarbackend.begin();
|
ToolbarBackend::Toolbars::const_iterator cit = toolbarbackend.begin();
|
||||||
@ -49,41 +50,20 @@ void Toolbar::update(bool in_math, bool in_table)
|
|||||||
|
|
||||||
for (; cit != end; ++cit) {
|
for (; cit != end; ++cit) {
|
||||||
if (cit->flags & ToolbarBackend::MATH)
|
if (cit->flags & ToolbarBackend::MATH)
|
||||||
pimpl_->displayToolbar(*cit, in_math);
|
displayToolbar(*cit, in_math);
|
||||||
else if (cit->flags & ToolbarBackend::TABLE)
|
else if (cit->flags & ToolbarBackend::TABLE)
|
||||||
pimpl_->displayToolbar(*cit, in_table);
|
displayToolbar(*cit, in_table);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void Toolbar::setLayout(string const & layout)
|
|
||||||
{
|
|
||||||
pimpl_->setLayout(layout);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool Toolbar::updateLayoutList(int textclass)
|
bool Toolbar::updateLayoutList(int textclass)
|
||||||
{
|
{
|
||||||
// update the layout display
|
// update the layout display
|
||||||
if (last_textclass_ != textclass) {
|
if (last_textclass_ != textclass) {
|
||||||
pimpl_->updateLayoutList(true);
|
updateLayoutList();
|
||||||
last_textclass_ = textclass;
|
last_textclass_ = textclass;
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else
|
||||||
pimpl_->updateLayoutList(false);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Toolbar::openLayoutList()
|
|
||||||
{
|
|
||||||
pimpl_->openLayoutList();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Toolbar::clearLayoutList()
|
|
||||||
{
|
|
||||||
pimpl_->clearLayoutList();
|
|
||||||
}
|
}
|
||||||
|
@ -14,10 +14,10 @@
|
|||||||
|
|
||||||
|
|
||||||
#include "LString.h"
|
#include "LString.h"
|
||||||
|
#include "ToolbarBackend.h"
|
||||||
|
|
||||||
class LyXView;
|
class LyXView;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The LyX GUI independent toolbar class
|
* The LyX GUI independent toolbar class
|
||||||
*
|
*
|
||||||
@ -26,33 +26,43 @@ class LyXView;
|
|||||||
class Toolbar {
|
class Toolbar {
|
||||||
public:
|
public:
|
||||||
///
|
///
|
||||||
Toolbar(LyXView * o, int x, int y);
|
Toolbar();
|
||||||
|
|
||||||
///
|
///
|
||||||
~Toolbar();
|
virtual ~Toolbar();
|
||||||
|
|
||||||
|
/// Initialize toolbar from backend
|
||||||
|
void init();
|
||||||
|
|
||||||
/// update the state of the toolbars
|
/// update the state of the toolbars
|
||||||
void update(bool in_math, bool in_table);
|
void update(bool in_math, bool in_table);
|
||||||
|
|
||||||
/// update the layout combox
|
/// update the layout combox
|
||||||
void setLayout(string const & layout);
|
virtual void setLayout(string const & layout) = 0;
|
||||||
/**
|
/**
|
||||||
* Populate the layout combox - returns whether we did a full
|
* Populate the layout combox - returns whether we did a full
|
||||||
* update or not
|
* update or not
|
||||||
*/
|
*/
|
||||||
bool updateLayoutList(int textclass);
|
bool updateLayoutList(int textclass);
|
||||||
/// Drop down the layout list
|
/// Drop down the layout list
|
||||||
void openLayoutList();
|
virtual void openLayoutList() = 0;
|
||||||
/// Erase the layout list
|
/// Erase the layout list
|
||||||
void clearLayoutList();
|
virtual void clearLayoutList() = 0;
|
||||||
|
|
||||||
/// Compaq cxx 6.5 requires this to be public
|
|
||||||
struct Pimpl;
|
|
||||||
private:
|
private:
|
||||||
///
|
|
||||||
friend struct Toolbar::Pimpl;
|
virtual void add(ToolbarBackend::Toolbar const & tb) = 0;
|
||||||
///
|
|
||||||
Pimpl * pimpl_;
|
/// update the state of the icons
|
||||||
|
virtual void update() = 0;
|
||||||
|
|
||||||
|
/// show or hide a toolbar
|
||||||
|
virtual void displayToolbar(ToolbarBackend::Toolbar const & tb,
|
||||||
|
bool show) = 0;
|
||||||
|
|
||||||
|
/// Populate the layout combox.
|
||||||
|
virtual void updateLayoutList() = 0;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The last textclass layout list in the layout choice selector
|
* The last textclass layout list in the layout choice selector
|
||||||
|
@ -1,3 +1,13 @@
|
|||||||
|
2003-07-25 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
|
||||||
|
|
||||||
|
* QLToolbar.h:
|
||||||
|
* QLToolbar.C: derives from Toolbar (replaces Toolbar::Pimpl)
|
||||||
|
|
||||||
|
* Toolbar_pimpl.C:
|
||||||
|
* Toolbar_pimpl.h: removed
|
||||||
|
|
||||||
|
* QtView.C: modified because of changes above
|
||||||
|
|
||||||
2003-07-24 John Levon <levon@movementarian.org>
|
2003-07-24 John Levon <levon@movementarian.org>
|
||||||
|
|
||||||
* QPrefs.C: make sure to correctly split a default
|
* QPrefs.C: make sure to correctly split a default
|
||||||
|
@ -122,4 +122,4 @@ MOCFILES = \
|
|||||||
QURLDialog.C QURLDialog.h \
|
QURLDialog.C QURLDialog.h \
|
||||||
QVCLogDialog.C QVCLogDialog.h \
|
QVCLogDialog.C QVCLogDialog.h \
|
||||||
QWrapDialog.C QWrapDialog.h \
|
QWrapDialog.C QWrapDialog.h \
|
||||||
Toolbar_pimpl.C Toolbar_pimpl.h
|
QLToolbar.C QLToolbar.h
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
/**
|
/**
|
||||||
* \file qt2/Toolbar_pimpl.C
|
* \file qt2/QLToolbar.C
|
||||||
* This file is part of LyX, the document processor.
|
* This file is part of LyX, the document processor.
|
||||||
* Licence details can be found in the file COPYING.
|
* Licence details can be found in the file COPYING.
|
||||||
*
|
*
|
||||||
* \author Lars Gullik Bjønnes
|
* \author Lars Gullik Bjønnes
|
||||||
* \author John Levon
|
* \author John Levon
|
||||||
|
* \author Jean-Marc Lasgouttes
|
||||||
*
|
*
|
||||||
* Full author contact details are available in file CREDITS
|
* Full author contact details are available in file CREDITS
|
||||||
*/
|
*/
|
||||||
@ -28,7 +29,7 @@
|
|||||||
#include <boost/tuple/tuple.hpp>
|
#include <boost/tuple/tuple.hpp>
|
||||||
|
|
||||||
#include "QtView.h"
|
#include "QtView.h"
|
||||||
#include "Toolbar_pimpl.h"
|
#include "QLToolbar.h"
|
||||||
|
|
||||||
#include <qtoolbar.h>
|
#include <qtoolbar.h>
|
||||||
#include <qcombobox.h>
|
#include <qcombobox.h>
|
||||||
@ -45,20 +46,15 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
Toolbar::Pimpl::Pimpl(LyXView * o, int, int)
|
QLToolbar::QLToolbar(LyXView * o)
|
||||||
: owner_(static_cast<QtView *>(o)),
|
: owner_(static_cast<QtView *>(o)),
|
||||||
combo_(0)
|
combo_(0)
|
||||||
{
|
{
|
||||||
proxy_.reset(new ToolbarProxy(*this));
|
proxy_.reset(new ToolbarProxy(*this));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Toolbar::Pimpl::~Pimpl()
|
void QLToolbar::displayToolbar(ToolbarBackend::Toolbar const & tb, bool show)
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Toolbar::Pimpl::displayToolbar(ToolbarBackend::Toolbar const & tb, bool show)
|
|
||||||
{
|
{
|
||||||
QToolBar * qtb = toolbars_[tb.name];
|
QToolBar * qtb = toolbars_[tb.name];
|
||||||
if (show) {
|
if (show) {
|
||||||
@ -69,7 +65,7 @@ void Toolbar::Pimpl::displayToolbar(ToolbarBackend::Toolbar const & tb, bool sho
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Toolbar::Pimpl::update()
|
void QLToolbar::update()
|
||||||
{
|
{
|
||||||
ButtonMap::const_iterator p = map_.begin();
|
ButtonMap::const_iterator p = map_.begin();
|
||||||
ButtonMap::const_iterator end = map_.end();
|
ButtonMap::const_iterator end = map_.end();
|
||||||
@ -95,7 +91,7 @@ void Toolbar::Pimpl::update()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Toolbar::Pimpl::button_selected(QToolButton * button)
|
void QLToolbar::button_selected(QToolButton * button)
|
||||||
{
|
{
|
||||||
ButtonMap::const_iterator cit = map_.find(button);
|
ButtonMap::const_iterator cit = map_.find(button);
|
||||||
|
|
||||||
@ -108,7 +104,7 @@ void Toolbar::Pimpl::button_selected(QToolButton * button)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Toolbar::Pimpl::changed_layout(string const & sel)
|
void QLToolbar::changed_layout(string const & sel)
|
||||||
{
|
{
|
||||||
owner_->centralWidget()->setFocus();
|
owner_->centralWidget()->setFocus();
|
||||||
|
|
||||||
@ -124,12 +120,12 @@ void Toolbar::Pimpl::changed_layout(string const & sel)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
lyxerr << "ERROR (Toolbar::Pimpl::layoutSelected): layout not found!"
|
lyxerr << "ERROR (QLToolbar::layoutSelected): layout not found!"
|
||||||
<< endl;
|
<< endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Toolbar::Pimpl::setLayout(string const & layout)
|
void QLToolbar::setLayout(string const & layout)
|
||||||
{
|
{
|
||||||
if (!combo_)
|
if (!combo_)
|
||||||
return;
|
return;
|
||||||
@ -155,15 +151,11 @@ void Toolbar::Pimpl::setLayout(string const & layout)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Toolbar::Pimpl::updateLayoutList(bool force)
|
void QLToolbar::updateLayoutList()
|
||||||
{
|
{
|
||||||
if (!combo_)
|
if (!combo_)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// if we don't need an update, don't ...
|
|
||||||
if (combo_->count() && !force)
|
|
||||||
return;
|
|
||||||
|
|
||||||
LyXTextClass const & tc =
|
LyXTextClass const & tc =
|
||||||
owner_->buffer()->params.getLyXTextClass();
|
owner_->buffer()->params.getLyXTextClass();
|
||||||
|
|
||||||
@ -189,7 +181,7 @@ void Toolbar::Pimpl::updateLayoutList(bool force)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Toolbar::Pimpl::clearLayoutList()
|
void QLToolbar::clearLayoutList()
|
||||||
{
|
{
|
||||||
if (!combo_)
|
if (!combo_)
|
||||||
return;
|
return;
|
||||||
@ -198,7 +190,7 @@ void Toolbar::Pimpl::clearLayoutList()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Toolbar::Pimpl::openLayoutList()
|
void QLToolbar::openLayoutList()
|
||||||
{
|
{
|
||||||
if (!combo_)
|
if (!combo_)
|
||||||
return;
|
return;
|
||||||
@ -225,7 +217,7 @@ QMainWindow::ToolBarDock getPosition(ToolbarBackend::Flags const & flags)
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
void Toolbar::Pimpl::add(ToolbarBackend::Toolbar const & tb)
|
void QLToolbar::add(ToolbarBackend::Toolbar const & tb)
|
||||||
{
|
{
|
||||||
QToolBar * qtb = new QToolBar(qt_(tb.name), owner_, getPosition(tb.flags));
|
QToolBar * qtb = new QToolBar(qt_(tb.name), owner_, getPosition(tb.flags));
|
||||||
// give visual separation between adjacent toolbars
|
// give visual separation between adjacent toolbars
|
||||||
@ -242,7 +234,7 @@ void Toolbar::Pimpl::add(ToolbarBackend::Toolbar const & tb)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Toolbar::Pimpl::add(QToolBar * tb, int action, string const & tooltip)
|
void QLToolbar::add(QToolBar * tb, int action, string const & tooltip)
|
||||||
{
|
{
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case ToolbarBackend::SEPARATOR:
|
case ToolbarBackend::SEPARATOR:
|
@ -5,16 +5,16 @@
|
|||||||
* Licence details can be found in the file COPYING.
|
* Licence details can be found in the file COPYING.
|
||||||
*
|
*
|
||||||
* \author Lars Gullik Bjønnes
|
* \author Lars Gullik Bjønnes
|
||||||
|
* \author John Levon
|
||||||
|
* \author Jean-Marc Lasgouttes
|
||||||
*
|
*
|
||||||
* Full author contact details are available in file CREDITS
|
* Full author contact details are available in file CREDITS
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef TOOLBAR_PIMPL_H
|
#ifndef QLTOOLBAR__H
|
||||||
#define TOOLBAR_PIMPL_H
|
#define QLTOOLBAR_H
|
||||||
|
|
||||||
|
|
||||||
#include "frontends/Toolbar.h"
|
#include "frontends/Toolbar.h"
|
||||||
#include "ToolbarBackend.h"
|
|
||||||
|
|
||||||
#include "qt_helpers.h"
|
#include "qt_helpers.h"
|
||||||
|
|
||||||
@ -30,13 +30,11 @@ class QToolBar;
|
|||||||
class QLComboBox;
|
class QLComboBox;
|
||||||
class ToolbarProxy;
|
class ToolbarProxy;
|
||||||
|
|
||||||
struct Toolbar::Pimpl {
|
class QLToolbar : public Toolbar {
|
||||||
public:
|
public:
|
||||||
friend class ToolbarProxy;
|
friend class ToolbarProxy;
|
||||||
|
|
||||||
Pimpl(LyXView * o, int x, int y);
|
QLToolbar(LyXView * o);
|
||||||
|
|
||||||
~Pimpl();
|
|
||||||
|
|
||||||
/// add a new toolbar
|
/// add a new toolbar
|
||||||
void add(ToolbarBackend::Toolbar const & tb);
|
void add(ToolbarBackend::Toolbar const & tb);
|
||||||
@ -52,8 +50,8 @@ public:
|
|||||||
|
|
||||||
/// select the right layout in the combox
|
/// select the right layout in the combox
|
||||||
void setLayout(string const & layout);
|
void setLayout(string const & layout);
|
||||||
/// Populate the layout combox; re-do everything if force is true.
|
/// Populate the layout combox.
|
||||||
void updateLayoutList(bool force);
|
void updateLayoutList();
|
||||||
/// Drop down the layout list
|
/// Drop down the layout list
|
||||||
void openLayoutList();
|
void openLayoutList();
|
||||||
/// Erase the layout list
|
/// Erase the layout list
|
||||||
@ -81,7 +79,7 @@ private:
|
|||||||
class ToolbarProxy : public QObject {
|
class ToolbarProxy : public QObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
ToolbarProxy(Toolbar::Pimpl & owner)
|
ToolbarProxy(QLToolbar & owner)
|
||||||
: owner_(owner) {}
|
: owner_(owner) {}
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
@ -96,7 +94,7 @@ public slots:
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
Toolbar::Pimpl & owner_;
|
QLToolbar & owner_;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
@ -21,7 +21,6 @@
|
|||||||
#include "lyxfunc.h"
|
#include "lyxfunc.h"
|
||||||
#include "BufferView.h"
|
#include "BufferView.h"
|
||||||
|
|
||||||
#include "frontends/Toolbar.h"
|
|
||||||
#include "frontends/Menubar.h"
|
#include "frontends/Menubar.h"
|
||||||
#include "frontends/Dialogs.h"
|
#include "frontends/Dialogs.h"
|
||||||
#include "frontends/Timeout.h"
|
#include "frontends/Timeout.h"
|
||||||
@ -29,6 +28,7 @@
|
|||||||
#include <boost/bind.hpp>
|
#include <boost/bind.hpp>
|
||||||
|
|
||||||
#include "QtView.h"
|
#include "QtView.h"
|
||||||
|
#include "QLToolbar.h"
|
||||||
#include "qfont_loader.h"
|
#include "qfont_loader.h"
|
||||||
#include "QCommandBuffer.h"
|
#include "QCommandBuffer.h"
|
||||||
#include "qt_helpers.h"
|
#include "qt_helpers.h"
|
||||||
@ -62,7 +62,8 @@ QtView::QtView(unsigned int width, unsigned int height)
|
|||||||
bufferview_.reset(new BufferView(this, 0, 0, width, height));
|
bufferview_.reset(new BufferView(this, 0, 0, width, height));
|
||||||
|
|
||||||
menubar_.reset(new Menubar(this, menubackend));
|
menubar_.reset(new Menubar(this, menubackend));
|
||||||
toolbar_.reset(new Toolbar(this, 0, 0));
|
toolbar_.reset(new QLToolbar(this));
|
||||||
|
toolbar_->init();
|
||||||
|
|
||||||
statusBar()->setSizeGripEnabled(false);
|
statusBar()->setSizeGripEnabled(false);
|
||||||
|
|
||||||
|
@ -1,3 +1,11 @@
|
|||||||
|
2003-07-25 Jean-Marc Lasgouttes <lasgouttes@lyx.org> <lyx@htwm.de>
|
||||||
|
|
||||||
|
*
|
||||||
|
|
||||||
|
2003-07-25 Jean-Marc Lasgouttes <lasgoutes@lyx.org>
|
||||||
|
|
||||||
|
* XFormsToolbar.h:
|
||||||
|
|
||||||
2003-07-23 Angus Leeming <leeming@lyx.org>
|
2003-07-23 Angus Leeming <leeming@lyx.org>
|
||||||
|
|
||||||
* FormColorpicker.[Ch]
|
* FormColorpicker.[Ch]
|
||||||
|
@ -155,8 +155,8 @@ libxforms_la_SOURCES = \
|
|||||||
Menubar_pimpl.h \
|
Menubar_pimpl.h \
|
||||||
RadioButtonGroup.C \
|
RadioButtonGroup.C \
|
||||||
RadioButtonGroup.h \
|
RadioButtonGroup.h \
|
||||||
Toolbar_pimpl.C \
|
XFormsToolbar.C \
|
||||||
Toolbar_pimpl.h \
|
XFormsToolbar.h \
|
||||||
Tooltips.C \
|
Tooltips.C \
|
||||||
Tooltips.h \
|
Tooltips.h \
|
||||||
WorkAreaFactory.C \
|
WorkAreaFactory.C \
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
/**
|
/**
|
||||||
* \file xforms/Toolbar_pimpl.C
|
* \file xforms/XFormsToolbar.C
|
||||||
* This file is part of LyX, the document processor.
|
* This file is part of LyX, the document processor.
|
||||||
* Licence details can be found in the file COPYING.
|
* Licence details can be found in the file COPYING.
|
||||||
*
|
*
|
||||||
* \author Lars Gullik Bjønnes
|
* \author Lars Gullik Bjønnes
|
||||||
|
* \author Jean-Marc Lasgouttes
|
||||||
*
|
*
|
||||||
* Full author contact details are available in file CREDITS
|
* Full author contact details are available in file CREDITS
|
||||||
*/
|
*/
|
||||||
@ -13,7 +14,7 @@
|
|||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
|
|
||||||
#include "Toolbar_pimpl.h"
|
#include "XFormsToolbar.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include "XFormsView.h"
|
#include "XFormsView.h"
|
||||||
#include "lyxfunc.h"
|
#include "lyxfunc.h"
|
||||||
@ -40,12 +41,12 @@ const int sepspace = 6; // extra space
|
|||||||
const int buttonwidth = 30; // the standard button width
|
const int buttonwidth = 30; // the standard button width
|
||||||
const int height = 30; // the height of all items in the toolbar
|
const int height = 30; // the height of all items in the toolbar
|
||||||
|
|
||||||
Toolbar::Pimpl::toolbarItem::toolbarItem()
|
XFormsToolbar::toolbarItem::toolbarItem()
|
||||||
: action(LFUN_NOACTION), icon(0)
|
: action(LFUN_NOACTION), icon(0)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
Toolbar::Pimpl::toolbarItem::~toolbarItem()
|
XFormsToolbar::toolbarItem::~toolbarItem()
|
||||||
{
|
{
|
||||||
// Lars said here that ~XFormsView() dealt with the icons.
|
// Lars said here that ~XFormsView() dealt with the icons.
|
||||||
// This is not true. But enabling this causes crashes,
|
// This is not true. But enabling this causes crashes,
|
||||||
@ -57,12 +58,12 @@ Toolbar::Pimpl::toolbarItem::~toolbarItem()
|
|||||||
|
|
||||||
/// Display toolbar, not implemented. But moved out of line so that
|
/// Display toolbar, not implemented. But moved out of line so that
|
||||||
/// linking will work properly.
|
/// linking will work properly.
|
||||||
void Toolbar::Pimpl::displayToolbar(ToolbarBackend::Toolbar const & /*tb*/,
|
void XFormsToolbar::displayToolbar(ToolbarBackend::Toolbar const & /*tb*/,
|
||||||
bool /*show*/)
|
bool /*show*/)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
void Toolbar::Pimpl::toolbarItem::kill_icon()
|
void XFormsToolbar::toolbarItem::kill_icon()
|
||||||
{
|
{
|
||||||
if (icon) {
|
if (icon) {
|
||||||
fl_delete_object(icon);
|
fl_delete_object(icon);
|
||||||
@ -72,8 +73,8 @@ void Toolbar::Pimpl::toolbarItem::kill_icon()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Toolbar::Pimpl::toolbarItem &
|
XFormsToolbar::toolbarItem &
|
||||||
Toolbar::Pimpl::toolbarItem::operator=(toolbarItem const & ti)
|
XFormsToolbar::toolbarItem::operator=(toolbarItem const & ti)
|
||||||
{
|
{
|
||||||
if (this == &ti)
|
if (this == &ti)
|
||||||
return *this;
|
return *this;
|
||||||
@ -89,14 +90,14 @@ Toolbar::Pimpl::toolbarItem::operator=(toolbarItem const & ti)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
Toolbar::Pimpl::Pimpl(LyXView * o, int x, int y)
|
XFormsToolbar::XFormsToolbar(LyXView * o, int x, int y)
|
||||||
: owner_(static_cast<XFormsView *>(o)), combox_(0), xpos(x), ypos(y)
|
: owner_(static_cast<XFormsView *>(o)), combox_(0), xpos(x), ypos(y)
|
||||||
{
|
{
|
||||||
tooltip_ = new Tooltips();
|
tooltip_ = new Tooltips();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Toolbar::Pimpl::~Pimpl()
|
XFormsToolbar::~XFormsToolbar()
|
||||||
{
|
{
|
||||||
fl_freeze_form(owner_->getForm());
|
fl_freeze_form(owner_->getForm());
|
||||||
|
|
||||||
@ -109,7 +110,7 @@ Toolbar::Pimpl::~Pimpl()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Toolbar::Pimpl::update()
|
void XFormsToolbar::update()
|
||||||
{
|
{
|
||||||
ToolbarList::const_iterator p = toollist_.begin();
|
ToolbarList::const_iterator p = toollist_.begin();
|
||||||
ToolbarList::const_iterator end = toollist_.end();
|
ToolbarList::const_iterator end = toollist_.end();
|
||||||
@ -156,14 +157,14 @@ void C_layoutSelectedCB(FL_OBJECT * ob, long)
|
|||||||
{
|
{
|
||||||
if (!ob || !ob->u_vdata)
|
if (!ob || !ob->u_vdata)
|
||||||
return;
|
return;
|
||||||
Toolbar::Pimpl * ptr = static_cast<Toolbar::Pimpl *>(ob->u_vdata);
|
XFormsToolbar * ptr = static_cast<XFormsToolbar *>(ob->u_vdata);
|
||||||
ptr->layoutSelected();
|
ptr->layoutSelected();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace anon
|
} // namespace anon
|
||||||
|
|
||||||
|
|
||||||
void Toolbar::Pimpl::layoutSelected()
|
void XFormsToolbar::layoutSelected()
|
||||||
{
|
{
|
||||||
if (!combox_)
|
if (!combox_)
|
||||||
return;
|
return;
|
||||||
@ -180,12 +181,12 @@ void Toolbar::Pimpl::layoutSelected()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
lyxerr << "ERROR (Toolbar::Pimpl::layoutSelected): layout not found!"
|
lyxerr << "ERROR (XFormsToolbar::layoutSelected): layout not found!"
|
||||||
<< endl;
|
<< endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Toolbar::Pimpl::setLayout(string const & layout)
|
void XFormsToolbar::setLayout(string const & layout)
|
||||||
{
|
{
|
||||||
if (!combox_)
|
if (!combox_)
|
||||||
return;
|
return;
|
||||||
@ -204,32 +205,29 @@ void Toolbar::Pimpl::setLayout(string const & layout)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Toolbar::Pimpl::updateLayoutList(bool force)
|
void XFormsToolbar::updateLayoutList()
|
||||||
{
|
{
|
||||||
if (!combox_)
|
if (!combox_)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// If textclass is different, we need to update the list
|
fl_clear_combox(combox_);
|
||||||
if (fl_get_combox_maxitems(combox_) == 0 || force) {
|
LyXTextClass const & tc = owner_->buffer()->params.getLyXTextClass();
|
||||||
fl_clear_combox(combox_);
|
LyXTextClass::const_iterator end = tc.end();
|
||||||
LyXTextClass const & tc =
|
for (LyXTextClass::const_iterator cit = tc.begin();
|
||||||
owner_->buffer()->params.getLyXTextClass();
|
cit != end; ++cit) {
|
||||||
LyXTextClass::const_iterator end = tc.end();
|
// ignore obsolete entries
|
||||||
for (LyXTextClass::const_iterator cit = tc.begin();
|
if ((*cit)->obsoleted_by().empty()) {
|
||||||
cit != end; ++cit) {
|
string const & name = _((*cit)->name());
|
||||||
// ignore obsolete entries
|
fl_addto_combox(combox_, name.c_str());
|
||||||
if ((*cit)->obsoleted_by().empty()) {
|
|
||||||
string const & name = _((*cit)->name());
|
|
||||||
fl_addto_combox(combox_, name.c_str());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// we need to do this.
|
// we need to do this.
|
||||||
fl_redraw_object(combox_);
|
fl_redraw_object(combox_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Toolbar::Pimpl::clearLayoutList()
|
void XFormsToolbar::clearLayoutList()
|
||||||
{
|
{
|
||||||
if (!combox_)
|
if (!combox_)
|
||||||
return;
|
return;
|
||||||
@ -239,7 +237,7 @@ void Toolbar::Pimpl::clearLayoutList()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Toolbar::Pimpl::openLayoutList()
|
void XFormsToolbar::openLayoutList()
|
||||||
{
|
{
|
||||||
if (!combox_)
|
if (!combox_)
|
||||||
return;
|
return;
|
||||||
@ -270,7 +268,7 @@ void C_Toolbar_ToolbarCB(FL_OBJECT * ob, long data)
|
|||||||
} // namespace anon
|
} // namespace anon
|
||||||
|
|
||||||
|
|
||||||
void Toolbar::Pimpl::add(ToolbarBackend::Toolbar const & tb)
|
void XFormsToolbar::add(ToolbarBackend::Toolbar const & tb)
|
||||||
{
|
{
|
||||||
// we can only handle one toolbar
|
// we can only handle one toolbar
|
||||||
if (!toollist_.empty())
|
if (!toollist_.empty())
|
||||||
@ -283,7 +281,7 @@ void Toolbar::Pimpl::add(ToolbarBackend::Toolbar const & tb)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Toolbar::Pimpl::add(int action, string const & tooltip)
|
void XFormsToolbar::add(int action, string const & tooltip)
|
||||||
{
|
{
|
||||||
toolbarItem item;
|
toolbarItem item;
|
||||||
item.action = action;
|
item.action = action;
|
@ -1,16 +1,17 @@
|
|||||||
// -*- C++ -*-
|
// -*- C++ -*-
|
||||||
/**
|
/**
|
||||||
* \file xforms/Toolbar_pimpl.h
|
* \file xforms/XFormsToolbar.h
|
||||||
* This file is part of LyX, the document processor.
|
* This file is part of LyX, the document processor.
|
||||||
* Licence details can be found in the file COPYING.
|
* Licence details can be found in the file COPYING.
|
||||||
*
|
*
|
||||||
* \author Lars Gullik Bjønnes
|
* \author Lars Gullik Bjønnes
|
||||||
|
* \author Jean-Marc Lasgouttes
|
||||||
*
|
*
|
||||||
* Full author contact details are available in file CREDITS
|
* Full author contact details are available in file CREDITS
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef TOOLBAR_PIMPL_H
|
#ifndef XFORMSTOOLBAR_H
|
||||||
#define TOOLBAR_PIMPL_H
|
#define XFROMSTOOLBAR_H
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "forms_fwd.h"
|
#include "forms_fwd.h"
|
||||||
@ -18,18 +19,18 @@
|
|||||||
#include "frontends/Toolbar.h"
|
#include "frontends/Toolbar.h"
|
||||||
#include "ToolbarBackend.h"
|
#include "ToolbarBackend.h"
|
||||||
|
|
||||||
|
|
||||||
class XFormsView;
|
class XFormsView;
|
||||||
class Tooltips;
|
class Tooltips;
|
||||||
|
|
||||||
/** The LyX xforms toolbar class
|
/** The LyX xforms toolbar class
|
||||||
*/
|
*/
|
||||||
struct Toolbar::Pimpl {
|
class XFormsToolbar : public Toolbar {
|
||||||
public:
|
public:
|
||||||
/// create an empty toolbar
|
/// create an empty toolbar
|
||||||
Pimpl(LyXView * o, int x, int y);
|
XFormsToolbar(LyXView * o, int x, int y);
|
||||||
|
|
||||||
~Pimpl();
|
///
|
||||||
|
~XFormsToolbar();
|
||||||
|
|
||||||
/// add a new toolbar
|
/// add a new toolbar
|
||||||
void add(ToolbarBackend::Toolbar const & tb);
|
void add(ToolbarBackend::Toolbar const & tb);
|
||||||
@ -45,8 +46,8 @@ public:
|
|||||||
|
|
||||||
/// select the right layout in the combox
|
/// select the right layout in the combox
|
||||||
void setLayout(string const & layout);
|
void setLayout(string const & layout);
|
||||||
/// Populate the layout combox; re-do everything if force is true.
|
/// Populate the layout combox.
|
||||||
void updateLayoutList(bool force);
|
void updateLayoutList();
|
||||||
/// Drop down the layout list
|
/// Drop down the layout list
|
||||||
void openLayoutList();
|
void openLayoutList();
|
||||||
/// Erase the layout list
|
/// Erase the layout list
|
||||||
@ -88,4 +89,4 @@ public:
|
|||||||
int ypos;
|
int ypos;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // TOOLBAR_PIMPL_H
|
#endif
|
@ -15,11 +15,11 @@
|
|||||||
#include "lyx_forms.h"
|
#include "lyx_forms.h"
|
||||||
|
|
||||||
#include "XMiniBuffer.h"
|
#include "XMiniBuffer.h"
|
||||||
|
#include "XFormsToolbar.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include "intl.h"
|
#include "intl.h"
|
||||||
#include "lyxrc.h"
|
#include "lyxrc.h"
|
||||||
#include "support/filetools.h" // OnlyFilename()
|
#include "support/filetools.h" // OnlyFilename()
|
||||||
#include "frontends/Toolbar.h"
|
|
||||||
#include "frontends/Menubar.h"
|
#include "frontends/Menubar.h"
|
||||||
#include "frontends/Timeout.h"
|
#include "frontends/Timeout.h"
|
||||||
#include "frontends/Dialogs.h"
|
#include "frontends/Dialogs.h"
|
||||||
@ -142,7 +142,8 @@ void XFormsView::create_form_form_main(int width, int height)
|
|||||||
|
|
||||||
menubar_.reset(new Menubar(this, menubackend));
|
menubar_.reset(new Menubar(this, menubackend));
|
||||||
|
|
||||||
toolbar_.reset(new Toolbar(this, air, 30 + air + bw));
|
toolbar_.reset(new XFormsToolbar(this, air, 30 + air + bw));
|
||||||
|
toolbar_->init();
|
||||||
|
|
||||||
int const ywork = 60 + 2 * air + bw;
|
int const ywork = 60 + 2 * air + bw;
|
||||||
int const workheight = height - ywork - (25 + 2 * air);
|
int const workheight = height - ywork - (25 + 2 * air);
|
||||||
|
Loading…
Reference in New Issue
Block a user