Move Signal/Slot/Bind stuff to base-lib.

This commit is contained in:
David Capello 2010-09-25 17:20:59 -03:00
parent 28d09af036
commit cd6b8d3d23
33 changed files with 151 additions and 404 deletions

View File

@ -19,8 +19,8 @@
#ifndef APP_H_INCLUDED #ifndef APP_H_INCLUDED
#define APP_H_INCLUDED #define APP_H_INCLUDED
#include "base/signal.h"
#include "jinete/jbase.h" #include "jinete/jbase.h"
#include "Vaca/Signal.h"
#include <vector> #include <vector>
@ -58,11 +58,11 @@ public:
RecentFiles* getRecentFiles() const; RecentFiles* getRecentFiles() const;
// App Signals // App Signals
Vaca::Signal0<void> Exit; Signal0<void> Exit;
Vaca::Signal0<void> PaletteChange; Signal0<void> PaletteChange;
Vaca::Signal0<void> PenSizeBeforeChange; Signal0<void> PenSizeBeforeChange;
Vaca::Signal0<void> PenSizeAfterChange; Signal0<void> PenSizeAfterChange;
Vaca::Signal0<void> CurrentToolChange; Signal0<void> CurrentToolChange;
private: private:
class Modules; class Modules;

View File

@ -1,50 +1,13 @@
// Vaca - Visual Application Components Abstraction // ASE base library
// Copyright (c) 2005-2009 David Capello // Copyright (C) 2001-2010 David Capello
// All rights reserved.
// //
// Redistribution and use in source and binary forms, with or without // This source file is ditributed under a BSD-like license, please
// modification, are permitted provided that the following conditions // read LICENSE.txt for more information.
// are met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in
// the documentation and/or other materials provided with the
// distribution.
// * Neither the name of the author nor the names of its contributors
// may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
// OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef VACA_BIND_H #ifndef BASE_BIND_H_INCLUDED
#define VACA_BIND_H #define BASE_BIND_H_INCLUDED
namespace Vaca {
/**
@defgroup bind_group Bind Classes and Functions
@{
*/
// ======================================================================
// BindAdapter0_fun // BindAdapter0_fun
/**
@see @ref page_bind
*/
template<typename R, typename F> template<typename R, typename F>
class BindAdapter0_fun class BindAdapter0_fun
{ {
@ -67,9 +30,6 @@ public:
R operator()(const A1& a1, const A2& a2, const A3& a3, const A4& a4) { return f(); } R operator()(const A1& a1, const A2& a2, const A3& a3, const A4& a4) { return f(); }
}; };
/**
@see @ref page_bind
*/
template<typename F> template<typename F>
class BindAdapter0_fun<void, F> class BindAdapter0_fun<void, F>
{ {
@ -92,9 +52,6 @@ public:
void operator()(const A1& a1, const A2& a2, const A3& a3, const A4& a4) { f(); } void operator()(const A1& a1, const A2& a2, const A3& a3, const A4& a4) { f(); }
}; };
/**
@see @ref page_bind
*/
template<typename R, typename F> template<typename R, typename F>
BindAdapter0_fun<R, F> BindAdapter0_fun<R, F>
Bind(const F& f) Bind(const F& f)
@ -102,12 +59,7 @@ Bind(const F& f)
return BindAdapter0_fun<R, F>(f); return BindAdapter0_fun<R, F>(f);
} }
// ======================================================================
// BindAdapter0_mem // BindAdapter0_mem
/**
@see @ref page_bind
*/
template<typename R, typename T> template<typename R, typename T>
class BindAdapter0_mem class BindAdapter0_mem
{ {
@ -132,9 +84,6 @@ public:
R operator()(const A1& a1, const A2& a2, const A3& a3, const A4& a4) { return (t->*m)(); } R operator()(const A1& a1, const A2& a2, const A3& a3, const A4& a4) { return (t->*m)(); }
}; };
/**
@see @ref page_bind
*/
template<typename T> template<typename T>
class BindAdapter0_mem<void, T> class BindAdapter0_mem<void, T>
{ {
@ -159,9 +108,6 @@ public:
void operator()(const A1& a1, const A2& a2, const A3& a3, const A4& a4) { (t->*m)(); } void operator()(const A1& a1, const A2& a2, const A3& a3, const A4& a4) { (t->*m)(); }
}; };
/**
@see @ref page_bind
*/
template<typename R, typename T, typename T2> template<typename R, typename T, typename T2>
BindAdapter0_mem<R, T> BindAdapter0_mem<R, T>
Bind(R (T::*m)(), T2* t) Bind(R (T::*m)(), T2* t)
@ -169,12 +115,7 @@ Bind(R (T::*m)(), T2* t)
return BindAdapter0_mem<R, T>(m, t); return BindAdapter0_mem<R, T>(m, t);
} }
// ======================================================================
// BindAdapter1_fun // BindAdapter1_fun
/**
@see @ref page_bind
*/
template<typename R, typename F, template<typename R, typename F,
typename X1> typename X1>
class BindAdapter1_fun class BindAdapter1_fun
@ -199,9 +140,6 @@ public:
R operator()(const A1& a1, const A2& a2, const A3& a3, const A4& a4) { return f(x1); } R operator()(const A1& a1, const A2& a2, const A3& a3, const A4& a4) { return f(x1); }
}; };
/**
@see @ref page_bind
*/
template<typename F, template<typename F,
typename X1> typename X1>
class BindAdapter1_fun<void, F, X1> class BindAdapter1_fun<void, F, X1>
@ -226,9 +164,6 @@ public:
void operator()(A1& a1, A2& a2, A3& a3, A4& a4) { f(x1); } void operator()(A1& a1, A2& a2, A3& a3, A4& a4) { f(x1); }
}; };
/**
@see @ref page_bind
*/
template<typename R, typename F, template<typename R, typename F,
typename X1> typename X1>
BindAdapter1_fun<R, F, X1> BindAdapter1_fun<R, F, X1>
@ -237,12 +172,7 @@ Bind(const F& f, X1 x1)
return BindAdapter1_fun<R, F, X1>(f, x1); return BindAdapter1_fun<R, F, X1>(f, x1);
} }
// ======================================================================
// BindAdapter1_mem // BindAdapter1_mem
/**
@see @ref page_bind
*/
template<typename R, typename T, template<typename R, typename T,
typename B1, typename B1,
typename X1> typename X1>
@ -270,9 +200,6 @@ public:
R operator()(const A1& a1, const A2& a2, const A3& a3, const A4& a4) { return (t->*m)(x1); } R operator()(const A1& a1, const A2& a2, const A3& a3, const A4& a4) { return (t->*m)(x1); }
}; };
/**
@see @ref page_bind
*/
template<typename T, template<typename T,
typename B1, typename B1,
typename X1> typename X1>
@ -300,9 +227,6 @@ public:
void operator()(const A1& a1, const A2& a2, const A3& a3, const A4& a4) { (t->*m)(x1); } void operator()(const A1& a1, const A2& a2, const A3& a3, const A4& a4) { (t->*m)(x1); }
}; };
/**
@see @ref page_bind
*/
template<typename R, typename T, typename T2, template<typename R, typename T, typename T2,
typename B1, typename X1> typename B1, typename X1>
BindAdapter1_mem<R, T, B1, X1> BindAdapter1_mem<R, T, B1, X1>
@ -311,12 +235,7 @@ Bind(R (T::*m)(B1), T2* t, X1 x1)
return BindAdapter1_mem<R, T, B1, X1>(m, t, x1); return BindAdapter1_mem<R, T, B1, X1>(m, t, x1);
} }
// ======================================================================
// BindAdapter2_fun // BindAdapter2_fun
/**
@see @ref page_bind
*/
template<typename R, typename F, template<typename R, typename F,
typename X1, typename X2> typename X1, typename X2>
class BindAdapter2_fun class BindAdapter2_fun
@ -342,9 +261,6 @@ public:
R operator()(const A1& a1, const A2& a2, const A3& a3, const A4& a4) { return f(x1, x2); } R operator()(const A1& a1, const A2& a2, const A3& a3, const A4& a4) { return f(x1, x2); }
}; };
/**
@see @ref page_bind
*/
template<typename F, template<typename F,
typename X1, typename X2> typename X1, typename X2>
class BindAdapter2_fun<void, F, X1, X2> class BindAdapter2_fun<void, F, X1, X2>
@ -370,9 +286,6 @@ public:
void operator()(const A1& a1, const A2& a2, const A3& a3, const A4& a4) { f(x1, x2); } void operator()(const A1& a1, const A2& a2, const A3& a3, const A4& a4) { f(x1, x2); }
}; };
/**
@see @ref page_bind
*/
template<typename R, typename F, template<typename R, typename F,
typename X1, typename X2> typename X1, typename X2>
BindAdapter2_fun<R, F, X1, X2> BindAdapter2_fun<R, F, X1, X2>
@ -381,12 +294,7 @@ Bind(const F& f, X1 x1, X2 x2)
return BindAdapter2_fun<R, F, X1, X2>(f, x1, x2); return BindAdapter2_fun<R, F, X1, X2>(f, x1, x2);
} }
// ======================================================================
// BindAdapter2_mem // BindAdapter2_mem
/**
@see @ref page_bind
*/
template<typename R, typename T, template<typename R, typename T,
typename B1, typename B2, typename B1, typename B2,
typename X1, typename X2> typename X1, typename X2>
@ -415,9 +323,6 @@ public:
R operator()(const A1& a1, const A2& a2, const A3& a3, const A4& a4) { return (t->*m)(x1, x2); } R operator()(const A1& a1, const A2& a2, const A3& a3, const A4& a4) { return (t->*m)(x1, x2); }
}; };
/**
@see @ref page_bind
*/
template<typename T, template<typename T,
typename B1, typename B2, typename B1, typename B2,
typename X1, typename X2> typename X1, typename X2>
@ -446,9 +351,6 @@ public:
void operator()(const A1& a1, const A2& a2, const A3& a3, const A4& a4) { (t->*m)(x1, x2); } void operator()(const A1& a1, const A2& a2, const A3& a3, const A4& a4) { (t->*m)(x1, x2); }
}; };
/**
@see @ref page_bind
*/
template<typename R, typename T, typename T2, typename B1, typename B2, typename X1, typename X2> template<typename R, typename T, typename T2, typename B1, typename B2, typename X1, typename X2>
BindAdapter2_mem<R, T, B1, B2, X1, X2> BindAdapter2_mem<R, T, B1, B2, X1, X2>
Bind(R (T::*m)(B1, B2), T2* t, X1 x1, X2 x2) Bind(R (T::*m)(B1, B2), T2* t, X1 x1, X2 x2)
@ -456,12 +358,7 @@ Bind(R (T::*m)(B1, B2), T2* t, X1 x1, X2 x2)
return BindAdapter2_mem<R, T, B1, B2, X1, X2>(m, t, x1, x2); return BindAdapter2_mem<R, T, B1, B2, X1, X2>(m, t, x1, x2);
} }
// ======================================================================
// BindAdapter3_fun // BindAdapter3_fun
/**
@see @ref page_bind
*/
template<typename R, typename F, template<typename R, typename F,
typename X1, typename X2, typename X3> typename X1, typename X2, typename X3>
class BindAdapter3_fun class BindAdapter3_fun
@ -488,9 +385,6 @@ public:
R operator()(const A1& a1, const A2& a2, const A3& a3, const A4& a4) { return f(x1, x2, x3); } R operator()(const A1& a1, const A2& a2, const A3& a3, const A4& a4) { return f(x1, x2, x3); }
}; };
/**
@see @ref page_bind
*/
template<typename F, template<typename F,
typename X1, typename X2, typename X3> typename X1, typename X2, typename X3>
class BindAdapter3_fun<void, F, X1, X2, X3> class BindAdapter3_fun<void, F, X1, X2, X3>
@ -517,9 +411,6 @@ public:
void operator()(const A1& a1, const A2& a2, const A3& a3, const A4& a4) { f(x1, x2, x3); } void operator()(const A1& a1, const A2& a2, const A3& a3, const A4& a4) { f(x1, x2, x3); }
}; };
/**
@see @ref page_bind
*/
template<typename R, typename F, template<typename R, typename F,
typename X1, typename X2, typename X3> typename X1, typename X2, typename X3>
BindAdapter3_fun<R, F, X1, X2, X3> BindAdapter3_fun<R, F, X1, X2, X3>
@ -528,12 +419,7 @@ Bind(const F& f, X1 x1, X2 x2, X3 x3)
return BindAdapter3_fun<R, F, X1, X2, X3>(f, x1, x2, x3); return BindAdapter3_fun<R, F, X1, X2, X3>(f, x1, x2, x3);
} }
// ======================================================================
// BindAdapter3_mem // BindAdapter3_mem
/**
@see @ref page_bind
*/
template<typename R, typename T, template<typename R, typename T,
typename B1, typename B2, typename B3, typename B1, typename B2, typename B3,
typename X1, typename X2, typename X3> typename X1, typename X2, typename X3>
@ -563,9 +449,6 @@ public:
R operator()(const A1& a1, const A2& a2, const A3& a3, const A4& a4) { return (t->*m)(x1, x2, x3); } R operator()(const A1& a1, const A2& a2, const A3& a3, const A4& a4) { return (t->*m)(x1, x2, x3); }
}; };
/**
@see @ref page_bind
*/
template<typename T, template<typename T,
typename B1, typename B2, typename B3, typename B1, typename B2, typename B3,
typename X1, typename X2, typename X3> typename X1, typename X2, typename X3>
@ -595,9 +478,6 @@ public:
void operator()(const A1& a1, const A2& a2, const A3& a3, const A4& a4) { (t->*m)(x1, x2, x3); } void operator()(const A1& a1, const A2& a2, const A3& a3, const A4& a4) { (t->*m)(x1, x2, x3); }
}; };
/**
@see @ref page_bind
*/
template<typename R, typename T, typename T2, template<typename R, typename T, typename T2,
typename B1, typename B2, typename B3, typename B1, typename B2, typename B3,
typename X1, typename X2, typename X3> typename X1, typename X2, typename X3>
@ -607,14 +487,8 @@ Bind(R (T::*m)(B1, B2, B3), T2* t, X1 x1, X2 x2)
return BindAdapter3_mem<R, T, B1, B2, B3, X1, X2, X3>(m, t, x1, x2); return BindAdapter3_mem<R, T, B1, B2, B3, X1, X2, X3>(m, t, x1, x2);
} }
// ====================================================================== // Helper class to holds references as pointers (to avoid copying the
// RefWrapper // original object).
/**
@todo
@see @ref page_bind
*/
template<class T> template<class T>
class RefWrapper class RefWrapper
{ {
@ -624,20 +498,12 @@ public:
operator T&() const { return *ptr; } operator T&() const { return *ptr; }
}; };
/** // Creates RefWrappers, useful to wrap arguments that have to be
Creates RefWrappers, useful to wrap arguments that have to be // passed as a reference when you use Bind.
passed as a reference when you use Bind.
@see @ref page_bind
*/
template<class T> template<class T>
RefWrapper<T> Ref(T& ref) RefWrapper<T> Ref(T& ref)
{ {
return RefWrapper<T>(ref); return RefWrapper<T>(ref);
} }
/** @} */ #endif
} // namespace Vaca
#endif // VACA_BIND_H

View File

@ -1,55 +1,18 @@
// Vaca - Visual Application Components Abstraction // ASE base library
// Copyright (c) 2005-2009 David Capello // Copyright (C) 2001-2010 David Capello
// All rights reserved.
// //
// Redistribution and use in source and binary forms, with or without // This source file is ditributed under a BSD-like license, please
// modification, are permitted provided that the following conditions // read LICENSE.txt for more information.
// are met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in
// the documentation and/or other materials provided with the
// distribution.
// * Neither the name of the author nor the names of its contributors
// may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
// OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef VACA_SIGNAL_H #ifndef BASE_SIGNAL_H_INCLUDED
#define VACA_SIGNAL_H #define BASE_SIGNAL_H_INCLUDED
#include "Vaca/base.h" #include "base/slot.h"
#include "Vaca/Slot.h"
#include <vector> #include <vector>
namespace Vaca { // Signal0_base<R> - Base class to delegate responsibility to
// functions of zero arguments.
/**
@defgroup signal_group Signal Classes
@{
*/
// ======================================================================
// Signal0_base<R>
/**
Base class for signals which call functions without parameters.
*/
template<typename R> template<typename R>
class Signal0_base class Signal0_base
{ {
@ -132,9 +95,7 @@ private:
}; };
// ======================================================================
// Signal0<R> // Signal0<R>
template<typename R> template<typename R>
class Signal0 : public Signal0_base<R> class Signal0 : public Signal0_base<R>
{ {
@ -172,9 +133,7 @@ public:
}; };
// ======================================================================
// Signal0<void> // Signal0<void>
template<> template<>
class Signal0<void> : public Signal0_base<void> class Signal0<void> : public Signal0_base<void>
{ {
@ -196,12 +155,8 @@ public:
}; };
// ====================================================================== // Signal1_base<R, A1> - Base class to delegate responsibility to
// Signal1_base<R, A1> // functions of one argument.
/**
Base class for signals which call functions with one parameter.
*/
template<typename R, typename A1> template<typename R, typename A1>
class Signal1_base class Signal1_base
{ {
@ -284,9 +239,7 @@ private:
}; };
// ======================================================================
// Signal1<R, A1> // Signal1<R, A1>
template<typename R, typename A1> template<typename R, typename A1>
class Signal1 : public Signal1_base<R, A1> class Signal1 : public Signal1_base<R, A1>
{ {
@ -324,9 +277,7 @@ public:
}; };
// ======================================================================
// Signal1<void, A1> // Signal1<void, A1>
template<typename A1> template<typename A1>
class Signal1<void, A1> : public Signal1_base<void, A1> class Signal1<void, A1> : public Signal1_base<void, A1>
{ {
@ -348,12 +299,8 @@ public:
}; };
// ====================================================================== // Signal2_base<R, A1, A2> - Base class to delegate responsibility to
// Signal2_base<R, A1, A2> // functions of two arguments.
/**
Base class for signals which call functions with two parameters.
*/
template<typename R, typename A1, typename A2> template<typename R, typename A1, typename A2>
class Signal2_base class Signal2_base
{ {
@ -436,9 +383,7 @@ private:
}; };
// ======================================================================
// Signal2<R, A1> // Signal2<R, A1>
template<typename R, typename A1, typename A2> template<typename R, typename A1, typename A2>
class Signal2 : public Signal2_base<R, A1, A2> class Signal2 : public Signal2_base<R, A1, A2>
{ {
@ -476,9 +421,7 @@ public:
}; };
// ======================================================================
// Signal2<void, A1> // Signal2<void, A1>
template<typename A1, typename A2> template<typename A1, typename A2>
class Signal2<void, A1, A2> : public Signal2_base<void, A1, A2> class Signal2<void, A1, A2> : public Signal2_base<void, A1, A2>
{ {
@ -500,8 +443,4 @@ public:
}; };
/** @} */ #endif
} // namespace Vaca
#endif // VACA_SIGNAL_H

View File

@ -1,49 +1,13 @@
// Vaca - Visual Application Components Abstraction // ASE base library
// Copyright (c) 2005-2009 David Capello // Copyright (C) 2001-2010 David Capello
// All rights reserved.
// //
// Redistribution and use in source and binary forms, with or without // This source file is ditributed under a BSD-like license, please
// modification, are permitted provided that the following conditions // read LICENSE.txt for more information.
// are met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in
// the documentation and/or other materials provided with the
// distribution.
// * Neither the name of the author nor the names of its contributors
// may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
// OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef VACA_SLOT_H #ifndef BASE_SLOT_H_INCLUDED
#define VACA_SLOT_H #define BASE_SLOT_H_INCLUDED
#include "Vaca/base.h"
namespace Vaca {
/**
@defgroup slot_group Slot Classes
@{
*/
// ======================================================================
// Slot0
// Slot0 - Base class for delegates of zero arguments.
template<typename R> template<typename R>
class Slot0 class Slot0
{ {
@ -55,9 +19,7 @@ public:
virtual Slot0* clone() const = 0; virtual Slot0* clone() const = 0;
}; };
// ======================================================================
// Slot0_fun - hold a F instance and use the function call operator // Slot0_fun - hold a F instance and use the function call operator
template<typename R, typename F> template<typename R, typename F>
class Slot0_fun : public Slot0<R> class Slot0_fun : public Slot0<R>
{ {
@ -82,9 +44,7 @@ public:
Slot0_fun* clone() const { return new Slot0_fun(*this); } Slot0_fun* clone() const { return new Slot0_fun(*this); }
}; };
// ======================================================================
// Slot0_mem - pointer to a member function of the T class // Slot0_mem - pointer to a member function of the T class
template<typename R, class T> template<typename R, class T>
class Slot0_mem : public Slot0<R> class Slot0_mem : public Slot0<R>
{ {
@ -111,9 +71,7 @@ public:
Slot0_mem* clone() const { return new Slot0_mem(*this); } Slot0_mem* clone() const { return new Slot0_mem(*this); }
}; };
// ====================================================================== // Slot1 - Base class for delegates of one argument.
// Slot1
template<typename R, typename A1> template<typename R, typename A1>
class Slot1 class Slot1
{ {
@ -125,9 +83,7 @@ public:
virtual Slot1* clone() const = 0; virtual Slot1* clone() const = 0;
}; };
// ======================================================================
// Slot1_fun - hold a F instance and use the function call operator // Slot1_fun - hold a F instance and use the function call operator
template<typename R, typename F, typename A1> template<typename R, typename F, typename A1>
class Slot1_fun : public Slot1<R, A1> class Slot1_fun : public Slot1<R, A1>
{ {
@ -152,9 +108,7 @@ public:
Slot1_fun* clone() const { return new Slot1_fun(*this); } Slot1_fun* clone() const { return new Slot1_fun(*this); }
}; };
// ======================================================================
// Slot1_mem - pointer to a member function of the T class // Slot1_mem - pointer to a member function of the T class
template<typename R, class T, typename A1> template<typename R, class T, typename A1>
class Slot1_mem : public Slot1<R, A1> class Slot1_mem : public Slot1<R, A1>
{ {
@ -181,9 +135,7 @@ public:
Slot1_mem* clone() const { return new Slot1_mem(*this); } Slot1_mem* clone() const { return new Slot1_mem(*this); }
}; };
// ====================================================================== // Slot2 - Base class for delegates of two arguments.
// Slot2
template<typename R, typename A1, typename A2> template<typename R, typename A1, typename A2>
class Slot2 class Slot2
{ {
@ -195,9 +147,7 @@ public:
virtual Slot2* clone() const = 0; virtual Slot2* clone() const = 0;
}; };
// ======================================================================
// Slot2_fun - hold a F instance and use the function call operator // Slot2_fun - hold a F instance and use the function call operator
template<typename R, typename F, typename A1, typename A2> template<typename R, typename F, typename A1, typename A2>
class Slot2_fun : public Slot2<R, A1, A2> class Slot2_fun : public Slot2<R, A1, A2>
{ {
@ -222,9 +172,7 @@ public:
Slot2_fun* clone() const { return new Slot2_fun(*this); } Slot2_fun* clone() const { return new Slot2_fun(*this); }
}; };
// ======================================================================
// Slot2_mem - pointer to a member function of the T class // Slot2_mem - pointer to a member function of the T class
template<typename R, class T, typename A1, typename A2> template<typename R, class T, typename A1, typename A2>
class Slot2_mem : public Slot2<R, A1, A2> class Slot2_mem : public Slot2<R, A1, A2>
{ {
@ -251,10 +199,4 @@ public:
Slot2_mem* clone() const { return new Slot2_mem(*this); } Slot2_mem* clone() const { return new Slot2_mem(*this); }
}; };
// ====================================================================== #endif
/** @} */
} // namespace Vaca
#endif // VACA_SLOT_H

View File

@ -20,8 +20,8 @@
#include <allegro.h> #include <allegro.h>
#include "base/bind.h"
#include "jinete/jinete.h" #include "jinete/jinete.h"
#include "Vaca/Bind.h"
#include "commands/command.h" #include "commands/command.h"
#include "modules/gui.h" #include "modules/gui.h"
@ -97,7 +97,7 @@ void AboutCommand::onExecute(Context* context)
close_button->border_width.r + 16*jguiscale(), close_button->border_width.r + 16*jguiscale(),
close_button->border_width.b); close_button->border_width.b);
close_button->Click.connect(Vaca::Bind<void>(&Frame::closeWindow, frame.get(), close_button)); close_button->Click.connect(Bind<void>(&Frame::closeWindow, frame.get(), close_button));
frame->open_window_fg(); frame->open_window_fg();
} }

View File

@ -20,7 +20,7 @@
#include <allegro.h> #include <allegro.h>
#include "Vaca/Bind.h" #include "base/bind.h"
#include "jinete/jinete.h" #include "jinete/jinete.h"
#include "app.h" #include "app.h"
@ -296,15 +296,15 @@ void ConfigureTools::onExecute(Context* context)
jwidget_add_child(brush_type_box, brush_type); jwidget_add_child(brush_type_box, brush_type);
// Slots // Slots
window->Close.connect(Vaca::Bind<bool>(&window_close_hook, (JWidget)window, (void*)0)); window->Close.connect(Bind<bool>(&window_close_hook, (JWidget)window, (void*)0));
m_tiled->Click.connect(Vaca::Bind<void>(&ConfigureTools::onTiledClick, this)); m_tiled->Click.connect(Bind<void>(&ConfigureTools::onTiledClick, this));
m_tiledX->Click.connect(Vaca::Bind<void>(&ConfigureTools::onTiledXYClick, this, TILED_X_AXIS, m_tiledX)); m_tiledX->Click.connect(Bind<void>(&ConfigureTools::onTiledXYClick, this, TILED_X_AXIS, m_tiledX));
m_tiledY->Click.connect(Vaca::Bind<void>(&ConfigureTools::onTiledXYClick, this, TILED_Y_AXIS, m_tiledY)); m_tiledY->Click.connect(Bind<void>(&ConfigureTools::onTiledXYClick, this, TILED_Y_AXIS, m_tiledY));
m_viewGrid->Click.connect(Vaca::Bind<void>(&ConfigureTools::onViewGridClick, this)); m_viewGrid->Click.connect(Bind<void>(&ConfigureTools::onViewGridClick, this));
m_pixelGrid->Click.connect(Vaca::Bind<void>(&ConfigureTools::onPixelGridClick, this)); m_pixelGrid->Click.connect(Bind<void>(&ConfigureTools::onPixelGridClick, this));
set_grid->Click.connect(Vaca::Bind<void>(&ConfigureTools::onSetGridClick, this)); set_grid->Click.connect(Bind<void>(&ConfigureTools::onSetGridClick, this));
m_snapToGrid->Click.connect(Vaca::Bind<void>(&ConfigureTools::onSnapToGridClick, this)); m_snapToGrid->Click.connect(Bind<void>(&ConfigureTools::onSnapToGridClick, this));
m_onionSkin->Click.connect(Vaca::Bind<void>(&ConfigureTools::onOnionSkinClick, this)); m_onionSkin->Click.connect(Bind<void>(&ConfigureTools::onOnionSkinClick, this));
App::instance()->Exit.connect(&on_exit_delete_this_widget); App::instance()->Exit.connect(&on_exit_delete_this_widget);
App::instance()->PenSizeAfterChange.connect(&on_pen_size_after_change); App::instance()->PenSizeAfterChange.connect(&on_pen_size_after_change);

View File

@ -18,11 +18,11 @@
#include "config.h" #include "config.h"
#include "base/bind.h"
#include "jinete/jinete.h" #include "jinete/jinete.h"
#include "Vaca/Bind.h"
#include "commands/command.h"
#include "app.h" #include "app.h"
#include "commands/command.h"
#include "modules/gui.h" #include "modules/gui.h"
#include "raster/image.h" #include "raster/image.h"
#include "raster/layer.h" #include "raster/layer.h"
@ -74,8 +74,8 @@ void LayerPropertiesCommand::onExecute(Context* context)
Button* button_ok = new Button("&OK"); Button* button_ok = new Button("&OK");
Button* button_cancel = new Button("&Cancel"); Button* button_cancel = new Button("&Cancel");
button_ok->Click.connect(Vaca::Bind<void>(&Frame::closeWindow, window.get(), button_ok)); button_ok->Click.connect(Bind<void>(&Frame::closeWindow, window.get(), button_ok));
button_cancel->Click.connect(Vaca::Bind<void>(&Frame::closeWindow, window.get(), button_cancel)); button_cancel->Click.connect(Bind<void>(&Frame::closeWindow, window.get(), button_cancel));
if (with_blend_modes) { if (with_blend_modes) {
label_bm = new Label("Blend mode:"); label_bm = new Label("Blend mode:");

View File

@ -20,8 +20,8 @@
#include <allegro.h> #include <allegro.h>
#include "base/bind.h"
#include "jinete/jinete.h" #include "jinete/jinete.h"
#include "Vaca/Bind.h"
#include "app.h" #include "app.h"
#include "commands/command.h" #include "commands/command.h"
@ -138,7 +138,7 @@ void OptionsCommand::onExecute(Context* context)
jwidget_add_child(checked_bg_color2_box, m_checked_bg_color2); jwidget_add_child(checked_bg_color2_box, m_checked_bg_color2);
// Reset button // Reset button
checked_bg_reset->Click.connect(Vaca::Bind<void>(&OptionsCommand::onResetCheckedBg, this)); checked_bg_reset->Click.connect(Bind<void>(&OptionsCommand::onResetCheckedBg, this));
// Undo limit // Undo limit
undo_size_limit->setTextf("%d", get_config_int("Options", "UndoSizeLimit", 8)); undo_size_limit->setTextf("%d", get_config_int("Options", "UndoSizeLimit", 8));

View File

@ -23,7 +23,7 @@
#include <string.h> #include <string.h>
#include <vector> #include <vector>
#include "Vaca/Bind.h" #include "base/bind.h"
#include "jinete/jinete.h" #include "jinete/jinete.h"
#include "app.h" #include "app.h"
@ -182,7 +182,7 @@ void PaletteEditorCommand::onExecute(Context* context)
first_time = true; first_time = true;
// Append hooks // Append hooks
window->Close.connect(Vaca::Bind<bool>(&window_close_hook, (JWidget)window, (void*)0)); window->Close.connect(Bind<bool>(&window_close_hook, (JWidget)window, (void*)0));
// Hook fg/bg color changes (by eyedropper mainly) // Hook fg/bg color changes (by eyedropper mainly)
app_get_colorbar()->FgColorChange.connect(&on_color_changed); app_get_colorbar()->FgColorChange.connect(&on_color_changed);
@ -265,11 +265,11 @@ void PaletteEditorCommand::onExecute(Context* context)
// Hide (or show) the "More Options" depending the saved value in .cfg file // Hide (or show) the "More Options" depending the saved value in .cfg file
more_options->setVisible(get_config_bool("PaletteEditor", "ShowMoreOptions", false)); more_options->setVisible(get_config_bool("PaletteEditor", "ShowMoreOptions", false));
button_load->Click.connect(Vaca::Bind<void>(&load_command, button_load)); button_load->Click.connect(Bind<void>(&load_command, button_load));
button_save->Click.connect(Vaca::Bind<void>(&save_command, button_save)); button_save->Click.connect(Bind<void>(&save_command, button_save));
button_ramp->Click.connect(Vaca::Bind<void>(&ramp_command, button_ramp)); button_ramp->Click.connect(Bind<void>(&ramp_command, button_ramp));
button_sort->Click.connect(Vaca::Bind<void>(&sort_command, button_sort)); button_sort->Click.connect(Bind<void>(&sort_command, button_sort));
button_quantize->Click.connect(Vaca::Bind<void>(&quantize_command, button_quantize)); button_quantize->Click.connect(Bind<void>(&quantize_command, button_quantize));
select_rgb_hook(NULL, NULL); select_rgb_hook(NULL, NULL);
} }

View File

@ -20,12 +20,12 @@
#include <allegro/unicode.h> #include <allegro/unicode.h>
#include "base/bind.h"
#include "jinete/jinete.h" #include "jinete/jinete.h"
#include "Vaca/Bind.h"
#include "commands/command.h"
#include "app/color.h" #include "app/color.h"
#include "base/mem_utils.h" #include "base/mem_utils.h"
#include "commands/command.h"
#include "modules/gui.h" #include "modules/gui.h"
#include "raster/image.h" #include "raster/image.h"
#include "raster/palette.h" #include "raster/palette.h"
@ -121,7 +121,7 @@ void SpritePropertiesCommand::onExecute(Context* context)
frames->setTextf("%d", sprite->getTotalFrames()); frames->setTextf("%d", sprite->getTotalFrames());
// Speed button // Speed button
speed->Click.connect(Vaca::Bind<void>(&dialogs_frame_length, sprite, -1)); speed->Click.connect(Bind<void>(&dialogs_frame_length, sprite, -1));
} }
window->remap_window(); window->remap_window();

View File

@ -20,8 +20,8 @@
#include <allegro/unicode.h> #include <allegro/unicode.h>
#include "base/bind.h"
#include "jinete/jinete.h" #include "jinete/jinete.h"
#include "Vaca/Bind.h"
#include "commands/command.h" #include "commands/command.h"
#include "core/cfg.h" #include "core/cfg.h"
@ -205,7 +205,7 @@ void SpriteSizeCommand::onExecute(Context* context)
width_px->setTextf("%d", sprite->getWidth()); width_px->setTextf("%d", sprite->getWidth());
height_px->setTextf("%d", sprite->getHeight()); height_px->setTextf("%d", sprite->getHeight());
m_lockRatio->Click.connect(Vaca::Bind<void>(&SpriteSizeCommand::onLockRatioClick, this)); m_lockRatio->Click.connect(Bind<void>(&SpriteSizeCommand::onLockRatioClick, this));
HOOK(width_px, JI_SIGNAL_ENTRY_CHANGE, width_px_change_hook, 0); HOOK(width_px, JI_SIGNAL_ENTRY_CHANGE, width_px_change_hook, 0);
HOOK(height_px, JI_SIGNAL_ENTRY_CHANGE, height_px_change_hook, 0); HOOK(height_px, JI_SIGNAL_ENTRY_CHANGE, height_px_change_hook, 0);

View File

@ -18,15 +18,15 @@
#include "config.h" #include "config.h"
#include "base/bind.h"
#include "jinete/jinete.h" #include "jinete/jinete.h"
#include "Vaca/Bind.h"
#include "app.h"
#include "app/color.h"
#include "commands/command.h" #include "commands/command.h"
#include "commands/fx/effectbg.h" #include "commands/fx/effectbg.h"
#include "console.h" #include "console.h"
#include "app.h"
#include "core/cfg.h" #include "core/cfg.h"
#include "app/color.h"
#include "effect/colcurve.h" #include "effect/colcurve.h"
#include "effect/effect.h" #include "effect/effect.h"
#include "modules/gui.h" #include "modules/gui.h"
@ -124,7 +124,7 @@ void ColorCurveCommand::onExecute(Context* context)
jwidget_add_child(box_target, target_button); jwidget_add_child(box_target, target_button);
jwidget_add_child(window, preview); jwidget_add_child(window, preview);
check_preview->Click.connect(Vaca::Bind<void>(&preview_change_hook, check_preview)); check_preview->Click.connect(Bind<void>(&preview_change_hook, check_preview));
jwidget_add_hook(window, -1, window_msg_proc, NULL); jwidget_add_hook(window, -1, window_msg_proc, NULL);
/* default position */ /* default position */

View File

@ -20,6 +20,7 @@
#include <string.h> #include <string.h>
#include "base/bind.h"
#include "jinete/jbox.h" #include "jinete/jbox.h"
#include "jinete/jbutton.h" #include "jinete/jbutton.h"
#include "jinete/jhook.h" #include "jinete/jhook.h"
@ -30,13 +31,12 @@
#include "jinete/jview.h" #include "jinete/jview.h"
#include "jinete/jwidget.h" #include "jinete/jwidget.h"
#include "jinete/jwindow.h" #include "jinete/jwindow.h"
#include "Vaca/Bind.h"
#include "app/color.h"
#include "commands/command.h" #include "commands/command.h"
#include "commands/fx/effectbg.h" #include "commands/fx/effectbg.h"
#include "console.h" #include "console.h"
#include "core/cfg.h" #include "core/cfg.h"
#include "app/color.h"
#include "effect/colcurve.h" #include "effect/colcurve.h"
#include "effect/convmatr.h" #include "effect/convmatr.h"
#include "effect/effect.h" #include "effect/effect.h"
@ -135,10 +135,10 @@ void ConvolutionMatrixCommand::onExecute(Context* context)
HOOK(list_convmatr, JI_SIGNAL_LISTBOX_CHANGE, list_change_hook, 0); HOOK(list_convmatr, JI_SIGNAL_LISTBOX_CHANGE, list_change_hook, 0);
HOOK(target_button, SIGNAL_TARGET_BUTTON_CHANGE, target_change_hook, 0); HOOK(target_button, SIGNAL_TARGET_BUTTON_CHANGE, target_change_hook, 0);
check_preview->Click.connect(Vaca::Bind<void>(&preview_change_hook, check_preview)); check_preview->Click.connect(Bind<void>(&preview_change_hook, check_preview));
check_tiled->Click.connect(Vaca::Bind<void>(&tiled_change_hook, check_tiled)); check_tiled->Click.connect(Bind<void>(&tiled_change_hook, check_tiled));
reload->Click.connect(Vaca::Bind<bool>(&reload_select_hook, list_convmatr)); reload->Click.connect(Bind<bool>(&reload_select_hook, list_convmatr));
generate->Click.connect(Vaca::Bind<void>(&generate_select_hook)); generate->Click.connect(Bind<void>(&generate_select_hook));
// TODO enable this someday // TODO enable this someday
generate->setEnabled(false); generate->setEnabled(false);

View File

@ -20,13 +20,13 @@
#include <stdio.h> #include <stdio.h>
#include "base/bind.h"
#include "jinete/jbox.h" #include "jinete/jbox.h"
#include "jinete/jbutton.h" #include "jinete/jbutton.h"
#include "jinete/jentry.h" #include "jinete/jentry.h"
#include "jinete/jhook.h" #include "jinete/jhook.h"
#include "jinete/jwidget.h" #include "jinete/jwidget.h"
#include "jinete/jwindow.h" #include "jinete/jwindow.h"
#include "Vaca/Bind.h"
#include "commands/command.h" #include "commands/command.h"
#include "commands/fx/effectbg.h" #include "commands/fx/effectbg.h"
@ -124,7 +124,7 @@ void DespeckleCommand::onExecute(Context* context)
HOOK(target_button, SIGNAL_TARGET_BUTTON_CHANGE, target_change_hook, 0); HOOK(target_button, SIGNAL_TARGET_BUTTON_CHANGE, target_change_hook, 0);
HOOK(check_tiled, JI_SIGNAL_CHECK_CHANGE, tiled_change_hook, 0); HOOK(check_tiled, JI_SIGNAL_CHECK_CHANGE, tiled_change_hook, 0);
check_preview->Click.connect(Vaca::Bind<void>(&preview_change_hook, check_preview)); check_preview->Click.connect(Bind<void>(&preview_change_hook, check_preview));
/* default position */ /* default position */
window->remap_window(); window->remap_window();

View File

@ -18,6 +18,7 @@
#include "config.h" #include "config.h"
#include "base/bind.h"
#include "jinete/jbox.h" #include "jinete/jbox.h"
#include "jinete/jbutton.h" #include "jinete/jbutton.h"
#include "jinete/jhook.h" #include "jinete/jhook.h"
@ -25,13 +26,12 @@
#include "jinete/jslider.h" #include "jinete/jslider.h"
#include "jinete/jwidget.h" #include "jinete/jwidget.h"
#include "jinete/jwindow.h" #include "jinete/jwindow.h"
#include "Vaca/Bind.h"
#include "app/color.h"
#include "commands/command.h" #include "commands/command.h"
#include "commands/fx/effectbg.h" #include "commands/fx/effectbg.h"
#include "console.h" #include "console.h"
#include "core/cfg.h" #include "core/cfg.h"
#include "app/color.h"
#include "effect/effect.h" #include "effect/effect.h"
#include "modules/gui.h" #include "modules/gui.h"
#include "raster/image.h" #include "raster/image.h"
@ -104,7 +104,7 @@ void InvertColorCommand::onExecute(Context* context)
jwidget_add_child(window, preview); jwidget_add_child(window, preview);
HOOK(target_button, SIGNAL_TARGET_BUTTON_CHANGE, target_change_hook, 0); HOOK(target_button, SIGNAL_TARGET_BUTTON_CHANGE, target_change_hook, 0);
check_preview->Click.connect(Vaca::Bind<void>(&preview_change_hook, check_preview)); check_preview->Click.connect(Bind<void>(&preview_change_hook, check_preview));
/* default position */ /* default position */
window->remap_window(); window->remap_window();

View File

@ -20,15 +20,16 @@
#include <stdio.h> #include <stdio.h>
#include "base/bind.h"
#include "jinete/jinete.h" #include "jinete/jinete.h"
#include "Vaca/Bind.h"
#include "app.h"
#include "app/color.h"
#include "app/color_utils.h"
#include "commands/command.h" #include "commands/command.h"
#include "commands/fx/effectbg.h" #include "commands/fx/effectbg.h"
#include "console.h" #include "console.h"
#include "app.h"
#include "core/cfg.h" #include "core/cfg.h"
#include "app/color.h"
#include "effect/effect.h" #include "effect/effect.h"
#include "effect/replcol.h" #include "effect/replcol.h"
#include "modules/gui.h" #include "modules/gui.h"
@ -40,7 +41,6 @@
#include "widgets/color_button.h" #include "widgets/color_button.h"
#include "widgets/preview.h" #include "widgets/preview.h"
#include "widgets/target.h" #include "widgets/target.h"
#include "app/color_utils.h"
static ColorButton* button_color1; static ColorButton* button_color1;
static ColorButton* button_color2; static ColorButton* button_color2;
@ -131,7 +131,7 @@ void ReplaceColorCommand::onExecute(Context* context)
HOOK(button_color2, SIGNAL_COLORBUTTON_CHANGE, color_change_hook, 2); HOOK(button_color2, SIGNAL_COLORBUTTON_CHANGE, color_change_hook, 2);
HOOK(target_button, SIGNAL_TARGET_BUTTON_CHANGE, target_change_hook, 0); HOOK(target_button, SIGNAL_TARGET_BUTTON_CHANGE, target_change_hook, 0);
HOOK(slider_tolerance, JI_SIGNAL_SLIDER_CHANGE, slider_change_hook, 0); HOOK(slider_tolerance, JI_SIGNAL_SLIDER_CHANGE, slider_change_hook, 0);
check_preview->Click.connect(Vaca::Bind<void>(&preview_change_hook, check_preview)); check_preview->Click.connect(Bind<void>(&preview_change_hook, check_preview));
/* default position */ /* default position */
window->remap_window(); window->remap_window();

View File

@ -19,14 +19,14 @@
#include "config.h" #include "config.h"
#include <allegro.h> #include <allegro.h>
#include <stdio.h>
#include <stdarg.h> #include <stdarg.h>
#include <stdio.h>
#include "base/bind.h"
#include "jinete/jinete.h" #include "jinete/jinete.h"
#include "Vaca/Bind.h"
#include "console.h"
#include "app.h" #include "app.h"
#include "console.h"
#include "modules/gui.h" #include "modules/gui.h"
#include "widgets/statebar.h" #include "widgets/statebar.h"
@ -58,7 +58,7 @@ Console::Console()
return; return;
// The "button" closes the console // The "button" closes the console
button->Click.connect(Vaca::Bind<void>(&Frame::closeWindow, window, button)); button->Click.connect(Bind<void>(&Frame::closeWindow, window, button));
jview_attach(view, textbox); jview_attach(view, textbox);

View File

@ -29,8 +29,8 @@
#include <allegro/internal/aintern.h> #include <allegro/internal/aintern.h>
#include <errno.h> #include <errno.h>
#include "base/bind.h"
#include "jinete/jinete.h" #include "jinete/jinete.h"
#include "Vaca/Bind.h"
#include "app.h" #include "app.h"
#include "core/cfg.h" #include "core/cfg.h"
@ -180,9 +180,9 @@ jstring ase_file_selector(const jstring& message,
setup_mini_look(goforward); setup_mini_look(goforward);
setup_mini_look(goup); setup_mini_look(goup);
goback->Click.connect(Vaca::Bind<void>(&goback_command, goback)); goback->Click.connect(Bind<void>(&goback_command, goback));
goforward->Click.connect(Vaca::Bind<void>(&goforward_command, goforward)); goforward->Click.connect(Bind<void>(&goforward_command, goforward));
goup->Click.connect(Vaca::Bind<void>(&goup_command, goup)); goup->Click.connect(Bind<void>(&goup_command, goup));
JWidget view = jview_new(); JWidget view = jview_new();
fileview = fileview_new(start_folder, exts); fileview = fileview_new(start_folder, exts);

View File

@ -18,6 +18,7 @@
#include "config.h" #include "config.h"
#include "base/bind.h"
#include "jinete/jbox.h" #include "jinete/jbox.h"
#include "jinete/jbutton.h" #include "jinete/jbutton.h"
#include "jinete/jhook.h" #include "jinete/jhook.h"
@ -25,11 +26,11 @@
#include "jinete/jslider.h" #include "jinete/jslider.h"
#include "jinete/jwidget.h" #include "jinete/jwidget.h"
#include "jinete/jwindow.h" #include "jinete/jwindow.h"
#include "Vaca/Bind.h"
#include "app.h" #include "app.h"
#include "core/cfg.h"
#include "app/color.h" #include "app/color.h"
#include "app/color_utils.h"
#include "core/cfg.h"
#include "modules/editors.h" #include "modules/editors.h"
#include "modules/gui.h" #include "modules/gui.h"
#include "raster/image.h" #include "raster/image.h"
@ -39,7 +40,6 @@
#include "util/misc.h" #include "util/misc.h"
#include "widgets/color_bar.h" #include "widgets/color_bar.h"
#include "widgets/color_button.h" #include "widgets/color_button.h"
#include "app/color_utils.h"
static ColorButton* button_color; static ColorButton* button_color;
static CheckBox* check_preview; static CheckBox* check_preview;
@ -96,14 +96,14 @@ void dialogs_mask_color(Sprite* sprite)
button_1->user_data[1] = sprite; button_1->user_data[1] = sprite;
button_2->user_data[1] = sprite; button_2->user_data[1] = sprite;
button_1->Click.connect(Vaca::Bind<void>(&button_1_command, button_1)); button_1->Click.connect(Bind<void>(&button_1_command, button_1));
button_2->Click.connect(Vaca::Bind<void>(&button_2_command, button_2)); button_2->Click.connect(Bind<void>(&button_2_command, button_2));
button_ok->Click.connect(Vaca::Bind<void>(&Frame::closeWindow, window.get(), button_ok)); button_ok->Click.connect(Bind<void>(&Frame::closeWindow, window.get(), button_ok));
button_cancel->Click.connect(Vaca::Bind<void>(&Frame::closeWindow, window.get(), button_cancel)); button_cancel->Click.connect(Bind<void>(&Frame::closeWindow, window.get(), button_cancel));
HOOK(button_color, SIGNAL_COLORBUTTON_CHANGE, color_change_hook, sprite); HOOK(button_color, SIGNAL_COLORBUTTON_CHANGE, color_change_hook, sprite);
HOOK(slider_tolerance, JI_SIGNAL_SLIDER_CHANGE, slider_change_hook, sprite); HOOK(slider_tolerance, JI_SIGNAL_SLIDER_CHANGE, slider_change_hook, sprite);
check_preview->Click.connect(Vaca::Bind<void>(&preview_change_hook, sprite)); check_preview->Click.connect(Bind<void>(&preview_change_hook, sprite));
jwidget_magnetic(button_ok, true); jwidget_magnetic(button_ok, true);
jwidget_expansive(button_color, true); jwidget_expansive(button_color, true);

View File

@ -21,8 +21,8 @@
#include <allegro/gfx.h> #include <allegro/gfx.h>
#include <allegro/unicode.h> #include <allegro/unicode.h>
#include "base/bind.h"
#include "jinete/jinete.h" #include "jinete/jinete.h"
#include "Vaca/Bind.h"
#include "core/cfg.h" #include "core/cfg.h"
#include "dialogs/repo.h" #include "dialogs/repo.h"
@ -53,10 +53,10 @@ void ji_show_repo_dlg(RepoDlg *repo_dlg)
jwidget_add_hook(repo_dlg->listbox, repo_listbox_type(), jwidget_add_hook(repo_dlg->listbox, repo_listbox_type(),
repo_listbox_msg_proc, repo_dlg); repo_listbox_msg_proc, repo_dlg);
repo_dlg->button_use->Click.connect(Vaca::Bind<void>(&use_command, repo_dlg->button_use, repo_dlg)); repo_dlg->button_use->Click.connect(Bind<void>(&use_command, repo_dlg->button_use, repo_dlg));
repo_dlg->button_add->Click.connect(Vaca::Bind<void>(&add_command, repo_dlg->button_add, repo_dlg)); repo_dlg->button_add->Click.connect(Bind<void>(&add_command, repo_dlg->button_add, repo_dlg));
repo_dlg->button_delete->Click.connect(Vaca::Bind<void>(&delete_command, repo_dlg->button_delete, repo_dlg)); repo_dlg->button_delete->Click.connect(Bind<void>(&delete_command, repo_dlg->button_delete, repo_dlg));
button_close->Click.connect(Vaca::Bind<void>(&Frame::closeWindow, window, button_close)); button_close->Click.connect(Bind<void>(&Frame::closeWindow, window, button_close));
jwidget_magnetic(repo_dlg->button_use, true); jwidget_magnetic(repo_dlg->button_use, true);

View File

@ -55,12 +55,12 @@
#include "config.h" #include "config.h"
#include <allegro/unicode.h>
#include <stdarg.h> #include <stdarg.h>
#include <stdio.h> #include <stdio.h>
#include <allegro/unicode.h>
#include "base/bind.h"
#include "jinete/jinete.h" #include "jinete/jinete.h"
#include "Vaca/Bind.h"
static Frame* create_alert(char *buf, JList *labels, JList *buttons); static Frame* create_alert(char *buf, JList *labels, JList *buttons);
@ -190,7 +190,7 @@ static Frame* create_alert(char *buf, JList *labels, JList *buttons)
usprintf(button_name, "button-%d", jlist_length(*buttons)); usprintf(button_name, "button-%d", jlist_length(*buttons));
button_widget->setName(button_name); button_widget->setName(button_name);
button_widget->Click.connect(Vaca::Bind<void>(&Frame::closeWindow, window, button_widget)); button_widget->Click.connect(Bind<void>(&Frame::closeWindow, window, button_widget));
} }
buf[c] = chr; buf[c] = chr;

View File

@ -32,8 +32,8 @@
#ifndef JINETE_JBUTTON_H_INCLUDED #ifndef JINETE_JBUTTON_H_INCLUDED
#define JINETE_JBUTTON_H_INCLUDED #define JINETE_JBUTTON_H_INCLUDED
#include "base/signal.h"
#include "jinete/jwidget.h" #include "jinete/jwidget.h"
#include "Vaca/Signal.h"
#include "Vaca/NonCopyable.h" #include "Vaca/NonCopyable.h"
#include <vector> #include <vector>
@ -62,7 +62,7 @@ public:
int getDrawType() const; int getDrawType() const;
// Signals // Signals
Vaca::Signal1<void, Event&> Click; ///< @see onClick Signal1<void, Event&> Click;
protected: protected:
// Events // Events

View File

@ -32,7 +32,7 @@
#ifndef JINETE_JLINK_LABEL_H_INCLUDED #ifndef JINETE_JLINK_LABEL_H_INCLUDED
#define JINETE_JLINK_LABEL_H_INCLUDED #define JINETE_JLINK_LABEL_H_INCLUDED
#include "Vaca/Signal.h" #include "base/signal.h"
#include "jinete/jcustom_label.h" #include "jinete/jcustom_label.h"
#include <string> #include <string>
@ -44,7 +44,7 @@ public:
LinkLabel(const char* urlOrText); LinkLabel(const char* urlOrText);
LinkLabel(const char* url, const char* text); LinkLabel(const char* url, const char* text);
Vaca::Signal0<void> Click; Signal0<void> Click;
protected: protected:
bool onProcessMessage(JMessage msg); bool onProcessMessage(JMessage msg);

View File

@ -32,8 +32,8 @@
#ifndef JINETE_JWINDOW_H_INCLUDED #ifndef JINETE_JWINDOW_H_INCLUDED
#define JINETE_JWINDOW_H_INCLUDED #define JINETE_JWINDOW_H_INCLUDED
#include "base/signal.h"
#include "jinete/jwidget.h" #include "jinete/jwidget.h"
#include "Vaca/Signal.h"
namespace Vaca { namespace Vaca {
class CloseEvent { }; // TODO class CloseEvent { }; // TODO
@ -79,7 +79,7 @@ public:
bool is_wantfocus() const; bool is_wantfocus() const;
// Signals // Signals
Vaca::Signal1<void, Vaca::CloseEvent&> Close; Signal1<void, Vaca::CloseEvent&> Close;
protected: protected:
bool onProcessMessage(JMessage msg); bool onProcessMessage(JMessage msg);

View File

@ -22,7 +22,7 @@
#include <allegro/internal/aintern.h> #include <allegro/internal/aintern.h>
#include "Vaca/SharedPtr.h" #include "Vaca/SharedPtr.h"
#include "Vaca/Bind.h" #include "base/bind.h"
#include "jinete/jinete.h" #include "jinete/jinete.h"
#include "jinete/jintern.h" #include "jinete/jintern.h"
@ -532,7 +532,7 @@ void SkinneableTheme::init_widget(JWidget widget)
jwidget_decorative(button, true); jwidget_decorative(button, true);
jwidget_add_child(widget, button); jwidget_add_child(widget, button);
button->setName("theme_close_button"); button->setName("theme_close_button");
button->Click.connect(Vaca::Bind<void>(&Frame::closeWindow, (Frame*)widget, button)); button->Click.connect(Bind<void>(&Frame::closeWindow, (Frame*)widget, button));
} }
#endif #endif
} }

View File

@ -19,7 +19,7 @@
#ifndef WIDGETS_COLOR_BAR_H_INCLUDED #ifndef WIDGETS_COLOR_BAR_H_INCLUDED
#define WIDGETS_COLOR_BAR_H_INCLUDED #define WIDGETS_COLOR_BAR_H_INCLUDED
#include "Vaca/Signal.h" #include "base/signal.h"
#include "jinete/jwidget.h" #include "jinete/jwidget.h"
#include "app/color.h" #include "app/color.h"
@ -44,8 +44,8 @@ public:
Color getColorByPosition(int x, int y); Color getColorByPosition(int x, int y);
// Signals // Signals
Vaca::Signal1<void, const Color&> FgColorChange; Signal1<void, const Color&> FgColorChange;
Vaca::Signal1<void, const Color&> BgColorChange; Signal1<void, const Color&> BgColorChange;
protected: protected:
bool onProcessMessage(JMessage msg); bool onProcessMessage(JMessage msg);

View File

@ -21,13 +21,13 @@
#include <allegro.h> #include <allegro.h>
#include <vector> #include <vector>
#include "base/bind.h"
#include "jinete/jinete.h" #include "jinete/jinete.h"
#include "Vaca/Bind.h"
#include "app.h" #include "app.h"
#include "app/color.h" #include "app/color.h"
#include "modules/gui.h"
#include "modules/gfx.h" #include "modules/gfx.h"
#include "modules/gui.h"
#include "modules/palettes.h" #include "modules/palettes.h"
#include "raster/image.h" #include "raster/image.h"
#include "raster/palette.h" #include "raster/palette.h"
@ -118,7 +118,7 @@ Frame* colorselector_new()
RadioButton* model_button = new RadioButton(m->text, 1, JI_BUTTON); RadioButton* model_button = new RadioButton(m->text, 1, JI_BUTTON);
colorselector->model_buttons.push_back(model_button); colorselector->model_buttons.push_back(model_button);
setup_mini_look(model_button); setup_mini_look(model_button);
model_button->Click.connect(Vaca::Bind<bool>(&select_model_hook, window, m)); model_button->Click.connect(Bind<bool>(&select_model_hook, window, m));
jwidget_add_child(models_box, model_button); jwidget_add_child(models_box, model_button);
// Create the color-model container // Create the color-model container

View File

@ -19,10 +19,10 @@
#ifndef WIDGETS_EDITOR_H_INCLUDED #ifndef WIDGETS_EDITOR_H_INCLUDED
#define WIDGETS_EDITOR_H_INCLUDED #define WIDGETS_EDITOR_H_INCLUDED
#include "app/color.h"
#include "base/signal.h"
#include "jinete/jbase.h" #include "jinete/jbase.h"
#include "jinete/jwidget.h" #include "jinete/jwidget.h"
#include "app/color.h"
#include "Vaca/Signal.h"
#define MIN_ZOOM 0 #define MIN_ZOOM 0
#define MAX_ZOOM 5 #define MAX_ZOOM 5
@ -62,7 +62,7 @@ class Editor : public Widget
void drawDecorator(Editor*editor, BITMAP* bmp); void drawDecorator(Editor*editor, BITMAP* bmp);
bool isInsideDecorator(int x, int y); bool isInsideDecorator(int x, int y);
Vaca::Signal0<void> Click; Signal0<void> Click;
}; };
// editor states // editor states

View File

@ -18,9 +18,10 @@
#include "config.h" #include "config.h"
#include <stdarg.h>
#include <allegro/unicode.h> #include <allegro/unicode.h>
#include <stdarg.h>
#include "base/bind.h"
#include "jinete/jbox.h" #include "jinete/jbox.h"
#include "jinete/jbutton.h" #include "jinete/jbutton.h"
#include "jinete/jhook.h" #include "jinete/jhook.h"
@ -28,7 +29,6 @@
#include "jinete/jsystem.h" #include "jinete/jsystem.h"
#include "jinete/jtheme.h" #include "jinete/jtheme.h"
#include "jinete/jwidget.h" #include "jinete/jwidget.h"
#include "Vaca/Bind.h"
#include "modules/gui.h" #include "modules/gui.h"
#include "widgets/groupbut.h" #include "widgets/groupbut.h"
@ -75,7 +75,7 @@ JWidget group_button_new(int w, int h, int first_selected, ...)
if (icon >= 0) if (icon >= 0)
add_gfxicon_to_button(radio, icon, JI_CENTER | JI_MIDDLE); add_gfxicon_to_button(radio, icon, JI_CENTER | JI_MIDDLE);
radio->Click.connect(Vaca::Bind<bool>(&radio_change_hook, vbox)); radio->Click.connect(Bind<bool>(&radio_change_hook, vbox));
if (c == first_selected) if (c == first_selected)
radio->setSelected(true); radio->setSelected(true);

View File

@ -23,9 +23,9 @@
#include <cstdio> #include <cstdio>
#include <cstring> #include <cstring>
#include "jinete/jinete.h" #include "base/bind.h"
#include "gfx/size.h" #include "gfx/size.h"
#include "Vaca/Bind.h" #include "jinete/jinete.h"
#include "app.h" #include "app.h"
#include "commands/commands.h" #include "commands/commands.h"
@ -81,7 +81,7 @@ StatusBar::StatusBar()
(name) = new Button(text); \ (name) = new Button(text); \
(name)->user_data[0] = this; \ (name)->user_data[0] = this; \
setup_mini_look(name); \ setup_mini_look(name); \
(name)->Click.connect(Vaca::Bind<void>(&ani_button_command, (name), action)); \ (name)->Click.connect(Bind<void>(&ani_button_command, (name), action)); \
} }
#define ICON_NEW(name, icon, action) \ #define ICON_NEW(name, icon, action) \

View File

@ -21,12 +21,12 @@
#include <allegro.h> #include <allegro.h>
#include <string.h> #include <string.h>
#include "base/bind.h"
#include "jinete/jbox.h" #include "jinete/jbox.h"
#include "jinete/jbutton.h" #include "jinete/jbutton.h"
#include "jinete/jhook.h" #include "jinete/jhook.h"
#include "jinete/jtheme.h" #include "jinete/jtheme.h"
#include "jinete/jwidget.h" #include "jinete/jwidget.h"
#include "Vaca/Bind.h"
#include "core/cfg.h" #include "core/cfg.h"
#include "effect/effect.h" #include "effect/effect.h"
@ -51,7 +51,7 @@ JWidget target_button_new(int imgtype, bool with_channels)
if (widget) { \ if (widget) { \
jwidget_set_border(widget, 2 * jguiscale()); \ jwidget_set_border(widget, 2 * jguiscale()); \
jwidget_add_child(box, widget); \ jwidget_add_child(box, widget); \
widget->Click.connect(Vaca::Bind<bool>(&hook, widget, vbox)); \ widget->Click.connect(Bind<bool>(&hook, widget, vbox)); \
} }
int default_targets = 0; int default_targets = 0;

View File

@ -18,14 +18,14 @@
#include "config.h" #include "config.h"
#include <allegro.h>
#include <map> #include <map>
#include <string> #include <string>
#include <allegro.h>
#include "jinete/jinete.h" #include "base/bind.h"
#include "Vaca/Bind.h" #include "base/signal.h"
#include "Vaca/Signal.h"
#include "gfx/size.h" #include "gfx/size.h"
#include "jinete/jinete.h"
#include "app.h" #include "app.h"
#include "commands/command.h" #include "commands/command.h"
@ -101,7 +101,7 @@ public:
void saveOverlappedArea(const Rect& bounds); void saveOverlappedArea(const Rect& bounds);
Vaca::Signal1<void, Tool*> ToolSelected; Signal1<void, Tool*> ToolSelected;
protected: protected:
bool onProcessMessage(JMessage msg); bool onProcessMessage(JMessage msg);
@ -402,7 +402,7 @@ void ToolBar::openPopupWindow(int group_index, ToolGroup* tool_group)
// In case this tool contains more than just one tool, show the popup window // In case this tool contains more than just one tool, show the popup window
m_open_on_hot = true; m_open_on_hot = true;
m_popup_window = new PopupWindow(NULL, false); m_popup_window = new PopupWindow(NULL, false);
m_popup_window->Close.connect(Vaca::Bind<void, ToolBar, ToolBar>(&ToolBar::onClosePopup, this)); m_popup_window->Close.connect(Bind<void, ToolBar, ToolBar>(&ToolBar::onClosePopup, this));
ToolStrip* toolstrip = new ToolStrip(tool_group, this); ToolStrip* toolstrip = new ToolStrip(tool_group, this);
jwidget_add_child(m_popup_window, toolstrip); jwidget_add_child(m_popup_window, toolstrip);

View File

@ -18,15 +18,15 @@
#include "config.h" #include "config.h"
#include <allegro/unicode.h>
#include <limits.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <limits.h>
#include <allegro/unicode.h>
#include "Vaca/Bind.h"
#include "jinete/jinete.h"
#include "ase_exception.h" #include "ase_exception.h"
#include "base/bind.h"
#include "jinete/jinete.h"
#include "modules/gui.h" #include "modules/gui.h"
#include "tinyxml.h" #include "tinyxml.h"
@ -134,7 +134,7 @@ static Widget* convert_xmlelement_to_widget(TiXmlElement* elem, Widget* root)
if (closewindow && root) { if (closewindow && root) {
if (Frame* frame = dynamic_cast<Frame*>(root)) { if (Frame* frame = dynamic_cast<Frame*>(root)) {
static_cast<Button*>(widget)-> static_cast<Button*>(widget)->
Click.connect(Vaca::Bind<void>(&Frame::closeWindow, frame, widget)); Click.connect(Bind<void>(&Frame::closeWindow, frame, widget));
} }
} }
} }