提交 b8d91c12 编写于 作者: D deathmarine

Store Font Size in Preferences.

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