New batch of Theme bugfix, see issue #3446 (still WIP)

This commit is contained in:
Hombre 2016-10-20 22:38:37 +02:00
parent 712468197d
commit f6a9e13297
13 changed files with 116 additions and 263 deletions

View File

@ -67,13 +67,13 @@ frame {
padding: 4px;
}
frame > label {
frame label {
color: #D8D8D8;
}
#FileBrowser {
padding: 10px;
margin: 10px;
padding: 2px;
margin: 0px;
}
/* Frames in Preferences */
@ -90,6 +90,8 @@ eventbox .frame {
window {
padding: 0;
margin: 0;
border: none;
}
button {
@ -110,6 +112,13 @@ scale {
min-height: 5px;
}
scale slider {
/* Slider size is min-width x min-height ; margin have to be half of those values, but negative */
min-width: 12px;
min-height: 12px;
margin: -6px;
}
/*.EditorTopPanel .button, .ToolBarPanelFileBrowser .button, .EditorZoomPanel .button {*/
.button {
padding: 1px;
@ -129,8 +138,9 @@ scale {
padding: 4px;
}
.separator {
separator {
color: #363636;
margin: 5px;
}
progressbar.vertical {
@ -229,18 +239,18 @@ menuitem {
}
#MyExpander {
margin: 2px;
padding: 2px;
margin: 0 5px 0 5px;
padding: 0;
}
/* Tool background */
#ExpanderBox {
#ExpanderBox > box {
background-color: #363636;
border-width: 1px;
border-style: solid;
border-radius: 4px;
border-color: #252525;
margin: 2px;
margin: 0;
padding: 3px;
}
@ -254,8 +264,8 @@ menuitem {
border-width: 1px;
border-radius: 4px;
border-color: #313131;
margin: 2px;
padding: 2px;
margin: 3px;
padding: 3px;
}
#ExpanderBox frame drawingarea {
@ -266,8 +276,8 @@ menuitem {
background-color: #414141;
border: 1px solid #373737;
border-radius: 4px;
margin: 2px;
padding: 2px;
margin: 3px;
padding: 3px;
}
#ExpanderBox frame frame drawingarea {
@ -275,11 +285,11 @@ menuitem {
}
/* Sub-tool (MyExpander) background */
#ExpanderBox2 {
#ExpanderBox2 > box {
background-color: #3B3B3B;
border: 1px solid #2A2A2A;
border-radius: 4px;
margin: 2px;
margin: 0;
padding: 3px;
}
@ -291,8 +301,8 @@ menuitem {
background-color: #414141;
border: 1px solid #373737;
border-radius: 4px;
margin: 2px;
padding: 2px;
margin: 3px;
padding: 3px;
}
#ExpanderBox2 frame drawingarea {
@ -303,26 +313,28 @@ menuitem {
background-color: #474747;
border: 1px solid #3D3D3D;
border-radius: 4px;
margin: 2px;
padding: 2px;
margin: 3px;
padding: 3px;
}
#ExpanderBox2 frame frame drawingarea {
background-color: #474747;
}
#MyExpanderTitle {
margin: 2px;
padding: 3px 1px 3px 1px;
font-size: 120%;
#MyExpanderTitle > box {
margin: 2px 0 2px 0;
padding: 2px;
}
#MyExpanderTitle label {
color: #CCCCCC;
padding: 0;
margin: 0 3px 0 3px;
}
#MyExpanderTitle:hover {
background-color: #202020;
}
#MyExpanderTitle GtkEventBox:hover image {
#MyExpanderTitle eventbox:hover image {
background-color: #202020;
border-radius: 3px;
}
@ -335,75 +347,69 @@ menuitem {
}
/* Editor tab button */
#MainNotebook > grid label, #MainNotebook > grid image {
#MainNotebook grid label, #MainNotebook grid image {
/* OK */
padding: 1px;
}
/* File Browser right side tabs - Toolbox, Inspector, Fast Export, Filter */
notebook tabs {
notebook {
padding: 0;
margin: 0;
border-style: none;
}
notebook header {
box-shadow: none;
background-color: #383838;
border-width: 1px;
border-style: none;
border-color: #262626;
border-radius: 0;
padding: 3px;
padding: 2px;
margin: 0;
}
notebook tabs:hover {
notebook tabs {
padding: 1px;
margin: 0;
}
notebook tab {
padding: 1px;
margin: 2px;
min-height: 15px;
min-width: 15px;
}
notebook tab:hover {
background-color: #505050;
}
notebook tabs:active {
notebook tab:active {
padding: 3px;
border-width: 5px;
border-color: #989898;
}
/* Get rid of shitty notebook header shadow */
notebook header.top tabs {
border-bottom-style: solid;
padding-bottom: 8px;
}
notebook header.right tabs {
border-left-style: solid;
padding-left: 8px;
}
notebook header.bottom tabs {
border-top-style: solid;
padding-top: 8px;
}
notebook header.left tabs {
border-right-style: solid;
padding-right: 8px;
}
/* Get rid of notebook frame border - too many borders */
notebook header.top, notebook header.right, notebook header.bottom, notebook header.left {
box-shadow: none;
border-width: 1px;
border-color: #262626;
border-style: none;
border-radius: 0;
background-color: #383838;
padding: 0;
}
/* Get rid of notebook header border - too many borders */
notebook header.top {
/* OK */
border-bottom-style: solid;
padding-bottom: 3px;
}
notebook header.right {
/* OK */
border-left-style: solid;
padding-left: 3px;
}
notebook header.bottom {
/* OK */
border-top-style: solid;
padding-top: 3px;
}
notebook header.left {
/* OK */
border-right-style: solid;
padding-right: 3px;
}
notebook.frame {
/* OK */
border-radius: 0;
@ -411,47 +417,79 @@ notebook.frame {
}
/* Pad notebooks, makes the other borders look nicer */
notebook {
notebook stack {
/* OK */
background-color: #484848;
padding: 0;
margin: 0;
}
paned box {
padding: 0;
margin: 0;
border-style: none;
}
#MainNotebook.header {
paned > separator {
margin: 0;
padding: 0;
}
#MainNotebook header {
/* OK */
background-color: #2A2A2A;
}
#MainNotebook > tabs {
#MainNotebook tabs {
/* OK */
background-color: #2A2A2A;
}
#MainNotebook > tabs:hover {
#MainNotebook tab:hover {
/* OK */
background-color: #505050;
}
#MainNotebook > tabs:active {
#MainNotebook tab:active {
/* OK */
border-color: #989898;
}
#RightNotebook.header {
#RightNotebook header {
/* OK */
background-color: #2A2A2A;
background-color: #393939;
}
#RightNotebook > tabs {
#RightNotebook tabs {
/* OK */
background-color: #2A2A2A;
background-color: #393939;
padding-bottom: 5px;
}
#RightNotebook > tabs:hover {
#RightNotebook tab:hover {
/* OK */
background-color: #505050;
}
#RightNotebook > tabs:active {
#RightNotebook tab:active {
/* OK */
border-color: #989898;
border-color: #A5A5A5;
}
#LabelRightNotebook {
padding: 5px;
margin: 2px;
}
#ToolPanelNotebook header {
background-color: #383838;
border-color: #262626;
padding: 0;
margin: 0;
}
#ToolPanelNotebook header tabs {
background-color: #383838;
}
#ToolPanelNotebook header tab {
padding: 3px;
margin: 0;
}
/* All tool panels have a frame except for Meta which unlike the rest is a notebook itself.
* So we use CSS to make it look like a frame. */
@ -464,7 +502,7 @@ notebook {
border-top-width: 0;
}
#MetaPanelNotebook.header {
#MetaPanelNotebook header {
border: 1px solid #262626;
border-bottom-left-radius: 0;
border-bottom-right-radius: 0;

View File

@ -506,12 +506,6 @@ bool ExpanderBox::on_draw(const ::Cairo::RefPtr< Cairo::Context> &cr) {
ExpanderBox::ExpanderBox( Gtk::Container *p): pC(p)
{
set_name ("ExpanderBox");
updateStyle();
}
void ExpanderBox::on_style_updated ()
{
updateStyle();
}
void ExpanderBox::setLevel(int level)
@ -525,11 +519,6 @@ void ExpanderBox::setLevel(int level)
}
}
void ExpanderBox::updateStyle()
{
set_border_width(2);
}
void ExpanderBox::show_all()
{
// ask childs to show themselves, but not us (remain unchanged)
@ -597,7 +586,6 @@ MyExpander::MyExpander(bool useEnabled, Gtk::Widget* titleWidget) :
pack_start(*titleEvBox, Gtk::PACK_EXPAND_WIDGET, 0);
updateStyle();
titleEvBox->signal_button_release_event().connect( sigc::mem_fun(this, & MyExpander::on_toggle) );
titleEvBox->signal_enter_notify_event().connect( sigc::mem_fun(this, & MyExpander::on_enter_leave_title), false);
titleEvBox->signal_leave_notify_event().connect( sigc::mem_fun(this, & MyExpander::on_enter_leave_title), false);
@ -653,7 +641,6 @@ MyExpander::MyExpander(bool useEnabled, Glib::ustring titleLabel) :
pack_start(*titleEvBox, Gtk::PACK_EXPAND_WIDGET, 0);
updateStyle();
titleEvBox->signal_button_release_event().connect( sigc::mem_fun(this, & MyExpander::on_toggle));
titleEvBox->signal_enter_notify_event().connect( sigc::mem_fun(this, & MyExpander::on_enter_leave_title), false);
titleEvBox->signal_leave_notify_event().connect( sigc::mem_fun(this, & MyExpander::on_enter_leave_title), false);
@ -689,18 +676,6 @@ bool MyExpander::on_enter_leave_enable (GdkEventCrossing* event)
return true;
}
void MyExpander::updateStyle()
{
headerHBox->set_spacing(2);
headerHBox->set_border_width(1);
set_spacing(0);
set_border_width(0);
if (expBox) {
expBox->updateStyle();
}
}
void MyExpander::setLevel (int level)
{
if (expBox) {

View File

@ -123,7 +123,6 @@ public:
}
void setLevel(int level);
void updateStyle();
void show() {}
void show_all();
@ -133,7 +132,6 @@ public:
void showBox();
void hideBox();
void on_style_updated ();
// bool on_draw(const ::Cairo::RefPtr< Cairo::Context> &cr);
};
@ -172,16 +170,6 @@ private:
bool on_enter_leave_title (GdkEventCrossing* event);
/// Used to handle the colored background for the Enable button
bool on_enter_leave_enable (GdkEventCrossing* event);
// The part below can probably be removed from here and the CSS file.
/// Update the style of this widget, depending in the "slim" option
void updateStyle();
void on_style_updated ()
{
updateStyle();
}
protected:
Gtk::Container* child; /// Gtk::Contained to display below the expander's title

View File

@ -84,8 +84,7 @@ int InspectorBuffer::infoFromImage (const Glib::ustring& fname)
Inspector::Inspector () : currImage(NULL), zoom(0.0), active(false)
{
Glib::RefPtr<Gtk::StyleContext> style = get_style_context();
style->add_class(GTK_STYLE_CLASS_BACKGROUND);
style->add_class(GTK_STYLE_CLASS_FLAT);
set_name("Inspector");
}
Inspector::~Inspector()

View File

@ -45,11 +45,6 @@ void LockableColorPicker::updateBackBuffer ()
if (validity == Validity::INSIDE) {
Gtk::DrawingArea *iArea = cropWindow->getImageArea();
Glib::RefPtr<Pango::Context> pangoContext = iArea->get_pango_context ();
Pango::FontDescription fontd(options.colorPickerFont);
fontd.set_weight(Pango::WEIGHT_NORMAL);
pangoContext->set_font_description (fontd);
Glib::RefPtr<Pango::Layout> layout[3][2];
Glib::ustring s1, s2, s3;
PointerMotionListener* navigator = cropWindow->getPointerMotionListener ();

View File

@ -326,23 +326,6 @@ int main(int argc, char **argv)
} catch (...) {
printf("Error: Can't load css file \"%s\"\n", filename.c_str());
}
// Set the font face and size
if (options.font != "default") {
try {
cssForced = Gtk::CssProvider::create();
// Reformatting the font parameter
Glib::ustring font = Options::formatFontName(options.font);
cssForced->load_from_data (Glib::ustring::compose("* { %1 }", font));
Gtk::StyleContext::add_provider_for_screen(screen, cssForced, GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
} catch (Glib::Error &err) {
printf("Error: \"%s\"\n", err.what().c_str());
} catch (...) {
printf("Error: Can't find the font named \"%s\"\n", options.font.c_str());
}
}
}
#ifndef NDEBUG

View File

@ -291,8 +291,6 @@ Glib::ustring Options::findProfilePath (Glib::ustring &profName)
void Options::setDefaults ()
{
font = "sans 8";
colorPickerFont = "sans 8";
windowWidth = 1200;
windowHeight = 680;
windowX = 0;
@ -1240,14 +1238,6 @@ int Options::readFromFile (Glib::ustring fname)
}
if (keyFile.has_group ("GUI")) {
if (keyFile.has_key ("GUI", "Font")) {
font = keyFile.get_string ("GUI", "Font");
}
if (keyFile.has_key ("GUI", "ColorPickerFont")) {
colorPickerFont = keyFile.get_string ("GUI", "ColorPickerFont");
}
if (keyFile.has_key ("GUI", "WindowWidth")) {
windowWidth = keyFile.get_integer ("GUI", "WindowWidth");
}
@ -1981,8 +1971,6 @@ int Options::saveToFile (Glib::ustring fname)
keyFile.set_string ("Profiles", "CustomProfileBuilderPath", CPBPath);
keyFile.set_integer ("Profiles", "CustomProfileBuilderKeys", CPBKeys);
keyFile.set_string ("GUI", "Font", font);
keyFile.set_string ("GUI", "ColorPickerFont", colorPickerFont);
keyFile.set_integer ("GUI", "WindowWidth", windowWidth);
keyFile.set_integer ("GUI", "WindowHeight", windowHeight);
keyFile.set_integer ("GUI", "WindowX", windowX);
@ -2337,29 +2325,6 @@ void Options::save ()
}
}
Glib::ustring Options::formatFontName (Glib::ustring font)
{
if (font.empty()) {
return "";
}
// Reformatting the font parameter
Glib::ustring sFont;
Pango::FontDescription fd(font);
sFont = "font-family: \"" + fd.get_family() + "\";";
if (fd.get_size()) {
sFont += "font-size: " + Glib::ustring::compose("%1pt", 8 /*fd.get_size()*/); // + (fd.get_size_is_absolute() ? "px;" : "pt;");
}
if (fd.get_style() == Pango::STYLE_ITALIC) {
sFont += "font-style: italic;";
}
if (fd.get_weight() > Pango::WEIGHT_NORMAL) {
sFont += "font-weight: bold;";
}
return sFont;
}
/*
* return true if fname ends with one of the retained image file extensions
*/

View File

@ -309,7 +309,6 @@ public:
int saveToFile (Glib::ustring fname);
static bool load ();
static void save ();
static Glib::ustring formatFontName (Glib::ustring font);
// if multiUser=false, send back the global profile path
Glib::ustring getPreferredProfilePath();

View File

@ -724,7 +724,6 @@ Gtk::Widget* Preferences::getColorManagementPanel ()
autoMonProfileToggled();
#endif
Gtk::VBox* vbdp = Gtk::manage (new Gtk::VBox ());
Gtk::Label* viewlab = Gtk::manage (new Gtk::Label (M("PREFERENCES_VIEW") + ":", Gtk::ALIGN_START));
view = Gtk::manage (new Gtk::ComboBoxText ());
@ -912,20 +911,10 @@ Gtk::Widget* Preferences::getGeneralPanel ()
Gtk::Label* fontlab = Gtk::manage( new Gtk::Label (M("PREFERENCES_SELECTFONT") + ":") );
setExpandAlignProperties(fontlab, false, false, Gtk::ALIGN_START, Gtk::ALIGN_BASELINE);
fontbutton = Gtk::manage( new Gtk::FontButton ());
setExpandAlignProperties(fontbutton, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_BASELINE);
fontbutton->set_use_size(true);
fontbutton->set_font_name(options.font);
themeGrid->attach_next_to(*themelab, *chUseSystemTheme, Gtk::POS_BOTTOM, 1, 1);
themeGrid->attach_next_to(*theme, *themelab, Gtk::POS_RIGHT, 1, 1);
themeGrid->attach_next_to(*fontlab, *theme, Gtk::POS_RIGHT, 1, 1);
themeGrid->attach_next_to(*fontbutton, *fontlab, Gtk::POS_RIGHT, 1, 1);
Gtk::Label* cpfontlab = Gtk::manage( new Gtk::Label (M("PREFERENCES_SELECTFONT_COLPICKER") + ":") );
colorPickerFontButton = Gtk::manage( new Gtk::FontButton ());
colorPickerFontButton->set_use_size(true);
colorPickerFontButton->set_font_name(options.colorPickerFont);
Gtk::Grid* cropcolorGrid = Gtk::manage( new Gtk::Grid () );
cropcolorGrid->set_column_spacing(4);
@ -1081,7 +1070,6 @@ Gtk::Widget* Preferences::getGeneralPanel ()
langAutoDetectConn = ckbLangAutoDetect->signal_toggled().connect (sigc::mem_fun(*this, &Preferences::langAutoDetectToggled));
tconn = theme->signal_changed().connect( sigc::mem_fun(*this, &Preferences::themeChanged) );
fconn = fontbutton->signal_font_set().connect( sigc::mem_fun(*this, &Preferences::fontChanged) );
usethcon = chUseSystemTheme->signal_clicked ().connect( sigc::mem_fun(*this, &Preferences::useThemeChanged) );
return mvbsd;
@ -1419,8 +1407,6 @@ void Preferences::storePreferences ()
moptions.navGuideBrush[2] = NavGuideCol.get_blue();
moptions.navGuideBrush[3] = butNavGuideCol->get_alpha() / 65535.0;
moptions.font = fontbutton->get_font_name();
moptions.colorPickerFont = colorPickerFontButton->get_font_name();
#ifdef WIN32
moptions.gimpDir = gimpDir->get_filename ();
moptions.psDir = psDir->get_filename ();
@ -1636,8 +1622,6 @@ void Preferences::fillPreferences ()
butNavGuideCol->set_rgba(NavGuideCol);
butNavGuideCol->set_alpha ( (unsigned short)(moptions.navGuideBrush[3] * 65535.0));
fontbutton->set_font_name(moptions.font);
colorPickerFontButton->set_font_name(moptions.colorPickerFont);
showDateTime->set_active (moptions.fbShowDateTime);
showBasicExif->set_active (moptions.fbShowBasicExif);
showExpComp->set_active (moptions.fbShowExpComp);
@ -1830,11 +1814,6 @@ void Preferences::cancelPressed ()
switchThemeTo(options.theme);
}
// set the initial font back
if (fontbutton->get_font_name() != options.font) {
switchFontTo(options.font);
}
// update the profileStore
if (useBundledProfiles->get_active () != options.useBundledProfiles) {
// we have to rescan with the old value;
@ -2005,12 +1984,6 @@ void Preferences::restoreValue()
storedValueImg = "";
}
void Preferences::fontChanged ()
{
switchFontTo(fontbutton->get_font_name());
}
void Preferences::switchThemeTo(Glib::ustring newTheme)
{
@ -2076,34 +2049,13 @@ void Preferences::workflowUpdate ()
}
void Preferences::switchFontTo(Glib::ustring newFont)
{
if (newFont != "default") {
if (!cssForced) {
cssForced = Gtk::CssProvider::create();
}
try {
newFont = Options::formatFontName(newFont);
cssForced->load_from_data (Glib::ustring::compose("* { %1 }", newFont));
} catch (Glib::Error &err) {
printf("Error: \"%s\"\n", err.what().c_str());
} catch (...) {
printf("Error: Can't find the font named \"%s\"\n", newFont.c_str());
}
}
}
void Preferences::useThemeChanged()
{
if(!chUseSystemTheme->get_active()) {
theme->set_sensitive(true);
fontbutton->set_sensitive(true);
} else {
theme->set_sensitive(false);
fontbutton->set_sensitive(false);
}
}

View File

@ -129,8 +129,6 @@ protected:
Gtk::ComboBoxText* theme;
Gtk::CheckButton* chUseSystemTheme;
Gtk::FontButton* fontbutton;
Gtk::FontButton* colorPickerFontButton;
Gtk::ColorButton* butCropCol;
Gtk::ColorButton* butNavGuideCol;
@ -193,7 +191,7 @@ protected:
Glib::ustring storedValueImg;
Options moptions;
sigc::connection tconn, sconn, fconn, usethcon, addc, setc, dfconn, ffconn, bpconn, rpconn, ipconn;
sigc::connection tconn, sconn, usethcon, addc, setc, dfconn, ffconn, bpconn, rpconn, ipconn;
sigc::connection autoMonProfileConn, sndEnableConn, langAutoDetectConn, autocielabConn;
Glib::ustring initialTheme;
Glib::ustring initialFont;
@ -206,14 +204,12 @@ protected:
void workflowUpdate();
void themeChanged ();
void useThemeChanged();
void fontChanged ();
void forRAWComboChanged ();
void forImageComboChanged ();
void layoutComboChanged ();
void bundledProfilesChanged ();
void iccDirChanged ();
void switchThemeTo (Glib::ustring newTheme);
void switchFontTo (Glib::ustring newFont);
bool splashClosed(GdkEventAny* event);
void appendBehavList (Gtk::TreeModel::iterator& parent, Glib::ustring label, int id, bool set);

View File

@ -741,8 +741,7 @@ void ThumbBrowserBase::on_style_updated ()
ThumbBrowserBase::Internal::Internal () : ofsX(0), ofsY(0), parent(NULL), dirty(true)
{
Glib::RefPtr<Gtk::StyleContext> style = get_style_context();
style->add_class(GTK_STYLE_CLASS_BACKGROUND);
style->add_class(GTK_STYLE_CLASS_FLAT);
set_name("Thumbnail");
}
void ThumbBrowserBase::Internal::setParent (ThumbBrowserBase* p)

View File

@ -23,37 +23,9 @@
using namespace rtengine::procparams;
ToolVBox::ToolVBox()
{
updateStyle();
}
ToolVBox::ToolVBox() {}
void ToolVBox::updateStyle()
{
set_spacing(1); // Vertical space between tools
set_border_width(3); // Space separating the tab's frame and the tools
}
void ToolVBox::on_style_updated ()
{
updateStyle();
}
ToolParamBlock::ToolParamBlock()
{
updateStyle();
}
void ToolParamBlock::updateStyle()
{
set_spacing(2); // Vertical space between parameters in a single tool
set_border_width(5); // Space separating the parameters of a tool and its surrounding frame
}
void ToolParamBlock::on_style_updated ()
{
updateStyle();
}
ToolParamBlock::ToolParamBlock() {}
FoldableToolPanel::FoldableToolPanel(Gtk::Box* content, Glib::ustring toolName, Glib::ustring UILabel, bool need11, bool useEnabled) : ToolPanel(toolName, need11), parentContainer(NULL), exp(NULL), lastEnabled(true)
{

View File

@ -43,23 +43,15 @@ public:
/// @brief This class control the space around the group of tools inside a tab, as well as the space separating each tool. */
class ToolVBox : public Gtk::VBox
{
private:
void updateStyle();
public:
ToolVBox();
void on_style_updated ();
};
/// @brief This class control the space around a tool's block of parameter. */
class ToolParamBlock : public Gtk::VBox
{
private:
void updateStyle();
public:
ToolParamBlock();
void on_style_updated ();
};
class ToolPanel