Code from Utils.* moved into Static.*

Removed link testing and debug flags from Makefile.am

Some magic to give a nice 3D look even when specified background colour
is dark (looks good with NeXT colour scheme now).

BTW, what's the point in translating 'RISC OS' ? It's a brand name,
like IBM.

svn path=/trunk/kdebase/kwin/; revision=46360
This commit is contained in:
Rik Hemsley 2000-04-12 00:13:14 +00:00
parent 84e0076486
commit 6f2db8d4c7
13 changed files with 85 additions and 181 deletions

View file

@ -33,7 +33,7 @@ namespace RiscOS
{
Button::Button(QWidget * parent, Manager * client, SymbolType t)
: QWidget (parent, "Button"),
: QWidget (parent, "Button", WRepaintNoErase | WPaintUnclipped),
client_ (client),
type_ (t),
align_ (Left),
@ -51,6 +51,7 @@ Button::~Button()
Button::updateDisplay()
{
setBackgroundPixmap(Static::instance()->button(type_, client_->isActive(), down_));
repaint(true);
}
} // End namespace

View file

@ -1,5 +1,3 @@
KDE_CXXFLAGS = -O0 -g3 -W -Wall
INCLUDES = $(all_includes)
lib_LTLIBRARIES = libkwinriscos.la
@ -17,7 +15,6 @@ ResizeMid.cpp \
ResizeSide.cpp \
TitleBar.cpp \
TitleText.cpp \
Utils.cpp \
Static.cpp
METASOURCES = AUTO
@ -34,7 +31,6 @@ ResizeMid.h \
ResizeSide.h \
TitleBar.h \
TitleText.h \
Utils.h \
Static.h
lnkdir = $(kde_datadir)/kwin/
@ -42,6 +38,5 @@ lnk_DATA = riscos.desktop
EXTRA_DIST = $(lnk_DATA)
libkwinriscos_la_LIBADD = ../../kwin.la -lqt -lX11
libkwinriscos_la_LDFLAGS = $(all_libraries) -version-info 1:0:0 -module -rdynamic -no-undefined
libkwinriscos_la_LDFLAGS = $(all_libraries) -version-info 1:0:0 -module -rdynamic

View file

@ -48,9 +48,9 @@ Manager::Manager(
QWidget * parent,
const char * name
)
: Client(workSpace, id, parent, name, WResizeNoErase | WRepaintNoErase | WPaintUnclipped)
: Client(workSpace, id, parent, name)
{
Static::instance()->update();
Static::instance();
setBackgroundMode(NoBackground);
@ -59,24 +59,21 @@ Manager::Manager(
titleBar_ = new TitleBar(this, this);
resizeBar_ = new ResizeBar(this, this);
// Layout
// Border
// Window
// Border
// Border Window Border
QHBoxLayout * windowLayout = new QHBoxLayout(0, "windowLayout");
windowLayout->addSpacing(1);
windowLayout->addWidget(windowWrapper(), 1);
windowLayout->addSpacing(1);
// Border
// Titlebar
// Window layout
// Resize bar
// Titlebar (has own single pixel border)
// Window
// Resize bar (has own single pixel border)
QVBoxLayout * mainLayout = new QVBoxLayout(this, 0, 0, "mainLayout");
mainLayout->addWidget(titleBar_);
mainLayout->addLayout(windowLayout, 1);
mainLayout->addWidget(resizeBar_);
updateDisplay();
}
Manager::~Manager()

View file

@ -35,10 +35,8 @@ MaximiseButton::MaximiseButton(QWidget * parent, Manager * client)
void
MaximiseButton::setOn(bool on)
{
if (on)
setType(Unmax);
else
setType(Max);
setType(on ? Unmax: Max);
updateDisplay();
}
void

View file

@ -25,13 +25,12 @@
#include "ResizeSide.h"
#include "Manager.h"
#include "Static.h"
#include "Utils.h"
namespace RiscOS
{
ResizeSide::ResizeSide(QWidget * parent, Manager * client, Side s)
: QWidget (parent, "ResizeSide"),
: QWidget (parent, "ResizeSide", WRepaintNoErase | WPaintUnclipped)
client_ (client),
side_ (s)
{

View file

@ -25,7 +25,6 @@
#include "ResizeMid.h"
#include "Manager.h"
#include "Static.h"
#include "Utils.h"
namespace RiscOS
{

View file

@ -25,7 +25,6 @@
#include "ResizeRight.h"
#include "Manager.h"
#include "Static.h"
#include "Utils.h"
namespace RiscOS
{

View file

@ -25,7 +25,6 @@
#include "ResizeSide.h"
#include "Manager.h"
#include "Static.h"
#include "Utils.h"
namespace RiscOS
{

View file

@ -27,7 +27,6 @@
#include "../../options.h"
#include "Static.h"
#include "Utils.h"
namespace RiscOS
{
@ -99,35 +98,6 @@ Static::_drawBorder(QPixmap & pix, int w, int h)
painter_.end();
}
QPixmap
recolour(const QImage & inputImage, const Palette & newPalette)
{
QImage image(inputImage);
Palette & standard = Static::instance()->standardPalette();
int ncols = image.numColors();
QRgb r;
for (int i = 0; i < ncols; i++) {
r = image.color(i);
for (int c = 0; c < 8; c++) {
if (r == standard[c])
{
image.setColor(i, newPalette[c]);
continue;
}
}
}
QPixmap output;
output.convertFromImage(image);
return output;
}
void
Static::_drawCloseSymbol(QPixmap & pixmap)
{
@ -191,7 +161,7 @@ Static::_drawLowerSymbol(QPixmap & pixmap)
painter_.translate(transx, transy);
painter_.fillRect(1, 1, 6, 6, QColor(palette_[6]));
painter_.fillRect(5, 5, 6, 6, QColor(palette_[6]));
painter_.fillRect(5, 5, 6, 6, QColor(palette_[3]));
painter_.setPen(QColor(palette_[1]));
painter_.drawRect(0, 0, 8, 8);
@ -247,7 +217,7 @@ Static::_drawUnmaxSymbol(QPixmap & pixmap)
painter_.translate(transx, transy);
painter_.setPen(QColor(palette_[1]));
painter_.drawRect(0, 0, 11, 11);
painter_.drawRect(0, 0, 12, 12);
painter_.setPen(QColor(palette_[3]));
painter_.drawPoint(0, 0);
@ -263,10 +233,17 @@ Static::_drawUnmaxSymbol(QPixmap & pixmap)
void
setPalette(Palette & pal, QColor c)
{
pal[3] = c.rgb();
int h, s, v;
c.hsv(&h, &s, &v);
if (v < 72)
c.setHsv(h, s, 72);
pal[0] = c.light(200).rgb();
pal[1] = c.light(166).rgb();
pal[2] = c.light(125).rgb();
pal[3] = c.rgb();
pal[4] = c.dark(133).rgb();
pal[5] = c.dark(166).rgb();
pal[6] = c.dark(200).rgb();
@ -276,10 +253,17 @@ setPalette(Palette & pal, QColor c)
void
setInversePalette(Palette & pal, QColor c)
{
pal[4] = c.rgb();
int h, s, v;
c.hsv(&h, &s, &v);
if (v < 72)
c.setHsv(h, s, 72);
pal[7] = c.light(200).rgb();
pal[6] = c.light(166).rgb();
pal[5] = c.light(125).rgb();
pal[4] = c.rgb();
pal[3] = c.dark(133).rgb();
pal[2] = c.dark(166).rgb();
pal[1] = c.dark(200).rgb();
@ -326,6 +310,22 @@ Static::_init()
aResize_.fill(Qt::black);
iResize_.fill(Qt::black);
aTitleTextLeft_ .setOptimization(QPixmap::BestOptim);
aTitleTextRight_ .setOptimization(QPixmap::BestOptim);
aTitleTextMid_ .setOptimization(QPixmap::BestOptim);
iTitleTextLeft_ .setOptimization(QPixmap::BestOptim);
iTitleTextRight_ .setOptimization(QPixmap::BestOptim);
iTitleTextMid_ .setOptimization(QPixmap::BestOptim);
aResizeMidLeft_ .setOptimization(QPixmap::BestOptim);
aResizeMidRight_ .setOptimization(QPixmap::BestOptim);
aResizeMid_ .setOptimization(QPixmap::BestOptim);
iResizeMidLeft_ .setOptimization(QPixmap::BestOptim);
iResizeMidRight_ .setOptimization(QPixmap::BestOptim);
iResizeMid_ .setOptimization(QPixmap::BestOptim);
aTitleTextLeft_ .resize(3, 20);
aTitleTextRight_ .resize(3, 20);
aTitleTextLeft_ .fill(Qt::black);
@ -345,6 +345,7 @@ Static::_init()
aResizeMidRight_ .resize(3, 12);
aResizeMidLeft_ .fill(Qt::black);
aResizeMidRight_ .fill(Qt::black);
iResizeMidLeft_ .resize(3, 12);
iResizeMidRight_ .resize(3, 12);
iResizeMidLeft_ .fill(Qt::black);

View file

@ -89,13 +89,14 @@ class Static
private:
void _drawButtonBorder (QPixmap &);
void _drawBorder(QPixmap &, int w, int h);
void _drawBorder (QPixmap &, int, int);
void _drawCloseSymbol (QPixmap &);
void _drawIconifySymbol(QPixmap &);
void _drawLowerSymbol (QPixmap &);
void _drawMaxSymbol (QPixmap &);
void _drawUnmaxSymbol (QPixmap &);
void _init();
void _drawCloseSymbol(QPixmap & pixmap);
void _drawIconifySymbol(QPixmap & pixmap);
void _drawLowerSymbol(QPixmap & pixmap);
void _drawMaxSymbol(QPixmap & pixmap);
void _drawUnmaxSymbol(QPixmap & pixmap);
static Static * instance_;

View file

@ -28,7 +28,6 @@
#include "TitleText.h"
#include "Manager.h"
#include "Static.h"
#include "Utils.h"
namespace RiscOS
{
@ -38,7 +37,6 @@ TitleText::TitleText(QWidget * parent, Manager * client)
client_(client)
{
setFixedHeight(20);
updatePixmap();
}
TitleText::~TitleText()

View file

@ -1,36 +0,0 @@
/*
RISC OS KWin client
Copyright 2000
Rik Hemsley <rik@kde.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
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., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include <qpainter.h>
#include <qimage.h>
#include "../../options.h"
#include "Utils.h"
#include "Static.h"
namespace RiscOS
{
} // End namespace
// vim:ts=2:sw=2:tw=78

View file

@ -1,47 +0,0 @@
/*
RISC OS KWin client
Copyright 2000
Rik Hemsley <rik@kde.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
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., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef RISC_OS_UTILS_H
#define RISC_OS_UTILS_H
#include <qarray.h>
#include <qpixmap.h>
#include "Palette.h"
namespace RiscOS {
void drawBorder(
QPixmap & pix,
int x, int y,
int w, int h,
const Palette & pal,
bool down = false
);
QPixmap recolour(const QImage &, const Palette &);
} // End namespace
#endif
// vim:ts=2:sw=2:tw=78