Changeset 3887

Show
Ignore:
Timestamp:
03/07/06 00:30:46 (3 years ago)
Author:
morris
Message:

More scaling/rotation fixes (wapanese to follow)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • Footagehead/trunk/English.lproj/Localizable.strings

    r3876 r3887  
    22"%@ %C %u/%u" = "%1$@ %2$C %3$u/%4$u"; 
    33 
    4 /* 'image.jpg, 640x480, zoomed at 100%' */ 
    5 "%@, %.0fx%.0f, zoomed at %.0f%%" = "%1$@, %2$.0fx%3$.0f, zoomed at %4$.0f%%"; 
     4/* 'image.jpg, 640x480' */ 
     5"%@, %.0fx%.0f" = "%1$@, %2$.0fx%3$.0f"; 
    66 
    77/* '20 items, 10 images' */ 
    88"%u %@, %u %@" = "%1$u %2$@, %3$u %4$@"; 
    99 
     10/* ', rotated by 90' */ 
     11", rotated by %.0f" = ", rotated by %.0f°"; 
     12 
     13/* ', scaled to 50%' */ 
     14", scaled to %.0f%%" = ", scaled to %.0f%%"; 
     15 
    1016/* Spotlight query (query) */ 
    11 "\"%@\"" = "\"%@\""; 
     17"\"%@\"" = "“%@”"; 
    1218 
    1319/* Color black */ 
     
    3743/* Color white */ 
    3844"White" = "White"; 
    39  
  • Footagehead/trunk/English.lproj/MainMenu.nib/classes.nib

    r3879 r3887  
    44        { 
    55            ACTIONS = { 
     6                autoSwitch = id;  
    67                delete = id;  
    78                firstFile = id;  
     
    2223                setAsDesktopPicture = id;  
    2324                slideshow = id;  
    24                 slideshowButtons = id;  
    2525                zoom = id;  
    2626            };  
     
    4545                "_rightStatusTextField" = NSTextField;  
    4646                "_rightView" = NSView;  
    47                 "_rotateRightButton" = NSButton;  
    4847                "_screenAutoSwitchButton" = NSButton;  
    4948                "_screenAutoSwitchTextField" = NSTextField;  
     
    5150                "_screenPanel" = NSPanel;  
    5251                "_screenPopUpButton" = NSPopUpButton;  
     52                "_screenZoomMatrix" = NSMatrix;  
    5353                "_scrollView" = NSScrollView;  
    5454                "_splitView" = WISplitView;  
  • Footagehead/trunk/English.lproj/MainMenu.nib/info.nib

    r3879 r3887  
    44<dict> 
    55        <key>IBDocumentLocation</key> 
    6         <string>423 67 395 374 0 0 1152 746 </string> 
     6        <string>893 73 395 374 0 0 1920 1178 </string> 
    77        <key>IBEditorPositions</key> 
    88        <dict> 
     
    1818        <key>IBOpenObjects</key> 
    1919        <array> 
    20                 <integer>21</integer> 
    2120                <integer>438</integer> 
    2221        </array> 
  • Footagehead/trunk/FHController.h

    r3879 r3887  
    5555        IBOutlet NSPanel                                *_screenPanel; 
    5656        IBOutlet NSPopUpButton                  *_screenPopUpButton; 
     57        IBOutlet NSMatrix                               *_screenZoomMatrix; 
    5758        IBOutlet NSPopUpButton                  *_screenBackgroundPopUpButton; 
    5859        IBOutlet NSButton                               *_screenAutoSwitchButton; 
     
    104105- (IBAction)rotateRight:(id)sender; 
    105106- (IBAction)slideshow:(id)sender; 
    106 - (IBAction)slideshowButtons:(id)sender; 
     107- (IBAction)autoSwitch:(id)sender; 
    107108- (IBAction)revealInFinder:(id)sender; 
    108109- (IBAction)setAsDesktopPicture:(id)sender; 
  • Footagehead/trunk/FHController.m

    r3883 r3887  
    397397                                [self _updateFullscreenStatus]; 
    398398                                [_loadImageTimer setFireDate:[NSDate dateWithTimeIntervalSinceNow: 
    399                                         [FHSettings intForKey:FHAutoSwitchTime]]]; 
     399                                        [FHSettings intForKey:FHFullscreenAutoSwitchTime]]]; 
    400400                        } else { 
    401401                                // --- display error in fullscreen 
     
    610610        [item setImage:[NSImage imageNamed:@"Black"]]; 
    611611        [item setRepresentedObject:[NSColor blackColor]]; 
    612         [item setTag:FHBackgroundBlack]; 
     612        [item setTag:FHFullscreenBackgroundBlack]; 
    613613        [[_screenBackgroundPopUpButton menu] addItem:item]; 
    614614        [item release]; 
     
    617617        [item setImage:[NSImage imageNamed:@"Gray"]]; 
    618618        [item setRepresentedObject:[NSColor grayColor]]; 
    619         [item setTag:FHBackgroundGray]; 
     619        [item setTag:FHFullscreenBackgroundGray]; 
    620620        [[_screenBackgroundPopUpButton menu] addItem:item]; 
    621621        [item release]; 
     
    624624        [item setImage:[NSImage imageNamed:@"White"]]; 
    625625        [item setRepresentedObject:[NSColor whiteColor]]; 
    626         [item setTag:FHBackgroundWhite]; 
     626        [item setTag:FHFullscreenBackgroundWhite]; 
    627627        [[_screenBackgroundPopUpButton menu] addItem:item]; 
    628628        [item release]; 
     
    686686 
    687687- (void)_updateRightStatus { 
    688         NSSize          imageSize, frameSize; 
    689         double          zoom = 100.0; 
     688        NSMutableString         *string; 
     689        NSSize                          imageSize, frameSize; 
     690        double                          zoom; 
     691        float                           size; 
    690692         
    691693        if(![_imageView image]) { 
     
    703705        } 
    704706         
     707        if(ABS([_imageView imageRotation]) == 90 || ABS([_imageView imageRotation]) == 270) { 
     708                size = imageSize.width; 
     709                imageSize.width = imageSize.height; 
     710                imageSize.height = size; 
     711        } 
     712 
    705713        frameSize = [NSScrollView frameSizeForContentSize:[_imageView frame].size 
    706714                                                                hasHorizontalScroller:[_scrollView hasHorizontalScroller] 
     
    719727                zoom = 100.0; 
    720728         
    721         [_rightStatusTextField setStringValue:[NSSWF:NSLS(@"%@, %.0fx%.0f, zoomed at %.0f%%", @"'image.jpg, 640x480, zoomed at 100%'"), 
     729        string = [[NSMutableString alloc] initWithFormat:NSLS(@"%@, %.0fx%.0f", @"'image.jpg, 640x480'"), 
    722730                [[self _selectedFile] name], 
    723731                imageSize.width, 
    724                 imageSize.height, 
    725                 zoom]]; 
     732                imageSize.height]; 
     733 
     734        if(zoom != 100.0) { 
     735                [string appendFormat:NSLS(@", scaled to %.0f%%", @"', scaled to 50%'"), 
     736                        zoom]; 
     737        } 
     738 
     739        if([_imageView imageRotation] != 0.0) { 
     740                [string appendFormat:NSLS(@", rotated by %.0f", @"', rotated by 90'"), 
     741                        ABS([_imageView imageRotation])]; 
     742        } 
     743         
     744        [_rightStatusTextField setStringValue:string]; 
     745         
     746        [string release]; 
    726747} 
    727748 
     
    800821        [self setWindowFrameAutosaveName:@"Footagehead"]; 
    801822         
    802         if([FHSettings intForKey:FHImageScaling] == NSScaleNone
     823        if([FHSettings intForKey:FHImageScalingMethod] != FHScaleProportionally
    803824                [_zoomButton setState:NSOnState]; 
    804825         
     
    806827        [self _reloadScreens]; 
    807828         
    808         if([FHSettings intForKey:FHScreen] < [_screenPopUpButton numberOfItems]) 
    809                 [_screenPopUpButton selectItemAtIndex:[FHSettings intForKey:FHScreen]]; 
     829        if([FHSettings intForKey:FHFullscreenScreen] < [_screenPopUpButton numberOfItems]) 
     830                [_screenPopUpButton selectItemAtIndex:[FHSettings intForKey:FHFullscreenScreen]]; 
    810831         
    811832        [self _reloadScreenBackgrounds]; 
    812833 
    813         [_screenBackgroundPopUpButton selectItemWithTag:[FHSettings intForKey:FHBackground]]; 
    814  
    815         [_screenAutoSwitchButton setState:[FHSettings boolForKey:FHAutoSwitch]]; 
    816         [_screenAutoSwitchTextField setEnabled:[FHSettings boolForKey:FHAutoSwitch]]; 
    817         [_screenAutoSwitchTextField setIntValue:[FHSettings intForKey:FHAutoSwitchTime]]; 
    818          
    819         [_imageView setImageScaling:[FHSettings intForKey:FHImageScaling]]; 
     834        [_screenZoomMatrix selectCellWithTag:[FHSettings intForKey:FHFullscreenImageScalingMethod]]; 
     835        [_screenBackgroundPopUpButton selectItemWithTag:[FHSettings intForKey:FHFullscreenBackground]]; 
     836 
     837        [_screenAutoSwitchButton setState:[FHSettings boolForKey:FHFullscreenAutoSwitch]]; 
     838        [_screenAutoSwitchTextField setEnabled:[FHSettings boolForKey:FHFullscreenAutoSwitch]]; 
     839        [_screenAutoSwitchTextField setIntValue:[FHSettings intForKey:FHFullscreenAutoSwitchTime]]; 
     840         
     841        [_imageView setImageScaling:[FHSettings intForKey:FHImageScalingMethod]]; 
    820842        [_imageView setImageRotation:[FHSettings floatForKey:FHImageRotation]]; 
    821843 
     
    916938         
    917939        [_handler release]; 
     940        _handler = NULL; 
    918941} 
    919942 
     
    9851008 
    9861009                [self showWindow:self]; 
     1010                 
     1011                _fullscreenWindow = NULL; 
     1012 
    9871013                [self _updateImage]; 
    988                 [_tableView scrollRowToVisible:[_tableView selectedRow]]; 
    989                  
    990                 _fullscreenWindow = NULL; 
    9911014        } 
    9921015} 
     
    13851408 
    13861409- (IBAction)zoom:(id)sender { 
    1387         NSImageScaling          scaling; 
    1388          
    1389         scaling = [_imageView imageScaling]; 
    1390          
    1391         if(scaling == NSScaleNone) 
    1392                 scaling = NSScaleProportionally; 
    1393         else 
    1394                 scaling = NSScaleNone; 
    1395  
    1396         [_imageView setImageScaling:scaling]; 
    1397  
    1398         [self _updateRightStatus]; 
    1399          
    1400         [FHSettings setInt:scaling forKey:FHImageScaling]; 
     1410        FHImageScaling          scaling; 
     1411         
     1412        if(_fullscreenWindow) { 
     1413                scaling = [_fullscreenImageView imageScaling]; 
     1414                 
     1415                if(scaling != FHScaleProportionally) 
     1416                        scaling = FHScaleProportionally; 
     1417                else 
     1418                        scaling = FHScaleStretched; 
     1419 
     1420                [_fullscreenImageView setImageScaling:scaling]; 
     1421        } else { 
     1422                scaling = [_imageView imageScaling]; 
     1423                 
     1424                if(scaling != FHScaleProportionally) 
     1425                        scaling = FHScaleProportionally; 
     1426                else 
     1427                        scaling = FHScaleNone; 
     1428 
     1429                [_imageView setImageScaling:scaling]; 
     1430 
     1431                [self _updateRightStatus]; 
     1432                 
     1433                [FHSettings setInt:scaling forKey:FHImageScalingMethod]; 
     1434        } 
    14011435} 
    14021436 
     
    14141448         
    14151449        [_imageView setImageRotation:rotation]; 
    1416          
     1450        [_fullscreenImageView setImageRotation:rotation]; 
     1451         
     1452        [self _updateRightStatus]; 
     1453 
    14171454        [FHSettings setFloat:rotation forKey:FHImageRotation]; 
    14181455} 
     
    14391476        if(returnCode == NSRunStoppedResponse) { 
    14401477                // --- save in prefs 
    1441                 [FHSettings setInt:[_screenPopUpButton indexOfSelectedItem] forKey:FHScreen]; 
    1442                 [FHSettings setInt:[_screenBackgroundPopUpButton tagOfSelectedItem] forKey:FHBackground]; 
    1443                 [FHSettings setBool:[_screenAutoSwitchButton state] forKey:FHAutoSwitch]; 
    1444                 [FHSettings setInt:[_screenAutoSwitchTextField intValue] forKey:FHAutoSwitchTime]; 
     1478                [FHSettings setInt:[_screenPopUpButton indexOfSelectedItem] forKey:FHFullscreenScreen]; 
     1479                [FHSettings setInt:[[_screenZoomMatrix selectedCell] tag] forKey:FHFullscreenImageScalingMethod]; 
     1480                [FHSettings setInt:[_screenBackgroundPopUpButton tagOfSelectedItem] forKey:FHFullscreenBackground]; 
     1481                [FHSettings setBool:[_screenAutoSwitchButton state] forKey:FHFullscreenAutoSwitch]; 
     1482                [FHSettings setInt:[_screenAutoSwitchTextField intValue] forKey:FHFullscreenAutoSwitchTime]; 
    14451483                 
    14461484                // --- get screen 
    1447                 screenNumber = [FHSettings intForKey:FHScreen]; 
     1485                screenNumber = [FHSettings intForKey:FHFullscreenScreen]; 
    14481486                 
    14491487                if((unsigned int) screenNumber > [[NSScreen screens] count]) 
     
    14671505                [_fullscreenWindow setTitle:[[self window] title]]; 
    14681506                [_fullscreenImageView setBackgroundColor:[_screenBackgroundPopUpButton representedObjectOfSelectedItem]]; 
     1507                [_fullscreenImageView setImageScaling:[[_screenZoomMatrix selectedCell] tag]]; 
     1508                [_fullscreenImageView setImageRotation:[_imageView imageRotation]]; 
    14691509                [_fullscreenPanel setFrame:screenRect display:NO]; 
    14701510                [_fullscreenWindow setContentView:[[_fullscreenPanel contentView] retain]]; 
     
    14731513                [self _updateImage]; 
    14741514 
    1475                 if([FHSettings boolForKey:FHAutoSwitch]) { 
    1476                         _loadImageTimer = [[NSTimer scheduledTimerWithTimeInterval:[FHSettings intForKey:FHAutoSwitchTime] 
     1515                if([FHSettings boolForKey:FHFullscreenAutoSwitch]) { 
     1516                        _loadImageTimer = [[NSTimer scheduledTimerWithTimeInterval:[FHSettings intForKey:FHFullscreenAutoSwitchTime] 
    14771517                                                                                                                                target:self 
    14781518                                                                                                                          selector:@selector(loadFileTimer:) 
     
    14851525 
    14861526 
    1487 - (IBAction)slideshowButtons:(id)sender { 
     1527- (IBAction)autoSwitch:(id)sender { 
    14881528        [_screenAutoSwitchTextField setEnabled:[_screenAutoSwitchButton state]]; 
    14891529} 
  • Footagehead/trunk/FHFullscreenWindow.m

    r2954 r3887  
    4949 
    5050                        [self close]; 
     51 
     52                        handled = YES; 
     53                } 
     54                else if([event commandKeyModifier] && c == 't') { 
     55                        [[self delegate] rotateRight:self]; 
     56 
     57                        handled = YES; 
     58                } 
     59                else if([event commandKeyModifier] && c == 'e') { 
     60                        [[self delegate] zoom:self]; 
    5161 
    5262                        handled = YES; 
  • Footagehead/trunk/FHImageView.h

    r3879 r3887  
    2727 */ 
    2828 
     29enum _FHImageScaling { 
     30        FHScaleProportionally           = 0, 
     31        FHScaleToFit, 
     32        FHScaleStretched, 
     33        FHScaleNone, 
     34}; 
     35typedef enum _FHImageScaling    FHImageScaling; 
     36 
     37 
    2938@class FHImage; 
    3039 
     
    3342         
    3443        FHImage                                         *_image; 
    35         NSImageScaling                                _imageScaling; 
     44        FHImageScaling                                _imageScaling; 
    3645        float                                           _imageRotation; 
    3746         
     
    4756- (void)setImage:(FHImage *)image; 
    4857- (FHImage *)image; 
    49 - (void)setImageScaling:(NSImageScaling)newScaling; 
    50 - (NSImageScaling)imageScaling; 
     58- (void)setImageScaling:(FHImageScaling)newScaling; 
     59- (FHImageScaling)imageScaling; 
    5160- (void)setImageRotation:(float)rotation; 
    5261- (float)imageRotation; 
  • Footagehead/trunk/FHImageView.m

    r3882 r3887  
    4343 
    4444- (void)_initImageView { 
    45         _imageScaling = NSScaleProportionally; 
     45        _imageScaling = FHScaleProportionally; 
    4646        _backgroundColor = [[NSColor whiteColor] retain]; 
    4747 
     
    8787                contentSize = [_scrollView contentSize]; 
    8888                 
    89                 if(_image && _imageScaling == NSScaleNone) { 
     89                if(_image && _imageScaling == FHScaleNone) { 
    9090                        imageSize = _image ? [_image size] : NSZeroSize; 
    9191                         
     
    175175 
    176176 
    177 - (void)setImageScaling:(NSImageScaling)imageScaling { 
     177- (void)setImageScaling:(FHImageScaling)imageScaling { 
    178178        _imageScaling = imageScaling; 
    179179 
     
    184184 
    185185 
    186 - (NSImageScaling)imageScaling { 
     186- (FHImageScaling)imageScaling { 
    187187        return _imageScaling; 
    188188} 
     
    313313 
    314314                switch (_imageScaling) { 
    315                         case NSScaleProportionally: 
     315                        case FHScaleProportionally: 
     316                        case FHScaleStretched: 
    316317                                if(ABS(_imageRotation) == 90.0 || ABS(_imageRotation) == 270.0) { 
    317318                                        dx = bounds.size.width  / rect.size.height; 
     
    324325                                d = dx < dy ? dx : dy; 
    325326                                 
    326                                 if(d < 1.0) { 
     327                                if(d < 1.0 || _imageScaling == FHScaleStretched) { 
    327328                                        rect.size.width         = floorf(rect.size.width  * d); 
    328329                                        rect.size.height        = floorf(rect.size.height * d); 
     
    330331                                break; 
    331332                         
    332                         case NSScaleToFit: 
     333                        case FHScaleToFit: 
    333334                                rect.size = bounds.size; 
    334335                                break; 
    335                                 
    336                         case NSScaleNone: 
     336                         
     337                        case FHScaleNone: 
    337338                                break; 
    338339                } 
  • Footagehead/trunk/FHSettings.h

    r3879 r3887  
    2929@interface FHSettings : WISettings 
    3030 
    31 #define FHOpenURL                                       @"FHOpenURL" 
    32 #define FHScreen                                        @"FHScreen" 
    33 #define FHImageScaling                          @"FHImageScaling" 
    34 #define FHImageRotation                         @"FHImageRotation" 
    35 #define FHBackground                            @"FHBackground" 
    36 #define FHBackgroundBlack                               0 
    37 #define FHBackgroundGray                                1 
    38 #define FHBackgroundWhite                               2 
    39 #define FHAutoSwitch                            @"FHAutoSwitch" 
    40 #define FHAutoSwitchTime                        @"FHAutoSwitchTime" 
     31#define FHOpenURL                                                       @"FHOpenURL" 
     32#define FHImageScalingMethod                            @"FHImageScalingMethod" 
     33#define FHImageRotation                                         @"FHImageRotation" 
     34#define FHFullscreenScreen                                      @"FHFullscreenScreen" 
     35#define FHFullscreenImageScalingMethod          @"FHFullscreenImageScalingMethod" 
     36#define FHFullscreenBackground                          @"FHFullscreenBackground" 
     37#define FHFullscreenBackgroundBlack                             0 
     38#define FHFullscreenBackgroundGray                              1 
     39#define FHFullscreenBackgroundWhite                             2 
     40#define FHFullscreenAutoSwitch                          @"FHFullscreenAutoSwitch" 
     41#define FHFullscreenAutoSwitchTime                      @"FHFullscreenAutoSwitchTime" 
    4142 
    4243@end 
  • Footagehead/trunk/FHSettings.m

    r3879 r3887  
    2828 
    2929#import "FHHandler.h" 
     30#import "FHImageView.h" 
    3031#import "FHSettings.h" 
    3132 
     
    3637                [[WIURL fileURLWithPath:NSHomeDirectory()] string], 
    3738                        FHOpenURL, 
    38                 [NSNumber numberWithInt:0], 
    39                         FHScreen, 
    40                 [NSNumber numberWithInt:NSScaleProportionally], 
    41                         FHImageScaling, 
     39                [NSNumber numberWithInt:FHScaleProportionally], 
     40                        FHImageScalingMethod, 
    4241                [NSNumber numberWithFloat:0.0f], 
    4342                        FHImageRotation, 
    44                 [NSNumber numberWithInt:FHBackgroundBlack], 
    45                         FHBackground, 
     43                [NSNumber numberWithInt:0], 
     44                        FHFullscreenScreen, 
     45                [NSNumber numberWithInt:FHScaleProportionally], 
     46                        FHFullscreenImageScalingMethod, 
     47                [NSNumber numberWithInt:FHFullscreenBackgroundBlack], 
     48                        FHFullscreenBackground, 
    4649                [NSNumber numberWithBool:NO], 
    47                         FHAutoSwitch, 
     50                        FHFullscreenAutoSwitch, 
    4851                [NSNumber numberWithInt:5], 
    49                         FHAutoSwitchTime, 
     52                        FHFullscreenAutoSwitchTime, 
    5053                NULL]; 
    5154} 
  • Footagehead/trunk/Japanese.lproj/Localizable.strings

    r3878 r3887  
    22"%@ %C %u/%u" = "%1$@ %2$C %3$u/%4$u"; 
    33 
    4 /* 'image.jpg, 640x480, zoomed at 100%' */ 
    5 "%@, %.0fx%.0f, zoomed at %.0f%%" = "%1$@, %2$.0fx%3$.0f, ズーム: %4$.0f%%"; 
     4/* 'image.jpg, 640x480' */ 
     5"%@, %.0fx%.0f" = "%1$@, %2$.0fx%3$.0f"; 
    66 
    77/* '20 items, 10 images' */ 
    88"%u %@, %u %@" = "%1$u %2$@, %3$u %4$@"; 
     9 
     10/* ', rotated by 90' */ 
     11", rotated by %.0f" = ", rotated by %.0f°"; 
     12 
     13/* ', scaled to 50%' */ 
     14", scaled to %.0f%%" = ", scaled to %.0f%%"; 
    915 
    1016/* Spotlight query (query) */ 
  • Footagehead/trunk/Japanese.lproj/MainMenu.nib/classes.nib

    r3879 r3887  
    44        { 
    55            ACTIONS = { 
     6                autoSwitch = id;  
    67                delete = id;  
    78                firstFile = id;  
     
    2223                setAsDesktopPicture = id;  
    2324                slideshow = id;  
    24                 slideshowButtons = id;  
    2525                zoom = id;  
    2626            };  
     
    5050                "_screenPanel" = NSPanel;  
    5151                "_screenPopUpButton" = NSPopUpButton;  
     52                "_screenZoomMatrix" = NSMatrix;  
    5253                "_scrollView" = NSScrollView;  
    5354                "_splitView" = WISplitView;  
  • Footagehead/trunk/Japanese.lproj/MainMenu.nib/info.nib

    r3879 r3887  
    88        <dict> 
    99                <key>29</key> 
    10                 <string>451 599 380 44 0 0 1280 1002 </string> 
     10                <string>772 709 380 44 0 0 1920 1178 </string> 
    1111                <key>571</key> 
    12                 <string>60 884 316 118 0 0 1280 1002 </string> 
     12                <string>100 1060 316 118 0 0 1920 1178 </string> 
    1313        </dict> 
    1414        <key>IBFramework Version</key> 
     
    1616        <key>IBOpenObjects</key> 
    1717        <array> 
    18                 <integer>534</integer> 
    19                 <integer>29</integer> 
    2018                <integer>438</integer> 
    21                 <integer>21</integer> 
    22                 <integer>571</integer> 
    2319        </array> 
    2420        <key>IBSystem Version</key>