Actually read the initial alpha for the color picker buttons

This commit is contained in:
Thomas Goyne 2013-01-13 20:33:49 -08:00
parent abf592e705
commit 8162ebea24
2 changed files with 11 additions and 5 deletions

View file

@ -289,7 +289,9 @@ void show_color_picker(const agi::Context *c, agi::Color (AssStyle::*field), con
int blockn = block_at_pos(line->Text, sel_start);
int initial_sel_start = sel_start, initial_sel_end = sel_end;
int a = get_value(blocks, blockn, (int)color.a, alpha, "\\alpha");
color = get_value(blocks, blockn, color, tag, alt);
color.a = a;
int commit_id = -1;
bool ok = GetColorFromUser(c->parent, color, true, [&](agi::Color new_color) {
set_tag(line, blocks, tag, new_color.GetAssOverrideFormatted(), sel_start, sel_end);

View file

@ -722,7 +722,16 @@ DialogColorPicker::~DialogColorPicker() {
if (screen_dropper_icon->HasCapture()) screen_dropper_icon->ReleaseMouse();
}
static void change_value(wxSpinCtrl *ctrl, int value) {
wxEventBlocker blocker(ctrl);
ctrl->SetValue(value);
}
void DialogColorPicker::SetColor(agi::Color new_color) {
change_value(alpha_input, new_color.a);
alpha_slider->SetXY(0, new_color.a);
cur_color.a = new_color.a;
SetRGB(new_color);
spectrum_dirty = true;
UpdateFromRGB();
@ -733,11 +742,6 @@ void DialogColorPicker::AddColorToRecent() {
OPT_SET("Tool/Colour Picker/Recent Colours")->SetListColor(recent_box->Save());
}
static void change_value(wxSpinCtrl *ctrl, int value) {
wxEventBlocker blocker(ctrl);
ctrl->SetValue(value);
}
void DialogColorPicker::SetRGB(agi::Color new_color) {
change_value(rgb_input[0], new_color.r);
change_value(rgb_input[1], new_color.g);