]> git.lyx.org Git - features.git/commitdiff
Commit Bernhard Reiter's implementation of GExternal
authorJohn Spray <spray@lyx.org>
Wed, 19 Apr 2006 09:13:54 +0000 (09:13 +0000)
committerJohn Spray <spray@lyx.org>
Wed, 19 Apr 2006 09:13:54 +0000 (09:13 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@13694 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/gtk/ChangeLog
src/frontends/gtk/Dialogs.C
src/frontends/gtk/GExternal.C [new file with mode: 0644]
src/frontends/gtk/GExternal.h [new file with mode: 0644]
src/frontends/gtk/Makefile.am
src/frontends/gtk/glade/Makefile.am
src/frontends/gtk/glade/external.glade [new file with mode: 0644]

index ffcc29ed071dda3839decded01441d851d1fa7be..e3da2b501d1d0e22b9b440f41c0377b25d31e503 100644 (file)
@@ -1,3 +1,6 @@
+2006-04-19  Bernhard Reiter <ockham@gmx.net>
+       * GExternal.[Ch], glade/external.glade: implement external dialog
+
 2006-03-26  John Spray <spray@lyx.org>
        * GMenubar.C: expect menu strings to be locale encoded (bug 2421,1954)
 
index 2af8722476f79f23a72b430ae66a8811e0c40d97..ddc645d329c8c9fcea1edeed99878bbf89b1db44 100644 (file)
@@ -67,7 +67,7 @@
 #include "GDocument.h"
 #include "GErrorList.h"
 #include "GERT.h"
-//#include "FormExternal.h"
+#include "GExternal.h"
 #include "GFloat.h"
 #include "GGraphics.h"
 #include "GInclude.h"
@@ -229,9 +229,9 @@ Dialogs::DialogPtr Dialogs::build(string const & name)
                dialog->setView(new GERT(*dialog));
                dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
        } else if (name == "external") {
-//             dialog->bc().view(new xformsBC(dialog->bc()));
+               dialog->bc().view(new GBC(dialog->bc()));
                dialog->setController(new ControlExternal(*dialog));
-//             dialog->setView(new FormExternal(*dialog));
+               dialog->setView(new GExternal(*dialog));
                dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
        } else if (name == "file") {
                dialog->bc().view(new GBC(dialog->bc()));
diff --git a/src/frontends/gtk/GExternal.C b/src/frontends/gtk/GExternal.C
new file mode 100644 (file)
index 0000000..a6a0704
--- /dev/null
@@ -0,0 +1,783 @@
+/**
+ * \file GExternal.C
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author Bernhard Reiter
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
+#include <config.h>
+
+// Too hard to make concept checks work with this file
+#ifdef _GLIBCXX_CONCEPT_CHECKS
+#undef _GLIBCXX_CONCEPT_CHECKS
+#endif
+#ifdef _GLIBCPP_CONCEPT_CHECKS
+#undef _GLIBCPP_CONCEPT_CHECKS
+#endif
+
+#include "GExternal.h"
+#include "ControlExternal.h"
+
+#include "GtkLengthEntry.h"
+
+#include "ghelpers.h"
+
+#include "support/lstrings.h"
+#include "support/convert.h"
+#include "support/filefilterlist.h"
+
+#include <libglademm.h>
+
+#include <vector>
+#include <string>
+
+using lyx::support::token;
+using lyx::support::FileFilterList;
+using lyx::support::trim;
+
+using std::string;
+
+
+namespace lyx {
+namespace frontend {
+
+namespace {
+
+class formatModelColumns : public Gtk::TreeModel::ColumnRecord
+{
+public:
+
+       formatModelColumns() { add(name); add(extra); }
+
+       Gtk::TreeModelColumn<Glib::ustring> name;
+       Gtk::TreeModelColumn<Glib::ustring> extra;
+};
+
+
+class displayModelColumns : public Gtk::TreeModel::ColumnRecord
+{
+public:
+
+       displayModelColumns() { add(name); add(type); }
+
+       Gtk::TreeModelColumn<Glib::ustring> name;
+       Gtk::TreeModelColumn<external::DisplayType> type;
+};
+
+
+class templateModelColumns : public Gtk::TreeModel::ColumnRecord
+{
+public:
+
+       templateModelColumns() { add(name); add(info); add(filters);}
+
+       Gtk::TreeModelColumn<Glib::ustring> name;
+       Gtk::TreeModelColumn<Glib::ustring> info;
+       Gtk::TreeModelColumn<std::vector<Gtk::FileFilter* > > filters;
+
+};
+
+
+formatModelColumns formatColumns;
+
+
+/* ...ModelColumns singletons, cf. Scott Meyers, Effective C++, Item 47
+ * Needed for proper initialization of the displayModelColumns::type member
+ * which in turn needs to be Glib::Value<>::init'ed in time
+ */
+displayModelColumns& displayColumns() {
+       static displayModelColumns dC;
+       return dC;
+}
+
+
+templateModelColumns& templateColumns() {
+       static templateModelColumns tC;
+       return tC;
+}
+
+
+/// Produces a vector of Gtk::FileFilter*s out of the controller's filterstring
+/// providing sensible descriptions (with alttitle as a fallback)
+std::vector<Gtk::FileFilter* > get_filters(const std::string & filterstring, const std::string & alttitle)
+{
+       FileFilterList filterlist(filterstring);
+       std::vector<Gtk::FileFilter* > filters(filterlist.size());
+
+       for (unsigned int i=0; i < filterlist.size(); ++i) {
+               FileFilterList::Filter ff = filterlist[i];
+
+               filters[i] = new Gtk::FileFilter();
+               std::string description = ff.description();
+
+               if (description.empty())
+                       filters[i]->set_name(Glib::locale_to_utf8(alttitle) + 
+                                            " " + _("files"));
+               else 
+                       filters[i]->set_name(Glib::locale_to_utf8(description));
+
+               for (FileFilterList::Filter::glob_iterator git = ff.begin();
+                       git!=ff.end(); ++git) 
+                       filters[i]->add_pattern(Glib::locale_to_utf8(*git));
+       }
+       return filters;
+}
+
+
+void set_display(Gtk::CheckButton * show_check, Gtk::ComboBox * display_combo, 
+                Gtk::Label * display_label, GtkLengthEntry * scale_length,
+                Gtk::Label * scale_label,
+                external::DisplayType display, unsigned int scale)
+{
+
+       typedef Gtk::TreeModel::const_iterator gcit;
+       Glib::RefPtr<const Gtk::TreeModel> const display_store = 
+               display_combo->get_model();
+       bool const no_display = display == external::NoDisplay;
+
+       if (no_display)
+               display_combo->set_active(
+                       *(display_store->children().begin())); //Default
+       else
+               for (gcit it = display_store->children().begin(); 
+                    it != display_store->children().end(); ++it) {
+                       if ((*it)[displayColumns().type] == display) {
+                               display_combo->set_active(*it);
+                               break;
+                       }
+               }
+
+       scale_length->get_spin()->set_value(scale);
+       show_check->set_active(!no_display);
+
+       display_label->set_sensitive(!no_display);
+       display_combo->set_sensitive(!no_display);
+       scale_label->set_sensitive(!no_display);
+       scale_length->set_sensitive(!no_display);
+}
+
+
+void get_display(external::DisplayType & display,
+                unsigned int & scale,
+                Gtk::CheckButton const * show_check,
+                Gtk::ComboBox const * display_combo,
+                GtkLengthEntry const * scale_length)
+{
+       display = (*(display_combo->get_active()))[displayColumns().type];
+       if (!show_check->get_active())
+               display = external::NoDisplay;
+       scale = scale_length->get_spin()->get_value_as_int();
+}
+
+
+void set_rotation(Gtk::Entry * angle_entry, Gtk::ComboBox * origin_combo,
+                external::RotationData const & data)
+{
+       origin_combo->set_active(int(data.origin()));
+       angle_entry->set_text(Glib::locale_to_utf8(data.angle));
+}
+
+
+void get_rotation(external::RotationData & data,
+                 Gtk::Entry const * angle_entry, 
+                 Gtk::ComboBox const * origin_combo)
+{
+       typedef external::RotationData::OriginType OriginType;
+
+       data.origin(static_cast<OriginType>(
+               origin_combo->get_active_row_number()));
+       data.angle = Glib::locale_from_utf8(angle_entry->get_text());
+}
+
+
+void set_size(GtkLengthEntry * width_length,
+             GtkLengthEntry * height_length,
+             Gtk::CheckButton * ar_check,
+             external::ResizeData const & data)
+{
+       bool using_scale = data.usingScale();
+       double scale = convert<double>(data.scale);
+       if (data.no_resize()) {
+               // Everything is zero, so default to this!
+               using_scale = true;
+               scale = 100.0;
+       }
+
+       if (using_scale) {
+               width_length->get_spin()->set_value(scale);
+               width_length->get_combo()->set_active_text(
+                       Glib::locale_to_utf8(_("Scale%")));
+       } else {
+               width_length->set_length(data.width);
+       }
+
+       height_length->set_length(data.height);
+       if (!data.width.zero()) 
+               height_length->get_combo()->set_active(data.width.unit());
+
+       height_length->set_sensitive(!using_scale);
+
+       ar_check->set_active(data.keepAspectRatio);
+
+       bool const disable_aspectRatio = using_scale ||
+               data.width.zero() || data.height.zero();
+       ar_check->set_sensitive(!disable_aspectRatio);
+}
+
+
+void get_size(external::ResizeData & data,
+             GtkLengthEntry * width_length,
+             GtkLengthEntry * height_length,
+             Gtk::CheckButton * ar_check)
+{
+       if (width_length->get_combo()->get_active_text() != 
+               Glib::locale_to_utf8(_("Scale%"))) {
+
+               data.width = width_length->get_length();
+               data.scale = string();
+       } else {
+               // scaling instead of a width
+               data.scale = convert<string>(width_length->get_spin()->get_value());
+               data.width = LyXLength();
+       }
+
+       data.height = height_length->get_length();
+
+       data.keepAspectRatio = ar_check->get_active();
+}
+
+
+void set_crop(Gtk::CheckButton * clip_check,
+             Gtk::Entry * xl_entry, Gtk::Entry * yb_entry,
+             Gtk::Entry * xr_entry, Gtk::Entry * yt_entry,
+             external::ClipData const & data)
+{
+       clip_check->set_active(data.clip);
+       graphics::BoundingBox const & bbox = data.bbox;
+       xl_entry->set_text(Glib::locale_to_utf8(convert<string>(bbox.xl)));
+       yb_entry->set_text(Glib::locale_to_utf8(convert<string>(bbox.yb)));
+       xr_entry->set_text(Glib::locale_to_utf8(convert<string>(bbox.xr)));
+       yt_entry->set_text(Glib::locale_to_utf8(convert<string>(bbox.yt)));
+
+}
+
+
+void get_crop(external::ClipData & data,
+             Gtk::CheckButton const * clip_check,
+             Gtk::Entry const * xl_entry, Gtk::Entry const * yb_entry,
+             Gtk::Entry const * xr_entry, Gtk::Entry const * yt_entry,
+             bool bb_changed)
+{
+       data.clip = clip_check->get_active();
+
+       if (!bb_changed)
+               return;
+
+       data.bbox.xl = convert<int>(Glib::locale_from_utf8(xl_entry->get_text()));
+       data.bbox.yb = convert<int>(Glib::locale_from_utf8(yb_entry->get_text()));
+       data.bbox.xr = convert<int>(Glib::locale_from_utf8(xr_entry->get_text()));
+       data.bbox.yt = convert<int>(Glib::locale_from_utf8(yt_entry->get_text()));
+}
+
+
+void get_extra(external::ExtraData & data,
+              Glib::RefPtr<Gtk::ListStore> format_store)
+{
+       Gtk::TreeModel::iterator it  = format_store->children().begin();
+       Gtk::TreeModel::iterator end = format_store->children().end();
+       for (; it != end; ++it)
+               data.set(Glib::locale_from_utf8((*it)[formatColumns.name]), 
+               trim(Glib::locale_from_utf8((*it)[formatColumns.extra])));
+}
+
+} // namespace anon
+
+
+GExternal::GExternal(Dialog & parent)
+       : GViewCB<ControlExternal, GViewGladeB>(parent, _("External Settings"), false)
+{}
+
+
+void GExternal::doBuild()
+{
+       string const gladeName = findGladeFile("external");
+       xml_ = Gnome::Glade::Xml::create(gladeName);
+
+       xml_->get_widget("Cancel", cancelbutton_);
+       setCancel(cancelbutton_);
+       xml_->get_widget("Apply", applybutton_);
+       setApply(applybutton_);
+       xml_->get_widget("OK", okbutton_);
+       setOK(okbutton_);
+
+       xml_->get_widget("notebook", notebook_);
+
+       templatestore_ = Gtk::ListStore::create(templateColumns());
+
+       std::vector<string> templates(controller().getTemplates());
+       int count = 0;
+
+       std::vector<std::vector<Gtk::FileFilter> > myfilterlist;
+
+       // Fill the templates combo
+       for (std::vector<string>::const_iterator cit = templates.begin();
+               cit != templates.end(); ++cit, ++count) {
+               external::Template templ = controller().getTemplate(count);
+
+               Gtk::TreeModel::iterator iter = templatestore_->append();
+               (*iter)[templateColumns().name] = Glib::locale_to_utf8(*cit);
+               (*iter)[templateColumns().info] = 
+                       Glib::locale_to_utf8(templ.helpText);
+               (*iter)[templateColumns().filters] = get_filters(
+                       controller().getTemplateFilters(*cit),*cit);
+       }
+
+
+       xml_->get_widget("Template", templatecombo_);
+       templatecombo_->pack_start(templateColumns().name);
+       templatecombo_->set_model(templatestore_);
+       templatecombo_->signal_changed().connect(
+               sigc::mem_fun(*this, &GExternal::template_changed));
+
+       xml_->get_widget("TemplateView", templateview_);
+
+       templatebuffer_ = Gtk::TextBuffer::create();
+       templateview_->set_buffer(templatebuffer_);
+
+       // *** Start "File" Page ***
+       xml_->get_widget("TemplateFile", templatefcbutton_);
+       templatefcbutton_->set_title(_("Select external file"));
+       templatefcbutton_->signal_file_activated().connect(
+               sigc::mem_fun(*this, &GExternal::file_changed));
+
+       xml_->get_widget("FileLabel", filelabel_);
+       filelabel_->set_mnemonic_widget(*templatefcbutton_);
+
+       xml_->get_widget("Draft", draftcheck_);
+       xml_->get_widget("EditFile", editfilebutton_);
+       editfilebutton_->signal_clicked().connect(
+               sigc::mem_fun(*this, &GExternal::edit_clicked));
+       // *** End "File" Page ***
+
+       // *** Start "LyX View" Page ***
+       xml_->get_widget("ShowInLyX", showcheck_);
+       showcheck_->signal_toggled().connect(
+               sigc::mem_fun(*this, &GExternal::showcheck_toggled));
+
+       xml_->get_widget("DisplayLabel", displaylabel_);
+
+       displaystore_ = Gtk::ListStore::create(displayColumns());
+
+       // Fill the display combo
+       Gtk::TreeModel::iterator iter = displaystore_->append();
+       (*iter)[displayColumns().name] = Glib::locale_to_utf8(_("Default"));
+       (*iter)[displayColumns().type] = external::DefaultDisplay;
+       iter = displaystore_->append();
+       (*iter)[displayColumns().name] = Glib::locale_to_utf8(_("Monochrome"));
+       (*iter)[displayColumns().type] = external::MonochromeDisplay;
+       iter = displaystore_->append();
+       (*iter)[displayColumns().name] = Glib::locale_to_utf8(_("Grayscale"));
+       (*iter)[displayColumns().type] = external::GrayscaleDisplay;
+       iter = displaystore_->append();
+       (*iter)[displayColumns().name] = Glib::locale_to_utf8(_("Color"));
+       (*iter)[displayColumns().type] = external::ColorDisplay;
+       iter = displaystore_->append();
+       (*iter)[displayColumns().name] = Glib::locale_to_utf8(_("Preview"));
+       (*iter)[displayColumns().type] = external::PreviewDisplay;
+
+       xml_->get_widget("Display", displaycombo_);
+       displaycombo_->set_model(displaystore_);
+       displaycombo_->pack_start(displayColumns().name);
+
+       xml_->get_widget_derived ("Scale", scalelength_);
+       scalespin_ = scalelength_->get_spin();
+       scalespin_->set_digits(0);
+       scalespin_->set_range(0,100);
+       scalespin_->set_increments(1,10);
+       scalecombo_ = scalelength_->get_combo();
+       scalecombo_->clear();
+       scalecombo_->append_text(Glib::locale_to_utf8(_("Scale%")));
+       scalecombo_->set_active_text(Glib::locale_to_utf8(_("Scale%")));
+
+       xml_->get_widget("ScaleLabel", scalelabel_);
+       scalelabel_->set_mnemonic_widget(*scalespin_);
+       // *** End "LyX View" Page ***
+
+       // *** Start "Rotate" Page ***
+       xml_->get_widget("Angle", angleentry_);
+
+       Gtk::Box * box = NULL;
+       xml_->get_widget("OriginBox", box);
+       box->pack_start(origincombo_, true, true, 0);
+       box->show_all();
+
+       // Fill the origins combo
+       typedef std::vector<external::RotationDataType> Origins;
+       Origins const & all_origins = external::all_origins();
+       for (Origins::size_type i = 0; i != all_origins.size(); ++i)
+               origincombo_.append_text(
+                       Glib::locale_to_utf8(external::origin_gui_str(i)));
+
+       xml_->get_widget("OriginLabel", originlabel_);
+       originlabel_->set_mnemonic_widget(origincombo_);
+       // *** End "Rotate" Page ***
+
+       // *** Start "Scale" Page ***
+       xml_->get_widget_derived ("Width", widthlength_);
+       widthcombo_ = widthlength_->get_combo();
+       widthcombo_->prepend_text(Glib::locale_to_utf8(_("Scale%")));
+       widthcombo_->set_active_text(Glib::locale_to_utf8(_("Scale%")));
+
+       xml_->get_widget("WidthLabel", widthlabel_);
+       widthlabel_->set_mnemonic_widget(*(widthlength_->get_spin()));
+
+       xml_->get_widget_derived ("Height", heightlength_);
+
+       widthlength_->signal_changed().connect(
+               sigc::mem_fun(*this, &GExternal::size_changed));
+       heightlength_->signal_changed().connect(
+               sigc::mem_fun(*this, &GExternal::size_changed));
+       
+       xml_->get_widget("HeightLabel", heightlabel_);
+       heightlabel_->set_mnemonic_widget(*(heightlength_->get_spin()));
+
+       xml_->get_widget ("AspectRatio", archeck_);
+       // *** End "Scale" Page ***
+
+       // *** Start "Crop" Page ***
+       xml_->get_widget("Clip", clipcheck_);
+       clipcheck_->signal_toggled().connect(
+               sigc::mem_fun(*this, &GExternal::clipcheck_toggled));
+
+       xml_->get_widget("GetFromFile", bbfromfilebutton_);
+
+       bbfromfilebutton_->signal_clicked().connect(
+               sigc::mem_fun(*this, &GExternal::get_bb));
+
+       xml_->get_widget("xLabel", xlabel_);
+       xml_->get_widget("yLabel", ylabel_);
+       xml_->get_widget("RightTopLabel", rtlabel_);
+       xml_->get_widget("LeftBottomLabel", lblabel_);
+
+       xml_->get_widget("xLeft", xlentry_);
+       xlentry_->signal_editing_done().connect(
+               sigc::mem_fun(*this, &GExternal::bb_changed));
+
+       xml_->get_widget("yBottom", ybentry_);
+       ybentry_->signal_editing_done().connect(
+               sigc::mem_fun(*this, &GExternal::bb_changed));
+
+       xml_->get_widget("xRight", xrentry_);
+       xrentry_->signal_editing_done().connect(
+               sigc::mem_fun(*this, &GExternal::bb_changed));
+
+       xml_->get_widget("yTop", ytentry_);
+       ytentry_->signal_editing_done().connect(
+               sigc::mem_fun(*this, &GExternal::bb_changed));
+
+       // *** End "Crop" Page ***
+
+       // *** Start "Options" Page ***
+       formatstore_ = Gtk::ListStore::create(formatColumns);
+
+       xml_->get_widget("Options", optionsview_);
+       optionsview_->set_model(formatstore_);
+       optionsview_->append_column(_("Forma_t"), formatColumns.name);
+       optionsview_->append_column_editable(_("O_ption"), formatColumns.extra);
+       // *** End "Options" Page ***
+}
+
+
+void GExternal::update()
+{
+       InsetExternalParams const & params = controller().params();
+
+       std::string const name = params.filename.outputFilename();
+       templatefcbutton_->set_filename(name);
+
+       if (name != Glib::ustring()) {
+
+               editfilebutton_->set_sensitive(true);
+               bbfromfilebutton_->set_sensitive(true);
+       }
+       else {
+               editfilebutton_->set_sensitive(false);
+               bbfromfilebutton_->set_sensitive(false);                
+       }
+
+       templatecombo_->set_active(
+               controller().getTemplateNumber(params.templatename()));
+       update_template();
+
+       draftcheck_->set_active(params.draft);
+
+       set_display(showcheck_, displaycombo_, displaylabel_, scalelength_, scalelabel_, params.display, params.lyxscale);
+
+       set_rotation(angleentry_, &origincombo_, params.rotationdata);
+
+       set_size(widthlength_, heightlength_, archeck_, params.resizedata);
+
+       set_crop(clipcheck_,
+               xlentry_, ybentry_,
+               xrentry_, ytentry_,
+               params.clipdata);
+
+       controller().bbChanged(!params.clipdata.bbox.empty());
+}
+
+
+void GExternal::update_template()
+{
+       external::Template templ =
+               controller().getTemplate(
+                       templatecombo_->get_active_row_number());
+
+       // Remove file stale filters, if present
+       // Keep the current file selected even after a template change
+       Glib::ustring currentfilename;
+
+       typedef std::vector<Gtk::FileFilter* >::iterator ffit;
+       std::vector<Gtk::FileFilter* > templatefilters;
+
+       if (currenttemplate_) {
+               currentfilename = templatefcbutton_->get_filename();
+               templatefilters =
+                       (*currenttemplate_)[templateColumns().filters];
+
+               for (ffit it = templatefilters.begin(); 
+                        it != templatefilters.end(); ++it)
+                       templatefcbutton_->remove_filter(**it);
+       }
+
+       currenttemplate_ = templatecombo_->get_active();
+
+       templatebuffer_->set_text((*currenttemplate_)[templateColumns().info]);
+
+       // Ascertain which (if any) transformations the template supports
+       // and disable tabs hosting unsupported transforms.
+       typedef std::vector<external::TransformID> TransformIDs;
+       TransformIDs const transformIds = templ.transformIds;
+       TransformIDs::const_iterator tr_begin = transformIds.begin();
+       TransformIDs::const_iterator const tr_end = transformIds.end();
+
+       bool found = find(tr_begin, tr_end, external::Rotate) != tr_end;
+       Gtk::Widget * widget = notebook_->get_nth_page(2);
+       widget->set_sensitive(found);
+       notebook_->get_tab_label(*widget)->set_sensitive(found);
+       
+       found = find(tr_begin, tr_end, external::Resize) != tr_end;
+       widget = notebook_->get_nth_page(3);
+       widget->set_sensitive(found);
+       notebook_->get_tab_label(*widget)->set_sensitive(found);
+
+       found = find(tr_begin, tr_end, external::Clip) != tr_end;
+       widget = notebook_->get_nth_page(4);
+       widget->set_sensitive(found);
+       notebook_->get_tab_label(*widget)->set_sensitive(found);
+
+       found = find(tr_begin, tr_end, external::Extra) != tr_end;
+       widget = notebook_->get_nth_page(5);
+       widget->set_sensitive(found);
+       notebook_->get_tab_label(*widget)->set_sensitive(found);
+
+       // Add new filters; set the "All files" filter
+       // in order to allow the previously selected file to remain selected
+       templatefilters = (*currenttemplate_)[templateColumns().filters];
+       for (ffit it = templatefilters.begin();
+               it != templatefilters.end(); ++it)
+                       templatefcbutton_->add_filter(**it);
+
+       templatefcbutton_->set_filter(*templatefilters.back()); // "All files"
+
+       if (currentfilename != Glib::ustring())
+               templatefcbutton_->set_filename(currentfilename);
+
+       if (!found)
+               return;
+
+       // Ascertain whether the template has any formats supporting
+       // the 'Extra' option
+       Glib::ustring templatename = 
+                       (*currenttemplate_)[templateColumns().name];
+       formatstore_->clear();
+       external::Template::Formats::const_iterator it = templ.formats.begin();
+       external::Template::Formats::const_iterator end = templ.formats.end();
+
+       bool const enabled = (it != end);
+
+       for (; it != end; ++it) {
+               if (it->second.option_transformers.find(external::Extra) ==
+                   it->second.option_transformers.end())
+                       continue;
+               string const format = it->first;
+               string const opt = controller().params().extradata.get(format);
+
+               Gtk::TreeModel::iterator iter = formatstore_->append();
+               (*iter)[formatColumns.name] = Glib::locale_to_utf8(format);
+               (*iter)[formatColumns.extra] = Glib::locale_to_utf8(opt);
+       }
+
+       // widget is still the 'Options' tab
+       notebook_->get_tab_label(*widget)->set_sensitive(enabled); 
+}
+
+
+void GExternal::apply()
+{
+       InsetExternalParams params = controller().params();
+
+       params.filename.set(templatefcbutton_->get_filename(),
+                           kernel().bufferFilepath());
+
+       params.settemplate(
+               Glib::locale_from_utf8((*(templatecombo_->get_active()))[templateColumns().name]));
+
+       params.draft = draftcheck_->get_active();
+
+       get_display(params.display, params.lyxscale,
+                  showcheck_, displaycombo_, scalelength_);
+
+       if (notebook_->get_nth_page(2)->is_sensitive())
+               get_rotation(params.rotationdata,
+                           angleentry_, &origincombo_);
+
+       if (notebook_->get_nth_page(3)->is_sensitive())
+               get_size(params.resizedata, 
+                        widthlength_, heightlength_, archeck_);
+
+       if (notebook_->get_nth_page(4)->is_sensitive())
+               get_crop(params.clipdata,
+                       clipcheck_,
+                       xlentry_, ybentry_,
+                       xrentry_, ytentry_,
+                       controller().bbChanged());
+
+       if (notebook_->get_nth_page(5)->is_sensitive())
+               get_extra(params.extradata, formatstore_);
+
+       controller().setParams(params);
+}
+
+
+void GExternal::get_bb()
+{
+       xlentry_->set_text("0");
+       ybentry_->set_text("0");
+       xrentry_->set_text("0");
+       ytentry_->set_text("0");
+
+       string const filename = templatefcbutton_->get_filename();
+       if (filename.empty())
+               return;
+
+       string const bb = controller().readBB(filename);
+       if (bb.empty())
+               return;
+
+       xlentry_->set_text(Glib::locale_to_utf8(token(bb, ' ', 0)));
+       ybentry_->set_text(Glib::locale_to_utf8(token(bb, ' ', 1)));
+       xrentry_->set_text(Glib::locale_to_utf8(token(bb, ' ', 2)));
+       ytentry_->set_text(Glib::locale_to_utf8(token(bb, ' ', 3)));
+
+       controller().bbChanged(false);
+       bc().valid(true);
+}
+
+
+bool GExternal::activate_ar() const
+{
+       if (widthlength_->get_combo()->get_active_text() == 
+               Glib::locale_to_utf8(_("Scale%")))
+               return false;
+
+       if (widthlength_->get_spin()->get_value() < 0.05)
+               return false;
+
+       if (heightlength_->get_spin()->get_value() < 0.05)
+               return false;
+
+       return true;
+}
+
+
+void GExternal::bb_changed()
+{
+       controller().bbChanged(true);
+       bc().valid(true);
+}
+
+
+void GExternal::edit_clicked()
+{
+       controller().editExternal();
+}
+
+
+void GExternal::size_changed()
+{
+       archeck_->set_sensitive(activate_ar());
+
+       bool useHeight = widthlength_->get_combo()->get_active_text() != 
+               Glib::locale_to_utf8(_("Scale%"));
+
+       heightlength_->set_sensitive(useHeight);
+}
+
+
+void GExternal::template_changed()
+{
+       update_template();
+       bc().valid(true);
+}
+
+
+void GExternal::showcheck_toggled()
+{
+       bool checked = showcheck_->get_active();
+       displaylabel_->set_sensitive(checked);
+       displaycombo_->set_sensitive(checked);
+       scalelabel_->set_sensitive(checked);
+       scalelength_->set_sensitive(checked);
+
+       bc().valid(true);
+}
+
+
+void GExternal::clipcheck_toggled()
+{
+       bool checked = clipcheck_->get_active();
+
+       xlabel_->set_sensitive(checked);
+       ylabel_->set_sensitive(checked);
+       rtlabel_->set_sensitive(checked);
+       lblabel_->set_sensitive(checked);
+
+       xlentry_->set_sensitive(checked);
+       ybentry_->set_sensitive(checked);
+       xrentry_->set_sensitive(checked);
+       ytentry_->set_sensitive(checked);
+
+       bc().valid(true);
+}
+
+
+void GExternal::file_changed()
+{
+       if (templatefcbutton_->get_filename() != Glib::ustring()) {
+
+               editfilebutton_->set_sensitive(true);
+               bbfromfilebutton_->set_sensitive(true);
+       }
+       else {
+               editfilebutton_->set_sensitive(false);
+               bbfromfilebutton_->set_sensitive(false);                
+       }
+       bc().valid(true);
+}
+
+
+} // namespace frontend
+} // namespace lyx
diff --git a/src/frontends/gtk/GExternal.h b/src/frontends/gtk/GExternal.h
new file mode 100644 (file)
index 0000000..fb7fbd6
--- /dev/null
@@ -0,0 +1,168 @@
+// -*- C++ -*-
+/**
+ * \file GExternal.h
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author Bernhard Reiter
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
+#ifndef GEXTERNAL_H
+#define GEXTERNAL_H
+
+#include "GViewBase.h"
+
+#include "GtkLengthEntry.h"
+
+#include "insets/ExternalTemplate.h"
+#include "insets/insetexternal.h"
+
+
+namespace lyx {
+namespace frontend {
+
+
+class ControlExternal;
+
+/** This class provides a GTK+ implementation of the External Dialog.
+ */
+class GExternal : public GViewCB<ControlExternal, GViewGladeB> {
+public:
+       GExternal(Dialog & parent);
+private:
+       virtual void apply();
+       virtual void doBuild();
+       virtual void update();
+
+       /** Called if a different template is selected from the templates combo
+           Updates the dialog widgets accordingly
+       */
+       void update_template();
+
+       /** Called if the "Get from file" button in the Crop tab is pressed
+           Inserts bounding box coordinates from file into coordinate entries
+       */
+       void get_bb();
+
+       /** Checks if the Aspect Ratio CheckButton is to be activated
+           True if widthlength_'s unit is not Scale% and both widthlength and
+           heightlength_ are nonzero
+       */
+       bool activate_ar() const;
+
+       /** Calls controller().bbChanged() providing it with new coordinates
+           if they any of them were changed
+       */
+       void bb_changed();
+
+       /** Calls controller().editExternal() if corresponding button is 
+           clicked
+       */
+       void edit_clicked();
+
+       /** Sets Aspect Ratio CheckButton and Height Length sensitive or greys
+           them out depending on widthlength_'s and heightlength_'s status
+           Called if either widthlength_ or heightlength_ were changed
+       */
+       void size_changed();
+
+       /// enables the apply button
+       void template_changed();
+
+       /** Sets sensitivity of the LyxView tab's other widgets depending und 
+           the 'Show in LyX' CheckButton
+       */
+       void showcheck_toggled();
+
+
+       /** Sets sensitivity of the Crop tab's other widgets depending und 
+           the 'Clip to bounding box' CheckButton
+       */
+       void clipcheck_toggled();
+
+       /** Sets sensitivity of the 'Edit file' and 
+           'Get [bounding box] from file' buttons if there was a file selected
+       */
+       void file_changed();
+
+       /// Holds the currently selected template
+       Gtk::TreeModel::iterator currenttemplate_;
+
+
+       //  Widgets & couple of corresponding models
+
+       Gtk::Button * cancelbutton_;
+       Gtk::Button * okbutton_;
+       Gtk::Button * applybutton_;
+
+       Glib::RefPtr<Gtk::ListStore> templatestore_;
+       Gtk::ComboBox * templatecombo_;
+
+       Glib::RefPtr<Gtk::TextBuffer> templatebuffer_;          
+       Gtk::TextView * templateview_;
+
+       Gtk::Notebook * notebook_;
+
+       // *** Start "File" Page ***
+       Gtk::Label * filelabel_;
+       Gtk::FileChooserButton * templatefcbutton_; //requires gtkmm>=2.6
+       Gtk::Button * editfilebutton_;
+       Gtk::CheckButton * draftcheck_;
+       // *** End "File" Page ***
+
+       // *** Start "LyX View" Page ***
+       Gtk::CheckButton * showcheck_;
+       Gtk::Label * displaylabel_;
+       Glib::RefPtr<Gtk::ListStore> displaystore_;
+       Gtk::ComboBox * displaycombo_;
+       Gtk::Label * scalelabel_;
+       GtkLengthEntry * scalelength_;
+       Gtk::ComboBoxText * scalecombo_;
+       Gtk::SpinButton * scalespin_;
+       Gtk::Label * percentlabel_;
+       // *** End "LyX View" Page ***
+
+       // *** Start "Rotate" Page ***
+       Gtk::Entry * angleentry_;
+       Gtk::Label * originlabel_;
+       Gtk::ComboBoxText origincombo_;
+       // *** End "Rotate" Page ***
+
+       // *** Start "Scale" Page ***
+       Gtk::CheckButton * archeck_;
+       Gtk::Label * widthlabel_;
+       GtkLengthEntry * widthlength_;
+       Gtk::Label * heightlabel_;
+       GtkLengthEntry * heightlength_;
+
+       Gtk::ComboBoxText * widthcombo_;
+       // *** End "Scale" Page ***
+
+       // *** Start "Crop" Page ***
+       Gtk::CheckButton * clipcheck_;
+       Gtk::Button * bbfromfilebutton_;
+
+       Gtk::Label * xlabel_;
+       Gtk::Label * ylabel_;
+       Gtk::Label * rtlabel_;
+       Gtk::Label * lblabel_;
+
+       Gtk::Entry * xlentry_;
+       Gtk::Entry * ybentry_;
+       Gtk::Entry * xrentry_;
+       Gtk::Entry * ytentry_;
+       // *** End "Crop" Page ***
+
+       // *** Start "Options" Page ***
+       Glib::RefPtr<Gtk::ListStore> formatstore_;
+       Gtk::TreeView * optionsview_;
+       // *** End "Options" Page ***
+
+};
+
+} // namespace frontend
+} // namespace lyx
+
+#endif // GEXTERNAL_H
index 9aab91e77f23eee83ac603d416f785e6375a0e91..b1a708df6ea0d785c7a2384bdecee7ab94ff8304 100644 (file)
@@ -49,6 +49,8 @@ libgtk_la_SOURCES = \
        GErrorList.h \
        GERT.C \
        GERT.h \
+       GExternal.C \
+       GExternal.h \
        GFloat.C \
        GFloat.h \
        GInclude.C \
index 7dac464dffd5de5badce3d48cd5d43c4346f63a0..daa335d320c1d68a70bacac780edee63b05b57a0 100644 (file)
@@ -15,6 +15,7 @@ dist_glade_DATA = \
        document.glade \
        errors.glade \
        ERT.glade \
+       external.glade \
        float.glade \
        graphics.glade \
        include.glade \
diff --git a/src/frontends/gtk/glade/external.glade b/src/frontends/gtk/glade/external.glade
new file mode 100644 (file)
index 0000000..5907331
--- /dev/null
@@ -0,0 +1,1080 @@
+<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
+<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
+
+<glade-interface>
+
+<widget class="GtkDialog" id="dialog">
+  <property name="visible">True</property>
+  <property name="title" translatable="yes">dialog1</property>
+  <property name="type">GTK_WINDOW_TOPLEVEL</property>
+  <property name="window_position">GTK_WIN_POS_NONE</property>
+  <property name="modal">False</property>
+  <property name="resizable">True</property>
+  <property name="destroy_with_parent">False</property>
+  <property name="decorated">True</property>
+  <property name="skip_taskbar_hint">False</property>
+  <property name="skip_pager_hint">False</property>
+  <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
+  <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
+  <property name="has_separator">False</property>
+
+  <child internal-child="vbox">
+    <widget class="GtkVBox" id="dialog-vbox1">
+      <property name="visible">True</property>
+      <property name="homogeneous">False</property>
+      <property name="spacing">0</property>
+
+      <child internal-child="action_area">
+       <widget class="GtkHButtonBox" id="dialog-action_area1">
+         <property name="visible">True</property>
+         <property name="layout_style">GTK_BUTTONBOX_END</property>
+
+         <child>
+           <widget class="GtkButton" id="Apply">
+             <property name="visible">True</property>
+             <property name="can_default">True</property>
+             <property name="can_focus">True</property>
+             <property name="label">gtk-apply</property>
+             <property name="use_stock">True</property>
+             <property name="relief">GTK_RELIEF_NORMAL</property>
+             <property name="focus_on_click">True</property>
+             <property name="response_id">-10</property>
+           </widget>
+         </child>
+
+         <child>
+           <widget class="GtkButton" id="Cancel">
+             <property name="visible">True</property>
+             <property name="can_default">True</property>
+             <property name="can_focus">True</property>
+             <property name="label">gtk-cancel</property>
+             <property name="use_stock">True</property>
+             <property name="relief">GTK_RELIEF_NORMAL</property>
+             <property name="focus_on_click">True</property>
+             <property name="response_id">-6</property>
+           </widget>
+         </child>
+
+         <child>
+           <widget class="GtkButton" id="OK">
+             <property name="visible">True</property>
+             <property name="can_default">True</property>
+             <property name="can_focus">True</property>
+             <property name="label">gtk-ok</property>
+             <property name="use_stock">True</property>
+             <property name="relief">GTK_RELIEF_NORMAL</property>
+             <property name="focus_on_click">True</property>
+             <property name="response_id">-5</property>
+           </widget>
+         </child>
+       </widget>
+       <packing>
+         <property name="padding">0</property>
+         <property name="expand">False</property>
+         <property name="fill">True</property>
+         <property name="pack_type">GTK_PACK_END</property>
+       </packing>
+      </child>
+
+      <child>
+       <widget class="GtkHBox" id="hbox1">
+         <property name="border_width">12</property>
+         <property name="visible">True</property>
+         <property name="homogeneous">False</property>
+         <property name="spacing">18</property>
+
+         <child>
+           <widget class="GtkVBox" id="vbox8">
+             <property name="visible">True</property>
+             <property name="homogeneous">False</property>
+             <property name="spacing">6</property>
+
+             <child>
+               <widget class="GtkLabel" id="TemplateLabel">
+                 <property name="visible">True</property>
+                 <property name="label" translatable="yes">Template</property>
+                 <property name="use_underline">False</property>
+                 <property name="use_markup">False</property>
+                 <property name="justify">GTK_JUSTIFY_LEFT</property>
+                 <property name="wrap">False</property>
+                 <property name="selectable">False</property>
+                 <property name="xalign">0</property>
+                 <property name="yalign">0.5</property>
+                 <property name="xpad">0</property>
+                 <property name="ypad">0</property>
+               </widget>
+               <packing>
+                 <property name="padding">0</property>
+                 <property name="expand">False</property>
+                 <property name="fill">False</property>
+               </packing>
+             </child>
+
+             <child>
+               <widget class="GtkComboBox" id="Template">
+                 <property name="visible">True</property>
+               </widget>
+               <packing>
+                 <property name="padding">0</property>
+                 <property name="expand">False</property>
+                 <property name="fill">False</property>
+               </packing>
+             </child>
+
+             <child>
+               <widget class="GtkScrolledWindow" id="scrolledwindow1">
+                 <property name="visible">True</property>
+                 <property name="can_focus">True</property>
+                 <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+                 <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+                 <property name="shadow_type">GTK_SHADOW_IN</property>
+                 <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
+
+                 <child>
+                   <widget class="GtkTextView" id="TemplateView">
+                     <property name="visible">True</property>
+                     <property name="can_focus">True</property>
+                     <property name="editable">False</property>
+                     <property name="overwrite">False</property>
+                     <property name="accepts_tab">True</property>
+                     <property name="justification">GTK_JUSTIFY_LEFT</property>
+                     <property name="wrap_mode">GTK_WRAP_WORD</property>
+                     <property name="cursor_visible">True</property>
+                     <property name="pixels_above_lines">0</property>
+                     <property name="pixels_below_lines">0</property>
+                     <property name="pixels_inside_wrap">0</property>
+                     <property name="left_margin">0</property>
+                     <property name="right_margin">0</property>
+                     <property name="indent">0</property>
+                     <property name="text" translatable="yes"></property>
+                   </widget>
+                 </child>
+               </widget>
+               <packing>
+                 <property name="padding">0</property>
+                 <property name="expand">True</property>
+                 <property name="fill">True</property>
+               </packing>
+             </child>
+           </widget>
+           <packing>
+             <property name="padding">0</property>
+             <property name="expand">True</property>
+             <property name="fill">True</property>
+           </packing>
+         </child>
+
+         <child>
+           <widget class="GtkNotebook" id="notebook">
+             <property name="visible">True</property>
+             <property name="can_focus">True</property>
+             <property name="show_tabs">True</property>
+             <property name="show_border">True</property>
+             <property name="tab_pos">GTK_POS_TOP</property>
+             <property name="scrollable">False</property>
+             <property name="enable_popup">False</property>
+
+             <child>
+               <widget class="GtkVBox" id="vbox1">
+                 <property name="border_width">12</property>
+                 <property name="visible">True</property>
+                 <property name="homogeneous">False</property>
+                 <property name="spacing">6</property>
+
+                 <child>
+                   <widget class="GtkHBox" id="hbox2">
+                     <property name="visible">True</property>
+                     <property name="homogeneous">False</property>
+                     <property name="spacing">12</property>
+
+                     <child>
+                       <widget class="GtkLabel" id="FileLabel">
+                         <property name="visible">True</property>
+                         <property name="label" translatable="yes">_File:</property>
+                         <property name="use_underline">True</property>
+                         <property name="use_markup">False</property>
+                         <property name="justify">GTK_JUSTIFY_LEFT</property>
+                         <property name="wrap">False</property>
+                         <property name="selectable">False</property>
+                         <property name="xalign">0.5</property>
+                         <property name="yalign">0.5</property>
+                         <property name="xpad">0</property>
+                         <property name="ypad">0</property>
+                         <property name="mnemonic_widget">notebook</property>
+                       </widget>
+                       <packing>
+                         <property name="padding">0</property>
+                         <property name="expand">False</property>
+                         <property name="fill">False</property>
+                       </packing>
+                     </child>
+
+                     <child>
+                       <widget class="GtkFileChooserButton" id="TemplateFile">
+                         <property name="visible">True</property>
+                         <property name="title" translatable="yes">Select external file</property>
+                         <property name="action">GTK_FILE_CHOOSER_ACTION_OPEN</property>
+                         <property name="local_only">True</property>
+                         <property name="show_hidden">False</property>
+                         <property name="do_overwrite_confirmation">False</property>
+                         <property name="width_chars">-1</property>
+                       </widget>
+                       <packing>
+                         <property name="padding">0</property>
+                         <property name="expand">True</property>
+                         <property name="fill">True</property>
+                       </packing>
+                     </child>
+
+                     <child>
+                       <widget class="GtkButton" id="EditFile">
+                         <property name="visible">True</property>
+                         <property name="can_focus">True</property>
+                         <property name="label" translatable="yes">_Edit File...</property>
+                         <property name="use_underline">True</property>
+                         <property name="relief">GTK_RELIEF_NORMAL</property>
+                         <property name="focus_on_click">True</property>
+                       </widget>
+                       <packing>
+                         <property name="padding">0</property>
+                         <property name="expand">False</property>
+                         <property name="fill">False</property>
+                       </packing>
+                     </child>
+                   </widget>
+                   <packing>
+                     <property name="padding">0</property>
+                     <property name="expand">False</property>
+                     <property name="fill">False</property>
+                   </packing>
+                 </child>
+
+                 <child>
+                   <widget class="GtkCheckButton" id="Draft">
+                     <property name="visible">True</property>
+                     <property name="can_focus">True</property>
+                     <property name="label" translatable="yes">_Draft</property>
+                     <property name="use_underline">True</property>
+                     <property name="relief">GTK_RELIEF_NORMAL</property>
+                     <property name="focus_on_click">True</property>
+                     <property name="active">False</property>
+                     <property name="inconsistent">False</property>
+                     <property name="draw_indicator">True</property>
+                   </widget>
+                   <packing>
+                     <property name="padding">0</property>
+                     <property name="expand">False</property>
+                     <property name="fill">False</property>
+                   </packing>
+                 </child>
+               </widget>
+               <packing>
+                 <property name="tab_expand">False</property>
+                 <property name="tab_fill">True</property>
+               </packing>
+             </child>
+
+             <child>
+               <widget class="GtkLabel" id="label1">
+                 <property name="visible">True</property>
+                 <property name="label" translatable="yes">File</property>
+                 <property name="use_underline">False</property>
+                 <property name="use_markup">False</property>
+                 <property name="justify">GTK_JUSTIFY_LEFT</property>
+                 <property name="wrap">False</property>
+                 <property name="selectable">False</property>
+                 <property name="xalign">0.5</property>
+                 <property name="yalign">0.5</property>
+                 <property name="xpad">0</property>
+                 <property name="ypad">0</property>
+               </widget>
+               <packing>
+                 <property name="type">tab</property>
+               </packing>
+             </child>
+
+             <child>
+               <widget class="GtkVBox" id="vbox7">
+                 <property name="border_width">12</property>
+                 <property name="visible">True</property>
+                 <property name="homogeneous">False</property>
+                 <property name="spacing">6</property>
+
+                 <child>
+                   <widget class="GtkCheckButton" id="ShowInLyX">
+                     <property name="visible">True</property>
+                     <property name="can_focus">True</property>
+                     <property name="label" translatable="yes">_Show in LyX</property>
+                     <property name="use_underline">True</property>
+                     <property name="relief">GTK_RELIEF_NORMAL</property>
+                     <property name="focus_on_click">True</property>
+                     <property name="active">False</property>
+                     <property name="inconsistent">False</property>
+                     <property name="draw_indicator">True</property>
+                   </widget>
+                   <packing>
+                     <property name="padding">0</property>
+                     <property name="expand">False</property>
+                     <property name="fill">False</property>
+                   </packing>
+                 </child>
+
+                 <child>
+                   <widget class="GtkTable" id="table5">
+                     <property name="visible">True</property>
+                     <property name="n_rows">2</property>
+                     <property name="n_columns">2</property>
+                     <property name="homogeneous">False</property>
+                     <property name="row_spacing">6</property>
+                     <property name="column_spacing">6</property>
+
+                     <child>
+                       <widget class="GtkLabel" id="DisplayLabel">
+                         <property name="visible">True</property>
+                         <property name="label" translatable="yes">_Display:</property>
+                         <property name="use_underline">True</property>
+                         <property name="use_markup">False</property>
+                         <property name="justify">GTK_JUSTIFY_LEFT</property>
+                         <property name="wrap">False</property>
+                         <property name="selectable">False</property>
+                         <property name="xalign">0</property>
+                         <property name="yalign">0.5</property>
+                         <property name="xpad">0</property>
+                         <property name="ypad">0</property>
+                         <property name="mnemonic_widget">Display</property>
+                       </widget>
+                       <packing>
+                         <property name="left_attach">0</property>
+                         <property name="right_attach">1</property>
+                         <property name="top_attach">0</property>
+                         <property name="bottom_attach">1</property>
+                         <property name="x_options">fill</property>
+                         <property name="y_options"></property>
+                       </packing>
+                     </child>
+
+                     <child>
+                       <widget class="GtkLabel" id="ScaleLabel">
+                         <property name="visible">True</property>
+                         <property name="label" translatable="yes">Sca_le:</property>
+                         <property name="use_underline">True</property>
+                         <property name="use_markup">False</property>
+                         <property name="justify">GTK_JUSTIFY_LEFT</property>
+                         <property name="wrap">False</property>
+                         <property name="selectable">False</property>
+                         <property name="xalign">0</property>
+                         <property name="yalign">0.5</property>
+                         <property name="xpad">0</property>
+                         <property name="ypad">0</property>
+                         <property name="mnemonic_widget">notebook</property>
+                       </widget>
+                       <packing>
+                         <property name="left_attach">0</property>
+                         <property name="right_attach">1</property>
+                         <property name="top_attach">1</property>
+                         <property name="bottom_attach">2</property>
+                         <property name="x_options">fill</property>
+                         <property name="y_options"></property>
+                       </packing>
+                     </child>
+
+                     <child>
+                       <widget class="GtkComboBox" id="Display">
+                         <property name="visible">True</property>
+                       </widget>
+                       <packing>
+                         <property name="left_attach">1</property>
+                         <property name="right_attach">2</property>
+                         <property name="top_attach">0</property>
+                         <property name="bottom_attach">1</property>
+                         <property name="y_options">fill</property>
+                       </packing>
+                     </child>
+
+                     <child>
+                       <widget class="GtkHBox" id="Scale">
+                         <property name="visible">True</property>
+                         <property name="homogeneous">False</property>
+                         <property name="spacing">0</property>
+
+                         <child>
+                           <placeholder/>
+                         </child>
+
+                         <child>
+                           <placeholder/>
+                         </child>
+                       </widget>
+                       <packing>
+                         <property name="left_attach">1</property>
+                         <property name="right_attach">2</property>
+                         <property name="top_attach">1</property>
+                         <property name="bottom_attach">2</property>
+                         <property name="x_options">fill</property>
+                         <property name="y_options">fill</property>
+                       </packing>
+                     </child>
+                   </widget>
+                   <packing>
+                     <property name="padding">0</property>
+                     <property name="expand">True</property>
+                     <property name="fill">True</property>
+                   </packing>
+                 </child>
+               </widget>
+               <packing>
+                 <property name="tab_expand">False</property>
+                 <property name="tab_fill">True</property>
+               </packing>
+             </child>
+
+             <child>
+               <widget class="GtkLabel" id="label2">
+                 <property name="visible">True</property>
+                 <property name="label" translatable="yes">LyX View</property>
+                 <property name="use_underline">False</property>
+                 <property name="use_markup">False</property>
+                 <property name="justify">GTK_JUSTIFY_LEFT</property>
+                 <property name="wrap">False</property>
+                 <property name="selectable">False</property>
+                 <property name="xalign">0.5</property>
+                 <property name="yalign">0.5</property>
+                 <property name="xpad">0</property>
+                 <property name="ypad">0</property>
+               </widget>
+               <packing>
+                 <property name="type">tab</property>
+               </packing>
+             </child>
+
+             <child>
+               <widget class="GtkTable" id="table3">
+                 <property name="border_width">12</property>
+                 <property name="visible">True</property>
+                 <property name="n_rows">2</property>
+                 <property name="n_columns">2</property>
+                 <property name="homogeneous">False</property>
+                 <property name="row_spacing">6</property>
+                 <property name="column_spacing">6</property>
+
+                 <child>
+                   <widget class="GtkLabel" id="AngleLabel">
+                     <property name="visible">True</property>
+                     <property name="label" translatable="yes">A_ngle:</property>
+                     <property name="use_underline">True</property>
+                     <property name="use_markup">False</property>
+                     <property name="justify">GTK_JUSTIFY_LEFT</property>
+                     <property name="wrap">False</property>
+                     <property name="selectable">False</property>
+                     <property name="xalign">0</property>
+                     <property name="yalign">0.5</property>
+                     <property name="xpad">0</property>
+                     <property name="ypad">0</property>
+                     <property name="mnemonic_widget">Angle</property>
+                   </widget>
+                   <packing>
+                     <property name="left_attach">0</property>
+                     <property name="right_attach">1</property>
+                     <property name="top_attach">0</property>
+                     <property name="bottom_attach">1</property>
+                     <property name="x_options">fill</property>
+                     <property name="y_options"></property>
+                   </packing>
+                 </child>
+
+                 <child>
+                   <widget class="GtkLabel" id="OriginLabel">
+                     <property name="visible">True</property>
+                     <property name="label" translatable="yes">_Origin:</property>
+                     <property name="use_underline">True</property>
+                     <property name="use_markup">False</property>
+                     <property name="justify">GTK_JUSTIFY_LEFT</property>
+                     <property name="wrap">False</property>
+                     <property name="selectable">False</property>
+                     <property name="xalign">0</property>
+                     <property name="yalign">0.5</property>
+                     <property name="xpad">0</property>
+                     <property name="ypad">0</property>
+                     <property name="mnemonic_widget">notebook</property>
+                   </widget>
+                   <packing>
+                     <property name="left_attach">0</property>
+                     <property name="right_attach">1</property>
+                     <property name="top_attach">1</property>
+                     <property name="bottom_attach">2</property>
+                     <property name="x_options">fill</property>
+                     <property name="y_options"></property>
+                   </packing>
+                 </child>
+
+                 <child>
+                   <widget class="GtkVBox" id="OriginBox">
+                     <property name="visible">True</property>
+                     <property name="homogeneous">False</property>
+                     <property name="spacing">0</property>
+
+                     <child>
+                       <placeholder/>
+                     </child>
+                   </widget>
+                   <packing>
+                     <property name="left_attach">1</property>
+                     <property name="right_attach">2</property>
+                     <property name="top_attach">1</property>
+                     <property name="bottom_attach">2</property>
+                     <property name="y_options">fill</property>
+                   </packing>
+                 </child>
+
+                 <child>
+                   <widget class="GtkEntry" id="Angle">
+                     <property name="visible">True</property>
+                     <property name="can_focus">True</property>
+                     <property name="editable">True</property>
+                     <property name="visibility">True</property>
+                     <property name="max_length">0</property>
+                     <property name="text" translatable="yes"></property>
+                     <property name="has_frame">True</property>
+                     <property name="invisible_char">*</property>
+                     <property name="activates_default">False</property>
+                   </widget>
+                   <packing>
+                     <property name="left_attach">1</property>
+                     <property name="right_attach">2</property>
+                     <property name="top_attach">0</property>
+                     <property name="bottom_attach">1</property>
+                     <property name="y_options"></property>
+                   </packing>
+                 </child>
+               </widget>
+               <packing>
+                 <property name="tab_expand">False</property>
+                 <property name="tab_fill">True</property>
+               </packing>
+             </child>
+
+             <child>
+               <widget class="GtkLabel" id="label3">
+                 <property name="visible">True</property>
+                 <property name="label" translatable="yes">Rotate</property>
+                 <property name="use_underline">False</property>
+                 <property name="use_markup">False</property>
+                 <property name="justify">GTK_JUSTIFY_LEFT</property>
+                 <property name="wrap">False</property>
+                 <property name="selectable">False</property>
+                 <property name="xalign">0.5</property>
+                 <property name="yalign">0.5</property>
+                 <property name="xpad">0</property>
+                 <property name="ypad">0</property>
+               </widget>
+               <packing>
+                 <property name="type">tab</property>
+               </packing>
+             </child>
+
+             <child>
+               <widget class="GtkVBox" id="vbox10">
+                 <property name="border_width">12</property>
+                 <property name="visible">True</property>
+                 <property name="homogeneous">False</property>
+                 <property name="spacing">6</property>
+
+                 <child>
+                   <widget class="GtkTable" id="table1">
+                     <property name="visible">True</property>
+                     <property name="n_rows">2</property>
+                     <property name="n_columns">2</property>
+                     <property name="homogeneous">False</property>
+                     <property name="row_spacing">6</property>
+                     <property name="column_spacing">12</property>
+
+                     <child>
+                       <widget class="GtkLabel" id="WidthLabel">
+                         <property name="visible">True</property>
+                         <property name="label" translatable="yes">_Width:</property>
+                         <property name="use_underline">True</property>
+                         <property name="use_markup">False</property>
+                         <property name="justify">GTK_JUSTIFY_LEFT</property>
+                         <property name="wrap">False</property>
+                         <property name="selectable">False</property>
+                         <property name="xalign">0</property>
+                         <property name="yalign">0.5</property>
+                         <property name="xpad">0</property>
+                         <property name="ypad">0</property>
+                         <property name="mnemonic_widget">notebook</property>
+                       </widget>
+                       <packing>
+                         <property name="left_attach">0</property>
+                         <property name="right_attach">1</property>
+                         <property name="top_attach">0</property>
+                         <property name="bottom_attach">1</property>
+                         <property name="x_options">fill</property>
+                         <property name="y_options"></property>
+                       </packing>
+                     </child>
+
+                     <child>
+                       <widget class="GtkLabel" id="HeightLabel">
+                         <property name="visible">True</property>
+                         <property name="label" translatable="yes">_Height:</property>
+                         <property name="use_underline">True</property>
+                         <property name="use_markup">False</property>
+                         <property name="justify">GTK_JUSTIFY_LEFT</property>
+                         <property name="wrap">False</property>
+                         <property name="selectable">False</property>
+                         <property name="xalign">0</property>
+                         <property name="yalign">0.5</property>
+                         <property name="xpad">0</property>
+                         <property name="ypad">0</property>
+                         <property name="mnemonic_widget">notebook</property>
+                       </widget>
+                       <packing>
+                         <property name="left_attach">0</property>
+                         <property name="right_attach">1</property>
+                         <property name="top_attach">1</property>
+                         <property name="bottom_attach">2</property>
+                         <property name="x_options">fill</property>
+                         <property name="y_options"></property>
+                       </packing>
+                     </child>
+
+                     <child>
+                       <widget class="GtkHBox" id="Width">
+                         <property name="visible">True</property>
+                         <property name="homogeneous">False</property>
+                         <property name="spacing">0</property>
+
+                         <child>
+                           <placeholder/>
+                         </child>
+
+                         <child>
+                           <placeholder/>
+                         </child>
+                       </widget>
+                       <packing>
+                         <property name="left_attach">1</property>
+                         <property name="right_attach">2</property>
+                         <property name="top_attach">0</property>
+                         <property name="bottom_attach">1</property>
+                         <property name="y_options">fill</property>
+                       </packing>
+                     </child>
+
+                     <child>
+                       <widget class="GtkHBox" id="Height">
+                         <property name="visible">True</property>
+                         <property name="homogeneous">False</property>
+                         <property name="spacing">0</property>
+
+                         <child>
+                           <placeholder/>
+                         </child>
+
+                         <child>
+                           <placeholder/>
+                         </child>
+                       </widget>
+                       <packing>
+                         <property name="left_attach">1</property>
+                         <property name="right_attach">2</property>
+                         <property name="top_attach">1</property>
+                         <property name="bottom_attach">2</property>
+                         <property name="y_options">fill</property>
+                       </packing>
+                     </child>
+                   </widget>
+                   <packing>
+                     <property name="padding">0</property>
+                     <property name="expand">True</property>
+                     <property name="fill">True</property>
+                   </packing>
+                 </child>
+
+                 <child>
+                   <widget class="GtkCheckButton" id="AspectRatio">
+                     <property name="visible">True</property>
+                     <property name="can_focus">True</property>
+                     <property name="label" translatable="yes">_Maintain aspect ratio</property>
+                     <property name="use_underline">True</property>
+                     <property name="relief">GTK_RELIEF_NORMAL</property>
+                     <property name="focus_on_click">True</property>
+                     <property name="active">False</property>
+                     <property name="inconsistent">False</property>
+                     <property name="draw_indicator">True</property>
+                   </widget>
+                   <packing>
+                     <property name="padding">0</property>
+                     <property name="expand">False</property>
+                     <property name="fill">False</property>
+                   </packing>
+                 </child>
+               </widget>
+               <packing>
+                 <property name="tab_expand">False</property>
+                 <property name="tab_fill">True</property>
+               </packing>
+             </child>
+
+             <child>
+               <widget class="GtkLabel" id="label4">
+                 <property name="visible">True</property>
+                 <property name="label" translatable="yes">Scale</property>
+                 <property name="use_underline">False</property>
+                 <property name="use_markup">False</property>
+                 <property name="justify">GTK_JUSTIFY_LEFT</property>
+                 <property name="wrap">False</property>
+                 <property name="selectable">False</property>
+                 <property name="xalign">0.5</property>
+                 <property name="yalign">0.5</property>
+                 <property name="xpad">0</property>
+                 <property name="ypad">0</property>
+               </widget>
+               <packing>
+                 <property name="type">tab</property>
+               </packing>
+             </child>
+
+             <child>
+               <widget class="GtkVBox" id="vbox5">
+                 <property name="border_width">12</property>
+                 <property name="visible">True</property>
+                 <property name="homogeneous">False</property>
+                 <property name="spacing">6</property>
+
+                 <child>
+                   <widget class="GtkHBox" id="hbox1">
+                     <property name="visible">True</property>
+                     <property name="homogeneous">False</property>
+                     <property name="spacing">12</property>
+
+                     <child>
+                       <widget class="GtkCheckButton" id="Clip">
+                         <property name="visible">True</property>
+                         <property name="can_focus">True</property>
+                         <property name="label" translatable="yes">Clip to _bounding box</property>
+                         <property name="use_underline">True</property>
+                         <property name="relief">GTK_RELIEF_NORMAL</property>
+                         <property name="focus_on_click">True</property>
+                         <property name="active">False</property>
+                         <property name="inconsistent">False</property>
+                         <property name="draw_indicator">True</property>
+                       </widget>
+                       <packing>
+                         <property name="padding">0</property>
+                         <property name="expand">False</property>
+                         <property name="fill">False</property>
+                       </packing>
+                     </child>
+
+                     <child>
+                       <widget class="GtkButton" id="GetFromFile">
+                         <property name="visible">True</property>
+                         <property name="can_focus">True</property>
+                         <property name="label" translatable="yes">_Get from File</property>
+                         <property name="use_underline">True</property>
+                         <property name="relief">GTK_RELIEF_NORMAL</property>
+                         <property name="focus_on_click">True</property>
+                       </widget>
+                       <packing>
+                         <property name="padding">0</property>
+                         <property name="expand">False</property>
+                         <property name="fill">False</property>
+                         <property name="pack_type">GTK_PACK_END</property>
+                       </packing>
+                     </child>
+                   </widget>
+                   <packing>
+                     <property name="padding">0</property>
+                     <property name="expand">True</property>
+                     <property name="fill">True</property>
+                   </packing>
+                 </child>
+
+                 <child>
+                   <widget class="GtkTable" id="CropTable">
+                     <property name="visible">True</property>
+                     <property name="n_rows">3</property>
+                     <property name="n_columns">3</property>
+                     <property name="homogeneous">False</property>
+                     <property name="row_spacing">6</property>
+                     <property name="column_spacing">6</property>
+
+                     <child>
+                       <widget class="GtkLabel" id="RightTopLabel">
+                         <property name="visible">True</property>
+                         <property name="label" translatable="yes">Right _top:</property>
+                         <property name="use_underline">True</property>
+                         <property name="use_markup">False</property>
+                         <property name="justify">GTK_JUSTIFY_LEFT</property>
+                         <property name="wrap">False</property>
+                         <property name="selectable">False</property>
+                         <property name="xalign">0</property>
+                         <property name="yalign">0.5</property>
+                         <property name="xpad">0</property>
+                         <property name="ypad">0</property>
+                         <property name="mnemonic_widget">xRight</property>
+                       </widget>
+                       <packing>
+                         <property name="left_attach">0</property>
+                         <property name="right_attach">1</property>
+                         <property name="top_attach">1</property>
+                         <property name="bottom_attach">2</property>
+                         <property name="x_options">fill</property>
+                         <property name="y_options"></property>
+                       </packing>
+                     </child>
+
+                     <child>
+                       <widget class="GtkLabel" id="LeftBottomLabel">
+                         <property name="visible">True</property>
+                         <property name="label" translatable="yes">_Left bottom:</property>
+                         <property name="use_underline">True</property>
+                         <property name="use_markup">False</property>
+                         <property name="justify">GTK_JUSTIFY_LEFT</property>
+                         <property name="wrap">False</property>
+                         <property name="selectable">False</property>
+                         <property name="xalign">0</property>
+                         <property name="yalign">0.5</property>
+                         <property name="xpad">0</property>
+                         <property name="ypad">0</property>
+                         <property name="mnemonic_widget">xLeft</property>
+                       </widget>
+                       <packing>
+                         <property name="left_attach">0</property>
+                         <property name="right_attach">1</property>
+                         <property name="top_attach">2</property>
+                         <property name="bottom_attach">3</property>
+                         <property name="x_options">fill</property>
+                         <property name="y_options"></property>
+                       </packing>
+                     </child>
+
+                     <child>
+                       <widget class="GtkLabel" id="xLabel">
+                         <property name="visible">True</property>
+                         <property name="label" translatable="yes">x</property>
+                         <property name="use_underline">False</property>
+                         <property name="use_markup">False</property>
+                         <property name="justify">GTK_JUSTIFY_LEFT</property>
+                         <property name="wrap">False</property>
+                         <property name="selectable">False</property>
+                         <property name="xalign">0</property>
+                         <property name="yalign">0.5</property>
+                         <property name="xpad">0</property>
+                         <property name="ypad">0</property>
+                       </widget>
+                       <packing>
+                         <property name="left_attach">1</property>
+                         <property name="right_attach">2</property>
+                         <property name="top_attach">0</property>
+                         <property name="bottom_attach">1</property>
+                         <property name="x_options">fill</property>
+                         <property name="y_options"></property>
+                       </packing>
+                     </child>
+
+                     <child>
+                       <widget class="GtkLabel" id="yLabel">
+                         <property name="visible">True</property>
+                         <property name="label" translatable="yes">y</property>
+                         <property name="use_underline">False</property>
+                         <property name="use_markup">False</property>
+                         <property name="justify">GTK_JUSTIFY_LEFT</property>
+                         <property name="wrap">False</property>
+                         <property name="selectable">False</property>
+                         <property name="xalign">0</property>
+                         <property name="yalign">0.5</property>
+                         <property name="xpad">0</property>
+                         <property name="ypad">0</property>
+                       </widget>
+                       <packing>
+                         <property name="left_attach">2</property>
+                         <property name="right_attach">3</property>
+                         <property name="top_attach">0</property>
+                         <property name="bottom_attach">1</property>
+                         <property name="x_options">fill</property>
+                         <property name="y_options"></property>
+                       </packing>
+                     </child>
+
+                     <child>
+                       <widget class="GtkEntry" id="xRight">
+                         <property name="visible">True</property>
+                         <property name="can_focus">True</property>
+                         <property name="editable">True</property>
+                         <property name="visibility">True</property>
+                         <property name="max_length">0</property>
+                         <property name="text" translatable="yes"></property>
+                         <property name="has_frame">True</property>
+                         <property name="invisible_char">*</property>
+                         <property name="activates_default">False</property>
+                       </widget>
+                       <packing>
+                         <property name="left_attach">1</property>
+                         <property name="right_attach">2</property>
+                         <property name="top_attach">1</property>
+                         <property name="bottom_attach">2</property>
+                         <property name="y_options"></property>
+                       </packing>
+                     </child>
+
+                     <child>
+                       <widget class="GtkEntry" id="yTop">
+                         <property name="visible">True</property>
+                         <property name="can_focus">True</property>
+                         <property name="editable">True</property>
+                         <property name="visibility">True</property>
+                         <property name="max_length">0</property>
+                         <property name="text" translatable="yes"></property>
+                         <property name="has_frame">True</property>
+                         <property name="invisible_char">*</property>
+                         <property name="activates_default">False</property>
+                       </widget>
+                       <packing>
+                         <property name="left_attach">2</property>
+                         <property name="right_attach">3</property>
+                         <property name="top_attach">1</property>
+                         <property name="bottom_attach">2</property>
+                         <property name="y_options"></property>
+                       </packing>
+                     </child>
+
+                     <child>
+                       <widget class="GtkEntry" id="xLeft">
+                         <property name="visible">True</property>
+                         <property name="can_focus">True</property>
+                         <property name="editable">True</property>
+                         <property name="visibility">True</property>
+                         <property name="max_length">0</property>
+                         <property name="text" translatable="yes"></property>
+                         <property name="has_frame">True</property>
+                         <property name="invisible_char">*</property>
+                         <property name="activates_default">False</property>
+                       </widget>
+                       <packing>
+                         <property name="left_attach">1</property>
+                         <property name="right_attach">2</property>
+                         <property name="top_attach">2</property>
+                         <property name="bottom_attach">3</property>
+                         <property name="y_options"></property>
+                       </packing>
+                     </child>
+
+                     <child>
+                       <widget class="GtkEntry" id="yBottom">
+                         <property name="visible">True</property>
+                         <property name="can_focus">True</property>
+                         <property name="editable">True</property>
+                         <property name="visibility">True</property>
+                         <property name="max_length">0</property>
+                         <property name="text" translatable="yes"></property>
+                         <property name="has_frame">True</property>
+                         <property name="invisible_char">*</property>
+                         <property name="activates_default">False</property>
+                       </widget>
+                       <packing>
+                         <property name="left_attach">2</property>
+                         <property name="right_attach">3</property>
+                         <property name="top_attach">2</property>
+                         <property name="bottom_attach">3</property>
+                         <property name="y_options"></property>
+                       </packing>
+                     </child>
+                   </widget>
+                   <packing>
+                     <property name="padding">0</property>
+                     <property name="expand">True</property>
+                     <property name="fill">True</property>
+                   </packing>
+                 </child>
+               </widget>
+               <packing>
+                 <property name="tab_expand">False</property>
+                 <property name="tab_fill">True</property>
+               </packing>
+             </child>
+
+             <child>
+               <widget class="GtkLabel" id="label5">
+                 <property name="visible">True</property>
+                 <property name="label" translatable="yes">Crop</property>
+                 <property name="use_underline">False</property>
+                 <property name="use_markup">False</property>
+                 <property name="justify">GTK_JUSTIFY_LEFT</property>
+                 <property name="wrap">False</property>
+                 <property name="selectable">False</property>
+                 <property name="xalign">0.5</property>
+                 <property name="yalign">0.5</property>
+                 <property name="xpad">0</property>
+                 <property name="ypad">0</property>
+               </widget>
+               <packing>
+                 <property name="type">tab</property>
+               </packing>
+             </child>
+
+             <child>
+               <widget class="GtkScrolledWindow" id="OptionsScrolledWindow">
+                 <property name="border_width">12</property>
+                 <property name="visible">True</property>
+                 <property name="can_focus">True</property>
+                 <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+                 <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+                 <property name="shadow_type">GTK_SHADOW_IN</property>
+                 <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
+
+                 <child>
+                   <widget class="GtkTreeView" id="Options">
+                     <property name="visible">True</property>
+                     <property name="can_focus">True</property>
+                     <property name="headers_visible">True</property>
+                     <property name="rules_hint">False</property>
+                     <property name="reorderable">False</property>
+                     <property name="enable_search">True</property>
+                   </widget>
+                 </child>
+               </widget>
+               <packing>
+                 <property name="tab_expand">False</property>
+                 <property name="tab_fill">True</property>
+               </packing>
+             </child>
+
+             <child>
+               <widget class="GtkLabel" id="label6">
+                 <property name="visible">True</property>
+                 <property name="label" translatable="yes">Options</property>
+                 <property name="use_underline">False</property>
+                 <property name="use_markup">False</property>
+                 <property name="justify">GTK_JUSTIFY_LEFT</property>
+                 <property name="wrap">False</property>
+                 <property name="selectable">False</property>
+                 <property name="xalign">0.5</property>
+                 <property name="yalign">0.5</property>
+                 <property name="xpad">0</property>
+                 <property name="ypad">0</property>
+               </widget>
+               <packing>
+                 <property name="type">tab</property>
+               </packing>
+             </child>
+           </widget>
+           <packing>
+             <property name="padding">0</property>
+             <property name="expand">True</property>
+             <property name="fill">True</property>
+           </packing>
+         </child>
+       </widget>
+       <packing>
+         <property name="padding">0</property>
+         <property name="expand">True</property>
+         <property name="fill">True</property>
+       </packing>
+      </child>
+    </widget>
+  </child>
+</widget>
+
+</glade-interface>