aboutsummaryrefslogtreecommitdiff
path: root/shared
diff options
context:
space:
mode:
authorHans-Christoph Steiner <eighthave@users.sourceforge.net>2007-11-22 05:57:45 +0000
committerHans-Christoph Steiner <eighthave@users.sourceforge.net>2007-11-22 05:57:45 +0000
commitdc52874be8ee2b471502809380354249b251b58a (patch)
tree72702ba59d8654ef17a2711d12604c0c8c616218 /shared
parente1e0533814d29fea5d0ba318df034a9e82ec6df3 (diff)
- removed xscrollcommand and yscrollcommand from supported options since
currently they use generated names, i.e. canvas_id, etc. Perhaps it's possible to support user override of these, but it probably would not be simple - renamed "inlets" functions to "iolets" since they handle outlets too - fixed bug in save logic that made the options get appended everytime it was saved: I needed to binbuf_clear() first. - created tkwidgets_restore_options() and implemented it in [text]. It turned out to be quite easy since Tk's "canvas configure" can take the whole slew of options all at once. svn path=/trunk/externals/tkwidgets/; revision=9024
Diffstat (limited to 'shared')
-rw-r--r--shared/tkwidgets.c32
-rw-r--r--shared/tkwidgets.h6
2 files changed, 18 insertions, 20 deletions
diff --git a/shared/tkwidgets.c b/shared/tkwidgets.c
index a2c520f..7b1dc4f 100644
--- a/shared/tkwidgets.c
+++ b/shared/tkwidgets.c
@@ -43,39 +43,35 @@ void tkwidgets_query_options(t_symbol *receive_name, t_symbol *widget_id,
receive_name->s_name, argv[i], widget_id->s_name, argv[i]);
}
-/* this function queries the widget and sends the data to the store_callback */
+/* this queries the widget for each option listed in the tk_options struct,
+ * builts a list in Tcl-space, then send that list to the store_callback */
void tkwidgets_store_options(t_symbol *receive_name, t_symbol *tcl_namespace,
t_symbol *widget_id, int argc, char **argv)
{
- // build list then send the whole shebang to store_callback
int i;
- post("tkwidgets_store_options total options: %d", argc);
for(i = 0; i < argc; i++)
{
- // TODO: only send if there is a value, not when blank
sys_vgui("set ::%s::ret [%s cget -%s]\n",
tcl_namespace->s_name, widget_id->s_name, argv[i]);
sys_vgui("if {[string length $::%s::ret] > 0} {\n",
tcl_namespace->s_name);
- sys_vgui("lappend ::%s::store_list -%s ; lappend ::%s::store_list $::%s::ret}\n",
+ sys_vgui("lappend ::%s::list -%s; lappend ::%s::list $::%s::ret}\n",
tcl_namespace->s_name, argv[i],
tcl_namespace->s_name, tcl_namespace->s_name);
}
- sys_vgui("pd [concat %s store_callback $::%s::store_list \\;]\n",
+ sys_vgui("pd [concat %s store_callback $::%s::list \\;]\n",
receive_name->s_name, tcl_namespace->s_name);
- sys_vgui("unset ::%s::store_list \n", tcl_namespace->s_name);
+ sys_vgui("unset ::%s::list \n", tcl_namespace->s_name);
}
-void tkwidgets_restore_options(t_symbol *receive_name, t_symbol *widget_id,
- int argc, char** argv)
+void tkwidgets_restore_options(t_symbol *receive_name, t_symbol *tcl_namespace,
+ t_symbol *widget_id, t_binbuf *options_binbuf)
{
- int i;
- for(i = 0; i < argc; i++)
- {
- // TODO parse out -flags and values, and set them here:
- sys_vgui("%s configure %s\n",
- widget_id->s_name, argv[i]);
- }
+ int length;
+ char *options;
+ binbuf_gettext(options_binbuf, &options, &length);
+ options[length] = 0; //binbuf_gettext() doesn't put a null, so we do
+ sys_vgui("%s configure %s\n", widget_id->s_name, options);
}
/* -------------------- generate names for various elements ----------------- */
@@ -160,7 +156,7 @@ static int calculate_onset(int x_location, int width,
* current_iolet / (total_iolets == 1 ? 1 : total_iolets - 1));
}
-void tkwidgets_draw_inlets(t_object *x, t_glist *glist, t_symbol *canvas_id,
+void tkwidgets_draw_iolets(t_object *x, t_glist *glist, t_symbol *canvas_id,
t_symbol *iolets_tag, t_symbol *all_tag,
int width, int height,
int total_inlets, int total_outlets)
@@ -189,7 +185,7 @@ void tkwidgets_draw_inlets(t_object *x, t_glist *glist, t_symbol *canvas_id,
}
}
-void tkwidgets_erase_inlets(t_symbol* canvas_id, t_symbol* iolets_tag)
+void tkwidgets_erase_iolets(t_symbol* canvas_id, t_symbol* iolets_tag)
{
sys_vgui("%s delete %s\n", canvas_id->s_name, iolets_tag);
}
diff --git a/shared/tkwidgets.h b/shared/tkwidgets.h
index 999e2ac..171b3c7 100644
--- a/shared/tkwidgets.h
+++ b/shared/tkwidgets.h
@@ -71,6 +71,8 @@ void tkwidgets_setcallbackname(void *x, char *widget_name);
/* handle options */
void tkwidgets_store_options(t_symbol *receive_name, t_symbol *tcl_namespace,
t_symbol *widget_id, int argc, char **argv);
+void tkwidgets_restore_options(t_symbol *receive_name, t_symbol *tcl_namespace,
+ t_symbol *widget_id, t_binbuf *options_binbuf);
void tkwidgets_query_options(t_symbol *receive_name, t_symbol *widget_id,
int argc, char** argv);
@@ -89,11 +91,11 @@ t_symbol* tkwidgets_gen_all_tag(t_object *x);
// TODO perhaps I should try to use glist_drawiofor() from g_text.c
-void tkwidgets_draw_inlets(t_object *x, t_glist *glist, t_symbol *canvas_id,
+void tkwidgets_draw_iolets(t_object *x, t_glist *glist, t_symbol *canvas_id,
t_symbol *iolets_tag, t_symbol *all_tag,
int width, int height,
int total_inlets, int total_outlets);
-void tkwidgets_erase_inlets(t_symbol* canvas_id, t_symbol* iolets_tag);
+void tkwidgets_erase_iolets(t_symbol* canvas_id, t_symbol* iolets_tag);
void tkwidgets_draw_handle(); // TODO draw resize handle when selected in editmode
void tkwidgets_draw_resize_window(); // TODO draw the resize window while resizing