|
|
|
12-12-2016, 01:47 PM
|
#81
|
Administrator
Join Date: Mar 2007
Location: NY
Posts: 15,746
|
Or!
Code:
BOLD,ITALIC,UNDERLINE=string.byte("biu",1,3)
(how do you say TMTOWTDI in Portuguese?)
|
|
|
12-12-2016, 06:26 PM
|
#82
|
Human being with feelings
Join Date: Mar 2013
Posts: 515
|
Quote:
Originally Posted by Lokasenna
We'll see, but I doubt it. My spare time is extremely limited right now, so what I do get ends up being spent on guitar.
|
No problem man. It already great as it is. Happy jams!
Quote:
Originally Posted by schwa
FWIW the lyrics editor script (lyrics.lua) that will be included with REAPER 5.30 includes a text entry box and scrollbar, which may be useful as coding examples (and could certainly be improved further!).
|
Thanks for the tip schwa!
Quote:
Originally Posted by schwa
(how do you say TMTOWTDI in Portuguese?)
|
__________________
"After silence, that which comes nearest to expressing the inexpressible is music", Aldous Huxley
|
|
|
12-12-2016, 08:00 PM
|
#83
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
Awesome, thanks gents. Adding that helper function to the Text chapter now.
Last edited by Lokasenna; 12-12-2016 at 08:12 PM.
|
|
|
01-16-2017, 02:12 PM
|
#84
|
Human being with feelings
Join Date: Feb 2015
Posts: 753
|
Why is this thread not a Sticky?
|
|
|
09-20-2017, 01:21 AM
|
#85
|
Human being with feelings
Join Date: May 2017
Posts: 14
|
Problem with knobs ?
Hello Lokasenna,
Thanks a lot for the library, it is being an enormous help.
I am running into a problem when I try to add a knob, I am not sure how to make min and max values work with regards to the ticks shown. It looks as if the tick labels are taken from the number of steps always starting at 0.
GUI.New("n_notes", "Knob", 1, 50, 50, 40, "Notes", 1,10,10,2,1)
I would expect ticks to go from 1 to 10, and default value to be at number 2, but it might well be that I am misunderstanding it's use.
I am using the library just downloaded from https://github.com/ReaTeam/ReaScript.../Lokasenna_GUI
Thank you again,
Benigno.
|
|
|
09-26-2017, 01:02 PM
|
#86
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
You're using it correctly - that's a bug. Fixed now (I think), you'll just have to redownload the Knob class file.
|
|
|
09-29-2017, 06:59 AM
|
#87
|
Human being with feelings
Join Date: May 2017
Posts: 14
|
Problem with knobs - Solved
Hello, thanks a lot, it works quite nicely as expected.
I am finishing a little plugin to create ear training exercises using your GUI, is there any place where you want to be notified of these things ? I suppose this thread is not the best place, but didn't really know where to ask.
Thanks a lot,
Benigno.
|
|
|
09-29-2017, 08:15 PM
|
#88
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
I'm happy with a shout-out in your thread for it. Glad to see people making use of it.
|
|
|
10-02-2017, 06:04 PM
|
#89
|
Human being with feelings
Join Date: Aug 2012
Posts: 271
|
For text can offer this script
I used it only for testing chunks, but it supports any ASC2 text.
The code is a bit ugly, but understandable enough.
In fact - it's a very-very simple text editor.
It supports large files. It supports selection, copying, pasting, and so on. Many functions can be very easily added. I just do not have time for this.
|
|
|
10-04-2017, 02:25 PM
|
#90
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
Awesome. I'll try to wrap it into a class file when I get some time.
|
|
|
08-04-2018, 11:18 AM
|
#91
|
Human being with feelings
Join Date: Jan 2010
Location: Fjugesta, Sweden
Posts: 811
|
Right click selecting
Hi!
I have this senario:
When I left click in a listbox the item get selected and in a frame
some text is shown. When I right click in my listbox I get a dropdown-
menu BUT the item in listbox dont get selected.
How can I select an item in listbox when I right click?
AND is it possible to change color on selected item?
|
|
|
08-04-2018, 12:11 PM
|
#92
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
- Wrong thread. :P
- You could have the right-click method call the left-click method at the end, I think. Haven't tried.
Code:
function GUI.elms.my_listbox:onr_mouseup() -- or whatever the method is called, I forget
... do stuff...
self:onmouseup()
end
|
|
|
08-06-2018, 03:48 AM
|
#93
|
Human being with feelings
Join Date: Jan 2010
Location: Fjugesta, Sweden
Posts: 811
|
Quote:
Originally Posted by Lokasenna
- Wrong thread. :P
- You could have the right-click method call the left-click method at the end, I think. Haven't tried.
Code:
function GUI.elms.my_listbox:onr_mouseup() -- or whatever the method is called, I forget
... do stuff...
self:onmouseup()
end
|
Wrong thread?? Oooops - sorry, moving to the other thread
|
|
|
08-29-2018, 08:01 PM
|
#94
|
Human being with feelings
Join Date: Mar 2007
Location: Denver, CO
Posts: 633
|
I am trying to edit the image demo to allow image resizing. It's working so far but only for the switches, which have only 2 images. My knobs and sliders are a little tweaky. So I'm trying to figure out what I did wrong.
So I'm looking at the slider code, and wondering where the '63' comes from?
Code:
local frame = (curstep / steps) * 63
GUI.img(x, y, w, w, frame, GUI.images.knb)
well, and just in case someone can help, here is my new code for GUI.img. I had to add a framecount argument, so I can divide the image up properly, rather than assuming it's already the desired height... and I imagine that's where my error is.
Code:
-- Draw the specified frame from a given image buffer
local function img(x, y, w, h, step, buffer, framecount)
framecount = framecount or 1
local img_w,img_h = gfx.getimgdim(buffer)
local frame_h = img_h / framecount
gfx.mode = 0
local img_y = frame_h * step
gfx.blit(buffer, 1, 0, 0, img_y, img_w,frame_h, x, y, w, h)
end
GUI.img = img
I think that framecount is the same as 'steps', right? or am I confused?
|
|
|
08-29-2018, 09:05 PM
|
#95
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
Oh boy, it's been a while since I wrote this. Let's see...
63: The slider image I used has frames 32px tall, and there are twice as many as the script needed so I had it only use every second frame.
framecount: My code assumes that you're just using the image at the original size, since I didn't like how Reaper's resizing algorithm looked. step is the frame to grab, given a frame size of w,h.
I should probably apologize for how rough and sloppy that code is. The GUI has gone through three or four complete overhauls between what I had in this tutorials and what's on ReaPack, and the image functions were left behind a long time ago.
If and when you get images working nicely with the current version, though, I'd definitely be interested in adding them again. I've been slowly rewriting these tutorials, so eventually I might get as far as images and come up with some updated code myself.
|
|
|
08-29-2018, 11:54 PM
|
#96
|
Human being with feelings
Join Date: Mar 2007
Location: Denver, CO
Posts: 633
|
well, I'll see how ambitious I get. I may try and dig into the newer stuff. I'm actually quite happy this code is as old and tiny as it is. I feel comfortable getting around in it, and I'm not far from getting it to work.
I do tend to avoid resizing, but thought I should figure out how to do it anyway. I typically create controls at the size I want to use them. Since I'm using a touch screen live, I can really only use buttons, sliders and knobs, but mostly buttons. and everything has to be big.
I did get a multi-row option matrix working, which is something I like to use with my touchscreen. Here it is with some really grim resizing going on!
|
|
|
08-30-2018, 06:47 AM
|
#97
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
Sexy.
I really have to recommend against using the older library versions, especially the one given here.
- There are a lot of major bugs. I'm not aware of any bugs in the current version, but they get fixed pretty quick when someone finds one.
- The drawing is about as inefficient as you can possibly get - it redraws everything on every frame. The current version stores all of the element layers in gfx buffers and only redraws individual layers when they ask for it.
- This one isn't on ReaPack, so you'd have to distribute and maintain it (read: fix bugs) yourself.
- The current version comes with a bunch of documentation and example scripts, so getting started is still super easy.
Once you've got your image code the way you like it, let me know and I'd be happy to help you port it over.
|
|
|
08-30-2018, 07:49 AM
|
#98
|
Human being with feelings
Join Date: Mar 2007
Location: Denver, CO
Posts: 633
|
okay, yeah, I imagine there are non-obvious reasons not to stick with this code. But it's only for me. I think the use-case is a little too specific....
although maybe not, I'll think about that. I've never managed to get my setup polished and bug-free enough to consider subjecting anyone else to it.
Anyway... I think if you were to integrate this code into your gui you might want to make it compatible with the LBX gui widgets. There are many hundreds of images and corresponding control files that have been created for the stripper.
I'm sure he's got all that code nailed as well, but searching through 67,000(!) lines to find it seems harder than actually writing it!
but here is the format of his KNB files:
Code:
{{
["ctltype"]=0,
["fn"]="KM2016_SimpleBigKnobSatGreen_40-128fr.png",
["cellh"]=40,
["frames"]=128,
},
}
looks like he is supporting vertical strips same as you... everything seems fairly obvious, except for 'ctltype'. I'm sure if you know Lua better than I do, it's trivial to parse this, but I'm still way in the Lua shallow end.
|
|
|
08-30-2018, 08:07 AM
|
#99
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
Cheers, that's an interesting idea.
|
|
|
08-30-2018, 02:57 PM
|
#100
|
Human being with feelings
Join Date: Mar 2007
Location: Denver, CO
Posts: 633
|
Yeah, an interesting idea, but after looking into it, wildly impractical for me to attempt.
I'll stick with the images demo and whatever bugs it brings for now!
cheers,
-e
|
|
|
09-01-2018, 10:46 AM
|
#101
|
Human being with feelings
Join Date: Mar 2007
Location: Denver, CO
Posts: 633
|
Well, after I wrote this I stumbled on the readme in the gui developer.... and I realized I'll need a few custom components to do what I really want.
So.... guess I'm going to try to dive in. Writing a custom UI element is something I've always been intimidated to do, even after 2 years as a Java Swing developer (and that was a good while ago too.)
But I'm going to dive in. Expect some dumb questions here
|
|
|
09-01-2018, 10:52 AM
|
#102
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
There's a blank class template in there somewhere, and it's basically all just event handling. Let me know if you need a hand.
|
|
|
09-01-2018, 01:45 PM
|
#103
|
Human being with feelings
Join Date: Mar 2007
Location: Denver, CO
Posts: 633
|
well, I'm starting with something stupidly simple, just to get familiar with where things are in the code.
But I can't get it to work. I'm trying to update the color of the frame in the first example (where the pan updates by track) based on the color of the track.
I'm using:
Code:
local trackColor = reaper.GetTrackColor(tr)
GUI.elms.frm_track.fill = hex2rgb(trackColor)
I've also tried .bg and .color (Edit: okay, I see, fill is a boolean, bg is just under text)
I then went in and changed "faded" to "red" in the constructor, and that didn't even do anything.
So how do I change the background color??
Last edited by woodslanding; 09-01-2018 at 01:52 PM.
|
|
|
09-01-2018, 02:09 PM
|
#104
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
Should be fill = true and color = "red". There isn't a separate frame vs. background color at the moment - Frame's properties were very much cobbled together as I wrote it, and a hypothetical GUI v3 would involve a huge rewrite for that class.
https://github.com/jalovatt/Lokasenn...iki/2.00-Frame
|
|
|
09-01-2018, 07:13 PM
|
#105
|
Human being with feelings
Join Date: Mar 2007
Location: Denver, CO
Posts: 633
|
that's right. Not working here....
Code:
Frame name, z, x, y, w, h[, shadow, fill, color, round]
GUI.New("frm_track", "Frame", 2, 0, 0, 300, 128, false, true, "red", 0)
No red to be seen....
|
|
|
09-01-2018, 07:49 PM
|
#106
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
Working fine here. I pasted it into one of the example scripts:
Want to post/PM the whole script?
|
|
|
09-01-2018, 09:01 PM
|
#107
|
Human being with feelings
Join Date: Mar 2007
Location: Denver, CO
Posts: 633
|
Just changed one word of the example -- "faded" to "red". Fill is already set to true.
I notice the label is also set to be red... don't see any red on that either.... oh, bg defaults to false, so that makes sense. Well, no, set bg to true, and still no red.
Code:
--[[
Lokasenna_GUI 2.0
- Using the Main loop to monitor and interact with things in Reaper
- Using z layers and related functions to move elements around
- Changing elements' methods for your own purposes
]]--
local dm, _ = debug_mode
local function Msg(str)
reaper.ShowConsoleMsg(tostring(str).."\n")
end
local info = debug.getinfo(1,'S');
script_path = info.source:match[[^@?(.*[\/])[^\/]-$]]
-- I hate working with 'requires', so I've opted to do it this way.
-- This also works much more easily with my Script Compiler.
local function req(file)
if missing_lib then return function () end end
local ret, err = loadfile(script_path .. file)
if not ret then
reaper.ShowMessageBox("Couldn't load "..file.."\n\nError: "..tostring(err), "Library error", 0)
missing_lib = true
return function () end
else
return ret
end
end
-- The Core library must be loaded prior to any classes, or the classes will throw up errors
-- when they look for functions that aren't there.
req("Core.lua")()
-- For better cross-platform behavior.
local sep = GUI.file_sep
req("Classes/Class - Label.lua")()
req("Classes/Class - Slider.lua")()
req("Classes/Class - Frame.lua")()
-- If any of the requested libraries weren't found, abort the script.
if missing_lib then return 0 end
GUI.name = "Example - Main, Z, and Methods"
GUI.x, GUI.y, GUI.w, GUI.h = 0, 0, 300, 128
GUI.anchor, GUI.corner = "mouse", "C"
-- Pre-declaring this so every function has access to it
local tr
--[[
New elements are created by:
GUI.New(name, class, params)
and can then have their parameters accessed via:
GUI.elms.name.param
ex:
GUI.New("my_new_label", "Label", 1, 32, 32, "This is my label")
GUI.elms.my_new_label.color = "magenta"
GUI.elms.my_new_label.font = 1
Classes and parameters
Button name, z, x, y, w, h, caption, func[, ...]
Checklist name, z, x, y, w, h, caption, opts[, dir, pad]
Frame name, z, x, y, w, h[, shadow, fill, color, round]
Knob name, z, x, y, w, caption, min, max, steps, default[, vals]
Label name, z, x, y, caption[, shadow, font, color, bg]
Menubox name, z, x, y, w, h, caption, opts
Radio name, z, x, y, w, h, caption, opts[, dir, pad]
Slider name, z, x, y, w, caption, min, max, steps, handles[, dir]
Tabs name, z, x, y, tab_w, tab_h, opts[, pad]
Textbox name, z, x, y, w, h[, caption, pad]
Listbox name, z, x, y, w, h, list[, multi, shadow]
]]--
GUI.New("lbl_track", "Label", 1, 96, 8, "No track selected!", true, 2, "red")
GUI.New("frm_track", "Frame", 2, 0, 0, 300, 128, false, true, "red", 0)
GUI.New("sldr_pan", "Slider", 3, 88, 64, 128, "First selected track's Pan:", -100, 100, 200, 100, "h")
-- Layer 5 will never be shown or updated
-- (See the Main function below)
GUI.elms_hide[5] = true
local function update_pan()
reaper.SetMediaTrackInfo_Value( tr, "D_PAN", GUI.Val("sldr_pan")/100 )
end
-- Class methods can be overwritten, either at the class level or
-- for individual elements.
-- You can also easily add your own code to methods:
-- Needs to be global, since GUI already exists
function GUI.elms.sldr_pan:onmousedown()
-- Run the slider's normal method
-- Note that we have to call the method as a function here; we
-- can't use the : syntax because sldr_pan's 'self' needs to be
-- passed on as a value. If we used a :, it would pass GUI.Slider
GUI.Slider.onmousedown(self)
update_pan()
end
function GUI.elms.sldr_pan:ondrag()
GUI.Slider.ondrag(self)
update_pan()
end
function GUI.elms.sldr_pan:onwheel()
GUI.Slider.onwheel(self)
update_pan()
end
function GUI.elms.sldr_pan:ondoubleclick()
GUI.Slider.ondoubleclick(self)
update_pan()
end
-- This will be run on every update loop of the GUI script; anything you would put
-- inside a reaper.defer() loop should go here. (The function name doesn't matter)
local function Main()
-- Check the track state and toggle our warning label as needed
tr = reaper.GetSelectedTrack( 0, 0 )
if tr then
-- Save a bit of CPU by only doing this if we need to
if GUI.elms.lbl_track.z == 1 then
-- These both accomplish the same thing...
-- lbl_track is moved to a different layer, which we've permanently
-- hidden above. Use this if you have several elements on a single
-- layer and only want to hide one of them. e.g. adjusting which
-- options are available depending on other things the user does.
GUI.elms.lbl_track.z = 5
-- frm_track's entire layer is hidden. This is what the Tabs element
-- uses.
GUI.elms_hide[GUI.elms.frm_track.z] = true
-- Layers can also be frozen; they'll be drawn, but won't receive
-- any user input. Use this for i.e. having a slider display an
-- RMS value, since the user can't do anything with it.
-- Completely unnecessary here, because frm_track is on top and will
-- "steal" any user input.
GUI.elms_freeze[GUI.elms.sldr_pan.z] = false
-- Force a redraw of every layer
GUI.redraw_z[0] = true
end
-- See if the track's Pan value has been changed and update the slider
local pan = reaper.GetMediaTrackInfo_Value( tr, "D_PAN" )
if math.abs( pan - (GUI.Val("sldr_pan") / 100) ) > 0.00 then
-- Converting the returned value (-1 to 1) to Slider steps (0 to 200)
pan = (math.floor(100*pan) - GUI.elms.sldr_pan.min )
-- Pan knobs can actually be at 0% L or R; correcting for that.
if pan < 100 then pan = pan + 1 end
GUI.Val("sldr_pan", pan )
end
else
if GUI.elms.lbl_track.z == 5 then
GUI.elms.lbl_track.z = 1
GUI.elms_hide[GUI.elms.frm_track.z] = false
GUI.elms_freeze[GUI.elms.sldr_pan.z] = true
GUI.redraw_z[0] = true
end
end
end
GUI.Init()
-- Tell the GUI library to run Main on each update loop
-- Individual elements are updated first, then GUI.func is run, then the GUI is redrawn
GUI.func = Main
-- How often (in seconds) to run GUI.func. 0 = every loop.
GUI.freq = 0
GUI.Main()
Last edited by woodslanding; 09-01-2018 at 09:08 PM.
|
|
|
09-01-2018, 09:31 PM
|
#108
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
I think the problem is that you're using an old version of the GUI, and I've probably messed with Frame in the meantime.
If you've got ReaPack, install both the library and developer tools packages - they're always up to date.
|
|
|
09-01-2018, 09:33 PM
|
#109
|
Human being with feelings
Join Date: Mar 2007
Location: Denver, CO
Posts: 633
|
Oh! I thought I had just downloaded them, but maybe I ended up working with an old version by mistake... I did mess about with it a year ago or so.
sorry!
EDIT: Working with 2 different computers... don't have reapack on this one yet. Have to get everything synched up....
Last edited by woodslanding; 09-01-2018 at 09:38 PM.
|
|
|
09-01-2018, 09:55 PM
|
#110
|
Human being with feelings
Join Date: Mar 2007
Location: Denver, CO
Posts: 633
|
Downloaded Reapack. Installed V2.
Took the same example Main,Z, and Methods, and changed frame color to red. fill is unchanged at true. still no change in the display.
Code:
-- NoIndex: true
--[[
Lokasenna_GUI
- Using the Main loop to monitor and interact with things in Reaper
- Using z layers and related functions to move elements around
- Changing elements' methods for your own purposes
]]--
-- The Core library must be loaded prior to anything else
local lib_path = reaper.GetExtState("Lokasenna_GUI", "lib_path_v2")
if not lib_path or lib_path == "" then
reaper.MB("Couldn't load the Lokasenna_GUI library. Please run 'Script: Set Lokasenna_GUI v2 library path.lua' in your Action List.", "Whoops!", 0)
return
end
loadfile(lib_path .. "Core.lua")()
GUI.req("Classes/Class - Label.lua")()
GUI.req("Classes/Class - Slider.lua")()
GUI.req("Classes/Class - Frame.lua")()
-- If any of the requested libraries weren't found, abort the script.
if missing_lib then return 0 end
------------------------------------
-------- Data + functions ----------
------------------------------------
-- Pre-declaring this so every function has access to it
local tr
local function update_pan()
reaper.SetMediaTrackInfo_Value( tr, "D_PAN", GUI.Val("sldr_pan")/100 )
end
------------------------------------
-------- Window settings -----------
------------------------------------
GUI.name = "Example - Main, Z, and Methods"
GUI.x, GUI.y, GUI.w, GUI.h = 0, 0, 300, 128
GUI.anchor, GUI.corner = "mouse", "C"
------------------------------------
-------- GUI Elements --------------
------------------------------------
--[[
Frame z, x, y, w, h[, shadow, fill, color, round]
Label z, x, y, caption[, shadow, font, color, bg]
Slider z, x, y, w, caption, min, max, defaults[, inc, dir]
]]--
GUI.New("lbl_track", "Label", 1, 96, 8, "No track selected!", true, 2, "red")
GUI.New("frm_track", "Frame", 2, 0, 0, 300, 128, false, true, "red", 0)
GUI.New("sldr_pan", "Slider", 3, 88, 64, 128, "First selected track's Pan:", -100, 100, 100, nil, "h")
-- Layer 5 will never be shown or updated
-- (See the Main function below)
GUI.elms_hide[5] = true
------------------------------------
-------- Method overrides ----------
------------------------------------
-- Class methods can be overwritten, either at the class level or
-- for individual elements.
-- You can also easily append your own code to the stock methods:
function GUI.elms.sldr_pan:onmousedown()
-- Run the slider's normal method
GUI.Slider.onmousedown(self)
-- Note that we have to call the method as a function here; we
-- can't use the : syntax because sldr_pan's 'self' needs to be
-- passed on as a value. If we used a :, it would pass GUI.Slider
update_pan()
end
function GUI.elms.sldr_pan:ondrag()
GUI.Slider.ondrag(self)
update_pan()
end
function GUI.elms.sldr_pan:onwheel()
GUI.Slider.onwheel(self)
update_pan()
end
function GUI.elms.sldr_pan:ondoubleclick()
GUI.Slider.ondoubleclick(self)
update_pan()
end
------------------------------------
-------- Main loop -----------------
------------------------------------
-- This will be run on every update loop of the GUI script; anything you would put
-- inside a reaper.defer() loop should go here. (The function name doesn't matter)
local function Main()
-- Check the track state and toggle our warning label as needed
tr = reaper.GetSelectedTrack( 0, 0 )
if tr then
-- Save a bit of CPU by only doing this if we need to
if GUI.elms.lbl_track.z == 1 then
-- These both accomplish the same thing...
-- lbl_track is moved to a different layer, which we've permanently
-- hidden above. Use this if you have several elements on a single
-- layer and only want to hide one of them. e.g. adjusting which
-- options are available depending on other things the user does.
GUI.elms.lbl_track.z = 5
-- frm_track's entire layer is hidden. This is what the Tabs element
-- uses.
GUI.elms_hide[GUI.elms.frm_track.z] = true
-- Layers can also be frozen; they'll be drawn, but won't receive
-- any user input. Use this for i.e. having a slider display an
-- RMS value, since the user can't do anything with it.
-- Completely unnecessary here, because frm_track is on top and will
-- "steal" any user input.
GUI.elms_freeze[GUI.elms.sldr_pan.z] = false
-- Force a redraw of every layer
GUI.redraw_z[0] = true
end
-- See if the track's Pan value has been changed and update the slider
local pan = reaper.GetMediaTrackInfo_Value( tr, "D_PAN" )
if math.abs( pan - (GUI.Val("sldr_pan") / 100) ) > 0.00 then
-- Converting the returned value (-1 to 1) to Slider steps (0 to 200)
pan = (math.floor(100*pan) - GUI.elms.sldr_pan.min )
GUI.Val("sldr_pan", pan )
end
-- If we don't have a track, hide the track elements
-- and pop up a warning
else
if GUI.elms.lbl_track.z == 5 then
GUI.elms.lbl_track.z = 1
GUI.elms_hide[GUI.elms.frm_track.z] = false
GUI.elms_freeze[GUI.elms.sldr_pan.z] = true
GUI.redraw_z[0] = true
end
end
end
GUI.Init()
-- Tell the GUI library to run Main on each update loop
-- Individual elements are updated first, then GUI.func is run, then the GUI is redrawn
GUI.func = Main
-- How often (in seconds) to run GUI.func. 0 = every loop.
GUI.freq = 0
GUI.Main()
|
|
|
09-01-2018, 11:36 PM
|
#111
|
Human being with feelings
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 3,913
|
Quote:
Originally Posted by woodslanding
Took the same example Main,Z, and Methods, and changed frame color to red. fill is unchanged at true. still no change in the display.
|
FWIW, I just installed the GUI libs and script you posted into a portable install of v5.941 on Win7 , and this is what I see,
Best of luck, I hope I can code in lua like this someday!
|
|
|
09-02-2018, 07:09 AM
|
#112
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
Works here too.
|
|
|
09-02-2018, 09:49 AM
|
#113
|
Human being with feelings
Join Date: Mar 2013
Posts: 5,844
|
Seems to work here too.
Quote:
Originally Posted by woodslanding
Downloaded Reapack. Installed V2.
|
Just in case (to rule out that the path might still be pointing to an older version): what GUI version number is shown at the bottom right of the example window?
|
|
|
09-02-2018, 03:16 PM
|
#114
|
Human being with feelings
Join Date: Mar 2007
Location: Denver, CO
Posts: 633
|
2.15.10
Maybe I will try a fresh install...
|
|
|
09-02-2018, 03:29 PM
|
#115
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
Just to make sure - in that particular example script, the frame is only displayed if you have no track selected. If there's a selected track you won't see it at all.
|
|
|
09-02-2018, 03:39 PM
|
#116
|
Human being with feelings
Join Date: Mar 2007
Location: Denver, CO
Posts: 633
|
Very Well then.... Starting fresh. Most strange. My reaper was up to date, and the computer is only 7 months old.
Onward!
|
|
|
09-02-2018, 03:40 PM
|
#117
|
Human being with feelings
Join Date: Mar 2007
Location: Denver, CO
Posts: 633
|
Oh missed that.... I'll bet that's the deal. All that installing for nothing.
EDIT: yup!
|
|
|
09-02-2018, 04:07 PM
|
#118
|
Human being with feelings
Join Date: Mar 2007
Location: Denver, CO
Posts: 633
|
okay, now that I'm over that hurdle, I'd like to actually change it to the track color. I've tried this, in the main method:
Code:
local trackColor = reaper.GetTrackColor(tr)
GUI.Msg("color"..trackColor)
--GUI.elms.frm_track.color = "red"
--GUI.color("frm_track", "red")
-- If we don't have a track, hide the track elements
-- and pop up a warning
The first commented line doesn't work, the second crashes the script. What syntax should I be using here?
I am getting track colors okay, looks like.
Reading further, looks like I need a table of values. But not sure what the reaper method is giving me. It's not showing up as hex in the console....
Last edited by woodslanding; 09-02-2018 at 04:14 PM.
|
|
|
09-02-2018, 06:35 PM
|
#119
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
You have to specifically request a redraw for the element's z layer:
Code:
GUI.elms.frm_track.color = "red"
GUI.elms.frm_track:redraw()
GUI.Val is only for getting and setting the element's value - the frame's text, in this case. It does automatically prompt a redraw though.
As for the color, the format you need to give it is:
Any colors that are set before the GUI starts ( GUI.Init) are given as 0-255, and any colors being set while the GUI is running use 0-1... when I first wrote everything, it made more sense to me that way. I apologize. :P
reaper.GetTrackColor returns an OS-dependent value because reasons, but you should be able to dump it straight into:
Code:
r, g, b = reaper.ColorFromNative( col )
I forget if that function corrects for it or not, but be aware that Linux (and Mac I think?) seem to store the colors as BBGGRR. For example, when I copied all of my Windows settings over to Linux I had to manually fix the colors in my SWS Auto-Color window because they were wrong.
|
|
|
09-03-2018, 07:42 AM
|
#120
|
Human being with feelings
Join Date: Jan 2010
Location: Fjugesta, Sweden
Posts: 811
|
Window placement win vs linux
Hi!
Is testing my script on windows again after some
coding on linux and find that the placement of
window is not the same. On linux I placed it
in middle and 300px down, but on windows the
window is placed up in the left corner. Changed
x and y code on win machine with notepad++ but
no change...
The script(beta) is public on Bitbucket, feel free to check it out:
https://bitbucket.org/TompaD/tompad_...st/src/master/
The things to do is word wrap in editor-box, and try to understand
how to release it in ReaPack.
|
|
|
Thread Tools |
|
Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -7. The time now is 01:59 AM.
|