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

Commit 7e84649

Browse files
committed
[[ FullscreenMode ]] Add fullscreen property to stack
[[ FullscreenMode ]] Implement fullscreen scale modes [[ FullscreenMode ]] Translate view->stack coords on Win32
1 parent da31e78 commit 7e84649

19 files changed

Lines changed: 638 additions & 109 deletions

engine/kernel.vcproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -566,6 +566,10 @@
566566
RelativePath="src\stacklst.h"
567567
>
568568
</File>
569+
<File
570+
RelativePath=".\src\stackview.cpp"
571+
>
572+
</File>
569573
<File
570574
RelativePath="src\styledtext.cpp"
571575
>

engine/src/card.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -672,7 +672,11 @@ Boolean MCCard::mdown(uint2 which)
672672
cptr = new MCImage(*MCtemplateimage);
673673
break;
674674
case T_DROPPER:
675-
MCscreen->dropper(getw(), MCmousex, MCmousey, NULL);
675+
// IM-2013-09-23: [[ FullscreenMode ]] Get mouse loc in view coordinates
676+
MCStack *t_mousestack;
677+
MCPoint t_mouseloc;
678+
MCscreen->getmouseloc(t_mousestack, t_mouseloc);
679+
MCscreen->dropper(getw(), t_mouseloc.x, t_mouseloc.y, NULL);
676680
message(MCM_color_changed);
677681
break;
678682
case T_BRUSH:

engine/src/cmdse.cpp

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -287,8 +287,9 @@ Exec_stat MCClickCmd::exec(MCExecPoint &ep)
287287
MCeerror->add(EE_CLICK_BADLOCATION, line, pos);
288288
return ES_ERROR;
289289
}
290-
int2 x, y;
291-
if (!MCU_stoi2x2(ep.getsvalue(), x, y))
290+
291+
MCPoint t_clickloc;
292+
if (!MCU_stoi2x2(ep.getsvalue(), t_clickloc.x, t_clickloc.y))
292293
{
293294
MCeerror->add(EE_CLICK_NAP, line, pos, ep.getsvalue());
294295
return ES_ERROR;
@@ -299,26 +300,34 @@ Exec_stat MCClickCmd::exec(MCExecPoint &ep)
299300
MCeerror->add(EE_CLICK_STACKNOTOPEN, line, pos, ep.getsvalue());
300301
return ES_ERROR;
301302
}
303+
304+
// IM-2013-09-23: [[ FullscreenMode ]] get / set mouseloc & clickloc in view coords
305+
MCPoint t_view_clickloc;
306+
t_view_clickloc = MCdefaultstackptr->view_stacktoviewloc(t_clickloc);
307+
302308
uint2 oldmstate = MCmodifierstate;
303309
uint2 oldbstate = MCbuttonstate;
304-
int2 oldmx = MCmousex;
305-
int2 oldmy = MCmousey;
306-
MCmousex = x;
307-
MCmousey = y;
308-
MCStack *oldms = MCmousestackptr;
310+
311+
MCStack *t_old_mousestack;
312+
MCPoint t_old_mouseloc;
313+
314+
MCscreen->getmouseloc(t_old_mousestack, t_old_mouseloc);
315+
MCscreen->setmouseloc(MCdefaultstackptr, t_view_clickloc);
316+
309317
MCmodifierstate = mstate;
310318
MCbuttonstate |= 0x1L << (which - 1);
311-
MCmousestackptr = MCdefaultstackptr;
312-
MCdispatcher->wmfocus_stack(MCdefaultstackptr, x, y);
319+
320+
MCdispatcher->wmfocus_stack(MCdefaultstackptr, t_view_clickloc.x, t_view_clickloc.y);
313321
MCmodifierstate = mstate;
314322
MCbuttonstate |= 0x1L << (which - 1);
315323
MCdispatcher->wmdown_stack(MCdefaultstackptr, which);
316324
// **** NULL POINTER FIX
317325
if (MCmousestackptr != NULL)
318326
MCscreen->sync(MCmousestackptr->getw());
319327
Boolean abort = MCscreen->wait(CLICK_INTERVAL, False, False);
320-
MCclicklocx = x;
321-
MCclicklocy = y;
328+
329+
MCscreen->setclickloc(MCdefaultstackptr, t_view_clickloc);
330+
322331
MCmodifierstate = mstate;
323332
MCbuttonstate &= ~(0x1L << (which - 1));
324333
MCdispatcher->wmup_stack(MCdefaultstackptr, which);
@@ -331,13 +340,11 @@ Exec_stat MCClickCmd::exec(MCExecPoint &ep)
331340
|| (mfocused->gettype() == CT_IMAGE && mfocused->getstate(CS_DRAW)
332341
&& MCdefaultstackptr->gettool(mfocused) == T_POLYGON)))
333342
mfocused->doubleup(1); // cancel polygon create
334-
if (oldms == NULL || oldms->getmode() != 0)
343+
if (t_old_mousestack == NULL || t_old_mousestack->getmode() != 0)
335344
{
336-
MCmousestackptr = oldms;
337-
MCmousex = oldmx;
338-
MCmousey = oldmy;
339-
if (oldms != NULL)
340-
MCdispatcher->wmfocus_stack(oldms, oldmx, oldmy);
345+
MCscreen->setmouseloc(t_old_mousestack, t_old_mouseloc);
346+
if (t_old_mousestack != NULL)
347+
MCdispatcher->wmfocus_stack(t_old_mousestack, t_old_mouseloc.x, t_old_mouseloc.y);
341348
}
342349
if (abort)
343350
{

engine/src/dispatch.cpp

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ along with LiveCode. If not see <http://www.gnu.org/licenses/>. */
5656
#include "font.h"
5757
#include "stacksecurity.h"
5858

59+
#include "graphics_util.h"
60+
5961
#define UNLICENSED_TIME 6.0
6062
#ifdef _DEBUG_MALLOC_INC
6163
#define LICENSED_TIME 1.0
@@ -1011,12 +1013,20 @@ void MCDispatch::wkup(Window w, const char *string, KeySym key)
10111013

10121014
void MCDispatch::wmfocus_stack(MCStack *target, int2 x, int2 y)
10131015
{
1016+
// IM-2013-09-23: [[ FullscreenMode ]] transform view -> stack coordinates
1017+
MCPoint t_stackloc;
10141018
if (menu != NULL)
1015-
menu->mfocus(x, y);
1019+
{
1020+
t_stackloc = menu->getstack()->view_viewtostackloc(MCPointMake(x, y));
1021+
menu->mfocus(t_stackloc.x, t_stackloc.y);
1022+
}
10161023
else
10171024
{
10181025
if (target != NULL)
1019-
target->mfocus(x, y);
1026+
{
1027+
t_stackloc = target->view_viewtostackloc(MCPointMake(x, y));
1028+
target->mfocus(t_stackloc.x, t_stackloc.y);
1029+
}
10201030
}
10211031
}
10221032

@@ -1195,6 +1205,7 @@ MCDragAction MCDispatch::wmdragmove(Window w, int2 x, int2 y)
11951205
// changes.
11961206
static uint4 s_old_modifiers = 0;
11971207

1208+
/* OVERHAUL - REVISIT [[ FullscreenMode ]] - mouse loc view -> stack? */
11981209
MCStack *target = findstackd(w);
11991210
if (MCmousex != x || MCmousey != y || MCmodifierstate != s_old_modifiers)
12001211
{

engine/src/executionerrors.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2424,6 +2424,10 @@ enum Exec_errors
24242424
// TD-2013-06-24: [[ DynamicFonts ]]
24252425
// {EE-0798} font: couldn't find font
24262426
EE_FONT_BADFILEEXP,
2427+
2428+
// IM-2013-09-22: [[ FullscreenMode ]]
2429+
// {EE-0799} fullscreenmode: not a valid mode
2430+
EE_STACK_BADFULLSCREENMODE,
24272431
};
24282432

24292433
extern const char *MCexecutionerrors;

engine/src/graphics_util.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,20 @@ inline MCRectangle MCGRectangleGetIntegerInterior(MCGRectangle p_rect)
6161
return t_rect;
6262
}
6363

64+
static inline MCPoint MCPointMake(int16_t x, int16_t y)
65+
{
66+
MCPoint t_point;
67+
t_point.x = x;
68+
t_point.y = y;
69+
70+
return t_point;
71+
}
72+
73+
static inline MCPoint MCGPointToMCPoint(const MCGPoint &p_point)
74+
{
75+
return MCPointMake(p_point.x, p_point.y);
76+
}
77+
6478
inline MCGPoint MCPointToMCGPoint(MCPoint p_point)
6579
{
6680
MCGPoint t_point;

engine/src/lextable.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -869,6 +869,8 @@ LT factor_table[] =
869869
{"frontscripts", TT_FUNCTION, F_FRONT_SCRIPTS},
870870
{"ftpproxy", TT_PROPERTY, P_FTP_PROXY},
871871
{"fullscreen", TT_PROPERTY, P_FULLSCREEN},
872+
// IM-2013-09-23: [[ FullscreenMode ]] New property for 'fullscreenmode'
873+
{"fullscreenmode", TT_PROPERTY, P_FULLSCREENMODE},
872874
{"functionnames", TT_FUNCTION, F_FUNCTION_NAMES},
873875
// JS-2013-06-19: [[ StatsFunctions ]] Token for 'geometricMean'
874876
{"geometricmean", TT_FUNCTION, F_GEO_MEAN},

engine/src/parsedef.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1222,6 +1222,8 @@ enum Properties {
12221222
P_REMOTEABLE, // RUNTIME only
12231223
P_STACK_URL, // RUNTIME only
12241224
P_FULLSCREEN,
1225+
// IM-2013-09-23: [[ FullscreenMode ]] Property tag for the fullscreenMode
1226+
P_FULLSCREENMODE,
12251227
P_FILE_NAME,
12261228
P_SAVE_COMPRESSED,
12271229
P_USER_LEVEL,

engine/src/props.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ static PropList stackprops[] =
4949
{"forePattern", P_FORE_PATTERN},
5050
{"formatForPrinting", P_FORMAT_FOR_PRINTING},
5151
{"fullscreen", P_FULLSCREEN},
52+
{"fullscreenmode", P_FULLSCREENMODE},
5253
{"hcAddressing", P_HC_ADDRESSING},
5354
{"hiliteColor", P_HILITE_COLOR},
5455
{"hilitePattern", P_HILITE_PATTERN},

engine/src/stack.cpp

Lines changed: 30 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,8 @@ MCStack::MCStack()
142142
cursoroverride = false ;
143143
old_rect.x = old_rect.y = old_rect.width = old_rect.height = 0 ;
144144

145+
view_init();
146+
145147
mode_create();
146148
}
147149

@@ -328,6 +330,8 @@ MCStack::MCStack(const MCStack &sref) : MCObject(sref)
328330
// MW-2010-11-17: [[ Valgrind ]] Uninitialized value.
329331
cursoroverride = false;
330332

333+
view_copy(sref);
334+
331335
mode_copy(sref);
332336
}
333337

@@ -1008,17 +1012,9 @@ void MCStack::setrect(const MCRectangle &nrect)
10081012
return;
10091013
#endif
10101014

1011-
// MW-2012-10-04: [[ Bug 10436 ]] Make sure we constrain stack size to screen size
1012-
// if in fullscreen mode.
1015+
// IM-2013-09-23: [[ FullscreenMode ]] Use view to determine adjusted stack size
10131016
MCRectangle t_new_rect;
1014-
if (getextendedstate(ECS_FULLSCREEN))
1015-
{
1016-
const MCDisplay *t_display;
1017-
t_display = MCscreen -> getnearestdisplay(rect);
1018-
t_new_rect = t_display -> viewport;
1019-
}
1020-
else
1021-
t_new_rect = nrect;
1017+
t_new_rect = view_setstackrect(nrect);
10221018

10231019
if (rect.x != t_new_rect.x || rect.y != t_new_rect.y)
10241020
state |= CS_BEEN_MOVED;
@@ -1068,6 +1064,11 @@ Exec_stat MCStack::getprop(uint4 parid, Properties which, MCExecPoint &ep, Boole
10681064
case P_FULLSCREEN:
10691065
ep.setsvalue( MCU_btos(getextendedstate(ECS_FULLSCREEN)));
10701066
break;
1067+
1068+
// IM-2013-09-23: [[ FullscreenMode ]] Add stack fullscreenMode property
1069+
case P_FULLSCREENMODE:
1070+
ep.setsvalue(MCStackFullscreenModeToString(view_getfullscreenmode()));
1071+
break;
10711072

10721073
case P_LONG_ID:
10731074
case P_LONG_NAME:
@@ -1593,6 +1594,7 @@ Exec_stat MCStack::setprop(uint4 parid, Properties which, MCExecPoint &ep, Boole
15931594
if ( v_changed)
15941595
{
15951596
setextendedstate(t_bval, ECS_FULLSCREEN);
1597+
view_setfullscreen(t_bval);
15961598

15971599
// MW-2012-10-04: [[ Bug 10436 ]] Use 'setrect' to change the rect
15981600
// field.
@@ -1607,6 +1609,24 @@ Exec_stat MCStack::setprop(uint4 parid, Properties which, MCExecPoint &ep, Boole
16071609
}
16081610
break;
16091611

1612+
// IM-2013-09-23: [[ FullscreenMode ]] Add stack fullscreenMode property
1613+
case P_FULLSCREENMODE:
1614+
{
1615+
MCStackFullscreenMode t_mode;
1616+
if (!MCStackFullscreenModeFromString(ep.getcstring(), t_mode))
1617+
{
1618+
MCeerror->add(EE_STACK_BADFULLSCREENMODE, 0, 0, data);
1619+
return ES_ERROR;
1620+
}
1621+
1622+
if (t_mode != view_getfullscreenmode())
1623+
{
1624+
view_setfullscreenmode(t_mode);
1625+
if (view_getfullscreen() && opened > 0)
1626+
reopenwindow();
1627+
}
1628+
}
1629+
break;
16101630
case P_NAME:
16111631
{
16121632
// MW-2008-10-28: [[ ParentScripts ]] If this stack has its 'has parentscripts'

0 commit comments

Comments
 (0)