]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/xforms/FormGraphics.C
remove defaults stuff, let Qt handle no toolbar
[lyx.git] / src / frontends / xforms / FormGraphics.C
index 60021430a4eac87526a910b19cba50815fc52212..32bd0e2011ec351a246e8f6c4c957d67505fd23e 100644 (file)
@@ -12,9 +12,6 @@
 
 #include <config.h>
 
-#ifdef __GNUG__
-#pragma implementation
-#endif
 
 #include "xformsBC.h"
 #include "ControlGraphics.h"
@@ -39,7 +36,7 @@
 #include "support/lyxlib.h"  // for float_equal
 #include "support/filetools.h"  // for MakeAbsPath etc
 
-#include "BoostFormat.h"
+#include "support/BoostFormat.h"
 
 #include FORMS_H_LOCATION
 
@@ -58,10 +55,10 @@ string defaultUnit("cm");
 } // namespace anon
 
 
-typedef FormCB<ControlGraphics, FormDB<FD_graphics> > base_class;
+typedef FormController<ControlGraphics, FormView<FD_graphics> > base_class;
 
-FormGraphics::FormGraphics()
-       : base_class(_("Graphics"), false)
+FormGraphics::FormGraphics(Dialog & parent)
+       : base_class(parent, _("Graphics"), false)
 {}
 
 
@@ -82,23 +79,23 @@ void FormGraphics::build()
        dialog_.reset(build_graphics(this));
 
        // Manage the ok, apply, restore and cancel/close buttons
-       bc().setOK(dialog_->button_ok);
-       bc().setApply(dialog_->button_apply);
-       bc().setCancel(dialog_->button_close);
-       bc().setRestore(dialog_->button_restore);
+       bcview().setOK(dialog_->button_ok);
+       bcview().setApply(dialog_->button_apply);
+       bcview().setCancel(dialog_->button_close);
+       bcview().setRestore(dialog_->button_restore);
 
        // the file section
        file_.reset(build_graphics_file(this));
 
        // disable for read-only documents
-       bc().addReadOnly(file_->button_browse);
-       bc().addReadOnly(file_->check_aspectratio);
-       bc().addReadOnly(file_->check_draft);
-       bc().addReadOnly(file_->check_nounzip);
+       bcview().addReadOnly(file_->button_browse);
+       bcview().addReadOnly(file_->check_aspectratio);
+       bcview().addReadOnly(file_->check_draft);
+       bcview().addReadOnly(file_->check_nounzip);
 
        // check validity of "length + unit" input
-       addCheckedGlueLength(bc(), file_->input_width);
-       addCheckedGlueLength(bc(), file_->input_height);
+       addCheckedGlueLength(bcview(), file_->input_width);
+       addCheckedGlueLength(bcview(), file_->input_height);
 
        // trigger an input event for cut&paste with middle mouse button.
        setPrehandler(file_->input_filename);
@@ -124,8 +121,9 @@ void FormGraphics::build()
        fl_addto_choice(file_->choice_display, display_List.c_str());
 
 #if USE_BOOST_FORMAT
-       string const width_list = boost::io::str(boost::format(_("Scale%%|%1$s")) % choice_Length_All);
+       string const width_list = boost::io::str(boost::format(_("Scale%%%%|%1$s")) % choice_Length_All);
 #else
+       // xgettext:no-c-format
        string const width_list = _("Scale%%|") + choice_Length_All;
 #endif
        fl_addto_choice(file_->choice_width, width_list.c_str());
@@ -145,6 +143,7 @@ void FormGraphics::build()
 
        str = _("Set the image width to the inserted value.");
        tooltips().init(file_->input_width, str);
+       // xgettext:no-c-format
        str = _("Select unit for width; Scale% for scaling whole image.");
        tooltips().init(file_->choice_width, str);
        str = _("Set the image height to the inserted value.");
@@ -167,11 +166,11 @@ void FormGraphics::build()
        bbox_.reset(build_graphics_bbox(this));
 
        // disable for read-only documents
-       bc().addReadOnly(bbox_->button_getBB);
-       bc().addReadOnly(bbox_->check_clip);
+       bcview().addReadOnly(bbox_->button_getBB);
+       bcview().addReadOnly(bbox_->check_clip);
 
        // check validity of "length + unit" input
-       addCheckedLyXLength(bc(), bbox_->input_bb_x1, bbox_->text_X);
+       addCheckedLyXLength(bcview(), bbox_->input_bb_x1, bbox_->text_X);
 
        // trigger an input event for cut&paste with middle mouse button.
        setPrehandler(bbox_->input_bb_x0);
@@ -218,10 +217,10 @@ void FormGraphics::build()
        extra_.reset(build_graphics_extra(this));
 
        // disable for read-only documents
-       bc().addReadOnly(extra_->input_rotate_angle);
-       bc().addReadOnly(extra_->choice_origin);
-       bc().addReadOnly(extra_->check_subcaption);
-       bc().addReadOnly(extra_->input_special);
+       bcview().addReadOnly(extra_->input_rotate_angle);
+       bcview().addReadOnly(extra_->choice_origin);
+       bcview().addReadOnly(extra_->check_subcaption);
+       bcview().addReadOnly(extra_->input_special);
 
        // trigger an input event for cut&paste with middle mouse button.
        setPrehandler(extra_->input_rotate_angle);
@@ -254,7 +253,7 @@ void FormGraphics::build()
        tooltips().init(extra_->check_subcaption, str);
        str = _("Insert the optional subfigure caption.");
        tooltips().init(extra_->input_subcaption, str);
-       str = _("Add any additional latex option, which is defined in the "
+       str = _("Add any additional LaTeX option, which is defined in the "
                "graphicx-package and not mentioned in the gui's tabfolders.");
        tooltips().init(extra_->input_special, str);
 
@@ -400,7 +399,7 @@ void FormGraphics::apply()
        fl_set_input(extra_->input_rotate_angle, tostr(igp.rotateAngle).c_str());
 
        int const origin_pos = fl_get_choice(extra_->choice_origin);
-       if (origin_pos == 1) {
+       if (origin_pos == 0) {
                igp.rotateOrigin.erase();
        } else {
                igp.rotateOrigin = origins_[origin_pos - 1];
@@ -484,7 +483,7 @@ void FormGraphics::update() {
        if (igp.rotateOrigin.empty()) {
                origin_pos = 1;
        } else {
-               origin_pos = 2 + findPos(origins_, igp.rotateOrigin);
+               origin_pos = 1 + findPos(origins_, igp.rotateOrigin);
        }
        fl_set_choice(extra_->choice_origin, origin_pos);