Changeset 717


Ignore:
Timestamp:
01/17/14 18:22:43 (10 years ago)
Author:
jts21
Message:

Changes to settings tree generation, and added vertical/horizontal format help text. Also some commented out code from an attempt to fix XGroupItem ignoring nested rectangles in rectangles reached by an arrow (didn't get anywhere with that)

Location:
trunk/src/org/expeditee
Files:
5 edited

Legend:

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

    r703 r717  
    539539
    540540        public Text getCodeCommentTemplate() {
    541                 Text t = getTemplate(UserSettings.CodeCommentTemplate.get(),
     541                Text t = getTemplate(UserSettings.CommentTemplate.get(),
    542542                                ItemUtils.TAG_CODE_COMMENT_TEMPLATE);
    543543
  • trunk/src/org/expeditee/gui/Help.java

    r712 r717  
    117117                case polygon:
    118118                case background:
    119                         return "Auto format";
     119                        if((mod & control) != 0) return "Horizontal format";
     120                        return "Vertical format";
    120121                }
    121122        }
  • trunk/src/org/expeditee/io/flowlayout/XGroupItem.java

    r714 r717  
    135135                this.raw_text_item_list  = imprint.raw_text_item_list;
    136136                this.grouped_item_list   = imprint.grouped_item_list;
     137               
     138//              int offX = imprint.getBoundingRect().x - copy_to_bounding_rect.x;
     139//              int offY = imprint.getBoundingRect().y - copy_to_bounding_rect.y;
     140//              this.grouped_item_list   = new ArrayList<XGroupItem>();
     141//              for(XGroupItem newChild : imprint.grouped_item_list) {
     142//                      Rectangle newRect = newChild.getBoundingRect();
     143//                      newRect.x -= offX;
     144//                      newRect.y -= offY;
     145//                      this.grouped_item_list.add(new XGroupItem(newChild, newRect));
     146//              }
    137147                this.remaining_item_list = imprint.remaining_item_list;
    138148               
  • trunk/src/org/expeditee/settings/Settings.java

    r679 r717  
    208208                                        }
    209209                                }
     210                                int x = 0, y = 0;
    210211                                Text t;
    211212                                if(key.equals("pass")) {
     
    215216                                        frames.getCurrentFrame().removeItem(t);
    216217                                        frames.getCurrentFrame().addAllItems(pw.getItems());
    217                                 } else if(s instanceof GenericSetting && ((GenericSetting) s).getType().equals(Text.class)) {
    218                                         t = ((GenericSetting<Text>) s).get();
    219                                         if(t == null) {
    220                                                 System.err.println("Failed to get Text setting \"" + str + "\"");
    221                                                 continue;
    222                                         }
    223                                         t = t.copy();
    224                                         t.setID(frames.getCurrentFrame().getNextItemID());
    225                                         t.setText(name);
    226                                         frames.addItem(t, false);
     218                                        x = pw.getX() + pw.getWidth();
     219                                        y = pw.getY();
    227220                                } else {
    228                                         t = frames.addText(name + value, null, null, null, false);
    229                                 }
    230                                 Text tt = frames.getCurrentFrame().addText(450, t.getY(), "// " + s.getTooltip(), null);
    231                                 tt.setWidth(550);
     221                                        if(s instanceof GenericSetting && ((GenericSetting) s).getType().equals(Text.class)) {
     222                                        t = ((GenericSetting<Text>) s).get();
     223                                        if(t == null) {
     224                                                System.err.println("Failed to get Text setting \"" + str + "\"");
     225                                                continue;
     226                                        }
     227                                        t = t.copy();
     228                                        t.setID(frames.getCurrentFrame().getNextItemID());
     229                                        t.setText(name);
     230                                        frames.addItem(t, false);
     231                                } else {
     232                                        t = frames.addText(name + value, null, null, null, false);
     233                                }
     234                                        x = t.getX() + t.getBoundsWidth();
     235                                        y = t.getY();
     236                                }
     237                                x = Math.max(250, x + 20);
     238                                Text tt = frames.getCurrentFrame().addText(x, y, "// " + s.getTooltip(), null);
    232239                                // rebuild to get the correct height since setWidth() doesn't immediately rebuild
    233240                                tt.rebuild(true);
  • trunk/src/org/expeditee/settings/UserSettings.java

    r706 r717  
    4141        public final static String DEFAULT_PROFILE_NAME = "default";
    4242       
    43         /*
    44          * General settings (no setter functions)
    45          */
    46        
    47         public static final FloatSetting ScaleFactor = new FloatSetting("Scale Factor for drawing (TODO: does this even do anything?)", 1F);
    48        
    49         public static final FloatSetting FormatSpacingMin = new FloatSetting("Minimum spacing ratio", null);
    50        
    51         public static final FloatSetting FormatSpacingMax = new FloatSetting("Maximum spacing ratio", null);
    52        
    5343        public static final IntegerSetting Gravity = new IntegerSetting("Distance the cursor has to be from a text item to select the text item", 3);
    54 
    55         public static final IntegerSetting LineStraightenThreshold = new IntegerSetting("Threshold for straightening a line (TODO: does this even do anything?)", 15);
    56 
    57         public static final IntegerSetting NoOpThreshold = new IntegerSetting("Distance the cursor may be dragged while clicking before the operation is cancelled", 60);
    58        
    59         public static final IntegerSetting TitlePosition = new IntegerSetting("Position of title item in frame (TODO: find whether this is x-offset or y-offset)", 150);
    60        
    61         public static final IntegerSetting InitialWidth = new IntegerSetting("Initial width of Expeditee window", 1024);
    62        
    63         public static final IntegerSetting InitialHeight = new IntegerSetting("Initial height of Expeditee window", 768);
    64        
    65         public static final StringSetting ProfileName = new StringSetting("Profile name", FrameIO.ConvertToValidFramesetName(System.getProperty("user.name")));
    66        
    67         public static final StringSetting UserName = new StringSetting("User name", ProfileName.get());
    68        
    69         public static final BooleanSetting AntiAlias = new BooleanSetting("Whether anti-aliasing should be enabled", false);
    70 
    71         public static final BooleanSetting LineHighlight = new BooleanSetting("Whether lines should be highlighted", false);
    72 
    73         public static final BooleanSetting Logging = new BooleanSetting("Whether logging should be enabled", false);
    74 
    75         public static final BooleanSetting LogStats = new BooleanSetting("Whether stats should be logged", true);
    76 
    77         public static final BooleanSetting Threading = new BooleanSetting("Whether threading should be enabled", true);
    78        
    79        
    80         /*
    81          * Frames
    82          */
    83         public static final StringSetting DefaultFrame = new StringSetting("The default frame", null) {
    84                 @Override
    85                 public boolean setSetting(Text text) {
    86                         _value = FrameUtils.getLink(text, _value);
    87                         return true;
    88                 }
    89         };
    90        
    91         public static final StringSetting StatisticsFrameset = new StringSetting("The statistics frameset", null);
    92 
    93         public static final StringSetting MenuFrame = new StringSetting("The menu frame", null);
    94 
     44       
     45        /*
     46         * Stuff that goes first
     47         */
    9548        public static final StringSetting HomeFrame = new StringSetting("The home frame", null) {
    9649                @Override
     
    11366                }
    11467        };
     68        public static final StringSetting DefaultFrame = new StringSetting("The default frame", null) {
     69                @Override
     70                public boolean setSetting(Text text) {
     71                        _value = FrameUtils.getLink(text, _value);
     72                        return true;
     73                }
     74        };
     75        public static final IntegerSetting InitialWidth = new IntegerSetting("Initial width of Expeditee window", 1024);
     76       
     77        public static final IntegerSetting InitialHeight = new IntegerSetting("Initial height of Expeditee window", 768);
     78       
     79        public static final TextSetting ItemTemplate = new TextSetting("Template for normal text items") {
     80                @Override
     81                public boolean setSetting(Text text) {
     82                        _value = text.getTemplateForm();
     83                        return true;
     84                }
     85               
     86                @Override
     87                public Text generateText() {
     88                        return new Text("ItemTemplate");
     89                }
     90        };
     91        public static final TextSetting AnnotationTemplate = new TextSetting("Template for annotation text items") {
     92                @Override
     93                public boolean setSetting(Text text) {
     94                        _value = text.getTemplateForm();
     95                        return true;
     96                }
     97                @Override
     98                public Text generateText() {
     99                        Text t = new Text("AnnotationTemplate");
     100                t.setColor(Color.gray);
     101                return t;
     102                }
     103        };
     104
     105        public static final TextSetting CommentTemplate = new TextSetting("Template for code comment text items") {
     106                @Override
     107                public boolean setSetting(Text text) {
     108                        _value = text.getTemplateForm();
     109                        return true;
     110                }
     111                @Override
     112                public Text generateText() {
     113                        Text t = new Text("CommentTemplate");
     114                t.setColor(Color.green.darker());
     115                return t;
     116                }
     117        };
     118
     119        public static final TextSetting StatTemplate = new TextSetting("Template for statistics (e.g. extracted attributes) text items") {
     120                @Override
     121                public boolean setSetting(Text text) {
     122                        _value = text.getTemplateForm();
     123                        return true;
     124                }
     125                @Override
     126                public Text generateText() {
     127                        Text t = new Text("StatsTemplate");
     128                t.setColor(Color.BLACK);
     129                t.setBackgroundColor(new Color(0.9F, 0.9F, 0.9F));
     130                t.setFamily(Text.MONOSPACED_FONT);
     131                t.setSize(14);
     132                return t;
     133                }
     134        };
     135       
     136        /*
     137         * General settings (no setter functions)
     138         */
     139       
     140        public static final FloatSetting ScaleFactor = new FloatSetting("Scale Factor for drawing (TODO: does this even do anything?)", 1F);
     141       
     142        public static final FloatSetting FormatSpacingMin = new FloatSetting("Minimum spacing ratio", null);
     143       
     144        public static final FloatSetting FormatSpacingMax = new FloatSetting("Maximum spacing ratio", null);
     145
     146        public static final IntegerSetting LineStraightenThreshold = new IntegerSetting("Threshold for straightening a line (TODO: does this even do anything?)", 15);
     147
     148        public static final IntegerSetting NoOpThreshold = new IntegerSetting("Distance the cursor may be dragged while clicking before the operation is cancelled", 60);
     149       
     150        public static final IntegerSetting TitlePosition = new IntegerSetting("Position of title item in frame (TODO: find whether this is x-offset or y-offset)", 150);
     151       
     152        public static final StringSetting ProfileName = new StringSetting("Profile name", FrameIO.ConvertToValidFramesetName(System.getProperty("user.name")));
     153       
     154        public static final StringSetting UserName = new StringSetting("User name", ProfileName.get());
     155       
     156        public static final BooleanSetting AntiAlias = new BooleanSetting("Whether anti-aliasing should be enabled", false);
     157
     158        public static final BooleanSetting LineHighlight = new BooleanSetting("Whether lines should be highlighted", false);
     159
     160        public static final BooleanSetting Logging = new BooleanSetting("Whether logging should be enabled", false);
     161
     162        public static final BooleanSetting LogStats = new BooleanSetting("Whether stats should be logged", true);
     163
     164        public static final BooleanSetting Threading = new BooleanSetting("Whether threading should be enabled", true);
     165       
     166       
     167        /*
     168         * Frames
     169         */
     170       
     171        public static final StringSetting StatisticsFrameset = new StringSetting("The statistics frameset", null);
     172
     173        public static final StringSetting MenuFrame = new StringSetting("The menu frame", null);
    115174
    116175        /*
     
    197256        };
    198257       
    199         public static final TextSetting ItemTemplate = new TextSetting("Template for normal text items") {
     258        public static final TextSetting DotTemplate = new TextSetting("Template for dot items") {
    200259                @Override
    201260                public boolean setSetting(Text text) {
     
    206265                @Override
    207266                public Text generateText() {
    208                         return new Text("ItemTemplate");
    209                 }
    210         };
    211        
    212         public static final TextSetting DotTemplate = new TextSetting("Template for dot items") {
    213                 @Override
    214                 public boolean setSetting(Text text) {
    215                         _value = text.getTemplateForm();
    216                         return true;
    217                 }
    218                
    219                 @Override
    220                 public Text generateText() {
    221267                        return new Text("DotTemplate");
    222                 }
    223         };
    224 
    225         public static final TextSetting AnnotationTemplate = new TextSetting("Template for annotation text items") {
    226                 @Override
    227                 public boolean setSetting(Text text) {
    228                         _value = text.getTemplateForm();
    229                         return true;
    230                 }
    231                 @Override
    232                 public Text generateText() {
    233                         Text t = new Text("AnnotationTemplate");
    234                 t.setColor(Color.gray);
    235                 return t;
    236                 }
    237         };
    238 
    239         public static final TextSetting CodeCommentTemplate = new TextSetting("Template for code comment text items") {
    240                 @Override
    241                 public boolean setSetting(Text text) {
    242                         _value = text.getTemplateForm();
    243                         return true;
    244                 }
    245                 @Override
    246                 public Text generateText() {
    247                         Text t = new Text("CommentTemplate");
    248                 t.setColor(Color.green.darker());
    249                 return t;
    250                 }
    251         };
    252 
    253         public static final TextSetting StatTemplate = new TextSetting("Template for statistics (e.g. extracted attributes) text items") {
    254                 @Override
    255                 public boolean setSetting(Text text) {
    256                         _value = text.getTemplateForm();
    257                         return true;
    258                 }
    259                 @Override
    260                 public Text generateText() {
    261                         Text t = new Text("StatsTemplate");
    262                 t.setColor(Color.BLACK);
    263                 t.setBackgroundColor(new Color(0.9F, 0.9F, 0.9F));
    264                 t.setFamily(Text.MONOSPACED_FONT);
    265                 t.setSize(14);
    266                 return t;
    267268                }
    268269        };
Note: See TracChangeset for help on using the changeset viewer.