Mercurial > octave
comparison src/display.cc @ 10315:57a59eae83cc
untabify src C++ source files
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 11 Feb 2010 12:41:46 -0500 |
parents | cd96d29c5efa |
children | fd0a3ac60b0e |
comparison
equal
deleted
inserted
replaced
10314:07ebe522dac2 | 10315:57a59eae83cc |
---|---|
47 #if defined (OCTAVE_USE_WINDOWS_API) | 47 #if defined (OCTAVE_USE_WINDOWS_API) |
48 | 48 |
49 HDC hdc = GetDC (0); | 49 HDC hdc = GetDC (0); |
50 | 50 |
51 if (hdc) | 51 if (hdc) |
52 { | 52 { |
53 dp = GetDeviceCaps (hdc, BITSPIXEL); | 53 dp = GetDeviceCaps (hdc, BITSPIXEL); |
54 | 54 |
55 ht = GetDeviceCaps (hdc, VERTRES); | 55 ht = GetDeviceCaps (hdc, VERTRES); |
56 wd = GetDeviceCaps (hdc, HORZRES); | 56 wd = GetDeviceCaps (hdc, HORZRES); |
57 | 57 |
58 double ht_mm = GetDeviceCaps (hdc, VERTSIZE); | 58 double ht_mm = GetDeviceCaps (hdc, VERTSIZE); |
59 double wd_mm = GetDeviceCaps (hdc, HORZSIZE); | 59 double wd_mm = GetDeviceCaps (hdc, HORZSIZE); |
60 | 60 |
61 rx = wd * 25.4 / wd_mm; | 61 rx = wd * 25.4 / wd_mm; |
62 ry = ht * 25.4 / ht_mm; | 62 ry = ht * 25.4 / ht_mm; |
63 } | 63 } |
64 else | 64 else |
65 warning ("no graphical display found"); | 65 warning ("no graphical display found"); |
66 | 66 |
67 #elif defined (HAVE_FRAMEWORK_CARBON) | 67 #elif defined (HAVE_FRAMEWORK_CARBON) |
68 | 68 |
69 CGDirectDisplayID display = CGMainDisplayID (); | 69 CGDirectDisplayID display = CGMainDisplayID (); |
70 | 70 |
71 if (display) | 71 if (display) |
72 { | 72 { |
73 dp = CGDisplayBitsPerPixel (display); | 73 dp = CGDisplayBitsPerPixel (display); |
74 | 74 |
75 ht = CGDisplayPixelsHigh (display); | 75 ht = CGDisplayPixelsHigh (display); |
76 wd = CGDisplayPixelsWide (display); | 76 wd = CGDisplayPixelsWide (display); |
77 | 77 |
78 CGSize sz_mm = CGDisplayScreenSize (display); | 78 CGSize sz_mm = CGDisplayScreenSize (display); |
79 | 79 |
80 // On modern Mac systems (>= 10.5) CGSize is a struct keeping 2 | 80 // On modern Mac systems (>= 10.5) CGSize is a struct keeping 2 |
81 // CGFloat values, but the CGFloat typedef is not present on | 81 // CGFloat values, but the CGFloat typedef is not present on |
82 // older systems, so use double instead. | 82 // older systems, so use double instead. |
83 double ht_mm = sz_mm.height; | 83 double ht_mm = sz_mm.height; |
84 double wd_mm = sz_mm.width; | 84 double wd_mm = sz_mm.width; |
85 | 85 |
86 rx = wd * 25.4 / wd_mm; | 86 rx = wd * 25.4 / wd_mm; |
87 ry = ht * 25.4 / ht_mm; | 87 ry = ht * 25.4 / ht_mm; |
88 } | 88 } |
89 else | 89 else |
90 warning ("no graphical display found"); | 90 warning ("no graphical display found"); |
91 | 91 |
92 #elif defined (HAVE_X_WINDOWS) | 92 #elif defined (HAVE_X_WINDOWS) |
93 | 93 |
94 const char *display_name = getenv ("DISPLAY"); | 94 const char *display_name = getenv ("DISPLAY"); |
95 | 95 |
96 if (display_name && *display_name) | 96 if (display_name && *display_name) |
97 { | 97 { |
98 Display *display = XOpenDisplay (display_name); | 98 Display *display = XOpenDisplay (display_name); |
99 | 99 |
100 if (display) | 100 if (display) |
101 { | 101 { |
102 Screen *screen = DefaultScreenOfDisplay (display); | 102 Screen *screen = DefaultScreenOfDisplay (display); |
103 | 103 |
104 if (screen) | 104 if (screen) |
105 { | 105 { |
106 dp = DefaultDepthOfScreen (screen); | 106 dp = DefaultDepthOfScreen (screen); |
107 | 107 |
108 ht = HeightOfScreen (screen); | 108 ht = HeightOfScreen (screen); |
109 wd = WidthOfScreen (screen); | 109 wd = WidthOfScreen (screen); |
110 | 110 |
111 int screen_number = XScreenNumberOfScreen (screen); | 111 int screen_number = XScreenNumberOfScreen (screen); |
112 | 112 |
113 double ht_mm = DisplayHeightMM (display, screen_number); | 113 double ht_mm = DisplayHeightMM (display, screen_number); |
114 double wd_mm = DisplayWidthMM (display, screen_number); | 114 double wd_mm = DisplayWidthMM (display, screen_number); |
115 | 115 |
116 rx = wd * 25.4 / wd_mm; | 116 rx = wd * 25.4 / wd_mm; |
117 ry = ht * 25.4 / ht_mm; | 117 ry = ht * 25.4 / ht_mm; |
118 } | 118 } |
119 else | 119 else |
120 warning ("X11 display has no default screen"); | 120 warning ("X11 display has no default screen"); |
121 } | 121 } |
122 else | 122 else |
123 warning ("unable to open X11 DISPLAY"); | 123 warning ("unable to open X11 DISPLAY"); |
124 } | 124 } |
125 else | 125 else |
126 warning ("X11 DISPLAY environment variable not set"); | 126 warning ("X11 DISPLAY environment variable not set"); |
127 #else | 127 #else |
128 | 128 |
129 warning ("no graphical display found"); | 129 warning ("no graphical display found"); |
130 | 130 |
131 #endif | 131 #endif |