Commit 39e45bae authored by Boudewijn Rempt's avatar Boudewijn Rempt

Move libcolor/libbrush/libpsd to libs

This basically showed that we had entangled ourselves majorly,
kritaimage has includes from kritaui, which it exported to kritapsd
and so on.
parent 7d1d542f
......@@ -303,8 +303,8 @@ else()
set(HAVE_XCB FALSE)
endif()
# use sane compile flags
add_definitions(
-DTRANSLATION_DOMAIN=\"krita\"
-DQT_USE_QSTRINGBUILDER
-DQT_STRICT_ITERATORS
-DQT_NO_SIGNALS_SLOTS_KEYWORDS
......@@ -637,9 +637,7 @@ set(PIGMENT_INCLUDES ${KOPLUGIN_INCLUDES}
${CMAKE_SOURCE_DIR}/libs/pigment
${CMAKE_BINARY_DIR}/libs/pigment
${CMAKE_SOURCE_DIR}/libs/pigment/compositeops
${CMAKE_SOURCE_DIR}/libs/pigment/resources
${Boost_INCLUDE_DIRS}
)
# flake depends on koodf and pigment
......
project(krita)
add_definitions(
-DTRANSLATION_DOMAIN=\"krita\"
-DQT_USE_QSTRINGBUILDER
-DQT_STRICT_ITERATORS
-DQT_NO_URL_CAST_FROM_STRING
-DQT_NO_SIGNALS_SLOTS_KEYWORDS
-DQT_USE_FAST_OPERATOR_PLUS
-DQT_USE_FAST_CONCATENATION
)
# To avoid the confusion of an endless stream of Eigen warnings.
if (CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_GNUC)
add_definitions(-Wno-unused-local-typedefs -Wno-deprecated -Wno-deprecated-declarations)
......@@ -66,12 +56,9 @@ set(KRITA_INCLUDES
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_BINARY_DIR}/image
${CMAKE_SOURCE_DIR}/krita/libpsd
${CMAKE_SOURCE_DIR}/krita/image
${CMAKE_SOURCE_DIR}/krita/image/brushengine
${CMAKE_SOURCE_DIR}/krita/image/tiles
${CMAKE_SOURCE_DIR}/krita/libbrush
${CMAKE_SOURCE_DIR}/krita/libcolor
${CMAKE_SOURCE_DIR}/krita/ui
${CMAKE_SOURCE_DIR}/krita/ui/canvas
${CMAKE_SOURCE_DIR}/krita/ui/tool
......@@ -98,10 +85,7 @@ set(KRITA_INCLUDES
include_directories(${KRITA_INCLUDES})
add_subdirectory( libpsd )
add_subdirectory( image )
add_subdirectory( libbrush )
add_subdirectory( libcolor )
add_subdirectory( ui )
add_subdirectory( dtd )
add_subdirectory( plugins )
......
......@@ -35,7 +35,7 @@
#include <kis_gradient_painter.h>
#include <KoCompositeOps.h>
#include <KoStopGradient.h>
#include <resources/KoStopGradient.h>
void KisGradientBenchmark::initTestCase()
{
......
......@@ -23,9 +23,9 @@
#include <QEvent>
#include <QPointF>
#include <KoColor.h>
#include <KoAbstractGradient.h>
#include <resources/KoAbstractGradient.h>
#include <kis_node.h>
#include <KoPattern.h>
#include <resources/KoPattern.h>
#include <KoGridData.h>
#include <kis_paintop_preset.h>
#include <kis_smoothing_options.h>
......
add_subdirectory( tests )
# Chose a tiles backend
# 1 - image/tiles
# 3 - image/tiles3
set(USE_TILESYSTEM 3)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config-tiles.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/../config-tiles.h) ### WRONG PLACE???
if(USE_TILESYSTEM EQUAL 3)
set(libkritatile_SRCS
${CMAKE_SOURCE_DIR}/krita/image/tiles3/kis_tile.cc
${CMAKE_SOURCE_DIR}/krita/image/tiles3/kis_tile_data.cc
......@@ -29,7 +21,6 @@ set(libkritatile_SRCS
${CMAKE_SOURCE_DIR}/krita/image/tiles3/swap/kis_tile_data_swapper.cpp
)
add_subdirectory( tiles3 )
endif()
include_directories(
${CMAKE_SOURCE_DIR}/krita/image/metadata
......@@ -229,7 +220,6 @@ set(kritaimage_LIB_SRCS
kis_liquify_transform_worker.cpp
kis_green_coordinates_math.cpp
kis_algebra_2d.cpp
kis_dom_utils.cpp
kis_transparency_mask.cc
kis_undo_store.cpp
kis_undo_stores.cpp
......
......@@ -19,7 +19,7 @@
#ifndef KIS_PAINTOP_PRESET_H
#define KIS_PAINTOP_PRESET_H
#include "KoResource.h"
#include <resources/KoResource.h>
#include "KoID.h"
#include "kis_types.h"
......
......@@ -27,7 +27,7 @@
KisNodePropertyListCommand::KisNodePropertyListCommand(KisNodeSP node, KisNodeModel::PropertyList newPropertyList)
KisNodePropertyListCommand::KisNodePropertyListCommand(KisNodeSP node, KisBaseNode::PropertyList newPropertyList)
: KisNodeCommand(kundo2_i18n("Property Changes"), node),
m_newPropertyList(newPropertyList),
m_oldPropertyList(node->sectionModelProperties())
......@@ -51,19 +51,19 @@ void KisNodePropertyListCommand::undo()
doUpdate(m_newPropertyList, m_oldPropertyList);
}
void KisNodePropertyListCommand::doUpdate(const KisNodeModel::PropertyList &oldPropertyList,
const KisNodeModel::PropertyList &newPropertyList)
void KisNodePropertyListCommand::doUpdate(const KisBaseNode::PropertyList &oldPropertyList,
const KisBaseNode::PropertyList &newPropertyList)
{
bool oldPassThroughValue = false;
bool newPassThroughValue = false;
Q_FOREACH (const KisNodeModel::Property &prop, oldPropertyList) {
Q_FOREACH (const KisBaseNode::Property &prop, oldPropertyList) {
if (prop.name == i18n("Pass Through")) {
oldPassThroughValue = prop.state.toBool();
}
}
Q_FOREACH (const KisNodeModel::Property &prop, newPropertyList) {
Q_FOREACH (const KisBaseNode::Property &prop, newPropertyList) {
if (prop.name == i18n("Pass Through")) {
newPassThroughValue = prop.state.toBool();
}
......@@ -83,7 +83,7 @@ void KisNodePropertyListCommand::doUpdate(const KisNodeModel::PropertyList &oldP
void KisNodePropertyListCommand::setNodePropertiesNoUndo(KisNodeSP node, KisImageSP image, PropertyList proplist)
{
bool undo = true;
Q_FOREACH (const KisNodeModel::Property &prop, proplist) {
Q_FOREACH (const KisBaseNode::Property &prop, proplist) {
if (prop.name == i18n("Visible") && node->visible() != prop.state.toBool()) undo = false;
if (prop.name == i18n("Locked") && node->userLocked() != prop.state.toBool()) undo = false;
if (prop.name == i18n("Active")) {
......
......@@ -20,7 +20,7 @@
#define KIS_IMAGE_NODE_PROPERTY_LIST_COMMAND_H_
#include "kis_node_command.h"
#include "kis_node_model.h"
#include "kis_base_node.h"
/// The command for changing the property list of a layer
......@@ -32,21 +32,21 @@ public:
* Constructor
* @param node the layer to add
*/
KisNodePropertyListCommand(KisNodeSP node, KisNodeModel::PropertyList newPropertyList);
KisNodePropertyListCommand(KisNodeSP node, KisBaseNode::PropertyList newPropertyList);
virtual void redo();
virtual void undo();
typedef KisNodeModel::PropertyList PropertyList;
typedef KisBaseNode::PropertyList PropertyList;
static void setNodePropertiesNoUndo(KisNodeSP node, KisImageSP image, PropertyList proplist);
private:
void doUpdate(const KisNodeModel::PropertyList &oldPropertyList,
const KisNodeModel::PropertyList &newPropertyList);
void doUpdate(const KisBaseNode::PropertyList &oldPropertyList,
const KisBaseNode::PropertyList &newPropertyList);
private:
KisNodeModel::PropertyList m_newPropertyList;
KisNodeModel::PropertyList m_oldPropertyList;
KisBaseNode::PropertyList m_newPropertyList;
KisBaseNode::PropertyList m_oldPropertyList;
};
#endif
......@@ -23,7 +23,7 @@
#include "kundo2command.h"
#include "kritaimage_export.h"
#include "kis_types.h"
#include "kis_psd_layer_style.h"
class KRITAIMAGE_EXPORT KisSetLayerStyleCommand : public KUndo2Command
{
......
/* config-tiles.h. Generated by cmake from config-tiles.h.cmake */
/* Define if you are using the 'old' (Krita 1.5+-style) or 'new' (post-2.O-style) of tile system */
/**
* 1 - image/tiles
* 2 - image/tiles_new
* 3 - image/tiles3
*/
#ifndef CONFIG_TILES_H_
#define CONFIG_TILES_H_
#ifndef USE_TILESYSTEM
#cmakedefine USE_TILESYSTEM @USE_TILESYSTEM@
#endif
#if USE_TILESYSTEM == 1
#error "The tiles1 backend is not available anymore"
#elif USE_TILESYSTEM == 2
#error "The tiles_new backend is not available anymore"
#elif USE_TILESYSTEM == 3
#include <tiles3/kis_tiled_data_manager.h>
#include <tiles3/kis_memento.h>
#endif
#endif /* CONFIG_TILES_H_ */
......@@ -135,12 +135,12 @@ QIcon KisGeneratorLayer::icon() const
return KisIconUtils::loadIcon("krita_tool_color_fill");
}
KisNodeModel::PropertyList KisGeneratorLayer::sectionModelProperties() const
KisBaseNode::PropertyList KisGeneratorLayer::sectionModelProperties() const
{
KisSafeFilterConfigurationSP filterConfig = filter();
KisNodeModel::PropertyList l = KisLayer::sectionModelProperties();
l << KisNodeModel::Property(i18n("Generator"),
KisBaseNode::PropertyList l = KisLayer::sectionModelProperties();
l << KisBaseNode::Property(i18n("Generator"),
KisGeneratorRegistry::instance()->value(filterConfig->name())->name());
return l;
}
......
......@@ -59,7 +59,7 @@ public:
void accept(KisProcessingVisitor &visitor, KisUndoAdapter *undoAdapter);
QIcon icon() const;
KisNodeModel::PropertyList sectionModelProperties() const;
KisBaseNode::PropertyList sectionModelProperties() const;
/**
* re-run the generator. This happens over the bounds
......
......@@ -122,12 +122,12 @@ QIcon KisAdjustmentLayer::icon() const
return KisIconUtils::loadIcon("view-filter");
}
KisNodeModel::PropertyList KisAdjustmentLayer::sectionModelProperties() const
KisBaseNode::PropertyList KisAdjustmentLayer::sectionModelProperties() const
{
KisSafeFilterConfigurationSP filterConfig = filter();
KisNodeModel::PropertyList l = KisLayer::sectionModelProperties();
KisBaseNode::PropertyList l = KisLayer::sectionModelProperties();
if (filterConfig)
l << KisNodeModel::Property(i18nc("property of a filter layer, noun", "Filter"), KisFilterRegistry::instance()->value(filterConfig->name())->name());
l << KisBaseNode::Property(i18nc("property of a filter layer, noun", "Filter"), KisFilterRegistry::instance()->value(filterConfig->name())->name());
return l;
}
......
......@@ -88,10 +88,10 @@ public:
* name is it is a filter. Overrides sectionModelProperties
* in KisLayer, and KisLayer overrides
* sectionModelProperties in KisBaseNode.
* @return KisNodeModel::PropertyList returns a list
* @return KisBaseNode::PropertyList returns a list
* of the properties
*/
KisNodeModel::PropertyList sectionModelProperties() const;
KisBaseNode::PropertyList sectionModelProperties() const;
public:
......
......@@ -20,7 +20,7 @@
#ifndef _KIS_MASK_GENERATOR_H_
#define _KIS_MASK_GENERATOR_H_
#include <KoVcMultiArchBuildSupport.h> //MSVC requires that Vc come first
#include <compositeops/KoVcMultiArchBuildSupport.h> //MSVC requires that Vc come first
#include <KoID.h>
#include <klocalizedstring.h>
......
......@@ -32,7 +32,7 @@ struct Q_DECL_HIDDEN KisBaseNode::Private
QString compositeOp;
KoProperties properties;
bool systemLocked;
KisNodeModel::Property hack_visible; //HACK
KisBaseNode::Property hack_visible; //HACK
QUuid id;
bool collapsed;
bool supportsLodMoves;
......@@ -140,15 +140,15 @@ void KisBaseNode::setCompositeOpId(const QString& compositeOp)
baseNodeInvalidateAllFramesCallback();
}
KisNodeModel::PropertyList KisBaseNode::sectionModelProperties() const
KisBaseNode::PropertyList KisBaseNode::sectionModelProperties() const
{
KisNodeModel::PropertyList l;
KisBaseNode::PropertyList l;
l << KisLayerPropertiesIcons::getProperty(KisLayerPropertiesIcons::visible, visible(), m_d->hack_visible.isInStasis, m_d->hack_visible.stateInStasis);
l << KisLayerPropertiesIcons::getProperty(KisLayerPropertiesIcons::locked, userLocked());
return l;
}
void KisBaseNode::setSectionModelProperties(const KisNodeModel::PropertyList &properties)
void KisBaseNode::setSectionModelProperties(const KisBaseNode::PropertyList &properties)
{
setVisible(properties.at(0).state.toBool());
m_d->hack_visible = properties.at(0);
......@@ -304,3 +304,4 @@ void KisBaseNode::setSupportsLodMoves(bool value)
{
m_d->supportsLodMoves = value;
}
......@@ -23,8 +23,6 @@
#include <QUuid>
#include <QString>
#include "kis_node_model.h"
#include "kis_shared.h"
#include "kis_paint_device.h"
#include "kis_processing_visitor.h" // included, not forward declared for msvc
......@@ -37,6 +35,8 @@ class KisUndoAdapter;
#include "kritaimage_export.h"
/**
* A KisBaseNode is the base class for all components of an image:
* nodes, layers masks, selections. A node has a number of properties,
......@@ -50,6 +50,99 @@ class KRITAIMAGE_EXPORT KisBaseNode : public QObject, public KisShared
Q_OBJECT
public:
/// Extensions to Qt::ItemDataRole.
enum ItemDataRole
{
/// Whether the section is the active one
ActiveRole = Qt::UserRole + 1,
/// A list of properties the part has.
PropertiesRole,
/// The aspect ratio of the section as a floating point value: width divided by height.
AspectRatioRole,
/// Use to communicate a progress report to the section delegate on an action (a value of -1 or a QVariant() disable the progress bar
ProgressRole,
/// Speacial activation role which is emitted when the user Atl-clicks on a section
/// The item is first activated with ActiveRole, then a separate AlternateActiveRole comes
AlternateActiveRole,
/// This is to ensure that we can extend the data role in the future, since it's not possible to add a role after BeginThumbnailRole (due to "Hack")
ReservedRole = 99,
/**
* For values of BeginThumbnailRole or higher, a thumbnail of the layer of which neither dimension
* is larger than (int) value - (int) BeginThumbnailRole.
* This is a hack to work around the fact that Interview doesn't have a nice way to
* request thumbnails of arbitrary size.
*/
BeginThumbnailRole
};
/**
* Describes a property of a document section.
*
* FIXME: using a QList instead of QMap and not having an untranslated identifier,
* either enum or string, forces applications to rely on the order of properties
* or to compare the translated strings. This makes it hard to robustly extend the
* properties of document section items.
*/
struct Property
{
/** i18n-ed name, suitable for displaying */
QString name;
/** Whether the property is a boolean (e.g. locked, visible) which can be toggled directly from the widget itself. */
bool isMutable;
/** Provide these if the property isMutable. */
QIcon onIcon;
QIcon offIcon;
/** If the property isMutable, provide a boolean. Otherwise, a string suitable for displaying. */
QVariant state;
/** If the property is mutable, specifies whether it can be put into stasis. When a property
is in stasis, a new state is created, and the old one is stored in stateInStasis. When
stasis ends, the old value is restored and the new one discarded */
bool canHaveStasis;
/** If the property isMutable and canHaveStasis, indicate whether it is in stasis or not */
bool isInStasis;
/** If the property isMutable and canHaveStasis, provide this value to store the property's
state while in stasis */
bool stateInStasis;
bool operator==(const Property &rhs) const {
return rhs.name == name;
}
/// Default constructor. Use if you want to assign the members manually.
Property(): isMutable( false ) { }
/// Constructor for a mutable property.
Property( const QString &n, const QIcon &on, const QIcon &off, bool isOn )
: name( n ), isMutable( true ), onIcon( on ), offIcon( off ), state( isOn ), canHaveStasis( false ) { }
/** Constructor for a mutable property accepting stasis */
Property( const QString &n, const QIcon &on, const QIcon &off, bool isOn,
bool isInStasis, bool stateInStasis )
: name( n ), isMutable( true ), onIcon( on ), offIcon( off ), state( isOn ),
canHaveStasis( true ), isInStasis( isInStasis ), stateInStasis( stateInStasis ) { }
/// Constructor for a nonmutable property.
Property( const QString &n, const QString &s )
: name( n ), isMutable( false ), state( s ) { }
};
/** Return this type for PropertiesRole. */
typedef QList<Property> PropertyList;
public:
/**
......@@ -187,12 +280,12 @@ public:
* KisLayer defines opacity = 2, compositeOp = 3
* KisMask defines active = 2 (KisMask does not inherit kislayer)
*/
virtual KisNodeModel::PropertyList sectionModelProperties() const;
virtual PropertyList sectionModelProperties() const;
/**
* Change the section model properties.
*/
virtual void setSectionModelProperties(const KisNodeModel::PropertyList &properties);
virtual void setSectionModelProperties(const PropertyList &properties);
/**
* Return all the properties of this layer as a KoProperties-based
......@@ -449,4 +542,8 @@ private:
};
Q_DECLARE_METATYPE( KisBaseNode::PropertyList )
#endif
......@@ -302,11 +302,11 @@ QIcon KisCloneLayer::icon() const
return KisIconUtils::loadIcon("edit-copy");
}
KisNodeModel::PropertyList KisCloneLayer::sectionModelProperties() const
KisBaseNode::PropertyList KisCloneLayer::sectionModelProperties() const
{
KisNodeModel::PropertyList l = KisLayer::sectionModelProperties();
KisBaseNode::PropertyList l = KisLayer::sectionModelProperties();
if (m_d->copyFrom)
l << KisNodeModel::Property(i18n("Copy From"), m_d->copyFrom->name());
l << KisBaseNode::Property(i18n("Copy From"), m_d->copyFrom->name());
return l;
}
......
......@@ -72,7 +72,7 @@ public:
bool needProjection() const;
QIcon icon() const;
KisNodeModel::PropertyList sectionModelProperties() const;
KisBaseNode::PropertyList sectionModelProperties() const;
qint32 x() const;
qint32 y() const;
......
......@@ -16,7 +16,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include <KoVcMultiArchBuildSupport.h> //MSVC requires that Vc come first
#include <compositeops/KoVcMultiArchBuildSupport.h> //MSVC requires that Vc come first
#include "kis_convolution_kernel.h"
#include <math.h>
......
......@@ -16,7 +16,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include <KoVcMultiArchBuildSupport.h> //MSVC requires that Vc come first
#include <compositeops/KoVcMultiArchBuildSupport.h> //MSVC requires that Vc come first
#include <cmath>
......
......@@ -16,7 +16,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include <KoVcMultiArchBuildSupport.h> //MSVC requires that Vc come first
#include <compositeops/KoVcMultiArchBuildSupport.h> //MSVC requires that Vc come first
#include <cmath>
......
......@@ -24,8 +24,8 @@ class QRect;
class KisPaintDeviceWriter;
class QIODevice;
// Change cmake to switch (at compiletime) to different datamanager
#include <config-tiles.h> // For the next define
#include <tiles3/kis_tiled_data_manager.h>
#include <tiles3/kis_memento.h>
#define ACTUAL_DATAMGR KisTiledDataManager
......
......@@ -47,7 +47,7 @@
#include "kis_image.h"
#include "kis_layer.h"
#include "kis_paint_device.h"
#include "KoPattern.h"
#include <resources/KoPattern.h>
#include "KoColorSpace.h"
#include "kis_transaction.h"
......
......@@ -17,7 +17,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include <KoVcMultiArchBuildSupport.h> //MSVC requires that Vc come first
#include <compositeops/KoVcMultiArchBuildSupport.h> //MSVC requires that Vc come first
#include <cmath>
#include <QDomDocument>
......
......@@ -17,7 +17,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include <KoVcMultiArchBuildSupport.h> //MSVC requires that Vc come first
#include <compositeops/KoVcMultiArchBuildSupport.h> //MSVC requires that Vc come first
#include <cmath>
#include <algorithm>
......
......@@ -21,12 +21,12 @@
#include <cfloat>
#include <KoColorSpace.h>
#include <KoAbstractGradient.h>
#include <resources/KoAbstractGradient.h>
#include <KoUpdater.h>
#include "kis_global.h"
#include "kis_paint_device.h"
#include "KoPattern.h"
#include <resources/KoPattern.h>
#include "kis_selection.h"