1
0
mirror of https://github.com/KDE/latte-dock.git synced 2025-03-21 10:50:30 +03:00

create behaveAsPlasmaPanel for containment

--replace drawShadowsExternal with behaveAsPlasmaPanel
This commit is contained in:
Michail Vourlakos 2017-05-07 14:49:07 +03:00
parent e68a9e78e1
commit 9e969d22dc
5 changed files with 38 additions and 22 deletions

View File

@ -514,6 +514,19 @@ Window{
text: visibilityManager.panelIsBiggerFromIconSize
}
Text{
text: "Behave As Plasma Panel"+space
}
Text{
text: {
if (root.behaveAsPlasmaPanel)
return "Yes";
else
return "No";
}
}
Text{
text: "Draw Shadows (external)"+space
}

View File

@ -37,8 +37,8 @@ Image{
property int speed: root.durationTime*4*units.longDuration
property int thickness: visibilityManager.thicknessNormalOriginal + root.editShadow
property int rootThickness: visibilityManager.thicknessZoomOriginal + root.editShadow
property int editLength: root.isHorizontal ? (root.drawShadowsExternal ? root.width - root.maxIconSize/4 : root.maxLength) :
(root.drawShadowsExternal ? root.height - root.maxIconSize/4 : root.maxLength)
property int editLength: root.isHorizontal ? (root.behaveAsPlasmaPanel ? root.width - root.maxIconSize/4 : root.maxLength) :
(root.behaveAsPlasmaPanel ? root.height - root.maxIconSize/4 : root.maxLength)
property bool animationSent: false
property bool farEdge: (plasmoid.location===PlasmaCore.Types.BottomEdge) || (plasmoid.location===PlasmaCore.Types.RightEdge)
@ -84,7 +84,7 @@ Image{
return;
}
if (editAnimationEnded && !root.drawShadowsExternal) {
if (editAnimationEnded && !root.behaveAsPlasmaPanel) {
dock.shadow = root.editShadow;
} else {
dock.shadow = root.panelShadow;
@ -234,7 +234,7 @@ Image{
PropertyAnimation {
target: editVisual
property: "opacity"
to: root.drawShadowsExternal && dock.session===Latte.Dock.DefaultSession ? 0.3 : 0.6
to: root.behaveAsPlasmaPanel && dock.session===Latte.Dock.DefaultSession ? 0.3 : 0.6
duration: editVisual.speed / 2
easing.type: Easing.OutQuad
}

View File

@ -39,7 +39,7 @@ Item{
opacity: root.useThemePanel ? 1 : 0
property int panelWidth: {
if (root.drawShadowsExternal) {
if (root.behaveAsPlasmaPanel) {
return root.width;
} else {
if ((root.panelAlignment === Latte.Dock.Justify) && root.isHorizontal && !root.editMode) {
@ -51,7 +51,7 @@ Item{
}
property int panelHeight: {
if (root.drawShadowsExternal) {
if (root.behaveAsPlasmaPanel) {
return root.height;
} else {
if ((root.panelAlignment === Latte.Dock.Justify) && root.isVertical && !root.editMode) {
@ -121,8 +121,8 @@ Item{
height: root.isVertical ? Math.min(parent.height + marginsHeight, root.height - marginsHeight) :
panelSize + marginsHeight - (solidBackground.topIncreaser + solidBackground.bottomIncreaser)
imagePath: root.drawShadowsExternal || !Latte.WindowSystem.compositingActive || !root.panelShadowsActive ? "" : "widgets/panel-background"
prefix: root.drawShadowsExternal || !Latte.WindowSystem.compositingActive || !root.panelShadowsActive ? "" : "shadow"
imagePath: root.behaveAsPlasmaPanel || !Latte.WindowSystem.compositingActive || !root.panelShadowsActive ? "" : "widgets/panel-background"
prefix: root.behaveAsPlasmaPanel || !Latte.WindowSystem.compositingActive || !root.panelShadowsActive ? "" : "shadow"
opacity: root.useThemePanel ? 1 : 0
visible: (opacity == 0) ? false : true
@ -157,7 +157,7 @@ Item{
property int panelSize: automaticPanelSize
property int automaticPanelSize: {
if (root.drawShadowsExternal) {
if (root.behaveAsPlasmaPanel) {
return root.isVertical ? root.width : root.height;
} else {
var icons = root.statesLineSize + root.iconSize + root.thickMargin + 1;
@ -315,7 +315,7 @@ Item{
}
onRepaintNeeded: {
if (root.drawShadowsExternal)
if (root.behaveAsPlasmaPanel)
adjustPrefix();
}

View File

@ -79,7 +79,7 @@ Item{
target: dock
property: "drawShadows"
when: dock
value: root.drawShadowsExternal
value: root.behaveAsPlasmaPanel
}
Binding{

View File

@ -53,13 +53,16 @@ DragDrop.DropArea {
property bool addLaunchersMessage: false
property bool addLaunchersInTaskManager: plasmoid.configuration.addLaunchersInTaskManager
property bool autoDecreaseIconSize: plasmoid.configuration.autoDecreaseIconSize
property bool behaveAsPlasmaPanel: visibilityManager.panelIsBiggerFromIconSize && (zoomFactor === 1.0)
&& (dock.visibility.mode === Latte.Dock.AlwaysVisible || dock.visibility.mode === Latte.Dock.WindowsGoBelow)
&& (plasmoid.configuration.panelPosition === Latte.Dock.Justify) && !root.solidPanel
property bool blurEnabled: plasmoid.configuration.blurEnabled
property bool confirmedDragEntered: false
property bool dockContainsMouse: dock && dock.visibility ? dock.visibility.containsMouse : false
property bool drawShadowsExternal: visibilityManager.panelIsBiggerFromIconSize && (zoomFactor === 1.0)
&& (dock.visibility.mode === Latte.Dock.AlwaysVisible || dock.visibility.mode === Latte.Dock.WindowsGoBelow)
&& (plasmoid.configuration.panelPosition === Latte.Dock.Justify) && !root.solidPanel
&& root.panelShadowsActive
property bool drawShadowsExternal: panelShadowsActive && behaveAsPlasmaPanel
property bool editMode: plasmoid.userConfiguring
property bool exposeAltSession: globalSettings ? globalSettings.exposeAltSession : false
@ -122,7 +125,7 @@ DragDrop.DropArea {
//FIXME: this is not needed any more probably
property int previousAllTasks: -1 //is used to forbit updateAutomaticIconSize when hovering
property int offset: {
if (drawShadowsExternal) {
if (behaveAsPlasmaPanel) {
return 0;
}
@ -1312,12 +1315,12 @@ DragDrop.DropArea {
EditModeVisual{
id:editModeVisual
z: root.drawShadowsExternal ? 1 : 0
z: root.behaveAsPlasmaPanel ? 1 : 0
}
Item{
anchors.fill:layoutsContainer
z: root.drawShadowsExternal ? 0 : 1
z: root.behaveAsPlasmaPanel ? 0 : 1
PanelBox{}
}
@ -1382,7 +1385,7 @@ DragDrop.DropArea {
x: {
if ( dock && (plasmoid.configuration.panelPosition === Latte.Dock.Justify) && root.isHorizontal
&& !root.editMode && !root.drawShadowsExternal ){
&& !root.editMode && !root.behaveAsPlasmaPanel ){
return ((dock.width/2) - (root.maxLength/2) + root.offset)
} else {
if ((visibilityManager.inSlidingIn || visibilityManager.inSlidingOut) && root.isVertical){
@ -1407,7 +1410,7 @@ DragDrop.DropArea {
y: {
if ( dock && (plasmoid.configuration.panelPosition === Latte.Dock.Justify) && root.isVertical
&& !root.editMode && !root.drawShadowsExternal ) {
&& !root.editMode && !root.behaveAsPlasmaPanel ) {
return ((dock.height/2) - (root.maxLength/2) + root.offset);
} else {
if ((visibilityManager.inSlidingIn || visibilityManager.inSlidingOut) && root.isHorizontal){
@ -1430,9 +1433,9 @@ DragDrop.DropArea {
}
}
width: (plasmoid.configuration.panelPosition === Latte.Dock.Justify) && root.isHorizontal && !root.editMode && !root.drawShadowsExternal ?
width: (plasmoid.configuration.panelPosition === Latte.Dock.Justify) && root.isHorizontal && !root.editMode && !root.behaveAsPlasmaPanel ?
root.maxLength : parent.width
height: (plasmoid.configuration.panelPosition === Latte.Dock.Justify) && root.isVertical && !root.editMode && !root.drawShadowsExternal ?
height: (plasmoid.configuration.panelPosition === Latte.Dock.Justify) && root.isVertical && !root.editMode && !root.behaveAsPlasmaPanel ?
root.maxLength : parent.height
z:10