summaryrefslogtreecommitdiffstats
path: root/client/deKoratorclient.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'client/deKoratorclient.cpp')
-rw-r--r--client/deKoratorclient.cpp102
1 files changed, 85 insertions, 17 deletions
diff --git a/client/deKoratorclient.cpp b/client/deKoratorclient.cpp
index 5c312fc..dc14eeb 100644
--- a/client/deKoratorclient.cpp
+++ b/client/deKoratorclient.cpp
@@ -36,6 +36,7 @@
#endif
#include "deKoratorclient.h"
+#include "imageholder.h"
#include <tqsettings.h>
@@ -175,6 +176,7 @@ TQString DeKoratorFactory::framesPath_ = "";
TQString DeKoratorFactory::buttonsPath_ = "";
TQString DeKoratorFactory::masksPath_ = "";
+bool DeKoratorFactory::transparency_ = FALSE;
extern "C"
{
@@ -196,6 +198,11 @@ DeKoratorFactory::DeKoratorFactory()
readConfig();
initialized_ = TRUE;
+ if (transparency_)
+ imageHolder = new QImageHolder(TQImage(), TQImage());
+ else
+ imageHolder = nullptr;
+
initPixmaps();
loadPixmaps();
@@ -226,6 +233,9 @@ DeKoratorFactory::~DeKoratorFactory()
initialized_ = FALSE;
int i, j, k;
+ if (imageHolder)
+ delete imageHolder;
+
for ( i = 0; i < decoCount; i++ )
{
for ( j = 0; j < pixTypeCount; j++ )
@@ -351,19 +361,19 @@ bool DeKoratorFactory::readConfig()
TITLEALIGN = TQt::AlignRight;
bool oldUseMenuImage = USEMENUEIMAGE;
- USEMENUEIMAGE = config.readBoolEntry( "UseMenuImage", "false" );
+ USEMENUEIMAGE = config.readBoolEntry( "UseMenuImage", false );
bool oldIgnoreAppIcnCol = IGNOREAPPICNCOL;
- IGNOREAPPICNCOL = config.readBoolEntry( "IgnoreAppIconCol", "false" );
+ IGNOREAPPICNCOL = config.readBoolEntry( "IgnoreAppIconCol", false );
// bool oldDblClkClose = DBLCLKCLOSE;
- DBLCLKCLOSE = config.readBoolEntry( "DblClkClose", "false" );
+ DBLCLKCLOSE = config.readBoolEntry( "DblClkClose", false );
bool oldShowBtmBorder = SHOWBTMBORDER;
- SHOWBTMBORDER = config.readBoolEntry( "ShowBtmBorder", "false" );
+ SHOWBTMBORDER = config.readBoolEntry( "ShowBtmBorder", false );
bool oldUseShdtext = USESHDTEXT;
- USESHDTEXT = config.readBoolEntry( "UseShdtext", "false" );
+ USESHDTEXT = config.readBoolEntry( "UseShdtext", false );
int oldActiveShdtextX = ACTIVESHDTEXTX;
ACTIVESHDTEXTX = config.readNumEntry( "ActiveShdtextX", 0 );
@@ -394,25 +404,28 @@ bool DeKoratorFactory::readConfig()
// color's settings
config.setGroup( "COLORS" );
+ bool oldTransparency = DeKoratorFactory::transparency_;
+ DeKoratorFactory::transparency_ = config.readBoolEntry( "Transparency", false );
+
bool oldColorizeActFrames = DeKoratorFactory::colorizeActFrames_;
- DeKoratorFactory::colorizeActFrames_ = config.readBoolEntry( "ColorizeActFrames", "false" );
+ DeKoratorFactory::colorizeActFrames_ = config.readBoolEntry( "ColorizeActFrames", false );
bool oldColorizeActButtons = DeKoratorFactory::colorizeActButtons_;
- DeKoratorFactory::colorizeActButtons_ = config.readBoolEntry( "ColorizeActButtons", "false" );
+ DeKoratorFactory::colorizeActButtons_ = config.readBoolEntry( "ColorizeActButtons", false );
bool oldColorizeInActFrames = DeKoratorFactory::colorizeInActFrames_;
- DeKoratorFactory::colorizeInActFrames_ = config.readBoolEntry( "ColorizeInActFrames", "false" );
+ DeKoratorFactory::colorizeInActFrames_ = config.readBoolEntry( "ColorizeInActFrames", false );
bool oldColorizeInActButtons = DeKoratorFactory::colorizeInActButtons_;
- DeKoratorFactory::colorizeInActButtons_ = config.readBoolEntry( "ColorizeInActButtons", "false" );
+ DeKoratorFactory::colorizeInActButtons_ = config.readBoolEntry( "ColorizeInActButtons", false );
- USEANIMATION = config.readBoolEntry( "UseAnimation", "false" );
+ USEANIMATION = config.readBoolEntry( "UseAnimation", false );
ANIMATIONTYPE = config.readEntry( "AnimationType", "Liquid Method" );
STEPS = config.readNumEntry( "AnimSteps", 5 );
INTERVAL = config.readNumEntry( "AnimInterval", 30 );
- KEEPANIMATING = config.readBoolEntry( "KeepAnimating", "false" );
+ KEEPANIMATING = config.readBoolEntry( "KeepAnimating", false );
BUTTONHOVERTYPE = config.readEntry( "ButtonsHoverType", "To Gray" );
@@ -435,13 +448,13 @@ bool DeKoratorFactory::readConfig()
config.setGroup( "BUTTONS" );
bool oldUseCustomButtonsColors = DeKoratorFactory::useCustomButtonsColors_;
- DeKoratorFactory::useCustomButtonsColors_ = config.readBoolEntry( "UseCustomButtonsColors", "false" );
+ DeKoratorFactory::useCustomButtonsColors_ = config.readBoolEntry( "UseCustomButtonsColors", false );
bool oldCustomColorsActiveButtons = DeKoratorFactory::customColorsActiveButtons_;
- DeKoratorFactory::customColorsActiveButtons_ = config.readBoolEntry( "customColorsActiveButtons", "false" );
+ DeKoratorFactory::customColorsActiveButtons_ = config.readBoolEntry( "customColorsActiveButtons", false );
bool oldCustomColorsInActiveButtons = DeKoratorFactory::customColorsInActiveButtons_;
- DeKoratorFactory::customColorsInActiveButtons_ = config.readBoolEntry( "customColorsInActiveButtons", "false" );
+ DeKoratorFactory::customColorsInActiveButtons_ = config.readBoolEntry( "customColorsInActiveButtons", false );
// load buttons colors
TQColor colArr[ buttonTypeAllCount ];
@@ -486,7 +499,7 @@ bool DeKoratorFactory::readConfig()
DeKoratorFactory::buttonsPath_ = config.readEntry( "ButtonsPath", "" );
bool oldUseMasks = USEMASKS;
- USEMASKS = config.readBoolEntry( "UseMasks", "false" );
+ USEMASKS = config.readBoolEntry( "UseMasks", false );
TQString oldMasksPath = DeKoratorFactory::masksPath_;
DeKoratorFactory::masksPath_ = config.readEntry( "MasksPath", "" );
@@ -517,6 +530,7 @@ bool DeKoratorFactory::readConfig()
oldInActiveShdtextX == INACTIVESHDTEXTX &&
oldInActiveShdtextY == INACTIVESHDTEXTY &&
oldInActiveShadeColor == INACTIVESHADECOLOR &&
+ oldTransparency == DeKoratorFactory::transparency_ &&
oldColorizeActFrames == DeKoratorFactory::colorizeActFrames_ &&
oldColorizeActButtons == DeKoratorFactory::colorizeActButtons_ &&
oldColorizeInActFrames == DeKoratorFactory::colorizeInActFrames_ &&
@@ -551,7 +565,8 @@ bool DeKoratorFactory::readConfig()
if ( oldFramesPath != DeKoratorFactory::framesPath_ ||
oldButtonsPath != DeKoratorFactory::buttonsPath_ ||
- oldMasksPath != DeKoratorFactory::masksPath_
+ oldMasksPath != DeKoratorFactory::masksPath_ ||
+ oldTransparency != DeKoratorFactory::transparency_
)
DeKoratorFactory::needReload_ = TRUE;
else
@@ -1077,7 +1092,7 @@ void DeKoratorFactory::chooseRightPixmaps()
}
//////////////////////////////////////////////////////////////////////////////
-// prepareDecoWithBbCol()
+// prepareDecoWithBgCol()
//
void DeKoratorFactory::prepareDecoWithBgCol()
{
@@ -1092,6 +1107,11 @@ void DeKoratorFactory::prepareDecoWithBgCol()
{
for ( i = 0 ; i < decoCount ; i++ )
{
+ if (transparency_) {
+ //DECOARR[ i ][ actCol ] = DECOARR[ i ][ actCol ];
+ continue;
+ }
+
tempPix.resize( DECOARR[ i ][ orig ] ->width(), DECOARR[ i ][ orig ] ->height() );
tempPix.fill( col );
@@ -1109,6 +1129,11 @@ void DeKoratorFactory::prepareDecoWithBgCol()
{
for ( i = 0 ; i < decoCount ; i++ )
{
+ if (transparency_) {
+ DECOARR[ i ][ normal ] = new TQPixmap(*DECOARR[ i ][ orig ]);
+ continue;
+ }
+
tempPix.resize( DECOARR[ i ][ orig ] ->width(), DECOARR[ i ][ orig ] ->height() );
tempPix.fill( col );
@@ -1127,6 +1152,11 @@ void DeKoratorFactory::prepareDecoWithBgCol()
{
for ( i = 0 ; i < decoCount ; i++ )
{
+ if (transparency_) {
+ //DECOARR[ i ][ inActCol ] = DECOARR[ i ][ inActCol ];
+ continue;
+ }
+
tempPix.resize( DECOARR[ i ][ orig ] ->width(), DECOARR[ i ][ orig ] ->height() );
tempPix.fill( col );
@@ -1144,6 +1174,11 @@ void DeKoratorFactory::prepareDecoWithBgCol()
{
for ( i = 0 ; i < decoCount ; i++ )
{
+ if (transparency_) {
+ DECOARR[ i ][ normal ] = new TQPixmap(*DECOARR[ i ][ orig ]);
+ continue;
+ }
+
tempPix.resize( DECOARR[ i ][ orig ] ->width(), DECOARR[ i ][ orig ] ->height() );
tempPix.fill( col );
@@ -1347,6 +1382,14 @@ void DeKoratorButton::drawButton( TQPainter * painter )
int dx = 0, dy = 0;
bool act = client_->isActive();
TQImage buttonImgBak;
+ TQPixmap *background = client_->decoFactory_->imageHolder->image(act);
+
+ if (background && DeKoratorFactory::transparency_) {
+ TQRect r = rect();
+ TQPoint p = mapToGlobal( TQPoint(0,0) );
+ r.moveBy( p.x(), p.y() );
+ painter->drawPixmap( TQPoint(0,0), *background, r );
+ }
// fill background
if ( isLeft_ )
@@ -1717,6 +1760,12 @@ void DeKoratorClient::init()
connect( this, TQ_SIGNAL( keepAboveChanged( bool ) ), TQ_SLOT( keepAboveChange( bool ) ) );
connect( this, TQ_SIGNAL( keepBelowChanged( bool ) ), TQ_SLOT( keepBelowChange( bool ) ) );
+ if (DeKoratorFactory::transparency_)
+ {
+ connect( decoFactory_->imageHolder, TQ_SIGNAL( repaintNeeded() ), this, TQ_SLOT( repaint() ) );
+ connect( &repaintTimer, TQ_SIGNAL( timeout() ), this, TQ_SLOT( repaint() ) );
+ }
+
captionBufferDirty_ = true;
//maskDirty_ = true;
widget() ->update( titleBarSpacer_->geometry() );
@@ -2312,6 +2361,15 @@ void DeKoratorClient::wheelEvent( TQWheelEvent *e )
titlebarMouseWheelOperation( e->delta() );
}
+//////////////////////////////////////////////////////////////////////////////
+// repaint()
+// -----------------------
+//
+void DeKoratorClient::repaint() {
+ widget()->repaint();
+ for (int n=0; n<ButtonTypeCount; n++)
+ if (button[n]) button[n]->reset();
+}
//////////////////////////////////////////////////////////////////////////////
// paintEvent()
@@ -2334,11 +2392,19 @@ void DeKoratorClient::paintEvent( TQPaintEvent* )
TQRect rightTitleR( rightTitleBarSpacer_->geometry() );
titleR.rect( &tx, &ty, &tw, &th );
TQRect rect;
+ TQPixmap* background = decoFactory_->imageHolder->image(isActive());
+ TQPoint p = widget()->mapToGlobal(TQPoint(0,0));
+
+ if (background && DeKoratorFactory::transparency_)
+ painter.drawPixmap( 0, 0, *background, p.x(), p.y(), w, h );
TQPainter painter2;
TQPixmap pix( w, TITLESIZE );
painter2.begin( &pix );
{
+ if (background && DeKoratorFactory::transparency_)
+ painter2.drawPixmap( 0, 0, *background, p.x(), p.y(), w, TITLESIZE );
+
// topLeftCorner
rect.setRect( 0, 0, TOPLEFTCORNERWIDTH, TITLESIZE );
@@ -2584,6 +2650,8 @@ void DeKoratorClient::updateCaptionBuffer()
// Window is being resized
void DeKoratorClient::resizeEvent( TQResizeEvent *e )
{
+ if ( !repaintTimer.isActive() && DeKoratorFactory::transparency_ )
+ repaintTimer.start(0, true);
if ( widget() ->isShown() )
{
TQRegion region = widget() ->rect();