Always use icons for tab headers, #4772

This commit is contained in:
heckflosse
2018-09-18 11:37:15 +02:00
parent 93f404fd79
commit 78989731f5
14 changed files with 12 additions and 146 deletions

View File

@@ -2315,11 +2315,6 @@ void EditorPanel::updateTPVScrollbar (bool hide)
tpc->updateTPVScrollbar (hide);
}
void EditorPanel::updateTabsUsesIcons (bool useIcons)
{
tpc->updateTabsUsesIcons (useIcons);
}
void EditorPanel::updateHistogramPosition (int oldPosition, int newPosition)
{

View File

@@ -133,7 +133,6 @@ public:
}
void updateProfiles (const Glib::ustring &printerProfile, rtengine::RenderingIntent printerIntent, bool printerBPC);
void updateTPVScrollbar (bool hide);
void updateTabsUsesIcons (bool useIcons);
void updateHistogramPosition (int oldPosition, int newPosition);
void defaultMonitorProfileChanged (const Glib::ustring &profile_name, bool auto_monitor_profile);

View File

@@ -425,8 +425,3 @@ void FilePanel::updateTPVScrollbar (bool hide)
{
tpc->updateTPVScrollbar (hide);
}
void FilePanel::updateTabsUsesIcons (bool useIcons)
{
tpc->updateTabsUsesIcons (useIcons);
}

View File

@@ -80,7 +80,6 @@ public:
bool handleShortcutKey (GdkEventKey* event);
void updateTPVScrollbar (bool hide);
void updateTabsUsesIcons (bool useIcons);
private:
void on_NB_switch_page(Gtk::Widget* page, guint page_num);

View File

@@ -1434,63 +1434,15 @@ void MyFileChooserButton::get_preferred_width_for_height_vfunc (int height, int
TextOrIcon::TextOrIcon (Glib::ustring fname, Glib::ustring labelTx, Glib::ustring tooltipTx, TOITypes type)
TextOrIcon::TextOrIcon (const Glib::ustring &fname, const Glib::ustring &labelTx, const Glib::ustring &tooltipTx)
{
imgIcon = nullptr;
label = nullptr;
filename = fname;
labelText = labelTx;
tooltipText = tooltipTx;
pack_start(*Gtk::manage(new RTImage(fname)), Gtk::PACK_SHRINK, 0);
set_tooltip_markup("<span font_size=\"large\" font_weight=\"bold\">" + labelTx + "</span>\n" + tooltipTx);
set_name("TextOrIcon");
switchTo(type);
}
TextOrIcon::~TextOrIcon ()
{
if (imgIcon) {
delete imgIcon;
}
if (label) {
delete label;
}
}
void TextOrIcon::switchTo(TOITypes type)
{
switch (type) {
case (TOI_ICON):
if (!imgIcon) {
removeIfThere(this, label, false);
delete label;
label = nullptr;
imgIcon = new RTImage (filename);
pack_start(*imgIcon, Gtk::PACK_SHRINK, 0);
set_tooltip_markup ("<span font_size=\"large\" font_weight=\"bold\">" + labelText + "</span>\n" + tooltipText);
}
// do nothing if imgIcon exist, which mean that it is currently being displayed
break;
case(TOI_TEXT):
default:
if (!label) {
removeIfThere(this, imgIcon, false);
delete imgIcon;
imgIcon = nullptr;
label = new Gtk::Label (labelText, Gtk::ALIGN_CENTER);
pack_start(*label, Gtk::PACK_EXPAND_WIDGET, 0);
set_tooltip_markup (tooltipText);
}
// do nothing if label exist, which mean that it is currently being displayed
break;
}
show_all();
}
MyImageMenuItem::MyImageMenuItem(Glib::ustring label, Glib::ustring imageFileName)

View File

@@ -450,11 +450,6 @@ typedef enum RTOrientation {
RTO_Top2Bottom
} eRTOrientation;
enum TOITypes {
TOI_TEXT,
TOI_ICON
};
typedef enum RTNav {
NAV_NONE,
NAV_NEXT,
@@ -467,18 +462,8 @@ typedef enum RTNav {
class TextOrIcon : public Gtk::HBox
{
protected:
Gtk::Image* imgIcon;
Gtk::Label* label;
Glib::ustring filename;
Glib::ustring labelText;
Glib::ustring tooltipText;
public:
TextOrIcon (Glib::ustring filename, Glib::ustring labelTx, Glib::ustring tooltipTx, TOITypes type);
~TextOrIcon ();
void switchTo(TOITypes type);
TextOrIcon (const Glib::ustring &filename, const Glib::ustring &labelTx, const Glib::ustring &tooltipTx);
};
class MyImageMenuItem : public Gtk::MenuItem

View File

@@ -440,7 +440,6 @@ void Options::setDefaults()
FileBrowserToolbarSingleRow = false;
hideTPVScrollbar = false;
UseIconNoText = true;
whiteBalanceSpotSize = 8;
showFilmStripToolBar = false;
menuGroupRank = true;
@@ -1339,10 +1338,6 @@ void Options::readFromFile(Glib::ustring fname)
#endif
if (keyFile.has_key("GUI", "UseIconNoText")) {
UseIconNoText = keyFile.get_boolean("GUI", "UseIconNoText");
}
if (keyFile.has_key("GUI", "HistogramWorking")) {
rtSettings.HistogramWorking = keyFile.get_boolean("GUI", "HistogramWorking");
}
@@ -2035,7 +2030,6 @@ void Options::saveToFile(Glib::ustring fname)
keyFile.set_boolean ("GUI", "ShowFilmStripToolBar", showFilmStripToolBar);
keyFile.set_boolean ("GUI", "FileBrowserToolbarSingleRow", FileBrowserToolbarSingleRow);
keyFile.set_boolean ("GUI", "HideTPVScrollbar", hideTPVScrollbar);
keyFile.set_boolean ("GUI", "UseIconNoText", UseIconNoText);
keyFile.set_boolean ("GUI", "HistogramWorking", rtSettings.HistogramWorking);
keyFile.set_integer ("GUI", "CurveBBoxPosition", curvebboxpos);

View File

@@ -263,7 +263,6 @@ public:
int histogramDrawMode;
bool FileBrowserToolbarSingleRow;
bool hideTPVScrollbar;
bool UseIconNoText;
int whiteBalanceSpotSize;
int curvebboxpos; // 0=above, 1=right, 2=below, 3=left

View File

@@ -934,11 +934,8 @@ Gtk::Widget* Preferences::getGeneralPanel ()
ckbHideTPVScrollbar->set_active(false);
ckbHideTPVScrollbar->set_sensitive(false);
#endif
ckbUseIconNoText = Gtk::manage ( new Gtk::CheckButton (M ("PREFERENCES_TP_USEICONORTEXT")) );
setExpandAlignProperties (ckbUseIconNoText, false, false, Gtk::ALIGN_START, Gtk::ALIGN_BASELINE);
workflowGrid->attach_next_to (*hb4label, *ckbFileBrowserToolbarSingleRow, Gtk::POS_BOTTOM, 1, 1);
workflowGrid->attach_next_to (*ckbHideTPVScrollbar, *hb4label, Gtk::POS_RIGHT, 1, 1);
workflowGrid->attach_next_to (*ckbUseIconNoText, *ckbHideTPVScrollbar, Gtk::POS_RIGHT, 1, 1);
ckbAutoSaveTpOpen = Gtk::manage (new Gtk::CheckButton (M ("PREFERENCES_AUTOSAVE_TP_OPEN")));
workflowGrid->attach_next_to (*ckbAutoSaveTpOpen, *hb4label, Gtk::POS_BOTTOM, 1, 1);
btnSaveTpOpenNow = Gtk::manage (new Gtk::Button (M ("PREFERENCES_SAVE_TP_OPEN_NOW")));
@@ -1743,7 +1740,6 @@ void Preferences::storePreferences ()
moptions.showFilmStripToolBar = ckbShowFilmStripToolBar->get_active();
moptions.hideTPVScrollbar = ckbHideTPVScrollbar->get_active();
moptions.overwriteOutputFile = chOverwriteOutputFile->get_active ();
moptions.UseIconNoText = ckbUseIconNoText->get_active();
moptions.autoSaveTpOpen = ckbAutoSaveTpOpen->get_active();
@@ -1948,7 +1944,6 @@ void Preferences::fillPreferences ()
ckbFileBrowserToolbarSingleRow->set_active (moptions.FileBrowserToolbarSingleRow);
ckbShowFilmStripToolBar->set_active (moptions.showFilmStripToolBar);
ckbHideTPVScrollbar->set_active (moptions.hideTPVScrollbar);
ckbUseIconNoText->set_active (moptions.UseIconNoText);
ckbAutoSaveTpOpen->set_active (moptions.autoSaveTpOpen);
@@ -2332,11 +2327,6 @@ void Preferences::workflowUpdate ()
parent->updateTPVScrollbar (moptions.hideTPVScrollbar);
}
if (moptions.UseIconNoText != options.UseIconNoText) {
// Update the tool's tab titles
parent->updateTabsUsesIcons (moptions.UseIconNoText);
}
if (moptions.FileBrowserToolbarSingleRow != options.FileBrowserToolbarSingleRow) {
// Update the position of the Query toolbar
parent->updateFBQueryTB (moptions.FileBrowserToolbarSingleRow);

View File

@@ -197,7 +197,6 @@ class Preferences : public Gtk::Dialog, public ProfileStoreListener
Gtk::CheckButton* ckbFileBrowserToolbarSingleRow;
Gtk::CheckButton* ckbShowFilmStripToolBar;
Gtk::CheckButton* ckbHideTPVScrollbar;
Gtk::CheckButton* ckbUseIconNoText;
Gtk::CheckButton* ckbAutoSaveTpOpen;
Gtk::Button* btnSaveTpOpenNow;

View File

@@ -901,19 +901,6 @@ void RTWindow::updateTPVScrollbar (bool hide)
}
}
void RTWindow::updateTabsUsesIcons (bool useIcons)
{
fpanel->updateTabsUsesIcons (useIcons);
if (epanel) {
epanel->updateTabsUsesIcons (useIcons);
}
for (auto panel : epanels) {
panel.second->updateTabsUsesIcons (useIcons);
}
}
void RTWindow::updateFBQueryTB (bool singleRow)
{
fpanel->fileCatalog->updateFBQueryTB (singleRow);

View File

@@ -110,7 +110,6 @@ public:
void updateProfiles (const Glib::ustring &printerProfile, rtengine::RenderingIntent printerIntent, bool printerBPC);
void updateTPVScrollbar (bool hide);
void updateHistogramPosition (int oldPosition, int newPosition);
void updateTabsUsesIcons (bool useIcons);
void updateFBQueryTB (bool singleRow);
void updateFBToolBarVisibility (bool showFilmStripToolBar);
bool getIsFullscreen()

View File

@@ -199,17 +199,13 @@ ToolPanelCoordinator::ToolPanelCoordinator (bool batch) : ipc (nullptr), hasChan
rawPanel->pack_start (*Gtk::manage (new Gtk::HSeparator), Gtk::PACK_SHRINK, 0);
rawPanel->pack_start (*vbPanelEnd[4], Gtk::PACK_SHRINK, 0);
TOITypes type = options.UseIconNoText ? TOI_ICON : TOI_TEXT;
toiE = Gtk::manage (new TextOrIcon ("exposure.png", M ("MAIN_TAB_EXPOSURE"), M ("MAIN_TAB_EXPOSURE_TOOLTIP"), type));
toiD = Gtk::manage (new TextOrIcon ("detail.png", M ("MAIN_TAB_DETAIL"), M ("MAIN_TAB_DETAIL_TOOLTIP"), type));
toiC = Gtk::manage (new TextOrIcon ("color-circles.png", M ("MAIN_TAB_COLOR"), M ("MAIN_TAB_COLOR_TOOLTIP"), type));
toiW = Gtk::manage (new TextOrIcon ("atom.png", M ("MAIN_TAB_ADVANCED"), M ("MAIN_TAB_ADVANCED_TOOLTIP"), type));
toiT = Gtk::manage (new TextOrIcon ("transform.png", M ("MAIN_TAB_TRANSFORM"), M ("MAIN_TAB_TRANSFORM_TOOLTIP"), type));
toiR = Gtk::manage (new TextOrIcon ("bayer.png", M ("MAIN_TAB_RAW"), M ("MAIN_TAB_RAW_TOOLTIP"), type));
toiM = Gtk::manage (new TextOrIcon ("metadata.png", M ("MAIN_TAB_METADATA"), M ("MAIN_TAB_METADATA_TOOLTIP"), type));
toiE = Gtk::manage (new TextOrIcon ("exposure.png", M ("MAIN_TAB_EXPOSURE"), M ("MAIN_TAB_EXPOSURE_TOOLTIP")));
toiD = Gtk::manage (new TextOrIcon ("detail.png", M ("MAIN_TAB_DETAIL"), M ("MAIN_TAB_DETAIL_TOOLTIP")));
toiC = Gtk::manage (new TextOrIcon ("color-circles.png", M ("MAIN_TAB_COLOR"), M ("MAIN_TAB_COLOR_TOOLTIP")));
toiW = Gtk::manage (new TextOrIcon ("atom.png", M ("MAIN_TAB_ADVANCED"), M ("MAIN_TAB_ADVANCED_TOOLTIP")));
toiT = Gtk::manage (new TextOrIcon ("transform.png", M ("MAIN_TAB_TRANSFORM"), M ("MAIN_TAB_TRANSFORM_TOOLTIP")));
toiR = Gtk::manage (new TextOrIcon ("bayer.png", M ("MAIN_TAB_RAW"), M ("MAIN_TAB_RAW_TOOLTIP")));
toiM = Gtk::manage (new TextOrIcon ("metadata.png", M ("MAIN_TAB_METADATA"), M ("MAIN_TAB_METADATA_TOOLTIP")));
toolPanelNotebook->append_page (*exposurePanelSW, *toiE);
toolPanelNotebook->append_page (*detailsPanelSW, *toiD);
@@ -888,32 +884,11 @@ void ToolPanelCoordinator::updateVScrollbars (bool hide)
}
}
void ToolPanelCoordinator::updateTabsHeader (bool useIcons)
{
GThreadLock lock; // All GUI access from idle_add callbacks or separate thread HAVE to be protected
TOITypes type = useIcons ? TOI_ICON : TOI_TEXT;
toiE->switchTo (type);
toiD->switchTo (type);
toiC->switchTo (type);
toiT->switchTo (type);
toiR->switchTo (type);
if (toiM) {
toiM->switchTo (type);
}
}
void ToolPanelCoordinator::updateTPVScrollbar (bool hide)
{
updateVScrollbars (hide);
}
void ToolPanelCoordinator::updateTabsUsesIcons (bool useIcons)
{
updateTabsHeader (useIcons);
}
void ToolPanelCoordinator::toolSelected (ToolMode tool)
{
GThreadLock lock; // All GUI access from idle_add callbacks or separate thread HAVE to be protected

View File

@@ -190,7 +190,6 @@ protected:
void addPanel (Gtk::Box* where, FoldableToolPanel* panel, int level = 1);
void foldThemAll (GdkEventButton* event);
void updateVScrollbars (bool hide);
void updateTabsHeader (bool useIcons);
private:
@@ -296,7 +295,6 @@ public:
}
void updateTPVScrollbar (bool hide);
void updateTabsUsesIcons (bool useIcons);
bool handleShortcutKey (GdkEventKey* event);
// ToolBarListener interface