Ian,
Just as with Ghoul, it occurs to me that it would be nice to have a way to populate a CB from the clipboard vs. creating a file just to open it. Thanks again for a great tool!!! Bill -- Wilhelm K. Schwab, Ph.D. [hidden email] |
Bill,
> Just as with Ghoul, it occurs to me that it would be nice to have a > way to populate a CB from the clipboard vs. creating a file just to > open it. Can't say it would be top of my wish list but if you feel it would be useful :-) Copy the following into a .st file and "File in" to an image already containing the CB (version 5l). You should see a new item on the File menu named "Open On Clipboard" which will only be enabled when the clipboard contains text. Selecting it will attempt to load the clipboard contents as if it were the contents of a file in chunk format. Let me know of any problems - or if you, or anybody else, has any other enhancement suggestions. =-=-=-=-=-= cut between here ... | ri vr m | ri := (ResourceIdentifier class: ChunkBrowser name: 'Default view'). vr := ri load. m := vr menuBar at: 1. m insertItem: (CommandMenuItem command: #clipboardOpen description: 'Open On Clipboard') at: 3. ri save: vr! !ChunkBrowserModel methodsFor! fromStream: aStream chunks := self fileInChunksFrom: aStream! ! !ChunkBrowserModel categoriesFor: #fromStream:!operations!public! ! !ChunkBrowserModel methodsFor! fileOpen: aString | stream | stream := FileStream read: aString. [self fromStream: stream] ensure: [stream close]! ! !ChunkBrowserModel categoriesFor: #fileOpen:!operations!public! ! !ChunkBrowser methodsFor! clipboardOpen | text | text := Clipboard current getText. Cursor wait showWhile: [self model fromStream: text readStream. chunkList selectionOrNil: nil. self updateChunkList]. self caption: 'ChunkBrowser - Clipboard'! ! !ChunkBrowser categoriesFor: #clipboardOpen!commands!public! ! !ChunkBrowser methodsFor! queryCommand: aCommandQuery aCommandQuery commandSymbol == #toggleInclusionOfChunkType: ifTrue: [| argument | aCommandQuery isEnabled: true. argument := aCommandQuery commandDescription command arguments first. aCommandQuery isChecked: (chunkTypeSelection at: argument). ^true]. aCommandQuery commandSymbol == #toggleComparison: ifTrue: [| argument | aCommandQuery isEnabled: true. argument := aCommandQuery commandDescription command arguments first. aCommandQuery isChecked: (comparisonSelection at: argument). ^true]. aCommandQuery commandSymbol == #selectAllOrDefault ifTrue: [aCommandQuery isEnabled: true; text: (self shouldSelectAll ifTrue: ['&Select all'] ifFalse: ['&Select default']). ^true]. aCommandQuery commandSymbol == #differences ifTrue: [aCommandQuery isEnabled: self canShowDifferences. ^true]. aCommandQuery commandSymbol == #selectRange ifTrue: [aCommandQuery isEnabled: self model hasChunks; isChecked: chunkRange notNil. ^true]. aCommandQuery commandSymbol == #lastOnly ifTrue: [aCommandQuery isEnabled: self model hasChunks; isChecked: lastOnly. ^true]. aCommandQuery commandSymbol == #copyText ifTrue: [aCommandQuery isEnabled: chunkList hasSingleSelection. ^true]. aCommandQuery commandSymbol == #browseChunk ifTrue: [aCommandQuery isEnabled: self canBrowse. ^true]. (#(#print #printPreview) identityIncludes: aCommandQuery command) ifTrue: [aCommandQuery isEnabled: self canPrint. ^true]. (#(#pickSelection #unpickSelection #restoreSelection) identityIncludes: aCommandQuery command) ifTrue: [aCommandQuery isEnabled: chunkList hasSelection. ^true]. aCommandQuery commandSymbol == #restorePicked ifTrue: [aCommandQuery isEnabled: self model hasAnyChunksPicked. ^true]. aCommandQuery commandSymbol == #clipboardOpen ifTrue: [aCommandQuery isEnabled: (Clipboard current isFormatIdAvailable: CF_TEXT). ^true]. ^super queryCommand: aCommandQuery! ! !ChunkBrowser categoriesFor: #queryCommand:!commands!public! ! =-=-=-=-=-= ... and here -- Ian Use the Reply-To address to contact me. Mail sent to the From address is ignored. |
Ian,
Somewhere between your posting and Thunderbird's rendering of same, there are some extra line feeds in the code, but it caused no troubles other than slightly mangling the menu text, which is easily corrected. After filing in the code, I promptly launched the CB and opened the text on the clipboard :) As another test, I copied the code from my ExternalArray post (which gave me the idea), and it worked exactly as one would want. THANKS!!!! Bill -- Wilhelm K. Schwab, Ph.D. [hidden email] |
Ian,
This one is so minute, I hestitate to mention it, but the Include menu refers to "last chunk"; the toolbar, when unchecked, refers to "final chunks only" and, when checked, refers to "last chunk limitation". I think I found "final chunks only" to be the most helpful description. BTW, I am noticing this only because the CB bailed me out of yet another fine mess - THANKS!!!!!! Have a good one, Bill -- Wilhelm K. Schwab, Ph.D. [hidden email] |
In reply to this post by Schwab,Wilhelm K
Bill,
> Just as with Ghoul, it occurs to me that it would be nice to have a way > to populate a CB from the clipboard vs. creating a file just to open it. I'm having difficulty imagining what use that would be ? After all, Ghoul is about looking at the post-mortem /files/ that Dolphin produces, so I don't understand where the clipboard data would come from (unless you mean taking the filename from the clipboard when it had been put there by the Windows Shell -- in which case I'm afraid I don't know how to do that). I don't mind adding the feature, though it would be little messy (GhoulModel "knows" that it represents a file, so a new kind of Model would be needed), but I'd like to know what the code is supposed to do before writing it[*] ;-) -- chris ([*] sometimes I'm picky that way -- not always, I admit...) |
In reply to this post by Schwab,Wilhelm K
Bill,
> Somewhere between your posting and Thunderbird's rendering of same, > there are some extra line feeds in the code, but it caused no troubles > other than slightly mangling the menu text, which is easily corrected. My fault. When I copy/paste from a Dolphin workspace into an OE message the extra line feeds get added. I sometimes remember to go via an intermediate text file, which removes the extra line feeds, but forgot in this case. > After filing in the code, I promptly launched the CB and opened the > text on the clipboard :) As another test, I copied the code from my > ExternalArray post (which gave me the idea), and it worked exactly as > one would want. Yes, that's one area that it could be useful - previewing code posted in the n/g in a formatted way but without having to install it in the image or save it in a file. > THANKS!!!! You are welcome. -- Ian Use the Reply-To address to contact me. Mail sent to the From address is ignored. |
In reply to this post by Schwab,Wilhelm K
Bill,
> This one is so minute, I hestitate to mention it, but the Include menu > refers to "last chunk"; the toolbar, when unchecked, refers to "final > chunks only" and, when checked, refers to "last chunk limitation". > > I think I found "final chunks only" to be the most helpful > description. I've never quite decided which is the correct way to describe that option - as you have seen with the current state of the CB. I'm thinking that "Final definition only" might be better .... -- Ian Use the Reply-To address to contact me. Mail sent to the From address is ignored. |
Ian,
> I'm thinking that "Final definition only" might be better .... Sounds good to me. Thanks again! Bill -- Wilhelm K. Schwab, Ph.D. [hidden email] |
In reply to this post by Chris Uppal-3
Chris,
> I'm having difficulty imagining what use that would be ? After all, Ghoul is > about looking at the post-mortem /files/ that Dolphin produces, so I don't > understand where the clipboard data would come from (unless you mean taking the > filename from the clipboard when it had been put there by the Windows Shell -- > in which case I'm afraid I don't know how to do that). My first use of Ghoul was to look at a dump posted here. I had to make a file just to hold the text, hence the idea. > I don't mind adding the feature, though it would be little messy (GhoulModel > "knows" that it represents a file, so a new kind of Model would be needed), but > I'd like to know what the code is supposed to do before writing it[*] ;-) If it's a lot of trouble, then please do not feel any pressure. Between Ghoul and the CB, the latter is probably more likely to have useful information on the clipboard. As an example, the chunks I posted yesterday went through it via the clipboard. I also quickly noted that I can use it to verify that what I think consists of readable chunks indeed is readable. With Blair's drop location fix for workspaces, that is less of a concern, but it never hurts to check. The clipboard allows me to easily test the would-be file contents _before_ I overwrite known good data :) Have a good one, Bill -- Wilhelm K. Schwab, Ph.D. [hidden email] |
Bill,
> My first use of Ghoul was to look at a dump posted here. I had to make > a file just to hold the text, hence the idea. Aha! I /see/... Yes, that might be useful. The difficulty is that the "parser" is pretty fragile, and I'm not sure that I can make it robust enough to deal with dumps mangled by line-wrapping, or by people trimming off the start/end markers that it looks for. I'll see what can be done (but promise nothing ;-) -- chris |
Free forum by Nabble | Edit this page |