I#1317 - HTMLEditor: Add "Preserve ratio" into image properties dialog

Closes https://gitlab.gnome.org/GNOME/evolution/-/issues/1317
This commit is contained in:
Milan Crha
2021-01-12 16:56:43 +01:00
parent ab96d90453
commit 684cdabac0
7 changed files with 1415 additions and 106 deletions

View File

@ -112,6 +112,8 @@ set(private_icons
hicolor_status_16x16_wrapped.png
hicolor_status_32x32_offline.png
hicolor_status_32x32_online.png
hicolor_status_32x32_aspect-ratio-lock.png
hicolor_status_32x32_aspect-ratio-unlock.png
)
# These icons were in gnome-icon-theme prior to GNOME 2.30.
@ -223,6 +225,8 @@ set(noinst_icons
hicolor_places_22x22_mail-sent.svg
hicolor_status_32x32_offline.svg
hicolor_status_32x32_online.svg
hicolor_status_scalable_aspect-ratio-lock.svg
hicolor_status_scalable_aspect-ratio-unlock.svg
)
add_icon_cache_files("${SHARE_INSTALL_PREFIX}" public_icons)

Binary file not shown.

After

Width:  |  Height:  |  Size: 840 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 887 B

View File

@ -0,0 +1,312 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
inkscape:output_extension="org.inkscape.output.svg.inkscape"
sodipodi:docname="hicolor_status_32x32_aspect-ratio-lock.svg"
version="1.0"
inkscape:version="1.0 (4035a4fb49, 2020-05-01)"
sodipodi:version="0.32"
id="svg5125"
height="32"
width="16">
<defs
id="defs5127">
<linearGradient
inkscape:collect="always"
id="linearGradient6875">
<stop
style="stop-color:#000000;stop-opacity:1;"
offset="0"
id="stop6877" />
<stop
style="stop-color:#ffffff;stop-opacity:1"
offset="1"
id="stop6879" />
</linearGradient>
<linearGradient
id="linearGradient5156">
<stop
style="stop-color:#cbcbc4;stop-opacity:1;"
offset="0"
id="stop5158" />
<stop
id="stop5160"
offset="0.72343725"
style="stop-color:#878983;stop-opacity:1" />
<stop
style="stop-color:#c9cac7;stop-opacity:1"
offset="1"
id="stop5162" />
</linearGradient>
<filter
inkscape:collect="always"
x="-0.18061832"
width="1.3612366"
y="-0.26189652"
height="1.5237931"
id="filter5312">
<feGaussianBlur
inkscape:collect="always"
stdDeviation="0.38581007"
id="feGaussianBlur5314" />
</filter>
<linearGradient
inkscape:collect="always"
id="linearGradient5324">
<stop
style="stop-color:#ffffff;stop-opacity:1;"
offset="0"
id="stop5326" />
<stop
style="stop-color:#ffffff;stop-opacity:0;"
offset="1"
id="stop5328" />
</linearGradient>
<linearGradient
gradientTransform="matrix(1.0225564,0,0,1.0098039,21.752672,-2.9985005)"
gradientUnits="userSpaceOnUse"
y2="5.0840392"
x2="18.906874"
y1="10.652505"
x1="18.923338"
id="linearGradient6765"
xlink:href="#linearGradient5156"
inkscape:collect="always" />
<linearGradient
y2="16.640388"
x2="17.293747"
y1="6"
x1="17.435883"
gradientTransform="matrix(0.7986885,0,0,0.8693491,9.8875434,-18.176176)"
gradientUnits="userSpaceOnUse"
id="linearGradient6781"
xlink:href="#linearGradient5156"
inkscape:collect="always" />
<linearGradient
gradientUnits="userSpaceOnUse"
y2="7.1558542"
x2="14"
y1="16.480825"
x1="14.056891"
id="linearGradient6802"
xlink:href="#linearGradient5324"
inkscape:collect="always" />
<linearGradient
y2="10.784233"
x2="12.271223"
y1="3.9783304"
x1="12.344958"
gradientUnits="userSpaceOnUse"
id="linearGradient6861"
xlink:href="#linearGradient5156"
inkscape:collect="always" />
<linearGradient
y2="7.875"
x2="1.9840925"
y1="7.875"
x1="0.8125"
gradientTransform="matrix(3.6041364,0,0,1.5837658,-33.062638,-1.3176926)"
gradientUnits="userSpaceOnUse"
id="linearGradient6921"
xlink:href="#linearGradient6875"
inkscape:collect="always" />
<mask
id="mask6917"
maskUnits="userSpaceOnUse">
<rect
transform="scale(-1,1)"
y="5.088717"
x="-32.927605"
height="12.598779"
width="21.343765"
id="rect6919"
style="fill:url(#linearGradient6921);fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
</mask>
<linearGradient
y2="7.875"
x2="1.9840925"
y1="7.875"
x1="0.8125"
gradientTransform="matrix(2.8785823,0,0,1.2649355,-0.07038306,-2.1167256)"
gradientUnits="userSpaceOnUse"
id="linearGradient6927"
xlink:href="#linearGradient6875"
inkscape:collect="always" />
<mask
id="mask6923"
maskUnits="userSpaceOnUse">
<rect
y="3"
x="0.037466049"
height="10.0625"
width="17.04702"
id="rect6925"
style="fill:url(#linearGradient6927);fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
</mask>
<linearGradient
y2="7.875"
x2="1.9840925"
y1="7.875"
x1="0.8125"
gradientTransform="matrix(2.8785823,0,0,1.2649355,-0.07038306,-2.1167256)"
gradientUnits="userSpaceOnUse"
id="linearGradient6933"
xlink:href="#linearGradient6875"
inkscape:collect="always" />
<mask
id="mask6929"
maskUnits="userSpaceOnUse">
<rect
y="3"
x="0.037466049"
height="10.0625"
width="17.04702"
id="rect6931"
style="fill:url(#linearGradient6933);fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
</mask>
<linearGradient
y2="7.875"
x2="1.9840925"
y1="7.875"
x1="0.8125"
gradientTransform="matrix(2.8785823,0,0,1.2649355,-0.07038306,-2.1167256)"
gradientUnits="userSpaceOnUse"
id="linearGradient6939"
xlink:href="#linearGradient6875"
inkscape:collect="always" />
<mask
id="mask6935"
maskUnits="userSpaceOnUse">
<rect
y="3"
x="0.037466049"
height="10.0625"
width="17.04702"
id="rect6937"
style="fill:url(#linearGradient6939);fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
</mask>
<linearGradient
y2="10.784233"
x2="12.271223"
y1="3.9783304"
x1="12.344958"
gradientUnits="userSpaceOnUse"
id="linearGradient6955"
xlink:href="#linearGradient5156"
inkscape:collect="always" />
<linearGradient
y2="7.1558542"
x2="14"
y1="16.480825"
x1="14.056891"
gradientUnits="userSpaceOnUse"
id="linearGradient6957"
xlink:href="#linearGradient5324"
inkscape:collect="always" />
</defs>
<sodipodi:namedview
inkscape:window-maximized="0"
inkscape:document-rotation="0"
inkscape:window-y="74"
inkscape:window-x="178"
inkscape:window-height="704"
inkscape:window-width="1106"
inkscape:document-units="px"
inkscape:grid-bbox="true"
showgrid="true"
inkscape:current-layer="layer1"
inkscape:cy="12.520478"
inkscape:cx="13.160011"
inkscape:zoom="16"
inkscape:pageshadow="2"
inkscape:pageopacity="0.0"
borderopacity="1.0"
bordercolor="#666666"
pagecolor="#ffffff"
id="base">
<inkscape:grid
spacingy="1"
spacingx="1"
units="px"
dotted="true"
enabled="true"
visible="true"
id="grid5148"
type="xygrid" />
</sodipodi:namedview>
<metadata
id="metadata5130">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:groupmode="layer"
inkscape:label="Layer 1"
id="layer1">
<g
transform="rotate(90,8.0248254,7.5290472)"
id="g579">
<g
id="g568">
<g
id="g6945">
<path
style="fill:url(#linearGradient6861);fill-opacity:1;stroke:#555753;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
d="m 15.6875,3.5 c -2.599018,0 -4.743733,1.6494833 -5.125,3.8125 V 6.53125 H 1.53125 v 2.875 H 10.5625 V 8.6875 c 0.381267,2.163016 2.525982,3.8125 5.125,3.8125 L 16.5,11.4375 V 4.71875 Z"
id="rect6806"
sodipodi:nodetypes="ccccccccccc"
mask="url(#mask6935)" />
<path
id="path6771"
d="M 14.760854,4.5537089 15.162639,4.519141 15.47425,5 l 0.04419,5.91767 -0.388715,0.554276 -0.245372,-0.0037 c 0,0 -3.349677,-0.460746 -3.349677,-3.3790301 0,-2.8740895 3.226174,-3.535534 3.226174,-3.535534 z"
style="fill:none;fill-rule:evenodd;stroke:url(#linearGradient6802);stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
sodipodi:nodetypes="cccccczc"
mask="url(#mask6923)" />
</g>
<g
transform="matrix(-1,0,0,1,33.057256,0.133437)"
id="g6949">
<path
style="fill:url(#linearGradient6955);fill-opacity:1;stroke:#555753;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
d="m 15.6875,3.5 c -2.599018,0 -4.743733,1.6494833 -5.125,3.8125 V 6.53125 H 1.53125 v 2.875 H 10.5625 V 8.6875 c 0.381267,2.163016 2.525982,3.8125 5.125,3.8125 L 16.5,11.4375 V 4.71875 Z"
id="path6951"
sodipodi:nodetypes="ccccccccccc"
mask="url(#mask6935)" />
<path
id="path6953"
d="M 14.760854,4.5537089 15.162639,4.519141 15.47425,5 l 0.04419,5.91767 -0.388715,0.554276 -0.245372,-0.0037 c 0,0 -3.349677,-0.460746 -3.349677,-3.3790301 0,-2.8740895 3.226174,-3.535534 3.226174,-3.535534 z"
style="fill:none;fill-rule:evenodd;stroke:url(#linearGradient6957);stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
sodipodi:nodetypes="cccccczc"
mask="url(#mask6923)" />
</g>
</g>
<path
style="opacity:0.469484;fill:none;fill-rule:evenodd;stroke:#dfe0de;stroke-width:1px;stroke-linecap:round;stroke-linejoin:miter;stroke-opacity:1"
d="M 3,7.5 H 8.9375"
id="path6821"
sodipodi:nodetypes="cc"
mask="url(#mask6929)" />
<path
sodipodi:nodetypes="ccccc"
id="path6819"
d="M 13.479223,8.2668741 14.142136,7.6481556 C 16.950937,7.8603852 17.897062,9.4547099 18.605747,11.18369 17.332956,10.494445 17.320424,9.3668499 13.572986,9.5383523 Z"
style="display:inline;overflow:visible;visibility:visible;opacity:0.729885;fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:2.25;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;marker-start:none;marker-mid:none;marker-end:none;filter:url(#filter5312);enable-background:accumulate"
transform="matrix(-0.7986885,0,0,0.7986885,26.336366,-1.0642997)"
mask="url(#mask6917)" />
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 11 KiB

View File

@ -0,0 +1,905 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="16"
height="32"
id="svg5125"
sodipodi:version="0.32"
inkscape:version="1.0 (4035a4fb49, 2020-05-01)"
version="1.0"
sodipodi:docname="hicolor_status_32x32_aspect-ratio-unlock.svg"
inkscape:output_extension="org.inkscape.output.svg.inkscape"
inkscape:export-filename="/home/andreas/project/misc icons/offline.png"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90">
<defs
id="defs5127">
<linearGradient
id="linearGradient6875"
inkscape:collect="always">
<stop
id="stop6877"
offset="0"
style="stop-color:#000000;stop-opacity:1;" />
<stop
id="stop6879"
offset="1"
style="stop-color:#ffffff;stop-opacity:1" />
</linearGradient>
<linearGradient
inkscape:collect="always"
id="linearGradient6828">
<stop
style="stop-color:#000000;stop-opacity:1;"
offset="0"
id="stop6830" />
<stop
style="stop-color:#ffffff;stop-opacity:1"
offset="1"
id="stop6832" />
</linearGradient>
<linearGradient
inkscape:collect="always"
id="linearGradient6598">
<stop
style="stop-color:#555753;stop-opacity:1;"
offset="0"
id="stop6600" />
<stop
style="stop-color:#61625f;stop-opacity:1"
offset="1"
id="stop6602" />
</linearGradient>
<linearGradient
inkscape:collect="always"
id="linearGradient6590">
<stop
style="stop-color:#ffffff;stop-opacity:1;"
offset="0"
id="stop6592" />
<stop
style="stop-color:#ffffff;stop-opacity:0;"
offset="1"
id="stop6594" />
</linearGradient>
<linearGradient
id="linearGradient6260"
inkscape:collect="always">
<stop
id="stop6262"
offset="0"
style="stop-color:#888a85;stop-opacity:1;" />
<stop
style="stop-color:#b6b7b5;stop-opacity:1"
offset="0.71731967"
id="stop6578" />
<stop
id="stop6264"
offset="1"
style="stop-color:#a7a9a6;stop-opacity:1" />
</linearGradient>
<linearGradient
inkscape:collect="always"
id="linearGradient5174">
<stop
style="stop-color:#888a85;stop-opacity:1;"
offset="0"
id="stop5176" />
<stop
style="stop-color:#a9aba7;stop-opacity:1"
offset="1"
id="stop5178" />
</linearGradient>
<inkscape:perspective
sodipodi:type="inkscape:persp3d"
inkscape:vp_x="0 : 32 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_z="32 : 32 : 1"
inkscape:persp3d-origin="16 : 26.666667 : 1"
id="perspective5133" />
<inkscape:perspective
id="perspective5142"
inkscape:persp3d-origin="372.04724 : 366.78739 : 1"
inkscape:vp_z="744.09448 : 542.18109 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 542.18109 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective5159"
inkscape:persp3d-origin="372.04724 : 366.78739 : 1"
inkscape:vp_z="744.09448 : 542.18109 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 542.18109 : 1"
sodipodi:type="inkscape:persp3d" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient6260"
id="linearGradient5180"
x1="14.875"
y1="10.285427"
x2="14.875"
y2="3.4389067"
gradientUnits="userSpaceOnUse" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient5174"
id="linearGradient5956"
gradientUnits="userSpaceOnUse"
x1="14"
y1="4.9514565"
x2="14"
y2="10.876407"
gradientTransform="matrix(-1,0,0,1,33.065167,-0.0029679)" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient6260"
id="linearGradient6582"
gradientUnits="userSpaceOnUse"
x1="14.875"
y1="10.285427"
x2="14.875"
y2="3.4389067"
gradientTransform="matrix(-1,0,0,1,33.031342,0.03492199)" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient6260"
id="linearGradient6586"
gradientUnits="userSpaceOnUse"
x1="14.875"
y1="10.285427"
x2="14.875"
y2="3.4389067"
gradientTransform="translate(0.656158,0.997032)" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient6590"
id="linearGradient6596"
x1="16.352375"
y1="5.3702998"
x2="16.258625"
y2="12.234408"
gradientUnits="userSpaceOnUse" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient6598"
id="linearGradient6604"
x1="20.507713"
y1="3.5363884"
x2="20.693243"
y2="9.1661215"
gradientUnits="userSpaceOnUse" />
<linearGradient
y2="16.640388"
x2="17.293747"
y1="6"
x1="17.435883"
gradientTransform="matrix(1,0,0,1.0884708,-2.295049,13.054382)"
gradientUnits="userSpaceOnUse"
id="linearGradient5721"
xlink:href="#linearGradient5156"
inkscape:collect="always" />
<linearGradient
y2="11.693966"
x2="16.90625"
y1="16.75"
x1="16.90625"
gradientTransform="matrix(-1,0,0,1.1369793,22.704951,12.328139)"
gradientUnits="userSpaceOnUse"
id="linearGradient5717"
xlink:href="#linearGradient5324"
inkscape:collect="always" />
<linearGradient
y2="11.693966"
x2="16.90625"
y1="16.75"
x1="16.90625"
gradientTransform="matrix(-1,0,0,1.1369793,16.954951,-5.3013027)"
gradientUnits="userSpaceOnUse"
id="linearGradient5712"
xlink:href="#linearGradient5324"
inkscape:collect="always" />
<linearGradient
y2="16.640388"
x2="17.293747"
y1="6"
x1="17.435883"
gradientTransform="matrix(1,0,0,1.0884708,-8.045049,-4.57506)"
gradientUnits="userSpaceOnUse"
id="linearGradient5710"
xlink:href="#linearGradient5156"
inkscape:collect="always" />
<radialGradient
r="10.0625"
fy="19.625"
fx="12.1875"
cy="19.625"
cx="12.1875"
gradientTransform="matrix(1,0,0,0.1987578,0,15.724379)"
gradientUnits="userSpaceOnUse"
id="radialGradient5708"
xlink:href="#linearGradient5168"
inkscape:collect="always" />
<linearGradient
inkscape:collect="always"
id="linearGradient5266">
<stop
style="stop-color:#ffffff;stop-opacity:1;"
offset="0"
id="stop5268" />
<stop
id="stop5276"
offset="0.47403327"
style="stop-color:#ffffff;stop-opacity:0.68627451;" />
<stop
style="stop-color:#ffffff;stop-opacity:0;"
offset="1"
id="stop5270" />
</linearGradient>
<linearGradient
id="linearGradient5626">
<stop
style="stop-color:#cbcbc4;stop-opacity:1;"
offset="0"
id="stop5628" />
<stop
id="stop5630"
offset="0.72343725"
style="stop-color:#878983;stop-opacity:1" />
<stop
style="stop-color:#c9cac7;stop-opacity:1"
offset="1"
id="stop5632" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient7045"
id="linearGradient5646"
x1="14.738757"
y1="1.4822139"
x2="15.501282"
y2="1.4822139"
gradientUnits="userSpaceOnUse"
gradientTransform="translate(0,5)" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient7061"
id="linearGradient5654"
x1="14.827146"
y1="2.4986799"
x2="15.75"
y2="2.4986799"
gradientUnits="userSpaceOnUse"
gradientTransform="translate(16,6.5)" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient6816"
id="radialGradient5669"
cx="7"
cy="14"
fx="7"
fy="14"
r="7.5"
gradientTransform="matrix(1,0,0,0.25,0,10.5)"
gradientUnits="userSpaceOnUse" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient6776"
id="linearGradient5671"
gradientUnits="userSpaceOnUse"
gradientTransform="translate(1,-1)"
x1="14.5625"
y1="3.125"
x2="14.5625"
y2="13.672975" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient7098"
id="linearGradient5673"
gradientUnits="userSpaceOnUse"
gradientTransform="translate(1,4)"
x1="12.59375"
y1="7.5625"
x2="14.314325"
y2="7.5625" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient5156"
id="linearGradient4959"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(-1,0,0,1,26,4)"
x1="9.4133587"
y1="0.34235775"
x2="9.4133587"
y2="12.96875" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient5168"
id="radialGradient5676"
cx="12.1875"
cy="19.625"
fx="12.1875"
fy="19.625"
r="10.0625"
gradientTransform="matrix(1,0,0,0.1987578,0,15.724379)"
gradientUnits="userSpaceOnUse" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient5266"
id="linearGradient5272"
x1="17.375"
y1="10.375"
x2="17"
y2="14.75"
gradientUnits="userSpaceOnUse" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient5266"
id="linearGradient5274"
gradientUnits="userSpaceOnUse"
x1="17.198223"
y1="7.03125"
x2="17"
y2="14.75" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient5156"
id="linearGradient5684"
x1="17.435883"
y1="6"
x2="17.293747"
y2="16.640388"
gradientUnits="userSpaceOnUse" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient5324"
id="linearGradient5330"
x1="16.90625"
y1="16.75"
x2="16.90625"
y2="11.693966"
gradientUnits="userSpaceOnUse" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient5324"
id="linearGradient5691"
gradientUnits="userSpaceOnUse"
x1="16.90625"
y1="16.75"
x2="16.90625"
y2="11.693966"
gradientTransform="matrix(-1,0,0,1,25,0)" />
<linearGradient
y2="13.672975"
x2="14.5625"
y1="3.125"
x1="14.5625"
gradientTransform="translate(1,-1)"
gradientUnits="userSpaceOnUse"
id="linearGradient6825"
xlink:href="#linearGradient6776"
inkscape:collect="always" />
<radialGradient
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1,0,0,0.25,0,10.5)"
r="7.5"
fy="14"
fx="7"
cy="14"
cx="7"
id="radialGradient6822"
xlink:href="#linearGradient6816"
inkscape:collect="always" />
<linearGradient
inkscape:collect="always"
id="linearGradient6776">
<stop
style="stop-color:#eeeeec;stop-opacity:1;"
offset="0"
id="stop6778" />
<stop
style="stop-color:#888a85;stop-opacity:1"
offset="1"
id="stop6780" />
</linearGradient>
<linearGradient
id="linearGradient6816"
inkscape:collect="always">
<stop
id="stop6818"
offset="0"
style="stop-color:#000000;stop-opacity:1;" />
<stop
id="stop6820"
offset="1"
style="stop-color:#000000;stop-opacity:0;" />
</linearGradient>
<linearGradient
id="linearGradient7061"
inkscape:collect="always">
<stop
id="stop7063"
offset="0"
style="stop-color:#ffffff;stop-opacity:1;" />
<stop
id="stop7065"
offset="1"
style="stop-color:#ffffff;stop-opacity:0;" />
</linearGradient>
<linearGradient
id="linearGradient7045"
inkscape:collect="always">
<stop
id="stop7047"
offset="0"
style="stop-color:#747671;stop-opacity:1" />
<stop
id="stop7049"
offset="1"
style="stop-color:#888a85;stop-opacity:0;" />
</linearGradient>
<linearGradient
id="linearGradient7098"
inkscape:collect="always">
<stop
id="stop7100"
offset="0"
style="stop-color:#eeeeec;stop-opacity:1;" />
<stop
id="stop7102"
offset="1"
style="stop-color:#888a85;stop-opacity:0" />
</linearGradient>
<radialGradient
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1,0,0,0.1987578,0,15.724379)"
r="10.0625"
fy="19.625"
fx="12.1875"
cy="19.625"
cx="12.1875"
id="radialGradient5174"
xlink:href="#linearGradient5168"
inkscape:collect="always" />
<linearGradient
id="linearGradient5168"
inkscape:collect="always">
<stop
id="stop5170"
offset="0"
style="stop-color:#000000;stop-opacity:1;" />
<stop
id="stop5172"
offset="1"
style="stop-color:#000000;stop-opacity:0;" />
</linearGradient>
<linearGradient
gradientTransform="matrix(1,0,0,1.0884708,-5.045049,-4.57506)"
gradientUnits="userSpaceOnUse"
y2="16.640388"
x2="17.293747"
y1="6"
x1="17.435883"
id="linearGradient5284"
xlink:href="#linearGradient5156"
inkscape:collect="always" />
<linearGradient
id="linearGradient5156">
<stop
id="stop5158"
offset="0"
style="stop-color:#cbcbc4;stop-opacity:1;" />
<stop
style="stop-color:#878983;stop-opacity:1"
offset="0.72343725"
id="stop5160" />
<stop
id="stop5162"
offset="1"
style="stop-color:#c9cac7;stop-opacity:1" />
</linearGradient>
<filter
id="filter5312"
height="1.5237931"
y="-0.26189652"
width="1.3612366"
x="-0.18061832"
inkscape:collect="always">
<feGaussianBlur
id="feGaussianBlur5314"
stdDeviation="0.38581007"
inkscape:collect="always" />
</filter>
<linearGradient
gradientTransform="matrix(-1,0,0,1.1369793,19.954951,-5.3013027)"
y2="11.693966"
x2="16.90625"
y1="16.75"
x1="16.90625"
gradientUnits="userSpaceOnUse"
id="linearGradient5334"
xlink:href="#linearGradient5324"
inkscape:collect="always" />
<linearGradient
id="linearGradient5324"
inkscape:collect="always">
<stop
id="stop5326"
offset="0"
style="stop-color:#ffffff;stop-opacity:1;" />
<stop
id="stop5328"
offset="1"
style="stop-color:#ffffff;stop-opacity:0;" />
</linearGradient>
<inkscape:perspective
id="perspective6679"
inkscape:persp3d-origin="8 : 21.333333 : 1"
inkscape:vp_z="16 : 24 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 24 : 1"
sodipodi:type="inkscape:persp3d" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient5156"
id="linearGradient6765"
x1="18.923338"
y1="10.652505"
x2="18.906874"
y2="5.0840392"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1.0225564,0,0,1.0098039,21.752672,-2.9985005)" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient5156"
id="linearGradient6769"
gradientUnits="userSpaceOnUse"
x1="19.045582"
y1="4.9025049"
x2="19.029118"
y2="11.27154"
gradientTransform="matrix(-1.0225564,0,0,1,33.385375,-0.08838812)" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient5324"
id="linearGradient6777"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(-0.7986885,0,0,0.9080923,31.7993,-24.236296)"
x1="16.90625"
y1="16.75"
x2="16.90625"
y2="11.693966" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient5156"
id="linearGradient6781"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.7986885,0,0,0.8693491,9.8875434,-18.176176)"
x1="17.435883"
y1="6"
x2="17.293747"
y2="16.640388" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient5324"
id="linearGradient6802"
x1="14.056891"
y1="16.480825"
x2="14"
y2="7.1558542"
gradientUnits="userSpaceOnUse" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient5156"
id="linearGradient6815"
x1="12.344958"
y1="3.9783304"
x2="12.271223"
y2="10.784233"
gradientUnits="userSpaceOnUse" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient6828"
id="linearGradient6834"
x1="0.8125"
y1="7.875"
x2="5.5647902"
y2="7.875"
gradientUnits="userSpaceOnUse"
gradientTransform="translate(-5.9969511)" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient6828"
id="linearGradient6844"
gradientUnits="userSpaceOnUse"
x1="0.8125"
y1="7.875"
x2="5.5647902"
y2="7.875" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient5156"
id="linearGradient6852"
gradientUnits="userSpaceOnUse"
x1="12.344958"
y1="3.9783304"
x2="12.271223"
y2="10.784233" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient6828"
id="linearGradient6854"
gradientUnits="userSpaceOnUse"
x1="0.8125"
y1="7.875"
x2="5.5647902"
y2="7.875" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient6875"
id="linearGradient6857"
gradientUnits="userSpaceOnUse"
x1="0.8125"
y1="7.875"
x2="5.5647902"
y2="7.875" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient5156"
id="linearGradient6861"
gradientUnits="userSpaceOnUse"
x1="12.344958"
y1="3.9783304"
x2="12.271223"
y2="10.784233" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient6875"
id="linearGradient6887"
gradientUnits="userSpaceOnUse"
x1="0.8125"
y1="7.875"
x2="5.5647902"
y2="7.875"
gradientTransform="matrix(2.8785823,0,0,1.2649355,-0.07038306,-2.1167256)" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient6875"
id="linearGradient6915"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(2.8785823,0,0,1.2649355,-0.07038306,-2.1167256)"
x1="0.8125"
y1="7.875"
x2="1.9840925"
y2="7.875" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient6875"
id="linearGradient6921"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(3.6041364,0,0,1.5837658,-33.062638,-1.3176926)"
x1="0.8125"
y1="7.875"
x2="1.9840925"
y2="7.875" />
<mask
maskUnits="userSpaceOnUse"
id="mask6917">
<rect
style="fill:url(#linearGradient6921);fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="rect6919"
width="21.343765"
height="12.598779"
x="-32.927605"
y="5.088717"
transform="scale(-1,1)" />
</mask>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient6875"
id="linearGradient6927"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(2.8785823,0,0,1.2649355,-0.07038306,-2.1167256)"
x1="0.8125"
y1="7.875"
x2="1.9840925"
y2="7.875" />
<mask
maskUnits="userSpaceOnUse"
id="mask6923">
<rect
style="fill:url(#linearGradient6927);fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="rect6925"
width="17.04702"
height="10.0625"
x="0.037466049"
y="3" />
</mask>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient6875"
id="linearGradient6933"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(2.8785823,0,0,1.2649355,-0.07038306,-2.1167256)"
x1="0.8125"
y1="7.875"
x2="1.9840925"
y2="7.875" />
<mask
maskUnits="userSpaceOnUse"
id="mask6929">
<rect
style="fill:url(#linearGradient6933);fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="rect6931"
width="17.04702"
height="10.0625"
x="0.037466049"
y="3" />
</mask>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient6875"
id="linearGradient6939"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(2.8785823,0,0,1.2649355,-0.07038306,-2.1167256)"
x1="0.8125"
y1="7.875"
x2="1.9840925"
y2="7.875" />
<mask
maskUnits="userSpaceOnUse"
id="mask6935">
<rect
style="fill:url(#linearGradient6939);fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="rect6937"
width="17.04702"
height="10.0625"
x="0.037466049"
y="3" />
</mask>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient5156"
id="linearGradient6955"
gradientUnits="userSpaceOnUse"
x1="12.344958"
y1="3.9783304"
x2="12.271223"
y2="10.784233" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient5324"
id="linearGradient6957"
gradientUnits="userSpaceOnUse"
x1="14.056891"
y1="16.480825"
x2="14"
y2="7.1558542" />
<inkscape:perspective
id="perspective7169"
inkscape:persp3d-origin="372.04724 : 366.78739 : 1"
inkscape:vp_z="744.09448 : 542.18109 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 542.18109 : 1"
sodipodi:type="inkscape:persp3d" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient5324"
id="linearGradient7179"
gradientUnits="userSpaceOnUse"
x1="14.056891"
y1="16.480825"
x2="14"
y2="7.1558542" />
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="15.999999"
inkscape:cx="10.005136"
inkscape:cy="17.799723"
inkscape:current-layer="layer1"
showgrid="true"
inkscape:grid-bbox="true"
inkscape:document-units="px"
inkscape:window-width="1103"
inkscape:window-height="789"
inkscape:window-x="338"
inkscape:window-y="122"
showguides="true"
inkscape:guide-bbox="true"
inkscape:document-rotation="0"
inkscape:window-maximized="0">
<inkscape:grid
spacingy="1"
spacingx="1"
units="px"
type="xygrid"
id="grid5148"
visible="true"
enabled="true"
dotted="true" />
</sodipodi:namedview>
<metadata
id="metadata5130">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
id="layer1"
inkscape:label="Layer 1"
inkscape:groupmode="layer">
<path
transform="rotate(90,8.1956169,7.3235245)"
style="opacity:0.469484;fill:none;fill-rule:evenodd;stroke:#dfe0de;stroke-width:1px;stroke-linecap:round;stroke-linejoin:miter;stroke-opacity:1"
d="M 3,7.5 H 8.9375"
id="path6821"
sodipodi:nodetypes="cc"
mask="url(#mask6929)" />
<g
transform="rotate(90,8.1956169,7.3235245)"
id="g6945">
<path
mask="url(#mask6935)"
sodipodi:nodetypes="ccccccccccc"
id="rect6806"
d="M 10.649364,3.5 C 8.0503462,3.5 5.9056312,5.1494833 5.5243642,7.3125 V 6.53125 H 1.53125 v 3.0517767 h 3.9931142 v -0.71875 C 5.9056312,11.027293 8.0503462,12.5 10.649364,12.5 l 0.8125,-1.0625 V 4.71875 Z"
style="fill:url(#linearGradient6861);fill-opacity:1;stroke:#555753;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
<path
mask="url(#mask6923)"
sodipodi:nodetypes="cccccczc"
style="fill:none;fill-rule:evenodd;stroke:url(#linearGradient7179);stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 14.760854,4.5537089 15.162639,4.519141 15.47425,5 l 0.04419,5.91767 -0.388715,0.554276 -0.245372,-0.0037 c 0,0 -3.349677,-0.460746 -3.349677,-3.3790301 0,-2.8740895 3.226174,-3.535534 3.226174,-3.535534 z"
id="path6771"
transform="translate(-5.08233)" />
</g>
<path
sodipodi:nodetypes="ccccc"
id="path6819"
d="M 13.479223,8.2668741 14.142136,7.6481556 C 16.950937,7.8603852 17.897062,9.4547099 18.605747,11.18369 17.332956,10.494445 17.320424,9.3668499 13.572986,9.5383523 Z"
style="display:inline;overflow:visible;visibility:visible;opacity:0.729885;fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:2.25;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;marker-start:none;marker-mid:none;marker-end:none;filter:url(#filter5312);enable-background:accumulate"
transform="matrix(0,-0.7986885,-0.7986885,0,16.583441,20.381943)"
mask="url(#mask6917)" />
<g
id="g6949"
transform="matrix(0,-1,-1,0,15.519141,32.185163)">
<path
mask="url(#mask6935)"
sodipodi:nodetypes="ccccccccccc"
id="path6951"
d="M 11.798413,3.5 C 9.1993947,3.5 7.0546797,5.1494833 6.6734127,7.3125 V 6.53125 H 1.53125 v 3.0517767 h 5.1421627 v -0.71875 C 7.0546797,11.027293 9.1993947,12.5 11.798413,12.5 l 0.8125,-1.0625 V 4.71875 Z"
style="fill:url(#linearGradient6955);fill-opacity:1;stroke:#555753;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
<path
mask="url(#mask6923)"
sodipodi:nodetypes="cccccczc"
style="fill:none;fill-rule:evenodd;stroke:url(#linearGradient6957);stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 14.760854,4.5537089 15.162639,4.519141 15.47425,5 l 0.04419,5.91767 -0.388715,0.554276 -0.245372,-0.0037 c 0,0 -3.349677,-0.460746 -3.349677,-3.3790301 0,-2.8740895 3.226174,-3.535534 3.226174,-3.535534 z"
id="path6953"
transform="translate(-3.9774757)" />
</g>
<path
sodipodi:nodetypes="ccccc"
id="path7181"
d="M 13.479223,8.2668741 14.142136,7.6481556 C 16.950937,7.8603852 17.897062,9.4547099 18.605747,11.18369 17.332956,10.494445 17.320424,9.3668499 13.572986,9.5383523 Z"
style="display:inline;overflow:visible;visibility:visible;opacity:0.729885;fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:2.25;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;marker-start:none;marker-mid:none;marker-end:none;filter:url(#filter5312);enable-background:accumulate"
transform="matrix(0,0.7986885,-0.7986885,0,16.718909,9.6936773)"
mask="url(#mask6917)" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 29 KiB

View File

@ -32,14 +32,18 @@
(G_TYPE_INSTANCE_GET_PRIVATE \
((obj), E_TYPE_HTML_EDITOR_IMAGE_DIALOG, EHTMLEditorImageDialogPrivate))
typedef enum {
E_SYNC_ASPECT_RATIO_BY_WIDTH,
E_SYNC_ASPECT_RATIO_BY_HEIGHT
} ESyncAspectRatio;
struct _EHTMLEditorImageDialogPrivate {
GtkWidget *file_chooser;
GtkWidget *description_edit;
GtkWidget *width_edit;
GtkWidget *width_units;
GtkWidget *height_edit;
GtkWidget *height_units;
GtkWidget *size_units;
GtkWidget *alignment;
GtkWidget *x_padding_edit;
@ -48,6 +52,8 @@ struct _EHTMLEditorImageDialogPrivate {
GtkWidget *url_edit;
GtkWidget *test_url_button;
gboolean preserve_aspect_ratio;
};
G_DEFINE_TYPE (
@ -62,6 +68,9 @@ html_editor_image_dialog_set_src (EHTMLEditorImageDialog *dialog)
EContentEditor *cnt_editor;
gchar *uri;
if (!gtk_widget_get_visible (GTK_WIDGET (dialog)))
return;
editor = e_html_editor_dialog_get_editor (E_HTML_EDITOR_DIALOG (dialog));
cnt_editor = e_html_editor_get_content_editor (editor);
@ -80,6 +89,9 @@ html_editor_image_dialog_set_alt (EHTMLEditorImageDialog *dialog)
EContentEditor *cnt_editor;
const gchar *value;
if (!gtk_widget_get_visible (GTK_WIDGET (dialog)))
return;
editor = e_html_editor_dialog_get_editor (E_HTML_EDITOR_DIALOG (dialog));
cnt_editor = e_html_editor_get_content_editor (editor);
@ -88,6 +100,75 @@ html_editor_image_dialog_set_alt (EHTMLEditorImageDialog *dialog)
e_content_editor_image_set_alt (cnt_editor, value);
}
static void
maybe_sync_aspect_ration (EHTMLEditorImageDialog *dialog,
ESyncAspectRatio kind)
{
EHTMLEditor *editor;
EContentEditor *cnt_editor;
gint32 natural_width, natural_height;
gint width = -1, height = -1, requested;
if (!dialog->priv->preserve_aspect_ratio)
return;
editor = e_html_editor_dialog_get_editor (E_HTML_EDITOR_DIALOG (dialog));
cnt_editor = e_html_editor_get_content_editor (editor);
natural_width = e_content_editor_image_get_natural_width (cnt_editor);
natural_height = e_content_editor_image_get_natural_height (cnt_editor);
requested = kind == E_SYNC_ASPECT_RATIO_BY_WIDTH ?
gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (dialog->priv->width_edit)) :
gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (dialog->priv->height_edit));
switch (gtk_combo_box_get_active (GTK_COMBO_BOX (dialog->priv->size_units))) {
case 0: /* px */
if (kind == E_SYNC_ASPECT_RATIO_BY_WIDTH) {
if (!natural_width)
height = 0;
else
height = ((gdouble) natural_height) * requested / natural_width;
} else { /* E_SYNC_ASPECT_RATIO_BY_HEIGHT */
if (!natural_height)
width = 0;
else
width = ((gdouble) natural_width) * requested / natural_height;
}
break;
case 1: /* percent */
if (kind == E_SYNC_ASPECT_RATIO_BY_WIDTH)
height = requested;
else /* E_SYNC_ASPECT_RATIO_BY_HEIGHT */
width = requested;
break;
case 2: /* follow */
/* ignore */
break;
}
/* To avoid recursion on set */
dialog->priv->preserve_aspect_ratio = FALSE;
if (width != -1) {
if (gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (dialog->priv->width_edit)) == width)
g_signal_emit_by_name (dialog->priv->width_edit, "value-changed", NULL);
else
gtk_spin_button_set_value (GTK_SPIN_BUTTON (dialog->priv->width_edit), width);
}
if (height != -1) {
if (gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (dialog->priv->height_edit)) == height)
g_signal_emit_by_name (dialog->priv->height_edit, "value-changed", NULL);
else
gtk_spin_button_set_value (GTK_SPIN_BUTTON (dialog->priv->height_edit), height);
}
dialog->priv->preserve_aspect_ratio = TRUE;
}
static void
html_editor_image_dialog_set_width (EHTMLEditorImageDialog *dialog)
{
@ -97,21 +178,26 @@ html_editor_image_dialog_set_width (EHTMLEditorImageDialog *dialog)
gint32 natural = 0;
gint width;
if (!gtk_widget_get_visible (GTK_WIDGET (dialog)))
return;
editor = e_html_editor_dialog_get_editor (E_HTML_EDITOR_DIALOG (dialog));
cnt_editor = e_html_editor_get_content_editor (editor);
natural = e_content_editor_image_get_natural_width (cnt_editor);
requested = gtk_spin_button_get_value_as_int (
GTK_SPIN_BUTTON (dialog->priv->width_edit));
requested = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (dialog->priv->width_edit));
switch (gtk_combo_box_get_active (GTK_COMBO_BOX (dialog->priv->width_units))) {
switch (gtk_combo_box_get_active (GTK_COMBO_BOX (dialog->priv->size_units))) {
case 0: /* px */
width = requested;
break;
case 1: /* percent */
width = natural * requested * 0.01;
if (requested)
width = natural * requested / 100.0;
else
width = natural;
break;
case 2: /* follow */
@ -123,57 +209,8 @@ html_editor_image_dialog_set_width (EHTMLEditorImageDialog *dialog)
}
e_content_editor_image_set_width (cnt_editor, width);
}
static void
html_editor_image_dialog_set_width_units (EHTMLEditorImageDialog *dialog)
{
EHTMLEditor *editor;
EContentEditor *cnt_editor;
gint requested;
gint32 natural;
gint width = 0;
editor = e_html_editor_dialog_get_editor (E_HTML_EDITOR_DIALOG (dialog));
cnt_editor = e_html_editor_get_content_editor (editor);
natural = e_content_editor_image_get_natural_width (cnt_editor);
requested = gtk_spin_button_get_value_as_int (
GTK_SPIN_BUTTON (dialog->priv->width_edit));
switch (gtk_combo_box_get_active (
GTK_COMBO_BOX (dialog->priv->width_units))) {
case 0: /* px */
if (gtk_widget_is_sensitive (dialog->priv->width_edit)) {
width = requested * natural * 0.01;
} else {
width = natural;
}
gtk_widget_set_sensitive (dialog->priv->width_edit, TRUE);
break;
case 1: /* percent */
if (natural && gtk_widget_is_sensitive (dialog->priv->width_edit)) {
width = (((gdouble) requested) / natural) * 100;
} else {
width = 100;
}
gtk_widget_set_sensitive (dialog->priv->width_edit, TRUE);
break;
case 2: /* follow */
gtk_widget_set_sensitive (dialog->priv->width_edit, FALSE);
break;
}
e_content_editor_image_set_width_follow (
cnt_editor, !gtk_widget_get_sensitive (dialog->priv->width_edit));
if (width != 0)
gtk_spin_button_set_value (
GTK_SPIN_BUTTON (dialog->priv->width_edit), width);
maybe_sync_aspect_ration (dialog, E_SYNC_ASPECT_RATIO_BY_WIDTH);
}
static void
@ -185,6 +222,9 @@ html_editor_image_dialog_set_height (EHTMLEditorImageDialog *dialog)
gint32 natural = 0;
gint height;
if (!gtk_widget_get_visible (GTK_WIDGET (dialog)))
return;
editor = e_html_editor_dialog_get_editor (E_HTML_EDITOR_DIALOG (dialog));
cnt_editor = e_html_editor_get_content_editor (editor);
@ -193,13 +233,16 @@ html_editor_image_dialog_set_height (EHTMLEditorImageDialog *dialog)
requested = gtk_spin_button_get_value_as_int (
GTK_SPIN_BUTTON (dialog->priv->height_edit));
switch (gtk_combo_box_get_active (GTK_COMBO_BOX (dialog->priv->height_units))) {
switch (gtk_combo_box_get_active (GTK_COMBO_BOX (dialog->priv->size_units))) {
case 0: /* px */
height = requested;
break;
case 1: /* percent */
height = natural * requested * 0.01;
if (requested)
height = natural * requested / 100.0;
else
height = natural;
break;
case 2: /* follow */
@ -211,57 +254,72 @@ html_editor_image_dialog_set_height (EHTMLEditorImageDialog *dialog)
}
e_content_editor_image_set_height (cnt_editor, height);
maybe_sync_aspect_ration (dialog, E_SYNC_ASPECT_RATIO_BY_HEIGHT);
}
static void
html_editor_image_dialog_set_height_units (EHTMLEditorImageDialog *dialog)
html_editor_image_dialog_set_size_units (EHTMLEditorImageDialog *dialog)
{
EHTMLEditor *editor;
EContentEditor *cnt_editor;
gint requested;
gulong natural;
gint height = -1;
gint requested_width, requested_height;
gint32 natural_width, natural_height;
gint width = -1, height = -1;
if (!gtk_widget_get_visible (GTK_WIDGET (dialog)))
return;
editor = e_html_editor_dialog_get_editor (E_HTML_EDITOR_DIALOG (dialog));
cnt_editor = e_html_editor_get_content_editor (editor);
natural = e_content_editor_image_get_natural_height (cnt_editor);
natural_width = e_content_editor_image_get_natural_width (cnt_editor);
natural_height = e_content_editor_image_get_natural_height (cnt_editor);
requested = gtk_spin_button_get_value_as_int (
GTK_SPIN_BUTTON (dialog->priv->height_edit));
switch (gtk_combo_box_get_active (
GTK_COMBO_BOX (dialog->priv->height_units))) {
requested_width = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (dialog->priv->width_edit));
requested_height = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (dialog->priv->height_edit));
switch (gtk_combo_box_get_active (GTK_COMBO_BOX (dialog->priv->size_units))) {
case 0: /* px */
if (gtk_widget_is_sensitive (dialog->priv->height_edit)) {
height = requested * natural * 0.01;
if (gtk_widget_is_sensitive (dialog->priv->width_edit)) {
width = requested_width * natural_width * 0.01;
height = requested_height * natural_height * 0.01;
} else {
height = natural;
width = natural_width;
height = natural_height;
}
gtk_widget_set_sensitive (dialog->priv->width_edit, TRUE);
gtk_widget_set_sensitive (dialog->priv->height_edit, TRUE);
break;
case 1: /* percent */
if (natural && gtk_widget_is_sensitive (dialog->priv->height_edit)) {
height = (((gdouble) requested) / natural) * 100;
if (natural_width && gtk_widget_is_sensitive (dialog->priv->width_edit)) {
width = (((gdouble) requested_width) / natural_width) * 100;
} else {
width = 100;
}
if (natural_height && gtk_widget_is_sensitive (dialog->priv->height_edit)) {
height = (((gdouble) requested_height) / natural_height) * 100;
} else {
height = 100;
}
gtk_widget_set_sensitive (dialog->priv->width_edit, TRUE);
gtk_widget_set_sensitive (dialog->priv->height_edit, TRUE);
break;
case 2: /* follow */
gtk_widget_set_sensitive (dialog->priv->width_edit, FALSE);
gtk_widget_set_sensitive (dialog->priv->height_edit, FALSE);
break;
}
e_content_editor_image_set_height_follow (
cnt_editor, !gtk_widget_get_sensitive (dialog->priv->height_edit));
e_content_editor_image_set_width_follow (cnt_editor, !gtk_widget_get_sensitive (dialog->priv->width_edit));
e_content_editor_image_set_height_follow (cnt_editor, !gtk_widget_get_sensitive (dialog->priv->height_edit));
if (width != -1)
gtk_spin_button_set_value (GTK_SPIN_BUTTON (dialog->priv->width_edit), width);
if (height != -1)
gtk_spin_button_set_value (
GTK_SPIN_BUTTON (dialog->priv->height_edit), height);
gtk_spin_button_set_value (GTK_SPIN_BUTTON (dialog->priv->height_edit), height);
}
static void
@ -271,6 +329,9 @@ html_editor_image_dialog_set_alignment (EHTMLEditorImageDialog *dialog)
EContentEditor *cnt_editor;
const gchar *value;
if (!gtk_widget_get_visible (GTK_WIDGET (dialog)))
return;
editor = e_html_editor_dialog_get_editor (E_HTML_EDITOR_DIALOG (dialog));
cnt_editor = e_html_editor_get_content_editor (editor);
@ -285,6 +346,9 @@ html_editor_image_dialog_set_x_padding (EHTMLEditorImageDialog *dialog)
EContentEditor *cnt_editor;
gint value;
if (!gtk_widget_get_visible (GTK_WIDGET (dialog)))
return;
editor = e_html_editor_dialog_get_editor (E_HTML_EDITOR_DIALOG (dialog));
cnt_editor = e_html_editor_get_content_editor (editor);
@ -300,6 +364,9 @@ html_editor_image_dialog_set_y_padding (EHTMLEditorImageDialog *dialog)
EContentEditor *cnt_editor;
gint value;
if (!gtk_widget_get_visible (GTK_WIDGET (dialog)))
return;
editor = e_html_editor_dialog_get_editor (E_HTML_EDITOR_DIALOG (dialog));
cnt_editor = e_html_editor_get_content_editor (editor);
@ -315,6 +382,9 @@ html_editor_image_dialog_set_border (EHTMLEditorImageDialog *dialog)
EContentEditor *cnt_editor;
gint value;
if (!gtk_widget_get_visible (GTK_WIDGET (dialog)))
return;
editor = e_html_editor_dialog_get_editor (E_HTML_EDITOR_DIALOG (dialog));
cnt_editor = e_html_editor_get_content_editor (editor);
@ -331,6 +401,9 @@ html_editor_image_dialog_set_url (EHTMLEditorImageDialog *dialog)
EContentEditor *cnt_editor;
const gchar *value;
if (!gtk_widget_get_visible (GTK_WIDGET (dialog)))
return;
editor = e_html_editor_dialog_get_editor (E_HTML_EDITOR_DIALOG (dialog));
cnt_editor = e_html_editor_get_content_editor (editor);
@ -384,15 +457,12 @@ html_editor_image_dialog_show (GtkWidget *widget)
GTK_SPIN_BUTTON (dialog->priv->width_edit),
e_content_editor_image_get_width (cnt_editor));
gtk_combo_box_set_active_id (
GTK_COMBO_BOX (dialog->priv->width_units), "units-px");
gtk_spin_button_set_value (
GTK_SPIN_BUTTON (dialog->priv->height_edit),
e_content_editor_image_get_height (cnt_editor));
gtk_combo_box_set_active_id (
GTK_COMBO_BOX (dialog->priv->height_units), "units-px");
GTK_COMBO_BOX (dialog->priv->size_units), "units-px");
gtk_spin_button_set_value (
GTK_SPIN_BUTTON (dialog->priv->border_edit),
@ -421,6 +491,25 @@ html_editor_image_dialog_show (GtkWidget *widget)
GTK_WIDGET_CLASS (e_html_editor_image_dialog_parent_class)->show (widget);
}
static void
aspect_ration_clicked_cb (GtkButton *button,
gpointer user_data)
{
EHTMLEditorImageDialog *dialog = user_data;
const gchar *icon_name;
dialog->priv->preserve_aspect_ratio = !dialog->priv->preserve_aspect_ratio;
if (dialog->priv->preserve_aspect_ratio)
icon_name = "aspect-ratio-lock";
else
icon_name = "aspect-ratio-unlock";
gtk_button_set_image (button, gtk_image_new_from_icon_name (icon_name, GTK_ICON_SIZE_BUTTON));
maybe_sync_aspect_ration (dialog, E_SYNC_ASPECT_RATIO_BY_WIDTH);
}
static void
html_editor_image_dialog_hide (GtkWidget *widget)
{
@ -540,17 +629,6 @@ e_html_editor_image_dialog_init (EHTMLEditorImageDialog *dialog)
gtk_label_set_mnemonic_widget (GTK_LABEL (widget), dialog->priv->width_edit);
gtk_grid_attach (grid, widget, 0, 0, 1, 1);
widget = gtk_combo_box_text_new ();
gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (widget), "units-px", "px");
gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (widget), "units-percent", "%");
gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (widget), "units-follow", "follow");
gtk_combo_box_set_active_id (GTK_COMBO_BOX (widget), "units-px");
gtk_grid_attach (grid, widget, 2, 0, 1, 1);
g_signal_connect_swapped (
widget, "changed",
G_CALLBACK (html_editor_image_dialog_set_width_units), dialog);
dialog->priv->width_units = widget;
/* Height */
widget = gtk_spin_button_new_with_range (1, G_MAXUINT, 1);
gtk_grid_attach (grid, widget, 1, 1, 1, 1);
@ -572,8 +650,18 @@ e_html_editor_image_dialog_init (EHTMLEditorImageDialog *dialog)
gtk_grid_attach (grid, widget, 2, 1, 1, 1);
g_signal_connect_swapped (
widget, "changed",
G_CALLBACK (html_editor_image_dialog_set_height_units), dialog);
dialog->priv->height_units = widget;
G_CALLBACK (html_editor_image_dialog_set_size_units), dialog);
dialog->priv->size_units = widget;
widget = gtk_button_new ();
gtk_button_set_always_show_image (GTK_BUTTON (widget), TRUE);
gtk_button_set_image (GTK_BUTTON (widget), gtk_image_new_from_icon_name ("aspect-ratio-lock", GTK_ICON_SIZE_BUTTON));
gtk_widget_set_tooltip_text (widget, _("Preserve aspect ratio"));
gtk_grid_attach (grid, widget, 3, 0, 1, 2);
dialog->priv->preserve_aspect_ratio = TRUE;
g_signal_connect_object (widget, "clicked",
G_CALLBACK (aspect_ration_clicked_cb), dialog, 0);
/* Alignment */
widget = gtk_combo_box_text_new ();
@ -594,7 +682,7 @@ e_html_editor_image_dialog_init (EHTMLEditorImageDialog *dialog)
/* X Padding */
widget = gtk_spin_button_new_with_range (0, G_MAXUINT, 1);
gtk_grid_attach (grid, widget, 5, 0, 1, 1);
gtk_grid_attach (grid, widget, 6, 0, 1, 1);
g_signal_connect_swapped (
widget, "value-changed",
G_CALLBACK (html_editor_image_dialog_set_x_padding), dialog);
@ -603,14 +691,14 @@ e_html_editor_image_dialog_init (EHTMLEditorImageDialog *dialog)
widget = gtk_label_new_with_mnemonic (_("_X-Padding:"));
gtk_label_set_justify (GTK_LABEL (widget), GTK_JUSTIFY_RIGHT);
gtk_label_set_mnemonic_widget (GTK_LABEL (widget), dialog->priv->x_padding_edit);
gtk_grid_attach (grid, widget, 4, 0, 1, 1);
gtk_grid_attach (grid, widget, 5, 0, 1, 1);
widget = gtk_label_new ("px");
gtk_grid_attach (grid, widget, 6, 0, 1, 1);
gtk_grid_attach (grid, widget, 7, 0, 1, 1);
/* Y Padding */
widget = gtk_spin_button_new_with_range (0, G_MAXUINT, 1);
gtk_grid_attach (grid, widget, 5, 1, 1, 1);
gtk_grid_attach (grid, widget, 6, 1, 1, 1);
g_signal_connect_swapped (
widget, "value-changed",
G_CALLBACK (html_editor_image_dialog_set_y_padding), dialog);
@ -619,14 +707,14 @@ e_html_editor_image_dialog_init (EHTMLEditorImageDialog *dialog)
widget = gtk_label_new_with_mnemonic (_("_Y-Padding:"));
gtk_label_set_justify (GTK_LABEL (widget), GTK_JUSTIFY_RIGHT);
gtk_label_set_mnemonic_widget (GTK_LABEL (widget), dialog->priv->y_padding_edit);
gtk_grid_attach (grid, widget, 4, 1, 1, 1);
gtk_grid_attach (grid, widget, 5, 1, 1, 1);
widget = gtk_label_new ("px");
gtk_grid_attach (grid, widget, 6, 1, 1, 1);
gtk_grid_attach (grid, widget, 7, 1, 1, 1);
/* Border */
widget = gtk_spin_button_new_with_range (0, G_MAXUINT, 1);
gtk_grid_attach (grid, widget, 5, 2, 1, 1);
gtk_grid_attach (grid, widget, 6, 2, 1, 1);
g_signal_connect_swapped (
widget, "value-changed",
G_CALLBACK (html_editor_image_dialog_set_border), dialog);
@ -635,10 +723,10 @@ e_html_editor_image_dialog_init (EHTMLEditorImageDialog *dialog)
widget = gtk_label_new_with_mnemonic (_("_Border:"));
gtk_label_set_justify (GTK_LABEL (widget), GTK_JUSTIFY_RIGHT);
gtk_label_set_mnemonic_widget (GTK_LABEL (widget), dialog->priv->border_edit);
gtk_grid_attach (grid, widget, 4, 2, 1, 1);
gtk_grid_attach (grid, widget, 5, 2, 1, 1);
widget = gtk_label_new ("px");
gtk_grid_attach (grid, widget, 6, 2, 1, 1);
gtk_grid_attach (grid, widget, 7, 2, 1, 1);
/* == Layout == */
widget = gtk_label_new ("");
@ -649,7 +737,7 @@ e_html_editor_image_dialog_init (EHTMLEditorImageDialog *dialog)
grid = GTK_GRID (gtk_grid_new ());
gtk_grid_set_row_spacing (grid, 5);
gtk_grid_set_column_spacing (grid, 5);
gtk_grid_attach (main_layout, GTK_WIDGET (grid), 0, 5, 1, 1);
gtk_grid_attach (main_layout, GTK_WIDGET (grid), 0, 6, 1, 1);
gtk_widget_set_margin_left (GTK_WIDGET (grid), 10);
widget = gtk_entry_new ();

View File

@ -3229,14 +3229,14 @@ static void
webkit_editor_image_set_height (EContentEditor *editor,
gint value)
{
webkit_editor_dialog_utils_set_attribute_int (E_WEBKIT_EDITOR (editor), NULL, "height", value);
webkit_editor_dialog_utils_set_attribute_with_unit (E_WEBKIT_EDITOR (editor), NULL, "height", value, E_CONTENT_EDITOR_UNIT_PIXEL);
}
static void
webkit_editor_image_set_width (EContentEditor *editor,
gint value)
{
webkit_editor_dialog_utils_set_attribute_int (E_WEBKIT_EDITOR (editor), NULL, "width", value);
webkit_editor_dialog_utils_set_attribute_with_unit (E_WEBKIT_EDITOR (editor), NULL, "width", value, E_CONTENT_EDITOR_UNIT_PIXEL);
}
static void