• R/O
  • HTTP
  • SSH
  • HTTPS

fermisurfer: Commit

fermisurfer Git


Commit MetaInfo

Revision138fbc93ac156f0095abfd7aef7319c3e6e3d33e (tree)
Zeit2019-06-03 01:00:15
Autormitsuaki1987 <kawamitsuaki@gmai...>
Commitermitsuaki1987

Log Message

wxWidgets

Ändern Zusammenfassung

Diff

--- a/Makefile.in
+++ b/Makefile.in
@@ -228,8 +228,6 @@ ECHO_N = @ECHO_N@
228228 ECHO_T = @ECHO_T@
229229 EGREP = @EGREP@
230230 EXEEXT = @EXEEXT@
231-GLUT_CFLAGS = @GLUT_CFLAGS@
232-GLUT_LIBS = @GLUT_LIBS@
233231 GLU_CFLAGS = @GLU_CFLAGS@
234232 GLU_LIBS = @GLU_LIBS@
235233 GL_CFLAGS = @GL_CFLAGS@
@@ -262,6 +260,19 @@ SET_MAKE = @SET_MAKE@
262260 SHELL = @SHELL@
263261 STRIP = @STRIP@
264262 VERSION = @VERSION@
263+WX_CFLAGS = @WX_CFLAGS@
264+WX_CFLAGS_ONLY = @WX_CFLAGS_ONLY@
265+WX_CONFIG_PATH = @WX_CONFIG_PATH@
266+WX_CPPFLAGS = @WX_CPPFLAGS@
267+WX_CXXFLAGS = @WX_CXXFLAGS@
268+WX_CXXFLAGS_ONLY = @WX_CXXFLAGS_ONLY@
269+WX_LIBS = @WX_LIBS@
270+WX_LIBS_STATIC = @WX_LIBS_STATIC@
271+WX_RESCOMP = @WX_RESCOMP@
272+WX_VERSION = @WX_VERSION@
273+WX_VERSION_MAJOR = @WX_VERSION_MAJOR@
274+WX_VERSION_MICRO = @WX_VERSION_MICRO@
275+WX_VERSION_MINOR = @WX_VERSION_MINOR@
265276 abs_builddir = @abs_builddir@
266277 abs_srcdir = @abs_srcdir@
267278 abs_top_builddir = @abs_top_builddir@
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -603,217 +603,6 @@ AC_DEFUN([AX_CHECK_GLU],[
603603 ])
604604
605605 # ===========================================================================
606-# https://www.gnu.org/software/autoconf-archive/ax_check_glut.html
607-# ===========================================================================
608-#
609-# SYNOPSIS
610-#
611-# AX_CHECK_GLUT([ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND])
612-#
613-# DESCRIPTION
614-#
615-# Checks for GLUT. If a valid GLUT implementation is found, the configure
616-# script would export the C preprocessor symbol "HAVE_GLUT=1".
617-#
618-# If either a valid GLUT header or library was not found, by default the
619-# configure script would exit on error. This behavior can be overwritten
620-# by providing a custom "ACTION-IF-NOT-FOUND" hook.
621-#
622-# If the header, library was found, and been tested for compiling and
623-# linking the configuration would export the required compiler flags to
624-# "GLUT_CFLAGS" and "GLUT_LIBS" environment variables. These two variables
625-# can also be overwritten by defining the environment variables before
626-# executing the configure program. If it was predefined, configure would
627-# not try to overwrite it, but it would still perform the compile and link
628-# test. Only when the tests succeeded does the configure script to export
629-# "HAVE_GLUT=1" and to run "ACTION-IF-FOUND" hook.
630-#
631-# If user didn't specify the "ACTION-IF-FOUND" hook, the configuration
632-# would prepend "GLUT_CFLAGS" and "GLUT_LIBS" to "CFLAGS" and "LIBS", like
633-# many other autoconf macros do.
634-#
635-# If the header "GL/glut.h" is found, "HAVE_GL_GLUT_H" is defined. If the
636-# header "GLUT/glut.h" is found, HAVE_GLUT_GLUT_H is defined.
637-#
638-# You should use something like this in your headers:
639-#
640-# # if HAVE_WINDOWS_H && defined(_WIN32)
641-# # include <windows.h>
642-# # endif
643-# # if defined(HAVE_GL_GLUT_H)
644-# # include <GL/glut.h>
645-# # elif defined(HAVE_GLUT_GLUT_H)
646-# # include <GLUT/glut.h>
647-# # else
648-# # error no glut.h
649-# # endif
650-#
651-# On the OSX platform, you can use the option --with-xquartz-gl to use
652-# X11/Xquartz GLUT implementation instead of the system built in GLUT
653-# framework.
654-#
655-# LICENSE
656-#
657-# Copyright (c) 2009 Braden McDaniel <braden@endoframe.com>
658-# Copyright (c) 2013 Bastien Roucaries <roucaries.bastien+autoconf@gmail.com>
659-# Copyright (c) 2016 Felix Chern <idryman@gmail.com>
660-#
661-# This program is free software; you can redistribute it and/or modify it
662-# under the terms of the GNU General Public License as published by the
663-# Free Software Foundation; either version 2 of the License, or (at your
664-# option) any later version.
665-#
666-# This program is distributed in the hope that it will be useful, but
667-# WITHOUT ANY WARRANTY; without even the implied warranty of
668-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
669-# Public License for more details.
670-#
671-# You should have received a copy of the GNU General Public License along
672-# with this program. If not, see <https://www.gnu.org/licenses/>.
673-#
674-# As a special exception, the respective Autoconf Macro's copyright owner
675-# gives unlimited permission to copy, distribute and modify the configure
676-# scripts that are the output of Autoconf when processing the Macro. You
677-# need not follow the terms of the GNU General Public License when using
678-# or distributing such scripts, even though portions of the text of the
679-# Macro appear in them. The GNU General Public License (GPL) does govern
680-# all other use of the material that constitutes the Autoconf Macro.
681-#
682-# This special exception to the GPL applies to versions of the Autoconf
683-# Macro released by the Autoconf Archive. When you make and distribute a
684-# modified version of the Autoconf Macro, you may extend this special
685-# exception to the GPL to apply to your modified version as well.
686-
687-#serial 17
688-
689-AC_DEFUN([_AX_CHECK_GLUT_SAVE_FLAGS], [
690- AX_SAVE_FLAGS_WITH_PREFIX([GLUT],[$1]) dnl defined in ax_check_gl
691- AC_LANG_PUSH([C])
692-])
693-
694-AC_DEFUN([_AX_CHECK_GLUT_RESTORE_FLAGS], [
695- AX_RESTORE_FLAGS_WITH_PREFIX([GLUT],[$1]) dnl defined in ax_check_gl
696- AC_LANG_POP([C])
697-])
698-
699-dnl Default include : add windows.h
700-dnl see http://www.opengl.org/wiki/Platform_specifics:_Windows
701-dnl (acceded 20120801)
702-AC_DEFUN([_AX_CHECK_GLUT_INCLUDES_DEFAULT],dnl
703-[
704- AC_INCLUDES_DEFAULT
705- [
706- # if defined(HAVE_WINDOWS_H) && defined(_WIN32)
707- # include <windows.h>
708- # endif
709- ]
710-])
711-
712-m4_define([_AX_CHECK_GLUT_PROGRAM],
713- [AC_LANG_PROGRAM([[
714-# if HAVE_WINDOWS_H && defined(_WIN32)
715-# include <windows.h>
716-# endif
717-# ifdef HAVE_GL_GLUT_H
718-# include <GL/glut.h>
719-# elif defined(HAVE_GLUT_GLUT_H)
720-# include <GLUT/glut.h>
721-# else
722-# error no glut.h
723-# endif]],
724-[[glutMainLoop()]])])
725-
726-
727-# _AX_CHECK_GLUT_MANUAL_LIBS_GENERIC(LIST-OF-LIBS)
728-# ------------------------------------------------
729-# Searches libraries provided in $1, and export variable
730-# $ax_check_glut_lib_glut
731-AC_DEFUN([_AX_CHECK_GLUT_MANUAL_LIBS_GENERIC],
732-[
733- _AX_CHECK_GLUT_SAVE_FLAGS([[CFLAGS],[LIBS]])
734- AC_SEARCH_LIBS([glutMainLoop],[$1],
735- [GLUT_LIBS="${GLUT_LIBS:-$ac_cv_search_glutMainLoop}"])
736- _AX_CHECK_GLUT_RESTORE_FLAGS([[CFLAGS],[LIBS]])
737-])
738-
739-# Wrapper macro to check GLUT header
740-AC_DEFUN([_AX_CHECK_GLUT_HEADER],[
741- _AX_CHECK_GLUT_SAVE_FLAGS([CFLAGS])
742- AC_CHECK_HEADERS([$1],
743- [ax_check_glut_have_headers=yes])
744- _AX_CHECK_GLUT_RESTORE_FLAGS([CFLAGS])
745-])
746-
747-
748-# AX_CHECK_GLUT_LIB([ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
749-# ---------------------------------------------------------
750-# Checks GLUT headers and library and provides hooks for success and failures.
751-AC_DEFUN([AX_CHECK_GLUT],
752-[AC_REQUIRE([AC_CANONICAL_HOST])
753- AC_REQUIRE([_WITH_XQUARTZ_GL])
754- AC_ARG_VAR([GLUT_CFLAGS],[C compiler flags for GLUT, overriding configure script defaults])
755- AC_ARG_VAR([GLUT_LIBS],[Linker flags for GLUT, overriding configure script defaults])
756-
757- AS_CASE([${host}],
758- [*-darwin*],[AS_IF([test "x$with_xquartz_gl" != "xno"],
759- [GLUT_LIBS="${GLUT_LIBS:--lGLUT}"],
760- [GLUT_LIBS="${GLUT_LIBS:--framework GLUT}"])],
761- [*-cygwin*|*-mingw*],[
762- _AX_CHECK_GLUT_MANUAL_LIBS_GENERIC([glut32 glut])
763- AC_CHECK_HEADERS([windows.h])
764- ],
765- [_AX_CHECK_GLUT_MANUAL_LIBS_GENERIC([glut])
766- ]) dnl host specific checks
767-
768- dnl checks header
769- AS_CASE([${host}],
770- [*-darwin*],[AS_IF([test "x$with_xquartz_gl" = "xno"],
771- [_AX_CHECK_GLUT_HEADER([GLUT/glut.h])],
772- [_AX_CHECK_GLUT_HEADER([GL/glut.h])]
773- )],
774- [_AX_CHECK_GLUT_HEADER([GL/glut.h])])
775-
776- dnl compile
777- AS_IF([test "X$ax_check_glut_have_headers" = "Xyes"],
778- [AC_CACHE_CHECK([for compiling a minimal GLUT program],
779- [ax_cv_check_glut_compile],
780- [_AX_CHECK_GLUT_SAVE_FLAGS([CFLAGS])
781- AC_COMPILE_IFELSE([_AX_CHECK_GLUT_PROGRAM],
782- [ax_cv_check_glut_compile="yes"],
783- [ax_cv_check_glut_compile="no"])
784- _AX_CHECK_GLUT_RESTORE_FLAGS([CFLAGS])
785- ])
786- ])
787-
788- dnl link
789- AS_IF([test "X$ax_cv_check_glut_compile" = "Xyes"],
790- [AC_CACHE_CHECK([for linking a minimal GLUT program],
791- [ax_cv_check_glut_link],
792- [_AX_CHECK_GLUT_SAVE_FLAGS([[CFLAGS],[LIBS]])
793- AC_LINK_IFELSE([_AX_CHECK_GLUT_PROGRAM],
794- [ax_cv_check_glut_link="yes"],
795- [ax_cv_check_glut_link="no"])
796- _AX_CHECK_GLUT_RESTORE_FLAGS([[CFLAGS],[LIBS]])
797- ])
798- ])
799-
800- dnl hook
801- AS_IF([test "X$ax_cv_check_glut_link" = "Xyes"],
802- [AC_DEFINE([HAVE_GLUT], [1], [Defined if a valid GLUT implementation is found])
803- m4_ifval([$1],
804- [$1],
805- [CFLAGS="$GLUT_CFLAGS $CFLAGS"
806- LIBS="$GLUT_LIBS $LIBS"])
807- ],
808- [m4_ifval([$2],
809- [$2],
810- [AC_MSG_ERROR([Could not find a valid GLUT implementation])]
811- )
812- ])
813-
814-])
815-
816-# ===========================================================================
817606 # https://www.gnu.org/software/autoconf-archive/ax_openmp.html
818607 # ===========================================================================
819608 #
@@ -1353,6 +1142,1066 @@ AS_VAR_COPY([$1], [pkg_cv_][$1])
13531142 AS_VAR_IF([$1], [""], [$5], [$4])dnl
13541143 ])dnl PKG_CHECK_VAR
13551144
1145+dnl ---------------------------------------------------------------------------
1146+dnl Author: wxWidgets development team,
1147+dnl Francesco Montorsi,
1148+dnl Bob McCown (Mac-testing)
1149+dnl Creation date: 24/11/2001
1150+dnl ---------------------------------------------------------------------------
1151+
1152+dnl ===========================================================================
1153+dnl Table of Contents of this macro file:
1154+dnl -------------------------------------
1155+dnl
1156+dnl SECTION A: wxWidgets main macros
1157+dnl - WX_CONFIG_OPTIONS
1158+dnl - WX_CONFIG_CHECK
1159+dnl - WXRC_CHECK
1160+dnl - WX_STANDARD_OPTIONS
1161+dnl - WX_CONVERT_STANDARD_OPTIONS_TO_WXCONFIG_FLAGS
1162+dnl - WX_DETECT_STANDARD_OPTION_VALUES
1163+dnl
1164+dnl SECTION B: wxWidgets-related utilities
1165+dnl - WX_LIKE_LIBNAME
1166+dnl - WX_ARG_ENABLE_YESNOAUTO
1167+dnl - WX_ARG_WITH_YESNOAUTO
1168+dnl
1169+dnl SECTION C: messages to the user
1170+dnl - WX_STANDARD_OPTIONS_SUMMARY_MSG
1171+dnl - WX_STANDARD_OPTIONS_SUMMARY_MSG_BEGIN
1172+dnl - WX_STANDARD_OPTIONS_SUMMARY_MSG_END
1173+dnl - WX_BOOLOPT_SUMMARY
1174+dnl
1175+dnl The special "WX_DEBUG_CONFIGURE" variable can be set to 1 to enable extra
1176+dnl debug output on stdout from these macros.
1177+dnl ===========================================================================
1178+
1179+
1180+dnl ---------------------------------------------------------------------------
1181+dnl Macros for wxWidgets detection. Typically used in configure.in as:
1182+dnl
1183+dnl AC_ARG_ENABLE(...)
1184+dnl AC_ARG_WITH(...)
1185+dnl ...
1186+dnl WX_CONFIG_OPTIONS
1187+dnl ...
1188+dnl ...
1189+dnl WX_CONFIG_CHECK([2.6.0], [wxWin=1])
1190+dnl if test "$wxWin" != 1; then
1191+dnl AC_MSG_ERROR([
1192+dnl wxWidgets must be installed on your system
1193+dnl but wx-config script couldn't be found.
1194+dnl
1195+dnl Please check that wx-config is in path, the directory
1196+dnl where wxWidgets libraries are installed (returned by
1197+dnl 'wx-config --libs' command) is in LD_LIBRARY_PATH or
1198+dnl equivalent variable and wxWidgets version is 2.3.4 or above.
1199+dnl ])
1200+dnl fi
1201+dnl CPPFLAGS="$CPPFLAGS $WX_CPPFLAGS"
1202+dnl CXXFLAGS="$CXXFLAGS $WX_CXXFLAGS_ONLY"
1203+dnl CFLAGS="$CFLAGS $WX_CFLAGS_ONLY"
1204+dnl
1205+dnl LIBS="$LIBS $WX_LIBS"
1206+dnl
1207+dnl If you want to support standard --enable-debug/unicode/shared options, you
1208+dnl may do the following:
1209+dnl
1210+dnl ...
1211+dnl AC_CANONICAL_SYSTEM
1212+dnl
1213+dnl # define configure options
1214+dnl WX_CONFIG_OPTIONS
1215+dnl WX_STANDARD_OPTIONS([debug,unicode,shared,toolkit,wxshared])
1216+dnl
1217+dnl # basic configure checks
1218+dnl ...
1219+dnl
1220+dnl # we want to always have DEBUG==WX_DEBUG and UNICODE==WX_UNICODE
1221+dnl WX_DEBUG=$DEBUG
1222+dnl WX_UNICODE=$UNICODE
1223+dnl
1224+dnl WX_CONVERT_STANDARD_OPTIONS_TO_WXCONFIG_FLAGS
1225+dnl WX_CONFIG_CHECK([2.8.0], [wxWin=1],,[html,core,net,base],[$WXCONFIG_FLAGS])
1226+dnl WX_DETECT_STANDARD_OPTION_VALUES
1227+dnl
1228+dnl # write the output files
1229+dnl AC_CONFIG_FILES([Makefile ...])
1230+dnl AC_OUTPUT
1231+dnl
1232+dnl # optional: just to show a message to the user
1233+dnl WX_STANDARD_OPTIONS_SUMMARY_MSG
1234+dnl
1235+dnl ---------------------------------------------------------------------------
1236+
1237+
1238+dnl ---------------------------------------------------------------------------
1239+dnl WX_CONFIG_OPTIONS
1240+dnl
1241+dnl adds support for --wx-prefix, --wx-exec-prefix, --with-wxdir and
1242+dnl --wx-config command line options
1243+dnl ---------------------------------------------------------------------------
1244+
1245+AC_DEFUN([WX_CONFIG_OPTIONS],
1246+[
1247+ AC_ARG_WITH(wxdir,
1248+ [ --with-wxdir=PATH Use uninstalled version of wxWidgets in PATH],
1249+ [ wx_config_name="$withval/wx-config"
1250+ wx_config_args="--inplace"])
1251+ AC_ARG_WITH(wx-config,
1252+ [ --with-wx-config=CONFIG wx-config script to use (optional)],
1253+ wx_config_name="$withval" )
1254+ AC_ARG_WITH(wx-prefix,
1255+ [ --with-wx-prefix=PREFIX Prefix where wxWidgets is installed (optional)],
1256+ wx_config_prefix="$withval", wx_config_prefix="")
1257+ AC_ARG_WITH(wx-exec-prefix,
1258+ [ --with-wx-exec-prefix=PREFIX
1259+ Exec prefix where wxWidgets is installed (optional)],
1260+ wx_config_exec_prefix="$withval", wx_config_exec_prefix="")
1261+])
1262+
1263+dnl Helper macro for checking if wx version is at least $1.$2.$3, set's
1264+dnl wx_ver_ok=yes if it is:
1265+AC_DEFUN([_WX_PRIVATE_CHECK_VERSION],
1266+[
1267+ wx_ver_ok=""
1268+ if test "x$WX_VERSION" != x ; then
1269+ if test $wx_config_major_version -gt $1; then
1270+ wx_ver_ok=yes
1271+ else
1272+ if test $wx_config_major_version -eq $1; then
1273+ if test $wx_config_minor_version -gt $2; then
1274+ wx_ver_ok=yes
1275+ else
1276+ if test $wx_config_minor_version -eq $2; then
1277+ if test $wx_config_micro_version -ge $3; then
1278+ wx_ver_ok=yes
1279+ fi
1280+ fi
1281+ fi
1282+ fi
1283+ fi
1284+ fi
1285+])
1286+
1287+dnl ---------------------------------------------------------------------------
1288+dnl WX_CONFIG_CHECK(VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND
1289+dnl [, WX-LIBS [, ADDITIONAL-WX-CONFIG-FLAGS]]]])
1290+dnl
1291+dnl Test for wxWidgets, and define WX_C*FLAGS, WX_LIBS and WX_LIBS_STATIC
1292+dnl (the latter is for static linking against wxWidgets). Set WX_CONFIG_NAME
1293+dnl environment variable to override the default name of the wx-config script
1294+dnl to use. Set WX_CONFIG_PATH to specify the full path to wx-config - in this
1295+dnl case the macro won't even waste time on tests for its existence.
1296+dnl
1297+dnl Optional WX-LIBS argument contains comma- or space-separated list of
1298+dnl wxWidgets libraries to link against. If it is not specified then WX_LIBS
1299+dnl and WX_LIBS_STATIC will contain flags to link with all of the core
1300+dnl wxWidgets libraries.
1301+dnl
1302+dnl Optional ADDITIONAL-WX-CONFIG-FLAGS argument is appended to wx-config
1303+dnl invocation command in present. It can be used to fine-tune lookup of
1304+dnl best wxWidgets build available.
1305+dnl
1306+dnl Example use:
1307+dnl WX_CONFIG_CHECK([2.6.0], [wxWin=1], [wxWin=0], [html,core,net]
1308+dnl [--unicode --debug])
1309+dnl ---------------------------------------------------------------------------
1310+
1311+dnl
1312+dnl Get the cflags and libraries from the wx-config script
1313+dnl
1314+AC_DEFUN([WX_CONFIG_CHECK],
1315+[
1316+ dnl do we have wx-config name: it can be wx-config or wxd-config or ...
1317+ if test x${WX_CONFIG_NAME+set} != xset ; then
1318+ WX_CONFIG_NAME=wx-config
1319+ fi
1320+
1321+ if test "x$wx_config_name" != x ; then
1322+ WX_CONFIG_NAME="$wx_config_name"
1323+ fi
1324+
1325+ dnl deal with optional prefixes
1326+ if test x$wx_config_exec_prefix != x ; then
1327+ wx_config_args="$wx_config_args --exec-prefix=$wx_config_exec_prefix"
1328+ WX_LOOKUP_PATH="$wx_config_exec_prefix/bin"
1329+ fi
1330+ if test x$wx_config_prefix != x ; then
1331+ wx_config_args="$wx_config_args --prefix=$wx_config_prefix"
1332+ WX_LOOKUP_PATH="$WX_LOOKUP_PATH:$wx_config_prefix/bin"
1333+ fi
1334+ if test "$cross_compiling" = "yes"; then
1335+ wx_config_args="$wx_config_args --host=$host_alias"
1336+ fi
1337+
1338+ dnl don't search the PATH if WX_CONFIG_NAME is absolute filename
1339+ if test -x "$WX_CONFIG_NAME" ; then
1340+ AC_MSG_CHECKING(for wx-config)
1341+ WX_CONFIG_PATH="$WX_CONFIG_NAME"
1342+ AC_MSG_RESULT($WX_CONFIG_PATH)
1343+ else
1344+ AC_PATH_PROG(WX_CONFIG_PATH, $WX_CONFIG_NAME, no, "$WX_LOOKUP_PATH:$PATH")
1345+ fi
1346+
1347+ if test "$WX_CONFIG_PATH" != "no" ; then
1348+ WX_VERSION=""
1349+
1350+ min_wx_version=ifelse([$1], ,2.2.1,$1)
1351+ if test -z "$5" ; then
1352+ AC_MSG_CHECKING([for wxWidgets version >= $min_wx_version])
1353+ else
1354+ AC_MSG_CHECKING([for wxWidgets version >= $min_wx_version ($5)])
1355+ fi
1356+
1357+ dnl don't add the libraries ($4) to this variable as this would result in
1358+ dnl an error when it's used with --version below
1359+ WX_CONFIG_WITH_ARGS="$WX_CONFIG_PATH $wx_config_args $5"
1360+
1361+ WX_VERSION=`$WX_CONFIG_WITH_ARGS --version 2>/dev/null`
1362+ wx_config_major_version=`echo $WX_VERSION | \
1363+ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
1364+ wx_config_minor_version=`echo $WX_VERSION | \
1365+ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
1366+ wx_config_micro_version=`echo $WX_VERSION | \
1367+ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
1368+
1369+ wx_requested_major_version=`echo $min_wx_version | \
1370+ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
1371+ wx_requested_minor_version=`echo $min_wx_version | \
1372+ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
1373+ wx_requested_micro_version=`echo $min_wx_version | \
1374+ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
1375+
1376+ _WX_PRIVATE_CHECK_VERSION([$wx_requested_major_version],
1377+ [$wx_requested_minor_version],
1378+ [$wx_requested_micro_version])
1379+
1380+ if test -n "$wx_ver_ok"; then
1381+ AC_MSG_RESULT(yes (version $WX_VERSION))
1382+ WX_LIBS=`$WX_CONFIG_WITH_ARGS --libs $4`
1383+
1384+ dnl is this even still appropriate? --static is a real option now
1385+ dnl and WX_CONFIG_WITH_ARGS is likely to contain it if that is
1386+ dnl what the user actually wants, making this redundant at best.
1387+ dnl For now keep it in case anyone actually used it in the past.
1388+ AC_MSG_CHECKING([for wxWidgets static library])
1389+ WX_LIBS_STATIC=`$WX_CONFIG_WITH_ARGS --static --libs $4 2>/dev/null`
1390+ if test "x$WX_LIBS_STATIC" = "x"; then
1391+ AC_MSG_RESULT(no)
1392+ else
1393+ AC_MSG_RESULT(yes)
1394+ fi
1395+
1396+ dnl starting with version 2.2.6 wx-config has --cppflags argument
1397+ wx_has_cppflags=""
1398+ if test $wx_config_major_version -gt 2; then
1399+ wx_has_cppflags=yes
1400+ else
1401+ if test $wx_config_major_version -eq 2; then
1402+ if test $wx_config_minor_version -gt 2; then
1403+ wx_has_cppflags=yes
1404+ else
1405+ if test $wx_config_minor_version -eq 2; then
1406+ if test $wx_config_micro_version -ge 6; then
1407+ wx_has_cppflags=yes
1408+ fi
1409+ fi
1410+ fi
1411+ fi
1412+ fi
1413+
1414+ dnl starting with version 2.7.0 wx-config has --rescomp option
1415+ wx_has_rescomp=""
1416+ if test $wx_config_major_version -gt 2; then
1417+ wx_has_rescomp=yes
1418+ else
1419+ if test $wx_config_major_version -eq 2; then
1420+ if test $wx_config_minor_version -ge 7; then
1421+ wx_has_rescomp=yes
1422+ fi
1423+ fi
1424+ fi
1425+ if test "x$wx_has_rescomp" = x ; then
1426+ dnl cannot give any useful info for resource compiler
1427+ WX_RESCOMP=
1428+ else
1429+ WX_RESCOMP=`$WX_CONFIG_WITH_ARGS --rescomp`
1430+ fi
1431+
1432+ if test "x$wx_has_cppflags" = x ; then
1433+ dnl no choice but to define all flags like CFLAGS
1434+ WX_CFLAGS=`$WX_CONFIG_WITH_ARGS --cflags $4`
1435+ WX_CPPFLAGS=$WX_CFLAGS
1436+ WX_CXXFLAGS=$WX_CFLAGS
1437+
1438+ WX_CFLAGS_ONLY=$WX_CFLAGS
1439+ WX_CXXFLAGS_ONLY=$WX_CFLAGS
1440+ else
1441+ dnl we have CPPFLAGS included in CFLAGS included in CXXFLAGS
1442+ WX_CPPFLAGS=`$WX_CONFIG_WITH_ARGS --cppflags $4`
1443+ WX_CXXFLAGS=`$WX_CONFIG_WITH_ARGS --cxxflags $4`
1444+ WX_CFLAGS=`$WX_CONFIG_WITH_ARGS --cflags $4`
1445+
1446+ WX_CFLAGS_ONLY=`echo $WX_CFLAGS | sed "s@^$WX_CPPFLAGS *@@"`
1447+ WX_CXXFLAGS_ONLY=`echo $WX_CXXFLAGS | sed "s@^$WX_CFLAGS *@@"`
1448+ fi
1449+
1450+ ifelse([$2], , :, [$2])
1451+
1452+ else
1453+
1454+ if test "x$WX_VERSION" = x; then
1455+ dnl no wx-config at all
1456+ AC_MSG_RESULT(no)
1457+ else
1458+ AC_MSG_RESULT(no (version $WX_VERSION is not new enough))
1459+ fi
1460+
1461+ WX_CFLAGS=""
1462+ WX_CPPFLAGS=""
1463+ WX_CXXFLAGS=""
1464+ WX_LIBS=""
1465+ WX_LIBS_STATIC=""
1466+ WX_RESCOMP=""
1467+
1468+ if test ! -z "$5"; then
1469+
1470+ wx_error_message="
1471+ The configuration you asked for $PACKAGE_NAME requires a wxWidgets
1472+ build with the following settings:
1473+ $5
1474+ but such build is not available.
1475+
1476+ To see the wxWidgets builds available on this system, please use
1477+ 'wx-config --list' command. To use the default build, returned by
1478+ 'wx-config --selected-config', use the options with their 'auto'
1479+ default values."
1480+
1481+ fi
1482+
1483+ wx_error_message="
1484+ The requested wxWidgets build couldn't be found.
1485+ $wx_error_message
1486+
1487+ If you still get this error, then check that 'wx-config' is
1488+ in path, the directory where wxWidgets libraries are installed
1489+ (returned by 'wx-config --libs' command) is in LD_LIBRARY_PATH
1490+ or equivalent variable and wxWidgets version is $1 or above."
1491+
1492+ ifelse([$3], , AC_MSG_ERROR([$wx_error_message]), [$3])
1493+
1494+ fi
1495+ else
1496+
1497+ WX_CFLAGS=""
1498+ WX_CPPFLAGS=""
1499+ WX_CXXFLAGS=""
1500+ WX_LIBS=""
1501+ WX_LIBS_STATIC=""
1502+ WX_RESCOMP=""
1503+
1504+ ifelse([$3], , :, [$3])
1505+
1506+ fi
1507+
1508+ AC_SUBST(WX_CPPFLAGS)
1509+ AC_SUBST(WX_CFLAGS)
1510+ AC_SUBST(WX_CXXFLAGS)
1511+ AC_SUBST(WX_CFLAGS_ONLY)
1512+ AC_SUBST(WX_CXXFLAGS_ONLY)
1513+ AC_SUBST(WX_LIBS)
1514+ AC_SUBST(WX_LIBS_STATIC)
1515+ AC_SUBST(WX_VERSION)
1516+ AC_SUBST(WX_RESCOMP)
1517+
1518+ dnl need to export also WX_VERSION_MINOR and WX_VERSION_MAJOR symbols
1519+ dnl to support wxpresets bakefiles (we export also WX_VERSION_MICRO for completeness):
1520+ WX_VERSION_MAJOR="$wx_config_major_version"
1521+ WX_VERSION_MINOR="$wx_config_minor_version"
1522+ WX_VERSION_MICRO="$wx_config_micro_version"
1523+ AC_SUBST(WX_VERSION_MAJOR)
1524+ AC_SUBST(WX_VERSION_MINOR)
1525+ AC_SUBST(WX_VERSION_MICRO)
1526+])
1527+
1528+dnl ---------------------------------------------------------------------------
1529+dnl Get information on the wxrc program for making C++, Python and xrs
1530+dnl resource files.
1531+dnl
1532+dnl AC_ARG_ENABLE(...)
1533+dnl AC_ARG_WITH(...)
1534+dnl ...
1535+dnl WX_CONFIG_OPTIONS
1536+dnl ...
1537+dnl WX_CONFIG_CHECK(2.6.0, wxWin=1)
1538+dnl if test "$wxWin" != 1; then
1539+dnl AC_MSG_ERROR([
1540+dnl wxWidgets must be installed on your system
1541+dnl but wx-config script couldn't be found.
1542+dnl
1543+dnl Please check that wx-config is in path, the directory
1544+dnl where wxWidgets libraries are installed (returned by
1545+dnl 'wx-config --libs' command) is in LD_LIBRARY_PATH or
1546+dnl equivalent variable and wxWidgets version is 2.6.0 or above.
1547+dnl ])
1548+dnl fi
1549+dnl
1550+dnl WXRC_CHECK([HAVE_WXRC=1], [HAVE_WXRC=0])
1551+dnl if test "x$HAVE_WXRC" != x1; then
1552+dnl AC_MSG_ERROR([
1553+dnl The wxrc program was not installed or not found.
1554+dnl
1555+dnl Please check the wxWidgets installation.
1556+dnl ])
1557+dnl fi
1558+dnl
1559+dnl CPPFLAGS="$CPPFLAGS $WX_CPPFLAGS"
1560+dnl CXXFLAGS="$CXXFLAGS $WX_CXXFLAGS_ONLY"
1561+dnl CFLAGS="$CFLAGS $WX_CFLAGS_ONLY"
1562+dnl
1563+dnl LDFLAGS="$LDFLAGS $WX_LIBS"
1564+dnl ---------------------------------------------------------------------------
1565+
1566+dnl ---------------------------------------------------------------------------
1567+dnl WXRC_CHECK([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
1568+dnl
1569+dnl Test for wxWidgets' wxrc program for creating either C++, Python or XRS
1570+dnl resources. The variable WXRC will be set and substituted in the configure
1571+dnl script and Makefiles.
1572+dnl
1573+dnl Example use:
1574+dnl WXRC_CHECK([wxrc=1], [wxrc=0])
1575+dnl ---------------------------------------------------------------------------
1576+
1577+dnl
1578+dnl wxrc program from the wx-config script
1579+dnl
1580+AC_DEFUN([WXRC_CHECK],
1581+[
1582+ AC_ARG_VAR([WXRC], [Path to wxWidget's wxrc resource compiler])
1583+
1584+ if test "x$WX_CONFIG_NAME" = x; then
1585+ AC_MSG_ERROR([The wxrc tests must run after wxWidgets test.])
1586+ else
1587+
1588+ AC_MSG_CHECKING([for wxrc])
1589+
1590+ if test "x$WXRC" = x ; then
1591+ dnl wx-config --utility is a new addition to wxWidgets:
1592+ _WX_PRIVATE_CHECK_VERSION(2,5,3)
1593+ if test -n "$wx_ver_ok"; then
1594+ WXRC=`$WX_CONFIG_WITH_ARGS --utility=wxrc`
1595+ fi
1596+ fi
1597+
1598+ if test "x$WXRC" = x ; then
1599+ AC_MSG_RESULT([not found])
1600+ ifelse([$2], , :, [$2])
1601+ else
1602+ AC_MSG_RESULT([$WXRC])
1603+ ifelse([$1], , :, [$1])
1604+ fi
1605+
1606+ AC_SUBST(WXRC)
1607+ fi
1608+])
1609+
1610+dnl ---------------------------------------------------------------------------
1611+dnl WX_LIKE_LIBNAME([output-var] [prefix], [name])
1612+dnl
1613+dnl Sets the "output-var" variable to the name of a library named with same
1614+dnl wxWidgets rule.
1615+dnl E.g. for output-var=='lib', name=='test', prefix='mine', sets
1616+dnl the $lib variable to:
1617+dnl 'mine_gtk2ud_test-2.8'
1618+dnl if WX_PORT=gtk2, WX_UNICODE=1, WX_DEBUG=1 and WX_RELEASE=28
1619+dnl ---------------------------------------------------------------------------
1620+AC_DEFUN([WX_LIKE_LIBNAME],
1621+ [
1622+ wx_temp="$2""_""$WX_PORT"
1623+
1624+ dnl add the [u][d] string
1625+ if test "$WX_UNICODE" = "1"; then
1626+ wx_temp="$wx_temp""u"
1627+ fi
1628+ if test "$WX_DEBUG" = "1"; then
1629+ wx_temp="$wx_temp""d"
1630+ fi
1631+
1632+ dnl complete the name of the lib
1633+ wx_temp="$wx_temp""_""$3""-$WX_VERSION_MAJOR.$WX_VERSION_MINOR"
1634+
1635+ dnl save it in the user's variable
1636+ $1=$wx_temp
1637+ ])
1638+
1639+dnl ---------------------------------------------------------------------------
1640+dnl WX_ARG_ENABLE_YESNOAUTO/WX_ARG_WITH_YESNOAUTO
1641+dnl
1642+dnl Two little custom macros which define the ENABLE/WITH configure arguments.
1643+dnl Macro arguments:
1644+dnl $1 = the name of the --enable / --with feature
1645+dnl $2 = the name of the variable associated
1646+dnl $3 = the description of that feature
1647+dnl $4 = the default value for that feature
1648+dnl $5 = additional action to do in case option is given with "yes" value
1649+dnl ---------------------------------------------------------------------------
1650+AC_DEFUN([WX_ARG_ENABLE_YESNOAUTO],
1651+ [AC_ARG_ENABLE($1,
1652+ AC_HELP_STRING([--enable-$1], [$3 (default is $4)]),
1653+ [], [enableval="$4"])
1654+
1655+ dnl Show a message to the user about this option
1656+ AC_MSG_CHECKING([for the --enable-$1 option])
1657+ if test "$enableval" = "yes" ; then
1658+ AC_MSG_RESULT([yes])
1659+ $2=1
1660+ $5
1661+ elif test "$enableval" = "no" ; then
1662+ AC_MSG_RESULT([no])
1663+ $2=0
1664+ elif test "$enableval" = "auto" ; then
1665+ AC_MSG_RESULT([will be automatically detected])
1666+ $2="auto"
1667+ else
1668+ AC_MSG_ERROR([
1669+ Unrecognized option value (allowed values: yes, no, auto)
1670+ ])
1671+ fi
1672+ ])
1673+
1674+AC_DEFUN([WX_ARG_WITH_YESNOAUTO],
1675+ [AC_ARG_WITH($1,
1676+ AC_HELP_STRING([--with-$1], [$3 (default is $4)]),
1677+ [], [withval="$4"])
1678+
1679+ dnl Show a message to the user about this option
1680+ AC_MSG_CHECKING([for the --with-$1 option])
1681+ if test "$withval" = "yes" ; then
1682+ AC_MSG_RESULT([yes])
1683+ $2=1
1684+ $5
1685+ dnl NB: by default we don't allow --with-$1=no option
1686+ dnl since it does not make much sense !
1687+ elif test "$6" = "1" -a "$withval" = "no" ; then
1688+ AC_MSG_RESULT([no])
1689+ $2=0
1690+ elif test "$withval" = "auto" ; then
1691+ AC_MSG_RESULT([will be automatically detected])
1692+ $2="auto"
1693+ else
1694+ AC_MSG_ERROR([
1695+ Unrecognized option value (allowed values: yes, auto)
1696+ ])
1697+ fi
1698+ ])
1699+
1700+
1701+dnl ---------------------------------------------------------------------------
1702+dnl WX_STANDARD_OPTIONS([options-to-add])
1703+dnl
1704+dnl Adds to the configure script one or more of the following options:
1705+dnl --enable-[debug|unicode|shared|wxshared|wxdebug]
1706+dnl --with-[gtk|msw|motif|x11|mac|dfb]
1707+dnl --with-wxversion
1708+dnl Then checks for their presence and eventually set the DEBUG, UNICODE, SHARED,
1709+dnl PORT, WX_SHARED, WX_DEBUG, variables to one of the "yes", "no", "auto" values.
1710+dnl
1711+dnl Note that e.g. UNICODE != WX_UNICODE; the first is the value of the
1712+dnl --enable-unicode option (in boolean format) while the second indicates
1713+dnl if wxWidgets was built in Unicode mode (and still is in boolean format).
1714+dnl ---------------------------------------------------------------------------
1715+AC_DEFUN([WX_STANDARD_OPTIONS],
1716+ [
1717+
1718+ dnl the following lines will expand to WX_ARG_ENABLE_YESNOAUTO calls if and only if
1719+ dnl the $1 argument contains respectively the debug,unicode or shared options.
1720+
1721+ dnl be careful here not to set debug flag if only "wxdebug" was specified
1722+ ifelse(regexp([$1], [\bdebug]), [-1],,
1723+ [WX_ARG_ENABLE_YESNOAUTO([debug], [DEBUG], [Build in debug mode], [auto])])
1724+
1725+ ifelse(index([$1], [unicode]), [-1],,
1726+ [WX_ARG_ENABLE_YESNOAUTO([unicode], [UNICODE], [Build in Unicode mode], [auto])])
1727+
1728+ ifelse(regexp([$1], [\bshared]), [-1],,
1729+ [WX_ARG_ENABLE_YESNOAUTO([shared], [SHARED], [Build as shared library], [auto])])
1730+
1731+ dnl WX_ARG_WITH_YESNOAUTO cannot be used for --with-toolkit since it's an option
1732+ dnl which must be able to accept the auto|gtk1|gtk2|msw|... values
1733+ ifelse(index([$1], [toolkit]), [-1],,
1734+ [
1735+ AC_ARG_WITH([toolkit],
1736+ AC_HELP_STRING([--with-toolkit],
1737+ [Build against a specific wxWidgets toolkit (default is auto)]),
1738+ [], [withval="auto"])
1739+
1740+ dnl Show a message to the user about this option
1741+ AC_MSG_CHECKING([for the --with-toolkit option])
1742+ if test "$withval" = "auto" ; then
1743+ AC_MSG_RESULT([will be automatically detected])
1744+ TOOLKIT="auto"
1745+ else
1746+ TOOLKIT="$withval"
1747+
1748+ dnl PORT must be one of the allowed values
1749+ if test "$TOOLKIT" != "gtk1" -a "$TOOLKIT" != "gtk2" -a \
1750+ "$TOOLKIT" != "msw" -a "$TOOLKIT" != "motif" -a \
1751+ "$TOOLKIT" != "osx_carbon" -a "$TOOLKIT" != "osx_cocoa" -a \
1752+ "$TOOLKIT" != "dfb" -a "$TOOLKIT" != "x11"; then
1753+ AC_MSG_ERROR([
1754+ Unrecognized option value (allowed values: auto, gtk1, gtk2, msw, motif, osx_carbon, osx_cocoa, dfb, x11)
1755+ ])
1756+ fi
1757+
1758+ AC_MSG_RESULT([$TOOLKIT])
1759+ fi
1760+ ])
1761+
1762+ dnl ****** IMPORTANT *******
1763+ dnl Unlike for the UNICODE setting, you can build your program in
1764+ dnl shared mode against a static build of wxWidgets. Thus we have the
1765+ dnl following option which allows these mixtures. E.g.
1766+ dnl
1767+ dnl ./configure --disable-shared --with-wxshared
1768+ dnl
1769+ dnl will build your library in static mode against the first available
1770+ dnl shared build of wxWidgets.
1771+ dnl
1772+ dnl Note that's not possible to do the viceversa:
1773+ dnl
1774+ dnl ./configure --enable-shared --without-wxshared
1775+ dnl
1776+ dnl Doing so you would try to build your library in shared mode against a static
1777+ dnl build of wxWidgets. This is not possible (you would mix PIC and non PIC code) !
1778+ dnl A check for this combination of options is in WX_DETECT_STANDARD_OPTION_VALUES
1779+ dnl (where we know what 'auto' should be expanded to).
1780+ dnl
1781+ dnl If you try to build something in ANSI mode against a UNICODE build
1782+ dnl of wxWidgets or in RELEASE mode against a DEBUG build of wxWidgets,
1783+ dnl then at best you'll get ton of linking errors !
1784+ dnl ************************
1785+
1786+ ifelse(index([$1], [wxshared]), [-1],,
1787+ [
1788+ WX_ARG_WITH_YESNOAUTO(
1789+ [wxshared], [WX_SHARED],
1790+ [Force building against a shared build of wxWidgets, even if --disable-shared is given],
1791+ [auto], [], [1])
1792+ ])
1793+
1794+ dnl Just like for SHARED and WX_SHARED it may happen that some adventurous
1795+ dnl peoples will want to mix a wxWidgets release build with a debug build of
1796+ dnl his app/lib. So, we have both DEBUG and WX_DEBUG variables.
1797+ ifelse(index([$1], [wxdebug]), [-1],,
1798+ [
1799+ WX_ARG_WITH_YESNOAUTO(
1800+ [wxdebug], [WX_DEBUG],
1801+ [Force building against a debug build of wxWidgets, even if --disable-debug is given],
1802+ [auto], [], [1])
1803+ ])
1804+
1805+ dnl WX_ARG_WITH_YESNOAUTO cannot be used for --with-wxversion since it's an option
1806+ dnl which accepts the "auto|2.6|2.7|2.8|2.9|3.0" etc etc values
1807+ ifelse(index([$1], [wxversion]), [-1],,
1808+ [
1809+ AC_ARG_WITH([wxversion],
1810+ AC_HELP_STRING([--with-wxversion],
1811+ [Build against a specific version of wxWidgets (default is auto)]),
1812+ [], [withval="auto"])
1813+
1814+ dnl Show a message to the user about this option
1815+ AC_MSG_CHECKING([for the --with-wxversion option])
1816+ if test "$withval" = "auto" ; then
1817+ AC_MSG_RESULT([will be automatically detected])
1818+ WX_RELEASE="auto"
1819+ else
1820+
1821+ wx_requested_major_version=`echo $withval | \
1822+ sed 's/\([[0-9]]*\).\([[0-9]]*\).*/\1/'`
1823+ wx_requested_minor_version=`echo $withval | \
1824+ sed 's/\([[0-9]]*\).\([[0-9]]*\).*/\2/'`
1825+
1826+ dnl both vars above must be exactly 1 digit
1827+ if test "${#wx_requested_major_version}" != "1" -o \
1828+ "${#wx_requested_minor_version}" != "1" ; then
1829+ AC_MSG_ERROR([
1830+ Unrecognized option value (allowed values: auto, 2.6, 2.7, 2.8, 2.9, 3.0)
1831+ ])
1832+ fi
1833+
1834+ WX_RELEASE="$wx_requested_major_version"".""$wx_requested_minor_version"
1835+ AC_MSG_RESULT([$WX_RELEASE])
1836+ fi
1837+ ])
1838+
1839+ if test "$WX_DEBUG_CONFIGURE" = "1"; then
1840+ echo "[[dbg]] DEBUG: $DEBUG, WX_DEBUG: $WX_DEBUG"
1841+ echo "[[dbg]] UNICODE: $UNICODE, WX_UNICODE: $WX_UNICODE"
1842+ echo "[[dbg]] SHARED: $SHARED, WX_SHARED: $WX_SHARED"
1843+ echo "[[dbg]] TOOLKIT: $TOOLKIT, WX_TOOLKIT: $WX_TOOLKIT"
1844+ echo "[[dbg]] VERSION: $VERSION, WX_RELEASE: $WX_RELEASE"
1845+ fi
1846+ ])
1847+
1848+
1849+dnl ---------------------------------------------------------------------------
1850+dnl WX_CONVERT_STANDARD_OPTIONS_TO_WXCONFIG_FLAGS
1851+dnl
1852+dnl Sets the WXCONFIG_FLAGS string using the SHARED,DEBUG,UNICODE variable values
1853+dnl which are different from "auto".
1854+dnl Thus this macro needs to be called only once all options have been set.
1855+dnl ---------------------------------------------------------------------------
1856+AC_DEFUN([WX_CONVERT_STANDARD_OPTIONS_TO_WXCONFIG_FLAGS],
1857+ [
1858+ if test "$WX_SHARED" = "1" ; then
1859+ WXCONFIG_FLAGS="--static=no "
1860+ elif test "$WX_SHARED" = "0" ; then
1861+ WXCONFIG_FLAGS="--static=yes "
1862+ fi
1863+
1864+ if test "$WX_DEBUG" = "1" ; then
1865+ WXCONFIG_FLAGS="$WXCONFIG_FLAGS""--debug=yes "
1866+ elif test "$WX_DEBUG" = "0" ; then
1867+ WXCONFIG_FLAGS="$WXCONFIG_FLAGS""--debug=no "
1868+ fi
1869+
1870+ dnl The user should have set WX_UNICODE=UNICODE
1871+ if test "$WX_UNICODE" = "1" ; then
1872+ WXCONFIG_FLAGS="$WXCONFIG_FLAGS""--unicode=yes "
1873+ elif test "$WX_UNICODE" = "0" ; then
1874+ WXCONFIG_FLAGS="$WXCONFIG_FLAGS""--unicode=no "
1875+ fi
1876+
1877+ if test "$TOOLKIT" != "auto" ; then
1878+ WXCONFIG_FLAGS="$WXCONFIG_FLAGS""--toolkit=$TOOLKIT "
1879+ fi
1880+
1881+ if test "$WX_RELEASE" != "auto" ; then
1882+ WXCONFIG_FLAGS="$WXCONFIG_FLAGS""--version=$WX_RELEASE "
1883+ fi
1884+
1885+ dnl strip out the last space of the string
1886+ WXCONFIG_FLAGS=${WXCONFIG_FLAGS% }
1887+
1888+ if test "$WX_DEBUG_CONFIGURE" = "1"; then
1889+ echo "[[dbg]] WXCONFIG_FLAGS: $WXCONFIG_FLAGS"
1890+ fi
1891+ ])
1892+
1893+
1894+dnl ---------------------------------------------------------------------------
1895+dnl _WX_SELECTEDCONFIG_CHECKFOR([RESULTVAR], [STRING], [MSG]
1896+dnl [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
1897+dnl
1898+dnl Outputs the given MSG. Then searches the given STRING in the wxWidgets
1899+dnl additional CPP flags and put the result of the search in WX_$RESULTVAR
1900+dnl also adding the "yes" or "no" message result to MSG.
1901+dnl ---------------------------------------------------------------------------
1902+AC_DEFUN([_WX_SELECTEDCONFIG_CHECKFOR],
1903+ [
1904+ if test "$$1" = "auto" ; then
1905+
1906+ dnl The user does not have particular preferences for this option;
1907+ dnl so we will detect the wxWidgets relative build setting and use it
1908+ AC_MSG_CHECKING([$3])
1909+
1910+ dnl set WX_$1 variable to 1 if the $WX_SELECTEDCONFIG contains the $2
1911+ dnl string or to 0 otherwise.
1912+ dnl NOTE: 'expr match STRING REGEXP' cannot be used since on Mac it
1913+ dnl doesn't work; we use 'expr STRING : REGEXP' instead
1914+ WX_$1=$(expr "$WX_SELECTEDCONFIG" : ".*$2.*")
1915+
1916+ if test "$WX_$1" != "0"; then
1917+ WX_$1=1
1918+ AC_MSG_RESULT([yes])
1919+ ifelse([$4], , :, [$4])
1920+ else
1921+ WX_$1=0
1922+ AC_MSG_RESULT([no])
1923+ ifelse([$5], , :, [$5])
1924+ fi
1925+ else
1926+
1927+ dnl Use the setting given by the user
1928+ WX_$1=$$1
1929+ fi
1930+ ])
1931+
1932+dnl ---------------------------------------------------------------------------
1933+dnl WX_DETECT_STANDARD_OPTION_VALUES
1934+dnl
1935+dnl Detects the values of the following variables:
1936+dnl 1) WX_RELEASE
1937+dnl 2) WX_UNICODE
1938+dnl 3) WX_DEBUG
1939+dnl 4) WX_SHARED (and also WX_STATIC)
1940+dnl 5) WX_PORT
1941+dnl from the previously selected wxWidgets build; this macro in fact must be
1942+dnl called *after* calling the WX_CONFIG_CHECK macro.
1943+dnl
1944+dnl Note that the WX_VERSION_MAJOR, WX_VERSION_MINOR symbols are already set
1945+dnl by WX_CONFIG_CHECK macro
1946+dnl ---------------------------------------------------------------------------
1947+AC_DEFUN([WX_DETECT_STANDARD_OPTION_VALUES],
1948+ [
1949+ dnl IMPORTANT: WX_VERSION contains all three major.minor.micro digits,
1950+ dnl while WX_RELEASE only the major.minor ones.
1951+ WX_RELEASE="$WX_VERSION_MAJOR""$WX_VERSION_MINOR"
1952+ if test $WX_RELEASE -lt 26 ; then
1953+
1954+ AC_MSG_ERROR([
1955+ Cannot detect the wxWidgets configuration for the selected wxWidgets build
1956+ since its version is $WX_VERSION < 2.6.0; please install a newer
1957+ version of wxWidgets.
1958+ ])
1959+ fi
1960+
1961+ dnl The wx-config we are using understands the "--selected_config"
1962+ dnl option which returns an easy-parseable string !
1963+ WX_SELECTEDCONFIG=$($WX_CONFIG_WITH_ARGS --selected_config)
1964+
1965+ if test "$WX_DEBUG_CONFIGURE" = "1"; then
1966+ echo "[[dbg]] Using wx-config --selected-config"
1967+ echo "[[dbg]] WX_SELECTEDCONFIG: $WX_SELECTEDCONFIG"
1968+ fi
1969+
1970+
1971+ dnl we could test directly for WX_SHARED with a line like:
1972+ dnl _WX_SELECTEDCONFIG_CHECKFOR([SHARED], [shared],
1973+ dnl [if wxWidgets was built in SHARED mode])
1974+ dnl but wx-config --selected-config DOES NOT outputs the 'shared'
1975+ dnl word when wx was built in shared mode; it rather outputs the
1976+ dnl 'static' word when built in static mode.
1977+ if test $WX_SHARED = "1"; then
1978+ STATIC=0
1979+ elif test $WX_SHARED = "0"; then
1980+ STATIC=1
1981+ elif test $WX_SHARED = "auto"; then
1982+ STATIC="auto"
1983+ fi
1984+
1985+ dnl Now set the WX_UNICODE, WX_DEBUG, WX_STATIC variables
1986+ _WX_SELECTEDCONFIG_CHECKFOR([UNICODE], [unicode],
1987+ [if wxWidgets was built with UNICODE enabled])
1988+ _WX_SELECTEDCONFIG_CHECKFOR([DEBUG], [debug],
1989+ [if wxWidgets was built in DEBUG mode])
1990+ _WX_SELECTEDCONFIG_CHECKFOR([STATIC], [static],
1991+ [if wxWidgets was built in STATIC mode])
1992+
1993+ dnl init WX_SHARED from WX_STATIC
1994+ if test "$WX_STATIC" != "0"; then
1995+ WX_SHARED=0
1996+ else
1997+ WX_SHARED=1
1998+ fi
1999+
2000+ AC_SUBST(WX_UNICODE)
2001+ AC_SUBST(WX_DEBUG)
2002+ AC_SUBST(WX_SHARED)
2003+
2004+ dnl detect the WX_PORT to use
2005+ if test "$TOOLKIT" = "auto" ; then
2006+
2007+ dnl The user does not have particular preferences for this option;
2008+ dnl so we will detect the wxWidgets relative build setting and use it
2009+ AC_MSG_CHECKING([which wxWidgets toolkit was selected])
2010+
2011+ WX_GTKPORT1=$(expr "$WX_SELECTEDCONFIG" : ".*gtk1.*")
2012+ WX_GTKPORT2=$(expr "$WX_SELECTEDCONFIG" : ".*gtk2.*")
2013+ WX_MSWPORT=$(expr "$WX_SELECTEDCONFIG" : ".*msw.*")
2014+ WX_MOTIFPORT=$(expr "$WX_SELECTEDCONFIG" : ".*motif.*")
2015+ WX_OSXCOCOAPORT=$(expr "$WX_SELECTEDCONFIG" : ".*osx_cocoa.*")
2016+ WX_OSXCARBONPORT=$(expr "$WX_SELECTEDCONFIG" : ".*osx_carbon.*")
2017+ WX_X11PORT=$(expr "$WX_SELECTEDCONFIG" : ".*x11.*")
2018+ WX_DFBPORT=$(expr "$WX_SELECTEDCONFIG" : ".*dfb.*")
2019+
2020+ WX_PORT="unknown"
2021+ if test "$WX_GTKPORT1" != "0"; then WX_PORT="gtk1"; fi
2022+ if test "$WX_GTKPORT2" != "0"; then WX_PORT="gtk2"; fi
2023+ if test "$WX_MSWPORT" != "0"; then WX_PORT="msw"; fi
2024+ if test "$WX_MOTIFPORT" != "0"; then WX_PORT="motif"; fi
2025+ if test "$WX_OSXCOCOAPORT" != "0"; then WX_PORT="osx_cocoa"; fi
2026+ if test "$WX_OSXCARBONPORT" != "0"; then WX_PORT="osx_carbon"; fi
2027+ if test "$WX_X11PORT" != "0"; then WX_PORT="x11"; fi
2028+ if test "$WX_DFBPORT" != "0"; then WX_PORT="dfb"; fi
2029+
2030+ dnl NOTE: backward-compatible check for wx2.8; in wx2.9 the mac
2031+ dnl ports are called 'osx_cocoa' and 'osx_carbon' (see above)
2032+ WX_MACPORT=$(expr "$WX_SELECTEDCONFIG" : ".*mac.*")
2033+ if test "$WX_MACPORT" != "0"; then WX_PORT="mac"; fi
2034+
2035+ dnl check at least one of the WX_*PORT has been set !
2036+
2037+ if test "$WX_PORT" = "unknown" ; then
2038+ AC_MSG_ERROR([
2039+ Cannot detect the currently installed wxWidgets port !
2040+ Please check your 'wx-config --cxxflags'...
2041+ ])
2042+ fi
2043+
2044+ AC_MSG_RESULT([$WX_PORT])
2045+ else
2046+
2047+ dnl Use the setting given by the user
2048+ if test -z "$TOOLKIT" ; then
2049+ WX_PORT=$TOOLKIT
2050+ else
2051+ dnl try with PORT
2052+ WX_PORT=$PORT
2053+ fi
2054+ fi
2055+
2056+ AC_SUBST(WX_PORT)
2057+
2058+ if test "$WX_DEBUG_CONFIGURE" = "1"; then
2059+ echo "[[dbg]] Values of all WX_* options after final detection:"
2060+ echo "[[dbg]] WX_DEBUG: $WX_DEBUG"
2061+ echo "[[dbg]] WX_UNICODE: $WX_UNICODE"
2062+ echo "[[dbg]] WX_SHARED: $WX_SHARED"
2063+ echo "[[dbg]] WX_RELEASE: $WX_RELEASE"
2064+ echo "[[dbg]] WX_PORT: $WX_PORT"
2065+ fi
2066+
2067+ dnl Avoid problem described in the WX_STANDARD_OPTIONS which happens when
2068+ dnl the user gives the options:
2069+ dnl ./configure --enable-shared --without-wxshared
2070+ dnl or just do
2071+ dnl ./configure --enable-shared
2072+ dnl but there is only a static build of wxWidgets available.
2073+ if test "$WX_SHARED" = "0" -a "$SHARED" = "1"; then
2074+ AC_MSG_ERROR([
2075+ Cannot build shared library against a static build of wxWidgets !
2076+ This error happens because the wxWidgets build which was selected
2077+ has been detected as static while you asked to build $PACKAGE_NAME
2078+ as shared library and this is not possible.
2079+ Use the '--disable-shared' option to build $PACKAGE_NAME
2080+ as static library or '--with-wxshared' to use wxWidgets as shared library.
2081+ ])
2082+ fi
2083+
2084+ dnl now we can finally update the DEBUG,UNICODE,SHARED options
2085+ dnl to their final values if they were set to 'auto'
2086+ if test "$DEBUG" = "auto"; then
2087+ DEBUG=$WX_DEBUG
2088+ fi
2089+ if test "$UNICODE" = "auto"; then
2090+ UNICODE=$WX_UNICODE
2091+ fi
2092+ if test "$SHARED" = "auto"; then
2093+ SHARED=$WX_SHARED
2094+ fi
2095+ if test "$TOOLKIT" = "auto"; then
2096+ TOOLKIT=$WX_PORT
2097+ fi
2098+
2099+ dnl in case the user needs a BUILD=debug/release var...
2100+ if test "$DEBUG" = "1"; then
2101+ BUILD="debug"
2102+ elif test "$DEBUG" = "0" -o "$DEBUG" = ""; then
2103+ BUILD="release"
2104+ fi
2105+
2106+ dnl respect the DEBUG variable adding the optimize/debug flags
2107+ dnl NOTE: the CXXFLAGS are merged together with the CPPFLAGS so we
2108+ dnl don't need to set them, too
2109+ if test "$DEBUG" = "1"; then
2110+ CXXFLAGS="$CXXFLAGS -g -O0"
2111+ CFLAGS="$CFLAGS -g -O0"
2112+ else
2113+ CXXFLAGS="$CXXFLAGS -O2"
2114+ CFLAGS="$CFLAGS -O2"
2115+ fi
2116+ ])
2117+
2118+dnl ---------------------------------------------------------------------------
2119+dnl WX_BOOLOPT_SUMMARY([name of the boolean variable to show summary for],
2120+dnl [what to print when var is 1],
2121+dnl [what to print when var is 0])
2122+dnl
2123+dnl Prints $2 when variable $1 == 1 and prints $3 when variable $1 == 0.
2124+dnl This macro mainly exists just to make configure.ac scripts more readable.
2125+dnl
2126+dnl NOTE: you need to use the [" my message"] syntax for 2nd and 3rd arguments
2127+dnl if you want that m4 avoid to throw away the spaces prefixed to the
2128+dnl argument value.
2129+dnl ---------------------------------------------------------------------------
2130+AC_DEFUN([WX_BOOLOPT_SUMMARY],
2131+ [
2132+ if test "x$$1" = "x1" ; then
2133+ echo $2
2134+ elif test "x$$1" = "x0" ; then
2135+ echo $3
2136+ else
2137+ echo "$1 is $$1"
2138+ fi
2139+ ])
2140+
2141+dnl ---------------------------------------------------------------------------
2142+dnl WX_STANDARD_OPTIONS_SUMMARY_MSG
2143+dnl
2144+dnl Shows a summary message to the user about the WX_* variable contents.
2145+dnl This macro is used typically at the end of the configure script.
2146+dnl ---------------------------------------------------------------------------
2147+AC_DEFUN([WX_STANDARD_OPTIONS_SUMMARY_MSG],
2148+ [
2149+ echo
2150+ echo " The wxWidgets build which will be used by $PACKAGE_NAME $PACKAGE_VERSION"
2151+ echo " has the following settings:"
2152+ WX_BOOLOPT_SUMMARY([WX_DEBUG], [" - DEBUG build"], [" - RELEASE build"])
2153+ WX_BOOLOPT_SUMMARY([WX_UNICODE], [" - UNICODE mode"], [" - ANSI mode"])
2154+ WX_BOOLOPT_SUMMARY([WX_SHARED], [" - SHARED mode"], [" - STATIC mode"])
2155+ echo " - VERSION: $WX_VERSION"
2156+ echo " - PORT: $WX_PORT"
2157+ ])
2158+
2159+
2160+dnl ---------------------------------------------------------------------------
2161+dnl WX_STANDARD_OPTIONS_SUMMARY_MSG_BEGIN, WX_STANDARD_OPTIONS_SUMMARY_MSG_END
2162+dnl
2163+dnl Like WX_STANDARD_OPTIONS_SUMMARY_MSG macro but these two macros also gives info
2164+dnl about the configuration of the package which used the wxpresets.
2165+dnl
2166+dnl Typical usage:
2167+dnl WX_STANDARD_OPTIONS_SUMMARY_MSG_BEGIN
2168+dnl echo " - Package setting 1: $SETTING1"
2169+dnl echo " - Package setting 2: $SETTING1"
2170+dnl ...
2171+dnl WX_STANDARD_OPTIONS_SUMMARY_MSG_END
2172+dnl
2173+dnl ---------------------------------------------------------------------------
2174+AC_DEFUN([WX_STANDARD_OPTIONS_SUMMARY_MSG_BEGIN],
2175+ [
2176+ echo
2177+ echo " ----------------------------------------------------------------"
2178+ echo " Configuration for $PACKAGE_NAME $PACKAGE_VERSION successfully completed."
2179+ echo " Summary of main configuration settings for $PACKAGE_NAME:"
2180+ WX_BOOLOPT_SUMMARY([DEBUG], [" - DEBUG build"], [" - RELEASE build"])
2181+ WX_BOOLOPT_SUMMARY([UNICODE], [" - UNICODE mode"], [" - ANSI mode"])
2182+ WX_BOOLOPT_SUMMARY([SHARED], [" - SHARED mode"], [" - STATIC mode"])
2183+ ])
2184+
2185+AC_DEFUN([WX_STANDARD_OPTIONS_SUMMARY_MSG_END],
2186+ [
2187+ WX_STANDARD_OPTIONS_SUMMARY_MSG
2188+ echo
2189+ echo " Now, just run make."
2190+ echo " ----------------------------------------------------------------"
2191+ echo
2192+ ])
2193+
2194+
2195+dnl ---------------------------------------------------------------------------
2196+dnl Deprecated macro wrappers
2197+dnl ---------------------------------------------------------------------------
2198+
2199+AC_DEFUN([AM_OPTIONS_WXCONFIG], [WX_CONFIG_OPTIONS])
2200+AC_DEFUN([AM_PATH_WXCONFIG], [
2201+ WX_CONFIG_CHECK([$1],[$2],[$3],[$4],[$5])
2202+])
2203+AC_DEFUN([AM_PATH_WXRC], [WXRC_CHECK([$1],[$2])])
2204+
13562205 # Copyright (C) 2002-2017 Free Software Foundation, Inc.
13572206 #
13582207 # This file is free software; the Free Software Foundation
--- a/config.h.in
+++ b/config.h.in
@@ -6,15 +6,6 @@
66 /* Defined if a valid GLU implementation is found. */
77 #undef HAVE_GLU
88
9-/* Defined if a valid GLUT implementation is found */
10-#undef HAVE_GLUT
11-
12-/* Define to 1 if you have the <GLUT/glut.h> header file. */
13-#undef HAVE_GLUT_GLUT_H
14-
15-/* Define to 1 if you have the <GL/glut.h> header file. */
16-#undef HAVE_GL_GLUT_H
17-
189 /* Define to 1 if you have the <GL/glu.h> header file. */
1910 #undef HAVE_GL_GLU_H
2011
--- a/configure
+++ b/configure
@@ -625,8 +625,19 @@ ac_subst_vars='am__EXEEXT_FALSE
625625 am__EXEEXT_TRUE
626626 LTLIBOBJS
627627 LIBOBJS
628-GLUT_LIBS
629-GLUT_CFLAGS
628+WX_VERSION_MICRO
629+WX_VERSION_MINOR
630+WX_VERSION_MAJOR
631+WX_RESCOMP
632+WX_VERSION
633+WX_LIBS_STATIC
634+WX_LIBS
635+WX_CXXFLAGS_ONLY
636+WX_CFLAGS_ONLY
637+WX_CXXFLAGS
638+WX_CFLAGS
639+WX_CPPFLAGS
640+WX_CONFIG_PATH
630641 GLU_LIBS
631642 GLU_CFLAGS
632643 EGREP
@@ -741,6 +752,10 @@ enable_silent_rules
741752 enable_dependency_tracking
742753 with_openmp
743754 with_xquartz_gl
755+with_wxdir
756+with_wx_config
757+with_wx_prefix
758+with_wx_exec_prefix
744759 '
745760 ac_precious_vars='build_alias
746761 host_alias
@@ -760,9 +775,7 @@ GL_CFLAGS
760775 GL_LIBS
761776 CPP
762777 GLU_CFLAGS
763-GLU_LIBS
764-GLUT_CFLAGS
765-GLUT_LIBS'
778+GLU_LIBS'
766779
767780
768781 # Initialize some variables set by options.
@@ -1408,6 +1421,11 @@ Optional Packages:
14081421 instead of the built-in framework. If enabled, the
14091422 default location is [DIR=/opt/X11]. This option is
14101423 default to false.
1424+ --with-wxdir=PATH Use uninstalled version of wxWidgets in PATH
1425+ --with-wx-config=CONFIG wx-config script to use (optional)
1426+ --with-wx-prefix=PREFIX Prefix where wxWidgets is installed (optional)
1427+ --with-wx-exec-prefix=PREFIX
1428+ Exec prefix where wxWidgets is installed (optional)
14111429
14121430 Some influential environment variables:
14131431 CXX C++ compiler command
@@ -1429,8 +1447,6 @@ Some influential environment variables:
14291447 CPP C preprocessor
14301448 GLU_CFLAGS C compiler flags for GLU, overriding system check
14311449 GLU_LIBS Linker flags for GLU, overriding system check
1432- GLUT_CFLAGS C compiler flags for GLUT, overriding configure script defaults
1433- GLUT_LIBS Linker flags for GLUT, overriding configure script defaults
14341450
14351451 Use these variables to override the choices made by `configure' or to help
14361452 it to find libraries and programs with nonstandard names/locations.
@@ -4309,7 +4325,7 @@ fi
43094325
43104326 fi
43114327 echo ""
4312-echo " Check OpenGL and GLUT"
4328+echo " Check OpenGL"
43134329 echo ""
43144330 # Make sure we can run config.sub.
43154331 $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
@@ -6701,523 +6717,324 @@ else
67016717
67026718 fi
67036719
6720+CXXFLAGS="$CXXFLAGS $GL_CFLAGS $GLU_CFLAGS"
6721+LIBS="$LIBS $GLU_LIBS $GL_LIBS -lm"
6722+echo ""
6723+echo " Check wxWidgets"
6724+echo ""
67046725
67056726
6727+# Check whether --with-wxdir was given.
6728+if test "${with_wxdir+set}" = set; then :
6729+ withval=$with_wxdir; wx_config_name="$withval/wx-config"
6730+ wx_config_args="--inplace"
6731+fi
67066732
67076733
6708-
6709- case ${host} in #(
6710- *-darwin*) :
6711- if test "x$with_xquartz_gl" != "xno"; then :
6712- GLUT_LIBS="${GLUT_LIBS:--lGLUT}"
6713-else
6714- GLUT_LIBS="${GLUT_LIBS:--framework GLUT}"
6715-fi ;; #(
6716- *-cygwin*|*-mingw*) :
6717-
6718-
6719-
6720-
6721-
6722-_ax_glut_saved_flag_cflags="$CFLAGS"
6723-CFLAGS="$GLUT_CFLAGS $CFLAGS"
6724-
6725-
6726-_ax_glut_saved_flag_libs="$LIBS"
6727-LIBS="$GLUT_LIBS $LIBS"
6728-
6729-
6730-
6731- ac_ext=c
6732-ac_cpp='$CPP $CPPFLAGS'
6733-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
6734-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
6735-ac_compiler_gnu=$ac_cv_c_compiler_gnu
6736-
6737-
6738- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing glutMainLoop" >&5
6739-$as_echo_n "checking for library containing glutMainLoop... " >&6; }
6740-if ${ac_cv_search_glutMainLoop+:} false; then :
6741- $as_echo_n "(cached) " >&6
6742-else
6743- ac_func_search_save_LIBS=$LIBS
6744-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
6745-/* end confdefs.h. */
6746-
6747-/* Override any GCC internal prototype to avoid an error.
6748- Use char because int might match the return type of a GCC
6749- builtin and then its argument prototype would still apply. */
6750-#ifdef __cplusplus
6751-extern "C"
6752-#endif
6753-char glutMainLoop ();
6754-int
6755-main ()
6756-{
6757-return glutMainLoop ();
6758- ;
6759- return 0;
6760-}
6761-_ACEOF
6762-for ac_lib in '' glut32 glut; do
6763- if test -z "$ac_lib"; then
6764- ac_res="none required"
6765- else
6766- ac_res=-l$ac_lib
6767- LIBS="-l$ac_lib $ac_func_search_save_LIBS"
6768- fi
6769- if ac_fn_c_try_link "$LINENO"; then :
6770- ac_cv_search_glutMainLoop=$ac_res
6771-fi
6772-rm -f core conftest.err conftest.$ac_objext \
6773- conftest$ac_exeext
6774- if ${ac_cv_search_glutMainLoop+:} false; then :
6775- break
6734+# Check whether --with-wx-config was given.
6735+if test "${with_wx_config+set}" = set; then :
6736+ withval=$with_wx_config; wx_config_name="$withval"
67766737 fi
6777-done
6778-if ${ac_cv_search_glutMainLoop+:} false; then :
67796738
6739+
6740+# Check whether --with-wx-prefix was given.
6741+if test "${with_wx_prefix+set}" = set; then :
6742+ withval=$with_wx_prefix; wx_config_prefix="$withval"
67806743 else
6781- ac_cv_search_glutMainLoop=no
6782-fi
6783-rm conftest.$ac_ext
6784-LIBS=$ac_func_search_save_LIBS
6785-fi
6786-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_glutMainLoop" >&5
6787-$as_echo "$ac_cv_search_glutMainLoop" >&6; }
6788-ac_res=$ac_cv_search_glutMainLoop
6789-if test "$ac_res" != no; then :
6790- test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
6791- GLUT_LIBS="${GLUT_LIBS:-$ac_cv_search_glutMainLoop}"
6744+ wx_config_prefix=""
67926745 fi
67936746
67946747
6795-
6796-
6797-CFLAGS="$_ax_glut_saved_flag_cflags"
6798-
6799-
6800-LIBS="$_ax_glut_saved_flag_libs"
6801-
6802-
6803-
6804-
6805- ac_ext=c
6806-ac_cpp='$CPP $CPPFLAGS'
6807-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
6808-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
6809-ac_compiler_gnu=$ac_cv_c_compiler_gnu
6810-
6811-
6812-
6813- for ac_header in windows.h
6814-do :
6815- ac_fn_c_check_header_mongrel "$LINENO" "windows.h" "ac_cv_header_windows_h" "$ac_includes_default"
6816-if test "x$ac_cv_header_windows_h" = xyes; then :
6817- cat >>confdefs.h <<_ACEOF
6818-#define HAVE_WINDOWS_H 1
6819-_ACEOF
6820-
6748+# Check whether --with-wx-exec-prefix was given.
6749+if test "${with_wx_exec_prefix+set}" = set; then :
6750+ withval=$with_wx_exec_prefix; wx_config_exec_prefix="$withval"
6751+else
6752+ wx_config_exec_prefix=""
68216753 fi
68226754
6823-done
6824-
6825- ;; #(
6826- *) :
6827-
6828-
6829-
68306755
6831-_ax_glut_saved_flag_cflags="$CFLAGS"
6832-CFLAGS="$GLUT_CFLAGS $CFLAGS"
6833-
6834-
6835-_ax_glut_saved_flag_libs="$LIBS"
6836-LIBS="$GLUT_LIBS $LIBS"
6756+reqwx=2.4.0
68376757
68386758
6759+ if test x${WX_CONFIG_NAME+set} != xset ; then
6760+ WX_CONFIG_NAME=wx-config
6761+ fi
68396762
6840- ac_ext=c
6841-ac_cpp='$CPP $CPPFLAGS'
6842-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
6843-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
6844-ac_compiler_gnu=$ac_cv_c_compiler_gnu
6763+ if test "x$wx_config_name" != x ; then
6764+ WX_CONFIG_NAME="$wx_config_name"
6765+ fi
68456766
6767+ if test x$wx_config_exec_prefix != x ; then
6768+ wx_config_args="$wx_config_args --exec-prefix=$wx_config_exec_prefix"
6769+ WX_LOOKUP_PATH="$wx_config_exec_prefix/bin"
6770+ fi
6771+ if test x$wx_config_prefix != x ; then
6772+ wx_config_args="$wx_config_args --prefix=$wx_config_prefix"
6773+ WX_LOOKUP_PATH="$WX_LOOKUP_PATH:$wx_config_prefix/bin"
6774+ fi
6775+ if test "$cross_compiling" = "yes"; then
6776+ wx_config_args="$wx_config_args --host=$host_alias"
6777+ fi
68466778
6847- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing glutMainLoop" >&5
6848-$as_echo_n "checking for library containing glutMainLoop... " >&6; }
6849-if ${ac_cv_search_glutMainLoop+:} false; then :
6779+ if test -x "$WX_CONFIG_NAME" ; then
6780+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for wx-config" >&5
6781+$as_echo_n "checking for wx-config... " >&6; }
6782+ WX_CONFIG_PATH="$WX_CONFIG_NAME"
6783+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $WX_CONFIG_PATH" >&5
6784+$as_echo "$WX_CONFIG_PATH" >&6; }
6785+ else
6786+ # Extract the first word of "$WX_CONFIG_NAME", so it can be a program name with args.
6787+set dummy $WX_CONFIG_NAME; ac_word=$2
6788+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
6789+$as_echo_n "checking for $ac_word... " >&6; }
6790+if ${ac_cv_path_WX_CONFIG_PATH+:} false; then :
68506791 $as_echo_n "(cached) " >&6
68516792 else
6852- ac_func_search_save_LIBS=$LIBS
6853-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
6854-/* end confdefs.h. */
6855-
6856-/* Override any GCC internal prototype to avoid an error.
6857- Use char because int might match the return type of a GCC
6858- builtin and then its argument prototype would still apply. */
6859-#ifdef __cplusplus
6860-extern "C"
6861-#endif
6862-char glutMainLoop ();
6863-int
6864-main ()
6865-{
6866-return glutMainLoop ();
6867- ;
6868- return 0;
6869-}
6870-_ACEOF
6871-for ac_lib in '' glut; do
6872- if test -z "$ac_lib"; then
6873- ac_res="none required"
6874- else
6875- ac_res=-l$ac_lib
6876- LIBS="-l$ac_lib $ac_func_search_save_LIBS"
6793+ case $WX_CONFIG_PATH in
6794+ [\\/]* | ?:[\\/]*)
6795+ ac_cv_path_WX_CONFIG_PATH="$WX_CONFIG_PATH" # Let the user override the test with a path.
6796+ ;;
6797+ *)
6798+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
6799+as_dummy=""$WX_LOOKUP_PATH:$PATH""
6800+for as_dir in $as_dummy
6801+do
6802+ IFS=$as_save_IFS
6803+ test -z "$as_dir" && as_dir=.
6804+ for ac_exec_ext in '' $ac_executable_extensions; do
6805+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
6806+ ac_cv_path_WX_CONFIG_PATH="$as_dir/$ac_word$ac_exec_ext"
6807+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
6808+ break 2
68776809 fi
6878- if ac_fn_c_try_link "$LINENO"; then :
6879- ac_cv_search_glutMainLoop=$ac_res
6880-fi
6881-rm -f core conftest.err conftest.$ac_objext \
6882- conftest$ac_exeext
6883- if ${ac_cv_search_glutMainLoop+:} false; then :
6884- break
6885-fi
68866810 done
6887-if ${ac_cv_search_glutMainLoop+:} false; then :
6888-
6889-else
6890- ac_cv_search_glutMainLoop=no
6891-fi
6892-rm conftest.$ac_ext
6893-LIBS=$ac_func_search_save_LIBS
6894-fi
6895-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_glutMainLoop" >&5
6896-$as_echo "$ac_cv_search_glutMainLoop" >&6; }
6897-ac_res=$ac_cv_search_glutMainLoop
6898-if test "$ac_res" != no; then :
6899- test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
6900- GLUT_LIBS="${GLUT_LIBS:-$ac_cv_search_glutMainLoop}"
6901-fi
6902-
6903-
6904-
6905-
6906-CFLAGS="$_ax_glut_saved_flag_cflags"
6907-
6908-
6909-LIBS="$_ax_glut_saved_flag_libs"
6910-
6911-
6912-
6913-
6914- ac_ext=c
6915-ac_cpp='$CPP $CPPFLAGS'
6916-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
6917-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
6918-ac_compiler_gnu=$ac_cv_c_compiler_gnu
6919-
6920-
6811+ done
6812+IFS=$as_save_IFS
69216813
6922- ;;
6814+ test -z "$ac_cv_path_WX_CONFIG_PATH" && ac_cv_path_WX_CONFIG_PATH="no"
6815+ ;;
69236816 esac
6924- case ${host} in #(
6925- *-darwin*) :
6926- if test "x$with_xquartz_gl" = "xno"; then :
6927-
6928-
6929-
6930-
6931-_ax_glut_saved_flag_cflags="$CFLAGS"
6932-CFLAGS="$GLUT_CFLAGS $CFLAGS"
6933-
6934-
6935- ac_ext=c
6936-ac_cpp='$CPP $CPPFLAGS'
6937-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
6938-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
6939-ac_compiler_gnu=$ac_cv_c_compiler_gnu
6940-
6941-
6942- for ac_header in GLUT/glut.h
6943-do :
6944- ac_fn_c_check_header_mongrel "$LINENO" "GLUT/glut.h" "ac_cv_header_GLUT_glut_h" "$ac_includes_default"
6945-if test "x$ac_cv_header_GLUT_glut_h" = xyes; then :
6946- cat >>confdefs.h <<_ACEOF
6947-#define HAVE_GLUT_GLUT_H 1
6948-_ACEOF
6949- ax_check_glut_have_headers=yes
69506817 fi
6951-
6952-done
6953-
6954-
6955-
6956-
6957-CFLAGS="$_ax_glut_saved_flag_cflags"
6958-
6959-
6960-
6961- ac_ext=c
6962-ac_cpp='$CPP $CPPFLAGS'
6963-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
6964-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
6965-ac_compiler_gnu=$ac_cv_c_compiler_gnu
6966-
6967-
6968-
6818+WX_CONFIG_PATH=$ac_cv_path_WX_CONFIG_PATH
6819+if test -n "$WX_CONFIG_PATH"; then
6820+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $WX_CONFIG_PATH" >&5
6821+$as_echo "$WX_CONFIG_PATH" >&6; }
69696822 else
6970-
6971-
6972-
6973-
6974-_ax_glut_saved_flag_cflags="$CFLAGS"
6975-CFLAGS="$GLUT_CFLAGS $CFLAGS"
6976-
6977-
6978- ac_ext=c
6979-ac_cpp='$CPP $CPPFLAGS'
6980-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
6981-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
6982-ac_compiler_gnu=$ac_cv_c_compiler_gnu
6983-
6984-
6985- for ac_header in GL/glut.h
6986-do :
6987- ac_fn_c_check_header_mongrel "$LINENO" "GL/glut.h" "ac_cv_header_GL_glut_h" "$ac_includes_default"
6988-if test "x$ac_cv_header_GL_glut_h" = xyes; then :
6989- cat >>confdefs.h <<_ACEOF
6990-#define HAVE_GL_GLUT_H 1
6991-_ACEOF
6992- ax_check_glut_have_headers=yes
6993-fi
6994-
6995-done
6996-
6997-
6998-
6999-
7000-CFLAGS="$_ax_glut_saved_flag_cflags"
7001-
7002-
7003-
7004- ac_ext=c
7005-ac_cpp='$CPP $CPPFLAGS'
7006-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
7007-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
7008-ac_compiler_gnu=$ac_cv_c_compiler_gnu
7009-
7010-
7011-
7012-
7013-fi ;; #(
7014- *) :
7015-
7016-
7017-
7018-
7019-_ax_glut_saved_flag_cflags="$CFLAGS"
7020-CFLAGS="$GLUT_CFLAGS $CFLAGS"
7021-
7022-
7023- ac_ext=c
7024-ac_cpp='$CPP $CPPFLAGS'
7025-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
7026-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
7027-ac_compiler_gnu=$ac_cv_c_compiler_gnu
7028-
7029-
7030- for ac_header in GL/glut.h
7031-do :
7032- ac_fn_c_check_header_mongrel "$LINENO" "GL/glut.h" "ac_cv_header_GL_glut_h" "$ac_includes_default"
7033-if test "x$ac_cv_header_GL_glut_h" = xyes; then :
7034- cat >>confdefs.h <<_ACEOF
7035-#define HAVE_GL_GLUT_H 1
7036-_ACEOF
7037- ax_check_glut_have_headers=yes
6823+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
6824+$as_echo "no" >&6; }
70386825 fi
70396826
7040-done
7041-
7042-
7043-
7044-
7045-CFLAGS="$_ax_glut_saved_flag_cflags"
7046-
7047-
7048-
7049- ac_ext=c
7050-ac_cpp='$CPP $CPPFLAGS'
7051-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
7052-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
7053-ac_compiler_gnu=$ac_cv_c_compiler_gnu
7054-
7055-
7056- ;;
7057-esac
7058-
7059- if test "X$ax_check_glut_have_headers" = "Xyes"; then :
7060- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for compiling a minimal GLUT program" >&5
7061-$as_echo_n "checking for compiling a minimal GLUT program... " >&6; }
7062-if ${ax_cv_check_glut_compile+:} false; then :
7063- $as_echo_n "(cached) " >&6
7064-else
70656827
6828+ fi
70666829
6830+ if test "$WX_CONFIG_PATH" != "no" ; then
6831+ WX_VERSION=""
70676832
7068-_ax_glut_saved_flag_cflags="$CFLAGS"
7069-CFLAGS="$GLUT_CFLAGS $CFLAGS"
6833+ min_wx_version=$reqwx
6834+ if test -z "" ; then
6835+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for wxWidgets version >= $min_wx_version" >&5
6836+$as_echo_n "checking for wxWidgets version >= $min_wx_version... " >&6; }
6837+ else
6838+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for wxWidgets version >= $min_wx_version ()" >&5
6839+$as_echo_n "checking for wxWidgets version >= $min_wx_version ()... " >&6; }
6840+ fi
70706841
6842+ WX_CONFIG_WITH_ARGS="$WX_CONFIG_PATH $wx_config_args "
70716843
7072- ac_ext=c
7073-ac_cpp='$CPP $CPPFLAGS'
7074-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
7075-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
7076-ac_compiler_gnu=$ac_cv_c_compiler_gnu
6844+ WX_VERSION=`$WX_CONFIG_WITH_ARGS --version 2>/dev/null`
6845+ wx_config_major_version=`echo $WX_VERSION | \
6846+ sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\1/'`
6847+ wx_config_minor_version=`echo $WX_VERSION | \
6848+ sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\2/'`
6849+ wx_config_micro_version=`echo $WX_VERSION | \
6850+ sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\3/'`
70776851
6852+ wx_requested_major_version=`echo $min_wx_version | \
6853+ sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\1/'`
6854+ wx_requested_minor_version=`echo $min_wx_version | \
6855+ sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\2/'`
6856+ wx_requested_micro_version=`echo $min_wx_version | \
6857+ sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\3/'`
70786858
7079- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
7080-/* end confdefs.h. */
70816859
7082-# if HAVE_WINDOWS_H && defined(_WIN32)
7083-# include <windows.h>
7084-# endif
7085-# ifdef HAVE_GL_GLUT_H
7086-# include <GL/glut.h>
7087-# elif defined(HAVE_GLUT_GLUT_H)
7088-# include <GLUT/glut.h>
7089-# else
7090-# error no glut.h
7091-# endif
7092-int
7093-main ()
7094-{
7095-glutMainLoop()
7096- ;
7097- return 0;
7098-}
7099-_ACEOF
7100-if ac_fn_c_try_compile "$LINENO"; then :
7101- ax_cv_check_glut_compile="yes"
7102-else
7103- ax_cv_check_glut_compile="no"
7104-fi
7105-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
6860+ wx_ver_ok=""
6861+ if test "x$WX_VERSION" != x ; then
6862+ if test $wx_config_major_version -gt $wx_requested_major_version; then
6863+ wx_ver_ok=yes
6864+ else
6865+ if test $wx_config_major_version -eq $wx_requested_major_version; then
6866+ if test $wx_config_minor_version -gt $wx_requested_minor_version; then
6867+ wx_ver_ok=yes
6868+ else
6869+ if test $wx_config_minor_version -eq $wx_requested_minor_version; then
6870+ if test $wx_config_micro_version -ge $wx_requested_micro_version; then
6871+ wx_ver_ok=yes
6872+ fi
6873+ fi
6874+ fi
6875+ fi
6876+ fi
6877+ fi
71066878
71076879
6880+ if test -n "$wx_ver_ok"; then
6881+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes (version $WX_VERSION)" >&5
6882+$as_echo "yes (version $WX_VERSION)" >&6; }
6883+ WX_LIBS=`$WX_CONFIG_WITH_ARGS --libs std,gl`
71086884
7109-CFLAGS="$_ax_glut_saved_flag_cflags"
6885+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for wxWidgets static library" >&5
6886+$as_echo_n "checking for wxWidgets static library... " >&6; }
6887+ WX_LIBS_STATIC=`$WX_CONFIG_WITH_ARGS --static --libs std,gl 2>/dev/null`
6888+ if test "x$WX_LIBS_STATIC" = "x"; then
6889+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
6890+$as_echo "no" >&6; }
6891+ else
6892+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
6893+$as_echo "yes" >&6; }
6894+ fi
71106895
6896+ wx_has_cppflags=""
6897+ if test $wx_config_major_version -gt 2; then
6898+ wx_has_cppflags=yes
6899+ else
6900+ if test $wx_config_major_version -eq 2; then
6901+ if test $wx_config_minor_version -gt 2; then
6902+ wx_has_cppflags=yes
6903+ else
6904+ if test $wx_config_minor_version -eq 2; then
6905+ if test $wx_config_micro_version -ge 6; then
6906+ wx_has_cppflags=yes
6907+ fi
6908+ fi
6909+ fi
6910+ fi
6911+ fi
71116912
6913+ wx_has_rescomp=""
6914+ if test $wx_config_major_version -gt 2; then
6915+ wx_has_rescomp=yes
6916+ else
6917+ if test $wx_config_major_version -eq 2; then
6918+ if test $wx_config_minor_version -ge 7; then
6919+ wx_has_rescomp=yes
6920+ fi
6921+ fi
6922+ fi
6923+ if test "x$wx_has_rescomp" = x ; then
6924+ WX_RESCOMP=
6925+ else
6926+ WX_RESCOMP=`$WX_CONFIG_WITH_ARGS --rescomp`
6927+ fi
71126928
7113- ac_ext=c
7114-ac_cpp='$CPP $CPPFLAGS'
7115-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
7116-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
7117-ac_compiler_gnu=$ac_cv_c_compiler_gnu
6929+ if test "x$wx_has_cppflags" = x ; then
6930+ WX_CFLAGS=`$WX_CONFIG_WITH_ARGS --cflags std,gl`
6931+ WX_CPPFLAGS=$WX_CFLAGS
6932+ WX_CXXFLAGS=$WX_CFLAGS
71186933
6934+ WX_CFLAGS_ONLY=$WX_CFLAGS
6935+ WX_CXXFLAGS_ONLY=$WX_CFLAGS
6936+ else
6937+ WX_CPPFLAGS=`$WX_CONFIG_WITH_ARGS --cppflags std,gl`
6938+ WX_CXXFLAGS=`$WX_CONFIG_WITH_ARGS --cxxflags std,gl`
6939+ WX_CFLAGS=`$WX_CONFIG_WITH_ARGS --cflags std,gl`
71196940
6941+ WX_CFLAGS_ONLY=`echo $WX_CFLAGS | sed "s@^$WX_CPPFLAGS *@@"`
6942+ WX_CXXFLAGS_ONLY=`echo $WX_CXXFLAGS | sed "s@^$WX_CFLAGS *@@"`
6943+ fi
71206944
7121-fi
7122-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_glut_compile" >&5
7123-$as_echo "$ax_cv_check_glut_compile" >&6; }
6945+ wxWin=1
71246946
7125-fi
6947+ else
71266948
7127- if test "X$ax_cv_check_glut_compile" = "Xyes"; then :
7128- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for linking a minimal GLUT program" >&5
7129-$as_echo_n "checking for linking a minimal GLUT program... " >&6; }
7130-if ${ax_cv_check_glut_link+:} false; then :
7131- $as_echo_n "(cached) " >&6
7132-else
6949+ if test "x$WX_VERSION" = x; then
6950+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
6951+$as_echo "no" >&6; }
6952+ else
6953+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no (version $WX_VERSION is not new enough)" >&5
6954+$as_echo "no (version $WX_VERSION is not new enough)" >&6; }
6955+ fi
71336956
6957+ WX_CFLAGS=""
6958+ WX_CPPFLAGS=""
6959+ WX_CXXFLAGS=""
6960+ WX_LIBS=""
6961+ WX_LIBS_STATIC=""
6962+ WX_RESCOMP=""
71346963
6964+ if test ! -z ""; then
71356965
7136-_ax_glut_saved_flag_cflags="$CFLAGS"
7137-CFLAGS="$GLUT_CFLAGS $CFLAGS"
6966+ wx_error_message="
6967+ The configuration you asked for $PACKAGE_NAME requires a wxWidgets
6968+ build with the following settings:
71386969
6970+ but such build is not available.
71396971
7140-_ax_glut_saved_flag_libs="$LIBS"
7141-LIBS="$GLUT_LIBS $LIBS"
6972+ To see the wxWidgets builds available on this system, please use
6973+ 'wx-config --list' command. To use the default build, returned by
6974+ 'wx-config --selected-config', use the options with their 'auto'
6975+ default values."
71426976
6977+ fi
71436978
6979+ wx_error_message="
6980+ The requested wxWidgets build couldn't be found.
6981+ $wx_error_message
71446982
7145- ac_ext=c
7146-ac_cpp='$CPP $CPPFLAGS'
7147-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
7148-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
7149-ac_compiler_gnu=$ac_cv_c_compiler_gnu
6983+ If you still get this error, then check that 'wx-config' is
6984+ in path, the directory where wxWidgets libraries are installed
6985+ (returned by 'wx-config --libs' command) is in LD_LIBRARY_PATH
6986+ or equivalent variable and wxWidgets version is $reqwx or above."
71506987
6988+ as_fn_error $? "$wx_error_message" "$LINENO" 5
71516989
7152- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
7153-/* end confdefs.h. */
6990+ fi
6991+ else
71546992
7155-# if HAVE_WINDOWS_H && defined(_WIN32)
7156-# include <windows.h>
7157-# endif
7158-# ifdef HAVE_GL_GLUT_H
7159-# include <GL/glut.h>
7160-# elif defined(HAVE_GLUT_GLUT_H)
7161-# include <GLUT/glut.h>
7162-# else
7163-# error no glut.h
7164-# endif
7165-int
7166-main ()
7167-{
7168-glutMainLoop()
7169- ;
7170- return 0;
7171-}
7172-_ACEOF
7173-if ac_fn_c_try_link "$LINENO"; then :
7174- ax_cv_check_glut_link="yes"
7175-else
7176- ax_cv_check_glut_link="no"
7177-fi
7178-rm -f core conftest.err conftest.$ac_objext \
7179- conftest$ac_exeext conftest.$ac_ext
6993+ WX_CFLAGS=""
6994+ WX_CPPFLAGS=""
6995+ WX_CXXFLAGS=""
6996+ WX_LIBS=""
6997+ WX_LIBS_STATIC=""
6998+ WX_RESCOMP=""
71806999
7000+ :
71817001
7002+ fi
71827003
7183-CFLAGS="$_ax_glut_saved_flag_cflags"
71847004
71857005
7186-LIBS="$_ax_glut_saved_flag_libs"
71877006
71887007
71897008
71907009
7191- ac_ext=c
7192-ac_cpp='$CPP $CPPFLAGS'
7193-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
7194-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
7195-ac_compiler_gnu=$ac_cv_c_compiler_gnu
71967010
71977011
71987012
7199-fi
7200-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_glut_link" >&5
7201-$as_echo "$ax_cv_check_glut_link" >&6; }
72027013
7203-fi
7014+ WX_VERSION_MAJOR="$wx_config_major_version"
7015+ WX_VERSION_MINOR="$wx_config_minor_version"
7016+ WX_VERSION_MICRO="$wx_config_micro_version"
72047017
7205- if test "X$ax_cv_check_glut_link" = "Xyes"; then :
72067018
7207-$as_echo "#define HAVE_GLUT 1" >>confdefs.h
72087019
7209- CFLAGS="$GLUT_CFLAGS $CFLAGS"
7210- LIBS="$GLUT_LIBS $LIBS"
72117020
7212-else
7213- as_fn_error $? "Could not find a valid GLUT implementation" "$LINENO" 5
72147021
7022+if test "$wxWin" != 1; then
7023+ as_fn_error $? "
7024+ wxWidgets must be installed on your system.
72157025
7026+ Please check that wx-config is in path, the directory
7027+ where wxWidgets libraries are installed (returned by
7028+ 'wx-config --libs' or 'wx-config --static --libs' command)
7029+ is in LD_LIBRARY_PATH or equivalent variable and
7030+ wxWidgets version is $reqwx or above.
7031+ " "$LINENO" 5
72167032 fi
72177033
7218-
7219-CXXFLAGS="$CXXFLAGS $GL_CFLAGS $GLU_CFLAGS $GLUT_CFLAGS"
7220-LIBS="$LIBS $GLUT_LIBS $GLU_LIBS $GL_LIBS -lm"
7034+CPPFLAGS="$CPPFLAGS $WX_CPPFLAGS"
7035+CXXFLAGS="$CXXFLAGS $WX_CXXFLAGS_ONLY"
7036+CFLAGS="$CFLAGS $WX_CFLAGS_ONLY"
7037+LIBS="$LIBS $WX_LIBS"
72217038 echo ""
72227039 echo " Output files"
72237040 echo ""
--- a/configure.ac
+++ b/configure.ac
@@ -21,13 +21,34 @@ if test x"$with_openmp" != xno; then
2121 ])
2222 fi
2323 echo ""
24-echo " Check OpenGL and GLUT"
24+echo " Check OpenGL"
2525 echo ""
2626 AX_CHECK_GL
2727 AX_CHECK_GLU
28-AX_CHECK_GLUT
29-CXXFLAGS="$CXXFLAGS $GL_CFLAGS $GLU_CFLAGS $GLUT_CFLAGS"
30-LIBS="$LIBS $GLUT_LIBS $GLU_LIBS $GL_LIBS -lm"
28+CXXFLAGS="$CXXFLAGS $GL_CFLAGS $GLU_CFLAGS"
29+LIBS="$LIBS $GLU_LIBS $GL_LIBS -lm"
30+echo ""
31+echo " Check wxWidgets"
32+echo ""
33+AM_OPTIONS_WXCONFIG
34+reqwx=2.4.0
35+AM_PATH_WXCONFIG($reqwx, wxWin=1,,[std,gl])
36+if test "$wxWin" != 1; then
37+ AC_MSG_ERROR([
38+ wxWidgets must be installed on your system.
39+
40+ Please check that wx-config is in path, the directory
41+ where wxWidgets libraries are installed (returned by
42+ 'wx-config --libs' or 'wx-config --static --libs' command)
43+ is in LD_LIBRARY_PATH or equivalent variable and
44+ wxWidgets version is $reqwx or above.
45+ ])
46+fi
47+
48+CPPFLAGS="$CPPFLAGS $WX_CPPFLAGS"
49+CXXFLAGS="$CXXFLAGS $WX_CXXFLAGS_ONLY"
50+CFLAGS="$CFLAGS $WX_CFLAGS_ONLY"
51+LIBS="$LIBS $WX_LIBS"
3152 echo ""
3253 echo " Output files"
3354 echo ""
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -204,8 +204,6 @@ ECHO_N = @ECHO_N@
204204 ECHO_T = @ECHO_T@
205205 EGREP = @EGREP@
206206 EXEEXT = @EXEEXT@
207-GLUT_CFLAGS = @GLUT_CFLAGS@
208-GLUT_LIBS = @GLUT_LIBS@
209207 GLU_CFLAGS = @GLU_CFLAGS@
210208 GLU_LIBS = @GLU_LIBS@
211209 GL_CFLAGS = @GL_CFLAGS@
@@ -238,6 +236,19 @@ SET_MAKE = @SET_MAKE@
238236 SHELL = @SHELL@
239237 STRIP = @STRIP@
240238 VERSION = @VERSION@
239+WX_CFLAGS = @WX_CFLAGS@
240+WX_CFLAGS_ONLY = @WX_CFLAGS_ONLY@
241+WX_CONFIG_PATH = @WX_CONFIG_PATH@
242+WX_CPPFLAGS = @WX_CPPFLAGS@
243+WX_CXXFLAGS = @WX_CXXFLAGS@
244+WX_CXXFLAGS_ONLY = @WX_CXXFLAGS_ONLY@
245+WX_LIBS = @WX_LIBS@
246+WX_LIBS_STATIC = @WX_LIBS_STATIC@
247+WX_RESCOMP = @WX_RESCOMP@
248+WX_VERSION = @WX_VERSION@
249+WX_VERSION_MAJOR = @WX_VERSION_MAJOR@
250+WX_VERSION_MICRO = @WX_VERSION_MICRO@
251+WX_VERSION_MINOR = @WX_VERSION_MINOR@
241252 abs_builddir = @abs_builddir@
242253 abs_srcdir = @abs_srcdir@
243254 abs_top_builddir = @abs_top_builddir@
--- a/src/basic_math.cpp
+++ b/src/basic_math.cpp
@@ -27,9 +27,6 @@ THE SOFTWARE.
2727 #if defined(HAVE_CONFIG_H)
2828 #include <config.h>
2929 #endif
30-#if defined(WIN32)
31-#include <Windows.h>
32-#endif
3330 #if defined(HAVE_GL_GL_H)
3431 #include <GL/gl.h>
3532 #elif defined(HAVE_OPENGL_GL_H)
--- a/src/basic_math.hpp
+++ b/src/basic_math.hpp
@@ -24,9 +24,6 @@ THE SOFTWARE.
2424 #if defined(HAVE_CONFIG_H)
2525 #include <config.h>
2626 #endif
27-#if defined(WIN32)
28-#include <Windows.h>
29-#endif
3027 #if defined(HAVE_GL_GL_H)
3128 #include <GL/gl.h>
3229 #elif defined(HAVE_OPENGL_GL_H)
--- a/src/bz_lines.cpp
+++ b/src/bz_lines.cpp
@@ -27,9 +27,6 @@ THE SOFTWARE.
2727 #if defined(HAVE_CONFIG_H)
2828 #include <config.h>
2929 #endif
30-#if defined(WIN32)
31-#include <Windows.h>
32-#endif
3330 #if defined(HAVE_GL_GL_H)
3431 #include <GL/gl.h>
3532 #elif defined(HAVE_OPENGL_GL_H)
--- a/src/calc_nodeline.cpp
+++ b/src/calc_nodeline.cpp
@@ -27,9 +27,6 @@ THE SOFTWARE.
2727 #if defined(HAVE_CONFIG_H)
2828 #include <config.h>
2929 #endif
30-#if defined(WIN32)
31-#include <Windows.h>
32-#endif
3330 #if defined(HAVE_GL_GL_H)
3431 #include <GL/gl.h>
3532 #elif defined(HAVE_OPENGL_GL_H)
--- a/src/draw.cpp
+++ b/src/draw.cpp
@@ -24,18 +24,21 @@ THE SOFTWARE.
2424 /**@file
2525 @brief Functions for actual displaying
2626 */
27+#include "wx/wx.h"
28+#include "wx/glcanvas.h"
2729 #if defined(HAVE_CONFIG_H)
2830 #include <config.h>
2931 #endif
30-#if defined(HAVE_GL_GLUT_H)
31-#include <GL/glut.h>
32-#elif defined(HAVE_GLUT_GLUT_H)
33-#include <GLUT/glut.h>
32+#if defined(HAVE_GL_GL_H)
33+#include <GL/gl.h>
34+#elif defined(HAVE_OPENGL_GL_H)
35+#include <OpenGL/gl.h>
3436 #endif
3537 #include <math.h>
3638 #include <stdio.h>
3739 #include <stdlib.h>
3840 #include "variable.hpp"
41+#include "operation.hpp"
3942 /**
4043 @brief Draw Fermi surfaces
4144
@@ -487,7 +490,7 @@ static void draw_fermi_line() {
487490 @brief Glut Display function
488491 called by glutDisplayFunc
489492 */
490-void display(void)
493+void TestGLCanvas::OnPaint(wxPaintEvent& WXUNUSED(event))
491494 {
492495 GLfloat pos[] = { 1.0f, 1.0f, 1.0f, 0.0f };
493496 GLfloat amb[] = { 0.2f, 0.2f, 0.2f, 0.0f };
@@ -496,6 +499,14 @@ void display(void)
496499 int ierr;
497500 char command_name[256];
498501
502+ // This is a dummy, to avoid an endless succession of paint messages.
503+ // OnPaint handlers must always create a wxPaintDC.
504+ wxPaintDC dc(this);
505+
506+ // This is normally only necessary if there is more than one wxGLCanvas
507+ // or more than one wxGLContext in the application.
508+ SetCurrent(*m_glRC);
509+
499510 if (lstereo == 2) {
500511 /*
501512 Parallel eyes
@@ -617,10 +628,12 @@ void display(void)
617628 /**/
618629 glPopMatrix();
619630 }/*if (lsection == 1)*/
620- glutSwapBuffers();
631+ glFlush(); // Not really necessary: buffer swapping below implies glFlush()
632+ SwapBuffers();
621633 if (lbatch == 1) {
622634 glFlush();
623- sprintf(command_name, "import -window \"%s\" %s.png", window_name, batch_name);
635+ sprintf(command_name, "import -window \"%s\" %s.png",
636+ window_name.mb_str(), batch_name.mb_str());
624637 ierr = system(command_name);
625638 exit(0);
626639 }
--- a/src/equator.cpp
+++ b/src/equator.cpp
@@ -27,9 +27,6 @@ THE SOFTWARE.
2727 #if defined(HAVE_CONFIG_H)
2828 #include <config.h>
2929 #endif
30-#if defined(WIN32)
31-#include <Windows.h>
32-#endif
3330 #if defined(HAVE_GL_GL_H)
3431 #include <GL/gl.h>
3532 #elif defined(HAVE_OPENGL_GL_H)
--- a/src/fermi_patch.cpp
+++ b/src/fermi_patch.cpp
@@ -27,9 +27,6 @@ THE SOFTWARE.
2727 #if defined(HAVE_CONFIG_H)
2828 #include <config.h>
2929 #endif
30-#if defined(WIN32)
31-#include <Windows.h>
32-#endif
3330 #if defined(HAVE_GL_GL_H)
3431 #include <GL/gl.h>
3532 #elif defined(HAVE_OPENGL_GL_H)
--- a/src/fermisurfer.cpp
+++ b/src/fermisurfer.cpp
@@ -55,10 +55,10 @@ with a color-plot of the arbitraly matrix element
5555 #if defined(HAVE_CONFIG_H)
5656 #include <config.h>
5757 #endif
58-#if defined(HAVE_GL_GLUT_H)
59-#include <GL/glut.h>
60-#elif defined(HAVE_GLUT_GLUT_H)
61-#include <GLUT/glut.h>
58+#if defined(HAVE_GL_GL_H)
59+#include <GL/gl.h>
60+#elif defined(HAVE_OPENGL_GL_H)
61+#include <OpenGL/gl.h>
6262 #endif
6363 #include <stdlib.h>
6464 #include <stdio.h>
@@ -78,6 +78,19 @@ with a color-plot of the arbitraly matrix element
7878 #if defined(_OPENMP)
7979 #include <omp.h>
8080 #endif
81+#include <wx/wx.h>
82+#include "wx/cmdline.h"
83+
84+class MyApp : public wxApp
85+{
86+public:
87+ virtual bool OnInit();
88+ virtual void OnInitCmdLine(wxCmdLineParser& parser);
89+ virtual bool OnCmdLineParsed(wxCmdLineParser& parser);
90+};
91+
92+IMPLEMENT_APP(MyApp)
93+
8194 /*
8295 Input variables
8396 */
@@ -209,29 +222,11 @@ int nthreads;//!< Number of OpenMP threads
209222 /*
210223 Batch mode
211224 */
212-char *window_name;
213-char *batch_name;
225+wxString window_name;
226+wxString batch_name;
227+wxString frmsf_file_name;
214228 int lbatch;
215229 /**
216- @brief Initialize GLUT canvas
217-*/
218-void init(void)
219-{
220- glClearColor(0.0, 0.0, 0.0, 0.0);
221- glEnable(GL_DEPTH_TEST);
222- glEnable(GL_LIGHTING);
223- glLightModelf(GL_LIGHT_MODEL_TWO_SIDE,GL_TRUE );
224- glEnable(GL_LIGHT0);
225- glEnable(GL_LIGHT1);
226- glEnable(GL_NORMALIZE);
227- glEnableClientState(GL_VERTEX_ARRAY);
228- glEnableClientState(GL_NORMAL_ARRAY);
229- glEnableClientState(GL_COLOR_ARRAY);
230- glEnable(GL_COLOR_MATERIAL);
231- /* Menu */
232- FS_CreateMenu();
233-} /* init */
234-/**
235230 @brief Glut Display function
236231 called by glutDisplayFunc
237232 */
@@ -273,13 +268,12 @@ void batch_draw()
273268
274269 Modify: ::query, ::nthreads
275270 */
276-int main(
277- int argc, //!< [in]
278- char *argv[] //!< [in] Input file name
279-)
271+bool MyApp::OnInit()
280272 {
281273 int ierr;
282274
275+ if (!wxApp::OnInit()) return false;
276+
283277 printf("\n");
284278 printf("###########################################\n");
285279 printf("## ##\n");
@@ -307,9 +301,8 @@ int main(
307301 printf(" Initialize variables ...\n");
308302 printf("\n");
309303 /**/
310- color_scale = read_file(argv[1]);
304+ color_scale = read_file();
311305 if (color_scale == 0)color_scale = 4;
312- printf("debug %d\n", color_scale);
313306 interpol_energy();
314307 init_corner();
315308 bragg_vector();
@@ -334,17 +327,8 @@ int main(
334327 printf(" mouse right button : Menu\n");
335328 printf("\n");
336329 /**/
337- glutInit(&argc, argv);
338- if (argc > 4)glutInitWindowSize(atoi(argv[3]), atoi(argv[4]));
339- glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH);
340- glutCreateWindow(argv[1]);
341- glutDisplayFunc(display);
342- glutReshapeFunc(resize);
343- glutMouseFunc(mouse);
344- glutMotionFunc(motion);
345- glutSpecialFunc(special_key);
346- glutMenuStateFunc(FS_ModifyMenu);
347- init();
330+ //if (argc > 4)glutInitWindowSize(atoi(argv[3]), atoi(argv[4]));
331+ new MyFrame(NULL, argv[1]);
348332 lbatch = 0;
349333 if (argc > 2) {
350334 lbatch = 1;
@@ -352,6 +336,22 @@ int main(
352336 batch_name = argv[2];
353337 batch_draw();
354338 }
355- glutMainLoop();
356- return 0;
339+ //MyFrame::m_canvas->PostSizeEventToParent();
340+ return true;
357341 } /* main */
342+
343+void MyApp::OnInitCmdLine(wxCmdLineParser& parser)
344+{
345+ wxApp::OnInitCmdLine(parser);
346+
347+ parser.AddParam("FRMSF file to plot.",
348+ wxCMD_LINE_VAL_STRING, wxCMD_LINE_OPTION_MANDATORY);
349+}
350+
351+bool MyApp::OnCmdLineParsed(wxCmdLineParser& parser)
352+{
353+ if (parser.GetParamCount())
354+ frmsf_file_name = parser.GetParam(0);
355+
356+ return wxApp::OnCmdLineParsed(parser);
357+}
--- a/src/kumo.cpp
+++ b/src/kumo.cpp
@@ -28,9 +28,6 @@ denser @f$k@f$-grid with French-curve (Kumo) interpolation
2828 #if defined(HAVE_CONFIG_H)
2929 #include <config.h>
3030 #endif
31-#if defined(WIN32)
32-#include <Windows.h>
33-#endif
3431 #if defined(HAVE_GL_GL_H)
3532 #include <GL/gl.h>
3633 #elif defined(HAVE_OPENGL_GL_H)
--- a/src/menu.cpp
+++ b/src/menu.cpp
@@ -27,10 +27,10 @@ THE SOFTWARE.
2727 #if defined(HAVE_CONFIG_H)
2828 #include <config.h>
2929 #endif
30-#if defined(HAVE_GL_GLUT_H)
31-#include <GL/glut.h>
32-#elif defined(HAVE_GLUT_GLUT_H)
33-#include <GLUT/glut.h>
30+#if defined(HAVE_GL_GL_H)
31+#include <GL/gl.h>
32+#elif defined(HAVE_OPENGL_GL_H)
33+#include <OpenGL/gl.h>
3434 #endif
3535
3636 #include <stdlib.h>
@@ -45,10 +45,8 @@ THE SOFTWARE.
4545 #include "equator.hpp"
4646 #include "draw.hpp"
4747 #include "variable.hpp"
48-
49-int imenu_band, imenu_interpol, imenu_background, imenu_colorscale, imenu_bzmode, imenu_section,
50-imenu_nodeline, imenu_colorbar, imenu_tetra, imenu_stereo, imenu_mouse, imenu_light,
51-imenu_line, imenu_shift, imenu_view, imenu_equator, imenu;
48+#include "menu.hpp"
49+#include "operation.hpp"
5250
5351 void compute_patch_segment() {
5452 query = 1; fermi_patch();
@@ -68,88 +66,213 @@ void refresh_patch_segment() {
6866 compute_patch_segment();
6967 }
7068
71-/**
72- @brief handle main menu.
73-*/
74-static void main_menu(
75- int value //!< [in] Selected menu
76-) {
77-}
69+enum
70+{
71+ menu_bz_radio1,
72+ menu_bz_radio2,
73+ menu_background_radio1,
74+ menu_background_radio2,
75+ menu_lighting_radio1,
76+ menu_lighting_radio2,
77+ menu_lighting_radio3,
78+ menu_mouse_radio1,
79+ menu_mouse_radio2,
80+ menu_mouse_radio3,
81+ menu_stereo_radio1,
82+ menu_stereo_radio2,
83+ menu_stereo_radio3,
84+ menu_tetra_radio1,
85+ menu_tetra_radio2,
86+ menu_tetra_radio3,
87+ menu_tetra_radio4,
88+ menu_tetra_radio5,
89+ menu_tetra_radio6,
90+ menu_tetra_radio7,
91+ menu_tetra_radio8,
92+ menu_tetra_radio9,
93+ menu_tetra_radio10,
94+ menu_tetra_radio11,
95+ menu_tetra_radio12,
96+ menu_tetra_radio13,
97+ menu_tetra_radio14,
98+ menu_tetra_radio15,
99+ menu_tetra_radio16,
100+ menu_view_radio1,
101+ menu_view_radio2,
102+ menu_view_radio3,
103+ menu_nodeline_check,
104+ menu_colorbar_check,
105+ imenu_line,
106+ imenu_shift,
107+ colorscale_maxmin,
108+ colorscale_radio1,
109+ colorscale_radio2,
110+ colorscale_radio3,
111+ colorscale_radio4,
112+ colorscale_radio5,
113+ colorscale_radio6,
114+ colorscale_radio7,
115+ equator_check,
116+ equator_modify,
117+ menu_section_check,
118+ menu_section_modify,
119+ menu_section_gamma,
120+ menu_view_scale,
121+ menu_view_position,
122+ menu_view_rotation,
123+ menu_band_check1,
124+ menu_band_check2,
125+ menu_band_check3,
126+ menu_band_check4,
127+ menu_band_check5,
128+ menu_band_check6,
129+ menu_band_check7,
130+ menu_band_check8,
131+ menu_band_check9,
132+ imenu_interpol
133+};
134+wxBEGIN_EVENT_TABLE(MyFrame, wxFrame)
135+EVT_MENU(menu_bz_radio1, MyFrame::menu_brillouinzone)
136+EVT_MENU(menu_bz_radio2, MyFrame::menu_brillouinzone)
137+EVT_MENU(menu_background_radio1, MyFrame::menu_background)
138+EVT_MENU(menu_background_radio2, MyFrame::menu_background)
139+EVT_MENU(menu_lighting_radio1, MyFrame::menu_lighting)
140+EVT_MENU(menu_lighting_radio2, MyFrame::menu_lighting)
141+EVT_MENU(menu_lighting_radio3, MyFrame::menu_lighting)
142+EVT_MENU(menu_mouse_radio1, MyFrame::menu_mouse)
143+EVT_MENU(menu_mouse_radio2, MyFrame::menu_mouse)
144+EVT_MENU(menu_mouse_radio3, MyFrame::menu_mouse)
145+EVT_MENU(menu_stereo_radio1, MyFrame::menu_stereo)
146+EVT_MENU(menu_stereo_radio2, MyFrame::menu_stereo)
147+EVT_MENU(menu_stereo_radio3, MyFrame::menu_stereo)
148+EVT_MENU(menu_tetra_radio1, MyFrame::menu_tetra)
149+EVT_MENU(menu_tetra_radio2, MyFrame::menu_tetra)
150+EVT_MENU(menu_tetra_radio3, MyFrame::menu_tetra)
151+EVT_MENU(menu_tetra_radio4, MyFrame::menu_tetra)
152+EVT_MENU(menu_tetra_radio5, MyFrame::menu_tetra)
153+EVT_MENU(menu_tetra_radio6, MyFrame::menu_tetra)
154+EVT_MENU(menu_tetra_radio7, MyFrame::menu_tetra)
155+EVT_MENU(menu_tetra_radio8, MyFrame::menu_tetra)
156+EVT_MENU(menu_tetra_radio9, MyFrame::menu_tetra)
157+EVT_MENU(menu_tetra_radio10, MyFrame::menu_tetra)
158+EVT_MENU(menu_tetra_radio11, MyFrame::menu_tetra)
159+EVT_MENU(menu_tetra_radio12, MyFrame::menu_tetra)
160+EVT_MENU(menu_tetra_radio13, MyFrame::menu_tetra)
161+EVT_MENU(menu_tetra_radio14, MyFrame::menu_tetra)
162+EVT_MENU(menu_tetra_radio15, MyFrame::menu_tetra)
163+EVT_MENU(menu_tetra_radio16, MyFrame::menu_tetra)
164+EVT_MENU(menu_view_radio1, MyFrame::menu_view)
165+EVT_MENU(menu_view_radio2, MyFrame::menu_view)
166+EVT_MENU(menu_view_radio3, MyFrame::menu_view)
167+EVT_MENU(menu_colorbar_check, MyFrame::menu_colorbar)
168+EVT_MENU(menu_nodeline_check, MyFrame::menu_nodeline)
169+EVT_MENU(imenu_line, MyFrame::menu_line)
170+EVT_MENU(imenu_shift, MyFrame::menu_shift)
171+EVT_MENU(colorscale_maxmin, MyFrame::menu_colorscale)
172+EVT_MENU(colorscale_radio1, MyFrame::menu_colorscale)
173+EVT_MENU(colorscale_radio2, MyFrame::menu_colorscale)
174+EVT_MENU(colorscale_radio3, MyFrame::menu_colorscale)
175+EVT_MENU(colorscale_radio4, MyFrame::menu_colorscale)
176+EVT_MENU(colorscale_radio5, MyFrame::menu_colorscale)
177+EVT_MENU(colorscale_radio6, MyFrame::menu_colorscale)
178+EVT_MENU(colorscale_radio7, MyFrame::menu_colorscale)
179+EVT_MENU(equator_check, MyFrame::menu_equator)
180+EVT_MENU(equator_modify, MyFrame::menu_equator)
181+EVT_MENU(menu_section_check, MyFrame::menu_section)
182+EVT_MENU(menu_section_modify, MyFrame::menu_section)
183+EVT_MENU(menu_section_gamma, MyFrame::menu_section)
184+EVT_MENU(menu_view_scale, MyFrame::menu_view)
185+EVT_MENU(menu_view_position, MyFrame::menu_view)
186+EVT_MENU(menu_view_rotation, MyFrame::menu_view)
187+EVT_MENU(menu_band_check1, MyFrame::menu_band)
188+EVT_MENU(menu_band_check1, MyFrame::menu_band)
189+EVT_MENU(menu_band_check2, MyFrame::menu_band)
190+EVT_MENU(menu_band_check3, MyFrame::menu_band)
191+EVT_MENU(menu_band_check4, MyFrame::menu_band)
192+EVT_MENU(menu_band_check5, MyFrame::menu_band)
193+EVT_MENU(menu_band_check6, MyFrame::menu_band)
194+EVT_MENU(menu_band_check7, MyFrame::menu_band)
195+EVT_MENU(menu_band_check8, MyFrame::menu_band)
196+EVT_MENU(menu_band_check9, MyFrame::menu_band)
197+EVT_MENU(imenu_interpol, MyFrame::menu_interpol)
198+wxEND_EVENT_TABLE()
199+
78200 /**
79201 @brief Change background color (::blackback)
80202 */
81-static void menu_background(
82- int value //!<[in] Selected menu
203+void MyFrame::menu_background(
204+ wxCommandEvent& event //!<[in] Selected menu
83205 )
84206 {
85- if (value == 1 && blackback != 1) {
207+ if (event.GetId() == menu_background_radio1 && blackback != 1) {
86208 glClearColor(0.0, 0.0, 0.0, 0.0);
87209 blackback = 1;
88210 if (color_scale == 2 || color_scale == 3) paint();
89- display();
211+ Refresh(false);
90212 }
91- else if (value == 0 && blackback != 0) {
213+ else if (event.GetId() == menu_background_radio2 && blackback != 0) {
92214 glClearColor(1.0, 1.0, 1.0, 0.0);
93215 blackback = 0;
94216 if (color_scale == 2 || color_scale == 3) paint();
95- display();
217+ Refresh(false);
96218 }
97219 }/* bgcolor change*/
98220 /**
99221 @brief Toggle the appearance of each band (::draw_band)
100222 */
101-static void menu_band(
102- int value //!< [in] Selected menu
223+void MyFrame::menu_band(
224+ wxCommandEvent& event //!<[in] Selected menu
103225 )
104226 {
105- if (draw_band[value] == 0) {
106- draw_band[value] = 1;
227+ int ib = event.GetId() - menu_band_check1;
228+ if (draw_band[ib] == 0) {
229+ draw_band[ib] = 1;
107230 }
108231 else {
109- draw_band[value] = 0;
232+ draw_band[ib] = 0;
110233 }
111- display();
234+ Refresh(false);
112235 } /* menu_band */
113236 /**
114237 @brief Change Brillouin zone (::fbz)
115238 */
116-static void menu_brillouinzone(
117- int value //!<[in] Selected menu
239+void MyFrame::menu_brillouinzone(
240+ wxCommandEvent& event //!<[in] Selected menu
118241 )
119242 {
120- if (value == 1 && fbz != 1) {
243+ if (event.GetId() == menu_bz_radio1 && fbz != 1) {
121244 fbz = 1;
122245 refresh_patch_segment();
123- display();
246+ Refresh(false);
124247 }
125- else if (value == 2 && fbz != -1) {
248+ else if (event.GetId() == menu_bz_radio2 && fbz != -1) {
126249 fbz = -1;
127250 lsection = 0;
128251 refresh_patch_segment();
129- display();
252+ Refresh(false);
130253 }
131254 } /* menu_brillouinzone */
132255 /**
133256 @brief Toggle Colorbar (::lcolorbar)
134257 */
135-static void menu_colorbar(
136- int value //!<[in] Selected menu
258+void MyFrame::menu_colorbar(
259+ wxCommandEvent& event //!<[in] Selected menu
137260 )
138261 {
139262 if (lcolorbar != 1) lcolorbar = 1;
140263 else lcolorbar = 0;
141- display();
264+ Refresh(false);
142265 } /* menu_colorbar */
143266 /**
144267 @brief Change color scale mode (::color_scale)
145268 */
146-static void menu_colorscale(
147- int value //!<[in] Selected menu
269+void MyFrame::menu_colorscale(
270+ wxCommandEvent& event //!<[in] Selected menu
148271 )
149272 {
150273 int ierr, ii;
151274
152- if (value == 0) {
275+ if (event.GetId() == colorscale_maxmin) {
153276 max_and_min();
154277 if (color_scale == 1 || color_scale == 4
155278 || color_scale == 6 || color_scale == 7) {
@@ -173,30 +296,30 @@ static void menu_colorscale(
173296 printf(" No color scale in this case.\n");
174297 }
175298 paint();
176- display();
299+ Refresh(false);
177300 }
178- else if (value != color_scale) {
179- color_scale = value;
301+ else if (event.GetId() - colorscale_radio1 + 1 != color_scale) {
302+ color_scale = event.GetId() - colorscale_radio1 + 1;
180303 max_and_min();
181304 paint();
182- display();
305+ Refresh(false);
183306 }
184307 } /* menu_colorscale */
185308 /**
186309 @brief Modify and toggle appearance of equator (::lequator)
187310 */
188-static void menu_equator(
189- int value //!<[in] Selected menu
311+void MyFrame::menu_equator(
312+ wxCommandEvent& event //!<[in] Selected menu
190313 )
191314 {
192315 int ierr, ii, jj, ib;
193316 GLfloat vec[3];
194317
195- if (value == 1) {
318+ if (event.GetId() == equator_check) {
196319 if (lequator != 1) lequator = 1;
197320 else lequator = 0;
198- display();
199- }/*if (value == 1)*/
321+ Refresh(false);
322+ }/*if (event.GetId() == 1)*/
200323 else {
201324
202325 printf(" New Miller index : ");
@@ -232,8 +355,8 @@ static void menu_equator(
232355
233356 query = 1; equator();
234357 query = 0; equator();
235- display();
236- }/*else if (value > 1)*/
358+ Refresh(false);
359+ }/*else if (event.GetId() > 1)*/
237360 } /*void menu_equator*/
238361 /**
239362 @brief Modify interpolation ratio
@@ -241,13 +364,13 @@ static void menu_equator(
241364 This routine modify interpolation ratio (::interpol)
242365 then compute Fermi surfaces, etc.
243366 */
244-static void menu_interpol(
245- int value //!< [in] Selected menu
367+void MyFrame::menu_interpol(
368+ wxCommandEvent& event //!<[in] Selected menu
246369 )
247370 {
248371 int ierr;
249372
250- if (value == 1) {
373+ if (event.GetId() == imenu_interpol) {
251374 printf(" Old interpolation ratio : %d\n", interpol);
252375 printf(" New interpolation ratio : ");
253376 //
@@ -257,40 +380,40 @@ static void menu_interpol(
257380 interpol_energy();
258381 refresh_patch_segment();
259382 /**/
260- display();
383+ Refresh(false);
261384 }
262385 }/*static void menu_interpol*/
263386 /**
264387 @brief Toggle Lighting (::lside)
265388 */
266-static void menu_lighting(
267- int value //!<[in] Selected menu
389+void MyFrame::menu_lighting(
390+ wxCommandEvent& event //!<[in] Selected menu
268391 )
269392 {
270- if (value == 1 && lside != 1) {
393+ if (event.GetId() == menu_lighting_radio1 && lside != 1) {
271394 lside = 1;
272395 side = 1.0;
273396 glLightModelf(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE);
274- display();
397+ Refresh(false);
275398 }
276- if (value == 2 && lside != 2) {
399+ if (event.GetId() == menu_lighting_radio2 && lside != 2) {
277400 lside = 2;
278401 side = 1.0;
279402 glLightModelf(GL_LIGHT_MODEL_TWO_SIDE, GL_FALSE);
280- display();
403+ Refresh(false);
281404 }
282- if (value == 3 && lside != 3) {
405+ if (event.GetId() == menu_lighting_radio3 && lside != 3) {
283406 lside = 3;
284407 side = -1.0;
285408 glLightModelf(GL_LIGHT_MODEL_TWO_SIDE, GL_FALSE);
286- display();
409+ Refresh(false);
287410 }
288411 } /* menu_lighting */
289412 /**
290413 @brief Line width (::lside)
291414 */
292-static void menu_line(
293- int value //!<[in] Selected menu
415+void MyFrame::menu_line(
416+ wxCommandEvent& event //!<[in] Selected menu
294417 )
295418 {
296419 int ierr;
@@ -298,61 +421,61 @@ static void menu_line(
298421 printf(" New line width : ");
299422 ierr = scanf("%f", &linewidth);
300423
301- display();
424+ Refresh(false);
302425 } /* menu_line */
303426 /**
304427 @brief Change the function associated to the mouse movement(::lmouse)
305428 */
306-static void menu_mouse(
307- int value //!< [in] Selected menu
308-)
429+void MyFrame::menu_mouse(
430+ wxCommandEvent& event //!<[in] Selected menu
431+)
309432 {
310- if (value == 1 && lmouse != 1) {
433+ if (event.GetId() == menu_mouse_radio1 && lmouse != 1) {
311434 lmouse = 1;
312- display();
435+ Refresh(false);
313436 }
314- if (value == 2 && lmouse != 2) {
437+ if (event.GetId() == menu_mouse_radio2 && lmouse != 2) {
315438 lmouse = 2;
316- display();
439+ Refresh(false);
317440 }
318- if (value == 3 && lmouse != 3) {
441+ if (event.GetId() == menu_mouse_radio3 && lmouse != 3) {
319442 lmouse = 3;
320- display();
443+ Refresh(false);
321444 }
322445 } /* menu_mouse */
323446 /**
324447 @brief Toggle apearance of nodale-line
325448 */
326-static void menu_nodeline(
327- int value //!<[in] Selected menu
449+void MyFrame::menu_nodeline(
450+ wxCommandEvent& event //!<[in] Selected menu
328451 )
329452 {
330453 if (nodeline != 1) nodeline = 1;
331454 else nodeline = 0;
332- display();
455+ Refresh(false);
333456 }/*menu_nodeline*/
334457 /**
335458 @brief Modify and toggle appearance of 2D Fermi lines (::lsection)
336459 */
337-static void menu_section(
338- int value //!<[in] Selected menu
460+void MyFrame::menu_section(
461+ wxCommandEvent& event //!<[in] Selected menu
339462 )
340463 {
341464 int ierr, ii, jj, ib;
342465 GLfloat vec[3];
343466
344- if (value == 1) {
467+ if (event.GetId() == menu_section_check) {
345468 if (lsection != 1) {
346469 lsection = 1;
347- display();
470+ Refresh(false);
348471 }
349472 else {
350473 lsection = 0;
351- display();
474+ Refresh(false);
352475 }
353- }/*if (value == 1)*/
354- else if (value > 1) {
355- if (value == 2) secscale = 1.0;
476+ }/*if (event.GetId() == 1)*/
477+ else {
478+ if (event.GetId() == menu_section_modify) secscale = 1.0;
356479 else secscale = 0.0;
357480
358481 printf(" New Miller index : ");
@@ -381,14 +504,14 @@ static void menu_section(
381504 calc_2dbz();
382505 query = 1; calc_section();
383506 query = 0; calc_section();
384- display();
385- }/*else if (value > 1)*/
507+ Refresh(false);
508+ }/*else if (event.GetId() > 1)*/
386509 } /*void menu_section*/
387510 /**
388511 @brief Shift Fermi energy
389512 */
390-static void menu_shift(
391- int value //!<[in] Selected menu
513+void MyFrame::menu_shift(
514+ wxCommandEvent& event //!<[in] Selected menu
392515 )
393516 {
394517 int ib, i0, i1, i2, ierr;
@@ -415,40 +538,40 @@ static void menu_shift(
415538 /**/
416539 refresh_patch_segment();
417540 /**/
418- display();
541+ Refresh(false);
419542 } /* menu_shift */
420543 /**
421544 @brief Tern stereogram (::lstereo)
422545 */
423-static void menu_stereo(
424- int value //!<[in] Selected menu
546+void MyFrame::menu_stereo(
547+ wxCommandEvent& event //!<[in] Selected menu
425548 ) {
426- if (value == 1 && lstereo != 1) {
549+ if (event.GetId() == menu_stereo_radio1 && lstereo != 1) {
427550 lstereo = 1;
428- display();
551+ Refresh(false);
429552 }
430- if (value == 2 && lstereo != 2) {
553+ if (event.GetId() == menu_stereo_radio2 && lstereo != 2) {
431554 lstereo = 2;
432- display();
555+ Refresh(false);
433556 }
434- if (value == 3 && lstereo != 3) {
557+ if (event.GetId() == menu_stereo_radio3 && lstereo != 3) {
435558 lstereo = 3;
436- display();
559+ Refresh(false);
437560 }
438561 } /* menu_stereo */
439562 /**
440563 @brief Change tetrahedron (::itet)
441564 */
442-static void menu_tetra(
443- int value //!<[in] Selected menu
565+void MyFrame::menu_tetra(
566+ wxCommandEvent& event //!<[in] Selected menu
444567 )
445568 {
446- if (value != itet) {
447- printf(" Tetra patern %d \n", value + 1);
448- itet = value;
569+ if (event.GetId() - menu_tetra_radio1 != itet) {
570+ printf(" Tetra patern %d \n", event.GetId()- menu_tetra_radio1 + 1);
571+ itet = event.GetId() - menu_tetra_radio1;
449572 init_corner();
450573 refresh_patch_segment();
451- display();
574+ Refresh(false);
452575 }
453576 }/*menu_tetra*/
454577 /**
@@ -457,27 +580,27 @@ static void menu_tetra(
457580 This modify scale (::scl) & tarnslation (::trans) &
458581 rotation (::thetax, ::thetay, ::thetaz, ::rot),
459582 */
460-static void menu_view(
461- int value //!< [in] Selected menu
583+void MyFrame::menu_view(
584+ wxCommandEvent& event //!<[in] Selected menu
462585 )
463586 {
464587 int ierr;
465588
466- if (value == 1) {
589+ if (event.GetId() == menu_view_scale) {
467590
468591 printf(" Current Scale : %f\n", scl);
469592 printf(" New Scale : ");
470593 ierr = scanf("%f", &scl);
471594
472595 }
473- else if (value == 2) {
596+ else if (event.GetId() == menu_view_position) {
474597
475598 printf(" Current Position(x y) : %f %f\n", trans[0], trans[1]);
476599 printf(" New Position(x y) : ");
477600 ierr = scanf("%f %f", &trans[0], &trans[1]);
478601
479602 }
480- else if (value == 3) {
603+ else if (event.GetId() == menu_view_rotation) {
481604
482605 /**/
483606 thetay = asinf(rot[0][2]);
@@ -514,346 +637,136 @@ static void menu_view(
514637
515638 }
516639
517- display();
518-
640+ Refresh(false);
519641 }
520-/**
521- @brief Modify text in the right-click munu
522-*/
523-void FS_ModifyMenu(
524- int status//!<[in]
525-)
526-{
527- int ib;
528- char menu_str[50] = { 0 };
529- if (status == GLUT_MENU_IN_USE) {
530- display();
531- }
532- else {
533- /*
534- Background color
535- */
536- glutSetMenu(imenu_background);
537- for (ib = 0; ib < 2; ib++) glutRemoveMenuItem(1);
538- if (blackback == 1) glutAddMenuEntry("[x] Black", 1);
539- else glutAddMenuEntry("[ ] Black", 1);
540- if (blackback == 0) glutAddMenuEntry("[x] White", 0);
541- else glutAddMenuEntry("[ ] White", 0);
542- /*
543- Band menu
544- */
545- glutSetMenu(imenu_band);
546- for (ib = 0; ib < nb; ib++) glutRemoveMenuItem(1);
547- for (ib = 0; ib < nb; ib++) {
548- if (draw_band[ib] == 1) sprintf(menu_str, "[x] band # %d", ib + 1);
549- else sprintf(menu_str, "[ ] band # %d", ib + 1);
550- glutAddMenuEntry(menu_str, ib);
551- }
552- /*
553- Brillouin zone
554- */
555- glutSetMenu(imenu_bzmode);
556- for (ib = 0; ib < 2; ib++) glutRemoveMenuItem(1);
557- if (fbz == 1) glutAddMenuEntry("[x] First Brillouin zone", 1);
558- else glutAddMenuEntry("[ ] First Brillouin zone", 1);
559- if (fbz == -1) glutAddMenuEntry("[x] Primitive Brillouin zone", 2);
560- else glutAddMenuEntry("[ ] Primitive Brillouin zone", 2);
561- /*
562- Colorbar on/off
563- */
564- glutSetMenu(imenu_colorbar);
565- for (ib = 0; ib < 1; ib++) glutRemoveMenuItem(1);
566- if (lcolorbar == 1) glutAddMenuEntry("[x] Color bar", 0);
567- else glutAddMenuEntry("[ ] Color bar", 0);
568- /*
569- Color scale mode
570- */
571- glutSetMenu(imenu_colorscale);
572- for (ib = 0; ib < 8; ib++) glutRemoveMenuItem(1);
573- glutAddMenuEntry("Max/Min of Scale", 0);
574- if (color_scale == 1) glutAddMenuEntry("[x] Input (Real)", 1);
575- else glutAddMenuEntry("[ ] Input (Real)", 1);
576- if (color_scale == 2) glutAddMenuEntry("[x] Input (Complex)", 2);
577- else glutAddMenuEntry("[ ] Input (Complex)", 2);
578- if (color_scale == 3) glutAddMenuEntry("[x] Input (Tri-number)", 3);
579- else glutAddMenuEntry("[ ] Input (Tri-number)", 3);
580- if (color_scale == 4) glutAddMenuEntry("[x] Fermi Velocity", 4);
581- else glutAddMenuEntry("[ ] Fermi Velocity", 4);
582- if (color_scale == 5) glutAddMenuEntry("[x] Band Index", 5);
583- else glutAddMenuEntry("[ ] Band Index", 5);
584- if (color_scale == 6) glutAddMenuEntry("[x] Input (Real, Gray Scale)", 6);
585- else glutAddMenuEntry("[ ] Input (Real, Gray Scale)", 6);
586- if (color_scale == 7) glutAddMenuEntry("[x] Fermi Velocity (Gray Scale)", 7);
587- else glutAddMenuEntry("[ ] Fermi Velocity (Gray Scale)", 7);
588- /*
589- Equator
590- */
591- glutSetMenu(imenu_equator);
592- for (ib = 0; ib < 2; ib++) glutRemoveMenuItem(1);
593- if (lequator == 1) glutAddMenuEntry("[x] Equator", 1);
594- else glutAddMenuEntry("[ ] Equator", 1);
595- glutAddMenuEntry("Modify euqtor", 2);
596- /*
597- Interpolation ratio
598- */
599- glutSetMenu(imenu_interpol);
600- glutRemoveMenuItem(1);
601- sprintf(menu_str, "Ratio : %d", interpol);
602- glutAddMenuEntry(menu_str, 1);
603- /*
604- Switch lighting
605- */
606- glutSetMenu(imenu_light);
607- for (ib = 0; ib < 3; ib++) glutRemoveMenuItem(1);
608- if (lside == 1) glutAddMenuEntry("[x] Both side", 1);
609- else glutAddMenuEntry("[ ] Both side", 1);
610- if (lside == 2) glutAddMenuEntry("[x] Unoccupied side", 2);
611- else glutAddMenuEntry("[ ] Unoccupied side", 2);
612- if (lside == 3) glutAddMenuEntry("[x] Occupied side", 3);
613- else glutAddMenuEntry("[ ] Occupied side", 3);
614- /*
615- Line width
616- */
617- glutSetMenu(imenu_line);
618- for (ib = 0; ib < 1; ib++) glutRemoveMenuItem(1);
619- sprintf(menu_str, "Line width : %3.1f", linewidth);
620- glutAddMenuEntry(menu_str, 1);
621- /*
622- Operation with mouse drag
623- */
624- glutSetMenu(imenu_mouse);
625- for (ib = 0; ib < 3; ib++) glutRemoveMenuItem(1);
626- if (lmouse == 1) glutAddMenuEntry("[x] Rotate", 1);
627- else glutAddMenuEntry("[ ] Rotate", 1);
628- if (lmouse == 2) glutAddMenuEntry("[x] Scale", 2);
629- else glutAddMenuEntry("[ ] Scale", 2);
630- if (lmouse == 3) glutAddMenuEntry("[x] Translate", 3);
631- else glutAddMenuEntry("[ ] Translate", 3);
632- /*
633- Nodal line on/off
634- */
635- glutSetMenu(imenu_nodeline);
636- for (ib = 0; ib < 1; ib++) glutRemoveMenuItem(1);
637- if (nodeline == 1) glutAddMenuEntry("[x] Nodal line", 0);
638- else glutAddMenuEntry("[ ] Nodal line", 0);
639- /*
640- 2D Fermi lines
641- */
642- glutSetMenu(imenu_section);
643- for (ib = 0; ib < 3; ib++) glutRemoveMenuItem(1);
644- if (fbz == -1) glutAddMenuEntry("[Cannot] Section", 0);
645- else if (lsection == 1) glutAddMenuEntry("[x] Section", 1);
646- else glutAddMenuEntry("[ ] Section", 1);
647- glutAddMenuEntry("Modify section", 2);
648- glutAddMenuEntry("Modify section (across Gamma)", 3);
649- /*
650- Shift Fermi energy
651- */
652- glutSetMenu(imenu_shift);
653- for (ib = 0; ib < 1; ib++) glutRemoveMenuItem(1);
654- sprintf(menu_str, "Fermi energy :%9.5f", EF);
655- glutAddMenuEntry(menu_str, 1);
656- /*
657- Stereogram
658- */
659- glutSetMenu(imenu_stereo);
660- for (ib = 0; ib < 3; ib++) glutRemoveMenuItem(1);
661- if (lstereo == 1) glutAddMenuEntry("[x] None", 1);
662- else glutAddMenuEntry("[ ] None", 1);
663- if (lstereo == 2) glutAddMenuEntry("[x] Parallel", 2);
664- else glutAddMenuEntry("[ ] Parallel", 2);
665- if (lstereo == 3) glutAddMenuEntry("[x] Cross", 3);
666- else glutAddMenuEntry("[ ] Cross", 3);
667- /*
668- Tetrahedron
669- */
670- glutSetMenu(imenu_tetra);
671- for (ib = 0; ib < 16; ib++) glutRemoveMenuItem(1);
672- for (ib = 0; ib < 16; ib++) {
673- if (itet == ib) sprintf(menu_str, "[x] tetra # %d", ib + 1);
674- else sprintf(menu_str, "[ ] tetra # %d", ib + 1);
675- glutAddMenuEntry(menu_str, ib);
676- }
677- /*
678- Set view
679- */
680- glutSetMenu(imenu_view);
681- for (ib = 0; ib < 3; ib++) glutRemoveMenuItem(1);
682- sprintf(menu_str, "Scale");// :%6.2f", scl);
683- glutAddMenuEntry(menu_str, 1);
684- sprintf(menu_str, "Position");// :%6.2f %6.2f", trans[0], trans[1]);
685- glutAddMenuEntry(menu_str, 2);
686- sprintf(menu_str, "Rotation");// : %4.0f %4.0f %4.0f", thetax, thetay, thetaz);
687- glutAddMenuEntry(menu_str, 3);
688-
689- display();
690- }
691-}/*void FS_ModifyMenu*/
692-/**
693- @brief Create Right-click Menu
694-*/
695-void FS_CreateMenu()
642+
643+MyFrame::MyFrame(wxFrame* frame, const wxString& title, const wxPoint& pos,
644+ const wxSize& size, long style)
645+ : wxFrame(frame, wxID_ANY, title, pos, size, style),
646+ m_canvas(NULL)
696647 {
697- int ib;
698- char menu_str[50] = { 0 };
699- /*
700- Background color
701- */
702- imenu_background = glutCreateMenu(menu_background);
703- if (blackback == 1) glutAddMenuEntry("[x] Black", 1);
704- else glutAddMenuEntry("[ ] Black", 1);
705- if (blackback == 0) glutAddMenuEntry("[x] White", 0);
706- else glutAddMenuEntry("[ ] White", 0);
707- /*
708- On/Off each band
709- */
710- imenu_band = glutCreateMenu(menu_band);
648+ int ib, itet;
649+ char menuname[8];
650+
651+ // debug SetIcon(wxICON(sample));
652+
653+ wxMenu* imenu_bzmode = new wxMenu;
654+ imenu_bzmode->AppendRadioItem(menu_bz_radio1, wxT("First Brillouin zone"));
655+ imenu_bzmode->AppendRadioItem(menu_bz_radio2, wxT("Primitive Brillouin zone"));
656+
657+ wxMenu* imenu_background = new wxMenu;
658+ imenu_background->AppendRadioItem(menu_background_radio1, wxT("Black"));
659+ imenu_background->AppendRadioItem(menu_background_radio2, wxT("White"));
660+
661+ wxMenu* imenu_band = new wxMenu;
711662 for (ib = 0; ib < nb; ib++) {
712- if (draw_band[ib] == 1) sprintf(menu_str, "[x] band # %d", ib + 1);
713- else sprintf(menu_str, "[ ] band # %d", ib + 1);
714- glutAddMenuEntry(menu_str, ib);
663+ imenu_band->AppendCheckItem(menu_band_check1 + ib, wxString::Format(wxT("Band %d"), ib));
715664 }
716- /*
717- Brillouin zone
718- */
719- imenu_bzmode = glutCreateMenu(menu_brillouinzone);
720- if (fbz == 1) glutAddMenuEntry("[x] First Brillouin zone", 1);
721- else glutAddMenuEntry("[ ] First Brillouin zone", 1);
722- if (fbz == -1) glutAddMenuEntry("[x] Primitive Brillouin zone", 2);
723- else glutAddMenuEntry("[ ] Primitive Brillouin zone", 2);
724- /*
725- Colorbar on/off
726- */
727- imenu_colorbar = glutCreateMenu(menu_colorbar);
728- if (lcolorbar == 1) glutAddMenuEntry("[x] Color bar", 1);
729- else glutAddMenuEntry("[ ] Color bar", 1);
730- /*
731- Color scale mode
732- */
733- imenu_colorscale = glutCreateMenu(menu_colorscale);
734- glutAddMenuEntry("Max/Min of Scale", 0);
735- if (color_scale == 1) glutAddMenuEntry("[x] Input (Real)", 1);
736- else glutAddMenuEntry("[ ] Input (Real)", 1);
737- if (color_scale == 2) glutAddMenuEntry("[x] Input (Complex)", 2);
738- else glutAddMenuEntry("[ ] Input (Complex)", 2);
739- if (color_scale == 3) glutAddMenuEntry("[x] Input (Tri-number)", 3);
740- else glutAddMenuEntry("[ ] Input (Tri-number)", 3);
741- if (color_scale == 4) glutAddMenuEntry("[x] Fermi Velocity", 4);
742- else glutAddMenuEntry("[ ] Fermi Velocity", 4);
743- if (color_scale == 5) glutAddMenuEntry("[x] Band Index", 5);
744- else glutAddMenuEntry("[ ] Band Index", 5);
745- if (color_scale == 6) glutAddMenuEntry("[x] Input (Real, Gray Scale)", 6);
746- else glutAddMenuEntry("[ ] Input (Real, Gray Scale)", 6);
747- if (color_scale == 7) glutAddMenuEntry("[x] Fermi Velocity (Gray Scale)", 7);
748- else glutAddMenuEntry("[ ] Fermi Velocity (Gray Scale)", 7);
749- /*
750- Equator
751- */
752- imenu_equator = glutCreateMenu(menu_equator);
753- if (lequator == 1) glutAddMenuEntry("[x] Equator", 1);
754- else glutAddMenuEntry("[ ] Equator", 1);
755- glutAddMenuEntry("Modify euqtor", 2);
756- /*
757- Interpolation ratio
758- */
759- sprintf(menu_str, "Ratio : %d", interpol);
760- imenu_interpol = glutCreateMenu(menu_interpol);
761- glutAddMenuEntry(menu_str, 1);
762- /*
763- Switch lighting
764- */
765- imenu_light = glutCreateMenu(menu_lighting);
766- if (lside == 1) glutAddMenuEntry("[x] Both side", 1);
767- else glutAddMenuEntry("[ ] Both side", 1);
768- if (lside == 2) glutAddMenuEntry("[x] Unoccupied side", 2);
769- else glutAddMenuEntry("[ ] Unoccupied side", 2);
770- if (lside == 3) glutAddMenuEntry("[x] Occupied side", 3);
771- else glutAddMenuEntry("[ ] Occupied side", 3);
772- /*
773- Line width
774- */
775- imenu_line = glutCreateMenu(menu_line);
776- sprintf(menu_str, "Line width : %3.1f", linewidth);
777- glutAddMenuEntry(menu_str, 1);
778- /*
779- Mouse drag works as ...
780- */
781- imenu_mouse = glutCreateMenu(menu_mouse);
782- if (lmouse == 1) glutAddMenuEntry("[x] Rotate", 1);
783- else glutAddMenuEntry("[ ] Rotate", 1);
784- if (lmouse == 2) glutAddMenuEntry("[x] Scale", 2);
785- else glutAddMenuEntry("[ ] Scale", 2);
786- if (lmouse == 3) glutAddMenuEntry("[x] Translate", 3);
787- else glutAddMenuEntry("[ ] Translate", 3);
788- /*
789- Nodeline on/off
790- */
791- imenu_nodeline = glutCreateMenu(menu_nodeline);
792- if (nodeline == 1) glutAddMenuEntry("[x] Nodal line", 0);
793- else glutAddMenuEntry("[ ] Nodal line", 0);
794- /*
795- 2D Fermi lines
796- */
797- imenu_section = glutCreateMenu(menu_section);
798- if (fbz == -1) glutAddMenuEntry("[Cannot] Section", 0);
799- else if (lsection == 1) glutAddMenuEntry("[x] Section", 1);
800- else glutAddMenuEntry("[ ] Section", 1);
801- glutAddMenuEntry("Modify section", 2);
802- glutAddMenuEntry("Modify section (across Gamma)", 3);
803- /*
804- Shift Fermi energy
805- */
806- imenu_shift = glutCreateMenu(menu_shift);
807- sprintf(menu_str, "Fermi energy :%9.5f", EF);
808- glutAddMenuEntry(menu_str, 1);
809- /*
810- Stereogram
811- */
812- imenu_stereo = glutCreateMenu(menu_stereo);
813- if (lstereo == 1) glutAddMenuEntry("[x] None", 1);
814- else glutAddMenuEntry("[ ] None", 1);
815- if (lstereo == 2) glutAddMenuEntry("[x] Parallel", 2);
816- else glutAddMenuEntry("[ ] Parallel", 2);
817- if (lstereo == 3) glutAddMenuEntry("[x] Cross", 3);
818- else glutAddMenuEntry("[ ] Cross", 3);
819- /*
820- Tetrahedron
821- */
822- imenu_tetra = glutCreateMenu(menu_tetra);
823- for (ib = 0; ib < 16; ib++) {
824- if (itet == ib) sprintf(menu_str, "[x] tetra # %d", ib + 1);
825- else sprintf(menu_str, "[ ] tetra # %d", ib + 1);
826- glutAddMenuEntry(menu_str, ib);
665+
666+ wxMenu* imenu_colorscale = new wxMenu;
667+ imenu_colorscale->Append(colorscale_maxmin, wxT("Max/Min of Scale"));
668+ imenu_colorscale->AppendRadioItem(colorscale_radio1, wxT("Input (Real)"));
669+ imenu_colorscale->AppendRadioItem(colorscale_radio2, wxT("Input (Complex)"));
670+ imenu_colorscale->AppendRadioItem(colorscale_radio3, wxT("Input (Tri-number)"));
671+ imenu_colorscale->AppendRadioItem(colorscale_radio4, wxT("Fermi Velocity"));
672+ imenu_colorscale->AppendRadioItem(colorscale_radio5, wxT("Band Index"));
673+ imenu_colorscale->AppendRadioItem(colorscale_radio6, wxT("Input (Real, Gray Scale)"));
674+ imenu_colorscale->AppendRadioItem(colorscale_radio7, wxT("Fermi Velocity (Gray Scale)"));
675+
676+ wxMenu* imenu_equator = new wxMenu;
677+ imenu_equator->AppendCheckItem(equator_check, wxT("Equator"));
678+ imenu_equator->Append(equator_modify, wxT("Modify euqtor"));
679+
680+ wxMenu* imenu_light = new wxMenu;
681+ imenu_light->AppendRadioItem(menu_lighting_radio1, wxT("Both side"));
682+ imenu_light->AppendRadioItem(menu_lighting_radio2, wxT("Unoccupied side"));
683+ imenu_light->AppendRadioItem(menu_lighting_radio3, wxT("Occupied side"));
684+
685+ wxMenu* imenu_mouse = new wxMenu;
686+ imenu_mouse->AppendRadioItem(menu_mouse_radio1, wxT("Rotate"));
687+ imenu_mouse->AppendRadioItem(menu_mouse_radio2, wxT("Scale"));
688+ imenu_mouse->AppendRadioItem(menu_mouse_radio3, wxT("Translate"));
689+
690+ wxMenu* imenu_section = new wxMenu;
691+ imenu_section->AppendCheckItem(menu_section_check, wxT("Section"));
692+ imenu_section->Append(menu_section_modify, wxT("Modify section"));
693+ imenu_section->Append(menu_section_gamma, wxT("Modify section (across Gamma)"));
694+
695+ wxMenu* imenu_stereo = new wxMenu;
696+ imenu_stereo->AppendRadioItem(menu_stereo_radio1, wxT("None"));
697+ imenu_stereo->AppendRadioItem(menu_stereo_radio2, wxT("Parallel"));
698+ imenu_stereo->AppendRadioItem(menu_stereo_radio3, wxT("Cross"));
699+
700+ wxMenu* imenu_tetra = new wxMenu;
701+ for (itet = 0; itet < 16; itet++) {
702+ imenu_tetra->AppendRadioItem(menu_tetra_radio1 + itet,
703+ wxString::Format(wxT("tetra # %d"), itet));
827704 }
828- /*
829- Set view
830- */
831- imenu_view = glutCreateMenu(menu_view);
832- sprintf(menu_str, "Scale");// :%6.2f", scl);
833- glutAddMenuEntry(menu_str, 1);
834- sprintf(menu_str, "Position");// :%6.2f %6.2f", trans[0], trans[1]);
835- glutAddMenuEntry(menu_str, 2);
836- sprintf(menu_str, "Rotation");// : %4.0f %4.0f %4.0f", thetax, thetay, thetaz);
837- glutAddMenuEntry(menu_str, 3);
838- /*
839- Main menu
840- */
841- imenu = glutCreateMenu(main_menu);
842- glutAddSubMenu("Background color", imenu_background);
843- glutAddSubMenu("Band", imenu_band);
844- glutAddSubMenu("Brillouin zone", imenu_bzmode);
845- glutAddSubMenu("Color bar", imenu_colorbar);
846- glutAddSubMenu("Color scale mode", imenu_colorscale);
847- glutAddSubMenu("Equator", imenu_equator);
848- glutAddSubMenu("Interpolation", imenu_interpol);
849- glutAddSubMenu("Lighting", imenu_light);
850- glutAddSubMenu("Line width", imenu_line);
851- glutAddSubMenu("Mouse Drag", imenu_mouse);
852- glutAddSubMenu("Nodal line", imenu_nodeline);
853- glutAddSubMenu("Section", imenu_section);
854- glutAddSubMenu("Shift Fermi energy", imenu_shift);
855- glutAddSubMenu("Stereogram", imenu_stereo);
856- glutAddSubMenu("Tetrahedron", imenu_tetra);
857- glutAddSubMenu("View point", imenu_view);
858- glutAttachMenu(GLUT_RIGHT_BUTTON);
705+
706+ wxMenu* imenu_view = new wxMenu;
707+ imenu_view->Append(menu_view_scale, wxT("Scale"));
708+ imenu_view->Append(menu_view_position, wxT("Position"));
709+ imenu_view->Append(menu_view_rotation, wxT("Rotation"));
710+
711+ // Make a menubar
712+ wxMenu* fileMenu = new wxMenu;
713+
714+ fileMenu->AppendSubMenu(imenu_background, wxT("Background color"));
715+ fileMenu->AppendSubMenu(imenu_band, wxT("Band"));
716+ fileMenu->AppendSubMenu(imenu_bzmode, wxT("Brillouin zone"));
717+ fileMenu->AppendCheckItem(menu_colorbar_check, wxT("Color bar"));
718+ fileMenu->AppendSubMenu(imenu_colorscale, wxT("Color scale mode"));
719+ fileMenu->AppendSubMenu(imenu_equator, wxT("Equator"));
720+ fileMenu->Append(imenu_interpol, wxT("Interpol ratio"));
721+ fileMenu->AppendSubMenu(imenu_light, wxT("Lighting"));
722+ fileMenu->Append(imenu_line, wxT("Line width"));
723+ fileMenu->AppendSubMenu(imenu_mouse, wxT("Mouse Drag"));
724+ fileMenu->AppendCheckItem(menu_nodeline_check, wxT("Nodal line"));
725+ fileMenu->AppendSubMenu(imenu_section, wxT("Section"));
726+ fileMenu->Append(imenu_shift, wxT("Shift Fermi energy"));
727+ fileMenu->AppendSubMenu(imenu_stereo, wxT("Stereogram"));
728+ fileMenu->AppendSubMenu(imenu_tetra, wxT("Tetrahedron"));
729+ fileMenu->AppendSubMenu(imenu_view, wxT("View point"));
730+
731+ wxMenuBar* menuBar = new wxMenuBar;
732+ menuBar->Append(fileMenu, wxT("File"));
733+ SetMenuBar(menuBar);
734+
735+ // Make a TestGLCanvas
736+
737+ // JACS
738+#ifdef __WXMSW__
739+ int* gl_attrib = NULL;
740+#else
741+ int gl_attrib[20] =
742+ { WX_GL_RGBA, WX_GL_MIN_RED, 1, WX_GL_MIN_GREEN, 1,
743+ WX_GL_MIN_BLUE, 1, WX_GL_DEPTH_SIZE, 1,
744+ WX_GL_DOUBLEBUFFER,
745+# if defined(__WXMAC__) || defined(__WXCOCOA__)
746+ GL_NONE };
747+# else
748+ None
749+};
750+# endif
751+#endif
752+
753+ m_canvas = new TestGLCanvas(this, wxID_ANY, gl_attrib);
754+
755+ // Show the frame
756+ Show(true);
757+ Raise();
758+
759+ m_canvas->InitGL();
760+}
761+
762+MyFrame::~MyFrame()
763+{
764+ delete m_canvas;
765+}
766+
767+// Intercept menu commands
768+void MyFrame::OnExit(wxCommandEvent& WXUNUSED(event))
769+{
770+ // true is to force the frame to close
771+ Close(true);
859772 }
--- a/src/menu.hpp
+++ b/src/menu.hpp
@@ -21,8 +21,43 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2121 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2222 THE SOFTWARE.
2323 */
24+#include "wx/wx.h"
25+#include "operation.hpp"
2426
2527 void compute_patch_segment();
26-void FS_CreateMenu();
27-void FS_ModifyMenu(int status);
2828 void refresh_patch_segment();
29+
30+// The frame containing the GL canvas
31+class MyFrame : public wxFrame
32+{
33+public:
34+ MyFrame(wxFrame* frame,
35+ const wxString& title,
36+ const wxPoint& pos = wxDefaultPosition,
37+ const wxSize& size = wxDefaultSize,
38+ long style = wxDEFAULT_FRAME_STYLE);
39+
40+ virtual ~MyFrame();
41+
42+ TestGLCanvas* m_canvas;
43+
44+private:
45+ void OnExit(wxCommandEvent& event);
46+ void menu_brillouinzone(wxCommandEvent& event);
47+ void menu_background(wxCommandEvent& event);
48+ void menu_band(wxCommandEvent& event);
49+ void menu_colorbar(wxCommandEvent& event);
50+ void menu_colorscale(wxCommandEvent& event);
51+ void menu_equator(wxCommandEvent& event);
52+ void menu_interpol(wxCommandEvent& event);
53+ void menu_lighting(wxCommandEvent& event);
54+ void menu_line(wxCommandEvent& event);
55+ void menu_mouse(wxCommandEvent& event);
56+ void menu_nodeline(wxCommandEvent& event);
57+ void menu_section(wxCommandEvent& event);
58+ void menu_shift(wxCommandEvent& event);
59+ void menu_stereo(wxCommandEvent& event);
60+ void menu_tetra(wxCommandEvent& event);
61+ void menu_view(wxCommandEvent& event);
62+ wxDECLARE_EVENT_TABLE();
63+};
--- a/src/operation.cpp
+++ b/src/operation.cpp
@@ -24,215 +24,218 @@ THE SOFTWARE.
2424 /**@file
2525 @brief Handle operations associated to mouse drag and window resize
2626 */
27+#include "wx/glcanvas.h"
28+
2729 #if defined(HAVE_CONFIG_H)
2830 #include <config.h>
2931 #endif
30-#if defined(HAVE_GL_GLUT_H)
31-#include <GL/glut.h>
32-#elif defined(HAVE_GLUT_GLUT_H)
33-#include <GLUT/glut.h>
32+#if defined(HAVE_GL_GLU_H)
33+#include <GL/glu.h>
34+#elif defined(HAVE_OPENGL_GLU_H)
35+#include <OpenGL/glu.h>
3436 #endif
3537
3638 #include <math.h>
3739 #include "draw.hpp"
3840 #include "variable.hpp"
41+#include "operation.hpp"
42+
43+wxBEGIN_EVENT_TABLE(TestGLCanvas, wxGLCanvas)
44+EVT_SIZE(TestGLCanvas::OnSize)
45+EVT_PAINT(TestGLCanvas::OnPaint)
46+EVT_CHAR(TestGLCanvas::OnChar)
47+EVT_MOUSE_EVENTS(TestGLCanvas::OnMouseEvent)
48+wxEND_EVENT_TABLE()
49+
3950 /**
4051 @brief Window resize
4152
4253 Modify : ::sx, ::sy
4354 */
44-void resize(
45- int w, //!<[in] Window width
46- int h //!<[in] Window height
47-)
55+void TestGLCanvas::OnSize(wxSizeEvent& event)
4856 {
57+ if (!IsShownOnScreen())
58+ return;
59+ // This is normally only necessary if there is more than one wxGLCanvas
60+ // or more than one wxGLContext in the application.
61+ SetCurrent(*m_glRC);
62+
4963 /*
5064 Scale of translation of mousepointer
5165 */
52- sx = 1.0f / (GLfloat)w;
53- sy = 1.0f / (GLfloat)h;
54- /**/
55- glViewport(0, 0, w, h);
66+ sx = 1.0f / (GLfloat)event.GetSize().x;
67+ sy = 1.0f / (GLfloat)event.GetSize().y;
68+ // It's up to the application code to update the OpenGL viewport settings.
69+ // This is OK here only because there is only one canvas that uses the
70+ // context. See the cube sample for that case that multiple canvases are
71+ // made current with one context.
72+ glViewport(0, 0, event.GetSize().x, event.GetSize().y);
5673 /**/
5774 glMatrixMode(GL_PROJECTION);
5875 /**/
5976 glLoadIdentity();
60- gluPerspective(30.0, (GLfloat)w / (GLfloat)h, 1.0, 100.0);
77+ gluPerspective(30.0, (GLfloat)event.GetSize().x / (GLfloat)event.GetSize().y, 1.0, 100.0);
6178 /**/
6279 glMatrixMode(GL_MODELVIEW);
63-} /* end resize */
64-/**
65- @brief Idling
66-*/
67-void idle(void)
68-{
69- display();
70-} /* idle */
80+}
7181 /**
7282 @brief Glut mouse function
7383
7484 Modify : ::cx, ::cy, ::scl
7585 */
76-void mouse(
77- int button, //!< [in] pushed button
78- int state, //!< [in] down or up or ?
79- int x, //!< [in] position of mouse cursor
80- int y //!< [in] position of mouse cursor
81-)
86+void TestGLCanvas::OnMouseEvent(wxMouseEvent& event)
8287 {
83- switch (button) {
84- /*
85- Drag
86- */
87- case GLUT_LEFT_BUTTON:
88- switch (state) {
89- case GLUT_DOWN:
90- /* Start of animation */
91- glutIdleFunc(idle);
92- /* Record drag start point */
93- cx = x;
94- cy = y;
95- break;
96- case GLUT_UP:
97- /* End of animation */
98- glutIdleFunc(0);
99- break;
100- default:
101- break;
102- }
103- break;
104- /*
105- Zoom up
106- */
107- case MOUSE_SCROLL_UP:
108- switch (state) {
109- case GLUT_DOWN:
110- scl = scl * 1.1f;
111- display();
112- break;
113- case GLUT_UP:
114- break;
115- default:
116- break;
117- }
118- break;
119- /*
120- Zoom down
121- */
122- case MOUSE_SCROLL_DOWN:
123- switch (state) {
124- case GLUT_DOWN:
125- scl = scl * 0.9f;
126- display();
127- break;
128- case GLUT_UP:
129- break;
130- default:
131- break;
132- }
133- break;
134- /*
135- No pushing
136- */
137- default:
138- break;
139- }
140-} /* end mouse */
141-/**
142- @brief Glut motion function
143-
144- Modify : ::scl, ::trans
145-*/
146-void motion(
147- int x, //!< [in] position of cursor
148- int y //!< [in] position of cursor
149-)
150-{
151- int i, j;
88+ static int dragging = 0;
89+ static float last_x, last_y;
90+ int i, j, wheel;
15291 GLfloat dx, dy, a, rot0[3][3], rot1[3][3], ax, ay;
153- /*
154- Translation of mousepointer from starting point
155- */
156- dx = (x - cx) * sx;
157- dy = (y - cy) * sy;
158- /*
159- Distanse from starting point
160- */
161- a = sqrtf(dx * dx + dy * dy);
162- /**/
163- if (lmouse == 1) {
164- /**/
165- if (a != 0.0) {
92+
93+ // Allow default processing to happen, or else the canvas cannot gain focus
94+ // (for key events).
95+ event.Skip();
96+
97+ if (event.LeftIsDown())
98+ {
99+ if (!dragging)
100+ {
101+ dragging = 1;
102+ }
103+ else
104+ {
166105 /*
167- Compute rotational matrix from translation of mousepointer
106+ Translation of mousepointer from starting point
168107 */
169- ax = -dy;
170- ay = dx;
171- /**/
172- a = a * 10.0f;
173- /**/
174- rot0[0][0] = (ax * ax + ay * ay * cosf(a)) / (ax * ax + ay * ay);
175- rot0[0][1] = ax * ay * (cosf(a) - 1.0f) / (ax * ax + ay * ay);
176- rot0[0][2] = ay * sinf(a) / sqrtf(ax * ax + ay * ay);
177- rot0[1][0] = ax * ay * (cosf(a) - 1.0f) / (ax * ax + ay * ay);
178- rot0[1][1] = (ax * ax * cosf(a) + ay * ay) / (ax * ax + ay * ay);
179- rot0[1][2] = ax * sinf(a) / sqrtf(ax * ax + ay * ay);
180- rot0[2][0] = -ay * sinf(a) / sqrtf(ax * ax + ay * ay);
181- rot0[2][1] = -ax * sinf(a) / sqrtf(ax * ax + ay * ay);
182- rot0[2][2] = cosf(a);
183- /**/
184- for (i = 0; i < 3; i++) for (j = 0; j < 3; j++) rot1[i][j] = rot[i][j];
108+ dx = (event.GetX() - last_x) * sx;
109+ dy = (event.GetY() - last_y) * sy;
110+ /*
111+ Distanse from starting point
112+ */
113+ a = sqrtf(dx * dx + dy * dy);
185114 /**/
186- for (i = 0; i < 3; i++) {
187- for (j = 0; j < 3; j++) {
188- rot[i][j] = rot0[i][0] * rot1[0][j]
189- + rot0[i][1] * rot1[1][j]
190- + rot0[i][2] * rot1[2][j];
115+ if (lmouse == 1) {
116+ /**/
117+ if (a != 0.0) {
118+ /*
119+ Compute rotational matrix from translation of mousepointer
120+ */
121+ ax = -dy;
122+ ay = dx;
123+ /**/
124+ a = a * 10.0f;
125+ /**/
126+ rot0[0][0] = (ax * ax + ay * ay * cosf(a)) / (ax * ax + ay * ay);
127+ rot0[0][1] = ax * ay * (cosf(a) - 1.0f) / (ax * ax + ay * ay);
128+ rot0[0][2] = ay * sinf(a) / sqrtf(ax * ax + ay * ay);
129+ rot0[1][0] = ax * ay * (cosf(a) - 1.0f) / (ax * ax + ay * ay);
130+ rot0[1][1] = (ax * ax * cosf(a) + ay * ay) / (ax * ax + ay * ay);
131+ rot0[1][2] = ax * sinf(a) / sqrtf(ax * ax + ay * ay);
132+ rot0[2][0] = -ay * sinf(a) / sqrtf(ax * ax + ay * ay);
133+ rot0[2][1] = -ax * sinf(a) / sqrtf(ax * ax + ay * ay);
134+ rot0[2][2] = cosf(a);
135+ /**/
136+ for (i = 0; i < 3; i++) for (j = 0; j < 3; j++) rot1[i][j] = rot[i][j];
137+ /**/
138+ for (i = 0; i < 3; i++) {
139+ for (j = 0; j < 3; j++) {
140+ rot[i][j] = rot0[i][0] * rot1[0][j]
141+ + rot0[i][1] * rot1[1][j]
142+ + rot0[i][2] * rot1[2][j];
143+ }
144+ }
191145 }
192146 }
147+ else if (lmouse == 2) {
148+ scl = scl * expf(-dy);
149+ }
150+ else {
151+ trans[0] = trans[0] + dx;
152+ trans[1] = trans[1] - dy;
153+ }
154+ Refresh(false);
193155 }
156+ last_x = event.GetX();
157+ last_y = event.GetY();
194158 }
195- else if (lmouse == 2) {
196- scl = scl * expf(-dy);
159+ else
160+ {
161+ dragging = 0;
197162 }
198- else {
199- trans[0] = trans[0] + dx;
200- trans[1] = trans[1] - dy;
163+
164+ wheel = event.GetWheelRotation();
165+ if (wheel > 0) {
166+ scl = scl * 1.1f;
167+ Refresh(false);
201168 }
202- cx = x;
203- cy = y;
204-} /* motion */
169+ else if (wheel < 0) {
170+ scl = scl * 0.9f;
171+ Refresh(false);
172+ }
173+}
205174 /**
206175 @brief Glut special key function
207176
208177 Modify : ::trans
209178 */
210-void special_key(
211- int key, //!< [in] typed special key
212- int x, //!< [in]
213- int y //!< [in]
214-)
179+void TestGLCanvas::OnChar(wxKeyEvent& event)
215180 {
216- switch (key) {
217- case GLUT_KEY_UP:
218- trans[1] = trans[1] + 0.1f;
219- display();
220- break;
221- case GLUT_KEY_DOWN:
222- trans[1] = trans[1] - 0.1f;
223- display();
181+ switch (event.GetKeyCode())
182+ {
183+ case WXK_LEFT:
184+ trans[0] = trans[0] - 0.1f;
185+ Refresh(false);
224186 break;
225- case GLUT_KEY_RIGHT:
226- /**/
187+
188+ case WXK_RIGHT:
227189 trans[0] = trans[0] + 0.1f;
228- display();
190+ Refresh(false);
229191 break;
230- /**/
231- case GLUT_KEY_LEFT:
232- /**/
233- trans[0] = trans[0] - 0.1f;
234- display();
192+
193+ case WXK_UP:
194+ trans[1] = trans[1] + 0.1f;
195+ Refresh(false);
196+ break;
197+
198+ case WXK_DOWN:
199+ trans[1] = trans[1] - 0.1f;
200+ Refresh(false);
235201 break;
236- /**/
202+
203+ default:
204+ event.Skip();
205+ return;
237206 }
238-} /* special_key */
207+
208+ Refresh(false);
209+}
210+
211+void TestGLCanvas::InitGL()
212+{
213+ // Make the new context current (activate it for use) with this canvas.
214+ SetCurrent(*m_glRC);
215+
216+ glClearColor(0.0, 0.0, 0.0, 0.0);
217+ glEnable(GL_DEPTH_TEST);
218+ glEnable(GL_LIGHTING);
219+ glLightModelf(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE);
220+ glEnable(GL_LIGHT0);
221+ glEnable(GL_LIGHT1);
222+ glEnable(GL_NORMALIZE);
223+ glEnableClientState(GL_VERTEX_ARRAY);
224+ glEnableClientState(GL_NORMAL_ARRAY);
225+ glEnableClientState(GL_COLOR_ARRAY);
226+ glEnable(GL_COLOR_MATERIAL);
227+}
228+
229+TestGLCanvas::TestGLCanvas(wxWindow* parent,
230+ wxWindowID id,
231+ int* gl_attrib)
232+ : wxGLCanvas(parent, id, gl_attrib)
233+{
234+ // Explicitly create a new rendering context instance for this canvas.
235+ m_glRC = new wxGLContext(this);
236+}
237+
238+TestGLCanvas::~TestGLCanvas()
239+{
240+ delete m_glRC;
241+}
--- a/src/operation.hpp
+++ b/src/operation.hpp
@@ -21,19 +21,32 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2121 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2222 THE SOFTWARE.
2323 */
24+#ifndef _OPERATOR_H_
25+#define _OPERATOR_H_
2426
25-void resize(
26- int w /**<[in] Window width*/,
27- int h /**<[in] Window height*/);
28-void mouse(
29- int button /**< [in] pushed button*/,
30- int state /**< [in] down or up or ?*/,
31- int x /**< [in] position of mouse cursor*/,
32- int y /**< [in] position of mouse cursor*/);
33-void motion(
34- int x /**< [in] position of cursor*/,
35- int y /**< [in] position of cursor*/);
36-void special_key(
37- int key /**< [in] typed special key*/,
38- int x /**< [in]*/,
39- int y /**< [in]*/);
27+#include "wx/glcanvas.h"
28+
29+// The OpenGL-enabled canvas
30+class TestGLCanvas : public wxGLCanvas
31+{
32+public:
33+ TestGLCanvas(wxWindow* parent,
34+ wxWindowID id = wxID_ANY,
35+ int* gl_attrib = NULL);
36+
37+ virtual ~TestGLCanvas();
38+
39+ void OnPaint(wxPaintEvent& event);
40+ void OnSize(wxSizeEvent& event);
41+ void OnChar(wxKeyEvent& event);
42+ void OnMouseEvent(wxMouseEvent& event);
43+ void InitGL();
44+
45+private:
46+ wxGLContext* m_glRC;
47+
48+ wxDECLARE_NO_COPY_CLASS(TestGLCanvas);
49+ wxDECLARE_EVENT_TABLE();
50+};
51+
52+#endif // _OPERATOR_H_
--- a/src/read_file.cpp
+++ b/src/read_file.cpp
@@ -34,18 +34,17 @@ THE SOFTWARE.
3434 #if defined(HAVE_CONFIG_H)
3535 #include <config.h>
3636 #endif
37-#if defined(HAVE_GL_GLUT_H)
38-#include <GL/glut.h>
39-#elif defined(HAVE_GLUT_GLUT_H)
40-#include <GLUT/glut.h>
37+#if defined(HAVE_GL_GL_H)
38+#include <GL/gl.h>
39+#elif defined(HAVE_OPENGL_GL_H)
40+#include <OpenGL/gl.h>
4141 #endif
42+#include <wx/wx.h>
4243
4344 /**
4445 @brief Input from Fermi surface file
4546 */
46-int read_file(
47- char *fname//!<[in] Input file name
48-)
47+int read_file()
4948 {
5049 int ib, i, j, i0, i1, i2, ii0, ii1, ii2, ierr, iaxis;
5150 FILE *fp;
@@ -55,8 +54,8 @@ int read_file(
5554 /*
5655 Open input file.
5756 */
58- printf(" Openning %s ...\n", fname);
59- if ((fp = fopen(fname, "r")) == NULL) {
57+ printf(" Openning %s ...\n", frmsf_file_name.mb_str());
58+ if ((fp = fopen(frmsf_file_name.mb_str(), "r")) == NULL) {
6059 printf("file open error!!\n");
6160 printf(" Press any key to exit.\n");
6261 ierr = getchar();
@@ -235,8 +234,8 @@ int read_batch(
235234 char *ctmp;
236235 int ierr, ib, iminmax;
237236
238- printf(" Openning batch file %s ...\n", batch_name);
239- if ((fp = fopen(batch_name, "r")) == NULL) {
237+ printf(" Openning batch file %s ...\n", batch_name.mb_str());
238+ if ((fp = fopen(batch_name.mb_str(), "r")) == NULL) {
240239 printf("file open error!!\n");
241240 printf(" Press any key to exit.\n");
242241 ierr = getchar();
--- a/src/read_file.hpp
+++ b/src/read_file.hpp
@@ -24,14 +24,12 @@ THE SOFTWARE.
2424 #if defined(HAVE_CONFIG_H)
2525 #include <config.h>
2626 #endif
27-#if defined(WIN32)
28-#include <Windows.h>
29-#endif
3027 #if defined(HAVE_GL_GL_H)
3128 #include <GL/gl.h>
3229 #elif defined(HAVE_OPENGL_GL_H)
3330 #include <OpenGL/gl.h>
3431 #endif
32+#include <wx/wx.h>
3533
36-int read_file(char *fname/**<[in] fname Input file name*/);
34+int read_file();
3735 int read_batch(GLfloat minmax[3][2]);
--- a/src/section.cpp
+++ b/src/section.cpp
@@ -28,9 +28,6 @@ THE SOFTWARE.
2828 #if defined(HAVE_CONFIG_H)
2929 #include <config.h>
3030 #endif
31-#if defined(WIN32)
32-#include <Windows.h>
33-#endif
3431 #if defined(HAVE_GL_GL_H)
3532 #include <GL/gl.h>
3633 #elif defined(HAVE_OPENGL_GL_H)
--- a/src/variable.hpp
+++ b/src/variable.hpp
@@ -31,14 +31,12 @@ THE SOFTWARE.
3131 #if defined(HAVE_CONFIG_H)
3232 #include <config.h>
3333 #endif
34-#if defined(WIN32)
35-#include <Windows.h>
36-#endif
3734 #if defined(HAVE_GL_GL_H)
3835 #include <GL/gl.h>
3936 #elif defined(HAVE_OPENGL_GL_H)
4037 #include <OpenGL/gl.h>
4138 #endif
39+#include <wx/wx.h>
4240
4341 /*
4442 Input variables
@@ -169,8 +167,9 @@ extern int nthreads;//!< Number of OpenMP threads
169167 /*
170168 Batch mode
171169 */
172-extern char *window_name;
173-extern char *batch_name;
170+extern wxString window_name;
171+extern wxString batch_name;
172+extern wxString frmsf_file_name;
174173 extern int lbatch;
175174
176175 #endif
Show on old repository browser