| 2 | | |
| 3 | | class CHMDocument < NSDocument |
| 4 | | attr_reader :chm |
| 5 | | |
| 6 | | #- (void)makeWindowControllers |
| 7 | | def makeWindowControllers |
| 8 | | c = CHMWindowController.alloc.initWithWindowNibName("CHMDocument") |
| 9 | | self.addWindowController(c) |
| 10 | | end |
| 11 | | |
| 12 | | #- (BOOL)readFromURL:(NSURL *)inAbsoluteURL ofType:(NSString *)inTypeName error:(NSError **)outError |
| 13 | | def readFromURL_ofType_error(url, type, error) |
| 14 | | @chm = Chmlib::Chm.new(url.path.to_s) |
| 15 | | true |
| 16 | | end |
| 17 | | |
| 18 | | #- (BOOL)writeToURL:(NSURL *)inAbsoluteURL ofType:(NSString *)inTypeName error:(NSError **)outError |
| 19 | | def writeToURL_ofType_error(url, type, error) |
| 20 | | false |
| 21 | | end |
| 22 | | |
| 23 | | #- (void)windowControllerDidLoadWindowNib:(NSWindowController *)windowController |
| 24 | | def windowControllerDidLoadWindowNib(cont) |
| 25 | | log "wCDLWN", cont |
| 26 | | end |
| 27 | | |
| 28 | | # def dataRepresentationOfType(aType) |
| 29 | | # end |
| 30 | | # |
| 31 | | # def loadDataRepresentation_ofType(data, aType) |
| 32 | | # end |
| 33 | | |
| 34 | | def displayName |
| 35 | | dc = NSDocumentController.sharedDocumentController |
| 36 | | i = dc.documents.index(self) + 1 |
| 37 | | cmd = [8984].pack("U") |
| 38 | | "#{cmd}#{i}| #{@chm.title}" |
| 39 | | end |
| 40 | | |
| 41 | | def windowControllerWillLoadNib(cont) |
| 42 | | log cont |
| 43 | | end |
| 44 | | |
| 45 | | def winwowNibName |
| 46 | | "CHMDocument" |
| 47 | | end |
| 48 | | end |
| 49 | | |
| 50 | | class MySearchWindow < NSWindow |
| 51 | | |
| 52 | | def sendEvent(e) |
| 53 | | if e.oc_type == NSKeyDown |
| 54 | | return if delegate.process_keybinds(e) |
| 55 | | end |
| 56 | | super_sendEvent(e) |
| 57 | | end |
| 58 | | |
| 59 | | end |
| | 326 | |
| | 327 | class CHMDocument < NSDocument |
| | 328 | attr_reader :chm |
| | 329 | |
| | 330 | #- (void)makeWindowControllers |
| | 331 | def makeWindowControllers |
| | 332 | c = CHMWindowController.alloc.initWithWindowNibName("CHMDocument") |
| | 333 | self.addWindowController(c) |
| | 334 | end |
| | 335 | |
| | 336 | #- (BOOL)readFromURL:(NSURL *)inAbsoluteURL ofType:(NSString *)inTypeName error:(NSError **)outError |
| | 337 | def readFromURL_ofType_error(url, type, error) |
| | 338 | @chm = Chmlib::Chm.new(url.path.to_s) |
| | 339 | true |
| | 340 | end |
| | 341 | |
| | 342 | #- (BOOL)writeToURL:(NSURL *)inAbsoluteURL ofType:(NSString *)inTypeName error:(NSError **)outError |
| | 343 | def writeToURL_ofType_error(url, type, error) |
| | 344 | false |
| | 345 | end |
| | 346 | |
| | 347 | #- (void)windowControllerDidLoadWindowNib:(NSWindowController *)windowController |
| | 348 | def windowControllerDidLoadWindowNib(cont) |
| | 349 | log "wCDLWN", cont |
| | 350 | end |
| | 351 | |
| | 352 | # def dataRepresentationOfType(aType) |
| | 353 | # end |
| | 354 | # |
| | 355 | # def loadDataRepresentation_ofType(data, aType) |
| | 356 | # end |
| | 357 | |
| | 358 | def displayName |
| | 359 | dc = NSDocumentController.sharedDocumentController |
| | 360 | i = dc.documents.index(self) + 1 |
| | 361 | cmd = [8984].pack("U") |
| | 362 | "#{cmd}#{i}| #{@chm.title}" |
| | 363 | end |
| | 364 | |
| | 365 | def windowControllerWillLoadNib(cont) |
| | 366 | log cont |
| | 367 | end |
| | 368 | |
| | 369 | def winwowNibName |
| | 370 | "CHMDocument" |
| | 371 | end |
| | 372 | end |
| | 373 | |
| | 374 | class MySearchWindow < NSWindow |
| | 375 | |
| | 376 | def sendEvent(e) |
| | 377 | if e.oc_type == NSKeyDown |
| | 378 | return if delegate.process_keybinds(e) |
| | 379 | end |
| | 380 | super_sendEvent(e) |
| | 381 | end |
| | 382 | |
| | 383 | end |