KOffice – TDE office suite
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

kis_custom_convolution_filter_configuration_widget.cc 3.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /*
  2. * Copyright (c) 2004 Cyrille Berger <cberger@cberger.net>
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation; either version 2 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program; if not, write to the Free Software
  16. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  17. */
  18. #include "kis_custom_convolution_filter_configuration_widget.h"
  19. #include <tqlayout.h>
  20. #include <tqspinbox.h>
  21. #include <tdelocale.h>
  22. #include "kis_filter.h"
  23. #include "kis_image.h"
  24. #include "kis_layer.h"
  25. #include "kis_view.h"
  26. #include "kis_types.h"
  27. #include "kis_filter_configuration.h"
  28. #include "kis_colorspace.h"
  29. #include "kis_convolution_filter.h"
  30. #include "kis_custom_convolution_filter_configuration_base_widget.h"
  31. #include "kis_matrix_widget.h"
  32. KisCustomConvolutionFilterConfigurationWidget::KisCustomConvolutionFilterConfigurationWidget( KisFilter* /*nfilter*/, TQWidget * parent, const char * name)
  33. : KisFilterConfigWidget ( parent, name )
  34. {
  35. TQGridLayout *widgetLayout = new TQGridLayout(this, 2, 1);
  36. TQ_CHECK_PTR(widgetLayout);
  37. // TQPushButton *bnRefresh = new TQPushButton(i18n("Refresh Preview"), this, "bnrefresh");
  38. // TQ_CHECK_PTR(bnRefresh);
  39. // TQSpacerItem *spacer = new TQSpacerItem(100, 30, TQSizePolicy::Expanding, TQSizePolicy::Minimum);
  40. // TQ_CHECK_PTR(spacer);
  41. // widgetLayout->addWidget(bnRefresh, 0, 0);
  42. // widgetLayout->addItem(spacer, 0, 1);
  43. m_ccfcws = new KisCustomConvolutionFilterConfigurationBaseWidget((TQWidget*)this);
  44. TQ_CHECK_PTR(m_ccfcws);
  45. widgetLayout->addMultiCellWidget(m_ccfcws, 1, 1, 0, 1);
  46. // connect( bnRefresh, TQT_SIGNAL(clicked()), nfilter, TQT_SLOT(refreshPreview()));
  47. connect( m_ccfcws->matrixWidget, TQT_SIGNAL(valueChanged()), TQT_SIGNAL(sigPleaseUpdatePreview()));
  48. connect( m_ccfcws->spinBoxFactor, TQT_SIGNAL(valueChanged(int)), TQT_SIGNAL(sigPleaseUpdatePreview()));
  49. connect( m_ccfcws->spinBoxOffset, TQT_SIGNAL(valueChanged(int)), TQT_SIGNAL(sigPleaseUpdatePreview()));
  50. }
  51. void KisCustomConvolutionFilterConfigurationWidget::setConfiguration(KisFilterConfiguration * cfg)
  52. {
  53. KisConvolutionConfiguration * config = dynamic_cast<KisConvolutionConfiguration*>(cfg);
  54. if (config->matrix()->width != 3 || config->matrix()->height != 3) return;
  55. m_ccfcws->spinBoxOffset->setValue(config->matrix()->offset);
  56. m_ccfcws->spinBoxFactor->setValue(config->matrix()->factor);
  57. m_ccfcws->matrixWidget->m11->setValue(config->matrix()->data[0]);
  58. m_ccfcws->matrixWidget->m21->setValue(config->matrix()->data[1]);
  59. m_ccfcws->matrixWidget->m31->setValue(config->matrix()->data[2]);
  60. m_ccfcws->matrixWidget->m12->setValue(config->matrix()->data[3]);
  61. m_ccfcws->matrixWidget->m22->setValue(config->matrix()->data[4]);
  62. m_ccfcws->matrixWidget->m32->setValue(config->matrix()->data[5]);
  63. m_ccfcws->matrixWidget->m31->setValue(config->matrix()->data[6]);
  64. m_ccfcws->matrixWidget->m32->setValue(config->matrix()->data[7]);
  65. m_ccfcws->matrixWidget->m33->setValue(config->matrix()->data[8]);
  66. }
  67. #include "kis_custom_convolution_filter_configuration_widget.moc"