r1006: configure: Use libx264_pic instead of libx264 if available.
[cinelerra_cv/mob.git] / cinelerra / bitspopup.C
blobc367e4027ad218435263f81e96ff7b565615ca04
1 #include "bitspopup.h"
2 #include "clip.h"
3 #include "file.h"
6 BitsPopup::BitsPopup(BC_WindowBase *parent_window, 
7         int x, 
8         int y, 
9         int *output, 
10         int use_ima4, 
11         int use_ulaw,
12         int use_adpcm, 
13         int use_float,
14         int use_32linear)
16         this->parent_window = parent_window;
17         this->output = output;
18         this->x = x;
19         this->y = y;
20         this->use_ima4 = use_ima4;
21         this->use_ulaw = use_ulaw;
22         this->use_adpcm = use_adpcm;
23         this->use_float = use_float;
24         this->use_32linear = use_32linear;
27 BitsPopup::~BitsPopup()
29         delete menu;
30         delete textbox;
31         for(int i = 0; i < bits_items.total; i++)
32                 delete bits_items.values[i];
35 int BitsPopup::create_objects()
37         bits_items.append(new BC_ListBoxItem(File::bitstostr(BITSLINEAR8)));
38         bits_items.append(new BC_ListBoxItem(File::bitstostr(BITSLINEAR16)));
39         bits_items.append(new BC_ListBoxItem(File::bitstostr(BITSLINEAR24)));
40         if(use_32linear) bits_items.append(new BC_ListBoxItem(File::bitstostr(BITSLINEAR32)));
41         if(use_ima4) bits_items.append(new BC_ListBoxItem(File::bitstostr(BITSIMA4)));
42         if(use_ulaw) bits_items.append(new BC_ListBoxItem(File::bitstostr(BITSULAW)));
43         if(use_adpcm) bits_items.append(new BC_ListBoxItem(File::bitstostr(BITS_ADPCM)));
44         if(use_float) bits_items.append(new BC_ListBoxItem(File::bitstostr(BITSFLOAT)));
46         parent_window->add_subwindow(textbox = new BitsPopupText(this, x, y));
47         x += textbox->get_w();
48         parent_window->add_subwindow(menu = new BitsPopupMenu(this, x, y));
49         return 0;
52 int BitsPopup::get_w()
54         return menu->get_w() + textbox->get_w();
57 int BitsPopup::get_h()
59         return MAX(menu->get_h(), textbox->get_h());
62 BitsPopupMenu::BitsPopupMenu(BitsPopup *popup, int x, int y)
63  : BC_ListBox(x,
64         y,
65         120,
66         100,
67         LISTBOX_TEXT,
68         &popup->bits_items,
69         0,
70         0,
71         1,
72         0,
73         1)
75         this->popup = popup;
78 int BitsPopupMenu::handle_event()
80         popup->textbox->update(get_selection(0, 0)->get_text());
81         popup->textbox->handle_event();
82         return 1;
85 BitsPopupText::BitsPopupText(BitsPopup *popup, int x, int y)
86  : BC_TextBox(x, y, 120, 1, File::bitstostr(*popup->output))
88         this->popup = popup;
91 int BitsPopupText::handle_event()
93         *popup->output = File::strtobits(get_text());
94         return 1;