drag+drop honours labels/plugins/autos, new drag icon, phantom keyframe fix
[goodguy/cinelerra.git] / cinelerra-5.1 / cinelerra / byteorderpopup.C
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 #include "byteorderpopup.h"
23 #include "file.h"
24
25
26 ByteOrderPopup::ByteOrderPopup(BC_WindowBase *parent_window,
27         int x,
28         int y,
29         int *output)
30 {
31         this->parent_window = parent_window;
32         this->output = output;
33         this->x = x;
34         this->y = y;
35 }
36
37 ByteOrderPopup::~ByteOrderPopup()
38 {
39         delete menu;
40         delete textbox;
41         for(int i = 0; i < byteorder_items.total; i++)
42                 delete byteorder_items.values[i];
43 }
44
45 void ByteOrderPopup::create_objects()
46 {
47         byteorder_items.append(new BC_ListBoxItem(File::byteorder_to_str(0)));
48         byteorder_items.append(new BC_ListBoxItem(File::byteorder_to_str(1)));
49
50         parent_window->add_subwindow(textbox = new ByteOrderText(this, x, y));
51         x += textbox->get_w();
52         parent_window->add_subwindow(menu = new ByteOrderList(this, x, y));
53 }
54
55 ByteOrderList::ByteOrderList(ByteOrderPopup *popup, int x, int y)
56  : BC_ListBox(x,
57         y,
58         100,
59         100,
60         LISTBOX_TEXT,
61         &popup->byteorder_items,
62         0,
63         0,
64         1,
65         0,
66         1)
67 {
68         this->popup = popup;
69 }
70
71 int ByteOrderList::handle_event()
72 {
73         popup->textbox->update(get_selection(0, 0)->get_text());
74         popup->textbox->handle_event();
75         return 1;
76 }
77
78 ByteOrderText::ByteOrderText(ByteOrderPopup *popup, int x, int y)
79  : BC_TextBox(x, y, 100, 1, File::byteorder_to_str(*popup->output))
80 {
81         this->popup = popup;
82 }
83
84 int ByteOrderText::handle_event()
85 {
86         *popup->output = File::str_to_byteorder(get_text());
87         return 1;
88 }