提交 b8d91c12 编写于 作者: D deathmarine

Store Font Size in Preferences.

Addresses #131,#53
上级 223d58e6
...@@ -288,6 +288,25 @@ ...@@ -288,6 +288,25 @@
<ignore></ignore> <ignore></ignore>
</action> </action>
</pluginExecution> </pluginExecution>
<pluginExecution>
<pluginExecutionFilter>
<groupId>
com.googlecode.maven-download-plugin
</groupId>
<artifactId>
download-maven-plugin
</artifactId>
<versionRange>
[1.3.0,)
</versionRange>
<goals>
<goal>wget</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore></ignore>
</action>
</pluginExecution>
</pluginExecutions> </pluginExecutions>
</lifecycleMappingMetadata> </lifecycleMappingMetadata>
</configuration> </configuration>
......
...@@ -14,6 +14,7 @@ public class LuytenPreferences { ...@@ -14,6 +14,7 @@ public class LuytenPreferences {
private String themeXml = DEFAULT_THEME_XML; private String themeXml = DEFAULT_THEME_XML;
private String fileOpenCurrentDirectory = ""; private String fileOpenCurrentDirectory = "";
private String fileSaveCurrentDirectory = ""; private String fileSaveCurrentDirectory = "";
private int font_size = 10;
private boolean isPackageExplorerStyle = true; private boolean isPackageExplorerStyle = true;
private boolean isFilterOutInnerClassEntries = true; private boolean isFilterOutInnerClassEntries = true;
...@@ -75,4 +76,12 @@ public class LuytenPreferences { ...@@ -75,4 +76,12 @@ public class LuytenPreferences {
public void setExitByEscEnabled(boolean isExitByEscEnabled) { public void setExitByEscEnabled(boolean isExitByEscEnabled) {
this.isExitByEscEnabled = isExitByEscEnabled; this.isExitByEscEnabled = isExitByEscEnabled;
} }
public int getFont_size() {
return font_size;
}
public void setFont_size(int font_size) {
this.font_size = font_size;
}
} }
...@@ -73,6 +73,9 @@ public class OpenFile implements SyntaxConstants { ...@@ -73,6 +73,9 @@ public class OpenFile implements SyntaxConstants {
RSyntaxTextArea textArea; RSyntaxTextArea textArea;
String name; String name;
String path; String path;
private ConfigSaver configSaver;
private LuytenPreferences luytenPrefs;
// decompiler and type references (not needed for text files) // decompiler and type references (not needed for text files)
private MetadataSystem metadataSystem; private MetadataSystem metadataSystem;
...@@ -84,6 +87,10 @@ public class OpenFile implements SyntaxConstants { ...@@ -84,6 +87,10 @@ public class OpenFile implements SyntaxConstants {
this.name = name; this.name = name;
this.path = path; this.path = path;
this.mainWindow = mainWindow; this.mainWindow = mainWindow;
configSaver = ConfigSaver.getLoadedInstance();
luytenPrefs = configSaver.getLuytenPreferences();
textArea = new RSyntaxTextArea(25, 70); textArea = new RSyntaxTextArea(25, 70);
textArea.setCaretPosition(0); textArea.setCaretPosition(0);
textArea.requestFocusInWindow(); textArea.requestFocusInWindow();
...@@ -149,15 +156,19 @@ public class OpenFile implements SyntaxConstants { ...@@ -149,15 +156,19 @@ public class OpenFile implements SyntaxConstants {
fontChooser.setSelectedFont(textArea.getFont()); fontChooser.setSelectedFont(textArea.getFont());
fontChooser.setSelectedFontSize(textArea.getFont().getSize()); fontChooser.setSelectedFontSize(textArea.getFont().getSize());
int result = fontChooser.showDialog(mainWindow); int result = fontChooser.showDialog(mainWindow);
if (result == JFontChooser.OK_OPTION) if (result == JFontChooser.OK_OPTION) {
textArea.setFont(fontChooser.getSelectedFont()); textArea.setFont(fontChooser.getSelectedFont());
luytenPrefs.setFont_size(fontChooser.getSelectedFontSize());
}
} }
}); });
pop.add(item); pop.add(item);
textArea.setPopupMenu(pop); textArea.setPopupMenu(pop);
theme.apply(textArea); theme.apply(textArea);
textArea.setFont(new Font(textArea.getFont().getName(), textArea.getFont().getStyle(), luytenPrefs.getFont_size()));
scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
final JScrollBar verticalScrollbar = scrollPane.getVerticalScrollBar(); final JScrollBar verticalScrollbar = scrollPane.getVerticalScrollBar();
if (verticalScrollbar != null) { if (verticalScrollbar != null) {
...@@ -225,6 +236,7 @@ public class OpenFile implements SyntaxConstants { ...@@ -225,6 +236,7 @@ public class OpenFile implements SyntaxConstants {
} else { } else {
textArea.setFont(new Font(font.getName(), font.getStyle(), ++size)); textArea.setFont(new Font(font.getName(), font.getStyle(), ++size));
} }
luytenPrefs.setFont_size(size);
} else { } else {
if (scrollPane.isWheelScrollingEnabled() && e.getWheelRotation() != 0) { if (scrollPane.isWheelScrollingEnabled() && e.getWheelRotation() != 0) {
JScrollBar toScroll = scrollPane.getVerticalScrollBar(); JScrollBar toScroll = scrollPane.getVerticalScrollBar();
...@@ -373,6 +385,7 @@ public class OpenFile implements SyntaxConstants { ...@@ -373,6 +385,7 @@ public class OpenFile implements SyntaxConstants {
} }
} }
} }
e.consume(); e.consume();
} }
}); });
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册