Credit Andrew - fix vorbis audio which was scratchy and ensure aging plugin does...
[goodguy/cinelerra.git] / cinelerra-5.1 / cinelerra / testwindow.C
1 /*
2  * This program is free software; you can redistribute it and/or modify it
3  * under the terms of the GNU General Public License as published
4  * by the Free Software Foundation; either version 2 of the License, or
5  * (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful, but
8  * WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
10  * General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public
13  * License along with this program; if not, write to the Free Software
14  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
15  * USA
16  */
17
18 #include "testwindow.h"
19 // c++ -g -I../guicast testwindow.C ../guicast/x86_64/libguicast.a \
20 //  -DHAVE_GL -DHAVE_XFT -I/usr/include/freetype2 -lGL -lX11 -lXext \
21 //  -lXinerama -lXv -lpng  -lfontconfig -lfreetype -lXft -pthread
22
23 TestWindowGUI::
24 TestWindowGUI()
25  : BC_Window("test", xS(100),yS(100), xS(100),yS(100), xS(100),yS(100))
26 {
27         in_motion = 0;  last_x = last_y = -1;
28         set_bg_color(BLACK);
29         clear_box(0,0,get_w(),get_h());
30         set_font(MEDIUMFONT);
31         tx = get_text_ascent(MEDIUMFONT);
32         ty = tx + get_text_height(MEDIUMFONT);
33 }
34
35 TestWindowGUI::
36 ~TestWindowGUI()
37 {
38 }
39
40 int TestWindowGUI::button_press_event()
41 {
42         if( !is_event_win() ) return 0;
43         if( !cursor_inside() ) return 0;
44         if( get_buttonpress() != 1 ) return 0;
45         in_motion = 1;
46         last_x = get_abs_cursor_x(0);
47         last_y = get_abs_cursor_y(0);
48         return 1;
49 }
50
51 int TestWindowGUI::button_release_event()
52 {
53         last_x = last_y = -1;
54         in_motion = 0;
55         return 1;
56 }
57 int TestWindowGUI::cursor_motion_event()
58 {
59         if( !in_motion ) return 1;
60         char position[BCSTRLEN];
61         int cx = get_abs_cursor_x(0), dx = cx-last_x;  last_x = cx;
62         int cy = get_abs_cursor_y(0), dy = cy-last_y;  last_y = cy;
63         reposition_window_relative(dx, dy);
64         snprintf(position,sizeof(position),"%d,%d",get_x(),get_y());
65         clear_box(0,0,get_w(),get_h());
66         set_color(WHITE);
67         draw_text(tx,ty, position);
68         flash();
69         return 1;
70 }
71
72 #include <stdio.h>
73 #include <stdlib.h>
74 #include <unistd.h>
75
76 int main(int ac, char **av)
77 {
78         BC_Signals signals;
79         signals.initialize();
80         TestWindow test_window;
81         test_window.join();
82         return 0;
83 }
84