mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-23 21:40:19 +00:00
GTK ERT dialog
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9240 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
5352478c93
commit
7e20629741
@ -1,5 +1,7 @@
|
|||||||
2004-11-14 John Spray <spray_john@users.sourceforge.net>
|
2004-11-14 John Spray <spray_john@users.sourceforge.net>
|
||||||
|
|
||||||
|
* The ERT dialog:
|
||||||
|
Dialogs.C, Makefile.am, GERT.C, GERT.h
|
||||||
* The Box dialog:
|
* The Box dialog:
|
||||||
Dialogs.C, Makefile.am, GBox.C, GBox.h
|
Dialogs.C, Makefile.am, GBox.C, GBox.h
|
||||||
* ghelpers.[Ch], GGraphics.[Ch]: new functions unitsComboFromLength
|
* ghelpers.[Ch], GGraphics.[Ch]: new functions unitsComboFromLength
|
||||||
|
@ -61,7 +61,7 @@
|
|||||||
#include "FormCitation.h"
|
#include "FormCitation.h"
|
||||||
#include "FormDocument.h"
|
#include "FormDocument.h"
|
||||||
#include "GErrorList.h"
|
#include "GErrorList.h"
|
||||||
#include "FormERT.h"
|
#include "GERT.h"
|
||||||
#include "FormExternal.h"
|
#include "FormExternal.h"
|
||||||
#include "FormFloat.h"
|
#include "FormFloat.h"
|
||||||
#include "GGraphics.h"
|
#include "GGraphics.h"
|
||||||
@ -218,8 +218,9 @@ Dialogs::DialogPtr Dialogs::build(string const & name)
|
|||||||
dialog->setView(new GErrorList(*dialog));
|
dialog->setView(new GErrorList(*dialog));
|
||||||
dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
|
dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
|
||||||
} else if (name == "ert") {
|
} else if (name == "ert") {
|
||||||
|
dialog->bc().view(new GBC(dialog->bc()));
|
||||||
dialog->setController(new ControlERT(*dialog));
|
dialog->setController(new ControlERT(*dialog));
|
||||||
dialog->setView(new FormERT(*dialog));
|
dialog->setView(new GERT(*dialog));
|
||||||
dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
|
dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
|
||||||
} else if (name == "external") {
|
} else if (name == "external") {
|
||||||
dialog->setController(new ControlExternal(*dialog));
|
dialog->setController(new ControlExternal(*dialog));
|
||||||
|
93
src/frontends/gtk/GERT.C
Normal file
93
src/frontends/gtk/GERT.C
Normal file
@ -0,0 +1,93 @@
|
|||||||
|
/**
|
||||||
|
* \file GERT.C
|
||||||
|
* This file is part of LyX, the document processor.
|
||||||
|
* Licence details can be found in the file COPYING.
|
||||||
|
*
|
||||||
|
* \author John Spray
|
||||||
|
*
|
||||||
|
* Full author contact details are available in file CREDITS.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <config.h>
|
||||||
|
|
||||||
|
#include "GERT.h"
|
||||||
|
#include "ControlERT.h"
|
||||||
|
#include "ghelpers.h"
|
||||||
|
|
||||||
|
#include <libglademm.h>
|
||||||
|
|
||||||
|
using std::string;
|
||||||
|
|
||||||
|
namespace lyx {
|
||||||
|
namespace frontend {
|
||||||
|
|
||||||
|
GERT::GERT(Dialog & parent)
|
||||||
|
: GViewCB<ControlERT, GViewGladeB>(parent, _("TeX Settings"), false)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
void GERT::doBuild()
|
||||||
|
{
|
||||||
|
string const gladeName = findGladeFile("ERT");
|
||||||
|
xml_ = Gnome::Glade::Xml::create(gladeName);
|
||||||
|
|
||||||
|
Gtk::Button * cancelbutton;
|
||||||
|
xml_->get_widget("Close", cancelbutton);
|
||||||
|
setCancel(cancelbutton);
|
||||||
|
|
||||||
|
xml_->get_widget("Inline", inlineradio_);
|
||||||
|
xml_->get_widget("Open", openradio_);
|
||||||
|
xml_->get_widget("Collapsed", collapsedradio_);
|
||||||
|
|
||||||
|
inlineradio_->signal_toggled().connect(
|
||||||
|
sigc::mem_fun(*this, &GERT::apply));
|
||||||
|
openradio_->signal_toggled().connect(
|
||||||
|
sigc::mem_fun(*this, &GERT::apply));
|
||||||
|
collapsedradio_->signal_toggled().connect(
|
||||||
|
sigc::mem_fun(*this, &GERT::apply));
|
||||||
|
|
||||||
|
bcview().addReadOnly(inlineradio_);
|
||||||
|
bcview().addReadOnly(openradio_);
|
||||||
|
bcview().addReadOnly(collapsedradio_);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GERT::update()
|
||||||
|
{
|
||||||
|
applylock_ = true;
|
||||||
|
|
||||||
|
bc().refreshReadOnly();
|
||||||
|
|
||||||
|
switch (controller().status()) {
|
||||||
|
case InsetERT::Open:
|
||||||
|
openradio_->set_active(true);
|
||||||
|
break;
|
||||||
|
case InsetERT::Collapsed:
|
||||||
|
collapsedradio_->set_active(true);
|
||||||
|
break;
|
||||||
|
case InsetERT::Inlined:
|
||||||
|
inlineradio_->set_active(true);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
applylock_ = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GERT::apply()
|
||||||
|
{
|
||||||
|
if (applylock_)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (openradio_->get_active())
|
||||||
|
controller().setStatus(InsetERT::Open);
|
||||||
|
else if (collapsedradio_->get_active())
|
||||||
|
controller().setStatus(InsetERT::Collapsed);
|
||||||
|
else
|
||||||
|
controller().setStatus(InsetERT::Inlined);
|
||||||
|
|
||||||
|
controller().dispatchParams();
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace frontend
|
||||||
|
} // namespace lyx
|
43
src/frontends/gtk/GERT.h
Normal file
43
src/frontends/gtk/GERT.h
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
// -*- C++ -*-
|
||||||
|
/**
|
||||||
|
* \file GERT.h
|
||||||
|
* This file is part of LyX, the document processor.
|
||||||
|
* Licence details can be found in the file COPYING.
|
||||||
|
*
|
||||||
|
* \author John Spray
|
||||||
|
*
|
||||||
|
* Full author contact details are available in file CREDITS.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef GERT_H
|
||||||
|
#define GERT_H
|
||||||
|
|
||||||
|
#include "GViewBase.h"
|
||||||
|
|
||||||
|
namespace lyx {
|
||||||
|
namespace frontend {
|
||||||
|
|
||||||
|
class ControlERT;
|
||||||
|
|
||||||
|
/** This class provides a GTK+ implementation of the ERT Dialog.
|
||||||
|
*/
|
||||||
|
class GERT : public GViewCB<ControlERT, GViewGladeB> {
|
||||||
|
public:
|
||||||
|
GERT(Dialog & parent);
|
||||||
|
private:
|
||||||
|
virtual void apply();
|
||||||
|
virtual void doBuild();
|
||||||
|
virtual void update();
|
||||||
|
|
||||||
|
// apply() won't act when this is true
|
||||||
|
bool applylock_;
|
||||||
|
|
||||||
|
Gtk::RadioButton * inlineradio_;
|
||||||
|
Gtk::RadioButton * openradio_;
|
||||||
|
Gtk::RadioButton * collapsedradio_;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace frontend
|
||||||
|
} // namespace lyx
|
||||||
|
|
||||||
|
#endif // GERT_H
|
@ -32,6 +32,8 @@ libgtk_la_SOURCES = \
|
|||||||
GCharacter.h \
|
GCharacter.h \
|
||||||
GErrorList.C \
|
GErrorList.C \
|
||||||
GErrorList.h \
|
GErrorList.h \
|
||||||
|
GERT.C \
|
||||||
|
GERT.h \
|
||||||
GGraphics.C \
|
GGraphics.C \
|
||||||
GGraphics.h \
|
GGraphics.h \
|
||||||
GLog.C \
|
GLog.C \
|
||||||
@ -116,7 +118,6 @@ xforms_objects = \
|
|||||||
../xforms/FormColorpicker.lo \
|
../xforms/FormColorpicker.lo \
|
||||||
../xforms/FormDialogView.lo \
|
../xforms/FormDialogView.lo \
|
||||||
../xforms/FormDocument.lo \
|
../xforms/FormDocument.lo \
|
||||||
../xforms/FormERT.lo \
|
|
||||||
../xforms/FormExternal.lo \
|
../xforms/FormExternal.lo \
|
||||||
../xforms/FormFloat.lo \
|
../xforms/FormFloat.lo \
|
||||||
../xforms/FormInclude.lo \
|
../xforms/FormInclude.lo \
|
||||||
|
172
src/frontends/gtk/glade/ERT.glade
Normal file
172
src/frontends/gtk/glade/ERT.glade
Normal file
@ -0,0 +1,172 @@
|
|||||||
|
<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
|
||||||
|
<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
|
||||||
|
|
||||||
|
<glade-interface>
|
||||||
|
|
||||||
|
<widget class="GtkDialog" id="dialog">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="title" translatable="yes">dialog1</property>
|
||||||
|
<property name="type">GTK_WINDOW_TOPLEVEL</property>
|
||||||
|
<property name="window_position">GTK_WIN_POS_NONE</property>
|
||||||
|
<property name="modal">False</property>
|
||||||
|
<property name="resizable">False</property>
|
||||||
|
<property name="destroy_with_parent">False</property>
|
||||||
|
<property name="decorated">True</property>
|
||||||
|
<property name="skip_taskbar_hint">False</property>
|
||||||
|
<property name="skip_pager_hint">False</property>
|
||||||
|
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
|
||||||
|
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
|
||||||
|
<property name="has_separator">False</property>
|
||||||
|
|
||||||
|
<child internal-child="vbox">
|
||||||
|
<widget class="GtkVBox" id="dialog-vbox1">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="homogeneous">False</property>
|
||||||
|
<property name="spacing">0</property>
|
||||||
|
|
||||||
|
<child internal-child="action_area">
|
||||||
|
<widget class="GtkHButtonBox" id="dialog-action_area1">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="layout_style">GTK_BUTTONBOX_END</property>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkButton" id="Close">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_default">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="label">gtk-close</property>
|
||||||
|
<property name="use_stock">True</property>
|
||||||
|
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||||
|
<property name="focus_on_click">True</property>
|
||||||
|
<property name="response_id">-7</property>
|
||||||
|
<accelerator key="Escape" modifiers="0" signal="clicked"/>
|
||||||
|
</widget>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="padding">0</property>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="pack_type">GTK_PACK_END</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkFrame" id="frame1">
|
||||||
|
<property name="border_width">12</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="label_xalign">0</property>
|
||||||
|
<property name="label_yalign">0.5</property>
|
||||||
|
<property name="shadow_type">GTK_SHADOW_NONE</property>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkAlignment" id="alignment1">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="xalign">0.5</property>
|
||||||
|
<property name="yalign">0.5</property>
|
||||||
|
<property name="xscale">1</property>
|
||||||
|
<property name="yscale">1</property>
|
||||||
|
<property name="top_padding">0</property>
|
||||||
|
<property name="bottom_padding">0</property>
|
||||||
|
<property name="left_padding">12</property>
|
||||||
|
<property name="right_padding">0</property>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkVBox" id="vbox1">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="homogeneous">False</property>
|
||||||
|
<property name="spacing">0</property>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkRadioButton" id="Open">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="label" translatable="yes">_Open</property>
|
||||||
|
<property name="use_underline">True</property>
|
||||||
|
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||||
|
<property name="focus_on_click">True</property>
|
||||||
|
<property name="active">False</property>
|
||||||
|
<property name="inconsistent">False</property>
|
||||||
|
<property name="draw_indicator">True</property>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="padding">0</property>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">False</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkRadioButton" id="Collapsed">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="label" translatable="yes">_Collapsed</property>
|
||||||
|
<property name="use_underline">True</property>
|
||||||
|
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||||
|
<property name="focus_on_click">True</property>
|
||||||
|
<property name="active">False</property>
|
||||||
|
<property name="inconsistent">False</property>
|
||||||
|
<property name="draw_indicator">True</property>
|
||||||
|
<property name="group">Open</property>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="padding">0</property>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">False</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkRadioButton" id="Inline">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="label" translatable="yes">_Inline</property>
|
||||||
|
<property name="use_underline">True</property>
|
||||||
|
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||||
|
<property name="focus_on_click">True</property>
|
||||||
|
<property name="active">False</property>
|
||||||
|
<property name="inconsistent">False</property>
|
||||||
|
<property name="draw_indicator">True</property>
|
||||||
|
<property name="group">Open</property>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="padding">0</property>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">False</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
</child>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkLabel" id="label1">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="label" translatable="yes"><b>Display</b></property>
|
||||||
|
<property name="use_underline">False</property>
|
||||||
|
<property name="use_markup">True</property>
|
||||||
|
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||||
|
<property name="wrap">False</property>
|
||||||
|
<property name="selectable">False</property>
|
||||||
|
<property name="xalign">0.5</property>
|
||||||
|
<property name="yalign">0.5</property>
|
||||||
|
<property name="xpad">0</property>
|
||||||
|
<property name="ypad">0</property>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="type">label_item</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="padding">0</property>
|
||||||
|
<property name="expand">True</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
|
||||||
|
</glade-interface>
|
Loading…
Reference in New Issue
Block a user