'Event' branch merged into trunk (Callback now deprecated)

git-svn-id: svn://ultimatepp.org/upp/trunk@10260 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2016-10-04 08:15:05 +00:00
parent 546596c6f7
commit 44037d6a0c
115 changed files with 756 additions and 828 deletions

View file

@ -294,7 +294,7 @@ void CodeEditor::IndentInsert(int chr, int count) {
InsertChar(chr, count);
}
void CodeEditor::Make(Callback1<String&> op)
void CodeEditor::Make(Event<String&> op)
{
Point cursor = GetColumnLine(GetCursor());
Point scroll = GetScrollPos();
@ -1039,9 +1039,9 @@ CodeEditor::CodeEditor() {
UndoSteps(10000);
InitFindReplace();
bar.WhenBreakpoint = THISBACK(ForwardWhenBreakpoint);
bar.WhenAnnotationMove = Proxy(WhenAnnotationMove);
bar.WhenAnnotationClick = Proxy(WhenAnnotationClick);
bar.WhenAnnotationRightClick = Proxy(WhenAnnotationRightClick);
bar.WhenAnnotationMove = WhenAnnotationMove.Proxy();
bar.WhenAnnotationClick = WhenAnnotationClick.Proxy();
bar.WhenAnnotationRightClick = WhenAnnotationRightClick.Proxy();
barline = true;
sb.WithSizeGrip();
DefaultHlStyles();

View file

@ -87,10 +87,10 @@ private:
void sPaintImage(Draw& w, int y, int fy, const Image& img);
public:
Callback1<int> WhenBreakpoint;
Callback WhenAnnotationMove;
Callback WhenAnnotationClick;
Callback WhenAnnotationRightClick;
Event<int> WhenBreakpoint;
Event<> WhenAnnotationMove;
Event<> WhenAnnotationClick;
Event<> WhenAnnotationRightClick;
void InsertLines(int i, int count);
void RemoveLines(int i, int count);
@ -322,7 +322,7 @@ protected:
void ToggleLineComments(bool usestars = false);
void ToggleStarComments();
void Enclose(const char *c1, const char *c2, int l = -1, int h = -1);
void Make(Callback1<String&> op);
void Make(Event<String&> op);
void TabsOrSpaces(String& out, bool maketabs);
void LineEnds(String& out);
@ -341,16 +341,16 @@ public:
Size sz;
};
Callback WhenSelection;
Event<> WhenSelection;
Gate1<MouseTip&> WhenTip;
Callback WhenLeftDown;
Callback1<int> WhenCtrlClick;
Callback WhenAnnotationMove;
Callback WhenAnnotationClick;
Callback WhenAnnotationRightClick;
Callback WhenOpenFindReplace;
Callback1<String&> WhenPaste;
Callback WhenUpdate;
Event<> WhenLeftDown;
Event<int> WhenCtrlClick;
Event<> WhenAnnotationMove;
Event<> WhenAnnotationClick;
Event<> WhenAnnotationRightClick;
Event<> WhenOpenFindReplace;
Event<String&> WhenPaste;
Event<> WhenUpdate;
FrameTop<Button> topsbbutton;
FrameTop<Button> topsbbutton1;
@ -419,7 +419,7 @@ public:
void TabRight();
void TabLeft();
Callback1<int> WhenBreakpoint;
Event<int> WhenBreakpoint;
void CheckEdited(bool e = true) { check_edited = e; }

View file

@ -637,8 +637,8 @@ void CodeEditor::FindReplace(bool pick_selection, bool pick_text, bool replace)
findreplace.amend_all.Hide();
findreplace.amend_rest.Hide();
findreplace.prev.Hide();
findreplace.next.Ok() <<= findreplace.Breaker(IDOK);
findreplace.close.Cancel() <<= findreplace.Breaker(IDCANCEL);
findreplace.next.Ok() << findreplace.Breaker(IDOK);
findreplace.close.Cancel() << findreplace.Breaker(IDCANCEL);
findreplace.close.SetImage(Null);
findreplace.close.Tip("");
findreplace.next.SetImage(Null);

View file

@ -8,7 +8,7 @@ ArrayMap<String, EditorSyntax::SyntaxDef>& EditorSyntax::defs()
return d;
}
void EditorSyntax::Register(const char *id, Callback1<One<EditorSyntax>&> factory,
void EditorSyntax::Register(const char *id, Event<One<EditorSyntax>&> factory,
const char *exts, const char *description)
{
SyntaxDef& f = defs().GetAdd(id);

View file

@ -89,7 +89,7 @@ public:
class EditorSyntax : public HighlightSetup { // Inheriting to make static members available
struct SyntaxDef {
Callback1<One<EditorSyntax>&> factory;
Event<One<EditorSyntax>&> factory;
String patterns;
String description;
};
@ -121,7 +121,7 @@ public:
EditorSyntax() { Clear(); ignore_errors = false; }
static void Register(const char *id, Callback1<One<EditorSyntax>&> factory,
static void Register(const char *id, Event<One<EditorSyntax>&> factory,
const char *exts, const char *description);
static One<EditorSyntax> Create(const char *id);
static String GetSyntaxForFilename(const char *fn);

View file

@ -1,114 +1,33 @@
enum CNULLer { CNULL };
// Backward compatibility
template<typename Res, typename... ArgTypes>
class Function<Res(ArgTypes...)> : Moveable<Function<Res(ArgTypes...)>> {
struct WrapperBase {
Atomic refcount;
virtual Res Execute(ArgTypes... args) = 0;
WrapperBase() { refcount = 1; }
virtual ~WrapperBase() {}
};
template <class F>
struct Wrapper : WrapperBase {
F fn;
virtual Res Execute(ArgTypes... args) { return fn(args...); }
Wrapper(F&& fn) : fn(pick(fn)) {}
};
template <class F>
struct Wrapper2 : WrapperBase {
Function l;
F fn;
virtual Res Execute(ArgTypes... args) { l(args...); return fn(args...); }
Wrapper2(const Function& l, F&& fn) : l(l), fn(pick(fn)) {}
Wrapper2(const Function& l, const F& fn) : l(l), fn(fn) {}
};
WrapperBase *ptr;
static void Free(WrapperBase *ptr) {
if(ptr && AtomicDec(ptr->refcount) == 0)
delete ptr;
}
void Copy(const Function& a) {
ptr = a.ptr;
if(ptr)
AtomicInc(ptr->refcount);
}
void Pick(Function&& src) {
ptr = src.ptr;
src.ptr = NULL;
}
public:
Function() { ptr = NULL; }
Function(CNULLer) { ptr = NULL; }
template <class F> Function(F fn) { ptr = new Wrapper<F>(pick(fn)); }
Function(const Function& src) { Copy(src); }
Function& operator=(const Function& src) { auto b = ptr; Copy(src); Free(b); return *this; }
Function(Function&& src) { Pick(pick(src)); }
Function& operator=(Function&& src) { if(&src != this) { Free(ptr); ptr = src.ptr; src.ptr = NULL; } return *this; }
Function Proxy() const { return [=] (ArgTypes... args) { return (*this)(args...); }; }
template <class F>
Function& operator<<(const F& fn) { if(!ptr) { Copy(fn); return *this; }
WrapperBase *b = ptr; ptr = new Wrapper2<F>(*this, fn); Free(b); return *this; }
template <class F>
Function& operator<<(F&& fn) { if(!ptr) { Pick(pick(fn)); return *this; }
WrapperBase *b = ptr; ptr = new Wrapper2<F>(*this, pick(fn)); Free(b); return *this; }
Res operator()(ArgTypes... args) const { return ptr ? ptr->Execute(args...) : Res(); }
operator bool() const { return ptr; }
void Clear() { Free(ptr); ptr = NULL; }
friend void Swap(Function& a, Function& b) { UPP::Swap(a.ptr, b.ptr); }
~Function() { Free(ptr); }
};
// we need "isolation level" to avoid overloading issues
template <class... ArgTypes>
class Event : Moveable<Event<ArgTypes...>> {
class CallbackN : Moveable<CallbackN<ArgTypes...>> {
typedef Function<void (ArgTypes...)> Fn;
Fn fn;
public:
Event() {}
Event(const Event& src) : fn(src.fn) {}
Event& operator=(const Event& src) { fn = src.fn; return *this; }
CallbackN() {}
CallbackN(const CallbackN& src) : fn(src.fn) {}
CallbackN& operator=(const CallbackN& src) { fn = src.fn; return *this; }
Event(Fn&& src, int) : fn(pick(src)) {} // Helper for callback compatibility code
CallbackN(Fn&& src, int) : fn(pick(src)) {} // Helper for callback compatibility code
template <class F>
Event(F src, int) : fn(src) {} // Helper for callback compatibility code
CallbackN(F src, int) : fn(src) {} // Helper for callback compatibility code
Event(Event&& src) : fn(pick(src.fn)) {}
Event& operator=(Event&& src) { fn = pick(src.fn); return *this; }
CallbackN(CallbackN&& src) : fn(pick(src.fn)) {}
CallbackN& operator=(CallbackN&& src) { fn = pick(src.fn); return *this; }
Event(CNULLer) {}
Event& operator=(CNULLer) { fn.Clear(); return *this; }
CallbackN(CNULLer) {}
CallbackN& operator=(CNULLer) { fn.Clear(); return *this; }
Event Proxy() const { return Event(fn.Proxy(), 1); }
CallbackN Proxy() const { return CallbackN(fn.Proxy(), 1); }
template <class F>
Event& operator<<(const F& f) { fn << f; return *this; }
CallbackN& operator<<(const F& f) { fn << f; return *this; }
template <class F>
Event& operator<<(F&& f) { fn << pick(f); return *this; }
CallbackN& operator<<(F&& f) { fn << pick(f); return *this; }
void operator()(ArgTypes... args) const { return fn(args...); }
@ -116,13 +35,13 @@ public:
operator bool() const { return fn; }
void Clear() { fn.Clear(); }
friend Event Proxy(const Event& a) { return a.Proxy(); }
friend void Swap(Event& a, Event& b) { UPP::Swap(a.fn, b.fn); }
friend CallbackN Proxy(const CallbackN& a) { return a.Proxy(); }
friend void Swap(CallbackN& a, CallbackN& b) { UPP::Swap(a.fn, b.fn); }
};
// we need "isolation level" to avoid overloading issues
template <class... ArgTypes>
class EventGate : Moveable<EventGate<ArgTypes...>> {
class GateN : Moveable<GateN<ArgTypes...>> {
typedef Function<bool (ArgTypes...)> Fn;
Fn fn;
@ -130,27 +49,27 @@ class EventGate : Moveable<EventGate<ArgTypes...>> {
void Set(bool b) { if(b) fn = [](ArgTypes...) { return true; }; else fn.Clear(); }
public:
EventGate() {}
GateN() {}
EventGate(bool b) { Set(b); }
EventGate& operator=(bool b) { Set(b); return *this; }
GateN(bool b) { Set(b); }
GateN& operator=(bool b) { Set(b); return *this; }
EventGate(const EventGate& a) : fn(a.fn) {}
EventGate& operator=(const EventGate& a) { fn = a.fn; return *this; }
GateN(const GateN& a) : fn(a.fn) {}
GateN& operator=(const GateN& a) { fn = a.fn; return *this; }
EventGate(Fn&& src, int) : fn(pick(src)) {}
EventGate& operator=(EventGate&& a) { fn = pick(a.fn); return *this; }
GateN(Fn&& src, int) : fn(pick(src)) {}
GateN& operator=(GateN&& a) { fn = pick(a.fn); return *this; }
EventGate(CNULLer) {}
EventGate& operator=(CNULLer) { fn.Clear(); return *this; }
GateN(CNULLer) {}
GateN& operator=(CNULLer) { fn.Clear(); return *this; }
EventGate Proxy() const { return fn.Proxy(); }
GateN Proxy() const { return fn.Proxy(); }
template <class F>
EventGate& operator<<(const F& f) { fn << f; return *this; }
GateN& operator<<(const F& f) { fn << f; return *this; }
template <class F>
EventGate& operator<<(F&& f) { fn << pick(f); return *this; }
GateN& operator<<(F&& f) { fn << pick(f); return *this; }
bool operator()(ArgTypes... args) const { return fn(args...); }
@ -158,31 +77,31 @@ public:
operator bool() const { return fn; }
void Clear() { fn.Clear(); }
friend EventGate Proxy(const EventGate& a) { return a.Proxy(); }
friend void Swap(EventGate& a, EventGate& b) { UPP::Swap(a.fn, b.fn); }
friend GateN Proxy(const GateN& a) { return a.Proxy(); }
friend void Swap(GateN& a, GateN& b) { UPP::Swap(a.fn, b.fn); }
};
// backward compatibility
typedef Event<> Callback;
template <class P1> using Callback1 = Event<P1>;
template <class P1, class P2> using Callback2 = Event<P1, P2>;
template <class P1, class P2, class P3> using Callback3 = Event<P1, P2, P3>;
template <class P1, class P2, class P3, class P4> using Callback4 = Event<P1, P2, P3, P4>;
template <class P1, class P2, class P3, class P4, class P5> using Callback5 = Event<P1, P2, P3, P4, P5>;
typedef CallbackN<> Callback;
template <class P1> using Callback1 = CallbackN<P1>;
template <class P1, class P2> using Callback2 = CallbackN<P1, P2>;
template <class P1, class P2, class P3> using Callback3 = CallbackN<P1, P2, P3>;
template <class P1, class P2, class P3, class P4> using Callback4 = CallbackN<P1, P2, P3, P4>;
template <class P1, class P2, class P3, class P4, class P5> using Callback5 = CallbackN<P1, P2, P3, P4, P5>;
#define Res void
#define Cb_ Event
#define Cb_ CallbackN
#include "CallbackR.i"
using Gate = EventGate<>;
template <class P1> using Gate1 = EventGate<P1>;
template <class P1, class P2> using Gate2 = EventGate<P1, P2>;
template <class P1, class P2, class P3> using Gate3 = EventGate<P1, P2, P3>;
template <class P1, class P2, class P3, class P4> using Gate4 = EventGate<P1, P2, P3, P4>;
template <class P1, class P2, class P3, class P4, class P5> using Gate5 = EventGate<P1, P2, P3, P4, P5>;
using Gate0 = GateN<>;
template <class P1> using Gate1 = GateN<P1>;
template <class P1, class P2> using Gate2 = GateN<P1, P2>;
template <class P1, class P2, class P3> using Gate3 = GateN<P1, P2, P3>;
template <class P1, class P2, class P3, class P4> using Gate4 = GateN<P1, P2, P3, P4>;
template <class P1, class P2, class P3, class P4, class P5> using Gate5 = GateN<P1, P2, P3, P4, P5>;
#define Res bool
#define Cb_ EventGate
#define Cb_ GateN
#include "CallbackR.i"
#define THISBACK(x) callback(this, &CLASSNAME::x)
@ -208,7 +127,7 @@ template <class P1, class P2, class P3, class P4, class P5> using Gate5 = EventG
template <class T>
class EventArgTarget
class CallbackNArgTarget
{
T result;
@ -216,7 +135,7 @@ class EventArgTarget
void Set(T value) { result = value; }
public:
typedef EventArgTarget CLASSNAME;
typedef CallbackNArgTarget CLASSNAME;
operator const T&() const { return result; }
bool IsNullInstance() const { return IsNull(result); }
@ -225,8 +144,8 @@ public:
operator Callback1<const T&>() { return THISBACK(SetResult); }
operator Callback1<T>() { return THISBACK(Set); }
EventArgTarget() { result = Null; }
CallbackNArgTarget() { result = Null; }
};
template <class T>
using CallbackArgTarget = EventArgTarget<T>;
using CallbackArgTarget = CallbackNArgTarget<T>;

View file

@ -83,8 +83,8 @@ public:
class CoWork : NoCopy {
public:
void Do(Callback cb) { cb(); }
CoWork& operator&(Callback cb) { cb(); return *this; }
void Do(Event<> cb) { cb(); }
CoWork& operator&(Event<> cb) { cb(); return *this; }
void Finish() {}
bool IsFinished() { return true; }

View file

@ -283,6 +283,8 @@ class JsonIO;
#include "Uuid.h"
#include "Ptr.h"
#include "Function.h"
#include "Callback.h"
#include "Color.h"

View file

@ -108,7 +108,8 @@ file
InMap.hpp,
Tuple.h,
Other.h,
Callbacks readonly separator,
Function readonly separator,
Function.h,
CallbackNP.i highlight cpp,
CallbackN.i highlight cpp,
CallbackR.i highlight cpp,
@ -184,7 +185,6 @@ file
Meta readonly separator,
sub.upt,
core.upt,
ignorelist,
core.defs,
Info readonly separator,
src.tpp,

View file

@ -23,12 +23,12 @@ private:
public:
Stream *in;
Callback2<const void *, int> Filter;
Callback End;
Gate More;
Event<const void *, int> Filter;
Event<> End;
Gate<> More;
void Out(const void *ptr, int size);
Callback WhenOut;
Event<> WhenOut;
template <class F>
void Set(Stream& in_, F& filter) {
@ -63,8 +63,8 @@ protected:
public:
Stream *out;
Callback2<const void *, int> Filter;
Callback End;
Event<const void *, int> Filter;
Event<> End;
void Out(const void *ptr, int size);
int64 GetCount() const { return count; }

View file

@ -173,7 +173,7 @@ class TcpSocket : NoCopy {
TcpSocket(const TcpSocket&);
public:
Callback WhenWait;
Event<> WhenWait;
void SetSockError(const char *context, int code, const char *errdesc);
@ -454,10 +454,10 @@ public:
METHOD_PATCH = 8,
};
Callback2<const void *, int> WhenContent;
Callback WhenStart;
Callback WhenDo;
Gate WhenAuthenticate;
Event<const void *, int> WhenContent;
Event<> WhenStart;
Event<> WhenDo;
Gate<> WhenAuthenticate;
HttpRequest& MaxHeaderSize(int m) { max_header_size = m; return *this; }
HttpRequest& MaxContentSize(int m) { max_content_size = m; return *this; }

View file

@ -41,6 +41,26 @@ void Stream::Seek(int64) {
NEVER();
}
int Stream::Skip(int size)
{
int r = 0;
while(size) {
int n = min(int(rdlim - ptr), size);
if(n == 0) {
if(Get() < 0)
break;
r++;
size--;
}
else {
size -= n;
r += n;
ptr += n;
}
}
return r;
}
int64 Stream::GetSize() const {
return 0;
}
@ -1334,7 +1354,7 @@ int64 CopyStream(Stream& dest, Stream& src, int64 count) {
return done;
}
int64 CopyStream(Stream& dest, Stream& src, int64 count, EventGate<int64, int64> progress)
int64 CopyStream(Stream& dest, Stream& src, int64 count, Gate<int64, int64> progress)
{
int block = (int)min<int64>(count, 32768);
Buffer<byte> temp(block);
@ -1351,7 +1371,7 @@ int64 CopyStream(Stream& dest, Stream& src, int64 count, EventGate<int64, int64>
return done;
}
void CheckedSerialize(const Callback1<Stream&> serialize, Stream& stream, int version)
void CheckedSerialize(const Event<Stream&> serialize, Stream& stream, int version)
{
int pos = (int)stream.GetPos();
stream.Magic(0x61746164);
@ -1363,7 +1383,7 @@ void CheckedSerialize(const Callback1<Stream&> serialize, Stream& stream, int ve
stream.Magic(pos);
}
bool Load(Callback1<Stream&> serialize, Stream& stream, int version) {
bool Load(Event<Stream&> serialize, Stream& stream, int version) {
StringStream backup;
backup.SetStoring();
serialize(backup);
@ -1390,7 +1410,7 @@ bool Load(Callback1<Stream&> serialize, Stream& stream, int version) {
return true;
}
bool Store(Callback1<Stream&> serialize, Stream& stream, int version) {
bool Store(Event<Stream&> serialize, Stream& stream, int version) {
stream.SetStoring();
CheckedSerialize(serialize, stream, version);
return !stream.IsError();
@ -1400,14 +1420,14 @@ String Cfgname(const char *file) {
return file ? String(file) : ConfigFile();
}
bool LoadFromFile(Callback1<Stream&> serialize, const char *file, int version) {
bool LoadFromFile(Event<Stream&> serialize, const char *file, int version) {
FileIn f(Cfgname(file));
return f ? Load(serialize, f, version) : false;
}
bool StoreToFile(Callback1<Stream&> serialize, const char *file, int version) {
bool StoreToFile(Event<Stream&> serialize, const char *file, int version) {
FileOut f(Cfgname(file));
if(!Store(serialize, f, version))
if(!f || !Store(serialize, f, version))
return false;
f.Close();
return !f.IsError();

View file

@ -98,6 +98,8 @@ public:
String Get(int size);
String GetAll(int size);
int Skip(int size);
void LoadThrowing() { style |= STRM_THROW; }
void LoadError();

View file

@ -620,9 +620,9 @@ static VectorMap<String, String>& sGCfg()
static StaticCriticalSection sGCfgLock;
static Vector<Callback>& sGFlush()
static Vector<Event<> >& sGFlush()
{
static Vector<Callback> m;
static Vector<Event<> > m;
return m;
}
@ -636,7 +636,7 @@ void RegisterGlobalConfig(const char *name)
}
}
void RegisterGlobalConfig(const char *name, Callback WhenFlush)
void RegisterGlobalConfig(const char *name, Event<> WhenFlush)
{
RegisterGlobalConfig(name);
INTERLOCKED_(sGFlushLock) {

View file

@ -404,12 +404,12 @@ public:
// ------------------- Advanced streaming --------------------
void CheckedSerialize(const Callback1<Stream&> serialize, Stream& stream, int version = Null);
void CheckedSerialize(const Event<Stream&> serialize, Stream& stream, int version = Null);
bool Load(Callback1<Stream&> serialize, Stream& stream, int version = Null);
bool Store(Callback1<Stream&> serialize, Stream& stream, int version = Null);
bool LoadFromFile(Callback1<Stream&> serialize, const char *file = NULL, int version = Null);
bool StoreToFile(Callback1<Stream&> serialize, const char *file = NULL, int version = Null);
bool Load(Event<Stream&> serialize, Stream& stream, int version = Null);
bool Store(Event<Stream&> serialize, Stream& stream, int version = Null);
bool LoadFromFile(Event<Stream&> serialize, const char *file = NULL, int version = Null);
bool StoreToFile(Event<Stream&> serialize, const char *file = NULL, int version = Null);
template <class T>
void SerializeTFn(Stream &s, T *x)
@ -418,7 +418,7 @@ void SerializeTFn(Stream &s, T *x)
}
template <class T>
Callback1<Stream&> SerializeCb(T& x)
Event<Stream&> SerializeCb(T& x)
{
return callback1(SerializeTFn<T>, &x);
}
@ -457,7 +457,7 @@ bool LoadFromString(T& x, const String& s) {
}
void RegisterGlobalConfig(const char *name) init_;
void RegisterGlobalConfig(const char *name, Callback WhenFlush) init_;
void RegisterGlobalConfig(const char *name, Event<> WhenFlush) init_;
String GetGlobalConfigData(const char *name);
void SetGlobalConfigData(const char *name, const String& data);

View file

@ -170,7 +170,7 @@ void XmlizeLang(XmlIO& xml, const char *tag, int& lang, const char *id)
XmlizeLangAttr(n, lang, id);
}
String StoreAsXML(Callback1<XmlIO> xmlize, const char *name)
String DoStoreAsXML(Event<XmlIO> xmlize, const char *name)
{
String n = Filter(name ? name : "app", CharFilterAlpha);
XmlNode node;
@ -178,7 +178,7 @@ String StoreAsXML(Callback1<XmlIO> xmlize, const char *name)
return AsXML(node);
}
bool LoadFromXML0(Callback1<XmlIO> xmlize, const String& xml)
bool LoadFromXML0(Event<XmlIO> xmlize, const String& xml)
{
XmlNode node = ParseXML(xml);
if(node.GetCount() == 0)
@ -192,7 +192,7 @@ bool LoadFromXML0(Callback1<XmlIO> xmlize, const String& xml)
return true;
}
bool LoadFromXML(Callback1<XmlIO> xmlize, const String& xml)
bool DoLoadFromXML(Event<XmlIO> xmlize, const String& xml)
{
try {
return LoadFromXML0(xmlize, xml);
@ -201,7 +201,7 @@ bool LoadFromXML(Callback1<XmlIO> xmlize, const String& xml)
return false;
}
bool TryLoadFromXML(Callback1<XmlIO> xmlize, const String& xml)
bool DoTryLoadFromXML(Event<XmlIO> xmlize, const String& xml)
{
return LoadFromXML0(xmlize, xml);
}
@ -211,19 +211,19 @@ static String sXMLFile(const char *file)
return file ? String(file) : ConfigFile(GetExeTitle() + ".xml");
}
bool StoreAsXMLFile(Callback1<XmlIO> xmlize, const char *name, const char *file)
bool StoreAsXMLFile(Event<XmlIO> xmlize, const char *name, const char *file)
{
return SaveFile(sXMLFile(file), StoreAsXML(xmlize, name ? (String)name : GetExeTitle()));
return SaveFile(sXMLFile(file), DoStoreAsXML(xmlize, name ? (String)name : GetExeTitle()));
}
bool LoadFromXMLFile(Callback1<XmlIO> xmlize, const char *file)
bool LoadFromXMLFile(Event<XmlIO> xmlize, const char *file)
{
return LoadFromXML(xmlize, LoadFile(sXMLFile(file)));
return DoLoadFromXML(xmlize, LoadFile(sXMLFile(file)));
}
bool TryLoadFromXMLFile(Callback1<XmlIO> xmlize, const char *file)
bool TryLoadFromXMLFile(Event<XmlIO> xmlize, const char *file)
{
return TryLoadFromXML(xmlize, LoadFile(sXMLFile(file)));
return DoTryLoadFromXML(xmlize, LoadFile(sXMLFile(file)));
}
void StoreJsonValue(XmlIO& xio, const Value& v)

View file

@ -231,7 +231,6 @@ void XmlizeIndex(XmlIO& xml, const char *keytag, T& data)
if(xml.IsStoring()) {
for(int i = 0; i < data.GetCount(); i++)
if(!data.IsUnlinked(i)) {
//XmlizeStore(xml.Add(keytag), data.GetKey(i)); //FIXME xmlize with hashfn awareness
XmlIO io = xml.Add(keytag);
XmlizeStore(io, data[i]);
}
@ -239,10 +238,7 @@ void XmlizeIndex(XmlIO& xml, const char *keytag, T& data)
else {
data.Clear();
int i = 0;
//while(i < xml->GetCount() - 1 && xml->Node(i).IsTag(keytag) && xml->Node(i + 1).IsTag(valuetag)) {
while(i < xml->GetCount() && xml->Node(i).IsTag(keytag)) {
//K key;
//Xmlize(xml.At(i++), key); //FIXME dexmlize with hashfn awareness
K k;
XmlIO io = xml.At(i++);
Xmlize(io, k);
@ -261,34 +257,34 @@ struct ParamHelper__ {
ParamHelper__(T& data) : data(data) {}
};
String StoreAsXML(Callback1<XmlIO> xmlize, const char *name);
bool LoadFromXML(Callback1<XmlIO> xmlize, const String& xml);
bool TryLoadFromXML(Callback1<XmlIO> xmlize, const String& xml);
String DoStoreAsXML(Event<XmlIO> xmlize, const char *name);
bool DoLoadFromXML(Event<XmlIO> xmlize, const String& xml);
bool DoTryLoadFromXML(Event<XmlIO> xmlize, const String& xml);
template <class T>
String StoreAsXML(const T& data, const char *name = NULL)
{
ParamHelper__<T> p(const_cast<T &>(data));
return StoreAsXML(callback(&p, &ParamHelper__<T>::Invoke), name);
return DoStoreAsXML([&](XmlIO io) { Xmlize(io, const_cast<T &>(data)); }, name);
}
template <class T>
bool LoadFromXML(T& data, const String& xml)
{
ParamHelper__<T> p(data);
return LoadFromXML(callback(&p, &ParamHelper__<T>::Invoke), xml);
return DoLoadFromXML(callback(&p, &ParamHelper__<T>::Invoke), xml);
}
template <class T>
bool TryLoadFromXML(T& data, const String& xml)
{
ParamHelper__<T> p(data);
return TryLoadFromXML(callback(&p, &ParamHelper__<T>::Invoke), xml);
return DoTryLoadFromXML(callback(&p, &ParamHelper__<T>::Invoke), xml);
}
bool StoreAsXMLFile(Callback1<XmlIO> xmlize, const char *name = NULL, const char *file = NULL);
bool LoadFromXMLFile(Callback1<XmlIO> xmlize, const char *file = NULL);
bool TryLoadFromXMLFile(Callback1<XmlIO> xmlize, const char *file = NULL);
bool StoreAsXMLFile(Event<XmlIO> xmlize, const char *name = NULL, const char *file = NULL);
bool LoadFromXMLFile(Event<XmlIO> xmlize, const char *file = NULL);
bool TryLoadFromXMLFile(Event<XmlIO> xmlize, const char *file = NULL);
template <class T>
bool StoreAsXMLFile(T& data, const char *name = NULL, const char *file = NULL)

View file

@ -1,37 +0,0 @@
init_
pick_
WINAPI
CALLBACK
_CRTIMP2
_CRTIMP
__cdecl
__fastcall
WINOLEAPI
FAR
NEAR
__CLR_OR_THIS_CALL
__inline
__CRTDECL
_CRT_INSECURE_DEPRECATE_GLOBALS
_CRT_INSECURE_DEPRECATE
_STDEXT
ISOLATION_AWARE_INLINE
WINUSERAPI
WINAPIV
__in
__out
__inout
_STD
_MRTIMP2
FARPROC
APIENTRY
_SCL_INSECURE_DEPRECATE
__thiscall
_CRTIMP_PURE
_CRT_JIT_INTRINSIC
__CLRCALL_OR_CDECL
_CRTIMP2_PURE_DEBUG_IT
_CRTIMP2_PURE
__declspec
NAMESPACE_UPP
END_UPP_NAMESPACE

View file

@ -454,6 +454,13 @@ obtained from the stream, is corrupted and too big and allocating
that much memory would cause out`-of`-memory situation.&]
[s3; &]
[s4;%- &]
[s5;:Upp`:`:Stream`:`:Skip`(int`):%- [@(0.0.255) int]_[* Skip]([@(0.0.255) int]_[*@3 size])&]
[s2; Skips [%-*@3 size] bytes in input Stream. This is similar to SeekCur([%-*@3 size]),
however it works with Streams that do not support seeking. Returns
a number of bytes actually skipped (can be less than required
because of EOF).&]
[s3; &]
[s4;%- &]
[s5;:Stream`:`:GetAll`(void`*`,int`):%- [@(0.0.255) bool]_[* GetAll]([@(0.0.255) void]_`*[*@3 d
ata], [@(0.0.255) int]_[*@3 size])&]
[s2; Reads [%-*@3 size] bytes from the stream to memory at [%-*@3 data].

View file

@ -307,7 +307,7 @@ Zlib::~Zlib()
Free();
}
int64 zPress(Stream& out, Stream& in, int64 size, EventGate<int64, int64> progress, bool gzip, bool compress,
int64 zPress(Stream& out, Stream& in, int64 size, Gate<int64, int64> progress, bool gzip, bool compress,
dword *crc = NULL, bool hdr = true)
{
Zlib zlib;
@ -331,95 +331,95 @@ int64 zPress(Stream& out, Stream& in, int64 size, EventGate<int64, int64> progre
return r;
}
int64 ZCompress(Stream& out, Stream& in, int64 size, EventGate<int64, int64>progress, bool hdr)
int64 ZCompress(Stream& out, Stream& in, int64 size, Gate<int64, int64>progress, bool hdr)
{
return zPress(out, in, size, progress, false, true, NULL, hdr);
}
int64 ZDecompress(Stream& out, Stream& in, int64 size, EventGate<int64, int64>progress, bool hdr)
int64 ZDecompress(Stream& out, Stream& in, int64 size, Gate<int64, int64>progress, bool hdr)
{
return zPress(out, in, size, progress, false, false, NULL, hdr);
}
int64 ZCompress(Stream& out, Stream& in, EventGate<int64, int64>progress)
int64 ZCompress(Stream& out, Stream& in, Gate<int64, int64>progress)
{
return ZCompress(out, in, in.GetLeft(), progress);
}
int64 ZDecompress(Stream& out, Stream& in, EventGate<int64, int64>progress)
int64 ZDecompress(Stream& out, Stream& in, Gate<int64, int64>progress)
{
return zPress(out, in, in.GetLeft(), progress, false, false);
}
String ZCompress(const void *data, int64 len, EventGate<int64, int64>progress)
String ZCompress(const void *data, int64 len, Gate<int64, int64>progress)
{
StringStream out;
MemReadStream in(data, len);
return ZCompress(out, in, progress) < 0 ? String::GetVoid() : out.GetResult();
}
String ZCompress(const String& s, EventGate<int64, int64>progress)
String ZCompress(const String& s, Gate<int64, int64>progress)
{
return ZCompress(~s, s.GetLength(), progress);
}
String ZDecompress(const void *data, int64 len, EventGate<int64, int64>progress)
String ZDecompress(const void *data, int64 len, Gate<int64, int64>progress)
{
StringStream out;
MemReadStream in(data, len);
return ZDecompress(out, in, progress) < 0 ? String::GetVoid() : out.GetResult();
}
String ZDecompress(const String& s, EventGate<int64, int64>progress)
String ZDecompress(const String& s, Gate<int64, int64>progress)
{
return ZDecompress(~s, s.GetLength(), progress);
}
int64 GZCompress(Stream& out, Stream& in, int64 size, EventGate<int64, int64>progress)
int64 GZCompress(Stream& out, Stream& in, int64 size, Gate<int64, int64>progress)
{
return zPress(out, in, size, progress, true, true);
}
int64 GZDecompress(Stream& out, Stream& in, int64 size, EventGate<int64, int64>progress)
int64 GZDecompress(Stream& out, Stream& in, int64 size, Gate<int64, int64>progress)
{
return zPress(out, in, size, progress, true, false);
}
int64 GZCompress(Stream& out, Stream& in, EventGate<int64, int64>progress)
int64 GZCompress(Stream& out, Stream& in, Gate<int64, int64>progress)
{
return GZCompress(out, in, in.GetLeft(), progress);
}
String GZCompress(const void *data, int len, EventGate<int64, int64>progress)
String GZCompress(const void *data, int len, Gate<int64, int64>progress)
{
StringStream out;
MemReadStream in(data, len);
return GZCompress(out, in, progress) < 0 ? String::GetVoid() : out.GetResult();
}
String GZCompress(const String& s, EventGate<int64, int64>progress)
String GZCompress(const String& s, Gate<int64, int64>progress)
{
return GZCompress(~s, s.GetCount(), progress);
}
int64 GZDecompress(Stream& out, Stream& in, EventGate<int64, int64>progress)
int64 GZDecompress(Stream& out, Stream& in, Gate<int64, int64>progress)
{
return GZDecompress(out, in, in.GetLeft(), progress);
}
String GZDecompress(const void *data, int len, EventGate<int64, int64>progress)
String GZDecompress(const void *data, int len, Gate<int64, int64>progress)
{
StringStream out;
MemReadStream in(data, len);
return GZDecompress(out, in, progress) < 0 ? String::GetVoid() : out.GetResult();
}
String GZDecompress(const String& s, EventGate<int64, int64>progress)
String GZDecompress(const String& s, Gate<int64, int64>progress)
{
return GZDecompress(~s, s.GetCount(), progress);
}
bool GZCompressFile(const char *dstfile, const char *srcfile, EventGate<int64, int64>progress)
bool GZCompressFile(const char *dstfile, const char *srcfile, Gate<int64, int64>progress)
{
FileIn in(srcfile);
if(!in)
@ -433,13 +433,13 @@ bool GZCompressFile(const char *dstfile, const char *srcfile, EventGate<int64, i
return !out.IsError();
}
bool GZCompressFile(const char *srcfile, EventGate<int64, int64>progress)
bool GZCompressFile(const char *srcfile, Gate<int64, int64>progress)
{
String dstfile = String(srcfile) + ".gz";
return GZCompressFile(dstfile, srcfile, progress);
}
bool GZDecompressFile(const char *dstfile, const char *srcfile, EventGate<int64, int64>progress)
bool GZDecompressFile(const char *dstfile, const char *srcfile, Gate<int64, int64>progress)
{
FileIn in(srcfile);
if(!in)
@ -453,7 +453,7 @@ bool GZDecompressFile(const char *dstfile, const char *srcfile, EventGate<int64,
return !out.IsError();
}
bool GZDecompressFile(const char *srcfile, EventGate<int64, int64>progress)
bool GZDecompressFile(const char *srcfile, Gate<int64, int64>progress)
{
String dstfile = srcfile;
if(dstfile.EndsWith(".gz"))
@ -466,9 +466,9 @@ bool GZDecompressFile(const char *srcfile, EventGate<int64, int64>progress)
return GZDecompressFile(dstfile, srcfile, progress);
}
EventGate<int64, int64> AsGate64(Gate2<int, int> gate)
Gate<int64, int64> AsGate64(Gate2<int, int> gate)
{
EventGate<int64, int64> h;
Gate<int64, int64> h;
h << [=](int64 a, int64 b) { return gate((int)a, (int)b); };
return h;
}
@ -502,7 +502,7 @@ String FastDecompress(const String& data)
}
// following function is used in both plugin/lz4 and plugin/zstd
void sCompressStreamCopy_(Stream& out, Stream& in, EventGate<int64, int64> progress, Stream& orig_in, int64 insz)
void sCompressStreamCopy_(Stream& out, Stream& in, Gate<int64, int64> progress, Stream& orig_in, int64 insz)
{
const int CHUNK = 32678;
Buffer<byte> b(CHUNK);

View file

@ -45,7 +45,7 @@ class Zlib {
void Init();
public:
Callback2<const void *, int> WhenOut;
Event<const void *, int> WhenOut;
void Compress();
void Decompress();
@ -120,37 +120,37 @@ public:
~ZDecompressStream() { Close(); }
};
int64 CopyStream(Stream& dest, Stream& src, int64 count, EventGate<int64, int64> progress);
int64 CopyStream(Stream& dest, Stream& src, int64 count, Gate<int64, int64> progress);
int64 ZCompress(Stream& out, Stream& in, int64 size, EventGate<int64, int64> progress = false, bool hdr = true);
int64 ZCompress(Stream& out, Stream& in, EventGate<int64, int64> progress = false);
String ZCompress(const void *data, int64 len, EventGate<int64, int64> progress = false);
String ZCompress(const String& s, EventGate<int64, int64> progress = false);
int64 ZCompress(Stream& out, Stream& in, int64 size, Gate<int64, int64> progress = Null, bool hdr = true);
int64 ZCompress(Stream& out, Stream& in, Gate<int64, int64> progress = Null);
String ZCompress(const void *data, int64 len, Gate<int64, int64> progress = Null);
String ZCompress(const String& s, Gate<int64, int64> progress = Null);
int64 ZDecompress(Stream& out, Stream& in, int64 size, EventGate<int64, int64> progress = false, bool hdr = true);
int64 ZDecompress(Stream& out, Stream& in, EventGate<int64, int64> progress = false);
String ZDecompress(const void *data, int64 len, EventGate<int64, int64> progress = false);
String ZDecompress(const String& s, EventGate<int64, int64> progress = false);
int64 ZDecompress(Stream& out, Stream& in, int64 size, Gate<int64, int64> progress = Null, bool hdr = true);
int64 ZDecompress(Stream& out, Stream& in, Gate<int64, int64> progress = Null);
String ZDecompress(const void *data, int64 len, Gate<int64, int64> progress = Null);
String ZDecompress(const String& s, Gate<int64, int64> progress = Null);
int64 GZCompress(Stream& out, Stream& in, int64 size, EventGate<int64, int64> progress = false);
int64 GZCompress(Stream& out, Stream& in, EventGate<int64, int64> progress = false);
String GZCompress(const void *data, int len, EventGate<int64, int64> progress = false);
String GZCompress(const String& s, EventGate<int64, int64> progress = false);
int64 GZCompress(Stream& out, Stream& in, int64 size, Gate<int64, int64> progress = Null);
int64 GZCompress(Stream& out, Stream& in, Gate<int64, int64> progress = Null);
String GZCompress(const void *data, int len, Gate<int64, int64> progress = Null);
String GZCompress(const String& s, Gate<int64, int64> progress = Null);
int64 GZDecompress(Stream& out, Stream& in, int64 size, EventGate<int64, int64> progress = false);
int64 GZDecompress(Stream& out, Stream& in, EventGate<int64, int64> progress = false);
String GZDecompress(const void *data, int len, EventGate<int64, int64> progress = false);
String GZDecompress(const String& s, EventGate<int64, int64> progress = false);
int64 GZDecompress(Stream& out, Stream& in, int64 size, Gate<int64, int64> progress = Null);
int64 GZDecompress(Stream& out, Stream& in, Gate<int64, int64> progress = Null);
String GZDecompress(const void *data, int len, Gate<int64, int64> progress = Null);
String GZDecompress(const String& s, Gate<int64, int64> progress = Null);
bool GZCompressFile(const char *dstfile, const char *srcfile, EventGate<int64, int64> progress = false);
bool GZCompressFile(const char *srcfile, EventGate<int64, int64> progress = false);
bool GZCompressFile(const char *dstfile, const char *srcfile, Gate<int64, int64> progress = Null);
bool GZCompressFile(const char *srcfile, Gate<int64, int64> progress = Null);
bool GZDecompressFile(const char *dstfile, const char *srcfile, EventGate<int64, int64> progress = false);
bool GZDecompressFile(const char *srcfile, EventGate<int64, int64> progress = false);
bool GZDecompressFile(const char *dstfile, const char *srcfile, Gate<int64, int64> progress = Null);
bool GZDecompressFile(const char *srcfile, Gate<int64, int64> progress = Null);
/// Backward compatibility:
EventGate<int64, int64> AsGate64(Gate2<int, int> gate);
Gate<int64, int64> AsGate64(Gate2<int, int> gate);
inline int ZCompress(Stream& out, Stream& in, Gate2<int, int> progress) { return (int)ZCompress(out, in, AsGate64(progress)); }
inline String ZCompress(const void *data, int len, Gate2<int, int> progress) { return ZCompress(data, len, AsGate64(progress)); }

View file

@ -250,7 +250,7 @@ class Lex {
void ThrowError(const char *e);
public:
Callback1<const String&> WhenError;
Event<const String&> WhenError;
struct Grounding {};
@ -503,7 +503,7 @@ struct Parser {
bool inbody;
int struct_level;
Callback2<int, const String&> err;
Event<int, const String&> err;
int lpos, line;
@ -600,7 +600,7 @@ public:
bool IsInBody() const { return inbody; }
typedef Callback1<const FunctionStat &> FnEndCallback;
typedef Event<const FunctionStat &> FnEndCallback;
bool dobody;
String current_scope;
@ -627,7 +627,7 @@ public:
Vector<String> GetNamespaces() const;
void Do(Stream& in, CppBase& _base, int file, int filetype,
const String& title, Callback2<int, const String&> _err,
const String& title, Event<int, const String&> _err,
const Vector<String>& typenames,
const Vector<String>& namespace_stack,
const Index<String>& namespace_using);

View file

@ -1754,7 +1754,7 @@ void Parser::Do()
}
void Parser::Do(Stream& in, CppBase& _base, int filei_, int filetype_,
const String& title_, Callback2<int, const String&> _err,
const String& title_, Event<int, const String&> _err,
const Vector<String>& typenames,
const Vector<String>& namespace_stack,
const Index<String>& namespace_using)

View file

@ -880,7 +880,7 @@ public:
virtual String GetDesc() const;
Callback WhenAction;
Event<> WhenAction;
void AddChild(Ctrl *child);
void AddChild(Ctrl *child, Ctrl *insafter);
@ -1138,9 +1138,9 @@ public:
const Value& operator<<=(const Value& v) { SetData(v); return v; }
bool IsNullInstance() const { return GetData().IsNull(); }
Callback operator<<=(Callback action) { WhenAction = action; return action; }
Callback operator<<=(Callback action) { WhenAction = action; return action; }
Callback& operator<<(Function<void ()> action) { return WhenAction << action; }
Event<>& operator<<(Event<> action) { return WhenAction << action; }
void SetTimeCallback(int delay_ms, Function<void ()> cb, int id = 0);
void KillTimeCallback(int id = 0);
@ -1497,8 +1497,8 @@ protected:
virtual void DrawRect(Rect r1, Rect r2);
public:
Callback1<Rect> sync;
Callback1<Rect&> round;
Event<Rect> sync;
Event<Rect&> round;
RectTracker& SetCursorImage(const Image& m) { cursorimage = m; return *this; }
RectTracker& MinSize(Size sz) { minsize = sz; return *this; }

View file

@ -59,7 +59,7 @@ void WakeUpGuiThread();
struct Ctrl::CallBox {
Semaphore sem;
Callback cb;
Event<> cb;
};
void Ctrl::PerformCall(Ctrl::CallBox *cbox)

View file

@ -10,7 +10,7 @@ int MemoryProbeInt;
struct TimeEvent : public Link<TimeEvent> {
dword time;
int delay;
Callback cb;
Event<> cb;
void *id;
bool rep;
};
@ -29,7 +29,7 @@ static TimeEvent *tevents() {
return t.GetPtr();
}
static void sTimeCallback(dword time, int delay, Callback cb, void *id) {
static void sTimeCallback(dword time, int delay, Event<> cb, void *id) {
TimeEvent *ne = tevents()->InsertPrev();
ne->time = time;
ne->cb = cb;
@ -43,7 +43,7 @@ void SetTimeCallback(int delay_ms, Function<void ()> cb, void *id) {
Mutex::Lock __(sTimerLock);
ASSERT(abs(delay_ms) < 0x40000000);
LLOG("SetTimeCallback " << delay_ms << " " << id);
sTimeCallback(GetTickCount() + abs(delay_ms), delay_ms, Callback() << cb, id);
sTimeCallback(GetTickCount() + abs(delay_ms), delay_ms, Event<> () << cb, id);
}
void KillTimeCallbacks(void *id, void *idlim) {
@ -114,7 +114,7 @@ void Ctrl::TimerProc(dword time)
if(!todo)
break;
LLOG("Performing " << todo->time << " " << todo->delay << " " << todo->id);
Callback cb = todo->cb;
Event<> cb = todo->cb;
if(todo->delay < 0)
todo->rep = true;
else

View file

@ -164,7 +164,7 @@ public: // really private:
static Gclipboard& gselection();
static String RenderPrimarySelection(const Value& fmt);
static Vector<Callback> hotkey;
static Vector<Event<> > hotkey;
static Vector<dword> keyhot;
static Vector<dword> modhot;

View file

@ -6,7 +6,7 @@ namespace Upp {
#define LLOG(x) // DLOG(x)
Vector<Callback> Ctrl::hotkey;
Vector<Event<> > Ctrl::hotkey;
Vector<dword> Ctrl::keyhot;
Vector<dword> Ctrl::modhot;
@ -122,7 +122,7 @@ Ctrl *Ctrl::GetActiveCtrl()
return activeCtrl;
}
// Vector<Callback> Ctrl::hotkey;
// Vector<Event<> > Ctrl::hotkey;
#ifndef GDK_WINDOWING_X11

View file

@ -128,7 +128,7 @@ int Ctrl::RegisterSystemHotKey(dword key, Function<void ()> cb)
q = i;
break;
}
hotkey.At(q) = Callback() << cb;
hotkey.At(q) = Event<> () << cb;
keyhot.At(q) = k;
modhot.At(q) = mod;
return q;

View file

@ -93,7 +93,7 @@ private:
public:
virtual void ShutdownWindow();
Callback WhenClose;
Event<> WhenClose;
void Backup();
void Restore();

View file

@ -48,7 +48,7 @@ protected:
Image DoMouse(int e, Point p, int zd = 0);
static void sProcessMSG(MSG& msg);
static Vector<Callback> hotkey;
static Vector<Event<> > hotkey;
friend void sSetCursor(Ctrl *ctrl, const Image& m);

View file

@ -714,7 +714,7 @@ bool PassWindowsKey(int wParam)
|| wParam >= 0x90; // OEM keys
}
Vector<Callback> Ctrl::hotkey;
Vector<Event<> > Ctrl::hotkey;
int Ctrl::RegisterSystemHotKey(dword key, Function<void ()> cb)
{
@ -725,7 +725,7 @@ int Ctrl::RegisterSystemHotKey(dword key, Function<void ()> cb)
q = i;
break;
}
hotkey.At(q) = Callback() << cb;
hotkey.At(q) = Event<> () << cb;
dword mod = 0;
if(key & K_ALT)
mod |= MOD_ALT;

View file

@ -34,7 +34,7 @@ private:
XWindow *GetXWindow();
static void SyncMousePos();
static void ReleaseGrab();
static Vector<Callback> hotkey;
static Vector<Event<> > hotkey;
static Vector<dword> modhot;
static Vector<dword> keyhot;

View file

@ -173,7 +173,7 @@ dword X11mods(dword key)
return mod;
}
Vector<Callback> Ctrl::hotkey;
Vector<Event<> > Ctrl::hotkey;
Vector<dword> Ctrl::keyhot;
Vector<dword> Ctrl::modhot;

View file

@ -97,7 +97,9 @@ workspace. Exceeding parts are trimmed (decreasing window size).&]
[s5;:TopWindow`:`:Breaker`(int`):%- [_^Callback^ Callback]_[* Breaker]([@(0.0.255) int]_[*@3 I
D]_`=_IDEXIT)&]
[s2; Returns Callback that, when invoked, invokes [* Break] with the
specified exit code.&]
specified exit code. Note that Callback as return value is used
for backward compatibility with pre`-C`+`+11 U`+`+ and for practical
purposes, you could consider Event<> being returned.&]
[s7; [%-*C@3 ID]-|Message loop exit code.&]
[s7; [*/ Return value]-|Callback.&]
[s3; &]
@ -105,7 +107,9 @@ specified exit code.&]
[s5;:TopWindow`:`:Acceptor`(int`):%- [_^Callback^ Callback]_[* Acceptor]([@(0.0.255) int]_[*@3 I
D])&]
[s2; Returns Callback that, when invoked, invokes [* AcceptBreak] with
the specified exit code.&]
the specified exit code. Note that Callback as return value is
used for backward compatibility with pre`-C`+`+11 U`+`+ and for
practical purposes, you could consider Event<> being returned.&]
[s7; [%-*C@3 ID]-|Message loop exit code.&]
[s7; [*/ Return value]-|Callback.&]
[s3; &]
@ -113,7 +117,9 @@ the specified exit code.&]
[s5;:TopWindow`:`:Rejector`(int`):%- [_^Callback^ Callback]_[* Rejector]([@(0.0.255) int]_[*@3 I
D])&]
[s2; Returns Callback that, when invoked, invokes [* RejectBreak] with
the specified exit code.&]
the specified exit code. Note that Callback as return value is
used for backward compatibility with pre`-C`+`+11 U`+`+ and for
practical purposes, you could consider Event<> being returned.&]
[s7; [%-*C@3 ID]-|Message loop exit code.&]
[s7; [*/ Return value]-|Callback.&]
[s3; &]

View file

@ -62,7 +62,7 @@ ArrayCtrl::Column& ArrayCtrl::Column::SetDisplay(const Display& d)
return *this;
}
ArrayCtrl::Column& ArrayCtrl::Column::Ctrls(Callback2<int, One<Ctrl>&> _factory)
ArrayCtrl::Column& ArrayCtrl::Column::Ctrls(Event<int, One<Ctrl>&> _factory)
{
factory = _factory;
arrayctrl->hasctrls = arrayctrl->headerctrls = true;
@ -72,15 +72,9 @@ ArrayCtrl::Column& ArrayCtrl::Column::Ctrls(Callback2<int, One<Ctrl>&> _factory)
return *this;
}
void ArrayCtrl::Column::Factory1(int, One<Ctrl>& x)
{
factory1(x);
}
ArrayCtrl::Column& ArrayCtrl::Column::Ctrls(Callback1<One<Ctrl>&> _factory)
{
factory1 = _factory;
return Ctrls(THISBACK(Factory1));
return Ctrls([=](int, One<Ctrl>& x) { _factory(x); });
}
void ArrayCtrl::Column::ClearCache() {
@ -3015,7 +3009,7 @@ ArrayCtrl::ArrayCtrl() {
header.WhenScroll = THISBACK(HeaderScroll);
sb.WhenScroll = THISBACK(Scroll);
header.Moving();
WhenAcceptRow = true;
WhenAcceptRow = [] { return true; };
WhenBar = THISBACK(StdBar);
SetFrame(ViewFrame());
oddpaper = evenpaper = SColorPaper;

View file

@ -1,8 +1,7 @@
template <class T>
void DefaultCtrlFactoryFn(One<Ctrl>& ctrl)
{
ctrl = new T;
ctrl.Create<T>();
}
template <class T>
@ -60,8 +59,8 @@ public:
const Convert *convert;
Ptr<Ctrl> edit;
const Display *display;
Callback2<int, One<Ctrl>&> factory;
Callback1< One<Ctrl>& > factory1;
Event<int, One<Ctrl>&> factory;
Event<One<Ctrl>&> factory1;
int (*accel)(int);
int margin;
bool cached;
@ -77,7 +76,6 @@ public:
void RemoveCache(int i);
void ClearCache();
void Sorts();
void Factory1(int, One<Ctrl>& ctrl);
typedef Column CLASSNAME;
@ -94,12 +92,12 @@ public:
Column& SetDisplay(const Display& d);
Column& NoEdit();
Column& Edit(Ctrl& e);
Column& Ctrls(Callback1<One<Ctrl>&> factory);
Column& Ctrls(void (*factory)(One<Ctrl>&)) { return Ctrls(callback(factory)); }
Column& Ctrls(Callback1<One<Ctrl>&> factory); // deprecated
Column& Ctrls(void (*factory)(One<Ctrl>&)) { return Ctrls(Event<int, One<Ctrl>&>([=](int, One<Ctrl>& h) { factory(h); })); }
template <class T>
Column& Ctrls() { return Ctrls(DefaultCtrlFactory<T>()); }
Column& Ctrls(Callback2<int, One<Ctrl>&> factory);
Column& Ctrls(void (*factory)(int, One<Ctrl>&)) { return Ctrls(callback(factory)); }
Column& Ctrls(Event<int, One<Ctrl>&> factory);
Column& Ctrls(void (*factory)(int, One<Ctrl>&)) { return Ctrls(Event<int, One<Ctrl>&>([=](int a, One<Ctrl>& b){ factory(a, b); })); }
Column& InsertValue(const Value& v);
Column& InsertValue(ValueGen& g);
Column& NoClickEdit() { clickedit = false; return *this; }
@ -343,36 +341,36 @@ protected:
void ClearModify();
public:
Callback WhenSel; // the most usual ArrayCtrl callbak
Event<> WhenSel; // the most usual ArrayCtrl callbak
Callback WhenLeftDouble;
Callback1<Point> WhenMouseMove;
Callback WhenEnterKey;
Callback WhenLeftClick;
Callback1<Bar&> WhenBar;
Gate WhenAcceptRow;
Callback WhenUpdateRow;
Callback WhenArrayAction;
Callback WhenStartEdit;
Callback WhenAcceptEdit;
Callback WhenCtrlsAction;
Callback WhenScroll;
Callback WhenHeaderLayout;
Event<> WhenLeftDouble;
Event<Point> WhenMouseMove;
Event<> WhenEnterKey;
Event<> WhenLeftClick;
Event<Bar&> WhenBar;
Gate<> WhenAcceptRow;
Event<> WhenUpdateRow;
Event<> WhenArrayAction;
Event<> WhenStartEdit;
Event<> WhenAcceptEdit;
Event<> WhenCtrlsAction;
Event<> WhenScroll;
Event<> WhenHeaderLayout;
Callback2<int, bool&> WhenLineEnabled;
Callback2<int, bool&> WhenLineVisible;
Event<int, bool&> WhenLineEnabled;
Event<int, bool&> WhenLineVisible;
Callback WhenDrag;
Callback3<int, int, PasteClip&> WhenDropCell;
Callback2<int, PasteClip&> WhenDropInsert;
Callback2<int, PasteClip&> WhenDropLine;
Callback1<PasteClip&> WhenDrop;
Event<> WhenDrag;
Event<int, int, PasteClip&> WhenDropCell;
Event<int, PasteClip&> WhenDropInsert;
Event<int, PasteClip&> WhenDropLine;
Event<PasteClip&> WhenDrop;
//Deprecated - use WhenSel
Callback WhenEnterRow;
Callback WhenKillCursor;
Callback WhenCursor;
Callback WhenSelection;
Event<> WhenEnterRow;
Event<> WhenKillCursor;
Event<> WhenCursor;
Event<> WhenSelection;
IdInfo& IndexInfo(int ii);
IdInfo& IndexInfo(const Id& id);
@ -738,9 +736,9 @@ public:
void Click();
public:
Callback WhenAction;
Event<> WhenAction;
Callback operator <<= (Callback cb) { return WhenAction = cb; }
Event<> operator <<= (Event<> cb) { return WhenAction = cb; }
private:
Vector<int> index;

View file

@ -292,7 +292,7 @@ Bar::Item& Bar::Add(const char *text, const UPP::Image& image, const Callback&
return AddItem(callback).Text(text).Image(image);
}
/*
Bar::Item& Bar::Add(const String& text, const UPP::Image& image, const Callback& callback)
Bar::Item& Bar::Add(const String& text, const UPP::Image& image, const Event<> & callback)
{
return Add(~text, image, callback);
}
@ -305,16 +305,16 @@ Bar::Item& Bar::Add(KeyInfo& (*key)(), const UPP::Image& image, const Callback&
return Add(text, image, callback).Key(key);
}
Bar::Item& Bar::Add(bool enable, const char *text, const Callback& callback)
Bar::Item& Bar::Add(bool enable, const char *text, const Callback & callback)
{ return IsMenuBar() ? Add(enable, text, Image(), callback) : NilItem(); }
Bar::Item& Bar::Add(const char *text, const Callback& callback)
Bar::Item& Bar::Add(const char *text, const Callback & callback)
{ return IsMenuBar() ? Add(true, text, Image(), callback) : NilItem(); }
Bar::Item& Bar::Add(bool enable, KeyInfo& (*key)(), const Callback& callback)
Bar::Item& Bar::Add(bool enable, KeyInfo& (*key)(), const Callback & callback)
{ return IsMenuBar() ? Add(enable, key, Image(), callback) : NilItem(); }
Bar::Item& Bar::Add(KeyInfo& (*key)(), const Callback& callback)
Bar::Item& Bar::Add(KeyInfo& (*key)(), const Callback & callback)
{ return IsMenuBar() ? Add(true, key, Image(), callback) : NilItem(); }
Bar::Item& Bar::Add(bool enable, const char *text, const UPP::Image& image, const UPP::Function<void ()>& fn)
@ -335,7 +335,7 @@ Bar::Item& Bar::Add(const char *text, const UPP::Image& image, const Function<vo
/*
Bar::Item& Bar::Add(const String& text, const UPP::Image& image, const Function<void ()>& fn)
{
return Add(text, image, Callback() << fn);
return Add(text, image, Event<> () << fn);
}
*/
@ -380,16 +380,16 @@ void Bar::MenuGap(int size) { if(IsMenuBar()) Gap(size); }
void Bar::AddMenu(Ctrl& ctrl) { if(IsMenuBar()) Add(ctrl); }
void Bar::AddMenu(Ctrl& ctrl, Size sz) { if(IsMenuBar()) Add(ctrl, sz); }
Bar::Item& Bar::AddMenu(bool enable, KeyInfo& (*key)(), const UPP::Image& image, const Callback& callback)
Bar::Item& Bar::AddMenu(bool enable, KeyInfo& (*key)(), const UPP::Image& image, const Callback & callback)
{ return IsMenuBar() ? Add(enable, key, image, callback) : NilItem(); }
Bar::Item& Bar::AddMenu(KeyInfo& (*key)(), const UPP::Image& image, const Callback& callback)
Bar::Item& Bar::AddMenu(KeyInfo& (*key)(), const UPP::Image& image, const Callback & callback)
{ return IsMenuBar() ? Add(key, image, callback) : NilItem(); }
Bar::Item& Bar::AddMenu(bool enable, const char *text, const UPP::Image& image, const Callback& callback)
Bar::Item& Bar::AddMenu(bool enable, const char *text, const UPP::Image& image, const Callback & callback)
{ return IsMenuBar() ? Add(enable, text, image, callback) : NilItem(); }
Bar::Item& Bar::AddMenu(const char *text, const UPP::Image& image, const Callback& callback)
Bar::Item& Bar::AddMenu(const char *text, const UPP::Image& image, const Callback & callback)
{ return IsMenuBar() ? Add(text, image, callback) : NilItem(); }
@ -400,49 +400,49 @@ Bar::Item& Bar::AddMenu(bool enable, const char *text, const UPP::Image& image,
Bar::Item& Bar::AddMenu(bool enable, KeyInfo& (*key)(), const UPP::Image& image, const Function<void ()>& fn)
{
return AddMenu(enable, key, image, Callback() << fn);
return AddMenu(enable, key, image, Callback () << fn);
}
Bar::Item& Bar::AddMenu(const char *text, const UPP::Image& image, const Function<void ()>& fn)
{
return AddMenu(text, image, Callback() << fn);
return AddMenu(text, image, Callback () << fn);
}
Bar::Item& Bar::AddMenu(KeyInfo& (*key)(), const UPP::Image& m, const Function<void ()>& fn)
{
return AddMenu(key, m, Callback() << fn);
return AddMenu(key, m, Callback () << fn);
}
Bar::Item& Bar::Add(bool enable, const char *text, const Event<Bar&>& proc)
Bar::Item& Bar::Add(bool enable, const char *text, const Callback1<Bar&>& proc)
{ return AddSubMenu(proc).Text(text).Enable(enable); }
Bar::Item& Bar::Add(const char *text, const Event<Bar&>& proc)
Bar::Item& Bar::Add(const char *text, const Callback1<Bar&>& proc)
{ return Add(true, text, proc); }
Bar::Item& Bar::Add(bool enable, const char *text, const UPP::Image& image, const Event<Bar&>& proc)
Bar::Item& Bar::Add(bool enable, const char *text, const UPP::Image& image, const Callback1<Bar&>& proc)
{ return Add(enable, text, proc).Image(image); }
Bar::Item& Bar::Add(const char *text, const UPP::Image& image, const Event<Bar&>& proc)
Bar::Item& Bar::Add(const char *text, const UPP::Image& image, const Callback1<Bar&>& proc)
{ return Add(text, proc).Image(image); }
Bar::Item& Bar::Sub(bool enable, const char *text, const Function<void (Bar&)>& submenu)
{
return Add(enable, text, Event<Bar&>() << submenu);
return Add(enable, text, Callback1<Bar&>() << submenu);
}
Bar::Item& Bar::Sub(const char *text, const Function<void (Bar&)>& submenu)
{
return Add(text, Event<Bar&>() << submenu);
return Add(text, Callback1<Bar&>() << submenu);
}
Bar::Item& Bar::Sub(bool enable, const char *text, const UPP::Image& image, const Function<void (Bar&)>& submenu)
{
return Add(enable, text, image, Event<Bar&>() << submenu);
return Add(enable, text, image, Callback1<Bar&>() << submenu);
}
Bar::Item& Bar::Sub(const char *text, const UPP::Image& image, const Function<void (Bar&)>& submenu)
{
return Add(text, image, Event<Bar&>() << submenu);
return Add(text, image, Callback1<Bar&>() << submenu);
}
void Bar::ToolSeparator() { if(IsToolBar()) Separator(); }
@ -452,9 +452,9 @@ void Bar::ToolGap(int size) { if(IsToolBar()) Gap(size); }
void Bar::AddTool(Ctrl& ctrl) { if(IsToolBar()) Add(ctrl); }
void Bar::AddTool(Ctrl& ctrl, Size sz) { if(IsToolBar()) Add(ctrl, sz); }
void Bar::AddKey(dword key, Callback cb) {}
void Bar::AddKey(dword key, Event<> cb) {}
void Bar::AddKey(KeyInfo& (*key)(), Callback cb)
void Bar::AddKey(KeyInfo& (*key)(), Event<> cb)
{
KeyInfo& k = (*key)();
AddKey(k.key[0], cb);
@ -463,17 +463,17 @@ void Bar::AddKey(KeyInfo& (*key)(), Callback cb)
AddKey(k.key[3], cb);
}
Bar::Item& Bar::Add(bool enable, const UPP::Image& image, Callback cb)
Bar::Item& Bar::Add(bool enable, const UPP::Image& image, Event<> cb)
{ return IsToolBar() ? AddItem(cb).Image(image).Enable(enable) : NilItem(); }
Bar::Item& Bar::Add(const UPP::Image& image, Callback cb)
Bar::Item& Bar::Add(const UPP::Image& image, Event<> cb)
{ return IsToolBar() ? Add(true, image, cb) : NilItem(); }
class Bar::ScanKeys : public Bar {
struct KeyItem : public Bar::Item {
bool enabled;
Vector<dword> key;
Callback action;
Event<> action;
virtual Item& Text(const char *) { return *this; }
virtual Item& Check(bool check) { return *this; }
@ -492,8 +492,8 @@ class Bar::ScanKeys : public Bar {
int level;
protected:
virtual Item& AddItem(Callback cb);
virtual Item& AddSubMenu(Callback1<Bar&> proc);
virtual Item& AddItem(Event<> cb);
virtual Item& AddSubMenu(Event<Bar&> proc);
virtual void AddCtrl(Ctrl *ctrl, int gapsize) {};
virtual void AddCtrl(Ctrl *ctrl, Size sz) {};
@ -504,14 +504,14 @@ public:
virtual bool IsEmpty() const { return key.IsEmpty(); }
virtual void Separator() {}
virtual void AddKey(dword key, Callback cb);
virtual void AddKey(dword key, Event<> cb);
bool Do(dword key);
ScanKeys() { level = 0; }
};
Bar::Item& Bar::ScanKeys::AddItem(Callback cb)
Bar::Item& Bar::ScanKeys::AddItem(Event<> cb)
{
KeyItem& m = key.Add();
m.action = cb;
@ -519,7 +519,7 @@ Bar::Item& Bar::ScanKeys::AddItem(Callback cb)
return m;
}
Bar::Item& Bar::ScanKeys::AddSubMenu(Callback1<Bar&> proc)
Bar::Item& Bar::ScanKeys::AddSubMenu(Event<Bar&> proc)
{
level++;
if(level > 5)
@ -529,7 +529,7 @@ Bar::Item& Bar::ScanKeys::AddSubMenu(Callback1<Bar&> proc)
return key.GetCount() ? key.Top() : nilitem;
}
void Bar::ScanKeys::AddKey(dword _key, Callback cb)
void Bar::ScanKeys::AddKey(dword _key, Event<> cb)
{
if(_key) {
KeyItem& m = key.Add();
@ -551,7 +551,7 @@ bool Bar::ScanKeys::Do(dword k)
return false;
}
bool Bar::Scan(Callback1<Bar&> proc, dword key)
bool Bar::Scan(Event<Bar&> proc, dword key)
{
ScanKeys keys;
proc(keys);
@ -742,12 +742,12 @@ void LRUList::Serialize(Stream& stream)
StreamContainer(stream, lru);
}
void LRUList::Select(String f, Callback1<const String&> WhenSelect)
void LRUList::Select(String f, Event<const String&> WhenSelect)
{
WhenSelect(f);
}
void LRUList::operator()(Bar& bar, Callback1<const String&> WhenSelect)
void LRUList::operator()(Bar& bar, Event<const String&> WhenSelect)
{
if(bar.IsMenuBar() && !lru.IsEmpty()) {
bar.Separator();

View file

@ -21,7 +21,7 @@ private:
int& VeHo(bool horz, Size& sz) const { return horz ? sz.cy : sz.cx; }
public:
Callback WhenLeftClick;
Event<> WhenLeftClick;
void PaintBar(Draw& w, const SeparatorCtrl::Style& ss,
const Value& pane, const Value& iconbar = Null, int iconsz = 0);
@ -74,8 +74,8 @@ public:
};
protected:
virtual Item& AddItem(Callback cb) = 0;
virtual Item& AddSubMenu(Callback1<Bar&> proc) = 0;
virtual Item& AddItem(Event<> cb) = 0;
virtual Item& AddSubMenu(Event<Bar&> proc) = 0;
virtual void AddCtrl(Ctrl *ctrl, int gapsize) = 0;
virtual void AddCtrl(Ctrl *ctrl, Size sz) = 0;
@ -86,7 +86,7 @@ public:
virtual void Separator() = 0;
static Item& NilItem();
static bool Scan(Callback1<Bar&> proc, dword key);
static bool Scan(Event<Bar&> proc, dword key);
void Break();
void Gap(int size = 8);
@ -153,14 +153,14 @@ public:
Item& AddMenu(const String& text, const UPP::Image& m, const Function<void ()>& fn) { return AddMenu(~text, m, fn); }
Item& AddMenu(KeyInfo& (*key)(), const UPP::Image& m, const Function<void ()>& fn);
Item& Add(bool enable, const char *text, const Event<Bar&>& proc);
Item& Add(bool enable, const String& text, const Event<Bar&>& proc) { return Add(enable, ~text, proc); }
Item& Add(const char *text, const Event<Bar&>& proc);
Item& Add(const String& text, const Event<Bar&>& proc) { return Add(~text, proc); }
Item& Add(bool enable, const char *text, const UPP::Image& image, const Event<Bar&>& proc);
Item& Add(bool enable, const String& text, const UPP::Image& image, const Event<Bar&>& proc) { return Add(enable, ~text, proc); }
Item& Add(const char *text, const UPP::Image& image, const Event<Bar&>& proc);
Item& Add(const String& text, const UPP::Image& image, const Event<Bar&>& proc) { return Add(~text, image, proc); }
Item& Add(bool enable, const char *text, const Callback1<Bar&>& proc);
Item& Add(bool enable, const String& text, const Callback1<Bar&>& proc) { return Add(enable, ~text, proc); }
Item& Add(const char *text, const Callback1<Bar&>& proc);
Item& Add(const String& text, const Callback1<Bar&>& proc) { return Add(~text, proc); }
Item& Add(bool enable, const char *text, const UPP::Image& image, const Callback1<Bar&>& proc);
Item& Add(bool enable, const String& text, const UPP::Image& image, const Callback1<Bar&>& proc) { return Add(enable, ~text, proc); }
Item& Add(const char *text, const UPP::Image& image, const Callback1<Bar&>& proc);
Item& Add(const String& text, const UPP::Image& image, const Callback1<Bar&>& proc) { return Add(~text, image, proc); }
Item& Sub(bool enable, const char *text, const Function<void (Bar&)>& submenu);
Item& Sub(bool enable, const String& text, const Function<void (Bar&)>& submenu) { return Sub(enable, ~text, submenu); }
Item& Sub(const char *text, const Function<void (Bar&)>& submenu);
@ -179,11 +179,11 @@ public:
void AddTool(Ctrl& ctrl, Size sz);
void AddTool(Ctrl& ctrl, int cx, int cy = 0) { AddTool(ctrl, Size(cx, cy)); }
Item& Add(const UPP::Image& image, Callback callback);
Item& Add(bool enable, const UPP::Image& image, Callback callback);
Item& Add(const UPP::Image& image, Event<> callback);
Item& Add(bool enable, const UPP::Image& image, Event<> callback);
virtual void AddKey(dword key, Callback cb);
void AddKey(KeyInfo& (*key)(), Callback cb);
virtual void AddKey(dword key, Event<> cb);
void AddKey(KeyInfo& (*key)(), Event<> cb);
virtual bool IsMenuBar() const { return false; }
virtual bool IsToolBar() const { return false; }
@ -250,8 +250,8 @@ protected:
friend class BarPane;
public:
Callback1<const String&> WhenHelp;
Callback WhenLeftClick;
Event<const String&> WhenHelp;
Event<> WhenLeftClick;
static BarCtrl *GetBarCtrlParent(Ctrl *child);
static void SendHelpLine(Ctrl *q);
@ -299,8 +299,8 @@ public:
virtual bool IsMenuBar() const { return true; }
protected:
virtual Item& AddItem(Callback cb);
virtual Item& AddSubMenu(Callback1<Bar&> proc);
virtual Item& AddItem(Event<> cb);
virtual Item& AddSubMenu(Event<Bar&> proc);
virtual Value GetBackground() const;
public:
@ -362,15 +362,15 @@ protected:
};
public:
Callback WhenSubMenuOpen;
Callback WhenSubMenuClose;
Event<> WhenSubMenuOpen;
Event<> WhenSubMenuClose;
static int GetStdHeight(Font font = StdFont());
void CloseMenu();
void Set(Callback1<Bar&> menu);
void Post(Callback1<Bar&> bar);
void Set(Event<Bar&> menu);
void Post(Event<Bar&> bar);
void PopUp(Point p) { PopUp(GetActiveCtrl(), p); }
void PopUp() { PopUp(GetMousePos()); }
@ -379,9 +379,9 @@ public:
void Execute(Point p) { Execute(GetActiveCtrl(), p); }
void Execute() { Execute(GetMousePos()); }
static void Execute(Ctrl *owner, Callback1<Bar&> proc, Point p);
static void Execute(Callback1<Bar&> proc, Point p) { Execute(GetActiveCtrl(), proc, p); }
static void Execute(Callback1<Bar&> proc) { Execute(proc, GetMousePos()); }
static void Execute(Ctrl *owner, Event<Bar&> proc, Point p);
static void Execute(Event<Bar&> proc, Point p) { Execute(GetActiveCtrl(), proc, p); }
static void Execute(Event<Bar&> proc) { Execute(proc, GetMousePos()); }
bool IsEmpty() const { return item.IsEmpty(); }
void Clear();
@ -496,8 +496,8 @@ public:
virtual void Paint(Draw& w);
protected:
virtual Item& AddItem(Callback cb);
virtual Item& AddSubMenu(Callback1<Bar&> proc);
virtual Item& AddItem(Event<> cb);
virtual Item& AddSubMenu(Event<Bar&> proc);
public:
struct Style : ChStyle<Style> {
@ -514,7 +514,7 @@ private:
int ii;
Array<ToolButton> item;
int lock;
Callback1<Bar&> proc;
Event<Bar&> proc;
const Style *style;
int arealook;
@ -535,8 +535,8 @@ public:
static int GetStdHeight();
void Clear();
void Set(Callback1<Bar&> bar);
void Post(Callback1<Bar&> bar);
void Set(Event<Bar&> bar);
void Post(Event<Bar&> bar);
static const Style& StyleDefault();
@ -571,14 +571,14 @@ public:
class LRUList {
Vector<String> lru;
int limit;
void Select(String s, Callback1<const String&> WhenSelect);
void Select(String s, Event<const String&> WhenSelect);
public:
static int GetStdHeight();
void Serialize(Stream& stream);
void operator()(Bar& bar, Callback1<const String&> WhenSelect);
void operator()(Bar& bar, Event<const String&> WhenSelect);
void NewEntry(const String& path);
void RemoveEntry(const String& path);

View file

@ -96,21 +96,21 @@ public:
MODE_ROWS
};
Callback WhenLeftClick;
Callback1<Point> WhenLeftClickPos;
Callback WhenLeftDouble;
Callback1<Bar&> WhenBar;
Callback WhenSel;
Event<> WhenLeftClick;
Event<Point> WhenLeftClickPos;
Event<> WhenLeftDouble;
Event<Bar&> WhenBar;
Event<> WhenSel;
Callback WhenDrag;
Callback2<int, PasteClip&> WhenDropItem;
Callback2<int, PasteClip&> WhenDropInsert;
Callback1<PasteClip&> WhenDrop;
Event<> WhenDrag;
Event<int, PasteClip&> WhenDropItem;
Event<int, PasteClip&> WhenDropInsert;
Event<PasteClip&> WhenDrop;
// depracated - use WhenSel
Callback WhenSelection;
Callback WhenEnterItem;
Callback WhenKillCursor;
// deprecated - use WhenSel
Event<> WhenSelection;
Event<> WhenEnterItem;
Event<> WhenKillCursor;
int GetColumnItems() const;
int GetColumnCx(int i = 0) const;

View file

@ -254,7 +254,7 @@ bool EditDateDlg(Date& d, const char *title, const char *label, Date min, Date m
return false;
}
Callback CtrlRetriever::operator<<=(Callback cb)
Event<> CtrlRetriever::operator<<=(Event<> cb)
{
for(int i = 0; i < item.GetCount(); i++) {
CtrlItem0 *m = dynamic_cast<CtrlItem0 *>(&item[i]);

View file

@ -31,16 +31,16 @@ void WindowsList();
void WindowsMenu(Bar& bar);
class DelayCallback : public Pte<DelayCallback> {
Callback target;
Event<> target;
int delay;
public:
void Invoke();
void operator<<=(Callback x) { target = x; }
void operator<<=(Event<> x) { target = x; }
void SetDelay(int ms) { delay = ms; }
Callback Get() { return callback(this, &DelayCallback::Invoke); }
Callback operator~() { return Get(); }
operator Callback() { return Get(); }
Event<> Get() { return callback(this, &DelayCallback::Invoke); }
Event<> operator~() { return Get(); }
operator Event<>() { return Get(); }
DelayCallback() { delay = 2000; }
~DelayCallback() { KillTimeCallback(this); }
@ -124,14 +124,14 @@ public:
virtual void BalloonHide();
virtual void BalloonTimeout();
Callback WhenLeftDown;
Callback WhenLeftUp;
Callback WhenLeftDouble;
Callback1<Bar&> WhenBar;
Callback WhenBalloonLeftDown;
Callback WhenBalloonShow;
Callback WhenBalloonHide;
Callback WhenBalloonTimeout;
Event<> WhenLeftDown;
Event<> WhenLeftUp;
Event<> WhenLeftDouble;
Event<Bar&> WhenBar;
Event<> WhenBalloonLeftDown;
Event<> WhenBalloonShow;
Event<> WhenBalloonHide;
Event<> WhenBalloonTimeout;
void Break() { EndLoop(0); }
void Run() { EventLoop(this); }
@ -181,10 +181,10 @@ public:
virtual void LeftUp();
virtual void LeftDouble();
Callback WhenLeftDown;
Callback WhenLeftUp;
Callback WhenLeftDouble;
Callback1<Bar&> WhenBar;
Event<> WhenLeftDown;
Event<> WhenLeftUp;
Event<> WhenLeftDouble;
Event<Bar&> WhenBar;
void Break();
void Run();
@ -260,14 +260,14 @@ public:
virtual void BalloonHide();
virtual void BalloonTimeout();
Callback WhenLeftDown;
Callback WhenLeftUp;
Callback WhenLeftDouble;
Callback1<Bar&> WhenBar;
Callback WhenBalloonLeftDown;
Callback WhenBalloonShow;
Callback WhenBalloonHide;
Callback WhenBalloonTimeout;
Event<> WhenLeftDown;
Event<> WhenLeftUp;
Event<> WhenLeftDouble;
Event<Bar&> WhenBar;
Event<> WhenBalloonLeftDown;
Event<> WhenBalloonShow;
Event<> WhenBalloonHide;
Event<> WhenBalloonTimeout;
void Show(bool b = true);
void Hide() { Show(false); }
@ -424,7 +424,7 @@ public:
void Retrieve();
Callback operator<<=(Callback cb);
Event<> operator<<=(Event<> cb);
};
template <class T>

View file

@ -1463,7 +1463,7 @@ void FlatSpin::SetTips(const char *tipl, const char *tipr)
right.Tip(tipr);
}
void FlatSpin::SetCallbacks(const Callback &cbl, const Callback& cbr)
void FlatSpin::SetCallbacks(const Event<>& cbl, const Event<>& cbr)
{
left.WhenAction = cbl;
right.WhenAction = cbr;

View file

@ -59,7 +59,7 @@ public:
FlatSpin();
void SetText(const String& s);
void SetTips(const char *tipl, const char *tipr);
void SetCallbacks(const Callback &cbl, const Callback& cbr);
void SetCallbacks(const Event<>& cbl, const Event<>& cbr);
FlatSpin& Selectable(bool b = true);
int GetWidth(const String& s, bool with_buttons = true);
@ -87,8 +87,8 @@ protected:
public:
PopUpCtrl() : popup(false) {}
Callback WhenPopDown;
Callback WhenDeactivate;
Event<> WhenPopDown;
Event<> WhenDeactivate;
virtual void Deactivate();
virtual Size ComputeSize() = 0;
virtual void Reset() {}
@ -208,8 +208,8 @@ private:
public:
Calendar();
Callback1<Time &> WhenTime;
Callback1<Date> WhenWeek;
Event<Time &> WhenTime;
Event<Date> WhenWeek;
static const Style& StyleDefault();
@ -246,7 +246,7 @@ public:
void PopUp(Ctrl *owner, Rect &rt);
Callback WhenSelect;
Event<> WhenSelect;
};
struct LineCtrl : Ctrl
@ -406,7 +406,7 @@ public:
Clock clock;
CalendarClock(int m = MODE_TIME);
Callback WhenPopDown;
Event<> WhenPopDown;
virtual void Deactivate();
virtual bool Key(dword key, int count);
@ -490,7 +490,7 @@ class DateTimeCtrl : public T {
}
if(WhenWeek)
cc.calendar.WhenWeek = Proxy(WhenWeek);
cc.calendar.WhenWeek = WhenWeek.Proxy();
else
cc.calendar.WhenWeek.Clear();
cc.PopUp(this, r);
@ -501,7 +501,7 @@ class DateTimeCtrl : public T {
public:
typedef DateTimeCtrl CLASSNAME;
Callback1<Date> WhenWeek;
Event<Date> WhenWeek;
DateTimeCtrl(int m) : cc(m) {
drop.AddTo(*this);
@ -512,7 +512,7 @@ public:
cc.calendar <<= THISBACK(OnCalendarChoice);
cc.clock <<= THISBACK(OnClockChoice);
cc.WhenPopDown = THISBACK(OnClose);
cc.calendar.WhenSelect = Proxy(WhenSelect);
cc.calendar.WhenSelect = WhenSelect.Proxy();
}
virtual void GotFocus() { T::GotFocus(); drop.RefreshFrame(); }
@ -532,7 +532,7 @@ public:
DateTimeCtrl& OneButton(bool b = true) { cc.calendar.OneButton(true); return *this; }
DateTimeCtrl& NoOneButton() { cc.calendar.OneButton(false); return *this; }
Callback WhenSelect;
Event<> WhenSelect;
};
class DropDate : public DateTimeCtrl<EditDate>

View file

@ -17,7 +17,7 @@ public:
virtual void LeftDouble(Point pt, dword keyflags);
virtual void MouseMove(Point pt, dword keyflags);
Callback WhenLeftDouble;
Event<> WhenLeftDouble;
private:
void SetColor(Color color, bool set_norm, bool set_hsv);
@ -84,7 +84,7 @@ public:
Ctrl& GetImplCtrl() { return impl->GetCtrl(); }
public:
Callback WhenSetColor;
Event<> WhenSetColor;
public:
class Impl
@ -183,8 +183,8 @@ private:
friend void ColorPopUp_InitHint();
public:
Callback WhenCancel;
Callback WhenSelect;
Event<> WhenCancel;
Event<> WhenSelect;
static void Hint(Color c);

View file

@ -28,8 +28,8 @@ public:
void PopUp(Ctrl *owner, int width);
void PopUp(Ctrl *owner);
Callback WhenCancel;
Callback WhenSelect;
Event<> WhenCancel;
Event<> WhenSelect;
PopUpTable& SetDropLines(int _droplines) { droplines = _droplines; return *this; }
@ -72,7 +72,7 @@ private:
public:
typedef MultiButton::Style Style;
Callback WhenDrop;
Event<> WhenDrop;
DropList& Add(const Value& key, const Value& value, bool enable = true);
DropList& Add(const Value& value) { return Add(value, value); }
@ -173,8 +173,8 @@ protected:
typedef DropChoice CLASSNAME;
public:
Callback WhenDrop;
Callback WhenSelect;
Event<> WhenDrop;
Event<> WhenSelect;
bool DoKey(dword key);
void DoWheel(int zdelta);
@ -236,8 +236,8 @@ protected:
void DoWhenDrop() { WhenDrop(); }
public:
Callback WhenDrop;
Callback WhenSelect;
Event<> WhenDrop;
Event<> WhenSelect;
void ClearList() { select.Clear(); }
void AddList(const Value& data) { select.Add(data); }

View file

@ -168,10 +168,10 @@ protected:
virtual void HighlightText(Vector<Highlight>& hl);
public:
Callback1<Bar&> WhenBar;
Callback WhenEnter;
Callback1<WString&> WhenPasteFilter;
Callback1<Vector<Highlight>&> WhenHighlight;
Event<Bar&> WhenBar;
Event<> WhenEnter;
Event<WString&> WhenPasteFilter;
Event<Vector<Highlight>&> WhenHighlight;
static const Style& StyleDefault();
EditField& SetStyle(const Style& s);

View file

@ -465,7 +465,7 @@ bool MatchSearch(const String& filename, const String& search)
}
bool Load(FileList& list, const String& dir, const char *patterns, bool dirs,
Callback3<bool, const String&, Image&> WhenIcon, FileSystemInfo& filesystem,
Event<bool, const String&, Image&> WhenIcon, FileSystemInfo& filesystem,
const String& search, bool hidden, bool hiddenfiles, bool lazyicons)
{
if(dir.IsEmpty()) {
@ -648,7 +648,7 @@ void LazyExeFileIcons::ReOrder()
Restart(0);
}
void LazyExeFileIcons::Start(FileList& list_, const String& dir_, Callback3<bool, const String&, Image&> WhenIcon_)
void LazyExeFileIcons::Start(FileList& list_, const String& dir_, Event<bool, const String&, Image&> WhenIcon_)
{
list = &list_;
dir = dir_;

View file

@ -72,7 +72,7 @@ protected:
};
public:
Callback2<const String&, const String&> WhenRename;
Event<const String&, const String&> WhenRename;
void StartEdit();
void EndEdit();
@ -121,7 +121,7 @@ public:
};
bool Load(FileList& list, const String& dir, const char *patterns, bool dirs = false,
Callback3<bool, const String&, Image&> WhenIcon = CNULL,
Event<bool, const String&, Image&> WhenIcon = Null,
FileSystemInfo& filesystem = StdFileSystemInfo(), const String& search = String(),
bool hidden = true, bool hiddenfiles = true, bool lazyicons = false);
void SortByName(FileList& list);
@ -135,7 +135,7 @@ class LazyExeFileIcons {
FileList *list;
int pos;
Vector<int> ndx;
Callback3<bool, const String&, Image&> WhenIcon;
Event<bool, const String&, Image&> WhenIcon;
Mutex mutex;
@ -146,7 +146,7 @@ class LazyExeFileIcons {
public:
void ReOrder();
void Start(FileList& list_, const String& dir_, Callback3<bool, const String&, Image&> WhenIcon_);
void Start(FileList& list_, const String& dir_, Event<bool, const String&, Image&> WhenIcon_);
};
#endif
@ -258,7 +258,7 @@ protected:
typedef FileSel CLASSNAME;
public:
Callback3<bool, const String&, Image&> WhenIcon;
Event<bool, const String&, Image&> WhenIcon;
#ifdef _MULTITHREADED
void (*WhenIconLazy)(const String& path, Image& result);
#endif

View file

@ -44,10 +44,10 @@ public:
friend class HeaderCtrl;
public:
Callback WhenLeftClick;
Callback WhenLeftDouble;
Callback WhenAction;
Callback1<Bar&> WhenBar;
Event<> WhenLeftClick;
Event<> WhenLeftDouble;
Event<> WhenAction;
Event<Bar&> WhenBar;
Column& Min(int _min) { min = _min; return *this; }
Column& Max(int _max) { max = _max; return *this; }
@ -116,9 +116,9 @@ protected:
Vector<int> GetVisibleCi(int from);
public:
Callback WhenLayout;
Callback WhenScroll;
Callback WhenScrollVisibility;
Event<> WhenLayout;
Event<> WhenScroll;
Event<> WhenScrollVisibility;
Rect GetTabRect(int i);

View file

@ -111,7 +111,7 @@ void MenuBar::Clear()
lock--;
}
Bar::Item& MenuBar::AddItem(Callback cb)
Bar::Item& MenuBar::AddItem(Event<> cb)
{
LLOG("MenuBar::AddItem " << Name());
MenuItemBase *q;
@ -131,7 +131,7 @@ Bar::Item& MenuBar::AddItem(Callback cb)
return *q;
}
Bar::Item& MenuBar::AddSubMenu(Callback1<Bar&> proc)
Bar::Item& MenuBar::AddSubMenu(Event<Bar&> proc)
{
LLOG("MenuBar::AddSubMenu " << Name());
SubMenuBase *w;
@ -248,7 +248,7 @@ void MenuBar::SyncState()
void MenuBar::ChildGotFocus()
{
if(submenu && !submenuitem->HasFocusDeep() && !ExistsTimeCallback()) {
if(submenu->IsOpen())
if(submenu->IsOpen())
submenu->DelayedClose();
}
KillDelayedClose();
@ -469,7 +469,7 @@ void MenuBar::KillDelayedClose()
KillTimeCallback(TIMEID_STOP);
}
void MenuBar::Set(const Callback1<Bar&> menu)
void MenuBar::Set(const Event<Bar&> menu)
{
if(lock) return;
Clear();
@ -480,7 +480,7 @@ void MenuBar::Set(const Callback1<Bar&> menu)
lock--;
}
void MenuBar::Post(Callback1<Bar&> bar)
void MenuBar::Post(Event<Bar&> bar)
{
KillTimeCallback(TIMEID_POST);
SetTimeCallback(0, THISBACK1(Set, bar), TIMEID_POST);
@ -580,7 +580,7 @@ void MenuBar::Execute(Ctrl *owner, Point p)
ows.SetCount(level);
}
void MenuBar::Execute(Ctrl *owner, Callback1<Bar&> proc, Point p)
void MenuBar::Execute(Ctrl *owner, Event<Bar&> proc, Point p)
{
MenuBar bar;
proc(bar);

View file

@ -100,7 +100,7 @@ public:
class SubMenuBase {
protected:
MenuBar menu;
Callback1<Bar&> proc;
Event<Bar&> proc;
MenuBar *parentmenu;
void Pull(Ctrl *item, Point p, Size sz);
@ -109,8 +109,8 @@ public:
virtual void Pull() = 0;
void SetParent(MenuBar *m) { parentmenu = m; menu.MaxIconSize(m->GetMaxIconSize()); }
void Set(Callback1<Bar&> _submenu) { proc = _submenu; }
Callback1<Bar&> Get() { return proc; }
void Set(Event<Bar&> _submenu) { proc = _submenu; }
Event<Bar&> Get() { return proc; }
SubMenuBase() { parentmenu = NULL; }
virtual ~SubMenuBase() {}

View file

@ -61,8 +61,8 @@ public:
void Refresh();
public:
Callback WhenPush;
Callback WhenClick;
Event<> WhenPush;
Event<> WhenClick;
SubButton& SetImage(const Image& m);
SubButton& SetMonoImage(const Image& m);
@ -75,7 +75,7 @@ public:
SubButton& Tip(const char *s) { tip = s; return *this; }
SubButton& Main(bool b = true);
Callback operator<<=(Callback cb) { WhenPush = cb; return cb; }
Event<> operator<<=(Event<> cb) { WhenPush = cb; return cb; }
SubButton();
};
@ -124,8 +124,8 @@ private:
friend class MultiButtonFrame;
public:
Callback WhenPush;
Callback WhenClick;
Event<> WhenPush;
Event<> WhenClick;
static const Style& StyleDefault();
static const Style& StyleFrame();

View file

@ -50,7 +50,7 @@ void RedirectPrompts(RedirectPromptFn r)
RedirectPrompt = r;
}
int Prompt(Callback1<const String&> WhenLink,
int Prompt(Event<const String&> WhenLink,
const char *title, const Image& iconbmp, const char *qtf, bool okcancel,
const char *button1, const char *button2, const char *button3,
int cx,
@ -140,7 +140,7 @@ int Prompt(Callback1<const String&> WhenLink,
return result;
}
int Prompt(Callback1<const String&> WhenLink,
int Prompt(Event<const String&> WhenLink,
const char *title, const Image& icon, const char *qtf, bool okcancel,
const char *button1, const char *button2, const char *button3,
int cx)

View file

@ -51,8 +51,8 @@ public:
int GetVisualState() const;
Callback WhenPush;
Callback WhenRepeat;
Event<> WhenPush;
Event<> WhenRepeat;
Pusher();
virtual ~Pusher();
@ -359,7 +359,7 @@ protected:
virtual void DoAction();
public:
Callback WhenPreAction;
Event<> WhenPreAction;
DataPusher& SetConvert(const Convert& _convert) { convert = &_convert; Refresh(); return *this; }

View file

@ -50,8 +50,8 @@ protected:
};
public:
Callback1<const String&> WhenLink;
Callback1<int> WhenMouseMove;
Event<const String&> WhenLink;
Event<int> WhenMouseMove;
void Clear();
void Pick(RichText&& t);
@ -125,13 +125,13 @@ public:
};
int Prompt(Callback1<const String&> WhenLink,
int Prompt(Event<const String&> WhenLink,
const char *title, const Image& iconbmp, const char *qtf, bool okcancel,
const char *button1, const char *button2, const char *button3,
int cx,
Image im1, Image im2, Image im3);
int Prompt(Callback1<const String&> WhenLink,
int Prompt(Event<const String&> WhenLink,
const char *title, const Image& icon, const char *qtf, bool okcancel,
const char *button1, const char *button2 = NULL, const char *button3 = NULL,
int cx = 0);
@ -173,7 +173,7 @@ void RetryButtonImage_Write(Image m);
typedef
int (*RedirectPromptFn)(Callback1<const String&> WhenLink,
int (*RedirectPromptFn)(Event<const String&> WhenLink,
const char *title, const Image& iconbmp, const char *qtf, bool okcancel,
const char *button1, const char *button2, const char *button3,
int cx, Image im1, Image im2, Image im3);

View file

@ -65,9 +65,9 @@ private:
int ScrollBarSize() const { return style->barsize; }
public:
Callback WhenScroll;
Callback WhenVisibility;
Callback WhenLeftClick;
Event<> WhenScroll;
Event<> WhenVisibility;
Event<> WhenLeftClick;
bool IsHorz() const { return horz; }
bool IsVert() const { return !horz; }
@ -178,8 +178,8 @@ public:
HScrollBar x;
VScrollBar y;
Callback WhenScroll;
Callback WhenLeftClick;
Event<> WhenScroll;
Event<> WhenLeftClick;
void Set(Point pos, Size page, Size total);
bool Set(Point pos);

View file

@ -16,7 +16,7 @@ class SliderCtrl : public Ctrl {
public:
typedef SliderCtrl CLASSNAME;
Callback WhenSlideFinish;
Event<> WhenSlideFinish;
SliderCtrl();
virtual ~SliderCtrl();

View file

@ -34,7 +34,7 @@ protected: // Because of docking... (will be private)
friend class SplitterFrame;
public:
Callback WhenSplitFinish;
Event<> WhenSplitFinish;
void Set(Ctrl& l, Ctrl& r);

View file

@ -72,9 +72,9 @@ private:
public:
void operator=(const String& s) { Set(s); }
operator Callback1<const String&>() { return pteback(this, &StatusBar::SetText); }
operator Event<const String&>() { return pteback(this, &StatusBar::SetText); }
Callback1<const String&> operator~() { return pteback(this, &StatusBar::SetText); }
Event<const String&> operator~() { return pteback(this, &StatusBar::SetText); }
StatusBar& Height(int _cy);
StatusBar& NoSizeGrip() { RemoveFrame(grip); return *this; }

View file

@ -96,7 +96,7 @@ private:
int FindInsert(Ctrl& slave);
public:
Callback WhenSet;
Event<> WhenSet;
TabCtrl::Item& Add();
TabCtrl::Item& Add(const char *text);

View file

@ -105,9 +105,9 @@ protected:
public:
virtual void RefreshLine(int i);
Callback1<Bar&> WhenBar;
Callback WhenState;
Callback WhenSel;
Event<Bar&> WhenBar;
Event<> WhenState;
Event<> WhenSel;
void CachePos(int pos);
void CacheLinePos(int linei);

View file

@ -52,7 +52,7 @@ void ToolBar::Paint(Draw& w)
PaintBar(w, style->breaksep, look);
}
Bar::Item& ToolBar::AddItem(Callback cb)
Bar::Item& ToolBar::AddItem(Event<> cb)
{
ToolButton& m = item.DoIndex(ii++);
m.ResetKeepStyle();
@ -66,7 +66,7 @@ Bar::Item& ToolBar::AddItem(Callback cb)
return m;
}
Bar::Item& ToolBar::AddSubMenu(Callback1<Bar&> proc)
Bar::Item& ToolBar::AddSubMenu(Event<Bar&> proc)
{
if(item.GetCount())
Separator();
@ -85,7 +85,7 @@ bool ToolBar::HotKey(dword key)
return Bar::Scan(proc, key) || Ctrl::HotKey(key);
}
void ToolBar::Set(Callback1<Bar&> bar)
void ToolBar::Set(Event<Bar&> bar)
{
LTIMING("SetToolBar");
if(lock) return;
@ -102,7 +102,7 @@ void ToolBar::Set(Callback1<Bar&> bar)
lock--;
}
void ToolBar::Post(Callback1<Bar&> bar)
void ToolBar::Post(Event<Bar&> bar)
{
KillTimeCallback(TIMEID_POST);
SetTimeCallback(0, PTEBACK1(Set, bar), TIMEID_POST);

View file

@ -168,21 +168,21 @@ protected:
friend class PopUpTree;
public:
Callback1<int> WhenOpen;
Callback1<int> WhenClose;
Callback WhenLeftClick;
Callback WhenLeftDouble;
Callback1<Bar&> WhenBar;
Callback WhenSel;
Event<int> WhenOpen;
Event<int> WhenClose;
Event<> WhenLeftClick;
Event<> WhenLeftDouble;
Event<Bar&> WhenBar;
Event<> WhenSel;
Callback WhenDrag;
Callback2<int, PasteClip&> WhenDropItem;
Callback3<int, int, PasteClip&> WhenDropInsert;
Callback1<PasteClip&> WhenDrop;
Event<> WhenDrag;
Event<int, PasteClip&> WhenDropItem;
Event<int, int, PasteClip&> WhenDropInsert;
Event<PasteClip&> WhenDrop;
// deprecated - use WhenSel
Callback WhenCursor;
Callback WhenSelection;
Event<> WhenCursor;
Event<> WhenSelection;
void SetRoot(const Node& n);
void SetRoot(const Image& img, Value v);
@ -341,7 +341,7 @@ protected:
virtual void SetChildren(int id, bool b);
public:
Callback WhenOption;
Event<> WhenOption;
void SetRoot(const Image& img, Option& option, const char *text = NULL);
void SetRoot(Option& option, const char *text = NULL);
@ -398,8 +398,8 @@ public:
void PopUp(Ctrl *owner, int width);
void PopUp(Ctrl *owner);
Callback WhenCancel;
Callback WhenSelect;
Event<> WhenCancel;
Event<> WhenSelect;
PopUpTree& MaxHeight(int maxheight_) { maxheight = maxheight_; return *this; }
int GetMaxHeight() const { return maxheight; }
@ -430,7 +430,7 @@ private:
typedef DropTree CLASSNAME;
public:
Callback WhenDrop;
Event<> WhenDrop;
void Clear();

View file

@ -2754,33 +2754,17 @@ editing.&]
[s7; [*/ Return value]-|[* `*this]&]
[s3; &]
[s4; &]
[s5;:ArrayCtrl`:`:Column`:`:Ctrls`(Callback1`<One`<Ctrl`>`&`>`): [_^ArrayCtrl`:`:Column^ C
olumn][@(0.0.255) `&]_[* Ctrls]([_^Callback1^ Callback1]<[_^One^ One]<[_^Ctrl^ Ctrl]>`&>_[*@3 f
actory])&]
[s2; The methods sets up a factory which the ArrayCtrl uses as necessary
to create new Ctrl`'s for editing a given column. The argument
of this function is a callback, which, upon execution, should
allocate (normally using the [* new] operator) the desired editor
object and set it to its argument. If the position of Ctrl is
equivalent to `'SetRect(0, 0, 0, 0)`', which is the default value,
Ctrl is resized to fit the ArrayCtrl cell accurately, spanning
the whole width and using STDSIZE for height, otherwise the position
represents the position within the cell.&]
[s7; [*C@3 factory]-|callback used for new control creation&]
[s7; [*/ Return value]-|[* `*this]&]
[s3; &]
[s4; &]
[s5;:ArrayCtrl`:`:Column`:`:Ctrls`(void`(`*`)`(One`<Ctrl`>`&`)`): [_^ArrayCtrl`:`:Column^ C
olumn][@(0.0.255) `&]_[* Ctrls]([@(0.0.255) void]_(`*[*@3 factory])(One<Ctrl>`&))&]
[s2; This method sets up a factory which the ArrayCtrl uses as necessary
to create new Ctrl`'s for editing a given column. The argument,
a global function, is supposed to allocate a new editor control
(normally using the [* new] operator) and set it to its argument.
If the position of Ctrl is equivalent to `'SetRect(0, 0, 0, 0)`',
which is the default value, Ctrl is resized to fit the ArrayCtrl
cell accurately, spanning the whole width and using STDSIZE for
height, otherwise the position represents the position within
the cell.&]
[s2; The methods sets up a factory which the ArrayCtrl uses as necessary
to create new Ctrl`'s for editing a given column. The argument
of this function is a function pointer, which, upon execution,
should allocate (normally using the One`::Create method) the desired
editor object and set it to its argument. If the position of
Ctrl is equivalent to `'SetRect(0, 0, 0, 0)`', which is the default
value, Ctrl is resized to fit the ArrayCtrl cell accurately,
spanning the whole width and using STDSIZE for height, otherwise
the position represents the position within the cell.&]
[s7; [*C@3 factory]-|a global function used for editor control creation&]
[s7; [*/ Return value]-|[* `*this]&]
[s3; &]
@ -2798,6 +2782,20 @@ the position represents the position within the cell.&]
[s7; [*C@4 T]-|the desired object editor type &]
[s7; [*/ Return value]-|[* `*this]&]
[s3; &]
[s4;%- &]
[s5;:Upp`:`:ArrayCtrl`:`:Column`:`:Ctrls`(Upp`:`:Event`<int`,Upp`:`:One`<Upp`:`:Ctrl`>`&`>`):%- [_^Upp`:`:ArrayCtrl`:`:Column^ C
olumn][@(0.0.255) `&]_[* Ctrls]([_^Upp`:`:Event^ Event]<[@(0.0.255) int],
[_^Upp`:`:One^ One]<[_^Upp`:`:Ctrl^ Ctrl]>`&>_[*@3 factory])&]
[s2; This method sets up a factory which the ArrayCtrl uses to create
new Ctrl`'s for editing a given column. The argument, a global
function, is supposed to allocate a new editor control (normally
using the One`::Create method) and set it to its argument. The
first argument of Event is the line index. If the position of
Ctrl is equivalent to `'SetRect(0, 0, 0, 0)`', which is the default
value, Ctrl is resized to fit the ArrayCtrl cell accurately,
spanning the whole width and using STDSIZE for height, otherwise
the position represents the position within the cell..&]
[s3; &]
[s4; &]
[s5;:ArrayCtrl`:`:Column`:`:InsertValue`(const Value`&`): [_^ArrayCtrl`:`:Column^ Colum
n][@(0.0.255) `&]_[* InsertValue]([@(0.0.255) const]_[_^Value^ Value][@(0.0.255) `&]_[*@3 v])

File diff suppressed because one or more lines are too long

View file

@ -92,8 +92,8 @@ public:
EscLambda& CreateLambda();
void Escape(const char *method, Callback1<EscEscape&> escape);
void Escape(const char *method, EscHandle *h, Callback1<EscEscape&> escape);
void Escape(const char *method, Event<EscEscape&> escape);
void Escape(const char *method, EscHandle *h, Event<EscEscape&> escape);
bool HasNumberField(const char *id) const;
int GetFieldInt(const char *id) const;
@ -158,7 +158,7 @@ public:
Vector<bool> inout;
String code;
EscHandle *handle;
Callback1<EscEscape&> escape;
Event<EscEscape&> escape;
bool varargs;
String filename;
int line;
@ -291,7 +291,7 @@ struct EscEscape {
};
void Escape(ArrayMap<String, EscValue>& globals, const char *function, void (*escape)(EscEscape& e));
void Escape(ArrayMap<String, EscValue>& globals, const char *function, Callback1<EscEscape&> escape);
void Escape(ArrayMap<String, EscValue>& globals, const char *function, Event<EscEscape&> escape);
void Scan(ArrayMap<String, EscValue>& global, const char *code, const char *filename = "");

View file

@ -118,7 +118,7 @@ void EscEscape::CheckMap(int i)
ThrowError(String().Cat() << "map expected as parameter " << i + 1 << InCall());
}
void Escape(ArrayMap<String, EscValue>& globals, const char *function, Callback1<EscEscape&> escape)
void Escape(ArrayMap<String, EscValue>& globals, const char *function, Event<EscEscape&> escape)
{
CParser p(function);
EscValue& v = globals.GetPut(p.ReadId());
@ -132,7 +132,7 @@ void Escape(ArrayMap<String, EscValue>& globals, const char *function, void (*es
Escape(globals, function, callback(escape));
}
void EscValue::Escape(const char *method, Callback1<EscEscape&> escape)
void EscValue::Escape(const char *method, Event<EscEscape&> escape)
{
CParser p(method);
String id = p.ReadId();
@ -143,7 +143,7 @@ void EscValue::Escape(const char *method, Callback1<EscEscape&> escape)
MapSet(id, v);
}
void EscValue::Escape(const char *method, EscHandle *h, Callback1<EscEscape&> escape)
void EscValue::Escape(const char *method, EscHandle *h, Event<EscEscape&> escape)
{
CParser p(method);
String id = p.ReadId();

View file

@ -64,8 +64,8 @@ private:
public:
virtual int Byte(int64 adr);
Callback1<Bar&> WhenBar;
Callback1<const String&> WhenGoto;
Event<Bar&> WhenBar;
Event<const String&> WhenGoto;
void ColumnsMenu(Bar& bar);
void CharsetMenu(Bar& bar);

View file

@ -434,13 +434,13 @@ protected:
virtual void BeginOnPathOp(double q, bool abs);
};
bool RenderSVG(Painter& p, const char *svg, Callback2<String, String&> resloader);
bool RenderSVG(Painter& p, const char *svg, Event<String, String&> resloader);
bool RenderSVG(Painter& p, const char *svg);
void GetSVGDimensions(const char *svg, Sizef& sz, Rectf& viewbox);
Rectf GetSVGBoundingBox(const char *svg);
Image RenderSVGImage(Size sz, const char *svg, Callback2<String, String&> resloader);
Image RenderSVGImage(Size sz, const char *svg, Event<String, String&> resloader);
Image RenderSVGImage(Size sz, const char *svg);
}

View file

@ -123,7 +123,7 @@ struct SvgParser : XmlParser {
bool Parse();
Callback2<String, String&> resloader;
Event<String, String&> resloader;
SvgParser(const char *svg, Painter& sw);
};

View file

@ -443,7 +443,7 @@ SvgParser::SvgParser(const char *svg, Painter& sw)
Reset();
}
bool ParseSVG(Painter& p, const char *svg, Callback2<String, String&> resloader, Rectf *boundingbox)
bool ParseSVG(Painter& p, const char *svg, Event<String, String&> resloader, Rectf *boundingbox)
{
SvgParser sp(svg, p);
sp.bp.compute_svg_boundingbox = boundingbox;
@ -455,14 +455,14 @@ bool ParseSVG(Painter& p, const char *svg, Callback2<String, String&> resloader,
return true;
}
bool RenderSVG(Painter& p, const char *svg, Callback2<String, String&> resloader)
bool RenderSVG(Painter& p, const char *svg, Event<String, String&> resloader)
{
return ParseSVG(p, svg, resloader, NULL);
}
bool RenderSVG(Painter& p, const char *svg)
{
return RenderSVG(p, svg, Callback2<String, String&>());
return RenderSVG(p, svg, Event<String, String&>());
}
void GetSVGDimensions(const char *svg, Sizef& sz, Rectf& viewbox)
@ -485,12 +485,12 @@ Rectf GetSVGBoundingBox(const char *svg)
{
NilPainter nil;
Rectf bb;
if(!ParseSVG(nil, svg, Callback2<String, String&>(), &bb))
if(!ParseSVG(nil, svg, Event<String, String&>(), &bb))
return Null;
return bb;
}
Image RenderSVGImage(Size sz, const char *svg, Callback2<String, String&> resloader)
Image RenderSVGImage(Size sz, const char *svg, Event<String, String&> resloader)
{
Rectf f = GetSVGBoundingBox(svg);
Sizef iszf = GetFitSize(f.GetSize(), Sizef(sz.cx, sz.cy) - 10.0);
@ -508,7 +508,7 @@ Image RenderSVGImage(Size sz, const char *svg, Callback2<String, String&> resloa
Image RenderSVGImage(Size sz, const char *svg)
{
return RenderSVGImage(sz, svg, Callback2<String, String&>());
return RenderSVGImage(sz, svg, Event<String, String&>());
}
}

View file

@ -49,12 +49,12 @@ private:
int newtabalign;
public:
Callback WhenLeftDouble;
Callback WhenLeftDown;
Callback WhenRightDown;
Callback WhenBeginTrack;
Callback WhenTrack;
Callback WhenEndTrack;
Event<> WhenLeftDouble;
Event<> WhenLeftDown;
Event<> WhenRightDown;
Event<> WhenBeginTrack;
Event<> WhenTrack;
Event<> WhenEndTrack;
void SetLayout(int x, int pgcx, Zoom zoom, double grid,
int numbers = INT_MAX, double numbermul = 1, int marks = INT_MAX,
@ -636,7 +636,7 @@ private:
};
void UserAction();
Callback User(Callback cb);
Event<> User(Event<> cb);
static void SpellerAdd(const WString& w, int lang);
static int CompareStyle(const Value& a, const Value& b);
@ -661,12 +661,12 @@ public:
static Bits SpellParagraph(const RichPara& p);
static void FixedLang(int lang) { fixedlang = lang; }
Callback WhenRefreshBar;
Callback WhenStartEvaluating;
Callback2<String&, WString&> WhenHyperlink;
Callback1<String&> WhenLabel;
Callback1<String&> WhenIndexEntry;
Callback1<Bar&> WhenBar;
Event<> WhenRefreshBar;
Event<> WhenStartEvaluating;
Event<String&, WString&> WhenHyperlink;
Event<String&> WhenLabel;
Event<String&> WhenIndexEntry;
Event<Bar&> WhenBar;
void StdBar(Bar& menu);

View file

@ -7,7 +7,7 @@ void RichEdit::UserAction()
useraction = true;
}
Callback RichEdit::User(Callback cb)
Event<> RichEdit::User(Event<> cb)
{
cb << THISBACK(UserAction);
return cb;

View file

@ -93,7 +93,7 @@ class TabScrollBar : public AlignedFrame
void Clear();
void Set(const TabScrollBar& t);
bool IsScrollable() const;
Callback WhenScroll;
Event<> WhenScroll;
};
class TabBar : public AlignedFrame
@ -407,14 +407,14 @@ protected:
public:
typedef TabBar CLASSNAME;
Callback WhenHighlight; // Executed on tab mouse-over
Callback WhenLeftDouble; // Executed on left-button double-click (clicked tab will be the active tab)
Event<> WhenHighlight; // Executed on tab mouse-over
Event<> WhenLeftDouble; // Executed on left-button double-click (clicked tab will be the active tab)
Gate1<Value> CancelClose; // Return true to cancel action. Parameter: Key of closed tab
Callback1<Value> WhenClose; // Executed before tab closing. Parameter: Key of closed tab
Gate CancelCloseAll; // Return true to cancel action;
Callback WhenCloseAll; // Executed before 'Close All' action
Event<Value> WhenClose; // Executed before tab closing. Parameter: Key of closed tab
Gate<> CancelCloseAll; // Return true to cancel action;
Event<> WhenCloseAll; // Executed before 'Close All' action
Gate1<ValueArray> CancelCloseSome; // Return true to cancel action (executed with list of closing tabs)
Callback1<ValueArray> WhenCloseSome; // Executed before any 'Close' action (with list of closing tabs)
Event<ValueArray> WhenCloseSome; // Executed before any 'Close' action (with list of closing tabs)
TabBar();
TabBar& CopyBaseSettings(const TabBar& src);

View file

@ -120,7 +120,7 @@ void DiffDlg::Write()
}
}
Callback3<const String&, Vector<LineEdit::Highlight>&, const WString&> DiffDlg::WhenHighlight;
Event<const String&, Vector<LineEdit::Highlight>&, const WString&> DiffDlg::WhenHighlight;
static void sDoHighlight(Vector<LineEdit::Highlight>& hl, const WString& ln, const String *path)
{

View file

@ -79,9 +79,9 @@ private:
typedef TextCompareCtrl CLASSNAME;
public:
Callback WhenScroll;
Callback1<int> WhenLeftDouble;
Callback2<Vector<LineEdit::Highlight>&, const WString&> WhenHighlight;
Event<> WhenScroll;
Event<int> WhenLeftDouble;
Event<Vector<LineEdit::Highlight>&, const WString&> WhenHighlight;
void SetCount(int c);
void AddCount(int c);
@ -118,7 +118,7 @@ public:
void ClearSelection() { cursor = Null; Refresh(); }
void SetSelection(int l, int h) { cursor = l; anchor = h; }
Callback ScrollWhen(TextCompareCtrl& pair) { return THISBACK1(PairScroll, &pair); }
Event<> ScrollWhen(TextCompareCtrl& pair) { return THISBACK1(PairScroll, &pair); }
TextCompareCtrl();
};
@ -136,8 +136,8 @@ struct TextDiffCtrl : public Splitter {
void SetFont(Font f, Font nf) { left.SetFont(f, nf); right.SetFont(f, nf); }
void SetFont(Font f) { left.SetFont(f); right.SetFont(f); }
Callback1<int> WhenLeftLine;
Callback1<int> WhenRightLine;
Event<int> WhenLeftLine;
Event<int> WhenRightLine;
TextDiffCtrl();
};
@ -155,7 +155,7 @@ struct DiffDlg : public TopWindow {
void Write();
void Execute(const String& f);
static Callback3<const String&, Vector<LineEdit::Highlight>&, const WString&> WhenHighlight;
static Event<const String&, Vector<LineEdit::Highlight>&, const WString&> WhenHighlight;
DiffDlg();
};

View file

@ -246,7 +246,7 @@ struct AssistEditor : CodeEditor, Navigator {
void SyncNavigator();
void SerializeNavigator(Stream& s);
Callback1<int> WhenFontScroll;
Event<int> WhenFontScroll;
typedef AssistEditor CLASSNAME;

View file

@ -333,7 +333,7 @@ void UpdateCodeBase(Progress& pi)
UpdateCodeBase2(pi);
}
void ParseSrc(Stream& in, int file, Callback2<int, const String&> error)
void ParseSrc(Stream& in, int file, Event<int, const String&> error)
{
String path = GetSourceFilePath(file);
CLOG("====== Parse " << file << ": " << path);

View file

@ -31,7 +31,7 @@ struct SourceFileInfo {
};
void NewCodeBase();
void ParseSrc(Stream& in, int file, Callback2<int, const String&> error);
void ParseSrc(Stream& in, int file, Event<int, const String&> error);
void CodeBaseScanFile(Stream& in, const String& fn);
void CodeBaseScanFile(const String& fn, bool auto_check);
void ClearCodeBase();
@ -143,8 +143,8 @@ struct CodeBrowser {
int range;
ButtonOption rangebutton[3];
ButtonOption sort;
Callback WhenKeyItem;
Callback WhenClear;
Event<> WhenKeyItem;
Event<> WhenClear;
String GetPm();
void Load();
@ -349,7 +349,7 @@ protected:
void FixTopic();
public:
Callback1<Bar&> WhenTemplatesMenu;
Event<Bar&> WhenTemplatesMenu;
enum {
TIMEID_AUTOSAVE = Ctrl::TIMEID_COUNT,

View file

@ -14,17 +14,17 @@ file
Iml.cpp,
Sch.cpp,
Util.cpp,
Base.cpp optimize_speed,
Base.cpp,
Item.cpp,
ItemDisplay.cpp,
CodeBrowser.cpp optimize_speed,
CodeBrowser.cpp,
Browser.lay,
Browser.iml,
todo.txt,
Topic readonly separator,
TopicBase.cpp,
Reference.cpp,
File.cpp optimize_speed,
File.cpp,
Topic.cpp,
Template.cpp,
Link.cpp,

View file

@ -23,7 +23,7 @@ TopicLinkDlg::TopicLinkDlg()
const Workspace& wspc = GetIdeWorkspace();
for(int i = 0; i < wspc.GetCount(); i++)
package.Add(wspc[i]);
insert <<= Breaker(IDYES);
insert << Breaker(IDYES);
}
String TopicLinkDlg::PackageGroup(const char *name)

View file

@ -262,7 +262,7 @@ struct OneFileHost : Host {
virtual bool Run(const char *cmdline, Stream& out, int slot, String key, int blitz_count) { return host->Run(cmdline, out, slot, key, blitz_count); }
virtual bool Wait() { return host->Wait(); }
virtual bool Wait(int slot) { return host->Wait(slot); }
virtual void OnFinish(Callback cb) { return host->OnFinish(cb); }
virtual void OnFinish(Event<> cb) { return host->OnFinish(cb); }
virtual One<AProcess> StartProcess(const char *c) { return host->StartProcess(c); }
virtual void Launch(const char *cmdline, bool) { host->Launch(cmdline); }
virtual void AddFlags(Index<String>& cfg) { host->AddFlags(cfg); }

View file

@ -31,7 +31,7 @@ struct CppBuilder : Builder {
bool Run(const char *cmdline, Stream& out, int slot, String key, int blitz_count);
bool Wait();
bool Wait(int slot);
void OnFinish(Callback cb);
void OnFinish(Event<> cb);
bool Cp(const String& cmd, const String& package, bool& error);
bool Cd(const String& cmd);
Vector<String> CustomStep(const String& path, const String& package, bool& error);

View file

@ -124,7 +124,7 @@ bool CppBuilder::Wait(int slot)
return host->Wait(slot);
}
void CppBuilder::OnFinish(Callback cb)
void CppBuilder::OnFinish(Event<> cb)
{
host->OnFinish(cb);
}

View file

@ -77,7 +77,7 @@ enum {
};
void RegisterWorkspaceConfig(const char *name);
void RegisterWorkspaceConfig(const char *name, Callback WhenFlush);
void RegisterWorkspaceConfig(const char *name, Event<> WhenFlush);
String& WorkspaceConfigData(const char *name);
template <class T>

View file

@ -78,9 +78,9 @@ VectorMap<String, String>& sWorkspaceCfg()
return h;
}
Vector<Callback>& sWorkspaceCfgFlush()
Vector<Event<> >& sWorkspaceCfgFlush()
{
static Vector<Callback> h;
static Vector<Event<> > h;
return h;
}
@ -90,7 +90,7 @@ void RegisterWorkspaceConfig(const char *name)
sWorkspaceCfg().Add(name);
}
void RegisterWorkspaceConfig(const char *name, Callback WhenFlush)
void RegisterWorkspaceConfig(const char *name, Event<> WhenFlush)
{
RegisterWorkspaceConfig(name);
sWorkspaceCfgFlush().Add(WhenFlush);

View file

@ -257,7 +257,7 @@ bool Console::Run(One<AProcess> pick_ process, const char *cmdline, Stream *out,
return true;
}
void Console::OnFinish(Callback cb)
void Console::OnFinish(Event<> cb)
{
Finisher& f = finisher.Add();
f.serial = serial;

View file

@ -210,7 +210,7 @@ bool IdeConsoleWait(int slot)
return the_ide && the_ide->IdeConsoleWait(slot);
}
void IdeConsoleOnFinish(Callback cb)
void IdeConsoleOnFinish(Event<> cb)
{
if(the_ide) the_ide->IdeConsoleOnFinish(cb);
}

View file

@ -56,7 +56,7 @@ public:
virtual void IdeConsoleEndGroup() = 0;
virtual bool IdeConsoleWait() = 0;
virtual bool IdeConsoleWait(int slot) = 0;
virtual void IdeConsoleOnFinish(Callback cb) = 0;
virtual void IdeConsoleOnFinish(Event<> cb) = 0;
virtual bool IdeIsDebug() const = 0;
virtual void IdeEndDebug() = 0;
@ -114,7 +114,7 @@ void IdeConsoleBeginGroup(String group);
void IdeConsoleEndGroup();
bool IdeConsoleWait();
bool IdeConsoleWait(int slot);
void IdeConsoleOnFinish(Callback cb);
void IdeConsoleOnFinish(Event<> cb);
void IdeGotoCodeRef(String s);
String GetDefaultMethod();

View file

@ -143,7 +143,7 @@ bool LocalHost::Wait(int slot)
return IdeConsoleWait(slot);
}
void LocalHost::OnFinish(Callback cb)
void LocalHost::OnFinish(Event<> cb)
{
IdeConsoleOnFinish(cb);
}

View file

@ -25,7 +25,7 @@ struct Host {
virtual bool Run(const char *cmdline, Stream& out, int slot, String key, int blitz_count) = 0;
virtual bool Wait() = 0;
virtual bool Wait(int slot) = 0;
virtual void OnFinish(Callback cb) = 0;
virtual void OnFinish(Event<> cb) = 0;
virtual One<AProcess> StartProcess(const char *cmdline) = 0;
virtual void Launch(const char *cmdline, bool console = false) = 0;
virtual void AddFlags(Index<String>& cfg) = 0;
@ -59,7 +59,7 @@ struct LocalHost : Host {
virtual bool Run(const char *cmdline, Stream& out, int slot, String key, int blitz_count);
virtual bool Wait();
virtual bool Wait(int slot);
virtual void OnFinish(Callback cb);
virtual void OnFinish(Event<> cb);
virtual One<AProcess> StartProcess(const char *cmdline);
virtual void Launch(const char *cmdline, bool console);
virtual void AddFlags(Index<String>& cfg);

View file

@ -34,7 +34,7 @@ void Custom::InsertOut(String s) {
void Custom::DoMenu(Button& b, Callback1<String> cb, bool cmd) {
if(!list.IsCursor()) return;
MenuBar menu;
// CallbackArg<String> set;
// Event<> Arg<String> set;
// set <<= cb;
String pk = list.Get(0);
String ext = (String)list.Get(2);

View file

@ -59,8 +59,8 @@ private:
typedef DbgDisas CLASSNAME;
public:
Callback WhenCursor;
Callback WhenFocus;
Event<> WhenCursor;
Event<> WhenFocus;
void Clear();
void Add(adr_t adr, const String& code, const String& args, const String& bytes = Null);

View file

@ -291,7 +291,7 @@ void Gdb::ClearWatches()
void Gdb::QuickWatch()
{
quickwatch.expression <<= quickwatch.Breaker(999);
quickwatch.expression << quickwatch.Breaker(999);
FastCmd("set print pretty on");
for(;;) {
int q = quickwatch.Run();

View file

@ -426,8 +426,8 @@ Gdb_MI2::Gdb_MI2()
dlock.Hide();
CtrlLayout(quickwatch, "Quick watch");
quickwatch.close.Cancel() <<= quickwatch.Breaker(IDCANCEL);
quickwatch.evaluate.Ok() <<= quickwatch.Acceptor(IDOK);
quickwatch.close.Cancel() << quickwatch.Breaker(IDCANCEL);
quickwatch.evaluate.Ok() << quickwatch.Acceptor(IDOK);
quickwatch.WhenClose = quickwatch.Breaker(IDCANCEL);
quickwatch.value.SetReadOnly();
quickwatch.value.SetFont(CourierZ(12));
@ -655,8 +655,8 @@ void Gdb_MI2::SyncIde(bool fr)
{
// kill pending update callbacks
#ifndef flagMT
timeCallback.Kill();
exploreCallback.Kill();
timeEvent<> .Kill();
exploreEvent<> .Kill();
#endif
// get current frame info and level
@ -719,9 +719,9 @@ void Gdb_MI2::SyncIde(bool fr)
SyncData();
CleanupVariables();
#else
exploreCallback.Set(480, THISBACK1(SyncExplorer, DeepClone(Vector<VarItem>())));
timeCallback.Set(500, THISBACK(SyncData));
timeCallback.Set(550, THISBACK(CleanupVariables));
exploreEvent<> .Set(480, THISBACK1(SyncExplorer, DeepClone(Vector<VarItem>())));
timeEvent<> .Set(500, THISBACK(SyncData));
timeEvent<> .Set(550, THISBACK(CleanupVariables));
#endif
}
@ -1160,7 +1160,7 @@ void Gdb_MI2::SyncLocals(const Vector<VarItem>& localVars_)
// autos variables can come from members or locals...
SyncAutos();
timeCallback.Set(500, THISBACK1(SyncLocals, DeepClone(localVars)));
timeEvent<> .Set(500, THISBACK1(SyncLocals, DeepClone(localVars)));
return;
}
@ -1174,7 +1174,7 @@ void Gdb_MI2::SyncLocals(const Vector<VarItem>& localVars_)
localValues[iLoc] = v.value;
locals.Set(iLoc, 1, v.value);
SyncAutos();
timeCallback.Set(100, THISBACK1(SyncLocals, DeepClone(localVars)));
timeEvent<> .Set(100, THISBACK1(SyncLocals, DeepClone(localVars)));
return;
}
}
@ -1305,7 +1305,7 @@ void Gdb_MI2::SyncThis(const Vector<VarItem>& children_)
// autos variables can come from members or locals...
SyncAutos();
timeCallback.Set(500, THISBACK1(SyncThis, DeepClone(children)));
timeEvent<> .Set(500, THISBACK1(SyncThis, DeepClone(children)));
return;
}
@ -1319,7 +1319,7 @@ void Gdb_MI2::SyncThis(const Vector<VarItem>& children_)
thisValues[iVar] = v.value;
members.Set(iVar, 1, v.value);
SyncAutos();
timeCallback.Set(100, THISBACK1(SyncThis, DeepClone(children)));
timeEvent<> .Set(100, THISBACK1(SyncThis, DeepClone(children)));
return;
}
}
@ -1470,7 +1470,7 @@ void Gdb_MI2::SyncWatches(const Vector<VarItem>& watchesVars_)
watches.Set(iWatch, 1, val);
}
timeCallback.Set(500, THISBACK1(SyncWatches, DeepClone(watchesVars_)));
timeEvent<> .Set(500, THISBACK1(SyncWatches, DeepClone(watchesVars_)));
return;
}
@ -1483,7 +1483,7 @@ void Gdb_MI2::SyncWatches(const Vector<VarItem>& watchesVars_)
watchesExpressions.Set(iWatch, v.evaluableExpression);
watchesValues[iWatch] = v.value;
watches.Set(iWatch, 1, v.value);
timeCallback.Set(100, THISBACK1(SyncWatches, DeepClone(watchesVars)));
timeEvent<> .Set(100, THISBACK1(SyncWatches, DeepClone(watchesVars)));
return;
}
}

View file

@ -124,7 +124,7 @@ void Gdb_MI2::SyncExplorer(const Vector<VarItem>& children_)
// update 'this' pane
FillPane(explorer, explorerExpressions, explorerValues);
exploreCallback.Set(500, THISBACK1(SyncExplorer, DeepClone(children)));
exploreEvent<> .Set(500, THISBACK1(SyncExplorer, DeepClone(children)));
return;
}
@ -136,7 +136,7 @@ void Gdb_MI2::SyncExplorer(const Vector<VarItem>& children_)
VarItem &v = children[iVar];
explorer.Set(iVar, 1, v.value);
explorerValues[iVar] = v.value;
exploreCallback.Set(100, THISBACK1(SyncExplorer, DeepClone(children)));
exploreEvent<> .Set(100, THISBACK1(SyncExplorer, DeepClone(children)));
return;
}
}

View file

@ -351,7 +351,7 @@ void Gdb_MI2::CleanupVariables(void)
{
String name = debugVariables.Pop();
MICmd("var-delete " + name);
timeCallback.Set(50, THISBACK(CleanupVariables));
timeEvent<> .Set(50, THISBACK(CleanupVariables));
}
#endif
}

View file

@ -89,8 +89,8 @@ SelectPackageDlg::SelectPackageDlg(const char *title, bool selectvars_, bool mai
base.WhenCursor = THISBACK(OnBase);
base.WhenBar = THISBACK(ToolBase);
base.WhenLeftDouble = THISBACK(OnBaseEdit);
ok <<= clist.WhenLeftDouble = alist.WhenLeftDouble = THISBACK(OnOK);
cancel <<= WhenClose = THISBACK(OnCancel);
ok.WhenAction = clist.WhenLeftDouble = alist.WhenLeftDouble = THISBACK(OnOK);
cancel.WhenAction = WhenClose = THISBACK(OnCancel);
clist.Columns(4);
clist.WhenEnterItem = clist.WhenKillCursor = THISBACK(ListCursor);
alist.AddColumn("Package").Add(3);

View file

@ -30,7 +30,7 @@ class FontSelectManager {
void Select();
public:
Callback WhenAction;
Event<> WhenAction;
typedef FontSelectManager CLASSNAME;
@ -487,7 +487,7 @@ void Ide::SetupFormat() {
hlt.hlstyle.EvenRowColor().NoHorzGrid().SetLineCy(EditField::GetStdHeight() + 2);
ReadHlStyles(hlt.hlstyle);
edt.charset <<= (int)default_charset;
edt.tabsize <<= rtvr <<=
edt.tabsize.WhenAction = rtvr <<=
hlt.hlstyle.WhenCtrlsAction = ed.WhenAction = tf.WhenAction =
con.WhenAction = f1.WhenAction = f2.WhenAction = dlg.Breaker(222);
ide.showtimeafter <<= Nvl((Date)FileGetTime(ConfigFile("version")), GetSysDate() - 1);

Some files were not shown because too many files have changed in this diff Show more