mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-24 13:48:59 +00:00
Marcos GNOME patch + Kevin's spellchecker patch
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1003 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
66088f1487
commit
260ae2415d
23
ChangeLog
23
ChangeLog
@ -1,3 +1,26 @@
|
|||||||
|
2000-09-05 Juergen Vigna <jug@sad.it>
|
||||||
|
|
||||||
|
* config/pspell.m4: added entry to lyx-flags
|
||||||
|
|
||||||
|
* src/spellchecker.C: modified version from Kevin for using pspell
|
||||||
|
|
||||||
|
2000-09-01 Marko Vendelin <markov@ioc.ee>
|
||||||
|
* src/frontends/gnome/Makefile.am
|
||||||
|
* src/frontends/gnome/FormCitation.C
|
||||||
|
* src/frontends/gnome/FormCitation.h
|
||||||
|
* src/frontends/gnome/diainsertcitation_callbacks.c
|
||||||
|
* src/frontends/gnome/diainsertcitation_callbacks.h
|
||||||
|
* src/frontends/gnome/diainsertcitation_interface.c
|
||||||
|
* src/frontends/gnome/diainsertcitation_interface.h
|
||||||
|
* src/frontends/gnome/dialogs/diainsertcitation.glade: Insert Citation
|
||||||
|
dialog for Gnome frontend
|
||||||
|
|
||||||
|
* src/main.C: Gnome libraries require keeping application name
|
||||||
|
and its version as strings
|
||||||
|
|
||||||
|
* src/frontends/gnome/mainapp.C: Change the name of the main window
|
||||||
|
from GnomeLyX to PACKAGE
|
||||||
|
|
||||||
2000-09-05 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
|
2000-09-05 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
|
||||||
|
|
||||||
* src/frontends/Liason.C: add "using: declaration.
|
* src/frontends/Liason.C: add "using: declaration.
|
||||||
|
@ -49,6 +49,7 @@ AC_DEFUN(CHECK_WITH_PSPELL,
|
|||||||
USE_PSPELL="yes ($pspell_use_include $pspell_use_lib)"
|
USE_PSPELL="yes ($pspell_use_include $pspell_use_lib)"
|
||||||
AC_SUBST(PSPELL_INCLUDES)
|
AC_SUBST(PSPELL_INCLUDES)
|
||||||
AC_SUBST(PSPELL_LIBS)
|
AC_SUBST(PSPELL_LIBS)
|
||||||
|
lyx_flags="$lyx_flags use-pspell"
|
||||||
fi
|
fi
|
||||||
AC_MSG_RESULT($USE_PSPELL)
|
AC_MSG_RESULT($USE_PSPELL)
|
||||||
])
|
])
|
||||||
|
@ -28,6 +28,7 @@ src/ext_l10n.h
|
|||||||
src/filedlg.C
|
src/filedlg.C
|
||||||
src/FontLoader.C
|
src/FontLoader.C
|
||||||
src/form1.C
|
src/form1.C
|
||||||
|
src/frontends/gnome/FormCitation.C
|
||||||
src/frontends/gnome/FormPrint.C
|
src/frontends/gnome/FormPrint.C
|
||||||
src/frontends/gnome/FormToc.C
|
src/frontends/gnome/FormToc.C
|
||||||
src/frontends/kde/FormCopyright.C
|
src/frontends/kde/FormCopyright.C
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
_("File|F");
|
_("File|F");
|
||||||
_("Edit|E");
|
_("Edit|E");
|
||||||
|
_("Toc|T");
|
||||||
|
_("Refs|R");
|
||||||
_("Layout|L");
|
_("Layout|L");
|
||||||
_("Insert|I");
|
_("Insert|I");
|
||||||
_("Math|M");
|
_("Math|M");
|
||||||
@ -84,6 +86,7 @@ _("Check Out for Edit|O");
|
|||||||
_("Revert to last version|l");
|
_("Revert to last version|l");
|
||||||
_("Undo last check in|U");
|
_("Undo last check in|U");
|
||||||
_("Show History|H");
|
_("Show History|H");
|
||||||
|
_("Go Back|B");
|
||||||
_("Character...|C");
|
_("Character...|C");
|
||||||
_("Paragraph...|P");
|
_("Paragraph...|P");
|
||||||
_("Document...|D");
|
_("Document...|D");
|
||||||
@ -167,17 +170,18 @@ _("Credits...|e");
|
|||||||
_("Version...|V");
|
_("Version...|V");
|
||||||
_("");
|
_("");
|
||||||
_("A&A");
|
_("A&A");
|
||||||
|
_("ACT");
|
||||||
|
_("AT_RISE:");
|
||||||
_("Abstract");
|
_("Abstract");
|
||||||
_("Accepted");
|
_("Accepted");
|
||||||
_("Acknowledgement");
|
_("Acknowledgement");
|
||||||
|
_("Acknowledgement(s)");
|
||||||
_("Acknowledgement*");
|
_("Acknowledgement*");
|
||||||
_("Acknowledgement-numbered");
|
_("Acknowledgement-numbered");
|
||||||
_("Acknowledgement(s)");
|
|
||||||
_("Acknowledgements");
|
|
||||||
_("Acknowledgement-unnumbered");
|
_("Acknowledgement-unnumbered");
|
||||||
|
_("Acknowledgements");
|
||||||
_("Acknowledgments");
|
_("Acknowledgments");
|
||||||
_("Acnowledgement");
|
_("Acnowledgement");
|
||||||
_("ACT");
|
|
||||||
_("Addchap");
|
_("Addchap");
|
||||||
_("Addchap*");
|
_("Addchap*");
|
||||||
_("Addition");
|
_("Addition");
|
||||||
@ -195,15 +199,15 @@ _("Anlagen");
|
|||||||
_("Anrede");
|
_("Anrede");
|
||||||
_("Appendices");
|
_("Appendices");
|
||||||
_("Appendix");
|
_("Appendix");
|
||||||
_("AT_RISE:");
|
|
||||||
_("Author");
|
_("Author");
|
||||||
|
_("AuthorRunning");
|
||||||
_("Author_Email");
|
_("Author_Email");
|
||||||
_("Author_Running");
|
_("Author_Running");
|
||||||
_("AuthorRunning");
|
|
||||||
_("Author_URL");
|
_("Author_URL");
|
||||||
_("Axiom");
|
_("Axiom");
|
||||||
_("Axiom-numbered");
|
_("Axiom-numbered");
|
||||||
_("Axiom-plain");
|
_("Axiom-plain");
|
||||||
|
_("BLZ");
|
||||||
_("Backaddress");
|
_("Backaddress");
|
||||||
_("Bank");
|
_("Bank");
|
||||||
_("BankAccount");
|
_("BankAccount");
|
||||||
@ -211,13 +215,12 @@ _("BankCode");
|
|||||||
_("Betreff");
|
_("Betreff");
|
||||||
_("Bibliography");
|
_("Bibliography");
|
||||||
_("Biography");
|
_("Biography");
|
||||||
_("BLZ");
|
|
||||||
_("Brieftext");
|
_("Brieftext");
|
||||||
|
_("CC");
|
||||||
|
_("CURTAIN");
|
||||||
_("Caption");
|
_("Caption");
|
||||||
_("Case");
|
_("Case");
|
||||||
_("Case-numbered");
|
_("Case-numbered");
|
||||||
_("CC");
|
|
||||||
_("cc");
|
|
||||||
_("CenteredCaption");
|
_("CenteredCaption");
|
||||||
_("Chapter");
|
_("Chapter");
|
||||||
_("Chapter*");
|
_("Chapter*");
|
||||||
@ -257,7 +260,6 @@ _("Criterion-plain");
|
|||||||
_("CrossList");
|
_("CrossList");
|
||||||
_("Current");
|
_("Current");
|
||||||
_("Current_Address");
|
_("Current_Address");
|
||||||
_("CURTAIN");
|
|
||||||
_("Customer");
|
_("Customer");
|
||||||
_("Data");
|
_("Data");
|
||||||
_("Date");
|
_("Date");
|
||||||
@ -272,10 +274,10 @@ _("Definition-unnumbered");
|
|||||||
_("Description");
|
_("Description");
|
||||||
_("Dialogue");
|
_("Dialogue");
|
||||||
_("EMail");
|
_("EMail");
|
||||||
|
_("EXT.");
|
||||||
_("Email");
|
_("Email");
|
||||||
_("Encl");
|
_("Encl");
|
||||||
_("Encl.");
|
_("Encl.");
|
||||||
_("encl");
|
|
||||||
_("End_All_Slides");
|
_("End_All_Slides");
|
||||||
_("Enumerate");
|
_("Enumerate");
|
||||||
_("Example");
|
_("Example");
|
||||||
@ -286,48 +288,43 @@ _("Example-unnumbered");
|
|||||||
_("Exercise");
|
_("Exercise");
|
||||||
_("Exercise-numbered");
|
_("Exercise-numbered");
|
||||||
_("Exercise-plain");
|
_("Exercise-plain");
|
||||||
_("EXT.");
|
|
||||||
_("Extratitle");
|
_("Extratitle");
|
||||||
|
_("FADE_IN:");
|
||||||
|
_("FADE_OUT:");
|
||||||
_("Fact");
|
_("Fact");
|
||||||
_("Fact*");
|
_("Fact*");
|
||||||
_("Fact-numbered");
|
_("Fact-numbered");
|
||||||
_("Fact-plain");
|
_("Fact-plain");
|
||||||
_("Fact-unnumbered");
|
_("Fact-unnumbered");
|
||||||
_("FADE_IN:");
|
|
||||||
_("FADE_OUT:");
|
|
||||||
_("FigCaption");
|
_("FigCaption");
|
||||||
_("first");
|
|
||||||
_("FirstAuthor");
|
_("FirstAuthor");
|
||||||
_("FirstName");
|
_("FirstName");
|
||||||
_("FitBitmap");
|
_("FitBitmap");
|
||||||
_("FitFigure");
|
_("FitFigure");
|
||||||
_("Foilhead");
|
_("Foilhead");
|
||||||
_("foilhead");
|
|
||||||
_("Footernote");
|
_("Footernote");
|
||||||
_("FourAffiliations");
|
_("FourAffiliations");
|
||||||
_("FourAuthors");
|
_("FourAuthors");
|
||||||
_("Gruss");
|
_("Gruss");
|
||||||
_("Headnote");
|
|
||||||
_("HTTP");
|
_("HTTP");
|
||||||
|
_("Headnote");
|
||||||
|
_("INT.");
|
||||||
_("Idea");
|
_("Idea");
|
||||||
_("IhrSchreiben");
|
_("IhrSchreiben");
|
||||||
_("IhrZeichen");
|
_("IhrZeichen");
|
||||||
_("Institute");
|
_("Institute");
|
||||||
_("Institution");
|
_("Institution");
|
||||||
_("INT.");
|
|
||||||
_("InvisibleText");
|
_("InvisibleText");
|
||||||
_("Invoice");
|
_("Invoice");
|
||||||
_("Itemize");
|
_("Itemize");
|
||||||
_("Journal");
|
_("Journal");
|
||||||
_("journal");
|
|
||||||
_("Keywords");
|
_("Keywords");
|
||||||
_("Konto");
|
_("Konto");
|
||||||
_("Labeling");
|
|
||||||
_("Land");
|
|
||||||
_("landscape");
|
|
||||||
_("LandscapeSlide");
|
|
||||||
_("LaTeX");
|
_("LaTeX");
|
||||||
_("LaTeX_Title");
|
_("LaTeX_Title");
|
||||||
|
_("Labeling");
|
||||||
|
_("Land");
|
||||||
|
_("LandscapeSlide");
|
||||||
_("Lemma");
|
_("Lemma");
|
||||||
_("Lemma*");
|
_("Lemma*");
|
||||||
_("Lemma-numbered");
|
_("Lemma-numbered");
|
||||||
@ -346,10 +343,8 @@ _("MarkBoth");
|
|||||||
_("MathLetters");
|
_("MathLetters");
|
||||||
_("MeinZeichen");
|
_("MeinZeichen");
|
||||||
_("Minisec");
|
_("Minisec");
|
||||||
_("modying");
|
|
||||||
_("msnumber");
|
|
||||||
_("My_Address");
|
|
||||||
_("MyRef");
|
_("MyRef");
|
||||||
|
_("My_Address");
|
||||||
_("Myref");
|
_("Myref");
|
||||||
_("Name");
|
_("Name");
|
||||||
_("Narrative");
|
_("Narrative");
|
||||||
@ -359,18 +354,18 @@ _("Note");
|
|||||||
_("Note*");
|
_("Note*");
|
||||||
_("Note-numbered");
|
_("Note-numbered");
|
||||||
_("Note-plain");
|
_("Note-plain");
|
||||||
|
_("Note-unnumbered");
|
||||||
_("NoteToEditor");
|
_("NoteToEditor");
|
||||||
_("Notetoeditor");
|
_("Notetoeditor");
|
||||||
_("Note-unnumbered");
|
|
||||||
_("Offprint");
|
_("Offprint");
|
||||||
_("Offprints");
|
_("Offprints");
|
||||||
_("Offsets");
|
_("Offsets");
|
||||||
_("offsets");
|
|
||||||
_("Oggetto");
|
_("Oggetto");
|
||||||
_("Opening");
|
_("Opening");
|
||||||
_("Ort");
|
_("Ort");
|
||||||
_("Overlay");
|
_("Overlay");
|
||||||
_("PACS");
|
_("PACS");
|
||||||
|
_("PS");
|
||||||
_("Paragraph");
|
_("Paragraph");
|
||||||
_("Paragraph*");
|
_("Paragraph*");
|
||||||
_("Paragraph-numbered");
|
_("Paragraph-numbered");
|
||||||
@ -381,8 +376,8 @@ _("Petit");
|
|||||||
_("Phone");
|
_("Phone");
|
||||||
_("Place");
|
_("Place");
|
||||||
_("PlaceFigure");
|
_("PlaceFigure");
|
||||||
_("Placefigure");
|
|
||||||
_("PlaceTable");
|
_("PlaceTable");
|
||||||
|
_("Placefigure");
|
||||||
_("Placetable");
|
_("Placetable");
|
||||||
_("PortraitSlide");
|
_("PortraitSlide");
|
||||||
_("PostalCommend");
|
_("PostalCommend");
|
||||||
@ -399,12 +394,11 @@ _("Proposition*");
|
|||||||
_("Proposition-numbered");
|
_("Proposition-numbered");
|
||||||
_("Proposition-plain");
|
_("Proposition-plain");
|
||||||
_("Proposition-unnumbered");
|
_("Proposition-unnumbered");
|
||||||
_("PS");
|
|
||||||
_("ps");
|
|
||||||
_("Publishers");
|
_("Publishers");
|
||||||
_("Question");
|
_("Question");
|
||||||
_("Quotation");
|
_("Quotation");
|
||||||
_("Quote");
|
_("Quote");
|
||||||
|
_("REVTEX_Title");
|
||||||
_("Received");
|
_("Received");
|
||||||
_("Recieved");
|
_("Recieved");
|
||||||
_("Recieved/Accepted");
|
_("Recieved/Accepted");
|
||||||
@ -414,17 +408,17 @@ _("Remark");
|
|||||||
_("Remark*");
|
_("Remark*");
|
||||||
_("Remark-numbered");
|
_("Remark-numbered");
|
||||||
_("Remark-plain");
|
_("Remark-plain");
|
||||||
_("Remarks");
|
|
||||||
_("Remark-unnumbered");
|
_("Remark-unnumbered");
|
||||||
|
_("Remarks");
|
||||||
_("RetourAdresse");
|
_("RetourAdresse");
|
||||||
_("ReturnAddress");
|
_("ReturnAddress");
|
||||||
_("REVTEX_Title");
|
|
||||||
_("Right_Address");
|
|
||||||
_("RightHeader");
|
_("RightHeader");
|
||||||
|
_("Right_Address");
|
||||||
_("Rotatefoilhead");
|
_("Rotatefoilhead");
|
||||||
_("Running_LaTeX_Title");
|
_("Running_LaTeX_Title");
|
||||||
_("SCENE");
|
_("SCENE");
|
||||||
_("SCENE*");
|
_("SCENE*");
|
||||||
|
_("SGML");
|
||||||
_("Scrap");
|
_("Scrap");
|
||||||
_("Section");
|
_("Section");
|
||||||
_("Section*");
|
_("Section*");
|
||||||
@ -432,11 +426,10 @@ _("Section-numbered");
|
|||||||
_("Send");
|
_("Send");
|
||||||
_("Send_To_Address");
|
_("Send_To_Address");
|
||||||
_("Seriate");
|
_("Seriate");
|
||||||
_("SGML");
|
|
||||||
_("ShortFoilhead");
|
_("ShortFoilhead");
|
||||||
_("Shortfoilhead");
|
|
||||||
_("ShortRotatefoilhead");
|
_("ShortRotatefoilhead");
|
||||||
_("ShortTitle");
|
_("ShortTitle");
|
||||||
|
_("Shortfoilhead");
|
||||||
_("Signature");
|
_("Signature");
|
||||||
_("Slide");
|
_("Slide");
|
||||||
_("Slide*");
|
_("Slide*");
|
||||||
@ -452,26 +445,26 @@ _("State");
|
|||||||
_("Strasse");
|
_("Strasse");
|
||||||
_("Street");
|
_("Street");
|
||||||
_("Style");
|
_("Style");
|
||||||
_("style");
|
_("SubSection");
|
||||||
|
_("SubTitle");
|
||||||
_("Subitle");
|
_("Subitle");
|
||||||
_("Subject");
|
_("Subject");
|
||||||
_("Subjectclass");
|
_("Subjectclass");
|
||||||
_("Subparagraph");
|
_("Subparagraph");
|
||||||
_("Subparagraph*");
|
_("Subparagraph*");
|
||||||
_("SubSection");
|
|
||||||
_("Subsection");
|
_("Subsection");
|
||||||
_("Subsection*");
|
_("Subsection*");
|
||||||
_("Subsection-numbered");
|
_("Subsection-numbered");
|
||||||
_("Subsubsection");
|
_("Subsubsection");
|
||||||
_("Subsubsection*");
|
_("Subsubsection*");
|
||||||
_("Subsubsection-numbered");
|
_("Subsubsection-numbered");
|
||||||
_("SubTitle");
|
|
||||||
_("Subtitle");
|
_("Subtitle");
|
||||||
_("Suggested");
|
_("Suggested");
|
||||||
_("Summary");
|
_("Summary");
|
||||||
_("Summary-numbered");
|
_("Summary-numbered");
|
||||||
_("Surname");
|
_("Surname");
|
||||||
_("surname");
|
_("TOC_Author");
|
||||||
|
_("TOC_Title");
|
||||||
_("TableComments");
|
_("TableComments");
|
||||||
_("TableRefs");
|
_("TableRefs");
|
||||||
_("Telefax");
|
_("Telefax");
|
||||||
@ -483,8 +476,8 @@ _("Theorem");
|
|||||||
_("Theorem*");
|
_("Theorem*");
|
||||||
_("Theorem-numbered");
|
_("Theorem-numbered");
|
||||||
_("Theorem-plain");
|
_("Theorem-plain");
|
||||||
_("TheoremTemplate");
|
|
||||||
_("Theorem-unnumbered");
|
_("Theorem-unnumbered");
|
||||||
|
_("TheoremTemplate");
|
||||||
_("Thesaurus");
|
_("Thesaurus");
|
||||||
_("ThickLine");
|
_("ThickLine");
|
||||||
_("This");
|
_("This");
|
||||||
@ -492,29 +485,39 @@ _("ThreeAffiliations");
|
|||||||
_("ThreeAuthors");
|
_("ThreeAuthors");
|
||||||
_("TickList");
|
_("TickList");
|
||||||
_("Title");
|
_("Title");
|
||||||
_("Titlehead");
|
|
||||||
_("Title_Running");
|
_("Title_Running");
|
||||||
_("TOC_Author");
|
_("Titlehead");
|
||||||
_("TOC_Title");
|
|
||||||
_("Town");
|
_("Town");
|
||||||
_("Transition");
|
|
||||||
_("Trans_Keywords");
|
_("Trans_Keywords");
|
||||||
|
_("Transition");
|
||||||
_("Translated");
|
_("Translated");
|
||||||
_("TranslatedAbstract");
|
_("TranslatedAbstract");
|
||||||
_("Translated_Title");
|
_("Translated_Title");
|
||||||
_("Translator");
|
_("Translator");
|
||||||
_("TwoAffiliations");
|
_("TwoAffiliations");
|
||||||
_("TwoAuthors");
|
_("TwoAuthors");
|
||||||
|
_("URL");
|
||||||
_("Unterschrift");
|
_("Unterschrift");
|
||||||
_("Uppertitleback");
|
_("Uppertitleback");
|
||||||
_("URL");
|
|
||||||
_("Use");
|
_("Use");
|
||||||
_("Verbatim");
|
_("Verbatim");
|
||||||
_("Verse");
|
_("Verse");
|
||||||
_("Verteiler");
|
_("Verteiler");
|
||||||
_("VisibleText");
|
_("VisibleText");
|
||||||
_("YourMail");
|
_("YourMail");
|
||||||
_("Yourmail");
|
|
||||||
_("YourRef");
|
_("YourRef");
|
||||||
|
_("Yourmail");
|
||||||
_("Yourref");
|
_("Yourref");
|
||||||
_("Zusatz");
|
_("Zusatz");
|
||||||
|
_("cc");
|
||||||
|
_("encl");
|
||||||
|
_("first");
|
||||||
|
_("foilhead");
|
||||||
|
_("journal");
|
||||||
|
_("landscape");
|
||||||
|
_("modying");
|
||||||
|
_("msnumber");
|
||||||
|
_("offsets");
|
||||||
|
_("ps");
|
||||||
|
_("style");
|
||||||
|
_("surname");
|
||||||
|
588
src/frontends/gnome/FormCitation.C
Normal file
588
src/frontends/gnome/FormCitation.C
Normal file
@ -0,0 +1,588 @@
|
|||||||
|
// -*- C++ -*-
|
||||||
|
/* This file is part of
|
||||||
|
* ======================================================
|
||||||
|
*
|
||||||
|
* LyX, The Document Processor
|
||||||
|
*
|
||||||
|
* Copyright 2000 The LyX Team.
|
||||||
|
*
|
||||||
|
* ======================================================
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <config.h>
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
|
#ifdef __GNUG__
|
||||||
|
#pragma implementation
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#include "gettext.h"
|
||||||
|
#include "Dialogs.h"
|
||||||
|
#include "FormCitation.h"
|
||||||
|
#include "LyXView.h"
|
||||||
|
#include "buffer.h"
|
||||||
|
#include "lyxfunc.h"
|
||||||
|
#include "support/filetools.h"
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
|
#include "diainsertcitation_interface.h"
|
||||||
|
#include "support.h"
|
||||||
|
}
|
||||||
|
|
||||||
|
#include <gtk--/scrolledwindow.h>
|
||||||
|
#include <gnome--/pixmap.h>
|
||||||
|
|
||||||
|
using std::vector;
|
||||||
|
using std::pair;
|
||||||
|
using std::max;
|
||||||
|
using std::min;
|
||||||
|
using std::find;
|
||||||
|
|
||||||
|
#ifdef SIGC_CXX_NAMESPACES
|
||||||
|
using SigC::slot;
|
||||||
|
using SigC::bind;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// gnome configuration file keys
|
||||||
|
#define LOCAL_CONFIGURE_PREFIX "FormCitation"
|
||||||
|
|
||||||
|
#define CONF_DIALOG_WIDTH "width"
|
||||||
|
#define CONF_DIALOG_WIDTH_DEFAULT "=550"
|
||||||
|
|
||||||
|
#define CONF_DIALOG_HEIGTH "heigth"
|
||||||
|
#define CONF_DIALOG_HEIGTH_DEFAULT "=550"
|
||||||
|
|
||||||
|
#define CONF_PANE_INFO "paneinfo"
|
||||||
|
#define CONF_PANE_INFO_DEFAULT "=300"
|
||||||
|
|
||||||
|
#define CONF_PANE_KEY "panekey"
|
||||||
|
#define CONF_PANE_KEY_DEFAULT "=225"
|
||||||
|
|
||||||
|
#define CONF_COLUMN "column"
|
||||||
|
#define CONF_COLUMN_DEFAULT "=50"
|
||||||
|
|
||||||
|
|
||||||
|
FormCitation::FormCitation(LyXView * lv, Dialogs * d)
|
||||||
|
: lv_(lv), d_(d), u_(0), h_(0), ih_(0), inset_(0), dialog_(NULL)
|
||||||
|
{
|
||||||
|
// let the dialog be shown
|
||||||
|
// These are permanent connections so we won't bother
|
||||||
|
// storing a copy because we won't be disconnecting.
|
||||||
|
d->showCitation.connect(slot(this, &FormCitation::showInset));
|
||||||
|
d->createCitation.connect(slot(this, &FormCitation::createInset));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
FormCitation::~FormCitation()
|
||||||
|
{
|
||||||
|
hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
void FormCitation::showInset( InsetCommand * const inset )
|
||||||
|
{
|
||||||
|
if( dialog_!=NULL || inset == 0 ) return;
|
||||||
|
|
||||||
|
inset_ = inset;
|
||||||
|
ih_ = inset_->hide.connect(slot(this, &FormCitation::hide));
|
||||||
|
|
||||||
|
params = inset->params();
|
||||||
|
show();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void FormCitation::createInset( string const & arg )
|
||||||
|
{
|
||||||
|
if( dialog_!=NULL ) return;
|
||||||
|
|
||||||
|
params.setFromString( arg );
|
||||||
|
show();
|
||||||
|
}
|
||||||
|
|
||||||
|
static
|
||||||
|
void parseBibTeX(string data,
|
||||||
|
string const & findkey,
|
||||||
|
string & keyvalue)
|
||||||
|
{
|
||||||
|
unsigned int i;
|
||||||
|
|
||||||
|
keyvalue = "";
|
||||||
|
|
||||||
|
for (i=0; i<data.length(); ++i)
|
||||||
|
if (data[i]=='\n' || data[i]=='\t')
|
||||||
|
data[i] = ' ';
|
||||||
|
|
||||||
|
data = frontStrip(data);
|
||||||
|
while (!data.empty()
|
||||||
|
&& data[0]!='='
|
||||||
|
&& (data.find(' ')!=string::npos ||
|
||||||
|
data.find('=')!=string::npos) )
|
||||||
|
{
|
||||||
|
unsigned int keypos = min(data.find(' '), data.find('='));
|
||||||
|
string key = lowercase( data.substr(0, keypos) );
|
||||||
|
string value, tmp;
|
||||||
|
char enclosing;
|
||||||
|
|
||||||
|
data = data.substr(keypos, data.length()-1);
|
||||||
|
data = frontStrip(strip(data));
|
||||||
|
if (data.length() > 1 && data[0]=='=')
|
||||||
|
{
|
||||||
|
data = frontStrip(data.substr(1, data.length()-1));
|
||||||
|
if (!data.empty())
|
||||||
|
{
|
||||||
|
keypos = 1;
|
||||||
|
if (data[0]=='{') enclosing = '}';
|
||||||
|
else if (data[0]=='"') enclosing = '"';
|
||||||
|
else { keypos=0; enclosing=' '; }
|
||||||
|
|
||||||
|
if (keypos &&
|
||||||
|
data.find(enclosing)!=string::npos &&
|
||||||
|
data.length()>1)
|
||||||
|
{
|
||||||
|
tmp = data.substr(keypos, data.length()-1);
|
||||||
|
while (tmp.find('{')!=string::npos &&
|
||||||
|
tmp.find('}')!=string::npos &&
|
||||||
|
tmp.find('{') < tmp.find('}') &&
|
||||||
|
tmp.find('{') < tmp.find(enclosing))
|
||||||
|
{
|
||||||
|
keypos += tmp.find('{')+1;
|
||||||
|
tmp = data.substr(keypos, data.length()-1);
|
||||||
|
keypos += tmp.find('}')+1;
|
||||||
|
tmp = data.substr(keypos, data.length()-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (tmp.find(enclosing)==string::npos) return;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
keypos += tmp.find(enclosing);
|
||||||
|
tmp = data.substr(keypos, data.length()-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
value = data.substr(1, keypos-1);
|
||||||
|
|
||||||
|
if (keypos+1<data.length()-1) data = frontStrip(data.substr(keypos+1, data.length()-1));
|
||||||
|
else data = "";
|
||||||
|
}
|
||||||
|
else if (!keypos &&
|
||||||
|
(data.find(' ') ||
|
||||||
|
data.find(','))
|
||||||
|
) // numerical value ?
|
||||||
|
{
|
||||||
|
keypos = data.length()-1;
|
||||||
|
if (data.find(' ')!=string::npos) keypos = data.find(' ');
|
||||||
|
if (data.find(',')!=string::npos &&
|
||||||
|
keypos > data.find(','))
|
||||||
|
keypos = data.find(',');
|
||||||
|
|
||||||
|
value = data.substr(0, keypos);
|
||||||
|
|
||||||
|
if (keypos+1<data.length()-1) data = frontStrip(data.substr(keypos+1, data.length()-1));
|
||||||
|
else data = "";
|
||||||
|
}
|
||||||
|
else return;
|
||||||
|
|
||||||
|
if (findkey == key) { keyvalue = value; return; }
|
||||||
|
|
||||||
|
data = frontStrip(frontStrip(data,','));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void FormCitation::show()
|
||||||
|
{
|
||||||
|
if (!dialog_)
|
||||||
|
{
|
||||||
|
GtkWidget * pd = create_DiaInsertCitation();
|
||||||
|
|
||||||
|
dialog_ = Gtk::wrap(pd);
|
||||||
|
clist_selected_ = Gtk::wrap( GTK_CLIST( lookup_widget(pd, "clist_selected") ) );
|
||||||
|
info_ = Gtk::wrap( GNOME_LESS( lookup_widget(pd, "info") ) );
|
||||||
|
text_after_ = Gtk::wrap( GNOME_ENTRY( lookup_widget(pd, "text_after") ) );
|
||||||
|
search_text_ = Gtk::wrap( GNOME_ENTRY( lookup_widget(pd, "search_text") ) );
|
||||||
|
|
||||||
|
button_select_ = Gtk::wrap( GTK_BUTTON( lookup_widget(pd, "button_select") ) );
|
||||||
|
button_unselect_ = Gtk::wrap( GTK_BUTTON( lookup_widget(pd, "button_unselect") ) );
|
||||||
|
button_up_ = Gtk::wrap( GTK_BUTTON( lookup_widget(pd, "button_up") ) );
|
||||||
|
button_down_ = Gtk::wrap( GTK_BUTTON( lookup_widget(pd, "button_down") ) );
|
||||||
|
button_search_ = Gtk::wrap( GTK_BUTTON( lookup_widget(pd, "button_search") ) );
|
||||||
|
|
||||||
|
paned_info_ = Gtk::wrap( GTK_PANED( lookup_widget(pd, "vpaned_info") ) );
|
||||||
|
paned_key_ = Gtk::wrap( GTK_PANED( lookup_widget(pd, "hpaned_key") ) );
|
||||||
|
box_keys_ = Gtk::wrap( GTK_BOX( lookup_widget(pd, "vbox_keys") ) );
|
||||||
|
|
||||||
|
b_ok = Gtk::wrap( GTK_BUTTON( lookup_widget(pd, "button_ok") ) );
|
||||||
|
b_cancel = Gtk::wrap( GTK_BUTTON( lookup_widget(pd, "button_cancel") ) );
|
||||||
|
|
||||||
|
// constructing and packing CList
|
||||||
|
vector<string> colnames;
|
||||||
|
colnames.push_back("INVISIBLE");
|
||||||
|
colnames.push_back(N_("Key"));
|
||||||
|
colnames.push_back(N_("Author(s)"));
|
||||||
|
colnames.push_back(N_("Title"));
|
||||||
|
colnames.push_back(N_("Year"));
|
||||||
|
colnames.push_back(N_("Journal"));
|
||||||
|
clist_bib_ = manage( new Gtk::CList(colnames) );
|
||||||
|
clist_bib_->column(0).set_visiblity(false);
|
||||||
|
|
||||||
|
Gtk::ScrolledWindow * sw_ = Gtk::wrap( GTK_SCROLLED_WINDOW( lookup_widget(pd, "scrolledwindow_bib") ) );
|
||||||
|
sw_->add(*clist_bib_);
|
||||||
|
|
||||||
|
// populating buttons with icons
|
||||||
|
Gnome::Pixmap * p;
|
||||||
|
p = Gtk::wrap( GNOME_PIXMAP( gnome_stock_pixmap_widget(NULL, GNOME_STOCK_PIXMAP_BACK) ) );
|
||||||
|
button_select_->add(*p);
|
||||||
|
p = Gtk::wrap( GNOME_PIXMAP( gnome_stock_pixmap_widget(NULL, GNOME_STOCK_PIXMAP_TRASH) ) );
|
||||||
|
button_unselect_->add(*p);
|
||||||
|
p = Gtk::wrap( GNOME_PIXMAP( gnome_stock_pixmap_widget(NULL, GNOME_STOCK_PIXMAP_UP) ) );
|
||||||
|
button_up_->add(*p);
|
||||||
|
p = Gtk::wrap( GNOME_PIXMAP( gnome_stock_pixmap_widget(NULL, GNOME_STOCK_PIXMAP_DOWN) ) );
|
||||||
|
button_down_->add(*p);
|
||||||
|
|
||||||
|
|
||||||
|
// connecting signals
|
||||||
|
clist_bib_->click_column.connect(slot(this, &FormCitation::sortBibList));
|
||||||
|
|
||||||
|
clist_selected_->select_row.connect(bind(slot(this, &FormCitation::selection_toggled),
|
||||||
|
true, true));
|
||||||
|
clist_bib_->select_row.connect(bind(slot(this, &FormCitation::selection_toggled),
|
||||||
|
true, false));
|
||||||
|
clist_selected_->unselect_row.connect(bind(slot(this, &FormCitation::selection_toggled),
|
||||||
|
false, true));
|
||||||
|
clist_bib_->unselect_row.connect(bind(slot(this, &FormCitation::selection_toggled),
|
||||||
|
false, false));
|
||||||
|
|
||||||
|
button_select_->clicked.connect(slot(this, &FormCitation::newCitation));
|
||||||
|
button_unselect_->clicked.connect(slot(this, &FormCitation::removeCitation));
|
||||||
|
button_up_->clicked.connect(slot(this, &FormCitation::moveCitationUp));
|
||||||
|
button_down_->clicked.connect(slot(this, &FormCitation::moveCitationDown));
|
||||||
|
|
||||||
|
search_text_->get_entry()->activate.connect(slot(this, &FormCitation::search));
|
||||||
|
button_search_->clicked.connect(slot(this, &FormCitation::search));
|
||||||
|
|
||||||
|
b_ok->clicked.connect(slot(this, &FormCitation::apply));
|
||||||
|
b_ok->clicked.connect(dialog_->destroy.slot());
|
||||||
|
b_cancel->clicked.connect(dialog_->destroy.slot());
|
||||||
|
dialog_->destroy.connect(slot(this, &FormCitation::free));
|
||||||
|
|
||||||
|
u_ = d_->updateBufferDependent.connect(slot(this, &FormCitation::update));
|
||||||
|
h_ = d_->hideBufferDependent.connect(slot(this, &FormCitation::hide));
|
||||||
|
|
||||||
|
// setting sizes of the widgets
|
||||||
|
string path;
|
||||||
|
string w, h;
|
||||||
|
path += PACKAGE "/" LOCAL_CONFIGURE_PREFIX;
|
||||||
|
w = path + "/" + CONF_DIALOG_WIDTH + CONF_DIALOG_WIDTH_DEFAULT;
|
||||||
|
h = path + "/" + CONF_DIALOG_HEIGTH + CONF_DIALOG_HEIGTH_DEFAULT;
|
||||||
|
dialog_->set_usize(gnome_config_get_int(w.c_str()),
|
||||||
|
gnome_config_get_int(h.c_str()));
|
||||||
|
|
||||||
|
w = path + "/" + CONF_PANE_INFO + CONF_PANE_INFO_DEFAULT;
|
||||||
|
paned_info_->set_position( gnome_config_get_int(w.c_str()) );
|
||||||
|
|
||||||
|
w = path + "/" + CONF_PANE_KEY + CONF_PANE_KEY_DEFAULT;
|
||||||
|
paned_key_->set_position( gnome_config_get_int(w.c_str()) );
|
||||||
|
|
||||||
|
int i, sz;
|
||||||
|
for (i = 0, sz = clist_bib_->columns().size(); i < sz; ++i)
|
||||||
|
{
|
||||||
|
w = path + "/" + CONF_COLUMN + "_" + tostr(i) + CONF_COLUMN_DEFAULT;
|
||||||
|
clist_bib_->column(i).set_width( gnome_config_get_int(w.c_str()) );
|
||||||
|
}
|
||||||
|
|
||||||
|
// ready to go...
|
||||||
|
if (!dialog_->is_visible()) dialog_->show_all();
|
||||||
|
|
||||||
|
update(); // make sure its up-to-date
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Gdk_Window dialog_win(dialog_->get_window());
|
||||||
|
dialog_win.raise();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void FormCitation::addItemToBibList(int i)
|
||||||
|
{
|
||||||
|
vector<string> r;
|
||||||
|
string key, info;
|
||||||
|
string val;
|
||||||
|
|
||||||
|
key = bibkeys[i];
|
||||||
|
info = bibkeysInfo[i];
|
||||||
|
|
||||||
|
// don't change the order of these first two items:
|
||||||
|
// callback functions depend on the data stored in the first column (its hided)
|
||||||
|
// and in the second column (shown to user)
|
||||||
|
r.push_back( tostr(i) );
|
||||||
|
r.push_back( key );
|
||||||
|
|
||||||
|
// this can be changed (configured by user?)
|
||||||
|
parseBibTeX( info, "author", val); r.push_back(val);
|
||||||
|
parseBibTeX( info, "title", val); r.push_back(val);
|
||||||
|
parseBibTeX( info, "year", val); r.push_back(val);
|
||||||
|
parseBibTeX( info, "journal", val); r.push_back(val);
|
||||||
|
|
||||||
|
clist_bib_->rows().push_back(r);
|
||||||
|
}
|
||||||
|
|
||||||
|
void FormCitation::update()
|
||||||
|
{
|
||||||
|
bibkeys.clear();
|
||||||
|
bibkeysInfo.clear();
|
||||||
|
|
||||||
|
clist_selected_->rows().clear();
|
||||||
|
clist_bib_->rows().clear();
|
||||||
|
|
||||||
|
// populating clist_bib_
|
||||||
|
clist_bib_->freeze();
|
||||||
|
|
||||||
|
vector<pair<string,string> > blist =
|
||||||
|
lv_->buffer()->getBibkeyList();
|
||||||
|
|
||||||
|
int i, sz;
|
||||||
|
for ( i = 0, sz = blist.size(); i < sz; ++i )
|
||||||
|
{
|
||||||
|
bibkeys.push_back(blist[i].first);
|
||||||
|
bibkeysInfo.push_back(blist[i].second);
|
||||||
|
}
|
||||||
|
|
||||||
|
blist.clear();
|
||||||
|
|
||||||
|
for ( i = 0, sz = bibkeys.size(); i < sz; ++i )
|
||||||
|
addItemToBibList(i);
|
||||||
|
|
||||||
|
clist_bib_->sort();
|
||||||
|
clist_bib_->thaw();
|
||||||
|
// clist_bib_: done
|
||||||
|
|
||||||
|
// populating clist_selected_
|
||||||
|
vector<string> r;
|
||||||
|
string tmp, keys( params.getContents() );
|
||||||
|
keys = frontStrip( split(keys, tmp, ',') );
|
||||||
|
while( !tmp.empty() )
|
||||||
|
{
|
||||||
|
r.clear();
|
||||||
|
r.push_back(tmp);
|
||||||
|
clist_selected_->rows().push_back(r);
|
||||||
|
|
||||||
|
keys = frontStrip( split(keys, tmp, ',') );
|
||||||
|
}
|
||||||
|
// clist_selected_: done
|
||||||
|
|
||||||
|
text_after_->get_entry()->set_text(params.getOptions());
|
||||||
|
|
||||||
|
updateButtons();
|
||||||
|
}
|
||||||
|
|
||||||
|
void FormCitation::updateButtons()
|
||||||
|
{
|
||||||
|
bool sens;
|
||||||
|
|
||||||
|
sens = (clist_selected_->selection().size()>0);
|
||||||
|
button_unselect_->set_sensitive(sens);
|
||||||
|
button_up_->set_sensitive(sens &&
|
||||||
|
clist_selected_->selection().operator[](0).get_row_num()>0);
|
||||||
|
button_down_->set_sensitive(sens &&
|
||||||
|
clist_selected_->selection().operator[](0).get_row_num() <
|
||||||
|
clist_selected_->rows().size()-1);
|
||||||
|
|
||||||
|
sens = (clist_bib_->selection().size()>0);
|
||||||
|
button_select_->set_sensitive( (clist_bib_->selection().size()>0) );
|
||||||
|
}
|
||||||
|
|
||||||
|
void FormCitation::selection_toggled(gint row,
|
||||||
|
gint ,//column,
|
||||||
|
GdkEvent * ,//event,
|
||||||
|
bool selected,
|
||||||
|
bool citeselected)
|
||||||
|
{
|
||||||
|
if (selected)
|
||||||
|
{
|
||||||
|
bool keyfound = false;
|
||||||
|
string info;
|
||||||
|
if (citeselected)
|
||||||
|
{
|
||||||
|
// lookup the record with the same key in bibkeys and show additional Info
|
||||||
|
int i;
|
||||||
|
int sz = bibkeys.size();
|
||||||
|
string key = clist_selected_->cell(row,0).get_text();
|
||||||
|
for (i=0; !keyfound && i<sz; ++i)
|
||||||
|
if (bibkeys[i] == key)
|
||||||
|
{
|
||||||
|
info = bibkeysInfo[i];
|
||||||
|
keyfound = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// the first column in clist_bib_ contains the index
|
||||||
|
keyfound = true;
|
||||||
|
info = bibkeysInfo[ strToInt(clist_bib_->cell(row,0).get_text()) ];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (keyfound)
|
||||||
|
info_->show_string(info);
|
||||||
|
else
|
||||||
|
info_->show_string(N_("--- No such key in the database ---"));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
info_->show_string("");
|
||||||
|
}
|
||||||
|
updateButtons();
|
||||||
|
}
|
||||||
|
|
||||||
|
void FormCitation::removeCitation()
|
||||||
|
{
|
||||||
|
clist_selected_->rows().remove(clist_selected_->selection().operator[](0));
|
||||||
|
updateButtons();
|
||||||
|
}
|
||||||
|
|
||||||
|
void FormCitation::moveCitationUp()
|
||||||
|
{
|
||||||
|
int i = clist_selected_->selection().operator[](0).get_row_num();
|
||||||
|
clist_selected_->swap_rows( i-1, i );
|
||||||
|
clist_selected_->row(i-1).select();
|
||||||
|
updateButtons();
|
||||||
|
}
|
||||||
|
|
||||||
|
void FormCitation::moveCitationDown()
|
||||||
|
{
|
||||||
|
int i = clist_selected_->selection().operator[](0).get_row_num();
|
||||||
|
clist_selected_->swap_rows( i+1, i );
|
||||||
|
clist_selected_->row(i+1).select();
|
||||||
|
updateButtons();
|
||||||
|
}
|
||||||
|
|
||||||
|
void FormCitation::newCitation()
|
||||||
|
{
|
||||||
|
// citation key is in the first column of clist_bib_ list
|
||||||
|
vector<string> r;
|
||||||
|
r.push_back( clist_bib_->selection().operator[](0).operator[](1).get_text() );
|
||||||
|
clist_selected_->rows().push_back(r);
|
||||||
|
clist_selected_->row( clist_selected_->rows().size()-1 ).select();
|
||||||
|
updateButtons();
|
||||||
|
}
|
||||||
|
|
||||||
|
void FormCitation::hide()
|
||||||
|
{
|
||||||
|
if (dialog_!=NULL) dialog_->destroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
void FormCitation::free()
|
||||||
|
{
|
||||||
|
if (dialog_!=NULL)
|
||||||
|
{
|
||||||
|
// storing configuration
|
||||||
|
string path;
|
||||||
|
string w, h;
|
||||||
|
path = PACKAGE "/" LOCAL_CONFIGURE_PREFIX;
|
||||||
|
w = path + "/" + CONF_DIALOG_WIDTH;
|
||||||
|
h = path + "/" + CONF_DIALOG_HEIGTH;
|
||||||
|
|
||||||
|
gnome_config_set_int(w.c_str(), dialog_->width());
|
||||||
|
gnome_config_set_int(h.c_str(), dialog_->height());
|
||||||
|
|
||||||
|
w = path + "/" + CONF_PANE_INFO;
|
||||||
|
gnome_config_set_int(w.c_str(), paned_key_->height());
|
||||||
|
|
||||||
|
w = path + "/" + CONF_PANE_KEY;
|
||||||
|
gnome_config_set_int(w.c_str(), box_keys_->width());
|
||||||
|
|
||||||
|
int i, sz;
|
||||||
|
for (i = 0, sz = clist_bib_->columns().size(); i < sz; ++i)
|
||||||
|
{
|
||||||
|
w = path + "/" + CONF_COLUMN + "_" + tostr(i);
|
||||||
|
gnome_config_set_int(w.c_str(), clist_bib_->get_column_width(i));
|
||||||
|
}
|
||||||
|
|
||||||
|
gnome_config_sync();
|
||||||
|
|
||||||
|
// cleaning up
|
||||||
|
dialog_ = NULL;
|
||||||
|
u_.disconnect();
|
||||||
|
h_.disconnect();
|
||||||
|
inset_ = 0;
|
||||||
|
ih_.disconnect();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void FormCitation::apply()
|
||||||
|
{
|
||||||
|
if( lv_->buffer()->isReadonly() ) return;
|
||||||
|
|
||||||
|
string contents;
|
||||||
|
for( unsigned int i = 0; i < clist_selected_->rows().size(); ++i )
|
||||||
|
{
|
||||||
|
if (i > 0) contents += ", ";
|
||||||
|
contents += clist_selected_->cell(i, 0).get_text();
|
||||||
|
}
|
||||||
|
|
||||||
|
params.setContents( contents );
|
||||||
|
params.setOptions( text_after_->get_entry()->get_text() );
|
||||||
|
|
||||||
|
if( inset_ != 0 )
|
||||||
|
{
|
||||||
|
// Only update if contents have changed
|
||||||
|
if( params != inset_->params() )
|
||||||
|
{
|
||||||
|
inset_->setParams( params );
|
||||||
|
lv_->view()->updateInset( inset_, true );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
lv_->getLyXFunc()->Dispatch( LFUN_CITATION_INSERT,
|
||||||
|
params.getAsString().c_str() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void FormCitation::sortBibList(gint col)
|
||||||
|
{
|
||||||
|
clist_bib_->set_sort_column(col);
|
||||||
|
clist_bib_->sort();
|
||||||
|
}
|
||||||
|
|
||||||
|
// looking for entries which contain all the words specified in search_text entry
|
||||||
|
void FormCitation::search()
|
||||||
|
{
|
||||||
|
vector<string> searchwords;
|
||||||
|
string tmp, stext( search_text_->get_entry()->get_text() );
|
||||||
|
stext = frontStrip( strip( stext ) );
|
||||||
|
stext = frontStrip( split(stext, tmp, ' ') );
|
||||||
|
while( !tmp.empty() )
|
||||||
|
{
|
||||||
|
searchwords.push_back(tmp);
|
||||||
|
stext = frontStrip( split(stext, tmp, ' ') );
|
||||||
|
}
|
||||||
|
|
||||||
|
// populating clist_bib_
|
||||||
|
clist_bib_->rows().clear();
|
||||||
|
|
||||||
|
clist_bib_->freeze();
|
||||||
|
|
||||||
|
int i, sz;
|
||||||
|
bool additem;
|
||||||
|
for ( i = 0, sz = bibkeys.size(); i < sz; ++i )
|
||||||
|
{
|
||||||
|
string data = bibkeys[i] + bibkeysInfo[i];
|
||||||
|
|
||||||
|
additem = true;
|
||||||
|
|
||||||
|
int j, szs;
|
||||||
|
for (j = 0, szs = searchwords.size();
|
||||||
|
additem && j < szs; ++j )
|
||||||
|
if ( data.find(searchwords[j]) == string::npos )
|
||||||
|
additem = false;
|
||||||
|
|
||||||
|
if ( additem ) addItemToBibList(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
clist_bib_->sort();
|
||||||
|
clist_bib_->thaw();
|
||||||
|
// clist_bib_: done
|
||||||
|
updateButtons();
|
||||||
|
}
|
129
src/frontends/gnome/FormCitation.h
Normal file
129
src/frontends/gnome/FormCitation.h
Normal file
@ -0,0 +1,129 @@
|
|||||||
|
// -*- C++ -*-
|
||||||
|
/* This file is part of
|
||||||
|
* ======================================================
|
||||||
|
*
|
||||||
|
* LyX, The Document Processor
|
||||||
|
*
|
||||||
|
* Copyright 2000 The LyX Team.
|
||||||
|
*
|
||||||
|
* ======================================================
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef FORMCITATION_H
|
||||||
|
#define FORMCITATION_H
|
||||||
|
|
||||||
|
#ifdef __GNUG__
|
||||||
|
#pragma interface
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "DialogBase.h"
|
||||||
|
#include "LString.h"
|
||||||
|
#include "support/utility.hpp"
|
||||||
|
#include "insets/insetcommand.h"
|
||||||
|
|
||||||
|
#include <gtk--/widget.h>
|
||||||
|
#include <gtk--/clist.h>
|
||||||
|
#include <gnome--/entry.h>
|
||||||
|
#include <gnome--/less.h>
|
||||||
|
#include <gtk--/button.h>
|
||||||
|
#include <gtk--/paned.h>
|
||||||
|
#include <gtk--/box.h>
|
||||||
|
|
||||||
|
/** This class provides an Gnome implementation of the FormCitation Dialog.
|
||||||
|
*/
|
||||||
|
class FormCitation : public DialogBase, public noncopyable {
|
||||||
|
public:
|
||||||
|
///
|
||||||
|
FormCitation(LyXView *, Dialogs *);
|
||||||
|
///
|
||||||
|
~FormCitation();
|
||||||
|
private:
|
||||||
|
/// Slot launching dialog to (possibly) create a new inset
|
||||||
|
void createInset( string const & );
|
||||||
|
/// Slot launching dialog to an existing inset
|
||||||
|
void showInset( InsetCommand * const );
|
||||||
|
|
||||||
|
/// Update dialog before showing it
|
||||||
|
virtual void update();
|
||||||
|
/// 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();
|
||||||
|
|
||||||
|
/// sort biblist
|
||||||
|
void sortBibList(gint);
|
||||||
|
/// update state of the buttons
|
||||||
|
void updateButtons();
|
||||||
|
/// clist selection/unselection callback
|
||||||
|
void selection_toggled(gint row,
|
||||||
|
gint column,
|
||||||
|
GdkEvent *event,
|
||||||
|
bool selected,
|
||||||
|
bool citeselected);
|
||||||
|
/// adds new citation key
|
||||||
|
void newCitation();
|
||||||
|
/// removes selected citation key
|
||||||
|
void removeCitation();
|
||||||
|
/// moves citation up
|
||||||
|
void moveCitationUp();
|
||||||
|
/// moves citation up
|
||||||
|
void moveCitationDown();
|
||||||
|
/// searches for entries
|
||||||
|
void search();
|
||||||
|
|
||||||
|
/// add item to the list
|
||||||
|
void addItemToBibList(int i);
|
||||||
|
|
||||||
|
/** 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)
|
||||||
|
InsetCommand * inset_;
|
||||||
|
/// the nitty-griity. What is modified and passed back
|
||||||
|
InsetCommandParams params;
|
||||||
|
/// Update connection.
|
||||||
|
Connection u_;
|
||||||
|
/// Hide connection.
|
||||||
|
Connection h_;
|
||||||
|
/// inset::hide connection.
|
||||||
|
Connection ih_;
|
||||||
|
|
||||||
|
/// Real GUI implementation.
|
||||||
|
Gtk::Widget * dialog_;
|
||||||
|
Gtk::Button * b_ok;
|
||||||
|
Gtk::Button * b_cancel;
|
||||||
|
|
||||||
|
Gnome::Less * info_;
|
||||||
|
Gnome::Entry * text_after_;
|
||||||
|
|
||||||
|
Gnome::Entry * search_text_;
|
||||||
|
|
||||||
|
Gtk::Button * button_select_;
|
||||||
|
Gtk::Button * button_unselect_;
|
||||||
|
Gtk::Button * button_up_;
|
||||||
|
Gtk::Button * button_down_;
|
||||||
|
Gtk::Button * button_search_;
|
||||||
|
|
||||||
|
Gtk::CList * clist_selected_;
|
||||||
|
Gtk::CList * clist_bib_;
|
||||||
|
|
||||||
|
Gtk::Paned * paned_info_;
|
||||||
|
Gtk::Paned * paned_key_;
|
||||||
|
Gtk::Box * box_keys_;
|
||||||
|
|
||||||
|
std::vector<string> bibkeys;
|
||||||
|
///
|
||||||
|
std::vector<string> bibkeysInfo;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
@ -33,6 +33,8 @@ LYXDATADIRS =
|
|||||||
libgnome_la_SOURCES = \
|
libgnome_la_SOURCES = \
|
||||||
Dialogs.C \
|
Dialogs.C \
|
||||||
GUIRunTime.C \
|
GUIRunTime.C \
|
||||||
|
FormCitation.C \
|
||||||
|
FormCitation.h \
|
||||||
FormCopyright.C \
|
FormCopyright.C \
|
||||||
FormCopyright.h \
|
FormCopyright.h \
|
||||||
FormPrint.C \
|
FormPrint.C \
|
||||||
@ -64,7 +66,11 @@ libgnome_la_SOURCES = \
|
|||||||
diatoc_callbacks.c \
|
diatoc_callbacks.c \
|
||||||
diatoc_interface.c \
|
diatoc_interface.c \
|
||||||
diatoc_callbacks.h \
|
diatoc_callbacks.h \
|
||||||
diatoc_interface.h
|
diatoc_interface.h \
|
||||||
|
diainsertcitation_interface.c \
|
||||||
|
diainsertcitation_interface.h \
|
||||||
|
diainsertcitation_callbacks.c \
|
||||||
|
diainsertcitation_callbacks.h
|
||||||
|
|
||||||
# These still have to be added. Sooner or later. ARRae-20000411
|
# These still have to be added. Sooner or later. ARRae-20000411
|
||||||
# GUI_defaults.C \
|
# GUI_defaults.C \
|
||||||
|
10
src/frontends/gnome/diainsertcitation_callbacks.c
Normal file
10
src/frontends/gnome/diainsertcitation_callbacks.c
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
# include <config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <gnome.h>
|
||||||
|
|
||||||
|
#include "diainsertcitation_callbacks.h"
|
||||||
|
#include "diainsertcitation_interface.h"
|
||||||
|
#include "support.h"
|
||||||
|
|
2
src/frontends/gnome/diainsertcitation_callbacks.h
Normal file
2
src/frontends/gnome/diainsertcitation_callbacks.h
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
#include <gnome.h>
|
||||||
|
|
325
src/frontends/gnome/diainsertcitation_interface.c
Normal file
325
src/frontends/gnome/diainsertcitation_interface.c
Normal file
@ -0,0 +1,325 @@
|
|||||||
|
/*
|
||||||
|
* DO NOT EDIT THIS FILE - it is generated by Glade.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
# include <config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <gnome.h>
|
||||||
|
|
||||||
|
#include "diainsertcitation_callbacks.h"
|
||||||
|
#include "diainsertcitation_interface.h"
|
||||||
|
#include "support.h"
|
||||||
|
|
||||||
|
GtkWidget*
|
||||||
|
create_DiaInsertCitation (void)
|
||||||
|
{
|
||||||
|
GtkWidget *DiaInsertCitation;
|
||||||
|
GtkWidget *dialog_vbox2;
|
||||||
|
GtkWidget *vbox4;
|
||||||
|
GtkWidget *vpaned_info;
|
||||||
|
GtkWidget *hpaned_key;
|
||||||
|
GtkWidget *vbox_keys;
|
||||||
|
GtkWidget *label17;
|
||||||
|
GtkWidget *scrolledwindow2;
|
||||||
|
GtkWidget *clist_selected;
|
||||||
|
GtkWidget *label18;
|
||||||
|
GtkWidget *table2;
|
||||||
|
GtkWidget *label19;
|
||||||
|
GtkWidget *vbuttonbox2;
|
||||||
|
GtkWidget *button_select;
|
||||||
|
GtkWidget *button_unselect;
|
||||||
|
GtkWidget *button_up;
|
||||||
|
GtkWidget *button_down;
|
||||||
|
GtkWidget *scrolledwindow_bib;
|
||||||
|
GtkWidget *hbox3;
|
||||||
|
GtkWidget *search_text;
|
||||||
|
GtkWidget *combo_entry1;
|
||||||
|
GtkWidget *button_search;
|
||||||
|
GtkWidget *vbox5;
|
||||||
|
GtkWidget *alignment2;
|
||||||
|
GtkWidget *label16;
|
||||||
|
GtkWidget *info;
|
||||||
|
GtkWidget *hbox2;
|
||||||
|
GtkWidget *label15;
|
||||||
|
GtkWidget *text_after;
|
||||||
|
GtkWidget *entry3;
|
||||||
|
GtkWidget *dialog_action_area2;
|
||||||
|
GtkWidget *button_ok;
|
||||||
|
GtkWidget *button_cancel;
|
||||||
|
GtkTooltips *tooltips;
|
||||||
|
|
||||||
|
tooltips = gtk_tooltips_new ();
|
||||||
|
|
||||||
|
DiaInsertCitation = gnome_dialog_new (_("Insert Citation"), NULL);
|
||||||
|
gtk_object_set_data (GTK_OBJECT (DiaInsertCitation), "DiaInsertCitation", DiaInsertCitation);
|
||||||
|
GTK_WINDOW (DiaInsertCitation)->type = GTK_WINDOW_DIALOG;
|
||||||
|
gtk_window_set_policy (GTK_WINDOW (DiaInsertCitation), TRUE, TRUE, FALSE);
|
||||||
|
|
||||||
|
dialog_vbox2 = GNOME_DIALOG (DiaInsertCitation)->vbox;
|
||||||
|
gtk_object_set_data (GTK_OBJECT (DiaInsertCitation), "dialog_vbox2", dialog_vbox2);
|
||||||
|
gtk_widget_show (dialog_vbox2);
|
||||||
|
|
||||||
|
vbox4 = gtk_vbox_new (FALSE, 4);
|
||||||
|
gtk_widget_ref (vbox4);
|
||||||
|
gtk_object_set_data_full (GTK_OBJECT (DiaInsertCitation), "vbox4", vbox4,
|
||||||
|
(GtkDestroyNotify) gtk_widget_unref);
|
||||||
|
gtk_widget_show (vbox4);
|
||||||
|
gtk_box_pack_start (GTK_BOX (dialog_vbox2), vbox4, TRUE, TRUE, 0);
|
||||||
|
|
||||||
|
vpaned_info = gtk_vpaned_new ();
|
||||||
|
gtk_widget_ref (vpaned_info);
|
||||||
|
gtk_object_set_data_full (GTK_OBJECT (DiaInsertCitation), "vpaned_info", vpaned_info,
|
||||||
|
(GtkDestroyNotify) gtk_widget_unref);
|
||||||
|
gtk_widget_show (vpaned_info);
|
||||||
|
gtk_box_pack_start (GTK_BOX (vbox4), vpaned_info, TRUE, TRUE, 0);
|
||||||
|
gtk_paned_set_gutter_size (GTK_PANED (vpaned_info), 10);
|
||||||
|
gtk_paned_set_position (GTK_PANED (vpaned_info), 245);
|
||||||
|
|
||||||
|
hpaned_key = gtk_hpaned_new ();
|
||||||
|
gtk_widget_ref (hpaned_key);
|
||||||
|
gtk_object_set_data_full (GTK_OBJECT (DiaInsertCitation), "hpaned_key", hpaned_key,
|
||||||
|
(GtkDestroyNotify) gtk_widget_unref);
|
||||||
|
gtk_widget_show (hpaned_key);
|
||||||
|
gtk_paned_pack1 (GTK_PANED (vpaned_info), hpaned_key, FALSE, TRUE);
|
||||||
|
gtk_paned_set_gutter_size (GTK_PANED (hpaned_key), 10);
|
||||||
|
gtk_paned_set_position (GTK_PANED (hpaned_key), 250);
|
||||||
|
|
||||||
|
vbox_keys = gtk_vbox_new (FALSE, 3);
|
||||||
|
gtk_widget_ref (vbox_keys);
|
||||||
|
gtk_object_set_data_full (GTK_OBJECT (DiaInsertCitation), "vbox_keys", vbox_keys,
|
||||||
|
(GtkDestroyNotify) gtk_widget_unref);
|
||||||
|
gtk_widget_show (vbox_keys);
|
||||||
|
gtk_paned_pack1 (GTK_PANED (hpaned_key), vbox_keys, FALSE, TRUE);
|
||||||
|
|
||||||
|
label17 = gtk_label_new (_("Insert keys:"));
|
||||||
|
gtk_widget_ref (label17);
|
||||||
|
gtk_object_set_data_full (GTK_OBJECT (DiaInsertCitation), "label17", label17,
|
||||||
|
(GtkDestroyNotify) gtk_widget_unref);
|
||||||
|
gtk_widget_show (label17);
|
||||||
|
gtk_box_pack_start (GTK_BOX (vbox_keys), label17, FALSE, FALSE, 0);
|
||||||
|
|
||||||
|
scrolledwindow2 = gtk_scrolled_window_new (NULL, NULL);
|
||||||
|
gtk_widget_ref (scrolledwindow2);
|
||||||
|
gtk_object_set_data_full (GTK_OBJECT (DiaInsertCitation), "scrolledwindow2", scrolledwindow2,
|
||||||
|
(GtkDestroyNotify) gtk_widget_unref);
|
||||||
|
gtk_widget_show (scrolledwindow2);
|
||||||
|
gtk_box_pack_start (GTK_BOX (vbox_keys), scrolledwindow2, TRUE, TRUE, 0);
|
||||||
|
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow2), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
|
||||||
|
|
||||||
|
clist_selected = gtk_clist_new (1);
|
||||||
|
gtk_widget_ref (clist_selected);
|
||||||
|
gtk_object_set_data_full (GTK_OBJECT (DiaInsertCitation), "clist_selected", clist_selected,
|
||||||
|
(GtkDestroyNotify) gtk_widget_unref);
|
||||||
|
gtk_widget_show (clist_selected);
|
||||||
|
gtk_container_add (GTK_CONTAINER (scrolledwindow2), clist_selected);
|
||||||
|
gtk_clist_set_column_width (GTK_CLIST (clist_selected), 0, 80);
|
||||||
|
gtk_clist_column_titles_hide (GTK_CLIST (clist_selected));
|
||||||
|
|
||||||
|
label18 = gtk_label_new ("");
|
||||||
|
gtk_widget_ref (label18);
|
||||||
|
gtk_object_set_data_full (GTK_OBJECT (DiaInsertCitation), "label18", label18,
|
||||||
|
(GtkDestroyNotify) gtk_widget_unref);
|
||||||
|
gtk_widget_show (label18);
|
||||||
|
gtk_clist_set_column_widget (GTK_CLIST (clist_selected), 0, label18);
|
||||||
|
|
||||||
|
table2 = gtk_table_new (3, 2, FALSE);
|
||||||
|
gtk_widget_ref (table2);
|
||||||
|
gtk_object_set_data_full (GTK_OBJECT (DiaInsertCitation), "table2", table2,
|
||||||
|
(GtkDestroyNotify) gtk_widget_unref);
|
||||||
|
gtk_widget_show (table2);
|
||||||
|
gtk_paned_pack2 (GTK_PANED (hpaned_key), table2, TRUE, TRUE);
|
||||||
|
gtk_table_set_row_spacings (GTK_TABLE (table2), 3);
|
||||||
|
gtk_table_set_col_spacings (GTK_TABLE (table2), 3);
|
||||||
|
|
||||||
|
label19 = gtk_label_new (_("Bibliography keys: "));
|
||||||
|
gtk_widget_ref (label19);
|
||||||
|
gtk_object_set_data_full (GTK_OBJECT (DiaInsertCitation), "label19", label19,
|
||||||
|
(GtkDestroyNotify) gtk_widget_unref);
|
||||||
|
gtk_widget_show (label19);
|
||||||
|
gtk_table_attach (GTK_TABLE (table2), label19, 1, 2, 0, 1,
|
||||||
|
(GtkAttachOptions) (0),
|
||||||
|
(GtkAttachOptions) (0), 0, 0);
|
||||||
|
|
||||||
|
vbuttonbox2 = gtk_vbutton_box_new ();
|
||||||
|
gtk_widget_ref (vbuttonbox2);
|
||||||
|
gtk_object_set_data_full (GTK_OBJECT (DiaInsertCitation), "vbuttonbox2", vbuttonbox2,
|
||||||
|
(GtkDestroyNotify) gtk_widget_unref);
|
||||||
|
gtk_widget_show (vbuttonbox2);
|
||||||
|
gtk_table_attach (GTK_TABLE (table2), vbuttonbox2, 0, 1, 1, 2,
|
||||||
|
(GtkAttachOptions) (GTK_FILL),
|
||||||
|
(GtkAttachOptions) (GTK_FILL), 0, 0);
|
||||||
|
gtk_button_box_set_layout (GTK_BUTTON_BOX (vbuttonbox2), GTK_BUTTONBOX_START);
|
||||||
|
gtk_button_box_set_spacing (GTK_BUTTON_BOX (vbuttonbox2), 0);
|
||||||
|
gtk_button_box_set_child_size (GTK_BUTTON_BOX (vbuttonbox2), 0, 27);
|
||||||
|
|
||||||
|
button_select = gtk_button_new ();
|
||||||
|
gtk_widget_ref (button_select);
|
||||||
|
gtk_object_set_data_full (GTK_OBJECT (DiaInsertCitation), "button_select", button_select,
|
||||||
|
(GtkDestroyNotify) gtk_widget_unref);
|
||||||
|
gtk_widget_show (button_select);
|
||||||
|
gtk_container_add (GTK_CONTAINER (vbuttonbox2), button_select);
|
||||||
|
GTK_WIDGET_SET_FLAGS (button_select, GTK_CAN_DEFAULT);
|
||||||
|
gtk_tooltips_set_tip (tooltips, button_select, _("Select"), NULL);
|
||||||
|
|
||||||
|
button_unselect = gtk_button_new ();
|
||||||
|
gtk_widget_ref (button_unselect);
|
||||||
|
gtk_object_set_data_full (GTK_OBJECT (DiaInsertCitation), "button_unselect", button_unselect,
|
||||||
|
(GtkDestroyNotify) gtk_widget_unref);
|
||||||
|
gtk_widget_show (button_unselect);
|
||||||
|
gtk_container_add (GTK_CONTAINER (vbuttonbox2), button_unselect);
|
||||||
|
GTK_WIDGET_SET_FLAGS (button_unselect, GTK_CAN_DEFAULT);
|
||||||
|
gtk_tooltips_set_tip (tooltips, button_unselect, _("Remove"), NULL);
|
||||||
|
|
||||||
|
button_up = gtk_button_new ();
|
||||||
|
gtk_widget_ref (button_up);
|
||||||
|
gtk_object_set_data_full (GTK_OBJECT (DiaInsertCitation), "button_up", button_up,
|
||||||
|
(GtkDestroyNotify) gtk_widget_unref);
|
||||||
|
gtk_widget_show (button_up);
|
||||||
|
gtk_container_add (GTK_CONTAINER (vbuttonbox2), button_up);
|
||||||
|
GTK_WIDGET_SET_FLAGS (button_up, GTK_CAN_DEFAULT);
|
||||||
|
gtk_tooltips_set_tip (tooltips, button_up, _("Up"), NULL);
|
||||||
|
|
||||||
|
button_down = gtk_button_new ();
|
||||||
|
gtk_widget_ref (button_down);
|
||||||
|
gtk_object_set_data_full (GTK_OBJECT (DiaInsertCitation), "button_down", button_down,
|
||||||
|
(GtkDestroyNotify) gtk_widget_unref);
|
||||||
|
gtk_widget_show (button_down);
|
||||||
|
gtk_container_add (GTK_CONTAINER (vbuttonbox2), button_down);
|
||||||
|
GTK_WIDGET_SET_FLAGS (button_down, GTK_CAN_DEFAULT);
|
||||||
|
gtk_tooltips_set_tip (tooltips, button_down, _("Down"), NULL);
|
||||||
|
|
||||||
|
scrolledwindow_bib = gtk_scrolled_window_new (NULL, NULL);
|
||||||
|
gtk_widget_ref (scrolledwindow_bib);
|
||||||
|
gtk_object_set_data_full (GTK_OBJECT (DiaInsertCitation), "scrolledwindow_bib", scrolledwindow_bib,
|
||||||
|
(GtkDestroyNotify) gtk_widget_unref);
|
||||||
|
gtk_widget_show (scrolledwindow_bib);
|
||||||
|
gtk_table_attach (GTK_TABLE (table2), scrolledwindow_bib, 1, 2, 1, 2,
|
||||||
|
(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
|
||||||
|
(GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
|
||||||
|
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow_bib), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
|
||||||
|
|
||||||
|
hbox3 = gtk_hbox_new (FALSE, 3);
|
||||||
|
gtk_widget_ref (hbox3);
|
||||||
|
gtk_object_set_data_full (GTK_OBJECT (DiaInsertCitation), "hbox3", hbox3,
|
||||||
|
(GtkDestroyNotify) gtk_widget_unref);
|
||||||
|
gtk_widget_show (hbox3);
|
||||||
|
gtk_table_attach (GTK_TABLE (table2), hbox3, 1, 2, 2, 3,
|
||||||
|
(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
|
||||||
|
(GtkAttachOptions) (GTK_FILL), 0, 0);
|
||||||
|
gtk_container_set_border_width (GTK_CONTAINER (hbox3), 3);
|
||||||
|
|
||||||
|
search_text = gnome_entry_new ("diainsertcitation_search");
|
||||||
|
gtk_widget_ref (search_text);
|
||||||
|
gtk_object_set_data_full (GTK_OBJECT (DiaInsertCitation), "search_text", search_text,
|
||||||
|
(GtkDestroyNotify) gtk_widget_unref);
|
||||||
|
gtk_widget_show (search_text);
|
||||||
|
gtk_box_pack_start (GTK_BOX (hbox3), search_text, TRUE, TRUE, 0);
|
||||||
|
|
||||||
|
combo_entry1 = gnome_entry_gtk_entry (GNOME_ENTRY (search_text));
|
||||||
|
gtk_widget_ref (combo_entry1);
|
||||||
|
gtk_object_set_data_full (GTK_OBJECT (DiaInsertCitation), "combo_entry1", combo_entry1,
|
||||||
|
(GtkDestroyNotify) gtk_widget_unref);
|
||||||
|
gtk_widget_show (combo_entry1);
|
||||||
|
|
||||||
|
button_search = gtk_button_new_with_label (_("Search"));
|
||||||
|
gtk_widget_ref (button_search);
|
||||||
|
gtk_object_set_data_full (GTK_OBJECT (DiaInsertCitation), "button_search", button_search,
|
||||||
|
(GtkDestroyNotify) gtk_widget_unref);
|
||||||
|
gtk_widget_show (button_search);
|
||||||
|
gtk_box_pack_start (GTK_BOX (hbox3), button_search, FALSE, FALSE, 0);
|
||||||
|
gtk_container_set_border_width (GTK_CONTAINER (button_search), 2);
|
||||||
|
|
||||||
|
vbox5 = gtk_vbox_new (FALSE, 1);
|
||||||
|
gtk_widget_ref (vbox5);
|
||||||
|
gtk_object_set_data_full (GTK_OBJECT (DiaInsertCitation), "vbox5", vbox5,
|
||||||
|
(GtkDestroyNotify) gtk_widget_unref);
|
||||||
|
gtk_widget_show (vbox5);
|
||||||
|
gtk_paned_pack2 (GTK_PANED (vpaned_info), vbox5, TRUE, TRUE);
|
||||||
|
|
||||||
|
alignment2 = gtk_alignment_new (0.5, 0.5, 1, 1);
|
||||||
|
gtk_widget_ref (alignment2);
|
||||||
|
gtk_object_set_data_full (GTK_OBJECT (DiaInsertCitation), "alignment2", alignment2,
|
||||||
|
(GtkDestroyNotify) gtk_widget_unref);
|
||||||
|
gtk_widget_show (alignment2);
|
||||||
|
gtk_box_pack_start (GTK_BOX (vbox5), alignment2, FALSE, TRUE, 0);
|
||||||
|
|
||||||
|
label16 = gtk_label_new (_("Info:"));
|
||||||
|
gtk_widget_ref (label16);
|
||||||
|
gtk_object_set_data_full (GTK_OBJECT (DiaInsertCitation), "label16", label16,
|
||||||
|
(GtkDestroyNotify) gtk_widget_unref);
|
||||||
|
gtk_widget_show (label16);
|
||||||
|
gtk_container_add (GTK_CONTAINER (alignment2), label16);
|
||||||
|
gtk_label_set_justify (GTK_LABEL (label16), GTK_JUSTIFY_LEFT);
|
||||||
|
gtk_misc_set_alignment (GTK_MISC (label16), 1.08033e-07, 1);
|
||||||
|
|
||||||
|
info = gnome_less_new ();
|
||||||
|
gtk_widget_ref (info);
|
||||||
|
gtk_object_set_data_full (GTK_OBJECT (DiaInsertCitation), "info", info,
|
||||||
|
(GtkDestroyNotify) gtk_widget_unref);
|
||||||
|
gtk_widget_show (info);
|
||||||
|
gtk_box_pack_start (GTK_BOX (vbox5), info, TRUE, TRUE, 0);
|
||||||
|
gtk_widget_set_usize (info, -2, 120);
|
||||||
|
|
||||||
|
hbox2 = gtk_hbox_new (FALSE, 3);
|
||||||
|
gtk_widget_ref (hbox2);
|
||||||
|
gtk_object_set_data_full (GTK_OBJECT (DiaInsertCitation), "hbox2", hbox2,
|
||||||
|
(GtkDestroyNotify) gtk_widget_unref);
|
||||||
|
gtk_widget_show (hbox2);
|
||||||
|
gtk_box_pack_start (GTK_BOX (vbox4), hbox2, FALSE, FALSE, 0);
|
||||||
|
|
||||||
|
label15 = gtk_label_new (_("Text after: "));
|
||||||
|
gtk_widget_ref (label15);
|
||||||
|
gtk_object_set_data_full (GTK_OBJECT (DiaInsertCitation), "label15", label15,
|
||||||
|
(GtkDestroyNotify) gtk_widget_unref);
|
||||||
|
gtk_widget_show (label15);
|
||||||
|
gtk_box_pack_start (GTK_BOX (hbox2), label15, FALSE, FALSE, 0);
|
||||||
|
|
||||||
|
text_after = gnome_entry_new ("diainsertcitation_textafter");
|
||||||
|
gtk_widget_ref (text_after);
|
||||||
|
gtk_object_set_data_full (GTK_OBJECT (DiaInsertCitation), "text_after", text_after,
|
||||||
|
(GtkDestroyNotify) gtk_widget_unref);
|
||||||
|
gtk_widget_show (text_after);
|
||||||
|
gtk_box_pack_start (GTK_BOX (hbox2), text_after, TRUE, TRUE, 0);
|
||||||
|
|
||||||
|
entry3 = gnome_entry_gtk_entry (GNOME_ENTRY (text_after));
|
||||||
|
gtk_widget_ref (entry3);
|
||||||
|
gtk_object_set_data_full (GTK_OBJECT (DiaInsertCitation), "entry3", entry3,
|
||||||
|
(GtkDestroyNotify) gtk_widget_unref);
|
||||||
|
gtk_widget_show (entry3);
|
||||||
|
|
||||||
|
dialog_action_area2 = GNOME_DIALOG (DiaInsertCitation)->action_area;
|
||||||
|
gtk_object_set_data (GTK_OBJECT (DiaInsertCitation), "dialog_action_area2", dialog_action_area2);
|
||||||
|
gtk_widget_show (dialog_action_area2);
|
||||||
|
gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area2), GTK_BUTTONBOX_END);
|
||||||
|
gtk_button_box_set_spacing (GTK_BUTTON_BOX (dialog_action_area2), 8);
|
||||||
|
|
||||||
|
gnome_dialog_append_button (GNOME_DIALOG (DiaInsertCitation), GNOME_STOCK_BUTTON_OK);
|
||||||
|
button_ok = g_list_last (GNOME_DIALOG (DiaInsertCitation)->buttons)->data;
|
||||||
|
gtk_widget_ref (button_ok);
|
||||||
|
gtk_object_set_data_full (GTK_OBJECT (DiaInsertCitation), "button_ok", button_ok,
|
||||||
|
(GtkDestroyNotify) gtk_widget_unref);
|
||||||
|
gtk_widget_show (button_ok);
|
||||||
|
GTK_WIDGET_SET_FLAGS (button_ok, GTK_CAN_DEFAULT);
|
||||||
|
|
||||||
|
gnome_dialog_append_button (GNOME_DIALOG (DiaInsertCitation), GNOME_STOCK_BUTTON_CANCEL);
|
||||||
|
button_cancel = g_list_last (GNOME_DIALOG (DiaInsertCitation)->buttons)->data;
|
||||||
|
gtk_widget_ref (button_cancel);
|
||||||
|
gtk_object_set_data_full (GTK_OBJECT (DiaInsertCitation), "button_cancel", button_cancel,
|
||||||
|
(GtkDestroyNotify) gtk_widget_unref);
|
||||||
|
gtk_widget_show (button_cancel);
|
||||||
|
GTK_WIDGET_SET_FLAGS (button_cancel, GTK_CAN_DEFAULT);
|
||||||
|
|
||||||
|
gtk_widget_grab_focus (button_ok);
|
||||||
|
gtk_widget_grab_default (button_ok);
|
||||||
|
gtk_object_set_data (GTK_OBJECT (DiaInsertCitation), "tooltips", tooltips);
|
||||||
|
|
||||||
|
return DiaInsertCitation;
|
||||||
|
}
|
||||||
|
|
5
src/frontends/gnome/diainsertcitation_interface.h
Normal file
5
src/frontends/gnome/diainsertcitation_interface.h
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
/*
|
||||||
|
* DO NOT EDIT THIS FILE - it is generated by Glade.
|
||||||
|
*/
|
||||||
|
|
||||||
|
GtkWidget* create_DiaInsertCitation (void);
|
486
src/frontends/gnome/dialogs/diainsertcitation.glade
Normal file
486
src/frontends/gnome/dialogs/diainsertcitation.glade
Normal file
@ -0,0 +1,486 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<GTK-Interface>
|
||||||
|
|
||||||
|
<project>
|
||||||
|
<name>diainsertcitation</name>
|
||||||
|
<program_name>diainsertcitation</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>
|
||||||
|
<output_main_file>False</output_main_file>
|
||||||
|
<output_support_files>False</output_support_files>
|
||||||
|
<output_build_files>False</output_build_files>
|
||||||
|
<main_source_file>diainsertcitation_interface.c</main_source_file>
|
||||||
|
<main_header_file>diainsertcitation_interface.h</main_header_file>
|
||||||
|
<handler_source_file>diainsertcitation_callbacks.c</handler_source_file>
|
||||||
|
<handler_header_file>diainsertcitation_callbacks.h</handler_header_file>
|
||||||
|
</project>
|
||||||
|
|
||||||
|
<widget>
|
||||||
|
<class>GnomeDialog</class>
|
||||||
|
<name>DiaInsertCitation</name>
|
||||||
|
<title>Insert Citation</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>False</hide_on_close>
|
||||||
|
|
||||||
|
<widget>
|
||||||
|
<class>GtkVBox</class>
|
||||||
|
<child_name>GnomeDialog:vbox</child_name>
|
||||||
|
<name>dialog-vbox2</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_area2</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>
|
||||||
|
<has_default>True</has_default>
|
||||||
|
<can_focus>True</can_focus>
|
||||||
|
<has_focus>True</has_focus>
|
||||||
|
<stock_button>GNOME_STOCK_BUTTON_OK</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>GtkVBox</class>
|
||||||
|
<name>vbox4</name>
|
||||||
|
<homogeneous>False</homogeneous>
|
||||||
|
<spacing>4</spacing>
|
||||||
|
<child>
|
||||||
|
<padding>0</padding>
|
||||||
|
<expand>True</expand>
|
||||||
|
<fill>True</fill>
|
||||||
|
</child>
|
||||||
|
|
||||||
|
<widget>
|
||||||
|
<class>GtkVPaned</class>
|
||||||
|
<name>vpaned_info</name>
|
||||||
|
<handle_size>10</handle_size>
|
||||||
|
<gutter_size>10</gutter_size>
|
||||||
|
<position>245</position>
|
||||||
|
<child>
|
||||||
|
<padding>0</padding>
|
||||||
|
<expand>True</expand>
|
||||||
|
<fill>True</fill>
|
||||||
|
</child>
|
||||||
|
|
||||||
|
<widget>
|
||||||
|
<class>GtkHPaned</class>
|
||||||
|
<name>hpaned_key</name>
|
||||||
|
<handle_size>10</handle_size>
|
||||||
|
<gutter_size>10</gutter_size>
|
||||||
|
<position>250</position>
|
||||||
|
<child>
|
||||||
|
<shrink>True</shrink>
|
||||||
|
<resize>False</resize>
|
||||||
|
</child>
|
||||||
|
|
||||||
|
<widget>
|
||||||
|
<class>GtkVBox</class>
|
||||||
|
<name>vbox_keys</name>
|
||||||
|
<homogeneous>False</homogeneous>
|
||||||
|
<spacing>3</spacing>
|
||||||
|
<child>
|
||||||
|
<shrink>True</shrink>
|
||||||
|
<resize>False</resize>
|
||||||
|
</child>
|
||||||
|
|
||||||
|
<widget>
|
||||||
|
<class>GtkLabel</class>
|
||||||
|
<name>label17</name>
|
||||||
|
<label>Insert keys:</label>
|
||||||
|
<justify>GTK_JUSTIFY_CENTER</justify>
|
||||||
|
<wrap>False</wrap>
|
||||||
|
<xalign>0.5</xalign>
|
||||||
|
<yalign>0.5</yalign>
|
||||||
|
<xpad>0</xpad>
|
||||||
|
<ypad>0</ypad>
|
||||||
|
<child>
|
||||||
|
<padding>0</padding>
|
||||||
|
<expand>False</expand>
|
||||||
|
<fill>False</fill>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
|
||||||
|
<widget>
|
||||||
|
<class>GtkScrolledWindow</class>
|
||||||
|
<name>scrolledwindow2</name>
|
||||||
|
<hscrollbar_policy>GTK_POLICY_AUTOMATIC</hscrollbar_policy>
|
||||||
|
<vscrollbar_policy>GTK_POLICY_AUTOMATIC</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>GtkCList</class>
|
||||||
|
<name>clist_selected</name>
|
||||||
|
<can_focus>True</can_focus>
|
||||||
|
<columns>1</columns>
|
||||||
|
<column_widths>80</column_widths>
|
||||||
|
<selection_mode>GTK_SELECTION_SINGLE</selection_mode>
|
||||||
|
<show_titles>False</show_titles>
|
||||||
|
<shadow_type>GTK_SHADOW_IN</shadow_type>
|
||||||
|
|
||||||
|
<widget>
|
||||||
|
<class>GtkLabel</class>
|
||||||
|
<child_name>CList:title</child_name>
|
||||||
|
<name>label18</name>
|
||||||
|
<label></label>
|
||||||
|
<justify>GTK_JUSTIFY_CENTER</justify>
|
||||||
|
<wrap>False</wrap>
|
||||||
|
<xalign>0.5</xalign>
|
||||||
|
<yalign>0.5</yalign>
|
||||||
|
<xpad>0</xpad>
|
||||||
|
<ypad>0</ypad>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
|
||||||
|
<widget>
|
||||||
|
<class>GtkTable</class>
|
||||||
|
<name>table2</name>
|
||||||
|
<rows>3</rows>
|
||||||
|
<columns>2</columns>
|
||||||
|
<homogeneous>False</homogeneous>
|
||||||
|
<row_spacing>3</row_spacing>
|
||||||
|
<column_spacing>3</column_spacing>
|
||||||
|
<child>
|
||||||
|
<shrink>True</shrink>
|
||||||
|
<resize>True</resize>
|
||||||
|
</child>
|
||||||
|
|
||||||
|
<widget>
|
||||||
|
<class>GtkLabel</class>
|
||||||
|
<name>label19</name>
|
||||||
|
<label>Bibliography keys: </label>
|
||||||
|
<justify>GTK_JUSTIFY_CENTER</justify>
|
||||||
|
<wrap>False</wrap>
|
||||||
|
<xalign>0.5</xalign>
|
||||||
|
<yalign>0.5</yalign>
|
||||||
|
<xpad>0</xpad>
|
||||||
|
<ypad>0</ypad>
|
||||||
|
<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>False</xexpand>
|
||||||
|
<yexpand>False</yexpand>
|
||||||
|
<xshrink>False</xshrink>
|
||||||
|
<yshrink>False</yshrink>
|
||||||
|
<xfill>False</xfill>
|
||||||
|
<yfill>False</yfill>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
|
||||||
|
<widget>
|
||||||
|
<class>GtkVButtonBox</class>
|
||||||
|
<name>vbuttonbox2</name>
|
||||||
|
<layout_style>GTK_BUTTONBOX_START</layout_style>
|
||||||
|
<spacing>0</spacing>
|
||||||
|
<child_min_width>0</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>
|
||||||
|
<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>True</yfill>
|
||||||
|
</child>
|
||||||
|
|
||||||
|
<widget>
|
||||||
|
<class>GtkButton</class>
|
||||||
|
<name>button_select</name>
|
||||||
|
<tooltip>Select</tooltip>
|
||||||
|
<can_default>True</can_default>
|
||||||
|
<can_focus>True</can_focus>
|
||||||
|
|
||||||
|
<widget>
|
||||||
|
<class>Placeholder</class>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
|
||||||
|
<widget>
|
||||||
|
<class>GtkButton</class>
|
||||||
|
<name>button_unselect</name>
|
||||||
|
<tooltip>Remove</tooltip>
|
||||||
|
<can_default>True</can_default>
|
||||||
|
<can_focus>True</can_focus>
|
||||||
|
|
||||||
|
<widget>
|
||||||
|
<class>Placeholder</class>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
|
||||||
|
<widget>
|
||||||
|
<class>GtkButton</class>
|
||||||
|
<name>button_up</name>
|
||||||
|
<tooltip>Up</tooltip>
|
||||||
|
<can_default>True</can_default>
|
||||||
|
<can_focus>True</can_focus>
|
||||||
|
|
||||||
|
<widget>
|
||||||
|
<class>Placeholder</class>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
|
||||||
|
<widget>
|
||||||
|
<class>GtkButton</class>
|
||||||
|
<name>button_down</name>
|
||||||
|
<tooltip>Down</tooltip>
|
||||||
|
<can_default>True</can_default>
|
||||||
|
<can_focus>True</can_focus>
|
||||||
|
|
||||||
|
<widget>
|
||||||
|
<class>Placeholder</class>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
|
||||||
|
<widget>
|
||||||
|
<class>GtkScrolledWindow</class>
|
||||||
|
<name>scrolledwindow_bib</name>
|
||||||
|
<hscrollbar_policy>GTK_POLICY_AUTOMATIC</hscrollbar_policy>
|
||||||
|
<vscrollbar_policy>GTK_POLICY_AUTOMATIC</vscrollbar_policy>
|
||||||
|
<hupdate_policy>GTK_UPDATE_CONTINUOUS</hupdate_policy>
|
||||||
|
<vupdate_policy>GTK_UPDATE_CONTINUOUS</vupdate_policy>
|
||||||
|
<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>True</yexpand>
|
||||||
|
<xshrink>False</xshrink>
|
||||||
|
<yshrink>False</yshrink>
|
||||||
|
<xfill>True</xfill>
|
||||||
|
<yfill>True</yfill>
|
||||||
|
</child>
|
||||||
|
|
||||||
|
<widget>
|
||||||
|
<class>Placeholder</class>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
|
||||||
|
<widget>
|
||||||
|
<class>GtkHBox</class>
|
||||||
|
<name>hbox3</name>
|
||||||
|
<border_width>3</border_width>
|
||||||
|
<homogeneous>False</homogeneous>
|
||||||
|
<spacing>3</spacing>
|
||||||
|
<child>
|
||||||
|
<left_attach>1</left_attach>
|
||||||
|
<right_attach>2</right_attach>
|
||||||
|
<top_attach>2</top_attach>
|
||||||
|
<bottom_attach>3</bottom_attach>
|
||||||
|
<xpad>0</xpad>
|
||||||
|
<ypad>0</ypad>
|
||||||
|
<xexpand>True</xexpand>
|
||||||
|
<yexpand>False</yexpand>
|
||||||
|
<xshrink>False</xshrink>
|
||||||
|
<yshrink>False</yshrink>
|
||||||
|
<xfill>True</xfill>
|
||||||
|
<yfill>True</yfill>
|
||||||
|
</child>
|
||||||
|
|
||||||
|
<widget>
|
||||||
|
<class>GnomeEntry</class>
|
||||||
|
<name>search_text</name>
|
||||||
|
<history_id>diainsertcitation_search</history_id>
|
||||||
|
<max_saved>10</max_saved>
|
||||||
|
<child>
|
||||||
|
<padding>0</padding>
|
||||||
|
<expand>True</expand>
|
||||||
|
<fill>True</fill>
|
||||||
|
</child>
|
||||||
|
|
||||||
|
<widget>
|
||||||
|
<class>GtkEntry</class>
|
||||||
|
<child_name>GnomeEntry:entry</child_name>
|
||||||
|
<name>combo-entry1</name>
|
||||||
|
<can_focus>True</can_focus>
|
||||||
|
<editable>True</editable>
|
||||||
|
<text_visible>True</text_visible>
|
||||||
|
<text_max_length>0</text_max_length>
|
||||||
|
<text></text>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
|
||||||
|
<widget>
|
||||||
|
<class>GtkButton</class>
|
||||||
|
<name>button_search</name>
|
||||||
|
<border_width>2</border_width>
|
||||||
|
<can_focus>True</can_focus>
|
||||||
|
<label>Search</label>
|
||||||
|
<child>
|
||||||
|
<padding>0</padding>
|
||||||
|
<expand>False</expand>
|
||||||
|
<fill>False</fill>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
|
||||||
|
<widget>
|
||||||
|
<class>GtkVBox</class>
|
||||||
|
<name>vbox5</name>
|
||||||
|
<homogeneous>False</homogeneous>
|
||||||
|
<spacing>1</spacing>
|
||||||
|
<child>
|
||||||
|
<shrink>True</shrink>
|
||||||
|
<resize>True</resize>
|
||||||
|
</child>
|
||||||
|
|
||||||
|
<widget>
|
||||||
|
<class>GtkAlignment</class>
|
||||||
|
<name>alignment2</name>
|
||||||
|
<xalign>0.5</xalign>
|
||||||
|
<yalign>0.5</yalign>
|
||||||
|
<xscale>1</xscale>
|
||||||
|
<yscale>1</yscale>
|
||||||
|
<child>
|
||||||
|
<padding>0</padding>
|
||||||
|
<expand>False</expand>
|
||||||
|
<fill>True</fill>
|
||||||
|
</child>
|
||||||
|
|
||||||
|
<widget>
|
||||||
|
<class>GtkLabel</class>
|
||||||
|
<name>label16</name>
|
||||||
|
<label>Info:</label>
|
||||||
|
<justify>GTK_JUSTIFY_LEFT</justify>
|
||||||
|
<wrap>False</wrap>
|
||||||
|
<xalign>1.08033e-07</xalign>
|
||||||
|
<yalign>1</yalign>
|
||||||
|
<xpad>0</xpad>
|
||||||
|
<ypad>0</ypad>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
|
||||||
|
<widget>
|
||||||
|
<class>GnomeLess</class>
|
||||||
|
<name>info</name>
|
||||||
|
<height>120</height>
|
||||||
|
<child>
|
||||||
|
<padding>0</padding>
|
||||||
|
<expand>True</expand>
|
||||||
|
<fill>True</fill>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
|
||||||
|
<widget>
|
||||||
|
<class>GtkHBox</class>
|
||||||
|
<name>hbox2</name>
|
||||||
|
<homogeneous>False</homogeneous>
|
||||||
|
<spacing>3</spacing>
|
||||||
|
<child>
|
||||||
|
<padding>0</padding>
|
||||||
|
<expand>False</expand>
|
||||||
|
<fill>False</fill>
|
||||||
|
</child>
|
||||||
|
|
||||||
|
<widget>
|
||||||
|
<class>GtkLabel</class>
|
||||||
|
<name>label15</name>
|
||||||
|
<label>Text after: </label>
|
||||||
|
<justify>GTK_JUSTIFY_CENTER</justify>
|
||||||
|
<wrap>False</wrap>
|
||||||
|
<xalign>0.5</xalign>
|
||||||
|
<yalign>0.5</yalign>
|
||||||
|
<xpad>0</xpad>
|
||||||
|
<ypad>0</ypad>
|
||||||
|
<child>
|
||||||
|
<padding>0</padding>
|
||||||
|
<expand>False</expand>
|
||||||
|
<fill>False</fill>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
|
||||||
|
<widget>
|
||||||
|
<class>GnomeEntry</class>
|
||||||
|
<name>text_after</name>
|
||||||
|
<history_id>diainsertcitation_textafter</history_id>
|
||||||
|
<max_saved>10</max_saved>
|
||||||
|
<child>
|
||||||
|
<padding>0</padding>
|
||||||
|
<expand>True</expand>
|
||||||
|
<fill>True</fill>
|
||||||
|
</child>
|
||||||
|
|
||||||
|
<widget>
|
||||||
|
<class>GtkEntry</class>
|
||||||
|
<child_name>GnomeEntry:entry</child_name>
|
||||||
|
<name>entry3</name>
|
||||||
|
<can_focus>True</can_focus>
|
||||||
|
<editable>True</editable>
|
||||||
|
<text_visible>True</text_visible>
|
||||||
|
<text_max_length>0</text_max_length>
|
||||||
|
<text></text>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
|
||||||
|
</GTK-Interface>
|
@ -20,7 +20,7 @@ using SigC::bind;
|
|||||||
using SigC::slot;
|
using SigC::slot;
|
||||||
|
|
||||||
GLyxAppWin::GLyxAppWin() :
|
GLyxAppWin::GLyxAppWin() :
|
||||||
Gnome::App("GnomeLyX","LyX Gnomified"),
|
Gnome::App(PACKAGE,"LyX Gnomified"),
|
||||||
status_(false, true, GNOME_PREFERENCES_NEVER)
|
status_(false, true, GNOME_PREFERENCES_NEVER)
|
||||||
{
|
{
|
||||||
init();
|
init();
|
||||||
@ -36,7 +36,7 @@ void GLyxAppWin::init()
|
|||||||
// set defaults
|
// set defaults
|
||||||
set_policy(false, true, false);
|
set_policy(false, true, false);
|
||||||
set_default_size(250, 350);
|
set_default_size(250, 350);
|
||||||
set_wmclass("lyx", "GnomeLyX");
|
set_wmclass(PACKAGE, "GnomeLyX");
|
||||||
|
|
||||||
frame_.set_shadow_type(GTK_SHADOW_IN);
|
frame_.set_shadow_type(GTK_SHADOW_IN);
|
||||||
|
|
||||||
|
@ -72,7 +72,9 @@ int main(int argc, char * argv[])
|
|||||||
KApplication a( argc, argv );
|
KApplication a( argc, argv );
|
||||||
#endif
|
#endif
|
||||||
#ifdef GTKGUI
|
#ifdef GTKGUI
|
||||||
Gnome::Main a(PACKAGE,VERSION,1,argv); //argc, argv );
|
string app_id(PACKAGE);
|
||||||
|
string app_version(VERSION);
|
||||||
|
Gnome::Main a(app_id, app_version, 1, argv); //argc, argv );
|
||||||
GLyxAppWin appWin;
|
GLyxAppWin appWin;
|
||||||
mainAppWin = &appWin;
|
mainAppWin = &appWin;
|
||||||
#endif
|
#endif
|
||||||
|
@ -61,8 +61,11 @@
|
|||||||
#include "encoding.h"
|
#include "encoding.h"
|
||||||
|
|
||||||
//#define USE_PSPELL 1
|
//#define USE_PSPELL 1
|
||||||
|
|
||||||
#ifdef USE_PSPELL
|
#ifdef USE_PSPELL
|
||||||
|
|
||||||
#include <pspell/pspell.h>
|
#include <pspell/pspell.h>
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
using std::reverse;
|
using std::reverse;
|
||||||
@ -111,19 +114,27 @@ extern void sigchldchecker(pid_t pid, int *status);
|
|||||||
|
|
||||||
struct isp_result {
|
struct isp_result {
|
||||||
int flag;
|
int flag;
|
||||||
int count;
|
char * str;
|
||||||
string str;
|
char * b;
|
||||||
char ** misses;
|
char * e;
|
||||||
|
const char * next_miss();
|
||||||
isp_result() {
|
isp_result() {
|
||||||
flag = ISP_UNKNOWN;
|
flag = ISP_UNKNOWN;
|
||||||
count = 0;
|
str = 0;
|
||||||
misses = static_cast<char**>(0);
|
|
||||||
}
|
}
|
||||||
~isp_result() {
|
~isp_result() {
|
||||||
delete[] misses;
|
delete[] str;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const char * isp_result::next_miss() {
|
||||||
|
if (str == 0 || *(e+1) == '\0') return 0;
|
||||||
|
b = e + 2;
|
||||||
|
e = strpbrk(b, ",\n");
|
||||||
|
*e = '\0';
|
||||||
|
return b;
|
||||||
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
struct isp_result {
|
struct isp_result {
|
||||||
@ -150,7 +161,6 @@ const char * isp_result::next_miss()
|
|||||||
const char * spell_error;
|
const char * spell_error;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/***** Spellchecker options *****/
|
/***** Spellchecker options *****/
|
||||||
|
|
||||||
// Rewritten to use ordinary LyX xforms loop and OK, Apply and Cancel set,
|
// Rewritten to use ordinary LyX xforms loop and OK, Apply and Cancel set,
|
||||||
@ -270,7 +280,6 @@ void SpellCheckerOptions()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifndef USE_PSPELL
|
#ifndef USE_PSPELL
|
||||||
|
|
||||||
/***** Spellchecker *****/
|
/***** Spellchecker *****/
|
||||||
@ -278,7 +287,7 @@ void SpellCheckerOptions()
|
|||||||
// Could also use a clean up. (Asger Alstrup)
|
// Could also use a clean up. (Asger Alstrup)
|
||||||
|
|
||||||
static
|
static
|
||||||
void create_ispell_pipe(BufferParams const & params, string const & lang)
|
void init_spell_checker(BufferParams const & params, string const & lang)
|
||||||
{
|
{
|
||||||
static char o_buf[BUFSIZ]; // jc: it could be smaller
|
static char o_buf[BUFSIZ]; // jc: it could be smaller
|
||||||
int pipein[2], pipeout[2];
|
int pipein[2], pipeout[2];
|
||||||
@ -289,19 +298,19 @@ void create_ispell_pipe(BufferParams const & params, string const & lang)
|
|||||||
|
|
||||||
if(pipe(pipein) == -1 || pipe(pipeout) == -1) {
|
if(pipe(pipein) == -1 || pipe(pipeout) == -1) {
|
||||||
lyxerr << "LyX: Can't create pipe for spellchecker!" << endl;
|
lyxerr << "LyX: Can't create pipe for spellchecker!" << endl;
|
||||||
return;
|
goto END;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((out = fdopen(pipein[1], "w")) == 0) {
|
if ((out = fdopen(pipein[1], "w")) == 0) {
|
||||||
lyxerr << "LyX: Can't create stream for pipe for spellchecker!"
|
lyxerr << "LyX: Can't create stream for pipe for spellchecker!"
|
||||||
<< endl;
|
<< endl;
|
||||||
return;
|
goto END;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((in = fdopen(pipeout[0], "r")) == 0) {
|
if ((in = fdopen(pipeout[0], "r")) == 0) {
|
||||||
lyxerr <<"LyX: Can't create stream for pipe for spellchecker!"
|
lyxerr <<"LyX: Can't create stream for pipe for spellchecker!"
|
||||||
<< endl;
|
<< endl;
|
||||||
return;
|
goto END;
|
||||||
}
|
}
|
||||||
|
|
||||||
setvbuf(out, o_buf, _IOLBF, BUFSIZ);
|
setvbuf(out, o_buf, _IOLBF, BUFSIZ);
|
||||||
@ -313,9 +322,9 @@ void create_ispell_pipe(BufferParams const & params, string const & lang)
|
|||||||
if(isp_pid == -1) {
|
if(isp_pid == -1) {
|
||||||
lyxerr << "LyX: Can't create child process for spellchecker!"
|
lyxerr << "LyX: Can't create child process for spellchecker!"
|
||||||
<< endl;
|
<< endl;
|
||||||
return;
|
goto END;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isp_pid == 0) {
|
if(isp_pid == 0) {
|
||||||
/* child process */
|
/* child process */
|
||||||
dup2(pipein[0], STDIN_FILENO);
|
dup2(pipein[0], STDIN_FILENO);
|
||||||
@ -405,7 +414,7 @@ void create_ispell_pipe(BufferParams const & params, string const & lang)
|
|||||||
lyxerr << "LyX: Failed to start ispell!" << endl;
|
lyxerr << "LyX: Failed to start ispell!" << endl;
|
||||||
_exit(0);
|
_exit(0);
|
||||||
}
|
}
|
||||||
|
{
|
||||||
/* Parent process: Read ispells identification message */
|
/* Parent process: Read ispells identification message */
|
||||||
// Hmm...what are we using this id msg for? Nothing? (Lgb)
|
// Hmm...what are we using this id msg for? Nothing? (Lgb)
|
||||||
// Actually I used it to tell if it's truly Ispell or if it's
|
// Actually I used it to tell if it's truly Ispell or if it's
|
||||||
@ -438,6 +447,9 @@ void create_ispell_pipe(BufferParams const & params, string const & lang)
|
|||||||
actual_spell_checker = ASC_ASPELL;
|
actual_spell_checker = ASC_ASPELL;
|
||||||
else
|
else
|
||||||
actual_spell_checker = ASC_ISPELL;
|
actual_spell_checker = ASC_ISPELL;
|
||||||
|
|
||||||
|
fputs("!\n", out); // Set terse mode (silently accept correct words)
|
||||||
|
|
||||||
|
|
||||||
} else if (retval == 0) {
|
} else if (retval == 0) {
|
||||||
// timeout. Give nice message to user.
|
// timeout. Give nice message to user.
|
||||||
@ -451,17 +463,39 @@ void create_ispell_pipe(BufferParams const & params, string const & lang)
|
|||||||
// Select returned error
|
// Select returned error
|
||||||
lyxerr << "Select on ispell returned error, what now?" << endl;
|
lyxerr << "Select on ispell returned error, what now?" << endl;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
END:
|
||||||
|
if (isp_pid == -1) {
|
||||||
|
spell_error =
|
||||||
|
"\n\n"
|
||||||
|
"The ispell-process has died for some reason. *One* possible reason\n"
|
||||||
|
"could be that you do not have a dictionary file\n"
|
||||||
|
"for the language of this document installed.\n"
|
||||||
|
"Check /usr/lib/ispell or set another\n"
|
||||||
|
"dictionary in the Spellchecker Options menu.";
|
||||||
|
} else {
|
||||||
|
spell_error = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static
|
||||||
|
bool sc_still_alive() {
|
||||||
|
return isp_pid != -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static
|
||||||
|
void sc_clean_up_after_error()
|
||||||
|
{
|
||||||
|
fclose(out);
|
||||||
|
}
|
||||||
|
|
||||||
// Send word to ispell and get reply
|
// Send word to ispell and get reply
|
||||||
static
|
static
|
||||||
isp_result *ispell_check_word(char *word)
|
isp_result * sc_check_word(char *word)
|
||||||
{
|
{
|
||||||
//Please rewrite to use string.
|
//Please rewrite to use string.
|
||||||
isp_result *result;
|
isp_result *result;
|
||||||
char buf[1024], *p;
|
char buf[1024];
|
||||||
int count, i;
|
|
||||||
|
|
||||||
fputs(word, out);
|
fputs(word, out);
|
||||||
fputc('\n', out);
|
fputc('\n', out);
|
||||||
@ -494,25 +528,10 @@ isp_result *ispell_check_word(char *word)
|
|||||||
case '&': // Not found, but we have near misses
|
case '&': // Not found, but we have near misses
|
||||||
{
|
{
|
||||||
result->flag = ISP_MISSED;
|
result->flag = ISP_MISSED;
|
||||||
result->str = buf;
|
char * p = strpbrk(buf, ":");
|
||||||
// nb is leaked! where should it be freed? I have to
|
result->str = new char[strlen(p) + 1];
|
||||||
// admit I do not understand the intent of the code :(
|
result->e = result->str;
|
||||||
// (JMarc)
|
strcpy(result->str, p);
|
||||||
char * nb = new char[result->str.length() + 1];
|
|
||||||
result->str.copy(nb, result->str.length());
|
|
||||||
nb[result->str.length()]= '\0';
|
|
||||||
p = strpbrk(nb+2, " ");
|
|
||||||
sscanf(p, "%d", &count); // Get near misses count
|
|
||||||
result->count = count;
|
|
||||||
if (count) result->misses = new char*[count];
|
|
||||||
p = strpbrk(nb, ":");
|
|
||||||
p += 2;
|
|
||||||
for (i = 0; i < count; ++i) {
|
|
||||||
result->misses[i] = p;
|
|
||||||
p = strpbrk(p, ",\n");
|
|
||||||
*p = 0;
|
|
||||||
p += 2;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default: // This shouldn't happend, but you know Murphy
|
default: // This shouldn't happend, but you know Murphy
|
||||||
@ -527,8 +546,8 @@ isp_result *ispell_check_word(char *word)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static inline
|
static inline
|
||||||
void ispell_terminate()
|
void close_spell_checker()
|
||||||
{
|
{
|
||||||
// Note: If you decide to optimize this out when it is not
|
// Note: If you decide to optimize this out when it is not
|
||||||
// needed please note that when Aspell is used this command
|
// needed please note that when Aspell is used this command
|
||||||
@ -542,15 +561,8 @@ void ispell_terminate()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static inline
|
static inline
|
||||||
void ispell_terse_mode()
|
void sc_insert_word(char const *word)
|
||||||
{
|
|
||||||
fputs("!\n", out); // Set terse mode (silently accept correct words)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static inline
|
|
||||||
void ispell_insert_word(char const *word)
|
|
||||||
{
|
{
|
||||||
fputc('*', out); // Insert word in personal dictionary
|
fputc('*', out); // Insert word in personal dictionary
|
||||||
fputs(word, out);
|
fputs(word, out);
|
||||||
@ -558,8 +570,8 @@ void ispell_insert_word(char const *word)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static inline
|
static inline
|
||||||
void ispell_accept_word(char const *word)
|
void sc_accept_word(char const *word)
|
||||||
{
|
{
|
||||||
fputc('@', out); // Accept in this session
|
fputc('@', out); // Accept in this session
|
||||||
fputs(word, out);
|
fputs(word, out);
|
||||||
@ -567,7 +579,7 @@ void ispell_accept_word(char const *word)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static inline
|
static inline
|
||||||
void ispell_store_replacement(char const *mis, string const & cor) {
|
void sc_store_replacement(char const *mis, string const & cor) {
|
||||||
if(actual_spell_checker == ASC_ASPELL) {
|
if(actual_spell_checker == ASC_ASPELL) {
|
||||||
fputs("$$ra ", out);
|
fputs("$$ra ", out);
|
||||||
fputs(mis, out);
|
fputs(mis, out);
|
||||||
@ -582,7 +594,7 @@ void ispell_store_replacement(char const *mis, string const & cor) {
|
|||||||
PspellCanHaveError * spell_error_object;
|
PspellCanHaveError * spell_error_object;
|
||||||
|
|
||||||
static
|
static
|
||||||
void init_spell_checker(string const & /* lang */)
|
void init_spell_checker(BufferParams const &, string const & lang)
|
||||||
{
|
{
|
||||||
PspellConfig * config = new_pspell_config();
|
PspellConfig * config = new_pspell_config();
|
||||||
spell_error_object = new_pspell_manager(config);
|
spell_error_object = new_pspell_manager(config);
|
||||||
@ -635,28 +647,27 @@ isp_result * sc_check_word(char *word)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static
|
static inline
|
||||||
inline void close_spell_checker()
|
void close_spell_checker()
|
||||||
{
|
{
|
||||||
pspell_manager_save_all_word_lists(sc);
|
pspell_manager_save_all_word_lists(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline
|
||||||
static
|
void sc_insert_word(char const *word)
|
||||||
inline void sc_insert_word(char const *word)
|
|
||||||
{
|
{
|
||||||
pspell_manager_add_to_personal(sc, word);
|
pspell_manager_add_to_personal(sc, word);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static
|
static inline
|
||||||
inline void sc_accept_word(char const *word)
|
void sc_accept_word(char const *word)
|
||||||
{
|
{
|
||||||
pspell_manager_add_to_personal(sc, word);
|
pspell_manager_add_to_personal(sc, word);
|
||||||
}
|
}
|
||||||
|
|
||||||
static
|
static inline
|
||||||
inline void sc_store_replacement(char const *mis, string const & cor) {
|
void sc_store_replacement(char const *mis, string const & cor) {
|
||||||
pspell_manager_store_replacement(sc, mis, cor.c_str());
|
pspell_manager_store_replacement(sc, mis, cor.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -792,33 +803,16 @@ bool RunSpellChecker(BufferView * bv)
|
|||||||
float newval = 0.0;
|
float newval = 0.0;
|
||||||
|
|
||||||
/* create ispell process */
|
/* create ispell process */
|
||||||
|
init_spell_checker(bv->buffer()->params, tmp);
|
||||||
|
|
||||||
#ifndef USE_PSPELL
|
|
||||||
|
|
||||||
create_ispell_pipe(bv->buffer()->params, tmp);
|
|
||||||
if (isp_pid == -1) {
|
|
||||||
fl_show_message(
|
|
||||||
_("\n\n"
|
|
||||||
"The ispell-process has died for some reason. *One* possible reason\n"
|
|
||||||
"could be that you do not have a dictionary file\n"
|
|
||||||
"for the language of this document installed.\n"
|
|
||||||
"Check /usr/lib/ispell or set another\n"
|
|
||||||
"dictionary in the Spellchecker Options menu."), "", "");
|
|
||||||
fclose(out);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
// Put ispell in terse mode to improve speed
|
|
||||||
ispell_terse_mode();
|
|
||||||
#else
|
|
||||||
init_spell_checker(tmp);
|
|
||||||
if (spell_error != 0) {
|
if (spell_error != 0) {
|
||||||
fl_show_message(_(spell_error), "", "");
|
fl_show_message(_(spell_error), "", "");
|
||||||
sc_clean_up_after_error();
|
sc_clean_up_after_error();
|
||||||
return true;
|
return false;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
unsigned int word_count = 0;
|
unsigned int word_count = 0;
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
char * word = bv->nextWord(newval);
|
char * word = bv->nextWord(newval);
|
||||||
if (word == 0) break;
|
if (word == 0) break;
|
||||||
@ -829,39 +823,24 @@ bool RunSpellChecker(BufferView * bv)
|
|||||||
if(newvalue!= oldval) {
|
if(newvalue!= oldval) {
|
||||||
oldval = newvalue;
|
oldval = newvalue;
|
||||||
fl_set_slider_value(fd_form_spell_check->slider, oldval);
|
fl_set_slider_value(fd_form_spell_check->slider, oldval);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (word_count%1000 == 0) {
|
if (word_count%1000 == 0) {
|
||||||
obj = fl_check_forms();
|
obj = fl_check_forms();
|
||||||
if (obj == fd_form_spell_check->stop) {
|
if (obj == fd_form_spell_check->stop) {
|
||||||
delete[] word;
|
delete[] word;
|
||||||
#ifndef USE_PSPELL
|
|
||||||
ispell_terminate();
|
|
||||||
#else
|
|
||||||
close_spell_checker();
|
close_spell_checker();
|
||||||
#endif
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (obj == fd_form_spell_check->done) {
|
if (obj == fd_form_spell_check->done) {
|
||||||
delete[] word;
|
delete[] word;
|
||||||
#ifndef USE_PSPELL
|
|
||||||
ispell_terminate();
|
|
||||||
#else
|
|
||||||
close_spell_checker();
|
close_spell_checker();
|
||||||
#endif
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef USE_PSPELL
|
|
||||||
result = ispell_check_word(word);
|
|
||||||
if (isp_pid == -1)
|
|
||||||
#else
|
|
||||||
result = sc_check_word(word);
|
result = sc_check_word(word);
|
||||||
if (!sc_still_alive())
|
if (!sc_still_alive()) {
|
||||||
#endif
|
|
||||||
{
|
|
||||||
|
|
||||||
delete result;
|
delete result;
|
||||||
delete[] word;
|
delete[] word;
|
||||||
break;
|
break;
|
||||||
@ -880,40 +859,25 @@ bool RunSpellChecker(BufferView * bv)
|
|||||||
fl_set_object_label(fd_form_spell_check->text, word);
|
fl_set_object_label(fd_form_spell_check->text, word);
|
||||||
fl_set_input(fd_form_spell_check->input, word);
|
fl_set_input(fd_form_spell_check->input, word);
|
||||||
fl_clear_browser(fd_form_spell_check->browser);
|
fl_clear_browser(fd_form_spell_check->browser);
|
||||||
#ifndef USE_PSPELL
|
const char * w;
|
||||||
int i;
|
while ((w = result->next_miss()) != 0) {
|
||||||
for (i = 0; i < result->count; ++i) {
|
|
||||||
if (rtl) {
|
if (rtl) {
|
||||||
string tmp = result->misses[i];
|
string tmp = w;
|
||||||
reverse(tmp.begin(),tmp.end());
|
reverse(tmp.begin(),tmp.end());
|
||||||
fl_add_browser_line(fd_form_spell_check->browser, tmp.c_str());
|
fl_add_browser_line(fd_form_spell_check->browser, tmp.c_str());
|
||||||
} else
|
} else
|
||||||
fl_add_browser_line(fd_form_spell_check->browser, result->misses[i]);
|
fl_add_browser_line(fd_form_spell_check->browser, w);
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
const char * w;
|
|
||||||
while ((w = result->next_miss()) != 0) {
|
|
||||||
fl_add_browser_line(fd_form_spell_check->browser, w);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int clickline = -1;
|
int clickline = -1;
|
||||||
while (true) {
|
while (true) {
|
||||||
obj = fl_do_forms();
|
obj = fl_do_forms();
|
||||||
if (obj == fd_form_spell_check->insert) {
|
if (obj == fd_form_spell_check->insert) {
|
||||||
#ifndef USE_PSPELL
|
|
||||||
ispell_insert_word(word);
|
|
||||||
#else
|
|
||||||
sc_insert_word(word);
|
sc_insert_word(word);
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (obj == fd_form_spell_check->accept) {
|
if (obj == fd_form_spell_check->accept) {
|
||||||
#ifndef USE_PSPELL
|
|
||||||
ispell_accept_word(word);
|
|
||||||
#else
|
|
||||||
sc_accept_word(word);
|
sc_accept_word(word);
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (obj == fd_form_spell_check->ignore) {
|
if (obj == fd_form_spell_check->ignore) {
|
||||||
@ -921,11 +885,7 @@ bool RunSpellChecker(BufferView * bv)
|
|||||||
}
|
}
|
||||||
if (obj == fd_form_spell_check->replace ||
|
if (obj == fd_form_spell_check->replace ||
|
||||||
obj == fd_form_spell_check->input) {
|
obj == fd_form_spell_check->input) {
|
||||||
#ifndef USE_PSPELL
|
|
||||||
ispell_store_replacement(word, fl_get_input(fd_form_spell_check->input));
|
|
||||||
#else
|
|
||||||
sc_store_replacement(word, fl_get_input(fd_form_spell_check->input));
|
sc_store_replacement(word, fl_get_input(fd_form_spell_check->input));
|
||||||
#endif
|
|
||||||
bv->replaceWord(fl_get_input(fd_form_spell_check->input));
|
bv->replaceWord(fl_get_input(fd_form_spell_check->input));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -934,11 +894,7 @@ bool RunSpellChecker(BufferView * bv)
|
|||||||
// sent to lyx@via by Mark Burton <mark@cbl.leeds.ac.uk>
|
// sent to lyx@via by Mark Burton <mark@cbl.leeds.ac.uk>
|
||||||
if (clickline ==
|
if (clickline ==
|
||||||
fl_get_browser(fd_form_spell_check->browser)) {
|
fl_get_browser(fd_form_spell_check->browser)) {
|
||||||
#ifndef USE_PSPELL
|
|
||||||
ispell_store_replacement(word, fl_get_input(fd_form_spell_check->input));
|
|
||||||
#else
|
|
||||||
sc_store_replacement(word, fl_get_input(fd_form_spell_check->input));
|
sc_store_replacement(word, fl_get_input(fd_form_spell_check->input));
|
||||||
#endif
|
|
||||||
bv->replaceWord(fl_get_input(fd_form_spell_check->input));
|
bv->replaceWord(fl_get_input(fd_form_spell_check->input));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -958,22 +914,14 @@ bool RunSpellChecker(BufferView * bv)
|
|||||||
if (obj == fd_form_spell_check->stop) {
|
if (obj == fd_form_spell_check->stop) {
|
||||||
delete result;
|
delete result;
|
||||||
delete[] word;
|
delete[] word;
|
||||||
#ifndef USE_PSPELL
|
|
||||||
ispell_terminate();
|
|
||||||
#else
|
|
||||||
close_spell_checker();
|
close_spell_checker();
|
||||||
#endif
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj == fd_form_spell_check->done) {
|
if (obj == fd_form_spell_check->done) {
|
||||||
delete result;
|
delete result;
|
||||||
delete[] word;
|
delete[] word;
|
||||||
#ifndef USE_PSPELL
|
|
||||||
ispell_terminate();
|
|
||||||
#else
|
|
||||||
close_spell_checker();
|
close_spell_checker();
|
||||||
#endif
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -983,14 +931,9 @@ bool RunSpellChecker(BufferView * bv)
|
|||||||
delete[] word;
|
delete[] word;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef USE_PSPELL
|
|
||||||
if(isp_pid!= -1) {
|
|
||||||
ispell_terminate();
|
|
||||||
#else
|
|
||||||
if(sc_still_alive()) {
|
if(sc_still_alive()) {
|
||||||
close_spell_checker();
|
close_spell_checker();
|
||||||
#endif
|
|
||||||
string word_msg(tostr(word_count));
|
string word_msg(tostr(word_count));
|
||||||
if (word_count != 1) {
|
if (word_count != 1) {
|
||||||
word_msg += _(" words checked.");
|
word_msg += _(" words checked.");
|
||||||
@ -1001,15 +944,9 @@ bool RunSpellChecker(BufferView * bv)
|
|||||||
word_msg.c_str());
|
word_msg.c_str());
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
#ifndef USE_PSPELL
|
|
||||||
fl_show_message(_("The ispell-process has died for some reason.\n"
|
|
||||||
"Maybe it has been killed."), "", "");
|
|
||||||
fclose(out);
|
|
||||||
#else
|
|
||||||
fl_show_message(_("The spell checker has died for some reason.\n"
|
fl_show_message(_("The spell checker has died for some reason.\n"
|
||||||
"Maybe it has been killed."), "", "");
|
"Maybe it has been killed."), "", "");
|
||||||
sc_clean_up_after_error();
|
sc_clean_up_after_error();
|
||||||
#endif
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1031,7 +968,7 @@ void sigchldhandler(pid_t pid, int * status)
|
|||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
void sigchldhandler(pid_t /* pid */, int * /* status */)
|
void sigchldhandler(pid_t, int *)
|
||||||
{
|
{
|
||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user