• R/O
  • HTTP
  • SSH
  • HTTPS

Molby: コミット

Molecular Modeling Software


コミットメタ情報

リビジョン5831f79238919a12d16f3ca025b2c99fa060d8a5 (tree)
日時2022-09-19 16:31:07
作者Toshi Nagata <alchemist.2005@nift...>
コミッターToshi Nagata

ログメッセージ

Compiler warnings are mostly removed.

変更サマリ

差分

--- a/Documents/src/doc_source.html
+++ b/Documents/src/doc_source.html
@@ -14,14 +14,14 @@
1414 <div class="centered" lang="en">
1515 <h1>Molby</h1>
1616 <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 -->
1818 <h3>Toshi Nagata</h3>
1919 <p><a href="http://molby.osdn.jp/index-en.html">http://molby.osdn.jp/index-en.html</a></p>
2020 </div>
2121 <div class="centered" lang="ja">
2222 <h1>Molby</h1>
2323 <h2>対話型分子モデリングソフトウェア<br />(Ruby インタプリタ内蔵)</h2>
24-<h3>Version 1.0.2</h3> <!-- version -->
24+<h3>Version 1.1.0</h3> <!-- version -->
2525 <h3>永田 央</h3>
2626 <p><a href="http://molby.osdn.jp/index.html">http://molby.osdn.jp/index.html</a></p>
2727 </div>
@@ -96,8 +96,8 @@ Molby は、分子を 3D 表示して、画面上で分子モデルを構築す
9696 Molby runs on the following platforms.
9797 </p>
9898 <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>
101101 </ul>
102102
103103 <p>
@@ -114,7 +114,7 @@ Download from the official distribution web site, <a href="http://en.osdn.jp/pro
114114 <h3>3-1. Microsoft Windows</h3>
115115
116116 <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>).
118118 </p>
119119 <p>
120120 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
125125
126126 <h3>3-2. Mac OS X</h3>
127127 <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.
132129 </p>
133130
134131 <h2>4. Uninstallation</h2>
@@ -149,8 +146,8 @@ Trash the Molby application in the "Applications" folder.
149146 Molbyは以下のプラットフォームで動作します。
150147 </p>
151148 <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>
154151 </ul>
155152
156153 <p>
@@ -167,7 +164,7 @@ Molbyは以下のプラットフォームで動作します。
167164 <h3>3-1. Microsoft Windows</h3>
168165
169166 <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ビット版) で配布されています。
171168 </p>
172169 <p>
173170 Zip アーカイブを使う時は、最初に内容をすべて展開してください。展開したフォルダの中に Molby アプリケーションがあるので、ダブルクリックして起動してください。
@@ -178,10 +175,7 @@ Zip アーカイブを使う時は、最初に内容をすべて展開してく
178175
179176 <h3>3-2. Mac OS X</h3>
180177 <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 アプリケーションがその中にありますので、ハードディスクの「アプリケーション」フォルダにドラッグコピーしてください。
185179 </p>
186180
187181 <h2>4. アンインストール</h2>
@@ -218,7 +212,7 @@ I ask for citation of the following paper in published works that utilize Molby:
218212 <p>
219213 Toshi Nagata, "Molby - Graphical Molecular Modeling Software with Integrated Ruby Interpreter,"
220214 <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>
222216 </p>
223217 </blockquote>
224218 <p>
@@ -229,7 +223,7 @@ Molby includes the following softwares, which are copyrighted products as descri
229223 <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
230224 </li>
231225 <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
233227 </li>
234228 <li>
235229 <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
248242
249243 <h2>2. License</h2>
250244 <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).
252246 </p>
253247 <blockquote>
254248 <p>
@@ -260,7 +254,7 @@ Copyright (C) 2008-2022 Toshi Nagata <!-- copyright -->
260254 <p>
261255 This program is free software; you can redistribute it and/or modify
262256 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
264258 (at your option) any later version.
265259 </p>
266260 <p>
@@ -286,7 +280,7 @@ Molby を利用した成果を発表される際は、以下の論文を引用
286280 <blockquote>
287281 <p>
288282 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>
290284 </p>
291285 </blockquote>
292286 <p>
@@ -297,7 +291,7 @@ Molby は以下のソフトウェアを含んでいます。それぞれの著
297291 <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
298292 </li>
299293 <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
301295 </li>
302296 <li>
303297 <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
316310
317311 <h2>2. ライセンス</h2>
318312 <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> に従って配布します。
320314 </p>
321315 <blockquote>
322316 <p>
@@ -326,7 +320,7 @@ Molby: 対話型分子モデルソフトウェア(Ruby インタプリタ内
326320 Copyright (C) 2008-2022 Toshi Nagata <!-- copyright -->
327321 </p>
328322 <p>
329-このプログラムはフリーソフトウェアです。あなたはこれを、フリーソフトウェア財団によって発行された GNU 一般公衆利用許諾契約書(バージョン2か、希望によってはそれ以降のバージョンのうちどれか)の定める条件の下で再頒布または改変することができます。
323+このプログラムはフリーソフトウェアです。あなたはこれを、フリーソフトウェア財団によって発行された GNU 一般公衆利用許諾契約書(バージョン3か、希望によってはそれ以降のバージョンのうちどれか)の定める条件の下で再頒布または改変することができます。
330324 </p>
331325 <p>
332326 このプログラムは有用であることを願って頒布されますが、*全くの無保証* です。商業可能性の保証や特定の目的への適合性は、言外に示されたものも含め全く存在しません。詳しくはGNU 一般公衆利用許諾契約書をご覧ください。
--- a/MolLib/MD/MDForce.c
+++ b/MolLib/MD/MDForce.c
@@ -21,6 +21,8 @@
2121 #include <stdlib.h>
2222 #include <string.h>
2323
24+#include "Missing.h"
25+
2426 extern int do_custom_bond_callback(MDArena *arena, Double r, void *procObj, Double *energy, Double *force);
2527
2628 static void
--- a/MolLib/MD/MDPressure.c
+++ b/MolLib/MD/MDPressure.c
@@ -126,7 +126,7 @@ pressure_control(MDArena *arena)
126126 Transform tf;
127127 Vector v;
128128 Vector cello_new;
129- Mat33 celltr_save;
129+ Transform celltr_save;
130130 Double w, w0;
131131 int i;
132132 int needs_cell_recalculate = 0;
--- a/MolLib/MainView.c
+++ b/MolLib/MainView.c
@@ -27,6 +27,7 @@
2727 #include <stdlib.h>
2828 #include <string.h>
2929 #include <ctype.h>
30+#include <math.h>
3031
3132 #define biso2radius(r) ((r) > 0.5 ? sqrt((r) / 78.9568352087147) : 0.08)
3233
@@ -36,6 +37,168 @@
3637 /* Invalid bond/angle/torsion value, used in internal cache */
3738 const Double kInvalidValue = -10000000.0;
3839
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+
39202 #pragma mark ==== MainView public methods ====
40203
41204 void
@@ -298,7 +461,7 @@ MainView_convertScreenPositionToObjectPosition(MainView *mview, const GLfloat *s
298461 winZ = screenPos[2];
299462 else
300463 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);
302465 n = glGetError();
303466 MainViewCallback_unlockFocus(mview);
304467 objectPos[0] = posX;
@@ -323,7 +486,7 @@ MainView_convertObjectPositionToScreenPosition(MainView *mview, const double *ob
323486 viewport[0] = viewport[1] = 0;
324487 viewport[2] = (GLint)(rect[2] - rect[0]) * scale;
325488 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);
327490 if (glGetError() == GL_NO_ERROR) {
328491 screenPos[0] = objX / scale;
329492 screenPos[1] = objY / scale;
@@ -1777,7 +1940,7 @@ MainView_drawModel(MainView *mview)
17771940 mview->perspective_vector[1] = width / height;
17781941 mview->perspective_vector[2] = dimension;
17791942 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]);
17811944
17821945 /* Set up the model view */
17831946 glMatrixMode(GL_MODELVIEW);
--- a/MolLib/MolAction.c
+++ b/MolLib/MolAction.c
@@ -634,7 +634,7 @@ s_MolActionLog(Molecule *mol, MolAction *action, FILE *fp)
634634 MoleculeCallback_displayName(argp->u.mval, buf, sizeof buf);
635635 if (buf[0] == 0) {
636636 /* 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);
638638 }
639639 fprintf(fp, "%s", buf);
640640 break;
--- a/MolLib/Molecule.c
+++ b/MolLib/Molecule.c
@@ -9387,12 +9387,12 @@ MoleculeChangeResidueNumberWithArray(Molecule *mp, IntGroup *group, Int *resSeqs
93879387 Atom *ap;
93889388
93899389 /* 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) {
93919391 withArray = 1;
93929392 resSeq = 0;
93939393 } else {
93949394 withArray = 0;
9395- resSeq = ((int)resSeqs - 1) / 2;
9395+ resSeq = ((uintptr_t)resSeqs - 1) / 2;
93969396 }
93979397
93989398 IntGroupIteratorInit(group, &iter);
--- a/MolLib/Parameter.c
+++ b/MolLib/Parameter.c
@@ -21,6 +21,7 @@
2121 #include <stdarg.h>
2222 #include <math.h>
2323 #include <float.h>
24+#include "Missing.h"
2425
2526 /* Global parameter: it is initialized by the first call to ParameterReadFromFile() */
2627 Parameter *gBuiltinParameters = NULL;
--- a/MolLib/Ruby_bind/ruby_bind.c
+++ b/MolLib/Ruby_bind/ruby_bind.c
@@ -789,7 +789,7 @@ static VALUE
789789 s_Ruby_UpdateUI_handler(VALUE data)
790790 {
791791 void **p = (void **)data;
792- int index = (int)p[0];
792+ int index = (intptr_t)p[0];
793793 Molecule *mol = (Molecule *)p[1];
794794 int *outChecked = (int *)p[2];
795795 char **outTitle = (char **)p[3];
@@ -8626,7 +8626,7 @@ s_Molecule_FitCoordinates(int argc, VALUE *argv, VALUE self)
86268626 VALUE gval, rval, wval;
86278627 IntGroup *ig;
86288628 IntGroupIterator iter;
8629- int nn, errno, i, j, in, status;
8629+ int nn, errnum, i, j, in, status;
86308630 Vector *ref;
86318631 Double *weights, dval[3];
86328632 Transform tr;
@@ -8647,7 +8647,7 @@ s_Molecule_FitCoordinates(int argc, VALUE *argv, VALUE self)
86478647 if (rb_obj_is_kind_of(rval, rb_cNumeric)) {
86488648 int fn = NUM2INT(rb_Integer(rval));
86498649 if (fn < 0 || fn >= MoleculeGetNumberOfFrames(mol)) {
8650- errno = 1;
8650+ errnum = 1;
86518651 status = fn;
86528652 goto err;
86538653 }
@@ -8660,7 +8660,7 @@ s_Molecule_FitCoordinates(int argc, VALUE *argv, VALUE self)
86608660 } else if (rb_obj_is_kind_of(rval, rb_cLAMatrix)) {
86618661 LAMatrix *m = LAMatrixFromValue(rval, NULL, 0, 0);
86628662 if (m->row * m->column < nn * 3) {
8663- errno = 2;
8663+ errnum = 2;
86648664 goto err;
86658665 }
86668666 for (i = 0; i < nn; i++) {
@@ -8672,24 +8672,24 @@ s_Molecule_FitCoordinates(int argc, VALUE *argv, VALUE self)
86728672 VALUE aval;
86738673 rval = rb_protect(rb_ary_to_ary, rval, &status);
86748674 if (status != 0) {
8675- errno = 3;
8675+ errnum = 3;
86768676 goto err;
86778677 }
86788678 if (RARRAY_LEN(rval) < nn) {
8679- errno = 2;
8679+ errnum = 2;
86808680 goto err;
86818681 }
86828682 if (rb_obj_is_kind_of((RARRAY_PTR(rval))[0], rb_cNumeric)) {
86838683 /* Array of 3*nn numbers */
86848684 if (RARRAY_LEN(rval) < nn * 3) {
8685- errno = 2;
8685+ errnum = 2;
86868686 goto err;
86878687 }
86888688 for (i = 0; i < nn; i++) {
86898689 for (j = 0; j < 3; j++) {
86908690 aval = rb_protect(rb_Float, (RARRAY_PTR(rval))[i * 3 + j], &status);
86918691 if (status != 0) {
8692- errno = 3;
8692+ errnum = 3;
86938693 goto err;
86948694 }
86958695 dval[j] = NUM2DBL(aval);
@@ -8707,18 +8707,18 @@ s_Molecule_FitCoordinates(int argc, VALUE *argv, VALUE self)
87078707 } else {
87088708 aval = rb_protect(rb_ary_to_ary, aval, &status);
87098709 if (status != 0) {
8710- errno = 3;
8710+ errnum = 3;
87118711 goto err;
87128712 }
87138713 if (RARRAY_LEN(aval) < 3) {
8714- errno = 4;
8714+ errnum = 4;
87158715 status = i;
87168716 goto err;
87178717 }
87188718 for (j = 0; j < 3; j++) {
87198719 VALUE aaval = rb_protect(rb_Float, (RARRAY_PTR(aval))[j], &status);
87208720 if (status != 0) {
8721- errno = 3;
8721+ errnum = 3;
87228722 goto err;
87238723 }
87248724 dval[j] = NUM2DBL(aaval);
@@ -8740,17 +8740,17 @@ s_Molecule_FitCoordinates(int argc, VALUE *argv, VALUE self)
87408740 } else {
87418741 wval = rb_protect(rb_ary_to_ary, wval, &status);
87428742 if (status != 0) {
8743- errno = 3;
8743+ errnum = 3;
87448744 goto err;
87458745 }
87468746 if (RARRAY_LEN(wval) < nn) {
8747- errno = 5;
8747+ errnum = 5;
87488748 goto err;
87498749 }
87508750 for (i = 0; i < nn; i++) {
87518751 VALUE wwval = rb_protect(rb_Float, (RARRAY_PTR(wval))[i], &status);
87528752 if (status != 0) {
8753- errno = 3;
8753+ errnum = 3;
87548754 goto err;
87558755 }
87568756 weights[i] = NUM2DBL(wwval);
@@ -8758,27 +8758,27 @@ s_Molecule_FitCoordinates(int argc, VALUE *argv, VALUE self)
87588758 }
87598759 dval[0] = s_Molecule_FitCoordinates_Sub(mol, ig, ref, weights, tr);
87608760 if (dval[0] < 0) {
8761- errno = 6;
8761+ errnum = 6;
87628762 goto err;
87638763 }
8764- errno = 0;
8764+ errnum = 0;
87658765 err:
87668766 IntGroupIteratorRelease(&iter);
87678767 free(ref);
87688768 free(weights);
8769- if (errno == 0) {
8769+ if (errnum == 0) {
87708770 return rb_ary_new3(2, ValueFromTransform(&tr), rb_float_new(dval[0]));
8771- } else if (errno == 1) {
8771+ } else if (errnum == 1) {
87728772 rb_raise(rb_eMolbyError, "frame index (%d) is out of range", status);
8773- } else if (errno == 2) {
8773+ } else if (errnum == 2) {
87748774 rb_raise(rb_eMolbyError, "insufficient number of reference coordinates");
8775- } else if (errno == 3) {
8775+ } else if (errnum == 3) {
87768776 rb_jump_tag(status);
8777- } else if (errno == 4) {
8777+ } else if (errnum == 4) {
87788778 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) {
87808780 rb_raise(rb_eMolbyError, "insufficient number of weight values");
8781- } else if (errno == 6) {
8781+ } else if (errnum == 6) {
87828782 rb_raise(rb_eMolbyError, "matrix calculation failed during coordinate fitting");
87838783 }
87848784 return Qnil; /* Not reached */
--- a/MolLib/Ruby_bind/ruby_dialog.c
+++ b/MolLib/Ruby_bind/ruby_dialog.c
@@ -1773,26 +1773,26 @@ s_RubyDialog_doTableAction(VALUE val)
17731773 vp[3] = (void *)(intptr_t)(NUM2INT(rb_Integer(retval)));
17741774 return retval;
17751775 } 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]);
17781778 retval = s_RubyDialog_CallActionProc(self, pval, 3, args);
17791779 retval = rb_str_to_str(retval);
17801780 vp[5] = strdup(EncodedStringValuePtr(retval));
17811781 return retval;
17821782 } 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]);
17851785 args[3] = Ruby_NewEncodedStringValue2((char *)vp[5]);
17861786 retval = s_RubyDialog_CallActionProc(self, pval, 4, args);
17871787 vp[6] = (void *)(intptr_t)(NUM2INT(rb_Integer(retval)));
17881788 return retval;
17891789 } else if (sym == sOnDragSelectionToRowSymbol) {
1790- args[1] = INT2NUM((int)vp[3]);
1790+ args[1] = INT2NUM((intptr_t)vp[3]);
17911791 retval = s_RubyDialog_CallActionProc(self, pval, 2, args);
17921792 return retval;
17931793 } 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]);
17961796 retval = s_RubyDialog_CallActionProc(self, pval, 3, args);
17971797 vp[5] = (void *)(intptr_t)(RTEST(retval) ? 1 : 0);
17981798 return retval;
@@ -1809,8 +1809,8 @@ s_RubyDialog_doTableAction(VALUE val)
18091809 float *bg = (float *)vp[6];
18101810 int i, n = 0;
18111811 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]);
18141814 retval = s_RubyDialog_CallActionProc(self, pval, 3, args);
18151815 if (retval == Qnil)
18161816 return Qnil;
@@ -1834,8 +1834,8 @@ s_RubyDialog_doTableAction(VALUE val)
18341834 vp[7] = (void *)(intptr_t)n;
18351835 return retval;
18361836 } 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]);
18391839 retval = s_RubyDialog_CallActionProc(self, pval, 3, args);
18401840 if (retval == Qnil) {
18411841 vp[6] = (void *)0;
@@ -1854,9 +1854,9 @@ s_RubyDialog_doTableAction(VALUE val)
18541854 }
18551855 return retval;
18561856 } 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]);
18601860 retval = s_RubyDialog_CallActionProc(self, pval, 4, args);
18611861 return retval;
18621862 } else return Qnil;
@@ -1873,7 +1873,7 @@ RubyDialog_GetTableItemCount(RubyValue self, RDItem *ip)
18731873 return 0;
18741874 } else if (val == Qnil)
18751875 return 0;
1876- else return (int)vp[3];
1876+ else return (intptr_t)vp[3];
18771877 }
18781878
18791879 void
@@ -1899,7 +1899,7 @@ RubyDialog_SetTableItemText(RubyValue self, RDItem *ip, int row, int column, con
18991899 if (status != 0 || val == Qnil) {
19001900 return -1;
19011901 } else
1902- return (int)vp[6];
1902+ return (intptr_t)vp[6];
19031903 }
19041904
19051905 void
@@ -1920,7 +1920,7 @@ RubyDialog_IsTableItemEditable(RubyValue self, RDItem *ip, int row, int column)
19201920 VALUE val = rb_protect(s_RubyDialog_doTableAction, (VALUE)vp, &status);
19211921 if (status != 0 || val == Qnil)
19221922 return 0;
1923- else return (int)vp[5];
1923+ else return (intptr_t)vp[5];
19241924 }
19251925
19261926 int
@@ -1931,7 +1931,7 @@ RubyDialog_IsTableDragAndDropEnabled(RubyValue self, RDItem *ip, int row)
19311931 VALUE val = rb_protect(s_RubyDialog_doTableAction, (VALUE)vp, &status);
19321932 if (status != 0 || val == Qnil)
19331933 return 0;
1934- else return (int)vp[3];
1934+ else return (intptr_t)vp[3];
19351935 }
19361936
19371937 void
@@ -1952,7 +1952,7 @@ RubyDialog_SetTableItemColor(RubyValue self, RDItem *ip, int row, int column, fl
19521952 VALUE val = rb_protect(s_RubyDialog_doTableAction, (VALUE)vp, &status);
19531953 if (status != 0 || val == Qnil)
19541954 return 0;
1955- else return (int)vp[7];
1955+ else return (intptr_t)vp[7];
19561956 }
19571957
19581958 int
@@ -1963,7 +1963,7 @@ RubyDialog_HasPopUpMenu(RubyValue self, RDItem *ip, int row, int column, char **
19631963 VALUE val = rb_protect(s_RubyDialog_doTableAction, (VALUE)vp, &status);
19641964 if (status != 0 || val == Qnil)
19651965 return 0;
1966- else return (int)vp[6];
1966+ else return (intptr_t)vp[6];
19671967 }
19681968
19691969 void
@@ -2026,7 +2026,7 @@ s_RubyDialog_doItemAction(VALUE val)
20262026 VALUE flag;
20272027 RDItem *ip = (RDItem *)vp[1];
20282028 RDItem *ip2;
2029- int options = (int)vp[2];
2029+ int options = (intptr_t)vp[2];
20302030 VALUE ival, itval, actval, tval, aval;
20312031 RubyDialog *dref = s_RubyDialog_GetController(self);
20322032 VALUE items = rb_iv_get(self, "_items");
@@ -2210,7 +2210,7 @@ s_RubyDialog_doKeyAction(VALUE val)
22102210 {
22112211 void **values = (void **)val;
22122212 VALUE self = (VALUE)values[0];
2213- int keyCode = (int)values[1];
2213+ int keyCode = (intptr_t)values[1];
22142214 VALUE actval = rb_iv_get(self, "_key_action");
22152215 if (actval != Qnil) {
22162216 if (TYPE(actval) == T_SYMBOL)
@@ -2268,7 +2268,7 @@ RubyDialog_getFlexFlags(RubyValue self, RDItem *ip)
22682268 return -1;
22692269 else if (rval == Qnil)
22702270 return -1;
2271- else return (int)args[2];
2271+ else return (intptr_t)args[2];
22722272 }
22732273
22742274 static VALUE
@@ -2276,7 +2276,7 @@ s_RubyDialog_doCloseWindow(VALUE val)
22762276 {
22772277 void **values = (void **)val;
22782278 VALUE self = (VALUE)values[0];
2279- int isModal = (int)values[1];
2279+ int isModal = (intptr_t)values[1];
22802280 if (isModal) {
22812281 rb_funcall(self, rb_intern("end_modal"), 1, INT2NUM(1));
22822282 return Qnil;
--- a/README
+++ b/README
@@ -5,7 +5,7 @@
55 An Interactive Molecular Modeling Software
66 with Integrated Ruby Interpreter
77
8- Version 1.0.2
8+ Version 1.1.0
99
1010 Toshi Nagata
1111
--- a/Version
+++ b/Version
@@ -1 +1 @@
1-version = "1.0.2"
1+version = "1.1.0"
--- a/bitmaps/jump_to_end.xpm
+++ b/bitmaps/jump_to_end.xpm
@@ -1,5 +1,5 @@
11 /* XPM */
2-static char *jump_to_end_xpm[] = {
2+static const char *jump_to_end_xpm[] = {
33 /* width height ncolors chars_per_pixel */
44 "9 9 7 1",
55 /* colors */
--- a/bitmaps/jump_to_start.xpm
+++ b/bitmaps/jump_to_start.xpm
@@ -1,5 +1,5 @@
11 /* XPM */
2-static char *jump_to_start_xpm[] = {
2+static const char *jump_to_start_xpm[] = {
33 /* width height ncolors chars_per_pixel */
44 "9 9 8 1",
55 /* colors */
--- a/bitmaps/pi00.xpm
+++ b/bitmaps/pi00.xpm
@@ -1,5 +1,5 @@
11 /* XPM */
2-static char *pi00[] = {
2+static const char *pi00[] = {
33 /* width height ncolors chars_per_pixel */
44 "12 12 20 1",
55 /* colors */
--- a/bitmaps/pi01.xpm
+++ b/bitmaps/pi01.xpm
@@ -1,5 +1,5 @@
11 /* XPM */
2-static char *pi01[] = {
2+static const char *pi01[] = {
33 /* width height ncolors chars_per_pixel */
44 "12 12 23 1",
55 /* colors */
--- a/bitmaps/pi02.xpm
+++ b/bitmaps/pi02.xpm
@@ -1,5 +1,5 @@
11 /* XPM */
2-static char *pi02[] = {
2+static const char *pi02[] = {
33 /* width height ncolors chars_per_pixel */
44 "12 12 19 1",
55 /* colors */
--- a/bitmaps/pi03.xpm
+++ b/bitmaps/pi03.xpm
@@ -1,5 +1,5 @@
11 /* XPM */
2-static char *pi03[] = {
2+static const char *pi03[] = {
33 /* width height ncolors chars_per_pixel */
44 "12 12 20 1",
55 /* colors */
--- a/bitmaps/pi04.xpm
+++ b/bitmaps/pi04.xpm
@@ -1,5 +1,5 @@
11 /* XPM */
2-static char *pi04[] = {
2+static const char *pi04[] = {
33 /* width height ncolors chars_per_pixel */
44 "12 12 24 1",
55 /* colors */
--- a/bitmaps/pi05.xpm
+++ b/bitmaps/pi05.xpm
@@ -1,5 +1,5 @@
11 /* XPM */
2-static char *pi05[] = {
2+static const char *pi05[] = {
33 /* width height ncolors chars_per_pixel */
44 "12 12 19 1",
55 /* colors */
--- a/bitmaps/pi06.xpm
+++ b/bitmaps/pi06.xpm
@@ -1,5 +1,5 @@
11 /* XPM */
2-static char *pi06[] = {
2+static const char *pi06[] = {
33 /* width height ncolors chars_per_pixel */
44 "12 12 19 1",
55 /* colors */
--- a/bitmaps/pi07.xpm
+++ b/bitmaps/pi07.xpm
@@ -1,5 +1,5 @@
11 /* XPM */
2-static char *pi07[] = {
2+static const char *pi07[] = {
33 /* width height ncolors chars_per_pixel */
44 "12 12 24 1",
55 /* colors */
--- a/bitmaps/pi08.xpm
+++ b/bitmaps/pi08.xpm
@@ -1,5 +1,5 @@
11 /* XPM */
2-static char *pi08[] = {
2+static const char *pi08[] = {
33 /* width height ncolors chars_per_pixel */
44 "12 12 20 1",
55 /* colors */
--- a/bitmaps/pi09.xpm
+++ b/bitmaps/pi09.xpm
@@ -1,5 +1,5 @@
11 /* XPM */
2-static char *pi09[] = {
2+static const char *pi09[] = {
33 /* width height ncolors chars_per_pixel */
44 "12 12 20 1",
55 /* colors */
--- a/bitmaps/pi10.xpm
+++ b/bitmaps/pi10.xpm
@@ -1,5 +1,5 @@
11 /* XPM */
2-static char *pi10[] = {
2+static const char *pi10[] = {
33 /* width height ncolors chars_per_pixel */
44 "12 12 23 1",
55 /* colors */
--- a/bitmaps/pi11.xpm
+++ b/bitmaps/pi11.xpm
@@ -1,5 +1,5 @@
11 /* XPM */
2-static char *pi11[] = {
2+static const char *pi11[] = {
33 /* width height ncolors chars_per_pixel */
44 "12 12 19 1",
55 /* colors */
--- a/bitmaps/play_backward.xpm
+++ b/bitmaps/play_backward.xpm
@@ -1,5 +1,5 @@
11 /* XPM */
2-static char *play_backward_xpm[] = {
2+static const char *play_backward_xpm[] = {
33 /* width height ncolors chars_per_pixel */
44 "9 9 12 1",
55 /* colors */
--- a/bitmaps/play_forward.xpm
+++ b/bitmaps/play_forward.xpm
@@ -1,5 +1,5 @@
11 /* XPM */
2-static char *play_forward_xpm[] = {
2+static const char *play_forward_xpm[] = {
33 /* width height ncolors chars_per_pixel */
44 "9 9 12 1",
55 /* colors */
--- a/bitmaps/rotate_bond.xpm
+++ b/bitmaps/rotate_bond.xpm
@@ -1,5 +1,5 @@
11 /* XPM */
2-static char *rotate_bond_xpm[] = {
2+static const char *rotate_bond_xpm[] = {
33 /* width height ncolors chars_per_pixel */
44 "18 18 30 2",
55 /* colors */
--- a/bitmaps/rotate_x.xpm
+++ b/bitmaps/rotate_x.xpm
@@ -1,5 +1,5 @@
11 /* XPM */
2-static char *rotate_x_xpm[] = {
2+static const char *rotate_x_xpm[] = {
33 /* width height ncolors chars_per_pixel */
44 "18 18 29 2",
55 /* colors */
--- a/bitmaps/rotate_y.xpm
+++ b/bitmaps/rotate_y.xpm
@@ -1,5 +1,5 @@
11 /* XPM */
2-static char *rotate_y_xpm[] = {
2+static const char *rotate_y_xpm[] = {
33 /* width height ncolors chars_per_pixel */
44 "18 18 26 1",
55 /* colors */
--- a/bitmaps/stop_mini.xpm
+++ b/bitmaps/stop_mini.xpm
@@ -1,5 +1,5 @@
11 /* XPM */
2-static char *stop_mini[] = {
2+static const char *stop_mini[] = {
33 /* width height ncolors chars_per_pixel */
44 "12 12 34 2",
55 /* colors */
--- a/bitmaps/stop_mini_dark.xpm
+++ b/bitmaps/stop_mini_dark.xpm
@@ -1,5 +1,5 @@
11 /* XPM */
2-static char *stop_mini_dark[] = {
2+static const char *stop_mini_dark[] = {
33 /* width height ncolors chars_per_pixel */
44 "12 12 42 2",
55 /* colors */
--- a/bitmaps/stop_mini_grey.xpm
+++ b/bitmaps/stop_mini_grey.xpm
@@ -1,5 +1,5 @@
11 /* XPM */
2-static char *stop_mini_grey[] = {
2+static const char *stop_mini_grey[] = {
33 /* width height ncolors chars_per_pixel */
44 "12 12 71 2",
55 /* colors */
--- a/build-win/molby64.iss
+++ b/build-win/molby64.iss
@@ -1,7 +1,7 @@
11 ; Create an installer that can install both 32bit and 64bit versions
22 [Setup]
33 AppName = Molby
4-AppVerName = Molby (v1.0.2)
4+AppVerName = Molby (v1.1.0)
55 DefaultDirName = {pf}\Molby
66 DefaultGroupName = Molby
77 UninstallDisplayIcon = {app}\Molby.exe
--- a/build-win32/molby32.iss
+++ b/build-win32/molby32.iss
@@ -1,6 +1,6 @@
11 [Setup]
22 AppName = Molby
3-AppVerName = Molby (v1.0.2)
3+AppVerName = Molby (v1.1.0)
44 DefaultDirName = {pf}\Molby (32bit)
55 DefaultGroupName = Molby (32bit)
66 UninstallDisplayIcon = {app}\Molby.exe
--- a/build-xcode/Molby-Info.plist
+++ b/build-xcode/Molby-Info.plist
@@ -34,11 +34,11 @@
3434 <key>CFBundlePackageType</key>
3535 <string>APPL</string>
3636 <key>CFBundleShortVersionString</key>
37- <string>Version 1.0.2</string>
37+ <string>Version 1.1.0</string>
3838 <key>CFBundleSignature</key>
3939 <string>????</string>
4040 <key>CFBundleVersion</key>
41- <string>v1.0.2</string>
41+ <string>v1.1.0</string>
4242 <key>NSHumanReadableCopyright</key>
4343 <string>Copyright 2008-2022 Toshi Nagata</string>
4444 <key>NSPrincipalClass</key>
--- a/build-xcode/Molby.xcodeproj/project.pbxproj
+++ b/build-xcode/Molby.xcodeproj/project.pbxproj
@@ -25,7 +25,6 @@
2525
2626 /* Begin PBXBuildFile section */
2727 E403568428CF6A3D008E2C46 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E403568328CF6A3D008E2C46 /* QuartzCore.framework */; };
28- E403568528D0AD7E008E2C46 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E4FC7845183E51180064FB2E /* Carbon.framework */; };
2928 E403568628D0B7B0008E2C46 /* MyListCtrl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E41251B728CD92A100E12983 /* MyListCtrl.cpp */; };
3029 E4059F9B28C46A6E0052B36B /* molby_icon.icns in Resources */ = {isa = PBXBuildFile; fileRef = E4FC77D4183E4FF20064FB2E /* molby_icon.icns */; };
3130 E4059F9C28C46A6E0052B36B /* Scripts in Resources */ = {isa = PBXBuildFile; fileRef = E4FC77D6183E4FFE0064FB2E /* Scripts */; };
@@ -114,6 +113,7 @@
114113 E4589CEF28D5FD6400F55785 /* MyToggleButton.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4589CEE28D5FD6400F55785 /* MyToggleButton.cpp */; };
115114 E4589CF028D5FD6400F55785 /* MyToggleButton.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4589CEE28D5FD6400F55785 /* MyToggleButton.cpp */; };
116115 E4589CF228D6E89900F55785 /* docview.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E45B94611A170B9A008E95EB /* docview.cpp */; };
116+ E4589CF528D82A5200F55785 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E4FC7845183E51180064FB2E /* Carbon.framework */; };
117117 E4653CB118A0CC7D0022377B /* textctrl_addition.mm in Sources */ = {isa = PBXBuildFile; fileRef = E4653CB018A0CC7D0022377B /* textctrl_addition.mm */; };
118118 E4ACACE718C6D32300F08B67 /* ortep3 in Resources */ = {isa = PBXBuildFile; fileRef = E4ACACE418C6D32300F08B67 /* ortep3 */; };
119119 E4D379A219C87C2200636D28 /* modalwindow.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4D379A119C87C2200636D28 /* modalwindow.cpp */; };
@@ -321,7 +321,7 @@
321321 E4FC784D183E51180064FB2E /* Cocoa.framework in Frameworks */,
322322 E4FC784E183E51180064FB2E /* GLUT.framework in Frameworks */,
323323 E4FC784F183E51180064FB2E /* IOKit.framework in Frameworks */,
324- E403568528D0AD7E008E2C46 /* Carbon.framework in Frameworks */,
324+ E4589CF528D82A5200F55785 /* Carbon.framework in Frameworks */,
325325 E4FC7850183E51180064FB2E /* OpenGL.framework in Frameworks */,
326326 E4FC7852183E51180064FB2E /* System.framework in Frameworks */,
327327 E4FC7A17183E51570064FB2E /* AppKit.framework in Frameworks */,
--- a/wxSources/ConsoleFrame.cpp
+++ b/wxSources/ConsoleFrame.cpp
@@ -387,7 +387,7 @@ ConsoleFrame::OnEnterPressed()
387387 void
388388 ConsoleFrame::ShowHistory(bool up, bool option)
389389 {
390- char *p;
390+ const char *p;
391391 if (commandHistoryIndex == -1 && valueHistoryIndex == -1) {
392392 if (!up)
393393 return;
--- a/wxSources/MoleculeView.cpp
+++ b/wxSources/MoleculeView.cpp
@@ -407,7 +407,6 @@ MoleculeView::OnDraw(wxDC *dc)
407407 wxImage *img = CaptureGLCanvas(scale);
408408 if (img != NULL) {
409409 wxBitmap bitmap(*img);
410- wxSize ppi = dc->GetPPI();
411410 double sx, sy;
412411 dc->GetUserScale(&sx, &sy);
413412 dc->SetUserScale(sx / scale, sy / scale);
@@ -930,7 +929,8 @@ MoleculeView::OnLeftDClickInListCtrl(wxMouseEvent &event)
930929 if (mview->tableIndex >= kMainViewBondTableIndex && mview->tableIndex <= kMainViewImproperTableIndex /* && mview->mol->par != NULL */ ) {
931930 int row, col, i;
932931 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;
934934 wxPoint pos = event.GetPosition();
935935 if (!listctrl->FindItemAtPosition(pos, &row, &col) || col < 4)
936936 return;
@@ -952,6 +952,7 @@ MoleculeView::OnLeftDClickInListCtrl(wxMouseEvent &event)
952952 }
953953 asprintf(&parstr, "%s %s %s", params[0], params[1], params[2]);
954954 MolActionCreateAndPerform(mview->mol, SCRIPT_ACTION("sssssss"), "cmd_edit_local_parameter_in_mainview", ptype, indices, names, types, value, partypes, parstr);
955+ free(parstr);
955956 }
956957 }
957958
--- a/wxSources/MyApp.cpp
+++ b/wxSources/MyApp.cpp
@@ -627,7 +627,7 @@ MyApp::CreateMenuBar(int kind, wxMenu **out_file_history_menu, wxMenu **out_edit
627627 return menu_bar;
628628 }
629629
630-#if __WXMAC__
630+#if defined(__WXMAC__) || defined(__WXOSX__)
631631 /* When the application is launched without any documents, an empty document is opened.
632632 This should be implemented by overriding this special method; parsing argc/argv does
633633 not work, because the list of files is passed through an Apple Event. */
@@ -646,53 +646,21 @@ MyApp::MacOpenFile(const wxString &fileName)
646646 RequestOpenFilesByEvent(file);
647647 }
648648
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");
688659 }
689-
690- OnOpenFiles(fNameList);
691-
692- return noErr;
660+ OnOpenFiles(fnames);
693661 }
694662
695-#endif
663+#endif // WXMAC
696664
697665 int
698666 MyApp::OnExit(void)
@@ -1444,10 +1412,8 @@ MyApp::CallSubProcess(const char *cmdline, const char *procname, int (*callback)
14441412 {
14451413 int status = 0;
14461414 int callback_result = 0;
1447- int count = 0;
14481415 bool progress_panel = false;
14491416 char buf[256];
1450- size_t len, len_total;
14511417 wxString cmdstr(cmdline, WX_DEFAULT_CONV);
14521418 wxLongLong startTime;
14531419
@@ -1817,7 +1783,8 @@ AboutDialog::AboutDialog():
18171783 // |
18181784 // |-> copyright messages
18191785
1820- char *s1, *s2, *s3;
1786+ const char *s1;
1787+ char *s2, *s3;
18211788 s1 = "Molby";
18221789 Molby_getDescription(&s2, &s3);
18231790 wxString str1(s1, WX_DEFAULT_CONV);
--- a/wxSources/MyApp.h
+++ b/wxSources/MyApp.h
@@ -239,7 +239,7 @@ class MyApp: public wxApp
239239 #if defined(__WXMAC__)
240240 virtual void MacNewFile();
241241 virtual void MacOpenFile(const wxString &fileName);
242- virtual short MacHandleAEODoc(const WXEVENTREF event, WXEVENTREF WXUNUSED(reply));
242+ virtual void MacOpenFiles(const wxArrayString &fileNames);
243243 #endif
244244
245245 void EnableTimerForDocument(MyDocument *doc);
--- a/wxSources/MyVersion.c
+++ b/wxSources/MyVersion.c
@@ -15,7 +15,7 @@
1515 GNU General Public License for more details.
1616 */
1717
18-const char *gVersionString = "v1.0.2";
18+const char *gVersionString = "v1.1.0";
1919 const char *gCopyrightString = "Copyright (c) 2008-2022 Toshi Nagata";
2020 /* The following are now defined in build/buildInfo.c, generated by record_build_date.sh */
2121 /*int gRevisionNumber = 0;
--- a/wxSources/OpenGL_extensions.c
+++ b/wxSources/OpenGL_extensions.c
@@ -63,7 +63,7 @@ InitializeOpenGLExtensions(void)
6363 {
6464 int n = 0;
6565 if (p_inited != 0)
66- return;
66+ return 0;
6767 p_glIsRenderbufferEXT = (t_glIsRenderbufferEXT)wglGetProcAddress("glIsRenderbufferEXT");
6868 if (p_glIsRenderbufferEXT == NULL)
6969 n++;
--- a/wxSources/ProgressFrame.cpp
+++ b/wxSources/ProgressFrame.cpp
@@ -108,7 +108,7 @@ ProgressFrame::SetInterruptValue(int value)
108108 int
109109 ProgressFrame::CheckInterrupt()
110110 {
111- if (this != NULL && m_interruptValue) {
111+ if (m_interruptValue) {
112112 int save = m_interruptValue;
113113 m_interruptValue = 0;
114114 return save;
--- a/wxSources/RubyDialogFrame.cpp
+++ b/wxSources/RubyDialogFrame.cpp
@@ -1294,38 +1294,41 @@ RubyDialogCallback_setFontForItem(RDItem *item, int size, int family, int style,
12941294 } else return;
12951295 if (size == 0)
12961296 size = font.GetPointSize();
1297+ wxFontFamily ffamily;
1298+ wxFontStyle fstyle;
1299+ wxFontWeight fweight;
12971300 if (family == 0)
1298- family = wxFONTFAMILY_DEFAULT;
1301+ ffamily = wxFONTFAMILY_DEFAULT;
12991302 else {
1300- family = (family == 2 ? wxFONTFAMILY_ROMAN :
1303+ ffamily = (family == 2 ? wxFONTFAMILY_ROMAN :
13011304 (family == 3 ? wxFONTFAMILY_SWISS :
13021305 (family == 4 ? wxFONTFAMILY_MODERN :
13031306 wxFONTFAMILY_DEFAULT)));
13041307 }
13051308 if (style == 0)
1306- style = wxFONTSTYLE_NORMAL;
1309+ fstyle = wxFONTSTYLE_NORMAL;
13071310 else {
1308- style = (style == 2 ? wxFONTSTYLE_SLANT :
1311+ fstyle = (style == 2 ? wxFONTSTYLE_SLANT :
13091312 (style == 3 ? wxFONTSTYLE_ITALIC :
13101313 wxFONTSTYLE_NORMAL));
13111314 }
13121315 if (weight == 0)
1313- weight = wxFONTWEIGHT_NORMAL;
1316+ fweight = wxFONTWEIGHT_NORMAL;
13141317 else {
1315- weight = (weight == 2 ? wxFONTWEIGHT_BOLD :
1318+ fweight = (weight == 2 ? wxFONTWEIGHT_BOLD :
13161319 (weight == 3 ? wxFONTWEIGHT_LIGHT :
13171320 wxFONTWEIGHT_NORMAL));
13181321 }
13191322 if (textctrl != NULL) {
13201323 wxTextAttr newAttr;
1321- wxFont newFont(size, family, style, weight);
1324+ wxFont newFont(size, ffamily, fstyle, fweight);
13221325 newAttr.SetFont(newFont);
13231326 textctrl->SetDefaultStyle(newAttr);
13241327 #if __WXMAC__
13251328 textctrl->SetFont(newFont);
13261329 #endif
13271330 } else {
1328- ctrl->SetFont(wxFont(size, family, style, weight));
1331+ ctrl->SetFont(wxFont(size, ffamily, fstyle, fweight));
13291332 wxString label = ctrl->GetLabel();
13301333 ctrl->SetLabel(_(""));
13311334 ctrl->SetLabel(label); /* Update the control size */
@@ -1757,14 +1760,15 @@ RubyDialogCallback_setFont(RDDeviceContext *dc, void **args)
17571760 float size = FromDCDIP(dcp, *((float *)(args[i + 1])));
17581761 font.SetPointSize((int)size);
17591762 } 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;
17611765 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;
17661770 }
1767- font.SetStyle(style);
1771+ font.SetStyle(fstyle);
17681772 } else if (strcmp((const char *)args[i], "family") == 0) {
17691773 wxFontFamily family;
17701774 j = (intptr_t)(args[i + 1]);
@@ -1811,16 +1815,17 @@ RubyDialogCallback_setPen(RDDeviceContext *dc, void **args)
18111815 pen.SetWidth((int)width);
18121816 } else if (strcmp((const char *)args[i], "style") == 0) {
18131817 long style = (intptr_t)(args[i + 1]);
1818+ wxPenStyle pstyle;
18141819 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;
18221827 }
1823- pen.SetStyle(style);
1828+ pen.SetStyle(pstyle);
18241829 }
18251830 }
18261831 }
旧リポジトリブラウザで表示