]> git.lyx.org Git - features.git/blobdiff - src/frontends/qt4/GuiGraphics.cpp
reduce line noise
[features.git] / src / frontends / qt4 / GuiGraphics.cpp
index fa71db87a87bcfa5d903f5b9483ef01d6849b9c4..5eb0fba11f66182d00e08e82001766cd5f81e0d9 100644 (file)
 
 #include "GuiGraphics.h"
 
-#include "GuiGraphics.h"
 #include "debug.h"
 #include "LengthCombo.h"
-#include "lengthcommon.h"
+#include "Length.h"
 #include "LyXRC.h"
 #include "qt_helpers.h"
 #include "Validator.h"
-#include "frontend_helpers.h"
 
 #include "FuncRequest.h"
 #include "gettext.h"
@@ -44,7 +42,6 @@
 #include "support/types.h"
 
 #include <boost/bind.hpp>
-#include <boost/filesystem/operations.hpp>
 
 #include <QCheckBox>
 #include <QCloseEvent>
@@ -68,8 +65,6 @@ using std::make_pair;
 using std::pair;
 using std::vector;
 
-namespace fs = boost::filesystem;
-
 namespace lyx {
 namespace frontend {
 
@@ -77,7 +72,6 @@ using support::addName;
 using support::FileFilterList;
 using support::FileName;
 using support::float_equal;
-using support::isFileReadable;
 using support::makeAbsPath;
 using support::os::internal_path;
 using support::package;
@@ -100,7 +94,7 @@ using support::token;
  * checkbox is unchecked and clearing the line edit if it previously
  * said "text".
 */
-void setAutoTextCB(QCheckBox * checkBox, QLineEdit * lineEdit,
+static void setAutoTextCB(QCheckBox * checkBox, QLineEdit * lineEdit,
        LengthCombo * lengthCombo/*, string text = "auto"*/)
 {
        if (!checkBox->isChecked())
@@ -111,8 +105,6 @@ void setAutoTextCB(QCheckBox * checkBox, QLineEdit * lineEdit,
                                lengthCombo->currentLengthItem());
 }
 
-
-
 template<class Pair>
 vector<typename Pair::first_type> const
 getFirst(vector<Pair> const & pr)
@@ -134,6 +126,12 @@ getSecond(vector<Pair> const & pr)
         return tmp;
 }
 
+/// The (tranlated) GUI std::string and it's LaTeX equivalent.
+typedef std::pair<docstring, std::string> RotationOriginPair;
+///
+std::vector<RotationOriginPair> getRotationOriginData();
+
+
 GuiGraphics::GuiGraphics(LyXView & lv)
        : GuiDialog(lv, "graphics")
 {
@@ -284,7 +282,7 @@ void GuiGraphics::change_adaptor()
 void GuiGraphics::change_bb()
 {
        bbChanged = true;
-       LYXERR(Debug::GRAPHICS) << "[bb_Changed set to true]\n";
+       LYXERR(Debug::GRAPHICS, "[bb_Changed set to true]");
        changed();
 }
 
@@ -765,21 +763,22 @@ docstring const GuiGraphics::browse(docstring const & in_name) const
 
        // Does user clipart directory exist?
        string clipdir = addName(package().user_support().absFilename(), "clipart");
-       string const encoded_clipdir = FileName(clipdir).toFilesystemEncoding();
-       if (!(fs::exists(encoded_clipdir) && fs::is_directory(encoded_clipdir)))
-               // No - bail out to system clipart directory
+       FileName clip(clipdir);
+
+       // bail out to system clipart directory
+       if (!(clip.exists() && clip.isDirectory()))
                clipdir = addName(package().system_support().absFilename(), "clipart");
-       pair<docstring, docstring> dir1(_("Clipart|#C#c"), from_utf8(clipdir));
-       pair<docstring, docstring> dir2(_("Documents|#o#O"), from_utf8(lyxrc.document_path));
-       // Show the file browser dialog
+
        return browseRelFile(in_name, from_utf8(bufferFilepath()),
-               title, FileFilterList(), false, dir1, dir2);
+               title, FileFilterList(), false, 
+               _("Clipart|#C#c"), from_utf8(clipdir),
+               _("Documents|#o#O"), from_utf8(lyxrc.document_path));
 }
 
 
 string const GuiGraphics::readBB(string const & file)
 {
-       FileName const abs_file(makeAbsPath(file, bufferFilepath()));
+       FileName const abs_file = makeAbsPath(file, bufferFilepath());
 
        // try to get it from the file, if possible. Zipped files are
        // unzipped in the readBB_from_PSFile-Function
@@ -808,14 +807,13 @@ string const GuiGraphics::readBB(string const & file)
 bool GuiGraphics::isFilenameValid(string const & fname) const
 {
        // It may be that the filename is relative.
-       FileName const name(makeAbsPath(fname, bufferFilepath()));
-       return isFileReadable(name);
+       return makeAbsPath(fname, bufferFilepath()).isFileReadable();
 }
 
 
 void GuiGraphics::editGraphics()
 {
-       dialog().applyView();
+       applyView();
        string const lfun =
                InsetGraphicsMailer::params2string(params_, buffer());
        dispatch(FuncRequest(LFUN_GRAPHICS_EDIT, lfun));