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

Commit 197ebf6

Browse files
Turn MCactivefield into an object handle
Conflicts: engine/src/stack2.cpp
1 parent f4c01fd commit 197ebf6

File tree

14 files changed

+36
-34
lines changed

14 files changed

+36
-34
lines changed

engine/src/desktop-dc.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -920,7 +920,7 @@ void MCScreenDC::flushevents(uint2 e)
920920

921921
void MCScreenDC::clearIME(Window w)
922922
{
923-
if (MCactivefield == nil)
923+
if (!MCactivefield)
924924
return;
925925

926926
MCPlatformResetTextInputInWindow(MCactivefield -> getstack() -> getwindow());
@@ -932,7 +932,7 @@ void MCScreenDC::openIME()
932932

933933
void MCScreenDC::activateIME(Boolean activate)
934934
{
935-
if (MCactivefield == nil)
935+
if (!MCactivefield)
936936
return;
937937

938938
MCPlatformConfigureTextInputInWindow(MCactivefield -> getstack() -> getwindow(), activate);

engine/src/desktop.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -767,7 +767,7 @@ void MCPlatformHandleKeyUp(MCPlatformWindowRef p_window, MCPlatformKeyCode p_key
767767

768768
void MCPlatformHandleTextInputQueryTextRanges(MCPlatformWindowRef p_window, MCRange& r_marked_range, MCRange& r_selected_range)
769769
{
770-
if (MCactivefield == nil)
770+
if (!MCactivefield)
771771
{
772772
r_marked_range = MCRangeMake(UINDEX_MAX, 0);
773773
r_selected_range = MCRangeMake(UINDEX_MAX, 0);
@@ -789,7 +789,7 @@ void MCPlatformHandleTextInputQueryTextRanges(MCPlatformWindowRef p_window, MCRa
789789

790790
void MCPlatformHandleTextInputQueryTextIndex(MCPlatformWindowRef p_window, MCPoint p_location, uindex_t& r_index)
791791
{
792-
if (MCactivefield == nil)
792+
if (!MCactivefield)
793793
{
794794
r_index = 0;
795795
return;
@@ -809,7 +809,7 @@ void MCPlatformHandleTextInputQueryTextIndex(MCPlatformWindowRef p_window, MCPoi
809809

810810
void MCPlatformHandleTextInputQueryTextRect(MCPlatformWindowRef p_window, MCRange p_range, MCRectangle& r_first_line_rect, MCRange& r_actual_range)
811811
{
812-
if (MCactivefield == nil)
812+
if (!MCactivefield)
813813
{
814814
r_first_line_rect = MCRectangleMake(0, 0, 0, 0);
815815
r_actual_range = MCRangeMake(UINDEX_MAX, 0);
@@ -836,7 +836,7 @@ void MCPlatformHandleTextInputQueryTextRect(MCPlatformWindowRef p_window, MCRang
836836

837837
void MCPlatformHandleTextInputQueryText(MCPlatformWindowRef p_window, MCRange p_range, unichar_t*& r_chars, uindex_t& r_char_count, MCRange& r_actual_range)
838838
{
839-
if (MCactivefield == nil)
839+
if (!MCactivefield)
840840
{
841841
r_chars = nil;
842842
r_char_count = 0;
@@ -860,7 +860,7 @@ void MCPlatformHandleTextInputQueryText(MCPlatformWindowRef p_window, MCRange p_
860860

861861
void MCPlatformHandleTextInputInsertText(MCPlatformWindowRef p_window, unichar_t *p_chars, uindex_t p_char_count, MCRange p_replace_range, MCRange p_selection_range, bool p_mark)
862862
{
863-
if (MCactivefield == nil)
863+
if (!MCactivefield)
864864
return;
865865

866866
// SN-2014-12-04: [[ Bug 14152 ]] Locking the screen here doesn't allow the screen to refresh after
@@ -1077,7 +1077,7 @@ static void synthesize_move_with_shift(MCField *p_field, Field_translations p_ac
10771077
// and dispatch them rather than go through actions.
10781078
void MCPlatformHandleTextInputAction(MCPlatformWindowRef p_window, MCPlatformTextInputAction p_action)
10791079
{
1080-
if (MCactivefield == nil)
1080+
if (!MCactivefield)
10811081
return;
10821082

10831083
switch(p_action)

engine/src/dispatch.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2070,7 +2070,7 @@ bool MCDispatch::dopaste(MCObject*& r_objptr, bool p_explicit)
20702070
// We haven't created a new object as the result of this paste (yet...)
20712071
r_objptr = NULL;
20722072

2073-
if (MCactivefield != NULL)
2073+
if (MCactivefield)
20742074
{
20752075
// There is an active field so paste the clipboard into it.
20762076
MCParagraph *t_paragraphs;

engine/src/exec-interface.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -935,7 +935,7 @@ void MCInterfaceEvalFoundLoc(MCExecContext& ctxt, MCStringRef& r_string)
935935

936936
void MCInterfaceEvalSelectedChunk(MCExecContext& ctxt, MCStringRef& r_string)
937937
{
938-
if (MCactivefield == NULL)
938+
if (!MCactivefield)
939939
{
940940
r_string = MCValueRetain(kMCEmptyString);
941941
return;
@@ -984,7 +984,7 @@ void MCInterfaceEvalSelectedChunkOf(MCExecContext& ctxt, MCObjectPtr p_target, M
984984

985985
void MCInterfaceEvalSelectedLine(MCExecContext& ctxt, MCStringRef& r_string)
986986
{
987-
if (MCactivefield == NULL)
987+
if (!MCactivefield)
988988
{
989989
r_string = MCValueRetain(kMCEmptyString);
990990
return;
@@ -1026,7 +1026,7 @@ void MCInterfaceEvalSelectedLineOf(MCExecContext& ctxt, MCObjectPtr p_target, MC
10261026

10271027
void MCInterfaceEvalSelectedText(MCExecContext& ctxt, MCStringRef& r_string)
10281028
{
1029-
if (MCactivefield == NULL)
1029+
if (!MCactivefield)
10301030
{
10311031
r_string = MCValueRetain(kMCEmptyString);
10321032
return;
@@ -1068,7 +1068,7 @@ void MCInterfaceEvalSelectedTextOf(MCExecContext& ctxt, MCObjectPtr p_target, MC
10681068

10691069
void MCInterfaceEvalSelectedLoc(MCExecContext& ctxt, MCStringRef& r_string)
10701070
{
1071-
if (MCactivefield == NULL)
1071+
if (!MCactivefield)
10721072
{
10731073
r_string = MCValueRetain(kMCEmptyString);
10741074
return;
@@ -1109,7 +1109,7 @@ void MCInterfaceEvalSelectedLocOf(MCExecContext& ctxt, MCObjectPtr p_target, MCS
11091109

11101110
void MCInterfaceEvalSelectedField(MCExecContext& ctxt, MCStringRef& r_string)
11111111
{
1112-
if (MCactivefield == nil)
1112+
if (!MCactivefield)
11131113
{
11141114
r_string = MCValueRetain(kMCEmptyString);
11151115
return;
@@ -2282,7 +2282,7 @@ void MCInterfaceExecCutObjectsToContainer(MCExecContext& ctxt, MCObjectPtr *p_ta
22822282

22832283
void MCInterfaceExecDelete(MCExecContext& ctxt)
22842284
{
2285-
if (MCactivefield != NULL)
2285+
if (MCactivefield)
22862286
MCactivefield->deleteselection(False);
22872287
else if (MCactiveimage != NULL)
22882288
MCactiveimage->delimage();
@@ -2429,10 +2429,10 @@ void MCInterfaceExecUnhiliteChunkOfButton(MCExecContext& ctxt, MCObjectChunkPtr
24292429
void MCInterfaceExecSelectEmpty(MCExecContext& ctxt)
24302430
{
24312431
MCselected->clear(True);
2432-
if (MCactivefield != NULL)
2432+
if (MCactivefield)
24332433
{
24342434
MCactivefield->unselect(False, True);
2435-
if (MCactivefield != NULL)
2435+
if (MCactivefield)
24362436
MCactivefield->getcard()->kunfocus();
24372437
}
24382438
}

engine/src/exec-interface2.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2333,7 +2333,7 @@ void MCInterfaceEvalClickFieldAsObject(MCExecContext& ctxt, MCObjectPtr& r_objec
23332333

23342334
void MCInterfaceEvalSelectedFieldAsObject(MCExecContext& ctxt, MCObjectPtr& r_object)
23352335
{
2336-
if (MCactivefield != nil)
2336+
if (MCactivefield)
23372337
{
23382338
r_object . object = MCactivefield;
23392339
r_object . part_id = 0;

engine/src/exec-pasteboard.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1050,7 +1050,7 @@ void MCPasteboardProcessTextToClipboard(MCExecContext &ctxt, MCObjectChunkPtr p_
10501050

10511051
void MCPasteboardExecCopy(MCExecContext& ctxt)
10521052
{
1053-
if (MCactivefield != NULL)
1053+
if (MCactivefield)
10541054
MCactivefield -> copytext();
10551055
else if (MCactiveimage != NULL)
10561056
MCactiveimage -> copyimage();
@@ -1070,7 +1070,7 @@ void MCPasteboardExecCopyObjectsToClipboard(MCExecContext& ctxt, MCObjectPtr *p_
10701070

10711071
void MCPasteboardExecCut(MCExecContext& ctxt)
10721072
{
1073-
if (MCactivefield != NULL)
1073+
if (MCactivefield)
10741074
MCactivefield -> cuttext();
10751075
else if (MCactiveimage != NULL)
10761076
MCactiveimage -> cutimage();

engine/src/field.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -535,7 +535,7 @@ void MCField::close()
535535
if (MCclickfield == this)
536536
MCclickfield = NULL;
537537
if (MCactivefield == this)
538-
MCactivefield = NULL;
538+
MCactivefield = nil;
539539
if (MCfoundfield == this)
540540
{
541541
foundoffset = 0;
@@ -572,7 +572,7 @@ void MCField::kfocus()
572572
t_old_trans = gettransient();
573573
state |= CS_KFOCUSED;
574574

575-
if (MCactivefield != NULL && MCactivefield != this)
575+
if (MCactivefield && MCactivefield != this)
576576
MCactivefield->unselect(True, True);
577577
MCactivefield = this;
578578
clearfound();
@@ -662,7 +662,7 @@ void MCField::kunfocus()
662662
if (!(state & CS_KFOCUSED) && MCactivefield == this
663663
&& !focusedparagraph->isselection()
664664
&& firstparagraph == lastparagraph)
665-
MCactivefield = NULL;
665+
MCactivefield = nil;
666666
}
667667
}
668668

engine/src/fieldf.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1399,7 +1399,7 @@ void MCField::startselection(int2 x, int2 y, Boolean words)
13991399
removecursor();
14001400
extendwords = words;
14011401
extendlines = MCscreen->istripleclick();
1402-
if (MCactivefield != NULL && MCactivefield != this)
1402+
if (MCactivefield && MCactivefield != this)
14031403
MCactivefield->unselect(True, True);
14041404
if (MCmodifierstate & MS_SHIFT
14051405
&& (!(flags & F_LIST_BEHAVIOR) || flags & F_MULTIPLE_HILITES))
@@ -1586,7 +1586,7 @@ void MCField::unselect(Boolean clear, Boolean internal)
15861586
MCselection->Clear();
15871587
}
15881588
if (clear || (MCactivefield == this && !(state & CS_KFOCUSED)))
1589-
MCactivefield = NULL;
1589+
MCactivefield = nil;
15901590
if (!opened || focusedparagraph == NULL)
15911591
return;
15921592
if (!focusedparagraph->isselection() && firstparagraph == lastparagraph)

engine/src/fields.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -908,11 +908,11 @@ Exec_stat MCField::seltext(findex_t si, findex_t ei, Boolean focus, Boolean upda
908908
{
909909
if (!opened || !(flags & F_TRAVERSAL_ON))
910910
return ES_NORMAL;
911-
if (MCactivefield != NULL)
911+
if (MCactivefield)
912912
{
913913
if (MCactivefield != this && focus && !(state & CS_KFOCUSED))
914914
MCactivefield->kunfocus();
915-
if (MCactivefield != NULL)
915+
if (MCactivefield)
916916
MCactivefield->unselect(True, True);
917917
if (focusedparagraph != NULL)
918918
focusedparagraph->setselectionindex(PARAGRAPH_MAX_LEN, PARAGRAPH_MAX_LEN, False, False);

engine/src/globals.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ MCImageHandle MCmagimage;
298298
MCMagnifyHandle MCmagnifier;
299299
MCObjectHandle MCdragsource;
300300
MCObjectHandle MCdragdest;
301-
MCField *MCactivefield;
301+
MCFieldHandle MCactivefield;
302302
MCField *MCclickfield;
303303
MCField *MCfoundfield;
304304
MCField *MCdropfield;

0 commit comments

Comments
 (0)