4 * Copyright (C) 2006 Pierre Dumuid
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 #include "awindowgui.h"
24 #include "labeledit.h"
28 #include "localsession.h"
29 #include "mainsession.h"
31 #include "mwindowgui.h"
33 #include "vwindowgui.h"
37 LabelEdit::LabelEdit(MWindow *mwindow, AWindow *awindow, VWindow *vwindow)
40 this->mwindow = mwindow;
41 this->awindow = awindow;
42 this->vwindow = vwindow;
46 LabelEdit::~LabelEdit()
50 void LabelEdit::edit_label(Label *label)
52 // Allow more than one window so we don't have to delete the clip in handle_event
64 LabelEditWindow *window = new LabelEditWindow(mwindow, this);
65 window->create_objects();
66 /*int result = */ window->run_window();
68 if (awindow) awindow->gui->async_update_assets();
78 LabelEditWindow::LabelEditWindow(MWindow *mwindow, LabelEdit *thread)
79 : BC_Window(_(PROGRAM_NAME ": Label Info"),
80 mwindow->gui->get_abs_cursor_x(1) - 400 / 2,
81 mwindow->gui->get_abs_cursor_y(1) - 350 / 2,
90 this->mwindow = mwindow;
91 this->thread = thread;
94 LabelEditWindow::~LabelEditWindow()
99 void LabelEditWindow::create_objects()
101 this->label = thread->label;
108 add_subwindow(title = new BC_Title(x1, y, _("Label Text:")));
109 y += title->get_h() + 5;
110 add_subwindow(textbox = new LabelEditComments(this,
114 BC_TextBox::pixels_to_rows(this, MEDIUMFONT, get_h() - 10 - 40 - y)));
117 add_subwindow(new BC_OKButton(this));
118 add_subwindow(new BC_CancelButton(this));
128 LabelEditComments::LabelEditComments(LabelEditWindow *window, int x, int y, int w, int rows)
129 : BC_TextBox(x, y, w, rows, window->label->textstr, 1, MEDIUMFONT, 1)
131 this->window = window;
134 int LabelEditComments::handle_event()
136 strcpy(window->label->textstr, get_text());