Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions engine/src/lextable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1293,6 +1293,7 @@ LT factor_table[] =
#ifdef MODE_DEVELOPMENT
{"revlicenseinfo", TT_PROPERTY, P_REV_LICENSE_INFO},
{"revlicenselimits",TT_PROPERTY,P_REV_LICENSE_LIMITS},
{"revmessageboxlastobject", TT_PROPERTY, P_REV_MESSAGE_BOX_LAST_OBJECT},
{"revmessageboxredirect", TT_PROPERTY, P_REV_MESSAGE_BOX_REDIRECT},
#ifdef FEATURE_PROPERTY_LISTENER
// MM-2012-09-05: [[ Property Listener ]] Returns the list of all active object property listeners
Expand Down
65 changes: 65 additions & 0 deletions engine/src/mode_development.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ along with LiveCode. If not see <http://www.gnu.org/licenses/>. */
#include "license.h"
#include "mode.h"
#include "revbuild.h"
#include "parentscript.h"

#if defined(_WINDOWS_DESKTOP)
#include "w32prefix.h"
Expand Down Expand Up @@ -97,6 +98,12 @@ Boolean MCenvironmentactive = False;

MCObject *MCmessageboxredirect = NULL;

// IM-2013-04-16: [[ BZ 10836 ]] Provide reference to the last "put" source
// as a global property, the "revMessageBoxLastObject"
MCObjectHandle *MCmessageboxlastobject = nil;
MCNameRef MCmessageboxlasthandler = nil;
uint32_t MCmessageboxlastline = 0;

Boolean MCcrashreportverbose = False;
char *MCcrashreportfilename = NULL;

Expand Down Expand Up @@ -952,6 +959,22 @@ Exec_stat MCProperty::mode_eval(MCExecPoint& ep)
{
switch(which)
{
case P_REV_MESSAGE_BOX_LAST_OBJECT:
if (MCmessageboxlastobject != NULL && MCmessageboxlastobject->Exists())
{
MCmessageboxlastobject->Get()->names(P_LONG_ID, ep, 0);
ep.concatnameref(MCmessageboxlasthandler, EC_COMMA, false);
ep.concatuint(MCmessageboxlastline, EC_COMMA, false);
if (MCmessageboxlastobject->Get()->getparentscript() != nil)
{
MCExecPoint ep2;
MCmessageboxlastobject->Get()->getparentscript()->GetObject()->names(P_LONG_ID, ep2, 0);
ep.concatmcstring(ep2.getsvalue(), EC_COMMA, false);
}
}
else
ep.clear();
break;
case P_REV_MESSAGE_BOX_REDIRECT:
if (MCmessageboxredirect != NULL)
MCmessageboxredirect -> names(P_LONG_ID, ep, 0);
Expand Down Expand Up @@ -1119,6 +1142,48 @@ bool MCModeShouldCheckCantStandalone(void)

bool MCModeHandleMessageBoxChanged(MCExecPoint& ep)
{
// IM-2013-04-16: [[ BZ 10836 ]] update revMessageBoxLastObject
// if the source of the change is not within the message box
MCObject *t_msg_box = nil;
if (MCmessageboxredirect != nil)
t_msg_box = MCmessageboxredirect;
else
{
if (MCmbstackptr == nil)
MCmbstackptr = MCdispatcher->findstackname(MCmessagenamestring);
t_msg_box = MCmbstackptr;
}

MCObject *t_src_object = nil;
if (ep.getobj() != nil)
t_src_object = ep.getobj();

bool t_in_msg_box = false;

MCObject *t_obj_ptr = t_src_object;
while (t_obj_ptr != nil)
{
if (t_obj_ptr == t_msg_box)
{
t_in_msg_box = true;
break;
}
t_obj_ptr = t_obj_ptr->getparent();
}

if (!t_in_msg_box)
{
if (MCmessageboxlastobject != nil)
MCmessageboxlastobject->Release();
MCmessageboxlastobject = t_src_object->gethandle();

MCNameDelete(MCmessageboxlasthandler);
MCmessageboxlasthandler = nil;
MCNameClone(ep.gethandler()->getname(), MCmessageboxlasthandler);

MCmessageboxlastline = ep.getline();
}

if (MCmessageboxredirect != NULL)
{
if (MCmessageboxredirect -> gettype() == CT_FIELD)
Expand Down
1 change: 1 addition & 0 deletions engine/src/parsedef.h
Original file line number Diff line number Diff line change
Expand Up @@ -1517,6 +1517,7 @@ enum Properties {
P_REV_LICENSE_LIMITS, // DEVELOPMENT only
P_REV_CRASH_REPORT_SETTINGS, // DEVELOPMENT only
P_REV_AVAILABLE_HANDLERS, // DEVELOPMENT only
P_REV_MESSAGE_BOX_LAST_OBJECT, // DEVELOPMENT only
P_REV_MESSAGE_BOX_REDIRECT, // DEVELOPMENT only
P_REV_LICENSE_INFO, // DEVELOPMENT only

Expand Down
1 change: 1 addition & 0 deletions engine/src/property.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,7 @@ Parse_stat MCProperty::parse(MCScriptPoint &sp, Boolean the)
// MM-2011-07-14: Add support for listing avaiable network interfaces
case P_NETWORK_INTERFACES:

case P_REV_MESSAGE_BOX_LAST_OBJECT: // DEVELOPMENT only
case P_REV_MESSAGE_BOX_REDIRECT: // DEVELOPMENT only
case P_REV_LICENSE_LIMITS: // DEVELOPMENT only

Expand Down