aboutsummaryrefslogtreecommitdiff
path: root/externals/grill/guitest
diff options
context:
space:
mode:
authorThomas Grill <xovo@users.sourceforge.net>2003-07-19 02:41:33 +0000
committerThomas Grill <xovo@users.sourceforge.net>2003-07-19 02:41:33 +0000
commitb24219e6ab0ce96f0d60f7a5f122c52b2c7e40aa (patch)
treee2cf090c2e6f5d50699457610eaf1b4f8b2225b3 /externals/grill/guitest
parent81c796acc3107ec1c148fb623259dc6fd3ac4c0e (diff)
""
svn path=/trunk/; revision=778
Diffstat (limited to 'externals/grill/guitest')
-rw-r--r--externals/grill/guitest/flgui.cpp94
-rw-r--r--externals/grill/guitest/flgui.h2
-rw-r--r--externals/grill/guitest/main.cpp42
3 files changed, 118 insertions, 20 deletions
diff --git a/externals/grill/guitest/flgui.cpp b/externals/grill/guitest/flgui.cpp
index 1771e992..b91f10a4 100644
--- a/externals/grill/guitest/flgui.cpp
+++ b/externals/grill/guitest/flgui.cpp
@@ -67,7 +67,7 @@ flext_gui::~flext_gui()
}
-void flext_gui::setup(t_class *c)
+void flext_gui::setup(t_classid c)
{
#if FLEXT_SYS == FLEXT_SYS_PD
SetWidget(c);
@@ -95,6 +95,91 @@ void flext_gui::setup(t_class *c)
// this is wrong if a modifier key is pressed during creation of the first object.....
curmod = 0;
+
+
+
+ sys_gui(
+ "proc flgui_apply {id} {\n"
+ // strip "." from the TK id to make a variable name suffix
+ "set vid [string trimleft $id .]\n"
+
+ // for each variable, make a local variable to hold its name...
+ "set var_graph_width [concat graph_width_$vid]\n"
+ "global $var_graph_width\n"
+ "set var_graph_height [concat graph_height_$vid]\n"
+ "global $var_graph_height\n"
+ "set var_graph_draw [concat graph_draw_$vid]\n"
+ "global $var_graph_draw\n"
+
+ "set cmd [concat $id dialog [eval concat $$var_graph_width] [eval concat $$var_graph_height] [eval concat $$var_graph_draw] \\;]\n"
+ // puts stderr $cmd
+ "pd $cmd\n"
+ "}\n"
+
+ "proc flgui_cancel {id} {\n"
+ "set cmd [concat $id cancel \\;]\n"
+ // puts stderr $cmd
+ "pd $cmd\n"
+ "}\n"
+
+ "proc flgui_ok {id} {\n"
+ "flgui_apply $id\n"
+ "flgui_cancel $id\n"
+ "}\n"
+
+ "proc pdtk_flgui_dialog {id width height draw} {\n"
+ "set vid [string trimleft $id .]\n"
+
+ "set var_graph_width [concat graph_width_$vid]\n"
+ "global $var_graph_width\n"
+ "set var_graph_height [concat graph_height_$vid]\n"
+ "global $var_graph_height\n"
+ "set var_graph_draw [concat graph_draw_$vid]\n"
+ "global $var_graph_draw\n"
+
+ "set $var_graph_width $width\n"
+ "set $var_graph_height $height\n"
+ "set $var_graph_draw $draw\n"
+
+ "toplevel $id\n"
+ "wm title $id {flext}\n"
+ "wm protocol $id WM_DELETE_WINDOW [concat flgui_cancel $id]\n"
+
+ "label $id.label -text {Attributes}\n"
+ "pack $id.label -side top\n"
+
+ "frame $id.buttonframe\n"
+ "pack $id.buttonframe -side bottom -fill x -pady 2m\n"
+
+ "button $id.buttonframe.cancel -text {Cancel} -command \"flgui_cancel $id\"\n"
+ "button $id.buttonframe.apply -text {Apply} -command \"flgui_apply $id\"\n"
+ "button $id.buttonframe.ok -text {OK} -command \"flgui_ok $id\"\n"
+
+ "pack $id.buttonframe.cancel -side left -expand 1\n"
+ "pack $id.buttonframe.apply -side left -expand 1\n"
+ "pack $id.buttonframe.ok -side left -expand 1\n"
+
+ "frame $id.1rangef\n"
+ "pack $id.1rangef -side top\n"
+ "label $id.1rangef.lwidth -text \"Width :\"\n"
+ "entry $id.1rangef.width -textvariable $var_graph_width -width 7\n"
+ "pack $id.1rangef.lwidth $id.1rangef.width -side left\n"
+
+ "frame $id.2rangef\n"
+ "pack $id.2rangef -side top\n"
+ "label $id.2rangef.lheight -text \"Height :\"\n"
+ "entry $id.2rangef.height -textvariable $var_graph_height -width 7\n"
+ "pack $id.2rangef.lheight $id.2rangef.height -side left\n"
+
+ "checkbutton $id.draw -text {Draw Sample} -variable $var_graph_draw -anchor w\n"
+ "pack $id.draw -side top\n"
+
+ "bind $id.1rangef.width <KeyPress-Return> [concat flgui_ok $id]\n"
+ "bind $id.2rangef.height <KeyPress-Return> [concat flgui_ok $id]\n"
+ "focus $id.1rangef.width\n"
+ "}\n"
+ );
+
#else
addmess((method)sg_update, "update", A_CANT, A_NULL);
addmess((method)sg_click, "click", A_CANT, A_NULL);
@@ -262,6 +347,13 @@ void flext_gui::pxkey_method(pxkey_object *obj,const t_symbol *s,int argc,t_atom
post("flext_gui key proxy - unknown method");
}
+void flext_gui::g_Properties()
+{
+ char buf[800];
+ sprintf(buf, "pdtk_flgui_dialog %%s %d %d %d\n",0, 0, 0);
+ gfxstub_new((t_pd *)thisHdr(), thisHdr(), buf);
+}
+
flext_gui::guicanv::guicanv(t_canvas *c):
canv(c),nxt(NULL),ref(0),
diff --git a/externals/grill/guitest/flgui.h b/externals/grill/guitest/flgui.h
index ab512a1a..0f62f01b 100644
--- a/externals/grill/guitest/flgui.h
+++ b/externals/grill/guitest/flgui.h
@@ -64,7 +64,7 @@ protected:
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_Properties();
virtual void g_Save(t_binbuf *b) {}
/*
virtual bool g_Motion(GuiObj &obj,int x,int y,int mod) { return false; }
diff --git a/externals/grill/guitest/main.cpp b/externals/grill/guitest/main.cpp
index fa5a6f71..96e168dc 100644
--- a/externals/grill/guitest/main.cpp
+++ b/externals/grill/guitest/main.cpp
@@ -37,13 +37,13 @@ public:
protected:
virtual void g_Create();
- virtual void g_Edit(bool selected);
+// 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_Properties();
virtual void g_Save(t_binbuf *b);
private:
@@ -52,14 +52,27 @@ private:
FLEXT_NEW_V("guitest",guitest)
+guitest::guitest(I argc,t_atom *argv):
+ flext_gui(400,100)
+{
+ AddInAnything();
+ AddOutInt(2);
+
+ FLEXT_ADDBANG(0,m_bang);
+}
+
+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);
-
+// GuiSingle *wave = Group().Add_Box(8,10,XSize()-16,YSize()-11,0,0x4040FF);
+ Group().Add_Text(1,1,"Hula",-1,GuiText::left);
+/*
I n = XSize()-16;
FPnt *p = new FPnt[n];
for(int i = 0; i < n; ++i) {
@@ -74,12 +87,15 @@ void guitest::g_Create()
if(!BindEvent(*wave,g_MouseKey,evKeyDown)) post("KeyDown not supported");
if(!BindEvent(*wave,g_MouseKey,evKeyUp)) post("KeyUp not supported");
if(!BindEvent(*wave,g_MouseKey,evKeyRepeat)) post("KeyRepeat not supported");
+*/
}
+/*
void guitest::g_Properties()
{
- post("properties");
+ post("properties");
}
+*/
void guitest::g_Save(t_binbuf *b)
{
@@ -93,6 +109,7 @@ void guitest::g_Save(t_binbuf *b)
#endif
}
+/*
void guitest::g_Edit(bool selected)
{
post("select is=%d", selected);
@@ -103,6 +120,7 @@ void guitest::g_Edit(bool selected)
else
post("obj not found");
}
+*/
bool guitest::g_Motion(flext_gui &g,GuiSingle &obj,const CBParams &p)
{
@@ -144,17 +162,5 @@ bool guitest::g_Key(flext_gui &g,GuiSingle &obj,const CBParams &p)
-guitest::guitest(I argc,t_atom *argv):
- flext_gui(400,100)
-{
- AddInAnything();
- AddOutInt(2);
-
- FLEXT_ADDBANG(0,m_bang);
-}
-
-guitest::~guitest()
-{
-}