21#include <tqgroupbox.h>
28#include "kis_filter_config_widget.h"
29#include "kis_transaction.h"
30#include "kis_filter.h"
31#include "kis_filter_configuration.h"
32#include "kis_dlg_adjustment_layer.h"
33#include "kis_filters_listview.h"
35#include "kis_previewwidget.h"
37#include "kis_paint_device.h"
38#include "kis_paint_layer.h"
39#include "kis_group_layer.h"
40#include "kis_adjustment_layer.h"
41#include "kis_filter.h"
42#include "kis_filter_configuration.h"
46 const TQString & caption,
49 : KDialogBase(parent, name, true, "", Ok | Cancel)
57 KisLayerSP activeLayer = img->activeLayer();
62 m_dev = pl->paintDevice();
72 m_dev = al->cachedPaintDevice();
78 TQWidget * page = new TQWidget( this, "page widget");
79 TQGridLayout * grid = new TQGridLayout(page, 3, 2, 0, 6);
82 TQLabel * lblName = new TQLabel(i18n( "Layer name:"), page, "lblName");
83 grid->addWidget(lblName, 0, 0);
85 m_layerName = new KLineEdit(page, "m_layerName");
86 grid->addWidget(m_layerName, 0, 1);
87 connect( m_layerName, TQ_SIGNAL( textChanged ( const TQString & ) ), this, TQ_SLOT( slotNameChanged( const TQString & ) ) );
89 m_filtersList = new KisFiltersListView(m_dev, page, true, "dlgadjustment.filtersList");
90 connect(m_filtersList , TQ_SIGNAL(selectionChanged(TQIconViewItem*)), this, TQ_SLOT(selectionHasChanged(TQIconViewItem* )));
91 grid->addMultiCellWidget(m_filtersList, 1, 2, 0, 0);
96 connect( m_preview, TQ_SIGNAL(updated()), this, TQ_SLOT(refreshPreview()));
97 grid->addWidget(m_preview, 1, 1);
99 m_configWidgetHolder = new TQGroupBox(i18n( "Configuration"), page, "currentConfigWidget");
100 m_configWidgetHolder->setColumnLayout(0, TQt::Horizontal);
101 grid->addWidget(m_configWidgetHolder, 2, 1);
103 m_labelNoConfigWidget = new TQLabel(i18n( "No configuration options are available for this filter"),
104 m_configWidgetHolder);
105 m_configWidgetHolder->layout()->add(m_labelNoConfigWidget);
106 m_labelNoConfigWidget->hide();
108 resize( TQSize(600, 480).expandedTo(minimumSizeHint()) );
110 m_currentConfigWidget = 0;
115void KisDlgAdjustmentLayer::slotNameChanged( const TQString & text )
120 m_customName = !text.isEmpty();
121 enableButtonOK( m_currentFilter && m_customName );
126 return m_currentFilter-> configuration(m_currentConfigWidget);
129TQString KisDlgAdjustmentLayer::layerName() const
131 return m_layerName->text();
134void KisDlgAdjustmentLayer::slotConfigChanged()
144void KisDlgAdjustmentLayer::refreshPreview()
148 m_preview-> runFilter(m_currentFilter, config);
151void KisDlgAdjustmentLayer::selectionHasChanged ( TQIconViewItem * item )
153 KisFiltersIconViewItem* kisitem = (KisFiltersIconViewItem*) item;
155 m_currentFilter = kisitem->filter();
157 if ( m_currentConfigWidget != 0 )
159 m_configWidgetHolder->layout()->remove(m_currentConfigWidget);
161 delete m_currentConfigWidget;
162 m_currentConfigWidget = 0;
166 m_labelNoConfigWidget->hide();
174 if (m_currentConfigWidget != 0)
176 m_configWidgetHolder->layout()->add(m_currentConfigWidget);
177 m_currentConfigWidget->show();
178 connect(m_currentConfigWidget, TQ_SIGNAL(sigPleaseUpdatePreview()), this, TQ_SLOT(slotConfigChanged()));
180 m_labelNoConfigWidget->show();
185 m_layerName->setText(m_currentFilter->id().name());
186 m_freezeName = false;
189 enableButtonOK( !m_layerName->text().isEmpty() );
193#include "kis_dlg_adjustment_layer.moc"
Class that contains a KisFilter and optionally a KisSelection.
KisDlgAdjustmentLayer(KisImage *img, const TQString &layerName, const TQString &caption, TQWidget *parent=0, const char *name=0) Create a new adjustmentlayer dialog.
A KisFilterConfiguration is the serializable representation of the filter parameters.
virtual KisFilterConfigWidget * createConfigurationWidget(TQWidget *parent, KisPaintDeviceSP dev)
virtual KisFilterConfiguration * configuration(TQWidget *)
A KisLayer that bundles child layers into a single layer.
virtual KisPaintDeviceSP projection(const TQRect &rect) will copy from to, if !0, CoW!!
This layer is of a type that can be painted on.
|