mirror of https://github.com/odrling/Aegisub
Add option to restrict color picker to window
This commit is contained in:
parent
238dbb386d
commit
2c296afdb8
|
@ -386,15 +386,21 @@ void ColorPickerScreenDropper::DropFromScreenXY(int x, int y) {
|
||||||
wxMemoryDC capdc(capture);
|
wxMemoryDC capdc(capture);
|
||||||
capdc.SetPen(*wxTRANSPARENT_PEN);
|
capdc.SetPen(*wxTRANSPARENT_PEN);
|
||||||
#ifndef __WXMAC__
|
#ifndef __WXMAC__
|
||||||
wxWindow *superparent = GetParent();
|
std::unique_ptr<wxDC> screen;
|
||||||
while (superparent->GetParent() != nullptr) {
|
|
||||||
superparent = superparent->GetParent();
|
|
||||||
}
|
|
||||||
superparent->ScreenToClient(&x, &y);
|
|
||||||
|
|
||||||
wxWindowDC screen(superparent);
|
if (!OPT_GET("Tool/Color Picker/Restrict to Window")->GetBool()) {
|
||||||
|
screen = agi::make_unique<wxScreenDC>();
|
||||||
|
} else {
|
||||||
|
wxWindow *superparent = GetParent();
|
||||||
|
while (superparent->GetParent() != nullptr) {
|
||||||
|
superparent = superparent->GetParent();
|
||||||
|
}
|
||||||
|
superparent->ScreenToClient(&x, &y);
|
||||||
|
|
||||||
|
screen = agi::make_unique<wxWindowDC>(superparent);
|
||||||
|
}
|
||||||
capdc.StretchBlit(0, 0, resx * magnification, resy * magnification,
|
capdc.StretchBlit(0, 0, resx * magnification, resy * magnification,
|
||||||
&screen, x - resx / 2, y - resy / 2, resx, resy);
|
screen.get(), x - resx / 2, y - resy / 2, resx, resy);
|
||||||
#else
|
#else
|
||||||
// wxScreenDC doesn't work on recent versions of OS X so do it manually
|
// wxScreenDC doesn't work on recent versions of OS X so do it manually
|
||||||
|
|
||||||
|
|
|
@ -573,6 +573,9 @@
|
||||||
"Maximized" : false,
|
"Maximized" : false,
|
||||||
"Skip Whitespace" : true
|
"Skip Whitespace" : true
|
||||||
},
|
},
|
||||||
|
"Color Picker" : {
|
||||||
|
"Restrict to Window" : false
|
||||||
|
},
|
||||||
"Visual" : {
|
"Visual" : {
|
||||||
"Autohide": false
|
"Autohide": false
|
||||||
}
|
}
|
||||||
|
|
|
@ -573,6 +573,9 @@
|
||||||
"Maximized" : false,
|
"Maximized" : false,
|
||||||
"Skip Whitespace" : true
|
"Skip Whitespace" : true
|
||||||
},
|
},
|
||||||
|
"Color Picker" : {
|
||||||
|
"Restrict to Window" : false
|
||||||
|
},
|
||||||
"Visual" : {
|
"Visual" : {
|
||||||
"Autohide": false
|
"Autohide": false
|
||||||
}
|
}
|
||||||
|
|
|
@ -228,6 +228,9 @@ void Interface(wxTreebook *book, Preferences *parent) {
|
||||||
auto tl_assistant = p->PageSizer(_("Translation Assistant"));
|
auto tl_assistant = p->PageSizer(_("Translation Assistant"));
|
||||||
p->OptionAdd(tl_assistant, _("Skip over whitespace"), "Tool/Translation Assistant/Skip Whitespace");
|
p->OptionAdd(tl_assistant, _("Skip over whitespace"), "Tool/Translation Assistant/Skip Whitespace");
|
||||||
|
|
||||||
|
auto color_picker = p->PageSizer(_("Color Picker"));
|
||||||
|
p->OptionAdd(color_picker, _("Restrict Screen Picker to Window"), "Tool/Color Picker/Restrict to Window");
|
||||||
|
|
||||||
p->SetSizerAndFit(p->sizer);
|
p->SetSizerAndFit(p->sizer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue