Advertisement
Guest User

Untitled

a guest
Jul 17th, 2015
698
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 6.25 KB | None | 0 0
  1. --- Base.java   Thu Jul 16 07:20:16 2015
  2. +++ Base.java   Thu Jul 16 21:35:24 2015
  3. @@ -1734,9 +1734,11 @@
  4.          g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
  5.                  RenderingHints.VALUE_TEXT_ANTIALIAS_OFF);
  6.  
  7. -        g.setFont(new Font("SansSerif", Font.PLAIN, 11));
  8. +        int scale = Theme.getInteger("gui.scalePercent");
  9. +        Font f = new Font("SansSerif", Font.PLAIN, 11 * scale / 100);
  10. +        g.setFont(f);
  11.          g.setColor(Color.white);
  12. -        g.drawString(BaseNoGui.VERSION_NAME_LONG, 33, 20);
  13. +        g.drawString(BaseNoGui.VERSION_NAME_LONG, 33 * scale / 100, 20 * scale / 100);
  14.        }
  15.      };
  16.      window.addMouseListener(new MouseAdapter() {
  17. @@ -2038,6 +2040,9 @@
  18.    static public Image getLibImage(String name, Component who) {
  19.      Toolkit tk = Toolkit.getDefaultToolkit();
  20.  
  21. +    int scale = Theme.getInteger("gui.scalePercent");
  22. +    // TODO: create high-res enlarged copies and load those if
  23. +    //       the scale is more than 125%  
  24.      File imageLocation = new File(getContentFile("lib"), name);
  25.      Image image = tk.getImage(imageLocation.getAbsolutePath());
  26.      MediaTracker tracker = new MediaTracker(who);
  27. @@ -2045,6 +2050,15 @@
  28.      try {
  29.        tracker.waitForAll();
  30.      } catch (InterruptedException e) {
  31. +    }
  32. +    if (scale != 100) {
  33. +      int width = image.getWidth(null) * scale / 100;
  34. +      int height = image.getHeight(null) * scale / 100;
  35. +      image = image.getScaledInstance(width, height, Image.SCALE_SMOOTH);
  36. +      tracker.addImage(image, 1);
  37. +      try {
  38. +        tracker.waitForAll();
  39. +      } catch (InterruptedException e) { }
  40.      }
  41.      return image;
  42.    }
  43. --- EditorHeader.java   Thu Jul 16 07:20:16 2015
  44. +++ EditorHeader.java   Thu Jul 16 21:38:13 2015
  45. @@ -68,6 +68,8 @@
  46.    static final int MENU = 3;
  47.  
  48.    static final int PIECE_WIDTH = 4;
  49. +  // value for the size bars, buttons, etc
  50. +  static final int GRID_SIZE = 33 * Theme.getInteger("gui.scalePercent") / 100;
  51.  
  52.    static Image[][] pieces;
  53.  
  54. @@ -383,16 +385,16 @@
  55.  
  56.    public Dimension getMinimumSize() {
  57.      if (OSUtils.isMacOS()) {
  58. -      return new Dimension(300, Preferences.GRID_SIZE);
  59. +      return new Dimension(300, GRID_SIZE);
  60.      }
  61. -    return new Dimension(300, Preferences.GRID_SIZE - 1);
  62. +    return new Dimension(300, GRID_SIZE - 1);
  63.    }
  64.  
  65.  
  66.    public Dimension getMaximumSize() {
  67.      if (OSUtils.isMacOS()) {
  68. -      return new Dimension(3000, Preferences.GRID_SIZE);
  69. +      return new Dimension(3000, GRID_SIZE);
  70.      }
  71. -    return new Dimension(3000, Preferences.GRID_SIZE - 1);
  72. +    return new Dimension(3000, GRID_SIZE - 1);
  73.    }
  74.  }
  75. --- EditorLineStatus.java   Thu Jul 16 07:20:16 2015
  76. +++ EditorLineStatus.java   Thu Jul 16 21:39:14 2015
  77. @@ -57,7 +57,7 @@
  78.      background = Theme.getColor("linestatus.bgcolor");
  79.      font = Theme.getFont("linestatus.font");
  80.      foreground = Theme.getColor("linestatus.color");
  81. -    high = Theme.getInteger("linestatus.height");
  82. +    high = Theme.getInteger("linestatus.height") * Theme.getInteger("gui.scalePercent") / 100;
  83.  
  84.      if (OSUtils.isMacOS()) {
  85.        resize = Base.getThemeImage("resize.gif", this);
  86. --- EditorStatus.java   Thu Jul 16 07:20:16 2015
  87. +++ EditorStatus.java   Thu Jul 16 21:40:54 2015
  88. @@ -45,6 +45,8 @@
  89.    private static final int EDIT = 2;
  90.    private static final int PROGRESS = 5;
  91.    private static final String NO_MESSAGE = "";
  92. +  //value for the size bars, buttons, etc
  93. +  static final int GRID_SIZE = 33 * Theme.getInteger("gui.scalePercent") / 100;
  94.  
  95.    private static final Color[] BGCOLOR;
  96.    private static final Color[] FGCOLOR;
  97. @@ -394,11 +396,11 @@
  98.    }
  99.  
  100.    public Dimension getMinimumSize() {
  101. -    return new Dimension(300, Preferences.GRID_SIZE);
  102. +    return new Dimension(300, GRID_SIZE);
  103.    }
  104.  
  105.    public Dimension getMaximumSize() {
  106. -    return new Dimension(3000, Preferences.GRID_SIZE);
  107. +    return new Dimension(3000, GRID_SIZE);
  108.    }
  109.  
  110.    public boolean isErr() {
  111. --- EditorToolbar.java  Thu Jul 16 07:20:16 2015
  112. +++ EditorToolbar.java  Thu Jul 16 21:42:06 2015
  113. @@ -56,19 +56,19 @@
  114.    /**
  115.     * Width of each toolbar button.
  116.     */
  117. -  private static final int BUTTON_WIDTH = 27;
  118. +  private static final int BUTTON_WIDTH = 27 * Theme.getInteger("gui.scalePercent") / 100;
  119.    /**
  120.     * Height of each toolbar button.
  121.     */
  122. -  private static final int BUTTON_HEIGHT = 32;
  123. +  private static final int BUTTON_HEIGHT = 32 * Theme.getInteger("gui.scalePercent") / 100;
  124.    /**
  125.     * The amount of space between groups of buttons on the toolbar.
  126.     */
  127. -  private static final int BUTTON_GAP = 5;
  128. +  private static final int BUTTON_GAP = 5 * Theme.getInteger("gui.scalePercent") / 100;
  129.    /**
  130.     * Size of the button image being chopped up.
  131.     */
  132. -  private static final int BUTTON_IMAGE_SIZE = 33;
  133. +  private static final int BUTTON_IMAGE_SIZE = 33 * Theme.getInteger("gui.scalePercent") / 100;
  134.  
  135.  
  136.    private static final int RUN = 0;
  137. @@ -437,7 +437,7 @@
  138.  
  139.  
  140.    public Dimension getMaximumSize() {
  141. -    return new Dimension(3000, BUTTON_HEIGHT);
  142. +    return new Dimension(3000 * Theme.getInteger("gui.scalePercent") / 100, BUTTON_HEIGHT);
  143.    }
  144.  
  145.  
  146. --- Preferences.java    Thu Jul 16 07:20:16 2015
  147. +++ Preferences.java    Thu Jul 16 21:42:54 2015
  148. @@ -73,11 +73,6 @@
  149.     */
  150.    static public int BUTTON_HEIGHT = 24;
  151.  
  152. -  // value for the size bars, buttons, etc
  153. -
  154. -  static final int GRID_SIZE = 33;
  155. -
  156. -
  157.    // indents and spacing standards. these probably need to be modified
  158.    // per platform as well, since macosx is so huge, windows is smaller,
  159.    // and linux is all over the map
  160. --- Theme.java  Thu Jul 16 07:20:16 2015
  161. +++ Theme.java  Thu Jul 16 21:44:20 2015
  162. @@ -109,6 +109,10 @@
  163.        set(attr, value);
  164.        font = PreferencesHelper.getFont(table, attr);
  165.      }
  166. +    int scale = getInteger("gui.scalePercent");
  167. +    if (scale != 100) {
  168. +      font = font.deriveFont((float)(font.getSize()) * (float)scale / (float)100.0);
  169. +    }
  170.      return font;
  171.    }
  172.  
  173.  
  174. --- theme.txt   Thu Jul 16 07:20:16 2015
  175. +++ theme.txt   Thu Jul 16 21:44:18 2015
  176. @@ -1,3 +1,6 @@
  177. +# GUI - Scaling, edit this to scale to higher dots-per-inch displays
  178. +gui.scalePercent = 100
  179. +
  180.  #FUNCTIONS COLOR           #D35400 - ORANGE            KEYWORD1
  181.  #FUNCTIONS COLOR           #D35400 - ORANGE            KEYWORD2
  182.  #STRUCTURE COLORS          #5E6D03 - GREEN         KEYWORD3
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement