2 #include "awindowgui.h"
7 #include "localsession.h"
8 #include "mainsession.h"
10 #include "mwindowgui.h"
12 #include "vwindowgui.h"
17 ClipEdit::ClipEdit(MWindow *mwindow, AWindow *awindow, VWindow *vwindow)
20 this->mwindow = mwindow;
21 this->awindow = awindow;
22 this->vwindow = vwindow;
31 void ClipEdit::edit_clip(EDL *clip)
33 // Allow more than one window so we don't have to delete the clip in handle_event
42 void ClipEdit::create_clip(EDL *clip)
44 // Allow more than one window so we don't have to delete the clip in handle_event
60 clip = new EDL(mwindow->edl);
61 clip->create_objects();
62 clip->copy_all(original);
72 ClipEditWindow *window = new ClipEditWindow(mwindow, this);
73 window->create_objects();
74 int result = window->run_window();
81 new_edl = mwindow->edl->add_clip(window->clip);
83 // Copy clip to existing clip in EDL
85 original->copy_session(clip);
88 // mwindow->vwindow->gui->update_sources(mwindow->vwindow->gui->source->get_text());
91 mwindow->awindow->gui->lock_window();
92 mwindow->awindow->gui->update_assets();
93 mwindow->awindow->gui->flush();
94 mwindow->awindow->gui->unlock_window();
96 // Change VWindow to it if vwindow was called
97 // But this doesn't let you easily create a lot of clips.
98 if(vwindow && create_it)
100 // vwindow->change_source(new_edl);
105 mwindow->session->clip_number--;
110 // For creating new clips, the original was copied in add_clip.
111 // For editing old clips, the original was transferred to another variable.
125 ClipEditWindow::ClipEditWindow(MWindow *mwindow, ClipEdit *thread)
126 : BC_Window(PROGRAM_NAME ": Clip Info",
127 mwindow->gui->get_abs_cursor_x() - 400 / 2,
128 mwindow->gui->get_abs_cursor_y() - 350 / 2,
137 this->mwindow = mwindow;
138 this->thread = thread;
141 ClipEditWindow::~ClipEditWindow()
146 void ClipEditWindow::create_objects()
148 this->clip = thread->clip;
149 this->create_it = thread->create_it;
156 add_subwindow(title = new BC_Title(x1, y, _("Title:")));
157 y += title->get_h() + 5;
158 add_subwindow(textbox = new ClipEditTitle(this, x1, y, get_w() - x1 * 2));
159 y += textbox->get_h() + 10;
160 add_subwindow(title = new BC_Title(x1, y, _("Comments:")));
161 y += title->get_h() + 5;
162 add_subwindow(textbox = new ClipEditComments(this,
166 BC_TextBox::pixels_to_rows(this, MEDIUMFONT, get_h() - 10 - 40 - y)));
170 add_subwindow(new BC_OKButton(this));
171 add_subwindow(new BC_CancelButton(this));
179 ClipEditTitle::ClipEditTitle(ClipEditWindow *window, int x, int y, int w)
180 : BC_TextBox(x, y, w, 1, window->clip->local_session->clip_title)
182 this->window = window;
185 int ClipEditTitle::handle_event()
187 strcpy(window->clip->local_session->clip_title, get_text());
195 ClipEditComments::ClipEditComments(ClipEditWindow *window, int x, int y, int w, int rows)
196 : BC_TextBox(x, y, w, rows, window->clip->local_session->clip_notes)
198 this->window = window;
201 int ClipEditComments::handle_event()
203 strcpy(window->clip->local_session->clip_notes, get_text());