2002-09-25 14:26:13 +00:00
|
|
|
/**
|
|
|
|
* \file GPreamble.C
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
2002-03-31 23:17:11 +00:00
|
|
|
*
|
2002-09-25 14:26:13 +00:00
|
|
|
* \author Michael Koziarski
|
2002-03-31 23:17:11 +00:00
|
|
|
*
|
2002-09-25 14:26:13 +00:00
|
|
|
* Full author contact details are available in file CREDITS
|
2002-03-31 23:17:11 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma implementation
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
|
|
|
#include "gnomeBC.h"
|
|
|
|
#include "GPreamble.h"
|
|
|
|
|
2002-06-02 04:15:33 +00:00
|
|
|
#include <gtkmm/textview.h>
|
|
|
|
#include <gtkmm/button.h>
|
2002-03-31 23:17:11 +00:00
|
|
|
|
|
|
|
GPreamble::GPreamble(ControlPreamble & c)
|
2002-09-26 08:57:43 +00:00
|
|
|
: GnomeCB<ControlPreamble>(c, "GPreamble")
|
2002-03-31 23:17:11 +00:00
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
|
|
GPreamble::~GPreamble()
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
|
|
void GPreamble::build()
|
|
|
|
{
|
|
|
|
// Connect the buttons.
|
2002-06-02 04:15:33 +00:00
|
|
|
ok_btn()->signal_clicked().connect(SigC::slot(*this, &GPreamble::OKClicked));
|
|
|
|
cancel_btn()->signal_clicked().connect(SigC::slot(*this, &GPreamble::CancelClicked));
|
|
|
|
apply_btn()->signal_clicked().connect(SigC::slot(*this, &GPreamble::ApplyClicked));
|
2002-03-31 23:17:11 +00:00
|
|
|
// Manage the buttons state
|
|
|
|
bc().setOK(ok_btn());
|
|
|
|
bc().setCancel(cancel_btn());
|
|
|
|
bc().setApply(apply_btn());
|
|
|
|
bc().refresh();
|
|
|
|
}
|
|
|
|
|
|
|
|
void GPreamble::apply()
|
|
|
|
{
|
2002-06-02 04:15:33 +00:00
|
|
|
controller().params() = preamble()->get_buffer()->get_text(preamble()->get_buffer()->get_start_iter(),
|
|
|
|
preamble()->get_buffer()->get_end_iter(),
|
|
|
|
false);
|
2002-03-31 23:17:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void GPreamble::update()
|
|
|
|
{
|
|
|
|
disconnect_signals();
|
2002-06-02 04:15:33 +00:00
|
|
|
preamble()->get_buffer()->set_text(controller().params());
|
2002-03-31 23:17:11 +00:00
|
|
|
connect_signals();
|
|
|
|
}
|
|
|
|
|
|
|
|
void GPreamble::connect_signals()
|
|
|
|
{
|
2002-06-02 04:15:33 +00:00
|
|
|
slot_preamble_ = preamble()->
|
|
|
|
get_buffer()->
|
|
|
|
signal_changed().connect(SigC::slot(*this, &GPreamble::InputChanged));
|
2002-03-31 23:17:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void GPreamble::disconnect_signals()
|
|
|
|
{
|
|
|
|
slot_preamble_.disconnect();
|
|
|
|
}
|
|
|
|
|
|
|
|
Gtk::Button * GPreamble::ok_btn() const
|
|
|
|
{
|
|
|
|
return getWidget<Gtk::Button>("r_ok_btn");
|
|
|
|
}
|
|
|
|
Gtk::Button * GPreamble::apply_btn() const
|
|
|
|
{
|
|
|
|
return getWidget<Gtk::Button>("r_apply_btn");
|
|
|
|
}
|
|
|
|
Gtk::Button * GPreamble::cancel_btn() const
|
|
|
|
{
|
|
|
|
return getWidget<Gtk::Button>("r_cancel_btn");
|
|
|
|
}
|
2002-06-02 04:15:33 +00:00
|
|
|
Gtk::TextView * GPreamble::preamble() const
|
2002-03-31 23:17:11 +00:00
|
|
|
{
|
2002-06-02 04:15:33 +00:00
|
|
|
return getWidget<Gtk::TextView>("r_preamble");
|
2002-03-31 23:17:11 +00:00
|
|
|
}
|