aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans-Christoph Steiner <eighthave@users.sourceforge.net>2007-10-27 23:50:16 +0000
committerHans-Christoph Steiner <eighthave@users.sourceforge.net>2007-10-27 23:50:16 +0000
commit9555e2d25a81a847e43f6496430a906f9163db17 (patch)
treef00c1996533da45edb3898b6ad3a4735796bc790
parentfe6b12a98c089aaeb4b65ea6b07c1b76c6979c5f (diff)
added support for adding and setting with floats
svn path=/trunk/externals/bbogart/; revision=8894
-rw-r--r--entry/entry-help.pd6
-rw-r--r--entry/entry.c30
2 files changed, 25 insertions, 11 deletions
diff --git a/entry/entry-help.pd b/entry/entry-help.pd
index 8642636..635a3a5 100644
--- a/entry/entry-help.pd
+++ b/entry/entry-help.pd
@@ -12,8 +12,8 @@
The width and height are in pixels.;
#X obj 261 234 select return;
#X obj 79 347 pddp/print;
-#X obj 176 163 trigger bang bang;
-#X msg 176 184 clear;
+#X obj 176 173 trigger bang bang;
+#X msg 176 194 clear;
#X symbolatom 216 319 10 0 0 1 last_key_typed - -;
#X text 266 262 ^-- hit return to output;
#X msg 132 430 size 100 100;
@@ -23,6 +23,7 @@ The width and height are in pixels.;
#X text 13 404 The size message currently only takes affect after a
save and reopen.;
#X msg 169 127 add seven eight nine;
+#X msg 196 149 add ten eleven.;
#X connect 0 0 2 0;
#X connect 0 0 10 0;
#X connect 0 1 9 0;
@@ -41,3 +42,4 @@ save and reopen.;
#X connect 17 0 0 0;
#X connect 18 0 0 0;
#X connect 20 0 0 0;
+#X connect 21 0 0 0;
diff --git a/entry/entry.c b/entry/entry.c
index c5acc65..ecab970 100644
--- a/entry/entry.c
+++ b/entry/entry.c
@@ -16,6 +16,7 @@
* GNU General Public License for more details. */
#include <m_pd.h>
+#include <m_imp.h>
#include <g_canvas.h>
#include <stdio.h>
#include <string.h>
@@ -25,8 +26,8 @@
/* TODO: make entry_save include whole classname, including namespace prefix */
/* TODO: make [size( message redraw object */
/* TODO: set message doesnt work with a loadbang */
-/* TODO: add [append( message to add contents after existing contents, just
- * base it on the set method, without the preceeding delete */
+/* TODO: make message to add a single character to the existing text */
+/* TODO: make scrollbar (check .printout.text in u_main.tk) */
#ifdef _MSC_VER
#pragma warning( disable : 4244 )
@@ -382,14 +383,26 @@ static void entry_add(t_entry* x, t_symbol *s, int argc, t_atom *argv)
{
DEBUG(post("entry_add"););
int i;
- t_symbol *tmp = s; /* <-- this gets rid of the unused variable warning */
+ t_symbol *tmp_symbol = s; /* <-- this gets rid of the unused variable warning */
+ t_float tmp_float;
for(i=0; i<argc ; i++)
{
- tmp = atom_getsymbol(argv+i);
- DEBUG(post("lappend ::entry%lx::list %s \n", x, tmp->s_name ););
- sys_vgui("lappend ::entry%lx::list %s \n", x, tmp->s_name );
+ tmp_symbol = atom_getsymbolarg(i, argc, argv);
+ if(tmp_symbol == &s_)
+ {
+ tmp_float = atom_getfloatarg(i, argc , argv);
+ DEBUG(post("lappend ::entry%lx::list %g \n", x, tmp_float ););
+ sys_vgui("lappend ::entry%lx::list %g \n", x, tmp_float );
+ }
+ else
+ {
+ DEBUG(post("lappend ::entry%lx::list %s \n", x, tmp_symbol->s_name ););
+ sys_vgui("lappend ::entry%lx::list %s \n", x, tmp_symbol->s_name );
+ }
}
+ DEBUG(post("append ::entry%lx::list \" \"\n", x););
+ sys_vgui("append ::entry%lx::list \" \"\n", x);
DEBUG(post("%s insert end $::entry%lx::list ; unset ::entry%lx::list \n",
x->x_widget_name, x, x ););
sys_vgui("%s insert end $::entry%lx::list ; unset ::entry%lx::list \n",
@@ -490,10 +503,9 @@ static void entry_save(t_gobj *z, t_binbuf *b)
t_entry *x = (t_entry *)z;
binbuf_addv(b, "ssiisiiss", gensym("#X"),gensym("obj"),
- x->x_obj.te_xpix, x->x_obj.te_ypix ,
+ x->x_obj.te_xpix, x->x_obj.te_ypix,
gensym("entry"), x->x_width, x->x_height, x->x_bgcolour, x->x_fgcolour);
binbuf_addv(b, ";");
-// post("objectclass: %s", ((t_pd *)x)->);
}
/* function to change colour of text background */
@@ -625,7 +637,7 @@ void entry_setup(void) {
up_symbol = gensym("up");
down_symbol = gensym("down");
- post("Text v0.1 Ben Bogart.\nCVS: $Revision: 1.14 $ $Date: 2007-10-26 04:49:50 $");
+ post("Text v0.1 Ben Bogart.\nCVS: $Revision: 1.15 $ $Date: 2007-10-27 23:50:16 $");
}