prevent popup deactivation while button_down
[goodguy/history.git] / cinelerra-5.0 / cinelerra / zoompanel.h
1
2 /*
3  * CINELERRA
4  * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
5  * 
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  * 
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  * 
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19  * 
20  */
21
22 #ifndef ZOOMPANEL_H
23 #define ZOOMPANEL_H
24
25
26 #include "guicast.h"
27 #include "mwindow.inc"
28
29 class ZoomPopup;
30 class ZoomTumbler;
31
32 #define ZOOM_PERCENTAGE 0
33 #define ZOOM_FLOAT 1
34 #define ZOOM_TIME 2
35 #define ZOOM_LONG 3
36
37 class ZoomHash
38 {
39 public:
40         ZoomHash(double value, char *text);
41         ~ZoomHash();
42
43         double value;
44         char *text;
45 } ;
46
47 class ZoomPanel
48 {
49 public:
50         ZoomPanel(MWindow *mwindow, 
51                 BC_WindowBase *subwindow, 
52                 double value, 
53                 int x, 
54                 int y, 
55                 int w, 
56                 double min = 1,
57                 double max = 131072,
58                 int zoom_type = ZOOM_PERCENTAGE);
59         ZoomPanel(MWindow *mwindow, 
60                 BC_WindowBase *subwindow, 
61                 double value, 
62                 int x, 
63                 int y, 
64                 int w, 
65                 double *user_table,
66                 int user_size,
67                 int zoom_type = ZOOM_PERCENTAGE);
68         ~ZoomPanel();
69
70         virtual int handle_event() { return 1; };
71         int get_w();
72         void calculate_menu();
73         static int calculate_w(int menu_w);
74         void update_menu();
75         void create_objects();
76         double get_value();
77         char* get_text();
78         void set_text(const char *text);
79         char* value_to_text(double value, int use_table = 1);
80         double text_to_zoom(char *text, int use_table = 1);
81         void update(double value);
82         void update(const char *value);
83         void reposition_window(int x, int y);
84 // Set images to be used
85         void set_menu_images(VFrame **data);
86         void set_tumbler_images(VFrame **data);
87
88         MWindow *mwindow;
89         BC_WindowBase *subwindow;
90         int x;
91         int y;
92         int w;
93         double value;
94
95         ZoomPopup *zoom_text;
96         ZoomTumbler *zoom_tumbler;
97         char string[BCTEXTLEN];
98         double min, max;
99         double *user_table;
100         int user_size;
101         int zoom_type;
102         ArrayList<ZoomHash*> zoom_table;
103         VFrame **menu_images;
104         VFrame **tumbler_images;
105 };
106
107 class ZoomPopup : public BC_PopupMenu
108 {
109 public:
110         ZoomPopup(MWindow *mwindow, ZoomPanel *panel, int x, int y);
111         ~ZoomPopup();
112
113         int handle_event();
114
115         ZoomPanel *panel;
116         MWindow *mwindow;
117 };
118
119 class ZoomTumbler : public BC_Tumbler
120 {
121 public:
122         ZoomTumbler(MWindow *mwindow, ZoomPanel *panel, int x, int y);
123         ~ZoomTumbler();
124         
125         int handle_up_event();
126         int handle_down_event();
127         
128         ZoomPanel *panel;
129         MWindow *mwindow;
130 };
131
132 #endif