rework histogram_bezier, init wm icon set_icon(gg), update de.po+msg/txt
[goodguy/history.git] / cinelerra-5.1 / cinelerra / labeledit.C
index 945d306a5e385da3254fadbf07b1b898286c5a37..22681918de4c0ae8a245a4126682fc422501604a 100644 (file)
@@ -45,9 +45,11 @@ LabelEdit::~LabelEdit()
        close_window();
 }
 
-void LabelEdit::start(Label *label)
+void LabelEdit::start(Label *label, int x, int y)
 {
        this->label = label;
+       this->x = x;  this->y = y;
+
        BC_DialogThread::start();
 }
 
@@ -59,20 +61,22 @@ void LabelEdit::handle_close_event(int result)
 
 void LabelEdit::handle_done_event(int result)
 {
-       awindow->gui->async_update_assets();
+       if( !result ) {
+               strcpy(label->textstr, label_edit_window->textbox->get_text());
+               awindow->gui->async_update_assets();
+       }
 }
 
 BC_Window *LabelEdit::new_gui()
 {
-       int x = mwindow->gui->get_abs_cursor_x(1) - 400 / 2;
-       int y = mwindow->gui->get_abs_cursor_y(1) - 350 / 2;
-       label_edit_window = new LabelEditWindow(mwindow, this, x, y);
+       label_edit_window = new LabelEditWindow(mwindow, this);
        label_edit_window->create_objects();
        return label_edit_window;
 }
 
-LabelEditWindow::LabelEditWindow(MWindow *mwindow, LabelEdit *thread, int x, int y)
- : BC_Window(_(PROGRAM_NAME ": Label Info"), x, y,
+LabelEditWindow::LabelEditWindow(MWindow *mwindow, LabelEdit *thread)
+ : BC_Window(_(PROGRAM_NAME ": Label Info"),
+       thread->x - 400/2, thread->y - 350/2,
        400, 350, 400, 430, 0, 0, 1)
 {
        this->mwindow = mwindow;
@@ -85,11 +89,11 @@ LabelEditWindow::~LabelEditWindow()
 
 void LabelEditWindow::create_objects()
 {
+       lock_window("LabelEditWindow::create_objects");
        this->label = thread->label;
 
        int x = 10, y = 10;
        int x1 = x;
-       BC_TextBox *textbox;
        BC_Title *title;
 
        add_subwindow(title = new BC_Title(x1, y, _("Label Text:")));
@@ -101,6 +105,7 @@ void LabelEditWindow::create_objects()
        add_subwindow(new BC_CancelButton(this));
        show_window();
        textbox->activate();
+       unlock_window();
 }
 
 LabelEditComments::LabelEditComments(LabelEditWindow *window, int x, int y, int w, int rows)
@@ -111,7 +116,6 @@ LabelEditComments::LabelEditComments(LabelEditWindow *window, int x, int y, int
 
 int LabelEditComments::handle_event()
 {
-       strcpy(window->label->textstr, get_text());
        return 1;
 }