Expand PMF_FN_* macros.
[netbsd-mini2440.git] / dist / nvi / gtk / gtkvi.c
blob7d8c9fdfb9f8484b372bb7d152297be935e757de
1 /* $NetBSD$ */
3 /*-
4 * Copyright (c) 1999
5 * Sven Verdoolaege. All rights reserved.
6 * Copyright (c) 1996
7 * Rob Zimmermann. All rights reserved.
8 * Copyright (c) 1996
9 * Keith Bostic. All rights reserved.
11 * See the LICENSE file for redistribution information.
14 #include "config.h"
16 #include <sys/types.h>
17 #include <sys/queue.h>
19 #include <bitstring.h>
20 #include <stdio.h>
21 #include <stdlib.h>
22 #include <string.h>
24 #include <gtk/gtk.h>
26 #include "../common/common.h"
27 #include "../ipc/ip.h"
29 #if 0
30 #include <zvt/zvtterm.h>
31 #include <zvt/vt.h>
32 #endif
33 #include "gtkvi.h"
34 #include "gtkviscreen.h"
35 #include "gtkviwindow.h"
36 #include "extern.h"
38 static int vi_key_press_event __P((GtkWidget*, GdkEventKey*, GtkVi*));
42 #if 0
43 static int
44 vi_fork(ipvi)
45 IPVI *ipvi;
47 GtkVi* vi = (GtkVi*)(ipvi->private_data);
49 return zvt_term_forkpty(ZVT_TERM(vi->term), 0);
51 #endif
53 /*
54 * PUBLIC: int gtk_vi_init __P((GtkVi **, int, char*[]));
56 int
57 gtk_vi_init(GtkVi **vip, int argc, char **argv)
59 GtkVi *vi;
60 GtkWidget *term;
62 MALLOC_GOTO(NULL, vi, GtkVi*, sizeof(GtkVi));
63 memset(vi, 0, sizeof(GtkVi));
65 #if 0
66 term = zvt_term_new();
67 gtk_widget_show(term);
68 vi->term = term;
69 vt_parse_vt(&ZVT_TERM(term)->vx->vt, "test\n", 5);
70 #endif
71 /* doesn't work now; need to know when other process is running
72 gtk_signal_connect(GTK_OBJECT(term), "key_press_event",
73 (GtkSignalFunc) vi_key_press_event, vi);
77 vi_create(&vi->ipvi, IP_EX_ALLOWED);
79 vi_create(&vi->ipvi, 0);
80 vi->ipvi->private_data = vi;
82 /* Run vi: the parent returns, the child is the vi process. */
83 vi->ipvi->run(vi->ipvi, argc, argv);
85 *vip = vi;
87 return 0;
89 alloc_err:
90 return 1;
93 #if 0
94 static int
95 vi_key_press_event(zvt, event, vi)
96 GtkVi *vi;
97 GtkWidget *zvt;
98 GdkEventKey *event;
100 gtk_vi_key_press_event(vi, event);
102 gtk_signal_emit_stop_by_name(GTK_OBJECT(zvt), "key_press_event");
103 /* handled */
104 return 1;
106 #endif