lv2_blklst additions, ffmpeg est/bad times, proxy preview, cin.svg icon
[goodguy/cinelerra.git] / cinelerra-5.1 / cinelerra / testwindow.C
1 #include "testwindow.h"
2 // c++ -g -I../guicast testwindow.C ../guicast/x86_64/libguicast.a \
3 //  -DHAVE_GL -DHAVE_XFT -I/usr/include/freetype2 -lGL -lX11 -lXext \
4 //  -lXinerama -lXv -lpng  -lfontconfig -lfreetype -lXft -pthread
5
6 TestWindowGUI::
7 TestWindowGUI()
8  : BC_Window("test", 100,100, 100,100, 100,100)
9 {
10         in_motion = 0;  last_x = last_y = -1;
11         set_bg_color(BLACK);
12         clear_box(0,0,get_w(),get_h());
13         set_font(MEDIUMFONT);
14         tx = get_text_ascent(MEDIUMFONT);
15         ty = tx + get_text_height(MEDIUMFONT);
16 }
17
18 TestWindowGUI::
19 ~TestWindowGUI()
20 {
21 }
22
23 int TestWindowGUI::button_press_event()
24 {
25         if( !is_event_win() ) return 0;
26         if( !cursor_inside() ) return 0;
27         if( get_buttonpress() != 1 ) return 0;
28         in_motion = 1;
29         last_x = get_abs_cursor_x(0);
30         last_y = get_abs_cursor_y(0);
31         return 1;
32 }
33
34 int TestWindowGUI::button_release_event()
35 {
36         last_x = last_y = -1;
37         in_motion = 0;
38         return 1;
39 }
40 int TestWindowGUI::cursor_motion_event()
41 {
42         if( !in_motion ) return 1;
43         char position[BCSTRLEN];
44         int cx = get_abs_cursor_x(0), dx = cx-last_x;  last_x = cx;
45         int cy = get_abs_cursor_y(0), dy = cy-last_y;  last_y = cy;
46         reposition_window_relative(dx, dy);
47         snprintf(position,sizeof(position),"%d,%d",get_x(),get_y());
48         clear_box(0,0,get_w(),get_h());
49         set_color(WHITE);
50         draw_text(tx,ty, position);
51         flash();
52         return 1;
53 }
54
55 #include <stdio.h>
56 #include <stdlib.h>
57 #include <unistd.h>
58
59 int main(int ac, char **av)
60 {
61         BC_Signals signals;
62         signals.initialize();
63         TestWindow test_window;
64         test_window.join();
65         return 0;
66 }
67