Changeset 729


Ignore:
Timestamp:
01/21/14 11:59:05 (10 years ago)
Author:
jts21
Message:

Move ColorWheels to UserSettings, store them as new ArraySetting type that handles default values (so now ColorWheels have defaults if you unlink their setting)

Location:
trunk/src/org/expeditee
Files:
1 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/expeditee/gui/Frame.java

    r722 r729  
    5656        }
    5757
    58         public static Color[] COLOR_WHEEL = { new Color(235, 235, 235),
    59                         new Color(225, 225, 255), new Color(195, 255, 255),
    60                         new Color(225, 255, 225), new Color(255, 255, 195),
    61                         new Color(255, 225, 225), new Color(255, 195, 255), Color.WHITE,
    62                         Color.GRAY, Color.DARK_GRAY, Color.BLACK, null };
    63 
    6458        // The various attributes of this Frame
    6559        private String _frameset = null;
     
    152146
    153147        private void resetDot() {
    154                 _dotTemplate.setColor(Item.COLOR_WHEEL[1]);
    155                 _dotTemplate.setFillColor(Item.FILL_COLOR_WHEEL[0]);
     148                _dotTemplate.setColor(UserSettings.ColorWheel.get()[1]);
     149                _dotTemplate.setFillColor(UserSettings.FillColorWheel.get()[0]);
    156150        }
    157151
    158152        public void nextDot() {
    159153                _dotTemplate.setFillColor(ColorUtils.getNextColor(_dotTemplate
    160                                 .getFillColor(), Item.FILL_COLOR_WHEEL, null));
     154                                .getFillColor(), UserSettings.FillColorWheel.get(), null));
    161155                _dotTemplate.setColor(ColorUtils.getNextColor(_dotTemplate.getColor(),
    162                                 Item.COLOR_WHEEL, null));
     156                                UserSettings.ColorWheel.get(), null));
    163157
    164158                if (_dotTemplate.getColor() == null || _dotTemplate.getColor().equals(Color.white)) {
     
    18591853        public void toggleBackgroundColor() {
    18601854                setBackgroundColor(ColorUtils.getNextColor(_background,
    1861                                 Frame.COLOR_WHEEL, null));
     1855                                UserSettings.BackgroundColorWheel.get(), null));
    18621856        }
    18631857
  • trunk/src/org/expeditee/gui/FrameKeyboardActions.java

    r655 r729  
    17911791                        color = null;
    17921792                else
    1793                         color = ColorUtils.getNextColor(color, Item.FILL_COLOR_WHEEL, toSet
     1793                        color = ColorUtils.getNextColor(color, UserSettings.FillColorWheel.get(), toSet
    17941794                                        .getGradientColor());
    17951795
     
    18191819                        color = null;
    18201820                else
    1821                         color = ColorUtils.getNextColor(color, Item.COLOR_WHEEL, toSet
     1821                        color = ColorUtils.getNextColor(color, UserSettings.ColorWheel.get(), toSet
    18221822                                        .getFillColor());
    18231823
     
    19001900                        color = null;
    19011901                else if (setBackgroundColor) {
    1902                         color = ColorUtils.getNextColor(color, Item.FILL_COLOR_WHEEL, item
     1902                        color = ColorUtils.getNextColor(color, UserSettings.FillColorWheel.get(), item
    19031903                                        .getPaintColor());
    19041904                } else {
    1905                         color = ColorUtils.getNextColor(color, Item.COLOR_WHEEL,
     1905                        color = ColorUtils.getNextColor(color, UserSettings.ColorWheel.get(),
    19061906                                        currentFrame.getPaintBackgroundColor());
    19071907                }
  • trunk/src/org/expeditee/gui/FrameUtils.java

    r706 r729  
    14191419                                help.setFontStyle("Bold");
    14201420                                help.setFamily("SansSerif");
    1421                                 help.setColor(Item.COLOR_WHEEL[3]);
     1421                                help.setColor(UserSettings.ColorWheel.get()[3]);
    14221422
    14231423                                xPos += 25;
     
    14591459                                templates.setFontStyle("Bold");
    14601460                                templates.setFamily("SansSerif");
    1461                                 templates.setColor(Item.COLOR_WHEEL[3]);
     1461                                templates.setColor(UserSettings.ColorWheel.get()[3]);
    14621462                               
    14631463                                xPos += 25;
  • trunk/src/org/expeditee/items/Item.java

    r720 r729  
    129129       
    130130        public static final Color GREEN = Color.GREEN.darker();
    131 
    132         /**
    133          * The Colors cycled through when using function keys to set the Color of
    134          * this Item.
    135          */
    136         public static Color[] COLOR_WHEEL = { Color.BLACK, Color.RED, Color.BLUE,
    137                         Item.GREEN, Color.MAGENTA, Color.YELLOW.darker(), Color.WHITE };
    138 
    139         // TODO Have shift toggle through a black and white color wheel?
    140         public static Color[] FILL_COLOR_WHEEL = { new Color(255, 150, 150),
    141                         new Color(150, 150, 255), new Color(150, 255, 150),
    142                         new Color(255, 150, 255), new Color(255, 255, 100), Color.WHITE,
    143                         Color.BLACK };
    144131
    145132        public static final int UNCHANGED_CURSOR = -100;
  • trunk/src/org/expeditee/items/widgets/charts/AbstractChart.java

    r410 r729  
    2727import org.expeditee.items.Text;
    2828import org.expeditee.items.widgets.DataFrameWidget;
     29import org.expeditee.settings.UserSettings;
    2930import org.jfree.chart.ChartPanel;
    3031import org.jfree.chart.JFreeChart;
     
    109110                                                        Color newColor = ColorUtils.getNextColor(
    110111                                                                        getSource().getFillColor(),
    111                                                                         Frame.COLOR_WHEEL, null);
     112                                                                        UserSettings.BackgroundColorWheel.get(), null);
    112113                                                        setSourceFillColor(newColor);
    113114                                                }
     
    117118                                                } else {
    118119                                                        Color newColor = ColorUtils.getNextColor(
    119                                                                         getSource().getColor(), Item.COLOR_WHEEL,
     120                                                                        getSource().getColor(), UserSettings.ColorWheel.get(),
    120121                                                                        null);
    121122                                                        setSourceColor(newColor);
  • trunk/src/org/expeditee/settings/UserSettings.java

    r717 r729  
    66import java.io.IOException;
    77import java.util.ArrayList;
     8import java.util.Arrays;
    89import java.util.LinkedList;
    910import java.util.List;
     
    2223import org.expeditee.items.ItemUtils;
    2324import org.expeditee.items.Text;
     25import org.expeditee.setting.ArraySetting;
    2426import org.expeditee.setting.BooleanSetting;
    2527import org.expeditee.setting.FloatSetting;
     
    289291         * Colorwheels
    290292         */
    291         public static final FrameSetting ColorWheel = new FrameSetting("The colours of items in the child frame are used to populate the colour wheel") {
    292                 @Override
    293                 protected void run(Frame frame) {
    294                         Item.COLOR_WHEEL = FrameUtils.getColorWheel(frame);
    295                 }
    296         };
    297        
    298         public static final FrameSetting FillColorWheel = new FrameSetting("The colours of items in the child frame are used to populate the colour wheel") {
    299                 @Override
    300                 protected void run(Frame frame) {
    301                         Item.FILL_COLOR_WHEEL = FrameUtils.getColorWheel(frame);
    302                 }
    303         };
    304        
    305         public static final FrameSetting BackgroundColorWheel = new FrameSetting("The colours of items in the child frame are used to populate the colour wheel") {
    306                 @Override
    307                 protected void run(Frame frame) {
    308                         Frame.COLOR_WHEEL = FrameUtils.getColorWheel(frame);
     293        public static final ArraySetting<Color> ColorWheel = new ArraySetting<Color>("The colours of items in the child frame are used to populate the colour wheel",
     294                        new Color[] { Color.BLACK, Color.RED, Color.BLUE, Item.GREEN, Color.MAGENTA, Color.YELLOW.darker(), Color.WHITE }) {
     295                @Override
     296                public boolean setSetting(Text text) {
     297                        Frame child = text.getChild();
     298                if (child == null) {
     299                        return false;
     300                }
     301                _value = FrameUtils.getColorWheel(child);
     302                return true;
     303                }
     304        };
     305       
     306        public static final ArraySetting<Color> FillColorWheel = new ArraySetting<Color>("The colours of items in the child frame are used to populate the colour wheel",
     307                        new Color[] { new Color(255, 150, 150), new Color(150, 150, 255), new Color(150, 255, 150),
     308                        new Color(255, 150, 255), new Color(255, 255, 100), Color.WHITE, Color.BLACK }) {
     309                @Override
     310                public boolean setSetting(Text text) {
     311                        Frame child = text.getChild();
     312                if (child == null) {
     313                        return false;
     314                }
     315                _value = FrameUtils.getColorWheel(child);
     316                return true;
     317                }
     318        };
     319       
     320        public static final ArraySetting<Color> BackgroundColorWheel = new ArraySetting<Color>("The colours of items in the child frame are used to populate the colour wheel",
     321                        new Color[] { new Color(235, 235, 235), new Color(225, 225, 255), new Color(195, 255, 255),
     322                        new Color(225, 255, 225), new Color(255, 255, 195), new Color(255, 225, 225),
     323                        new Color(255, 195, 255), Color.WHITE, Color.GRAY, Color.DARK_GRAY, Color.BLACK, null }) {
     324                @Override
     325                public boolean setSetting(Text text) {
     326                        Frame child = text.getChild();
     327                if (child == null) {
     328                        return false;
     329                }
     330                _value = FrameUtils.getColorWheel(child);
     331                return true;
    309332                }
    310333        };
Note: See TracChangeset for help on using the changeset viewer.