39
39
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
40
40
#define COMPILING_FOR_10_6
41
41
#endif
42
+ #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
43
+ #define COMPILING_FOR_10_7
44
+ #endif
42
45
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 10100
43
46
#define COMPILING_FOR_10_10
44
47
#endif
@@ -4883,9 +4886,12 @@ -(void)save_figure:(id)sender
4883
4886
4884
4887
int i;
4885
4888
NSRect rect;
4889
+ NSSize size;
4890
+ NSSize scale;
4886
4891
4887
4892
const float gap = 2;
4888
4893
const int height = 36;
4894
+ const int imagesize = 24;
4889
4895
4890
4896
const char* basedir;
4891
4897
@@ -4926,13 +4932,13 @@ -(void)save_figure:(id)sender
4926
4932
4927
4933
NSButton* buttons[7];
4928
4934
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 "};
4936
4942
4937
4943
NSString* tooltips[7] = {@"Reset original view",
4938
4944
@"Back to previous view",
@@ -4958,20 +4964,32 @@ -(void)save_figure:(id)sender
4958
4964
NSMomentaryLightButton,
4959
4965
NSMomentaryLightButton};
4960
4966
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
+
4961
4978
rect.size.width = 32;
4962
4979
rect.size.height = 32;
4963
4980
rect.origin.x = gap;
4964
4981
rect.origin.y = 0.5*(height - rect.size.height);
4982
+
4965
4983
for (i = 0; i < 7; i++)
4966
4984
{
4967
- const NSSize size = {24, 24};
4968
4985
NSString* filename = [dir stringByAppendingPathComponent: images[i]];
4969
4986
NSImage* image = [[NSImage alloc] initWithContentsOfFile: filename];
4970
4987
buttons[i] = [[NSButton alloc] initWithFrame: rect];
4971
4988
[image setSize: size];
4972
4989
[buttons[i] setBezelStyle: NSShadowlessSquareBezelStyle];
4973
4990
[buttons[i] setButtonType: buttontypes[i]];
4974
4991
[buttons[i] setImage: image];
4992
+ [buttons[i] scaleUnitSquareToSize: scale];
4975
4993
[buttons[i] setImagePosition: NSImageOnly];
4976
4994
[buttons[i] setToolTip: tooltips[i]];
4977
4995
[[window contentView] addSubview: buttons[i]];
0 commit comments