Callback: cleanup
authorTimePath <andrew.hardaker1995@gmail.com>
Mon, 1 Jan 2018 05:42:25 +0000 (16:42 +1100)
committerTimePath <andrew.hardaker1995@gmail.com>
Mon, 1 Jan 2018 05:42:25 +0000 (16:42 +1100)
29 files changed:
contrib/shaderplug/shaderplug.cpp
libs/generic/callback.cpp
libs/generic/callback.h
libs/generic/functional.h
plugins/shaders/shaders.cpp
radiant/autosave.cpp
radiant/brushmanip.cpp
radiant/brushmodule.cpp
radiant/camwindow.cpp
radiant/eclass_doom3.cpp
radiant/entity.cpp
radiant/entityinspector.cpp
radiant/filters.cpp
radiant/grid.cpp
radiant/groupdialog.cpp
radiant/mainframe.cpp
radiant/map.cpp
radiant/multimon.cpp
radiant/patchdialog.cpp
radiant/patchmanip.cpp
radiant/pluginmenu.cpp
radiant/points.cpp
radiant/preferences.cpp
radiant/referencecache.cpp
radiant/surfacedialog.cpp
radiant/textures.cpp
radiant/texwindow.cpp
radiant/watchbsp.cpp
radiant/xywindow.cpp

index 7bc9814..9d7bc4c 100644 (file)
@@ -96,8 +96,6 @@ void loadArchiveFile( const char* filename ){
        archives.push_back( filename );
 }
 
-typedef FreeCaller<void(const char*), loadArchiveFile> LoadArchiveFileCaller;
-
 void LoadTextureFile( const char* filename ){
        std::string s_filename = filename;
 
@@ -116,10 +114,8 @@ void LoadTextureFile( const char* filename ){
        }
 }
 
-typedef FreeCaller<void(const char*), LoadTextureFile> LoadTextureFileCaller;
-
 void GetTextures( const char* extension ){
-       GlobalFileSystem().forEachFile( "textures/", extension, LoadTextureFileCaller(), 0 );
+       GlobalFileSystem().forEachFile("textures/", extension, makeCallbackF(LoadTextureFile), 0);
 }
 
 void LoadShaderList( const char* filename ){
@@ -128,14 +124,12 @@ void LoadShaderList( const char* filename ){
        }
 }
 
-typedef FreeCaller<void(const char*), LoadShaderList> LoadShaderListCaller;
-
 void GetAllShaders(){
-       GlobalShaderSystem().foreachShaderName( LoadShaderListCaller() );
+       GlobalShaderSystem().foreachShaderName(makeCallbackF(LoadShaderList));
 }
 
 void GetArchiveList(){
-       GlobalFileSystem().forEachArchive( LoadArchiveFileCaller() );
+       GlobalFileSystem().forEachArchive(makeCallbackF(loadArchiveFile));
        globalOutputStream() << "Shaderplug: " << (const Unsigned)Shaderplug::archives.size() << " archives found.\n";
 }
 
index 4776f57..423efce 100644 (file)
@@ -153,10 +153,8 @@ typedef ConstMember<Test, void(A1, A2, A3), &Test::test3const> Test3Const;
 
 void test0free(){
 }
-typedef FreeCaller<void(), &test0free> Test0FreeCaller;
 void test1free( A1 ){
 }
-typedef FreeCaller<void(A1), &test1free> Test1FreeCaller;
 void test2free( A1, A2 ){
 }
 typedef Function<void(A1, A2), &test2free> Test2Free;
@@ -209,7 +207,7 @@ void instantiate(){
        Test test;
        const Test& testconst = test;
        {
-               Callback<void()> a = Test0FreeCaller();
+               Callback<void()> a = makeCallbackF(&test0free)();
                Callback<void()> b = Test::Test0Caller( test );
                b = makeCallback( Test::Test0(), test );
                Callback<void()> c = Test::Test0ConstCaller( testconst );
@@ -223,7 +221,7 @@ void instantiate(){
        }
        {
                typedef Callback<void(A1)> TestCallback1;
-               TestCallback1 a = Test1FreeCaller();
+               TestCallback1 a = makeCallbackF(&test1free));
                TestCallback1 b = Test::Test1Caller( test );
                b = makeCallback( Test::Test1(), test );
                TestCallback1 c = Test::Test1ConstCaller( testconst );
index 9a1c9b1..03689e8 100644 (file)
 #include <cstddef>
 #include "functional.h"
 
-template<typename Type>
-inline void* convertToOpaque( Type* t ){
-       return t;
-}
-template<typename Type>
-inline void* convertToOpaque( const Type* t ){
-       return const_cast<Type*>( t );
-}
-template<typename Type>
-inline void* convertToOpaque( Type& t ){
-       return &t;
-}
-template<typename Type>
-inline void* convertToOpaque( const Type& t ){
-       return const_cast<Type*>( &t );
-}
-
+namespace detail {
 
-template<typename Type>
-class ConvertFromOpaque
-{
-};
+       template<typename Thunk_>
+       class CallbackBase {
+               void *m_environment;
+               Thunk_ m_thunk;
+       public:
+               typedef Thunk_ Thunk;
 
-template<typename Type>
-class ConvertFromOpaque<Type&>
-{
-public:
-static Type& apply( void* p ){
-       return *static_cast<Type*>( p );
-}
-};
+               CallbackBase(void *environment, Thunk function) : m_environment(environment), m_thunk(function) {
+               }
 
-template<typename Type>
-class ConvertFromOpaque<const Type&>
-{
-public:
-static const Type& apply( void* p ){
-       return *static_cast<Type*>( p );
-}
-};
+               void *getEnvironment() const {
+                       return m_environment;
+               }
 
+               Thunk getThunk() const {
+                       return m_thunk;
+               }
+       };
 
-template<typename Type>
-class ConvertFromOpaque<Type*>
-{
-public:
-static Type* apply( void* p ){
-       return static_cast<Type*>( p );
-}
-};
+       template<typename Thunk>
+       inline bool operator==(const CallbackBase<Thunk> &self, const CallbackBase<Thunk> &other) {
+               return self.getEnvironment() == other.getEnvironment() && self.getThunk() == other.getThunk();
+       }
 
-template<typename Type>
-class ConvertFromOpaque<const Type*>
-{
-public:
-static const Type* apply( void* p ){
-       return static_cast<Type*>( p );
-}
-};
+       template<typename Thunk>
+       inline bool operator!=(const CallbackBase<Thunk> &self, const CallbackBase<Thunk> &other) {
+               return !(self == other);
+       }
 
-template<typename Thunk_>
-class CallbackBase
-{
-void* m_environment;
-Thunk_ m_thunk;
-public:
-typedef Thunk_ Thunk;
-CallbackBase( void* environment, Thunk function ) : m_environment( environment ), m_thunk( function ){
-}
-void* getEnvironment() const {
-       return m_environment;
-}
-Thunk getThunk() const {
-       return m_thunk;
-}
-};
+       template<typename Thunk>
+       inline bool operator<(const CallbackBase<Thunk> &self, const CallbackBase<Thunk> &other) {
+               return self.getEnvironment() < other.getEnvironment() ||
+                          (!(other.getEnvironment() < self.getEnvironment()) && self.getThunk() < other.getThunk());
+       }
 
-template<typename Thunk>
-inline bool operator==( const CallbackBase<Thunk>& self, const CallbackBase<Thunk>& other ){
-       return self.getEnvironment() == other.getEnvironment() && self.getThunk() == other.getThunk();
-}
-template<typename Thunk>
-inline bool operator!=( const CallbackBase<Thunk>& self, const CallbackBase<Thunk>& other ){
-       return !( self == other );
-}
-template<typename Thunk>
-inline bool operator<( const CallbackBase<Thunk>& self, const CallbackBase<Thunk>& other ){
-       return self.getEnvironment() < other.getEnvironment() ||
-                  ( !( other.getEnvironment() < self.getEnvironment() ) && self.getThunk() < other.getThunk() );
 }
 
-template<class Caller, class F>
-class BindFirstOpaqueN;
+namespace detail {
 
-template<class Caller, class R, class FirstBound, class... Ts>
-class BindFirstOpaqueN<Caller, R(FirstBound, Ts...)> {
-       FirstBound firstBound;
-public:
-       explicit BindFirstOpaqueN(FirstBound firstBound) : firstBound(firstBound) {
+       template<typename Type>
+       inline void *convertToOpaque(Type *t) {
+               return t;
        }
 
-       R operator()(Ts... args) const {
-               return Caller::call(firstBound, args...);
+       template<typename Type>
+       inline void *convertToOpaque(const Type *t) {
+               return const_cast<Type *>( t );
        }
 
-       FirstBound getBound() const {
-               return firstBound;
+       template<typename Type>
+       inline void *convertToOpaque(Type &t) {
+               return &t;
        }
 
-       static R thunk(void *environment, Ts... args) {
-               return Caller::call(ConvertFromOpaque<FirstBound>::apply(environment), args...);
+       template<typename Type>
+       inline void *convertToOpaque(const Type &t) {
+               return const_cast<Type *>( &t );
        }
 
-       void *getEnvironment() const {
-               return convertToOpaque(firstBound);
-       }
-};
+
+       template<typename Type>
+       class ConvertFromOpaque {
+       };
+
+       template<typename Type>
+       class ConvertFromOpaque<Type &> {
+       public:
+               static Type &apply(void *p) {
+                       return *static_cast<Type *>( p );
+               }
+       };
+
+       template<typename Type>
+       class ConvertFromOpaque<const Type &> {
+       public:
+               static const Type &apply(void *p) {
+                       return *static_cast<Type *>( p );
+               }
+       };
+
+
+       template<typename Type>
+       class ConvertFromOpaque<Type *> {
+       public:
+               static Type *apply(void *p) {
+                       // illegal cast
+                       return reinterpret_cast<Type *>( p );
+               }
+       };
+
+       template<typename Type>
+       class ConvertFromOpaque<const Type *> {
+       public:
+               static const Type *apply(void *p) {
+                       return static_cast<Type *>( p );
+               }
+       };
+
+       template<class Caller, class F>
+       class BindFirstOpaqueN;
+
+       template<class Caller, class R, class FirstBound, class... Ts>
+       class BindFirstOpaqueN<Caller, R(FirstBound, Ts...)> {
+               FirstBound firstBound;
+       public:
+               explicit BindFirstOpaqueN(FirstBound firstBound) : firstBound(firstBound) {
+               }
+
+               R operator()(Ts... args) const {
+                       return Caller::call(firstBound, args...);
+               }
+
+               FirstBound getBound() const {
+                       return firstBound;
+               }
+
+               static R thunk(void *environment, Ts... args) {
+                       return Caller::call(detail::ConvertFromOpaque<FirstBound>::apply(environment), args...);
+               }
+
+               void *getEnvironment() const {
+                       return detail::convertToOpaque(firstBound);
+               }
+       };
+
+}
 
 template<class Caller>
-using BindFirstOpaque = BindFirstOpaqueN<Caller, get_func<Caller>>;
+using BindFirstOpaque = detail::BindFirstOpaqueN<Caller, get_func<Caller>>;
 
 /// \brief Combines a void pointer with a pointer to a function which operates on a void pointer.
 ///
@@ -156,8 +167,8 @@ template<class F>
 class Callback;
 
 template<class R, class... Ts>
-class Callback<R(Ts...)> : public CallbackBase<R(*)(void *, Ts...)> {
-       using Base = CallbackBase<R (*)(void *, Ts...)>;
+class Callback<R(Ts...)> : public detail::CallbackBase<R(*)(void *, Ts...)> {
+       using Base = detail::CallbackBase<R (*)(void *, Ts...)>;
 
        static R nullThunk(void *, Ts...) {
        }
@@ -201,89 +212,109 @@ namespace detail {
                template <class Unshift>
                using unshift = Arglist<R(Unshift, Ts...)>;
        };
+
+       template<class F>
+       using ArgShift = typename detail::Arglist<F>::shift::type;
+
+       template<class F, class T>
+       using ArgUnshift = typename detail::Arglist<F>::template unshift<T>::type;
 }
 
 template<typename Caller>
-inline Callback<typename detail::Arglist<get_func<Caller>>::shift::type> makeCallback(const Caller &caller, get_argument<Caller, 0> callee) {
-       return Callback<typename detail::Arglist<get_func<Caller>>::shift::type>(BindFirstOpaque<Caller>(callee));
+inline Callback<detail::ArgShift<get_func<Caller>>> makeCallback(const Caller &caller, get_argument<Caller, 0> callee) {
+       return BindFirstOpaque<Caller>(callee);
 }
 
+template<class Caller, class F>
+class CallerShiftFirst;
+
+template<class Caller, class R, class FirstArgument, class... Ts>
+class CallerShiftFirst<Caller, R(FirstArgument, Ts...)> {
+public:
+       using func = R(FirstArgument, Ts...);
+
+       static R call(FirstArgument, Ts... args) {
+               return Caller::call(args...);
+       }
+};
+
 template<typename Caller>
 inline Callback<get_func<Caller>> makeStatelessCallback(const Caller &caller) {
-       return makeCallback(CallerShiftFirst<Caller, typename detail::Arglist<get_func<Caller>>::template unshift<void *>::type>(), nullptr);
+       return makeCallback(CallerShiftFirst<Caller, detail::ArgUnshift<get_func<Caller>, void *>>(), nullptr);
 }
 
 /// \brief Forms a Callback from a non-const Environment reference and a non-const Environment member-function.
-///
-/// \dontinclude generic/callback.cpp
-/// \skipline MemberCaller0 example
-/// \until end example
-
 template<class Environment, class F, MemberFunction<Environment, F> member>
-using MemberCaller = BindFirstOpaque<typename MemberN<Environment, F>::template instance<member>>;
+using MemberCaller = BindFirstOpaque<Member<Environment, F, member>>;
 
-/// \brief Forms a Callback from a const Environment reference and a const Environment member-function.
+/// \brief  Constructs a Callback1 from a non-const \p functor
 ///
-/// \dontinclude generic/callback.cpp
-/// \skipline MemberCaller0 example
-/// \until end example
+/// \param Functor Must define \c first_argument_type and \c operator()(first_argument_type).
+template<typename Functor>
+inline Callback<get_func<Functor>> makeCallback(Functor &functor) {
+       return MemberCaller<Functor, get_func<Functor>, &Functor::operator()>(functor);
+}
+
+/// \brief Forms a Callback from a const Environment reference and a const Environment member-function.
 template<class Environment, class F, ConstMemberFunction<Environment, F> member>
-using ConstMemberCaller = BindFirstOpaque<typename ConstMemberN<Environment, F>::template instance<member>>;
+using ConstMemberCaller = BindFirstOpaque<ConstMember<Environment, F, member>>;
 
-/// \brief Forms a Callback from a non-const Environment reference and a free function which operates on a non-const Environment reference.
+/// \brief  Constructs a Callback1 from a const \p functor
 ///
-/// \dontinclude generic/callback.cpp
-/// \skipline ReferenceCaller0 example
-/// \until end example
-template<class Environment, class F, typename detail::Arglist<F>::template unshift<Environment &>::type *func>
-using ReferenceCaller = BindFirstOpaque<typename FunctionN<typename detail::Arglist<F>::template unshift<Environment &>::type>::template instance<func>>;
+/// \param Functor Must define \c first_argument_type and const \c operator()(first_argument_type).
+template<typename Functor>
+inline Callback<get_func<Functor>> makeCallback(const Functor &functor) {
+       return ConstMemberCaller<Functor, get_func<Functor>, &Functor::operator()>(functor);
+}
+
+/// \brief Forms a Callback from a non-const Environment reference and a free function which operates on a non-const Environment reference.
+template<class Environment, class F, detail::ArgUnshift<F, Environment &> *func>
+using ReferenceCaller = BindFirstOpaque<Function<detail::ArgUnshift<F, Environment &>, func>>;
 
 /// \brief Forms a Callback from a const Environment reference and a free function which operates on a const Environment reference.
-///
-/// \dontinclude generic/callback.cpp
-/// \skipline ReferenceCaller0 example
-/// \until end example
-template<class Environment, class F, typename detail::Arglist<F>::template unshift<const Environment &>::type *func>
-using ConstReferenceCaller = BindFirstOpaque<typename FunctionN<typename detail::Arglist<F>::template unshift<const Environment &>::type>::template instance<func>>;
+template<class Environment, class F, detail::ArgUnshift<F, const Environment &> *func>
+using ConstReferenceCaller = BindFirstOpaque<Function<detail::ArgUnshift<F, const Environment &>, func>>;
 
 /// \brief Forms a Callback from a non-const Environment pointer and a free function which operates on a non-const Environment pointer.
-template<class Environment, class F, typename detail::Arglist<F>::template unshift<Environment *>::type *func>
-using PointerCaller = BindFirstOpaque<typename FunctionN<typename detail::Arglist<F>::template unshift<Environment *>::type>::template instance<func>>;
+template<class Environment, class F, detail::ArgUnshift<F, Environment *> *func>
+using PointerCaller = BindFirstOpaque<Function<detail::ArgUnshift<F, Environment *>, func>>;
 
 /// \brief Forms a Callback from a const Environment pointer and a free function which operates on a const Environment pointer.
-template<class Environment, class F, typename detail::Arglist<F>::template unshift<const Environment *>::type *func>
-using ConstPointerCaller = BindFirstOpaque<typename FunctionN<typename detail::Arglist<F>::template unshift<const Environment *>::type>::template instance<func>>;
+template<class Environment, class F, detail::ArgUnshift<F, const Environment *> *func>
+using ConstPointerCaller = BindFirstOpaque<Function<detail::ArgUnshift<F, const Environment *>, func>>;
+
+namespace detail {
+       template<class Caller, class F>
+       class FreeCaller : public BindFirstOpaque<CallerShiftFirst<Caller, detail::ArgUnshift<F, void *>>> {
+       public:
+               FreeCaller() : BindFirstOpaque<CallerShiftFirst<Caller, detail::ArgUnshift<F, void *>>>(nullptr) {
+               }
+       };
+
+       template <class F>
+       struct freecallwrapper;
+
+       template <class R, class... Ts>
+       struct freecallwrapper<R(Ts...)> {
+               using func = R(R(Ts...), Ts...);
+               static R call(R(*f)(Ts...), Ts... args) {
+                       // ideally, we'd get the implementation of the function type directly. Instead, it's passed in
+                       return f(args...);
+               }
+       };
+}
 
 /// \brief Forms a Callback from a free function
 template<class F, F *func>
-class FreeCaller : public BindFirstOpaque<CallerShiftFirst<
-        typename FunctionN<F>::template instance<func>,
-        typename detail::Arglist<F>::template unshift<void *>::type
->> {
-public:
-    FreeCaller()
-            : BindFirstOpaque<CallerShiftFirst<
-            typename FunctionN<F>::template instance<func>,
-            typename detail::Arglist<F>::template unshift<void *>::type
-    >>(nullptr) {
-    }
-};
+using FreeCaller = detail::FreeCaller<Function<F, func>, F>;
 
-/// \brief  Constructs a Callback1 from a non-const \p functor
-///
-/// \param Functor Must define \c first_argument_type and \c operator()(first_argument_type).
-template<typename Functor>
-inline Callback<get_func<Functor>> makeCallback(Functor &functor) {
-       return Callback<get_func<Functor>>(MemberCaller<Functor, get_func<Functor>, &Functor::operator()>(functor));
+template<class F>
+inline Callback<F> makeCallbackF(F *func) {
+       // illegal cast
+       return Callback<F>(reinterpret_cast<void *>(func), BindFirstOpaque<detail::freecallwrapper<F>>::thunk);
 }
 
-/// \brief  Constructs a Callback1 from a const \p functor
-///
-/// \param Functor Must define \c first_argument_type and const \c operator()(first_argument_type).
-template<typename Functor>
-inline Callback<get_func<Functor>> makeCallback(const Functor &functor) {
-       return Callback<get_func<Functor>>(ConstMemberCaller<Functor, get_func<Functor>, &Functor::operator()>(functor));
-}
+// todo: remove
 
 using BoolImportCallback = Callback<void(bool)>;
 using BoolExportCallback = Callback<void(const BoolImportCallback&)>;
index 67161ff..2b4fe1b 100644 (file)
@@ -73,6 +73,30 @@ template<class Caller, int N>
 using get_argument = typename detail::Fn<get_func<Caller>>::template get<N>;
 
 namespace detail {
+
+    template<class F>
+    class FunctionN;
+
+    template<class R, class... Ts>
+    class FunctionN<R(Ts...)> {
+    public:
+        template<R(*f)(Ts...)>
+        class instance {
+        public:
+            using func = R(Ts...);
+
+            static R call(Ts... args) {
+                return (f)(args...);
+            }
+        };
+    };
+
+}
+
+template<class F, F *func>
+using Function = typename detail::FunctionN<F>::template instance<func>;
+
+namespace detail {
     template<class Object, class F>
     struct MemberFunction;
 
@@ -83,87 +107,57 @@ namespace detail {
     };
 }
 
-template<class Object, class F>
-using MemberFunction = typename detail::MemberFunction<Object, F>::type;
-
-template<class Object, class F>
-using ConstMemberFunction = typename detail::MemberFunction<Object, F>::type_const;
-
-template<class Object, class F>
-class MemberN;
+namespace detail {
+    template<class Object, class F>
+    class MemberN;
 
-template<class Object, class R, class... Ts>
-class MemberN<Object, R(Ts...)> {
-public:
-    template<R(Object::*f)(Ts...)>
-    class instance {
+    template<class Object, class R, class... Ts>
+    class MemberN<Object, R(Ts...)> {
     public:
-        using func = R(Object &, Ts...);
-
-        static R call(Object &object, Ts... args) {
-            return (object.*f)(args...);
-        }
+        template<R(Object::*f)(Ts...)>
+        class instance {
+        public:
+            using func = R(Object &, Ts...);
+
+            static R call(Object &object, Ts... args) {
+                return (object.*f)(args...);
+            }
+        };
     };
-};
-
-template<class Object, class F, MemberFunction<Object, F> func>
-using Member = typename MemberN<Object, F>::template instance<func>;
+}
 
 template<class Object, class F>
-class ConstMemberN;
-
-template<class Object, class R, class... Ts>
-class ConstMemberN<Object, R(Ts...)> {
-public:
-    template<R(Object::*f)(Ts...) const>
-    class instance {
-    public:
-        using func = R(const Object &, Ts...);
-
-        static R call(const Object &object, Ts... args) {
-            return (object.*f)(args...);
-        }
-    };
-};
+using MemberFunction = typename detail::MemberFunction<Object, F>::type;
 
-template<class Object, class F, ConstMemberFunction<Object, F> func>
-using ConstMember = typename ConstMemberN<Object, F>::template instance<func>;
+template<class Object, class F, MemberFunction<Object, F> func>
+using Member = typename detail::MemberN<Object, F>::template instance<func>;
 
-template<class F>
-class FunctionN;
+namespace detail {
+    template<class Object, class F>
+    class ConstMemberN;
 
-template<class R, class... Ts>
-class FunctionN<R(Ts...)> {
-public:
-    template<R(*f)(Ts...)>
-    class instance {
+    template<class Object, class R, class... Ts>
+    class ConstMemberN<Object, R(Ts...)> {
     public:
-        using func = R(Ts...);
-
-        static R call(Ts... args) {
-            return (f)(args...);
-        }
+        template<R(Object::*f)(Ts...) const>
+        class instance {
+        public:
+            using func = R(const Object &, Ts...);
+
+            static R call(const Object &object, Ts... args) {
+                return (object.*f)(args...);
+            }
+        };
     };
-};
-
-template<class F, F *func>
-using Function = typename FunctionN<F>::template instance<func>;
-
-template<class Caller, class F>
-class CallerShiftFirst;
+}
 
-template<class Caller, class R, class FirstArgument, class... Ts>
-class CallerShiftFirst<Caller, R(FirstArgument, Ts...)> {
-public:
-    using func = R(FirstArgument, Ts...);
+template<class Object, class F>
+using ConstMemberFunction = typename detail::MemberFunction<Object, F>::type_const;
 
-    static R call(FirstArgument, Ts... args) {
-        return Caller::call(args...);
-    }
-};
+template<class Object, class F, ConstMemberFunction<Object, F> func>
+using ConstMember = typename detail::ConstMemberN<Object, F>::template instance<func>;
 
-template<class Functor, class F>
-class FunctorNInvoke;
+// misc
 
 namespace detail {
     template<int ...>
@@ -181,33 +175,36 @@ namespace detail {
 
     template<int N>
     using seq_new = typename gens<N>::type;
-}
 
-template<class Functor, class R, class... Ts>
-class FunctorNInvoke<Functor, R(Ts...)> {
-    std::tuple<Ts...> args;
+    template<class Functor, class F>
+    class FunctorNInvoke;
 
-    template<class T>
-    struct caller;
+    template<class Functor, class R, class... Ts>
+    class FunctorNInvoke<Functor, R(Ts...)> {
+        std::tuple<Ts...> args;
 
-    template<int ...I>
-    struct caller<detail::seq<I...>> {
-        static inline R call(FunctorNInvoke<Functor, R(Ts...)> *self, Functor functor) {
-            (void) self;
-            return functor(std::get<I>(self->args)...);
-        }
-    };
+        template<class T>
+        struct caller;
+
+        template<int ...I>
+        struct caller<seq<I...>> {
+            static inline R call(FunctorNInvoke<Functor, R(Ts...)> *self, Functor functor) {
+                (void) self;
+                return functor(std::get<I>(self->args)...);
+            }
+        };
 
-public:
-    FunctorNInvoke(Ts... args) : args(args...) {
-    }
+    public:
+        FunctorNInvoke(Ts... args) : args(args...) {
+        }
 
-    inline R operator()(Functor functor) {
-        return caller<detail::seq_new<sizeof...(Ts)>>::call(this, functor);
-    }
-};
+        inline R operator()(Functor functor) {
+            return caller<seq_new<sizeof...(Ts)>>::call(this, functor);
+        }
+    };
+}
 
 template<class Functor>
-using FunctorInvoke = FunctorNInvoke<Functor, get_func<Functor>>;
+using FunctorInvoke = detail::FunctorNInvoke<Functor, get_func<Functor>>;
 
 #endif
index 6a1ec96..0499bee 100644 (file)
@@ -1442,9 +1442,6 @@ void LoadShaderFile( const char* filename ){
        }
 }
 
-typedef FreeCaller<void(const char*), LoadShaderFile> LoadShaderFileCaller;
-
-
 void loadGuideFile( const char* filename ){
        StringOutputStream fullname( 256 );
        fullname << "guides/" << filename;
@@ -1466,9 +1463,6 @@ void loadGuideFile( const char* filename ){
        }
 }
 
-typedef FreeCaller<void(const char*), loadGuideFile> LoadGuideFileCaller;
-
-
 CShader* Try_Shader_ForName( const char* name ){
        {
                shaders_t::iterator i = g_ActiveShaders.find( name );
@@ -1567,9 +1561,6 @@ void ShaderList_addShaderFile( const char* dirstring ){
        }
 }
 
-typedef FreeCaller<void(const char*), ShaderList_addShaderFile> AddShaderFileCaller;
-
-
 /*
    ==================
    BuildShaderList
@@ -1624,8 +1615,6 @@ void ShaderList_addFromArchive( const char *archivename ){
        }
 }
 
-typedef FreeCaller<void(const char *), ShaderList_addFromArchive> AddShaderListFromArchiveCaller;
-
 #include "stream/filestream.h"
 
 bool shaderlist_findOrInstall( const char* enginePath, const char* toolsPath, const char* shaderPath, const char* gamename ){
@@ -1653,7 +1642,7 @@ bool shaderlist_findOrInstall( const char* enginePath, const char* toolsPath, co
 
 void Shaders_Load(){
        if ( g_shaderLanguage == SHADERLANGUAGE_QUAKE4 ) {
-               GlobalFileSystem().forEachFile( "guides/", "guide", LoadGuideFileCaller(), 0 );
+               GlobalFileSystem().forEachFile("guides/", "guide", makeCallbackF(loadGuideFile), 0);
        }
 
        const char* shaderPath = GlobalRadiant().getGameDescriptionKeyValue( "shaderpath" );
@@ -1675,12 +1664,12 @@ void Shaders_Load(){
                                shaderlist_findOrInstall( enginePath, toolsPath, path.c_str(), gamename );
                        }
 
-                       GlobalFileSystem().forEachArchive( AddShaderListFromArchiveCaller(), false, true );
+                       GlobalFileSystem().forEachArchive(makeCallbackF(ShaderList_addFromArchive), false, true);
                        DumpUnreferencedShaders();
                }
                else
                {
-                       GlobalFileSystem().forEachFile( path.c_str(), g_shadersExtension, AddShaderFileCaller(), 0 );
+                       GlobalFileSystem().forEachFile(path.c_str(), g_shadersExtension, makeCallbackF(ShaderList_addShaderFile), 0);
                }
 
                GSList *lst = l_shaderfiles;
index 5cb91ea..effb111 100644 (file)
@@ -186,7 +186,7 @@ void Autosave_constructPage( PreferenceGroup& group ){
        Autosave_constructPreferences( page );
 }
 void Autosave_registerPreferencesPage(){
-       PreferencesDialog_addSettingsPage( FreeCaller<void(PreferenceGroup&), Autosave_constructPage>() );
+       PreferencesDialog_addSettingsPage(makeCallbackF(Autosave_constructPage));
 }
 
 
index 528341d..0e190e6 100644 (file)
@@ -1216,7 +1216,7 @@ void Texdef_ToggleMoveLock(){
 
 
 void Brush_registerCommands(){
-       GlobalToggles_insert( "TogTexLock", FreeCaller<void(), Texdef_ToggleMoveLock>(), ToggleItem::AddCallbackCaller( g_texdef_movelock_item ), Accelerator( 'T', (GdkModifierType)GDK_SHIFT_MASK ) );
+       GlobalToggles_insert( "TogTexLock", makeCallbackF(Texdef_ToggleMoveLock), ToggleItem::AddCallbackCaller( g_texdef_movelock_item ), Accelerator( 'T', (GdkModifierType)GDK_SHIFT_MASK ) );
 
        GlobalCommands_insert( "BrushPrism", BrushPrefab::SetCaller( g_brushprism ) );
        GlobalCommands_insert( "BrushCone", BrushPrefab::SetCaller( g_brushcone ) );
@@ -1231,12 +1231,12 @@ void Brush_registerCommands(){
        GlobalCommands_insert( "Brush8Sided", BrushMakeSided::SetCaller( g_brushmakesided8 ), Accelerator( '8', (GdkModifierType)GDK_CONTROL_MASK ) );
        GlobalCommands_insert( "Brush9Sided", BrushMakeSided::SetCaller( g_brushmakesided9 ), Accelerator( '9', (GdkModifierType)GDK_CONTROL_MASK ) );
 
-       GlobalCommands_insert( "ClipSelected", FreeCaller<void(), ClipSelected>(), Accelerator( GDK_KEY_Return ) );
-       GlobalCommands_insert( "SplitSelected", FreeCaller<void(), SplitSelected>(), Accelerator( GDK_KEY_Return, (GdkModifierType)GDK_SHIFT_MASK ) );
-       GlobalCommands_insert( "FlipClip", FreeCaller<void(), FlipClipper>(), Accelerator( GDK_KEY_Return, (GdkModifierType)GDK_CONTROL_MASK ) );
+       GlobalCommands_insert( "ClipSelected", makeCallbackF(ClipSelected), Accelerator( GDK_KEY_Return ) );
+       GlobalCommands_insert( "SplitSelected", makeCallbackF(SplitSelected), Accelerator( GDK_KEY_Return, (GdkModifierType)GDK_SHIFT_MASK ) );
+       GlobalCommands_insert( "FlipClip", makeCallbackF(FlipClipper), Accelerator( GDK_KEY_Return, (GdkModifierType)GDK_CONTROL_MASK ) );
 
-       GlobalCommands_insert( "MakeDetail", FreeCaller<void(), Select_MakeDetail>(), Accelerator( 'M', (GdkModifierType)GDK_CONTROL_MASK ) );
-       GlobalCommands_insert( "MakeStructural", FreeCaller<void(), Select_MakeStructural>(), Accelerator( 'S', (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) );
+       GlobalCommands_insert( "MakeDetail", makeCallbackF(Select_MakeDetail), Accelerator( 'M', (GdkModifierType)GDK_CONTROL_MASK ) );
+       GlobalCommands_insert( "MakeStructural", makeCallbackF(Select_MakeStructural), Accelerator( 'S', (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) );
 }
 
 void Brush_constructMenu( ui::Menu menu ){
index bd51cf5..02e5416 100644 (file)
@@ -45,18 +45,16 @@ bool getTextureLockEnabled(){
 void Face_importSnapPlanes( bool value ){
        Face::m_quantise = value ? quantiseInteger : quantiseFloating;
 }
-typedef FreeCaller<void(bool), Face_importSnapPlanes> FaceImportSnapPlanesCaller;
 
 void Face_exportSnapPlanes( const BoolImportCallback& importer ){
        importer( Face::m_quantise == quantiseInteger );
 }
-typedef FreeCaller<void(const BoolImportCallback&), Face_exportSnapPlanes> FaceExportSnapPlanesCaller;
 
 void Brush_constructPreferences( PreferencesPage& page ){
        page.appendCheckBox(
                "", "Snap planes to integer grid",
-               FaceImportSnapPlanesCaller(),
-               FaceExportSnapPlanesCaller()
+               makeCallbackF(Face_importSnapPlanes),
+               makeCallbackF(Face_exportSnapPlanes)
                );
        page.appendEntry(
                "Default texture scale",
@@ -80,7 +78,7 @@ void Brush_constructPage( PreferenceGroup& group ){
        Brush_constructPreferences( page );
 }
 void Brush_registerPreferencesPage(){
-       PreferencesDialog_addSettingsPage( FreeCaller<void(PreferenceGroup&), Brush_constructPage>() );
+       PreferencesDialog_addSettingsPage( makeCallbackF(Brush_constructPage) );
 }
 
 void Brush_unlatchPreferences(){
@@ -155,11 +153,11 @@ void Brush_Construct( EBrushType type ){
        }
 
        GlobalPreferenceSystem().registerPreference( "TextureLock", BoolImportStringCaller( g_brush_texturelock_enabled ), BoolExportStringCaller( g_brush_texturelock_enabled ) );
-       GlobalPreferenceSystem().registerPreference( "BrushSnapPlanes", makeBoolStringImportCallback( FaceImportSnapPlanesCaller() ), makeBoolStringExportCallback( FaceExportSnapPlanesCaller() ) );
+       GlobalPreferenceSystem().registerPreference( "BrushSnapPlanes", makeBoolStringImportCallback( FreeCaller<void(bool), Face_importSnapPlanes>() ), makeBoolStringExportCallback( FreeCaller<void(const BoolImportCallback&), Face_exportSnapPlanes>() ) );
        GlobalPreferenceSystem().registerPreference( "TexdefDefaultScale", FloatImportStringCaller( g_texdef_default_scale ), FloatExportStringCaller( g_texdef_default_scale ) );
 
        GridStatus_getTextureLockEnabled = getTextureLockEnabled;
-       g_texture_lock_status_changed = FreeCaller<void(), GridStatus_onTextureLockEnabledChanged>();
+       g_texture_lock_status_changed = makeCallbackF(GridStatus_onTextureLockEnabledChanged);
 }
 
 void Brush_Destroy(){
index c505b1b..273f2b0 100644 (file)
@@ -1391,14 +1391,12 @@ void render( const Matrix4& modelview, const Matrix4& projection ){
 void ShowStatsToggle(){
        g_camwindow_globals_private.m_showStats ^= 1;
 }
-typedef FreeCaller<void(), ShowStatsToggle> ShowStatsToggleCaller;
 
 void ShowStatsExport( const BoolImportCallback& importer ){
        importer( g_camwindow_globals_private.m_showStats );
 }
-typedef FreeCaller<void(const BoolImportCallback&), ShowStatsExport> ShowStatsExportCaller;
 
-ShowStatsExportCaller g_show_stats_caller;
+FreeCaller<void(const BoolImportCallback&), ShowStatsExport> g_show_stats_caller;
 BoolExportCallback g_show_stats_callback( g_show_stats_caller );
 ToggleItem g_show_stats( g_show_stats_callback );
 
@@ -1839,7 +1837,7 @@ void Camera_constructPage( PreferenceGroup& group ){
        Camera_constructPreferences( page );
 }
 void Camera_registerPreferencesPage(){
-       PreferencesDialog_addSettingsPage( FreeCaller<void(PreferenceGroup&), Camera_constructPage>() );
+       PreferencesDialog_addSettingsPage( makeCallbackF(Camera_constructPage) );
 }
 
 #include "preferencesystem.h"
@@ -1868,25 +1866,25 @@ void CameraSpeed_decrease(){
 
 /// \brief Initialisation for things that have the same lifespan as this module.
 void CamWnd_Construct(){
-       GlobalCommands_insert( "CenterView", FreeCaller<void(), GlobalCamera_ResetAngles>(), Accelerator( GDK_KEY_End ) );
+       GlobalCommands_insert( "CenterView", makeCallbackF(GlobalCamera_ResetAngles), Accelerator( GDK_KEY_End ) );
 
-       GlobalToggles_insert( "ToggleCubicClip", FreeCaller<void(), Camera_ToggleFarClip>(), ToggleItem::AddCallbackCaller( g_getfarclip_item ), Accelerator( '\\', (GdkModifierType)GDK_CONTROL_MASK ) );
-       GlobalCommands_insert( "CubicClipZoomIn", FreeCaller<void(), Camera_CubeIn>(), Accelerator( '[', (GdkModifierType)GDK_CONTROL_MASK ) );
-       GlobalCommands_insert( "CubicClipZoomOut", FreeCaller<void(), Camera_CubeOut>(), Accelerator( ']', (GdkModifierType)GDK_CONTROL_MASK ) );
+       GlobalToggles_insert( "ToggleCubicClip", makeCallbackF(Camera_ToggleFarClip), ToggleItem::AddCallbackCaller( g_getfarclip_item ), Accelerator( '\\', (GdkModifierType)GDK_CONTROL_MASK ) );
+       GlobalCommands_insert( "CubicClipZoomIn", makeCallbackF(Camera_CubeIn), Accelerator( '[', (GdkModifierType)GDK_CONTROL_MASK ) );
+       GlobalCommands_insert( "CubicClipZoomOut", makeCallbackF(Camera_CubeOut), Accelerator( ']', (GdkModifierType)GDK_CONTROL_MASK ) );
 
-       GlobalCommands_insert( "UpFloor", FreeCaller<void(), Camera_ChangeFloorUp>(), Accelerator( GDK_KEY_Prior ) );
-       GlobalCommands_insert( "DownFloor", FreeCaller<void(), Camera_ChangeFloorDown>(), Accelerator( GDK_KEY_Next ) );
+       GlobalCommands_insert( "UpFloor", makeCallbackF(Camera_ChangeFloorUp), Accelerator( GDK_KEY_Prior ) );
+       GlobalCommands_insert( "DownFloor", makeCallbackF(Camera_ChangeFloorDown), Accelerator( GDK_KEY_Next ) );
 
        GlobalToggles_insert( "ToggleCamera", ToggleShown::ToggleCaller( g_camera_shown ), ToggleItem::AddCallbackCaller( g_camera_shown.m_item ), Accelerator( 'C', (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) );
-       GlobalCommands_insert( "LookThroughSelected", FreeCaller<void(), GlobalCamera_LookThroughSelected>() );
-       GlobalCommands_insert( "LookThroughCamera", FreeCaller<void(), GlobalCamera_LookThroughCamera>() );
+       GlobalCommands_insert( "LookThroughSelected", makeCallbackF(GlobalCamera_LookThroughSelected) );
+       GlobalCommands_insert( "LookThroughCamera", makeCallbackF(GlobalCamera_LookThroughCamera) );
 
        if ( g_pGameDescription->mGameType == "doom3" ) {
-               GlobalCommands_insert( "TogglePreview", FreeCaller<void(), CamWnd_TogglePreview>(), Accelerator( GDK_KEY_F3 ) );
+               GlobalCommands_insert( "TogglePreview", makeCallbackF(CamWnd_TogglePreview), Accelerator( GDK_KEY_F3 ) );
        }
 
-       GlobalCommands_insert( "CameraSpeedInc", FreeCaller<void(), CameraSpeed_increase>(), Accelerator( GDK_KEY_KP_Add, (GdkModifierType)GDK_SHIFT_MASK ) );
-       GlobalCommands_insert( "CameraSpeedDec", FreeCaller<void(), CameraSpeed_decrease>(), Accelerator( GDK_KEY_KP_Subtract, (GdkModifierType)GDK_SHIFT_MASK ) );
+       GlobalCommands_insert( "CameraSpeedInc", makeCallbackF(CameraSpeed_increase), Accelerator( GDK_KEY_KP_Add, (GdkModifierType)GDK_SHIFT_MASK ) );
+       GlobalCommands_insert( "CameraSpeedDec", makeCallbackF(CameraSpeed_decrease), Accelerator( GDK_KEY_KP_Subtract, (GdkModifierType)GDK_SHIFT_MASK ) );
 
        GlobalShortcuts_insert( "CameraForward", Accelerator( GDK_KEY_Up ) );
        GlobalShortcuts_insert( "CameraBack", Accelerator( GDK_KEY_Down ) );
@@ -1905,7 +1903,7 @@ void CamWnd_Construct(){
        GlobalShortcuts_insert( "CameraFreeMoveLeft", Accelerator( GDK_KEY_Left ) );
        GlobalShortcuts_insert( "CameraFreeMoveRight", Accelerator( GDK_KEY_Right ) );
 
-       GlobalToggles_insert( "ShowStats", ShowStatsToggleCaller(), ToggleItem::AddCallbackCaller( g_show_stats ) );
+       GlobalToggles_insert( "ShowStats", makeCallbackF(ShowStatsToggle), ToggleItem::AddCallbackCaller( g_show_stats ) );
 
        GlobalPreferenceSystem().registerPreference( "ShowStats", BoolImportStringCaller( g_camwindow_globals_private.m_showStats ), BoolExportStringCaller( g_camwindow_globals_private.m_showStats ) );
        GlobalPreferenceSystem().registerPreference( "MoveSpeed", IntImportStringCaller( g_camwindow_globals_private.m_nMoveSpeed ), IntExportStringCaller( g_camwindow_globals_private.m_nMoveSpeed ) );
index 7a7da47..4c7525e 100644 (file)
@@ -689,7 +689,7 @@ EntityClassDoom3() : m_unrealised( 2 ){
 void realise(){
        if ( --m_unrealised == 0 ) {
                globalOutputStream() << "searching vfs directory " << makeQuoted( "def" ) << " for *.def\n";
-               GlobalFileSystem().forEachFile( "def/", "def", FreeCaller<void(const char*), EntityClassDoom3_loadFile>() );
+               GlobalFileSystem().forEachFile( "def/", "def", makeCallbackF(EntityClassDoom3_loadFile) );
 
                {
                        for ( Models::iterator i = g_models.begin(); i != g_models.end(); ++i )
index f480a22..feb08f6 100644 (file)
@@ -564,7 +564,7 @@ void Entity_constructPage( PreferenceGroup& group ){
        Entity_constructPreferences( page );
 }
 void Entity_registerPreferencesPage(){
-       PreferencesDialog_addDisplayPage( FreeCaller<void(PreferenceGroup&), Entity_constructPage>() );
+       PreferencesDialog_addDisplayPage( makeCallbackF(Entity_constructPage) );
 }
 
 
@@ -584,12 +584,12 @@ void Entity_constructMenu( ui::Menu menu ){
 #include "stringio.h"
 
 void Entity_Construct(){
-       GlobalCommands_insert( "EntityColor", FreeCaller<void(), Entity_setColour>(), Accelerator( 'K' ) );
-       GlobalCommands_insert( "NormalizeColor", FreeCaller<void(), Entity_normalizeColor>() );
-       GlobalCommands_insert( "ConnectSelection", FreeCaller<void(), Entity_connectSelected>(), Accelerator( 'K', (GdkModifierType)GDK_CONTROL_MASK ) );
-       GlobalCommands_insert( "KillConnectSelection", FreeCaller<void(), Entity_killconnectSelected>(), Accelerator( 'K', (GdkModifierType)( GDK_SHIFT_MASK ) ) );
-       GlobalCommands_insert( "GroupSelection", FreeCaller<void(), Entity_groupSelected>() );
-       GlobalCommands_insert( "UngroupSelection", FreeCaller<void(), Entity_ungroupSelected>() );
+       GlobalCommands_insert( "EntityColor", makeCallbackF(Entity_setColour), Accelerator( 'K' ) );
+       GlobalCommands_insert( "NormalizeColor", makeCallbackF(Entity_normalizeColor) );
+       GlobalCommands_insert( "ConnectSelection", makeCallbackF(Entity_connectSelected), Accelerator( 'K', (GdkModifierType)GDK_CONTROL_MASK ) );
+       GlobalCommands_insert( "KillConnectSelection", makeCallbackF(Entity_killconnectSelected), Accelerator( 'K', (GdkModifierType)( GDK_SHIFT_MASK ) ) );
+       GlobalCommands_insert( "GroupSelection", makeCallbackF(Entity_groupSelected) );
+       GlobalCommands_insert( "UngroupSelection", makeCallbackF(Entity_ungroupSelected) );
 
        GlobalPreferenceSystem().registerPreference( "SI_Colors5", Vector3ImportStringCaller( g_entity_globals.color_entity ), Vector3ExportStringCaller( g_entity_globals.color_entity ) );
        GlobalPreferenceSystem().registerPreference( "LastLightIntensity", IntImportStringCaller( g_iLastLightIntensity ), IntExportStringCaller( g_iLastLightIntensity ) );
index 852b763..39f6109 100644 (file)
@@ -1063,7 +1063,7 @@ class EntityInspectorDraw
 {
 IdleDraw m_idleDraw;
 public:
-EntityInspectorDraw() : m_idleDraw( FreeCaller<void(), EntityInspector_updateKeyValues>( ) ){
+EntityInspectorDraw() : m_idleDraw( makeCallbackF(EntityInspector_updateKeyValues) ){
 }
 void queueDraw(){
        m_idleDraw.queueDraw();
index be7576c..6547233 100644 (file)
@@ -218,8 +218,8 @@ void Filters_constructMenu( ui::Menu menu_in_menu ){
 void ConstructFilters(){
        GlobalPreferenceSystem().registerPreference( "SI_Exclude", SizeImportStringCaller( g_filters_globals.exclude ), SizeExportStringCaller( g_filters_globals.exclude ) );
 
-       GlobalCommands_insert( "InvertFilters", FreeCaller<void(), InvertFilters>() );
-       GlobalCommands_insert( "ResetFilters", FreeCaller<void(), ResetFilters>() );
+       GlobalCommands_insert( "InvertFilters", makeCallbackF(InvertFilters) );
+       GlobalCommands_insert( "ResetFilters", makeCallbackF(ResetFilters) );
 
        add_filter_command( EXCLUDE_WORLD, "FilterWorldBrushes", Accelerator( '1', (GdkModifierType)GDK_MOD1_MASK ) );
        add_filter_command( EXCLUDE_ENT, "FilterEntities", Accelerator( '2', (GdkModifierType)GDK_MOD1_MASK ) );
index 08b9bb8..fa255b4 100644 (file)
@@ -192,10 +192,10 @@ void ToggleGridSnap(){
 }
 
 void Grid_registerCommands(){
-       GlobalCommands_insert( "GridDown", FreeCaller<void(), GridPrev>(), Accelerator( '[' ) );
-       GlobalCommands_insert( "GridUp", FreeCaller<void(), GridNext>(), Accelerator( ']' ) );
+       GlobalCommands_insert( "GridDown", makeCallbackF(GridPrev), Accelerator( '[' ) );
+       GlobalCommands_insert( "GridUp", makeCallbackF(GridNext), Accelerator( ']' ) );
 
-       GlobalCommands_insert( "ToggleGridSnap", FreeCaller<void(), ToggleGridSnap>() );
+       GlobalCommands_insert( "ToggleGridSnap", makeCallbackF(ToggleGridSnap) );
 
        GlobalToggles_insert( "SetGrid0.125", GridMenuItem::SetCaller( g_gridMenu0125 ), ToggleItem::AddCallbackCaller( g_gridMenu0125.m_item ) );
        GlobalToggles_insert( "SetGrid0.25", GridMenuItem::SetCaller( g_gridMenu025 ), ToggleItem::AddCallbackCaller( g_gridMenu025.m_item ) );
@@ -246,7 +246,7 @@ void Grid_constructPage( PreferenceGroup& group ){
        Grid_constructPreferences( page );
 }
 void Grid_registerPreferencesPage(){
-       PreferencesDialog_addSettingsPage( FreeCaller<void(PreferenceGroup&), Grid_constructPage>() );
+       PreferencesDialog_addSettingsPage( makeCallbackF(Grid_constructPage) );
 }
 
 void Grid_construct(){
index f175bc5..a926d0f 100644 (file)
@@ -197,7 +197,7 @@ void GroupDialog_updatePageTitle( ui::Widget page ){
 void GroupDialog_Construct(){
        GlobalPreferenceSystem().registerPreference( "EntityWnd", WindowPositionTrackerImportStringCaller( g_GroupDlg.m_position_tracker ), WindowPositionTrackerExportStringCaller( g_GroupDlg.m_position_tracker ) );
 
-       GlobalCommands_insert( "ViewEntityInfo", FreeCaller<void(), GroupDialog_ToggleShow>(), Accelerator( 'N' ) );
+       GlobalCommands_insert( "ViewEntityInfo", makeCallbackF(GroupDialog_ToggleShow), Accelerator( 'N' ) );
 }
 void GroupDialog_Destroy(){
 }
index 6429805..6ae00e3 100644 (file)
@@ -430,7 +430,7 @@ void Paths_constructPage( PreferenceGroup& group ){
        Paths_constructPreferences( page );
 }
 void Paths_registerPreferencesPage(){
-       PreferencesDialog_addSettingsPage( FreeCaller<void(PreferenceGroup&), Paths_constructPage>() );
+       PreferencesDialog_addSettingsPage( makeCallbackF(Paths_constructPage) );
 }
 
 
@@ -2085,7 +2085,7 @@ ui::MenuItem create_misc_menu(){
        }
 
 #if 0
-       create_menu_item_with_mnemonic( menu, "_Benchmark", FreeCaller<void(), GlobalCamera_Benchmark>() );
+       create_menu_item_with_mnemonic( menu, "_Benchmark", makeCallbackF(GlobalCamera_Benchmark) );
 #endif
     menu.add(create_colours_menu());
 
@@ -2093,7 +2093,7 @@ ui::MenuItem create_misc_menu(){
        create_menu_item_with_mnemonic( menu, "Map Info...", "MapInfo" );
        // http://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=394
 //  create_menu_item_with_mnemonic(menu, "_Print XY View", FreeCaller<void(), WXY_Print>());
-       create_menu_item_with_mnemonic( menu, "_Background select", FreeCaller<void(), WXY_BackgroundSelect>() );
+       create_menu_item_with_mnemonic( menu, "_Background select", makeCallbackF(WXY_BackgroundSelect) );
        return misc_menu_item;
 }
 
@@ -2150,9 +2150,9 @@ ui::MenuItem create_help_menu(){
        // it will take care of hooking the Sys_OpenURL calls etc.
        create_game_help_menu( menu );
 
-       create_menu_item_with_mnemonic( menu, "Bug report", FreeCaller<void(), OpenBugReportURL>() );
-       create_menu_item_with_mnemonic( menu, "Shortcuts list", FreeCaller<void(), DoCommandListDlg>() );
-       create_menu_item_with_mnemonic( menu, "_About", FreeCaller<void(), DoAbout>() );
+       create_menu_item_with_mnemonic( menu, "Bug report", makeCallbackF(OpenBugReportURL) );
+       create_menu_item_with_mnemonic( menu, "Shortcuts list", makeCallbackF(DoCommandListDlg) );
+       create_menu_item_with_mnemonic( menu, "_About", makeCallbackF(DoAbout) );
 
        return help_menu_item;
 }
@@ -3155,7 +3155,7 @@ void Layout_constructPage( PreferenceGroup& group ){
 }
 
 void Layout_registerPreferencesPage(){
-       PreferencesDialog_addInterfacePage( FreeCaller<void(PreferenceGroup&), Layout_constructPage>() );
+       PreferencesDialog_addInterfacePage( makeCallbackF(Layout_constructPage) );
 }
 
 
@@ -3163,75 +3163,75 @@ void Layout_registerPreferencesPage(){
 #include "stringio.h"
 
 void MainFrame_Construct(){
-       GlobalCommands_insert( "OpenManual", FreeCaller<void(), OpenHelpURL>(), Accelerator( GDK_KEY_F1 ) );
-
-       GlobalCommands_insert( "Sleep", FreeCaller<void(), thunk_OnSleep>(), Accelerator( 'P', (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) );
-       GlobalCommands_insert( "NewMap", FreeCaller<void(), NewMap>() );
-       GlobalCommands_insert( "OpenMap", FreeCaller<void(), OpenMap>(), Accelerator( 'O', (GdkModifierType)GDK_CONTROL_MASK ) );
-       GlobalCommands_insert( "ImportMap", FreeCaller<void(), ImportMap>() );
-       GlobalCommands_insert( "SaveMap", FreeCaller<void(), SaveMap>(), Accelerator( 'S', (GdkModifierType)GDK_CONTROL_MASK ) );
-       GlobalCommands_insert( "SaveMapAs", FreeCaller<void(), SaveMapAs>() );
-       GlobalCommands_insert( "ExportSelected", FreeCaller<void(), ExportMap>() );
-       GlobalCommands_insert( "SaveRegion", FreeCaller<void(), SaveRegion>() );
-       GlobalCommands_insert( "RefreshReferences", FreeCaller<void(), VFS_Refresh>() );
-       GlobalCommands_insert( "ProjectSettings", FreeCaller<void(), DoProjectSettings>() );
-       GlobalCommands_insert( "Exit", FreeCaller<void(), Exit>() );
-
-       GlobalCommands_insert( "Undo", FreeCaller<void(), Undo>(), Accelerator( 'Z', (GdkModifierType)GDK_CONTROL_MASK ) );
-       GlobalCommands_insert( "Redo", FreeCaller<void(), Redo>(), Accelerator( 'Y', (GdkModifierType)GDK_CONTROL_MASK ) );
-       GlobalCommands_insert( "Copy", FreeCaller<void(), Copy>(), Accelerator( 'C', (GdkModifierType)GDK_CONTROL_MASK ) );
-       GlobalCommands_insert( "Paste", FreeCaller<void(), Paste>(), Accelerator( 'V', (GdkModifierType)GDK_CONTROL_MASK ) );
-       GlobalCommands_insert( "PasteToCamera", FreeCaller<void(), PasteToCamera>(), Accelerator( 'V', (GdkModifierType)GDK_MOD1_MASK ) );
-       GlobalCommands_insert( "CloneSelection", FreeCaller<void(), Selection_Clone>(), Accelerator( GDK_KEY_space ) );
-       GlobalCommands_insert( "CloneSelectionAndMakeUnique", FreeCaller<void(), Selection_Clone_MakeUnique>(), Accelerator( GDK_KEY_space, (GdkModifierType)GDK_SHIFT_MASK ) );
-       GlobalCommands_insert( "DeleteSelection", FreeCaller<void(), deleteSelection>(), Accelerator( GDK_KEY_BackSpace ) );
-       GlobalCommands_insert( "ParentSelection", FreeCaller<void(), Scene_parentSelected>() );
-       GlobalCommands_insert( "UnSelectSelection", FreeCaller<void(), Selection_Deselect>(), Accelerator( GDK_KEY_Escape ) );
-       GlobalCommands_insert( "InvertSelection", FreeCaller<void(), Select_Invert>(), Accelerator( 'I' ) );
-       GlobalCommands_insert( "SelectInside", FreeCaller<void(), Select_Inside>() );
-       GlobalCommands_insert( "SelectTouching", FreeCaller<void(), Select_Touching>() );
-       GlobalCommands_insert( "ExpandSelectionToEntities", FreeCaller<void(), Scene_ExpandSelectionToEntities>(), Accelerator( 'E', (GdkModifierType)( GDK_MOD1_MASK | GDK_CONTROL_MASK ) ) );
-       GlobalCommands_insert( "Preferences", FreeCaller<void(), PreferencesDialog_showDialog>(), Accelerator( 'P' ) );
-
-       GlobalCommands_insert( "ToggleConsole", FreeCaller<void(), Console_ToggleShow>(), Accelerator( 'O' ) );
-       GlobalCommands_insert( "ToggleEntityInspector", FreeCaller<void(), EntityInspector_ToggleShow>(), Accelerator( 'N' ) );
-       GlobalCommands_insert( "EntityList", FreeCaller<void(), EntityList_toggleShown>(), Accelerator( 'L' ) );
-
-       GlobalCommands_insert( "ShowHidden", FreeCaller<void(), Select_ShowAllHidden>(), Accelerator( 'H', (GdkModifierType)GDK_SHIFT_MASK ) );
-       GlobalCommands_insert( "HideSelected", FreeCaller<void(), HideSelected>(), Accelerator( 'H' ) );
-
-       GlobalToggles_insert( "DragVertices", FreeCaller<void(), SelectVertexMode>(), ToggleItem::AddCallbackCaller( g_vertexMode_button ), Accelerator( 'V' ) );
-       GlobalToggles_insert( "DragEdges", FreeCaller<void(), SelectEdgeMode>(), ToggleItem::AddCallbackCaller( g_edgeMode_button ), Accelerator( 'E' ) );
-       GlobalToggles_insert( "DragFaces", FreeCaller<void(), SelectFaceMode>(), ToggleItem::AddCallbackCaller( g_faceMode_button ), Accelerator( 'F' ) );
-
-       GlobalCommands_insert( "MirrorSelectionX", FreeCaller<void(), Selection_Flipx>() );
-       GlobalCommands_insert( "RotateSelectionX", FreeCaller<void(), Selection_Rotatex>() );
-       GlobalCommands_insert( "MirrorSelectionY", FreeCaller<void(), Selection_Flipy>() );
-       GlobalCommands_insert( "RotateSelectionY", FreeCaller<void(), Selection_Rotatey>() );
-       GlobalCommands_insert( "MirrorSelectionZ", FreeCaller<void(), Selection_Flipz>() );
-       GlobalCommands_insert( "RotateSelectionZ", FreeCaller<void(), Selection_Rotatez>() );
-
-       GlobalCommands_insert( "ArbitraryRotation", FreeCaller<void(), DoRotateDlg>() );
-       GlobalCommands_insert( "ArbitraryScale", FreeCaller<void(), DoScaleDlg>() );
-
-       GlobalCommands_insert( "BuildMenuCustomize", FreeCaller<void(), DoBuildMenu>() );
-
-       GlobalCommands_insert( "FindBrush", FreeCaller<void(), DoFind>() );
-
-       GlobalCommands_insert( "MapInfo", FreeCaller<void(), DoMapInfo>(), Accelerator( 'M' ) );
-
-
-       GlobalToggles_insert( "ToggleClipper", FreeCaller<void(), ClipperMode>(), ToggleItem::AddCallbackCaller( g_clipper_button ), Accelerator( 'X' ) );
-
-       GlobalToggles_insert( "MouseTranslate", FreeCaller<void(), TranslateMode>(), ToggleItem::AddCallbackCaller( g_translatemode_button ), Accelerator( 'W' ) );
-       GlobalToggles_insert( "MouseRotate", FreeCaller<void(), RotateMode>(), ToggleItem::AddCallbackCaller( g_rotatemode_button ), Accelerator( 'R' ) );
-       GlobalToggles_insert( "MouseScale", FreeCaller<void(), ScaleMode>(), ToggleItem::AddCallbackCaller( g_scalemode_button ) );
-       GlobalToggles_insert( "MouseDrag", FreeCaller<void(), DragMode>(), ToggleItem::AddCallbackCaller( g_dragmode_button ), Accelerator( 'Q' ) );
-
-       GlobalCommands_insert( "ColorSchemeOriginal", FreeCaller<void(), ColorScheme_Original>() );
-       GlobalCommands_insert( "ColorSchemeQER", FreeCaller<void(), ColorScheme_QER>() );
-       GlobalCommands_insert( "ColorSchemeBlackAndGreen", FreeCaller<void(), ColorScheme_Black>() );
-       GlobalCommands_insert( "ColorSchemeYdnar", FreeCaller<void(), ColorScheme_Ydnar>() );
+       GlobalCommands_insert( "OpenManual", makeCallbackF(OpenHelpURL), Accelerator( GDK_KEY_F1 ) );
+
+       GlobalCommands_insert( "Sleep", makeCallbackF(thunk_OnSleep), Accelerator( 'P', (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) );
+       GlobalCommands_insert( "NewMap", makeCallbackF(NewMap) );
+       GlobalCommands_insert( "OpenMap", makeCallbackF(OpenMap), Accelerator( 'O', (GdkModifierType)GDK_CONTROL_MASK ) );
+       GlobalCommands_insert( "ImportMap", makeCallbackF(ImportMap) );
+       GlobalCommands_insert( "SaveMap", makeCallbackF(SaveMap), Accelerator( 'S', (GdkModifierType)GDK_CONTROL_MASK ) );
+       GlobalCommands_insert( "SaveMapAs", makeCallbackF(SaveMapAs) );
+       GlobalCommands_insert( "ExportSelected", makeCallbackF(ExportMap) );
+       GlobalCommands_insert( "SaveRegion", makeCallbackF(SaveRegion) );
+       GlobalCommands_insert( "RefreshReferences", makeCallbackF(VFS_Refresh) );
+       GlobalCommands_insert( "ProjectSettings", makeCallbackF(DoProjectSettings) );
+       GlobalCommands_insert( "Exit", makeCallbackF(Exit) );
+
+       GlobalCommands_insert( "Undo", makeCallbackF(Undo), Accelerator( 'Z', (GdkModifierType)GDK_CONTROL_MASK ) );
+       GlobalCommands_insert( "Redo", makeCallbackF(Redo), Accelerator( 'Y', (GdkModifierType)GDK_CONTROL_MASK ) );
+       GlobalCommands_insert( "Copy", makeCallbackF(Copy), Accelerator( 'C', (GdkModifierType)GDK_CONTROL_MASK ) );
+       GlobalCommands_insert( "Paste", makeCallbackF(Paste), Accelerator( 'V', (GdkModifierType)GDK_CONTROL_MASK ) );
+       GlobalCommands_insert( "PasteToCamera", makeCallbackF(PasteToCamera), Accelerator( 'V', (GdkModifierType)GDK_MOD1_MASK ) );
+       GlobalCommands_insert( "CloneSelection", makeCallbackF(Selection_Clone), Accelerator( GDK_KEY_space ) );
+       GlobalCommands_insert( "CloneSelectionAndMakeUnique", makeCallbackF(Selection_Clone_MakeUnique), Accelerator( GDK_KEY_space, (GdkModifierType)GDK_SHIFT_MASK ) );
+       GlobalCommands_insert( "DeleteSelection", makeCallbackF(deleteSelection), Accelerator( GDK_KEY_BackSpace ) );
+       GlobalCommands_insert( "ParentSelection", makeCallbackF(Scene_parentSelected) );
+       GlobalCommands_insert( "UnSelectSelection", makeCallbackF(Selection_Deselect), Accelerator( GDK_KEY_Escape ) );
+       GlobalCommands_insert( "InvertSelection", makeCallbackF(Select_Invert), Accelerator( 'I' ) );
+       GlobalCommands_insert( "SelectInside", makeCallbackF(Select_Inside) );
+       GlobalCommands_insert( "SelectTouching", makeCallbackF(Select_Touching) );
+       GlobalCommands_insert( "ExpandSelectionToEntities", makeCallbackF(Scene_ExpandSelectionToEntities), Accelerator( 'E', (GdkModifierType)( GDK_MOD1_MASK | GDK_CONTROL_MASK ) ) );
+       GlobalCommands_insert( "Preferences", makeCallbackF(PreferencesDialog_showDialog), Accelerator( 'P' ) );
+
+       GlobalCommands_insert( "ToggleConsole", makeCallbackF(Console_ToggleShow), Accelerator( 'O' ) );
+       GlobalCommands_insert( "ToggleEntityInspector", makeCallbackF(EntityInspector_ToggleShow), Accelerator( 'N' ) );
+       GlobalCommands_insert( "EntityList", makeCallbackF(EntityList_toggleShown), Accelerator( 'L' ) );
+
+       GlobalCommands_insert( "ShowHidden", makeCallbackF(Select_ShowAllHidden), Accelerator( 'H', (GdkModifierType)GDK_SHIFT_MASK ) );
+       GlobalCommands_insert( "HideSelected", makeCallbackF(HideSelected), Accelerator( 'H' ) );
+
+       GlobalToggles_insert( "DragVertices", makeCallbackF(SelectVertexMode), ToggleItem::AddCallbackCaller( g_vertexMode_button ), Accelerator( 'V' ) );
+       GlobalToggles_insert( "DragEdges", makeCallbackF(SelectEdgeMode), ToggleItem::AddCallbackCaller( g_edgeMode_button ), Accelerator( 'E' ) );
+       GlobalToggles_insert( "DragFaces", makeCallbackF(SelectFaceMode), ToggleItem::AddCallbackCaller( g_faceMode_button ), Accelerator( 'F' ) );
+
+       GlobalCommands_insert( "MirrorSelectionX", makeCallbackF(Selection_Flipx) );
+       GlobalCommands_insert( "RotateSelectionX", makeCallbackF(Selection_Rotatex) );
+       GlobalCommands_insert( "MirrorSelectionY", makeCallbackF(Selection_Flipy) );
+       GlobalCommands_insert( "RotateSelectionY", makeCallbackF(Selection_Rotatey) );
+       GlobalCommands_insert( "MirrorSelectionZ", makeCallbackF(Selection_Flipz) );
+       GlobalCommands_insert( "RotateSelectionZ", makeCallbackF(Selection_Rotatez) );
+
+       GlobalCommands_insert( "ArbitraryRotation", makeCallbackF(DoRotateDlg) );
+       GlobalCommands_insert( "ArbitraryScale", makeCallbackF(DoScaleDlg) );
+
+       GlobalCommands_insert( "BuildMenuCustomize", makeCallbackF(DoBuildMenu) );
+
+       GlobalCommands_insert( "FindBrush", makeCallbackF(DoFind) );
+
+       GlobalCommands_insert( "MapInfo", makeCallbackF(DoMapInfo), Accelerator( 'M' ) );
+
+
+       GlobalToggles_insert( "ToggleClipper", makeCallbackF(ClipperMode), ToggleItem::AddCallbackCaller( g_clipper_button ), Accelerator( 'X' ) );
+
+       GlobalToggles_insert( "MouseTranslate", makeCallbackF(TranslateMode), ToggleItem::AddCallbackCaller( g_translatemode_button ), Accelerator( 'W' ) );
+       GlobalToggles_insert( "MouseRotate", makeCallbackF(RotateMode), ToggleItem::AddCallbackCaller( g_rotatemode_button ), Accelerator( 'R' ) );
+       GlobalToggles_insert( "MouseScale", makeCallbackF(ScaleMode), ToggleItem::AddCallbackCaller( g_scalemode_button ) );
+       GlobalToggles_insert( "MouseDrag", makeCallbackF(DragMode), ToggleItem::AddCallbackCaller( g_dragmode_button ), Accelerator( 'Q' ) );
+
+       GlobalCommands_insert( "ColorSchemeOriginal", makeCallbackF(ColorScheme_Original) );
+       GlobalCommands_insert( "ColorSchemeQER", makeCallbackF(ColorScheme_QER) );
+       GlobalCommands_insert( "ColorSchemeBlackAndGreen", makeCallbackF(ColorScheme_Black) );
+       GlobalCommands_insert( "ColorSchemeYdnar", makeCallbackF(ColorScheme_Ydnar) );
        GlobalCommands_insert( "ChooseTextureBackgroundColor", makeCallback( g_ColoursMenu.m_textureback ) );
        GlobalCommands_insert( "ChooseGridBackgroundColor", makeCallback( g_ColoursMenu.m_xyback ) );
        GlobalCommands_insert( "ChooseGridMajorColor", makeCallback( g_ColoursMenu.m_gridmajor ) );
@@ -3248,34 +3248,34 @@ void MainFrame_Construct(){
        GlobalCommands_insert( "ChooseOrthoViewNameColor", makeCallback( g_ColoursMenu.m_viewname ) );
 
 
-       GlobalCommands_insert( "CSGSubtract", FreeCaller<void(), CSG_Subtract>(), Accelerator( 'U', (GdkModifierType)GDK_SHIFT_MASK ) );
-       GlobalCommands_insert( "CSGMerge", FreeCaller<void(), CSG_Merge>(), Accelerator( 'U', (GdkModifierType)GDK_CONTROL_MASK ) );
-       GlobalCommands_insert( "CSGHollow", FreeCaller<void(), CSG_MakeHollow>() );
+       GlobalCommands_insert( "CSGSubtract", makeCallbackF(CSG_Subtract), Accelerator( 'U', (GdkModifierType)GDK_SHIFT_MASK ) );
+       GlobalCommands_insert( "CSGMerge", makeCallbackF(CSG_Merge), Accelerator( 'U', (GdkModifierType)GDK_CONTROL_MASK ) );
+       GlobalCommands_insert( "CSGHollow", makeCallbackF(CSG_MakeHollow) );
 
        Grid_registerCommands();
 
-       GlobalCommands_insert( "SnapToGrid", FreeCaller<void(), Selection_SnapToGrid>(), Accelerator( 'G', (GdkModifierType)GDK_CONTROL_MASK ) );
+       GlobalCommands_insert( "SnapToGrid", makeCallbackF(Selection_SnapToGrid), Accelerator( 'G', (GdkModifierType)GDK_CONTROL_MASK ) );
 
-       GlobalCommands_insert( "SelectAllOfType", FreeCaller<void(), Select_AllOfType>(), Accelerator( 'A', (GdkModifierType)GDK_SHIFT_MASK ) );
+       GlobalCommands_insert( "SelectAllOfType", makeCallbackF(Select_AllOfType), Accelerator( 'A', (GdkModifierType)GDK_SHIFT_MASK ) );
 
-       GlobalCommands_insert( "TexRotateClock", FreeCaller<void(), Texdef_RotateClockwise>(), Accelerator( GDK_KEY_Next, (GdkModifierType)GDK_SHIFT_MASK ) );
-       GlobalCommands_insert( "TexRotateCounter", FreeCaller<void(), Texdef_RotateAntiClockwise>(), Accelerator( GDK_KEY_Prior, (GdkModifierType)GDK_SHIFT_MASK ) );
-       GlobalCommands_insert( "TexScaleUp", FreeCaller<void(), Texdef_ScaleUp>(), Accelerator( GDK_KEY_Up, (GdkModifierType)GDK_CONTROL_MASK ) );
-       GlobalCommands_insert( "TexScaleDown", FreeCaller<void(), Texdef_ScaleDown>(), Accelerator( GDK_KEY_Down, (GdkModifierType)GDK_CONTROL_MASK ) );
-       GlobalCommands_insert( "TexScaleLeft", FreeCaller<void(), Texdef_ScaleLeft>(), Accelerator( GDK_KEY_Left, (GdkModifierType)GDK_CONTROL_MASK ) );
-       GlobalCommands_insert( "TexScaleRight", FreeCaller<void(), Texdef_ScaleRight>(), Accelerator( GDK_KEY_Right, (GdkModifierType)GDK_CONTROL_MASK ) );
-       GlobalCommands_insert( "TexShiftUp", FreeCaller<void(), Texdef_ShiftUp>(), Accelerator( GDK_KEY_Up, (GdkModifierType)GDK_SHIFT_MASK ) );
-       GlobalCommands_insert( "TexShiftDown", FreeCaller<void(), Texdef_ShiftDown>(), Accelerator( GDK_KEY_Down, (GdkModifierType)GDK_SHIFT_MASK ) );
-       GlobalCommands_insert( "TexShiftLeft", FreeCaller<void(), Texdef_ShiftLeft>(), Accelerator( GDK_KEY_Left, (GdkModifierType)GDK_SHIFT_MASK ) );
-       GlobalCommands_insert( "TexShiftRight", FreeCaller<void(), Texdef_ShiftRight>(), Accelerator( GDK_KEY_Right, (GdkModifierType)GDK_SHIFT_MASK ) );
+       GlobalCommands_insert( "TexRotateClock", makeCallbackF(Texdef_RotateClockwise), Accelerator( GDK_KEY_Next, (GdkModifierType)GDK_SHIFT_MASK ) );
+       GlobalCommands_insert( "TexRotateCounter", makeCallbackF(Texdef_RotateAntiClockwise), Accelerator( GDK_KEY_Prior, (GdkModifierType)GDK_SHIFT_MASK ) );
+       GlobalCommands_insert( "TexScaleUp", makeCallbackF(Texdef_ScaleUp), Accelerator( GDK_KEY_Up, (GdkModifierType)GDK_CONTROL_MASK ) );
+       GlobalCommands_insert( "TexScaleDown", makeCallbackF(Texdef_ScaleDown), Accelerator( GDK_KEY_Down, (GdkModifierType)GDK_CONTROL_MASK ) );
+       GlobalCommands_insert( "TexScaleLeft", makeCallbackF(Texdef_ScaleLeft), Accelerator( GDK_KEY_Left, (GdkModifierType)GDK_CONTROL_MASK ) );
+       GlobalCommands_insert( "TexScaleRight", makeCallbackF(Texdef_ScaleRight), Accelerator( GDK_KEY_Right, (GdkModifierType)GDK_CONTROL_MASK ) );
+       GlobalCommands_insert( "TexShiftUp", makeCallbackF(Texdef_ShiftUp), Accelerator( GDK_KEY_Up, (GdkModifierType)GDK_SHIFT_MASK ) );
+       GlobalCommands_insert( "TexShiftDown", makeCallbackF(Texdef_ShiftDown), Accelerator( GDK_KEY_Down, (GdkModifierType)GDK_SHIFT_MASK ) );
+       GlobalCommands_insert( "TexShiftLeft", makeCallbackF(Texdef_ShiftLeft), Accelerator( GDK_KEY_Left, (GdkModifierType)GDK_SHIFT_MASK ) );
+       GlobalCommands_insert( "TexShiftRight", makeCallbackF(Texdef_ShiftRight), Accelerator( GDK_KEY_Right, (GdkModifierType)GDK_SHIFT_MASK ) );
 
-       GlobalCommands_insert( "MoveSelectionDOWN", FreeCaller<void(), Selection_MoveDown>(), Accelerator( GDK_KEY_KP_Subtract ) );
-       GlobalCommands_insert( "MoveSelectionUP", FreeCaller<void(), Selection_MoveUp>(), Accelerator( GDK_KEY_KP_Add ) );
+       GlobalCommands_insert( "MoveSelectionDOWN", makeCallbackF(Selection_MoveDown), Accelerator( GDK_KEY_KP_Subtract ) );
+       GlobalCommands_insert( "MoveSelectionUP", makeCallbackF(Selection_MoveUp), Accelerator( GDK_KEY_KP_Add ) );
 
-       GlobalCommands_insert( "SelectNudgeLeft", FreeCaller<void(), Selection_NudgeLeft>(), Accelerator( GDK_KEY_Left, (GdkModifierType)GDK_MOD1_MASK ) );
-       GlobalCommands_insert( "SelectNudgeRight", FreeCaller<void(), Selection_NudgeRight>(), Accelerator( GDK_KEY_Right, (GdkModifierType)GDK_MOD1_MASK ) );
-       GlobalCommands_insert( "SelectNudgeUp", FreeCaller<void(), Selection_NudgeUp>(), Accelerator( GDK_KEY_Up, (GdkModifierType)GDK_MOD1_MASK ) );
-       GlobalCommands_insert( "SelectNudgeDown", FreeCaller<void(), Selection_NudgeDown>(), Accelerator( GDK_KEY_Down, (GdkModifierType)GDK_MOD1_MASK ) );
+       GlobalCommands_insert( "SelectNudgeLeft", makeCallbackF(Selection_NudgeLeft), Accelerator( GDK_KEY_Left, (GdkModifierType)GDK_MOD1_MASK ) );
+       GlobalCommands_insert( "SelectNudgeRight", makeCallbackF(Selection_NudgeRight), Accelerator( GDK_KEY_Right, (GdkModifierType)GDK_MOD1_MASK ) );
+       GlobalCommands_insert( "SelectNudgeUp", makeCallbackF(Selection_NudgeUp), Accelerator( GDK_KEY_Up, (GdkModifierType)GDK_MOD1_MASK ) );
+       GlobalCommands_insert( "SelectNudgeDown", makeCallbackF(Selection_NudgeDown), Accelerator( GDK_KEY_Down, (GdkModifierType)GDK_MOD1_MASK ) );
 
        Patch_registerCommands();
        XYShow_registerCommands();
@@ -3330,8 +3330,8 @@ void MainFrame_Construct(){
        Layout_registerPreferencesPage();
        Paths_registerPreferencesPage();
 
-       g_brushCount.setCountChangedCallback( FreeCaller<void(), QE_brushCountChanged>() );
-       g_entityCount.setCountChangedCallback( FreeCaller<void(), QE_entityCountChanged>() );
+       g_brushCount.setCountChangedCallback( makeCallbackF(QE_brushCountChanged) );
+       g_entityCount.setCountChangedCallback( makeCallbackF(QE_entityCountChanged) );
        GlobalEntityCreator().setCounter( &g_entityCount );
 
        GLWidget_sharedContextCreated = GlobalGL_sharedContextCreated;
index 5523f43..a6833a6 100644 (file)
@@ -2161,16 +2161,16 @@ CopiedString g_strLastMap;
 bool g_bLoadLastMap = false;
 
 void Map_Construct(){
-       GlobalCommands_insert( "RegionOff", FreeCaller<void(), RegionOff>() );
-       GlobalCommands_insert( "RegionSetXY", FreeCaller<void(), RegionXY>() );
-       GlobalCommands_insert( "RegionSetBrush", FreeCaller<void(), RegionBrush>() );
-       GlobalCommands_insert( "RegionSetSelection", FreeCaller<void(), RegionSelected>(), Accelerator( 'R', (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) );
+       GlobalCommands_insert( "RegionOff", makeCallbackF(RegionOff) );
+       GlobalCommands_insert( "RegionSetXY", makeCallbackF(RegionXY) );
+       GlobalCommands_insert( "RegionSetBrush", makeCallbackF(RegionBrush) );
+       GlobalCommands_insert( "RegionSetSelection", makeCallbackF(RegionSelected), Accelerator( 'R', (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) );
 
        GlobalPreferenceSystem().registerPreference( "LastMap", CopiedStringImportStringCaller( g_strLastMap ), CopiedStringExportStringCaller( g_strLastMap ) );
        GlobalPreferenceSystem().registerPreference( "LoadLastMap", BoolImportStringCaller( g_bLoadLastMap ), BoolExportStringCaller( g_bLoadLastMap ) );
        GlobalPreferenceSystem().registerPreference( "MapInfoDlg", WindowPositionImportStringCaller( g_posMapInfoWnd ), WindowPositionExportStringCaller( g_posMapInfoWnd ) );
 
-       PreferencesDialog_addSettingsPreferences( FreeCaller<void(PreferencesPage&), Map_constructPreferences>() );
+       PreferencesDialog_addSettingsPreferences( makeCallbackF(Map_constructPreferences) );
 
        GlobalEntityClassManager().attach( g_MapEntityClasses );
        Radiant_attachHomePathsObserver( g_MapModuleObserver );
index 9138573..8a569e0 100644 (file)
@@ -92,7 +92,7 @@ void MultiMon_Construct(){
 
        g_Multimon_enableSysMenuPopups.useLatched();
 
-       PreferencesDialog_addInterfacePreferences( FreeCaller<void(PreferencesPage&), MultiMonitor_constructPreferences>() );
+       PreferencesDialog_addInterfacePreferences( makeCallbackF(MultiMonitor_constructPreferences) );
 }
 void MultiMon_Destroy(){
 }
index 310d133..b6650f5 100644 (file)
@@ -1033,7 +1033,7 @@ void PatchInspector_SelectionChanged( const Selectable& selectable ){
 
 
 void PatchInspector_Construct(){
-       GlobalCommands_insert( "PatchInspector", FreeCaller<void(), PatchInspector_toggleShown>(), Accelerator( 'S', (GdkModifierType)GDK_SHIFT_MASK ) );
+       GlobalCommands_insert( "PatchInspector", makeCallbackF(PatchInspector_toggleShown), Accelerator( 'S', (GdkModifierType)GDK_SHIFT_MASK ) );
 
        GlobalPreferenceSystem().registerPreference( "PatchWnd", WindowPositionTrackerImportStringCaller( g_PatchInspector.m_position_tracker ), WindowPositionTrackerExportStringCaller( g_PatchInspector.m_position_tracker ) );
        GlobalPreferenceSystem().registerPreference( "SI_PatchTexdef_Scale1", FloatImportStringCaller( g_pi_globals.scale[0] ), FloatExportStringCaller( g_pi_globals.scale[0] ) );
index ceca948..a7e993e 100644 (file)
@@ -600,7 +600,7 @@ void Patch_constructPage( PreferenceGroup& group ){
        Patch_constructPreferences( page );
 }
 void Patch_registerPreferencesPage(){
-       PreferencesDialog_addDisplayPage( FreeCaller<void(PreferenceGroup&), Patch_constructPage>() );
+       PreferencesDialog_addDisplayPage( makeCallbackF(Patch_constructPage) );
 }
 
 
@@ -614,41 +614,41 @@ void PatchPreferences_construct(){
 #include "generic/callback.h"
 
 void Patch_registerCommands(){
-       GlobalCommands_insert( "InvertCurveTextureX", FreeCaller<void(), Patch_FlipTextureX>(), Accelerator( 'I', (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) );
-       GlobalCommands_insert( "InvertCurveTextureY", FreeCaller<void(), Patch_FlipTextureY>(), Accelerator( 'I', (GdkModifierType)GDK_SHIFT_MASK ) );
-       GlobalCommands_insert( "NaturalizePatch", FreeCaller<void(), Patch_NaturalTexture>(), Accelerator( 'N', (GdkModifierType)GDK_CONTROL_MASK ) );
-       GlobalCommands_insert( "PatchCylinder", FreeCaller<void(), Patch_Cylinder>() );
-       GlobalCommands_insert( "PatchDenseCylinder", FreeCaller<void(), Patch_DenseCylinder>() );
-       GlobalCommands_insert( "PatchVeryDenseCylinder", FreeCaller<void(), Patch_VeryDenseCylinder>() );
-       GlobalCommands_insert( "PatchSquareCylinder", FreeCaller<void(), Patch_SquareCylinder>() );
-       GlobalCommands_insert( "PatchXactCylinder", FreeCaller<void(), Patch_XactCylinder>() );
-       GlobalCommands_insert( "PatchXactSphere", FreeCaller<void(), Patch_XactSphere>() );
-       GlobalCommands_insert( "PatchXactCone", FreeCaller<void(), Patch_XactCone>() );
-       GlobalCommands_insert( "PatchEndCap", FreeCaller<void(), Patch_Endcap>() );
-       GlobalCommands_insert( "PatchBevel", FreeCaller<void(), Patch_Bevel>() );
-       GlobalCommands_insert( "PatchSquareBevel", FreeCaller<void(), Patch_SquareBevel>() );
-       GlobalCommands_insert( "PatchSquareEndcap", FreeCaller<void(), Patch_SquareEndcap>() );
-       GlobalCommands_insert( "PatchCone", FreeCaller<void(), Patch_Cone>() );
-       GlobalCommands_insert( "PatchSphere", FreeCaller<void(), Patch_Sphere>() );
-       GlobalCommands_insert( "SimplePatchMesh", FreeCaller<void(), Patch_Plane>(), Accelerator( 'P', (GdkModifierType)GDK_SHIFT_MASK ) );
-       GlobalCommands_insert( "PatchInsertInsertColumn", FreeCaller<void(), Patch_InsertInsertColumn>(), Accelerator( GDK_KEY_KP_Add, (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) );
-       GlobalCommands_insert( "PatchInsertAddColumn", FreeCaller<void(), Patch_InsertAddColumn>() );
-       GlobalCommands_insert( "PatchInsertInsertRow", FreeCaller<void(), Patch_InsertInsertRow>(), Accelerator( GDK_KEY_KP_Add, (GdkModifierType)GDK_CONTROL_MASK ) );
-       GlobalCommands_insert( "PatchInsertAddRow", FreeCaller<void(), Patch_InsertAddRow>() );
-       GlobalCommands_insert( "PatchDeleteFirstColumn", FreeCaller<void(), Patch_DeleteFirstColumn>() );
-       GlobalCommands_insert( "PatchDeleteLastColumn", FreeCaller<void(), Patch_DeleteLastColumn>(), Accelerator( GDK_KEY_KP_Subtract, (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) );
-       GlobalCommands_insert( "PatchDeleteFirstRow", FreeCaller<void(), Patch_DeleteFirstRow>(), Accelerator( GDK_KEY_KP_Subtract, (GdkModifierType)GDK_CONTROL_MASK ) );
-       GlobalCommands_insert( "PatchDeleteLastRow", FreeCaller<void(), Patch_DeleteLastRow>() );
-       GlobalCommands_insert( "InvertCurve", FreeCaller<void(), Patch_Invert>(), Accelerator( 'I', (GdkModifierType)GDK_CONTROL_MASK ) );
-       GlobalCommands_insert( "RedisperseRows", FreeCaller<void(), Patch_RedisperseRows>(), Accelerator( 'E', (GdkModifierType)GDK_CONTROL_MASK ) );
-       GlobalCommands_insert( "RedisperseCols", FreeCaller<void(), Patch_RedisperseCols>(), Accelerator( 'E', (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) );
-       GlobalCommands_insert( "SmoothRows", FreeCaller<void(), Patch_SmoothRows>(), Accelerator( 'W', (GdkModifierType)GDK_CONTROL_MASK ) );
-       GlobalCommands_insert( "SmoothCols", FreeCaller<void(), Patch_SmoothCols>(), Accelerator( 'W', (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) );
-       GlobalCommands_insert( "MatrixTranspose", FreeCaller<void(), Patch_Transpose>(), Accelerator( 'M', (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) );
-       GlobalCommands_insert( "CapCurrentCurve", FreeCaller<void(), Patch_Cap>(), Accelerator( 'C', (GdkModifierType)GDK_SHIFT_MASK ) );
-       GlobalCommands_insert( "CycleCapTexturePatch", FreeCaller<void(), Patch_CycleProjection>(), Accelerator( 'N', (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) );
-       GlobalCommands_insert( "MakeOverlayPatch", FreeCaller<void(), Patch_OverlayOn>(), Accelerator( 'Y' ) );
-       GlobalCommands_insert( "ClearPatchOverlays", FreeCaller<void(), Patch_OverlayOff>(), Accelerator( 'L', (GdkModifierType)GDK_CONTROL_MASK ) );
+       GlobalCommands_insert( "InvertCurveTextureX", makeCallbackF(Patch_FlipTextureX), Accelerator( 'I', (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) );
+       GlobalCommands_insert( "InvertCurveTextureY", makeCallbackF(Patch_FlipTextureY), Accelerator( 'I', (GdkModifierType)GDK_SHIFT_MASK ) );
+       GlobalCommands_insert( "NaturalizePatch", makeCallbackF(Patch_NaturalTexture), Accelerator( 'N', (GdkModifierType)GDK_CONTROL_MASK ) );
+       GlobalCommands_insert( "PatchCylinder", makeCallbackF(Patch_Cylinder) );
+       GlobalCommands_insert( "PatchDenseCylinder", makeCallbackF(Patch_DenseCylinder) );
+       GlobalCommands_insert( "PatchVeryDenseCylinder", makeCallbackF(Patch_VeryDenseCylinder) );
+       GlobalCommands_insert( "PatchSquareCylinder", makeCallbackF(Patch_SquareCylinder) );
+       GlobalCommands_insert( "PatchXactCylinder", makeCallbackF(Patch_XactCylinder) );
+       GlobalCommands_insert( "PatchXactSphere", makeCallbackF(Patch_XactSphere) );
+       GlobalCommands_insert( "PatchXactCone", makeCallbackF(Patch_XactCone) );
+       GlobalCommands_insert( "PatchEndCap", makeCallbackF(Patch_Endcap) );
+       GlobalCommands_insert( "PatchBevel", makeCallbackF(Patch_Bevel) );
+       GlobalCommands_insert( "PatchSquareBevel", makeCallbackF(Patch_SquareBevel) );
+       GlobalCommands_insert( "PatchSquareEndcap", makeCallbackF(Patch_SquareEndcap) );
+       GlobalCommands_insert( "PatchCone", makeCallbackF(Patch_Cone) );
+       GlobalCommands_insert( "PatchSphere", makeCallbackF(Patch_Sphere) );
+       GlobalCommands_insert( "SimplePatchMesh", makeCallbackF(Patch_Plane), Accelerator( 'P', (GdkModifierType)GDK_SHIFT_MASK ) );
+       GlobalCommands_insert( "PatchInsertInsertColumn", makeCallbackF(Patch_InsertInsertColumn), Accelerator( GDK_KEY_KP_Add, (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) );
+       GlobalCommands_insert( "PatchInsertAddColumn", makeCallbackF(Patch_InsertAddColumn) );
+       GlobalCommands_insert( "PatchInsertInsertRow", makeCallbackF(Patch_InsertInsertRow), Accelerator( GDK_KEY_KP_Add, (GdkModifierType)GDK_CONTROL_MASK ) );
+       GlobalCommands_insert( "PatchInsertAddRow", makeCallbackF(Patch_InsertAddRow) );
+       GlobalCommands_insert( "PatchDeleteFirstColumn", makeCallbackF(Patch_DeleteFirstColumn) );
+       GlobalCommands_insert( "PatchDeleteLastColumn", makeCallbackF(Patch_DeleteLastColumn), Accelerator( GDK_KEY_KP_Subtract, (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) );
+       GlobalCommands_insert( "PatchDeleteFirstRow", makeCallbackF(Patch_DeleteFirstRow), Accelerator( GDK_KEY_KP_Subtract, (GdkModifierType)GDK_CONTROL_MASK ) );
+       GlobalCommands_insert( "PatchDeleteLastRow", makeCallbackF(Patch_DeleteLastRow) );
+       GlobalCommands_insert( "InvertCurve", makeCallbackF(Patch_Invert), Accelerator( 'I', (GdkModifierType)GDK_CONTROL_MASK ) );
+       GlobalCommands_insert( "RedisperseRows", makeCallbackF(Patch_RedisperseRows), Accelerator( 'E', (GdkModifierType)GDK_CONTROL_MASK ) );
+       GlobalCommands_insert( "RedisperseCols", makeCallbackF(Patch_RedisperseCols), Accelerator( 'E', (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) );
+       GlobalCommands_insert( "SmoothRows", makeCallbackF(Patch_SmoothRows), Accelerator( 'W', (GdkModifierType)GDK_CONTROL_MASK ) );
+       GlobalCommands_insert( "SmoothCols", makeCallbackF(Patch_SmoothCols), Accelerator( 'W', (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) );
+       GlobalCommands_insert( "MatrixTranspose", makeCallbackF(Patch_Transpose), Accelerator( 'M', (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) );
+       GlobalCommands_insert( "CapCurrentCurve", makeCallbackF(Patch_Cap), Accelerator( 'C', (GdkModifierType)GDK_SHIFT_MASK ) );
+       GlobalCommands_insert( "CycleCapTexturePatch", makeCallbackF(Patch_CycleProjection), Accelerator( 'N', (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) );
+       GlobalCommands_insert( "MakeOverlayPatch", makeCallbackF(Patch_OverlayOn), Accelerator( 'Y' ) );
+       GlobalCommands_insert( "ClearPatchOverlays", makeCallbackF(Patch_OverlayOff), Accelerator( 'L', (GdkModifierType)GDK_CONTROL_MASK ) );
 }
 
 void Patch_constructToolbar( ui::Toolbar toolbar ){
index 1134d8a..5d9dd65 100644 (file)
@@ -166,7 +166,7 @@ ui::MenuItem create_plugins_menu(){
 
        //TODO: some modules/plugins do not yet support refresh
 #if 0
-       create_menu_item_with_mnemonic( menu, "Refresh", FreeCaller<void(), Restart>() );
+       create_menu_item_with_mnemonic( menu, "Refresh", makeCallbackF(Restart) );
 
        // NOTE: the seperator is used when doing a refresh of the list, everything past the seperator is removed
        g_plugins_menu_separator = menu_separator( menu );
index cc5ca5f..c4a5649 100644 (file)
@@ -330,9 +330,9 @@ void Pointfile_Construct(){
 
        GlobalShaderCache().attachRenderable( s_pointfile );
 
-       GlobalCommands_insert( "TogglePointfile", FreeCaller<void(), Pointfile_Toggle>() );
-       GlobalCommands_insert( "NextLeakSpot", FreeCaller<void(), Pointfile_Next>(), Accelerator( 'K', (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) );
-       GlobalCommands_insert( "PrevLeakSpot", FreeCaller<void(), Pointfile_Prev>(), Accelerator( 'L', (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) );
+       GlobalCommands_insert( "TogglePointfile", makeCallbackF(Pointfile_Toggle) );
+       GlobalCommands_insert( "NextLeakSpot", makeCallbackF(Pointfile_Next), Accelerator( 'K', (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) );
+       GlobalCommands_insert( "PrevLeakSpot", makeCallbackF(Pointfile_Prev), Accelerator( 'L', (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) );
 }
 
 void Pointfile_Destroy(){
index f3efd8d..510a1cc 100644 (file)
@@ -81,7 +81,7 @@ void Mouse_constructPage( PreferenceGroup& group ){
        Mouse_constructPreferences( page );
 }
 void Mouse_registerPreferencesPage(){
-       PreferencesDialog_addInterfacePage( FreeCaller<void(PreferenceGroup&), Mouse_constructPage>() );
+       PreferencesDialog_addInterfacePage( makeCallbackF(Mouse_constructPage) );
 }
 
 
@@ -668,7 +668,7 @@ PreferencesPage createPage( const char* treeName, const char* frameName ){
 };
 
 ui::Window PrefsDlg::BuildDialog(){
-       PreferencesDialog_addInterfacePreferences( FreeCaller<void(PreferencesPage&), Interface_constructPreferences>() );
+       PreferencesDialog_addInterfacePreferences( makeCallbackF(Interface_constructPreferences) );
        Mouse_registerPreferencesPage();
 
        ui::Window dialog = ui::Window(create_floating_window( "NetRadiant Preferences", m_parent ));
index 91e0645..b1c34c8 100644 (file)
@@ -471,7 +471,7 @@ struct ModelResource : public Resource
        void connectMap(){
                MapFile* map = Node_getMapFile( m_model );
                if ( map != 0 ) {
-                       map->setChangedCallback( FreeCaller<void(), MapChanged>() );
+                       map->setChangedCallback( makeCallbackF(MapChanged) );
                }
        }
        std::time_t modified() const {
index 5bfb45f..5700711 100644 (file)
@@ -1393,15 +1393,15 @@ void SurfaceInspector_constructPage( PreferenceGroup& group ){
        SurfaceInspector_constructPreferences( page );
 }
 void SurfaceInspector_registerPreferencesPage(){
-       PreferencesDialog_addSettingsPage( FreeCaller<void(PreferenceGroup&), SurfaceInspector_constructPage>() );
+       PreferencesDialog_addSettingsPage( makeCallbackF(SurfaceInspector_constructPage) );
 }
 
 void SurfaceInspector_registerCommands(){
-       GlobalCommands_insert( "FitTexture", FreeCaller<void(), SurfaceInspector_FitTexture>(), Accelerator( 'B', (GdkModifierType)GDK_SHIFT_MASK ) );
-       GlobalCommands_insert( "SurfaceInspector", FreeCaller<void(), SurfaceInspector_toggleShown>(), Accelerator( 'S' ) );
+       GlobalCommands_insert( "FitTexture", makeCallbackF(SurfaceInspector_FitTexture), Accelerator( 'B', (GdkModifierType)GDK_SHIFT_MASK ) );
+       GlobalCommands_insert( "SurfaceInspector", makeCallbackF(SurfaceInspector_toggleShown), Accelerator( 'S' ) );
 
-       GlobalCommands_insert( "FaceCopyTexture", FreeCaller<void(), SelectedFaces_copyTexture>() );
-       GlobalCommands_insert( "FacePasteTexture", FreeCaller<void(), SelectedFaces_pasteTexture>() );
+       GlobalCommands_insert( "FaceCopyTexture", makeCallbackF(SelectedFaces_copyTexture) );
+       GlobalCommands_insert( "FacePasteTexture", makeCallbackF(SelectedFaces_pasteTexture) );
 }
 
 
index 55f00b7..b724c31 100644 (file)
@@ -769,7 +769,7 @@ void Textures_constructPage( PreferenceGroup& group ){
        Textures_constructPreferences( page );
 }
 void Textures_registerPreferencesPage(){
-       PreferencesDialog_addDisplayPage( FreeCaller<void(PreferenceGroup&), Textures_constructPage>() );
+       PreferencesDialog_addDisplayPage( makeCallbackF(Textures_constructPage) );
 }
 
 void TextureCompression_importString( const char* string ){
index 09c7fc7..0097d9b 100644 (file)
@@ -2598,7 +2598,7 @@ void TextureBrowser_constructPage( PreferenceGroup& group ){
        TextureBrowser_constructPreferences( page );
 }
 void TextureBrowser_registerPreferencesPage(){
-       PreferencesDialog_addSettingsPage( FreeCaller<void(PreferenceGroup&), TextureBrowser_constructPage>() );
+       PreferencesDialog_addSettingsPage( makeCallbackF(TextureBrowser_constructPage) );
 }
 
 
@@ -2612,23 +2612,23 @@ typedef ReferenceCaller<TextureBrowser, void(std::size_t), TextureBrowser_setSca
 void TextureClipboard_textureSelected( const char* shader );
 
 void TextureBrowser_Construct(){
-       GlobalCommands_insert( "ShaderInfo", FreeCaller<void(), TextureBrowser_shaderInfo>() );
-       GlobalCommands_insert( "ShowUntagged", FreeCaller<void(), TextureBrowser_showUntagged>() );
-       GlobalCommands_insert( "AddTag", FreeCaller<void(), TextureBrowser_addTag>() );
-       GlobalCommands_insert( "RenameTag", FreeCaller<void(), TextureBrowser_renameTag>() );
-       GlobalCommands_insert( "DeleteTag", FreeCaller<void(), TextureBrowser_deleteTag>() );
-       GlobalCommands_insert( "CopyTag", FreeCaller<void(), TextureBrowser_copyTag>() );
-       GlobalCommands_insert( "PasteTag", FreeCaller<void(), TextureBrowser_pasteTag>() );
-       GlobalCommands_insert( "RefreshShaders", FreeCaller<void(), VFS_Refresh>() );
-       GlobalToggles_insert( "ShowInUse", FreeCaller<void(), TextureBrowser_ToggleHideUnused>(), ToggleItem::AddCallbackCaller( g_TextureBrowser.m_hideunused_item ), Accelerator( 'U' ) );
-       GlobalCommands_insert( "ShowAllTextures", FreeCaller<void(), TextureBrowser_showAll>(), Accelerator( 'A', (GdkModifierType)GDK_CONTROL_MASK ) );
-       GlobalCommands_insert( "ToggleTextures", FreeCaller<void(), TextureBrowser_toggleShow>(), Accelerator( 'T' ) );
-       GlobalToggles_insert( "ToggleShowShaders", FreeCaller<void(), TextureBrowser_ToggleShowShaders>(), ToggleItem::AddCallbackCaller( g_TextureBrowser.m_showshaders_item ) );
-       GlobalToggles_insert( "ToggleShowShaderlistOnly", FreeCaller<void(), TextureBrowser_ToggleShowShaderListOnly>(), ToggleItem::AddCallbackCaller( g_TextureBrowser.m_showshaderlistonly_item ) );
-       GlobalToggles_insert( "FixedSize", FreeCaller<void(), TextureBrowser_FixedSize>(), ToggleItem::AddCallbackCaller( g_TextureBrowser.m_fixedsize_item ) );
-       GlobalToggles_insert( "FilterMissing", FreeCaller<void(), TextureBrowser_FilterMissing>(), ToggleItem::AddCallbackCaller( g_TextureBrowser.m_filternotex_item ) );
-       GlobalToggles_insert( "FilterFallback", FreeCaller<void(), TextureBrowser_FilterFallback>(), ToggleItem::AddCallbackCaller( g_TextureBrowser.m_hidenotex_item ) );
-       GlobalToggles_insert( "EnableAlpha", FreeCaller<void(), TextureBrowser_EnableAlpha>(), ToggleItem::AddCallbackCaller( g_TextureBrowser.m_enablealpha_item ) );
+       GlobalCommands_insert( "ShaderInfo", makeCallbackF(TextureBrowser_shaderInfo) );
+       GlobalCommands_insert( "ShowUntagged", makeCallbackF(TextureBrowser_showUntagged) );
+       GlobalCommands_insert( "AddTag", makeCallbackF(TextureBrowser_addTag) );
+       GlobalCommands_insert( "RenameTag", makeCallbackF(TextureBrowser_renameTag) );
+       GlobalCommands_insert( "DeleteTag", makeCallbackF(TextureBrowser_deleteTag) );
+       GlobalCommands_insert( "CopyTag", makeCallbackF(TextureBrowser_copyTag) );
+       GlobalCommands_insert( "PasteTag", makeCallbackF(TextureBrowser_pasteTag) );
+       GlobalCommands_insert( "RefreshShaders", makeCallbackF(VFS_Refresh) );
+       GlobalToggles_insert( "ShowInUse", makeCallbackF(TextureBrowser_ToggleHideUnused), ToggleItem::AddCallbackCaller( g_TextureBrowser.m_hideunused_item ), Accelerator( 'U' ) );
+       GlobalCommands_insert( "ShowAllTextures", makeCallbackF(TextureBrowser_showAll), Accelerator( 'A', (GdkModifierType)GDK_CONTROL_MASK ) );
+       GlobalCommands_insert( "ToggleTextures", makeCallbackF(TextureBrowser_toggleShow), Accelerator( 'T' ) );
+       GlobalToggles_insert( "ToggleShowShaders", makeCallbackF(TextureBrowser_ToggleShowShaders), ToggleItem::AddCallbackCaller( g_TextureBrowser.m_showshaders_item ) );
+       GlobalToggles_insert( "ToggleShowShaderlistOnly", makeCallbackF(TextureBrowser_ToggleShowShaderListOnly), ToggleItem::AddCallbackCaller( g_TextureBrowser.m_showshaderlistonly_item ) );
+       GlobalToggles_insert( "FixedSize", makeCallbackF(TextureBrowser_FixedSize), ToggleItem::AddCallbackCaller( g_TextureBrowser.m_fixedsize_item ) );
+       GlobalToggles_insert( "FilterMissing", makeCallbackF(TextureBrowser_FilterMissing), ToggleItem::AddCallbackCaller( g_TextureBrowser.m_filternotex_item ) );
+       GlobalToggles_insert( "FilterFallback", makeCallbackF(TextureBrowser_FilterFallback), ToggleItem::AddCallbackCaller( g_TextureBrowser.m_hidenotex_item ) );
+       GlobalToggles_insert( "EnableAlpha", makeCallbackF(TextureBrowser_EnableAlpha), ToggleItem::AddCallbackCaller( g_TextureBrowser.m_enablealpha_item ) );
 
        GlobalPreferenceSystem().registerPreference( "TextureScale",
                                                                                                 makeSizeStringImportCallback( TextureBrowserSetScaleCaller( g_TextureBrowser ) ),
index d36738a..d5f6eb7 100644 (file)
@@ -190,7 +190,7 @@ void Build_constructPage( PreferenceGroup& group ){
        Build_constructPreferences( page );
 }
 void Build_registerPreferencesPage(){
-       PreferencesDialog_addSettingsPage( FreeCaller<void(PreferenceGroup&), Build_constructPage>() );
+       PreferencesDialog_addSettingsPage( makeCallbackF(Build_constructPage) );
 }
 
 #include "preferencesystem.h"
index 9e296f4..d6f2283 100644 (file)
@@ -2708,7 +2708,7 @@ void Orthographic_constructPage( PreferenceGroup& group ){
        Orthographic_constructPreferences( page );
 }
 void Orthographic_registerPreferencesPage(){
-       PreferencesDialog_addSettingsPage( FreeCaller<void(PreferenceGroup&), Orthographic_constructPage>() );
+       PreferencesDialog_addSettingsPage( makeCallbackF(Orthographic_constructPage) );
 }
 
 void Clipper_constructPreferences( PreferencesPage& page ){
@@ -2719,7 +2719,7 @@ void Clipper_constructPage( PreferenceGroup& group ){
        Clipper_constructPreferences( page );
 }
 void Clipper_registerPreferencesPage(){
-       PreferencesDialog_addSettingsPage( FreeCaller<void(PreferenceGroup&), Clipper_constructPage>() );
+       PreferencesDialog_addSettingsPage( makeCallbackF(Clipper_constructPage) );
 }
 
 
@@ -2740,21 +2740,21 @@ typedef ConstReferenceCaller<ToggleShown, void(const BoolImportCallback&), Toggl
 
 
 void XYWindow_Construct(){
-       GlobalCommands_insert( "ToggleCrosshairs", FreeCaller<void(), ToggleShowCrosshair>(), Accelerator( 'X', (GdkModifierType)GDK_SHIFT_MASK ) );
-       GlobalCommands_insert( "ToggleSizePaint", FreeCaller<void(), ToggleShowSizeInfo>(), Accelerator( 'J' ) );
-       GlobalCommands_insert( "ToggleGrid", FreeCaller<void(), ToggleShowGrid>(), Accelerator( '0' ) );
+       GlobalCommands_insert( "ToggleCrosshairs", makeCallbackF(ToggleShowCrosshair), Accelerator( 'X', (GdkModifierType)GDK_SHIFT_MASK ) );
+       GlobalCommands_insert( "ToggleSizePaint", makeCallbackF(ToggleShowSizeInfo), Accelerator( 'J' ) );
+       GlobalCommands_insert( "ToggleGrid", makeCallbackF(ToggleShowGrid), Accelerator( '0' ) );
 
        GlobalToggles_insert( "ToggleView", ToggleShown::ToggleCaller( g_xy_top_shown ), ToggleItem::AddCallbackCaller( g_xy_top_shown.m_item ), Accelerator( 'V', (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) );
        GlobalToggles_insert( "ToggleSideView", ToggleShown::ToggleCaller( g_yz_side_shown ), ToggleItem::AddCallbackCaller( g_yz_side_shown.m_item ) );
        GlobalToggles_insert( "ToggleFrontView", ToggleShown::ToggleCaller( g_xz_front_shown ), ToggleItem::AddCallbackCaller( g_xz_front_shown.m_item ) );
-       GlobalCommands_insert( "NextView", FreeCaller<void(), XY_Next>(), Accelerator( GDK_KEY_Tab, (GdkModifierType)GDK_CONTROL_MASK ) ); // fixme: doesn't show its shortcut
-       GlobalCommands_insert( "ZoomIn", FreeCaller<void(), XY_ZoomIn>(), Accelerator( GDK_KEY_Delete ) );
-       GlobalCommands_insert( "ZoomOut", FreeCaller<void(), XY_ZoomOut>(), Accelerator( GDK_KEY_Insert ) );
-       GlobalCommands_insert( "ViewTop", FreeCaller<void(), XY_Top>(), Accelerator( GDK_KEY_KP_Home ) );
-       GlobalCommands_insert( "ViewSide", FreeCaller<void(), XY_Side>(), Accelerator( GDK_KEY_KP_Page_Down ) );
-       GlobalCommands_insert( "ViewFront", FreeCaller<void(), XY_Front>(), Accelerator( GDK_KEY_KP_End ) );
-       GlobalCommands_insert( "Zoom100", FreeCaller<void(), XY_Zoom100>() );
-       GlobalCommands_insert( "CenterXYView", FreeCaller<void(), XY_Focus>(), Accelerator( GDK_KEY_Tab, (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) );
+       GlobalCommands_insert( "NextView", makeCallbackF(XY_Next), Accelerator( GDK_KEY_Tab, (GdkModifierType)GDK_CONTROL_MASK ) ); // fixme: doesn't show its shortcut
+       GlobalCommands_insert( "ZoomIn", makeCallbackF(XY_ZoomIn), Accelerator( GDK_KEY_Delete ) );
+       GlobalCommands_insert( "ZoomOut", makeCallbackF(XY_ZoomOut), Accelerator( GDK_KEY_Insert ) );
+       GlobalCommands_insert( "ViewTop", makeCallbackF(XY_Top), Accelerator( GDK_KEY_KP_Home ) );
+       GlobalCommands_insert( "ViewSide", makeCallbackF(XY_Side), Accelerator( GDK_KEY_KP_Page_Down ) );
+       GlobalCommands_insert( "ViewFront", makeCallbackF(XY_Front), Accelerator( GDK_KEY_KP_End ) );
+       GlobalCommands_insert( "Zoom100", makeCallbackF(XY_Zoom100) );
+       GlobalCommands_insert( "CenterXYView", makeCallbackF(XY_Focus), Accelerator( GDK_KEY_Tab, (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) );
 
        GlobalPreferenceSystem().registerPreference( "ClipCaulk", BoolImportStringCaller( g_clip_useCaulk ), BoolExportStringCaller( g_clip_useCaulk ) );