2,2c2,2 < * @(#)DrawApplication.java 5.2 --- > * @(#)DrawApplication.java 3a4,9 > * Project: JHotdraw - a GUI framework for technical drawings > * http://www.jhotdraw.org > * http://jhotdraw.sourceforge.net > * Copyright: © by the original author(s) and all contributors > * License: Lesser GNU Public License (LGPL) > * http://www.opensource.org/licenses/lgpl-license.html 19,19c25,25 < * DrawApplication defines a standard presentation for --- > * DrawApplication defines a standard presentation for standalone drawing 20,20d25 < * standalone drawing editors. The presentation is 21,21c26,26 < * customized in subclasses. --- > * editors. The presentation is customized in subclasses. 28a34,35 > * > * @version <$CURRENT_VERSION$> 30,30c136,136 < --- > 40,40c46,46 < private StandardDrawingView fView; --- > private DrawingView fView; 75,75c81,81 < super("JHotDraw"); --- > this("JHotDraw"); 123,125d128 < // Panel in which a JToolBar can be placed using a BoxLayout < JPanel fullPanel = new JPanel(); < fullPanel.setLayout(new BoxLayout(fullPanel, BoxLayout.X_AXIS)); 140,141d143 < fullPanel.add(activePanel); < 143,143c145,145 < getContentPane().add(fullPanel, BorderLayout.CENTER); --- > getContentPane().add(activePanel, BorderLayout.CENTER); 188a191,193 > addMenuIfPossible(mb, createFileMenu()); > addMenuIfPossible(mb, createEditMenu()); > addMenuIfPossible(mb, createAlignmentMenu()); 189,191d190 < mb.add(createFileMenu()); < mb.add(createEditMenu()); < mb.add(createAlignmentMenu()); 192a195,199 > addMenuIfPossible(mb, createDebugMenu()); > } > > protected void addMenuIfPossible(JMenuBar mb, JMenu newMenu) { > if (newMenu != null) { 192,192c194,194 < mb.add(createAttributesMenu()); --- > addMenuIfPossible(mb, createAttributesMenu()); 193,193c200,200 < mb.add(createDebugMenu()); --- > mb.add(newMenu); 193a201,201 > } 260a269,272 > menu.add(new UndoableCommand( > new SelectAllCommand("Select All", view())), new MenuShortcut('a')); > menu.addSeparator(); > menu.add(new UndoableCommand( 261,261c273,273 < menu.add(new CutCommand("Cut", view()), new MenuShortcut('x')); --- > new CutCommand("Cut", view())), new MenuShortcut('x')); 262a288,288 > menu.add(new UndoCommand("Undo Command", view())); 263,263c289,289 < menu.add(new PasteCommand("Paste", view()), new MenuShortcut('v')); --- > menu.add(new RedoCommand("Redo Command", view())); 264a275,278 > menu.add(new UndoableCommand( > new PasteCommand("Paste", view())), new MenuShortcut('v')); > menu.addSeparator(); > menu.add(new UndoableCommand( 265,265c279,279 < menu.add(new DuplicateCommand("Duplicate", view()), new MenuShortcut('d')); --- > new DuplicateCommand("Duplicate", view())), new MenuShortcut('d')); 266,266c280,280 < menu.add(new DeleteCommand("Delete", view())); --- > menu.add(new UndoableCommand(new DeleteCommand("Delete", view()))); 267a282,282 > menu.add(new UndoableCommand(new GroupCommand("Group", view()))); 268,268d281 < menu.add(new GroupCommand("Group", view())); 269,269c283,283 < menu.add(new UngroupCommand("Ungroup", view())); --- > menu.add(new UndoableCommand(new UngroupCommand("Ungroup", view()))); 270a285,285 > menu.add(new UndoableCommand(new SendToBackCommand("Send to Back", view()))); 271,271d284 < menu.add(new SendToBackCommand("Send to Back", view())); 272,272c286,286 < menu.add(new BringToFrontCommand("Bring to Front", view())); --- > menu.add(new UndoableCommand(new BringToFrontCommand("Bring to Front", view()))); 282,282c299,299 < menu.add(new ToggleGridCommand("Toggle Snap to Grid", view(), new Point(4,4))); --- > menu.addCheckItem(new ToggleGridCommand("Toggle Snap to Grid", view(), new Point(4,4))); 283a301,305 > menu.add(new UndoableCommand( > new AlignCommand(AlignCommand.Alignment.LEFTS, view()))); > menu.add(new UndoableCommand( > new AlignCommand(AlignCommand.Alignment.CENTERS, view()))); > menu.add(new UndoableCommand( 284,285d300 < menu.add(new AlignCommand("Lefts", view(), AlignCommand.LEFTS)); < menu.add(new AlignCommand("Centers", view(), AlignCommand.CENTERS)); 286,286c306,306 < menu.add(new AlignCommand("Rights", view(), AlignCommand.RIGHTS)); --- > new AlignCommand(AlignCommand.Alignment.RIGHTS, view()))); 287a308,310 > menu.add(new UndoableCommand( > new AlignCommand(AlignCommand.Alignment.TOPS, view()))); > menu.add(new UndoableCommand( 288,288d307 < menu.add(new AlignCommand("Tops", view(), AlignCommand.TOPS)); 289a312,312 > menu.add(new UndoableCommand( 289,289c311,311 < menu.add(new AlignCommand("Middles", view(), AlignCommand.MIDDLES)); --- > new AlignCommand(AlignCommand.Alignment.MIDDLES, view()))); 290,290c313,313 < menu.add(new AlignCommand("Bottoms", view(), AlignCommand.BOTTOMS)); --- > new AlignCommand(AlignCommand.Alignment.BOTTOMS, view()))); 346a370,370 > new UndoableCommand( 352a377,377 > ) 361a387,389 > menu.add(new UndoableCommand( > new ChangeAttributeCommand("none", "ArrowMode", new Integer(PolyLineFigure.ARROW_TIP_NONE), view()))); > menu.add(new UndoableCommand( 362,362d386 < menu.add(new ChangeAttributeCommand("none", "ArrowMode", new Integer(PolyLineFigure.ARROW_TIP_NONE), view())); 363a391,393 > menu.add(new UndoableCommand( > new ChangeAttributeCommand("at End", "ArrowMode", new Integer(PolyLineFigure.ARROW_TIP_END), view()))); > menu.add(new UndoableCommand( 363,363c390,390 < menu.add(new ChangeAttributeCommand("at Start", "ArrowMode", new Integer(PolyLineFigure.ARROW_TIP_START), view())); --- > new ChangeAttributeCommand("at Start", "ArrowMode", new Integer(PolyLineFigure.ARROW_TIP_START), view()))); 364,364d390 < menu.add(new ChangeAttributeCommand("at End", "ArrowMode", new Integer(PolyLineFigure.ARROW_TIP_END), view())); 365,365c394,394 < menu.add(new ChangeAttributeCommand("at Both", "ArrowMode", new Integer(PolyLineFigure.ARROW_TIP_BOTH), view())); --- > new ChangeAttributeCommand("at Both", "ArrowMode", new Integer(PolyLineFigure.ARROW_TIP_BOTH), view()))); 376a406,406 > menu.add(new UndoableCommand( 377,377c407,407 < menu.add(new ChangeAttributeCommand(fonts[i], "FontName", fonts[i], view())); --- > new ChangeAttributeCommand(fonts[i], "FontName", fonts[i], view()))); 385a416,416 > menu.add(new UndoableCommand( 386,386c417,417 < menu.add(new ChangeAttributeCommand("Plain", "FontStyle", new Integer(Font.PLAIN), view())); --- > new ChangeAttributeCommand("Plain", "FontStyle", new Integer(Font.PLAIN), view()))); 386a418,418 > menu.add(new UndoableCommand( 387a420,420 > menu.add(new UndoableCommand( 387,387c419,419 < menu.add(new ChangeAttributeCommand("Italic","FontStyle", new Integer(Font.ITALIC),view())); --- > new ChangeAttributeCommand("Italic","FontStyle", new Integer(Font.ITALIC),view()))); 388,388c421,421 < menu.add(new ChangeAttributeCommand("Bold", "FontStyle", new Integer(Font.BOLD), view())); --- > new ChangeAttributeCommand("Bold", "FontStyle", new Integer(Font.BOLD), view()))); 399a433,433 > new UndoableCommand( 403a438,438 > ) 477,477c512,512 < protected StandardDrawingView createDrawingView() { --- > protected DrawingView createDrawingView() { 504,504c539,539 < protected JComponent createContents(StandardDrawingView view) { --- > protected JComponent createContents(DrawingView view) { 505,505c540,540 < JScrollPane sp = new JScrollPane(view); --- > JScrollPane sp = new JScrollPane((StandardDrawingView)view); 582,582c617,617 < if (inside) --- > if (inside) { 583a619,620 > } > else { 584,584d618 < else 586a623,623 > } 628,628c665,665 < public void selectionChanged(DrawingView view) { --- > public void figureSelectionChanged(DrawingView view) { 630a668,669 > // make sure it does exist > if (editMenu != null) { 631a671,671 > } 632a673,674 > // make sure it does exist > if (editMenu != null) { 635a678,689 > JMenu attributeMenu = mb.getMenu(ATTRIBUTES_MENU); > // make sure it does exist > if (attributeMenu != null) { > for (int i = 0; i < attributeMenu.getItemCount(); i++) { > JMenuItem currentMenu = attributeMenu.getItem(i); > if (currentMenu instanceof CommandMenu) { > ((CommandMenu)currentMenu).checkEnabled(); > } > } > } > } > 648a703,703 > showStatus(name); 649,649d702 < fStatusLine.setText(name); 655,655c709,709 < if (fSelectedToolButton != null) --- > if (fSelectedToolButton != null) { 656a711,711 > } 658,658c713,713 < if (fSelectedToolButton != null) --- > if (fSelectedToolButton != null) { 660a716,716 > } 682a739,739 > toolDone();