2 #include "awindowgui.h"
6 #include "localsession.h"
7 #include "mainsession.h"
9 #include "mwindowgui.h"
11 #include "vwindowgui.h"
14 #define _(String) gettext(String)
15 #define gettext_noop(String) String
16 #define N_(String) gettext_noop (String)
20 ClipEdit::ClipEdit(MWindow *mwindow, AWindow *awindow, VWindow *vwindow)
23 this->mwindow = mwindow;
24 this->awindow = awindow;
25 this->vwindow = vwindow;
34 void ClipEdit::edit_clip(EDL *clip)
36 // Allow more than one window so we don't have to delete the clip in handle_event
45 void ClipEdit::create_clip(EDL *clip)
47 // Allow more than one window so we don't have to delete the clip in handle_event
63 clip = new EDL(mwindow->edl);
64 clip->create_objects();
65 clip->copy_all(original);
75 ClipEditWindow *window = new ClipEditWindow(mwindow, this);
76 window->create_objects();
77 int result = window->run_window();
84 new_edl = mwindow->edl->add_clip(window->clip);
86 // Copy clip to existing clip in EDL
88 original->copy_session(clip);
91 // mwindow->vwindow->gui->update_sources(mwindow->vwindow->gui->source->get_text());
94 mwindow->awindow->gui->lock_window();
95 mwindow->awindow->gui->update_assets();
96 mwindow->awindow->gui->flush();
97 mwindow->awindow->gui->unlock_window();
99 // Change VWindow to it if vwindow was called
100 // But this doesn't let you easily create a lot of clips.
101 if(vwindow && create_it)
103 // vwindow->change_source(new_edl);
108 mwindow->session->clip_number--;
113 // For creating new clips, the original was copied in add_clip.
114 // For editing old clips, the original was transferred to another variable.
128 ClipEditWindow::ClipEditWindow(MWindow *mwindow, ClipEdit *thread)
129 : BC_Window(PROGRAM_NAME ": Clip Info",
130 mwindow->gui->get_abs_cursor_x() - 400 / 2,
131 mwindow->gui->get_abs_cursor_y() - 350 / 2,
140 this->mwindow = mwindow;
141 this->thread = thread;
144 ClipEditWindow::~ClipEditWindow()
149 void ClipEditWindow::create_objects()
151 this->clip = thread->clip;
152 this->create_it = thread->create_it;
159 add_subwindow(title = new BC_Title(x1, y, _("Title:")));
160 y += title->get_h() + 5;
161 add_subwindow(textbox = new ClipEditTitle(this, x1, y, get_w() - x1 * 2));
162 y += textbox->get_h() + 10;
163 add_subwindow(title = new BC_Title(x1, y, _("Comments:")));
164 y += title->get_h() + 5;
165 add_subwindow(textbox = new ClipEditComments(this,
169 BC_TextBox::pixels_to_rows(this, MEDIUMFONT, get_h() - 10 - 40 - y)));
173 add_subwindow(new BC_OKButton(this));
174 add_subwindow(new BC_CancelButton(this));
182 ClipEditTitle::ClipEditTitle(ClipEditWindow *window, int x, int y, int w)
183 : BC_TextBox(x, y, w, 1, window->clip->local_session->clip_title)
185 this->window = window;
188 int ClipEditTitle::handle_event()
190 strcpy(window->clip->local_session->clip_title, get_text());
198 ClipEditComments::ClipEditComments(ClipEditWindow *window, int x, int y, int w, int rows)
199 : BC_TextBox(x, y, w, rows, window->clip->local_session->clip_notes)
201 this->window = window;
204 int ClipEditComments::handle_event()
206 strcpy(window->clip->local_session->clip_notes, get_text());