mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 01:59:02 +00:00
Marko's GNOME patch and Baruch's insetgraphic patch + some fixes to make all
this work. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@967 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
f4d7b803f3
commit
c29851030b
66
ChangeLog
66
ChangeLog
@ -1,3 +1,69 @@
|
||||
2000-08-14 Juergen Vigna <jug@sad.it>
|
||||
|
||||
* sigc++/.cvsignore: added acinclude.m4
|
||||
|
||||
* lib/.cvsignore: added listerros
|
||||
|
||||
* src/frontends/Makefile.am: modified for now to ALWAYS compile the
|
||||
xforms tree as objects are needed for other frontends.
|
||||
|
||||
* src/frontends/gnome/Makefile.am (libgnome_la_OBJADD): added for
|
||||
linking with not yet implemented xforms objects.
|
||||
|
||||
* src/frontends/gnome/Dialogs.C (Dialogs): added FormDocument.
|
||||
|
||||
2000-08-14 Baruch Even <baruch.even@writeme.com>
|
||||
|
||||
* src/frontends/xforms/FormGraphics.h:
|
||||
* src/frontends/xforms/FormGraphics.C:
|
||||
* src/frontends/xforms/RadioButtonGroup.h:
|
||||
* src/frontends/xforms/RadioButtonGroup.C:
|
||||
* src/insets/insetgraphics.h:
|
||||
* src/insets/insetgraphics.C:
|
||||
* src/insets/insetgraphicsParams.h:
|
||||
* src/insets/insetgraphicsParams.C: Changed indentation to use tabs
|
||||
instead of spaces, and various other indentation issues to make the
|
||||
sources more consistent.
|
||||
|
||||
2000-08-14 Marko Vendelin <markov@ioc.ee>
|
||||
|
||||
* src/frontends/gnome/dialogs/diaprint.glade
|
||||
* src/frontends/gnome/FormPrint.C
|
||||
* src/frontends/gnome/FormPrint.h
|
||||
* src/frontends/gnome/diaprint_callbacks.c
|
||||
* src/frontends/gnome/diaprint_callbacks.h
|
||||
* src/frontends/gnome/diaprint_interface.c
|
||||
* src/frontends/gnome/diaprint_interface.h: Print dialog Gnome
|
||||
implementation
|
||||
|
||||
* src/frontends/gnome/dialogs/diainserturl.glade
|
||||
* src/frontends/gnome/FormUrl.C
|
||||
* src/frontends/gnome/FormUrl.h
|
||||
* src/frontends/gnome/diainserturl_callbacks.c
|
||||
* src/frontends/gnome/diainserturl_callbacks.h
|
||||
* src/frontends/gnome/diainserturl_interface.c
|
||||
* src/frontends/gnome/diainserturl_interface.h: Insert Url dialog
|
||||
Gnome implementation
|
||||
|
||||
* src/frontends/gnome/Dialogs.C
|
||||
* src/frontends/gnome/Makefile.am: added Print, Insert Url and all other
|
||||
dialogs. Copy all unimplemented dialogs from Xforms frontend
|
||||
|
||||
* src/frontends/gnome/support.c
|
||||
* src/frontends/gnome/support.h: support files generated by Glade
|
||||
|
||||
* autogen.sh
|
||||
* configure.in
|
||||
* config/gnome.m4: Gnome configuration scripts
|
||||
|
||||
* config/lyxinclude.m4: cleanup: frontend renamed from gtk to gnome in
|
||||
configure --help message
|
||||
|
||||
* src/lyx_gui.C: Gnome/Gtk releases control in LyXGUI::runTime() only if
|
||||
there are no events pendling in Gnome/Gtk. This enhances the performance of
|
||||
menus.
|
||||
|
||||
|
||||
2000-08-14 Allan Rae <rae@lyx.org>
|
||||
|
||||
* lib/Makefile.am: listerrors cleaning
|
||||
|
@ -24,7 +24,7 @@ fi
|
||||
echo -n "Generate acinclude.m4... "
|
||||
rm -f acinclude.m4 sigc++/acinclude.m4
|
||||
touch acinclude.m4
|
||||
for fil in config/lyxinclude.m4 config/libtool.m4 config/gettext.m4 config/lcmessage.m4 config/progtest.m4 config/sigc++.m4 config/kde.m4 config/gtk--.m4 config/gnome--.m4 ; do
|
||||
for fil in config/lyxinclude.m4 config/libtool.m4 config/gettext.m4 config/lcmessage.m4 config/progtest.m4 config/sigc++.m4 config/kde.m4 config/gtk--.m4 config/gnome--.m4 config/gnome.m4 ; do
|
||||
cat $fil >> acinclude.m4
|
||||
done
|
||||
touch sigc++/acinclude.m4
|
||||
|
2498
config/gnome.m4
Normal file
2498
config/gnome.m4
Normal file
File diff suppressed because it is too large
Load Diff
@ -906,7 +906,7 @@ AC_DEFUN(LYX_USE_FRONTEND,
|
||||
[AC_MSG_CHECKING(what frontend should be used as main GUI)
|
||||
AC_ARG_WITH(frontend,
|
||||
[ --with-frontend[=value] Use THIS frontend as main GUI:
|
||||
Possible values: xforms,kde,gtk],
|
||||
Possible values: xforms,kde,gnome],
|
||||
[lyx_use_frontend="$withval"], [lyx_use_frontend="xforms"])
|
||||
AC_MSG_RESULT($lyx_use_frontend)
|
||||
lyx_flags="$lyx_flags frontend-$lyx_use_frontend"
|
||||
|
13
configure.in
13
configure.in
@ -61,6 +61,17 @@ LYX_SCO
|
||||
### Check for program extensions (.exe or nothing)
|
||||
AC_EXEEXT
|
||||
|
||||
### check which frontend we want to use
|
||||
LYX_USE_FRONTEND
|
||||
dnl The code below is not in a macro, because this would cause big
|
||||
dnl problems with the AC_REQUIRE contained in KDE_DO_IT_ALL.
|
||||
case "$lyx_use_frontend" in
|
||||
gnome)
|
||||
GNOME_INIT
|
||||
GNOME_COMPILE_WARNINGS
|
||||
GNOME_X_CHECKS
|
||||
esac
|
||||
|
||||
### Check for a C++ compiler
|
||||
AC_LANG_CPLUSPLUS
|
||||
LYX_PROG_CXX
|
||||
@ -144,7 +155,7 @@ CPPFLAGS="$CPPFLAGS $X_CFLAGS"
|
||||
AC_CHECK_FUNCS(XOpenIM)
|
||||
|
||||
### check which frontend we want to use
|
||||
LYX_USE_FRONTEND
|
||||
#LYX_USE_FRONTEND
|
||||
dnl The code below is not in a macro, because this would cause big
|
||||
dnl problems with the AC_REQUIRE contained in KDE_DO_IT_ALL.
|
||||
case "$lyx_use_frontend" in
|
||||
|
@ -3,3 +3,4 @@ Makefile.in
|
||||
textclass.lst
|
||||
packages.lst
|
||||
lyxrc.defaults
|
||||
listerrors
|
||||
|
@ -26,6 +26,7 @@ src/ext_l10n.h
|
||||
src/filedlg.C
|
||||
src/FontLoader.C
|
||||
src/form1.C
|
||||
src/frontends/gnome/FormPrint.C
|
||||
src/frontends/xforms/FormCitation.C
|
||||
src/frontends/xforms/form_citation.C
|
||||
src/frontends/xforms/FormCopyright.C
|
||||
@ -42,6 +43,17 @@ src/frontends/xforms/FormPrint.C
|
||||
src/frontends/xforms/form_print.C
|
||||
src/frontends/xforms/FormRef.C
|
||||
src/frontends/xforms/form_ref.C
|
||||
src/frontends/xforms/forms/form_citation.C
|
||||
src/frontends/xforms/forms/form_copyright.C
|
||||
src/frontends/xforms/forms/form_document.C
|
||||
src/frontends/xforms/forms/form_graphics.C
|
||||
src/frontends/xforms/forms/form_index.C
|
||||
src/frontends/xforms/forms/form_preferences.C
|
||||
src/frontends/xforms/forms/form_print.C
|
||||
src/frontends/xforms/forms/form_ref.C
|
||||
src/frontends/xforms/forms/form_tabular.C
|
||||
src/frontends/xforms/forms/form_toc.C
|
||||
src/frontends/xforms/forms/form_url.C
|
||||
src/frontends/xforms/FormTabular.C
|
||||
src/frontends/xforms/form_tabular.C
|
||||
src/frontends/xforms/FormToc.C
|
||||
|
@ -26,3 +26,4 @@ sigc-config
|
||||
stamp*
|
||||
sigc++config.h
|
||||
sigc++config.h.in
|
||||
acinclude.m4
|
||||
|
@ -165,17 +165,18 @@ _("Credits...|e");
|
||||
_("Version...|V");
|
||||
_("");
|
||||
_("A&A");
|
||||
_("ACT");
|
||||
_("AT_RISE:");
|
||||
_("Abstract");
|
||||
_("Accepted");
|
||||
_("Acknowledgement");
|
||||
_("Acknowledgement(s)");
|
||||
_("Acknowledgement*");
|
||||
_("Acknowledgement-numbered");
|
||||
_("Acknowledgement(s)");
|
||||
_("Acknowledgements");
|
||||
_("Acknowledgement-unnumbered");
|
||||
_("Acknowledgements");
|
||||
_("Acknowledgments");
|
||||
_("Acnowledgement");
|
||||
_("ACT");
|
||||
_("Addchap");
|
||||
_("Addchap*");
|
||||
_("Addition");
|
||||
@ -193,15 +194,15 @@ _("Anlagen");
|
||||
_("Anrede");
|
||||
_("Appendices");
|
||||
_("Appendix");
|
||||
_("AT_RISE:");
|
||||
_("Author");
|
||||
_("AuthorRunning");
|
||||
_("Author_Email");
|
||||
_("Author_Running");
|
||||
_("AuthorRunning");
|
||||
_("Author_URL");
|
||||
_("Axiom");
|
||||
_("Axiom-numbered");
|
||||
_("Axiom-plain");
|
||||
_("BLZ");
|
||||
_("Backaddress");
|
||||
_("Bank");
|
||||
_("BankAccount");
|
||||
@ -209,13 +210,12 @@ _("BankCode");
|
||||
_("Betreff");
|
||||
_("Bibliography");
|
||||
_("Biography");
|
||||
_("BLZ");
|
||||
_("Brieftext");
|
||||
_("CC");
|
||||
_("CURTAIN");
|
||||
_("Caption");
|
||||
_("Case");
|
||||
_("Case-numbered");
|
||||
_("CC");
|
||||
_("cc");
|
||||
_("CenteredCaption");
|
||||
_("Chapter");
|
||||
_("Chapter*");
|
||||
@ -255,7 +255,6 @@ _("Criterion-plain");
|
||||
_("CrossList");
|
||||
_("Current");
|
||||
_("Current_Address");
|
||||
_("CURTAIN");
|
||||
_("Customer");
|
||||
_("Data");
|
||||
_("Date");
|
||||
@ -270,10 +269,10 @@ _("Definition-unnumbered");
|
||||
_("Description");
|
||||
_("Dialogue");
|
||||
_("EMail");
|
||||
_("EXT.");
|
||||
_("Email");
|
||||
_("Encl");
|
||||
_("Encl.");
|
||||
_("encl");
|
||||
_("End_All_Slides");
|
||||
_("Enumerate");
|
||||
_("Example");
|
||||
@ -284,48 +283,43 @@ _("Example-unnumbered");
|
||||
_("Exercise");
|
||||
_("Exercise-numbered");
|
||||
_("Exercise-plain");
|
||||
_("EXT.");
|
||||
_("Extratitle");
|
||||
_("FADE_IN:");
|
||||
_("FADE_OUT:");
|
||||
_("Fact");
|
||||
_("Fact*");
|
||||
_("Fact-numbered");
|
||||
_("Fact-plain");
|
||||
_("Fact-unnumbered");
|
||||
_("FADE_IN:");
|
||||
_("FADE_OUT:");
|
||||
_("FigCaption");
|
||||
_("first");
|
||||
_("FirstAuthor");
|
||||
_("FirstName");
|
||||
_("FitBitmap");
|
||||
_("FitFigure");
|
||||
_("Foilhead");
|
||||
_("foilhead");
|
||||
_("Footernote");
|
||||
_("FourAffiliations");
|
||||
_("FourAuthors");
|
||||
_("Gruss");
|
||||
_("Headnote");
|
||||
_("HTTP");
|
||||
_("Headnote");
|
||||
_("INT.");
|
||||
_("Idea");
|
||||
_("IhrSchreiben");
|
||||
_("IhrZeichen");
|
||||
_("Institute");
|
||||
_("Institution");
|
||||
_("INT.");
|
||||
_("InvisibleText");
|
||||
_("Invoice");
|
||||
_("Itemize");
|
||||
_("Journal");
|
||||
_("journal");
|
||||
_("Keywords");
|
||||
_("Konto");
|
||||
_("Labeling");
|
||||
_("Land");
|
||||
_("landscape");
|
||||
_("LandscapeSlide");
|
||||
_("LaTeX");
|
||||
_("LaTeX_Title");
|
||||
_("Labeling");
|
||||
_("Land");
|
||||
_("LandscapeSlide");
|
||||
_("Lemma");
|
||||
_("Lemma*");
|
||||
_("Lemma-numbered");
|
||||
@ -344,10 +338,8 @@ _("MarkBoth");
|
||||
_("MathLetters");
|
||||
_("MeinZeichen");
|
||||
_("Minisec");
|
||||
_("modying");
|
||||
_("msnumber");
|
||||
_("My_Address");
|
||||
_("MyRef");
|
||||
_("My_Address");
|
||||
_("Myref");
|
||||
_("Name");
|
||||
_("Narrative");
|
||||
@ -357,18 +349,18 @@ _("Note");
|
||||
_("Note*");
|
||||
_("Note-numbered");
|
||||
_("Note-plain");
|
||||
_("Note-unnumbered");
|
||||
_("NoteToEditor");
|
||||
_("Notetoeditor");
|
||||
_("Note-unnumbered");
|
||||
_("Offprint");
|
||||
_("Offprints");
|
||||
_("Offsets");
|
||||
_("offsets");
|
||||
_("Oggetto");
|
||||
_("Opening");
|
||||
_("Ort");
|
||||
_("Overlay");
|
||||
_("PACS");
|
||||
_("PS");
|
||||
_("Paragraph");
|
||||
_("Paragraph*");
|
||||
_("Paragraph-numbered");
|
||||
@ -379,8 +371,8 @@ _("Petit");
|
||||
_("Phone");
|
||||
_("Place");
|
||||
_("PlaceFigure");
|
||||
_("Placefigure");
|
||||
_("PlaceTable");
|
||||
_("Placefigure");
|
||||
_("Placetable");
|
||||
_("PortraitSlide");
|
||||
_("PostalCommend");
|
||||
@ -397,12 +389,11 @@ _("Proposition*");
|
||||
_("Proposition-numbered");
|
||||
_("Proposition-plain");
|
||||
_("Proposition-unnumbered");
|
||||
_("PS");
|
||||
_("ps");
|
||||
_("Publishers");
|
||||
_("Question");
|
||||
_("Quotation");
|
||||
_("Quote");
|
||||
_("REVTEX_Title");
|
||||
_("Received");
|
||||
_("Recieved");
|
||||
_("Recieved/Accepted");
|
||||
@ -412,17 +403,17 @@ _("Remark");
|
||||
_("Remark*");
|
||||
_("Remark-numbered");
|
||||
_("Remark-plain");
|
||||
_("Remarks");
|
||||
_("Remark-unnumbered");
|
||||
_("Remarks");
|
||||
_("RetourAdresse");
|
||||
_("ReturnAddress");
|
||||
_("REVTEX_Title");
|
||||
_("Right_Address");
|
||||
_("RightHeader");
|
||||
_("Right_Address");
|
||||
_("Rotatefoilhead");
|
||||
_("Running_LaTeX_Title");
|
||||
_("SCENE");
|
||||
_("SCENE*");
|
||||
_("SGML");
|
||||
_("Scrap");
|
||||
_("Section");
|
||||
_("Section*");
|
||||
@ -430,11 +421,10 @@ _("Section-numbered");
|
||||
_("Send");
|
||||
_("Send_To_Address");
|
||||
_("Seriate");
|
||||
_("SGML");
|
||||
_("ShortFoilhead");
|
||||
_("Shortfoilhead");
|
||||
_("ShortRotatefoilhead");
|
||||
_("ShortTitle");
|
||||
_("Shortfoilhead");
|
||||
_("Signature");
|
||||
_("Slide");
|
||||
_("Slide*");
|
||||
@ -450,26 +440,26 @@ _("State");
|
||||
_("Strasse");
|
||||
_("Street");
|
||||
_("Style");
|
||||
_("style");
|
||||
_("SubSection");
|
||||
_("SubTitle");
|
||||
_("Subitle");
|
||||
_("Subject");
|
||||
_("Subjectclass");
|
||||
_("Subparagraph");
|
||||
_("Subparagraph*");
|
||||
_("SubSection");
|
||||
_("Subsection");
|
||||
_("Subsection*");
|
||||
_("Subsection-numbered");
|
||||
_("Subsubsection");
|
||||
_("Subsubsection*");
|
||||
_("Subsubsection-numbered");
|
||||
_("SubTitle");
|
||||
_("Subtitle");
|
||||
_("Suggested");
|
||||
_("Summary");
|
||||
_("Summary-numbered");
|
||||
_("Surname");
|
||||
_("surname");
|
||||
_("TOC_Author");
|
||||
_("TOC_Title");
|
||||
_("TableComments");
|
||||
_("TableRefs");
|
||||
_("Telefax");
|
||||
@ -481,8 +471,8 @@ _("Theorem");
|
||||
_("Theorem*");
|
||||
_("Theorem-numbered");
|
||||
_("Theorem-plain");
|
||||
_("TheoremTemplate");
|
||||
_("Theorem-unnumbered");
|
||||
_("TheoremTemplate");
|
||||
_("Thesaurus");
|
||||
_("ThickLine");
|
||||
_("This");
|
||||
@ -490,29 +480,39 @@ _("ThreeAffiliations");
|
||||
_("ThreeAuthors");
|
||||
_("TickList");
|
||||
_("Title");
|
||||
_("Titlehead");
|
||||
_("Title_Running");
|
||||
_("TOC_Author");
|
||||
_("TOC_Title");
|
||||
_("Titlehead");
|
||||
_("Town");
|
||||
_("Transition");
|
||||
_("Trans_Keywords");
|
||||
_("Transition");
|
||||
_("Translated");
|
||||
_("TranslatedAbstract");
|
||||
_("Translated_Title");
|
||||
_("Translator");
|
||||
_("TwoAffiliations");
|
||||
_("TwoAuthors");
|
||||
_("URL");
|
||||
_("Unterschrift");
|
||||
_("Uppertitleback");
|
||||
_("URL");
|
||||
_("Use");
|
||||
_("Verbatim");
|
||||
_("Verse");
|
||||
_("Verteiler");
|
||||
_("VisibleText");
|
||||
_("YourMail");
|
||||
_("Yourmail");
|
||||
_("YourRef");
|
||||
_("Yourmail");
|
||||
_("Yourref");
|
||||
_("Zusatz");
|
||||
_("cc");
|
||||
_("encl");
|
||||
_("first");
|
||||
_("foilhead");
|
||||
_("journal");
|
||||
_("landscape");
|
||||
_("modying");
|
||||
_("msnumber");
|
||||
_("offsets");
|
||||
_("ps");
|
||||
_("style");
|
||||
_("surname");
|
||||
|
@ -1,9 +1,12 @@
|
||||
AUTOMAKE_OPTIONS = foreign 1.4
|
||||
DISTCLEANFILES= *.orig *.rej *~ *.bak core
|
||||
MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
|
||||
SUBDIRS = @FRONTEND@
|
||||
# xforms has to be fixed here as we still need object files in this directory
|
||||
# for the compilation of other frontends, so until that we have to let this
|
||||
# here.
|
||||
SUBDIRS = xforms @FRONTEND@
|
||||
ETAGS_ARGS = --lang=c++
|
||||
INCLUDES = ${FRONTEND_INCLUDES} -I${srcdir}/.. -I${srcdir}/@FRONTEND@ ${SIGC_CFLAGS}
|
||||
INCLUDES = ${FRONTEND_INCLUDES} -I${srcdir}/.. -I${srcdir}/@FRONTEND@ -I${srcdir}/xfroms ${SIGC_CFLAGS}
|
||||
LIBS =
|
||||
noinst_LTLIBRARIES = libfrontends.la
|
||||
libfrontends_la_SOURCES=\
|
||||
|
@ -1,13 +1,33 @@
|
||||
#include <config.h>
|
||||
#include FORMS_H_LOCATION
|
||||
|
||||
#include "Dialogs.h"
|
||||
#include "FormCopyright.h"
|
||||
#include "FormCitation.h"
|
||||
#include "FormDocument.h"
|
||||
#include "FormGraphics.h"
|
||||
#include "FormIndex.h"
|
||||
#include "FormPreferences.h"
|
||||
#include "FormPrint.h"
|
||||
#include "FormRef.h"
|
||||
#include "FormTabular.h"
|
||||
#include "FormToc.h"
|
||||
#include "FormUrl.h"
|
||||
|
||||
|
||||
Dialogs::Dialogs(LyXView * lv)
|
||||
{
|
||||
dialogs_.push_back(new FormCitation(lv, this));
|
||||
dialogs_.push_back(new FormCopyright(lv, this));
|
||||
//dialogs_.push_back(new FormPrint(lv, this));
|
||||
//dialogs_.push_back(new FormPreferences(lv, this));
|
||||
dialogs_.push_back(new FormDocument(lv, this));
|
||||
dialogs_.push_back(new FormGraphics(lv, this));
|
||||
dialogs_.push_back(new FormIndex(lv, this));
|
||||
dialogs_.push_back(new FormPreferences(lv, this));
|
||||
dialogs_.push_back(new FormPrint(lv, this));
|
||||
dialogs_.push_back(new FormRef(lv, this));
|
||||
dialogs_.push_back(new FormTabular(lv, this));
|
||||
dialogs_.push_back(new FormToc(lv, this));
|
||||
dialogs_.push_back(new FormUrl(lv, this));
|
||||
|
||||
// reduce the number of connections needed in
|
||||
// dialogs by a simple connection here.
|
||||
|
213
src/frontends/gnome/FormPrint.C
Normal file
213
src/frontends/gnome/FormPrint.C
Normal file
@ -0,0 +1,213 @@
|
||||
// -*- C++ -*-
|
||||
/* FormPrint.C
|
||||
* FormPrint Interface Class Implementation
|
||||
* This file is part of
|
||||
* ======================================================
|
||||
*
|
||||
* LyX, The Document Processor
|
||||
*
|
||||
* Copyright 2000 The LyX Team.
|
||||
*
|
||||
* ======================================================
|
||||
*/
|
||||
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation
|
||||
#endif
|
||||
|
||||
#include "FormPrint.h"
|
||||
#include "LyXView.h"
|
||||
#include "Dialogs.h"
|
||||
#include "lyxrc.h"
|
||||
#include "PrinterParams.h"
|
||||
#include "Liason.h"
|
||||
#include "debug.h"
|
||||
#include "BufferView.h"
|
||||
#include "lyx_gui_misc.h"
|
||||
#include "gettext.h"
|
||||
|
||||
extern "C" {
|
||||
#include "diaprint_interface.h"
|
||||
#include "support.h"
|
||||
}
|
||||
|
||||
#include <gtk--/base.h>
|
||||
#include <gtk--/button.h>
|
||||
|
||||
#ifdef SIGC_CXX_NAMESPACES
|
||||
using SigC::slot;
|
||||
using SigC::bind;
|
||||
#endif
|
||||
|
||||
#ifdef CXX_WORKING_NAMESPACES
|
||||
using Liason::printBuffer;
|
||||
using Liason::getPrinterParams;
|
||||
#endif
|
||||
|
||||
FormPrint::FormPrint(LyXView * lv, Dialogs * d)
|
||||
: dialog_(NULL), lv_(lv), d_(d), u_(0), h_(0)
|
||||
{
|
||||
// let the dialog be shown
|
||||
// This is a permanent connection so we won't bother
|
||||
// storing a copy because we won't be disconnecting.
|
||||
d->showPrint.connect(slot(this,&FormPrint::show));
|
||||
}
|
||||
|
||||
|
||||
FormPrint::~FormPrint()
|
||||
{
|
||||
hide();
|
||||
}
|
||||
|
||||
|
||||
void FormPrint::show()
|
||||
{
|
||||
Gtk::Button * b_ok;
|
||||
Gtk::Button * b_cancel;
|
||||
if (!dialog_)
|
||||
{
|
||||
GtkWidget * pd = create_DiaPrint();
|
||||
|
||||
dialog_ = Gtk::wrap(pd);
|
||||
print_all_ = Gtk::wrap( GTK_RADIO_BUTTON( lookup_widget(pd, "print_all") ) );
|
||||
print_odd_ = Gtk::wrap( GTK_RADIO_BUTTON( lookup_widget(pd, "print_odd") ) );
|
||||
print_even_ = Gtk::wrap( GTK_RADIO_BUTTON( lookup_widget(pd, "print_even") ) );
|
||||
|
||||
print_pages_ = Gtk::wrap( GTK_CHECK_BUTTON( lookup_widget(pd, "print_pages") ) );
|
||||
|
||||
print_from_ = Gtk::wrap( GTK_SPIN_BUTTON( lookup_widget(pd, "print_from") ) );
|
||||
print_to_ = Gtk::wrap( GTK_SPIN_BUTTON( lookup_widget(pd, "print_to") ) );
|
||||
|
||||
order_normal_ = Gtk::wrap( GTK_RADIO_BUTTON( lookup_widget(pd, "order_normal") ) );
|
||||
order_reverse_ = Gtk::wrap( GTK_RADIO_BUTTON( lookup_widget(pd, "order_reverse") ) );
|
||||
|
||||
copies_unsorted_ = Gtk::wrap( GTK_CHECK_BUTTON( lookup_widget(pd, "copies_unsorted") ) );
|
||||
copies_count_ = Gtk::wrap( GTK_SPIN_BUTTON( lookup_widget(pd, "copies_count") ) );
|
||||
|
||||
printto_printer_ = Gtk::wrap( GTK_RADIO_BUTTON( lookup_widget(pd, "printto_printer") ) );
|
||||
printto_file_ = Gtk::wrap( GTK_RADIO_BUTTON( lookup_widget(pd, "printto_file") ) );
|
||||
|
||||
printto_printcommand_ = Gtk::wrap( GNOME_ENTRY( lookup_widget(pd, "printto_printcommand") ) );
|
||||
printto_fileentry_ = Gtk::wrap( GNOME_FILE_ENTRY( lookup_widget(pd, "printto_fileentry") ) );
|
||||
|
||||
b_ok = Gtk::wrap( GTK_BUTTON( lookup_widget(pd, "button_print") ) );
|
||||
b_cancel = Gtk::wrap( GTK_BUTTON( lookup_widget(pd, "button_cancel") ) );
|
||||
|
||||
// setting up connections
|
||||
b_ok->clicked.connect(slot(this, &FormPrint::apply));
|
||||
b_ok->clicked.connect(dialog_->destroy.slot());
|
||||
b_cancel->clicked.connect(dialog_->destroy.slot());
|
||||
dialog_->destroy.connect(slot(this, &FormPrint::free));
|
||||
|
||||
u_ = d_->updateBufferDependent.connect(slot(this,
|
||||
&FormPrint::update));
|
||||
h_ = d_->hideBufferDependent.connect(dialog_->destroy.slot());
|
||||
|
||||
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 FormPrint::hide()
|
||||
{
|
||||
if (dialog_!=NULL) dialog_->destroy();
|
||||
}
|
||||
|
||||
void FormPrint::free()
|
||||
{
|
||||
if (dialog_!=NULL)
|
||||
{
|
||||
dialog_ = NULL;
|
||||
u_.disconnect();
|
||||
h_.disconnect();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void FormPrint::apply()
|
||||
{
|
||||
if (!lv_->view()->available()) return;
|
||||
|
||||
PrinterParams::WhichPages wp(PrinterParams::ALL);
|
||||
if (print_odd_->get_active()) wp = PrinterParams::ODD;
|
||||
else if (print_even_->get_active()) wp = PrinterParams::EVEN;
|
||||
|
||||
string from;
|
||||
int to(0);
|
||||
if (print_pages_->get_active())
|
||||
{
|
||||
from = print_from_->get_text();
|
||||
to = print_to_->get_value_as_int();
|
||||
}
|
||||
|
||||
PrinterParams::Target t(PrinterParams::PRINTER);
|
||||
if (printto_file_->get_active()) t = PrinterParams::FILE;
|
||||
|
||||
// we really should use the return value here I think.
|
||||
if (!printBuffer(lv_->buffer(),
|
||||
PrinterParams(t,
|
||||
printto_printcommand_->get_entry()->get_text(),
|
||||
printto_fileentry_->get_full_path(false),
|
||||
wp, from, to,
|
||||
order_reverse_->get_active(),
|
||||
copies_unsorted_->get_active(),
|
||||
copies_count_->get_value_as_int())))
|
||||
{
|
||||
WriteAlert(_("Error:"),
|
||||
_("Unable to print"),
|
||||
_("Check that your parameters are correct"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void FormPrint::update()
|
||||
{
|
||||
if (dialog_ != NULL &&
|
||||
lv_->view()->available())
|
||||
{
|
||||
PrinterParams pp(getPrinterParams(lv_->buffer()));
|
||||
|
||||
printto_printcommand_->get_entry()->set_text( pp.printer_name.c_str() );
|
||||
((Gtk::Entry *)printto_fileentry_->gtk_entry())->set_text(pp.file_name.c_str());
|
||||
|
||||
if (pp.target == PrinterParams::PRINTER) printto_printer_->set_active(true);
|
||||
else printto_file_->set_active(true);
|
||||
|
||||
if (pp.reverse_order) order_reverse_->set_active(true);
|
||||
else order_normal_->set_active(true);
|
||||
|
||||
switch (pp.which_pages)
|
||||
{
|
||||
case PrinterParams::ODD:
|
||||
print_odd_->set_active(true);
|
||||
break;
|
||||
|
||||
case PrinterParams::EVEN:
|
||||
print_even_->set_active(true);
|
||||
break;
|
||||
|
||||
case PrinterParams::ALL:
|
||||
default:
|
||||
print_all_->set_active(true);
|
||||
break;
|
||||
}
|
||||
|
||||
// hmmm... maybe a bit weird but maybe not
|
||||
// we might just be remembering the last
|
||||
// time this was printed.
|
||||
if (!pp.from_page.empty())
|
||||
{
|
||||
print_to_->set_value(pp.to_page);
|
||||
print_from_->set_value(strToInt(pp.from_page));
|
||||
}
|
||||
}
|
||||
}
|
108
src/frontends/gnome/FormPrint.h
Normal file
108
src/frontends/gnome/FormPrint.h
Normal file
@ -0,0 +1,108 @@
|
||||
// -*- C++ -*-
|
||||
/* This file is part of
|
||||
* ======================================================
|
||||
*
|
||||
* LyX, The Document Processor
|
||||
*
|
||||
* Copyright 2000 The LyX Team.
|
||||
*
|
||||
* ====================================================== */
|
||||
/* FormPrint.h
|
||||
* FormPrint Interface Class
|
||||
*/
|
||||
|
||||
#ifndef FORMPRINT_H
|
||||
#define FORMPRINT_H
|
||||
|
||||
#include "DialogBase.h"
|
||||
#include "support/utility.hpp"
|
||||
|
||||
#include <gtk--/widget.h>
|
||||
#include <gtk--/radiobutton.h>
|
||||
#include <gtk--/checkbutton.h>
|
||||
#include <gtk--/spinbutton.h>
|
||||
#include <gnome--/entry.h>
|
||||
#include <gnome--/file-entry.h>
|
||||
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
class LyXView;
|
||||
class Dialogs;
|
||||
|
||||
#ifdef SIGC_CXX_NAMESPACES
|
||||
using SigC::Connection;
|
||||
#endif
|
||||
|
||||
/** This class provides an Gnome implementation of the FormPrint Dialog.
|
||||
The print dialog allows users to print their documents.
|
||||
*/
|
||||
class FormPrint : public DialogBase, public noncopyable {
|
||||
public:
|
||||
/**@name Constructors and Destructors */
|
||||
//@{
|
||||
/// #FormPrint x(LyXFunc ..., Dialogs ...);#
|
||||
FormPrint(LyXView *, Dialogs *);
|
||||
///
|
||||
~FormPrint();
|
||||
//@}
|
||||
|
||||
|
||||
private:
|
||||
/**@name Slot Methods */
|
||||
//@{
|
||||
/// Create the dialog if necessary, update it and display it.
|
||||
void show();
|
||||
/// Hide the dialog.
|
||||
void hide();
|
||||
/// Update the dialog.
|
||||
void update();
|
||||
/// Free memory
|
||||
void free();
|
||||
//@}
|
||||
|
||||
/**@name Dialog internal methods */
|
||||
//@{
|
||||
/// Apply from dialog
|
||||
void apply();
|
||||
//@}
|
||||
|
||||
/**@name Private Data */
|
||||
//@{
|
||||
/// Real GUI implementation.
|
||||
Gtk::Widget * dialog_;
|
||||
|
||||
Gtk::RadioButton * print_all_;
|
||||
Gtk::RadioButton * print_odd_;
|
||||
Gtk::RadioButton * print_even_;
|
||||
|
||||
Gtk::CheckButton * print_pages_;
|
||||
|
||||
Gtk::SpinButton * print_from_;
|
||||
Gtk::SpinButton * print_to_;
|
||||
|
||||
Gtk::RadioButton * order_normal_;
|
||||
Gtk::RadioButton * order_reverse_;
|
||||
|
||||
Gtk::CheckButton * copies_unsorted_;
|
||||
Gtk::SpinButton * copies_count_;
|
||||
|
||||
Gtk::RadioButton * printto_printer_;
|
||||
Gtk::RadioButton * printto_file_;
|
||||
|
||||
Gnome::Entry * printto_printcommand_;
|
||||
Gnome::FileEntry * printto_fileentry_;
|
||||
|
||||
/// Which LyXView do we belong to?
|
||||
LyXView * lv_;
|
||||
Dialogs * d_;
|
||||
/// Update connection.
|
||||
Connection u_;
|
||||
/// Hide connection.
|
||||
Connection h_;
|
||||
//@}
|
||||
};
|
||||
|
||||
#endif
|
163
src/frontends/gnome/FormUrl.C
Normal file
163
src/frontends/gnome/FormUrl.C
Normal file
@ -0,0 +1,163 @@
|
||||
// -*- C++ -*-
|
||||
/* This file is part of
|
||||
* ======================================================
|
||||
*
|
||||
* LyX, The Document Processor
|
||||
*
|
||||
* Copyright 2000 The LyX Team.
|
||||
*
|
||||
* ======================================================
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation
|
||||
#endif
|
||||
|
||||
|
||||
#include "gettext.h"
|
||||
#include "Dialogs.h"
|
||||
#include "FormUrl.h"
|
||||
#include "LyXView.h"
|
||||
#include "buffer.h"
|
||||
#include "lyxfunc.h"
|
||||
|
||||
extern "C" {
|
||||
#include "diainserturl_interface.h"
|
||||
#include "support.h"
|
||||
}
|
||||
|
||||
#include <gtk--/base.h>
|
||||
|
||||
FormUrl::FormUrl(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->showUrl.connect(slot(this, &FormUrl::showInset));
|
||||
d->createUrl.connect(slot(this, &FormUrl::createInset));
|
||||
}
|
||||
|
||||
|
||||
FormUrl::~FormUrl()
|
||||
{
|
||||
hide();
|
||||
}
|
||||
|
||||
void FormUrl::showInset( InsetCommand * const inset )
|
||||
{
|
||||
if( dialog_!=NULL || inset == 0 ) return;
|
||||
|
||||
inset_ = inset;
|
||||
ih_ = inset_->hide.connect(slot(this, &FormUrl::hide));
|
||||
|
||||
params = inset->params();
|
||||
show();
|
||||
}
|
||||
|
||||
|
||||
void FormUrl::createInset( string const & arg )
|
||||
{
|
||||
if( dialog_!=NULL ) return;
|
||||
|
||||
params.setFromString( arg );
|
||||
show();
|
||||
}
|
||||
|
||||
void FormUrl::show()
|
||||
{
|
||||
if (!dialog_)
|
||||
{
|
||||
GtkWidget * pd = create_DiaInsertUrl();
|
||||
|
||||
dialog_ = Gtk::wrap(pd);
|
||||
url_ = Gtk::wrap( GNOME_ENTRY( lookup_widget(pd, "url") ) );
|
||||
name_ = Gtk::wrap( GNOME_ENTRY( lookup_widget(pd, "name") ) );
|
||||
html_type_ = Gtk::wrap( GTK_CHECK_BUTTON( lookup_widget(pd, "html_type") ) );
|
||||
|
||||
b_ok = Gtk::wrap( GTK_BUTTON( lookup_widget(pd, "button_ok") ) );
|
||||
b_cancel = Gtk::wrap( GTK_BUTTON( lookup_widget(pd, "button_cancel") ) );
|
||||
|
||||
b_ok->clicked.connect(slot(this, &FormUrl::apply));
|
||||
b_ok->clicked.connect(dialog_->destroy.slot());
|
||||
b_cancel->clicked.connect(dialog_->destroy.slot());
|
||||
dialog_->destroy.connect(slot(this, &FormUrl::free));
|
||||
|
||||
u_ = d_->updateBufferDependent.connect(slot(this, &FormUrl::update));
|
||||
h_ = d_->hideBufferDependent.connect(slot(this, &FormUrl::hide));
|
||||
|
||||
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 FormUrl::update()
|
||||
{
|
||||
if (dialog_ != NULL &&
|
||||
lv_->view()->available())
|
||||
{
|
||||
url_->get_entry()->set_text(params.getContents().c_str());
|
||||
name_->get_entry()->set_text(params.getOptions().c_str());
|
||||
|
||||
html_type_->set_active( (params.getCmdName() == "htmlurl") );
|
||||
|
||||
bool sens = (!(lv_->buffer()->isReadonly()));
|
||||
|
||||
html_type_->set_sensitive(sens);
|
||||
url_->set_sensitive(sens);
|
||||
name_->set_sensitive(sens);
|
||||
b_ok->set_sensitive(sens);
|
||||
}
|
||||
}
|
||||
|
||||
void FormUrl::hide()
|
||||
{
|
||||
if (dialog_!=NULL) dialog_->destroy();
|
||||
}
|
||||
|
||||
void FormUrl::free()
|
||||
{
|
||||
if (dialog_!=NULL)
|
||||
{
|
||||
dialog_ = NULL;
|
||||
u_.disconnect();
|
||||
h_.disconnect();
|
||||
inset_ = 0;
|
||||
ih_.disconnect();
|
||||
}
|
||||
}
|
||||
|
||||
void FormUrl::apply()
|
||||
{
|
||||
if( lv_->buffer()->isReadonly() ) return;
|
||||
|
||||
params.setContents( url_->get_entry()->get_text() );
|
||||
params.setOptions( name_->get_entry()->get_text() );
|
||||
|
||||
if (html_type_->get_active())
|
||||
params.setCmdName("htmlurl");
|
||||
else
|
||||
params.setCmdName("url");
|
||||
|
||||
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_INSERT_URL,
|
||||
params.getAsString().c_str() );
|
||||
}
|
||||
}
|
90
src/frontends/gnome/FormUrl.h
Normal file
90
src/frontends/gnome/FormUrl.h
Normal file
@ -0,0 +1,90 @@
|
||||
// -*- C++ -*-
|
||||
/* This file is part of
|
||||
* ======================================================
|
||||
*
|
||||
* LyX, The Document Processor
|
||||
*
|
||||
* Copyright 2000 The LyX Team.
|
||||
*
|
||||
* ======================================================
|
||||
*/
|
||||
|
||||
#ifndef FORMURL_H
|
||||
#define FORMURL_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--/checkbutton.h>
|
||||
#include <gnome--/entry.h>
|
||||
#include <gtk--/button.h>
|
||||
|
||||
/** This class provides an Gnome implementation of the FormUrl Dialog.
|
||||
*/
|
||||
class FormUrl : public DialogBase, public noncopyable {
|
||||
public:
|
||||
/**@name Constructors and Destructors */
|
||||
//@{
|
||||
///
|
||||
FormUrl(LyXView *, Dialogs *);
|
||||
///
|
||||
~FormUrl();
|
||||
//@}
|
||||
|
||||
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();
|
||||
|
||||
/** 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::CheckButton * html_type_;
|
||||
|
||||
Gnome::Entry * url_;
|
||||
Gnome::Entry * name_;
|
||||
|
||||
Gtk::Button * b_ok;
|
||||
Gtk::Button * b_cancel;
|
||||
};
|
||||
|
||||
#endif
|
@ -3,22 +3,55 @@ DISTCLEANFILES= *.orig *.rej *~ *.bak core
|
||||
MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
|
||||
noinst_LTLIBRARIES = libgnome.la
|
||||
INCLUDES = ${FRONTEND_INCLUDES} -I${top_srcdir}/src/ \
|
||||
-I${top_srcdir}/src/frontends/ \
|
||||
-I${top_srcdir}/src/frontends/ -I${top_srcdir}/src/frontends/xforms \
|
||||
${SIGC_CFLAGS}
|
||||
LIBS=
|
||||
LDFLAGS=
|
||||
libgnome_la_OBJADD = \
|
||||
../xforms/FormCitation.lo \
|
||||
../xforms/form_citation.lo \
|
||||
../xforms/FormCommand.lo \
|
||||
../xforms/FormDocument.lo \
|
||||
../xforms/form_document.lo \
|
||||
../xforms/FormGraphics.lo \
|
||||
../xforms/form_graphics.lo \
|
||||
../xforms/FormIndex.lo \
|
||||
../xforms/form_index.lo \
|
||||
../xforms/FormPreferences.lo \
|
||||
../xforms/form_preferences.lo \
|
||||
../xforms/FormRef.lo \
|
||||
../xforms/form_ref.lo \
|
||||
../xforms/FormTabular.lo \
|
||||
../xforms/form_tabular.lo \
|
||||
../xforms/FormToc.lo \
|
||||
../xforms/form_toc.lo \
|
||||
../xforms/input_validators.lo \
|
||||
../xforms/RadioButtonGroup.lo \
|
||||
../xforms/Toolbar_pimpl.lo
|
||||
LIBS=
|
||||
LDFLAGS= $(libgnome_la_OBJADD)
|
||||
LYXDATADIRS =
|
||||
ETAGS_ARGS = --lang=c++
|
||||
#ETAGS_ARGS = --lang=c++
|
||||
libgnome_la_SOURCES = \
|
||||
Dialogs.C \
|
||||
FormCopyright.C \
|
||||
FormCopyright.h \
|
||||
FormPrint.C \
|
||||
FormPrint.h \
|
||||
FormUrl.C \
|
||||
FormUrl.h \
|
||||
Menubar_pimpl.C \
|
||||
Menubar_pimpl.h \
|
||||
Toolbar_pimpl.C \
|
||||
Toolbar_pimpl.h \
|
||||
mainapp.C \
|
||||
mainapp.h
|
||||
mainapp.h \
|
||||
support.c \
|
||||
support.h \
|
||||
diaprint_callbacks.c \
|
||||
diaprint_callbacks.h \
|
||||
diaprint_interface.c \
|
||||
diaprint_interface.h \
|
||||
diainserturl_callbacks.c \
|
||||
diainserturl_interface.c \
|
||||
diainserturl_callbacks.h \
|
||||
diainserturl_interface.h
|
||||
|
||||
# These still have to be added. Sooner or later. ARRae-20000411
|
||||
# GUI_defaults.C \
|
||||
|
19
src/frontends/gnome/diainserturl_callbacks.c
Normal file
19
src/frontends/gnome/diainserturl_callbacks.c
Normal file
@ -0,0 +1,19 @@
|
||||
/* This file is part of
|
||||
* ======================================================
|
||||
*
|
||||
* LyX, The Document Processor
|
||||
*
|
||||
* Copyright 2000 The LyX Team.
|
||||
*
|
||||
* ====================================================== */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <gnome.h>
|
||||
|
||||
#include "diainserturl_callbacks.h"
|
||||
#include "diainserturl_interface.h"
|
||||
#include "support.h"
|
||||
|
11
src/frontends/gnome/diainserturl_callbacks.h
Normal file
11
src/frontends/gnome/diainserturl_callbacks.h
Normal file
@ -0,0 +1,11 @@
|
||||
/* This file is part of
|
||||
* ======================================================
|
||||
*
|
||||
* LyX, The Document Processor
|
||||
*
|
||||
* Copyright 2000 The LyX Team.
|
||||
*
|
||||
* ====================================================== */
|
||||
|
||||
#include <gnome.h>
|
||||
|
159
src/frontends/gnome/diainserturl_interface.c
Normal file
159
src/frontends/gnome/diainserturl_interface.c
Normal file
@ -0,0 +1,159 @@
|
||||
/*
|
||||
* 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 "diainserturl_callbacks.h"
|
||||
#include "diainserturl_interface.h"
|
||||
#include "support.h"
|
||||
|
||||
GtkWidget*
|
||||
create_DiaInsertUrl (void)
|
||||
{
|
||||
GtkWidget *DiaInsertUrl;
|
||||
GtkWidget *dialog_vbox1;
|
||||
GtkWidget *vbox1;
|
||||
GtkWidget *table1;
|
||||
GtkWidget *label2;
|
||||
GtkWidget *label1;
|
||||
GtkWidget *url;
|
||||
GtkWidget *combo_entry1;
|
||||
GtkWidget *name;
|
||||
GtkWidget *combo_entry2;
|
||||
guint html_type_key;
|
||||
GtkWidget *html_type;
|
||||
GtkWidget *dialog_action_area1;
|
||||
GtkWidget *button_ok;
|
||||
GtkWidget *button_cancel;
|
||||
GtkAccelGroup *accel_group;
|
||||
|
||||
accel_group = gtk_accel_group_new ();
|
||||
|
||||
DiaInsertUrl = gnome_dialog_new (_("Insert URL"), NULL);
|
||||
gtk_object_set_data (GTK_OBJECT (DiaInsertUrl), "DiaInsertUrl", DiaInsertUrl);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (DiaInsertUrl), 2);
|
||||
GTK_WINDOW (DiaInsertUrl)->type = GTK_WINDOW_DIALOG;
|
||||
gtk_window_set_policy (GTK_WINDOW (DiaInsertUrl), FALSE, FALSE, FALSE);
|
||||
|
||||
dialog_vbox1 = GNOME_DIALOG (DiaInsertUrl)->vbox;
|
||||
gtk_object_set_data (GTK_OBJECT (DiaInsertUrl), "dialog_vbox1", dialog_vbox1);
|
||||
gtk_widget_show (dialog_vbox1);
|
||||
|
||||
vbox1 = gtk_vbox_new (FALSE, 2);
|
||||
gtk_widget_ref (vbox1);
|
||||
gtk_object_set_data_full (GTK_OBJECT (DiaInsertUrl), "vbox1", vbox1,
|
||||
(GtkDestroyNotify) gtk_widget_unref);
|
||||
gtk_widget_show (vbox1);
|
||||
gtk_box_pack_start (GTK_BOX (dialog_vbox1), vbox1, TRUE, TRUE, 0);
|
||||
|
||||
table1 = gtk_table_new (2, 2, FALSE);
|
||||
gtk_widget_ref (table1);
|
||||
gtk_object_set_data_full (GTK_OBJECT (DiaInsertUrl), "table1", table1,
|
||||
(GtkDestroyNotify) gtk_widget_unref);
|
||||
gtk_widget_show (table1);
|
||||
gtk_box_pack_start (GTK_BOX (vbox1), table1, TRUE, TRUE, 0);
|
||||
gtk_table_set_row_spacings (GTK_TABLE (table1), 2);
|
||||
gtk_table_set_col_spacings (GTK_TABLE (table1), 2);
|
||||
|
||||
label2 = gtk_label_new (_("Name"));
|
||||
gtk_widget_ref (label2);
|
||||
gtk_object_set_data_full (GTK_OBJECT (DiaInsertUrl), "label2", label2,
|
||||
(GtkDestroyNotify) gtk_widget_unref);
|
||||
gtk_widget_show (label2);
|
||||
gtk_table_attach (GTK_TABLE (table1), label2, 0, 1, 1, 2,
|
||||
(GtkAttachOptions) (0),
|
||||
(GtkAttachOptions) (0), 0, 0);
|
||||
gtk_label_set_justify (GTK_LABEL (label2), GTK_JUSTIFY_LEFT);
|
||||
|
||||
label1 = gtk_label_new (_("URL"));
|
||||
gtk_widget_ref (label1);
|
||||
gtk_object_set_data_full (GTK_OBJECT (DiaInsertUrl), "label1", label1,
|
||||
(GtkDestroyNotify) gtk_widget_unref);
|
||||
gtk_widget_show (label1);
|
||||
gtk_table_attach (GTK_TABLE (table1), label1, 0, 1, 0, 1,
|
||||
(GtkAttachOptions) (GTK_FILL),
|
||||
(GtkAttachOptions) (0), 0, 0);
|
||||
gtk_label_set_justify (GTK_LABEL (label1), GTK_JUSTIFY_LEFT);
|
||||
|
||||
url = gnome_entry_new ("diainserturl_url");
|
||||
gtk_widget_ref (url);
|
||||
gtk_object_set_data_full (GTK_OBJECT (DiaInsertUrl), "url", url,
|
||||
(GtkDestroyNotify) gtk_widget_unref);
|
||||
gtk_widget_show (url);
|
||||
gtk_table_attach (GTK_TABLE (table1), url, 1, 2, 0, 1,
|
||||
(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
|
||||
(GtkAttachOptions) (0), 0, 0);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (url), 1);
|
||||
|
||||
combo_entry1 = gnome_entry_gtk_entry (GNOME_ENTRY (url));
|
||||
gtk_widget_ref (combo_entry1);
|
||||
gtk_object_set_data_full (GTK_OBJECT (DiaInsertUrl), "combo_entry1", combo_entry1,
|
||||
(GtkDestroyNotify) gtk_widget_unref);
|
||||
gtk_widget_show (combo_entry1);
|
||||
|
||||
name = gnome_entry_new ("diainserturl_name");
|
||||
gtk_widget_ref (name);
|
||||
gtk_object_set_data_full (GTK_OBJECT (DiaInsertUrl), "name", name,
|
||||
(GtkDestroyNotify) gtk_widget_unref);
|
||||
gtk_widget_show (name);
|
||||
gtk_table_attach (GTK_TABLE (table1), name, 1, 2, 1, 2,
|
||||
(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
|
||||
(GtkAttachOptions) (0), 0, 0);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (name), 1);
|
||||
|
||||
combo_entry2 = gnome_entry_gtk_entry (GNOME_ENTRY (name));
|
||||
gtk_widget_ref (combo_entry2);
|
||||
gtk_object_set_data_full (GTK_OBJECT (DiaInsertUrl), "combo_entry2", combo_entry2,
|
||||
(GtkDestroyNotify) gtk_widget_unref);
|
||||
gtk_widget_show (combo_entry2);
|
||||
|
||||
html_type = gtk_check_button_new_with_label ("");
|
||||
html_type_key = gtk_label_parse_uline (GTK_LABEL (GTK_BIN (html_type)->child),
|
||||
_("_HTML type"));
|
||||
gtk_widget_add_accelerator (html_type, "clicked", accel_group,
|
||||
html_type_key, GDK_MOD1_MASK, 0);
|
||||
gtk_widget_ref (html_type);
|
||||
gtk_object_set_data_full (GTK_OBJECT (DiaInsertUrl), "html_type", html_type,
|
||||
(GtkDestroyNotify) gtk_widget_unref);
|
||||
gtk_widget_show (html_type);
|
||||
gtk_box_pack_start (GTK_BOX (vbox1), html_type, FALSE, FALSE, 0);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (html_type), 2);
|
||||
|
||||
dialog_action_area1 = GNOME_DIALOG (DiaInsertUrl)->action_area;
|
||||
gtk_object_set_data (GTK_OBJECT (DiaInsertUrl), "dialog_action_area1", dialog_action_area1);
|
||||
gtk_widget_show (dialog_action_area1);
|
||||
gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area1), GTK_BUTTONBOX_END);
|
||||
gtk_button_box_set_spacing (GTK_BUTTON_BOX (dialog_action_area1), 8);
|
||||
|
||||
gnome_dialog_append_button (GNOME_DIALOG (DiaInsertUrl), GNOME_STOCK_BUTTON_OK);
|
||||
button_ok = g_list_last (GNOME_DIALOG (DiaInsertUrl)->buttons)->data;
|
||||
gtk_widget_ref (button_ok);
|
||||
gtk_object_set_data_full (GTK_OBJECT (DiaInsertUrl), "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 (DiaInsertUrl), GNOME_STOCK_BUTTON_CANCEL);
|
||||
button_cancel = g_list_last (GNOME_DIALOG (DiaInsertUrl)->buttons)->data;
|
||||
gtk_widget_ref (button_cancel);
|
||||
gtk_object_set_data_full (GTK_OBJECT (DiaInsertUrl), "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_default (button_ok);
|
||||
gtk_window_add_accel_group (GTK_WINDOW (DiaInsertUrl), accel_group);
|
||||
|
||||
return DiaInsertUrl;
|
||||
}
|
||||
|
5
src/frontends/gnome/diainserturl_interface.h
Normal file
5
src/frontends/gnome/diainserturl_interface.h
Normal file
@ -0,0 +1,5 @@
|
||||
/*
|
||||
* DO NOT EDIT THIS FILE - it is generated by Glade.
|
||||
*/
|
||||
|
||||
GtkWidget* create_DiaInsertUrl (void);
|
245
src/frontends/gnome/dialogs/diainserturl.glade
Normal file
245
src/frontends/gnome/dialogs/diainserturl.glade
Normal file
@ -0,0 +1,245 @@
|
||||
<?xml version="1.0"?>
|
||||
<GTK-Interface>
|
||||
|
||||
<project>
|
||||
<name>diainserturl</name>
|
||||
<program_name>diainserturl</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>diainserturl_interface.c</main_source_file>
|
||||
<main_header_file>diainserturl_interface.h</main_header_file>
|
||||
<handler_source_file>diainserturl_callbacks.c</handler_source_file>
|
||||
<handler_header_file>diainserturl_callbacks.h</handler_header_file>
|
||||
</project>
|
||||
|
||||
<widget>
|
||||
<class>GnomeDialog</class>
|
||||
<name>DiaInsertUrl</name>
|
||||
<border_width>2</border_width>
|
||||
<title>Insert URL</title>
|
||||
<type>GTK_WINDOW_DIALOG</type>
|
||||
<position>GTK_WIN_POS_NONE</position>
|
||||
<modal>False</modal>
|
||||
<allow_shrink>False</allow_shrink>
|
||||
<allow_grow>False</allow_grow>
|
||||
<auto_shrink>False</auto_shrink>
|
||||
<auto_close>False</auto_close>
|
||||
<hide_on_close>False</hide_on_close>
|
||||
|
||||
<widget>
|
||||
<class>GtkVBox</class>
|
||||
<child_name>GnomeDialog:vbox</child_name>
|
||||
<name>dialog-vbox1</name>
|
||||
<homogeneous>False</homogeneous>
|
||||
<spacing>8</spacing>
|
||||
<child>
|
||||
<padding>4</padding>
|
||||
<expand>True</expand>
|
||||
<fill>True</fill>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>GtkHButtonBox</class>
|
||||
<child_name>GnomeDialog:action_area</child_name>
|
||||
<name>dialog-action_area1</name>
|
||||
<layout_style>GTK_BUTTONBOX_END</layout_style>
|
||||
<spacing>8</spacing>
|
||||
<child_min_width>85</child_min_width>
|
||||
<child_min_height>27</child_min_height>
|
||||
<child_ipad_x>7</child_ipad_x>
|
||||
<child_ipad_y>0</child_ipad_y>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<fill>True</fill>
|
||||
<pack>GTK_PACK_END</pack>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>GtkButton</class>
|
||||
<name>button_ok</name>
|
||||
<can_default>True</can_default>
|
||||
<has_default>True</has_default>
|
||||
<can_focus>True</can_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>vbox1</name>
|
||||
<homogeneous>False</homogeneous>
|
||||
<spacing>2</spacing>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>True</expand>
|
||||
<fill>True</fill>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>GtkTable</class>
|
||||
<name>table1</name>
|
||||
<rows>2</rows>
|
||||
<columns>2</columns>
|
||||
<homogeneous>False</homogeneous>
|
||||
<row_spacing>2</row_spacing>
|
||||
<column_spacing>2</column_spacing>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>True</expand>
|
||||
<fill>True</fill>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>GtkLabel</class>
|
||||
<name>label2</name>
|
||||
<label>Name</label>
|
||||
<justify>GTK_JUSTIFY_LEFT</justify>
|
||||
<wrap>False</wrap>
|
||||
<xalign>0.5</xalign>
|
||||
<yalign>0.5</yalign>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
<child>
|
||||
<left_attach>0</left_attach>
|
||||
<right_attach>1</right_attach>
|
||||
<top_attach>1</top_attach>
|
||||
<bottom_attach>2</bottom_attach>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
<xexpand>False</xexpand>
|
||||
<yexpand>False</yexpand>
|
||||
<xshrink>False</xshrink>
|
||||
<yshrink>False</yshrink>
|
||||
<xfill>False</xfill>
|
||||
<yfill>False</yfill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkLabel</class>
|
||||
<name>label1</name>
|
||||
<label>URL</label>
|
||||
<justify>GTK_JUSTIFY_LEFT</justify>
|
||||
<wrap>False</wrap>
|
||||
<xalign>0.5</xalign>
|
||||
<yalign>0.5</yalign>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
<child>
|
||||
<left_attach>0</left_attach>
|
||||
<right_attach>1</right_attach>
|
||||
<top_attach>0</top_attach>
|
||||
<bottom_attach>1</bottom_attach>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
<xexpand>False</xexpand>
|
||||
<yexpand>False</yexpand>
|
||||
<xshrink>False</xshrink>
|
||||
<yshrink>False</yshrink>
|
||||
<xfill>True</xfill>
|
||||
<yfill>False</yfill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GnomeEntry</class>
|
||||
<name>url</name>
|
||||
<border_width>1</border_width>
|
||||
<history_id>diainserturl_url</history_id>
|
||||
<max_saved>10</max_saved>
|
||||
<child>
|
||||
<left_attach>1</left_attach>
|
||||
<right_attach>2</right_attach>
|
||||
<top_attach>0</top_attach>
|
||||
<bottom_attach>1</bottom_attach>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
<xexpand>True</xexpand>
|
||||
<yexpand>False</yexpand>
|
||||
<xshrink>False</xshrink>
|
||||
<yshrink>False</yshrink>
|
||||
<xfill>True</xfill>
|
||||
<yfill>False</yfill>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<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>GnomeEntry</class>
|
||||
<name>name</name>
|
||||
<border_width>1</border_width>
|
||||
<history_id>diainserturl_name</history_id>
|
||||
<max_saved>10</max_saved>
|
||||
<child>
|
||||
<left_attach>1</left_attach>
|
||||
<right_attach>2</right_attach>
|
||||
<top_attach>1</top_attach>
|
||||
<bottom_attach>2</bottom_attach>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
<xexpand>True</xexpand>
|
||||
<yexpand>False</yexpand>
|
||||
<xshrink>False</xshrink>
|
||||
<yshrink>False</yshrink>
|
||||
<xfill>True</xfill>
|
||||
<yfill>False</yfill>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>GtkEntry</class>
|
||||
<child_name>GnomeEntry:entry</child_name>
|
||||
<name>combo-entry2</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>
|
||||
<class>GtkCheckButton</class>
|
||||
<name>html_type</name>
|
||||
<border_width>2</border_width>
|
||||
<can_focus>True</can_focus>
|
||||
<label>_HTML type</label>
|
||||
<active>False</active>
|
||||
<draw_indicator>True</draw_indicator>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<fill>False</fill>
|
||||
</child>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
</GTK-Interface>
|
598
src/frontends/gnome/dialogs/diaprint.glade
Normal file
598
src/frontends/gnome/dialogs/diaprint.glade
Normal file
@ -0,0 +1,598 @@
|
||||
<?xml version="1.0"?>
|
||||
<GTK-Interface>
|
||||
|
||||
<project>
|
||||
<name>Project2</name>
|
||||
<program_name>project2</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_build_files>False</output_build_files>
|
||||
<main_source_file>diaprint_interface.c</main_source_file>
|
||||
<main_header_file>diaprint_interface.h</main_header_file>
|
||||
<handler_source_file>diaprint_callbacks.c</handler_source_file>
|
||||
<handler_header_file>diaprint_callbacks.h</handler_header_file>
|
||||
</project>
|
||||
|
||||
<widget>
|
||||
<class>GnomeDialog</class>
|
||||
<name>DiaPrint</name>
|
||||
<border_width>2</border_width>
|
||||
<signal>
|
||||
<name>show</name>
|
||||
<handler>diaprint_on_diaprint_show</handler>
|
||||
<last_modification_time>Sat, 12 Aug 2000 07:05:03 GMT</last_modification_time>
|
||||
</signal>
|
||||
<title>Print</title>
|
||||
<type>GTK_WINDOW_DIALOG</type>
|
||||
<position>GTK_WIN_POS_NONE</position>
|
||||
<modal>False</modal>
|
||||
<allow_shrink>False</allow_shrink>
|
||||
<allow_grow>False</allow_grow>
|
||||
<auto_shrink>False</auto_shrink>
|
||||
<auto_close>False</auto_close>
|
||||
<hide_on_close>False</hide_on_close>
|
||||
|
||||
<widget>
|
||||
<class>GtkVBox</class>
|
||||
<child_name>GnomeDialog:vbox</child_name>
|
||||
<name>dialog-vbox1</name>
|
||||
<homogeneous>False</homogeneous>
|
||||
<spacing>8</spacing>
|
||||
<child>
|
||||
<padding>4</padding>
|
||||
<expand>True</expand>
|
||||
<fill>True</fill>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>GtkHButtonBox</class>
|
||||
<child_name>GnomeDialog:action_area</child_name>
|
||||
<name>dialog-action_area1</name>
|
||||
<layout_style>GTK_BUTTONBOX_END</layout_style>
|
||||
<spacing>8</spacing>
|
||||
<child_min_width>85</child_min_width>
|
||||
<child_min_height>27</child_min_height>
|
||||
<child_ipad_x>7</child_ipad_x>
|
||||
<child_ipad_y>0</child_ipad_y>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<fill>True</fill>
|
||||
<pack>GTK_PACK_END</pack>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>GtkButton</class>
|
||||
<name>button_print</name>
|
||||
<can_default>True</can_default>
|
||||
<has_default>True</has_default>
|
||||
<can_focus>True</can_focus>
|
||||
<has_focus>True</has_focus>
|
||||
<label>Print</label>
|
||||
<stock_pixmap>GNOME_STOCK_PIXMAP_PRINT</stock_pixmap>
|
||||
</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>vbox1</name>
|
||||
<homogeneous>False</homogeneous>
|
||||
<spacing>0</spacing>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>True</expand>
|
||||
<fill>True</fill>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>GtkHBox</class>
|
||||
<name>hbox1</name>
|
||||
<homogeneous>False</homogeneous>
|
||||
<spacing>0</spacing>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>True</expand>
|
||||
<fill>True</fill>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>GtkFrame</class>
|
||||
<name>frame2</name>
|
||||
<border_width>2</border_width>
|
||||
<label>Print</label>
|
||||
<label_xalign>0</label_xalign>
|
||||
<shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>True</expand>
|
||||
<fill>True</fill>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>GtkVBox</class>
|
||||
<name>vbox2</name>
|
||||
<homogeneous>False</homogeneous>
|
||||
<spacing>0</spacing>
|
||||
|
||||
<widget>
|
||||
<class>GtkRadioButton</class>
|
||||
<name>print_all</name>
|
||||
<can_focus>True</can_focus>
|
||||
<label>All Pa_ges</label>
|
||||
<active>False</active>
|
||||
<draw_indicator>True</draw_indicator>
|
||||
<group>print</group>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<fill>False</fill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkRadioButton</class>
|
||||
<name>print_odd</name>
|
||||
<can_focus>True</can_focus>
|
||||
<label>_Only Odd Pages</label>
|
||||
<active>False</active>
|
||||
<draw_indicator>True</draw_indicator>
|
||||
<group>print</group>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<fill>False</fill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkRadioButton</class>
|
||||
<name>print_even</name>
|
||||
<can_focus>True</can_focus>
|
||||
<label>Only _Even Pages</label>
|
||||
<active>False</active>
|
||||
<draw_indicator>True</draw_indicator>
|
||||
<group>print</group>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<fill>False</fill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkHBox</class>
|
||||
<name>hbox2</name>
|
||||
<homogeneous>False</homogeneous>
|
||||
<spacing>0</spacing>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>True</expand>
|
||||
<fill>True</fill>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>GtkCheckButton</class>
|
||||
<name>print_pages</name>
|
||||
<can_focus>True</can_focus>
|
||||
<signal>
|
||||
<name>toggled</name>
|
||||
<handler>diaprint_on_print_pages_toggled</handler>
|
||||
<last_modification_time>Sun, 13 Aug 2000 07:14:15 GMT</last_modification_time>
|
||||
</signal>
|
||||
<label>Page_s</label>
|
||||
<active>False</active>
|
||||
<draw_indicator>True</draw_indicator>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<fill>False</fill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkLabel</class>
|
||||
<name>label1</name>
|
||||
<label>from</label>
|
||||
<justify>GTK_JUSTIFY_CENTER</justify>
|
||||
<wrap>False</wrap>
|
||||
<xalign>0.5</xalign>
|
||||
<yalign>0.5</yalign>
|
||||
<xpad>1</xpad>
|
||||
<ypad>0</ypad>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<fill>False</fill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkSpinButton</class>
|
||||
<name>print_from</name>
|
||||
<can_focus>True</can_focus>
|
||||
<signal>
|
||||
<name>changed</name>
|
||||
<handler>diaprint_on_print_from_changed</handler>
|
||||
<last_modification_time>Sun, 13 Aug 2000 10:34:42 GMT</last_modification_time>
|
||||
</signal>
|
||||
<climb_rate>1</climb_rate>
|
||||
<digits>0</digits>
|
||||
<numeric>True</numeric>
|
||||
<update_policy>GTK_UPDATE_ALWAYS</update_policy>
|
||||
<snap>False</snap>
|
||||
<wrap>False</wrap>
|
||||
<value>1</value>
|
||||
<lower>1</lower>
|
||||
<upper>100000</upper>
|
||||
<step>1</step>
|
||||
<page>10</page>
|
||||
<page_size>10</page_size>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<fill>False</fill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkLabel</class>
|
||||
<name>label2</name>
|
||||
<label>to</label>
|
||||
<justify>GTK_JUSTIFY_CENTER</justify>
|
||||
<wrap>False</wrap>
|
||||
<xalign>0.5</xalign>
|
||||
<yalign>0.5</yalign>
|
||||
<xpad>1</xpad>
|
||||
<ypad>0</ypad>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<fill>False</fill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkSpinButton</class>
|
||||
<name>print_to</name>
|
||||
<can_focus>True</can_focus>
|
||||
<climb_rate>1</climb_rate>
|
||||
<digits>0</digits>
|
||||
<numeric>True</numeric>
|
||||
<update_policy>GTK_UPDATE_ALWAYS</update_policy>
|
||||
<snap>False</snap>
|
||||
<wrap>False</wrap>
|
||||
<value>1</value>
|
||||
<lower>1</lower>
|
||||
<upper>100000</upper>
|
||||
<step>1</step>
|
||||
<page>10</page>
|
||||
<page_size>10</page_size>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<fill>False</fill>
|
||||
</child>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkVBox</class>
|
||||
<name>vbox3</name>
|
||||
<homogeneous>False</homogeneous>
|
||||
<spacing>0</spacing>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>True</expand>
|
||||
<fill>True</fill>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>GtkFrame</class>
|
||||
<name>frame3</name>
|
||||
<border_width>2</border_width>
|
||||
<label>Order</label>
|
||||
<label_xalign>0</label_xalign>
|
||||
<shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>True</expand>
|
||||
<fill>True</fill>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>GtkVBox</class>
|
||||
<name>vbox4</name>
|
||||
<homogeneous>False</homogeneous>
|
||||
<spacing>0</spacing>
|
||||
|
||||
<widget>
|
||||
<class>GtkRadioButton</class>
|
||||
<name>order_normal</name>
|
||||
<can_focus>True</can_focus>
|
||||
<label>_Normal Order</label>
|
||||
<active>False</active>
|
||||
<draw_indicator>True</draw_indicator>
|
||||
<group>order</group>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<fill>False</fill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkRadioButton</class>
|
||||
<name>order_reverse</name>
|
||||
<can_focus>True</can_focus>
|
||||
<label>_Reverse Order</label>
|
||||
<active>False</active>
|
||||
<draw_indicator>True</draw_indicator>
|
||||
<group>order</group>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<fill>False</fill>
|
||||
</child>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkFrame</class>
|
||||
<name>frame4</name>
|
||||
<border_width>2</border_width>
|
||||
<label>Copies</label>
|
||||
<label_xalign>0</label_xalign>
|
||||
<shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>True</expand>
|
||||
<fill>True</fill>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>GtkVBox</class>
|
||||
<name>vbox5</name>
|
||||
<homogeneous>False</homogeneous>
|
||||
<spacing>0</spacing>
|
||||
|
||||
<widget>
|
||||
<class>GtkCheckButton</class>
|
||||
<name>copies_unsorted</name>
|
||||
<can_focus>True</can_focus>
|
||||
<label>_Unsorted</label>
|
||||
<active>False</active>
|
||||
<draw_indicator>True</draw_indicator>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<fill>False</fill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkHBox</class>
|
||||
<name>hbox3</name>
|
||||
<border_width>2</border_width>
|
||||
<homogeneous>False</homogeneous>
|
||||
<spacing>0</spacing>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>True</expand>
|
||||
<fill>True</fill>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>GtkLabel</class>
|
||||
<name>label3</name>
|
||||
<label>Count</label>
|
||||
<justify>GTK_JUSTIFY_CENTER</justify>
|
||||
<wrap>False</wrap>
|
||||
<xalign>0.5</xalign>
|
||||
<yalign>0.5</yalign>
|
||||
<xpad>3</xpad>
|
||||
<ypad>0</ypad>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<fill>False</fill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkSpinButton</class>
|
||||
<name>copies_count</name>
|
||||
<can_focus>True</can_focus>
|
||||
<climb_rate>1</climb_rate>
|
||||
<digits>0</digits>
|
||||
<numeric>True</numeric>
|
||||
<update_policy>GTK_UPDATE_ALWAYS</update_policy>
|
||||
<snap>False</snap>
|
||||
<wrap>False</wrap>
|
||||
<value>1</value>
|
||||
<lower>1</lower>
|
||||
<upper>100000</upper>
|
||||
<step>1</step>
|
||||
<page>10</page>
|
||||
<page_size>10</page_size>
|
||||
<child>
|
||||
<padding>2</padding>
|
||||
<expand>True</expand>
|
||||
<fill>True</fill>
|
||||
</child>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkFrame</class>
|
||||
<name>frame1</name>
|
||||
<border_width>2</border_width>
|
||||
<label>Print to</label>
|
||||
<label_xalign>0</label_xalign>
|
||||
<shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>True</expand>
|
||||
<fill>True</fill>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>GtkTable</class>
|
||||
<name>table1</name>
|
||||
<rows>2</rows>
|
||||
<columns>2</columns>
|
||||
<homogeneous>False</homogeneous>
|
||||
<row_spacing>0</row_spacing>
|
||||
<column_spacing>0</column_spacing>
|
||||
|
||||
<widget>
|
||||
<class>GtkRadioButton</class>
|
||||
<name>printto_file</name>
|
||||
<can_focus>True</can_focus>
|
||||
<signal>
|
||||
<name>toggled</name>
|
||||
<handler>diaprint_on_printto_file_toggled</handler>
|
||||
<last_modification_time>Sat, 12 Aug 2000 07:04:41 GMT</last_modification_time>
|
||||
</signal>
|
||||
<label>_File</label>
|
||||
<active>False</active>
|
||||
<draw_indicator>True</draw_indicator>
|
||||
<group>printto</group>
|
||||
<child>
|
||||
<left_attach>0</left_attach>
|
||||
<right_attach>1</right_attach>
|
||||
<top_attach>1</top_attach>
|
||||
<bottom_attach>2</bottom_attach>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
<xexpand>False</xexpand>
|
||||
<yexpand>False</yexpand>
|
||||
<xshrink>False</xshrink>
|
||||
<yshrink>False</yshrink>
|
||||
<xfill>True</xfill>
|
||||
<yfill>False</yfill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkRadioButton</class>
|
||||
<name>printto_printer</name>
|
||||
<can_focus>True</can_focus>
|
||||
<signal>
|
||||
<name>toggled</name>
|
||||
<handler>diaprint_on_printto_printer_toggled</handler>
|
||||
<last_modification_time>Sat, 12 Aug 2000 07:04:32 GMT</last_modification_time>
|
||||
</signal>
|
||||
<label>_Printer</label>
|
||||
<active>True</active>
|
||||
<draw_indicator>True</draw_indicator>
|
||||
<group>printto</group>
|
||||
<child>
|
||||
<left_attach>0</left_attach>
|
||||
<right_attach>1</right_attach>
|
||||
<top_attach>0</top_attach>
|
||||
<bottom_attach>1</bottom_attach>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
<xexpand>False</xexpand>
|
||||
<yexpand>False</yexpand>
|
||||
<xshrink>False</xshrink>
|
||||
<yshrink>False</yshrink>
|
||||
<xfill>True</xfill>
|
||||
<yfill>False</yfill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GnomeFileEntry</class>
|
||||
<name>printto_fileentry</name>
|
||||
<border_width>3</border_width>
|
||||
<history_id>diaprint_printto_fileentry</history_id>
|
||||
<max_saved>10</max_saved>
|
||||
<directory>False</directory>
|
||||
<modal>False</modal>
|
||||
<child>
|
||||
<left_attach>1</left_attach>
|
||||
<right_attach>2</right_attach>
|
||||
<top_attach>1</top_attach>
|
||||
<bottom_attach>2</bottom_attach>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
<xexpand>True</xexpand>
|
||||
<yexpand>False</yexpand>
|
||||
<xshrink>False</xshrink>
|
||||
<yshrink>False</yshrink>
|
||||
<xfill>True</xfill>
|
||||
<yfill>False</yfill>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<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>GnomeEntry</class>
|
||||
<name>printto_printcommand</name>
|
||||
<border_width>3</border_width>
|
||||
<history_id>diaprint_printto_printcommand</history_id>
|
||||
<max_saved>10</max_saved>
|
||||
<child>
|
||||
<left_attach>1</left_attach>
|
||||
<right_attach>2</right_attach>
|
||||
<top_attach>0</top_attach>
|
||||
<bottom_attach>1</bottom_attach>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
<xexpand>True</xexpand>
|
||||
<yexpand>False</yexpand>
|
||||
<xshrink>False</xshrink>
|
||||
<yshrink>False</yshrink>
|
||||
<xfill>True</xfill>
|
||||
<yfill>False</yfill>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>GtkEntry</class>
|
||||
<child_name>GnomeEntry:entry</child_name>
|
||||
<name>combo-entry2</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>
|
||||
</widget>
|
||||
|
||||
</GTK-Interface>
|
104
src/frontends/gnome/diaprint_callbacks.c
Normal file
104
src/frontends/gnome/diaprint_callbacks.c
Normal file
@ -0,0 +1,104 @@
|
||||
/* This file is part of
|
||||
* ======================================================
|
||||
*
|
||||
* LyX, The Document Processor
|
||||
*
|
||||
* Copyright 2000 The LyX Team.
|
||||
*
|
||||
* ====================================================== */
|
||||
|
||||
/* Print dialog callbacks
|
||||
* Controls the state of the widgets
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <gnome.h>
|
||||
|
||||
#include "diaprint_callbacks.h"
|
||||
#include "diaprint_interface.h"
|
||||
#include "support.h"
|
||||
|
||||
|
||||
void
|
||||
diaprint_set_printdest_state( GtkWidget *wid, gboolean active_is_printer )
|
||||
{
|
||||
if (active_is_printer)
|
||||
{
|
||||
gtk_widget_set_sensitive(lookup_widget(wid, "printto_printcommand"), TRUE);
|
||||
gtk_widget_set_sensitive(lookup_widget(wid, "printto_fileentry"), FALSE);
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_widget_set_sensitive(lookup_widget(wid, "printto_printcommand"), FALSE);
|
||||
gtk_widget_set_sensitive(lookup_widget(wid, "printto_fileentry"), TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
diaprint_set_pages_state( GtkWidget *wid, gboolean active_pages )
|
||||
{
|
||||
gtk_widget_set_sensitive(lookup_widget(wid, "print_from"), active_pages);
|
||||
gtk_widget_set_sensitive(lookup_widget(wid, "print_to"), active_pages);
|
||||
}
|
||||
|
||||
void
|
||||
diaprint_on_diaprint_show (GtkWidget *widget,
|
||||
gpointer user_data)
|
||||
{
|
||||
diaprint_set_printdest_state(widget,
|
||||
gtk_toggle_button_get_active
|
||||
(GTK_TOGGLE_BUTTON(lookup_widget(widget, "printto_printer")))
|
||||
);
|
||||
diaprint_set_pages_state(widget,
|
||||
gtk_toggle_button_get_active
|
||||
(GTK_TOGGLE_BUTTON(lookup_widget(widget, "print_pages")))
|
||||
);
|
||||
}
|
||||
|
||||
void
|
||||
diaprint_on_printto_file_toggled (GtkToggleButton *togglebutton,
|
||||
gpointer user_data)
|
||||
{
|
||||
diaprint_set_printdest_state(GTK_WIDGET(togglebutton), FALSE);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
diaprint_on_printto_printer_toggled (GtkToggleButton *togglebutton,
|
||||
gpointer user_data)
|
||||
{
|
||||
diaprint_set_printdest_state(GTK_WIDGET(togglebutton), TRUE);
|
||||
}
|
||||
|
||||
void
|
||||
diaprint_on_print_pages_toggled (GtkToggleButton *togglebutton,
|
||||
gpointer user_data)
|
||||
{
|
||||
diaprint_set_pages_state(GTK_WIDGET(togglebutton),
|
||||
gtk_toggle_button_get_active(togglebutton));
|
||||
}
|
||||
|
||||
void
|
||||
diaprint_on_print_from_changed (GtkEditable *editable,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkSpinButton * to;
|
||||
GtkAdjustment * a;
|
||||
int nmin, v;
|
||||
|
||||
nmin = gtk_spin_button_get_value_as_int( GTK_SPIN_BUTTON(editable) );
|
||||
to = GTK_SPIN_BUTTON(lookup_widget(GTK_WIDGET(editable), "print_to"));
|
||||
a = gtk_spin_button_get_adjustment(to);
|
||||
v = gtk_spin_button_get_value_as_int(to);
|
||||
|
||||
a->lower = nmin;
|
||||
if (v < nmin)
|
||||
gtk_spin_button_set_value(to, nmin);
|
||||
else
|
||||
gtk_spin_button_set_value(to, v);
|
||||
}
|
||||
|
||||
|
36
src/frontends/gnome/diaprint_callbacks.h
Normal file
36
src/frontends/gnome/diaprint_callbacks.h
Normal file
@ -0,0 +1,36 @@
|
||||
/* This file is part of
|
||||
* ======================================================
|
||||
*
|
||||
* LyX, The Document Processor
|
||||
*
|
||||
* Copyright 2000 The LyX Team.
|
||||
*
|
||||
* ====================================================== */
|
||||
|
||||
#include <gnome.h>
|
||||
|
||||
|
||||
void
|
||||
diaprint_on_diaprint_show (GtkWidget *widget,
|
||||
gpointer user_data);
|
||||
|
||||
void
|
||||
diaprint_on_print_all_toggled (GtkToggleButton *togglebutton,
|
||||
gpointer user_data);
|
||||
|
||||
void
|
||||
diaprint_on_print_pages_toggled (GtkToggleButton *togglebutton,
|
||||
gpointer user_data);
|
||||
|
||||
void
|
||||
diaprint_on_printto_file_toggled (GtkToggleButton *togglebutton,
|
||||
gpointer user_data);
|
||||
|
||||
void
|
||||
diaprint_on_printto_printer_toggled (GtkToggleButton *togglebutton,
|
||||
gpointer user_data);
|
||||
|
||||
void
|
||||
diaprint_on_print_from_changed (GtkEditable *editable,
|
||||
gpointer user_data);
|
||||
|
424
src/frontends/gnome/diaprint_interface.c
Normal file
424
src/frontends/gnome/diaprint_interface.c
Normal file
@ -0,0 +1,424 @@
|
||||
/*
|
||||
* 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 "diaprint_callbacks.h"
|
||||
#include "diaprint_interface.h"
|
||||
#include "support.h"
|
||||
|
||||
GtkWidget*
|
||||
create_DiaPrint (void)
|
||||
{
|
||||
GtkWidget *DiaPrint;
|
||||
GtkWidget *dialog_vbox1;
|
||||
GtkWidget *vbox1;
|
||||
GtkWidget *hbox1;
|
||||
GtkWidget *frame2;
|
||||
GtkWidget *vbox2;
|
||||
GSList *print_group = NULL;
|
||||
guint print_all_key;
|
||||
GtkWidget *print_all;
|
||||
guint print_odd_key;
|
||||
GtkWidget *print_odd;
|
||||
guint print_even_key;
|
||||
GtkWidget *print_even;
|
||||
GtkWidget *hbox2;
|
||||
guint print_pages_key;
|
||||
GtkWidget *print_pages;
|
||||
GtkWidget *label1;
|
||||
GtkObject *print_from_adj;
|
||||
GtkWidget *print_from;
|
||||
GtkWidget *label2;
|
||||
GtkObject *print_to_adj;
|
||||
GtkWidget *print_to;
|
||||
GtkWidget *vbox3;
|
||||
GtkWidget *frame3;
|
||||
GtkWidget *vbox4;
|
||||
GSList *order_group = NULL;
|
||||
guint order_normal_key;
|
||||
GtkWidget *order_normal;
|
||||
guint order_reverse_key;
|
||||
GtkWidget *order_reverse;
|
||||
GtkWidget *frame4;
|
||||
GtkWidget *vbox5;
|
||||
guint copies_unsorted_key;
|
||||
GtkWidget *copies_unsorted;
|
||||
GtkWidget *hbox3;
|
||||
GtkWidget *label3;
|
||||
GtkObject *copies_count_adj;
|
||||
GtkWidget *copies_count;
|
||||
GtkWidget *frame1;
|
||||
GtkWidget *table1;
|
||||
GSList *printto_group = NULL;
|
||||
guint printto_file_key;
|
||||
GtkWidget *printto_file;
|
||||
guint printto_printer_key;
|
||||
GtkWidget *printto_printer;
|
||||
GtkWidget *printto_fileentry;
|
||||
GtkWidget *combo_entry1;
|
||||
GtkWidget *printto_printcommand;
|
||||
GtkWidget *combo_entry2;
|
||||
GtkWidget *dialog_action_area1;
|
||||
GtkWidget *button_print;
|
||||
GtkWidget *button_cancel;
|
||||
GtkAccelGroup *accel_group;
|
||||
|
||||
accel_group = gtk_accel_group_new ();
|
||||
|
||||
DiaPrint = gnome_dialog_new (_("Print"), NULL);
|
||||
gtk_object_set_data (GTK_OBJECT (DiaPrint), "DiaPrint", DiaPrint);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (DiaPrint), 2);
|
||||
GTK_WINDOW (DiaPrint)->type = GTK_WINDOW_DIALOG;
|
||||
gtk_window_set_policy (GTK_WINDOW (DiaPrint), FALSE, FALSE, FALSE);
|
||||
|
||||
dialog_vbox1 = GNOME_DIALOG (DiaPrint)->vbox;
|
||||
gtk_object_set_data (GTK_OBJECT (DiaPrint), "dialog_vbox1", dialog_vbox1);
|
||||
gtk_widget_show (dialog_vbox1);
|
||||
|
||||
vbox1 = gtk_vbox_new (FALSE, 0);
|
||||
gtk_widget_ref (vbox1);
|
||||
gtk_object_set_data_full (GTK_OBJECT (DiaPrint), "vbox1", vbox1,
|
||||
(GtkDestroyNotify) gtk_widget_unref);
|
||||
gtk_widget_show (vbox1);
|
||||
gtk_box_pack_start (GTK_BOX (dialog_vbox1), vbox1, TRUE, TRUE, 0);
|
||||
|
||||
hbox1 = gtk_hbox_new (FALSE, 0);
|
||||
gtk_widget_ref (hbox1);
|
||||
gtk_object_set_data_full (GTK_OBJECT (DiaPrint), "hbox1", hbox1,
|
||||
(GtkDestroyNotify) gtk_widget_unref);
|
||||
gtk_widget_show (hbox1);
|
||||
gtk_box_pack_start (GTK_BOX (vbox1), hbox1, TRUE, TRUE, 0);
|
||||
|
||||
frame2 = gtk_frame_new (_("Print"));
|
||||
gtk_widget_ref (frame2);
|
||||
gtk_object_set_data_full (GTK_OBJECT (DiaPrint), "frame2", frame2,
|
||||
(GtkDestroyNotify) gtk_widget_unref);
|
||||
gtk_widget_show (frame2);
|
||||
gtk_box_pack_start (GTK_BOX (hbox1), frame2, TRUE, TRUE, 0);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (frame2), 2);
|
||||
|
||||
vbox2 = gtk_vbox_new (FALSE, 0);
|
||||
gtk_widget_ref (vbox2);
|
||||
gtk_object_set_data_full (GTK_OBJECT (DiaPrint), "vbox2", vbox2,
|
||||
(GtkDestroyNotify) gtk_widget_unref);
|
||||
gtk_widget_show (vbox2);
|
||||
gtk_container_add (GTK_CONTAINER (frame2), vbox2);
|
||||
|
||||
print_all = gtk_radio_button_new_with_label (print_group, "");
|
||||
print_all_key = gtk_label_parse_uline (GTK_LABEL (GTK_BIN (print_all)->child),
|
||||
_("All Pa_ges"));
|
||||
gtk_widget_add_accelerator (print_all, "clicked", accel_group,
|
||||
print_all_key, GDK_MOD1_MASK, 0);
|
||||
print_group = gtk_radio_button_group (GTK_RADIO_BUTTON (print_all));
|
||||
gtk_widget_ref (print_all);
|
||||
gtk_object_set_data_full (GTK_OBJECT (DiaPrint), "print_all", print_all,
|
||||
(GtkDestroyNotify) gtk_widget_unref);
|
||||
gtk_widget_show (print_all);
|
||||
gtk_box_pack_start (GTK_BOX (vbox2), print_all, FALSE, FALSE, 0);
|
||||
|
||||
print_odd = gtk_radio_button_new_with_label (print_group, "");
|
||||
print_odd_key = gtk_label_parse_uline (GTK_LABEL (GTK_BIN (print_odd)->child),
|
||||
_("_Only Odd Pages"));
|
||||
gtk_widget_add_accelerator (print_odd, "clicked", accel_group,
|
||||
print_odd_key, GDK_MOD1_MASK, 0);
|
||||
print_group = gtk_radio_button_group (GTK_RADIO_BUTTON (print_odd));
|
||||
gtk_widget_ref (print_odd);
|
||||
gtk_object_set_data_full (GTK_OBJECT (DiaPrint), "print_odd", print_odd,
|
||||
(GtkDestroyNotify) gtk_widget_unref);
|
||||
gtk_widget_show (print_odd);
|
||||
gtk_box_pack_start (GTK_BOX (vbox2), print_odd, FALSE, FALSE, 0);
|
||||
|
||||
print_even = gtk_radio_button_new_with_label (print_group, "");
|
||||
print_even_key = gtk_label_parse_uline (GTK_LABEL (GTK_BIN (print_even)->child),
|
||||
_("Only _Even Pages"));
|
||||
gtk_widget_add_accelerator (print_even, "clicked", accel_group,
|
||||
print_even_key, GDK_MOD1_MASK, 0);
|
||||
print_group = gtk_radio_button_group (GTK_RADIO_BUTTON (print_even));
|
||||
gtk_widget_ref (print_even);
|
||||
gtk_object_set_data_full (GTK_OBJECT (DiaPrint), "print_even", print_even,
|
||||
(GtkDestroyNotify) gtk_widget_unref);
|
||||
gtk_widget_show (print_even);
|
||||
gtk_box_pack_start (GTK_BOX (vbox2), print_even, FALSE, FALSE, 0);
|
||||
|
||||
hbox2 = gtk_hbox_new (FALSE, 0);
|
||||
gtk_widget_ref (hbox2);
|
||||
gtk_object_set_data_full (GTK_OBJECT (DiaPrint), "hbox2", hbox2,
|
||||
(GtkDestroyNotify) gtk_widget_unref);
|
||||
gtk_widget_show (hbox2);
|
||||
gtk_box_pack_start (GTK_BOX (vbox2), hbox2, TRUE, TRUE, 0);
|
||||
|
||||
print_pages = gtk_check_button_new_with_label ("");
|
||||
print_pages_key = gtk_label_parse_uline (GTK_LABEL (GTK_BIN (print_pages)->child),
|
||||
_("Page_s"));
|
||||
gtk_widget_add_accelerator (print_pages, "clicked", accel_group,
|
||||
print_pages_key, GDK_MOD1_MASK, 0);
|
||||
gtk_widget_ref (print_pages);
|
||||
gtk_object_set_data_full (GTK_OBJECT (DiaPrint), "print_pages", print_pages,
|
||||
(GtkDestroyNotify) gtk_widget_unref);
|
||||
gtk_widget_show (print_pages);
|
||||
gtk_box_pack_start (GTK_BOX (hbox2), print_pages, FALSE, FALSE, 0);
|
||||
|
||||
label1 = gtk_label_new (_("from"));
|
||||
gtk_widget_ref (label1);
|
||||
gtk_object_set_data_full (GTK_OBJECT (DiaPrint), "label1", label1,
|
||||
(GtkDestroyNotify) gtk_widget_unref);
|
||||
gtk_widget_show (label1);
|
||||
gtk_box_pack_start (GTK_BOX (hbox2), label1, FALSE, FALSE, 0);
|
||||
gtk_misc_set_padding (GTK_MISC (label1), 1, 0);
|
||||
|
||||
print_from_adj = gtk_adjustment_new (1, 1, 100000, 1, 10, 10);
|
||||
print_from = gtk_spin_button_new (GTK_ADJUSTMENT (print_from_adj), 1, 0);
|
||||
gtk_widget_ref (print_from);
|
||||
gtk_object_set_data_full (GTK_OBJECT (DiaPrint), "print_from", print_from,
|
||||
(GtkDestroyNotify) gtk_widget_unref);
|
||||
gtk_widget_show (print_from);
|
||||
gtk_box_pack_start (GTK_BOX (hbox2), print_from, FALSE, FALSE, 0);
|
||||
gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (print_from), TRUE);
|
||||
|
||||
label2 = gtk_label_new (_("to"));
|
||||
gtk_widget_ref (label2);
|
||||
gtk_object_set_data_full (GTK_OBJECT (DiaPrint), "label2", label2,
|
||||
(GtkDestroyNotify) gtk_widget_unref);
|
||||
gtk_widget_show (label2);
|
||||
gtk_box_pack_start (GTK_BOX (hbox2), label2, FALSE, FALSE, 0);
|
||||
gtk_misc_set_padding (GTK_MISC (label2), 1, 0);
|
||||
|
||||
print_to_adj = gtk_adjustment_new (1, 1, 100000, 1, 10, 10);
|
||||
print_to = gtk_spin_button_new (GTK_ADJUSTMENT (print_to_adj), 1, 0);
|
||||
gtk_widget_ref (print_to);
|
||||
gtk_object_set_data_full (GTK_OBJECT (DiaPrint), "print_to", print_to,
|
||||
(GtkDestroyNotify) gtk_widget_unref);
|
||||
gtk_widget_show (print_to);
|
||||
gtk_box_pack_start (GTK_BOX (hbox2), print_to, FALSE, FALSE, 0);
|
||||
gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (print_to), TRUE);
|
||||
|
||||
vbox3 = gtk_vbox_new (FALSE, 0);
|
||||
gtk_widget_ref (vbox3);
|
||||
gtk_object_set_data_full (GTK_OBJECT (DiaPrint), "vbox3", vbox3,
|
||||
(GtkDestroyNotify) gtk_widget_unref);
|
||||
gtk_widget_show (vbox3);
|
||||
gtk_box_pack_start (GTK_BOX (hbox1), vbox3, TRUE, TRUE, 0);
|
||||
|
||||
frame3 = gtk_frame_new (_("Order"));
|
||||
gtk_widget_ref (frame3);
|
||||
gtk_object_set_data_full (GTK_OBJECT (DiaPrint), "frame3", frame3,
|
||||
(GtkDestroyNotify) gtk_widget_unref);
|
||||
gtk_widget_show (frame3);
|
||||
gtk_box_pack_start (GTK_BOX (vbox3), frame3, TRUE, TRUE, 0);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (frame3), 2);
|
||||
|
||||
vbox4 = gtk_vbox_new (FALSE, 0);
|
||||
gtk_widget_ref (vbox4);
|
||||
gtk_object_set_data_full (GTK_OBJECT (DiaPrint), "vbox4", vbox4,
|
||||
(GtkDestroyNotify) gtk_widget_unref);
|
||||
gtk_widget_show (vbox4);
|
||||
gtk_container_add (GTK_CONTAINER (frame3), vbox4);
|
||||
|
||||
order_normal = gtk_radio_button_new_with_label (order_group, "");
|
||||
order_normal_key = gtk_label_parse_uline (GTK_LABEL (GTK_BIN (order_normal)->child),
|
||||
_("_Normal Order"));
|
||||
gtk_widget_add_accelerator (order_normal, "clicked", accel_group,
|
||||
order_normal_key, GDK_MOD1_MASK, 0);
|
||||
order_group = gtk_radio_button_group (GTK_RADIO_BUTTON (order_normal));
|
||||
gtk_widget_ref (order_normal);
|
||||
gtk_object_set_data_full (GTK_OBJECT (DiaPrint), "order_normal", order_normal,
|
||||
(GtkDestroyNotify) gtk_widget_unref);
|
||||
gtk_widget_show (order_normal);
|
||||
gtk_box_pack_start (GTK_BOX (vbox4), order_normal, FALSE, FALSE, 0);
|
||||
|
||||
order_reverse = gtk_radio_button_new_with_label (order_group, "");
|
||||
order_reverse_key = gtk_label_parse_uline (GTK_LABEL (GTK_BIN (order_reverse)->child),
|
||||
_("_Reverse Order"));
|
||||
gtk_widget_add_accelerator (order_reverse, "clicked", accel_group,
|
||||
order_reverse_key, GDK_MOD1_MASK, 0);
|
||||
order_group = gtk_radio_button_group (GTK_RADIO_BUTTON (order_reverse));
|
||||
gtk_widget_ref (order_reverse);
|
||||
gtk_object_set_data_full (GTK_OBJECT (DiaPrint), "order_reverse", order_reverse,
|
||||
(GtkDestroyNotify) gtk_widget_unref);
|
||||
gtk_widget_show (order_reverse);
|
||||
gtk_box_pack_start (GTK_BOX (vbox4), order_reverse, FALSE, FALSE, 0);
|
||||
|
||||
frame4 = gtk_frame_new (_("Copies"));
|
||||
gtk_widget_ref (frame4);
|
||||
gtk_object_set_data_full (GTK_OBJECT (DiaPrint), "frame4", frame4,
|
||||
(GtkDestroyNotify) gtk_widget_unref);
|
||||
gtk_widget_show (frame4);
|
||||
gtk_box_pack_start (GTK_BOX (vbox3), frame4, TRUE, TRUE, 0);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (frame4), 2);
|
||||
|
||||
vbox5 = gtk_vbox_new (FALSE, 0);
|
||||
gtk_widget_ref (vbox5);
|
||||
gtk_object_set_data_full (GTK_OBJECT (DiaPrint), "vbox5", vbox5,
|
||||
(GtkDestroyNotify) gtk_widget_unref);
|
||||
gtk_widget_show (vbox5);
|
||||
gtk_container_add (GTK_CONTAINER (frame4), vbox5);
|
||||
|
||||
copies_unsorted = gtk_check_button_new_with_label ("");
|
||||
copies_unsorted_key = gtk_label_parse_uline (GTK_LABEL (GTK_BIN (copies_unsorted)->child),
|
||||
_("_Unsorted"));
|
||||
gtk_widget_add_accelerator (copies_unsorted, "clicked", accel_group,
|
||||
copies_unsorted_key, GDK_MOD1_MASK, 0);
|
||||
gtk_widget_ref (copies_unsorted);
|
||||
gtk_object_set_data_full (GTK_OBJECT (DiaPrint), "copies_unsorted", copies_unsorted,
|
||||
(GtkDestroyNotify) gtk_widget_unref);
|
||||
gtk_widget_show (copies_unsorted);
|
||||
gtk_box_pack_start (GTK_BOX (vbox5), copies_unsorted, FALSE, FALSE, 0);
|
||||
|
||||
hbox3 = gtk_hbox_new (FALSE, 0);
|
||||
gtk_widget_ref (hbox3);
|
||||
gtk_object_set_data_full (GTK_OBJECT (DiaPrint), "hbox3", hbox3,
|
||||
(GtkDestroyNotify) gtk_widget_unref);
|
||||
gtk_widget_show (hbox3);
|
||||
gtk_box_pack_start (GTK_BOX (vbox5), hbox3, TRUE, TRUE, 0);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (hbox3), 2);
|
||||
|
||||
label3 = gtk_label_new (_("Count"));
|
||||
gtk_widget_ref (label3);
|
||||
gtk_object_set_data_full (GTK_OBJECT (DiaPrint), "label3", label3,
|
||||
(GtkDestroyNotify) gtk_widget_unref);
|
||||
gtk_widget_show (label3);
|
||||
gtk_box_pack_start (GTK_BOX (hbox3), label3, FALSE, FALSE, 0);
|
||||
gtk_misc_set_padding (GTK_MISC (label3), 3, 0);
|
||||
|
||||
copies_count_adj = gtk_adjustment_new (1, 1, 100000, 1, 10, 10);
|
||||
copies_count = gtk_spin_button_new (GTK_ADJUSTMENT (copies_count_adj), 1, 0);
|
||||
gtk_widget_ref (copies_count);
|
||||
gtk_object_set_data_full (GTK_OBJECT (DiaPrint), "copies_count", copies_count,
|
||||
(GtkDestroyNotify) gtk_widget_unref);
|
||||
gtk_widget_show (copies_count);
|
||||
gtk_box_pack_start (GTK_BOX (hbox3), copies_count, TRUE, TRUE, 2);
|
||||
gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (copies_count), TRUE);
|
||||
|
||||
frame1 = gtk_frame_new (_("Print to"));
|
||||
gtk_widget_ref (frame1);
|
||||
gtk_object_set_data_full (GTK_OBJECT (DiaPrint), "frame1", frame1,
|
||||
(GtkDestroyNotify) gtk_widget_unref);
|
||||
gtk_widget_show (frame1);
|
||||
gtk_box_pack_start (GTK_BOX (vbox1), frame1, TRUE, TRUE, 0);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (frame1), 2);
|
||||
|
||||
table1 = gtk_table_new (2, 2, FALSE);
|
||||
gtk_widget_ref (table1);
|
||||
gtk_object_set_data_full (GTK_OBJECT (DiaPrint), "table1", table1,
|
||||
(GtkDestroyNotify) gtk_widget_unref);
|
||||
gtk_widget_show (table1);
|
||||
gtk_container_add (GTK_CONTAINER (frame1), table1);
|
||||
|
||||
printto_file = gtk_radio_button_new_with_label (printto_group, "");
|
||||
printto_file_key = gtk_label_parse_uline (GTK_LABEL (GTK_BIN (printto_file)->child),
|
||||
_("_File"));
|
||||
gtk_widget_add_accelerator (printto_file, "clicked", accel_group,
|
||||
printto_file_key, GDK_MOD1_MASK, 0);
|
||||
printto_group = gtk_radio_button_group (GTK_RADIO_BUTTON (printto_file));
|
||||
gtk_widget_ref (printto_file);
|
||||
gtk_object_set_data_full (GTK_OBJECT (DiaPrint), "printto_file", printto_file,
|
||||
(GtkDestroyNotify) gtk_widget_unref);
|
||||
gtk_widget_show (printto_file);
|
||||
gtk_table_attach (GTK_TABLE (table1), printto_file, 0, 1, 1, 2,
|
||||
(GtkAttachOptions) (GTK_FILL),
|
||||
(GtkAttachOptions) (0), 0, 0);
|
||||
|
||||
printto_printer = gtk_radio_button_new_with_label (printto_group, "");
|
||||
printto_printer_key = gtk_label_parse_uline (GTK_LABEL (GTK_BIN (printto_printer)->child),
|
||||
_("_Printer"));
|
||||
gtk_widget_add_accelerator (printto_printer, "clicked", accel_group,
|
||||
printto_printer_key, GDK_MOD1_MASK, 0);
|
||||
printto_group = gtk_radio_button_group (GTK_RADIO_BUTTON (printto_printer));
|
||||
gtk_widget_ref (printto_printer);
|
||||
gtk_object_set_data_full (GTK_OBJECT (DiaPrint), "printto_printer", printto_printer,
|
||||
(GtkDestroyNotify) gtk_widget_unref);
|
||||
gtk_widget_show (printto_printer);
|
||||
gtk_table_attach (GTK_TABLE (table1), printto_printer, 0, 1, 0, 1,
|
||||
(GtkAttachOptions) (GTK_FILL),
|
||||
(GtkAttachOptions) (0), 0, 0);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (printto_printer), TRUE);
|
||||
|
||||
printto_fileentry = gnome_file_entry_new ("diaprint_printto_fileentry", NULL);
|
||||
gtk_widget_ref (printto_fileentry);
|
||||
gtk_object_set_data_full (GTK_OBJECT (DiaPrint), "printto_fileentry", printto_fileentry,
|
||||
(GtkDestroyNotify) gtk_widget_unref);
|
||||
gtk_widget_show (printto_fileentry);
|
||||
gtk_table_attach (GTK_TABLE (table1), printto_fileentry, 1, 2, 1, 2,
|
||||
(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
|
||||
(GtkAttachOptions) (0), 0, 0);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (printto_fileentry), 3);
|
||||
|
||||
combo_entry1 = gnome_file_entry_gtk_entry (GNOME_FILE_ENTRY (printto_fileentry));
|
||||
gtk_widget_ref (combo_entry1);
|
||||
gtk_object_set_data_full (GTK_OBJECT (DiaPrint), "combo_entry1", combo_entry1,
|
||||
(GtkDestroyNotify) gtk_widget_unref);
|
||||
gtk_widget_show (combo_entry1);
|
||||
|
||||
printto_printcommand = gnome_entry_new ("diaprint_printto_printcommand");
|
||||
gtk_widget_ref (printto_printcommand);
|
||||
gtk_object_set_data_full (GTK_OBJECT (DiaPrint), "printto_printcommand", printto_printcommand,
|
||||
(GtkDestroyNotify) gtk_widget_unref);
|
||||
gtk_widget_show (printto_printcommand);
|
||||
gtk_table_attach (GTK_TABLE (table1), printto_printcommand, 1, 2, 0, 1,
|
||||
(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
|
||||
(GtkAttachOptions) (0), 0, 0);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (printto_printcommand), 3);
|
||||
|
||||
combo_entry2 = gnome_entry_gtk_entry (GNOME_ENTRY (printto_printcommand));
|
||||
gtk_widget_ref (combo_entry2);
|
||||
gtk_object_set_data_full (GTK_OBJECT (DiaPrint), "combo_entry2", combo_entry2,
|
||||
(GtkDestroyNotify) gtk_widget_unref);
|
||||
gtk_widget_show (combo_entry2);
|
||||
|
||||
dialog_action_area1 = GNOME_DIALOG (DiaPrint)->action_area;
|
||||
gtk_object_set_data (GTK_OBJECT (DiaPrint), "dialog_action_area1", dialog_action_area1);
|
||||
gtk_widget_show (dialog_action_area1);
|
||||
gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area1), GTK_BUTTONBOX_END);
|
||||
gtk_button_box_set_spacing (GTK_BUTTON_BOX (dialog_action_area1), 8);
|
||||
|
||||
gnome_dialog_append_button_with_pixmap (GNOME_DIALOG (DiaPrint),
|
||||
_("Print"), GNOME_STOCK_PIXMAP_PRINT);
|
||||
button_print = g_list_last (GNOME_DIALOG (DiaPrint)->buttons)->data;
|
||||
gtk_widget_ref (button_print);
|
||||
gtk_object_set_data_full (GTK_OBJECT (DiaPrint), "button_print", button_print,
|
||||
(GtkDestroyNotify) gtk_widget_unref);
|
||||
gtk_widget_show (button_print);
|
||||
GTK_WIDGET_SET_FLAGS (button_print, GTK_CAN_DEFAULT);
|
||||
|
||||
gnome_dialog_append_button (GNOME_DIALOG (DiaPrint), GNOME_STOCK_BUTTON_CANCEL);
|
||||
button_cancel = g_list_last (GNOME_DIALOG (DiaPrint)->buttons)->data;
|
||||
gtk_widget_ref (button_cancel);
|
||||
gtk_object_set_data_full (GTK_OBJECT (DiaPrint), "button_cancel", button_cancel,
|
||||
(GtkDestroyNotify) gtk_widget_unref);
|
||||
gtk_widget_show (button_cancel);
|
||||
GTK_WIDGET_SET_FLAGS (button_cancel, GTK_CAN_DEFAULT);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (DiaPrint), "show",
|
||||
GTK_SIGNAL_FUNC (diaprint_on_diaprint_show),
|
||||
NULL);
|
||||
gtk_signal_connect (GTK_OBJECT (print_pages), "toggled",
|
||||
GTK_SIGNAL_FUNC (diaprint_on_print_pages_toggled),
|
||||
NULL);
|
||||
gtk_signal_connect (GTK_OBJECT (print_from), "changed",
|
||||
GTK_SIGNAL_FUNC (diaprint_on_print_from_changed),
|
||||
NULL);
|
||||
gtk_signal_connect (GTK_OBJECT (printto_file), "toggled",
|
||||
GTK_SIGNAL_FUNC (diaprint_on_printto_file_toggled),
|
||||
NULL);
|
||||
gtk_signal_connect (GTK_OBJECT (printto_printer), "toggled",
|
||||
GTK_SIGNAL_FUNC (diaprint_on_printto_printer_toggled),
|
||||
NULL);
|
||||
|
||||
gtk_widget_grab_focus (button_print);
|
||||
gtk_widget_grab_default (button_print);
|
||||
gtk_window_add_accel_group (GTK_WINDOW (DiaPrint), accel_group);
|
||||
|
||||
return DiaPrint;
|
||||
}
|
||||
|
5
src/frontends/gnome/diaprint_interface.h
Normal file
5
src/frontends/gnome/diaprint_interface.h
Normal file
@ -0,0 +1,5 @@
|
||||
/*
|
||||
* DO NOT EDIT THIS FILE - it is generated by Glade.
|
||||
*/
|
||||
|
||||
GtkWidget* create_DiaPrint (void);
|
146
src/frontends/gnome/support.c
Normal file
146
src/frontends/gnome/support.c
Normal file
@ -0,0 +1,146 @@
|
||||
/*
|
||||
* 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 "support.h"
|
||||
|
||||
/* This is an internally used function to create pixmaps. */
|
||||
static GtkWidget* create_dummy_pixmap (GtkWidget *widget,
|
||||
gboolean gnome_pixmap);
|
||||
|
||||
GtkWidget*
|
||||
lookup_widget (GtkWidget *widget,
|
||||
const gchar *widget_name)
|
||||
{
|
||||
GtkWidget *parent, *found_widget;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
if (GTK_IS_MENU (widget))
|
||||
parent = gtk_menu_get_attach_widget (GTK_MENU (widget));
|
||||
else
|
||||
parent = widget->parent;
|
||||
if (parent == NULL)
|
||||
break;
|
||||
widget = parent;
|
||||
}
|
||||
|
||||
found_widget = (GtkWidget*) gtk_object_get_data (GTK_OBJECT (widget),
|
||||
widget_name);
|
||||
if (!found_widget)
|
||||
g_warning ("Widget not found: %s", widget_name);
|
||||
return found_widget;
|
||||
}
|
||||
|
||||
/* This is a dummy pixmap we use when a pixmap can't be found. */
|
||||
static char *dummy_pixmap_xpm[] = {
|
||||
/* columns rows colors chars-per-pixel */
|
||||
"1 1 1 1",
|
||||
" c None",
|
||||
/* pixels */
|
||||
" ",
|
||||
" "
|
||||
};
|
||||
|
||||
/* This is an internally used function to create pixmaps. */
|
||||
static GtkWidget*
|
||||
create_dummy_pixmap (GtkWidget *widget,
|
||||
gboolean gnome_pixmap)
|
||||
{
|
||||
GdkColormap *colormap;
|
||||
GdkPixmap *gdkpixmap;
|
||||
GdkBitmap *mask;
|
||||
GtkWidget *pixmap;
|
||||
|
||||
if (gnome_pixmap)
|
||||
{
|
||||
return gnome_pixmap_new_from_xpm_d (dummy_pixmap_xpm);
|
||||
}
|
||||
|
||||
colormap = gtk_widget_get_colormap (widget);
|
||||
gdkpixmap = gdk_pixmap_colormap_create_from_xpm_d (NULL, colormap, &mask,
|
||||
NULL, dummy_pixmap_xpm);
|
||||
if (gdkpixmap == NULL)
|
||||
g_error ("Couldn't create replacement pixmap.");
|
||||
pixmap = gtk_pixmap_new (gdkpixmap, mask);
|
||||
gdk_pixmap_unref (gdkpixmap);
|
||||
gdk_bitmap_unref (mask);
|
||||
return pixmap;
|
||||
}
|
||||
|
||||
/* This is an internally used function to create pixmaps. */
|
||||
GtkWidget*
|
||||
create_pixmap (GtkWidget *widget,
|
||||
const gchar *filename,
|
||||
gboolean gnome_pixmap)
|
||||
{
|
||||
GtkWidget *pixmap;
|
||||
GdkColormap *colormap;
|
||||
GdkPixmap *gdkpixmap;
|
||||
GdkBitmap *mask;
|
||||
gchar *pathname;
|
||||
|
||||
if (!filename || !filename[0])
|
||||
return create_dummy_pixmap (widget, gnome_pixmap);
|
||||
|
||||
pathname = gnome_pixmap_file (filename);
|
||||
if (!pathname)
|
||||
{
|
||||
g_warning (_("Couldn't find pixmap file: %s"), filename);
|
||||
return create_dummy_pixmap (widget, gnome_pixmap);
|
||||
}
|
||||
|
||||
if (gnome_pixmap)
|
||||
{
|
||||
pixmap = gnome_pixmap_new_from_file (pathname);
|
||||
g_free (pathname);
|
||||
return pixmap;
|
||||
}
|
||||
|
||||
colormap = gtk_widget_get_colormap (widget);
|
||||
gdkpixmap = gdk_pixmap_colormap_create_from_xpm (NULL, colormap, &mask,
|
||||
NULL, pathname);
|
||||
if (gdkpixmap == NULL)
|
||||
{
|
||||
g_warning (_("Couldn't create pixmap from file: %s"), pathname);
|
||||
g_free (pathname);
|
||||
return create_dummy_pixmap (widget, gnome_pixmap);
|
||||
}
|
||||
g_free (pathname);
|
||||
|
||||
pixmap = gtk_pixmap_new (gdkpixmap, mask);
|
||||
gdk_pixmap_unref (gdkpixmap);
|
||||
gdk_bitmap_unref (mask);
|
||||
return pixmap;
|
||||
}
|
||||
|
||||
/* This is an internally used function to create imlib images. */
|
||||
GdkImlibImage*
|
||||
create_image (const gchar *filename)
|
||||
{
|
||||
GdkImlibImage *image;
|
||||
gchar *pathname;
|
||||
|
||||
pathname = gnome_pixmap_file (filename);
|
||||
if (!pathname)
|
||||
{
|
||||
g_warning (_("Couldn't find pixmap file: %s"), filename);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
image = gdk_imlib_load_image (pathname);
|
||||
g_free (pathname);
|
||||
return image;
|
||||
}
|
||||
|
34
src/frontends/gnome/support.h
Normal file
34
src/frontends/gnome/support.h
Normal file
@ -0,0 +1,34 @@
|
||||
/*
|
||||
* DO NOT EDIT THIS FILE - it is generated by Glade.
|
||||
*/
|
||||
|
||||
#include <gnome.h>
|
||||
|
||||
/*
|
||||
* Public Functions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This function returns a widget in a component created by Glade.
|
||||
* Call it with the toplevel widget in the component (i.e. a window/dialog),
|
||||
* or alternatively any widget in the component, and the name of the widget
|
||||
* you want returned.
|
||||
*/
|
||||
GtkWidget* lookup_widget (GtkWidget *widget,
|
||||
const gchar *widget_name);
|
||||
|
||||
/* get_widget() is deprecated. Use lookup_widget instead. */
|
||||
#define get_widget lookup_widget
|
||||
|
||||
|
||||
/*
|
||||
* Private Functions.
|
||||
*/
|
||||
|
||||
/* This is used to create the pixmaps in the interface. */
|
||||
GtkWidget* create_pixmap (GtkWidget *widget,
|
||||
const gchar *filename,
|
||||
gboolean gnome_pixmap);
|
||||
|
||||
GdkImlibImage* create_image (const gchar *filename);
|
||||
|
@ -9,11 +9,11 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation
|
||||
#endif
|
||||
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "lyx_gui_misc.h"
|
||||
#include "gettext.h"
|
||||
@ -38,9 +38,7 @@
|
||||
|
||||
#include "RadioButtonGroup.h"
|
||||
|
||||
#ifdef ENABLE_ASSERTIONS
|
||||
#include "support/LAssert.h"
|
||||
#endif
|
||||
|
||||
using std::endl;
|
||||
|
||||
@ -48,18 +46,18 @@ C_RETURNCB(FormGraphics, WMHideCB)
|
||||
C_GENERICCB(FormGraphics, OKCB)
|
||||
C_GENERICCB(FormGraphics, ApplyCB)
|
||||
C_GENERICCB(FormGraphics, CancelCB)
|
||||
C_GENERICCB(FormGraphics, BrowseCB)
|
||||
C_GENERICCB(FormGraphics, BrowseCB)
|
||||
C_GENERICCB(FormGraphics, AdvancedOptionsCB)
|
||||
C_GENERICCB(FormGraphics, InputCB)
|
||||
|
||||
|
||||
|
||||
FormGraphics::FormGraphics(LyXView * lv, Dialogs * d)
|
||||
: dialog_(0), lv_(lv), d_(d), inset_(0),
|
||||
// The buttons c-tor values are the number of buttons we use
|
||||
// This is only to reduce memory waste.
|
||||
widthButtons(5), heightButtons(4), displayButtons(4),
|
||||
ih_(0), h_(0), u_(0),
|
||||
last_image_path(".")
|
||||
: dialog_(0), lv_(lv), d_(d), inset_(0),
|
||||
// The buttons c-tor values are the number of buttons we use
|
||||
// This is only to reduce memory waste.
|
||||
widthButtons(5), heightButtons(4), displayButtons(4),
|
||||
ih_(0), h_(0), u_(0),
|
||||
last_image_path(".")
|
||||
{
|
||||
// let the dialog be shown
|
||||
// This is a permanent connection so we won't bother
|
||||
@ -76,150 +74,146 @@ FormGraphics::~FormGraphics()
|
||||
|
||||
void FormGraphics::build()
|
||||
{
|
||||
dialog_ = build_graphics();
|
||||
#ifdef ENABLE_ASSERTIONS
|
||||
Assert(dialog_ != 0);
|
||||
#endif
|
||||
if (!dialog_)
|
||||
return;
|
||||
dialog_ = build_graphics();
|
||||
Assert(dialog_ != 0);
|
||||
if (!dialog_)
|
||||
return ;
|
||||
|
||||
// This is the place to add settings of the dialog that did not go
|
||||
// to the .fd file.
|
||||
// This is the place to add settings of the dialog that did not go
|
||||
// to the .fd file.
|
||||
|
||||
// Set the input widgets to issue a callback to input() whenever
|
||||
// they change, so we can verify their content.
|
||||
fl_set_input_return(dialog_->input_width,
|
||||
FL_RETURN_CHANGED);
|
||||
fl_set_input_return(dialog_->input_height,
|
||||
FL_RETURN_CHANGED);
|
||||
fl_set_input_return(dialog_->input_filename,
|
||||
FL_RETURN_CHANGED);
|
||||
// fl_set_input_return(dialog_->input_rotate_angle,
|
||||
// FL_RETURN_CHANGED);
|
||||
|
||||
// Set the maximum characters that can be written in the input texts.
|
||||
fl_set_input_maxchars(dialog_->input_width, WIDTH_MAXDIGITS);
|
||||
fl_set_input_maxchars(dialog_->input_height, HEIGHT_MAXDIGITS);
|
||||
fl_set_input_maxchars(dialog_->input_filename, FILENAME_MAXCHARS);
|
||||
fl_set_input_maxchars(dialog_->input_rotate_angle, ROTATE_MAXCHARS);
|
||||
|
||||
// Set input filter on width and height to make them accept only
|
||||
// unsigned numbers.
|
||||
fl_set_input_filter(dialog_->input_width,
|
||||
fl_unsigned_int_filter);
|
||||
fl_set_input_filter(dialog_->input_height,
|
||||
fl_unsigned_int_filter);
|
||||
// Set the input widgets to issue a callback to input() whenever
|
||||
// they change, so we can verify their content.
|
||||
fl_set_input_return (dialog_->input_width,
|
||||
FL_RETURN_CHANGED);
|
||||
fl_set_input_return (dialog_->input_height,
|
||||
FL_RETURN_CHANGED);
|
||||
fl_set_input_return (dialog_->input_filename,
|
||||
FL_RETURN_CHANGED);
|
||||
// fl_set_input_return(dialog_->input_rotate_angle,
|
||||
// FL_RETURN_CHANGED);
|
||||
|
||||
|
||||
// Add the widgets of the width radio buttons to their group
|
||||
widthButtons.reset();
|
||||
widthButtons.registerRadioButton(dialog_->radio_width_default,
|
||||
InsetGraphicsParams::DEFAULT_SIZE);
|
||||
widthButtons.registerRadioButton(dialog_->radio_width_cm,
|
||||
InsetGraphicsParams::CM);
|
||||
widthButtons.registerRadioButton(dialog_->radio_width_inch,
|
||||
InsetGraphicsParams::INCH);
|
||||
widthButtons.registerRadioButton(dialog_->radio_width_percent_page,
|
||||
InsetGraphicsParams::PERCENT_PAGE);
|
||||
widthButtons.registerRadioButton(dialog_->radio_width_percent_column,
|
||||
InsetGraphicsParams::PERCENT_COLUMN);
|
||||
|
||||
// Add the widgets of the height radio buttons to their group
|
||||
heightButtons.reset();
|
||||
heightButtons.registerRadioButton(dialog_->radio_height_default,
|
||||
InsetGraphicsParams::DEFAULT_SIZE);
|
||||
heightButtons.registerRadioButton(dialog_->radio_height_cm,
|
||||
InsetGraphicsParams::CM);
|
||||
heightButtons.registerRadioButton(dialog_->radio_height_inch,
|
||||
InsetGraphicsParams::INCH);
|
||||
heightButtons.registerRadioButton(dialog_->radio_height_percent_page,
|
||||
InsetGraphicsParams::PERCENT_PAGE);
|
||||
|
||||
// Add the widgets of the display radio buttons to their group
|
||||
displayButtons.reset();
|
||||
displayButtons.registerRadioButton(dialog_->radio_display_color,
|
||||
InsetGraphicsParams::COLOR);
|
||||
displayButtons.registerRadioButton(dialog_->radio_display_grayscale,
|
||||
InsetGraphicsParams::GRAYSCALE);
|
||||
displayButtons.registerRadioButton(dialog_->radio_display_monochrome,
|
||||
InsetGraphicsParams::MONOCHROME);
|
||||
displayButtons.registerRadioButton(dialog_->radio_no_display,
|
||||
InsetGraphicsParams::NONE);
|
||||
|
||||
// Connect a signal to hide the window when the window manager orders it.
|
||||
fl_set_form_atclose(dialog_->form,
|
||||
C_FormGraphicsWMHideCB, 0);
|
||||
// Set the maximum characters that can be written in the input texts.
|
||||
fl_set_input_maxchars(dialog_->input_width, WIDTH_MAXDIGITS);
|
||||
fl_set_input_maxchars(dialog_->input_height, HEIGHT_MAXDIGITS);
|
||||
fl_set_input_maxchars(dialog_->input_filename, FILENAME_MAXCHARS);
|
||||
fl_set_input_maxchars(dialog_->input_rotate_angle, ROTATE_MAXCHARS);
|
||||
|
||||
// Set input filter on width and height to make them accept only
|
||||
// unsigned numbers.
|
||||
fl_set_input_filter(dialog_->input_width,
|
||||
fl_unsigned_int_filter);
|
||||
fl_set_input_filter(dialog_->input_height,
|
||||
fl_unsigned_int_filter);
|
||||
|
||||
|
||||
// Add the widgets of the width radio buttons to their group
|
||||
widthButtons.reset();
|
||||
widthButtons.registerRadioButton(dialog_->radio_width_default,
|
||||
InsetGraphicsParams::DEFAULT_SIZE);
|
||||
widthButtons.registerRadioButton(dialog_->radio_width_cm,
|
||||
InsetGraphicsParams::CM);
|
||||
widthButtons.registerRadioButton(dialog_->radio_width_inch,
|
||||
InsetGraphicsParams::INCH);
|
||||
widthButtons.registerRadioButton(dialog_->radio_width_percent_page,
|
||||
InsetGraphicsParams::PERCENT_PAGE);
|
||||
widthButtons.registerRadioButton(dialog_->radio_width_percent_column,
|
||||
InsetGraphicsParams::PERCENT_COLUMN);
|
||||
|
||||
// Add the widgets of the height radio buttons to their group
|
||||
heightButtons.reset();
|
||||
heightButtons.registerRadioButton(dialog_->radio_height_default,
|
||||
InsetGraphicsParams::DEFAULT_SIZE);
|
||||
heightButtons.registerRadioButton(dialog_->radio_height_cm,
|
||||
InsetGraphicsParams::CM);
|
||||
heightButtons.registerRadioButton(dialog_->radio_height_inch,
|
||||
InsetGraphicsParams::INCH);
|
||||
heightButtons.registerRadioButton(dialog_->radio_height_percent_page,
|
||||
InsetGraphicsParams::PERCENT_PAGE);
|
||||
|
||||
// Add the widgets of the display radio buttons to their group
|
||||
displayButtons.reset();
|
||||
displayButtons.registerRadioButton(dialog_->radio_display_color,
|
||||
InsetGraphicsParams::COLOR);
|
||||
displayButtons.registerRadioButton(dialog_->radio_display_grayscale,
|
||||
InsetGraphicsParams::GRAYSCALE);
|
||||
displayButtons.registerRadioButton(dialog_->radio_display_monochrome,
|
||||
InsetGraphicsParams::MONOCHROME);
|
||||
displayButtons.registerRadioButton(dialog_->radio_no_display,
|
||||
InsetGraphicsParams::NONE);
|
||||
|
||||
// Connect a signal to hide the window when the window manager orders it.
|
||||
fl_set_form_atclose(dialog_->form,
|
||||
C_FormGraphicsWMHideCB, 0);
|
||||
}
|
||||
|
||||
void FormGraphics::show()
|
||||
{
|
||||
// If the dialog doesn't exist yet, build it.
|
||||
// If the dialog doesn't exist yet, build it.
|
||||
if (!dialog_) {
|
||||
build();
|
||||
}
|
||||
|
||||
// Update the form with the data from the inset.
|
||||
update();
|
||||
|
||||
// If the form is visible
|
||||
// Update the form with the data from the inset.
|
||||
update();
|
||||
|
||||
// If the form is visible
|
||||
if (dialog_->form->visible) {
|
||||
// Raise it.
|
||||
// Raise it.
|
||||
fl_raise_form(dialog_->form);
|
||||
} else {
|
||||
// Otherwise (invisible), show it.
|
||||
// Otherwise (invisible), show it.
|
||||
fl_show_form(dialog_->form,
|
||||
FL_PLACE_MOUSE,
|
||||
FL_FULLBORDER,
|
||||
_("Graphics"));
|
||||
FL_PLACE_MOUSE,
|
||||
FL_FULLBORDER,
|
||||
_("Graphics"));
|
||||
|
||||
// And connect the signals 'updateBufferDependent',
|
||||
// 'hideBufferDependent' and 'hideGraphics'.
|
||||
// And connect the signals 'updateBufferDependent',
|
||||
// 'hideBufferDependent' and 'hideGraphics'.
|
||||
u_ = d_->updateBufferDependent.connect(slot(this,
|
||||
&FormGraphics::update));
|
||||
&FormGraphics::update));
|
||||
h_ = d_->hideBufferDependent.connect(slot(this,
|
||||
&FormGraphics::hide));
|
||||
&FormGraphics::hide));
|
||||
}
|
||||
}
|
||||
|
||||
void FormGraphics::showDialog(InsetGraphics* inset)
|
||||
{
|
||||
#ifdef ENABLE_ASSERTIONS
|
||||
Assert(inset != 0);
|
||||
#endif
|
||||
Assert(inset != 0);
|
||||
|
||||
// If we are connected to another inset, disconnect.
|
||||
if (inset_)
|
||||
ih_.disconnect();
|
||||
|
||||
inset_ = inset;
|
||||
|
||||
if (inset_) {
|
||||
ih_ = inset_->hide.connect(slot(this, &FormGraphics::hide));
|
||||
show();
|
||||
}
|
||||
// If we are connected to another inset, disconnect.
|
||||
if (inset_)
|
||||
ih_.disconnect();
|
||||
|
||||
inset_ = inset;
|
||||
|
||||
if (inset_) {
|
||||
ih_ = inset_->hide.connect(slot(this, &FormGraphics::hide));
|
||||
show();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void FormGraphics::hide()
|
||||
{
|
||||
// If the dialog exists, and the form is allocated and visible.
|
||||
// If the dialog exists, and the form is allocated and visible.
|
||||
if (dialog_
|
||||
&& dialog_->form
|
||||
&& dialog_->form->visible) {
|
||||
// Hide the form
|
||||
// Hide the form
|
||||
fl_hide_form(dialog_->form);
|
||||
|
||||
// And disconnect the signals.
|
||||
u_.disconnect();
|
||||
// And disconnect the signals.
|
||||
u_.disconnect();
|
||||
h_.disconnect();
|
||||
ih_.disconnect();
|
||||
ih_.disconnect();
|
||||
|
||||
// Forget the inset.
|
||||
inset_ = 0;
|
||||
// Forget the inset.
|
||||
inset_ = 0;
|
||||
}
|
||||
// Most of the time, the dialog is not needed anymore, we'll free it
|
||||
// now to save memory.
|
||||
free();
|
||||
// Most of the time, the dialog is not needed anymore, we'll free it
|
||||
// now to save memory.
|
||||
free();
|
||||
}
|
||||
|
||||
|
||||
@ -229,7 +223,7 @@ void FormGraphics::free()
|
||||
widthButtons.reset();
|
||||
heightButtons.reset();
|
||||
displayButtons.reset();
|
||||
|
||||
|
||||
// Free the form.
|
||||
delete dialog_;
|
||||
dialog_ = 0;
|
||||
@ -237,156 +231,146 @@ void FormGraphics::free()
|
||||
|
||||
void FormGraphics::apply()
|
||||
{
|
||||
#ifdef ENABLE_ASSERTIONS
|
||||
Assert(inset_ != 0);
|
||||
#endif
|
||||
if (! inset_)
|
||||
return;
|
||||
Assert(inset_ != 0);
|
||||
|
||||
// Take all dialog details and insert them to the inset.
|
||||
// Take all dialog details and insert them to the inset.
|
||||
|
||||
// Create the parameters structure and fill the data from the dialog.
|
||||
InsetGraphicsParams igp;
|
||||
// Create the parameters structure and fill the data from the dialog.
|
||||
InsetGraphicsParams igp;
|
||||
|
||||
igp.filename = fl_get_input(dialog_->input_filename);
|
||||
igp.filename = fl_get_input(dialog_->input_filename);
|
||||
|
||||
igp.display = static_cast<InsetGraphicsParams::DisplayType>
|
||||
(displayButtons.getButton());
|
||||
|
||||
igp.widthResize = static_cast<InsetGraphicsParams::Resize>
|
||||
(widthButtons.getButton());
|
||||
igp.widthSize = strToDbl(fl_get_input(dialog_->input_width));
|
||||
igp.display = static_cast < InsetGraphicsParams::DisplayType >
|
||||
(displayButtons.getButton());
|
||||
|
||||
igp.heightResize = static_cast<InsetGraphicsParams::Resize>
|
||||
(heightButtons.getButton());
|
||||
igp.heightSize = strToDbl(fl_get_input(dialog_->input_height));
|
||||
igp.widthResize = static_cast < InsetGraphicsParams::Resize >
|
||||
(widthButtons.getButton());
|
||||
igp.widthSize = strToDbl(fl_get_input(dialog_->input_width));
|
||||
|
||||
igp.rotateAngle = strToInt(fl_get_input(dialog_->input_rotate_angle));
|
||||
if (igp.rotateAngle >= 360)
|
||||
igp.rotateAngle = igp.rotateAngle % 360;
|
||||
if (igp.rotateAngle <= -360)
|
||||
igp.rotateAngle = - ((-igp.rotateAngle) % 360);
|
||||
|
||||
igp.subcaption = fl_get_button(dialog_->check_subcaption);
|
||||
igp.subcaptionText = fl_get_input(dialog_->input_subcaption);
|
||||
igp.heightResize = static_cast < InsetGraphicsParams::Resize >
|
||||
(heightButtons.getButton());
|
||||
igp.heightSize = strToDbl(fl_get_input(dialog_->input_height));
|
||||
|
||||
igp.inlineFigure = fl_get_button(dialog_->check_inline);
|
||||
|
||||
#ifdef ENABLE_ASSERTIONS
|
||||
igp.testInvariant();
|
||||
#endif
|
||||
igp.rotateAngle = strToInt(fl_get_input(dialog_->input_rotate_angle));
|
||||
if (igp.rotateAngle >= 360)
|
||||
igp.rotateAngle = igp.rotateAngle % 360;
|
||||
if (igp.rotateAngle <= -360)
|
||||
igp.rotateAngle = - (( -igp.rotateAngle) % 360);
|
||||
|
||||
// Set the parameters in the inset, it also returns true if the new
|
||||
// parameters are different from what was in the inset already.
|
||||
bool changed = inset_->setParams(igp);
|
||||
igp.subcaption = fl_get_button(dialog_->check_subcaption);
|
||||
igp.subcaptionText = fl_get_input(dialog_->input_subcaption);
|
||||
|
||||
// Tell LyX we've got a change, and mark the document dirty, if it changed.
|
||||
lv_->view()->updateInset(inset_, changed);
|
||||
igp.inlineFigure = fl_get_button(dialog_->check_inline);
|
||||
|
||||
igp.testInvariant();
|
||||
|
||||
// Set the parameters in the inset, it also returns true if the new
|
||||
// parameters are different from what was in the inset already.
|
||||
bool changed = inset_->setParams(igp);
|
||||
|
||||
// Tell LyX we've got a change, and mark the document dirty, if it changed.
|
||||
lv_->view()->updateInset(inset_, changed);
|
||||
}
|
||||
|
||||
void FormGraphics::update()
|
||||
{
|
||||
#ifdef ENABLE_ASSERTIONS
|
||||
Assert(inset_ != 0);
|
||||
#endif
|
||||
if (! inset_)
|
||||
return;
|
||||
Assert(inset_ != 0);
|
||||
|
||||
// Update dialog with details from inset
|
||||
InsetGraphicsParams igp = inset_->getParams();
|
||||
// Update dialog with details from inset
|
||||
InsetGraphicsParams igp = inset_->getParams();
|
||||
|
||||
// Update the filename input field
|
||||
fl_set_input(dialog_->input_filename,
|
||||
igp.filename.c_str());
|
||||
// Update the filename input field
|
||||
fl_set_input(dialog_->input_filename,
|
||||
igp.filename.c_str());
|
||||
|
||||
// Update the display depth radio buttons
|
||||
displayButtons.setButton(igp.display);
|
||||
|
||||
// Update the width radio buttons and input field
|
||||
widthButtons.setButton(igp.widthResize);
|
||||
fl_set_input(dialog_->input_width,
|
||||
tostr(igp.widthSize).c_str());
|
||||
// Update the display depth radio buttons
|
||||
displayButtons.setButton(igp.display);
|
||||
|
||||
// Update the height radio buttons and input field
|
||||
heightButtons.setButton(igp.heightResize);
|
||||
fl_set_input(dialog_->input_height,
|
||||
tostr(igp.heightSize).c_str());
|
||||
// Update the width radio buttons and input field
|
||||
widthButtons.setButton(igp.widthResize);
|
||||
fl_set_input(dialog_->input_width,
|
||||
tostr(igp.widthSize).c_str());
|
||||
|
||||
// Update the rotate angle
|
||||
fl_set_input(dialog_->input_rotate_angle,
|
||||
tostr(igp.rotateAngle).c_str());
|
||||
|
||||
// Update the subcaption check button and input field
|
||||
fl_set_button(dialog_->check_subcaption,
|
||||
igp.subcaption);
|
||||
fl_set_input(dialog_->input_subcaption,
|
||||
igp.subcaptionText.c_str());
|
||||
|
||||
// Update the inline figure check button
|
||||
fl_set_button(dialog_->check_inline,
|
||||
igp.inlineFigure);
|
||||
|
||||
// Now make sure that the buttons are set correctly.
|
||||
input();
|
||||
// Update the height radio buttons and input field
|
||||
heightButtons.setButton(igp.heightResize);
|
||||
fl_set_input(dialog_->input_height,
|
||||
tostr(igp.heightSize).c_str());
|
||||
|
||||
// Update the rotate angle
|
||||
fl_set_input(dialog_->input_rotate_angle,
|
||||
tostr(igp.rotateAngle).c_str());
|
||||
|
||||
// Update the subcaption check button and input field
|
||||
fl_set_button(dialog_->check_subcaption,
|
||||
igp.subcaption);
|
||||
fl_set_input(dialog_->input_subcaption,
|
||||
igp.subcaptionText.c_str());
|
||||
|
||||
// Update the inline figure check button
|
||||
fl_set_button(dialog_->check_inline,
|
||||
igp.inlineFigure);
|
||||
|
||||
// Now make sure that the buttons are set correctly.
|
||||
input();
|
||||
}
|
||||
|
||||
void FormGraphics::input()
|
||||
void FormGraphics::input()
|
||||
{
|
||||
// Put verifications that the dialog shows some sane values,
|
||||
// if not disallow clicking on ok/apply.
|
||||
// Possibly use a label in the bottom of the dialog to give the reason.
|
||||
// Put verifications that the dialog shows some sane values,
|
||||
// if not disallow clicking on ok/apply.
|
||||
// Possibly use a label in the bottom of the dialog to give the reason.
|
||||
|
||||
// Is all input boxes convey a valid meaning?
|
||||
bool inputOK = true;
|
||||
// Is all input boxes convey a valid meaning?
|
||||
bool inputOK = true;
|
||||
|
||||
// Things that we check (meaning they are incorrect states):
|
||||
// 1. No filename specified.
|
||||
// 2. Width radio button is not Default and width text is not a number.
|
||||
// 3. Height radio button is not Default and height text is a not a number
|
||||
|
||||
// Note: radio button default means that the user asks for the image
|
||||
// to be included as is with no size change, in this case we don't need
|
||||
// any width or height.
|
||||
|
||||
// We verify now that there is a filename, it exists, it's a file
|
||||
// and it's readable.
|
||||
string filename = fl_get_input(dialog_->input_filename);
|
||||
FileInfo file(filename);
|
||||
if (filename.empty()
|
||||
|| !file.isOK()
|
||||
|| !file.exist()
|
||||
|| !file.isRegular()
|
||||
|| !file.readable()
|
||||
)
|
||||
inputOK = false;
|
||||
// Things that we check (meaning they are incorrect states):
|
||||
// 1. No filename specified.
|
||||
// 2. Width radio button is not Default and width text is not a number.
|
||||
// 3. Height radio button is not Default and height text is a not a number
|
||||
|
||||
// Width radio button not default and no number.
|
||||
if (!fl_get_button(dialog_->radio_width_default)
|
||||
&& strToDbl(fl_get_input(dialog_->input_width)) <= 0.0) {
|
||||
|
||||
inputOK = false;
|
||||
}
|
||||
// Note: radio button default means that the user asks for the image
|
||||
// to be included as is with no size change, in this case we don't need
|
||||
// any width or height.
|
||||
|
||||
// Height radio button not default and no number.
|
||||
if (!fl_get_button(dialog_->radio_height_default)
|
||||
&& strToDbl(fl_get_input(dialog_->input_height)) <= 0.0) {
|
||||
|
||||
inputOK = false;
|
||||
}
|
||||
// We verify now that there is a filename, it exists, it's a file
|
||||
// and it's readable.
|
||||
string filename = fl_get_input(dialog_->input_filename);
|
||||
FileInfo file(filename);
|
||||
if (filename.empty()
|
||||
|| !file.isOK()
|
||||
|| !file.exist()
|
||||
|| !file.isRegular()
|
||||
|| !file.readable()
|
||||
)
|
||||
inputOK = false;
|
||||
|
||||
// Width radio button not default and no number.
|
||||
if (!fl_get_button(dialog_->radio_width_default)
|
||||
&& strToDbl(fl_get_input(dialog_->input_width)) <= 0.0) {
|
||||
|
||||
inputOK = false;
|
||||
}
|
||||
|
||||
// Height radio button not default and no number.
|
||||
if (!fl_get_button(dialog_->radio_height_default)
|
||||
&& strToDbl(fl_get_input(dialog_->input_height)) <= 0.0) {
|
||||
|
||||
inputOK = false;
|
||||
}
|
||||
|
||||
|
||||
// Now set the buttons to the correct state.
|
||||
if (inputOK && ! lv_->buffer()->isReadonly()) {
|
||||
fl_activate_object(dialog_->button_ok);
|
||||
fl_activate_object(dialog_->button_apply);
|
||||
fl_set_object_lcol(dialog_->button_ok, FL_BLACK);
|
||||
fl_set_object_lcol(dialog_->button_apply, FL_BLACK);
|
||||
} else {
|
||||
fl_deactivate_object(dialog_->button_ok);
|
||||
fl_deactivate_object(dialog_->button_apply);
|
||||
fl_set_object_lcol(dialog_->button_ok, FL_INACTIVE);
|
||||
fl_set_object_lcol(dialog_->button_apply, FL_INACTIVE);
|
||||
}
|
||||
// Now set the buttons to the correct state.
|
||||
if (inputOK && ! lv_->buffer()->isReadonly()) {
|
||||
fl_activate_object(dialog_->button_ok);
|
||||
fl_activate_object(dialog_->button_apply);
|
||||
fl_set_object_lcol(dialog_->button_ok, FL_BLACK);
|
||||
fl_set_object_lcol(dialog_->button_apply, FL_BLACK);
|
||||
} else {
|
||||
fl_deactivate_object(dialog_->button_ok);
|
||||
fl_deactivate_object(dialog_->button_apply);
|
||||
fl_set_object_lcol(dialog_->button_ok, FL_INACTIVE);
|
||||
fl_set_object_lcol(dialog_->button_apply, FL_INACTIVE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -398,40 +382,40 @@ extern string user_lyxdir;
|
||||
// Need to move this to the form_graphics
|
||||
string FormGraphics::browseFile(string const & filename)
|
||||
{
|
||||
if (! filename.empty() )
|
||||
last_image_path = OnlyPath(filename);
|
||||
if (! filename.empty() )
|
||||
last_image_path = OnlyPath(filename);
|
||||
|
||||
// Does user clipart directory exist?
|
||||
string bufclip = AddName (user_lyxdir, "clipart");
|
||||
FileInfo fileInfo(bufclip);
|
||||
if (!(fileInfo.isOK() && fileInfo.isDir()))
|
||||
// No - bail out to system clipart directory
|
||||
bufclip = AddName (system_lyxdir, "clipart");
|
||||
// Does user clipart directory exist?
|
||||
string bufclip = AddName (user_lyxdir, "clipart");
|
||||
FileInfo fileInfo(bufclip);
|
||||
if (!(fileInfo.isOK() && fileInfo.isDir()))
|
||||
// No - bail out to system clipart directory
|
||||
bufclip = AddName (system_lyxdir, "clipart");
|
||||
|
||||
LyXFileDlg fileDlg;
|
||||
fileDlg.SetButton(0, _("Clipart"), bufclip);
|
||||
LyXFileDlg fileDlg;
|
||||
fileDlg.SetButton(0, _("Clipart"), bufclip);
|
||||
|
||||
bool error = false;
|
||||
string buf;
|
||||
do {
|
||||
string p = fileDlg.Select(_("Graphics"),
|
||||
last_image_path,
|
||||
"*(ps|png)", filename);
|
||||
bool error = false;
|
||||
string buf;
|
||||
do {
|
||||
string p = fileDlg.Select(_("Graphics"),
|
||||
last_image_path,
|
||||
"*(ps|png)", filename);
|
||||
|
||||
if (p.empty()) return p;
|
||||
if (p.empty()) return p;
|
||||
|
||||
last_image_path = OnlyPath(p);
|
||||
last_image_path = OnlyPath(p);
|
||||
|
||||
if (p.find_first_of("#~$% ") != string::npos) {
|
||||
if (p.find_first_of("#~$% ") != string::npos) {
|
||||
WriteAlert(_("Filename can't contain any "
|
||||
"of these characters:"),
|
||||
// xgettext:no-c-format
|
||||
_("space, '#', '~', '$' or '%'."));
|
||||
"of these characters:"),
|
||||
// xgettext:no-c-format
|
||||
_("space, '#', '~', '$' or '%'."));
|
||||
error = true;
|
||||
} else {
|
||||
error = false;
|
||||
buf = p;
|
||||
}
|
||||
error = false;
|
||||
buf = p;
|
||||
}
|
||||
} while (error);
|
||||
|
||||
return buf;
|
||||
@ -439,29 +423,29 @@ string FormGraphics::browseFile(string const & filename)
|
||||
|
||||
void FormGraphics::browse()
|
||||
{
|
||||
// Get the filename from the dialog
|
||||
string filename = fl_get_input(dialog_->input_filename);
|
||||
// Get the filename from the dialog
|
||||
string filename = fl_get_input(dialog_->input_filename);
|
||||
|
||||
// Show the file browser dialog
|
||||
string new_filename = browseFile(filename);
|
||||
// Show the file browser dialog
|
||||
string new_filename = browseFile(filename);
|
||||
|
||||
// Save the filename to the dialog
|
||||
if (new_filename != filename && ! new_filename.empty()) {
|
||||
fl_set_input(dialog_->input_filename,
|
||||
new_filename.c_str());
|
||||
// The above set input doesn't cause an input event so we do
|
||||
// it manually. Otherwise the user needs to cause an input event
|
||||
// to get the ok/apply buttons to be activated.
|
||||
input();
|
||||
}
|
||||
|
||||
// Save the filename to the dialog
|
||||
if (new_filename != filename && ! new_filename.empty()) {
|
||||
fl_set_input(dialog_->input_filename,
|
||||
new_filename.c_str());
|
||||
// The above set input doesn't cause an input event so we do
|
||||
// it manually. Otherwise the user needs to cause an input event
|
||||
// to get the ok/apply buttons to be activated.
|
||||
input();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
int FormGraphics::WMHideCB(FL_FORM * form, void *)
|
||||
{
|
||||
// Ensure that the signal h is disconnected even if the
|
||||
// window manager is used to close the dialog.
|
||||
FormGraphics * pre = static_cast<FormGraphics*>(form->u_vdata);
|
||||
FormGraphics * pre = static_cast < FormGraphics* > (form->u_vdata);
|
||||
pre->hide();
|
||||
return FL_CANCEL;
|
||||
}
|
||||
@ -469,41 +453,41 @@ int FormGraphics::WMHideCB(FL_FORM * form, void *)
|
||||
|
||||
void FormGraphics::OKCB(FL_OBJECT * ob, long)
|
||||
{
|
||||
FormGraphics * pre = static_cast<FormGraphics*>(ob->form->u_vdata);
|
||||
pre->apply();
|
||||
FormGraphics * pre = static_cast < FormGraphics* > (ob->form->u_vdata);
|
||||
pre->apply();
|
||||
pre->hide();
|
||||
}
|
||||
|
||||
void FormGraphics::ApplyCB(FL_OBJECT * ob, long)
|
||||
{
|
||||
FormGraphics * pre = static_cast<FormGraphics*>(ob->form->u_vdata);
|
||||
FormGraphics * pre = static_cast < FormGraphics* > (ob->form->u_vdata);
|
||||
pre->apply();
|
||||
}
|
||||
|
||||
void FormGraphics::CancelCB(FL_OBJECT * ob, long)
|
||||
{
|
||||
FormGraphics * pre = static_cast<FormGraphics*>(ob->form->u_vdata);
|
||||
FormGraphics * pre = static_cast < FormGraphics* > (ob->form->u_vdata);
|
||||
pre->hide();
|
||||
}
|
||||
|
||||
void FormGraphics::BrowseCB(FL_OBJECT * ob, long)
|
||||
{
|
||||
FormGraphics * pre = static_cast<FormGraphics*>(ob->form->u_vdata);
|
||||
pre->browse();
|
||||
FormGraphics * pre = static_cast < FormGraphics* > (ob->form->u_vdata);
|
||||
pre->browse();
|
||||
}
|
||||
|
||||
void FormGraphics::AdvancedOptionsCB(FL_OBJECT * /* ob */, long)
|
||||
{
|
||||
// FormGraphics * pre = static_cast<FormGraphics*>(ob->form->u_vdata);
|
||||
// pre->showAdvancedOptions();
|
||||
lyxerr << "Advanced Options button depressed, "
|
||||
"show advanced options dialog"
|
||||
<< endl;
|
||||
// FormGraphics * pre = static_cast<FormGraphics*>(ob->form->u_vdata);
|
||||
// pre->showAdvancedOptions();
|
||||
lyxerr << "Advanced Options button depressed, "
|
||||
"show advanced options dialog"
|
||||
<< endl;
|
||||
}
|
||||
|
||||
void FormGraphics::InputCB(FL_OBJECT * ob, long)
|
||||
{
|
||||
FormGraphics * pre = static_cast<FormGraphics*>(ob->form->u_vdata);
|
||||
FormGraphics * pre = static_cast < FormGraphics* > (ob->form->u_vdata);
|
||||
pre->input();
|
||||
}
|
||||
|
||||
|
@ -18,8 +18,6 @@
|
||||
#ifndef FORMGRAPHICS_H
|
||||
#define FORMGRAPHICS_H
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "LString.h"
|
||||
#include "frontends/DialogBase.h"
|
||||
//#include "form_graphics.h"
|
||||
@ -27,7 +25,7 @@
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
#endif
|
||||
#endif
|
||||
|
||||
class Dialogs;
|
||||
// same arguement as in Dialogs.h s/LyX/UI/
|
||||
@ -38,14 +36,15 @@ struct FD_form_graphics;
|
||||
|
||||
/** This class provides an XForms implementation of the FormGraphics Dialog.
|
||||
*/
|
||||
class FormGraphics: public DialogBase {
|
||||
class FormGraphics: public DialogBase
|
||||
{
|
||||
public:
|
||||
/// #FormGraphics x(LyXFunc ..., Dialogs ...);#
|
||||
FormGraphics(LyXView *, Dialogs *);
|
||||
///
|
||||
~FormGraphics();
|
||||
///
|
||||
static int WMHideCB(FL_FORM *, void *);
|
||||
static int WMHideCB(FL_FORM *, void *);
|
||||
///
|
||||
static void OKCB(FL_OBJECT *, long);
|
||||
///
|
||||
@ -62,31 +61,31 @@ public:
|
||||
private:
|
||||
///
|
||||
FormGraphics()
|
||||
: widthButtons(5), heightButtons(4), displayButtons(4) {}
|
||||
: widthButtons(5), heightButtons(4), displayButtons(4) {}
|
||||
//
|
||||
FormGraphics(FormGraphics const &) : DialogBase() {}
|
||||
|
||||
FormGraphics(FormGraphics const &) : DialogBase() {}
|
||||
|
||||
/// The maximum digits for the image width (cm, inch, percent)
|
||||
enum {
|
||||
///
|
||||
WIDTH_MAXDIGITS = 3
|
||||
};
|
||||
///
|
||||
WIDTH_MAXDIGITS = 3
|
||||
};
|
||||
/// The maximum digits for the image height (cm, inch, percent)
|
||||
enum {
|
||||
///
|
||||
HEIGHT_MAXDIGITS = 3
|
||||
///
|
||||
HEIGHT_MAXDIGITS = 3
|
||||
};
|
||||
/// The maximum characters in the rotation angle (minus sign and 3 digits)
|
||||
enum {
|
||||
///
|
||||
ROTATE_MAXCHARS = 4
|
||||
///
|
||||
ROTATE_MAXCHARS = 4
|
||||
};
|
||||
/// The maximum characters in a filename.
|
||||
enum {
|
||||
///
|
||||
FILENAME_MAXCHARS = 1024
|
||||
///
|
||||
FILENAME_MAXCHARS = 1024
|
||||
};
|
||||
|
||||
|
||||
/**@name Slot Methods */
|
||||
//@{
|
||||
/// Save the active inset and show the dialog.
|
||||
@ -108,7 +107,7 @@ private:
|
||||
/// Open the file browse dialog to select an image file.
|
||||
void browse();
|
||||
//@}
|
||||
|
||||
|
||||
/// Build the dialog
|
||||
void build();
|
||||
///
|
||||
@ -152,6 +151,7 @@ private:
|
||||
string last_image_path;
|
||||
//@}
|
||||
|
||||
};
|
||||
}
|
||||
;
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
@ -9,12 +9,12 @@
|
||||
* This file Copyright 2000 Baruch Even
|
||||
* ================================================= */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <config.h>
|
||||
#include "RadioButtonGroup.h"
|
||||
|
||||
#include "debug.h" // for lyxerr
|
||||
@ -28,76 +28,78 @@ using std::endl;
|
||||
|
||||
void RadioButtonGroup::registerRadioButton(FL_OBJECT *button, int value)
|
||||
{
|
||||
map.push_back( ButtonValuePair(button, value) );
|
||||
map.push_back( ButtonValuePair(button, value) );
|
||||
}
|
||||
|
||||
|
||||
void RadioButtonGroup::reset()
|
||||
{
|
||||
map.clear();
|
||||
map.clear();
|
||||
}
|
||||
|
||||
// Functor to help us in our work, we should try to find how to achieve
|
||||
// this with only STL predicates, but its easier to write this than to
|
||||
// dig. If you can find the equivalent STL predicate combination, let me
|
||||
// know.
|
||||
//
|
||||
// The idea is to take a pair and a value and return true when the second
|
||||
// element in the pair equals the value.
|
||||
template <typename T>
|
||||
struct equal_to_second_in_pair {
|
||||
typedef bool result_type;
|
||||
typedef T first_argument_type;
|
||||
typedef typename T::second_type second_argument_type;
|
||||
// Functor to help us in our work, we should try to find how to achieve
|
||||
// this with only STL predicates, but its easier to write this than to
|
||||
// dig. If you can find the equivalent STL predicate combination, let me
|
||||
// know.
|
||||
//
|
||||
// The idea is to take a pair and a value and return true when the second
|
||||
// element in the pair equals the value.
|
||||
template < typename T >
|
||||
struct equal_to_second_in_pair
|
||||
{
|
||||
typedef bool result_type;
|
||||
typedef T first_argument_type;
|
||||
typedef typename T::second_type second_argument_type;
|
||||
|
||||
bool operator() (
|
||||
pair<typename T::first_type, typename T::second_type> const & left,
|
||||
typename T::second_type const & right) const
|
||||
{
|
||||
return left.second == right;
|
||||
}
|
||||
};
|
||||
bool operator() (
|
||||
pair < typename T::first_type, typename T::second_type > const & left,
|
||||
typename T::second_type const & right) const
|
||||
{
|
||||
return left.second == right;
|
||||
}
|
||||
};
|
||||
|
||||
void RadioButtonGroup::setButton(int value)
|
||||
{
|
||||
ButtonValueMap::const_iterator it =
|
||||
find_if(map.begin(), map.end(),
|
||||
bind2nd(equal_to_second_in_pair<ButtonValuePair>(),
|
||||
value));
|
||||
ButtonValueMap::const_iterator it =
|
||||
find_if(map.begin(), map.end(),
|
||||
bind2nd(equal_to_second_in_pair < ButtonValuePair > (),
|
||||
value));
|
||||
|
||||
// If we found nothing, report it and return
|
||||
if (it == map.end()) {
|
||||
lyxerr << "BUG: Requested value in RadioButtonGroup doesn't exists"
|
||||
<< endl;
|
||||
}
|
||||
else {
|
||||
fl_set_button((*it).first, 1);
|
||||
}
|
||||
|
||||
// If we found nothing, report it and return
|
||||
if (it == map.end()) {
|
||||
lyxerr << "BUG: Requested value in RadioButtonGroup doesn't exists"
|
||||
<< endl;
|
||||
} else {
|
||||
fl_set_button((*it).first, 1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
template < typename T >
|
||||
struct is_set_button {
|
||||
bool operator() (T const & item) const
|
||||
{
|
||||
return fl_get_button( (item).first );
|
||||
}
|
||||
bool operator() (T const & item) const
|
||||
{
|
||||
return fl_get_button( (item).first );
|
||||
}
|
||||
};
|
||||
|
||||
int RadioButtonGroup::getButton()
|
||||
int RadioButtonGroup::getButton()
|
||||
{
|
||||
// Find the first button that is active
|
||||
ButtonValueMap::iterator it =
|
||||
find_if(map.begin(), map.end(),
|
||||
is_set_button<ButtonValuePair>() );
|
||||
// Find the first button that is active
|
||||
ButtonValueMap::iterator it =
|
||||
find_if(map.begin(), map.end(),
|
||||
is_set_button < ButtonValuePair > () );
|
||||
|
||||
// If such a button was found, return its value.
|
||||
if (it != map.end()) {
|
||||
return (*it).second;
|
||||
}
|
||||
// If such a button was found, return its value.
|
||||
if (it != map.end()) {
|
||||
return (*it).second;
|
||||
}
|
||||
|
||||
lyxerr << "BUG: No radio button found to be active." << endl;
|
||||
lyxerr << "BUG: No radio button found to be active." << endl;
|
||||
|
||||
// Else return 0.
|
||||
return 0;
|
||||
// Else return 0.
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -21,38 +21,38 @@
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <vector>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
#include <utility>
|
||||
using std::vector;
|
||||
using std::pair;
|
||||
|
||||
#include FORMS_H_LOCATION
|
||||
|
||||
class RadioButtonGroup {
|
||||
class RadioButtonGroup
|
||||
{
|
||||
public:
|
||||
/// Constructor. Allocate space for 'n' items in the group.
|
||||
RadioButtonGroup(unsigned n = 5) : map(n)
|
||||
{};
|
||||
/// Destructor. Cleans up.
|
||||
~RadioButtonGroup() {};
|
||||
|
||||
/// Register a radio button with it's corresponding value.
|
||||
void registerRadioButton(FL_OBJECT *button, int value);
|
||||
/// Reset registrations.
|
||||
void reset();
|
||||
/// Constructor. Allocate space for 'n' items in the group.
|
||||
RadioButtonGroup(unsigned n = 5) : map(n) {};
|
||||
/// Destructor. Cleans up.
|
||||
~RadioButtonGroup() {};
|
||||
|
||||
// Set the active button.
|
||||
void setButton(int value);
|
||||
/// Register a radio button with it's corresponding value.
|
||||
void registerRadioButton(FL_OBJECT *button, int value);
|
||||
/// Reset registrations.
|
||||
void reset();
|
||||
|
||||
// Set the active button.
|
||||
void setButton(int value);
|
||||
|
||||
// Get the active button.
|
||||
int getButton();
|
||||
|
||||
// Get the active button.
|
||||
int getButton();
|
||||
|
||||
private:
|
||||
typedef pair<FL_OBJECT *, int> ButtonValuePair;
|
||||
typedef vector<ButtonValuePair> ButtonValueMap;
|
||||
ButtonValueMap map;
|
||||
typedef pair < FL_OBJECT *, int > ButtonValuePair;
|
||||
typedef vector < ButtonValuePair > ButtonValueMap;
|
||||
ButtonValueMap map;
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
@ -32,7 +32,7 @@ Known BUGS:
|
||||
* Bug in FileDlg class (src/filedlg.[hC]) when selecting a file and then
|
||||
pressing ok, it counts as if no real selection done. Apparently it
|
||||
when choosing a file it doesn't update the select file input line.
|
||||
|
||||
|
||||
Current PROBLEMS:
|
||||
|
||||
* How to support both PDF and PS output, should we do the conversion
|
||||
@ -48,13 +48,13 @@ Current PROBLEMS:
|
||||
sizes, not to mention rotations!
|
||||
|
||||
TODO Basics:
|
||||
|
||||
|
||||
* Add support for more features so that it will be better than insetfig.
|
||||
* Keep aspect ratio radio button
|
||||
|
||||
|
||||
* Create the GraphicsCache and FormatTranslator
|
||||
* Add inline viewing of image.
|
||||
|
||||
|
||||
TODO Before initial production release:
|
||||
* Replace insetfig everywhere
|
||||
* Read it's file format
|
||||
@ -62,7 +62,7 @@ TODO Before initial production release:
|
||||
* Search for comments of the form
|
||||
// INSET_GRAPHICS: remove this when InsetFig is thrown.
|
||||
And act upon them.
|
||||
|
||||
|
||||
* Pop up a dialog if the widget version is higher than what we accept.
|
||||
* Finish the basic To-do list.
|
||||
* Extract the general logic of the dialog in order to allow easier porting
|
||||
@ -70,7 +70,7 @@ TODO Before initial production release:
|
||||
platform dependent code in the appropriate dirs.
|
||||
|
||||
TODO Extended features:
|
||||
|
||||
|
||||
* Advanced Latex tab folder.
|
||||
* Add even more options to make it better than insetfig.
|
||||
* Support for complete control over the latex parameters for TeXperts
|
||||
@ -152,18 +152,18 @@ TODO Extended features:
|
||||
* transferring the file around.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation
|
||||
#endif
|
||||
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "insets/insetgraphics.h"
|
||||
#include "insets/insetgraphicsParams.h"
|
||||
#include "graphics/GraphicsCache.h"
|
||||
#include "graphics/GraphicsCacheItem.h"
|
||||
|
||||
|
||||
#include "frontends/Dialogs.h"
|
||||
#include "LyXView.h"
|
||||
#include "buffer.h"
|
||||
@ -184,21 +184,21 @@ using std::endl;
|
||||
|
||||
// Initialize only those variables that do not have a constructor.
|
||||
InsetGraphics::InsetGraphics()
|
||||
#ifdef IG_OLDPARAMS
|
||||
: use_bb(false), hiresbb(false), angle(0.0), origin(DEFAULT)
|
||||
,keepaspectratio(false), scale(0.0), clip(false), draft(false)
|
||||
,cacheHandle(0)
|
||||
#endif
|
||||
: cacheHandle(0), pixmapInitialized(false)
|
||||
#ifdef IG_OLDPARAMS
|
||||
: use_bb(false), hiresbb(false), angle(0.0), origin(DEFAULT)
|
||||
, keepaspectratio(false), scale(0.0), clip(false), draft(false)
|
||||
, cacheHandle(0)
|
||||
#endif
|
||||
: cacheHandle(0), pixmapInitialized(false)
|
||||
{}
|
||||
|
||||
InsetGraphics::~InsetGraphics()
|
||||
{
|
||||
// Emits the hide signal to the dialog connected (if any)
|
||||
hide();
|
||||
// Emits the hide signal to the dialog connected (if any)
|
||||
hide();
|
||||
}
|
||||
|
||||
int InsetGraphics::ascent(BufferView *, LyXFont const &) const
|
||||
int InsetGraphics::ascent(BufferView *, LyXFont const &) const
|
||||
{
|
||||
if (pixmapInitialized)
|
||||
return cacheHandle->getHeight();
|
||||
@ -207,14 +207,14 @@ int InsetGraphics::ascent(BufferView *, LyXFont const &) const
|
||||
}
|
||||
|
||||
|
||||
int InsetGraphics::descent(BufferView *, LyXFont const &) const
|
||||
int InsetGraphics::descent(BufferView *, LyXFont const &) const
|
||||
{
|
||||
// this is not true if viewport is used and clip is not.
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int InsetGraphics::width(BufferView *, LyXFont const &) const
|
||||
int InsetGraphics::width(BufferView *, LyXFont const &) const
|
||||
{
|
||||
if (pixmapInitialized)
|
||||
return cacheHandle->getWidth();
|
||||
@ -224,26 +224,29 @@ int InsetGraphics::width(BufferView *, LyXFont const &) const
|
||||
|
||||
|
||||
void InsetGraphics::draw(BufferView * bv, LyXFont const & font,
|
||||
int baseline, float & x, bool) const
|
||||
int baseline, float & x, bool) const
|
||||
{
|
||||
Painter & paint = bv->painter();
|
||||
|
||||
int lwidth = width(bv, font);
|
||||
int ldescent = descent(bv, font);
|
||||
int lascent = ascent(bv, font);
|
||||
|
||||
// This will draw the graphics. If the graphics has not been loaded yet,
|
||||
// we draw just a rectangle.
|
||||
if (pixmapInitialized) {
|
||||
|
||||
paint.pixmap(int(x)+2, baseline - ascent(bv, font),
|
||||
width(bv, font) - 4,
|
||||
ascent(bv,font) + descent(bv,font),
|
||||
pixmap);
|
||||
} else {
|
||||
paint.rectangle(int(x)+2, baseline - ascent(bv, font),
|
||||
width(bv, font) - 4,
|
||||
ascent(bv, font) + descent(bv, font));
|
||||
paint.pixmap(int(x) + 2, baseline - lascent,
|
||||
lwidth - 4, lascent + ldescent,
|
||||
pixmap);
|
||||
} else {
|
||||
paint.rectangle(int(x) + 2, baseline - lascent,
|
||||
lwidth - 4,
|
||||
lascent + ldescent);
|
||||
|
||||
// Check if the image is now ready.
|
||||
if (cacheHandle &&
|
||||
(cacheHandle->getImageStatus() == GraphicsCacheItem::Loaded)) {
|
||||
(cacheHandle->getImageStatus() == GraphicsCacheItem::Loaded)) {
|
||||
pixmap = cacheHandle->getImage();
|
||||
pixmapInitialized = true;
|
||||
|
||||
@ -252,13 +255,14 @@ void InsetGraphics::draw(BufferView * bv, LyXFont const & font,
|
||||
}
|
||||
}
|
||||
|
||||
x += width(bv, font);
|
||||
// Add the image width to the row width.
|
||||
x += lwidth;
|
||||
}
|
||||
|
||||
|
||||
void InsetGraphics::Edit(BufferView *bv, int, int, unsigned int)
|
||||
{
|
||||
bv->owner()->getDialogs() -> showGraphics(this);
|
||||
bv->owner()->getDialogs() -> showGraphics(this);
|
||||
}
|
||||
|
||||
|
||||
@ -272,7 +276,7 @@ void InsetGraphics::Write(Buffer const * buf, ostream & os) const
|
||||
{
|
||||
os << "GRAPHICS FormatVersion 1" << endl;
|
||||
|
||||
params.Write(buf, os);
|
||||
params.Write(buf, os);
|
||||
}
|
||||
|
||||
#if 0
|
||||
@ -284,7 +288,7 @@ void InsetGraphics::Write(Buffer const * buf, ostream & os) const
|
||||
// The questions are:
|
||||
// 1. Is this cleaner?
|
||||
// 2. Is there no hidden performance costs?
|
||||
//
|
||||
//
|
||||
// Regarding 2 I can already see that we will have two copies of the strings
|
||||
// one in the data part of the program and one in the map, but that won't be
|
||||
// more than say 2K (overestimation here), there is no real benefit to put
|
||||
@ -294,162 +298,163 @@ void InsetGraphics::Write(Buffer const * buf, ostream & os) const
|
||||
|
||||
void InsetGraphics::Read(Buffer const * buf, LyXLex & lex)
|
||||
{
|
||||
typedef map<string, enum TOKENS> ReadActionMap;
|
||||
static ReadActionMap const readMap;
|
||||
typedef map < string, enum TOKENS > ReadActionMap;
|
||||
static ReadActionMap const readMap;
|
||||
|
||||
bool finished = false;
|
||||
bool finished = false;
|
||||
|
||||
while (lex.IsOK() && !finished) {
|
||||
lex.next();
|
||||
while (lex.IsOK() && !finished) {
|
||||
lex.next();
|
||||
|
||||
string const token = lex.GetString();
|
||||
lyxerr.debug() << "Token: '" << token << '\'' << endl;
|
||||
string const token = lex.GetString();
|
||||
lyxerr.debug() << "Token: '" << token << '\'' << endl;
|
||||
|
||||
if (token.empty())
|
||||
continue;
|
||||
|
||||
ReadActionMap::const_iterator it =
|
||||
readMap.find(token);
|
||||
if (token.empty())
|
||||
continue;
|
||||
|
||||
if (it == readMap.end()) {
|
||||
lyxerr << "Unknown keyword, skipping." << endl;
|
||||
continue;
|
||||
}
|
||||
|
||||
switch (it.second) {
|
||||
case FILENAME_TOKEN:
|
||||
break;
|
||||
case VERSION_TOKEN:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
ReadActionMap::const_iterator it =
|
||||
readMap.find(token);
|
||||
|
||||
|
||||
}
|
||||
if (it == readMap.end()) {
|
||||
lyxerr << "Unknown keyword, skipping." << endl;
|
||||
continue;
|
||||
}
|
||||
|
||||
switch (it.second) {
|
||||
case FILENAME_TOKEN:
|
||||
break;
|
||||
case VERSION_TOKEN:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
void InsetGraphics::Read(Buffer const * buf, LyXLex & lex)
|
||||
void InsetGraphics::Read(Buffer const * buf, LyXLex & lex)
|
||||
{
|
||||
bool finished = false;
|
||||
|
||||
while (lex.IsOK() && !finished) {
|
||||
lex.next();
|
||||
|
||||
string const token = lex.GetString();
|
||||
lyxerr.debug() << "Token: '" << token << '\'' << endl;
|
||||
bool finished = false;
|
||||
|
||||
if (token.empty()) {
|
||||
continue;
|
||||
} else if (token == "\\end_inset") {
|
||||
finished = true;
|
||||
} else if (token == "FormatVersion") {
|
||||
lex.next();
|
||||
int version = lex.GetInteger();
|
||||
if (version > 1)
|
||||
lyxerr
|
||||
<< "This document was created with a newer Graphics widget"
|
||||
", You should use a newer version of LyX to read this"
|
||||
" file."
|
||||
<< endl;
|
||||
// TODO: Possibly open up a dialog?
|
||||
} else {
|
||||
if (! params.Read(buf, lex, token))
|
||||
lyxerr << "Unknown token, " << token << ",skipping." << endl;
|
||||
}
|
||||
}
|
||||
|
||||
updateInset();
|
||||
while (lex.IsOK() && !finished) {
|
||||
lex.next();
|
||||
|
||||
string const token = lex.GetString();
|
||||
lyxerr.debug() << "Token: '" << token << '\'' << endl;
|
||||
|
||||
if (token.empty()) {
|
||||
continue;
|
||||
} else if (token == "\\end_inset") {
|
||||
finished = true;
|
||||
} else if (token == "FormatVersion") {
|
||||
lex.next();
|
||||
int version = lex.GetInteger();
|
||||
if (version > 1)
|
||||
lyxerr
|
||||
<< "This document was created with a newer Graphics widget"
|
||||
", You should use a newer version of LyX to read this"
|
||||
" file."
|
||||
<< endl;
|
||||
// TODO: Possibly open up a dialog?
|
||||
}
|
||||
else {
|
||||
if (! params.Read(buf, lex, token))
|
||||
lyxerr << "Unknown token, " << token << ",skipping." << endl;
|
||||
}
|
||||
}
|
||||
|
||||
updateInset();
|
||||
}
|
||||
|
||||
static void formatResize(ostream & os, char const *key,
|
||||
InsetGraphicsParams::Resize resizeType, double size)
|
||||
InsetGraphicsParams::Resize resizeType, double size)
|
||||
{
|
||||
switch (resizeType) {
|
||||
case InsetGraphicsParams::DEFAULT_SIZE:
|
||||
break;
|
||||
|
||||
case InsetGraphicsParams::CM:
|
||||
os << key << '=' << size << "cm,";
|
||||
break;
|
||||
|
||||
case InsetGraphicsParams::INCH:
|
||||
os << key << '=' << size << "in,";
|
||||
break;
|
||||
|
||||
case InsetGraphicsParams::PERCENT_PAGE:
|
||||
os << key << '=' << size/100 << "\\text" << key << ',';
|
||||
break;
|
||||
|
||||
case InsetGraphicsParams::PERCENT_COLUMN:
|
||||
os << key << '=' << size/100 << "\\column" << key << ',';
|
||||
break;
|
||||
|
||||
}
|
||||
switch (resizeType) {
|
||||
case InsetGraphicsParams::DEFAULT_SIZE:
|
||||
break;
|
||||
|
||||
case InsetGraphicsParams::CM:
|
||||
os << key << '=' << size << "cm,";
|
||||
break;
|
||||
|
||||
case InsetGraphicsParams::INCH:
|
||||
os << key << '=' << size << "in,";
|
||||
break;
|
||||
|
||||
case InsetGraphicsParams::PERCENT_PAGE:
|
||||
os << key << '=' << size / 100 << "\\text" << key << ',';
|
||||
break;
|
||||
|
||||
case InsetGraphicsParams::PERCENT_COLUMN:
|
||||
os << key << '=' << size / 100 << "\\column" << key << ',';
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
int InsetGraphics::Latex(Buffer const *buf, ostream & os,
|
||||
bool /*fragile*/, bool/*fs*/) const
|
||||
bool /*fragile*/, bool/*fs*/) const
|
||||
{
|
||||
// MISSING: We have to decide how to do the order of the options
|
||||
// that is dependent of order, like witdth, height, angle. Should
|
||||
// we rotate before scale? Should we let the user decide?
|
||||
// bool rot_before_scale; ?
|
||||
|
||||
// (BE) As a first step we should do a scale before rotate since this is
|
||||
// more like the natural thought of how to do it.
|
||||
// (BE) I believe that a priority list presented to the user with
|
||||
// a default order would be the best, though it would be better to
|
||||
// hide such a thing in an "Advanced options" dialog.
|
||||
// (BE) This should go an advanced LaTeX options dialog.
|
||||
// (BE) As a first step we should do a scale before rotate since this is
|
||||
// more like the natural thought of how to do it.
|
||||
// (BE) I believe that a priority list presented to the user with
|
||||
// a default order would be the best, though it would be better to
|
||||
// hide such a thing in an "Advanced options" dialog.
|
||||
// (BE) This should go an advanced LaTeX options dialog.
|
||||
|
||||
// If there is no file specified, just output a message about it in
|
||||
// the latex output.
|
||||
if (params.filename.empty()) {
|
||||
os << "\\fbox{\\rule[-0.5in]{0pt}{1in}"
|
||||
<< _("empty figure path")
|
||||
<< '}'
|
||||
<< endl;
|
||||
// If there is no file specified, just output a message about it in
|
||||
// the latex output.
|
||||
if (params.filename.empty()) {
|
||||
os << "\\fbox{\\rule[-0.5in]{0pt}{1in}"
|
||||
<< _("empty figure path")
|
||||
<< '}'
|
||||
<< endl;
|
||||
|
||||
return 1;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Calculate the options part of the command, we must do it to a string
|
||||
// stream since we might have a trailing comma that we would like to remove
|
||||
// before writing it to the output stream.
|
||||
// Calculate the options part of the command, we must do it to a string
|
||||
// stream since we might have a trailing comma that we would like to remove
|
||||
// before writing it to the output stream.
|
||||
#ifdef HAVE_SSTREAM
|
||||
std::ostringstream options;
|
||||
#else
|
||||
ostrstream options;
|
||||
#endif
|
||||
|
||||
formatResize(options, "width", params.widthResize, params.widthSize);
|
||||
formatResize(options, "height", params.heightResize, params.heightSize);
|
||||
#endif
|
||||
|
||||
if (params.rotateAngle != 0) {
|
||||
options << "angle="
|
||||
<< params.rotateAngle << ',';
|
||||
}
|
||||
|
||||
#ifdef IG_OLDPARAMS
|
||||
formatResize(options, "width", params.widthResize, params.widthSize);
|
||||
formatResize(options, "height", params.heightResize, params.heightSize);
|
||||
|
||||
if (params.rotateAngle != 0) {
|
||||
options << "angle="
|
||||
<< params.rotateAngle << ',';
|
||||
}
|
||||
|
||||
#ifdef IG_OLDPARAMS
|
||||
if (bb.isSet() && use_bb) {
|
||||
options << "bb="
|
||||
<< bb.llx << ' ' << bb.lly << ' '
|
||||
<< bb.urx << ' ' << bb.ury << ',';
|
||||
<< bb.llx << ' ' << bb.lly << ' '
|
||||
<< bb.urx << ' ' << bb.ury << ',';
|
||||
}
|
||||
if (hiresbb) {
|
||||
options << "hiresbb,";
|
||||
}
|
||||
if (viewport.isSet()) {
|
||||
options << "viewport="
|
||||
<< viewport.llx << ' ' << viewport.lly << ' '
|
||||
<< viewport.urx << ' ' << viewport.ury << ',';
|
||||
<< viewport.llx << ' ' << viewport.lly << ' '
|
||||
<< viewport.urx << ' ' << viewport.ury << ',';
|
||||
}
|
||||
if (trim.isSet()) {
|
||||
options << "trim="
|
||||
<< trim.llx << ' ' << trim.lly << ' '
|
||||
<< trim.urx << ' ' << trim.ury << ',';
|
||||
<< trim.llx << ' ' << trim.lly << ' '
|
||||
<< trim.urx << ' ' << trim.ury << ',';
|
||||
}
|
||||
if (natheight.value() != 0) {
|
||||
options << "natheight=" << natheight.asString() << ',';
|
||||
@ -461,7 +466,7 @@ int InsetGraphics::Latex(Buffer const *buf, ostream & os,
|
||||
options << "angle=" << angle << ',';
|
||||
}
|
||||
if (origin != DEFAULT) {
|
||||
switch(origin) {
|
||||
switch (origin) {
|
||||
case DEFAULT: break;
|
||||
case LEFTTOP:
|
||||
options << "origin=lt,";
|
||||
@ -524,19 +529,19 @@ int InsetGraphics::Latex(Buffer const *buf, ostream & os,
|
||||
}
|
||||
if (!type.empty()) {
|
||||
options << "type=" << type << ',';
|
||||
|
||||
// These should be present only when type is used.
|
||||
if (!ext.empty()) {
|
||||
options << "ext=" << type << ',';
|
||||
}
|
||||
if (!read.empty()) {
|
||||
options << "read=" << type << ',';
|
||||
}
|
||||
if (!command.empty()) {
|
||||
options << "command=" << type << ',';
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// These should be present only when type is used.
|
||||
if (!ext.empty()) {
|
||||
options << "ext=" << type << ',';
|
||||
}
|
||||
if (!read.empty()) {
|
||||
options << "read=" << type << ',';
|
||||
}
|
||||
if (!command.empty()) {
|
||||
options << "command=" << type << ',';
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SSTREAM
|
||||
string opts(options.str().c_str());
|
||||
@ -545,96 +550,96 @@ int InsetGraphics::Latex(Buffer const *buf, ostream & os,
|
||||
char * tmp = options.str();
|
||||
string opts(tmp);
|
||||
delete [] tmp;
|
||||
#endif
|
||||
#endif
|
||||
opts = strip(opts, ',');
|
||||
|
||||
|
||||
// If it's not an inline image, surround it with the centering paragraph.
|
||||
if (! params.inlineFigure) {
|
||||
os << endl
|
||||
<< "\\vspace{0.3cm}" << endl
|
||||
<< "{\\par\\centering ";
|
||||
}
|
||||
|
||||
// Do we want subcaptions?
|
||||
if (params.subcaption) {
|
||||
os << "\\subfigure[" << params.subcaptionText << "]{";
|
||||
}
|
||||
|
||||
|
||||
// If it's not an inline image, surround it with the centering paragraph.
|
||||
if (! params.inlineFigure) {
|
||||
os << endl
|
||||
<< "\\vspace{0.3cm}" << endl
|
||||
<< "{\\par\\centering ";
|
||||
}
|
||||
|
||||
// Do we want subcaptions?
|
||||
if (params.subcaption) {
|
||||
os << "\\subfigure[" << params.subcaptionText << "]{";
|
||||
}
|
||||
|
||||
// We never used the starred form, we use the "clip" option instead.
|
||||
os << "\\includegraphics";
|
||||
os << "\\includegraphics";
|
||||
|
||||
if (!opts.empty()) {
|
||||
os << '[' << opts << ']';
|
||||
}
|
||||
|
||||
// Make the filename relative to the lyx file
|
||||
string filename = MakeRelPath(params.filename, OnlyPath(buf->fileName()));
|
||||
// Make the filename relative to the lyx file
|
||||
string filename = MakeRelPath(params.filename, OnlyPath(buf->fileName()));
|
||||
|
||||
// and remove the extension so the LaTeX will use whatever is
|
||||
// appropriate (when there are several versions in different formats)
|
||||
filename = ChangeExtension(filename, string());
|
||||
// and remove the extension so the LaTeX will use whatever is
|
||||
// appropriate (when there are several versions in different formats)
|
||||
filename = ChangeExtension(filename, string());
|
||||
|
||||
os << '{' << filename << '}';
|
||||
|
||||
// Do we want a subcaption?
|
||||
if (params.subcaption) {
|
||||
// Close the subcaption command
|
||||
os << '}';
|
||||
}
|
||||
|
||||
// Is this an inline graphics?
|
||||
if (!params.inlineFigure) {
|
||||
os << " \\par}" << endl
|
||||
<< "\\vspace{0.3cm}" << endl;
|
||||
}
|
||||
// Do we want a subcaption?
|
||||
if (params.subcaption) {
|
||||
// Close the subcaption command
|
||||
os << '}';
|
||||
}
|
||||
|
||||
// Is this an inline graphics?
|
||||
if (!params.inlineFigure) {
|
||||
os << " \\par}" << endl
|
||||
<< "\\vspace{0.3cm}" << endl;
|
||||
}
|
||||
|
||||
// How do we decide to what format should we export?
|
||||
// cacheHandle->>export(ImageType::EPS);
|
||||
// cacheHandle->>export(ImageType::PNG);
|
||||
|
||||
// How do we decide to what format should we export?
|
||||
// cacheHandle->>export(ImageType::EPS);
|
||||
// cacheHandle->>export(ImageType::PNG);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
int InsetGraphics::Ascii(Buffer const *, ostream &) const
|
||||
{
|
||||
// No graphics in ascii output.
|
||||
// No graphics in ascii output.
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int InsetGraphics::Linuxdoc(Buffer const *, ostream &) const
|
||||
{
|
||||
// No graphics in LinuxDoc output. Should check how/what to add.
|
||||
// No graphics in LinuxDoc output. Should check how/what to add.
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int InsetGraphics::DocBook(Buffer const *, ostream &) const
|
||||
{
|
||||
// No graphics in DocBook output. Should check how/what to add.
|
||||
// No graphics in DocBook output. Should check how/what to add.
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void InsetGraphics::Validate(LaTeXFeatures & features) const
|
||||
{
|
||||
// If we have no image, we should not require anything.
|
||||
if (params.filename.empty())
|
||||
return;
|
||||
// If we have no image, we should not require anything.
|
||||
if (params.filename.empty())
|
||||
return ;
|
||||
|
||||
features.graphicx = true;
|
||||
|
||||
if (params.subcaption)
|
||||
features.subfigure = true;
|
||||
if (params.subcaption)
|
||||
features.subfigure = true;
|
||||
}
|
||||
|
||||
// Update the inset after parameters changed (read from file or changed in
|
||||
// dialog.
|
||||
void InsetGraphics::updateInset()
|
||||
{
|
||||
// If file changed...
|
||||
// If file changed...
|
||||
|
||||
GraphicsCache * gc = GraphicsCache::getInstance();
|
||||
GraphicsCacheItem * temp = 0;
|
||||
@ -650,22 +655,22 @@ void InsetGraphics::updateInset()
|
||||
bool InsetGraphics::setParams(InsetGraphicsParams const & params)
|
||||
{
|
||||
// If nothing is changed, just return and say so.
|
||||
if (this->params == params)
|
||||
return false;
|
||||
if (this->params == params)
|
||||
return false;
|
||||
|
||||
// Copy the new parameters.
|
||||
this->params = params;
|
||||
// Copy the new parameters.
|
||||
this->params = params;
|
||||
|
||||
// Update the inset with the new parameters.
|
||||
updateInset();
|
||||
|
||||
// We have changed data, report it.
|
||||
return true;
|
||||
// Update the inset with the new parameters.
|
||||
updateInset();
|
||||
|
||||
// We have changed data, report it.
|
||||
return true;
|
||||
}
|
||||
|
||||
InsetGraphicsParams InsetGraphics::getParams() const
|
||||
{
|
||||
return params;
|
||||
return params;
|
||||
}
|
||||
|
||||
Inset * InsetGraphics::Clone() const
|
||||
|
@ -15,9 +15,7 @@
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "insets/lyxinset.h"
|
||||
#include "insets/insetgraphicsParams.h"
|
||||
@ -31,21 +29,23 @@
|
||||
using SigC::Signal0;
|
||||
using SigC::slot;
|
||||
using SigC::Object;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
class Dialogs;
|
||||
|
||||
///
|
||||
#ifdef SIGC_CXX_NAMESPACES
|
||||
class InsetGraphics : public Inset, public SigC::Object {
|
||||
class InsetGraphics : public Inset, public SigC::Object
|
||||
{
|
||||
#else
|
||||
class InsetGraphics : public Inset, public Object {
|
||||
#endif
|
||||
class InsetGraphics : public Inset, public Object
|
||||
{
|
||||
#endif
|
||||
public:
|
||||
///
|
||||
InsetGraphics();
|
||||
///
|
||||
~InsetGraphics();
|
||||
///
|
||||
~InsetGraphics();
|
||||
///
|
||||
int ascent(BufferView *, LyXFont const &) const;
|
||||
///
|
||||
@ -70,7 +70,7 @@ public:
|
||||
fragile commands by adding a \protect before.
|
||||
*/
|
||||
int Latex(Buffer const *, std::ostream &,
|
||||
bool fragile, bool free_spc) const;
|
||||
bool fragile, bool free_spc) const;
|
||||
///
|
||||
int Ascii(Buffer const *, std::ostream &) const;
|
||||
///
|
||||
@ -79,43 +79,43 @@ public:
|
||||
int DocBook(Buffer const *, std::ostream &) const;
|
||||
|
||||
/** Tell LyX what the latex features you need i.e. what latex packages
|
||||
* you need to be included.
|
||||
*/
|
||||
* you need to be included.
|
||||
*/
|
||||
void Validate(LaTeXFeatures & features) const;
|
||||
|
||||
/// returns LyX code associated with the inset. Used for TOC, ...)
|
||||
Inset::Code LyxCode() const { return Inset::GRAPHICS_CODE; }
|
||||
|
||||
|
||||
///
|
||||
Inset * Clone() const;
|
||||
|
||||
/// Set the inset parameters, used by the GUIndependent dialog.
|
||||
/// Return true of new params are different from what was so far.
|
||||
bool setParams(InsetGraphicsParams const & params);
|
||||
/// Set the inset parameters, used by the GUIndependent dialog.
|
||||
/// Return true of new params are different from what was so far.
|
||||
bool setParams(InsetGraphicsParams const & params);
|
||||
|
||||
/// Get the inset parameters, used by the GUIndependent dialog.
|
||||
InsetGraphicsParams getParams() const;
|
||||
/// Get the inset parameters, used by the GUIndependent dialog.
|
||||
InsetGraphicsParams getParams() const;
|
||||
|
||||
/// This signal is connected by our dialog and called when the inset
|
||||
/// is deleted.
|
||||
Signal0<void> hide;
|
||||
/// This signal is connected by our dialog and called when the inset
|
||||
/// is deleted.
|
||||
Signal0 < void > hide;
|
||||
private:
|
||||
/// Update the inset after parameter change.
|
||||
void updateInset();
|
||||
/// Update the inset after parameter change.
|
||||
void updateInset();
|
||||
|
||||
/// The graphics cache handle.
|
||||
GraphicsCacheItem * cacheHandle;
|
||||
/// The graphics cache handle.
|
||||
GraphicsCacheItem * cacheHandle;
|
||||
|
||||
/// The pixmap
|
||||
mutable Pixmap pixmap;
|
||||
/// is the pixmap initialized?
|
||||
mutable bool pixmapInitialized;
|
||||
|
||||
InsetGraphicsParams params;
|
||||
/// The pixmap
|
||||
mutable Pixmap pixmap;
|
||||
/// is the pixmap initialized?
|
||||
mutable bool pixmapInitialized;
|
||||
|
||||
// Baruch Even (baruch.even@writeme.com) 2000-07-17
|
||||
// This was the intended way however it is not flexible enough and
|
||||
// only provides for LaTeX output.
|
||||
InsetGraphicsParams params;
|
||||
|
||||
// Baruch Even (baruch.even@writeme.com) 2000-07-17
|
||||
// This was the intended way however it is not flexible enough and
|
||||
// only provides for LaTeX output.
|
||||
#ifdef IG_OLDPARAMS
|
||||
// We need variables to store the size of the boundingbox and
|
||||
// to store a pointer to the pixmap in.. The question is if
|
||||
@ -132,7 +132,7 @@ private:
|
||||
bounding box in the LaTex command or not. (i.e. if the user
|
||||
has manually set the bb.) */
|
||||
bool use_bb;
|
||||
|
||||
|
||||
/** When a graphics file is parsed we first check for BoundingBox
|
||||
and then for HiResBoundingBox, and set hiresbb depending on this.
|
||||
This key makes LaTeX search for %%HiResBoundingBox comments
|
||||
@ -141,73 +141,73 @@ private:
|
||||
can normally only have integer values. It is a Boolean, either
|
||||
"true" or "false". */
|
||||
bool hiresbb;
|
||||
|
||||
|
||||
/** This key takes four arguments (like bb), but in this case the
|
||||
origin is taken with respect to the bounding box specified in
|
||||
the file. So to view a 20 bp square at the lower left-hand corner
|
||||
of the picture, specify viewport=0 0 20 20. */
|
||||
BoundingBox viewport;
|
||||
|
||||
|
||||
/** Similar to the viewport key, but the four dimensions correspond
|
||||
to the amount of space to be trimmed (cut off) at the left-hand
|
||||
side, bottom, right-hand side and top of the included graphics. */
|
||||
BoundingBox trim;
|
||||
|
||||
|
||||
/// Natural height of figure
|
||||
LyXLength natheight;
|
||||
|
||||
|
||||
/// Natural width of figure.
|
||||
LyXLength natwidth;
|
||||
|
||||
|
||||
/// Rotation angle (in degrees, counterclockwise).
|
||||
float angle;
|
||||
|
||||
/** Origin for rotation, similar to the origin parameter of
|
||||
the \rotatebox command described on p.46 and Fig. 2.2 on p.46. */
|
||||
Origin origin;
|
||||
|
||||
|
||||
/// Required width (the width of the image is scaled to that value).
|
||||
LyXLength g_width;
|
||||
|
||||
|
||||
/// Required height (the height of the image is scaled to that value).
|
||||
LyXLength g_height;
|
||||
|
||||
|
||||
/** Required total height (the total height of the image is scaled
|
||||
to that value). This key should be used instead of height if
|
||||
images are rotated over 90 degrees, since the height can
|
||||
disappear (and become the depth) and LaTeX will have difficulties
|
||||
satisfying the user's request. */
|
||||
LyXLength totalheight;
|
||||
|
||||
|
||||
/** Boolean variable that can have the values "true" and "false"
|
||||
(se above for defaults). When true, specifying both width and
|
||||
height parameters does not distort the picture, but the image
|
||||
is scaled so that neither of the width of height exceeds the
|
||||
given dimensions. */
|
||||
bool keepaspectratio;
|
||||
|
||||
|
||||
/// Scale factor
|
||||
float scale;
|
||||
|
||||
|
||||
/** Clip the graphic to the bounding box. It is a Boolean, either
|
||||
"true" or "false". */
|
||||
bool clip;
|
||||
|
||||
|
||||
/// Locally switch to draft mode. A Boolean valued key, like clip.
|
||||
bool draft;
|
||||
|
||||
|
||||
/// The graphics type.
|
||||
string type;
|
||||
|
||||
|
||||
/// The file extension of the file containing the image data.
|
||||
string ext;
|
||||
|
||||
|
||||
/// The file extension of the file "read" by LaTeX.
|
||||
string read;
|
||||
|
||||
|
||||
/// Any command to be applied to the file.
|
||||
string command;
|
||||
#endif
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
@ -9,12 +9,11 @@
|
||||
* This file Copyright 2000 Baruch Even
|
||||
* ================================================= */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation
|
||||
#endif
|
||||
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "insetgraphicsParams.h"
|
||||
|
||||
@ -31,413 +30,414 @@ static bool translatorsSet = false;
|
||||
|
||||
/// This is the translator between the Resize enum and corresponding lyx
|
||||
/// file strings.
|
||||
static Translator<InsetGraphicsParams::Resize, string>
|
||||
resizeTranslator(InsetGraphicsParams::DEFAULT_SIZE, "default");
|
||||
static Translator < InsetGraphicsParams::Resize, string >
|
||||
resizeTranslator(InsetGraphicsParams::DEFAULT_SIZE, "default");
|
||||
|
||||
/// This is the translator between the Origin enum and corresponding lyx
|
||||
/// file strings.
|
||||
static Translator<InsetGraphicsParams::Origin, string>
|
||||
originTranslator(InsetGraphicsParams::DEFAULT, "default");
|
||||
static Translator < InsetGraphicsParams::Origin, string >
|
||||
originTranslator(InsetGraphicsParams::DEFAULT, "default");
|
||||
|
||||
/// This is the translator between the Display enum and corresponding lyx
|
||||
/// file strings.
|
||||
static Translator<InsetGraphicsParams::DisplayType, string>
|
||||
displayTranslator(InsetGraphicsParams::MONOCHROME, "monochrome");
|
||||
static Translator < InsetGraphicsParams::DisplayType, string >
|
||||
displayTranslator(InsetGraphicsParams::MONOCHROME, "monochrome");
|
||||
|
||||
|
||||
|
||||
InsetGraphicsParams::InsetGraphicsParams()
|
||||
{
|
||||
init();
|
||||
init();
|
||||
|
||||
// Set translators
|
||||
if (! translatorsSet) {
|
||||
translatorsSet = true;
|
||||
// Set translators
|
||||
if (! translatorsSet) {
|
||||
translatorsSet = true;
|
||||
|
||||
// Fill the resize translator
|
||||
resizeTranslator.addPair(DEFAULT_SIZE, "default");
|
||||
resizeTranslator.addPair(CM, "cm");
|
||||
resizeTranslator.addPair(INCH, "inch");
|
||||
resizeTranslator.addPair(PERCENT_PAGE, "percentOfPage");
|
||||
resizeTranslator.addPair(PERCENT_COLUMN, "percentOfColumn");
|
||||
// Fill the resize translator
|
||||
resizeTranslator.addPair(DEFAULT_SIZE, "default");
|
||||
resizeTranslator.addPair(CM, "cm");
|
||||
resizeTranslator.addPair(INCH, "inch");
|
||||
resizeTranslator.addPair(PERCENT_PAGE, "percentOfPage");
|
||||
resizeTranslator.addPair(PERCENT_COLUMN, "percentOfColumn");
|
||||
|
||||
// Fill the origin translator
|
||||
originTranslator.addPair(DEFAULT, "default");
|
||||
originTranslator.addPair(LEFTTOP, "leftTop");
|
||||
originTranslator.addPair(LEFTCENTER, "leftCenter");
|
||||
originTranslator.addPair(LEFTBASELINE, "leftBaseLine");
|
||||
originTranslator.addPair(LEFTBOTTOM, "leftBottom");
|
||||
originTranslator.addPair(CENTERTOP, "centerTop");
|
||||
originTranslator.addPair(CENTER, "center");
|
||||
originTranslator.addPair(CENTERBASELINE, "centerBaseLine");
|
||||
originTranslator.addPair(CENTERBOTTOM, "centerBottom");
|
||||
originTranslator.addPair(RIGHTTOP, "rightTop");
|
||||
originTranslator.addPair(RIGHTCENTER, "rightCenter");
|
||||
originTranslator.addPair(RIGHTBASELINE, "rightBaseLine");
|
||||
originTranslator.addPair(RIGHTBOTTOM, "rightBottom");
|
||||
originTranslator.addPair(REFERENCE_POINT, "referencePoint");
|
||||
|
||||
// Fill the display translator
|
||||
displayTranslator.addPair(MONOCHROME, "monochrome");
|
||||
displayTranslator.addPair(GRAYSCALE, "grayscale");
|
||||
displayTranslator.addPair(COLOR, "color");
|
||||
displayTranslator.addPair(NONE, "none");
|
||||
}
|
||||
|
||||
// Fill the origin translator
|
||||
originTranslator.addPair(DEFAULT, "default");
|
||||
originTranslator.addPair(LEFTTOP, "leftTop");
|
||||
originTranslator.addPair(LEFTCENTER, "leftCenter");
|
||||
originTranslator.addPair(LEFTBASELINE, "leftBaseLine");
|
||||
originTranslator.addPair(LEFTBOTTOM, "leftBottom");
|
||||
originTranslator.addPair(CENTERTOP, "centerTop");
|
||||
originTranslator.addPair(CENTER, "center");
|
||||
originTranslator.addPair(CENTERBASELINE, "centerBaseLine");
|
||||
originTranslator.addPair(CENTERBOTTOM, "centerBottom");
|
||||
originTranslator.addPair(RIGHTTOP, "rightTop");
|
||||
originTranslator.addPair(RIGHTCENTER, "rightCenter");
|
||||
originTranslator.addPair(RIGHTBASELINE, "rightBaseLine");
|
||||
originTranslator.addPair(RIGHTBOTTOM, "rightBottom");
|
||||
originTranslator.addPair(REFERENCE_POINT, "referencePoint");
|
||||
|
||||
// Fill the display translator
|
||||
displayTranslator.addPair(MONOCHROME, "monochrome");
|
||||
displayTranslator.addPair(GRAYSCALE, "grayscale");
|
||||
displayTranslator.addPair(COLOR, "color");
|
||||
displayTranslator.addPair(NONE, "none");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
InsetGraphicsParams::InsetGraphicsParams(InsetGraphicsParams const & igp)
|
||||
{
|
||||
// I decided to skip the initialization since the copy will overwrite
|
||||
// everything anyway.
|
||||
// init();
|
||||
copy(igp);
|
||||
// I decided to skip the initialization since the copy will overwrite
|
||||
// everything anyway.
|
||||
// init();
|
||||
copy(igp);
|
||||
}
|
||||
|
||||
InsetGraphicsParams const &
|
||||
InsetGraphicsParams const &
|
||||
InsetGraphicsParams::operator=(InsetGraphicsParams const ¶ms)
|
||||
{
|
||||
// Are we assigning the object into itself?
|
||||
if (this == ¶ms)
|
||||
return *this;
|
||||
|
||||
copy(params);
|
||||
return *this;
|
||||
// Are we assigning the object into itself?
|
||||
if (this == ¶ms)
|
||||
return * this;
|
||||
|
||||
copy(params);
|
||||
return *this;
|
||||
}
|
||||
|
||||
void InsetGraphicsParams::init()
|
||||
{
|
||||
subcaptionText = filename = string();
|
||||
display = MONOCHROME;
|
||||
inlineFigure = false;
|
||||
subcaption = false;
|
||||
keepAspectRatio = true;
|
||||
widthResize = DEFAULT_SIZE;
|
||||
widthSize = 0.0;
|
||||
heightResize = DEFAULT_SIZE;
|
||||
heightSize = 0.0;
|
||||
rotateOrigin = DEFAULT;
|
||||
rotateAngle = 0;
|
||||
subcaptionText = filename = string();
|
||||
display = MONOCHROME;
|
||||
inlineFigure = false;
|
||||
subcaption = false;
|
||||
keepAspectRatio = true;
|
||||
widthResize = DEFAULT_SIZE;
|
||||
widthSize = 0.0;
|
||||
heightResize = DEFAULT_SIZE;
|
||||
heightSize = 0.0;
|
||||
rotateOrigin = DEFAULT;
|
||||
rotateAngle = 0;
|
||||
|
||||
testInvariant();
|
||||
testInvariant();
|
||||
}
|
||||
|
||||
void InsetGraphicsParams::copy(InsetGraphicsParams const & igp)
|
||||
{
|
||||
filename = igp.filename;
|
||||
display = igp.display;
|
||||
inlineFigure = igp.inlineFigure;
|
||||
subcaption = igp.subcaption;
|
||||
subcaptionText = igp.subcaptionText;
|
||||
keepAspectRatio = igp.keepAspectRatio;
|
||||
widthResize = igp.widthResize;
|
||||
widthSize = igp.widthSize;
|
||||
heightResize = igp.heightResize;
|
||||
heightSize = igp.heightSize;
|
||||
rotateOrigin = igp.rotateOrigin;
|
||||
rotateAngle = igp.rotateAngle;
|
||||
filename = igp.filename;
|
||||
display = igp.display;
|
||||
inlineFigure = igp.inlineFigure;
|
||||
subcaption = igp.subcaption;
|
||||
subcaptionText = igp.subcaptionText;
|
||||
keepAspectRatio = igp.keepAspectRatio;
|
||||
widthResize = igp.widthResize;
|
||||
widthSize = igp.widthSize;
|
||||
heightResize = igp.heightResize;
|
||||
heightSize = igp.heightSize;
|
||||
rotateOrigin = igp.rotateOrigin;
|
||||
rotateAngle = igp.rotateAngle;
|
||||
|
||||
testInvariant();
|
||||
testInvariant();
|
||||
}
|
||||
|
||||
void InsetGraphicsParams::testInvariant() const
|
||||
{
|
||||
// Filename might be empty (when the dialog is first created).
|
||||
// Assert(!filename.empty());
|
||||
|
||||
Assert(display == COLOR ||
|
||||
display == MONOCHROME ||
|
||||
display == GRAYSCALE ||
|
||||
display == NONE
|
||||
);
|
||||
|
||||
Assert(widthResize == DEFAULT_SIZE ||
|
||||
widthResize == CM ||
|
||||
widthResize == INCH ||
|
||||
widthResize == PERCENT_PAGE ||
|
||||
widthResize == PERCENT_COLUMN
|
||||
);
|
||||
// Filename might be empty (when the dialog is first created).
|
||||
// Assert(!filename.empty());
|
||||
|
||||
Assert(heightResize == DEFAULT_SIZE ||
|
||||
heightResize == CM ||
|
||||
heightResize == INCH ||
|
||||
heightResize == PERCENT_PAGE
|
||||
);
|
||||
|
||||
Assert(widthSize >= 0.0);
|
||||
Assert(heightSize >= 0.0);
|
||||
|
||||
// Angle is in degrees and ranges -360 < angle < 360
|
||||
// The reason for this is that in latex there is a meaning for the
|
||||
// different angles and they are not necessarliy interchangeable,
|
||||
// it depends on the rotation origin.
|
||||
Assert(rotateAngle < 360);
|
||||
Assert(rotateAngle > -360);
|
||||
Assert(display == COLOR ||
|
||||
display == MONOCHROME ||
|
||||
display == GRAYSCALE ||
|
||||
display == NONE
|
||||
);
|
||||
|
||||
Assert(widthResize == DEFAULT_SIZE ||
|
||||
widthResize == CM ||
|
||||
widthResize == INCH ||
|
||||
widthResize == PERCENT_PAGE ||
|
||||
widthResize == PERCENT_COLUMN
|
||||
);
|
||||
|
||||
Assert(heightResize == DEFAULT_SIZE ||
|
||||
heightResize == CM ||
|
||||
heightResize == INCH ||
|
||||
heightResize == PERCENT_PAGE
|
||||
);
|
||||
|
||||
Assert(widthSize >= 0.0);
|
||||
Assert(heightSize >= 0.0);
|
||||
|
||||
// Angle is in degrees and ranges -360 < angle < 360
|
||||
// The reason for this is that in latex there is a meaning for the
|
||||
// different angles and they are not necessarliy interchangeable,
|
||||
// it depends on the rotation origin.
|
||||
Assert(rotateAngle < 360);
|
||||
Assert(rotateAngle > -360);
|
||||
|
||||
}
|
||||
|
||||
bool operator==(InsetGraphicsParams const & left,
|
||||
InsetGraphicsParams const & right)
|
||||
bool operator==(InsetGraphicsParams const & left,
|
||||
InsetGraphicsParams const & right)
|
||||
{
|
||||
if (left.filename == right.filename &&
|
||||
left.display == right.display &&
|
||||
left.inlineFigure == right.inlineFigure &&
|
||||
left.subcaption == right.subcaption &&
|
||||
left.subcaptionText == right.subcaptionText &&
|
||||
left.keepAspectRatio == right.keepAspectRatio &&
|
||||
left.widthResize == right.widthResize &&
|
||||
left.widthSize == right.widthSize &&
|
||||
left.heightResize == right.heightResize &&
|
||||
left.heightSize == right.heightSize &&
|
||||
left.rotateOrigin == right.rotateOrigin &&
|
||||
left.rotateAngle == right.rotateAngle
|
||||
)
|
||||
return true;
|
||||
if (left.filename == right.filename &&
|
||||
left.display == right.display &&
|
||||
left.inlineFigure == right.inlineFigure &&
|
||||
left.subcaption == right.subcaption &&
|
||||
left.subcaptionText == right.subcaptionText &&
|
||||
left.keepAspectRatio == right.keepAspectRatio &&
|
||||
left.widthResize == right.widthResize &&
|
||||
left.widthSize == right.widthSize &&
|
||||
left.heightResize == right.heightResize &&
|
||||
left.heightSize == right.heightSize &&
|
||||
left.rotateOrigin == right.rotateOrigin &&
|
||||
left.rotateAngle == right.rotateAngle
|
||||
)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
static void writeResize(ostream & os, char const * key,
|
||||
InsetGraphicsParams::Resize resize, double size)
|
||||
static void writeResize(ostream & os, char const * key,
|
||||
InsetGraphicsParams::Resize resize, double size)
|
||||
{
|
||||
os << ' ' << key << "Resize ";
|
||||
os << ' ' << key << "Resize ";
|
||||
|
||||
os << resizeTranslator.find(resize);
|
||||
os << resizeTranslator.find(resize);
|
||||
#if 0
|
||||
// Old code, before using translators
|
||||
switch (resize) {
|
||||
case InsetGraphicsParams::DEFAULT_SIZE:
|
||||
os << "default";
|
||||
break;
|
||||
|
||||
case InsetGraphicsParams::CM:
|
||||
os << "cm";
|
||||
break;
|
||||
|
||||
case InsetGraphicsParams::INCH:
|
||||
os << "inch";
|
||||
break;
|
||||
|
||||
case InsetGraphicsParams::PERCENT_PAGE:
|
||||
os << "percentOfPage";
|
||||
break;
|
||||
|
||||
case InsetGraphicsParams::PERCENT_COLUMN:
|
||||
os << "percentOfColumnt";
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
os << ' ' << key << ' ' << size << endl;
|
||||
// Old code, before using translators
|
||||
switch (resize) {
|
||||
case InsetGraphicsParams::DEFAULT_SIZE:
|
||||
os << "default";
|
||||
break;
|
||||
|
||||
case InsetGraphicsParams::CM:
|
||||
os << "cm";
|
||||
break;
|
||||
|
||||
case InsetGraphicsParams::INCH:
|
||||
os << "inch";
|
||||
break;
|
||||
|
||||
case InsetGraphicsParams::PERCENT_PAGE:
|
||||
os << "percentOfPage";
|
||||
break;
|
||||
|
||||
case InsetGraphicsParams::PERCENT_COLUMN:
|
||||
os << "percentOfColumnt";
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
os << ' ' << key << ' ' << size << endl;
|
||||
}
|
||||
|
||||
static void writeOrigin(ostream & os,
|
||||
InsetGraphicsParams::Origin origin)
|
||||
static void writeOrigin(ostream & os,
|
||||
InsetGraphicsParams::Origin origin)
|
||||
{
|
||||
os << " rotateOrigin " << originTranslator.find(origin);
|
||||
|
||||
os << " rotateOrigin " << originTranslator.find(origin);
|
||||
|
||||
#if 0
|
||||
// Old method.
|
||||
switch (origin) {
|
||||
case InsetGraphicsParams:: DEFAULT:
|
||||
os << "default";
|
||||
break;
|
||||
case InsetGraphicsParams:: LEFTTOP:
|
||||
os << "LeftTop";
|
||||
break;
|
||||
case InsetGraphicsParams:: LEFTCENTER:
|
||||
os << "LeftCenter";
|
||||
break;
|
||||
case InsetGraphicsParams:: LEFTBASELINE:
|
||||
os << "LeftBaseLine";
|
||||
break;
|
||||
case InsetGraphicsParams:: LEFTBOTTOM:
|
||||
os << "LeftBottom";
|
||||
break;
|
||||
case InsetGraphicsParams:: CENTERTOP:
|
||||
os << "CenterTop";
|
||||
break;
|
||||
case InsetGraphicsParams:: CENTER:
|
||||
os << "Center";
|
||||
break;
|
||||
case InsetGraphicsParams:: CENTERBASELINE:
|
||||
os << "CenterBaseLine";
|
||||
break;
|
||||
case InsetGraphicsParams:: CENTERBOTTOM:
|
||||
os << "CenterBottom";
|
||||
break;
|
||||
case InsetGraphicsParams:: RIGHTTOP:
|
||||
os << "RightTop";
|
||||
break;
|
||||
case InsetGraphicsParams:: RIGHTCENTER:
|
||||
os << "RightCenter";
|
||||
break;
|
||||
case InsetGraphicsParams:: RIGHTBASELINE:
|
||||
os << "RightBaseLine";
|
||||
break;
|
||||
case InsetGraphicsParams:: RIGHTBOTTOM:
|
||||
os << "RightBottom";
|
||||
break;
|
||||
// Current REFERENCE_POINT is aliased to LEFTBASELINE
|
||||
// case InsetGraphicsParams:: REFERENCE_POINT:
|
||||
}
|
||||
#endif
|
||||
|
||||
os << endl;
|
||||
// Old method.
|
||||
switch (origin) {
|
||||
case InsetGraphicsParams:: DEFAULT:
|
||||
os << "default";
|
||||
break;
|
||||
case InsetGraphicsParams:: LEFTTOP:
|
||||
os << "LeftTop";
|
||||
break;
|
||||
case InsetGraphicsParams:: LEFTCENTER:
|
||||
os << "LeftCenter";
|
||||
break;
|
||||
case InsetGraphicsParams:: LEFTBASELINE:
|
||||
os << "LeftBaseLine";
|
||||
break;
|
||||
case InsetGraphicsParams:: LEFTBOTTOM:
|
||||
os << "LeftBottom";
|
||||
break;
|
||||
case InsetGraphicsParams:: CENTERTOP:
|
||||
os << "CenterTop";
|
||||
break;
|
||||
case InsetGraphicsParams:: CENTER:
|
||||
os << "Center";
|
||||
break;
|
||||
case InsetGraphicsParams:: CENTERBASELINE:
|
||||
os << "CenterBaseLine";
|
||||
break;
|
||||
case InsetGraphicsParams:: CENTERBOTTOM:
|
||||
os << "CenterBottom";
|
||||
break;
|
||||
case InsetGraphicsParams:: RIGHTTOP:
|
||||
os << "RightTop";
|
||||
break;
|
||||
case InsetGraphicsParams:: RIGHTCENTER:
|
||||
os << "RightCenter";
|
||||
break;
|
||||
case InsetGraphicsParams:: RIGHTBASELINE:
|
||||
os << "RightBaseLine";
|
||||
break;
|
||||
case InsetGraphicsParams:: RIGHTBOTTOM:
|
||||
os << "RightBottom";
|
||||
break;
|
||||
// Current REFERENCE_POINT is aliased to LEFTBASELINE
|
||||
// case InsetGraphicsParams:: REFERENCE_POINT:
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
os << endl;
|
||||
}
|
||||
|
||||
void InsetGraphicsParams::Write(Buffer const * buf, ostream & os) const
|
||||
{
|
||||
// If there is no filename, write nothing for it.
|
||||
if (! filename.empty()) {
|
||||
os << "filename "
|
||||
<< MakeRelPath(filename, OnlyPath(buf->fileName()))
|
||||
<< endl;
|
||||
}
|
||||
// If there is no filename, write nothing for it.
|
||||
if (! filename.empty()) {
|
||||
os << "filename "
|
||||
<< MakeRelPath(filename, OnlyPath(buf->fileName()))
|
||||
<< endl;
|
||||
}
|
||||
|
||||
// Save the display type
|
||||
os << " display " << displayTranslator.find(display) << endl;
|
||||
// Save the display type
|
||||
os << " display " << displayTranslator.find(display) << endl;
|
||||
#if 0
|
||||
switch (display) {
|
||||
case COLOR:
|
||||
os << "color";
|
||||
break;
|
||||
switch (display) {
|
||||
case COLOR:
|
||||
os << "color";
|
||||
break;
|
||||
|
||||
case GRAYSCALE:
|
||||
os << "grayscale";
|
||||
break;
|
||||
case GRAYSCALE:
|
||||
os << "grayscale";
|
||||
break;
|
||||
|
||||
case MONOCHROME:
|
||||
os << "monochrome";
|
||||
break;
|
||||
case MONOCHROME:
|
||||
os << "monochrome";
|
||||
break;
|
||||
|
||||
case NONE:
|
||||
os << "none";
|
||||
break;
|
||||
}
|
||||
os << endl;
|
||||
#endif
|
||||
|
||||
// Save the inline status
|
||||
if (inlineFigure)
|
||||
os << " inline";
|
||||
|
||||
// Save the subcaption status
|
||||
if (subcaption)
|
||||
os << " subcaption";
|
||||
|
||||
if (! subcaptionText.empty())
|
||||
os << " subcaptionText \"" << subcaptionText << '\"' << endl;
|
||||
|
||||
writeResize(os, "width", widthResize, widthSize);
|
||||
writeResize(os, "height", heightResize, heightSize);
|
||||
|
||||
writeOrigin(os, rotateOrigin);
|
||||
if (rotateAngle != 0)
|
||||
os << " rotateAngle " << rotateAngle << endl;
|
||||
}
|
||||
|
||||
static void readResize(InsetGraphicsParams * igp, bool height,
|
||||
string const & token)
|
||||
{
|
||||
InsetGraphicsParams::Resize resize = InsetGraphicsParams::DEFAULT_SIZE;
|
||||
|
||||
resize = resizeTranslator.find(token);
|
||||
#if 0
|
||||
// Old code, before translator.
|
||||
if (token == "default")
|
||||
resize = InsetGraphicsParams::DEFAULT_SIZE;
|
||||
else if (token == "cm")
|
||||
resize = InsetGraphicsParams::CM;
|
||||
else if (token == "inch")
|
||||
resize = InsetGraphicsParams::INCH;
|
||||
else if (token == "percentOfPage")
|
||||
resize = InsetGraphicsParams::PERCENT_PAGE;
|
||||
else if (token == "percentOfColumn")
|
||||
resize = InsetGraphicsParams::PERCENT_COLUMN;
|
||||
else {
|
||||
lyxerr << "BUG: When reading resize value of InsetGraphicsParam"
|
||||
" unknown token found '" << token << '\'' << endl;
|
||||
}
|
||||
case NONE:
|
||||
os << "none";
|
||||
break;
|
||||
}
|
||||
os << endl;
|
||||
#endif
|
||||
|
||||
if (height)
|
||||
igp->heightResize = resize;
|
||||
else
|
||||
igp->widthResize = resize;
|
||||
|
||||
// Save the inline status
|
||||
if (inlineFigure)
|
||||
os << " inline";
|
||||
|
||||
// Save the subcaption status
|
||||
if (subcaption)
|
||||
os << " subcaption";
|
||||
|
||||
if (! subcaptionText.empty())
|
||||
os << " subcaptionText \"" << subcaptionText << '\"' << endl;
|
||||
|
||||
writeResize(os, "width", widthResize, widthSize);
|
||||
writeResize(os, "height", heightResize, heightSize);
|
||||
|
||||
writeOrigin(os, rotateOrigin);
|
||||
if (rotateAngle != 0)
|
||||
os << " rotateAngle " << rotateAngle << endl;
|
||||
}
|
||||
|
||||
|
||||
static void readResize(InsetGraphicsParams * igp, bool height,
|
||||
string const & token)
|
||||
{
|
||||
InsetGraphicsParams::Resize resize = InsetGraphicsParams::DEFAULT_SIZE;
|
||||
|
||||
resize = resizeTranslator.find(token);
|
||||
#if 0
|
||||
// Old code, before translator.
|
||||
if (token == "default")
|
||||
resize = InsetGraphicsParams::DEFAULT_SIZE;
|
||||
else if (token == "cm")
|
||||
resize = InsetGraphicsParams::CM;
|
||||
else if (token == "inch")
|
||||
resize = InsetGraphicsParams::INCH;
|
||||
else if (token == "percentOfPage")
|
||||
resize = InsetGraphicsParams::PERCENT_PAGE;
|
||||
else if (token == "percentOfColumn")
|
||||
resize = InsetGraphicsParams::PERCENT_COLUMN;
|
||||
else {
|
||||
lyxerr << "BUG: When reading resize value of InsetGraphicsParam"
|
||||
" unknown token found '" << token << '\'' << endl;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (height)
|
||||
igp->heightResize = resize;
|
||||
else
|
||||
igp->widthResize = resize;
|
||||
}
|
||||
|
||||
static void readOrigin(InsetGraphicsParams * igp, string const & token)
|
||||
{ // TODO: complete this function.
|
||||
igp->rotateOrigin = originTranslator.find(token);
|
||||
igp->rotateOrigin = originTranslator.find(token);
|
||||
}
|
||||
|
||||
bool InsetGraphicsParams::Read(Buffer const * buf, LyXLex & lex,
|
||||
string const& token)
|
||||
|
||||
bool InsetGraphicsParams::Read(Buffer const * buf, LyXLex & lex,
|
||||
string const& token)
|
||||
{
|
||||
if (token == "filename") {
|
||||
lex.next();
|
||||
filename = lex.GetString();
|
||||
if (token == "filename") {
|
||||
lex.next();
|
||||
filename = lex.GetString();
|
||||
|
||||
if (!filename.empty()) {
|
||||
// Make the filename with absolute directory.
|
||||
filename = MakeAbsPath(filename, OnlyPath(buf->fileName()));
|
||||
}
|
||||
} else if (token == "display") {
|
||||
lex.next();
|
||||
string const type = lex.GetString();
|
||||
if (!filename.empty()) {
|
||||
// Make the filename with absolute directory.
|
||||
filename = MakeAbsPath(filename, OnlyPath(buf->fileName()));
|
||||
}
|
||||
} else if (token == "display") {
|
||||
lex.next();
|
||||
string const type = lex.GetString();
|
||||
|
||||
display = displayTranslator.find(type);
|
||||
display = displayTranslator.find(type);
|
||||
#if 0
|
||||
if (type == "color")
|
||||
display = COLOR;
|
||||
else if (type == "grayscale")
|
||||
display = GRAYSCALE;
|
||||
else if (type == "monochrome")
|
||||
display = MONOCHROME;
|
||||
else if (type == "none")
|
||||
display = NONE;
|
||||
else {
|
||||
display = MONOCHROME;
|
||||
lyxerr << "BUG: When reading InsetGraphicsParams"
|
||||
" display has an unknown type " << type << endl;
|
||||
}
|
||||
if (type == "color")
|
||||
display = COLOR;
|
||||
else if (type == "grayscale")
|
||||
display = GRAYSCALE;
|
||||
else if (type == "monochrome")
|
||||
display = MONOCHROME;
|
||||
else if (type == "none")
|
||||
display = NONE;
|
||||
else {
|
||||
display = MONOCHROME;
|
||||
lyxerr << "BUG: When reading InsetGraphicsParams"
|
||||
" display has an unknown type " << type << endl;
|
||||
}
|
||||
#endif
|
||||
} else if (token == "inline") {
|
||||
inlineFigure = true;
|
||||
} else if (token == "subcaption") {
|
||||
subcaption = true;
|
||||
} else if (token == "subcaptionText") {
|
||||
lex.next();
|
||||
subcaptionText = lex.GetString();
|
||||
} else if (token == "widthResize") {
|
||||
lex.next();
|
||||
string const token = lex.GetString();
|
||||
|
||||
readResize(this, false, token);
|
||||
} else if (token == "width") {
|
||||
lex.next();
|
||||
widthSize = lex.GetFloat();
|
||||
} else if (token == "heightResize") {
|
||||
lex.next();
|
||||
string const token = lex.GetString();
|
||||
|
||||
readResize(this, true, token);
|
||||
} else if (token == "height") {
|
||||
lex.next();
|
||||
heightSize = lex.GetFloat();
|
||||
} else if (token == "rotateOrigin") {
|
||||
lex.next();
|
||||
string const token = lex.GetString();
|
||||
} else if (token == "inline") {
|
||||
inlineFigure = true;
|
||||
} else if (token == "subcaption") {
|
||||
subcaption = true;
|
||||
} else if (token == "subcaptionText") {
|
||||
lex.next();
|
||||
subcaptionText = lex.GetString();
|
||||
} else if (token == "widthResize") {
|
||||
lex.next();
|
||||
string const token = lex.GetString();
|
||||
|
||||
readOrigin(this, token);
|
||||
} else if (token == "rotateAngle") {
|
||||
lex.next();
|
||||
rotateAngle = lex.GetInteger();
|
||||
} else {
|
||||
// If it's none of the above, its not ours.
|
||||
return false;
|
||||
}
|
||||
readResize(this, false, token);
|
||||
} else if (token == "width") {
|
||||
lex.next();
|
||||
widthSize = lex.GetFloat();
|
||||
} else if (token == "heightResize") {
|
||||
lex.next();
|
||||
string const token = lex.GetString();
|
||||
|
||||
return true;
|
||||
readResize(this, true, token);
|
||||
} else if (token == "height") {
|
||||
lex.next();
|
||||
heightSize = lex.GetFloat();
|
||||
} else if (token == "rotateOrigin") {
|
||||
lex.next();
|
||||
string const token = lex.GetString();
|
||||
|
||||
readOrigin(this, token);
|
||||
} else if (token == "rotateAngle") {
|
||||
lex.next();
|
||||
rotateAngle = lex.GetInteger();
|
||||
} else {
|
||||
// If it's none of the above, its not ours.
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -14,9 +14,7 @@
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "LString.h"
|
||||
|
||||
@ -26,102 +24,103 @@
|
||||
using std::ostream;
|
||||
|
||||
/// This struct holds all the parameters needed by insetGraphics.
|
||||
struct InsetGraphicsParams {
|
||||
/// Image filename.
|
||||
string filename;
|
||||
|
||||
/// How do we display the image?
|
||||
enum DisplayType {
|
||||
/// In full color range (if it's not in color we show it as it is)
|
||||
COLOR,
|
||||
/// In Grayscale (256 shades of gray).
|
||||
GRAYSCALE,
|
||||
/// In black and white.
|
||||
MONOCHROME,
|
||||
/// Don't display it on screen, only keep a frame in place.
|
||||
NONE
|
||||
};
|
||||
struct InsetGraphicsParams
|
||||
{
|
||||
/// Image filename.
|
||||
string filename;
|
||||
|
||||
/// How to display the image
|
||||
DisplayType display;
|
||||
|
||||
/// Is the figure inlined? (not in a paragraph of its own).
|
||||
bool inlineFigure;
|
||||
|
||||
/// Do we have a subcaption?
|
||||
bool subcaption;
|
||||
|
||||
/// The text of the subcaption.
|
||||
string subcaptionText;
|
||||
|
||||
/// This is the different origins that the graphicx package support.
|
||||
enum Origin {
|
||||
DEFAULT,
|
||||
LEFTTOP,
|
||||
LEFTCENTER,
|
||||
LEFTBASELINE,
|
||||
LEFTBOTTOM,
|
||||
CENTERTOP,
|
||||
CENTER,
|
||||
CENTERBASELINE,
|
||||
CENTERBOTTOM,
|
||||
RIGHTTOP,
|
||||
RIGHTCENTER,
|
||||
RIGHTBASELINE,
|
||||
RIGHTBOTTOM,
|
||||
REFERENCE_POINT = LEFTBASELINE
|
||||
/// How do we display the image?
|
||||
enum DisplayType {
|
||||
/// In full color range (if it's not in color we show it as it is)
|
||||
COLOR,
|
||||
/// In Grayscale (256 shades of gray).
|
||||
GRAYSCALE,
|
||||
/// In black and white.
|
||||
MONOCHROME,
|
||||
/// Don't display it on screen, only keep a frame in place.
|
||||
NONE
|
||||
};
|
||||
|
||||
/// The resize of the image, is it the default size, in cm, inch or
|
||||
/// percentage of the page/column width/height
|
||||
enum Resize {
|
||||
DEFAULT_SIZE,
|
||||
CM,
|
||||
INCH,
|
||||
PERCENT_PAGE,
|
||||
PERCENT_COLUMN
|
||||
};
|
||||
/// How to display the image
|
||||
DisplayType display;
|
||||
|
||||
|
||||
/// Keep the ratio between height and width when resizing.
|
||||
bool keepAspectRatio;
|
||||
/// Is the figure inlined? (not in a paragraph of its own).
|
||||
bool inlineFigure;
|
||||
|
||||
// What width resize to do?
|
||||
Resize widthResize;
|
||||
// Value of width resize
|
||||
float widthSize;
|
||||
// What height resize to do?
|
||||
Resize heightResize;
|
||||
// Value of height resize
|
||||
float heightSize;
|
||||
/// Do we have a subcaption?
|
||||
bool subcaption;
|
||||
|
||||
// Origin point of rotation
|
||||
Origin rotateOrigin;
|
||||
// Rotation angle.
|
||||
int rotateAngle;
|
||||
/// The text of the subcaption.
|
||||
string subcaptionText;
|
||||
|
||||
InsetGraphicsParams();
|
||||
/// This is the different origins that the graphicx package support.
|
||||
enum Origin {
|
||||
DEFAULT,
|
||||
LEFTTOP,
|
||||
LEFTCENTER,
|
||||
LEFTBASELINE,
|
||||
LEFTBOTTOM,
|
||||
CENTERTOP,
|
||||
CENTER,
|
||||
CENTERBASELINE,
|
||||
CENTERBOTTOM,
|
||||
RIGHTTOP,
|
||||
RIGHTCENTER,
|
||||
RIGHTBASELINE,
|
||||
RIGHTBOTTOM,
|
||||
REFERENCE_POINT = LEFTBASELINE
|
||||
};
|
||||
|
||||
InsetGraphicsParams(InsetGraphicsParams const &);
|
||||
InsetGraphicsParams const & operator=(InsetGraphicsParams const &);
|
||||
/// The resize of the image, is it the default size, in cm, inch or
|
||||
/// percentage of the page/column width/height
|
||||
enum Resize {
|
||||
DEFAULT_SIZE,
|
||||
CM,
|
||||
INCH,
|
||||
PERCENT_PAGE,
|
||||
PERCENT_COLUMN
|
||||
};
|
||||
|
||||
/// Save the parameters in the LyX format stream.
|
||||
void Write(Buffer const * buf, ostream & os) const;
|
||||
|
||||
/// If the token belongs to our parameters, read it.
|
||||
bool Read(Buffer const * buf, LyXLex & lex, string const & token);
|
||||
|
||||
/// Test the struct to make sure that all the options have legal values.
|
||||
void testInvariant() const;
|
||||
|
||||
/// Keep the ratio between height and width when resizing.
|
||||
bool keepAspectRatio;
|
||||
|
||||
// What width resize to do?
|
||||
Resize widthResize;
|
||||
// Value of width resize
|
||||
float widthSize;
|
||||
// What height resize to do?
|
||||
Resize heightResize;
|
||||
// Value of height resize
|
||||
float heightSize;
|
||||
|
||||
// Origin point of rotation
|
||||
Origin rotateOrigin;
|
||||
// Rotation angle.
|
||||
int rotateAngle;
|
||||
|
||||
InsetGraphicsParams();
|
||||
|
||||
InsetGraphicsParams(InsetGraphicsParams const &);
|
||||
InsetGraphicsParams const & operator=(InsetGraphicsParams const &);
|
||||
|
||||
/// Save the parameters in the LyX format stream.
|
||||
void Write(Buffer const * buf, ostream & os) const;
|
||||
|
||||
/// If the token belongs to our parameters, read it.
|
||||
bool Read(Buffer const * buf, LyXLex & lex, string const & token);
|
||||
|
||||
/// Test the struct to make sure that all the options have legal values.
|
||||
void testInvariant() const;
|
||||
|
||||
private:
|
||||
/// Initialize the object to a default status.
|
||||
void init();
|
||||
/// Initialize the object to a default status.
|
||||
void init();
|
||||
|
||||
/// Copy the other objects content to us, used in copy c-tor and assignment
|
||||
void copy(InsetGraphicsParams const & params);
|
||||
/// Copy the other objects content to us, used in copy c-tor and assignment
|
||||
void copy(InsetGraphicsParams const & params);
|
||||
};
|
||||
|
||||
bool operator==(InsetGraphicsParams const&, InsetGraphicsParams const &);
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
@ -575,7 +575,7 @@ void LyXGUI::runTime()
|
||||
kapp->processEvents();
|
||||
#endif
|
||||
#ifdef GTKGUI
|
||||
Gnome::Main::instance()->iteration(FALSE);
|
||||
while(Gnome::Main::instance()->events_pending()) Gnome::Main::instance()->iteration(FALSE);
|
||||
#endif
|
||||
|
||||
if (fl_check_forms() == FL_EVENT) {
|
||||
|
Loading…
Reference in New Issue
Block a user