Skip to content

Commit

Permalink
#8: cleanup code
Browse files Browse the repository at this point in the history
  • Loading branch information
rladstaetter committed May 28, 2021
1 parent 34a38c4 commit ddcb56e
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 21 deletions.
15 changes: 1 addition & 14 deletions src/main/scala/app/logorrr/LogoRRRApp.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,10 @@ import javafx.beans.value.{ChangeListener, ObservableValue}
import javafx.event.EventHandler
import javafx.scene.Scene
import javafx.scene.image.Image
import javafx.scene.paint.Color
import javafx.scene.text.Font
import javafx.stage.{Stage, WindowEvent}

import java.nio.file.Paths

object LogoRRRFonts {

// load font thanks to https://www.jetbrains.com/lp/mono/
Font.loadFont(getClass.getResource("/app/logorrr/JetBrainsMono-Regular.ttf").toExternalForm, 12)

def jetBrainsMono(size: Int) =
s"""|-fx-font-family: 'JetBrains Mono';
|-fx-font-size: ${size.toString} px;
|""".stripMargin

}

object LogoRRRApp {

Expand Down Expand Up @@ -49,7 +36,6 @@ class LogoRRRApp extends javafx.application.Application {

import scala.jdk.CollectionConverters._


/**
* will be called by the java bootstrapper
*/
Expand All @@ -60,6 +46,7 @@ class LogoRRRApp extends javafx.application.Application {
val scene = new Scene(mainBorderPane, LogoRRRApp.InitialSceneWidth, LogoRRRApp.InitialSceneHeight)
scene.widthProperty().addListener(new ChangeListener[Number] {
override def changed(observableValue: ObservableValue[_ <: Number], t: Number, t1: Number): Unit = {
println(s"changed: ${t1.intValue}")
Option(mainBorderPane).foreach(_.setSceneWidth(t1.intValue))
}
})
Expand Down
15 changes: 15 additions & 0 deletions src/main/scala/app/logorrr/LogoRRRFonts.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package app.logorrr

import javafx.scene.text.Font

object LogoRRRFonts {

// load font thanks to https://www.jetbrains.com/lp/mono/
Font.loadFont(getClass.getResource("/app/logorrr/JetBrainsMono-Regular.ttf").toExternalForm, 12)

def jetBrainsMono(size: Int) =
s"""|-fx-font-family: 'JetBrains Mono';
|-fx-font-size: ${size.toString} px;
|""".stripMargin

}
7 changes: 1 addition & 6 deletions src/main/scala/app/logorrr/views/LogView.scala
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,11 @@ class LogView(logReport: LogReport
extends Tab with CanLog {

/** repaint if entries or filters change */
val repaintInvalidationListener: InvalidationListener = new InvalidationListener {
override def invalidated(observable: Observable): Unit = {
repaint()
}
}
val repaintInvalidationListener: InvalidationListener = (_: Observable) => repaint()

def start(): Unit = {
logReport.start()
installInvalidationListener()

}

/** don't monitor file anymore if tab is closed, free invalidation listeners */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class LogVisualView(entries: mutable.Buffer[LogEntry]

def repaint(sWidth: Int, cWidth: Int): Unit = timeR({
sisp.repaint(sWidth, cWidth)
}, "Executes repaint")
}, "Repaint")


}

0 comments on commit ddcb56e

Please sign in to comment.