00001 #include "awindow.h"
00002 #include "awindowgui.h"
00003 #include "labeledit.h"
00004 #include "edl.h"
00005 #include "fonts.h"
00006 #include "language.h"
00007 #include "localsession.h"
00008 #include "mainsession.h"
00009 #include "mwindow.h"
00010 #include "mwindowgui.h"
00011 #include "vwindow.h"
00012 #include "vwindowgui.h"
00013
00014
00015
00016 LabelEdit::LabelEdit(MWindow *mwindow, AWindow *awindow, VWindow *vwindow)
00017 : Thread()
00018 {
00019 this->mwindow = mwindow;
00020 this->awindow = awindow;
00021 this->vwindow = vwindow;
00022 this->label = 0;
00023 }
00024
00025 LabelEdit::~LabelEdit()
00026 {
00027 }
00028
00029 void LabelEdit::edit_label(Label *label)
00030 {
00031
00032 if(label)
00033 {
00034 this->label = label;
00035 Thread::start();
00036 }
00037 }
00038
00039 void LabelEdit::run()
00040 {
00041 if(label)
00042 {
00043 Label *label = label;
00044
00045 LabelEditWindow *window = new LabelEditWindow(mwindow, this);
00046 window->create_objects();
00047 int result = window->run_window();
00048 delete window;
00049 if (awindow) awindow->gui->async_update_assets();
00050 }
00051 }
00052
00053
00054
00055
00056
00057
00058
00059 LabelEditWindow::LabelEditWindow(MWindow *mwindow, LabelEdit *thread)
00060 : BC_Window(PROGRAM_NAME ": Label Info",
00061 mwindow->gui->get_abs_cursor_x(1) - 400 / 2,
00062 mwindow->gui->get_abs_cursor_y(1) - 350 / 2,
00063 400,
00064 350,
00065 400,
00066 430,
00067 0,
00068 0,
00069 1)
00070 {
00071 this->mwindow = mwindow;
00072 this->thread = thread;
00073 }
00074
00075 LabelEditWindow::~LabelEditWindow()
00076 {
00077 }
00078
00079
00080 void LabelEditWindow::create_objects()
00081 {
00082 this->label = thread->label;
00083
00084 int x = 10, y = 10;
00085 int x1 = x;
00086 BC_TextBox *textbox;
00087 BC_TextBox *titlebox;
00088 BC_Title *title;
00089
00090 add_subwindow(title = new BC_Title(x1, y, _("Label Text:")));
00091 y += title->get_h() + 5;
00092 add_subwindow(textbox = new LabelEditComments(this,
00093 x1,
00094 y,
00095 get_w() - x1 * 2,
00096 BC_TextBox::pixels_to_rows(this, MEDIUMFONT, get_h() - 10 - 40 - y)));
00097
00098
00099 add_subwindow(new BC_OKButton(this));
00100 add_subwindow(new BC_CancelButton(this));
00101 show_window();
00102 textbox->activate();
00103 }
00104
00105
00106
00107
00108
00109
00110 LabelEditComments::LabelEditComments(LabelEditWindow *window, int x, int y, int w, int rows)
00111 : BC_TextBox(x, y, w, rows, window->label->textstr)
00112 {
00113 this->window = window;
00114 }
00115
00116 int LabelEditComments::handle_event()
00117 {
00118 strcpy(window->label->textstr, get_text());
00119 return 1;
00120 }