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

Commit de934f4

Browse files
Turn MCactiveimage into an object handle
Conflicts: engine/src/stack.cpp
1 parent db8a58e commit de934f4

File tree

12 files changed

+26
-23
lines changed

12 files changed

+26
-23
lines changed

engine/src/cmdsc.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1258,7 +1258,7 @@ void MCFlip::exec_ctxt(MCExecContext& ctxt)
12581258
MCGraphicsExecFlipImage(ctxt, iptr, direction == FL_HORIZONTAL);
12591259
}
12601260

1261-
if (MCactiveimage != nil)
1261+
if (MCactiveimage)
12621262
MCGraphicsExecFlipSelection(ctxt, direction == FL_HORIZONTAL);
12631263
}
12641264

engine/src/dispatch.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2096,7 +2096,7 @@ bool MCDispatch::dopaste(MCObject*& r_objptr, bool p_explicit)
20962096
}
20972097
}
20982098

2099-
if (MCactiveimage != NULL && MCclipboard->HasImage())
2099+
if (MCactiveimage && MCclipboard->HasImage())
21002100
{
21012101
// There is a selected image object and there is an image on the
21022102
// clipboard so paste the image into it.

engine/src/exec-graphics.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ void MCGraphicsExecFlipSelection(MCExecContext& ctxt, bool p_horizontal)
139139
return;
140140
}
141141

142-
if (MCactiveimage != nil)
142+
if (MCactiveimage)
143143
MCactiveimage->flipsel(p_horizontal);
144144
}
145145

@@ -163,7 +163,7 @@ void MCGraphicsExecFlipImage(MCExecContext& ctxt, MCImage *p_image, bool p_horiz
163163
MCcurtool = MColdtool;
164164

165165
// IM-2013-06-28: [[ Bug 10999 ]] ensure MCactiveimage is not null when calling endsel() method
166-
if (MCactiveimage != nil)
166+
if (MCactiveimage)
167167
MCactiveimage -> endsel();
168168
}
169169

engine/src/exec-interface.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1130,7 +1130,7 @@ void MCInterfaceEvalSelectedField(MCExecContext& ctxt, MCStringRef& r_string)
11301130

11311131
void MCInterfaceEvalSelectedImage(MCExecContext& ctxt, MCStringRef& r_string)
11321132
{
1133-
if (MCactiveimage == nil)
1133+
if (!MCactiveimage)
11341134
{
11351135
r_string = MCValueRetain(kMCEmptyString);
11361136
return;
@@ -2284,7 +2284,7 @@ void MCInterfaceExecDelete(MCExecContext& ctxt)
22842284
{
22852285
if (MCactivefield)
22862286
MCactivefield->deleteselection(False);
2287-
else if (MCactiveimage != NULL)
2287+
else if (MCactiveimage)
22882288
MCactiveimage->delimage();
22892289
else
22902290
MCselected->del();

engine/src/exec-interface2.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2344,7 +2344,7 @@ void MCInterfaceEvalSelectedFieldAsObject(MCExecContext& ctxt, MCObjectPtr& r_ob
23442344
}
23452345
void MCInterfaceEvalSelectedImageAsObject(MCExecContext& ctxt, MCObjectPtr& r_object)
23462346
{
2347-
if (MCactiveimage != nil)
2347+
if (MCactiveimage)
23482348
{
23492349
r_object . object = MCactiveimage;
23502350
r_object . part_id = 0;

engine/src/exec-pasteboard.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1052,7 +1052,7 @@ void MCPasteboardExecCopy(MCExecContext& ctxt)
10521052
{
10531053
if (MCactivefield)
10541054
MCactivefield -> copytext();
1055-
else if (MCactiveimage != NULL)
1055+
else if (MCactiveimage)
10561056
MCactiveimage -> copyimage();
10571057
else
10581058
MCselected -> copy();
@@ -1072,7 +1072,7 @@ void MCPasteboardExecCut(MCExecContext& ctxt)
10721072
{
10731073
if (MCactivefield)
10741074
MCactivefield -> cuttext();
1075-
else if (MCactiveimage != NULL)
1075+
else if (MCactiveimage)
10761076
MCactiveimage -> cutimage();
10771077
else
10781078
MCselected -> cut();

engine/src/globals.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ MCFieldHandle MCclickfield;
303303
MCFieldHandle MCfoundfield;
304304
MCFieldHandle MCdropfield;
305305
int4 MCdropchar;
306-
MCImage *MCactiveimage;
306+
MCImageHandle MCactiveimage;
307307
MCImage *MCeditingimage;
308308
MCTooltip *MCtooltip;
309309

engine/src/globals.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ extern MCFieldHandle MCclickfield;
224224
extern MCFieldHandle MCfoundfield;
225225
extern MCFieldHandle MCdropfield;
226226
extern int4 MCdropchar;
227-
extern MCImage *MCactiveimage;
227+
extern MCImageHandle MCactiveimage;
228228
extern MCImage *MCeditingimage;
229229
extern MCTooltip *MCtooltip;
230230
extern MCStack *MCmbstackptr;

engine/src/image_rep_mutable.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ void MCMutableImageRep::startdraw()
405405
starty = my;
406406
MCRectangle brect;
407407
brect.width = brect.height = 0;
408-
if (MCactiveimage != NULL && MCactiveimage != m_owner
408+
if (MCactiveimage && MCactiveimage != m_owner
409409
&& t_tool == T_SELECT)
410410
MCactiveimage->endsel();
411411

@@ -476,7 +476,7 @@ void MCMutableImageRep::startdraw()
476476
brect = drawroundrect();
477477
break;
478478
case T_SELECT:
479-
if (MCactiveimage != NULL && MCactiveimage != m_owner)
479+
if (MCactiveimage && MCactiveimage != m_owner)
480480
MCactiveimage->endsel();
481481
if (state & CS_OWN_SELECTION)
482482
{
@@ -879,7 +879,7 @@ void MCMutableImageRep::endsel()
879879
m_selection_image = nil;
880880
}
881881
state &= ~(CS_BEEN_MOVED | CS_OWN_SELECTION);
882-
MCactiveimage = NULL;
882+
MCactiveimage = nil;
883883
selrect.x += rect.x;
884884
selrect.y += rect.y;
885885
// MW-2011-08-18: [[ Layers ]] Invalidate the selected rect.

engine/src/stack.cpp

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -916,14 +916,16 @@ Boolean MCStack::kdown(MCStringRef p_string, KeySym key)
916916
if (MCmodifierstate & MS_MOD1)
917917
return MCundos->undo();
918918
if (MCmodifierstate & MS_SHIFT)
919-
if (MCactiveimage != NULL)
919+
{
920+
if (MCactiveimage)
920921
{
921922
MCactiveimage->cutimage();
922923
return True;
923924
}
924925
else
925926
return MCselected->cut();
926-
if (MCactiveimage != NULL)
927+
}
928+
if (MCactiveimage)
927929
{
928930
MCactiveimage->delimage();
929931
return True;
@@ -932,7 +934,7 @@ Boolean MCStack::kdown(MCStringRef p_string, KeySym key)
932934
case XK_BackSpace:
933935
if (MCmodifierstate & MS_MOD1)
934936
return MCundos->undo();
935-
if (MCactiveimage != NULL)
937+
if (MCactiveimage)
936938
{
937939
MCactiveimage->delimage();
938940
return True;
@@ -941,15 +943,15 @@ Boolean MCStack::kdown(MCStringRef p_string, KeySym key)
941943
case XK_osfUndo:
942944
return MCundos->undo();
943945
case XK_osfCut:
944-
if (MCactiveimage != NULL)
946+
if (MCactiveimage)
945947
{
946948
MCactiveimage->cutimage();
947949
return True;
948950
}
949951
else
950952
return MCselected->cut();
951953
case XK_osfCopy:
952-
if (MCactiveimage != NULL)
954+
if (MCactiveimage)
953955
{
954956
MCactiveimage->copyimage();
955957
return True;
@@ -966,7 +968,7 @@ Boolean MCStack::kdown(MCStringRef p_string, KeySym key)
966968
return MCdispatcher -> dopaste(optr);
967969
}
968970
if (MCmodifierstate & MS_CONTROL)
969-
if (MCactiveimage != NULL)
971+
if (MCactiveimage)
970972
{
971973
MCactiveimage->copyimage();
972974
return True;
@@ -1025,7 +1027,7 @@ Boolean MCStack::kdown(MCStringRef p_string, KeySym key)
10251027
{
10261028
case XK_C:
10271029
case XK_c:
1028-
if (MCactiveimage != NULL)
1030+
if (MCactiveimage)
10291031
{
10301032
MCactiveimage->copyimage();
10311033
return True;
@@ -1039,7 +1041,7 @@ Boolean MCStack::kdown(MCStringRef p_string, KeySym key)
10391041

10401042
case XK_x:
10411043

1042-
if (MCactiveimage != NULL)
1044+
if (MCactiveimage)
10431045
{
10441046
MCactiveimage->cutimage();
10451047
return True;

0 commit comments

Comments
 (0)