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