mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-08 20:32:49 +00:00
Gnomified FormError.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1881 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
5a00c55946
commit
63a78abdb9
@ -24,6 +24,7 @@
|
||||
#include "ControlCitation.h"
|
||||
#include "ControlCopyright.h"
|
||||
#include "ControlCredits.h"
|
||||
#include "ControlError.h"
|
||||
#include "ControlInclude.h"
|
||||
#include "ControlLog.h"
|
||||
#include "ControlUrl.h"
|
||||
@ -34,6 +35,7 @@
|
||||
#include "FormUrl.h"
|
||||
#include "FormCredits.h"
|
||||
#include "FormCopyright.h"
|
||||
#include "FormError.h"
|
||||
|
||||
/*
|
||||
#include "FormBibitem.h"
|
||||
@ -44,7 +46,6 @@
|
||||
#include "FormVCLog.h"
|
||||
|
||||
#include "FormDocument.h"
|
||||
#include "FormError.h"
|
||||
#include "FormExternal.h"
|
||||
#include "FormGraphics.h"
|
||||
#include "FormInclude.h"
|
||||
@ -73,6 +74,7 @@ Dialogs::Dialogs(LyXView * lv)
|
||||
add(new GUIUrl<FormUrl, gnomeBC>(*lv, *this));
|
||||
add(new GUICredits<FormCredits, gnomeBC>(*lv, *this));
|
||||
add(new GUICopyright<FormCopyright, gnomeBC>(*lv, *this));
|
||||
add(new GUIError<FormError, gnomeBC>(*lv, *this));
|
||||
|
||||
/*
|
||||
splash_.reset(new FormSplash(lv, this));
|
||||
@ -88,7 +90,6 @@ Dialogs::Dialogs(LyXView * lv)
|
||||
add(new FormCitation(lv, this));
|
||||
|
||||
add(new FormDocument(lv, this));
|
||||
add(new FormError(lv, this));
|
||||
add(new FormExternal(lv, this));
|
||||
add(new FormGraphics(lv, this));
|
||||
add(new FormInclude(lv, this));
|
||||
|
@ -1,130 +1,58 @@
|
||||
// -*- C++ -*-
|
||||
/* This file is part of
|
||||
* ======================================================
|
||||
* =================================================
|
||||
*
|
||||
* LyX, The Document Processor
|
||||
* Copyright 1995-2000 The LyX Team.
|
||||
*
|
||||
* LyX, The Document Processor
|
||||
* =================================================
|
||||
*
|
||||
* Copyright 2000 The LyX Team.
|
||||
*
|
||||
* ======================================================
|
||||
* \author Baruch Even
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation
|
||||
#endif
|
||||
|
||||
#include "gettext.h"
|
||||
#include "Dialogs.h"
|
||||
#include <config.h>
|
||||
|
||||
#include "gnomeBC.h"
|
||||
#include "FormError.h"
|
||||
#include "LyXView.h"
|
||||
#include "buffer.h"
|
||||
#include "lyxfunc.h"
|
||||
|
||||
#include <gtk--/label.h>
|
||||
#include <gtk--/box.h>
|
||||
#include <gtk--/button.h>
|
||||
#include <gtk--/buttonbox.h>
|
||||
#include <gnome--/stock.h>
|
||||
#include <gtk--/separator.h>
|
||||
#include <gtk--/alignment.h>
|
||||
#include <gtk--/text.h>
|
||||
|
||||
// temporary solution for LyXView
|
||||
#include "mainapp.h"
|
||||
extern GLyxAppWin * mainAppWin;
|
||||
FormError::FormError(ControlError & c)
|
||||
: FormCB<ControlError>(c, "diaerror.glade", "DiaError")
|
||||
{}
|
||||
|
||||
|
||||
FormError::FormError(LyXView * lv, Dialogs * d)
|
||||
: lv_(lv), d_(d), inset_(0), u_(0), h_(0), ih_(0), dialog_(0)
|
||||
void FormError::build()
|
||||
{
|
||||
// let the dialog be shown
|
||||
// These are permanent connections so we won't bother
|
||||
// storing a copy because we won't be disconnecting.
|
||||
d->showError.connect(slot(this, &FormError::showInset));
|
||||
// Connect the buttons.
|
||||
close_btn()->clicked.connect(SigC::slot(this, &FormError::CloseClicked));
|
||||
|
||||
// Manage the buttons state
|
||||
bc().setCancel(close_btn());
|
||||
|
||||
// Make sure everything is in the correct state.
|
||||
bc().refresh();
|
||||
}
|
||||
|
||||
|
||||
FormError::~FormError()
|
||||
void FormError::update()
|
||||
{
|
||||
hide();
|
||||
textarea()->insert(controller().params());
|
||||
}
|
||||
|
||||
void FormError::showInset( InsetError * const inset )
|
||||
{
|
||||
if( dialog_!=0 || inset == 0 ) return;
|
||||
|
||||
inset_ = inset;
|
||||
ih_ = inset_->hideDialog.connect(slot(this, &FormError::hide));
|
||||
|
||||
show();
|
||||
Gtk::Button * FormError::close_btn() const
|
||||
{
|
||||
return getWidget<Gtk::Button>("button_close");
|
||||
}
|
||||
|
||||
void FormError::show()
|
||||
|
||||
Gtk::Text * FormError::textarea() const
|
||||
{
|
||||
if (!dialog_)
|
||||
{
|
||||
using namespace Gtk::Box_Helpers;
|
||||
|
||||
Gtk::Label * label = manage( new Gtk::Label(inset_->getContents()) );
|
||||
Gtk::Box * hbox = manage( new Gtk::HBox() );
|
||||
Gtk::Button * b_close = Gtk::wrap( GTK_BUTTON( gnome_stock_button(GNOME_STOCK_BUTTON_CLOSE) ) );
|
||||
Gtk::Alignment * alg1 = manage( new Gtk::Alignment(0.5, 0.5, 0, 0) );
|
||||
Gtk::Alignment * mbox = manage( new Gtk::Alignment(0.5, 0.5, 0, 0) );
|
||||
|
||||
// set up spacing
|
||||
hbox->set_spacing(4);
|
||||
|
||||
// packing
|
||||
alg1->add(*b_close);
|
||||
|
||||
hbox->children().push_back(Element(*label, false, false));
|
||||
hbox->children().push_back(Element(*manage(new Gtk::VSeparator()), false, false));
|
||||
hbox->children().push_back(Element(*alg1, false, false));
|
||||
|
||||
mbox->add(*hbox);
|
||||
|
||||
// packing dialog to main window
|
||||
dialog_ = mbox;
|
||||
mainAppWin->add_action(*dialog_, _(" Error "));
|
||||
|
||||
// setting focus
|
||||
GTK_WIDGET_SET_FLAGS (GTK_WIDGET(b_close->gtkobj()), GTK_CAN_DEFAULT);
|
||||
gtk_widget_grab_focus (GTK_WIDGET(b_close->gtkobj()));
|
||||
gtk_widget_grab_default (GTK_WIDGET(b_close->gtkobj()));
|
||||
|
||||
// connecting signals
|
||||
b_close->clicked.connect(slot(mainAppWin, &GLyxAppWin::remove_action));
|
||||
dialog_->destroy.connect(slot(this, &FormError::free));
|
||||
|
||||
u_ = d_->updateBufferDependent.connect(slot(this, &FormError::updateSlot));
|
||||
h_ = d_->hideBufferDependent.connect(slot(this, &FormError::hide));
|
||||
}
|
||||
return getWidget<Gtk::Text>("textarea");
|
||||
}
|
||||
|
||||
void FormError::updateSlot(bool buffchanged)
|
||||
{
|
||||
if (buffchanged) hide();
|
||||
}
|
||||
|
||||
void FormError::hide()
|
||||
{
|
||||
if (dialog_!=0) mainAppWin->remove_action();
|
||||
}
|
||||
|
||||
void FormError::free()
|
||||
{
|
||||
if (dialog_!=0)
|
||||
{
|
||||
dialog_ = 0;
|
||||
u_.disconnect();
|
||||
h_.disconnect();
|
||||
inset_ = 0;
|
||||
ih_.disconnect();
|
||||
}
|
||||
}
|
||||
|
||||
void FormError::apply()
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -1,13 +1,15 @@
|
||||
// -*- C++ -*-
|
||||
/* This file is part of
|
||||
* ======================================================
|
||||
* =================================================
|
||||
*
|
||||
* LyX, The Document Processor
|
||||
* Copyright 1995 Matthias Ettrich.
|
||||
* Copyright 1995-2000 The LyX Team.
|
||||
*
|
||||
* LyX, The Document Processor
|
||||
* =================================================
|
||||
*
|
||||
* Copyright 2000 The LyX Team.
|
||||
*
|
||||
* ======================================================
|
||||
*/
|
||||
* \author Baruch Even
|
||||
* */
|
||||
|
||||
#ifndef FORMERROR_H
|
||||
#define FORMERROR_H
|
||||
@ -16,56 +18,40 @@
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
#include "DialogBase.h"
|
||||
#include "LString.h"
|
||||
#include "insets/inseterror.h"
|
||||
#include "ControlError.h"
|
||||
#include "GnomeBase.h"
|
||||
|
||||
#include <gtk--/container.h>
|
||||
namespace Gtk {
|
||||
class Button;
|
||||
class Text;
|
||||
}
|
||||
|
||||
/** This class provides an Gnome implementation of the FormError Dialog.
|
||||
/**
|
||||
* This class implements the dialog to show error messages.
|
||||
*/
|
||||
class FormError : public DialogBase {
|
||||
class FormError : public FormCB<ControlError> {
|
||||
public:
|
||||
///
|
||||
FormError(LyXView *, Dialogs *);
|
||||
///
|
||||
~FormError();
|
||||
private:
|
||||
/// Slot launching dialog to an existing inset
|
||||
void showInset( InsetError * const );
|
||||
|
||||
/// Update dialog before showing it
|
||||
virtual void update() { }
|
||||
virtual void updateSlot(bool = false);
|
||||
/// Apply from dialog (modify or create inset)
|
||||
virtual void apply();
|
||||
/// Explicitly free the dialog.
|
||||
void free();
|
||||
/// Create the dialog if necessary, update it and display it.
|
||||
void show();
|
||||
/// Hide the dialog.
|
||||
void hide();
|
||||
|
||||
/** Which LyXFunc do we use?
|
||||
We could modify Dialogs to have a visible LyXFunc* instead and
|
||||
save a couple of bytes per dialog.
|
||||
*/
|
||||
LyXView * lv_;
|
||||
/** Which Dialogs do we belong to?
|
||||
Used so we can get at the signals we have to connect to.
|
||||
*/
|
||||
Dialogs * d_;
|
||||
/// pointer to the inset passed through showInset (if any)
|
||||
InsetError * inset_;
|
||||
/// Update connection.
|
||||
SigC::Connection u_;
|
||||
/// Hide connection.
|
||||
SigC::Connection h_;
|
||||
/// inset::hide connection.
|
||||
SigC::Connection ih_;
|
||||
///
|
||||
FormError(ControlError & c);
|
||||
///
|
||||
~FormError() {};
|
||||
|
||||
/// Real GUI implementation.
|
||||
Gtk::Container * dialog_;
|
||||
void apply() {};
|
||||
void update();
|
||||
|
||||
private:
|
||||
/// Build the dialog
|
||||
void build();
|
||||
|
||||
/// Returns true if the dialog input is in a valid state.
|
||||
bool validate() const {return true;};
|
||||
|
||||
|
||||
void CloseClicked() { CancelButton(); }
|
||||
|
||||
/// The close button
|
||||
Gtk::Button * close_btn() const;
|
||||
Gtk::Text * textarea() const;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -83,6 +83,8 @@ libgnome_la_SOURCES = \
|
||||
FormCopyright.h \
|
||||
FormCredits.C \
|
||||
FormCredits.h \
|
||||
FormError.C \
|
||||
FormError.h \
|
||||
FormUrl.C \
|
||||
FormUrl.h \
|
||||
Menubar_pimpl.C \
|
||||
|
100
src/frontends/gnome/dialogs/diaerror.glade
Normal file
100
src/frontends/gnome/dialogs/diaerror.glade
Normal file
@ -0,0 +1,100 @@
|
||||
<?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>DiaError</name>
|
||||
<title>Error</title>
|
||||
<type>GTK_WINDOW_DIALOG</type>
|
||||
<position>GTK_WIN_POS_NONE</position>
|
||||
<modal>False</modal>
|
||||
<allow_shrink>False</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_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_close</name>
|
||||
<can_default>True</can_default>
|
||||
<can_focus>True</can_focus>
|
||||
<stock_button>GNOME_STOCK_BUTTON_CLOSE</stock_button>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkScrolledWindow</class>
|
||||
<name>scrolledwindow1</name>
|
||||
<hscrollbar_policy>GTK_POLICY_AUTOMATIC</hscrollbar_policy>
|
||||
<vscrollbar_policy>GTK_POLICY_NEVER</vscrollbar_policy>
|
||||
<hupdate_policy>GTK_UPDATE_CONTINUOUS</hupdate_policy>
|
||||
<vupdate_policy>GTK_UPDATE_CONTINUOUS</vupdate_policy>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>True</expand>
|
||||
<fill>True</fill>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>GtkText</class>
|
||||
<name>textarea</name>
|
||||
<width>250</width>
|
||||
<height>200</height>
|
||||
<can_focus>True</can_focus>
|
||||
<editable>False</editable>
|
||||
<text></text>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
</GTK-Interface>
|
@ -21,9 +21,9 @@
|
||||
|
||||
<widget>
|
||||
<class>GnomeDialog</class>
|
||||
<name>DiaInsertIndex</name>
|
||||
<name>DiaIndex</name>
|
||||
<border_width>2</border_width>
|
||||
<title>Insert Index</title>
|
||||
<title>Insert/Update Index</title>
|
||||
<type>GTK_WINDOW_DIALOG</type>
|
||||
<position>GTK_WIN_POS_NONE</position>
|
||||
<modal>False</modal>
|
||||
@ -123,7 +123,7 @@
|
||||
<widget>
|
||||
<class>GtkEntry</class>
|
||||
<child_name>GnomeEntry:entry</child_name>
|
||||
<name>combo-entry1</name>
|
||||
<name>keyword</name>
|
||||
<can_default>True</can_default>
|
||||
<has_default>True</has_default>
|
||||
<can_focus>True</can_focus>
|
||||
|
Loading…
Reference in New Issue
Block a user