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

reindex.C

Go to the documentation of this file.
00001 #include "reindex.h"
00002 
00003 
00004 #include <libintl.h>
00005 #define _(String) gettext(String)
00006 #define gettext_noop(String) String
00007 #define N_(String) gettext_noop (String)
00008 
00009 
00010 ReIndex::ReIndex(MWindow *mwindow)
00011  : BC_MenuItem(_("Redraw Indexes"), "", 0), Thread()
00012 {
00013         this->mwindow = mwindow;
00014 }
00015 
00016 ReIndex::~ReIndex()
00017 {
00018 }
00019 
00020 ReIndex::handle_event() { start(); }
00021 
00022 void ReIndex::run()
00023 {
00024         int result;
00025         
00026         if(mwindow->gui) mwindow->gui->disable_window();
00027         if(mwindow->gui) mwindow->lock_resize();
00028 
00029         {
00030                 ReIndexWindow window;
00031                 window.create_objects();
00032                 result = window.run_window();
00033         }
00034         
00035         if(!result)       // user didn't cancel
00036         {
00037 // ========== need pointers since mainmenu is created after tracks
00038 // ==================================== delete old index files
00039                 mwindow->tracks->delete_index_files();
00040 // ==================================== create new index files
00041                 mwindow->tracks->create_index_files(1);
00042 // ==================================== draw
00043                 mwindow->draw();
00044         }
00045         if(mwindow->gui) mwindow->unlock_resize();
00046         if(mwindow->gui) mwindow->gui->enable_window();
00047 }
00048 
00049 ReIndexWindow::ReIndexWindow(char *display = "")
00050  : BC_Window(display, MEGREY, PROGRAM_NAME ": Redraw Indexes", 340, 140, 340, 140)
00051 {
00052 }
00053 
00054 ReIndexWindow::~ReIndexWindow()
00055 {
00056         delete ok;
00057         delete cancel;
00058 }
00059 
00060 ReIndexWindow::create_objects()
00061 {
00062         BC_SubWindow *subwindow;
00063         
00064         add_subwindow(subwindow = new BC_SubWindow(0, 0, w, h, MEGREY));
00065         subwindow->add_subwindow(new BC_Title(5, 5, _("Redraw all indexes for the current project?")));
00066         subwindow->add_subwindow(ok = new ReIndexOkButton(this));
00067         subwindow->add_subwindow(cancel = new ReIndexCancelButton(this));
00068 }
00069 
00070 ReIndexOkButton::ReIndexOkButton(ReIndexWindow *window)
00071  : BC_Button(5, 80, _("Yes"))
00072 {
00073         this->window = window;
00074 }
00075 
00076 ReIndexOkButton::handle_event()
00077 {
00078         window->set_done(0);
00079 }
00080 
00081 ReIndexOkButton::keypress_event()
00082 {
00083         if(window->get_keypress() == 13) { handle_event(); return 1; }
00084         return 0;
00085 }
00086 
00087 ReIndexCancelButton::ReIndexCancelButton(ReIndexWindow *window)
00088  : BC_Button(140, 80, _("No"))
00089 {
00090         this->window = window;
00091 }
00092 
00093 ReIndexCancelButton::handle_event()
00094 {
00095         window->set_done(1);
00096 }
00097 
00098 ReIndexCancelButton::keypress_event()
00099 {
00100         if(window->get_keypress() == ESC) { handle_event(); return 1; }
00101         return 0;
00102 }
00103 

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