r1014: Enable horizontal scrolling with the mouse wheel by pressing Ctrl.
[cinelerra_cv/ct.git] / cinelerra / reindex.C
blob68d9fdb599f4a160fadf1bba6b7378ef43e86e49
1 #include "reindex.h"
4 #include <libintl.h>
5 #define _(String) gettext(String)
6 #define gettext_noop(String) String
7 #define N_(String) gettext_noop (String)
10 ReIndex::ReIndex(MWindow *mwindow)
11  : BC_MenuItem(_("Redraw Indexes"), "", 0), Thread()
13         this->mwindow = mwindow;
16 ReIndex::~ReIndex()
20 ReIndex::handle_event() { start(); }
22 void ReIndex::run()
24         int result;
25         
26         if(mwindow->gui) mwindow->gui->disable_window();
27         if(mwindow->gui) mwindow->lock_resize();
29         {
30                 ReIndexWindow window;
31                 window.create_objects();
32                 result = window.run_window();
33         }
34         
35         if(!result)       // user didn't cancel
36         {
37 // ========== need pointers since mainmenu is created after tracks
38 // ==================================== delete old index files
39                 mwindow->tracks->delete_index_files();
40 // ==================================== create new index files
41                 mwindow->tracks->create_index_files(1);
42 // ==================================== draw
43                 mwindow->draw();
44         }
45         if(mwindow->gui) mwindow->unlock_resize();
46         if(mwindow->gui) mwindow->gui->enable_window();
49 ReIndexWindow::ReIndexWindow(char *display = "")
50  : BC_Window(display, MEGREY, PROGRAM_NAME ": Redraw Indexes", 340, 140, 340, 140)
54 ReIndexWindow::~ReIndexWindow()
56         delete ok;
57         delete cancel;
60 ReIndexWindow::create_objects()
62         BC_SubWindow *subwindow;
63         
64         add_subwindow(subwindow = new BC_SubWindow(0, 0, w, h, MEGREY));
65         subwindow->add_subwindow(new BC_Title(5, 5, _("Redraw all indexes for the current project?")));
66         subwindow->add_subwindow(ok = new ReIndexOkButton(this));
67         subwindow->add_subwindow(cancel = new ReIndexCancelButton(this));
70 ReIndexOkButton::ReIndexOkButton(ReIndexWindow *window)
71  : BC_Button(5, 80, _("Yes"))
73         this->window = window;
76 ReIndexOkButton::handle_event()
78         window->set_done(0);
81 ReIndexOkButton::keypress_event()
83         if(window->get_keypress() == 13) { handle_event(); return 1; }
84         return 0;
87 ReIndexCancelButton::ReIndexCancelButton(ReIndexWindow *window)
88  : BC_Button(140, 80, _("No"))
90         this->window = window;
93 ReIndexCancelButton::handle_event()
95         window->set_done(1);
98 ReIndexCancelButton::keypress_event()
100         if(window->get_keypress() == ESC) { handle_event(); return 1; }
101         return 0;