aboutsummaryrefslogtreecommitdiff
path: root/externals
diff options
context:
space:
mode:
authorThomas Grill <xovo@users.sourceforge.net>2002-10-22 23:55:09 +0000
committerThomas Grill <xovo@users.sourceforge.net>2002-10-22 23:55:09 +0000
commit75de2ea4f02e83661cfd04401951de07b12686d1 (patch)
tree74719ce81f2e699d658ab91f324810ea9bccea31 /externals
parentc2645dc4003b1391aba9b387a79a66cff1e63d3e (diff)
*** empty log message ***
svn path=/trunk/; revision=192
Diffstat (limited to 'externals')
-rw-r--r--externals/grill/guitest/flgui.cpp646
-rw-r--r--externals/grill/guitest/flgui.h232
-rw-r--r--externals/grill/guitest/flguiobj.cpp801
-rw-r--r--externals/grill/guitest/flguiobj.h362
-rw-r--r--externals/grill/guitest/guitest.dsp112
-rw-r--r--externals/grill/guitest/main.cpp152
6 files changed, 0 insertions, 2305 deletions
diff --git a/externals/grill/guitest/flgui.cpp b/externals/grill/guitest/flgui.cpp
deleted file mode 100644
index 86d8e4ea..00000000
--- a/externals/grill/guitest/flgui.cpp
+++ /dev/null
@@ -1,646 +0,0 @@
-#include "flgui.h"
-#include "flguiobj.h"
-#include "flinternal.h"
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-
-
-#ifdef PD
-t_class *flext_gui::px_class = NULL;
-t_class *flext_gui::pxkey_class = NULL;
-
-struct flext_gui::px_object // no virtual table!
-{
- t_object obj; // MUST reside at memory offset 0
- t_canvas *canv;
-
- void init(t_canvas *c) { canv = c; }
-};
-
-struct flext_gui::pxkey_object // no virtual table!
-{
- t_object obj; // MUST reside at memory offset 0
- flext_gui *th;
-
- void init(flext_gui *t) { th = t; }
-};
-#endif
-
-
-flext_gui::flext_gui(int xs,int ys):
- objs(NULL),
-#ifdef PD
- xsize(xs),ysize(ys),
-#endif
-#ifdef MAXMSP
- curx(-1),cury(-1),curmod(-1),
- created(false),
-#endif
- bindsym(NULL)
-{
- canvas = new Canvas(thisCanvas());
- objs = new GuiGroup(canvas);
-
-#ifdef PD
- AddCanvas();
-#else
- t_box *b = (t_box *)gensym("#B")->s_thing;
-
- int x = b->b_rect.left,y = b->b_rect.top;
- t_pxbox *p = thisHdr();
- box_new(&p->z_box, thisCanvas(), F_DRAWFIRSTIN | F_GROWBOTH | F_SAVVY,x,y,x+xs,y+ys);
- p->z_box.b_firstin = (void *)p; /* it's not really an inlet */
- box_ready(&p->z_box);
-#endif
-}
-
-flext_gui::~flext_gui()
-{
-#ifdef PD
- RmvCanvas();
-#endif
-
- delete objs;
- delete canvas;
-}
-
-
-void flext_gui::setup(t_class *c)
-{
-#ifdef PD
- SetWidget(c);
-
- pxkey_class = class_new(gensym("flext_gui key proxy"),NULL,NULL,sizeof(pxkey_object),CLASS_PD|CLASS_NOINLET, A_NULL);
- add_anything(pxkey_class,pxkey_method);
- pxkey = (pxkey_object *)pd_new(pxkey_class);
-
- pd_bind(&pxkey_class,gensym("#keyname"));
-// pd_bind(&pxkey_class,gensym("#key"));
-// pd_bind(&pxkey_class,gensym("#keyup"));
-
- gcanv = NULL;
-
-#ifdef DIRECT_TK
- px_class = class_new(gensym("flext_gui proxy"),NULL,NULL,sizeof(px_object),CLASS_PD|CLASS_NOINLET, A_NULL);
- add_anything(px_class,px_method);
-
- gcm_motion = MakeSymbol("_tk_motion");
- gcm_mousekey = MakeSymbol("_tk_mousekey");
- gcm_mousewheel = MakeSymbol("_tk_mousewheel");
- gcm_key = MakeSymbol("_tk_key");
- gcm_destroy = MakeSymbol("_tk_destroy");
-#endif
-
- // this is wrong if a modifier key is pressed during creation of the first object.....
- curmod = 0;
-#else
- addmess((method)sg_update, "update", A_CANT, A_NULL);
- addmess((method)sg_click, "click", A_CANT, A_NULL);
- addmess((method)sg_psave, "psave", A_CANT, A_NULL);
- addmess((method)sg_bfont, "bfont", A_CANT, A_NULL);
- addmess((method)sg_key, "key", A_CANT, A_NULL);
- addmess((method)sg_bidle, "bidle", A_CANT, A_NULL);
-#endif
-}
-
-#ifdef PD
-
-int flext_gui::evmask = evMotion|evMouseDown|evKeyDown|evKeyUp;
-int flext_gui::curmod = 0;
-flext_gui::pxkey_object *flext_gui::pxkey = NULL;
-flext_gui::guicanv *flext_gui::gcanv = NULL;
-
-#ifdef DIRECT_TK
-const t_symbol *flext_gui::gcm_motion = NULL;
-const t_symbol *flext_gui::gcm_mousekey = NULL;
-const t_symbol *flext_gui::gcm_mousewheel = NULL;
-const t_symbol *flext_gui::gcm_key = NULL;
-const t_symbol *flext_gui::gcm_destroy = NULL;
-
-void flext_gui::px_method(px_object *obj,const t_symbol *s,int argc,t_atom *argv)
-{
- guicanv *ix = gcanv;
- for(; ix && ix->canv != obj->canv; ix = ix->nxt);
-
- if(ix) {
- CBParams parms;
-
- if(s == gcm_motion) {
- parms.kind = evMotion;
- parms.pMotion.x = GetAInt(argv[0]);
- parms.pMotion.y = GetAInt(argv[1]);
- parms.pMotion.mod = GetAInt(argv[2]);
- }
- else if(s == gcm_mousekey) {
- parms.kind = GetAInt(argv[0])?evMouseDown:evMouseUp;
- parms.pMouseKey.x = GetAInt(argv[1]);
- parms.pMouseKey.y = GetAInt(argv[2]);
- parms.pMouseKey.b = GetAInt(argv[3]);
- parms.pMouseKey.mod = GetAInt(argv[4]);
- }
- else if(s == gcm_mousewheel) {
- parms.kind = evMouseWheel;
- parms.pMouseWheel.x = GetAInt(argv[0]);
- parms.pMouseWheel.y = GetAInt(argv[1]);
- parms.pMouseWheel.mod = GetAInt(argv[2]);
- parms.pMouseWheel.delta = GetAInt(argv[3]);
- }
- else if(s == gcm_key) {
- parms.kind = GetAInt(argv[0])?evKeyDown:evKeyUp;
- parms.pKey.k = GetAInt(argv[1]);
- parms.pKey.a = GetAInt(argv[2]);
-// parms.pKey.n = GetAInt(argv[3]);
- parms.pKey.mod = GetAInt(argv[4]);
- }
- else if(s == gcm_destroy) {
-// post("TK destroy");
- DelCanvas(ix->canv);
- }
-
- if(parms.kind != evNone) {
- for(canvobj *co = ix->head; co; co = co->nxt)
- co->guiobj->m_Method(parms);
- }
-
- }
- else
- error("flext_gui: canvas not found!");
-}
-
-#endif
-
-static const char *extkeys[] = {
- "Escape","F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12",
- "Prior","Next","Home","End","Delete","Insert",""
-};
-
-void flext_gui::pxkey_method(pxkey_object *obj,const t_symbol *s,int argc,t_atom *argv)
-{
-/*
- if(s == sym_float && argc == 1) {
- lastkey = GetInt(argv[0]);
- }
- else
-*/
- if(s == sym_list && argc == 2) {
- CBParams p;
-
- bool down = GetABool(argv[0]);
- const char *str = GetString(argv[1]);
- int code = str[0];
- int asc = code;
- int mod = mod_None;
- if(code && str[1] != 0) {
- code = asc = 0;
- if(GetSymbol(argv[1]) == MakeSymbol("Shift_L") || GetSymbol(argv[1]) == MakeSymbol("Shift_R")) {
- code = 2001;
- mod = mod_Shift;
- }
- else if(GetSymbol(argv[1]) == MakeSymbol("Control_L") || GetSymbol(argv[1]) == MakeSymbol("Control_R")) {
- code = 2002;
- mod = mod_Ctrl;
- }
- else if(GetSymbol(argv[1]) == MakeSymbol("Alt_L") || GetSymbol(argv[1]) == MakeSymbol("Alt_R")) {
- code = 2003;
- mod = mod_Alt;
- }
- else {
- for(int i = 0;; ++i) {
- const char *ci = extkeys[i];
- if(!*ci) break;
- if(GetSymbol(argv[1]) == MakeSymbol(ci)) {
- code = 1000+i;
- break;
- }
- }
- }
-#ifdef DEBUG
- else
- post("unknown modifier %s",str);
-#endif
- }
-
- if(down) curmod |= mod;
- else curmod &= ~mod;
-
-// post("Key down=%i c=%c mod=%i",down?1:0,code,curmod);
-
- if(code || mod) {
- // button is pressed
- p.kind = down?evKeyDown:evKeyUp;
- p.ext = true;
- p.pKey.k = code; //lastkey;
- p.pKey.a = asc;
- p.pKey.mod = curmod;
-
- for(guicanv *ix = gcanv; ix; ix = ix->nxt)
- for(canvobj *ci = ix->head; ci; ci = ci->nxt)
- ci->guiobj->m_Method(p);
- }
- }
- else
- post("flext_gui key proxy - unknown method");
-}
-
-
-flext_gui::guicanv::guicanv(t_canvas *c):
- canv(c),nxt(NULL),ref(0),
- head(NULL),tail(NULL)
-{
- char tmp[25];
- sprintf(tmp,"FLCANV%x",c);
- sym = MakeSymbol(tmp);
-
-#ifdef DIRECT_TK
- // proxy for canvas messages
- (px = (px_object *)pd_new(px_class))->init(c);
-#endif
-}
-
-flext_gui::guicanv::~guicanv()
-{
-#ifdef DIRECT_TK
- if(px) pd_free(&px->obj.ob_pd);
-#endif
-}
-
-void flext_gui::guicanv::Push(flext_gui *o)
-{
- canvobj *co = new canvobj(o);
- if(tail) tail->nxt = co;
- tail = co;
- if(!head) head = tail;
-
- ++ref;
-}
-
-void flext_gui::guicanv::Pop(flext_gui *o)
-{
- canvobj *prv = NULL,*ix = head;
- for(; ix && ix->guiobj != o; prv = ix,ix = ix->nxt);
-
- if(ix) {
- --ref;
- if(prv) prv->nxt = ix->nxt;
- else head = ix->nxt;
- if(!ix->nxt) tail = prv;
- }
- else
- error("flext_gui: object not found in canvas!");
-}
-
-
-void flext_gui::AddCanvas()
-{
- t_canvas *c = thisCanvas();
- guicanv *prv = NULL,*ix = gcanv;
- for(; ix && ix->canv != c; prv = ix,ix = ix->nxt);
-
- if(ix) {
- ix->Push(this);
- }
- else {
- guicanv *nc = new guicanv(c);
- if(prv) prv->nxt = nc;
- else gcanv = nc;
-
- nc->Push(this);
-
-#ifdef DIRECT_TK
- pd_bind(&nc->px->obj.ob_pd,(t_symbol *)nc->sym);
-
-/*
- // initialize new canvas object
- sys_vgui("bind .x%x.c <Motion> {pd %s %s %%x %%y %%s \\;}\n",c,GetString(nc->sym),GetString(gcm_motion));
-
- sys_vgui("bind .x%x.c <ButtonPress> {pd %s %s 1 %%x %%y %%b %%s \\;}\n",c,GetString(nc->sym),GetString(gcm_mousekey));
- sys_vgui("bind .x%x.c <ButtonRelease> {pd %s %s 0 %%x %%y %%b %%s \\;}\n",c,GetString(nc->sym),GetString(gcm_mousekey));
- sys_vgui("bind .x%x.c <MouseWheel> {pd %s %s %%x %%y %%s %%D \\;}\n",c,GetString(nc->sym),GetString(gcm_mousewheel));
- sys_vgui("bind .x%x.c <KeyPress> {pd %s %s 1 %%k %%A %%N %%s \\;}\n",c,GetString(nc->sym),GetString(gcm_key));
- sys_vgui("bind .x%x.c <KeyRelease> {pd %s %s 0 %%k %%A %%N %%s \\;}\n",c,GetString(nc->sym),GetString(gcm_key));
-
- // what happend to objects in subpatchers?
- sys_vgui("bind .x%x.c <Destroy> {pd %s %s \\;}\n",c,GetString(nc->sym),GetString(gcm_destroy));
-
- // sys_vgui("bind .x%x.c <Visibility> {pd %s %s %x %s \\;}\n",c,GetString(nc->sym),"_tk_visibility",this);
-*/
-#endif
- }
-}
-
-void flext_gui::RmvCanvas()
-{
- guicanv *ix = gcanv;
- for(; ix && ix->canv != thisCanvas(); ix = ix->nxt);
-
- if(ix) {
- ix->Pop(this);
- if(!ix->Refs()) DelCanvas(thisCanvas());
- }
- else {
- error("flext_gui: Canvas not found!");
- }
-}
-
-void flext_gui::DelCanvas(t_canvas *c)
-{
- guicanv *prv = NULL,*ix = gcanv;
- for(; ix && ix->canv != c; prv = ix,ix = ix->nxt);
-
- if(ix) {
-#ifdef DIRECT_TK
- pd_unbind(&ix->px->obj.ob_pd,(t_symbol *)ix->sym);
-#endif
-
- if(prv) prv->nxt = ix->nxt;
- else gcanv = ix->nxt;
- }
- else {
- error("flext_gui: Canvas not found!");
- }
-}
-
-static GuiObj *GetGuiObj(const t_atom &a)
-{
- GuiObj *th = NULL;
- sscanf(flext::GetString(a),"%x",&th);
- return th;
-}
-
-void flext_gui::g_Displace(int dx, int dy)
-{
-// post("Displace");
-
- XLo(XLo()+dx);
- YLo(YLo()+dy);
-
- Group().MoveRel(dx,dy);
- FixLines();
-}
-
-void flext_gui::g_Delete()
-{
- objs->Clear();
- DelLines();
-}
-
-
-
-t_widgetbehavior flext_gui::widgetbehavior;
-
-void flext_gui::SetWidget(t_class *c)
-{
- // widgetbehavior struct MUST be resident... (static is just ok here)
-
- widgetbehavior.w_getrectfn = sg_getrect;
- widgetbehavior.w_displacefn = sg_displace;
- widgetbehavior.w_selectfn = sg_select;
- widgetbehavior.w_activatefn = NULL; //sg_activate;
- widgetbehavior.w_deletefn = sg_delete;
- widgetbehavior.w_visfn = sg_vis;
- widgetbehavior.w_clickfn = sg_click;
- widgetbehavior.w_propertiesfn = sg_properties;
- widgetbehavior.w_savefn = sg_save;
- class_setwidget(c, &widgetbehavior);
-}
-
-void flext_gui::sg_getrect(t_gobj *c, t_glist *,int *xp1, int *yp1, int *xp2, int *yp2)
-{
- flext_gui *th = thisObject(c);
- /*th->g_GetRect(*xp1,*yp1,*xp2,*yp2);*/
- *xp1 = th->XLo(),*yp1 = th->YLo(),*xp2 = th->XHi(),*yp2 = th->YHi();
-}
-
-void flext_gui::sg_displace(t_gobj *c, t_glist *, int dx, int dy)
-{
- thisObject(c)->g_Displace(dx,dy);
-}
-
-void flext_gui::sg_select(t_gobj *c, t_glist *, int selected)
-{
-// post("Select");
-
- flext_gui *th = thisObject(c);
- th->g_Edit(th->selected = (selected != 0));
-}
-
-void flext_gui::sg_vis(t_gobj *c, t_glist *, int vis)
-{
- post("Visible %i",vis);
-
- if(vis) {
- flext_gui *g = thisObject(c);
- g->g_Create();
- g->Group().MoveRel(g->XLo(),g->YLo());
- g->FixLines();
- }
-}
-
-int flext_gui::sg_click(t_gobj *c, t_glist *,int xpix, int ypix, int shift, int alt, int dbl, int doit)
-{
- flext_gui *g = thisObject(c);
- CBParams p;
- int x = xpix-g->XLo();
- int y = ypix-g->YLo();
-
- // PD bug: shift isn't reported for idle mousing
-// int mod = (alt?mod_Alt:0)+(shift?mod_Shift:0)+(dbl?mod_Double:0);
-
- if(doit) {
- // button is pressed
- p.kind = evMouseDown;
- p.pMouseKey.x = x;
- p.pMouseKey.y = y;
- p.pMouseKey.b = 1;
- p.pMouseKey.mod = curmod; //mod;
- }
- else {
- // only mouse position change
- p.kind = evMotion;
- p.pMotion.x = x;
- p.pMotion.y = y;
- p.pMotion.mod = curmod; //mod;
- }
- g->m_Method(p);
- return 1;
-}
-
-void flext_gui::sg_delete(t_gobj *c, t_glist *)
-{
- thisObject(c)->g_Delete();
-}
-
-void flext_gui::sg_properties(t_gobj *c, t_glist *)
-{
- thisObject(c)->g_Properties();
-}
-
-void flext_gui::sg_save(t_gobj *c, t_binbuf *b)
-{
- thisObject(c)->g_Save(b);
-}
-
-/*
-bool flext_gui::sg_Key(flext_base *c,int argc,t_atom *argv)
-{
- return true;
-}
-
-bool flext_gui::sg_KeyNum(flext_base *c,int &keynum)
-{
- flext_gui *g = dynamic_cast<flext_gui *>(c);
- post("KeyNum %i",keynum);
- return true;
-}
-
-bool flext_gui::sg_KeyUp(flext_base *c,int &keynum)
-{
- flext_gui *g = dynamic_cast<flext_gui *>(c);
- post("KeyUp %i",keynum);
- return true;
-}
-*/
-
-#else // MAXMSP
-
-int flext_gui::evmask = evMotion|evMouseDown|evKeyDown;
-
-static void dragfun()
-{
-}
-
-static void tmfun()
-{
-}
-
-void flext_gui::sg_click(t_object *x, Point pt, short m)
-{
- flext_gui *g = thisObject(x);
- CBParams p(evMouseDown);
- p.pMouseKey.x = pt.h-g->XLo();
- p.pMouseKey.y = pt.v-g->YLo();
- p.pMouseKey.b = 0;
- p.pMouseKey.mod = (m&256?mod_Meta:0)+(m&512?mod_Shift:0)+(m&1024?mod_Caps:0)+(m&2048?mod_Alt:0)+(m&4096?mod_Ctrl:0);
- g->m_Method(p);
-}
-
-void flext_gui::sg_update(t_object *x)
-{
- flext_gui *g = thisObject(x);
- if(!g->created) { g->g_Create(); g->created = true; }
-
- // draw elements
- g->Update();
-}
-
-void flext_gui::sg_psave (t_object *x, t_binbuf *dest) { thisObject(x)->g_Save(dest); }
-
-void flext_gui::sg_bfont (t_object *x, short size, short font) {}
-
-void flext_gui::sg_key (t_object *x, short keyvalue)
-{
- flext_gui *g = thisObject(x);
-
- CBParams p(evKeyDown);
- p.pKey.k = keyvalue;
- p.pKey.a = 0;
- p.pKey.mod = 0;
- g->m_Method(p);
-}
-
-void flext_gui::sg_enter (t_object *x) {}
-
-void flext_gui::sg_clipregion (t_object *x, RgnHandle *rgn, short *result) {}
-
-void flext_gui::sg_bidle (t_object *x)
-{
- flext_gui *g = thisObject(x);
- Point pnt; GetMouse(&pnt);
-
- CBParams p(evMotion);
- p.pMotion.x = pnt.h-g->XLo();
- p.pMotion.y = pnt.v-g->YLo();
- p.pMotion.mod = 0;
-
- if(p.pMotion.x != g->curx || p.pMotion.y != g->cury || p.pMotion.mod != g->curmod) {
- g->m_Method(p);
- g->curx = p.pMotion.x;
- g->cury = p.pMotion.y;
- g->curmod = p.pMotion.mod;
- }
-}
-
-void flext_gui::g_Displace(int dx, int dy)
-{
-}
-
-void flext_gui::g_Delete()
-{
- objs->Clear();
-}
-
-void flext_gui::Update()
-{
- box_ready(&thisHdr()->z_box);
-
- if(Group().Canv().Pre(XLo(),YLo()))
- Group().Draw();
- Group().Canv().Post();
-}
-
-#endif // PD / MAXMSP
-
-void flext_gui::m_Method(const CBParams &p)
-{
-/*
- switch(p.kind) {
- case evMotion: {
- // if(!g->Selected() || mod)
- post("Motion: x=%i y=%i m=%i",p.pMotion.x,p.pMotion.y,p.pMotion.mod);
- break;
- }
- case evMouseDown: {
- post("MouseDown: x=%i y=%i b=%i m=%i",p.pMouseKey.x,p.pMouseKey.y,p.pMouseKey.b,p.pMouseKey.mod);
- break;
- }
- case evMouseUp: {
- post("MouseUp: x=%i y=%i b=%i m=%i",p.pMouseKey.x,p.pMouseKey.y,p.pMouseKey.b,p.pMouseKey.mod);
- break;
- }
- case evMouseWheel: {
- post("Mousewheel: x=%i y=%i m=%i d=%i",p.pMouseWheel.x,p.pMouseWheel.y,p.pMouseWheel.mod,p.pMouseWheel.delta);
- break;
- }
- case evKeyDown: {
- post("KeyDown: k=%i a=%i m=%i",p.pKey.k,p.pKey.a,p.pKey.mod);
- break;
- }
- case evKeyUp: {
- post("KeyUp: k=%i a=%i m=%i",p.pKey.k,p.pKey.a,p.pKey.mod);
- break;
- }
- }
-*/
- if(!Selected() || p.kind != evMotion || p.kind != evMouseDown || p.kind != evMouseUp)
- Group().Method(*this,p);
- }
-
-bool flext_gui::BindEvent(GuiSingle &o,bool (*cb)(flext_gui &o,GuiSingle &obj,const CBParams &p),int evs)
-{
- if((evs&EventMask()) == evs) {
- o.AddEvent(evs,cb);
- return true;
- }
- else
- // not all requested events supported
- return false;
-}
-
-void flext_gui::UnbindEvent(GuiSingle &o,bool (*cb)(flext_gui &o,GuiSingle &obj,const CBParams &p),int evs)
-{
- o.RmvEvent(evs,cb);
-}
-
-
diff --git a/externals/grill/guitest/flgui.h b/externals/grill/guitest/flgui.h
deleted file mode 100644
index ac42ab7b..00000000
--- a/externals/grill/guitest/flgui.h
+++ /dev/null
@@ -1,232 +0,0 @@
-#ifndef __FLEXT_GUI
-#define __FLEXT_GUI
-
-#define FLEXT_GUI
-#include <flext.h>
-
-#ifdef PD
-#pragma warning( disable : 4091 )
-#include <g_canvas.h>
-#endif
-
-class Canvas;
-class GuiObj;
-class GuiGroup;
-class GuiSingle;
-
-class flext_gui:
- virtual public flext_base
-{
- FLEXT_HEADER_S(flext_gui,flext_base,setup)
-
-public:
- flext_gui(int xs,int ys);
- ~flext_gui();
-
- enum CBEvs {
- evNone = 0,
- evMotion = 0x01,
- evMouseDown = 0x02,
- evMouseUp = 0x04,
- evMouseWheel = 0x08,
- evKeyDown = 0x10,
- evKeyUp = 0x20
- };
-
- class CBParams {
- public:
- CBParams(CBEvs k = evNone): kind(k),ext(false) {}
-
- CBEvs kind;
- union {
- struct { int x,y,mod; } pMotion;
- struct { int x,y,b,mod; } pMouseKey;
- struct { int x,y,mod,delta; } pMouseWheel;
- struct { int k,a,mod; } pKey;
- };
- bool ext;
- };
-
- static int EventMask() { return evmask; }
-
- bool BindEvent(GuiSingle &o,bool (*cb)(flext_gui &o,GuiSingle &obj,const CBParams &p),int evs);
- void UnbindEvent(GuiSingle &o,bool (*cb)(flext_gui &o,GuiSingle &obj,const CBParams &p),int evs);
-
-protected:
-
- virtual void g_Create() {}
- virtual void g_Delete();
-// virtual void g_GetRect(int &xp1,int &yp1,int &xp2,int &yp2);
- virtual void g_Edit(bool selected) {}
- virtual void g_Displace(int dx, int dy);
-// virtual void g_Activate(bool state) {}
-// virtual int g_Click(int xpix, int ypix, int shift, int alt, int dbl, int doit) { return 0; }
- virtual void g_Properties() {}
- virtual void g_Save(t_binbuf *b) {}
-/*
- virtual bool g_Motion(GuiObj &obj,int x,int y,int mod) { return false; }
- virtual bool g_MouseKey(GuiObj &obj,bool down,int x,int y,int b,int mod) { return false; }
- virtual bool g_MouseWheel(GuiObj &obj,int x,int y,int d,int mod) { return false; }
- virtual bool g_Key(GuiObj &obj,bool down,int k,int a,int n,int mod) { return false; }
- virtual bool g_Region(GuiObj &obj,bool on,int mod) { return false; }
- virtual bool g_Focus(GuiObj &obj,bool on,int mod) { return false; }
-*/
-
-#ifdef PD
- bool Selected() const { return selected; }
-
- void FixLines() { canvas_fixlinesfor( thisCanvas(), thisHdr() ); }
- void DelLines() { canvas_deletelinesfor( glist_getcanvas(thisCanvas()), (t_text *)thisHdr()); }
-
- int XLo() const { return thisHdr()->te_xpix; }
- int YLo() const { return thisHdr()->te_ypix; }
- int XHi() const { return XLo()+XSize()-1; }
- int YHi() const { return YLo()+YSize()-1; }
- void XLo(int x) { thisHdr()->te_xpix = x; }
- void YLo(int y) { thisHdr()->te_ypix = y; }
-
- int XSize() const { return xsize; }
- int YSize() const { return ysize; }
-#else // MAXMSP
- bool Selected() const { return box_ownerlocked((t_box *)(&thisHdr()->z_box)) == 0; }
-
- void FixLines() {}
- void DelLines() {}
-
- int XLo() const { return thisHdr()->z_box.b_rect.left; }
- int YLo() const { return thisHdr()->z_box.b_rect.top; }
- int XHi() const { return thisHdr()->z_box.b_rect.right; }
- int YHi() const { return thisHdr()->z_box.b_rect.bottom; }
- void XLo(int x) { thisHdr()->z_box.b_rect.left = x; }
- void YLo(int y) { thisHdr()->z_box.b_rect.top = y; }
-
- int XSize() const { return XHi()-XLo()+1; }
- int YSize() const { return YHi()-YLo()+1; }
-#endif
-
- const t_symbol *Id() const { return bindsym; }
-
- GuiGroup &Group() { return *objs; }
-
-
- static void Setup(t_class *c);
-
-
- enum Modifier {
- mod_None = 0,
- mod_Ctrl = 0x0001,
- mod_Shift = 0x0002,
- mod_Alt = 0x0004,
- mod_Meta = 0x0008,
- mod_Mod1 = 0x0010,
- mod_Mod2 = 0x0020,
- mod_Mod3 = 0x0040,
- mod_Caps = 0x0080,
- mod_Double = 0x0100,
-// mod_Triple = 0x0200,
- mod_Button1 = 0x1000,
- mod_Button2 = 0x2000,
- mod_Button3 = 0x4000,
- mod_Button4 = 0x8000
- };
-
-private:
- bool visible;
- Canvas *canvas;
- GuiGroup *objs;
-
- const t_symbol *bindsym;
-
- static int evmask;
-
- static void setup(t_class *);
-
- virtual void m_Method(const CBParams &p);
-
-#ifdef PD
- bool selected;
- int xsize,ysize;
-
- static void sg_getrect(t_gobj *c, t_glist *,int *xp1, int *yp1, int *xp2, int *yp2);
- static void sg_displace(t_gobj *c, t_glist *, int dx, int dy);
- static void sg_select(t_gobj *c, t_glist *, int selected);
-// static void sg_activate(t_gobj *c, t_glist *, int state) { thisObject(c)->g_Activate(state != 0); }
- static void sg_delete(t_gobj *c, t_glist *);
- static void sg_vis(t_gobj *c, t_glist *, int vis);
- static int sg_click(t_gobj *c, t_glist *,int xpix, int ypix, int shift, int alt, int dbl, int doit);
- static void sg_properties(t_gobj *c, t_glist *);
- static void sg_save(t_gobj *c, t_binbuf *b);
-// static void sg_motion(void *c, float dx,float dy) { thisObject((t_gobj *)c)->g_Motion(dx,dy); }
-
- static bool sg_Key(flext_base *c,int argc,t_atom *argv);
- static bool sg_KeyNum(flext_base *c,int &keynum);
- static bool sg_KeyUp(flext_base *c,int &keynum);
-
- static t_widgetbehavior widgetbehavior;
- static void SetWidget(t_class *c);
-
- struct px_object;
- struct pxkey_object;
- static int curmod; //,lastkey;
- static pxkey_object *pxkey;
-
- class canvobj {
- public:
- canvobj(flext_gui *go): guiobj(go),nxt(NULL) {}
-
- flext_gui *guiobj;
- canvobj *nxt;
- };
-
- class guicanv {
- public:
- guicanv(t_canvas *c);
- ~guicanv();
-
- int Refs() const { return ref; }
- void Push(flext_gui *o);
- void Pop(flext_gui *o);
-
-#ifdef DIRECT_TK
- px_object *px;
-#endif
- const t_symbol *sym;
- t_canvas *canv;
- guicanv *nxt;
- canvobj *head,*tail;
- int ref;
- };
-
- static guicanv *gcanv;
- static const t_symbol *gcm_motion,*gcm_mousekey,*gcm_mousewheel,*gcm_key,*gcm_destroy;
- static void px_method(px_object *c,const t_symbol *s,int argc,t_atom *argv);
- static void pxkey_method(pxkey_object *c,const t_symbol *s,int argc,t_atom *argv);
-
- void AddCanvas();
- void RmvCanvas();
- static void DelCanvas(t_canvas *c);
-
-public:
- static t_class *px_class,*pxkey_class;
- static void sg_tk(t_canvas *c,const t_symbol *s,int argc,t_atom *argv);
-
-#else
- int curx,cury,curmod;
- bool created;
- static t_clock clock;
- static t_qelem qelem;
-
- void Update();
-
- static void sg_click(t_object *x, Point pt, short modifiers);
- static void sg_update(t_object *x);
- static void sg_psave (t_object *x, t_binbuf *dest);
- static void sg_bfont (t_object *x, short size, short font);
- static void sg_key (t_object *x,short keyvalue);
- static void sg_enter (t_object *x);
- static void sg_clipregion (t_object *x, RgnHandle *rgn, short *result);
- static void sg_bidle(t_object *x);
-#endif
-};
-
-#endif
diff --git a/externals/grill/guitest/flguiobj.cpp b/externals/grill/guitest/flguiobj.cpp
deleted file mode 100644
index b845ae5e..00000000
--- a/externals/grill/guitest/flguiobj.cpp
+++ /dev/null
@@ -1,801 +0,0 @@
-#include "flguiobj.h"
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <stdarg.h>
-
-
-#define USETAGS
-
-#define BUFSIZE 20000
-#define ZONE 1000
-
-
-#ifdef PD
-bool Canvas::store = true;
-bool Canvas::debug = false;
-#endif
-
-Canvas::Canvas(t_canvas *c):
- canvas(c)
-#ifdef PD
- ,buffer(new char[BUFSIZE]),bufix(0),waiting(0)
-#endif
-{}
-
-Canvas::~Canvas()
-{
-#ifdef PD
- if(buffer) delete[] buffer;
-#endif
-}
-
-#ifdef PD
-void Canvas::Send(const char *t)
-{
- if(debug) post("GUI - %s",t);
- sys_gui((char *)t);
-}
-
-void Canvas::SendBuf()
-{
- if(bufix) {
- Send(buffer);
- bufix = 0;
- }
-}
-
-void Canvas::ToBuf(const char *t)
-{
- int len = strlen(t);
- if(!len) return;
-
- bool end = t[len-1] == '\n';
- if((store && waiting) || !end) {
- int nxt = bufix+len;
- if(nxt >= BUFSIZE || (end && nxt >= BUFSIZE-ZONE)) SendBuf();
-
- memcpy(buffer+bufix,t,len);
- buffer[bufix += len] = 0;
- }
- else {
- SendBuf();
- Send(t);
- }
-}
-
-Canvas &Canvas::TkC()
-{
- char tmp[20];
- sprintf(tmp,".x%x.c ",canvas);
- ToBuf(tmp);
- return *this;
-}
-
-Canvas &Canvas::TkE()
-{
- ToBuf("\n");
- return *this;
-}
-
-Canvas &Canvas::Tk(char *fmt,...)
-{
- // int result, i;
- char buf[2048];
- va_list ap;
-
- va_start(ap, fmt);
- vsprintf(buf, fmt, ap);
- ToBuf(buf);
- va_end(ap);
- return *this;
-}
-#endif
-
-bool Canvas::Pre(int x,int y)
-{
- xpos = x,ypos = y;
-#ifdef PD
- ++waiting;
- return true;
-#else
- svgp = patcher_setport(canvas);
- if(svgp != NULL) {
- GetForeColor(&svcol);
- GetPenState(&svpen);
- ::PenMode(patCopy);
- return true;
- }
- else return false;
-#endif
-}
-
-void Canvas::Post()
-{
-#ifdef PD
- if(!--waiting) SendBuf();
-#else
- if(svgp) {
- RGBForeColor(&svcol);
- SetPenState(&svpen);
- SetPort(svgp);
- }
-#endif
-}
-
-
-// --------------------------------------------------------------------------
-
-
-Rect &Rect::Add(const Pnt &p)
-{
- if(p.x < lo.x) lo.x = p.x;
- if(p.y < lo.y) lo.y = p.y;
- if(p.x > hi.x) hi.x = p.x;
- if(p.y > hi.y) hi.y = p.y;
- return *this;
-}
-
-Rect &Rect::Add(const Rect &r)
-{
- if(r.lo.x < lo.x) lo.x = r.lo.x;
- if(r.lo.y < lo.y) lo.y = r.lo.y;
- if(r.hi.x > hi.x) hi.x = r.hi.x;
- if(r.hi.y > hi.y) hi.y = r.hi.y;
- return *this;
-}
-
-bool Rect::In(const Pnt &p) const
-{
- return p.x >= lo.x && p.x <= hi.x && p.y >= lo.y && p.y <= hi.y;
-}
-
-bool Rect::Inter(const Rect &r) const
-{
- return true;
-}
-
-
-// --------------------------------------------------------------------------
-
-
-GuiObj::GuiObj(Canvas *c,GuiGroup *p):
- canvas(c),idsym(NULL),
- parent(p)
-// ,ori(0,0)
-{}
-
-GuiObj::~GuiObj()
-{
-// Delete();
-}
-
-
-// --------------------------------------------------------------------------
-
-GuiSingle::Event::Event(int evmask,bool (*m)(flext_gui &g,GuiSingle &obj,const flext_gui::CBParams &p)):
- methfl(evmask),method(m),ext(false),nxt(NULL)
-{}
-
-GuiSingle::Event::~Event() { if(nxt) delete nxt; }
-
-
-GuiSingle::GuiSingle(Canvas *c,GuiGroup *p,const t_symbol *s):
- GuiObj(c,p),sym(s),active(false),event(NULL)
-{
- char tmp[20];
-#ifdef __MWERKS__
- std::
-#endif
- sprintf(tmp,"GUI%x",this);
- idsym = MakeSymbol(tmp);
-}
-
-GuiSingle::~GuiSingle()
-{
- Delete();
- if(event) delete event;
-}
-
-void GuiSingle::Symbol(const t_symbol *s)
-{
- sym = s;
-}
-
-GuiSingle *GuiSingle::Find(const t_symbol *s)
-{
- return sym == s?this:NULL;
-}
-
-GuiObj &GuiSingle::MoveTo(int x,int y)
-{
-#ifdef PD
- if(active) {
- canvas->TkC().Tk("coords %s %i %i\n",GetString(Id()), x, y);
- }
-#endif
- rect.MoveTo(x,y);
- return *this;
-}
-
-GuiObj &GuiSingle::MoveRel(int dx,int dy)
-{
-#ifdef PD
- if(active) {
- canvas->TkC().Tk("move %s %i %i\n",GetString(Id()), dx, dy);
- }
-#endif
- rect.Move(dx,dy);
- return *this;
-}
-
-GuiObj &GuiSingle::Delete()
-{
-#ifdef PD
- if(active) {
- canvas->TkC().Tk("delete -tags %s\n",GetString(Id()));
- active = false;
- }
-#endif
- return *this;
-}
-
-GuiObj &GuiSingle::FillColor(unsigned long col)
-{
-#ifdef PD
- if(active) {
- canvas->TkC().Tk("itemconfigure %s -fill #%06x\n",GetString(Id()),col);
- }
-#endif
- return *this;
-}
-
-GuiObj &GuiSingle::Outline(unsigned long col)
-{
-#ifdef PD
- if(active) {
- canvas->TkC().Tk("itemconfigure %s -outline #%06x\n",GetString(Id()),col);
- }
-#endif
- return *this;
-}
-
-GuiObj &GuiSingle::Focus()
-{
-#ifdef PD
- if(active) {
- canvas->TkC().Tk("focus %s\n",GetString(Id()));
- }
-#endif
- return *this;
-}
-
-bool GuiSingle::Method(flext_gui &g,const flext_gui::CBParams &p)
-{
- bool ret = true;
- for(Event *ei = event; ei && ret; ei = ei->nxt)
- ret = ret && ((ei->method && (ei->methfl&p.kind))?ei->method(g,*this,p):true);
- return ret;
-}
-
-void GuiSingle::AddEvent(int evmask,bool (*m)(flext_gui &g,GuiSingle &obj,const flext_gui::CBParams &p))
-{
- Event *prv = NULL,*ix = event;
- for(; ix && ix->method != m; prv = ix,ix = ix->nxt) {}
-
- if(ix)
- // previous handler found -> update event mask
- ix->methfl |= evmask;
- else {
- // no previous handler was found -> make new one
-
- Event *nev = new Event(evmask,m);
- if(prv) prv->nxt = nev;
- else event = nev;
- }
-}
-
-void GuiSingle::RmvEvent(int evmask,bool (*m)(flext_gui &g,GuiSingle &obj,const flext_gui::CBParams &p))
-{
- Event *prv = NULL,*ix = event;
- for(; ix && ix->method != m; prv = ix,ix = ix->nxt) {}
-
- if(ix) {
- // handler found
-
- if(!(ix->methfl &= ~evmask)) {
- // mask has become zero -> remove handler
-
- if(prv) prv->nxt = ix->nxt;
- else event = ix->nxt;
- ix->nxt = NULL;
- delete ix;
- }
- }
-}
-
-
-
-// --------------------------------------------------------------------------
-
-
-GuiGroup::GuiGroup(Canvas *c,GuiGroup *p):
- GuiObj(c,p),head(NULL),tail(NULL)
-{
- char tmp[20];
-#ifdef __MWERKS__
- std::
-#endif
- sprintf(tmp,"GRP%x",this);
- idsym = MakeSymbol(tmp);
-}
-
-GuiGroup::~GuiGroup() { Clear(); }
-
-void GuiGroup::Clear()
-{
- for(Part *ix = head; ix; ) {
- Part *n = ix->nxt;
-#ifdef PD
- RemoveTag(ix->obj);
-#endif
- if(ix->owner) delete ix->obj;
- delete ix;
- ix = n;
- }
- head = tail = NULL;
-}
-
-void GuiGroup::Add(GuiObj *o,bool owner)
-{
- o->canvas = canvas;
-#ifdef PD
- AddTag(o); // valid only for GuiSingle!
-#endif
- Part *n = new Part(o,owner);
- if(!head) head = n;
- else tail->nxt = n;
- tail = n;
-
- rect.Add(o->rect);
-}
-
-GuiSingle *GuiGroup::Find(const t_symbol *s)
-{
- GuiSingle *r = NULL;
- for(Part *ix = head; ix && !r; ix = ix->nxt) {
- r = ix->obj->Find(s);
- }
- return r;
-}
-
-GuiSingle *GuiGroup::Detach(const t_symbol *s)
-{
- if(head) {
- Part *p = NULL,*ix = head;
- while(ix) {
- if(ix->obj->Symbol() == s) {
- // found
- if(p) p->nxt = ix->nxt;
- GuiSingle *ret = (GuiSingle *)(ix->obj);
-
-#ifdef PD
- RemoveTag(ret);
-#endif
- if(head == ix) head = ix->nxt;
- if(tail == ix) tail = p;
-
- delete ix;
-
- return ret;
- }
- else p = ix,ix = ix->nxt;
- }
- }
- return NULL;
-}
-
-GuiObj &GuiGroup::MoveRel(int dx,int dy)
-{
-#ifdef PD
- canvas->TkC().Tk("move %s %i %i\n",GetString(Id()), dx, dy);
-#endif
- for(Part *ix = head; ix; ix = ix->nxt) {
- ix->obj->rect.Move(dx,dy);
- }
- return *this;
-}
-
-GuiObj &GuiGroup::Delete()
-{
-#ifdef PD
- canvas->TkC().Tk("delete -tags %s\n",GetString(Id()));
-
- for(Part *ix = head; ix; ix = ix->nxt) ix->obj->Inactive();
-#endif
- return *this;
-}
-
-
-GuiObj &GuiGroup::Draw()
-{
- for(Part *ix = head; ix; ix = ix->nxt) ix->obj->Draw();
- return *this;
-}
-
-
-#ifdef PD
-
-void GuiGroup::AddTag(GuiObj *o)
-{
- canvas->TkC().Tk("addtag %s withtag %s\n",GetString(Id()),GetString(o->Id()));
-}
-
-void GuiGroup::RemoveTag(GuiObj *o)
-{
- canvas->TkC().Tk("dtag %s %s\n",GetString(o->Id()),GetString(Id()));
-}
-
-#endif
-
-GuiGroup *GuiGroup::Add_Group()
-{
- GuiGroup *obj = new GuiGroup(canvas,this);
- Add(obj);
- return obj;
-}
-
-
-GuiSingle *GuiGroup::Add_Point(int x,int y,long fill)
-{
- GuiPoint *obj = new GuiPoint(canvas,this);
- obj->Set(x,y,fill);
- Add(obj);
- return obj;
-}
-
-GuiSingle *GuiGroup::Add_Cloud(int n,const Pnt *p,long fill)
-{
- GuiCloud *obj = new GuiCloud(canvas,this);
- obj->Set(n,p,fill);
- Add(obj);
- return obj;
-}
-
-GuiSingle *GuiGroup::Add_Box(int x,int y,int xsz,int ysz,int width,long fill,long outl)
-{
- GuiBox *obj = new GuiBox(canvas,this);
- obj->Set(x,y,xsz,ysz,width,fill,outl);
- Add(obj);
- return obj;
-}
-
-GuiSingle *GuiGroup::Add_Rect(int x,int y,int xsz,int ysz,int width,long outl)
-{
- GuiRect *obj = new GuiRect(canvas,this);
- obj->Set(x,y,xsz,ysz,width,outl);
- Add(obj);
- return obj;
-}
-
-GuiSingle *GuiGroup::Add_Line(int x1,int y1,int x2,int y2,int width,long fill)
-{
- GuiLine *obj = new GuiLine(canvas,this);
- obj->Set(x1,y1,x2,y2,width,fill);
- Add(obj);
- return obj;
-}
-
-GuiSingle *GuiGroup::Add_Poly(int n,const Pnt *p,int width,long fill)
-{
- GuiPoly *obj = new GuiPoly(canvas,this);
- obj->Set(n,p,width,fill);
- Add(obj);
- return obj;
-}
-
-GuiSingle *GuiGroup::Add_Text(int x,int y,const char *txt,long fill,GuiText::just_t just)
-{
- GuiText *obj = new GuiText(canvas,this);
- obj->Set(x,y,txt,fill,just);
- Add(obj);
- return obj;
-}
-
-GuiSingle *GuiGroup::Remove(GuiSingle *go)
-{
- for(Part *prv = NULL,*ix = head; ix; prv = ix,ix = ix->nxt)
- if(ix->obj == go) {
- if(prv) prv->nxt = ix->nxt;
- else head = ix->nxt;
- if(!head) tail = NULL;
-
- GuiObj *ret = ix->obj;
- delete ix;
-
- if(head) {
- rect = head->obj->rect;
- for(ix = head->nxt; ix; ix = ix->nxt) rect.Add(ix->obj->rect);
- }
-
- return (GuiSingle *)ret;
- }
-
- return NULL;
-}
-
-bool GuiGroup::Method(flext_gui &g,const flext_gui::CBParams &p)
-{
- bool go = true;
- for(Part *ix = head; go && ix; ix = ix->nxt) go = go && ix->obj->Method(g,p);
- return go;
-}
-
-
-// --------------------------------------------------------------------------
-
-
-GuiObj &GuiPoint::Set(int x,int y,long fl)
-{
- Delete();
- fill = fl;
- rect(x,y,x,y);
-
-#ifdef PD
- canvas->TkC();
- canvas->Tk("create line %i %i %i %i -tags %s",x,y,x+1,y,GetString(Id()));
- if(fill >= 0) canvas->Tk(" -fill #%06x",fill);
- canvas->TkE();
-
- active = true;
-#endif
- return *this;
-}
-
-GuiObj &GuiPoint::Draw()
-{
-#ifdef MAXMSP
-#endif
- return *this;
-}
-
-
-GuiObj &GuiCloud::Set(int n,const Pnt *p,long fl)
-{
- int i;
- Delete();
-
- fill = fl;
- pnt = new Pnt[pnts = n];
- rect(pnt[0] = p[0],p[0]);
- for(i = 1; i < n; ++i) rect.Add(pnt[i] = p[i]);
-
-#ifdef PD
- canvas->TkC().Tk("create line");
- for(i = 0; i < n; ++i)
- canvas->Tk(" %i %i",p[i].X(),p[i].Y());
- canvas->Tk(" -tags %s",GetString(Id()));
- if(fill >= 0) canvas->Tk(" -fill #%06x",fill);
- canvas->TkE();
-
- active = true;
-#endif
- return *this;
-}
-
-GuiObj &GuiCloud::Draw()
-{
-#ifdef MAXMSP
-#endif
- return *this;
-}
-
-GuiObj &GuiCloud::Delete()
-{
- if(pnt) { delete[] pnt; pnt = NULL; }
- return *this;
-}
-
-
-GuiObj &GuiBox::Set(int x,int y,int xsz,int ysz,int wd,long fl,long outl)
-{
- Delete();
- rect(x,y,x+xsz-1,y+ysz-1);
- width = wd,fill = fl,outln = outl;
-
-#ifdef PD
- canvas->TkC().Tk("create rectangle %i %i %i %i -tags %s",x,y,x+xsz,y+ysz,GetString(Id()));
- if(wd >= 0) canvas->Tk(" -width %i",wd);
- if(fl >= 0) canvas->Tk(" -fill #%06x",fl);
- if(outl >= 0) canvas->Tk(" -outline #%06x",outl);
- canvas->TkE();
-
- active = true;
-#endif
- return *this;
-}
-
-GuiObj &GuiBox::Draw()
-{
-#ifdef MAXMSP
- ::Rect r;
- ::RGBColor col;
- int w = width;
- if(!w) w = 1;
-
- r.left = Canv().X()+rect.Lo().X();
- r.top = Canv().Y()+rect.Lo().Y();
- r.right = Canv().X()+rect.Hi().X();
- r.bottom = Canv().Y()+rect.Hi().Y();
-
- if(width >= 0) {
- col.red = (outln>>8)&0xff00;
- col.green = outln&0xff00;
- col.blue = (outln&0xff)<<8;
- ::RGBForeColor(&col);
- ::PenSize(w,w);
- ::FrameRect(&r);
- }
- col.red = (fill>>8)&0xff00;
- col.green = fill&0xff00;
- col.blue = (fill&0xff)<<8;
- ::RGBForeColor(&col);
- ::PaintRect(&r);
-#endif
- return *this;
-}
-
-
-GuiObj &GuiRect::Set(int x,int y,int xsz,int ysz,int wd,long outl)
-{
- Delete();
- rect(x,y,x+xsz-1,y+ysz-1);
- width = wd,outln = outl;
-
-#ifdef PD
- canvas->TkC().Tk("create line %i %i %i %i %i %i %i %i %i %i -tags %s",x,y,x+xsz,y,x+xsz,y+ysz,x,y+ysz,x,y,GetString(Id()));
- if(width >= 0) canvas->Tk(" -width %i",width);
- if(outl >= 0) canvas->Tk(" -fill #%06x",outl);
- canvas->TkE();
-
- active = true;
-#endif
- return *this;
-}
-
-GuiObj &GuiRect::Draw()
-{
-#ifdef MAXMSP
-#endif
- return *this;
-}
-
-
-GuiObj &GuiLine::Set(int x1,int y1,int x2,int y2,int wd,long fl)
-{
- Delete();
- rect(p1(x1,y1),p2(x2,y2));
- width = wd,fill = fl;
-
-#ifdef PD
- canvas->TkC().Tk("create line %i %i %i %i -tags %s",x1,y1,x2,y2,GetString(Id()));
- if(width >= 0) canvas->Tk(" -width %i",width);
- if(fill >= 0) canvas->Tk(" -fill #%06x",fill);
- canvas->TkE();
-
- active = true;
-#endif
- return *this;
-}
-
-GuiObj &GuiLine::Draw()
-{
-#ifdef MAXMSP
- ::Point p;
- ::RGBColor col;
- int w = width;
- if(!w) w = 1;
-
- col.red = (fill>>8)&0xff00;
- col.green = fill&0xff00;
- col.blue = (fill&0xff)<<8;
- ::RGBForeColor(&col);
- ::PenSize(w,w);
- p.h = Canv().X()+p1.X();
- p.v = Canv().Y()+p1.Y();
- ::MoveTo(p.h,p.v);
- p.h = Canv().X()+p2.X();
- p.v = Canv().Y()+p2.Y();
- ::LineTo(p.h,p.v);
-#endif
- return *this;
-}
-
-
-GuiObj &GuiPoly::Set(int n,const Pnt *p,int wd,long fl)
-{
- int i;
-
- Delete();
-
- width = wd,fill = fl;
- pnt = new Pnt[pnts = n];
- rect(pnt[0] = p[0],p[0]);
- for(i = 1; i < n; ++i) rect.Add(pnt[i] = p[i]);
-
-#ifdef PD
- canvas->TkC().Tk("create line");
- for(i = 0; i < n; ++i)
- canvas->Tk(" %i %i",p[i].X(),p[i].Y());
- canvas->Tk(" -tags %s",GetString(Id()));
- if(width >= 0) canvas->Tk(" -width %i",width);
- if(fill >= 0) canvas->Tk(" -fill #%06x",fill);
- canvas->TkE();
-
- active = true;
-#endif
- return *this;
-}
-
-GuiObj &GuiPoly::Draw()
-{
-#ifdef MAXMSP
- ::Point p;
- ::RGBColor col;
- int ox = Canv().X(),oy = Canv().Y();
- int w = width;
- if(!w) w = 1;
-
- col.red = (fill>>8)&0xff00;
- col.green = fill&0xff00;
- col.blue = (fill&0xff)<<8;
- ::RGBForeColor(&col);
- ::PenSize(w,w);
- p.h = ox+pnt[0].X();
- p.v = oy+pnt[0].Y();
- ::MoveTo(p.h,p.v);
- for(int i = 1; i < pnts; ++i) {
- p.h = ox+pnt[i].X();
- p.v = oy+pnt[i].Y();
- ::LineTo(p.h,p.v);
- }
-#endif
- return *this;
-}
-
-GuiObj &GuiPoly::Delete()
-{
- if(pnt) { delete[] pnt; pnt = NULL; }
- return *this;
-}
-
-
-GuiObj &GuiText::Set(int x,int y,const char *txt,long fl,just_t jt)
-{
- Delete();
- rect(x,y,x,y);
- fill = fl,just = jt;
-
-#ifdef PD
- canvas->TkC().Tk("create text %i %i -tags %s",x,y,GetString(Id()));
- if(txt) canvas->Tk(" -text %s",txt);
- if(fill >= 0) canvas->Tk(" -fill #%06x",fill);
- if(just != none) {
- static const char justtxt[][7] = {"left","right","center"};
- canvas->Tk(" -justify %s",justtxt[(int)just]);
- }
- canvas->TkE();
-
- active = true;
-#endif
- return *this;
-}
-
-GuiObj &GuiText::Draw()
-{
-#ifdef MAXMSP
-#endif
- return *this;
-}
-
diff --git a/externals/grill/guitest/flguiobj.h b/externals/grill/guitest/flguiobj.h
deleted file mode 100644
index 66286cef..00000000
--- a/externals/grill/guitest/flguiobj.h
+++ /dev/null
@@ -1,362 +0,0 @@
-#ifndef __FLGUIOBJ_H
-#define __FLGUIOBJ_H
-
-#define FLEXT_GUI
-#include <flext.h>
-#include "flgui.h"
-
-
-class Canvas
-{
-public:
- Canvas(t_canvas *c);
- ~Canvas();
-
-#ifdef PD
- Canvas &Tk(char *fmt,...);
- Canvas &TkC();
- Canvas &TkE();
-
- void ToBuf(const char *t);
-#endif
-
- bool Pre(int x,int y);
- void Post();
-
- int X() const { return xpos; }
- int Y() const { return ypos; }
-
-protected:
-
- t_canvas *canvas;
- int xpos,ypos;
-
-#ifdef PD
- void Send(const char *t);
- void SendBuf();
-
- static bool debug,store;
-
- char *buffer;
- int bufix;
- int waiting;
-#else
- PenState svpen;
- RGBColor svcol;
- GrafPtr svgp;
-#endif
-};
-
-
-class Pnt
-{
-public:
- Pnt() {}
- Pnt(const Pnt &p): x(p.x),y(p.y) {}
- Pnt(int px,int py): x(px),y(py) {}
-
- Pnt &operator =(const Pnt &p) { x = p.x,y = p.y; return *this; }
- Pnt &operator ()(int px,int py) { x = px,y = py; return *this; }
-
- Pnt &Move(int dx,int dy) { x += dx,y += dy; return *this; }
-
- int X() const { return x; }
- int Y() const { return y; }
-
-//protected:
- int x,y;
-};
-
-class Rect
-{
-public:
- Rect() {}
- Rect(const Rect &r): lo(r.lo),hi(r.hi) {}
- Rect(int xlo,int ylo,int xhi,int yhi): lo(xlo,ylo),hi(xhi,yhi) {}
-
- Rect &operator =(const Rect &r) { lo = r.lo; hi = r.hi; return *this; }
- Rect &operator ()(const Pnt &l,const Pnt &h) { lo = l; hi = h; return *this; }
- Rect &operator ()(int xlo,int ylo,int xhi,int yhi) { lo(xlo,ylo); hi(xhi,yhi); return *this; }
-
- Rect &Move(int dx,int dy) { lo.Move(dx,dy); hi.Move(dx,dy); return *this; }
- Rect &MoveTo(int x,int y) { hi(x+hi.X()-lo.X(),y+hi.Y()-lo.Y()); lo(x,y); return *this; }
-
- Pnt &Lo() { return lo; }
- Pnt &Hi() { return hi; }
- int SizeX() const { return hi.X()-lo.X()+1; }
- int SizeY() const { return hi.Y()-lo.Y()+1; }
-
- Rect &Add(const Pnt &p);
- Rect &Add(const Rect &r);
- bool In(const Pnt &p) const;
- bool Inter(const Rect &r) const;
-
-protected:
- Pnt lo,hi;
-};
-
-class GuiObj:
- public flext
-{
- friend class GuiGroup;
-public:
- GuiObj(Canvas *c = NULL,GuiGroup *p = NULL);
- virtual ~GuiObj();
-
- const t_symbol *Id() const { return idsym; }
- virtual const t_symbol *Symbol() const { return NULL; }
-
- virtual void Active() {}
- virtual void Inactive() {}
-
-/*
- void Origin(int x,int y) { ori(x,y); }
- void Origin(const Pnt &p) { ori = p; }
- const Pnt &Origin() const { return ori; }
- void OriMove(int dx,int dy) { ori.Move(dx,dy); }
- int OriX() const { return ori.X(); }
- int OriY() const { return ori.Y(); }
-*/
-
- virtual GuiSingle *Find(const t_symbol *s) { return NULL; }
- inline GuiSingle *Find(const char *s) { return Find(MakeSymbol(s)); }
-
- virtual GuiObj &MoveRel(int dx,int dy) = 0;
- virtual GuiObj &Focus() { return *this; }
-
- virtual GuiObj &Draw() = 0;
-
- Canvas &Canv() { return *canvas; }
-
-protected:
- virtual GuiObj &Delete() = 0;
-
- GuiGroup *parent;
- Canvas *canvas;
- const t_symbol *idsym;
-
- virtual bool Method(flext_gui &g,const flext_gui::CBParams &p) = 0;
-
- Rect rect;
-};
-
-
-class GuiSingle:
- public GuiObj
-{
- friend class flext_gui;
-public:
- GuiSingle(Canvas *c = NULL,GuiGroup *p = NULL,const t_symbol *s = NULL);
- ~GuiSingle();
-
- virtual const t_symbol *Symbol() const { return sym; }
- virtual void Symbol(const t_symbol *s);
- void Symbol(const char *s) { Symbol(MakeSymbol(s)); }
-
- virtual void Active() { active = true; }
- virtual void Inactive() { active = false; }
-
- virtual bool In(const Pnt &p) const { return false; }
-
- virtual GuiSingle *Find(const t_symbol *s);
- virtual GuiObj &MoveTo(int x,int y);
- virtual GuiObj &MoveRel(int dx,int dy);
- virtual GuiObj &FillColor(unsigned long col);
- virtual GuiObj &Outline(unsigned long col);
-
- virtual GuiObj &Focus();
-
- GuiGroup &Parent() { return *parent; }
-
-protected:
- virtual GuiObj &Delete();
-
- const t_symbol *sym;
- bool active;
-
- class Event {
- public:
- Event(int evmask,bool (*m)(flext_gui &g,GuiSingle &obj,const flext_gui::CBParams &p));
- ~Event();
-
- int methfl;
- bool (*method)(flext_gui &g,GuiSingle &obj,const flext_gui::CBParams &p);
- bool ext;
- Event *nxt;
- } *event;
-
- void AddEvent(int evmask,bool (*m)(flext_gui &g,GuiSingle &obj,const flext_gui::CBParams &p));
- void RmvEvent(int evmask,bool (*m)(flext_gui &g,GuiSingle &obj,const flext_gui::CBParams &p));
-
- virtual bool Method(flext_gui &g,const flext_gui::CBParams &p);
-};
-
-
-class GuiPoint:
- public GuiSingle
-{
- friend class GuiGroup;
-
- GuiPoint(Canvas *c = NULL,GuiGroup *p = NULL,const t_symbol *s = NULL): GuiSingle(c,p,s) {}
- GuiObj &Set(int x,int y,long fill = -1);
- virtual GuiObj &Draw();
-
- long fill;
-public:
-};
-
-
-class GuiCloud:
- public GuiSingle
-{
- friend class GuiGroup;
-
- GuiCloud(Canvas *c = NULL,GuiGroup *p = NULL,const t_symbol *s = NULL): GuiSingle(c,p,s),pnt(NULL) {}
- GuiObj &Set(int n,const Pnt *p,long fill = -1);
- virtual GuiObj &Draw();
- virtual GuiObj &Delete();
-
- long fill;
- int pnts;
- Pnt *pnt;
-public:
-};
-
-
-class GuiBox:
- public GuiSingle
-{
- friend class GuiGroup;
-
- GuiBox(Canvas *c = NULL,GuiGroup *p = NULL,const t_symbol *s = NULL): GuiSingle(c,p,s) {}
- GuiObj &Set(int x,int y,int xsz,int ysz,int width = -1,long fill = -1,long outl = -1);
- virtual GuiObj &Draw();
-
- virtual bool In(const Pnt &p) const { return rect.In(p); }
-
- int width;
- long fill,outln;
-public:
-};
-
-
-class GuiRect:
- public GuiSingle
-{
- friend class GuiGroup;
-
- GuiRect(Canvas *c = NULL,GuiGroup *p = NULL,const t_symbol *s = NULL): GuiSingle(c,p,s) {}
- GuiObj &Set(int x,int y,int xsz,int ysz,int width = -1,long outl = -1);
- virtual GuiObj &Draw();
-
- virtual bool In(const Pnt &p) const { return rect.In(p); }
-
- int width;
- long outln;
-public:
-};
-
-
-class GuiLine:
- public GuiSingle
-{
- friend class GuiGroup;
-
- GuiLine(Canvas *c = NULL,GuiGroup *p = NULL,const t_symbol *s = NULL): GuiSingle(c,p,s) {}
- GuiObj &Set(int x1,int y1,int x2,int y2,int width = -1,long fill = -1);
- virtual GuiObj &Draw();
-
- int width;
- long fill;
- Pnt p1,p2;
-public:
-};
-
-
-class GuiPoly:
- public GuiSingle
-{
- friend class GuiGroup;
-
- GuiPoly(Canvas *c = NULL,GuiGroup *p = NULL,const t_symbol *s = NULL): GuiSingle(c,p,s),pnt(NULL) {}
- GuiObj &Set(int n,const Pnt *p,int width = -1,long fill = -1);
- virtual GuiObj &Draw();
- virtual GuiObj &Delete();
-
- int width;
- long fill;
- int pnts;
- Pnt *pnt;
-public:
-};
-
-
-class GuiText:
- public GuiSingle
-{
- friend class GuiGroup;
-public:
- enum just_t { none = -1,left = 0,right,center };
-protected:
- GuiText(Canvas *c = NULL,GuiGroup *p = NULL,const t_symbol *s = NULL): GuiSingle(c,p,s) {}
- GuiObj &Set(int x,int y,const char *txt = NULL,long fill = -1,just_t just = none);
- virtual GuiObj &Draw();
-
- just_t just;
- long fill;
-};
-
-
-class GuiGroup:
- public GuiObj
-{
- friend class flext_gui;
-public:
- GuiGroup(Canvas *c,GuiGroup *p = NULL);
- ~GuiGroup();
-
- virtual GuiSingle *Find(const t_symbol *s);
- virtual GuiObj &MoveRel(int dx,int dy);
-
- void Clear();
- void Add(GuiObj *o,bool own = true);
- GuiSingle *Detach(const t_symbol *s);
-
- virtual GuiObj &Draw();
-
- GuiGroup *Add_Group();
- GuiSingle *Add_Point(int x,int y,long fill = -1);
- inline GuiSingle *Add_Point(const Pnt &p,long fill = -1) { return Add_Point(p.X(),p.Y(),fill); }
- GuiSingle *Add_Cloud(int n,const Pnt *p,long fill = -1);
- GuiSingle *Add_Box(int x,int y,int xsz,int ysz,int width = -1,long fill = -1,long outl = -1);
- GuiSingle *Add_Rect(int x,int y,int xsz,int ysz,int width = -1,long outl = -1);
- GuiSingle *Add_Line(int x1,int y1,int x2,int y2,int width = -1,long fill = -1);
- inline GuiSingle *Add_Line(const Pnt &p1,const Pnt &p2,int width = -1,long fill = -1) { return Add_Line(p1.X(),p1.Y(),p2.X(),p2.Y(),width,fill); }
- GuiSingle *Add_Poly(int n,const Pnt *p,int width = -1,long fill = -1);
- GuiSingle *Add_Text(int x,int y,const char *txt,long fill = -1,GuiText::just_t just = GuiText::none);
- inline GuiSingle *Add_Text(const Pnt &p,const char *txt,long fill = -1,GuiText::just_t just = GuiText::none) { return Add_Text(p.X(),p.Y(),txt,fill,just); }
-
- GuiSingle *Remove(GuiSingle *obj);
-
-protected:
-#ifdef PD
- void AddTag(GuiObj *o);
- void RemoveTag(GuiObj *o);
-#endif
-
- virtual GuiObj &Delete();
-
- class Part
- {
- public:
- Part(GuiObj *o,bool own = true): obj(o),owner(own),nxt(NULL) {}
-
- GuiObj *obj;
- bool owner;
- Part *nxt;
- } *head,*tail;
-
- virtual bool Method(flext_gui &g,const flext_gui::CBParams &p);
-};
-
-#endif
diff --git a/externals/grill/guitest/guitest.dsp b/externals/grill/guitest/guitest.dsp
deleted file mode 100644
index e7dcf20e..00000000
--- a/externals/grill/guitest/guitest.dsp
+++ /dev/null
@@ -1,112 +0,0 @@
-# Microsoft Developer Studio Project File - Name="guitest" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** NICHT BEARBEITEN **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=guitest - Win32 Debug
-!MESSAGE Dies ist kein gültiges Makefile. Zum Erstellen dieses Projekts mit NMAKE
-!MESSAGE verwenden Sie den Befehl "Makefile exportieren" und führen Sie den Befehl
-!MESSAGE
-!MESSAGE NMAKE /f "guitest.mak".
-!MESSAGE
-!MESSAGE Sie können beim Ausführen von NMAKE eine Konfiguration angeben
-!MESSAGE durch Definieren des Makros CFG in der Befehlszeile. Zum Beispiel:
-!MESSAGE
-!MESSAGE NMAKE /f "guitest.mak" CFG="guitest - Win32 Debug"
-!MESSAGE
-!MESSAGE Für die Konfiguration stehen zur Auswahl:
-!MESSAGE
-!MESSAGE "guitest - Win32 Release" (basierend auf "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "guitest - Win32 Debug" (basierend auf "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName "max/guitest"
-# PROP Scc_LocalPath "."
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "guitest - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "msvc\r"
-# PROP Intermediate_Dir "msvc\r"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "GUITEST_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /W3 /GR /O2 /I "c:\programme\audio\pd\src" /I "f:\prog\max\flext\source" /I "F:\prog\packs\wxwindows-2.3.2\include" /I "F:\prog\packs\wxwindows-2.3.2\lib\mswdll" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "NT" /D "PD" /YX /FD /c
-# SUBTRACT CPP /Fr
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0xc07 /d "NDEBUG"
-# ADD RSC /l 0xc07 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib pd.lib flext-pdwin.lib /nologo /dll /machine:I386 /libpath:"c:\programme\audio\pd\bin" /libpath:"f:\prog\max\flext\pd-msvc" /libpath:"F:\prog\packs\wxwindows-2.2.9\lib"
-
-!ELSEIF "$(CFG)" == "guitest - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "msvc\d"
-# PROP Intermediate_Dir "msvc\d"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "GUITEST_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /W3 /Gm /GR /ZI /Od /I "c:\programme\audio\pd\src" /I "f:\prog\max\flext\source" /I "F:\prog\packs\wxwindows-2.3.2\include" /I "F:\prog\packs\wxwindows-2.3.2\lib\mswdlld" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "NT" /D "PD" /FR /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0xc07 /d "_DEBUG"
-# ADD RSC /l 0xc07 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib pd.lib flext_d-pdwin.lib /nologo /dll /debug /machine:I386 /pdbtype:sept /libpath:"c:\programme\audio\pd\bin" /libpath:"f:\prog\max\flext\pd-msvc" /libpath:"F:\prog\packs\wxwindows-2.3.2\lib"
-
-!ENDIF
-
-# Begin Target
-
-# Name "guitest - Win32 Release"
-# Name "guitest - Win32 Debug"
-# Begin Source File
-
-SOURCE=.\flgui.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\flgui.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\flguiobj.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\flguiobj.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\main.cpp
-# End Source File
-# End Target
-# End Project
diff --git a/externals/grill/guitest/main.cpp b/externals/grill/guitest/main.cpp
deleted file mode 100644
index 775a206b..00000000
--- a/externals/grill/guitest/main.cpp
+++ /dev/null
@@ -1,152 +0,0 @@
-#include "flgui.h"
-#include "flguiobj.h"
-
-#include <stdlib.h>
-/*
-#include <stdio.h>
-#include <string.h>
-#include <stdarg.h>
-*/
-
-#if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 303)
-#error You need at least flext version 0.3.3
-#endif
-
-
-#define V void
-#define I int
-#define C char
-#define BL bool
-#define L long
-#define UL unsigned long
-
-class guitest:
-public flext_gui,virtual public flext_base
-{
- FLEXT_HEADER(guitest,flext_gui)
-
-public:
- guitest(I argc,t_atom *argv);
- ~guitest();
-
- virtual void m_bang()
- {
- post("%s - bang!",thisName());
- }
-
-protected:
-
- virtual void g_Create();
- virtual void g_Edit(bool selected);
-
- static bool g_Motion(flext_gui &g,GuiSingle &obj,const CBParams &p);
- static bool g_MouseKey(flext_gui &g,GuiSingle &obj,const CBParams &p);
- static bool g_Key(flext_gui &g,GuiSingle &obj,const CBParams &p);
-
- virtual void g_Properties();
- virtual void g_Save(t_binbuf *b);
-
-private:
- FLEXT_CALLBACK(m_bang);
-};
-
-FLEXT_NEW_V("guitest",guitest)
-
-
-void guitest::g_Create()
-{
- GuiSingle *frame = Group().Add_Box(0,0,XSize(),YSize(),-1,0xE0E0E0);
- frame->Symbol("rect1");
- GuiSingle *wave = Group().Add_Box(8,10,XSize()-16,YSize()-11,0,0x4040FF);
- Group().Add_Text(1,1,"Hula",-1);
-
- I n = XSize()-16;
- Pnt *p = new Pnt[n];
- for(int i = 0; i < n; ++i) {
- p[i](8+i,10+rand()%(YSize()-11));
- }
- Group().Add_Poly(n,p,-1,0xC0C0C0);
- delete[] p;
-
- if(!BindEvent(*frame,g_Motion,evMotion)) post("Motion not supported");
- if(!BindEvent(*wave,g_MouseKey,evMouseDown)) post("MouseDown not supported");
- if(!BindEvent(*wave,g_MouseKey,evKeyDown)) post("KeyDown not supported");
- if(!BindEvent(*wave,g_MouseKey,evKeyUp)) post("KeyUp not supported");
-}
-
-void guitest::g_Properties()
-{
- post("properties");
-}
-
-void guitest::g_Save(t_binbuf *b)
-{
- post("save");
-#ifdef PD
- binbuf_addv(b, "ssiis;", gensym("#X"),gensym("obj"),
- (t_int)XLo(), (t_int)YLo(),MakeSymbol(thisName())
- // here the arguments
- );
-#else
-#endif
-}
-
-void guitest::g_Edit(bool selected)
-{
- post("select is=%d", selected);
-
- GuiSingle *obj = Group().Find(MakeSymbol("rect1"));
- if(obj)
- obj->Outline(selected?0xFF0000:0x000000);
- else
- post("obj not found");
-}
-
-bool guitest::g_Motion(flext_gui &g,GuiSingle &obj,const CBParams &p)
-{
- if(p.kind == evMotion) {
- post("Motion %s x:%i y:%i mod:%i",GetString(obj.Id()),p.pMotion.x,p.pMotion.y,p.pMotion.mod);
- }
- else
- post("Motion");
- return true;
-}
-
-bool guitest::g_MouseKey(flext_gui &g,GuiSingle &obj,const CBParams &p)
-{
- if(p.kind == evMouseDown) {
- post("MouseDown %s x:%i y:%i b:%i mod:%i",GetString(obj.Id()),p.pMouseKey.x,p.pMouseKey.y,p.pMouseKey.b,p.pMouseKey.mod);
- }
- else if(p.kind == evKeyDown) {
- post("KeyDown %s asc:%i key:%i mod:%i",GetString(obj.Id()),p.pKey.a,p.pKey.k,p.pKey.mod);
- }
- else if(p.kind == evKeyUp) {
- post("KeyUp %s asc:%i key:%i mod:%i",GetString(obj.Id()),p.pKey.a,p.pKey.k,p.pKey.mod);
- }
- return true;
-}
-
-bool guitest::g_Key(flext_gui &g,GuiSingle &obj,const CBParams &p)
-{
- post("Key");
- return true;
-}
-
-
-
-
-
-guitest::guitest(I argc,t_atom *argv):
- flext_gui(400,100)
-{
- AddInAnything();
- AddOutInt(2);
-
- FLEXT_ADDBANG(0,m_bang);
-}
-
-guitest::~guitest()
-{
-}
-
-