mirror of
https://gitlab.gnome.org/GNOME/gimp.git
synced 2025-10-06 01:12:40 +02:00
Compare commits
434 Commits
alxsa-lcms
...
wip/Jehan/
Author | SHA1 | Date | |
---|---|---|---|
|
cf8c306f6d | ||
|
308963c271 | ||
|
4d0fef9482 | ||
|
d5f3fa77db | ||
|
dbf0c39bb3 | ||
|
56f72c24ba | ||
|
a0676125a1 | ||
|
c472800eae | ||
|
63b4d69e48 | ||
|
70bf795dfb | ||
|
a7c4320312 | ||
|
5bc2f26cb0 | ||
|
cacb8d2035 | ||
|
c8ed51bb52 | ||
|
264a65e0b3 | ||
|
e27353216c | ||
|
49fc3ad0bd | ||
|
5b71d1a10d | ||
|
06bcef3273 | ||
|
17b23b6f26 | ||
|
413114f9d0 | ||
|
c2f0afb4bd | ||
|
b945d77ed7 | ||
|
7c04605d14 | ||
|
25edb3cc64 | ||
|
b773c3ac48 | ||
|
9551519f23 | ||
|
a9d2700631 | ||
|
5375ca63d5 | ||
|
78acdd8882 | ||
|
b5dda733dc | ||
|
e17567d001 | ||
|
4a0ea33bc5 | ||
|
a2d106e3fa | ||
|
4ebd340688 | ||
|
15f047f6c0 | ||
|
484d0fbcf4 | ||
|
b70186bc99 | ||
|
4a656a1db0 | ||
|
cb565344e9 | ||
|
c8971ac2ae | ||
|
3ec63979d8 | ||
|
c72e36c6a2 | ||
|
5ccc525281 | ||
|
84eaa94842 | ||
|
bc7cc0b698 | ||
|
602300ec8e | ||
|
64e276c3b5 | ||
|
96394377e6 | ||
|
a926e013da | ||
|
2d74278860 | ||
|
e1e4c0f400 | ||
|
5fc3c29f5c | ||
|
de4fb3470c | ||
|
ddfce634a8 | ||
|
527f4964fe | ||
|
be2e47114d | ||
|
11b81e25a4 | ||
|
4ca05cb38d | ||
|
bb9aad1e87 | ||
|
4dceeb174a | ||
|
9819457f31 | ||
|
7c947ef1af | ||
|
03beda6e2a | ||
|
a7d867c8bc | ||
|
6584f92748 | ||
|
593f0abf09 | ||
|
a734b4a3a4 | ||
|
0fd280db5c | ||
|
443d0a2f7b | ||
|
ed01c1b7f4 | ||
|
904f283932 | ||
|
9026d18039 | ||
|
8a5825b66f | ||
|
71caf7eb05 | ||
|
bf6092c728 | ||
|
6d74a880f9 | ||
|
1a953c5c73 | ||
|
1564efb519 | ||
|
3e96397770 | ||
|
c8cf2219ce | ||
|
2865aa7f03 | ||
|
013f9c7f0c | ||
|
8ea6e4031e | ||
|
69359a16c1 | ||
|
4d84ac748b | ||
|
1dcc8585ef | ||
|
8a3fb8c08e | ||
|
4509ec92f5 | ||
|
ee43316839 | ||
|
0782b9166b | ||
|
5a34856e38 | ||
|
9ec28cec54 | ||
|
d6d959c6c9 | ||
|
83c18ee0f2 | ||
|
5a5e0b6fee | ||
|
acf0920d82 | ||
|
58efcf6312 | ||
|
e3c8910da7 | ||
|
01c1949dd5 | ||
|
599a6c7afe | ||
|
16bb162894 | ||
|
65258d6183 | ||
|
6e80f98390 | ||
|
e18eaff1dc | ||
|
a4c780f6c9 | ||
|
0665e3fb5c | ||
|
9f9bf1003d | ||
|
8b560f835e | ||
|
2a9eb5aa66 | ||
|
002b22c150 | ||
|
d27c580144 | ||
|
4738472fcd | ||
|
4eb106f2bf | ||
|
53b18653bc | ||
|
2012eef75c | ||
|
fb31ddf322 | ||
|
0f309f9a8d | ||
|
05e90b1cde | ||
|
e4cb1e485e | ||
|
03f7cf58b8 | ||
|
5f4329d324 | ||
|
1a144f35a6 | ||
|
8287302b50 | ||
|
98dbff1e99 | ||
|
53a1d07ffd | ||
|
0191e0a485 | ||
|
fc4eb6730c | ||
|
459090836a | ||
|
81c844d2ca | ||
|
51ba945eb1 | ||
|
87def70e1e | ||
|
35257782ca | ||
|
238718b667 | ||
|
95cbadd277 | ||
|
88d6dfea04 | ||
|
6b1834ec9e | ||
|
10319fc883 | ||
|
624f049e66 | ||
|
0c5e5c0094 | ||
|
50978f18b6 | ||
|
cb4316d07a | ||
|
a530892fb5 | ||
|
ad3ec69183 | ||
|
6c1c497ce0 | ||
|
b1e52381f5 | ||
|
27a89a0c8a | ||
|
a636aea98d | ||
|
62727a654c | ||
|
2e05a4b1d9 | ||
|
0faa10ddd6 | ||
|
d16fe453b6 | ||
|
e5c04e449e | ||
|
8a3603828b | ||
|
4b252bddec | ||
|
b42ba20657 | ||
|
c5ddbf5732 | ||
|
1e5be02d8c | ||
|
cf9d39c3d7 | ||
|
1365b8a08b | ||
|
51ffd78d2a | ||
|
d985b9b377 | ||
|
760ef381fe | ||
|
19e230e9cb | ||
|
04622852fa | ||
|
2f6b75913b | ||
|
883498916a | ||
|
8e2a0381d7 | ||
|
c732dfd4ca | ||
|
38c379cd92 | ||
|
9a780bc7d4 | ||
|
db18d739e5 | ||
|
2c44689fe2 | ||
|
cc4821ffcb | ||
|
35b972c854 | ||
|
2a3d54bee9 | ||
|
c0d2a7fadd | ||
|
a5aaed7929 | ||
|
4ed035affd | ||
|
44d90a389e | ||
|
4f3aee5e83 | ||
|
9519901150 | ||
|
d8712a525b | ||
|
640fb89f13 | ||
|
24ca35625b | ||
|
769b911018 | ||
|
84b450b7bd | ||
|
4ec1368af9 | ||
|
520aeacd8c | ||
|
0fb3c8bb67 | ||
|
1f0f8d1a2c | ||
|
be667ac007 | ||
|
16a1283f07 | ||
|
1f79e4314e | ||
|
55627934c5 | ||
|
61c67d012b | ||
|
faf0fd7401 | ||
|
eeeaca928b | ||
|
73979309ab | ||
|
97bf7e1bfa | ||
|
95f1d768c3 | ||
|
66cdecb0fa | ||
|
8280058c5a | ||
|
2821dbab58 | ||
|
7c7587bb2d | ||
|
3e5fce27cb | ||
|
4128c789f9 | ||
|
0b8397ff56 | ||
|
9b0f426fbd | ||
|
674939e225 | ||
|
a60487aedd | ||
|
2dac66d979 | ||
|
f4a2158458 | ||
|
28bf061f4d | ||
|
0b5aa01bb9 | ||
|
f45244f991 | ||
|
39185d43ba | ||
|
6c86e80019 | ||
|
3e6fed839a | ||
|
6e91826865 | ||
|
20083bcabe | ||
|
ac63b1d8fb | ||
|
d1dca0a881 | ||
|
8a771a2a51 | ||
|
33f6117539 | ||
|
b80a2341cf | ||
|
3ad4b063b0 | ||
|
de2b54faa6 | ||
|
30d31ac709 | ||
|
5d308e9ed9 | ||
|
e52b49e0a3 | ||
|
565804f26e | ||
|
c734c0f33f | ||
|
1a96fb55f9 | ||
|
922e409045 | ||
|
3211ab1408 | ||
|
2c91604509 | ||
|
f02910d00f | ||
|
2346acbfc2 | ||
|
7764eab3f6 | ||
|
ca43c6f20c | ||
|
05cde48a3e | ||
|
4bf7ed4265 | ||
|
0aa7af0f11 | ||
|
d2beafd0e9 | ||
|
fa683ca0ce | ||
|
4fa0a63ca4 | ||
|
d2720dca0c | ||
|
d72bc4704e | ||
|
eb30705545 | ||
|
807e263b87 | ||
|
fae39c792d | ||
|
3290dd9b8f | ||
|
137bf01928 | ||
|
8f895aaa8c | ||
|
b4952addb9 | ||
|
5856941814 | ||
|
1e5639a47d | ||
|
e8b6f05659 | ||
|
6eaf357af9 | ||
|
da16988ee0 | ||
|
f9809354d5 | ||
|
ad03d6c94a | ||
|
f6704a84fa | ||
|
5c35946c51 | ||
|
6245e4ee70 | ||
|
0c6d7c15bc | ||
|
0d7cea41ad | ||
|
c63d7bc226 | ||
|
3d14a2652d | ||
|
8993939008 | ||
|
3c85dfe6e9 | ||
|
96be4a79d3 | ||
|
381bee5dbb | ||
|
0f12dcc772 | ||
|
293300cafd | ||
|
898ab7c9c6 | ||
|
f3a8e0c041 | ||
|
2b779c6a11 | ||
|
735ae9f123 | ||
|
09203bb93e | ||
|
1d5a1c9972 | ||
|
fb04b7cb8f | ||
|
6fe919c6e2 | ||
|
1c7a43a021 | ||
|
4b67eb9cd0 | ||
|
baa5e0690e | ||
|
ffa2946b18 | ||
|
8710127641 | ||
|
cfb1b539f2 | ||
|
11b35908fa | ||
|
6ddb33135c | ||
|
125e355c44 | ||
|
edc6f5a4b1 | ||
|
246d73de04 | ||
|
c2195a24ca | ||
|
977bcae71e | ||
|
31293376ee | ||
|
42e72b29c1 | ||
|
31a267a8f1 | ||
|
193cf720c6 | ||
|
94dcb39659 | ||
|
af6bb31f89 | ||
|
fe10197298 | ||
|
e67068d92f | ||
|
54f39cef6d | ||
|
ada86282de | ||
|
afb8867bce | ||
|
9f17f97198 | ||
|
41a464cb9a | ||
|
4a93a04a6b | ||
|
a1cd2a2588 | ||
|
60ed90e10a | ||
|
03443ffcc1 | ||
|
4f6036e3e6 | ||
|
20d37cbe45 | ||
|
949f9b586b | ||
|
ee50e5f1c7 | ||
|
4fb5857123 | ||
|
53f714f8bc | ||
|
52ffd75330 | ||
|
6a7911655b | ||
|
522d73a922 | ||
|
a5d282fc80 | ||
|
87f670b5d1 | ||
|
0022e9738e | ||
|
634dd304d7 | ||
|
d0af548894 | ||
|
a8934067a9 | ||
|
3b11006eed | ||
|
f333aa354b | ||
|
9a118dd887 | ||
|
f5518cd69a | ||
|
0570ea2b0b | ||
|
891e55829c | ||
|
b43e4df63f | ||
|
a6545f3511 | ||
|
b4eda82a93 | ||
|
3f13511015 | ||
|
d261d466e9 | ||
|
162725bd8c | ||
|
3d91452507 | ||
|
d8a264283b | ||
|
bb1d96528d | ||
|
ede124ff85 | ||
|
aa9aa9e489 | ||
|
f890c5ab68 | ||
|
9eee96328b | ||
|
634ebf97e7 | ||
|
79a92ce439 | ||
|
eefc2bea1a | ||
|
f7cfd4ef39 | ||
|
0c1963ca7c | ||
|
0868cf3cd3 | ||
|
bb26b9f81d | ||
|
052eb474cc | ||
|
abf026fc54 | ||
|
9bf03bc8f6 | ||
|
202ae26c80 | ||
|
973ae3eef2 | ||
|
b04841d993 | ||
|
437ba0aa46 | ||
|
caa0df8e22 | ||
|
5b765fc665 | ||
|
f5fa753dc2 | ||
|
d59c230560 | ||
|
3e9585839e | ||
|
a6b09d8029 | ||
|
56a5dea720 | ||
|
c3079a7ad4 | ||
|
50e96b181f | ||
|
c35abbe090 | ||
|
6211ec8d2c | ||
|
1730c62187 | ||
|
ff157df094 | ||
|
03172b7196 | ||
|
e5260cd60f | ||
|
56838c1194 | ||
|
841b5ddfb9 | ||
|
0d50753cca | ||
|
6cc054ee4e | ||
|
bbb0be8413 | ||
|
92c096d699 | ||
|
9308de3137 | ||
|
946a362d9b | ||
|
decc8dec6c | ||
|
048c86ffcf | ||
|
8470ec8b10 | ||
|
f35cc4693c | ||
|
632cbd9ed3 | ||
|
5b97d96349 | ||
|
b24fc1b74b | ||
|
ebec92aec7 | ||
|
861e406393 | ||
|
b65bd2bd4c | ||
|
2e12de6747 | ||
|
9f789e68d5 | ||
|
6124b56b3e | ||
|
839064a6c6 | ||
|
56cc7e363b | ||
|
aee3bd23d6 | ||
|
c3d01854b3 | ||
|
d932d02fbe | ||
|
4255227fff | ||
|
a87ee3c241 | ||
|
124993d770 | ||
|
ff9a14b7d0 | ||
|
f96a7192cd | ||
|
d4aac4a3e5 | ||
|
5da4b89002 | ||
|
b960be9735 | ||
|
2d57b1764d | ||
|
6651d4eb7f | ||
|
795cf081cc | ||
|
7fad4ad323 | ||
|
9e2b378414 | ||
|
92e68453df | ||
|
c114e96096 | ||
|
b4e27fbf83 | ||
|
33dfccde51 | ||
|
2f87f8e51e | ||
|
6574f6ff30 | ||
|
92150e07ba | ||
|
37ff61d0ac | ||
|
d0d4c769e3 | ||
|
aa0a25d82a | ||
|
cb13ce0da3 | ||
|
f520df6f4a | ||
|
3a2d9c477e | ||
|
261f407008 | ||
|
d9b9a7f8bd | ||
|
4514e61fd1 | ||
|
e3b58d5180 | ||
|
67dcac45ef |
242
.gitlab-ci.yml
242
.gitlab-ci.yml
@@ -30,7 +30,8 @@ workflow:
|
||||
##################################################
|
||||
|
||||
## 1. On MERGE REQUESTS, the following are triggered:
|
||||
## - Abbreviated Linux Clang build (base & fast)
|
||||
## - Abbreviated Linux Clang build
|
||||
## - Building quality tests (static code analysis)
|
||||
## - clang-format (static code analysis)
|
||||
## - Execution tests (dynamic code analysis)
|
||||
.pipeline_merge: &CI_MERGE
|
||||
@@ -43,20 +44,22 @@ workflow:
|
||||
# GitLab is quite sensitive about rules 'if' order so be careful
|
||||
|
||||
## 3. On COMMITS except tags.
|
||||
## - Linux Clang build (base & fast)
|
||||
## - Linux Clang build
|
||||
## - Building quality tests (static code analysis)
|
||||
## - Execution tests (dynamic code analysis)
|
||||
## - Source tarball (base & fast)
|
||||
## - Developer documentation (base & fast)
|
||||
## - Source tarball
|
||||
## - Developer documentation
|
||||
.pipeline_commit: &CI_COMMIT
|
||||
if: '$CI_PIPELINE_SOURCE == "push" && $CI_OPEN_MERGE_REQUESTS == null && $CI_COMMIT_TAG == null'
|
||||
interruptible: true
|
||||
variables: {}
|
||||
|
||||
## 4. RELEASES.
|
||||
## - Source tarball (base & fast)
|
||||
## - Developer documentation (base & fast)
|
||||
## - Inno Windows installer (base but slow)
|
||||
## - MS Store .msixupload (base but slow)
|
||||
## - Source tarball
|
||||
## - Developer documentation
|
||||
## - Linux .appimage
|
||||
## - Inno Windows installer
|
||||
## - MS Store .msixupload
|
||||
.pipeline_release: &CI_RELEASE
|
||||
if: '$CI_COMMIT_TAG != null'
|
||||
interruptible: false
|
||||
@@ -77,10 +80,11 @@ workflow:
|
||||
- 'runner_system_failure'
|
||||
- 'scheduler_failure'
|
||||
needs: []
|
||||
# Default Docker image (unless otherwise defined)
|
||||
image: debian:${DEB_VERSION}
|
||||
# Default Docker image (keep variables: DEB_VERSION: consistent with devel-docs/os-support.txt)
|
||||
image: $CI_REGISTRY_IMAGE:build-debian-${DEB_VERSION}-${RUNNER}
|
||||
variables:
|
||||
DEB_VERSION: "bookworm"
|
||||
RUNNER: "x86_64_v3"
|
||||
# Common cloning procedure
|
||||
GIT_DEPTH: "1"
|
||||
GIT_SUBMODULE_STRATEGY: none
|
||||
@@ -111,7 +115,6 @@ stages:
|
||||
- RUNNER: [aarch64, x86_64_v3]
|
||||
tags:
|
||||
- $RUNNER
|
||||
image: $CI_REGISTRY_IMAGE:build-debian-${DEB_VERSION}-${RUNNER}
|
||||
variables:
|
||||
CC: "clang"
|
||||
CXX: "clang++"
|
||||
@@ -138,19 +141,17 @@ stages:
|
||||
deps-debian:
|
||||
extends: .debian
|
||||
stage: dependencies
|
||||
image:
|
||||
name: gcr.io/kaniko-project/executor:debug
|
||||
entrypoint: [""]
|
||||
image: quay.io/buildah/stable
|
||||
variables:
|
||||
GIT_STRATEGY: none
|
||||
UMFPACK: libumfpack5
|
||||
PKGCONF_RELOCATABLE_OPTION: '-Dpkgconfig.relocatable=true'
|
||||
script:
|
||||
- export container=docker
|
||||
- mkdir -p /kaniko/.docker
|
||||
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
|
||||
- export BUILDAH_FORMAT=docker
|
||||
- export STORAGE_DRIVER=vfs
|
||||
- echo "$CI_REGISTRY_PASSWORD" | buildah login -u "$CI_REGISTRY_USER" --password-stdin $CI_REGISTRY
|
||||
# Install deps
|
||||
- echo "FROM debian:${DEB_VERSION}" > Dockerfile
|
||||
- echo "WORKDIR $CI_PROJECT_DIR" >> Dockerfile
|
||||
- echo "RUN printf \"\e[0Ksection_start:0000000001:deps_install[collapsed=true]\r\e[0KInstalling dependencies provided by Debian $DEB_VERSION\n\"" >> Dockerfile
|
||||
- echo "RUN apt-get update -qq" >> Dockerfile
|
||||
## 'ca-certificates' is NOT a gimp dep, it is installed only to our Docker image work
|
||||
@@ -159,7 +160,6 @@ deps-debian:
|
||||
- echo "RUN apt-get install -qq -y --no-install-recommends \\" >> Dockerfile
|
||||
- echo "appstream
|
||||
bison
|
||||
ccache
|
||||
clang
|
||||
desktop-file-utils
|
||||
flex
|
||||
@@ -180,6 +180,7 @@ deps-debian:
|
||||
glib-networking
|
||||
graphviz
|
||||
graphviz-dev
|
||||
gvfs
|
||||
iso-codes
|
||||
libaa1-dev
|
||||
libappstream-dev
|
||||
@@ -208,7 +209,7 @@ deps-debian:
|
||||
librsvg2-dev
|
||||
libsuitesparse-dev
|
||||
libtiff-dev
|
||||
$UMFPACK
|
||||
libumfpack5
|
||||
libunwind-dev
|
||||
libwebp-dev
|
||||
libwmf-dev
|
||||
@@ -223,9 +224,7 @@ deps-debian:
|
||||
# Prepare environ
|
||||
- echo "FROM $CI_REGISTRY_IMAGE:build-debian-${DEB_VERSION}-${RUNNER}" > Dockerfile2;
|
||||
- echo "RUN printf \"\e[0Ksection_start:`date +%s`:environ[collapsed=true]\r\e[0KPreparing build environment\n\"" >> Dockerfile2;
|
||||
- export LIB_DIR="lib";
|
||||
- export LIB_SUBDIR=$([ "$(uname -m)" = 'aarch64' ] && echo "aarch64-linux-gnu/" || echo "x86_64-linux-gnu/");
|
||||
- echo "ENV PKG_CONFIG_PATH=\"${GIMP_PREFIX}/${LIB_DIR}/${LIB_SUBDIR}pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}\"" >> Dockerfile2;
|
||||
- echo "ENV PKG_CONFIG_PATH=\"${GIMP_PREFIX}/lib/$([ "$(uname -m)" = 'aarch64' ] && echo "aarch64-linux-gnu/" || echo "x86_64-linux-gnu/")pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}\"" >> Dockerfile2;
|
||||
- echo "ENV XDG_DATA_DIRS=\"${GIMP_PREFIX}/share:/usr/share${XDG_DATA_DIRS:+:$XDG_DATA_DIRS}\"" >> Dockerfile2;
|
||||
- echo "ENV CC=\"$CC\"" >> Dockerfile2;
|
||||
- echo "ENV CXX=\"$CXX\"" >> Dockerfile2;
|
||||
@@ -236,20 +235,21 @@ deps-debian:
|
||||
# Build some dependencies
|
||||
## Build babl
|
||||
- echo "RUN printf \"\e[0Ksection_start:`date +%s`:babl_build[collapsed=true]\r\e[0KBuilding babl\n\"" >> Dockerfile2;
|
||||
- echo "RUN git clone --branch \"\$([ \"$CI_COMMIT_TAG\" ] && echo \"\$(git ls-remote --tags --exit-code --refs https://gitlab.gnome.org/GNOME/babl.git | grep -oi \"BABL_[0-9]*_[0-9]*_[0-9]*\" | sort --version-sort | tail -1)\" || echo \"master\")\" --depth=${GIT_DEPTH} https://gitlab.gnome.org/GNOME/babl.git" $CI_PROJECT_DIR/babl >> Dockerfile2;
|
||||
- echo "RUN meson setup $CI_PROJECT_DIR/babl/_build-${RUNNER} $CI_PROJECT_DIR/babl -Dprefix=\"${GIMP_PREFIX}\" $PKGCONF_RELOCATABLE_OPTION" >> Dockerfile2;
|
||||
- echo "RUN ninja -C $CI_PROJECT_DIR/babl/_build-${RUNNER}" >> Dockerfile2;
|
||||
- echo "RUN ninja -C $CI_PROJECT_DIR/babl/_build-${RUNNER} install" >> Dockerfile2;
|
||||
- echo "RUN git clone --branch \"\$([ \"$CI_COMMIT_TAG\" ] && echo \"\$(git ls-remote --tags --exit-code --refs https://gitlab.gnome.org/GNOME/babl.git | grep -oi \"BABL_[0-9]*_[0-9]*_[0-9]*\" | sort --version-sort | tail -1)\" || echo \"master\")\" --depth=${GIT_DEPTH} https://gitlab.gnome.org/GNOME/babl.git" babl >> Dockerfile2;
|
||||
- echo "RUN meson setup babl/_build-${RUNNER} babl -Dprefix=\"${GIMP_PREFIX}\" $PKGCONF_RELOCATABLE_OPTION" >> Dockerfile2;
|
||||
- echo "RUN ninja -C babl/_build-${RUNNER}" >> Dockerfile2;
|
||||
- echo "RUN ninja -C babl/_build-${RUNNER} install" >> Dockerfile2;
|
||||
- echo "RUN printf \"\e[0Ksection_end:`date +%s`:babl_build\r\e[0K\n\"" >> Dockerfile2;
|
||||
## Build GEGL
|
||||
- echo "RUN printf \"\e[0Ksection_start:`date +%s`:gegl_build[collapsed=true]\r\e[0KBuilding gegl\n\"" >> Dockerfile2;
|
||||
- echo "RUN git clone --branch \"\$([ \"$CI_COMMIT_TAG\" ] && echo \"\$(git ls-remote --tags --exit-code --refs https://gitlab.gnome.org/GNOME/gegl.git | grep -oi \"GEGL_[0-9]*_[0-9]*_[0-9]*\" | sort --version-sort | tail -1)\" || echo \"master\")\" --depth=${GIT_DEPTH} https://gitlab.gnome.org/GNOME/gegl.git" $CI_PROJECT_DIR/gegl >> Dockerfile2;
|
||||
- echo "RUN meson setup $CI_PROJECT_DIR/gegl/_build-${RUNNER} $CI_PROJECT_DIR/gegl -Dprefix=\"${GIMP_PREFIX}\" $PKGCONF_RELOCATABLE_OPTION $WORKSHOP_OPTION" >> Dockerfile2;
|
||||
- echo "RUN ninja -C $CI_PROJECT_DIR/gegl/_build-${RUNNER}" >> Dockerfile2;
|
||||
- echo "RUN ninja -C $CI_PROJECT_DIR/gegl/_build-${RUNNER} install" >> Dockerfile2;
|
||||
- echo "RUN git clone --branch \"\$([ \"$CI_COMMIT_TAG\" ] && echo \"\$(git ls-remote --tags --exit-code --refs https://gitlab.gnome.org/GNOME/gegl.git | grep -oi \"GEGL_[0-9]*_[0-9]*_[0-9]*\" | sort --version-sort | tail -1)\" || echo \"master\")\" --depth=${GIT_DEPTH} https://gitlab.gnome.org/GNOME/gegl.git" gegl >> Dockerfile2;
|
||||
- echo "RUN meson setup gegl/_build-${RUNNER} gegl -Dprefix=\"${GIMP_PREFIX}\" $PKGCONF_RELOCATABLE_OPTION -Dworkshop=true" >> Dockerfile2;
|
||||
- echo "RUN ninja -C gegl/_build-${RUNNER}" >> Dockerfile2;
|
||||
- echo "RUN ninja -C gegl/_build-${RUNNER} install" >> Dockerfile2;
|
||||
- echo "RUN printf \"\e[0Ksection_end:`date +%s`:gegl_build\r\e[0K\n\"" >> Dockerfile2;
|
||||
- /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --destination $CI_REGISTRY_IMAGE:build-debian-${DEB_VERSION}-${RUNNER} --cache=true --cache-ttl=120h --image-fs-extract-retry 1 --verbosity=warn
|
||||
- if [ -f 'Dockerfile2' ]; then /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile2 --destination build-debian-${DEB_VERSION}-${RUNNER}-temp --cache=false --no-push --verbosity=warn; fi
|
||||
#FIXME: '2>&1 | grep -v STEP' since buildah is too verbose. See: https://github.com/containers/buildah/issues/6362
|
||||
- buildah build --log-level error --volume $CI_PROJECT_DIR:$CI_PROJECT_DIR:Z --file $CI_PROJECT_DIR/Dockerfile --tag $CI_REGISTRY_IMAGE:build-debian-${DEB_VERSION}-${RUNNER} --layers --cache-from $CI_REGISTRY_IMAGE/cache --cache-to $CI_REGISTRY_IMAGE/cache --cache-ttl=120h 2>&1 | grep -v STEP && buildah push --log-level error $CI_REGISTRY_IMAGE:build-debian-${DEB_VERSION}-${RUNNER} 2>&1 | grep -v STEP
|
||||
- buildah build --log-level error --volume $CI_PROJECT_DIR:$CI_PROJECT_DIR:Z --file $CI_PROJECT_DIR/Dockerfile2 --no-cache 2>&1 | grep -v STEP
|
||||
artifacts:
|
||||
paths:
|
||||
- _install-${RUNNER}/
|
||||
@@ -270,6 +270,7 @@ gimp-debian:
|
||||
# Build GIMP
|
||||
- printf "\e[0Ksection_start:`date +%s`:gimp_build[collapsed=true]\r\e[0KBuilding GIMP\n"
|
||||
- meson setup _build-${RUNNER} -Dprefix="${GIMP_PREFIX}"
|
||||
-Dgi-docgen=disabled
|
||||
-Dpkgconfig.relocatable=true
|
||||
-Drelocatable-bundle=yes
|
||||
-Dcheck-update=yes
|
||||
@@ -293,12 +294,11 @@ gimp-debian:
|
||||
|
||||
|
||||
## GNU/Linux 64-bit CIs (Debian) ##
|
||||
.debian-x64:
|
||||
.debian-nonreloc:
|
||||
extends: .debian
|
||||
rules:
|
||||
- <<: *CI_MERGE
|
||||
- <<: *CI_COMMIT
|
||||
- if: '$GIMP_CI_MESON_CLANG != null'
|
||||
variables: {}
|
||||
- if: '$GIMP_CI_MESON_GCC != null || "$[[ inputs.test_pipeline ]]" =~ /.*GIMP_CI_MESON_GCC.*/'
|
||||
variables:
|
||||
@@ -311,27 +311,25 @@ gimp-debian:
|
||||
variables:
|
||||
MESON_OPTIONS: "-Dvector-icons=false"
|
||||
VARIANT: "-raster"
|
||||
- if: '$GIMP_CI_SOURCES != null'
|
||||
- <<: *CI_RELEASE
|
||||
parallel:
|
||||
matrix:
|
||||
- RUNNER: x86_64_v3
|
||||
tags: []
|
||||
|
||||
deps-debian-x64:
|
||||
extends: .debian-x64
|
||||
deps-debian-nonreloc:
|
||||
extends: .debian-nonreloc
|
||||
stage: !reference [deps-debian, stage]
|
||||
image: !reference [deps-debian, image]
|
||||
variables:
|
||||
GIT_STRATEGY: none
|
||||
WORKSHOP_OPTION: '-Dworkshop=true'
|
||||
script:
|
||||
- !reference [deps-debian, script]
|
||||
artifacts: !reference [deps-debian, artifacts]
|
||||
|
||||
gimp-debian-x64:
|
||||
extends: .debian-x64
|
||||
needs: ["deps-debian-x64"]
|
||||
gimp-debian-nonreloc:
|
||||
extends: .debian-nonreloc
|
||||
needs: ["deps-debian-nonreloc"]
|
||||
stage: !reference [gimp-debian, stage]
|
||||
variables: !reference [gimp-debian, variables]
|
||||
script:
|
||||
@@ -399,16 +397,11 @@ gimp-debian-x64:
|
||||
deps-flatpak:
|
||||
extends: .flatpak
|
||||
stage: dependencies
|
||||
#https://gitlab.gnome.org/Infrastructure/Infrastructure/-/issues/1502
|
||||
#cache:
|
||||
#key: ${CI_JOB_NAME_SLUG}
|
||||
#paths:
|
||||
#- .flatpak-builder/
|
||||
script:
|
||||
- sh build/linux/flatpak/1_build-deps-flatpakbuilder.sh
|
||||
artifacts:
|
||||
paths:
|
||||
- .flatpak-builder-$RUNNER.tar
|
||||
- _build-$RUNNER.tar
|
||||
- flatpak-builder.log
|
||||
- babl-meson-log.tar
|
||||
- gegl-meson-log.tar
|
||||
@@ -426,6 +419,7 @@ gimp-flatpak:
|
||||
paths:
|
||||
- temp*.flatpak
|
||||
- repo*.tar
|
||||
- gimp-flatpak-builder.log
|
||||
- gimp-meson-log.tar
|
||||
expire_in: 2 days
|
||||
|
||||
@@ -439,43 +433,63 @@ gimp-flatpak:
|
||||
- if: '$GIMP_CI_SNAP != null || "$[[ inputs.distribution_pipeline ]]" =~ /.*GIMP_CI_SNAP.*/'
|
||||
parallel:
|
||||
matrix:
|
||||
- DPKG_ARCH: [arm64, amd64]
|
||||
- RUNNER: [aarch64, x86_64_v3]
|
||||
tags:
|
||||
- x86_64_v2
|
||||
image:
|
||||
name: $CI_REGISTRY_IMAGE:build-snap-${SNAPCRAFT_CORE_VERSION}
|
||||
entrypoint: [""]
|
||||
- $RUNNER
|
||||
image: $CI_REGISTRY_IMAGE:build-snap-${SNAPCRAFT_BASE_VERSION}-${RUNNER}
|
||||
variables:
|
||||
SNAPCRAFT_CORE_VERSION: "8_core24"
|
||||
#@brunvonlope private credentials. We are using these for now
|
||||
#until we don't get acess to 'gimp' entry on Snap Store: https://github.com/snapcrafters/gimp/issues/447
|
||||
LAUNCHPAD_CREDENTIALS_ACCESS_TOKEN: pPs367Km5glpfXXK9BQl
|
||||
LAUNCHPAD_CREDENTIALS_ACCESS_SECRET: PQ0r1JGdHQRWQCS255jNZdglCcK4KDmsGRSZxl4CZwWvMF00GLRFbz1185L08cjh5zWqhQddsvmgLg7l
|
||||
timeout: 120m
|
||||
SNAPCRAFT_BASE_VERSION: "8_core24"
|
||||
RUNNER: x86_64_v3
|
||||
timeout: 20m
|
||||
|
||||
deps-snap:
|
||||
extends: .snap
|
||||
stage: dependencies
|
||||
image:
|
||||
name: gcr.io/kaniko-project/executor:debug
|
||||
entrypoint: [""]
|
||||
image: quay.io/buildah/stable
|
||||
script:
|
||||
- sh build/linux/snap/1_build-deps-snapcraft.sh
|
||||
- export BUILDAH_FORMAT=docker
|
||||
- export STORAGE_DRIVER=vfs
|
||||
- echo "$CI_REGISTRY_PASSWORD" | buildah login -u "$CI_REGISTRY_USER" --password-stdin $CI_REGISTRY
|
||||
# Install deps
|
||||
- echo "FROM ghcr.io/canonical/snapcraft:${SNAPCRAFT_BASE_VERSION}" > Dockerfile
|
||||
- echo "ENTRYPOINT [\"\"]" >> Dockerfile
|
||||
- echo "WORKDIR $CI_PROJECT_DIR" >> Dockerfile
|
||||
- echo "ENV GITLAB_CI=1" >> Dockerfile
|
||||
- echo "ENV RUNNER=$RUNNER" >> Dockerfile
|
||||
- echo "RUN apt-get update -y" >> Dockerfile
|
||||
- echo "RUN apt-get install -y curl jq squashfs-tools sudo" >> Dockerfile
|
||||
# https://github.com/canonical/snapcraft-rocks/issues/37
|
||||
- echo "RUN cp -r /usr/lib/python3.*/site-packages/extensions/* /usr/share/snapcraft/extensions/" >> Dockerfile
|
||||
# https://github.com/canonical/snapcraft-rocks/issues/33
|
||||
- echo "RUN ln -s /usr/libexec/snapcraft/craftctl /usr/bin/craftctl" >> Dockerfile
|
||||
- echo "RUN sh build/linux/snap/1_build-deps-snapcraft.sh --install-snaps" >> Dockerfile;
|
||||
# Build babl and GEGL
|
||||
- echo "FROM $CI_REGISTRY_IMAGE:build-snap-${SNAPCRAFT_BASE_VERSION}-${RUNNER}" > Dockerfile2;
|
||||
- echo "RUN sh build/linux/snap/1_build-deps-snapcraft.sh" >> Dockerfile2;
|
||||
#FIXME: '2>&1 | grep -v STEP' since buildah is too verbose. See: https://github.com/containers/buildah/issues/6362
|
||||
- buildah build --log-level error --volume $CI_PROJECT_DIR:$CI_PROJECT_DIR:Z --file $CI_PROJECT_DIR/Dockerfile --tag $CI_REGISTRY_IMAGE:build-snap-${SNAPCRAFT_BASE_VERSION}-${RUNNER} --layers --cache-from $CI_REGISTRY_IMAGE/cache --cache-to $CI_REGISTRY_IMAGE/cache --cache-ttl=120h 2>&1 | grep -v STEP && buildah push --log-level error $CI_REGISTRY_IMAGE:build-snap-${SNAPCRAFT_BASE_VERSION}-${RUNNER} 2>&1 | grep -v STEP
|
||||
- buildah build --log-level error --volume $CI_PROJECT_DIR:$CI_PROJECT_DIR:Z --file $CI_PROJECT_DIR/Dockerfile2 --no-cache 2>&1 | grep -v STEP
|
||||
artifacts:
|
||||
paths:
|
||||
- _install-$RUNNER.tar
|
||||
- _build-$RUNNER.tar
|
||||
- babl-meson-log.tar
|
||||
- gegl-meson-log.tar
|
||||
expire_in: 2 hours
|
||||
|
||||
gimp-snap:
|
||||
extends: .snap
|
||||
needs: ["deps-snap"]
|
||||
stage: build
|
||||
variables:
|
||||
#Snapcraft/launchpad does not allow shallow clones
|
||||
GIT_DEPTH: 0
|
||||
GIT_SUBMODULE_STRATEGY: recursive
|
||||
script:
|
||||
- sh build/linux/snap/2_build-gimp-snapcraft.sh
|
||||
artifacts:
|
||||
paths:
|
||||
- temp*.snap
|
||||
- snapcraft*.txt
|
||||
- gimp-snapcraft.log
|
||||
- gimp-meson-log.tar
|
||||
expire_in: 2 days
|
||||
|
||||
|
||||
@@ -483,16 +497,20 @@ gimp-snap:
|
||||
.win:
|
||||
extends: .default
|
||||
rules:
|
||||
#Developers (on GNOME/gimp namespace) can create multi-arch installers (.exe or .msixbundle)
|
||||
#Non developers (e.g. on MRs), however, can create x64-only installers (.exe or .msix)
|
||||
- if: '$RUNNER == "windows-aarch64" && $CI_PROJECT_NAMESPACE != "GNOME"'
|
||||
when: never
|
||||
- if: '$CI_MERGE_REQUEST_LABELS =~ /.*Package:Windows Installer.*/ && $CI_MERGE_REQUEST_LABELS =~ /.*Package:Microsoft Store.*/'
|
||||
interruptible: true
|
||||
variables:
|
||||
INSTALLER_OPTION: '-Dwindows-installer=true'
|
||||
STORE_OPTION: '-Dms-store=true'
|
||||
- if: '$CI_MERGE_REQUEST_LABELS =~ /.*Package:Windows Installer.*/'
|
||||
- if: '$CI_MERGE_REQUEST_LABELS =~ /.*Package:Windows Installer.*/ && $CI_JOB_NAME !~ /.*store.*/'
|
||||
interruptible: true
|
||||
variables:
|
||||
INSTALLER_OPTION: '-Dwindows-installer=true'
|
||||
- if: '$CI_MERGE_REQUEST_LABELS =~ /.*Package:Microsoft Store.*/ && $CI_JOB_NAME =~ /.*64.*/ && $CI_JOB_NAME !~ /.*installer.*/'
|
||||
- if: '$CI_MERGE_REQUEST_LABELS =~ /.*Package:Microsoft Store.*/ && $CI_JOB_NAME !~ /.*mingw32.*/ && $CI_JOB_NAME !~ /.*installer.*/'
|
||||
interruptible: true
|
||||
variables:
|
||||
STORE_OPTION: '-Dms-store=true'
|
||||
@@ -500,10 +518,10 @@ gimp-snap:
|
||||
variables:
|
||||
INSTALLER_OPTION: '-Dwindows-installer=true'
|
||||
STORE_OPTION: '-Dms-store=true'
|
||||
- if: '$GIMP_CI_WIN_INSTALLER != null || "$[[ inputs.distribution_pipeline ]]" =~ /.*GIMP_CI_WIN_INSTALLER.*/'
|
||||
- if: '($GIMP_CI_WIN_INSTALLER != null || "$[[ inputs.distribution_pipeline ]]" =~ /.*GIMP_CI_WIN_INSTALLER.*/) && $CI_JOB_NAME !~ /.*store.*/'
|
||||
variables:
|
||||
INSTALLER_OPTION: '-Dwindows-installer=true'
|
||||
- if: '$GIMP_CI_MS_STORE != null || "$[[ inputs.distribution_pipeline ]]" =~ /.*GIMP_CI_MS_STORE.*/ && $CI_JOB_NAME =~ /.*64.*/ && $CI_JOB_NAME !~ /.*installer.*/'
|
||||
- if: '($GIMP_CI_MS_STORE != null || "$[[ inputs.distribution_pipeline ]]" =~ /.*GIMP_CI_MS_STORE.*/) && $CI_JOB_NAME !~ /.*mingw32.*/ && $CI_JOB_NAME !~ /.*installer.*/'
|
||||
variables:
|
||||
STORE_OPTION: '-Dms-store=true'
|
||||
- <<: *CI_RELEASE
|
||||
@@ -520,8 +538,6 @@ gimp-snap:
|
||||
- $RUNNER
|
||||
variables:
|
||||
MSYS_ROOT: 'C:/msys64'
|
||||
CC: cc
|
||||
CXX: c++
|
||||
#meson.build forces non-relocatable .pc. See: https://github.com/mesonbuild/meson/issues/14346
|
||||
PKGCONF_RELOCATABLE_OPTION: '-Dpkgconfig.relocatable=true'
|
||||
before_script:
|
||||
@@ -533,11 +549,11 @@ gimp-snap:
|
||||
# See: https://testing.developer.gimp.org/core/setup/build/windows/#prepare-for-building
|
||||
- Write-Output "$([char]27)[0Ksection_start:$(Get-Date -UFormat %s -Millisecond 0):win_environ[collapsed=true]$([char]13)$([char]27)[0KPreparing build environment"
|
||||
## Build-time vars
|
||||
- $env:PKG_CONFIG_PATH = "$GIMP_PREFIX/lib/pkgconfig;$MSYS_ROOT/$MSYSTEM_PREFIX/lib/pkgconfig;$MSYS_ROOT/$MSYSTEM_PREFIX/share/pkgconfig"
|
||||
- $env:XDG_DATA_DIRS = "$GIMP_PREFIX/share;$MSYS_ROOT/$MSYSTEM_PREFIX/share"
|
||||
- $env:PKG_CONFIG_PATH = "$GIMP_PREFIX/lib/pkgconfig;$env:MSYS_ROOT/$env:MSYSTEM_PREFIX/lib/pkgconfig;$env:MSYS_ROOT/$env:MSYSTEM_PREFIX/share/pkgconfig"
|
||||
- $env:XDG_DATA_DIRS = "$GIMP_PREFIX/share;$env:MSYS_ROOT/$env:MSYSTEM_PREFIX/share"
|
||||
## Runtime vars
|
||||
- $env:PATH = "$GIMP_PREFIX/bin;$MSYS_ROOT/$MSYSTEM_PREFIX/bin;" + $env:PATH
|
||||
- $env:GI_TYPELIB_PATH = "$GIMP_PREFIX/lib/girepository-1.0;$MSYS_ROOT/$MSYSTEM_PREFIX/lib/girepository-1.0"
|
||||
- $env:PATH = "$GIMP_PREFIX/bin;$env:MSYS_ROOT/$env:MSYSTEM_PREFIX/bin;$env:PATH"
|
||||
- $env:GI_TYPELIB_PATH = "$GIMP_PREFIX/lib/girepository-1.0;$env:MSYS_ROOT/$env:MSYSTEM_PREFIX/lib/girepository-1.0"
|
||||
- Write-Output "$([char]27)[0Ksection_end:$(Get-Date -UFormat %s -Millisecond 0):win_environ$([char]13)$([char]27)[0K"
|
||||
|
||||
deps-win:
|
||||
@@ -554,7 +570,10 @@ deps-win:
|
||||
|
||||
gimp-win:
|
||||
extends: .win
|
||||
needs: ["deps-win"]
|
||||
needs:
|
||||
- job: deps-win
|
||||
#to allow running outside 'GNOME/gimp' namespace (on MRs)
|
||||
optional: true
|
||||
stage: build
|
||||
variables:
|
||||
GIT_SUBMODULE_STRATEGY: recursive
|
||||
@@ -574,11 +593,8 @@ gimp-win:
|
||||
|
||||
|
||||
## WINDOWS x86 legacy CI (native MSYS2) ##
|
||||
.win-x86:
|
||||
.win-eol:
|
||||
extends: .win
|
||||
rules:
|
||||
- !reference [.win, rules]
|
||||
- if: '$GIMP_CI_MSYS2_WIN32 != null'
|
||||
parallel:
|
||||
matrix:
|
||||
- RUNNER: win32-ps
|
||||
@@ -588,16 +604,16 @@ gimp-win:
|
||||
CC: cc
|
||||
CXX: c++
|
||||
|
||||
deps-win-x86:
|
||||
extends: .win-x86
|
||||
deps-win-eol:
|
||||
extends: .win-eol
|
||||
stage: !reference [deps-win, stage]
|
||||
script:
|
||||
- !reference [deps-win, script]
|
||||
artifacts: !reference [deps-win, artifacts]
|
||||
|
||||
gimp-win-x86:
|
||||
extends: .win-x86
|
||||
needs: ["deps-win-x86"]
|
||||
gimp-win-eol:
|
||||
extends: .win-eol
|
||||
needs: ["deps-win-eol"]
|
||||
stage: !reference [gimp-win, stage]
|
||||
variables:
|
||||
GIT_SUBMODULE_STRATEGY: recursive
|
||||
@@ -612,22 +628,18 @@ gimp-win-x86:
|
||||
file-plug-in-tests:
|
||||
# FIXME: Do we need another job testing this under Windows? MSYS2 usually has
|
||||
# the latest deps. It might be a good idea to test that too, maybe weekly?
|
||||
extends: .debian-x64
|
||||
extends: .debian-nonreloc
|
||||
rules:
|
||||
# Don't run on release since the plug-in doesn't get installed in releases
|
||||
- <<: *CI_MERGE
|
||||
- <<: *CI_COMMIT
|
||||
needs: ["gimp-debian-x64"]
|
||||
needs: ["gimp-debian-nonreloc"]
|
||||
stage: analysis
|
||||
variables:
|
||||
GIT_STRATEGY: none
|
||||
GIMP_TESTS_DATA_FOLDER: "$CI_PROJECT_DIR/_data/gimp-test-images/"
|
||||
GIMP_TESTS_LOG_FILE: "$CI_PROJECT_DIR/_log/import-tests.log"
|
||||
REGRESSION_STRING: "Total number of regressions: 0"
|
||||
cache:
|
||||
key: $CI_JOB_NAME
|
||||
paths:
|
||||
- _data
|
||||
script:
|
||||
- API_VER=$(grep GIMP_PKGCONFIG_VERSION _build*/config.h | head -1 | sed 's/^.*"\([^"]*\)"$/\1/')
|
||||
- APP_VER=$(grep GIMP_APP_VERSION _build*/config.h | head -1 | sed 's/^.*"\([^"]*\)"$/\1/')
|
||||
@@ -684,6 +696,19 @@ clang-format:
|
||||
- fetch_origin.log
|
||||
expire_in: 2 days
|
||||
|
||||
branches-check:
|
||||
extends: .default
|
||||
rules:
|
||||
- if: '$CI_PIPELINE_SOURCE == "push" && $CI_OPEN_MERGE_REQUESTS == null && $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH'
|
||||
stage: analysis
|
||||
variables:
|
||||
GIT_DEPTH: "0"
|
||||
script:
|
||||
- apt-get update -qq
|
||||
- apt-get install -qq -y --no-install-recommends git
|
||||
- sh .gitlab/check_dead_branches.sh
|
||||
allow_failure: true
|
||||
|
||||
cppcheck:
|
||||
extends: .default
|
||||
rules:
|
||||
@@ -693,7 +718,7 @@ cppcheck:
|
||||
- apt-get update
|
||||
- apt-get install -y cppcheck
|
||||
- cppcheck -q -j8 --enable=all --force --output-file=cppcheck.xml --xml --xml-version=2
|
||||
-i _build -i babl -i gegl -i _install -i .local -i .cache -i gimp-x64 .
|
||||
-i _build -i babl -i gegl -i _install .
|
||||
- mkdir report
|
||||
- cppcheck-htmlreport --source-dir=. --title=gimp --file=cppcheck.xml --report-dir=report
|
||||
artifacts:
|
||||
@@ -707,10 +732,10 @@ cppcheck:
|
||||
sources-debian:
|
||||
extends: .default
|
||||
rules:
|
||||
# Don't run on MRs since non-merged/non-upstream code can't be distributed by us
|
||||
- <<: *CI_COMMIT
|
||||
- if: '$GIMP_CI_SOURCES != null'
|
||||
- <<: *CI_RELEASE
|
||||
needs: ["gimp-debian-x64"]
|
||||
needs: ["gimp-debian-nonreloc"]
|
||||
stage: distribution
|
||||
variables:
|
||||
GIT_STRATEGY: none
|
||||
@@ -729,10 +754,10 @@ sources-debian:
|
||||
dev-docs:
|
||||
extends: .default
|
||||
rules:
|
||||
# Don't run on MRs since non-merged/non-upstream code can't be distributed by us
|
||||
- <<: *CI_COMMIT
|
||||
- if: '$GIMP_CI_SOURCES != null'
|
||||
- <<: *CI_RELEASE
|
||||
needs: ["deps-debian-x64", "gimp-debian-x64"]
|
||||
needs: ["deps-debian-nonreloc", "gimp-debian-nonreloc"]
|
||||
stage: distribution
|
||||
variables:
|
||||
GIT_STRATEGY: none
|
||||
@@ -800,15 +825,14 @@ dist-appimage-weekly:
|
||||
include:
|
||||
project: GNOME/citemplates
|
||||
file: flatpak/flatpak_ci_initiative.yml
|
||||
ref: 42fbc2526a7680b6a4f284a210e63e3973ea6dae
|
||||
|
||||
dist-flatpak-weekly:
|
||||
extends:
|
||||
- .default
|
||||
- .publish_nightly
|
||||
rules:
|
||||
- if: '$CI_MERGE_REQUEST_LABELS =~ /.*Package:Flatpak.*/'
|
||||
interruptible: true
|
||||
- if: '$GIMP_CI_FLATPAK != null || "$[[ inputs.distribution_pipeline ]]" =~ /.*GIMP_CI_FLATPAK.*/'
|
||||
- !reference [.flatpak, rules]
|
||||
needs: ["gimp-flatpak"]
|
||||
stage: distribution
|
||||
script:
|
||||
@@ -839,10 +863,14 @@ dist-installer-weekly:
|
||||
extends: .default
|
||||
rules:
|
||||
- !reference [.win, rules]
|
||||
needs: ["gimp-win", "gimp-win-x86"]
|
||||
needs:
|
||||
- job: gimp-win
|
||||
#to allow running outside 'GNOME/gimp' namespace (on MRs)
|
||||
optional: true
|
||||
- job: gimp-win-eol
|
||||
stage: distribution
|
||||
tags:
|
||||
- windows-aarch64
|
||||
- win32-ps
|
||||
variables:
|
||||
MSYS_ROOT: 'C:/msys64'
|
||||
script:
|
||||
@@ -857,11 +885,11 @@ dist-installer-weekly:
|
||||
dist-store-weekly:
|
||||
extends: .default
|
||||
rules:
|
||||
- if: '$CI_MERGE_REQUEST_LABELS =~ /.*Package:Microsoft Store.*/'
|
||||
interruptible: true
|
||||
- if: '$GIMP_CI_MS_STORE != null || "$[[ inputs.distribution_pipeline ]]" =~ /.*GIMP_CI_MS_STORE.*/'
|
||||
- <<: *CI_RELEASE
|
||||
needs: ["gimp-win"]
|
||||
- !reference [.win, rules]
|
||||
needs:
|
||||
- job: gimp-win
|
||||
#to allow running outside 'GNOME/gimp' namespace (on MRs)
|
||||
optional: true
|
||||
stage: distribution
|
||||
tags:
|
||||
- win32-ps
|
||||
|
42
.gitlab/check_dead_branches.sh
Normal file
42
.gitlab/check_dead_branches.sh
Normal file
@@ -0,0 +1,42 @@
|
||||
#!/bin/sh
|
||||
|
||||
printf "\e[0Ksection_start:`date +%s`:branch_check[collapsed=false]\r\e[0KChecking for dead branches\n"
|
||||
git branch -r | grep -v 'origin/HEAD' | grep -v "origin/$CI_DEFAULT_BRANCH" | while IFS= read remote_branch; do
|
||||
remote_branch=$(printf "%s\n" "$remote_branch" | sed 's/^ *//;s/ *$//')
|
||||
branch_name=$(printf "%s\n" "$remote_branch" | sed 's|origin/||')
|
||||
|
||||
# NOT CHECKING
|
||||
## Skip old stable branches
|
||||
if echo "$branch_name" | grep -q "^gimp-[0-9]-" || [ "$branch_name" = "gnome-2-2" ] || [ "$branch_name" = "gnome-2-4" ]; then
|
||||
printf "\033[33m(SKIP)\033[0m: $branch_name is a snapshot of $CI_DEFAULT_BRANCH but no problem\n"
|
||||
continue
|
||||
fi
|
||||
## Skip recently created branches
|
||||
if [ "$(git rev-parse "$remote_branch")" = "$(git rev-parse "$CI_COMMIT_SHA")" ]; then
|
||||
printf "\033[33m(SKIP)\033[0m: $branch_name is identical to $CI_DEFAULT_BRANCH but no problem\n"
|
||||
continue
|
||||
fi
|
||||
|
||||
# CHECKING
|
||||
## Check: merge-base
|
||||
if git merge-base --is-ancestor "$remote_branch" "$CI_COMMIT_SHA"; then
|
||||
printf "\033[31m(ERROR)\033[0m: $branch_name is fully merged into $CI_DEFAULT_BRANCH (via git merge-base)\n"
|
||||
touch 'dead_branch'
|
||||
continue
|
||||
fi
|
||||
## Fallback check: cherry
|
||||
cherry_output=$(git cherry "$CI_COMMIT_SHA" "$remote_branch")
|
||||
if [ -z "$(printf "%s\n" "$cherry_output" | grep '^+')" ]; then
|
||||
printf "\033[31m(ERROR)\033[0m: $branch_name is fully merged into $CI_DEFAULT_BRANCH (via git cherry)\n"
|
||||
touch 'dead_branch'
|
||||
continue
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -f "dead_branch" ]; then
|
||||
printf " Please delete the merged branches\n"
|
||||
exit 1
|
||||
else
|
||||
printf '(INFO): All branches are organized.\n'
|
||||
fi
|
||||
printf "\e[0Ksection_end:`date +%s`:branch_check\r\e[0K\n"
|
@@ -9,4 +9,7 @@
|
||||
"*Allow commits from members who can merge to the target branch.*"
|
||||
|
||||
- No AI-generated contents allowed (neither code nor text, images…).
|
||||
Only human created works please! -->
|
||||
Only human created works please!
|
||||
|
||||
- You can request the devs to allow installable packages to be
|
||||
generated from this MR by writting ~Package: in the comments -->
|
||||
|
2
AUTHORS
2
AUTHORS
@@ -23,6 +23,7 @@ The following people have contributed code to GIMP:
|
||||
Rob Antonishen
|
||||
Nicola Archibald
|
||||
Timm Bäder
|
||||
Gabriele Barbero
|
||||
Luis Barrancos
|
||||
Jerry Baker
|
||||
John Beale
|
||||
@@ -204,6 +205,7 @@ The following people have contributed code to GIMP:
|
||||
Federico Mena Quintero
|
||||
Loren Merritt
|
||||
Jim Meyer
|
||||
Ondřej Míchal
|
||||
James Mitchell
|
||||
Hirotsuna Mizuno
|
||||
Chris Mohler
|
||||
|
158
NEWS
158
NEWS
@@ -6,6 +6,69 @@
|
||||
This is the development branch of GIMP.
|
||||
|
||||
|
||||
Overview of Changes from GIMP 3.1.4 to GIMP 3.2-RC1
|
||||
===================================================
|
||||
|
||||
Core:
|
||||
|
||||
- Improve Export to SVG of paths by not exporting the DTD and adding
|
||||
an explicit SVG version.
|
||||
|
||||
Graphical User Interface:
|
||||
|
||||
- "Monitor Linked Image" and "Discard Link Information" menu items
|
||||
added to Layer menu when the selected layer is a link layer.
|
||||
- Palette Import dialog now display file format filters, both to let
|
||||
users hide irrelevant files from view and to highlight which formats
|
||||
we support.
|
||||
|
||||
Plug-Ins:
|
||||
|
||||
- Fixed vulnerabilities: ZDI-CAN-27684, ZDI-CAN-27863, ZDI-CAN-27878,
|
||||
ZDI-CAN-27836, ZDI-CAN-27823, ZDI-CAN-27793
|
||||
|
||||
API:
|
||||
|
||||
- The following libgimpbase API are now deprecated:
|
||||
* gimp_pixpipe_params_init
|
||||
* gimp_pixpipe_params_parse
|
||||
* gimp_pixpipe_params_build
|
||||
* gimp_pixpipe_params_free
|
||||
- New libgimp functions:
|
||||
* gimp_vector_layer_get_enable_fill
|
||||
* gimp_vector_layer_get_enable_stroke
|
||||
* gimp_vector_layer_get_fill_color
|
||||
* gimp_vector_layer_get_path
|
||||
* gimp_vector_layer_get_stroke_cap_style
|
||||
* gimp_vector_layer_get_stroke_color
|
||||
* gimp_vector_layer_get_stroke_dash_offset
|
||||
* gimp_vector_layer_get_stroke_dash_pattern
|
||||
* gimp_vector_layer_get_stroke_join_style
|
||||
* gimp_vector_layer_get_stroke_miter_limit
|
||||
* gimp_vector_layer_get_stroke_width
|
||||
* gimp_vector_layer_get_stroke_width_unit
|
||||
* gimp_vector_layer_set_enable_fill
|
||||
* gimp_vector_layer_set_enable_stroke
|
||||
* gimp_vector_layer_set_fill_color
|
||||
* gimp_vector_layer_set_stroke_cap_style
|
||||
* gimp_vector_layer_set_stroke_color
|
||||
* gimp_vector_layer_set_stroke_dash_offset
|
||||
* gimp_vector_layer_set_stroke_dash_pattern
|
||||
* gimp_vector_layer_set_stroke_join_style
|
||||
* gimp_vector_layer_set_stroke_miter_limit
|
||||
* gimp_vector_layer_set_stroke_width
|
||||
* gimp_vector_layer_set_stroke_width_unit
|
||||
|
||||
|
||||
Build:
|
||||
|
||||
- CI:
|
||||
* Linux builds ported from unmaintained Kaniko to Buildah.
|
||||
* Colored output and .pdb support for builds of dependency using
|
||||
CMake.
|
||||
* Ability to apply remote patches on dependency builds.
|
||||
|
||||
|
||||
Overview of Changes from GIMP 3.1.2 to GIMP 3.1.4
|
||||
=================================================
|
||||
|
||||
@@ -21,8 +84,31 @@ Core:
|
||||
- Some cleanup of outdated disabled unit tests and other warnings.
|
||||
- Restructuration of internal GimpControllerManager and
|
||||
GimpContainerView API.
|
||||
- GimpContainerListView now uses a GtkListBox. A Playground switch was
|
||||
added to use the new widgets in all views that can be switched
|
||||
between list and grid view (brushes, patterns etc.). This won't
|
||||
likely get out of Playground before GIMP 4 because it is far too
|
||||
slow right now (and apparently we'll need GTK4 for making it fast as
|
||||
our current lists).
|
||||
- Various code have been moving away from GtkTreeView and some new
|
||||
internal classes were added as a preparation for GTK4 port.
|
||||
- GEX format updated to use standard <custom/> instead of <metadata/>
|
||||
per update in the AppStream specs in the last few years. This
|
||||
doesn't make any compatibility issue since this format is purely
|
||||
internal only for now, not public.
|
||||
- New setting "Update metadata automatically" in Preferences > Image
|
||||
Import & Export > Export Policies. When enabled, add and update
|
||||
metadata automatically. When disabled, only the minimum necessary
|
||||
metadata changes are made, without changing modification date,
|
||||
synchronizing tags, or updating the software and change history
|
||||
metadata. This new setting is enabled by default.
|
||||
- Fix palette import to properly import colors with alpha values from
|
||||
palettes.
|
||||
- New layer types:
|
||||
* vector layers
|
||||
* link layers
|
||||
- Fill/Stroke editor are now live-previewing color changes for vector
|
||||
layer fill/stroke and text layer outlines.
|
||||
|
||||
Tools:
|
||||
|
||||
@@ -31,6 +117,12 @@ Tools:
|
||||
mypaint-brushes-1.0.
|
||||
- Seamless Clone (Playground): made to work again, but is still too
|
||||
slow to move out of Playground.
|
||||
- The Paths tool has updated UI to create vector layers.
|
||||
- Text tool: bold, italic and underline can now be applied with
|
||||
commonly used shortcuts (Ctrl+b, i and u respectively).
|
||||
- Vector and Link layers cannot be painted on, and filters cannot be
|
||||
merged on them. They now need to be explicitly downgraded to raster
|
||||
layers.
|
||||
|
||||
Graphical User Interface:
|
||||
|
||||
@@ -43,6 +135,11 @@ Graphical User Interface:
|
||||
Preferences dialogue, and Welcome dialogue), we now turn off
|
||||
animations when it is set OFF system-wide.
|
||||
- "System" color scheme now also works on macOS.
|
||||
- GimpSpinScale cursors now changed to "pointer" when hovering the
|
||||
slider area and "col-resize" when actually grabbing the cursor.
|
||||
- The Welcome dialog will now recognize your standard shortcuts to
|
||||
create a new file, open a file or open one of the 10 most recent
|
||||
files.
|
||||
|
||||
Plug-Ins:
|
||||
|
||||
@@ -61,19 +158,70 @@ Plug-Ins:
|
||||
playback UIs. The redesign also changes the progress bar to a
|
||||
GtkScale, so users can more easily move to different frames on the
|
||||
timeline.
|
||||
- PAA textures: initial import support (includes RGBA 4444, 5551,
|
||||
8888, and Grayscale with Alpha channel. It does not yet cover DXT1 -
|
||||
5 texture import support).
|
||||
- New GEGL Filter Browser plug-in to list and inspect all available
|
||||
filters for development purpose.
|
||||
- New import support:
|
||||
* PAA textures: initial import support (includes RGBA 4444, 5551,
|
||||
8888, and Grayscale with Alpha channel. It does not yet cover DXT1
|
||||
- 5 texture import support).
|
||||
* Seattle Filmworks photos (earliest format SFW93A, and the most
|
||||
common format SFW94A). Both formats are essentially mangled JPEGs,
|
||||
though mangled in different ways.
|
||||
* HRZ Slow Scan Television Images (restored, as it used to be
|
||||
implemented and removed in 2004).
|
||||
- Raw Image data plug-in dialog redesigned to be on a two-column
|
||||
layout to avoid over-high dialog.
|
||||
- Print: in sandboxed environments (Flatpak, Snap), the print Settings
|
||||
are now displayed as a second dialog after the portal print dialog.
|
||||
This 2-step workflow is a work-around to the inability to tweak the
|
||||
print dialog when the print portal is in use.
|
||||
|
||||
API:
|
||||
|
||||
PDB:
|
||||
|
||||
- GimpTRCType enum type made available in libgimp and PDB.
|
||||
- gimp-file-save properly sets associated save or exported files.
|
||||
- New PDB/libgimp functions:
|
||||
* gimp_drawable_filter_operation_get_available()
|
||||
* gimp_drawable_filter_operation_get_details()
|
||||
* gimp_drawable_filter_operation_get_pspecs()
|
||||
* gimp_context_get_paint_fade_length()
|
||||
* gimp_context_get_paint_fade_repeat()
|
||||
* gimp_context_set_paint_fade_length()
|
||||
* gimp_context_set_paint_fade_repeat()
|
||||
* gimp_item_id_is_vector_layer()
|
||||
* gimp_param_spec_vector_layer()
|
||||
* gimp_procedure_add_vector_layer_argument()
|
||||
* gimp_procedure_add_vector_layer_aux_argument()
|
||||
* gimp_procedure_add_vector_layer_return_value()
|
||||
* gimp_vector_layer_discard()
|
||||
* gimp_vector_layer_get_by_id()
|
||||
* gimp_vector_layer_new()
|
||||
* gimp_vector_layer_refresh()
|
||||
- GimpSizeEntry (libgimpwidget) can now parse mathematical expressions
|
||||
in their reference value spin buttons too.
|
||||
- GimpColorScales (libgimpwidget) will now set its decimals to 0 when
|
||||
creating u8 RGB color selectors. This change will help further
|
||||
distinguish between the 0...00 and 0..255 views in the Color
|
||||
Selectors. It will also better convey to users that u8 is an integer
|
||||
value rather than a floating point.
|
||||
- Favor existing image comment instead of always loading comment from
|
||||
metadata.
|
||||
- Improve handling of comment metadata with
|
||||
"charset=[ascii|InvalidCharsetId]" prefixes.
|
||||
- New GIMP_METADATA_SAVE_UPDATE value in enum type
|
||||
GimpMetadataSaveFlags (libgimpbase).
|
||||
- Modernize setting "Exif.Image.DateTime" metadata by setting the
|
||||
timezone additionally.
|
||||
|
||||
Build:
|
||||
|
||||
- Add nightly Snap package.
|
||||
- Add nightly Aarch64 flatpak.
|
||||
- appstream-glib dependency replaced with libappstream
|
||||
- Installer uses latest InnoSetup now.
|
||||
- New configure option -Dwin-debugging allowing to choose DWARF debug
|
||||
symbols on Windows instead of the native (CodeView) symbols. This
|
||||
will be useful for people wishing to debug with GDB in particular.
|
||||
|
||||
|
||||
Overview of Changes from GIMP 3.0.4 to GIMP 3.1.2
|
||||
|
@@ -104,6 +104,7 @@
|
||||
/* global variables */
|
||||
|
||||
GimpActionFactory *global_action_factory = NULL;
|
||||
GHashTable *aux_filter_hash_table = NULL;
|
||||
|
||||
|
||||
/* private variables */
|
||||
@@ -270,6 +271,8 @@ actions_init (Gimp *gimp)
|
||||
action_groups[i].icon_name,
|
||||
action_groups[i].setup_func,
|
||||
action_groups[i].update_func);
|
||||
|
||||
aux_filter_hash_table = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -280,6 +283,23 @@ actions_exit (Gimp *gimp)
|
||||
g_return_if_fail (global_action_factory->gimp == gimp);
|
||||
|
||||
g_clear_object (&global_action_factory);
|
||||
g_hash_table_unref (aux_filter_hash_table);
|
||||
}
|
||||
|
||||
/* XXX Temporary code to store the list of filter operations with an
|
||||
* "aux" input. This won't be necessary anymore once these filters can
|
||||
* be applied non-destructively too in the future.
|
||||
*/
|
||||
void
|
||||
actions_filter_set_aux (const gchar *action_name)
|
||||
{
|
||||
g_hash_table_add (aux_filter_hash_table, (gpointer) g_strdup (action_name));
|
||||
}
|
||||
|
||||
gboolean
|
||||
actions_filter_get_aux (const gchar *action_name)
|
||||
{
|
||||
return g_hash_table_lookup (aux_filter_hash_table, action_name) != NULL;
|
||||
}
|
||||
|
||||
Gimp *
|
||||
|
@@ -24,6 +24,9 @@ extern GimpActionFactory *global_action_factory;
|
||||
void actions_init (Gimp *gimp);
|
||||
void actions_exit (Gimp *gimp);
|
||||
|
||||
void actions_filter_set_aux (const gchar *action_name);
|
||||
gboolean actions_filter_get_aux (const gchar *action_name);
|
||||
|
||||
Gimp * action_data_get_gimp (gpointer data);
|
||||
GimpContext * action_data_get_context (gpointer data);
|
||||
GimpImage * action_data_get_image (gpointer data);
|
||||
|
@@ -82,6 +82,12 @@ static const GimpActionEntry file_actions[] =
|
||||
file_open_as_layers_cmd_callback,
|
||||
GIMP_HELP_FILE_OPEN_AS_LAYER },
|
||||
|
||||
{ "file-open-as-link-layers", GIMP_ICON_LAYER,
|
||||
NC_("file-action", "Op_en as Link Layer..."), NULL, { "<primary><alt><shift>O", NULL },
|
||||
NC_("file-action", "Open an image file as Link layer"),
|
||||
file_open_as_link_layer_cmd_callback,
|
||||
GIMP_HELP_FILE_OPEN_AS_LINK_LAYER },
|
||||
|
||||
{ "file-open-location", GIMP_ICON_WEB,
|
||||
NC_("file-action", "Open _Location..."), NULL, { NULL },
|
||||
NC_("file-action", "Open an image file from a specified location"),
|
||||
|
@@ -73,7 +73,8 @@ static void file_open_dialog_show (Gimp *gimp,
|
||||
const gchar *title,
|
||||
GimpImage *image,
|
||||
GFile *file,
|
||||
gboolean open_as_layers);
|
||||
gboolean open_as_layers,
|
||||
gboolean open_as_link);
|
||||
static GtkWidget * file_save_dialog_show (Gimp *gimp,
|
||||
GimpImage *image,
|
||||
GtkWidget *parent,
|
||||
@@ -118,7 +119,7 @@ file_open_cmd_callback (GimpAction *action,
|
||||
|
||||
file_open_dialog_show (gimp, widget,
|
||||
_("Open Image"),
|
||||
image, NULL, FALSE);
|
||||
image, NULL, FALSE, FALSE);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -140,7 +141,29 @@ file_open_as_layers_cmd_callback (GimpAction *action,
|
||||
|
||||
file_open_dialog_show (gimp, widget,
|
||||
_("Open Image as Layers"),
|
||||
image, NULL, TRUE);
|
||||
image, NULL, TRUE, FALSE);
|
||||
}
|
||||
|
||||
void
|
||||
file_open_as_link_layer_cmd_callback (GimpAction *action,
|
||||
GVariant *value,
|
||||
gpointer data)
|
||||
{
|
||||
Gimp *gimp;
|
||||
GtkWidget *widget;
|
||||
GimpDisplay *display;
|
||||
GimpImage *image = NULL;
|
||||
return_if_no_gimp (gimp, data);
|
||||
return_if_no_widget (widget, data);
|
||||
|
||||
display = action_data_get_display (data);
|
||||
|
||||
if (display)
|
||||
image = gimp_display_get_image (display);
|
||||
|
||||
file_open_dialog_show (gimp, widget,
|
||||
_("Open Image as Link Layer"),
|
||||
image, NULL, TRUE, TRUE);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -577,7 +600,7 @@ file_file_open_dialog (Gimp *gimp,
|
||||
{
|
||||
file_open_dialog_show (gimp, parent,
|
||||
_("Open Image"),
|
||||
NULL, file, FALSE);
|
||||
NULL, file, FALSE, FALSE);
|
||||
}
|
||||
|
||||
|
||||
@@ -589,7 +612,8 @@ file_open_dialog_show (Gimp *gimp,
|
||||
const gchar *title,
|
||||
GimpImage *image,
|
||||
GFile *file,
|
||||
gboolean open_as_layers)
|
||||
gboolean open_as_layers,
|
||||
gboolean open_as_link)
|
||||
{
|
||||
GtkWidget *dialog;
|
||||
|
||||
@@ -621,7 +645,7 @@ file_open_dialog_show (Gimp *gimp,
|
||||
gtk_window_set_title (GTK_WINDOW (dialog), title);
|
||||
|
||||
gimp_open_dialog_set_image (GIMP_OPEN_DIALOG (dialog),
|
||||
image, open_as_layers);
|
||||
image, open_as_layers, open_as_link);
|
||||
|
||||
gtk_window_set_transient_for (GTK_WINDOW (dialog),
|
||||
GTK_WINDOW (gtk_widget_get_toplevel (parent)));
|
||||
@@ -841,9 +865,9 @@ file_revert_confirm_response (GtkWidget *dialog,
|
||||
|
||||
new_image = file_open_image (gimp, gimp_get_user_context (gimp),
|
||||
GIMP_PROGRESS (display),
|
||||
file, 0, 0, FALSE, NULL,
|
||||
file, 0, 0, TRUE, FALSE, NULL,
|
||||
GIMP_RUN_INTERACTIVE,
|
||||
&status, NULL, &error);
|
||||
NULL, &status, NULL, &error);
|
||||
|
||||
if (new_image)
|
||||
{
|
||||
|
@@ -24,6 +24,9 @@ void file_open_cmd_callback (GimpAction *action,
|
||||
void file_open_as_layers_cmd_callback (GimpAction *action,
|
||||
GVariant *value,
|
||||
gpointer data);
|
||||
void file_open_as_link_layer_cmd_callback (GimpAction *action,
|
||||
GVariant *value,
|
||||
gpointer data);
|
||||
void file_open_location_cmd_callback (GimpAction *action,
|
||||
GVariant *value,
|
||||
gpointer data);
|
||||
|
@@ -29,13 +29,18 @@
|
||||
|
||||
#include "core/gimp-filter-history.h"
|
||||
#include "core/gimpimage.h"
|
||||
#include "core/gimpgrouplayer.h"
|
||||
#include "core/gimplinklayer.h"
|
||||
#include "core/gimplayermask.h"
|
||||
|
||||
#include "path/gimpvectorlayer.h"
|
||||
|
||||
#include "pdb/gimpprocedure.h"
|
||||
|
||||
#include "widgets/gimpaction.h"
|
||||
#include "widgets/gimpactiongroup.h"
|
||||
#include "widgets/gimphelp-ids.h"
|
||||
#include "widgets/gimpstringaction.h"
|
||||
#include "widgets/gimpuimanager.h"
|
||||
#include "widgets/gimpwidgets-utils.h"
|
||||
|
||||
@@ -48,11 +53,12 @@
|
||||
|
||||
/* local function prototypes */
|
||||
|
||||
static void filters_actions_set_tooltips (GimpActionGroup *group,
|
||||
const GimpStringActionEntry *entries,
|
||||
gint n_entries);
|
||||
static void filters_actions_history_changed (Gimp *gimp,
|
||||
GimpActionGroup *group);
|
||||
static void filters_actions_set_tooltips (GimpActionGroup *group,
|
||||
const GimpStringActionEntry *entries,
|
||||
gint n_entries);
|
||||
static void filters_actions_history_changed (Gimp *gimp,
|
||||
GimpActionGroup *group);
|
||||
static gboolean filters_is_non_interactive (const gchar *action_name);
|
||||
|
||||
|
||||
/* private variables */
|
||||
@@ -748,6 +754,7 @@ static const GimpEnumActionEntry filters_repeat_actions[] =
|
||||
void
|
||||
filters_actions_setup (GimpActionGroup *group)
|
||||
{
|
||||
static gboolean first_setup = TRUE;
|
||||
GimpProcedureActionEntry *entries;
|
||||
gint n_entries;
|
||||
gint i;
|
||||
@@ -776,6 +783,21 @@ filters_actions_setup (GimpActionGroup *group)
|
||||
filters_actions_set_tooltips (group, filters_interactive_actions,
|
||||
G_N_ELEMENTS (filters_interactive_actions));
|
||||
|
||||
/* XXX Hardcoded list to prevent expensive node/graph creation of a
|
||||
* well-known list of operations.
|
||||
* This whole code will disappear when we'll support filters with aux
|
||||
* input non-destructively anyway.
|
||||
*/
|
||||
if (first_setup)
|
||||
{
|
||||
actions_filter_set_aux ("filters-variable-blur");
|
||||
actions_filter_set_aux ("filters-oilify");
|
||||
actions_filter_set_aux ("filters-lens-blur");
|
||||
actions_filter_set_aux ("filters-gaussian-blur-selective");
|
||||
actions_filter_set_aux ("filters-displace");
|
||||
actions_filter_set_aux ("filters-bump-map");
|
||||
}
|
||||
|
||||
gegl_actions = g_strv_builder_new ();
|
||||
op_classes = gimp_gegl_get_op_classes (TRUE);
|
||||
|
||||
@@ -861,6 +883,23 @@ filters_actions_setup (GimpActionGroup *group)
|
||||
g_free (short_label);
|
||||
}
|
||||
|
||||
/* Identify third-party filters based on operations with an
|
||||
* auxiliary pad in first setup because of slowness on Windows.
|
||||
* See #14781.
|
||||
*/
|
||||
if (first_setup)
|
||||
{
|
||||
GeglNode *node = gegl_node_new ();
|
||||
|
||||
gegl_node_set (node,
|
||||
"operation", op_class->name,
|
||||
NULL);
|
||||
|
||||
if (gegl_node_has_pad (node, "aux"))
|
||||
actions_filter_set_aux (action_name);
|
||||
|
||||
g_clear_object (&node);
|
||||
}
|
||||
g_strv_builder_add (gegl_actions, action_name);
|
||||
|
||||
g_free (label);
|
||||
@@ -910,6 +949,8 @@ filters_actions_setup (GimpActionGroup *group)
|
||||
group, 0);
|
||||
|
||||
filters_actions_history_changed (group->gimp, group);
|
||||
|
||||
first_setup = FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
@@ -917,11 +958,14 @@ filters_actions_update (GimpActionGroup *group,
|
||||
gpointer data)
|
||||
{
|
||||
GimpImage *image;
|
||||
GList *actions;
|
||||
GList *iter;
|
||||
gboolean writable = FALSE;
|
||||
gboolean gray = FALSE;
|
||||
gboolean alpha = FALSE;
|
||||
gboolean supports_alpha = FALSE;
|
||||
gboolean is_group = FALSE;
|
||||
gboolean force_nde = FALSE;
|
||||
|
||||
image = action_data_get_image (data);
|
||||
|
||||
@@ -949,6 +993,11 @@ filters_actions_update (GimpActionGroup *group,
|
||||
|
||||
if (gimp_viewable_get_children (GIMP_VIEWABLE (drawable)))
|
||||
is_group = TRUE;
|
||||
|
||||
if (GIMP_IS_GROUP_LAYER (drawable) ||
|
||||
gimp_item_is_vector_layer (GIMP_ITEM (drawable)) ||
|
||||
gimp_item_is_link_layer (GIMP_ITEM (drawable)))
|
||||
force_nde = TRUE;
|
||||
}
|
||||
|
||||
g_list_free (drawables);
|
||||
@@ -957,134 +1006,82 @@ filters_actions_update (GimpActionGroup *group,
|
||||
#define SET_SENSITIVE(action,condition) \
|
||||
gimp_action_group_set_action_sensitive (group, action, (condition) != 0, NULL)
|
||||
|
||||
SET_SENSITIVE ("filters-alien-map", writable);
|
||||
SET_SENSITIVE ("filters-antialias", writable && !is_group);
|
||||
SET_SENSITIVE ("filters-apply-canvas", writable);
|
||||
SET_SENSITIVE ("filters-apply-lens", writable);
|
||||
SET_SENSITIVE ("filters-bayer-matrix", writable);
|
||||
SET_SENSITIVE ("filters-bloom", writable);
|
||||
SET_SENSITIVE ("filters-brightness-contrast", writable);
|
||||
SET_SENSITIVE ("filters-bump-map", writable && !is_group);
|
||||
actions = gimp_action_group_list_actions (group);
|
||||
for (iter = actions; iter; iter = iter->next)
|
||||
{
|
||||
GimpAction *action = iter->data;
|
||||
const gchar *action_name;
|
||||
|
||||
action_name = gimp_action_get_name (action);
|
||||
|
||||
if (filters_is_non_interactive (action_name))
|
||||
{
|
||||
/* Even I'm not sure they should, right now non-interactive
|
||||
* actions are always applied destructively. So these filters
|
||||
* are incompatible with layers where non-destructivity is
|
||||
* mandatory.
|
||||
*/
|
||||
SET_SENSITIVE (action_name, writable && ! force_nde);
|
||||
}
|
||||
else if (GIMP_IS_STRING_ACTION (action))
|
||||
{
|
||||
const gchar *opname;
|
||||
|
||||
opname = GIMP_STRING_ACTION (action)->value;
|
||||
|
||||
if (opname == NULL)
|
||||
/* These are the filters-recent-*, repeat and reshow handled
|
||||
* below.
|
||||
*/
|
||||
continue;
|
||||
|
||||
if (g_strcmp0 (opname, "gegl:gegl") == 0)
|
||||
{
|
||||
/* GEGL graph filter can only be run destructively, unless
|
||||
* the GIMP_ALLOW_GEGL_GRAPH_LAYER_EFFECT environment
|
||||
* variable is set.
|
||||
*/
|
||||
SET_SENSITIVE (gimp_action_get_name (action), writable &&
|
||||
(g_getenv ("GIMP_ALLOW_GEGL_GRAPH_LAYER_EFFECT") != NULL || ! force_nde));
|
||||
}
|
||||
else if (gegl_has_operation (opname))
|
||||
{
|
||||
gboolean sensitive = writable;
|
||||
|
||||
if (sensitive && force_nde)
|
||||
/* Operations with auxiliary inputs can only be applied
|
||||
* destructively. Therefore they must be deactivated on
|
||||
* types of layers where filters can only be applied
|
||||
* non-destructively.
|
||||
*/
|
||||
sensitive = ! actions_filter_get_aux (action_name);
|
||||
|
||||
SET_SENSITIVE (gimp_action_get_name (action), sensitive);
|
||||
}
|
||||
}
|
||||
}
|
||||
g_list_free (actions);
|
||||
|
||||
/* Special-cased filters */
|
||||
SET_SENSITIVE ("filters-c2g", writable && !gray);
|
||||
SET_SENSITIVE ("filters-cartoon", writable);
|
||||
SET_SENSITIVE ("filters-channel-mixer", writable);
|
||||
SET_SENSITIVE ("filters-checkerboard", writable);
|
||||
SET_SENSITIVE ("filters-color-balance", writable && !gray);
|
||||
SET_SENSITIVE ("filters-color-enhance", writable && !gray);
|
||||
SET_SENSITIVE ("filters-color-exchange", writable);
|
||||
SET_SENSITIVE ("filters-color-enhance", writable && !force_nde && !gray);
|
||||
SET_SENSITIVE ("filters-colorize", writable && !gray);
|
||||
SET_SENSITIVE ("filters-dither", writable);
|
||||
SET_SENSITIVE ("filters-color-rotate", writable);
|
||||
SET_SENSITIVE ("filters-color-temperature", writable && !gray);
|
||||
SET_SENSITIVE ("filters-color-to-alpha", writable && supports_alpha);
|
||||
SET_SENSITIVE ("filters-component-extract", writable);
|
||||
SET_SENSITIVE ("filters-convolution-matrix", writable);
|
||||
SET_SENSITIVE ("filters-cubism", writable);
|
||||
SET_SENSITIVE ("filters-curves", writable);
|
||||
SET_SENSITIVE ("filters-deinterlace", writable);
|
||||
SET_SENSITIVE ("filters-desaturate", writable && !gray);
|
||||
SET_SENSITIVE ("filters-difference-of-gaussians", writable);
|
||||
SET_SENSITIVE ("filters-diffraction-patterns", writable);
|
||||
SET_SENSITIVE ("filters-dilate", writable && !is_group);
|
||||
SET_SENSITIVE ("filters-displace", writable && !is_group);
|
||||
SET_SENSITIVE ("filters-distance-map", writable);
|
||||
|
||||
SET_SENSITIVE ("filters-dropshadow", writable && alpha);
|
||||
SET_SENSITIVE ("filters-edge", writable && !is_group);
|
||||
SET_SENSITIVE ("filters-edge-laplace", writable);
|
||||
SET_SENSITIVE ("filters-edge-neon", writable);
|
||||
SET_SENSITIVE ("filters-edge-sobel", writable);
|
||||
SET_SENSITIVE ("filters-emboss", writable);
|
||||
SET_SENSITIVE ("filters-engrave", writable);
|
||||
SET_SENSITIVE ("filters-erode", writable);
|
||||
SET_SENSITIVE ("filters-exposure", writable);
|
||||
SET_SENSITIVE ("filters-fattal-2002", writable);
|
||||
SET_SENSITIVE ("filters-focus-blur", writable);
|
||||
SET_SENSITIVE ("filters-fractal-trace", writable);
|
||||
SET_SENSITIVE ("filters-gaussian-blur", writable);
|
||||
SET_SENSITIVE ("filters-gaussian-blur-selective", writable && !is_group);
|
||||
SET_SENSITIVE ("filters-gegl-graph", writable && !is_group);
|
||||
SET_SENSITIVE ("filters-grid", writable);
|
||||
SET_SENSITIVE ("filters-high-pass", writable);
|
||||
SET_SENSITIVE ("filters-hue-chroma", writable);
|
||||
SET_SENSITIVE ("filters-hue-saturation", writable && !gray);
|
||||
SET_SENSITIVE ("filters-illusion", writable);
|
||||
SET_SENSITIVE ("filters-invert-linear", writable && !is_group);
|
||||
SET_SENSITIVE ("filters-invert-perceptual", writable && !is_group);
|
||||
SET_SENSITIVE ("filters-invert-value", writable && !is_group);
|
||||
SET_SENSITIVE ("filters-image-gradient", writable);
|
||||
SET_SENSITIVE ("filters-kaleidoscope", writable);
|
||||
SET_SENSITIVE ("filters-lens-blur", writable && !is_group);
|
||||
SET_SENSITIVE ("filters-lens-distortion", writable);
|
||||
SET_SENSITIVE ("filters-lens-flare", writable);
|
||||
SET_SENSITIVE ("filters-levels", writable);
|
||||
SET_SENSITIVE ("filters-linear-sinusoid", writable);
|
||||
SET_SENSITIVE ("filters-little-planet", writable);
|
||||
SET_SENSITIVE ("filters-long-shadow", writable && alpha);
|
||||
SET_SENSITIVE ("filters-mantiuk-2006", writable);
|
||||
SET_SENSITIVE ("filters-maze", writable);
|
||||
SET_SENSITIVE ("filters-mean-curvature-blur", writable);
|
||||
SET_SENSITIVE ("filters-median-blur", writable);
|
||||
SET_SENSITIVE ("filters-mono-mixer", writable && !gray);
|
||||
SET_SENSITIVE ("filters-mosaic", writable);
|
||||
SET_SENSITIVE ("filters-motion-blur-circular", writable);
|
||||
SET_SENSITIVE ("filters-motion-blur-linear", writable);
|
||||
SET_SENSITIVE ("filters-motion-blur-zoom", writable);
|
||||
SET_SENSITIVE ("filters-newsprint", writable);
|
||||
SET_SENSITIVE ("filters-noise-cell", writable);
|
||||
SET_SENSITIVE ("filters-noise-cie-lch", writable);
|
||||
SET_SENSITIVE ("filters-noise-hsv", writable && !gray);
|
||||
SET_SENSITIVE ("filters-noise-hurl", writable);
|
||||
SET_SENSITIVE ("filters-noise-perlin", writable);
|
||||
SET_SENSITIVE ("filters-noise-pick", writable);
|
||||
SET_SENSITIVE ("filters-noise-reduction", writable);
|
||||
SET_SENSITIVE ("filters-noise-rgb", writable);
|
||||
SET_SENSITIVE ("filters-noise-simplex", writable);
|
||||
SET_SENSITIVE ("filters-noise-slur", writable);
|
||||
SET_SENSITIVE ("filters-noise-solid", writable);
|
||||
SET_SENSITIVE ("filters-noise-spread", writable);
|
||||
SET_SENSITIVE ("filters-normal-map", writable);
|
||||
SET_SENSITIVE ("filters-offset", writable);
|
||||
SET_SENSITIVE ("filters-oilify", writable && !is_group);
|
||||
SET_SENSITIVE ("filters-panorama-projection", writable);
|
||||
SET_SENSITIVE ("filters-photocopy", writable);
|
||||
SET_SENSITIVE ("filters-pixelize", writable);
|
||||
SET_SENSITIVE ("filters-plasma", writable);
|
||||
SET_SENSITIVE ("filters-polar-coordinates", writable);
|
||||
SET_SENSITIVE ("filters-posterize", writable);
|
||||
SET_SENSITIVE ("filters-recursive-transform", writable);
|
||||
SET_SENSITIVE ("filters-red-eye-removal", writable && !gray);
|
||||
SET_SENSITIVE ("filters-reinhard-2005", writable);
|
||||
SET_SENSITIVE ("filters-rgb-clip", writable);
|
||||
SET_SENSITIVE ("filters-ripple", writable);
|
||||
SET_SENSITIVE ("filters-saturation", writable && !gray);
|
||||
SET_SENSITIVE ("filters-semi-flatten", writable && alpha);
|
||||
SET_SENSITIVE ("filters-sepia", writable && !gray);
|
||||
SET_SENSITIVE ("filters-shadows-highlights", writable);
|
||||
SET_SENSITIVE ("filters-shift", writable);
|
||||
SET_SENSITIVE ("filters-sinus", writable);
|
||||
SET_SENSITIVE ("filters-slic", writable);
|
||||
SET_SENSITIVE ("filters-snn-mean", writable);
|
||||
SET_SENSITIVE ("filters-softglow", writable);
|
||||
SET_SENSITIVE ("filters-spherize", writable);
|
||||
SET_SENSITIVE ("filters-spiral", writable);
|
||||
SET_SENSITIVE ("filters-stretch-contrast", writable);
|
||||
SET_SENSITIVE ("filters-stretch-contrast-hsv", writable);
|
||||
SET_SENSITIVE ("filters-stress", writable);
|
||||
SET_SENSITIVE ("filters-supernova", writable);
|
||||
SET_SENSITIVE ("filters-threshold", writable);
|
||||
SET_SENSITIVE ("filters-threshold-alpha", writable && alpha);
|
||||
SET_SENSITIVE ("filters-tile-glass", writable);
|
||||
SET_SENSITIVE ("filters-tile-paper", writable);
|
||||
SET_SENSITIVE ("filters-tile-seamless", writable);
|
||||
SET_SENSITIVE ("filters-unsharp-mask", writable);
|
||||
SET_SENSITIVE ("filters-value-propagate", writable);
|
||||
SET_SENSITIVE ("filters-variable-blur", writable && !is_group);
|
||||
SET_SENSITIVE ("filters-video-degradation", writable);
|
||||
SET_SENSITIVE ("filters-vignette", writable);
|
||||
SET_SENSITIVE ("filters-waterpixels", writable);
|
||||
SET_SENSITIVE ("filters-waves", writable);
|
||||
SET_SENSITIVE ("filters-whirl-pinch", writable);
|
||||
SET_SENSITIVE ("filters-wind", writable);
|
||||
|
||||
#undef SET_SENSITIVE
|
||||
|
||||
@@ -1336,3 +1333,19 @@ filters_actions_history_changed (Gimp *gimp,
|
||||
NULL);
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
filters_is_non_interactive (const gchar *action_name)
|
||||
{
|
||||
gint i;
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS (filters_actions); i++)
|
||||
if (g_strcmp0 (filters_actions[i].name, action_name) == 0)
|
||||
return TRUE;
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS (filters_settings_actions); i++)
|
||||
if (g_strcmp0 (filters_settings_actions[i].name, action_name) == 0)
|
||||
return TRUE;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
@@ -30,9 +30,12 @@
|
||||
#include "core/gimpimage.h"
|
||||
#include "core/gimplayer.h"
|
||||
#include "core/gimplayer-floating-selection.h"
|
||||
#include "core/gimplinklayer.h"
|
||||
|
||||
#include "text/gimptextlayer.h"
|
||||
|
||||
#include "path/gimpvectorlayer.h"
|
||||
|
||||
#include "widgets/gimphelp-ids.h"
|
||||
#include "widgets/gimpactiongroup.h"
|
||||
#include "widgets/gimpwidgets-utils.h"
|
||||
@@ -60,6 +63,12 @@ static const GimpActionEntry layers_actions[] =
|
||||
layers_edit_text_cmd_callback,
|
||||
GIMP_HELP_LAYER_EDIT },
|
||||
|
||||
{ "layers-edit-vector", GIMP_ICON_TOOL_PATH,
|
||||
NC_("layers-action", "Path Tool"), NULL, { NULL },
|
||||
NC_("layers-action", "Activate the path tool on this vector layer's path"),
|
||||
layers_edit_vector_cmd_callback,
|
||||
GIMP_HELP_TOOL_PATH },
|
||||
|
||||
{ "layers-edit-attributes", GIMP_ICON_EDIT,
|
||||
NC_("layers-action", "_Edit Layer Attributes..."), NULL, { NULL },
|
||||
NC_("layers-action", "Edit the layer's name"),
|
||||
@@ -173,6 +182,18 @@ static const GimpActionEntry layers_actions[] =
|
||||
image_flatten_image_cmd_callback,
|
||||
GIMP_HELP_IMAGE_FLATTEN },
|
||||
|
||||
{ "layers-link-discard", GIMP_ICON_TOOL_TEXT,
|
||||
NC_("layers-action", "_Discard Link Information"), NULL, { NULL },
|
||||
NC_("layers-action", "Turn this link layer into a normal layer"),
|
||||
layers_link_discard_cmd_callback,
|
||||
GIMP_HELP_LAYER_TEXT_DISCARD },
|
||||
|
||||
{ "layers-link-monitor", GIMP_ICON_TOOL_TEXT,
|
||||
NC_("layers-action", "_Monitor Linked Image"), NULL, { NULL },
|
||||
NC_("layers-action", "Discard any transformation and monitor the linked file again"),
|
||||
layers_link_monitor_cmd_callback,
|
||||
GIMP_HELP_LAYER_TEXT_DISCARD },
|
||||
|
||||
{ "layers-text-discard", GIMP_ICON_TOOL_TEXT,
|
||||
NC_("layers-action", "_Discard Text Information"), NULL, { NULL },
|
||||
NC_("layers-action", "Turn these text layers into normal layers"),
|
||||
@@ -191,6 +212,18 @@ static const GimpActionEntry layers_actions[] =
|
||||
layers_text_along_path_cmd_callback,
|
||||
GIMP_HELP_LAYER_TEXT_ALONG_PATH },
|
||||
|
||||
{ "layers-vector-fill-stroke", NULL,
|
||||
NC_("layers-action", "Fill / Stroke..."), NULL, { NULL },
|
||||
NC_("layers-action", "Edit the fill and stroke of this vector layer"),
|
||||
layers_vector_fill_stroke_cmd_callback,
|
||||
GIMP_HELP_LAYER_VECTOR_FILL_STROKE },
|
||||
|
||||
{ "layers-vector-discard", NULL,
|
||||
NC_("layers-action", "Discard Vector Information"), NULL, { NULL },
|
||||
NC_("layers-action", "Turn this vector layer into a normal layer"),
|
||||
layers_vector_discard_cmd_callback,
|
||||
GIMP_HELP_LAYER_VECTOR_DISCARD },
|
||||
|
||||
{ "layers-resize", GIMP_ICON_OBJECT_RESIZE,
|
||||
NC_("layers-action", "Layer B_oundary Size..."), NULL, { NULL },
|
||||
NC_("layers-action", "Adjust the layer dimensions"),
|
||||
@@ -757,6 +790,8 @@ layers_actions_update (GimpActionGroup *group,
|
||||
gboolean lock_alpha = TRUE;
|
||||
gboolean can_lock_alpha = FALSE;
|
||||
gboolean text_layer = FALSE;
|
||||
gboolean vector_layer = FALSE;
|
||||
gboolean link_layer = FALSE;
|
||||
gboolean bs_mutable = FALSE; /* At least 1 selected layers' blend space is mutable. */
|
||||
gboolean cs_mutable = FALSE; /* At least 1 selected layers' composite space is mutable. */
|
||||
gboolean cm_mutable = FALSE; /* At least 1 selected layers' composite mode is mutable. */
|
||||
@@ -977,7 +1012,10 @@ layers_actions_update (GimpActionGroup *group,
|
||||
|
||||
gimp_action_group_set_action_active (group, action, TRUE);
|
||||
|
||||
text_layer = gimp_item_is_text_layer (GIMP_ITEM (layer));
|
||||
text_layer = gimp_item_is_text_layer (GIMP_ITEM (layer));
|
||||
vector_layer = gimp_item_is_vector_layer (GIMP_ITEM (layer));
|
||||
if (GIMP_IS_LINK_LAYER (layer))
|
||||
link_layer = gimp_link_layer_is_monitored (GIMP_LINK_LAYER (layer));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -993,6 +1031,7 @@ layers_actions_update (GimpActionGroup *group,
|
||||
SET_SENSITIVE ("layers-edit", !ac && ((layer && !fs) || text_layer));
|
||||
SET_VISIBLE ("layers-edit-text", text_layer && !ac);
|
||||
SET_SENSITIVE ("layers-edit-text", text_layer && !ac);
|
||||
SET_VISIBLE ("layers-edit-vector", vector_layer && !ac);
|
||||
SET_SENSITIVE ("layers-edit-attributes", layer && !fs && !ac);
|
||||
|
||||
if (layer && gimp_layer_is_floating_sel (layer))
|
||||
@@ -1042,6 +1081,12 @@ layers_actions_update (GimpActionGroup *group,
|
||||
SET_VISIBLE ("layers-text-to-path", n_text_layers > 0 && !ac);
|
||||
SET_VISIBLE ("layers-text-along-path", text_layer && !ac);
|
||||
|
||||
SET_VISIBLE ("layers-vector-fill-stroke", vector_layer && !ac);
|
||||
SET_VISIBLE ("layers-vector-discard", vector_layer && !ac);
|
||||
|
||||
SET_VISIBLE ("layers-link-discard", link_layer && !ac);
|
||||
SET_VISIBLE ("layers-link-monitor", GIMP_IS_LINK_LAYER (layer) && ! link_layer && !ac);
|
||||
|
||||
SET_SENSITIVE ("layers-resize", n_selected_layers == 1 && all_writable && all_movable && !ac);
|
||||
SET_SENSITIVE ("layers-resize-to-image", all_writable && all_movable && !ac);
|
||||
SET_SENSITIVE ("layers-scale", n_selected_layers == 1 && all_writable && all_movable && !ac);
|
||||
|
@@ -48,6 +48,8 @@
|
||||
#include "core/gimplayerpropundo.h"
|
||||
#include "core/gimplayer-floating-selection.h"
|
||||
#include "core/gimplayer-new.h"
|
||||
#include "core/gimplink.h"
|
||||
#include "core/gimplinklayer.h"
|
||||
#include "core/gimplist.h"
|
||||
#include "core/gimppickable.h"
|
||||
#include "core/gimppickable-auto-shrink.h"
|
||||
@@ -58,6 +60,8 @@
|
||||
#include "path/gimppath.h"
|
||||
#include "path/gimppath-warp.h"
|
||||
#include "path/gimpstroke.h"
|
||||
#include "path/gimpvectorlayer.h"
|
||||
#include "path/gimpvectorlayeroptions.h"
|
||||
|
||||
#include "text/gimptext.h"
|
||||
#include "text/gimptext-path.h"
|
||||
@@ -66,12 +70,14 @@
|
||||
#include "widgets/gimpaction.h"
|
||||
#include "widgets/gimpdock.h"
|
||||
#include "widgets/gimphelp-ids.h"
|
||||
#include "widgets/gimpopendialog.h"
|
||||
#include "widgets/gimpprogressdialog.h"
|
||||
|
||||
#include "display/gimpdisplay.h"
|
||||
#include "display/gimpdisplayshell.h"
|
||||
#include "display/gimpimagewindow.h"
|
||||
|
||||
#include "tools/gimppathtool.h"
|
||||
#include "tools/gimptexttool.h"
|
||||
#include "tools/tool_manager.h"
|
||||
|
||||
@@ -80,6 +86,7 @@
|
||||
#include "dialogs/layer-options-dialog.h"
|
||||
#include "dialogs/resize-dialog.h"
|
||||
#include "dialogs/scale-dialog.h"
|
||||
#include "dialogs/vector-layer-options-dialog.h"
|
||||
|
||||
#include "actions.h"
|
||||
#include "items-commands.h"
|
||||
@@ -90,87 +97,93 @@
|
||||
|
||||
/* local function prototypes */
|
||||
|
||||
static void layers_new_callback (GtkWidget *dialog,
|
||||
GimpImage *image,
|
||||
GimpLayer *layer,
|
||||
GimpContext *context,
|
||||
const gchar *layer_name,
|
||||
GimpLayerMode layer_mode,
|
||||
GimpLayerColorSpace layer_blend_space,
|
||||
GimpLayerColorSpace layer_composite_space,
|
||||
GimpLayerCompositeMode layer_composite_mode,
|
||||
gdouble layer_opacity,
|
||||
GimpFillType layer_fill_type,
|
||||
gint layer_width,
|
||||
gint layer_height,
|
||||
gint layer_offset_x,
|
||||
gint layer_offset_y,
|
||||
gboolean layer_visible,
|
||||
GimpColorTag layer_color_tag,
|
||||
gboolean layer_lock_pixels,
|
||||
gboolean layer_lock_position,
|
||||
gboolean layer_lock_visibility,
|
||||
gboolean layer_lock_alpha,
|
||||
gboolean rename_text_layer,
|
||||
gpointer user_data);
|
||||
static void layers_edit_attributes_callback (GtkWidget *dialog,
|
||||
GimpImage *image,
|
||||
GimpLayer *layer,
|
||||
GimpContext *context,
|
||||
const gchar *layer_name,
|
||||
GimpLayerMode layer_mode,
|
||||
GimpLayerColorSpace layer_blend_space,
|
||||
GimpLayerColorSpace layer_composite_space,
|
||||
GimpLayerCompositeMode layer_composite_mode,
|
||||
gdouble layer_opacity,
|
||||
GimpFillType layer_fill_type,
|
||||
gint layer_width,
|
||||
gint layer_height,
|
||||
gint layer_offset_x,
|
||||
gint layer_offset_y,
|
||||
gboolean layer_visible,
|
||||
GimpColorTag layer_color_tag,
|
||||
gboolean layer_lock_pixels,
|
||||
gboolean layer_lock_position,
|
||||
gboolean layer_lock_visibility,
|
||||
gboolean layer_lock_alpha,
|
||||
gboolean rename_text_layer,
|
||||
gpointer user_data);
|
||||
static void layers_add_mask_callback (GtkWidget *dialog,
|
||||
GList *layers,
|
||||
GimpAddMaskType add_mask_type,
|
||||
GimpChannel *channel,
|
||||
gboolean invert,
|
||||
gpointer user_data);
|
||||
static void layers_scale_callback (GtkWidget *dialog,
|
||||
GimpViewable *viewable,
|
||||
gint width,
|
||||
gint height,
|
||||
GimpUnit *unit,
|
||||
GimpInterpolationType interpolation,
|
||||
gdouble xresolution,
|
||||
gdouble yresolution,
|
||||
GimpUnit *resolution_unit,
|
||||
gpointer user_data);
|
||||
static void layers_resize_callback (GtkWidget *dialog,
|
||||
GimpViewable *viewable,
|
||||
GimpContext *context,
|
||||
gint width,
|
||||
gint height,
|
||||
GimpUnit *unit,
|
||||
gint offset_x,
|
||||
gint offset_y,
|
||||
gdouble unused0,
|
||||
gdouble unused1,
|
||||
GimpUnit *unused2,
|
||||
GimpFillType fill_type,
|
||||
GimpItemSet unused3,
|
||||
gboolean unused4,
|
||||
gpointer data);
|
||||
static void layers_new_callback (GtkWidget *dialog,
|
||||
GimpImage *image,
|
||||
GimpLayer *layer,
|
||||
GimpContext *context,
|
||||
const gchar *layer_name,
|
||||
GimpLayerMode layer_mode,
|
||||
GimpLayerColorSpace layer_blend_space,
|
||||
GimpLayerColorSpace layer_composite_space,
|
||||
GimpLayerCompositeMode layer_composite_mode,
|
||||
gdouble layer_opacity,
|
||||
GimpFillType layer_fill_type,
|
||||
GimpInsertPosition insert_position,
|
||||
GimpInsertGroupPosition insert_group_position,
|
||||
GimpLink *link,
|
||||
gint layer_width,
|
||||
gint layer_height,
|
||||
gint layer_offset_x,
|
||||
gint layer_offset_y,
|
||||
gboolean layer_visible,
|
||||
GimpColorTag layer_color_tag,
|
||||
gboolean layer_lock_pixels,
|
||||
gboolean layer_lock_position,
|
||||
gboolean layer_lock_visibility,
|
||||
gboolean layer_lock_alpha,
|
||||
gboolean rename_text_layer,
|
||||
gpointer user_data);
|
||||
static void layers_edit_attributes_callback (GtkWidget *dialog,
|
||||
GimpImage *image,
|
||||
GimpLayer *layer,
|
||||
GimpContext *context,
|
||||
const gchar *layer_name,
|
||||
GimpLayerMode layer_mode,
|
||||
GimpLayerColorSpace layer_blend_space,
|
||||
GimpLayerColorSpace layer_composite_space,
|
||||
GimpLayerCompositeMode layer_composite_mode,
|
||||
gdouble layer_opacity,
|
||||
GimpFillType unused,
|
||||
GimpInsertPosition unused2,
|
||||
GimpInsertGroupPosition unused3,
|
||||
GimpLink *link,
|
||||
gint layer_width,
|
||||
gint layer_height,
|
||||
gint layer_offset_x,
|
||||
gint layer_offset_y,
|
||||
gboolean layer_visible,
|
||||
GimpColorTag layer_color_tag,
|
||||
gboolean layer_lock_pixels,
|
||||
gboolean layer_lock_position,
|
||||
gboolean layer_lock_visibility,
|
||||
gboolean layer_lock_alpha,
|
||||
gboolean rename_text_layer,
|
||||
gpointer user_data);
|
||||
static void layers_add_mask_callback (GtkWidget *dialog,
|
||||
GList *layers,
|
||||
GimpAddMaskType add_mask_type,
|
||||
GimpChannel *channel,
|
||||
gboolean invert,
|
||||
gpointer user_data);
|
||||
static void layers_scale_callback (GtkWidget *dialog,
|
||||
GimpViewable *viewable,
|
||||
gint width,
|
||||
gint height,
|
||||
GimpUnit *unit,
|
||||
GimpInterpolationType interpolation,
|
||||
gdouble xresolution,
|
||||
gdouble yresolution,
|
||||
GimpUnit *resolution_unit,
|
||||
gpointer user_data);
|
||||
static void layers_resize_callback (GtkWidget *dialog,
|
||||
GimpViewable *viewable,
|
||||
GimpContext *context,
|
||||
gint width,
|
||||
gint height,
|
||||
GimpUnit *unit,
|
||||
gint offset_x,
|
||||
gint offset_y,
|
||||
gdouble unused0,
|
||||
gdouble unused1,
|
||||
GimpUnit *unused2,
|
||||
GimpFillType fill_type,
|
||||
GimpItemSet unused3,
|
||||
gboolean unused4,
|
||||
gpointer data);
|
||||
|
||||
static gint layers_mode_index (GimpLayerMode layer_mode,
|
||||
const GimpLayerMode *modes,
|
||||
gint n_modes);
|
||||
static gint layers_mode_index (GimpLayerMode layer_mode,
|
||||
const GimpLayerMode *modes,
|
||||
gint n_modes);
|
||||
|
||||
|
||||
/* private variables */
|
||||
@@ -200,6 +213,10 @@ layers_edit_cmd_callback (GimpAction *action,
|
||||
{
|
||||
layers_edit_text_cmd_callback (action, value, data);
|
||||
}
|
||||
else if (gimp_item_is_vector_layer (GIMP_ITEM (layers->data)))
|
||||
{
|
||||
layers_vector_fill_stroke_cmd_callback (action, value, data);
|
||||
}
|
||||
else
|
||||
{
|
||||
layers_edit_attributes_cmd_callback (action, value, data);
|
||||
@@ -251,6 +268,52 @@ layers_edit_text_cmd_callback (GimpAction *action,
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
layers_edit_vector_cmd_callback (GimpAction *action,
|
||||
GVariant *value,
|
||||
gpointer data)
|
||||
{
|
||||
GimpImage *image;
|
||||
GimpLayer *layer;
|
||||
GList *layers;
|
||||
GtkWidget *widget;
|
||||
GimpTool *active_tool;
|
||||
return_if_no_layers (image, layers, data);
|
||||
return_if_no_widget (widget, data);
|
||||
|
||||
if (g_list_length (layers) != 1)
|
||||
return;
|
||||
|
||||
layer = layers->data;
|
||||
|
||||
if (! gimp_item_is_vector_layer (GIMP_ITEM (layer)))
|
||||
{
|
||||
layers_edit_attributes_cmd_callback (action, value, data);
|
||||
return;
|
||||
}
|
||||
|
||||
active_tool = tool_manager_get_active (image->gimp);
|
||||
|
||||
if (! GIMP_IS_PATH_TOOL (active_tool))
|
||||
{
|
||||
GimpToolInfo *tool_info;
|
||||
|
||||
tool_info = (GimpToolInfo *)
|
||||
gimp_container_get_child_by_name (image->gimp->tool_info_list,
|
||||
"gimp-path-tool");
|
||||
|
||||
if (GIMP_IS_TOOL_INFO (tool_info))
|
||||
{
|
||||
gimp_context_set_tool (action_data_get_context (data), tool_info);
|
||||
active_tool = tool_manager_get_active (image->gimp);
|
||||
}
|
||||
}
|
||||
|
||||
if (GIMP_IS_PATH_TOOL (active_tool))
|
||||
gimp_path_tool_set_path (GIMP_PATH_TOOL (active_tool),
|
||||
GIMP_VECTOR_LAYER (layer)->options->path);
|
||||
}
|
||||
|
||||
void
|
||||
layers_edit_attributes_cmd_callback (GimpAction *action,
|
||||
GVariant *value,
|
||||
@@ -296,6 +359,8 @@ layers_edit_attributes_cmd_callback (GimpAction *action,
|
||||
gimp_layer_get_composite_mode (layer),
|
||||
gimp_layer_get_opacity (layer),
|
||||
0 /* unused */,
|
||||
0 /* unused */,
|
||||
0 /* unused */,
|
||||
gimp_item_get_visible (item),
|
||||
gimp_item_get_color_tag (item),
|
||||
gimp_item_get_lock_content (item),
|
||||
@@ -381,6 +446,8 @@ layers_new_cmd_callback (GimpAction *action,
|
||||
config->layer_new_composite_mode,
|
||||
config->layer_new_opacity,
|
||||
config->layer_new_fill_type,
|
||||
config->layer_new_insert_position,
|
||||
config->layer_new_insert_group_position,
|
||||
TRUE,
|
||||
GIMP_COLOR_TAG_NONE,
|
||||
FALSE,
|
||||
@@ -454,15 +521,38 @@ layers_new_last_vals_cmd_callback (GimpAction *action,
|
||||
run_once = FALSE;
|
||||
if (iter)
|
||||
{
|
||||
if (gimp_viewable_get_children (GIMP_VIEWABLE (iter->data)))
|
||||
GimpContainer *container;
|
||||
|
||||
if ((container = gimp_viewable_get_children (GIMP_VIEWABLE (iter->data))))
|
||||
{
|
||||
parent = iter->data;
|
||||
position = 0;
|
||||
if (config->layer_new_insert_group_position == GIMP_INSERT_GROUP_TOP ||
|
||||
config->layer_new_insert_group_position == GIMP_INSERT_GROUP_BOTTOM)
|
||||
{
|
||||
parent = iter->data;
|
||||
|
||||
if (config->layer_new_insert_group_position == GIMP_INSERT_GROUP_TOP)
|
||||
position = 0;
|
||||
else
|
||||
position = gimp_container_get_n_children (container);
|
||||
}
|
||||
else
|
||||
{
|
||||
parent = GIMP_LAYER (gimp_item_get_parent (iter->data));
|
||||
|
||||
if (config->layer_new_insert_group_position == GIMP_INSERT_GROUP_ABOVE)
|
||||
position = gimp_item_get_index (iter->data);
|
||||
else
|
||||
position = gimp_item_get_index (iter->data) + 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
parent = GIMP_LAYER (gimp_item_get_parent (iter->data));
|
||||
position = gimp_item_get_index (iter->data);
|
||||
parent = GIMP_LAYER (gimp_item_get_parent (iter->data));
|
||||
|
||||
if (config->layer_new_insert_position == GIMP_INSERT_ABOVE)
|
||||
position = gimp_item_get_index (iter->data);
|
||||
else
|
||||
position = gimp_item_get_index (iter->data) + 1;
|
||||
}
|
||||
}
|
||||
else /* run_once */
|
||||
@@ -1045,6 +1135,42 @@ layers_delete_cmd_callback (GimpAction *action,
|
||||
gimp_image_flush (image);
|
||||
}
|
||||
|
||||
void
|
||||
layers_link_discard_cmd_callback (GimpAction *action,
|
||||
GVariant *value,
|
||||
gpointer data)
|
||||
{
|
||||
GimpImage *image;
|
||||
GList *layers;
|
||||
GList *iter;
|
||||
return_if_no_layers (image, layers, data);
|
||||
|
||||
gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_ITEM_PROPERTIES,
|
||||
_("Discard Links"));
|
||||
for (iter = layers; iter; iter = iter->next)
|
||||
if (GIMP_IS_LINK_LAYER (iter->data))
|
||||
gimp_link_layer_discard (GIMP_LINK_LAYER (iter->data));
|
||||
gimp_image_undo_group_end (image);
|
||||
}
|
||||
|
||||
void
|
||||
layers_link_monitor_cmd_callback (GimpAction *action,
|
||||
GVariant *value,
|
||||
gpointer data)
|
||||
{
|
||||
GimpImage *image;
|
||||
GList *layers;
|
||||
GList *iter;
|
||||
return_if_no_layers (image, layers, data);
|
||||
|
||||
gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_ITEM_PROPERTIES,
|
||||
_("Monitor Links"));
|
||||
for (iter = layers; iter; iter = iter->next)
|
||||
if (GIMP_IS_LINK_LAYER (iter->data))
|
||||
gimp_link_layer_monitor (GIMP_LINK_LAYER (iter->data));
|
||||
gimp_image_undo_group_end (image);
|
||||
}
|
||||
|
||||
void
|
||||
layers_text_discard_cmd_callback (GimpAction *action,
|
||||
GVariant *value,
|
||||
@@ -2263,6 +2389,9 @@ layers_new_callback (GtkWidget *dialog,
|
||||
GimpLayerCompositeMode layer_composite_mode,
|
||||
gdouble layer_opacity,
|
||||
GimpFillType layer_fill_type,
|
||||
GimpInsertPosition layer_insert_position,
|
||||
GimpInsertGroupPosition layer_insert_group_position,
|
||||
GimpLink *link,
|
||||
gint layer_width,
|
||||
gint layer_height,
|
||||
gint layer_offset_x,
|
||||
@@ -2283,6 +2412,8 @@ layers_new_callback (GtkWidget *dialog,
|
||||
gint n_layers = g_list_length (layers);
|
||||
gboolean run_once = (n_layers == 0);
|
||||
|
||||
g_return_if_fail (link == NULL);
|
||||
|
||||
g_object_set (config,
|
||||
"layer-new-name", layer_name,
|
||||
"layer-new-mode", layer_mode,
|
||||
@@ -2291,6 +2422,8 @@ layers_new_callback (GtkWidget *dialog,
|
||||
"layer-new-composite-mode", layer_composite_mode,
|
||||
"layer-new-opacity", layer_opacity,
|
||||
"layer-new-fill-type", layer_fill_type,
|
||||
"layer-new-insert-position", layer_insert_position,
|
||||
"layer-new-insert-group-position", layer_insert_group_position,
|
||||
NULL);
|
||||
|
||||
layers = g_list_copy (layers);
|
||||
@@ -2307,15 +2440,38 @@ layers_new_callback (GtkWidget *dialog,
|
||||
run_once = FALSE;
|
||||
if (iter)
|
||||
{
|
||||
if (gimp_viewable_get_children (GIMP_VIEWABLE (iter->data)))
|
||||
GimpContainer *container;
|
||||
|
||||
if ((container = gimp_viewable_get_children (GIMP_VIEWABLE (iter->data))))
|
||||
{
|
||||
parent = iter->data;
|
||||
position = 0;
|
||||
if (layer_insert_group_position == GIMP_INSERT_GROUP_TOP ||
|
||||
layer_insert_group_position == GIMP_INSERT_GROUP_BOTTOM)
|
||||
{
|
||||
parent = iter->data;
|
||||
|
||||
if (layer_insert_group_position == GIMP_INSERT_GROUP_TOP)
|
||||
position = 0;
|
||||
else
|
||||
position = gimp_container_get_n_children (container);
|
||||
}
|
||||
else
|
||||
{
|
||||
parent = GIMP_LAYER (gimp_item_get_parent (iter->data));
|
||||
|
||||
if (layer_insert_group_position == GIMP_INSERT_GROUP_ABOVE)
|
||||
position = gimp_item_get_index (iter->data);
|
||||
else
|
||||
position = gimp_item_get_index (iter->data) + 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
parent = GIMP_LAYER (gimp_item_get_parent (iter->data));
|
||||
position = gimp_item_get_index (iter->data);
|
||||
parent = GIMP_LAYER (gimp_item_get_parent (iter->data));
|
||||
|
||||
if (layer_insert_position == GIMP_INSERT_ABOVE)
|
||||
position = gimp_item_get_index (iter->data);
|
||||
else
|
||||
position = gimp_item_get_index (iter->data) + 1;
|
||||
}
|
||||
}
|
||||
else /* run_once */
|
||||
@@ -2379,8 +2535,11 @@ layers_edit_attributes_callback (GtkWidget *dialog,
|
||||
GimpLayerCompositeMode layer_composite_mode,
|
||||
gdouble layer_opacity,
|
||||
GimpFillType unused1,
|
||||
gint unused2,
|
||||
gint unused3,
|
||||
GimpInsertPosition unused2,
|
||||
GimpInsertGroupPosition unused3,
|
||||
GimpLink *link,
|
||||
gint unused4,
|
||||
gint unused5,
|
||||
gint layer_offset_x,
|
||||
gint layer_offset_y,
|
||||
gboolean layer_visible,
|
||||
@@ -2407,7 +2566,8 @@ layers_edit_attributes_callback (GtkWidget *dialog,
|
||||
layer_lock_pixels != gimp_item_get_lock_content (item) ||
|
||||
layer_lock_position != gimp_item_get_lock_position (item) ||
|
||||
layer_lock_visibility != gimp_item_get_lock_visibility (item) ||
|
||||
layer_lock_alpha != gimp_layer_get_lock_alpha (layer))
|
||||
layer_lock_alpha != gimp_layer_get_lock_alpha (layer) ||
|
||||
link)
|
||||
{
|
||||
gimp_image_undo_group_start (image,
|
||||
GIMP_UNDO_GROUP_ITEM_PROPERTIES,
|
||||
@@ -2468,6 +2628,9 @@ layers_edit_attributes_callback (GtkWidget *dialog,
|
||||
if (layer_lock_alpha != gimp_layer_get_lock_alpha (layer))
|
||||
gimp_layer_set_lock_alpha (layer, layer_lock_alpha, TRUE);
|
||||
|
||||
if (GIMP_IS_LINK_LAYER (layer) && link)
|
||||
gimp_link_layer_set_link (GIMP_LINK_LAYER (layer), link, TRUE);
|
||||
|
||||
gimp_image_undo_group_end (image);
|
||||
gimp_image_flush (image);
|
||||
}
|
||||
@@ -2591,6 +2754,56 @@ layers_scale_callback (GtkWidget *dialog,
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
layers_vector_fill_stroke_cmd_callback (GimpAction *action,
|
||||
GVariant *value,
|
||||
gpointer data)
|
||||
{
|
||||
GimpImage *image;
|
||||
GimpLayer *layer;
|
||||
GList *layers;
|
||||
GtkWidget *widget;
|
||||
return_if_no_layers (image, layers, data);
|
||||
return_if_no_widget (widget, data);
|
||||
|
||||
if (g_list_length (layers) != 1)
|
||||
return;
|
||||
|
||||
layer = layers->data;
|
||||
|
||||
if (GIMP_IS_VECTOR_LAYER (layer))
|
||||
{
|
||||
GtkWidget *dialog;
|
||||
|
||||
dialog = vector_layer_options_dialog_new (GIMP_VECTOR_LAYER (layer),
|
||||
action_data_get_context (data),
|
||||
_("Fill / Stroke"),
|
||||
"gimp-vector-layer-stroke",
|
||||
GIMP_HELP_LAYER_VECTOR_FILL_STROKE,
|
||||
widget);
|
||||
gtk_widget_show (dialog);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
layers_vector_discard_cmd_callback (GimpAction *action,
|
||||
GVariant *value,
|
||||
gpointer data)
|
||||
{
|
||||
GimpImage *image;
|
||||
GimpLayer *layer;
|
||||
GList *layers;
|
||||
return_if_no_layers (image, layers, data);
|
||||
|
||||
if (g_list_length (layers) != 1)
|
||||
return;
|
||||
|
||||
layer = layers->data;
|
||||
|
||||
if (GIMP_IS_VECTOR_LAYER (layer))
|
||||
gimp_vector_layer_discard (GIMP_VECTOR_LAYER (layer));
|
||||
}
|
||||
|
||||
static void
|
||||
layers_resize_callback (GtkWidget *dialog,
|
||||
GimpViewable *viewable,
|
||||
|
@@ -24,6 +24,9 @@ void layers_edit_cmd_callback (GimpAction *action,
|
||||
void layers_edit_text_cmd_callback (GimpAction *action,
|
||||
GVariant *value,
|
||||
gpointer data);
|
||||
void layers_edit_vector_cmd_callback (GimpAction *action,
|
||||
GVariant *value,
|
||||
gpointer data);
|
||||
void layers_edit_attributes_cmd_callback (GimpAction *action,
|
||||
GVariant *value,
|
||||
gpointer data);
|
||||
@@ -74,6 +77,12 @@ void layers_merge_group_cmd_callback (GimpAction *action,
|
||||
void layers_delete_cmd_callback (GimpAction *action,
|
||||
GVariant *value,
|
||||
gpointer data);
|
||||
void layers_link_discard_cmd_callback (GimpAction *action,
|
||||
GVariant *value,
|
||||
gpointer data);
|
||||
void layers_link_monitor_cmd_callback (GimpAction *action,
|
||||
GVariant *value,
|
||||
gpointer data);
|
||||
void layers_text_discard_cmd_callback (GimpAction *action,
|
||||
GVariant *value,
|
||||
gpointer data);
|
||||
@@ -83,6 +92,12 @@ void layers_text_to_path_cmd_callback (GimpAction *action,
|
||||
void layers_text_along_path_cmd_callback (GimpAction *action,
|
||||
GVariant *value,
|
||||
gpointer data);
|
||||
void layers_vector_fill_stroke_cmd_callback (GimpAction *action,
|
||||
GVariant *value,
|
||||
gpointer data);
|
||||
void layers_vector_discard_cmd_callback (GimpAction *action,
|
||||
GVariant *value,
|
||||
gpointer data);
|
||||
|
||||
void layers_resize_cmd_callback (GimpAction *action,
|
||||
GVariant *value,
|
||||
|
@@ -149,7 +149,12 @@ static const GimpActionEntry paths_actions[] =
|
||||
{ "paths-import", GIMP_ICON_DOCUMENT_OPEN,
|
||||
NC_("paths-action", "I_mport Path..."), NULL, { NULL }, NULL,
|
||||
paths_import_cmd_callback,
|
||||
GIMP_HELP_PATH_IMPORT }
|
||||
GIMP_HELP_PATH_IMPORT },
|
||||
|
||||
{ "paths-to-vector-layer", NULL,
|
||||
NC_("paths-action", "Path to Vector Layer"), NULL, { NULL }, NULL,
|
||||
path_to_vector_layer_cmd_callback,
|
||||
GIMP_HELP_PATH_TO_VECTOR_LAYER },
|
||||
};
|
||||
|
||||
static const GimpToggleActionEntry paths_toggle_actions[] =
|
||||
@@ -429,6 +434,8 @@ paths_actions_update (GimpActionGroup *group,
|
||||
SET_SENSITIVE ("paths-export", n_selected_paths > 0);
|
||||
SET_SENSITIVE ("paths-import", image);
|
||||
|
||||
SET_SENSITIVE ("paths-to-vector-layer", n_selected_paths == 1);
|
||||
|
||||
SET_SENSITIVE ("paths-selection-to-path", image && !mask_empty);
|
||||
SET_SENSITIVE ("paths-selection-to-path-advanced", image && !mask_empty);
|
||||
SET_SENSITIVE ("paths-fill", n_selected_paths > 0 &&
|
||||
|
@@ -47,6 +47,7 @@
|
||||
#include "path/gimppath.h"
|
||||
#include "path/gimppath-export.h"
|
||||
#include "path/gimppath-import.h"
|
||||
#include "path/gimpvectorlayer.h"
|
||||
|
||||
#include "widgets/gimpaction.h"
|
||||
#include "widgets/gimpclipboard.h"
|
||||
@@ -469,6 +470,7 @@ paths_delete_cmd_callback (GimpAction *action,
|
||||
{
|
||||
GimpImage *image;
|
||||
GList *paths;
|
||||
gboolean attached_to_vector_layer = FALSE;
|
||||
return_if_no_paths (image, paths, data);
|
||||
|
||||
paths = g_list_copy (paths);
|
||||
@@ -478,11 +480,21 @@ paths_delete_cmd_callback (GimpAction *action,
|
||||
_("Remove Paths"));
|
||||
|
||||
for (GList *iter = paths; iter; iter = iter->next)
|
||||
gimp_image_remove_path (image, iter->data, TRUE, NULL);
|
||||
{
|
||||
/* Verify path is not attached to vector layer */
|
||||
if (! gimp_path_attached_to_vector_layer (GIMP_PATH (iter->data), image))
|
||||
gimp_image_remove_path (image, iter->data, TRUE, NULL);
|
||||
else
|
||||
attached_to_vector_layer = TRUE;
|
||||
}
|
||||
|
||||
gimp_image_undo_group_end (image);
|
||||
gimp_image_flush (image);
|
||||
g_list_free (paths);
|
||||
|
||||
if (attached_to_vector_layer)
|
||||
gimp_message_literal (image->gimp, NULL, GIMP_MESSAGE_WARNING,
|
||||
_("Paths attached to vector layers weren't deleted"));
|
||||
}
|
||||
|
||||
void
|
||||
@@ -509,6 +521,28 @@ paths_merge_visible_cmd_callback (GimpAction *action,
|
||||
gimp_image_flush (image);
|
||||
}
|
||||
|
||||
void
|
||||
path_to_vector_layer_cmd_callback (GimpAction *action,
|
||||
GVariant *value,
|
||||
gpointer data)
|
||||
{
|
||||
GimpImage *image;
|
||||
GList *paths;
|
||||
GimpVectorLayer *layer;
|
||||
return_if_no_paths (image, paths, data);
|
||||
|
||||
layer = gimp_vector_layer_new (image, paths->data,
|
||||
gimp_get_user_context (image->gimp));
|
||||
gimp_image_add_layer (image,
|
||||
GIMP_LAYER (layer),
|
||||
GIMP_IMAGE_ACTIVE_PARENT,
|
||||
-1,
|
||||
TRUE);
|
||||
gimp_vector_layer_refresh (layer);
|
||||
|
||||
gimp_image_flush (image);
|
||||
}
|
||||
|
||||
void
|
||||
paths_to_selection_cmd_callback (GimpAction *action,
|
||||
GVariant *value,
|
||||
|
@@ -50,6 +50,9 @@ void paths_duplicate_cmd_callback (GimpAction *action,
|
||||
void paths_delete_cmd_callback (GimpAction *action,
|
||||
GVariant *value,
|
||||
gpointer data);
|
||||
void path_to_vector_layer_cmd_callback (GimpAction *action,
|
||||
GVariant *value,
|
||||
gpointer data);
|
||||
void paths_merge_visible_cmd_callback (GimpAction *action,
|
||||
GVariant *value,
|
||||
gpointer data);
|
||||
|
@@ -61,6 +61,21 @@ static const GimpActionEntry text_tool_actions[] =
|
||||
text_tool_paste_cmd_callback,
|
||||
GIMP_HELP_TEXT_TOOL_PASTE },
|
||||
|
||||
{ "text-tool-toggle-bold", GIMP_ICON_FORMAT_TEXT_BOLD,
|
||||
NC_("text-tool-action", "_Bold"), NULL, { "<primary>B", NULL }, NULL,
|
||||
text_tool_toggle_bold_cmd_callback,
|
||||
NULL },
|
||||
|
||||
{ "text-tool-toggle-italic", GIMP_ICON_FORMAT_TEXT_ITALIC,
|
||||
NC_("text-tool-action", "_Italic"), NULL, { "<primary>I", NULL }, NULL,
|
||||
text_tool_toggle_italic_cmd_callback,
|
||||
NULL },
|
||||
|
||||
{ "text-tool-toggle-underline", GIMP_ICON_FORMAT_TEXT_UNDERLINE,
|
||||
NC_("text-tool-action", "_Underline"), NULL, { "<primary>U", NULL }, NULL,
|
||||
text_tool_toggle_underline_cmd_callback,
|
||||
NULL },
|
||||
|
||||
{ "text-tool-delete", GIMP_ICON_EDIT_DELETE,
|
||||
NC_("text-tool-action", "_Delete"), NULL, { NULL }, NULL,
|
||||
text_tool_delete_cmd_callback,
|
||||
@@ -189,14 +204,17 @@ text_tool_actions_update (GimpActionGroup *group,
|
||||
#define SET_ACTIVE(action,condition) \
|
||||
gimp_action_group_set_action_active (group, action, (condition) != 0)
|
||||
|
||||
SET_SENSITIVE ("text-tool-cut", text_sel);
|
||||
SET_SENSITIVE ("text-tool-copy", text_sel);
|
||||
SET_SENSITIVE ("text-tool-paste", clip);
|
||||
SET_SENSITIVE ("text-tool-delete", text_sel);
|
||||
SET_SENSITIVE ("text-tool-clear", text_layer);
|
||||
SET_SENSITIVE ("text-tool-load", image);
|
||||
SET_SENSITIVE ("text-tool-text-to-path", text_layer);
|
||||
SET_SENSITIVE ("text-tool-text-along-path", text_layer && g_list_length (paths) == 1);
|
||||
SET_SENSITIVE ("text-tool-cut", text_sel);
|
||||
SET_SENSITIVE ("text-tool-copy", text_sel);
|
||||
SET_SENSITIVE ("text-tool-paste", clip);
|
||||
SET_SENSITIVE ("text-tool-toggle-bold", text_sel);
|
||||
SET_SENSITIVE ("text-tool-toggle-italic", text_sel);
|
||||
SET_SENSITIVE ("text-tool-toggle-underline", text_sel);
|
||||
SET_SENSITIVE ("text-tool-delete", text_sel);
|
||||
SET_SENSITIVE ("text-tool-clear", text_layer);
|
||||
SET_SENSITIVE ("text-tool-load", image);
|
||||
SET_SENSITIVE ("text-tool-text-to-path", text_layer);
|
||||
SET_SENSITIVE ("text-tool-text-along-path", text_layer && g_list_length (paths) == 1);
|
||||
|
||||
direction = gimp_text_tool_get_direction (text_tool);
|
||||
for (i = 0; i < G_N_ELEMENTS (text_tool_direction_actions); i++)
|
||||
|
@@ -84,6 +84,36 @@ text_tool_paste_cmd_callback (GimpAction *action,
|
||||
gimp_text_tool_paste_clipboard (text_tool);
|
||||
}
|
||||
|
||||
void
|
||||
text_tool_toggle_bold_cmd_callback (GimpAction *action,
|
||||
GVariant *value,
|
||||
gpointer data)
|
||||
{
|
||||
GimpTextTool *text_tool = GIMP_TEXT_TOOL (data);
|
||||
|
||||
gimp_text_tool_toggle_tag (text_tool, text_tool->buffer->bold_tag);
|
||||
}
|
||||
|
||||
void
|
||||
text_tool_toggle_italic_cmd_callback (GimpAction *action,
|
||||
GVariant *value,
|
||||
gpointer data)
|
||||
{
|
||||
GimpTextTool *text_tool = GIMP_TEXT_TOOL (data);
|
||||
|
||||
gimp_text_tool_toggle_tag (text_tool, text_tool->buffer->italic_tag);
|
||||
}
|
||||
|
||||
void
|
||||
text_tool_toggle_underline_cmd_callback (GimpAction *action,
|
||||
GVariant *value,
|
||||
gpointer data)
|
||||
{
|
||||
GimpTextTool *text_tool = GIMP_TEXT_TOOL (data);
|
||||
|
||||
gimp_text_tool_toggle_tag (text_tool, text_tool->buffer->underline_tag);
|
||||
}
|
||||
|
||||
void
|
||||
text_tool_delete_cmd_callback (GimpAction *action,
|
||||
GVariant *value,
|
||||
|
@@ -27,6 +27,16 @@ void text_tool_copy_cmd_callback (GimpAction *action,
|
||||
void text_tool_paste_cmd_callback (GimpAction *action,
|
||||
GVariant *value,
|
||||
gpointer data);
|
||||
void text_tool_toggle_bold_cmd_callback (GimpAction *action,
|
||||
GVariant *value,
|
||||
gpointer data);
|
||||
void text_tool_toggle_italic_cmd_callback (GimpAction *action,
|
||||
GVariant *value,
|
||||
gpointer data);
|
||||
void text_tool_toggle_underline_cmd_callback
|
||||
(GimpAction *action,
|
||||
GVariant *value,
|
||||
gpointer data);
|
||||
void text_tool_delete_cmd_callback (GimpAction *action,
|
||||
GVariant *value,
|
||||
gpointer data);
|
||||
|
@@ -420,6 +420,68 @@ gimp_theme_scheme_get_type (void)
|
||||
return type;
|
||||
}
|
||||
|
||||
GType
|
||||
gimp_insert_position_get_type (void)
|
||||
{
|
||||
static const GEnumValue values[] =
|
||||
{
|
||||
{ GIMP_INSERT_ABOVE, "GIMP_INSERT_ABOVE", "above" },
|
||||
{ GIMP_INSERT_BELOW, "GIMP_INSERT_BELOW", "below" },
|
||||
{ 0, NULL, NULL }
|
||||
};
|
||||
|
||||
static const GimpEnumDesc descs[] =
|
||||
{
|
||||
{ GIMP_INSERT_ABOVE, NC_("insert-position", "Above selected"), NULL },
|
||||
{ GIMP_INSERT_BELOW, NC_("insert-position", "Below selected"), NULL },
|
||||
{ 0, NULL, NULL }
|
||||
};
|
||||
|
||||
static GType type = 0;
|
||||
|
||||
if (G_UNLIKELY (! type))
|
||||
{
|
||||
type = g_enum_register_static ("GimpInsertPosition", values);
|
||||
gimp_type_set_translation_context (type, "insert-position");
|
||||
gimp_enum_set_value_descriptions (type, descs);
|
||||
}
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
GType
|
||||
gimp_insert_group_position_get_type (void)
|
||||
{
|
||||
static const GEnumValue values[] =
|
||||
{
|
||||
{ GIMP_INSERT_GROUP_TOP, "GIMP_INSERT_GROUP_TOP", "top" },
|
||||
{ GIMP_INSERT_GROUP_BOTTOM, "GIMP_INSERT_GROUP_BOTTOM", "bottom" },
|
||||
{ GIMP_INSERT_GROUP_ABOVE, "GIMP_INSERT_GROUP_ABOVE", "above" },
|
||||
{ GIMP_INSERT_GROUP_BELOW, "GIMP_INSERT_GROUP_BELOW", "below" },
|
||||
{ 0, NULL, NULL }
|
||||
};
|
||||
|
||||
static const GimpEnumDesc descs[] =
|
||||
{
|
||||
{ GIMP_INSERT_GROUP_TOP, NC_("insert-group-position", "As top child"), NULL },
|
||||
{ GIMP_INSERT_GROUP_BOTTOM, NC_("insert-group-position", "As bottom child"), NULL },
|
||||
{ GIMP_INSERT_GROUP_ABOVE, NC_("insert-group-position", "Above the group"), NULL },
|
||||
{ GIMP_INSERT_GROUP_BELOW, NC_("insert-group-position", "Below the group"), NULL },
|
||||
{ 0, NULL, NULL }
|
||||
};
|
||||
|
||||
static GType type = 0;
|
||||
|
||||
if (G_UNLIKELY (! type))
|
||||
{
|
||||
type = g_enum_register_static ("GimpInsertGroupPosition", values);
|
||||
gimp_type_set_translation_context (type, "insert-group-position");
|
||||
gimp_enum_set_value_descriptions (type, descs);
|
||||
}
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
|
||||
/* Generated data ends here */
|
||||
|
||||
|
@@ -174,3 +174,41 @@ typedef enum
|
||||
GIMP_THEME_DARK, /*< desc="Dark Colors" >*/
|
||||
GIMP_THEME_SYSTEM, /*< desc="System Colors" >*/
|
||||
} GimpThemeScheme;
|
||||
|
||||
/**
|
||||
* GimpInsertPosition:
|
||||
* @GIMP_INSERT_ABOVE: Insert above selected item
|
||||
* @GIMP_INSERT_BELOW: Insert below selected item
|
||||
*
|
||||
* Position for item insertion.
|
||||
**/
|
||||
#define GIMP_TYPE_INSERT_POSITION (gimp_insert_position_get_type ())
|
||||
|
||||
GType gimp_insert_position_get_type (void) G_GNUC_CONST;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
GIMP_INSERT_ABOVE, /*< desc="Above selected" >*/
|
||||
GIMP_INSERT_BELOW, /*< desc="Below selected" >*/
|
||||
} GimpInsertPosition;
|
||||
|
||||
/**
|
||||
* GimpInsertGroupPosition:
|
||||
* @GIMP_INSERT_GROUP_TOP: Insert as top child
|
||||
* @GIMP_INSERT_GROUP_BOTTOM: Insert as bottom child
|
||||
* @GIMP_INSERT_GROUP_ABOVE: Insert above selected group
|
||||
* @GIMP_INSERT_GROUP_BELOW: Insert below selected group
|
||||
*
|
||||
* Position for item insertion in an item group.
|
||||
**/
|
||||
#define GIMP_TYPE_INSERT_GROUP_POSITION (gimp_insert_group_position_get_type ())
|
||||
|
||||
GType gimp_insert_group_position_get_type (void) G_GNUC_CONST;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
GIMP_INSERT_GROUP_TOP, /*< desc="As top child" >*/
|
||||
GIMP_INSERT_GROUP_BOTTOM, /*< desc="As bottom child" >*/
|
||||
GIMP_INSERT_GROUP_ABOVE, /*< desc="Above the group" >*/
|
||||
GIMP_INSERT_GROUP_BELOW, /*< desc="Below the group" >*/
|
||||
} GimpInsertGroupPosition;
|
||||
|
@@ -76,6 +76,8 @@ enum
|
||||
PROP_LAYER_NEW_COMPOSITE_MODE,
|
||||
PROP_LAYER_NEW_OPACITY,
|
||||
PROP_LAYER_NEW_FILL_TYPE,
|
||||
PROP_LAYER_NEW_INSERT_POSITION,
|
||||
PROP_LAYER_NEW_INSERT_GROUP_POSITION,
|
||||
|
||||
PROP_LAYER_RESIZE_FILL_TYPE,
|
||||
|
||||
@@ -366,6 +368,22 @@ gimp_dialog_config_class_init (GimpDialogConfigClass *klass)
|
||||
GIMP_FILL_TRANSPARENT,
|
||||
GIMP_PARAM_STATIC_STRINGS);
|
||||
|
||||
GIMP_CONFIG_PROP_ENUM (object_class, PROP_LAYER_NEW_INSERT_POSITION,
|
||||
"layer-new-insert-position",
|
||||
"Default new layer position",
|
||||
LAYER_NEW_INSERT_POSITION_BLURB,
|
||||
GIMP_TYPE_INSERT_POSITION,
|
||||
GIMP_INSERT_ABOVE,
|
||||
GIMP_PARAM_STATIC_STRINGS);
|
||||
|
||||
GIMP_CONFIG_PROP_ENUM (object_class, PROP_LAYER_NEW_INSERT_GROUP_POSITION,
|
||||
"layer-new-insert-group-position",
|
||||
"Default new layer position in group",
|
||||
LAYER_NEW_INSERT_GROUP_POSITION_BLURB,
|
||||
GIMP_TYPE_INSERT_GROUP_POSITION,
|
||||
GIMP_INSERT_GROUP_TOP,
|
||||
GIMP_PARAM_STATIC_STRINGS);
|
||||
|
||||
GIMP_CONFIG_PROP_ENUM (object_class, PROP_LAYER_RESIZE_FILL_TYPE,
|
||||
"layer-resize-fill-type",
|
||||
"Default layer resize fill type",
|
||||
@@ -705,6 +723,12 @@ gimp_dialog_config_set_property (GObject *object,
|
||||
case PROP_LAYER_NEW_FILL_TYPE:
|
||||
config->layer_new_fill_type = g_value_get_enum (value);
|
||||
break;
|
||||
case PROP_LAYER_NEW_INSERT_POSITION:
|
||||
config->layer_new_insert_position = g_value_get_enum (value);
|
||||
break;
|
||||
case PROP_LAYER_NEW_INSERT_GROUP_POSITION:
|
||||
config->layer_new_insert_group_position = g_value_get_enum (value);
|
||||
break;
|
||||
|
||||
case PROP_LAYER_RESIZE_FILL_TYPE:
|
||||
config->layer_resize_fill_type = g_value_get_enum (value);
|
||||
@@ -897,6 +921,12 @@ gimp_dialog_config_get_property (GObject *object,
|
||||
case PROP_LAYER_NEW_FILL_TYPE:
|
||||
g_value_set_enum (value, config->layer_new_fill_type);
|
||||
break;
|
||||
case PROP_LAYER_NEW_INSERT_POSITION:
|
||||
g_value_set_enum (value, config->layer_new_insert_position);
|
||||
break;
|
||||
case PROP_LAYER_NEW_INSERT_GROUP_POSITION:
|
||||
g_value_set_enum (value, config->layer_new_insert_group_position);
|
||||
break;
|
||||
|
||||
case PROP_LAYER_RESIZE_FILL_TYPE:
|
||||
g_value_set_enum (value, config->layer_resize_fill_type);
|
||||
|
@@ -73,6 +73,8 @@ struct _GimpDialogConfig
|
||||
GimpLayerCompositeMode layer_new_composite_mode;
|
||||
gdouble layer_new_opacity;
|
||||
GimpFillType layer_new_fill_type;
|
||||
GimpInsertPosition layer_new_insert_position;
|
||||
GimpInsertGroupPosition layer_new_insert_group_position;
|
||||
|
||||
GimpFillType layer_resize_fill_type;
|
||||
|
||||
|
@@ -650,6 +650,12 @@ _("Sets the default opacity for the 'New Layer' dialog.")
|
||||
#define LAYER_NEW_FILL_TYPE_BLURB \
|
||||
_("Sets the default fill type for the 'New Layer' dialog.")
|
||||
|
||||
#define LAYER_NEW_INSERT_POSITION_BLURB \
|
||||
_("Sets the default insert position for the 'New Layer' dialog.")
|
||||
|
||||
#define LAYER_NEW_INSERT_GROUP_POSITION_BLURB \
|
||||
_("Sets the default insert position in layer groups for the 'New Layer' dialog.")
|
||||
|
||||
#define LAYER_RESIZE_FILL_TYPE_BLURB \
|
||||
_("Sets the default fill type for the 'Layer Boundary Size' dialog.")
|
||||
|
||||
|
@@ -1257,6 +1257,7 @@ gimp_undo_type_get_type (void)
|
||||
{ GIMP_UNDO_LAYER_MODE, "GIMP_UNDO_LAYER_MODE", "layer-mode" },
|
||||
{ GIMP_UNDO_LAYER_OPACITY, "GIMP_UNDO_LAYER_OPACITY", "layer-opacity" },
|
||||
{ GIMP_UNDO_LAYER_LOCK_ALPHA, "GIMP_UNDO_LAYER_LOCK_ALPHA", "layer-lock-alpha" },
|
||||
{ GIMP_UNDO_LINK_LAYER, "GIMP_UNDO_LINK_LAYER", "link-layer" },
|
||||
{ GIMP_UNDO_GROUP_LAYER_SUSPEND_RESIZE, "GIMP_UNDO_GROUP_LAYER_SUSPEND_RESIZE", "group-layer-suspend-resize" },
|
||||
{ GIMP_UNDO_GROUP_LAYER_RESUME_RESIZE, "GIMP_UNDO_GROUP_LAYER_RESUME_RESIZE", "group-layer-resume-resize" },
|
||||
{ GIMP_UNDO_GROUP_LAYER_SUSPEND_MASK, "GIMP_UNDO_GROUP_LAYER_SUSPEND_MASK", "group-layer-suspend-mask" },
|
||||
@@ -1267,6 +1268,8 @@ gimp_undo_type_get_type (void)
|
||||
{ GIMP_UNDO_TEXT_LAYER, "GIMP_UNDO_TEXT_LAYER", "text-layer" },
|
||||
{ GIMP_UNDO_TEXT_LAYER_MODIFIED, "GIMP_UNDO_TEXT_LAYER_MODIFIED", "text-layer-modified" },
|
||||
{ GIMP_UNDO_TEXT_LAYER_CONVERT, "GIMP_UNDO_TEXT_LAYER_CONVERT", "text-layer-convert" },
|
||||
{ GIMP_UNDO_VECTOR_LAYER, "GIMP_UNDO_VECTOR_LAYER", "vector-layer" },
|
||||
{ GIMP_UNDO_VECTOR_LAYER_MODIFIED, "GIMP_UNDO_VECTOR_LAYER_MODIFIED", "vector-layer-modified" },
|
||||
{ GIMP_UNDO_LAYER_MASK_ADD, "GIMP_UNDO_LAYER_MASK_ADD", "layer-mask-add" },
|
||||
{ GIMP_UNDO_LAYER_MASK_REMOVE, "GIMP_UNDO_LAYER_MASK_REMOVE", "layer-mask-remove" },
|
||||
{ GIMP_UNDO_LAYER_MASK_APPLY, "GIMP_UNDO_LAYER_MASK_APPLY", "layer-mask-apply" },
|
||||
@@ -1370,6 +1373,7 @@ gimp_undo_type_get_type (void)
|
||||
{ GIMP_UNDO_LAYER_MODE, NC_("undo-type", "Set layer mode"), NULL },
|
||||
{ GIMP_UNDO_LAYER_OPACITY, NC_("undo-type", "Set layer opacity"), NULL },
|
||||
{ GIMP_UNDO_LAYER_LOCK_ALPHA, NC_("undo-type", "Lock/Unlock alpha channel"), NULL },
|
||||
{ GIMP_UNDO_LINK_LAYER, NC_("undo-type", "Link layer"), NULL },
|
||||
{ GIMP_UNDO_GROUP_LAYER_SUSPEND_RESIZE, NC_("undo-type", "Suspend group layer resize"), NULL },
|
||||
{ GIMP_UNDO_GROUP_LAYER_RESUME_RESIZE, NC_("undo-type", "Resume group layer resize"), NULL },
|
||||
{ GIMP_UNDO_GROUP_LAYER_SUSPEND_MASK, NC_("undo-type", "Suspend group layer mask"), NULL },
|
||||
@@ -1380,6 +1384,8 @@ gimp_undo_type_get_type (void)
|
||||
{ GIMP_UNDO_TEXT_LAYER, NC_("undo-type", "Text layer"), NULL },
|
||||
{ GIMP_UNDO_TEXT_LAYER_MODIFIED, NC_("undo-type", "Text layer modification"), NULL },
|
||||
{ GIMP_UNDO_TEXT_LAYER_CONVERT, NC_("undo-type", "Convert text layer"), NULL },
|
||||
{ GIMP_UNDO_VECTOR_LAYER, NC_("undo-type", "Vector layer"), NULL },
|
||||
{ GIMP_UNDO_VECTOR_LAYER_MODIFIED, NC_("undo-type", "Vector layer modification"), NULL },
|
||||
{ GIMP_UNDO_LAYER_MASK_ADD, NC_("undo-type", "Add layer masks"), NULL },
|
||||
{ GIMP_UNDO_LAYER_MASK_REMOVE, NC_("undo-type", "Delete layer masks"), NULL },
|
||||
{ GIMP_UNDO_LAYER_MASK_APPLY, NC_("undo-type", "Apply layer masks"), NULL },
|
||||
|
@@ -609,6 +609,7 @@ typedef enum /*< pdb-skip >*/
|
||||
GIMP_UNDO_LAYER_MODE, /*< desc="Set layer mode" >*/
|
||||
GIMP_UNDO_LAYER_OPACITY, /*< desc="Set layer opacity" >*/
|
||||
GIMP_UNDO_LAYER_LOCK_ALPHA, /*< desc="Lock/Unlock alpha channel" >*/
|
||||
GIMP_UNDO_LINK_LAYER, /*< desc="Link layer" >*/
|
||||
GIMP_UNDO_GROUP_LAYER_SUSPEND_RESIZE, /*< desc="Suspend group layer resize" >*/
|
||||
GIMP_UNDO_GROUP_LAYER_RESUME_RESIZE, /*< desc="Resume group layer resize" >*/
|
||||
GIMP_UNDO_GROUP_LAYER_SUSPEND_MASK, /*< desc="Suspend group layer mask" >*/
|
||||
@@ -619,6 +620,8 @@ typedef enum /*< pdb-skip >*/
|
||||
GIMP_UNDO_TEXT_LAYER, /*< desc="Text layer" >*/
|
||||
GIMP_UNDO_TEXT_LAYER_MODIFIED, /*< desc="Text layer modification" >*/
|
||||
GIMP_UNDO_TEXT_LAYER_CONVERT, /*< desc="Convert text layer" >*/
|
||||
GIMP_UNDO_VECTOR_LAYER, /*< desc="Vector layer" >*/
|
||||
GIMP_UNDO_VECTOR_LAYER_MODIFIED, /*< desc="Vector layer modification" >*/
|
||||
GIMP_UNDO_LAYER_MASK_ADD, /*< desc="Add layer masks" >*/
|
||||
GIMP_UNDO_LAYER_MASK_REMOVE, /*< desc="Delete layer masks" >*/
|
||||
GIMP_UNDO_LAYER_MASK_APPLY, /*< desc="Apply layer masks" >*/
|
||||
|
@@ -90,6 +90,7 @@ typedef struct _GimpViewable GimpViewable;
|
||||
typedef struct _GimpFilter GimpFilter;
|
||||
typedef struct _GimpItem GimpItem;
|
||||
typedef struct _GimpAuxItem GimpAuxItem;
|
||||
typedef struct _GimpLink GimpLink;
|
||||
|
||||
typedef struct _Gimp Gimp;
|
||||
typedef struct _GimpImage GimpImage;
|
||||
@@ -167,6 +168,7 @@ typedef struct _GimpLayerMask GimpLayerMask;
|
||||
typedef struct _GimpSelection GimpSelection;
|
||||
typedef struct _GimpLayer GimpLayer;
|
||||
typedef struct _GimpGroupLayer GimpGroupLayer;
|
||||
typedef struct _GimpLinkLayer GimpLinkLayer;
|
||||
|
||||
|
||||
/* auxiliary image items */
|
||||
|
@@ -224,18 +224,14 @@ gimp_user_install_run (GimpUserInstall *install,
|
||||
|
||||
if (install->migrate)
|
||||
{
|
||||
gchar *verstring;
|
||||
|
||||
/* TODO: these 2 strings should be merged into one, but it was not
|
||||
* possible to do it at implementation time, in order not to break
|
||||
* string freeze.
|
||||
*/
|
||||
verstring = g_strdup_printf ("%d.%d", install->old_major, install->old_minor);
|
||||
user_install_log (install,
|
||||
_("It seems you have used GIMP %s before. "
|
||||
/* TRANSLATORS: the %d.%d replacement strings
|
||||
* will be a series version (e.g. 2.10). The %s
|
||||
* replacement will be a directory.
|
||||
*/
|
||||
_("It seems you have used GIMP %d.%d before. "
|
||||
"GIMP will now migrate your user settings to '%s'."),
|
||||
verstring, dirname);
|
||||
g_free (verstring);
|
||||
install->old_major, install->old_minor, dirname);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@@ -55,6 +55,7 @@
|
||||
#include "gimp-units.h"
|
||||
#include "gimp-utils.h"
|
||||
#include "gimpbrush.h"
|
||||
#include "gimpbrushgenerated.h"
|
||||
#include "gimpbuffer.h"
|
||||
#include "gimpcontext.h"
|
||||
#include "gimpdynamics.h"
|
||||
@@ -75,6 +76,8 @@
|
||||
#include "gimptoolinfo.h"
|
||||
#include "gimptreeproxy.h"
|
||||
|
||||
#include "text/gimpfont.h"
|
||||
|
||||
#include "gimp-intl.h"
|
||||
|
||||
|
||||
@@ -1269,6 +1272,34 @@ gimp_get_temp_file (Gimp *gimp,
|
||||
return file;
|
||||
}
|
||||
|
||||
GimpDataFactory *
|
||||
gimp_get_data_factory (Gimp *gimp,
|
||||
GType data_type)
|
||||
{
|
||||
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
|
||||
g_return_val_if_fail (g_type_is_a (data_type, GIMP_TYPE_DATA), NULL);
|
||||
|
||||
if (g_type_is_a (data_type, GIMP_TYPE_BRUSH_GENERATED))
|
||||
return gimp->brush_factory;
|
||||
else if (g_type_is_a (data_type, GIMP_TYPE_BRUSH))
|
||||
return gimp->brush_factory;
|
||||
else if (g_type_is_a (data_type, GIMP_TYPE_PATTERN))
|
||||
return gimp->pattern_factory;
|
||||
else if (g_type_is_a (data_type, GIMP_TYPE_GRADIENT))
|
||||
return gimp->gradient_factory;
|
||||
else if (g_type_is_a (data_type, GIMP_TYPE_PALETTE))
|
||||
return gimp->palette_factory;
|
||||
else if (g_type_is_a (data_type, GIMP_TYPE_FONT))
|
||||
return gimp->font_factory;
|
||||
else if (g_type_is_a (data_type, GIMP_TYPE_DYNAMICS))
|
||||
return gimp->dynamics_factory;
|
||||
else if (g_type_is_a (data_type, GIMP_TYPE_MYBRUSH))
|
||||
return gimp->mybrush_factory;
|
||||
|
||||
/* If we reach this, it means we forgot a data factory in our list! */
|
||||
g_return_val_if_reached (NULL);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gimp_exit_idle_cleanup_stray_images (Gimp *gimp)
|
||||
{
|
||||
|
@@ -251,3 +251,7 @@ void gimp_image_opened (Gimp *gimp,
|
||||
|
||||
GFile * gimp_get_temp_file (Gimp *gimp,
|
||||
const gchar *extension);
|
||||
|
||||
GimpDataFactory *
|
||||
gimp_get_data_factory (Gimp *gimp,
|
||||
GType data_type);
|
||||
|
@@ -80,8 +80,7 @@ static GimpTempBuf * gimp_brush_get_new_preview (GimpViewable *vie
|
||||
GimpContext *context,
|
||||
gint width,
|
||||
gint height,
|
||||
GeglColor *color,
|
||||
GeglColor *background);
|
||||
GeglColor *fg_color);
|
||||
static gchar * gimp_brush_get_description (GimpViewable *viewable,
|
||||
gchar **tooltip);
|
||||
|
||||
@@ -276,8 +275,7 @@ gimp_brush_get_new_preview (GimpViewable *viewable,
|
||||
GimpContext *context,
|
||||
gint width,
|
||||
gint height,
|
||||
GeglColor *color,
|
||||
GeglColor *background)
|
||||
GeglColor *fg_color)
|
||||
{
|
||||
GimpBrush *brush = GIMP_BRUSH (viewable);
|
||||
const GimpTempBuf *mask_buf = brush->priv->mask;
|
||||
@@ -373,10 +371,10 @@ gimp_brush_get_new_preview (GimpViewable *viewable,
|
||||
}
|
||||
else
|
||||
{
|
||||
guint8 rgb[3] = {0, 0, 0};
|
||||
guint8 rgb[3] = { 0, 0, 0 };
|
||||
|
||||
if (color != NULL)
|
||||
gegl_color_get_pixel (color, babl_format ("R'G'B' u8"), rgb);
|
||||
if (fg_color)
|
||||
gegl_color_get_pixel (fg_color, babl_format ("R'G'B' u8"), rgb);
|
||||
|
||||
for (y = 0; y < mask_height; y++)
|
||||
{
|
||||
|
@@ -351,8 +351,10 @@ gimp_brush_pipe_set_params (GimpBrushPipe *pipe,
|
||||
{
|
||||
GimpPixPipeParams params;
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
gimp_pixpipe_params_init (¶ms);
|
||||
gimp_pixpipe_params_parse (paramstring, ¶ms);
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
|
||||
pipe->dimension = params.dim;
|
||||
pipe->rank = g_new0 (gint, pipe->dimension);
|
||||
@@ -384,7 +386,9 @@ gimp_brush_pipe_set_params (GimpBrushPipe *pipe,
|
||||
pipe->index[i] = 0;
|
||||
}
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
gimp_pixpipe_params_free (¶ms);
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
|
||||
pipe->params = g_strdup (paramstring);
|
||||
}
|
||||
|
@@ -64,14 +64,12 @@ static GimpTempBuf * gimp_buffer_get_new_preview (GimpViewable *viewable,
|
||||
GimpContext *context,
|
||||
gint width,
|
||||
gint height,
|
||||
GeglColor *color,
|
||||
GeglColor *background);
|
||||
GeglColor *fg_color);
|
||||
static GdkPixbuf * gimp_buffer_get_new_pixbuf (GimpViewable *viewable,
|
||||
GimpContext *context,
|
||||
gint width,
|
||||
gint height,
|
||||
GeglColor *color,
|
||||
GeglColor *background);
|
||||
GeglColor *fg_color);
|
||||
static gchar * gimp_buffer_get_description (GimpViewable *viewable,
|
||||
gchar **tooltip);
|
||||
|
||||
@@ -232,8 +230,7 @@ gimp_buffer_get_new_preview (GimpViewable *viewable,
|
||||
GimpContext *context,
|
||||
gint width,
|
||||
gint height,
|
||||
GeglColor *color G_GNUC_UNUSED,
|
||||
GeglColor *background G_GNUC_UNUSED)
|
||||
GeglColor *fg_color G_GNUC_UNUSED)
|
||||
{
|
||||
GimpBuffer *buffer = GIMP_BUFFER (viewable);
|
||||
const Babl *format = gimp_buffer_get_format (buffer);
|
||||
@@ -268,8 +265,7 @@ gimp_buffer_get_new_pixbuf (GimpViewable *viewable,
|
||||
GimpContext *context,
|
||||
gint width,
|
||||
gint height,
|
||||
GeglColor *color G_GNUC_UNUSED,
|
||||
GeglColor *background G_GNUC_UNUSED)
|
||||
GeglColor *fg_color G_GNUC_UNUSED)
|
||||
{
|
||||
GimpBuffer *buffer = GIMP_BUFFER (viewable);
|
||||
GdkPixbuf *pixbuf;
|
||||
|
@@ -87,8 +87,7 @@ static GimpTempBuf * gimp_curve_get_new_preview (GimpViewable *viewable,
|
||||
GimpContext *context,
|
||||
gint width,
|
||||
gint height,
|
||||
GeglColor *color,
|
||||
GeglColor *background);
|
||||
GeglColor *fg_color);
|
||||
static gchar * gimp_curve_get_description (GimpViewable *viewable,
|
||||
gchar **tooltip);
|
||||
|
||||
@@ -524,8 +523,7 @@ gimp_curve_get_new_preview (GimpViewable *viewable,
|
||||
GimpContext *context,
|
||||
gint width,
|
||||
gint height,
|
||||
GeglColor *color G_GNUC_UNUSED,
|
||||
GeglColor *background G_GNUC_UNUSED)
|
||||
GeglColor *fg_color G_GNUC_UNUSED)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
@@ -77,6 +77,14 @@ struct _GimpDataFactoryPrivate
|
||||
GimpAsyncSet *async_set;
|
||||
};
|
||||
|
||||
typedef struct
|
||||
{
|
||||
const gchar *name;
|
||||
const gchar *collection;
|
||||
gboolean is_internal;
|
||||
} SearchData;
|
||||
|
||||
|
||||
#define GET_PRIVATE(obj) (((GimpDataFactory *) (obj))->priv)
|
||||
|
||||
|
||||
@@ -109,6 +117,9 @@ static void gimp_data_factory_path_notify (GObject *ob
|
||||
static GFile * gimp_data_factory_get_save_dir (GimpDataFactory *factory,
|
||||
GError **error);
|
||||
|
||||
static gboolean gimp_data_factory_search_in_container (GimpData *data,
|
||||
SearchData *search_data);
|
||||
|
||||
|
||||
G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (GimpDataFactory, gimp_data_factory,
|
||||
GIMP_TYPE_OBJECT)
|
||||
@@ -650,6 +661,47 @@ gimp_data_factory_data_cancel (GimpDataFactory *factory)
|
||||
GIMP_DATA_FACTORY_GET_CLASS (factory)->data_cancel (factory);
|
||||
}
|
||||
|
||||
GimpData *
|
||||
gimp_data_factory_get_data (GimpDataFactory *factory,
|
||||
const gchar *name,
|
||||
const gchar *collection,
|
||||
gboolean is_internal)
|
||||
{
|
||||
GimpContainer *container;
|
||||
GimpObject *data;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_DATA_FACTORY (factory), NULL);
|
||||
|
||||
container = gimp_data_factory_get_container (factory);
|
||||
|
||||
if (collection == NULL)
|
||||
{
|
||||
data = gimp_container_get_child_by_name (container, name);
|
||||
}
|
||||
else
|
||||
{
|
||||
SearchData *search_data = g_new (SearchData, 1);
|
||||
|
||||
search_data->name = name;
|
||||
search_data->collection = collection;
|
||||
search_data->is_internal = is_internal;
|
||||
data = gimp_container_search (container,
|
||||
(GimpContainerSearchFunc) gimp_data_factory_search_in_container,
|
||||
search_data);
|
||||
g_free (search_data);
|
||||
}
|
||||
|
||||
if (! data)
|
||||
data = gimp_container_get_child_by_name (gimp_data_factory_get_container_obsolete (factory),
|
||||
name);
|
||||
|
||||
if (! data && ! strcmp (name, "Standard"))
|
||||
data = (GimpObject *) gimp_data_factory_data_get_standard (factory,
|
||||
gimp_get_user_context (factory->priv->gimp));
|
||||
|
||||
return (GimpData *) data;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gimp_data_factory_has_data_new_func (GimpDataFactory *factory)
|
||||
{
|
||||
@@ -1038,3 +1090,10 @@ gimp_data_factory_get_save_dir (GimpDataFactory *factory,
|
||||
|
||||
return writable_dir;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gimp_data_factory_search_in_container (GimpData *data,
|
||||
SearchData *search_data)
|
||||
{
|
||||
return gimp_data_identify (data, search_data->name, search_data->collection, search_data->is_internal);
|
||||
}
|
||||
|
@@ -87,6 +87,11 @@ GimpAsyncSet * gimp_data_factory_get_async_set (GimpDataFactory *factory);
|
||||
gboolean gimp_data_factory_data_wait (GimpDataFactory *factory);
|
||||
void gimp_data_factory_data_cancel (GimpDataFactory *factory);
|
||||
|
||||
GimpData * gimp_data_factory_get_data (GimpDataFactory *factory,
|
||||
const gchar *name,
|
||||
const gchar *collection,
|
||||
gboolean is_internal);
|
||||
|
||||
gboolean gimp_data_factory_has_data_new_func (GimpDataFactory *factory);
|
||||
GimpData * gimp_data_factory_data_new (GimpDataFactory *factory,
|
||||
GimpContext *context,
|
||||
|
@@ -113,8 +113,7 @@ gimp_drawable_get_new_preview (GimpViewable *viewable,
|
||||
GimpContext *context,
|
||||
gint width,
|
||||
gint height,
|
||||
GeglColor *color G_GNUC_UNUSED,
|
||||
GeglColor *background G_GNUC_UNUSED)
|
||||
GeglColor *fg_color G_GNUC_UNUSED)
|
||||
{
|
||||
GimpItem *item = GIMP_ITEM (viewable);
|
||||
GimpImage *image = gimp_item_get_image (item);
|
||||
@@ -135,8 +134,7 @@ gimp_drawable_get_new_pixbuf (GimpViewable *viewable,
|
||||
GimpContext *context,
|
||||
gint width,
|
||||
gint height,
|
||||
GeglColor *color G_GNUC_UNUSED,
|
||||
GeglColor *background G_GNUC_UNUSED)
|
||||
GeglColor *fg_color G_GNUC_UNUSED)
|
||||
{
|
||||
GimpItem *item = GIMP_ITEM (viewable);
|
||||
GimpImage *image = gimp_item_get_image (item);
|
||||
|
@@ -25,14 +25,12 @@ GimpTempBuf * gimp_drawable_get_new_preview (GimpViewable *viewable,
|
||||
GimpContext *context,
|
||||
gint width,
|
||||
gint height,
|
||||
GeglColor *color,
|
||||
GeglColor *background);
|
||||
GeglColor *fg_color);
|
||||
GdkPixbuf * gimp_drawable_get_new_pixbuf (GimpViewable *viewable,
|
||||
GimpContext *context,
|
||||
gint width,
|
||||
gint height,
|
||||
GeglColor *color,
|
||||
GeglColor *background);
|
||||
GeglColor *fg_color);
|
||||
|
||||
/*
|
||||
* normal functions (no virtuals)
|
||||
|
@@ -766,7 +766,7 @@ gimp_drawable_transform_affine (GimpDrawable *drawable,
|
||||
{
|
||||
result = gimp_drawable_transform_paste (drawable, new_buffer, profile,
|
||||
new_offset_x, new_offset_y,
|
||||
new_layer);
|
||||
new_layer, TRUE);
|
||||
g_object_unref (new_buffer);
|
||||
}
|
||||
}
|
||||
@@ -848,7 +848,7 @@ gimp_drawable_transform_flip (GimpDrawable *drawable,
|
||||
{
|
||||
result = gimp_drawable_transform_paste (drawable, new_buffer, profile,
|
||||
new_offset_x, new_offset_y,
|
||||
new_layer);
|
||||
new_layer, TRUE);
|
||||
g_object_unref (new_buffer);
|
||||
}
|
||||
}
|
||||
@@ -933,7 +933,7 @@ gimp_drawable_transform_rotate (GimpDrawable *drawable,
|
||||
{
|
||||
result = gimp_drawable_transform_paste (drawable, new_buffer, profile,
|
||||
new_offset_x, new_offset_y,
|
||||
new_layer);
|
||||
new_layer, TRUE);
|
||||
g_object_unref (new_buffer);
|
||||
}
|
||||
}
|
||||
@@ -1026,11 +1026,11 @@ gimp_drawable_transform_paste (GimpDrawable *drawable,
|
||||
GimpColorProfile *buffer_profile,
|
||||
gint offset_x,
|
||||
gint offset_y,
|
||||
gboolean new_layer)
|
||||
gboolean new_layer,
|
||||
gboolean push_undo)
|
||||
{
|
||||
GimpImage *image;
|
||||
GimpLayer *layer = NULL;
|
||||
const gchar *undo_desc = NULL;
|
||||
GimpImage *image;
|
||||
GimpLayer *layer = NULL;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), NULL);
|
||||
g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (drawable)), NULL);
|
||||
@@ -1039,14 +1039,19 @@ gimp_drawable_transform_paste (GimpDrawable *drawable,
|
||||
|
||||
image = gimp_item_get_image (GIMP_ITEM (drawable));
|
||||
|
||||
if (GIMP_IS_LAYER (drawable))
|
||||
undo_desc = C_("undo-type", "Transform Layer");
|
||||
else if (GIMP_IS_CHANNEL (drawable))
|
||||
undo_desc = C_("undo-type", "Transform Channel");
|
||||
else
|
||||
return NULL;
|
||||
if (push_undo)
|
||||
{
|
||||
const gchar *undo_desc = NULL;
|
||||
|
||||
gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_EDIT_PASTE, undo_desc);
|
||||
if (GIMP_IS_LAYER (drawable))
|
||||
undo_desc = C_("undo-type", "Transform Layer");
|
||||
else if (GIMP_IS_CHANNEL (drawable))
|
||||
undo_desc = C_("undo-type", "Transform Channel");
|
||||
else
|
||||
return NULL;
|
||||
|
||||
gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_EDIT_PASTE, undo_desc);
|
||||
}
|
||||
|
||||
if (new_layer)
|
||||
{
|
||||
@@ -1066,13 +1071,14 @@ gimp_drawable_transform_paste (GimpDrawable *drawable,
|
||||
}
|
||||
else
|
||||
{
|
||||
gimp_drawable_set_buffer_full (drawable, TRUE, NULL,
|
||||
gimp_drawable_set_buffer_full (drawable, push_undo, NULL,
|
||||
buffer,
|
||||
GEGL_RECTANGLE (offset_x, offset_y, 0, 0),
|
||||
TRUE);
|
||||
}
|
||||
|
||||
gimp_image_undo_group_end (image);
|
||||
if (push_undo)
|
||||
gimp_image_undo_group_end (image);
|
||||
|
||||
return drawable;
|
||||
}
|
||||
|
@@ -87,4 +87,5 @@ GimpDrawable * gimp_drawable_transform_paste (GimpDrawable
|
||||
GimpColorProfile *buffer_profile,
|
||||
gint offset_x,
|
||||
gint offset_y,
|
||||
gboolean new_layer);
|
||||
gboolean new_layer,
|
||||
gboolean push_undo);
|
||||
|
@@ -142,7 +142,8 @@ static void gimp_drawable_transform (GimpItem *item,
|
||||
GimpTransformDirection direction,
|
||||
GimpInterpolationType interpolation_type,
|
||||
GimpTransformResize clip_result,
|
||||
GimpProgress *progress);
|
||||
GimpProgress *progress,
|
||||
gboolean push_undo);
|
||||
|
||||
static const guint8 *
|
||||
gimp_drawable_get_icc_profile (GimpColorManaged *managed,
|
||||
@@ -583,7 +584,7 @@ gimp_drawable_duplicate (GimpItem *item,
|
||||
|
||||
new_filter = gimp_drawable_filter_duplicate (new_drawable,
|
||||
filter);
|
||||
if (filter)
|
||||
if (new_filter)
|
||||
{
|
||||
gimp_drawable_filter_apply (new_filter, NULL);
|
||||
gimp_drawable_filter_commit (new_filter, TRUE, NULL, FALSE);
|
||||
@@ -742,7 +743,7 @@ gimp_drawable_flip (GimpItem *item,
|
||||
if (buffer)
|
||||
{
|
||||
gimp_drawable_transform_paste (drawable, buffer, buffer_profile,
|
||||
new_off_x, new_off_y, FALSE);
|
||||
new_off_x, new_off_y, FALSE, TRUE);
|
||||
g_object_unref (buffer);
|
||||
}
|
||||
}
|
||||
@@ -774,7 +775,7 @@ gimp_drawable_rotate (GimpItem *item,
|
||||
if (buffer)
|
||||
{
|
||||
gimp_drawable_transform_paste (drawable, buffer, buffer_profile,
|
||||
new_off_x, new_off_y, FALSE);
|
||||
new_off_x, new_off_y, FALSE, TRUE);
|
||||
g_object_unref (buffer);
|
||||
}
|
||||
}
|
||||
@@ -786,7 +787,8 @@ gimp_drawable_transform (GimpItem *item,
|
||||
GimpTransformDirection direction,
|
||||
GimpInterpolationType interpolation_type,
|
||||
GimpTransformResize clip_result,
|
||||
GimpProgress *progress)
|
||||
GimpProgress *progress,
|
||||
gboolean push_undo)
|
||||
{
|
||||
GimpDrawable *drawable = GIMP_DRAWABLE (item);
|
||||
GeglBuffer *buffer;
|
||||
@@ -809,7 +811,7 @@ gimp_drawable_transform (GimpItem *item,
|
||||
if (buffer)
|
||||
{
|
||||
gimp_drawable_transform_paste (drawable, buffer, buffer_profile,
|
||||
new_off_x, new_off_y, FALSE);
|
||||
new_off_x, new_off_y, FALSE, push_undo);
|
||||
g_object_unref (buffer);
|
||||
}
|
||||
}
|
||||
|
@@ -56,6 +56,8 @@
|
||||
#include "gimplist.h"
|
||||
#include "gimpprogress.h"
|
||||
|
||||
#include "gimp-intl.h"
|
||||
|
||||
|
||||
enum
|
||||
{
|
||||
@@ -954,9 +956,8 @@ gimp_drawable_filter_update (GimpDrawableFilter *filter,
|
||||
* directly with bad data.
|
||||
*/
|
||||
g_set_error (error, GIMP_ERROR, GIMP_FAILED,
|
||||
/* TODO: localize after string freeze. */
|
||||
"GEGL operation '%s' has been called with a "
|
||||
"non-existent argument name '%s' (#%d).",
|
||||
_("GEGL operation '%s' has been called with a "
|
||||
"non-existent argument name '%s' (#%d)."),
|
||||
opname, pspec->name, i);
|
||||
break;
|
||||
}
|
||||
@@ -1019,10 +1020,9 @@ gimp_drawable_filter_update (GimpDrawableFilter *filter,
|
||||
else if (! G_TYPE_CHECK_VALUE_TYPE (new_value, G_PARAM_SPEC_VALUE_TYPE (pspec)))
|
||||
{
|
||||
g_set_error (error, GIMP_ERROR, GIMP_FAILED,
|
||||
/* TODO: localize after string freeze. */
|
||||
"GEGL operation '%s' has been called with a "
|
||||
"wrong value type for argument '%s' (#%d). "
|
||||
"Expected %s, got %s.",
|
||||
_("GEGL operation '%s' has been called with a "
|
||||
"wrong value type for argument '%s' (#%d). "
|
||||
"Expected %s, got %s."),
|
||||
opname, pspec->name, i,
|
||||
g_type_name (pspec->value_type),
|
||||
g_type_name (G_VALUE_TYPE (new_value)));
|
||||
@@ -1095,9 +1095,8 @@ gimp_drawable_filter_update (GimpDrawableFilter *filter,
|
||||
if (! gegl_node_has_pad (node, auxinputnames[i]))
|
||||
{
|
||||
g_set_error (error, GIMP_ERROR, GIMP_FAILED,
|
||||
/* TODO: localize after string freeze. */
|
||||
"GEGL operation '%s' has been called with an "
|
||||
"invalid aux input name '%s'.",
|
||||
_("GEGL operation '%s' has been called with an "
|
||||
"invalid aux input name '%s'."),
|
||||
opname, auxinputnames[i]);
|
||||
break;
|
||||
}
|
||||
|
@@ -108,8 +108,7 @@ gimp_drawable_filter_mask_rename (GimpItem *item,
|
||||
GError **error)
|
||||
{
|
||||
g_set_error (error, GIMP_ERROR, GIMP_FAILED,
|
||||
/* TODO: localized after string freeze. */
|
||||
"Cannot rename effect masks.");
|
||||
_("Cannot rename effect masks."));
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
@@ -406,17 +406,26 @@ gimp_extension_load (GimpExtension *extension,
|
||||
metadata = as_metadata_new ();
|
||||
success = as_metadata_parse_file (metadata, file, AS_FORMAT_KIND_XML, error);
|
||||
|
||||
if (success)
|
||||
{
|
||||
#if AS_CHECK_VERSION(1, 0, 0)
|
||||
components = as_metadata_get_components (metadata);
|
||||
component = as_component_box_index (components, 0);
|
||||
components = as_metadata_get_components (metadata);
|
||||
component = as_component_box_index (components, 0);
|
||||
#else
|
||||
components = as_metadata_get_components (metadata);
|
||||
component = g_ptr_array_index (components, 0);
|
||||
components = as_metadata_get_components (metadata);
|
||||
component = g_ptr_array_index (components, 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
g_object_unref (file);
|
||||
g_free (path);
|
||||
|
||||
if (!success)
|
||||
{
|
||||
return success;
|
||||
}
|
||||
|
||||
|
||||
if (success && as_component_get_kind (component) != AS_COMPONENT_KIND_ADDON)
|
||||
{
|
||||
/* Properly setting the type will allow extensions to be
|
||||
|
@@ -63,8 +63,7 @@ static GimpTempBuf * gimp_gradient_get_new_preview (GimpViewable *viewa
|
||||
GimpContext *context,
|
||||
gint width,
|
||||
gint height,
|
||||
GeglColor *color,
|
||||
GeglColor *background);
|
||||
GeglColor *fg_color);
|
||||
|
||||
static const gchar * gimp_gradient_get_extension (GimpData *data);
|
||||
static void gimp_gradient_copy (GimpData *data,
|
||||
@@ -219,8 +218,7 @@ gimp_gradient_get_new_preview (GimpViewable *viewable,
|
||||
GimpContext *context,
|
||||
gint width,
|
||||
gint height,
|
||||
GeglColor *color G_GNUC_UNUSED,
|
||||
GeglColor *background G_GNUC_UNUSED)
|
||||
GeglColor *fg_color G_GNUC_UNUSED)
|
||||
{
|
||||
GimpGradient *gradient = GIMP_GRADIENT (viewable);
|
||||
GimpGradientSegment *seg = NULL;
|
||||
|
@@ -159,7 +159,8 @@ static void gimp_group_layer_transform (GimpLayer *layer,
|
||||
GimpTransformDirection direction,
|
||||
GimpInterpolationType interpolation_type,
|
||||
GimpTransformResize clip_result,
|
||||
GimpProgress *progress);
|
||||
GimpProgress *progress,
|
||||
gboolean push_undo);
|
||||
static void gimp_group_layer_convert_type (GimpLayer *layer,
|
||||
GimpImage *dest_image,
|
||||
const Babl *new_format,
|
||||
@@ -1016,7 +1017,8 @@ gimp_group_layer_transform (GimpLayer *layer,
|
||||
GimpTransformDirection direction,
|
||||
GimpInterpolationType interpolation_type,
|
||||
GimpTransformResize clip_result,
|
||||
GimpProgress *progress)
|
||||
GimpProgress *progress,
|
||||
gboolean push_undo)
|
||||
{
|
||||
GimpGroupLayer *group = GIMP_GROUP_LAYER (layer);
|
||||
GimpGroupLayerPrivate *private = GET_PRIVATE (layer);
|
||||
|
@@ -2361,6 +2361,8 @@ select_colors_gray (QuantizeObj *quantobj,
|
||||
/* Compute the representative color for each box, fill colormap */
|
||||
for (i = 0; i < numboxes; i++)
|
||||
compute_color_gray (quantobj, histogram, boxlist + i, i);
|
||||
|
||||
g_free (boxlist);
|
||||
}
|
||||
|
||||
|
||||
|
@@ -122,8 +122,7 @@ gimp_image_get_new_preview (GimpViewable *viewable,
|
||||
GimpContext *context,
|
||||
gint width,
|
||||
gint height,
|
||||
GeglColor *color G_GNUC_UNUSED,
|
||||
GeglColor *background G_GNUC_UNUSED)
|
||||
GeglColor *fg_color G_GNUC_UNUSED)
|
||||
{
|
||||
GimpImage *image = GIMP_IMAGE (viewable);
|
||||
const Babl *format;
|
||||
@@ -153,8 +152,7 @@ gimp_image_get_new_pixbuf (GimpViewable *viewable,
|
||||
GimpContext *context,
|
||||
gint width,
|
||||
gint height,
|
||||
GeglColor *color G_GNUC_UNUSED,
|
||||
GeglColor *background G_GNUC_UNUSED)
|
||||
GeglColor *fg_color G_GNUC_UNUSED)
|
||||
{
|
||||
GimpImage *image = GIMP_IMAGE (viewable);
|
||||
GdkPixbuf *pixbuf;
|
||||
|
@@ -41,11 +41,9 @@ GimpTempBuf * gimp_image_get_new_preview (GimpViewable *viewable,
|
||||
GimpContext *context,
|
||||
gint width,
|
||||
gint height,
|
||||
GeglColor *color,
|
||||
GeglColor *background);
|
||||
GeglColor *fg_color);
|
||||
GdkPixbuf * gimp_image_get_new_pixbuf (GimpViewable *viewable,
|
||||
GimpContext *context,
|
||||
gint width,
|
||||
gint height,
|
||||
GeglColor *color,
|
||||
GeglColor *background);
|
||||
GeglColor *fg_color);
|
||||
|
@@ -48,6 +48,8 @@
|
||||
#include "gimplayermaskundo.h"
|
||||
#include "gimplayerpropundo.h"
|
||||
#include "gimplayerundo.h"
|
||||
#include "gimplinklayer.h"
|
||||
#include "gimplinklayerundo.h"
|
||||
#include "gimpmaskundo.h"
|
||||
#include "gimpsamplepoint.h"
|
||||
#include "gimpsamplepointundo.h"
|
||||
@@ -57,6 +59,8 @@
|
||||
#include "path/gimppathmodundo.h"
|
||||
#include "path/gimppathpropundo.h"
|
||||
#include "path/gimppathundo.h"
|
||||
#include "path/gimpvectorlayer.h"
|
||||
#include "path/gimpvectorlayerundo.h"
|
||||
|
||||
#include "text/gimptextlayer.h"
|
||||
#include "text/gimptextundo.h"
|
||||
@@ -876,6 +880,64 @@ gimp_image_undo_push_text_layer_convert (GimpImage *image,
|
||||
NULL);
|
||||
}
|
||||
|
||||
/**********************/
|
||||
/* Link Layer Undos */
|
||||
/**********************/
|
||||
|
||||
GimpUndo *
|
||||
gimp_image_undo_push_link_layer (GimpImage *image,
|
||||
const gchar *undo_desc,
|
||||
GimpLinkLayer *layer)
|
||||
{
|
||||
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
||||
g_return_val_if_fail (GIMP_IS_LINK_LAYER (layer), NULL);
|
||||
g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (layer)), NULL);
|
||||
|
||||
return gimp_image_undo_push (image, GIMP_TYPE_LINK_LAYER_UNDO,
|
||||
GIMP_UNDO_LINK_LAYER, undo_desc,
|
||||
GIMP_DIRTY_ITEM | GIMP_DIRTY_DRAWABLE,
|
||||
"item", layer,
|
||||
NULL);
|
||||
}
|
||||
|
||||
/************************/
|
||||
/* Vector Layer Undos */
|
||||
/************************/
|
||||
|
||||
GimpUndo *
|
||||
gimp_image_undo_push_vector_layer (GimpImage *image,
|
||||
const gchar *undo_desc,
|
||||
GimpVectorLayer *layer,
|
||||
const GParamSpec *pspec)
|
||||
{
|
||||
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
||||
g_return_val_if_fail (GIMP_IS_VECTOR_LAYER (layer), NULL);
|
||||
g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (layer)), NULL);
|
||||
|
||||
return gimp_image_undo_push (image, GIMP_TYPE_VECTOR_LAYER_UNDO,
|
||||
GIMP_UNDO_VECTOR_LAYER, undo_desc,
|
||||
GIMP_DIRTY_ITEM | GIMP_DIRTY_DRAWABLE,
|
||||
"item", layer,
|
||||
"param", pspec,
|
||||
NULL);
|
||||
}
|
||||
|
||||
GimpUndo *
|
||||
gimp_image_undo_push_vector_layer_modified (GimpImage *image,
|
||||
const gchar *undo_desc,
|
||||
GimpVectorLayer *layer)
|
||||
{
|
||||
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
||||
g_return_val_if_fail (GIMP_IS_VECTOR_LAYER (layer), NULL);
|
||||
g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (layer)), NULL);
|
||||
|
||||
return gimp_image_undo_push (image, GIMP_TYPE_VECTOR_LAYER_UNDO,
|
||||
GIMP_UNDO_VECTOR_LAYER_MODIFIED, undo_desc,
|
||||
GIMP_DIRTY_ITEM_META,
|
||||
"item", layer,
|
||||
NULL);
|
||||
}
|
||||
|
||||
|
||||
/**********************/
|
||||
/* Layer Mask Undos */
|
||||
|
@@ -214,6 +214,22 @@ GimpUndo * gimp_image_undo_push_text_layer_convert (GimpImage *image,
|
||||
const gchar *undo_desc,
|
||||
GimpTextLayer *layer);
|
||||
|
||||
/* link layer undos */
|
||||
|
||||
GimpUndo * gimp_image_undo_push_link_layer (GimpImage *image,
|
||||
const gchar *undo_desc,
|
||||
GimpLinkLayer *layer);
|
||||
|
||||
/* vector layer undos */
|
||||
|
||||
GimpUndo * gimp_image_undo_push_vector_layer (GimpImage *image,
|
||||
const gchar *undo_desc,
|
||||
GimpVectorLayer *layer,
|
||||
const GParamSpec *pspec);
|
||||
GimpUndo * gimp_image_undo_push_vector_layer_modified
|
||||
(GimpImage *image,
|
||||
const gchar *undo_desc,
|
||||
GimpVectorLayer *layer);
|
||||
|
||||
/* layer mask undos */
|
||||
|
||||
|
@@ -71,6 +71,7 @@
|
||||
#include "gimplayer-floating-selection.h"
|
||||
#include "gimplayermask.h"
|
||||
#include "gimplayerstack.h"
|
||||
#include "gimplinklayer.h"
|
||||
#include "gimpmarshal.h"
|
||||
#include "gimppalette.h"
|
||||
#include "gimpparasitelist.h"
|
||||
@@ -87,6 +88,7 @@
|
||||
#include "text/gimptextlayer.h"
|
||||
|
||||
#include "path/gimppath.h"
|
||||
#include "path/gimpvectorlayer.h"
|
||||
|
||||
#include "gimp-log.h"
|
||||
#include "gimp-intl.h"
|
||||
@@ -3015,6 +3017,22 @@ gimp_image_get_xcf_version (GimpImage *image,
|
||||
*/
|
||||
version = MAX (23, version);
|
||||
}
|
||||
|
||||
/* Need version 24 for vector layers. */
|
||||
if (GIMP_IS_VECTOR_LAYER (layer))
|
||||
{
|
||||
ADD_REASON (g_strdup_printf (_("Vector layers were added in %s"),
|
||||
"GIMP 3.2"));
|
||||
version = MAX (24, version);
|
||||
}
|
||||
|
||||
/* Need version 25 for link layers. */
|
||||
if (GIMP_IS_LINK_LAYER (layer))
|
||||
{
|
||||
ADD_REASON (g_strdup_printf (_("Link layers were added in %s"),
|
||||
"GIMP 3.2"));
|
||||
version = MAX (25, version);
|
||||
}
|
||||
}
|
||||
g_list_free (items);
|
||||
|
||||
@@ -3194,6 +3212,11 @@ gimp_image_get_xcf_version (GimpImage *image,
|
||||
if (gimp_version) *gimp_version = 300;
|
||||
if (version_string) *version_string = "GIMP 3.0";
|
||||
break;
|
||||
case 24:
|
||||
case 25:
|
||||
if (gimp_version) *gimp_version = 320;
|
||||
if (version_string) *version_string = "GIMP 3.2";
|
||||
break;
|
||||
}
|
||||
|
||||
if (version_reason && reasons)
|
||||
@@ -5457,6 +5480,17 @@ gimp_image_add_layer (GimpImage *image,
|
||||
gimp_drawable_attach_floating_sel (gimp_layer_get_floating_sel_drawable (layer),
|
||||
layer);
|
||||
|
||||
/* If the layer is a vector layer, also add its path to the image */
|
||||
if (gimp_item_is_vector_layer (GIMP_ITEM (layer)))
|
||||
{
|
||||
GimpPath *path = gimp_vector_layer_get_path (GIMP_VECTOR_LAYER (layer));
|
||||
|
||||
if (path &&
|
||||
(! gimp_item_is_attached (GIMP_ITEM (path))) &&
|
||||
gimp_item_get_image (GIMP_ITEM (path)) == image)
|
||||
gimp_image_add_path (image, path, NULL, -1, FALSE);
|
||||
}
|
||||
|
||||
if (old_has_alpha != gimp_image_has_alpha (image))
|
||||
private->flush_accum.alpha_changed = TRUE;
|
||||
|
||||
|
@@ -71,6 +71,10 @@ struct _GimpImagefilePrivate
|
||||
|
||||
gchar *description;
|
||||
gboolean static_desc;
|
||||
|
||||
gint popup_size;
|
||||
gint popup_width;
|
||||
gint popup_height;
|
||||
};
|
||||
|
||||
#define GET_PRIVATE(imagefile) ((GimpImagefilePrivate *) gimp_imagefile_get_instance_private ((GimpImagefile *) (imagefile)))
|
||||
@@ -81,12 +85,17 @@ static void gimp_imagefile_finalize (GObject *object);
|
||||
|
||||
static void gimp_imagefile_name_changed (GimpObject *object);
|
||||
|
||||
static gboolean gimp_imagefile_get_popup_size (GimpViewable *viewable,
|
||||
gint width,
|
||||
gint height,
|
||||
gboolean dot_for_dot,
|
||||
gint *popup_width,
|
||||
gint *popup_height);
|
||||
static GdkPixbuf * gimp_imagefile_get_new_pixbuf (GimpViewable *viewable,
|
||||
GimpContext *context,
|
||||
gint width,
|
||||
gint height,
|
||||
GeglColor *color,
|
||||
GeglColor *background);
|
||||
GeglColor *fg_color);
|
||||
static gchar * gimp_imagefile_get_description (GimpViewable *viewable,
|
||||
gchar **tooltip);
|
||||
|
||||
@@ -147,6 +156,7 @@ gimp_imagefile_class_init (GimpImagefileClass *klass)
|
||||
gimp_object_class->name_changed = gimp_imagefile_name_changed;
|
||||
|
||||
viewable_class->name_changed_signal = "info-changed";
|
||||
viewable_class->get_popup_size = gimp_imagefile_get_popup_size;
|
||||
viewable_class->get_new_pixbuf = gimp_imagefile_get_new_pixbuf;
|
||||
viewable_class->get_description = gimp_imagefile_get_description;
|
||||
|
||||
@@ -222,13 +232,34 @@ gimp_imagefile_name_changed (GimpObject *object)
|
||||
private->file = g_file_new_for_uri (gimp_object_get_name (object));
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gimp_imagefile_get_popup_size (GimpViewable *viewable,
|
||||
gint width,
|
||||
gint height,
|
||||
gboolean dot_for_dot,
|
||||
gint *popup_width,
|
||||
gint *popup_height)
|
||||
{
|
||||
GimpImagefilePrivate *private = GET_PRIVATE (viewable);
|
||||
|
||||
if (width < private->popup_width ||
|
||||
height < private->popup_height)
|
||||
{
|
||||
*popup_width = private->popup_width;
|
||||
*popup_height = private->popup_height;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static GdkPixbuf *
|
||||
gimp_imagefile_get_new_pixbuf (GimpViewable *viewable,
|
||||
GimpContext *context,
|
||||
gint width,
|
||||
gint height,
|
||||
GeglColor *color G_GNUC_UNUSED,
|
||||
GeglColor *background G_GNUC_UNUSED)
|
||||
GeglColor *fg_color G_GNUC_UNUSED)
|
||||
{
|
||||
GimpImagefile *imagefile = GIMP_IMAGEFILE (viewable);
|
||||
|
||||
@@ -517,10 +548,10 @@ gimp_imagefile_create_thumbnail (GimpImagefile *imagefile,
|
||||
}
|
||||
|
||||
image = file_open_image (private->gimp, context, progress,
|
||||
private->file, size, size,
|
||||
private->file, size, size, TRUE,
|
||||
FALSE, NULL,
|
||||
GIMP_RUN_NONINTERACTIVE,
|
||||
&status, &mime_type, error);
|
||||
NULL, &status, &mime_type, error);
|
||||
|
||||
if (image)
|
||||
gimp_thumbnail_set_info_from_image (private->thumbnail,
|
||||
@@ -931,11 +962,9 @@ gimp_imagefile_load_thumb (GimpImagefile *imagefile,
|
||||
gchar *image_uri;
|
||||
gint image_width;
|
||||
gint image_height;
|
||||
GdkPixbuf *pixbuf = NULL;
|
||||
GError *error = NULL;
|
||||
gint size = MAX (width, height);
|
||||
gint pixbuf_width;
|
||||
gint pixbuf_height;
|
||||
GdkPixbuf *pixbuf = NULL;
|
||||
GError *error = NULL;
|
||||
gint size;
|
||||
gint preview_width;
|
||||
gint preview_height;
|
||||
|
||||
@@ -946,6 +975,19 @@ gimp_imagefile_load_thumb (GimpImagefile *imagefile,
|
||||
"image-height", &image_height,
|
||||
NULL);
|
||||
|
||||
/* use the size remembered below if a pixbuf of the remembered
|
||||
* dimensions is requested
|
||||
*/
|
||||
if (width == private->popup_width &&
|
||||
height == private->popup_height)
|
||||
{
|
||||
size = private->popup_size;
|
||||
}
|
||||
else
|
||||
{
|
||||
size = MAX (width, height);
|
||||
}
|
||||
|
||||
if (gimp_thumbnail_peek_thumb (thumbnail, size) < GIMP_THUMB_STATE_EXISTS)
|
||||
return NULL;
|
||||
|
||||
@@ -975,11 +1017,16 @@ gimp_imagefile_load_thumb (GimpImagefile *imagefile,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
pixbuf_width = gdk_pixbuf_get_width (pixbuf);
|
||||
pixbuf_height = gdk_pixbuf_get_height (pixbuf);
|
||||
/* remember the actual dimensions of the returned pixbuf, and the
|
||||
* size used to request it, so we can later use that size to get a
|
||||
* popup.
|
||||
*/
|
||||
private->popup_size = size;
|
||||
private->popup_width = gdk_pixbuf_get_width (pixbuf);
|
||||
private->popup_height = gdk_pixbuf_get_height (pixbuf);
|
||||
|
||||
gimp_viewable_calc_preview_size (pixbuf_width,
|
||||
pixbuf_height,
|
||||
gimp_viewable_calc_preview_size (private->popup_width,
|
||||
private->popup_height,
|
||||
width,
|
||||
height,
|
||||
TRUE, 1.0, 1.0,
|
||||
@@ -987,7 +1034,8 @@ gimp_imagefile_load_thumb (GimpImagefile *imagefile,
|
||||
&preview_height,
|
||||
NULL);
|
||||
|
||||
if (preview_width < pixbuf_width || preview_height < pixbuf_height)
|
||||
if (preview_width != private->popup_width ||
|
||||
preview_height != private->popup_height)
|
||||
{
|
||||
GdkPixbuf *scaled = gdk_pixbuf_scale_simple (pixbuf,
|
||||
preview_width,
|
||||
@@ -995,18 +1043,15 @@ gimp_imagefile_load_thumb (GimpImagefile *imagefile,
|
||||
GDK_INTERP_BILINEAR);
|
||||
g_object_unref (pixbuf);
|
||||
pixbuf = scaled;
|
||||
|
||||
pixbuf_width = preview_width;
|
||||
pixbuf_height = preview_height;
|
||||
}
|
||||
|
||||
if (gdk_pixbuf_get_n_channels (pixbuf) != 3)
|
||||
{
|
||||
GdkPixbuf *tmp = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8,
|
||||
pixbuf_width, pixbuf_height);
|
||||
preview_width, preview_height);
|
||||
|
||||
gdk_pixbuf_composite_color (pixbuf, tmp,
|
||||
0, 0, pixbuf_width, pixbuf_height,
|
||||
0, 0, preview_width, preview_height,
|
||||
0.0, 0.0, 1.0, 1.0,
|
||||
GDK_INTERP_NEAREST, 255,
|
||||
0, 0, GIMP_CHECK_SIZE_SM,
|
||||
@@ -1065,7 +1110,7 @@ gimp_imagefile_save_thumb (GimpImagefile *imagefile,
|
||||
pixbuf = gimp_viewable_get_new_pixbuf (GIMP_VIEWABLE (image),
|
||||
/* random context, unused */
|
||||
gimp_get_user_context (image->gimp),
|
||||
width, height, NULL, NULL);
|
||||
width, height, NULL);
|
||||
|
||||
/* when layer previews are disabled, we won't get a pixbuf */
|
||||
if (! pixbuf)
|
||||
|
@@ -94,14 +94,12 @@ static GimpTempBuf * gimp_image_proxy_get_new_preview (GimpViewabl
|
||||
GimpContext *context,
|
||||
gint width,
|
||||
gint height,
|
||||
GeglColor *color,
|
||||
GeglColor *background);
|
||||
GeglColor *fg_color);
|
||||
static GdkPixbuf * gimp_image_proxy_get_new_pixbuf (GimpViewable *viewable,
|
||||
GimpContext *context,
|
||||
gint width,
|
||||
gint height,
|
||||
GeglColor *color,
|
||||
GeglColor *background);
|
||||
GeglColor *fg_color);
|
||||
static gchar * gimp_image_proxy_get_description (GimpViewable *viewable,
|
||||
gchar **tooltip);
|
||||
|
||||
@@ -378,8 +376,7 @@ gimp_image_proxy_get_new_preview (GimpViewable *viewable,
|
||||
GimpContext *context,
|
||||
gint width,
|
||||
gint height,
|
||||
GeglColor *color G_GNUC_UNUSED,
|
||||
GeglColor *background G_GNUC_UNUSED)
|
||||
GeglColor *fg_color G_GNUC_UNUSED)
|
||||
{
|
||||
GimpImageProxy *image_proxy = GIMP_IMAGE_PROXY (viewable);
|
||||
GimpImage *image = image_proxy->priv->image;
|
||||
@@ -421,8 +418,7 @@ gimp_image_proxy_get_new_pixbuf (GimpViewable *viewable,
|
||||
GimpContext *context,
|
||||
gint width,
|
||||
gint height,
|
||||
GeglColor *color G_GNUC_UNUSED,
|
||||
GeglColor *background G_GNUC_UNUSED)
|
||||
GeglColor *fg_color G_GNUC_UNUSED)
|
||||
{
|
||||
GimpImageProxy *image_proxy = GIMP_IMAGE_PROXY (viewable);
|
||||
GimpImage *image = image_proxy->priv->image;
|
||||
|
@@ -1777,7 +1777,7 @@ gimp_item_transform (GimpItem *item,
|
||||
g_object_freeze_notify (G_OBJECT (item));
|
||||
|
||||
item_class->transform (item, context, matrix, direction, interpolation,
|
||||
clip_result, progress);
|
||||
clip_result, progress, TRUE);
|
||||
|
||||
g_object_thaw_notify (G_OBJECT (item));
|
||||
|
||||
@@ -2650,7 +2650,8 @@ gimp_item_mask_bounds (GimpItem *item,
|
||||
! gimp_channel_is_empty (selection) &&
|
||||
gimp_item_bounds (GIMP_ITEM (selection), &x, &y, &width, &height))
|
||||
{
|
||||
gint off_x, off_y;
|
||||
gint off_x = 0;
|
||||
gint off_y = 0;
|
||||
gint x2, y2;
|
||||
|
||||
gimp_item_get_offset (item, &off_x, &off_y);
|
||||
@@ -2724,7 +2725,8 @@ gimp_item_mask_intersect (GimpItem *item,
|
||||
gimp_item_bounds (GIMP_ITEM (selection),
|
||||
&tmp_x, &tmp_y, &tmp_width, &tmp_height))
|
||||
{
|
||||
gint off_x, off_y;
|
||||
gint off_x = 0;
|
||||
gint off_y = 0;
|
||||
|
||||
gimp_item_get_offset (item, &off_x, &off_y);
|
||||
|
||||
|
@@ -107,7 +107,8 @@ struct _GimpItemClass
|
||||
GimpTransformDirection direction,
|
||||
GimpInterpolationType interpolation_type,
|
||||
GimpTransformResize clip_result,
|
||||
GimpProgress *progress);
|
||||
GimpProgress *progress,
|
||||
gboolean push_undo);
|
||||
GimpTransformResize (* get_clip) (GimpItem *item,
|
||||
GimpTransformResize clip_result);
|
||||
gboolean (* fill) (GimpItem *item,
|
||||
|
111
app/core/gimplayer-xcf.c
Normal file
111
app/core/gimplayer-xcf.c
Normal file
@@ -0,0 +1,111 @@
|
||||
/* GIMP - The GNU Image Manipulation Program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* gimplayer-xcf.c
|
||||
*
|
||||
* Copyright 2003 Sven Neumann <sven@gimp.org>
|
||||
* Copyright 2025 Jehan
|
||||
*
|
||||
* 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 3 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, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <gdk-pixbuf/gdk-pixbuf.h>
|
||||
|
||||
#include "core-types.h"
|
||||
|
||||
#include "gimpimage.h"
|
||||
#include "gimplayer.h"
|
||||
#include "gimplayer-xcf.h"
|
||||
|
||||
/**
|
||||
* gimp_layer_from_layer:
|
||||
* @layer: a #GimpLayer object
|
||||
* @options: a #GimpVectorLayerOptions object
|
||||
*
|
||||
* Converts a standard #GimpLayer into a more specific type of
|
||||
* #GimpLayer. The new layer takes ownership of properties of @layer.
|
||||
* The @layer object is rendered unusable by this function. Don't even
|
||||
* try to use it afterwards!
|
||||
*
|
||||
* This is a gross hack that is needed in order to load text or vector
|
||||
* layers from XCF files in a backwards-compatible way, or as a
|
||||
* secondary step (after more data has been loaded). Please don't use it
|
||||
* for anything else!
|
||||
*
|
||||
* The variable list of arguments will be the properties which will be
|
||||
* used to create the new layer of type @new_layer_type. Note that the
|
||||
* "image" property needs to be set at the minimum.
|
||||
*
|
||||
* Return value: a newly allocated object of a subtype of #GimpLayer.
|
||||
**/
|
||||
GimpLayer *
|
||||
gimp_layer_from_layer (GimpLayer *layer,
|
||||
GType new_layer_type,
|
||||
...)
|
||||
{
|
||||
GimpLayer *new_layer;
|
||||
GimpDrawable *drawable;
|
||||
GimpImage *image;
|
||||
gboolean attached;
|
||||
GimpLayer *parent = NULL;
|
||||
gint position = 0;
|
||||
va_list args;
|
||||
const gchar *first_prop;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_LAYER (layer), NULL);
|
||||
g_return_val_if_fail (g_type_is_a (new_layer_type, GIMP_TYPE_LAYER), NULL);
|
||||
|
||||
image = gimp_item_get_image (GIMP_ITEM (layer));
|
||||
|
||||
if ((attached = gimp_item_is_attached (GIMP_ITEM (layer))))
|
||||
{
|
||||
parent = gimp_layer_get_parent (layer);
|
||||
position = gimp_item_get_index (GIMP_ITEM (layer));
|
||||
|
||||
g_object_ref (layer);
|
||||
gimp_image_remove_layer (image, layer, FALSE, NULL);
|
||||
}
|
||||
|
||||
va_start (args, new_layer_type);
|
||||
first_prop = va_arg (args, gchar *);
|
||||
new_layer = GIMP_LAYER (g_object_new_valist (new_layer_type, first_prop, args));
|
||||
va_end (args);
|
||||
|
||||
gimp_item_replace_item (GIMP_ITEM (new_layer), GIMP_ITEM (layer));
|
||||
|
||||
drawable = GIMP_DRAWABLE (new_layer);
|
||||
gimp_drawable_steal_buffer (drawable, GIMP_DRAWABLE (layer));
|
||||
|
||||
gimp_layer_set_opacity (GIMP_LAYER (new_layer),
|
||||
gimp_layer_get_opacity (layer), FALSE);
|
||||
gimp_layer_set_mode (GIMP_LAYER (new_layer),
|
||||
gimp_layer_get_mode (layer), FALSE);
|
||||
gimp_layer_set_blend_space (GIMP_LAYER (new_layer),
|
||||
gimp_layer_get_blend_space (layer), FALSE);
|
||||
gimp_layer_set_composite_space (GIMP_LAYER (new_layer),
|
||||
gimp_layer_get_composite_space (layer), FALSE);
|
||||
gimp_layer_set_composite_mode (GIMP_LAYER (new_layer),
|
||||
gimp_layer_get_composite_mode (layer), FALSE);
|
||||
gimp_layer_set_lock_alpha (GIMP_LAYER (new_layer),
|
||||
gimp_layer_get_lock_alpha (layer), FALSE);
|
||||
|
||||
g_object_unref (layer);
|
||||
|
||||
if (attached)
|
||||
gimp_image_add_layer (image, new_layer, parent, position, FALSE);
|
||||
|
||||
return new_layer;
|
||||
}
|
27
app/core/gimplayer-xcf.h
Normal file
27
app/core/gimplayer-xcf.h
Normal file
@@ -0,0 +1,27 @@
|
||||
/* GIMP - The GNU Image Manipulation Program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* gimplayer-xcf.h
|
||||
*
|
||||
* Copyright 2003 Sven Neumann <sven@gimp.org>
|
||||
* Copyright 2025 Jehan
|
||||
*
|
||||
* 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 3 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, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
GimpLayer * gimp_layer_from_layer (GimpLayer *layer,
|
||||
GType new_layer_type,
|
||||
...) G_GNUC_NULL_TERMINATED;
|
@@ -169,7 +169,8 @@ static void gimp_layer_transform (GimpItem *item,
|
||||
GimpTransformDirection direction,
|
||||
GimpInterpolationType interpolation_type,
|
||||
GimpTransformResize clip_result,
|
||||
GimpProgress *progress);
|
||||
GimpProgress *progress,
|
||||
gboolean push_undo);
|
||||
static void gimp_layer_to_selection (GimpItem *item,
|
||||
GimpChannelOps op,
|
||||
gboolean antialias,
|
||||
@@ -248,7 +249,8 @@ static void gimp_layer_real_transform (GimpLayer *layer,
|
||||
GimpTransformDirection direction,
|
||||
GimpInterpolationType interpolation_type,
|
||||
GimpTransformResize clip_result,
|
||||
GimpProgress *progress);
|
||||
GimpProgress *progress,
|
||||
gboolean push_undo);
|
||||
static void gimp_layer_real_convert_type (GimpLayer *layer,
|
||||
GimpImage *dest_image,
|
||||
const Babl *new_format,
|
||||
@@ -1298,7 +1300,8 @@ gimp_layer_transform (GimpItem *item,
|
||||
GimpTransformDirection direction,
|
||||
GimpInterpolationType interpolation_type,
|
||||
GimpTransformResize clip_result,
|
||||
GimpProgress *progress)
|
||||
GimpProgress *progress,
|
||||
gboolean push_undo)
|
||||
{
|
||||
GimpLayer *layer = GIMP_LAYER (item);
|
||||
GimpObjectQueue *queue = NULL;
|
||||
@@ -1328,7 +1331,7 @@ gimp_layer_transform (GimpItem *item,
|
||||
GIMP_LAYER_GET_CLASS (layer)->transform (layer, context, matrix, direction,
|
||||
interpolation_type,
|
||||
clip_result,
|
||||
progress);
|
||||
progress, push_undo);
|
||||
|
||||
if (layer->mask)
|
||||
{
|
||||
@@ -1743,7 +1746,8 @@ gimp_layer_real_transform (GimpLayer *layer,
|
||||
GimpTransformDirection direction,
|
||||
GimpInterpolationType interpolation_type,
|
||||
GimpTransformResize clip_result,
|
||||
GimpProgress *progress)
|
||||
GimpProgress *progress,
|
||||
gboolean push_undo)
|
||||
{
|
||||
if (! gimp_matrix3_is_simple (matrix) &&
|
||||
! gimp_drawable_has_alpha (GIMP_DRAWABLE (layer)))
|
||||
@@ -1753,7 +1757,7 @@ gimp_layer_real_transform (GimpLayer *layer,
|
||||
context, matrix, direction,
|
||||
interpolation_type,
|
||||
clip_result,
|
||||
progress);
|
||||
progress, push_undo);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@@ -122,7 +122,8 @@ struct _GimpLayerClass
|
||||
GimpTransformDirection direction,
|
||||
GimpInterpolationType interpolation_type,
|
||||
GimpTransformResize clip_result,
|
||||
GimpProgress *progress);
|
||||
GimpProgress *progress,
|
||||
gboolean push_undo);
|
||||
void (* convert_type) (GimpLayer *layer,
|
||||
GimpImage *dest_image,
|
||||
const Babl *new_format,
|
||||
|
738
app/core/gimplink.c
Normal file
738
app/core/gimplink.c
Normal file
@@ -0,0 +1,738 @@
|
||||
/* GIMP - The GNU Image Manipulation Program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* GimpLink
|
||||
* Copyright (C) 2019 Jehan
|
||||
*
|
||||
* 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 3 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, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <cairo.h>
|
||||
#include <gegl.h>
|
||||
#include <gdk-pixbuf/gdk-pixbuf.h>
|
||||
|
||||
#include "libgimpbase/gimpbase.h"
|
||||
|
||||
#include "core-types.h"
|
||||
|
||||
#include "gimp.h"
|
||||
#include "gimpimage.h"
|
||||
#include "gimplink.h"
|
||||
#include "gimpmarshal.h"
|
||||
#include "gimppickable.h"
|
||||
#include "gimpprojection.h"
|
||||
|
||||
#include "file/file-open.h"
|
||||
|
||||
#include "gimp-intl.h"
|
||||
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
PROP_GIMP,
|
||||
PROP_FILE,
|
||||
PROP_ABSOLUTE_PATH,
|
||||
N_PROPS
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
CHANGED,
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
struct _GimpLinkPrivate
|
||||
{
|
||||
Gimp *gimp;
|
||||
GFile *file;
|
||||
GFileMonitor *monitor;
|
||||
gboolean absolute_path;
|
||||
|
||||
GeglBuffer *buffer;
|
||||
gboolean broken;
|
||||
GError *error;
|
||||
guint idle_changed_source;
|
||||
|
||||
gboolean is_vector;
|
||||
gint width;
|
||||
gint height;
|
||||
gboolean keep_ratio;
|
||||
GimpImageBaseType base_type;
|
||||
GimpPrecision precision;
|
||||
GimpPlugInProcedure *load_proc;
|
||||
};
|
||||
|
||||
static void gimp_link_finalize (GObject *object);
|
||||
static void gimp_link_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gimp_link_set_property (GObject *object,
|
||||
guint property_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
|
||||
static void gimp_link_file_changed (GFileMonitor *monitor,
|
||||
GFile *file,
|
||||
GFile *other_file,
|
||||
GFileMonitorEvent event_type,
|
||||
GimpLink *link);
|
||||
static gboolean gimp_link_emit_changed (gpointer data);
|
||||
|
||||
static void gimp_link_update_buffer (GimpLink *link,
|
||||
GimpProgress *progress,
|
||||
GError **error);
|
||||
static void gimp_link_start_monitoring (GimpLink *link);
|
||||
static gchar * gimp_link_get_relative_path (GimpLink *link,
|
||||
GFile *parent,
|
||||
gint n_back);
|
||||
|
||||
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (GimpLink, gimp_link, GIMP_TYPE_OBJECT)
|
||||
|
||||
#define parent_class gimp_link_parent_class
|
||||
|
||||
static guint link_signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
static GParamSpec *link_props[N_PROPS] = { NULL, };
|
||||
|
||||
static void
|
||||
gimp_link_class_init (GimpLinkClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
link_signals[CHANGED] =
|
||||
g_signal_new ("changed",
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_FIRST,
|
||||
G_STRUCT_OFFSET (GimpLinkClass, changed),
|
||||
NULL, NULL, NULL,
|
||||
G_TYPE_NONE, 0);
|
||||
|
||||
object_class->finalize = gimp_link_finalize;
|
||||
object_class->get_property = gimp_link_get_property;
|
||||
object_class->set_property = gimp_link_set_property;
|
||||
|
||||
link_props[PROP_GIMP] = g_param_spec_object ("gimp", NULL, NULL,
|
||||
GIMP_TYPE_GIMP,
|
||||
GIMP_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT_ONLY);
|
||||
link_props[PROP_FILE] = g_param_spec_object ("file", NULL, NULL,
|
||||
G_TYPE_FILE,
|
||||
GIMP_PARAM_READWRITE |
|
||||
G_PARAM_EXPLICIT_NOTIFY);
|
||||
link_props[PROP_ABSOLUTE_PATH] = g_param_spec_boolean ("absolute-path", NULL, NULL,
|
||||
FALSE,
|
||||
GIMP_PARAM_READWRITE);
|
||||
|
||||
g_object_class_install_properties (object_class, N_PROPS, link_props);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_link_init (GimpLink *link)
|
||||
{
|
||||
link->p = gimp_link_get_instance_private (link);
|
||||
link->p->gimp = NULL;
|
||||
link->p->file = NULL;
|
||||
link->p->monitor = NULL;
|
||||
link->p->buffer = NULL;
|
||||
link->p->broken = TRUE;
|
||||
link->p->error = NULL;
|
||||
link->p->width = 0;
|
||||
link->p->height = 0;
|
||||
link->p->base_type = GIMP_RGB;
|
||||
link->p->precision = GIMP_PRECISION_U8_PERCEPTUAL;
|
||||
link->p->load_proc = NULL;
|
||||
|
||||
link->p->idle_changed_source = 0;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_link_finalize (GObject *object)
|
||||
{
|
||||
GimpLink *link = GIMP_LINK (object);
|
||||
|
||||
g_clear_object (&link->p->file);
|
||||
g_clear_object (&link->p->monitor);
|
||||
g_clear_object (&link->p->buffer);
|
||||
g_clear_error (&link->p->error);
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_link_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GimpLink *link = GIMP_LINK (object);
|
||||
|
||||
switch (property_id)
|
||||
{
|
||||
case PROP_GIMP:
|
||||
g_value_set_object (value, link->p->gimp);
|
||||
break;
|
||||
case PROP_FILE:
|
||||
g_value_set_object (value, link->p->file);
|
||||
break;
|
||||
case PROP_ABSOLUTE_PATH:
|
||||
g_value_set_boolean (value, link->p->absolute_path);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_link_set_property (GObject *object,
|
||||
guint property_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GimpLink *link = GIMP_LINK (object);
|
||||
|
||||
switch (property_id)
|
||||
{
|
||||
case PROP_GIMP:
|
||||
link->p->gimp = g_value_get_object (value);
|
||||
break;
|
||||
case PROP_FILE:
|
||||
gimp_link_set_file (link, g_value_get_object (value), 0, 0, FALSE, NULL, NULL);
|
||||
break;
|
||||
case PROP_ABSOLUTE_PATH:
|
||||
link->p->absolute_path = g_value_get_boolean (value);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_link_file_changed (GFileMonitor *monitor,
|
||||
GFile *file,
|
||||
GFile *other_file,
|
||||
GFileMonitorEvent event_type,
|
||||
GimpLink *link)
|
||||
{
|
||||
switch (event_type)
|
||||
{
|
||||
case G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT:
|
||||
if (link->p->idle_changed_source == 0)
|
||||
link->p->idle_changed_source = g_idle_add_full (G_PRIORITY_LOW,
|
||||
gimp_link_emit_changed,
|
||||
link, NULL);
|
||||
break;
|
||||
case G_FILE_MONITOR_EVENT_CREATED:
|
||||
g_signal_emit (link, link_signals[CHANGED], 0);
|
||||
break;
|
||||
case G_FILE_MONITOR_EVENT_DELETED:
|
||||
link->p->broken = TRUE;
|
||||
g_clear_error (&link->p->error);
|
||||
g_set_error_literal (&link->p->error,
|
||||
G_FILE_ERROR, G_FILE_ERROR_FAILED,
|
||||
_("The file got deleted"));
|
||||
break;
|
||||
|
||||
default:
|
||||
/* No need to signal for changes where nothing can be done anyway.
|
||||
* In particular a file deletion, the link is broken, yet we don't
|
||||
* want to re-render.
|
||||
* Don't emit either on G_FILE_MONITOR_EVENT_CHANGED because too
|
||||
* many such events may be emitted for a single file writing.
|
||||
*/
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gimp_link_emit_changed (gpointer data)
|
||||
{
|
||||
GimpLink *link = GIMP_LINK (data);
|
||||
|
||||
gimp_link_update_buffer (link, NULL, NULL);
|
||||
|
||||
g_signal_emit (link, link_signals[CHANGED], 0);
|
||||
link->p->idle_changed_source = 0;
|
||||
|
||||
return G_SOURCE_REMOVE;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_link_update_buffer (GimpLink *link,
|
||||
GimpProgress *progress,
|
||||
GError **error)
|
||||
{
|
||||
GeglBuffer *buffer = NULL;
|
||||
GError *real_error = NULL;
|
||||
|
||||
g_return_if_fail (GIMP_IS_LINK (link));
|
||||
g_return_if_fail (error == NULL || *error == NULL);
|
||||
|
||||
link->p->is_vector = FALSE;
|
||||
g_clear_error (&link->p->error);
|
||||
|
||||
if (link->p->file)
|
||||
{
|
||||
GimpImage *image;
|
||||
GimpPDBStatusType status;
|
||||
const gchar *mime_type = NULL;
|
||||
|
||||
image = file_open_image (link->p->gimp,
|
||||
gimp_get_user_context (link->p->gimp),
|
||||
progress,
|
||||
link->p->file,
|
||||
link->p->width, link->p->height,
|
||||
link->p->keep_ratio,
|
||||
FALSE, NULL,
|
||||
/* XXX We might want interactive opening
|
||||
* for a first opening (when done through
|
||||
* GUI), but not for every re-render.
|
||||
*/
|
||||
GIMP_RUN_NONINTERACTIVE,
|
||||
&link->p->is_vector,
|
||||
&status, &mime_type, &real_error);
|
||||
|
||||
if (image && status == GIMP_PDB_SUCCESS)
|
||||
{
|
||||
/* If we don't flush the projection first, the buffer may be empty.
|
||||
* I do wonder if the flushing and updating of the link could
|
||||
* not be multi-threaded with gimp_projection_flush() instead,
|
||||
* then notifying the update through signals. For very heavy
|
||||
* images, would it be a better UX? XXX
|
||||
*/
|
||||
gimp_projection_flush_now (gimp_image_get_projection (image), TRUE);
|
||||
buffer = gimp_pickable_get_buffer (GIMP_PICKABLE (image));
|
||||
g_object_ref (buffer);
|
||||
|
||||
link->p->base_type = gimp_image_get_base_type (image);
|
||||
link->p->precision = gimp_image_get_precision (image);
|
||||
link->p->width = gimp_image_get_width (image);
|
||||
link->p->height = gimp_image_get_height (image);
|
||||
link->p->load_proc = gimp_image_get_load_proc (image);
|
||||
}
|
||||
|
||||
/* Only keep the buffer, free the rest. */
|
||||
g_clear_object (&image);
|
||||
}
|
||||
|
||||
link->p->broken = (buffer == NULL);
|
||||
if (link->p->broken)
|
||||
{
|
||||
if (real_error)
|
||||
link->p->error = g_error_copy (real_error);
|
||||
else
|
||||
g_set_error_literal (&link->p->error,
|
||||
G_FILE_ERROR, G_FILE_ERROR_FAILED,
|
||||
_("No file was set"));
|
||||
}
|
||||
|
||||
if (error)
|
||||
*error = real_error;
|
||||
else
|
||||
g_clear_error (&real_error);
|
||||
|
||||
if (buffer)
|
||||
{
|
||||
/* Keep the old buffer if the link is broken (outdated image is
|
||||
* better than none).
|
||||
*/
|
||||
g_clear_object (&link->p->buffer);
|
||||
link->p->buffer = buffer;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_link_start_monitoring (GimpLink *link)
|
||||
{
|
||||
link->p->monitor = g_file_monitor_file (link->p->file,
|
||||
G_FILE_MONITOR_WATCH_HARD_LINKS,
|
||||
NULL, NULL);
|
||||
g_signal_connect (link->p->monitor, "changed",
|
||||
G_CALLBACK (gimp_link_file_changed),
|
||||
link);
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_link_get_relative_path:
|
||||
* @link: the image this link is associated with.
|
||||
* @parent: (transfer full): a #GFile object.
|
||||
* @n_back: set it to 0 when calling it initially.
|
||||
*
|
||||
* This is a variant of g_file_get_relative_path() which will work even
|
||||
* when the @link file is not a child of @parent. In this case, the
|
||||
* relative link will use "../" as many times as necessary until a
|
||||
* common parent folder is found.
|
||||
*
|
||||
* In case no parent is found (it may happen for instance on Windows,
|
||||
* with various file system roots), an absolute path is returned
|
||||
* instead, ensuring that we never return %NULL.
|
||||
*
|
||||
* Note that this function takes ownership of @parent and will take care
|
||||
* of freeing it. This allows for tail recursion.
|
||||
*
|
||||
* Returns: a path from @link relatively to @parent, falling back
|
||||
* to an absolute path if a relative path cannot be constructed.
|
||||
**/
|
||||
static gchar *
|
||||
gimp_link_get_relative_path (GimpLink *link,
|
||||
GFile *parent,
|
||||
gint n_back)
|
||||
{
|
||||
gchar *relative_path;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_LINK (link), NULL);
|
||||
g_return_val_if_fail (parent != NULL && n_back >= 0, NULL);
|
||||
|
||||
relative_path = g_file_get_relative_path (parent, link->p->file);
|
||||
|
||||
if (relative_path == NULL)
|
||||
{
|
||||
GFile *grand_parent = g_file_get_parent (parent);
|
||||
|
||||
g_object_unref (parent);
|
||||
|
||||
if (grand_parent == NULL)
|
||||
/* This may happen e.g. on Windows where there are several roots
|
||||
* so it is not always possible to make a relative path.
|
||||
*/
|
||||
return g_file_get_path (link->p->file);
|
||||
else
|
||||
return gimp_link_get_relative_path (link, grand_parent, n_back + 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_object_unref (parent);
|
||||
|
||||
if (n_back > 0)
|
||||
{
|
||||
GStrvBuilder *builder;
|
||||
gchar **array;
|
||||
gchar *dots;
|
||||
gchar *relpath;
|
||||
|
||||
builder = g_strv_builder_new ();
|
||||
for (gint i = 0; i < n_back; i++)
|
||||
g_strv_builder_add (builder, "..");
|
||||
|
||||
array = g_strv_builder_end (builder);
|
||||
dots = g_strjoinv (G_DIR_SEPARATOR_S, array);
|
||||
relpath = g_build_filename (dots, relative_path, NULL);
|
||||
|
||||
g_free (relative_path);
|
||||
g_free (dots);
|
||||
g_strfreev (array);
|
||||
g_strv_builder_unref (builder);
|
||||
|
||||
relative_path = relpath;
|
||||
}
|
||||
|
||||
return relative_path;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* public functions */
|
||||
|
||||
/**
|
||||
* gimp_link_new:
|
||||
* @gimp: #Gimp object.
|
||||
* @file: a #GFile object.
|
||||
*
|
||||
* Creates a new link object. By default, all link objects are created
|
||||
* as being relative to the path of the image they will be associated
|
||||
* with.
|
||||
*
|
||||
* Return value: a new #GimpLink or %NULL in case of a problem
|
||||
**/
|
||||
GimpLink *
|
||||
gimp_link_new (Gimp *gimp,
|
||||
GFile *file,
|
||||
gint vector_width,
|
||||
gint vector_height,
|
||||
gboolean keep_ratio,
|
||||
GimpProgress *progress,
|
||||
GError **error)
|
||||
{
|
||||
GimpLink *link;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
|
||||
g_return_val_if_fail (G_IS_FILE (file), NULL);
|
||||
|
||||
link = g_object_new (GIMP_TYPE_LINK,
|
||||
"gimp", gimp,
|
||||
"absolute-path", FALSE,
|
||||
NULL);
|
||||
|
||||
gimp_link_set_file (link, file, vector_width, vector_height, keep_ratio, progress, error);
|
||||
|
||||
return GIMP_LINK (link);
|
||||
}
|
||||
|
||||
GimpLink *
|
||||
gimp_link_duplicate (GimpLink *link)
|
||||
{
|
||||
GimpLink *new_link;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_LINK (link), NULL);
|
||||
|
||||
new_link = g_object_new (GIMP_TYPE_LINK,
|
||||
"gimp", link->p->gimp,
|
||||
"absolute-path", gimp_link_get_absolute_path (link),
|
||||
NULL);
|
||||
|
||||
/* Copy things manually as we do not need to trigger a load. */
|
||||
new_link->p->file = link->p->file ? g_object_ref (link->p->file) : NULL;
|
||||
|
||||
new_link->p->buffer = link->p->buffer ? gegl_buffer_dup (link->p->buffer) : NULL;
|
||||
new_link->p->broken = link->p->broken;
|
||||
new_link->p->error = link->p->error ? g_error_copy (link->p->error) : NULL;
|
||||
|
||||
new_link->p->is_vector = link->p->is_vector;
|
||||
new_link->p->width = link->p->width;
|
||||
new_link->p->height = link->p->height;
|
||||
new_link->p->base_type = link->p->base_type;
|
||||
new_link->p->precision = link->p->precision;
|
||||
new_link->p->load_proc = link->p->load_proc;
|
||||
|
||||
if (new_link->p->file)
|
||||
{
|
||||
gchar *basename;
|
||||
|
||||
basename = g_file_get_basename (new_link->p->file);
|
||||
gimp_object_set_name_safe (GIMP_OBJECT (new_link), basename);
|
||||
g_free (basename);
|
||||
|
||||
if (gimp_link_is_monitored (link))
|
||||
gimp_link_start_monitoring (new_link);
|
||||
}
|
||||
|
||||
return new_link;
|
||||
}
|
||||
|
||||
/*
|
||||
* gimp_link_get_file:
|
||||
* @link: the #GimpLink object.
|
||||
* @xcf_file: optional XCF file from which @path will be relative to.
|
||||
* @path: optional returned path of the returned file.
|
||||
*
|
||||
* If @path is non-%NULL, it will be set to the file system path for the
|
||||
* returned %GFile, either as an absolute or relative path, depending on
|
||||
* how @link was set.
|
||||
* Note that it is possible for @path to be absolute even when it is set
|
||||
* to be a relative path, in cases where no relative path can be
|
||||
* constructed from @xcf_file.
|
||||
*
|
||||
* Returns: the %GFile which %link is syncing too.
|
||||
*/
|
||||
GFile *
|
||||
gimp_link_get_file (GimpLink *link,
|
||||
GFile *xcf_file,
|
||||
gchar **path)
|
||||
{
|
||||
g_return_val_if_fail (GIMP_IS_LINK (link), NULL);
|
||||
g_return_val_if_fail ((path == NULL && xcf_file == NULL) ||
|
||||
(*path == NULL && xcf_file != NULL &&
|
||||
g_file_has_parent (xcf_file, NULL)), NULL);
|
||||
|
||||
if (path != NULL)
|
||||
{
|
||||
if (link->p->absolute_path)
|
||||
*path = g_file_get_path (link->p->file);
|
||||
else
|
||||
*path = gimp_link_get_relative_path (link,
|
||||
g_file_get_parent (xcf_file),
|
||||
0);
|
||||
}
|
||||
|
||||
return link->p->file;
|
||||
}
|
||||
|
||||
void
|
||||
gimp_link_set_file (GimpLink *link,
|
||||
GFile *file,
|
||||
gint vector_width,
|
||||
gint vector_height,
|
||||
gboolean keep_ratio,
|
||||
GimpProgress *progress,
|
||||
GError **error)
|
||||
{
|
||||
g_return_if_fail (GIMP_IS_LINK (link));
|
||||
g_return_if_fail (G_IS_FILE (file) || file == NULL);
|
||||
g_return_if_fail (error == NULL || *error == NULL);
|
||||
|
||||
if (file == link->p->file ||
|
||||
(file && link->p->file && g_file_equal (file, link->p->file)))
|
||||
{
|
||||
if (link->p->width != vector_width ||
|
||||
link->p->height != vector_height ||
|
||||
link->p->keep_ratio != keep_ratio)
|
||||
gimp_link_set_size (link, vector_width, vector_height, keep_ratio);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
link->p->width = vector_width;
|
||||
link->p->height = vector_height;
|
||||
link->p->keep_ratio = keep_ratio;
|
||||
|
||||
g_clear_object (&link->p->monitor);
|
||||
|
||||
g_set_object (&link->p->file, file);
|
||||
|
||||
gimp_link_update_buffer (link, progress, error);
|
||||
|
||||
if (link->p->file)
|
||||
{
|
||||
gchar *basename;
|
||||
|
||||
basename = g_file_get_basename (link->p->file);
|
||||
gimp_object_set_name_safe (GIMP_OBJECT (link), basename);
|
||||
g_free (basename);
|
||||
|
||||
gimp_link_start_monitoring (link);
|
||||
}
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (link), link_props[PROP_FILE]);
|
||||
}
|
||||
|
||||
gboolean
|
||||
gimp_link_get_absolute_path (GimpLink *link)
|
||||
{
|
||||
g_return_val_if_fail (GIMP_IS_LINK (link), FALSE);
|
||||
|
||||
return link->p->absolute_path;
|
||||
}
|
||||
|
||||
void
|
||||
gimp_link_set_absolute_path (GimpLink *link,
|
||||
gboolean absolute_path)
|
||||
{
|
||||
g_return_if_fail (GIMP_IS_LINK (link));
|
||||
|
||||
link->p->absolute_path = absolute_path;
|
||||
}
|
||||
|
||||
void
|
||||
gimp_link_freeze (GimpLink *link)
|
||||
{
|
||||
g_return_if_fail (GIMP_IS_LINK (link));
|
||||
g_return_if_fail (link->p->monitor != NULL);
|
||||
|
||||
g_clear_object (&link->p->monitor);
|
||||
}
|
||||
|
||||
void
|
||||
gimp_link_thaw (GimpLink *link)
|
||||
{
|
||||
g_return_if_fail (GIMP_IS_LINK (link));
|
||||
g_return_if_fail (G_IS_FILE (link->p->file) && link->p->monitor == NULL);
|
||||
|
||||
gimp_link_update_buffer (link, NULL, NULL);
|
||||
gimp_link_start_monitoring (link);
|
||||
}
|
||||
|
||||
gboolean
|
||||
gimp_link_is_monitored (GimpLink *link)
|
||||
{
|
||||
g_return_val_if_fail (GIMP_IS_LINK (link), FALSE);
|
||||
|
||||
return (link->p->monitor != NULL);
|
||||
}
|
||||
|
||||
gboolean
|
||||
gimp_link_is_broken (GimpLink *link)
|
||||
{
|
||||
g_return_val_if_fail (GIMP_IS_LINK (link), TRUE);
|
||||
|
||||
return link->p->broken;
|
||||
}
|
||||
|
||||
void
|
||||
gimp_link_set_size (GimpLink *link,
|
||||
gint width,
|
||||
gint height,
|
||||
gboolean keep_ratio)
|
||||
{
|
||||
g_return_if_fail (GIMP_IS_LINK (link));
|
||||
|
||||
link->p->width = width;
|
||||
link->p->height = height;
|
||||
link->p->keep_ratio = keep_ratio;
|
||||
|
||||
if (link->p->monitor && link->p->is_vector)
|
||||
gimp_link_update_buffer (link, NULL, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
gimp_link_get_size (GimpLink *link,
|
||||
gint *width,
|
||||
gint *height)
|
||||
{
|
||||
g_return_if_fail (GIMP_IS_LINK (link));
|
||||
|
||||
*width = link->p->width;
|
||||
*height = link->p->height;
|
||||
}
|
||||
|
||||
GimpImageBaseType
|
||||
gimp_link_get_base_type (GimpLink *link)
|
||||
{
|
||||
g_return_val_if_fail (GIMP_IS_LINK (link) && ! link->p->broken, GIMP_RGB);
|
||||
|
||||
return link->p->base_type;
|
||||
}
|
||||
|
||||
GimpPrecision
|
||||
gimp_link_get_precision (GimpLink *link)
|
||||
{
|
||||
g_return_val_if_fail (GIMP_IS_LINK (link) && ! link->p->broken, GIMP_PRECISION_U8_PERCEPTUAL);
|
||||
|
||||
return link->p->precision;
|
||||
}
|
||||
|
||||
GimpPlugInProcedure *
|
||||
gimp_link_get_load_proc (GimpLink *link)
|
||||
{
|
||||
g_return_val_if_fail (GIMP_IS_LINK (link) && ! link->p->broken, NULL);
|
||||
|
||||
return link->p->load_proc;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gimp_link_is_vector (GimpLink *link)
|
||||
{
|
||||
g_return_val_if_fail (GIMP_IS_LINK (link), FALSE);
|
||||
|
||||
return link->p->is_vector;
|
||||
}
|
||||
|
||||
GeglBuffer *
|
||||
gimp_link_get_buffer (GimpLink *link)
|
||||
{
|
||||
g_return_val_if_fail (GIMP_IS_LINK (link), NULL);
|
||||
|
||||
return link->p->buffer;
|
||||
}
|
95
app/core/gimplink.h
Normal file
95
app/core/gimplink.h
Normal file
@@ -0,0 +1,95 @@
|
||||
/* GIMP - The GNU Image Manipulation Program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* GimpLink
|
||||
* Copyright (C) 2019 Jehan
|
||||
*
|
||||
* 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 3 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, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "gimpitem.h"
|
||||
|
||||
|
||||
#define GIMP_TYPE_LINK (gimp_link_get_type ())
|
||||
#define GIMP_LINK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_LINK, GimpLink))
|
||||
#define GIMP_LINK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_LINK, GimpLinkClass))
|
||||
#define GIMP_IS_LINK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_LINK))
|
||||
#define GIMP_IS_LINK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_LINK))
|
||||
#define GIMP_LINK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_LINK, GimpLinkClass))
|
||||
|
||||
|
||||
typedef struct _GimpLinkClass GimpLinkClass;
|
||||
typedef struct _GimpLinkPrivate GimpLinkPrivate;
|
||||
|
||||
struct _GimpLink
|
||||
{
|
||||
GimpObject parent_instance;
|
||||
|
||||
GimpLinkPrivate *p;
|
||||
};
|
||||
|
||||
struct _GimpLinkClass
|
||||
{
|
||||
GimpObjectClass parent_class;
|
||||
|
||||
void (* changed) (GimpLink *link);
|
||||
};
|
||||
|
||||
|
||||
GType gimp_link_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GimpLink * gimp_link_new (Gimp *gimp,
|
||||
GFile *file,
|
||||
gint vector_width,
|
||||
gint vector_height,
|
||||
gboolean keep_ratio,
|
||||
GimpProgress *progress,
|
||||
GError **error);
|
||||
GimpLink * gimp_link_duplicate (GimpLink *link);
|
||||
|
||||
GFile * gimp_link_get_file (GimpLink *link,
|
||||
GFile *parent,
|
||||
gchar **path);
|
||||
void gimp_link_set_file (GimpLink *layer,
|
||||
GFile *file,
|
||||
gint vector_width,
|
||||
gint vector_height,
|
||||
gboolean keep_ratio,
|
||||
GimpProgress *progress,
|
||||
GError **error);
|
||||
gboolean gimp_link_get_absolute_path (GimpLink *link);
|
||||
void gimp_link_set_absolute_path (GimpLink *link,
|
||||
gboolean absolute_path);
|
||||
void gimp_link_freeze (GimpLink *link);
|
||||
void gimp_link_thaw (GimpLink *link);
|
||||
gboolean gimp_link_is_monitored (GimpLink *link);
|
||||
|
||||
gboolean gimp_link_is_broken (GimpLink *link);
|
||||
|
||||
void gimp_link_set_size (GimpLink *link,
|
||||
gint width,
|
||||
gint height,
|
||||
gboolean keep_ratio);
|
||||
void gimp_link_get_size (GimpLink *link,
|
||||
gint *width,
|
||||
gint *height);
|
||||
GimpImageBaseType gimp_link_get_base_type (GimpLink *link);
|
||||
GimpPrecision gimp_link_get_precision (GimpLink *link);
|
||||
GimpPlugInProcedure * gimp_link_get_load_proc (GimpLink *link);
|
||||
|
||||
gboolean gimp_link_is_vector (GimpLink *link);
|
||||
|
||||
GeglBuffer * gimp_link_get_buffer (GimpLink *link);
|
1137
app/core/gimplinklayer.c
Normal file
1137
app/core/gimplinklayer.c
Normal file
File diff suppressed because it is too large
Load Diff
87
app/core/gimplinklayer.h
Normal file
87
app/core/gimplinklayer.h
Normal file
@@ -0,0 +1,87 @@
|
||||
/* GIMP - The GNU Image Manipulation Program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* GimpLinkLayer
|
||||
* Copyright (C) 2019 Jehan
|
||||
*
|
||||
* 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 3 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, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "gimplayer.h"
|
||||
|
||||
|
||||
#define GIMP_TYPE_LINK_LAYER (gimp_link_layer_get_type ())
|
||||
#define GIMP_LINK_LAYER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_LINK_LAYER, GimpLinkLayer))
|
||||
#define GIMP_LINK_LAYER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_LINK_LAYER, GimpLinkLayerClass))
|
||||
#define GIMP_IS_LINK_LAYER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_LINK_LAYER))
|
||||
#define GIMP_IS_LINK_LAYER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_LINK_LAYER))
|
||||
#define GIMP_LINK_LAYER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_LINK_LAYER, GimpLinkLayerClass))
|
||||
|
||||
|
||||
typedef struct _GimpLinkLayerClass GimpLinkLayerClass;
|
||||
typedef struct _GimpLinkLayerPrivate GimpLinkLayerPrivate;
|
||||
|
||||
struct _GimpLinkLayer
|
||||
{
|
||||
GimpLayer layer;
|
||||
|
||||
GimpLinkLayerPrivate *p;
|
||||
};
|
||||
|
||||
struct _GimpLinkLayerClass
|
||||
{
|
||||
GimpLayerClass parent_class;
|
||||
};
|
||||
|
||||
|
||||
GType gimp_link_layer_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GimpLayer * gimp_link_layer_new (GimpImage *image,
|
||||
GimpLink *link);
|
||||
|
||||
GimpLink * gimp_link_layer_get_link (GimpLinkLayer *layer);
|
||||
gboolean gimp_link_layer_set_link (GimpLinkLayer *layer,
|
||||
GimpLink *link,
|
||||
gboolean push_undo);
|
||||
gboolean gimp_link_layer_set_link_with_matrix (GimpLinkLayer *layer,
|
||||
GimpLink *link,
|
||||
GimpMatrix3 *matrix,
|
||||
GimpInterpolationType interpolation_type,
|
||||
gint offset_x,
|
||||
gint offset_y,
|
||||
gboolean push_undo);
|
||||
|
||||
void gimp_link_layer_discard (GimpLinkLayer *layer);
|
||||
void gimp_link_layer_monitor (GimpLinkLayer *layer);
|
||||
gboolean gimp_link_layer_is_monitored (GimpLinkLayer *layer);
|
||||
|
||||
gboolean gimp_link_layer_get_transform (GimpLinkLayer *layer,
|
||||
GimpMatrix3 *matrix,
|
||||
gint *offset_x,
|
||||
gint *offset_y,
|
||||
GimpInterpolationType *interpolation);
|
||||
gboolean gimp_link_layer_set_transform (GimpLinkLayer *layer,
|
||||
GimpMatrix3 *matrix,
|
||||
GimpInterpolationType interpolation_type,
|
||||
gboolean push_undo);
|
||||
|
||||
gboolean gimp_item_is_link_layer (GimpItem *item);
|
||||
|
||||
/* Only to be used for XCF loading/saving. */
|
||||
|
||||
guint32 gimp_link_layer_get_xcf_flags (GimpLinkLayer *layer);
|
||||
void gimp_link_layer_set_xcf_flags (GimpLinkLayer *layer,
|
||||
guint32 flags);
|
218
app/core/gimplinklayerundo.c
Normal file
218
app/core/gimplinklayerundo.c
Normal file
@@ -0,0 +1,218 @@
|
||||
/* GIMP - The GNU Image Manipulation Program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* Copyright (C) 2019 Jehan
|
||||
*
|
||||
* 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 3 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, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <gdk-pixbuf/gdk-pixbuf.h>
|
||||
#include <gegl.h>
|
||||
|
||||
#include "libgimpbase/gimpbase.h"
|
||||
|
||||
#include "core-types.h"
|
||||
|
||||
#include "gimpimage.h"
|
||||
#include "gimplayer.h"
|
||||
#include "gimplink.h"
|
||||
#include "gimplinklayer.h"
|
||||
#include "gimplinklayerundo.h"
|
||||
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
PROP_PREV_LINK
|
||||
};
|
||||
|
||||
|
||||
static void gimp_link_layer_undo_constructed (GObject *object);
|
||||
static void gimp_link_layer_undo_finalize (GObject *object);
|
||||
static void gimp_link_layer_undo_set_property (GObject *object,
|
||||
guint property_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gimp_link_layer_undo_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
|
||||
static gint64 gimp_link_layer_undo_get_memsize (GimpObject *object,
|
||||
gint64 *gui_size);
|
||||
|
||||
static void gimp_link_layer_undo_pop (GimpUndo *undo,
|
||||
GimpUndoMode undo_mode,
|
||||
GimpUndoAccumulator *accum);
|
||||
|
||||
|
||||
G_DEFINE_TYPE (GimpLinkLayerUndo, gimp_link_layer_undo, GIMP_TYPE_ITEM_UNDO)
|
||||
|
||||
#define parent_class gimp_link_layer_undo_parent_class
|
||||
|
||||
|
||||
static void
|
||||
gimp_link_layer_undo_class_init (GimpLinkLayerUndoClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
GimpObjectClass *gimp_object_class = GIMP_OBJECT_CLASS (klass);
|
||||
GimpUndoClass *undo_class = GIMP_UNDO_CLASS (klass);
|
||||
|
||||
object_class->constructed = gimp_link_layer_undo_constructed;
|
||||
object_class->finalize = gimp_link_layer_undo_finalize;
|
||||
object_class->set_property = gimp_link_layer_undo_set_property;
|
||||
object_class->get_property = gimp_link_layer_undo_get_property;
|
||||
|
||||
gimp_object_class->get_memsize = gimp_link_layer_undo_get_memsize;
|
||||
|
||||
undo_class->pop = gimp_link_layer_undo_pop;
|
||||
|
||||
g_object_class_install_property (object_class, PROP_PREV_LINK,
|
||||
g_param_spec_object ("prev-link",
|
||||
NULL, NULL,
|
||||
GIMP_TYPE_LINK,
|
||||
GIMP_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT_ONLY));
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_link_layer_undo_init (GimpLinkLayerUndo *undo)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_link_layer_undo_constructed (GObject *object)
|
||||
{
|
||||
GimpLinkLayerUndo *undo = GIMP_LINK_LAYER_UNDO (object);
|
||||
GimpLinkLayer *layer;
|
||||
GimpLink *link;
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->constructed (object);
|
||||
|
||||
gimp_assert (GIMP_IS_LINK_LAYER (GIMP_ITEM_UNDO (object)->item));
|
||||
|
||||
layer = GIMP_LINK_LAYER (GIMP_ITEM_UNDO (undo)->item);
|
||||
|
||||
link = gimp_link_layer_get_link (layer);
|
||||
undo->link = link ? gimp_link_duplicate (link) : NULL;
|
||||
gimp_link_layer_get_transform (layer,
|
||||
&undo->matrix,
|
||||
&undo->offset_x,
|
||||
&undo->offset_y,
|
||||
&undo->interpolation);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_link_layer_undo_finalize (GObject *object)
|
||||
{
|
||||
GimpLinkLayerUndo *undo = GIMP_LINK_LAYER_UNDO (object);
|
||||
|
||||
g_clear_object (&undo->link);
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_link_layer_undo_set_property (GObject *object,
|
||||
guint property_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GimpLinkLayerUndo *undo = GIMP_LINK_LAYER_UNDO (object);
|
||||
|
||||
switch (property_id)
|
||||
{
|
||||
case PROP_PREV_LINK:
|
||||
g_clear_object (&undo->link);
|
||||
undo->link = g_value_get_object (value) ? gimp_link_duplicate (g_value_get_object (value)) : NULL;
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_link_layer_undo_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GimpLinkLayerUndo *undo = GIMP_LINK_LAYER_UNDO (object);
|
||||
|
||||
switch (property_id)
|
||||
{
|
||||
case PROP_PREV_LINK:
|
||||
g_value_set_object (value, undo->link);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static gint64
|
||||
gimp_link_layer_undo_get_memsize (GimpObject *object,
|
||||
gint64 *gui_size)
|
||||
{
|
||||
GimpItemUndo *item_undo = GIMP_ITEM_UNDO (object);
|
||||
gint64 memsize = 0;
|
||||
|
||||
if (! gimp_item_is_attached (item_undo->item))
|
||||
memsize += gimp_object_get_memsize (GIMP_OBJECT (item_undo->item),
|
||||
gui_size);
|
||||
|
||||
return memsize + GIMP_OBJECT_CLASS (parent_class)->get_memsize (object,
|
||||
gui_size);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_link_layer_undo_pop (GimpUndo *undo,
|
||||
GimpUndoMode undo_mode,
|
||||
GimpUndoAccumulator *accum)
|
||||
{
|
||||
GimpLinkLayerUndo *layer_undo = GIMP_LINK_LAYER_UNDO (undo);
|
||||
GimpLinkLayer *layer = GIMP_LINK_LAYER (GIMP_ITEM_UNDO (undo)->item);
|
||||
GimpLink *link;
|
||||
GimpMatrix3 matrix;
|
||||
gint offset_x;
|
||||
gint offset_y;
|
||||
GimpInterpolationType interpolation;
|
||||
|
||||
GIMP_UNDO_CLASS (parent_class)->pop (undo, undo_mode, accum);
|
||||
|
||||
link = gimp_link_layer_get_link (layer);
|
||||
link = link ? g_object_ref (link) : NULL;
|
||||
|
||||
gimp_link_layer_get_transform (layer, &matrix, &offset_x, &offset_y, &interpolation);
|
||||
gimp_link_layer_set_link_with_matrix (layer, layer_undo->link,
|
||||
&layer_undo->matrix,
|
||||
layer_undo->interpolation,
|
||||
layer_undo->offset_x,
|
||||
layer_undo->offset_y,
|
||||
FALSE);
|
||||
|
||||
|
||||
layer_undo->matrix = matrix;
|
||||
layer_undo->interpolation = interpolation;
|
||||
layer_undo->offset_x = offset_x;
|
||||
layer_undo->offset_y = offset_y;
|
||||
|
||||
g_clear_object (&layer_undo->link);
|
||||
layer_undo->link = link;
|
||||
}
|
53
app/core/gimplinklayerundo.h
Normal file
53
app/core/gimplinklayerundo.h
Normal file
@@ -0,0 +1,53 @@
|
||||
/* GIMP - The GNU Image Manipulation Program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* Copyright (C) 2019 Jehan
|
||||
*
|
||||
* 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 3 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, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "gimpitemundo.h"
|
||||
|
||||
|
||||
#define GIMP_TYPE_LINK_LAYER_UNDO (gimp_link_layer_undo_get_type ())
|
||||
#define GIMP_LINK_LAYER_UNDO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_LINK_LAYER_UNDO, GimpLinkLayerUndo))
|
||||
#define GIMP_LINK_LAYER_UNDO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_LINK_LAYER_UNDO, GimpLinkLayerUndoClass))
|
||||
#define GIMP_IS_LINK_LAYER_UNDO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_LINK_LAYER_UNDO))
|
||||
#define GIMP_IS_LINK_LAYER_UNDO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_LINK_LAYER_UNDO))
|
||||
#define GIMP_LINK_LAYER_UNDO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_LINK_LAYER_UNDO, GimpLinkLayerUndoClass))
|
||||
|
||||
|
||||
typedef struct _GimpLinkLayerUndo GimpLinkLayerUndo;
|
||||
typedef struct _GimpLinkLayerUndoClass GimpLinkLayerUndoClass;
|
||||
|
||||
struct _GimpLinkLayerUndo
|
||||
{
|
||||
GimpItemUndo parent_instance;
|
||||
|
||||
GimpLink *link;
|
||||
GimpMatrix3 matrix;
|
||||
gint offset_x;
|
||||
gint offset_y;
|
||||
GimpInterpolationType interpolation;
|
||||
};
|
||||
|
||||
struct _GimpLinkLayerUndoClass
|
||||
{
|
||||
GimpItemUndoClass parent_class;
|
||||
};
|
||||
|
||||
|
||||
GType gimp_link_layer_undo_get_type (void) G_GNUC_CONST;
|
@@ -207,7 +207,7 @@ gimp_palette_import_create_image_palette (gpointer data,
|
||||
gint n_colors;
|
||||
gchar *lab;
|
||||
GeglColor *color;
|
||||
guint8 rgb[3];
|
||||
guint8 rgb[4];
|
||||
|
||||
n_colors = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (palette),
|
||||
"import-n-colors"));
|
||||
@@ -228,6 +228,12 @@ gimp_palette_import_create_image_palette (gpointer data,
|
||||
rgb[0] = (guchar) color_tab->r + (color_tab->r_adj / color_tab->count);
|
||||
rgb[1] = (guchar) color_tab->g + (color_tab->g_adj / color_tab->count);
|
||||
rgb[2] = (guchar) color_tab->b + (color_tab->b_adj / color_tab->count);
|
||||
/* TODO: We only receive the RGB values, so if the format has alpha, it
|
||||
* becomes transparent when used outside of a palette. For now, we'll set
|
||||
* alpha to 255, but in the future, a less RGB-specific implementation
|
||||
* would be ideal */
|
||||
if (babl_format_has_alpha (format))
|
||||
rgb[3] = 255;
|
||||
|
||||
gegl_color_set_pixel (color, format, rgb);
|
||||
|
||||
|
@@ -872,7 +872,7 @@ gimp_palette_load_acb (GimpContext *context,
|
||||
{
|
||||
g_free (palette_entry);
|
||||
g_free (full_palette_name);
|
||||
g_object_unref (color);
|
||||
g_clear_object (&color);
|
||||
|
||||
g_printerr ("Invalid ACB palette color code");
|
||||
break;
|
||||
@@ -880,63 +880,65 @@ gimp_palette_load_acb (GimpContext *context,
|
||||
|
||||
if (color_space == 0)
|
||||
{
|
||||
gchar rgb[3];
|
||||
guchar rgb[3];
|
||||
|
||||
if (! g_input_stream_read_all (input, rgb, sizeof (rgb),
|
||||
&bytes_read, NULL, error))
|
||||
{
|
||||
g_free (palette_entry);
|
||||
g_free (full_palette_name);
|
||||
g_object_unref (color);
|
||||
g_clear_object (&color);
|
||||
|
||||
g_printerr ("Invalid ACB palette colors");
|
||||
break;
|
||||
}
|
||||
|
||||
gegl_color_set_pixel (color, babl_format ("R'G'B u8"), rgb);
|
||||
gegl_color_set_pixel (color, babl_format ("R'G'B' u8"), rgb);
|
||||
color_ok = TRUE;
|
||||
}
|
||||
else if (color_space == 2)
|
||||
{
|
||||
gchar cmyk[4];
|
||||
guchar cmyk[4];
|
||||
gfloat cmyk_f[4];
|
||||
|
||||
if (! g_input_stream_read_all (input, cmyk, sizeof (cmyk),
|
||||
&bytes_read, NULL, error))
|
||||
{
|
||||
g_free (palette_entry);
|
||||
g_free (full_palette_name);
|
||||
g_object_unref (color);
|
||||
g_clear_object (&color);
|
||||
|
||||
g_printerr ("Invalid ACB palette colors");
|
||||
break;
|
||||
}
|
||||
|
||||
for (gint j = 0; j < 4; j++)
|
||||
cmyk[j] = ((255 - cmyk[j]) / 2.55f) + 0.5f;
|
||||
cmyk_f[j] = (((255 - cmyk[j]) / 2.55f) + 0.5f) / 100.0f;
|
||||
|
||||
gegl_color_set_pixel (color, babl_format ("cmyk u8"), cmyk);
|
||||
gegl_color_set_pixel (color, babl_format ("CMYK float"), cmyk_f);
|
||||
color_ok = TRUE;
|
||||
}
|
||||
else if (color_space == 7)
|
||||
{
|
||||
gchar lab[3];
|
||||
guchar lab[3];
|
||||
gfloat lab_f[3];
|
||||
|
||||
if (! g_input_stream_read_all (input, lab, sizeof (lab),
|
||||
&bytes_read, NULL, error))
|
||||
{
|
||||
g_free (palette_entry);
|
||||
g_free (full_palette_name);
|
||||
g_object_unref (color);
|
||||
g_clear_object (&color);
|
||||
|
||||
g_printerr ("Invalid ACB palette colors");
|
||||
break;
|
||||
}
|
||||
|
||||
lab[0] = (lab[0] / 2.55f) + 0.5f;
|
||||
lab[1] = lab[1] - 128;
|
||||
lab[2] = lab[2] - 128;
|
||||
lab_f[0] = (lab[0] / 2.55f) + 0.5f;
|
||||
lab_f[1] = ((gfloat) lab[1]) - 128;
|
||||
lab_f[2] = ((gfloat) lab[2]) - 128;
|
||||
|
||||
gegl_color_set_pixel (color, babl_format ("CIE Lab u8"), lab);
|
||||
gegl_color_set_pixel (color, babl_format ("CIE Lab float"), lab_f);
|
||||
color_ok = TRUE;
|
||||
}
|
||||
|
||||
@@ -945,7 +947,7 @@ gimp_palette_load_acb (GimpContext *context,
|
||||
|
||||
g_free (palette_entry);
|
||||
g_free (full_palette_name);
|
||||
g_object_unref (color);
|
||||
g_clear_object (&color);
|
||||
|
||||
if (! color_ok)
|
||||
{
|
||||
|
@@ -76,8 +76,7 @@ static GimpTempBuf * gimp_palette_get_new_preview (GimpViewable *vie
|
||||
GimpContext *context,
|
||||
gint width,
|
||||
gint height,
|
||||
GeglColor *color,
|
||||
GeglColor *background);
|
||||
GeglColor *fg_color);
|
||||
static gchar * gimp_palette_get_description (GimpViewable *viewable,
|
||||
gchar **tooltip);
|
||||
static const gchar * gimp_palette_get_extension (GimpData *data);
|
||||
@@ -243,8 +242,7 @@ gimp_palette_get_new_preview (GimpViewable *viewable,
|
||||
GimpContext *context,
|
||||
gint width,
|
||||
gint height,
|
||||
GeglColor *color G_GNUC_UNUSED,
|
||||
GeglColor *background G_GNUC_UNUSED)
|
||||
GeglColor *fg_color G_GNUC_UNUSED)
|
||||
{
|
||||
GimpPalette *palette = GIMP_PALETTE (viewable);
|
||||
GimpTempBuf *temp_buf;
|
||||
@@ -498,11 +496,7 @@ gimp_palette_restrict_format (GimpPalette *palette,
|
||||
|
||||
if (push_undo_if_image && gimp_data_get_image (GIMP_DATA (palette)))
|
||||
gimp_image_undo_push_image_colormap (gimp_data_get_image (GIMP_DATA (palette)),
|
||||
/* TODO: use localized string
|
||||
* after string freeze.
|
||||
*/
|
||||
/*C_("undo-type", "Change Colormap format restriction"));*/
|
||||
"Change Colormap format restriction");
|
||||
C_("undo-type", "Change Colormap format restriction"));
|
||||
palette->format = format;
|
||||
|
||||
if (palette->format == NULL)
|
||||
|
@@ -42,6 +42,7 @@
|
||||
#include "gimpselection.h"
|
||||
|
||||
#include "path/gimppath.h"
|
||||
#include "path/gimpvectorlayer.h"
|
||||
|
||||
#include "text/gimpfont.h"
|
||||
#include "text/gimptextlayer.h"
|
||||
|
@@ -50,8 +50,7 @@ static GimpTempBuf * gimp_pattern_get_new_preview (GimpViewable *viewa
|
||||
GimpContext *context,
|
||||
gint width,
|
||||
gint height,
|
||||
GeglColor *color,
|
||||
GeglColor *background);
|
||||
GeglColor *fg_color);
|
||||
static gchar * gimp_pattern_get_description (GimpViewable *viewable,
|
||||
gchar **tooltip);
|
||||
|
||||
@@ -145,8 +144,7 @@ gimp_pattern_get_new_preview (GimpViewable *viewable,
|
||||
GimpContext *context,
|
||||
gint width,
|
||||
gint height,
|
||||
GeglColor *color G_GNUC_UNUSED,
|
||||
GeglColor *background G_GNUC_UNUSED)
|
||||
GeglColor *fg_color G_GNUC_UNUSED)
|
||||
{
|
||||
GimpPattern *pattern = GIMP_PATTERN (viewable);
|
||||
GimpTempBuf *temp_buf;
|
||||
|
@@ -83,8 +83,7 @@ static GimpTempBuf * gimp_undo_get_new_preview (GimpViewable *viewabl
|
||||
GimpContext *context,
|
||||
gint width,
|
||||
gint height,
|
||||
GeglColor *color,
|
||||
GeglColor *background);
|
||||
GeglColor *fg_color);
|
||||
|
||||
static void gimp_undo_real_pop (GimpUndo *undo,
|
||||
GimpUndoMode undo_mode,
|
||||
@@ -304,8 +303,7 @@ gimp_undo_get_new_preview (GimpViewable *viewable,
|
||||
GimpContext *context,
|
||||
gint width,
|
||||
gint height,
|
||||
GeglColor *color G_GNUC_UNUSED,
|
||||
GeglColor *background G_GNUC_UNUSED)
|
||||
GeglColor *fg_color G_GNUC_UNUSED)
|
||||
{
|
||||
GimpUndo *undo = GIMP_UNDO (viewable);
|
||||
|
||||
@@ -495,7 +493,7 @@ gimp_undo_create_preview_private (GimpUndo *undo,
|
||||
}
|
||||
|
||||
undo->preview = gimp_viewable_get_new_preview (preview_viewable, context,
|
||||
width, height, NULL, NULL);
|
||||
width, height, NULL);
|
||||
|
||||
gimp_viewable_invalidate_preview (GIMP_VIEWABLE (undo));
|
||||
}
|
||||
|
@@ -75,11 +75,10 @@ struct _GimpViewablePrivate
|
||||
gint depth;
|
||||
|
||||
GimpTempBuf *preview_temp_buf;
|
||||
GeglColor *preview_temp_buf_color;
|
||||
|
||||
GdkPixbuf *preview_pixbuf;
|
||||
GeglColor *preview_pixbuf_color;
|
||||
GeglColor *preview_pixbuf_background;
|
||||
GeglColor *preview_temp_buf_color;
|
||||
GeglColor *preview_temp_buf_background;
|
||||
};
|
||||
|
||||
#define GET_PRIVATE(viewable) \
|
||||
@@ -108,8 +107,7 @@ static GdkPixbuf * gimp_viewable_real_get_new_pixbuf (GimpViewable *viewable,
|
||||
GimpContext *context,
|
||||
gint width,
|
||||
gint height,
|
||||
GeglColor *color,
|
||||
GeglColor *background);
|
||||
GeglColor *fg_color);
|
||||
static void gimp_viewable_real_get_preview_size (GimpViewable *viewable,
|
||||
gint size,
|
||||
gboolean popup,
|
||||
@@ -255,13 +253,11 @@ gimp_viewable_finalize (GObject *object)
|
||||
GimpViewablePrivate *private = GET_PRIVATE (object);
|
||||
|
||||
g_clear_pointer (&private->icon_name, g_free);
|
||||
g_clear_object (&private->icon_pixbuf);
|
||||
g_clear_object (&private->icon_pixbuf);
|
||||
g_clear_pointer (&private->preview_temp_buf, gimp_temp_buf_unref);
|
||||
g_clear_object (&private->preview_pixbuf);
|
||||
g_clear_object (&private->preview_pixbuf_color);
|
||||
g_clear_object (&private->preview_pixbuf_background);
|
||||
g_clear_object (&private->preview_temp_buf_color);
|
||||
g_clear_object (&private->preview_temp_buf_background);
|
||||
g_clear_object (&private->preview_temp_buf_color);
|
||||
g_clear_object (&private->preview_pixbuf);
|
||||
g_clear_object (&private->preview_pixbuf_color);
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
@@ -345,11 +341,9 @@ gimp_viewable_real_invalidate_preview (GimpViewable *viewable)
|
||||
GimpViewablePrivate *private = GET_PRIVATE (viewable);
|
||||
|
||||
g_clear_pointer (&private->preview_temp_buf, gimp_temp_buf_unref);
|
||||
g_clear_object (&private->preview_pixbuf);
|
||||
g_clear_object (&private->preview_pixbuf_color);
|
||||
g_clear_object (&private->preview_pixbuf_background);
|
||||
g_clear_object (&private->preview_temp_buf_color);
|
||||
g_clear_object (&private->preview_temp_buf_background);
|
||||
g_clear_object (&private->preview_temp_buf_color);
|
||||
g_clear_object (&private->preview_pixbuf);
|
||||
g_clear_object (&private->preview_pixbuf_color);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -419,14 +413,15 @@ gimp_viewable_real_get_new_pixbuf (GimpViewable *viewable,
|
||||
GimpContext *context,
|
||||
gint width,
|
||||
gint height,
|
||||
GeglColor *color,
|
||||
GeglColor *background)
|
||||
GeglColor *fg_color)
|
||||
{
|
||||
GimpViewablePrivate *private = GET_PRIVATE (viewable);
|
||||
GdkPixbuf *pixbuf = NULL;
|
||||
GimpTempBuf *temp_buf;
|
||||
|
||||
temp_buf = gimp_viewable_get_preview (viewable, context, width, height, color, background);
|
||||
temp_buf = gimp_viewable_get_preview (viewable, context,
|
||||
width, height,
|
||||
fg_color);
|
||||
|
||||
if (temp_buf)
|
||||
{
|
||||
@@ -697,12 +692,18 @@ gimp_viewable_calc_preview_size (gint aspect_width,
|
||||
}
|
||||
|
||||
gboolean
|
||||
gimp_viewable_has_preview (GimpViewable *viewable)
|
||||
gimp_viewable_has_preview (GimpViewable *viewable)
|
||||
{
|
||||
GimpViewableClass *viewable_class;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_VIEWABLE (viewable), FALSE);
|
||||
|
||||
return (GIMP_VIEWABLE_GET_CLASS (viewable)->get_preview != NULL ||
|
||||
GIMP_VIEWABLE_GET_CLASS (viewable)->get_new_preview != NULL);
|
||||
viewable_class = GIMP_VIEWABLE_GET_CLASS (viewable);
|
||||
|
||||
return (viewable_class->get_preview ||
|
||||
viewable_class->get_new_preview ||
|
||||
viewable_class->get_pixbuf ||
|
||||
viewable_class->get_new_pixbuf);
|
||||
}
|
||||
|
||||
gboolean
|
||||
@@ -853,10 +854,8 @@ gimp_viewable_get_popup_size (GimpViewable *viewable,
|
||||
* @context: The context to render the preview for.
|
||||
* @width: desired width for the preview
|
||||
* @height: desired height for the preview
|
||||
* @color: desired foreground color for the preview when the type of
|
||||
* @fg_color :desired foreground color for the preview when the type of
|
||||
* @viewable support recolorization.
|
||||
* @background: desired background color for the preview when the type
|
||||
* of @viewable supports recolorization.
|
||||
*
|
||||
* Gets a preview for a viewable object, by running through a variety
|
||||
* of methods until it finds one that works. First, if an
|
||||
@@ -882,8 +881,7 @@ gimp_viewable_get_preview (GimpViewable *viewable,
|
||||
GimpContext *context,
|
||||
gint width,
|
||||
gint height,
|
||||
GeglColor *color,
|
||||
GeglColor *background)
|
||||
GeglColor *fg_color)
|
||||
{
|
||||
GimpViewablePrivate *private = GET_PRIVATE (viewable);
|
||||
GimpViewableClass *viewable_class;
|
||||
@@ -893,8 +891,6 @@ gimp_viewable_get_preview (GimpViewable *viewable,
|
||||
g_return_val_if_fail (context == NULL || GIMP_IS_CONTEXT (context), NULL);
|
||||
g_return_val_if_fail (width > 0, NULL);
|
||||
g_return_val_if_fail (height > 0, NULL);
|
||||
g_return_val_if_fail ((color == NULL && background == NULL) ||
|
||||
(color != NULL && background != NULL), NULL);
|
||||
|
||||
if (G_UNLIKELY (context == NULL))
|
||||
g_warning ("%s: context is NULL", G_STRFUNC);
|
||||
@@ -902,21 +898,23 @@ gimp_viewable_get_preview (GimpViewable *viewable,
|
||||
viewable_class = GIMP_VIEWABLE_GET_CLASS (viewable);
|
||||
|
||||
if (viewable_class->get_preview)
|
||||
temp_buf = viewable_class->get_preview (viewable, context, width, height, color, background);
|
||||
temp_buf = viewable_class->get_preview (viewable, context,
|
||||
width, height,
|
||||
fg_color);
|
||||
|
||||
if (temp_buf)
|
||||
return temp_buf;
|
||||
|
||||
if (private->preview_temp_buf &&
|
||||
((color == NULL && private->preview_temp_buf_color == NULL) ||
|
||||
(color != NULL && private->preview_temp_buf_color != NULL)))
|
||||
((fg_color == NULL && private->preview_temp_buf_color == NULL) ||
|
||||
(fg_color != NULL && private->preview_temp_buf_color != NULL)))
|
||||
{
|
||||
if (gimp_temp_buf_get_width (private->preview_temp_buf) == width &&
|
||||
gimp_temp_buf_get_height (private->preview_temp_buf) == height)
|
||||
{
|
||||
gboolean same_colors = TRUE;
|
||||
|
||||
if (color != NULL)
|
||||
if (fg_color)
|
||||
{
|
||||
gdouble r1, g1, b1, a1;
|
||||
gdouble r2, g2, b2, a2;
|
||||
@@ -924,18 +922,12 @@ gimp_viewable_get_preview (GimpViewable *viewable,
|
||||
/* Don't use gimp_color_is_perceptually_identical(). Exact
|
||||
* comparison is fine for this use case.
|
||||
*/
|
||||
gegl_color_get_rgba (color, &r1, &g1, &b1, &a1);
|
||||
gegl_color_get_rgba (private->preview_temp_buf_color, &r2, &g2, &b2, &a2);
|
||||
gegl_color_get_rgba (fg_color,
|
||||
&r1, &g1, &b1, &a1);
|
||||
gegl_color_get_rgba (private->preview_temp_buf_color,
|
||||
&r2, &g2, &b2, &a2);
|
||||
|
||||
same_colors = (r1 == r2 && g1 == g2 && b1 == b2 && a1 == a2);
|
||||
|
||||
if (same_colors)
|
||||
{
|
||||
gegl_color_get_rgba (background, &r1, &g1, &b1, &a1);
|
||||
gegl_color_get_rgba (private->preview_temp_buf_background, &r2, &g2, &b2, &a2);
|
||||
|
||||
same_colors = (r1 == r2 && g1 == g2 && b1 == b2 && a1 == a2);
|
||||
}
|
||||
}
|
||||
|
||||
if (same_colors)
|
||||
@@ -945,15 +937,15 @@ gimp_viewable_get_preview (GimpViewable *viewable,
|
||||
|
||||
g_clear_pointer (&private->preview_temp_buf, gimp_temp_buf_unref);
|
||||
g_clear_object (&private->preview_temp_buf_color);
|
||||
g_clear_object (&private->preview_temp_buf_background);
|
||||
|
||||
if (viewable_class->get_new_preview)
|
||||
temp_buf = viewable_class->get_new_preview (viewable, context,
|
||||
width, height, color, background);
|
||||
width, height,
|
||||
fg_color);
|
||||
|
||||
private->preview_temp_buf = temp_buf;
|
||||
private->preview_temp_buf_color = color ? gegl_color_duplicate (color) : NULL;
|
||||
private->preview_temp_buf_background = background ? gegl_color_duplicate (background) : NULL;
|
||||
private->preview_temp_buf = temp_buf;
|
||||
private->preview_temp_buf_color = fg_color ?
|
||||
gegl_color_duplicate (fg_color) : NULL;
|
||||
|
||||
return temp_buf;
|
||||
}
|
||||
@@ -963,10 +955,8 @@ gimp_viewable_get_preview (GimpViewable *viewable,
|
||||
* @viewable: The viewable object to get a preview for.
|
||||
* @width: desired width for the preview
|
||||
* @height: desired height for the preview
|
||||
* @color: desired foreground color for the preview when the type of
|
||||
* @fg_color: desired foreground color for the preview when the type of
|
||||
* @viewable support recolorization.
|
||||
* @background: desired background color for the preview when the type
|
||||
* of @viewable supports recolorization.
|
||||
*
|
||||
* Gets a new preview for a viewable object. Similar to
|
||||
* gimp_viewable_get_preview(), except that it tries things in a
|
||||
@@ -982,8 +972,7 @@ gimp_viewable_get_new_preview (GimpViewable *viewable,
|
||||
GimpContext *context,
|
||||
gint width,
|
||||
gint height,
|
||||
GeglColor *color,
|
||||
GeglColor *background)
|
||||
GeglColor *fg_color)
|
||||
{
|
||||
GimpViewableClass *viewable_class;
|
||||
GimpTempBuf *temp_buf = NULL;
|
||||
@@ -1000,14 +989,16 @@ gimp_viewable_get_new_preview (GimpViewable *viewable,
|
||||
|
||||
if (viewable_class->get_new_preview)
|
||||
temp_buf = viewable_class->get_new_preview (viewable, context,
|
||||
width, height, color, background);
|
||||
width, height,
|
||||
fg_color);
|
||||
|
||||
if (temp_buf)
|
||||
return temp_buf;
|
||||
|
||||
if (viewable_class->get_preview)
|
||||
temp_buf = viewable_class->get_preview (viewable, context,
|
||||
width, height, color, background);
|
||||
width, height,
|
||||
fg_color);
|
||||
|
||||
if (temp_buf)
|
||||
return gimp_temp_buf_copy (temp_buf);
|
||||
@@ -1059,10 +1050,8 @@ gimp_viewable_get_dummy_preview (GimpViewable *viewable,
|
||||
* @context: The context to render the preview for.
|
||||
* @width: desired width for the preview
|
||||
* @height: desired height for the preview
|
||||
* @color: desired foreground color for the preview when the type of
|
||||
* @fg_color: desired foreground color for the preview when the type of
|
||||
* @viewable supports recolorization.
|
||||
* @background: desired background color for the preview when the type
|
||||
* of @viewable supports recolorization.
|
||||
*
|
||||
* Gets a preview for a viewable object, by running through a variety
|
||||
* of methods until it finds one that works. First, if an
|
||||
@@ -1082,8 +1071,7 @@ gimp_viewable_get_pixbuf (GimpViewable *viewable,
|
||||
GimpContext *context,
|
||||
gint width,
|
||||
gint height,
|
||||
GeglColor *color,
|
||||
GeglColor *background)
|
||||
GeglColor *fg_color)
|
||||
{
|
||||
GimpViewablePrivate *private = GET_PRIVATE (viewable);
|
||||
GimpViewableClass *viewable_class;
|
||||
@@ -1093,8 +1081,6 @@ gimp_viewable_get_pixbuf (GimpViewable *viewable,
|
||||
g_return_val_if_fail (context == NULL || GIMP_IS_CONTEXT (context), NULL);
|
||||
g_return_val_if_fail (width > 0, NULL);
|
||||
g_return_val_if_fail (height > 0, NULL);
|
||||
g_return_val_if_fail ((color == NULL && background == NULL) ||
|
||||
(color != NULL && background != NULL), NULL);
|
||||
|
||||
if (G_UNLIKELY (context == NULL))
|
||||
g_warning ("%s: context is NULL", G_STRFUNC);
|
||||
@@ -1102,21 +1088,23 @@ gimp_viewable_get_pixbuf (GimpViewable *viewable,
|
||||
viewable_class = GIMP_VIEWABLE_GET_CLASS (viewable);
|
||||
|
||||
if (viewable_class->get_pixbuf)
|
||||
pixbuf = viewable_class->get_pixbuf (viewable, context, width, height, color, background);
|
||||
pixbuf = viewable_class->get_pixbuf (viewable, context,
|
||||
width, height,
|
||||
fg_color);
|
||||
|
||||
if (pixbuf)
|
||||
return pixbuf;
|
||||
|
||||
if (private->preview_pixbuf &&
|
||||
((color == NULL && private->preview_pixbuf_color == NULL) ||
|
||||
(color != NULL && private->preview_pixbuf_color != NULL)))
|
||||
((fg_color == NULL && private->preview_pixbuf_color == NULL) ||
|
||||
(fg_color != NULL && private->preview_pixbuf_color != NULL)))
|
||||
{
|
||||
if (gdk_pixbuf_get_width (private->preview_pixbuf) == width &&
|
||||
gdk_pixbuf_get_height (private->preview_pixbuf) == height)
|
||||
{
|
||||
gboolean same_colors = TRUE;
|
||||
|
||||
if (color != NULL)
|
||||
if (fg_color)
|
||||
{
|
||||
gdouble r1, g1, b1, a1;
|
||||
gdouble r2, g2, b2, a2;
|
||||
@@ -1124,18 +1112,12 @@ gimp_viewable_get_pixbuf (GimpViewable *viewable,
|
||||
/* Don't use gimp_color_is_perceptually_identical(). Exact
|
||||
* comparison is fine for this use case.
|
||||
*/
|
||||
gegl_color_get_rgba (color, &r1, &g1, &b1, &a1);
|
||||
gegl_color_get_rgba (private->preview_pixbuf_color, &r2, &g2, &b2, &a2);
|
||||
gegl_color_get_rgba (fg_color,
|
||||
&r1, &g1, &b1, &a1);
|
||||
gegl_color_get_rgba (private->preview_pixbuf_color,
|
||||
&r2, &g2, &b2, &a2);
|
||||
|
||||
same_colors = (r1 == r2 && g1 == g2 && b1 == b2 && a1 == a2);
|
||||
|
||||
if (same_colors)
|
||||
{
|
||||
gegl_color_get_rgba (background, &r1, &g1, &b1, &a1);
|
||||
gegl_color_get_rgba (private->preview_pixbuf_background, &r2, &g2, &b2, &a2);
|
||||
|
||||
same_colors = (r1 == r2 && g1 == g2 && b1 == b2 && a1 == a2);
|
||||
}
|
||||
}
|
||||
|
||||
if (same_colors)
|
||||
@@ -1145,14 +1127,15 @@ gimp_viewable_get_pixbuf (GimpViewable *viewable,
|
||||
|
||||
g_clear_object (&private->preview_pixbuf);
|
||||
g_clear_object (&private->preview_pixbuf_color);
|
||||
g_clear_object (&private->preview_pixbuf_background);
|
||||
|
||||
if (viewable_class->get_new_pixbuf)
|
||||
pixbuf = viewable_class->get_new_pixbuf (viewable, context, width, height, color, background);
|
||||
pixbuf = viewable_class->get_new_pixbuf (viewable, context,
|
||||
width, height,
|
||||
fg_color);
|
||||
|
||||
private->preview_pixbuf = pixbuf;
|
||||
private->preview_pixbuf_color = color ? gegl_color_duplicate (color) : NULL;
|
||||
private->preview_pixbuf_background = background ? gegl_color_duplicate (background) : NULL;
|
||||
private->preview_pixbuf = pixbuf;
|
||||
private->preview_pixbuf_color = fg_color ?
|
||||
gegl_color_duplicate (fg_color) : NULL;
|
||||
|
||||
return pixbuf;
|
||||
}
|
||||
@@ -1163,7 +1146,7 @@ gimp_viewable_get_pixbuf (GimpViewable *viewable,
|
||||
* @context: The context to render the preview for.
|
||||
* @width: desired width for the pixbuf
|
||||
* @height: desired height for the pixbuf
|
||||
* @color: desired foreground color for the preview when the type of
|
||||
* @fg_color: desired foreground color for the preview when the type of
|
||||
* @viewable support recolorization.
|
||||
*
|
||||
* Gets a new preview for a viewable object. Similar to
|
||||
@@ -1180,8 +1163,7 @@ gimp_viewable_get_new_pixbuf (GimpViewable *viewable,
|
||||
GimpContext *context,
|
||||
gint width,
|
||||
gint height,
|
||||
GeglColor *color,
|
||||
GeglColor *background)
|
||||
GeglColor *fg_color)
|
||||
{
|
||||
GimpViewableClass *viewable_class;
|
||||
GdkPixbuf *pixbuf = NULL;
|
||||
@@ -1197,13 +1179,17 @@ gimp_viewable_get_new_pixbuf (GimpViewable *viewable,
|
||||
viewable_class = GIMP_VIEWABLE_GET_CLASS (viewable);
|
||||
|
||||
if (viewable_class->get_new_pixbuf)
|
||||
pixbuf = viewable_class->get_new_pixbuf (viewable, context, width, height, color, background);
|
||||
pixbuf = viewable_class->get_new_pixbuf (viewable, context,
|
||||
width, height,
|
||||
fg_color);
|
||||
|
||||
if (pixbuf)
|
||||
return pixbuf;
|
||||
|
||||
if (viewable_class->get_pixbuf)
|
||||
pixbuf = viewable_class->get_pixbuf (viewable, context, width, height, color, background);
|
||||
pixbuf = viewable_class->get_pixbuf (viewable, context,
|
||||
width, height,
|
||||
fg_color);
|
||||
|
||||
if (pixbuf)
|
||||
return gdk_pixbuf_copy (pixbuf);
|
||||
|
@@ -71,26 +71,22 @@ struct _GimpViewableClass
|
||||
GimpContext *context,
|
||||
gint width,
|
||||
gint height,
|
||||
GeglColor *fg_color,
|
||||
GeglColor *background);
|
||||
GeglColor *fg_color);
|
||||
GimpTempBuf * (* get_new_preview) (GimpViewable *viewable,
|
||||
GimpContext *context,
|
||||
gint width,
|
||||
gint height,
|
||||
GeglColor *fg_color,
|
||||
GeglColor *background);
|
||||
GeglColor *fg_color);
|
||||
GdkPixbuf * (* get_pixbuf) (GimpViewable *viewable,
|
||||
GimpContext *context,
|
||||
gint width,
|
||||
gint height,
|
||||
GeglColor *fg_color,
|
||||
GeglColor *background);
|
||||
GeglColor *fg_color);
|
||||
GdkPixbuf * (* get_new_pixbuf) (GimpViewable *viewable,
|
||||
GimpContext *context,
|
||||
gint width,
|
||||
gint height,
|
||||
GeglColor *fg_color,
|
||||
GeglColor *background);
|
||||
GeglColor *fg_color);
|
||||
gchar * (* get_description) (GimpViewable *viewable,
|
||||
gchar **tooltip);
|
||||
|
||||
@@ -145,14 +141,12 @@ GimpTempBuf * gimp_viewable_get_preview (GimpViewable *viewable,
|
||||
GimpContext *context,
|
||||
gint width,
|
||||
gint height,
|
||||
GeglColor *fg_color,
|
||||
GeglColor *bg_color);
|
||||
GeglColor *fg_color);
|
||||
GimpTempBuf * gimp_viewable_get_new_preview (GimpViewable *viewable,
|
||||
GimpContext *context,
|
||||
gint width,
|
||||
gint height,
|
||||
GeglColor *fg_color,
|
||||
GeglColor *bg_color);
|
||||
GeglColor *fg_color);
|
||||
|
||||
GimpTempBuf * gimp_viewable_get_dummy_preview (GimpViewable *viewable,
|
||||
gint width,
|
||||
@@ -163,14 +157,12 @@ GdkPixbuf * gimp_viewable_get_pixbuf (GimpViewable *viewable,
|
||||
GimpContext *context,
|
||||
gint width,
|
||||
gint height,
|
||||
GeglColor *color,
|
||||
GeglColor *background);
|
||||
GeglColor *fg_color);
|
||||
GdkPixbuf * gimp_viewable_get_new_pixbuf (GimpViewable *viewable,
|
||||
GimpContext *context,
|
||||
gint width,
|
||||
gint height,
|
||||
GeglColor *color,
|
||||
GeglColor *background);
|
||||
GeglColor *fg_color);
|
||||
|
||||
GdkPixbuf * gimp_viewable_get_dummy_pixbuf (GimpViewable *viewable,
|
||||
gint width,
|
||||
|
@@ -185,6 +185,7 @@ libappcore_sources = [
|
||||
'gimpitemundo.c',
|
||||
'gimplayer-floating-selection.c',
|
||||
'gimplayer-new.c',
|
||||
'gimplayer-xcf.c',
|
||||
'gimplayer.c',
|
||||
'gimplayermask.c',
|
||||
'gimplayermaskpropundo.c',
|
||||
@@ -193,6 +194,9 @@ libappcore_sources = [
|
||||
'gimplayerstack.c',
|
||||
'gimplayerundo.c',
|
||||
'gimplineart.c',
|
||||
'gimplink.c',
|
||||
'gimplinklayer.c',
|
||||
'gimplinklayerundo.c',
|
||||
'gimplist.c',
|
||||
'gimpmaskundo.c',
|
||||
'gimpmybrush-load.c',
|
||||
@@ -273,6 +277,7 @@ libappcore = static_library('appcore',
|
||||
cairo,
|
||||
gegl,
|
||||
gdk_pixbuf,
|
||||
libarchive,
|
||||
libmypaint,
|
||||
gexiv2,
|
||||
appstream,
|
||||
|
@@ -512,17 +512,24 @@ about_dialog_add_update (GimpAboutDialog *dialog,
|
||||
|
||||
if (config->check_update_timestamp > 0)
|
||||
{
|
||||
gchar *subtext;
|
||||
gchar *time;
|
||||
|
||||
datetime = g_date_time_new_from_unix_local (config->check_update_timestamp);
|
||||
gchar *subtext;
|
||||
gchar *time;
|
||||
#if defined(PLATFORM_OSX)
|
||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
|
||||
NSDate *current_date = [NSDate date];
|
||||
NSString *formatted_date;
|
||||
NSString *formatted_time;
|
||||
#elif defined(G_OS_WIN32)
|
||||
SYSTEMTIME st;
|
||||
int date_len, time_len;
|
||||
wchar_t *date_buf = NULL;
|
||||
wchar_t *time_buf = NULL;
|
||||
#endif
|
||||
|
||||
datetime = g_date_time_new_from_unix_local (config->check_update_timestamp);
|
||||
|
||||
#if defined(PLATFORM_OSX)
|
||||
formatter.locale = [NSLocale currentLocale];
|
||||
|
||||
formatter.dateStyle = NSDateFormatterShortStyle;
|
||||
@@ -546,11 +553,6 @@ about_dialog_add_update (GimpAboutDialog *dialog,
|
||||
[formatter release];
|
||||
[pool drain];
|
||||
#elif defined(G_OS_WIN32)
|
||||
SYSTEMTIME st;
|
||||
int date_len, time_len;
|
||||
wchar_t *date_buf = NULL;
|
||||
wchar_t *time_buf = NULL;
|
||||
|
||||
GetLocalTime (&st);
|
||||
|
||||
date_len = GetDateFormatEx (LOCALE_NAME_USER_DEFAULT, 0, &st,
|
||||
|
@@ -73,7 +73,7 @@ extensions_dialog_new (Gimp *gimp)
|
||||
GtkWidget *widget;
|
||||
GtkTreeIter top_iter;
|
||||
|
||||
dialog = gimp_dialog_new (_("Extensions"), "gimp-extensions",
|
||||
dialog = gimp_dialog_new (C_("GIMP extensions", "Extensions"), "gimp-extensions",
|
||||
NULL, 0, NULL,
|
||||
GIMP_HELP_EXTENSIONS_DIALOG,
|
||||
_("_OK"), GTK_RESPONSE_OK,
|
||||
|
@@ -55,11 +55,13 @@ static void file_open_dialog_response (GtkWidget *dialog,
|
||||
static GimpImage *file_open_dialog_open_image (GtkWidget *dialog,
|
||||
Gimp *gimp,
|
||||
GFile *file,
|
||||
GimpPlugInProcedure *load_proc);
|
||||
GimpPlugInProcedure *load_proc,
|
||||
gboolean as_link);
|
||||
static gboolean file_open_dialog_open_layers (GtkWidget *dialog,
|
||||
GimpImage *image,
|
||||
GFile *file,
|
||||
GimpPlugInProcedure *load_proc);
|
||||
GimpPlugInProcedure *load_proc,
|
||||
gboolean as_link);
|
||||
|
||||
|
||||
/* public functions */
|
||||
@@ -147,13 +149,14 @@ file_open_dialog_response (GtkWidget *dialog,
|
||||
{
|
||||
if (! file_dialog->image)
|
||||
{
|
||||
gimp_open_dialog_set_image (
|
||||
open_dialog,
|
||||
file_open_dialog_open_image (dialog,
|
||||
gimp,
|
||||
file,
|
||||
file_dialog->file_proc),
|
||||
TRUE);
|
||||
gimp_open_dialog_set_image (open_dialog,
|
||||
file_open_dialog_open_image (dialog,
|
||||
gimp,
|
||||
file,
|
||||
file_dialog->file_proc,
|
||||
open_dialog->open_as_link),
|
||||
TRUE,
|
||||
open_dialog->open_as_link);
|
||||
|
||||
if (file_dialog->image)
|
||||
{
|
||||
@@ -170,7 +173,8 @@ file_open_dialog_response (GtkWidget *dialog,
|
||||
else if (file_open_dialog_open_layers (dialog,
|
||||
file_dialog->image,
|
||||
file,
|
||||
file_dialog->file_proc))
|
||||
file_dialog->file_proc,
|
||||
open_dialog->open_as_link))
|
||||
{
|
||||
success = TRUE;
|
||||
}
|
||||
@@ -180,7 +184,8 @@ file_open_dialog_response (GtkWidget *dialog,
|
||||
if (file_open_dialog_open_image (dialog,
|
||||
gimp,
|
||||
file,
|
||||
file_dialog->file_proc))
|
||||
file_dialog->file_proc,
|
||||
open_dialog->open_as_link))
|
||||
{
|
||||
success = TRUE;
|
||||
|
||||
@@ -227,7 +232,8 @@ static GimpImage *
|
||||
file_open_dialog_open_image (GtkWidget *dialog,
|
||||
Gimp *gimp,
|
||||
GFile *file,
|
||||
GimpPlugInProcedure *load_proc)
|
||||
GimpPlugInProcedure *load_proc,
|
||||
gboolean as_link)
|
||||
{
|
||||
GimpImage *image;
|
||||
GimpPDBStatusType status;
|
||||
@@ -236,7 +242,7 @@ file_open_dialog_open_image (GtkWidget *dialog,
|
||||
image = file_open_with_proc_and_display (gimp,
|
||||
gimp_get_user_context (gimp),
|
||||
GIMP_PROGRESS (dialog),
|
||||
file, FALSE,
|
||||
file, FALSE, as_link,
|
||||
load_proc,
|
||||
G_OBJECT (gimp_widget_get_monitor (dialog)),
|
||||
&status, &error);
|
||||
@@ -256,7 +262,8 @@ static gboolean
|
||||
file_open_dialog_open_layers (GtkWidget *dialog,
|
||||
GimpImage *image,
|
||||
GFile *file,
|
||||
GimpPlugInProcedure *load_proc)
|
||||
GimpPlugInProcedure *load_proc,
|
||||
gboolean as_link)
|
||||
{
|
||||
GList *new_layers;
|
||||
GimpPDBStatusType status;
|
||||
@@ -265,7 +272,7 @@ file_open_dialog_open_layers (GtkWidget *dialog,
|
||||
new_layers = file_open_layers (image->gimp,
|
||||
gimp_get_user_context (image->gimp),
|
||||
GIMP_PROGRESS (dialog),
|
||||
image, FALSE,
|
||||
image, FALSE, as_link,
|
||||
file, GIMP_RUN_INTERACTIVE, load_proc,
|
||||
&status, &error);
|
||||
|
||||
|
@@ -204,7 +204,7 @@ file_open_location_response (GtkDialog *dialog,
|
||||
image = file_open_with_proc_and_display (gimp,
|
||||
gimp_get_user_context (gimp),
|
||||
GIMP_PROGRESS (box),
|
||||
file, FALSE, NULL,
|
||||
file, FALSE, FALSE, NULL,
|
||||
G_OBJECT (gimp_widget_get_monitor (entry)),
|
||||
&status, &error);
|
||||
|
||||
|
@@ -322,6 +322,21 @@ item_options_dialog_get_vbox (GtkWidget *dialog)
|
||||
return private->left_vbox;
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
item_options_dialog_get_right_vbox (GtkWidget *dialog)
|
||||
{
|
||||
ItemOptionsDialog *private;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_VIEWABLE_DIALOG (dialog), NULL);
|
||||
|
||||
private = g_object_get_data (G_OBJECT (dialog),
|
||||
"item-options-dialog-private");
|
||||
|
||||
g_return_val_if_fail (private != NULL, NULL);
|
||||
|
||||
return private->right_vbox;
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
item_options_dialog_get_grid (GtkWidget *dialog,
|
||||
gint *next_row)
|
||||
|
@@ -55,6 +55,7 @@ GtkWidget * item_options_dialog_new (GimpImage *image,
|
||||
gpointer user_data);
|
||||
|
||||
GtkWidget * item_options_dialog_get_vbox (GtkWidget *dialog);
|
||||
GtkWidget * item_options_dialog_get_right_vbox (GtkWidget *dialog);
|
||||
GtkWidget * item_options_dialog_get_grid (GtkWidget *dialog,
|
||||
gint *next_row);
|
||||
GtkWidget * item_options_dialog_get_name_entry (GtkWidget *dialog);
|
||||
|
@@ -32,12 +32,15 @@
|
||||
#include "core/gimpdrawable-filters.h"
|
||||
#include "core/gimpimage.h"
|
||||
#include "core/gimplayer.h"
|
||||
#include "core/gimplink.h"
|
||||
#include "core/gimplinklayer.h"
|
||||
|
||||
#include "text/gimptext.h"
|
||||
#include "text/gimptextlayer.h"
|
||||
|
||||
#include "widgets/gimpcontainertreeview.h"
|
||||
#include "widgets/gimpcontainerlistview.h"
|
||||
#include "widgets/gimplayermodebox.h"
|
||||
#include "widgets/gimpopendialog.h"
|
||||
#include "widgets/gimpviewabledialog.h"
|
||||
|
||||
#include "item-options-dialog.h"
|
||||
@@ -50,6 +53,7 @@ typedef struct _LayerOptionsDialog LayerOptionsDialog;
|
||||
|
||||
struct _LayerOptionsDialog
|
||||
{
|
||||
Gimp *gimp;
|
||||
GimpLayer *layer;
|
||||
GimpLayerMode mode;
|
||||
GimpLayerColorSpace blend_space;
|
||||
@@ -57,6 +61,8 @@ struct _LayerOptionsDialog
|
||||
GimpLayerCompositeMode composite_mode;
|
||||
gdouble opacity;
|
||||
GimpFillType fill_type;
|
||||
GimpInsertPosition insert_position;
|
||||
GimpInsertGroupPosition insert_group_position;
|
||||
gboolean lock_alpha;
|
||||
gboolean rename_text_layers;
|
||||
GimpLayerOptionsCallback callback;
|
||||
@@ -68,6 +74,8 @@ struct _LayerOptionsDialog
|
||||
GtkWidget *composite_mode_combo;
|
||||
GtkWidget *size_se;
|
||||
GtkWidget *offset_se;
|
||||
|
||||
GimpLink *link;
|
||||
};
|
||||
|
||||
|
||||
@@ -93,6 +101,9 @@ static void layer_options_dialog_mode_notify (GtkWidget *widget,
|
||||
static void layer_options_dialog_rename_toggled (GtkWidget *widget,
|
||||
LayerOptionsDialog *private);
|
||||
|
||||
static void layer_options_file_set (GtkFileChooserButton *widget,
|
||||
LayerOptionsDialog *private);
|
||||
|
||||
|
||||
/* public functions */
|
||||
|
||||
@@ -113,6 +124,8 @@ layer_options_dialog_new (GimpImage *image,
|
||||
GimpLayerCompositeMode layer_composite_mode,
|
||||
gdouble layer_opacity,
|
||||
GimpFillType layer_fill_type,
|
||||
GimpInsertPosition insert_position,
|
||||
GimpInsertGroupPosition insert_group_position,
|
||||
gboolean layer_visible,
|
||||
GimpColorTag layer_color_tag,
|
||||
gboolean layer_lock_content,
|
||||
@@ -127,6 +140,7 @@ layer_options_dialog_new (GimpImage *image,
|
||||
GtkWidget *grid;
|
||||
GtkListStore *space_model;
|
||||
GtkWidget *combo;
|
||||
GtkWidget *file_select;
|
||||
GtkWidget *scale;
|
||||
GtkWidget *label;
|
||||
GtkAdjustment *adjustment;
|
||||
@@ -144,17 +158,21 @@ layer_options_dialog_new (GimpImage *image,
|
||||
|
||||
private = g_slice_new0 (LayerOptionsDialog);
|
||||
|
||||
private->layer = layer;
|
||||
private->mode = layer_mode;
|
||||
private->blend_space = layer_blend_space;
|
||||
private->composite_space = layer_composite_space;
|
||||
private->composite_mode = layer_composite_mode;
|
||||
private->opacity = layer_opacity * 100.0;
|
||||
private->fill_type = layer_fill_type;
|
||||
private->lock_alpha = layer_lock_alpha;
|
||||
private->rename_text_layers = FALSE;
|
||||
private->callback = callback;
|
||||
private->user_data = user_data;
|
||||
private->gimp = image->gimp;
|
||||
private->layer = layer;
|
||||
private->mode = layer_mode;
|
||||
private->blend_space = layer_blend_space;
|
||||
private->composite_space = layer_composite_space;
|
||||
private->composite_mode = layer_composite_mode;
|
||||
private->opacity = layer_opacity * 100.0;
|
||||
private->fill_type = layer_fill_type;
|
||||
private->insert_position = insert_position;
|
||||
private->insert_group_position = insert_group_position;
|
||||
private->lock_alpha = layer_lock_alpha;
|
||||
private->rename_text_layers = FALSE;
|
||||
private->callback = callback;
|
||||
private->user_data = user_data;
|
||||
private->link = NULL;
|
||||
|
||||
if (layer && gimp_item_is_text_layer (GIMP_ITEM (layer)))
|
||||
private->rename_text_layers = GIMP_TEXT_LAYER (layer)->auto_rename;
|
||||
@@ -372,19 +390,6 @@ layer_options_dialog_new (GimpImage *image,
|
||||
|
||||
row += 2;
|
||||
|
||||
if (! layer)
|
||||
{
|
||||
/* The fill type */
|
||||
combo = gimp_enum_combo_box_new (GIMP_TYPE_FILL_TYPE);
|
||||
gimp_grid_attach_aligned (GTK_GRID (grid), 0, row++,
|
||||
_("_Fill with:"), 0.0, 0.5,
|
||||
combo, 1);
|
||||
gimp_int_combo_box_connect (GIMP_INT_COMBO_BOX (combo),
|
||||
private->fill_type,
|
||||
G_CALLBACK (gimp_int_combo_box_get_active),
|
||||
&private->fill_type, NULL);
|
||||
}
|
||||
|
||||
if (layer)
|
||||
{
|
||||
GtkWidget *left_vbox = item_options_dialog_get_vbox (dialog);
|
||||
@@ -398,10 +403,80 @@ layer_options_dialog_new (GimpImage *image,
|
||||
|
||||
filters = gimp_drawable_get_filters (GIMP_DRAWABLE (layer));
|
||||
|
||||
view = gimp_container_tree_view_new (filters, context,
|
||||
view = gimp_container_list_view_new (filters, context,
|
||||
GIMP_VIEW_SIZE_SMALL, 0);
|
||||
gtk_container_add (GTK_CONTAINER (frame), view);
|
||||
gtk_widget_show (view);
|
||||
|
||||
if (GIMP_IS_LINK_LAYER (layer))
|
||||
{
|
||||
GtkWidget *open_dialog;
|
||||
GimpLink *link;
|
||||
|
||||
/* File chooser dialog. */
|
||||
open_dialog = gimp_open_dialog_new (private->gimp);
|
||||
gtk_window_set_title (GTK_WINDOW (open_dialog),
|
||||
_("Select Linked Image"));
|
||||
|
||||
/* File chooser button. */
|
||||
file_select = gtk_file_chooser_button_new_with_dialog (open_dialog);
|
||||
link = gimp_link_layer_get_link (GIMP_LINK_LAYER (layer));
|
||||
gtk_file_chooser_set_file (GTK_FILE_CHOOSER (file_select),
|
||||
gimp_link_get_file (link, NULL, NULL),
|
||||
NULL);
|
||||
gtk_widget_show (file_select);
|
||||
gimp_grid_attach_aligned (GTK_GRID (grid), 0, row++,
|
||||
_("_Linked image:"), 0.0, 0.5,
|
||||
file_select, 1);
|
||||
|
||||
g_signal_connect (file_select, "file-set",
|
||||
G_CALLBACK (layer_options_file_set),
|
||||
private);
|
||||
|
||||
private->link = gimp_link_duplicate (link);
|
||||
|
||||
/* Absolute path checkbox. */
|
||||
button = gtk_check_button_new_with_mnemonic (_("S_tore with absolute path"));
|
||||
gimp_grid_attach_aligned (GTK_GRID (grid), 0, row++,
|
||||
NULL, 0.0, 0.5,
|
||||
button, 2);
|
||||
g_object_bind_property (G_OBJECT (private->link), "absolute-path",
|
||||
G_OBJECT (button), "active",
|
||||
G_BINDING_SYNC_CREATE |
|
||||
G_BINDING_BIDIRECTIONAL);
|
||||
gtk_widget_set_visible (button, TRUE);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* The fill type */
|
||||
combo = gimp_enum_combo_box_new (GIMP_TYPE_FILL_TYPE);
|
||||
gimp_grid_attach_aligned (GTK_GRID (grid), 0, row++,
|
||||
_("_Fill with:"), 0.0, 0.5,
|
||||
combo, 1);
|
||||
gimp_int_combo_box_connect (GIMP_INT_COMBO_BOX (combo),
|
||||
private->fill_type,
|
||||
G_CALLBACK (gimp_int_combo_box_get_active),
|
||||
&private->fill_type, NULL);
|
||||
|
||||
/* The insert position */
|
||||
combo = gimp_enum_combo_box_new (GIMP_TYPE_INSERT_POSITION);
|
||||
gimp_grid_attach_aligned (GTK_GRID (grid), 0, row++,
|
||||
_("Insert position:"), 0.0, 0.5,
|
||||
combo, 1);
|
||||
gimp_int_combo_box_connect (GIMP_INT_COMBO_BOX (combo),
|
||||
private->insert_position,
|
||||
G_CALLBACK (gimp_int_combo_box_get_active),
|
||||
&private->insert_position, NULL);
|
||||
|
||||
combo = gimp_enum_combo_box_new (GIMP_TYPE_INSERT_GROUP_POSITION);
|
||||
gimp_grid_attach_aligned (GTK_GRID (grid), 0, row++,
|
||||
_("Insert position in layer group:"), 0.0, 0.5,
|
||||
combo, 1);
|
||||
gimp_int_combo_box_connect (GIMP_INT_COMBO_BOX (combo),
|
||||
private->insert_group_position,
|
||||
G_CALLBACK (gimp_int_combo_box_get_active),
|
||||
&private->insert_group_position, NULL);
|
||||
}
|
||||
|
||||
button = item_options_dialog_get_lock_position (dialog);
|
||||
@@ -502,6 +577,9 @@ layer_options_dialog_callback (GtkWidget *dialog,
|
||||
private->composite_mode,
|
||||
private->opacity / 100.0,
|
||||
private->fill_type,
|
||||
private->insert_position,
|
||||
private->insert_group_position,
|
||||
private->link,
|
||||
width,
|
||||
height,
|
||||
offset_x,
|
||||
@@ -574,3 +652,45 @@ layer_options_dialog_rename_toggled (GtkWidget *widget,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
layer_options_file_set (GtkFileChooserButton *widget,
|
||||
LayerOptionsDialog *private)
|
||||
{
|
||||
GFile *file;
|
||||
|
||||
file = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (widget));
|
||||
if (file)
|
||||
{
|
||||
gint width = 0;
|
||||
gint height = 0;
|
||||
|
||||
if (private->layer)
|
||||
{
|
||||
width = gimp_item_get_width (GIMP_ITEM (private->layer));
|
||||
height = gimp_item_get_height (GIMP_ITEM (private->layer));
|
||||
|
||||
if (width == 0 || height == 0)
|
||||
{
|
||||
GimpImage *image = gimp_item_get_image (GIMP_ITEM (private->layer));
|
||||
|
||||
width = gimp_image_get_width (image);
|
||||
height = gimp_image_get_height (image);
|
||||
}
|
||||
}
|
||||
|
||||
gimp_link_set_file (private->link, file, width, height, TRUE, NULL, NULL);
|
||||
if (gimp_link_is_broken (private->link))
|
||||
{
|
||||
gimp_link_set_file (private->link, NULL, width, height, TRUE, NULL, NULL);
|
||||
g_signal_handlers_block_by_func (widget,
|
||||
G_CALLBACK (layer_options_file_set),
|
||||
private);
|
||||
gtk_file_chooser_unselect_file (GTK_FILE_CHOOSER (widget), file);
|
||||
g_signal_handlers_unblock_by_func (widget,
|
||||
G_CALLBACK (layer_options_file_set),
|
||||
private);
|
||||
}
|
||||
}
|
||||
g_clear_object (&file);
|
||||
}
|
||||
|
@@ -29,6 +29,9 @@ typedef void (* GimpLayerOptionsCallback) (GtkWidget *dialog,
|
||||
GimpLayerCompositeMode layer_composite_mode,
|
||||
gdouble layer_opacity,
|
||||
GimpFillType layer_fill_type,
|
||||
GimpInsertPosition insert_position,
|
||||
GimpInsertGroupPosition insert_group_position,
|
||||
GimpLink *link,
|
||||
gint layer_width,
|
||||
gint layer_height,
|
||||
gint layer_offset_x,
|
||||
@@ -59,6 +62,8 @@ GtkWidget * layer_options_dialog_new (GimpImage *image,
|
||||
GimpLayerCompositeMode layer_composite_mode,
|
||||
gdouble layer_opacity,
|
||||
GimpFillType layer_fill_type,
|
||||
GimpInsertPosition insert_position,
|
||||
GimpInsertGroupPosition insert_group_position,
|
||||
gboolean layer_visible,
|
||||
GimpColorTag layer_color_tag,
|
||||
gboolean layer_lock_content,
|
||||
|
@@ -56,6 +56,7 @@ libappdialogs_sources = [
|
||||
'tips-dialog.c',
|
||||
'tips-parser.c',
|
||||
'user-install-dialog.c',
|
||||
'vector-layer-options-dialog.c',
|
||||
'welcome-dialog.c',
|
||||
gitversion_h,
|
||||
welcome_dialog_data_c,
|
||||
|
@@ -163,7 +163,7 @@ gimp_image_metadata_rotate_dialog (GimpImage *image,
|
||||
|
||||
gimp_pickable_flush (GIMP_PICKABLE (image));
|
||||
pixbuf = gimp_viewable_get_pixbuf (GIMP_VIEWABLE (image), context,
|
||||
width, height, NULL, NULL);
|
||||
width, height, NULL);
|
||||
if (pixbuf)
|
||||
{
|
||||
GdkPixbuf *rotated;
|
||||
|
@@ -125,7 +125,7 @@ static void palette_import_image_remove (GimpContainer *container,
|
||||
GimpImage *image,
|
||||
ImportDialog *private);
|
||||
static void palette_import_make_palette (ImportDialog *private);
|
||||
|
||||
static void palette_import_file_set_filters (GtkFileChooser *file_chooser);
|
||||
|
||||
/* public functions */
|
||||
|
||||
@@ -282,13 +282,15 @@ palette_import_dialog_new (GimpContext *context)
|
||||
|
||||
/* Palette file name entry */
|
||||
private->file_chooser = gtk_file_chooser_button_new (_("Select Palette File"),
|
||||
GTK_FILE_CHOOSER_ACTION_OPEN);
|
||||
GTK_FILE_CHOOSER_ACTION_OPEN);
|
||||
gimp_grid_attach_aligned (GTK_GRID (grid), 0, 4,
|
||||
NULL, 0.0, 0.5, private->file_chooser, 1);
|
||||
gtk_size_group_add_widget (size_group, private->file_chooser);
|
||||
|
||||
g_object_unref (size_group);
|
||||
/* Set valid palette files filters */
|
||||
palette_import_file_set_filters (GTK_FILE_CHOOSER (private->file_chooser));
|
||||
|
||||
g_object_unref (size_group);
|
||||
|
||||
/* The "Import" frame */
|
||||
|
||||
@@ -893,3 +895,62 @@ palette_import_make_palette (ImportDialog *private)
|
||||
! (palette &&
|
||||
gimp_palette_get_n_colors (palette) > 0));
|
||||
}
|
||||
|
||||
static void
|
||||
palette_import_file_set_filters (GtkFileChooser *file_chooser)
|
||||
{
|
||||
GtkFileFilter *filter;
|
||||
|
||||
filter = gtk_file_filter_new ();
|
||||
gtk_file_filter_set_name (filter, _("All palette files (*.*)"));
|
||||
gtk_file_filter_add_pattern (filter, "*");
|
||||
gtk_file_chooser_add_filter (file_chooser, filter);
|
||||
|
||||
filter = gtk_file_filter_new ();
|
||||
gtk_file_filter_set_name (filter, _("GIMP Palette (*.gpl)"));
|
||||
gtk_file_filter_add_pattern (filter, "*.gpl");
|
||||
gtk_file_filter_add_pattern (filter, "*.GPL");
|
||||
gtk_file_chooser_add_filter (file_chooser, filter);
|
||||
|
||||
filter = gtk_file_filter_new ();
|
||||
gtk_file_filter_set_name (filter, _("Adobe Color Table (*.act)"));
|
||||
gtk_file_filter_add_pattern (filter, "*.act");
|
||||
gtk_file_filter_add_pattern (filter, "*.ACT");
|
||||
gtk_file_chooser_add_filter (file_chooser, filter);
|
||||
|
||||
filter = gtk_file_filter_new ();
|
||||
gtk_file_filter_set_name (filter, _("Adobe Color Swatch (*.aco)"));
|
||||
gtk_file_filter_add_pattern (filter, "*.aco");
|
||||
gtk_file_filter_add_pattern (filter, "*.ACO");
|
||||
gtk_file_chooser_add_filter (file_chooser, filter);
|
||||
|
||||
filter = gtk_file_filter_new ();
|
||||
gtk_file_filter_set_name (filter, _("Adobe Color Book (*.acb)"));
|
||||
gtk_file_filter_add_pattern (filter, "*.acb");
|
||||
gtk_file_filter_add_pattern (filter, "*.ACB");
|
||||
gtk_file_chooser_add_filter (file_chooser, filter);
|
||||
|
||||
filter = gtk_file_filter_new ();
|
||||
gtk_file_filter_set_name (filter, _("Adobe Swatch Exchange (*.ase)"));
|
||||
gtk_file_filter_add_pattern (filter, "*.ase");
|
||||
gtk_file_filter_add_pattern (filter, "*.ASE");
|
||||
gtk_file_chooser_add_filter (file_chooser, filter);
|
||||
|
||||
filter = gtk_file_filter_new ();
|
||||
gtk_file_filter_set_name (filter, _("Cascading Style Sheet (*.css)"));
|
||||
gtk_file_filter_add_pattern (filter, "*.css");
|
||||
gtk_file_filter_add_pattern (filter, "*.CSS");
|
||||
gtk_file_chooser_add_filter (file_chooser, filter);
|
||||
|
||||
filter = gtk_file_filter_new ();
|
||||
gtk_file_filter_set_name (filter, _("JASC or RIFF Palette (*.pal)"));
|
||||
gtk_file_filter_add_pattern (filter, "*.pal");
|
||||
gtk_file_filter_add_pattern (filter, "*.PAL");
|
||||
gtk_file_chooser_add_filter (file_chooser, filter);
|
||||
|
||||
filter = gtk_file_filter_new ();
|
||||
gtk_file_filter_set_name (filter, _("SwatchBooker (*.sbz)"));
|
||||
gtk_file_filter_add_pattern (filter, "*.sbz");
|
||||
gtk_file_filter_add_pattern (filter, "*.SBZ");
|
||||
gtk_file_chooser_add_filter (file_chooser, filter);
|
||||
}
|
||||
|
@@ -429,7 +429,7 @@ resize_dialog_new (GimpViewable *viewable,
|
||||
|
||||
gimp_viewable_get_preview_size (viewable, 200, TRUE, TRUE, &width, &height);
|
||||
pixbuf = gimp_viewable_get_pixbuf (viewable, context,
|
||||
width, height, NULL, NULL);
|
||||
width, height, NULL);
|
||||
|
||||
if (pixbuf)
|
||||
gimp_offset_area_set_pixbuf (GIMP_OFFSET_AREA (private->area), pixbuf);
|
||||
|
326
app/dialogs/vector-layer-options-dialog.c
Normal file
326
app/dialogs/vector-layer-options-dialog.c
Normal file
@@ -0,0 +1,326 @@
|
||||
/* GIMP - The GNU Image Manipulation Program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* vector-layer-options-dialog.h
|
||||
*
|
||||
* Copyright 2006 Hendrik Boom
|
||||
*
|
||||
* 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 3 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, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <gegl.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "libgimpconfig/gimpconfig.h"
|
||||
#include "libgimpwidgets/gimpwidgets.h"
|
||||
|
||||
#include "dialogs-types.h"
|
||||
|
||||
#include "core/gimp.h"
|
||||
#include "core/gimpdrawable.h"
|
||||
#include "core/gimpimage.h"
|
||||
#include "core/gimpimage-undo-push.h"
|
||||
#include "core/gimpstrokeoptions.h"
|
||||
|
||||
#include "path/gimppath.h"
|
||||
#include "path/gimpvectorlayer.h"
|
||||
#include "path/gimpvectorlayeroptions.h"
|
||||
|
||||
#include "widgets/gimpcolorpanel.h"
|
||||
#include "widgets/gimpcontainercombobox.h"
|
||||
#include "widgets/gimpcontainerview.h"
|
||||
#include "widgets/gimppropwidgets.h"
|
||||
#include "widgets/gimpviewabledialog.h"
|
||||
#include "widgets/gimpstrokeeditor.h"
|
||||
|
||||
#include "vector-layer-options-dialog.h"
|
||||
|
||||
#include "gimp-intl.h"
|
||||
|
||||
|
||||
#define RESPONSE_RESET 1
|
||||
|
||||
|
||||
/* local functions */
|
||||
|
||||
static void vector_layer_options_dialog_notify (GObject *options,
|
||||
const GParamSpec *pspec,
|
||||
GtkWidget *dialog);
|
||||
static void vector_layer_options_dialog_response (GtkWidget *widget,
|
||||
gint response_id,
|
||||
GtkWidget *dialog);
|
||||
static void vector_layer_options_dialog_path_selected (GimpContainerView *view,
|
||||
GtkWidget *dialog);
|
||||
|
||||
|
||||
/* public function */
|
||||
|
||||
GtkWidget *
|
||||
vector_layer_options_dialog_new (GimpVectorLayer *layer,
|
||||
GimpContext *context,
|
||||
const gchar *title,
|
||||
const gchar *icon_name,
|
||||
const gchar *help_id,
|
||||
GtkWidget *parent)
|
||||
{
|
||||
GimpVectorLayerOptions *saved_options;
|
||||
GimpFillOptions *fill_options;
|
||||
GimpStrokeOptions *stroke_options;
|
||||
GtkWidget *dialog;
|
||||
GtkWidget *main_vbox;
|
||||
GtkWidget *combo;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_VECTOR_LAYER (layer), NULL);
|
||||
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
|
||||
g_return_val_if_fail (icon_name != NULL, NULL);
|
||||
g_return_val_if_fail (parent == NULL || GTK_IS_WIDGET (parent), NULL);
|
||||
|
||||
saved_options = gimp_config_duplicate (GIMP_CONFIG (layer->options));
|
||||
fill_options = gimp_config_duplicate (GIMP_CONFIG (saved_options->fill_options));
|
||||
stroke_options = gimp_config_duplicate (GIMP_CONFIG (saved_options->stroke_options));
|
||||
|
||||
dialog = gimp_viewable_dialog_new (g_list_prepend (NULL, GIMP_VIEWABLE (layer)),
|
||||
context,
|
||||
title, "gimp-vectorlayer-options",
|
||||
icon_name,
|
||||
_("Edit Vector Layer Attributes"),
|
||||
parent,
|
||||
gimp_standard_help_func,
|
||||
help_id,
|
||||
_("_Reset"), RESPONSE_RESET,
|
||||
_("_Cancel"), GTK_RESPONSE_CANCEL,
|
||||
_("_Apply"), GTK_RESPONSE_OK,
|
||||
|
||||
NULL);
|
||||
|
||||
gimp_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
|
||||
RESPONSE_RESET,
|
||||
GTK_RESPONSE_OK,
|
||||
GTK_RESPONSE_CANCEL,
|
||||
-1);
|
||||
|
||||
gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
|
||||
|
||||
g_signal_connect (dialog, "response",
|
||||
G_CALLBACK (vector_layer_options_dialog_response),
|
||||
dialog);
|
||||
|
||||
g_object_set_data (G_OBJECT (dialog), "layer", layer);
|
||||
|
||||
g_object_set_data_full (G_OBJECT (dialog), "saved-options",
|
||||
saved_options,
|
||||
(GDestroyNotify) g_object_unref);
|
||||
g_object_set_data_full (G_OBJECT (dialog), "fill-options",
|
||||
fill_options,
|
||||
(GDestroyNotify) g_object_unref);
|
||||
g_object_set_data_full (G_OBJECT (dialog), "stroke-options",
|
||||
stroke_options,
|
||||
(GDestroyNotify) g_object_unref);
|
||||
|
||||
g_signal_connect_object (saved_options, "notify::enable-fill",
|
||||
G_CALLBACK (vector_layer_options_dialog_notify),
|
||||
dialog, 0);
|
||||
g_signal_connect_object (saved_options, "notify::enable-stroke",
|
||||
G_CALLBACK (vector_layer_options_dialog_notify),
|
||||
dialog, 0);
|
||||
|
||||
g_signal_connect_object (fill_options, "notify",
|
||||
G_CALLBACK (vector_layer_options_dialog_notify),
|
||||
dialog, 0);
|
||||
g_signal_connect_object (stroke_options, "notify",
|
||||
G_CALLBACK (vector_layer_options_dialog_notify),
|
||||
dialog, 0);
|
||||
|
||||
main_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 12);
|
||||
gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))),
|
||||
main_vbox, TRUE, TRUE, 0);
|
||||
gtk_widget_set_visible (main_vbox, TRUE);
|
||||
|
||||
|
||||
combo = gimp_container_combo_box_new (gimp_image_get_paths (gimp_item_get_image (GIMP_ITEM (layer))),
|
||||
context,
|
||||
GIMP_VIEW_SIZE_SMALL, 1);
|
||||
gimp_container_view_set_1_selected (GIMP_CONTAINER_VIEW (combo),
|
||||
GIMP_VIEWABLE (saved_options->path));
|
||||
g_signal_connect_object (combo, "selection-changed",
|
||||
G_CALLBACK (vector_layer_options_dialog_path_selected),
|
||||
dialog, 0);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (main_vbox), combo, FALSE, FALSE, 0);
|
||||
gtk_widget_set_visible (combo, TRUE);
|
||||
|
||||
/* The fill editor */
|
||||
{
|
||||
GtkWidget *frame;
|
||||
GtkWidget *fill_editor;
|
||||
|
||||
fill_editor = gimp_fill_editor_new (fill_options, TRUE, TRUE);
|
||||
gtk_widget_set_visible (fill_editor, TRUE);
|
||||
|
||||
frame = gimp_prop_expanding_frame_new (G_OBJECT (saved_options),
|
||||
"enable-fill", NULL, fill_editor,
|
||||
NULL);
|
||||
gtk_box_pack_start (GTK_BOX (main_vbox), frame, FALSE, FALSE, 0);
|
||||
}
|
||||
|
||||
/* The stroke editor */
|
||||
{
|
||||
GtkWidget *frame;
|
||||
GtkWidget *stroke_editor;
|
||||
gdouble xres;
|
||||
gdouble yres;
|
||||
|
||||
gimp_image_get_resolution (gimp_item_get_image (GIMP_ITEM (layer)),
|
||||
&xres, &yres);
|
||||
|
||||
stroke_editor = gimp_stroke_editor_new (stroke_options, yres, TRUE, TRUE);
|
||||
gtk_widget_set_visible (stroke_editor, TRUE);
|
||||
|
||||
frame = gimp_prop_expanding_frame_new (G_OBJECT (saved_options),
|
||||
"enable-stroke", NULL, stroke_editor,
|
||||
NULL);
|
||||
gtk_box_pack_start (GTK_BOX (main_vbox), frame, FALSE, FALSE, 0);
|
||||
}
|
||||
|
||||
return dialog;
|
||||
}
|
||||
|
||||
static void
|
||||
vector_layer_options_dialog_notify (GObject *options,
|
||||
const GParamSpec *pspec,
|
||||
GtkWidget *dialog)
|
||||
{
|
||||
GimpVectorLayer *layer;
|
||||
GimpFillOptions *fill_options;
|
||||
GimpStrokeOptions *stroke_options;
|
||||
gboolean enable_fill;
|
||||
gboolean enable_stroke;
|
||||
|
||||
layer = g_object_get_data (G_OBJECT (dialog), "layer");
|
||||
|
||||
enable_fill = layer->options->enable_fill;
|
||||
enable_stroke = layer->options->enable_stroke;
|
||||
|
||||
fill_options = g_object_get_data (G_OBJECT (dialog), "fill-options");
|
||||
stroke_options = g_object_get_data (G_OBJECT (dialog), "stroke-options");
|
||||
|
||||
gimp_config_sync (G_OBJECT (fill_options),
|
||||
G_OBJECT (layer->options->fill_options), 0);
|
||||
gimp_config_sync (G_OBJECT (stroke_options),
|
||||
G_OBJECT (layer->options->stroke_options), 0);
|
||||
|
||||
if (! strcmp (pspec->name, "enable-fill") ||
|
||||
! strcmp (pspec->name, "enable-stroke"))
|
||||
{
|
||||
GimpVectorLayerOptions *vector_options;
|
||||
|
||||
vector_options = GIMP_VECTOR_LAYER_OPTIONS (options);
|
||||
|
||||
layer->options->enable_fill = vector_options->enable_fill;
|
||||
layer->options->enable_stroke = vector_options->enable_stroke;
|
||||
}
|
||||
|
||||
gimp_vector_layer_refresh (layer);
|
||||
gimp_image_flush (gimp_item_get_image (GIMP_ITEM (layer)));
|
||||
|
||||
layer->options->enable_fill = enable_fill;
|
||||
layer->options->enable_stroke = enable_stroke;
|
||||
}
|
||||
|
||||
static void
|
||||
vector_layer_options_dialog_response (GtkWidget *widget,
|
||||
gint response_id,
|
||||
GtkWidget *dialog)
|
||||
{
|
||||
GimpVectorLayer *layer;
|
||||
GimpPath *path;
|
||||
GimpVectorLayerOptions *saved_options;
|
||||
GimpFillOptions *fill_options;
|
||||
GimpStrokeOptions *stroke_options;
|
||||
|
||||
layer = g_object_get_data (G_OBJECT (dialog), "layer");
|
||||
|
||||
saved_options = g_object_get_data (G_OBJECT (dialog), "saved-options");
|
||||
fill_options = g_object_get_data (G_OBJECT (dialog), "fill-options");
|
||||
stroke_options = g_object_get_data (G_OBJECT (dialog), "stroke-options");
|
||||
|
||||
switch (response_id)
|
||||
{
|
||||
case GTK_RESPONSE_OK:
|
||||
if (layer && layer->options)
|
||||
{
|
||||
layer->options->enable_fill = saved_options->enable_fill;
|
||||
gimp_config_sync (G_OBJECT (saved_options->fill_options),
|
||||
G_OBJECT (layer->options->fill_options), 0);
|
||||
layer->options->enable_stroke = saved_options->enable_stroke;
|
||||
gimp_config_sync (G_OBJECT (saved_options->stroke_options),
|
||||
G_OBJECT (layer->options->stroke_options), 0);
|
||||
|
||||
gimp_image_undo_push_vector_layer (gimp_item_get_image (GIMP_ITEM (layer)),
|
||||
_("Fill/Stroke Vector Layer"),
|
||||
layer, NULL);
|
||||
|
||||
gimp_config_sync (G_OBJECT (fill_options),
|
||||
G_OBJECT (layer->options->fill_options), 0);
|
||||
gimp_config_sync (G_OBJECT (stroke_options),
|
||||
G_OBJECT (layer->options->stroke_options), 0);
|
||||
}
|
||||
|
||||
gtk_widget_destroy (dialog);
|
||||
break;
|
||||
|
||||
default:
|
||||
gimp_config_sync (G_OBJECT (saved_options->fill_options),
|
||||
G_OBJECT (fill_options), 0);
|
||||
gimp_config_sync (G_OBJECT (saved_options->stroke_options),
|
||||
G_OBJECT (stroke_options), 0);
|
||||
if (layer && layer->options)
|
||||
{
|
||||
g_object_get (saved_options, "path", &path, NULL);
|
||||
g_object_set (layer->options, "path", path, NULL);
|
||||
|
||||
gimp_vector_layer_refresh (layer);
|
||||
gimp_image_flush (gimp_item_get_image (GIMP_ITEM (layer)));
|
||||
}
|
||||
|
||||
if (response_id != RESPONSE_RESET)
|
||||
gtk_widget_destroy (dialog);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
vector_layer_options_dialog_path_selected (GimpContainerView *view,
|
||||
GtkWidget *dialog)
|
||||
{
|
||||
GimpViewable *item = gimp_container_view_get_1_selected (view);
|
||||
GimpPath *path = NULL;
|
||||
GimpVectorLayer *layer;
|
||||
|
||||
layer = g_object_get_data (G_OBJECT (dialog), "layer");
|
||||
|
||||
if (item)
|
||||
path = GIMP_PATH (item);
|
||||
|
||||
if (path && GIMP_IS_PATH (path))
|
||||
{
|
||||
g_object_set (layer->options, "path", path, NULL);
|
||||
|
||||
gimp_vector_layer_refresh (layer);
|
||||
gimp_image_flush (gimp_item_get_image (GIMP_ITEM (layer)));
|
||||
}
|
||||
}
|
34
app/dialogs/vector-layer-options-dialog.h
Normal file
34
app/dialogs/vector-layer-options-dialog.h
Normal file
@@ -0,0 +1,34 @@
|
||||
/* GIMP - The GNU Image Manipulation Program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* vector-layer-options-dialog.h
|
||||
*
|
||||
* Copyright 2006 Hendrik Boom
|
||||
*
|
||||
* 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 3 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, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __VECTOR_LAYER_OPTIONS_DIALOG_H__
|
||||
#define __VECTOR_LAYER_OPTIONS_DIALOG_H__
|
||||
|
||||
|
||||
GtkWidget * vector_layer_options_dialog_new (GimpVectorLayer *layer,
|
||||
GimpContext *context,
|
||||
const gchar *title,
|
||||
const gchar *icon_name,
|
||||
const gchar *help_id,
|
||||
GtkWidget *parent);
|
||||
|
||||
|
||||
#endif /* __VECTOR_LAYER_OPTIONS_DIALOG_H__ */
|
@@ -25,7 +25,6 @@
|
||||
#ifdef GDK_WINDOWING_WAYLAND
|
||||
#include <gdk/gdkwayland.h>
|
||||
#endif
|
||||
#include <gdk-pixbuf/gdk-pixbuf.h>
|
||||
|
||||
#include "libgimpbase/gimpbase.h"
|
||||
#include "libgimpconfig/gimpconfig.h"
|
||||
@@ -43,21 +42,21 @@
|
||||
#include "core/gimpcontainer.h"
|
||||
#include "core/gimpimagefile.h"
|
||||
|
||||
#include "dialogs/file-open-dialog.h"
|
||||
|
||||
#include "file/file-open.h"
|
||||
|
||||
#include "gui/icon-themes.h"
|
||||
#include "gui/themes.h"
|
||||
|
||||
#include "menus/menus.h"
|
||||
|
||||
#include "widgets/gimpdialogfactory.h"
|
||||
#include "widgets/gimphelp-ids.h"
|
||||
#include "widgets/gimpprefsbox.h"
|
||||
#include "widgets/gimprow.h"
|
||||
#include "widgets/gimpuimanager.h"
|
||||
#include "widgets/gimpwidgets-utils.h"
|
||||
|
||||
#include "menus/menus.h"
|
||||
|
||||
#include "gui/icon-themes.h"
|
||||
#include "gui/themes.h"
|
||||
|
||||
#include "file-open-dialog.h"
|
||||
#include "preferences-dialog-utils.h"
|
||||
#include "welcome-dialog.h"
|
||||
#include "welcome-dialog-data.h"
|
||||
@@ -115,6 +114,22 @@ static void welcome_open_activated_callback (GtkListBox *listbox,
|
||||
GtkWidget *welcome_dialog);
|
||||
static void welcome_open_images_callback (GtkWidget *button,
|
||||
GtkListBox *listbox);
|
||||
static void welcome_dialog_new_image_accelerator (GtkAccelGroup *accel_group,
|
||||
GObject *accelerator_widget,
|
||||
guint keyval,
|
||||
GdkModifierType mods,
|
||||
gpointer user_data);
|
||||
static void welcome_dialog_open_image_dialog_accelerator
|
||||
(GtkAccelGroup *accel_group,
|
||||
GObject *accelerator_widget,
|
||||
guint keyval,
|
||||
GdkModifierType mods,
|
||||
gpointer user_data);
|
||||
static void welcome_dialog_open_image_accelerator (GtkAccelGroup *accel_group,
|
||||
GObject *accelerator_widget,
|
||||
guint keyval,
|
||||
GdkModifierType mods,
|
||||
gpointer user_data);
|
||||
|
||||
static gboolean welcome_scrollable_resize (gpointer data);
|
||||
|
||||
@@ -170,17 +185,22 @@ welcome_dialog_new (Gimp *gimp,
|
||||
GimpConfig *config,
|
||||
gboolean show_welcome_page)
|
||||
{
|
||||
GtkWidget *dialog;
|
||||
GList *windows;
|
||||
GtkWidget *switcher;
|
||||
GtkWidget *stack;
|
||||
GtkWidget *tree_view;
|
||||
GtkTreeIter top_iter;
|
||||
GtkWidget *dialog;
|
||||
GList *windows;
|
||||
GtkWidget *switcher;
|
||||
GtkWidget *stack;
|
||||
GtkWidget *tree_view;
|
||||
GtkTreeIter top_iter;
|
||||
|
||||
GtkWidget *prefs_box;
|
||||
GtkWidget *main_vbox;
|
||||
GtkWidget *prefs_box;
|
||||
GtkWidget *main_vbox;
|
||||
|
||||
gchar *title;
|
||||
gchar *title;
|
||||
|
||||
GtkAccelGroup *accel_group;
|
||||
guint accel_key;
|
||||
GdkModifierType accel_mods;
|
||||
gchar **accels;
|
||||
|
||||
/* Translators: the %s string will be the version, e.g. "3.0". */
|
||||
title = g_strdup_printf (_("Welcome to GIMP %s"), GIMP_VERSION);
|
||||
@@ -300,6 +320,58 @@ welcome_dialog_new (Gimp *gimp,
|
||||
gtk_widget_set_visible (main_vbox, TRUE);
|
||||
}
|
||||
|
||||
/*************/
|
||||
/* Shortcuts */
|
||||
/*************/
|
||||
/* XXX: GtkAccelGroup will be deprecated in GTK4
|
||||
* See: https://docs.gtk.org/gtk4/migrating-3to4.html#use-the-new-apis-for-keyboard-shortcuts
|
||||
* This GtkAccelGroup must be converted to a GtkShortcutController
|
||||
*/
|
||||
accel_group = gtk_accel_group_new ();
|
||||
gtk_window_add_accel_group (GTK_WINDOW (dialog), accel_group);
|
||||
|
||||
accels = gtk_application_get_accels_for_action (GTK_APPLICATION (gimp->app),
|
||||
"app.image-new");
|
||||
if (accels && accels[0])
|
||||
{
|
||||
gtk_accelerator_parse (accels[0], &accel_key, &accel_mods);
|
||||
gtk_accel_group_connect (accel_group,
|
||||
accel_key, accel_mods, 0,
|
||||
g_cclosure_new (G_CALLBACK (welcome_dialog_new_image_accelerator),
|
||||
dialog, NULL));
|
||||
g_strfreev (accels);
|
||||
}
|
||||
|
||||
accels = gtk_application_get_accels_for_action (GTK_APPLICATION (gimp->app),
|
||||
"app.file-open");
|
||||
if (accels && accels[0])
|
||||
{
|
||||
gtk_accelerator_parse (accels[0], &accel_key, &accel_mods);
|
||||
gtk_accel_group_connect (accel_group,
|
||||
accel_key, accel_mods, 0,
|
||||
g_cclosure_new (G_CALLBACK (welcome_dialog_open_image_dialog_accelerator),
|
||||
dialog, NULL));
|
||||
g_strfreev (accels);
|
||||
}
|
||||
|
||||
for (guint i = 0; i < 10; i++)
|
||||
{
|
||||
gchar accel_str[24];
|
||||
|
||||
g_snprintf (accel_str, sizeof (accel_str), "app.file-open-recent-%02u", i + 1);
|
||||
accels = gtk_application_get_accels_for_action (GTK_APPLICATION (gimp->app),
|
||||
accel_str);
|
||||
if (accels && accels[0])
|
||||
{
|
||||
gtk_accelerator_parse (accels[0], &accel_key, &accel_mods);
|
||||
gtk_accel_group_connect (accel_group,
|
||||
accel_key, accel_mods, 0,
|
||||
g_cclosure_new (G_CALLBACK (welcome_dialog_open_image_accelerator),
|
||||
GUINT_TO_POINTER (i), NULL));
|
||||
g_strfreev (accels);
|
||||
}
|
||||
}
|
||||
|
||||
return dialog;
|
||||
}
|
||||
|
||||
@@ -742,13 +814,10 @@ welcome_dialog_create_creation_page (Gimp *gimp,
|
||||
{
|
||||
GimpImagefile *imagefile = NULL;
|
||||
GtkWidget *row;
|
||||
GtkWidget *grid;
|
||||
GtkWidget *name_label;
|
||||
GtkWidget *thumbnail = NULL;
|
||||
GFile *file;
|
||||
GimpThumbnail *icon;
|
||||
const gchar *name;
|
||||
gchar *basename;
|
||||
gchar *action_name;
|
||||
|
||||
imagefile = (GimpImagefile *)
|
||||
gimp_container_get_child_by_index (gimp->documents, i);
|
||||
@@ -770,45 +839,15 @@ welcome_dialog_create_creation_page (Gimp *gimp,
|
||||
continue;
|
||||
}
|
||||
|
||||
row = gtk_list_box_row_new ();
|
||||
g_object_set_data_full (G_OBJECT (row),
|
||||
"file", file,
|
||||
NULL);
|
||||
row = gimp_row_new (gimp_get_user_context (gimp),
|
||||
GIMP_VIEWABLE (imagefile),
|
||||
32, 0);
|
||||
|
||||
grid = gtk_grid_new ();
|
||||
gtk_grid_set_column_spacing (GTK_GRID (grid), 12);
|
||||
gtk_container_add (GTK_CONTAINER (row), grid);
|
||||
action_name = g_strdup_printf ("file-open-recent-%02u", i + 1);
|
||||
g_object_set_data_full (G_OBJECT (row), "action_name", action_name,
|
||||
g_free);
|
||||
|
||||
icon = gimp_imagefile_get_thumbnail (imagefile);
|
||||
if (icon)
|
||||
{
|
||||
GdkPixbuf *pixbuf = NULL;
|
||||
|
||||
pixbuf = gimp_thumbnail_load_thumb (icon, 1, NULL);
|
||||
if (! pixbuf)
|
||||
pixbuf = gimp_widget_load_icon (grid, GIMP_ICON_DIALOG_QUESTION,
|
||||
32);
|
||||
|
||||
if (pixbuf)
|
||||
{
|
||||
pixbuf = gdk_pixbuf_scale_simple (pixbuf,
|
||||
32, 32,
|
||||
GDK_INTERP_BILINEAR);
|
||||
|
||||
thumbnail = gtk_image_new_from_pixbuf (pixbuf);
|
||||
}
|
||||
}
|
||||
|
||||
if (thumbnail)
|
||||
gtk_grid_attach (GTK_GRID (grid), thumbnail, 1, 0, 1, 1);
|
||||
|
||||
name_label = gtk_label_new (basename);
|
||||
gtk_label_set_ellipsize (GTK_LABEL (name_label), PANGO_ELLIPSIZE_MIDDLE);
|
||||
g_free (basename);
|
||||
g_object_set (name_label, "xalign", 0.0, NULL);
|
||||
gtk_grid_attach (GTK_GRID (grid), name_label, 2, 0, 1, 1);
|
||||
|
||||
gtk_widget_show_all (row);
|
||||
gtk_widget_set_visible (row, TRUE);
|
||||
gtk_list_box_insert (GTK_LIST_BOX (listbox), row, -1);
|
||||
}
|
||||
|
||||
@@ -1008,19 +1047,20 @@ welcome_dialog_create_release_page (Gimp *gimp,
|
||||
{
|
||||
GtkWidget *row;
|
||||
gchar *markup;
|
||||
gchar *text;
|
||||
|
||||
text = g_markup_escape_text (_((gchar *) gimp_welcome_dialog_items[i]), -1);
|
||||
|
||||
/* Add a bold dot for pretty listing. */
|
||||
if (i < gimp_welcome_dialog_n_items &&
|
||||
gimp_welcome_dialog_demos[i] != NULL)
|
||||
{
|
||||
markup = g_strdup_printf ("<span weight='ultrabold'>\xe2\x96\xb6</span> %s",
|
||||
_((gchar *) gimp_welcome_dialog_items[i]));
|
||||
markup = g_strdup_printf ("<span weight='ultrabold'>\xe2\x96\xb6</span> %s", text);
|
||||
n_demos++;
|
||||
}
|
||||
else
|
||||
{
|
||||
markup = g_strdup_printf ("<span weight='ultrabold'>\xe2\x80\xa2</span> %s",
|
||||
_((gchar *) gimp_welcome_dialog_items[i]));
|
||||
markup = g_strdup_printf ("<span weight='ultrabold'>\xe2\x80\xa2</span> %s", text);
|
||||
}
|
||||
|
||||
row = gtk_list_box_row_new ();
|
||||
@@ -1037,6 +1077,7 @@ welcome_dialog_create_release_page (Gimp *gimp,
|
||||
gtk_widget_show_all (row);
|
||||
|
||||
g_free (markup);
|
||||
g_free (text);
|
||||
}
|
||||
gtk_container_add (GTK_CONTAINER (scrolled_window), listbox);
|
||||
gtk_list_box_set_selection_mode (GTK_LIST_BOX (listbox),
|
||||
@@ -1131,12 +1172,13 @@ static void
|
||||
welcome_dialog_open_image_dialog (GtkWidget *button,
|
||||
GtkWidget *welcome_dialog)
|
||||
{
|
||||
Gimp *gimp = g_object_get_data (G_OBJECT (welcome_dialog), "gimp");
|
||||
GtkWidget *dialog;
|
||||
Gimp *gimp = g_object_get_data (G_OBJECT (welcome_dialog), "gimp");
|
||||
GtkWidget *dialog = file_open_dialog_new (gimp);
|
||||
GimpUIManager *manager = menus_get_image_manager_singleton (gimp);
|
||||
|
||||
dialog = file_open_dialog_new (gimp);
|
||||
|
||||
if (dialog)
|
||||
if (gimp_ui_manager_activate_action (manager, "file", "file-open") &&
|
||||
(dialog = gimp_dialog_factory_find_widget (gimp_dialog_factory_get_singleton (),
|
||||
"gimp-file-open-dialog")))
|
||||
{
|
||||
gtk_widget_set_visible (welcome_dialog, FALSE);
|
||||
|
||||
@@ -1208,18 +1250,17 @@ static void
|
||||
welcome_open_images_callback (GtkWidget *button,
|
||||
GtkListBox *listbox)
|
||||
{
|
||||
GList *rows = NULL;
|
||||
Gimp *gimp = NULL;
|
||||
GError *error = NULL;
|
||||
gboolean opened = FALSE;
|
||||
GtkWidget *parent;
|
||||
GList *rows = NULL;
|
||||
Gimp *gimp = NULL;
|
||||
gboolean opened = FALSE;
|
||||
gchar *action_name;
|
||||
GimpUIManager *manager;
|
||||
|
||||
if (! welcome_dialog)
|
||||
return;
|
||||
|
||||
gimp = g_object_get_data (G_OBJECT (welcome_dialog), "gimp");
|
||||
|
||||
parent = gtk_widget_get_parent (welcome_dialog);
|
||||
manager = menus_get_image_manager_singleton (gimp);
|
||||
|
||||
rows = gtk_list_box_get_selected_rows (listbox);
|
||||
if (rows)
|
||||
@@ -1228,30 +1269,11 @@ welcome_open_images_callback (GtkWidget *button,
|
||||
|
||||
for (GList *iter = rows; iter; iter = iter->next)
|
||||
{
|
||||
GFile *file = NULL;
|
||||
GimpImage *image = NULL;
|
||||
const gchar *name;
|
||||
GimpPDBStatusType status;
|
||||
action_name = (gchar *) g_object_get_data (G_OBJECT (iter->data),
|
||||
"action_name");
|
||||
|
||||
file = g_object_get_data (G_OBJECT (iter->data), "file");
|
||||
name = gimp_file_get_utf8_name (file);
|
||||
|
||||
if (file && g_file_test (name, G_FILE_TEST_IS_REGULAR))
|
||||
image = file_open_with_display (gimp, gimp_get_user_context (gimp),
|
||||
NULL, file, FALSE, NULL, &status,
|
||||
&error);
|
||||
|
||||
if (! image && status != GIMP_PDB_CANCEL)
|
||||
{
|
||||
gimp_message (gimp, G_OBJECT (parent), GIMP_MESSAGE_ERROR,
|
||||
_("Opening '%s' failed:\n\n%s"),
|
||||
gimp_file_get_utf8_name (file), error->message);
|
||||
g_clear_error (&error);
|
||||
}
|
||||
else
|
||||
{
|
||||
opened = TRUE;
|
||||
}
|
||||
if (gimp_ui_manager_activate_action (manager, "file", action_name))
|
||||
opened = TRUE;
|
||||
}
|
||||
|
||||
g_list_free (rows);
|
||||
@@ -1490,3 +1512,45 @@ welcome_scrollable_resize (gpointer data)
|
||||
|
||||
return G_SOURCE_REMOVE;
|
||||
}
|
||||
|
||||
static void
|
||||
welcome_dialog_new_image_accelerator (GtkAccelGroup *accel_group,
|
||||
GObject *accelerator_widget,
|
||||
guint keyval,
|
||||
GdkModifierType mods,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkWidget *dialog = GTK_WIDGET (user_data);
|
||||
|
||||
welcome_dialog_new_image_dialog (NULL, dialog);
|
||||
}
|
||||
|
||||
static void
|
||||
welcome_dialog_open_image_dialog_accelerator (GtkAccelGroup *accel_group,
|
||||
GObject *accelerator_widget,
|
||||
guint keyval,
|
||||
GdkModifierType mods,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkWidget *dialog = GTK_WIDGET (user_data);
|
||||
|
||||
welcome_dialog_open_image_dialog (NULL, dialog);
|
||||
}
|
||||
|
||||
static void
|
||||
welcome_dialog_open_image_accelerator (GtkAccelGroup *accel_group,
|
||||
GObject *accelerator_widget,
|
||||
guint keyval,
|
||||
GdkModifierType mods,
|
||||
gpointer user_data)
|
||||
{
|
||||
Gimp *gimp = g_object_get_data (G_OBJECT (welcome_dialog), "gimp");
|
||||
GimpUIManager *manager = menus_get_image_manager_singleton (gimp);
|
||||
guint index = GPOINTER_TO_UINT (user_data);
|
||||
gchar action_name[20];
|
||||
|
||||
g_snprintf (action_name, sizeof (action_name), "file-open-recent-%02u", index + 1);
|
||||
|
||||
if (gimp_ui_manager_activate_action (manager, "file", action_name))
|
||||
gtk_widget_destroy (welcome_dialog);
|
||||
}
|
||||
|
@@ -34,6 +34,8 @@
|
||||
#include "core/gimpgrid.h"
|
||||
#include "core/gimplayer.h"
|
||||
|
||||
#include "path/gimpvectorlayer.h"
|
||||
|
||||
#include "gimpcanvas.h"
|
||||
#include "gimpcanvas-style.h"
|
||||
|
||||
@@ -431,6 +433,15 @@ gimp_canvas_set_layer_style (GtkWidget *canvas,
|
||||
pattern = gimp_cairo_pattern_create_stipple (layer_group_fg, layer_group_bg, 0,
|
||||
offset_x, offset_y, render_space);
|
||||
}
|
||||
else if (gimp_item_is_vector_layer (GIMP_ITEM (layer)))
|
||||
{
|
||||
GeglColor *transparent = gegl_color_new ("transparent");
|
||||
|
||||
pattern = gimp_cairo_pattern_create_stipple (transparent, transparent, 0,
|
||||
offset_x, offset_y, render_space);
|
||||
|
||||
g_clear_object (&transparent);
|
||||
}
|
||||
else
|
||||
{
|
||||
pattern = gimp_cairo_pattern_create_stipple (layer_fg, layer_bg, 0,
|
||||
|
@@ -378,7 +378,7 @@ gimp_canvas_layer_boundary_set_layers (GimpCanvasLayerBoundary *boundary,
|
||||
}
|
||||
|
||||
if (x1 != (gint) x ||
|
||||
x1 != (gint) y ||
|
||||
y1 != (gint) y ||
|
||||
(x2 - x1) != (gint) w ||
|
||||
(y2 - y1) != (gint) h ||
|
||||
edit_mask != private->edit_mask)
|
||||
|
@@ -571,7 +571,7 @@ gimp_display_shell_drop_uri_list (GtkWidget *widget,
|
||||
|
||||
new_layers = file_open_layers (shell->display->gimp, context,
|
||||
GIMP_PROGRESS (shell->display),
|
||||
image, FALSE,
|
||||
image, FALSE, FALSE,
|
||||
file, GIMP_RUN_INTERACTIVE, NULL,
|
||||
&status, &error);
|
||||
|
||||
|
@@ -1289,9 +1289,9 @@ gimp_display_shell_scale_image_starts_to_fit (GimpDisplayShell *shell,
|
||||
&new_scale_width,
|
||||
&new_scale_height);
|
||||
|
||||
*vertically = (current_scale_width > shell->disp_width &&
|
||||
*horizontally = (current_scale_width > shell->disp_width &&
|
||||
new_scale_width <= shell->disp_width);
|
||||
*horizontally = (current_scale_height > shell->disp_height &&
|
||||
*vertically = (current_scale_height > shell->disp_height &&
|
||||
new_scale_height <= shell->disp_height);
|
||||
}
|
||||
|
||||
|
@@ -1052,7 +1052,7 @@ gimp_display_shell_canvas_tool_events (GtkWidget *canvas,
|
||||
|
||||
if (gimp_display_shell_key_to_state (kevent->keyval) == GDK_MOD1_MASK)
|
||||
/* Make sure the picked layer is reset. */
|
||||
shell->picked_layer = NULL;
|
||||
g_clear_weak_pointer (&shell->picked_layer);
|
||||
|
||||
switch (kevent->keyval)
|
||||
{
|
||||
@@ -1151,7 +1151,7 @@ gimp_display_shell_canvas_tool_events (GtkWidget *canvas,
|
||||
statusbar = gimp_display_shell_get_statusbar (shell);
|
||||
gimp_statusbar_pop_temp (statusbar);
|
||||
|
||||
shell->picked_layer = NULL;
|
||||
g_clear_weak_pointer (&shell->picked_layer);
|
||||
shell->mod_action = GIMP_MODIFIER_ACTION_NONE;
|
||||
}
|
||||
else if (shell->mod_action != GIMP_MODIFIER_ACTION_NONE &&
|
||||
@@ -1767,7 +1767,7 @@ gimp_display_shell_start_scrolling (GimpDisplayShell *shell,
|
||||
_("Layer picked: '%s'"),
|
||||
gimp_object_get_name (layer));
|
||||
}
|
||||
shell->picked_layer = layer;
|
||||
g_set_weak_pointer (&shell->picked_layer, layer);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@@ -920,6 +920,7 @@ gimp_display_shell_finalize (GObject *object)
|
||||
g_clear_object (&shell->no_image_options);
|
||||
g_clear_pointer (&shell->title, g_free);
|
||||
g_clear_pointer (&shell->status, g_free);
|
||||
g_clear_weak_pointer (&shell->picked_layer);
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
@@ -2125,7 +2125,7 @@ gimp_image_window_switch_page (GtkNotebook *notebook,
|
||||
NULL /*new_entry_id*/,
|
||||
gimp_widget_get_monitor (GTK_WIDGET (window)));
|
||||
}
|
||||
else
|
||||
else if (private->initial_monitor != NULL)
|
||||
{
|
||||
/* we are in construction, use the initial monitor; calling
|
||||
* gimp_widget_get_monitor() would get us the monitor where the
|
||||
|
@@ -513,13 +513,17 @@ gimp_modifiers_manager_get_keys (GdkDevice *device,
|
||||
gchar **actions_key,
|
||||
gchar **buttons_key)
|
||||
{
|
||||
const gchar *vendor_id;
|
||||
const gchar *product_id;
|
||||
const gchar *vendor_id = NULL;
|
||||
const gchar *product_id = NULL;
|
||||
|
||||
g_return_if_fail (GDK_IS_DEVICE (device) || device == NULL);
|
||||
|
||||
vendor_id = device ? gdk_device_get_vendor_id (device) : NULL;
|
||||
product_id = device ? gdk_device_get_product_id (device) : NULL;
|
||||
if (device && gdk_device_get_device_type (device) != GDK_DEVICE_TYPE_MASTER)
|
||||
{
|
||||
vendor_id = gdk_device_get_vendor_id (device);
|
||||
product_id = gdk_device_get_product_id (device);
|
||||
}
|
||||
|
||||
modifiers = modifiers & gimp_get_all_modifiers_mask ();
|
||||
|
||||
if (actions_key)
|
||||
|
@@ -215,15 +215,19 @@ file_gih_pipe_to_image (Gimp *gimp,
|
||||
* described in the header" means) -- mitch
|
||||
*/
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
gimp_pixpipe_params_init (¶ms);
|
||||
gimp_pixpipe_params_parse (pipe->params, ¶ms);
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
|
||||
params.cellwidth = gimp_image_get_width (image);
|
||||
params.cellheight = gimp_image_get_height (image);
|
||||
params.cols = 1;
|
||||
params.rows = 1;
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
paramstring = gimp_pixpipe_params_build (¶ms);
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
if (paramstring)
|
||||
{
|
||||
parasite = gimp_parasite_new ("gimp-brush-pipe-parameters",
|
||||
@@ -235,7 +239,9 @@ file_gih_pipe_to_image (Gimp *gimp,
|
||||
g_free (paramstring);
|
||||
}
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
gimp_pixpipe_params_free (¶ms);
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
}
|
||||
|
||||
return image;
|
||||
@@ -262,8 +268,10 @@ file_gih_image_to_pipe (GimpImage *image,
|
||||
"spacing", spacing,
|
||||
NULL);
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
gimp_pixpipe_params_init (¶ms);
|
||||
gimp_pixpipe_params_parse (paramstring, ¶ms);
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
|
||||
image_width = gimp_image_get_width (image);
|
||||
image_height = gimp_image_get_height (image);
|
||||
@@ -353,7 +361,9 @@ file_gih_image_to_pipe (GimpImage *image,
|
||||
|
||||
g_list_free (brushes);
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
gimp_pixpipe_params_free (¶ms);
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
|
||||
gimp_brush_pipe_set_params (pipe, paramstring);
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user