diff --git a/notebooks/notebook-ui/src/com/intellij/notebooks/ui/editor/DefaultNotebookEditorAppearance.kt b/notebooks/notebook-ui/src/com/intellij/notebooks/ui/editor/DefaultNotebookEditorAppearance.kt index ffdbb5c1a42a..e9a21b3320f8 100644 --- a/notebooks/notebook-ui/src/com/intellij/notebooks/ui/editor/DefaultNotebookEditorAppearance.kt +++ b/notebooks/notebook-ui/src/com/intellij/notebooks/ui/editor/DefaultNotebookEditorAppearance.kt @@ -25,8 +25,9 @@ import com.intellij.ui.JBColor import java.awt.Color import kotlin.sequences.generateSequence -open class DefaultNotebookEditorAppearance(private val editor: Editor) : NotebookEditorAppearance, - NotebookEditorAppearanceSizes by DefaultNotebookEditorAppearanceSizes { +open class DefaultNotebookEditorAppearance( + private val editor: Editor +) : NotebookEditorAppearance, NotebookEditorAppearanceSizes by DefaultNotebookEditorAppearanceSizes { private val swapCellAndEditorBackgroundColor = AtomicBooleanProperty( Registry.`is`("jupyter.editor.swap.cell.and.editor.background", false) @@ -130,12 +131,11 @@ open class DefaultNotebookEditorAppearance(private val editor: Editor) : Noteboo override fun getCellLeftLineWidth(editor: Editor): Int = when (editor.currentMode) { - NotebookEditorMode.EDIT -> EDIT_MODE_CELL_LEFT_LINE_WIDTH - NotebookEditorMode.COMMAND -> COMMAND_MODE_CELL_LEFT_LINE_WIDTH + NotebookEditorMode.EDIT -> editModeCellLeftLineWidth + NotebookEditorMode.COMMAND -> commandModeCellLeftLineWidth } - override fun getCellLeftLineHoverWidth(): Int = - COMMAND_MODE_CELL_LEFT_LINE_WIDTH + override fun getCellLeftLineHoverWidth(): Int = commandModeCellLeftLineWidth override fun shouldShowCellLineNumbers(): Boolean = true diff --git a/notebooks/notebook-ui/src/com/intellij/notebooks/ui/editor/NewUINotebookDiffEditorAppearance.kt b/notebooks/notebook-ui/src/com/intellij/notebooks/ui/editor/NewUINotebookDiffEditorAppearance.kt deleted file mode 100644 index 251834ede2e2..000000000000 --- a/notebooks/notebook-ui/src/com/intellij/notebooks/ui/editor/NewUINotebookDiffEditorAppearance.kt +++ /dev/null @@ -1,38 +0,0 @@ -package com.intellij.notebooks.ui.editor - -import com.intellij.openapi.editor.Editor -import com.intellij.util.ui.JBUI - -class NewUINotebookDiffEditorAppearance(editor: Editor): DefaultNotebookEditorAppearance(editor){ - - override fun shouldShowCellLineNumbers(): Boolean = false - override fun shouldShowExecutionCounts(): Boolean = false // not needed for DIFF -> execution does not reach it - override fun shouldShowOutExecutionCounts(): Boolean = false - override fun shouldShowRunButtonInGutter(): Boolean = true - // see comments in org.jetbrains.plugins.notebooks.ui.visualization.DefaultNotebookEditorAppearanceSizes - override val CODE_CELL_LEFT_LINE_PADDING: Int = 5 - override val LINE_NUMBERS_MARGIN: Int = 10 - - override val COMMAND_MODE_CELL_LEFT_LINE_WIDTH: Int = 4 - override val EDIT_MODE_CELL_LEFT_LINE_WIDTH: Int = 2 - override val CODE_AND_CODE_TOP_GRAY_HEIGHT: Int = 60 - override val CODE_AND_CODE_BOTTOM_GRAY_HEIGHT: Int = 60 - override val INNER_CELL_TOOLBAR_HEIGHT: Int = 24 - override val cellBorderHeight: Int = JBUI.scale(20) - override val distanceBetweenCells: Int = JBUI.scale(16) - override val aboveFirstCellDelimiterHeight: Int = JBUI.scale(20) - override val SPACER_HEIGHT: Int = cellBorderHeight / 2 - override val EXECUTION_TIME_HEIGHT: Int = 0 // not used in the jupyter diff viewer - override val SPACE_BELOW_CELL_TOOLBAR: Int = 10 - override val CELL_TOOLBAR_TOTAL_HEIGHT: Int = INNER_CELL_TOOLBAR_HEIGHT + SPACE_BELOW_CELL_TOOLBAR - override val PROGRESS_STATUS_HEIGHT: Int = 2 - - - override val EXTRA_PADDING_EXECUTION_COUNT: Int = 0 - - override fun getCellLeftLineWidth(editor: Editor): Int = 10 - override fun getCellLeftLineHoverWidth(): Int = 10 - - override fun getLeftBorderWidth(): Int = - Integer.max(COMMAND_MODE_CELL_LEFT_LINE_WIDTH, EDIT_MODE_CELL_LEFT_LINE_WIDTH) + CODE_CELL_LEFT_LINE_PADDING -} diff --git a/notebooks/notebook-ui/src/com/intellij/notebooks/ui/editor/NotebookEditorAppearanceManager.kt b/notebooks/notebook-ui/src/com/intellij/notebooks/ui/editor/NotebookEditorAppearanceManager.kt index e3d44a12ca62..eafd109e3276 100644 --- a/notebooks/notebook-ui/src/com/intellij/notebooks/ui/editor/NotebookEditorAppearanceManager.kt +++ b/notebooks/notebook-ui/src/com/intellij/notebooks/ui/editor/NotebookEditorAppearanceManager.kt @@ -15,7 +15,7 @@ internal class NotebookEditorAppearanceManager { private val connection: MessageBusConnection = ApplicationManager.getApplication().getMessageBus().connect(NotebookPluginDisposable.getInstance() as Disposable) - private val eventDispatcher = EventDispatcher.create(EditorColorsListener::class.java) + private val eventDispatcher = EventDispatcher.create(EditorColorsListener::class.java) init { connection.subscribe(EditorColorsManager.TOPIC, EditorColorsListener { scheme -> diff --git a/notebooks/notebook-ui/src/com/intellij/notebooks/ui/visualization/DefaultNotebookEditorAppearanceSizes.kt b/notebooks/notebook-ui/src/com/intellij/notebooks/ui/visualization/DefaultNotebookEditorAppearanceSizes.kt index 83cf46b62636..567ba3b07a37 100644 --- a/notebooks/notebook-ui/src/com/intellij/notebooks/ui/visualization/DefaultNotebookEditorAppearanceSizes.kt +++ b/notebooks/notebook-ui/src/com/intellij/notebooks/ui/visualization/DefaultNotebookEditorAppearanceSizes.kt @@ -6,32 +6,30 @@ import com.intellij.util.ui.JBUI object DefaultNotebookEditorAppearanceSizes : NotebookEditorAppearanceSizes { // TODO it's hardcoded, but it should be equal to distance between a folding line and an editor. - override val CODE_CELL_LEFT_LINE_PADDING: Int = 5 + override val codeCellLeftLinePadding: Int = JBUI.scale(5) // TODO it's hardcoded, but it should be EditorGutterComponentImpl.getLineNumberAreaWidth() - override val LINE_NUMBERS_MARGIN: Int = 10 + override val lineNumbersMargin: Int = JBUI.scale(10) - // TODO Do the pixel constants need JBUI.scale? - override val COMMAND_MODE_CELL_LEFT_LINE_WIDTH: Int = JBUI.scale(4) - override val EDIT_MODE_CELL_LEFT_LINE_WIDTH: Int = JBUI.scale(2) - override val CODE_AND_CODE_TOP_GRAY_HEIGHT: Int = JBUI.scale(6) - override val CODE_AND_CODE_BOTTOM_GRAY_HEIGHT: Int = JBUI.scale(6) - override val INNER_CELL_TOOLBAR_HEIGHT: Int = JBUI.scale(24) + override val commandModeCellLeftLineWidth: Int = JBUI.scale(4) + override val editModeCellLeftLineWidth: Int = JBUI.scale(2) + override val codeAndCodeTopGrayHeight: Int = JBUI.scale(6) + override val codeAndCodeBottomGrayHeight: Int = JBUI.scale(6) + override val innerCellToolbarHeight: Int = JBUI.scale(24) override val distanceBetweenCells: Int = JBUI.scale(16) override val cellBorderHeight: Int = JBUI.scale(16) override val aboveFirstCellDelimiterHeight: Int = JBUI.scale(42) - override val SPACER_HEIGHT: Int = JBUI.scale(cellBorderHeight / 2) - override val EXECUTION_TIME_HEIGHT: Int = JBUI.scale(SPACER_HEIGHT + 14) - override val SPACE_BELOW_CELL_TOOLBAR: Int = JBUI.scale(4) - override val CELL_TOOLBAR_TOTAL_HEIGHT: Int = JBUI.scale(INNER_CELL_TOOLBAR_HEIGHT + SPACE_BELOW_CELL_TOOLBAR) - override val PROGRESS_STATUS_HEIGHT: Int = JBUI.scale(2) + override val spacerHeight: Int = JBUI.scale(cellBorderHeight / 2) + override val executionTimeHeight: Int = JBUI.scale(spacerHeight + 14) + override val spaceBelowCellToolbar: Int = JBUI.scale(4) + override val cellToolbarTotalHeight: Int = JBUI.scale(innerCellToolbarHeight + spaceBelowCellToolbar) + override val progressStatusHeight: Int = JBUI.scale(2) + override val extraPaddingExecutionCount: Int = JBUI.scale(20) - override val EXTRA_PADDING_EXECUTION_COUNT: Int = JBUI.scale(20) - - override fun getCellLeftLineWidth(editor: Editor): Int = EDIT_MODE_CELL_LEFT_LINE_WIDTH - override fun getCellLeftLineHoverWidth(): Int = COMMAND_MODE_CELL_LEFT_LINE_WIDTH + override fun getCellLeftLineWidth(editor: Editor): Int = editModeCellLeftLineWidth + override fun getCellLeftLineHoverWidth(): Int = commandModeCellLeftLineWidth override fun getLeftBorderWidth(): Int = - Integer.max(COMMAND_MODE_CELL_LEFT_LINE_WIDTH, EDIT_MODE_CELL_LEFT_LINE_WIDTH) + CODE_CELL_LEFT_LINE_PADDING + Integer.max(commandModeCellLeftLineWidth, editModeCellLeftLineWidth) + codeCellLeftLinePadding } \ No newline at end of file diff --git a/notebooks/notebook-ui/src/com/intellij/notebooks/ui/visualization/NotebookEditorAppearanceColors.kt b/notebooks/notebook-ui/src/com/intellij/notebooks/ui/visualization/NotebookEditorAppearanceColors.kt index 95b84575bf62..e230373ce781 100644 --- a/notebooks/notebook-ui/src/com/intellij/notebooks/ui/visualization/NotebookEditorAppearanceColors.kt +++ b/notebooks/notebook-ui/src/com/intellij/notebooks/ui/visualization/NotebookEditorAppearanceColors.kt @@ -27,6 +27,5 @@ interface NotebookEditorAppearanceColors { fun getGutterInputExecutionCountForegroundColor(scheme: EditorColorsScheme): Color? = null fun getGutterOutputExecutionCountForegroundColor(scheme: EditorColorsScheme): Color? = null fun getProgressStatusRunningColor(scheme: EditorColorsScheme): Color = JBColor.BLUE - fun getInlayBackgroundColor(scheme: EditorColorsScheme): Color? = null fun getTextOutputBackground(scheme: EditorColorsScheme): Color = scheme.defaultBackground } \ No newline at end of file diff --git a/notebooks/notebook-ui/src/com/intellij/notebooks/ui/visualization/NotebookEditorAppearanceSizes.kt b/notebooks/notebook-ui/src/com/intellij/notebooks/ui/visualization/NotebookEditorAppearanceSizes.kt index 1851607d53b9..85506dfe08c5 100644 --- a/notebooks/notebook-ui/src/com/intellij/notebooks/ui/visualization/NotebookEditorAppearanceSizes.kt +++ b/notebooks/notebook-ui/src/com/intellij/notebooks/ui/visualization/NotebookEditorAppearanceSizes.kt @@ -19,24 +19,20 @@ interface NotebookEditorAppearanceSizes { val cellOutputToolbarInlayPriority: Int get() = 5 + val codeCellLeftLinePadding: Int + val lineNumbersMargin: Int + val commandModeCellLeftLineWidth: Int + val editModeCellLeftLineWidth: Int + val codeAndCodeTopGrayHeight: Int + val codeAndCodeBottomGrayHeight: Int + val innerCellToolbarHeight: Int + val spacerHeight: Int + val executionTimeHeight: Int + val spaceBelowCellToolbar: Int + val cellToolbarTotalHeight: Int + val progressStatusHeight: Int - val CODE_CELL_LEFT_LINE_PADDING: Int - val LINE_NUMBERS_MARGIN: Int - - // TODO Do the pixel constants need JBUI.scale? - val COMMAND_MODE_CELL_LEFT_LINE_WIDTH: Int - val EDIT_MODE_CELL_LEFT_LINE_WIDTH: Int - val CODE_AND_CODE_TOP_GRAY_HEIGHT: Int - val CODE_AND_CODE_BOTTOM_GRAY_HEIGHT: Int - val INNER_CELL_TOOLBAR_HEIGHT: Int - val SPACER_HEIGHT: Int - val EXECUTION_TIME_HEIGHT: Int - val SPACE_BELOW_CELL_TOOLBAR: Int - val CELL_TOOLBAR_TOTAL_HEIGHT: Int - val PROGRESS_STATUS_HEIGHT: Int - - - val EXTRA_PADDING_EXECUTION_COUNT: Int + val extraPaddingExecutionCount: Int val cellBorderHeight: Int val aboveFirstCellDelimiterHeight: Int val distanceBetweenCells: Int