switch move/swap tracks, add mv trk shortcut, update msg
[goodguy/cinelerra.git] / cinelerra-5.1 / 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, const 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         virtual ~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 set_tooltip(const char *text);
82         void update(double value);
83         void update(const char *value);
84         void reposition_window(int x, int y);
85
86         MWindow *mwindow;
87         BC_WindowBase *subwindow;
88         int x;
89         int y;
90         int w;
91         double value;
92
93         ZoomPopup *zoom_text;
94         ZoomTumbler *zoom_tumbler;
95         char string[BCTEXTLEN];
96         double min, max;
97         double *user_table;
98         int user_size;
99         int zoom_type;
100         ArrayList<ZoomHash*> zoom_table;
101 };
102
103 class ZoomPopup : public BC_PopupMenu
104 {
105 public:
106         ZoomPopup(MWindow *mwindow, ZoomPanel *panel, int x, int y);
107         ~ZoomPopup();
108
109         int handle_event();
110
111         ZoomPanel *panel;
112         MWindow *mwindow;
113 };
114
115 class ZoomTumbler : public BC_Tumbler
116 {
117 public:
118         ZoomTumbler(MWindow *mwindow, ZoomPanel *panel, int x, int y);
119         ~ZoomTumbler();
120
121         int handle_up_event();
122         int handle_down_event();
123
124         ZoomPanel *panel;
125         MWindow *mwindow;
126 };
127
128 #endif