Fix #34357: image editor scope and clip editor track preview did not resize

properly with different DPI settings.
This commit is contained in:
Brecht Van Lommel 2013-02-22 16:11:27 +00:00
parent 7ae17e9ed4
commit ce54cc111d
3 changed files with 13 additions and 13 deletions

@ -4253,7 +4253,7 @@ static int ui_numedit_but_HISTOGRAM(uiBut *but, uiHandleButtonData *data, int mx
if (in_scope_resize_zone(but, data->dragstartx, data->dragstarty)) { if (in_scope_resize_zone(but, data->dragstartx, data->dragstarty)) {
/* resize histogram widget itself */ /* resize histogram widget itself */
hist->height = BLI_rctf_size_y(&but->rect) + (data->dragstarty - my); hist->height = (BLI_rctf_size_y(&but->rect) + (data->dragstarty - my))/UI_DPI_FAC;
} }
else { else {
/* scale histogram values (dy / 10 for better control) */ /* scale histogram values (dy / 10 for better control) */
@ -4337,7 +4337,7 @@ static int ui_numedit_but_WAVEFORM(uiBut *but, uiHandleButtonData *data, int mx,
if (in_scope_resize_zone(but, data->dragstartx, data->dragstarty)) { if (in_scope_resize_zone(but, data->dragstartx, data->dragstarty)) {
/* resize waveform widget itself */ /* resize waveform widget itself */
scopes->wavefrm_height = BLI_rctf_size_y(&but->rect) + (data->dragstarty - my); scopes->wavefrm_height = (BLI_rctf_size_y(&but->rect) + (data->dragstarty - my))/UI_DPI_FAC;
} }
else { else {
/* scale waveform values */ /* scale waveform values */
@ -4419,7 +4419,7 @@ static int ui_numedit_but_VECTORSCOPE(uiBut *but, uiHandleButtonData *data, int
if (in_scope_resize_zone(but, data->dragstartx, data->dragstarty)) { if (in_scope_resize_zone(but, data->dragstartx, data->dragstarty)) {
/* resize vectorscope widget itself */ /* resize vectorscope widget itself */
scopes->vecscope_height = BLI_rctf_size_y(&but->rect) + (data->dragstarty - my); scopes->vecscope_height = (BLI_rctf_size_y(&but->rect) + (data->dragstarty - my))/UI_DPI_FAC;
} }
data->draglastx = mx; data->draglastx = mx;
@ -4622,7 +4622,7 @@ static int ui_numedit_but_TRACKPREVIEW(bContext *C, uiBut *but, uiHandleButtonDa
if (in_scope_resize_zone(but, data->dragstartx, data->dragstarty)) { if (in_scope_resize_zone(but, data->dragstartx, data->dragstarty)) {
/* resize preview widget itself */ /* resize preview widget itself */
scopes->track_preview_height = BLI_rctf_size_y(&but->rect) + (data->dragstarty - my); scopes->track_preview_height = (BLI_rctf_size_y(&but->rect) + (data->dragstarty - my))/UI_DPI_FAC;
} }
else { else {
if (!scopes->track_locked) { if (!scopes->track_locked) {

@ -1679,7 +1679,7 @@ void uiTemplateHistogram(uiLayout *layout, PointerRNA *ptr, const char *propname
hist = (Histogram *)cptr.data; hist = (Histogram *)cptr.data;
hist->height = (hist->height <= UI_UNIT_Y) ? UI_UNIT_Y : hist->height; hist->height = (hist->height <= 20) ? 20 : hist->height;
bt = uiDefBut(block, HISTOGRAM, 0, "", rect.xmin, rect.ymin, BLI_rctf_size_x(&rect), UI_DPI_FAC * hist->height, bt = uiDefBut(block, HISTOGRAM, 0, "", rect.xmin, rect.ymin, BLI_rctf_size_x(&rect), UI_DPI_FAC * hist->height,
hist, 0, 0, 0, 0, ""); hist, 0, 0, 0, 0, "");
@ -1718,7 +1718,7 @@ void uiTemplateWaveform(uiLayout *layout, PointerRNA *ptr, const char *propname)
block = uiLayoutAbsoluteBlock(layout); block = uiLayoutAbsoluteBlock(layout);
scopes->wavefrm_height = (scopes->wavefrm_height <= UI_UNIT_Y) ? UI_UNIT_Y : scopes->wavefrm_height; scopes->wavefrm_height = (scopes->wavefrm_height <= 20) ? 20 : scopes->wavefrm_height;
bt = uiDefBut(block, WAVEFORM, 0, "", rect.xmin, rect.ymin, BLI_rctf_size_x(&rect), UI_DPI_FAC * scopes->wavefrm_height, bt = uiDefBut(block, WAVEFORM, 0, "", rect.xmin, rect.ymin, BLI_rctf_size_x(&rect), UI_DPI_FAC * scopes->wavefrm_height,
scopes, 0, 0, 0, 0, ""); scopes, 0, 0, 0, 0, "");
@ -1756,7 +1756,7 @@ void uiTemplateVectorscope(uiLayout *layout, PointerRNA *ptr, const char *propna
block = uiLayoutAbsoluteBlock(layout); block = uiLayoutAbsoluteBlock(layout);
scopes->vecscope_height = (scopes->vecscope_height <= UI_UNIT_Y) ? UI_UNIT_Y : scopes->vecscope_height; scopes->vecscope_height = (scopes->vecscope_height <= 20) ? 20 : scopes->vecscope_height;
bt = uiDefBut(block, VECTORSCOPE, 0, "", rect.xmin, rect.ymin, BLI_rctf_size_x(&rect), bt = uiDefBut(block, VECTORSCOPE, 0, "", rect.xmin, rect.ymin, BLI_rctf_size_x(&rect),
UI_DPI_FAC * scopes->vecscope_height, scopes, 0, 0, 0, 0, ""); UI_DPI_FAC * scopes->vecscope_height, scopes, 0, 0, 0, 0, "");

@ -169,16 +169,16 @@ void uiTemplateTrack(uiLayout *layout, PointerRNA *ptr, const char *propname)
scopesptr = RNA_property_pointer_get(ptr, prop); scopesptr = RNA_property_pointer_get(ptr, prop);
scopes = (MovieClipScopes *)scopesptr.data; scopes = (MovieClipScopes *)scopesptr.data;
rect.xmin = 0; rect.xmax = 200; rect.xmin = 0; rect.xmax = 10.0f * UI_UNIT_X;
rect.ymin = 0; rect.ymax = 120; rect.ymin = 0; rect.ymax = 6.0f * UI_UNIT_Y;
block = uiLayoutAbsoluteBlock(layout); block = uiLayoutAbsoluteBlock(layout);
scopes->track_preview_height = scopes->track_preview_height =
(scopes->track_preview_height <= UI_UNIT_Y) ? UI_UNIT_Y : scopes->track_preview_height; (scopes->track_preview_height <= 20) ? 20 : scopes->track_preview_height;
uiDefBut(block, TRACKPREVIEW, 0, "", rect.xmin, rect.ymin, BLI_rctf_size_x(&rect), uiDefBut(block, TRACKPREVIEW, 0, "", rect.xmin, rect.ymin, BLI_rctf_size_x(&rect),
scopes->track_preview_height, scopes, 0, 0, 0, 0, ""); scopes->track_preview_height * UI_DPI_FAC, scopes, 0, 0, 0, 0, "");
} }
/********************* Marker Template ************************/ /********************* Marker Template ************************/
@ -393,7 +393,7 @@ void uiTemplateMarker(uiLayout *layout, PointerRNA *ptr, const char *propname, P
else else
tip = TIP_("Marker is enabled at current frame"); tip = TIP_("Marker is enabled at current frame");
bt = uiDefIconButBitI(block, TOGN, MARKER_DISABLED, 0, ICON_RESTRICT_VIEW_OFF, 0, 0, 20, 20, bt = uiDefIconButBitI(block, TOGN, MARKER_DISABLED, 0, ICON_RESTRICT_VIEW_OFF, 0, 0, UI_UNIT_X, UI_UNIT_Y,
&cb->marker_flag, 0, 0, 1, 0, tip); &cb->marker_flag, 0, 0, 1, 0, tip);
uiButSetNFunc(bt, marker_update_cb, cb, NULL); uiButSetNFunc(bt, marker_update_cb, cb, NULL);
} }
@ -407,7 +407,7 @@ void uiTemplateMarker(uiLayout *layout, PointerRNA *ptr, const char *propname, P
if (track->flag & TRACK_LOCKED) { if (track->flag & TRACK_LOCKED) {
uiLayoutSetActive(layout, FALSE); uiLayoutSetActive(layout, FALSE);
block = uiLayoutAbsoluteBlock(layout); block = uiLayoutAbsoluteBlock(layout);
uiDefBut(block, LABEL, 0, IFACE_("Track is locked"), 0, 0, 300, 19, NULL, 0, 0, 0, 0, ""); uiDefBut(block, LABEL, 0, IFACE_("Track is locked"), 0, 0, UI_UNIT_X*15.0f, UI_UNIT_Y, NULL, 0, 0, 0, 0, "");
return; return;
} }