]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/GuiGraphics.cpp
fix completion painting for RTL (inline completion and completion list)
[lyx.git] / src / frontends / qt4 / GuiGraphics.cpp
index 069ee24f06a6402f5ea027cb8cd090813a7adb45..1ceb9af9a557decb14e712820b5c3f15294e4f45 100644 (file)
@@ -28,7 +28,7 @@
 #include "graphics/GraphicsCacheItem.h"
 #include "graphics/GraphicsImage.h"
 
-#include "insets/InsetGraphicsParams.h"
+#include "insets/InsetGraphics.h"
 
 #include "support/convert.h"
 #include "support/debug.h"
@@ -82,8 +82,7 @@ namespace frontend {
 //FIXME setAutoTextCB should really take an argument, as indicated, that
 //determines what text is to be written for "auto". But making
 //that work involves more extensive revisions than we now want
-//to make, since "auto" also appears in updateContents() (see
-//GuiGraphics.cpp).
+//to make, since "auto" also appears in paramsToDialog().
 //The right way to do this, I think, would be to define a class
 //checkedLengthSet (and a partnering labeledLengthSete) that encapsulated
 //the checkbox, line edit, and length combo together, and then made e.g.
@@ -246,6 +245,8 @@ GuiGraphics::GuiGraphics(GuiView & lv)
                this, SLOT(change_adaptor()));
        connect(displayscale, SIGNAL(textChanged(const QString&)),
                this, SLOT(change_adaptor()));
+       connect(groupId, SIGNAL(textChanged(const QString&)),
+               this, SLOT(change_adaptor()));
        displayscale->setValidator(new QIntValidator(displayscale));
 
        bc().setPolicy(ButtonPolicy::NoRepeatedApplyReadOnlyPolicy);
@@ -427,7 +428,7 @@ static int itemNumber(const vector<string> & v, string const & s)
 }
 
 
-void GuiGraphics::updateContents()
+void GuiGraphics::paramsToDialog(InsetGraphicsParams const & igp)
 {
        static char const * const bb_units[] = { "bp", "cm", "mm", "in" };
        size_t const bb_size = sizeof(bb_units) / sizeof(bb_units[0]);
@@ -445,8 +446,6 @@ void GuiGraphics::updateContents()
                rtYunit->addItem(toqstr(*it));
        }
 
-       InsetGraphicsParams & igp = params_;
-
        // set the right default unit
        Length::UNIT unitDefault = Length::CM;
        switch (lyxrc.default_papersize) {
@@ -459,7 +458,7 @@ void GuiGraphics::updateContents()
                        break;
        }
 
-       lyxerr << bufferFilepath();
+       //lyxerr << bufferFilepath();
        string const name =
                igp.filename.outputFilename(fromqstr(bufferFilepath()));
        filename->setText(toqstr(name));
@@ -542,6 +541,8 @@ void GuiGraphics::updateContents()
        scaleCB->blockSignals(false);
        Scale->setEnabled(scaleChecked);
 
+       groupId->setText(toqstr(igp.groupId));
+
        lengthAutoToWidgets(Width, widthUnit, igp.width,
                unitDefault);
        bool const widthChecked = !Width->text().isEmpty() &&
@@ -685,6 +686,8 @@ void GuiGraphics::applyView()
 
        // more latex options
        igp.special = fromqstr(latexoptions->text());
+
+       igp.groupId = fromqstr(groupId->text());
 }
 
 
@@ -719,6 +722,7 @@ bool GuiGraphics::isValid()
 bool GuiGraphics::initialiseParams(string const & data)
 {
        InsetGraphics::string2params(data, buffer(), params_);
+       paramsToDialog(params_);
        return true;
 }
 
@@ -734,6 +738,9 @@ void GuiGraphics::dispatchParams()
        InsetGraphicsParams tmp_params(params_);
        string const lfun = InsetGraphics::params2string(tmp_params, buffer());
        dispatch(FuncRequest(getLfun(), lfun));
+       if (!params_.groupId.empty())
+               dispatch(FuncRequest(LFUN_GRAPHICS_GROUPS_UNIFY,
+                               InsetGraphics::params2string(params_, buffer())));
 }
 
 
@@ -758,7 +765,7 @@ QString GuiGraphics::browse(QString const & in_name) const
 
 string GuiGraphics::readBoundingBox(string const & file)
 {
-       FileName const abs_file = makeAbsPath(file, fromqstr(bufferFilepath()));
+       FileName const abs_file = support::makeAbsPath(file, fromqstr(bufferFilepath()));
 
        // try to get it from the file, if possible. Zipped files are
        // unzipped in the readBB_from_PSFile-Function
@@ -787,7 +794,7 @@ string GuiGraphics::readBoundingBox(string const & file)
 bool GuiGraphics::isFileNameValid(string const & fname) const
 {
        // It may be that the filename is relative.
-       return makeAbsPath(fname, fromqstr(bufferFilepath())).isReadableFile();
+       return support::makeAbsPath(fname, fromqstr(bufferFilepath())).isReadableFile();
 }