Initial commit for real hidpi support
Note: This commit has only been tested on MacOS Changes: - Icons now use the native hidpi support from Gtk (through Icon Theme) - Icons are now directly generated from scalable file (i.e. SVG file) - Widget sizes are scaled based on DPI and scale factor - Font size is scaled based on DPI and scale factor
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
*
|
||||
* Copyright (c) 2004-2010 Gabor Horvath <hgabor@rawtherapee.com>
|
||||
* Copyright (c) 2018 Jean-Christophe FRISCH <natureh.510@gmail.com>
|
||||
* Copyright (c) 2022 Pierre CABRERA <pierre.cab@gmail.com>
|
||||
*
|
||||
* RawTherapee is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -20,44 +21,19 @@
|
||||
#pragma once
|
||||
|
||||
#include <gtkmm/image.h>
|
||||
#include "rtscalable.h"
|
||||
|
||||
/**
|
||||
* @brief A derived class of Gtk::Image in order to handle theme-related icon sets.
|
||||
*/
|
||||
class RTImage final : public Gtk::Image, public RTScalable
|
||||
class RTImage final : public Gtk::Image
|
||||
{
|
||||
static double dpiBack; // used to keep track of master dpi change
|
||||
static int scaleBack; // used to keep track of master scale change
|
||||
//bool on_configure_event(GdkEventConfigure* configure_event);
|
||||
|
||||
protected:
|
||||
Cairo::RefPtr<Cairo::ImageSurface> surface;
|
||||
Glib::RefPtr<Gdk::Pixbuf> pixbuf;
|
||||
private:
|
||||
Gtk::IconSize size;
|
||||
|
||||
public:
|
||||
RTImage ();
|
||||
RTImage (RTImage &other);
|
||||
explicit RTImage (Glib::RefPtr<Gdk::Pixbuf> &pixbuf);
|
||||
explicit RTImage (Cairo::RefPtr<Cairo::ImageSurface> &surf);
|
||||
explicit RTImage(Cairo::RefPtr<Cairo::ImageSurface> other);
|
||||
explicit RTImage (Glib::RefPtr<RTImage> &other);
|
||||
explicit RTImage (const Glib::ustring& fileName, const Glib::ustring& rtlFileName = Glib::ustring());
|
||||
|
||||
void setImage (const Glib::ustring& fileName, const Glib::ustring& rtlFileName = Glib::ustring());
|
||||
void changeImage (const Glib::ustring& imageName);
|
||||
Cairo::RefPtr<Cairo::ImageSurface> get_surface();
|
||||
int get_width();
|
||||
int get_height();
|
||||
|
||||
|
||||
static void init();
|
||||
static void cleanup(bool all = false);
|
||||
static void updateImages ();
|
||||
static void setDPInScale (const double newDPI, const int newScale);
|
||||
static void setScale (const int newScale);
|
||||
|
||||
static Glib::RefPtr<Gdk::Pixbuf> createPixbufFromFile (const Glib::ustring& fileName);
|
||||
static Cairo::RefPtr<Cairo::ImageSurface> createImgSurfFromFile (const Glib::ustring& fileName);
|
||||
explicit RTImage (const Glib::ustring& iconName, const Gtk::IconSize iconSize = Gtk::ICON_SIZE_SMALL_TOOLBAR);
|
||||
|
||||
void set_from_icon_name(const Glib::ustring& iconName);
|
||||
void set_from_icon_name(const Glib::ustring& iconName, const Gtk::IconSize iconSize);
|
||||
};
|
||||
|
Reference in New Issue
Block a user