summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-10-05 18:12:45 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-10-05 18:12:45 +0000
commitb23b8edce7cbd48165084dbd852875afeb800735 (patch)
tree6fce139d187944d762e804b4e868e8a40284a121 /common
parent70f7d26b3b2a811ad0000cc3a26e21142d34e39f (diff)
downloadtde-style-qtcurve-b23b8edce7cbd48165084dbd852875afeb800735.tar.gz
tde-style-qtcurve-b23b8edce7cbd48165084dbd852875afeb800735.zip
Update qtcurve to latest upstream version
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kde-style-qtcurve@1182805 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'common')
-rw-r--r--common/colorutils.c305
-rw-r--r--common/common.h1726
-rw-r--r--common/config_file.c2750
-rw-r--r--common/dot.pngbin0 -> 130 bytes
-rw-r--r--common/radio_inner.pngbin0 -> 276 bytes
-rw-r--r--common/radio_on.pngbin231 -> 221 bytes
-rw-r--r--common/radio_on_small.pngbin0 -> 258 bytes
7 files changed, 4150 insertions, 631 deletions
diff --git a/common/colorutils.c b/common/colorutils.c
new file mode 100644
index 0000000..05aaaea
--- /dev/null
+++ b/common/colorutils.c
@@ -0,0 +1,305 @@
+/*
+ This file is taken from kcolorspaces.cpp and kcolorutils.cpp from kdelibs
+The code has been modified to work with QColor (Qt3 &Qt4) and GdkColor
+*/
+
+/* This file is part of the KDE project
+ * Copyright (C) 2007 Matthew Woehlke <mw_triad@users.sourceforge.net>
+ * Copyright (C) 2007 Olaf Schmidt <ojschmidt@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <math.h>
+
+#ifdef __cplusplus
+#if defined QT_VERSION && (QT_VERSION >= 0x040000)
+#define FLOAT_COLOR(VAL, COL) (VAL).COL##F()
+#define TO_COLOR(R, G, B) QColor::fromRgbF(R, G, B)
+#else
+#define FLOAT_COLOR(VAL, COL) ((double)(((VAL).COL()*1.0)/255.0))
+#define TO_COLOR(R, G, B) QColor(limit(R*255.0), limit(G*255.0), limit(B*255.0))
+#endif
+#else
+#define inline
+#define FLOAT_COLOR(VAL, COL) ((double)(((VAL).COL*1.0)/65535.0))
+static GdkColor qtcGdkColor(double r, double g, double b)
+{
+ GdkColor col;
+
+ col.red=limit(r*65535);
+ col.green=limit(g*65535);
+ col.blue=limit(b*65535);
+
+ return col;
+}
+
+#define TO_COLOR(R, G, B) qtcGdkColor(R, G, B)
+#endif
+
+static inline double ColorUtils_normalize(double a)
+{
+ return (a < 1.0 ? (a > 0.0 ? a : 0.0) : 1.0);
+}
+
+static inline double ColorUtils_wrap(double a)
+{
+ static double d = 1.0;
+ double r = fmod(a, d);
+ return (r < 0.0 ? d + r : (r > 0.0 ? r : 0.0));
+}
+
+#define HCY_REC 709 // use 709 for now
+#if HCY_REC == 601
+static const double yc[3] = { 0.299, 0.587, 0.114 };
+#elif HCY_REC == 709
+static const double yc[3] = {0.2126, 0.7152, 0.0722};
+#else // use Qt values
+static const double yc[3] = { 0.34375, 0.5, 0.15625 };
+#endif
+
+static inline double ColorUtils_HCY_gamma(double n)
+{
+ return pow(ColorUtils_normalize(n), 2.2);
+}
+
+static inline double ColorUtils_HCY_igamma(double n)
+{
+ return pow(ColorUtils_normalize(n), 1.0/2.2);
+}
+
+static inline double ColorUtils_HCY_lumag(double r, double g, double b)
+{
+ return r*yc[0] + g*yc[1] + b*yc[2];
+}
+
+typedef struct
+{
+ double h, c, y;
+} ColorUtils_HCY;
+
+// static ColorUtils_HCY ColorUtils_HCY_fromValues(double h_, double c_, double y_/*, double a_*/)
+// {
+// h = h_;
+// c = c_;
+// y = y_;
+// // a = a_;
+// }
+
+static ColorUtils_HCY ColorUtils_HCY_fromColor(const color *color)
+{
+ ColorUtils_HCY hcy;
+ double r = ColorUtils_HCY_gamma(FLOAT_COLOR(*color, red));
+ double g = ColorUtils_HCY_gamma(FLOAT_COLOR(*color, green));
+ double b = ColorUtils_HCY_gamma(FLOAT_COLOR(*color, blue));
+// a = color.alphaF();
+
+ // luma component
+ hcy.y = ColorUtils_HCY_lumag(r, g, b);
+
+ // hue component
+ double p = MAX(MAX(r, g), b);
+ double n = MIN(MIN(r, g), b);
+ double d = 6.0 * (p - n);
+ if (n == p)
+ hcy.h = 0.0;
+ else if (r == p)
+ hcy.h = ((g - b) / d);
+ else if (g == p)
+ hcy.h = ((b - r) / d) + (1.0 / 3.0);
+ else
+ hcy.h = ((r - g) / d) + (2.0 / 3.0);
+
+ // chroma component
+ if (0.0 == hcy.y || 1.0 == hcy.y)
+ hcy.c = 0.0;
+ else
+ hcy.c = MAX( (hcy.y - n) / hcy.y, (p - hcy.y) / (1 - hcy.y) );
+ return hcy;
+}
+
+static color ColorUtils_HCY_toColor(ColorUtils_HCY *hcy)
+{
+ // start with sane component values
+ double _h = ColorUtils_wrap(hcy->h);
+ double _c = ColorUtils_normalize(hcy->c);
+ double _y = ColorUtils_normalize(hcy->y);
+
+ // calculate some needed variables
+ double _hs = _h * 6.0, th, tm;
+ if (_hs < 1.0) {
+ th = _hs;
+ tm = yc[0] + yc[1] * th;
+ }
+ else if (_hs < 2.0) {
+ th = 2.0 - _hs;
+ tm = yc[1] + yc[0] * th;
+ }
+ else if (_hs < 3.0) {
+ th = _hs - 2.0;
+ tm = yc[1] + yc[2] * th;
+ }
+ else if (_hs < 4.0) {
+ th = 4.0 - _hs;
+ tm = yc[2] + yc[1] * th;
+ }
+ else if (_hs < 5.0) {
+ th = _hs - 4.0;
+ tm = yc[2] + yc[0] * th;
+ }
+ else {
+ th = 6.0 - _hs;
+ tm = yc[0] + yc[2] * th;
+ }
+
+ // calculate RGB channels in sorted order
+ double tn, to, tp;
+ if (tm >= _y) {
+ tp = _y + _y * _c * (1.0 - tm) / tm;
+ to = _y + _y * _c * (th - tm) / tm;
+ tn = _y - (_y * _c);
+ }
+ else {
+ tp = _y + (1.0 - _y) * _c;
+ to = _y + (1.0 - _y) * _c * (th - tm) / (1.0 - tm);
+ tn = _y - (1.0 - _y) * _c * tm / (1.0 - tm);
+ }
+
+ // return RGB channels in appropriate order
+ if (_hs < 1.0)
+ return TO_COLOR(ColorUtils_HCY_igamma(tp), ColorUtils_HCY_igamma(to), ColorUtils_HCY_igamma(tn));
+ else if (_hs < 2.0)
+ return TO_COLOR(ColorUtils_HCY_igamma(to), ColorUtils_HCY_igamma(tp), ColorUtils_HCY_igamma(tn));
+ else if (_hs < 3.0)
+ return TO_COLOR(ColorUtils_HCY_igamma(tn), ColorUtils_HCY_igamma(tp), ColorUtils_HCY_igamma(to));
+ else if (_hs < 4.0)
+ return TO_COLOR(ColorUtils_HCY_igamma(tn), ColorUtils_HCY_igamma(to), ColorUtils_HCY_igamma(tp));
+ else if (_hs < 5.0)
+ return TO_COLOR(ColorUtils_HCY_igamma(to), ColorUtils_HCY_igamma(tn), ColorUtils_HCY_igamma(tp));
+ else
+ return TO_COLOR(ColorUtils_HCY_igamma(tp), ColorUtils_HCY_igamma(tn), ColorUtils_HCY_igamma(to));
+}
+
+// #ifndef __cplusplus
+static inline double ColorUtils_HCY_luma(const color *color)
+{
+ return ColorUtils_HCY_lumag(ColorUtils_HCY_gamma(FLOAT_COLOR(*color, red)),
+ ColorUtils_HCY_gamma(FLOAT_COLOR(*color, green)),
+ ColorUtils_HCY_gamma(FLOAT_COLOR(*color, blue)));
+}
+
+static inline double ColorUtils_mixQreal(double a, double b, double bias)
+{
+ return a + (b - a) * bias;
+}
+
+static inline double ColorUtils_luma(const color *color)
+{
+ return ColorUtils_HCY_luma(color);
+}
+
+static double ColorUtils_contrastRatio(const color *c1, const color *c2)
+{
+ double y1 = ColorUtils_luma(c1), y2 = ColorUtils_luma(c2);
+ if (y1 > y2)
+ return (y1 + 0.05) / (y2 + 0.05);
+ else
+ return (y2 + 0.05) / (y1 + 0.05);
+}
+
+static color ColorUtils_lighten(const color *color, double ky, double kc)
+{
+ ColorUtils_HCY c=ColorUtils_HCY_fromColor(color);
+
+ c.y = 1.0 - ColorUtils_normalize((1.0 - c.y) * (1.0 - ky));
+ c.c = 1.0 - ColorUtils_normalize((1.0 - c.c) * kc);
+ return ColorUtils_HCY_toColor(&c);
+}
+
+static color ColorUtils_darken(const color *color, double ky, double kc)
+{
+ ColorUtils_HCY c=ColorUtils_HCY_fromColor(color);
+ c.y = ColorUtils_normalize(c.y * (1.0 - ky));
+ c.c = ColorUtils_normalize(c.c * kc);
+ return ColorUtils_HCY_toColor(&c);
+}
+
+static color ColorUtils_shade(const color *color, double ky, double kc)
+{
+ ColorUtils_HCY c=ColorUtils_HCY_fromColor(color);
+ c.y = ColorUtils_normalize(c.y + ky);
+ c.c = ColorUtils_normalize(c.c + kc);
+ return ColorUtils_HCY_toColor(&c);
+}
+
+static color ColorUtils_mix(const color *c1, const color *c2, double bias);
+
+static color ColorUtils_tintHelper(const color *base, const color *col, double amount)
+{
+ color mixed=ColorUtils_mix(base, col, pow(amount, 0.3));
+ ColorUtils_HCY c=ColorUtils_HCY_fromColor(&mixed);
+ c.y = ColorUtils_mixQreal(ColorUtils_luma(base), c.y, amount);
+
+ return ColorUtils_HCY_toColor(&c);
+}
+
+static color ColorUtils_tint(const color *base, const color *col, double amount)
+{
+ if (amount <= 0.0) return *base;
+ if (amount >= 1.0) return *col;
+ if (isnan(amount)) return *base;
+
+ double ri = ColorUtils_contrastRatio(base, col);
+ double rg = 1.0 + ((ri + 1.0) * amount * amount * amount);
+ double u = 1.0, l = 0.0;
+ color result;
+ int i;
+ for (i = 12 ; i ; --i) {
+ double a = 0.5 * (l+u);
+ result = ColorUtils_tintHelper(base, col, a);
+ double ra = ColorUtils_contrastRatio(base, &result);
+ if (ra > rg)
+ u = a;
+ else
+ l = a;
+ }
+ return result;
+}
+
+static color ColorUtils_mix(const color *c1, const color *c2, double bias)
+{
+ if (bias <= 0.0) return *c1;
+ if (bias >= 1.0) return *c2;
+ if (isnan(bias)) return *c1;
+
+ {
+ double r = ColorUtils_mixQreal(FLOAT_COLOR(*c1, red), FLOAT_COLOR(*c2, red), bias);
+ double g = ColorUtils_mixQreal(FLOAT_COLOR(*c1, green), FLOAT_COLOR(*c2, green), bias);
+ double b = ColorUtils_mixQreal(FLOAT_COLOR(*c1, blue), FLOAT_COLOR(*c2, blue), bias);
+ /*double a = ColorUtils_mixQreal(FLOAT_COLOR(*c1, alpha), FLOAT_COLOR(*c2, alpha), bias);*/
+
+ return TO_COLOR(r, g, b);
+ }
+}
+
+// #endif
+/* Added!!! */
+// static color ColorUtils_shade_qtc(const color *color, double k)
+// {
+// ColorUtils_HCY c=ColorUtils_HCY_fromColor(color);
+// c.y = ColorUtils_normalize(c.y * (k>1.0 ? (k*1.1) : (k<1.0 ? (k*0.9) : k)));
+// return ColorUtils_HCY_toColor(&c);
+// }
diff --git a/common/common.h b/common/common.h
index 21f6bae..c64872b 100644
--- a/common/common.h
+++ b/common/common.h
@@ -2,7 +2,7 @@
#define __COMMON_H__
/*
- QtCurve (C) Craig Drummond, 2003 - 2007 Craig.Drummond@lycos.co.uk
+ QtCurve (C) Craig Drummond, 2003 - 2010 craig.p.drummond@gmail.com
----
@@ -25,17 +25,29 @@
between Qt and Gtk, but not polute the namespace with exported functions... */
#include <string.h>
+#include <stdarg.h>
#include <math.h>
#include "config.h"
-/*
- The following #define disables the rounding when scrollbar type==none.
-#define QTC_SIMPLE_SCROLLBARS
-*/
+#if defined _WIN32 && defined QT_VERSION && (QT_VERSION >= 0x040000)
+#include <sys/stat.h>
+#include <float.h>
+#include <direct.h>
+
+static int isnan(double x)
+{
+ return _isnan(x);
+}
+
+static int lstat(const char* fileName, struct stat* s)
+{
+ return stat(fileName, s);
+}
+#endif
/*
- The following #define disables the custom focus rectangle
-#define QTC_PLAIN_FOCUS_ONLY
+ The following #define disables the rounding when scrollbar type==none.
+#define SIMPLE_SCROLLBARS
*/
/*
@@ -43,64 +55,62 @@
the scrollbar buttons when at min/max. This removes the thick looking line
between the slider and the buttons.
*/
-#define QTC_INCREASE_SB_SLIDER
-
-/*
- Enable this to do focus highlighting for scrollviews... NOTE: Gtk2 currently does not do this.
-#define QTC_HIGHLIGHT_SCROLVIEWS
-*/
-
-/*
- Control shading used for glass variants.
- 0 => As used in 0.51.1 +
- 1 => As used in 0.51
- 2 => As used in <0.51
-*/
-#define QTC_GLASS_SHADING 0
+#define INCREASE_SB_SLIDER
typedef enum
{
SHADING_SIMPLE=0,
SHADING_HSL=1,
- SHADING_HSV=2
+ SHADING_HSV=2,
+ SHADING_HCY=3
} EShading;
-#if (!defined QTC_CONFIG_DIALOG) && (!defined QTC_KWIN)
-static EShading shading=SHADING_HSL;
-#endif
-
#ifdef __cplusplus
#include <qconfig.h>
-#ifdef QTC_CONFIG_DIALOG
+#ifdef CONFIG_DIALOG
#include <qapplication.h>
#endif
+#include <map>
+#include <set>
+#if !defined CONFIG_DIALOG && defined QT_VERSION && (QT_VERSION >= 0x040000)
+#include <QtCore/QString>
+#endif
#else
#include <glib.h>
#endif
#ifdef __cplusplus
+#include <qpixmap.h>
typedef QColor color;
+
+#if defined QT_VERSION && (QT_VERSION >= 0x040000)
+#include <QtCore/QSet>
+typedef QSet<QString> Strings;
+#else
+typedef QStringList Strings;
+#endif
+
#else
typedef gboolean bool;
typedef GdkColor color;
+typedef gchar ** Strings;
#define true TRUE
#define false FALSE
#endif
-#define QTC_GROUP "Settings"
-/*#define QTC_DESCR_GROUP "Description"*/
+#define SETTINGS_GROUP "Settings"
+#define KWIN_GROUP "KWin"
+/*#define DESCR_GROUP "Description"*/
/* qtc_<theme name>.themerc support */
#define KDE_PREFIX(V) ((4==(V)) ? KDE4PREFIX : KDE3PREFIX)
-#define QTC_THEME_DIR "/share/apps/kstyle/themes/"
-#define QTC_THEME_PREFIX "qtc_"
-#define QTC_THEME_SUFFIX ".themerc"
-
+#define THEME_DIR "/share/apps/kstyle/themes/"
+#define THEME_DIR4 "/share/kde4/apps/kstyle/themes/"
+#define THEME_PREFIX "qtc_"
+#define THEME_SUFFIX ".themerc"
+#define BORDER_SIZE_FILE "windowBorderSizes"
-#define QTC_CHECK_SIZE 13
-#define QTC_RADIO_SIZE 13
-#define QTC_MIN_BTN_SIZE 8
-#define QTC_LV_SIZE 7
+#define LV_SIZE 7
#define LARGE_ARR_WIDTH 7
#define LARGE_ARR_HEIGHT 4
@@ -110,6 +120,13 @@ typedef GdkColor color;
#define NUM_STD_SHADES 6
#define NUM_EXTRA_SHADES 3
+enum
+{
+ ALPHA_ETCH_LIGHT = 0,
+ ALPHA_ETCH_DARK,
+ NUM_STD_ALPHAS
+};
+
#define TOTAL_SHADES NUM_STD_SHADES+NUM_EXTRA_SHADES
#define ORIGINAL_SHADE TOTAL_SHADES
@@ -118,7 +135,7 @@ typedef GdkColor color;
#define SHADE_2_HIGHLIGHT NUM_STD_SHADES+2
/* 3d effect - i.e. buttons, etc */
-#define QTC_SHADES \
+#define SHADES \
static const double shades[2][11][NUM_STD_SHADES]=\
{ \
{ /* HSV & HSL */ \
@@ -149,88 +166,70 @@ typedef GdkColor color;
} \
} ;
-#define QTC_SIMPLE_SHADING (!shading)
-
-#define QT_STD_BORDER 5
-#define QT_DISABLED_BORDER QT_STD_BORDER /*3*/
-#define QT_BORDER(E) (/*(E) ?*/ QT_STD_BORDER/* : QT_DISABLED_BORDER*/)
-
-#define QT_FRAME_DARK_SHADOW 2
-#define QT_FOCUS 3
-
-#define QTC_SHADE(c, s) \
+#define SIMPLE_SHADING (!shading)
+#define DEFAULT_CONTRAST 7
+
+#define THIN_SBAR_MOD ((opts.sliderWidth<DEFAULT_SLIDER_WIDTH ? 3 : opts.sliderWidth>DEFAULT_SLIDER_WIDTH ? (opts.sliderWidth-9)/2 : 4)+(EFFECT_NONE==opts.buttonEffect ? 1 : 0))
+#define SLIDER_SIZE (opts.sliderWidth<DEFAULT_SLIDER_WIDTH ? DEFAULT_SLIDER_WIDTH-2 : opts.sliderWidth)
+#define CIRCULAR_SLIDER_SIZE 15
+#define GLOW_MO 1 /*ORIGINAL_SHADE*/
+#define GLOW_DEFBTN 1
+#define GLOW_ALPHA(DEF) ((DEF) ? 0.5 : 0.65)
+#define DEF_BNT_TINT 0.4
+#define ENTRY_INNER_ALPHA 0.4
+#define INACTIVE_SEL_ALPHA 0.5
+
+#define SUNKEN_BEVEL_DARK_ALPHA(X) (X.value()/800.0) // 0.25
+#define SUNKEN_BEVEL_LIGHT_ALPHA(X) (X.value()/500.0) // 0.40
+
+#define MENU_SIZE_ATOM "_QTCURVE_MENUBAR_SIZE_"
+#define STATUSBAR_ATOM "_QTCURVE_STATUSBAR_"
+#define TITLEBAR_SIZE_ATOM "_QTCURVE_TITLEBAR_SIZE_"
+#define ACTIVE_WINDOW_ATOM "_QTCURVE_ACTIVE_WINDOW_"
+#define TOGGLE_MENUBAR_ATOM "_QTCURVE_TOGGLE_MENUBAR_"
+#define TOGGLE_STATUSBAR_ATOM "_QTCURVE_TOGGLE_STATUSBAR_"
+#define OPACITY_ATOM "_QTCURVE_OPACITY_"
+#define BGND_ATOM "_QTCURVE_BGND_"
+#define BLEND_TITLEBAR (opts.menubarAppearance==opts.titlebarAppearance && opts.menubarAppearance==opts.inactiveTitlebarAppearance && \
+ !(opts.windowBorder&WINDOW_BORDER_BLEND_TITLEBAR) && SHADE_WINDOW_BORDER==opts.shadeMenubars && opts.windowDrag)
+
+#define STD_BORDER 5
+#define STD_BORDER_BR 2
+#define PBAR_BORDER 4
+#define ARROW_MO_SHADE 4
+#define LOWER_BORDER_ALPHA 0.35
+#define DISABLED_BORDER STD_BORDER /*3*/
+#define BORDER_VAL(E) (/*(E) ?*/ STD_BORDER/* : DISABLED_BORDER*/)
+#define SLIDER_MO_BORDER_VAL 3
+
+#define FRAME_DARK_SHADOW 2
+#define FOCUS_SHADE(SEL) (FOCUS_GLOW==opts.focus ? GLOW_MO : ((SEL) ? 3 : ORIGINAL_SHADE))
+#define MENU_STRIPE_SHADE (USE_LIGHTER_POPUP_MENU ? ORIGINAL_SHADE : 2)
+#define MENU_SEP_SHADE (USE_LIGHTER_POPUP_MENU ? 4 : 3)
+
+#define BGND_STRIPE_SHADE 0.95
+
+#define SHADE(c, s) \
(c>10 || c<0 || s>=NUM_STD_SHADES || s<0 \
? 1.0 \
- : opts.darkerBorders && (QT_STD_BORDER==i || QT_DISABLED_BORDER==i) \
- ? shades[SHADING_SIMPLE==shading ? 1 : 0][c][s] - 0.1 \
- : shades[SHADING_SIMPLE==shading ? 1 : 0][c][s] )
+ : opts.darkerBorders && (STD_BORDER==i || DISABLED_BORDER==i) \
+ ? shades[SHADING_SIMPLE==opts.shading ? 1 : 0][c][s] - 0.1 \
+ : shades[SHADING_SIMPLE==opts.shading ? 1 : 0][c][s] )
#define TAB_APPEARANCE(A) (A) /* (APPEARANCE_GLASS==(A) ? APPEARANCE_GRADIENT : (A)) */
-#define QTC_COLOR_SEL_TAB_FACTOR 1.2
-
-#define QTC_ROUNDED (ROUND_NONE!=opts.round)
-
-#define QTC_ETCHED_DARK 0.95
-#define SHADE_BEVEL_GRAD_LIGHT (QTC_SIMPLE_SHADING ? 1.05 : 1.07)
-#define SHADE_BEVEL_GRAD_DARK (QTC_SIMPLE_SHADING ? 0.93 : 0.91)
-#define SHADE_BEVEL_GRAD_SEL_LIGHT (QTC_SIMPLE_SHADING ? 1.05 : 1.07)
-#define SHADE_BEVEL_GRAD_SEL_DARK (QTC_SIMPLE_SHADING ? 0.95 : 0.93)
-
-#define SHADE_BEVEL_MENU_ITEM_LIGHT (QTC_SIMPLE_SHADING ? 1.07 : 1.09)
-#define SHADE_BEVEL_MENU_ITEM_DARK (QTC_SIMPLE_SHADING ? 0.85 : 0.83)
-
-#define SHADE_SLIDER_LIGHT 1.1
-#define SHADE_SLIDER_DARK 0.8
-
-#define SHADE_SBAR_LIGHT 1.02
-#define SHADE_SBAR_DARK 0.95
-
-#define SHADE_MENU_LIGHT 1.02
-#define SHADE_MENU_DARK 0.96
-
-#define SHADE_TAB_SEL_LIGHT 1.1
-#define SHADE_TAB_SEL_DARK 1.0
-#define SHADE_BOTTOM_TAB_SEL_LIGHT 1.0
-#define SHADE_BOTTOM_TAB_SEL_DARK 0.96
-
-#define SPLIT_GRADIENT_FACTOR 0.415
-
-#if !defined QTC_GLASS_SHADING || QTC_GLASS_SHADING==0
-
- #define SHADE_GLASS_TOP_A(A, W) (APPEARANCE_DULL_GLASS==A \
- ? (WIDGET_DEF_BUTTON==W ? 0.99 : 0.98) \
- : (WIDGET_DEF_BUTTON==W ? 1.08 : 1.55))
- #define SHADE_GLASS_TOP_B(A, W) (APPEARANCE_DULL_GLASS==A \
- ? (WIDGET_DEF_BUTTON==W ? 0.94 : 0.92) \
- : 0.92)
- #define SHADE_GLASS_BOT_A(A) (APPEARANCE_DULL_GLASS==A ? 1.02 : 0.99)
- #define SHADE_GLASS_BOT_B(A) (APPEARANCE_DULL_GLASS==A ? 1.10 : 1.16)
-
-#elif QTC_GLASS_SHADING==1
-
- #define SHADE_GLASS_TOP_A(A, W) (APPEARANCE_DULL_GLASS==A \
- ? (WIDGET_DEF_BUTTON==W ? 1.0 : 1.0) \
- : (WIDGET_DEF_BUTTON==W ? 1.08 : 1.7))
- #define SHADE_GLASS_TOP_B(A, W) (APPEARANCE_DULL_GLASS==A ? 0.96 : 0.96)
- #define SHADE_GLASS_BOT_A(A) 0.99
- #define SHADE_GLASS_BOT_B(A) (APPEARANCE_DULL_GLASS==A ? 1.08 : 1.16)
-
-#else
+#define INVERT_SHADE(A) (1.0+(1.0-(A)))
- #define SHADE_GLASS_TOP_A(A, W) (APPEARANCE_DULL_GLASS==A \
- ? (WIDGET_DEF_BUTTON==W ? 1.05 : 1.05) \
- : (WIDGET_DEF_BUTTON==W ? 1.08 : 1.7))
- #define SHADE_GLASS_TOP_B(A, W) 0.96
- #define SHADE_GLASS_BOT_A(A) 0.99
- #define SHADE_GLASS_BOT_B(A) (APPEARANCE_DULL_GLASS==A ? 1.08 : 1.16)
+#define ROUNDED (ROUND_NONE!=opts.round)
-#endif
+#define TOOLBAR_SEP_GAP (opts.fadeLines ? 5 : 6)
+#define FADE_SIZE 0.4
+#define ETCHED_DARK 0.95
-#define IS_GLASS(A) (APPEARANCE_DULL_GLASS==A || APPEARANCE_SHINY_GLASS==A)
-#define IS_FLAT(A) (APPEARANCE_FLAT==A || APPEARANCE_RAISED==A)
-#define SHADE_SELECTION_TOP 1.15
-#define SHADE_SELECTION_BOT 0.9
+#define IS_GLASS(A) (APPEARANCE_DULL_GLASS==(A) || APPEARANCE_SHINY_GLASS==(A))
+#define IS_CUSTOM(A) ((A)>=APPEARANCE_CUSTOM1 && (A)<(APPEARANCE_CUSTOM1+NUM_CUSTOM_GRAD))
+#define IS_FLAT(A) (APPEARANCE_FLAT==(A) || APPEARANCE_RAISED==(A) || APPEARANCE_FADE==(A))
+#define IS_FLAT_BGND(A) (APPEARANCE_FLAT==(A) || APPEARANCE_RAISED==(A))
#ifdef __cplusplus
#define MENUBAR_DARK_LIMIT 160
@@ -240,73 +239,340 @@ typedef GdkColor color;
#define TOO_DARK(A) ((A).red<MENUBAR_DARK_LIMIT || (A).green<MENUBAR_DARK_LIMIT || (A).blue<MENUBAR_DARK_LIMIT)
#endif
-#define DEFAULT_HIGHLIGHT_FACTOR 1.05
-#define MAX_HIGHLIGHT_FACTOR 50
-#define MIN_HIGHLIGHT_FACTOR -50
-#define MENUBAR_DARK_FACTOR 0.97
-#define POPUPMENU_LIGHT_FACTOR 1.15
-#define INACTIVE_HIGHLIGHT_FACTOR 1.20
+#define TO_FACTOR(A) ((100.0+((double)(A)))/100.0)
+#define DEFAULT_HIGHLIGHT_FACTOR 3
+#define DEFAULT_SPLITTER_HIGHLIGHT_FACTOR 3
+#define DEFAULT_CR_HIGHLIGHT_FACTOR 0
+#define DEFAULT_EXPANDER_HIGHLIGHT_FACTOR 3
+#define MAX_HIGHLIGHT_FACTOR 50
+#define MIN_HIGHLIGHT_FACTOR -50
+#define MENUBAR_DARK_FACTOR TO_FACTOR(-3)
+#define INACTIVE_HIGHLIGHT_FACTOR TO_FACTOR(20)
+#define LV_HEADER_DARK_FACTOR TO_FACTOR(-10)
+#define DEF_POPUPMENU_LIGHT_FACTOR 2
+#define MIN_LIGHTER_POPUP_MENU -100
+#define MAX_LIGHTER_POPUP_MENU 100
+
+#define MIN_GB_FACTOR -50
+#define MAX_GB_FACTOR 50
+#define DEF_GB_FACTOR -3
+
+#define TO_ALPHA(A) (((double)((A)<0 ? -(A) : (A)))/100.0)
+#define DEF_COLOR_SEL_TAB_FACTOR 25
+#define MIN_COLOR_SEL_TAB_FACTOR 0
+#define MAX_COLOR_SEL_TAB_FACTOR 100
+
+#define DEF_TAB_BGND 0
+#define MIN_TAB_BGND -5
+#define MAX_TAB_BGND 5
+
+#define DEFAULT_MENU_DELAY 225
+#define MIN_MENU_DELAY 0
+#define MAX_MENU_DELAY 500
+
+#define DEFAULT_SLIDER_WIDTH 15
+#define MIN_SLIDER_WIDTH 11
+#define MAX_SLIDER_WIDTH 31
+
+#define SIZE_GRIP_SIZE 12
+
+#define USE_LIGHTER_POPUP_MENU (opts.lighterPopupMenuBgnd)
+#define USE_GLOW_FOCUS(mouseOver) (FOCUS_GLOW==opts.focus && (MO_GLOW!=opts.coloredMouseOver || !(mouseOver)))
#define USE_SHADED_MENU_BAR_COLORS (SHADE_CUSTOM==opts.shadeMenubars || SHADE_BLEND_SELECTED==opts.shadeMenubars)
#define MENUBAR_GLASS_SELECTED_DARK_FACTOR 0.9
-#define GLASS_BORDER 0.4
-#define BEVEL_BORDER(w) (WIDGET_LISTVIEW_HEADER==w ? 6 : 4)
-#define SHADE_BEVEL_TOP 1.07
-#define SHADE_BEVEL_MID_TOP 1.03
-#define SHADE_BEVEL_MID_BOT 0.975
-#define SHADE_BEVEL_BOT(w) (WIDGET_LISTVIEW_HEADER==(w) ? 0.88 : 0.90)
+
+#define MENUITEM_FADE_SIZE 48
#define NUM_SPLITTER_DASHES 21
-#define WIDGET_BUTTON(w) (WIDGET_STD_BUTTON==w || WIDGET_DEF_BUTTON==w || WIDGET_TOGGLE_BUTTON==w || WIDGET_CHECKBOX==w)
#ifdef __cplusplus
-#define ETCH_WIDGET(w) (WIDGET_STD_BUTTON==w || WIDGET_DEF_BUTTON==w || WIDGET_TOGGLE_BUTTON==w)
+#define WIDGET_BUTTON(w) (WIDGET_STD_BUTTON==(w) || WIDGET_DEF_BUTTON==(w) || \
+ WIDGET_CHECKBOX==(w) || WIDGET_RADIO_BUTTON==(w) || WIDGET_DIAL==(w) || \
+ WIDGET_COMBO==(w) || WIDGET_COMBO_BUTTON==(w) || WIDGET_MDI_WINDOW_BUTTON==(w) || \
+ WIDGET_TOOLBAR_BUTTON==(w) )
+#define ETCH_WIDGET(w) (WIDGET_STD_BUTTON==(w) || WIDGET_DEF_BUTTON==(w) || WIDGET_SLIDER_TROUGH==(w) || \
+ WIDGET_CHECKBOX==(w) || WIDGET_RADIO_BUTTON==(w) || WIDGET_DIAL==(w) || \
+ (WIDGET_SLIDER==(w) && MO_GLOW==opts.coloredMouseOver) || \
+ WIDGET_FILLED_SLIDER_TROUGH==(w) || WIDGET_MDI_WINDOW_BUTTON==(w) || WIDGET_TOOLBAR_BUTTON==(w))
+#define AGUA_WIDGET(w) (WIDGET_STD_BUTTON==(w) || WIDGET_DEF_BUTTON==(w) || IS_SLIDER((w)) || \
+ WIDGET_CHECKBOX==(w) || WIDGET_RADIO_BUTTON==(w) || \
+ WIDGET_COMBO==(w) WIDGET_COMBO_BUTTON==(w) || WIDGET_MDI_WINDOW_BUTTON==(w))
#else
-#define ETCH_WIDGET(w) (WIDGET_STD_BUTTON==w || WIDGET_DEF_BUTTON==w || WIDGET_TOGGLE_BUTTON==w || \
- WIDGET_SPIN_UP==w || WIDGET_SPIN_DOWN==w)
+#define WIDGET_BUTTON(w) (WIDGET_STD_BUTTON==(w) || WIDGET_DEF_BUTTON==(w) || WIDGET_TOGGLE_BUTTON==(w) || \
+ WIDGET_CHECKBOX==(w) || WIDGET_RADIO_BUTTON==(w) || \
+ WIDGET_RADIO_BUTTON==(w) || WIDGET_COMBO==(w) || WIDGET_COMBO_BUTTON==(w) || WIDGET_UNCOLOURED_MO_BUTTON==(w) || \
+ WIDGET_TOOLBAR_BUTTON==(w))
+#define ETCH_WIDGET(w) (WIDGET_STD_BUTTON==(w) || WIDGET_DEF_BUTTON==(w) || WIDGET_TOGGLE_BUTTON==(w) || WIDGET_SLIDER_TROUGH==(w) || \
+ WIDGET_CHECKBOX==(w) || WIDGET_RADIO_BUTTON==(w) || \
+ (WIDGET_SLIDER==(w) && MO_GLOW==opts.coloredMouseOver) || \
+ WIDGET_FILLED_SLIDER_TROUGH==(w) || WIDGET_COMBO==(w) || WIDGET_UNCOLOURED_MO_BUTTON==(w) || \
+ WIDGET_TOOLBAR_BUTTON==(w))
+#define AGUA_WIDGET(w) (WIDGET_STD_BUTTON==(w) || WIDGET_DEF_BUTTON==(w) || WIDGET_TOGGLE_BUTTON==(w) || IS_SLIDER((w)) || \
+ WIDGET_CHECKBOX==(w) || WIDGET_RADIO_BUTTON==(w) || \
+ WIDGET_COMBO==(w) WIDGET_COMBO_BUTTON==(w))
#endif
+
+#define SLIDER(w) (WIDGET_SB_SLIDER==(w) || WIDGET_SLIDER==(w))
+#define CIRCULAR_SLIDER(w) (WIDGET_SLIDER==(w) && SLIDER_CIRCULAR==opts.sliderStyle)
+
+#define MODIFY_AGUA_X(A, X) (APPEARANCE_AGUA==(A) ? (X) : (A))
+#define MODIFY_AGUA(A) MODIFY_AGUA_X((A), APPEARANCE_AGUA_MOD)
+#define AGUA_MAX 32.0
+#define AGUA_MID_SHADE 0.85
+
#define COLORED_BORDER_SIZE 3
#define PROGRESS_CHUNK_WIDTH 10
-#define QTC_DRAW_LIGHT_BORDER(SUKEN, WIDGET, APP) \
- ((!SUKEN && IS_GLASS(APP) && WIDGET_MENU_ITEM!=WIDGET && WIDGET_DEF_BUTTON!=WIDGET) || \
- (WIDGET_PROGRESSBAR==WIDGET && APPEARANCE_FLAT!=APP && \
- APPEARANCE_RAISED!=APP && APPEARANCE_INVERTED!=APP))
+#define STRIPE_WIDTH 10
+#define DRAW_LIGHT_BORDER(SUKEN, WIDGET, APP) \
+ (!(SUKEN) && (GB_LIGHT==getGradient(APP, &opts)->border) && WIDGET_MENU_ITEM!=(WIDGET) && !IS_TROUGH(WIDGET) && \
+ (WIDGET_DEF_BUTTON!=(WIDGET) || IND_COLORED!=opts.defBtnIndicator))
+
+#define DRAW_3D_FULL_BORDER(SUNKEN, APP) \
+ (!(SUNKEN) && GB_3D_FULL==getGradient((APP), &opts)->border)
+
+#define DRAW_3D_BORDER(SUNKEN, APP) \
+ (!(SUNKEN) && GB_3D==getGradient((APP), &opts)->border)
+
+#define DRAW_SHINE(SUNKEN, APP) \
+ (!(SUNKEN) && GB_SHINE==getGradient((APP), &opts)->border)
+
+#define LIGHT_BORDER(APP) (APPEARANCE_DULL_GLASS==(APP) ? 1 : 0)
#define PROGRESS_ANIMATION 100
-#define MIN_SLIDER_SIZE(A) (LINE_DOTS==A ? 24 : 20)
-
-#define QTC_NORM_TAB_APP (APPEARANCE_BEVELLED==opts.tabAppearance || APPEARANCE_SPLIT_GRADIENT==opts.appearance \
- ? APPEARANCE_GRADIENT : opts.tabAppearance)
-#define QTC_SEL_TAB_APP (APPEARANCE_INVERTED==opts.tabAppearance ? APPEARANCE_FLAT : (QTC_NORM_TAB_APP))
-#define QTC_SLIDER_MO_SHADE (SHADE_SELECTED==opts.shadeSliders ? 1 : (SHADE_BLEND_SELECTED==opts.shadeSliders ? 0 : ORIGINAL_SHADE))
-#define QTC_SLIDER_MO_BORDER (SHADE_SELECTED==opts.shadeSliders || SHADE_BLEND_SELECTED==opts.shadeSliders ? 2 : 1)
-#define QTC_SLIDER_MO_LEN (SLIDER_TRIANGULAR==opts.sliderStyle ? 2 : (SHADE_SELECTED==opts.shadeSliders || SHADE_BLEND_SELECTED==opts.shadeSliders ? 4 : 3))
-#define QTC_SB_SLIDER_MO_LEN(A) ((A)<22 && ROUND_FULL!=opts.round \
+#define MIN_SLIDER_SIZE(A) (LINE_DOTS==(A) ? 24 : 20)
+
+#define CR_SMALL_SIZE 13
+#define CR_LARGE_SIZE 15
+
+#define TAB_APP(A) (APPEARANCE_BEVELLED==(A) || APPEARANCE_SPLIT_GRADIENT==(A) ? APPEARANCE_GRADIENT : (A))
+#define NORM_TAB_APP TAB_APP(opts.tabAppearance)
+#define SEL_TAB_APP TAB_APP(opts.activeTabAppearance)
+
+#define SLIDER_MO_SHADE (SHADE_SELECTED==opts.shadeSliders ? 1 : (SHADE_BLEND_SELECTED==opts.shadeSliders ? 0 : ORIGINAL_SHADE))
+#define SLIDER_MO_PLASTIK_BORDER (SHADE_SELECTED==opts.shadeSliders || SHADE_BLEND_SELECTED==opts.shadeSliders ? 2 : 1)
+#define SLIDER_MO_LEN (SLIDER_TRIANGULAR==opts.sliderStyle ? 2 : (SHADE_SELECTED==opts.shadeSliders || SHADE_BLEND_SELECTED==opts.shadeSliders ? 4 : 3))
+#define SB_SLIDER_MO_LEN(A) ((A)<22 && !FULLLY_ROUNDED \
? 2 \
: ((A)<32 || (SHADE_SELECTED!=opts.shadeSliders && SHADE_BLEND_SELECTED!=opts.shadeSliders) \
? 4 \
: 6))
-#define QTC_CR_MO_FILL (SHADE_BLEND_SELECTED==opts.shadeCheckRadio || SHADE_SELECTED==opts.shadeCheckRadio ? 1 : 2)
-#define QTC_MO_DEF_BTN 2
-#define QTC_MO_PLASTIK_DARK(W) (WIDGET_DEF_BUTTON==W && IND_COLORED==opts.defBtnIndicator ? 3 : 2) /*? 2 : 1) */
-#define QTC_MO_PLASTIK_LIGHT(W) (WIDGET_DEF_BUTTON==W && IND_COLORED==opts.defBtnIndicator ? 4 : 1) /*? 2 : 0) */
+#define CR_MO_FILL 1
+#define MO_DEF_BTN 2
+#define MO_PLASTIK_DARK(W) (WIDGET_DEF_BUTTON==(W) && IND_COLORED==opts.defBtnIndicator ? 3 : 2) /*? 2 : 1) */
+#define MO_PLASTIK_LIGHT(W) (WIDGET_DEF_BUTTON==(W) && IND_COLORED==opts.defBtnIndicator ? 4 : 1) /*? 2 : 0) */
+
+#define MO_STD_DARK(W) (MO_GLOW==opts.coloredMouseOver \
+ ? 1 \
+ : MO_PLASTIK_DARK(W))
+#define MO_STD_LIGHT(W, S) (MO_GLOW==opts.coloredMouseOver \
+ ? 1 \
+ : MO_PLASTIK_LIGHT(W))
+
+#define FULLLY_ROUNDED (opts.round>=ROUND_FULL)
+#define DO_EFFECT (EFFECT_NONE!=opts.buttonEffect)
+#if !defined __cplusplus || (defined QT_VERSION && (QT_VERSION >= 0x040000))
+#define SLIDER_GLOW (DO_EFFECT && MO_GLOW==opts.coloredMouseOver /*&& SLIDER_TRIANGULAR!=opts.sliderStyle*/ ? 2 : 0)
+#endif
-#define QTC_MO_STD_DARK(W) QTC_MO_PLASTIK_DARK(W) /*(WIDGET_DEF_BUTTON==W && IND_COLORED==opts.defBtnIndicator ? 4 : 1) */
-#define QTC_MO_STD_LIGHT(W, S) QTC_MO_PLASTIK_LIGHT(W) /*(WIDGET_DEF_BUTTON==W && IND_COLORED==opts.defBtnIndicator ? 2 : (S ? 1 : 0))*/
+#define ENTRY_MO (opts.unifyCombo && opts.unifySpin)
+
+#if !defined __cplusplus || (defined QT_VERSION && (QT_VERSION >= 0x040000))
+#define FOCUS_ALPHA 0.08
+#define FOCUS_GLOW_LINE_ALPHA 0.5
+#define BORDER_BLEND_ALPHA 0.7
+#define ETCH_TOP_ALPHA 0.055
+#define ETCH_BOTTOM_ALPHA 0.1
+// #if defined QT_VERSION && (QT_VERSION >= 0x040000)
+// #define ETCH_RADIO_TOP_ALPHA 0.055
+// #define ETCH_RADIO_BOTTOM_ALPHA 0.80
+// #else
+#define ETCH_RADIO_TOP_ALPHA 0.09
+#define ETCH_RADIO_BOTTOM_ALPHA 1.0
+// #endif
+
+#define RINGS_INNER_ALPHA(T) qtcRingAlpha[IMG_PLAIN_RINGS==(T) ? 1 : 0] //(IMG_PLAIN_RINGS==opts.bgndImage.type ? 0.25 : 0.125)
+#define RINGS_OUTER_ALPHA qtcRingAlpha[2] //0.5
+#define RINGS_WIDTH(T) (IMG_SQUARE_RINGS==T ? 260 : 450)
+#define RINGS_HEIGHT(T) (IMG_SQUARE_RINGS==T ? 220 : 360)
+
+#define RINGS_SQUARE_LARGE_ALPHA (RINGS_OUTER_ALPHA*0.675)
+#define RINGS_SQUARE_SMALL_ALPHA (RINGS_OUTER_ALPHA*0.50)
+#define RINGS_SQUARE_LINE_WIDTH 20.0
+#define RINGS_SQUARE_RADIUS 18.0
+#define RINGS_SQUARE_LARGE_SIZE 120.0
+#define RINGS_SQUARE_SMALL_SIZE 100.0
+
+#if !defined __cplusplus
+#define MENU_AND_TOOLTIP_RADIUS (opts.round>=ROUND_FULL ? 5.0 : 3.5)
+#else
+#define MENU_AND_TOOLTIP_RADIUS (opts.round>=ROUND_FULL ? 5.0 : 2.5)
+#endif
-#define QTC_DO_EFFECT (ROUND_FULL==opts.round && EFFECT_NONE!=opts.buttonEffect)
+#define CUSTOM_BGND (!(IS_FLAT_BGND(opts.bgndAppearance)) || IMG_NONE!=opts.bgndImage.type || 100!=opts.bgndOpacity || 100!=opts.dlgOpacity)
+
+#define GLOW_PROG_ALPHA 0.55
+
+#endif
+
+#if defined __cplusplus && defined QT_VERSION && (QT_VERSION >= 0x040000)
-#ifdef __cplusplus
#include <qstyle.h>
typedef enum
{
- QtC_Round = QStyle::PM_CustomBase
+ QtC_Round = QStyle::PM_CustomBase,
+ QtC_TitleBarButtonAppearance,
+ QtC_TitleAlignment,
+ QtC_TitleBarButtons,
+ QtC_TitleBarIcon,
+ QtC_TitleBarIconColor,
+ QtC_TitleBarEffect,
+ QtC_BlendMenuAndTitleBar,
+ QtC_ShadeMenubarOnlyWhenActive,
+ QtC_ToggleButtons,
+ QtC_MenubarColor,
+ QtC_WindowBorder,
+ QtC_CustomBgnd,
+ QtC_TitleBarApp
} QtCMetrics;
+
+#define QtC_StateKWin ((QStyle::StateFlag)0x10000000)
+// PE_FrameWindow
+#define QtC_StateKWinNotFull ((QStyle::StateFlag)0x20000000)
+// CC_TitleBar
+#define QtC_StateKWinFillBgnd ((QStyle::StateFlag)0x20000000)
+#define QtC_StateKWinNoBorder ((QStyle::StateFlag)0x40000000)
+#define QtC_StateKWinCompositing ((QStyle::StateFlag)0x80000000)
+#define QtC_StateKWinTabDrag ((QStyle::StateFlag)0x00000001)
+
+#define QtC_PE_DrawBackground ((QStyle::PrimitiveElement)(QStyle::PE_CustomBase+10000))
+
+#define CLOSE_COLOR QColor(191, 82, 82)
+#define DARK_WINDOW_TEXT(A) ((A).red()<230 || (A).green()<230 || (A).blue()<230)
+#define HOVER_BUTTON_ALPHA(A) (DARK_WINDOW_TEXT(A) ? 0.25 : 0.65)
+#define WINDOW_TEXT_SHADOW_ALPHA(A) (EFFECT_SHADOW==(A) ? 0.10 : 0.60)
+#define WINDOW_SHADOW_COLOR(A) (EFFECT_SHADOW==(A) ? Qt::black : Qt::white)
+#endif
+
+#if defined CONFIG_DIALOG || (defined QT_VERSION && (QT_VERSION >= 0x040000))
+#define QTCURVE_PREVIEW_CONFIG "QTCURVE_PREVIEW_CONFIG"
+#define QTCURVE_PREVIEW_CONFIG_FULL "QTCURVE_PREVIEW_CONFIG_FULL"
+
+typedef enum
+{
+ DWT_BUTTONS_AS_PER_TITLEBAR = 0x0001,
+ DWT_COLOR_AS_PER_TITLEBAR = 0x0002,
+ DWT_FONT_AS_PER_TITLEBAR = 0x0004,
+ DWT_TEXT_ALIGN_AS_PER_TITLEBAR = 0x0008,
+ DWT_EFFECT_AS_PER_TITLEBAR = 0x0010,
+ DWT_ROUND_TOP_ONLY = 0x0020,
+ DWT_ICON_COLOR_AS_PER_TITLEBAR = 0x0040
+} EDwtSettingsFlags;
+
+typedef enum
+{
+ TITLEBAR_BUTTON_ROUND = 0x0001,
+ TITLEBAR_BUTTON_HOVER_FRAME = 0x0002,
+ TITLEBAR_BUTTON_HOVER_SYMBOL = 0x0004,
+ TITLEBAR_BUTTON_NO_FRAME = 0x0008,
+ TITLEBAR_BUTTON_COLOR = 0x0010,
+ TITLEBAR_BUTTON_COLOR_INACTIVE = 0x0020,
+ TITLEBAR_BUTTON_COLOR_MOUSE_OVER = 0x0040,
+ TITLEBAR_BUTTON_STD_COLOR = 0x0080,
+ TITLEBAR_BUTTON_COLOR_SYMBOL = 0x0100,
+ TITLEBAR_BUTTON_HOVER_SYMBOL_FULL = 0x0200,
+ TITLEBAR_BUTTON_SUNKEN_BACKGROUND = 0x0400,
+ TITLEBAR_BUTTOM_ARROW_MIN_MAX = 0x0800,
+ TITLEBAR_BUTTOM_HIDE_ON_INACTIVE_WINDOW = 0x1000,
+ TITLEBAR_BUTTON_ICON_COLOR = 0x2000
+} ETitleBarButtonFlags;
+
+typedef enum
+{
+ TITLEBAR_ICON_NONE,
+ TITLEBAR_ICON_MENU_BUTTON,
+ TITLEBAR_ICON_NEXT_TO_TITLE
+} ETitleBarIcon;
+
+typedef enum
+{
+ TITLEBAR_CLOSE,
+ TITLEBAR_MIN,
+ TITLEBAR_MAX,
+ TITLEBAR_HELP,
+ TITLEBAR_MENU,
+ TITLEBAR_SHADE,
+ TITLEBAR_ALL_DESKTOPS,
+ TITLEBAR_KEEP_ABOVE,
+ TITLEBAR_KEEP_BELOW,
+ NUM_TITLEBAR_BUTTONS
+} ETitleBarButtons;
+
+#define TBAR_VERSION_HACK 65535
+#define TBAR_BORDER_VERSION_HACK (TBAR_VERSION_HACK+1000)
+
+typedef std::map<int, QColor> TBCols;
#endif
typedef enum
{
+ WINDOW_BORDER_COLOR_TITLEBAR_ONLY = 0x01, // colorTitlebarOnly
+ WINDOW_BORDER_USE_MENUBAR_COLOR_FOR_TITLEBAR = 0x02, // titlebarMenuColor
+ WINDOW_BORDER_ADD_LIGHT_BORDER = 0x04, // titlebarBorder
+ WINDOW_BORDER_BLEND_TITLEBAR = 0x08, // titlebarBlend
+ WINDOW_BORDER_SEPARATOR = 0x10
+} EWindowBorder;
+
+typedef enum
+{
+ IMG_NONE,
+ IMG_BORDERED_RINGS,
+ IMG_PLAIN_RINGS,
+ IMG_SQUARE_RINGS,
+ IMG_FILE
+} EImageType;
+
+typedef struct
+{
+ EImageType type;
+ bool loaded;
+#if defined __cplusplus
+ QString file;
+ QPixmap pix;
+#else // __cplusplus
+ const char *file;
+ GdkPixbuf *pix;
+#endif // __cplusplus
+ int width, height;
+} QtCImage;
+
+typedef enum
+{
+ SQUARE_NONE = 0x0000,
+ SQUARE_ENTRY = 0x0001,
+ SQUARE_PROGRESS = 0x0002,
+ SQUARE_SCROLLVIEW = 0x0004,
+ SQUARE_LISTVIEW_SELECTION = 0x0008,
+ SQUARE_FRAME = 0x0010,
+ SQUARE_TAB_FRAME = 0x0020,
+ SQUARE_SLIDER = 0x0040,
+ SQUARE_SB_SLIDER = 0x0080,
+ SQUARE_WINDOWS = 0x0100,
+ SQUARE_TOOLTIPS = 0x0200,
+ SQUARE_POPUP_MENUS = 0x0400
+} ESquare;
+
+typedef enum
+{
+ WM_DRAG_NONE = 0,
+ WM_DRAG_MENUBAR = 1,
+ WM_DRAG_MENU_AND_TOOLBAR = 2,
+ WM_DRAG_ALL = 3
+} EWmDrag;
+
+typedef enum
+{
EFFECT_NONE,
EFFECT_ETCH,
EFFECT_SHADOW
@@ -314,14 +580,22 @@ typedef enum
typedef enum
{
+ PIX_CHECK,
+#ifdef __cplusplus
+#if defined QT_VERSION && (QT_VERSION < 0x040000)
+ PIX_RADIO_ON,
PIX_RADIO_BORDER,
+ PIX_RADIO_INNER,
PIX_RADIO_LIGHT,
- PIX_RADIO_ON,
- PIX_CHECK,
PIX_SLIDER,
PIX_SLIDER_LIGHT,
PIX_SLIDER_V,
- PIX_SLIDER_LIGHT_V
+ PIX_SLIDER_LIGHT_V,
+#endif
+ PIX_DOT
+#else
+ PIX_BLANK
+#endif
} EPixmap;
typedef enum
@@ -330,46 +604,109 @@ typedef enum
WIDGET_TAB_BOT,
WIDGET_STD_BUTTON,
WIDGET_DEF_BUTTON,
+ WIDGET_TOOLBAR_BUTTON,
WIDGET_LISTVIEW_HEADER,
WIDGET_SLIDER,
WIDGET_SLIDER_TROUGH,
+ WIDGET_FILLED_SLIDER_TROUGH,
WIDGET_SB_SLIDER,
WIDGET_SB_BUTTON,
+ WIDGET_SB_BGND,
WIDGET_TROUGH,
WIDGET_CHECKBOX,
- WIDGET_TOGGLE_BUTTON,
+ WIDGET_RADIO_BUTTON,
+ WIDGET_COMBO,
+ WIDGET_COMBO_BUTTON,
WIDGET_MENU_ITEM,
WIDGET_PROGRESSBAR,
+ WIDGET_PBAR_TROUGH,
#ifndef __cplusplus
+ WIDGET_ENTRY_PROGRESSBAR,
+ WIDGET_TOGGLE_BUTTON,
WIDGET_SPIN_UP,
WIDGET_SPIN_DOWN,
+ WIDGET_UNCOLOURED_MO_BUTTON,
+#else
+ WIDGET_CHECKBUTTON, // Qt4 only
+ WIDGET_MDI_WINDOW, // Qt4 only
+ WIDGET_MDI_WINDOW_TITLE, // Qt4 only
+ WIDGET_MDI_WINDOW_BUTTON, // Qt4 only
+ WIDGET_DOCK_WIDGET_TITLE,
+ WIDGET_DIAL,
#endif
WIDGET_SPIN,
-#ifdef __cplusplus
- WIDGET_CHECKBUTTON, // Qt4 only
- WIDGET_MDI_WINDOW, // Qt4 only
- WIDGET_MDI_WINDOW_TITLE, // Qt4 only
WIDGET_ENTRY,
+ WIDGET_SCROLLVIEW,
+ WIDGET_SELECTION,
WIDGET_FRAME,
WIDGET_NO_ETCH_BTN,
-#endif
+ WIDGET_MENU_BUTTON, // Qt4 only
+ WIDGET_FOCUS,
+ WIDGET_TAB_FRAME,
WIDGET_OTHER
} EWidget;
typedef enum
{
- APPEARANCE_FLAT,
+ APP_ALLOW_BASIC,
+ APP_ALLOW_FADE,
+ APP_ALLOW_STRIPED,
+ APP_ALLOW_NONE
+} EAppAllow;
+
+typedef enum
+{
+ APPEARANCE_CUSTOM1,
+ APPEARANCE_CUSTOM2,
+ APPEARANCE_CUSTOM3,
+ APPEARANCE_CUSTOM4,
+ APPEARANCE_CUSTOM5,
+ APPEARANCE_CUSTOM6,
+ APPEARANCE_CUSTOM7,
+ APPEARANCE_CUSTOM8,
+ APPEARANCE_CUSTOM9,
+ APPEARANCE_CUSTOM10,
+ APPEARANCE_CUSTOM11,
+ APPEARANCE_CUSTOM12,
+ APPEARANCE_CUSTOM13,
+ APPEARANCE_CUSTOM14,
+ APPEARANCE_CUSTOM15,
+ APPEARANCE_CUSTOM16,
+ APPEARANCE_CUSTOM17,
+ APPEARANCE_CUSTOM18,
+ APPEARANCE_CUSTOM19,
+ APPEARANCE_CUSTOM20,
+ APPEARANCE_CUSTOM21,
+ APPEARANCE_CUSTOM22,
+
+ NUM_CUSTOM_GRAD,
+
+ APPEARANCE_FLAT = NUM_CUSTOM_GRAD,
APPEARANCE_RAISED,
APPEARANCE_DULL_GLASS,
APPEARANCE_SHINY_GLASS,
+ APPEARANCE_AGUA,
+ APPEARANCE_SOFT_GRADIENT,
APPEARANCE_GRADIENT,
+ APPEARANCE_HARSH_GRADIENT,
APPEARANCE_INVERTED,
+ APPEARANCE_DARK_INVERTED,
APPEARANCE_SPLIT_GRADIENT,
- APPEARANCE_BEVELLED
+ APPEARANCE_BEVELLED,
+ APPEARANCE_FADE, /* Only for poupmenu items! */
+ APPEARANCE_STRIPED = APPEARANCE_FADE, /* Only for windows and menus */
+ APPEARANCE_NONE = APPEARANCE_FADE, /* Only for titlebars */
+ APPEARANCE_LV_BEVELLED, /* To be used only with getGradient */
+ APPEARANCE_AGUA_MOD,
+ APPEARANCE_LV_AGUA,
+ NUM_STD_APP = (APPEARANCE_LV_AGUA-NUM_CUSTOM_GRAD)+1
} EAppearance;
-#define IS_SLIDER(W) (WIDGET_SLIDER==W || WIDGET_SB_SLIDER==W)
-#define IS_TOGGLE_BUTTON(W) (WIDGET_TOGGLE_BUTTON==W || WIDGET_CHECKBOX==W)
+#define IS_SLIDER(W) (WIDGET_SLIDER==(W) || WIDGET_SB_SLIDER==(W))
+#define IS_TROUGH(W) (WIDGET_SLIDER_TROUGH==(W) || WIDGET_PBAR_TROUGH==(W) || WIDGET_TROUGH==(W) || WIDGET_FILLED_SLIDER_TROUGH==(W))
+#ifndef __cplusplus
+#define IS_TOGGLE_BUTTON(W) (WIDGET_TOGGLE_BUTTON==(W) || WIDGET_CHECKBOX==(W))
+#endif
typedef enum
{
@@ -379,49 +716,54 @@ typedef enum
CORNER_BL = 0x8
} ECornerBits;
-#define ROUNDED_NONE 0x0
-#define ROUNDED_TOP (CORNER_TL|CORNER_TR)
-#define ROUNDED_BOTTOM (CORNER_BL|CORNER_BR)
-#define ROUNDED_LEFT (CORNER_TL|CORNER_BL)
-#define ROUNDED_RIGHT (CORNER_TR|CORNER_BR)
-#define ROUNDED_TOPRIGHT CORNER_TR
-#define ROUNDED_BOTTOMRIGHT CORNER_BR
-#define ROUNDED_TOPLEFT CORNER_TL
-#define ROUNDED_BOTTOMLEFT CORNER_BL
-#define ROUNDED_ALL (CORNER_TL|CORNER_TR|CORNER_BR|CORNER_BL)
+#define ROUNDED_NONE 0x0
+#define ROUNDED_TOP (CORNER_TL|CORNER_TR)
+#define ROUNDED_BOTTOM (CORNER_BL|CORNER_BR)
+#define ROUNDED_LEFT (CORNER_TL|CORNER_BL)
+#define ROUNDED_RIGHT (CORNER_TR|CORNER_BR)
+#define ROUNDED_TOPRIGHT CORNER_TR
+#define ROUNDED_BOTTOMRIGHT CORNER_BR
+#define ROUNDED_TOPLEFT CORNER_TL
+#define ROUNDED_BOTTOMLEFT CORNER_BL
+#define ROUNDED_ALL (CORNER_TL|CORNER_TR|CORNER_BR|CORNER_BL)
typedef enum
{
IND_CORNER,
IND_FONT_COLOR,
IND_COLORED,
+ IND_TINT,
+ IND_GLOW,
+ IND_DARKEN,
+ IND_SELECTED,
IND_NONE
} EDefBtnIndicator;
typedef enum
{
+ LINE_NONE,
LINE_SUNKEN,
LINE_FLAT,
LINE_DOTS,
- LINE_DASHES
+ LINE_1DOT,
+ LINE_DASHES,
} ELine;
-#define LINE_NONE LINE_DASHES
-
typedef enum
{
TB_NONE,
TB_LIGHT,
TB_DARK,
TB_LIGHT_ALL,
- TB_DARK_ALL,
+ TB_DARK_ALL
} ETBarBorder;
typedef enum
{
BORDER_FLAT,
BORDER_RAISED,
- BORDER_SUNKEN
+ BORDER_SUNKEN,
+ BORDER_LIGHT
} EBorder;
/*
@@ -433,16 +775,26 @@ typedef enum
{
SHADE_NONE,
SHADE_CUSTOM,
- SHADE_BLEND_SELECTED, /* In the case of check/radios this is SHADE_SELECTED */
- SHADE_SELECTED,
- SHADE_DARKEN = SHADE_SELECTED , /* For menubar only! */
+ SHADE_SELECTED,
+ SHADE_BLEND_SELECTED,
+ SHADE_DARKEN,
+ SHADE_WINDOW_BORDER
} EShade;
typedef enum
{
+ ECOLOR_BASE,
+ ECOLOR_BACKGROUND,
+ ECOLOR_DARK,
+} EColor;
+
+typedef enum
+{
ROUND_NONE,
ROUND_SLIGHT,
- ROUND_FULL
+ ROUND_FULL,
+ ROUND_EXTRA,
+ ROUND_MAX
} ERound;
typedef enum
@@ -456,66 +808,437 @@ typedef enum
typedef enum
{
+ FRAME_NONE,
+ FRAME_PLAIN,
+ FRAME_LINE,
+ FRAME_SHADED,
+ FRAME_FADED
+} EFrame;
+
+typedef enum
+{
+ GB_LBL_BOLD = 0x01,
+ GB_LBL_CENTRED = 0x02,
+ GB_LBL_INSIDE = 0x04,
+ GB_LBL_OUTSIDE = 0x08
+} EGBLabel;
+
+#define NO_FRAME(A) (FRAME_NONE==(A) || FRAME_LINE==(A))
+
+typedef enum
+{
MO_NONE,
MO_COLORED,
- MO_PLASTIK
+ MO_COLORED_THICK,
+ MO_PLASTIK,
+ MO_GLOW
} EMouseOver;
typedef enum
{
STRIPE_NONE,
STRIPE_PLAIN,
- STRIPE_DIAGONAL
+ STRIPE_DIAGONAL,
+ STRIPE_FADE
} EStripe;
typedef enum
{
SLIDER_PLAIN,
SLIDER_ROUND,
+ SLIDER_PLAIN_ROTATED,
+ SLIDER_ROUND_ROTATED,
SLIDER_TRIANGULAR,
+ SLIDER_CIRCULAR
} ESliderStyle;
-#define DEF_IND_STR "fontcolor"
-#define DEF_LINE_STR "dots"
-#define DEF_TB_BORDER "none"
-#define DEF_APPEARANCE_STR "bevelled"
-#define DEF_MENU_APPEARANCE_STR "gradient"
-#define DEF_TOOLBAR_APPEARANCE_STR "gradient"
-#define DEF_SLIDER_SHADE_STR "selected"
-#define DEF_TBS_STR "dots"
-#define DEF_COLOR_STR "background"
-#define DEF_TOOLBAR_SHADE_STR "none"
+#define ROTATED_SLIDER (SLIDER_PLAIN_ROTATED==opts.sliderStyle || SLIDER_ROUND_ROTATED==opts.sliderStyle)
-#ifdef QTC_COMMON_FUNCTIONS
-static double getWidgetShade(EWidget w, bool light, bool sunken, EAppearance app)
+typedef enum
{
- switch(w)
+ FOCUS_STANDARD,
+ FOCUS_RECTANGLE,
+ FOCUS_FULL,
+ FOCUS_FILLED,
+ FOCUS_LINE,
+ FOCUS_GLOW
+} EFocus;
+
+typedef enum
+{
+ TAB_MO_TOP,
+ TAB_MO_BOTTOM,
+ TAB_MO_GLOW
+} ETabMo;
+
+typedef enum
+{
+ GT_HORIZ,
+ GT_VERT
+} EGradType;
+
+typedef enum
+{
+ GLOW_NONE,
+ GLOW_START,
+ GLOW_MIDDLE,
+ GLOW_END
+} EGlow;
+
+#define FULL_FOCUS (FOCUS_FULL==opts.focus || FOCUS_FILLED==opts.focus)
+
+enum
+{
+ HIDE_NONE = 0x00,
+ HIDE_KEYBOARD = 0x01,
+ HIDE_KWIN = 0x02
+};
+
+#if defined __cplusplus
+typedef enum
+{
+ ALIGN_LEFT,
+ ALIGN_CENTER,
+ ALIGN_FULL_CENTER,
+ ALIGN_RIGHT
+} EAlign;
+#endif
+
+#ifdef __cplusplus
+inline
+#else
+static
+#endif
+bool equal(double d1, double d2)
+{
+ return (fabs(d1 - d2) < 0.0001);
+}
+
+#ifdef __cplusplus
+struct GradientStop
+#else
+typedef struct
+#endif
+{
+#ifdef __cplusplus
+ GradientStop(double p=0.0, double v=0.0, double a=1.0) : pos(p), val(v), alpha(a) { }
+
+ bool operator==(const GradientStop &o) const
{
- case WIDGET_TROUGH:
- return light ? SHADE_SBAR_LIGHT : SHADE_SBAR_DARK;
- case WIDGET_SLIDER_TROUGH:
- return light ? SHADE_SLIDER_LIGHT : SHADE_SLIDER_DARK;
- case WIDGET_MENU_ITEM:
- if(APPEARANCE_DULL_GLASS!=app && APPEARANCE_SHINY_GLASS!=app)
- return light ? SHADE_BEVEL_MENU_ITEM_LIGHT : SHADE_BEVEL_MENU_ITEM_DARK;
- default:
- return light
- ? sunken
- ? SHADE_BEVEL_GRAD_SEL_LIGHT
- : SHADE_BEVEL_GRAD_LIGHT
- : sunken
- ? SHADE_BEVEL_GRAD_SEL_DARK
- : SHADE_BEVEL_GRAD_DARK;
+ return equal(pos, o.pos) && equal(val, o.val) && equal(alpha, o.alpha);
+ }
+
+ bool operator<(const GradientStop &o) const
+ {
+ return pos<o.pos || (equal(pos, o.pos) && (val<o.val || (equal(val, o.val) && alpha<o.alpha)));
}
+#endif
+
+ double pos,
+ val,
+ alpha;
}
+#ifndef __cplusplus
+GradientStop
+#endif
+;
-#define QTC_MIN(a, b) ((a) < (b) ? (a) : (b))
-#define QTC_MAX(a, b) ((b) < (a) ? (a) : (b))
+typedef enum
+{
+ GB_NONE,
+ GB_LIGHT,
+ GB_3D,
+ GB_3D_FULL,
+ GB_SHINE
+} EGradientBorder;
-static bool equal(double d1, double d2)
+typedef enum
{
- return (fabs(d1 - d2) < 0.0001);
+ LV_NONE,
+ LV_NEW,
+ LV_OLD
+} ELvLines;
+
+typedef struct
+{
+ int titleHeight,
+ toolTitleHeight,
+ bottom,
+ sides;
+} WindowBorders;
+
+#ifdef __cplusplus
+struct GradientStopCont : public std::set<GradientStop>
+{
+ GradientStopCont fix() const
+ {
+ GradientStopCont c(*this);
+ if(size())
+ {
+ GradientStopCont::const_iterator first(c.begin());
+ GradientStopCont::reverse_iterator last(c.rbegin());
+
+ if((*first).pos>0.001)
+ c.insert(GradientStop(0.0, 1.0));
+ if((*last).pos<0.999)
+ c.insert(GradientStop(1.0, 1.0));
+ }
+ return c;
+ }
+};
+struct Gradient
+#else
+typedef struct
+#endif
+{
+#ifdef __cplusplus
+ Gradient() : border(GB_3D) { }
+
+#ifdef CONFIG_DIALOG
+ bool operator==(const Gradient &o) const
+ {
+ return border==o.border && stops==o.stops;
+ }
+#endif
+#endif
+ EGradientBorder border;
+#ifdef __cplusplus
+ GradientStopCont stops;
+#else
+ int numStops;
+ GradientStop *stops;
+#endif
}
+#ifndef __cplusplus
+Gradient
+#endif
+;
+
+#define USE_CUSTOM_SHADES(A) ((A).customShades[0]>0.00001)
+#define USE_CUSTOM_ALPHAS(A) ((A).customAlphas[0]>0.00001)
+
+#ifdef __cplusplus
+typedef std::map<EAppearance, Gradient> GradientCont;
+struct Options
+#else
+typedef struct
+#endif
+{
+
+ int version,
+ contrast,
+ passwordChar,
+ highlightFactor,
+ lighterPopupMenuBgnd,
+ menuDelay,
+ sliderWidth,
+ tabBgnd,
+ colorSelTab,
+ expanderHighlight,
+ crHighlight,
+ splitterHighlight,
+ crSize,
+ gbFactor,
+ gbLabel;
+ ERound round;
+ bool embolden,
+ highlightTab,
+ roundAllTabs,
+ animatedProgress,
+#ifdef QTC_ENABLE_PARENTLESS_DIALOG_FIX_SUPPORT
+ fixParentlessDialogs,
+#endif
+ customMenuTextColor,
+ menubarMouseOver,
+ useHighlightForMenu,
+ shadeMenubarOnlyWhenActive,
+ thinnerMenuItems,
+ thinnerBtns,
+ lvButton,
+ drawStatusBarFrames,
+ fillSlider,
+ roundMbTopOnly,
+ gtkScrollViews,
+ stdSidebarButtons,
+ toolbarTabs,
+#ifdef __cplusplus
+ gtkComboMenus,
+/*
+#else
+ setDialogButtonOrder,
+*/
+#endif
+ mapKdeIcons,
+#if defined CONFIG_DIALOG || (defined QT_VERSION && (QT_VERSION >= 0x040000)) || !defined __cplusplus
+ gtkButtonOrder,
+ fadeLines,
+#endif
+ reorderGtkButtons,
+ borderMenuitems,
+ colorMenubarMouseOver,
+ darkerBorders,
+ vArrows,
+ xCheck,
+ crButton,
+ smallRadio,
+ fillProgress,
+ comboSplitter,
+ highlightScrollViews,
+ sunkenScrollViews,
+ etchEntry,
+ colorSliderMouseOver,
+ thinSbarGroove,
+ flatSbarButtons,
+ borderSbarGroove,
+ borderProgress,
+ popupBorder,
+ unifySpinBtns,
+ unifyCombo,
+ unifySpin,
+ borderTab,
+ borderInactiveTab,
+ doubleGtkComboArrow,
+ menuIcons,
+#if defined CONFIG_DIALOG || (defined QT_VERSION && (QT_VERSION >= 0x040000))
+ stdBtnSizes,
+#endif
+#if defined QT_VERSION && (QT_VERSION >= 0x040000)
+ xbar,
+#endif
+ forceAlternateLvCols,
+ invertBotTab,
+ boldProgress,
+ coloredTbarMo,
+ borderSelection,
+ stripedSbar,
+ shadePopupMenu;
+ EFrame groupBox;
+ EGlow glowProgress;
+ ELvLines lvLines;
+ EGradType bgndGrad,
+ menuBgndGrad;
+ int menubarHiding,
+ statusbarHiding,
+ square,
+ windowDrag,
+ windowBorder,
+ bgndOpacity,
+ menuBgndOpacity,
+ dlgOpacity;
+#if defined QT_VERSION && (QT_VERSION >= 0x040000)
+ int dwtSettings;
+#endif
+#if defined CONFIG_DIALOG || (defined QT_VERSION && (QT_VERSION >= 0x040000))
+ int titlebarButtons;
+ TBCols titlebarButtonColors;
+ ETitleBarIcon titlebarIcon;
+#endif
+ EStripe stripedProgress;
+ ESliderStyle sliderStyle;
+ EMouseOver coloredMouseOver;
+ ETBarBorder toolbarBorders;
+ EDefBtnIndicator defBtnIndicator;
+ ELine sliderThumbs,
+ handles,
+ toolbarSeparators,
+ splitters;
+ ETabMo tabMouseOver;
+/* NOTE: If add an appearance setting, increase the number of custmo gradients to match! */
+ EAppearance appearance,
+ bgndAppearance,
+ menuBgndAppearance,
+ menubarAppearance,
+ menuitemAppearance,
+ toolbarAppearance,
+ lvAppearance,
+ tabAppearance,
+ activeTabAppearance,
+ sliderAppearance,
+ titlebarAppearance,
+ inactiveTitlebarAppearance,
+#ifdef __cplusplus
+ titlebarButtonAppearance,
+ dwtAppearance,
+#endif
+ selectionAppearance,
+ menuStripeAppearance,
+ progressAppearance,
+ progressGrooveAppearance,
+ grooveAppearance,
+ sunkenAppearance,
+ sbarBgndAppearance,
+ sliderFill,
+ tooltipAppearance;
+ EShade shadeSliders,
+ shadeMenubars,
+ menuStripe,
+ shadeCheckRadio,
+ comboBtn,
+ sortedLv,
+ crColor,
+ progressColor;
+ EColor progressGrooveColor;
+ EEffect buttonEffect;
+ EScrollbar scrollbarType;
+ EFocus focus;
+ color customMenubarsColor,
+ customSlidersColor,
+ customMenuNormTextColor,
+ customMenuSelTextColor,
+ customMenuStripeColor,
+ customCheckRadioColor,
+ customComboBtnColor,
+ customSortedLvColor,
+ customCrBgndColor,
+ customProgressColor;
+ EShading shading;
+#if defined __cplusplus
+ EAlign titlebarAlignment;
+ EEffect titlebarEffect;
+ bool centerTabText;
+#endif
+ double customShades[NUM_STD_SHADES],
+ customAlphas[NUM_STD_ALPHAS];
+#ifdef __cplusplus
+ GradientCont customGradient;
+#else
+ Gradient *customGradient[NUM_CUSTOM_GRAD];
+#endif
+ QtCImage bgndImage,
+ menuBgndImage;
+#if !defined __cplusplus || (defined QT_VERSION && (QT_VERSION >= 0x040000))
+ /* NOTE: If add any more settings here, need to alter copyOpts/freeOpts/defaultSettings in config_file.c */
+ Strings noBgndGradientApps,
+ noBgndOpacityApps,
+ noMenuBgndOpacityApps,
+ noBgndImageApps;
+#endif
+#ifdef QTC_ENABLE_PARENTLESS_DIALOG_FIX_SUPPORT
+ Strings noDlgFixApps;
+#endif
+ Strings noMenuStripeApps;
+#if defined QT_VERSION && (QT_VERSION >= 0x040000)
+ Strings menubarApps,
+ statusbarApps,
+ useQtFileDialogApps,
+ windowDragWhiteList,
+ windowDragBlackList;
+#endif
+
+#ifndef __cplusplus
+} Options;
+#else
+};
+#endif
+
+#ifdef COMMON_FUNCTIONS
+
+#ifndef MIN
+#define MIN(a, b) ((a) < (b) ? (a) : (b))
+#endif
+#ifndef MAX
+#define MAX(a, b) ((b) < (a) ? (a) : (b))
+#endif
/* Taken from rgb->hsl routines taken from KColor
Copyright 2007 Matthew Woehlke <mw_triad@users.sourceforge.net>
@@ -551,8 +1274,8 @@ static inline double h2c(double h, double m1, double m2)
static inline void rgbToHsl(double r, double g, double b, double *h, double *s, double *l)
{
- double min=QTC_MIN(QTC_MIN(r, g), b),
- max=QTC_MAX(QTC_MAX(r, g), b);
+ double min=MIN(MIN(r, g), b),
+ max=MAX(MAX(r, g), b);
*l = 0.5 * (max + min);
*s = 0.0;
@@ -600,29 +1323,30 @@ static inline void hslToRgb(double h, double s, double l, double *r, double *g,
static void rgbToHsv(double r, double g, double b, double *h, double *s, double *v)
{
- double min=QTC_MIN(QTC_MIN(r, g), b),
- max=QTC_MAX(QTC_MAX(r, g), b),
+ double min=MIN(MIN(r, g), b),
+ max=MAX(MAX(r, g), b),
delta=max - min;
*v=max;
if(max != 0)
*s=delta / max;
else
- {
- /* r=g=b=0 s=0, v is undefined */
*s=0;
- *h=-1;
- return;
- }
- if(r == max)
- *h=(g - b) / delta; /* between yellow & magenta */
- else if(g == max)
- *h=2 + (b - r) / delta; /* between cyan & yellow */
+
+ if (*s==0.0)
+ *h = 0.0;
else
- *h=4 + (r - g) / delta; /* between magenta & cyan */
- *h *= 60; /* degrees */
- if(*h < 0)
- *h += 360;
+ {
+ if(r == max)
+ *h=(g - b) / delta; /* between yellow & magenta */
+ else if(g == max)
+ *h=2 + (b - r) / delta; /* between cyan & yellow */
+ else if(b == max)
+ *h=4 + (r - g) / delta; /* between magenta & cyan */
+ *h *= 60; /* degrees */
+ if(*h < 0)
+ *h += 360;
+ }
}
static void hsvToRgb(double *r, double *g, double *b, double h, double s, double v)
@@ -692,10 +1416,26 @@ inline int limit(double c)
}
#endif
+#if defined QT_VERSION && (QT_VERSION >= 0x040000) && !defined QTC_QT_ONLY
+#include <KDE/KColorUtils>
+#define tint(COLA, COLB, FACTOR) KColorUtils::tint((COLA), (COLB), (FACTOR))
+#define midColor(COLA, COLB) KColorUtils::mix((COLA), (COLB), 0.5)
+#else
+#include "colorutils.c"
+#ifdef __cplusplus
+#define tint(COLA, COLB, FACTOR) ColorUtils_tint(&(COLA), &(COLB), (FACTOR))
+#define midColor(COLA, COLB) ColorUtils_mix(&(COLA), &(COLB), 0.5)
+#define midColorF(COLA, COLB, FACTOR) ColorUtils_mix(&(COLA), &(COLB), FACTOR-0.5)
+#else
+#define tint(COLA, COLB, FACTOR) ColorUtils_tint((COLA), (COLB), (FACTOR))
+#define midColor(COLA, COLB) ColorUtils_mix((COLA), (COLB), 0.5)
+#endif
+#endif
+
#ifdef __cplusplus
-static void shade(const color &ca, color *cb, double k)
+static void shade(const Options *opts, const color &ca, color *cb, double k)
#else
-static void shade(const color *ca, color *cb, double k)
+static void shade(const Options *opts, const color *ca, color *cb, double k)
#endif
{
if(equal(k, 1.0))
@@ -709,7 +1449,7 @@ static void shade(const color *ca, color *cb, double k)
#endif
}
else
- switch(shading)
+ switch(opts->shading)
{
case SHADING_SIMPLE:
{
@@ -783,10 +1523,38 @@ static void shade(const color *ca, color *cb, double k)
cb->green=limit(g*65535.0);
cb->blue=limit(b*65535.0);
#endif
+ break;
+ }
+ case SHADING_HCY:
+ {
+ #define HCY_FACTOR 0.15
+ #if defined QT_VERSION && (QT_VERSION >= 0x040000) && !defined QTC_QT_ONLY
+ if(k>1.0)
+ *cb=KColorUtils::lighten(ca, (k*(1+HCY_FACTOR))-1.0, 1.0);
+ else
+ *cb=KColorUtils::darken(ca, 1.0-(k*(1-HCY_FACTOR)), 1.0);
+ #elif defined __cplusplus
+ if(k>1.0)
+ *cb=ColorUtils_lighten(&ca, (k*(1+HCY_FACTOR))-1.0, 1.0);
+ else
+ *cb=ColorUtils_darken(&ca, 1.0-(k*(1-HCY_FACTOR)), 1.0);
+ #else
+ if(k>1.0)
+ *cb=ColorUtils_lighten(ca, (k*(1+HCY_FACTOR))-1.0, 1.0);
+ else
+ *cb=ColorUtils_darken(ca, 1.0-(k*(1-HCY_FACTOR)), 1.0);
+ #endif
}
}
+#if defined __cplusplus && defined QT_VERSION && (QT_VERSION >= 0x040000)
+ cb->setAlpha(ca.alpha());
+#endif
+#ifndef __cplusplus
+ cb->pixel = ca->pixel;
+#endif
}
+#if (!defined CONFIG_DIALOG)
static unsigned char checkBounds(int num)
{
return num < 0 ? 0 :
@@ -835,121 +1603,445 @@ static void adjustPix(unsigned char *data, int numChannels, int w, int h, int st
offset+=stride;
}
}
-#endif /* QTC_COMMON_NO_FUNCTIONS */
+#endif
+
+static void setupGradient(Gradient *grad, EGradientBorder border, int numStops, ...)
+{
+ va_list ap;
+ int i;
+ grad->border=border;
+#ifndef __cplusplus
+ grad->numStops=numStops;
+ grad->stops=malloc(sizeof(GradientStop) * numStops);
+#endif
+ va_start(ap, numStops);
+ for(i=0; i<numStops; ++i)
+ {
+ double pos=va_arg(ap, double),
+ val=va_arg(ap, double);
#ifdef __cplusplus
-struct Options
+ grad->stops.insert(GradientStop(pos, val));
#else
-typedef struct
+ grad->stops[i].pos=pos;
+ grad->stops[i].val=val;
+ grad->stops[i].alpha=1.0;
#endif
+ }
+ va_end(ap);
+}
+
+static const Gradient * getGradient(EAppearance app, const Options *opts)
{
- int contrast,
- passwordChar;
- double highlightFactor;
- ERound round;
- bool embolden,
- lighterPopupMenuBgnd,
- highlightTab,
- colorSelTab,
- animatedProgress,
- fixParentlessDialogs,
- customMenuTextColor,
- menubarMouseOver,
- shadeMenubarOnlyWhenActive,
- thinnerMenuItems,
-#ifndef QTC_PLAIN_FOCUS_ONLY
- stdFocus,
-#endif
- lvLines,
- drawStatusBarFrames,
- fillSlider,
- roundMbTopOnly,
- gradientPbGroove,
+ if(IS_CUSTOM(app))
+ {
#ifdef __cplusplus
- stdSidebarButtons,
- gtkScrollViews,
- gtkComboMenus,
-/*
+ GradientCont::const_iterator grad(opts->customGradient.find(app));
+
+ if(grad!=opts->customGradient.end())
+ return &((*grad).second);
#else
- setDialogButtonOrder,
-*/
-#endif
-#if !defined __cplusplus || defined QTC_CONFIG_DIALOG
- mapKdeIcons,
-#endif
-#if defined QTC_CONFIG_DIALOG || (defined QT_VERSION && (QT_VERSION >= 0x040000)) || !defined __cplusplus
- gtkButtonOrder,
+ Gradient *grad=opts->customGradient[app-APPEARANCE_CUSTOM1];
+
+ if(grad)
+ return grad;
#endif
- borderMenuitems,
- colorMenubarMouseOver,
- darkerBorders,
- vArrows,
- xCheck,
- framelessGroupBoxes,
- inactiveHighlight;
- EStripe stripedProgress;
- ESliderStyle sliderStyle;
- EMouseOver coloredMouseOver;
- ETBarBorder toolbarBorders;
- EDefBtnIndicator defBtnIndicator;
- ELine sliderThumbs,
- handles,
- toolbarSeparators,
- splitters;
- EAppearance appearance,
- menubarAppearance,
- menuitemAppearance,
- toolbarAppearance,
- lvAppearance,
- tabAppearance,
- sliderAppearance,
- progressAppearance;
- EShade shadeSliders,
- shadeMenubars,
- shadeCheckRadio;
- EEffect buttonEffect;
- EScrollbar scrollbarType;
- color customMenubarsColor,
- customSlidersColor,
- customMenuNormTextColor,
- customMenuSelTextColor,
- customCheckRadioColor;
- #ifdef QTC_CONFIG_DIALOG
- EShading shading;
- #endif
-#ifndef __cplusplus
-} Options;
-#else
-};
+ app=APPEARANCE_RAISED;
+ }
+
+ {
+ static Gradient stdGradients[NUM_STD_APP];
+ static bool init=false;
+
+ if(!init)
+ {
+ setupGradient(&stdGradients[APPEARANCE_FLAT-APPEARANCE_FLAT], GB_3D,2,0.0,1.0,1.0,1.0);
+ setupGradient(&stdGradients[APPEARANCE_RAISED-APPEARANCE_FLAT], GB_3D_FULL,2,0.0,1.0,1.0,1.0);
+ setupGradient(&stdGradients[APPEARANCE_DULL_GLASS-APPEARANCE_FLAT], GB_LIGHT,4,0.0,1.05,0.499,0.984,0.5,0.928,1.0,1.0);
+ setupGradient(&stdGradients[APPEARANCE_SHINY_GLASS-APPEARANCE_FLAT], GB_LIGHT,4,0.0,1.2,0.499,0.984,0.5,0.9,1.0,1.06);
+ setupGradient(&stdGradients[APPEARANCE_AGUA-APPEARANCE_FLAT], GB_SHINE, 2,0.0,0.6,1.0,1.1);
+ setupGradient(&stdGradients[APPEARANCE_SOFT_GRADIENT-APPEARANCE_FLAT], GB_3D,2,0.0,1.04,1.0,0.98);
+ setupGradient(&stdGradients[APPEARANCE_GRADIENT-APPEARANCE_FLAT], GB_3D,2,0.0,1.1,1.0,0.94);
+ setupGradient(&stdGradients[APPEARANCE_HARSH_GRADIENT-APPEARANCE_FLAT], GB_3D,2,0.0,1.3,1.0,0.925);
+ setupGradient(&stdGradients[APPEARANCE_INVERTED-APPEARANCE_FLAT], GB_3D,2,0.0,0.93,1.0,1.04);
+ setupGradient(&stdGradients[APPEARANCE_DARK_INVERTED-APPEARANCE_FLAT], GB_NONE,3,0.0,0.8,0.7,0.95,1.0,1.0);
+ setupGradient(&stdGradients[APPEARANCE_SPLIT_GRADIENT-APPEARANCE_FLAT], GB_3D,4,0.0,1.06,0.499,1.004,0.5,0.986,1.0,0.92);
+ setupGradient(&stdGradients[APPEARANCE_BEVELLED-APPEARANCE_FLAT], GB_3D,4,0.0,1.05,0.1,1.02,0.9,0.985,1.0,0.94);
+ setupGradient(&stdGradients[APPEARANCE_LV_BEVELLED-APPEARANCE_FLAT], GB_3D,3,0.0,1.00,0.85,1.0,1.0,0.90);
+ setupGradient(&stdGradients[APPEARANCE_AGUA_MOD-APPEARANCE_FLAT], GB_NONE,3,0.0,1.5,0.49,0.85,1.0,1.3);
+ setupGradient(&stdGradients[APPEARANCE_LV_AGUA-APPEARANCE_FLAT], GB_NONE,4,0.0,0.98,0.35,0.95,0.4,0.93,1.0,1.15);
+ init=true;
+ }
+
+ return &stdGradients[app-APPEARANCE_FLAT];
+ }
+
+ return 0L; /* Will never happen! */
+}
+
#endif
-#if defined QTC_COMMON_FUNCTIONS && !defined QTC_CONFIG_DIALOG
+#if defined COMMON_FUNCTIONS && !defined CONFIG_DIALOG
+
+#ifdef __cplusplus
+static EAppearance widgetApp(EWidget w, const Options *opts, bool active=true)
+#else
static EAppearance widgetApp(EWidget w, const Options *opts)
+#endif
{
switch(w)
{
+ case WIDGET_SB_BGND:
+ return opts->sbarBgndAppearance;
case WIDGET_LISTVIEW_HEADER:
return opts->lvAppearance;
case WIDGET_SB_BUTTON:
case WIDGET_SLIDER:
case WIDGET_SB_SLIDER:
return opts->sliderAppearance;
+ case WIDGET_FILLED_SLIDER_TROUGH:
+ return opts->sliderFill;
case WIDGET_TAB_TOP:
case WIDGET_TAB_BOT:
return opts->tabAppearance;
case WIDGET_MENU_ITEM:
return opts->menuitemAppearance;
case WIDGET_PROGRESSBAR:
+#ifndef __cplusplus
+ case WIDGET_ENTRY_PROGRESSBAR:
+#endif
return opts->progressAppearance;
+ case WIDGET_PBAR_TROUGH:
+ return opts->progressGrooveAppearance;
+ case WIDGET_SELECTION:
+ return opts->selectionAppearance;
+#ifdef __cplusplus
+ case WIDGET_DOCK_WIDGET_TITLE:
+ return opts->dwtAppearance;
+ case WIDGET_MDI_WINDOW:
+ case WIDGET_MDI_WINDOW_TITLE:
+ return active ? opts->titlebarAppearance : opts->inactiveTitlebarAppearance;
+ case WIDGET_MDI_WINDOW_BUTTON:
+ return opts->titlebarButtonAppearance;
+ case WIDGET_DIAL:
+ return IS_FLAT(opts->appearance) ? APPEARANCE_RAISED : APPEARANCE_SOFT_GRADIENT;
+#endif
+ case WIDGET_TROUGH:
case WIDGET_SLIDER_TROUGH:
- return APPEARANCE_FLAT==opts->appearance || APPEARANCE_RAISED==opts->appearance
- ? APPEARANCE_FLAT : APPEARANCE_GRADIENT;
+ return opts->grooveAppearance;
+#ifndef __cplusplus
+ case WIDGET_SPIN_UP:
+ case WIDGET_SPIN_DOWN:
+#endif
+ case WIDGET_SPIN:
+ return MODIFY_AGUA(opts->appearance);
default:
break;
}
return opts->appearance;
};
+
+#define MIN_ROUND_FULL_SIZE 8
+#ifdef __cplusplus
+#define MIN_ROUND_EXTRA_SIZE(W) (WIDGET_SPIN==(W) ? 7 : 14)
+#else
+#define MIN_ROUND_EXTRA_SIZE(W) (WIDGET_SPIN_UP==(W) || WIDGET_SPIN_DOWN==(W) || WIDGET_SPIN==(W) ? 7 : 14)
+#endif
+#define MIN_ROUND_MAX_HEIGHT 12
+#define MIN_ROUND_MAX_WIDTH 24
+
+#if !defined __cplusplus || (defined QT_VERSION && (QT_VERSION >= 0x040000))
+
+#if defined __cplusplus
+#define EXTRA_INNER_RADIUS 3.5
+#define EXTRA_OUTER_RADIUS 4.5
+#define EXTRA_ETCH_RADIUS 5.5
+#define FULL_INNER_RADIUS 1.5
+#define FULL_OUTER_RADIUS 2.5
+#define FULL_ETCH_RADIUS 3.5
+
+#if defined QT_VERSION && (QT_VERSION < 0x040600)
+#define SLIGHT_INNER_RADIUS 0.5
+#define SLIGHT_OUTER_RADIUS 1.5
+#define SLIGHT_ETCH_RADIUS 2.5
+#else
+#define SLIGHT_INNER_RADIUS 0.75
+#define SLIGHT_OUTER_RADIUS 1.75
+#define SLIGHT_ETCH_RADIUS 2.75
#endif
+#else
+#define EXTRA_INNER_RADIUS 4
+#define EXTRA_OUTER_RADIUS 5
+#define EXTRA_ETCH_RADIUS 6
+#define FULL_INNER_RADIUS 2
+#define FULL_OUTER_RADIUS 3
+#define FULL_ETCH_RADIUS 4
+#define SLIGHT_INNER_RADIUS 1
+#define SLIGHT_OUTER_RADIUS 2
+#define SLIGHT_ETCH_RADIUS 3
#endif
+
+#define MAX_RADIUS_INTERNAL 9.0
+#define MAX_RADIUS_EXTERNAL (MAX_RADIUS_INTERNAL+2.0)
+
+typedef enum
+{
+ RADIUS_SELECTION,
+ RADIUS_INTERNAL,
+ RADIUS_EXTERNAL,
+ RADIUS_ETCH
+} ERadius;
+
+#ifdef __cplusplus
+#define IS_MAX_ROUND_WIDGET(A) \
+ (WIDGET_STD_BUTTON==A || WIDGET_DEF_BUTTON==A /*|| WIDGET_MENU_BUTTON==A*/)
+#define IS_EXTRA_ROUND_WIDGET(A) \
+ (A!=WIDGET_MENU_ITEM && A!=WIDGET_TAB_FRAME && A!=WIDGET_PBAR_TROUGH && A!=WIDGET_PROGRESSBAR && \
+ A!=WIDGET_MDI_WINDOW && A!=WIDGET_MDI_WINDOW_TITLE)
+#else
+#define IS_MAX_ROUND_WIDGET(A) \
+ (WIDGET_STD_BUTTON==A || WIDGET_DEF_BUTTON==A || WIDGET_TOGGLE_BUTTON==A /*|| WIDGET_MENU_BUTTON==A*/)
+#define IS_EXTRA_ROUND_WIDGET(A) \
+ (A!=WIDGET_MENU_ITEM && A!=WIDGET_TAB_FRAME && A!=WIDGET_PBAR_TROUGH && A!=WIDGET_PROGRESSBAR)
+#endif
+
+#define CAN_EXTRA_ROUND(MOD) \
+ (IS_EXTRA_ROUND_WIDGET(widget) && \
+ (IS_SLIDER(widget) || WIDGET_TROUGH==widget || \
+ ( ( (w>(MIN_ROUND_EXTRA_SIZE(widget)+MOD)) || (WIDGET_NO_ETCH_BTN==widget || WIDGET_MENU_BUTTON==widget) ) &&\
+ (h>(MIN_ROUND_EXTRA_SIZE(widget)+MOD)))))
+#define CAN_FULL_ROUND(MOD) (w>(MIN_ROUND_FULL_SIZE+MOD) && h>(MIN_ROUND_FULL_SIZE+MOD))
+
+// **NOTE** MUST KEEP IN SYNC WITH getRadius/RADIUS_ETCH !!!
+ERound getWidgetRound(const Options *opts, int w, int h, EWidget widget)
+{
+ ERound r=opts->round;
+
+ if( ((WIDGET_PBAR_TROUGH==widget || WIDGET_PROGRESSBAR==widget) && (opts->square&SQUARE_PROGRESS)) ||
+ (WIDGET_ENTRY==widget && (opts->square&SQUARE_ENTRY)) )
+ return ROUND_NONE;
+
+ if((WIDGET_CHECKBOX==widget || WIDGET_FOCUS==widget) && ROUND_NONE!=r)
+ r=ROUND_SLIGHT;
+
+#if defined __cplusplus && (defined QT_VERSION && (QT_VERSION >= 0x040000))
+ if((WIDGET_MDI_WINDOW_BUTTON==widget && (opts->titlebarButtons&TITLEBAR_BUTTON_ROUND)) ||
+ WIDGET_RADIO_BUTTON==widget || WIDGET_DIAL==widget)
+ return ROUND_MAX;
+#endif
+#ifndef __cplusplus
+ if(WIDGET_RADIO_BUTTON==widget)
+ return ROUND_MAX;
+#endif
+
+#if !defined __cplusplus || (defined QT_VERSION && (QT_VERSION >= 0x040000))
+ if(WIDGET_SLIDER==widget &&
+ (SLIDER_ROUND==opts->sliderStyle || SLIDER_ROUND_ROTATED==opts->sliderStyle || SLIDER_CIRCULAR==opts->sliderStyle))
+ return ROUND_MAX;
+#endif
+
+ switch(r)
+ {
+ case ROUND_MAX:
+ if(IS_SLIDER(widget) || WIDGET_TROUGH==widget ||
+ (w>(MIN_ROUND_MAX_WIDTH+2) && h>(MIN_ROUND_MAX_HEIGHT+2) && IS_MAX_ROUND_WIDGET(widget)))
+ return ROUND_MAX;
+ case ROUND_EXTRA:
+ if(CAN_EXTRA_ROUND(2))
+ return ROUND_EXTRA;
+ case ROUND_FULL:
+ if(CAN_FULL_ROUND(2))
+ return ROUND_FULL;
+ case ROUND_SLIGHT:
+ return ROUND_SLIGHT;
+ case ROUND_NONE:
+ return ROUND_NONE;
+ }
+
+ return ROUND_NONE;
+}
+
+static double getRadius(const Options *opts, int w, int h, EWidget widget, ERadius rad)
+{
+ ERound r=opts->round;
+
+ if((WIDGET_CHECKBOX==widget || WIDGET_FOCUS==widget) && ROUND_NONE!=r)
+ r=ROUND_SLIGHT;
+
+ if( ((WIDGET_PBAR_TROUGH==widget || WIDGET_PROGRESSBAR==widget) && (opts->square&SQUARE_PROGRESS)) ||
+ (WIDGET_ENTRY==widget && (opts->square&SQUARE_ENTRY)) )
+ return 0.0;
+
+#if defined __cplusplus && (defined QT_VERSION && (QT_VERSION >= 0x040000))
+ if((WIDGET_MDI_WINDOW_BUTTON==widget && (opts->titlebarButtons&TITLEBAR_BUTTON_ROUND)) ||
+ WIDGET_RADIO_BUTTON==widget || WIDGET_DIAL==widget)
+ return (w>h ? h : w)/2.0;
+#endif
+#ifndef __cplusplus
+ if(WIDGET_RADIO_BUTTON==widget)
+ return (w>h ? h : w)/2.0;
+#endif
+
+#if !defined __cplusplus || (defined QT_VERSION && (QT_VERSION >= 0x040000))
+ if(WIDGET_SLIDER==widget &&
+ (SLIDER_ROUND==opts->sliderStyle || SLIDER_ROUND_ROTATED==opts->sliderStyle || SLIDER_CIRCULAR==opts->sliderStyle))
+ return (w>h ? h : w)/2.0;
+#endif
+
+ if(RADIUS_EXTERNAL==rad && !opts->fillProgress && (WIDGET_PROGRESSBAR==widget
+#ifndef __cplusplus
+ || WIDGET_ENTRY_PROGRESSBAR==widget
+#endif
+ ))
+ rad=RADIUS_INTERNAL;
+
+ switch(rad)
+ {
+ case RADIUS_SELECTION:
+ switch(r)
+ {
+ case ROUND_MAX:
+ case ROUND_EXTRA:
+ if(/* (WIDGET_RUBBER_BAND==widget && w>14 && h>14) || */(w>48 && h>48))
+ return 6.0;
+ case ROUND_FULL:
+// if( /*(WIDGET_RUBBER_BAND==widget && w>11 && h>11) || */(w>48 && h>48))
+// return 3.0;
+ if(w>MIN_ROUND_FULL_SIZE && h>MIN_ROUND_FULL_SIZE)
+ return 3.0;
+ case ROUND_SLIGHT:
+ return 2.0;
+ case ROUND_NONE:
+ return 0;
+ }
+ case RADIUS_INTERNAL:
+ switch(r)
+ {
+ case ROUND_MAX:
+ if(IS_SLIDER(widget) || WIDGET_TROUGH==widget)
+ {
+ double r=((w>h ? h : w)-(WIDGET_SLIDER==widget ? 1 : 0))/2.0;
+ return r>MAX_RADIUS_INTERNAL ? MAX_RADIUS_INTERNAL : r;
+ }
+ if(w>(MIN_ROUND_MAX_WIDTH-2) && h>(MIN_ROUND_MAX_HEIGHT-2) && IS_MAX_ROUND_WIDGET(widget))
+ {
+ double r=((w>h ? h : w)-2.0)/2.0;
+ return r>9.5 ? 9.5 : r;
+ }
+ case ROUND_EXTRA:
+ if(CAN_EXTRA_ROUND(-2))
+ return EXTRA_INNER_RADIUS;
+ case ROUND_FULL:
+ if(CAN_FULL_ROUND(-2))
+ return FULL_INNER_RADIUS;
+ case ROUND_SLIGHT:
+ return SLIGHT_INNER_RADIUS;
+ case ROUND_NONE:
+ return 0;
+ }
+ case RADIUS_EXTERNAL:
+ switch(r)
+ {
+ case ROUND_MAX:
+ if(IS_SLIDER(widget) || WIDGET_TROUGH==widget)
+ {
+ double r=((w>h ? h : w)-(WIDGET_SLIDER==widget ? 1 : 0))/2.0;
+ return r>MAX_RADIUS_EXTERNAL ? MAX_RADIUS_EXTERNAL : r;
+ }
+ if(w>MIN_ROUND_MAX_WIDTH && h>MIN_ROUND_MAX_HEIGHT && IS_MAX_ROUND_WIDGET(widget))
+ {
+ double r=((w>h ? h : w)-2.0)/2.0;
+ return r>10.5 ? 10.5 : r;
+ }
+ case ROUND_EXTRA:
+ if(CAN_EXTRA_ROUND(0))
+ return EXTRA_OUTER_RADIUS;
+ case ROUND_FULL:
+ if(CAN_FULL_ROUND(0))
+ return FULL_OUTER_RADIUS;
+ case ROUND_SLIGHT:
+ return SLIGHT_OUTER_RADIUS;
+ case ROUND_NONE:
+ return 0;
+ }
+ case RADIUS_ETCH:
+ // **NOTE** MUST KEEP IN SYNC WITH getWidgetRound !!!
+ switch(r)
+ {
+ case ROUND_MAX:
+ if(IS_SLIDER(widget) || WIDGET_TROUGH==widget)
+ {
+ double r=((w>h ? h : w)-(WIDGET_SLIDER==widget ? 1 : 0))/2.0;
+ return r>MAX_RADIUS_EXTERNAL ? MAX_RADIUS_EXTERNAL : r;
+ }
+ if(w>(MIN_ROUND_MAX_WIDTH+2) && h>(MIN_ROUND_MAX_HEIGHT+2) && IS_MAX_ROUND_WIDGET(widget))
+ {
+ double r=((w>h ? h : w)-2.0)/2.0;
+ return r>11.5 ? 11.5 : r;
+ }
+ case ROUND_EXTRA:
+ if(CAN_FULL_ROUND(2))
+ return EXTRA_ETCH_RADIUS;
+ case ROUND_FULL:
+ if(w>(MIN_ROUND_FULL_SIZE+2) && h>(MIN_ROUND_FULL_SIZE+2))
+ return FULL_ETCH_RADIUS;
+ case ROUND_SLIGHT:
+ return SLIGHT_ETCH_RADIUS;
+ case ROUND_NONE:
+ return 0;
+ }
+ }
+
+ return 0;
+}
+
+static double qtcRingAlpha[3]={0.125, 0.125, 0.5};
+
+static void calcRingAlphas(const color *bgnd)
+{
+#ifdef __cplusplus
+ double r=bgnd->red()/255.0,
+ g=bgnd->green()/255.0,
+ b=bgnd->blue()/255.0,
+#else
+ double r=bgnd->red/65535.0,
+ g=bgnd->green/65535.0,
+ b=bgnd->blue/65535.0,
+#endif
+ h=0,
+ s=0,
+ v=0;
+ rgbToHsv(r, g, b, &h, &s, &v);
+ qtcRingAlpha[0]=v*0.26;
+ qtcRingAlpha[1]=v*0.14;
+ qtcRingAlpha[2]=v*0.55;
+}
+
+#define BGND_SHINE_SIZE 300
+#define BGND_SHINE_STEPS 8
+
+static double shineAlpha(const color *bgnd)
+{
+#ifdef __cplusplus
+ double r=bgnd->red()/255.0,
+ g=bgnd->green()/255.0,
+ b=bgnd->blue()/255.0,
+#else
+ double r=bgnd->red/65535.0,
+ g=bgnd->green/65535.0,
+ b=bgnd->blue/65535.0,
+#endif
+ h=0,
+ s=0,
+ v=0;
+ rgbToHsv(r, g, b, &h, &s, &v);
+ return v*0.8;
+}
+
+#endif
+
+#endif
+
+#endif // __COMMON_H__
diff --git a/common/config_file.c b/common/config_file.c
index 930ce21..7174286 100644
--- a/common/config_file.c
+++ b/common/config_file.c
@@ -1,5 +1,5 @@
-/*
- QtCurve (C) Craig Drummond, 2003 - 2007 Craig.Drummond@lycos.co.uk
+ /*
+ QtCurve (C) Craig Drummond, 2003 - 2010 craig.p.drummond@gmail.com
----
@@ -23,15 +23,40 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
-#include <pwd.h>
#include <sys/types.h>
-#define QTC_MAX_FILENAME_LEN 1024
-#define QTC_MAX_INPUT_LINE_LEN 256
-#define QTC_FILE "qtcurvestylerc"
+#ifndef _WIN32
+#include <unistd.h>
+#include <pwd.h>
+#endif
+
+#define MAKE_VERSION(a, b) (((a) << 16) | ((b) << 8))
+#define MAKE_VERSION3(a, b, c) (((a) << 16) | ((b) << 8) | (c))
+
+#define MAX_CONFIG_FILENAME_LEN 1024
+#define MAX_CONFIG_INPUT_LINE_LEN 256
+#define CONFIG_FILE "stylerc"
+#define OLD_CONFIG_FILE "qtcurvestylerc"
+#define VERSION_KEY "version"
+
+#ifdef __cplusplus
+
+#if QT_VERSION >= 0x040000
+#include <QMap>
+#include <QFile>
+#include <QTextStream>
+#define TO_LATIN1(A) A.toLatin1().constData()
+#else
+#define TO_LATIN1(A) A.latin1()
+
+#include <qmap.h>
+#include <qfile.h>
+#include <qtextstream.h>
+#endif
+
+#endif // __cplusplus
#ifdef CONFIG_READ
static int c2h(char ch)
@@ -78,6 +103,14 @@ static EDefBtnIndicator toInd(const char *str, EDefBtnIndicator def)
return IND_CORNER;
if(0==memcmp(str, "colored", 7))
return IND_COLORED;
+ if(0==memcmp(str, "tint", 4))
+ return IND_TINT;
+ if(0==memcmp(str, "glow", 4))
+ return IND_GLOW;
+ if(0==memcmp(str, "darken", 6))
+ return IND_DARKEN;
+ if(0==memcmp(str, "origselected", 12))
+ return IND_SELECTED;
}
return def;
@@ -97,6 +130,8 @@ static ELine toLine(const char *str, ELine def)
return LINE_DOTS;
if(0==memcmp(str, "flat", 4))
return LINE_FLAT;
+ if(0==memcmp(str, "1dot", 5))
+ return LINE_1DOT;
}
return def;
}
@@ -121,15 +156,19 @@ static EMouseOver toMouseOver(const char *str, EMouseOver def)
{
if(0==memcmp(str, "true", 4) || 0==memcmp(str, "colored", 7))
return MO_COLORED;
+ if(0==memcmp(str, "thickcolored", 12))
+ return MO_COLORED_THICK;
if(0==memcmp(str, "plastik", 7))
return MO_PLASTIK;
+ if(0==memcmp(str, "glow", 4))
+ return MO_GLOW;
if(0==memcmp(str, "false", 4) || 0==memcmp(str, "none", 4))
return MO_NONE;
}
return def;
}
-static EAppearance toAppearance(const char *str, EAppearance def)
+static EAppearance toAppearance(const char *str, EAppearance def, EAppAllow allow)
{
if(str)
{
@@ -137,35 +176,69 @@ static EAppearance toAppearance(const char *str, EAppearance def)
return APPEARANCE_FLAT;
if(0==memcmp(str, "raised", 6))
return APPEARANCE_RAISED;
- if(0==memcmp(str, "gradient", 8) || 0==memcmp(str, "lightgradient", 13))
- return APPEARANCE_GRADIENT;
- if(0==memcmp(str, "splitgradient", 13))
- return APPEARANCE_SPLIT_GRADIENT;
- if(0==memcmp(str, "glass", 5) || 0==memcmp(str, "shinyglass", 10))
- return APPEARANCE_SHINY_GLASS;
if(0==memcmp(str, "dullglass", 9))
return APPEARANCE_DULL_GLASS;
+ if(0==memcmp(str, "glass", 5) || 0==memcmp(str, "shinyglass", 10))
+ return APPEARANCE_SHINY_GLASS;
+ if(0==memcmp(str, "agua", 4))
+#if defined __cplusplus && !defined CONFIG_DIALOG && defined QT_VERSION && QT_VERSION < 0x040000
+ return APPEARANCE_AGUA_MOD;
+#else
+ return APPEARANCE_AGUA;
+#endif
+ if(0==memcmp(str, "soft", 4))
+ return APPEARANCE_SOFT_GRADIENT;
+ if(0==memcmp(str, "gradient", 8) || 0==memcmp(str, "lightgradient", 13))
+ return APPEARANCE_GRADIENT;
+ if(0==memcmp(str, "harsh", 5))
+ return APPEARANCE_HARSH_GRADIENT;
if(0==memcmp(str, "inverted", 8))
return APPEARANCE_INVERTED;
+ if(0==memcmp(str, "darkinverted", 12))
+ return APPEARANCE_DARK_INVERTED;
+ if(0==memcmp(str, "splitgradient", 13))
+ return APPEARANCE_SPLIT_GRADIENT;
if(0==memcmp(str, "bevelled", 8))
return APPEARANCE_BEVELLED;
+ if(APP_ALLOW_FADE==allow && 0==memcmp(str, "fade", 4))
+ return APPEARANCE_FADE;
+ if(APP_ALLOW_STRIPED==allow && 0==memcmp(str, "striped", 7))
+ return APPEARANCE_STRIPED;
+ if(APP_ALLOW_NONE==allow && 0==memcmp(str, "none", 4))
+ return APPEARANCE_NONE;
+
+ if(0==memcmp(str, "customgradient", 14) && strlen(str)>14)
+ {
+ int i=atoi(&str[14]);
+
+ i--;
+ if(i>=0 && i<NUM_CUSTOM_GRAD)
+ return (EAppearance)(APPEARANCE_CUSTOM1+i);
+ }
}
return def;
}
-static EShade toShade(const char *str, bool allowDarken, EShade def)
+static EShade toShade(const char *str, bool allowMenu, EShade def, bool menuShade, color *col)
{
if(str)
{
/* true/false is from 0.25... */
- if(0==memcmp(str, "true", 4) || 0==memcmp(str, "selected", 8))
+ if((!menuShade && 0==memcmp(str, "true", 4)) || 0==memcmp(str, "selected", 8))
return SHADE_BLEND_SELECTED;
if(0==memcmp(str, "origselected", 12))
return SHADE_SELECTED;
- if(allowDarken && 0==memcmp(str, "darken", 6))
+ if(allowMenu && (0==memcmp(str, "darken", 6) || (menuShade && 0==memcmp(str, "true", 4))))
return SHADE_DARKEN;
+ if(allowMenu && 0==memcmp(str, "wborder", 7))
+ return SHADE_WINDOW_BORDER;
if(0==memcmp(str, "custom", 6))
return SHADE_CUSTOM;
+ if('#'==str[0] && col)
+ {
+ setRgb(col, str);
+ return SHADE_CUSTOM;
+ }
if(0==memcmp(str, "none", 4))
return SHADE_NONE;
}
@@ -184,6 +257,10 @@ static ERound toRound(const char *str, ERound def)
return ROUND_SLIGHT;
if(0==memcmp(str, "full", 4))
return ROUND_FULL;
+ if(0==memcmp(str, "extra", 5))
+ return ROUND_EXTRA;
+ if(0==memcmp(str, "max", 3))
+ return ROUND_MAX;
}
return def;
@@ -208,6 +285,25 @@ static EScrollbar toScrollbar(const char *str, EScrollbar def)
return def;
}
+static EFrame toFrame(const char *str, EFrame def)
+{
+ if(str)
+ {
+ if(0==memcmp(str, "none", 4))
+ return FRAME_NONE;
+ if(0==memcmp(str, "plain", 5))
+ return FRAME_PLAIN;
+ if(0==memcmp(str, "line", 4))
+ return FRAME_LINE;
+ if(0==memcmp(str, "shaded", 6))
+ return FRAME_SHADED;
+ if(0==memcmp(str, "faded", 5))
+ return FRAME_FADED;
+ }
+
+ return def;
+}
+
static EEffect toEffect(const char *str, EEffect def)
{
if(str)
@@ -223,7 +319,7 @@ static EEffect toEffect(const char *str, EEffect def)
return def;
}
-static EShading toShading(const char * str, EShading def)
+static EShading toShading(const char *str, EShading def)
{
if(str)
{
@@ -233,12 +329,14 @@ static EShading toShading(const char * str, EShading def)
return SHADING_HSL;
if(0==memcmp(str, "hsv", 3))
return SHADING_HSV;
+ if(0==memcmp(str, "hcy", 3))
+ return SHADING_HCY;
}
return def;
}
-static EStripe toStripe(const char * str, EStripe def)
+static EStripe toStripe(const char *str, EStripe def)
{
if(str)
{
@@ -248,12 +346,14 @@ static EStripe toStripe(const char * str, EStripe def)
return STRIPE_NONE;
if(0==memcmp(str, "diagonal", 8))
return STRIPE_DIAGONAL;
+ if(0==memcmp(str, "fade", 4))
+ return STRIPE_FADE;
}
return def;
}
-static ESliderStyle toSlider(const char * str, ESliderStyle def)
+static ESliderStyle toSlider(const char *str, ESliderStyle def)
{
if(str)
{
@@ -261,23 +361,191 @@ static ESliderStyle toSlider(const char * str, ESliderStyle def)
return SLIDER_ROUND;
if(0==memcmp(str, "plain", 5))
return SLIDER_PLAIN;
+ if(0==memcmp(str, "r-round", 7))
+ return SLIDER_ROUND_ROTATED;
+ if(0==memcmp(str, "r-plain", 7))
+ return SLIDER_PLAIN_ROTATED;
if(0==memcmp(str, "triangular", 10))
return SLIDER_TRIANGULAR;
+ if(0==memcmp(str, "circular", 8))
+ return SLIDER_CIRCULAR;
+ }
+
+ return def;
+}
+
+static EColor toEColor(const char *str, EColor def)
+{
+ if(str)
+ {
+ if(0==memcmp(str, "base", 4))
+ return ECOLOR_BASE;
+ if(0==memcmp(str, "dark", 4))
+ return ECOLOR_DARK;
+ if(0==memcmp(str, "background", 10))
+ return ECOLOR_BACKGROUND;
+ }
+
+ return def;
+}
+
+static EFocus toFocus(const char *str, EFocus def)
+{
+ if(str)
+ {
+ if(0==memcmp(str, "standard", 8))
+ return FOCUS_STANDARD;
+ if(0==memcmp(str, "rect", 4) || 0==memcmp(str, "highlight", 9))
+ return FOCUS_RECTANGLE;
+ if(0==memcmp(str, "filled", 6))
+ return FOCUS_FILLED;
+ if(0==memcmp(str, "full", 4))
+ return FOCUS_FULL;
+ if(0==memcmp(str, "line", 4))
+ return FOCUS_LINE;
+ if(0==memcmp(str, "glow", 4))
+ return FOCUS_GLOW;
+ }
+
+ return def;
+}
+
+static ETabMo toTabMo(const char *str, ETabMo def)
+{
+ if(str)
+ {
+ if(0==memcmp(str, "top", 3))
+ return TAB_MO_TOP;
+ if(0==memcmp(str, "bot", 3))
+ return TAB_MO_BOTTOM;
+ if(0==memcmp(str, "glow", 4))
+ return TAB_MO_GLOW;
+ }
+
+ return def;
+}
+
+static EGradType toGradType(const char *str, EGradType def)
+{
+ if(str)
+ {
+ if(0==memcmp(str, "horiz", 5))
+ return GT_HORIZ;
+ if(0==memcmp(str, "vert", 4))
+ return GT_VERT;
}
+ return def;
+}
+static ELvLines toLvLines(const char *str, ELvLines def)
+{
+ if(str)
+ {
+ if(0==memcmp(str, "true", 4) || 0==memcmp(str, "new", 3))
+ return LV_NEW;
+ if(0==memcmp(str, "old", 3))
+ return LV_OLD;
+ if(0==memcmp(str, "false", 5) || 0==memcmp(str, "none", 4))
+ return LV_NONE;
+ }
return def;
}
+static EGradientBorder toGradientBorder(const char *str, bool *haveAlpha)
+{
+ if(str)
+ {
+ *haveAlpha=strstr(str, "-alpha") ? true : false;
+ if(0==memcmp(str, "light", 5) || 0==memcmp(str, "true", 4))
+ return GB_LIGHT;
+ if(0==memcmp(str, "none", 4))
+ return GB_NONE;
+ if(0==memcmp(str, "3dfull", 6))
+ return GB_3D_FULL;
+ if(0==memcmp(str, "3d", 2) || 0==memcmp(str, "false", 5))
+ return GB_3D;
+ if(0==memcmp(str, "shine", 5))
+ return GB_SHINE;
+ }
+ return GB_3D;
+}
+
+#ifdef __cplusplus
+static EAlign toAlign(const char *str, EAlign def)
+{
+ if(str)
+ {
+ if(0==memcmp(str, "left", 4))
+ return ALIGN_LEFT;
+ if(0==memcmp(str, "center-full", 11))
+ return ALIGN_FULL_CENTER;
+ if(0==memcmp(str, "center", 6))
+ return ALIGN_CENTER;
+ if(0==memcmp(str, "right", 5))
+ return ALIGN_RIGHT;
+ }
+ return def;
+}
#endif
-#ifdef CONFIG_WRITE
-#include <kstandarddirs.h>
+#if defined CONFIG_DIALOG || (defined QT_VERSION && (QT_VERSION >= 0x040000))
+static ETitleBarIcon toTitlebarIcon(const char *str, ETitleBarIcon def)
+{
+ if(str)
+ {
+ if(0==memcmp(str, "none", 4))
+ return TITLEBAR_ICON_NONE;
+ if(0==memcmp(str, "menu", 4))
+ return TITLEBAR_ICON_MENU_BUTTON;
+ if(0==memcmp(str, "title", 5))
+ return TITLEBAR_ICON_NEXT_TO_TITLE;
+ }
+ return def;
+}
+#endif
+
+static EImageType toImageType(const char *str, EImageType def)
+{
+ if(str)
+ {
+ if(0==memcmp(str, "none", 4))
+ return IMG_NONE;
+ if(0==memcmp(str, "plainrings", 10))
+ return IMG_PLAIN_RINGS;
+ if(0==memcmp(str, "rings", 5))
+ return IMG_BORDERED_RINGS;
+ if(0==memcmp(str, "squarerings", 11))
+ return IMG_SQUARE_RINGS;
+ if(0==memcmp(str, "file", 4))
+ return IMG_FILE;
+ }
+ return def;
+}
+
+static EGlow toGlow(const char *str, EGlow def)
+{
+ if(str)
+ {
+ if(0==memcmp(str, "none", 4))
+ return GLOW_NONE;
+ if(0==memcmp(str, "start", 5))
+ return GLOW_START;
+ if(0==memcmp(str, "middle", 6))
+ return GLOW_MIDDLE;
+ if(0==memcmp(str, "end", 3))
+ return GLOW_END;
+ }
+ return def;
+}
#endif
static const char * getHome()
{
static const char *home=NULL;
+#ifdef _WIN32
+ home = getenv("HOMEPATH");
+#else
if(!home)
{
struct passwd *p=getpwuid(getuid());
@@ -295,15 +563,82 @@ static const char * getHome()
if(!home)
home="/tmp";
}
-
+#endif
return home;
}
-static const char *xdgConfigFolder()
+#ifdef __cplusplus
+
+#if defined QTC_QT_ONLY || QT_VERSION < 0x040000
+#if QT_VERSION < 0x040000
+#include <qdir.h>
+#include <qfile.h>
+#endif
+// Take from KStandardDirs::makeDir
+static bool makeDir(const QString& dir, int mode)
+{
+ // we want an absolute path
+ if (QDir::isRelativePath(dir))
+ return false;
+
+#ifdef Q_WS_WIN
+ return QDir().mkpath(dir);
+#else
+ QString target = dir;
+ uint len = target.length();
+
+ // append trailing slash if missing
+ if (dir.at(len - 1) != '/')
+ target += '/';
+
+ QString base;
+ uint i = 1;
+
+ while( i < len )
+ {
+ struct stat st;
+#if QT_VERSION >= 0x040000
+ int pos = target.indexOf('/', i);
+#else
+ int pos = target.find('/', i);
+#endif
+ base += target.mid(i - 1, pos - i + 1);
+ QByteArray baseEncoded = QFile::encodeName(base);
+ // bail out if we encountered a problem
+ if (stat(baseEncoded, &st) != 0)
+ {
+ // Directory does not exist....
+ // Or maybe a dangling symlink ?
+ if (lstat(baseEncoded, &st) == 0)
+ (void)unlink(baseEncoded); // try removing
+
+ if (mkdir(baseEncoded, static_cast<mode_t>(mode)) != 0)
+ {
+#if QT_VERSION >= 0x040000
+ baseEncoded.prepend("trying to create local folder ");
+ perror(baseEncoded.constData());
+#else
+ perror("trying to create QtCurve config folder ");
+#endif
+ return false; // Couldn't create it :-(
+ }
+ }
+ i = pos + 1;
+ }
+ return true;
+#endif
+}
+
+#else
+#include <kstandarddirs.h>
+#endif
+#endif
+
+static const char *qtcConfDir()
{
- static char xdgDir[QTC_MAX_FILENAME_LEN]={'\0'};
+ static char *cfgDir=NULL;
- if(!xdgDir[0])
+ if(!cfgDir)
{
static const char *home=NULL;
@@ -333,7 +668,12 @@ static const char *xdgConfigFolder()
"sudo su" / "kcmshell style". The 1st would write to ~/.config, but
if root has a XDG_ set then that would be used on the second :-(
*/
+#ifndef _WIN32
char *env=0==getuid() ? NULL : getenv("XDG_CONFIG_HOME");
+#else
+ char *env=0;
+#endif
+
#endif
if(!env)
@@ -341,59 +681,210 @@ static const char *xdgConfigFolder()
if(!home)
home=getHome();
- sprintf(xdgDir, "%s/.config", home);
+ cfgDir=(char *)malloc(strlen(home)+18);
+ sprintf(cfgDir, "%s/.config/qtcurve/", home);
}
else
- strcpy(xdgDir, env);
+ {
+ cfgDir=(char *)malloc(strlen(env)+10);
+ sprintf(cfgDir, "%s/qtcurve/", env);
+ }
-#if defined CONFIG_WRITE || !defined __cplusplus
+//#if defined CONFIG_WRITE || !defined __cplusplus
{
struct stat info;
- if(0!=lstat(xdgDir, &info))
+ if(0!=lstat(cfgDir, &info))
{
#ifdef __cplusplus
- KStandardDirs::makeDir(xdgDir, 0755);
+#if defined QTC_QT_ONLY || QT_VERSION < 0x040000
+ makeDir(cfgDir, 0755);
+#else
+ KStandardDirs::makeDir(cfgDir, 0755);
+#endif
#else
- g_mkdir_with_parents(xdgDir, 0755);
+ g_mkdir_with_parents(cfgDir, 0755);
#endif
}
}
+//#endif
+ }
+
+ return cfgDir;
+}
+
+#ifdef __cplusplus
+static WindowBorders qtcGetWindowBorderSize(bool force=false)
+#else
+static WindowBorders qtcGetWindowBorderSize(bool force)
+#endif
+{
+ static WindowBorders def={24, 18, 4, 4};
+ static WindowBorders sizes={-1, -1, -1, -1};
+
+ if(-1==sizes.titleHeight || force)
+ {
+#ifdef __cplusplus
+ QFile f(qtcConfDir()+QString(BORDER_SIZE_FILE));
+
+#if QT_VERSION >= 0x040000
+ if(f.open(QIODevice::ReadOnly))
+#else
+ if(f.open(IO_ReadOnly))
#endif
+ {
+ QTextStream stream(&f);
+ QString line;
+
+ sizes.titleHeight=stream.readLine().toInt();
+ sizes.toolTitleHeight=stream.readLine().toInt();
+ sizes.bottom=stream.readLine().toInt();
+ sizes.sides=stream.readLine().toInt();
+ f.close();
+ }
+#else // __cplusplus
+ char *filename=(char *)malloc(strlen(qtcConfDir())+strlen(BORDER_SIZE_FILE)+1);
+ FILE *f=NULL;
+
+ sprintf(filename, "%s"BORDER_SIZE_FILE, qtcConfDir());
+ if((f=fopen(filename, "r")))
+ {
+ char *line=NULL;
+ size_t len;
+ getline(&line, &len, f);
+ sizes.titleHeight=atoi(line);
+ getline(&line, &len, f);
+ sizes.toolTitleHeight=atoi(line);
+ getline(&line, &len, f);
+ sizes.bottom=atoi(line);
+ getline(&line, &len, f);
+ sizes.sides=atoi(line);
+ if(line)
+ free(line);
+ fclose(f);
+ }
+ free(filename);
+#endif // __cplusplus
}
- return xdgDir;
+ return sizes.titleHeight<12 ? def : sizes;
}
+#if (!defined QT_VERSION || QT_VERSION >= 0x040000) && !defined CONFIG_DIALOG
+
+#define MENU_FILE_PREFIX "menubar-"
+#define STATUS_FILE_PREFIX "statusbar-"
+
+#define qtcMenuBarHidden(A) qtcBarHidden((A), MENU_FILE_PREFIX)
+#define qtcSetMenuBarHidden(A, H) qtcSetBarHidden((A), (H), MENU_FILE_PREFIX)
+#define qtcStatusBarHidden(A) qtcBarHidden((A), STATUS_FILE_PREFIX)
+#define qtcSetStatusBarHidden(A, H) qtcSetBarHidden((A), (H), STATUS_FILE_PREFIX)
+
+#ifdef __cplusplus
+static bool qtcBarHidden(const QString &app, const char *prefix)
+{
+ return QFile::exists(QFile::decodeName(qtcConfDir())+prefix+app);
+}
+
+static void qtcSetBarHidden(const QString &app, bool hidden, const char *prefix)
+{
+ if(!hidden)
+ QFile::remove(QFile::decodeName(qtcConfDir())+prefix+app);
+ else
+ QFile(QFile::decodeName(qtcConfDir())+prefix+app).open(QIODevice::WriteOnly);
+}
+
+#else // __cplusplus
+static bool qtcFileExists(const char *name)
+{
+ struct stat info;
+
+ return 0==lstat(name, &info) && S_ISREG(info.st_mode);
+}
+
+static char * qtcGetBarFileName(const char *app, const char *prefix)
+{
+ char *filename=NULL;
+
+ if(!filename)
+ {
+ filename=(char *)malloc(strlen(qtcConfDir())+strlen(prefix)+strlen(app)+1);
+ sprintf(filename, "%s%s%s", qtcConfDir(), prefix, app);
+ }
+
+ return filename;
+}
+
+static bool qtcBarHidden(const char *app, const char *prefix)
+{
+ return qtcFileExists(qtcGetBarFileName(app, prefix));
+}
+
+static void qtcSetBarHidden(const char *app, bool hidden, const char *prefix)
+{
+ if(!hidden)
+ unlink(qtcGetBarFileName(app, prefix));
+ else
+ {
+ FILE *f=fopen(qtcGetBarFileName(app, prefix), "w");
+
+ if(f)
+ fclose(f);
+ }
+}
+
+#endif // __cplusplus
+
+#ifdef __cplusplus
+#include <QtSvg/QSvgRenderer>
+#endif // __cplusplus
+
+static void loadBgndImage(QtCImage *img)
+{
+ if(!img->loaded &&
+ img->width>16 && img->width<1024 && img->height>16 && img->height<1024)
+ {
+ img->loaded=true;
+#ifdef __cplusplus
+ if(!img->file.isEmpty())
+ {
+ QSvgRenderer svg(img->file);
+
+ if(svg.isValid())
+ {
+ img->pix=QPixmap(img->width, img->height);
+ img->pix.fill(Qt::transparent);
+ QPainter painter(&img->pix);
+ svg.render(&painter);
+ painter.end();
+ }
+ }
+#else // __cplusplus
+ img->pix=0L;
+ if(img->file)
+ img->pix=gdk_pixbuf_new_from_file_at_scale(img->file, img->width, img->height, FALSE, NULL);
+#endif // __cplusplus
+ }
+}
+
+#endif // (!defined QT_VERSION || QT_VERSION >= 0x040000) && !defined CONFIG_DIALOG
+
#ifdef CONFIG_READ
#ifdef __cplusplus
-#define QTC_IS_BLACK(A) (0==(A).red() && 0==(A).green() && 0==(A).blue())
+#define IS_BLACK(A) (0==(A).red() && 0==(A).green() && 0==(A).blue())
#else
-#define QTC_IS_BLACK(A) (0==(A).red && 0==(A).green && 0==(A).blue)
+#define IS_BLACK(A) (0==(A).red && 0==(A).green && 0==(A).blue)
#endif
static void checkColor(EShade *s, color *c)
{
- if(SHADE_CUSTOM==*s && QTC_IS_BLACK(*c))
+ if(SHADE_CUSTOM==*s && IS_BLACK(*c))
*s=SHADE_NONE;
}
#ifdef __cplusplus
-#if QT_VERSION >= 0x040000
-#include <QMap>
-#include <QFile>
-#include <QTextStream>
-#define QTC_LATIN1(A) A.toLatin1()
-#else
-#define QTC_LATIN1(A) A.latin1()
-
-#include <qmap.h>
-#include <qfile.h>
-#include <qtextstream.h>
-#endif
-
class QtCConfig
{
public:
@@ -401,7 +892,8 @@ class QtCConfig
QtCConfig(const QString &filename);
bool ok() const { return values.count()>0; }
- const QString & readEntry(const char *key, const QString &def=QString::null);
+ bool hasKey(const QString &key) { return values.contains(key); }
+ const QString & readEntry(const QString &key, const QString &def=QString::null);
private:
@@ -436,47 +928,105 @@ QtCConfig::QtCConfig(const QString &filename)
}
}
-inline const QString & QtCConfig::readEntry(const char *key, const QString &def)
+inline const QString & QtCConfig::readEntry(const QString &key, const QString &def)
{
return values.contains(key) ? values[key] : def;
}
-inline QString readStringEntry(QtCConfig &cfg, const char *key)
+inline QString readStringEntry(QtCConfig &cfg, const QString &key)
{
return cfg.readEntry(key);
}
-static int readNumEntry(QtCConfig &cfg, const char *key, int def)
+static int readNumEntry(QtCConfig &cfg, const QString &key, int def)
{
const QString &val(readStringEntry(cfg, key));
return val.isEmpty() ? def : val.toInt();
}
-static bool readBoolEntry(QtCConfig &cfg, const char *key, bool def)
+static int readVersionEntry(QtCConfig &cfg, const QString &key)
+{
+ const QString &val(readStringEntry(cfg, key));
+ int major, minor, patch;
+
+ return !val.isEmpty() && 3==sscanf(TO_LATIN1(val), "%d.%d.%d", &major, &minor, &patch)
+ ? MAKE_VERSION3(major, minor, patch)
+ : 0;
+}
+
+static bool readBoolEntry(QtCConfig &cfg, const QString &key, bool def)
{
const QString &val(readStringEntry(cfg, key));
return val.isEmpty() ? def : (val=="true" ? true : false);
}
-#if QT_VERSION >= 0x040000
-#define QTC_LATIN1(A) A.toLatin1()
+static void readDoubleList(QtCConfig &cfg, const char *key, double *list, int count)
+{
+#if (defined QT_VERSION && (QT_VERSION >= 0x040000))
+ QStringList strings(readStringEntry(cfg, key).split(',', QString::SkipEmptyParts));
#else
-#define QTC_LATIN1(A) A.latin1()
+ QStringList strings(QStringList::split(',', readStringEntry(cfg, key)));
#endif
+ bool ok(count==strings.size());
+
+ if(ok)
+ {
+ QStringList::ConstIterator it(strings.begin());
+ int i;
-#define QTC_CFG_READ_COLOR(ENTRY) \
+ for(i=0; i<count && ok; ++i, ++it)
+ list[i]=(*it).toDouble(&ok);
+ }
+
+ if(!ok && strings.size())
+ list[0]=0;
+}
+
+#define CFG_READ_COLOR(ENTRY) \
{ \
QString sVal(cfg.readEntry(#ENTRY)); \
if(sVal.isEmpty()) \
opts->ENTRY=def->ENTRY; \
else \
- setRgb(&(opts->ENTRY), QTC_LATIN1(sVal)); \
+ setRgb(&(opts->ENTRY), TO_LATIN1(sVal)); \
+ }
+
+#define CFG_READ_IMAGE(ENTRY) \
+ { \
+ opts->ENTRY.type=toImageType(TO_LATIN1(readStringEntry(cfg, #ENTRY)), def->ENTRY.type); \
+ opts->ENTRY.loaded=false; \
+ if(IMG_FILE==opts->ENTRY.type) \
+ { \
+ QString file(cfg.readEntry(#ENTRY ".file")); \
+ if(!file.isEmpty()) \
+ { \
+ opts->ENTRY.file=file; \
+ opts->ENTRY.width=readNumEntry(cfg, #ENTRY ".width", 0); \
+ opts->ENTRY.height=readNumEntry(cfg, #ENTRY ".height", 0); \
+ } \
+ } \
}
+#if QT_VERSION >= 0x040000
+ #define CFG_READ_STRING_LIST(ENTRY) \
+ { \
+ QString val=readStringEntry(cfg, #ENTRY); \
+ Strings set=val.isEmpty() ? Strings() : Strings::fromList(val.split(",", QString::SkipEmptyParts)); \
+ opts->ENTRY=set.count() || cfg.hasKey(#ENTRY) ? set : def->ENTRY; \
+ }
#else
+ #define CFG_READ_STRING_LIST(ENTRY) \
+ { \
+ QString val=readStringEntry(cfg, #ENTRY); \
+ Strings list=val.isEmpty() ? Strings() : Strings::split(",", val, false); \
+ opts->ENTRY=list.count() || cfg.hasKey(#ENTRY) ? list : def->ENTRY; \
+ }
+#endif
+#else
+
static char * lookupCfgHash(GHashTable **cfg, char *key, char *val)
{
char *rv=NULL;
@@ -502,9 +1052,9 @@ static GHashTable * loadConfig(const char *filename)
if(f)
{
- char line[QTC_MAX_INPUT_LINE_LEN];
+ char line[MAX_CONFIG_INPUT_LINE_LEN];
- while(NULL!=fgets(line, QTC_MAX_INPUT_LINE_LEN-1, f))
+ while(NULL!=fgets(line, MAX_CONFIG_INPUT_LINE_LEN-1, f))
{
char *eq=strchr(line, '=');
int pos=eq ? eq-line : -1;
@@ -545,6 +1095,16 @@ static int readNumEntry(GHashTable *cfg, char *key, int def)
return str ? atoi(str) : def;
}
+static int readVersionEntry(GHashTable *cfg, char *key)
+{
+ char *str=readStringEntry(cfg, key);
+ int major, minor, patch;
+
+ return str && 3==sscanf(str, "%d.%d.%d", &major, &minor, &patch)
+ ? MAKE_VERSION3(major, minor, patch)
+ : 0;
+}
+
static gboolean readBoolEntry(GHashTable *cfg, char *key, gboolean def)
{
char *str=readStringEntry(cfg, key);
@@ -552,9 +1112,47 @@ static gboolean readBoolEntry(GHashTable *cfg, char *key, gboolean def)
return str ? (0==memcmp(str, "true", 4) ? true : false) : def;
}
-#define QTC_LATIN1(A) A
+static void readDoubleList(GHashTable *cfg, char *key, double *list, int count)
+{
+ char *str=readStringEntry(cfg, key);
+
+ if(str)
+ {
+ int j,
+ comma=0;
+ bool ok=true;
+
+ for(j=0; str[j]; ++j)
+ if(','==str[j])
+ comma++;
+
+ ok=(count-1)==comma;
+ if(ok)
+ {
+ for(j=0; j<comma+1 && str && ok; ++j)
+ {
+ char *c=strchr(str, ',');
+
+ if(c || (str && count-1==comma))
+ {
+ if(c)
+ *c='\0';
+ list[j]=g_ascii_strtod(str, NULL);
+ str=c+1;
+ }
+ else
+ ok=false;
+ }
+ }
-#define QTC_CFG_READ_COLOR(ENTRY) \
+ if(!ok)
+ list[0]=0;
+ }
+}
+
+#define TO_LATIN1(A) A
+
+#define CFG_READ_COLOR(ENTRY) \
{ \
const char *str=readStringEntry(cfg, #ENTRY); \
\
@@ -563,93 +1161,485 @@ static gboolean readBoolEntry(GHashTable *cfg, char *key, gboolean def)
else \
opts->ENTRY=def->ENTRY; \
}
-#endif
+#define CFG_READ_IMAGE(ENTRY) \
+ { \
+ opts->ENTRY.type=toImageType(TO_LATIN1(readStringEntry(cfg, #ENTRY)), def->ENTRY.type); \
+ opts->ENTRY.loaded=false; \
+ if(IMG_FILE==opts->ENTRY.type) \
+ { \
+ const char *file=readStringEntry(cfg, #ENTRY ".file"); \
+ if(file) \
+ { \
+ opts->ENTRY.file=file; \
+ opts->ENTRY.width=readNumEntry(cfg, #ENTRY ".width", 0); \
+ opts->ENTRY.height=readNumEntry(cfg, #ENTRY ".height", 0); \
+ } \
+ } \
+ }
+#define CFG_READ_STRING_LIST(ENTRY) \
+ { \
+ const gchar *str=readStringEntry(cfg, #ENTRY); \
+ if(str) \
+ opts->ENTRY=g_strsplit(str, ",", -1); \
+ else if(def->ENTRY) \
+ { \
+ opts->ENTRY=def->ENTRY; \
+ def->ENTRY=NULL; \
+ } \
+ }
-#define QTC_CFG_READ_NUM(ENTRY) \
- opts->ENTRY=readNumEntry(cfg, #ENTRY, def->ENTRY);
+#endif
-#define QTC_CFG_READ_BOOL(ENTRY) \
+#define CFG_READ_BOOL(ENTRY) \
opts->ENTRY=readBoolEntry(cfg, #ENTRY, def->ENTRY);
-#define QTC_CFG_READ_ROUND(ENTRY) \
- opts->ENTRY=toRound(QTC_LATIN1(readStringEntry(cfg, #ENTRY)), def->ENTRY);
+#define CFG_READ_ROUND(ENTRY) \
+ opts->ENTRY=toRound(TO_LATIN1(readStringEntry(cfg, #ENTRY)), def->ENTRY);
-#define QTC_CFG_READ_DI(ENTRY) \
- opts->ENTRY=((double)(readNumEntry(cfg, #ENTRY, ((int)(def->ENTRY*100))-100)+100))/100.0;
+#define CFG_READ_INT(ENTRY) \
+ opts->ENTRY=readNumEntry(cfg, #ENTRY, def->ENTRY);
-#define QTC_CFG_READ_TB_BORDER(ENTRY) \
- opts->ENTRY=toTBarBorder(QTC_LATIN1(readStringEntry(cfg, #ENTRY)), def->ENTRY);
+#define CFG_READ_INT_BOOL(ENTRY, DEF) \
+ if(readBoolEntry(cfg, #ENTRY, false)) \
+ opts->ENTRY=DEF; \
+ else \
+ opts->ENTRY=readNumEntry(cfg, #ENTRY, def->ENTRY);
+
+#define CFG_READ_TB_BORDER(ENTRY) \
+ opts->ENTRY=toTBarBorder(TO_LATIN1(readStringEntry(cfg, #ENTRY)), def->ENTRY);
-#define QTC_CFG_READ_MOUSE_OVER(ENTRY) \
- opts->ENTRY=toMouseOver(QTC_LATIN1(readStringEntry(cfg, #ENTRY)), def->ENTRY);
+#define CFG_READ_MOUSE_OVER(ENTRY) \
+ opts->ENTRY=toMouseOver(TO_LATIN1(readStringEntry(cfg, #ENTRY)), def->ENTRY);
-#define QTC_CFG_READ_APPEARANCE(ENTRY, DEF) \
- opts->ENTRY=toAppearance(QTC_LATIN1(readStringEntry(cfg, #ENTRY)), DEF);
+#define CFG_READ_APPEARANCE(ENTRY, ALLOW) \
+ opts->ENTRY=toAppearance(TO_LATIN1(readStringEntry(cfg, #ENTRY)), def->ENTRY, ALLOW);
/*
-#define QTC_CFG_READ_APPEARANCE(ENTRY) \
- opts->ENTRY=toAppearance(QTC_LATIN1(readStringEntry(cfg, #ENTRY)), def->ENTRY);
+#define CFG_READ_APPEARANCE(ENTRY) \
+ opts->ENTRY=toAppearance(TO_LATIN1(readStringEntry(cfg, #ENTRY)), def->ENTRY);
*/
-#define QTC_CFG_READ_STRIPE(ENTRY) \
- opts->ENTRY=toStripe(QTC_LATIN1(readStringEntry(cfg, #ENTRY)), def->ENTRY);
+#define CFG_READ_STRIPE(ENTRY) \
+ opts->ENTRY=toStripe(TO_LATIN1(readStringEntry(cfg, #ENTRY)), def->ENTRY);
+
+#define CFG_READ_SLIDER(ENTRY) \
+ opts->ENTRY=toSlider(TO_LATIN1(readStringEntry(cfg, #ENTRY)), def->ENTRY);
+
+#define CFG_READ_DEF_BTN(ENTRY) \
+ opts->ENTRY=toInd(TO_LATIN1(readStringEntry(cfg, #ENTRY)), def->ENTRY);
+
+#define CFG_READ_LINE(ENTRY) \
+ opts->ENTRY=toLine(TO_LATIN1(readStringEntry(cfg, #ENTRY)), def->ENTRY);
+
+#define CFG_READ_SHADE(ENTRY, AD, MENU_STRIPE, COL) \
+ opts->ENTRY=toShade(TO_LATIN1(readStringEntry(cfg, #ENTRY)), AD, def->ENTRY, MENU_STRIPE, COL);
+
+#define CFG_READ_SCROLLBAR(ENTRY) \
+ opts->ENTRY=toScrollbar(TO_LATIN1(readStringEntry(cfg, #ENTRY)), def->ENTRY);
+
+#define CFG_READ_FRAME(ENTRY) \
+ opts->ENTRY=toFrame(TO_LATIN1(readStringEntry(cfg, #ENTRY)), def->ENTRY);
+
+#define CFG_READ_EFFECT(ENTRY) \
+ opts->ENTRY=toEffect(TO_LATIN1(readStringEntry(cfg, #ENTRY)), def->ENTRY);
-#define QTC_CFG_READ_SLIDER(ENTRY) \
- opts->ENTRY=toSlider(QTC_LATIN1(readStringEntry(cfg, #ENTRY)), def->ENTRY);
+#define CFG_READ_SHADING(ENTRY) \
+ opts->ENTRY=toShading(TO_LATIN1(readStringEntry(cfg, #ENTRY)), def->ENTRY);
-#define QTC_CFG_READ_DEF_BTN(ENTRY) \
- opts->ENTRY=toInd(QTC_LATIN1(readStringEntry(cfg, #ENTRY)), def->ENTRY);
+#define CFG_READ_ECOLOR(ENTRY) \
+ opts->ENTRY=toEColor(TO_LATIN1(readStringEntry(cfg, #ENTRY)), def->ENTRY);
-#define QTC_CFG_READ_LINE(ENTRY) \
- opts->ENTRY=toLine(QTC_LATIN1(readStringEntry(cfg, #ENTRY)), def->ENTRY);
+#define CFG_READ_FOCUS(ENTRY) \
+ opts->ENTRY=toFocus(TO_LATIN1(readStringEntry(cfg, #ENTRY)), def->ENTRY);
-#define QTC_CFG_READ_SHADE(ENTRY, AD) \
- opts->ENTRY=toShade(QTC_LATIN1(readStringEntry(cfg, #ENTRY)), AD, def->ENTRY);
+#define CFG_READ_TAB_MO(ENTRY) \
+ opts->ENTRY=toTabMo(TO_LATIN1(readStringEntry(cfg, #ENTRY)), def->ENTRY);
-#define QTC_CFG_READ_SCROLLBAR(ENTRY) \
- opts->ENTRY=toScrollbar(QTC_LATIN1(readStringEntry(cfg, #ENTRY)), def->ENTRY);
+#define CFG_READ_GRAD_TYPE(ENTRY) \
+ opts->ENTRY=toGradType(TO_LATIN1(readStringEntry(cfg, #ENTRY)), def->ENTRY);
-#define QTC_CFG_READ_EFFECT(ENTRY) \
- opts->ENTRY=toEffect(QTC_LATIN1(readStringEntry(cfg, #ENTRY)), def->ENTRY);
+#define CFG_READ_LV_LINES(ENTRY) \
+ opts->ENTRY=toLvLines(TO_LATIN1(readStringEntry(cfg, #ENTRY)), def->ENTRY);
-#ifdef QTC_CONFIG_DIALOG
-#define QTC_CFG_READ_SHADING(ENTRY, UNUSED) \
- opts->ENTRY=toShading(QTC_LATIN1(readStringEntry(cfg, #ENTRY)), def->ENTRY);
+#ifdef __cplusplus
+#define CFG_READ_ALIGN(ENTRY) \
+ opts->ENTRY=toAlign(TO_LATIN1(readStringEntry(cfg, #ENTRY)), def->ENTRY);
+#endif
+
+#if defined CONFIG_DIALOG || (defined QT_VERSION && (QT_VERSION >= 0x040000))
+#define CFG_READ_TB_ICON(ENTRY) \
+ opts->ENTRY=toTitlebarIcon(TO_LATIN1(readStringEntry(cfg, #ENTRY)), def->ENTRY);
+#endif
+
+#define CFG_READ_GLOW(ENTRY) \
+ opts->ENTRY=toGlow(TO_LATIN1(readStringEntry(cfg, #ENTRY)), def->ENTRY);
+
+static void checkAppearance(EAppearance *ap, Options *opts)
+{
+ if(*ap>=APPEARANCE_CUSTOM1 && *ap<(APPEARANCE_CUSTOM1+NUM_CUSTOM_GRAD))
+ {
+#ifdef __cplusplus
+ if(opts->customGradient.end()==opts->customGradient.find(*ap))
#else
-#define QTC_CFG_READ_SHADING(ENTRY, DEF) \
- ENTRY=toShading(QTC_LATIN1(readStringEntry(cfg, #ENTRY)), DEF);
+ if(!opts->customGradient[*ap-APPEARANCE_CUSTOM1])
+#endif
+ {
+ if(ap==&opts->appearance)
+ *ap=APPEARANCE_FLAT;
+ else
+ *ap=opts->appearance;
+ }
+ }
+}
+
+static void defaultSettings(Options *opts);
+
+#ifndef __cplusplus
+static void copyGradients(Options *src, Options *dest)
+{
+ if(src && dest && src!=dest)
+ {
+ int i;
+
+ for(i=0; i<NUM_CUSTOM_GRAD; ++i)
+ if(src->customGradient[i] && src->customGradient[i]->numStops>0)
+ {
+ dest->customGradient[i]=malloc(sizeof(Gradient));
+ dest->customGradient[i]->numStops=src->customGradient[i]->numStops;
+ dest->customGradient[i]->stops=malloc(sizeof(GradientStop) * dest->customGradient[i]->numStops);
+ memcpy(dest->customGradient[i]->stops, src->customGradient[i]->stops,
+ sizeof(GradientStop) * dest->customGradient[i]->numStops);
+ dest->customGradient[i]->border=src->customGradient[i]->border;
+ }
+ else
+ dest->customGradient[i]=NULL;
+ }
+}
+
+static void copyOpts(Options *src, Options *dest)
+{
+ if(src && dest && src!=dest)
+ {
+ memcpy(dest, src, sizeof(Options));
+ dest->noBgndGradientApps=src->noBgndGradientApps;
+ dest->noBgndOpacityApps=src->noBgndOpacityApps;
+ dest->noMenuBgndOpacityApps=src->noMenuBgndOpacityApps;
+ dest->noBgndImageApps=src->noBgndImageApps;
+#ifdef QTC_ENABLE_PARENTLESS_DIALOG_FIX_SUPPORT
+ dest->noDlgFixApps=src->noDlgFixApps;
+ src->noDlgFixApps=NULL;
#endif
+ dest->noMenuStripeApps=src->noMenuStripeApps;
+ src->noBgndGradientApps=src->noBgndOpacityApps=src->noMenuBgndOpacityApps=src->noBgndImageApps=src->noMenuStripeApps=NULL;
+ memcpy(dest->customShades, src->customShades, sizeof(double)*NUM_STD_SHADES);
+ memcpy(dest->customAlphas, src->customAlphas, sizeof(double)*NUM_STD_ALPHAS);
+ copyGradients(src, dest);
+ }
+}
+static void freeOpts(Options *opts)
+{
+ if(opts)
+ {
+ int i;
+
+ if(opts->noBgndGradientApps)
+ g_strfreev(opts->noBgndGradientApps);
+ if(opts->noBgndOpacityApps)
+ g_strfreev(opts->noBgndOpacityApps);
+ if(opts->noMenuBgndOpacityApps)
+ g_strfreev(opts->noMenuBgndOpacityApps);
+ if(opts->noBgndImageApps)
+ g_strfreev(opts->noBgndImageApps);
+#ifdef QTC_ENABLE_PARENTLESS_DIALOG_FIX_SUPPORT
+ if(opts->noDlgFixApps)
+ g_strfreev(opts->noDlgFixApps);
+ opts->noDlgFixApps=NULL
+#endif
+ if(opts->noMenuStripeApps)
+ g_strfreev(opts->noMenuStripeApps);
+ opts->noBgndGradientApps=opts->noBgndOpacityApps=opts->noMenuBgndOpacityApps=opts->noBgndImageApps=opts->noMenuStripeApps=NULL;
+ for(i=0; i<NUM_CUSTOM_GRAD; ++i)
+ if(opts->customGradient[i])
+ {
+ if(opts->customGradient[i]->stops)
+ free(opts->customGradient[i]->stops);
+ free(opts->customGradient[i]);
+ opts->customGradient[i]=NULL;
+ }
+ }
+}
+#endif
+
+static void checkConfig(Options *opts)
+{
+ /* **Must** check appearance first, as the rest will default to this */
+ checkAppearance(&opts->appearance, opts);
+ checkAppearance(&opts->bgndAppearance, opts);
+ checkAppearance(&opts->menuBgndAppearance, opts);
+ checkAppearance(&opts->menubarAppearance, opts);
+ checkAppearance(&opts->menuitemAppearance, opts);
+ checkAppearance(&opts->toolbarAppearance, opts);
+ checkAppearance(&opts->lvAppearance, opts);
+ checkAppearance(&opts->tabAppearance, opts);
+ checkAppearance(&opts->activeTabAppearance, opts);
+ checkAppearance(&opts->sliderAppearance, opts);
+ checkAppearance(&opts->selectionAppearance, opts);
+ checkAppearance(&opts->titlebarAppearance, opts);
+ checkAppearance(&opts->inactiveTitlebarAppearance, opts);
#ifdef __cplusplus
-static bool readConfig(const QString &file, Options *opts, Options *def)
+ checkAppearance(&opts->titlebarButtonAppearance, opts);
+ checkAppearance(&opts->selectionAppearance, opts);
+ checkAppearance(&opts->dwtAppearance, opts);
+#endif
+ checkAppearance(&opts->menuStripeAppearance, opts);
+ checkAppearance(&opts->progressAppearance, opts);
+ checkAppearance(&opts->progressGrooveAppearance, opts);
+ checkAppearance(&opts->grooveAppearance, opts);
+ checkAppearance(&opts->sunkenAppearance, opts);
+ checkAppearance(&opts->sbarBgndAppearance, opts);
+ checkAppearance(&opts->sliderFill, opts);
+ checkAppearance(&opts->tooltipAppearance, opts);
+
+ if(SHADE_BLEND_SELECTED==opts->shadeCheckRadio)
+ opts->shadeCheckRadio=SHADE_SELECTED;
+
+ checkColor(&opts->shadeMenubars, &opts->customMenubarsColor);
+ checkColor(&opts->shadeSliders, &opts->customSlidersColor);
+ checkColor(&opts->shadeCheckRadio, &opts->customCheckRadioColor);
+ checkColor(&opts->menuStripe, &opts->customMenuStripeColor);
+ checkColor(&opts->comboBtn, &opts->customComboBtnColor);
+ checkColor(&opts->sortedLv, &opts->customSortedLvColor);
+ if(APPEARANCE_BEVELLED==opts->toolbarAppearance)
+ opts->toolbarAppearance=APPEARANCE_GRADIENT;
+ else if(APPEARANCE_RAISED==opts->toolbarAppearance)
+ opts->toolbarAppearance=APPEARANCE_FLAT;
+
+ if(APPEARANCE_BEVELLED==opts->menubarAppearance)
+ opts->menubarAppearance=APPEARANCE_GRADIENT;
+ else if(APPEARANCE_RAISED==opts->menubarAppearance)
+ opts->menubarAppearance=APPEARANCE_FLAT;
+
+ if(APPEARANCE_BEVELLED==opts->sliderAppearance)
+ opts->sliderAppearance=APPEARANCE_GRADIENT;
+
+ if(APPEARANCE_BEVELLED==opts->tabAppearance)
+ opts->tabAppearance=APPEARANCE_GRADIENT;
+
+ if(APPEARANCE_BEVELLED==opts->activeTabAppearance)
+ opts->activeTabAppearance=APPEARANCE_GRADIENT;
+
+ if(APPEARANCE_RAISED==opts->selectionAppearance)
+ opts->selectionAppearance=APPEARANCE_FLAT;
+ else if(APPEARANCE_BEVELLED==opts->selectionAppearance)
+ opts->selectionAppearance=APPEARANCE_GRADIENT;
+
+ if(APPEARANCE_RAISED==opts->menuStripeAppearance)
+ opts->menuStripeAppearance=APPEARANCE_FLAT;
+ else if(APPEARANCE_BEVELLED==opts->menuStripeAppearance)
+ opts->menuStripeAppearance=APPEARANCE_GRADIENT;
+
+ if(opts->highlightFactor<MIN_HIGHLIGHT_FACTOR || opts->highlightFactor>MAX_HIGHLIGHT_FACTOR)
+ opts->highlightFactor=DEFAULT_HIGHLIGHT_FACTOR;
+
+ if(opts->crHighlight<MIN_HIGHLIGHT_FACTOR || opts->crHighlight>MAX_HIGHLIGHT_FACTOR)
+ opts->crHighlight=DEFAULT_CR_HIGHLIGHT_FACTOR;
+
+ if(opts->splitterHighlight<MIN_HIGHLIGHT_FACTOR || opts->splitterHighlight>MAX_HIGHLIGHT_FACTOR)
+ opts->splitterHighlight=DEFAULT_SPLITTER_HIGHLIGHT_FACTOR;
+
+#if !defined __cplusplus || defined CONFIG_DIALOG
+ if(opts->expanderHighlight<MIN_HIGHLIGHT_FACTOR || opts->expanderHighlight>MAX_HIGHLIGHT_FACTOR)
+ opts->expanderHighlight=DEFAULT_EXPANDER_HIGHLIGHT_FACTOR;
+#endif
+
+ if(opts->menuDelay<MIN_MENU_DELAY || opts->menuDelay>MAX_MENU_DELAY)
+ opts->menuDelay=DEFAULT_MENU_DELAY;
+
+ if(0==opts->sliderWidth%2)
+ opts->sliderWidth++;
+
+ if(opts->sliderWidth<MIN_SLIDER_WIDTH || opts->sliderWidth>MAX_SLIDER_WIDTH)
+ opts->sliderWidth=DEFAULT_SLIDER_WIDTH;
+
+ if(opts->sliderWidth<DEFAULT_SLIDER_WIDTH)
+ opts->sliderThumbs=LINE_NONE;
+
+ if(opts->lighterPopupMenuBgnd<MIN_LIGHTER_POPUP_MENU || opts->lighterPopupMenuBgnd>MAX_LIGHTER_POPUP_MENU)
+ opts->lighterPopupMenuBgnd=DEF_POPUPMENU_LIGHT_FACTOR;
+
+ if(opts->tabBgnd<MIN_TAB_BGND || opts->tabBgnd>MAX_TAB_BGND)
+ opts->tabBgnd=DEF_TAB_BGND;
+
+ if(opts->animatedProgress && !opts->stripedProgress)
+ opts->animatedProgress=false;
+
+ if(0==opts->gbFactor)
+ opts->groupBox=FRAME_PLAIN;
+
+ if(opts->gbFactor<MIN_GB_FACTOR || opts->gbFactor>MAX_GB_FACTOR)
+ opts->gbFactor=DEF_GB_FACTOR;
+
+#if defined __cplusplus && defined QT_VERSION && QT_VERSION < 0x040000 && !defined CONFIG_DIALOG
+ opts->crSize=CR_SMALL_SIZE;
+ if(SLIDER_CIRCULAR==opts->sliderStyle)
+ opts->sliderStyle=SLIDER_ROUND;
+ if(STRIPE_FADE==opts->stripedProgress)
+ opts->stripedProgress=STRIPE_PLAIN;
+#endif
+ /* For now, only 2 sizes... */
+ if(opts->crSize!=CR_SMALL_SIZE && opts->crSize!=CR_LARGE_SIZE)
+ opts->crSize=CR_SMALL_SIZE;
+
+/*
+??
+ if(SHADE_CUSTOM==opts->shadeMenubars || SHADE_BLEND_SELECTED==opts->shadeMenubars || !opts->borderMenuitems)
+ opts->colorMenubarMouseOver=true;
+*/
+
+#if defined __cplusplus && defined QT_VERSION && QT_VERSION < 0x040000 && !defined CONFIG_DIALOG
+ if(opts->round>ROUND_FULL)
+ opts->round=ROUND_FULL;
+#endif
+#ifndef CONFIG_DIALOG
+ if(MO_GLOW==opts->coloredMouseOver && EFFECT_NONE==opts->buttonEffect)
+ opts->coloredMouseOver=MO_COLORED_THICK;
+
+ if(IND_GLOW==opts->defBtnIndicator && EFFECT_NONE==opts->buttonEffect)
+ opts->defBtnIndicator=IND_TINT;
+
+ if(opts->round>ROUND_EXTRA && FOCUS_GLOW!=opts->focus)
+ opts->focus=FOCUS_LINE;
+
+ if(EFFECT_NONE==opts->buttonEffect)
+ {
+ opts->etchEntry=false;
+ if(FOCUS_GLOW==opts->focus)
+ opts->focus=FOCUS_FULL;
+ }
+
+// if(opts->squareScrollViews)
+// opts->highlightScrollViews=false;
+
+ if(SHADE_WINDOW_BORDER==opts->shadeMenubars)
+ opts->shadeMenubarOnlyWhenActive=true;
+
+ if(MO_GLOW==opts->coloredMouseOver)
+ opts->coloredTbarMo=true;
+
+ if(opts->round<ROUND_SLIGHT)
+ opts->square|=SQUARE_POPUP_MENUS|SQUARE_TOOLTIPS;
+#endif
+
+ if(opts->bgndOpacity<0 || opts->bgndOpacity>100)
+ opts->bgndOpacity=100;
+ if(opts->dlgOpacity<0 || opts->dlgOpacity>100)
+ opts->dlgOpacity=100;
+ if(opts->menuBgndOpacity<0 || opts->menuBgndOpacity>100)
+ opts->menuBgndOpacity=100;
+
+#ifndef CONFIG_DIALOG
+ opts->bgndAppearance=MODIFY_AGUA(opts->bgndAppearance);
+ opts->selectionAppearance=MODIFY_AGUA(opts->selectionAppearance);
+ opts->lvAppearance=MODIFY_AGUA_X(opts->lvAppearance, APPEARANCE_LV_AGUA);
+ opts->sbarBgndAppearance=MODIFY_AGUA(opts->sbarBgndAppearance);
+ opts->tooltipAppearance=MODIFY_AGUA(opts->tooltipAppearance);
+ opts->progressGrooveAppearance=MODIFY_AGUA(opts->progressGrooveAppearance);
+ opts->menuBgndAppearance=MODIFY_AGUA(opts->menuBgndAppearance);
+ opts->menuStripeAppearance=MODIFY_AGUA(opts->menuStripeAppearance);
+ opts->grooveAppearance=MODIFY_AGUA(opts->grooveAppearance);
+ opts->progressAppearance=MODIFY_AGUA(opts->progressAppearance);
+ opts->sliderFill=MODIFY_AGUA(opts->sliderFill);
+ opts->tabAppearance=MODIFY_AGUA(opts->tabAppearance);
+ opts->activeTabAppearance=MODIFY_AGUA(opts->activeTabAppearance);
+ opts->menuitemAppearance=MODIFY_AGUA(opts->menuitemAppearance);
+
+ if(!opts->borderProgress && (!opts->fillProgress || !(opts->square&SQUARE_PROGRESS)))
+ opts->borderProgress=true;
+
+ opts->titlebarAppearance=MODIFY_AGUA(opts->titlebarAppearance);
+ opts->inactiveTitlebarAppearance=MODIFY_AGUA(opts->inactiveTitlebarAppearance);
+
+ if(opts->shadePopupMenu && SHADE_NONE==opts->shadeMenubars)
+ opts->shadePopupMenu=false;
+
+ if(opts->shadePopupMenu)
+ opts->lighterPopupMenuBgnd=0;
+#ifdef __cplusplus
+
+#if defined QT_VERSION && QT_VERSION >= 0x040000
+ if(!(opts->titlebarButtons&TITLEBAR_BUTTON_ROUND))
+#endif
+ opts->titlebarButtonAppearance=MODIFY_AGUA(opts->titlebarButtonAppearance);
+ opts->dwtAppearance=MODIFY_AGUA(opts->dwtAppearance);
+#endif
+ if(opts->windowBorder&WINDOW_BORDER_USE_MENUBAR_COLOR_FOR_TITLEBAR &&
+ (opts->windowBorder&WINDOW_BORDER_BLEND_TITLEBAR || SHADE_WINDOW_BORDER==opts->shadeMenubars))
+ opts->windowBorder-=WINDOW_BORDER_USE_MENUBAR_COLOR_FOR_TITLEBAR;
+
+ if(APPEARANCE_FLAT==opts->tabAppearance)
+ opts->tabAppearance=APPEARANCE_RAISED;
+ if(EFFECT_NONE==opts->buttonEffect)
+ opts->etchEntry=false;
+ if(opts->colorSliderMouseOver &&
+ (SHADE_NONE==opts->shadeSliders || SHADE_DARKEN==opts->shadeSliders))
+ opts->colorSliderMouseOver=false;
+#endif /* ndef CONFIG_DIALOG */
+
+ if(LINE_1DOT==opts->toolbarSeparators)
+ opts->toolbarSeparators=LINE_DOTS;
+}
+
+#ifdef __cplusplus
+static bool readConfig(const QString &file, Options *opts, Options *defOpts=0L)
#else
-static bool readConfig(const char *file, Options *opts, Options *def)
+static bool readConfig(const char *file, Options *opts, Options *defOpts)
#endif
{
#ifdef __cplusplus
if(file.isEmpty())
{
- const char *xdg=xdgConfigFolder();
+ const char *env=getenv("QTCURVE_CONFIG_FILE");
- if(xdg)
+ if(NULL!=env)
+ return readConfig(env, opts, defOpts);
+ else
{
- QString filename(xdg);
+ const char *cfgDir=qtcConfDir();
+
+ if(cfgDir)
+ {
+ QString filename(QFile::decodeName(cfgDir)+CONFIG_FILE);
- filename+="/"QTC_FILE;
- return readConfig(filename, opts, def);
+ if(!QFile::exists(filename))
+ filename=QFile::decodeName(cfgDir)+"../"OLD_CONFIG_FILE;
+ return readConfig(filename, opts, defOpts);
+ }
}
}
#else
if(!file)
{
- const char *xdg=xdgConfigFolder();
+ const char *env=getenv("QTCURVE_CONFIG_FILE");
- if(xdg)
+ if(NULL!=env)
+ return readConfig(env, opts, defOpts);
+ else
{
- char filename[QTC_MAX_FILENAME_LEN];
+ const char *cfgDir=qtcConfDir();
- sprintf(filename, "%s/"QTC_FILE, xdg);
- return readConfig(filename, opts, def);
+ if(cfgDir)
+ {
+ char *filename=(char *)malloc(strlen(cfgDir)+strlen(OLD_CONFIG_FILE)+4);
+ bool rv=false;
+
+ sprintf(filename, "%s"CONFIG_FILE, cfgDir);
+ if(!qtcFileExists(filename))
+ sprintf(filename, "%s../"OLD_CONFIG_FILE, cfgDir);
+ rv=readConfig(filename, opts, defOpts);
+ free(filename);
+ return rv;
+ }
}
}
#endif
@@ -666,117 +1656,638 @@ static bool readConfig(const char *file, Options *opts, Options *def)
if(cfg)
{
#endif
- QTC_CFG_READ_NUM(passwordChar)
- QTC_CFG_READ_ROUND(round)
- QTC_CFG_READ_DI(highlightFactor)
- QTC_CFG_READ_TB_BORDER(toolbarBorders)
- QTC_CFG_READ_APPEARANCE(appearance, def->appearance)
- QTC_CFG_READ_BOOL(fixParentlessDialogs)
- QTC_CFG_READ_STRIPE(stripedProgress)
- QTC_CFG_READ_SLIDER(sliderStyle)
- QTC_CFG_READ_BOOL(animatedProgress)
- QTC_CFG_READ_BOOL(lighterPopupMenuBgnd)
- QTC_CFG_READ_BOOL(embolden)
- QTC_CFG_READ_DEF_BTN(defBtnIndicator)
- QTC_CFG_READ_LINE(sliderThumbs)
- QTC_CFG_READ_LINE(handles)
- QTC_CFG_READ_BOOL(highlightTab)
- QTC_CFG_READ_BOOL(colorSelTab)
- QTC_CFG_READ_SHADE(shadeSliders, false)
- QTC_CFG_READ_SHADE(shadeMenubars, true)
- QTC_CFG_READ_SHADE(shadeCheckRadio, false)
- QTC_CFG_READ_APPEARANCE(menubarAppearance, def->menubarAppearance)
- QTC_CFG_READ_APPEARANCE(menuitemAppearance, opts->appearance)
- QTC_CFG_READ_APPEARANCE(toolbarAppearance, def->toolbarAppearance)
- QTC_CFG_READ_LINE(toolbarSeparators)
- QTC_CFG_READ_LINE(splitters)
- QTC_CFG_READ_BOOL(customMenuTextColor)
- QTC_CFG_READ_MOUSE_OVER(coloredMouseOver)
- QTC_CFG_READ_BOOL(menubarMouseOver)
- QTC_CFG_READ_BOOL(shadeMenubarOnlyWhenActive)
- QTC_CFG_READ_BOOL(thinnerMenuItems)
- QTC_CFG_READ_COLOR(customSlidersColor)
- QTC_CFG_READ_COLOR(customMenubarsColor)
- QTC_CFG_READ_COLOR(customMenuSelTextColor)
- QTC_CFG_READ_COLOR(customMenuNormTextColor)
- QTC_CFG_READ_COLOR(customCheckRadioColor)
- QTC_CFG_READ_SCROLLBAR(scrollbarType)
- QTC_CFG_READ_EFFECT(buttonEffect)
- QTC_CFG_READ_APPEARANCE(lvAppearance, opts->appearance)
- QTC_CFG_READ_APPEARANCE(tabAppearance, opts->appearance)
- QTC_CFG_READ_APPEARANCE(sliderAppearance, opts->appearance)
- QTC_CFG_READ_APPEARANCE(progressAppearance, opts->appearance)
-#ifndef QTC_PLAIN_FOCUS_ONLY
- QTC_CFG_READ_BOOL(stdFocus)
-#endif
- QTC_CFG_READ_BOOL(lvLines)
- QTC_CFG_READ_BOOL(drawStatusBarFrames)
- QTC_CFG_READ_BOOL(fillSlider)
- QTC_CFG_READ_BOOL(roundMbTopOnly)
- QTC_CFG_READ_BOOL(borderMenuitems)
- QTC_CFG_READ_BOOL(gradientPbGroove)
- QTC_CFG_READ_BOOL(darkerBorders)
- QTC_CFG_READ_BOOL(vArrows)
- QTC_CFG_READ_BOOL(xCheck)
- QTC_CFG_READ_BOOL(framelessGroupBoxes)
- QTC_CFG_READ_BOOL(inactiveHighlight)
- QTC_CFG_READ_BOOL(colorMenubarMouseOver)
+ int i;
+
+ opts->version=readVersionEntry(cfg, VERSION_KEY);
+
#ifdef __cplusplus
- QTC_CFG_READ_BOOL(stdSidebarButtons)
- QTC_CFG_READ_BOOL(gtkScrollViews)
- QTC_CFG_READ_BOOL(gtkComboMenus)
-/*
+ Options newOpts;
+
+ if(defOpts)
+ newOpts=*defOpts;
+ else
+ defaultSettings(&newOpts);
+
+ Options *def=&newOpts;
+
+ if(opts!=def)
+ opts->customGradient=def->customGradient;
+
#else
- QTC_CFG_READ_BOOL(setDialogButtonOrder)
-*/
-#endif
-#if !defined __cplusplus || defined QTC_CONFIG_DIALOG
- QTC_CFG_READ_BOOL(mapKdeIcons)
+ Options newOpts;
+ Options *def=&newOpts;
+#ifdef QTC_ENABLE_PARENTLESS_DIALOG_FIX_SUPPORT
+ opts->noDlgFixApps=NULL;
#endif
-#if defined QTC_CONFIG_DIALOG || (defined QT_VERSION && (QT_VERSION >= 0x040000)) || !defined __cplusplus
- QTC_CFG_READ_BOOL(gtkButtonOrder)
+ opts->noBgndGradientApps=opts->noBgndOpacityApps=opts->noMenuBgndOpacityApps=opts->noBgndImageApps=opts->noMenuStripeApps=NULL;
+ for(i=0; i<NUM_CUSTOM_GRAD; ++i)
+ opts->customGradient[i]=NULL;
+
+ if(defOpts)
+ copyOpts(defOpts, &newOpts);
+ else
+ defaultSettings(&newOpts);
+ if(opts!=def)
+ copyGradients(def, opts);
#endif
- QTC_CFG_READ_SHADING(shading, shading);
-#ifndef __cplusplus
- releaseConfig(cfg);
+ /* Check if the config file expects old default values... */
+ if(opts->version<MAKE_VERSION(1, 6))
+ {
+ bool framelessGroupBoxes=readBoolEntry(cfg, "framelessGroupBoxes", true),
+ groupBoxLine=readBoolEntry(cfg, "groupBoxLine", true);
+ opts->groupBox=framelessGroupBoxes ? (groupBoxLine ? FRAME_LINE : FRAME_NONE) : FRAME_PLAIN;
+ opts->gbLabel=framelessGroupBoxes ? GB_LBL_BOLD : 0;
+ opts->gbFactor=0;
+ def->focus=FOCUS_LINE;
+ def->crHighlight=3;
+ }
+ else
+ {
+ CFG_READ_FRAME(groupBox)
+ CFG_READ_INT(gbLabel)
+ }
+
+ if(opts->version<MAKE_VERSION(1, 5))
+ {
+ opts->windowBorder=
+ (readBoolEntry(cfg, "colorTitlebarOnly", def->windowBorder&WINDOW_BORDER_COLOR_TITLEBAR_ONLY)
+ ? WINDOW_BORDER_COLOR_TITLEBAR_ONLY : 0)+
+ (readBoolEntry(cfg, "titlebarBorder", def->windowBorder&WINDOW_BORDER_ADD_LIGHT_BORDER)
+ ? WINDOW_BORDER_ADD_LIGHT_BORDER : 0)+
+ (readBoolEntry(cfg, "titlebarBlend", def->windowBorder&WINDOW_BORDER_BLEND_TITLEBAR)
+ ? WINDOW_BORDER_BLEND_TITLEBAR : 0);
+ }
+ else
+ CFG_READ_INT(windowBorder);
+
+ if(opts->version<MAKE_VERSION(1, 4))
+ {
+ opts->square=
+ (readBoolEntry(cfg, "squareLvSelection", def->square&SQUARE_LISTVIEW_SELECTION) ? SQUARE_LISTVIEW_SELECTION : SQUARE_NONE)+
+ (readBoolEntry(cfg, "squareScrollViews", def->square&SQUARE_SCROLLVIEW) ? SQUARE_SCROLLVIEW : SQUARE_NONE)+
+ (readBoolEntry(cfg, "squareProgress", def->square&SQUARE_PROGRESS) ? SQUARE_PROGRESS : SQUARE_NONE)+
+ (readBoolEntry(cfg, "squareEntry", def->square&SQUARE_ENTRY)? SQUARE_ENTRY : SQUARE_NONE);
+ }
+ else
+ CFG_READ_INT(square)
+
+ if(opts->version<MAKE_VERSION(1, 6))
+ opts->square|=SQUARE_TOOLTIPS;
+ if(opts->version<MAKE_VERSION3(1, 6, 1))
+ opts->square|=SQUARE_POPUP_MENUS;
+ if(opts->version<MAKE_VERSION(1, 2))
+ def->crSize=CR_SMALL_SIZE;
+ if(opts->version<MAKE_VERSION(1, 0))
+ {
+ def->roundAllTabs=false;
+ def->smallRadio=false;
+ def->splitters=LINE_FLAT;
+ def->handles=LINE_SUNKEN;
+ def->crHighlight=0;
+#ifdef __cplusplus
+ def->dwtAppearance=APPEARANCE_FLAT;
+#if defined QT_VERSION && (QT_VERSION >= 0x040000)
+ def->dwtSettings=0;
#endif
- if(SHADE_SELECTED==opts->shadeCheckRadio)
- opts->shadeCheckRadio=SHADE_BLEND_SELECTED;
+#endif
+ def->inactiveTitlebarAppearance=APPEARANCE_CUSTOM2;
+ }
+ if(opts->version<MAKE_VERSION(0, 67))
+ def->doubleGtkComboArrow=false;
+ if(opts->version<MAKE_VERSION(0, 66))
+ {
+ def->menuStripeAppearance=APPEARANCE_GRADIENT;
+ def->etchEntry=true;
+ def->gtkScrollViews=false;
+ def->thinSbarGroove=false;
+#if defined CONFIG_DIALOG || (defined QT_VERSION && (QT_VERSION >= 0x040000))
+ def->titlebarButtons=TITLEBAR_BUTTON_HOVER_FRAME;
+ def->titlebarIcon=TITLEBAR_ICON_MENU_BUTTON;
+#endif
+ }
+ if(opts->version<MAKE_VERSION(0, 65))
+ {
+ def->tabMouseOver=TAB_MO_BOTTOM;
+ def->activeTabAppearance=APPEARANCE_FLAT;
+ def->unifySpin=false;
+ def->unifyCombo=false;
+ def->borderTab=false;
+ def->thinnerBtns=false;
+ }
+ if(opts->version<MAKE_VERSION(0, 63))
+ {
+ def->tabMouseOver=TAB_MO_TOP;
+ def->sliderStyle=SLIDER_TRIANGULAR;
+#ifdef __cplusplus
+ def->titlebarAlignment=ALIGN_LEFT;
+#endif
+ }
+ if(opts->version<MAKE_VERSION(0, 62))
+ {
+ def->titlebarAppearance=APPEARANCE_GRADIENT;
+ def->inactiveTitlebarAppearance=APPEARANCE_GRADIENT;
+ def->round=ROUND_FULL;
+ def->appearance=APPEARANCE_DULL_GLASS;
+ def->sliderAppearance=APPEARANCE_DULL_GLASS;
+ def->menuitemAppearance=APPEARANCE_DULL_GLASS;
+ def->useHighlightForMenu=true;
+ def->tabAppearance=APPEARANCE_GRADIENT;
+ def->highlightFactor=5;
+ def->toolbarSeparators=LINE_NONE;
+ def->menubarAppearance=APPEARANCE_SOFT_GRADIENT;
+ def->crButton=false;
+ def->customShades[0]=0;
+ def->stripedProgress=STRIPE_DIAGONAL;
+ def->sunkenAppearance=APPEARANCE_INVERTED;
+ def->focus=FOCUS_FILLED;
+ }
+ if(opts->version<MAKE_VERSION(0, 61))
+ {
+ def->coloredMouseOver=MO_PLASTIK;
+ def->buttonEffect=EFFECT_NONE;
+ def->defBtnIndicator=IND_TINT;
+ def->vArrows=false;
+ def->toolbarAppearance=APPEARANCE_GRADIENT;
+ def->focus=FOCUS_STANDARD;
+ def->selectionAppearance=APPEARANCE_FLAT;
+ def->flatSbarButtons=false;
+ def->comboSplitter=true;
+ def->handles=LINE_DOTS;
+ def->lighterPopupMenuBgnd=15;
+ def->activeTabAppearance=APPEARANCE_GRADIENT;
+ def->gbLabel=GB_LBL_BOLD;
+ def->groupBox=FRAME_NONE;
+ def->shadeSliders=SHADE_BLEND_SELECTED;
+ def->progressGrooveColor=ECOLOR_BASE;
+ def->shadeMenubars=SHADE_DARKEN;
+ opts->highlightTab=true;
+ }
- checkColor(&opts->shadeMenubars, &opts->customMenubarsColor);
- checkColor(&opts->shadeSliders, &opts->customSlidersColor);
- checkColor(&opts->shadeCheckRadio, &opts->customCheckRadioColor);
+ if(opts!=def)
+ {
+ opts->customShades[0]=0;
+ opts->customAlphas[0]=0;
+ if(USE_CUSTOM_SHADES(*def))
+ memcpy(opts->customShades, def->customShades, sizeof(double)*NUM_STD_SHADES);
+ }
- if(APPEARANCE_BEVELLED==opts->toolbarAppearance)
- opts->toolbarAppearance=APPEARANCE_GRADIENT;
- else if(APPEARANCE_RAISED==opts->toolbarAppearance)
- opts->toolbarAppearance=APPEARANCE_FLAT;
+ CFG_READ_INT(gbFactor)
+ CFG_READ_INT(passwordChar)
+ CFG_READ_ROUND(round)
+ CFG_READ_INT(highlightFactor)
+ CFG_READ_INT(menuDelay)
+ CFG_READ_INT(sliderWidth)
+ CFG_READ_INT_BOOL(lighterPopupMenuBgnd, def->lighterPopupMenuBgnd)
+ CFG_READ_INT(tabBgnd)
+ CFG_READ_TB_BORDER(toolbarBorders)
+ CFG_READ_APPEARANCE(appearance, APP_ALLOW_BASIC)
+ CFG_READ_APPEARANCE(bgndAppearance, APP_ALLOW_STRIPED)
+ CFG_READ_GRAD_TYPE(bgndGrad)
+ CFG_READ_GRAD_TYPE(menuBgndGrad)
+ CFG_READ_APPEARANCE(menuBgndAppearance, APP_ALLOW_STRIPED)
+#ifdef QTC_ENABLE_PARENTLESS_DIALOG_FIX_SUPPORT
+ CFG_READ_BOOL(fixParentlessDialogs)
+ CFG_READ_STRING_LIST(noDlgFixApps)
+#endif
+ CFG_READ_STRIPE(stripedProgress)
+ CFG_READ_SLIDER(sliderStyle)
+ CFG_READ_BOOL(animatedProgress)
+ CFG_READ_BOOL(embolden)
+ CFG_READ_DEF_BTN(defBtnIndicator)
+ CFG_READ_LINE(sliderThumbs)
+ CFG_READ_LINE(handles)
+ CFG_READ_BOOL(highlightTab)
+ CFG_READ_INT_BOOL(colorSelTab, DEF_COLOR_SEL_TAB_FACTOR)
+ CFG_READ_BOOL(roundAllTabs)
+ CFG_READ_TAB_MO(tabMouseOver)
+ CFG_READ_SHADE(shadeSliders, true, false, &opts->customSlidersColor)
+ CFG_READ_SHADE(shadeMenubars, true, false, &opts->customMenubarsColor)
+ CFG_READ_SHADE(shadeCheckRadio, false, false, &opts->customCheckRadioColor)
+ CFG_READ_SHADE(sortedLv, true, false, &opts->customSortedLvColor)
+ CFG_READ_SHADE(crColor, true, false, &opts->customCrBgndColor)
+ CFG_READ_SHADE(progressColor, false, false, &opts->customProgressColor)
+ CFG_READ_APPEARANCE(menubarAppearance, APP_ALLOW_BASIC)
+ CFG_READ_APPEARANCE(menuitemAppearance, APP_ALLOW_FADE)
+ CFG_READ_APPEARANCE(toolbarAppearance, APP_ALLOW_BASIC)
+ CFG_READ_APPEARANCE(selectionAppearance, APP_ALLOW_BASIC)
+#ifdef __cplusplus
+ CFG_READ_APPEARANCE(dwtAppearance, APP_ALLOW_BASIC)
+#endif
+ CFG_READ_LINE(toolbarSeparators)
+ CFG_READ_LINE(splitters)
+ CFG_READ_BOOL(customMenuTextColor)
+ CFG_READ_MOUSE_OVER(coloredMouseOver)
+ CFG_READ_BOOL(menubarMouseOver)
+ CFG_READ_BOOL(useHighlightForMenu)
+ CFG_READ_BOOL(shadeMenubarOnlyWhenActive)
+ CFG_READ_BOOL(thinnerMenuItems)
+ CFG_READ_BOOL(thinnerBtns)
+ if(opts->version<MAKE_VERSION(0, 63))
+ {
+ if(IS_BLACK(opts->customSlidersColor))
+ CFG_READ_COLOR(customSlidersColor)
+ if(IS_BLACK(opts->customMenubarsColor))
+ CFG_READ_COLOR(customMenubarsColor)
+ if(IS_BLACK(opts->customCheckRadioColor))
+ CFG_READ_COLOR(customCheckRadioColor)
+ }
+ CFG_READ_COLOR(customMenuSelTextColor)
+ CFG_READ_COLOR(customMenuNormTextColor)
+ CFG_READ_SCROLLBAR(scrollbarType)
+ CFG_READ_EFFECT(buttonEffect)
+ CFG_READ_APPEARANCE(lvAppearance, APP_ALLOW_BASIC)
+ CFG_READ_APPEARANCE(tabAppearance, APP_ALLOW_BASIC)
+ CFG_READ_APPEARANCE(activeTabAppearance, APP_ALLOW_BASIC)
+ CFG_READ_APPEARANCE(sliderAppearance, APP_ALLOW_BASIC)
+ CFG_READ_APPEARANCE(progressAppearance, APP_ALLOW_BASIC)
+ CFG_READ_APPEARANCE(progressGrooveAppearance, APP_ALLOW_BASIC)
+ CFG_READ_APPEARANCE(grooveAppearance, APP_ALLOW_BASIC)
+ CFG_READ_APPEARANCE(sunkenAppearance, APP_ALLOW_BASIC)
+ CFG_READ_APPEARANCE(sbarBgndAppearance, APP_ALLOW_BASIC)
+ if(opts->version<MAKE_VERSION(1, 6))
+ opts->tooltipAppearance=APPEARANCE_FLAT;
+ else
+ {
+ CFG_READ_APPEARANCE(tooltipAppearance, APP_ALLOW_BASIC)
+ }
- if(APPEARANCE_BEVELLED==opts->menubarAppearance)
- opts->menubarAppearance=APPEARANCE_GRADIENT;
- else if(APPEARANCE_RAISED==opts->menubarAppearance)
- opts->menubarAppearance=APPEARANCE_FLAT;
+ if(opts->version<MAKE_VERSION(0, 63))
+ opts->sliderFill=IS_FLAT(opts->appearance) ? opts->grooveAppearance : APPEARANCE_GRADIENT;
+ else
+ {
+ CFG_READ_APPEARANCE(sliderFill, APP_ALLOW_BASIC)
+ }
+ CFG_READ_ECOLOR(progressGrooveColor)
+ CFG_READ_FOCUS(focus)
+ CFG_READ_BOOL(lvButton)
+ CFG_READ_LV_LINES(lvLines)
+ CFG_READ_BOOL(drawStatusBarFrames)
+ CFG_READ_BOOL(fillSlider)
+ CFG_READ_BOOL(roundMbTopOnly)
+ CFG_READ_BOOL(borderMenuitems)
+ CFG_READ_BOOL(darkerBorders)
+ CFG_READ_BOOL(vArrows)
+ CFG_READ_BOOL(xCheck)
+#if defined CONFIG_DIALOG || (defined QT_VERSION && (QT_VERSION >= 0x040000)) || !defined __cplusplus
+ CFG_READ_BOOL(fadeLines)
+ CFG_READ_GLOW(glowProgress)
+#endif
+ CFG_READ_BOOL(colorMenubarMouseOver)
+ CFG_READ_INT_BOOL(crHighlight, opts->highlightFactor)
+ CFG_READ_BOOL(crButton)
+ CFG_READ_BOOL(smallRadio)
+ CFG_READ_BOOL(fillProgress)
+ CFG_READ_BOOL(comboSplitter)
+ CFG_READ_BOOL(highlightScrollViews)
+ CFG_READ_BOOL(etchEntry)
+ CFG_READ_INT_BOOL(splitterHighlight, opts->highlightFactor)
+ CFG_READ_INT(crSize)
+ CFG_READ_BOOL(flatSbarButtons)
+ CFG_READ_BOOL(borderSbarGroove)
+ CFG_READ_BOOL(borderProgress)
+ CFG_READ_BOOL(popupBorder)
+ CFG_READ_BOOL(unifySpinBtns)
+ CFG_READ_BOOL(unifySpin)
+ CFG_READ_BOOL(unifyCombo)
+ CFG_READ_BOOL(borderTab)
+ CFG_READ_BOOL(borderInactiveTab)
+ CFG_READ_BOOL(thinSbarGroove)
+ CFG_READ_BOOL(colorSliderMouseOver)
+ CFG_READ_BOOL(menuIcons)
+ CFG_READ_BOOL(forceAlternateLvCols)
+ CFG_READ_BOOL(invertBotTab)
+ CFG_READ_INT_BOOL(menubarHiding, HIDE_KEYBOARD)
+ CFG_READ_INT_BOOL(statusbarHiding, HIDE_KEYBOARD)
+ CFG_READ_BOOL(boldProgress)
+ CFG_READ_BOOL(coloredTbarMo)
+ CFG_READ_BOOL(borderSelection)
+ CFG_READ_BOOL(stripedSbar)
+ CFG_READ_INT_BOOL(windowDrag, WM_DRAG_MENUBAR)
+ CFG_READ_BOOL(shadePopupMenu)
+
+#if defined CONFIG_DIALOG || (defined QT_VERSION && (QT_VERSION >= 0x040000))
+ CFG_READ_BOOL(stdBtnSizes)
+ CFG_READ_INT(titlebarButtons)
+ CFG_READ_TB_ICON(titlebarIcon)
+#endif
+#if defined QT_VERSION && (QT_VERSION >= 0x040000)
+ CFG_READ_BOOL(xbar)
+ CFG_READ_INT(dwtSettings)
+#endif
+ CFG_READ_INT(bgndOpacity)
+ CFG_READ_INT(menuBgndOpacity)
+ CFG_READ_INT(dlgOpacity)
+ CFG_READ_SHADE(menuStripe, true, true, &opts->customMenuStripeColor)
+ CFG_READ_APPEARANCE(menuStripeAppearance, APP_ALLOW_BASIC)
+ if(opts->version<MAKE_VERSION(0, 63) && IS_BLACK(opts->customMenuStripeColor))
+ CFG_READ_COLOR(customMenuStripeColor)
+ CFG_READ_SHADE(comboBtn, true, false, &opts->customComboBtnColor);
+ CFG_READ_BOOL(gtkScrollViews)
+ CFG_READ_BOOL(doubleGtkComboArrow)
+ CFG_READ_BOOL(stdSidebarButtons)
+ CFG_READ_BOOL(toolbarTabs)
+#ifdef __cplusplus
+ CFG_READ_ALIGN(titlebarAlignment)
+ CFG_READ_EFFECT(titlebarEffect)
+ CFG_READ_BOOL(gtkComboMenus)
+ CFG_READ_BOOL(centerTabText)
+/*
+#else
+ CFG_READ_BOOL(setDialogButtonOrder)
+*/
+#endif
+#if !defined __cplusplus || defined CONFIG_DIALOG
+ CFG_READ_INT(expanderHighlight)
+ CFG_READ_BOOL(mapKdeIcons)
+#endif
+#if defined CONFIG_DIALOG || (defined QT_VERSION && (QT_VERSION >= 0x040000)) || !defined __cplusplus
+ CFG_READ_BOOL(gtkButtonOrder)
+#endif
+#if !defined __cplusplus || (defined CONFIG_DIALOG && defined QT_VERSION && (QT_VERSION >= 0x040000))
+ CFG_READ_BOOL(reorderGtkButtons)
+#endif
+ CFG_READ_APPEARANCE(titlebarAppearance, APP_ALLOW_NONE)
+ CFG_READ_APPEARANCE(inactiveTitlebarAppearance, APP_ALLOW_NONE)
+
+ if(APPEARANCE_BEVELLED==opts->titlebarAppearance)
+ opts->titlebarAppearance=APPEARANCE_GRADIENT;
+ else if(APPEARANCE_RAISED==opts->titlebarAppearance)
+ opts->titlebarAppearance=APPEARANCE_FLAT;
+ if((opts->windowBorder&WINDOW_BORDER_BLEND_TITLEBAR) && !(opts->windowBorder&WINDOW_BORDER_COLOR_TITLEBAR_ONLY))
+ opts->windowBorder-=WINDOW_BORDER_BLEND_TITLEBAR;
+ if(APPEARANCE_BEVELLED==opts->inactiveTitlebarAppearance)
+ opts->inactiveTitlebarAppearance=APPEARANCE_GRADIENT;
+ else if(APPEARANCE_RAISED==opts->inactiveTitlebarAppearance)
+ opts->inactiveTitlebarAppearance=APPEARANCE_FLAT;
+#ifdef __cplusplus
+ CFG_READ_APPEARANCE(titlebarButtonAppearance, APP_ALLOW_BASIC)
+#if defined QT_VERSION && (QT_VERSION >= 0x040000)
+ if(opts->xbar && opts->menubarHiding)
+ opts->xbar=false;
+#endif
+#endif
+ CFG_READ_SHADING(shading)
+ CFG_READ_IMAGE(bgndImage)
+ CFG_READ_IMAGE(menuBgndImage)
+ CFG_READ_STRING_LIST(noMenuStripeApps)
+#if !defined __cplusplus || (defined QT_VERSION && (QT_VERSION >= 0x040000))
+ CFG_READ_STRING_LIST(noBgndGradientApps)
+ CFG_READ_STRING_LIST(noBgndOpacityApps)
+ CFG_READ_STRING_LIST(noMenuBgndOpacityApps)
+ CFG_READ_STRING_LIST(noBgndImageApps)
+#endif
+#if defined QT_VERSION && (QT_VERSION >= 0x040000)
+ CFG_READ_STRING_LIST(menubarApps)
+ CFG_READ_STRING_LIST(statusbarApps)
+ CFG_READ_STRING_LIST(useQtFileDialogApps)
+ CFG_READ_STRING_LIST(windowDragWhiteList)
+ CFG_READ_STRING_LIST(windowDragBlackList)
+#endif
+ readDoubleList(cfg, "customShades", opts->customShades, NUM_STD_SHADES);
+ readDoubleList(cfg, "customAlphas", opts->customAlphas, NUM_STD_ALPHAS);
+
+#ifdef __cplusplus
+#if defined CONFIG_DIALOG || (defined QT_VERSION && (QT_VERSION >= 0x040000))
+ if(opts->titlebarButtons&TITLEBAR_BUTTON_COLOR || opts->titlebarButtons&TITLEBAR_BUTTON_ICON_COLOR)
+ {
+#if (defined QT_VERSION && (QT_VERSION >= 0x040000))
+ QStringList cols(readStringEntry(cfg, "titlebarButtonColors").split(',', QString::SkipEmptyParts));
+#else
+ QStringList cols(QStringList::split(',', readStringEntry(cfg, "titlebarButtonColors")));
+#endif
+ if(cols.count() && 0==(cols.count()%NUM_TITLEBAR_BUTTONS) && cols.count()<=(NUM_TITLEBAR_BUTTONS*3))
+ {
+ QStringList::ConstIterator it(cols.begin()),
+ end(cols.end());
+
+ for(int i=0; it!=end; ++it, ++i)
+ {
+ QColor col;
+ setRgb(&col, TO_LATIN1((*it)));
+ opts->titlebarButtonColors[i]=col;
+ }
+ if(cols.count()<(NUM_TITLEBAR_BUTTONS+1))
+ opts->titlebarButtons&=~TITLEBAR_BUTTON_ICON_COLOR;
+ }
+ else
+ {
+ opts->titlebarButtons&=~TITLEBAR_BUTTON_COLOR;
+ opts->titlebarButtons&=~TITLEBAR_BUTTON_ICON_COLOR;
+ }
+ }
+#endif
- if(APPEARANCE_BEVELLED==opts->sliderAppearance)
- opts->sliderAppearance=APPEARANCE_GRADIENT;
+ for(i=APPEARANCE_CUSTOM1; i<(APPEARANCE_CUSTOM1+NUM_CUSTOM_GRAD); ++i)
+ {
+ QString gradKey;
- if(APPEARANCE_BEVELLED==opts->tabAppearance)
- opts->tabAppearance=APPEARANCE_GRADIENT;
+ gradKey.sprintf("customgradient%d", (i-APPEARANCE_CUSTOM1)+1);
- if(opts->highlightFactor<((100.0+MIN_HIGHLIGHT_FACTOR)/100.0) ||
- opts->highlightFactor>((100.0+MAX_HIGHLIGHT_FACTOR)/100.0))
- opts->highlightFactor=DEFAULT_HIGHLIGHT_FACTOR;
+#if (defined QT_VERSION && (QT_VERSION >= 0x040000))
+ QStringList vals(readStringEntry(cfg, gradKey).split(',', QString::SkipEmptyParts));
+#else
+ QStringList vals(QStringList::split(',', readStringEntry(cfg, gradKey)));
+#endif
- if(opts->animatedProgress && !opts->stripedProgress)
- opts->animatedProgress=false;
+ if(vals.size())
+ opts->customGradient.erase((EAppearance)i);
+
+ if(vals.size()>=5)
+ {
+ QStringList::ConstIterator it(vals.begin()),
+ end(vals.end());
+ bool ok(true),
+ haveAlpha(false);
+ Gradient grad;
+ int j;
+
+ grad.border=toGradientBorder(TO_LATIN1((*it)), &haveAlpha);
+ ok=vals.size()%(haveAlpha ? 3 : 2);
+
+ for(++it, j=0; it!=end && ok; ++it, ++j)
+ {
+ double pos=(*it).toDouble(&ok),
+ val=ok ? (*(++it)).toDouble(&ok) : 0.0,
+ alpha=haveAlpha && ok ? (*(++it)).toDouble(&ok) : 1.0;
+
+ ok=ok && (pos>=0 && pos<=1.0) && (val>=0.0 && val<=2.0) && (alpha>=0.0 && alpha<=1.0);
+
+ if(ok)
+ grad.stops.insert(GradientStop(pos, val, alpha));
+ }
+
+ if(ok)
+ {
+ opts->customGradient[(EAppearance)i]=grad;
+ opts->customGradient[(EAppearance)i].stops=grad.stops.fix();
+ }
+ }
+ }
+#else
+ for(i=0; i<NUM_CUSTOM_GRAD; ++i)
+ {
+ char gradKey[18];
+ char *str;
+
+ sprintf(gradKey, "customgradient%d", i+1);
+ if((str=readStringEntry(cfg, gradKey)))
+ {
+ int j,
+ comma=0;
+
+ for(j=0; str[j]; ++j)
+ if(','==str[j])
+ comma++;
+
+ if(comma && opts->customGradient[i])
+ {
+ if(opts->customGradient[i]->stops)
+ free(opts->customGradient[i]->stops);
+ free(opts->customGradient[i]);
+ opts->customGradient[i]=0L;
+ }
+
+ if(comma>=4)
+ {
+ char *c=strchr(str, ',');
+
+ if(c)
+ {
+ bool haveAlpha=false;
+ EGradientBorder border=toGradientBorder(str, &haveAlpha);
+ int parts=haveAlpha ? 3 : 2;
+ bool ok=0==comma%parts;
+
+ *c='\0';
+
+ if(ok)
+ {
+ opts->customGradient[i]=malloc(sizeof(Gradient));
+ opts->customGradient[i]->numStops=comma/parts;
+ opts->customGradient[i]->stops=malloc(sizeof(GradientStop) * opts->customGradient[i]->numStops);
+ opts->customGradient[i]->border=border;
+ str=c+1;
+ for(j=0; j<comma && str && ok; j+=parts)
+ {
+ int stop=j/parts;
+ c=strchr(str, ',');
+
+ if(c)
+ {
+ *c='\0';
+ opts->customGradient[i]->stops[stop].pos=g_ascii_strtod(str, NULL);
+ str=c+1;
+ c=str ? strchr(str, ',') : 0L;
+
+ if(c || str)
+ {
+ if(c)
+ *c='\0';
+ opts->customGradient[i]->stops[stop].val=g_ascii_strtod(str, NULL);
+ str=c ? c+1 : c;
+ if(haveAlpha)
+ {
+ c=str ? strchr(str, ',') : 0L;
+ if(c || str)
+ {
+ if(c)
+ *c='\0';
+ opts->customGradient[i]->stops[stop].alpha=g_ascii_strtod(str, NULL);
+ str=c ? c+1 : c;
+ }
+ else
+ ok=false;
+ }
+ else
+ opts->customGradient[i]->stops[stop].alpha=1.0;
+ }
+ else
+ ok=false;
+ }
+ else
+ ok=false;
+
+ ok=ok &&
+ (opts->customGradient[i]->stops[stop].pos>=0 && opts->customGradient[i]->stops[stop].pos<=1.0) &&
+ (opts->customGradient[i]->stops[stop].val>=0.0 && opts->customGradient[i]->stops[stop].val<=2.0) &&
+ (opts->customGradient[i]->stops[stop].alpha>=0.0 && opts->customGradient[i]->stops[stop].alpha<=1.0);
+ }
+
+ if(ok)
+ {
+ int addStart=0,
+ addEnd=0;
+ if(opts->customGradient[i]->stops[0].pos>0.001)
+ addStart=1;
+ if(opts->customGradient[i]->stops[opts->customGradient[i]->numStops-1].pos<0.999)
+ addEnd=1;
+
+ if(addStart || addEnd)
+ {
+ int newSize=opts->customGradient[i]->numStops+addStart+addEnd;
+ GradientStop *stops=malloc(sizeof(GradientStop) * newSize);
+
+ if(addStart)
+ {
+ stops[0].pos=0.0;
+ stops[0].val=1.0;
+ stops[0].alpha=1.0;
+ }
+ memcpy(&stops[addStart], opts->customGradient[i]->stops, sizeof(GradientStop) * opts->customGradient[i]->numStops);
+ if(addEnd)
+ {
+ stops[opts->customGradient[i]->numStops+addStart].pos=1.0;
+ stops[opts->customGradient[i]->numStops+addStart].val=1.0;
+ stops[opts->customGradient[i]->numStops+addStart].alpha=1.0;
+ }
+ opts->customGradient[i]->numStops=newSize;
+ free(opts->customGradient[i]->stops);
+ opts->customGradient[i]->stops=stops;
+ }
+ }
+ else
+ {
+ free(opts->customGradient[i]->stops);
+ free(opts->customGradient[i]);
+ opts->customGradient[i]=0L;
+ }
+ }
+ }
+ }
+ }
+ }
+#endif
- if(opts->colorSelTab && APPEARANCE_GRADIENT!=opts->tabAppearance)
- opts->colorSelTab=false;
+ checkConfig(opts);
- if(SHADE_CUSTOM==opts->shadeMenubars || SHADE_BLEND_SELECTED==opts->shadeMenubars || !opts->borderMenuitems)
- opts->colorMenubarMouseOver=true;
+#ifndef __cplusplus
+ if(!defOpts)
+ {
+ int i;
+ for(i=0; i<NUM_CUSTOM_GRAD; ++i)
+ if(def->customGradient[i])
+ free(def->customGradient[i]);
+ }
+ releaseConfig(cfg);
+ freeOpts(defOpts);
+#endif
+ return true;
+ }
+ else
+ {
+#ifdef __cplusplus
+ if(defOpts)
+ *opts=*defOpts;
+ else
+ defaultSettings(opts);
+#else
+ if(defOpts)
+ copyOpts(defOpts, opts);
+ else
+ defaultSettings(opts);
+#endif
return true;
}
}
@@ -793,7 +2304,7 @@ static bool fileExists(const char *path)
static const char * getSystemConfigFile()
{
- static const char * constFiles[]={ "/etc/qt4/"QTC_FILE, "/etc/qt3/"QTC_FILE, "/etc/qt/"QTC_FILE, NULL };
+ static const char * constFiles[]={ /*"/etc/qt4/"OLD_CONFIG_FILE, "/etc/qt3/"OLD_CONFIG_FILE, "/etc/qt/"OLD_CONFIG_FILE,*/ "/etc/"OLD_CONFIG_FILE, NULL };
int i;
@@ -806,70 +2317,199 @@ static const char * getSystemConfigFile()
static void defaultSettings(Options *opts)
{
/* Set hard-coded defaults... */
+#ifndef __cplusplus
+ int i;
+
+ for(i=0; i<NUM_CUSTOM_GRAD; ++i)
+ opts->customGradient[i]=0L;
+ opts->customGradient[APPEARANCE_CUSTOM1]=malloc(sizeof(Gradient));
+ opts->customGradient[APPEARANCE_CUSTOM2]=malloc(sizeof(Gradient));
+ setupGradient(opts->customGradient[APPEARANCE_CUSTOM1], GB_3D,3,0.0,1.2,0.5,1.0,1.0,1.0);
+ setupGradient(opts->customGradient[APPEARANCE_CUSTOM2], GB_3D,3,0.0,0.9,0.5,1.0,1.0,1.0);
+#else
+ // Setup titlebar gradients...
+ setupGradient(&(opts->customGradient[APPEARANCE_CUSTOM1]), GB_3D,3,0.0,1.2,0.5,1.0,1.0,1.0);
+ setupGradient(&(opts->customGradient[APPEARANCE_CUSTOM2]), GB_3D,3,0.0,0.9,0.5,1.0,1.0,1.0);
+#endif
+ opts->customShades[0]=1.16;
+ opts->customShades[1]=1.07;
+ opts->customShades[2]=0.9;
+ opts->customShades[3]=0.78;
+ opts->customShades[4]=0.84;
+ opts->customShades[5]=0.75;
+ opts->customAlphas[0]=0;
opts->contrast=7;
opts->passwordChar=0x25CF;
+ opts->gbFactor=DEF_GB_FACTOR;
opts->highlightFactor=DEFAULT_HIGHLIGHT_FACTOR;
+ opts->crHighlight=DEFAULT_CR_HIGHLIGHT_FACTOR;
+ opts->splitterHighlight=DEFAULT_SPLITTER_HIGHLIGHT_FACTOR;
+ opts->crSize=CR_LARGE_SIZE;
+ opts->menuDelay=DEFAULT_MENU_DELAY;
+ opts->sliderWidth=DEFAULT_SLIDER_WIDTH;
+ opts->selectionAppearance=APPEARANCE_HARSH_GRADIENT;
+#if defined CONFIG_DIALOG || (defined QT_VERSION && (QT_VERSION >= 0x040000)) || !defined __cplusplus
+ opts->round=ROUND_EXTRA;
+ opts->fadeLines=true;
+ opts->glowProgress=GLOW_NONE;
+ opts->gtkButtonOrder=false;
+#else
opts->round=ROUND_FULL;
- opts->lighterPopupMenuBgnd=true;
- opts->animatedProgress=true;
- opts->stripedProgress=STRIPE_DIAGONAL;
- opts->sliderStyle=SLIDER_TRIANGULAR;
- opts->highlightTab=true;
- opts->colorSelTab=false;
+#endif
+#ifdef __cplusplus
+ opts->dwtAppearance=APPEARANCE_CUSTOM1;
+#endif
+#if !defined __cplusplus || (defined CONFIG_DIALOG && defined QT_VERSION && (QT_VERSION >= 0x040000))
+ opts->reorderGtkButtons=false;
+#endif
+ opts->bgndImage.type=IMG_NONE;
+ opts->menuBgndImage.type=IMG_NONE;
+ opts->lighterPopupMenuBgnd=DEF_POPUPMENU_LIGHT_FACTOR;
+ opts->tabBgnd=DEF_TAB_BGND;
+ opts->animatedProgress=false;
+ opts->stripedProgress=STRIPE_NONE;
+ opts->sliderStyle=SLIDER_PLAIN;
+ opts->highlightTab=false;
+ opts->colorSelTab=0;
+ opts->roundAllTabs=true;
+ opts->tabMouseOver=TAB_MO_GLOW;
opts->embolden=false;
- opts->appearance=APPEARANCE_DULL_GLASS;
+ opts->bgndGrad=GT_HORIZ;
+ opts->menuBgndGrad=GT_HORIZ;
+ opts->appearance=APPEARANCE_SOFT_GRADIENT;
+ opts->bgndAppearance=APPEARANCE_FLAT;
+ opts->menuBgndAppearance=APPEARANCE_FLAT;
opts->lvAppearance=APPEARANCE_BEVELLED;
- opts->tabAppearance=APPEARANCE_GRADIENT;
- opts->sliderAppearance=APPEARANCE_DULL_GLASS;
- opts->menubarAppearance=APPEARANCE_GRADIENT;
- opts->menuitemAppearance=APPEARANCE_DULL_GLASS;
+ opts->tabAppearance=APPEARANCE_SOFT_GRADIENT;
+ opts->activeTabAppearance=APPEARANCE_SOFT_GRADIENT;
+ opts->sliderAppearance=APPEARANCE_SOFT_GRADIENT;
+ opts->menubarAppearance=APPEARANCE_FLAT;
+ opts->menuitemAppearance=APPEARANCE_FADE;
opts->toolbarAppearance=APPEARANCE_FLAT;
opts->progressAppearance=APPEARANCE_DULL_GLASS;
- opts->defBtnIndicator=IND_COLORED;
+ opts->progressGrooveAppearance=APPEARANCE_INVERTED;
+ opts->progressGrooveColor=ECOLOR_DARK;
+ opts->grooveAppearance=APPEARANCE_INVERTED;
+ opts->sunkenAppearance=APPEARANCE_SOFT_GRADIENT;
+ opts->sbarBgndAppearance=APPEARANCE_FLAT;
+ opts->tooltipAppearance=APPEARANCE_GRADIENT;
+ opts->sliderFill=APPEARANCE_GRADIENT;
+ opts->defBtnIndicator=IND_GLOW;
opts->sliderThumbs=LINE_FLAT;
- opts->handles=LINE_SUNKEN;
- opts->shadeSliders=SHADE_BLEND_SELECTED;
+ opts->handles=LINE_1DOT;
+ opts->shadeSliders=SHADE_NONE;
opts->shadeMenubars=SHADE_NONE;
opts->shadeCheckRadio=SHADE_NONE;
+ opts->sortedLv=SHADE_NONE;
opts->toolbarBorders=TB_NONE;
- opts->toolbarSeparators=LINE_NONE;
- opts->splitters=LINE_FLAT;
+ opts->toolbarSeparators=LINE_SUNKEN;
+ opts->splitters=LINE_1DOT;
+#ifdef QTC_ENABLE_PARENTLESS_DIALOG_FIX_SUPPORT
opts->fixParentlessDialogs=false;
+#ifdef __cplusplus
+ opts->noDlgFixApps << "kate" << "plasma" << "plasma-desktop" << "plasma-netbook";
+#else
+ opts->noDlgFixApps=NULL;
+#endif
+#endif
opts->customMenuTextColor=false;
- opts->coloredMouseOver=MO_PLASTIK;
+ opts->coloredMouseOver=MO_GLOW;
opts->menubarMouseOver=true;
- opts->shadeMenubarOnlyWhenActive=true;
+ opts->useHighlightForMenu=false;
+ opts->shadeMenubarOnlyWhenActive=false;
opts->thinnerMenuItems=false;
+ opts->thinnerBtns=true;
opts->scrollbarType=SCROLLBAR_KDE;
- opts->buttonEffect=EFFECT_NONE;
-#ifndef QTC_PLAIN_FOCUS_ONLY
- opts->stdFocus=true;
-#endif
- opts->lvLines=false;
+ opts->buttonEffect=EFFECT_SHADOW;
+ opts->focus=FOCUS_GLOW;
+ opts->lvButton=false;
+ opts->lvLines=LV_NONE;
opts->drawStatusBarFrames=false;
opts->fillSlider=true;
opts->roundMbTopOnly=true;
- opts->borderMenuitems=true;
- opts->gradientPbGroove=true;
+ opts->borderMenuitems=false;
opts->darkerBorders=false;
- opts->vArrows=false;
+ opts->vArrows=true;
opts->xCheck=false;
- opts->framelessGroupBoxes=false;
- opts->colorMenubarMouseOver=false;
- opts->inactiveHighlight=false;
-#ifdef QTC_CONFIG_DIALOG
- opts->shading=SHADING_HSL;
+ opts->colorMenubarMouseOver=true;
+ opts->crButton=true;
+ opts->crColor=SHADE_NONE;
+ opts->progressColor=SHADE_SELECTED;
+ opts->smallRadio=true;
+ opts->fillProgress=true;
+ opts->comboSplitter=false;
+ opts->highlightScrollViews=false;
+ opts->etchEntry=false;
+ opts->flatSbarButtons=true;
+ opts->borderSbarGroove=true;
+ opts->borderProgress=true;
+ opts->popupBorder=true;
+ opts->unifySpinBtns=false;
+ opts->unifySpin=true;
+ opts->unifyCombo=true;
+ opts->borderTab=true;
+ opts->borderInactiveTab=false;
+ opts->thinSbarGroove=true;
+ opts->colorSliderMouseOver=false;
+ opts->menuIcons=true;
+ opts->forceAlternateLvCols=false;
+ opts->invertBotTab=true;
+ opts->menubarHiding=HIDE_NONE;
+ opts->statusbarHiding=HIDE_NONE;
+ opts->boldProgress=true;
+ opts->coloredTbarMo=false;
+ opts->borderSelection=false;
+ opts->square=SQUARE_POPUP_MENUS;
+ opts->stripedSbar=false;
+ opts->windowDrag=WM_DRAG_NONE;
+ opts->shadePopupMenu=false;
+ opts->windowBorder=WINDOW_BORDER_ADD_LIGHT_BORDER;
+ opts->groupBox=FRAME_FADED;
+ opts->gbFactor=DEF_GB_FACTOR;
+ opts->gbLabel=GB_LBL_BOLD|GB_LBL_OUTSIDE;
+#if defined CONFIG_DIALOG || (defined QT_VERSION && (QT_VERSION >= 0x040000))
+ opts->stdBtnSizes=false;
+ opts->titlebarButtons=TITLEBAR_BUTTON_ROUND|TITLEBAR_BUTTON_HOVER_SYMBOL;
+ opts->titlebarIcon=TITLEBAR_ICON_NEXT_TO_TITLE;
#endif
-#ifdef __cplusplus
+ opts->menuStripe=SHADE_NONE;
+ opts->menuStripeAppearance=APPEARANCE_DARK_INVERTED;
+ opts->shading=SHADING_HSL;
+ opts->gtkScrollViews=true;
+ opts->comboBtn=SHADE_NONE;
+ opts->doubleGtkComboArrow=true;
opts->stdSidebarButtons=false;
- opts->gtkScrollViews=false;
+ opts->toolbarTabs=false;
+ opts->bgndOpacity=opts->dlgOpacity=opts->menuBgndOpacity=100;
+#ifdef __cplusplus
opts->gtkComboMenus=false;
opts->customMenubarsColor.setRgb(0, 0, 0);
opts->customSlidersColor.setRgb(0, 0, 0);
opts->customMenuNormTextColor.setRgb(0, 0, 0);
opts->customMenuSelTextColor.setRgb(0, 0, 0);
opts->customCheckRadioColor.setRgb(0, 0, 0);
+ opts->customComboBtnColor.setRgb(0, 0, 0);
+ opts->customMenuStripeColor.setRgb(0, 0, 0);
+ opts->customProgressColor.setRgb(0, 0, 0);
+ opts->titlebarAlignment=ALIGN_FULL_CENTER;
+ opts->titlebarEffect=EFFECT_SHADOW;
+ opts->centerTabText=false;
+#if defined QT_VERSION && (QT_VERSION >= 0x040000)
+ opts->xbar=false;
+ opts->dwtSettings=DWT_BUTTONS_AS_PER_TITLEBAR|DWT_ROUND_TOP_ONLY;
+ opts->menubarApps << "amarok" << "arora" << "kaffeine" << "kcalc" << "smplayer" << "VirtualBox";
+ opts->statusbarApps << "kde";
+ opts->useQtFileDialogApps << "googleearth-bin";
+ opts->noMenuBgndOpacityApps << "inkscape" << "inkscape" << "sonata" << "totem";
+ opts->noBgndOpacityApps << "smplayer" << "kaffeine" << "dragon" << "kscreenlocker" << "inkscape" << "inkscape" << "sonata" << "totem";
+#endif
+ opts->noMenuStripeApps << "gtk" << "soffice.bin";
#else
+ opts->noBgndGradientApps=NULL;
+ opts->noBgndOpacityApps=g_strsplit("inkscape,sonata,totem",",", -1);;
+ opts->noBgndImageApps=NULL;
+ opts->noMenuStripeApps=g_strsplit("gtk",",", -1);
+ opts->noMenuBgndOpacityApps=g_strsplit("inkscape,sonata,totem",",", -1);
/*
opts->setDialogButtonOrder=false;
*/
@@ -878,15 +2518,20 @@ static void defaultSettings(Options *opts)
opts->customMenuNormTextColor.red=opts->customMenuNormTextColor.green=opts->customMenuNormTextColor.blue=0;
opts->customMenuSelTextColor.red=opts->customMenuSelTextColor.green=opts->customMenuSelTextColor.blue=0;
opts->customCheckRadioColor.red=opts->customCheckRadioColor.green=opts->customCheckRadioColor.blue=0;
+ opts->customComboBtnColor.red=opts->customCheckRadioColor.green=opts->customCheckRadioColor.blue=0;
+ opts->customMenuStripeColor.red=opts->customMenuStripeColor.green=opts->customMenuStripeColor.blue=0;
+ opts->customProgressColor.red=opts->customProgressColor.green=opts->customProgressColor.blue=0;
#endif
-#if !defined __cplusplus || defined QTC_CONFIG_DIALOG
+#if !defined __cplusplus || defined CONFIG_DIALOG
opts->mapKdeIcons=true;
+ opts->expanderHighlight=DEFAULT_EXPANDER_HIGHLIGHT_FACTOR;
#endif
-#if defined QTC_CONFIG_DIALOG || (defined QT_VERSION && (QT_VERSION >= 0x040000)) || !defined __cplusplus
- opts->gtkButtonOrder=false;
+ opts->titlebarAppearance=APPEARANCE_CUSTOM1;
+ opts->inactiveTitlebarAppearance=APPEARANCE_CUSTOM1;
+#ifdef __cplusplus
+ opts->titlebarButtonAppearance=APPEARANCE_GRADIENT;
#endif
-
/* Read system config file... */
{
static const char * systemFilename=NULL;
@@ -897,6 +2542,11 @@ static void defaultSettings(Options *opts)
if(systemFilename)
readConfig(systemFilename, opts, opts);
}
+
+#if !defined CONFIG_DIALOG && defined QT_VERSION && (QT_VERSION < 0x040000)
+ if(FOCUS_FILLED==opts->focus)
+ opts->focus=FOCUS_FULL;
+#endif
}
#endif
@@ -912,19 +2562,31 @@ static const char *toStr(EDefBtnIndicator ind)
return "fontcolor";
case IND_CORNER:
return "corner";
+ case IND_TINT:
+ return "tint";
+ case IND_GLOW:
+ return "glow";
+ case IND_DARKEN:
+ return "darken";
+ case IND_SELECTED:
+ return "origselected";
default:
return "colored";
}
}
-static const char *toStr(ELine ind, bool none)
+static const char *toStr(ELine ind, bool dashes)
{
switch(ind)
{
+ case LINE_1DOT:
+ return "1dot";
case LINE_DOTS:
return "dots";
case LINE_DASHES:
- return none ? "none" : "dashes";
+ return dashes ? "dashes" : "none";
+ case LINE_NONE:
+ return "none";
case LINE_FLAT:
return "flat";
default:
@@ -955,14 +2617,18 @@ static const char *toStr(EMouseOver mo)
{
case MO_COLORED:
return "colored";
+ case MO_COLORED_THICK:
+ return "thickcolored";
case MO_NONE:
return "none";
+ case MO_GLOW:
+ return "glow";
default:
return "plastik";
}
}
-static const char *toStr(EAppearance exp)
+static QString toStr(EAppearance exp, EAppAllow allow)
{
switch(exp)
{
@@ -970,22 +2636,56 @@ static const char *toStr(EAppearance exp)
return "flat";
case APPEARANCE_RAISED:
return "raised";
+ case APPEARANCE_DULL_GLASS:
+ return "dullglass";
+ case APPEARANCE_SHINY_GLASS:
+ return "shinyglass";
+ case APPEARANCE_AGUA:
+ return "agua";
+ case APPEARANCE_SOFT_GRADIENT:
+ return "soft";
case APPEARANCE_GRADIENT:
return "gradient";
+ case APPEARANCE_HARSH_GRADIENT:
+ return "harsh";
+ case APPEARANCE_INVERTED:
+ return "inverted";
+ case APPEARANCE_DARK_INVERTED:
+ return "darkinverted";
case APPEARANCE_SPLIT_GRADIENT:
return "splitgradient";
- case APPEARANCE_DULL_GLASS:
- return "dullglass";
case APPEARANCE_BEVELLED:
return "bevelled";
- case APPEARANCE_INVERTED:
- return "inverted";
+ case APPEARANCE_FADE:
+ switch(allow)
+ {
+ case APP_ALLOW_BASIC: // Should not get here!
+ case APP_ALLOW_FADE:
+ return "fade";
+ case APP_ALLOW_STRIPED:
+ return "striped";
+ case APP_ALLOW_NONE:
+ return "none";
+ }
default:
- return "shinyglass";
+ {
+ QString app;
+
+ app.sprintf("customgradient%d", (exp-APPEARANCE_CUSTOM1)+1);
+ return app;
+ }
}
}
-static const char *toStr(EShade exp, bool dark, bool convertBlendSelToSel)
+static QString toStr(const QColor &col)
+{
+ QString colorStr;
+
+ colorStr.sprintf("#%02X%02X%02X", col.red(), col.green(), col.blue());
+ return colorStr;
+}
+
+static QString toStr(EShade exp, const QColor &col)
{
switch(exp)
{
@@ -993,12 +2693,15 @@ static const char *toStr(EShade exp, bool dark, bool convertBlendSelToSel)
case SHADE_NONE:
return "none";
case SHADE_BLEND_SELECTED:
- return dark || !convertBlendSelToSel ? "selected" : "origselected";
+ return "selected";
case SHADE_CUSTOM:
- return "custom";
- /* case SHADE_SELECTED */
+ return toStr(col);
+ case SHADE_SELECTED:
+ return "origselected";
case SHADE_DARKEN:
- return dark ? "darken" : "origselected";
+ return "darken";
+ case SHADE_WINDOW_BORDER:
+ return "wborder";
}
}
@@ -1010,6 +2713,10 @@ static const char *toStr(ERound exp)
return "none";
case ROUND_SLIGHT:
return "slight";
+ case ROUND_EXTRA:
+ return "extra";
+ case ROUND_MAX:
+ return "max";
default:
case ROUND_FULL:
return "full";
@@ -1034,6 +2741,24 @@ static const char *toStr(EScrollbar sb)
}
}
+static const char *toStr(EFrame sb)
+{
+ switch(sb)
+ {
+ case FRAME_NONE:
+ return "none";
+ case FRAME_PLAIN:
+ return "plain";
+ case FRAME_LINE:
+ return "line";
+ case FRAME_SHADED:
+ return "shaded";
+ case FRAME_FADED:
+ default:
+ return "faded";
+ }
+}
+
static const char *toStr(EEffect e)
{
switch(e)
@@ -1050,14 +2775,6 @@ static const char *toStr(EEffect e)
inline const char * toStr(bool b) { return b ? "true" : "false"; }
-static QString toStr(const QColor &col)
-{
- QString colorStr;
-
- colorStr.sprintf("#%02X%02X%02X", col.red(), col.green(), col.blue());
- return colorStr;
-}
-
static const char *toStr(EShading s)
{
switch(s)
@@ -1069,6 +2786,8 @@ static const char *toStr(EShading s)
return "hsl";
case SHADING_HSV:
return "hsv";
+ case SHADING_HCY:
+ return "hcy";
}
}
@@ -1083,6 +2802,8 @@ static const char *toStr(EStripe s)
return "none";
case STRIPE_DIAGONAL:
return "diagonal";
+ case STRIPE_FADE:
+ return "fade";
}
}
@@ -1094,13 +2815,176 @@ static const char *toStr(ESliderStyle s)
return "plain";
case SLIDER_TRIANGULAR:
return "triangular";
+ case SLIDER_ROUND_ROTATED:
+ return "r-round";
+ case SLIDER_PLAIN_ROTATED:
+ return "r-plain";
+ case SLIDER_CIRCULAR:
+ return "circular";
default:
case SLIDER_ROUND:
return "round";
}
}
+static const char *toStr(EColor s)
+{
+ switch(s)
+ {
+ case ECOLOR_BACKGROUND:
+ return "background";
+ case ECOLOR_DARK:
+ return "dark";
+ default:
+ case ECOLOR_BASE:
+ return "base";
+ }
+}
+
+static const char *toStr(EFocus f)
+{
+ switch(f)
+ {
+ default:
+ case FOCUS_STANDARD:
+ return "standard";
+ case FOCUS_RECTANGLE:
+ return "rect";
+ case FOCUS_FILLED:
+ return "filled";
+ case FOCUS_FULL:
+ return "full";
+ case FOCUS_LINE:
+ return "line";
+ case FOCUS_GLOW:
+ return "glow";
+ }
+}
+
+static const char *toStr(ETabMo f)
+{
+ switch(f)
+ {
+ default:
+ case TAB_MO_BOTTOM:
+ return "bot";
+ case TAB_MO_TOP:
+ return "top";
+ case TAB_MO_GLOW:
+ return "glow";
+ }
+}
+
+static const char *toStr(EGradientBorder g)
+{
+ switch(g)
+ {
+ case GB_NONE:
+ return "none";
+ case GB_LIGHT:
+ return "light";
+ case GB_3D_FULL:
+ return "3dfull";
+ case GB_SHINE:
+ return "shine";
+ default:
+ case GB_3D:
+ return "3d";
+ }
+}
+
+static const char *toStr(EAlign ind)
+{
+ switch(ind)
+ {
+ default:
+ case ALIGN_LEFT:
+ return "left";
+ case ALIGN_CENTER:
+ return "center";
+ case ALIGN_FULL_CENTER:
+ return "center-full";
+ case ALIGN_RIGHT:
+ return "right";
+ }
+}
+
+static const char * toStr(ETitleBarIcon icn)
+{
+ switch(icn)
+ {
+ case TITLEBAR_ICON_NONE:
+ return "none";
+ default:
+ case TITLEBAR_ICON_MENU_BUTTON:
+ return "menu";
+ case TITLEBAR_ICON_NEXT_TO_TITLE:
+ return "title";
+ }
+}
+
+static const char * toStr(EGradType gt)
+{
+ switch(gt)
+ {
+ case GT_VERT:
+ return "vert";
+ default:
+ case GT_HORIZ:
+ return "horiz";
+ }
+}
+
+static const char * toStr(ELvLines lv)
+{
+ switch(lv)
+ {
+ case LV_NEW:
+ return "new";
+ case LV_OLD:
+ return "old";
+ default:
+ case LV_NONE:
+ return "none";
+ }
+}
+
+static const char * toStr(EImageType lv)
+{
+ switch(lv)
+ {
+ default:
+ case IMG_NONE:
+ return "none";
+ case IMG_PLAIN_RINGS:
+ return "plainrings";
+ case IMG_BORDERED_RINGS:
+ return "rings";
+ case IMG_SQUARE_RINGS:
+ return "squarerings";
+ case IMG_FILE:
+ return "file";
+ }
+}
+
+static const char * toStr(EGlow lv)
+{
+ switch(lv)
+ {
+ default:
+ case GLOW_NONE:
+ return "none";
+ case GLOW_START:
+ return "start";
+ case GLOW_MIDDLE:
+ return "middle";
+ case GLOW_END:
+ return "end";
+ }
+}
+
#if QT_VERSION >= 0x040000
+#include <QTextStream>
#define CFG config
#else
#define CFG (*cfg)
@@ -1112,124 +2996,362 @@ static const char *toStr(ESliderStyle s)
else \
CFG.writeEntry(#ENTRY, toStr(opts.ENTRY));
-#define CFG_WRITE_ENTRY_FORCE(ENTRY) \
- CFG.writeEntry(#ENTRY, toStr(opts.ENTRY));
-
+#define CFG_WRITE_APPEARANCE_ENTRY(ENTRY, ALLOW) \
+ if (!exportingStyle && def.ENTRY==opts.ENTRY) \
+ CFG.deleteEntry(#ENTRY); \
+ else \
+ CFG.writeEntry(#ENTRY, toStr(opts.ENTRY, ALLOW));
+
#define CFG_WRITE_ENTRY_B(ENTRY, B) \
if (!exportingStyle && def.ENTRY==opts.ENTRY) \
CFG.deleteEntry(#ENTRY); \
else \
CFG.writeEntry(#ENTRY, toStr(opts.ENTRY, B));
-#define CFG_WRITE_ENTRY_SHADE(ENTRY, DARK, CONVERT_SHADE) \
+#define CFG_WRITE_ENTRY_NUM(ENTRY) \
if (!exportingStyle && def.ENTRY==opts.ENTRY) \
CFG.deleteEntry(#ENTRY); \
else \
- CFG.writeEntry(#ENTRY, toStr(opts.ENTRY, DARK, CONVERT_SHADE));
+ CFG.writeEntry(#ENTRY, opts.ENTRY);
-#define CFG_WRITE_ENTRY_D(ENTRY) \
+#define CFG_WRITE_SHADE_ENTRY(ENTRY, COL) \
if (!exportingStyle && def.ENTRY==opts.ENTRY) \
CFG.deleteEntry(#ENTRY); \
else \
- CFG.writeEntry(#ENTRY, ((int)(opts.ENTRY*100))-100);
+ CFG.writeEntry(#ENTRY, toStr(opts.ENTRY, opts.COL));
-#define CFG_WRITE_ENTRY_NUM(ENTRY) \
+#define CFG_WRITE_IMAGE_ENTRY(ENTRY) \
+ if (!exportingStyle && def.ENTRY.type==opts.ENTRY.type) \
+ CFG.deleteEntry(#ENTRY); \
+ else \
+ CFG.writeEntry(#ENTRY, toStr(opts.ENTRY.type)); \
+ if(IMG_FILE!=opts.ENTRY.type) \
+ { \
+ CFG.deleteEntry(#ENTRY ".file"); \
+ CFG.deleteEntry(#ENTRY ".width"); \
+ CFG.deleteEntry(#ENTRY ".height"); \
+ } \
+ else \
+ { \
+ CFG.writeEntry(#ENTRY ".file", opts.ENTRY.file); \
+ CFG.writeEntry(#ENTRY ".width", opts.ENTRY.width); \
+ CFG.writeEntry(#ENTRY ".height", opts.ENTRY.height); \
+ }
+
+#define CFG_WRITE_STRING_LIST_ENTRY(ENTRY) \
if (!exportingStyle && def.ENTRY==opts.ENTRY) \
CFG.deleteEntry(#ENTRY); \
else \
- CFG.writeEntry(#ENTRY, opts.ENTRY);
+ CFG.writeEntry(#ENTRY, QStringList(opts.ENTRY.toList()).join(",")); \
bool static writeConfig(KConfig *cfg, const Options &opts, const Options &def, bool exportingStyle=false)
{
if(!cfg)
{
- const char *xdg=xdgConfigFolder();
+ const char *cfgDir=qtcConfDir();
- if(xdg)
+ if(cfgDir)
{
- char filename[QTC_MAX_FILENAME_LEN];
-
- sprintf(filename, "%s/"QTC_FILE, xdg);
-
#if QT_VERSION >= 0x040000
- KConfig defCfg(filename, KConfig::SimpleConfig);
+ KConfig defCfg(QFile::decodeName(cfgDir)+CONFIG_FILE, KConfig::SimpleConfig);
#else
- KConfig defCfg(filename, false, false);
+ KConfig defCfg(QFile::decodeName(cfgDir)+CONFIG_FILE, false, false);
#endif
- return writeConfig(&defCfg, opts, def, exportingStyle);
+ if(writeConfig(&defCfg, opts, def, exportingStyle))
+ {
+ const char *oldFiles[]={ OLD_CONFIG_FILE, "qtcurve.gtk-icons", 0};
+
+ for(int i=0; oldFiles[i]; ++i)
+ {
+ QString oldFileName(QFile::decodeName(cfgDir)+QString("../")+oldFiles[i]);
+
+ if(QFile::exists(oldFileName))
+ QFile::remove(oldFileName);
+ }
+ }
}
}
else
{
#if QT_VERSION >= 0x040000
- KConfigGroup config(cfg, QTC_GROUP);
+ KConfigGroup config(cfg, SETTINGS_GROUP);
#else
- cfg->setGroup(QTC_GROUP);
+ cfg->setGroup(SETTINGS_GROUP);
#endif
+ CFG.writeEntry(VERSION_KEY, VERSION);
CFG_WRITE_ENTRY_NUM(passwordChar)
+ CFG_WRITE_ENTRY_NUM(gbFactor)
CFG_WRITE_ENTRY(round)
- CFG_WRITE_ENTRY_D(highlightFactor)
+ CFG_WRITE_ENTRY_NUM(highlightFactor)
+ CFG_WRITE_ENTRY_NUM(menuDelay)
+ CFG_WRITE_ENTRY_NUM(sliderWidth)
CFG_WRITE_ENTRY(toolbarBorders)
- CFG_WRITE_ENTRY_FORCE(appearance)
+ CFG_WRITE_APPEARANCE_ENTRY(appearance, APP_ALLOW_BASIC)
+ CFG_WRITE_APPEARANCE_ENTRY(bgndAppearance, APP_ALLOW_STRIPED)
+ CFG_WRITE_ENTRY(bgndGrad)
+ CFG_WRITE_ENTRY(menuBgndGrad)
+ CFG_WRITE_APPEARANCE_ENTRY(menuBgndAppearance, APP_ALLOW_STRIPED)
+#ifdef QTC_ENABLE_PARENTLESS_DIALOG_FIX_SUPPORT
CFG_WRITE_ENTRY(fixParentlessDialogs)
+#if defined QT_VERSION && (QT_VERSION >= 0x040000)
+ CFG_WRITE_STRING_LIST_ENTRY(noDlgFixApps)
+#endif
+#endif
CFG_WRITE_ENTRY(stripedProgress)
CFG_WRITE_ENTRY(sliderStyle)
CFG_WRITE_ENTRY(animatedProgress)
- CFG_WRITE_ENTRY(lighterPopupMenuBgnd)
+ CFG_WRITE_ENTRY_NUM(lighterPopupMenuBgnd)
+ CFG_WRITE_ENTRY_NUM(tabBgnd)
CFG_WRITE_ENTRY(embolden)
CFG_WRITE_ENTRY(defBtnIndicator)
- CFG_WRITE_ENTRY_B(sliderThumbs, true)
- CFG_WRITE_ENTRY_B(handles, false)
+ CFG_WRITE_ENTRY_B(sliderThumbs, false)
+ CFG_WRITE_ENTRY_B(handles, true)
CFG_WRITE_ENTRY(highlightTab)
- CFG_WRITE_ENTRY(colorSelTab)
- CFG_WRITE_ENTRY_SHADE(shadeSliders, false, false)
- CFG_WRITE_ENTRY_SHADE(shadeMenubars, true, false)
- CFG_WRITE_ENTRY_SHADE(shadeCheckRadio, false, true)
- CFG_WRITE_ENTRY_FORCE(menubarAppearance)
- CFG_WRITE_ENTRY_FORCE(menuitemAppearance)
- CFG_WRITE_ENTRY_FORCE(toolbarAppearance)
- CFG_WRITE_ENTRY_B(toolbarSeparators, true)
- CFG_WRITE_ENTRY_B(splitters, false)
+ CFG_WRITE_ENTRY_NUM(colorSelTab)
+ CFG_WRITE_ENTRY(roundAllTabs)
+ CFG_WRITE_ENTRY(tabMouseOver)
+ CFG_WRITE_APPEARANCE_ENTRY(menubarAppearance, APP_ALLOW_BASIC)
+ CFG_WRITE_APPEARANCE_ENTRY(menuitemAppearance, APP_ALLOW_FADE)
+ CFG_WRITE_APPEARANCE_ENTRY(toolbarAppearance, APP_ALLOW_BASIC)
+ CFG_WRITE_APPEARANCE_ENTRY(selectionAppearance, APP_ALLOW_BASIC)
+#ifdef __cplusplus
+ CFG_WRITE_APPEARANCE_ENTRY(dwtAppearance, APP_ALLOW_BASIC)
+ CFG_WRITE_ENTRY(titlebarEffect)
+#endif
+ CFG_WRITE_APPEARANCE_ENTRY(menuStripeAppearance, APP_ALLOW_BASIC)
+ CFG_WRITE_ENTRY_B(toolbarSeparators, false)
+ CFG_WRITE_ENTRY_B(splitters, true)
CFG_WRITE_ENTRY(customMenuTextColor)
CFG_WRITE_ENTRY(coloredMouseOver)
CFG_WRITE_ENTRY(menubarMouseOver)
+ CFG_WRITE_ENTRY(useHighlightForMenu)
CFG_WRITE_ENTRY(shadeMenubarOnlyWhenActive)
CFG_WRITE_ENTRY(thinnerMenuItems)
- CFG_WRITE_ENTRY(customSlidersColor)
- CFG_WRITE_ENTRY(customMenubarsColor)
+ CFG_WRITE_ENTRY(thinnerBtns)
+ CFG_WRITE_SHADE_ENTRY(shadeSliders, customSlidersColor)
+ CFG_WRITE_SHADE_ENTRY(shadeMenubars, customMenubarsColor)
+ CFG_WRITE_SHADE_ENTRY(sortedLv, customSortedLvColor)
CFG_WRITE_ENTRY(customMenuSelTextColor)
CFG_WRITE_ENTRY(customMenuNormTextColor)
- CFG_WRITE_ENTRY(customCheckRadioColor)
+ CFG_WRITE_SHADE_ENTRY(shadeCheckRadio, customCheckRadioColor)
CFG_WRITE_ENTRY(scrollbarType)
CFG_WRITE_ENTRY(buttonEffect)
- CFG_WRITE_ENTRY_FORCE(lvAppearance)
- CFG_WRITE_ENTRY_FORCE(tabAppearance)
- CFG_WRITE_ENTRY_FORCE(sliderAppearance)
- CFG_WRITE_ENTRY_FORCE(progressAppearance)
-#ifndef QTC_PLAIN_FOCUS_ONLY
- CFG_WRITE_ENTRY(stdFocus)
-#endif
+ CFG_WRITE_APPEARANCE_ENTRY(lvAppearance, APP_ALLOW_BASIC)
+ CFG_WRITE_APPEARANCE_ENTRY(tabAppearance, APP_ALLOW_BASIC)
+ CFG_WRITE_APPEARANCE_ENTRY(activeTabAppearance, APP_ALLOW_BASIC)
+ CFG_WRITE_APPEARANCE_ENTRY(sliderAppearance, APP_ALLOW_BASIC)
+ CFG_WRITE_APPEARANCE_ENTRY(progressAppearance, APP_ALLOW_BASIC)
+ CFG_WRITE_APPEARANCE_ENTRY(progressGrooveAppearance, APP_ALLOW_BASIC)
+ CFG_WRITE_APPEARANCE_ENTRY(grooveAppearance, APP_ALLOW_BASIC)
+ CFG_WRITE_APPEARANCE_ENTRY(sunkenAppearance, APP_ALLOW_BASIC)
+ CFG_WRITE_APPEARANCE_ENTRY(sbarBgndAppearance, APP_ALLOW_BASIC)
+ CFG_WRITE_APPEARANCE_ENTRY(tooltipAppearance, APP_ALLOW_BASIC)
+ CFG_WRITE_ENTRY(sliderFill)
+ CFG_WRITE_ENTRY(progressGrooveColor)
+ CFG_WRITE_ENTRY(focus)
+ CFG_WRITE_ENTRY(lvButton)
CFG_WRITE_ENTRY(lvLines)
CFG_WRITE_ENTRY(drawStatusBarFrames)
CFG_WRITE_ENTRY(fillSlider)
CFG_WRITE_ENTRY(roundMbTopOnly)
CFG_WRITE_ENTRY(borderMenuitems)
- CFG_WRITE_ENTRY(gradientPbGroove)
CFG_WRITE_ENTRY(darkerBorders)
CFG_WRITE_ENTRY(vArrows)
CFG_WRITE_ENTRY(xCheck)
- CFG_WRITE_ENTRY(framelessGroupBoxes)
- CFG_WRITE_ENTRY(inactiveHighlight)
-#ifdef __cplusplus
- CFG_WRITE_ENTRY(stdSidebarButtons)
+ CFG_WRITE_ENTRY(groupBox)
+ CFG_WRITE_ENTRY_NUM(gbLabel)
+ CFG_WRITE_ENTRY(fadeLines)
+ CFG_WRITE_ENTRY(glowProgress)
+ CFG_WRITE_IMAGE_ENTRY(bgndImage)
+ CFG_WRITE_IMAGE_ENTRY(menuBgndImage)
+ CFG_WRITE_ENTRY(colorMenubarMouseOver)
+ CFG_WRITE_ENTRY_NUM(crHighlight)
+ CFG_WRITE_ENTRY(crButton)
+ CFG_WRITE_SHADE_ENTRY(crColor, customCrBgndColor)
+ CFG_WRITE_SHADE_ENTRY(progressColor, customProgressColor)
+ CFG_WRITE_ENTRY(smallRadio)
+ CFG_WRITE_ENTRY(fillProgress)
+ CFG_WRITE_ENTRY(comboSplitter)
+ CFG_WRITE_ENTRY(highlightScrollViews)
+ CFG_WRITE_ENTRY(etchEntry)
+ CFG_WRITE_ENTRY_NUM(splitterHighlight)
+ CFG_WRITE_ENTRY_NUM(expanderHighlight)
+ CFG_WRITE_ENTRY_NUM(crSize)
+ CFG_WRITE_ENTRY(flatSbarButtons)
+ CFG_WRITE_ENTRY(borderSbarGroove)
+ CFG_WRITE_ENTRY(borderProgress)
+ CFG_WRITE_ENTRY(popupBorder)
+ CFG_WRITE_ENTRY(unifySpinBtns)
+ CFG_WRITE_ENTRY(unifySpin)
+ CFG_WRITE_ENTRY(unifyCombo)
+ CFG_WRITE_ENTRY(borderTab)
+ CFG_WRITE_ENTRY(borderInactiveTab)
+ CFG_WRITE_ENTRY(thinSbarGroove)
+ CFG_WRITE_ENTRY(colorSliderMouseOver)
+ CFG_WRITE_ENTRY(menuIcons)
+ CFG_WRITE_ENTRY(forceAlternateLvCols)
+ CFG_WRITE_ENTRY_NUM(square)
+ CFG_WRITE_ENTRY(invertBotTab)
+ CFG_WRITE_ENTRY_NUM(menubarHiding)
+ CFG_WRITE_ENTRY_NUM(statusbarHiding)
+ CFG_WRITE_ENTRY(boldProgress)
+ CFG_WRITE_ENTRY(coloredTbarMo)
+ CFG_WRITE_ENTRY(borderSelection)
+ CFG_WRITE_ENTRY(stripedSbar)
+ CFG_WRITE_ENTRY_NUM(windowDrag)
+ CFG_WRITE_ENTRY(shadePopupMenu)
+ CFG_WRITE_ENTRY_NUM(windowBorder)
+#if defined QT_VERSION && (QT_VERSION >= 0x040000)
+ CFG_WRITE_ENTRY(xbar)
+ CFG_WRITE_ENTRY_NUM(dwtSettings)
#endif
-
+ CFG_WRITE_ENTRY_NUM(bgndOpacity)
+ CFG_WRITE_ENTRY_NUM(menuBgndOpacity)
+ CFG_WRITE_ENTRY_NUM(dlgOpacity)
+#if defined CONFIG_DIALOG || (defined QT_VERSION && (QT_VERSION >= 0x040000))
+ CFG_WRITE_ENTRY(stdBtnSizes)
+ CFG_WRITE_ENTRY_NUM(titlebarButtons)
+ CFG_WRITE_ENTRY(titlebarIcon)
+
+ if((opts.titlebarButtons&TITLEBAR_BUTTON_COLOR || opts.titlebarButtons&TITLEBAR_BUTTON_ICON_COLOR) &&
+ opts.titlebarButtonColors.size() && 0==(opts.titlebarButtonColors.size()%NUM_TITLEBAR_BUTTONS))
+ {
+ QString val;
+#if QT_VERSION >= 0x040000
+ QTextStream str(&val);
+#else
+ QTextStream str(&val, IO_WriteOnly);
+#endif
+ for(unsigned int i=0; i<opts.titlebarButtonColors.size(); ++i)
+ {
+ TBCols::const_iterator c(opts.titlebarButtonColors.find((ETitleBarButtons)i));
+
+ if(c!=opts.titlebarButtonColors.end())
+ {
+ if(i)
+ str << ',';
+ str << toStr((*c).second);
+ }
+ }
+ CFG.writeEntry("titlebarButtonColors", val);
+ }
+ else
+ CFG.deleteEntry("titlebarButtonColors");
+#endif
+ CFG_WRITE_SHADE_ENTRY(menuStripe, customMenuStripeColor)
+ CFG_WRITE_SHADE_ENTRY(comboBtn, customComboBtnColor)
+ CFG_WRITE_ENTRY(stdSidebarButtons)
+ CFG_WRITE_ENTRY(toolbarTabs)
+ CFG_WRITE_APPEARANCE_ENTRY(titlebarAppearance, APP_ALLOW_NONE)
+ CFG_WRITE_APPEARANCE_ENTRY(inactiveTitlebarAppearance, APP_ALLOW_NONE)
+ CFG_WRITE_APPEARANCE_ENTRY(titlebarButtonAppearance, APP_ALLOW_BASIC)
CFG_WRITE_ENTRY(gtkScrollViews)
CFG_WRITE_ENTRY(gtkComboMenus)
+ CFG_WRITE_ENTRY(doubleGtkComboArrow)
CFG_WRITE_ENTRY(gtkButtonOrder)
+#if !defined __cplusplus || (defined CONFIG_DIALOG && defined QT_VERSION && (QT_VERSION >= 0x040000))
+ CFG_WRITE_ENTRY(reorderGtkButtons)
+#endif
CFG_WRITE_ENTRY(mapKdeIcons)
CFG_WRITE_ENTRY(shading)
+ CFG_WRITE_ENTRY(titlebarAlignment)
+ CFG_WRITE_ENTRY(centerTabText)
+#if defined QT_VERSION && (QT_VERSION >= 0x040000)
+ CFG_WRITE_STRING_LIST_ENTRY(noBgndGradientApps)
+ CFG_WRITE_STRING_LIST_ENTRY(noBgndOpacityApps)
+ CFG_WRITE_STRING_LIST_ENTRY(noMenuBgndOpacityApps)
+ CFG_WRITE_STRING_LIST_ENTRY(noBgndImageApps)
+ CFG_WRITE_STRING_LIST_ENTRY(noMenuStripeApps)
+ CFG_WRITE_STRING_LIST_ENTRY(menubarApps)
+ CFG_WRITE_STRING_LIST_ENTRY(statusbarApps)
+ CFG_WRITE_STRING_LIST_ENTRY(useQtFileDialogApps)
+#endif
+
+ for(int i=APPEARANCE_CUSTOM1; i<(APPEARANCE_CUSTOM1+NUM_CUSTOM_GRAD); ++i)
+ {
+ GradientCont::const_iterator cg(opts.customGradient.find((EAppearance)i));
+ QString gradKey;
+
+ gradKey.sprintf("customgradient%d", (i-APPEARANCE_CUSTOM1)+1);
+
+ if(cg==opts.customGradient.end())
+ CFG.deleteEntry(gradKey);
+ else
+ {
+ GradientCont::const_iterator d;
+
+ if(exportingStyle || (d=def.customGradient.find((EAppearance)i))==def.customGradient.end() || !((*d)==(*cg)))
+ {
+ QString gradVal;
+#if QT_VERSION >= 0x040000
+ QTextStream str(&gradVal);
+#else
+ QTextStream str(&gradVal, IO_WriteOnly);
+#endif
+ GradientStopCont stops((*cg).second.stops.fix());
+ GradientStopCont::const_iterator it(stops.begin()),
+ end(stops.end());
+ bool haveAlpha(false);
+
+ for(; it!=end && !haveAlpha; ++it)
+ if((*it).alpha<1.0)
+ haveAlpha=true;
+
+ str << toStr((*cg).second.border);
+ if(haveAlpha)
+ str << "-alpha";
+
+ for(it=stops.begin(); it!=end; ++it)
+ if(haveAlpha)
+ str << ',' << (*it).pos << ',' << (*it).val << ',' << (*it).alpha;
+ else
+ str << ',' << (*it).pos << ',' << (*it).val;
+ CFG.writeEntry(gradKey, gradVal);
+ }
+ else
+ CFG.deleteEntry(gradKey);
+ }
+ }
+
+ if(opts.customShades[0]==0 ||
+ exportingStyle ||
+ opts.customShades[0]!=def.customShades[0] ||
+ opts.customShades[1]!=def.customShades[1] ||
+ opts.customShades[2]!=def.customShades[2] ||
+ opts.customShades[3]!=def.customShades[3] ||
+ opts.customShades[4]!=def.customShades[4] ||
+ opts.customShades[5]!=def.customShades[5])
+ {
+ QString shadeVal;
+#if QT_VERSION >= 0x040000
+ QTextStream str(&shadeVal);
+#else
+ QTextStream str(&shadeVal, IO_WriteOnly);
+#endif
+ if(0==opts.customShades[0])
+ str << 0;
+ else
+ for(int i=0; i<NUM_STD_SHADES; ++i)
+ if(0==i)
+ str << opts.customShades[i];
+ else
+ str << ',' << opts.customShades[i];
+ CFG.writeEntry("customShades", shadeVal);
+ }
+ else
+ CFG.deleteEntry("customShades");
+
+ // Removed from 1.5 onwards...
+ CFG.deleteEntry("colorTitlebarOnly");
+ CFG.deleteEntry("titlebarBorder");
+ CFG.deleteEntry("titlebarBlend");
+ // Removed from 1.4 onwards..
+ CFG.deleteEntry("squareLvSelection");
+ CFG.deleteEntry("squareScrollViews");
+ CFG.deleteEntry("squareProgress");
+ CFG.deleteEntry("squareEntry");
+
cfg->sync();
return true;
}
diff --git a/common/dot.png b/common/dot.png
new file mode 100644
index 0000000..c1ba664
--- /dev/null
+++ b/common/dot.png
Binary files differ
diff --git a/common/radio_inner.png b/common/radio_inner.png
new file mode 100644
index 0000000..94201cd
--- /dev/null
+++ b/common/radio_inner.png
Binary files differ
diff --git a/common/radio_on.png b/common/radio_on.png
index 22236ac..7584dbf 100644
--- a/common/radio_on.png
+++ b/common/radio_on.png
Binary files differ
diff --git a/common/radio_on_small.png b/common/radio_on_small.png
new file mode 100644
index 0000000..72dc158
--- /dev/null
+++ b/common/radio_on_small.png
Binary files differ