First implementation of a bookmarks system.

Not persistent yet, so you lose them all when you close ATCS.
This commit is contained in:
Zukero
2018-09-13 13:34:04 +02:00
parent bf42f86408
commit 0a3da17d47
19 changed files with 653 additions and 1 deletions

View File

@@ -1779,6 +1779,20 @@ public class TMXMapEditor extends Editor implements TMXMap.MapChangedOnDiskListe
}
});
savePane.add(delete, JideBoxLayout.FIX);
final JButton bookmark = new JButton(new ImageIcon(map.bookmark != null ? DefaultIcons.getBookmarkActiveIcon() : DefaultIcons.getBookmarkInactiveIcon()));
savePane.add(bookmark, JideBoxLayout.FIX);
bookmark.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
if (map.bookmark == null) {
map.getProject().bookmark(map);
bookmark.setIcon(new ImageIcon(DefaultIcons.getBookmarkActiveIcon()));
} else {
map.bookmark.delete();
bookmark.setIcon(new ImageIcon(DefaultIcons.getBookmarkInactiveIcon()));
}
}
});
} else {
if (proj.getMap(map.id) != map) {
savePane.add(message = new JLabel(ALTERED_EXISTS_MESSAGE), JideBoxLayout.FIX);
@@ -1842,6 +1856,20 @@ public class TMXMapEditor extends Editor implements TMXMap.MapChangedOnDiskListe
}
}
});
final JButton bookmark = new JButton(new ImageIcon(map.bookmark != null ? DefaultIcons.getBookmarkActiveIcon() : DefaultIcons.getBookmarkInactiveIcon()));
savePane.add(bookmark, JideBoxLayout.FIX);
bookmark.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
if (map.bookmark == null) {
map.getProject().bookmark(map);
bookmark.setIcon(new ImageIcon(DefaultIcons.getBookmarkActiveIcon()));
} else {
map.bookmark.delete();
bookmark.setIcon(new ImageIcon(DefaultIcons.getBookmarkInactiveIcon()));
}
}
});
//Placeholder. Fills the eventual remaining space.
savePane.add(new JPanel(), JideBoxLayout.VARY);
pane.add(savePane, JideBoxLayout.FIX);