5 #include "edlsession.h"
6 #include "gwindowgui.h"
9 #include "mainsession.h"
11 #include "mwindowgui.h"
12 #include "trackcanvas.h"
18 GWindowGUI::GWindowGUI(MWindow *mwindow,
21 : BC_Window(PROGRAM_NAME N_(": Overlays"),
22 mwindow->session->gwindow_x,
23 mwindow->session->gwindow_y,
32 this->mwindow = mwindow;
35 static char *other_text[NONAUTOTOGGLES_COUNT] =
43 static char *auto_text[] =
59 static toggleinfo toggle_order[] =
61 {0, NONAUTOTOGGLES_ASSETS},
62 {0, NONAUTOTOGGLES_TITLES},
63 {0, NONAUTOTOGGLES_TRANSITIONS},
68 {0, NONAUTOTOGGLES_PLUGIN_AUTOS},
70 {1, AUTOMATION_CAMERA_X},
71 {1, AUTOMATION_CAMERA_Y},
72 {1, AUTOMATION_CAMERA_Z},
73 {1, AUTOMATION_PROJECTOR_X},
74 {1, AUTOMATION_PROJECTOR_Y},
75 {1, AUTOMATION_PROJECTOR_Z},
78 void GWindowGUI::calculate_extents(BC_WindowBase *gui, int *w, int *h)
80 int temp1, temp2, temp3, temp4, temp5, temp6, temp7;
81 int current_w, current_h;
84 for(int i = 0; i < NONAUTOTOGGLES_COUNT + AUTOMATION_TOTAL; i++)
86 BC_Toggle::calculate_extents(gui,
87 BC_WindowBase::get_resources()->checkbox_images,
98 toggle_order[i].isauto ? auto_text[toggle_order[i].ref] : other_text[toggle_order[i].ref]);
99 *w = MAX(current_w, *w);
109 void GWindowGUI::create_objects()
114 for(int i = 0; i < NONAUTOTOGGLES_COUNT + AUTOMATION_TOTAL; i++)
116 add_tool(toggles[i] = new GWindowToggle(mwindow,
121 y += toggles[i]->get_h() + 5;
125 void GWindowGUI::update_mwindow()
128 mwindow->gui->mainmenu->update_toggles(1);
129 lock_window("GWindowGUI::update_mwindow");
132 void GWindowGUI::update_toggles(int use_lock)
134 if(use_lock) lock_window("GWindowGUI::update_toggles");
136 for(int i = 0; i < NONAUTOTOGGLES_COUNT + AUTOMATION_TOTAL; i++)
138 toggles[i]->update();
141 if(use_lock) unlock_window();
144 int GWindowGUI::translation_event()
146 mwindow->session->gwindow_x = get_x();
147 mwindow->session->gwindow_y = get_y();
151 int GWindowGUI::close_event()
154 mwindow->session->show_gwindow = 0;
157 mwindow->gui->lock_window("GWindowGUI::close_event");
158 mwindow->gui->mainmenu->show_gwindow->set_checked(0);
159 mwindow->gui->unlock_window();
161 lock_window("GWindowGUI::close_event");
162 mwindow->save_defaults();
166 int GWindowGUI::keypress_event()
168 switch(get_keypress())
187 GWindowToggle::GWindowToggle(MWindow *mwindow,
191 toggleinfo toggleinf)
194 *get_main_value(mwindow, toggleinf),
195 toggleinf.isauto ? auto_text[toggleinf.ref] : other_text[toggleinf.ref])
197 this->mwindow = mwindow;
199 this->toggleinf = toggleinf;
202 int GWindowToggle::handle_event()
204 *get_main_value(mwindow, toggleinf) = get_value();
205 gui->update_mwindow();
208 // Update stuff in MWindow
210 mwindow->gui->lock_window("GWindowToggle::handle_event");
213 mwindow->gui->canvas->draw_overlays();
214 mwindow->gui->canvas->flash();
218 switch(toggleinf.ref)
220 case NONAUTOTOGGLES_ASSETS:
221 case NONAUTOTOGGLES_TITLES:
222 mwindow->gui->update(1,
231 case NONAUTOTOGGLES_TRANSITIONS:
232 case NONAUTOTOGGLES_PLUGIN_AUTOS:
233 mwindow->gui->canvas->draw_overlays();
234 mwindow->gui->canvas->flash();
239 mwindow->gui->unlock_window();
240 lock_window("GWindowToggle::handle_event");
245 int* GWindowToggle::get_main_value(MWindow *mwindow, toggleinfo toggleinf)
249 return &mwindow->edl->session->auto_conf->autos[toggleinf.ref];
253 switch(toggleinf.ref)
255 case NONAUTOTOGGLES_ASSETS:
256 return &mwindow->edl->session->show_assets;
258 case NONAUTOTOGGLES_TITLES:
259 return &mwindow->edl->session->show_titles;
261 case NONAUTOTOGGLES_TRANSITIONS:
262 return &mwindow->edl->session->auto_conf->transitions;
264 case NONAUTOTOGGLES_PLUGIN_AUTOS:
265 return &mwindow->edl->session->auto_conf->plugins;
271 void GWindowToggle::update()
273 set_value(*get_main_value(mwindow, toggleinf));