Changeset 733

Show
Ignore:
Timestamp:
10/26/07 15:01:20 (6 years ago)
Author:
cho45
Message:

lang/ruby/Chemr/AppController.rb,
lang/ruby/Chemr/CHMDocument.rb:

userstylesheet を設定するように

Location:
lang/ruby/Chemr
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • lang/ruby/Chemr/AppController.rb

    r706 r733  
    120120                log "Register: #{r}" 
    121121 
     122                WebPreferences.standardPreferences.userStyleSheetEnabled = true 
     123                WebPreferences.standardPreferences.userStyleSheetLocation = NSURL.URLWithString("#{ENV["HOME"]}/.chemr/userstyle.css") 
    122124        end 
    123125 
  • lang/ruby/Chemr/CHMDocument.rb

    r729 r733  
    11#!rake ;# 
    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 
    602 
    613 
     
    7113                @chm = self.document.chm 
    7214                uri  = URI(self.document.fileURL.absoluteString) 
    73                 log uri 
    7415                browse @chm.home 
    7516                @now = @index = @chm.index.to_a.sort_by {|k,v| k} # cache 
     
    382323        end 
    383324 
    384  
    385325end 
     326 
     327class 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 
     372end 
     373 
     374class 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 
     383end