21#include <tqgroupbox.h>
28#include <kpushbutton.h>
30#include "kis_factory.h"
31#include "kis_global.h"
32#include "kis_cmb_composite.h"
33#include "kis_cmb_idlist.h"
35#include "kis_dlg_new_layer.h"
36#include <kis_meta_registry.h>
37#include "kis_colorspace_factory_registry.h"
38#include "kis_profile.h"
39#include "kis_colorspace.h"
40#include "wdglayerproperties.h"
41#include "kis_int_spinbox.h"
43NewLayerDialog::NewLayerDialog(
const KisID colorSpaceID,
44 const TQString & profilename,
45 const TQString & deviceName,
48 : super(parent, name, true,
"", Ok | Cancel)
50 m_page =
new WdgLayerProperties(
this);
51 m_page->layout()->setMargin(0);
53 setCaption(i18n(
"New Layer"));
55 setMainWidget(m_page);
58 m_page->editName->setText(deviceName);
61 m_page->intOpacity->setRange(0, 100, 13);
62 m_page->intOpacity->setValue(100);
65 m_page->cmbColorSpaces->setIDList(KisMetaRegistry::instance()->csRegistry()->listKeys());
66 m_page->cmbColorSpaces->setCurrentText(colorSpaceID.id());
67 connect(m_page->cmbColorSpaces, TQ_SIGNAL(activated(
const KisID &)),
68 this, TQ_SLOT(fillCmbProfiles(
const KisID &)));
69 connect(m_page->cmbColorSpaces, TQ_SIGNAL(activated(
const KisID &)),
70 this, TQ_SLOT(fillCmbComposite(
const KisID &)));
73 fillCmbProfiles(m_page->cmbColorSpaces->currentItem());
74 m_page->cmbProfile->setCurrentText(profilename);
77 fillCmbComposite(m_page->cmbColorSpaces->currentItem());
86void NewLayerDialog::setColorSpaceEnabled(
bool enabled)
88 m_page->cmbProfile->setEnabled(enabled);
89 m_page->cmbColorSpaces->setEnabled(enabled);
92void NewLayerDialog::fillCmbProfiles(
const KisID & s)
94 m_page->cmbProfile->clear();
96 if (!KisMetaRegistry::instance()->csRegistry()->exists(s)) {
100 KisColorSpaceFactory * csf = KisMetaRegistry::instance()->csRegistry()->
get(s);
101 if (csf == 0)
return;
103 TQValueVector<KisProfile *> profileList = KisMetaRegistry::instance()->csRegistry()->
profilesFor( csf );
104 TQValueVector<KisProfile *> ::iterator it;
105 for ( it = profileList.begin(); it != profileList.end(); ++it ) {
106 m_page->cmbProfile->insertItem((*it)->productName());
108 m_page->cmbProfile->setCurrentText(csf->defaultProfile());
111void NewLayerDialog::fillCmbComposite(
const KisID & s)
113 m_page->cmbComposite->clear();
115 if (!KisMetaRegistry::instance()->csRegistry()->exists(s)) {
119 KisColorSpace * cs = KisMetaRegistry::instance()->csRegistry()->
getColorSpace(s,
"");
125int NewLayerDialog::opacity()
const
127 TQ_INT32 opacity = m_page->intOpacity->value();
132 opacity = int((opacity * 255.0) / 100 + 0.5);
138KisCompositeOp NewLayerDialog::compositeOp()
const
140 return m_page->cmbComposite->currentItem();
143KisID NewLayerDialog::colorSpaceID()
const
145 return m_page->cmbColorSpaces->currentItem();
148TQString NewLayerDialog::layerName()
const
150 return m_page->editName->text();
153TQString NewLayerDialog::profileName()
const
155 return m_page->cmbProfile-> currentText();
158#include "kis_dlg_new_layer.moc"
TQValueVector< KisProfile * > profilesFor(KisColorSpaceFactory *cs)
Return the vector of profiles for this colorspacefactory.
KisColorSpace * getColorSpace(const KisID &csID, const TQString &profileName)
Return the colorspace + profile as named, or NULL if impossible combination.
virtual KisCompositeOpList userVisiblecompositeOps() const =0
Returns the list of user-visible composite ops supported by this colourspace.
_T get(const KisID &name) const
This function allow to get an object from its KisID.
Chalk has a large number of extensible resources.