Merge branch 'ct' of git.pipapo.org:cinelerra-ct into ct
[cinelerra_cv/ct.git] / cinelerra / newfolder.C
blob76279493be6e091c803120ffdc5ca1fa5a953f77
1 #include "assets.h"
2 #include "awindowgui.h"
3 #include "edl.h"
4 #include "mwindow.h"
5 #include "newfolder.h"
7 #include <string.h>
9 #include <libintl.h>
10 #define _(String) gettext(String)
11 #define gettext_noop(String) String
12 #define N_(String) gettext_noop (String)
15 NewFolder::NewFolder(MWindow *mwindow, AWindowGUI *awindow, int x, int y)
16  : BC_Window(PROGRAM_NAME ": New folder", 
17         x, 
18         y, 
19         320, 
20         120, 
21         0, 
22         0, 
23         0, 
24         0, 
25         1)
27         this->mwindow = mwindow;
28         this->awindow = awindow;
31 NewFolder::~NewFolder()
36 int NewFolder::create_objects()
38         int x = 10, y = 10;
39         add_tool(new BC_Title(x, y, _("Enter the name of the folder:")));
40         y += 20;
41         add_subwindow(textbox = new BC_TextBox(x, y, 300, 1, _("Untitled")));
42         y += 30;
43         add_subwindow(new BC_OKButton(x, y));
44         x = get_w() - 100;
45         add_subwindow(new BC_CancelButton(x, y));
46         show_window();
47         return 0;
50 char* NewFolder::get_text()
52         return textbox->get_text();
56 NewFolderThread::NewFolderThread(MWindow *mwindow, AWindowGUI *awindow)
58         this->mwindow = mwindow;
59         this->awindow = awindow;
60         active = 0;
61         set_synchronous(0);
64 NewFolderThread::~NewFolderThread() 
68 void NewFolderThread::run()
70         int result = window->run_window();
72         if(!result)
73         {
74                 mwindow->new_folder(window->get_text());
75         }
77         change_lock.lock("NewFolderThread::run");
78         active = 0;
79         change_lock.unlock();
80         delete window;
81         completion_lock.unlock();
84 int NewFolderThread::interrupt()
86         change_lock.lock("NewFolderThread::interrupt");
87         if(active)
88         {
89                 window->lock_window();
90                 window->set_done(1);
91                 window->unlock_window();
92         }
94         change_lock.unlock();
96         completion_lock.lock("NewFolderThread::interrupt");
97         completion_lock.unlock();
98         return 0;
101 int NewFolderThread::start_new_folder()
103         window = new NewFolder(mwindow, 
104                 awindow, 
105                 awindow->get_abs_cursor_x(1), 
106                 awindow->get_abs_cursor_y(1) - 120);
107         window->create_objects();
109         change_lock.lock("NewFolderThread::start_new_folder");
110         active = 1;
111         change_lock.unlock();
113         Thread::start();
115         completion_lock.lock("NewFolderThread::start_new_folder");
116         return 0;
119 //      Local Variables:
120 //      mode: C++
121 //      c-file-style: "linux"
122 //      End: