Source Code (Use browser search to find items of interest.)
Class Index
kimageshop'ChannelTable (./koffice/kimageshop/ui/kis_channelview.h:45)
class ChannelTable : public QTableView
{
Q_OBJECT
public:
enum action { VISIBLE, ADDCHANNEL, REMOVECHANNEL, RAISECHANNEL, LOWERCHANNEL };
ChannelTable( QWidget *_parent = 0, const char *_name = 0 );
ChannelTable( KisDoc *_doc, QWidget *_parent = 0, const char *_name = 0 );
void updateTable();
void updateAllCells();
void update_contextmenu( int _index );
void selectChannel( int _index );
void slotInverseVisibility( int _index );
virtual QSize sizeHint() const;
public slots:
void slotMenuAction( int );
void slotAddChannel();
void slotRemoveChannel();
protected:
virtual void paintCell( QPainter*, int _row, int _col );
virtual void mousePressEvent( QMouseEvent *_event );
private:
void init(KisDoc* doc);
KisDoc* m_doc;
int m_items, m_selected;
QPopupMenu* m_contextmenu;
QPixmap *m_eyeIcon, *m_linkIcon;
QRect m_eyeRect, m_linkRect, m_previewRect;
};
kimageshop'ChannelTable::ChannelTable() (./koffice/kimageshop/ui/kis_channelview.cc:65)
ChannelTable::ChannelTable( QWidget* _parent, const char* _name )
: QTableView( _parent, _name )
{
init( 0 );
}
kimageshop'ChannelTable::ChannelTable() (./koffice/kimageshop/ui/kis_channelview.cc:71)
ChannelTable::ChannelTable( KisDoc* doc, QWidget* _parent, const char* _name )
: QTableView( _parent, _name )
{
init( doc );
}
kimageshop'ChannelTable::init() (./koffice/kimageshop/ui/kis_channelview.cc:77)
void ChannelTable::init( KisDoc* doc )
{
setTableFlags( Tbl_autoHScrollBar | Tbl_autoVScrollBar );
m_doc = doc;
setBackgroundColor( white );
// load icon pixmaps
QString _icon = locate( "kis_pics", "eye.png", KisFactory::global() );
m_eyeIcon = new QPixmap;
if( !m_eyeIcon->load( _icon ) )
QMessageBox::critical( this, "Canvas", "Can't find eye.png" );
m_eyeRect = QRect( QPoint( 2,( CELLHEIGHT - m_eyeIcon->height() ) / 2 ), m_eyeIcon->size() );
_icon = locate( "kis_pics", "link.png", KisFactory::global() );
m_linkIcon = new QPixmap;
if( !m_linkIcon->load( _icon ) )
QMessageBox::critical( this, "Canvas", "Can't find link.png" );
m_linkRect = QRect( QPoint( 25,( CELLHEIGHT - m_linkIcon->height() ) / 2 ), m_linkIcon->size() );
// HACK - the size of the preview image should be configurable somewhere
m_previewRect = QRect( QPoint( 40, (CELLHEIGHT - m_linkIcon->height() ) /2 ),
QSize( 15, 15 ) );
updateTable();
setCellWidth( CELLWIDTH );
setCellHeight( CELLHEIGHT );
// m_selected = m_doc->layerList().count() - 1;
QPopupMenu *submenu = new QPopupMenu();
m_contextmenu = new QPopupMenu();
m_contextmenu->setCheckable(TRUE);
m_contextmenu->insertItem( i18n( "Visible" ), VISIBLE );
m_contextmenu->insertItem( i18n( "Level" ), submenu );
m_contextmenu->insertSeparator();
m_contextmenu->insertItem( i18n( "Add Layer" ), ADDCHANNEL );
m_contextmenu->insertItem( i18n( "Remove Layer"), REMOVECHANNEL );
connect( m_contextmenu, SIGNAL( activated( int ) ), SLOT( slotMenuAction( int ) ) );
connect( submenu, SIGNAL( activated( int ) ), SLOT( slotMenuAction( int ) ) );
}
kimageshop'ChannelTable::paintCell() (./koffice/kimageshop/ui/kis_channelview.cc:126)
void ChannelTable::paintCell( QPainter* /*_painter*/, int /*_row*/, int )
{
/*
QString tmp;
switch( _row )
{
case 0 :
tmp = i18n( "Red" );
break;
case 1 :
tmp = i18n( "Green" );
break;
case 2 :
tmp = i18n( "Blue" );
break;
default :
tmp = i18n( "Alpha" );
break;
}
if( _row == m_selected )
{
_painter->fillRect( 0, 0, cellWidth( 0 ) - 1, cellHeight() - 1, green );
}
if( m_doc->layerList().at( _row )->isVisible() )
{
_painter->drawPixmap( m_eyeRect.topLeft(), *m_eyeIcon );
}
_painter->drawRect( 0, 0, cellWidth( 0 ) - 1, cellHeight() - 1);
_painter->drawText( 80, 20, tmp );
*/
}
kimageshop'ChannelTable::updateTable() (./koffice/kimageshop/ui/kis_channelview.cc:162)
void ChannelTable::updateTable()
{
m_items = 0;
setNumRows( 0 );
setNumCols( 0 );
resize( sizeHint() );
}
kimageshop'ChannelTable::update_contextmenu() (./koffice/kimageshop/ui/kis_channelview.cc:170)
void ChannelTable::update_contextmenu( int )
{
}
kimageshop'ChannelTable::selectChannel() (./koffice/kimageshop/ui/kis_channelview.cc:174)
void ChannelTable::selectChannel( int/* _index*/ )
{
}
kimageshop'ChannelTable::slotInverseVisibility() (./koffice/kimageshop/ui/kis_channelview.cc:179)
void ChannelTable::slotInverseVisibility( int )
{
}
kimageshop'ChannelTable::slotMenuAction() (./koffice/kimageshop/ui/kis_channelview.cc:183)
void ChannelTable::slotMenuAction( int _id )
{
switch( _id )
{
case VISIBLE:
slotInverseVisibility( m_selected );
break;
case ADDCHANNEL:
slotAddChannel();
break;
case REMOVECHANNEL:
slotRemoveChannel();
break;
default:
cerr << "Michael : unknown context menu action" << endl;
break;
}
}
kimageshop'ChannelTable::sizeHint() (./koffice/kimageshop/ui/kis_channelview.cc:202)
QSize ChannelTable::sizeHint() const
{
return QSize( CELLWIDTH, CELLHEIGHT * 5 );
}
kimageshop'ChannelTable::mousePressEvent() (./koffice/kimageshop/ui/kis_channelview.cc:207)
void ChannelTable::mousePressEvent( QMouseEvent *_event )
{
int row = findRow( _event->pos().y() );
QPoint localPoint( _event->pos().x() % cellWidth(), _event->pos().y() % cellHeight() );
if( _event->button() & LeftButton )
{
if( m_eyeRect.contains( localPoint ) )
{
slotInverseVisibility( row );
}
else if( row != -1 )
{
selectChannel( row );
}
}
else if( _event->button() & RightButton )
{
selectChannel( row );
update_contextmenu( row );
m_contextmenu->popup( mapToGlobal( _event->pos() ) );
}
}
kimageshop'ChannelTable::slotAddChannel() (./koffice/kimageshop/ui/kis_channelview.cc:231)
void ChannelTable::slotAddChannel()
{
}
kimageshop'ChannelTable::slotRemoveChannel() (./koffice/kimageshop/ui/kis_channelview.cc:235)
void ChannelTable::slotRemoveChannel()
{
}
kimageshop'ChannelTable::updateAllCells() (./koffice/kimageshop/ui/kis_channelview.cc:239)
void ChannelTable::updateAllCells()
{
//for( unsigned int i = 0; i < m_doc->layerList().count(); i++ )
// updateCell( i, 0 );
}