r125: This commit was manufactured by cvs2svn to create tag 'r1_1_7-last'.
[cinelerra_cv/mob.git] / hvirtual / cinelerra / newfolder.C
blobff8cc6de3d8f318bba03a9044cb4d178d1adbb59
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();
78         active = 0;
79         change_lock.unlock();
80         delete window;
81         completion_lock.unlock();
84 int NewFolderThread::interrupt()
86         change_lock.lock();
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();
97         completion_lock.unlock();
98         return 0;
101 int NewFolderThread::start_new_folder()
103         window = new NewFolder(mwindow, awindow, awindow->get_abs_cursor_x(), awindow->get_abs_cursor_y() - 120);
104         window->create_objects();
106         change_lock.lock();
107         active = 1;
108         change_lock.unlock();
110         Thread::start();
112         completion_lock.lock();
113         return 0;