It is currently May 6th, 2024, 5:36 pm

Scrolly Text Select For File (ini) Open in Editor [solved]

Get help with creating, editing & fixing problems with skins
User avatar
Mor3bane
Posts: 943
Joined: May 7th, 2016, 7:32 am

Scrolly Text Select For File (ini) Open in Editor [solved]

Post by Mor3bane »

In some code from eclectic-tech, I would hopefully ask for some help to isolate some of his code from here: https://forum.rainmeter.net/viewtopic.php?f=5&t=34101#p168763

What I mean by that is, what mouse action call will be recognised by any particular line of text e.g. for a line of text to be an active link to some Bang method/link/path?

I have some parsed lines of text that are essentially/potentially a config path to an ini that would open the ini in say sublimetext.

There is a lot in eclectic-tech's code that I don't think I need, but am having trouble with the linktofile concept.

Any help is appreciated.
Last edited by Mor3bane on December 9th, 2019, 1:49 am, edited 1 time in total.
My DevArt Gallery

There are many ways to be different - there is only one way to be yourself - be amazing at it

The law of averages says what it means; even if you get everything right, you will get something wrong. Therefore; self managing error trapping initiates another set of averages - amongst the errors, some of them will not be errors, instead those instances will appear to be "luck". One cannot complain of the 'appearance' of 'infinite regress of causation', even if it does not have a predictable pattern, only that it requires luck to achieve.
User avatar
Mor3bane
Posts: 943
Joined: May 7th, 2016, 7:32 am

Re: Scrolly Text Select For File (ini) Open in Editor

Post by Mor3bane »

If eclectic-tech isn't around, perhaps someone has any ideas, please?

Here is my code as updated so far. I have cut a lot of stuff out trying to simplify my task, but I am stuck.

Code: Select all

[Rainmeter]
Update=-1
DefaultUpdateDivider=-1
DynamicWindowSize=1
AccurateText=1
Group=Scrollie

[variables]
Spacing=21
MaxListings=21
StartY=39
Padding=5
Width=320

[RainmeterSettings]
Measure=WebParser
URL=file://C:\Users\Morbane\AppData\Roaming\Rainmeter\Rainmeter.ini
CodePage=1200
RegExp=(?s)(.*)
UpdateDivider=5
UpdateRate=1
FinishAction=[!UpdateMeasure GetConfigName][!UpdateMeterGroup ShowIt][!Redraw]

[GetConfigName]
Measure=String
String=[RainmeterSettings]
DynamicVariables=1
RegExpSubstitute=1
Substitute="(?s).*?(\[[^\n]*?\])..Active=[^0]" : "\1", "(?s)([^\n]*]).*" : "\1", "\[(.*?)]" : "\1#CRLF#"

[MeasureiniPath]
Measure=Plugin
Plugin=FileView
Path=#SKINSPATH#\
LeftMouseDownAction=[!CommandMeasure "[GetConfigName]" "open"]

[Header]
Meter=Shape
DynamicVariables=1
Shape=Rectangle 0, 0, 320, 36, 8

[Title]
Meter=string
StringAlign=Left
Text=Active Configs:
X=0
Y=0
Padding=25,0,129,0
Fontcolor=255,220,135,255
Container=Header
FontFace=Testamentos-Jed@
StringStyle=Normal
SolidColor=25,50,25,50
FontSize=12
DynamicVariables=1

[Container]
Meter=Shape
DynamicVariables=1
Shape=Rectangle 0, 39, #Width#, (#Spacing# * #MaxListings#+#Padding#), 10

[Show]
Meter=string
Group=ShowIt
StringAlign=Left
text=[GetConfigName]
X=0
Padding=25,0,0,5
Y=#StartY#
W= #Width#
Container=Container
FontFace=Segoe UI
FontSize=12
FontColor=255,220,135,255
SolidColor=25,50,25,100
MouseOverAction=[!SetOption #CURRENTSECTION# SolidColor 25,50,25,100][!UpdateMeter #CURRENTSECTION#][!SetOption Title SolidColor 25,50,25,100][!UpdateMeter Title][!Redraw]
MouseLeaveAction=[!SetOption #CURRENTSECTION# SolidColor 25,50,25,50][!UpdateMeter #CURRENTSECTION#][!SetOption Title SolidColor 25,50,25,50][!UpdateMeter Title][!Redraw]
MouseScrollDownAction=[!SetOption #CURRENTSECTION# Y (([#CURRENTSECTION#:H]-#StartY#+[#CURRENTSECTION#:Y]-#Padding#)<(#Spacing#*#MaxListings#+#Padding#)?[#CURRENTSECTION#:Y]:([#CURRENTSECTION#:Y]-#Spacing#))][!UpdateMeter #CURRENTSECTION#][!UpdateMeter Slider][!Redraw]
MouseScrollUpAction=[!SetOption #CURRENTSECTION# Y ((([#CURRENTSECTION#:Y]+#Spacing#)>#StartY#?#StartY#:([#CURRENTSECTION#:Y]+#Spacing#)))][!UpdateMeter #CURRENTSECTION#][!UpdateMeter Slider][!Redraw]
LeftMouseDownAction=[]
DynamicVariables=1

[GetMouseY]
Measure=Calc
Group=NoUpdate
Disabled=1
Formula=(Ceil(#MouseY#) - 1) = -1 ? 0 : (Ceil(#MouseY#) - 1)
DynamicVariables=1
My DevArt Gallery

There are many ways to be different - there is only one way to be yourself - be amazing at it

The law of averages says what it means; even if you get everything right, you will get something wrong. Therefore; self managing error trapping initiates another set of averages - amongst the errors, some of them will not be errors, instead those instances will appear to be "luck". One cannot complain of the 'appearance' of 'infinite regress of causation', even if it does not have a predictable pattern, only that it requires luck to achieve.
User avatar
Yamajac
Posts: 134
Joined: June 30th, 2014, 8:44 am

Re: Scrolly Text Select For File (ini) Open in Editor

Post by Yamajac »

I'm not sure I understand the question. If you take a look at the whole skin you're modifying, you'll see that this is already done, I just use a context menu for actually sending the bang.

Code: Select all

[Show]
Meter = string
Group = ShowIt
text  = [FuckShitUp]
X     = 10
Y     = #StartY#
W     = #Width#
Container  = Container
FontFace   = Cormac-ExtraLight
FontColor  = 155,147,201,255
SolidColor = 0,0,0,1
FontSize   = 12
DynamicVariables  = 1
; This converts the mouse's Y coordinates to the line clicked on
; If you use a bigger font, you need to change the 18 
; Later on I'll programmatically determine the lineheight but I need to figure out
; a good way to count the number of active skins first. Which I might never do.
; It's easy to do it in a bad way though.
LeftMouseUpAction     = [!SetVariable MouseY "($MouseY$ / #Spacing#)"][!UpdateMeasureGroup Mousers][!UpdateMeasure ClickedConfig][!Refresh [ClickedConfig]]
RightMouseUpAction    = [!SetVariable MouseY "($MouseY$ / #Spacing#)"][!UpdateMeasureGroup Mousers][!UpdateMeasure ClickedConfig][!WriteKeyValue Variables Config [ClickedConfig] "#SKINSPATH#\DevKit\RainManager\ContextMenu.inc"][!WriteKeyValue Variables @IncludeOptions "#SKINSPATH#DevKit\RainManager\ContextMenu.inc" "#SKINSPATH#Context Menu\ContextMenu\ContextMenu.ini"][!ActivateConfig "Context Menu\ContextMenu"][!Move (#CURRENTCONFIGX#+$MouseX$+[#CURRENTSECTION#:X]) (#CURRENTCONFIGY#+$MouseY$+[#CURRENTSECTION#:Y]) "Context Menu\ContextMenu"][!update "Context Menu\ContextMenu"]
MiddleMouseUpAction   = [!SetVariable MouseY "($MouseY$ / #Spacing#)"][!UpdateMeasureGroup Mousers][!UpdateMeasure ClickedConfig][!DeactivateConfig [ClickedConfig]][!UpdateMeasure RainmeterSettings]
MouseScrollDownAction = [!SetOption #CURRENTSECTION# Y (([#CURRENTSECTION#:H]-#StartY#+[#CURRENTSECTION#:Y]-#Padding#)<(#Spacing#*#MaxListings#+#Padding#)?[#CURRENTSECTION#:Y]:([#CURRENTSECTION#:Y]-#Spacing#))][!UpdateMeter #CURRENTSECTION#][!UpdateMeter Slider][!Redraw][!UpdateMeasure Tester]
MouseScrollUpAction   = [!SetOption #CURRENTSECTION# Y ((([#CURRENTSECTION#:Y]+#Spacing#)>#StartY#?#StartY#:([#CURRENTSECTION#:Y]+#Spacing#)))][!UpdateMeter #CURRENTSECTION#][!UpdateMeter Slider][!Redraw][!UpdateMeasure Tester]

In the various MouseUpActions, we first set MouseY to "($MouseY$ / #Spacing#)" and then update the Mousers measuregroup. This Mousers measure group refers to only the GetMouseY measure ATM. Then we update the ClickedConfig measure which gets WHICH config was clicked on. Then [ClickedConfig] will refer to whichever config was clicked on, and we can use it accordingly.

Image

In my RightMouseUpAction I send the data to a separate context menu skin, but you could just remove that bit and do [!EditSkin [ClickedConfig]] instead. Fun fact, the only reason the EditSkin bang works that way is because I needed it to for this very skin. :D


So if I'm understanding your question right, you want to do what this skin does and to do it you removed the parts responsible for doing it?
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5407
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Scrolly Text Select For File (ini) Open in Editor

Post by eclectic-tech »

Been a busy weekend...

My skin and Yamajac's may produce similar results, but take completely different approaches to achieve click selection and scrolling.

As Yamajac points out, the skin you are modifying is his version, that (from a quick glance) calculates the mouse Y position and uses that combined with "lineheight" to determine what position in the skin was "clicked". I haven't looked much deeper into his "interesting" approach.

My posted example uses a list of relatively positioned meter items (sourced by webparser in that case). The list is positioned inside a CONTAINER of your desired size, and the Y position of the first meter is changed to scroll the list upward or downward, using the container to limit what is visible.

Yamajac's replies can help you modify his original code for your purpose. :great:
User avatar
Mor3bane
Posts: 943
Joined: May 7th, 2016, 7:32 am

Re: Scrolly Text Select For File (ini) Open in Editor

Post by Mor3bane »

Hi Guys,

Thanks for getting to this one.

Originally, I liked simply to have the scroll window, so was taking bits from both eclectic-tech's and Yamajac's skins.

However, having been tooling around with the bulk of the code being Yamajac's, and finding his skin actually primarily useful for the process of opening .ini files, I switched lanes back to wanting the config functionality, rather than something else as originally gleaned from eclectic-tech's skin.

So you may have noticed some bits from both are being utilised in my version, hence I had cut out the context menu before even exploring what it was. So, having that clarified, I will backtrack through Yamajac's code.

I hope no one minds that in this process, I've literally butchered you guy's code. :oops:

I will check in again if further hurdles surface as I re-rework Yamajac's stuff.

At this point, all I really am remaining wanting to do is to keep my changed layout for the skin and the shapes as I have them in my post above.

I have to go through Yamajac's code, and hopefully it will become clear and I learn something (hopefully) new.
My DevArt Gallery

There are many ways to be different - there is only one way to be yourself - be amazing at it

The law of averages says what it means; even if you get everything right, you will get something wrong. Therefore; self managing error trapping initiates another set of averages - amongst the errors, some of them will not be errors, instead those instances will appear to be "luck". One cannot complain of the 'appearance' of 'infinite regress of causation', even if it does not have a predictable pattern, only that it requires luck to achieve.
User avatar
Yamajac
Posts: 134
Joined: June 30th, 2014, 8:44 am

Re: Scrolly Text Select For File (ini) Open in Editor

Post by Yamajac »

Nah, I'm happy to see something I made get some use. A lotta work went into the logic for this skin so it's nice that somebody other than me can benefit from it.
User avatar
Yamajac
Posts: 134
Joined: June 30th, 2014, 8:44 am

Re: Scrolly Text Select For File (ini) Open in Editor

Post by Yamajac »

eclectic-tech wrote: December 8th, 2019, 3:31 am My posted example uses a list of relatively positioned meter items (sourced by webparser in that case). The list is positioned inside a CONTAINER of your desired size, and the Y position of the first meter is changed to scroll the list upward or downward, using the container to limit what is visible.
We both use containers and the same scrolling method actually, the only difference lies in that I use one string meter while you use a list of relatively positioned meters.

I prefer using one string meter since it allows for an unlimited number of items to be drawn instead of being limited to however many you wrote in the skin, but it does make the whole process a lot harder to follow lol. I wish I could do a similar thing with images. :(
User avatar
balala
Rainmeter Sage
Posts: 16201
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Scrolly Text Select For File (ini) Open in Editor

Post by balala »

Yamajac wrote: December 8th, 2019, 7:24 am I wish I could do a similar thing with images. :(
I don't see why you couldn't.
User avatar
Yamajac
Posts: 134
Joined: June 30th, 2014, 8:44 am

Re: Scrolly Text Select For File (ini) Open in Editor

Post by Yamajac »

balala wrote: December 8th, 2019, 7:56 am I don't see why you couldn't.
Nah, you havr to define each image individually I believe. Cant just replace letters in a string with images, for example. Itd be nice though :(
User avatar
balala
Rainmeter Sage
Posts: 16201
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Scrolly Text Select For File (ini) Open in Editor

Post by balala »

Yamajac wrote: December 8th, 2019, 8:37 am Cant just replace letters in a string with images,
O.O Don't even dream such of a thing. No way for this. O.O