2002-07-02 Lars Gullik Bj�nnes <larsbj@birdstep.com>

Dialogs.h: remove static from redrawGUI and
toggleTooltips.

And changes because of this.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4517 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 2002-07-02 19:23:10 +00:00
parent 46917487e3
commit 5fd921e9e6
82 changed files with 220 additions and 213 deletions

View File

@ -1,3 +1,8 @@
2002-07-02 Lars Gullik Bjønnes <larsbj@birdstep.com>
* Dialogs.h: remove static from redrawGUI and
toggleTooltips.
2002-06-28 Angus Leeming <leeming@lyx.org>
* Painter.h:

View File

@ -28,13 +28,13 @@
// Signal enabling all visible dialogs to be redrawn if so desired.
// E.g., when the GUI colours have been remapped.
boost::signal0<void> Dialogs::redrawGUI;
//boost::signal0<void> Dialogs::redrawGUI;
extern LyXView * dialogs_lyxview;
// toggle tooltips on/off in all dialogs.
boost::signal0<void> Dialogs::toggleTooltips;
//boost::signal0<void> Dialogs::toggleTooltips;
void Dialogs::showAboutlyx()
{

View File

@ -66,10 +66,10 @@ public:
/** Redraw all visible dialogs because, for example, the GUI colours
have been re-mapped. */
static boost::signal0<void> redrawGUI;
boost::signal0<void> redrawGUI;
/// Toggle tooltips on/off in all dialogs.
static boost::signal0<void> toggleTooltips;
boost::signal0<void> toggleTooltips;
/// Are the tooltips on or off?
static bool tooltipsEnabled();

View File

@ -23,10 +23,11 @@ using std::endl;
extern LyXAction lyxaction;
Toolbar::Toolbar(LyXView * o, int x, int y, ToolbarDefaults const &tbd)
Toolbar::Toolbar(LyXView * o, Dialogs & d,
int x, int y, ToolbarDefaults const &tbd)
: last_textclass_(-1)
{
pimpl_ = new Pimpl(o, x, y);
pimpl_ = new Pimpl(o, d, x, y);
pimpl_->reset();

View File

@ -22,6 +22,7 @@
class LyXView;
class ToolbarDefaults;
class Dialogs;
/** The LyX GUI independent toolbar class
The GUI interface is implemented in the corresponding Toolbar_pimpl class.
@ -29,7 +30,8 @@ class ToolbarDefaults;
class Toolbar {
public:
///
Toolbar(LyXView * o, int x, int y, ToolbarDefaults const &);
Toolbar(LyXView * o, Dialogs & d,
int x, int y, ToolbarDefaults const &);
///
~Toolbar();
@ -55,8 +57,8 @@ public:
/// update the layout combox
void setLayout(string const & layout);
/**
* Populate the layout combox - returns whether we did a full
/**
* Populate the layout combox - returns whether we did a full
* update or not
*/
bool updateLayoutList(int textclass);

View File

@ -33,7 +33,7 @@ ControlConnectBase::ControlConnectBase(LyXView & lv, Dialogs & d)
void ControlConnectBase::connect()
{
r_ = Dialogs::redrawGUI.
r_ = d_.redrawGUI.
connect(boost::bind(&ControlConnectBase::redraw, this));
}

View File

@ -20,7 +20,7 @@ template <class Controller, class GUIview, class Policy, class GUIbc>
class GUI : public Controller {
public:
///
GUI(LyXView & lv, Dialogs & d) : Controller(lv, d), view_(*this) {}
GUI(LyXView & lv, Dialogs & d) : Controller(lv, d), view_(*this, d) {}
///
virtual ButtonControllerBase & bc() { return bc_; }
///

View File

@ -1,3 +1,4 @@
// -*- C++ -*-
/**
* \file lyx_gui.h
* Copyright 2002 the LyX Team
@ -8,22 +9,24 @@
#ifndef LYX_GUI_H
#define LYX_GUI_H
#include <config.h>
#include "LString.h"
#include <vector>
class Dialogs;
/// GUI interaction
namespace lyx_gui {
/// parse command line and do basic initialisation
void parse_init(int & argc, char * argv[]);
/**
* set up GUI parameters. At this point lyxrc may
* be used.
* be used.
*/
void parse_lyxrc();

View File

@ -33,7 +33,7 @@ using std::endl;
FileDialog::FileDialog(LyXView *lv, string const &t, kb_action s, Button b1, Button b2)
: private_(0), lv_(lv), title_(t), success_(s)
{
private_ = new FileDialog::Private;
private_ = new FileDialog::Private(*lv->getDialogs());
private_->SetButton(0, b1.first, b1.second);
private_->SetButton(1, b2.first, b2.second);
@ -43,7 +43,6 @@ FileDialog::FileDialog(LyXView *lv, string const &t, kb_action s, Button b1, But
FileDialog::~FileDialog()
{
delete private_;
private_ = 0;
}

View File

@ -25,8 +25,8 @@ using std::getline;
typedef FormCB<ControlAboutlyx, FormDB<FD_aboutlyx> > base_class;
FormAboutlyx::FormAboutlyx(ControlAboutlyx & c)
: base_class(c, _("About LyX"), false)
FormAboutlyx::FormAboutlyx(ControlAboutlyx & c, Dialogs & d)
: base_class(c, d, _("About LyX"), false)
{}

View File

@ -30,7 +30,7 @@ struct FD_aboutlyx_license;
class FormAboutlyx : public FormCB<ControlAboutlyx, FormDB<FD_aboutlyx> > {
public:
///
FormAboutlyx(ControlAboutlyx &);
FormAboutlyx(ControlAboutlyx &, Dialogs &);
private:
/// not needed.

View File

@ -32,9 +32,10 @@ static int C_PrehandlerCB(FL_OBJECT *, int, FL_Coord, FL_Coord, int, void *);
} // extern "C"
FormBase::FormBase(ControlButtons & c, string const & t, bool allowResize)
FormBase::FormBase(ControlButtons & c, Dialogs & d,
string const & t, bool allowResize)
: ViewBC<xformsBC>(c), minw_(0), minh_(0), allow_resize_(allowResize),
title_(t), tooltips_(new Tooltips)
title_(t), tooltips_(new Tooltips(d))
{}

View File

@ -28,6 +28,7 @@
class xformsBC;
class Tooltips;
class Dialogs;
/** This class is an XForms GUI base class.
*/
@ -35,7 +36,8 @@ class FormBase : public ViewBC<xformsBC>, public FeedbackController
{
public:
///
FormBase(ControlButtons &, string const &, bool allowResize);
FormBase(ControlButtons &, Dialogs &,
string const &, bool allowResize);
///
virtual ~FormBase();
@ -91,7 +93,8 @@ class FormDB: public FormBase
{
protected:
///
FormDB(ControlButtons &, string const &, bool allowResize=true);
FormDB(ControlButtons &, Dialogs &,
string const &, bool allowResize=true);
/// Pointer to the actual instantiation of xform's form
virtual FL_FORM * form() const;
/// Real GUI implementation.
@ -100,8 +103,9 @@ protected:
template <class Dialog>
FormDB<Dialog>::FormDB(ControlButtons & c, string const & t, bool allowResize)
: FormBase(c, t, allowResize)
FormDB<Dialog>::FormDB(ControlButtons & c, Dialogs & d,
string const & t, bool allowResize)
: FormBase(c, d, t, allowResize)
{}
@ -118,16 +122,17 @@ class FormCB: public Base
{
protected:
///
FormCB(Controller &, string const &, bool allowResize=true);
FormCB(Controller &, Dialogs &,
string const &, bool allowResize = true);
/// The parent controller
Controller & controller() const;
};
template <class Controller, class Base>
FormCB<Controller, Base>::FormCB(Controller & c, string const & t,
bool allowResize)
: Base(c, t, allowResize)
FormCB<Controller, Base>::FormCB(Controller & c, Dialogs & d,
string const & t, bool allowResize)
: Base(c, d, t, allowResize)
{}

View File

@ -43,7 +43,7 @@ FormBaseDeprecated::FormBaseDeprecated(LyXView * lv, Dialogs * d,
string const & t, bool allowResize)
: lv_(lv), d_(d), title_(t),
minw_(0), minh_(0), allow_resize_(allowResize),
tooltips_(new Tooltips)
tooltips_(new Tooltips(*d))
{
lyx::Assert(lv && d);
}
@ -71,7 +71,7 @@ void FormBaseDeprecated::redraw()
void FormBaseDeprecated::connect()
{
fl_set_form_minsize(form(), minw_, minh_);
r_ = Dialogs::redrawGUI.connect(boost::bind(&FormBaseDeprecated::redraw, this));
r_ = d_->redrawGUI.connect(boost::bind(&FormBaseDeprecated::redraw, this));
}

View File

@ -22,8 +22,8 @@
typedef FormCB<ControlBibitem, FormDB<FD_bibitem> > base_class;
FormBibitem::FormBibitem(ControlBibitem & c)
: base_class(c, _("Bibliography Entry"))
FormBibitem::FormBibitem(ControlBibitem & c, Dialogs & d)
: base_class(c, d, _("Bibliography Entry"))
{}

View File

@ -26,8 +26,7 @@ struct FD_bibitem;
class FormBibitem : public FormCB<ControlBibitem, FormDB<FD_bibitem> > {
public:
///
FormBibitem(ControlBibitem &);
FormBibitem(ControlBibitem &, Dialogs &);
private:
/// Set the Params variable for the Controller.
virtual void apply();

View File

@ -36,8 +36,8 @@ using std::sort;
typedef FormCB<ControlBibtex, FormDB<FD_bibtex> > base_class;
FormBibtex::FormBibtex(ControlBibtex & c)
: base_class(c, _("BibTeX Database"))
FormBibtex::FormBibtex(ControlBibtex & c, Dialogs & d)
: base_class(c, d, _("BibTeX Database"))
{}
@ -75,13 +75,13 @@ void FormBibtex::build()
str = _("Activate this option if you want the bibliography to appear in the Table of Contents (which doesn't happen by default)");
tooltips().init(dialog_->check_bibtotoc, str);
str = _("Choose a BibTeX style from the browsers list");
tooltips().init(dialog_->button_style_choose, str);
str = _("Updates your TeX system for a new bibstyle list. Only the styles which are in directories where TeX finds them are listed!");
tooltips().init(dialog_->button_rescan, str);
}
@ -116,9 +116,9 @@ ButtonPolicy::SMInput FormBibtex::input(FL_OBJECT * ob, long)
}
} else if (ob == dialog_->button_style_choose) {
unsigned int selection = fl_get_browser(dialog_->browser_styles);
string const out_name =
string const out_name =
fl_get_browser_line(dialog_->browser_styles, selection);
fl_set_input(dialog_->input_style,
fl_set_input(dialog_->input_style,
ChangeExtension(out_name, string()).c_str());
} else if (ob == dialog_->button_rescan)
controller().rescanBibStyles();

View File

@ -26,8 +26,7 @@ struct FD_bibtex;
class FormBibtex : public FormCB<ControlBibtex, FormDB<FD_bibtex> > {
public:
///
FormBibtex(ControlBibtex &);
FormBibtex(ControlBibtex &, Dialogs &);
private:
/// Set the Params variable for the Controller.
virtual void apply();

View File

@ -16,8 +16,9 @@
#include "forms/form_browser.h"
#include "xformsBC.h"
FormBrowser::FormBrowser(ControlButtons & c, string const & t, bool allowResize)
: FormDB<FD_browser>(c, t, allowResize)
FormBrowser::FormBrowser(ControlButtons & c, Dialogs & d,
string const & t, bool allowResize)
: FormDB<FD_browser>(c, d, t, allowResize)
{}

View File

@ -26,8 +26,8 @@ struct FD_browser;
class FormBrowser : public FormDB<FD_browser> {
public:
///
FormBrowser(ControlButtons &, string const &, bool allowResize=true);
FormBrowser(ControlButtons &, Dialogs &,
string const &, bool allowResize = true);
private:
/// Build the dialog.
virtual void build();

View File

@ -36,8 +36,8 @@ using namespace frnt;
typedef FormCB<ControlCharacter, FormDB<FD_character> > base_class;
FormCharacter::FormCharacter(ControlCharacter & c)
: base_class(c, _("Character Layout"), false)
FormCharacter::FormCharacter(ControlCharacter & c, Dialogs & d)
: base_class(c, d, _("Character Layout"), false)
{}

View File

@ -35,7 +35,7 @@ class FormCharacter
: public FormCB<ControlCharacter, FormDB<FD_character> > {
public:
///
FormCharacter(ControlCharacter &);
FormCharacter(ControlCharacter &, Dialogs &);
private:
/// Apply from dialog

View File

@ -58,14 +58,14 @@ void fillChoice(FD_citation * dialog, vector<string> vec)
string str = " ";
if (!vec.empty())
str += getStringFromVector(vec, " | ") + " ";
fl_clear_choice(dialog->choice_style);
fl_addto_choice(dialog->choice_style, str.c_str());
setEnabled(dialog->choice_style, !vec.empty());
if (vec.empty())
return;
// The width of the choice varies with the contents.
// Ensure that it is centred in the frame.
@ -115,8 +115,8 @@ void updateStyle(FD_citation * dialog, string command)
typedef FormCB<ControlCitation, FormDB<FD_citation> > base_class;
FormCitation::FormCitation(ControlCitation & c)
: base_class(c, _("Citation"), false)
FormCitation::FormCitation(ControlCitation & c, Dialogs & d)
: base_class(c, d, _("Citation"), false)
{}

View File

@ -25,8 +25,7 @@ struct FD_citation;
class FormCitation : public FormCB<ControlCitation, FormDB<FD_citation> > {
public:
///
FormCitation(ControlCitation &);
FormCitation(ControlCitation &, Dialogs &);
private:
///
enum State {

View File

@ -23,8 +23,8 @@
typedef FormCB<ControlERT, FormDB<FD_ert> > base_class;
FormERT::FormERT(ControlERT & c)
: base_class(c, _("ERT Options"))
FormERT::FormERT(ControlERT & c, Dialogs & d)
: base_class(c, d, _("ERT Options"))
{}

View File

@ -26,7 +26,7 @@ class FormERT
: public FormCB<ControlERT, FormDB<FD_ert> > {
public:
///
FormERT(ControlERT &);
FormERT(ControlERT &, Dialogs &);
private:
/// Set the Params variable for the Controller.
virtual void apply();

View File

@ -21,8 +21,8 @@
typedef FormCB<ControlError, FormDB<FD_error> > base_class;
FormError::FormError(ControlError & c)
: base_class(c, _("LaTeX Error"))
FormError::FormError(ControlError & c, Dialogs & d)
: base_class(c, d, _("LaTeX Error"))
{}

View File

@ -24,8 +24,7 @@ struct FD_error;
class FormError : public FormCB<ControlError, FormDB<FD_error> > {
public:
/// Constructor
FormError(ControlError &);
FormError(ControlError &, Dialogs &);
private:
/// not needed.
virtual void apply() {}

View File

@ -27,8 +27,8 @@
typedef FormCB<ControlExternal, FormDB<FD_external> > base_class;
FormExternal::FormExternal(ControlExternal & c)
: base_class(c, _("Edit external file"))
FormExternal::FormExternal(ControlExternal & c, Dialogs & d)
: base_class(c, d, _("Edit external file"))
{}

View File

@ -26,8 +26,7 @@ struct FD_external;
class FormExternal : public FormCB<ControlExternal, FormDB<FD_external> > {
public:
///
FormExternal(ControlExternal &);
FormExternal(ControlExternal &, Dialogs &);
private:
/// apply changes
void apply();

View File

@ -422,7 +422,7 @@ void FileDialog::Private::SetInfoLine(string const & Line)
}
FileDialog::Private::Private()
FileDialog::Private::Private(Dialogs & dia)
{
pszDirectory = MakeAbsPath(string("."));
pszMask = '*';
@ -459,7 +459,7 @@ FileDialog::Private::Private()
fl_hide_object(pFileDlgForm->User1);
fl_hide_object(pFileDlgForm->User2);
r_ = Dialogs::redrawGUI.connect(boost::bind(&FileDialog::Private::redraw, this));
r_ = dia.redrawGUI.connect(boost::bind(&FileDialog::Private::redraw, this));
}

View File

@ -27,6 +27,8 @@
#include <vector>
class Dialogs;
/// DirEntry internal structure definition
class DirEntry {
public:
@ -51,7 +53,7 @@ class FD_filedialog;
class FileDialog::Private : public boost::signals::trackable {
public:
///
Private();
Private(Dialogs &);
///
~Private();

View File

@ -22,8 +22,8 @@
typedef FormCB<ControlFloat, FormDB<FD_float> > base_class;
FormFloat::FormFloat(ControlFloat & c)
: base_class(c, _("Float Options"))
FormFloat::FormFloat(ControlFloat & c, Dialogs & d)
: base_class(c, d, _("Float Options"))
{}

View File

@ -25,8 +25,7 @@ struct FD_float;
class FormFloat : public FormCB<ControlFloat, FormDB<FD_float> > {
public:
///
FormFloat(ControlFloat &);
FormFloat(ControlFloat &, Dialogs &);
private:
/// Set the Params variable for the Controller.
virtual void apply();

View File

@ -30,8 +30,8 @@ using std::find_if;
typedef FormCB<ControlForks, FormDB<FD_forks> > base_class;
FormForks::FormForks(ControlForks & c)
: base_class(c, _("Child processes"))
FormForks::FormForks(ControlForks & c, Dialogs & d)
: base_class(c, d, _("Child processes"))
{}

View File

@ -22,7 +22,7 @@ struct FD_forks;
class FormForks : public FormCB<ControlForks, FormDB<FD_forks> > {
public:
///
FormForks(ControlForks &);
FormForks(ControlForks &, Dialogs &);
/// preemptive handler for feedback messages
void feedbackCB(FL_OBJECT *, int);

View File

@ -53,8 +53,8 @@ LyXLength getLyXLengthFromWidgets(FL_OBJECT * input, FL_OBJECT * choice)
typedef FormCB<ControlGraphics, FormDB<FD_graphics> > base_class;
FormGraphics::FormGraphics(ControlGraphics & c)
: base_class(c, _("Graphics"), false)
FormGraphics::FormGraphics(ControlGraphics & c, Dialogs & d)
: base_class(c, d, _("Graphics"), false)
{}
@ -102,7 +102,7 @@ void FormGraphics::build()
// Store the identifiers for later
origins_ = getSecond(origindata);
string const choice =
" " + getStringFromVector(getFirst(origindata), " | ") +" ";
fl_addto_choice(file_->choice_origin, choice.c_str());
@ -513,7 +513,7 @@ ButtonPolicy::SMInput FormGraphics::input(FL_OBJECT * ob, long)
}
if (controller().isFilenameValid(out_name) &&
!controller().bbChanged)
updateBB(out_name, string());
updateBB(out_name, string());
} else if (ob == file_->check_subcaption) {
setEnabled(file_->input_subcaption,

View File

@ -35,8 +35,7 @@ struct FD_graphics_special;
class FormGraphics : public FormCB<ControlGraphics, FormDB<FD_graphics> > {
public:
///
FormGraphics(ControlGraphics &);
FormGraphics(ControlGraphics &, Dialogs &);
private:
/** Redraw the form (on receipt of a Signal indicating, for example,

View File

@ -26,8 +26,8 @@
typedef FormCB<ControlInclude, FormDB<FD_include> > base_class;
FormInclude::FormInclude(ControlInclude & c)
: base_class(c, _("Include file"))
FormInclude::FormInclude(ControlInclude & c, Dialogs & d)
: base_class(c, d, _("Include file"))
{}

View File

@ -25,8 +25,7 @@ struct FD_include;
class FormInclude : public FormCB<ControlInclude, FormDB<FD_include> > {
public:
///
FormInclude(ControlInclude &);
FormInclude(ControlInclude &, Dialogs &);
private:
/// Set the Params variable for the Controller.
virtual void apply();

View File

@ -21,8 +21,8 @@
typedef FormCB<ControlIndex, FormDB<FD_index> > base_class;
FormIndex::FormIndex(ControlIndex & c)
: base_class(c, _("Index"))
FormIndex::FormIndex(ControlIndex & c, Dialogs & d)
: base_class(c, d, _("Index"))
{}

View File

@ -24,8 +24,7 @@ struct FD_index;
class FormIndex : public FormCB<ControlIndex, FormDB<FD_index> > {
public:
///
FormIndex(ControlIndex &);
FormIndex(ControlIndex &, Dialogs &);
private:
/// Set the Params variable for the Controller.
virtual void apply();

View File

@ -19,8 +19,8 @@
#include "gettext.h"
#include FORMS_H_LOCATION
FormLog::FormLog(ControlLog & c)
: FormCB<ControlLog, FormBrowser>(c, _("LaTeX Log"))
FormLog::FormLog(ControlLog & c, Dialogs & d)
: FormCB<ControlLog, FormBrowser>(c, d, _("LaTeX Log"))
{}

View File

@ -25,7 +25,7 @@ class ControlLog;
class FormLog : public FormCB<ControlLog, FormBrowser> {
public:
///
FormLog(ControlLog &);
FormLog(ControlLog &, Dialogs &);
// Functions accessible to the Controller.

View File

@ -24,8 +24,8 @@
typedef FormCB<ControlMinipage, FormDB<FD_minipage> > base_class;
FormMinipage::FormMinipage(ControlMinipage & c)
: base_class(c, _("Minipage Options"))
FormMinipage::FormMinipage(ControlMinipage & c, Dialogs & d)
: base_class(c, d, _("Minipage Options"))
{}

View File

@ -26,7 +26,7 @@ class FormMinipage
: public FormCB<ControlMinipage, FormDB<FD_minipage> > {
public:
///
FormMinipage(ControlMinipage &);
FormMinipage(ControlMinipage &, Dialogs &);
private:
/// Set the Params variable for the Controller.
virtual void apply();

View File

@ -38,8 +38,8 @@ using std::remove_if;
typedef FormCB<ControlParagraph, FormDB<FD_paragraph> > base_class;
FormParagraph::FormParagraph(ControlParagraph & c)
: base_class(c, _("Paragraph Layout"), false)
FormParagraph::FormParagraph(ControlParagraph & c, Dialogs & d)
: base_class(c, d, _("Paragraph Layout"), false)
{}
void FormParagraph::build()

View File

@ -25,7 +25,7 @@ class FormParagraph
: public FormCB<ControlParagraph, FormDB<FD_paragraph> > {
public:
///
FormParagraph(ControlParagraph &);
FormParagraph(ControlParagraph &, Dialogs &);
private:
/// Build the dialog
virtual void build();
@ -33,7 +33,7 @@ private:
virtual void apply();
/// Update the dialog
virtual void update();
/// Filter the inputs on callback from xforms
virtual ButtonPolicy::SMInput input(FL_OBJECT *, long);
};

View File

@ -21,8 +21,8 @@
typedef FormCB<ControlPreamble, FormDB<FD_preamble> > base_class;
FormPreamble::FormPreamble(ControlPreamble & c)
: base_class(c, _("LaTeX preamble"))
FormPreamble::FormPreamble(ControlPreamble & c, Dialogs & d)
: base_class(c, d, _("LaTeX preamble"))
{}

View File

@ -24,7 +24,7 @@ struct FD_preamble;
class FormPreamble : public FormCB<ControlPreamble, FormDB<FD_preamble> > {
public:
///
FormPreamble(ControlPreamble &);
FormPreamble(ControlPreamble &, Dialogs &);
private:
/// Apply from dialog
virtual void apply();

View File

@ -427,7 +427,7 @@ void FormPreferences::Colors::apply()
setCursorColor(GUI_COLOR_CURSOR);
}
}
Dialogs::redrawGUI();
parent_.lv_->getDialogs()->redrawGUI();
}
// Now do the same for the LyX LColors...

View File

@ -32,8 +32,8 @@ using std::make_pair;
typedef FormCB<ControlPrint, FormDB<FD_print> > base_class;
FormPrint::FormPrint(ControlPrint & c)
: base_class(c, _("Print")),
FormPrint::FormPrint(ControlPrint & c, Dialogs & d)
: base_class(c, d, _("Print")),
target_(2), order_(2), which_(3)
{}

View File

@ -29,8 +29,7 @@ struct FD_print;
class FormPrint : public FormCB<ControlPrint, FormDB<FD_print> > {
public:
///
FormPrint(ControlPrint &);
FormPrint(ControlPrint &, Dialogs &);
private:
/// Apply from dialog
virtual void apply();

View File

@ -30,8 +30,8 @@ using std::vector;
typedef FormCB<ControlRef, FormDB<FD_ref> > base_class;
FormRef::FormRef(ControlRef & c)
: base_class(c, _("Reference")),
FormRef::FormRef(ControlRef & c, Dialogs & d)
: base_class(c, d, _("Reference")),
at_ref_(false)
{}

View File

@ -24,8 +24,7 @@ struct FD_ref;
class FormRef : public FormCB<ControlRef, FormDB<FD_ref> > {
public:
///
FormRef(ControlRef &);
FormRef(ControlRef &, Dialogs &);
private:
/// Set the Params variable for the Controller.
virtual void apply();

View File

@ -20,8 +20,8 @@
typedef FormCB<ControlSearch, FormDB<FD_search> > base_class;
FormSearch::FormSearch(ControlSearch & c)
: base_class(c, _("LyX: Find and Replace"))
FormSearch::FormSearch(ControlSearch & c, Dialogs & d)
: base_class(c, d, _("LyX: Find and Replace"))
{}
@ -43,7 +43,7 @@ void FormSearch::update()
fl_set_focus_object(dialog_->form, dialog_->input_search);
}
ButtonPolicy::SMInput FormSearch::input(FL_OBJECT * obj, long)
{
if (obj == dialog_->button_findnext ||

View File

@ -24,8 +24,7 @@ struct FD_search;
class FormSearch : public FormCB<ControlSearch, FormDB<FD_search> > {
public:
///
FormSearch(ControlSearch &);
FormSearch(ControlSearch &, Dialogs &);
private:
/// not needed.
virtual void apply() {}

View File

@ -26,8 +26,8 @@ using std::vector;
typedef FormCB<ControlSendto, FormDB<FD_sendto> > base_class;
FormSendto::FormSendto(ControlSendto & c)
: base_class(c, _("Send document to command"))
FormSendto::FormSendto(ControlSendto & c, Dialogs & d)
: base_class(c, d, _("Send document to command"))
{}

View File

@ -26,8 +26,7 @@ struct FD_sendto;
class FormSendto : public FormCB<ControlSendto, FormDB<FD_sendto> > {
public:
///
FormSendto(ControlSendto &);
FormSendto(ControlSendto &, Dialogs &);
private:
/// Apply from dialog (modify or create inset)
virtual void apply();

View File

@ -20,8 +20,8 @@
#include FORMS_H_LOCATION
FormShowFile::FormShowFile(ControlShowFile & c)
: FormCB<ControlShowFile, FormBrowser>(c, string())
FormShowFile::FormShowFile(ControlShowFile & c, Dialogs & d)
: FormCB<ControlShowFile, FormBrowser>(c, d, string())
{}

View File

@ -25,7 +25,7 @@ class ControlShowFile;
class FormShowFile : public FormCB<ControlShowFile, FormBrowser> {
public:
///
FormShowFile(ControlShowFile &);
FormShowFile(ControlShowFile &, Dialogs &);
// Functions accessible to the Controller.

View File

@ -21,8 +21,8 @@
typedef FormCB<ControlSpellchecker, FormDB<FD_spellchecker> > base_class;
FormSpellchecker::FormSpellchecker(ControlSpellchecker & c)
: base_class(c, _("LyX: Spellchecker"), false)
FormSpellchecker::FormSpellchecker(ControlSpellchecker & c, Dialogs & d)
: base_class(c, d, _("LyX: Spellchecker"), false)
{}

View File

@ -24,8 +24,7 @@ struct FD_spellchecker;
class FormSpellchecker : public FormCB<ControlSpellchecker, FormDB<FD_spellchecker> > {
public:
///
FormSpellchecker(ControlSpellchecker &);
FormSpellchecker(ControlSpellchecker &, Dialogs &);
private:
/// not needed.
void apply() {}

View File

@ -26,8 +26,8 @@ using std::make_pair;
typedef FormCB<ControlTabularCreate, FormDB<FD_tabular_create> > base_class;
FormTabularCreate::FormTabularCreate(ControlTabularCreate & c)
: base_class(c, _("Insert Tabular"))
FormTabularCreate::FormTabularCreate(ControlTabularCreate & c, Dialogs & d)
: base_class(c, d, _("Insert Tabular"))
{}

View File

@ -27,8 +27,7 @@ class FormTabularCreate :
public FormCB<ControlTabularCreate, FormDB<FD_tabular_create> > {
public:
///
FormTabularCreate(ControlTabularCreate &);
FormTabularCreate(ControlTabularCreate &, Dialogs &);
private:
/// Apply from dialog
virtual void apply();

View File

@ -26,8 +26,8 @@
typedef FormCB<ControlTexinfo, FormDB<FD_texinfo> > base_class;
FormTexinfo::FormTexinfo(ControlTexinfo & c)
: base_class(c, _("LaTeX Information")),
FormTexinfo::FormTexinfo(ControlTexinfo & c, Dialogs & d)
: base_class(c, d, _("LaTeX Information")),
activeStyle(ControlTexinfo::cls)
{}

View File

@ -22,8 +22,7 @@ struct FD_texinfo;
class FormTexinfo : public FormCB<ControlTexinfo, FormDB<FD_texinfo> > {
public:
///
FormTexinfo(ControlTexinfo &);
FormTexinfo(ControlTexinfo &, Dialogs &);
private:
/// not needed
virtual void apply() {}

View File

@ -33,8 +33,8 @@ using std::vector;
typedef FormCB<ControlThesaurus, FormDB<FD_thesaurus> > base_class;
FormThesaurus::FormThesaurus(ControlThesaurus & c)
: base_class(c, _("LyX: Thesaurus"), false),
FormThesaurus::FormThesaurus(ControlThesaurus & c, Dialogs & d)
: base_class(c, d, _("LyX: Thesaurus"), false),
clickline_(-1)
{
}

View File

@ -24,8 +24,7 @@ struct FD_thesaurus;
class FormThesaurus : public FormCB<ControlThesaurus, FormDB<FD_thesaurus> > {
public:
///
FormThesaurus(ControlThesaurus &);
FormThesaurus(ControlThesaurus &, Dialogs &);
private:
/// not needed.
virtual void apply() {}

View File

@ -29,8 +29,8 @@ using std::endl;
typedef FormCB<ControlToc, FormDB<FD_toc> > base_class;
FormToc::FormToc(ControlToc & c)
: base_class(c, _("Table of Contents"))
FormToc::FormToc(ControlToc & c, Dialogs & d)
: base_class(c, d, _("Table of Contents"))
{}

View File

@ -25,7 +25,7 @@ struct FD_toc;
class FormToc : public FormCB<ControlToc, FormDB<FD_toc> > {
public:
///
FormToc(ControlToc &);
FormToc(ControlToc &, Dialogs &);
private:
/// not needed
virtual void apply() {}

View File

@ -21,8 +21,8 @@
typedef FormCB<ControlUrl, FormDB<FD_url> > base_class;
FormUrl::FormUrl(ControlUrl & c)
: base_class(c, _("Url"))
FormUrl::FormUrl(ControlUrl & c, Dialogs & d)
: base_class(c, d, _("Url"))
{}

View File

@ -24,8 +24,7 @@ struct FD_url;
class FormUrl : public FormCB<ControlUrl, FormDB<FD_url> > {
public:
///
FormUrl(ControlUrl &);
FormUrl(ControlUrl &, Dialogs &);
private:
/// Apply from dialog (modify or create inset)
virtual void apply();

View File

@ -20,8 +20,8 @@
#include "gettext.h"
#include FORMS_H_LOCATION
FormVCLog::FormVCLog(ControlVCLog & c)
: FormCB<ControlVCLog, FormBrowser>(c, _("Version Control Log"))
FormVCLog::FormVCLog(ControlVCLog & c, Dialogs & d)
: FormCB<ControlVCLog, FormBrowser>(c, d, _("Version Control Log"))
{}

View File

@ -25,7 +25,7 @@ class ControlVCLog;
class FormVCLog : public FormCB<ControlVCLog, FormBrowser> {
public:
///
FormVCLog(ControlVCLog &);
FormVCLog(ControlVCLog &, Dialogs &);
// Functions accessible to the Controller.

View File

@ -86,11 +86,11 @@ Toolbar::Pimpl::toolbarItem::operator=(toolbarItem const & ti)
Toolbar::Pimpl::Pimpl(LyXView * o, int x, int y)
Toolbar::Pimpl::Pimpl(LyXView * o, Dialogs & d, int x, int y)
: owner(static_cast<XFormsView *>(o)), sxpos(x), sypos(y)
{
combox = 0;
tooltip_ = new Tooltips;
tooltip_ = new Tooltips(d);
}

View File

@ -26,6 +26,7 @@
class XFormsView;
class Tooltips;
class Dialogs;
/** The LyX xforms toolbar class
*/
@ -34,7 +35,7 @@ public:
/// called when user selects a layout from combox
static void layoutSelectedCB(int, void *, Combox *);
///
Pimpl(LyXView * o, int x, int y);
Pimpl(LyXView * o, Dialogs &, int x, int y);
///
~Pimpl();

View File

@ -35,12 +35,12 @@ boost::signal0<void> Tooltips::toggled;
#if FL_VERSION > 0 || FL_REVISION >= 89
Tooltips::Tooltips()
Tooltips::Tooltips(Dialogs & d)
{
static bool first = true;
if (first) {
first = false;
Dialogs::toggleTooltips.connect(boost::bind(&Tooltips::toggleEnabled));
d.toggleTooltips.connect(boost::bind(&Tooltips::toggleEnabled));
}
toggled.connect(boost::bind(&Tooltips::set, this));
}

View File

@ -26,6 +26,8 @@
#include <map>
class Dialogs;
#ifdef __GNUG__
#pragma interface
@ -33,7 +35,7 @@
class Tooltips : boost::noncopyable, public boost::signals::trackable {
public:
Tooltips();
Tooltips(Dialogs &);
/// Initialise a tooltip for this ob.
void init(FL_OBJECT * ob, string const & tip);

View File

@ -59,7 +59,7 @@ int C_XFormsView_atCloseMainFormCB(FL_FORM * form, void * p)
XFormsView::XFormsView(int width, int height)
: LyXView()
{
create_form_form_main(width, height);
create_form_form_main(*getDialogs(), width, height);
fl_set_form_atclose(getForm(), C_XFormsView_atCloseMainFormCB, 0);
// Connect the minibuffer signals
@ -68,7 +68,7 @@ XFormsView::XFormsView(int width, int height)
// Make sure the buttons are disabled if needed.
updateToolbar();
Dialogs::redrawGUI.connect(boost::bind(&XFormsView::redraw, this));
getDialogs()->redrawGUI.connect(boost::bind(&XFormsView::redraw, this));
}
@ -123,7 +123,7 @@ void XFormsView::show(int x, int y, string const & title)
}
void XFormsView::create_form_form_main(int width, int height)
void XFormsView::create_form_form_main(Dialogs & dia, int width, int height)
/* to make this work as it should, .lyxrc should have been
* read first; OR maybe this one should be made dynamic.
* Hmmmm. Lgb.
@ -144,7 +144,8 @@ void XFormsView::create_form_form_main(int width, int height)
menubar_.reset(new Menubar(this, menubackend));
toolbar_.reset(new Toolbar(this, air, 30 + air + bw, toolbardefaults));
toolbar_.reset(new Toolbar(this, dia,
air, 30 + air + bw, toolbardefaults));
toolbar_->set(true);
int const ywork = 60 + 2 * air + bw;

View File

@ -20,6 +20,8 @@
#include "frontends/LyXView.h"
class Dialogs;
/**
* XFormsView - xforms implementation of LyXView
*
@ -32,14 +34,14 @@ public:
~XFormsView();
/**
* show - display the top-level window
* @param xpos requested x position (or 0)
* @param xpos requested y position (or 0)
* @param title window title
*/
/**
* show - display the top-level window
* @param xpos requested x position (or 0)
* @param xpos requested y position (or 0)
* @param title window title
*/
void show(int xpos, int ypos, string const & t = string("LyX"));
/// get the xforms main form
FL_FORM * getForm() const;
/// redraw the main form.
@ -58,10 +60,10 @@ private:
* @param t main window title
* @param it iconified (short) title
*/
virtual void setWindowTitle(string const & t, string const & it);
virtual void setWindowTitle(string const & t, string const & it);
/// makes the main form.
void create_form_form_main(int width, int height);
void create_form_form_main(Dialogs & d, int width, int height);
/// the main form.
boost::scoped_ptr<FL_FORM> form_;
};

View File

@ -8,16 +8,16 @@
*/
#include <config.h>
#include "lyx_gui.h"
#include "support/lyxlib.h"
#include "support/os.h"
#include "support/filetools.h"
#include "debug.h"
#include "gettext.h"
#include "lyx_main.h"
#include "lyxrc.h"
@ -27,7 +27,7 @@
#include "lyxserver.h"
#include "BufferView.h"
#include "XFormsView.h"
#include FORMS_H_LOCATION
#include "ColorHandler.h"
#include "xforms_helpers.h"
@ -37,11 +37,11 @@
#include "graphics/GraphicsImageXPM.h"
#endif
#include <fcntl.h>
#include <boost/bind.hpp>
#ifndef CXX_GLOBAL_CSTD
using std::exit;
#endif
@ -49,15 +49,15 @@ using std::exit;
using std::vector;
using std::hex;
using std::endl;
extern bool finished;
extern BufferList bufferlist;
// FIXME: wrong place !
LyXServer * lyxserver;
namespace {
/// set default GUI configuration
void setDefaults()
{
@ -80,7 +80,7 @@ void setDefaults()
| FL_PDBorderWidth, &cntl);
}
extern "C" {
int LyX_XErrHandler(Display * display, XErrorEvent * xeev) {
@ -103,19 +103,19 @@ int LyX_XErrHandler(Display * display, XErrorEvent * xeev) {
lyx::abort();
return 0;
}
}
/// read in geometry specification
char geometry[40];
} // namespace anon
void lyx_gui::parse_init(int & argc, char * argv[])
{
setDefaults();
FL_CMD_OPT cmdopt[] = {
{"-geometry", "*.geometry", XrmoptionSepArg, "690x510"}
};
@ -125,36 +125,36 @@ void lyx_gui::parse_init(int & argc, char * argv[])
};
const int num_res = sizeof(res)/sizeof(FL_resource);
fl_initialize(&argc, argv, "LyX", cmdopt, num_res);
// It appears that, in xforms >=0.89.5, fl_initialize()
// calls setlocale() and ruins our LC_NUMERIC setting.
locale_init();
fl_get_app_resources(res, num_res);
Display * display = fl_get_display();
if (!display) {
lyxerr << "LyX: unable to access X display, exiting" << endl;
os::warn("Unable to access X display, exiting");
::exit(1);
}
fcntl(ConnectionNumber(display), F_SETFD, FD_CLOEXEC);
XSetErrorHandler(LyX_XErrHandler);
lyxColorHandler.reset(new LyXColorHandler());
}
void lyx_gui::parse_lyxrc()
{
// FIXME !!!!
// FIXME !!!!
lyxrc.dpi = 95;
XformsColor::read(AddName(user_lyxdir, "preferences.xform"));
if (lyxrc.popup_font_encoding.empty())
@ -207,7 +207,7 @@ void lyx_gui::parse_lyxrc()
#endif
}
void lyx_gui::start(string const & batch, vector<string> files)
{
// initial geometry
@ -215,7 +215,7 @@ void lyx_gui::start(string const & batch, vector<string> files)
int ypos = -1;
unsigned int width = 690;
unsigned int height = 510;
static const int geometryBitmask =
XParseGeometry(geometry,
&xpos, &ypos, &width, &height);
@ -235,7 +235,7 @@ void lyx_gui::start(string const & batch, vector<string> files)
}
Screen * s = ScreenOfDisplay(fl_get_display(), fl_screen);
// recalculate xpos if it's not set
if (xpos == -1)
xpos = (WidthOfScreen(s) - width) / 2;
@ -246,17 +246,17 @@ void lyx_gui::start(string const & batch, vector<string> files)
lyxerr[Debug::GUI] << "Creating view: " << width << "x" << height
<< "+" << xpos << "+" << ypos << endl;
XFormsView view(width, height);
view.show(xpos, ypos, "LyX");
view.init();
Buffer * last = 0;
// FIXME: some code below needs moving
lyxserver = new LyXServer(view.getLyXFunc(), lyxrc.lyxpipes);
vector<string>::const_iterator cit = files.begin();
vector<string>::const_iterator end = files.end();
for (; cit != end; ++cit) {
@ -276,7 +276,7 @@ void lyx_gui::start(string const & batch, vector<string> files)
view.getLyXFunc()->verboseDispatch(batch, false);
}
// enter the event loop
// enter the event loop
while (!finished) {
if (fl_check_forms() == FL_EVENT) {
XEvent ev;
@ -287,11 +287,11 @@ void lyx_gui::start(string const & batch, vector<string> files)
}
}
// FIXME
// FIXME
delete lyxserver;
}
// Called by the graphics cache to connect the appropriate frontend
// image loading routines to the LyX kernel.
void lyx_gui::init_graphics()