towards saner frontends (?). Part II: the menubar (now it is possible to switch frontend without recompiling GUII code)

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7361 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jean-Marc Lasgouttes 2003-07-25 21:34:45 +00:00
parent 2e57f2ff0a
commit c7f1fcdc65
22 changed files with 114 additions and 143 deletions

View File

@ -1,3 +1,8 @@
2003-07-25 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
* configure.in:
* configure.ac: remove frontend directories from FRONTEND_INCLUDES
2003-07-22 John Levon <levon@movementarian.org> 2003-07-22 John Levon <levon@movementarian.org>
* configure.ac: * configure.ac:

View File

@ -177,7 +177,6 @@ case "$lyx_use_frontend" in
RPM_FRONTEND="xforms" RPM_FRONTEND="xforms"
RPM_FRONTEND_DEPS='libforms >= 1.0' RPM_FRONTEND_DEPS='libforms >= 1.0'
FRONTEND_GUILIB="frontends/xforms/libxforms.la" FRONTEND_GUILIB="frontends/xforms/libxforms.la"
FRONTEND_INCLUDES="-I\$(srcdir)/xforms"
FRONTEND_INFO=" libXpm version: ${XPM_VERSION}\n\ FRONTEND_INFO=" libXpm version: ${XPM_VERSION}\n\
libforms version: ${XFORMS_VERSION}\n" libforms version: ${XFORMS_VERSION}\n"
;; ;;
@ -192,7 +191,7 @@ dnl AC_SUBST(GNOME_FRONTEND_LIBS)
dnl FRONTEND="xforms gnome" dnl FRONTEND="xforms gnome"
dnl FRONTEND_GUILIB="gnome/*.lo" dnl FRONTEND_GUILIB="gnome/*.lo"
dnl FRONTEND_LDFLAGS="${GNOME_FRONTEND_LIBS}" dnl FRONTEND_LDFLAGS="${GNOME_FRONTEND_LIBS}"
dnl FRONTEND_INCLUDES="-I\${srcdir}/gnome -I\${srcdir}/xforms ${GNOME_FRONTEND_CFLAGS} " dnl FRONTEND_INCLUDES="${GNOME_FRONTEND_CFLAGS}"
dnl FRONTEND_LIBS="@XPM_LIB@ @XFORMS_LIB@ ${GNOME_FRONTEND_LIBS}" dnl FRONTEND_LIBS="@XPM_LIB@ @XFORMS_LIB@ ${GNOME_FRONTEND_LIBS}"
dnl ;; dnl ;;
qt) qt)
@ -200,7 +199,7 @@ dnl ;;
RPM_FRONTEND_DEPS='qt >= 2.2.1' RPM_FRONTEND_DEPS='qt >= 2.2.1'
FRONTEND="qt2" FRONTEND="qt2"
FRONTEND_GUILIB="frontends/qt2/libqt2.la" FRONTEND_GUILIB="frontends/qt2/libqt2.la"
FRONTEND_INCLUDES="-I\${srcdir}/qt2 \$(QT_INCLUDES)" FRONTEND_INCLUDES="\$(QT_INCLUDES)"
FRONTEND_INFO=" Qt version: ${QT_VERSION}\n" FRONTEND_INFO=" Qt version: ${QT_VERSION}\n"
;; ;;
*) *)

View File

@ -174,7 +174,6 @@ case "$lyx_use_frontend" in
RPM_FRONTEND="xforms" RPM_FRONTEND="xforms"
RPM_FRONTEND_DEPS='libforms >= 1.0' RPM_FRONTEND_DEPS='libforms >= 1.0'
FRONTEND_GUILIB="xforms/*.lo xforms/forms/*.lo" FRONTEND_GUILIB="xforms/*.lo xforms/forms/*.lo"
FRONTEND_INCLUDES="-I\$(srcdir)/xforms"
FRONTEND_LIBS="@XFORMS_IMAGE_LIB@ @XFORMS_LIB@ @XPM_LIB@" FRONTEND_LIBS="@XFORMS_IMAGE_LIB@ @XFORMS_LIB@ @XPM_LIB@"
FRONTEND_INFO=" libXpm version: ${XPM_VERSION}\n\ FRONTEND_INFO=" libXpm version: ${XPM_VERSION}\n\
libforms version: ${XFORMS_VERSION}\n" libforms version: ${XFORMS_VERSION}\n"
@ -193,7 +192,7 @@ dnl AC_SUBST(GNOME_FRONTEND_LIBS)
dnl FRONTEND="xforms gnome" dnl FRONTEND="xforms gnome"
dnl FRONTEND_GUILIB="gnome/*.lo" dnl FRONTEND_GUILIB="gnome/*.lo"
dnl FRONTEND_LDFLAGS="${GNOME_FRONTEND_LIBS}" dnl FRONTEND_LDFLAGS="${GNOME_FRONTEND_LIBS}"
dnl FRONTEND_INCLUDES="-I\${srcdir}/gnome -I\${srcdir}/xforms ${GNOME_FRONTEND_CFLAGS} " dnl FRONTEND_INCLUDES="${GNOME_FRONTEND_CFLAGS} "
dnl FRONTEND_LIBS="@XPM_LIB@ @XFORMS_LIB@ ${GNOME_FRONTEND_LIBS}";; dnl FRONTEND_LIBS="@XPM_LIB@ @XFORMS_LIB@ ${GNOME_FRONTEND_LIBS}";;
qt) qt)
QT_DO_IT_ALL QT_DO_IT_ALL
@ -201,8 +200,8 @@ dnl FRONTEND_LIBS="@XPM_LIB@ @XFORMS_LIB@ ${GNOME_FRONTEND_LIBS}";;
RPM_FRONTEND_DEPS='qt >= 2.2.1' RPM_FRONTEND_DEPS='qt >= 2.2.1'
FRONTEND="qt2" FRONTEND="qt2"
FRONTEND_GUILIB="qt2/*.lo qt2/ui/*.lo qt2/moc/*.lo qt2/ui/moc/*.lo" FRONTEND_GUILIB="qt2/*.lo qt2/ui/*.lo qt2/moc/*.lo qt2/ui/moc/*.lo"
FRONTEND_LDFLAGS="\$(QT_LDFLAGS)" FRONTEND_LDFLAGS='$(QT_LDFLAGS)'
FRONTEND_INCLUDES="-I\${srcdir}/qt2 \$(QT_INCLUDES)" FRONTEND_INCLUDES='$(QT_INCLUDES)'
FRONTEND_LIBS="\$(QT_LIB)" FRONTEND_LIBS="\$(QT_LIB)"
FRONTEND_INFO=" Qt version: ${QT_VERSION}\n" FRONTEND_INFO=" Qt version: ${QT_VERSION}\n"
;; ;;

View File

@ -130,6 +130,7 @@ src/frontends/xforms/FormUrl.C
src/frontends/xforms/FormVCLog.C src/frontends/xforms/FormVCLog.C
src/frontends/xforms/FormWrap.C src/frontends/xforms/FormWrap.C
src/frontends/xforms/Menubar_pimpl.C src/frontends/xforms/Menubar_pimpl.C
src/frontends/xforms/XFormsMenubar.C
src/frontends/xforms/XMiniBuffer.C src/frontends/xforms/XMiniBuffer.C
src/frontends/xforms/xformsBC.h src/frontends/xforms/xformsBC.h
src/frontends/xforms/xforms_helpers.C src/frontends/xforms/xforms_helpers.C

View File

@ -1,3 +1,13 @@
2003-07-25 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
* Menubar.h: do not use a pimpl, but rather an abstract class
* Menubar.C: removed
2003-07-25 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
* Toolbar.h: do not use a pimpl, but rather an abstract class
2003-07-21 Angus Leeming <leeming@lyx.org> 2003-07-21 Angus Leeming <leeming@lyx.org>
* screen.C (c-tor, greyOut): use namespace lyx::graphics * screen.C (c-tor, greyOut): use namespace lyx::graphics

View File

@ -6,7 +6,7 @@ DIST_SUBDIRS = controllers xforms qt2 gnome
noinst_LTLIBRARIES = libfrontends.la noinst_LTLIBRARIES = libfrontends.la
INCLUDES = $(FRONTEND_INCLUDES) -I$(srcdir)/.. $(BOOST_INCLUDES) INCLUDES = -I$(srcdir)/.. $(BOOST_INCLUDES)
libfrontends_la_SOURCES = \ libfrontends_la_SOURCES = \
Alert.C \ Alert.C \
@ -20,7 +20,6 @@ libfrontends_la_SOURCES = \
LyXScreenFactory.h \ LyXScreenFactory.h \
LyXView.C \ LyXView.C \
LyXView.h \ LyXView.h \
Menubar.C \
Menubar.h \ Menubar.h \
Painter.C \ Painter.C \
Painter.h \ Painter.h \

View File

@ -1,39 +0,0 @@
/**
* \file Menubar.C
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author Jean-Marc Lasgouttes
*
* Full author contact details are available in file CREDITS
*/
#include <config.h>
#include "Menubar.h"
#include "MenuBackend.h"
#include "Menubar_pimpl.h"
Menubar::Menubar(LyXView * o, MenuBackend const & md)
{
pimpl_ = new Pimpl(o, md);
}
Menubar::~Menubar()
{
delete pimpl_;
}
void Menubar::openByName(string const & name)
{
pimpl_->openByName(name);
}
void Menubar::update()
{
pimpl_->update();
}

View File

@ -5,6 +5,7 @@
* 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
*/ */
@ -15,32 +16,17 @@
#include "LString.h" #include "LString.h"
class LyXView;
class MenuBackend;
/** /**
* The LyX GUI independent menubar class * The LyX GUI independent menubar class
* The GUI interface is implemented in the corresponding Menubar_pimpl class. * The GUI interface is implemented in the frontends
*/ */
class Menubar { class Menubar {
public: public:
/// ///
Menubar(LyXView * o, MenuBackend const &); virtual ~Menubar() {}
///
~Menubar();
/// Opens a top-level submenu given its name /// Opens a top-level submenu given its name
void openByName(string const &); virtual void openByName(string const &) = 0;
/// update the state of the menuitems /// update the state of the menuitems
void update(); virtual void update() = 0;
//I disable this temporarily until I find a nice way to make it work
//with compaq cxx. (Jean-Marc)
// Is this a new comment? (Lgb)
struct Pimpl;
friend struct Pimpl;
private:
///
Pimpl * pimpl_;
}; };
#endif // MENUBAR_H #endif // MENUBAR_H

View File

@ -1,3 +1,13 @@
2003-07-25 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
* QLMenubar.h:
* QLMenubar.C: derives from Menubar (replaces Menubar::Pimpl)
* Menubar_pimpl.C:
* Menubar_pimpl.h: removed
* QtView.C: modified because of changes above
2003-07-25 Jean-Marc Lasgouttes <lasgouttes@lyx.org> 2003-07-25 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
* QLToolbar.h: * QLToolbar.h:

View File

@ -25,7 +25,7 @@ libqt2_la_SOURCES = \
FileDialog.C \ FileDialog.C \
LyXKeySymFactory.C \ LyXKeySymFactory.C \
LyXScreenFactory.C \ LyXScreenFactory.C \
Menubar_pimpl.C Menubar_pimpl.h \ QLMenubar.C QLMenubar.h \
qtTimeout.C qtTimeout.h \ qtTimeout.C qtTimeout.h \
QAbout.C QAbout.h \ QAbout.C QAbout.h \
QBibitem.C QBibitem.h \ QBibitem.C QBibitem.h \

View File

@ -1,17 +1,15 @@
/** /**
* \file qt2/Menubar_pimpl.C * \file qt2/QLMenubar.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 John Levon
* *
* Full author contact details are available in file CREDITS * Full author contact details are available in file CREDITS
*/ */
#include <config.h> #include <config.h>
#include "Menubar_pimpl.h"
#include "MenuBackend.h" #include "MenuBackend.h"
#include "LyXAction.h" #include "LyXAction.h"
#include "kbmap.h" #include "kbmap.h"
@ -24,6 +22,7 @@
#include "debug.h" #include "debug.h"
#include "QtView.h" #include "QtView.h"
#include "QLMenubar.h"
#include "QLPopupMenu.h" #include "QLPopupMenu.h"
#include <qmenubar.h> #include <qmenubar.h>
@ -39,7 +38,7 @@ using std::for_each;
using std::pair; using std::pair;
Menubar::Pimpl::Pimpl(LyXView * view, MenuBackend const & mbe) QLMenubar::QLMenubar(LyXView * view, MenuBackend const & mbe)
: owner_(static_cast<QtView*>(view)), menubackend_(mbe) : owner_(static_cast<QtView*>(view)), menubackend_(mbe)
{ {
Menu::const_iterator m = mbe.getMenubar().begin(); Menu::const_iterator m = mbe.getMenubar().begin();
@ -63,11 +62,7 @@ Menubar::Pimpl::Pimpl(LyXView * view, MenuBackend const & mbe)
} }
Menubar::Pimpl::~Pimpl() void QLMenubar::openByName(string const & name)
{}
void Menubar::Pimpl::openByName(string const & name)
{ {
NameMap::const_iterator const cit = name_map_.find(name); NameMap::const_iterator const cit = name_map_.find(name);
if (cit == name_map_.end()) if (cit == name_map_.end())
@ -78,17 +73,17 @@ void Menubar::Pimpl::openByName(string const & name)
} }
void Menubar::Pimpl::update() void QLMenubar::update()
{} {}
QtView * Menubar::Pimpl::view() QtView * QLMenubar::view()
{ {
return owner_; return owner_;
} }
MenuBackend const & Menubar::Pimpl::backend() MenuBackend const & QLMenubar::backend()
{ {
return menubackend_; return menubackend_;
} }

View File

@ -1,6 +1,6 @@
// -*- C++ -*- // -*- C++ -*-
/** /**
* \file qt2/Menubar_pimpl.h * \file qt2/QLMenubar.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.
* *
@ -11,9 +11,8 @@
*/ */
#ifndef MENUBAR_PIMPL_H #ifndef QLMENUBAR_H
#define MENUBAR_PIMPL_H #define QLMENUBAR_H
#include "frontends/Menubar.h" #include "frontends/Menubar.h"
#include "LString.h" #include "LString.h"
@ -24,12 +23,10 @@ class QtView;
class MenuBackend; class MenuBackend;
class QLPopupMenu; class QLPopupMenu;
struct Menubar::Pimpl { class QLMenubar : public Menubar {
public: public:
Pimpl(LyXView *, MenuBackend const &); QLMenubar(LyXView *, MenuBackend const &);
~Pimpl();
/// opens a top-level submenu given its name /// opens a top-level submenu given its name
void openByName(string const &); void openByName(string const &);
@ -54,4 +51,4 @@ private:
NameMap name_map_; NameMap name_map_;
}; };
#endif // MENUBAR_PIMPL_H #endif // QLMENUBAR_H

View File

@ -18,6 +18,7 @@
#include "QtView.h" #include "QtView.h"
#include "QLMenubar.h"
#include "QLPopupMenu.h" #include "QLPopupMenu.h"
#include "qt_helpers.h" #include "qt_helpers.h"
@ -58,7 +59,7 @@ string const getLabel(MenuItem const & mi)
pair<int, QLPopupMenu *> pair<int, QLPopupMenu *>
createMenu(QMenuData * parent, MenuItem const * item, Menubar::Pimpl * owner, createMenu(QMenuData * parent, MenuItem const * item, QLMenubar * owner,
bool is_toplevel) bool is_toplevel)
{ {
// FIXME: leaks ?? // FIXME: leaks ??
@ -68,7 +69,7 @@ createMenu(QMenuData * parent, MenuItem const * item, Menubar::Pimpl * owner,
} }
QLPopupMenu::QLPopupMenu(Menubar::Pimpl * owner, QLPopupMenu::QLPopupMenu(QLMenubar * owner,
string const & name, bool toplevel) string const & name, bool toplevel)
: owner_(owner), name_(name) : owner_(owner), name_(name)
{ {

View File

@ -13,8 +13,6 @@
#define QLPOPUPMENU_H #define QLPOPUPMENU_H
#include "Menubar_pimpl.h"
#include <qpopupmenu.h> #include <qpopupmenu.h>
#include "LString.h" #include "LString.h"
@ -23,18 +21,19 @@ class MenuBackend;
class MenuItem; class MenuItem;
class Menu; class Menu;
class QMenuData; class QMenuData;
class QLMenubar;
class QLPopupMenu; class QLPopupMenu;
/// create a sub-menu /// create a sub-menu
std::pair<int, QLPopupMenu *> std::pair<int, QLPopupMenu *>
createMenu(QMenuData * parent, MenuItem const * item, createMenu(QMenuData * parent, MenuItem const * item,
Menubar::Pimpl * owner, bool is_toplevel = false); QLMenubar * owner, bool is_toplevel = false);
/// a submenu /// a submenu
class QLPopupMenu : public QPopupMenu { class QLPopupMenu : public QPopupMenu {
Q_OBJECT Q_OBJECT
public: public:
QLPopupMenu(Menubar::Pimpl * owner, QLPopupMenu(QLMenubar * owner,
string const & name, bool toplevel); string const & name, bool toplevel);
/// populate the menu /// populate the menu
@ -44,7 +43,7 @@ public slots:
void showing(); void showing();
private: private:
/// our owning menubar /// our owning menubar
Menubar::Pimpl * owner_; QLMenubar * owner_;
/// the name of this menu /// the name of this menu
string name_; string name_;

View File

@ -21,7 +21,6 @@
#include "lyxfunc.h" #include "lyxfunc.h"
#include "BufferView.h" #include "BufferView.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 "QtView.h" #include "QtView.h"
#include "QLToolbar.h" #include "QLToolbar.h"
#include "QLMenubar.h"
#include "qfont_loader.h" #include "qfont_loader.h"
#include "QCommandBuffer.h" #include "QCommandBuffer.h"
#include "qt_helpers.h" #include "qt_helpers.h"
@ -61,7 +61,7 @@ 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 QLMenubar(this, menubackend));
toolbar_.reset(new QLToolbar(this)); toolbar_.reset(new QLToolbar(this));
toolbar_->init(); toolbar_->init();

View File

@ -1,10 +1,22 @@
2003-07-25 Jean-Marc Lasgouttes <lasgouttes@lyx.org> <lyx@htwm.de> 2003-07-25 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
* * XFormsMenubar.h:
* XFormsMenubar.C: derives from Menubar (replaces Menubar::Pimpl)
2003-07-25 Jean-Marc Lasgouttes <lasgoutes@lyx.org> * Menubar_pimpl.C:
* Menubar_pimpl.h: removed
* XFormsView.C: modified because of changes above
2003-07-25 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
* XFormsToolbar.h: * XFormsToolbar.h:
* XFormsToolbar.C: derives from Toolbar (replaces Toolbar::Pimpl)
* Toolbar_pimpl.C:
* Toolbar_pimpl.h: removed
* XFormsView.C: modified because of changes above
2003-07-23 Angus Leeming <leeming@lyx.org> 2003-07-23 Angus Leeming <leeming@lyx.org>

View File

@ -151,8 +151,8 @@ libxforms_la_SOURCES = \
FormWrap.h \ FormWrap.h \
LyXKeySymFactory.C \ LyXKeySymFactory.C \
LyXScreenFactory.C \ LyXScreenFactory.C \
Menubar_pimpl.C \ XFormsMenubar.C \
Menubar_pimpl.h \ XFormsMenubar.h \
RadioButtonGroup.C \ RadioButtonGroup.C \
RadioButtonGroup.h \ RadioButtonGroup.h \
XFormsToolbar.C \ XFormsToolbar.C \

View File

@ -1,5 +1,5 @@
/** /**
* \file xforms/Menubar_pimpl.C * \file XFormsMenubar.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.
* *
@ -11,7 +11,7 @@
#include <config.h> #include <config.h>
#include "Menubar_pimpl.h" #include "XFormsMenubar.h"
#include "MenuBackend.h" #include "MenuBackend.h"
#include "XFormsView.h" #include "XFormsView.h"
#include "lyxfunc.h" #include "lyxfunc.h"
@ -72,26 +72,26 @@ extern "C" {
//Defined later, used in makeMenubar(). //Defined later, used in makeMenubar().
static static
void C_Menubar_Pimpl_MenuCallback(FL_OBJECT * ob, long button) void C_XFormsMenubar_MenuCallback(FL_OBJECT * ob, long button)
{ {
Menubar::Pimpl::MenuCallback(ob, button); XFormsMenubar::MenuCallback(ob, button);
} }
} }
Menubar::Pimpl::Pimpl(LyXView * view, MenuBackend const & mb) XFormsMenubar::XFormsMenubar(LyXView * view, MenuBackend const & mb)
: owner_(static_cast<XFormsView*>(view)), menubackend_(&mb) : owner_(static_cast<XFormsView*>(view)), menubackend_(&mb)
{ {
makeMenubar(menubackend_->getMenubar()); makeMenubar(menubackend_->getMenubar());
} }
Menubar::Pimpl::~Pimpl() XFormsMenubar::~XFormsMenubar()
{} {}
void Menubar::Pimpl::makeMenubar(Menu const & menu) void XFormsMenubar::makeMenubar(Menu const & menu)
{ {
FL_FORM * form = owner_->getForm(); FL_FORM * form = owner_->getForm();
int moffset = 0; int moffset = 0;
@ -108,7 +108,7 @@ void Menubar::Pimpl::makeMenubar(Menu const & menu)
for (; i != end; ++i) { for (; i != end; ++i) {
FL_OBJECT * obj; FL_OBJECT * obj;
if (i->kind() != MenuItem::Submenu) { if (i->kind() != MenuItem::Submenu) {
lyxerr << "ERROR: Menubar::Pimpl::createMenubar:" lyxerr << "ERROR: XFormsMenubar::createMenubar:"
" only submenus can appear in a menubar" " only submenus can appear in a menubar"
<< endl; << endl;
continue; continue;
@ -130,7 +130,7 @@ void Menubar::Pimpl::makeMenubar(Menu const & menu)
NorthWestGravity); NorthWestGravity);
moffset += obj->w + air; moffset += obj->w + air;
fl_set_object_shortcut(obj, shortcut.c_str(), 1); fl_set_object_shortcut(obj, shortcut.c_str(), 1);
fl_set_object_callback(obj, C_Menubar_Pimpl_MenuCallback, 1); fl_set_object_callback(obj, C_XFormsMenubar_MenuCallback, 1);
boost::shared_ptr<ItemInfo> boost::shared_ptr<ItemInfo>
iteminfo(new ItemInfo(this, new MenuItem(*i), obj)); iteminfo(new ItemInfo(this, new MenuItem(*i), obj));
@ -141,13 +141,13 @@ void Menubar::Pimpl::makeMenubar(Menu const & menu)
} }
void Menubar::Pimpl::update() void XFormsMenubar::update()
{ {
// nothing yet // nothing yet
} }
void Menubar::Pimpl::openByName(string const & name) void XFormsMenubar::openByName(string const & name)
{ {
for (ButtonList::const_iterator cit = buttonlist_.begin(); for (ButtonList::const_iterator cit = buttonlist_.begin();
cit != buttonlist_.end(); ++cit) { cit != buttonlist_.end(); ++cit) {
@ -157,7 +157,7 @@ void Menubar::Pimpl::openByName(string const & name)
} }
} }
lyxerr << "Menubar::Pimpl::openByName: menu " lyxerr << "XFormsMenubar::openByName: menu "
<< name << " not found" << endl; << name << " not found" << endl;
} }
@ -191,11 +191,11 @@ string const fixlabel(string const & str)
int Menubar::Pimpl::create_submenu(Window win, XFormsView * view, int XFormsMenubar::create_submenu(Window win, XFormsView * view,
Menu const & menu, vector<int> & smn) Menu const & menu, vector<int> & smn)
{ {
const int menuid = get_new_submenu(smn, win); const int menuid = get_new_submenu(smn, win);
lyxerr[Debug::GUI] << "Menubar::Pimpl::create_submenu: creating " lyxerr[Debug::GUI] << "XFormsMenubar::create_submenu: creating "
<< menu.name() << " as menuid=" << menuid << endl; << menu.name() << " as menuid=" << menuid << endl;
// Compute the size of the largest label (because xforms is // Compute the size of the largest label (because xforms is
@ -321,7 +321,7 @@ int Menubar::Pimpl::create_submenu(Window win, XFormsView * view,
default: default:
lyxerr << "Menubar::Pimpl::create_submenu: " lyxerr << "XFormsMenubar::create_submenu: "
"this should not happen" << endl; "this should not happen" << endl;
break; break;
} }
@ -330,10 +330,10 @@ int Menubar::Pimpl::create_submenu(Window win, XFormsView * view,
} }
void Menubar::Pimpl::MenuCallback(FL_OBJECT * ob, long button) void XFormsMenubar::MenuCallback(FL_OBJECT * ob, long button)
{ {
ItemInfo * iteminfo = static_cast<ItemInfo *>(ob->u_vdata); ItemInfo * iteminfo = static_cast<ItemInfo *>(ob->u_vdata);
XFormsView * view = iteminfo->pimpl_->owner_; XFormsView * view = iteminfo->menubar_->owner_;
MenuItem const * item = iteminfo->item_.get(); MenuItem const * item = iteminfo->item_.get();
if (button == 1) { if (button == 1) {
@ -349,12 +349,12 @@ void Menubar::Pimpl::MenuCallback(FL_OBJECT * ob, long button)
// set tabstop length // set tabstop length
fl_set_tabstop(menu_tabstop); fl_set_tabstop(menu_tabstop);
MenuBackend const * menubackend_ = iteminfo->pimpl_->menubackend_; MenuBackend const * menubackend_ = iteminfo->menubar_->menubackend_;
Menu tomenu; Menu tomenu;
Menu const frommenu = menubackend_->getMenu(item->submenuname()); Menu const frommenu = menubackend_->getMenu(item->submenuname());
menubackend_->expand(frommenu, tomenu, view); menubackend_->expand(frommenu, tomenu, view);
vector<int> submenus; vector<int> submenus;
int menu = iteminfo->pimpl_->create_submenu(FL_ObjWin(ob), view, int menu = iteminfo->menubar_->create_submenu(FL_ObjWin(ob), view,
tomenu, submenus); tomenu, submenus);
if (menu != -1) { if (menu != -1) {
// place popup // place popup
@ -388,13 +388,13 @@ void Menubar::Pimpl::MenuCallback(FL_OBJECT * ob, long button)
} }
Menubar::Pimpl::ItemInfo::ItemInfo XFormsMenubar::ItemInfo::ItemInfo
(Menubar::Pimpl * p, MenuItem const * i, FL_OBJECT * o) (XFormsMenubar * p, MenuItem const * i, FL_OBJECT * o)
: pimpl_(p), obj_(o) : menubar_(p), obj_(o)
{ {
item_.reset(i); item_.reset(i);
} }
Menubar::Pimpl::ItemInfo::~ItemInfo() XFormsMenubar::ItemInfo::~ItemInfo()
{} {}

View File

@ -1,6 +1,6 @@
// -*- C++ -*- // -*- C++ -*-
/** /**
* \file xforms/Menubar_pimpl.h * \file XFormsMenubar.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.
* *
@ -9,9 +9,8 @@
* Full author contact details are available in file CREDITS * Full author contact details are available in file CREDITS
*/ */
#ifndef MENUBAR_PIMPL_H #ifndef XFORMSMENUBAR_H
#define MENUBAR_PIMPL_H #define XFORMSMENUBAR_H
#include "LString.h" #include "LString.h"
#include "frontends/Menubar.h" #include "frontends/Menubar.h"
@ -28,16 +27,14 @@ class LyXView;
class XFormsView; class XFormsView;
class Menu; class Menu;
class MenuItem; class MenuItem;
class MenuBackend;
/** The LyX GUI independent menubar class class XFormsMenubar : public Menubar {
The GUI interface is implemented in the corresponding Menubar_pimpl class.
*/
struct Menubar::Pimpl {
public: public:
/// ///
Pimpl(LyXView *, MenuBackend const &); XFormsMenubar(LyXView *, MenuBackend const &);
/// ///
~Pimpl(); ~XFormsMenubar();
/// update the state of the menuitems /// update the state of the menuitems
void update(); void update();
@ -69,11 +66,11 @@ private:
/// ///
struct ItemInfo { struct ItemInfo {
/// ///
ItemInfo(Menubar::Pimpl * p, MenuItem const * i, ItemInfo(XFormsMenubar * p, MenuItem const * i,
FL_OBJECT * o); FL_OBJECT * o);
~ItemInfo(); ~ItemInfo();
/// ///
Menubar::Pimpl * pimpl_; XFormsMenubar * menubar_;
/// ///
boost::shared_ptr<MenuItem const> item_; boost::shared_ptr<MenuItem const> item_;
/// ///

View File

@ -1,5 +1,5 @@
/** /**
* \file xforms/XFormsToolbar.C * \file 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.
* *

View File

@ -1,6 +1,6 @@
// -*- C++ -*- // -*- C++ -*-
/** /**
* \file xforms/XFormsToolbar.h * \file 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.
* *

View File

@ -15,12 +15,12 @@
#include "lyx_forms.h" #include "lyx_forms.h"
#include "XMiniBuffer.h" #include "XMiniBuffer.h"
#include "XFormsMenubar.h"
#include "XFormsToolbar.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/Menubar.h"
#include "frontends/Timeout.h" #include "frontends/Timeout.h"
#include "frontends/Dialogs.h" #include "frontends/Dialogs.h"
#include "MenuBackend.h" #include "MenuBackend.h"
@ -140,7 +140,7 @@ void XFormsView::create_form_form_main(int width, int height)
int const air = 2; int const air = 2;
int const bw = abs(fl_get_border_width()); int const bw = abs(fl_get_border_width());
menubar_.reset(new Menubar(this, menubackend)); menubar_.reset(new XFormsMenubar(this, menubackend));
toolbar_.reset(new XFormsToolbar(this, air, 30 + air + bw)); toolbar_.reset(new XFormsToolbar(this, air, 30 + air + bw));
toolbar_->init(); toolbar_->init();