Molecular Modeling Software
リビジョン | 5831f79238919a12d16f3ca025b2c99fa060d8a5 (tree) |
---|---|
日時 | 2022-09-19 16:31:07 |
作者 | Toshi Nagata <alchemist.2005@nift...> |
コミッター | Toshi Nagata |
Compiler warnings are mostly removed.
@@ -14,14 +14,14 @@ | ||
14 | 14 | <div class="centered" lang="en"> |
15 | 15 | <h1>Molby</h1> |
16 | 16 | <h2>Interactive Molecular Modeling Software<br />with Integrated Ruby Interpreter</h2> |
17 | -<h3>Version 1.0.2</h3> <!-- version --> | |
17 | +<h3>Version 1.1.0</h3> <!-- version --> | |
18 | 18 | <h3>Toshi Nagata</h3> |
19 | 19 | <p><a href="http://molby.osdn.jp/index-en.html">http://molby.osdn.jp/index-en.html</a></p> |
20 | 20 | </div> |
21 | 21 | <div class="centered" lang="ja"> |
22 | 22 | <h1>Molby</h1> |
23 | 23 | <h2>対話型分子モデリングソフトウェア<br />(Ruby インタプリタ内蔵)</h2> |
24 | -<h3>Version 1.0.2</h3> <!-- version --> | |
24 | +<h3>Version 1.1.0</h3> <!-- version --> | |
25 | 25 | <h3>永田 央</h3> |
26 | 26 | <p><a href="http://molby.osdn.jp/index.html">http://molby.osdn.jp/index.html</a></p> |
27 | 27 | </div> |
@@ -96,8 +96,8 @@ Molby は、分子を 3D 表示して、画面上で分子モデルを構築す | ||
96 | 96 | Molby runs on the following platforms. |
97 | 97 | </p> |
98 | 98 | <ul> |
99 | -<li>Microsoft Windows (XP or later, 32 bit or 64 bit).</li> | |
100 | -<li>Mac OS X (10.6 or later, 64 bit Intel).</li> | |
99 | +<li>Microsoft Windows (7 or later, 32 bit or 64 bit).</li> | |
100 | +<li>Mac OS X (10.12 or later, 64 bit Intel).</li> | |
101 | 101 | </ul> |
102 | 102 | |
103 | 103 | <p> |
@@ -114,7 +114,7 @@ Download from the official distribution web site, <a href="http://en.osdn.jp/pro | ||
114 | 114 | <h3>3-1. Microsoft Windows</h3> |
115 | 115 | |
116 | 116 | <p> |
117 | -The Windows version is provided either as a zip archive (<code>MolbyWin.zip</code>) or a standard setup package (<code>SetupMolbyWin.exe</code>). | |
117 | +The Windows version is provided either as a zip archive (<code>MolbyWin32.zip</code>, <code>MolbyWin64.zip</code>) or a standard setup package (<code>SetupMolbyWin32.exe</code>, <code>SetupMolbyWin.exe</code>). | |
118 | 118 | </p> |
119 | 119 | <p> |
120 | 120 | To use the zip archive, expand all contents in your favorite place, and double-click the "Molby" icon. |
@@ -125,10 +125,7 @@ To install on your PC, start the setup package, and follow the instructions. Aft | ||
125 | 125 | |
126 | 126 | <h3>3-2. Mac OS X</h3> |
127 | 127 | <p> |
128 | -The Mac version is provided as a zip archive (<code>MolbyMac.zip</code>). Double-click the archive, and you will get a folder including the Molby application. Drag it to the "Applications" folder in your hard drive. | |
129 | -</p> | |
130 | -<p> | |
131 | -<span class="italic">Note:</span> The Mac version is provided as a universal binary, which runs natively on both PowerPC and Intel platforms. | |
128 | +The Mac version is provided as a zip archive (<code>MolbyMac.zip</code>, <code>MolbyMacLegacy.zip</code> for MacOS 10.6 to 10.11). Double-click the archive, and you will get a folder including the Molby application. Drag it to the "Applications" folder in your hard drive. | |
132 | 129 | </p> |
133 | 130 | |
134 | 131 | <h2>4. Uninstallation</h2> |
@@ -149,8 +146,8 @@ Trash the Molby application in the "Applications" folder. | ||
149 | 146 | Molbyは以下のプラットフォームで動作します。 |
150 | 147 | </p> |
151 | 148 | <ul> |
152 | -<li>Microsoft Windows (XPまたはそれ以降, 32ビットまたは64ビット).</li> | |
153 | -<li>Mac OS X (10.6 またはそれ以降、64ビット).</li> | |
149 | +<li>Microsoft Windows (7またはそれ以降, 32ビットまたは64ビット).</li> | |
150 | +<li>Mac OS X (10.12 またはそれ以降、64ビット).</li> | |
154 | 151 | </ul> |
155 | 152 | |
156 | 153 | <p> |
@@ -167,7 +164,7 @@ Molbyは以下のプラットフォームで動作します。 | ||
167 | 164 | <h3>3-1. Microsoft Windows</h3> |
168 | 165 | |
169 | 166 | <p> |
170 | -Windows版は、zip アーカイブ(<code>MolbyWin32.zip</code>:32 ビット版, <code>MolbyWin64.zip</code>: 64ビット版)、または標準のセットアップパッケージ (<code>SetupMolbyWin32.exe</code>: 32ビット版、<code>SetupMolbyWin64.exe</code>: 64ビット版) で配布されています。どちらも内容は同じです。 | |
167 | +Windows版は、zip アーカイブ(<code>MolbyWin32.zip</code>:32 ビット版, <code>MolbyWin64.zip</code>: 64ビット版)、または標準のセットアップパッケージ (<code>SetupMolbyWin32.exe</code>: 32ビット版、<code>SetupMolbyWin64.exe</code>: 64ビット版) で配布されています。 | |
171 | 168 | </p> |
172 | 169 | <p> |
173 | 170 | Zip アーカイブを使う時は、最初に内容をすべて展開してください。展開したフォルダの中に Molby アプリケーションがあるので、ダブルクリックして起動してください。 |
@@ -178,10 +175,7 @@ Zip アーカイブを使う時は、最初に内容をすべて展開してく | ||
178 | 175 | |
179 | 176 | <h3>3-2. Mac OS X</h3> |
180 | 177 | <p> |
181 | -Mac版は、zip アーカイブ (<code>MolbyMac.zip</code>) で配布されています。アーカイブをダブルクリックすると、内容が展開されて新しいフォルダができます。Molby アプリケーションがその中にありますので、ハードディスクの「アプリケーション」フォルダにドラッグコピーしてください。 | |
182 | -</p> | |
183 | -<p> | |
184 | -<span class="italic">注:</span> Version 1.0 から、Mac 版は 64 bit のみになりました。 | |
178 | +Mac版は、zip アーカイブ (<code>MolbyMac.zip</code>, <code>MolbyMacLegacy.zip</code> [10.6〜10.11用]) で配布されています。アーカイブをダブルクリックすると、内容が展開されて新しいフォルダができます。Molby アプリケーションがその中にありますので、ハードディスクの「アプリケーション」フォルダにドラッグコピーしてください。 | |
185 | 179 | </p> |
186 | 180 | |
187 | 181 | <h2>4. アンインストール</h2> |
@@ -218,7 +212,7 @@ I ask for citation of the following paper in published works that utilize Molby: | ||
218 | 212 | <p> |
219 | 213 | Toshi Nagata, "Molby - Graphical Molecular Modeling Software with Integrated Ruby Interpreter," |
220 | 214 | <br /> |
221 | -<i>Bull. Chem. Soc. Jpn.</i> <b>2014,</b> in press. DOI:<a href="http://dx.doi.org/10.1246/bcsj.20140093">10.1246/bcsj.20140093</a> | |
215 | +<i>Bull. Chem. Soc. Jpn.</i> <b>2014,</b> <i>87,</i> 902-904. DOI:<a href="http://dx.doi.org/10.1246/bcsj.20140093">10.1246/bcsj.20140093</a> | |
222 | 216 | </p> |
223 | 217 | </blockquote> |
224 | 218 | <p> |
@@ -229,7 +223,7 @@ Molby includes the following softwares, which are copyrighted products as descri | ||
229 | 223 | <a href="http://ambermd.org/">AmberTools 1.3</a>: Copyright (C) Junmei Wang, Ross C. Walker, Michael F. Crowley, Scott Brozell and David A. Case |
230 | 224 | </li> |
231 | 225 | <li> |
232 | -<a href="http://www.wxwidgets.org/">wxWidgets 3.0.0</a>: Copyright (C) 1992-2013 Julian Smart, Robert Roebling, Vadim Zeitlin and other members of the wxWidgets team. Portions (c) 1996 Artificial Intelligence Applications Institute | |
226 | +<a href="http://www.wxwidgets.org/">wxWidgets 3.2.0</a>: Copyright (C) 1992-2022 Julian Smart, Robert Roebling, Vadim Zeitlin and other members of the wxWidgets team. Portions (c) 1996 Artificial Intelligence Applications Institute | |
233 | 227 | </li> |
234 | 228 | <li> |
235 | 229 | <a href="http://www.ruby-lang.org/">Ruby 2.0.0</a>: Copyright (C) 1993-2013 Yukihiro Matsumoto |
@@ -248,7 +242,7 @@ Burnett, M. N.; Johnson, C. K. <i>ORTEP-III: Oak Ridge Thermal Ellipsoid Plot Pr | ||
248 | 242 | |
249 | 243 | <h2>2. License</h2> |
250 | 244 | <p> |
251 | -Molby is distributed under the GNU General Public License (version 2). | |
245 | +Molby is distributed under the GNU General Public License (version 3). | |
252 | 246 | </p> |
253 | 247 | <blockquote> |
254 | 248 | <p> |
@@ -260,7 +254,7 @@ Copyright (C) 2008-2022 Toshi Nagata <!-- copyright --> | ||
260 | 254 | <p> |
261 | 255 | This program is free software; you can redistribute it and/or modify |
262 | 256 | it under the terms of the GNU General Public License as published by |
263 | -the Free Software Foundation; either version 2 of the License, or | |
257 | +the Free Software Foundation; either version 3 of the License, or | |
264 | 258 | (at your option) any later version. |
265 | 259 | </p> |
266 | 260 | <p> |
@@ -286,7 +280,7 @@ Molby を利用した成果を発表される際は、以下の論文を引用 | ||
286 | 280 | <blockquote> |
287 | 281 | <p> |
288 | 282 | Toshi Nagata, "Molby - Graphical Molecular Modeling Software with Integrated Ruby Interpreter," <br /> |
289 | -<i>Bull. Chem. Soc. Jpn.</i> <b>2014,</b> in press. DOI:<a href="http://dx.doi.org/10.1246/bcsj.20140093">10.1246/bcsj.20140093</a> | |
283 | +<i>Bull. Chem. Soc. Jpn.</i> <b>2014,</b> <i>87,</i> 902-904. DOI:<a href="http://dx.doi.org/10.1246/bcsj.20140093">10.1246/bcsj.20140093</a> | |
290 | 284 | </p> |
291 | 285 | </blockquote> |
292 | 286 | <p> |
@@ -297,7 +291,7 @@ Molby は以下のソフトウェアを含んでいます。それぞれの著 | ||
297 | 291 | <a href="http://ambermd.org/">AmberTools 1.3</a>: Copyright (C) Junmei Wang, Ross C. Walker, Michael F. Crowley, Scott Brozell and David A. Case |
298 | 292 | </li> |
299 | 293 | <li> |
300 | -<a href="http://www.wxwidgets.org/">wxWidgets 3.0.0</a>: Copyright (C) 1992-2013 Julian Smart, Robert Roebling, Vadim Zeitlin and other members of the wxWidgets team. Portions (c) 1996 Artificial Intelligence Applications Institute | |
294 | +<a href="http://www.wxwidgets.org/">wxWidgets 3.2.0</a>: Copyright (C) 1992-2022 Julian Smart, Robert Roebling, Vadim Zeitlin and other members of the wxWidgets team. Portions (c) 1996 Artificial Intelligence Applications Institute | |
301 | 295 | </li> |
302 | 296 | <li> |
303 | 297 | <a href="http://www.ruby-lang.org/">Ruby 2.0.0</a>: Copyright (C) 1993-2013 Yukihiro Matsumoto |
@@ -316,7 +310,7 @@ Burnett, M. N.; Johnson, C. K. <i>ORTEP-III: Oak Ridge Thermal Ellipsoid Plot Pr | ||
316 | 310 | |
317 | 311 | <h2>2. ライセンス</h2> |
318 | 312 | <p> |
319 | -Molby は <a href="../etc/gpl.txt">GNU General Public License (GNU 一般公衆利用許諾契約書, version 2)</a> に従って配布します。 | |
313 | +Molby は <a href="../etc/gpl.txt">GNU General Public License (GNU 一般公衆利用許諾契約書, version 3)</a> に従って配布します。 | |
320 | 314 | </p> |
321 | 315 | <blockquote> |
322 | 316 | <p> |
@@ -326,7 +320,7 @@ Molby: 対話型分子モデルソフトウェア(Ruby インタプリタ内 | ||
326 | 320 | Copyright (C) 2008-2022 Toshi Nagata <!-- copyright --> |
327 | 321 | </p> |
328 | 322 | <p> |
329 | -このプログラムはフリーソフトウェアです。あなたはこれを、フリーソフトウェア財団によって発行された GNU 一般公衆利用許諾契約書(バージョン2か、希望によってはそれ以降のバージョンのうちどれか)の定める条件の下で再頒布または改変することができます。 | |
323 | +このプログラムはフリーソフトウェアです。あなたはこれを、フリーソフトウェア財団によって発行された GNU 一般公衆利用許諾契約書(バージョン3か、希望によってはそれ以降のバージョンのうちどれか)の定める条件の下で再頒布または改変することができます。 | |
330 | 324 | </p> |
331 | 325 | <p> |
332 | 326 | このプログラムは有用であることを願って頒布されますが、*全くの無保証* です。商業可能性の保証や特定の目的への適合性は、言外に示されたものも含め全く存在しません。詳しくはGNU 一般公衆利用許諾契約書をご覧ください。 |
@@ -21,6 +21,8 @@ | ||
21 | 21 | #include <stdlib.h> |
22 | 22 | #include <string.h> |
23 | 23 | |
24 | +#include "Missing.h" | |
25 | + | |
24 | 26 | extern int do_custom_bond_callback(MDArena *arena, Double r, void *procObj, Double *energy, Double *force); |
25 | 27 | |
26 | 28 | static void |
@@ -126,7 +126,7 @@ pressure_control(MDArena *arena) | ||
126 | 126 | Transform tf; |
127 | 127 | Vector v; |
128 | 128 | Vector cello_new; |
129 | - Mat33 celltr_save; | |
129 | + Transform celltr_save; | |
130 | 130 | Double w, w0; |
131 | 131 | int i; |
132 | 132 | int needs_cell_recalculate = 0; |
@@ -27,6 +27,7 @@ | ||
27 | 27 | #include <stdlib.h> |
28 | 28 | #include <string.h> |
29 | 29 | #include <ctype.h> |
30 | +#include <math.h> | |
30 | 31 | |
31 | 32 | #define biso2radius(r) ((r) > 0.5 ? sqrt((r) / 78.9568352087147) : 0.08) |
32 | 33 |
@@ -36,6 +37,168 @@ | ||
36 | 37 | /* Invalid bond/angle/torsion value, used in internal cache */ |
37 | 38 | const Double kInvalidValue = -10000000.0; |
38 | 39 | |
40 | +#pragma mark ==== OpenGL utility functions === | |
41 | + | |
42 | +static void __gluMultMatrixVecf(const GLdouble matrix[16], const GLdouble in[4], GLdouble out[4]) | |
43 | +{ | |
44 | + int i; | |
45 | + for (i = 0; i < 4; i++) { | |
46 | + out[i] = in[0] * matrix[0*4+i] + in[1] * matrix[1*4+i] + in[2] * matrix[2*4+i] + in[3] * matrix[3*4+i]; | |
47 | + } | |
48 | +} | |
49 | + | |
50 | +static int __gluInvertMatrixf(const GLdouble m[16], GLdouble invOut[16]) | |
51 | +{ | |
52 | + GLdouble inv[16], det; | |
53 | + int i; | |
54 | + | |
55 | + inv[0] = m[5]*m[10]*m[15] - m[5]*m[11]*m[14] - m[9]*m[6]*m[15] | |
56 | + + m[9]*m[7]*m[14] + m[13]*m[6]*m[11] - m[13]*m[7]*m[10]; | |
57 | + inv[4] = -m[4]*m[10]*m[15] + m[4]*m[11]*m[14] + m[8]*m[6]*m[15] | |
58 | + - m[8]*m[7]*m[14] - m[12]*m[6]*m[11] + m[12]*m[7]*m[10]; | |
59 | + inv[8] = m[4]*m[9]*m[15] - m[4]*m[11]*m[13] - m[8]*m[5]*m[15] | |
60 | + + m[8]*m[7]*m[13] + m[12]*m[5]*m[11] - m[12]*m[7]*m[9]; | |
61 | + inv[12] = -m[4]*m[9]*m[14] + m[4]*m[10]*m[13] + m[8]*m[5]*m[14] | |
62 | + - m[8]*m[6]*m[13] - m[12]*m[5]*m[10] + m[12]*m[6]*m[9]; | |
63 | + inv[1] = -m[1]*m[10]*m[15] + m[1]*m[11]*m[14] + m[9]*m[2]*m[15] | |
64 | + - m[9]*m[3]*m[14] - m[13]*m[2]*m[11] + m[13]*m[3]*m[10]; | |
65 | + inv[5] = m[0]*m[10]*m[15] - m[0]*m[11]*m[14] - m[8]*m[2]*m[15] | |
66 | + + m[8]*m[3]*m[14] + m[12]*m[2]*m[11] - m[12]*m[3]*m[10]; | |
67 | + inv[9] = -m[0]*m[9]*m[15] + m[0]*m[11]*m[13] + m[8]*m[1]*m[15] | |
68 | + - m[8]*m[3]*m[13] - m[12]*m[1]*m[11] + m[12]*m[3]*m[9]; | |
69 | + inv[13] = m[0]*m[9]*m[14] - m[0]*m[10]*m[13] - m[8]*m[1]*m[14] | |
70 | + + m[8]*m[2]*m[13] + m[12]*m[1]*m[10] - m[12]*m[2]*m[9]; | |
71 | + inv[2] = m[1]*m[6]*m[15] - m[1]*m[7]*m[14] - m[5]*m[2]*m[15] | |
72 | + + m[5]*m[3]*m[14] + m[13]*m[2]*m[7] - m[13]*m[3]*m[6]; | |
73 | + inv[6] = -m[0]*m[6]*m[15] + m[0]*m[7]*m[14] + m[4]*m[2]*m[15] | |
74 | + - m[4]*m[3]*m[14] - m[12]*m[2]*m[7] + m[12]*m[3]*m[6]; | |
75 | + inv[10] = m[0]*m[5]*m[15] - m[0]*m[7]*m[13] - m[4]*m[1]*m[15] | |
76 | + + m[4]*m[3]*m[13] + m[12]*m[1]*m[7] - m[12]*m[3]*m[5]; | |
77 | + inv[14] = -m[0]*m[5]*m[14] + m[0]*m[6]*m[13] + m[4]*m[1]*m[14] | |
78 | + - m[4]*m[2]*m[13] - m[12]*m[1]*m[6] + m[12]*m[2]*m[5]; | |
79 | + inv[3] = -m[1]*m[6]*m[11] + m[1]*m[7]*m[10] + m[5]*m[2]*m[11] | |
80 | + - m[5]*m[3]*m[10] - m[9]*m[2]*m[7] + m[9]*m[3]*m[6]; | |
81 | + inv[7] = m[0]*m[6]*m[11] - m[0]*m[7]*m[10] - m[4]*m[2]*m[11] | |
82 | + + m[4]*m[3]*m[10] + m[8]*m[2]*m[7] - m[8]*m[3]*m[6]; | |
83 | + inv[11] = -m[0]*m[5]*m[11] + m[0]*m[7]*m[9] + m[4]*m[1]*m[11] | |
84 | + - m[4]*m[3]*m[9] - m[8]*m[1]*m[7] + m[8]*m[3]*m[5]; | |
85 | + inv[15] = m[0]*m[5]*m[10] - m[0]*m[6]*m[9] - m[4]*m[1]*m[10] | |
86 | + + m[4]*m[2]*m[9] + m[8]*m[1]*m[6] - m[8]*m[2]*m[5]; | |
87 | + | |
88 | + det = m[0]*inv[0] + m[1]*inv[4] + m[2]*inv[8] + m[3]*inv[12]; | |
89 | + if (det == 0) | |
90 | + return GL_FALSE; | |
91 | + | |
92 | + det = 1.0 / det; | |
93 | + | |
94 | + for (i = 0; i < 16; i++) | |
95 | + invOut[i] = inv[i] * det; | |
96 | + | |
97 | + return GL_TRUE; | |
98 | +} | |
99 | + | |
100 | +static void __gluMultMatricesf(const GLdouble a[16], const GLdouble b[16], | |
101 | + GLdouble r[16]) | |
102 | +{ | |
103 | + int i, j; | |
104 | + for (i = 0; i < 4; i++) { | |
105 | + for (j = 0; j < 4; j++) { | |
106 | + r[i*4+j] = a[i*4+0]*b[0*4+j] + a[i*4+1]*b[1*4+j] + a[i*4+2]*b[2*4+j] + a[i*4+3]*b[3*4+j]; | |
107 | + } | |
108 | + } | |
109 | +} | |
110 | + | |
111 | +GLint | |
112 | +myGluProject(GLdouble objx, GLdouble objy, GLdouble objz, const GLdouble modelMatrix[16], const GLdouble projMatrix[16], const GLint viewport[4], GLdouble *winx, GLdouble *winy, GLdouble *winz) | |
113 | +{ | |
114 | + GLdouble in[4]; | |
115 | + GLdouble out[4]; | |
116 | + | |
117 | + in[0] = objx; | |
118 | + in[1] = objy; | |
119 | + in[2] = objz; | |
120 | + in[3] = 1.0; | |
121 | + __gluMultMatrixVecf(modelMatrix, in, out); | |
122 | + __gluMultMatrixVecf(projMatrix, out, in); | |
123 | + if (in[3] == 0.0) | |
124 | + return(GL_FALSE); | |
125 | + in[0] /= in[3]; | |
126 | + in[1] /= in[3]; | |
127 | + in[2] /= in[3]; | |
128 | + /* Map x, y and z to range 0-1 */ | |
129 | + in[0] = in[0] * 0.5 + 0.5; | |
130 | + in[1] = in[1] * 0.5 + 0.5; | |
131 | + in[2] = in[2] * 0.5 + 0.5; | |
132 | + /* Map x,y to viewport */ | |
133 | + in[0] = in[0] * viewport[2] + viewport[0]; | |
134 | + in[1] = in[1] * viewport[3] + viewport[1]; | |
135 | + *winx = in[0]; | |
136 | + *winy = in[1]; | |
137 | + *winz = in[2]; | |
138 | + return(GL_TRUE); | |
139 | +} | |
140 | + | |
141 | +GLint | |
142 | +myGluUnProject(GLdouble winx, GLdouble winy, GLdouble winz, const GLdouble modelMatrix[16], const GLdouble projMatrix[16], const GLint viewport[4], GLdouble *objx, GLdouble *objy, GLdouble *objz) | |
143 | +{ | |
144 | + GLdouble finalMatrix[16]; | |
145 | + GLdouble in[4]; | |
146 | + GLdouble out[4]; | |
147 | + | |
148 | + __gluMultMatricesf(modelMatrix, projMatrix, finalMatrix); | |
149 | + if (!__gluInvertMatrixf(finalMatrix, finalMatrix)) | |
150 | + return(GL_FALSE); | |
151 | + | |
152 | + in[0] = winx; | |
153 | + in[1] = winy; | |
154 | + in[2] = winz; | |
155 | + in[3] = 1.0; | |
156 | + | |
157 | + /* Map x and y from window coordinates */ | |
158 | + in[0] = (in[0] - viewport[0]) / viewport[2]; | |
159 | + in[1] = (in[1] - viewport[1]) / viewport[3]; | |
160 | + | |
161 | + /* Map to range -1 to 1 */ | |
162 | + in[0] = in[0] * 2 - 1; | |
163 | + in[1] = in[1] * 2 - 1; | |
164 | + in[2] = in[2] * 2 - 1; | |
165 | + | |
166 | + __gluMultMatrixVecf(finalMatrix, in, out); | |
167 | + if (out[3] == 0.0) return(GL_FALSE); | |
168 | + out[0] /= out[3]; | |
169 | + out[1] /= out[3]; | |
170 | + out[2] /= out[3]; | |
171 | + *objx = out[0]; | |
172 | + *objy = out[1]; | |
173 | + *objz = out[2]; | |
174 | + return(GL_TRUE); | |
175 | +} | |
176 | + | |
177 | +void | |
178 | +myGluPerspective(GLdouble fovy_degree, GLdouble aspect, GLdouble zNear, GLdouble zFar) { | |
179 | + GLdouble m[16]; | |
180 | + GLdouble fovy_rad = fovy_degree * (3.14159265358979 / 180.0); | |
181 | + GLdouble f = 1.0 / tan(fovy_rad / (GLdouble)2.0); | |
182 | + m[0] = f / aspect; | |
183 | + m[1] = 0.0; | |
184 | + m[2] = 0.0; | |
185 | + m[3] = 0.0; | |
186 | + m[4] = 0.0; | |
187 | + m[5] = f; | |
188 | + m[6] = 0.0; | |
189 | + m[7] = 0.0; | |
190 | + m[8] = 0.0; | |
191 | + m[9] = 0.0; | |
192 | + m[10] = (zFar + zNear) / (zNear - zFar); | |
193 | + m[11] = -1.0; | |
194 | + m[12] = 0.0; | |
195 | + m[13] = 0.0; | |
196 | + m[14] = (2 * zFar * zNear) / (zNear - zFar); | |
197 | + m[15] = 0.0; | |
198 | + glMatrixMode(GL_PROJECTION); | |
199 | + glLoadMatrixd(m); | |
200 | +} | |
201 | + | |
39 | 202 | #pragma mark ==== MainView public methods ==== |
40 | 203 | |
41 | 204 | void |
@@ -298,7 +461,7 @@ MainView_convertScreenPositionToObjectPosition(MainView *mview, const GLfloat *s | ||
298 | 461 | winZ = screenPos[2]; |
299 | 462 | else |
300 | 463 | glReadPixels(screenPos[0] * scale, screenPos[1] * scale, 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &winZ); |
301 | - gluUnProject(screenPos[0] * scale, screenPos[1] * scale, winZ, mview->modelview_matrix, mview->projection_matrix, viewport, &posX, &posY, &posZ); | |
464 | + myGluUnProject(screenPos[0] * scale, screenPos[1] * scale, winZ, mview->modelview_matrix, mview->projection_matrix, viewport, &posX, &posY, &posZ); | |
302 | 465 | n = glGetError(); |
303 | 466 | MainViewCallback_unlockFocus(mview); |
304 | 467 | objectPos[0] = posX; |
@@ -323,7 +486,7 @@ MainView_convertObjectPositionToScreenPosition(MainView *mview, const double *ob | ||
323 | 486 | viewport[0] = viewport[1] = 0; |
324 | 487 | viewport[2] = (GLint)(rect[2] - rect[0]) * scale; |
325 | 488 | viewport[3] = (GLint)(rect[3] - rect[1]) * scale; |
326 | - gluProject(objectPos[0], objectPos[1], objectPos[2], mview->modelview_matrix, mview->projection_matrix, viewport, &objX, &objY, &objZ); | |
489 | + myGluProject(objectPos[0], objectPos[1], objectPos[2], mview->modelview_matrix, mview->projection_matrix, viewport, &objX, &objY, &objZ); | |
327 | 490 | if (glGetError() == GL_NO_ERROR) { |
328 | 491 | screenPos[0] = objX / scale; |
329 | 492 | screenPos[1] = objY / scale; |
@@ -1777,7 +1940,7 @@ MainView_drawModel(MainView *mview) | ||
1777 | 1940 | mview->perspective_vector[1] = width / height; |
1778 | 1941 | mview->perspective_vector[2] = dimension; |
1779 | 1942 | mview->perspective_vector[3] = distance + 200.0 * dimension; |
1780 | - gluPerspective(mview->perspective_vector[0], mview->perspective_vector[1], mview->perspective_vector[2], mview->perspective_vector[3]); | |
1943 | + myGluPerspective(mview->perspective_vector[0], mview->perspective_vector[1], mview->perspective_vector[2], mview->perspective_vector[3]); | |
1781 | 1944 | |
1782 | 1945 | /* Set up the model view */ |
1783 | 1946 | glMatrixMode(GL_MODELVIEW); |
@@ -634,7 +634,7 @@ s_MolActionLog(Molecule *mol, MolAction *action, FILE *fp) | ||
634 | 634 | MoleculeCallback_displayName(argp->u.mval, buf, sizeof buf); |
635 | 635 | if (buf[0] == 0) { |
636 | 636 | /* No associated document */ |
637 | - snprintf(buf, sizeof buf, "#<Molecule:0x%lx>", (long unsigned)(void *)argp->u.mval); | |
637 | + snprintf(buf, sizeof buf, "#<Molecule:0x%lx>", (uintptr_t)(void *)argp->u.mval); | |
638 | 638 | } |
639 | 639 | fprintf(fp, "%s", buf); |
640 | 640 | break; |
@@ -9387,12 +9387,12 @@ MoleculeChangeResidueNumberWithArray(Molecule *mp, IntGroup *group, Int *resSeqs | ||
9387 | 9387 | Atom *ap; |
9388 | 9388 | |
9389 | 9389 | /* If LSB of resSeqs is 1, then a constant value is used for all specified atoms */ |
9390 | - if (((int)resSeqs & 1) == 0) { | |
9390 | + if (((uintptr_t)resSeqs & 1) == 0) { | |
9391 | 9391 | withArray = 1; |
9392 | 9392 | resSeq = 0; |
9393 | 9393 | } else { |
9394 | 9394 | withArray = 0; |
9395 | - resSeq = ((int)resSeqs - 1) / 2; | |
9395 | + resSeq = ((uintptr_t)resSeqs - 1) / 2; | |
9396 | 9396 | } |
9397 | 9397 | |
9398 | 9398 | IntGroupIteratorInit(group, &iter); |
@@ -21,6 +21,7 @@ | ||
21 | 21 | #include <stdarg.h> |
22 | 22 | #include <math.h> |
23 | 23 | #include <float.h> |
24 | +#include "Missing.h" | |
24 | 25 | |
25 | 26 | /* Global parameter: it is initialized by the first call to ParameterReadFromFile() */ |
26 | 27 | Parameter *gBuiltinParameters = NULL; |
@@ -789,7 +789,7 @@ static VALUE | ||
789 | 789 | s_Ruby_UpdateUI_handler(VALUE data) |
790 | 790 | { |
791 | 791 | void **p = (void **)data; |
792 | - int index = (int)p[0]; | |
792 | + int index = (intptr_t)p[0]; | |
793 | 793 | Molecule *mol = (Molecule *)p[1]; |
794 | 794 | int *outChecked = (int *)p[2]; |
795 | 795 | char **outTitle = (char **)p[3]; |
@@ -8626,7 +8626,7 @@ s_Molecule_FitCoordinates(int argc, VALUE *argv, VALUE self) | ||
8626 | 8626 | VALUE gval, rval, wval; |
8627 | 8627 | IntGroup *ig; |
8628 | 8628 | IntGroupIterator iter; |
8629 | - int nn, errno, i, j, in, status; | |
8629 | + int nn, errnum, i, j, in, status; | |
8630 | 8630 | Vector *ref; |
8631 | 8631 | Double *weights, dval[3]; |
8632 | 8632 | Transform tr; |
@@ -8647,7 +8647,7 @@ s_Molecule_FitCoordinates(int argc, VALUE *argv, VALUE self) | ||
8647 | 8647 | if (rb_obj_is_kind_of(rval, rb_cNumeric)) { |
8648 | 8648 | int fn = NUM2INT(rb_Integer(rval)); |
8649 | 8649 | if (fn < 0 || fn >= MoleculeGetNumberOfFrames(mol)) { |
8650 | - errno = 1; | |
8650 | + errnum = 1; | |
8651 | 8651 | status = fn; |
8652 | 8652 | goto err; |
8653 | 8653 | } |
@@ -8660,7 +8660,7 @@ s_Molecule_FitCoordinates(int argc, VALUE *argv, VALUE self) | ||
8660 | 8660 | } else if (rb_obj_is_kind_of(rval, rb_cLAMatrix)) { |
8661 | 8661 | LAMatrix *m = LAMatrixFromValue(rval, NULL, 0, 0); |
8662 | 8662 | if (m->row * m->column < nn * 3) { |
8663 | - errno = 2; | |
8663 | + errnum = 2; | |
8664 | 8664 | goto err; |
8665 | 8665 | } |
8666 | 8666 | for (i = 0; i < nn; i++) { |
@@ -8672,24 +8672,24 @@ s_Molecule_FitCoordinates(int argc, VALUE *argv, VALUE self) | ||
8672 | 8672 | VALUE aval; |
8673 | 8673 | rval = rb_protect(rb_ary_to_ary, rval, &status); |
8674 | 8674 | if (status != 0) { |
8675 | - errno = 3; | |
8675 | + errnum = 3; | |
8676 | 8676 | goto err; |
8677 | 8677 | } |
8678 | 8678 | if (RARRAY_LEN(rval) < nn) { |
8679 | - errno = 2; | |
8679 | + errnum = 2; | |
8680 | 8680 | goto err; |
8681 | 8681 | } |
8682 | 8682 | if (rb_obj_is_kind_of((RARRAY_PTR(rval))[0], rb_cNumeric)) { |
8683 | 8683 | /* Array of 3*nn numbers */ |
8684 | 8684 | if (RARRAY_LEN(rval) < nn * 3) { |
8685 | - errno = 2; | |
8685 | + errnum = 2; | |
8686 | 8686 | goto err; |
8687 | 8687 | } |
8688 | 8688 | for (i = 0; i < nn; i++) { |
8689 | 8689 | for (j = 0; j < 3; j++) { |
8690 | 8690 | aval = rb_protect(rb_Float, (RARRAY_PTR(rval))[i * 3 + j], &status); |
8691 | 8691 | if (status != 0) { |
8692 | - errno = 3; | |
8692 | + errnum = 3; | |
8693 | 8693 | goto err; |
8694 | 8694 | } |
8695 | 8695 | dval[j] = NUM2DBL(aval); |
@@ -8707,18 +8707,18 @@ s_Molecule_FitCoordinates(int argc, VALUE *argv, VALUE self) | ||
8707 | 8707 | } else { |
8708 | 8708 | aval = rb_protect(rb_ary_to_ary, aval, &status); |
8709 | 8709 | if (status != 0) { |
8710 | - errno = 3; | |
8710 | + errnum = 3; | |
8711 | 8711 | goto err; |
8712 | 8712 | } |
8713 | 8713 | if (RARRAY_LEN(aval) < 3) { |
8714 | - errno = 4; | |
8714 | + errnum = 4; | |
8715 | 8715 | status = i; |
8716 | 8716 | goto err; |
8717 | 8717 | } |
8718 | 8718 | for (j = 0; j < 3; j++) { |
8719 | 8719 | VALUE aaval = rb_protect(rb_Float, (RARRAY_PTR(aval))[j], &status); |
8720 | 8720 | if (status != 0) { |
8721 | - errno = 3; | |
8721 | + errnum = 3; | |
8722 | 8722 | goto err; |
8723 | 8723 | } |
8724 | 8724 | dval[j] = NUM2DBL(aaval); |
@@ -8740,17 +8740,17 @@ s_Molecule_FitCoordinates(int argc, VALUE *argv, VALUE self) | ||
8740 | 8740 | } else { |
8741 | 8741 | wval = rb_protect(rb_ary_to_ary, wval, &status); |
8742 | 8742 | if (status != 0) { |
8743 | - errno = 3; | |
8743 | + errnum = 3; | |
8744 | 8744 | goto err; |
8745 | 8745 | } |
8746 | 8746 | if (RARRAY_LEN(wval) < nn) { |
8747 | - errno = 5; | |
8747 | + errnum = 5; | |
8748 | 8748 | goto err; |
8749 | 8749 | } |
8750 | 8750 | for (i = 0; i < nn; i++) { |
8751 | 8751 | VALUE wwval = rb_protect(rb_Float, (RARRAY_PTR(wval))[i], &status); |
8752 | 8752 | if (status != 0) { |
8753 | - errno = 3; | |
8753 | + errnum = 3; | |
8754 | 8754 | goto err; |
8755 | 8755 | } |
8756 | 8756 | weights[i] = NUM2DBL(wwval); |
@@ -8758,27 +8758,27 @@ s_Molecule_FitCoordinates(int argc, VALUE *argv, VALUE self) | ||
8758 | 8758 | } |
8759 | 8759 | dval[0] = s_Molecule_FitCoordinates_Sub(mol, ig, ref, weights, tr); |
8760 | 8760 | if (dval[0] < 0) { |
8761 | - errno = 6; | |
8761 | + errnum = 6; | |
8762 | 8762 | goto err; |
8763 | 8763 | } |
8764 | - errno = 0; | |
8764 | + errnum = 0; | |
8765 | 8765 | err: |
8766 | 8766 | IntGroupIteratorRelease(&iter); |
8767 | 8767 | free(ref); |
8768 | 8768 | free(weights); |
8769 | - if (errno == 0) { | |
8769 | + if (errnum == 0) { | |
8770 | 8770 | return rb_ary_new3(2, ValueFromTransform(&tr), rb_float_new(dval[0])); |
8771 | - } else if (errno == 1) { | |
8771 | + } else if (errnum == 1) { | |
8772 | 8772 | rb_raise(rb_eMolbyError, "frame index (%d) is out of range", status); |
8773 | - } else if (errno == 2) { | |
8773 | + } else if (errnum == 2) { | |
8774 | 8774 | rb_raise(rb_eMolbyError, "insufficient number of reference coordinates"); |
8775 | - } else if (errno == 3) { | |
8775 | + } else if (errnum == 3) { | |
8776 | 8776 | rb_jump_tag(status); |
8777 | - } else if (errno == 4) { | |
8777 | + } else if (errnum == 4) { | |
8778 | 8778 | rb_raise(rb_eMolbyError, "less than 3 elements for index %d of reference coordinates", status); |
8779 | - } else if (errno == 5) { | |
8779 | + } else if (errnum == 5) { | |
8780 | 8780 | rb_raise(rb_eMolbyError, "insufficient number of weight values"); |
8781 | - } else if (errno == 6) { | |
8781 | + } else if (errnum == 6) { | |
8782 | 8782 | rb_raise(rb_eMolbyError, "matrix calculation failed during coordinate fitting"); |
8783 | 8783 | } |
8784 | 8784 | return Qnil; /* Not reached */ |
@@ -1773,26 +1773,26 @@ s_RubyDialog_doTableAction(VALUE val) | ||
1773 | 1773 | vp[3] = (void *)(intptr_t)(NUM2INT(rb_Integer(retval))); |
1774 | 1774 | return retval; |
1775 | 1775 | } else if (sym == sOnGetValueSymbol) { |
1776 | - args[1] = INT2NUM((int)vp[3]); | |
1777 | - args[2] = INT2NUM((int)vp[4]); | |
1776 | + args[1] = INT2NUM((intptr_t)vp[3]); | |
1777 | + args[2] = INT2NUM((intptr_t)vp[4]); | |
1778 | 1778 | retval = s_RubyDialog_CallActionProc(self, pval, 3, args); |
1779 | 1779 | retval = rb_str_to_str(retval); |
1780 | 1780 | vp[5] = strdup(EncodedStringValuePtr(retval)); |
1781 | 1781 | return retval; |
1782 | 1782 | } else if (sym == sOnSetValueSymbol) { |
1783 | - args[1] = INT2NUM((int)vp[3]); | |
1784 | - args[2] = INT2NUM((int)vp[4]); | |
1783 | + args[1] = INT2NUM((intptr_t)vp[3]); | |
1784 | + args[2] = INT2NUM((intptr_t)vp[4]); | |
1785 | 1785 | args[3] = Ruby_NewEncodedStringValue2((char *)vp[5]); |
1786 | 1786 | retval = s_RubyDialog_CallActionProc(self, pval, 4, args); |
1787 | 1787 | vp[6] = (void *)(intptr_t)(NUM2INT(rb_Integer(retval))); |
1788 | 1788 | return retval; |
1789 | 1789 | } else if (sym == sOnDragSelectionToRowSymbol) { |
1790 | - args[1] = INT2NUM((int)vp[3]); | |
1790 | + args[1] = INT2NUM((intptr_t)vp[3]); | |
1791 | 1791 | retval = s_RubyDialog_CallActionProc(self, pval, 2, args); |
1792 | 1792 | return retval; |
1793 | 1793 | } else if (sym == sIsItemEditableSymbol) { |
1794 | - args[1] = INT2NUM((int)vp[3]); | |
1795 | - args[2] = INT2NUM((int)vp[4]); | |
1794 | + args[1] = INT2NUM((intptr_t)vp[3]); | |
1795 | + args[2] = INT2NUM((intptr_t)vp[4]); | |
1796 | 1796 | retval = s_RubyDialog_CallActionProc(self, pval, 3, args); |
1797 | 1797 | vp[5] = (void *)(intptr_t)(RTEST(retval) ? 1 : 0); |
1798 | 1798 | return retval; |
@@ -1809,8 +1809,8 @@ s_RubyDialog_doTableAction(VALUE val) | ||
1809 | 1809 | float *bg = (float *)vp[6]; |
1810 | 1810 | int i, n = 0; |
1811 | 1811 | VALUE cval; |
1812 | - args[1] = INT2NUM((int)vp[3]); | |
1813 | - args[2] = INT2NUM((int)vp[4]); | |
1812 | + args[1] = INT2NUM((intptr_t)vp[3]); | |
1813 | + args[2] = INT2NUM((intptr_t)vp[4]); | |
1814 | 1814 | retval = s_RubyDialog_CallActionProc(self, pval, 3, args); |
1815 | 1815 | if (retval == Qnil) |
1816 | 1816 | return Qnil; |
@@ -1834,8 +1834,8 @@ s_RubyDialog_doTableAction(VALUE val) | ||
1834 | 1834 | vp[7] = (void *)(intptr_t)n; |
1835 | 1835 | return retval; |
1836 | 1836 | } else if (sym == sHasPopUpMenuSymbol) { |
1837 | - args[1] = INT2NUM((int)vp[3]); | |
1838 | - args[2] = INT2NUM((int)vp[4]); | |
1837 | + args[1] = INT2NUM((intptr_t)vp[3]); | |
1838 | + args[2] = INT2NUM((intptr_t)vp[4]); | |
1839 | 1839 | retval = s_RubyDialog_CallActionProc(self, pval, 3, args); |
1840 | 1840 | if (retval == Qnil) { |
1841 | 1841 | vp[6] = (void *)0; |
@@ -1854,9 +1854,9 @@ s_RubyDialog_doTableAction(VALUE val) | ||
1854 | 1854 | } |
1855 | 1855 | return retval; |
1856 | 1856 | } else if (sym == sOnPopUpMenuSelectedSymbol) { |
1857 | - args[1] = INT2NUM((int)vp[3]); | |
1858 | - args[2] = INT2NUM((int)vp[4]); | |
1859 | - args[3] = INT2NUM((int)vp[5]); | |
1857 | + args[1] = INT2NUM((intptr_t)vp[3]); | |
1858 | + args[2] = INT2NUM((intptr_t)vp[4]); | |
1859 | + args[3] = INT2NUM((intptr_t)vp[5]); | |
1860 | 1860 | retval = s_RubyDialog_CallActionProc(self, pval, 4, args); |
1861 | 1861 | return retval; |
1862 | 1862 | } else return Qnil; |
@@ -1873,7 +1873,7 @@ RubyDialog_GetTableItemCount(RubyValue self, RDItem *ip) | ||
1873 | 1873 | return 0; |
1874 | 1874 | } else if (val == Qnil) |
1875 | 1875 | return 0; |
1876 | - else return (int)vp[3]; | |
1876 | + else return (intptr_t)vp[3]; | |
1877 | 1877 | } |
1878 | 1878 | |
1879 | 1879 | void |
@@ -1899,7 +1899,7 @@ RubyDialog_SetTableItemText(RubyValue self, RDItem *ip, int row, int column, con | ||
1899 | 1899 | if (status != 0 || val == Qnil) { |
1900 | 1900 | return -1; |
1901 | 1901 | } else |
1902 | - return (int)vp[6]; | |
1902 | + return (intptr_t)vp[6]; | |
1903 | 1903 | } |
1904 | 1904 | |
1905 | 1905 | void |
@@ -1920,7 +1920,7 @@ RubyDialog_IsTableItemEditable(RubyValue self, RDItem *ip, int row, int column) | ||
1920 | 1920 | VALUE val = rb_protect(s_RubyDialog_doTableAction, (VALUE)vp, &status); |
1921 | 1921 | if (status != 0 || val == Qnil) |
1922 | 1922 | return 0; |
1923 | - else return (int)vp[5]; | |
1923 | + else return (intptr_t)vp[5]; | |
1924 | 1924 | } |
1925 | 1925 | |
1926 | 1926 | int |
@@ -1931,7 +1931,7 @@ RubyDialog_IsTableDragAndDropEnabled(RubyValue self, RDItem *ip, int row) | ||
1931 | 1931 | VALUE val = rb_protect(s_RubyDialog_doTableAction, (VALUE)vp, &status); |
1932 | 1932 | if (status != 0 || val == Qnil) |
1933 | 1933 | return 0; |
1934 | - else return (int)vp[3]; | |
1934 | + else return (intptr_t)vp[3]; | |
1935 | 1935 | } |
1936 | 1936 | |
1937 | 1937 | void |
@@ -1952,7 +1952,7 @@ RubyDialog_SetTableItemColor(RubyValue self, RDItem *ip, int row, int column, fl | ||
1952 | 1952 | VALUE val = rb_protect(s_RubyDialog_doTableAction, (VALUE)vp, &status); |
1953 | 1953 | if (status != 0 || val == Qnil) |
1954 | 1954 | return 0; |
1955 | - else return (int)vp[7]; | |
1955 | + else return (intptr_t)vp[7]; | |
1956 | 1956 | } |
1957 | 1957 | |
1958 | 1958 | int |
@@ -1963,7 +1963,7 @@ RubyDialog_HasPopUpMenu(RubyValue self, RDItem *ip, int row, int column, char ** | ||
1963 | 1963 | VALUE val = rb_protect(s_RubyDialog_doTableAction, (VALUE)vp, &status); |
1964 | 1964 | if (status != 0 || val == Qnil) |
1965 | 1965 | return 0; |
1966 | - else return (int)vp[6]; | |
1966 | + else return (intptr_t)vp[6]; | |
1967 | 1967 | } |
1968 | 1968 | |
1969 | 1969 | void |
@@ -2026,7 +2026,7 @@ s_RubyDialog_doItemAction(VALUE val) | ||
2026 | 2026 | VALUE flag; |
2027 | 2027 | RDItem *ip = (RDItem *)vp[1]; |
2028 | 2028 | RDItem *ip2; |
2029 | - int options = (int)vp[2]; | |
2029 | + int options = (intptr_t)vp[2]; | |
2030 | 2030 | VALUE ival, itval, actval, tval, aval; |
2031 | 2031 | RubyDialog *dref = s_RubyDialog_GetController(self); |
2032 | 2032 | VALUE items = rb_iv_get(self, "_items"); |
@@ -2210,7 +2210,7 @@ s_RubyDialog_doKeyAction(VALUE val) | ||
2210 | 2210 | { |
2211 | 2211 | void **values = (void **)val; |
2212 | 2212 | VALUE self = (VALUE)values[0]; |
2213 | - int keyCode = (int)values[1]; | |
2213 | + int keyCode = (intptr_t)values[1]; | |
2214 | 2214 | VALUE actval = rb_iv_get(self, "_key_action"); |
2215 | 2215 | if (actval != Qnil) { |
2216 | 2216 | if (TYPE(actval) == T_SYMBOL) |
@@ -2268,7 +2268,7 @@ RubyDialog_getFlexFlags(RubyValue self, RDItem *ip) | ||
2268 | 2268 | return -1; |
2269 | 2269 | else if (rval == Qnil) |
2270 | 2270 | return -1; |
2271 | - else return (int)args[2]; | |
2271 | + else return (intptr_t)args[2]; | |
2272 | 2272 | } |
2273 | 2273 | |
2274 | 2274 | static VALUE |
@@ -2276,7 +2276,7 @@ s_RubyDialog_doCloseWindow(VALUE val) | ||
2276 | 2276 | { |
2277 | 2277 | void **values = (void **)val; |
2278 | 2278 | VALUE self = (VALUE)values[0]; |
2279 | - int isModal = (int)values[1]; | |
2279 | + int isModal = (intptr_t)values[1]; | |
2280 | 2280 | if (isModal) { |
2281 | 2281 | rb_funcall(self, rb_intern("end_modal"), 1, INT2NUM(1)); |
2282 | 2282 | return Qnil; |
@@ -5,7 +5,7 @@ | ||
5 | 5 | An Interactive Molecular Modeling Software |
6 | 6 | with Integrated Ruby Interpreter |
7 | 7 | |
8 | - Version 1.0.2 | |
8 | + Version 1.1.0 | |
9 | 9 | |
10 | 10 | Toshi Nagata |
11 | 11 |
@@ -1 +1 @@ | ||
1 | -version = "1.0.2" | |
1 | +version = "1.1.0" |
@@ -1,5 +1,5 @@ | ||
1 | 1 | /* XPM */ |
2 | -static char *jump_to_end_xpm[] = { | |
2 | +static const char *jump_to_end_xpm[] = { | |
3 | 3 | /* width height ncolors chars_per_pixel */ |
4 | 4 | "9 9 7 1", |
5 | 5 | /* colors */ |
@@ -1,5 +1,5 @@ | ||
1 | 1 | /* XPM */ |
2 | -static char *jump_to_start_xpm[] = { | |
2 | +static const char *jump_to_start_xpm[] = { | |
3 | 3 | /* width height ncolors chars_per_pixel */ |
4 | 4 | "9 9 8 1", |
5 | 5 | /* colors */ |
@@ -1,5 +1,5 @@ | ||
1 | 1 | /* XPM */ |
2 | -static char *pi00[] = { | |
2 | +static const char *pi00[] = { | |
3 | 3 | /* width height ncolors chars_per_pixel */ |
4 | 4 | "12 12 20 1", |
5 | 5 | /* colors */ |
@@ -1,5 +1,5 @@ | ||
1 | 1 | /* XPM */ |
2 | -static char *pi01[] = { | |
2 | +static const char *pi01[] = { | |
3 | 3 | /* width height ncolors chars_per_pixel */ |
4 | 4 | "12 12 23 1", |
5 | 5 | /* colors */ |
@@ -1,5 +1,5 @@ | ||
1 | 1 | /* XPM */ |
2 | -static char *pi02[] = { | |
2 | +static const char *pi02[] = { | |
3 | 3 | /* width height ncolors chars_per_pixel */ |
4 | 4 | "12 12 19 1", |
5 | 5 | /* colors */ |
@@ -1,5 +1,5 @@ | ||
1 | 1 | /* XPM */ |
2 | -static char *pi03[] = { | |
2 | +static const char *pi03[] = { | |
3 | 3 | /* width height ncolors chars_per_pixel */ |
4 | 4 | "12 12 20 1", |
5 | 5 | /* colors */ |
@@ -1,5 +1,5 @@ | ||
1 | 1 | /* XPM */ |
2 | -static char *pi04[] = { | |
2 | +static const char *pi04[] = { | |
3 | 3 | /* width height ncolors chars_per_pixel */ |
4 | 4 | "12 12 24 1", |
5 | 5 | /* colors */ |
@@ -1,5 +1,5 @@ | ||
1 | 1 | /* XPM */ |
2 | -static char *pi05[] = { | |
2 | +static const char *pi05[] = { | |
3 | 3 | /* width height ncolors chars_per_pixel */ |
4 | 4 | "12 12 19 1", |
5 | 5 | /* colors */ |
@@ -1,5 +1,5 @@ | ||
1 | 1 | /* XPM */ |
2 | -static char *pi06[] = { | |
2 | +static const char *pi06[] = { | |
3 | 3 | /* width height ncolors chars_per_pixel */ |
4 | 4 | "12 12 19 1", |
5 | 5 | /* colors */ |
@@ -1,5 +1,5 @@ | ||
1 | 1 | /* XPM */ |
2 | -static char *pi07[] = { | |
2 | +static const char *pi07[] = { | |
3 | 3 | /* width height ncolors chars_per_pixel */ |
4 | 4 | "12 12 24 1", |
5 | 5 | /* colors */ |
@@ -1,5 +1,5 @@ | ||
1 | 1 | /* XPM */ |
2 | -static char *pi08[] = { | |
2 | +static const char *pi08[] = { | |
3 | 3 | /* width height ncolors chars_per_pixel */ |
4 | 4 | "12 12 20 1", |
5 | 5 | /* colors */ |
@@ -1,5 +1,5 @@ | ||
1 | 1 | /* XPM */ |
2 | -static char *pi09[] = { | |
2 | +static const char *pi09[] = { | |
3 | 3 | /* width height ncolors chars_per_pixel */ |
4 | 4 | "12 12 20 1", |
5 | 5 | /* colors */ |
@@ -1,5 +1,5 @@ | ||
1 | 1 | /* XPM */ |
2 | -static char *pi10[] = { | |
2 | +static const char *pi10[] = { | |
3 | 3 | /* width height ncolors chars_per_pixel */ |
4 | 4 | "12 12 23 1", |
5 | 5 | /* colors */ |
@@ -1,5 +1,5 @@ | ||
1 | 1 | /* XPM */ |
2 | -static char *pi11[] = { | |
2 | +static const char *pi11[] = { | |
3 | 3 | /* width height ncolors chars_per_pixel */ |
4 | 4 | "12 12 19 1", |
5 | 5 | /* colors */ |
@@ -1,5 +1,5 @@ | ||
1 | 1 | /* XPM */ |
2 | -static char *play_backward_xpm[] = { | |
2 | +static const char *play_backward_xpm[] = { | |
3 | 3 | /* width height ncolors chars_per_pixel */ |
4 | 4 | "9 9 12 1", |
5 | 5 | /* colors */ |
@@ -1,5 +1,5 @@ | ||
1 | 1 | /* XPM */ |
2 | -static char *play_forward_xpm[] = { | |
2 | +static const char *play_forward_xpm[] = { | |
3 | 3 | /* width height ncolors chars_per_pixel */ |
4 | 4 | "9 9 12 1", |
5 | 5 | /* colors */ |
@@ -1,5 +1,5 @@ | ||
1 | 1 | /* XPM */ |
2 | -static char *rotate_bond_xpm[] = { | |
2 | +static const char *rotate_bond_xpm[] = { | |
3 | 3 | /* width height ncolors chars_per_pixel */ |
4 | 4 | "18 18 30 2", |
5 | 5 | /* colors */ |
@@ -1,5 +1,5 @@ | ||
1 | 1 | /* XPM */ |
2 | -static char *rotate_x_xpm[] = { | |
2 | +static const char *rotate_x_xpm[] = { | |
3 | 3 | /* width height ncolors chars_per_pixel */ |
4 | 4 | "18 18 29 2", |
5 | 5 | /* colors */ |
@@ -1,5 +1,5 @@ | ||
1 | 1 | /* XPM */ |
2 | -static char *rotate_y_xpm[] = { | |
2 | +static const char *rotate_y_xpm[] = { | |
3 | 3 | /* width height ncolors chars_per_pixel */ |
4 | 4 | "18 18 26 1", |
5 | 5 | /* colors */ |
@@ -1,5 +1,5 @@ | ||
1 | 1 | /* XPM */ |
2 | -static char *stop_mini[] = { | |
2 | +static const char *stop_mini[] = { | |
3 | 3 | /* width height ncolors chars_per_pixel */ |
4 | 4 | "12 12 34 2", |
5 | 5 | /* colors */ |
@@ -1,5 +1,5 @@ | ||
1 | 1 | /* XPM */ |
2 | -static char *stop_mini_dark[] = { | |
2 | +static const char *stop_mini_dark[] = { | |
3 | 3 | /* width height ncolors chars_per_pixel */ |
4 | 4 | "12 12 42 2", |
5 | 5 | /* colors */ |
@@ -1,5 +1,5 @@ | ||
1 | 1 | /* XPM */ |
2 | -static char *stop_mini_grey[] = { | |
2 | +static const char *stop_mini_grey[] = { | |
3 | 3 | /* width height ncolors chars_per_pixel */ |
4 | 4 | "12 12 71 2", |
5 | 5 | /* colors */ |
@@ -1,7 +1,7 @@ | ||
1 | 1 | ; Create an installer that can install both 32bit and 64bit versions |
2 | 2 | [Setup] |
3 | 3 | AppName = Molby |
4 | -AppVerName = Molby (v1.0.2) | |
4 | +AppVerName = Molby (v1.1.0) | |
5 | 5 | DefaultDirName = {pf}\Molby |
6 | 6 | DefaultGroupName = Molby |
7 | 7 | UninstallDisplayIcon = {app}\Molby.exe |
@@ -1,6 +1,6 @@ | ||
1 | 1 | [Setup] |
2 | 2 | AppName = Molby |
3 | -AppVerName = Molby (v1.0.2) | |
3 | +AppVerName = Molby (v1.1.0) | |
4 | 4 | DefaultDirName = {pf}\Molby (32bit) |
5 | 5 | DefaultGroupName = Molby (32bit) |
6 | 6 | UninstallDisplayIcon = {app}\Molby.exe |
@@ -34,11 +34,11 @@ | ||
34 | 34 | <key>CFBundlePackageType</key> |
35 | 35 | <string>APPL</string> |
36 | 36 | <key>CFBundleShortVersionString</key> |
37 | - <string>Version 1.0.2</string> | |
37 | + <string>Version 1.1.0</string> | |
38 | 38 | <key>CFBundleSignature</key> |
39 | 39 | <string>????</string> |
40 | 40 | <key>CFBundleVersion</key> |
41 | - <string>v1.0.2</string> | |
41 | + <string>v1.1.0</string> | |
42 | 42 | <key>NSHumanReadableCopyright</key> |
43 | 43 | <string>Copyright 2008-2022 Toshi Nagata</string> |
44 | 44 | <key>NSPrincipalClass</key> |
@@ -25,7 +25,6 @@ | ||
25 | 25 | |
26 | 26 | /* Begin PBXBuildFile section */ |
27 | 27 | E403568428CF6A3D008E2C46 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E403568328CF6A3D008E2C46 /* QuartzCore.framework */; }; |
28 | - E403568528D0AD7E008E2C46 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E4FC7845183E51180064FB2E /* Carbon.framework */; }; | |
29 | 28 | E403568628D0B7B0008E2C46 /* MyListCtrl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E41251B728CD92A100E12983 /* MyListCtrl.cpp */; }; |
30 | 29 | E4059F9B28C46A6E0052B36B /* molby_icon.icns in Resources */ = {isa = PBXBuildFile; fileRef = E4FC77D4183E4FF20064FB2E /* molby_icon.icns */; }; |
31 | 30 | E4059F9C28C46A6E0052B36B /* Scripts in Resources */ = {isa = PBXBuildFile; fileRef = E4FC77D6183E4FFE0064FB2E /* Scripts */; }; |
@@ -114,6 +113,7 @@ | ||
114 | 113 | E4589CEF28D5FD6400F55785 /* MyToggleButton.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4589CEE28D5FD6400F55785 /* MyToggleButton.cpp */; }; |
115 | 114 | E4589CF028D5FD6400F55785 /* MyToggleButton.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4589CEE28D5FD6400F55785 /* MyToggleButton.cpp */; }; |
116 | 115 | E4589CF228D6E89900F55785 /* docview.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E45B94611A170B9A008E95EB /* docview.cpp */; }; |
116 | + E4589CF528D82A5200F55785 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E4FC7845183E51180064FB2E /* Carbon.framework */; }; | |
117 | 117 | E4653CB118A0CC7D0022377B /* textctrl_addition.mm in Sources */ = {isa = PBXBuildFile; fileRef = E4653CB018A0CC7D0022377B /* textctrl_addition.mm */; }; |
118 | 118 | E4ACACE718C6D32300F08B67 /* ortep3 in Resources */ = {isa = PBXBuildFile; fileRef = E4ACACE418C6D32300F08B67 /* ortep3 */; }; |
119 | 119 | E4D379A219C87C2200636D28 /* modalwindow.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4D379A119C87C2200636D28 /* modalwindow.cpp */; }; |
@@ -321,7 +321,7 @@ | ||
321 | 321 | E4FC784D183E51180064FB2E /* Cocoa.framework in Frameworks */, |
322 | 322 | E4FC784E183E51180064FB2E /* GLUT.framework in Frameworks */, |
323 | 323 | E4FC784F183E51180064FB2E /* IOKit.framework in Frameworks */, |
324 | - E403568528D0AD7E008E2C46 /* Carbon.framework in Frameworks */, | |
324 | + E4589CF528D82A5200F55785 /* Carbon.framework in Frameworks */, | |
325 | 325 | E4FC7850183E51180064FB2E /* OpenGL.framework in Frameworks */, |
326 | 326 | E4FC7852183E51180064FB2E /* System.framework in Frameworks */, |
327 | 327 | E4FC7A17183E51570064FB2E /* AppKit.framework in Frameworks */, |
@@ -387,7 +387,7 @@ ConsoleFrame::OnEnterPressed() | ||
387 | 387 | void |
388 | 388 | ConsoleFrame::ShowHistory(bool up, bool option) |
389 | 389 | { |
390 | - char *p; | |
390 | + const char *p; | |
391 | 391 | if (commandHistoryIndex == -1 && valueHistoryIndex == -1) { |
392 | 392 | if (!up) |
393 | 393 | return; |
@@ -407,7 +407,6 @@ MoleculeView::OnDraw(wxDC *dc) | ||
407 | 407 | wxImage *img = CaptureGLCanvas(scale); |
408 | 408 | if (img != NULL) { |
409 | 409 | wxBitmap bitmap(*img); |
410 | - wxSize ppi = dc->GetPPI(); | |
411 | 410 | double sx, sy; |
412 | 411 | dc->GetUserScale(&sx, &sy); |
413 | 412 | dc->SetUserScale(sx / scale, sy / scale); |
@@ -930,7 +929,8 @@ MoleculeView::OnLeftDClickInListCtrl(wxMouseEvent &event) | ||
930 | 929 | if (mview->tableIndex >= kMainViewBondTableIndex && mview->tableIndex <= kMainViewImproperTableIndex /* && mview->mol->par != NULL */ ) { |
931 | 930 | int row, col, i; |
932 | 931 | char indices[64], names[64], types[64], value[20], partypes[64], params[3][20]; |
933 | - char *ptype, *parstr; | |
932 | + const char *ptype; | |
933 | + char *parstr; | |
934 | 934 | wxPoint pos = event.GetPosition(); |
935 | 935 | if (!listctrl->FindItemAtPosition(pos, &row, &col) || col < 4) |
936 | 936 | return; |
@@ -952,6 +952,7 @@ MoleculeView::OnLeftDClickInListCtrl(wxMouseEvent &event) | ||
952 | 952 | } |
953 | 953 | asprintf(&parstr, "%s %s %s", params[0], params[1], params[2]); |
954 | 954 | MolActionCreateAndPerform(mview->mol, SCRIPT_ACTION("sssssss"), "cmd_edit_local_parameter_in_mainview", ptype, indices, names, types, value, partypes, parstr); |
955 | + free(parstr); | |
955 | 956 | } |
956 | 957 | } |
957 | 958 |
@@ -627,7 +627,7 @@ MyApp::CreateMenuBar(int kind, wxMenu **out_file_history_menu, wxMenu **out_edit | ||
627 | 627 | return menu_bar; |
628 | 628 | } |
629 | 629 | |
630 | -#if __WXMAC__ | |
630 | +#if defined(__WXMAC__) || defined(__WXOSX__) | |
631 | 631 | /* When the application is launched without any documents, an empty document is opened. |
632 | 632 | This should be implemented by overriding this special method; parsing argc/argv does |
633 | 633 | not work, because the list of files is passed through an Apple Event. */ |
@@ -646,53 +646,21 @@ MyApp::MacOpenFile(const wxString &fileName) | ||
646 | 646 | RequestOpenFilesByEvent(file); |
647 | 647 | } |
648 | 648 | |
649 | -/* Open given files: instead of calling MacOpenFile() for each entry, build a file list | |
650 | - and call MyApp::OnOpenFiles() */ | |
651 | -short | |
652 | -MyApp::MacHandleAEODoc(const WXEVENTREF event, WXEVENTREF WXUNUSED(reply)) | |
653 | -{ | |
654 | - AEDescList docList; | |
655 | - AEKeyword keywd; | |
656 | - DescType returnedType; | |
657 | - Size actualSize; | |
658 | - long itemsInList; | |
659 | - OSErr err; | |
660 | - short i; | |
661 | - | |
662 | - return noErr; /* TODO: handle open Apple event */ | |
663 | - | |
664 | - err = AEGetParamDesc((AppleEvent *)event, keyDirectObject, typeAEList, &docList); | |
665 | - if (err != noErr) | |
666 | - return err; | |
667 | - | |
668 | - err = AECountItems(&docList, &itemsInList); | |
669 | - if (err != noErr) | |
670 | - return err; | |
671 | - | |
672 | - ProcessSerialNumber PSN ; | |
673 | - PSN.highLongOfPSN = 0 ; | |
674 | - PSN.lowLongOfPSN = kCurrentProcess ; | |
675 | - SetFrontProcess( &PSN ) ; | |
676 | - | |
677 | - wxString fName, fNameList; | |
678 | - FSRef theRef ; | |
679 | - | |
680 | - for (i = 1; i <= itemsInList; i++) | |
681 | - { | |
682 | - AEGetNthPtr( | |
683 | - &docList, i, typeFSRef, &keywd, &returnedType, | |
684 | - (Ptr)&theRef, sizeof(theRef), &actualSize); | |
685 | - // fName = wxMacFSRefToPath( &theRef ) ; | |
686 | - fNameList.append(fName); | |
687 | - fNameList.append(wxT("\n")); | |
649 | +void | |
650 | +MyApp::MacOpenFiles(const wxArrayString &fileNames) | |
651 | +{ | |
652 | + wxString fnames; | |
653 | + int i, n; | |
654 | + n = fileNames.GetCount(); | |
655 | + for (i = 0; i < n; i++) { | |
656 | + fnames = fnames + fileNames[i]; | |
657 | + if (i < n - 1) | |
658 | + fnames = fnames + wxT("\n"); | |
688 | 659 | } |
689 | - | |
690 | - OnOpenFiles(fNameList); | |
691 | - | |
692 | - return noErr; | |
660 | + OnOpenFiles(fnames); | |
693 | 661 | } |
694 | 662 | |
695 | -#endif | |
663 | +#endif // WXMAC | |
696 | 664 | |
697 | 665 | int |
698 | 666 | MyApp::OnExit(void) |
@@ -1444,10 +1412,8 @@ MyApp::CallSubProcess(const char *cmdline, const char *procname, int (*callback) | ||
1444 | 1412 | { |
1445 | 1413 | int status = 0; |
1446 | 1414 | int callback_result = 0; |
1447 | - int count = 0; | |
1448 | 1415 | bool progress_panel = false; |
1449 | 1416 | char buf[256]; |
1450 | - size_t len, len_total; | |
1451 | 1417 | wxString cmdstr(cmdline, WX_DEFAULT_CONV); |
1452 | 1418 | wxLongLong startTime; |
1453 | 1419 |
@@ -1817,7 +1783,8 @@ AboutDialog::AboutDialog(): | ||
1817 | 1783 | // | |
1818 | 1784 | // |-> copyright messages |
1819 | 1785 | |
1820 | - char *s1, *s2, *s3; | |
1786 | + const char *s1; | |
1787 | + char *s2, *s3; | |
1821 | 1788 | s1 = "Molby"; |
1822 | 1789 | Molby_getDescription(&s2, &s3); |
1823 | 1790 | wxString str1(s1, WX_DEFAULT_CONV); |
@@ -239,7 +239,7 @@ class MyApp: public wxApp | ||
239 | 239 | #if defined(__WXMAC__) |
240 | 240 | virtual void MacNewFile(); |
241 | 241 | virtual void MacOpenFile(const wxString &fileName); |
242 | - virtual short MacHandleAEODoc(const WXEVENTREF event, WXEVENTREF WXUNUSED(reply)); | |
242 | + virtual void MacOpenFiles(const wxArrayString &fileNames); | |
243 | 243 | #endif |
244 | 244 | |
245 | 245 | void EnableTimerForDocument(MyDocument *doc); |
@@ -15,7 +15,7 @@ | ||
15 | 15 | GNU General Public License for more details. |
16 | 16 | */ |
17 | 17 | |
18 | -const char *gVersionString = "v1.0.2"; | |
18 | +const char *gVersionString = "v1.1.0"; | |
19 | 19 | const char *gCopyrightString = "Copyright (c) 2008-2022 Toshi Nagata"; |
20 | 20 | /* The following are now defined in build/buildInfo.c, generated by record_build_date.sh */ |
21 | 21 | /*int gRevisionNumber = 0; |
@@ -63,7 +63,7 @@ InitializeOpenGLExtensions(void) | ||
63 | 63 | { |
64 | 64 | int n = 0; |
65 | 65 | if (p_inited != 0) |
66 | - return; | |
66 | + return 0; | |
67 | 67 | p_glIsRenderbufferEXT = (t_glIsRenderbufferEXT)wglGetProcAddress("glIsRenderbufferEXT"); |
68 | 68 | if (p_glIsRenderbufferEXT == NULL) |
69 | 69 | n++; |
@@ -108,7 +108,7 @@ ProgressFrame::SetInterruptValue(int value) | ||
108 | 108 | int |
109 | 109 | ProgressFrame::CheckInterrupt() |
110 | 110 | { |
111 | - if (this != NULL && m_interruptValue) { | |
111 | + if (m_interruptValue) { | |
112 | 112 | int save = m_interruptValue; |
113 | 113 | m_interruptValue = 0; |
114 | 114 | return save; |
@@ -1294,38 +1294,41 @@ RubyDialogCallback_setFontForItem(RDItem *item, int size, int family, int style, | ||
1294 | 1294 | } else return; |
1295 | 1295 | if (size == 0) |
1296 | 1296 | size = font.GetPointSize(); |
1297 | + wxFontFamily ffamily; | |
1298 | + wxFontStyle fstyle; | |
1299 | + wxFontWeight fweight; | |
1297 | 1300 | if (family == 0) |
1298 | - family = wxFONTFAMILY_DEFAULT; | |
1301 | + ffamily = wxFONTFAMILY_DEFAULT; | |
1299 | 1302 | else { |
1300 | - family = (family == 2 ? wxFONTFAMILY_ROMAN : | |
1303 | + ffamily = (family == 2 ? wxFONTFAMILY_ROMAN : | |
1301 | 1304 | (family == 3 ? wxFONTFAMILY_SWISS : |
1302 | 1305 | (family == 4 ? wxFONTFAMILY_MODERN : |
1303 | 1306 | wxFONTFAMILY_DEFAULT))); |
1304 | 1307 | } |
1305 | 1308 | if (style == 0) |
1306 | - style = wxFONTSTYLE_NORMAL; | |
1309 | + fstyle = wxFONTSTYLE_NORMAL; | |
1307 | 1310 | else { |
1308 | - style = (style == 2 ? wxFONTSTYLE_SLANT : | |
1311 | + fstyle = (style == 2 ? wxFONTSTYLE_SLANT : | |
1309 | 1312 | (style == 3 ? wxFONTSTYLE_ITALIC : |
1310 | 1313 | wxFONTSTYLE_NORMAL)); |
1311 | 1314 | } |
1312 | 1315 | if (weight == 0) |
1313 | - weight = wxFONTWEIGHT_NORMAL; | |
1316 | + fweight = wxFONTWEIGHT_NORMAL; | |
1314 | 1317 | else { |
1315 | - weight = (weight == 2 ? wxFONTWEIGHT_BOLD : | |
1318 | + fweight = (weight == 2 ? wxFONTWEIGHT_BOLD : | |
1316 | 1319 | (weight == 3 ? wxFONTWEIGHT_LIGHT : |
1317 | 1320 | wxFONTWEIGHT_NORMAL)); |
1318 | 1321 | } |
1319 | 1322 | if (textctrl != NULL) { |
1320 | 1323 | wxTextAttr newAttr; |
1321 | - wxFont newFont(size, family, style, weight); | |
1324 | + wxFont newFont(size, ffamily, fstyle, fweight); | |
1322 | 1325 | newAttr.SetFont(newFont); |
1323 | 1326 | textctrl->SetDefaultStyle(newAttr); |
1324 | 1327 | #if __WXMAC__ |
1325 | 1328 | textctrl->SetFont(newFont); |
1326 | 1329 | #endif |
1327 | 1330 | } else { |
1328 | - ctrl->SetFont(wxFont(size, family, style, weight)); | |
1331 | + ctrl->SetFont(wxFont(size, ffamily, fstyle, fweight)); | |
1329 | 1332 | wxString label = ctrl->GetLabel(); |
1330 | 1333 | ctrl->SetLabel(_("")); |
1331 | 1334 | ctrl->SetLabel(label); /* Update the control size */ |
@@ -1757,14 +1760,15 @@ RubyDialogCallback_setFont(RDDeviceContext *dc, void **args) | ||
1757 | 1760 | float size = FromDCDIP(dcp, *((float *)(args[i + 1]))); |
1758 | 1761 | font.SetPointSize((int)size); |
1759 | 1762 | } else if (strcmp((const char *)args[i], "style") == 0) { |
1760 | - long style = (intptr_t)(args[i + 1]); | |
1763 | + int style = (intptr_t)(args[i + 1]); | |
1764 | + wxFontStyle fstyle; | |
1761 | 1765 | switch (style) { |
1762 | - case 0: style = wxFONTSTYLE_NORMAL; break; | |
1763 | - case 1: style = wxFONTSTYLE_ITALIC; break; | |
1764 | - case 2: style = wxFONTSTYLE_SLANT; break; | |
1765 | - default: style = wxFONTSTYLE_NORMAL; break; | |
1766 | + case 0: fstyle = wxFONTSTYLE_NORMAL; break; | |
1767 | + case 1: fstyle = wxFONTSTYLE_ITALIC; break; | |
1768 | + case 2: fstyle = wxFONTSTYLE_SLANT; break; | |
1769 | + default: fstyle = wxFONTSTYLE_NORMAL; break; | |
1766 | 1770 | } |
1767 | - font.SetStyle(style); | |
1771 | + font.SetStyle(fstyle); | |
1768 | 1772 | } else if (strcmp((const char *)args[i], "family") == 0) { |
1769 | 1773 | wxFontFamily family; |
1770 | 1774 | j = (intptr_t)(args[i + 1]); |
@@ -1811,16 +1815,17 @@ RubyDialogCallback_setPen(RDDeviceContext *dc, void **args) | ||
1811 | 1815 | pen.SetWidth((int)width); |
1812 | 1816 | } else if (strcmp((const char *)args[i], "style") == 0) { |
1813 | 1817 | long style = (intptr_t)(args[i + 1]); |
1818 | + wxPenStyle pstyle; | |
1814 | 1819 | switch (style) { |
1815 | - case 0: style = wxSOLID; break; | |
1816 | - case 1: style = wxTRANSPARENT; break; | |
1817 | - case 2: style = wxDOT; break; | |
1818 | - case 3: style = wxLONG_DASH; break; | |
1819 | - case 4: style = wxSHORT_DASH; break; | |
1820 | - case 5: style = wxDOT_DASH; break; | |
1821 | - default: style = wxSOLID; break; | |
1820 | + case 0: pstyle = wxPENSTYLE_SOLID; break; | |
1821 | + case 1: pstyle = wxPENSTYLE_TRANSPARENT; break; | |
1822 | + case 2: pstyle = wxPENSTYLE_DOT; break; | |
1823 | + case 3: pstyle = wxPENSTYLE_LONG_DASH; break; | |
1824 | + case 4: pstyle = wxPENSTYLE_SHORT_DASH; break; | |
1825 | + case 5: pstyle = wxPENSTYLE_DOT_DASH; break; | |
1826 | + default: pstyle = wxPENSTYLE_SOLID; break; | |
1822 | 1827 | } |
1823 | - pen.SetStyle(style); | |
1828 | + pen.SetStyle(pstyle); | |
1824 | 1829 | } |
1825 | 1830 | } |
1826 | 1831 | } |