summaryrefslogtreecommitdiffstats
path: root/chalk/ui/kis_custom_brush.cc
diff options
context:
space:
mode:
authorMichele Calgaro <michele.calgaro@yahoo.it>2021-05-23 20:48:35 +0900
committerMichele Calgaro <michele.calgaro@yahoo.it>2021-05-29 15:16:28 +0900
commit8b78a8791bc539bcffe7159f9d9714d577cb3d7d (patch)
tree1328291f966f19a22d7b13657d3f01a588eb1083 /chalk/ui/kis_custom_brush.cc
parent95834e2bdc5e01ae1bd21ac0dfa4fa1d2417fae9 (diff)
downloadkoffice-8b78a8791bc539bcffe7159f9d9714d577cb3d7d.tar.gz
koffice-8b78a8791bc539bcffe7159f9d9714d577cb3d7d.zip
Renaming of files in preparation for code style tools.
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
Diffstat (limited to 'chalk/ui/kis_custom_brush.cc')
-rw-r--r--chalk/ui/kis_custom_brush.cc158
1 files changed, 0 insertions, 158 deletions
diff --git a/chalk/ui/kis_custom_brush.cc b/chalk/ui/kis_custom_brush.cc
deleted file mode 100644
index 1802e6cf..00000000
--- a/chalk/ui/kis_custom_brush.cc
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
- * Copyright (c) 2005 Bart Coppens <kde@bartcoppens.be>
- *
- * 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 <KoImageResource.h>
-#include <kdebug.h>
-#include <tqlabel.h>
-#include <tqimage.h>
-#include <tqpushbutton.h>
-#include <tqcombobox.h>
-#include <tqcheckbox.h>
-#include <tdeglobal.h>
-#include <kstandarddirs.h>
-#include <tdetempfile.h>
-
-#include "kis_view.h"
-#include "kis_image.h"
-#include "kis_layer.h"
-#include "kis_paint_device.h"
-#include "kis_brush.h"
-#include "kis_imagepipe_brush.h"
-#include "kis_custom_brush.h"
-#include "kis_resource_mediator.h"
-#include "kis_resourceserver.h"
-#include "kis_paint_layer.h"
-#include "kis_group_layer.h"
-
-KisCustomBrush::KisCustomBrush(TQWidget *parent, const char* name, const TQString& caption, KisView* view)
- : KisWdgCustomBrush(parent, name), m_view(view)
-{
- Q_ASSERT(m_view);
- m_mediator = 0;
- setCaption(caption);
-
- m_brush = 0;
-
- preview->setScaledContents(true);
-
- connect(addButton, TQT_SIGNAL(pressed()), this, TQT_SLOT(slotAddPredefined()));
- connect(brushButton, TQT_SIGNAL(pressed()), this, TQT_SLOT(slotUseBrush()));
-// connect(exportButton, TQT_SIGNAL(pressed()), this, TQT_SLOT(slotExport()));
- connect(style, TQT_SIGNAL(activated(int)), this, TQT_SLOT(slotUpdateCurrentBrush(int)));
- connect(colorAsMask, TQT_SIGNAL(stateChanged(int)), this, TQT_SLOT(slotUpdateCurrentBrush(int)));
-}
-
-KisCustomBrush::~KisCustomBrush() {
- delete m_brush;
-}
-
-void KisCustomBrush::showEvent(TQShowEvent *) {
- slotUpdateCurrentBrush(0);
-}
-
-void KisCustomBrush::slotUpdateCurrentBrush(int) {
- delete m_brush;
- if (m_view->canvasSubject() && m_view->canvasSubject()->currentImg()) {
- createBrush();
- preview->setPixmap(TQPixmap(m_brush->img()));
- } else {
- m_brush = 0;
- }
-}
-
-void KisCustomBrush::slotExport() {
- ;
-}
-
-void KisCustomBrush::slotAddPredefined() {
- // Save in the directory that is likely to be: ~/.trinity/share/apps/chalk/brushes
- // a unique file with this brushname
- TQString dir = TDEGlobal::dirs()->saveLocation("data", "chalk/brushes");
- TQString extension;
-
- if (style->currentItem() == 0) {
- extension = ".gbr";
- } else {
- extension = ".gih";
- }
- KTempFile file(dir, extension);
- file.close(); // If we don't, and brush->save first, it might get truncated!
-
- // Save it to that file
- m_brush->setFilename(file.name());
-
- // Add it to the brush server, so that it automatically gets to the mediators, and
- // so to the other brush choosers can pick it up, if they want to
- if (m_server)
- m_server->addResource(m_brush->clone());
-}
-
-void KisCustomBrush::slotUseBrush() {
- KisBrush* copy = m_brush->clone();
-
- TQ_CHECK_PTR(copy);
-
- emit(activatedResource(copy));
-}
-
-void KisCustomBrush::createBrush() {
- KisImageSP img = m_view->canvasSubject()->currentImg();
-
- if (!img)
- return;
-
- if (style->currentItem() == 0) {
- m_brush = new KisBrush(img->mergedImage(), 0, 0, img->width(), img->height());
- if (colorAsMask->isChecked())
- m_brush->makeMaskImage();
- return;
- }
-
- // For each layer in the current image, create a new image, and add it to the list
- TQValueVector< TQValueVector<KisPaintDevice*> > devices;
- devices.push_back(TQValueVector<KisPaintDevice*>());
- int w = img->width();
- int h = img->height();
-
- // We only loop over the rootLayer. Since we actually should have a layer selection
- // list, no need to elaborate on that here and now
- KisLayer* layer = img->rootLayer()->firstChild();
- while (layer) {
- KisPaintLayer* paint = 0;
- if (layer->visible() && (paint = dynamic_cast<KisPaintLayer*>(layer)))
- devices.at(0).push_back(paint->paintDevice());
- layer = layer->nextSibling();
- }
- TQValueVector<KisPipeBrushParasite::SelectionMode> modes;
-
- switch(comboBox2->currentItem()) {
- case 0: modes.push_back(KisPipeBrushParasite::Constant); break;
- case 1: modes.push_back(KisPipeBrushParasite::Random); break;
- case 2: modes.push_back(KisPipeBrushParasite::Incremental); break;
- case 3: modes.push_back(KisPipeBrushParasite::Pressure); break;
- case 4: modes.push_back(KisPipeBrushParasite::Angular); break;
- default: modes.push_back(KisPipeBrushParasite::Incremental);
- }
-
- m_brush = new KisImagePipeBrush(img->name(), w, h, devices, modes);
- if (colorAsMask->isChecked())
- m_brush->makeMaskImage();
-}
-
-
-#include "kis_custom_brush.moc"