+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:
// 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()
{
/** 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();
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();
class LyXView;
class ToolbarDefaults;
+class Dialogs;
/** The LyX GUI independent toolbar class
The GUI interface is implemented in the corresponding Toolbar_pimpl class.
class Toolbar {
public:
///
- Toolbar(LyXView * o, int x, int y, ToolbarDefaults const &);
+ Toolbar(LyXView * o, Dialogs & d,
+ int x, int y, ToolbarDefaults const &);
///
~Toolbar();
/// 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);
void ControlConnectBase::connect()
{
- r_ = Dialogs::redrawGUI.
+ r_ = d_.redrawGUI.
connect(boost::bind(&ControlConnectBase::redraw, this));
}
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_; }
///
+// -*- C++ -*-
/**
* \file lyx_gui.h
* Copyright 2002 the LyX Team
#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();
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);
FileDialog::~FileDialog()
{
delete private_;
- private_ = 0;
}
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)
{}
class FormAboutlyx : public FormCB<ControlAboutlyx, FormDB<FD_aboutlyx> > {
public:
///
- FormAboutlyx(ControlAboutlyx &);
+ FormAboutlyx(ControlAboutlyx &, Dialogs &);
private:
/// not needed.
} // 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))
{}
class xformsBC;
class Tooltips;
+class Dialogs;
/** This class is an XForms GUI base class.
*/
{
public:
///
- FormBase(ControlButtons &, string const &, bool allowResize);
+ FormBase(ControlButtons &, Dialogs &,
+ string const &, bool allowResize);
///
virtual ~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.
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)
{}
{
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)
{}
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);
}
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));
}
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"))
{}
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();
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"))
{}
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);
-
+
}
}
} 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();
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();
#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)
{}
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();
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)
{}
: public FormCB<ControlCharacter, FormDB<FD_character> > {
public:
///
- FormCharacter(ControlCharacter &);
+ FormCharacter(ControlCharacter &, Dialogs &);
private:
/// Apply from dialog
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.
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)
{}
class FormCitation : public FormCB<ControlCitation, FormDB<FD_citation> > {
public:
///
- FormCitation(ControlCitation &);
-
+ FormCitation(ControlCitation &, Dialogs &);
private:
///
enum State {
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"))
{}
: public FormCB<ControlERT, FormDB<FD_ert> > {
public:
///
- FormERT(ControlERT &);
+ FormERT(ControlERT &, Dialogs &);
private:
/// Set the Params variable for the Controller.
virtual void apply();
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"))
{}
class FormError : public FormCB<ControlError, FormDB<FD_error> > {
public:
/// Constructor
- FormError(ControlError &);
-
+ FormError(ControlError &, Dialogs &);
private:
/// not needed.
virtual void apply() {}
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"))
{}
class FormExternal : public FormCB<ControlExternal, FormDB<FD_external> > {
public:
///
- FormExternal(ControlExternal &);
-
+ FormExternal(ControlExternal &, Dialogs &);
private:
/// apply changes
void apply();
}
-FileDialog::Private::Private()
+FileDialog::Private::Private(Dialogs & dia)
{
pszDirectory = MakeAbsPath(string("."));
pszMask = '*';
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));
}
#include <vector>
+class Dialogs;
+
/// DirEntry internal structure definition
class DirEntry {
public:
class FileDialog::Private : public boost::signals::trackable {
public:
///
- Private();
+ Private(Dialogs &);
///
~Private();
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"))
{}
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();
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"))
{}
class FormForks : public FormCB<ControlForks, FormDB<FD_forks> > {
public:
///
- FormForks(ControlForks &);
+ FormForks(ControlForks &, Dialogs &);
/// preemptive handler for feedback messages
void feedbackCB(FL_OBJECT *, int);
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)
{}
// Store the identifiers for later
origins_ = getSecond(origindata);
-
+
string const choice =
" " + getStringFromVector(getFirst(origindata), " | ") +" ";
fl_addto_choice(file_->choice_origin, choice.c_str());
}
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,
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,
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"))
{}
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();
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"))
{}
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();
#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"))
{}
class FormLog : public FormCB<ControlLog, FormBrowser> {
public:
///
- FormLog(ControlLog &);
+ FormLog(ControlLog &, Dialogs &);
// Functions accessible to the Controller.
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"))
{}
: public FormCB<ControlMinipage, FormDB<FD_minipage> > {
public:
///
- FormMinipage(ControlMinipage &);
+ FormMinipage(ControlMinipage &, Dialogs &);
private:
/// Set the Params variable for the Controller.
virtual void apply();
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()
: public FormCB<ControlParagraph, FormDB<FD_paragraph> > {
public:
///
- FormParagraph(ControlParagraph &);
+ FormParagraph(ControlParagraph &, Dialogs &);
private:
/// Build the dialog
virtual void build();
virtual void apply();
/// Update the dialog
virtual void update();
-
+
/// Filter the inputs on callback from xforms
virtual ButtonPolicy::SMInput input(FL_OBJECT *, long);
};
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"))
{}
class FormPreamble : public FormCB<ControlPreamble, FormDB<FD_preamble> > {
public:
///
- FormPreamble(ControlPreamble &);
+ FormPreamble(ControlPreamble &, Dialogs &);
private:
/// Apply from dialog
virtual void apply();
setCursorColor(GUI_COLOR_CURSOR);
}
}
- Dialogs::redrawGUI();
+ parent_.lv_->getDialogs()->redrawGUI();
}
// Now do the same for the LyX LColors...
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)
{}
class FormPrint : public FormCB<ControlPrint, FormDB<FD_print> > {
public:
///
- FormPrint(ControlPrint &);
-
+ FormPrint(ControlPrint &, Dialogs &);
private:
/// Apply from dialog
virtual void apply();
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)
{}
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();
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"))
{}
fl_set_focus_object(dialog_->form, dialog_->input_search);
}
-
+
ButtonPolicy::SMInput FormSearch::input(FL_OBJECT * obj, long)
{
if (obj == dialog_->button_findnext ||
class FormSearch : public FormCB<ControlSearch, FormDB<FD_search> > {
public:
///
- FormSearch(ControlSearch &);
-
+ FormSearch(ControlSearch &, Dialogs &);
private:
/// not needed.
virtual void apply() {}
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"))
{}
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();
#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())
{}
class FormShowFile : public FormCB<ControlShowFile, FormBrowser> {
public:
///
- FormShowFile(ControlShowFile &);
+ FormShowFile(ControlShowFile &, Dialogs &);
// Functions accessible to the Controller.
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)
{}
class FormSpellchecker : public FormCB<ControlSpellchecker, FormDB<FD_spellchecker> > {
public:
///
- FormSpellchecker(ControlSpellchecker &);
-
+ FormSpellchecker(ControlSpellchecker &, Dialogs &);
private:
/// not needed.
void apply() {}
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"))
{}
public FormCB<ControlTabularCreate, FormDB<FD_tabular_create> > {
public:
///
- FormTabularCreate(ControlTabularCreate &);
-
+ FormTabularCreate(ControlTabularCreate &, Dialogs &);
private:
/// Apply from dialog
virtual void apply();
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)
{}
class FormTexinfo : public FormCB<ControlTexinfo, FormDB<FD_texinfo> > {
public:
///
- FormTexinfo(ControlTexinfo &);
-
+ FormTexinfo(ControlTexinfo &, Dialogs &);
private:
/// not needed
virtual void apply() {}
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)
{
}
class FormThesaurus : public FormCB<ControlThesaurus, FormDB<FD_thesaurus> > {
public:
///
- FormThesaurus(ControlThesaurus &);
-
+ FormThesaurus(ControlThesaurus &, Dialogs &);
private:
/// not needed.
virtual void apply() {}
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"))
{}
class FormToc : public FormCB<ControlToc, FormDB<FD_toc> > {
public:
///
- FormToc(ControlToc &);
+ FormToc(ControlToc &, Dialogs &);
private:
/// not needed
virtual void apply() {}
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"))
{}
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();
#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"))
{}
class FormVCLog : public FormCB<ControlVCLog, FormBrowser> {
public:
///
- FormVCLog(ControlVCLog &);
+ FormVCLog(ControlVCLog &, Dialogs &);
// Functions accessible to the Controller.
-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);
}
class XFormsView;
class Tooltips;
+class Dialogs;
/** The LyX xforms toolbar class
*/
/// 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();
#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));
}
#include <map>
+class Dialogs;
+
#ifdef __GNUG__
#pragma interface
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);
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
// 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));
}
}
-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.
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;
#include "frontends/LyXView.h"
+class Dialogs;
+
/**
* XFormsView - xforms implementation of LyXView
*
~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.
* @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_;
};
*/
#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"
#include "lyxserver.h"
#include "BufferView.h"
#include "XFormsView.h"
-
+
#include FORMS_H_LOCATION
#include "ColorHandler.h"
#include "xforms_helpers.h"
#include "graphics/GraphicsImageXPM.h"
#endif
-
+
#include <fcntl.h>
#include <boost/bind.hpp>
-
+
#ifndef CXX_GLOBAL_CSTD
using std::exit;
#endif
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()
{
| FL_PDBorderWidth, &cntl);
}
-
+
extern "C" {
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"}
};
};
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())
#endif
}
-
+
void lyx_gui::start(string const & batch, vector<string> files)
{
// initial geometry
int ypos = -1;
unsigned int width = 690;
unsigned int height = 510;
-
+
static const int geometryBitmask =
XParseGeometry(geometry,
&xpos, &ypos, &width, &height);
}
Screen * s = ScreenOfDisplay(fl_get_display(), fl_screen);
-
+
// recalculate xpos if it's not set
if (xpos == -1)
xpos = (WidthOfScreen(s) - width) / 2;
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) {
view.getLyXFunc()->verboseDispatch(batch, false);
}
- // enter the event loop
+ // enter the event loop
while (!finished) {
if (fl_check_forms() == FL_EVENT) {
XEvent ev;
}
}
- // 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()