Ticket #2276: book-window-location-lost-on-save-as-2.patch
File book-window-location-lost-on-save-as-2.patch, 6.8 KB (added by deni, 15 years ago) |
---|
-
TabularUnified modules/org.sophie2.base.layout/src/main/java/org/sophie2/base/layout/testing/DummyDocumentView.java
### Eclipse Workspace Patch 1.0 #P sophie
3 3 import javax.swing.JDesktopPane; 4 4 5 5 import org.sophie2.base.commons.util.ImmImage; 6 import org.sophie2.base.commons.util.position.ImmPoint; 6 7 import org.sophie2.base.commons.util.position.ImmSize; 7 8 import org.sophie2.base.layout.model.DocView; 8 9 import org.sophie2.base.visual.BaseSwingVisualElement; … … 65 66 public RwProp<ImmSize> preferredDimensions() { 66 67 return getBean().makeValueProp("preferredDimensions", ImmSize.class); 67 68 } 69 70 public RwProp<ImmPoint> preferredLocation() { 71 return getBean().makeValueProp("preferredLocation", ImmPoint.class, null); 72 } 68 73 } -
TabularUnified modules/org.sophie2.extra.func.scripting/src/main/java/org/sophie2/extra/func/scripting/view/ScriptDocView.java
12 12 import org.sophie2.base.commons.structures.ImmTreeList; 13 13 import org.sophie2.base.commons.util.ImmImage; 14 14 import org.sophie2.base.commons.util.ImmList; 15 import org.sophie2.base.commons.util.position.ImmPoint; 15 16 import org.sophie2.base.commons.util.position.ImmSize; 16 17 import org.sophie2.base.layout.LogicR3Button; 17 18 import org.sophie2.base.model.resources.r4.access.ResourceAccess; … … 288 289 public RwProp<ImmSize> preferredDimensions() { 289 290 return getBean().makeValueProp("preferredDimensions", ImmSize.class, ImmSize.ZERO); 290 291 } 292 293 public RwProp<ImmPoint> preferredLocation() { 294 return getBean().makeValueProp("preferredLocation", ImmPoint.class, null); 295 } 291 296 } -
TabularUnified modules/org.sophie2.main.layout.mydoggy/src/main/java/org/sophie2/main/layout/mydoggy/MDDocumentWindow.java
16 16 17 17 import org.noos.xing.mydoggy.ToolWindowAnchor; 18 18 import org.sophie2.base.commons.util.ImmImage; 19 import org.sophie2.base.commons.util.position.ImmPoint; 19 20 import org.sophie2.base.commons.util.position.ImmSize; 20 21 import org.sophie2.base.layout.impl.DefaultDocView; 21 22 import org.sophie2.base.layout.model.DocView; … … 108 109 } 109 110 110 111 public void componentMoved(ComponentEvent e) { 111 //nothing. 112 JInternalFrame internalFrame = (JInternalFrame) e.getComponent(); 113 ImmPoint location = new ImmPoint(internalFrame.getLocation()); 114 model().get().preferredLocation().set(location); 112 115 } 113 116 114 117 public void componentHidden(ComponentEvent e) { … … 254 257 res.pack(); 255 258 } 256 259 } 260 261 @SuppressWarnings("unused") 262 @Setup 263 protected void setLocation(JInternalFrame res) { 264 265 if (model().get() != null && 266 model().get().preferredLocation().get() != null) { 267 268 res.setLocation(model().get().preferredLocation().get().toPoint()); 269 } 270 } 257 271 258 272 /** 259 273 * Defines whether the JInternalFrame representing the -
TabularUnified modules/org.sophie2.main.app.commons/src/main/java/org/sophie2/main/app/commons/book/BookDocView.java
8 8 import javax.swing.ScrollPaneConstants; 9 9 10 10 import org.sophie2.base.commons.util.ImmImage; 11 import org.sophie2.base.commons.util.position.ImmPoint; 11 12 import org.sophie2.base.commons.util.position.ImmSize; 12 13 import org.sophie2.base.layout.impl.DefaultDocView; 13 14 import org.sophie2.base.layout.model.DocView; … … 189 190 mainWindow.documents().add(newView); 190 191 191 192 newView.preferredDimensions().set(preferredDimensions().get()); 193 newView.preferredLocation().set(preferredLocation().get()); 192 194 193 195 DefaultDocView.setCurrent(newView); 194 196 } … … 353 355 public RwProp<ImmSize> preferredDimensions() { 354 356 return getBean().makeValueProp("preferredDimensions", ImmSize.class, ImmSize.ZERO); 355 357 } 358 359 public RwProp<ImmPoint> preferredLocation() { 360 return getBean().makeValueProp("preferredLocation", ImmPoint.class, null); 361 } 356 362 357 363 public boolean shouldWarnOnClose() { 358 364 // When we develop sophie the confirmation dialog is slowing us. -
TabularUnified modules/org.sophie2.base.model.text/src/main/java/org/sophie2/base/model/text/mvc/TextFlowLogic.java
200 200 public boolean handle(EventR3 event) { 201 201 TextView source = event.getSource(TextView.class); 202 202 TextViewFlow flow = source.textFlow().get(); 203 if (flow == null ) {203 if (flow == null || !flow.isEditable()) { 204 204 //This TextView is no longer in the flow. 205 205 return true; 206 206 } -
TabularUnified modules/org.sophie2.base.layout/src/main/java/org/sophie2/base/layout/model/DocView.java
3 3 import javax.swing.JComponent; 4 4 5 5 import org.sophie2.base.commons.util.ImmImage; 6 import org.sophie2.base.commons.util.position.ImmPoint; 6 7 import org.sophie2.base.commons.util.position.ImmSize; 7 8 import org.sophie2.base.visual.SwingVisualElement; 8 9 import org.sophie2.core.prolib.interfaces.Prop; … … 49 50 */ 50 51 RwProp<ImmSize> preferredDimensions(); 51 52 53 /** 54 * When re-opening a window, its location should not change. This prop's purpose is to 55 * keep the last location set by the user, so that it can be transferred from window to window. 56 * 57 * @return 58 * The last location, defined by the user. 59 */ 60 RwProp<ImmPoint> preferredLocation(); 61 52 62 }