Cabbage Logo
Back to Cabbage Site

Texteditor cursor colour

Hey Rory, just a little one:
Is it possible to change the colour of the cursor in the Texteditor widget? When I change the font colour the cursor always seems to stay in the default black colour. The whole theme of my plugin is more or less based on a dark background with bright fonts so then the cursor is barely visible.

[edit]: Also, would it be possible to have the widget entering text edit only on double click?

Sure, I think that’s possible.

I’ll take a look.

Just pushed to git. Should be available shortly in Azure. I’ve added the following new identifiers, readOnly(0/1)
caretColour(col)
doubleClickTogglesEdit(0/1)

I couldn’t think of a more succinct name for that last identifer :roll_eyes:, but I guess it does describe its purpose quite well! Here’s an example:

<Cabbage>
form size(500, 300), caption("Untitled"), guiMode("queue")
texteditor bounds(0, 0, 500, 300), file("test.txt"), wrap(1), readOnly(1), doubleClickTogglesEdit(1), caretColour("blue")
</Cabbage>

Supercool! :+1::muscle:

Hi Rory,
Unfortunately, er…, something’s really wrong now. I get this message when I compile the instrument:


My Instrument still loads, but all the sliders are missing their filmstrips.
When I do the “camelCase” conversion the instrument doesn’t even load anymore. The only thing that appears in the GUI is the cSound Output.

Is this supposed to happen because you made some major changes? Seems like I’d have to review a lot of things.

Can you PM me the csd file?

[Edit] it’s most likely an identifier that I missed…

[Edit] I think widgetArray() got mangled in some recent updates. I’ll looking into it now. It could be the root of your current issue. Hang tight…

The widget array issue is fixed now. I just pushed to git, should be in Azure in a half hour or so. Let me know if this fixes the issue. Sorry about that!

I actually just had to change identifiers in the Cabbage section manually for the new camelCase . I was on 2.5.18. that didn’t have the camelCase syntax yet. The automatic function changed a lot of words randomly.

The auto-concert function should only change known identifiers, if it changed random words something went seriously wrong :grimacing: Either way, there was an issue with widgetArray(), which has been fixed now.

Thanks for the hint. actually using widget arrays.

Are or are not using widget arrays?

Using them in one case, but not on texteditor widgets.

Text edit still starts on single click with doubleClickTogglesEdit(1)

Set readonly(1) to disable editing on startup.

Is this resolved now?

I see thanks for explaining.

The filmstrips and a whole lot of other stuff wasn’t loading because I needed to switch to camelCase. All good now, just used the replace function.

1 Like

I’m using a soundfiler widget array to switch waveform views rapidly. Loading different files into one was clearly to slow.

That widget array is not showing up anymore.
[edit] Looks like the visible Identifier is not working on it anymore from within the Orchestra.

I’m doing it once immediately from on opcode and then again from an dedicated instrument with a bit of a delay time, to make sure that it happens. It work quite reliably.

Can you PM me the file, or post it here?

I’m guessing you’re not meaning the 1500+ lines of code. Let’s see…

This is where I toggle the visibility of the soundfilers:

opcode SwitchWaveform,0,kk ; Making Soundfiler @ Slot visible / old Slot invisible
kSlot, kOld xin
String sprintfk “visible(%d)”,1
Soundfiler sprintfk “waveform_ident%d”, kSlot
chnset String, Soundfiler

String              sprintfk "visible(%d)",0
Soundfiler          sprintfk "waveform_ident%d", kOld
chnset              String, Soundfiler

event               "i", "SwitchWaveSecure", 0.1, 0.1, kSlot, kOld

endop

instr SwitchWaveSecure

String              sprintfk "visible(%d)",0
Soundfiler          sprintfk "waveform_ident%d", p5
chnset              String, Soundfiler

String              sprintfk "visible(%d)",1
Soundfiler          sprintfk "waveform_ident%d", p4
chnset              String, Soundfiler

endin

Balls, is it that big? If it’s just the visible() identifier I can probably create a stripped down version that is broken?

[edit] you posted as I was posting this. Thanks, I’ll take a look…

Yeah, it’s probably not always elegant.

I have created an example with your code. Yup, something up. Give me a moment…

Actually, it works fine for me here:

<Cabbage>
form size(500, 300), caption("Untitled")

soundfiler bounds(10, 34, 300, 200), file("DutchLadyTalking.aif"), visible(0), identChannel("waveform_ident0")
soundfiler bounds(10, 34, 300, 200), file("pianoMood.wav"), identChannel("waveform_ident1")
button bounds(352, 47, 80, 40), channel("switch")
</Cabbage>

<CsoundSynthesizer>
<CsOptions>
-n -d -m0d
</CsOptions>
<CsInstruments>
nchnls = 2	
0dbfs = 1

instr SwitchWaveSecure
String              sprintfk "visible(%d)",0
Soundfiler          sprintfk "waveform_ident%d", p5
prints Soundfiler
chnset              String, Soundfiler

String              sprintfk "visible(%d)",1
Soundfiler          sprintfk "waveform_ident%d", p4
prints Soundfiler
chnset              String, Soundfiler
endin	
       
                      
instr 1
    kSwitch chnget "switch"
    if changed:k(kSwitch) == 1 then
        if kSwitch == 1 then
            event "i", "SwitchWaveSecure", 0, 0.1, 0, 1
        else
            event "i", "SwitchWaveSecure", 0, 0.1, 1, 0
        endif
    endif

endin                                                    
</CsInstruments>
<CsScore>
i1 0 z
</CsScore>
</CsoundSynthesizer>

I had accidentally set guiMode() to queue in my form. Of course it won’t work then, because identChannels are supported.