From 8362bf63dea22bbf6736609b0f49c152f975eb63 Mon Sep 17 00:00:00 2001 From: tpearson Date: Wed, 20 Jan 2010 01:29:50 +0000 Subject: Added old abandoned KDE3 version of koffice git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/koffice@1077364 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- krita/plugins/viewplugins/shearimage/Makefile.am | 24 +++++ .../viewplugins/shearimage/dlg_shearimage.cc | 96 +++++++++++++++++ .../viewplugins/shearimage/dlg_shearimage.h | 54 ++++++++++ .../viewplugins/shearimage/kritashearimage.desktop | 37 +++++++ krita/plugins/viewplugins/shearimage/shearimage.cc | 113 +++++++++++++++++++++ krita/plugins/viewplugins/shearimage/shearimage.h | 46 +++++++++ krita/plugins/viewplugins/shearimage/shearimage.rc | 13 +++ .../viewplugins/shearimage/wdg_shearimage.ui | 102 +++++++++++++++++++ 8 files changed, 485 insertions(+) create mode 100644 krita/plugins/viewplugins/shearimage/Makefile.am create mode 100644 krita/plugins/viewplugins/shearimage/dlg_shearimage.cc create mode 100644 krita/plugins/viewplugins/shearimage/dlg_shearimage.h create mode 100644 krita/plugins/viewplugins/shearimage/kritashearimage.desktop create mode 100644 krita/plugins/viewplugins/shearimage/shearimage.cc create mode 100644 krita/plugins/viewplugins/shearimage/shearimage.h create mode 100644 krita/plugins/viewplugins/shearimage/shearimage.rc create mode 100644 krita/plugins/viewplugins/shearimage/wdg_shearimage.ui (limited to 'krita/plugins/viewplugins/shearimage') diff --git a/krita/plugins/viewplugins/shearimage/Makefile.am b/krita/plugins/viewplugins/shearimage/Makefile.am new file mode 100644 index 00000000..3c085d45 --- /dev/null +++ b/krita/plugins/viewplugins/shearimage/Makefile.am @@ -0,0 +1,24 @@ +kritarcdir = $(kde_datadir)/kritaplugins +kritarc_DATA = shearimage.rc + +EXTRA_DIST = $(kritarc_DATA) + + +INCLUDES = -I$(srcdir)/../../../sdk \ + -I$(srcdir)/../../../core \ + -I$(srcdir)/../../../kritacolor/ \ + -I$(srcdir)/../../../ui \ + $(KOFFICE_INCLUDES) \ + $(all_includes) + +kde_module_LTLIBRARIES = kritashearimage.la + +kde_services_DATA = kritashearimage.desktop + +kritashearimage_la_SOURCES = wdg_shearimage.ui shearimage.cc dlg_shearimage.cc +noinst_HEADERS = wdg_shearimage.h dlg_shearimage.h shearimage.h + +kritashearimage_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) +kritashearimage_la_LIBADD = ../../../libkritacommon.la + +kritashearimage_la_METASOURCES = AUTO diff --git a/krita/plugins/viewplugins/shearimage/dlg_shearimage.cc b/krita/plugins/viewplugins/shearimage/dlg_shearimage.cc new file mode 100644 index 00000000..9a6a2f66 --- /dev/null +++ b/krita/plugins/viewplugins/shearimage/dlg_shearimage.cc @@ -0,0 +1,96 @@ +/* + * dlg_shearimage.cc - part of KimageShop^WKrayon^WKrita + * + * Copyright (c) 2004 Michael Thaler + * + * 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 + +#include + +#include + +using namespace std; + +#include +#include +#include +#include + +#include +#include +#include + +#include "dlg_shearimage.h" +#include "wdg_shearimage.h" + + +DlgShearImage::DlgShearImage( QWidget * parent, + const char * name) + : super (parent, name, true, i18n("Shear Image"), Ok | Cancel, Ok) +{ + m_lock = false; + + m_page = new WdgShearImage(this, "shear_image"); + m_page->layout()->setMargin(0); + Q_CHECK_PTR(m_page); + + setMainWidget(m_page); + resize(m_page->sizeHint()); + + connect(this, SIGNAL(okClicked()), + this, SLOT(okClicked())); + +} + +DlgShearImage::~DlgShearImage() +{ + delete m_page; +} + +void DlgShearImage::setAngleX(Q_UINT32 angle) +{ + m_page->shearAngleX->setValue(angle); + m_oldAngle = angle; + +} + +void DlgShearImage::setAngleY(Q_UINT32 angle) +{ + m_page->shearAngleY->setValue(angle); + m_oldAngle = angle; + +} + +Q_INT32 DlgShearImage::angleX() +{ + return (Q_INT32)qRound(m_page->shearAngleX->value()); +} + +Q_INT32 DlgShearImage::angleY() +{ + return (Q_INT32)qRound(m_page->shearAngleY->value()); +} + +// SLOTS + +void DlgShearImage::okClicked() +{ + accept(); +} + +#include "dlg_shearimage.moc" diff --git a/krita/plugins/viewplugins/shearimage/dlg_shearimage.h b/krita/plugins/viewplugins/shearimage/dlg_shearimage.h new file mode 100644 index 00000000..183f166a --- /dev/null +++ b/krita/plugins/viewplugins/shearimage/dlg_shearimage.h @@ -0,0 +1,54 @@ +/* + * dlg_shearimage.h -- part of KimageShop^WKrayon^WKrita + * + * Copyright (c) 2004 Michael Thaler + * + * 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 DLG_SHEARIMAGE +#define DLG_SHEARIMAGE + +#include + +class WdgShearImage; + +class DlgShearImage: public KDialogBase { + typedef KDialogBase super; + Q_OBJECT + +public: + + DlgShearImage(QWidget * parent = 0, + const char* name = 0); + ~DlgShearImage(); + + void setAngleX(Q_UINT32 w); + void setAngleY(Q_UINT32 w); + Q_INT32 angleX(); + Q_INT32 angleY(); + +private slots: + + void okClicked(); + +private: + + WdgShearImage * m_page; + double m_oldAngle; + bool m_lock; + +}; + +#endif // DLG_SHEARIMAGE diff --git a/krita/plugins/viewplugins/shearimage/kritashearimage.desktop b/krita/plugins/viewplugins/shearimage/kritashearimage.desktop new file mode 100644 index 00000000..1b1e8ad0 --- /dev/null +++ b/krita/plugins/viewplugins/shearimage/kritashearimage.desktop @@ -0,0 +1,37 @@ +[Desktop Entry] +Name=Shear Image Plugin +Name[bg]=Приставка за отрязване на изображение +Name[ca]=Connector de tall d'imatge +Name[da]=Plugin for skævvrid billede +Name[de]="Bild scheren"-Modul +Name[el]=Πρόσθετο στρέβλωσης εικόνας +Name[es]=Complemento para cortar la imagen +Name[et]=Pildinihke plugin +Name[fa]=اشتراک وصلۀ تصویر +Name[fr]=Module de rognage d'images +Name[fy]=Ofbylding skeanlûke plugin +Name[gl]=Plugin de Inclinación da Imaxe +Name[hu]=Képnyíró modul +Name[is]=Klippa mynd íforrit +Name[it]=Plugin di distorsione delle immagini +Name[ja]=画像剪断変形プラグイン +Name[km]=កម្មវិធី​ជំនួយ​ដើម្បី​កាត់​រូបភាព +Name[nb]=Programtillegg for bildeskjæring +Name[nds]=Bildscheer-Moduul +Name[ne]=छवि प्लगइन अपूर्ण गर्नुहोस् +Name[nl]=Afbeelding schuintrekken +Name[pl]=Wtyczka obcinania obrazków +Name[pt]='Plugin' de Inclinação da Imagem +Name[pt_BR]=Plugin de Inclinação da Imagem +Name[ru]=Сдвиг +Name[sk]=Modul roztrhnutie obrázku +Name[sl]=Vstavek Ostriži sliko +Name[sr]=Прикључак за смицање слике +Name[sr@Latn]=Priključak za smicanje slike +Name[sv]=Insticksprogram för skjuva bild +Name[uk]=Втулок перекошення зображення +Name[zh_TW]=修剪圖片外掛程式 +ServiceTypes=Krita/ViewPlugin +Type=Service +X-KDE-Library=kritashearimage +X-Krita-Version=2 diff --git a/krita/plugins/viewplugins/shearimage/shearimage.cc b/krita/plugins/viewplugins/shearimage/shearimage.cc new file mode 100644 index 00000000..d8c839ce --- /dev/null +++ b/krita/plugins/viewplugins/shearimage/shearimage.cc @@ -0,0 +1,113 @@ +/* + * shearimage.cc -- Part of Krita + * + * Copyright (c) 2004 Michael Thaler + * + * 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 + +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "shearimage.h" +#include "dlg_shearimage.h" + +typedef KGenericFactory ShearImageFactory; +K_EXPORT_COMPONENT_FACTORY( kritashearimage, ShearImageFactory( "krita" ) ) + +// XXX: this plugin could also provide layer scaling/resizing +ShearImage::ShearImage(QObject *parent, const char *name, const QStringList &) + : KParts::Plugin(parent, name) +{ + if ( parent->inherits("KisView") ) + { + setInstance(ShearImageFactory::instance()); + setXMLFile(locate("data","kritaplugins/shearimage.rc"), true); + + (void) new KAction(i18n("&Shear Image..."), 0, 0, this, SLOT(slotShearImage()), actionCollection(), "shearimage"); + (void) new KAction(i18n("&Shear Layer..."), 0, 0, this, SLOT(slotShearLayer()), actionCollection(), "shearlayer"); + + m_view = (KisView*) parent; + } +} + +ShearImage::~ShearImage() +{ + m_view = 0; +} + +void ShearImage::slotShearImage() +{ + KisImageSP image = m_view->canvasSubject()->currentImg(); + + if (!image) return; + + DlgShearImage * dlgShearImage = new DlgShearImage(m_view, "ShearImage"); + Q_CHECK_PTR(dlgShearImage); + + dlgShearImage->setCaption(i18n("Shear Image")); + + if (dlgShearImage->exec() == QDialog::Accepted) { + Q_INT32 angleX = dlgShearImage->angleX(); + Q_INT32 angleY = dlgShearImage->angleY(); + m_view->shearCurrentImage(angleX, angleY); + } + delete dlgShearImage; +} + +void ShearImage::slotShearLayer() +{ + KisImageSP image = m_view->canvasSubject()->currentImg(); + + if (!image) return; + + DlgShearImage * dlgShearImage = new DlgShearImage(m_view, "ShearLayer"); + Q_CHECK_PTR(dlgShearImage); + + dlgShearImage->setCaption(i18n("Shear Layer")); + + if (dlgShearImage->exec() == QDialog::Accepted) { + Q_INT32 angleX = dlgShearImage->angleX(); + Q_INT32 angleY = dlgShearImage->angleY(); + m_view->shearLayer(angleX, angleY); + + } + delete dlgShearImage; +} + +#include "shearimage.moc" diff --git a/krita/plugins/viewplugins/shearimage/shearimage.h b/krita/plugins/viewplugins/shearimage/shearimage.h new file mode 100644 index 00000000..bfff2ac2 --- /dev/null +++ b/krita/plugins/viewplugins/shearimage/shearimage.h @@ -0,0 +1,46 @@ +/* + * shearimage.h -- Part of Krita + * + * Copyright (c) 2004 Michael Thaler (michael.thaler@physik.tu-muenchen.de) + * + * 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 SHEARIMAGE_H +#define SHEARIMAGE_H + +#include + +class KisView; + +class ShearImage : public KParts::Plugin +{ + Q_OBJECT +public: + ShearImage(QObject *parent, const char *name, const QStringList &); + virtual ~ShearImage(); + +private slots: + + void slotShearImage(); + void slotShearLayer(); + +private: + + KisView * m_view; + KisPainter * m_painter; + +}; + +#endif // SHEARIMAGE_H diff --git a/krita/plugins/viewplugins/shearimage/shearimage.rc b/krita/plugins/viewplugins/shearimage/shearimage.rc new file mode 100644 index 00000000..c13e341f --- /dev/null +++ b/krita/plugins/viewplugins/shearimage/shearimage.rc @@ -0,0 +1,13 @@ + + + + &Image + + + + La&yer + + + + + diff --git a/krita/plugins/viewplugins/shearimage/wdg_shearimage.ui b/krita/plugins/viewplugins/shearimage/wdg_shearimage.ui new file mode 100644 index 00000000..20de0b6b --- /dev/null +++ b/krita/plugins/viewplugins/shearimage/wdg_shearimage.ui @@ -0,0 +1,102 @@ + +WdgShearImage + + + WdgShearImage + + + + 0 + 0 + 323 + 114 + + + + Shear Image + + + + unnamed + + + + grpPixelDimensions + + + &Shear Image + + + + unnamed + + + + shearAngleX + + + -45 + + + 45 + + + ° + + + + + lblShearAngelY + + + Shear angle Y: + + + + + shearAngleY + + + + 32767 + 100 + + + + -45 + + + 45 + + + ° + + + + + lblShearAngleX + + + Shear angle X: + + + intWidth + + + + + + + + + + shearAngleX + + + + knuminput.h + knuminput.h + knuminput.h + knuminput.h + + -- cgit v1.2.1