Ignore:
Timestamp:
12/05/13 01:20:30 (11 years ago)
Author:
jts21
Message:

Add the capability to use setter functions that will be called to set a setting.
Moved some stuff over to use this already (colorwheel and homeframe) to test that it works.
This means it should now be possible to add new user configurable settings by simply defining a function or a field in a settings class (the class structure corresponds to the page structure).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/expeditee/settings/UserSettings.java

    r570 r571  
    11package org.expeditee.settings;
    22
     3import java.awt.Color;
    34import java.io.File;
    45import java.util.LinkedList;
    56import java.util.List;
    67
     8import org.expeditee.gui.Frame;
    79import org.expeditee.gui.FrameIO;
     10import org.expeditee.gui.FrameUtils;
     11import org.expeditee.items.Item;
    812import org.expeditee.items.Text;
    913
     
    4448
    4549        public static String HomeFrame = null;
     50        public static void setHomeFrame(Text t) {
     51                String first = FrameUtils.getLink(t, UserSettings.HomeFrame);
     52                // do not use non-existant frames as the first frame
     53                if (FrameIO.isValidFrameName(first)) {
     54                        UserSettings.HomeFrame = first;
     55                }
     56                // warn the user
     57                else {
     58                        // MessageBay.warningMessage("Home frame: " + first
     59                        // + " is not a valid frame.");
     60                        UserSettings.HomeFrame = FrameIO.LoadProfile(UserSettings.ProfileName).getName();
     61                }
     62        }
    4663
    4764        public static List<String> FrameDirs = new LinkedList<String>();
     
    7087
    7188        public static Text StatTemplate = null;
     89       
     90        public static void setColorWheel(Text t) {
     91                Item.COLOR_WHEEL = FrameUtils.getColorWheel(t);
     92        }
     93       
     94        public static void setFillColorWheel(Text t) {
     95                Item.FILL_COLOR_WHEEL = FrameUtils.getColorWheel(t);
     96        }
     97       
     98        public static void setBackgroundColorWheel(Text t) {
     99                Frame.COLOR_WHEEL = FrameUtils.getColorWheel(t);
     100        }
    72101       
    73102        // add default values
Note: See TracChangeset for help on using the changeset viewer.