CC: Draw bar & place text on it

Features wanted...
Post Reply
highend
Posts: 14922
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

CC: Draw bar & place text on it

Post by highend »

It would be cool if we could additionally place text (centered) in a custom column with format = icon e.g. for perfect age columns...

Like this:
onecommander_pages-number_file-age-colour_1.png
Taken from: viewtopic.php?t=29617

Sample script (without text ofc):

Code: Select all

    $modified = property("#date.m", "<cc_item>");
    $diff     = datediff($modified, , "n"); // Difference in minutes
    switch (true) {
        case $diff == 0:    return ''; // draw nothing
        case $diff < 1440:  return '>draw.bar ' . 100 . ', 66CC66, BBEEBB'; // less than a day
        case $diff < 2880:  return '>draw.bar ' . 100 . ', FFBB00, FFEE88'; // 1 day
        case $diff < 10080: return '>draw.bar ' . 100 . ', DD4444, FFAAAA'; // 2 - 7 days
        // ...
        default:            return '>draw.bar ' . 100 . ', DD44AA, FFAADD';
    }
You do not have the required permissions to view the files attached to this post.
One of my scripts helped you out? Please donate via Paypal

admin
Site Admin
Posts: 66070
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: CC: Draw bar & place text on it

Post by admin »

Do you have a suggestion for the syntax? It would at least need the text and the text color.

highend
Posts: 14922
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: CC: Draw bar & place text on it

Post by highend »

Maybe:

Code: Select all

>draw.bar [percentage=50], [colorleft], [colorright], [opacity=224], [borderwidth=0]|[text]|[colortext]
A "," for the delimiter between [text] and [colortext] wouldn't make sense, so why not use two bars?
One of my scripts helped you out? Please donate via Paypal

admin
Site Admin
Posts: 66070
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: CC: Draw bar & place text on it

Post by admin »

Because the text may contain a comma?

highend
Posts: 14922
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: CC: Draw bar & place text on it

Post by highend »

Exactly
One of my scripts helped you out? Please donate via Paypal

admin
Site Admin
Posts: 66070
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: CC: Draw bar & place text on it

Post by admin »

Looks doable. :)

highend
Posts: 14922
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: CC: Draw bar & place text on it

Post by highend »

:tup:
One of my scripts helped you out? Please donate via Paypal

highend
Posts: 14922
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: CC: Draw bar & place text on it

Post by highend »

Very cool! One minor request though (if it's still possible and not too much work):

Code: Select all

>draw.bar [percentage=50], [colorleft], [colorright], [opacity=224], [borderwidth=0]|[text]|[colortext]|[horizontalalignment]
Alignments:
c = center
l = left
r = left
If [alignment] is left out, it's c by default

The vertical alignment should imho be always centered
One of my scripts helped you out? Please donate via Paypal

admin
Site Admin
Posts: 66070
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: CC: Draw bar & place text on it

Post by admin »

Tomorrow. :)

highend
Posts: 14922
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: CC: Draw bar & place text on it

Post by highend »

Thanks, great addition!
One of my scripts helped you out? Please donate via Paypal

admin
Site Admin
Posts: 66070
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: CC: Draw bar & place text on it

Post by admin »

I agree, thanks for the idea! :tup:

Post Reply