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

Commit 8c89c64

Browse files
Turn MCmenuobjectptr into an object handle
1 parent 4ff6805 commit 8c89c64

File tree

6 files changed

+9
-9
lines changed

6 files changed

+9
-9
lines changed

engine/src/button.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -755,7 +755,7 @@ Boolean MCButton::kdown(MCStringRef p_string, KeySym key)
755755
message_with_args(MCM_mouse_release, menubutton);
756756
state &= ~CS_IGNORE_MENU;
757757
if (MCmenuobjectptr == this)
758-
MCmenuobjectptr = NULL;
758+
MCmenuobjectptr = nil;
759759
return True;
760760
default:
761761
MCButton *mbptr = menu->findmnemonic(t_char);
@@ -778,7 +778,7 @@ Boolean MCButton::kdown(MCStringRef p_string, KeySym key)
778778
message_with_args(MCM_mouse_up, menubutton);
779779
}
780780
if (MCmenuobjectptr == this)
781-
MCmenuobjectptr = NULL;
781+
MCmenuobjectptr = nil;
782782
return True;
783783
}
784784
else
@@ -1416,7 +1416,7 @@ Boolean MCButton::mup(uint2 which, bool p_release)
14161416
}
14171417
state &= ~CS_IGNORE_MENU;
14181418
if (MCmenuobjectptr == this)
1419-
MCmenuobjectptr = NULL;
1419+
MCmenuobjectptr = nil;
14201420
// MW-2011-08-18: [[ Layers ]] Invalidate the whole object.
14211421
layer_redrawall();
14221422
if (!opened)
@@ -2775,7 +2775,7 @@ void MCButton::openmenu(Boolean grab)
27752775
{
27762776
state |= CS_SUBMENU | CS_ARMED;
27772777
reseticon();
2778-
if (MCmenuobjectptr == NULL)
2778+
if (!MCmenuobjectptr)
27792779
MCmenuobjectptr = this;
27802780
mymenudepth = ++menudepth;
27812781
MCStack *sptr = menumode == WM_POPUP ? MCmousestackptr : getstack();

engine/src/exec-engine.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1917,7 +1917,7 @@ void MCEngineEvalMeAsObject(MCExecContext& ctxt, MCObjectPtr& r_object)
19171917

19181918
void MCEngineEvalMenuObjectAsObject(MCExecContext& ctxt, MCObjectPtr& r_object)
19191919
{
1920-
if (MCmenuobjectptr != nil)
1920+
if (MCmenuobjectptr)
19211921
{
19221922
r_object . object = MCmenuobjectptr;
19231923
r_object . part_id = 0;

engine/src/exec-legacy.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ void MCLegacyEvalTextHeightSum(MCExecContext& ctxt, MCObjectPtr p_object, intege
276276

277277
void MCLegacyEvalMenuObject(MCExecContext& ctxt, MCStringRef& r_object)
278278
{
279-
if (MCmenuobjectptr == nil)
279+
if (!MCmenuobjectptr)
280280
{
281281
r_object = (MCStringRef)MCValueRetain(kMCEmptyString);
282282
return;

engine/src/globals.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,12 +274,12 @@ Boolean MCdynamicpath;
274274
MCObject *MCerrorptr;
275275
MCObject *MCerrorlockptr;
276276
MCObjectPtr MCtargetptr;
277-
MCObject *MCmenuobjectptr;
278277
MCGroup *MCsavegroupptr;
279278
MCGroup *MCdefaultmenubar;
280279
MCGroup *MCmenubar;
281280
MCPlayer *MCplayers;
282281
MCAudioClip *MCacptr;
282+
MCObjectHandle MCmenuobjectptr;
283283

284284
MCStack *MCtemplatestack;
285285
MCAudioClip *MCtemplateaudio;

engine/src/globals.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ extern MCStackHandle MCmousestackptr;
188188
extern MCStackHandle MCclickstackptr;
189189
extern MCStackHandle MCfocusedstackptr;
190190
extern MCObjectPtr MCtargetptr;
191-
extern MCObject *MCmenuobjectptr;
191+
extern MCObjectHandle MCmenuobjectptr;
192192
extern MCCardHandle MCdynamiccard;
193193
extern Boolean MCdynamicpath;
194194
extern MCObject *MCerrorptr;

engine/src/object.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1194,7 +1194,7 @@ void MCObject::closemenu(Boolean kfocus, Boolean disarm)
11941194
attachedmenu = NULL;
11951195
menudepth--;
11961196
if (MCmenuobjectptr == this)
1197-
MCmenuobjectptr = NULL;
1197+
MCmenuobjectptr = nil;
11981198
}
11991199
}
12001200

0 commit comments

Comments
 (0)