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

Commit 9c84b4d

Browse files
author
Ali Lloyd
committed
[[ RefactorSyntax ]] various fixes for colour properties
1 parent 3b0e0bd commit 9c84b4d

File tree

9 files changed

+51
-15
lines changed

9 files changed

+51
-15
lines changed

engine/src/bitmapeffect.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -923,7 +923,7 @@ static void MCBitmapEffectStoreProperty(MCExecContext& ctxt, MCBitmapEffect& x_e
923923
{
924924
uinteger_t t_value;
925925
MCExecTypeConvertAndReleaseAlways(ctxt, p_value . type, &p_value , kMCExecValueTypeUInt, &t_value);
926-
MCBitmapEffectsSetUIntProperty(x_effect, p_prop, p_value . uint_value, r_dirty);
926+
MCBitmapEffectsSetUIntProperty(x_effect, p_prop, t_value, r_dirty);
927927
}
928928
break;
929929

@@ -942,7 +942,7 @@ bool MCBitmapEffectsSetProperty(MCExecContext& ctxt, MCBitmapEffectsRef& self, M
942942
bool t_is_array;
943943
t_is_array = MCNameIsEqualTo(p_index, kMCEmptyName, kMCCompareCaseless);
944944

945-
if (t_is_array && p_value . type == kMCExecValueTypeStringRef && MCStringIsEmpty(p_value . stringref_value))
945+
if (t_is_array && p_value . type == kMCExecValueTypeValueRef && MCValueIsEmpty(p_value . valueref_value))
946946
{
947947
if (self == nil || (self -> mask & (1 << t_type)) == 0)
948948
return true;

engine/src/dispatch.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2109,6 +2109,18 @@ MCFontlist *MCFontlistGetCurrent(void)
21092109

21102110
////////////////////////////////////////////////////////////////////////////////
21112111

2112+
bool MCDispatch::GetColor(MCExecContext& ctxt, Properties which, bool effective, MCInterfaceNamedColor& r_color)
2113+
{
2114+
if (which == P_FORE_COLOR)
2115+
GetDefaultForeColor(ctxt, r_color);
2116+
else if (which == P_BACK_COLOR)
2117+
GetDefaultBackColor(ctxt, r_color);
2118+
else
2119+
r_color . name = MCValueRetain(kMCEmptyString);
2120+
2121+
return true;
2122+
}
2123+
21122124
void MCDispatch::GetDefaultTextFont(MCExecContext& ctxt, MCStringRef& r_font)
21132125
{
21142126
if (MCStringCreateWithCString(DEFAULT_TEXT_FONT, r_font))

engine/src/dispatch.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,8 @@ class MCDispatch : public MCObject
212212

213213
////////// PROPERTY ACCESSORS
214214

215+
bool GetColor(MCExecContext& ctxt, Properties which, bool effective, MCInterfaceNamedColor& r_color);
216+
215217
void GetDefaultTextFont(MCExecContext& ctxt, MCStringRef& r_font);
216218
void GetDefaultTextSize(MCExecContext& ctxt, uinteger_t& r_size);
217219
void GetDefaultTextStyle(MCExecContext& ctxt, MCInterfaceTextStyle& r_style);

engine/src/exec-interface-graphic.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -881,7 +881,7 @@ void MCGraphic::SetForeColor(MCExecContext& ctxt, const MCInterfaceNamedColor& c
881881
MCGradientFillFree(m_stroke_gradient);
882882
m_stroke_gradient = nil;
883883
}
884-
return MCObject::SetForeColor(ctxt, color);
884+
MCObject::SetForeColor(ctxt, color);
885885
}
886886

887887
void MCGraphic::SetBackColor(MCExecContext& ctxt, const MCInterfaceNamedColor& color)
@@ -891,7 +891,7 @@ void MCGraphic::SetBackColor(MCExecContext& ctxt, const MCInterfaceNamedColor& c
891891
MCGradientFillFree(m_stroke_gradient);
892892
m_stroke_gradient = nil;
893893
}
894-
return MCObject::SetBackColor(ctxt, color);
894+
MCObject::SetBackColor(ctxt, color);
895895
}
896896

897897
void MCGraphic::SetForePattern(MCExecContext& ctxt, uinteger_t* pattern)
@@ -901,7 +901,7 @@ void MCGraphic::SetForePattern(MCExecContext& ctxt, uinteger_t* pattern)
901901
MCGradientFillFree(m_stroke_gradient);
902902
m_stroke_gradient = nil;
903903
}
904-
return MCObject::SetBackPattern(ctxt, pattern);
904+
MCObject::SetBackPattern(ctxt, pattern);
905905
}
906906

907907
void MCGraphic::SetBackPattern(MCExecContext& ctxt, uinteger_t* pattern)
@@ -911,6 +911,6 @@ void MCGraphic::SetBackPattern(MCExecContext& ctxt, uinteger_t* pattern)
911911
MCGradientFillFree(m_stroke_gradient);
912912
m_stroke_gradient = nil;
913913
}
914-
return MCObject::SetBackPattern(ctxt, pattern);
914+
MCObject::SetBackPattern(ctxt, pattern);
915915
}
916916

engine/src/exec-interface-object.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1815,8 +1815,13 @@ bool MCObject::GetColor(MCExecContext& ctxt, Properties which, bool effective, M
18151815
get_interface_color(colors[i], colornames[i], r_color);
18161816
return true;
18171817
}
1818-
else if (effective && parent != NULL)
1819-
return parent -> GetColor(ctxt, which, effective, r_color);
1818+
else if (effective)
1819+
{
1820+
if (parent != NULL)
1821+
return parent -> GetColor(ctxt, which, effective, r_color);
1822+
else
1823+
return MCdispatcher -> GetColor(ctxt, which, effective, r_color);
1824+
}
18201825
else
18211826
{
18221827
r_color . name = MCValueRetain(kMCEmptyString);

engine/src/exec-interface2.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,7 @@ void MCInterfaceNamedColorParse(MCExecContext& ctxt, MCStringRef p_input, MCInte
357357
}
358358

359359
r_output . color = t_color;
360+
r_output . color . flags = DoRed | DoGreen | DoBlue;
360361
r_output . name = t_color_name;
361362
}
362363

engine/src/exec-keywords.h

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/* Copyright (C) 2003-2013 Runtime Revolution Ltd.
2+
3+
This file is part of LiveCode.
4+
5+
LiveCode is free software; you can redistribute it and/or modify it under
6+
the terms of the GNU General Public License v3 as published by the Free
7+
Software Foundation.
8+
9+
LiveCode is distributed in the hope that it will be useful, but WITHOUT ANY
10+
WARRANTY; without even the implied warranty of MERCHANTABILITY or
11+
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12+
for more details.
13+
14+
You should have received a copy of the GNU General Public License
15+
along with LiveCode. If not see <http://www.gnu.org/licenses/>. */
16+
17+
////////////////////////////////////////////////////////////////////////////////
18+
19+
void MCKeywordsExecCommand(MCExecContext& ctxt, MCNameRef p_name, MCHandler *p_handler, bool p_handler_resolved, bool p_is_platform_message, MCParameter *p_parameters, uint2 p_line, uint2 p_pos, bool p_is_function, MCObject *p_parent);

engine/src/exec.h

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -674,7 +674,7 @@ template<typename A, typename B, void Method(MCExecContext&, B, A)> inline void
674674
{ prop, false, kMCPropertyTypeCustom, kMC##type##TypeInfo, (void *)MCPropertyThunkGetCustomType(MC##module##Get##tag, MC##type), nil },
675675

676676
#define DEFINE_RO_EFFECTIVE_PROPERTY(prop, type, module, tag) \
677-
{ prop, true, kMCPropertyType##type, nil, (void *)MCPropertyThunkGet##type(MC##module##Get##tag), nil },
677+
{ prop, true, kMCPropertyType##type, nil, (void *)MCPropertyThunkGet##type(MC##module##GetEffective##tag), nil },
678678

679679
#define DEFINE_RO_ARRAY_PROPERTY(prop, type, module, tag) \
680680
{ prop, false, kMCPropertyType##type, nil, (void *)MCPropertyThunkArrayGet##type(MC##module##Get##tag), nil, false, true, kMCPropertyInfoChunkTypeNone },
@@ -731,11 +731,8 @@ template<typename A, typename B, void Method(MCExecContext&, B, A)> inline void
731731
#define DEFINE_RO_OBJ_NON_EFFECTIVE_CUSTOM_PROPERTY(prop, type, obj, tag) \
732732
{ prop, false, kMCPropertyTypeCustom, kMC##type##TypeInfo, (void *)MCPropertyObjectThunkGetCustomType(obj, Get##tag, MC##type), nil, true, false, kMCPropertyInfoChunkTypeNone },
733733

734-
#define DEFINE_RW_OBJ_EFFECTIVE_CUSTOM_PROPERTY(prop, type, obj, tag) \
735-
{ prop, true, kMCPropertyTypeCustom, kMC##type##TypeInfo, (void *)MCPropertyObjectThunkGetCustomType(obj, Get##tag, MC##type), (void *)MCPropertyObjectThunkSetCustomType(obj, Set##tag, MC##type), true, false, kMCPropertyInfoChunkTypeNone },
736-
737734
#define DEFINE_RO_OBJ_EFFECTIVE_CUSTOM_PROPERTY(prop, type, obj, tag) \
738-
{ prop, true, kMCPropertyTypeCustom, kMC##type##TypeInfo, (void *)MCPropertyObjectThunkGetCustomType(obj, Get##tag, MC##type), nil, true, false, kMCPropertyInfoChunkTypeNone },
735+
{ prop, true, kMCPropertyTypeCustom, kMC##type##TypeInfo, (void *)MCPropertyObjectThunkGetCustomType(obj, GetEffective##tag, MC##type), nil, true, false, kMCPropertyInfoChunkTypeNone },
739736

740737
#define DEFINE_RW_OBJ_PART_CUSTOM_PROPERTY(prop, type, obj, tag) \
741738
{ prop, false, kMCPropertyTypeCustom, kMC##type##TypeInfo, (void *)MCPropertyObjectPartThunkGetCustomType(obj, Get##tag, MC##type), (void *)MCPropertyObjectPartThunkSetCustomType(obj, Set##tag, MC##type), false, false, kMCPropertyInfoChunkTypeNone },
@@ -787,7 +784,7 @@ template<typename A, typename B, void Method(MCExecContext&, B, A)> inline void
787784
{ prop, false, kMCPropertyType##type, nil, (void *)MCPropertyObjectListThunkGet##type(obj, Get##tag), nil, true, false, kMCPropertyInfoChunkTypeNone },
788785

789786
#define DEFINE_RO_OBJ_EFFECTIVE_LIST_PROPERTY(prop, type, obj, tag) \
790-
{ prop, true, kMCPropertyType##type, nil, (void *)MCPropertyObjectListThunkGet##type(obj, Get##tag), nil, true, false, kMCPropertyInfoChunkTypeNone },
787+
{ prop, true, kMCPropertyType##type, nil, (void *)MCPropertyObjectListThunkGet##type(obj, GetEffective##tag), nil, true, false, kMCPropertyInfoChunkTypeNone },
791788

792789
#define DEFINE_WO_OBJ_CHUNK_PROPERTY(prop, type, obj, tag) \
793790
{ prop, false, kMCPropertyType##type, nil, nil, (void *)MCPropertyObjectChunkThunkSet##type(obj, Set##tag##OfCharChunk), false, false, true },

engine/src/property.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ static MCPropertyInfo kMCPropertyInfoTable[] =
160160
DEFINE_RW_PROPERTY(P_STATUS_ICON_MENU, String, Interface, StatusIconMenu)
161161
DEFINE_RW_ENUM_PROPERTY(P_PROCESS_TYPE, InterfaceProcessType, Interface, ProcessType)
162162
DEFINE_RW_PROPERTY(P_STACK_LIMIT, UInt32, Engine, StackLimit)
163-
DEFINE_RO_EFFECTIVE_PROPERTY(P_STACK_LIMIT, UInt32,Engine, StackLimit)
163+
DEFINE_RO_EFFECTIVE_PROPERTY(P_STACK_LIMIT, UInt32, Engine, StackLimit)
164164
DEFINE_RW_PROPERTY(P_IMAGE_CACHE_LIMIT, UInt32, Graphics, ImageCacheLimit)
165165
DEFINE_RO_PROPERTY(P_IMAGE_CACHE_USAGE, UInt32, Graphics, ImageCacheUsage)
166166
DEFINE_RW_PROPERTY(P_ALLOW_DATAGRAM_BROADCASTS, Bool, Network, AllowDatagramBroadcasts)

0 commit comments

Comments
 (0)