Skip to content

Commit

Permalink
Remove logging
Browse files Browse the repository at this point in the history
  • Loading branch information
rock3r committed Nov 27, 2023
1 parent 07dd720 commit 7fa334f
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -315,8 +314,6 @@ private fun Tree.Element<*>.flattenTree(state: TreeState): MutableList<Tree.Elem
state.openNodes -= buildSet { getAllSubNodes(this@flattenTree) }
}
}
Log.w("the node is open, loading children for $id")
Log.w("children size: ${children?.size}")
open(true)
children?.forEach { child -> orderedChildren.addAll(child.flattenTree(state)) }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 {
Expand Down Expand Up @@ -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 }
}
Expand Down Expand Up @@ -161,15 +155,13 @@ public class DefaultTreeViewPointerEventAction(
when {
pointerEvent.keyboardModifiers.isContiguousSelectionKeyPressed &&
pointerEvent.keyboardModifiers.isCtrlPressed -> {
Log.t("ctrl and shift pressed on click")
}

pointerEvent.keyboardModifiers.isContiguousSelectionKeyPressed -> {
super.onExtendSelectionToKey(key, allKeys, selectableLazyListState, selectionMode)
}

pointerEvent.keyboardModifiers.isMultiSelectionKeyPressed -> {
Log.t("multi selection pressed")
selectableLazyListState.lastKeyEventUsedMouse = false
super.toggleKeySelection(key, allKeys, selectableLazyListState)
}
Expand Down Expand Up @@ -199,7 +191,6 @@ public class DefaultTreeViewPointerEventAction(
}
onElementDoubleClick(item)
elementClickedTmpHolder = null
Log.d("doubleClicked!")
} else {
elementClickedTmpHolder = item.id
// is a single click
Expand All @@ -208,8 +199,6 @@ public class DefaultTreeViewPointerEventAction(
delay(doubleClickTimeDelayMillis)
if (elementClickedTmpHolder == item.id) elementClickedTmpHolder = null
}

Log.d("singleClicked!")
}
}
}
Expand Down Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -27,13 +26,11 @@ public class TreeState(
public var openNodes: Set<Any> by mutableStateOf<Set<Any>>(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<Any>) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}

0 comments on commit 7fa334f

Please sign in to comment.