diff options
Diffstat (limited to 'opensuse/core/tdelibs.old/rubberband-selection.diff')
-rw-r--r-- | opensuse/core/tdelibs.old/rubberband-selection.diff | 380 |
1 files changed, 380 insertions, 0 deletions
diff --git a/opensuse/core/tdelibs.old/rubberband-selection.diff b/opensuse/core/tdelibs.old/rubberband-selection.diff new file mode 100644 index 000000000..d2b75f17c --- /dev/null +++ b/opensuse/core/tdelibs.old/rubberband-selection.diff @@ -0,0 +1,380 @@ +Index: kdefx/kstyle.cpp +=================================================================== +--- kdefx/kstyle.cpp.orig ++++ kdefx/kstyle.cpp +@@ -154,6 +154,7 @@ struct KStylePrivate + bool menuAltKeyNavigation : 1; + bool menuDropShadow : 1; + bool sloppySubMenus : 1; ++ bool semiTransparentRubberband : 1; + int popupMenuDelay; + float menuOpacity; + +@@ -187,6 +188,7 @@ KStyle::KStyle( KStyleFlags flags, KStyl + d->menuAltKeyNavigation = settings.readBoolEntry("/KStyle/Settings/MenuAltKeyNavigation", true); + d->scrollablePopupmenus = settings.readBoolEntry("/KStyle/Settings/ScrollablePopupMenus", false); + d->menuDropShadow = settings.readBoolEntry("/KStyle/Settings/MenuDropShadow", false); ++ d->semiTransparentRubberband = settings.readBoolEntry("/KStyle/Settings/SemiTransparentRubberband", false); + d->menuHandler = NULL; + + if (useMenuTransparency) { +@@ -553,7 +555,57 @@ void KStyle::drawPrimitive( PrimitiveEle + else + // General handle, probably a kicker applet handle. + drawKStylePrimitive( KPE_GeneralHandle, p, widget, r, cg, flags, opt ); +- ++#if QT_VERSION >= 0x030300 ++#ifdef HAVE_XRENDER ++ } else if ( d->semiTransparentRubberband && pe == QStyle::PE_RubberBand ) { ++ QRect rect = r.normalize(); ++ QPoint point; ++ point = p->xForm( point ); ++ ++ static XRenderColor clr = { 0, 0, 0, 0 }; ++ static unsigned long fillColor = 0; ++ if ( fillColor != cg.highlight().rgb() ) { ++ fillColor = cg.highlight().rgb(); ++ ++ unsigned long color = fillColor << 8 | 0x40; ++ ++ int red = (color >> 24) & 0xff; ++ int green = (color >> 16) & 0xff; ++ int blue = (color >> 8) & 0xff; ++ int alpha = (color >> 0) & 0xff; ++ ++ red = red * alpha / 255; ++ green = green * alpha / 255; ++ blue = blue * alpha / 255; ++ ++ clr.red = (red << 8) + red; ++ clr.green = (green << 8) + green; ++ clr.blue = (blue << 8) + blue; ++ clr.alpha = (alpha << 8) + alpha; ++ } ++ ++ XRenderFillRectangle( ++ p->device()->x11Display(), ++ PictOpOver, ++ p->device()->x11RenderHandle(), ++ &clr, ++ rect.x() + point.x(), ++ rect.y() + point.y(), ++ rect.width(), ++ rect.height() ); ++ ++ p->save(); ++ p->setRasterOp( Qt::CopyROP ); ++ p->setPen( QPen( cg.highlight().dark( 160 ), 1 ) ); ++ p->setBrush( NoBrush ); ++ p->drawRect( ++ rect.x() + point.x(), ++ rect.y() + point.y(), ++ rect.width(), ++ rect.height() ); ++ p->restore(); ++#endif ++#endif + } else + QCommonStyle::drawPrimitive( pe, p, r, cg, flags, opt ); + } +Index: kdeui/kiconview.cpp +=================================================================== +--- kdeui/kiconview.cpp.orig ++++ kdeui/kiconview.cpp +@@ -548,7 +548,7 @@ void KIconViewItem::calcRect( const QStr + r = m_wordWrap->boundingRect(); + + int realWidth = QMAX( QMIN( r.width() + 4, tw ), fm->width( "X" ) ); +- itemTextRect.setWidth( realWidth ); ++ itemTextRect.setWidth( realWidth + 4 ); + itemTextRect.setHeight( r.height() ); + + int w = 0; int h = 0; int y = 0; +@@ -699,11 +699,13 @@ void KIconViewItem::paintPixmap( QPainte + + void KIconViewItem::paintText( QPainter *p, const QColorGroup &cg ) + { +- int textX = textRect( false ).x() + 2; ++ int textX = textRect( false ).x() + 4; + int textY = textRect( false ).y(); + + if ( isSelected() ) { +- p->fillRect( textRect( false ), cg.highlight() ); ++ p->setBrush(QBrush(cg.highlight())); ++ p->setPen(QPen(cg.highlight())); ++ p->drawRoundRect( textRect( false ) ,1000/textRect(false).width(),1000/textRect(false).height() ); + p->setPen( QPen( cg.highlightedText() ) ); + } else { + if ( iconView()->itemTextBackground() != NoBrush ) +Index: kdeui/kjanuswidget.cpp +=================================================================== +--- kdeui/kjanuswidget.cpp.orig ++++ kdeui/kjanuswidget.cpp +@@ -49,16 +49,19 @@ class KJanusWidget::IconListItem : publi + { + public: + IconListItem( QListBox *listbox, const QPixmap &pixmap, +- const QString &text ); ++ const QString &text ); + virtual int height( const QListBox *lb ) const; + virtual int width( const QListBox *lb ) const; + int expandMinimumWidth( int width ); ++ void highlight( bool erase ); + + protected: + const QPixmap &defaultPixmap(); + void paint( QPainter *painter ); +- ++ + private: ++ void paintContents( QPainter *painter ); ++ + QPixmap mPixmap; + int mMinimumWidth; + }; +@@ -141,6 +144,8 @@ KJanusWidget::KJanusWidget( QWidget *par + + mIconList->verticalScrollBar()->installEventFilter( this ); + connect( mIconList, SIGNAL(selectionChanged()), SLOT(slotShowPage())); ++ connect( mIconList, SIGNAL(onItem(QListBoxItem *)), SLOT(slotOnItem(QListBoxItem *))); ++ + hbox->addSpacing( KDialog::marginHint() ); + page = new QFrame( this ); + hbox->addWidget( page, 10 ); +@@ -259,7 +264,7 @@ void KJanusWidget::slotReopen( QListView + } + + QFrame *KJanusWidget::addPage( const QString &itemName, const QString &header, +- const QPixmap &pixmap ) ++ const QPixmap &pixmap ) + { + QStringList items; + items << itemName; +@@ -269,8 +274,8 @@ QFrame *KJanusWidget::addPage( const QSt + + + QVBox *KJanusWidget::addVBoxPage( const QStringList &items, +- const QString &header, +- const QPixmap &pixmap ) ++ const QString &header, ++ const QPixmap &pixmap ) + { + if( !mValid ) + { +@@ -721,6 +726,12 @@ void KJanusWidget::slotItemClicked(QList + it->setOpen(!it->isOpen()); + } + ++// hack because qt does not support Q_OBJECT in nested classes ++void KJanusWidget::slotOnItem(QListBoxItem *qitem) ++{ ++ mIconList->slotOnItem( qitem ); ++} ++ + void KJanusWidget::setFocus() + { + if( !mValid ) { return; } +@@ -929,11 +940,11 @@ bool KJanusWidget::eventFilter( QObject + KJanusWidget::IconListBox::IconListBox( QWidget *parent, const char *name, + WFlags f ) + :KListBox( parent, name, f ), mShowAll(false), mHeightValid(false), +- mWidthValid(false) ++ mWidthValid(false), ++ mOldItem(0) + { + } + +- + void KJanusWidget::IconListBox::updateMinimumHeight() + { + if( mShowAll && !mHeightValid ) +@@ -995,6 +1006,45 @@ void KJanusWidget::IconListBox::setShowA + } + + ++void KJanusWidget::IconListBox::leaveEvent( QEvent *ev ) ++{ ++ KListBox::leaveEvent( ev ); ++ ++ if ( mOldItem && !mOldItem->isSelected() ) ++ { ++ ((KJanusWidget::IconListItem *) mOldItem)->highlight( true ); ++ mOldItem = 0; ++ } ++} ++ ++// hack because qt does not support Q_OBJECT in nested classes ++void KJanusWidget::IconListBox::slotOnItem(QListBoxItem *qitem) ++{ ++ KListBox::slotOnItem( qitem ); ++ ++ if ( qitem == mOldItem ) ++ { ++ return; ++ } ++ ++ if ( mOldItem && !mOldItem->isSelected() ) ++ { ++ ((KJanusWidget::IconListItem *) mOldItem)->highlight( true ); ++ } ++ ++ KJanusWidget::IconListItem *item = dynamic_cast< KJanusWidget::IconListItem * >( qitem ); ++ if ( item && !item->isSelected() ) ++ { ++ item->highlight( false ); ++ mOldItem = item; ++ } ++ else ++ { ++ mOldItem = 0; ++ } ++} ++ ++ + + KJanusWidget::IconListItem::IconListItem( QListBox *listbox, const QPixmap &pixmap, + const QString &text ) +@@ -1006,6 +1056,7 @@ KJanusWidget::IconListItem::IconListItem + mPixmap = defaultPixmap(); + } + setText( text ); ++ setCustomHighlighting( true ); + mMinimumWidth = 0; + } + +@@ -1017,6 +1068,36 @@ int KJanusWidget::IconListItem::expandMi + } + + ++void KJanusWidget::IconListItem::highlight( bool erase ) ++{ ++ QRect r = listBox()->itemRect( this ); ++ r.addCoords( 1, 1, -1, -1 ); ++ ++ QPainter p( listBox()->viewport() ); ++ p.setClipRegion( r ); ++ ++ const QColorGroup &cg = listBox()->colorGroup(); ++ if ( erase ) ++ { ++ p.setPen( cg.base() ); ++ p.setBrush( cg.base() ); ++ p.drawRect( r ); ++ } ++ else ++ { ++ p.setBrush( cg.highlight().light( 120 ) ); ++ p.drawRect( r ); ++ ++ p.setPen( cg.highlight().dark( 140 ) ); ++ p.drawRect( r ); ++ } ++ ++ p.setPen( cg.foreground() ); ++ p.translate( r.x() - 1, r.y() - 1 ); ++ paintContents( &p ); ++} ++ ++ + const QPixmap &KJanusWidget::IconListItem::defaultPixmap() + { + static QPixmap *pix=0; +@@ -1044,15 +1125,34 @@ const QPixmap &KJanusWidget::IconListIte + + void KJanusWidget::IconListItem::paint( QPainter *painter ) + { ++ QRect itemPaintRegion( listBox()->itemRect( this ) ); ++ QRect r( 1, 1, itemPaintRegion.width() - 2, itemPaintRegion.height() - 2); ++ ++ if ( isSelected() ) ++ { ++ painter->eraseRect( r ); ++ ++ painter->save(); ++ painter->setPen( listBox()->colorGroup().highlight().dark( 160 ) ); ++ painter->drawRect( r ); ++ painter->restore(); ++ } ++ ++ paintContents( painter ); ++} ++ ++ ++void KJanusWidget::IconListItem::paintContents( QPainter *painter ) ++{ + QFontMetrics fm = painter->fontMetrics(); + int ht = fm.boundingRect( 0, 0, 0, 0, Qt::AlignCenter, text() ).height(); + int wp = mPixmap.width(); + int hp = mPixmap.height(); ++ painter->drawPixmap( (mMinimumWidth - wp) / 2, 5, mPixmap ); + +- painter->drawPixmap( (mMinimumWidth-wp)/2, 5, mPixmap ); + if( !text().isEmpty() ) + { +- painter->drawText( 0, hp+7, mMinimumWidth, ht, Qt::AlignCenter, text() ); ++ painter->drawText( 1, hp + 7, mMinimumWidth - 2, ht, Qt::AlignCenter, text() ); + } + } + +@@ -1082,6 +1182,7 @@ int KJanusWidget::IconListItem::width( c + void KJanusWidget::virtual_hook( int, void* ) + { /*BASE::virtual_hook( id, data );*/ } + ++ + // TODO: In TreeList, if the last child of a node is removed, and there is no corrsponding widget for that node, allow the caller to + // delete the node. + void KJanusWidget::removePage( QWidget *page ) +@@ -1129,6 +1230,7 @@ void KJanusWidget::removePage( QWidget * + } + } + ++ + QString KJanusWidget::pageTitle(int index) const + { + if (!d || !d->mIntToTitle.contains(index)) +@@ -1137,6 +1239,7 @@ QString KJanusWidget::pageTitle(int inde + return d->mIntToTitle[index]; + } + ++ + QWidget *KJanusWidget::pageWidget(int index) const + { + if (!d || !d->mIntToPage.contains(index)) +Index: kdeui/kjanuswidget.h +=================================================================== +--- kdeui/kjanuswidget.h.orig ++++ kdeui/kjanuswidget.h +@@ -71,6 +71,8 @@ class KDEUI_EXPORT KJanusWidget : public + private: + class IconListBox : public KListBox + { ++ friend class KJanusWidget; ++ + public: + IconListBox( QWidget *parent=0, const char *name=0, WFlags f=0 ); + void updateMinimumHeight(); +@@ -79,10 +81,15 @@ class KDEUI_EXPORT KJanusWidget : public + void invalidateWidth(); + void setShowAll( bool showAll ); + ++ protected: ++ void slotOnItem( QListBoxItem *item ); ++ virtual void leaveEvent( QEvent * ); ++ + private: + bool mShowAll; + bool mHeightValid; + bool mWidthValid; ++ QListBoxItem *mOldItem; + }; + + public: +@@ -558,6 +565,8 @@ class KDEUI_EXPORT KJanusWidget : public + private slots: + bool slotShowPage(); + void slotFontChanged(); ++ ++ void slotOnItem(QListBoxItem *item); + void slotItemClicked(QListViewItem *it); + void pageGone(QObject *obj); // signal from the added page's "destroyed" signal + void slotReopen(QListViewItem *item); |