edit group selection and cut/copy/paste/del shortcuts, interview mode tweaks
[goodguy/cinelerra.git] / cinelerra-5.1 / cinelerra / timeentry.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 TIMEENTRY_H
23 #define TIMEENTRY_H
24
25
26 class DayText;
27 class DayTumbler;
28 class SecTumbler;
29 class TimeTextBox;
30 #define TOTAL_DAYS 8
31
32
33 #include "guicast.h"
34 #include "timeentry.inc"
35 #include "units.h"
36
37 // 3 part entry widget.
38 // part 1: day of the week
39 // part 2: day tumbler
40 // part 3: time of day
41 // Used by the Record GUI, Batch Rendering.
42
43 class TimeEntry
44 {
45 public:
46         TimeEntry(BC_WindowBase *gui, int x, int y,
47                 int *output_day, double *output_time, int time_format,
48                 int time_w=DEFAULT_TIMEW);
49         virtual ~TimeEntry();
50
51         void create_objects();
52         void time_to_hours(char *result, double time);
53         void time_to_minutes(char *result, double time);
54         void time_to_seconds(char *result, double time);
55         virtual int handle_event();
56         static int day_to_int(const char *day);
57         void update(int *day, double *time);
58         void update_time(double time);
59         void update_day(int day);
60         void reposition_window(int x, int y);
61         void enable();
62         void disable();
63         int get_h();
64         int get_w();
65         double get_time() { return *output_time; }
66         int get_day() { return *output_day; }
67
68         BC_WindowBase *gui;
69         int enabled;
70         int x, y;
71         int time_w;
72         DayText *day_text;
73         DayTumbler *day_tumbler;
74         TimeTextBox *time_text;
75         static const char *day_table[TOTAL_DAYS];
76         int *output_day;
77         double *output_time;
78         int time_format;
79 };
80
81 class DayText : public BC_TextBox
82 {
83 public:
84         DayText(TimeEntry *timeentry, int x, int y, int w,
85                 const char **table, int table_items, const char *text);
86         int handle_event();
87
88         const char **table;
89         TimeEntry *timeentry;
90         int table_items;
91         int current_item;
92 };
93
94 class DayTumbler : public BC_Tumbler
95 {
96 public:
97         DayTumbler(TimeEntry *timeentry, DayText *text, int x, int y);
98
99         int handle_up_event();
100         int handle_down_event();
101
102         TimeEntry *timeentry;
103         DayText *text;
104 };
105
106
107 class TimeEntryTumbler : public TimeEntry
108 {
109 public:
110         int time_w;
111         int incr;
112         SecTumbler *sec_tumbler;
113
114         void create_objects();
115         void reposition_window(int x, int y);
116         virtual int handle_up_event();
117         virtual int handle_down_event();
118         int get_h();
119         int get_w();
120         int get_incr() { return incr; }
121         void update_incr(int i) { incr = i; }
122
123         TimeEntryTumbler(BC_WindowBase *gui, int x, int y,
124                 int *output_day, double *output_time, int incr=1,
125                 int time_format=TIME_MS2, int time_w=DEFAULT_TIMEW);
126         ~TimeEntryTumbler();
127 };
128
129 class SecTumbler : public BC_Tumbler
130 {
131 public:
132         SecTumbler(TimeEntryTumbler *timetumbler, int x, int y);
133
134         int handle_up_event();
135         int handle_down_event();
136
137         TimeEntryTumbler *timetumbler;
138 };
139
140
141 class TimeTextBox : public BC_TextBox
142 {
143 public:
144         TimeTextBox(TimeEntry *timeentry,
145                 int x, int y, int w, char *default_text);
146         int handle_event();
147         TimeEntry *timeentry;
148 };
149
150
151 #endif