r1005: Increase the number of displayed digits for resample audio dialog box
[cinelerra_cv/mob.git] / guicast / test.C
blobda674378fc43e410585953dd72bb27e213b17445
1 #include "bcsignals.h"
2 #include "cursors.h"
3 #include "guicast.h"
4 #include "keys.h"
5 #include "language.h"
6 #include "vframe.h"
7 #include <ctype.h>
8 #include <math.h>
9 #include <stdio.h>
10 #include <stdlib.h>
11 #include <string.h>
12 #include <sys/types.h>
13 #include <sys/wait.h>
14 #include <unistd.h>
17 #define MAX_ARGS 32
18 #define BCTEXTLEN 1024
21 void thread_fork()
23         int filedes[2];
24         int pid;
25         char *command_line = "ls -l -s -S -r";
26         char *arguments[MAX_ARGS];
27         char path[BCTEXTLEN];
28         int total_arguments;
29         FILE *stdin_fd;
30         int pipe_stdin = 0;
31         char *path_ptr;
32         char *ptr = command_line;
33         char *argument_ptr;
34         char argument[BCTEXTLEN];
37         path_ptr = path;
38         while(*ptr != ' ' && *ptr != 0)
39         {
40                 *path_ptr++ = *ptr++;
41         }
42         *path_ptr = 0;
44         arguments[total_arguments] = new char[strlen(path) + 1];
45         strcpy(arguments[total_arguments], path);
46 printf("%s\n", arguments[total_arguments]);
47         total_arguments++;
48         arguments[total_arguments] = 0;
50         while(*ptr != 0)
51         {
52                 ptr++;
53                 argument_ptr = argument;
54                 while(*ptr != ' ' && *ptr != 0)
55                 {
56                         *argument_ptr++ = *ptr++;
57                 }
58                 *argument_ptr = 0;
59 printf("%s\n", argument);
61                 arguments[total_arguments] = new char[strlen(argument) + 1];
62                 strcpy(arguments[total_arguments], argument);
63                 total_arguments++;
64                 arguments[total_arguments] = 0;
65         }
67         pipe(filedes);
68         stdin_fd = fdopen(filedes[1], "w");
69         
70         int new_pid = fork();
71         
72         if(new_pid == 0)
73         {
74                 dup2(filedes[0], fileno(stdin));
75                 execvp(path, arguments);
76                 perror("execvp");
77         }
78         else
79         {
80                 pid = new_pid;
81                 int return_value;
82                 if(waitpid(pid, &return_value, WUNTRACED) == -1)
83                 {
84                         perror("waitpid");
85                 }
86                 close(filedes[0]);
87                 close(filedes[1]);
88                 fclose(stdin_fd);
89                 printf("Finished.\n");
90         }
91         
92         
93         
94         
98 class TestWindow : public BC_Window
100 public:
101         TestWindow() : BC_Window("test", 
102                                 0,
103                                 0,
104                                 320, 
105                                 240,
106                                 -1,
107                                 -1,
108                                 0,
109                                 0,
110                                 1)
111         {
112                 current_cursor = 0;
113                 test_keypress = 1;
114         };
116         int close_event()
117         {
118                 set_done(0);
119                 return 1;
120         };
122         int keypress_event()
123         {
124                 switch(get_keypress())
125                 {
126                         case UP:
127                                 current_cursor += 1;
128                                 if(current_cursor >= XC_num_glyphs) current_cursor = 0;
129                                 break;
130                         
131                         case DOWN:
132                                 current_cursor -= 1;
133                                 if(current_cursor <= 0) current_cursor = XC_num_glyphs - 1;
134                                 break;
135                 }
136                 printf("%d\n", current_cursor);
137 //              set_x_cursor(current_cursor);
138 set_cursor(TRANSPARENT_CURSOR);
139         }
140         
141         int current_cursor;
144 int main(int argc, char *argv[])
146         new BC_Signals;
147         TestWindow window;
148         int angles[] = { 180, 0 };
149         float values[] = { 1, 0 };
151         window.add_tool(new BC_Pan(10, 
152                 120, 
153                 100, 
154                 1, 
155                 2, 
156                 angles, 
157                 -1, 
158                 -1,
159                 values));
160         window.add_tool(new BC_TextBox(10, 10, 200, 5, _("Mary Egbert\nhad a little lamb.")));
161         BC_Title *title;
162         window.add_tool(title = new BC_Title(10, 210, _("Hello world")));
163         title->update("xyz");
164         window.show_window();
166 sleep(2);
167         title->update("abc");
169         window.run_window();
171 //      thread_fork();