From 32ace734b36de108d8322157aaa106069df16477 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Fri, 1 Feb 2013 17:25:43 -0600 Subject: Fix FTBFS --- kghostview/marklist.cpp | 247 ---------------------------------------------- kghostview/marklist.h | 90 ----------------- kghostview/martdelist.cpp | 247 ++++++++++++++++++++++++++++++++++++++++++++++ kghostview/martdelist.h | 90 +++++++++++++++++ 4 files changed, 337 insertions(+), 337 deletions(-) delete mode 100644 kghostview/marklist.cpp delete mode 100644 kghostview/marklist.h create mode 100644 kghostview/martdelist.cpp create mode 100644 kghostview/martdelist.h (limited to 'kghostview') diff --git a/kghostview/marklist.cpp b/kghostview/marklist.cpp deleted file mode 100644 index 9505b965..00000000 --- a/kghostview/marklist.cpp +++ /dev/null @@ -1,247 +0,0 @@ -/** - * Copyright (C) 1997-2002 the KGhostView authors. See file AUTHORS. - * - * 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; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#include "marklist.moc" - -#include - -#include -#include -#include -#include -#include - -#include -#include -#include - -#include "kgv_miniwidget.h" - -MarkListItem::MarkListItem(TQWidget *parent, const TQString &text, const TQString &tip, const TQColor &color, KGVMiniWidget* miniW, int pageNum) - : TQWidget( parent ), - _miniWidget( miniW ), - _pageNum( pageNum ), - _requested( false ) -{ - //kdDebug( 4500 ) << "MarkListItem::MarkListItem( _ , " << text <<" , " << tip << " , " << color << ", _ ," << pageNum << " )" << endl; - TQBoxLayout *l = new TQVBoxLayout( this, 5, 0 ); - _thumbnailW = new TQWidget( this ); - _checkBox = new TQCheckBox( text, this ); - l->addWidget( _thumbnailW, 1 ); - l->addWidget( _checkBox, 0, TQt::AlignHCenter ); - TQWhatsThis::add( _checkBox, i18n( "Using this checkbox you can select pages for printing." ) ); - setFixedHeight( 100 ); - _backgroundColor = color; - setPaletteBackgroundColor( _backgroundColor ); - TQToolTip::add(this, tip); - // TODO: Put a little page number or other place-holder when there is no thumbnail to display. -} - -bool MarkListItem::isChecked() const -{ - return _checkBox->isChecked(); -} - -void MarkListItem::toggle() -{ - _checkBox->toggle(); -} - -void MarkListItem::setChecked( bool checked ) -{ - _checkBox->setChecked(checked); -} - -void MarkListItem::setPixmap( TQPixmap thumbnail ) -{ - // The line below is needed to work around certain "features" of styles such as liquid - // see bug:61711 for more info (LPC, 20 Aug '03) - _thumbnailW->setBackgroundOrigin( TQWidget::WidgetOrigin ); - TQPixmap pm; - pm.convertFromImage( thumbnail.convertToImage().smoothScale( _thumbnailW->size() ) ); - _thumbnailW->setPaletteBackgroundPixmap( pm ); - _requested = false; -} - -void MarkListItem::setSelected( bool selected ) -{ - if (selected) - setPaletteBackgroundColor( TQApplication::palette().active().highlight() ); - else - setPaletteBackgroundColor( _backgroundColor ); -} - -void MarkListItem::resizeEvent( TQResizeEvent * ) -{ - if ( _thumbnailW->paletteBackgroundPixmap() ) { - TQPixmap pm; - pm.convertFromImage( _thumbnailW->paletteBackgroundPixmap()->convertToImage().smoothScale( _thumbnailW->size() ) ); - _thumbnailW->setPaletteBackgroundPixmap( pm ); - } -} - -void MarkListItem::paintEvent( TQPaintEvent* ) -{ - /* TODO: - * We should cancel things which flipped into view and then flipped out. - * - * Now, if one scrolls through a 1000 page document to the end and then lingers on the - * last pages, these will take forever to appear in thumbnail form. - */ - if ( _requested ) return; - if ( !_thumbnailW->paletteBackgroundPixmap() || _thumbnailW->paletteBackgroundPixmap()->isNull() ) { - _miniWidget->getThumbnailService()->delayedGetThumbnail( _pageNum, TQT_TQOBJECT(this), TQT_SLOT( setPixmap( TQPixmap ) ) ); - _requested = true; - } -} - - -/* MarkList */ - -MarkList::MarkList( TQWidget* parent, const char* name, KGVMiniWidget* mini) - : TQTable( parent, name ), - _selected ( -1 ), -_miniWidget( mini ) -{ - setNumCols( 1 ); - setLeftMargin( 0 ); // we don't want the vertical header - horizontalHeader()->setLabel( 0, i18n("Page") ); - - connect( this, TQT_SIGNAL( currentChanged( int, int ) ), - this, TQT_SIGNAL( selected( int ) ) ); -} - -TQValueList MarkList::markList() const -{ - TQValueList list; - MarkListItem *_item; - for(int i = 0; i < numRows(); i++) - { - _item = dynamic_cast( cellWidget( i, 0 ) ); - assert( _item ); - if ( _item->isChecked() ) list << (i + 1); - } - return list; -} - -void MarkList::insertItem( const TQString& text, int index, const TQString& tip) -{ - MarkListItem *_item; - _item = new MarkListItem( this, text, tip, viewport()->paletteBackgroundColor(), _miniWidget, index ); - setNumRows( index + 1 ); - setCellWidget( index, 0, _item ); - setRowHeight( index, _item->height() ); -} - -void MarkList::select( int index ) -{ - MarkListItem *_item; - setCurrentCell( index, 0 ); - _item = dynamic_cast( cellWidget( _selected, 0 ) ); - if (_item) _item -> setSelected( false ); - _selected = index; - _item = dynamic_cast( cellWidget( _selected, 0 ) ); - if (_item) _item -> setSelected( true ); - clearFocus(); -} - -void MarkList::clear() -{ - for ( int i = 0; i != numRows() ; ++i ) { - clearCellWidget( i, 0 ); - } - setNumRows( 0 ); -} - -void MarkList::markCurrent() -{ - MarkListItem *_item = dynamic_cast( cellWidget( currentRow(), 0 ) ); - assert( _item ); - _item->toggle(); -} - -void MarkList::markAll() -{ - MarkListItem *_item; - for(int i = 0; i < numRows(); i++) - { - _item = dynamic_cast( cellWidget( i, 0 ) ); - assert( _item ); - _item->setChecked( true ); - } -} - -void MarkList::markEven() -{ - MarkListItem *_item; - for(int i = 1; i < numRows(); i = i + 2) - { - _item = dynamic_cast( cellWidget( i, 0 ) ); - assert( _item ); - _item->setChecked( true ); - } -} - -void MarkList::markOdd() -{ - MarkListItem *_item; - for(int i = 0; i < numRows(); i = i + 2) - { - _item = dynamic_cast( cellWidget( i, 0 ) ); - assert( _item ); - _item->setChecked( true ); - } -} - -void MarkList::toggleMarks() -{ - MarkListItem *_item; - for(int i = 0; i < numRows(); i++) - { - _item = dynamic_cast( cellWidget( i, 0 ) ); - assert( _item ); - _item->toggle(); - } -} - -void MarkList::removeMarks() -{ - MarkListItem *_item; - for( int i = 0; i < numRows(); i++ ) { - _item = dynamic_cast( cellWidget( i, 0 ) ); - assert( _item ); - _item->setChecked( false ); - } -} - -void MarkList::viewportResizeEvent ( TQResizeEvent * ) -{ - MarkListItem *_item; - if( visibleWidth() != columnWidth( 0 ) ) - { - setColumnWidth( 0, visibleWidth() ); - for( int i = 0; i < numRows(); ++i ) - { - _item = dynamic_cast( cellWidget( i, 0 ) ); - assert( _item ); - _item->setFixedSize( visibleWidth(), _item->height() ); - } - } -} - -// vim:sw=4:sts=4:ts=8:noet diff --git a/kghostview/marklist.h b/kghostview/marklist.h deleted file mode 100644 index 54992a88..00000000 --- a/kghostview/marklist.h +++ /dev/null @@ -1,90 +0,0 @@ -/** - * Copyright (C) 1997-2002 the KGhostView authors. See file AUTHORS. - * - * 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; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef MARKLIST_H -#define MARKLIST_H - -#include -#include - -class KGVMiniWidget; - -class MarkListItem : public TQWidget -{ - Q_OBJECT - -public: - MarkListItem( TQWidget *parent, const TQString &text, const TQString &tip, const TQColor &color, KGVMiniWidget*, int ); - - bool isChecked() const; - -public slots: - void toggle(); - void setChecked( bool checked ); - void setPixmap( TQPixmap thumbnail ); - - void setSelected( bool selected ); - -private: - void resizeEvent( TQResizeEvent * ); - void paintEvent( TQPaintEvent* ); -private: - TQWidget *_thumbnailW; - TQCheckBox *_checkBox; - TQColor _backgroundColor; - KGVMiniWidget* _miniWidget; - const int _pageNum; - bool _requested; -}; - -class MarkList: public TQTable -{ - Q_OBJECT - - -public: - MarkList( TQWidget* parent = 0, const char* name = 0, KGVMiniWidget* = 0 ); - - TQValueList markList() const; - void insertItem( const TQString& text, int index = -1, - const TQString& tip = TQString() ); - -public slots: - void select( int index ); - void markCurrent(); - void markAll(); - void markEven(); - void markOdd(); - void toggleMarks(); - void removeMarks(); - void clear(); - -protected: - virtual void viewportResizeEvent ( TQResizeEvent * ); - -signals: - void selected( int ); - -private: - int _selected; - KGVMiniWidget* _miniWidget; -}; - -#endif - -// vim:sw=4:sts=4:ts=8:noet diff --git a/kghostview/martdelist.cpp b/kghostview/martdelist.cpp new file mode 100644 index 00000000..9505b965 --- /dev/null +++ b/kghostview/martdelist.cpp @@ -0,0 +1,247 @@ +/** + * Copyright (C) 1997-2002 the KGhostView authors. See file AUTHORS. + * + * 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; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#include "marklist.moc" + +#include + +#include +#include +#include +#include +#include + +#include +#include +#include + +#include "kgv_miniwidget.h" + +MarkListItem::MarkListItem(TQWidget *parent, const TQString &text, const TQString &tip, const TQColor &color, KGVMiniWidget* miniW, int pageNum) + : TQWidget( parent ), + _miniWidget( miniW ), + _pageNum( pageNum ), + _requested( false ) +{ + //kdDebug( 4500 ) << "MarkListItem::MarkListItem( _ , " << text <<" , " << tip << " , " << color << ", _ ," << pageNum << " )" << endl; + TQBoxLayout *l = new TQVBoxLayout( this, 5, 0 ); + _thumbnailW = new TQWidget( this ); + _checkBox = new TQCheckBox( text, this ); + l->addWidget( _thumbnailW, 1 ); + l->addWidget( _checkBox, 0, TQt::AlignHCenter ); + TQWhatsThis::add( _checkBox, i18n( "Using this checkbox you can select pages for printing." ) ); + setFixedHeight( 100 ); + _backgroundColor = color; + setPaletteBackgroundColor( _backgroundColor ); + TQToolTip::add(this, tip); + // TODO: Put a little page number or other place-holder when there is no thumbnail to display. +} + +bool MarkListItem::isChecked() const +{ + return _checkBox->isChecked(); +} + +void MarkListItem::toggle() +{ + _checkBox->toggle(); +} + +void MarkListItem::setChecked( bool checked ) +{ + _checkBox->setChecked(checked); +} + +void MarkListItem::setPixmap( TQPixmap thumbnail ) +{ + // The line below is needed to work around certain "features" of styles such as liquid + // see bug:61711 for more info (LPC, 20 Aug '03) + _thumbnailW->setBackgroundOrigin( TQWidget::WidgetOrigin ); + TQPixmap pm; + pm.convertFromImage( thumbnail.convertToImage().smoothScale( _thumbnailW->size() ) ); + _thumbnailW->setPaletteBackgroundPixmap( pm ); + _requested = false; +} + +void MarkListItem::setSelected( bool selected ) +{ + if (selected) + setPaletteBackgroundColor( TQApplication::palette().active().highlight() ); + else + setPaletteBackgroundColor( _backgroundColor ); +} + +void MarkListItem::resizeEvent( TQResizeEvent * ) +{ + if ( _thumbnailW->paletteBackgroundPixmap() ) { + TQPixmap pm; + pm.convertFromImage( _thumbnailW->paletteBackgroundPixmap()->convertToImage().smoothScale( _thumbnailW->size() ) ); + _thumbnailW->setPaletteBackgroundPixmap( pm ); + } +} + +void MarkListItem::paintEvent( TQPaintEvent* ) +{ + /* TODO: + * We should cancel things which flipped into view and then flipped out. + * + * Now, if one scrolls through a 1000 page document to the end and then lingers on the + * last pages, these will take forever to appear in thumbnail form. + */ + if ( _requested ) return; + if ( !_thumbnailW->paletteBackgroundPixmap() || _thumbnailW->paletteBackgroundPixmap()->isNull() ) { + _miniWidget->getThumbnailService()->delayedGetThumbnail( _pageNum, TQT_TQOBJECT(this), TQT_SLOT( setPixmap( TQPixmap ) ) ); + _requested = true; + } +} + + +/* MarkList */ + +MarkList::MarkList( TQWidget* parent, const char* name, KGVMiniWidget* mini) + : TQTable( parent, name ), + _selected ( -1 ), +_miniWidget( mini ) +{ + setNumCols( 1 ); + setLeftMargin( 0 ); // we don't want the vertical header + horizontalHeader()->setLabel( 0, i18n("Page") ); + + connect( this, TQT_SIGNAL( currentChanged( int, int ) ), + this, TQT_SIGNAL( selected( int ) ) ); +} + +TQValueList MarkList::markList() const +{ + TQValueList list; + MarkListItem *_item; + for(int i = 0; i < numRows(); i++) + { + _item = dynamic_cast( cellWidget( i, 0 ) ); + assert( _item ); + if ( _item->isChecked() ) list << (i + 1); + } + return list; +} + +void MarkList::insertItem( const TQString& text, int index, const TQString& tip) +{ + MarkListItem *_item; + _item = new MarkListItem( this, text, tip, viewport()->paletteBackgroundColor(), _miniWidget, index ); + setNumRows( index + 1 ); + setCellWidget( index, 0, _item ); + setRowHeight( index, _item->height() ); +} + +void MarkList::select( int index ) +{ + MarkListItem *_item; + setCurrentCell( index, 0 ); + _item = dynamic_cast( cellWidget( _selected, 0 ) ); + if (_item) _item -> setSelected( false ); + _selected = index; + _item = dynamic_cast( cellWidget( _selected, 0 ) ); + if (_item) _item -> setSelected( true ); + clearFocus(); +} + +void MarkList::clear() +{ + for ( int i = 0; i != numRows() ; ++i ) { + clearCellWidget( i, 0 ); + } + setNumRows( 0 ); +} + +void MarkList::markCurrent() +{ + MarkListItem *_item = dynamic_cast( cellWidget( currentRow(), 0 ) ); + assert( _item ); + _item->toggle(); +} + +void MarkList::markAll() +{ + MarkListItem *_item; + for(int i = 0; i < numRows(); i++) + { + _item = dynamic_cast( cellWidget( i, 0 ) ); + assert( _item ); + _item->setChecked( true ); + } +} + +void MarkList::markEven() +{ + MarkListItem *_item; + for(int i = 1; i < numRows(); i = i + 2) + { + _item = dynamic_cast( cellWidget( i, 0 ) ); + assert( _item ); + _item->setChecked( true ); + } +} + +void MarkList::markOdd() +{ + MarkListItem *_item; + for(int i = 0; i < numRows(); i = i + 2) + { + _item = dynamic_cast( cellWidget( i, 0 ) ); + assert( _item ); + _item->setChecked( true ); + } +} + +void MarkList::toggleMarks() +{ + MarkListItem *_item; + for(int i = 0; i < numRows(); i++) + { + _item = dynamic_cast( cellWidget( i, 0 ) ); + assert( _item ); + _item->toggle(); + } +} + +void MarkList::removeMarks() +{ + MarkListItem *_item; + for( int i = 0; i < numRows(); i++ ) { + _item = dynamic_cast( cellWidget( i, 0 ) ); + assert( _item ); + _item->setChecked( false ); + } +} + +void MarkList::viewportResizeEvent ( TQResizeEvent * ) +{ + MarkListItem *_item; + if( visibleWidth() != columnWidth( 0 ) ) + { + setColumnWidth( 0, visibleWidth() ); + for( int i = 0; i < numRows(); ++i ) + { + _item = dynamic_cast( cellWidget( i, 0 ) ); + assert( _item ); + _item->setFixedSize( visibleWidth(), _item->height() ); + } + } +} + +// vim:sw=4:sts=4:ts=8:noet diff --git a/kghostview/martdelist.h b/kghostview/martdelist.h new file mode 100644 index 00000000..54992a88 --- /dev/null +++ b/kghostview/martdelist.h @@ -0,0 +1,90 @@ +/** + * Copyright (C) 1997-2002 the KGhostView authors. See file AUTHORS. + * + * 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; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef MARKLIST_H +#define MARKLIST_H + +#include +#include + +class KGVMiniWidget; + +class MarkListItem : public TQWidget +{ + Q_OBJECT + +public: + MarkListItem( TQWidget *parent, const TQString &text, const TQString &tip, const TQColor &color, KGVMiniWidget*, int ); + + bool isChecked() const; + +public slots: + void toggle(); + void setChecked( bool checked ); + void setPixmap( TQPixmap thumbnail ); + + void setSelected( bool selected ); + +private: + void resizeEvent( TQResizeEvent * ); + void paintEvent( TQPaintEvent* ); +private: + TQWidget *_thumbnailW; + TQCheckBox *_checkBox; + TQColor _backgroundColor; + KGVMiniWidget* _miniWidget; + const int _pageNum; + bool _requested; +}; + +class MarkList: public TQTable +{ + Q_OBJECT + + +public: + MarkList( TQWidget* parent = 0, const char* name = 0, KGVMiniWidget* = 0 ); + + TQValueList markList() const; + void insertItem( const TQString& text, int index = -1, + const TQString& tip = TQString() ); + +public slots: + void select( int index ); + void markCurrent(); + void markAll(); + void markEven(); + void markOdd(); + void toggleMarks(); + void removeMarks(); + void clear(); + +protected: + virtual void viewportResizeEvent ( TQResizeEvent * ); + +signals: + void selected( int ); + +private: + int _selected; + KGVMiniWidget* _miniWidget; +}; + +#endif + +// vim:sw=4:sts=4:ts=8:noet -- cgit v1.2.3