47a48,48 > private DrawingView fView; 51,51c52,52 < private static String fApplicationName; --- > private String fApplicationName; 54,54c55,55 < private String fgUntitled = "untitled"; --- > protected static String fgUntitled = "untitled"; 116,117d116 < DrawingView dv = getDesktop().getActiveDrawingView(); < if (dv == null || !dv.isInteractive()) {//this should be ASSERT and otherwise handled by context sensitive menus. 120a121,122 > window.open(view()); > if (view().drawing().getTitle() != null ) { 121,124d120 < window.open(); < window.newWindow( dv.drawing() ); < < /* if (dv.drawing().getTitle() != null ) { 125,125c123,123 < window.setDrawingTitle(dv.drawing().getTitle() + " (View)"); --- > window.setDrawingTitle(view().drawing().getTitle() + " (View)"); 129,129c127,127 < }*/ --- > } 135a195,197 > if (newDrawingView.isInteractive()) { > getDesktop().addToDesktop(newDrawingView , Desktop.PRIMARY); > } 135a134,140 > public void newWindow(Drawing initialDrawing) { > DrawApplication window = createApplication(); > if (initialDrawing == null) { > window.open(); > } > else { > window.open(window.createDrawingView(initialDrawing)); 136,138d194 < public void newWindow(Drawing newDrawing) { < getDesktop().removeAllFromDesktop(Desktop.PRIMARY); < getDesktop().addToDesktop( createDrawingView( newDrawing ), Desktop.PRIMARY); 139,139c198,198 < toolDone(); --- > toolDone(); 141,142d141 < public final void newWindow() { < newWindow( createDrawing() ); 143a143,150 > > /** > * Opens a new window > */ > public void open() { > open(createInitialDrawingView()); > } > 147,147c154,154 < public synchronized void open() { --- > protected synchronized void open(DrawingView newDrawingView) { 157,157d175 < //Initialize Desktop, must be done before tools 158,158c176,176 < setDesktopListener(createDesktopListener()); --- > setDesktopListener(createDesktopListener()); 159,159c177,177 < setDesktop(createDesktop()); --- > setDesktop(createDesktop()); 160,161d177 < < //Initialize Tools 163,163d164 < //why do we need a dummy tool? 164a166,167 > setView(newDrawingView); > 176,178d180 < < < //Initialize Menus 191a706,706 > } 192,192d705 < 335,335c340,340 < getDesktop().getActiveDrawingView().setDisplayUpdate(new SimpleUpdateStrategy()); --- > this.view().setDisplayUpdate(new SimpleUpdateStrategy()); 342,342c347,347 < getDesktop().getActiveDrawingView().setDisplayUpdate(new BufferedUpdateStrategy()); --- > this.view().setDisplayUpdate(new BufferedUpdateStrategy()); 536,538d540 < * Made this final so no one indavertently overrides it. If you need to < * override, override createDrawingView(Drawing newDrawing) below. < * dnoyeb@users.sourceforge.net 540,540c542,542 < protected final DrawingView createDrawingView() { --- > protected DrawingView createDrawingView() { 541,541c543,543 < return createDrawingView( createDrawing() ); --- > DrawingView createdDrawingView = createDrawingView(createDrawing()); 541a544,545 > createdDrawingView.drawing().setTitle(getDefaultDrawingTitle()); > return createdDrawingView; 546a551,551 > newDrawingView.setDrawing(newDrawing); 546,546c550,550 < DrawingView newDrawingView = new StandardDrawingView(newDrawing, this, d.width, d.height); --- > DrawingView newDrawingView = new StandardDrawingView(this, d.width, d.height); 580,580c585,585 < Drawing dwg = new StandardDrawing(); --- > return new StandardDrawing(); 581,582d585 < dwg.setTitle( getDefaultDrawingTitle() ); < return dwg; 586,586c589,589 < return new JPanelDesktop(); --- > return new JPanelDesktop(this); 695a699,699 > return fView; 696,696d698 < return getDesktop().getActiveDrawingView(); 699,699c702,702 < /* protected void setView(DrawingView newView) { --- > protected void setView(DrawingView newView) { 703,703d705 < }*/ 706,706c709,709 < return new DrawingView[] { getDesktop().getActiveDrawingView() }; --- > return new DrawingView[] { view() }; 868a872,874 > newWindow(createDrawing()); > //toolDone(); > //view().setDrawing(createDrawing()); 869,869d871 < newWindow( ); 893a899,899 > if (view() != null) { 894,894c117,117 < if (getDesktop().getActiveDrawingView() != null) { --- > if (view() == null) { 942,942c947,947 < ((StandardDrawingView)getDesktop().getActiveDrawingView()).printAll(pg); --- > ((StandardDrawingView)view()).printAll(pg); 954a960,962 > if (view() == null) { > return; > } 955,956d959 < DrawingView dv = getDesktop().getActiveDrawingView(); < if (dv != null && dv.isInteractive() ) { 958,958c964,964 < String name = storeFormat.store(file, dv.drawing()); --- > String name = storeFormat.store(file, view().drawing()); 959,959c965,965 < dv.drawing().setTitle(name); --- > view().drawing().setTitle(name); 959a966,966 > setDrawingTitle(name); 960,960d965 < updateApplicationTitle(); 966,966d971 < } 1002a1008,1008 > protected void setDrawingTitle(String drawingTitle) { 1003,1006d1007 < protected void updateApplicationTitle() { < DrawingView dv = getDesktop().getActiveDrawingView(); < if(dv != null && dv.isInteractive()){ //mrfloppy, we can do away with null check and ASSERT once their is always at least a NullDrawingView < String drawingTitle = dv.drawing().getTitle(); 1007,1007c1009,1009 < if (!getDefaultDrawingTitle().equals(drawingTitle)) { --- > if (getDefaultDrawingTitle().equals(drawingTitle)) { 1008,1008c1010,1010 < setTitle(getApplicationName() + " - " + drawingTitle); --- > setTitle(getApplicationName()); 1009,1009d1010 < } 1011a1013,1014 > setTitle(getApplicationName() + " - " + drawingTitle); > } 1012,1012d1012 < setTitle(getApplicationName()); 1013a1016,1021 > > /** > * Return the title of the currently selected drawing > */ > protected String getDrawingTitle() { > return view().drawing().getTitle(); 1026,1026c1034,1034 < public static String getApplicationName() { --- > public String getApplicationName() { 1056a1065,1065 > public String getDefaultDrawingTitle() { 1057,1063d1064 < /** < * I made this protected because it should only be used by the DrawApplication. < * This is because all created drawings will be created through createDrawing() < * which is a method of DrawApplication. < * dnoyeb@users.sourceforge.net 12/31/02 < */ < protected String getDefaultDrawingTitle() { 1085,1085c1087,1087 < public void drawingViewSelected(DrawingView oldView, DesktopEvent dpe) { --- > public void drawingViewSelected(DesktopEvent dpe) { 1091a1094,1094 > setView(dv); 1092,1093d1093 < fireViewSelectionChangedEvent(oldView, getDesktop().getActiveDrawingView()); < updateApplicationTitle();