diff --git a/jadx-gui/src/main/java/jadx/gui/settings/JadxSettings.java b/jadx-gui/src/main/java/jadx/gui/settings/JadxSettings.java index 8b096591660..697adb6bb38 100644 --- a/jadx-gui/src/main/java/jadx/gui/settings/JadxSettings.java +++ b/jadx-gui/src/main/java/jadx/gui/settings/JadxSettings.java @@ -41,6 +41,7 @@ import jadx.gui.ui.MainWindow; import jadx.gui.ui.action.ActionModel; import jadx.gui.ui.codearea.EditorTheme; +import jadx.gui.ui.tab.dnd.TabDndGhostType; import jadx.gui.utils.FontUtils; import jadx.gui.utils.LafManager; import jadx.gui.utils.LangLocale; @@ -52,7 +53,7 @@ public class JadxSettings extends JadxCLIArgs { private static final Path USER_HOME = Paths.get(System.getProperty("user.home")); private static final int RECENT_PROJECTS_COUNT = 30; - private static final int CURRENT_SETTINGS_VERSION = 19; + private static final int CURRENT_SETTINGS_VERSION = 20; private static final Font DEFAULT_FONT = new RSyntaxTextArea().getFont(); @@ -134,6 +135,8 @@ public void setSaveOption(SAVEOPTION saveOption) { private boolean dockLogViewer = true; + private TabDndGhostType tabDndGhostType = TabDndGhostType.OUTLINE; + private int settingsVersion = CURRENT_SETTINGS_VERSION; @JadxSettingsAdapter.GsonExclude @@ -749,6 +752,14 @@ public void setXposedCodegenLanguage(XposedCodegenLanguage language) { this.xposedCodegenLanguage = language; } + public void setTabDndGhostType(TabDndGhostType tabDndGhostType) { + this.tabDndGhostType = tabDndGhostType; + } + + public TabDndGhostType getTabDndGhostType() { + return this.tabDndGhostType; + } + private void upgradeSettings(int fromVersion) { LOG.debug("upgrade settings from version: {} to {}", fromVersion, CURRENT_SETTINGS_VERSION); if (fromVersion <= 10) { @@ -790,6 +801,10 @@ private void upgradeSettings(int fromVersion) { xposedCodegenLanguage = XposedCodegenLanguage.JAVA; fromVersion++; } + if (fromVersion == 19) { + tabDndGhostType = TabDndGhostType.OUTLINE; + fromVersion++; + } if (fromVersion != CURRENT_SETTINGS_VERSION) { LOG.warn("Incorrect settings upgrade. Expected version: {}, got: {}", CURRENT_SETTINGS_VERSION, fromVersion); } diff --git a/jadx-gui/src/main/java/jadx/gui/settings/ui/JadxSettingsWindow.java b/jadx-gui/src/main/java/jadx/gui/settings/ui/JadxSettingsWindow.java index 7d51f301489..68c1bb4af7e 100644 --- a/jadx-gui/src/main/java/jadx/gui/settings/ui/JadxSettingsWindow.java +++ b/jadx-gui/src/main/java/jadx/gui/settings/ui/JadxSettingsWindow.java @@ -65,6 +65,7 @@ import jadx.gui.settings.ui.shortcut.ShortcutsSettingsGroup; import jadx.gui.ui.MainWindow; import jadx.gui.ui.codearea.EditorTheme; +import jadx.gui.ui.tab.dnd.TabDndGhostType; import jadx.gui.utils.FontUtils; import jadx.gui.utils.LafManager; import jadx.gui.utils.LangLocale; @@ -396,6 +397,15 @@ public void mouseClicked(MouseEvent e) { } } }); + + JComboBox tabDndGhostTypeCbx = new JComboBox<>(TabDndGhostType.values()); + tabDndGhostTypeCbx.setSelectedItem(settings.getTabDndGhostType()); + tabDndGhostTypeCbx.addActionListener(e -> { + settings.setTabDndGhostType((TabDndGhostType) tabDndGhostTypeCbx.getSelectedItem()); + mainWindow.loadSettings(); + }); + group.addRow(NLS.str("preferences.tab_dnd_appearance"), tabDndGhostTypeCbx); + return group; } diff --git a/jadx-gui/src/main/java/jadx/gui/ui/MainWindow.java b/jadx-gui/src/main/java/jadx/gui/ui/MainWindow.java index 046b854bb27..b2d54924db4 100644 --- a/jadx-gui/src/main/java/jadx/gui/ui/MainWindow.java +++ b/jadx-gui/src/main/java/jadx/gui/ui/MainWindow.java @@ -1306,7 +1306,7 @@ public void treeWillCollapse(TreeExpansionEvent event) { tabbedPane = new TabbedPane(this); tabbedPane.setMinimumSize(new Dimension(150, 150)); - new TabDndController(tabbedPane); + new TabDndController(tabbedPane, settings); rightSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT); rightSplitPane.setTopComponent(tabbedPane); diff --git a/jadx-gui/src/main/java/jadx/gui/ui/tab/dnd/TabDndController.java b/jadx-gui/src/main/java/jadx/gui/ui/tab/dnd/TabDndController.java index 7fad1d28498..d7db6053904 100644 --- a/jadx-gui/src/main/java/jadx/gui/ui/tab/dnd/TabDndController.java +++ b/jadx-gui/src/main/java/jadx/gui/ui/tab/dnd/TabDndController.java @@ -41,6 +41,7 @@ import javax.swing.SwingUtilities; import javax.swing.plaf.metal.MetalTabbedPaneUI; +import jadx.gui.settings.JadxSettings; import jadx.gui.ui.tab.TabbedPane; public class TabDndController { @@ -63,11 +64,11 @@ public class TabDndController { protected Rectangle rectForward = new Rectangle(); private boolean isDragging = false; - public TabDndController(TabbedPane pane) { + public TabDndController(TabbedPane pane, JadxSettings settings) { pane.setDnd(this); this.pane = pane; - tabDndGhostPane = new TabDndGhostPane(this); + tabDndGhostPane = new TabDndGhostPane(this, settings); new DropTarget(tabDndGhostPane, DnDConstants.ACTION_COPY_OR_MOVE, new TabDndTargetListener(this), true); DragSource.getDefaultDragSource().createDefaultDragGestureRecognizer(pane, @@ -244,11 +245,11 @@ protected void initGlassPane(Point tabPt) { pane.setTabComponentAt(dragTabIndex, c); break; } - case COLORFUL_RECT: { + case OUTLINE: { tabDndGhostPane.setGhostSize(d); break; } - case NONE: + case TARGET_MARK: break; } } diff --git a/jadx-gui/src/main/java/jadx/gui/ui/tab/dnd/TabDndGhostPane.java b/jadx-gui/src/main/java/jadx/gui/ui/tab/dnd/TabDndGhostPane.java index e334c4ba66c..f3f2ca3b356 100644 --- a/jadx-gui/src/main/java/jadx/gui/ui/tab/dnd/TabDndGhostPane.java +++ b/jadx-gui/src/main/java/jadx/gui/ui/tab/dnd/TabDndGhostPane.java @@ -34,20 +34,24 @@ import javax.swing.JComponent; import javax.swing.UIManager; +import jadx.gui.settings.JadxSettings; + public class TabDndGhostPane extends JComponent { private final TabDndController dnd; private final Rectangle lineRect = new Rectangle(); private final Point location = new Point(); private transient BufferedImage ghostImage; - private TabDndGhostType tabDndGhostType = TabDndGhostType.COLORFUL_RECT; + private JadxSettings settings; + private TabDndGhostType tabDndGhostType = TabDndGhostType.OUTLINE; private Dimension ghostSize; private Color ghostColor; private Insets insets; - protected TabDndGhostPane(TabDndController dnd) { + protected TabDndGhostPane(TabDndController dnd, JadxSettings settings) { super(); this.dnd = dnd; + this.settings = settings; loadSettings(); } @@ -58,6 +62,8 @@ public void loadSettings() { Insets ins = UIManager.getInsets("TabbedPane.tabInsets"); insets = ins != null ? ins : new Insets(0, 0, 0, 0); + + tabDndGhostType = settings.getTabDndGhostType(); } public void setTargetRect(int x, int y, int width, int height) { @@ -129,7 +135,7 @@ private void renderGhost(Graphics2D g) { g.drawImage(ghostImage, (int) x, (int) y, this); break; } - case COLORFUL_RECT: { + case OUTLINE: { g.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, .2f)); if (ghostSize == null) { return; @@ -140,7 +146,7 @@ private void renderGhost(Graphics2D g) { g.fillRect((int) x, (int) y, ghostSize.width, ghostSize.height); break; } - case NONE: + case TARGET_MARK: break; } } diff --git a/jadx-gui/src/main/java/jadx/gui/ui/tab/dnd/TabDndGhostType.java b/jadx-gui/src/main/java/jadx/gui/ui/tab/dnd/TabDndGhostType.java index a65a48cab00..2792155fedd 100644 --- a/jadx-gui/src/main/java/jadx/gui/ui/tab/dnd/TabDndGhostType.java +++ b/jadx-gui/src/main/java/jadx/gui/ui/tab/dnd/TabDndGhostType.java @@ -10,10 +10,10 @@ public enum TabDndGhostType { /** * Colored rect of tabs size is dragged along with cursor. */ - COLORFUL_RECT, + OUTLINE, /** * Only insert mark is rendered. */ - NONE, + TARGET_MARK, } diff --git a/jadx-gui/src/main/resources/i18n/Messages_de_DE.properties b/jadx-gui/src/main/resources/i18n/Messages_de_DE.properties index 251aae0e8bb..ffaf016fbbe 100644 --- a/jadx-gui/src/main/resources/i18n/Messages_de_DE.properties +++ b/jadx-gui/src/main/resources/i18n/Messages_de_DE.properties @@ -236,6 +236,7 @@ preferences.search_group_title=Ressourcen durchsuchen #preferences.search_results_per_page=Results per page (0 - no limit) preferences.res_file_ext=Dateierweiterungen (z.B. .xml|.html), * bedeutet alle preferences.res_skip_file=Dateien überspringen (MB) +preferences.tab_dnd_appearance=Dragging tab appearance #preferences.plugins.install=Install plugin #preferences.plugins.install_btn=Install diff --git a/jadx-gui/src/main/resources/i18n/Messages_en_US.properties b/jadx-gui/src/main/resources/i18n/Messages_en_US.properties index 773e2930f0d..fc465654350 100644 --- a/jadx-gui/src/main/resources/i18n/Messages_en_US.properties +++ b/jadx-gui/src/main/resources/i18n/Messages_en_US.properties @@ -236,6 +236,7 @@ preferences.search_group_title=Search preferences.search_results_per_page=Results per page (0 - no limit) preferences.res_file_ext=Resource files extensions ('xml|html', * for all) preferences.res_skip_file=Skip resources files if larger (MB) (0 - disable) +preferences.tab_dnd_appearance=Dragging tab appearance preferences.plugins.install=Install plugin preferences.plugins.install_btn=Install diff --git a/jadx-gui/src/main/resources/i18n/Messages_es_ES.properties b/jadx-gui/src/main/resources/i18n/Messages_es_ES.properties index 5d964d1efb0..bf4cfef7cf8 100644 --- a/jadx-gui/src/main/resources/i18n/Messages_es_ES.properties +++ b/jadx-gui/src/main/resources/i18n/Messages_es_ES.properties @@ -236,6 +236,7 @@ preferences.reset_title=Reestablecer preferencias #preferences.search_results_per_page=Results per page (0 - no limit) #preferences.res_file_ext=Resource files extensions ('xml|html', * for all) #preferences.res_skip_file=Skip resources files if larger (MB) +#preferences.tab_dnd_appearance=Dragging tab appearance #preferences.plugins.install=Install plugin #preferences.plugins.install_btn=Install diff --git a/jadx-gui/src/main/resources/i18n/Messages_id_ID.properties b/jadx-gui/src/main/resources/i18n/Messages_id_ID.properties index 5cb5fed77f5..2ba1504acd0 100644 --- a/jadx-gui/src/main/resources/i18n/Messages_id_ID.properties +++ b/jadx-gui/src/main/resources/i18n/Messages_id_ID.properties @@ -236,6 +236,7 @@ preferences.search_group_title=Pencarian preferences.search_results_per_page=Hasil per halaman (0 - tanpa batas) preferences.res_file_ext=Ekstensi berkas sumber daya ('xml|html', * untuk semua) preferences.res_skip_file=Lewati berkas sumber daya jika lebih besar (MB) (0 - nonaktifkan) +preferences.tab_dnd_appearance=Dragging tab appearance preferences.plugins.install=Instal plugin preferences.plugins.install_btn=Instal diff --git a/jadx-gui/src/main/resources/i18n/Messages_ko_KR.properties b/jadx-gui/src/main/resources/i18n/Messages_ko_KR.properties index baaf8c2f2c0..c696e8c1846 100644 --- a/jadx-gui/src/main/resources/i18n/Messages_ko_KR.properties +++ b/jadx-gui/src/main/resources/i18n/Messages_ko_KR.properties @@ -236,6 +236,7 @@ preferences.search_group_title=리소스 검색 #preferences.search_results_per_page=Results per page (0 - no limit) preferences.res_file_ext=파일 확장자 (예: .xml|.html) (* 은 전체를 의미) preferences.res_skip_file=이 옵션보다 큰 파일 건너 뛰기 (MB) +preferences.tab_dnd_appearance=Dragging tab appearance #preferences.plugins.install=Install plugin #preferences.plugins.install_btn=Install diff --git a/jadx-gui/src/main/resources/i18n/Messages_pt_BR.properties b/jadx-gui/src/main/resources/i18n/Messages_pt_BR.properties index b38a19bde84..14e51c1cc63 100644 --- a/jadx-gui/src/main/resources/i18n/Messages_pt_BR.properties +++ b/jadx-gui/src/main/resources/i18n/Messages_pt_BR.properties @@ -236,6 +236,7 @@ preferences.search_group_title=Buscar recursos #preferences.search_results_per_page=Results per page (0 - no limit) preferences.res_file_ext=Extensões de arquivos (ex: .xml|.html), * significa todas preferences.res_skip_file=Pular arquivos excedidos +preferences.tab_dnd_appearance=Dragging tab appearance #preferences.plugins.install=Install plugin #preferences.plugins.install_btn=Install diff --git a/jadx-gui/src/main/resources/i18n/Messages_ru_RU.properties b/jadx-gui/src/main/resources/i18n/Messages_ru_RU.properties index fb3be97c8e2..6f8106ad4b4 100644 --- a/jadx-gui/src/main/resources/i18n/Messages_ru_RU.properties +++ b/jadx-gui/src/main/resources/i18n/Messages_ru_RU.properties @@ -236,6 +236,7 @@ preferences.search_group_title=Поиск preferences.search_results_per_page=Результатов на страницу (0 - без лимита) preferences.res_file_ext=Расширения файлов ресурсов ('xml|html', * для всех) preferences.res_skip_file=Пропускать ресурсы больше чем (в МБ) +preferences.tab_dnd_appearance=Dragging tab appearance #preferences.plugins.install=Install plugin #preferences.plugins.install_btn=Install diff --git a/jadx-gui/src/main/resources/i18n/Messages_zh_CN.properties b/jadx-gui/src/main/resources/i18n/Messages_zh_CN.properties index 977d66b5478..bf71aaa49da 100644 --- a/jadx-gui/src/main/resources/i18n/Messages_zh_CN.properties +++ b/jadx-gui/src/main/resources/i18n/Messages_zh_CN.properties @@ -236,6 +236,7 @@ preferences.search_group_title=搜索资源 preferences.search_results_per_page=每页结果数(0 - 无限制) preferences.res_file_ext=文件扩展名(e.g. .xml|.html),* 表示所有 preferences.res_skip_file=跳过文件大小(MB) +preferences.tab_dnd_appearance=Dragging tab appearance preferences.plugins.install=安装插件 preferences.plugins.install_btn=安装 diff --git a/jadx-gui/src/main/resources/i18n/Messages_zh_TW.properties b/jadx-gui/src/main/resources/i18n/Messages_zh_TW.properties index 4b4c53b7157..05a41df4bc3 100644 --- a/jadx-gui/src/main/resources/i18n/Messages_zh_TW.properties +++ b/jadx-gui/src/main/resources/i18n/Messages_zh_TW.properties @@ -236,6 +236,7 @@ preferences.search_group_title=搜尋資源 preferences.search_results_per_page=每頁的搜尋結果數 (0 - 無限制) preferences.res_file_ext=副檔名 (e.g. .xml|.html), * 表示全部 preferences.res_skip_file=略過大於此值的檔案 (MB) +preferences.tab_dnd_appearance=Dragging tab appearance preferences.plugins.install=安裝外掛程式 preferences.plugins.install_btn=安裝