///
QTimer * delay_refresh_;
///
+ Trackable trackable_;
+ ///
bool finished_generating_;
/// We don't own this
static lyx::Converter const * pconverter_;
- Trackable trackable_;
};
namespace {
-std::function<SnippetPair (string const &)> IncrementedFileName
- (string const & to_format, string const & filename_base)
-{
- return [&to_format, &filename_base](string const & snippet)
+class IncrementedFileName {
+public:
+ IncrementedFileName(string const & to_format,
+ string const & filename_base)
+ : to_format_(to_format), base_(filename_base), counter_(1)
+ {}
+
+ SnippetPair const operator()(string const & snippet)
{
- static int counter_ = 1;
ostringstream os;
- os << filename_base << counter_++ << '.' << to_format;
- string const file = os.str();
- return make_pair(snippet, FileName(file));
- };
-}
+ os << base_ << counter_++ << '.' << to_format_;
+ string const file_name = os.str();
+ return make_pair(snippet, FileName(file_name));
+ }
+
+private:
+ string const & to_format_;
+ string const & base_;
+ int counter_;
+};
InProgress::InProgress(string const & filename_base,
{
font_scaling_factor_ = int(buffer_.fontScalingFactor());
if (theApp()) {
- fg_color_ = strtol(theApp()->hexName(foregroundColor()).c_str(), nullptr, 16);
- bg_color_ = strtol(theApp()->hexName(backgroundColor()).c_str(), nullptr, 16);
+ fg_color_ = convert(theApp()->hexName(foregroundColor()).c_str(), 16);
+ bg_color_ = convert(theApp()->hexName(backgroundColor()).c_str(), 16);
} else {
fg_color_ = 0x0;
bg_color_ = 0xffffff;
int fg = 0x0;
int bg = 0xffffff;
if (theApp()) {
- fg = strtol(theApp()->hexName(foregroundColor()).c_str(), nullptr, 16);
- bg = strtol(theApp()->hexName(backgroundColor()).c_str(), nullptr, 16);
+ fg = convert(theApp()->hexName(foregroundColor()).c_str(), 16);
+ bg = convert(theApp()->hexName(backgroundColor()).c_str(), 16);
}
if (font_scaling_factor_ != fs || fg_color_ != fg || bg_color_ != bg) {
// Schedule refresh of all previews on zoom or color changes.
// Don't try to access the cache until we are done.
if (delay_refresh_->isActive() || !finished_generating_)
return nullptr;
+
Cache::const_iterator it = cache_.find(latex_snippet);
return (it == cache_.end()) ? nullptr : it->second.get();
}