version update, docs Features5 msg/txt, shuttle tweaks for build
[goodguy/cinelerra.git] / cinelerra-5.1 / cinelerra / compresspopup.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 "compresspopup.h"
23 #include "file.h"
24 #include "language.h"
25 #include <string.h>
26
27
28
29 CompressPopup::CompressPopup(int x, int y, int use_dv, char *text)
30  : BC_PopupMenu(x, y, 80, File::compressiontostr(text))
31 {
32         strcpy(format, text);
33         this->use_dv = use_dv;
34 }
35
36 int CompressPopup::add_items()
37 {
38         if(!use_dv) add_item(format_items[0] = new CompressPopupItem(_("DV")));
39         add_item(format_items[1] = new CompressPopupItem(_("JPEG")));
40         add_item(format_items[2] = new CompressPopupItem(_("MJPA")));
41         add_item(format_items[3] = new CompressPopupItem(_("PNG")));
42         add_item(format_items[4] = new CompressPopupItem(_("PNG-Alpha")));
43         add_item(format_items[5] = new CompressPopupItem(_("RGB")));
44         add_item(format_items[6] = new CompressPopupItem(_("RGB-Alpha")));
45         add_item(format_items[7] = new CompressPopupItem(_("YUV420")));
46         add_item(format_items[8] = new CompressPopupItem(_("YUV422")));
47         return 0;
48 }
49
50 CompressPopup::~CompressPopup()
51 {
52         for(int i = 0; i < COMPRESS_ITEMS; i++) delete format_items[i];
53 }
54
55 char* CompressPopup::get_compression()
56 {
57         File test_file;
58         return test_file.strtocompression(get_text());
59 }
60
61 char* CompressPopup::compression_to_text(char *compression)
62 {
63         File test_file;
64         return test_file.compressiontostr(compression);
65 }
66
67 CompressPopupItem::CompressPopupItem(char *text)
68  : BC_MenuItem(text)
69 {
70 }
71
72 CompressPopupItem::~CompressPopupItem()
73 {
74 }
75
76 int CompressPopupItem::handle_event()
77 {
78         get_popup_menu()->set_text(get_text());
79         get_popup_menu()->handle_event();
80 }