[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: GUISwarm and gtk ? - not yet
From: |
Daniel Kottow |
Subject: |
Re: GUISwarm and gtk ? - not yet |
Date: |
Wed, 01 Aug 2001 11:49:52 +0200 |
hi,
and thank you, marcus for your patch, although results are pretty
funny...
let me tell you what i did and what happens:
> 1) Add the alternative ControlPanel below, replacing the printf
> with the GTK update code. Add MyControlPanel.o to the OBJECTS in
> your Makefile.
@implementation GtkControlPanel
- setStateStopped
{
[probeDisplayManager setDropImmediatelyFlag: YES];
if (_activity_current)
{
[getTopLevelActivity() stop];
return [self setState: ControlStateStopped];
}
else
{
[self setState: ControlStateStopped];
while (state == ControlStateStopped)
{
//gtk
while (gtk_events_pending()) gtk_main_iteration();
GUI_EVENT_SYNC ();
}
return self;
}
}
@end
> 2) Use +poseAs: before creating the GUISwarm in order to make
> this implementation look like the real ControlPanel.
int
main (int argc, const char **argv)
{
ObserverSwarm *observerSwarm;
//work around the const/non-const problem with gnome_init()
char *argv2[1];
*argv2 = strdup( *argv);
gnome_init ("img-example", "0.0", 1, argv2);
// Swarm initialization: all Swarm apps must call this first.
initSwarm (argc, argv);
[GtkControlPanel poseAs: [ControlPanel class]];
observerSwarm = [ObserverSwarm create: globalZone];
...
> 3) Call your GTK update code along with the doTkEvents code.
in ObserverSwarm.m
- doGtkEvents
{
while (gtk_events_pending())
gtk_main_iteration();
return self;
}
- buildActions
{
[super buildActions];
displayActions = [ActionGroup create: self];
[displayActions createActionTo: self message:
M(processImage)];
[displayActions createActionTo: actionCache message: M(doGtkEvents)];
[displayActions createActionTo: actionCache message: M(doTkEvents)];
displaySchedule = [Schedule createBegin: self];
[displaySchedule setRepeatInterval: displayFrequency];
displaySchedule = [displaySchedule createEnd];
[displaySchedule at: 0 createAction: displayActions];
return self;
}
runtime behavior is like follows:
while the simluation is running, everything is fine. i can see my image
getting processed while zooming/panning interactively with the
gtk-widget.
if i stop the simulation, i can get updates on the gtk events, but only
if i put my mouse pointer over the control panel! so you kind of have to
work blindly on the gtk window and then "have a look on what you did"
moving over to the panel ;-)
what do you think of another old-school lesson ?
greetings daniel
==================================
Swarm-Support is for discussion of the technical details of the day
to day usage of Swarm. For list administration needs (esp.
[un]subscribing), please send a message to <address@hidden>
with "help" in the body of the message.
- Re: GUISwarm and gtk ? - not yet,
Daniel Kottow <=