This repository has been archived by the owner on Jul 17, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ad80274
commit 3cbf6a3
Showing
57 changed files
with
240 additions
and
152 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,33 @@ | ||
/* Copyright (c) 2020 DeflatedPickle under the MIT license */ | ||
|
||
package so.madprogrammer; | ||
|
||
import java.util.regex.Matcher; | ||
import java.util.regex.Pattern; | ||
import javax.swing.text.AttributeSet; | ||
import javax.swing.text.BadLocationException; | ||
import javax.swing.text.DocumentFilter; | ||
import java.util.regex.Matcher; | ||
import java.util.regex.Pattern; | ||
|
||
// https://stackoverflow.com/a/28790963 | ||
public class PatternFilter extends DocumentFilter { | ||
private final Pattern pattern; | ||
private final Pattern pattern; | ||
|
||
public PatternFilter(String pat) { | ||
pattern = Pattern.compile(pat); | ||
} | ||
public PatternFilter(String pat) { | ||
pattern = Pattern.compile(pat); | ||
} | ||
|
||
public void insertString(FilterBypass fb, int offset, String string, AttributeSet attr) | ||
throws BadLocationException { | ||
String newStr = fb.getDocument().getText(0, fb.getDocument().getLength()) + string; | ||
Matcher m = pattern.matcher(newStr); | ||
if (m.matches()) { | ||
super.insertString(fb, offset, string, attr); | ||
} | ||
public void insertString(FilterBypass fb, int offset, String string, AttributeSet attr) | ||
throws BadLocationException { | ||
String newStr = fb.getDocument().getText(0, fb.getDocument().getLength()) + string; | ||
Matcher m = pattern.matcher(newStr); | ||
if (m.matches()) { | ||
super.insertString(fb, offset, string, attr); | ||
} | ||
} | ||
|
||
public void replace(FilterBypass fb, int offset, | ||
int length, String string, AttributeSet attr) | ||
throws BadLocationException { | ||
if (length > 0) fb.remove(offset, length); | ||
insertString(fb, offset, string, attr); | ||
} | ||
} | ||
public void replace(FilterBypass fb, int offset, int length, String string, AttributeSet attr) | ||
throws BadLocationException { | ||
if (length > 0) fb.remove(offset, length); | ||
insertString(fb, offset, string, attr); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,31 @@ | ||
/* Copyright (c) 2020 DeflatedPickle under the MIT license */ | ||
|
||
package so.madprogrammer; | ||
|
||
import java.awt.*; | ||
|
||
public class ScaleUtil { | ||
static public double getScaleFactor(int iMasterSize, int iTargetSize) { | ||
return (double) iTargetSize / (double) iMasterSize; | ||
} | ||
|
||
static public double getScaleFactorToFit(Dimension original, Dimension toFit) { | ||
double dScale = 1d; | ||
public static double getScaleFactor(int iMasterSize, int iTargetSize) { | ||
return (double) iTargetSize / (double) iMasterSize; | ||
} | ||
|
||
if (original != null && toFit != null) { | ||
double dScaleWidth = getScaleFactor(original.width, toFit.width); | ||
double dScaleHeight = getScaleFactor(original.height, toFit.height); | ||
public static double getScaleFactorToFit(Dimension original, Dimension toFit) { | ||
double dScale = 1d; | ||
|
||
dScale = Math.min(dScaleHeight, dScaleWidth); | ||
} | ||
if (original != null && toFit != null) { | ||
double dScaleWidth = getScaleFactor(original.width, toFit.width); | ||
double dScaleHeight = getScaleFactor(original.height, toFit.height); | ||
|
||
return dScale; | ||
dScale = Math.min(dScaleHeight, dScaleWidth); | ||
} | ||
|
||
public static double getScaleFactorToFill(Dimension masterSize, Dimension targetSize) { | ||
double dScaleWidth = getScaleFactor(masterSize.width, targetSize.width); | ||
double dScaleHeight = getScaleFactor(masterSize.height, targetSize.height); | ||
return dScale; | ||
} | ||
|
||
return Math.max(dScaleHeight, dScaleWidth); | ||
} | ||
public static double getScaleFactorToFill(Dimension masterSize, Dimension targetSize) { | ||
double dScaleWidth = getScaleFactor(masterSize.width, targetSize.width); | ||
double dScaleHeight = getScaleFactor(masterSize.height, targetSize.height); | ||
|
||
return Math.max(dScaleHeight, dScaleWidth); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 3 additions & 1 deletion
4
core/src/main/kotlin/com/deflatedpickle/quiver/backend/event/EventOpenFile.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
/* Copyright (c) 2020 DeflatedPickle under the MIT license */ | ||
|
||
package com.deflatedpickle.quiver.backend.event | ||
|
||
import com.deflatedpickle.haruhi.api.event.AbstractEvent | ||
import java.io.File | ||
|
||
object EventOpenFile : AbstractEvent<File>() | ||
object EventOpenFile : AbstractEvent<File>() |
4 changes: 3 additions & 1 deletion
4
core/src/main/kotlin/com/deflatedpickle/quiver/backend/event/EventSearchFile.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
/* Copyright (c) 2020 DeflatedPickle under the MIT license */ | ||
|
||
package com.deflatedpickle.quiver.backend.event | ||
|
||
import com.deflatedpickle.haruhi.api.event.AbstractEvent | ||
import java.io.File | ||
|
||
object EventSearchFile : AbstractEvent<File>() | ||
object EventSearchFile : AbstractEvent<File>() |
4 changes: 3 additions & 1 deletion
4
core/src/main/kotlin/com/deflatedpickle/quiver/backend/event/EventSearchFolder.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
/* Copyright (c) 2020 DeflatedPickle under the MIT license */ | ||
|
||
package com.deflatedpickle.quiver.backend.event | ||
|
||
import com.deflatedpickle.haruhi.api.event.AbstractEvent | ||
import java.io.File | ||
|
||
object EventSearchFolder : AbstractEvent<File>() | ||
object EventSearchFolder : AbstractEvent<File>() |
4 changes: 3 additions & 1 deletion
4
core/src/main/kotlin/com/deflatedpickle/quiver/backend/event/EventSelectFile.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
/* Copyright (c) 2020 DeflatedPickle under the MIT license */ | ||
|
||
package com.deflatedpickle.quiver.backend.event | ||
|
||
import com.deflatedpickle.haruhi.api.event.AbstractEvent | ||
import java.io.File | ||
|
||
object EventSelectFile : AbstractEvent<File>() | ||
object EventSelectFile : AbstractEvent<File>() |
4 changes: 3 additions & 1 deletion
4
core/src/main/kotlin/com/deflatedpickle/quiver/backend/event/EventSelectFolder.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
/* Copyright (c) 2020 DeflatedPickle under the MIT license */ | ||
|
||
package com.deflatedpickle.quiver.backend.event | ||
|
||
import com.deflatedpickle.haruhi.api.event.AbstractEvent | ||
import java.io.File | ||
|
||
object EventSelectFolder : AbstractEvent<File>() | ||
object EventSelectFolder : AbstractEvent<File>() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 3 additions & 1 deletion
4
core/src/main/kotlin/com/deflatedpickle/quiver/backend/util/DocumentUtil.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
/* Copyright (c) 2020 DeflatedPickle under the MIT license */ | ||
|
||
package com.deflatedpickle.quiver.backend.util | ||
|
||
import java.io.File | ||
|
||
object DocumentUtil { | ||
var current: File? = null | ||
} | ||
} |
4 changes: 3 additions & 1 deletion
4
core/src/main/kotlin/com/deflatedpickle/quiver/backend/util/Filters.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
/* Copyright (c) 2020 DeflatedPickle under the MIT license */ | ||
|
||
package com.deflatedpickle.quiver.backend.util | ||
|
||
import so.madprogrammer.PatternFilter | ||
|
||
object Filters { | ||
val FILE = PatternFilter("[^\\./:*?\"<>|]*") | ||
val PATH = PatternFilter("[A-Za-z]:[^:*?\"<>|]*") | ||
} | ||
} |
4 changes: 3 additions & 1 deletion
4
core/src/main/kotlin/com/deflatedpickle/quiver/backend/util/PackType.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
/* Copyright (c) 2020 DeflatedPickle under the MIT license */ | ||
|
||
package com.deflatedpickle.quiver.backend.util | ||
|
||
enum class PackType { | ||
EMPTY_PACK, | ||
DEFAULT_PACK | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 3 additions & 1 deletion
4
core/src/main/kotlin/com/deflatedpickle/quiver/backend/util/VersionUtil.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
/* Copyright (c) 2020 DeflatedPickle under the MIT license */ | ||
|
||
package com.deflatedpickle.quiver.backend.util | ||
|
||
object VersionUtil { | ||
val RELEASE = Regex("""\d+\.\d+(\.\d+)?""") | ||
val ALPHA = Regex("""\d+w\d+a""") | ||
val BETA = Regex("""\d+w\d+b""") | ||
} | ||
} |
2 changes: 2 additions & 0 deletions
2
core/src/main/kotlin/com/deflatedpickle/quiver/frontend/constraints/FillBothFinishLine.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
core/src/main/kotlin/com/deflatedpickle/quiver/frontend/constraints/FillHorizontal.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
...rc/main/kotlin/com/deflatedpickle/quiver/frontend/constraints/FillHorizontalFinishLine.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
core/src/main/kotlin/com/deflatedpickle/quiver/frontend/constraints/FillVerticalStickEast.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
core/src/main/kotlin/com/deflatedpickle/quiver/frontend/constraints/FinishLine.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.