Added: Configure grid and guides color

This commit is contained in:
Jindra Petřík
2025-05-07 09:42:40 +02:00
parent aff0b8aea3
commit 3d9e44d3f1
6 changed files with 174 additions and 7 deletions

View File

@@ -23,6 +23,7 @@ import com.jpexs.decompiler.flash.helpers.FontHelper;
import com.jpexs.decompiler.flash.importers.TextImportResizeTextBoundsMode;
import com.jpexs.helpers.Helper;
import com.jpexs.helpers.Path;
import java.awt.Color;
import java.awt.Font;
import java.io.BufferedOutputStream;
import java.io.File;
@@ -1101,6 +1102,14 @@ public final class Configuration {
@ConfigurationCategory("display")
public static ConfigurationItem<Boolean> gridOverObjects = null;
@ConfigurationDefaultColor("#949494")
@ConfigurationCategory("display")
public static ConfigurationItem<Color> gridColor = null;
@ConfigurationDefaultColor("#00FF00")
@ConfigurationCategory("display")
public static ConfigurationItem<Color> guidesColor = null;
private enum OSId {
WINDOWS, OSX, UNIX
}
@@ -1484,6 +1493,17 @@ public final class Configuration {
mingc.setTime(new Date(aCalendar.value()));
defaultValue = mingc;
}
ConfigurationDefaultColor aColor = field.getAnnotation(ConfigurationDefaultColor.class);
if (aColor != null) {
Pattern p = Pattern.compile("#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})$");
Matcher m = p.matcher(aColor.value());
if (m.matches()) {
defaultValue = new Color(Integer.parseInt(m.group(1), 16), Integer.parseInt(m.group(2), 16), Integer.parseInt(m.group(3), 16));
} else {
defaultValue = Color.black;
}
}
return defaultValue;
}

View File

@@ -0,0 +1,34 @@
/*
* Copyright (C) 2010-2024 JPEXS, All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
*/
package com.jpexs.decompiler.flash.configuration;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Configuration default Color annotation.
*
* @author JPEXS
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
public @interface ConfigurationDefaultColor {
String value();
}