mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-10 17:22:09 +10:00
Added a button in the action toolbar to toggle between snap modes (none,
grid, component)
This commit is contained in:
@@ -3277,7 +3277,11 @@
|
|||||||
</versionNumber>
|
</versionNumber>
|
||||||
<releaseDate>2020-11-19 00:00:00.000 CET</releaseDate>
|
<releaseDate>2020-11-19 00:00:00.000 CET</releaseDate>
|
||||||
<name></name>
|
<name></name>
|
||||||
<changes>
|
<changes>
|
||||||
|
<org.diylc.appframework.update.Change>
|
||||||
|
<changeType>NEW_FEATURE</changeType>
|
||||||
|
<description>Added a button in the action toolbar to toggle between snap modes (none, grid, component)</description>
|
||||||
|
</org.diylc.appframework.update.Change>
|
||||||
<org.diylc.appframework.update.Change>
|
<org.diylc.appframework.update.Change>
|
||||||
<changeType>NEW_FEATURE</changeType>
|
<changeType>NEW_FEATURE</changeType>
|
||||||
<description>Added pinch zooming functionality for compatible devices (tested on Mac and Win laptops)</description>
|
<description>Added pinch zooming functionality for compatible devices (tested on Mac and Win laptops)</description>
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ Click on the canvas to set the %s control point of a new %s or press %s to cance
|
|||||||
Click the lightbulb icon in the bottom-right corner of the window for more info.|Klicken Sie auf das Glühbirnen-Symbol in der unteren rechten Ecke des Fensters, um weitere Informationen zu erhalten
|
Click the lightbulb icon in the bottom-right corner of the window for more info.|Klicken Sie auf das Glühbirnen-Symbol in der unteren rechten Ecke des Fensters, um weitere Informationen zu erhalten
|
||||||
Click to fetch the most recent public announcement|Klicken Sie hier, um das neuste Update zu erhalten
|
Click to fetch the most recent public announcement|Klicken Sie hier, um das neuste Update zu erhalten
|
||||||
Click to show recent changes and updates|Klicken Sie hier, um die letzten Änderungen und Aktualisierungen anzuzeigen
|
Click to show recent changes and updates|Klicken Sie hier, um die letzten Änderungen und Aktualisierungen anzuzeigen
|
||||||
|
Click to toggle to the next option|Klicken Sie, um zur nächsten Option zu wechseln
|
||||||
Coil|Spule
|
Coil|Spule
|
||||||
Coil Border|Spulenrand
|
Coil Border|Spulenrand
|
||||||
Coil Length|Spulenlänge
|
Coil Length|Spulenlänge
|
||||||
@@ -367,7 +368,7 @@ Size|Größe
|
|||||||
Sizing Mode|Größenmodus
|
Sizing Mode|Größenmodus
|
||||||
Small-button B7G|Miniatur 7-pol
|
Small-button B7G|Miniatur 7-pol
|
||||||
Smooth|Glätten
|
Smooth|Glätten
|
||||||
Snap To...|Einrasten zu...
|
Snap To|Einrasten zu
|
||||||
Soap Bar|
|
Soap Bar|
|
||||||
Solid|Ununterbrochen
|
Solid|Ununterbrochen
|
||||||
South|Süden
|
South|Süden
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ Click on the canvas to set the %s control point of a new %s or press %s to cance
|
|||||||
Click the lightbulb icon in the bottom-right corner of the window for more info.
|
Click the lightbulb icon in the bottom-right corner of the window for more info.
|
||||||
Click to fetch the most recent public announcement
|
Click to fetch the most recent public announcement
|
||||||
Click to show recent changes and updates
|
Click to show recent changes and updates
|
||||||
|
Click to toggle to the next option
|
||||||
Coil
|
Coil
|
||||||
Coil Border
|
Coil Border
|
||||||
Coil Length
|
Coil Length
|
||||||
@@ -350,7 +351,7 @@ Size
|
|||||||
Sizing Mode
|
Sizing Mode
|
||||||
Small-button B7G
|
Small-button B7G
|
||||||
Smooth
|
Smooth
|
||||||
Snap To...
|
Snap To
|
||||||
Soap Bar
|
Soap Bar
|
||||||
Solid
|
Solid
|
||||||
South
|
South
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ Click on the canvas to set the %s control point of a new %s or press %s to cance
|
|||||||
Click the lightbulb icon in the bottom-right corner of the window for more info.|Haga clic en el icono de la bombilla en la esquina inferior derecha de la ventana para obtener más información.
|
Click the lightbulb icon in the bottom-right corner of the window for more info.|Haga clic en el icono de la bombilla en la esquina inferior derecha de la ventana para obtener más información.
|
||||||
Click to fetch the most recent public announcement|Haga clic para obtener el anuncio público más reciente.
|
Click to fetch the most recent public announcement|Haga clic para obtener el anuncio público más reciente.
|
||||||
Click to show recent changes and updates|Haga clic para ver cambios y actualizaciones recientes
|
Click to show recent changes and updates|Haga clic para ver cambios y actualizaciones recientes
|
||||||
|
Click to toggle to the next option|Haga clic para cambiar a la siguiente opción
|
||||||
Coil|Bobina
|
Coil|Bobina
|
||||||
Coil Border|Borde de la bobina
|
Coil Border|Borde de la bobina
|
||||||
Coil Length|Longitud de la bobina
|
Coil Length|Longitud de la bobina
|
||||||
@@ -356,7 +357,7 @@ Size|Tamaño
|
|||||||
Sizing Mode|Modo de Dimensionamiento
|
Sizing Mode|Modo de Dimensionamiento
|
||||||
Small-button B7G|Zócalo de Botón pequeño B7G
|
Small-button B7G|Zócalo de Botón pequeño B7G
|
||||||
Smooth|Suave
|
Smooth|Suave
|
||||||
Snap To...|Ajustarse a...
|
Snap To|Ajustarse a
|
||||||
Soap Bar|Soap Bar
|
Soap Bar|Soap Bar
|
||||||
Solid|Sólido
|
Solid|Sólido
|
||||||
South|Sur
|
South|Sur
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ Click on the canvas to set the %s control point of a new %s or press %s to cance
|
|||||||
Click the lightbulb icon in the bottom-right corner of the window for more info.|Cliquez sur l'icône de l'ampoule dans le coin inférieur droit de la fenêtre pour plus d'informations.
|
Click the lightbulb icon in the bottom-right corner of the window for more info.|Cliquez sur l'icône de l'ampoule dans le coin inférieur droit de la fenêtre pour plus d'informations.
|
||||||
Click to fetch the most recent public announcement|Cliquez pour récupérer l'annonce publique la plus récente
|
Click to fetch the most recent public announcement|Cliquez pour récupérer l'annonce publique la plus récente
|
||||||
Click to show recent changes and updates|Cliquez pour afficher les modifications et mises à jour récentes
|
Click to show recent changes and updates|Cliquez pour afficher les modifications et mises à jour récentes
|
||||||
|
Click to toggle to the next option|Cliquez pour passer à l'option suivante
|
||||||
Coil|Bobine
|
Coil|Bobine
|
||||||
Coil Border|Bordure de la bobine
|
Coil Border|Bordure de la bobine
|
||||||
Coil Length|Longueur de la bobine
|
Coil Length|Longueur de la bobine
|
||||||
@@ -352,7 +353,7 @@ Size|Taille
|
|||||||
Sizing Mode|Mode de redimensionnement
|
Sizing Mode|Mode de redimensionnement
|
||||||
Small-button B7G|Petit bouton B7G
|
Small-button B7G|Petit bouton B7G
|
||||||
Smooth|Lisse
|
Smooth|Lisse
|
||||||
Snap To...|Aimanter à ...
|
Snap To|Aimanter à
|
||||||
Soap Bar|Soap Bar
|
Soap Bar|Soap Bar
|
||||||
Solid|Solide
|
Solid|Solide
|
||||||
South|Sud
|
South|Sud
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ Click on the canvas to set the %s control point of a new %s or press %s to cance
|
|||||||
Click the lightbulb icon in the bottom-right corner of the window for more info.|Clicca sull'icona della lampadina nell'angolo in basso a destra della finestra per ulteriori informazioni.
|
Click the lightbulb icon in the bottom-right corner of the window for more info.|Clicca sull'icona della lampadina nell'angolo in basso a destra della finestra per ulteriori informazioni.
|
||||||
Click to fetch the most recent public announcement|Clicca per recuperare l'annuncio pubblico più recente
|
Click to fetch the most recent public announcement|Clicca per recuperare l'annuncio pubblico più recente
|
||||||
Click to show recent changes and updates|Clicca per mostrare le modifiche e gli aggiornamenti recenti
|
Click to show recent changes and updates|Clicca per mostrare le modifiche e gli aggiornamenti recenti
|
||||||
|
Click to toggle to the next option|Clicca per passare all'opzione successiva
|
||||||
Coil|Bobina
|
Coil|Bobina
|
||||||
Coil Border|Bordo della Bobina
|
Coil Border|Bordo della Bobina
|
||||||
Coil Length|Lunghezza della Bobina
|
Coil Length|Lunghezza della Bobina
|
||||||
@@ -367,7 +368,7 @@ Size|dimensione
|
|||||||
Sizing Mode|Modalità di dimensionamento
|
Sizing Mode|Modalità di dimensionamento
|
||||||
Small-button B7G|Pulsante piccolo B7G
|
Small-button B7G|Pulsante piccolo B7G
|
||||||
Smooth|Smussato
|
Smooth|Smussato
|
||||||
Snap To...|Aggancia a ...
|
Snap To|Aggancia a
|
||||||
Soap Bar|Soap Bar
|
Soap Bar|Soap Bar
|
||||||
Solid|solido
|
Solid|solido
|
||||||
South|Sud
|
South|Sud
|
||||||
|
|||||||
@@ -60,7 +60,8 @@ Click on the canvas to create a new %s or press %s to cancel|Klik op het werkbla
|
|||||||
Click on the canvas to set the %s control point of a new %s or press %s to cancel|Klik op het werkblad om het %s-controlepunt van een nieuwe %s in te stellen of druk op %s om te annuleren
|
Click on the canvas to set the %s control point of a new %s or press %s to cancel|Klik op het werkblad om het %s-controlepunt van een nieuwe %s in te stellen of druk op %s om te annuleren
|
||||||
Click the lightbulb icon in the bottom-right corner of the window for more info.|Klik op het gloeilampicoon in de rechteronderhoek van het venster voor meer informatie.
|
Click the lightbulb icon in the bottom-right corner of the window for more info.|Klik op het gloeilampicoon in de rechteronderhoek van het venster voor meer informatie.
|
||||||
Click to fetch the most recent public announcement|Klik om de meest recente openbare aankondiging op te halen
|
Click to fetch the most recent public announcement|Klik om de meest recente openbare aankondiging op te halen
|
||||||
Click to show recent changes and updates|Klik om recente wijzigingen en updates weer te geven
|
Click to show recent changes and updates|Klik om recente wijzigingen en updates weer te geven
|
||||||
|
Click to toggle to the next option|Klik om naar de volgende optie te gaan
|
||||||
Coil|Spoel
|
Coil|Spoel
|
||||||
Coil Border|Spoelrand
|
Coil Border|Spoelrand
|
||||||
Coil Length|Spoellengte
|
Coil Length|Spoellengte
|
||||||
@@ -367,7 +368,7 @@ Size|Maat
|
|||||||
Sizing Mode|Dimensioneringsmethode
|
Sizing Mode|Dimensioneringsmethode
|
||||||
Small-button B7G|B7G met Kleine Knop
|
Small-button B7G|B7G met Kleine Knop
|
||||||
Smooth|Egaliseren
|
Smooth|Egaliseren
|
||||||
Snap To...|Uitlijnen op...
|
Snap To|Uitlijnen op
|
||||||
Soap Bar|Soap Bar
|
Soap Bar|Soap Bar
|
||||||
Solid|Ononderbroken
|
Solid|Ononderbroken
|
||||||
South|Zuid
|
South|Zuid
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ Click on the canvas to set the %s control point of a new %s or press %s to cance
|
|||||||
Click the lightbulb icon in the bottom-right corner of the window for more info.|Klikni na ikonicu sa sijalicom u donjem-desnom uglu prozora za više informacija.
|
Click the lightbulb icon in the bottom-right corner of the window for more info.|Klikni na ikonicu sa sijalicom u donjem-desnom uglu prozora za više informacija.
|
||||||
Click to fetch the most recent public announcement|Klikni za preuzimanje najnovijih objava
|
Click to fetch the most recent public announcement|Klikni za preuzimanje najnovijih objava
|
||||||
Click to show recent changes and updates|Klikni za prikaz skorih unapređenja
|
Click to show recent changes and updates|Klikni za prikaz skorih unapređenja
|
||||||
|
Click to toggle to the next option|Klikni za prelaz za narednu opciju
|
||||||
Coil|Kalem
|
Coil|Kalem
|
||||||
Coil Border|Ivica Kalema
|
Coil Border|Ivica Kalema
|
||||||
Coil Length|Dužina Kalema
|
Coil Length|Dužina Kalema
|
||||||
@@ -348,7 +349,7 @@ Size|Veličina
|
|||||||
Sizing Mode|Zadavanje Veličine
|
Sizing Mode|Zadavanje Veličine
|
||||||
Small-button B7G
|
Small-button B7G
|
||||||
Smooth|Glatko
|
Smooth|Glatko
|
||||||
Snap To...|Zalepi Uz...
|
Snap To|Zalepi Uz
|
||||||
Soap Bar
|
Soap Bar
|
||||||
Solid|Puna Linija
|
Solid|Puna Linija
|
||||||
South|Jug
|
South|Jug
|
||||||
|
|||||||
@@ -1705,7 +1705,7 @@ public class ActionFactory {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class ToggleAction extends AbstractAction {
|
public static class ToggleAction extends AbstractAction implements IConfigListener {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@@ -1720,6 +1720,8 @@ public class ActionFactory {
|
|||||||
.readString(configKey, defaultValue).equalsIgnoreCase(title));
|
.readString(configKey, defaultValue).equalsIgnoreCase(title));
|
||||||
if (icon != null)
|
if (icon != null)
|
||||||
putValue(AbstractAction.SMALL_ICON, icon);
|
putValue(AbstractAction.SMALL_ICON, icon);
|
||||||
|
// keep track of config changes and update the state accordingly
|
||||||
|
ConfigurationManager.getInstance().addConfigListener(configKey, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -1727,6 +1729,11 @@ public class ActionFactory {
|
|||||||
LOG.info(getValue(AbstractAction.NAME) + " toggle triggered");
|
LOG.info(getValue(AbstractAction.NAME) + " toggle triggered");
|
||||||
ConfigurationManager.getInstance().writeValue(configKey, getValue(AbstractAction.NAME));
|
ConfigurationManager.getInstance().writeValue(configKey, getValue(AbstractAction.NAME));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void valueChanged(String key, Object value) {
|
||||||
|
putValue(AbstractAction.SELECTED_KEY, getValue(AbstractAction.NAME).toString().equalsIgnoreCase(value.toString()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class ThemeAction extends AbstractAction {
|
public static class ThemeAction extends AbstractAction {
|
||||||
|
|||||||
@@ -26,7 +26,9 @@ import java.awt.event.ComponentAdapter;
|
|||||||
import java.awt.event.ComponentEvent;
|
import java.awt.event.ComponentEvent;
|
||||||
import java.awt.event.MouseAdapter;
|
import java.awt.event.MouseAdapter;
|
||||||
import java.awt.event.MouseEvent;
|
import java.awt.event.MouseEvent;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import javax.swing.BorderFactory;
|
import javax.swing.BorderFactory;
|
||||||
import javax.swing.JLabel;
|
import javax.swing.JLabel;
|
||||||
@@ -42,11 +44,10 @@ import org.diylc.common.EventType;
|
|||||||
import org.diylc.common.IComponentTransformer;
|
import org.diylc.common.IComponentTransformer;
|
||||||
import org.diylc.common.IPlugIn;
|
import org.diylc.common.IPlugIn;
|
||||||
import org.diylc.common.IPlugInPort;
|
import org.diylc.common.IPlugInPort;
|
||||||
import org.diylc.swing.images.IconLoader;
|
|
||||||
import org.diylc.lang.LangUtil;
|
import org.diylc.lang.LangUtil;
|
||||||
import org.diylc.swing.ActionFactory;
|
import org.diylc.swing.ActionFactory;
|
||||||
import org.diylc.swing.ISwingUI;
|
import org.diylc.swing.ISwingUI;
|
||||||
import org.diylc.swing.plugins.canvas.CanvasPlugin;
|
import org.diylc.swing.images.IconLoader;
|
||||||
import org.diylc.swing.plugins.help.HelpMenuPlugin;
|
import org.diylc.swing.plugins.help.HelpMenuPlugin;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -152,6 +153,13 @@ public class ActionBarPlugin implements IPlugIn {
|
|||||||
public ConfigToolbar getConfigToolbar() {
|
public ConfigToolbar getConfigToolbar() {
|
||||||
if (configToolbar == null) {
|
if (configToolbar == null) {
|
||||||
configToolbar = new ConfigToolbar();
|
configToolbar = new ConfigToolbar();
|
||||||
|
|
||||||
|
List<ToggleItem> toggleItems = new ArrayList<ToggleItem>();
|
||||||
|
toggleItems.add(new ToggleItem(IPlugInPort.SNAP_TO_NONE, IPlugInPort.SNAP_TO_NONE, IconLoader.SnapToNone.getIcon()));
|
||||||
|
toggleItems.add(new ToggleItem(IPlugInPort.SNAP_TO_GRID, IPlugInPort.SNAP_TO_GRID, IconLoader.SnapToGrid.getIcon()));
|
||||||
|
toggleItems.add(new ToggleItem(IPlugInPort.SNAP_TO_COMPONENTS, IPlugInPort.SNAP_TO_COMPONENTS, IconLoader.SnapToComponents.getIcon()));
|
||||||
|
configToolbar.addToggleLabel(LangUtil.translate("Snap To"), IPlugInPort.SNAP_TO_KEY, IPlugInPort.SNAP_TO_DEFAULT, toggleItems);
|
||||||
|
|
||||||
configToolbar.add(LangUtil.translate("Continuous Creation"), IPlugInPort.CONTINUOUS_CREATION_KEY, IconLoader.Elements.getIcon(), false);
|
configToolbar.add(LangUtil.translate("Continuous Creation"), IPlugInPort.CONTINUOUS_CREATION_KEY, IconLoader.Elements.getIcon(), false);
|
||||||
configToolbar.add(LangUtil.translate("Highlight Connected Areas"), IPlugInPort.HIGHLIGHT_CONTINUITY_AREA, IconLoader.LaserPointer.getIcon(), false);
|
configToolbar.add(LangUtil.translate("Highlight Connected Areas"), IPlugInPort.HIGHLIGHT_CONTINUITY_AREA, IconLoader.LaserPointer.getIcon(), false);
|
||||||
configToolbar.add(LangUtil.translate("Sticky Points"), IPlugInPort.STICKY_POINTS_KEY, IconLoader.GraphNodes.getIcon(), true);
|
configToolbar.add(LangUtil.translate("Sticky Points"), IPlugInPort.STICKY_POINTS_KEY, IconLoader.GraphNodes.getIcon(), true);
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ import java.awt.Component;
|
|||||||
import java.awt.Cursor;
|
import java.awt.Cursor;
|
||||||
import java.awt.event.MouseAdapter;
|
import java.awt.event.MouseAdapter;
|
||||||
import java.awt.event.MouseEvent;
|
import java.awt.event.MouseEvent;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import javax.swing.BorderFactory;
|
import javax.swing.BorderFactory;
|
||||||
import javax.swing.Icon;
|
import javax.swing.Icon;
|
||||||
@@ -75,6 +76,11 @@ public class ConfigToolbar extends JPanel {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void addToggleLabel(String text, String configKey, String defaultValue, List<ToggleItem> items) {
|
||||||
|
ToggleConfigLabel label = new ToggleConfigLabel(text, configKey, defaultValue, items);
|
||||||
|
add(label);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setEnabled(boolean enabled) {
|
public void setEnabled(boolean enabled) {
|
||||||
for (Component c : getComponents())
|
for (Component c : getComponents())
|
||||||
|
|||||||
@@ -0,0 +1,85 @@
|
|||||||
|
/*
|
||||||
|
|
||||||
|
DIY Layout Creator (DIYLC).
|
||||||
|
Copyright (c) 2009-2018 held jointly by the individual authors.
|
||||||
|
|
||||||
|
This file is part of DIYLC.
|
||||||
|
|
||||||
|
DIYLC is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
DIYLC 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 General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
*/
|
||||||
|
package org.diylc.swing.gui.actionbar;
|
||||||
|
|
||||||
|
import java.awt.Cursor;
|
||||||
|
import java.awt.event.MouseAdapter;
|
||||||
|
import java.awt.event.MouseEvent;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.swing.JLabel;
|
||||||
|
import javax.swing.SwingConstants;
|
||||||
|
|
||||||
|
import org.diylc.appframework.miscutils.ConfigurationManager;
|
||||||
|
import org.diylc.appframework.miscutils.IConfigListener;
|
||||||
|
import org.diylc.lang.LangUtil;
|
||||||
|
|
||||||
|
public class ToggleConfigLabel extends JLabel implements IConfigListener {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
private List<ToggleItem> items;
|
||||||
|
private String configItem;
|
||||||
|
private String title;
|
||||||
|
|
||||||
|
private int itemIndex = 0;
|
||||||
|
|
||||||
|
public ToggleConfigLabel(String title, String configKey, String defaultValue, List<ToggleItem> items) {
|
||||||
|
super();
|
||||||
|
this.title = title;
|
||||||
|
this.configItem = configKey;
|
||||||
|
this.items = items;
|
||||||
|
setHorizontalTextPosition(SwingConstants.LEFT);
|
||||||
|
setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
|
||||||
|
|
||||||
|
valueChanged(configKey, ConfigurationManager.getInstance().readString(configKey, defaultValue));
|
||||||
|
ConfigurationManager.getInstance().addConfigListener(configKey, this);
|
||||||
|
|
||||||
|
addMouseListener(new MouseAdapter() {
|
||||||
|
@Override
|
||||||
|
public void mouseClicked(MouseEvent e) {
|
||||||
|
itemIndex++;
|
||||||
|
if (itemIndex >= items.size())
|
||||||
|
itemIndex = 0;
|
||||||
|
ConfigurationManager.getInstance().writeValue(configKey, items.get(itemIndex).getConfigValue());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void valueChanged(String key, Object value) {
|
||||||
|
if (!this.configItem.equalsIgnoreCase(key) || value == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
this.itemIndex = 0;
|
||||||
|
for (int i = 0; i < items.size(); i++) {
|
||||||
|
ToggleItem item = items.get(i);
|
||||||
|
if (item.getConfigValue().equalsIgnoreCase(value.toString()))
|
||||||
|
{
|
||||||
|
this.itemIndex = i;
|
||||||
|
setIcon(item.getIcon());
|
||||||
|
setToolTipText(title + " " + item.getConfigValue() + ". " + LangUtil.translate("Click to toggle to the next option"));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
package org.diylc.swing.gui.actionbar;
|
||||||
|
|
||||||
|
import javax.swing.Icon;
|
||||||
|
|
||||||
|
public class ToggleItem {
|
||||||
|
private String name;
|
||||||
|
private String configValue;
|
||||||
|
private Icon icon;
|
||||||
|
|
||||||
|
public ToggleItem(String name, String configValue, Icon icon) {
|
||||||
|
super();
|
||||||
|
this.name = name;
|
||||||
|
this.configValue = configValue;
|
||||||
|
this.icon = icon;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getConfigValue() {
|
||||||
|
return configValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Icon getIcon() {
|
||||||
|
return icon;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -66,7 +66,8 @@ public enum IconLoader {
|
|||||||
Node("node.png"), Web("web.png"), Guitar("guitar.png"), Scientist("scientist.png"), StarGrey("star_grey.png"), StarBlue("star_blue.png"),
|
Node("node.png"), Web("web.png"), Guitar("guitar.png"), Scientist("scientist.png"), StarGrey("star_grey.png"), StarBlue("star_blue.png"),
|
||||||
JarBeanInto("jar_bean_into.png"), GraphEdgeDirected("graph_edge_directed.png"), LaserPointer("laserpointer.png"), TapeMeasure("tape_measure1.png"),
|
JarBeanInto("jar_bean_into.png"), GraphEdgeDirected("graph_edge_directed.png"), LaserPointer("laserpointer.png"), TapeMeasure("tape_measure1.png"),
|
||||||
Elements("elements1.png"), GraphNodes("graph_nodes.png"), User("user1.png"), FlexibleLeads("flexible_leads.png"), Pads("pads.png"), Lock("lock.png"),
|
Elements("elements1.png"), GraphNodes("graph_nodes.png"), User("user1.png"), FlexibleLeads("flexible_leads.png"), Pads("pads.png"), Lock("lock.png"),
|
||||||
Unlock("lock_open.png"), Earth("earth.png"), Loadline("loadline.png"), LoadlineAdd("loadline_add.png");
|
Unlock("lock_open.png"), Earth("earth.png"), Loadline("loadline.png"), LoadlineAdd("loadline_add.png"), SnapToGrid("snap_to_grid.png"),
|
||||||
|
SnapToComponents("snap_to_components.png"), SnapToNone("snap_to_none.png");
|
||||||
|
|
||||||
protected String name;
|
protected String name;
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 2.3 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 2.1 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 2.1 KiB |
@@ -36,7 +36,6 @@ import java.awt.event.ComponentAdapter;
|
|||||||
import java.awt.event.ComponentEvent;
|
import java.awt.event.ComponentEvent;
|
||||||
import java.awt.event.KeyEvent;
|
import java.awt.event.KeyEvent;
|
||||||
import java.awt.image.VolatileImage;
|
import java.awt.image.VolatileImage;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ public class ConfigPlugin implements IPlugIn {
|
|||||||
private static final String CONFIG_MENU = "Config";
|
private static final String CONFIG_MENU = "Config";
|
||||||
private static final String THEME_MENU = "Theme";
|
private static final String THEME_MENU = "Theme";
|
||||||
private static final String RULER_MENU = "Ruler Inch Subdivision...";
|
private static final String RULER_MENU = "Ruler Inch Subdivision...";
|
||||||
private static final String SNAP_MENU = "Snap To...";
|
private static final String SNAP_MENU = "Snap To";
|
||||||
private static final String COMPONENT_BROWSER_MENU = "Toolbox";
|
private static final String COMPONENT_BROWSER_MENU = "Toolbox";
|
||||||
public static final String COMPONENT_BROWSER = "componentBrowser";
|
public static final String COMPONENT_BROWSER = "componentBrowser";
|
||||||
public static final String SEARCHABLE_TREE = "Searchable Tree";
|
public static final String SEARCHABLE_TREE = "Searchable Tree";
|
||||||
|
|||||||
Reference in New Issue
Block a user