From 7fa334f0f2be8b07c5f53d1aae94bebc556cec8f Mon Sep 17 00:00:00 2001 From: Sebastiano Poggi Date: Mon, 27 Nov 2023 08:40:42 +0100 Subject: [PATCH] Remove logging --- .../jewel/foundation/lazy/tree/BasicLazyTree.kt | 3 --- .../jewel/foundation/lazy/tree/KeyActions.kt | 12 ------------ .../jewel/foundation/lazy/tree/TreeState.kt | 3 --- .../org/jetbrains/jewel/foundation/utils/Logger.kt | 11 ----------- 4 files changed, 29 deletions(-) diff --git a/foundation/src/main/kotlin/org/jetbrains/jewel/foundation/lazy/tree/BasicLazyTree.kt b/foundation/src/main/kotlin/org/jetbrains/jewel/foundation/lazy/tree/BasicLazyTree.kt index a588e8d26..de11c75b3 100644 --- a/foundation/src/main/kotlin/org/jetbrains/jewel/foundation/lazy/tree/BasicLazyTree.kt +++ b/foundation/src/main/kotlin/org/jetbrains/jewel/foundation/lazy/tree/BasicLazyTree.kt @@ -37,7 +37,6 @@ import org.jetbrains.jewel.foundation.state.CommonStateBitMask.Pressed import org.jetbrains.jewel.foundation.state.CommonStateBitMask.Selected import org.jetbrains.jewel.foundation.state.FocusableComponentState import org.jetbrains.jewel.foundation.state.SelectableComponentState -import org.jetbrains.jewel.foundation.utils.Log import kotlin.time.Duration import kotlin.time.Duration.Companion.milliseconds @@ -315,8 +314,6 @@ private fun Tree.Element<*>.flattenTree(state: TreeState): MutableList orderedChildren.addAll(child.flattenTree(state)) } } diff --git a/foundation/src/main/kotlin/org/jetbrains/jewel/foundation/lazy/tree/KeyActions.kt b/foundation/src/main/kotlin/org/jetbrains/jewel/foundation/lazy/tree/KeyActions.kt index 448bbc44e..4072bc6f1 100644 --- a/foundation/src/main/kotlin/org/jetbrains/jewel/foundation/lazy/tree/KeyActions.kt +++ b/foundation/src/main/kotlin/org/jetbrains/jewel/foundation/lazy/tree/KeyActions.kt @@ -2,7 +2,6 @@ package org.jetbrains.jewel.foundation.lazy.tree import androidx.compose.ui.input.key.KeyEvent import androidx.compose.ui.input.key.KeyEventType -import androidx.compose.ui.input.key.key import androidx.compose.ui.input.key.type import androidx.compose.ui.input.pointer.PointerEvent import androidx.compose.ui.input.pointer.isCtrlPressed @@ -17,7 +16,6 @@ import org.jetbrains.jewel.foundation.lazy.SelectableColumnOnKeyEvent import org.jetbrains.jewel.foundation.lazy.SelectableLazyListKey import org.jetbrains.jewel.foundation.lazy.SelectableLazyListState import org.jetbrains.jewel.foundation.lazy.SelectionMode -import org.jetbrains.jewel.foundation.utils.Log import org.jetbrains.skiko.hostOs public interface KeyActions { @@ -72,22 +70,18 @@ public open class DefaultSelectableLazyColumnEventAction : PointerEventActions { when { pointerEvent.keyboardModifiers.isContiguousSelectionKeyPressed && pointerEvent.keyboardModifiers.isCtrlPressed -> { - Log.i("ctrl and shift pressed on click") // do nothing } pointerEvent.keyboardModifiers.isContiguousSelectionKeyPressed -> { - Log.i("shift pressed on click") onExtendSelectionToKey(key, allKeys, selectableLazyListState, selectionMode) } pointerEvent.keyboardModifiers.isMultiSelectionKeyPressed -> { - Log.i("ctrl pressed on click") toggleKeySelection(key, allKeys, selectableLazyListState) } else -> { - Log.i("single click") selectableLazyListState.selectedKeys = listOf(key) selectableLazyListState.lastActiveItemIndex = allKeys.indexOfFirst { it.key == key } } @@ -161,7 +155,6 @@ public class DefaultTreeViewPointerEventAction( when { pointerEvent.keyboardModifiers.isContiguousSelectionKeyPressed && pointerEvent.keyboardModifiers.isCtrlPressed -> { - Log.t("ctrl and shift pressed on click") } pointerEvent.keyboardModifiers.isContiguousSelectionKeyPressed -> { @@ -169,7 +162,6 @@ public class DefaultTreeViewPointerEventAction( } pointerEvent.keyboardModifiers.isMultiSelectionKeyPressed -> { - Log.t("multi selection pressed") selectableLazyListState.lastKeyEventUsedMouse = false super.toggleKeySelection(key, allKeys, selectableLazyListState) } @@ -199,7 +191,6 @@ public class DefaultTreeViewPointerEventAction( } onElementDoubleClick(item) elementClickedTmpHolder = null - Log.d("doubleClicked!") } else { elementClickedTmpHolder = item.id // is a single click @@ -208,8 +199,6 @@ public class DefaultTreeViewPointerEventAction( delay(doubleClickTimeDelayMillis) if (elementClickedTmpHolder == item.id) elementClickedTmpHolder = null } - - Log.d("singleClicked!") } } } @@ -237,7 +226,6 @@ public class DefaultTreeViewKeyActions( val keyEvent = this with(keybindings) { with(actions) { - Log.d(keyEvent.key.keyCode.toString()) if (selectionMode == SelectionMode.None) return@lambda false when { isSelectParent -> onSelectParent(keys, state) diff --git a/foundation/src/main/kotlin/org/jetbrains/jewel/foundation/lazy/tree/TreeState.kt b/foundation/src/main/kotlin/org/jetbrains/jewel/foundation/lazy/tree/TreeState.kt index 7e8ee813d..7df6950ea 100644 --- a/foundation/src/main/kotlin/org/jetbrains/jewel/foundation/lazy/tree/TreeState.kt +++ b/foundation/src/main/kotlin/org/jetbrains/jewel/foundation/lazy/tree/TreeState.kt @@ -10,7 +10,6 @@ import androidx.compose.runtime.remember import androidx.compose.runtime.setValue import org.jetbrains.jewel.foundation.lazy.SelectableLazyListState import org.jetbrains.jewel.foundation.lazy.SelectableScope -import org.jetbrains.jewel.foundation.utils.Log @Composable public fun rememberTreeState( @@ -27,13 +26,11 @@ public class TreeState( public var openNodes: Set by mutableStateOf>(emptySet()) public fun toggleNode(nodeId: Any) { - Log.d("toggleNode $nodeId") if (nodeId in openNodes) { openNodes -= nodeId } else { openNodes += nodeId } - Log.d("open nodes ${openNodes.map { it.toString() }}") } public fun openNodes(nodes: List) { diff --git a/foundation/src/main/kotlin/org/jetbrains/jewel/foundation/utils/Logger.kt b/foundation/src/main/kotlin/org/jetbrains/jewel/foundation/utils/Logger.kt index 1482f4410..5b9dda14a 100644 --- a/foundation/src/main/kotlin/org/jetbrains/jewel/foundation/utils/Logger.kt +++ b/foundation/src/main/kotlin/org/jetbrains/jewel/foundation/utils/Logger.kt @@ -38,14 +38,3 @@ internal interface Logger { log(LogLevel.Trace, LogLevel.Trace.color + msg + resetColor()) } } - -// TODO remove and replace with real logger -@Deprecated("Use a real logger instead") -internal object Log : Logger { - - override var currentLogLevel: LogLevel = LogLevel.Off - - override fun log(level: LogLevel, msg: String) { - if (currentLogLevel.ordinal <= level.ordinal) println(msg) - } -}