Merge with "Beep6581/dev" 2
This commit is contained in:
parent
c28d5aab97
commit
2338b8f366
@ -25,7 +25,6 @@
|
|||||||
|
|
||||||
#include "externaleditorpreferences.h"
|
#include "externaleditorpreferences.h"
|
||||||
#include "multilangmgr.h"
|
#include "multilangmgr.h"
|
||||||
#include "rtimage.h"
|
|
||||||
|
|
||||||
|
|
||||||
ExternalEditorPreferences::ExternalEditorPreferences():
|
ExternalEditorPreferences::ExternalEditorPreferences():
|
||||||
@ -52,12 +51,10 @@ ExternalEditorPreferences::ExternalEditorPreferences():
|
|||||||
list_scroll_area.add(*list_view);
|
list_scroll_area.add(*list_view);
|
||||||
|
|
||||||
// Toolbar buttons.
|
// Toolbar buttons.
|
||||||
auto add_image = Gtk::manage(new RTImage("add-small.png"));
|
|
||||||
auto remove_image = Gtk::manage(new RTImage("remove-small.png"));
|
|
||||||
button_add = Gtk::manage(new Gtk::Button());
|
button_add = Gtk::manage(new Gtk::Button());
|
||||||
button_remove = Gtk::manage(new Gtk::Button());
|
button_remove = Gtk::manage(new Gtk::Button());
|
||||||
button_add->set_image(*add_image);
|
button_add->set_image_from_icon_name("add-small");
|
||||||
button_remove->set_image(*remove_image);
|
button_remove->set_image_from_icon_name("remove-small");
|
||||||
button_app_chooser = Gtk::manage(new Gtk::Button(M("PREFERENCES_EXTERNALEDITOR_CHANGE")));
|
button_app_chooser = Gtk::manage(new Gtk::Button(M("PREFERENCES_EXTERNALEDITOR_CHANGE")));
|
||||||
button_file_chooser = Gtk::manage(new Gtk::Button(M("PREFERENCES_EXTERNALEDITOR_CHANGE_FILE")));
|
button_file_chooser = Gtk::manage(new Gtk::Button(M("PREFERENCES_EXTERNALEDITOR_CHANGE_FILE")));
|
||||||
|
|
||||||
|
@ -61,8 +61,8 @@ public:
|
|||||||
|
|
||||||
explicit PopUpCommon (Gtk::Button* button, const Glib::ustring& label = "");
|
explicit PopUpCommon (Gtk::Button* button, const Glib::ustring& label = "");
|
||||||
virtual ~PopUpCommon ();
|
virtual ~PopUpCommon ();
|
||||||
bool addEntry (const Glib::ustring& fileName, const Glib::ustring& label, Gtk::RadioButtonGroup* radioGroup = nullptr);
|
bool addEntry (const Glib::ustring& iconName, const Glib::ustring& label, Gtk::RadioButtonGroup* radioGroup = nullptr);
|
||||||
bool insertEntry(int position, const Glib::ustring& fileName, const Glib::ustring& label, Gtk::RadioButtonGroup* radioGroup = nullptr);
|
bool insertEntry(int position, const Glib::ustring& iconName, const Glib::ustring& label, Gtk::RadioButtonGroup* radioGroup = nullptr);
|
||||||
bool insertEntry(int position, const Glib::RefPtr<const Gio::Icon>& gIcon, const Glib::ustring& label, Gtk::RadioButtonGroup* radioGroup = nullptr);
|
bool insertEntry(int position, const Glib::RefPtr<const Gio::Icon>& gIcon, const Glib::ustring& label, Gtk::RadioButtonGroup* radioGroup = nullptr);
|
||||||
int getEntryCount () const;
|
int getEntryCount () const;
|
||||||
bool setSelected (int entryNum);
|
bool setSelected (int entryNum);
|
||||||
@ -78,7 +78,7 @@ private:
|
|||||||
type_signal_item_selected messageItemSelected;
|
type_signal_item_selected messageItemSelected;
|
||||||
|
|
||||||
std::vector<Glib::RefPtr<const Gio::Icon>> imageIcons;
|
std::vector<Glib::RefPtr<const Gio::Icon>> imageIcons;
|
||||||
std::vector<Glib::ustring> imageFilenames;
|
std::vector<Glib::ustring> imageIconNames;
|
||||||
std::vector<const RTImage*> images;
|
std::vector<const RTImage*> images;
|
||||||
Glib::ustring buttonHint;
|
Glib::ustring buttonHint;
|
||||||
RTImage* buttonImage;
|
RTImage* buttonImage;
|
||||||
@ -90,15 +90,15 @@ private:
|
|||||||
bool hasMenu;
|
bool hasMenu;
|
||||||
|
|
||||||
void changeImage(int position);
|
void changeImage(int position);
|
||||||
void changeImage(const Glib::ustring& fileName, const Glib::RefPtr<const Gio::Icon>& gIcon);
|
void changeImage(const Glib::ustring& iconName, const Glib::RefPtr<const Gio::Icon>& gIcon);
|
||||||
void entrySelected(Gtk::Widget* menuItem);
|
void entrySelected(Gtk::Widget* menuItem);
|
||||||
bool insertEntryImpl(int position, const Glib::ustring& fileName, const Glib::RefPtr<const Gio::Icon>& gIcon, RTImage* image, const Glib::ustring& label, Gtk::RadioButtonGroup* radioGroup);
|
bool insertEntryImpl(int position, const Glib::ustring& iconName, const Glib::RefPtr<const Gio::Icon>& gIcon, RTImage* image, const Glib::ustring& label, Gtk::RadioButtonGroup* radioGroup);
|
||||||
void showMenu(GdkEventButton* event);
|
void showMenu(GdkEventButton* event);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual int posToIndex(int p) const { return p; }
|
virtual int posToIndex(int p) const { return p; }
|
||||||
virtual int indexToPos(int i) const { return i; }
|
virtual int indexToPos(int i) const { return i; }
|
||||||
|
|
||||||
void entrySelected (int i);
|
void entrySelected (int i);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -58,7 +58,8 @@ RTImage::RTImage () {}
|
|||||||
RTImage::RTImage (const Glib::ustring& iconName, const Gtk::IconSize iconSize) :
|
RTImage::RTImage (const Glib::ustring& iconName, const Gtk::IconSize iconSize) :
|
||||||
Gtk::Image(),
|
Gtk::Image(),
|
||||||
size(iconSize),
|
size(iconSize),
|
||||||
icon_name(iconName)
|
icon_name(iconName),
|
||||||
|
g_icon(Glib::RefPtr<const Gio::Icon>())
|
||||||
{
|
{
|
||||||
// Set surface from icon cache
|
// Set surface from icon cache
|
||||||
surface = RTImageCache::getCachedSurface(this->icon_name, this->size);
|
surface = RTImageCache::getCachedSurface(this->icon_name, this->size);
|
||||||
@ -69,6 +70,16 @@ RTImage::RTImage (const Glib::ustring& iconName, const Gtk::IconSize iconSize) :
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RTImage::RTImage (const Glib::RefPtr<const Gio::Icon>& gIcon, const Gtk::IconSize iconSize) :
|
||||||
|
Gtk::Image(),
|
||||||
|
size(iconSize),
|
||||||
|
icon_name(""),
|
||||||
|
g_icon(Glib::RefPtr<const Gio::Icon>())
|
||||||
|
{
|
||||||
|
// Configure RTImage based on g_icon
|
||||||
|
set(this->g_icon, this->size);
|
||||||
|
}
|
||||||
|
|
||||||
void RTImage::set_from_icon_name(const Glib::ustring& iconName)
|
void RTImage::set_from_icon_name(const Glib::ustring& iconName)
|
||||||
{
|
{
|
||||||
this->icon_name = iconName;
|
this->icon_name = iconName;
|
||||||
@ -80,6 +91,11 @@ void RTImage::set_from_icon_name(const Glib::ustring& iconName)
|
|||||||
if (surface) {
|
if (surface) {
|
||||||
set(surface->get());
|
set(surface->get());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Unset Gio::Icon if firstly exists
|
||||||
|
if (this->g_icon) {
|
||||||
|
g_icon = Glib::RefPtr<const Gio::Icon>();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RTImage::set_from_icon_name(const Glib::ustring& iconName, const Gtk::IconSize iconSize)
|
void RTImage::set_from_icon_name(const Glib::ustring& iconName, const Gtk::IconSize iconSize)
|
||||||
@ -90,16 +106,54 @@ void RTImage::set_from_icon_name(const Glib::ustring& iconName, const Gtk::IconS
|
|||||||
// Set surface from icon cache
|
// Set surface from icon cache
|
||||||
surface = RTImageCache::getCachedSurface(this->icon_name, this->size);
|
surface = RTImageCache::getCachedSurface(this->icon_name, this->size);
|
||||||
|
|
||||||
// Add it to the RTImage if surface exists
|
// Add it to the RTImage if previously chosen
|
||||||
if (surface) {
|
if (surface) {
|
||||||
set(surface->get());
|
set(surface->get());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Unset Gio::Icon if previously chosen
|
||||||
|
if (this->g_icon) {
|
||||||
|
g_icon = Glib::RefPtr<const Gio::Icon>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void RTImage::set_from_gicon(const Glib::RefPtr<const Gio::Icon>& gIcon)
|
||||||
|
{
|
||||||
|
this->g_icon = gIcon;
|
||||||
|
|
||||||
|
// Set image from Gio::Icon
|
||||||
|
set(this->g_icon, this->size);
|
||||||
|
|
||||||
|
// Unset surface if previously chosen
|
||||||
|
this->icon_name = "";
|
||||||
|
|
||||||
|
if (surface) {
|
||||||
|
surface = std::shared_ptr<RTSurface>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void RTImage::set_from_gicon(const Glib::RefPtr<const Gio::Icon>& gIcon, const Gtk::IconSize iconSize)
|
||||||
|
{
|
||||||
|
this->g_icon = gIcon;
|
||||||
|
this->size = iconSize;
|
||||||
|
|
||||||
|
// Set image from Gio::Icon
|
||||||
|
set(this->g_icon, this->size);
|
||||||
|
|
||||||
|
// Unset surface if previously chosen
|
||||||
|
this->icon_name = "";
|
||||||
|
|
||||||
|
if (surface) {
|
||||||
|
surface = std::shared_ptr<RTSurface>();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int RTImage::get_width()
|
int RTImage::get_width()
|
||||||
{
|
{
|
||||||
if (surface) {
|
if (surface) {
|
||||||
return surface->getWidth();
|
return surface->getWidth();
|
||||||
|
} else if (g_icon) {
|
||||||
|
Gtk::Image::get_width();
|
||||||
}
|
}
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
@ -109,6 +163,8 @@ int RTImage::get_height()
|
|||||||
{
|
{
|
||||||
if (surface) {
|
if (surface) {
|
||||||
return surface->getHeight();
|
return surface->getHeight();
|
||||||
|
} else if (g_icon) {
|
||||||
|
Gtk::Image::get_height();
|
||||||
}
|
}
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -42,13 +42,17 @@ private:
|
|||||||
Gtk::IconSize size;
|
Gtk::IconSize size;
|
||||||
Glib::ustring icon_name;
|
Glib::ustring icon_name;
|
||||||
std::shared_ptr<RTSurface> surface;
|
std::shared_ptr<RTSurface> surface;
|
||||||
|
Glib::RefPtr<const Gio::Icon> g_icon;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
RTImage ();
|
RTImage ();
|
||||||
explicit RTImage (const Glib::ustring& iconName, const Gtk::IconSize iconSize = Gtk::ICON_SIZE_SMALL_TOOLBAR);
|
explicit RTImage (const Glib::ustring& iconName, const Gtk::IconSize iconSize = Gtk::ICON_SIZE_SMALL_TOOLBAR);
|
||||||
|
explicit RTImage (const Glib::RefPtr<const Gio::Icon>& gIcon, 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);
|
||||||
void set_from_icon_name(const Glib::ustring& iconName, const Gtk::IconSize iconSize);
|
void set_from_icon_name(const Glib::ustring& iconName, const Gtk::IconSize iconSize);
|
||||||
|
void set_from_gicon(const Glib::RefPtr<const Gio::Icon>& gIcon);
|
||||||
|
void set_from_gicon(const Glib::RefPtr<const Gio::Icon>& gIcon, const Gtk::IconSize iconSize);
|
||||||
|
|
||||||
int get_width();
|
int get_width();
|
||||||
int get_height();
|
int get_height();
|
||||||
|
@ -21,7 +21,6 @@
|
|||||||
|
|
||||||
#include "guiutils.h"
|
#include "guiutils.h"
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
#include "rtimage.h"
|
|
||||||
#include "rtscalable.h"
|
#include "rtscalable.h"
|
||||||
#include "toollocationpref.h"
|
#include "toollocationpref.h"
|
||||||
#include "toolpanelcoord.h"
|
#include "toolpanelcoord.h"
|
||||||
@ -277,12 +276,9 @@ ListEditButtons::ListEditButtons(Gtk::TreeView &list, Glib::RefPtr<Gtk::ListStor
|
|||||||
assert(list.get_model() == listStore);
|
assert(list.get_model() == listStore);
|
||||||
|
|
||||||
// Set button images.
|
// Set button images.
|
||||||
RTImage *image_button_up = Gtk::manage(new RTImage("arrow-up-small.png"));
|
buttonUp.set_image_from_icon_name("arrow-up-small");
|
||||||
RTImage *image_button_down = Gtk::manage(new RTImage("arrow-down-small.png"));
|
buttonDown.set_image_from_icon_name("arrow-down-small");
|
||||||
RTImage *image_button_remove = Gtk::manage(new RTImage("remove-small.png"));
|
buttonRemove.set_image_from_icon_name("remove-small");
|
||||||
buttonUp.set_image(*image_button_up);
|
|
||||||
buttonDown.set_image(*image_button_down);
|
|
||||||
buttonRemove.set_image(*image_button_remove);
|
|
||||||
|
|
||||||
// Connect signals for changing button sensitivity.
|
// Connect signals for changing button sensitivity.
|
||||||
const auto on_list_sel_changed_fun = sigc::mem_fun(
|
const auto on_list_sel_changed_fun = sigc::mem_fun(
|
||||||
@ -725,8 +721,7 @@ ToolLocationPreference::ToolLocationPreference(Options &options) :
|
|||||||
M("PREFERENCES_TOOLPANEL_AVAILABLETOOLS")));
|
M("PREFERENCES_TOOLPANEL_AVAILABLETOOLS")));
|
||||||
Gtk::ScrolledWindow *tool_list_scrolled_window =
|
Gtk::ScrolledWindow *tool_list_scrolled_window =
|
||||||
Gtk::manage(new Gtk::ScrolledWindow());
|
Gtk::manage(new Gtk::ScrolledWindow());
|
||||||
tool_list_scrolled_window->set_min_content_width(
|
tool_list_scrolled_window->set_min_content_width(RTScalable::scalePixelSize(400));
|
||||||
400 * (RTScalable::getTweakedDPI() / RTScalable::baseDPI));
|
|
||||||
layout_grid->attach_next_to(*tool_list_frame, Gtk::PositionType::POS_RIGHT, 1, 1);
|
layout_grid->attach_next_to(*tool_list_frame, Gtk::PositionType::POS_RIGHT, 1, 1);
|
||||||
tool_list_frame->add(*tool_list_scrolled_window);
|
tool_list_frame->add(*tool_list_scrolled_window);
|
||||||
tool_list_scrolled_window->add(*impl->toolListViewPtr);
|
tool_list_scrolled_window->add(*impl->toolListViewPtr);
|
||||||
@ -739,8 +734,7 @@ ToolLocationPreference::ToolLocationPreference(Options &options) :
|
|||||||
Gtk::Box *favorites_box = Gtk::manage(new Gtk::Box());
|
Gtk::Box *favorites_box = Gtk::manage(new Gtk::Box());
|
||||||
Gtk::ScrolledWindow *favorites_list_scrolled_window =
|
Gtk::ScrolledWindow *favorites_list_scrolled_window =
|
||||||
Gtk::manage(new Gtk::ScrolledWindow());
|
Gtk::manage(new Gtk::ScrolledWindow());
|
||||||
favorites_list_scrolled_window->set_min_content_width(
|
favorites_list_scrolled_window->set_min_content_width(RTScalable::scalePixelSize(300));
|
||||||
300 * (RTScalable::getTweakedDPI() / RTScalable::baseDPI));
|
|
||||||
layout_grid->attach_next_to(*favorites_frame, Gtk::PositionType::POS_RIGHT, 1, 1);
|
layout_grid->attach_next_to(*favorites_frame, Gtk::PositionType::POS_RIGHT, 1, 1);
|
||||||
favorites_box->pack_start(impl->favoritesListEditButtons, false, false);
|
favorites_box->pack_start(impl->favoritesListEditButtons, false, false);
|
||||||
favorites_box->pack_start(*favorites_list_scrolled_window, false, false);
|
favorites_box->pack_start(*favorites_list_scrolled_window, false, false);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user