{
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");
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);
}
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 ) {
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();
void GWindowColorThread::update_gui()
{
+ gui->lock_window("GWindowColorThread::update_gui");
color_button->update_gui(color);
+ gui->unlock_window();
}
GWindowColorUpdate::GWindowColorUpdate(GWindowColorThread *color_thread)
}
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);
}
-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;
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;
void GWindowToggle::update()
{
- int *vp = get_main_value(mwindow, info);
+ int *vp = get_main_value(gui->mwindow, info);
if( !vp ) return;
set_value(*vp);
}