X-Git-Url: http://git.cinelerra-gg.org/git/?p=goodguy%2Fhistory.git;a=blobdiff_plain;f=cinelerra-5.1%2Fcinelerra%2Fgwindowgui.C;h=c5248b4839b18591c02913405e7ebd2cd12f4c13;hp=97a9adc2da970616ef6d263430214ae992df6879;hb=7e5a0760f40ff787cc3d93cb7768a901ebe52809;hpb=b9f98da8f1cd8b7b31ead02fa41f299b56cac3da diff --git a/cinelerra-5.1/cinelerra/gwindowgui.C b/cinelerra-5.1/cinelerra/gwindowgui.C index 97a9adc2..c5248b48 100644 --- a/cinelerra-5.1/cinelerra/gwindowgui.C +++ b/cinelerra-5.1/cinelerra/gwindowgui.C @@ -60,7 +60,7 @@ void GWindowGUI::start_color_thread(GWindowColorButton *color_button) { unlock_window(); delete color_thread; - color_thread = new GWindowColorThread(color_button); + color_thread = new GWindowColorThread(this, color_button); int color = auto_colors[color_button->auto_toggle->info->ref]; color_thread->start(color); lock_window("GWindowGUI::start_color_thread"); @@ -249,11 +249,12 @@ void GWindowColorButton::update_gui(int color) draw_face(); } -GWindowColorThread::GWindowColorThread(GWindowColorButton *color_button) +GWindowColorThread::GWindowColorThread(GWindowGUI *gui, GWindowColorButton *color_button) : ColorPicker(0, color_button->auto_toggle->caption) { - this->color = 0; + this->gui = gui; this->color_button = color_button; + this->color = 0; color_update = new GWindowColorUpdate(this); } @@ -271,7 +272,6 @@ void GWindowColorThread::start(int color) void GWindowColorThread::handle_done_event(int result) { color_update->stop(); - GWindowGUI *gui = color_button->auto_toggle->gui; int ref = color_button->auto_toggle->info->ref; gui->lock_window("GWindowColorThread::handle_done_event"); if( !result ) { @@ -284,7 +284,7 @@ void GWindowColorThread::handle_done_event(int result) color_button->update_gui(color); } gui->unlock_window(); - MWindowGUI *mwindow_gui = color_button->auto_toggle->gui->mwindow->gui; + MWindowGUI *mwindow_gui = gui->mwindow->gui; mwindow_gui->lock_window("GWindowColorUpdate::run"); mwindow_gui->draw_overlays(1); mwindow_gui->unlock_window(); @@ -299,7 +299,9 @@ int GWindowColorThread::handle_new_color(int color, int alpha) void GWindowColorThread::update_gui() { + gui->lock_window("GWindowColorThread::update_gui"); color_button->update_gui(color); + gui->unlock_window(); } GWindowColorUpdate::GWindowColorUpdate(GWindowColorThread *color_thread) @@ -373,7 +375,7 @@ void GWindowGUI::create_objects() } const char *label = _(tp->isauto ? auto_text[tp->ref] : other_text[tp->ref]); int color = !tp->isauto ? -1 : auto_colors[tp->ref]; - GWindowToggle *toggle = new GWindowToggle(mwindow, this, x, y, label, color, tp); + GWindowToggle *toggle = new GWindowToggle(this, x, y, label, color, tp); add_tool(toggles[i] = toggle); if( vframe ) draw_vframe(vframe, get_w()-vframe->get_w()-10, y); @@ -447,11 +449,10 @@ int GWindowGUI::keypress_event() } -GWindowToggle::GWindowToggle(MWindow *mwindow, GWindowGUI *gui, int x, int y, +GWindowToggle::GWindowToggle(GWindowGUI *gui, int x, int y, const char *text, int color, toggleinfo *info) - : BC_CheckBox(x, y, *get_main_value(mwindow, info), text, MEDIUMFONT, color) + : BC_CheckBox(x, y, *get_main_value(gui->mwindow, info), text, MEDIUMFONT, color) { - this->mwindow = mwindow; this->gui = gui; this->info = info; this->color = color; @@ -466,12 +467,13 @@ GWindowToggle::~GWindowToggle() int GWindowToggle::handle_event() { int value = get_value(); - *get_main_value(mwindow, info) = value; + *get_main_value(gui->mwindow, info) = value; gui->update_mwindow(); // Update stuff in MWindow unlock_window(); + MWindow *mwindow = gui->mwindow; mwindow->gui->lock_window("GWindowToggle::handle_event"); if( info->isauto ) { int autogroup_type = -1; @@ -538,7 +540,7 @@ int* GWindowToggle::get_main_value(MWindow *mwindow, toggleinfo *info) void GWindowToggle::update() { - int *vp = get_main_value(mwindow, info); + int *vp = get_main_value(gui->mwindow, info); if( !vp ) return; set_value(*vp); }