Warning, /graphics/krita/libs/libqml/qml/panels/SelectPanel.qml is written in an unsupported language. File is not indexed.
0001 /* This file is part of the KDE project 0002 * SPDX-FileCopyrightText: 2012 Arjen Hiemstra <ahiemstra@heimr.nl> 0003 * 0004 * SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 import QtQuick 2.3 0008 import org.krita.sketch 1.0 0009 import org.krita.sketch.components 1.0 0010 0011 Panel { 0012 id: base; 0013 name: "Select"; 0014 colorSet: "selection"; 0015 0016 actions: [ 0017 Button { 0018 id: deselectButton; 0019 width: height; 0020 height: Constants.ToolbarButtonSize 0021 image: Settings.theme.icon("select-deselect"); 0022 enabled: sketchView.selectionManager ? sketchView.selectionManager.havePixelsSelected : false; 0023 onClicked: if (sketchView.selectionManager) sketchView.selectionManager.deselect(); 0024 }, 0025 Button { 0026 id: reselectButton; 0027 width: height; 0028 height: Constants.ToolbarButtonSize 0029 image: Settings.theme.icon("select-reselect"); 0030 onClicked: sketchView.selectionManager.reselect(); 0031 }, 0032 Item { 0033 width: base.width - Constants.DefaultMargin - (Constants.ToolbarButtonSize * 3) 0034 height: Constants.ToolbarButtonSize; 0035 }, 0036 Button { 0037 id: toggleShowSelectionButton; 0038 property bool showSelection: sketchView.selectionManager ? sketchView.selectionManager.displaySelection : false; 0039 width: height; 0040 height: Constants.ToolbarButtonSize 0041 image: showSelection ? Settings.theme.icon("select-show") : Settings.theme.icon("select-hide"); 0042 onClicked: sketchView.selectionManager.toggleDisplaySelection(); 0043 } 0044 ] 0045 0046 peekContents: Item { 0047 id: peekItem; 0048 anchors.fill: parent; 0049 0050 Item { 0051 width: childrenRect.width; 0052 height: peekItem.height / 3; 0053 anchors { 0054 horizontalCenter: parent.horizontalCenter; 0055 top: parent.top; 0056 } 0057 Button { 0058 id: selectRectangle; 0059 anchors.verticalCenter: parent.verticalCenter; 0060 image: Settings.theme.icon("select-rectangle"); 0061 width: Constants.ToolbarButtonSize * 0.8; 0062 height: width; 0063 onClicked: toolManager.requestToolChange("KisToolSelectRectangular"); 0064 checked: toolManager.currentTool !== null ? toolManager.currentTool.toolId() === "KisToolSelectRectangular" : false; 0065 } 0066 Button { 0067 id: selectPolygon; 0068 anchors.verticalCenter: parent.verticalCenter; 0069 anchors.left: selectRectangle.right; 0070 image: Settings.theme.icon("select-polygon"); 0071 width: Constants.ToolbarButtonSize * 0.8; 0072 height: width; 0073 onClicked: toolManager.requestToolChange("KisToolSelectPolygonal"); 0074 checked: toolManager.currentTool !== null ? toolManager.currentTool.toolId() === "KisToolSelectPolygonal" : false; 0075 } 0076 Button { 0077 id: selectArea; 0078 anchors.verticalCenter: parent.verticalCenter; 0079 anchors.left: selectPolygon.right; 0080 image: Settings.theme.icon("select-area"); 0081 width: Constants.ToolbarButtonSize * 0.8; 0082 height: width; 0083 onClicked: toolManager.requestToolChange("KisToolSelectContiguous"); 0084 checked: toolManager.currentTool !== null ? toolManager.currentTool.toolId() === "KisToolSelectContiguous" : false; 0085 } 0086 Button { 0087 id: selectColor; 0088 anchors.verticalCenter: parent.verticalCenter; 0089 anchors.left: selectArea.right; 0090 image: Settings.theme.icon("select-color"); 0091 width: Constants.ToolbarButtonSize * 0.8; 0092 height: width; 0093 onClicked: toolManager.requestToolChange("KisToolSelectSimilar"); 0094 checked: toolManager.currentTool !== null ? toolManager.currentTool.toolId() === "KisToolSelectSimilar" : false; 0095 } 0096 } 0097 Item { 0098 width: childrenRect.width; 0099 height: childrenRect.height; 0100 anchors.centerIn: parent; 0101 Button { 0102 id: selectReplace; 0103 image: Settings.theme.icon("select-replace"); 0104 width: Constants.ToolbarButtonSize * 0.8; 0105 height: width; 0106 checked: (toolManager.currentTool && toolManager.currentTool.selectionAction === 0) ? true : false; 0107 onClicked: if (toolManager.currentTool && toolManager.currentTool.selectionAction !== undefined) toolManager.currentTool.selectionAction = 0; 0108 } 0109 Button { 0110 id: selectIntersect; 0111 anchors.left: selectReplace.right; 0112 image: Settings.theme.icon("select-intersect"); 0113 width: Constants.ToolbarButtonSize * 0.8; 0114 height: width; 0115 checked: (toolManager.currentTool && toolManager.currentTool.selectionAction === 3) ? true : false; 0116 onClicked: if (toolManager.currentTool && toolManager.currentTool.selectionAction !== undefined) toolManager.currentTool.selectionAction = 3; 0117 } 0118 Button { 0119 id: selectAdd; 0120 anchors.left: selectIntersect.right; 0121 image: Settings.theme.icon("select-add"); 0122 width: Constants.ToolbarButtonSize * 0.8; 0123 height: width; 0124 checked: (toolManager.currentTool && toolManager.currentTool.selectionAction === 1) ? true : false; 0125 onClicked: if (toolManager.currentTool && toolManager.currentTool.selectionAction !== undefined) toolManager.currentTool.selectionAction = 1; 0126 } 0127 Button { 0128 id: selectSub; 0129 anchors.left: selectAdd.right; 0130 image: Settings.theme.icon("select-sub"); 0131 width: Constants.ToolbarButtonSize * 0.8; 0132 height: width; 0133 checked: (toolManager.currentTool && toolManager.currentTool.selectionAction === 2) ? true : false; 0134 onClicked: if (toolManager.currentTool && toolManager.currentTool.selectionAction !== undefined) toolManager.currentTool.selectionAction = 2; 0135 } 0136 Button { 0137 id: selectSymmetricDifference; 0138 anchors.left: selectSub.right; 0139 image: Settings.theme.icon("select-symmetric-difference"); 0140 width: Constants.ToolbarButtonSize * 0.8; 0141 height: width; 0142 checked: (toolManager.currentTool && toolManager.currentTool.selectionAction === 4) ? true : false; 0143 onClicked: if (toolManager.currentTool && toolManager.currentTool.selectionAction !== undefined) toolManager.currentTool.selectionAction = 4; 0144 } 0145 } 0146 Item { 0147 width: childrenRect.width; 0148 height: peekItem.height / 3; 0149 anchors { 0150 horizontalCenter: parent.horizontalCenter; 0151 bottom: parent.bottom; 0152 } 0153 Button { 0154 id: selectAll; 0155 anchors.verticalCenter: parent.verticalCenter; 0156 anchors.margins: Constants.DefaultMargin; 0157 text: "All"; 0158 textColor: Settings.theme.color("panels/selection/buttons/text"); 0159 color: Settings.theme.color("panels/selection/buttons/color"); 0160 border.width: 1; 0161 border.color: Settings.theme.color("panels/selection/buttons/border"); 0162 radius: Constants.DefaultMargin; 0163 width: Constants.IsLandscape ? Constants.GridWidth : (Constants.GridWidth * 2 / 3);// - Constants.DefaultMargin; 0164 height: textSize + Constants.DefaultMargin * 2; 0165 onClicked: sketchView.selectionManager.selectAll(); 0166 } 0167 Button { 0168 id: selectInvert; 0169 anchors.verticalCenter: parent.verticalCenter; 0170 anchors.left: selectAll.right; 0171 anchors.margins: Constants.DefaultMargin; 0172 text: "Invert"; 0173 textColor: Settings.theme.color("panels/selection/buttons/text"); 0174 color: Settings.theme.color("panels/selection/buttons/color"); 0175 border.width: 1; 0176 border.color: Settings.theme.color("panels/selection/buttons/border"); 0177 radius: Constants.DefaultMargin; 0178 width: Constants.IsLandscape ? Constants.GridWidth : (Constants.GridWidth * 2 / 3);// - Constants.DefaultMargin; 0179 height: textSize + Constants.DefaultMargin * 2 0180 onClicked: sketchView.selectionManager.invert(); 0181 } 0182 /*Button { 0183 id: selectOpaque; 0184 anchors.verticalCenter: parent.verticalCenter; 0185 anchors.left: selectInvert.right; 0186 anchors.margins: Constants.DefaultMargin; 0187 text: "Opaque"; 0188 textColor: "black"; 0189 color: "#63ffffff"; 0190 border.width: 1; 0191 border.color: "silver"; 0192 radius: Constants.DefaultMargin; 0193 width: (Constants.GridWidth * 2 / 3) - Constants.DefaultMargin; 0194 height: textSize + Constants.DefaultMargin * 2 0195 }*/ 0196 } 0197 } 0198 0199 fullContents: Item { 0200 anchors.fill: parent; 0201 Flickable { 0202 id: selectOptionsFullFlickable; 0203 anchors.fill: parent 0204 contentHeight: fullItem.height; 0205 Item { 0206 id: fullItem; 0207 width: parent.width; 0208 height: Constants.GridHeight * 9.5; 0209 0210 Item { 0211 id: fullTopRow; 0212 width: childrenRect.width; 0213 height: Constants.GridHeight; 0214 anchors { 0215 horizontalCenter: parent.horizontalCenter; 0216 top: parent.top; 0217 } 0218 Button { 0219 id: selectRectangleFull; 0220 anchors.verticalCenter: parent.verticalCenter; 0221 image: Settings.theme.icon("select-rectangle"); 0222 width: Constants.ToolbarButtonSize * 0.8; 0223 height: width; 0224 onClicked: toolManager.requestToolChange("KisToolSelectRectangular"); 0225 checked: toolManager.currentTool !== null ? toolManager.currentTool.toolId() === "KisToolSelectRectangular" : false; 0226 } 0227 Button { 0228 id: selectPolygonFull; 0229 anchors.verticalCenter: parent.verticalCenter; 0230 anchors.left: selectRectangleFull.right; 0231 image: Settings.theme.icon("select-polygon") 0232 width: Constants.ToolbarButtonSize * 0.8; 0233 height: width; 0234 onClicked: toolManager.requestToolChange("KisToolSelectPolygonal"); 0235 checked: toolManager.currentTool !== null ? toolManager.currentTool.toolId() === "KisToolSelectPolygonal" : false; 0236 } 0237 Button { 0238 id: selectAreaFull; 0239 anchors.verticalCenter: parent.verticalCenter; 0240 anchors.left: selectPolygonFull.right; 0241 image: Settings.theme.icon("select-area") 0242 width: Constants.ToolbarButtonSize * 0.8; 0243 height: width; 0244 onClicked: toolManager.requestToolChange("KisToolSelectContiguous"); 0245 checked: toolManager.currentTool !== null ? toolManager.currentTool.toolId() === "KisToolSelectContiguous" : false; 0246 } 0247 Button { 0248 id: selectColorFull; 0249 anchors.verticalCenter: parent.verticalCenter; 0250 anchors.left: selectAreaFull.right; 0251 image: Settings.theme.icon("select-color") 0252 width: Constants.ToolbarButtonSize * 0.8; 0253 height: width; 0254 onClicked: toolManager.requestToolChange("KisToolSelectSimilar"); 0255 checked: toolManager.currentTool !== null ? toolManager.currentTool.toolId() === "KisToolSelectSimilar" : false; 0256 } 0257 } 0258 Label { 0259 id: modeLabel 0260 anchors { 0261 left: parent.left; 0262 leftMargin: Constants.DefaultMargin; 0263 top: fullTopRow.bottom; 0264 } 0265 height: Constants.GridHeight / 2; 0266 text: "Mode:"; 0267 font: Settings.theme.font("panelSection"); 0268 } 0269 Item { 0270 id: fullModeRow; 0271 width: childrenRect.width; 0272 height: Constants.GridHeight; 0273 anchors.horizontalCenter: parent.horizontalCenter; 0274 anchors.top: modeLabel.bottom; 0275 Button { 0276 id: selectReplaceFull; 0277 image: Settings.theme.icon("select-replace") 0278 width: Constants.ToolbarButtonSize * 0.8; 0279 height: width; 0280 checked: (toolManager.currentTool && toolManager.currentTool.selectionAction === 0) ? true : false; 0281 onClicked: if (toolManager.currentTool && toolManager.currentTool.selectionAction !== undefined) toolManager.currentTool.selectionAction = 0; 0282 } 0283 Button { 0284 id: selectIntersectFull; 0285 anchors.left: selectReplaceFull.right; 0286 image: Settings.theme.icon("select-intersect") 0287 width: Constants.ToolbarButtonSize * 0.8; 0288 height: width; 0289 checked: (toolManager.currentTool && toolManager.currentTool.selectionAction === 3) ? true : false; 0290 onClicked: if (toolManager.currentTool && toolManager.currentTool.selectionAction !== undefined) toolManager.currentTool.selectionAction = 3; 0291 } 0292 Button { 0293 id: selectAddFull; 0294 anchors.left: selectIntersectFull.right; 0295 image: Settings.theme.icon("select-add") 0296 width: Constants.ToolbarButtonSize * 0.8; 0297 height: width; 0298 checked: (toolManager.currentTool && toolManager.currentTool.selectionAction === 1) ? true : false; 0299 onClicked: if (toolManager.currentTool && toolManager.currentTool.selectionAction !== undefined) toolManager.currentTool.selectionAction = 1; 0300 } 0301 Button { 0302 id: selectSubFull; 0303 anchors.left: selectAddFull.right; 0304 image: Settings.theme.icon("select-sub") 0305 width: Constants.ToolbarButtonSize * 0.8; 0306 height: width; 0307 checked: (toolManager.currentTool && toolManager.currentTool.selectionAction === 2) ? true : false; 0308 onClicked: if (toolManager.currentTool && toolManager.currentTool.selectionAction !== undefined) toolManager.currentTool.selectionAction = 2; 0309 } 0310 } 0311 Label { 0312 id: fullSelectCommandsLabel; 0313 anchors { 0314 left: parent.left; 0315 leftMargin: Constants.DefaultMargin; 0316 top: fullModeRow.bottom; 0317 } 0318 height: Constants.GridHeight / 2; 0319 text: "Select:"; 0320 font: Settings.theme.font("panelSection"); 0321 } 0322 Item { 0323 id: fullSelectCommands; 0324 width: childrenRect.width; 0325 height: Constants.GridHeight; 0326 anchors { 0327 horizontalCenter: parent.horizontalCenter; 0328 top: fullSelectCommandsLabel.bottom; 0329 } 0330 Button { 0331 id: selectAllFull; 0332 anchors.verticalCenter: parent.verticalCenter; 0333 anchors.margins: Constants.DefaultMargin; 0334 text: "All"; 0335 textColor: Settings.theme.color("panels/selection/buttons/text"); 0336 color: Settings.theme.color("panels/selection/buttons/color"); 0337 border.width: 1; 0338 border.color: Settings.theme.color("panels/selection/buttons/border"); 0339 radius: Constants.DefaultMargin; 0340 width: Constants.IsLandscape ? Constants.GridWidth : (Constants.GridWidth * 2 / 3);// - Constants.DefaultMargin; 0341 height: textSize + Constants.DefaultMargin * 2 0342 onClicked: sketchView.selectionManager.selectAll(); 0343 } 0344 Button { 0345 id: selectInvertFull; 0346 anchors.verticalCenter: parent.verticalCenter; 0347 anchors.left: selectAllFull.right; 0348 anchors.margins: Constants.DefaultMargin; 0349 text: "Invert"; 0350 textColor: Settings.theme.color("panels/selection/buttons/text"); 0351 color: Settings.theme.color("panels/selection/buttons/color"); 0352 border.width: 1; 0353 border.color: Settings.theme.color("panels/selection/buttons/border"); 0354 radius: Constants.DefaultMargin; 0355 width: Constants.IsLandscape ? Constants.GridWidth : (Constants.GridWidth * 2 / 3);// - Constants.DefaultMargin; 0356 height: textSize + Constants.DefaultMargin * 2 0357 onClicked: sketchView.selectionManager.invert(); 0358 } 0359 /*Button { 0360 id: selectOpaqueFull; 0361 anchors.verticalCenter: parent.verticalCenter; 0362 anchors.left: selectInvertFull.right; 0363 anchors.margins: Constants.DefaultMargin; 0364 text: "Opaque"; 0365 textColor: "black"; 0366 color: "#63ffffff"; 0367 border.width: 1; 0368 border.color: "silver"; 0369 radius: Constants.DefaultMargin; 0370 width: (Constants.GridWidth * 2 / 3) - Constants.DefaultMargin; 0371 height: textSize + Constants.DefaultMargin * 2 0372 }*/ 0373 } 0374 Label { 0375 id: fullEditingLabel; 0376 anchors { 0377 left: parent.left; 0378 leftMargin: Constants.DefaultMargin; 0379 top: fullSelectCommands.bottom; 0380 } 0381 height: Constants.GridHeight / 2; 0382 text: "Edit:"; 0383 font: Settings.theme.font("panelSection"); 0384 } 0385 Column { 0386 anchors { 0387 top: fullEditingLabel.bottom; 0388 left: parent.left; 0389 right: parent.right; 0390 } 0391 spacing: Constants.DefaultMargin; 0392 Item { 0393 width: fullItem.width; 0394 height: featherTxt.height; 0395 RangeInput { 0396 id: featherTxt; 0397 anchors { 0398 left: parent.left; 0399 right: featherImg.left; 0400 } 0401 placeholder: "Feather"; 0402 min: 1; max: 500; decimals: 0; 0403 useExponentialValue: true; 0404 } 0405 Image { 0406 id: featherImg; 0407 anchors { 0408 right: parent.right; 0409 rightMargin: Constants.DefaultMargin; 0410 verticalCenter: featherTxt.verticalCenter; 0411 } 0412 height: parent.height - (Constants.DefaultMargin * 6); 0413 width: height; 0414 source: Settings.theme.icon("select-apply"); 0415 smooth: true; 0416 MouseArea { 0417 anchors.fill: parent; 0418 onClicked: sketchView.selectionExtras.feather(featherTxt.value); 0419 } 0420 } 0421 } 0422 Item { 0423 width: fullItem.width; 0424 height: growTxt.height; 0425 RangeInput { 0426 id: growTxt; 0427 anchors { 0428 left: parent.left; 0429 right: growImg.left; 0430 } 0431 placeholder: "Grow"; 0432 min: 1; max: 500; decimals: 0; 0433 useExponentialValue: true; 0434 } 0435 Image { 0436 id: growImg; 0437 anchors { 0438 right: parent.right; 0439 rightMargin: Constants.DefaultMargin; 0440 verticalCenter: growTxt.verticalCenter; 0441 } 0442 height: parent.height - (Constants.DefaultMargin * 6); 0443 width: height; 0444 source: Settings.theme.icon("select-apply"); 0445 smooth: true; 0446 MouseArea { 0447 anchors.fill: parent; 0448 onClicked: sketchView.selectionExtras.grow(growTxt.value, growTxt.value); 0449 } 0450 } 0451 } 0452 Item { 0453 width: fullItem.width; 0454 height: borderTxt.height; 0455 RangeInput { 0456 id: borderTxt; 0457 anchors { 0458 left: parent.left; 0459 right: borderImg.left; 0460 } 0461 placeholder: "Border"; 0462 min: 1; max: 500; decimals: 0; 0463 useExponentialValue: true; 0464 } 0465 Image { 0466 id: borderImg; 0467 anchors { 0468 right: parent.right; 0469 rightMargin: Constants.DefaultMargin; 0470 verticalCenter: borderTxt.verticalCenter; 0471 } 0472 height: parent.height - (Constants.DefaultMargin * 6); 0473 width: height; 0474 source: Settings.theme.icon("select-apply"); 0475 smooth: true; 0476 MouseArea { 0477 anchors.fill: parent; 0478 onClicked: sketchView.selectionExtras.border(borderTxt.value, borderTxt.value); 0479 } 0480 } 0481 } 0482 Item { 0483 width: fullItem.width; 0484 height: shrinkTxt.height; 0485 RangeInput { 0486 id: shrinkTxt; 0487 anchors { 0488 left: parent.left; 0489 right: shrinkImg.left; 0490 } 0491 placeholder: "Shrink"; 0492 min: 1; max: 500; decimals: 0; 0493 useExponentialValue: true; 0494 } 0495 Image { 0496 id: shrinkImg; 0497 anchors { 0498 right: parent.right; 0499 rightMargin: Constants.DefaultMargin; 0500 verticalCenter: shrinkTxt.verticalCenter; 0501 } 0502 height: parent.height - (Constants.DefaultMargin * 6); 0503 width: height; 0504 source: Settings.theme.icon("select-apply"); 0505 smooth: true; 0506 MouseArea { 0507 anchors.fill: parent; 0508 onClicked: sketchView.selectionExtras.shrink(shrinkTxt.value, shrinkTxt.value, false); 0509 } 0510 } 0511 } 0512 } 0513 } 0514 } 0515 ScrollDecorator { flickableItem: selectOptionsFullFlickable; } 0516 } 0517 }