summaryrefslogtreecommitdiffstats
path: root/common/common.h
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2014-11-14 21:25:54 -0600
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2014-11-14 21:25:54 -0600
commit0ea889939059694c588988e0b6d8fd92eb5b7539 (patch)
tree69b7087db9897dab31fdc14cd6f98c030cd01b0c /common/common.h
parentb91b9e500bd265bc06564ff6935966b75cba82ff (diff)
downloadtde-style-qtcurve-0ea889939059694c588988e0b6d8fd92eb5b7539.tar.gz
tde-style-qtcurve-0ea889939059694c588988e0b6d8fd92eb5b7539.zip
Fix a long-standing conflict between QtCurve's Gradient class and Libreoffice's Gradient class
This largely resolves Bug 1489
Diffstat (limited to 'common/common.h')
-rw-r--r--common/common.h102
1 files changed, 61 insertions, 41 deletions
diff --git a/common/common.h b/common/common.h
index f39022a..88dfb40 100644
--- a/common/common.h
+++ b/common/common.h
@@ -29,10 +29,45 @@
#include <math.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 <float.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)
{
@@ -66,25 +101,9 @@ typedef enum
} EShading;
#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;
-#if (0x039999 >= 0x040000)
-#include <TQtCore/TQSet>
+#if defined QT4_OR_ABOVE
typedef TQSet<TQString> Strings;
#else
typedef TQStringList Strings;
@@ -372,19 +391,19 @@ enum
#define FULLLY_ROUNDED (opts.round>=ROUND_FULL)
#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)
#endif
#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_GLOW_LINE_ALPHA 0.5
#define BORDER_BLEND_ALPHA 0.7
#define ETCH_TOP_ALPHA 0.055
#define ETCH_BOTTOM_ALPHA 0.1
-// #if (0x039999 >= 0x040000)
+// #if defined QT4_OR_ABOVE
// #define ETCH_RADIO_TOP_ALPHA 0.055
// #define ETCH_RADIO_BOTTOM_ALPHA 0.80
// #else
@@ -416,9 +435,7 @@ enum
#endif
-#if defined __cplusplus && (0x039999 >= 0x040000)
-
-#include <tqstyle.h>
+#if defined __cplusplus && defined QT4_OR_ABOVE
typedef enum
{
TQtC_Round = TQStyle::PM_CustomBase,
@@ -455,7 +472,7 @@ typedef enum
#define WINDOW_SHADOW_COLOR(A) (EFFECT_SHADOW==(A) ? TQt::black : TQt::white)
#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_FULL "QTCURVE_PREVIEW_CONFIG_FULL"
@@ -1069,7 +1086,7 @@ typedef struct
*/
#endif
mapKdeIcons,
-#if defined CONFIG_DIALOG || ( (0x039999 >= 0x040000)) || !defined __cplusplus
+#if defined CONFIG_DIALOG || ( defined QT4_OR_ABOVE) || !defined __cplusplus
gtkButtonOrder,
fadeLines,
#endif
@@ -1099,10 +1116,10 @@ typedef struct
borderInactiveTab,
doubleGtkComboArrow,
menuIcons,
-#if defined CONFIG_DIALOG || ( (0x039999 >= 0x040000))
+#if defined CONFIG_DIALOG || ( defined QT4_OR_ABOVE)
stdBtnSizes,
#endif
-#if (0x039999 >= 0x040000)
+#if defined QT4_OR_ABOVE
xbar,
#endif
forceAlternateLvCols,
@@ -1125,10 +1142,10 @@ typedef struct
bgndOpacity,
menuBgndOpacity,
dlgOpacity;
-#if (0x039999 >= 0x040000)
+#if defined QT4_OR_ABOVE
int dwtSettings;
#endif
-#if defined CONFIG_DIALOG || ( (0x039999 >= 0x040000))
+#if defined CONFIG_DIALOG || ( defined QT4_OR_ABOVE)
int titlebarButtons;
TBCols titlebarButtonColors;
ETitleBarIcon titlebarIcon;
@@ -1206,7 +1223,7 @@ typedef struct
#endif
TQtCImage bgndImage,
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 */
Strings noBgndGradientApps,
noBgndOpacityApps,
@@ -1217,7 +1234,7 @@ typedef struct
Strings noDlgFixApps;
#endif
Strings noMenuStripeApps;
-#if (0x039999 >= 0x040000)
+#if defined QT4_OR_ABOVE
Strings menubarApps,
statusbarApps,
useTQtFileDialogApps,
@@ -1416,8 +1433,7 @@ inline int limit(double c)
}
#endif
-#if (0x039999 >= 0x040000) && !defined TQTC_TQT_ONLY
-#include <KDE/KColorUtils>
+#if defined QT4_OR_ABOVE && !defined TQTC_TQT_ONLY
#define tint(COLA, COLB, FACTOR) KColorUtils::tint((COLA), (COLB), (FACTOR))
#define midColor(COLA, COLB) KColorUtils::mix((COLA), (COLB), 0.5)
#else
@@ -1528,7 +1544,7 @@ static void shade(const Options *opts, const color *ca, color *cb, double k)
case SHADING_HCY:
{
#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)
*cb=KColorUtils::lighten(ca, (k*(1+HCY_FACTOR))-1.0, 1.0);
else
@@ -1546,7 +1562,7 @@ static void shade(const Options *opts, const color *ca, color *cb, double k)
#endif
}
}
-#if defined __cplusplus && (0x039999 >= 0x040000)
+#if defined __cplusplus && defined QT4_OR_ABOVE
cb->setAlpha(ca.alpha());
#endif
#ifndef __cplusplus
@@ -1751,7 +1767,7 @@ static EAppearance widgetApp(EWidget w, const Options *opts)
#define MIN_ROUND_MAX_HEIGHT 12
#define MIN_ROUND_MAX_WIDTH 24
-#if !defined __cplusplus || ( (0x039999 >= 0x040000))
+#if !defined __cplusplus || ( defined QT4_OR_ABOVE)
#if defined __cplusplus
#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)
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)) ||
WIDGET_RADIO_BUTTON==widget || WIDGET_DIAL==widget)
return ROUND_MAX;
@@ -1836,7 +1852,7 @@ ERound getWidgetRound(const Options *opts, int w, int h, EWidget widget)
return ROUND_MAX;
#endif
-#if !defined __cplusplus || ( (0x039999 >= 0x040000))
+#if !defined __cplusplus || ( defined QT4_OR_ABOVE)
if(WIDGET_SLIDER==widget &&
(SLIDER_ROUND==opts->sliderStyle || SLIDER_ROUND_ROTATED==opts->sliderStyle || SLIDER_CIRCULAR==opts->sliderStyle))
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)) )
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)) ||
WIDGET_RADIO_BUTTON==widget || WIDGET_DIAL==widget)
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;
#endif
-#if !defined __cplusplus || ( (0x039999 >= 0x040000))
+#if !defined __cplusplus || ( defined QT4_OR_ABOVE)
if(WIDGET_SLIDER==widget &&
(SLIDER_ROUND==opts->sliderStyle || SLIDER_ROUND_ROTATED==opts->sliderStyle || SLIDER_CIRCULAR==opts->sliderStyle))
return (w>h ? h : w)/2.0;
@@ -2044,4 +2060,8 @@ static double shineAlpha(const color *bgnd)
#endif
+#ifdef __cplusplus
+}
+#endif
+
#endif // __COMMON_H__