bazaar: CMeter: code artefact, Dispatcher: param is not nessesary actually, has been removed.

git-svn-id: svn://ultimatepp.org/upp/trunk@2648 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
kohait 2010-09-01 08:54:09 +00:00
parent 8a07235f3d
commit 91ce2e1c72
15 changed files with 56 additions and 60 deletions

View file

@ -402,10 +402,6 @@ void CMeter::PaintCVMarks(Painter & sw)
if(cvmarks.GetCount()<=0) return; if(cvmarks.GetCount()<=0) return;
Size size = GetSize(); Size size = GetSize();
Vector<Point> p; Vector<Point> p;
if(cvmarks.GetCount() > 2)
{
int a = 0;
}
if(vertical) if(vertical)
{ {
sw.DrawRect(0,0,px,size.cy,style->backcol); sw.DrawRect(0,0,px,size.cy,style->backcol);

View file

@ -21,7 +21,7 @@ public:
virtual ~Dispatchable(); virtual ~Dispatchable();
public: public:
virtual void Dispatch(const T & o, unsigned param = 0) = 0; virtual void Dispatch(const T & o) = 0;
void Unregister(const Any & _src); void Unregister(const Any & _src);
void UnregisterAll(); void UnregisterAll();
@ -43,7 +43,7 @@ public:
Dispatcher(); Dispatcher();
virtual ~Dispatcher(); virtual ~Dispatcher();
void DoDispatch(const T & o, unsigned param = 0) const; void DoDispatch(const T & o) const;
void Register(Dispatchable<T> & d, unsigned key = 0); void Register(Dispatchable<T> & d, unsigned key = 0);
void Unregister(Dispatchable<T> & d, unsigned key = 0); void Unregister(Dispatchable<T> & d, unsigned key = 0);
@ -63,7 +63,7 @@ public:
virtual ~DispatcherGen(); virtual ~DispatcherGen();
template<class T> template<class T>
void DoDispatch(const T & o, unsigned param = 0) const; void DoDispatch(const T & o) const;
template<class T> template<class T>
void Register(Dispatchable<T> & d, unsigned key = 0); void Register(Dispatchable<T> & d, unsigned key = 0);
@ -88,15 +88,15 @@ public:
DispatcherCB(); DispatcherCB();
virtual ~DispatcherCB(); virtual ~DispatcherCB();
void DoDispatch(const T & o, unsigned param = 0) const; void DoDispatch(const T & o) const;
void Register(Callback2<const T &, unsigned> d, unsigned key); void Register(Callback1<const T &> d, unsigned key);
void Unregister(unsigned key); void Unregister(unsigned key);
Callback2<const T &, unsigned> GetDispatchable(unsigned key); Callback1<const T &> GetDispatchable(unsigned key);
const VectorMap<unsigned, Callback2<const T &, unsigned> > & GetDests() const { return dests; } const VectorMap<unsigned, Callback1<const T &> > & GetDests() const { return dests; }
private: private:
VectorMap<unsigned, Callback2<const T &, unsigned> > dests; VectorMap<unsigned, Callback1<const T &> > dests;
}; };
//a generic version that accepts any Callback<cons T &, unsigned> //a generic version that accepts any Callback<cons T &, unsigned>
@ -108,10 +108,10 @@ public:
virtual ~DispatcherCBGen(); virtual ~DispatcherCBGen();
template<class T> template<class T>
void DoDispatch(const T & o, unsigned param = 0) const; void DoDispatch(const T & o) const;
template<class T> template<class T>
void Register(Callback2<const T &, unsigned> d, unsigned key); void Register(Callback1<const T &> d, unsigned key);
template<class T> template<class T>
void Unregister(unsigned key); void Unregister(unsigned key);
template<class T> template<class T>

View file

@ -50,12 +50,12 @@ Dispatcher<T>::~Dispatcher()
} }
template<class T> template<class T>
void Dispatcher<T>::DoDispatch(const T & o, unsigned param) const void Dispatcher<T>::DoDispatch(const T & o) const
{ {
for(int i = 0; i < dests.GetCount(); i++) for(int i = 0; i < dests.GetCount(); i++)
{ {
Dispatchable<T> * dest = dests.operator[](i); Dispatchable<T> * dest = dests.operator[](i);
dest->Dispatch(o, param); dest->Dispatch(o);
} }
} }
@ -92,14 +92,14 @@ Dispatchable<T> * Dispatcher<T>::GetDispatchable(unsigned key) const
} }
template<class T> template<class T>
void DispatcherGen::DoDispatch(const T & o, unsigned param) const void DispatcherGen::DoDispatch(const T & o) const
{ {
for(int i = 0; i < dests.GetCount(); i++) for(int i = 0; i < dests.GetCount(); i++)
{ {
const Any & a = dests.operator[](i); const Any & a = dests.operator[](i);
if(!a.Is<Dispatcher<T> >()) continue; if(!a.Is<Dispatcher<T> >()) continue;
const Dispatcher<T> & dest = a.Get<Dispatcher<T> >(); const Dispatcher<T> & dest = a.Get<Dispatcher<T> >();
dest.DoDispatch(o, param); dest.DoDispatch(o);
return; return;
} }
} }
@ -161,17 +161,17 @@ DispatcherCB<T>::~DispatcherCB()
} }
template<class T> template<class T>
void DispatcherCB<T>::DoDispatch(const T & o, unsigned param) const void DispatcherCB<T>::DoDispatch(const T & o) const
{ {
for(int i = 0; i < dests.GetCount(); i++) for(int i = 0; i < dests.GetCount(); i++)
{ {
const Callback2<const T &, unsigned> & dest = dests.operator[](i); const Callback1<const T &> & dest = dests.operator[](i);
dest(o, param); dest(o);
} }
} }
template<class T> template<class T>
void DispatcherCB<T>::Register(Callback2<const T &, unsigned> d, unsigned key) void DispatcherCB<T>::Register(Callback1<const T &> d, unsigned key)
{ {
int i = dests.Find(key); int i = dests.Find(key);
if(i>=0) return; if(i>=0) return;
@ -187,29 +187,29 @@ void DispatcherCB<T>::Unregister(unsigned key)
} }
template<class T> template<class T>
Callback2<const T &, unsigned> DispatcherCB<T>::GetDispatchable(unsigned key) Callback1<const T &> DispatcherCB<T>::GetDispatchable(unsigned key)
{ {
int i = dests.Find(key); int i = dests.Find(key);
if(i<0) return; if(i<0) return;
Callback2<const T &, unsigned> & dest = dests.operator[](i); Callback1<const T &> & dest = dests.operator[](i);
return dest; return dest;
} }
template<class T> template<class T>
void DispatcherCBGen::DoDispatch(const T & o, unsigned param) const void DispatcherCBGen::DoDispatch(const T & o) const
{ {
for(int i = 0; i < dests.GetCount(); i++) for(int i = 0; i < dests.GetCount(); i++)
{ {
const Any & a = dests.operator[](i); const Any & a = dests.operator[](i);
if(!a.Is<DispatcherCB<T> >()) continue; if(!a.Is<DispatcherCB<T> >()) continue;
const DispatcherCB<T> & dest = a.Get<DispatcherCB<T> >(); const DispatcherCB<T> & dest = a.Get<DispatcherCB<T> >();
dest.DoDispatch(o, param); dest.DoDispatch(o);
return; return;
} }
} }
template<class T> template<class T>
void DispatcherCBGen::Register(Callback2<const T &, unsigned> d, unsigned key) void DispatcherCBGen::Register(Callback1<const T &> d, unsigned key)
{ {
for(int i = 0; i < dests.GetCount(); i++) for(int i = 0; i < dests.GetCount(); i++)
{ {

View file

@ -18,7 +18,7 @@ public:
typedef MyPane CLASSNAME; typedef MyPane CLASSNAME;
MyPane(); MyPane();
virtual void Dispatch(const Value & o, unsigned param); virtual void Dispatch(const Value & o);
}; };
class DispatcherTest : public WithDispatcherTestLayout<TopWindow> class DispatcherTest : public WithDispatcherTestLayout<TopWindow>

View file

@ -10,7 +10,7 @@ MyPane::MyPane()
dl.Add(i); dl.Add(i);
} }
void MyPane::Dispatch(const Value & o, unsigned param) void MyPane::Dispatch(const Value & o)
{ {
ei.SetData(o); ei.SetData(o);
//pi.SetData(o); //pi.SetData(o);
@ -24,7 +24,7 @@ void MyPane::Dispatch(const Value & o, unsigned param)
void DispatcherTest::sliderCB() void DispatcherTest::sliderCB()
{ {
Value o = sl.GetData(); Value o = sl.GetData();
disp.DoDispatch(o, 123); disp.DoDispatch(o);
} }
DispatcherTest::DispatcherTest() DispatcherTest::DispatcherTest()

View file

@ -19,8 +19,8 @@ public:
typedef MyPane CLASSNAME; typedef MyPane CLASSNAME;
MyPane(); MyPane();
virtual void Dispatch(const Value & o, unsigned param); virtual void Dispatch(const Value & o);
virtual void Dispatch(const int & o, unsigned param); virtual void Dispatch(const int & o);
}; };
class DispatcherTest : public WithDispatcherTestLayout<TopWindow> class DispatcherTest : public WithDispatcherTestLayout<TopWindow>

View file

@ -10,7 +10,7 @@ MyPane::MyPane()
dl.Add(i); dl.Add(i);
} }
void MyPane::Dispatch(const Value & o, unsigned param) void MyPane::Dispatch(const Value & o)
{ {
ei.SetData(o); ei.SetData(o);
//pi.SetData(o); //pi.SetData(o);
@ -19,7 +19,7 @@ void MyPane::Dispatch(const Value & o, unsigned param)
st.SetText(String().Cat() << o); st.SetText(String().Cat() << o);
} }
void MyPane::Dispatch(const int & o, unsigned param) void MyPane::Dispatch(const int & o)
{ {
ei.SetData(o); ei.SetData(o);
//pi.SetData(o); //pi.SetData(o);
@ -33,13 +33,13 @@ void MyPane::Dispatch(const int & o, unsigned param)
void DispatcherTest::sliderCB() void DispatcherTest::sliderCB()
{ {
Value o = sl.GetData(); Value o = sl.GetData();
disp.DoDispatch(o, 123); disp.DoDispatch(o);
} }
void DispatcherTest::slideriCB() void DispatcherTest::slideriCB()
{ {
int o = sli.GetData(); int o = sli.GetData();
dispi.DoDispatch(o, 125); dispi.DoDispatch(o);
} }
DispatcherTest::DispatcherTest() DispatcherTest::DispatcherTest()

View file

@ -19,7 +19,7 @@ class WithDispatch
public: public:
typedef WithDispatch<C, T> CLASSNAME; typedef WithDispatch<C, T> CLASSNAME;
virtual void Dispatch(const T & o, unsigned param) virtual void Dispatch(const T & o)
{ {
C::SetData(o); C::SetData(o);
} }
@ -34,7 +34,7 @@ class ProgressIndicatorWithDispatch
public: public:
typedef ProgressIndicatorWithDispatch<T> CLASSNAME; typedef ProgressIndicatorWithDispatch<T> CLASSNAME;
virtual void Dispatch(const T & o, unsigned param) virtual void Dispatch(const T & o)
{ {
Set(o); Set(o);
} }

View file

@ -3,14 +3,14 @@
void DispatcherTest::sliderCB() void DispatcherTest::sliderCB()
{ {
Value o = sl.GetData(); Value o = sl.GetData();
disp.DoDispatch(o, 123); disp.DoDispatch(o);
} }
/* /*
void DispatcherTest::slideriCB() void DispatcherTest::slideriCB()
{ {
int o = sli.GetData(); int o = sli.GetData();
dispi.DoDispatch(o, 125); dispi.DoDispatch(o);
} }
*/ */

View file

@ -18,11 +18,11 @@ class MyEditInt
public: public:
typedef MyEditInt CLASSNAME; typedef MyEditInt CLASSNAME;
virtual void Dispatch(const Value & o, unsigned param) virtual void Dispatch(const Value & o)
{ {
SetData(o); SetData(o);
} }
virtual void Dispatch(const int & o, unsigned param) virtual void Dispatch(const int & o)
{ {
SetData(o); SetData(o);
} }
@ -36,11 +36,11 @@ class MyProgressIndicator
public: public:
typedef MyProgressIndicator CLASSNAME; typedef MyProgressIndicator CLASSNAME;
virtual void Dispatch(const Value & o, unsigned param) virtual void Dispatch(const Value & o)
{ {
Set(o); Set(o);
} }
virtual void Dispatch(const int & o, unsigned param) virtual void Dispatch(const int & o)
{ {
Set(o); Set(o);
} }

View file

@ -3,13 +3,13 @@
void DispatcherTest::sliderCB() void DispatcherTest::sliderCB()
{ {
Value o = sl.GetData(); Value o = sl.GetData();
disp.DoDispatch(o, 123); disp.DoDispatch(o);
} }
void DispatcherTest::slideriCB() void DispatcherTest::slideriCB()
{ {
int o = sli.GetData(); int o = sli.GetData();
dispi.DoDispatch(o, 125); dispi.DoDispatch(o);
} }

View file

@ -18,11 +18,11 @@ class MyEditInt
public: public:
typedef MyEditInt CLASSNAME; typedef MyEditInt CLASSNAME;
virtual void Dispatch(const Value & o, unsigned param) virtual void Dispatch(const Value & o)
{ {
SetData(o); SetData(o);
} }
virtual void Dispatch(const int & o, unsigned param) virtual void Dispatch(const int & o)
{ {
SetData(o); SetData(o);
} }
@ -36,11 +36,11 @@ class MyProgressIndicator
public: public:
typedef MyProgressIndicator CLASSNAME; typedef MyProgressIndicator CLASSNAME;
virtual void Dispatch(const Value & o, unsigned param) virtual void Dispatch(const Value & o)
{ {
Set(o); Set(o);
} }
virtual void Dispatch(const int & o, unsigned param) virtual void Dispatch(const int & o)
{ {
Set(o); Set(o);
} }

View file

@ -3,13 +3,13 @@
void DispatcherTest::sliderCB() void DispatcherTest::sliderCB()
{ {
Value o = sl.GetData(); Value o = sl.GetData();
disp.DoDispatch(o, 123); disp.DoDispatch(o);
} }
void DispatcherTest::slideriCB() void DispatcherTest::slideriCB()
{ {
int o = sli.GetData(); int o = sli.GetData();
disp.DoDispatch(o, 125); disp.DoDispatch(o);
} }

View file

@ -16,11 +16,11 @@ class MyEditInt
public: public:
typedef MyEditInt CLASSNAME; typedef MyEditInt CLASSNAME;
virtual void DispatchV(const Value & o, unsigned param) virtual void DispatchV(const Value & o)
{ {
SetData(o); SetData(o);
} }
virtual void DispatchI(const int & o, unsigned param) virtual void DispatchI(const int & o)
{ {
SetData(o); SetData(o);
} }
@ -32,11 +32,11 @@ class MyProgressIndicator
public: public:
typedef MyProgressIndicator CLASSNAME; typedef MyProgressIndicator CLASSNAME;
virtual void DispatchV(const Value & o, unsigned param) virtual void DispatchV(const Value & o)
{ {
Set(o); Set(o);
} }
virtual void DispatchI(const int & o, unsigned param) virtual void DispatchI(const int & o)
{ {
Set(o); Set(o);
} }
@ -51,7 +51,7 @@ public:
void sliderCB(); void sliderCB();
void slideriCB(); void slideriCB();
virtual void Dispatch(const Value & o, unsigned param); virtual void Dispatch(const Value & o);
DispatcherCBGen disp; DispatcherCBGen disp;

View file

@ -3,16 +3,16 @@
void DispatcherTest::sliderCB() void DispatcherTest::sliderCB()
{ {
Value o = sl.GetData(); Value o = sl.GetData();
disp.DoDispatch(o, 123); disp.DoDispatch(o);
} }
void DispatcherTest::slideriCB() void DispatcherTest::slideriCB()
{ {
int o = sli.GetData(); int o = sli.GetData();
disp.DoDispatch(o, 125); disp.DoDispatch(o);
} }
void DispatcherTest::Dispatch(const Value & o, unsigned param) void DispatcherTest::Dispatch(const Value & o)
{ {
int a = 0; int a = 0;
} }