#include "insets/insetgraphics.h"
-#include "support/FileInfo.h"
+#include "support/convert.h"
+#include "support/filefilterlist.h"
#include "support/filetools.h"
-#include "support/path_defines.h"
-#include "support/tostr.h"
+#include "support/package.h"
#include "support/types.h"
-using namespace lyx::support;
+#include <boost/filesystem/operations.hpp>
using std::make_pair;
-
+using std::string;
using std::pair;
using std::vector;
+namespace fs = boost::filesystem;
+
+namespace lyx {
+
+using support::AddName;
+using support::FileFilterList;
+using support::IsFileReadable;
+using support::MakeAbsPath;
+using support::package;
+using support::readBB_from_PSFile;
+
+namespace frontend {
+
ControlGraphics::ControlGraphics(Dialog & parent)
: Dialog::Controller(parent)
InsetGraphicsParams tmp_params(params());
string const lfun =
InsetGraphicsMailer::params2string(tmp_params, kernel().buffer());
- kernel().dispatch(FuncRequest(LFUN_INSET_APPLY, lfun));
+ kernel().dispatch(FuncRequest(getLfun(), lfun));
}
-string const ControlGraphics::Browse(string const & in_name)
+string const ControlGraphics::browse(string const & in_name) const
{
string const title = _("Select graphics file");
// Does user clipart directory exist?
- string clipdir = AddName (user_lyxdir(), "clipart");
- FileInfo fileInfo(clipdir);
- if (!(fileInfo.isOK() && fileInfo.isDir()))
+ string clipdir = AddName (package().user_support(), "clipart");
+ if (!(fs::exists(clipdir) && fs::is_directory(clipdir)))
// No - bail out to system clipart directory
- clipdir = AddName (system_lyxdir(), "clipart");
+ clipdir = AddName (package().system_support(), "clipart");
pair<string, string> dir1(_("Clipart|#C#c"), clipdir);
pair<string, string> dir2(_("Documents|#o#O"), string(lyxrc.document_path));
// Show the file browser dialog
return browseRelFile(in_name, kernel().bufferFilepath(),
- title, "*.*", false, dir1, dir2);
+ title,
+ FileFilterList(),
+ false, dir1, dir2);
}
int width = 0;
int height = 0;
- lyx::graphics::Cache & gc = lyx::graphics::Cache::get();
+ graphics::Cache & gc = graphics::Cache::get();
if (gc.inCache(abs_file)) {
- lyx::graphics::Image const * image = gc.item(abs_file)->image();
+ graphics::Image const * image = gc.item(abs_file)->image();
if (image) {
width = image->getWidth();
}
}
- return ("0 0 " + tostr(width) + ' ' + tostr(height));
+ return ("0 0 " + convert<string>(width) + ' ' + convert<string>(height));
}
}
-namespace frnt {
+void ControlGraphics::editGraphics()
+{
+ BOOST_ASSERT(params_.get());
+
+ dialog().view().apply();
+ string const lfun =
+ InsetGraphicsMailer::params2string(params(), kernel().buffer());
+ kernel().dispatch(FuncRequest(LFUN_GRAPHICS_EDIT, lfun));
+}
+
namespace {
return data;
data.resize(rorigin_size);
- for (lyx::size_type i = 0; i < rorigin_size; ++i) {
+ for (size_type i = 0; i < rorigin_size; ++i) {
data[i] = make_pair(_(rorigin_gui_strs[i]),
rorigin_lyx_strs[i]);
}
return data;
}
-} // namespace frnt
+} // namespace frontend
+} // namespace lyx