Skip to content

Commit

Permalink
Updated to Scala 3.4 and MUnit 1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Martomate committed May 28, 2024
1 parent cd17f8b commit 29c744f
Show file tree
Hide file tree
Showing 11 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
scalaVersion := "3.3.1"
scalaVersion := "3.4.2"

name := "TriPaint"
organization := "com.martomate"
Expand Down Expand Up @@ -28,7 +28,7 @@ jlinkOptions ++= Seq(
Compile / scalacOptions += "-deprecation"

libraryDependencies ++= Seq(
"org.scalameta" %% "munit" % "0.7.29" % "test",
"org.scalameta" %% "munit" % "1.0.0" % "test",
"org.scalatestplus" %% "mockito-4-5" % "3.2.12.0" % "test"
)

Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/tripaint/model/coords/GlobalPixCoords.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package tripaint.model.coords

/** Like TriImageCoords but for pixels (on the entire area) */
case class GlobalPixCoords(x: Int, y: Int) {
def distanceSq(other: GlobalPixCoords): Double = {
infix def distanceSq(other: GlobalPixCoords): Double = {
val dx = other.x - x
val dy = other.y - y
val otherY = other.y + (if other.x % 2 == 0 then 1.0 / 3 else 2.0 / 3)
Expand Down
4 changes: 2 additions & 2 deletions src/main/scala/tripaint/model/image/GridCell.scala
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class GridCell(val coords: GridCoords, init_image: ImageStorage):
private val dispatcher = new EventDispatcher[GridCell.Event]
def trackChanges(tracker: Tracker[GridCell.Event]): Tracker.RevokeFn = dispatcher.track(tracker)

_image.trackChanges(this.onStorageChanged _)
_image.trackChanges(this.onStorageChanged(_))

def storage: ImageStorage = _image

Expand All @@ -35,7 +35,7 @@ class GridCell(val coords: GridCoords, init_image: ImageStorage):

def replaceImage(newImage: ImageStorage): Unit =
_image = newImage
_image.trackChanges(this.onStorageChanged _)
_image.trackChanges(this.onStorageChanged(_))
dispatcher.notify(GridCell.Event.ImageChangedALot)

private def onStorageChanged(event: ImageStorage.Event): Unit =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ object AskForFileOpenSettingsDialog {
val formatMap: Map[StorageFormat, String] = Map.from(formats)

val formatChooser = {
val b = new ChoiceBox[StorageFormat](ObservableBuffer(formats.map(_._1): _*))
val b = new ChoiceBox[StorageFormat](ObservableBuffer(formats.map(_._1)*))
b.selectionModel.value.select(initiallySelectedFormat)
b.converter = StringConverter.toStringConverter(formatMap(_))
b
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ object AskForFileSaveSettingsDialog {
val formatMap: Map[StorageFormat, String] = Map.from(formats)

val formatChooser = {
val b = new ChoiceBox[StorageFormat](ObservableBuffer(formats.map(_._1): _*))
val b = new ChoiceBox[StorageFormat](ObservableBuffer(formats.map(_._1)*))
b.selectionModel.value.select(initiallySelectedFormat)
b.converter = StringConverter.toStringConverter(formatMap(_))
b
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/tripaint/view/gui/DialogUtils.scala
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ object DialogUtils {
dialog.contentText = contentText
dialog.graphic = graphic

val contentBox = new VBox(content: _*)
val contentBox = new VBox(content*)
contentBox.setSpacing(10)

dialog.dialogPane().setContent(contentBox)
Expand Down
4 changes: 2 additions & 2 deletions src/main/scala/tripaint/view/gui/ImagePreviewList.scala
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ object ImagePreviewList {
val scrollPane = {
val p = new ScrollPane()
p.maxWidth = previewSize * 5
p.content = new HBox(children = makeContent(_ => ()): _*)
p.content = new HBox(children = makeContent(_ => ())*)
p.minViewportHeight = previewSize * Math.sqrt(3) / 2
p
}

val updatePreview: (ImageGrid => Unit) => Unit = effect => {
scrollPane.content = new HBox(children = makeContent(effect): _*)
scrollPane.content = new HBox(children = makeContent(effect)*)
}

(scrollPane, updatePreview)
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/tripaint/view/gui/ImageTabs.scala
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ object ImageTabs {
requestImageRemoval: GridCell => Unit
): TilePane = {
val tilePane = new ImageTabs(imagePool, requestImageRemoval)
imageGrid.trackChanges(tilePane.onImageGridEvent _)
imageGrid.trackChanges(tilePane.onImageGridEvent(_))
tilePane
}
}
2 changes: 1 addition & 1 deletion src/main/scala/tripaint/view/gui/MainStageButtons.scala
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ object MainStageButtons {
"Save As",
accelerator =
new KeyCodeCombination(KeyCode.S, KeyCombination.ControlDown, KeyCombination.ShiftDown),
UIAction.SaveAs
action = UIAction.SaveAs
)
val Exit: MenuBarAction = MenuBarAction("Exit", action = UIAction.Exit)
val Undo: MenuBarAction = MenuBarAction(
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/tripaint/view/image/ImageGridPane.scala
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class ImageGridPane(imageGrid: ImageGrid) extends Pane {

children.add(canvas)

imageGrid.trackChanges(this.onImageGridEvent _)
imageGrid.trackChanges(this.onImageGridEvent(_))

private val cumulativeImageChange = mutable.Map.empty[GridCoords, ImageChange.Builder]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class TriImageForPreview(content: GridCell, previewWidth: Double) extends Pane {

private val canvas: TriImageCanvas = new TriImageCanvas(previewWidth, storage.imageSize)

content.trackChanges(onImageChanged _)
content.trackChanges(onImageChanged(_))
children.add(canvas)

redraw()
Expand Down

0 comments on commit 29c744f

Please sign in to comment.