3939#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
4040#define COMPILING_FOR_10_6
4141#endif
42+ #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
43+ #define COMPILING_FOR_10_7
44+ #endif
4245#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 10100
4346#define COMPILING_FOR_10_10
4447#endif
@@ -4883,9 +4886,12 @@ -(void)save_figure:(id)sender
48834886
48844887 int i;
48854888 NSRect rect;
4889+ NSSize size;
4890+ NSSize scale;
48864891
48874892 const float gap = 2 ;
48884893 const int height = 36 ;
4894+ const int imagesize = 24 ;
48894895
48904896 const char * basedir;
48914897
@@ -4926,13 +4932,13 @@ -(void)save_figure:(id)sender
49264932
49274933 NSButton * buttons[7 ];
49284934
4929- NSString * images[7 ] = {@" home.png " ,
4930- @" back.png " ,
4931- @" forward.png " ,
4932- @" move.png " ,
4933- @" zoom_to_rect.png " ,
4934- @" subplots.png " ,
4935- @" filesave.png " };
4935+ NSString * images[7 ] = {@" home.pdf " ,
4936+ @" back.pdf " ,
4937+ @" forward.pdf " ,
4938+ @" move.pdf " ,
4939+ @" zoom_to_rect.pdf " ,
4940+ @" subplots.pdf " ,
4941+ @" filesave.pdf " };
49364942
49374943 NSString * tooltips[7 ] = {@" Reset original view" ,
49384944 @" Back to previous view" ,
@@ -4958,20 +4964,32 @@ -(void)save_figure:(id)sender
49584964 NSMomentaryLightButton ,
49594965 NSMomentaryLightButton };
49604966
4967+ rect.origin .x = 0 ;
4968+ rect.origin .y = 0 ;
4969+ rect.size .width = imagesize;
4970+ rect.size .height = imagesize;
4971+ #ifdef COMPILING_FOR_10_7
4972+ rect = [window convertRectToBacking: rect];
4973+ #endif
4974+ size = rect.size ;
4975+ scale.width = imagesize / size.width ;
4976+ scale.height = imagesize / size.height ;
4977+
49614978 rect.size .width = 32 ;
49624979 rect.size .height = 32 ;
49634980 rect.origin .x = gap;
49644981 rect.origin .y = 0.5 *(height - rect.size .height );
4982+
49654983 for (i = 0 ; i < 7 ; i++)
49664984 {
4967- const NSSize size = {24 , 24 };
49684985 NSString * filename = [dir stringByAppendingPathComponent: images[i]];
49694986 NSImage * image = [[NSImage alloc ] initWithContentsOfFile: filename];
49704987 buttons[i] = [[NSButton alloc ] initWithFrame: rect];
49714988 [image setSize: size];
49724989 [buttons[i] setBezelStyle: NSShadowlessSquareBezelStyle ];
49734990 [buttons[i] setButtonType: buttontypes[i]];
49744991 [buttons[i] setImage: image];
4992+ [buttons[i] scaleUnitSquareToSize: scale];
49754993 [buttons[i] setImagePosition: NSImageOnly];
49764994 [buttons[i] setToolTip: tooltips[i]];
49774995 [[window contentView ] addSubview: buttons[i]];
0 commit comments