Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members

newfolder.C

Go to the documentation of this file.
00001 #include "assets.h"
00002 #include "awindowgui.h"
00003 #include "edl.h"
00004 #include "mwindow.h"
00005 #include "newfolder.h"
00006 
00007 #include <string.h>
00008 
00009 #include <libintl.h>
00010 #define _(String) gettext(String)
00011 #define gettext_noop(String) String
00012 #define N_(String) gettext_noop (String)
00013 
00014 
00015 NewFolder::NewFolder(MWindow *mwindow, AWindowGUI *awindow, int x, int y)
00016  : BC_Window(PROGRAM_NAME ": New folder", 
00017         x, 
00018         y, 
00019         320, 
00020         120, 
00021         0, 
00022         0, 
00023         0, 
00024         0, 
00025         1)
00026 {
00027         this->mwindow = mwindow;
00028         this->awindow = awindow;
00029 }
00030 
00031 NewFolder::~NewFolder()
00032 {
00033 }
00034 
00035 
00036 int NewFolder::create_objects()
00037 {
00038         int x = 10, y = 10;
00039         add_tool(new BC_Title(x, y, _("Enter the name of the folder:")));
00040         y += 20;
00041         add_subwindow(textbox = new BC_TextBox(x, y, 300, 1, _("Untitled")));
00042         y += 30;
00043         add_subwindow(new BC_OKButton(x, y));
00044         x = get_w() - 100;
00045         add_subwindow(new BC_CancelButton(x, y));
00046         show_window();
00047         return 0;
00048 }
00049 
00050 char* NewFolder::get_text()
00051 {
00052         return textbox->get_text();
00053 }
00054 
00055 
00056 NewFolderThread::NewFolderThread(MWindow *mwindow, AWindowGUI *awindow)
00057 {
00058         this->mwindow = mwindow;
00059         this->awindow = awindow;
00060         active = 0;
00061         set_synchronous(0);
00062 }
00063 
00064 NewFolderThread::~NewFolderThread() 
00065 {
00066 }
00067 
00068 void NewFolderThread::run()
00069 {
00070         int result = window->run_window();
00071 
00072         if(!result)
00073         {
00074                 mwindow->new_folder(window->get_text());
00075         }
00076 
00077         change_lock.lock("NewFolderThread::run");
00078         active = 0;
00079         change_lock.unlock();
00080         delete window;
00081         completion_lock.unlock();
00082 }
00083 
00084 int NewFolderThread::interrupt()
00085 {
00086         change_lock.lock("NewFolderThread::interrupt");
00087         if(active)
00088         {
00089                 window->lock_window();
00090                 window->set_done(1);
00091                 window->unlock_window();
00092         }
00093 
00094         change_lock.unlock();
00095 
00096         completion_lock.lock("NewFolderThread::interrupt");
00097         completion_lock.unlock();
00098         return 0;
00099 }
00100 
00101 int NewFolderThread::start_new_folder()
00102 {
00103         window = new NewFolder(mwindow, 
00104                 awindow, 
00105                 awindow->get_abs_cursor_x(1), 
00106                 awindow->get_abs_cursor_y(1) - 120);
00107         window->create_objects();
00108 
00109         change_lock.lock("NewFolderThread::start_new_folder");
00110         active = 1;
00111         change_lock.unlock();
00112 
00113         Thread::start();
00114 
00115         completion_lock.lock("NewFolderThread::start_new_folder");
00116         return 0;
00117 }

Generated on Sun Jan 8 13:38:57 2006 for Cinelerra-svn by  doxygen 1.4.4