Skip to content

Commit

Permalink
Removed the Sort() action
Browse files Browse the repository at this point in the history
  • Loading branch information
paul-manias committed May 15, 2024
1 parent d495c46 commit 6b58bb2
Show file tree
Hide file tree
Showing 13 changed files with 18 additions and 71 deletions.
1 change: 0 additions & 1 deletion docs/xml/modules/classes/compressedstream.xml
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@
<const name="SetKey"/>
<const name="Show"/>
<const name="Signal"/>
<const name="Sort"/>
<const name="Undo"/>
<const name="Unlock"/>
<const name="Write"/>
Expand Down
7 changes: 1 addition & 6 deletions docs/xml/modules/classes/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,6 @@ print('The Action class is located at ' .. str)
<comment>Saves configuration data to an object, using standard config text format.</comment>
</action>

<action>
<name>Sort</name>
<comment>Sorts config groups into alphabetical order.</comment>
</action>

</actions>

<methods>
Expand Down Expand Up @@ -216,7 +211,7 @@ print('The Action class is located at ' .. str)
<prototype>ERR cfgSortByKey(OBJECTPTR Object, CSTRING Key, LONG Descending)</prototype>
<input>
<param type="CSTRING" name="Key">The name of the key to sort on.</param>
<param type="LONG" name="Descending">Set to TRUE if a descending sort is required.</param>
<param type="LONG" name="Descending">Set to true if a descending sort is required.</param>
</input>
<description>
<p>The SortByKey method sorts the groups of a config object by key values (the named key value should be present in every group).</p>
Expand Down
1 change: 0 additions & 1 deletion docs/xml/modules/core.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2341,7 +2341,6 @@ SetField(Object, FID_Statement|TSTR, "string");
<const name="SetKey"/>
<const name="Show"/>
<const name="Signal"/>
<const name="Sort"/>
<const name="Undo"/>
<const name="Unlock"/>
<const name="Write"/>
Expand Down
7 changes: 2 additions & 5 deletions include/parasol/modules/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ DEFINE_ENUM_FLAG_OPERATORS(CCF)
#define AC_Redimension 3
#define AC_Clear 4
#define AC_FreeWarning 5
#define AC_Sort 6
#define AC_Enable 6
#define AC_CopyData 7
#define AC_DataFeed 8
#define AC_Deactivate 9
Expand Down Expand Up @@ -172,8 +172,7 @@ DEFINE_ENUM_FLAG_OPERATORS(CCF)
#define AC_Clipboard 45
#define AC_Refresh 46
#define AC_Disable 47
#define AC_Enable 48
#define AC_END 49
#define AC_END 48

// Permission flags

Expand Down Expand Up @@ -3057,7 +3056,6 @@ inline ERR acReset(OBJECTPTR Object) { return Action(AC_Reset,Object,NULL); }
inline ERR acSaveSettings(OBJECTPTR Object) { return Action(AC_SaveSettings,Object,NULL); }
inline ERR acShow(OBJECTPTR Object) { return Action(AC_Show,Object,NULL); }
inline ERR acSignal(OBJECTPTR Object) { return Action(AC_Signal,Object,NULL); }
inline ERR acSort(OBJECTPTR Object) { return Action(AC_Sort,Object,NULL); }
inline ERR acUnlock(OBJECTPTR Object) { return Action(AC_Unlock,Object,NULL); }

inline ERR acClipboard(OBJECTPTR Object, CLIPMODE Mode) {
Expand Down Expand Up @@ -3750,7 +3748,6 @@ class objConfig : public Object {
struct acSaveToObject args = { Dest, { ClassID } };
return Action(AC_SaveToObject, this, &args);
}
inline ERR sort() noexcept { return Action(AC_Sort, this, NULL); }

// Customised field setting

Expand Down
4 changes: 2 additions & 2 deletions scripts/dev/idl/common.fdl
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@ flags("CCF", { comment="Class categories", module="Core" },
"MULTIMEDIA")

enum("AC", { weak=true, start=1, comment="Action identifiers.", module="Core" },
"Signal", "Activate", "Redimension", "Clear", "FreeWarning", "Sort", "CopyData",
"Signal", "Activate", "Redimension", "Clear", "FreeWarning", "Enable", "CopyData",
"DataFeed", "Deactivate", "Draw", "Flush", "Focus", "Free", "SaveSettings",
"GetKey", "DragDrop", "Hide", "Init", "Lock", "LostFocus", "Move",
"MoveToBack", "MoveToFront", "NewChild", "NewOwner", "NewObject", "Redo", "Query",
"Read", "Rename", "Reset", "Resize", "SaveImage", "SaveToObject", "MoveToPoint",
"Seek", "SetKey", "Show", "Undo", "Unlock", "Next", "Prev",
"Write", "SetField", "Clipboard", "Refresh", "Disable", "Enable",
"Write", "SetField", "Clipboard", "Refresh", "Disable",
"END")

flags("PERMIT", { comment="Permission flags", module="Core" },
Expand Down
1 change: 0 additions & 1 deletion scripts/dev/idl/idl-c.fluid
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ glActionStubs = {
Reset = " inline ERR reset() noexcept { return Action(AC_Reset, this, NULL); }",
SaveSettings = " inline ERR saveSettings() noexcept { return Action(AC_SaveSettings, this, NULL); }",
Show = " inline ERR show() noexcept { return Action(AC_Show, this, NULL); }",
Sort = " inline ERR sort() noexcept { return Action(AC_Sort, this, NULL); }",
Unlock = " inline ERR unlock() noexcept { return Action(AC_Unlock, this, NULL); }",

CopyData = [[
Expand Down
1 change: 0 additions & 1 deletion scripts/dev/idl/idl-doc.fluid
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ glActionComments[AC_Seek] = 'Move the read/write marker to a new posit
glActionComments[AC_SetField] = 'Private. For use by the Core only.'
glActionComments[AC_SetKey] = 'Sets custom key values that are not defined by an object\'s structure.'
glActionComments[AC_Show] = 'Makes an object visible to the user.'
glActionComments[AC_Sort] = 'Sorts object content into ascending order (by default).'
glActionComments[AC_Undo] = 'Reverses the last operation.'
glActionComments[AC_Unlock] = 'Remove a lock from an object.'
glActionComments[AC_Write] = 'Writes data to objects that provide storage or output services.'
Expand Down
26 changes: 1 addition & 25 deletions scripts/gui/button.fluid
Original file line number Diff line number Diff line change
@@ -1,29 +1,5 @@
--[[
The gui.button API creates and manages buttons in the user interface.

Basic template for creating a new button:

require 'gui/button'
my_button = gui.button({ Options... })

Valid options to use when creating the button are as follows:

target: Required. Refers to a viewport that will contain the button.
icon: An optional icon to display alongside the text.
text: A label to display in the button.
events: A table of event triggers. Supported events: activate, show, focus, lostFocus, cursorEntry, cursorExit, enable, disable
width: Width of the button (including any label).
x: The x coordinate of the button.
xOffset: X offset, if not defining x.
y: The y coordinate of the button.
yOffset: Y offset, if not defining y.

:disable()
Disable user interactivity.

:enable()
Enable user interactivity.

Documentation is available in the Parasol Wiki.
--]]

require 'common'
Expand Down
31 changes: 9 additions & 22 deletions src/core/classes/class_config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -594,26 +594,6 @@ static ERR CONFIG_Set(extConfig *Self, struct cfgSet *Args)
else return ERR::Search;
}

/*********************************************************************************************************************
-ACTION-
Sort: Sorts config groups into alphabetical order.
-END-
*********************************************************************************************************************/

static ERR CONFIG_Sort(extConfig *Self, APTR Void)
{
pf::Log log;

log.branch("Sorting by group name.");

std::sort(Self->Groups->begin(), Self->Groups->end(),
[](const ConfigGroup &a, const ConfigGroup &b ) {
return a.first < b.first;
});

return ERR::Okay;
}

/*********************************************************************************************************************
-METHOD-
Expand All @@ -623,7 +603,7 @@ The SortByKey method sorts the groups of a config object by key values (the name
-INPUT-
cstr Key: The name of the key to sort on.
int Descending: Set to TRUE if a descending sort is required.
int Descending: Set to true if a descending sort is required.
-ERRORS-
Okay
Expand All @@ -634,7 +614,14 @@ NoData

static ERR CONFIG_SortByKey(extConfig *Self, struct cfgSortByKey *Args)
{
if ((!Args) or (!Args->Key)) return CONFIG_Sort(Self, NULL); // If no args are provided then use the default Sort action instead
if ((!Args) or (!Args->Key)) { // Sort by group name if no args provided.
std::sort(Self->Groups->begin(), Self->Groups->end(),
[](const ConfigGroup &a, const ConfigGroup &b ) {
return a.first < b.first;
});

return ERR::Okay;
}

pf::Log log;

Expand Down
1 change: 0 additions & 1 deletion src/core/classes/class_config_def.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ static const struct ActionArray clConfigActions[] = {
{ AC_NewObject, CONFIG_NewObject },
{ AC_SaveSettings, CONFIG_SaveSettings },
{ AC_SaveToObject, CONFIG_SaveToObject },
{ AC_Sort, CONFIG_Sort },
{ 0, NULL }
};

1 change: 0 additions & 1 deletion src/core/defs/core.fdl
Original file line number Diff line number Diff line change
Expand Up @@ -1915,7 +1915,6 @@ inline ERR acReset(OBJECTPTR Object) { return Action(AC_Reset,Object,NULL); }
inline ERR acSaveSettings(OBJECTPTR Object) { return Action(AC_SaveSettings,Object,NULL); }
inline ERR acShow(OBJECTPTR Object) { return Action(AC_Show,Object,NULL); }
inline ERR acSignal(OBJECTPTR Object) { return Action(AC_Signal,Object,NULL); }
inline ERR acSort(OBJECTPTR Object) { return Action(AC_Sort,Object,NULL); }
inline ERR acUnlock(OBJECTPTR Object) { return Action(AC_Unlock,Object,NULL); }

inline ERR acClipboard(OBJECTPTR Object, CLIPMODE Mode) {
Expand Down
2 changes: 1 addition & 1 deletion src/core/idl.h

Large diffs are not rendered by default.

6 changes: 2 additions & 4 deletions src/fluid/fluid_object_actions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ static int obj_jump_empty(lua_State *Lua, const obj_read &Handle, object *def) {
static int obj_jump_signal(lua_State *Lua, const obj_read &Handle, object *def) { lua_pushvalue(Lua, 1); lua_pushinteger(Lua, AC_Signal); lua_pushcclosure(Lua, object_action_call, 2); return 1; }
static int obj_jump_activate(lua_State *Lua, const obj_read &Handle, object *def) { lua_pushvalue(Lua, 1); lua_pushcclosure(Lua, action_activate, 1); return 1; }
static int obj_jump_clear(lua_State *Lua, const obj_read &Handle, object *def) { lua_pushvalue(Lua, 1); lua_pushinteger(Lua, AC_Clear); lua_pushcclosure(Lua, object_action_call, 2); return 1; }
static int obj_jump_sort(lua_State *Lua, const obj_read &Handle, object *def) { lua_pushvalue(Lua, 1); lua_pushinteger(Lua, AC_Sort); lua_pushcclosure(Lua, object_action_call, 2); return 1; }
static int obj_jump_copydata(lua_State *Lua, const obj_read &Handle, object *def) { lua_pushvalue(Lua, 1); lua_pushinteger(Lua, AC_CopyData); lua_pushcclosure(Lua, object_action_call_args, 2); return 1; }
static int obj_jump_datafeed(lua_State *Lua, const obj_read &Handle, object *def) { lua_pushvalue(Lua, 1); lua_pushinteger(Lua, AC_DataFeed); lua_pushcclosure(Lua, object_action_call_args, 2); return 1; }
static int obj_jump_deactivate(lua_State *Lua, const obj_read &Handle, object *def) { lua_pushvalue(Lua, 1); lua_pushinteger(Lua, AC_Deactivate); lua_pushcclosure(Lua, object_action_call, 2); return 1; }
Expand Down Expand Up @@ -118,7 +117,7 @@ static std::array<obj_read::JUMP *, AC_END> glJumpActions = {
obj_jump_redimension,
obj_jump_clear,
obj_jump_empty, // FreeWarning
obj_jump_sort,
obj_jump_enable,
obj_jump_copydata,
obj_jump_datafeed,
obj_jump_deactivate,
Expand Down Expand Up @@ -159,6 +158,5 @@ static std::array<obj_read::JUMP *, AC_END> glJumpActions = {
obj_jump_setfield,
obj_jump_clipboard,
obj_jump_refresh,
obj_jump_disable,
obj_jump_enable
obj_jump_disable
};

0 comments on commit 6b58bb2

Please sign in to comment.