add binfolder path relative filters, fix gbrp color model, vwdw timebar tweaks, title...
[goodguy/history.git] / cinelerra-5.1 / guicast / bcdelete.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 "bcdelete.h"
23 #include "bcsignals.h"
24 #include "filesystem.h"
25 #include "language.h"
26
27
28
29
30
31 BC_DeleteFile::BC_DeleteFile(BC_FileBox *filebox, int x, int y)
32  : BC_Window(filebox->get_delete_title(),
33         x,
34         y,
35         320,
36         480,
37         0,
38         0,
39         0,
40         0,
41         1)
42 {
43         this->filebox = filebox;
44         data = 0;
45 }
46
47 BC_DeleteFile::~BC_DeleteFile()
48 {
49         delete data;
50 }
51
52 void BC_DeleteFile::create_objects()
53 {
54         int x = 10, y = 10;
55         data = new ArrayList<BC_ListBoxItem*>;
56         int i = 1;
57         char *path;
58         FileSystem fs;
59
60
61         lock_window("BC_DeleteFile::create_objects");
62         while((path = filebox->get_path(i)))
63         {
64                 data->append(new BC_ListBoxItem(path));
65                 i++;
66         }
67
68         BC_Title *title;
69         add_subwindow(title = new BC_Title(x, y, _("Really delete the following files?")));
70         y += title->get_h() + 5;
71         BC_DeleteList *list;
72         add_subwindow(list = new BC_DeleteList(filebox,
73                 x,
74                 y,
75                 get_w() - x * 2,
76                 get_h() - y - BC_OKButton::calculate_h() - 20,
77                 data));
78         y += list->get_h() + 5;
79         add_subwindow(new BC_OKButton(this));
80         add_subwindow(new BC_CancelButton(this));
81         show_window();
82         unlock_window();
83 }
84
85
86
87
88
89 BC_DeleteList::BC_DeleteList(BC_FileBox *filebox,
90         int x,
91         int y,
92         int w,
93         int h,
94         ArrayList<BC_ListBoxItem*> *data)
95  : BC_ListBox(x,
96         y,
97         w,
98         h,
99         LISTBOX_TEXT,
100         data)
101 {
102         this->filebox = filebox;
103 }
104
105
106
107
108
109
110
111
112
113
114 BC_DeleteThread::BC_DeleteThread(BC_FileBox *filebox)
115  : BC_DialogThread()
116 {
117         this->filebox = filebox;
118 }
119
120 void BC_DeleteThread::handle_done_event(int result)
121 {
122         if(!result)
123         {
124                 filebox->lock_window("BC_DeleteThread::handle_done_event");
125                 filebox->delete_files();
126                 filebox->unlock_window();
127         }
128 }
129
130 BC_Window* BC_DeleteThread::new_gui()
131 {
132         int x = filebox->get_abs_cursor_x(1);
133         int y = filebox->get_abs_cursor_y(1);
134         BC_DeleteFile *result = new BC_DeleteFile(filebox, x, y);
135         result->create_objects();
136         return result;
137 }
138
139
140
141
142
143
144
145