Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2024.3 Build Support #805

Merged
merged 5 commits into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 2 additions & 9 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
import io.gitlab.arturbosch.detekt.Detekt
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import org.kordamp.gradle.plugin.markdown.tasks.MarkdownToHtmlTask

fun properties(key: String) = project.findProperty(key).toString()

plugins {
// Custom plugin for building all the themes
id("doki-theme-plugin")
// Kotlin support
kotlin("jvm") version "1.8.10"
kotlin("jvm") version "2.0.0"
// gradle-intellij-plugin - read more: https://github.com/JetBrains/gradle-intellij-plugin
id("org.jetbrains.intellij") version "1.16.1"
// detekt linter - read more: https://detekt.github.io/detekt/gradle.html
id("io.gitlab.arturbosch.detekt") version "1.23.6"
// ktlint linter - read more: https://github.com/JLLeitschuh/ktlint-gradle
id("org.jlleitschuh.gradle.ktlint") version "12.0.3"
id("org.kordamp.gradle.markdown") version "2.2.0"
id("org.jetbrains.qodana") version "0.1.13"
}

Expand Down Expand Up @@ -99,11 +97,6 @@ tasks {
jvmTarget = "17"
}

withType<MarkdownToHtmlTask> {
sourceDir = file("$projectDir/changelog")
outputDir = file("$projectDir/build/html")
}

runIde {
maxHeapSize = "2g"
enabled = environment.getOrDefault("SHOULD_DOKI_THEME_RUN", "true") == "true"
Expand All @@ -128,7 +121,7 @@ tasks {
changeNotes.set(releaseNotes.readText())
}

dependsOn("markdownToHtml", "buildThemes")
dependsOn("buildThemes")
}

signPlugin {
Expand Down
5 changes: 5 additions & 0 deletions changelog/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
Changelog
---
# 88.5-1.15.0 [2024.3 Build Support]

- Lowest supported version is now 2024.3
- Compiles to the 2024.3 build

# 88.5-1.14.0 [Marketplace Support]

- Added initial 2024.2 build support
Expand Down
2 changes: 0 additions & 2 deletions changelog/RELEASE-NOTES.md

This file was deleted.

13 changes: 7 additions & 6 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,20 @@
# -> https://www.jetbrains.org/intellij/sdk/docs/reference_guide/intellij_artifacts.html

pluginGroup=io.unthrottled
pluginVersion=88.5-1.14.1
pluginSinceBuild=241
pluginUntilBuild=242.*
pluginVersion=88.5-1.15.0
pluginSinceBuild=243
pluginUntilBuild=243.*

# Plugin Verifier integration -> https://github.com/JetBrains/gradle-intellij-plugin#plugin-verifier-dsl
# See https://jb.gg/intellij-platform-builds-list for available build versions.
pluginVerifierIdeVersions = 2024.1, 2024.2
pluginVerifierIdeVersions = 2024.3

platformType = IU
platformVersion = 2024.1.4
platformVersion = 2024.2
platformDownloadSources = true
# Plugin Dependencies -> https://www.jetbrains.org/intellij/sdk/docs/basics/plugin_structure/plugin_dependencies.html
# Example: platformPlugins = com.intellij.java,com.jetbrains.php:203.4449.22
# todo for the next build platformPlugins = XPathView,com.intellij.modules.json
platformPlugins = XPathView

# Java language level used to compile sources and to generate the files for - Java 11 is required since 2020.3
Expand All @@ -30,6 +31,6 @@ kotlin.stdlib.default.dependency = false

idePrefix=IU
idePath=
#idePath=/Users/alexsimons/Library/Application Support/JetBrains/Toolbox/apps/IDEA-C/ch-0/231.7515.13/IntelliJ IDEA 2023.1 CE EAP.app/Contents
#idePath=/Users/alexsimons/Applications/WebStorm.app/Contents
#idePath=C:\\Users\\birdm.DESKTOP-FO92PV5\\AppData\\Local\\JetBrains\\Toolbox\\apps\\Rider\\ch-0\\212.4416.21
#idePath=/home/alex/.local/share/JetBrains/Toolbox/apps/IDEA-U/ch-0/202.7660.26
72 changes: 30 additions & 42 deletions src/main/kotlin/io/unthrottled/doki/stickers/StickerPane.kt
Original file line number Diff line number Diff line change
Expand Up @@ -195,22 +195,17 @@ internal class StickerPane(
var hoveredInside = false
var makingStickerReAppear = false
return AWTEventListener { event ->
if (
!this.hideConfig.hideOnHover ||
event !is InputEvent ||
UIUtil.isDescendingFrom(event.component, drawablePane).not()
if (!this.hideConfig.hideOnHover || event !is InputEvent ||
UIUtil.isDescendingFrom(event.component, drawablePane)
.not()
) {
return@AWTEventListener
}

if (event is MouseEvent) {
val isInsideSticker = isInsideMemePanel(event)
val stickerShowing = isStickerShowing()
if (
event.id == MouseEvent.MOUSE_MOVED &&
isInsideSticker &&
stickerShowing
) {
if (event.id == MouseEvent.MOUSE_MOVED && isInsideSticker && stickerShowing) {
if (!hoveredInside) {
hoveredInside = true
hoverAlarm.addRequest(
Expand All @@ -223,11 +218,7 @@ internal class StickerPane(
this.hideConfig.hideDelayMS,
)
}
} else if (
event.id == MouseEvent.MOUSE_MOVED &&
hoveredInside &&
!isInsideSticker
) {
} else if (event.id == MouseEvent.MOUSE_MOVED && hoveredInside && !isInsideSticker) {
if (!makingStickerReAppear) {
hoverAlarm.cancelAllRequests()
}
Expand All @@ -253,9 +244,7 @@ internal class StickerPane(
}
}

private fun isStickerShowing() =
alpha == CLEARED_ALPHA ||
alpha == VISIBLE_ALPHA
private fun isStickerShowing() = alpha == CLEARED_ALPHA || alpha == VISIBLE_ALPHA

private fun isInsideMemePanel(e: MouseEvent): Boolean = isInsideComponent(e, this)

Expand Down Expand Up @@ -347,9 +336,7 @@ internal class StickerPane(

// don't show on small stickers on
// small dialog windows
if (type == StickerType.SMOL &&
drawablePane.height < 400
) {
if (type == StickerType.SMOL && drawablePane.height < 400) {
return
}

Expand Down Expand Up @@ -478,8 +465,7 @@ internal class StickerPane(
),
)

type == StickerType.REGULAR &&
ThemeConfig.instance.capStickerDimensions ->
type == StickerType.REGULAR && ThemeConfig.instance.capStickerDimensions ->
DimensionCappingService.getCappingStyle(
originalDimension,
Dimension(
Expand All @@ -494,17 +480,16 @@ internal class StickerPane(

private fun getImageDimensions(stickerUrl: String): Dimension =
runSafelyWithResult({
ImageIO.createImageInputStream(File(URI(stickerUrl)))
.use {
val readers = ImageIO.getImageReaders(it)
if (readers.hasNext()) {
val reader = readers.next()
reader.input = it
Dimension(reader.getWidth(0), reader.getHeight(0))
} else {
Dimension(1, 1)
}
ImageIO.createImageInputStream(File(URI(stickerUrl))).use {
val readers = ImageIO.getImageReaders(it)
if (readers.hasNext()) {
val reader = readers.next()
reader.input = it
Dimension(reader.getWidth(0), reader.getHeight(0))
} else {
Dimension(1, 1)
}
}
}) { Dimension(1, 1) }

private fun positionStickerPanel(
Expand All @@ -528,9 +513,10 @@ internal class StickerPane(
parentWidth: Int,
parentHeight: Int,
stickerPanelBoundingBox: Rectangle,
): Pair<Int, Int> =
parentWidth - stickerPanelBoundingBox.width - (parentWidth * myMargin.marginX).toInt() to
parentHeight - stickerPanelBoundingBox.height - (parentHeight * myMargin.marginY).toInt()
): Pair<Int, Int> {
val i = parentWidth - stickerPanelBoundingBox.width - (parentWidth * myMargin.marginX).toInt()
return i to parentHeight - stickerPanelBoundingBox.height - (parentHeight * myMargin.marginY).toInt()
}

fun detach() {
drawablePane.remove(this)
Expand Down Expand Up @@ -640,13 +626,15 @@ internal class StickerPane(
private fun runFadeAnimation(runForwards: Boolean = true) {
val self = this
val animator =
object : Animator(
"Sticker Fadeout",
TOTAL_FRAMES,
CYCLE_DURATION,
false,
runForwards,
) {
object :
Animator(
"Sticker Fadeout",
TOTAL_FRAMES,
CYCLE_DURATION,
false,
runForwards,
),
Disposable {
override fun paintNow(
frame: Int,
totalFrames: Int,
Expand Down
15 changes: 9 additions & 6 deletions src/main/kotlin/io/unthrottled/doki/util/LAFAnimator.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package io.unthrottled.doki.util

import com.intellij.openapi.Disposable
import com.intellij.openapi.util.Disposer
import com.intellij.util.ui.Animator
import com.intellij.util.ui.GraphicsUtil
Expand Down Expand Up @@ -68,12 +69,14 @@ class LAFAnimator {
}

myAnimator =
object : Animator(
"ChangeLAF",
60,
800,
false,
) {
object :
Animator(
"ChangeLAF",
60,
800,
false,
),
Disposable {
override fun paintNow(
frame: Int,
totalFrames: Int,
Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/io/unthrottled/doki/util/ToolBox.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import java.util.Optional
import java.util.concurrent.Callable
import java.util.stream.Stream

fun <T> getSafely(callable: Callable<T>): Optional<T> =
fun <T : Any> getSafely(callable: Callable<T>): Optional<T> =
try {
callable.call().toOptional()
} catch (e: Throwable) {
Expand Down
Loading