Fix a long-standing conflict between QtCurve's Gradient class and Libreoffice's Gradient class

This largely resolves Bug 1489
pull/1/head
Timothy Pearson 10 years ago
parent b91b9e500b
commit 0ea8899390

@ -29,10 +29,45 @@
#include <math.h> #include <math.h>
#include "config.h" #include "config.h"
#if defined _WIN32 && (0x039999 >= 0x040000) // #define QT4_OR_ABOVE 1
#if defined _WIN32 && defined QT4_OR_ABOVE
#include <sys/stat.h> #include <sys/stat.h>
#include <float.h> #include <float.h>
#include <direct.h> #include <direct.h>
#endif
#ifdef __cplusplus
#include <tqconfig.h>
#ifdef CONFIG_DIALOG
#include <tqapplication.h>
#endif
#include <map>
#include <set>
#if !defined CONFIG_DIALOG && defined QT4_OR_ABOVE
#include <TQtCore/TQString>
#endif
#else
#include <glib.h>
#endif
#ifdef __cplusplus
#include <tqpixmap.h>
#if defined QT4_OR_ABOVE
#include <TQtCore/TQSet>
#include <tqstyle.h>
#endif
#endif
#if defined QT4_OR_ABOVE && !defined TQTC_TQT_ONLY
#include <KDE/KColorUtils>
#endif
#ifdef __cplusplus
namespace TDEQtCurveStyle {
#endif
#if defined _WIN32 && defined QT4_OR_ABOVE
static int isnan(double x) static int isnan(double x)
{ {
@ -66,25 +101,9 @@ typedef enum
} EShading; } EShading;
#ifdef __cplusplus #ifdef __cplusplus
#include <tqconfig.h>
#ifdef CONFIG_DIALOG
#include <tqapplication.h>
#endif
#include <map>
#include <set>
#if !defined CONFIG_DIALOG && (0x039999 >= 0x040000)
#include <TQtCore/TQString>
#endif
#else
#include <glib.h>
#endif
#ifdef __cplusplus
#include <tqpixmap.h>
typedef TQColor color; typedef TQColor color;
#if (0x039999 >= 0x040000) #if defined QT4_OR_ABOVE
#include <TQtCore/TQSet>
typedef TQSet<TQString> Strings; typedef TQSet<TQString> Strings;
#else #else
typedef TQStringList Strings; typedef TQStringList Strings;
@ -372,19 +391,19 @@ enum
#define FULLLY_ROUNDED (opts.round>=ROUND_FULL) #define FULLLY_ROUNDED (opts.round>=ROUND_FULL)
#define DO_EFFECT (EFFECT_NONE!=opts.buttonEffect) #define DO_EFFECT (EFFECT_NONE!=opts.buttonEffect)
#if !defined __cplusplus || ( (0x039999 >= 0x040000)) #if !defined __cplusplus || ( defined QT4_OR_ABOVE)
#define SLIDER_GLOW (DO_EFFECT && MO_GLOW==opts.coloredMouseOver /*&& SLIDER_TRIANGULAR!=opts.sliderStyle*/ ? 2 : 0) #define SLIDER_GLOW (DO_EFFECT && MO_GLOW==opts.coloredMouseOver /*&& SLIDER_TRIANGULAR!=opts.sliderStyle*/ ? 2 : 0)
#endif #endif
#define ENTRY_MO (opts.unifyCombo && opts.unifySpin) #define ENTRY_MO (opts.unifyCombo && opts.unifySpin)
#if !defined __cplusplus || ( (0x039999 >= 0x040000)) #if !defined __cplusplus || ( defined QT4_OR_ABOVE)
#define FOCUS_ALPHA 0.08 #define FOCUS_ALPHA 0.08
#define FOCUS_GLOW_LINE_ALPHA 0.5 #define FOCUS_GLOW_LINE_ALPHA 0.5
#define BORDER_BLEND_ALPHA 0.7 #define BORDER_BLEND_ALPHA 0.7
#define ETCH_TOP_ALPHA 0.055 #define ETCH_TOP_ALPHA 0.055
#define ETCH_BOTTOM_ALPHA 0.1 #define ETCH_BOTTOM_ALPHA 0.1
// #if (0x039999 >= 0x040000) // #if defined QT4_OR_ABOVE
// #define ETCH_RADIO_TOP_ALPHA 0.055 // #define ETCH_RADIO_TOP_ALPHA 0.055
// #define ETCH_RADIO_BOTTOM_ALPHA 0.80 // #define ETCH_RADIO_BOTTOM_ALPHA 0.80
// #else // #else
@ -416,9 +435,7 @@ enum
#endif #endif
#if defined __cplusplus && (0x039999 >= 0x040000) #if defined __cplusplus && defined QT4_OR_ABOVE
#include <tqstyle.h>
typedef enum typedef enum
{ {
TQtC_Round = TQStyle::PM_CustomBase, TQtC_Round = TQStyle::PM_CustomBase,
@ -455,7 +472,7 @@ typedef enum
#define WINDOW_SHADOW_COLOR(A) (EFFECT_SHADOW==(A) ? TQt::black : TQt::white) #define WINDOW_SHADOW_COLOR(A) (EFFECT_SHADOW==(A) ? TQt::black : TQt::white)
#endif #endif
#if defined CONFIG_DIALOG || ( (0x039999 >= 0x040000)) #if defined CONFIG_DIALOG || ( defined QT4_OR_ABOVE)
#define QTCURVE_PREVIEW_CONFIG "QTCURVE_PREVIEW_CONFIG" #define QTCURVE_PREVIEW_CONFIG "QTCURVE_PREVIEW_CONFIG"
#define QTCURVE_PREVIEW_CONFIG_FULL "QTCURVE_PREVIEW_CONFIG_FULL" #define QTCURVE_PREVIEW_CONFIG_FULL "QTCURVE_PREVIEW_CONFIG_FULL"
@ -1069,7 +1086,7 @@ typedef struct
*/ */
#endif #endif
mapKdeIcons, mapKdeIcons,
#if defined CONFIG_DIALOG || ( (0x039999 >= 0x040000)) || !defined __cplusplus #if defined CONFIG_DIALOG || ( defined QT4_OR_ABOVE) || !defined __cplusplus
gtkButtonOrder, gtkButtonOrder,
fadeLines, fadeLines,
#endif #endif
@ -1099,10 +1116,10 @@ typedef struct
borderInactiveTab, borderInactiveTab,
doubleGtkComboArrow, doubleGtkComboArrow,
menuIcons, menuIcons,
#if defined CONFIG_DIALOG || ( (0x039999 >= 0x040000)) #if defined CONFIG_DIALOG || ( defined QT4_OR_ABOVE)
stdBtnSizes, stdBtnSizes,
#endif #endif
#if (0x039999 >= 0x040000) #if defined QT4_OR_ABOVE
xbar, xbar,
#endif #endif
forceAlternateLvCols, forceAlternateLvCols,
@ -1125,10 +1142,10 @@ typedef struct
bgndOpacity, bgndOpacity,
menuBgndOpacity, menuBgndOpacity,
dlgOpacity; dlgOpacity;
#if (0x039999 >= 0x040000) #if defined QT4_OR_ABOVE
int dwtSettings; int dwtSettings;
#endif #endif
#if defined CONFIG_DIALOG || ( (0x039999 >= 0x040000)) #if defined CONFIG_DIALOG || ( defined QT4_OR_ABOVE)
int titlebarButtons; int titlebarButtons;
TBCols titlebarButtonColors; TBCols titlebarButtonColors;
ETitleBarIcon titlebarIcon; ETitleBarIcon titlebarIcon;
@ -1206,7 +1223,7 @@ typedef struct
#endif #endif
TQtCImage bgndImage, TQtCImage bgndImage,
menuBgndImage; menuBgndImage;
#if !defined __cplusplus || ( (0x039999 >= 0x040000)) #if !defined __cplusplus || ( defined QT4_OR_ABOVE)
/* NOTE: If add any more settings here, need to alter copyOpts/freeOpts/defaultSettings in config_file.c */ /* NOTE: If add any more settings here, need to alter copyOpts/freeOpts/defaultSettings in config_file.c */
Strings noBgndGradientApps, Strings noBgndGradientApps,
noBgndOpacityApps, noBgndOpacityApps,
@ -1217,7 +1234,7 @@ typedef struct
Strings noDlgFixApps; Strings noDlgFixApps;
#endif #endif
Strings noMenuStripeApps; Strings noMenuStripeApps;
#if (0x039999 >= 0x040000) #if defined QT4_OR_ABOVE
Strings menubarApps, Strings menubarApps,
statusbarApps, statusbarApps,
useTQtFileDialogApps, useTQtFileDialogApps,
@ -1416,8 +1433,7 @@ inline int limit(double c)
} }
#endif #endif
#if (0x039999 >= 0x040000) && !defined TQTC_TQT_ONLY #if defined QT4_OR_ABOVE && !defined TQTC_TQT_ONLY
#include <KDE/KColorUtils>
#define tint(COLA, COLB, FACTOR) KColorUtils::tint((COLA), (COLB), (FACTOR)) #define tint(COLA, COLB, FACTOR) KColorUtils::tint((COLA), (COLB), (FACTOR))
#define midColor(COLA, COLB) KColorUtils::mix((COLA), (COLB), 0.5) #define midColor(COLA, COLB) KColorUtils::mix((COLA), (COLB), 0.5)
#else #else
@ -1528,7 +1544,7 @@ static void shade(const Options *opts, const color *ca, color *cb, double k)
case SHADING_HCY: case SHADING_HCY:
{ {
#define HCY_FACTOR 0.15 #define HCY_FACTOR 0.15
#if (0x039999 >= 0x040000) && !defined TQTC_TQT_ONLY #if defined QT4_OR_ABOVE && !defined TQTC_TQT_ONLY
if(k>1.0) if(k>1.0)
*cb=KColorUtils::lighten(ca, (k*(1+HCY_FACTOR))-1.0, 1.0); *cb=KColorUtils::lighten(ca, (k*(1+HCY_FACTOR))-1.0, 1.0);
else else
@ -1546,7 +1562,7 @@ static void shade(const Options *opts, const color *ca, color *cb, double k)
#endif #endif
} }
} }
#if defined __cplusplus && (0x039999 >= 0x040000) #if defined __cplusplus && defined QT4_OR_ABOVE
cb->setAlpha(ca.alpha()); cb->setAlpha(ca.alpha());
#endif #endif
#ifndef __cplusplus #ifndef __cplusplus
@ -1751,7 +1767,7 @@ static EAppearance widgetApp(EWidget w, const Options *opts)
#define MIN_ROUND_MAX_HEIGHT 12 #define MIN_ROUND_MAX_HEIGHT 12
#define MIN_ROUND_MAX_WIDTH 24 #define MIN_ROUND_MAX_WIDTH 24
#if !defined __cplusplus || ( (0x039999 >= 0x040000)) #if !defined __cplusplus || ( defined QT4_OR_ABOVE)
#if defined __cplusplus #if defined __cplusplus
#define EXTRA_INNER_RADIUS 3.5 #define EXTRA_INNER_RADIUS 3.5
@ -1826,7 +1842,7 @@ ERound getWidgetRound(const Options *opts, int w, int h, EWidget widget)
if((WIDGET_CHECKBOX==widget || WIDGET_FOCUS==widget) && ROUND_NONE!=r) if((WIDGET_CHECKBOX==widget || WIDGET_FOCUS==widget) && ROUND_NONE!=r)
r=ROUND_SLIGHT; r=ROUND_SLIGHT;
#if defined __cplusplus && ( (0x039999 >= 0x040000)) #if defined __cplusplus && ( defined QT4_OR_ABOVE)
if((WIDGET_MDI_WINDOW_BUTTON==widget && (opts->titlebarButtons&TITLEBAR_BUTTON_ROUND)) || if((WIDGET_MDI_WINDOW_BUTTON==widget && (opts->titlebarButtons&TITLEBAR_BUTTON_ROUND)) ||
WIDGET_RADIO_BUTTON==widget || WIDGET_DIAL==widget) WIDGET_RADIO_BUTTON==widget || WIDGET_DIAL==widget)
return ROUND_MAX; return ROUND_MAX;
@ -1836,7 +1852,7 @@ ERound getWidgetRound(const Options *opts, int w, int h, EWidget widget)
return ROUND_MAX; return ROUND_MAX;
#endif #endif
#if !defined __cplusplus || ( (0x039999 >= 0x040000)) #if !defined __cplusplus || ( defined QT4_OR_ABOVE)
if(WIDGET_SLIDER==widget && if(WIDGET_SLIDER==widget &&
(SLIDER_ROUND==opts->sliderStyle || SLIDER_ROUND_ROTATED==opts->sliderStyle || SLIDER_CIRCULAR==opts->sliderStyle)) (SLIDER_ROUND==opts->sliderStyle || SLIDER_ROUND_ROTATED==opts->sliderStyle || SLIDER_CIRCULAR==opts->sliderStyle))
return ROUND_MAX; return ROUND_MAX;
@ -1874,7 +1890,7 @@ static double getRadius(const Options *opts, int w, int h, EWidget widget, ERadi
(WIDGET_ENTRY==widget && (opts->square&SQUARE_ENTRY)) ) (WIDGET_ENTRY==widget && (opts->square&SQUARE_ENTRY)) )
return 0.0; return 0.0;
#if defined __cplusplus && ( (0x039999 >= 0x040000)) #if defined __cplusplus && ( defined QT4_OR_ABOVE)
if((WIDGET_MDI_WINDOW_BUTTON==widget && (opts->titlebarButtons&TITLEBAR_BUTTON_ROUND)) || if((WIDGET_MDI_WINDOW_BUTTON==widget && (opts->titlebarButtons&TITLEBAR_BUTTON_ROUND)) ||
WIDGET_RADIO_BUTTON==widget || WIDGET_DIAL==widget) WIDGET_RADIO_BUTTON==widget || WIDGET_DIAL==widget)
return (w>h ? h : w)/2.0; return (w>h ? h : w)/2.0;
@ -1884,7 +1900,7 @@ static double getRadius(const Options *opts, int w, int h, EWidget widget, ERadi
return (w>h ? h : w)/2.0; return (w>h ? h : w)/2.0;
#endif #endif
#if !defined __cplusplus || ( (0x039999 >= 0x040000)) #if !defined __cplusplus || ( defined QT4_OR_ABOVE)
if(WIDGET_SLIDER==widget && if(WIDGET_SLIDER==widget &&
(SLIDER_ROUND==opts->sliderStyle || SLIDER_ROUND_ROTATED==opts->sliderStyle || SLIDER_CIRCULAR==opts->sliderStyle)) (SLIDER_ROUND==opts->sliderStyle || SLIDER_ROUND_ROTATED==opts->sliderStyle || SLIDER_CIRCULAR==opts->sliderStyle))
return (w>h ? h : w)/2.0; return (w>h ? h : w)/2.0;
@ -2044,4 +2060,8 @@ static double shineAlpha(const color *bgnd)
#endif #endif
#ifdef __cplusplus
}
#endif
#endif // __COMMON_H__ #endif // __COMMON_H__

@ -25,6 +25,10 @@
#define CONFIG_DIALOG #define CONFIG_DIALOG
#include "common.h" #include "common.h"
#ifdef __cplusplus
using namespace TDEQtCurveStyle;
#endif
class KURLRequester; class KURLRequester;
class TQLineEdit; class TQLineEdit;

@ -29,6 +29,10 @@
#include <tqmap.h> #include <tqmap.h>
#include "common.h" #include "common.h"
#ifdef __cplusplus
using namespace TDEQtCurveStyle;
#endif
class TQPopupMenu; class TQPopupMenu;
class TQListViewItem; class TQListViewItem;
class KDoubleNumInput; class KDoubleNumInput;

@ -65,6 +65,10 @@
#include <tqvaluelist.h> #include <tqvaluelist.h>
#include "common.h" #include "common.h"
#ifdef __cplusplus
using namespace TDEQtCurveStyle;
#endif
class TQTimer; class TQTimer;
class TQSlider; class TQSlider;

Loading…
Cancel
Save