[237] in BarnOwl Developers

home help back first fref pref prev next nref lref last post

[D-O-H] r411 - trunk/owl

daemon@ATHENA.MIT.EDU (nelhage@MIT.EDU)
Thu Oct 29 18:04:00 2009

Resent-From: nelhage@mit.edu
Resent-To: barnowl-dev-mtg@charon.mit.edu
Date: Fri, 27 Oct 2006 13:39:52 -0400
To: dirty-owl-hackers@MIT.EDU
From: nelhage@MIT.EDU
Reply-To: dirty-owl-hackers@MIT.EDU

Author: nelhage
Date: 2006-10-27 13:39:46 -0400 (Fri, 27 Oct 2006)
New Revision: 411

Modified:
   trunk/owl/editwin.c
Log:
I failed to commit this in the last ci

Modified: trunk/owl/editwin.c
===================================================================
--- trunk/owl/editwin.c	2006-10-27 17:17:18 UTC (rev 410)
+++ trunk/owl/editwin.c	2006-10-27 17:39:46 UTC (rev 411)
@@ -34,6 +34,14 @@
   e->lock=0;
   e->dotsend=0;
   e->echochar='\0';
+
+  /*
+    // We get initialized multiple times, but we need to hold on to
+    // the callbacks, so we can't NULL them here.
+    e->command = NULL;
+    e->callback = NULL;
+    e->cbdata = NULL;
+  */
   if (win) werase(win);
 }
 
@@ -75,6 +83,43 @@
   e->dotsend=1;
 }
 
+void owl_editwin_set_command(owl_editwin *e, char *command) {
+  if(e->command) owl_free(e->command);
+  e->command = owl_strdup(command);
+}
+
+char *owl_editwin_get_command(owl_editwin *e) {
+  if(e->command) return e->command;
+  return "";
+}
+
+void owl_editwin_set_callback(owl_editwin *e, void (*cb)(owl_editwin*)) {
+  e->callback = cb;
+}
+
+void (*owl_editwin_get_callback(owl_editwin *e))(owl_editwin*) {
+  return e->callback;
+}
+
+void owl_editwin_set_cbdata(owl_editwin *e, void *data) {
+  e->cbdata = data;
+}
+
+void* owl_editwin_get_cbdata(owl_editwin *e) {
+  return e->cbdata;
+}
+
+void owl_editwin_do_callback(owl_editwin *e) {
+  void (*cb)(owl_editwin*);
+  cb=owl_editwin_get_callback(e);
+  if(!cb) {
+    owl_function_error("Internal error: No editwin callback!");
+  } else {
+    // owl_function_error("text: |%s|", owl_editwin_get_text(e));
+    cb(e);
+  }
+}
+
 int owl_editwin_limit_maxcols(int v, int maxv)
 {
   if (maxv > 5 && v > maxv) {


home help back first fref pref prev next nref lref last post