+2000-09-22 Juergen Vigna <jug@sad.it>
+
+ * src/frontends/kde/Dialogs.C: added credits forms.
+
+ * src/frontends/gnome/Makefile.am (libgnome_la_OBJADD): added forms.
+
+ * src/frontends/gnome/Dialogs.C: added some forms.
+
+ * src/spellchecker.C (init_spell_checker): set language in pspell code
+ (RunSpellChecker): some modifications for setting language string.
+
+ * src/language.[Ch]: added language_country code.
+
+2000-09-21 Angus Leeming <a.leeming@ic.ac.uk>
+
+ * src/frontends/Dialogs.h: added new signal showError.
+ Rearranged existing signals in some sort of alphabetical order.
+
+ * src/frontends/xforms/Makefile.am: added new files, FormBase.[Ch],
+ FormError.[Ch], form_error.[Ch]
+ * src/frontends/xforms/forms/makefile: added new file form_error.fd
+ * src/frontends/xforms/Dialogs.C: added new xforms dialog FormError.
+
+ * src/frontends/xforms/FormBase.[Ch]: new base class for xforms
+ dialogs. I think that this can be used as the base to all these
+ dialogs.
+
+ * src/frontends/xforms/FormError.[Ch]
+ * src/frontends/xforms/forms/form_error.fd: new files. Xforms
+ implementation of InsetError dialog.
+
+ * src/insets/inseterror.[Ch]: rendered GUI-independent.
+
+ * src/frontends/kde/Dialogs.C: added new xforms dialog FormError.
+ * src/frontends/kde/Makefile.am: ditto
+
+2000-09-21 Dekel Tsur <dekel@math.tau.ac.il>
+
+ * src/mathed/math_cursor.[Ch]: Removed class members macroln and
+ macrobf. This fixes a bug of invisible text.
+
2000-09-22 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
* lib/doc/LaTeXConfig.lyx.in: updated.
class InsetGraphics;
class InsetBibKey;
class InsetBibtex;
+class InsetError;
class InsetInclude;
class InsetInfo;
class InsetTabular;
Signal0<void> updateBufferDependent;
//@}
- /**@name Dialog Access Signals */
+ /**@name Dialog Access Signals.
+ Put into some sort of alphabetical order */
//@{
- /// Opens the Preamble Dialog.
- Signal0<void> showPreamble;
- ///
- Signal0<void> showLogFile;
- ///
- Signal1<void, InsetTabular *> showTabular;
- ///
- Signal1<void, InsetTabular *> updateTabular;
+ /// Do we really have to push this?
+ Signal1<void, vector<string> const &> SetDocumentClassChoice;
///
- Signal1<void, InsetTabular *> hideTabular;
+ Signal1<void, InsetBibKey *> showBibkey;
///
- Signal0<void> showTabularCreate;
+ Signal1<void, InsetBibtex *> showBibtex;
///
Signal0<void> showCharacter;
///
- Signal0<void> updateCharacter; // allow update as cursor moves
- ///
- Signal0<void> showParagraph;
- /// Do we really have to push this?
- Signal1<void, vector<string> const &> SetDocumentClassChoice;
+ Signal1<void, InsetCommand *> showCitation;
///
- Signal0<void> showPrint;
+ Signal1<void, string const &> createCitation;
///
Signal0<void> showCopyright;
///
Signal0<void> showCredits;
///
- Signal0<void> showPreferences;
- ///
- Signal0<void> showLayoutDocument;
+ Signal1<void, InsetError *> showError;
///
Signal1<void, InsetGraphics *> showGraphics;
///
///
Signal1<void, string const &> createIndex;
///
- Signal1<void, InsetBibKey *> showBibkey;
+ Signal1<void, InsetInfo *> showInfo;
///
- Signal1<void, InsetCommand *> showCitation;
+ Signal0<void> showLayoutDocument;
///
- Signal1<void, string const &> createCitation;
+ Signal0<void> showLogFile;
+ ///
+ Signal0<void> showParagraph;
+ ///
+ Signal0<void> showPreamble;
+ ///
+ Signal0<void> showPreferences;
+ ///
+ Signal0<void> showPrint;
///
Signal1<void, InsetCommand *> showRef;
///
Signal1<void, string const &> createRef;
///
+ Signal1<void, InsetTabular *> showTabular;
+ ///
+ Signal1<void, InsetTabular *> updateTabular;
+ ///
+ Signal1<void, InsetTabular *> hideTabular;
+ ///
+ Signal0<void> showTabularCreate;
+ ///
Signal1<void, InsetCommand *> showTOC;
///
Signal1<void, string const &> createTOC;
///
Signal1<void, string const &> createUrl;
///
- Signal1<void, InsetBibtex *> showBibtex;
- ///
- Signal1<void, InsetInfo *> showInfo;
+ Signal0<void> updateCharacter; // allow update as cursor moves
//@}
private:
///
#include FORMS_H_LOCATION
#include "Dialogs.h"
-#include "FormCopyright.h"
#include "FormCitation.h"
+#include "FormCopyright.h"
#include "FormDocument.h"
+#include "FormError.h"
#include "FormGraphics.h"
#include "FormIndex.h"
#include "FormPreferences.h"
#include "FormToc.h"
#include "FormUrl.h"
+#ifdef __GNUG__
+#pragma implementation
+#endif
+
+// temporary till ported
+extern void ShowCredits();
+
Dialogs::Dialogs(LyXView * lv)
{
dialogs_.push_back(new FormCitation(lv, this));
dialogs_.push_back(new FormCopyright(lv, this));
dialogs_.push_back(new FormDocument(lv, this));
+ dialogs_.push_back(new FormError(lv, this));
dialogs_.push_back(new FormGraphics(lv, this));
dialogs_.push_back(new FormIndex(lv, this));
dialogs_.push_back(new FormPreferences(lv, this));
dialogs_.push_back(new FormToc(lv, this));
dialogs_.push_back(new FormUrl(lv, this));
+ showCredits.connect(slot(ShowCredits));
+
// reduce the number of connections needed in
// dialogs by a simple connection here.
hideAll.connect(hideBufferDependent.slot());
-I${top_srcdir}/src/frontends/ -I${top_srcdir}/src/frontends/xforms \
${SIGC_CFLAGS}
libgnome_la_OBJADD = \
+ ../xforms/FormBase.lo \
../xforms/FormCitation.lo \
../xforms/form_citation.lo \
../xforms/FormCommand.lo \
../xforms/FormDocument.lo \
../xforms/form_document.lo \
+ ../xforms/FormError.lo \
+ ../xforms/form_error.lo \
../xforms/FormGraphics.lo \
../xforms/form_graphics.lo \
../xforms/FormIndex.lo \
#include "FormCitation.h"
#include "FormCopyright.h"
#include "FormDocument.h"
+#include "FormError.h"
#include "FormGraphics.h"
#include "FormIndex.h"
#include "FormPreferences.h"
#pragma implementation
#endif
+// temporary till ported
+extern void ShowCredits();
+
Dialogs::Dialogs(LyXView * lv)
{
dialogs_.push_back(new FormCitation(lv, this));
dialogs_.push_back(new FormCopyright(lv, this));
dialogs_.push_back(new FormDocument(lv, this));
+ dialogs_.push_back(new FormError(lv, this));
dialogs_.push_back(new FormGraphics(lv, this));
dialogs_.push_back(new FormIndex(lv, this));
dialogs_.push_back(new FormPreferences(lv, this));
dialogs_.push_back(new FormToc(lv, this));
dialogs_.push_back(new FormUrl(lv, this));
+ showCredits.connect(slot(ShowCredits));
+
// reduce the number of connections needed in
// dialogs by a simple connection here.
hideAll.connect(hideBufferDependent.slot());
DISTCLEANFILES = $(BUILTSOURCES) *.orig *.rej *~ *.bak core
libkde_la_OBJADD = \
+ ../xforms/FormBase.lo \
../xforms/FormCommand.lo \
../xforms/FormDocument.lo \
../xforms/form_document.lo \
+ ../xforms/FormError.lo \
+ ../xforms/form_error.lo \
../xforms/FormGraphics.lo \
../xforms/form_graphics.lo \
../xforms/FormPreferences.lo \
#include "FormCitation.h"
#include "FormCopyright.h"
#include "FormDocument.h"
+#include "FormError.h"
#include "FormGraphics.h"
#include "FormIndex.h"
#include "FormPreferences.h"
dialogs_.push_back(new FormCitation(lv, this));
dialogs_.push_back(new FormCopyright(lv, this));
dialogs_.push_back(new FormDocument(lv, this));
+ dialogs_.push_back(new FormError(lv, this));
dialogs_.push_back(new FormGraphics(lv, this));
dialogs_.push_back(new FormIndex(lv, this));
dialogs_.push_back(new FormPreferences(lv, this));
--- /dev/null
+// -*- C++ -*-
+/* This file is part of
+ * ======================================================
+ *
+ * LyX, The Document Processor
+ *
+ * Copyright 2000 The LyX Team.
+ *
+ * ======================================================
+ */
+
+#include <config.h>
+
+#include FORMS_H_LOCATION
+
+#ifdef __GNUG__
+#pragma implementation
+#endif
+
+#include "Dialogs.h"
+#include "FormBase.h"
+#include "xform_macros.h"
+
+C_RETURNCB(FormBase, WMHideCB)
+C_GENERICCB(FormBase, ApplyCB)
+C_GENERICCB(FormBase, CancelCB)
+C_GENERICCB(FormBase, InputCB)
+C_GENERICCB(FormBase, OKCB)
+
+FormBase::FormBase(LyXView * lv, Dialogs * d, string const & t)
+ : lv_(lv), d_(d), u_(0), h_(0), title(t), dialogIsOpen(false)
+{}
+
+
+void FormBase::show()
+{
+ if (!form()) {
+ build();
+ fl_set_form_atclose(form(),
+ C_FormBaseWMHideCB, 0);
+ }
+
+ fl_freeze_form( form() );
+ update(); // make sure its up-to-date
+ fl_unfreeze_form( form() );
+
+ dialogIsOpen = true;
+ if (form()->visible) {
+ fl_raise_form(form());
+ } else {
+ fl_show_form(form(),
+ FL_PLACE_MOUSE | FL_FREE_SIZE,
+ FL_TRANSIENT,
+ title.c_str());
+ u_ = d_->updateBufferDependent.
+ connect(slot(this, &FormBase::update));
+ h_ = d_->hideBufferDependent.
+ connect(slot(this, &FormBase::hide));
+ }
+}
+
+
+void FormBase::hide()
+{
+ if (form() && form()->visible) {
+ fl_hide_form(form());
+ u_.disconnect();
+ h_.disconnect();
+ }
+
+ // free up the dialog for another inset
+ dialogIsOpen = false;
+ clearStore();
+}
+
+
+int FormBase::WMHideCB(FL_FORM * form, void *)
+{
+ // Ensure that the signals (u and h) are disconnected even if the
+ // window manager is used to close the dialog.
+ FormBase * pre = static_cast<FormBase*>(form->u_vdata);
+ pre->hide();
+ return FL_CANCEL;
+}
+
+
+void FormBase::ApplyCB(FL_OBJECT * ob, long)
+{
+ FormBase * pre = static_cast<FormBase*>(ob->form->u_vdata);
+ pre->apply();
+}
+
+
+void FormBase::CancelCB(FL_OBJECT * ob, long)
+{
+ FormBase * pre = static_cast<FormBase*>(ob->form->u_vdata);
+ pre->hide();
+}
+
+
+void FormBase::InputCB(FL_OBJECT * ob, long data )
+{
+ FormBase * pre = static_cast<FormBase*>(ob->form->u_vdata);
+ pre->input( data );
+}
+
+
+void FormBase::OKCB(FL_OBJECT * ob, long)
+{
+ FormBase * pre = static_cast<FormBase*>(ob->form->u_vdata);
+ pre->apply();
+ pre->hide();
+}
--- /dev/null
+// -*- C++ -*-
+/* This file is part of
+ * ======================================================
+ *
+ * LyX, The Document Processor
+ *
+ * Copyright 2000 The LyX Team.
+ *
+ * ======================================================
+ */
+
+#ifndef FORMBASE_H
+#define FORMBASE_H
+
+#include "DialogBase.h"
+#include "LString.h"
+#include "support/utility.hpp"
+#include FORMS_H_LOCATION
+
+class Dialogs;
+class LyXView;
+
+#ifdef __GNUG__
+#pragma interface
+#endif
+
+/** This class is an XForms GUI base class
+ */
+class FormBase : public DialogBase, public noncopyable {
+public:
+ /// Constructor
+ FormBase(LyXView *, Dialogs *, string const &);
+
+ /// Callback functions
+ static int WMHideCB(FL_FORM *, void *);
+ ///
+ static void ApplyCB(FL_OBJECT *, long);
+ ///
+ static void CancelCB(FL_OBJECT *, long);
+ ///
+ static void InputCB(FL_OBJECT *, long);
+ ///
+ static void OKCB(FL_OBJECT *, long);
+
+protected:
+ /// Create the dialog if necessary, update it and display it.
+ void show();
+ /// Hide the dialog.
+ void hide();
+
+ /// Build the dialog
+ virtual void build() = 0;
+ /// Filter the inputs on callback from xforms
+ virtual void input( long ) {}
+ /// Update dialog before showing it
+ virtual void update() {}
+ /// Apply from dialog (modify or create inset)
+ virtual void apply() {}
+ /// delete derived class variables when hide()ing
+ virtual void clearStore() {}
+ /// Pointer to the actual instantiation of xform's form
+ virtual FL_FORM * const form() const = 0;
+
+ /** 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_;
+private:
+ /// Update connection.
+ Connection u_;
+ /// Hide connection.
+ Connection h_;
+ /// dialog title, displayed by WM.
+ string title;
+
+protected:
+ /// block opening of form twice at the same time
+ bool dialogIsOpen;
+};
+
+#endif
#endif
class Dialogs;
-// same arguement as in Dialogs.h s/LyX/UI/
class LyXView;
struct FD_form_copyright;
--- /dev/null
+// -*- C++ -*-
+/* This file is part of
+ * ======================================================
+ *
+ * LyX, The Document Processor
+ *
+ * Copyright 2000 The LyX Team.
+ *
+ * ======================================================
+ */
+
+#include <config.h>
+
+#ifdef __GNUG__
+#pragma implementation
+#endif
+
+#include "Dialogs.h"
+#include "FormError.h"
+#include "form_error.h"
+
+static int minh, minw;
+
+FormError::FormError(LyXView * lv, Dialogs * d)
+ : FormBase(lv, d, _("LaTeX Error")),
+ dialog_(0), ih_(0), message_("")
+{
+ // let the dialog be shown
+ // This is a permanent connection so we won't bother
+ // storing a copy because we won't be disconnecting.
+ d->showError.connect(slot(this, &FormError::showInset));
+}
+
+
+FormError::~FormError()
+{
+ delete dialog_;
+}
+
+
+void FormError::showInset( InsetError * const inset )
+{
+ if( dialogIsOpen || inset == 0 ) return;
+
+ ih_ = inset->hide.connect(slot(this, &FormError::hide));
+
+ message_ = inset->getContents();
+ show();
+}
+
+
+void FormError::update()
+{
+ fl_set_form_minsize(form(), minw, minh);
+ fl_set_object_label(dialog_->message, message_.c_str());
+}
+
+
+void FormError::build()
+{
+ dialog_ = build_error();
+
+ // XFORMS bug workaround
+ // Define the min/max dimensions. Actually applied in update()
+ minw = form()->w; minh = form()->h;
+}
+
+
+void FormError::clearStore()
+{
+ ih_.disconnect();
+ message_.empty();
+}
+
+
+FL_FORM * const FormError::form() const
+{
+ if( dialog_ ) // no need to test for dialog_->form
+ return dialog_->form;
+ else
+ return 0;
+}
--- /dev/null
+// -*- C++ -*-
+/* This file is part of
+ * ======================================================
+ *
+ * LyX, The Document Processor
+ *
+ * Copyright 2000 The LyX Team.
+ *
+ * ======================================================
+ */
+
+#ifndef FORMERROR_H
+#define FORMERROR_H
+
+#ifdef __GNUG__
+#pragma interface
+#endif
+
+#include "FormBase.h"
+#include "insets/inseterror.h"
+
+struct FD_form_error;
+
+/** This class provides an XForms implementation of the FormError Dialog.
+ */
+class FormError : public FormBase, public noncopyable {
+public:
+ /// Constructor
+ FormError(LyXView *, Dialogs *);
+ ///
+ ~FormError();
+private:
+ /// Slot launching dialog to an existing inset
+ void showInset( InsetError * const );
+ /// Update dialog before showing it
+ void update();
+ /// Build the dialog
+ void build();
+ /// Reset data when hide() is called
+ void clearStore();
+ /// Pointer to the actual instantiation of the xform's form
+ FL_FORM * const form() const;
+ /// Fdesign generated method
+ FD_form_error * build_error();
+
+ /// Real GUI implementation.
+ FD_form_error * dialog_;
+ /// inset::hide connection.
+ Connection ih_;
+ /// the error message
+ string message_;
+};
+
+#endif
ButtonController.h \
Dialogs.C \
GUIRunTime.C \
+ FormBase.C \
+ FormBase.h \
FormCitation.C \
FormCitation.h \
form_citation.C \
FormDocument.h \
form_document.C \
form_document.h \
+ FormError.C \
+ FormError.h \
+ form_error.C \
+ form_error.h \
FormGraphics.C \
FormGraphics.h \
form_graphics.C \
--- /dev/null
+// File modified by fdfix.sh for use by lyx (with xforms >= 0.88) and gettext
+#include <config.h>
+#include "lyx_gui_misc.h"
+#include "gettext.h"
+
+/* Form definition file generated with fdesign. */
+
+#include FORMS_H_LOCATION
+#include <stdlib.h>
+#include "form_error.h"
+#include "FormError.h"
+
+FD_form_error::~FD_form_error()
+{
+ if( form->visible ) fl_hide_form( form );
+ fl_free_form( form );
+}
+
+
+FD_form_error * FormError::build_error()
+{
+ FL_OBJECT *obj;
+ FD_form_error *fdui = new FD_form_error;
+
+ fdui->form = fl_bgn_form(FL_NO_BOX, 400, 240);
+ fdui->form->u_vdata = this;
+ obj = fl_add_box(FL_UP_BOX, 0, 0, 400, 240, "");
+ fdui->message = obj = fl_add_box(FL_FRAME_BOX, 10, 10, 380, 180, "");
+ fl_set_object_gravity(obj, FL_NorthWest, FL_SouthEast);
+ obj = fl_add_button(FL_RETURN_BUTTON, 135, 200, 130, 30, _("Close"));
+ fl_set_object_gravity(obj, FL_South, FL_South);
+ fl_set_object_resize(obj, FL_RESIZE_NONE);
+ fl_set_object_callback(obj, C_FormBaseCancelCB, 0);
+ fl_end_form();
+
+ fdui->form->fdui = fdui;
+
+ return fdui;
+}
+/*---------------------------------------*/
+
--- /dev/null
+// File modified by fdfix.sh for use by lyx (with xforms >= 0.88) and gettext
+/** Header file generated with fdesign **/
+
+#ifndef FD_form_error_h_
+#define FD_form_error_h_
+
+/** Callbacks, globals and object handlers **/
+extern "C" void C_FormBaseCancelCB(FL_OBJECT *, long);
+
+
+/**** Forms and Objects ****/
+struct FD_form_error {
+ ~FD_form_error();
+
+ FL_FORM *form;
+ FL_OBJECT *message;
+};
+
+#endif /* FD_form_error_h_ */
--- /dev/null
+Magic: 13000
+
+Internal Form Definition File
+ (do not change)
+
+Number of forms: 1
+Unit of measure: FL_COORD_PIXEL
+
+=============== FORM ===============
+Name: form_error
+Width: 400
+Height: 240
+Number of Objects: 3
+
+--------------------
+class: FL_BOX
+type: UP_BOX
+box: 0 0 400 240
+boxtype: FL_UP_BOX
+colors: FL_COL1 FL_COL1
+alignment: FL_ALIGN_CENTER
+style: FL_NORMAL_STYLE
+size: FL_DEFAULT_SIZE
+lcol: FL_BLACK
+label:
+shortcut:
+resize: FL_RESIZE_ALL
+gravity: FL_NoGravity FL_NoGravity
+name:
+callback:
+argument:
+
+--------------------
+class: FL_BOX
+type: FRAME_BOX
+box: 10 10 380 180
+boxtype: FL_FRAME_BOX
+colors: FL_COL1 FL_COL1
+alignment: FL_ALIGN_CENTER
+style: FL_NORMAL_STYLE
+size: FL_DEFAULT_SIZE
+lcol: FL_BLACK
+label:
+shortcut:
+resize: FL_RESIZE_ALL
+gravity: FL_NorthWest FL_SouthEast
+name: message
+callback:
+argument:
+
+--------------------
+class: FL_BUTTON
+type: RETURN_BUTTON
+box: 135 200 130 30
+boxtype: FL_UP_BOX
+colors: FL_COL1 FL_COL1
+alignment: FL_ALIGN_CENTER
+style: FL_NORMAL_STYLE
+size: FL_DEFAULT_SIZE
+lcol: FL_BLACK
+label: Close
+shortcut: ^M
+resize: FL_RESIZE_NONE
+gravity: FL_South FL_South
+name:
+callback: C_FormBaseCancelCB
+argument: 0
+
+==============================
+create_the_forms
SRCS := form_citation.fd \
form_copyright.fd \
form_document.fd \
+ form_error.fd \
form_graphics.fd \
form_index.fd \
form_preferences.fd \
explicit
InsetCommand(InsetCommandParams const &);
///
- virtual ~InsetCommand() { hide(); };
+ virtual ~InsetCommand() { hide(); }
///
void Write(Buffer const *, std::ostream & os) const
{ p_.Write( os ); }
#pragma implementation
#endif
-#include "inseterror.h"
-#include "gettext.h"
-#include "lyx_gui_misc.h" // CancelCloseBoxCB
-#include "Painter.h"
#include "BufferView.h"
#include "font.h"
+#include "gettext.h"
+#include "inseterror.h"
+#include "LyXView.h"
+#include "Painter.h"
+#include "frontends/Dialogs.h"
using std::ostream;
/* Error, used for the LaTeX-Error Messages */
-#if 0
-InsetError::InsetError()
-{
- form = 0;
-}
-#endif
-
-
InsetError::InsetError(string const & str)
- : contents(str), form(0)
+ : contents(str)
{}
-InsetError::~InsetError()
-{
- if (form) {
- fl_hide_form(form);
- fl_free_form(form);
- form = 0;
- }
-}
-
-
int InsetError::ascent(BufferView *, LyXFont const & font) const
{
LyXFont efont;
}
-void InsetError::Write(Buffer const *, ostream &) const
-{
-}
-
-
-void InsetError::Read(Buffer const *, LyXLex &)
-{
-}
-
-
-int InsetError::Latex(Buffer const *, ostream &,
- bool /*fragile*/, bool /*fs*/) const
-{
- return 0;
-}
-
-
-int InsetError::Ascii(Buffer const *, ostream &) const
-{
- return 0;
-}
-
-
-int InsetError::Linuxdoc(Buffer const *, ostream &) const
-{
- return 0;
-}
-
-
-int InsetError::DocBook(Buffer const *, ostream &) const
-{
- return 0;
-}
-
-
-bool InsetError::AutoDelete() const
-{
- return true;
-}
-
-
-Inset::EDITABLE InsetError::Editable() const
-{
- return IS_EDITABLE;
-}
-
-
-void InsetError::CloseErrorCB(FL_OBJECT * ob, long)
-{
- InsetError * inset = static_cast<InsetError*>(ob->u_vdata);
- if (inset->form) {
- fl_hide_form(inset->form);
- fl_free_form(inset->form);
- inset->form = 0;
- }
-}
-
-
-// A C wrapper
-extern "C"
-void C_InsetError_CloseErrorCB(FL_OBJECT * ob, long data)
-{
- InsetError::CloseErrorCB(ob , data);
-}
-
-
string const InsetError::EditMessage() const
{
return _("Opened error");
}
-void InsetError::Edit(BufferView *, int, int, unsigned int)
-{
- static int ow = 400, oh = 240;
-
- if (!form) {
- FL_OBJECT * obj;
- form = fl_bgn_form(FL_UP_BOX, ow, oh);
- strobj = fl_add_box(FL_FRAME_BOX, 10, 10, 380, 180, "");
- fl_set_object_color(strobj, FL_MCOL, FL_MCOL);
- fl_set_object_gravity(strobj, FL_NorthWest, FL_SouthEast);
- obj = fl_add_button(FL_RETURN_BUTTON, 140, 200, 120, 30,
- _("Close"));
- fl_set_object_callback(obj, C_InsetError_CloseErrorCB, 0);
- obj->u_vdata = this;
- fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast);
- fl_set_object_resize(obj, FL_RESIZE_NONE);
- fl_end_form();
- fl_set_form_atclose(form, CancelCloseBoxCB, 0);
- }
- fl_set_object_label(strobj, contents.c_str());
- if (form->visible) {
- fl_raise_form(form);
- } else {
- fl_show_form(form, FL_PLACE_MOUSE | FL_FREE_SIZE,
- FL_FULLBORDER, _("LaTeX Error"));
- fl_set_form_minsize(form, ow, oh);
- }
-}
-
-
-Inset * InsetError::Clone() const
+void InsetError::Edit(BufferView * bv, int, int, unsigned int)
{
- return new InsetError(contents);
+ bv->owner()->getDialogs()->showError( this );
}
#pragma interface
#endif
-#include FORMS_H_LOCATION
#include "lyxinset.h"
#include "LString.h"
-#include "gettext.h"
+#include <sigc++/signal_system.h>
+
+#ifdef SIGC_CXX_NAMESPACES
+using SigC::Signal0;
+#endif
/** Used for error messages from LaTeX runs.
public:
///
explicit
- InsetError(string const & string);
-#if 0
- ///
- InsetError();
-#endif
+ InsetError(string const &);
///
- ~InsetError();
+ ~InsetError() { hide(); }
///
- int ascent(BufferView *, LyXFont const & font) const;
+ int ascent(BufferView *, LyXFont const &) const;
///
- int descent(BufferView *, LyXFont const & font) const;
+ int descent(BufferView *, LyXFont const &) const;
///
- int width(BufferView *, LyXFont const & font) const;
+ int width(BufferView *, LyXFont const &) const;
///
void draw(BufferView *, LyXFont const &, int, float &, bool) const;
///
- void Write(Buffer const *, std::ostream &) const;
+ void Write(Buffer const *, std::ostream &) const {}
///
- void Read(Buffer const *, LyXLex & lex);
+ void Read(Buffer const *, LyXLex &) {}
///
- int Latex(Buffer const *, std::ostream &,
- bool fragile, bool free_spc) const;
+ int Latex(Buffer const *, std::ostream &, bool, bool) const { return 0; }
///
- int Ascii(Buffer const *, std::ostream &) const;
+ int Ascii(Buffer const *, std::ostream &) const { return 0; }
///
- int Linuxdoc(Buffer const *, std::ostream &) const;
+ int Linuxdoc(Buffer const *, std::ostream &) const { return 0; }
///
- int DocBook(Buffer const *, std::ostream &) const;
+ int DocBook(Buffer const *, std::ostream &) const { return 0; }
///
- bool AutoDelete() const;
+ bool AutoDelete() const { return true; }
/// what appears in the minibuffer when opening
string const EditMessage() const;
///
- void Edit(BufferView *, int x, int y, unsigned int button);
+ void Edit(BufferView *, int, int, unsigned int);
///
- EDITABLE Editable() const;
+ EDITABLE Editable() const { return IS_EDITABLE; }
///
- Inset * Clone() const;
+ Inset * Clone() const { return new InsetError(contents); }
///
Inset::Code LyxCode() const { return Inset::NO_CODE; }
/// We don't want "begin" and "end inset" in lyx-file
bool DirectWrite() const { return true; };
///
- static void CloseErrorCB(FL_OBJECT *, long data);
+ string const & getContents() const { return contents; }
+ ///
+ Signal0<void> hide;
private:
///
string contents;
- ///
- FL_FORM * form;
- ///
- FL_OBJECT * strobj;
};
#endif
Languages languages;
Language const * default_language;
-Language ignore_lang("ignore", "Ignore", false, 0);
+Language ignore_lang("ignore", "Ignore", false, 0, "ignore");
Language const * ignore_language = &ignore_lang;
///
char const * display;
bool rtl;
Encoding const * encoding;
+ char const * code;
};
// Same method is used in LyXAction.C (Lgb)
lang_item items[] = {
- { "afrikaans", N_("Afrikaans"), false, &iso8859_1 },
- { "american", N_("American"), false, &iso8859_1 },
- { "arabic", N_("Arabic"), true, &iso8859_6 },
- { "austrian", N_("Austrian"), false, &iso8859_1 },
- { "bahasa", N_("Bahasa"), false, &iso8859_1 },
- { "brazil", N_("Brazil"), false, &iso8859_1 },
- { "breton", N_("Breton"), false, &iso8859_1 },
- { "catalan", N_("Catalan"), false, &iso8859_1 },
- { "croatian", N_("Croatian"), false, &iso8859_2 },
- { "czech", N_("Czech"), false, &iso8859_2 },
- { "danish", N_("Danish"), false, &iso8859_1 },
- { "default", N_("Document wide language"), false, &iso8859_1 },
- { "dutch", N_("Dutch"), false, &iso8859_1 },
- { "english", N_("English"), false, &iso8859_1 },
- { "esperanto", N_("Esperanto"), false, &iso8859_3 },
- { "estonian", N_("Estonian"), false, &iso8859_4 },
- { "finnish", N_("Finnish"), false, &iso8859_1 },
- { "frenchb", N_("French"), false, &iso8859_1 },
- { "french", N_("French (GUTenberg)"), false, &iso8859_1 },
- { "galician", N_("Galician"), false, &iso8859_1 },
- { "german", N_("German"), false, &iso8859_1 },
- { "greek", N_("Greek"), false, &iso8859_7 },
- { "hebrew", N_("Hebrew"), true, &cp1255 },
+ { "afrikaans", N_("Afrikaans"), false, &iso8859_1, "" },
+ { "american", N_("American"), false, &iso8859_1, "en_US" },
+ { "arabic", N_("Arabic"), true, &iso8859_6, "" },
+ { "austrian", N_("Austrian"), false, &iso8859_1, "de_AU" },
+ { "bahasa", N_("Bahasa"), false, &iso8859_1, "" },
+ { "brazil", N_("Brazil"), false, &iso8859_1, "" },
+ { "breton", N_("Breton"), false, &iso8859_1, "" },
+ { "catalan", N_("Catalan"), false, &iso8859_1, "" },
+ { "croatian", N_("Croatian"), false, &iso8859_2, "" },
+ { "czech", N_("Czech"), false, &iso8859_2, "" },
+ { "danish", N_("Danish"), false, &iso8859_1, "" },
+ { "default", N_("Document wide language"), false, &iso8859_1, "" },
+ { "dutch", N_("Dutch"), false, &iso8859_1, "" },
+ { "english", N_("English"), false, &iso8859_1, "en_EN" },
+ { "esperanto", N_("Esperanto"), false, &iso8859_3, "" },
+ { "estonian", N_("Estonian"), false, &iso8859_4, "" },
+ { "finnish", N_("Finnish"), false, &iso8859_1, "" },
+ { "frenchb", N_("French"), false, &iso8859_1, "fr_FR" },
+ { "french", N_("French (GUTenberg)"), false, &iso8859_1, "fr_FR" },
+ { "galician", N_("Galician"), false, &iso8859_1, "" },
+ { "german", N_("German"), false, &iso8859_1, "de_DE" },
+ { "greek", N_("Greek"), false, &iso8859_7, "" },
+ { "hebrew", N_("Hebrew"), true, &cp1255, "" },
/* According to Zrubecz Laszlo <zrubi@k2.jozsef.kando.hu>,
"magyar" is better. I kept it here in case we want
to provide aliasing of languages. (JMarc)
*/
- //{ "hungarian", N_("Hungarian"), false, &iso8859_2 },
- { "irish", N_("Irish"), false, &iso8859_1 },
- { "italian", N_("Italian"), false, &iso8859_1 },
- { "lsorbian", N_("Lsorbian"), false, &iso8859_2 },
- { "magyar", N_("Magyar"), false, &iso8859_2 },
- { "norsk", N_("Norsk"), false, &iso8859_1 },
- { "polish", N_("Polish"), false, &iso8859_2 },
- { "portuges", N_("Portuges"), false, &iso8859_1 },
- { "romanian", N_("Romanian"), false, &iso8859_2 },
- { "russian", N_("Russian"), false, &koi8 },
- { "scottish", N_("Scottish"), false, &iso8859_1 },
- { "spanish", N_("Spanish"), false, &iso8859_1 },
- { "slovak", N_("Slovak"), false, &iso8859_2 },
- { "slovene", N_("Slovene"), false, &iso8859_2 },
- { "swedish", N_("Swedish"), false, &iso8859_1 },
- { "turkish", N_("Turkish"), false, &iso8859_9 },
- { "usorbian", N_("Usorbian"), false, &iso8859_2 },
- { "welsh", N_("Welsh"), false, &iso8859_1 },
- { 0, 0, false, 0 }
+ //{ "hungarian", N_("Hungarian"), false, &iso8859_2, "" },
+ { "irish", N_("Irish"), false, &iso8859_1, "" },
+ { "italian", N_("Italian"), false, &iso8859_1, "it_IT" },
+ { "lsorbian", N_("Lsorbian"), false, &iso8859_2, "" },
+ { "magyar", N_("Magyar"), false, &iso8859_2, "" },
+ { "norsk", N_("Norsk"), false, &iso8859_1, "" },
+ { "polish", N_("Polish"), false, &iso8859_2, "" },
+ { "portuges", N_("Portuges"), false, &iso8859_1, "pt_PT" },
+ { "romanian", N_("Romanian"), false, &iso8859_2, "" },
+ { "russian", N_("Russian"), false, &koi8, "" },
+ { "scottish", N_("Scottish"), false, &iso8859_1, "" },
+ { "spanish", N_("Spanish"), false, &iso8859_1, "es_ES" },
+ { "slovak", N_("Slovak"), false, &iso8859_2, "" },
+ { "slovene", N_("Slovene"), false, &iso8859_2, "" },
+ { "swedish", N_("Swedish"), false, &iso8859_1, "" },
+ { "turkish", N_("Turkish"), false, &iso8859_9, "" },
+ { "usorbian", N_("Usorbian"), false, &iso8859_2, "" },
+ { "welsh", N_("Welsh"), false, &iso8859_1, "" },
+ { 0, 0, false, 0, 0 }
};
int i = 0;
while (items[i].lang) {
languages[items[i].lang] =
Language(items[i].lang, items[i].display,
- items[i].rtl, items[i].encoding);
+ items[i].rtl, items[i].encoding,
+ items[i].code);
++i;
}
Language() : RightToLeft_(false) {}
///
Language(string const & l, string const & d,
- bool rtl, Encoding const * e)
- : lang_(l), display_(d), RightToLeft_(rtl) , encoding_(e) {}
+ bool rtl, Encoding const * e, string const & c)
+ : lang_(l), display_(d), RightToLeft_(rtl) , encoding_(e),
+ code_(c)
+ {}
///
string const & lang() const {
return lang_;
Encoding const * encoding() const {
return encoding_;
}
+ ///
+ string const & code() const {
+ return code_;
+ }
private:
///
string lang_;
bool RightToLeft_;
///
Encoding const * encoding_;
+ ///
+ string code_;
};
#if 0
void MathedCursor::MacroModeOpen()
{
if (!macro_mode) {
- macroln = 0;
- macrobf[0] = '\0';
- imacro = new MathFuncInset(¯obf[0]);
+ imacro = new MathFuncInset("");
Insert (imacro);
macro_mode = true;
} else
{
if (macro_mode) {
macro_mode = false;
- latexkeys * l = in_word_set(macrobf, macroln);
- if (macroln > 0 && (!l || (l && IsMacro(l->token, l->id))) &&
- !MathMacroTable::mathMTable.getMacro(macrobf)) {
+ latexkeys * l = in_word_set(imacro->GetName());
+ if (!imacro->GetName().empty()
+ && (!l || (l && IsMacro(l->token, l->id))) &&
+ !MathMacroTable::mathMTable.getMacro(imacro->GetName())) {
if (!l) {
- imacro->SetName(macrobf);
+ //imacro->SetName(macrobf);
// This guarantees that the string will be removed by destructor
imacro->SetType(LM_OT_UNDEF);
} else
imacro->SetName(l->name);
} else {
Left();
- imacro->SetName("");
if (cursor->GetInset()->GetType() == LM_OT_ACCENT) {
setAccent(static_cast<MathAccentInset*>(cursor->GetInset())->getAccentCode());
}
cursor->Delete();
- if (l || MathMacroTable::mathMTable.getMacro(macrobf)) {
- Interpret(macrobf);
+ if (l || MathMacroTable::mathMTable.getMacro(imacro->GetName())) {
+ Interpret(imacro->GetName());
}
+ imacro->SetName("");
}
imacro = 0;
}
void MathedCursor::MacroModeBack()
{
if (macro_mode) {
- if (macroln>0) {
- macrobf[--macroln] = '\0';
+ if (!imacro->GetName().empty()) {
+ imacro->SetName(imacro->GetName().substr(0, imacro->GetName().length() - 1));
imacro->Metrics();
} else
MacroModeClose();
void MathedCursor::MacroModeInsert(char c)
{
if (macro_mode) {
- macrobf[macroln + 1] = macrobf[macroln];
- macrobf[macroln++] = c;
+ imacro->SetName(imacro->GetName() + c);
imacro->Metrics();
} else
lyxerr << "Mathed Warning: we are not in macro mode" << endl;
MathedTextCodes lastcode;
private:
- ///
- char macrobf[80];
- ///
- int macroln;
- ///
+ ///
MathFuncInset * imacro;
};
#include "lyx_gui_misc.h"
#include "debug.h"
#include "support/lstrings.h"
+#include "language.h"
#include "encoding.h"
+#include "support/lstrings.h"
//#define USE_PSPELL 1
PspellCanHaveError * spell_error_object;
static
-void init_spell_checker(BufferParams const &, string const & /* lang */)
+void init_spell_checker(BufferParams const &, string const & lang)
{
PspellConfig * config = new_pspell_config();
+ string code;
+ (void)split(lang, code, '_');
+ config->replace("language-tag", code.c_str());
spell_error_object = new_pspell_manager(config);
if (pspell_error_number(spell_error_object) != 0) {
spell_error = pspell_error_message(spell_error_object);
}
-// Perform an ispell session
+// Perform a spell session
static
bool RunSpellChecker(BufferView * bv)
{
int newvalue;
FL_OBJECT * obj;
- string tmp = (lyxrc.isp_use_alt_lang) ? lyxrc.isp_alt_lang : bv->buffer()->GetLanguage();
- bool rtl = tmp == "hebrew" || tmp == "arabic";
+#ifdef USE_PSPELL
+ string tmp = (lyxrc.isp_use_alt_lang) ?
+ lyxrc.isp_alt_lang : bv->buffer()->params.language_info->code();
+#else
+ string tmp = (lyxrc.isp_use_alt_lang) ?
+ lyxrc.isp_alt_lang : bv->buffer()->GetLanguage();
+#endif
+#warning This is not good we should find a way to identify a rtl-language in a more general way. Please have a look Dekel! (Jug)
+// For now I'll change this to a bit more general solution but
+// Please comment on this if you don't like it. We probaly need
+// anoter flag something like lyxrc.isp_use_alt_lang_rtl (true/false)!
+ bool rtl;
+ if (lyxrc.isp_use_alt_lang)
+ rtl = (tmp == "hebrew" || tmp == "arabic");
+ else
+ rtl = bv->buffer()->params.language_info->RightToLeft();
int oldval = 0; /* used for updating slider only when needed */
float newval = 0.0;
int LyXTabular::Latex(Buffer const * buf,
ostream & os, bool fragile, bool fp) const
{
-#warning Jürgen, this func should be split into more funcs (Lgb)
int ret = 0;
int i,j;
int cell = 0;