Changeset 253

Show
Ignore:
Timestamp:
08/29/08 15:40:11 (4 months ago)
Author:
tal
Message:
- New factories for an experimental glyph view.
- Register all factories additions.
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • packages/defconAppKit/trunk/Lib/defconAppKit/representationFactories/__init__.py

    r235 r253  
    33from defconAppKit.representationFactories.glyphCellFactory import GlyphCellFactory 
    44from defconAppKit.representationFactories.glyphCellDetailFactory import GlyphCellDetailFactory 
     5from defconAppKit.representationFactories.glyphViewFactories import NoComponentsNSBezierPathFactory, OnlyComponentsNSBezierPathFactory, OutlineInformationFactory 
     6 
     7_factories = { 
     8    "NSBezierPath" : NSBezierPathFactory, 
     9    "NoComponentsNSBezierPath" : NoComponentsNSBezierPathFactory, 
     10    "OnlyComponentsNSBezierPath" : OnlyComponentsNSBezierPathFactory, 
     11    "defconAppKitGlyphCell" : GlyphCellFactory, 
     12    "defconAppKitGlyphCellDetail" : GlyphCellDetailFactory, 
     13    "defconAppKitOutlineInformation" : OutlineInformationFactory 
     14} 
     15 
     16# used by the glyph multiline view 
     17try: 
     18    from defconAppKit.representationFactories.t2CharStringFactory import T2CharStringRepresentationFactory 
     19    _factories["T2CharString"] = T2CharStringRepresentationFactory 
     20except ImportError: 
     21    pass 
    522 
    623 
    724def registerAllFactories(): 
    8     addRepresentationFactory("NSBezierPath", NSBezierPathFactory) 
    9     addRepresentationFactory("defconAppKitGlyphCell", GlyphCellFactory) 
    10     addRepresentationFactory("defconAppKitGlyphCellDetail", GlyphCellDetailFactory) 
     25    for name, factory in _factories.items(): 
     26        addRepresentationFactory(name, factory) 
  • packages/defconAppKit/trunk/Lib/defconAppKit/representationFactories/glyphCellFactory.py

    r235 r253  
    4747        headerRect = ((0, -self.height+self.headerHeight), (self.width, self.headerHeight)) 
    4848        # background 
     49        context.saveGraphicsState() 
     50        transform = NSAffineTransform.transform() 
     51        transform.translateXBy_yBy_(0, self.height-self.headerHeight) 
     52        transform.scaleXBy_yBy_(1.0, -1.0) 
     53        transform.concat() 
    4954        self.drawCellBackground(bodyRect) 
     55        context.restoreGraphicsState() 
    5056        # glyph 
    5157        if self.shouldDrawMetrics: