Michael Koziarski's gnome patch.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3516 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Angus Leeming 2002-02-11 10:22:27 +00:00
parent ccdfe85d2b
commit c238196fb2
8 changed files with 386 additions and 1 deletions

View File

@ -1,3 +1,14 @@
2002-02-10 Michael A. Koziarski <michael@koziarski.com>
* FormERT.C
* FormERT.h
* Dialogs.C
* dialogs/FormERT.glade: Implemented FormERT, still seeing the
weird crashes
* GnomeBase.C: add debug message to help track down the "twice OK"
bug
* gnomeBC.C: Fix compilation
2002-01-12 Michael A. Koziarski <michael@koziarski.com>
* Menubar_pimpl.C

View File

@ -30,11 +30,13 @@
#include "ControlUrl.h"
#include "ControlVCLog.h"
#include "ControlTabularCreate.h"
#include "ControlERT.h"
#include "GUI.h"
#include "FormUrl.h"
#include "FormError.h"
#include "FormTabularCreate.h"
#include "FormERT.h"
/*
#include "FormBibitem.h"
#include "FormBibtex.h"
@ -56,7 +58,7 @@
#include "FormRef.h"
#include "FormSearch.h"
#include "FormTabular.h"
#include "FormTabularCreate.h"
#include "FormTabul./arCreate.h"
#include "FormToc.h"
#include "FormUrl.h"
#include "FormMinipage.h"
@ -71,6 +73,7 @@ Dialogs::Dialogs(LyXView * lv)
add(new GUIUrl<FormUrl, gnomeBC>(*lv, *this));
add(new GUIError<FormError, gnomeBC>(*lv, *this));
add(new GUITabularCreate<FormTabularCreate, gnomeBC>(*lv, *this));
add(new GUIERT<FormERT, gnomeBC>(*lv, *this));
/*
add(new GUIBibitem<FormBibitem, xformsBC>(*lv, *this));

View File

@ -0,0 +1,132 @@
/* This file is part of
* =================================================
*
* LyX, The Document Processor
* Copyright 1995-2000 The LyX Team.
*
* =================================================
*
* \author Michael Koziarski <michael@koziarski.org>
*/
#ifdef __GNUG__
#pragma implementation
#endif
#include <config.h>
#include "gnomeBC.h"
#include "FormERT.h"
#include <gtk--/radiobutton.h>
#include <gtk--/button.h>
FormERT::FormERT(ControlERT & c)
: FormCB<ControlERT>(c, "FormERT")
{}
FormERT::~FormERT()
{}
void FormERT::build()
{
// Connect the buttons.
ok_btn()->clicked.connect(SigC::slot(this, &FormERT::OKClicked));
cancel_btn()->clicked.connect(SigC::slot(this, &FormERT::CancelClicked));
apply_btn()->clicked.connect(SigC::slot(this, &FormERT::ApplyClicked));
// Manage the buttons state
bc().setOK(ok_btn());
bc().setCancel(cancel_btn());
bc().setApply(apply_btn());
// Make sure everything is in the correct state.
bc().refresh();
// Manage the read-only aware widgets.
bc().addReadOnly(open());
bc().addReadOnly(inlined());
bc().addReadOnly(collapsed());
}
void FormERT::connect_signals()
{
slot_open = open()->clicked.connect(SigC::slot(this, &FormERT::InputChanged));
slot_collapsed = collapsed()->clicked.connect(SigC::slot(this, &FormERT::InputChanged));
slot_inlined = inlined()->clicked.connect(SigC::slot(this, &FormERT::InputChanged));
}
void FormERT::disconnect_signals()
{
slot_open.disconnect();
slot_collapsed.disconnect();
slot_inlined.disconnect();
}
void FormERT::apply()
{
if (open()->get_active())
controller().params().status = InsetERT::Open;
else if (collapsed()->get_active())
controller().params().status = InsetERT::Collapsed;
else
controller().params().status = InsetERT::Inlined;
}
void FormERT::update()
{
disconnect_signals();
switch (controller().params().status) {
case InsetERT::Open:
open()->set_active(true);
break;
case InsetERT::Collapsed:
collapsed()->set_active(true);
break;
case InsetERT::Inlined:
inlined()->set_active(true);
break;
}
connect_signals();
}
bool FormERT::validate() const
{
return true;
}
Gtk::Button * FormERT::ok_btn() const
{
return getWidget<Gtk::Button>("r_ok_btn");
}
Gtk::Button * FormERT::apply_btn() const
{
return getWidget<Gtk::Button>("r_apply_btn");
}
Gtk::Button * FormERT::cancel_btn() const
{
return getWidget<Gtk::Button>("r_cancel_btn");
}
Gtk::RadioButton * FormERT::open() const
{
return getWidget<Gtk::RadioButton>("r_open");
}
Gtk::RadioButton * FormERT::collapsed() const
{
return getWidget<Gtk::RadioButton>("r_collapsed");
}
Gtk::RadioButton * FormERT::inlined() const
{
return getWidget<Gtk::RadioButton>("r_inlined");
}

View File

@ -0,0 +1,75 @@
// -*- C++ -*-
/* This file is part of
* =================================================
*
* LyX, The Document Processor
* Copyright 1995 Matthias Ettrich.
* Copyright 1995-2000 The LyX Team.
*
* =================================================
*
* \author Michael Koziarski <michael@koziarski.org>
* */
#ifndef FORMERT_H
#define FORMERT_H
#ifdef __GNUG__
#pragma interface
#endif
#include "ControlERT.h"
#include "GnomeBase.h"
namespace Gtk {
class RadioButton;
class Button;
}
/**
* This class implements the dialog to insert/modify urls.
*/
class FormERT : public FormCB<ControlERT> {
public:
///
FormERT(ControlERT & c);
///
~FormERT();
void apply();
void update();
private:
/// Build the dialog
void build();
/// Returns true if the dialog input is in a valid state.
bool validate() const;
/// Do the connection of signals
void connect_signals();
/// Disconnect the signals.
void disconnect_signals();
/// generated by accessors.py
Gtk::Button * ok_btn() const;
/// generated by accessors.py
Gtk::Button * apply_btn() const;
/// genearated by accessors.py
Gtk::Button * cancel_btn() const;
/// generated by accessors.py
Gtk::RadioButton * open() const;
/// generated by accessors.py
Gtk::RadioButton * collapsed() const;
/// generated by accessors.py
Gtk::RadioButton * inlined() const;
/// do input validation
SigC::Connection slot_open;
SigC::Connection slot_collapsed;
SigC::Connection slot_inlined;
};
#endif

View File

@ -78,6 +78,7 @@ bool GnomeBase::validate()
void GnomeBase::OKClicked()
{
lyxerr[Debug::GUI] << "OKClicked()\n";
OKButton();
}

View File

@ -78,6 +78,8 @@ libgnome_la_SOURCES = \
FormTabularCreate.h \
FormUrl.C \
FormUrl.h \
FormERT.C \
FormERT.h \
gnome_helpers.C \
gnome_helpers.h \
GnomeBase.C \

View File

@ -0,0 +1,160 @@
<?xml version="1.0"?>
<GTK-Interface>
<project>
<name>diainserturl</name>
<program_name>diainserturl</program_name>
<directory></directory>
<source_directory></source_directory>
<pixmaps_directory>pixmaps</pixmaps_directory>
<language>C</language>
<gnome_support>True</gnome_support>
<gettext_support>True</gettext_support>
<use_widget_names>True</use_widget_names>
<output_main_file>False</output_main_file>
<output_build_files>False</output_build_files>
<gnome_help_support>True</gnome_help_support>
<main_source_file>diainserturl_interface.c</main_source_file>
<main_header_file>diainserturl_interface.h</main_header_file>
<handler_source_file>diainserturl_callbacks.c</handler_source_file>
<handler_header_file>diainserturl_callbacks.h</handler_header_file>
</project>
<widget>
<class>GnomeDialog</class>
<name>FormERT</name>
<border_width>2</border_width>
<visible>False</visible>
<title>ERT Options</title>
<type>GTK_WINDOW_DIALOG</type>
<position>GTK_WIN_POS_NONE</position>
<modal>False</modal>
<allow_shrink>True</allow_shrink>
<allow_grow>True</allow_grow>
<auto_shrink>False</auto_shrink>
<auto_close>False</auto_close>
<hide_on_close>True</hide_on_close>
<widget>
<class>GtkVBox</class>
<child_name>GnomeDialog:vbox</child_name>
<name>dialog-vbox1</name>
<homogeneous>False</homogeneous>
<spacing>8</spacing>
<child>
<padding>4</padding>
<expand>True</expand>
<fill>True</fill>
</child>
<widget>
<class>GtkHButtonBox</class>
<child_name>GnomeDialog:action_area</child_name>
<name>dialog-action_area1</name>
<layout_style>GTK_BUTTONBOX_DEFAULT_STYLE</layout_style>
<spacing>8</spacing>
<child_min_width>85</child_min_width>
<child_min_height>27</child_min_height>
<child_ipad_x>7</child_ipad_x>
<child_ipad_y>0</child_ipad_y>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>True</fill>
<pack>GTK_PACK_END</pack>
</child>
<widget>
<class>GtkButton</class>
<name>r_ok_btn</name>
<can_default>True</can_default>
<can_focus>True</can_focus>
<stock_button>GNOME_STOCK_BUTTON_OK</stock_button>
</widget>
<widget>
<class>GtkButton</class>
<name>r_apply_btn</name>
<can_default>True</can_default>
<can_focus>True</can_focus>
<stock_button>GNOME_STOCK_BUTTON_APPLY</stock_button>
</widget>
<widget>
<class>GtkButton</class>
<name>r_cancel_btn</name>
<can_default>True</can_default>
<has_default>True</has_default>
<can_focus>True</can_focus>
<stock_button>GNOME_STOCK_BUTTON_CANCEL</stock_button>
</widget>
</widget>
<widget>
<class>GtkFrame</class>
<name>frame1</name>
<label>Status</label>
<label_xalign>0</label_xalign>
<shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
<child>
<padding>0</padding>
<expand>True</expand>
<fill>True</fill>
</child>
<widget>
<class>GtkVBox</class>
<name>vbox1</name>
<homogeneous>False</homogeneous>
<spacing>0</spacing>
<widget>
<class>GtkRadioButton</class>
<name>r_open</name>
<can_focus>True</can_focus>
<label>_Open</label>
<active>True</active>
<draw_indicator>True</draw_indicator>
<group>status</group>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
</child>
</widget>
<widget>
<class>GtkRadioButton</class>
<name>r_collapsed</name>
<can_focus>True</can_focus>
<label>_Collapsed</label>
<active>False</active>
<draw_indicator>True</draw_indicator>
<group>status</group>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
</child>
</widget>
<widget>
<class>GtkRadioButton</class>
<name>r_inlined</name>
<can_focus>True</can_focus>
<label>_Inlined View</label>
<active>False</active>
<draw_indicator>True</draw_indicator>
<group>status</group>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
</child>
</widget>
</widget>
</widget>
</widget>
</widget>
</GTK-Interface>

View File

@ -5,6 +5,7 @@
#endif
#include "gnomeBC.h"
#include "ButtonController.tmpl"
#include "gtk--/widget.h"
#include "gtk--/button.h"