Changeset 98
- Timestamp:
- 10/11/02 14:07:36 (21 years ago)
- Location:
- trunk/j/src/org/armedbear/j
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/j/src/org/armedbear/j/Buffer.java
r94 r98 3 3 * 4 4 * Copyright (C) 1998-2002 Peter Graves 5 * $Id: Buffer.java,v 1. 6 2002-10-11 12:35:09piso Exp $5 * $Id: Buffer.java,v 1.7 2002-10-11 14:05:14 piso Exp $ 6 6 * 7 7 * This program is free software; you can redistribute it and/or … … 63 63 protected boolean supportsUndo = true; 64 64 65 private int modificationCount; 66 private int modificationCountWhenLastSaved; 67 private int modificationCountWhenLastAutosaved; 65 private int modCount; 66 private int saveModCount; // Value of modCount when last saved. 68 67 69 68 // Autosave. 70 69 protected boolean autosaveEnabled; 71 File autosaveFile; 70 private File autosaveFile; 71 private int autosaveModCount; // Value of modCount when last autosaved. 72 72 73 73 private File cache; … … 592 592 } 593 593 594 public final int getMod ificationCount()595 { 596 return mod ificationCount;597 } 598 599 public final synchronized void setMod ificationCount(int count)600 { 601 if (count != mod ificationCount) {602 mod ificationCount = count;594 public final int getModCount() 595 { 596 return modCount; 597 } 598 599 public final synchronized void setModCount(int count) 600 { 601 if (count != modCount) { 602 modCount = count; 603 603 srText = null; 604 604 } 605 605 } 606 606 607 public final synchronized void incrementMod ificationCount()608 { 609 ++mod ificationCount;607 public final synchronized void incrementModCount() 608 { 609 ++modCount; 610 610 srText = null; 611 611 } 612 612 613 public final void setMod ificationCountWhenLastSaved(int count)614 { 615 modificationCountWhenLastAutosaved= count;613 public final void setModCountWhenLastSaved(int count) 614 { 615 autosaveModCount = count; 616 616 } 617 617 … … 1749 1749 if (!Autosave.isAutosaveEnabled() || !autosaveEnabled) 1750 1750 return false; 1751 return mod ificationCount != modificationCountWhenLastAutosaved;1751 return modCount != autosaveModCount; 1752 1752 } 1753 1753 … … 1797 1797 autosaveFile.setEncoding(getFile().getEncoding()); 1798 1798 if (writeFile(autosaveFile)) 1799 modificationCountWhenLastAutosaved = modificationCount;1799 autosaveModCount = modCount; 1800 1800 else 1801 1801 Log.error("autosave writeFile failed"); … … 1823 1823 Debug.dumpStack(); 1824 1824 } 1825 if (mod ificationCount > modificationCountWhenLastSaved) {1825 if (modCount > saveModCount) { 1826 1826 // Already modified. 1827 incrementMod ificationCount();1827 incrementModCount(); 1828 1828 } else { 1829 1829 // First change. 1830 setMod ificationCount(modificationCountWhenLastSaved+ 1);1830 setModCount(saveModCount + 1); 1831 1831 Sidebar.setUpdateFlagInAllFrames(SIDEBAR_MODIFIED_BUFFER_COUNT); 1832 1832 Sidebar.repaintBufferListInAllFrames(); … … 1837 1837 public void unmodified() 1838 1838 { 1839 setMod ificationCount(0);1840 modificationCountWhenLastSaved= 0;1841 modificationCountWhenLastAutosaved= 0;1839 setModCount(0); 1840 saveModCount = 0; 1841 autosaveModCount = 0; 1842 1842 Sidebar.setUpdateFlagInAllFrames(SIDEBAR_MODIFIED_BUFFER_COUNT); 1843 1843 Sidebar.repaintBufferListInAllFrames(); … … 1846 1846 public void saved() 1847 1847 { 1848 modificationCountWhenLastSaved = modificationCount;1849 modificationCountWhenLastAutosaved = modificationCount;1848 saveModCount = modCount; 1849 autosaveModCount = modCount; 1850 1850 if (isNewFile()) { 1851 1851 for (Line line = getFirstLine(); line != null; line = line.next()) { … … 1887 1887 public boolean isModified() 1888 1888 { 1889 return mod ificationCount != modificationCountWhenLastSaved;1889 return modCount != saveModCount; 1890 1890 } 1891 1891 … … 1981 1981 public void resetUndo() 1982 1982 { 1983 if (supportsUndo) {1983 if (supportsUndo) 1984 1984 undoManager.discardAllEdits(); 1985 }1986 1985 } 1987 1986 -
trunk/j/src/org/armedbear/j/FindInFiles.java
r2 r98 3 3 * 4 4 * Copyright (C) 1998-2002 Peter Graves 5 * $Id: FindInFiles.java,v 1. 1.1.1 2002-09-24 16:09:38piso Exp $5 * $Id: FindInFiles.java,v 1.2 2002-10-11 14:07:31 piso Exp $ 6 6 * 7 7 * This program is free software; you can redistribute it and/or … … 685 685 compoundEdit.addEdit(new UndoLineEdit(buffer, pos.getLine())); 686 686 replaceOccurrence(pos); 687 buffer.incrementMod ificationCount();687 buffer.incrementModCount(); 688 688 } 689 689 compoundEdit.end(); -
trunk/j/src/org/armedbear/j/UndoDeleteLineSeparator.java
r2 r98 3 3 * 4 4 * Copyright (C) 2002 Peter Graves 5 * $Id: UndoDeleteLineSeparator.java,v 1. 1.1.1 2002-09-24 16:07:44piso Exp $5 * $Id: UndoDeleteLineSeparator.java,v 1.2 2002-10-11 14:07:33 piso Exp $ 6 6 * 7 7 * This program is free software; you can redistribute it and/or … … 97 97 absCaretCol = editor.getAbsoluteCaretCol(); 98 98 final Buffer buffer = editor.getBuffer(); 99 modificationCount = buffer.getMod ificationCount();99 modificationCount = buffer.getModCount(); 100 100 modified = buffer.isModified(); 101 101 first = dotLine.copy(); … … 122 122 // Markers!! 123 123 124 buffer.setMod ificationCount(modificationCount);124 buffer.setModCount(modificationCount); 125 125 126 126 buffer.needsRenumbering = true; … … 150 150 absCaretCol = editor.getAbsoluteCaretCol(); 151 151 final Buffer buffer = editor.getBuffer(); 152 modificationCount = buffer.getMod ificationCount();152 modificationCount = buffer.getModCount(); 153 153 modified = buffer.isModified(); 154 154 line = dotLine.copy(); … … 173 173 // Markers!! 174 174 175 buffer.setMod ificationCount(modificationCount);175 buffer.setModCount(modificationCount); 176 176 177 177 buffer.needsRenumbering = true; -
trunk/j/src/org/armedbear/j/UndoDeleteRegion.java
r2 r98 3 3 * 4 4 * Copyright (C) 2002 Peter Graves 5 * $Id: UndoDeleteRegion.java,v 1. 1.1.1 2002-09-24 16:08:25piso Exp $5 * $Id: UndoDeleteRegion.java,v 1.2 2002-10-11 14:07:33 piso Exp $ 6 6 * 7 7 * This program is free software; you can redistribute it and/or … … 108 108 } 109 109 final Buffer buffer = editor.getBuffer(); 110 modificationCount = buffer.getMod ificationCount();110 modificationCount = buffer.getModCount(); 111 111 modified = buffer.isModified(); 112 112 } … … 134 134 after.setPrevious(last); 135 135 136 buffer.setMod ificationCount(modificationCount);136 buffer.setModCount(modificationCount); 137 137 138 138 buffer.needsRenumbering = true; … … 163 163 absCaretCol = editor.getAbsoluteCaretCol(); 164 164 final Buffer buffer = editor.getBuffer(); 165 modificationCount = buffer.getMod ificationCount();165 modificationCount = buffer.getModCount(); 166 166 modified = buffer.isModified(); 167 167 line = dotLine.copy(); … … 192 192 // Markers!! 193 193 194 buffer.setMod ificationCount(modificationCount);194 buffer.setModCount(modificationCount); 195 195 196 196 buffer.needsRenumbering = true; -
trunk/j/src/org/armedbear/j/UndoInsertLineSeparator.java
r2 r98 3 3 * 4 4 * Copyright (C) 2002 Peter Graves 5 * $Id: UndoInsertLineSeparator.java,v 1. 1.1.1 2002-09-24 16:08:48piso Exp $5 * $Id: UndoInsertLineSeparator.java,v 1.2 2002-10-11 14:07:34 piso Exp $ 6 6 * 7 7 * This program is free software; you can redistribute it and/or … … 97 97 absCaretCol = editor.getAbsoluteCaretCol(); 98 98 final Buffer buffer = editor.getBuffer(); 99 modificationCount = buffer.getMod ificationCount();99 modificationCount = buffer.getModCount(); 100 100 modified = buffer.isModified(); 101 101 line = editor.getDotLine().copy(); … … 121 121 // Markers!! 122 122 123 buffer.setMod ificationCount(modificationCount);123 buffer.setModCount(modificationCount); 124 124 125 125 buffer.needsRenumbering = true; … … 151 151 absCaretCol = editor.getAbsoluteCaretCol(); 152 152 final Buffer buffer = editor.getBuffer(); 153 modificationCount = buffer.getMod ificationCount();153 modificationCount = buffer.getModCount(); 154 154 modified = buffer.isModified(); 155 155 second = dotLine.copy(); … … 176 176 // Markers!! 177 177 178 buffer.setMod ificationCount(modificationCount);178 buffer.setModCount(modificationCount); 179 179 180 180 buffer.needsRenumbering = true; -
trunk/j/src/org/armedbear/j/UndoInsertString.java
r2 r98 3 3 * 4 4 * Copyright (C) 2002 Peter Graves 5 * $Id: UndoInsertString.java,v 1. 1.1.1 2002-09-24 16:09:28piso Exp $5 * $Id: UndoInsertString.java,v 1.2 2002-10-11 14:07:34 piso Exp $ 6 6 * 7 7 * This program is free software; you can redistribute it and/or … … 99 99 absCaretCol = editor.getAbsoluteCaretCol(); 100 100 isColumnSelection = editor.isColumnSelection(); 101 modificationCount = buffer.getMod ificationCount();101 modificationCount = buffer.getModCount(); 102 102 modified = buffer.isModified(); 103 103 line = editor.getDotLine().copy(); … … 132 132 buffer.repaint(); 133 133 } 134 buffer.setMod ificationCount(modificationCount);134 buffer.setModCount(modificationCount); 135 135 editor.setDot(dotLineNumber, dotOffset); 136 136 editor.setMark(null); … … 165 165 absCaretCol = editor.getAbsoluteCaretCol(); 166 166 isColumnSelection = editor.isColumnSelection(); 167 modificationCount = editor.getBuffer().getMod ificationCount();167 modificationCount = editor.getBuffer().getModCount(); 168 168 modified = editor.getBuffer().isModified(); 169 169 } … … 191 191 buffer.repaint(); 192 192 } 193 buffer.setMod ificationCount(modificationCount);193 buffer.setModCount(modificationCount); 194 194 editor.setDot(dotLineNumber, dotOffset); 195 195 editor.setMark(null); -
trunk/j/src/org/armedbear/j/UndoLineEdit.java
r2 r98 3 3 * 4 4 * Copyright (C) 2002 Peter Graves 5 * $Id: UndoLineEdit.java,v 1. 1.1.1 2002-09-24 16:09:17piso Exp $5 * $Id: UndoLineEdit.java,v 1.2 2002-10-11 14:07:35 piso Exp $ 6 6 * 7 7 * This program is free software; you can redistribute it and/or … … 128 128 isColumnSelection = editor.isColumnSelection(); 129 129 final Buffer buffer = editor.getBuffer(); 130 modificationCount = buffer.getMod ificationCount();130 modificationCount = buffer.getModCount(); 131 131 modified = buffer.isModified(); 132 132 line = buffer.getLine(changeLineNumber).copy(); … … 141 141 markOffset = -1; 142 142 isColumnSelection = false; 143 modificationCount = buffer.getMod ificationCount();143 modificationCount = buffer.getModCount(); 144 144 modified = buffer.isModified(); 145 145 line = buffer.getLine(changeLineNumber).copy(); … … 157 157 Editor.updateInAllEditors(changeLine); 158 158 159 buffer.setMod ificationCount(modificationCount);159 buffer.setModCount(modificationCount); 160 160 161 161 boolean wasMarked = editor.getMark() != null; -
trunk/j/src/org/armedbear/j/UndoRemoveLine.java
r2 r98 3 3 * 4 4 * Copyright (C) 2002 Peter Graves 5 * $Id: UndoRemoveLine.java,v 1. 1.1.1 2002-09-24 16:08:29piso Exp $5 * $Id: UndoRemoveLine.java,v 1.2 2002-10-11 14:07:35 piso Exp $ 6 6 * 7 7 * This program is free software; you can redistribute it and/or … … 101 101 absCaretCol = editor.getAbsoluteCaretCol(); 102 102 final Buffer buffer = editor.getBuffer(); 103 modificationCount = buffer.getMod ificationCount();103 modificationCount = buffer.getModCount(); 104 104 modified = buffer.isModified(); 105 105 … … 131 131 // Markers!! 132 132 133 buffer.setMod ificationCount(modificationCount);133 buffer.setModCount(modificationCount); 134 134 buffer.needsRenumbering = true; 135 135 buffer.renumber(); … … 155 155 absCaretCol = editor.getAbsoluteCaretCol(); 156 156 final Buffer buffer = editor.getBuffer(); 157 modificationCount = buffer.getMod ificationCount();157 modificationCount = buffer.getModCount(); 158 158 modified = buffer.isModified(); 159 159 } … … 183 183 // Markers!! 184 184 185 buffer.setMod ificationCount(modificationCount);185 buffer.setModCount(modificationCount); 186 186 buffer.needsRenumbering = true; 187 187 buffer.renumber(); -
trunk/j/src/org/armedbear/j/WrapText.java
r61 r98 3 3 * 4 4 * Copyright (C) 1998-2002 Peter Graves 5 * $Id: WrapText.java,v 1. 2 2002-10-06 00:10:09piso Exp $5 * $Id: WrapText.java,v 1.3 2002-10-11 14:07:35 piso Exp $ 6 6 * 7 7 * This program is free software; you can redistribute it and/or … … 183 183 int offsetBefore = buffer.getAbsoluteOffset(dot); 184 184 185 int originalModificationCount = buffer.getMod ificationCount();185 int originalModificationCount = buffer.getModCount(); 186 186 187 187 // Save undo information before detabbing region (which may also move … … 333 333 334 334 // Buffer has not been modified. 335 buffer.setMod ificationCount(originalModificationCount);335 buffer.setModCount(originalModificationCount); 336 336 return; 337 337 } -
trunk/j/src/org/armedbear/j/XmlTree.java
r24 r98 3 3 * 4 4 * Copyright (C) 2000-2002 Peter Graves 5 * $Id: XmlTree.java,v 1. 2 2002-10-02 16:36:16 piso Exp $5 * $Id: XmlTree.java,v 1.3 2002-10-11 14:07:36 piso Exp $ 6 6 * 7 7 * This program is free software; you can redistribute it and/or … … 95 95 if (!SwingUtilities.isEventDispatchThread()) 96 96 Debug.bug("XmlTree.refresh() called from background thread!"); 97 if (modificationCount == buffer.getMod ificationCount())97 if (modificationCount == buffer.getModCount()) 98 98 return; 99 99 final XmlParserImpl parser = new XmlParserImpl(); … … 101 101 return; 102 102 parser.setBuffer(buffer); 103 modificationCount = buffer.getMod ificationCount();103 modificationCount = buffer.getModCount(); 104 104 final String text = buffer.getText(); 105 105 if (text.length() < 7) // "<a></a>"
Note: See TracChangeset
for help on using the changeset viewer.