Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added a read-only mode for which privileged files will default to.

Fixed a memory leak in [HFFileReference writeBytes.]
Changed key equivalent for overwrite mode to something that doesn't clash.
Fixed it so that character and block devices will not allow you to be in insert mode.
  • Loading branch information...
commit bf32c661a972b44086e49059abcd987207146fb7 1 parent 5c2327b
Chris Suter authored
View
653 English.lproj/MainMenu.xib
@@ -474,14 +474,47 @@
<reference key="NSOnImage" ref="171599450"/>
<reference key="NSMixedImage" ref="491729860"/>
</object>
- <object class="NSMenuItem" id="320074869">
+ <object class="NSMenuItem" id="272344617">
<reference key="NSMenu" ref="789758025"/>
- <string key="NSTitle">Overwrite Mode</string>
- <string key="NSKeyEquiv">o</string>
- <int key="NSKeyEquivModMask">1572864</int>
+ <string key="NSTitle">Mode</string>
+ <string key="NSKeyEquiv"/>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="171599450"/>
<reference key="NSMixedImage" ref="491729860"/>
+ <string key="NSAction">submenuAction:</string>
+ <object class="NSMenu" key="NSSubmenu" id="62561926">
+ <string key="NSTitle">Mode</string>
+ <object class="NSMutableArray" key="NSMenuItems">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSMenuItem" id="285196700">
+ <reference key="NSMenu" ref="62561926"/>
+ <string key="NSTitle">Read-only</string>
+ <string key="NSKeyEquiv">R</string>
+ <int key="NSKeyEquivModMask">1048576</int>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <reference key="NSOnImage" ref="171599450"/>
+ <reference key="NSMixedImage" ref="491729860"/>
+ </object>
+ <object class="NSMenuItem" id="320074869">
+ <reference key="NSMenu" ref="62561926"/>
+ <string key="NSTitle">Overwrite</string>
+ <string key="NSKeyEquiv">O</string>
+ <int key="NSKeyEquivModMask">1048576</int>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <reference key="NSOnImage" ref="171599450"/>
+ <reference key="NSMixedImage" ref="491729860"/>
+ </object>
+ <object class="NSMenuItem" id="385733532">
+ <reference key="NSMenu" ref="62561926"/>
+ <string key="NSTitle">Insert</string>
+ <string key="NSKeyEquiv">I</string>
+ <int key="NSKeyEquivModMask">1048576</int>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <reference key="NSOnImage" ref="171599450"/>
+ <reference key="NSMixedImage" ref="491729860"/>
+ </object>
+ </object>
+ </object>
</object>
<object class="NSMenuItem" id="212016141">
<reference key="NSMenu" ref="789758025"/>
@@ -1710,14 +1743,6 @@
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
- <string key="label">toggleOverwriteMode:</string>
- <reference key="source" ref="1014"/>
- <reference key="destination" ref="320074869"/>
- </object>
- <int key="connectionID">469</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
<string key="label">toggleVisibleControllerView:</string>
<reference key="source" ref="1014"/>
<reference key="destination" ref="73626741"/>
@@ -1909,6 +1934,30 @@
<int key="connectionID">713</int>
</object>
<object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">setOverwriteMode:</string>
+ <reference key="source" ref="1014"/>
+ <reference key="destination" ref="320074869"/>
+ </object>
+ <int key="connectionID">726</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">setInsertMode:</string>
+ <reference key="source" ref="1014"/>
+ <reference key="destination" ref="385733532"/>
+ </object>
+ <int key="connectionID">727</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">setReadOnlyMode:</string>
+ <reference key="source" ref="1014"/>
+ <reference key="destination" ref="285196700"/>
+ </object>
+ <int key="connectionID">728</int>
+ </object>
+ <object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">extendForwardsItem</string>
<reference key="source" ref="449992897"/>
@@ -2232,8 +2281,8 @@
<reference ref="194621016"/>
<reference ref="761163590"/>
<reference ref="750048265"/>
- <reference ref="320074869"/>
<reference ref="627409932"/>
+ <reference ref="272344617"/>
</object>
<reference key="parent" ref="952259628"/>
</object>
@@ -2631,11 +2680,6 @@
<reference key="parent" ref="789758025"/>
</object>
<object class="IBObjectRecord">
- <int key="objectID">467</int>
- <reference key="object" ref="320074869"/>
- <reference key="parent" ref="789758025"/>
- </object>
- <object class="IBObjectRecord">
<int key="objectID">468</int>
<reference key="object" ref="627409932"/>
<reference key="parent" ref="789758025"/>
@@ -2971,6 +3015,41 @@
<reference key="object" ref="305889989"/>
<reference key="parent" ref="0"/>
</object>
+ <object class="IBObjectRecord">
+ <int key="objectID">722</int>
+ <reference key="object" ref="272344617"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="62561926"/>
+ </object>
+ <reference key="parent" ref="789758025"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">723</int>
+ <reference key="object" ref="62561926"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="385733532"/>
+ <reference ref="320074869"/>
+ <reference ref="285196700"/>
+ </object>
+ <reference key="parent" ref="272344617"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">724</int>
+ <reference key="object" ref="385733532"/>
+ <reference key="parent" ref="62561926"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">467</int>
+ <reference key="object" ref="320074869"/>
+ <reference key="parent" ref="62561926"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">725</int>
+ <reference key="object" ref="285196700"/>
+ <reference key="parent" ref="62561926"/>
+ </object>
</object>
</object>
<object class="NSMutableDictionary" key="flattenedProperties">
@@ -3106,6 +3185,10 @@
<string>714.IBPluginDependency</string>
<string>717.IBPluginDependency</string>
<string>72.IBPluginDependency</string>
+ <string>722.IBPluginDependency</string>
+ <string>723.IBPluginDependency</string>
+ <string>724.IBPluginDependency</string>
+ <string>725.IBPluginDependency</string>
<string>73.IBPluginDependency</string>
<string>74.IBPluginDependency</string>
<string>75.IBPluginDependency</string>
@@ -3260,6 +3343,10 @@
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
</object>
</object>
<object class="NSMutableDictionary" key="unlocalizedProperties">
@@ -3274,333 +3361,12 @@
<reference key="dict.values" ref="0"/>
</object>
<nil key="sourceID"/>
- <int key="maxID">721</int>
+ <int key="maxID">728</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBPartialClassDescription">
- <string key="className">AppDelegate</string>
- <string key="superclassName">NSObject</string>
- <object class="NSMutableDictionary" key="actions">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>diffFrontDocuments:</string>
- <string>setStringEncodingFromMenuItem:</string>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>id</string>
- <string>NSMenuItem</string>
- </object>
- </object>
- <object class="NSMutableDictionary" key="actionInfosByName">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>diffFrontDocuments:</string>
- <string>setStringEncodingFromMenuItem:</string>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="IBActionInfo">
- <string key="name">diffFrontDocuments:</string>
- <string key="candidateClassName">id</string>
- </object>
- <object class="IBActionInfo">
- <string key="name">setStringEncodingFromMenuItem:</string>
- <string key="candidateClassName">NSMenuItem</string>
- </object>
- </object>
- </object>
- <object class="NSMutableDictionary" key="outlets">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>bookmarksMenu</string>
- <string>extendBackwardsItem</string>
- <string>extendForwardsItem</string>
- <string>fontMenuItem</string>
- <string>processListMenuItem</string>
- <string>stringEncodingMenu</string>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>NSMenu</string>
- <string>NSMenuItem</string>
- <string>NSMenuItem</string>
- <string>NSMenuItem</string>
- <string>NSMenuItem</string>
- <string>NSMenu</string>
- </object>
- </object>
- <object class="NSMutableDictionary" key="toOneOutletInfosByName">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>bookmarksMenu</string>
- <string>extendBackwardsItem</string>
- <string>extendForwardsItem</string>
- <string>fontMenuItem</string>
- <string>processListMenuItem</string>
- <string>stringEncodingMenu</string>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="IBToOneOutletInfo">
- <string key="name">bookmarksMenu</string>
- <string key="candidateClassName">NSMenu</string>
- </object>
- <object class="IBToOneOutletInfo">
- <string key="name">extendBackwardsItem</string>
- <string key="candidateClassName">NSMenuItem</string>
- </object>
- <object class="IBToOneOutletInfo">
- <string key="name">extendForwardsItem</string>
- <string key="candidateClassName">NSMenuItem</string>
- </object>
- <object class="IBToOneOutletInfo">
- <string key="name">fontMenuItem</string>
- <string key="candidateClassName">NSMenuItem</string>
- </object>
- <object class="IBToOneOutletInfo">
- <string key="name">processListMenuItem</string>
- <string key="candidateClassName">NSMenuItem</string>
- </object>
- <object class="IBToOneOutletInfo">
- <string key="name">stringEncodingMenu</string>
- <string key="candidateClassName">NSMenu</string>
- </object>
- </object>
- </object>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">./Classes/AppDelegate.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">BaseDataDocument</string>
- <string key="superclassName">NSDocument</string>
- <object class="NSMutableDictionary" key="actions">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>decreaseFontSize:</string>
- <string>deleteBookmark:</string>
- <string>findNext:</string>
- <string>findPrevious:</string>
- <string>increaseFontSize:</string>
- <string>modifyByteGrouping:</string>
- <string>moveSelectionByAction:</string>
- <string>performFindReplaceActionFromSelectedSegment:</string>
- <string>replace:</string>
- <string>replaceAll:</string>
- <string>replaceAndFind:</string>
- <string>setAntialiasFromMenuItem:</string>
- <string>setBookmark:</string>
- <string>setStringEncodingFromMenuItem:</string>
- <string>showFontPanel:</string>
- <string>toggleOverwriteMode:</string>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>NSMenuItem</string>
- <string>id</string>
- <string>id</string>
- </object>
- </object>
- <object class="NSMutableDictionary" key="actionInfosByName">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>decreaseFontSize:</string>
- <string>deleteBookmark:</string>
- <string>findNext:</string>
- <string>findPrevious:</string>
- <string>increaseFontSize:</string>
- <string>modifyByteGrouping:</string>
- <string>moveSelectionByAction:</string>
- <string>performFindReplaceActionFromSelectedSegment:</string>
- <string>replace:</string>
- <string>replaceAll:</string>
- <string>replaceAndFind:</string>
- <string>setAntialiasFromMenuItem:</string>
- <string>setBookmark:</string>
- <string>setStringEncodingFromMenuItem:</string>
- <string>showFontPanel:</string>
- <string>toggleOverwriteMode:</string>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="IBActionInfo">
- <string key="name">decreaseFontSize:</string>
- <string key="candidateClassName">id</string>
- </object>
- <object class="IBActionInfo">
- <string key="name">deleteBookmark:</string>
- <string key="candidateClassName">id</string>
- </object>
- <object class="IBActionInfo">
- <string key="name">findNext:</string>
- <string key="candidateClassName">id</string>
- </object>
- <object class="IBActionInfo">
- <string key="name">findPrevious:</string>
- <string key="candidateClassName">id</string>
- </object>
- <object class="IBActionInfo">
- <string key="name">increaseFontSize:</string>
- <string key="candidateClassName">id</string>
- </object>
- <object class="IBActionInfo">
- <string key="name">modifyByteGrouping:</string>
- <string key="candidateClassName">id</string>
- </object>
- <object class="IBActionInfo">
- <string key="name">moveSelectionByAction:</string>
- <string key="candidateClassName">id</string>
- </object>
- <object class="IBActionInfo">
- <string key="name">performFindReplaceActionFromSelectedSegment:</string>
- <string key="candidateClassName">id</string>
- </object>
- <object class="IBActionInfo">
- <string key="name">replace:</string>
- <string key="candidateClassName">id</string>
- </object>
- <object class="IBActionInfo">
- <string key="name">replaceAll:</string>
- <string key="candidateClassName">id</string>
- </object>
- <object class="IBActionInfo">
- <string key="name">replaceAndFind:</string>
- <string key="candidateClassName">id</string>
- </object>
- <object class="IBActionInfo">
- <string key="name">setAntialiasFromMenuItem:</string>
- <string key="candidateClassName">id</string>
- </object>
- <object class="IBActionInfo">
- <string key="name">setBookmark:</string>
- <string key="candidateClassName">id</string>
- </object>
- <object class="IBActionInfo">
- <string key="name">setStringEncodingFromMenuItem:</string>
- <string key="candidateClassName">NSMenuItem</string>
- </object>
- <object class="IBActionInfo">
- <string key="name">showFontPanel:</string>
- <string key="candidateClassName">id</string>
- </object>
- <object class="IBActionInfo">
- <string key="name">toggleOverwriteMode:</string>
- <string key="candidateClassName">id</string>
- </object>
- </object>
- </object>
- <object class="NSMutableDictionary" key="outlets">
- <string key="NS.key.0">containerView</string>
- <string key="NS.object.0">NSSplitView</string>
- </object>
- <object class="NSMutableDictionary" key="toOneOutletInfosByName">
- <string key="NS.key.0">containerView</string>
- <object class="IBToOneOutletInfo" key="NS.object.0">
- <string key="name">containerView</string>
- <string key="candidateClassName">NSSplitView</string>
- </object>
- </object>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">./Classes/BaseDataDocument.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">ChooseStringEncodingWindowController</string>
- <string key="superclassName">NSWindowController</string>
- <object class="NSMutableDictionary" key="actions">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>OKButtonClicked:</string>
- <string>openCFStringHeaderClicked:</string>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>id</string>
- <string>id</string>
- </object>
- </object>
- <object class="NSMutableDictionary" key="actionInfosByName">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>OKButtonClicked:</string>
- <string>openCFStringHeaderClicked:</string>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="IBActionInfo">
- <string key="name">OKButtonClicked:</string>
- <string key="candidateClassName">id</string>
- </object>
- <object class="IBActionInfo">
- <string key="name">openCFStringHeaderClicked:</string>
- <string key="candidateClassName">id</string>
- </object>
- </object>
- </object>
- <object class="NSMutableDictionary" key="outlets">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>encodingField</string>
- <string>okButton</string>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>NSComboBox</string>
- <string>NSButton</string>
- </object>
- </object>
- <object class="NSMutableDictionary" key="toOneOutletInfosByName">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>encodingField</string>
- <string>okButton</string>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="IBToOneOutletInfo">
- <string key="name">encodingField</string>
- <string key="candidateClassName">NSComboBox</string>
- </object>
- <object class="IBToOneOutletInfo">
- <string key="name">okButton</string>
- <string key="candidateClassName">NSButton</string>
- </object>
- </object>
- </object>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">./Classes/ChooseStringEncodingWindowController.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
<string key="className">FirstResponder</string>
<object class="NSMutableDictionary" key="actions">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -3744,209 +3510,6 @@
<string key="minorKey"/>
</object>
</object>
- <object class="IBPartialClassDescription">
- <string key="className">HFController</string>
- <string key="superclassName">NSObject</string>
- <object class="NSMutableDictionary" key="actions">
- <string key="NS.key.0">selectAll:</string>
- <string key="NS.object.0">id</string>
- </object>
- <object class="NSMutableDictionary" key="actionInfosByName">
- <string key="NS.key.0">selectAll:</string>
- <object class="IBActionInfo" key="NS.object.0">
- <string key="name">selectAll:</string>
- <string key="candidateClassName">id</string>
- </object>
- </object>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">./Classes/HFController.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">HFRepresenterTextView</string>
- <string key="superclassName">NSView</string>
- <object class="NSMutableDictionary" key="actions">
- <string key="NS.key.0">selectAll:</string>
- <string key="NS.object.0">id</string>
- </object>
- <object class="NSMutableDictionary" key="actionInfosByName">
- <string key="NS.key.0">selectAll:</string>
- <object class="IBActionInfo" key="NS.object.0">
- <string key="name">selectAll:</string>
- <string key="candidateClassName">id</string>
- </object>
- </object>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">./Classes/HFRepresenterTextView.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSDocument</string>
- <object class="NSMutableDictionary" key="actions">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>printDocument:</string>
- <string>revertDocumentToSaved:</string>
- <string>runPageLayout:</string>
- <string>saveDocument:</string>
- <string>saveDocumentAs:</string>
- <string>saveDocumentTo:</string>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- </object>
- </object>
- <object class="NSMutableDictionary" key="actionInfosByName">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>printDocument:</string>
- <string>revertDocumentToSaved:</string>
- <string>runPageLayout:</string>
- <string>saveDocument:</string>
- <string>saveDocumentAs:</string>
- <string>saveDocumentTo:</string>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="IBActionInfo">
- <string key="name">printDocument:</string>
- <string key="candidateClassName">id</string>
- </object>
- <object class="IBActionInfo">
- <string key="name">revertDocumentToSaved:</string>
- <string key="candidateClassName">id</string>
- </object>
- <object class="IBActionInfo">
- <string key="name">runPageLayout:</string>
- <string key="candidateClassName">id</string>
- </object>
- <object class="IBActionInfo">
- <string key="name">saveDocument:</string>
- <string key="candidateClassName">id</string>
- </object>
- <object class="IBActionInfo">
- <string key="name">saveDocumentAs:</string>
- <string key="candidateClassName">id</string>
- </object>
- <object class="IBActionInfo">
- <string key="name">saveDocumentTo:</string>
- <string key="candidateClassName">id</string>
- </object>
- </object>
- </object>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">./Classes/NSDocument.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">OpenPathWindowController</string>
- <string key="superclassName">NSWindowController</string>
- <object class="NSMutableDictionary" key="actions">
- <string key="NS.key.0">openPathOKButtonClicked:</string>
- <string key="NS.object.0">id</string>
- </object>
- <object class="NSMutableDictionary" key="actionInfosByName">
- <string key="NS.key.0">openPathOKButtonClicked:</string>
- <object class="IBActionInfo" key="NS.object.0">
- <string key="name">openPathOKButtonClicked:</string>
- <string key="candidateClassName">id</string>
- </object>
- </object>
- <object class="NSMutableDictionary" key="outlets">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>iconView</string>
- <string>okButton</string>
- <string>pathField</string>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>NSImageView</string>
- <string>NSButton</string>
- <string>NSTextField</string>
- </object>
- </object>
- <object class="NSMutableDictionary" key="toOneOutletInfosByName">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>iconView</string>
- <string>okButton</string>
- <string>pathField</string>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="IBToOneOutletInfo">
- <string key="name">iconView</string>
- <string key="candidateClassName">NSImageView</string>
- </object>
- <object class="IBToOneOutletInfo">
- <string key="name">okButton</string>
- <string key="candidateClassName">NSButton</string>
- </object>
- <object class="IBToOneOutletInfo">
- <string key="name">pathField</string>
- <string key="candidateClassName">NSTextField</string>
- </object>
- </object>
- </object>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">./Classes/OpenPathWindowController.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">ProcessList</string>
- <string key="superclassName">NSObject</string>
- <object class="NSMutableDictionary" key="actions">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>openProcess:</string>
- <string>openProcessByProcessMenuItem:</string>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>id</string>
- <string>id</string>
- </object>
- </object>
- <object class="NSMutableDictionary" key="actionInfosByName">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>openProcess:</string>
- <string>openProcessByProcessMenuItem:</string>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="IBActionInfo">
- <string key="name">openProcess:</string>
- <string key="candidateClassName">id</string>
- </object>
- <object class="IBActionInfo">
- <string key="name">openProcessByProcessMenuItem:</string>
- <string key="candidateClassName">id</string>
- </object>
- </object>
- </object>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">./Classes/ProcessList.h</string>
- </object>
- </object>
</object>
</object>
<int key="IBDocument.localizationMode">0</int>
@@ -3955,10 +3518,6 @@
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.macosx</string>
<real value="1060" key="NS.object.0"/>
</object>
- <object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencyDefaults">
- <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.macosx</string>
- <real value="1060" key="NS.object.0"/>
- </object>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3</string>
<integer value="3000" key="NS.object.0"/>
View
2  app/sources/AppDelegate.m
@@ -14,8 +14,6 @@
#include <stdbool.h>
#include <stdlib.h>
#include <stdio.h>
-#include <xpc/connection.h>
-#include <syslog.h>
@implementation AppDelegate
View
8 app/sources/BaseDataDocument.h
@@ -47,7 +47,7 @@ NSString * const BaseDataDocumentDidChangeStringEncodingNotification;
BOOL saveInProgress;
BOOL currentlySettingFont;
- BOOL isTransient;
+ BOOL isTransient;
}
- (void)moveSelectionForwards:(NSMenuItem *)sender;
@@ -74,7 +74,9 @@ NSString * const BaseDataDocumentDidChangeStringEncodingNotification;
- (IBAction)replaceAll:sender;
- (IBAction)performFindReplaceActionFromSelectedSegment:(id)sender;
-- (IBAction)toggleOverwriteMode:sender;
+- (IBAction)setOverwriteMode:sender;
+- (IBAction)setInsertMode:sender;
+- (IBAction)setReadOnlyMode:sender;
- (IBAction)modifyByteGrouping:sender;
- (IBAction)setBookmark:sender;
@@ -102,4 +104,6 @@ NSString * const BaseDataDocumentDidChangeStringEncodingNotification;
/* Returns a string identifier used as an NSUserDefault prefix for storing the layout for documents of this type. If you return nil, the layout will not be stored. The default is to return the class name. */
+ (NSString *)layoutUserDefaultIdentifier;
+- (BOOL)requiresOverwriteMode;
+
@end
View
58 app/sources/BaseDataDocument.m
@@ -266,11 +266,18 @@ - (NSArray *)runningOperationViews {
/* Return a format string that can take one argument which is the document name. */
- (NSString *)documentWindowTitleFormatString {
NSMutableString *result = [NSMutableString stringWithString:@"%@"]; //format specifier that is replaced with document name
-
- if ([controller inOverwriteMode]) {
- [result appendString:@" **OVERWRITE MODE**"];
+
+ switch ([controller editMode]) {
+ case HFInsertMode:
+ break;
+ case HFOverwriteMode:
+ [result appendString:NSLocalizedString(@" **OVERWRITE MODE**", @"Title Suffix")];
+ break;
+ case HFReadOnlyMode:
+ [result appendString:NSLocalizedString(@" **READ-ONLY MODE**", @"Title Suffix")];
+ break;
}
-
+
BOOL hasAppendedProgressMarker = NO;
NSArray *runningViews = [self runningOperationViews];
FOREACH(HFDocumentOperationView *, view, runningViews) {
@@ -789,10 +796,18 @@ - (BOOL)validateMenuItem:(NSMenuItem *)item {
[item setState:[controller shouldAntialias]];
return YES;
}
- else if (action == @selector(toggleOverwriteMode:)) {
- [item setState:[controller inOverwriteMode]];
+ else if (action == @selector(setOverwriteMode:)) {
+ [item setState:[controller editMode] == HFOverwriteMode];
/* We can toggle overwrite mode only if the controller doesn't require that it be on */
- return ! [controller requiresOverwriteMode];
+ return YES;
+ }
+ else if (action == @selector(setInsertMode:)) {
+ [item setState:[controller editMode] == HFInsertMode];
+ return ![self requiresOverwriteMode];
+ }
+ else if (action == @selector(setReadOnlyMode:)) {
+ [item setState:[controller editMode] == HFReadOnlyMode];
+ return YES;
}
else if (action == @selector(modifyByteGrouping:)) {
[item setState:(NSUInteger)[item tag] == [controller bytesPerColumn]];
@@ -814,7 +829,13 @@ - (BOOL)validateMenuItem:(NSMenuItem *)item {
[item setTitle:newTitle];
return selectedBookmark != NSNotFound;
}
- else return [super validateMenuItem:item];
+ else if (action == @selector(saveDocument:)) {
+ if ([controller editMode] == HFReadOnlyMode)
+ return NO;
+ // Fall through
+ }
+
+ return [super validateMenuItem:item];
}
- (void)finishedAnimation {
@@ -1603,12 +1624,24 @@ - (IBAction)modifyByteGrouping:sender {
[[NSUserDefaults standardUserDefaults] setInteger:newBytesPerColumn forKey:@"BytesPerColumn"];
}
-- (IBAction)toggleOverwriteMode:sender {
+- (IBAction)setOverwriteMode:sender {
USE(sender);
- [controller setInOverwriteMode:![controller inOverwriteMode]];
+ [controller setEditMode:HFOverwriteMode];
[self updateDocumentWindowTitle];
}
+- (IBAction)setInsertMode:sender {
+ USE(sender);
+ [controller setEditMode:HFInsertMode];
+ [self updateDocumentWindowTitle];
+}
+
+- (IBAction)setReadOnlyMode:sender {
+ USE(sender);
+ [controller setEditMode:HFReadOnlyMode];
+ [self updateDocumentWindowTitle];
+}
+
- (void)jumpToBookmarkIndex:(NSInteger)bookmark selecting:(BOOL)select {
if (controller) {
HFRange range = [controller rangeForBookmark:bookmark];
@@ -1775,4 +1808,9 @@ + (void)prepareForChangeInFileByBreakingFileDependencies:(NSNotification *)note
[allDocuments release];
}
+- (BOOL)requiresOverwriteMode
+{
+ return NO;
+}
+
@end
View
2  app/sources/FileDataDocument.h
@@ -8,7 +8,7 @@
#import "BaseDataDocument.h"
@interface FileDataDocument : BaseDataDocument {
-
+ BOOL requiresOverwriteMode;
}
@end
View
19 app/sources/FileDataDocument.m
@@ -31,12 +31,23 @@ - (BOOL)readFromURL:(NSURL *)absoluteURL ofType:(NSString *)typeName error:(NSEr
[controller setByteArray:byteArray];
result = YES;
- // If the file is > 64 MB in size, default to starting in overwrite mode
- if ([fileReference length] > 64 * 1024 * 1024)
- [controller setInOverwriteMode:YES];
-
+ if ([fileReference isPrivileged])
+ [controller setEditMode:HFReadOnlyMode];
+ else {
+ // If the file is > 64 MB in size, default to starting in overwrite mode
+ if ([fileReference length] > 64 * 1024 * 1024)
+ [controller setEditMode:HFOverwriteMode];
+ }
}
+
+ requiresOverwriteMode = [fileReference isFixedLength];
+
return result;
}
+- (BOOL)requiresOverwriteMode
+{
+ return requiresOverwriteMode;
+}
+
@end
View
25 framework/sources/HFController.h
@@ -75,6 +75,16 @@ enum
};
typedef NSInteger HFControllerMovementGranularity;
+/*! @enum HFEditMode
+
+HFEditMode enumerates the different edit modes that a document might be in.
+ */
+typedef enum {
+ HFInsertMode,
+ HFOverwriteMode,
+ HFReadOnlyMode,
+} HFEditMode;
+
/*! @class HFController
@brief A central class that acts as the controller layer for HexFiend.framework
@@ -122,7 +132,7 @@ You create an HFController via <tt>[[HFController alloc] init]</tt>. After that
struct {
unsigned antialias:1;
- unsigned overwriteMode:1;
+ HFEditMode editMode:2;
unsigned editable:1;
unsigned selectable:1;
unsigned selectionInProgress:1;
@@ -240,18 +250,13 @@ You create an HFController via <tt>[[HFController alloc] init]</tt>. After that
- (NSUInteger)bytesPerColumn;
//@}
-/*! @name Overwrite mode
- Determines whether text insertion overwrites subsequent text or not. */
+/*! @name Edit Mode
+ Determines what mode we're in, read-only, overwrite or insert. */
//@{
-/*! Determines whether this HFController is in overwrite mode or not. */
-- (BOOL)inOverwriteMode;
-
-/*! Sets whether we this HFController is in overwrite mode or not. */
-- (void)setInOverwriteMode:(BOOL)val;
+- (HFEditMode)editMode;
-/*! Returns YES if we must be in overwrite mode (because our backing data cannot have its size changed) */
-- (BOOL)requiresOverwriteMode;
+- (void)setEditMode:(HFEditMode)val;
//@}
View
45 framework/sources/HFController.m
@@ -128,7 +128,7 @@ - (void)encodeWithCoder:(NSCoder *)coder {
[coder encodeObject:font forKey:@"HFFont"];
[coder encodeDouble:lineHeight forKey:@"HFLineHeight"];
[coder encodeBool:_hfflags.antialias forKey:@"HFAntialias"];
- [coder encodeBool:_hfflags.overwriteMode forKey:@"HFOverwriteMode"];
+ [coder encodeInt:_hfflags.editMode forKey:@"HFEditMode"];
[coder encodeBool:_hfflags.editable forKey:@"HFEditable"];
[coder encodeBool:_hfflags.selectable forKey:@"HFSelectable"];
}
@@ -142,7 +142,14 @@ - (id)initWithCoder:(NSCoder *)coder {
font = [[coder decodeObjectForKey:@"HFFont"] retain];
lineHeight = (CGFloat)[coder decodeDoubleForKey:@"HFLineHeight"];
_hfflags.antialias = [coder decodeBoolForKey:@"HFAntialias"];
- _hfflags.overwriteMode = [coder decodeBoolForKey:@"HFOverwriteMode"];
+
+ if ([coder containsValueForKey:@"HFEditMode"])
+ _hfflags.editMode = [coder decodeIntForKey:@"HFEditMode"];
+ else {
+ _hfflags.editMode = ([coder decodeBoolForKey:@"HFOverwriteMode"]
+ ? HFOverwriteMode : HFInsertMode);
+ }
+
_hfflags.editable = [coder decodeBoolForKey:@"HFEditable"];
_hfflags.selectable = [coder decodeBoolForKey:@"HFSelectable"];
representers = [[coder decodeObjectForKey:@"HFRepresenters"] retain];
@@ -800,7 +807,7 @@ - (NSUInteger)bytesPerLine {
}
- (BOOL)editable {
- return _hfflags.editable && ! [byteArray changesAreLocked];
+ return _hfflags.editable && ! [byteArray changesAreLocked] && _hfflags.editMode != HFReadOnlyMode;
}
- (void)setEditable:(BOOL)flag {
@@ -1716,7 +1723,7 @@ - (void)moveToLineBoundaryInDirection:(HFControllerMovementDirection)direction a
}
- (void)deleteSelection {
- if ([self inOverwriteMode] || ! [self editable]) {
+ if ([self editMode] == HFOverwriteMode || ! [self editable]) {
NSBeep();
}
else {
@@ -1729,7 +1736,7 @@ - (void)replaceByteArray:(HFByteArray *)newArray {
REQUIRE_NOT_NULL(newArray);
EXPECT_CLASS(newArray, HFByteArray);
HFRange entireRange = HFRangeMake(0, [self contentsLength]);
- if ([self inOverwriteMode] && [newArray length] != entireRange.length) {
+ if ([self editMode] == HFOverwriteMode && [newArray length] != entireRange.length) {
NSBeep();
}
else {
@@ -1743,7 +1750,7 @@ - (BOOL)insertData:(NSData *)data replacingPreviousBytes:(unsigned long long)pre
#if ! NDEBUG
const unsigned long long startLength = [byteArray length];
unsigned long long expectedNewLength;
- if ([self inOverwriteMode]) {
+ if ([self editMode] == HFOverwriteMode) {
expectedNewLength = startLength;
}
else {
@@ -1766,7 +1773,7 @@ - (BOOL)insertData:(NSData *)data replacingPreviousBytes:(unsigned long long)pre
}
- (BOOL)_insertionModeCoreInsertByteArray:(HFByteArray *)bytesToInsert replacingPreviousBytes:(unsigned long long)previousBytes allowUndoCoalescing:(BOOL)allowUndoCoalescing outNewSingleSelectedRange:(HFRange *)outSelectedRange {
- HFASSERT(! [self inOverwriteMode]);
+ HFASSERT([self editMode] == HFInsertMode);
REQUIRE_NOT_NULL(bytesToInsert);
/* Guard against overflow. If [bytesToInsert length] + [self contentsLength] - previousBytes overflows, then we can't do it */
@@ -1874,7 +1881,7 @@ - (BOOL)insertByteArray:(HFByteArray *)bytesToInsert replacingPreviousBytes:(uns
BEGIN_TRANSACTION();
unsigned long long beforeLength = [byteArray length];
- BOOL inOverwriteMode = [self inOverwriteMode];
+ BOOL inOverwriteMode = [self editMode] == HFOverwriteMode;
HFRange modificationRange; //either range to remove from selection if in overwrite mode, or range to select if not
BOOL success;
if (inOverwriteMode) {
@@ -1905,7 +1912,7 @@ - (BOOL)insertByteArray:(HFByteArray *)bytesToInsert replacingPreviousBytes:(uns
- (void)deleteDirection:(HFControllerMovementDirection)direction {
HFASSERT(direction == HFControllerDirectionLeft || direction == HFControllerDirectionRight);
- if ([self inOverwriteMode]) {
+ if ([self editMode] != HFInsertMode) {
NSBeep();
return;
}
@@ -1936,18 +1943,18 @@ - (void)deleteDirection:(HFControllerMovementDirection)direction {
}
}
-- (BOOL)inOverwriteMode {
- return _hfflags.overwriteMode;
+- (HFEditMode)editMode {
+ return _hfflags.editMode;
}
-- (void)setInOverwriteMode:(BOOL)val {
- _hfflags.overwriteMode = val;
- // don't allow undo coalescing across switching between overwrite mode
- [self _endTypingUndoCoalescingIfActive];
-}
-
-- (BOOL)requiresOverwriteMode {
- return NO;
+- (void)setEditMode:(HFEditMode)val
+{
+ if (val != _hfflags.editMode) {
+ _hfflags.editMode = val;
+ // don't allow undo coalescing when switching modes
+ [self _endTypingUndoCoalescingIfActive];
+ [self _addPropertyChangeBits:HFControllerEditable];
+ }
}
+ (BOOL)prepareForChangeInFile:(NSURL *)targetFile fromWritingByteArray:(HFByteArray *)array {
View
4 framework/sources/HFFileReference.h
@@ -25,8 +25,12 @@
mode_t fileMode;
BOOL isWritable;
uint32_t blockSize;
+ BOOL isPrivileged;
+ BOOL isFixedLength;
}
+@property (readonly) BOOL isPrivileged;
+@property (readonly) BOOL isFixedLength;
/*! Open a file for reading and writing at the given path. The permissions mode of any newly created file is 0744. Returns nil if the file could not be opened, in which case the error parameter (if not nil) will be set. */
- initWritableWithPath:(NSString *)path error:(NSError **)error;
View
10 framework/sources/HFFileReference.m
@@ -111,6 +111,8 @@ static BOOL returnFTruncateError(NSError **error) {
@implementation HFFileReference
+@synthesize isPrivileged, isFixedLength;
+
- (void)close { UNIMPLEMENTED_VOID(); }
- (void)readBytes:(unsigned char *)buff length:(NSUInteger)length from:(unsigned long long)offset {USE(buff); USE(length); USE(offset); UNIMPLEMENTED_VOID(); }
- (int)writeBytes:(const unsigned char *)buff length:(NSUInteger)length to:(unsigned long long)offset {USE(buff); USE(length); USE(offset); UNIMPLEMENTED(); }
@@ -204,7 +206,9 @@ - (BOOL)initSharedWithPath:(NSString *)path error:(NSError **)error {
#ifndef HF_NO_PRIVILEGED_FILE_OPERATIONS
if (fileDescriptor < 0 && errno == EACCES) {
- if (![[HFPrivilegedHelperConnection sharedConnection] openFileAtPath:p writable:isWritable fileDescriptor:&fileDescriptor error:error]) {
+ if ([[HFPrivilegedHelperConnection sharedConnection] openFileAtPath:p writable:isWritable fileDescriptor:&fileDescriptor error:error]) {
+ isPrivileged = YES;
+ } else {
fileDescriptor = -1;
errno = EACCES;
}
@@ -231,7 +235,7 @@ - (BOOL)initSharedWithPath:(NSString *)path error:(NSError **)error {
if (!sb.st_size && (S_ISCHR(sb.st_mode) || S_ISBLK(sb.st_mode))) {
uint64_t blockCount;
-
+
if (ioctl(fileDescriptor, DKIOCGETBLOCKSIZE, &blockSize) < 0
|| ioctl(fileDescriptor, DKIOCGETBLOCKCOUNT, &blockCount) < 0) {
int err = errno;
@@ -241,6 +245,7 @@ - (BOOL)initSharedWithPath:(NSString *)path error:(NSError **)error {
}
fileLength = blockSize * blockCount;
+ isFixedLength = YES;
}
else {
fileLength = sb.st_size;
@@ -370,6 +375,7 @@ - (int)writeBytes:(const unsigned char *)buff length:(NSUInteger)length to:(unsi
return errno;
HFASSERT(result == (ssize_t)blockSize);
}
+ free(tempBuf);
return 0;
}
View
2  framework/sources/HFTextRepresenter.m
@@ -409,7 +409,7 @@ - (BOOL)canPasteFromPasteboard:(NSPasteboard *)pb {
- (BOOL)canCut {
/* We can cut if we are editable, we have at least one byte selected, and we are not in overwrite mode */
HFController *controller = [self controller];
- if ([controller inOverwriteMode]) return NO;
+ if ([controller editMode] != HFInsertMode) return NO;
if (! [controller editable]) return NO;
FOREACH(HFRangeWrapper *, rangeWrapper, [controller selectedContentsRanges]) {
Please sign in to comment.
Something went wrong with that request. Please try again.