summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Mittendrein <git@maxmitti.tk>2018-10-31 16:49:19 +0100
committerMarkus Mittendrein <git@maxmitti.tk>2018-10-31 16:49:19 +0100
commit5426330c7560610843228758684e886d5d672b9c (patch)
tree8b1f8be89abd8f0040ef252487ed3b6cd190b335
parentc820da04c3653adc43913d567a8e3cfed71cba45 (diff)
downloadDTMenuDebug.c4d-5426330c7560610843228758684e886d5d672b9c.tar.gz
DTMenuDebug.c4d-5426330c7560610843228758684e886d5d672b9c.zip
Add Menu_Closable allows menus to be closed without returning Menu_React_Close in the callbacks (was broken since always setting the native menu to permanent)
Rename Symbol -> Icon, InfoCaption -> Description and Caption to Title or Text (Menu_Title, but Menu_Entry_Text) Add Menu_InstantDescription (shows the description of the current entry instantly in a separate dialog) Fix deletion of object icons (the object was always deleted regardless if specified or not)
-rw-r--r--IconDummy.c4d/DefCore.txt (renamed from SymbolDummy.c4d/DefCore.txt)4
-rw-r--r--IconDummy.c4d/Graphics.png (renamed from SymbolDummy.c4d/Graphics.png)bin126 -> 126 bytes
-rw-r--r--IconDummy.c4d/Script.c16
-rw-r--r--InstantDescriptionDecoration.c4d/ActMap.txt31
-rw-r--r--InstantDescriptionDecoration.c4d/DefCore.txt9
-rw-r--r--InstantDescriptionDecoration.c4d/Graphics.pngbin0 -> 10955 bytes
-rw-r--r--InstantDescriptionDecoration.c4d/Script.c9
-rw-r--r--Script.c389
-rw-r--r--SymbolDummy.c4d/Script.c16
9 files changed, 309 insertions, 165 deletions
diff --git a/SymbolDummy.c4d/DefCore.txt b/IconDummy.c4d/DefCore.txt
index 5592096..3758e17 100644
--- a/SymbolDummy.c4d/DefCore.txt
+++ b/IconDummy.c4d/DefCore.txt
@@ -1,5 +1,5 @@
[DefCore]
-id=MS7I
-Name=Menu symbol dummy
+id=ID7I
+Name=Menu icon dummy
Version=4,9,5
Category=C4D_StaticBack
diff --git a/SymbolDummy.c4d/Graphics.png b/IconDummy.c4d/Graphics.png
index 6b1b504..6b1b504 100644
--- a/SymbolDummy.c4d/Graphics.png
+++ b/IconDummy.c4d/Graphics.png
Binary files differ
diff --git a/IconDummy.c4d/Script.c b/IconDummy.c4d/Script.c
new file mode 100644
index 0000000..58e5f2e
--- /dev/null
+++ b/IconDummy.c4d/Script.c
@@ -0,0 +1,16 @@
+#strict 2
+
+static const DT_Menu_IconDummy = ID7I;
+
+func SetIcon(id icon, int nr)
+{
+ SetGraphics(0, this, icon);
+ SetPicture(GetDefCoreVal("Picture", "DefCore", icon, 0) + nr * GetDefCoreVal("Picture", "DefCore", icon, 2), GetDefCoreVal("Picture", "DefCore", icon, 1), GetDefCoreVal("Picture", "DefCore", icon, 2), GetDefCoreVal("Picture", "DefCore", icon, 3));
+ return this;
+}
+
+func SetColor(int color)
+{
+ SetClrModulation(color);
+ return this;
+}
diff --git a/InstantDescriptionDecoration.c4d/ActMap.txt b/InstantDescriptionDecoration.c4d/ActMap.txt
new file mode 100644
index 0000000..3ab9eca
--- /dev/null
+++ b/InstantDescriptionDecoration.c4d/ActMap.txt
@@ -0,0 +1,31 @@
+[Action]
+Name=FrameDecoTopLeft
+Facet=0,0,32,28,0,-14
+
+[Action]
+Name=FrameDecoTop
+Facet=32,0,128,28,0,-14
+
+[Action]
+Name=FrameDecoTopRight
+Facet=160,0,32,28,-26,-14
+
+[Action]
+Name=FrameDecoRight
+Facet=190,23,2,1,4,0
+
+[Action]
+Name=FrameDecoBottomRight
+Facet=186,28,6,2,0,0
+
+[Action]
+Name=FrameDecoBottom
+Facet=2,28,128,2,0,0
+
+[Action]
+Name=FrameDecoBottomLeft
+Facet=0,28,2,2,0,0
+
+[Action]
+Name=FrameDecoLeft
+Facet=0,23,2,1,0,0 \ No newline at end of file
diff --git a/InstantDescriptionDecoration.c4d/DefCore.txt b/InstantDescriptionDecoration.c4d/DefCore.txt
new file mode 100644
index 0000000..7631f48
--- /dev/null
+++ b/InstantDescriptionDecoration.c4d/DefCore.txt
@@ -0,0 +1,9 @@
+[DefCore]
+id=DD7I
+Name=DefaultMenuDescriptionDecoration
+Version=4,9,5,4
+Category=1
+MaxUserSelect=0
+Width=1
+Height=1
+Mass=1
diff --git a/InstantDescriptionDecoration.c4d/Graphics.png b/InstantDescriptionDecoration.c4d/Graphics.png
new file mode 100644
index 0000000..5241e1c
--- /dev/null
+++ b/InstantDescriptionDecoration.c4d/Graphics.png
Binary files differ
diff --git a/InstantDescriptionDecoration.c4d/Script.c b/InstantDescriptionDecoration.c4d/Script.c
new file mode 100644
index 0000000..1862b57
--- /dev/null
+++ b/InstantDescriptionDecoration.c4d/Script.c
@@ -0,0 +1,9 @@
+#strict 2
+
+static const DT_Menu_DefaultInstantDescriptionDecoration = DD7I;
+
+func FrameDecorationBackClr() { return 0x5f000000; } // C4GUI_StandardBGColor
+func FrameDecorationBorderTop() { return 14; }
+func FrameDecorationBorderLeft() { return 2; }
+func FrameDecorationBorderRight() { return 4; }
+func FrameDecorationBorderBottom() { return 2; }
diff --git a/Script.c b/Script.c
index 9523259..b45ce5f 100644
--- a/Script.c
+++ b/Script.c
@@ -6,10 +6,10 @@ static const DT_Menu_MenuVar = -1;
// Enums and bitfields
-static const DT_Menu_Settings_Symbol = 0;
+static const DT_Menu_Settings_Icon = 0;
static const DT_Menu_Settings_Object = 1;
static const DT_Menu_Settings_Extra = 2;
-static const DT_Menu_Settings_Caption = 3;
+static const DT_Menu_Settings_Title = 3;
static const DT_Menu_Settings_ExtraData = 4;
static const DT_Menu_Settings_Style = 5;
static const DT_Menu_Settings_KeepOpen = 6;
@@ -24,6 +24,11 @@ static const DT_Menu_Settings_Decoration = 14;
static const DT_Menu_Settings_RequireAction = 15;
static const DT_Menu_Settings_KeepParentOnClose = 16;
static const DT_Menu_Settings_Vars = 17;
+static const DT_Menu_Settings_Closable = 18;
+static const DT_Menu_Settings_InstantDescription = 19;
+static const DT_Menu_Settings_InstantDescriptionFlags = 20;
+static const DT_Menu_Settings_InstantDescriptionPosition = 21;
+static const DT_Menu_Settings_InstantDescriptionDecoration = 22;
static const DT_Menu_KeepOpen_Not = 0x0;
static const DT_Menu_KeepOpen_Keep = 0x1;
@@ -71,17 +76,18 @@ static const Menu_Condition_AllowSelection = 1;
static const Menu_Condition_DenySelection = 2;
static const Menu_Condition_Max = Menu_Condition_DenySelection;
-static const DT_Menu_Entry_Caption = 0;
+static const DT_Menu_Entry_Text = 0;
static const DT_Menu_Entry_Callbacks = 1;
-static const DT_Menu_Entry_Symbol = 2;
+static const DT_Menu_Entry_Icon = 2;
static const DT_Menu_Entry_Count = 3;
-static const DT_Menu_Entry_InfoCaption = 4;
+static const DT_Menu_Entry_Description = 4;
static const DT_Menu_Entry_Extra = 5;
static const DT_Menu_Entry_XPar1 = 6;
static const DT_Menu_Entry_XPar2 = 7;
static const DT_Menu_Entry_Args = 8;
static const DT_Menu_Entry_Condition = 9;
static const DT_Menu_Entry_Placeholder = 10;
+static const DT_Menu_Entry_InstantDescriptionIcon = 11;
static const Menu_CallbackType_None = 0x0;
static const Menu_CallbackType_Special2 = 0x1;
@@ -106,7 +112,7 @@ static const Menu_Adaptor_Limits_Min = 0x80000000;
static const Menu_CallbackArg_All = -1;
static const Menu_CallbackArg_Action = 0;
-static const Menu_CallbackArg_Symbol = 1;
+static const Menu_CallbackArg_Icon = 1;
static const Menu_CallbackArg_MenuObject = 2;
static const Menu_CallbackArg_Args = 3;
static const Menu_CallbackArg_NewSelection = 4;
@@ -134,19 +140,19 @@ static const DT_Menu_Adaptor_Mask = 9;
static const DT_Menu_Adaptor_WrapAround = 10;
static const DT_Menu_Adaptor_Args = 11;
static const DT_Menu_Adaptor_EnumSubmenu = 12;
-static const DT_Menu_Adaptor_EnumSubmenuCaption = 13;
-static const DT_Menu_Adaptor_EnumSubmenuSymbol = 14;
+static const DT_Menu_Adaptor_EnumSubmenuTitleAndText = 13;
+static const DT_Menu_Adaptor_EnumSubmenuIcon = 14;
static const DT_Menu_Adaptor_EnumAllowUnknown = 15;
static const DT_Menu_Adaptor_EnumInline = 16;
-static const Menu_Layout_Symbol = 1;
-static const Menu_Layout_InfoCaption = 2;
+static const Menu_Layout_Icon = 1;
+static const Menu_Layout_Description = 2;
-static const Menu_Layout__CaptionPos = 3;
+static const Menu_Layout__TextPos = 3;
static const Menu_Layout__ValuePos = 4;
// static const Menu_Layout__InputValuePos = 5; TODO
-static const Menu_Layout_Caption = 4;
+static const Menu_Layout_Text = 4;
static const Menu_Layout_Value = 8;
// static const Menu_Layout_InputValue = 16; TODO
static const Menu_Layout__NoFlagMask = 3;
@@ -208,7 +214,7 @@ func Create(array cSettings, array cEntries)
if(settings[DT_Menu_Settings_Parent]) settings[DT_Menu_Settings_Parent]->Suspend();
if(!(settings[DT_Menu_Settings_Object])) { FatalError("Assertion failed: CreateNewMenu: menu object is missing; assertion code: settings[DT_Menu_Settings_Object]"); }
- CreateMenu(settings[DT_Menu_Settings_Symbol], settings[DT_Menu_Settings_Object], this, settings[DT_Menu_Settings_Extra], settings[DT_Menu_Settings_Caption], settings[DT_Menu_Settings_ExtraData], settings[DT_Menu_Settings_Style], true, MN7I);
+ CreateMenu(settings[DT_Menu_Settings_Icon], settings[DT_Menu_Settings_Object], this, settings[DT_Menu_Settings_Extra], settings[DT_Menu_Settings_Title], settings[DT_Menu_Settings_ExtraData], settings[DT_Menu_Settings_Style], true, MN7I);
if(GetType(settings[DT_Menu_Settings_Size]) == C4V_Array) SetMenuSize(settings[DT_Menu_Settings_Size][0], settings[DT_Menu_Settings_Size][1], settings[DT_Menu_Settings_Object]);
@@ -250,7 +256,7 @@ func ActivateEntry(int index, int action)
SelectEntry(index);
var entry = entries[index];
- MenuItemCommand(entry[DT_Menu_Entry_Symbol], index, action);
+ MenuItemCommand(entry[DT_Menu_Entry_Icon], index, action);
}
func SubMenu()
@@ -295,7 +301,7 @@ func FxMenuTimer(object target, int effectNumber, int effectTime)
{
var entry = entries[msgBoardEntry];
var args = entry[DT_Menu_Entry_Args];
- var reaction = CallCallbacks(args[DT_Menu_Adaptor_Callbacks], Menu_CallbackType_InputAborted, [Menu_CallbackType_InputAborted, entry[DT_Menu_Entry_Symbol], settings[DT_Menu_Settings_Object], entry[DT_Menu_Entry_Args]]);
+ var reaction = CallCallbacks(args[DT_Menu_Adaptor_Callbacks], Menu_CallbackType_InputAborted, [Menu_CallbackType_InputAborted, entry[DT_Menu_Entry_Icon], settings[DT_Menu_Settings_Object], entry[DT_Menu_Entry_Args]]);
if(reaction != Menu_React_None)
{
React(reaction, msgBoardEntry);
@@ -305,7 +311,7 @@ func FxMenuTimer(object target, int effectNumber, int effectTime)
if(!GetMenu(settings[DT_Menu_Settings_Object]))
{
- if(settings[DT_Menu_Settings_KeepOpen] & (DT_Menu_KeepOpen_Refresh_Mask | DT_Menu_KeepOpen_Force))
+ if(settings[DT_Menu_Settings_KeepOpen] & (DT_Menu_KeepOpen_Refresh_Mask | DT_Menu_KeepOpen_Force) && !settings[DT_Menu_Settings_Closable])
{
Refresh(currentSelection);
}
@@ -328,6 +334,7 @@ func FxMenuStop(object target, int effectNumber, int reason, bool temp)
return;
}
CloseMenu(settings[DT_Menu_Settings_Object]);
+ if(settings[DT_Menu_Settings_InstantDescription]) HideInstantDescription();
if(settings[DT_Menu_Settings_Parent]) settings[DT_Menu_Settings_Parent]->Suspend(true);
RemoveObject(this);
}
@@ -459,7 +466,7 @@ func AddEntries(array& entries)
{
var entry = entries[i];
var condition = entry[DT_Menu_Entry_Condition], conditionRet;
- var caption = entry[DT_Menu_Entry_Caption], noCommand = !entry[DT_Menu_Entry_Placeholder] || (entry[DT_Menu_Entry_Placeholder] != true && !entry[DT_Menu_Entry_Callbacks]);
+ var text = entry[DT_Menu_Entry_Text], noCommand = !entry[DT_Menu_Entry_Placeholder] || (entry[DT_Menu_Entry_Placeholder] != true && !entry[DT_Menu_Entry_Callbacks]);
if(condition)
{
if(noCommand || condition[1] == Menu_Condition_DenySelection || (condition[1] == Menu_Condition_Default && !settings[DT_Menu_Settings_ConditionAllowSelection]))
@@ -467,18 +474,18 @@ func AddEntries(array& entries)
noCommand = true;
}
- conditionRet = CallA(condition[0], [entry[DT_Menu_Entry_Symbol], settings[DT_Menu_Settings_Object], entry[DT_Menu_Entry_Args]]) || settings[DT_Menu_Settings_ConditionDisableMode];
+ conditionRet = CallA(condition[0], [entry[DT_Menu_Entry_Icon], settings[DT_Menu_Settings_Object], entry[DT_Menu_Entry_Args]]) || settings[DT_Menu_Settings_ConditionDisableMode];
if(conditionRet == Menu_ConditionReact_Hide)
{
continue;
}
else if(conditionRet == Menu_ConditionReact_GrayOut)
{
- caption = Format("<c 808080>%s</c>", caption);
+ text = Format("<c 808080>%s</c>", text);
}
else if(GetType(conditionRet) == C4V_Array && conditionRet[0] == Menu_ConditionReact_CustomFormat)
{
- caption = Format(conditionRet[1], caption);
+ text = Format(conditionRet[1], text);
}
else
{
@@ -486,43 +493,59 @@ func AddEntries(array& entries)
}
}
- var symbol = entry[DT_Menu_Entry_Symbol], symbolID = 0, deleteSymbol = 0;
- if(GetType(symbol) == C4V_Array)
+ var icon = entry[DT_Menu_Entry_Icon], iconIndex = 0, iconID = 0, deleteIcon = 0;
+ if(GetType(icon) == C4V_Array)
{
- if(GetType(symbol[0]) == C4V_C4ID)
+ if(GetType(icon[0]) == C4V_C4ID)
{
- symbolID = symbol[0];
- if(symbol[2])
+ iconID = icon[0];
+ if(icon[2])
{
- symbol = [CreateSymbolDummy()->SetSymbol(symbolID, symbol[1])->SetColor(symbol[2]), true];
+ icon = [CreateIconDummy()->SetIcon(iconID, icon[1])->SetColor(icon[2]), true];
}
- else if(symbol[1])
+ else if(icon[1])
{
entry[DT_Menu_Entry_Extra] |= C4MN_Add_ImgIndexed;
- entry[DT_Menu_Entry_XPar1] = symbol[1];
+ iconIndex = icon[1];
+ entry[DT_Menu_Entry_XPar1] = icon[1];
}
}
- if(GetType(symbol[0]) == C4V_C4Object)
+ if(GetType(icon[0]) == C4V_C4Object)
{
entry[DT_Menu_Entry_Extra] |= C4MN_Add_ImgObject;
- deleteSymbol = entry[DT_Menu_Entry_XPar1] = symbol[0];
- symbolID = GetID(symbol[0]);
+ entry[DT_Menu_Entry_XPar1] = icon[0];
+ if(icon[1])
+ {
+ deleteIcon = icon[0];
+ }
+ iconID = GetID(icon[0]);
}
}
else
{
- symbolID = symbol;
+ iconID = icon;
+ }
+ entry[DT_Menu_Entry_Icon] = iconID;
+
+ if(!entry[DT_Menu_Entry_InstantDescriptionIcon])
+ {
+ entry[DT_Menu_Entry_InstantDescriptionIcon] = [iconID, iconIndex];
+ }
+
+ if(settings[DT_Menu_Settings_InstantDescription])
+ {
+ entry[DT_Menu_Entry_Extra] |= C4MN_Add_ForceNoDesc;
}
- entry[DT_Menu_Entry_Symbol] = symbolID;
entries[i] = entry;
+ var showDesc = !(entry[DT_Menu_Entry_Extra] & C4MN_Add_ForceNoDesc);
- AddMenuItem(caption, !noCommand && "MenuItemCommand", symbolID, settings[DT_Menu_Settings_Object], entry[DT_Menu_Entry_Count], i, entry[DT_Menu_Entry_InfoCaption], entry[DT_Menu_Entry_Extra], entry[DT_Menu_Entry_XPar1], entry[DT_Menu_Entry_XPar2]);
+ AddMenuItem(text, !noCommand && "MenuItemCommand", iconID, settings[DT_Menu_Settings_Object], entry[DT_Menu_Entry_Count], i, showDesc && entry[DT_Menu_Entry_Description], entry[DT_Menu_Entry_Extra], entry[DT_Menu_Entry_XPar1], entry[DT_Menu_Entry_XPar2]);
- if(deleteSymbol)
+ if(deleteIcon)
{
- RemoveObject(deleteSymbol);
+ RemoveObject(deleteIcon);
}
}
}
@@ -564,7 +587,7 @@ func React(reaction, int itemNumber, int refreshDelayed)
func CheckCondition(array entry)
{
var condition = entry[DT_Menu_Entry_Condition];
- return !condition || (CallA(condition[0], [entry[DT_Menu_Entry_Symbol], settings[DT_Menu_Settings_Object], entry[DT_Menu_Entry_Args]]) || settings[DT_Menu_Settings_ConditionDisableMode]) == Menu_ConditionReact_Show;
+ return !condition || (CallA(condition[0], [entry[DT_Menu_Entry_Icon], settings[DT_Menu_Settings_Object], entry[DT_Menu_Entry_Args]]) || settings[DT_Menu_Settings_ConditionDisableMode]) == Menu_ConditionReact_Show;
}
func MenuItemCommand(id ID, int itemNumber, int action)
@@ -615,13 +638,13 @@ func MenuQueryCancel(int selection, object menuObject)
var entry = entries[selection];
if(CheckCondition(entry))
{
- reaction = CallCallbacks(entry[DT_Menu_Entry_Callbacks], Menu_CallbackType_Close, [Menu_CallbackType_Close, entry[DT_Menu_Entry_Symbol], settings[DT_Menu_Settings_Object], entry[DT_Menu_Entry_Args]]);
+ reaction = CallCallbacks(entry[DT_Menu_Entry_Callbacks], Menu_CallbackType_Close, [Menu_CallbackType_Close, entry[DT_Menu_Entry_Icon], settings[DT_Menu_Settings_Object], entry[DT_Menu_Entry_Args]]);
}
React(reaction, selection, true);
}
- if((settings[DT_Menu_Settings_KeepOpen] != DT_Menu_KeepOpen_Not && settings[DT_Menu_Settings_KeepOpen] != DT_Menu_KeepOpen_Permanent) || (reaction == Menu_React_KeepOpen))
+ if((settings[DT_Menu_Settings_KeepOpen] != DT_Menu_KeepOpen_Not && settings[DT_Menu_Settings_KeepOpen] != DT_Menu_KeepOpen_Permanent && !settings[DT_Menu_Settings_Closable]) || (reaction == Menu_React_KeepOpen))
{
return true;
}
@@ -638,14 +661,14 @@ func OnMenuSelection(int selection, object menuObject)
var selectReaction = Menu_React_None;
if(!noSelectionCallbacks && CheckCondition(entry) && currentSelection != -1)
{
- deselectReaction = CallCallbacks(entry[DT_Menu_Entry_Callbacks], Menu_CallbackType_Deselection, [Menu_CallbackType_Deselection, entry[DT_Menu_Entry_Symbol], settings[DT_Menu_Settings_Object], entry[DT_Menu_Entry_Args], selection, oldSelection]);
+ deselectReaction = CallCallbacks(entry[DT_Menu_Entry_Callbacks], Menu_CallbackType_Deselection, [Menu_CallbackType_Deselection, entry[DT_Menu_Entry_Icon], settings[DT_Menu_Settings_Object], entry[DT_Menu_Entry_Args], selection, oldSelection]);
}
entry = entries[currentSelection = selection];
if(!noSelectionCallbacks && CheckCondition(entry))
{
- selectReaction = CallCallbacks(entry[DT_Menu_Entry_Callbacks], Menu_CallbackType_Selection, [Menu_CallbackType_Selection, entry[DT_Menu_Entry_Symbol], settings[DT_Menu_Settings_Object], entry[DT_Menu_Entry_Args], selection, oldSelection]);
+ selectReaction = CallCallbacks(entry[DT_Menu_Entry_Callbacks], Menu_CallbackType_Selection, [Menu_CallbackType_Selection, entry[DT_Menu_Entry_Icon], settings[DT_Menu_Settings_Object], entry[DT_Menu_Entry_Args], selection, oldSelection]);
}
if(deselectReaction != Menu_React_None)
@@ -657,6 +680,11 @@ func OnMenuSelection(int selection, object menuObject)
{
React(selectReaction, currentSelection);
}
+
+ if(settings[DT_Menu_Settings_InstantDescription])
+ {
+ ShowInstantDescription(entry);
+ }
}
}
@@ -690,16 +718,44 @@ func Refresh(int selection, bool delayed)
}
}
+func ShowInstantDescription(array entry)
+{
+ if(entry[DT_Menu_Entry_Description])
+ {
+ var icon = entry[DT_Menu_Entry_InstantDescriptionIcon];
+ var iconString;
+ if(GetType(icon[1]) == C4V_String)
+ {
+ iconString = Format("Portrait:%i::%x::%s", icon[0], icon[2], icon[1]);
+ }
+ else
+ {
+ iconString = Format("%i:%d", icon[0] || DT_Menu_IconDummy, icon[1]);
+ }
+ var pos = settings[DT_Menu_Settings_InstantDescriptionPosition];
+ CustomMessage(Format("@%s", entry[DT_Menu_Entry_Description]), 0, GetOwner(settings[DT_Menu_Settings_Object]), pos[0], pos[1], 0, settings[DT_Menu_Settings_InstantDescriptionDecoration], iconString, settings[DT_Menu_Settings_InstantDescriptionFlags]);
+ }
+ else
+ {
+ HideInstantDescription();
+ }
+}
+
+func HideInstantDescription()
+{
+ CustomMessage("", 0, GetOwner(settings[DT_Menu_Settings_Object]), 0, 0, 0, 0, Format("%i", DT_Menu_IconDummy), settings[DT_Menu_Settings_InstantDescriptionFlags]);
+}
+
// ----------------------------------------------------------------------------
global func Menu__Setting(array setting) { return [DT_Menu_Type_Setting, setting]; }
-global func Menu_Symbol(id symbol) { return Menu__Setting([DT_Menu_Settings_Symbol, symbol]); }
+global func Menu_Icon(id icon) { return Menu__Setting([DT_Menu_Settings_Icon, icon]); }
global func Menu_Object(object obj) { return Menu__Setting([DT_Menu_Settings_Object, obj]); }
global func Menu__Extra(int extra, int data) { return Menu_Combined([Menu__Setting([DT_Menu_Settings_Extra, extra]), Menu_ExtraData(data)]); }
global func Menu_Size(int width, int height) { if(!(width >= 0 && height >= 0)) { FatalError("Assertion failed: Menu_Size: Negative Menu_Size doesn't make sense; assertion code: width >= 0 && height >= 0"); }return Menu__Setting([DT_Menu_Settings_Size, [width, height]]); }
global func Menu_ExtraData(int data) { return Menu__Setting([DT_Menu_Settings_ExtraData, data]); }
-global func Menu_Caption(string caption) { return Menu__Setting([DT_Menu_Settings_Caption, caption]); }
+global func Menu_Title(string title) { return Menu__Setting([DT_Menu_Settings_Title, title]); }
global func Menu_RefreshInterval(int interval) { if(!(interval >= 0)) { FatalError("Assertion failed: Menu_RefreshInterval: Negative interval doesn't make sense; assertion code: interval >= 0"); }return Menu__Setting([DT_Menu_Settings_RefreshInterval, interval + !interval]); }
global func Menu_Selection(int selection) { return Menu__Setting([DT_Menu_Settings_Selection, selection]); }
global func Menu__Style(int style) { return Menu__Setting([DT_Menu_Settings_Style, style]); }
@@ -734,67 +790,72 @@ global func Menu_RequireAction(string action, object target) { if(!(action)) {
global func Menu_KeepParentOnClose(bool dontKeep) { return Menu__Setting([DT_Menu_Settings_KeepParentOnClose, !dontKeep]); }
global func Menu_ConditionDisableMode(mode) { if(!(!mode || (GetType(mode) == C4V_Int && mode >= 0 && mode <= Menu_ConditionReact_Max) || (GetType(mode) == C4V_Array && mode[0] == Menu_ConditionReact_CustomFormat && GetType(mode[1]) == C4V_String))) { FatalError("Assertion failed: Menu_ConditionDisableMode: invalid mode; assertion code: !mode || (GetType(mode) == C4V_Int && mode >= 0 && mode <= Menu_ConditionReact_Max) || (GetType(mode) == C4V_Array && mode[0] == Menu_ConditionReact_CustomFormat && GetType(mode[1]) == C4V_String)"); }return Menu__Setting([DT_Menu_Settings_ConditionDisableMode, mode]);}
global func Menu_Vars(array vars) { return Menu__Setting([DT_Menu_Settings_Vars, vars]); }
+global func Menu_Closable(bool notClosable) { return Menu__Setting([DT_Menu_Settings_Closable, !notClosable]); }
+global func Menu_InstantDescription(bool disable) { return Menu__Setting([DT_Menu_Settings_InstantDescription, !disable]); }
+global func Menu_InstantDescriptionDecoration(id decoration) { return Menu__Setting([DT_Menu_Settings_InstantDescriptionDecoration, decoration]); }
+global func Menu_InstantDescriptionMessageFlags(int flags) { return Menu__Setting([DT_Menu_Settings_InstantDescriptionFlags, flags]); }
+global func Menu_InstantDescriptionPosition(int x, int y) { return Menu__Setting([DT_Menu_Settings_InstantDescriptionPosition, [x, y]]); }
global func Menu_Callback(array callback, int types, array argBinding)
{
if(!(MN7I->CheckCallback(callback))) { FatalError("Assertion failed: Menu_Callback invalid callback used; assertion code: MN7I->CheckCallback(callback)"); }
if(!((types & ~Menu_CallbackType_All) == 0)) { FatalError("Assertion failed: Menu_Callback: invalid callback type(s) used; assertion code: (types & ~Menu_CallbackType_All) == 0"); }
- argBinding = argBinding || [Menu_CallbackArg_Action, Menu_CallbackArg_Symbol, Menu_CallbackArg_MenuObject, Menu_CallbackArg_Args, Menu_CallbackArg_NewSelection, Menu_CallbackArg_OldSelection, Menu_CallbackArg_NewValue, Menu_CallbackArg_OldValue, Menu_CallbackArg_FromSubmenu];
+ argBinding = argBinding || [Menu_CallbackArg_Action, Menu_CallbackArg_Icon, Menu_CallbackArg_MenuObject, Menu_CallbackArg_Args, Menu_CallbackArg_NewSelection, Menu_CallbackArg_OldSelection, Menu_CallbackArg_NewValue, Menu_CallbackArg_OldValue, Menu_CallbackArg_FromSubmenu];
if(!(MN7I->ValidateMenuCallbackArgBinding(argBinding))) { FatalError("Assertion failed: Menu_Callback: invalid argBinding used; assertion code: MN7I->ValidateMenuCallbackArgBinding(argBinding)"); }
return [callback, types || Menu_CallbackType_Defaults, argBinding];
}
-global func Menu_Entry_Caption(string Caption) { return [DT_Menu_Entry_Caption, Caption]; }
+global func Menu_Entry_Text(string Text) { return [DT_Menu_Entry_Text, Text]; }
global func Menu_Entry_Callbacks(array Callbacks) { return [DT_Menu_Entry_Callbacks, Callbacks]; }
global func Menu_Entry_Count(int Count) { return [DT_Menu_Entry_Count, Count]; }
-global func Menu_Entry_InfoCaption(string InfoCaption) { return [DT_Menu_Entry_InfoCaption, InfoCaption]; }
+global func Menu_Entry_Description(string Description) { return [DT_Menu_Entry_Description, Description]; }
global func Menu_Entry_Extra(int Extra) { return [DT_Menu_Entry_Extra, Extra]; }
global func Menu_Entry_XPar1(XPar1) { return [DT_Menu_Entry_XPar1, XPar1]; }
global func Menu_Entry_XPar2(XPar2) { return [DT_Menu_Entry_XPar2, XPar2]; }
global func Menu_Entry_Args(Args) { return [DT_Menu_Entry_Args, Args]; }
global func Menu_Entry_Placeholder(bool Placeholder) { return [DT_Menu_Entry_Placeholder, Placeholder]; }
-global func Menu_Entry_Symbol(symbol, extra, int color)
+global func Menu_Entry_Icon(icon, extra, int color)
{
- var checkSymbol, checkExtra, checkColor;
- if(GetType(symbol) == C4V_Array)
+ var checkIcon, checkExtra, checkColor;
+ if(GetType(icon) == C4V_Array)
{
- checkSymbol = symbol[0];
- checkExtra = symbol[1];
- checkColor = symbol[2];
+ checkIcon = icon[0];
+ checkExtra = icon[1];
+ checkColor = icon[2];
}
else
{
- checkSymbol = symbol;
+ checkIcon = icon;
checkExtra = extra;
checkColor = color;
}
- if(!(!checkSymbol || GetType(checkSymbol) == C4V_C4ID || GetType(checkSymbol) == C4V_C4Object)) { FatalError("Assertion failed: Menu_Entry_Symbol: Invalid symbol; assertion code: !checkSymbol || GetType(checkSymbol) == C4V_C4ID || GetType(checkSymbol) == C4V_C4Object"); }
- if(GetType(checkSymbol) == C4V_C4ID)
+ if(!(!checkIcon || GetType(checkIcon) == C4V_C4ID || GetType(checkIcon) == C4V_C4Object)) { FatalError("Assertion failed: Menu_Entry_Icon: Invalid icon; assertion code: !checkIcon || GetType(checkIcon) == C4V_C4ID || GetType(checkIcon) == C4V_C4Object"); }
+ if(GetType(checkIcon) == C4V_C4ID)
{
if(checkExtra)
{
- if(!(GetType(checkExtra) == C4V_Int && checkExtra >= 0)) { FatalError("Assertion failed: Menu_Entry_Symbol: Only positive integers are allowed for symbol extra with symbol id; assertion code: GetType(checkExtra) == C4V_Int && checkExtra >= 0"); }
+ if(!(GetType(checkExtra) == C4V_Int && checkExtra >= 0)) { FatalError("Assertion failed: Menu_Entry_Icon: Only positive integers are allowed for icon extra with icon id; assertion code: GetType(checkExtra) == C4V_Int && checkExtra >= 0"); }
}
- if(!(!checkColor || GetType(checkColor) == C4V_Int)) { FatalError(Format("Assertion failed: Menu_Entry_Symbol: Got invalid color: %v; assertion code: !checkColor || GetType(checkColor) == C4V_Int", checkColor)); }
+ if(!(!checkColor || GetType(checkColor) == C4V_Int)) { FatalError(Format("Assertion failed: Menu_Entry_Icon: Got invalid color: %v; assertion code: !checkColor || GetType(checkColor) == C4V_Int", checkColor)); }
}
else
{
if(checkExtra)
{
- if(!(GetType(checkExtra) == C4V_Bool)) { FatalError("Assertion failed: Menu_Entry_Symbol: Only booleans are allowed for symbol extra with symbol object; assertion code: GetType(checkExtra) == C4V_Bool"); }
+ if(!(GetType(checkExtra) == C4V_Bool)) { FatalError("Assertion failed: Menu_Entry_Icon: Only booleans are allowed for icon extra with icon object; assertion code: GetType(checkExtra) == C4V_Bool"); }
}
- if(!(!checkColor)) { FatalError("Assertion failed: Menu_Entry_Symbol: Colorizing is not supported for symbol objects; assertion code: !checkColor"); }
+ if(!(!checkColor)) { FatalError("Assertion failed: Menu_Entry_Icon: Colorizing is not supported for icon objects; assertion code: !checkColor"); }
}
- if(GetType(symbol) == C4V_Array)
+ if(GetType(icon) == C4V_Array)
{
- return [DT_Menu_Entry_Symbol, symbol];
+ return [DT_Menu_Entry_Icon, icon];
}
else
{
- return [DT_Menu_Entry_Symbol, [symbol, extra, color]];
+ return [DT_Menu_Entry_Icon, [icon, extra, color]];
}
}
global func Menu_Entry_Condition(callback, int allowDisabledSelection) { if(!(MN7I->CheckCallback(callback))) { FatalError("Assertion failed: Menu_Entry_Condition: invalid callback used; assertion code: MN7I->CheckCallback(callback)"); }return [DT_Menu_Entry_Condition, [callback, allowDisabledSelection]]; }
@@ -822,10 +883,17 @@ global func VariableCondition(array scopedVar, compare, int disableMode, bool in
return Menu_ConditionReact_Show;
}
}
+global func Menu_Entry_InstantDescriptionIcon(id icon, variation, int color)
+{
+ if(!(icon)) { FatalError("Assertion failed: Menu_Entry_InstantDescriptionIcon: icon is mandatory; assertion code: icon"); }
+ if(!(!variation || GetType(variation) == C4V_Int || GetType(variation) == C4V_String)) { FatalError("Assertion failed: Menu_Entry_InstantDescriptionIcon: variation must either be an integer to index the icon or a string to select the corresponding portrait; assertion code: !variation || GetType(variation) == C4V_Int || GetType(variation) == C4V_String"); }
+ if(!(!color || GetType(variation) == C4V_String)) { FatalError("Assertion failed: Menu_Entry_InstantDescriptionIcon: color can be only set in conjunction with setting a portrait (i.e. setting variation to the portrait name); assertion code: !color || GetType(variation) == C4V_String"); }
+ return [DT_Menu_Entry_InstantDescriptionIcon, [icon, variation, color]];
+}
global func Menu_Entry_Object(object obj)
{
if(!(obj)) { FatalError("Assertion failed: Menu_Entry_Object: obj is mandatory; assertion code: obj"); }
- return Menu_Combined([Menu_Entry_Symbol(obj), Menu_Entry_Caption(GetName(obj)), Menu_Entry_InfoCaption(GetDesc(obj))]);
+ return Menu_Combined([Menu_Entry_Icon(obj), Menu_Entry_Text(GetName(obj)), Menu_Entry_Description(GetDesc(obj))]);
}
global func Menu_Entry(array settings)
@@ -836,10 +904,10 @@ global func Menu_Entry(array settings)
}
var namedArgs = [];
- namedArgs[DT_Menu_Entry_Caption] = "";
+ namedArgs[DT_Menu_Entry_Text] = "";
namedArgs[DT_Menu_Entry_Placeholder] = -1;
MN7I->NamedArgs(settings, namedArgs);
- if(!namedArgs[DT_Menu_Entry_InfoCaption])
+ if(!namedArgs[DT_Menu_Entry_Description])
{
namedArgs[DT_Menu_Entry_Extra] |= C4MN_Add_ForceNoDesc;
}
@@ -864,7 +932,7 @@ global func Menu_Factory(array callbacks, args, array binding)
global func Menu_Text(string text, bool allowSelection)
{
- return Menu_Entry([Menu_Entry_Caption(text), Menu_Entry_Placeholder(allowSelection)]);
+ return Menu_Entry([Menu_Entry_Text(text), Menu_Entry_Placeholder(allowSelection)]);
}
global func Menu_Blank(bool allowSelection)
@@ -872,12 +940,12 @@ global func Menu_Blank(bool allowSelection)
return Menu_Entry([Menu_Entry_Placeholder(allowSelection)]);
}
-func DeclineAcceptBack(string caption, symbol, string callback, array settings)
+func DeclineAcceptBack(string text, icon, string callback, array settings)
{
- var ret = Menu_Entry([Menu_Entry_Caption(caption), Menu_Combined(settings || [])]);
+ var ret = Menu_Entry([Menu_Entry_Text(text), Menu_Combined(settings || [])]);
ret[1][DT_Menu_Entry_Args] = [ret[1][DT_Menu_Entry_Callbacks], ret[1][DT_Menu_Entry_Args]];
ret[1][DT_Menu_Entry_Callbacks] = Menu_Entry_Callbacks([Menu_Callback(MN7I->MenuObjectCallback(callback), Menu_CallbackType_All, [Menu_CallbackArg_Action, Menu_CallbackArg_Args, Menu_CallbackArg_All])])[1];
- ExtraSymbol(ret[1][DT_Menu_Entry_Caption], ret[1][DT_Menu_Entry_Symbol], symbol);
+ ExtraIcon(ret[1][DT_Menu_Entry_Text], ret[1][DT_Menu_Entry_Icon], icon);
return ret;
}
@@ -901,7 +969,7 @@ global func Menu_Adaptor_Variable(array Variable) { return [DT_Menu_Adaptor_Vari
global func Menu_Adaptor_Callbacks(array Callbacks) { return [DT_Menu_Adaptor_Callbacks, Callbacks]; }
global func Menu_Adaptor_MessageBoardText(string MessageBoardText) { return [DT_Menu_Adaptor_MessageBoardText, MessageBoardText]; }
global func Menu_Adaptor_WrapAround(bool WrapAround) { return [DT_Menu_Adaptor_WrapAround, WrapAround]; }
-global func Menu_Adaptor_EnumSubmenuSymbol(id EnumSubmenuSymbol) { return [DT_Menu_Adaptor_EnumSubmenuSymbol, EnumSubmenuSymbol]; }
+global func Menu_Adaptor_EnumSubmenuIcon(id EnumSubmenuIcon) { return [DT_Menu_Adaptor_EnumSubmenuIcon, EnumSubmenuIcon]; }
global func Menu_Adaptor_EnumAllowUnknown(bool EnumAllowUnknown) { return [DT_Menu_Adaptor_EnumAllowUnknown, EnumAllowUnknown]; }
global func Menu_Adaptor_EnumInline(bool EnumInline) { return [DT_Menu_Adaptor_EnumInline, EnumInline]; }
global func Menu_Adaptor_EnumSubmenu(int callbackType) { if(!((callbackType & ~Menu_CallbackType_All) == 0)) { FatalError("Assertion failed: Menu_Adaptor_EnumSubmenu: invalid callback type(s) used; assertion code: (callbackType & ~Menu_CallbackType_All) == 0"); }return [DT_Menu_Adaptor_EnumSubmenu, callbackType]; }
@@ -955,9 +1023,9 @@ global func Menu_Adaptor_BitField(array fieldVals, array layout, bool valuesAsSe
return Menu_Combined([Menu_Adaptor_Type(Menu_AdaptorType_BitField), [DT_Menu_Adaptor_LayoutVals, [fieldVals, layout]]]);
}
global func Menu_Adaptor_NoEmptyString() { return [DT_Menu_Adaptor_NoEmptyString, true]; }
-global func Menu_Adaptor_EnumSubmenuCaption(string menuCaption, string entryCaption)
+global func Menu_Adaptor_EnumSubmenuTitleAndText(string menuTitle, string entryText)
{
- return [DT_Menu_Adaptor_EnumSubmenuCaption, [menuCaption, entryCaption]];
+ return [DT_Menu_Adaptor_EnumSubmenuTitleAndText, [menuTitle, entryText]];
}
global func Menu_Adaptor_Boolean() { return Menu_Adaptor_Type(Menu_AdaptorType_Boolean); }
global func Menu_Adaptor_Integer() { return Menu_Adaptor_Type(Menu_AdaptorType_Integer); }
@@ -967,7 +1035,7 @@ global func Menu_Adaptor_ID() { return Menu_Adaptor_Type(Menu_AdaptorType_ID); }
func AdaptorLayout(array& layout, array& vals, bool valuesAsSeparateLists)
{
if(!(vals)) { FatalError("Assertion failed: AdaptorLayout: vals are mandatory; assertion code: vals"); }
- layout = layout || [Menu_Layout_Value | Menu_Layout_Caption];
+ layout = layout || [Menu_Layout_Value | Menu_Layout_Text];
var layoutMap = [];
var index = 1;
for(var val in layout)
@@ -979,9 +1047,9 @@ func AdaptorLayout(array& layout, array& vals, bool valuesAsSeparateLists)
layoutMap[noFlag] = index;
}
- if(val & Menu_Layout_Caption)
+ if(val & Menu_Layout_Text)
{
- layoutMap[Menu_Layout__CaptionPos] = index;
+ layoutMap[Menu_Layout__TextPos] = index;
}
if(val & Menu_Layout_Value)
@@ -1018,7 +1086,7 @@ func AdaptorLayout(array& layout, array& vals, bool valuesAsSeparateLists)
for(var fieldPart in vals)
{
- if(layout[Menu_Layout_Symbol]) { Menu_Entry_Symbol(fieldPart[layout[Menu_Layout_Symbol] - 1]); } // this debug checks the symbol
+ if(layout[Menu_Layout_Icon]) { Menu_Entry_Icon(fieldPart[layout[Menu_Layout_Icon] - 1]); } // this debug checks the icon
}
}
@@ -1065,61 +1133,61 @@ func EnumValPos(array enumVals, array layout, val, bool allowUnknown)
return -1;
}
-func BooleanToggleCaption(bool val, string& caption, &symbol)
+func BooleanToggleText(bool val, string& text, &icon)
{
val = !!val;
- ExtraSymbol(caption, symbol, [MN7I, 2 - val, !val && RGB(128, 128, 128)]);
+ ExtraIcon(text, icon, [MN7I, 2 - val, !val && RGB(128, 128, 128)]);
}
-func InlineSymbol(string& caption, symbol)
+func InlineIcon(string& text, icon)
{
- if(symbol[2])
+ if(icon[2])
{
- caption = Format("<c %x>{{%i:%d}}</c> %s", symbol[2], symbol[0], symbol[1], caption);
+ text = Format("<c %x>{{%i:%d}}</c> %s", icon[2], icon[0], icon[1], text);
}
else
{
- caption = Format("{{%i:%d}} %s", symbol[0], symbol[1], caption);
+ text = Format("{{%i:%d}} %s", icon[0], icon[1], text);
}
}
-func ExtraSymbol(string& caption, &symbol, extraSymbol)
+func ExtraIcon(string& text, &icon, extraIcon)
{
- if(GetType(extraSymbol) == C4V_C4ID)
+ if(GetType(extraIcon) == C4V_C4ID)
{
- extraSymbol = [extraSymbol];
+ extraIcon = [extraIcon];
}
- if(symbol && extraSymbol && GetType(extraSymbol[0]) == C4V_C4ID)
+ if(icon && extraIcon && GetType(extraIcon[0]) == C4V_C4ID)
{
- InlineSymbol(caption, extraSymbol);
+ InlineIcon(text, extraIcon);
}
else
{
- symbol = extraSymbol;
+ icon = extraIcon;
}
}
-func EnumEntrySettings(string& caption, &symbol, string& infoCaption, int index, array args, array entry)
+func EnumEntrySettings(string& text, &icon, string& description, int index, array args, array entry)
{
var layoutVals = args[DT_Menu_Adaptor_LayoutVals];
var layout = layoutVals[1];
layoutVals = layoutVals[0];
- caption = entry[DT_Menu_Entry_Caption];
- if(layout[Menu_Layout__CaptionPos])
+ text = entry[DT_Menu_Entry_Text];
+ if(layout[Menu_Layout__TextPos])
{
- caption = Format(caption, layoutVals[index][layout[Menu_Layout__CaptionPos] - 1]);
+ text = Format(text, layoutVals[index][layout[Menu_Layout__TextPos] - 1]);
}
- if(layout[Menu_Layout_Symbol])
+ if(layout[Menu_Layout_Icon])
{
- ExtraSymbol(caption, symbol, layoutVals[index][layout[Menu_Layout_Symbol] - 1]);
+ ExtraIcon(text, icon, layoutVals[index][layout[Menu_Layout_Icon] - 1]);
}
- if(layout[Menu_Layout_InfoCaption])
+ if(layout[Menu_Layout_Description])
{
- infoCaption = Format(infoCaption, layoutVals[index][layout[Menu_Layout_InfoCaption] - 1]);
+ description = Format(description, layoutVals[index][layout[Menu_Layout_Description] - 1]);
}
}
@@ -1153,9 +1221,9 @@ func AdaptorFactory(args, int entryIndex)
var entry = args[0];
var entrySettings = args[2];
args = args[1];
- var caption = entry[DT_Menu_Entry_Caption];
- var infoCaption = entry[DT_Menu_Entry_InfoCaption];
- var symbol = entry[DT_Menu_Entry_Symbol];
+ var text = entry[DT_Menu_Entry_Text];
+ var description = entry[DT_Menu_Entry_Description];
+ var icon = entry[DT_Menu_Entry_Icon];
var val = ScopedVar(args[DT_Menu_Adaptor_Variable]);
var defaultMsgboardText = "$EnterValue$";
@@ -1167,12 +1235,12 @@ func AdaptorFactory(args, int entryIndex)
if(args[DT_Menu_Adaptor_Type] == Menu_AdaptorType_Boolean)
{
if(!(GetType(val) == C4V_Any || GetType(val) == C4V_Bool)) { FatalError("Assertion failed: AdaptorFactory: Value of Menu_Adaptor_Variable has wrong type; assertion code: GetType(val) == C4V_Any || GetType(val) == C4V_Bool"); }
- BooleanToggleCaption(val, caption, symbol);
+ BooleanToggleText(val, text, icon);
}
else if(args[DT_Menu_Adaptor_Type] == Menu_AdaptorType_String)
{
if(!(GetType(val) == C4V_Any || GetType(val) == C4V_String)) { FatalError("Assertion failed: AdaptorFactory: Value of Menu_Adaptor_Variable has wrong type; assertion code: GetType(val) == C4V_Any || GetType(val) == C4V_String"); }
- caption = Format(entry[DT_Menu_Entry_Caption], val);
+ text = Format(entry[DT_Menu_Entry_Text], val);
defaultMsgboardText = "$EnterText$";
}
else if(args[DT_Menu_Adaptor_Type] == Menu_AdaptorType_Integer)
@@ -1191,17 +1259,17 @@ func AdaptorFactory(args, int entryIndex)
min = true;
}
}
- caption = Format("%s %s", Format(entry[DT_Menu_Entry_Caption], val), ["{{MN7I:4}}", "<c 808080>{{MN7I:4}}</c>"][min]);
- ExtraSymbol(caption, symbol, [MN7I, 3, max && RGB(128, 128, 128)]);
+ text = Format("%s %s", Format(entry[DT_Menu_Entry_Text], val), ["{{MN7I:4}}", "<c 808080>{{MN7I:4}}</c>"][min]);
+ ExtraIcon(text, icon, [MN7I, 3, max && RGB(128, 128, 128)]);
defaultMsgboardText = "$EnterNumber$";
}
else if(args[DT_Menu_Adaptor_Type] == Menu_AdaptorType_ID)
{
if(!(GetType(val) == C4V_Any || GetType(val) == C4V_C4ID)) { FatalError("Assertion failed: AdaptorFactory: Value of Menu_Adaptor_Variable has wrong type; assertion code: GetType(val) == C4V_Any || GetType(val) == C4V_C4ID"); }
- caption = Format(entry[DT_Menu_Entry_Caption], val && GetName(0, val) || "");
+ text = Format(entry[DT_Menu_Entry_Text], val && GetName(0, val) || "");
if(val)
{
- ExtraSymbol(caption, symbol, val);
+ ExtraIcon(text, icon, val);
}
defaultMsgboardText = "$EnterIDOrName$";
}
@@ -1227,9 +1295,9 @@ func AdaptorFactory(args, int entryIndex)
index = 0;
}
- var submenuSymbol = symbol;
+ var submenuIcon = icon;
- EnumEntrySettings(caption, symbol, infoCaption, index, args, entry);
+ EnumEntrySettings(text, icon, description, index, args, entry);
if(args[DT_Menu_Adaptor_EnumSubmenu] != Menu_CallbackType_None)
{
@@ -1245,11 +1313,11 @@ func AdaptorFactory(args, int entryIndex)
args[DT_Menu_Adaptor_MessageBoardText] = args[DT_Menu_Adaptor_MessageBoardText] || defaultMsgboardText;
if(!retSubmenu)
{
- return [Menu_Entry([Menu_Combined(entrySettings), Menu_Entry_Caption(caption), Menu_Entry_Callbacks([Menu_Callback(MenuObjectCallback("AdaptorCommand"), Menu_CallbackType_All, [Menu_CallbackArg_Action, Menu_CallbackArg_MenuObject, Menu_CallbackArg_Args, Menu_CallbackArg_All])]), Menu_Entry_Symbol(symbol), Menu_Entry_InfoCaption(infoCaption), Menu_Entry_Args(args)])];
+ return [Menu_Entry([Menu_Combined(entrySettings), Menu_Entry_Text(text), Menu_Entry_Callbacks([Menu_Callback(MenuObjectCallback("AdaptorCommand"), Menu_CallbackType_All, [Menu_CallbackArg_Action, Menu_CallbackArg_MenuObject, Menu_CallbackArg_Args, Menu_CallbackArg_All])]), Menu_Entry_Icon(icon), Menu_Entry_Description(description), Menu_Entry_Args(args)])];
}
else
{
- return [Menu_SubMenu([Menu_Combined(entrySettings), Menu_Entry_Caption(caption), Menu_Entry_Callbacks([Menu_Callback(MenuObjectCallback("AdaptorCommand"), Menu_CallbackType_All, [Menu_CallbackArg_Action, Menu_CallbackArg_MenuObject, Menu_CallbackArg_Args, Menu_CallbackArg_All])]), Menu_Entry_Symbol(symbol), Menu_Entry_InfoCaption(infoCaption), Menu_Entry_Args(args)], retSubmenu)];
+ return [Menu_SubMenu([Menu_Combined(entrySettings), Menu_Entry_Text(text), Menu_Entry_Callbacks([Menu_Callback(MenuObjectCallback("AdaptorCommand"), Menu_CallbackType_All, [Menu_CallbackArg_Action, Menu_CallbackArg_MenuObject, Menu_CallbackArg_Args, Menu_CallbackArg_All])]), Menu_Entry_Icon(icon), Menu_Entry_Description(description), Menu_Entry_Args(args)], retSubmenu)];
}
}
@@ -1261,17 +1329,17 @@ func AdaptorEnumSubmenuFactory(array args)
var layout = layoutVals[1];
layoutVals = layoutVals[0];
- var submenuCaption = args[DT_Menu_Adaptor_EnumSubmenuCaption];
- var submenuSymbol = [];
+ var submenuTitleAndText = args[DT_Menu_Adaptor_EnumSubmenuTitleAndText];
+ var submenuIcon = [];
- if(submenuCaption && submenuCaption[0])
+ if(submenuTitleAndText && submenuTitleAndText[0])
{
- entry[DT_Menu_Entry_Caption] = submenuCaption[0];
+ entry[DT_Menu_Entry_Text] = submenuTitleAndText[0];
}
var index = EnumValPos(layoutVals, layout, ScopedVar(args[DT_Menu_Adaptor_Variable]), args[DT_Menu_Adaptor_EnumAllowUnknown]);
- var symbol, infoCaption;
- EnumEntrySettings(submenuCaption, symbol, infoCaption, index, args, entry);
+ var title, icon, description;
+ EnumEntrySettings(title, icon, description, index, args, entry);
var ret;
if(args[DT_Menu_Adaptor_EnumInline])
@@ -1284,41 +1352,40 @@ func AdaptorEnumSubmenuFactory(array args)
Menu_Selection(index),
Menu_KeepParentOnClose(),
Menu_DontKeepOpen(),
- Menu_Caption(submenuCaption)
+ Menu_Title(title)
];
}
- if(args[DT_Menu_Adaptor_EnumSubmenuSymbol])
+ if(args[DT_Menu_Adaptor_EnumSubmenuIcon])
{
- submenuSymbol = [args[DT_Menu_Adaptor_EnumSubmenuSymbol]];
+ submenuIcon = [args[DT_Menu_Adaptor_EnumSubmenuIcon]];
}
- else if(!submenuSymbol && symbol && GetType(symbol[0]) == C4V_C4ID)
+ else if(!submenuIcon && icon && GetType(icon[0]) == C4V_C4ID)
{
- submenuSymbol = symbol;
+ submenuIcon = icon;
}
- if(submenuSymbol && GetType(submenuSymbol[0]) == C4V_C4ID)
+ if(submenuIcon && GetType(submenuIcon[0]) == C4V_C4ID)
{
- ArrayAppend(ret, Menu_Symbol(submenuSymbol[0]));
+ ArrayAppend(ret, Menu_Icon(submenuIcon[0]));
}
- var caption;
-
- var submenuCaption = args[DT_Menu_Adaptor_EnumSubmenuCaption];
- if(submenuCaption && submenuCaption[1])
+ var text;
+ var submenuTitleAndText = args[DT_Menu_Adaptor_EnumSubmenuTitleAndText];
+ if(submenuTitleAndText && submenuTitleAndText[1])
{
- entry[DT_Menu_Entry_Caption] = submenuCaption[1];
+ entry[DT_Menu_Entry_Text] = submenuTitleAndText[1];
}
for(var i = 0; i < GetLength(layoutVals); ++i)
{
- symbol = 0;
- EnumEntrySettings(caption, symbol, infoCaption, i, args, entry);
+ icon = 0;
+ EnumEntrySettings(text, icon, description, i, args, entry);
if(args[DT_Menu_Adaptor_EnumInline])
{
- BooleanToggleCaption(i == index, caption, symbol);
+ BooleanToggleText(i == index, text, icon);
}
- ArrayAppend(ret, Menu_Entry([Menu_Entry_Caption(caption), Menu_Entry_Symbol(symbol), Menu_Entry_InfoCaption(infoCaption), Menu_Entry_Callbacks([Menu_Callback(MenuObjectCallback("AdaptorEnumSubmenuItem"), Menu_CallbackType_Defaults, [Menu_CallbackArg_Args, Menu_CallbackArg_All])]), Menu_Entry_Args([i, args])]));
+ ArrayAppend(ret, Menu_Entry([Menu_Entry_Text(text), Menu_Entry_Icon(icon), Menu_Entry_Description(description), Menu_Entry_Callbacks([Menu_Callback(MenuObjectCallback("AdaptorEnumSubmenuItem"), Menu_CallbackType_Defaults, [Menu_CallbackArg_Args, Menu_CallbackArg_All])]), Menu_Entry_Args([i, args])]));
}
return ret;
@@ -1361,9 +1428,9 @@ func AdaptorBitFieldItemsFactory(args)
var entrySettings = args[2];
args = args[1];
- var caption = entry[DT_Menu_Entry_Caption];
- var infoCaption = entry[DT_Menu_Entry_InfoCaption];
- var symbol = entry[DT_Menu_Entry_Symbol];
+ var text = entry[DT_Menu_Entry_Text];
+ var description = entry[DT_Menu_Entry_Description];
+ var icon = entry[DT_Menu_Entry_Icon];
var fieldValue = ScopedVar(args[DT_Menu_Adaptor_Variable]);
if(!(GetType(fieldValue) == C4V_Any || GetType(fieldValue) == C4V_Int)) { FatalError("Assertion failed: AdaptorFactory: Value of Menu_Adaptor_Variable has wrong type; assertion code: GetType(fieldValue) == C4V_Any || GetType(fieldValue) == C4V_Int"); }
@@ -1376,27 +1443,27 @@ func AdaptorBitFieldItemsFactory(args)
for(var val in layoutVals)
{
var mask = val[layout[Menu_Layout__ValuePos] - 1];
- caption = entry[DT_Menu_Entry_Caption] || "%s";
- if(layout[Menu_Layout__CaptionPos])
+ text = entry[DT_Menu_Entry_Text] || "%s";
+ if(layout[Menu_Layout__TextPos])
{
- caption = Format(caption, val[layout[Menu_Layout__CaptionPos] - 1]);
+ text = Format(text, val[layout[Menu_Layout__TextPos] - 1]);
}
- symbol = entry[DT_Menu_Entry_Symbol];
- BooleanToggleCaption((fieldValue & mask) == mask, caption, symbol);
- if(layout[Menu_Layout_Symbol])
+ icon = entry[DT_Menu_Entry_Icon];
+ BooleanToggleText((fieldValue & mask) == mask, text, icon);
+ if(layout[Menu_Layout_Icon])
{
- ExtraSymbol(caption, symbol, val[layout[Menu_Layout_Symbol] - 1]);
+ ExtraIcon(text, icon, val[layout[Menu_Layout_Icon] - 1]);
}
- if(layout[Menu_Layout_InfoCaption])
+ if(layout[Menu_Layout_Description])
{
- infoCaption = Format(infoCaption, val[layout[Menu_Layout_InfoCaption] - 1]);
+ description = Format(description, val[layout[Menu_Layout_Description] - 1]);
}
args[DT_Menu_Adaptor_Mask] = mask;
- ArrayAppend(ret, Menu_Entry([Menu_Combined(entrySettings), Menu_Entry_Caption(caption), Menu_Entry_Callbacks([Menu_Callback(MenuObjectCallback("AdaptorCommand"), Menu_CallbackType_All, [Menu_CallbackArg_Action, Menu_CallbackArg_MenuObject, Menu_CallbackArg_Args, Menu_CallbackArg_All])]), Menu_Entry_Symbol(symbol), Menu_Entry_InfoCaption(infoCaption), Menu_Entry_Args(args)]));
+ ArrayAppend(ret, Menu_Entry([Menu_Combined(entrySettings), Menu_Entry_Text(text), Menu_Entry_Callbacks([Menu_Callback(MenuObjectCallback("AdaptorCommand"), Menu_CallbackType_All, [Menu_CallbackArg_Action, Menu_CallbackArg_MenuObject, Menu_CallbackArg_Args, Menu_CallbackArg_All])]), Menu_Entry_Icon(icon), Menu_Entry_Description(description), Menu_Entry_Args(args)]));
}
return ret;
@@ -1694,7 +1761,7 @@ func InputCallback(string input, int plr)
msgBoardMode = 0;
if(val != oldVal)
{
- var reaction = CallCallbacks(args[DT_Menu_Adaptor_Callbacks], Menu_CallbackType_ValueChanged, [Menu_CallbackType_ValueChanged, entry[DT_Menu_Entry_Symbol], settings[DT_Menu_Settings_Object], callbackArgs, 0, 0, val, oldVal]);
+ var reaction = CallCallbacks(args[DT_Menu_Adaptor_Callbacks], Menu_CallbackType_ValueChanged, [Menu_CallbackType_ValueChanged, entry[DT_Menu_Entry_Icon], settings[DT_Menu_Settings_Object], callbackArgs, 0, 0, val, oldVal]);
if(reaction != Menu_React_None)
{
return React(reaction, msgBoardEntry);
@@ -1713,6 +1780,9 @@ global func CreateNewMenu(array menu, inheritSettings, object parentMenu)
settings[DT_Menu_Settings_Style] &= ~C4MN_Style_EqualItemHeight; // EqualItemHeight can't be inherited
settings[DT_Menu_Settings_Selection] = 0; // Selection can't be inherited
settings[DT_Menu_Settings_Callbacks] = 0; // Global callbacks can't be inherited (maybe filter callbacks)
+ settings[DT_Menu_Settings_InstantDescriptionDecoration] = DT_Menu_DefaultInstantDescriptionDecoration;
+ settings[DT_Menu_Settings_InstantDescriptionFlags] = MSG_Left | MSG_Bottom;
+ settings[DT_Menu_Settings_InstantDescriptionPosition] = [40, -60];
settings[DT_Menu_Settings_Parent] = parentMenu;
@@ -1869,11 +1939,36 @@ func GetObject()
return settings[DT_Menu_Settings_Object];
}
-func CreateSymbolDummy()
+func CreateIconDummy()
{
- return CreateContents(DT_Menu_SymbolDummy);
+ return CreateContents(DT_Menu_IconDummy);
}
+// deprecated compatibility functions and constants
+// Symbol -> Icon
+static const Menu_Layout_Symbol = Menu_Layout_Icon;
+static const Menu_CallbackArg_Symbol = Menu_CallbackArg_Icon;
+
+global func Menu_Symbol() { return Menu_Icon(...); }
+global func Menu_Entry_Symbol() { return Menu_Entry_Icon(...); }
+
+// InfoCaption -> Description
+static const Menu_Layout_InfoCaption = Menu_Layout_Description;
+
+global func Menu_Entry_InfoCaption() { return Menu_Entry_Description(...); }
+
+// Menu_Caption -> Menu_Title
+global func Menu_Caption() { return Menu_Title(...); }
+
+// Menu_Entry_Caption -> Menu_Entry_Text
+static const Menu_Layout_Caption = Menu_Layout_Text;
+
+global func Menu_Entry_Caption() { return Menu_Entry_Text(...); }
+
+// Menu_Adaptor_EnumSubmenuCaption -> Menu_Adaptor_EnumSubmenuTitleAndText
+global func Menu_Adaptor_EnumSubmenuCaption() { return Menu_Adaptor_EnumSubmenuTitleAndText(...); }
+
+
func ValidateDeco(id deco)
{
return !deco || (deco->~FrameDecorationBackClr() || deco->~FrameDecorationBorderTop() || deco->~FrameDecorationBorderLeft() || deco->~FrameDecorationBorderRight() || deco->~FrameDecorationBorderBottom());
diff --git a/SymbolDummy.c4d/Script.c b/SymbolDummy.c4d/Script.c
deleted file mode 100644
index 4032726..0000000
--- a/SymbolDummy.c4d/Script.c
+++ /dev/null
@@ -1,16 +0,0 @@
-#strict 2
-
-static const DT_Menu_SymbolDummy = MS7I;
-
-func SetSymbol(id symbol, int nr)
-{
- SetGraphics(0, this, symbol);
- SetPicture(GetDefCoreVal("Picture", "DefCore", symbol, 0) + nr * GetDefCoreVal("Picture", "DefCore", symbol, 2), GetDefCoreVal("Picture", "DefCore", symbol, 1), GetDefCoreVal("Picture", "DefCore", symbol, 2), GetDefCoreVal("Picture", "DefCore", symbol, 3));
- return this;
-}
-
-func SetColor(int color)
-{
- SetClrModulation(color);
- return this;
-}