#include "frontends/Application.h"
+#include "support/convert.h"
#include "support/debug.h"
#include "support/docstream.h"
#include "support/docstring_list.h"
InsetGraphics * inset = new InsetGraphics(buffer_);
InsetGraphicsParams igp;
igp.filename = file;
+ igp.lyxscale = iconScaleFactor(file);
+ igp.scale = convert<string>(igp.lyxscale);
inset->setParams(igp);
clear();
Font const f(inherit_font, buffer().params().language);
#include "support/qstring_helpers.h"
#include <QDir>
+#include <QImage>
#include <QTemporaryFile>
#include "support/lassert.h"
}
+int iconScaleFactor(FileName const & image)
+{
+ int imgsize = QImage(toqstr(image.absFileName())).height();
+ if (imgsize <= 0)
+ return 100;
+
+ // default icon size
+ int iconsize = 20;
+
+ string dir = "images";
+ FileName const fn = imageLibFileSearch(dir, "iconsize.png");
+ if (!fn.empty())
+ iconsize = QImage(toqstr(fn.absFileName())).height();
+
+ return (100 * iconsize + imgsize / 2)/imgsize;
+}
+
+
string const commandPrep(string const & command_in)
{
static string const token_scriptpath = "$$s/";
std::string const & ext = std::string(),
search_mode mode = must_exist);
+/** Returns the percentage factor by which an image has to be
+ scaled for matching the (theme dependent) nominal icon size
+ */
+int iconScaleFactor(FileName const & image);
+
/// How to quote a filename
enum quote_style {
/** Quote for the (OS dependant) shell. This is needed for command