mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-10 18:58:10 +00:00
Michael's latest gnome changes.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3386 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
54a38db2b2
commit
3f0903efb0
@ -7,6 +7,36 @@
|
|||||||
frontend, so I've removed the LyXGnomified and menubar code. The
|
frontend, so I've removed the LyXGnomified and menubar code. The
|
||||||
menubar wasn't working properly anyway.
|
menubar wasn't working properly anyway.
|
||||||
|
|
||||||
|
2002-01-12 Michael A. Koziarski <michael@koziarski.com>
|
||||||
|
|
||||||
|
* various: Cleaned out the old stuff, standardised the new
|
||||||
|
stuff.
|
||||||
|
* GnomeBase.C
|
||||||
|
* GnomeBase.h: Changed the constructor to take one argument. The
|
||||||
|
dialog name. The path and name of the glade files can be
|
||||||
|
calculated from there. These two now provide default validate() &
|
||||||
|
*Clicked functions.
|
||||||
|
* FormUrl.C
|
||||||
|
* FormUrl.h
|
||||||
|
* FormError.C
|
||||||
|
* FormError.h
|
||||||
|
* FormTabularCreate.C
|
||||||
|
* FormTabularCreate.h: updated them to use the new system.
|
||||||
|
Removed Local inline *Clicked functions as they're now in the base
|
||||||
|
class.
|
||||||
|
* README: new, brief outline of what I'm doing here.
|
||||||
|
* accessors.py: Described in README, generates the accessor
|
||||||
|
functions from the glade file.
|
||||||
|
|
||||||
|
2002-01-12 Michael A. Koziarski <michael@koziarski.com>
|
||||||
|
|
||||||
|
* Menubar_pimpl.C
|
||||||
|
* Menubar_pimpl.h
|
||||||
|
* mainapp.h
|
||||||
|
* mainapp.C: Removed, We should behave similarly to the qt2
|
||||||
|
frontend, so I've removed the LyXGnomified and menubar code. The
|
||||||
|
menubar wasn't working properly anyway.
|
||||||
|
|
||||||
2002-01-08 Martin Vermeer <martin.vermeer@hut.fi>
|
2002-01-08 Martin Vermeer <martin.vermeer@hut.fi>
|
||||||
|
|
||||||
* Menubar_pimpl.C (composeUIInfo):
|
* Menubar_pimpl.C (composeUIInfo):
|
||||||
|
@ -22,17 +22,17 @@
|
|||||||
#include <gtk--/text.h>
|
#include <gtk--/text.h>
|
||||||
|
|
||||||
FormError::FormError(ControlError & c)
|
FormError::FormError(ControlError & c)
|
||||||
: FormCB<ControlError>(c, "diaerror.glade", "DiaError")
|
: FormCB<ControlError>(c, "FormError")
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
void FormError::build()
|
void FormError::build()
|
||||||
{
|
{
|
||||||
// Connect the buttons.
|
// Connect the buttons.
|
||||||
close_btn()->clicked.connect(SigC::slot(this, &FormError::CloseClicked));
|
button_close()->clicked.connect(SigC::slot(this, &FormError::CloseClicked));
|
||||||
|
|
||||||
// Manage the buttons state
|
// Manage the buttons state
|
||||||
bc().setCancel(close_btn());
|
bc().setCancel(button_close());
|
||||||
|
|
||||||
// Make sure everything is in the correct state.
|
// Make sure everything is in the correct state.
|
||||||
bc().refresh();
|
bc().refresh();
|
||||||
@ -44,14 +44,12 @@ void FormError::update()
|
|||||||
textarea()->insert(controller().params());
|
textarea()->insert(controller().params());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Gtk::Button * FormError::button_close() const
|
||||||
Gtk::Button * FormError::close_btn() const
|
|
||||||
{
|
{
|
||||||
return getWidget<Gtk::Button>("button_close");
|
return getWidget<Gtk::Button>("r_button_close");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Gtk::Text * FormError::textarea() const
|
||||||
Gtk::Text * FormError::textarea() const
|
|
||||||
{
|
{
|
||||||
return getWidget<Gtk::Text>("textarea");
|
return getWidget<Gtk::Text>("r_textarea");
|
||||||
}
|
}
|
||||||
|
@ -49,9 +49,12 @@ private:
|
|||||||
|
|
||||||
void CloseClicked() { CancelButton(); }
|
void CloseClicked() { CancelButton(); }
|
||||||
|
|
||||||
/// The close button
|
|
||||||
Gtk::Button * close_btn() const;
|
/// generated by accessors.py
|
||||||
|
Gtk::Button * button_close() const;
|
||||||
|
/// generated by accessors.py
|
||||||
Gtk::Text * textarea() const;
|
Gtk::Text * textarea() const;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -23,8 +23,7 @@
|
|||||||
#include <gtk--/button.h>
|
#include <gtk--/button.h>
|
||||||
|
|
||||||
FormTabularCreate::FormTabularCreate(ControlTabularCreate & c)
|
FormTabularCreate::FormTabularCreate(ControlTabularCreate & c)
|
||||||
: FormCB<ControlTabularCreate>(c, "diainserttabular.glade",
|
: FormCB<ControlTabularCreate>(c, "FormTabularCreate")
|
||||||
"DiaInsertTabular")
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -59,50 +58,42 @@ void FormTabularCreate::build()
|
|||||||
|
|
||||||
void FormTabularCreate::apply()
|
void FormTabularCreate::apply()
|
||||||
{
|
{
|
||||||
unsigned int ysize = (unsigned int)(rows_spin()->get_value_as_int());
|
unsigned int ysize = (unsigned int)(rows()->get_value_as_int());
|
||||||
unsigned int xsize = (unsigned int)(columns_spin()->get_value_as_int());
|
unsigned int xsize = (unsigned int)(cols()->get_value_as_int());
|
||||||
|
|
||||||
controller().params() = std::make_pair(xsize, ysize);
|
controller().params() = std::make_pair(xsize, ysize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void FormTabularCreate::update()
|
void FormTabularCreate::update()
|
||||||
{
|
{}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool FormTabularCreate::validate() const
|
bool FormTabularCreate::validate() const
|
||||||
{
|
{
|
||||||
// Always valid! (not really so, needs fixing).
|
return ( rows()->get_value_as_int() > 0 ) &&
|
||||||
return true;
|
( cols()->get_value_as_int() > 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Gtk::SpinButton * FormTabularCreate::rows_spin() const
|
Gtk::Button * FormTabularCreate::ok_btn() const
|
||||||
{
|
{
|
||||||
return getWidget<Gtk::SpinButton>("tabular_spin_rows");
|
return getWidget<Gtk::Button>("r_ok_btn");
|
||||||
}
|
}
|
||||||
|
Gtk::Button * FormTabularCreate::apply_btn() const
|
||||||
|
|
||||||
Gtk::SpinButton * FormTabularCreate::columns_spin() const
|
|
||||||
{
|
{
|
||||||
return getWidget<Gtk::SpinButton>("tabular_spin_columns");
|
return getWidget<Gtk::Button>("r_apply_btn");
|
||||||
}
|
}
|
||||||
|
Gtk::Button * FormTabularCreate::cancel_btn() const
|
||||||
|
|
||||||
Gtk::Button * FormTabularCreate::ok_btn() const
|
|
||||||
{
|
{
|
||||||
return getWidget<Gtk::Button>("button_ok");
|
return getWidget<Gtk::Button>("r_cancel_btn");
|
||||||
}
|
}
|
||||||
|
Gtk::SpinButton * FormTabularCreate::rows() const
|
||||||
|
|
||||||
Gtk::Button * FormTabularCreate::cancel_btn() const
|
|
||||||
{
|
{
|
||||||
return getWidget<Gtk::Button>("button_cancel");
|
return getWidget<Gtk::SpinButton>("r_rows");
|
||||||
}
|
}
|
||||||
|
Gtk::SpinButton * FormTabularCreate::cols() const
|
||||||
|
|
||||||
Gtk::Button * FormTabularCreate::apply_btn() const
|
|
||||||
{
|
{
|
||||||
return getWidget<Gtk::Button>("button_apply");
|
return getWidget<Gtk::SpinButton>("r_cols");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,15 +49,17 @@ private:
|
|||||||
void CancelClicked() { CancelButton(); }
|
void CancelClicked() { CancelButton(); }
|
||||||
void ApplyClicked() { ApplyButton(); }
|
void ApplyClicked() { ApplyButton(); }
|
||||||
|
|
||||||
/// The SpinButtons
|
/// generated by accessors.py
|
||||||
Gtk::SpinButton * rows_spin() const;
|
|
||||||
Gtk::SpinButton * columns_spin() const;
|
|
||||||
/// The ok button
|
|
||||||
Gtk::Button * ok_btn() const;
|
Gtk::Button * ok_btn() const;
|
||||||
/// The cancel button
|
/// generated by accessors.py
|
||||||
Gtk::Button * cancel_btn() const;
|
|
||||||
/// The apply button
|
|
||||||
Gtk::Button * apply_btn() const;
|
Gtk::Button * apply_btn() const;
|
||||||
|
/// generated by accessors.py
|
||||||
|
Gtk::Button * cancel_btn() const;
|
||||||
|
/// generated by accessors.py
|
||||||
|
Gtk::SpinButton * rows() const;
|
||||||
|
/// generated by accessors.py
|
||||||
|
Gtk::SpinButton * cols() const;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
#include <gtk--/checkbutton.h>
|
#include <gtk--/checkbutton.h>
|
||||||
|
|
||||||
FormUrl::FormUrl(ControlUrl & c)
|
FormUrl::FormUrl(ControlUrl & c)
|
||||||
: FormCB<ControlUrl>(c, "diainserturl.glade", "DiaInsertUrl")
|
: FormCB<ControlUrl>(c, "FormUrl")
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -53,7 +53,7 @@ void FormUrl::build()
|
|||||||
bc().refresh();
|
bc().refresh();
|
||||||
|
|
||||||
// Manage the read-only aware widgets.
|
// Manage the read-only aware widgets.
|
||||||
bc().addReadOnly(html());
|
bc().addReadOnly(html_cb());
|
||||||
bc().addReadOnly(name());
|
bc().addReadOnly(name());
|
||||||
bc().addReadOnly(url());
|
bc().addReadOnly(url());
|
||||||
}
|
}
|
||||||
@ -64,7 +64,7 @@ void FormUrl::connect_signals()
|
|||||||
// Get notifications on input change
|
// Get notifications on input change
|
||||||
slot_url_ = url()->changed.connect(SigC::slot(this, &FormUrl::InputChanged));
|
slot_url_ = url()->changed.connect(SigC::slot(this, &FormUrl::InputChanged));
|
||||||
slot_name_ = name()->changed.connect(SigC::slot(this, &FormUrl::InputChanged));
|
slot_name_ = name()->changed.connect(SigC::slot(this, &FormUrl::InputChanged));
|
||||||
slot_html_ = html()->toggled.connect(SigC::slot(this, &FormUrl::InputChanged));
|
slot_html_ = html_cb()->toggled.connect(SigC::slot(this, &FormUrl::InputChanged));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -78,14 +78,16 @@ void FormUrl::disconnect_signals()
|
|||||||
|
|
||||||
void FormUrl::apply()
|
void FormUrl::apply()
|
||||||
{
|
{
|
||||||
|
disconnect_signals();
|
||||||
controller().params().setContents(url()->get_text());
|
controller().params().setContents(url()->get_text());
|
||||||
controller().params().setOptions(name()->get_text());
|
controller().params().setOptions(name()->get_text());
|
||||||
|
|
||||||
string cmdname("url");
|
string cmdname("url");
|
||||||
if (html()->get_active())
|
if (html_cb()->get_active())
|
||||||
cmdname = "htmlurl";
|
cmdname = "htmlurl";
|
||||||
|
|
||||||
controller().params().setCmdName(cmdname);
|
controller().params().setCmdName(cmdname);
|
||||||
|
connect_signals();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -99,7 +101,7 @@ void FormUrl::update()
|
|||||||
url()->set_text(controller().params().getContents());
|
url()->set_text(controller().params().getContents());
|
||||||
name()->set_text(controller().params().getOptions());
|
name()->set_text(controller().params().getOptions());
|
||||||
|
|
||||||
html()->set_active("url" != controller().params().getCmdName());
|
html_cb()->set_active("url" != controller().params().getCmdName());
|
||||||
|
|
||||||
// Reconnect the signals.
|
// Reconnect the signals.
|
||||||
connect_signals();
|
connect_signals();
|
||||||
@ -108,46 +110,36 @@ void FormUrl::update()
|
|||||||
|
|
||||||
bool FormUrl::validate() const
|
bool FormUrl::validate() const
|
||||||
{
|
{
|
||||||
// Always valid! (not really so, needs fixing).
|
return !url()->get_text().empty() && !name()->get_text().empty();
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Gtk::Button * FormUrl::restore_btn() const
|
||||||
Gtk::Entry * FormUrl::url() const
|
|
||||||
{
|
{
|
||||||
return getWidget<Gtk::Entry>("url");
|
return getWidget<Gtk::Button>("r_restore_btn");
|
||||||
}
|
}
|
||||||
|
Gtk::Button * FormUrl::ok_btn() const
|
||||||
Gtk::Entry * FormUrl::name() const
|
|
||||||
{
|
{
|
||||||
return getWidget<Gtk::Entry>("name");
|
return getWidget<Gtk::Button>("r_ok_btn");
|
||||||
}
|
}
|
||||||
|
Gtk::Button * FormUrl::apply_btn() const
|
||||||
Gtk::CheckButton * FormUrl::html() const
|
|
||||||
{
|
{
|
||||||
return getWidget<Gtk::CheckButton>("html_type");
|
return getWidget<Gtk::Button>("r_apply_btn");
|
||||||
}
|
}
|
||||||
|
Gtk::Button * FormUrl::cancel_btn() const
|
||||||
|
|
||||||
Gtk::Button * FormUrl::ok_btn() const
|
|
||||||
{
|
{
|
||||||
return getWidget<Gtk::Button>("button_ok");
|
return getWidget<Gtk::Button>("r_cancel_btn");
|
||||||
}
|
}
|
||||||
|
Gtk::Entry * FormUrl::url() const
|
||||||
|
|
||||||
Gtk::Button * FormUrl::cancel_btn() const
|
|
||||||
{
|
{
|
||||||
return getWidget<Gtk::Button>("button_cancel");
|
return getWidget<Gtk::Entry>("r_url");
|
||||||
}
|
}
|
||||||
|
Gtk::Entry * FormUrl::name() const
|
||||||
|
|
||||||
Gtk::Button * FormUrl::apply_btn() const
|
|
||||||
{
|
{
|
||||||
return getWidget<Gtk::Button>("button_apply");
|
return getWidget<Gtk::Entry>("r_name");
|
||||||
}
|
}
|
||||||
|
Gtk::CheckButton * FormUrl::html_cb() const
|
||||||
|
|
||||||
Gtk::Button * FormUrl::restore_btn() const
|
|
||||||
{
|
{
|
||||||
return getWidget<Gtk::Button>("button_restore");
|
return getWidget<Gtk::CheckButton>("r_html_cb");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -52,27 +52,21 @@ private:
|
|||||||
/// Disconnect the signals.
|
/// Disconnect the signals.
|
||||||
void disconnect_signals();
|
void disconnect_signals();
|
||||||
|
|
||||||
void OKClicked() { OKButton(); }
|
/// generated by accessors.py
|
||||||
void CancelClicked() { CancelButton(); }
|
|
||||||
void ApplyClicked() { ApplyButton(); }
|
|
||||||
void RestoreClicked() { RestoreButton(); }
|
|
||||||
void InputChanged() { bc().valid(validate()); }
|
|
||||||
|
|
||||||
/// The url entry
|
|
||||||
Gtk::Entry * url() const;
|
|
||||||
/// The name entry
|
|
||||||
Gtk::Entry * name() const;
|
|
||||||
/// The html type checkbutton
|
|
||||||
Gtk::CheckButton * html() const;
|
|
||||||
/// The ok button
|
|
||||||
Gtk::Button * ok_btn() const;
|
|
||||||
/// The cancel button
|
|
||||||
Gtk::Button * cancel_btn() const;
|
|
||||||
/// The apply button
|
|
||||||
Gtk::Button * apply_btn() const;
|
|
||||||
/// The restore button
|
|
||||||
Gtk::Button * restore_btn() const;
|
Gtk::Button * restore_btn() const;
|
||||||
|
/// gene rated by accessors.py
|
||||||
|
Gtk::Button * ok_btn() const;
|
||||||
|
/// generated by accessors.py
|
||||||
|
Gtk::Button * apply_btn() const;
|
||||||
|
/// generated by accessors.py
|
||||||
|
Gtk::Button * cancel_btn() const;
|
||||||
|
/// generated by accessors.py
|
||||||
|
Gtk::Entry * url() const;
|
||||||
|
/// generated by accessors.py
|
||||||
|
Gtk::Entry * name() const;
|
||||||
|
/// generated by accessors.py
|
||||||
|
Gtk::CheckButton * html_cb() const;
|
||||||
|
|
||||||
/// Keeps the connection to the input validator.
|
/// Keeps the connection to the input validator.
|
||||||
SigC::Connection slot_url_;
|
SigC::Connection slot_url_;
|
||||||
SigC::Connection slot_name_;
|
SigC::Connection slot_name_;
|
||||||
|
@ -21,9 +21,9 @@
|
|||||||
#include <gnome--/dialog.h>
|
#include <gnome--/dialog.h>
|
||||||
|
|
||||||
GnomeBase::GnomeBase(ControlButtons & c,
|
GnomeBase::GnomeBase(ControlButtons & c,
|
||||||
string const & glade_file, string const & name)
|
string const & name)
|
||||||
: ViewBC<gnomeBC>(c)
|
: ViewBC<gnomeBC>(c)
|
||||||
, file_(glade_file), widget_name_(name), xml_(0)
|
, file_(name + ".glade"), widget_name_(name), xml_(0)
|
||||||
, dialog_(0)
|
, dialog_(0)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
@ -71,6 +71,35 @@ void GnomeBase::hide()
|
|||||||
dialog_->hide();
|
dialog_->hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool GnomeBase::validate()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void GnomeBase::OKClicked()
|
||||||
|
{
|
||||||
|
OKButton();
|
||||||
|
}
|
||||||
|
|
||||||
|
void GnomeBase::CancelClicked()
|
||||||
|
{
|
||||||
|
CancelButton();
|
||||||
|
}
|
||||||
|
|
||||||
|
void GnomeBase::ApplyClicked()
|
||||||
|
{
|
||||||
|
ApplyButton();
|
||||||
|
}
|
||||||
|
|
||||||
|
void GnomeBase::RestoreClicked()
|
||||||
|
{
|
||||||
|
RestoreButton();
|
||||||
|
}
|
||||||
|
|
||||||
|
void GnomeBase::InputChanged()
|
||||||
|
{
|
||||||
|
bc().valid(validate());
|
||||||
|
}
|
||||||
|
|
||||||
Gnome::Dialog * GnomeBase::dialog()
|
Gnome::Dialog * GnomeBase::dialog()
|
||||||
{
|
{
|
||||||
|
@ -33,7 +33,7 @@ class Dialog;
|
|||||||
class GnomeBase : public ViewBC<gnomeBC>, public SigC::Object {
|
class GnomeBase : public ViewBC<gnomeBC>, public SigC::Object {
|
||||||
public:
|
public:
|
||||||
///
|
///
|
||||||
GnomeBase(ControlButtons & c, string const & glade_file, string const & name);
|
GnomeBase(ControlButtons & c, string const & name);
|
||||||
///
|
///
|
||||||
virtual ~GnomeBase();
|
virtual ~GnomeBase();
|
||||||
|
|
||||||
@ -49,9 +49,20 @@ protected:
|
|||||||
void show();
|
void show();
|
||||||
/// Hide the dialog.
|
/// Hide the dialog.
|
||||||
void hide();
|
void hide();
|
||||||
|
|
||||||
/// Build the dialog. Also connects signals and prepares it for work.
|
/// Build the dialog. Also connects signals and prepares it for work.
|
||||||
virtual void build() = 0;
|
virtual void build() = 0;
|
||||||
|
/// Dialog is valid
|
||||||
|
virtual bool validate();
|
||||||
|
/// Default OK behaviour
|
||||||
|
virtual void OKClicked();
|
||||||
|
/// Default Cancel behaviour
|
||||||
|
virtual void CancelClicked();
|
||||||
|
/// Default Restore behaviour
|
||||||
|
virtual void RestoreClicked();
|
||||||
|
/// Default apply behaviour
|
||||||
|
virtual void ApplyClicked();
|
||||||
|
/// Default changed input behaviour
|
||||||
|
virtual void InputChanged();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// Loads the glade file to memory.
|
/// Loads the glade file to memory.
|
||||||
@ -93,14 +104,14 @@ T* GnomeBase::getWidget(char const * name) const
|
|||||||
template <class Controller>
|
template <class Controller>
|
||||||
class FormCB : public GnomeBase {
|
class FormCB : public GnomeBase {
|
||||||
public:
|
public:
|
||||||
FormCB(Controller & c, string const & file, string const & name);
|
FormCB(Controller & c, string const & name);
|
||||||
protected:
|
protected:
|
||||||
Controller & controller();
|
Controller & controller();
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class Controller>
|
template <class Controller>
|
||||||
FormCB<Controller>::FormCB(Controller & c, string const & file, string const & name)
|
FormCB<Controller>::FormCB(Controller & c, string const & name)
|
||||||
: GnomeBase(c, file, name)
|
: GnomeBase(c, name)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
template <class Controller>
|
template <class Controller>
|
||||||
|
Loading…
Reference in New Issue
Block a user