Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

Commit 787bd2e

Browse files
author
runrevali
committed
Merge remote-tracking branch 'upstream/develop' into refactor
Conflicts: engine/src/MCBlock.h engine/src/block.cpp engine/src/button.cpp engine/src/line.cpp engine/src/line.h
2 parents ab51f54 + b6b5a99 commit 787bd2e

File tree

11 files changed

+55
-23
lines changed

11 files changed

+55
-23
lines changed

docs/notes/bugfix-13351.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# printing a field with listbehaviour set to true makes gray background

docs/notes/bugfix-13493.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Scroll is being reset in 6.7 when it is not in 6.5.2

docs/notes/bugfix-13675.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Scrollbar for the font selection in the script editor preferences doesn't work

docs/notes/bugfix-13711.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Player plays audio but not video

engine/src/block.cpp

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -702,15 +702,13 @@ bool MCBlock::fit(coord_t x, coord_t maxwidth, findex_t& r_break_index, bool& r_
702702
// but use the integer width to break. This ensures measure(a & b) == measure(a) + measure(b)
703703
// (otherwise you get drift as the accumulated width the block calculates is different
704704
// from the width of the text that is drawn).
705-
// AL-2014-09-11: [[ Bug 13403 ]] Continue to track width as an integer for breaking purposes
705+
706706
coord_t t_width_float;
707707
t_width_float = 0;
708-
int32_t t_width;
709-
t_width = 0;
710-
708+
711709
// MW-2009-04-23: [[ Bug ]] For printing, we measure complete runs of text otherwise we get
712710
// positioning issues.
713-
int4 t_last_break_width;
711+
coord_t t_last_break_width;
714712
t_last_break_width = 0;
715713
uint2 t_last_break_i;
716714
t_last_break_i = m_index;
@@ -783,22 +781,21 @@ bool MCBlock::fit(coord_t x, coord_t maxwidth, findex_t& r_break_index, bool& r_
783781
t_range = MCRangeMake(initial_i, i - initial_i);
784782
// MM-2014-04-16: [[ Bug 11964 ]] Pass through the transform of the stack to make sure the measurment is correct for scaled text.
785783
t_width_float += MCFontMeasureTextSubstringFloat(m_font, parent->GetInternalStringRef(), t_range, parent -> getparent() -> getstack() -> getdevicetransform());
786-
t_width = (int32_t)floorf(t_width_float);
787-
}
788-
789-
if (t_can_fit && t_width > maxwidth)
784+
}
785+
786+
if (t_can_fit && t_width_float > maxwidth)
790787
break;
791788

792789
if (t_can_break)
793790
t_break_index = i;
794791

795-
if (t_width <= maxwidth)
792+
if (t_width_float <= maxwidth)
796793
{
797794
t_can_fit = true;
798795
t_whole_block = t_end_of_block;
799796
}
800797

801-
if (t_width >= maxwidth)
798+
if (t_width_float >= maxwidth)
802799
break;
803800
}
804801

engine/src/button.cpp

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1151,8 +1151,17 @@ Boolean MCButton::mdown(uint2 which)
11511151
{
11521152
// SN-2014-08-26: [[ Bug 13201 ]] mx/my are now related to the button's rectangle,
11531153
// not the stack's rectangle anymore.
1154-
if (state & CS_SCROLLBAR && mx > rect.width - MCscrollbarwidth
1155-
&& mx < rect.width)
1154+
// SN-2014-10-17: [[ Bug 13675 ]] mx/my refer to the button's rectangle on Mac only
1155+
int2 t_right_limit, t_left_limit;
1156+
#ifdef _MACOSX
1157+
t_left_limit = rect.width - MCscrollbarwidth;
1158+
t_right_limit = rect.width;
1159+
#else
1160+
t_left_limit = rect.x + rect.width - MCscrollbarwidth;
1161+
t_right_limit = rect.x + rect.width;
1162+
#endif
1163+
if (state & CS_SCROLLBAR && mx > t_left_limit
1164+
&& mx < t_right_limit)
11561165
{
11571166
menu->mdown(which);
11581167
state |= CS_FIELD_GRAB;
@@ -4741,4 +4750,4 @@ IO_stat MCButton::load(IO_handle stream, uint32_t version)
47414750
}
47424751
}
47434752
return IO_NORMAL;
4744-
}
4753+
}

engine/src/cmdsf.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4301,7 +4301,13 @@ void MCRead::exec_ctxt(MCExecContext& ctxt)
43014301
if (arg == OA_FILE)
43024302
t_is_text = MCfiles[index] . textmode != 0;
43034303
else if (arg == OA_PROCESS)
4304+
{
43044305
t_is_text = MCprocesses[index] . textmode != 0;
4306+
// SN-2014-10-14: [[ Bug 13658 ]] Ensure that we read all we can from a binary process, not
4307+
// until 0x4 (which might be read before the end, when outputting binary data)
4308+
if (!t_is_text && *sptr == 0x4)
4309+
ep.setsvalue("");
4310+
}
43054311
else
43064312
t_is_text = true;
43074313
if (!t_is_text)

engine/src/customprinter.cpp

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -358,12 +358,14 @@ void MCCustomMetaContext::domark(MCMark *p_mark)
358358
{
359359
// MM-2014-04-23: [[ Bug 11884 ]] Inset the bounds. Since MCPath only accepts ints, if the inset value is uneven,
360360
// round up to the nearest even value, keeping behaviour as close to that of the graphics context as possible.
361-
if (!(p_mark -> rectangle . inset % 2))
361+
// SN-2014-10-17: [[ Bug 13351 ]] Only round up existing inset
362+
if (p_mark -> rectangle . inset && !(p_mark -> rectangle . inset % 2))
362363
p_mark -> rectangle . inset ++;
364+
// SN-2014-10-17: [[ Bug 13351 ]] Be careful not to underflow the bounds
363365
p_mark -> rectangle . bounds = MCRectangleMake(p_mark -> rectangle . bounds . x + p_mark -> rectangle . inset / 2,
364366
p_mark -> rectangle . bounds . y + p_mark -> rectangle . inset / 2,
365-
p_mark -> rectangle . bounds . width - p_mark -> rectangle . inset,
366-
p_mark -> rectangle . bounds . height - p_mark -> rectangle . inset);
367+
MCMin(p_mark -> rectangle . bounds . width, p_mark -> rectangle . bounds . width - p_mark -> rectangle . inset),
368+
MCMin(p_mark -> rectangle . bounds . height, p_mark -> rectangle . bounds . height - p_mark -> rectangle . inset));
367369

368370
MCPath *t_path;
369371
if (p_mark -> stroke != nil && p_mark -> rectangle . bounds . height == 1)
@@ -385,12 +387,14 @@ void MCCustomMetaContext::domark(MCMark *p_mark)
385387
{
386388
// MM-2014-04-23: [[ Bug 11884 ]] Inset the bounds. Since MCPath only accepts ints, if the inset value is uneven,
387389
// round up to the nearest even value, keeping behaviour as close to that of the graphics context as possible.
390+
// SN-2014-10-17: [[ Bug 13351 ]] Only round up existing inset
388391
if (!(p_mark -> round_rectangle . inset % 2))
389392
p_mark -> round_rectangle . inset ++;
393+
// SN-2014-10-17: [[ Bug 13351 ]] Be careful not to underflow the bounds
390394
p_mark -> round_rectangle . bounds = MCRectangleMake(p_mark -> round_rectangle . bounds . x + p_mark -> round_rectangle . inset / 2,
391395
p_mark -> round_rectangle . bounds . y + p_mark -> round_rectangle . inset / 2,
392-
p_mark -> round_rectangle . bounds . width - p_mark -> round_rectangle . inset,
393-
p_mark -> round_rectangle . bounds . height - p_mark -> round_rectangle . inset);
396+
MCMin(p_mark -> round_rectangle . bounds . width, p_mark -> round_rectangle . bounds . width - p_mark -> round_rectangle . inset),
397+
MCMin(p_mark -> round_rectangle . bounds . height, p_mark -> round_rectangle . bounds . height - p_mark -> round_rectangle . inset));
394398

395399
MCPath *t_path;
396400
t_path = MCPath::create_rounded_rectangle(p_mark -> round_rectangle . bounds, p_mark -> round_rectangle . radius / 2, p_mark -> stroke != nil);
@@ -407,12 +411,14 @@ void MCCustomMetaContext::domark(MCMark *p_mark)
407411
{
408412
// MM-2014-04-23: [[ Bug 11884 ]] Inset the bounds. Since MCPath only accepts ints, if the inset value is uneven,
409413
// round up to the nearest even value, keeping behaviour as close to that of the graphics context as possible.
414+
// SN-2014-10-17: [[ Bug 13351 ]] Only round up existing inset
410415
if (!(p_mark -> arc . inset % 2))
411416
p_mark -> arc . inset ++;
417+
// SN-2014-10-17: [[ Bug 13351 ]] Be careful not to underflow the bounds
412418
p_mark -> arc . bounds = MCRectangleMake(p_mark -> arc . bounds . x + p_mark -> arc . inset / 2,
413419
p_mark -> arc . bounds . y + p_mark -> arc . inset / 2,
414-
p_mark -> arc . bounds . width - p_mark -> arc . inset,
415-
p_mark -> arc . bounds . height - p_mark -> arc . inset);
420+
MCMin(p_mark -> arc . bounds . width, p_mark -> arc . bounds . width - p_mark -> arc . inset),
421+
MCMin(p_mark -> arc . bounds . height, p_mark -> arc . bounds . height - p_mark -> arc . inset));
416422

417423
MCPath *t_path;
418424
if (p_mark -> arc . complete)

engine/src/fields.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -830,7 +830,9 @@ Exec_stat MCField::settextindex(uint4 parid, findex_t si, findex_t ei, MCStringR
830830

831831
// SN-2014-05-12 [[ Bug 12365 ]]
832832
// Redraw the cursor after the update
833-
replacecursor(True, True);
833+
// SN-2014-10-17: [[ Bug 13493 ]] Don't replace the cursor - unnecessary and causes
834+
// unwanted scrolling
835+
// replacecursor(True, True);
834836
}
835837

836838
return ES_NORMAL;

engine/src/line.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ MCLine::~MCLine()
7575
MCBlock *t_block;
7676
t_block = p_first;
7777
78-
int4 t_frontier_width;
78+
coord_t t_frontier_width;
7979
t_frontier_width = 0;
8080
8181
MCBlock *t_break_block;

0 commit comments

Comments
 (0)