|
|
|
08-13-2018, 01:36 PM
|
#281
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
Quote:
Originally Posted by cfillion
Ah right, for some reason gfx.getfont() always returns an empty string on Linux (bug?)
|
I can't imagine it's intentional.
|
|
|
08-13-2018, 01:41 PM
|
#282
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
What I'm gathering from this is that I should probably throw Linux on a USB drive just for scripting.
|
|
|
08-13-2018, 02:52 PM
|
#283
|
Pixel Pusher
Join Date: Mar 2007
Location: Blighty
Posts: 4,951
|
As of v5.94pre6, Reaper for Linux bundles the liberation fonts.
|
|
|
08-14-2018, 04:13 AM
|
#284
|
Human being with feelings
Join Date: Jan 2010
Location: Fjugesta, Sweden
Posts: 811
|
I am maybe out and bicycling now but I looked in Reaper.ini and found this:
Code:
t_font_fallback=// Cantarell FreeSans DejaVuSans NotoSans LiberationSans Oxygen Arial Verdana
ft_font_fallback_fixedwidth=// FreeMono DejaVuSansMono NotoMono OxygenMono LiberationMono Courier
Is this something I can change to make it work?
|
|
|
08-14-2018, 09:13 AM
|
#285
|
Human being with feelings
Join Date: Mar 2013
Posts: 5,844
|
@Lokasenna
I just did a quick check on Linux and changing these lines in your Core.lua seem to help:
Code:
Linux = {
sans = "Arial",
mono = "DejaVuSansMono" <-- without the spaces
Or in case of using the Liberation fonts White Tie mentioned:
Code:
Linux = {
sans = "LiberationSans",
mono = "LiberationMono"
}
Quote:
Originally Posted by Lokasenna
What I'm gathering from this is that I should probably throw Linux on a USB drive just for scripting.
|
In case you don't already know it, another option is to make a Linux install on a virtual machine using something like VirtualBox.
That's what I'm currently using here to test the Linux version
Last edited by solger; 08-14-2018 at 09:19 AM.
|
|
|
08-14-2018, 11:44 AM
|
#286
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
Alright, I'm dual-booting with Ubuntu Studio now. Just have to sort out some crap with my trackball and my laptop's function keys and then I can investigate.
|
|
|
08-14-2018, 12:42 PM
|
#287
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
Fix confirmed, updating.
|
|
|
08-14-2018, 01:22 PM
|
#288
|
Human being with feelings
Join Date: Mar 2013
Posts: 5,844
|
Quote:
Originally Posted by Lokasenna
Fix confirmed, updating.
|
Nice!
|
|
|
08-14-2018, 10:08 PM
|
#289
|
Human being with feelings
Join Date: Jan 2010
Location: Fjugesta, Sweden
Posts: 811
|
Quote:
Originally Posted by Lokasenna
Fix confirmed, updating.
|
Yeah, nice!
|
|
|
08-18-2018, 12:43 PM
|
#290
|
Human being with feelings
Join Date: May 2015
Location: Québec, Canada
Posts: 4,937
|
v5.95pre7 supports font families and gfx.getfont's second return value on Linux!
sans-serif/serif/monospace/cursive now resolves to the user's preferred font of that type.
(It doesn't always match what was given to gfx.setfont. The system's FontConfig will select the closest substitute font in most cases if the requested one isn't installed. gfx.getfont returns which font is actually being used.)
Last edited by cfillion; 08-18-2018 at 02:42 PM.
|
|
|
08-18-2018, 02:30 PM
|
#291
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
Quote:
Originally Posted by cfillion
v5.95pre7 supports font families and gfx.getfont's second return value on Linux!
(It doesn't always match what was given to gfx.setfont. The system's FontConfig will select the closest substitute font in most cases if the requested one isn't installed. gfx.getfont returns which font is actually being used.)
|
Awesome. AFAIK pretty much any Linux distro should have DejaVu on hand, so I won't worry too much unless I hear about people having trouble.
|
|
|
08-22-2018, 07:54 AM
|
#292
|
Human being with feelings
Join Date: Jan 2010
Location: Fjugesta, Sweden
Posts: 811
|
Selecting item in listbox
Hi again! ;-)
Have I misunderstod the following:
GUI.Val("listbox_tasks",3) - should select the third item in list??
I am creating a new item in listbox and want the created item
to be selected when returning to the listbox.
|
|
|
08-22-2018, 08:16 AM
|
#293
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
It wants to see a table of booleans:
Code:
GUI.Val("listbox_tasks", {[3] = true})
Pushing an update to have it take a single number as well.
Last edited by Lokasenna; 08-22-2018 at 08:35 AM.
|
|
|
08-22-2018, 09:14 AM
|
#294
|
Human being with feelings
Join Date: Jan 2010
Location: Fjugesta, Sweden
Posts: 811
|
Quote:
Originally Posted by Lokasenna
It wants to see a table of booleans:
Code:
GUI.Val("listbox_tasks", {[3] = true})
Pushing an update to have it take a single number as well.
|
Ahaaa! Ok now I understand what is written in the documentation.
Needed to see an example in code....Thanks again!
|
|
|
08-22-2018, 02:01 PM
|
#295
|
Human being with feelings
Join Date: Jan 2010
Location: Fjugesta, Sweden
Posts: 811
|
Word wrap in texteditor
Ok, I am very close to release my first real reascript (not built with actions).
I read in documentation that word wrap is not implemented in TextEditor. :-(
Is there another way to get multiline text from users input?
|
|
|
08-22-2018, 02:36 PM
|
#296
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
You could convert the user's input to fit in the window, adding "\n" characters any time the string gets wider than the TextBox (self.wnd_w is the number of characters it fits, I think?). If you need to save/export/copy the text elsewhere, though, you'd need some way of tracking where those extra lines were so you could remove them.
I'd love to have word wrap, I just haven't found an algorithm for tracking where the real line breaks are versus the wrapped ones, etc.
|
|
|
08-27-2018, 07:19 AM
|
#297
|
Human being with feelings
Join Date: Jan 2010
Location: Fjugesta, Sweden
Posts: 811
|
Quote:
Originally Posted by Lokasenna
You could convert the user's input to fit in the window, adding "\n" characters any time the string gets wider than the TextBox (self.wnd_w is the number of characters it fits, I think?). If you need to save/export/copy the text elsewhere, though, you'd need some way of tracking where those extra lines were so you could remove them.
I'd love to have word wrap, I just haven't found an algorithm for tracking where the real line breaks are versus the wrapped ones, etc.
|
I take a look on it. :-)
|
|
|
08-27-2018, 07:27 AM
|
#298
|
Human being with feelings
Join Date: Jan 2010
Location: Fjugesta, Sweden
Posts: 811
|
Hola!
I moved my reascript I've been working on on Linux
to my main DAW on windows10 and got some things not
happening. The messageBox dont show up and the else
is running (inspite of some empty text fields).
Script run well on Linux.
Code:
function GUI.elms.btn_save_new:onmouseup()
GUI.Button.onmouseup(self)
Msg("ShowMessageBox")
if (GUI.Val("txtbox_caption_tasks") == "") or (GUI.Val("txt_editor_tasks") == "") then
reaper.ShowMessageBox("Fill in the blanks - you must have text in Tasks and Details", "Fill in the blanks", 0)
else
table.insert(items, { prio[1], GUI.Val("txtbox_caption_tasks"), GUI.Val("txt_editor_tasks")})
sortItems()
GUI.Val("frm_details", items[GUI.Val("lst_tasks")][3])
saveToFile()
emptyTxtFields()
shiftNewWindow()
end
end
Are there any modifications I need to do if I want to run script
on windows?
|
|
|
08-27-2018, 07:31 AM
|
#299
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
The only differences are if you access file paths or some of the io. and os. commands. The GUI shouldn't care.
Hard to say what the issue is without having the whole script to test though.
|
|
|
08-27-2018, 11:28 AM
|
#300
|
Human being with feelings
Join Date: Jan 2010
Location: Fjugesta, Sweden
Posts: 811
|
Quote:
Originally Posted by Lokasenna
The only differences are if you access file paths or some of the io. and os. commands. The GUI shouldn't care.
Hard to say what the issue is without having the whole script to test though.
|
Can I PM it to you?
|
|
|
08-27-2018, 12:07 PM
|
#301
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
Yup, anytime.
|
|
|
09-06-2018, 07:44 PM
|
#302
|
Human being with feelings
Join Date: Mar 2007
Location: Denver, CO
Posts: 633
|
Question about toggle buttons
What is the recommended way to create a toggle button? There doesn't seem to be a built-in option for it.
I guess you could use a single check box?
Alternatively, I could see modifying the mouseDn and mouseUp methods.... but I'd wonder about saving state.
Indeed that makes me wonder. I'd be using toggle buttons to control a lot of switchable on-off parameters of various vsts and jsfxs, and I'm wondering how best to synchronize these states, so when f.i. loading a new preset to a vst, the settings of gui controls would update. I haven't noticed an example of setting the state of a control externally.....
Edit: thinking about this, I guess it's just a matter of calling the GUI:Val function? And state is actually saved by Reaper itself, and you can request a parameter value when the gui opens....
|
|
|
09-06-2018, 08:16 PM
|
#303
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
A single checkbox, yeah. caption = "" and frame = false are probably your friends in that case.
As far as synchronizing the values, as long as you know what you're trying to sync with you can have a function that polls the current VST to see if the parameters have changed, and then if they have repopulate your script's values.
Code:
local function pollVST()
-- Do whatever you want here
end
GUI.func = pollVST
GUI.freq = 0 -- Interval to call pollVST, 0 = every loop
GUI.Init()
GUI.Main()
Going the other way is much easier - you can append your own code to the elements' event methods to have changes in the script automatically sent over to the VST.
Code:
function GUI.elms.my_checklist:onmouseup()
-- Make sure the original code is called, note the . and "self" here
GUI.Checklist.onmouseup(self)
updateMyVSTState()
end
Be aware of which methods each class uses though, since some use onmousedown, some also have onwheel, etc.
|
|
|
09-06-2018, 08:17 PM
|
#304
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
You can use Reaper's ExtStates for saving data between script instances, or you can write to a text file yourself as long as the script isn't running in Restricted Permissions mode (it disables all os and io functions).
|
|
|
09-06-2018, 08:37 PM
|
#305
|
Human being with feelings
Join Date: Mar 2007
Location: Denver, CO
Posts: 633
|
okay, I can certainly do that. But it seems like if everything in my script is referencing the state of reaper or the settings of the parameters of some plugin or other, I should be able to restore state of all the elements in the gui by querying Reaper, and those values should be storable and recallable by SWS snapshots..... correct?
|
|
|
09-06-2018, 09:14 PM
|
#306
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
I would think so, yeah.
|
|
|
09-19-2018, 03:45 PM
|
#307
|
Human being with feelings
Join Date: Sep 2014
Posts: 2,643
|
GUI Builder Import/Paste Code
With the GUI Builder if you could import or paste a section of code would help.
This way I could rearrange existing buttons or other elements easily.
|
|
|
09-20-2018, 05:52 PM
|
#308
|
Human being with feelings
Join Date: Sep 2014
Posts: 2,643
|
Have a look at AHK, SmartGUI you can import scripts into that and
AutoGUI you can clone other GUI's.
|
|
|
09-26-2018, 02:35 PM
|
#309
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
Better import/export options are on my list, along with being able to read/write the GUI code for an existing script.
Unfortunately, some organizational choices I made for GUI Builder have created a few bugs that are really painful to fix and work around, so the smart thing to do would be a complete rewrite.
Unfortunately unfortunately, I'm prepping for a course and don't have much time to spare. Hoping to fix a couple of instant-crash bugs I've found, if nothing else.
|
|
|
10-03-2018, 05:21 AM
|
#310
|
Human being with feelings
Join Date: Sep 2014
Posts: 2,643
|
I'm trying to get the button Toggle state color to show, the initial button text color and color fill works, the text and text color will change for the New button but not the color fill. It seems to use the default color fill dark gray.
It's very late here so might just be a brain freeze.
Code:
function btn_click_show_chords_in_items()
reaper.Main_OnCommand(40691, 0) -- View: Toggle show media cues in items
update_show_chords_in_items()
end
function update_show_chords_in_items()
--Delete old buttons before updating
if reaper.GetToggleCommandState(40691) == 1 then onstate = "red"
else
onstate = "gray"
end
GUI.elms.show_chords_in_items_btn:ondelete()
GUI.New("show_chords_in_items_btn", "Button", 3, 275+x1, 180+y1, 135, 20, "New Chords in Items "..onstate, btn_click_show_chords_in_items)
GUI.elms.show_chords_in_items_btn.col_txt = "yellow"
GUI.elms.show_chords_in_items_btn.col_fill = onstate
end
if reaper.GetToggleCommandState(40691) == 1 then onstate = "red"
else
onstate = "gray"
end
GUI.New("show_chords_in_items_btn", "Button", 3, 275+x1, 180+y1, 135, 20, "Initial Chords in Items", btn_click_show_chords_in_items)
GUI.elms.show_chords_in_items_btn.col_txt = "yellow"
GUI.elms.show_chords_in_items_btn.col_fill = onstate
|
|
|
10-03-2018, 05:45 AM
|
#311
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
Try adding:
Code:
GUI.elms.show_chords_in_items_btn:init()
afterward. The button itself is drawn to a buffer when it's created, so changing the color will need that buffer to be redrawn.
|
|
|
10-03-2018, 10:55 AM
|
#312
|
Human being with feelings
Join Date: Sep 2014
Posts: 2,643
|
Love it ! perfect !
|
|
|
10-17-2018, 10:28 AM
|
#313
|
Human being with feelings
Join Date: Apr 2011
Posts: 3,451
|
Is there a way to automatically incorporate the GUI code into my script, without having to require it externally? The main reason is, I would like to make the Radio to update in realtime, so changes are instant, and to be able to color the background of each text line a different color.
Is it possible?
Thanks!
|
|
|
10-17-2018, 01:45 PM
|
#314
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
You could copy/paste all the necessary modules into it, but then you'd never see any updates/fixes I put up.
If you just require them as normal you can rewrite or extend any of the GUI or element functions that want - I do it all the time. There are also a number of empty methods ready to go for your own code, such as onupdate.
|
|
|
10-18-2018, 05:59 PM
|
#315
|
Human being with feelings
Join Date: Apr 2011
Posts: 3,451
|
Thanks!
How can I "rewrite or extend any of the GUI or element functions that want"? I mean, is it possible to change them in my script? Or change the external libraries? Because in this case, my changes will get overwritten in the next update. Could I use onupdate somehow to make the Radio update in realtime?
|
|
|
10-18-2018, 06:35 PM
|
#316
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
No need to worry about breaking the user's install or having your code disappear - Lua is happy to let you rewrite things at runtime, so whatever your script does with the GUI stays in your script.
Well, unless you were rude enough to actually open the files and write to them...
You can overwrite any or all of the GUI functions in your script by just declaring that function again. All of the methods listed in the project documentation are already present, but most of them are empty. Using onupdate, for example, is as simple as just writing your own code for it:
Code:
-- Radio class has already been loaded
function GUI.Radio.onupdate()
-- Any code here will be called on every
-- GUI loop as long as the element isn't
-- on a frozen or hidden Z layer
end
Just have a look in the class file first to see if it's making use of a particular method. Off the top of my head I don't think any of them use onupdate, but let's pretend that Radio does - you probably don't want to break whatever it's doing, so it's important to grab the original method first and include a call to it:
Code:
local RadioUpdate = GUI.Radio.onupdate
function GUI.Radio:onupdate()
-- your code here
RadioUpdate(self)
-- or your code here
end
This is particularly important to remember if you're messing with things like onmouseup that pretty much every class uses.
You can also do this at the level of individual elements if you, for example, only want one particular Radio element to do something special:
Code:
function GUI.elms.my_radio:onmouseup()
-- Note the . and self here
GUI.Radio.onmouseup(self)
doMyStuff()
end
Depending on what you're doing, sometimes it might be easier to add your code to the element directly so it can easily access of the element's properties using self:
Code:
function GUI.elms.my_radio:doMyStuff()
Msg(self.name .. " has the value: " .. self:val() )
end
function GUI.elms.my_radio:onmouseup()
self:doMyStuff()
end
|
|
|
10-18-2018, 06:38 PM
|
#317
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
Just a reminder, though - it's always good to make sure that Radio NEEDS to update before actually doing it, so you aren't hogging the CPU.
|
|
|
10-18-2018, 08:03 PM
|
#318
|
Human being with feelings
Join Date: Apr 2011
Posts: 3,451
|
Thank you so much for the tutorial!!
|
|
|
11-04-2018, 05:14 PM
|
#320
|
Human being with feelings
Join Date: Apr 2016
Posts: 39
|
Hey guys, hoping someone can help me with this. I'm doing some simple scaling on a listbox element. Looks like the bg rect is not receiving the width or height updates. Text and scrollbar update as they should. Figured i'd ask if anyone had this problem or know a solution before diving into the class!
Here's the scaling code i'm running:
Code:
function OnResize()
GUI.elms.Listbox1.w = gfx.w - 20
GUI.elms.Listbox1.h = gfx.h - 20
GUI.elms.Listbox1:redraw() --same behavior without this line
GUI.elms.Listbox1:wnd_recalc()
end
...
...
GUI.onresize = OnResize
Hoping Lokasenna or someone else can save me <3
|
|
|
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 07:47 AM.
|