FormTabularCreate dialog implementation for Gnome.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1996 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Baruch Even 2001-05-12 20:13:52 +00:00
parent 15271fce07
commit c1cfd45477
6 changed files with 400 additions and 2 deletions

View File

@ -1,3 +1,11 @@
2001-05-08 Michael A. Koziarski <michael@koziarski.org>
* FormTabularCreate[Ch]:
* dialogs:
* Makefile.am:
* Dialogs.C: Created the FormCharacter Dialog and altered the
other files to include it.
2001-04-29 Baruch Even <baruch@lyx.org> 2001-04-29 Baruch Even <baruch@lyx.org>
* Dialogs.C: Added an include for ControlSplash which is required * Dialogs.C: Added an include for ControlSplash which is required

View File

@ -31,14 +31,14 @@
#include "ControlLog.h" #include "ControlLog.h"
#include "ControlUrl.h" #include "ControlUrl.h"
#include "ControlVCLog.h" #include "ControlVCLog.h"
#include "ControlTabularCreate.h"
#include "GUI.h" #include "GUI.h"
#include "FormUrl.h" #include "FormUrl.h"
#include "FormCredits.h" #include "FormCredits.h"
#include "FormCopyright.h" #include "FormCopyright.h"
#include "FormError.h" #include "FormError.h"
#include "FormTabularCreate.h"
/* /*
#include "FormBibitem.h" #include "FormBibitem.h"
#include "FormBibtex.h" #include "FormBibtex.h"
@ -77,6 +77,7 @@ Dialogs::Dialogs(LyXView * lv)
add(new GUICredits<FormCredits, gnomeBC>(*lv, *this)); add(new GUICredits<FormCredits, gnomeBC>(*lv, *this));
add(new GUICopyright<FormCopyright, gnomeBC>(*lv, *this)); add(new GUICopyright<FormCopyright, gnomeBC>(*lv, *this));
add(new GUIError<FormError, gnomeBC>(*lv, *this)); add(new GUIError<FormError, gnomeBC>(*lv, *this));
add(new GUITabularCreate<FormTabularCreate, gnomeBC>(*lv, *this));
/* /*
splash_.reset(new FormSplash(lv, this)); splash_.reset(new FormSplash(lv, this));

View File

@ -0,0 +1,109 @@
// -*- C++ -*-
/* 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 <utility>
#include "gnomeBC.h"
#include "FormTabularCreate.h"
#include <gtk--/spinbutton.h>
#include <gtk--/button.h>
FormTabularCreate::FormTabularCreate(ControlTabularCreate & c)
: FormCB<ControlTabularCreate>(c, "diainserttabular.glade",
"DiaInsertTabular")
{}
FormTabularCreate::~FormTabularCreate()
{
// Note that there is no need to destroy the class itself, it seems
// like everything is managed inside it. Deleting the class itself will
// a crash at the end of the program.
//dialog_->destroy();
}
void FormTabularCreate::build()
{
// Connect the buttons.
ok_btn()->clicked.connect(SigC::slot(this,
&FormTabularCreate::OKClicked));
cancel_btn()->clicked.connect(SigC::slot(this,
&FormTabularCreate::CancelClicked));
apply_btn()->clicked.connect(SigC::slot(this,
&FormTabularCreate::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();
}
void FormTabularCreate::apply()
{
unsigned int ysize = (unsigned int)(rows_spin()->get_value_as_int());
unsigned int xsize = (unsigned int)(columns_spin()->get_value_as_int());
controller().params() = std::make_pair(xsize, ysize);
}
void FormTabularCreate::update()
{
}
bool FormTabularCreate::validate() const
{
// Always valid! (not really so, needs fixing).
return true;
}
Gtk::SpinButton * FormTabularCreate::rows_spin() const
{
return getWidget<Gtk::SpinButton>("tabular_spin_rows");
}
Gtk::SpinButton * FormTabularCreate::columns_spin() const
{
return getWidget<Gtk::SpinButton>("tabular_spin_columns");
}
Gtk::Button * FormTabularCreate::ok_btn() const
{
return getWidget<Gtk::Button>("button_ok");
}
Gtk::Button * FormTabularCreate::cancel_btn() const
{
return getWidget<Gtk::Button>("button_cancel");
}
Gtk::Button * FormTabularCreate::apply_btn() const
{
return getWidget<Gtk::Button>("button_apply");
}

View File

@ -0,0 +1,63 @@
// -*- 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 FORMTABULARCREATE_H
#define FORMTABULARCREATE_H
#ifdef __GNUG__
#pragma interface
#endif
#include "ControlTabularCreate.h"
#include "GnomeBase.h"
namespace Gtk {
class SpinButton;
}
/**
* This class implements the dialog to insert/modify urls.
*/
class FormTabularCreate : public FormCB<ControlTabularCreate> {
public:
///
FormTabularCreate(ControlTabularCreate & c);
///
~FormTabularCreate();
void apply();
private:
/// Build the dialog
void build();
/// Returns true if the dialog input is in a valid state.
bool validate() const;
void update();
void OKClicked() { OKButton(); }
void CancelClicked() { CancelButton(); }
void ApplyClicked() { ApplyButton(); }
/// The SpinButtons
Gtk::SpinButton * rows_spin() const;
Gtk::SpinButton * columns_spin() 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;
};
#endif

View File

@ -81,6 +81,8 @@ libgnome_la_SOURCES = \
FileDialog.C \ FileDialog.C \
FormCopyright.C \ FormCopyright.C \
FormCopyright.h \ FormCopyright.h \
FormTabularCreate.C \
FormTabularCreate.h \
FormCredits.C \ FormCredits.C \
FormCredits.h \ FormCredits.h \
FormError.C \ FormError.C \

View File

@ -0,0 +1,215 @@
<?xml version="1.0"?>
<GTK-Interface>
<project>
<name>DiaInsertTabular</name>
<program_name>diainserttabular</program_name>
<directory></directory>
<source_directory>src</source_directory>
<pixmaps_directory>pixmaps</pixmaps_directory>
<language>C</language>
<gnome_support>True</gnome_support>
<gettext_support>True</gettext_support>
</project>
<widget>
<class>GnomeDialog</class>
<name>DiaInsertTabular</name>
<title>Insert Tabular</title>
<type>GTK_WINDOW_DIALOG</type>
<position>GTK_WIN_POS_NONE</position>
<modal>False</modal>
<allow_shrink>False</allow_shrink>
<allow_grow>False</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_END</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>button_ok</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>button_apply</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>button_cancel</name>
<can_default>True</can_default>
<can_focus>True</can_focus>
<stock_button>GNOME_STOCK_BUTTON_CANCEL</stock_button>
</widget>
</widget>
<widget>
<class>GtkTable</class>
<name>table1</name>
<rows>2</rows>
<columns>2</columns>
<homogeneous>True</homogeneous>
<row_spacing>0</row_spacing>
<column_spacing>0</column_spacing>
<child>
<padding>0</padding>
<expand>True</expand>
<fill>True</fill>
</child>
<widget>
<class>GtkLabel</class>
<name>label2</name>
<label>Rows</label>
<justify>GTK_JUSTIFY_RIGHT</justify>
<wrap>False</wrap>
<xalign>0</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
<child>
<left_attach>0</left_attach>
<right_attach>1</right_attach>
<top_attach>0</top_attach>
<bottom_attach>1</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>False</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>False</yfill>
</child>
</widget>
<widget>
<class>GtkLabel</class>
<name>label3</name>
<label>Columns</label>
<justify>GTK_JUSTIFY_RIGHT</justify>
<wrap>False</wrap>
<xalign>0</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
<child>
<left_attach>0</left_attach>
<right_attach>1</right_attach>
<top_attach>1</top_attach>
<bottom_attach>2</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>False</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>False</yfill>
</child>
</widget>
<widget>
<class>GtkSpinButton</class>
<name>tabular_spin_rows</name>
<can_focus>True</can_focus>
<climb_rate>1</climb_rate>
<digits>0</digits>
<numeric>False</numeric>
<update_policy>GTK_UPDATE_ALWAYS</update_policy>
<snap>False</snap>
<wrap>False</wrap>
<value>1</value>
<lower>1</lower>
<upper>50</upper>
<step>1</step>
<page>10</page>
<page_size>10</page_size>
<child>
<left_attach>1</left_attach>
<right_attach>2</right_attach>
<top_attach>0</top_attach>
<bottom_attach>1</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>True</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>False</yfill>
</child>
</widget>
<widget>
<class>GtkSpinButton</class>
<name>tabular_spin_columns</name>
<can_focus>True</can_focus>
<climb_rate>1</climb_rate>
<digits>0</digits>
<numeric>False</numeric>
<update_policy>GTK_UPDATE_ALWAYS</update_policy>
<snap>False</snap>
<wrap>False</wrap>
<value>1</value>
<lower>1</lower>
<upper>50</upper>
<step>1</step>
<page>10</page>
<page_size>10</page_size>
<child>
<left_attach>1</left_attach>
<right_attach>2</right_attach>
<top_attach>1</top_attach>
<bottom_attach>2</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>True</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>False</yfill>
</child>
</widget>
</widget>
</widget>
</widget>
</GTK-Interface>