Re: [opensource-dev] I could use a little help with boost and callbacks and stuff

2011-11-13 Thread Ricky
IIRC that _number thing has to do with iteration.  The example code I
gave in the email here passes one parameter (myParameter).  I'm not as
strong with Boost or the Standard Lib methods as I was a couple of
months ago, but I don't recall there being a no-parameter version.
The count of parameters is entirely dependent upon the function/method
being passed.

I discovered this technique online after searching the 'net looking
for how to work with functions and methods as first-class types in
C++: I wanted to pass the method of a class instance off to another
function (in my case, a template) so that is could call it in a
centralized manner.  I was able to do so this way, though it feels a
bit hackish - like a lot of C++ I'm afraid. (Yes, C++ isn't my fav
language, but D isn't what we are working in.)

Sorry I can't help much farther: my experience is limited, and my SL
viewer hacking experience is even more limited!

Ricky
Cron Stardus

On Sat, Nov 12, 2011 at 11:51 PM, Lance Corrimal
 wrote:
> I guess I wasn't exactly clear...
>
>
> What I need to know is how I have to modify my classes to make them
> work with boost::bind and the CallbackRegistry.
>
> When I try to just duplicate the way that other classes in the viewer
> use to register methods in the CallbackRegistry, I get tons of boost
> errors when building, all culminating from some missing function or
> such that is called get_pointer...
>
> So I think I need to inherit some special class or something, but I
> can't find which one!
>
> And what do I pass to the bind() call, there are several different
> ways to call it, with one, two, or three parameters, and what's the
> _(number) that usually gets passed last?
>
>
> As you can see, I don't really know what I'm doing there.
>
> bye,
> LC
>
>
> Am Sonntag, 13. November 2011 schrieb Ricky:
>> Is something like:
>> std::bind1st(std::mem_fun(&MyClass::MyMethod), myParameter)
>> what you are looking for?
>>
>> You can see working code using that on lines 350-390 of
>> https://bitbucket.org/kf6kjg/gsp-420-engine-design-graphics/src/120
>> a2081bb2f/src/audio_core/AudioCore.cpp (This was code I wrote while
>> helping out another team in one of my classes.)
>>
>> Boost's Bind function
>> (http://www.boost.org/doc/libs/1_47_0/libs/bind/bind.html)
>> generalizes the standard call I used, and so might be easier to
>> use.  Here's the same using Boost:
>> bind(&MyClass::MyMethod, myParameter)
>>
>> I hope this helps,
>> Ricky
>> Cron Stardust
>>
>> On Sat, Nov 12, 2011 at 1:54 PM, Lance Corrimal
>>
>>  wrote:
>> > Hi there,
>> >
>> >
>> > I'm banging my head against a problem here...
>> > I want to add buttons to the toolboxes.
>> >
>> > The actuall adding is easy, but I have trouble figuring out what
>> > I need to do to register some callbacks into the classes I need.
>> >
>> > I have two classes that I need to "buttonize"... one represents
>> > the graphical UI for a set of new features, and that one I
>> > managed to set up as a toolbox button just fine.
>> >
>> > The other one is troublesome though. I need to establish a method
>> > that gets called (with no parameter, or a dummy), to toggle an
>> > internal switch in my class, and I need another callback, that
>> > returns the boolean value of that internal switch, to turn the
>> > button green or not. Think of a simple "on/off switch".
>> >
>> > What I can't figure out is what I actually have to do with my
>> > class to implement the callbacks properly, and what I have to
>> > pass to the function that registers the callback.
>> >
>> > Any hints/tips for me?
>> >
>> > thanks,
>> >
>> > LC
>> > ___
>> > Policies and (un)subscribe information available here:
>> > http://wiki.secondlife.com/wiki/OpenSource-Dev
>> > Please read the policies before posting to keep unmoderated
>> > posting privileges
>
> ___
> Policies and (un)subscribe information available here:
> http://wiki.secondlife.com/wiki/OpenSource-Dev
> Please read the policies before posting to keep unmoderated posting privileges
>
___
Policies and (un)subscribe information available here:
http://wiki.secondlife.com/wiki/OpenSource-Dev
Please read the policies before posting to keep unmoderated posting privileges


[opensource-dev] VD Build Page Hacking

2011-11-13 Thread Ricky
I finally got so annoyed with the build page that I decided to do some
hacking on it.  Turns out that the reason why it isn't displaying
changesets or JIRA entries is because the JSON format was changed
without correcting the Javascript.  What's more, the JSON information
doesn't have the needed data anymore.

So.  I dug and I hacked, and I hacked and I dug, and voila, I'd mashed
up a facsimile of what I think it did in the past.  And yes, I used
the phrase "mashed up" on purpose: the page I built taps into
BitBucket's REST API to get the missing data.  It's not all that
pretty to go that route, but it works.

Here's a demonstration: http://rwcproductions.com/~ricky/snowstorm/
And here's the patch:
http://rwcproductions.com/~ricky/snowstorm/index.js.patch.txt

Yes, there are some whitespace changes, and render_description() could
be cleaned up further, but I tried to not affect more than the areas
needed to make it "workable."

Suggestions, thoughts, etc. welcome.

Ricky
Cron Stardust
___
Policies and (un)subscribe information available here:
http://wiki.secondlife.com/wiki/OpenSource-Dev
Please read the policies before posting to keep unmoderated posting privileges


Re: [opensource-dev] I could use a little help with boost and callbacks and stuff

2011-11-13 Thread Lance Corrimal
Am Sonntag, 13. November 2011 schrieb Jonathan Welch:
> Did you try creating a new debug variable and linking it to your
> xml file that defines the new UI element you have created?


the ui element is doing fine, it's the "non-ui" class that I can't get 
to work with the buttons...

I'm trying to get Zi Ree's client side AO to work with toolbox 
buttons.

There's a class "FLoaterAO" which is basically the setup dialog, and 
that works fine after "buttonizing" it.

There's another class AOEngine which is the actual running AO, and 
that one needs to get two methods:

void AOEngine::Toggle() { toggles the AO on or off }

bool  AOEngine::isRunning() { returns true or false depending on the 
state of things }


I'm having trouble getting those two methods registered in the 
callback registry, so that I can use them in app_settings/commands.xml

Any help is appreciated!


bye,
LC
___
Policies and (un)subscribe information available here:
http://wiki.secondlife.com/wiki/OpenSource-Dev
Please read the policies before posting to keep unmoderated posting privileges