1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
/*
* Copyright (c) 2004 Cyrille Berger <cberger@cberger.net>
*
* 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 "kis_custom_convolution_filter_configuration_widget.h"
#include <tqlayout.h>
#include <tqspinbox.h>
#include <tdelocale.h>
#include "kis_filter.h"
#include "kis_image.h"
#include "kis_layer.h"
#include "kis_view.h"
#include "kis_types.h"
#include "kis_filter_configuration.h"
#include "kis_colorspace.h"
#include "kis_convolution_filter.h"
#include "kis_custom_convolution_filter_configuration_base_widget.h"
#include "kis_matrix_widget.h"
KisCustomConvolutionFilterConfigurationWidget::KisCustomConvolutionFilterConfigurationWidget( KisFilter* /*nfilter*/, TQWidget * parent, const char * name)
: KisFilterConfigWidget ( parent, name )
{
TQGridLayout *widgetLayout = new TQGridLayout(this, 2, 1);
TQ_CHECK_PTR(widgetLayout);
// TQPushButton *bnRefresh = new TQPushButton(i18n("Refresh Preview"), this, "bnrefresh");
// TQ_CHECK_PTR(bnRefresh);
// TQSpacerItem *spacer = new TQSpacerItem(100, 30, TQSizePolicy::Expanding, TQSizePolicy::Minimum);
// TQ_CHECK_PTR(spacer);
// widgetLayout->addWidget(bnRefresh, 0, 0);
// widgetLayout->addItem(spacer, 0, 1);
m_ccfcws = new KisCustomConvolutionFilterConfigurationBaseWidget((TQWidget*)this);
TQ_CHECK_PTR(m_ccfcws);
widgetLayout->addMultiCellWidget(m_ccfcws, 1, 1, 0, 1);
// connect( bnRefresh, TQT_SIGNAL(clicked()), nfilter, TQT_SLOT(refreshPreview()));
connect( m_ccfcws->matrixWidget, TQT_SIGNAL(valueChanged()), TQT_SIGNAL(sigPleaseUpdatePreview()));
connect( m_ccfcws->spinBoxFactor, TQT_SIGNAL(valueChanged(int)), TQT_SIGNAL(sigPleaseUpdatePreview()));
connect( m_ccfcws->spinBoxOffset, TQT_SIGNAL(valueChanged(int)), TQT_SIGNAL(sigPleaseUpdatePreview()));
}
void KisCustomConvolutionFilterConfigurationWidget::setConfiguration(KisFilterConfiguration * cfg)
{
KisConvolutionConfiguration * config = dynamic_cast<KisConvolutionConfiguration*>(cfg);
if (config->matrix()->width != 3 || config->matrix()->height != 3) return;
m_ccfcws->spinBoxOffset->setValue(config->matrix()->offset);
m_ccfcws->spinBoxFactor->setValue(config->matrix()->factor);
m_ccfcws->matrixWidget->m11->setValue(config->matrix()->data[0]);
m_ccfcws->matrixWidget->m21->setValue(config->matrix()->data[1]);
m_ccfcws->matrixWidget->m31->setValue(config->matrix()->data[2]);
m_ccfcws->matrixWidget->m12->setValue(config->matrix()->data[3]);
m_ccfcws->matrixWidget->m22->setValue(config->matrix()->data[4]);
m_ccfcws->matrixWidget->m32->setValue(config->matrix()->data[5]);
m_ccfcws->matrixWidget->m31->setValue(config->matrix()->data[6]);
m_ccfcws->matrixWidget->m32->setValue(config->matrix()->data[7]);
m_ccfcws->matrixWidget->m33->setValue(config->matrix()->data[8]);
}
#include "kis_custom_convolution_filter_configuration_widget.moc"
|