r974: configure: Check for presence of libtiff headers and libraries.
[cinelerra_cv.git] / cinelerra / labeledit.C
blob434745370c402bd63cd049108725edf14db6098b
1 #include "awindow.h"
2 #include "awindowgui.h"
3 #include "labeledit.h"
4 #include "edl.h"
5 #include "fonts.h"
6 #include "language.h"
7 #include "localsession.h"
8 #include "mainsession.h"
9 #include "mwindow.h"
10 #include "mwindowgui.h"
11 #include "vwindow.h"
12 #include "vwindowgui.h"
16 LabelEdit::LabelEdit(MWindow *mwindow, AWindow *awindow, VWindow *vwindow)
17  : Thread()
19         this->mwindow = mwindow;
20         this->awindow = awindow;
21         this->vwindow = vwindow;
22         this->label = 0;
25 LabelEdit::~LabelEdit()
29 void LabelEdit::edit_label(Label *label)
31 // Allow more than one window so we don't have to delete the clip in handle_event
32         if(label)
33         {
34                 this->label = label;
35                 Thread::start();
36         }
39 void LabelEdit::run()
41         if(label)
42         {
43                 Label *label = label;
45                 LabelEditWindow *window = new LabelEditWindow(mwindow, this);
46                 window->create_objects();
47                 int result = window->run_window();
48                 delete window;
49                 if (awindow) awindow->gui->async_update_assets();
50         }
59 LabelEditWindow::LabelEditWindow(MWindow *mwindow, LabelEdit *thread)
60  : BC_Window(PROGRAM_NAME ": Label Info", 
61         mwindow->gui->get_abs_cursor_x(1) - 400 / 2,
62         mwindow->gui->get_abs_cursor_y(1) - 350 / 2,
63         400, 
64         350,
65         400,
66         430,
67         0,
68         0,
69         1)
71         this->mwindow = mwindow;
72         this->thread = thread;
75 LabelEditWindow::~LabelEditWindow()
79         
80 void LabelEditWindow::create_objects()
82         this->label = thread->label;
84         int x = 10, y = 10;
85         int x1 = x;
86         BC_TextBox *textbox;
87         BC_TextBox *titlebox;
88         BC_Title *title;
90         add_subwindow(title = new BC_Title(x1, y, _("Label Text:")));
91         y += title->get_h() + 5;
92         add_subwindow(textbox = new LabelEditComments(this, 
93                 x1, 
94                 y, 
95                 get_w() - x1 * 2, 
96                 BC_TextBox::pixels_to_rows(this, MEDIUMFONT, get_h() - 10 - 40 - y)));
99         add_subwindow(new BC_OKButton(this));
100         add_subwindow(new BC_CancelButton(this));
101         show_window();
102         textbox->activate();
110 LabelEditComments::LabelEditComments(LabelEditWindow *window, int x, int y, int w, int rows)
111  : BC_TextBox(x, y, w, rows, window->label->textstr)
113         this->window = window;
116 int LabelEditComments::handle_event()
118         strcpy(window->label->textstr, get_text());
119         return 1;