Native look&feel, fixed bug when closing views, other cosmetic changes

This commit is contained in:
Iván Delgado 2021-02-03 00:33:56 +01:00
parent c8752a6389
commit ae94b52a00
7 changed files with 59 additions and 33 deletions

Binary file not shown.

8
resources/TM200.xml Normal file
View file

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE tmres SYSTEM "tmres.dtd">
<tmres>
<bookmarks>
</bookmarks>
<palettes>
</palettes>
</tmres>

View file

@ -5,6 +5,7 @@
<property key="viewStatusBar" value="true"/>
<property key="viewToolBar" value="true"/>
<property key="maxRecentFiles" value="10"/>
<property key="recentFile" value="/home/ivan/Escritorio/Otros/Apps/TM200"/>
<property key="lastPath" value=""/>
<property key="MenuBG" value="#151b1c"/>
<property key="WindowBG" value="#222b2e"/>

View file

@ -16,8 +16,12 @@
*
*/
import javax.swing.UIManager;
import tm.ui.TMUI;
/**
*
* Tile Molester main class.
@ -35,7 +39,17 @@ public class TileMolester {
*
**/
private static String OS = System.getProperty("os.name").toLowerCase();
public static Boolean isLinux = OS.indexOf("nix") >= 0 || OS.indexOf("nux") >= 0 || OS.indexOf("aix") > 0;
public static Boolean isWindows = OS.indexOf("win") >= 0;
public TileMolester() {
try {
if(isLinux) UIManager.setLookAndFeel("com.sun.java.swing.plaf.gtk.GTKLookAndFeel");
if(isWindows) UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
} catch (Exception e) {
e.printStackTrace();
}
new TMUI();
}

View file

@ -72,12 +72,12 @@ public class TMStatusBar extends JPanel {
add(p3);
// pane.add(new JLabel(" ")); // just some whitespace
offsetLabel.setBorder(new BevelBorder(BevelBorder.LOWERED));
coordsLabel.setBorder(new BevelBorder(BevelBorder.LOWERED));
palOffsetLabel.setBorder(new BevelBorder(BevelBorder.LOWERED));
codecLabel.setBorder(new BevelBorder(BevelBorder.LOWERED));
modeLabel.setBorder(new BevelBorder(BevelBorder.LOWERED));
tilesLabel.setBorder(new BevelBorder(BevelBorder.LOWERED));
//offsetLabel.setBorder(new BevelBorder(BevelBorder.LOWERED));
//coordsLabel.setBorder(new BevelBorder(BevelBorder.LOWERED));
//palOffsetLabel.setBorder(new BevelBorder(BevelBorder.LOWERED));
//codecLabel.setBorder(new BevelBorder(BevelBorder.LOWERED));
//modeLabel.setBorder(new BevelBorder(BevelBorder.LOWERED));
//tilesLabel.setBorder(new BevelBorder(BevelBorder.LOWERED));
}
/**

View file

@ -258,7 +258,7 @@ public class TMUI extends JFrame {
// Help menu
private JMenu helpMenu = new JMenu("Help");
private JMenuItem helpTopicsMenuItem = new JMenuItem("Help Topics");
private JMenuItem tipMenuItem = new JMenuItem("Tip of the Millennium...");
//private JMenuItem tipMenuItem = new JMenuItem("Tip of the Millennium..."); // Still say no to drugs, okay?
private JMenuItem aboutMenuItem = new JMenuItem("About Tile Molester...");
// button groups
@ -370,7 +370,7 @@ public class TMUI extends JFrame {
JComponent.setDefaultLocale(this.locale);
// show splash screen
new TMSplashScreen(this);
//new TMSplashScreen(this); // No need for a splash screen, it runs immediately on modern systems
// create a translator
try {
@ -474,7 +474,6 @@ public class TMUI extends JFrame {
// Help menu
helpMenu.setText(xlate("Help"));
helpTopicsMenuItem.setText(xlate("Help_Topics"));
tipMenuItem.setText(xlate("Tip_of_the_Millennium"));
aboutMenuItem.setText(xlate("About_Tile_Molester"));
UIManager.put("OptionPane.yesButtonText", xlate("Yes"));
@ -562,6 +561,7 @@ public class TMUI extends JFrame {
initToolBar();
initNavBar();
toolBarPane.setLayout(new FlowLayout(FlowLayout.LEFT));
toolBarPane.setBackground(MenuBG);
toolBarPane.add(toolBar);
toolBarPane.add(navBar);
pane.add(toolBarPane, BorderLayout.NORTH);
@ -571,7 +571,7 @@ public class TMUI extends JFrame {
// palette pane & statusbar
palettePane = new TMPalettePane(this);
statusBar.setBorder(new BevelBorder(BevelBorder.LOWERED));
//statusBar.setBorder(new BevelBorder(BevelBorder.LOWERED));
bottomPane.setLayout(new BorderLayout());
bottomPane.add(palettePane, BorderLayout.CENTER);
bottomPane.add(statusBar, BorderLayout.SOUTH);
@ -584,6 +584,7 @@ public class TMUI extends JFrame {
barPane.setLayout(new GridLayout(1, 2));
barPane.add(selectionToolBar);
barPane.add(toolPalette);
toolPane.setBackground(AsideBG);
toolPane.setLayout(new BorderLayout());
toolPane.add(barPane, BorderLayout.NORTH);
pane.add(toolPane, BorderLayout.WEST);
@ -628,6 +629,7 @@ public class TMUI extends JFrame {
doExitCommand();
}
public void windowActivated(WindowEvent e) {
setExtendedState(JFrame.NORMAL); // Hacky way to make it not run in full screen by default
// HACK to fix the GUI after running FCEU in fullscreen mode
// int state = getExtendedState();
// setExtendedState(JFrame.ICONIFIED);
@ -1159,7 +1161,7 @@ public class TMUI extends JFrame {
toolButtonGroup.add(replaceButton);
toolButtonGroup.add(moveButton);
selectButton.setSelected(true); // starting tool
toolPalette.setBorder(new BevelBorder(BevelBorder.LOWERED));
//toolPalette.setBorder(new BevelBorder(BevelBorder.LOWERED));
}
/**
@ -1318,7 +1320,7 @@ public class TMUI extends JFrame {
);
fileMenu.add(closeAllMenuItem);
//
fileMenu.addSeparator();
//fileMenu.addSeparator();
// Save
saveMenuItem.setMnemonic(KeyEvent.VK_S);
saveMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, Event.CTRL_MASK));
@ -2009,16 +2011,7 @@ public class TMUI extends JFrame {
}
);
helpMenu.add(helpTopicsMenuItem);
// Tip of the Millennium
tipMenuItem.setMnemonic(KeyEvent.VK_M);
tipMenuItem.addActionListener(
new ActionListener() {
public void actionPerformed(ActionEvent e) {
doTipCommand();
}
}
);
helpMenu.add(tipMenuItem);
// About
aboutMenuItem.setMnemonic(KeyEvent.VK_A);
aboutMenuItem.addActionListener(
@ -2130,8 +2123,8 @@ public class TMUI extends JFrame {
// remove view from the FileImage and desktop
img.removeView(view);
view.dispose();
desktop.remove(view);
view.dispose();
desktop.revalidate();
desktop.repaint();
@ -2239,8 +2232,8 @@ public class TMUI extends JFrame {
// remove the view
img.removeView(view);
view.dispose();
desktop.remove(view);
view.dispose();
}
buildReopenMenu();
@ -2719,7 +2712,7 @@ public class TMUI extends JFrame {
public void doAboutCommand()
{
JOptionPane.showMessageDialog(this,
"Tile Molester v0.19\nby SnowBro 2003-2005 (v0.16)\nby Dr. MefistO 2013 (v0.17.2)\nby Mewster 2014-2015 (v0.19)", "Tile Molester",
"Tile Molester v0.20\nby SnowBro 2003-2005 (v0.16)\nby Dr. MefistO 2013 (v0.17.2)\nby Mewster 2014-2015 (v0.19)\nby toruzz 2020 (v0.20)", "Tile Molester",
1);
}

View file

@ -43,6 +43,9 @@ import java.util.Vector;
**/
public class TMView extends JInternalFrame implements ChangeListener {
Color MenuBG = TMUI.MenuBG;
Color WindowBG = TMUI.WindowBG;
Color AsideBG = TMUI.AsideBG;
private static int frameCount = 0;
private JPanel contentPane = new JPanel();
@ -77,7 +80,10 @@ public class TMView extends JInternalFrame implements ChangeListener {
this.fileImage = fileImage;
fileImage.addView(this);
setDoubleBuffered(true);
setBackground(Color.gray);
//setBackground(Color.gray);
setFrameIcon(null);
setBackground(MenuBG);
setDefaultCloseOperation(JInternalFrame.DO_NOTHING_ON_CLOSE);
addInternalFrameListener(new InternalFrameAdapter() {
@ -99,7 +105,8 @@ public class TMView extends JInternalFrame implements ChangeListener {
// init UI components
// the panel containing the slider and editor canvas
contentPane.setBackground(Color.gray);
//contentPane.setBackground(Color.gray);
contentPane.setBackground(AsideBG);
contentPane.setLayout(null);
contentPane.setFocusable(true);
contentPane.addKeyListener(new ViewKeyListener(this));
@ -121,8 +128,11 @@ public class TMView extends JInternalFrame implements ChangeListener {
slider.setFocusable(false);
slider.setInverted(true);
contentPane.add(slider);
slider.setLocation(0, 0);
slider.setSize(24, 384);
slider.setForeground(AsideBG);
//slider.setLocation(0, 0);
//slider.setSize(24, 384);
slider.setLocation(4, -14);
slider.setSize(32, 424);
slider.addChangeListener(this);
// the scrollpane