Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
J
jadx
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open-source
jadx
Commits
7b264ef2
Commit
7b264ef2
authored
Mar 16, 2015
by
Skylot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gui: add font selection dialog
parent
5a6600f7
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
82 additions
and
0 deletions
+82
-0
NOTICE
NOTICE
+1
-0
build.gradle
jadx-gui/build.gradle
+1
-0
jfontchooser-1.0.5.jar
jadx-gui/libs/jfontchooser-1.0.5.jar
+0
-0
JadxSettings.java
jadx-gui/src/main/java/jadx/gui/settings/JadxSettings.java
+29
-0
JadxSettingsWindow.java
...i/src/main/java/jadx/gui/settings/JadxSettingsWindow.java
+26
-0
ContentArea.java
jadx-gui/src/main/java/jadx/gui/ui/ContentArea.java
+7
-0
MainWindow.java
jadx-gui/src/main/java/jadx/gui/ui/MainWindow.java
+10
-0
TabbedPane.java
jadx-gui/src/main/java/jadx/gui/ui/TabbedPane.java
+6
-0
Messages_en_US.properties
jadx-gui/src/main/resources/i18n/Messages_en_US.properties
+2
-0
No files found.
NOTICE
View file @
7b264ef2
...
...
@@ -178,3 +178,4 @@ Icons copied from several places:
- Eclipse Project (JDT UI) - licensed under EPL v1.0 (http://www.eclipse.org/legal/epl-v10.html)
- famfamfam silk icon set (http://www.famfamfam.com/lab/icons/silk/) - licensed under Creative Commons Attribution 2.5 License (http://creativecommons.org/licenses/by/2.5/)
JFontChooser Component - http://sourceforge.jp/projects/jfontchooser/
jadx-gui/build.gradle
View file @
7b264ef2
...
...
@@ -7,6 +7,7 @@ dependencies {
compile
(
project
(
":jadx-cli"
))
compile
'com.fifesoft:rsyntaxtextarea:2.5.6'
compile
'com.google.code.gson:gson:2.3.1'
compile
files
(
'libs/jfontchooser-1.0.5.jar'
)
}
applicationDistribution
.
with
{
...
...
jadx-gui/libs/jfontchooser-1.0.5.jar
0 → 100644
View file @
7b264ef2
File added
jadx-gui/src/main/java/jadx/gui/settings/JadxSettings.java
View file @
7b264ef2
...
...
@@ -2,6 +2,8 @@ package jadx.gui.settings;
import
jadx.cli.JadxCLIArgs
;
import
javax.swing.JLabel
;
import
java.awt.Font
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.HashSet
;
...
...
@@ -13,6 +15,8 @@ public class JadxSettings extends JadxCLIArgs {
private
static
final
String
USER_HOME
=
System
.
getProperty
(
"user.home"
);
private
static
final
int
RECENT_FILES_COUNT
=
15
;
private
static
final
Font
DEFAULT_FONT
=
new
JLabel
().
getFont
();
static
final
Set
<
String
>
SKIP_FIELDS
=
new
HashSet
<
String
>(
Arrays
.
asList
(
"files"
,
"input"
,
"outputDir"
,
"printHelp"
));
...
...
@@ -22,6 +26,7 @@ public class JadxSettings extends JadxCLIArgs {
private
boolean
flattenPackage
=
false
;
private
boolean
checkForUpdates
=
true
;
private
List
<
String
>
recentFiles
=
new
ArrayList
<
String
>();
private
String
fontStr
=
""
;
public
void
sync
()
{
JadxSettingsAdapter
.
store
(
this
);
...
...
@@ -126,4 +131,28 @@ public class JadxSettings extends JadxCLIArgs {
public
void
setDeobfuscationForceSave
(
boolean
deobfuscationForceSave
)
{
this
.
deobfuscationForceSave
=
deobfuscationForceSave
;
}
public
Font
getFont
()
{
if
(
fontStr
.
isEmpty
())
{
return
DEFAULT_FONT
;
}
return
Font
.
decode
(
fontStr
);
}
public
void
setFont
(
Font
font
)
{
this
.
fontStr
=
font
.
getFontName
()
+
addStyleName
(
font
.
getStyle
())
+
"-"
+
font
.
getSize
();
}
private
static
String
addStyleName
(
int
style
)
{
switch
(
style
)
{
case
Font
.
BOLD
:
return
"-BOLD"
;
case
Font
.
PLAIN
:
return
"-PLAIN"
;
case
Font
.
ITALIC
:
return
"-ITALIC"
;
default
:
return
""
;
}
}
}
jadx-gui/src/main/java/jadx/gui/settings/JadxSettingsWindow.java
View file @
7b264ef2
...
...
@@ -2,6 +2,7 @@ package jadx.gui.settings;
import
jadx.gui.ui.MainWindow
;
import
jadx.gui.utils.NLS
;
import
say.swing.JFontChooser
;
import
javax.swing.BorderFactory
;
import
javax.swing.Box
;
...
...
@@ -20,6 +21,7 @@ import javax.swing.event.ChangeListener;
import
java.awt.BorderLayout
;
import
java.awt.Container
;
import
java.awt.Dimension
;
import
java.awt.Font
;
import
java.awt.GridBagConstraints
;
import
java.awt.GridBagLayout
;
import
java.awt.GridLayout
;
...
...
@@ -28,10 +30,17 @@ import java.awt.event.ActionEvent;
import
java.awt.event.ActionListener
;
import
java.awt.event.ItemEvent
;
import
java.awt.event.ItemListener
;
import
java.awt.event.MouseAdapter
;
import
java.awt.event.MouseEvent
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
public
class
JadxSettingsWindow
extends
JDialog
{
private
static
final
long
serialVersionUID
=
-
1804570470377354148L
;
private
static
final
Logger
LOG
=
LoggerFactory
.
getLogger
(
JadxSettingsWindow
.
class
);
private
final
MainWindow
mainWindow
;
private
final
JadxSettings
settings
;
private
final
String
startSettings
;
...
...
@@ -204,6 +213,22 @@ public class JadxSettingsWindow extends JDialog {
}
});
JButton
fontBtn
=
new
JButton
(
NLS
.
str
(
"preferences.select_font"
));
fontBtn
.
addMouseListener
(
new
MouseAdapter
()
{
@Override
public
void
mouseClicked
(
MouseEvent
e
)
{
JFontChooser
fontChooser
=
new
JFontChooser
();
fontChooser
.
setSelectedFont
(
settings
.
getFont
());
int
result
=
fontChooser
.
showDialog
(
JadxSettingsWindow
.
this
);
if
(
result
==
JFontChooser
.
OK_OPTION
)
{
Font
font
=
fontChooser
.
getSelectedFont
();
LOG
.
info
(
"Selected Font : {}"
,
font
);
settings
.
setFont
(
font
);
mainWindow
.
updateFont
(
font
);
}
}
});
SettingsGroup
other
=
new
SettingsGroup
(
NLS
.
str
(
"preferences.other"
));
other
.
addRow
(
NLS
.
str
(
"preferences.check_for_updates"
),
update
);
other
.
addRow
(
NLS
.
str
(
"preferences.threads"
),
threadsCount
);
...
...
@@ -212,6 +237,7 @@ public class JadxSettingsWindow extends JDialog {
other
.
addRow
(
NLS
.
str
(
"preferences.skipResourcesDecode"
),
resourceDecode
);
other
.
addRow
(
NLS
.
str
(
"preferences.cfg"
),
cfg
);
other
.
addRow
(
NLS
.
str
(
"preferences.raw_cfg"
),
rawCfg
);
other
.
addRow
(
NLS
.
str
(
"preferences.font"
),
fontBtn
);
return
other
;
}
...
...
jadx-gui/src/main/java/jadx/gui/ui/ContentArea.java
View file @
7b264ef2
package
jadx
.
gui
.
ui
;
import
jadx.api.CodePosition
;
import
jadx.gui.settings.JadxSettings
;
import
jadx.gui.treemodel.JClass
;
import
jadx.gui.treemodel.JNode
;
import
jadx.gui.utils.Position
;
...
...
@@ -45,6 +46,7 @@ class ContentArea extends RSyntaxTextArea {
setBackground
(
BACKGROUND
);
setAntiAliasingEnabled
(
true
);
setEditable
(
false
);
loadSettings
();
Caret
caret
=
getCaret
();
if
(
caret
instanceof
DefaultCaret
)
{
((
DefaultCaret
)
caret
).
setUpdatePolicy
(
DefaultCaret
.
ALWAYS_UPDATE
);
...
...
@@ -66,6 +68,11 @@ class ContentArea extends RSyntaxTextArea {
setText
(
node
.
getContent
());
}
public
void
loadSettings
()
{
JadxSettings
settings
=
contentPanel
.
getTabbedPane
().
getMainWindow
().
getSettings
();
setFont
(
settings
.
getFont
());
}
private
boolean
isJumpToken
(
Token
token
)
{
if
(
token
.
getType
()
==
TokenTypes
.
IDENTIFIER
)
{
// fast skip
...
...
jadx-gui/src/main/java/jadx/gui/ui/MainWindow.java
View file @
7b264ef2
...
...
@@ -48,6 +48,7 @@ import javax.swing.tree.TreeSelectionModel;
import
java.awt.BorderLayout
;
import
java.awt.Component
;
import
java.awt.DisplayMode
;
import
java.awt.Font
;
import
java.awt.GraphicsDevice
;
import
java.awt.GraphicsEnvironment
;
import
java.awt.event.ActionEvent
;
...
...
@@ -574,6 +575,15 @@ public class MainWindow extends JFrame {
setSize
((
int
)
(
w
*
WINDOW_RATIO
),
(
int
)
(
h
*
WINDOW_RATIO
));
}
public
void
updateFont
(
Font
font
)
{
setFont
(
font
);
tabbedPane
.
loadSettings
();
}
public
JadxSettings
getSettings
()
{
return
settings
;
}
private
class
OpenListener
implements
ActionListener
{
public
void
actionPerformed
(
ActionEvent
event
)
{
openFile
();
...
...
jadx-gui/src/main/java/jadx/gui/ui/TabbedPane.java
View file @
7b264ef2
...
...
@@ -234,4 +234,10 @@ class TabbedPane extends JTabbedPane {
closeCodePanel
(
panel
);
}
}
public
void
loadSettings
()
{
for
(
ContentPanel
panel
:
openTabs
.
values
())
{
panel
.
getContentArea
().
loadSettings
();
}
}
}
jadx-gui/src/main/resources/i18n/Messages_en_US.properties
View file @
7b264ef2
...
...
@@ -55,6 +55,8 @@ preferences.skipResourcesDecode=Don't decode resources
preferences.threads
=
Processing threads count
preferences.cfg
=
Generate methods CFG graphs (in 'dot' format)
preferences.raw_cfg
=
Generate RAW CFG graphs
preferences.font
=
Editor font
preferences.select_font
=
Select
preferences.deobfuscation_on
=
Enable deobfuscation
preferences.deobfuscation_force
=
Force rewrite deobfuscation map file
preferences.deobfuscation_min_len
=
Minimum name length
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment