5 #include "edlsession.h"
6 #include "gwindowgui.h"
8 #include "mainsession.h"
10 #include "mwindowgui.h"
11 #include "trackcanvas.h"
17 GWindowGUI::GWindowGUI(MWindow *mwindow,
20 : BC_Window(PROGRAM_NAME ": Overlays",
21 mwindow->session->gwindow_x,
22 mwindow->session->gwindow_y,
31 this->mwindow = mwindow;
34 static char *other_text[OTHER_TOGGLES] =
42 static char *auto_text[] =
58 void GWindowGUI::calculate_extents(BC_WindowBase *gui, int *w, int *h)
60 int temp1, temp2, temp3, temp4, temp5, temp6, temp7;
61 int current_w, current_h;
64 for(int i = 0; i < OTHER_TOGGLES; i++)
66 BC_Toggle::calculate_extents(gui,
67 BC_WindowBase::get_resources()->checkbox_images,
79 *w = MAX(current_w, *w);
83 for(int i = 0; i < AUTOMATION_TOTAL; i++)
85 BC_Toggle::calculate_extents(gui,
86 BC_WindowBase::get_resources()->checkbox_images,
98 *w = MAX(current_w, *w);
107 void GWindowGUI::create_objects()
112 for(int i = 0; i < OTHER_TOGGLES; i++)
114 add_tool(other[i] = new GWindowToggle(mwindow,
121 y += other[i]->get_h() + 5;
124 for(int i = 0; i < AUTOMATION_TOTAL; i++)
126 add_tool(auto_toggle[i] = new GWindowToggle(mwindow,
133 y += auto_toggle[i]->get_h() + 5;
137 void GWindowGUI::update_mwindow()
140 mwindow->gui->mainmenu->update_toggles(1);
141 lock_window("GWindowGUI::update_mwindow");
144 void GWindowGUI::update_toggles(int use_lock)
146 if(use_lock) lock_window("GWindowGUI::update_toggles");
148 for(int i = 0; i < OTHER_TOGGLES; i++)
153 for(int i = 0; i < AUTOMATION_TOTAL; i++)
155 auto_toggle[i]->update();
158 if(use_lock) unlock_window();
161 int GWindowGUI::translation_event()
163 mwindow->session->gwindow_x = get_x();
164 mwindow->session->gwindow_y = get_y();
168 int GWindowGUI::close_event()
171 mwindow->session->show_gwindow = 0;
174 mwindow->gui->lock_window("GWindowGUI::close_event");
175 mwindow->gui->mainmenu->show_gwindow->set_checked(0);
176 mwindow->gui->unlock_window();
178 lock_window("GWindowGUI::close_event");
179 mwindow->save_defaults();
183 int GWindowGUI::keypress_event()
185 switch(get_keypress())
204 GWindowToggle::GWindowToggle(MWindow *mwindow,
213 *get_main_value(mwindow, subscript, other),
216 this->mwindow = mwindow;
218 this->subscript = subscript;
222 int GWindowToggle::handle_event()
224 *get_main_value(mwindow, subscript, other) = get_value();
225 gui->update_mwindow();
228 // Update stuff in MWindow
230 mwindow->gui->lock_window("GWindowToggle::handle_event");
233 mwindow->gui->canvas->draw_overlays();
234 mwindow->gui->canvas->flash();
242 mwindow->gui->update(1,
253 mwindow->gui->canvas->draw_overlays();
254 mwindow->gui->canvas->flash();
259 mwindow->gui->unlock_window();
260 lock_window("GWindowToggle::handle_event");
265 int* GWindowToggle::get_main_value(MWindow *mwindow, int subscript, int other)
269 return &mwindow->edl->session->auto_conf->autos[subscript];
276 return &mwindow->edl->session->show_assets;
279 return &mwindow->edl->session->show_titles;
282 return &mwindow->edl->session->auto_conf->transitions;
285 return &mwindow->edl->session->auto_conf->plugins;
291 void GWindowToggle::update()
293 set_value(*get_main_value(mwindow, subscript, other));