Gambas Function sorter

So you have written that new, must have program. Let us see it here.
Post Reply
User avatar
BruceSteers
Posts: 1521
Joined: Thursday 23rd July 2020 5:20pm
Location: Isle of Wight
Contact:

Gambas Function sorter

Post by BruceSteers »

Darn my code becomes a mess.

So i was working on a function sorter.

I then integrated the code into my gambas :)

Attached is the test proggy.
gambascodesorter-1.1.7.tar.gz
(199.97 KiB) Downloaded 252 times

How it works...

You load a gambas source code into it and it analyses the text...

Anything in the global space above the functions is considered the Header apart from comments after the last definition.
So any comments/wiki comments between the last global definition and the first function is considered the 1st functions pre-text.

The file is read and the functions are listed, any text between functions is stored as the next functions pre-text.

So the FileMap.class data then consists of the header and the functions along with their pre-text.
This should preserve any comments/wiki text and anything else.

The data can then be sorted using the gambas Sort flags (gb.ascent, gb.IgnoreCase, etc) with FileMap.Sort()

The app enables toggling most of the options the FileMap supports.

Options..
Array Sort options,, toggle gb.IgnoreCase, gb.Natural, gb.Ascent/gb.Descent.

Form_Open() on top, that will place Form_Open() as the first function after any special methods

You can manually move functions around with the up and down buttons and save it as you like.

Set the amount of lines between the Header and the functions.
Set the amount of lines between the functions.

Latest version
gambascodesorter-1.1.7.tar.gz
(199.97 KiB) Downloaded 252 times
Last edited by BruceSteers on Thursday 4th August 2022 9:37am, edited 7 times in total.
If at first you don't succeed , try doing something differently.
BruceS
User avatar
BruceSteers
Posts: 1521
Joined: Thursday 23rd July 2020 5:20pm
Location: Isle of Wight
Contact:

Re: Gambas Function sorter

Post by BruceSteers »

I have been a naughty boy and snuck the FileMap.class into my gambas IDE Editor ;)

If at first you don't succeed , try doing something differently.
BruceS
User avatar
PJBlack
Posts: 184
Joined: Tuesday 9th June 2020 10:26pm
Location: Florstadt, Hessen, Germany

Re: Gambas Function sorter

Post by PJBlack »

Image
Attachments
Bildschirmfoto_2022-01-19_12-50-11.png
Bildschirmfoto_2022-01-19_12-50-11.png (14.99 KiB) Viewed 8079 times
User avatar
BruceSteers
Posts: 1521
Joined: Thursday 23rd July 2020 5:20pm
Location: Isle of Wight
Contact:

Re: Gambas Function sorter

Post by BruceSteers »

PJBlack wrote: Wednesday 19th January 2022 11:51am Image
Do you not have the latest gambas?

Okay just for you dude I've removed the FileBox and used a Buttonbox instead

plus there's a few other upgrades...
Last edited by BruceSteers on Thursday 20th January 2022 12:16am, edited 1 time in total.
If at first you don't succeed , try doing something differently.
BruceS
User avatar
BruceSteers
Posts: 1521
Joined: Thursday 23rd July 2020 5:20pm
Location: Isle of Wight
Contact:

Re: Gambas Function sorter

Post by BruceSteers »

EDIT:
I have added "Groups" to it.

groups are....
By default..
FileMap.GroupOrder = [GRP_Static, GRP_Hidden, GRP_Other, GRP_Event, GRP_Property]

GroupOrder[] can be rearranged like this..
FileMap.GroupOrder = [GRP_Static, GRP_Hidden, GRP_Event, GRP_Property, GRP_Other]

GroupOrder[] does not need to be the complete list of types, Eg.
FileMap.GroupOrder = [GRP_Hidden, GRP_Event]

If GRP_Other is not specified it is automatically appended as anything that does not meet a specific style is treated as GRP_Other

Group methods are...
GRP_Static, Function/Sub is static
GRP_Hidden, Function/Sub begins with _underscore
GRP_Other, if not any group
GRP_Event, name is *_*
GRP_Property, Name is like blah_Read or Blah_Write
Last edited by BruceSteers on Thursday 20th January 2022 12:27am, edited 1 time in total.
If at first you don't succeed , try doing something differently.
BruceS
User avatar
BruceSteers
Posts: 1521
Joined: Thursday 23rd July 2020 5:20pm
Location: Isle of Wight
Contact:

Re: Gambas Function sorter

Post by BruceSteers »

BruceSteers wrote: Wednesday 19th January 2022 4:33pm
PJBlack wrote: Wednesday 19th January 2022 11:51am Image
Do you not have the latest gambas?

Okay just for you dude I've removed the FileBox and used a Buttonbox instead
Aah it might have been that one of it's own source files was loading as a test file.

that work in the IDE but not the compiled exe. So i copied the file to the .public folder and fixed that

Cheers :)
If at first you don't succeed , try doing something differently.
BruceS
User avatar
BruceSteers
Posts: 1521
Joined: Thursday 23rd July 2020 5:20pm
Location: Isle of Wight
Contact:

Re: Gambas Function sorter

Post by BruceSteers »

Added some argument options.

Options:
-m --modal No file load box
-n --nosource No source file view
-o --output Save button outputs text not save file
-c --close Save button exits after save.
-f --file <Path> File to load
-V --version Display version
-h --help Display this help

i have this set up now so my gambas External Tools feature can use it, It can load the current source file into the CodeSorter, then after i save the changes and close the sorter the document reloads in the IDE.
Last edited by BruceSteers on Sunday 30th January 2022 1:58am, edited 2 times in total.
If at first you don't succeed , try doing something differently.
BruceS
User avatar
PJBlack
Posts: 184
Joined: Tuesday 9th June 2020 10:26pm
Location: Florstadt, Hessen, Germany

Re: Gambas Function sorter

Post by PJBlack »

Bildschirmfoto vom 2022-01-20 11-12-18.png
Bildschirmfoto vom 2022-01-20 11-12-18.png (9.92 KiB) Viewed 8034 times
now that i am back here after various intensive care units ... be honest ... you missed me ;)
Attachments
Bildschirmfoto vom 2022-01-20 11-12-47.png
Bildschirmfoto vom 2022-01-20 11-12-47.png (16.05 KiB) Viewed 8034 times
User avatar
BruceSteers
Posts: 1521
Joined: Thursday 23rd July 2020 5:20pm
Location: Isle of Wight
Contact:

Re: Gambas Function sorter

Post by BruceSteers »

PJBlack wrote: Thursday 20th January 2022 10:14am Bildschirmfoto vom 2022-01-20 11-12-18.png

now that i am back here after various intensive care units ... be honest ... you missed me ;)
Sorry fella.

I attached it to the first post now.
download/file.php?id=1118
If at first you don't succeed , try doing something differently.
BruceS
Post Reply