summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--bin/kdepim/WhatsNew.txt2
-rwxr-xr-xmicrokde/fncolordialog.cpp334
-rwxr-xr-xmicrokde/fncolordialog.h137
-rw-r--r--microkde/kcolordialog.cpp80
-rw-r--r--microkde/kcolordialog.h13
-rw-r--r--microkde/microkdeE.pro4
6 files changed, 482 insertions, 88 deletions
diff --git a/bin/kdepim/WhatsNew.txt b/bin/kdepim/WhatsNew.txt
index dd02be5..322c0e6 100644
--- a/bin/kdepim/WhatsNew.txt
+++ b/bin/kdepim/WhatsNew.txt
@@ -13,6 +13,8 @@ In the addressee selection dialog now the formatted name is shown, if not empty.
Fixed in the file selector on the Zaurus the problem that symbolic links to files/dirs were ignored.
Fixed the sorting for size in the file selector on the Z.
+Changed the color selection dialog on the Zaurus to a more user friendly version.
+
********** VERSION 2.1.7 ************
KO/Pi:
diff --git a/microkde/fncolordialog.cpp b/microkde/fncolordialog.cpp
new file mode 100755
index 0000000..f1ffa5b
--- a/dev/null
+++ b/microkde/fncolordialog.cpp
@@ -0,0 +1,334 @@
+/* this program for Sharp SLA300, B500, C7x0, C860 Linux PDA
+ Copyright (C) 2003-2005 Joe Kanemori.<kanemori@ymg.urban.ne.jp>
+
+ 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 Foundatibannwaon; 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; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+
+#include <qwidget.h>
+#include <qimage.h>
+#include <qbrush.h>
+#include <qpainter.h>
+#include <qlabel.h>
+#include "fncolordialog.h"
+
+
+//-----------------------------------------------------------------------------
+// FNPaletteBase
+//-----------------------------------------------------------------------------
+/*
+ * Constructs a Example which is a child of 'parent', with the
+ * name 'name' and widget flags set to 'f'
+ */
+FNPaletteBase::FNPaletteBase(QWidget* parent, const char* name, WFlags fl )
+ : QWidget( parent, name, fl ), bgcolor_(white), _isblock(false)
+{
+ this->setBackgroundMode(NoBackground);
+ wbuf_.resize(32, 32);
+}
+
+/*
+ * Destroys the object and frees any allocated resources
+ */
+FNPaletteBase::~FNPaletteBase()
+{
+ // no need to delete child widgets, Qt does it all for us
+}
+
+
+/*
+ * Painting event.
+ */
+void FNPaletteBase::paintEvent(QPaintEvent*)
+{
+ bitBlt(this, 0, 0, &wbuf_);
+}
+
+
+/*
+ * Painting event.
+ */
+void FNPaletteBase::resizeEvent(QResizeEvent* evt)
+{
+ QPixmap save(wbuf_);
+ wbuf_.resize(evt->size());
+ wbuf_.fill(bgcolor_);
+ bitBlt(&wbuf_, 0, 0, &save);
+ redraw();
+}
+
+
+/*
+ * Redraw method.
+ */
+void FNPaletteBase::redraw(bool force)
+{
+ if (!force) {
+ if (_isblock) {
+ return;
+ }
+ }
+ _isblock = true;
+ wbuf_.fill(bgcolor_);
+ QPainter pa;
+ pa.begin(&wbuf_);
+ drawImpl(pa);
+ pa.end();
+ repaint();
+ _isblock = false;
+}
+
+
+/*
+ * Redraw Implement
+ */
+void FNPaletteBase::drawImpl(QPainter& pa)
+{
+ pa.flush();
+}
+
+bool FNPaletteBase::pickColor(int x, int y)
+{
+ if (0 <= x && 0 <= y && x < width() && y < height()) {
+ selection_ = QColor(wbuf_.convertToImage().pixel(x, y));
+ return true;
+ } else {
+ return false;
+ }
+}
+
+void FNPaletteBase::mouseReleaseEvent(QMouseEvent* evt)
+{
+ //マウスリリースイベント(MouseClicked)
+ if (pickColor(evt->x(), evt->y())) {
+ emit clicked(this);
+ }
+}
+
+
+
+
+//-----------------------------------------------------------------------------
+// FNColorPalette
+//-----------------------------------------------------------------------------
+FNColorPalette::FNColorPalette(QColor c, QWidget* parent, const char* name, WFlags fl)
+:FNPaletteBase(parent, name, fl)
+{
+ setBGColor(c);
+}
+
+FNColorPalette::~FNColorPalette()
+{
+}
+
+
+
+
+//-----------------------------------------------------------------------------
+// FNHSVPalette
+//-----------------------------------------------------------------------------
+FNHSVPalette::FNHSVPalette(QWidget* parent, const char* name, WFlags fl)
+:FNPaletteBase(parent, name, fl), _hue(0)
+{
+}
+
+FNHSVPalette::~FNHSVPalette()
+{
+}
+
+void FNHSVPalette::hueChanged(int v)
+{
+ _hue = v;
+ redraw();
+}
+
+void FNHSVPalette::drawImpl(QPainter& pa)
+{
+ //描画実装
+ //HSVカラーパレットを描画
+ int wd = width();
+ int ht = height();
+ if (wd > 0 && ht > 0) {
+ QColor c;
+ double xs = (double)wd / 255.0;
+ double ys = (double)ht / 255.0;
+ for (int i = 0; i < 256; i += 32) {
+ int x1 = (int)((double)i * xs);
+ int x2 = (int)((double)(i + 32) * xs);
+ int w = x2 - x1;
+ if (1 > w) {
+ w = 1;
+ }
+ for (int j = 0; j <= 256; j += 32) {
+ int y1 = (int)((double)j * ys);
+ int y2 = (int)((double)(j + 32) * ys);
+ int h = y2 - y1;
+ if (1 > h) {
+ h = 1;
+ }
+ c.setHsv(_hue, 255 - j, 255 - i);
+ pa.fillRect(x1, y1, w, h, QBrush(c));
+ }
+ }
+ }
+ pa.flush();
+}
+
+
+
+
+//-----------------------------------------------------------------------------
+// FNColorDialog
+//-----------------------------------------------------------------------------
+FNColorDialog::FNColorDialog(QWidget* parent, const char* name, WFlags f)
+:QDialog(parent, name, true, f), _isblock(false)
+{
+ resize(200, 200);
+ QVBoxLayout* mainlayout = new QVBoxLayout(this);
+ setCaption("Color Selector");
+ mainlayout->setMargin(2);
+ mainlayout->setSpacing(2);
+ setSizeGripEnabled(true);
+ //基本パレット
+ int p = 0;
+ _base[p++] = new FNColorPalette(QColor(0, 0, 0), this);
+ _base[p++] = new FNColorPalette(QColor(0, 0, 255), this);
+ _base[p++] = new FNColorPalette(QColor(255, 0, 0), this);
+ _base[p++] = new FNColorPalette(QColor(255, 0, 255), this);
+ _base[p++] = new FNColorPalette(QColor(0, 255, 0), this);
+ _base[p++] = new FNColorPalette(QColor(0, 255, 255), this);
+ _base[p++] = new FNColorPalette(QColor(255, 255, 0), this);
+ _base[p++] = new FNColorPalette(QColor(255, 255, 255), this);
+ _base[p++] = new FNColorPalette(QColor(128, 128, 128), this);
+ _base[p++] = new FNColorPalette(QColor(0, 0, 128), this);
+ _base[p++] = new FNColorPalette(QColor(128, 0, 0), this);
+ _base[p++] = new FNColorPalette(QColor(128, 0, 128), this);
+ _base[p++] = new FNColorPalette(QColor(0, 128, 0), this);
+ _base[p++] = new FNColorPalette(QColor(0, 128, 128), this);
+ _base[p++] = new FNColorPalette(QColor(128, 128, 0), this);
+ _base[p++] = new FNColorPalette(QColor(200, 200, 200), this);
+
+ QGridLayout* baselayout = new QGridLayout(this, 2, 16);
+ baselayout->setMargin(0);
+ baselayout->setSpacing(0);
+ p = 0;
+ for (int i = 0; i < 2; ++i) {
+ for (int j = 0; j < 8; ++j) {
+ baselayout->addWidget(_base[p], i, j);
+ connect(_base[p], SIGNAL(clicked(FNPaletteBase*)), this, SLOT(basePaletteClicked(FNPaletteBase*)));
+ _base[p]->resize(24, 24);
+ _base[p]->setMaximumSize(24, 24);
+ _base[p]->setMinimumSize(24, 24);
+ p++;
+ }
+ }
+ mainlayout->addLayout(baselayout);
+
+ //HUE
+ _hue = new QSlider(Horizontal, this);
+ _hue->setMinValue(0);
+ _hue->setMaxValue(360);
+ _hue->setLineStep(1);
+ _hue->setPageStep(60);
+ _hue->setValue(0);
+ //sliderReleased
+ mainlayout->addWidget(_hue);
+
+ //HSVパレット
+ QHBoxLayout* hsvlayout = new QHBoxLayout(this);
+ hsvlayout->setMargin(0);
+ hsvlayout->setSpacing(2);
+ _palette = new FNHSVPalette(this);
+ _palette->setMinimumSize(90, 100);
+ hsvlayout->addWidget(_palette);
+ connect(_palette, SIGNAL(clicked(FNPaletteBase*)), this, SLOT(hsvPaletteClicked(FNPaletteBase*)));
+
+ //選択色
+ QGridLayout* selectLayout = new QGridLayout(this, 4, 4);
+ _select = new FNColorPalette(black, this);
+ _select->resize(48, 32);
+ _select->setMinimumSize(48, 32);
+ _select->setMaximumSize(32767, 32);
+ selectLayout->addMultiCellWidget(_select, 0, 0, 1, 3);
+
+ //RGBコントローラ
+ selectLayout->addWidget(new QLabel("R:", this), 1, 0);
+ _r = new QSpinBox(0, 255, 1, this);
+ _r->setValue(0);
+ selectLayout->addMultiCellWidget(_r, 1, 1, 1, 3);
+
+ selectLayout->addWidget(new QLabel("G:", this), 2, 0);
+ _g = new QSpinBox(0, 255, 1, this);
+ _g->setValue(0);
+ selectLayout->addMultiCellWidget(_g, 2, 2, 1, 3);
+
+ selectLayout->addWidget(new QLabel("B:", this), 3, 0);
+ _b = new QSpinBox(0, 255, 1, this);
+ _b->setValue(0);
+ selectLayout->addMultiCellWidget(_b, 3, 3, 1, 3);
+
+ hsvlayout->addLayout(selectLayout);
+ mainlayout->addLayout(hsvlayout);
+
+ connect(_hue, SIGNAL(valueChanged(int)), _palette, SLOT(hueChanged(int)));
+ connect(_r, SIGNAL(valueChanged(int)), this, SLOT(rgbChanged(int)));
+ connect(_g, SIGNAL(valueChanged(int)), this, SLOT(rgbChanged(int)));
+ connect(_b, SIGNAL(valueChanged(int)), this, SLOT(rgbChanged(int)));
+}
+
+FNColorDialog::~FNColorDialog()
+{
+}
+
+void FNColorDialog::rgbChanged(int)
+{
+ int r = _r->value();
+ int g = _g->value();
+ int b = _b->value();
+ setColor(QColor(r, g, b));
+}
+
+QColor FNColorDialog::color() const
+{
+ return _select->color();
+}
+void FNColorDialog::setColor(QColor c)
+{
+ if (_isblock) {
+ return;
+ }
+ _isblock = true;
+
+ int r;
+ int g;
+ int b;
+
+ c.rgb(&r, &g, &b);
+ _r->setValue(r);
+ _g->setValue(g);
+ _b->setValue(b);
+ _select->setBGColor(c);
+ _isblock = false;
+}
+
+void FNColorDialog::basePaletteClicked(FNPaletteBase* btn)
+{
+ setColor(btn->color());
+ accept();
+}
+
+void FNColorDialog::hsvPaletteClicked(FNPaletteBase* btn)
+{
+ setColor(btn->color());
+}
diff --git a/microkde/fncolordialog.h b/microkde/fncolordialog.h
new file mode 100755
index 0000000..615d2ed
--- a/dev/null
+++ b/microkde/fncolordialog.h
@@ -0,0 +1,137 @@
+/* this program for Sharp SLA300, B500, C7x0, C860 Linux PDA
+ Copyright (C) 2003-2005 Joe Kanemori.<kanemori@ymg.urban.ne.jp>
+
+ 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 Foundatibannwaon; 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; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+/*
+2005/02/27 FreeNote 1.11.10pre
+・PDFの出力形式を一部変更
+・インポート時のバグfix
+
+*/
+#ifndef FNPALETTEDIALOG_H
+#define FNPALETTEDIALOG_H
+#include <qwidget.h>
+#include <qpixmap.h>
+#include <qpainter.h>
+#include <qcolor.h>
+#include <qdialog.h>
+#include <qlayout.h>
+#include <qslider.h>
+#include <qspinbox.h>
+
+//-----------------------------------------------------------------------------
+// FNPaletteBase
+//-----------------------------------------------------------------------------
+class Q_EXPORT FNPaletteBase : public QWidget
+{
+ Q_OBJECT
+public:
+
+ FNPaletteBase(QWidget* parent = 0, const char* name = 0, WFlags fl = 0);
+
+
+ virtual ~FNPaletteBase();
+
+
+ void setBGColor(QColor c) {
+ bgcolor_ = c;
+ selection_ = c;
+ redraw();
+ };
+ QColor color() const {
+ return selection_;
+ };
+
+protected:
+ virtual void paintEvent(QPaintEvent*);
+ virtual void resizeEvent(QResizeEvent* evt);
+ virtual void redraw(bool force=false);
+ virtual void drawImpl(QPainter& pa);
+ virtual void mouseReleaseEvent(QMouseEvent* evt);
+ virtual bool pickColor(int x, int y);
+ QColor selection_;
+private:
+ QPixmap wbuf_;
+ QColor bgcolor_;
+ bool _isblock;
+
+signals:
+ void clicked(FNPaletteBase* sender);
+};
+
+
+
+
+//-----------------------------------------------------------------------------
+// FNColorPalette
+//-----------------------------------------------------------------------------
+class Q_EXPORT FNColorPalette : public FNPaletteBase
+{
+ Q_OBJECT
+public:
+ FNColorPalette(QColor c, QWidget* parent = 0, const char* name = 0, WFlags fl = 0);
+ virtual ~FNColorPalette();
+};
+
+
+
+
+//-----------------------------------------------------------------------------
+// FNHSVPalette
+//-----------------------------------------------------------------------------
+class Q_EXPORT FNHSVPalette : public FNPaletteBase
+{
+ Q_OBJECT
+public:
+ FNHSVPalette(QWidget* parent = 0, const char* name = 0, WFlags fl = 0);
+ virtual ~FNHSVPalette();
+public slots:
+ void hueChanged(int v);
+protected:
+ virtual void drawImpl(QPainter& pa);
+ int _hue;
+};
+
+
+
+
+//-----------------------------------------------------------------------------
+// FNColorDialog
+//-----------------------------------------------------------------------------
+class Q_EXPORT FNColorDialog : public QDialog
+{
+ Q_OBJECT
+public:
+ FNColorDialog(QWidget* parent=0, const char* name=0, WFlags f=0);
+ virtual ~FNColorDialog();
+ void setColor(QColor c);
+ QColor color() const;
+public slots:
+ virtual void basePaletteClicked(FNPaletteBase*);
+ virtual void hsvPaletteClicked(FNPaletteBase*);
+ void rgbChanged(int);
+private:
+ FNHSVPalette* _palette;
+ FNColorPalette* _base[16];
+ QSlider* _hue;
+ FNColorPalette* _select;
+ QSpinBox* _r;
+ QSpinBox* _g;
+ QSpinBox* _b;
+ bool _isblock;
+
+};
+#endif //FNPALETTEDIALOG_H
diff --git a/microkde/kcolordialog.cpp b/microkde/kcolordialog.cpp
index a3d8973..b9bb5bb 100644
--- a/microkde/kcolordialog.cpp
+++ b/microkde/kcolordialog.cpp
@@ -10,84 +10,10 @@
#include <kglobal.h>
QColor KColorDialog::getColor( ) const
{
- QColor c ( r->value(), g->value(), b->value() );
- lar->setText ( "R: " + QString::number ( c.red() ) );
- lag->setText ( "G: " + QString::number ( c.green() ) );
- lab->setText ( "B: " + QString::number ( c.blue() ) );
- return c;
+ return color();
}
-void KColorDialog::setColor( const QColor & d )
-{
- r->setValue(d.red() );
- g->setValue(d.green() );
- b->setValue(d.blue() );
- old_color->setPalette( QPalette( d.dark(), d ) );
- lar->setText ( "R: " + QString::number ( d.red() ) );
- lag->setText ( "G: " + QString::number ( d.green() ) );
- lab->setText ( "B: " + QString::number ( d.blue() ) );
-
-}
-KColorDialog::KColorDialog( QWidget *p ):QDialog( p, "input-dialog", true )
-{
- setCaption( i18n("Choose Color") );
-
- setMaximumSize( QApplication::desktop()->width() - 20, QApplication::desktop()->height() - 40 ); // for zaurus 5500er.
- QGridLayout* lay = new QGridLayout ( this, 4, 2 );
- lay->setSpacing( 6 );
- lay->setMargin( 11 );
-
- old_color = new QLabel("Old color",this);
- old_color->setFrameStyle( QFrame::Panel | QFrame::Plain );
- old_color->setLineWidth( 1 );
- lay->addWidget(old_color, 0, 0);
-
- new_color = new QLabel("New color", this);
- new_color->setFrameStyle( QFrame::Panel | QFrame::Plain );
- new_color->setLineWidth( 1 );
- lay->addWidget(new_color, 0, 1);
- new_color->setAlignment( AlignCenter );
- QHBox* hb = new QHBox ( this );
- lar = new QLabel( hb );
- lag = new QLabel( hb );
- lab = new QLabel( hb );
- lay->addMultiCellWidget( hb,1,1, 0,1 );
-
- QLabel* lr = new QLabel ( "Red:", this );
- lay->addWidget( lr,2,0 );
- r = new QSlider ( 0, 255, 1, 1, Horizontal, this );
- lay->addWidget(r ,2,1 );
-
- QLabel* lg = new QLabel( "Green:",this );
- lay->addWidget(lg ,3,0 );
- g = new QSlider ( 0, 255, 1, 1, Horizontal, this );
- lay->addWidget( g ,3,1 );
-
- QLabel* lb = new QLabel ( "Blue:",this );
- lay->addWidget( lb,4,0 );
- b = new QSlider ( 0, 255, 1, 1, Horizontal, this );
- lay->addWidget(b ,4,1 );
-
- QColor d = backgroundColor();
- r->setValue(d.red() );
- g->setValue(d.green() );
- b->setValue(d.blue() );
- old_color->setPalette( QPalette( d.dark() , d ) );
- // kannst du wieder reinnehmen, aber es geht auch so.
- QPushButton * ok = new QPushButton (i18n(" OK "), this );
- ok->setDefault( true );
- QPushButton * cancel = new QPushButton (i18n(" Cancel "), this );
-
- lay->addWidget(ok ,5,0 );
- lay->addWidget(cancel ,5,1 );
- connect (ok, SIGNAL( clicked() ), this ,SLOT (accept() ));
- connect (cancel, SIGNAL( clicked() ), this ,SLOT (reject() ));
- connect (r, SIGNAL( valueChanged ( int ) ), this ,SLOT (updateColor( int ) ));
- connect (g, SIGNAL( valueChanged ( int ) ), this ,SLOT (updateColor( int ) ));
- connect (b, SIGNAL( valueChanged ( int ) ), this ,SLOT (updateColor( int ) ));
-}
-void KColorDialog::updateColor( int )
+KColorDialog::KColorDialog( QWidget *p ):FNColorDialog( p, "input-dialog" )
{
- QColor c = getColor( ) ;
- new_color->setPalette( QPalette( c.dark(), c ) );
+
}
diff --git a/microkde/kcolordialog.h b/microkde/kcolordialog.h
index bb2045d..0858352 100644
--- a/microkde/kcolordialog.h
+++ b/microkde/kcolordialog.h
@@ -6,19 +6,14 @@
#include <qdialog.h>
#include <qslider.h>
#include <qlabel.h>
-class KColorDialog : public QDialog
+#include <fncolordialog.h>
+
+class KColorDialog : public FNColorDialog
{
Q_OBJECT
public:
KColorDialog( QWidget *p );
- QColor getColor( ) const;
- void setColor( const QColor &);
- private:
- QSlider *r, *g, *b;
- QLabel * old_color, *new_color;
- QLabel *lar, *lag, *lab;
-private slots:
- void updateColor( int );
+ QColor getColor( ) const;
};
diff --git a/microkde/microkdeE.pro b/microkde/microkdeE.pro
index c54fb22..335fcd0 100644
--- a/microkde/microkdeE.pro
+++ b/microkde/microkdeE.pro
@@ -16,7 +16,7 @@ DESTDIR=$(QPEDIR)/lib
INTERFACES = \
HEADERS = \
-qlayoutengine_p.h \
+qlayoutengine_p.h fncolordialog.h\
KDGanttMinimizeSplitter.h \
kapplication.h \
kaudioplayer.h \
@@ -104,7 +104,7 @@ KDGanttMinimizeSplitter.h \
SOURCES = \
-KDGanttMinimizeSplitter.cpp \
+KDGanttMinimizeSplitter.cpp fncolordialog.cpp \
kapplication.cpp \
kcalendarsystem.cpp \
kcalendarsystemgregorian.cpp \