From 579d92c0eb2b0f96de01cccf2c7f08d794d87509 Mon Sep 17 00:00:00 2001 From: TCH Date: Mon, 27 Apr 2020 23:49:57 +0900 Subject: [PATCH] Updated to QtCurve version 1.7.1. Based on the original GPL2 QtCurve code from Craig Drummond available at https://github.com/KDE/qtcurve Signed-off-by: TCH Signed-off-by: Michele Calgaro (cherry picked from commit 82fe64d550d8754266109084f82dd56cc8a04f49) --- CMakeLists.txt | 4 +- ChangeLog | 18 + common/common.h | 53 +- common/config_file.c-orig | 1238 ------------------------------------- style/qtcurve.cpp | 455 +++++++++----- style/qtcurve.h | 5 +- 6 files changed, 386 insertions(+), 1387 deletions(-) delete mode 100644 common/config_file.c-orig diff --git a/CMakeLists.txt b/CMakeLists.txt index c74594b..7b81120 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,8 +19,8 @@ set(DEBIAN_PACKAGE_DESCRIPTION "QtCurve for TQt/TDE") set(DEBIAN_PACKAGE_SECTION "tde") set(CPACK_SOURCE_GENERATOR "TBZ2") set(CPACK_PACKAGE_VERSION_MAJOR "1") -set(CPACK_PACKAGE_VERSION_MINOR "6") -set(CPACK_PACKAGE_VERSION_PATCH "2") +set(CPACK_PACKAGE_VERSION_MINOR "7") +set(CPACK_PACKAGE_VERSION_PATCH "1") set(CPACK_PACKAGE_CONTACT "Craig Drummond ") set(QTCURVE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}") set(QTCURVE_VERSION_FULL "${QTCURVE_VERSION}.${CPACK_PACKAGE_VERSION_PATCH}") diff --git a/ChangeLog b/ChangeLog index 74104fd..032e289 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,21 @@ +1.7.1 +----- +1. Remove box around arrow in listview lines - to match Gtk better. + +1.7.0 +----- + 1. Add option to use tiled pixmap as background for windows and menus. + 2. Draw line focus for items that cannot use glow focus. + 3. Use popup menu gradient's border setting to determine border type of menus. + 4. Add option to draw standard, raised, or joined toolbar buttons. + 5. Add option to use thinner frames, focus, etc. + 6. If not rounding, enable all 'square' options. + 7. Store background colour setting in XProperty - so that this can be used by + QtCurve twin decoration. + 8. Implement shading popup menus as per memubar settings. + 9. Fix segfault when obtaining MDI colours. +10. Dont overwrite user supplied CMAKE_INSTALL_PREFIX + 1.6.2 ----- 1. Disable the support for 'fix parent-less dialog' option - this causes too many diff --git a/common/common.h b/common/common.h index 34d8345..b3bcc6a 100644 --- a/common/common.h +++ b/common/common.h @@ -296,6 +296,10 @@ enum #define SIZE_GRIP_SIZE 12 #define USE_LIGHTER_POPUP_MENU (opts.lighterPopupMenuBgnd) +#define USE_BORDER(B) (GB_SHINE!=(B) && GB_NONE!=(B)) +#define DRAW_MENU_BORDER (APPEARANCE_FLAT!=opts.menuBgndAppearance && opts.version>=MAKE_VERSION(1,7) && \ + USE_BORDER(getGradient(opts.menuBgndAppearance, &opts)->border)) + #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) @@ -550,6 +554,32 @@ typedef enum IMG_FILE } EImageType; +typedef struct +{ +#if defined __cplusplus + TQString file; + TQPixmap img; +#else // __cplusplus + const char *file; + GdkPixbuf *img; +#endif // __cplusplus +} TQtCPixmap; + +#define BGND_IMG_ON_BORDER (IMG_FILE==opts.bgndImage.type && opts.bgndImage.onBorder) + +typedef enum +{ + PP_TL, + PP_TM, + PP_TR, + PP_BL, + PP_BM, + PP_BR, + PP_LM, + PP_RM, + PP_CENTRED, +} EPixPos; + typedef struct { EImageType type; @@ -564,6 +594,13 @@ typedef struct int width, height; } TQtCImage; +typedef enum +{ + THIN_BUTTONS = 0x0001, + THIN_MENU_ITEMS = 0x0002, + THIN_FRAMES = 0x0004 +} EThinFlags; + typedef enum { SQUARE_NONE = 0x0000, @@ -713,6 +750,7 @@ typedef enum APPEARANCE_FADE, /* Only for poupmenu items! */ APPEARANCE_STRIPED = APPEARANCE_FADE, /* Only for windows and menus */ APPEARANCE_NONE = APPEARANCE_FADE, /* Only for titlebars */ + APPEARANCE_FILE, /* Only for windows and menus */ APPEARANCE_LV_BEVELLED, /* To be used only with getGradient */ APPEARANCE_AGUA_MOD, APPEARANCE_LV_AGUA, @@ -775,6 +813,13 @@ typedef enum TB_DARK_ALL } ETBarBorder; +typedef enum +{ + TBTN_STANDARD, + TBTN_RAISED, + TBTN_JOINED +} ETBarBtn; + typedef enum { BORDER_FLAT, @@ -1056,7 +1101,8 @@ typedef struct splitterHighlight, crSize, gbFactor, - gbLabel; + gbLabel, + thin; ERound round; bool embolden, highlightTab, @@ -1088,8 +1134,8 @@ typedef struct mapKdeIcons, #if defined CONFIG_DIALOG || ( defined QT4_OR_ABOVE) || !defined __cplusplus gtkButtonOrder, - fadeLines, #endif + fadeLines, reorderGtkButtons, borderMenuitems, colorMenubarMouseOver, @@ -1154,6 +1200,7 @@ typedef struct ESliderStyle sliderStyle; EMouseOver coloredMouseOver; ETBarBorder toolbarBorders; + ETBarBtn tbarBtns; EDefBtnIndicator defBtnIndicator; ELine sliderThumbs, handles, @@ -1221,6 +1268,8 @@ typedef struct #else Gradient *customGradient[NUM_CUSTOM_GRAD]; #endif + TQtCPixmap bgndPixmap; + TQtCPixmap menuBgndPixmap; TQtCImage bgndImage, menuBgndImage; #if !defined __cplusplus || ( defined QT4_OR_ABOVE) diff --git a/common/config_file.c-orig b/common/config_file.c-orig deleted file mode 100644 index b1e3c53..0000000 --- a/common/config_file.c-orig +++ /dev/null @@ -1,1238 +0,0 @@ -/* - QtCurve (C) Craig Drummond, 2003 - 2007 Craig.Drummond@lycos.co.uk - - ---- - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public - License version 2 as published by the Free Software Foundation. - - This program 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 - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; see the file COPYING. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. - */ - -#include "common.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define TQTC_MAX_FILENAME_LEN 1024 -#define TQTC_MAX_INPUT_LINE_LEN 256 -#define TQTC_FILE "qtcurvestylerc" - -#ifdef CONFIG_READ -static int c2h(char ch) -{ - return (ch>='0' && ch<='9') ? ch-'0' : - (ch>='a' && ch<='f') ? 10+(ch-'a') : - (ch>='A' && ch<='F') ? 10+(ch-'A') : - 0; -} - -#define ATOH(str) ((c2h(*str)<<4)+c2h(*(str+1))) - -static void setRgb(color *col, const char *str) -{ - if(str && strlen(str)>6) - { - int offset='#'==str[0] ? 1 : 0; -#ifdef __cplusplus - col->setRgb(ATOH(&str[offset]), ATOH(&str[offset+2]), ATOH(&str[offset+4])); -#else - col->red=ATOH(&str[offset])<<8; - col->green=ATOH(&str[offset+2])<<8; - col->blue=ATOH(&str[offset+4])<<8; - col->pixel=0; -#endif - } - else -#ifdef __cplusplus - col->setRgb(0, 0, 0); -#else - col->red=col->green=col->blue=col->pixel=0; -#endif -} - -static EDefBtnIndicator toInd(const char *str, EDefBtnIndicator def) -{ - if(str) - { - if(0==memcmp(str, "fontcolor", 9) || 0==memcmp(str, "border", 6)) - return IND_FONT_COLOR; - if(0==memcmp(str, "none", 4)) - return IND_NONE; - if(0==memcmp(str, "corner", 6)) - return IND_CORNER; - if(0==memcmp(str, "colored", 7)) - return IND_COLORED; - } - - return def; -} - -static ELine toLine(const char *str, ELine def) -{ - if(str) - { - if(0==memcmp(str, "dashes", 6)) - return LINE_DASHES; - if(0==memcmp(str, "none", 4)) - return LINE_NONE; - if(0==memcmp(str, "sunken", 6)) - return LINE_SUNKEN; - if(0==memcmp(str, "dots", 4)) - return LINE_DOTS; - if(0==memcmp(str, "flat", 4)) - return LINE_FLAT; - } - return def; -} - -static ETBarBorder toTBarBorder(const char *str, ETBarBorder def) -{ - if(str) - { - if(0==memcmp(str, "dark", 4)) - return 0==memcmp(&str[4], "-all", 4) ? TB_DARK_ALL : TB_DARK; - if(0==memcmp(str, "none", 4)) - return TB_NONE; - if(0==memcmp(str, "light", 5)) - return 0==memcmp(&str[5], "-all", 4) ? TB_LIGHT_ALL : TB_LIGHT; - } - return def; -} - -static EMouseOver toMouseOver(const char *str, EMouseOver def) -{ - if(str) - { - if(0==memcmp(str, "true", 4) || 0==memcmp(str, "colored", 7)) - return MO_COLORED; - if(0==memcmp(str, "plastik", 7)) - return MO_PLASTIK; - if(0==memcmp(str, "false", 4) || 0==memcmp(str, "none", 4)) - return MO_NONE; - } - return def; -} - -static EAppearance toAppearance(const char *str, EAppearance def) -{ - if(str) - { - if(0==memcmp(str, "flat", 4)) - 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, "inverted", 8)) - return APPEARANCE_INVERTED; - if(0==memcmp(str, "bevelled", 8)) - return APPEARANCE_BEVELLED; - } - return def; -} - -static EShade toShade(const char *str, bool allowDarken, EShade def) -{ - if(str) - { - /* true/false is from 0.25... */ - if(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)) - return SHADE_DARKEN; - if(0==memcmp(str, "custom", 6)) - return SHADE_CUSTOM; - if(0==memcmp(str, "none", 4)) - return SHADE_NONE; - } - - return def; -} - -/* Prior to 0.42 round was a bool - so need to read 'false' as 'none' */ -static ERound toRound(const char *str, ERound def) -{ - if(str) - { - if(0==memcmp(str, "none", 4) || 0==memcmp(str, "false", 5)) - return ROUND_NONE; - if(0==memcmp(str, "slight", 6)) - return ROUND_SLIGHT; - if(0==memcmp(str, "full", 4)) - return ROUND_FULL; - } - - return def; -} - -static EScrollbar toScrollbar(const char *str, EScrollbar def) -{ - if(str) - { - if(0==memcmp(str, "kde", 3)) - return SCROLLBAR_KDE; - if(0==memcmp(str, "windows", 7)) - return SCROLLBAR_WINDOWS; - if(0==memcmp(str, "platinum", 8)) - return SCROLLBAR_PLATINUM; - if(0==memcmp(str, "next", 4)) - return SCROLLBAR_NEXT; - if(0==memcmp(str, "none", 4)) - return SCROLLBAR_NONE; - } - - return def; -} - -static EEffect toEffect(const char *str, EEffect def) -{ - if(str) - { - if(0==memcmp(str, "none", 4)) - return EFFECT_NONE; - if(0==memcmp(str, "shadow", 6)) - return EFFECT_SHADOW; - if(0==memcmp(str, "etch", 4)) - return EFFECT_ETCH; - } - - return def; -} - -static EShading toShading(const char * str, EShading def) -{ - if(str) - { - if(0==memcmp(str, "simple", 6)) - return SHADING_SIMPLE; - if(0==memcmp(str, "hsl", 3)) - return SHADING_HSL; - if(0==memcmp(str, "hsv", 3)) - return SHADING_HSV; - } - - return def; -} - -static EStripe toStripe(const char * str, EStripe def) -{ - if(str) - { - if(0==memcmp(str, "plain", 5) || 0==memcmp(str, "true", 4)) - return STRIPE_PLAIN; - if(0==memcmp(str, "none", 4) || 0==memcmp(str, "false", 5)) - return STRIPE_NONE; - if(0==memcmp(str, "diagonal", 8)) - return STRIPE_DIAGONAL; - } - - return def; -} - -static ESliderStyle toSlider(const char * str, ESliderStyle def) -{ - if(str) - { - if(0==memcmp(str, "round", 5)) - return SLIDER_ROUND; - if(0==memcmp(str, "plain", 5)) - return SLIDER_PLAIN; - if(0==memcmp(str, "triangular", 10)) - return SLIDER_TRIANGULAR; - } - - return def; -} - -#endif - -#ifdef CONFIG_WRITE -#include -#endif - -static const char * getHome() -{ - static const char *home=NULL; - - if(!home) - { - struct passwd *p=getpwuid(getuid()); - - if(p) - home=p->pw_dir; - else - { - char *env=getenv("HOME"); - - if(env) - home=env; - } - - if(!home) - home="/tmp"; - } - - return home; -} - -static const char *xdgConfigFolder() -{ - static char xdgDir[TQTC_MAX_FILENAME_LEN]={'\0'}; - - if(!xdgDir[0]) - { - static const char *home=NULL; - -#if 0 - char *env=getenv("XDG_CONFIG_HOME"); - - /* - Check the setting of XDG_CONFIG_HOME - For some reason, sudo leaves the env vars set to those of the - caller - so XDG_CONFIG_HOME would point to the users setting, and - not roots. - - Therefore, check that home is first part of XDG_CONFIG_HOME - */ - - if(env && 0==getuid()) - { - if(!home) - home=getHome(); - if(home && home!=strstr(env, home)) - env=NULL; - } -#else - /* - Hmm... for 'root' dont bother to check env var, just set to ~/.config - - as problems would arise if "sudo tdecmshell style", and then - "sudo su" / "tdecmshell style". The 1st would write to ~/.config, but - if root has a XDG_ set then that would be used on the second :-( - */ - char *env=0==getuid() ? NULL : getenv("XDG_CONFIG_HOME"); -#endif - - if(!env) - { - if(!home) - home=getHome(); - - sprintf(xdgDir, "%s/.config", home); - } - else - strcpy(xdgDir, env); - -#if defined CONFIG_WRITE || !defined __cplusplus - { - struct stat info; - - if(0!=lstat(xdgDir, &info)) - { -#ifdef __cplusplus - TDEStandardDirs::makeDir(xdgDir, 0755); -#else - g_mkdir_with_parents(xdgDir, 0755); -#endif - } - } -#endif - } - - return xdgDir; -} - -#ifdef CONFIG_READ - -#ifdef __cplusplus -#define TQTC_IS_BLACK(A) (0==(A).red() && 0==(A).green() && 0==(A).blue()) -#else -#define TQTC_IS_BLACK(A) (0==(A).red && 0==(A).green && 0==(A).blue) -#endif - -static void checkColor(EShade *s, color *c) -{ - if(SHADE_CUSTOM==*s && TQTC_IS_BLACK(*c)) - *s=SHADE_NONE; -} - -#ifdef __cplusplus - -#if [[[TQT_VERSION IS DEPRECATED]]] >= 0x040000 -#include -#include -#include -#define TQTC_LATIN1(A) A.toLatin1() -#else -#define TQTC_LATIN1(A) A.latin1() - -#include -#include -#include -#endif - -class TQtCConfig -{ - public: - - TQtCConfig(const TQString &filename); - - bool ok() const { return values.count()>0; } - const TQString & readEntry(const char *key, const TQString &def=TQString()); - - private: - - TQMap values; -}; - -TQtCConfig::TQtCConfig(const TQString &filename) -{ - TQFile f(filename); - -#if [[[TQT_VERSION IS DEPRECATED]]] >= 0x040000 - if(f.open(TQIODevice::ReadOnly)) -#else - if(f.open(IO_ReadOnly)) -#endif - { - TQTextStream stream(&f); - TQString line; - - while(!stream.atEnd()) - { - line = stream.readLine(); -#if [[[TQT_VERSION IS DEPRECATED]]] >= 0x040000 - int pos=line.indexOf('='); -#else - int pos=line.find('='); -#endif - if(-1!=pos) - values[line.left(pos)]=line.mid(pos+1); - } - f.close(); - } -} - -inline const TQString & TQtCConfig::readEntry(const char *key, const TQString &def) -{ - return values.contains(key) ? values[key] : def; -} - -inline TQString readStringEntry(TQtCConfig &cfg, const char *key) -{ - return cfg.readEntry(key); -} - -static int readNumEntry(TQtCConfig &cfg, const char *key, int def) -{ - const TQString &val(readStringEntry(cfg, key)); - - return val.isEmpty() ? def : val.toInt(); -} - -static bool readBoolEntry(TQtCConfig &cfg, const char *key, bool def) -{ - const TQString &val(readStringEntry(cfg, key)); - - return val.isEmpty() ? def : (val=="true" ? true : false); -} - -#if [[[TQT_VERSION IS DEPRECATED]]] >= 0x040000 -#define TQTC_LATIN1(A) A.toLatin1() -#else -#define TQTC_LATIN1(A) A.latin1() -#endif - -#define TQTC_CFG_READ_COLOR(ENTRY) \ - { \ - TQString sVal(cfg.readEntry(#ENTRY)); \ - if(sVal.isEmpty()) \ - opts->ENTRY=def->ENTRY; \ - else \ - setRgb(&(opts->ENTRY), TQTC_LATIN1(sVal)); \ - } - -#else - -static char * lookupCfgHash(GHashTable **cfg, char *key, char *val) -{ - char *rv=NULL; - - if(!*cfg) - *cfg=g_hash_table_new(g_str_hash, g_str_equal); - else - rv=(char *)g_hash_table_lookup(*cfg, key); - - if(!rv && val) - { - g_hash_table_insert(*cfg, g_strdup(key), g_strdup(val)); - rv=(char *)g_hash_table_lookup(*cfg, key); - } - - return rv; -} - -static GHashTable * loadConfig(const char *filename) -{ - FILE *f=fopen(filename, "r"); - GHashTable *cfg=NULL; - - if(f) - { - char line[TQTC_MAX_INPUT_LINE_LEN]; - - while(NULL!=fgets(line, TQTC_MAX_INPUT_LINE_LEN-1, f)) - { - char *eq=strchr(line, '='); - int pos=eq ? eq-line : -1; - - if(pos>0) - { - char *endl=strchr(line, '\n'); - - if(endl) - *endl='\0'; - - line[pos]='\0'; - - lookupCfgHash(&cfg, line, &line[pos+1]); - } - } - - fclose(f); - } - - return cfg; -} - -static void releaseConfig(GHashTable *cfg) -{ - g_hash_table_destroy(cfg); -} - -static char * readStringEntry(GHashTable *cfg, char *key) -{ - return lookupCfgHash(&cfg, key, NULL); -} - -static int readNumEntry(GHashTable *cfg, char *key, int def) -{ - char *str=readStringEntry(cfg, key); - - return str ? atoi(str) : def; -} - -static gboolean readBoolEntry(GHashTable *cfg, char *key, gboolean def) -{ - char *str=readStringEntry(cfg, key); - - return str ? (0==memcmp(str, "true", 4) ? true : false) : def; -} - -#define TQTC_LATIN1(A) A - -#define TQTC_CFG_READ_COLOR(ENTRY) \ - { \ - const char *str=readStringEntry(cfg, #ENTRY); \ - \ - if(str) \ - setRgb(&(opts->ENTRY), str); \ - else \ - opts->ENTRY=def->ENTRY; \ - } -#endif - -#define TQTC_CFG_READ_NUM(ENTRY) \ - opts->ENTRY=readNumEntry(cfg, #ENTRY, def->ENTRY); - -#define TQTC_CFG_READ_BOOL(ENTRY) \ - opts->ENTRY=readBoolEntry(cfg, #ENTRY, def->ENTRY); - -#define TQTC_CFG_READ_ROUND(ENTRY) \ - opts->ENTRY=toRound(TQTC_LATIN1(readStringEntry(cfg, #ENTRY)), def->ENTRY); - -#define TQTC_CFG_READ_DI(ENTRY) \ - opts->ENTRY=((double)(readNumEntry(cfg, #ENTRY, ((int)(def->ENTRY*100))-100)+100))/100.0; - -#define TQTC_CFG_READ_TB_BORDER(ENTRY) \ - opts->ENTRY=toTBarBorder(TQTC_LATIN1(readStringEntry(cfg, #ENTRY)), def->ENTRY); - -#define TQTC_CFG_READ_MOUSE_OVER(ENTRY) \ - opts->ENTRY=toMouseOver(TQTC_LATIN1(readStringEntry(cfg, #ENTRY)), def->ENTRY); - -#define TQTC_CFG_READ_APPEARANCE(ENTRY, DEF) \ - opts->ENTRY=toAppearance(TQTC_LATIN1(readStringEntry(cfg, #ENTRY)), DEF); - -/* -#define TQTC_CFG_READ_APPEARANCE(ENTRY) \ - opts->ENTRY=toAppearance(TQTC_LATIN1(readStringEntry(cfg, #ENTRY)), def->ENTRY); -*/ - -#define TQTC_CFG_READ_STRIPE(ENTRY) \ - opts->ENTRY=toStripe(TQTC_LATIN1(readStringEntry(cfg, #ENTRY)), def->ENTRY); - -#define TQTC_CFG_READ_SLIDER(ENTRY) \ - opts->ENTRY=toSlider(TQTC_LATIN1(readStringEntry(cfg, #ENTRY)), def->ENTRY); - -#define TQTC_CFG_READ_DEF_BTN(ENTRY) \ - opts->ENTRY=toInd(TQTC_LATIN1(readStringEntry(cfg, #ENTRY)), def->ENTRY); - -#define TQTC_CFG_READ_LINE(ENTRY) \ - opts->ENTRY=toLine(TQTC_LATIN1(readStringEntry(cfg, #ENTRY)), def->ENTRY); - -#define TQTC_CFG_READ_SHADE(ENTRY, AD) \ - opts->ENTRY=toShade(TQTC_LATIN1(readStringEntry(cfg, #ENTRY)), AD, def->ENTRY); - -#define TQTC_CFG_READ_SCROLLBAR(ENTRY) \ - opts->ENTRY=toScrollbar(TQTC_LATIN1(readStringEntry(cfg, #ENTRY)), def->ENTRY); - -#define TQTC_CFG_READ_EFFECT(ENTRY) \ - opts->ENTRY=toEffect(TQTC_LATIN1(readStringEntry(cfg, #ENTRY)), def->ENTRY); - -#ifdef TQTC_CONFIG_DIALOG -#define TQTC_CFG_READ_SHADING(ENTRY, UNUSED) \ - opts->ENTRY=toShading(TQTC_LATIN1(readStringEntry(cfg, #ENTRY)), def->ENTRY); -#else -#define TQTC_CFG_READ_SHADING(ENTRY, DEF) \ - ENTRY=toShading(TQTC_LATIN1(readStringEntry(cfg, #ENTRY)), DEF); -#endif - -#ifdef __cplusplus -static bool readConfig(const TQString &file, Options *opts, Options *def) -#else -static bool readConfig(const char *file, Options *opts, Options *def) -#endif -{ -#ifdef __cplusplus - if(file.isEmpty()) - { - const char *xdg=xdgConfigFolder(); - - if(xdg) - { - TQString filename(xdg); - - filename+="/"TQTC_FILE; - return readConfig(filename, opts, def); - } - } -#else - if(!file) - { - const char *xdg=xdgConfigFolder(); - - if(xdg) - { - char filename[TQTC_MAX_FILENAME_LEN]; - - sprintf(filename, "%s/"TQTC_FILE, xdg); - return readConfig(filename, opts, def); - } - } -#endif - else - { -#ifdef __cplusplus - TQtCConfig cfg(file); - - if(cfg.ok()) - { -#else - GHashTable *cfg=loadConfig(file); - - if(cfg) - { -#endif - TQTC_CFG_READ_NUM(passwordChar) - TQTC_CFG_READ_ROUND(round) - TQTC_CFG_READ_DI(highlightFactor) - TQTC_CFG_READ_TB_BORDER(toolbarBorders) - TQTC_CFG_READ_APPEARANCE(appearance, def->appearance) - TQTC_CFG_READ_BOOL(fixParentlessDialogs) - TQTC_CFG_READ_STRIPE(stripedProgress) - TQTC_CFG_READ_SLIDER(sliderStyle) - TQTC_CFG_READ_BOOL(animatedProgress) - TQTC_CFG_READ_BOOL(lighterPopupMenuBgnd) - TQTC_CFG_READ_BOOL(embolden) - TQTC_CFG_READ_DEF_BTN(defBtnIndicator) - TQTC_CFG_READ_LINE(sliderThumbs) - TQTC_CFG_READ_LINE(handles) - TQTC_CFG_READ_BOOL(highlightTab) - TQTC_CFG_READ_BOOL(colorSelTab) - TQTC_CFG_READ_SHADE(shadeSliders, false) - TQTC_CFG_READ_SHADE(shadeMenubars, true) - TQTC_CFG_READ_SHADE(shadeCheckRadio, false) - TQTC_CFG_READ_APPEARANCE(menubarAppearance, def->menubarAppearance) - TQTC_CFG_READ_APPEARANCE(menuitemAppearance, opts->appearance) - TQTC_CFG_READ_APPEARANCE(toolbarAppearance, def->toolbarAppearance) - TQTC_CFG_READ_LINE(toolbarSeparators) - TQTC_CFG_READ_LINE(splitters) - TQTC_CFG_READ_BOOL(customMenuTextColor) - TQTC_CFG_READ_MOUSE_OVER(coloredMouseOver) - TQTC_CFG_READ_BOOL(menubarMouseOver) - TQTC_CFG_READ_BOOL(shadeMenubarOnlyWhenActive) - TQTC_CFG_READ_BOOL(thinnerMenuItems) - TQTC_CFG_READ_COLOR(customSlidersColor) - TQTC_CFG_READ_COLOR(customMenubarsColor) - TQTC_CFG_READ_COLOR(customMenuSelTextColor) - TQTC_CFG_READ_COLOR(customMenuNormTextColor) - TQTC_CFG_READ_COLOR(customCheckRadioColor) - TQTC_CFG_READ_SCROLLBAR(scrollbarType) - TQTC_CFG_READ_EFFECT(buttonEffect) - TQTC_CFG_READ_APPEARANCE(lvAppearance, opts->appearance) - TQTC_CFG_READ_APPEARANCE(tabAppearance, opts->appearance) - TQTC_CFG_READ_APPEARANCE(sliderAppearance, opts->appearance) - TQTC_CFG_READ_APPEARANCE(progressAppearance, opts->appearance) -#ifndef TQTC_PLAIN_FOCUS_ONLY - TQTC_CFG_READ_BOOL(stdFocus) -#endif - TQTC_CFG_READ_BOOL(lvLines) - TQTC_CFG_READ_BOOL(drawStatusBarFrames) - TQTC_CFG_READ_BOOL(fillSlider) - TQTC_CFG_READ_BOOL(roundMbTopOnly) - TQTC_CFG_READ_BOOL(borderMenuitems) - TQTC_CFG_READ_BOOL(gradientPbGroove) - TQTC_CFG_READ_BOOL(darkerBorders) - TQTC_CFG_READ_BOOL(vArrows) - TQTC_CFG_READ_BOOL(xCheck) - TQTC_CFG_READ_BOOL(framelessGroupBoxes) - TQTC_CFG_READ_BOOL(inactiveHighlight) - TQTC_CFG_READ_BOOL(colorMenubarMouseOver) -#ifdef __cplusplus - TQTC_CFG_READ_BOOL(stdSidebarButtons) - TQTC_CFG_READ_BOOL(gtkScrollViews) - TQTC_CFG_READ_BOOL(gtkComboMenus) -/* -#else - TQTC_CFG_READ_BOOL(setDialogButtonOrder) -*/ -#endif -#if !defined __cplusplus || defined TQTC_CONFIG_DIALOG - TQTC_CFG_READ_BOOL(mapKdeIcons) -#endif -#if defined TQTC_CONFIG_DIALOG || (defined [[[TQT_VERSION IS DEPRECATED]]] && ([[[TQT_VERSION IS DEPRECATED]]] >= 0x040000)) || !defined __cplusplus - TQTC_CFG_READ_BOOL(gtkButtonOrder) -#endif - TQTC_CFG_READ_SHADING(shading, shading); - -#ifndef __cplusplus - releaseConfig(cfg); -#endif - if(SHADE_SELECTED==opts->shadeCheckRadio) - opts->shadeCheckRadio=SHADE_BLEND_SELECTED; - - checkColor(&opts->shadeMenubars, &opts->customMenubarsColor); - checkColor(&opts->shadeSliders, &opts->customSlidersColor); - checkColor(&opts->shadeCheckRadio, &opts->customCheckRadioColor); - - 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(opts->highlightFactor<((100.0+MIN_HIGHLIGHT_FACTOR)/100.0) || - opts->highlightFactor>((100.0+MAX_HIGHLIGHT_FACTOR)/100.0)) - opts->highlightFactor=DEFAULT_HIGHLIGHT_FACTOR; - - if(opts->animatedProgress && !opts->stripedProgress) - opts->animatedProgress=false; - - if(opts->colorSelTab && APPEARANCE_GRADIENT!=opts->tabAppearance) - opts->colorSelTab=false; - - if(SHADE_CUSTOM==opts->shadeMenubars || SHADE_BLEND_SELECTED==opts->shadeMenubars || !opts->borderMenuitems) - opts->colorMenubarMouseOver=true; - - return true; - } - } - - return false; -} - -static bool fileExists(const char *path) -{ - struct stat info; - - return 0==lstat(path, &info) && (info.st_mode&S_IFMT)==S_IFREG; -} - -static const char * getSystemConfigFile() -{ - static const char * constFiles[]={ "/etc/qt4/"TQTC_FILE, "/etc/qt3/"TQTC_FILE, "/etc/qt/"TQTC_FILE, NULL }; - - int i; - - for(i=0; constFiles[i]; ++i) - if(fileExists(constFiles[i])) - return constFiles[i]; - return NULL; -} - -static void defaultSettings(Options *opts) -{ - /* Set hard-coded defaults... */ - opts->contrast=7; - opts->passwordChar=0x25CF; - opts->highlightFactor=DEFAULT_HIGHLIGHT_FACTOR; - opts->round=ROUND_FULL; - opts->lighterPopupMenuBgnd=true; - opts->animatedProgress=true; - opts->stripedProgress=STRIPE_DIAGONAL; - opts->sliderStyle=SLIDER_TRIANGULAR; - opts->highlightTab=true; - opts->colorSelTab=false; - opts->embolden=false; - opts->appearance=APPEARANCE_DULL_GLASS; - opts->lvAppearance=APPEARANCE_BEVELLED; - opts->tabAppearance=APPEARANCE_GRADIENT; - opts->sliderAppearance=APPEARANCE_DULL_GLASS; - opts->menubarAppearance=APPEARANCE_GRADIENT; - opts->menuitemAppearance=APPEARANCE_DULL_GLASS; - opts->toolbarAppearance=APPEARANCE_GRADIENT; - opts->progressAppearance=APPEARANCE_DULL_GLASS; - opts->defBtnIndicator=IND_COLORED; - opts->sliderThumbs=LINE_FLAT; - opts->handles=LINE_DOTS; - opts->shadeSliders=SHADE_BLEND_SELECTED; - opts->shadeMenubars=SHADE_DARKEN; - opts->shadeCheckRadio=SHADE_NONE; - opts->toolbarBorders=TB_NONE; - opts->toolbarSeparators=LINE_NONE; - opts->splitters=LINE_FLAT; - opts->fixParentlessDialogs=false; - opts->customMenuTextColor=false; - opts->coloredMouseOver=MO_PLASTIK; - opts->menubarMouseOver=true; - opts->shadeMenubarOnlyWhenActive=true; - opts->thinnerMenuItems=false; - opts->scrollbarType=SCROLLBAR_KDE; - opts->buttonEffect=EFFECT_NONE; -#ifndef TQTC_PLAIN_FOCUS_ONLY - opts->stdFocus=true; -#endif - opts->lvLines=false; - opts->drawStatusBarFrames=false; - opts->fillSlider=true; - opts->roundMbTopOnly=true; - opts->borderMenuitems=true; - opts->gradientPbGroove=true; - opts->darkerBorders=false; - opts->vArrows=false; - opts->xCheck=false; - opts->framelessGroupBoxes=false; - opts->colorMenubarMouseOver=false; - opts->inactiveHighlight=false; -#ifdef TQTC_CONFIG_DIALOG - opts->shading=SHADING_HSL; -#endif -#ifdef __cplusplus - opts->stdSidebarButtons=false; - opts->gtkScrollViews=false; - 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); -#else -/* - opts->setDialogButtonOrder=false; -*/ - opts->customMenubarsColor.red=opts->customMenubarsColor.green=opts->customMenubarsColor.blue=0; - opts->customSlidersColor.red=opts->customSlidersColor.green=opts->customSlidersColor.blue=0; - 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; -#endif - -#if !defined __cplusplus || defined TQTC_CONFIG_DIALOG - opts->mapKdeIcons=true; -#endif -#if defined TQTC_CONFIG_DIALOG || (defined [[[TQT_VERSION IS DEPRECATED]]] && ([[[TQT_VERSION IS DEPRECATED]]] >= 0x040000)) || !defined __cplusplus - opts->gtkButtonOrder=false; -#endif - - /* Read system config file... */ - { - static const char * systemFilename=NULL; - - if(!systemFilename) - systemFilename=getSystemConfigFile(); - - if(systemFilename) - readConfig(systemFilename, opts, opts); - } -} - -#endif - -#ifdef CONFIG_WRITE -static const char *toStr(EDefBtnIndicator ind) -{ - switch(ind) - { - case IND_NONE: - return "none"; - case IND_FONT_COLOR: - return "fontcolor"; - case IND_CORNER: - return "corner"; - default: - return "colored"; - } -} - -static const char *toStr(ELine ind, bool none) -{ - switch(ind) - { - case LINE_DOTS: - return "dots"; - case LINE_DASHES: - return none ? "none" : "dashes"; - case LINE_FLAT: - return "flat"; - default: - return "sunken"; - } -} - -static const char *toStr(ETBarBorder ind) -{ - switch(ind) - { - case TB_DARK: - return "dark"; - case TB_DARK_ALL: - return "dark-all"; - case TB_LIGHT_ALL: - return "light-all"; - case TB_NONE: - return "none"; - default: - return "light"; - } -} - -static const char *toStr(EMouseOver mo) -{ - switch(mo) - { - case MO_COLORED: - return "colored"; - case MO_NONE: - return "none"; - default: - return "plastik"; - } -} - -static const char *toStr(EAppearance exp) -{ - switch(exp) - { - case APPEARANCE_FLAT: - return "flat"; - case APPEARANCE_RAISED: - return "raised"; - case APPEARANCE_GRADIENT: - return "gradient"; - case APPEARANCE_SPLIT_GRADIENT: - return "splitgradient"; - case APPEARANCE_DULL_GLASS: - return "dullglass"; - case APPEARANCE_BEVELLED: - return "bevelled"; - case APPEARANCE_INVERTED: - return "inverted"; - default: - return "shinyglass"; - } -} - -static const char *toStr(EShade exp, bool dark, bool convertBlendSelToSel) -{ - switch(exp) - { - default: - case SHADE_NONE: - return "none"; - case SHADE_BLEND_SELECTED: - return dark || !convertBlendSelToSel ? "selected" : "origselected"; - case SHADE_CUSTOM: - return "custom"; - /* case SHADE_SELECTED */ - case SHADE_DARKEN: - return dark ? "darken" : "origselected"; - } -} - -static const char *toStr(ERound exp) -{ - switch(exp) - { - case ROUND_NONE: - return "none"; - case ROUND_SLIGHT: - return "slight"; - default: - case ROUND_FULL: - return "full"; - } -} - -static const char *toStr(EScrollbar sb) -{ - switch(sb) - { - case SCROLLBAR_KDE: - return "kde"; - default: - case SCROLLBAR_WINDOWS: - return "windows"; - case SCROLLBAR_PLATINUM: - return "platinum"; - case SCROLLBAR_NEXT: - return "next"; - case SCROLLBAR_NONE: - return "none"; - } -} - -static const char *toStr(EEffect e) -{ - switch(e) - { - case EFFECT_NONE: - return "none"; - default: - case EFFECT_SHADOW: - return "shadow"; - case EFFECT_ETCH: - return "etch"; - } -} - -inline const char * toStr(bool b) { return b ? "true" : "false"; } - -static TQString toStr(const TQColor &col) -{ - TQString colorStr; - - colorStr.sprintf("#%02X%02X%02X", col.red(), col.green(), col.blue()); - return colorStr; -} - -static const char *toStr(EShading s) -{ - switch(s) - { - case SHADING_SIMPLE: - return "simple"; - default: - case SHADING_HSL: - return "hsl"; - case SHADING_HSV: - return "hsv"; - } -} - -static const char *toStr(EStripe s) -{ - switch(s) - { - default: - case STRIPE_PLAIN: - return "plain"; - case STRIPE_NONE: - return "none"; - case STRIPE_DIAGONAL: - return "diagonal"; - } -} - -static const char *toStr(ESliderStyle s) -{ - switch(s) - { - case SLIDER_PLAIN: - return "plain"; - case SLIDER_TRIANGULAR: - return "triangular"; - default: - case SLIDER_ROUND: - return "round"; - } -} - -#if [[[TQT_VERSION IS DEPRECATED]]] >= 0x040000 -#define CFG config -#else -#define CFG (*cfg) -#endif - -#define CFG_WRITE_ENTRY(ENTRY) \ - if (!exportingStyle && def.ENTRY==opts.ENTRY) \ - CFG.deleteEntry(#ENTRY); \ - else \ - CFG.writeEntry(#ENTRY, toStr(opts.ENTRY)); - -#define CFG_WRITE_ENTRY_FORCE(ENTRY) \ - CFG.writeEntry(#ENTRY, toStr(opts.ENTRY)); - -#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) \ - if (!exportingStyle && def.ENTRY==opts.ENTRY) \ - CFG.deleteEntry(#ENTRY); \ - else \ - CFG.writeEntry(#ENTRY, toStr(opts.ENTRY, DARK, CONVERT_SHADE)); - -#define CFG_WRITE_ENTRY_D(ENTRY) \ - if (!exportingStyle && def.ENTRY==opts.ENTRY) \ - CFG.deleteEntry(#ENTRY); \ - else \ - CFG.writeEntry(#ENTRY, ((int)(opts.ENTRY*100))-100); - -#define CFG_WRITE_ENTRY_NUM(ENTRY) \ - if (!exportingStyle && def.ENTRY==opts.ENTRY) \ - CFG.deleteEntry(#ENTRY); \ - else \ - CFG.writeEntry(#ENTRY, opts.ENTRY); - -bool static writeConfig(TDEConfig *cfg, const Options &opts, const Options &def, bool exportingStyle=false) -{ - if(!cfg) - { - const char *xdg=xdgConfigFolder(); - - if(xdg) - { - char filename[TQTC_MAX_FILENAME_LEN]; - - sprintf(filename, "%s/"TQTC_FILE, xdg); - -#if [[[TQT_VERSION IS DEPRECATED]]] >= 0x040000 - TDEConfig defCfg(filename, TDEConfig::SimpleConfig); -#else - TDEConfig defCfg(filename, false, false); -#endif - - return writeConfig(&defCfg, opts, def, exportingStyle); - } - } - else - { -#if [[[TQT_VERSION IS DEPRECATED]]] >= 0x040000 - TDEConfigGroup config(cfg, TQTC_GROUP); -#else - cfg->setGroup(TQTC_GROUP); -#endif - CFG_WRITE_ENTRY_NUM(passwordChar) - CFG_WRITE_ENTRY(round) - CFG_WRITE_ENTRY_D(highlightFactor) - CFG_WRITE_ENTRY(toolbarBorders) - CFG_WRITE_ENTRY_FORCE(appearance) - CFG_WRITE_ENTRY(fixParentlessDialogs) - CFG_WRITE_ENTRY(stripedProgress) - CFG_WRITE_ENTRY(sliderStyle) - CFG_WRITE_ENTRY(animatedProgress) - CFG_WRITE_ENTRY(lighterPopupMenuBgnd) - CFG_WRITE_ENTRY(embolden) - CFG_WRITE_ENTRY(defBtnIndicator) - CFG_WRITE_ENTRY_B(sliderThumbs, true) - CFG_WRITE_ENTRY_B(handles, false) - 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(customMenuTextColor) - CFG_WRITE_ENTRY(coloredMouseOver) - CFG_WRITE_ENTRY(menubarMouseOver) - CFG_WRITE_ENTRY(shadeMenubarOnlyWhenActive) - CFG_WRITE_ENTRY(thinnerMenuItems) - CFG_WRITE_ENTRY(customSlidersColor) - CFG_WRITE_ENTRY(customMenubarsColor) - CFG_WRITE_ENTRY(customMenuSelTextColor) - CFG_WRITE_ENTRY(customMenuNormTextColor) - CFG_WRITE_ENTRY(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 TQTC_PLAIN_FOCUS_ONLY - CFG_WRITE_ENTRY(stdFocus) -#endif - 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) -#endif - - CFG_WRITE_ENTRY(gtkScrollViews) - CFG_WRITE_ENTRY(gtkComboMenus) - CFG_WRITE_ENTRY(gtkButtonOrder) - CFG_WRITE_ENTRY(mapKdeIcons) - CFG_WRITE_ENTRY(shading) - cfg->sync(); - return true; - } - return false; -} -#endif diff --git a/style/qtcurve.cpp b/style/qtcurve.cpp index 24b1f19..fa0fe51 100644 --- a/style/qtcurve.cpp +++ b/style/qtcurve.cpp @@ -145,7 +145,7 @@ static void emitMenuSize(const TQWidget *widget, unsigned short size) if(w) { - static const Atom constAtom = XInternAtom(tqt_xdisplay(), MENU_SIZE_ATOM, False); + static const Atom constAtom = XInternAtom(tqt_xdisplay(), MENU_SIZE_ATOM, False); XChangeProperty(tqt_xdisplay(), w->parentWidget() ? w->parentWidget()->winId() : w->winId(), constAtom, XA_CARDINAL, 16, PropModeReplace, (unsigned char *)&size, 1); } @@ -157,9 +157,12 @@ void setBgndProp(TQWidget *widget, unsigned short app) if(w) { - static const Atom constAtom = XInternAtom(tqt_xdisplay(), BGND_ATOM, False); + static const Atom constAtom = XInternAtom(tqt_xdisplay(), BGND_ATOM, False); + unsigned long prop=((APPEARANCE_STRIPED==app || APPEARANCE_FILE==app ? app : APPEARANCE_FLAT)&0xFF) | + (widget->palette().active().background().rgb()&0x00FFFFFF)<<8; + XChangeProperty(tqt_xdisplay(), w->parentWidget() ? w->parentWidget()->winId() : w->winId(), - constAtom, XA_CARDINAL, 16, PropModeReplace, (unsigned char *)&app, 1); + constAtom, XA_CARDINAL, 32, PropModeReplace, (unsigned char *)&prop, 1); } } @@ -186,6 +189,39 @@ static void triggerWMMove(const TQWidget *w, const TQPoint &p) #define MO_ARROW_X(FLAGS, COL) (MO_NONE!=opts.coloredMouseOver && FLAGS&Style_MouseOver && FLAGS&Style_Enabled ? itsMouseOverCols[ARROW_MO_SHADE] : COL) #define MO_ARROW(COL) MO_ARROW_X(flags, COL) +static void adjustToolbarButtons(const TQWidget *widget, const TQToolBar *toolbar, int &leftAdjust, int &topAdjust, + int &rightAdjust, int &bottomAdjust, int &round) +{ + const int constAdjust=4; + const int d = 1; + TQRect geo(widget->geometry()); + + if (TQt::Horizontal==toolbar->orientation()) + { + bool haveLeft=::tqqt_cast(toolbar->childAt(geo.x()-d, geo.y())), + haveRight=::tqqt_cast(toolbar->childAt(geo.right()+d, geo.y())); + + if(haveLeft && haveRight) + leftAdjust=-constAdjust, rightAdjust=constAdjust, round=ROUNDED_NONE; + else if(haveLeft) + leftAdjust=-constAdjust, round=ROUNDED_RIGHT; + else if(haveRight) + rightAdjust=constAdjust, round=ROUNDED_LEFT; + } + else + { + bool haveTop=::tqqt_cast(toolbar->childAt(geo.x(), geo.y()-d)), + haveBot=::tqqt_cast(toolbar->childAt(geo.x(), geo.bottom()+d)); + + if(haveTop && haveBot) + topAdjust=-constAdjust, bottomAdjust=constAdjust, round=ROUNDED_NONE; + else if(haveTop) + topAdjust=-constAdjust, round=ROUNDED_BOTTOM; + else if(haveBot) + bottomAdjust=constAdjust, round=ROUNDED_TOP; + } +} + static const int constMenuPixmapWidth=22; static bool useTQt3Settings() @@ -1419,6 +1455,35 @@ void QtCurveStyle::polish(TQPalette &pal) if(APPEARANCE_STRIPED==opts.bgndAppearance) pal.setBrush(TQColorGroup::Background, TQBrush(pal.active().background(), *createStripePixmap(pal.active().background(), true))); + else if(APPEARANCE_FILE==opts.bgndAppearance) + { + TQPixmap pix(opts.bgndPixmap.img.width(), opts.bgndPixmap.img.height()); + TQPainter p(&pix); + WindowBorders borders=qtcGetWindowBorderSize(); + int xadjust=borders.sides>0 && borders.sides!=opts.bgndPixmap.img.width() + ? borders.sides>opts.bgndPixmap.img.width() + ? borders.sides%opts.bgndPixmap.img.width() + : borders.sides + :0, + yadjust=borders.titleHeight>0 && borders.titleHeight!=opts.bgndPixmap.img.height() + ? borders.titleHeight>opts.bgndPixmap.img.height() + ? borders.titleHeight%opts.bgndPixmap.img.height() + : borders.titleHeight + :0; + + p.fillRect(0, 0, opts.bgndPixmap.img.width(), opts.bgndPixmap.img.height(), pal.active().background()); + + p.drawPixmap(-xadjust, -yadjust, opts.bgndPixmap.img); + if(xadjust>0) + p.drawPixmap(opts.bgndPixmap.img.width()-xadjust, -yadjust, opts.bgndPixmap.img); + if(yadjust>0) + p.drawPixmap(-xadjust, opts.bgndPixmap.img.height()-yadjust, opts.bgndPixmap.img); + if(xadjust>0 && yadjust>0) + p.drawPixmap(opts.bgndPixmap.img.width()-xadjust, opts.bgndPixmap.img.height()-yadjust, opts.bgndPixmap.img); + + p.end(); + pal.setBrush(TQColorGroup::Background, TQBrush(pal.active().background(), pix)); + } } static TQColor disable(const TQColor &col, const TQColor &bgnd) @@ -1479,8 +1544,11 @@ void QtCurveStyle::polish(const TQStyleControlElementData &ceData, ControlElemen if(isWindowDragWidget(TQT_TQOBJECT(widget))) installObjectEventHandler(ceData, elementFlags, ptr, this); - if(APPEARANCE_STRIPED==opts.bgndAppearance && (::tqqt_cast(widget) || ::tqqt_cast(widget))) - setBgndProp(widget, APPEARANCE_STRIPED); + if(::tqqt_cast(widget) || ::tqqt_cast(widget)) + { + setBgndProp(widget, opts.bgndAppearance); + installObjectEventHandler(ceData, elementFlags, ptr, this); // To trap palette change + } if(widget->parentWidget() && ::tqqt_cast(widget) && ::tqqt_cast(widget->parentWidget())) { @@ -1547,8 +1615,7 @@ void QtCurveStyle::polish(const TQStyleControlElementData &ceData, ControlElemen (widget->parentWidget() && ::tqqt_cast(widget) && ::tqqt_cast(widget->parentWidget())))) ((TQFrame *)widget)->setLineWidth(0); - else if ((USE_LIGHTER_POPUP_MENU || !IS_FLAT_BGND(opts.menuBgndAppearance)) && !opts.borderMenuitems && - widget && ::tqqt_cast(widget)) + else if (!DRAW_MENU_BORDER && !opts.borderMenuitems && widget && ::tqqt_cast(widget)) ((TQFrame *)widget)->setLineWidth(1); if (::tqqt_cast(widget) || ::tqqt_cast(widget)) @@ -1623,39 +1690,7 @@ void QtCurveStyle::polish(const TQStyleControlElementData &ceData, ControlElemen installObjectEventHandler(ceData, elementFlags, ptr, this); if(BLEND_TITLEBAR || opts.windowBorder&WINDOW_BORDER_USE_MENUBAR_COLOR_FOR_TITLEBAR) emitMenuSize(widget, ceData.rect.height()); - if(SHADE_WINDOW_BORDER==opts.shadeMenubars) - { - TQPalette pal(ceData.palette); - TQColorGroup act(pal.active()); - TQColorGroup inact(pal.inactive()); - - getMdiColors(act, true); - act.setColor(TQColorGroup::Foreground, itsActiveMdiTextColor); - inact.setColor(TQColorGroup::Foreground, opts.shadeMenubarOnlyWhenActive ? itsMdiTextColor : itsActiveMdiTextColor); - pal.setInactive(inact); - pal.setActive(act); - widget->setPalette(pal); - } - else if(opts.customMenuTextColor || SHADE_BLEND_SELECTED==opts.shadeMenubars || SHADE_SELECTED==opts.shadeMenubars || - (SHADE_CUSTOM==opts.shadeMenubars && TOO_DARK(itsMenubarCols[ORIGINAL_SHADE]))) - { - TQPalette pal(ceData.palette); - TQColorGroup act(pal.active()); - - act.setColor(TQColorGroup::Foreground, opts.customMenuTextColor - ? opts.customMenuNormTextColor - : TQApplication::palette().active().highlightedText()); - - if(!opts.shadeMenubarOnlyWhenActive) - { - TQColorGroup inact(pal.inactive()); - inact.setColor(TQColorGroup::Foreground, act.color(TQColorGroup::Foreground)); - pal.setInactive(inact); - } - - pal.setActive(act); - widget->setPalette(pal); - } + setMenuTextColors(widget, true); } else if(::tqqt_cast(widget)) { @@ -1663,7 +1698,10 @@ void QtCurveStyle::polish(const TQStyleControlElementData &ceData, ControlElemen widget->setBackgroundMode(PaletteBackground); } else if(::tqqt_cast(widget)) + { widget->setBackgroundMode(NoBackground); // PaletteBackground); + setMenuTextColors(widget, true); + } else if (ceData.widgetObjectTypes.contains("TDEToolBarSeparator") || (ceData.widgetObjectTypes.contains("TDEListViewSearchLineWidget") && widget->parent() && ::tqqt_cast(widget->parent()))) @@ -1837,7 +1875,7 @@ void QtCurveStyle::polish(const TQStyleControlElementData &ceData, ControlElemen widget->setPalette(pal); } - if(APPEARANCE_STRIPED==opts.bgndAppearance) + if(APPEARANCE_STRIPED==opts.bgndAppearance || APPEARANCE_FILE==opts.bgndAppearance) widget->setBackgroundOrigin(TQWidget::WindowOrigin); } @@ -2096,12 +2134,17 @@ bool QtCurveStyle::objectEventHandler( const TQStyleControlElementData &ceData, { TQWidget *widget=(TQWidget*)object; TQPainter painter(widget); - TQColor col(USE_LIGHTER_POPUP_MENU ? itsLighterPopupMenuBgndCol : ceData.palette.active().background()); + TQColor col(popupMenuCol(widget->palette().active())); if(APPEARANCE_STRIPED==opts.menuBgndAppearance) { painter.drawTiledPixmap(ceData.rect, *createStripePixmap(col, false)); } + else if(APPEARANCE_FILE==opts.menuBgndAppearance) + { + painter.fillRect(widget->rect(), col); + painter.drawTiledPixmap(widget->rect(), opts.menuBgndPixmap.img); + } else { drawBevelGradientReal(col, &painter, ceData.rect, GT_HORIZ==opts.menuBgndGrad, false, @@ -2324,7 +2367,8 @@ bool QtCurveStyle::objectEventHandler( const TQStyleControlElementData &ceData, default: break; } - + if(TQEvent::PaletteChange==event->type() && (::tqqt_cast(object) || ::tqqt_cast(object))) + setBgndProp(static_cast(object), opts.bgndAppearance); #ifdef TQTC_ENABLE_PARENTLESS_DIALOG_FIX_SUPPORT if(opts.fixParentlessDialogs && ::tqqt_cast(object)) { @@ -2688,7 +2732,7 @@ void QtCurveStyle::drawLightBevel(const TQColor &bgnd, TQPainter *p, const TQRec } if(doEtch || glowFocus) { - if( (!sunken || sunkenToggleMo) && + if( (!sunken || sunkenToggleMo) && !(opts.thin&THIN_FRAMES) && ((WIDGET_OTHER!=w && WIDGET_SLIDER_TROUGH!=w && MO_GLOW==opts.coloredMouseOver && flags&Style_MouseOver) || glowFocus || (WIDGET_DEF_BUTTON==w && IND_GLOW==opts.defBtnIndicator)/* || @@ -2797,40 +2841,41 @@ void QtCurveStyle::drawBorder(const TQColor &bgnd, TQPainter *p, const TQRect &r if(WIDGET_TAB_BOT==w || WIDGET_TAB_TOP==w) cols=itsBackgroundCols; - switch(borderProfile) - { - case BORDER_FLAT: - break; - case BORDER_RAISED: - case BORDER_SUNKEN: - case BORDER_LIGHT: - if(flags&Style_Enabled && (hasMouseOver || hasFocus) && (WIDGET_ENTRY==w || WIDGET_SCROLLVIEW==w || WIDGET_COMBO==w || WIDGET_SPIN==w)) - p->setPen(midColorF(cg.background(), cols[BORDER_RAISED==borderProfile || BORDER_LIGHT==borderProfile - ? 0 : FRAME_DARK_SHADOW], 1.5-ENTRY_INNER_ALPHA)); - else - p->setPen(flags&Style_Enabled && (BORDER_RAISED==borderProfile || BORDER_LIGHT==borderProfile || APPEARANCE_FLAT!=app) - ? blendBorderColors - ? midColor(cg.background(), cols[BORDER_RAISED==borderProfile - ? 0 : FRAME_DARK_SHADOW]) // Was base??? - : cols[BORDER_RAISED==borderProfile || BORDER_LIGHT==borderProfile ? 0 : FRAME_DARK_SHADOW] - : cg.background()); - p->drawLine(r.x()+1, r.y()+1, r.x()+1, r.y()+r.height()-2); - p->drawLine(r.x()+1, r.y()+1, r.x()+r.width()-2, r.y()+1); - if(!hasFocus && !hasMouseOver && BORDER_LIGHT!=borderProfile) - p->setPen(WIDGET_SCROLLVIEW==w - ? cg.background() - : WIDGET_ENTRY==w - ? cg.base() - : flags&Style_Enabled && (BORDER_SUNKEN==borderProfile || APPEARANCE_FLAT!=app || - WIDGET_TAB_TOP==w || WIDGET_TAB_BOT==w) - ? blendBorderColors - ? midColor(cg.background(), cols[BORDER_RAISED==borderProfile - ? FRAME_DARK_SHADOW : 0]) // Was base??? - : cols[BORDER_RAISED==borderProfile ? FRAME_DARK_SHADOW : 0] - : cg.background()); - p->drawLine(r.x()+r.width()-2, r.y()+1, r.x()+r.width()-2, r.y()+r.height()-2); - p->drawLine(r.x()+1, r.y()+r.height()-2, r.x()+r.width()-2, r.y()+r.height()-2); - } + if(!(opts.thin&THIN_FRAMES)) + switch(borderProfile) + { + case BORDER_FLAT: + break; + case BORDER_RAISED: + case BORDER_SUNKEN: + case BORDER_LIGHT: + if(flags&Style_Enabled && (hasMouseOver || hasFocus) && (WIDGET_ENTRY==w || WIDGET_SCROLLVIEW==w || WIDGET_COMBO==w || WIDGET_SPIN==w)) + p->setPen(midColorF(cg.background(), cols[BORDER_RAISED==borderProfile || BORDER_LIGHT==borderProfile + ? 0 : FRAME_DARK_SHADOW], 1.5-ENTRY_INNER_ALPHA)); + else + p->setPen(flags&Style_Enabled && (BORDER_RAISED==borderProfile || BORDER_LIGHT==borderProfile || APPEARANCE_FLAT!=app) + ? blendBorderColors + ? midColor(cg.background(), cols[BORDER_RAISED==borderProfile + ? 0 : FRAME_DARK_SHADOW]) // Was base??? + : cols[BORDER_RAISED==borderProfile || BORDER_LIGHT==borderProfile ? 0 : FRAME_DARK_SHADOW] + : cg.background()); + p->drawLine(r.x()+1, r.y()+1, r.x()+1, r.y()+r.height()-2); + p->drawLine(r.x()+1, r.y()+1, r.x()+r.width()-2, r.y()+1); + if(!hasFocus && !hasMouseOver && BORDER_LIGHT!=borderProfile) + p->setPen(WIDGET_SCROLLVIEW==w + ? cg.background() + : WIDGET_ENTRY==w + ? cg.base() + : flags&Style_Enabled && (BORDER_SUNKEN==borderProfile || APPEARANCE_FLAT!=app || + WIDGET_TAB_TOP==w || WIDGET_TAB_BOT==w) + ? blendBorderColors + ? midColor(cg.background(), cols[BORDER_RAISED==borderProfile + ? FRAME_DARK_SHADOW : 0]) // Was base??? + : cols[BORDER_RAISED==borderProfile ? FRAME_DARK_SHADOW : 0] + : cg.background()); + p->drawLine(r.x()+r.width()-2, r.y()+1, r.x()+r.width()-2, r.y()+r.height()-2); + p->drawLine(r.x()+1, r.y()+r.height()-2, r.x()+r.width()-2, r.y()+r.height()-2); + } if(ROUNDED && ROUNDED_NONE!=round) { @@ -3940,26 +3985,33 @@ void QtCurveStyle::drawPrimitive(TQ_PrimitiveElement pe, TQPainter *p, const TQS } case PE_PanelPopup: { - const TQColor *use(backgroundColors(cg)); + const TQColor *use(popupMenuCols(cg)); + EGradientBorder border=getGradient(opts.menuBgndAppearance, &opts)->border; p->setPen(use[STD_BORDER]); p->setBrush(NoBrush); p->drawRect(r); - if(!IS_FLAT_BGND(opts.menuBgndAppearance)) - ; - else if(USE_LIGHTER_POPUP_MENU) + + if(USE_BORDER(border) && APPEARANCE_FLAT!=opts.menuBgndAppearance) { - p->setPen(/*USE_LIGHTER_POPUP_MENU ? */itsLighterPopupMenuBgndCol/* : cg.background()*/); - p->drawRect(TQRect(r.x()+1, r.y()+1, r.width()-2, r.height()-2)); + p->setPen(use[0]); + if(GB_LIGHT==border) + p->drawRect(TQRect(r.x()+1, r.y()+1, r.width()-2, r.height()-2)); + else + { + if(GB_3D==border) + p->setPen(popupMenuCol(cg)); + p->drawLine(r.x()+1, r.y()+1, r.x()+r.width()-2, r.y()+1); + p->drawLine(r.x()+1, r.y()+1, r.x()+1, r.y()+r.height()-2); + p->setPen(use[FRAME_DARK_SHADOW]); + p->drawLine(r.x()+1, r.y()+r.height()-2, r.x()+r.width()-2, r.y()+r.height()-2); + p->drawLine(r.x()+r.width()-2, r.y()+1, r.x()+r.width()-2, r.y()+r.height()-2); + } } - else + else if(IS_FLAT_BGND(opts.menuBgndAppearance)) { - p->setPen(use[0]); - p->drawLine(r.x()+1, r.y()+1, r.x()+r.width()-2, r.y()+1); - p->drawLine(r.x()+1, r.y()+1, r.x()+1, r.y()+r.height()-2); - p->setPen(use[FRAME_DARK_SHADOW]); - p->drawLine(r.x()+1, r.y()+r.height()-2, r.x()+r.width()-2, r.y()+r.height()-2); - p->drawLine(r.x()+r.width()-2, r.y()+1, r.x()+r.width()-2, r.y()+r.height()-2); + p->setPen(/*USE_LIGHTER_POPUP_MENU ? */popupMenuCol(cg)/* : cg.background()*/); + p->drawRect(TQRect(r.x()+1, r.y()+1, r.width()-2, r.height()-2)); } break; } @@ -4253,7 +4305,7 @@ void QtCurveStyle::drawPrimitive(TQ_PrimitiveElement pe, TQPainter *p, const TQS (dynamic_cast(widget) || dynamic_cast(widget))) return; - if(FOCUS_LINE==opts.focus) + if(FOCUS_LINE==opts.focus || FOCUS_GLOW==opts.focus) { p->setPen(view && flags&Style_Selected ? cg.highlightedText() @@ -4492,7 +4544,7 @@ void QtCurveStyle::drawTDEStylePrimitive(TDEStylePrimitive kpe, TQPainter *p, co { case KPE_ToolBarHandle: { - if(APPEARANCE_STRIPED!=opts.bgndAppearance) + if(APPEARANCE_STRIPED!=opts.bgndAppearance && APPEARANCE_FILE!=opts.bgndAppearance) { TQRect r2(r); r2.addCoords(-1, -1, 2, 2); @@ -4584,7 +4636,7 @@ void QtCurveStyle::drawTDEStylePrimitive(TDEStylePrimitive kpe, TQPainter *p, co { TQRect ar(r.x()+((r.width()-(LV_SIZE+4))>>1), r.y()+((r.height()-(LV_SIZE+4))>>1), LV_SIZE+4, LV_SIZE+4); - +#if 0 if(LV_OLD==opts.lvLines) { int lo(ROUNDED ? 2 : 0); @@ -4611,7 +4663,7 @@ void QtCurveStyle::drawTDEStylePrimitive(TDEStylePrimitive kpe, TQPainter *p, co ar.y()+ar.height()-2); } } - +#endif ::drawArrow(p, ar, flags&Style_Enabled ? cg.mid() : cg.text(), flags&Style_On // Collapsed = On ? TQApplication::reverseLayout() ? PE_ArrowLeft @@ -4664,7 +4716,9 @@ void QtCurveStyle::drawControl(ControlElement control, TQPainter *p, const TQSty itsHover(itsHoverTab && itsHoverTab->isEnabled() && data.tab()==itsHoverTab && !(flags&Style_Selected) && ceData.tabBarData.currentTabIndex!=tabIndex), - glowMo(!active && itsHover && opts.coloredMouseOver && TAB_MO_GLOW==opts.tabMouseOver); + glowMo(!active && itsHover && opts.coloredMouseOver && TAB_MO_GLOW==opts.tabMouseOver), + thin(opts.thin&THIN_FRAMES), + drawOuterGlow(glowMo && !thin); int sizeAdjust(!active && TAB_MO_GLOW==opts.tabMouseOver ? 1 : 0); const TQColor &fill(getTabFill(flags&Style_Selected, itsHover, itsBackgroundCols)); EBorder borderProfile(active || opts.borderInactiveTab @@ -4746,7 +4800,7 @@ void QtCurveStyle::drawControl(ControlElement control, TQPainter *p, const TQSty ? (top ? ROUNDED_TOPRIGHT : ROUNDED_BOTTOMRIGHT) : ROUNDED_NONE, glowMo ? itsMouseOverCols : 0L, top ? WIDGET_TAB_TOP : WIDGET_TAB_BOT, true, borderProfile, false); - if(glowMo) + if(drawOuterGlow) { glowTr.addCoords(-1, -1, 1, 1); drawGlow(p, glowTr, cg, top ? WIDGET_TAB_TOP : WIDGET_TAB_BOT); @@ -4760,16 +4814,22 @@ void QtCurveStyle::drawControl(ControlElement control, TQPainter *p, const TQSty p->setPen(itsBackgroundCols[STD_BORDER]); p->drawPoint(r.x(), r.y()+r.height()-2); p->drawPoint(r.x()+r.width()-1, r.y()+r.height()-2); - p->setPen(itsBackgroundCols[0]); - p->drawLine(r.x()+1, r.y()+r.height()-3, r.x()+1, r.y()+r.height()-1); - //p->drawPoint(r.x()+r.width()-2, r.y()+r.height()-1); - p->setPen(itsBackgroundCols[opts.borderTab ? 0 : FRAME_DARK_SHADOW]); - p->drawPoint(r.x()+r.width()-2, r.y()+r.height()-2); + if(!thin) + { + p->setPen(itsBackgroundCols[0]); + p->drawLine(r.x()+1, r.y()+r.height()-3, r.x()+1, r.y()+r.height()-1); + //p->drawPoint(r.x()+r.width()-2, r.y()+r.height()-1); + p->setPen(itsBackgroundCols[opts.borderTab ? 0 : FRAME_DARK_SHADOW]); + p->drawPoint(r.x()+r.width()-2, r.y()+r.height()-2); + } } else { - p->setPen(itsBackgroundCols[0]); - p->drawLine(r.x(), r.y()+r.height()-1, r.x()+r.width()-1, r.y()+r.height()-1); + if(!thin) + { + p->setPen(itsBackgroundCols[0]); + p->drawLine(r.x(), r.y()+r.height()-1, r.x()+r.width()-1, r.y()+r.height()-1); + } p->setPen(itsBackgroundCols[STD_BORDER]); p->drawLine(r.x(), r.y()+r.height()-2, r.x()+r.width()-1, r.y()+r.height()-2); @@ -4788,7 +4848,7 @@ void QtCurveStyle::drawControl(ControlElement control, TQPainter *p, const TQSty p->setPen(itsBackgroundCols[!active && TAB_MO_GLOW==opts.tabMouseOver && opts.round>ROUND_SLIGHT && !(opts.square&SQUARE_TAB_FRAME) ? ORIGINAL_SHADE : STD_BORDER]); p->drawLine(x, r.y()+r.height()-1, x, r.height()-2); - if(active) + if(active && !thin) { p->setPen(itsBackgroundCols[reverse ? dark : 0]); p->drawLine(x2, r.y()+r.height()-1, x2, r.y()+r.height()-2); @@ -4827,16 +4887,22 @@ void QtCurveStyle::drawControl(ControlElement control, TQPainter *p, const TQSty p->setPen(itsBackgroundCols[STD_BORDER]); p->drawPoint(r.x(), r.y()+1); p->drawPoint(r.x()+r.width()-1, r.y()+1); - p->setPen(itsBackgroundCols[0]); - p->drawLine(r.x()+1, r.y()+2, r.x()+1, r.y()); - p->setPen(itsBackgroundCols[opts.borderTab ? 0 : FRAME_DARK_SHADOW]); - p->drawLine(r.x()+r.width()-2, r.y()+1, r.x()+r.width()-2, r.y()); - p->drawPoint(r.x()+r.width()-1, r.y()); + if(!thin) + { + p->setPen(itsBackgroundCols[0]); + p->drawLine(r.x()+1, r.y()+2, r.x()+1, r.y()); + p->setPen(itsBackgroundCols[opts.borderTab ? 0 : FRAME_DARK_SHADOW]); + p->drawLine(r.x()+r.width()-2, r.y()+1, r.x()+r.width()-2, r.y()); + p->drawPoint(r.x()+r.width()-1, r.y()); + } } else { - p->setPen(itsBackgroundCols[opts.borderTab ? 0 : dark]); - p->drawLine(r.x(), r.y(), r.x()+r.width()-1, r.y()); + if(!thin) + { + p->setPen(itsBackgroundCols[opts.borderTab ? 0 : dark]); + p->drawLine(r.x(), r.y(), r.x()+r.width()-1, r.y()); + } p->setPen(itsBackgroundCols[STD_BORDER]); p->drawLine(r.x(), r.y()+1, r.x()+r.width()-1, r.y()+1); @@ -5059,6 +5125,7 @@ void QtCurveStyle::drawControl(ControlElement control, TQPainter *p, const TQSty if(data.isDefault()) break; + //const TQPopupMenu *popupmenu((const QPopupMenu *)widget); TQMenuItem *mi(data.menuItem()); int tab(data.tabWidth()), maxpmw(data.maxIconWidth()), @@ -5073,20 +5140,17 @@ void QtCurveStyle::drawControl(ControlElement control, TQPainter *p, const TQSty else { if(IS_FLAT_BGND(opts.menuBgndAppearance)) - p->fillRect(r, USE_LIGHTER_POPUP_MENU ? itsLighterPopupMenuBgndCol - : itsBackgroundCols[ORIGINAL_SHADE]); + p->fillRect(r, popupMenuCol(cg)); if(opts.menuStripe) - drawBevelGradient(menuStripeCol(), p, + drawBevelGradient(menuStripeCol(cg), p, TQRect(reverse ? r.right()-maxpmw : r.x(), r.y(), maxpmw, r.height()), false, false, opts.menuStripeAppearance, WIDGET_OTHER); } if((flags&Style_Active) && (flags&Style_Enabled)) - drawMenuItem(p, r, flags, cg, false, ROUNDED_ALL, - USE_LIGHTER_POPUP_MENU ? itsLighterPopupMenuBgndCol - : itsBackgroundCols[ORIGINAL_SHADE], + drawMenuItem(p, r, flags, cg, false, ROUNDED_ALL, popupMenuCol(cg), opts.useHighlightForMenu ? itsHighlightCols : itsBackgroundCols); if(!mi) @@ -5095,7 +5159,7 @@ void QtCurveStyle::drawControl(ControlElement control, TQPainter *p, const TQSty if(mi->isSeparator()) { y=r.y()+(r.height()>>1); - p->setPen(itsBackgroundCols[MENU_SEP_SHADE]); + p->setPen(popupMenuCols(cg)[MENU_SEP_SHADE]); p->drawLine(r.x()+3+(!reverse && opts.menuStripe ? maxpmw : 0), y, r.x()+r.width()-4-(reverse && opts.menuStripe ? maxpmw : 0), y); // p->setPen(itsBackgroundCols[0]); @@ -5671,11 +5735,29 @@ void QtCurveStyle::drawComplexControl(ComplexControl control, TQPainter *p, cons break; bflags|=DW_CLOSE_BUTTON; } - + if (!tb && !onExtender && (elementFlags & CEF_HasParentWidget) && !qstrcmp(ceData.parentWidgetData.name.ascii(), "qt_maxcontrols")) onControlButtons = true; + int round(ROUNDED_ALL), leftAdjust(0), topAdjust(0), rightAdjust(0), bottomAdjust(0); + bool horizTBar(true), + raised(!onControlButtons && (TBTN_RAISED==opts.tbarBtns || TBTN_JOINED==opts.tbarBtns)); + + if(raised) + { + if(tb) + { + if(TBTN_JOINED==opts.tbarBtns) + { + horizTBar=Qt::Horizontal==tb->orientation(); + adjustToolbarButtons(widget, tb, leftAdjust, topAdjust, rightAdjust, bottomAdjust, round); + } + } + else + raised=false; + } + if(active & SC_ToolButton) bflags |=Style_Down; if(active & SC_ToolButtonMenu) @@ -5692,10 +5774,9 @@ void QtCurveStyle::drawComplexControl(ComplexControl control, TQPainter *p, cons // If we're pressed, on, or raised... #if defined TQTC_TQT_ONLY || !defined TDE_VERSION - if(bflags &(Style_Down | Style_On | Style_Raised) || onControlButtons) + if(bflags &(Style_Down | Style_On | Style_Raised) || onControlButtons || raised) #else - if(bflags &(Style_Down | Style_On | Style_Raised | Style_MouseOver) || - onControlButtons) + if(bflags &(Style_Down | Style_On | Style_Raised | Style_MouseOver) || onControlButtons || raised) #endif { //Make sure the standalone toolbuttons have a gradient in the right direction @@ -5711,10 +5792,35 @@ void QtCurveStyle::drawComplexControl(ComplexControl control, TQPainter *p, cons } } + if(raised && TBTN_JOINED==opts.tbarBtns && !horizTBar) + bflags &= ~Style_Horizontal; + if(elementFlags & CEF_BiState) bflags|=TOGGLE_BUTTON; - drawPrimitive(PE_ButtonTool, p, ceData, elementFlags, button, cg, bflags, data); + const TQColor *use(buttonColors(cg)); + + TQRect btnRect(r); + + btnRect.addCoords(leftAdjust, topAdjust, rightAdjust, bottomAdjust); + drawLightBevel(cg.background(), p, btnRect, cg, bflags, round, getFill(bflags, use), use, true, true, WIDGET_STD_BUTTON); + + if(raised && TBTN_JOINED==opts.tbarBtns) + { + const int constSpace=opts.fadeLines ? 7 : 4; + + p->setPen(use[0]); + if(leftAdjust) + p->drawLine(r.x(), r.y()+constSpace, r.x(), r.height()-(constSpace+1)); + if(topAdjust) + p->drawLine(r.x()+constSpace, r.y(), r.width()-(constSpace+1), r.y()); + p->setPen(use[STD_BORDER]); + if(rightAdjust) + p->drawLine(r.x()+r.width()-1, r.y()+constSpace, r.x()+r.width()-1, r.height()-(constSpace+1)); + if(bottomAdjust) + p->drawLine(r.x()+constSpace, r.y()+r.height()-1, r.width()-(constSpace+1), r.y()+r.height()-1); + } + //drawPrimitive(PE_ButtonTool, p, button, cg, bflags, data); } // Check whether to draw a background pixmap @@ -5960,7 +6066,7 @@ void QtCurveStyle::drawComplexControl(ComplexControl control, TQPainter *p, cons { bool glowFocus(USE_GLOW_FOCUS(flags&Style_MouseOver) && flags&Style_HasFocus && flags&Style_Enabled); - if(!sunken && !editable && + if(!sunken && !editable && !(opts.thin&THIN_FRAMES) && ((MO_GLOW==opts.coloredMouseOver && flags&Style_MouseOver)/* || (FOCUS_FULL==opts.focus && flags&Style_HasFocus)*/ || glowFocus)) drawGlow(p, widget ? TQT_TQRECT_OBJECT(ceData.rect) : r, cg, WIDGET_COMBO, glowFocus ? itsFocusCols : NULL); @@ -5977,6 +6083,7 @@ void QtCurveStyle::drawComplexControl(ComplexControl control, TQPainter *p, cons { itsFormMode = isFormWidget(widget); + //const TQSpinWidget *spinwidget((const QSpinWidget *)widget); TQRect frame(querySubControlMetrics(CC_SpinWidget, ceData, elementFlags, SC_SpinWidgetFrame, data, widget)), up(ceData.spinWidgetData.upRect), @@ -6913,22 +7020,21 @@ TQSize QtCurveStyle::sizeFromContents(ContentsType contents, const TQStyleContro w=constMinW; } - return TQSize(w, contentsSize.height() + margin+(DO_EFFECT && !isFormWidget(widget) && !opts.thinnerBtns - ? 6 : 4)); + return TQSize(w, contentsSize.height() + margin+(DO_EFFECT && !isFormWidget(widget) && !(opts.thin&THIN_BUTTONS) ? 6 : 4)); } break; } case CT_ComboBox: { TQSize sz(BASE_STYLE::sizeFromContents(contents, ceData, elementFlags, contentsSize, data, widget)); - return TQSize(sz.width(), sz.height()+(DO_EFFECT && !isFormWidget(widget) && !opts.thinnerBtns ? 4 : 2)); + return TQSize(sz.width(), sz.height()+(DO_EFFECT && !isFormWidget(widget) && !(opts.thin&THIN_BUTTONS) ? 4 : 2)); } case CT_PopupMenuItem: { if (!widget || data.isDefault()) break; - const int constMinH(opts.thinnerMenuItems ? 25 : 27); + const int constMinH((opts.thin&THIN_MENU_ITEMS) ? 25 : 27); TQMenuItem *mi(data.menuItem()); int maxpmw(data.maxIconWidth()), @@ -6960,7 +7066,7 @@ TQSize QtCurveStyle::sizeFromContents(ContentsType contents, const TQStyleContro h = TQMAX(h, TQFontMetrics(ceData.font).height() + 2); if (mi->iconSet()!= 0) h = TQMAX(h, mi->iconSet()->pixmap(TQIconSet::Small, TQIconSet::Normal).height()); - h+=(opts.thinnerMenuItems ? 2 : 4); + h+=((opts.thin&THIN_MENU_ITEMS) ? 2 : 4); } // check | 4 pixels | item | 8 pixels | accel | 4 pixels | check @@ -7185,12 +7291,11 @@ void QtCurveStyle::drawMenuItem(TQPainter *p, const TQRect &r, int flags, const if(ROUNDED) { main.addCoords(-1, -1, 1, 1); - drawBorder(USE_LIGHTER_POPUP_MENU ? itsLighterPopupMenuBgndCol : itsBackgroundCols[ORIGINAL_SHADE], p, main, - cg, Style_Horizontal|Style_Raised, reverse ? ROUNDED_RIGHT : ROUNDED_LEFT, + drawBorder(popupMenuCol(cg), p, main, cg, Style_Horizontal|Style_Raised, reverse ? ROUNDED_RIGHT : ROUNDED_LEFT, cols, WIDGET_MENU_ITEM, false, BORDER_FLAT, false, fill); } - TQColor bgnd(USE_LIGHTER_POPUP_MENU ? itsLighterPopupMenuBgndCol : itsBackgroundCols[ORIGINAL_SHADE]); + TQColor bgnd(popupMenuCol(cg)); drawGradient(reverse ? bgnd : cols[fill], reverse ? cols[fill] : bgnd, p, fade, false); } else if(mbi || opts.borderMenuitems) @@ -7789,7 +7894,8 @@ void QtCurveStyle::drawSliderGroove(TQPainter *p, const TQRect &r, const TQColor void QtCurveStyle::drawMenuOrToolBarBackground(TQPainter *p, const TQRect &r, const TQColorGroup &cg, bool menu, bool horiz) const { - if(menu && APPEARANCE_STRIPED==opts.bgndAppearance && IS_FLAT(opts.menubarAppearance) && SHADE_NONE==opts.shadeMenubars) + if(menu && (APPEARANCE_STRIPED==opts.bgndAppearance || APPEARANCE_FILE==opts.bgndAppearance) && + IS_FLAT(opts.menubarAppearance) && SHADE_NONE==opts.shadeMenubars) return; TQRect rx(r); @@ -7893,6 +7999,20 @@ const TQColor * QtCurveStyle::buttonColors(const TQColorGroup &cg) const return itsButtonCols; } +const TQColor * QtCurveStyle::popupMenuCols(const TQColorGroup &cg) const +{ + return opts.shadePopupMenu ? menuColors(cg, true) : backgroundColors(cg); +} + +const TQColor & QtCurveStyle::popupMenuCol(const TQColorGroup &cg, int shade) const +{ + return opts.shadePopupMenu + ? menuColors(cg, true)[ORIGINAL_SHADE] + : USE_LIGHTER_POPUP_MENU + ? itsLighterPopupMenuBgndCol + : itsBackgroundCols[shade]; +} + const TQColor * QtCurveStyle::checkRadioColors(const TQColorGroup &cg, SFlags flags) const { return opts.crColor && flags&Style_Enabled && (flags&Style_On || !(flags&Style_Off)) @@ -7972,6 +8092,58 @@ void QtCurveStyle::setMenuColors(const TQColorGroup &cg) } } +void QtCurveStyle::setMenuTextColors(TQWidget *widget, bool isMenuBar) const +{ + if(SHADE_WINDOW_BORDER==opts.shadeMenubars) + { + TQPalette pal(widget->palette()); + + getMdiColors(pal.active(), false); + + pal.setBrush(TQPalette::Active, TQColorGroup::Foreground, itsActiveMdiTextColor); + pal.setBrush(TQPalette::Active, TQColorGroup::Text, pal.brush(TQPalette::Active, TQColorGroup::Foreground)); + if(isMenuBar) + { + pal.setBrush(TQPalette::Inactive, TQColorGroup::Foreground, + opts.shadeMenubarOnlyWhenActive ? itsMdiTextColor : itsActiveMdiTextColor); + pal.setBrush(TQPalette::Inactive, TQColorGroup::Text, pal.brush(TQPalette::Inactive, TQColorGroup::Foreground)); + } + else if(opts.shadePopupMenu) + { + pal.setBrush(TQPalette::Disabled, TQColorGroup::Foreground, midColor(itsActiveMdiTextColor, popupMenuCol(pal.active()))); + pal.setBrush(TQPalette::Disabled, TQColorGroup::Text, pal.brush(TQPalette::Disabled, TQColorGroup::Foreground)); + } + + widget->setPalette(pal); + } + else if(opts.customMenuTextColor || SHADE_BLEND_SELECTED==opts.shadeMenubars || + SHADE_SELECTED==opts.shadeMenubars || + (SHADE_CUSTOM==opts.shadeMenubars && TOO_DARK(itsMenubarCols[ORIGINAL_SHADE]))) + { + TQPalette pal(widget->palette()); + + pal.setBrush(TQPalette::Active, TQColorGroup::Foreground, opts.customMenuTextColor + ? opts.customMenuNormTextColor + : pal.active().highlightedText()); + pal.setBrush(TQPalette::Active, TQColorGroup::Text, pal.brush(TQPalette::Active, TQColorGroup::Foreground)); + + if(isMenuBar && !opts.shadeMenubarOnlyWhenActive) + { + pal.setBrush(TQPalette::Inactive, TQColorGroup::Foreground, opts.customMenuTextColor + ? opts.customMenuNormTextColor + : pal.active().highlightedText()); + pal.setBrush(TQPalette::Inactive, TQColorGroup::Text, pal.brush(TQPalette::Inactive, TQColorGroup::Foreground)); + } + else if(!isMenuBar && opts.shadePopupMenu) + { + pal.setBrush(TQPalette::Disabled, TQColorGroup::Foreground, + midColor(pal.brush(TQPalette::Active, TQColorGroup::Foreground).color(), popupMenuCol(pal.active()))); + pal.setBrush(TQPalette::Disabled, TQColorGroup::Text, pal.brush(TQPalette::Disabled, TQColorGroup::Foreground)); + } + widget->setPalette(pal); + } +} + const TQColor * QtCurveStyle::menuColors(const TQColorGroup &cg, bool active) const { return SHADE_WINDOW_BORDER==opts.shadeMenubars @@ -8106,8 +8278,8 @@ const TQColor * QtCurveStyle::getMdiColors(const TQColorGroup &cg, bool active) } } - if(itsMdiColors && opts.shadeMenubarOnlyWhenActive && SHADE_WINDOW_BORDER==opts.shadeMenubars && - itsActiveMdiColors[ORIGINAL_SHADE]==itsMdiColors[ORIGINAL_SHADE]) + if(opts.shadeMenubarOnlyWhenActive && SHADE_WINDOW_BORDER==opts.shadeMenubars && + itsActiveMdiColors && itsMdiColors && itsActiveMdiColors[ORIGINAL_SHADE]==itsMdiColors[ORIGINAL_SHADE]) opts.shadeMenubarOnlyWhenActive=false; if(!itsActiveMdiColors) { @@ -8431,7 +8603,7 @@ const TQColor & QtCurveStyle::getTabFill(bool current, bool highlight, const TQC : use[2]; } -const TQColor & QtCurveStyle::menuStripeCol() const +const TQColor & QtCurveStyle::menuStripeCol(const TQColorGroup &cg) const { switch(opts.menuStripe) { @@ -8443,17 +8615,12 @@ const TQColor & QtCurveStyle::menuStripeCol() const case SHADE_BLEND_SELECTED: // Hack! Use opts.customMenuStripeColor to store this setting! if(IS_BLACK(opts.customMenuStripeColor)) - opts.customMenuStripeColor=midColor(itsHighlightCols[ORIGINAL_SHADE], - opts.lighterPopupMenuBgnd<0 - ? itsLighterPopupMenuBgndCol - : itsBackgroundCols[ORIGINAL_SHADE]); + opts.customMenuStripeColor=midColor(itsHighlightCols[ORIGINAL_SHADE], popupMenuCol(cg)); return opts.customMenuStripeColor; case SHADE_SELECTED: return itsHighlightCols[MENU_STRIPE_SHADE]; case SHADE_DARKEN: - return USE_LIGHTER_POPUP_MENU - ? itsLighterPopupMenuBgndCol - : itsBackgroundCols[MENU_STRIPE_SHADE]; + return popupMenuCol(cg); } } diff --git a/style/qtcurve.h b/style/qtcurve.h index a060102..5bd78ca 100644 --- a/style/qtcurve.h +++ b/style/qtcurve.h @@ -217,6 +217,8 @@ class QtCurveStyle : public BASE_STYLE void shadeColors(const TQColor &base, TQColor *vals) const; const TQColor * buttonColors(const TQColorGroup &cg) const; + const TQColor * popupMenuCols(const TQColorGroup &cg) const; + const TQColor & popupMenuCol(const TQColorGroup &cg, int shade=ORIGINAL_SHADE) const; const TQColor * checkRadioColors(const TQColorGroup &cg, SFlags flags) const; const TQColor * sliderColors(/*const TQColorGroup &cg, */SFlags flags) const; const TQColor * backgroundColors(const TQColor &c) const; @@ -225,6 +227,7 @@ class QtCurveStyle : public BASE_STYLE const TQColor * borderColors(SFlags flags, const TQColor *use) const; const TQColor * getSidebarButtons() const; void setMenuColors(const TQColorGroup &cg); + void setMenuTextColors(TQWidget *widget, bool isMenuBar) const; const TQColor * menuColors(const TQColorGroup &cg, bool active) const; void setDecorationColors(bool init=false); const TQColor * getMdiColors(const TQColorGroup &cg, bool active) const; @@ -235,7 +238,7 @@ class QtCurveStyle : public BASE_STYLE const TQColor & getFill(SFlags flags, const TQColor *use, bool cr=false, bool darker=false) const; const TQColor & getListViewFill(SFlags flags, const TQColor *use) const; const TQColor & getTabFill(bool current, bool highlight, const TQColor *use) const; - const TQColor & menuStripeCol() const; + const TQColor & menuStripeCol(const TQColorGroup &cg) const; const TQColor & checkRadioCol(SFlags flags, const TQColorGroup &cg) const; TQColor shade(const TQColor &a, float k) const; void shade(const color &ca, color *cb, double k) const;