- Made the bottom grab bar optional by popular demand.

- Implemented a (hopefully) temporary solution to
  tooltip setting changes not being applied to the
  titlebar buttons while the style is in use.

svn path=/trunk/kdebase/kwin/; revision=175167
This commit is contained in:
Fredrik Höglund 2002-09-01 22:50:34 +00:00
parent e5d7df3d7f
commit d1ef7e8236
9 changed files with 89 additions and 38 deletions

View file

@ -30,7 +30,8 @@ tiles.h: pics/caption-large-left.png pics/caption-small-right.png pics/titlebar-
pics/grabbar-center.png pics/titlebar-left.png pics/border-right.png \
pics/caption-small-center.png pics/grabbar-left.png pics/titlebar-right.png \
pics/caption-large-center.png pics/caption-small-left.png pics/grabbar-right.png \
pics/titlebutton-round.png
pics/titlebutton-round.png pics/bottom-left.png pics/bottom-right.png \
pics/bottom-center.png
tiles.h: embedtool
pics=`ls $(srcdir)/pics/*.png 2>/dev/null` ;\

View file

@ -58,6 +58,7 @@ KeramikConfig::KeramikConfig( KConfig* conf, QWidget* parent )
ui = new KeramikConfigUI( parent );
connect( ui->showAppIcons, SIGNAL(clicked()), SIGNAL(changed()) );
connect( ui->smallCaptions, SIGNAL(clicked()), SIGNAL(changed()) );
connect( ui->largeGrabBars, SIGNAL(clicked()), SIGNAL(changed()) );
connect( ui->useShadowedText, SIGNAL(clicked()), SIGNAL(changed()) );
load( conf );
@ -79,6 +80,7 @@ void KeramikConfig::load( KConfig* )
c->setGroup("General");
ui->showAppIcons->setChecked( c->readBoolEntry("ShowAppIcons", true) );
ui->smallCaptions->setChecked( c->readBoolEntry("SmallCaptionBubbles", false) );
ui->largeGrabBars->setChecked( c->readBoolEntry("LargeGrabBars", true) );
ui->useShadowedText->setChecked( c->readBoolEntry("UseShadowedText", true) );
}
@ -89,6 +91,7 @@ void KeramikConfig::save( KConfig* )
c->setGroup( "General" );
c->writeEntry( "ShowAppIcons", ui->showAppIcons->isChecked() );
c->writeEntry( "SmallCaptionBubbles", ui->smallCaptions->isChecked() );
c->writeEntry( "LargeGrabBars", ui->largeGrabBars->isChecked() );
c->writeEntry( "UseShadowedText", ui->useShadowedText->isChecked() );
c->sync();
}
@ -99,6 +102,7 @@ void KeramikConfig::defaults()
{
ui->showAppIcons->setChecked( true );
ui->smallCaptions->setChecked( false );
ui->largeGrabBars->setChecked( true );
ui->useShadowedText->setChecked( true );
emit changed();

View file

@ -78,6 +78,17 @@
<string>Check this option if you want the caption bubble to have the same size on active windows that it has on inactive ones. This option is useful for laptops or low resolution displays where you want maximize the amount of space available to the window contents.</string>
</property>
</widget>
<widget class="QCheckBox">
<property name="name">
<cstring>largeGrabBars</cstring>
</property>
<property name="text">
<string>Draw g&amp;rab bars below windows</string>
</property>
<property name="whatsThis" stdset="0">
<string>Check this option if you want a grab bar to be drawn below windows. When this option is not selected only a thin border will be drawn in its place.</string>
</property>
</widget>
<widget class="QCheckBox">
<property name="name">
<cstring>useShadowedText</cstring>
@ -89,7 +100,7 @@
<string>Check this option if you want the titlebar text to have a 3D look with a shadow behind it.</string>
</property>
</widget>
</vbox>
</vbox>
</widget>
</hbox>
</widget>

View file

@ -170,7 +170,7 @@ void KeramikEmbedder::writeIndex()
uint prime = 0;
for ( i = 0; i < 50; i++ )
if ( (prime = primes[i]) > index->count() )
if ( (prime = primes[i]) >= index->count() )
break;
stream << "\tclass KeramikImageDb {\n";

View file

@ -249,10 +249,15 @@ void KeramikHandler::createPixmaps()
activeTiles[ BorderRight ] = loadPixmap( "border-right", titleColor );
// Load the bottom grabbar pixmaps
activeTiles[ GrabBarLeft ] = loadPixmap( "grabbar-left", titleColor );
activeTiles[ GrabBarRight ] = loadPixmap( "grabbar-right", titleColor );
activeTiles[ GrabBarCenter ] = loadPixmap( "grabbar-center", titleColor );
if ( largeGrabBars ) {
activeTiles[ GrabBarLeft ] = loadPixmap( "grabbar-left", titleColor );
activeTiles[ GrabBarRight ] = loadPixmap( "grabbar-right", titleColor );
activeTiles[ GrabBarCenter ] = loadPixmap( "grabbar-center", titleColor );
} else {
activeTiles[ GrabBarLeft ] = loadPixmap( "bottom-left", titleColor );
activeTiles[ GrabBarRight ] = loadPixmap( "bottom-right", titleColor );
activeTiles[ GrabBarCenter ] = loadPixmap( "bottom-center", titleColor );
}
// Inactive tiles
// -------------------------------------------------------------------------
@ -283,10 +288,15 @@ void KeramikHandler::createPixmaps()
inactiveTiles[ BorderLeft ] = loadPixmap( "border-left", titleColor );
inactiveTiles[ BorderRight ] = loadPixmap( "border-right", titleColor );
inactiveTiles[ GrabBarLeft ] = loadPixmap( "grabbar-left", titleColor );
inactiveTiles[ GrabBarRight ] = loadPixmap( "grabbar-right", titleColor );
inactiveTiles[ GrabBarCenter ] = loadPixmap( "grabbar-center", titleColor );
if ( largeGrabBars ) {
inactiveTiles[ GrabBarLeft ] = loadPixmap( "grabbar-left", titleColor );
inactiveTiles[ GrabBarRight ] = loadPixmap( "grabbar-right", titleColor );
inactiveTiles[ GrabBarCenter ] = loadPixmap( "grabbar-center", titleColor );
} else {
inactiveTiles[ GrabBarLeft ] = loadPixmap( "bottom-left", titleColor );
inactiveTiles[ GrabBarRight ] = loadPixmap( "bottom-right", titleColor );
inactiveTiles[ GrabBarCenter ] = loadPixmap( "bottom-center", titleColor );
}
// Buttons
// -------------------------------------------------------------------------
@ -404,10 +414,11 @@ void KeramikHandler::readConfig()
showIcons = c->readBoolEntry( "ShowAppIcons", true );
shadowedText = c->readBoolEntry( "UseShadowedText", true );
smallCaptionBubbles = c->readBoolEntry( "SmallCaptionBubbles", false );
largeGrabBars = c->readBoolEntry( "LargeGrabBars", true );
if ( ! settings_cache ) {
settings_cache = new SettingsCache;
if ( options->customButtonPositions() ) {
settings_cache->buttonsLeft = options->titleButtonsLeft();
settings_cache->buttonsRight = options->titleButtonsRight();
@ -415,12 +426,14 @@ void KeramikHandler::readConfig()
settings_cache->buttonsLeft = QString( default_left );
settings_cache->buttonsRight = QString( default_right );
}
settings_cache->aTitleColor = options->color( Options::TitleBar, true );
settings_cache->aTitleBlend = options->color( Options::TitleBlend, true );
settings_cache->iTitleColor = options->color( Options::TitleBar, false );
settings_cache->iTitleBlend = options->color( Options::TitleBlend, false );
settings_cache->buttonColor = options->color( Options::ButtonBg, true );
settings_cache->aTitleColor = options->color( Options::TitleBar, true );
settings_cache->aTitleBlend = options->color( Options::TitleBlend, true );
settings_cache->iTitleColor = options->color( Options::TitleBar, false );
settings_cache->iTitleBlend = options->color( Options::TitleBlend, false );
settings_cache->buttonColor = options->color( Options::ButtonBg, true );
settings_cache->showTooltips = options->showTooltips();
settings_cache->largeGrabBars = largeGrabBars;
}
delete c;
@ -500,9 +513,9 @@ QPixmap *KeramikHandler::loadPixmap( const QString &name, const QColor &col )
void KeramikHandler::reset()
{
QString buttonsLeft, buttonsRight;
keramik_initialized = false;
bool needHardReset = false;
bool pixmapsInvalid = false;
@ -518,7 +531,7 @@ void KeramikHandler::reset()
{
pixmapsInvalid = true;
}
// Check if button positions have changed
if ( options->customButtonPositions() ) {
buttonsLeft = options->titleButtonsLeft();
@ -527,22 +540,33 @@ void KeramikHandler::reset()
buttonsLeft = QString( default_left );
buttonsRight = QString( default_right );
}
if ( (settings_cache->buttonsLeft != buttonsLeft) ||
(settings_cache->buttonsRight != buttonsRight) ) {
needHardReset = true;
}
// Check if tooltips options have changed
if ( (settings_cache->showTooltips != options->showTooltips()) ) {
needHardReset = true;
}
if ( (settings_cache->largeGrabBars != largeGrabBars) ) {
pixmapsInvalid = true;
needHardReset = true;
}
// Update our config cache
settings_cache->aTitleColor = options->color( Options::TitleBar, true );
settings_cache->aTitleBlend = options->color( Options::TitleBlend, true );
settings_cache->iTitleColor = options->color( Options::TitleBar, false );
settings_cache->iTitleBlend = options->color( Options::TitleBlend, false );
settings_cache->buttonColor = options->color( Options::ButtonBg, true );
settings_cache->showTooltips = options->showTooltips();
settings_cache->buttonsLeft = buttonsLeft;
settings_cache->buttonsRight = buttonsRight;
settings_cache->largeGrabBars = largeGrabBars;
// Do we need to recreate the pixmaps?
if ( pixmapsInvalid ) {
destroyPixmaps();
@ -710,15 +734,16 @@ KeramikClient::KeramikClient( Workspace *ws, WId w, QWidget *parent, const char
largeTitlebar = ( !maximizedVertical() && clientHandler->largeCaptionBubbles() );
largeCaption = ( isActive() && largeTitlebar );
int grabBarHeight = clientHandler->grabBarHeight();
int topSpacing = ( largeTitlebar ? 4 : 1 );
topSpacer = new QSpacerItem( 10, topSpacing,
QSizePolicy::Expanding, QSizePolicy::Minimum );
mainLayout->addItem( topSpacer );
mainLayout->addLayout( titleLayout ); // Titlebar
mainLayout->addLayout( windowLayout, 1 ); // Left border + window + right border
mainLayout->addSpacing( 8 ); // Bottom grab bar + shadow
mainLayout->addLayout( titleLayout ); // Titlebar
mainLayout->addLayout( windowLayout, 1 ); // Left border + window + right border
mainLayout->addSpacing( grabBarHeight ); // Bottom grab bar
titleLayout->setSpacing( buttonSpacing );
@ -1206,6 +1231,7 @@ void KeramikClient::paintEvent( QPaintEvent *e )
int titleBaseY = ( largeTitlebar ? 3 : 0 );
int titleBarHeight = clientHandler->titleBarHeight( largeTitlebar );
int grabBarHeight = clientHandler->grabBarHeight();
if ( maskDirty )
updateMask();
@ -1259,10 +1285,11 @@ void KeramikClient::paintEvent( QPaintEvent *e )
// Borders
// -----------------------------------------------------------------------
if ( updateRect.bottom() >= titleBarHeight && updateRect.top() < height() - 8 )
if ( updateRect.bottom() >= titleBarHeight &&
updateRect.top() < height() - grabBarHeight )
{
int top = QMAX( titleBarHeight, updateRect.top() );
int bottom = QMIN( updateRect.bottom(), height() - 8 );
int bottom = QMIN( updateRect.bottom(), height() - grabBarHeight );
// Left border
if ( updateRect.x() <= 4 ) {
@ -1280,10 +1307,10 @@ void KeramikClient::paintEvent( QPaintEvent *e )
// Bottom grab bar
// -----------------------------------------------------------------------
if ( updateRect.bottom() >= height() - 8 ) {
if ( updateRect.bottom() >= height() - grabBarHeight ) {
// Bottom left corner
if ( updateRect.x() < 9 )
p.drawPixmap( 0, height() - 8,
p.drawPixmap( 0, height() - grabBarHeight,
*clientHandler->tile( GrabBarLeft, active ) );
// Space between the left corner and the right corner
@ -1291,13 +1318,13 @@ void KeramikClient::paintEvent( QPaintEvent *e )
int x1 = QMAX( 9, updateRect.x() );
int x2 = QMIN( width() - 9, updateRect.right() );
p.drawTiledPixmap( x1, height() - 8, x2 - x1 + 1, 8,
*clientHandler->tile( GrabBarCenter, active ) );
p.drawTiledPixmap( x1, height() - grabBarHeight, x2 - x1 + 1,
grabBarHeight, *clientHandler->tile( GrabBarCenter, active ) );
}
// Bottom right corner
if ( updateRect.right() > width() - 9 )
p.drawPixmap( width()-9, height()-8,
p.drawPixmap( width() - 9, height() - grabBarHeight,
*clientHandler->tile( GrabBarRight, active ) );
}
}
@ -1405,7 +1432,7 @@ Client::MousePosition KeramikClient::mousePosition( const QPoint &p ) const
&& p.y() < titleBaseY+3 )
return Top;
if ( p.y() >= height() - 8 )
if ( p.y() >= height() - clientHandler->grabBarHeight() )
return Bottom;
return Center;
@ -1413,6 +1440,8 @@ Client::MousePosition KeramikClient::mousePosition( const QPoint &p ) const
}; // namespace Keramik
// -------------------------------------------------------------------------------------------

View file

@ -56,6 +56,8 @@ namespace Keramik {
QColor buttonColor;
QString buttonsLeft;
QString buttonsRight;
bool showTooltips:1;
bool largeGrabBars:1;
};
class KeramikHandler : public QObject {
@ -76,7 +78,10 @@ namespace Keramik {
return ( large ? activeTiles[CaptionLargeCenter]->height()
: activeTiles[CaptionSmallCenter]->height() );
}
int grabBarHeight() const
{ return activeTiles[GrabBarCenter]->height(); }
const QPixmap *roundButton() const { return titleButtonRound; }
const QPixmap *squareButton() const { return titleButtonSquare; }
const QBitmap *buttonDeco( ButtonDeco deco ) const
@ -100,7 +105,8 @@ namespace Keramik {
QPixmap *loadPixmap( const QString &, const QColor & );
private:
bool showIcons:1, shadowedText:1, smallCaptionBubbles:1;
bool showIcons:1, shadowedText:1,
smallCaptionBubbles:1, largeGrabBars:1;
SettingsCache *settings_cache;
KeramikImageDb *imageDb;

Binary file not shown.

After

Width:  |  Height:  |  Size: 149 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 156 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 163 B