aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--entry/entry-help.pd9
-rw-r--r--entry/entry.c35
2 files changed, 39 insertions, 5 deletions
diff --git a/entry/entry-help.pd b/entry/entry-help.pd
index 66b0059..bd79734 100644
--- a/entry/entry-help.pd
+++ b/entry/entry-help.pd
@@ -1,4 +1,4 @@
-#N canvas 172 88 736 664 10;
+#N canvas 172 88 748 676 10;
#X obj 73 212 entry 150 100 grey black;
#X obj 11 84 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
-1;
@@ -72,7 +72,7 @@ save and reopen.;
#X msg 603 323 lightyellow;
#X obj 384 218 entry 100 50 grey70 black;
#X obj 386 167 hsl 128 15 0 127 0 0 empty empty empty -2 -6 0 10 -262144
--1 -1 2000 1;
+-1 -1 0 1;
#X obj 52 601 entry 100 50 grey70 black;
#X obj 51 556 symbol;
#X obj 161 636 pddp/pddplink http://tcl.tk/man/tcl8.4/TkCmd/cursors.htm
@@ -94,6 +94,9 @@ save and reopen.;
#X obj 386 48 hsl 128 15 0 127 0 0 empty empty empty -2 -6 0 10 -262144
-1 -1 0 1;
#X msg 383 68 option borderwidth \$1;
+#X msg 395 366 scrollbar \$1;
+#X obj 395 346 tgl 15 0 empty empty empty 0 -6 0 10 -262144 -1 -1 0
+1;
#X connect 0 0 2 0;
#X connect 0 0 10 0;
#X connect 0 1 9 0;
@@ -163,3 +166,5 @@ save and reopen.;
#X connect 84 0 66 0;
#X connect 85 0 86 0;
#X connect 86 0 26 0;
+#X connect 87 0 50 0;
+#X connect 88 0 87 0;
diff --git a/entry/entry.c b/entry/entry.c
index d5e9bc4..3756772 100644
--- a/entry/entry.c
+++ b/entry/entry.c
@@ -65,7 +65,8 @@ typedef struct _entry
t_float x_border;
t_float x_highlightthickness;
t_symbol *x_relief;
-
+ t_int x_have_scrollbar;
+
t_outlet* x_data_outlet;
t_outlet* x_status_outlet;
} t_entry;
@@ -205,6 +206,21 @@ static void erase_inlets(t_entry *x, t_canvas *canvas)
onset + IOWIDTH-2, text_ypix(&x->x_obj, glist) + x->x_rect_height-4);
}
*/
+static void draw_scrollbar(t_entry *x)
+{
+ DEBUG(post("pack .x%x.c.s%x.scrollbar -side right -fill y -before .x%x.c.s%x.text \n",
+ x->x_glist, x, x->x_glist, x););
+ sys_vgui("pack .x%x.c.s%x.scrollbar -side right -fill y -before .x%x.c.s%x.text \n",
+ x->x_glist, x, x->x_glist, x);
+ x->x_have_scrollbar = 1;
+}
+
+static void erase_scrollbar(t_entry *x)
+{
+ DEBUG(post("pack forget .x%x.c.s%x.scrollbar \n", x->x_glist, x););
+ sys_vgui("pack forget .x%x.c.s%x.scrollbar \n", x->x_glist, x);
+ x->x_have_scrollbar = 0;
+}
static void create_widget(t_entry *x, t_glist *glist)
{
@@ -558,7 +574,6 @@ static void entry_option_symbol(t_entry* x, t_symbol *option, t_symbol *value)
static void entry_option(t_entry *x, t_symbol *s, int argc, t_atom *argv)
{
t_symbol *tmp_symbol = s; /* <-- this gets rid of the unused variable warning */
- t_float tmp_float;
tmp_symbol = atom_getsymbolarg(1, argc, argv);
if(tmp_symbol == &s_)
@@ -572,6 +587,14 @@ static void entry_option(t_entry *x, t_symbol *s, int argc, t_atom *argv)
}
}
+static void entry_scrollbar(t_entry *x, t_float f)
+{
+ if(f > 0)
+ draw_scrollbar(x);
+ else
+ erase_scrollbar(x);
+}
+
/* function to change colour of text background */
void entry_bgcolour(t_entry* x, t_symbol* bgcol)
@@ -634,6 +657,7 @@ static void *entry_new(t_symbol *s, int argc, t_atom *argv)
x->x_font_face = gensym("helvetica");
x->x_font_size = 10;
x->x_font_weight = gensym("normal");
+ x->x_have_scrollbar = 1;
if (argc < 4)
{
@@ -672,6 +696,11 @@ void entry_setup(void) {
A_DEFFLOAT,
0);
+ class_addmethod(entry_class, (t_method)entry_scrollbar,
+ gensym("scrollbar"),
+ A_DEFFLOAT,
+ 0);
+
class_addmethod(entry_class, (t_method)entry_option,
gensym("option"),
A_GIMME,
@@ -730,7 +759,7 @@ void entry_setup(void) {
up_symbol = gensym("up");
down_symbol = gensym("down");
- post("Text v0.1 Ben Bogart.\nCVS: $Revision: 1.18 $ $Date: 2007-10-28 05:20:34 $");
+ post("Text v0.1 Ben Bogart.\nCVS: $Revision: 1.19 $ $Date: 2007-10-28 05:53:09 $");
}