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:
Pandagrapher
2022-08-19 16:47:28 +02:00
parent 1e2dc30738
commit 89d2bdce5b
108 changed files with 1949 additions and 2032 deletions

View File

@@ -989,11 +989,11 @@ void OPIcon::drivenPointToRectangle(const rtengine::Coord &pos,
bottomRight.y = topLeft.y + H - 1;
}
OPIcon::OPIcon(const Cairo::RefPtr<RTSurface> &normal,
const Cairo::RefPtr<RTSurface> &active,
const Cairo::RefPtr<RTSurface> &prelight,
const Cairo::RefPtr<RTSurface> &dragged,
const Cairo::RefPtr<RTSurface> &insensitive,
OPIcon::OPIcon(const std::shared_ptr<RTSurface> &normal,
const std::shared_ptr<RTSurface> &active,
const std::shared_ptr<RTSurface> &prelight,
const std::shared_ptr<RTSurface> &dragged,
const std::shared_ptr<RTSurface>&insensitive,
DrivenPoint drivenPoint) :
drivenPoint(drivenPoint)
{
@@ -1022,48 +1022,48 @@ OPIcon::OPIcon(Glib::ustring normalImage, Glib::ustring activeImage, Glib::ustri
Glib::ustring draggedImage, Glib::ustring insensitiveImage, DrivenPoint drivenPoint) : drivenPoint(drivenPoint)
{
if (!normalImage.empty()) {
normalImg = Cairo::RefPtr<RTSurface>(new RTSurface(normalImage));
normalImg = std::shared_ptr<RTSurface>(new RTSurface(normalImage, Gtk::ICON_SIZE_MENU));
}
if (!prelightImage.empty()) {
prelightImg = Cairo::RefPtr<RTSurface>(new RTSurface(prelightImage));
prelightImg = std::shared_ptr<RTSurface>(new RTSurface(prelightImage, Gtk::ICON_SIZE_MENU));
}
if (!activeImage.empty()) {
activeImg = Cairo::RefPtr<RTSurface>(new RTSurface(activeImage));
activeImg = std::shared_ptr<RTSurface>(new RTSurface(activeImage, Gtk::ICON_SIZE_MENU));
}
if (!draggedImage.empty()) {
draggedImg = Cairo::RefPtr<RTSurface>(new RTSurface(draggedImage));
draggedImg = std::shared_ptr<RTSurface>(new RTSurface(draggedImage, Gtk::ICON_SIZE_MENU));
}
if (!insensitiveImage.empty()) {
insensitiveImg = Cairo::RefPtr<RTSurface>(new RTSurface(insensitiveImage));
insensitiveImg = std::shared_ptr<RTSurface>(new RTSurface(insensitiveImage, Gtk::ICON_SIZE_MENU));
}
}
const Cairo::RefPtr<RTSurface> OPIcon::getNormalImg()
const std::shared_ptr<RTSurface> OPIcon::getNormalImg()
{
return normalImg;
}
const Cairo::RefPtr<RTSurface> OPIcon::getPrelightImg()
const std::shared_ptr<RTSurface> OPIcon::getPrelightImg()
{
return prelightImg;
}
const Cairo::RefPtr<RTSurface> OPIcon::getActiveImg()
const std::shared_ptr<RTSurface> OPIcon::getActiveImg()
{
return activeImg;
}
const Cairo::RefPtr<RTSurface> OPIcon::getDraggedImg()
const std::shared_ptr<RTSurface> OPIcon::getDraggedImg()
{
return draggedImg;
}
const Cairo::RefPtr<RTSurface> OPIcon::getInsensitiveImg()
const std::shared_ptr<RTSurface> OPIcon::getInsensitiveImg()
{
return insensitiveImg;
}
void OPIcon::drawImage(Cairo::RefPtr<RTSurface> &img,
void OPIcon::drawImage(std::shared_ptr<RTSurface> &img,
Cairo::RefPtr<Cairo::Context> &cr, ObjectMOBuffer *objectBuffer,
EditCoordSystem &coordSystem)
{
@@ -1089,7 +1089,7 @@ void OPIcon::drawImage(Cairo::RefPtr<RTSurface> &img,
cr->fill();
}
void OPIcon::drawMOImage(Cairo::RefPtr<RTSurface> &img, Cairo::RefPtr<Cairo::Context> &cr,
void OPIcon::drawMOImage(std::shared_ptr<RTSurface> &img, Cairo::RefPtr<Cairo::Context> &cr,
unsigned short id, ObjectMOBuffer *objectBuffer, EditCoordSystem &coordSystem)
{
// test of F_HOVERABLE has already been done