]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/GuiGraphics.cpp
Fix the tab ordering of GuiDocument components.
[lyx.git] / src / frontends / qt4 / GuiGraphics.cpp
index 2fcb79867103e6eab8e9fd30ece273f25e33df25..465ffcea34406d8d5e0804b8962e1fe3838e9526 100644 (file)
@@ -24,7 +24,6 @@
 #include "LengthCombo.h"
 #include "Length.h"
 #include "LyXRC.h"
-#include "Undo.h"
 
 #include "graphics/GraphicsCache.h"
 #include "graphics/GraphicsCacheItem.h"
@@ -473,7 +472,7 @@ void GuiGraphics::on_angle_textChanged(const QString & filename)
 void GuiGraphics::paramsToDialog(InsetGraphicsParams const & igp)
 {
        static char const * const bb_units[] = { "bp", "cm", "mm", "in" };
-       static char const * const bb_units_gui[] = { N_("bp"), N_("cm"), N_("mm"), N_("in") };
+       static char const * const bb_units_gui[] = { N_("bp"), N_("cm"), N_("mm"), N_("in[[unit of measure]]") };
        size_t const bb_size = sizeof(bb_units) / sizeof(bb_units[0]);
 
        lbXunit->clear();
@@ -481,7 +480,7 @@ void GuiGraphics::paramsToDialog(InsetGraphicsParams const & igp)
        rtXunit->clear();
        rtYunit->clear();
        
-       for (int i = 0; i < bb_size; i++) {
+       for (size_t i = 0; i < bb_size; i++) {
                lbXunit->addItem(qt_(bb_units_gui[i]),
                        toqstr(bb_units[i]));
                lbYunit->addItem(qt_(bb_units_gui[i]),
@@ -495,14 +494,14 @@ void GuiGraphics::paramsToDialog(InsetGraphicsParams const & igp)
        // set the right default unit
        Length::UNIT const defaultUnit = Length::defaultUnit();
 
-       //lyxerr << bufferFilepath();
+       //lyxerr << bufferFilePath();
        string const name =
-               igp.filename.outputFilename(fromqstr(bufferFilepath()));
+               igp.filename.outputFileName(fromqstr(bufferFilePath()));
        filename->setText(toqstr(name));
 
        // set the bounding box values
        if (igp.bb.empty()) {
-               string const bb = readBoundingBox(igp.filename.absFilename());
+               string const bb = readBoundingBox(igp.filename.absFileName());
                // the values from the file always have the bigpoint-unit bp
                doubleToWidget(lbX, token(bb, ' ', 0));
                doubleToWidget(lbY, token(bb, ' ', 1));
@@ -626,7 +625,7 @@ void GuiGraphics::paramsToDialog(InsetGraphicsParams const & igp)
 
        origin->clear();
 
-       for (int i = 0; i < rorigin_size; i++) {
+       for (size_t i = 0; i < rorigin_size; i++) {
                origin->addItem(qt_(rorigin_gui_strs[i]),
                        toqstr(rorigin_lyx_strs[i]));
        }
@@ -638,6 +637,8 @@ void GuiGraphics::paramsToDialog(InsetGraphicsParams const & igp)
 
        // latex section
        latexoptions->setText(toqstr(igp.special));
+       // cf bug #3852
+       filename->setFocus();
 }
 
 
@@ -645,7 +646,7 @@ void GuiGraphics::applyView()
 {
        InsetGraphicsParams & igp = params_;
 
-       igp.filename.set(fromqstr(filename->text()), fromqstr(bufferFilepath()));
+       igp.filename.set(fromqstr(filename->text()), fromqstr(bufferFilePath()));
 
        // the bb section
        igp.bb.erase();
@@ -785,14 +786,14 @@ QString GuiGraphics::browse(QString const & in_name) const
        QString const title = qt_("Select graphics file");
 
        // Does user clipart directory exist?
-       string clipdir = addName(package().user_support().absFilename(), "clipart");
+       string clipdir = addName(package().user_support().absFileName(), "clipart");
        FileName clip(clipdir);
 
        // bail out to system clipart directory
        if (!clip.isDirectory())
-               clipdir = addName(package().system_support().absFilename(), "clipart");
+               clipdir = addName(package().system_support().absFileName(), "clipart");
 
-       return browseRelFile(in_name, bufferFilepath(),
+       return browseRelToParent(in_name, bufferFilePath(),
                title, fileFilters(QString()), false, 
                qt_("Clipart|#C#c"), toqstr(clipdir),
                qt_("Documents|#o#O"), toqstr(lyxrc.document_path));
@@ -801,7 +802,7 @@ QString GuiGraphics::browse(QString const & in_name) const
 
 string GuiGraphics::readBoundingBox(string const & file)
 {
-       FileName const abs_file = support::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
@@ -830,7 +831,7 @@ string GuiGraphics::readBoundingBox(string const & file)
 bool GuiGraphics::isFileNameValid(string const & fname) const
 {
        // It may be that the filename is relative.
-       return support::makeAbsPath(fname, fromqstr(bufferFilepath())).isReadableFile();
+       return support::makeAbsPath(fname, fromqstr(bufferFilePath())).isReadableFile();
 }