*/
private boolean focusFollowsMouse = false;
- /**
- * The images that might be displayed. Note package private access.
- */
- private List<TImage> images;
-
/**
* The list of commands to run before the next I/O check.
*/
accelerators = new HashMap<TKeypress, TMenuItem>();
menuItems = new LinkedList<TMenuItem>();
desktop = new TDesktop(this);
- images = new LinkedList<TImage>();
// Special case: the Swing backend needs to have a timer to drive its
// blink state.
String version = getClass().getPackage().getImplementationVersion();
if (version == null) {
// This is Java 9+, use a hardcoded string here.
- version = "0.3.1";
+ version = "0.3.2";
}
messageBox(i18n.getString("aboutDialogTitle"),
MessageFormat.format(i18n.getString("aboutDialogText"), version),
getScreen().putCharXY(oldDrawnMouseX, oldDrawnMouseY,
oldDrawnMouseCell);
oldDrawnMouseCell = getScreen().getCharXY(mouseX, mouseY);
- if ((images.size() > 0) && (backend instanceof ECMA48Backend)) {
+ if (backend instanceof ECMA48Backend) {
// Special case: the entire row containing the mouse has
// to be re-drawn if it has any image data, AND any rows
// in between.
oldDrawnMouseX = mouseX;
oldDrawnMouseY = mouseY;
}
- if ((images.size() > 0) || getScreen().isDirty()) {
+ if (getScreen().isDirty()) {
backend.flushScreen();
}
return;
oldDrawnMouseX, oldDrawnMouseY);
}
oldDrawnMouseCell = getScreen().getCharXY(mouseX, mouseY);
- if ((images.size() > 0) && (backend instanceof ECMA48Backend)) {
+ if (backend instanceof ECMA48Backend) {
// Special case: the entire row containing the mouse has to be
// re-drawn if it has any image data, AND any rows in between.
if (oldDrawnMouseY != mouseY) {
}
// Flush the screen contents
- if ((images.size() > 0) || getScreen().isDirty()) {
+ if (getScreen().isDirty()) {
if (debugThreads) {
System.err.printf("%d %s backend.flushScreen()\n",
System.currentTimeMillis(), Thread.currentThread());
window.setY(windowY);
}
- // ------------------------------------------------------------------------
- // TImage management ------------------------------------------------------
- // ------------------------------------------------------------------------
-
- /**
- * Add an image to the list. Note package private access.
- *
- * @param image the image to add
- * @throws IllegalArgumentException if the image is already used in
- * another TApplication
- */
- final void addImage(final TImage image) {
- if ((image.getApplication() != null)
- && (image.getApplication() != this)
- ) {
- throw new IllegalArgumentException("Image " + image +
- " is already " + "part of application " +
- image.getApplication());
- }
- images.add(image);
- }
-
- /**
- * Remove an image from the list. Note package private access.
- *
- * @param image the image to remove
- * @throws IllegalArgumentException if the image is already used in
- * another TApplication
- */
- final void removeImage(final TImage image) {
- if ((image.getApplication() != null)
- && (image.getApplication() != this)
- ) {
- throw new IllegalArgumentException("Image " + image +
- " is already " + "part of application " +
- image.getApplication());
- }
- images.remove(image);
- }
-
// ------------------------------------------------------------------------
// TMenu management -------------------------------------------------------
// ------------------------------------------------------------------------
}
}
+ /**
+ * Get the menu item associated with this ID.
+ *
+ * @param id the menu item ID
+ * @return the menu item, or null if not found
+ */
+ public final TMenuItem getMenuItem(final int id) {
+ for (TMenuItem item: menuItems) {
+ if (item.getId() == id) {
+ return item;
+ }
+ }
+ return null;
+ }
+
/**
* Recompute menu x positions based on their title length.
*/
*/
public final TMenu addTableMenu() {
TMenu tableMenu = addMenu(i18n.getString("tableMenuTitle"));
+ tableMenu.addDefaultItem(TMenu.MID_TABLE_RENAME_COLUMN, false);
+ tableMenu.addDefaultItem(TMenu.MID_TABLE_RENAME_ROW, false);
+ tableMenu.addSeparator();
+
+ TSubMenu viewMenu = tableMenu.addSubMenu(i18n.
+ getString("tableSubMenuView"));
+ viewMenu.addDefaultItem(TMenu.MID_TABLE_VIEW_ROW_LABELS, false);
+ viewMenu.addDefaultItem(TMenu.MID_TABLE_VIEW_COLUMN_LABELS, false);
+ viewMenu.addDefaultItem(TMenu.MID_TABLE_VIEW_HIGHLIGHT_ROW, false);
+ viewMenu.addDefaultItem(TMenu.MID_TABLE_VIEW_HIGHLIGHT_COLUMN, false);
+
TSubMenu borderMenu = tableMenu.addSubMenu(i18n.
getString("tableSubMenuBorders"));
borderMenu.addDefaultItem(TMenu.MID_TABLE_BORDER_NONE, false);
borderMenu.addDefaultItem(TMenu.MID_TABLE_BORDER_ALL, false);
+ borderMenu.addDefaultItem(TMenu.MID_TABLE_BORDER_CELL_NONE, false);
+ borderMenu.addDefaultItem(TMenu.MID_TABLE_BORDER_CELL_ALL, false);
borderMenu.addDefaultItem(TMenu.MID_TABLE_BORDER_RIGHT, false);
borderMenu.addDefaultItem(TMenu.MID_TABLE_BORDER_LEFT, false);
borderMenu.addDefaultItem(TMenu.MID_TABLE_BORDER_TOP, false);
columnMenu.addDefaultItem(TMenu.MID_TABLE_COLUMN_WIDEN, false);
TSubMenu fileMenu = tableMenu.addSubMenu(i18n.
getString("tableSubMenuFile"));
+ fileMenu.addDefaultItem(TMenu.MID_TABLE_FILE_OPEN_CSV, false);
fileMenu.addDefaultItem(TMenu.MID_TABLE_FILE_SAVE_CSV, false);
fileMenu.addDefaultItem(TMenu.MID_TABLE_FILE_SAVE_TEXT, false);