protux-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Protux-devel] Wrong concept in MJMB


From: Remon Sijrier
Subject: Re: [Protux-devel] Wrong concept in MJMB
Date: Thu, 29 Apr 2004 01:30:34 +0200
User-agent: KMail/1.6.2

Hi all,

Reading what I wrote previous in this mail I wondered if anybody understood 
what I tried to say. I don't ;-P

But after hours of thinking I found a solution that hopefully fits to the idea 
Luciano has (The idea of contexts) and fixes all remaining issues.  

I tried the following:

Jmb internally has an array of JmbAction's.
A JmbAction has 2 members, a context and a slot.
When we call this: 

Jmb::connect_action_to_slot(actionId, JmbContext, slot)
(note: this method name is not completely consistent, it adds _both_ a slot 
and context to an action!)

a new JmbAction is created and stored in the array at index actionId. This 
action has thus both a slot and a context.

The JmbContext can be either of the following:

JmbContext((object*) this, bool global=false) // this boolean is application 
wide)
JmbContext((object*) this, JmbContextMode* mode, JmbContext* innerContext, 
bool global=false)

Here we see a new object, JmbContextMode which can be:

JmbContextMode(bool global=false) // in this case the boolean will work only 
object wide


When a JmbContext is made with global=true, there can be only one JmbAction 
made for a given actionId, 
else there can be more actions associated with it.

Consider this: (This is code from Song.cc)

JmbContextMode* jmbContextModeNormal = new JmbContextMode();
JmbContextMode* jmbContextModeCurve = new JmbContextMode();
JmbContextMode* jmbContextModeGlobal = new JmbContextMode(Jmb::GLOBAL_MODE);

jmbcGlobal     = new JmbContext(this, Jmb::GLOBAL_CONTEXT); 
jmbcNormalMode = new JmbContext(this, jmbContextModeNormal, 0, false); 
jmbcCurveMode  = new JmbContext(this, jmbContextModeCurve, 0, false);
jmbcGlobalMode = new JmbContext(this, jmbContextModeGlobal, 0, false);
jmbcUponClip   = new JmbContext(this);
jmbcGlobalModeUponClip = new JmbContext(this, jmbContextModeGlobal, 
jmbcUponClip, false);   
jmbcUponTrack  = new JmbContext(this);
jmbcGlobalModeUponTrack = new JmbContext(this, jmbContextModeGlobal, 
jmbcUponTrack, false);  

And look what we do when connection actionId's (==actions) to a context/slot:

Jmb::connect_action_to_slot(106, jmbcGlobalMode        , 
JMB_SLOT(Song,touch));
Jmb::connect_action_to_slot(601, jmbcCurveMode        , 
JMB_SLOT(Song,select_filter_controller));
Jmb::connect_action_to_slot(552, jmbcGlobalModeUponClip        , 
JMB_SLOT(Song,drag_clip));
Jmb::connect_action_to_slot(407, jmbcGlobalModeUponTrack     , 
JMB_SLOT(Song,solo_track));

The funn thing:
We don't have to set a mode when a slot/context is connected with 
jmbcGlobalMode, it is simpy always true ;-)
What if the mouse is above a clip and we want to drag it? The 
Jmb::currentContext is set to jmbcUponClip and 
actionId 552 is called. It's left as an exercise to the reader to see that 
Song::drag_clip is called....


If you can't figure out how it works from the above, ask me then I'll try one 
more time!


Best wishes,

Remon

P.S.
Oh, and Luciano, pleeeeeeeeeeaaaaaaaase don't tell me that this breaks the 
"concept" so I did it all for nothing.....
(You see, I don't know exactly if this is what you had in mind, but it works!)



> Hello Luciano,
>
> I tried to work on MJMB to see if I could get it to work, but there seems a
> wrong concept in Jmb::connect_action_to_slot()
>
> There, we actually connect an action (==actionId) to a context.
> For an actionId the associated context is stored in the
> contextArray[actionId], afterwards the slot is set to the context and not
> to the actionId !!!!
>
> So if there are more actions for one context, the last set slot of a
> context will always be used.
>
> Do we need a Jmb:actionId object, were we can store the slot object?
>
> Then there's is still one problem with this approach, only one slot can be
> combined with a actionId, so this is impossible:
>
> Jmb::connect_action_to_slot(300, jmbcGlobal  , JMB_SLOT(Song,drag_edge));
> Jmb::connect_action_to_slot(301, jmbcGlobal   , JMB_SLOT(Song,drag_edge));
> Jmb::connect_action_to_slot(302, jmbcGlobal   , JMB_SLOT(Song,drag_edge));
> Jmb::connect_action_to_slot(303, jmbcGlobal    , JMB_SLOT(Song,drag_edge));
>
> for example, instead we need to make separate slots for each action, which
> can use Song::drag_edge(bla,bla) to do the thing it has to do. This is
> inevitable I think. (hopefully I'm using the right word here)
>
> Oh, fixed the globalContext thing in MJMB, but then I got stuck with this
> wrong concept :-(
> Hope you can help me out ;-)
>
> Best wishes,
>
> Remon
>
>
> _______________________________________________
> Protux-devel mailing list
> address@hidden
> http://mail.nongnu.org/mailman/listinfo/protux-devel




reply via email to

[Prev in Thread] Current Thread [Next in Thread]