LookAndFeel()

Home Forums General Programming LookAndFeel()

Viewing 20 posts - 1 through 20 (of 49 total)
  • Author
    Posts
  • #29358
    zeoka
    Participant
      • Topics: 73
      • Replies: 466
      • Total: 539
      • ★★★

      Hello
      I try to get variables colors
      I see the juce class and then do that :

      --
      -- Called when a component needs repainting
      -- @comp
      -- @g    http://ctrlr.org/api/class_ctrlr_lua_graphics.html
      --              see also http://www.rawmaterialsoftware.com/juce/api/classGraphics.html
      --
      panelpainting = function(comp,g)
      paintval = comp:getOwner():getValue() + 1 
      lkf = LookAndFeel()
      lkf:setColour(1,Colour(0xFFFF423E))
      lkf:setColour(2,Colour(0xFFFF7442))
      lkf:setColour(3,Colour(0xFFFC9824))
      lkf:setColour(4,Colour(0xFFFFDD1A))
      lkf:setColour(5,Colour(0xFFFFFF19))
      lkf:setColour(6,Colour(0xFFA3FF18))
      lkf:setColour(7,Colour(0xFF53FF53))
      lkf:setColour(8,Colour(0xFF19EAA3))
      lkf:setColour(9,Colour(0xFF19EAEB))
      lkf:setColour(10,Colour(0xFF18CEFF))
      lkf:setColour(11,Colour(0xFF4D94FF))
      lkf:setColour(12,Colour(0xFF8472FF))
      lkf:setColour(13,Colour(0xFFB66EFF))
      lkf:setColour(14,Colour(0xFFDF5FFF))
      lkf:setColour(15,Colour(0xFFFF53F0))
      lkf:setColour(16,Colour(0xFFFF4880))
      T8 = {0,32,64,96,128,160,192,224,256,288,320,352,384,416,448,480}
        for plte = 1,16,1 do
            if paintval == plte then
               g:setColour(Coulour(g:findColour(paintval)))
               g:fillRect(T8[paintval] + 8,6,16,16) 
          else
               g:setColour(Coulour(g:findColour(paintval)))
               g:setOpacity(0.4)
               g:fillRect(T8[paintval] + 8,6,16,16) 
           end
       end
      end

      If you’re looking up a colour for use in drawing a component, it’s usually best not to call this directly, but to use the Component::findColour() method instead. That will first check whether a suitable colour has been registered directly with the component, and will fall-back on calling the component’s LookAndFeel’s findColour() method if none is found.

      tried…. . tried various syntaxes and I can’t get a variable color identifier

      #29359
      atom
      Keymaster
        • Topics: 159
        • Replies: 2945
        • Total: 3104
        • ★★★★★

        LookAndFeel is something i’m wroking on right now (it’s done but i’m working on the example demo panel). You need to apply the LookAndFeel to a component for it to work, and just creating a LookAndFeel object won’t really do anything.

        A DEMO panel for LookAndFeel is in the works (you can check it out in the repo), once it’s done i’ll let you know.

        #29379
        zeoka
        Participant
          • Topics: 73
          • Replies: 466
          • Total: 539
          • ★★★

          Ok Thank you Atom
          Repo not found , I don’t remember where , searched in the github
          I will try like you said and look for the demo panel

          All the best

          #29381
          atom
          Keymaster
            • Topics: 159
            • Replies: 2945
            • Total: 3104
            • ★★★★★
            #29382
            zeoka
            Participant
              • Topics: 73
              • Replies: 466
              • Total: 539
              • ★★★

              It looks like you add cool properties 🙂 on Components but I don’t see the basic commands I would like.

              comp:setColour(1,Colour(0xFFFF423E) ?
              comp:findColour(x) returns 0xFFFF423E or Colour(0xFFFF423E) ?
              I just would define colours when any mods are created and call them in various scripts
              Before I tried to do a table ex
              CLR = {}
              CLR[1] = Colour(0xFFFF423E)
              and g:setColour(CLR[clrs] )
              or
              CLR = {}
              CLR[1] = 0xFFFF423E
              g:setColour(Colour(CLR[clrs]))

              #29820
              dasfaker
              Keymaster
                • Topics: 80
                • Replies: 793
                • Total: 873
                • ★★★

                I’m testing the LookAndFeel new possibilities and they are great!! Thanks Atom.

                I just messed with the rotary following the M-Brain 11 panel, and apart from the amount of Ctrlr crashes I’m having, it works fine.

                Will be possible to have knobs with different LookAndFeel in the same panel?

                I suppose other UI elements (combos, buttons…) can be customized in the same way the slider. Where can we find the variables related to each element (p.rotaryStartAngle, p.sliderPosProportional…)?

                #29821
                atom
                Keymaster
                  • Topics: 159
                  • Replies: 2945
                  • Total: 3104
                  • ★★★★★

                  It will be all documented when creating a LookAndFeel class from a template (evey parameter will be described what type it has so you’ll know what and how you can use in each method).

                  I need to actually add all the methods for all other UI elements (again it’s a lot of typing because the old way caused crashes).

                  Yes you’ll be able to have multiple LookAndFeel objects applied to any number of components.

                  #29837
                  zeoka
                  Participant
                    • Topics: 73
                    • Replies: 466
                    • Total: 539
                    • ★★★

                    Nice 🙂

                    #29842
                    dasfaker
                    Keymaster
                      • Topics: 80
                      • Replies: 793
                      • Total: 873
                      • ★★★

                      Really nice indeed.

                      For some reason, sliders placed in layers still have the standard Juce knob.

                      #34090
                      dasfaker
                      Keymaster
                        • Topics: 80
                        • Replies: 793
                        • Total: 873
                        • ★★★

                        Really nice indeed.

                        For some reason, sliders placed in layers still have the standard Juce knob.

                        BUMP

                        #34342
                        dasfaker
                        Keymaster
                          • Topics: 80
                          • Replies: 793
                          • Total: 873
                          • ★★★

                          My bad, it’s not sliders placed in layers, what is wrong is when you place a slider in a uiTab, it is when the default Juce knob appears.

                          #34349
                          zeoka
                          Participant
                            • Topics: 73
                            • Replies: 466
                            • Total: 539
                            • ★★★

                            May be a component of the slider is a child when it is in a group,tab or layer and the script doesn’t work

                            I notice one thing ( I use it as a feature in a panel )

                            open a custom comp with knob paint method but using a slider value
                            place it in a layer
                            place the slider on another layer (on top) and superpose it
                            move the knob
                            Magic : the custom comp is repaint
                            it is another interference

                            #34374
                            dasfaker
                            Keymaster
                              • Topics: 80
                              • Replies: 793
                              • Total: 873
                              • ★★★

                              May be a component of the slider is a child when it is in a group,tab or layer and the script doesn’t work

                              Then I would like to have some example, as all I’m trying give me crashes. This is the command we have to change look&feel:
                              setLookAndFeel (panel:getCanvas(), CustomLookAndFeel()).

                              To get to sliders inside a tab I’ve tried:

                              setLookAndFeel (panel:getModulatorByName("My Tab"):getComponent(), CustomLookAndFeel()) -- nothing happens.
                              
                              setLookAndFeel (panel:getModulatorByName("My Tab"):getComponent():getChildComponent(0), CustomLookAndFeel()) -- this change tab L&F
                              
                              setLookAndFeel (panel:getModulatorByName("My Tab"):getComponent():getChildComponent(2), CustomLookAndFeel()) -- this component is a slider, it changes it's L&F, but as soon I enter the slider Ctrlr crashes. 

                              So the L&F code works fine in sliders placed in the panel canvas, but crash when it’s used inside a tab following the approach above.

                              I notice one thing ( I use it as a feature in a panel )

                              open a custom comp with knob paint method but using a slider value
                              place it in a layer
                              place the slider on another layer (on top) and superpose it
                              move the knob
                              Magic : the custom comp is repaint
                              it is another interference

                              I think this is the correct behaviour. Every component that gets repainted must call a repaint to all objects behind.

                              #34379
                              zeoka
                              Participant
                                • Topics: 73
                                • Replies: 466
                                • Total: 539
                                • ★★★

                                may be if you use global
                                setLookAndFeel (panel:getCanvas(), CustomLookAndFeel()).

                                AND local

                                setLookAndFeel (panel:getModulatorByName(“My Tab”):getComponent():getChildComponent(2), CustomLookAndFeel())

                                could create a c stack overflow

                                if you start to specify for one mod then the method applied to canvas must be removed
                                for this mod or you had to specify for all mods ??

                                ex mods in group1 ,mods in layer1 , mods in tab1 etc…

                                #34382
                                dasfaker
                                Keymaster
                                  • Topics: 80
                                  • Replies: 793
                                  • Total: 873
                                  • ★★★

                                  No, I tried each option individually, even modulator by modulator. I’m seing some assertion failure related to drawing the slider, I’ll try to resolve them and see if it’s related.

                                  Atom, I’ve seen another assertion failure related to a memory leak just before crashing Ctrlr (entering edit mode).

                                  Assertion failure in memory/juce_LeakedObjectDetector.h:95

                                   class LeakCounter
                                  {
                                  public:
                                  LeakCounter() noexcept {}
                                  ~LeakCounter()
                                  {
                                  if (numObjects.value > 0)
                                  {
                                  DBG ("*** Leaked objects detected: " << numObjects.value << " instance(s) of class " << getLeakedObjectClassName());
                                  /** If you hit this, then you've leaked one or more objects of the type specified by
                                  the 'OwnerClass' template parameter - the name should have been printed by the line above.
                                  If you're leaking, it's probably because you're using old-fashioned, non-RAII techniques for
                                  your object management. Tut, tut. Always, always use ScopedPointers, OwnedArrays,
                                  ReferenceCountedObjects, etc, and avoid the 'delete' operator at all costs!
                                  */
                                  jassertfalse;
                                  #34427
                                  atom
                                  Keymaster
                                    • Topics: 159
                                    • Replies: 2945
                                    • Total: 3104
                                    • ★★★★★

                                    Well if something crashes in Ctrlr, the cleanup is not done well and there might a lot of objects not properly freed from the memory, so you’ll get a lot of those.

                                    I need to re-check the look and feel stuff after some changes i’ve made, i’ll get to that tomorrow and report back.

                                    #36529
                                    dasfaker
                                    Keymaster
                                      • Topics: 80
                                      • Replies: 793
                                      • Total: 873
                                      • ★★★

                                      I need to re-check the look and feel stuff after some changes i’ve made, i’ll get to that tomorrow and report back.

                                      Bump

                                      #36532
                                      atom
                                      Keymaster
                                        • Topics: 159
                                        • Replies: 2945
                                        • Total: 3104
                                        • ★★★★★

                                        Shit i missed that, sorry about this. I had to move house, and my life got a bit messy lately so i’m not really focused. Keep reminding me i’ll get to that asap, i don’t know when that will be that’s all i can say.

                                        #36759
                                        atom
                                        Keymaster
                                          • Topics: 159
                                          • Replies: 2945
                                          • Total: 3104
                                          • ★★★★★

                                          I was looking into this a little. I found a compiler switch that will make ctrlr not-crash on runtime errors (at least on linux, i might have to upgrade VS2010 to get this working)

                                          and i know why the l&f does noy apply to components in tabs, it’s because tabs use it’s own look and feel, i need to add some logic to l&f switching for components that have their own l&f (a lot of them do). Otherwise it’s a mess.

                                          #36785
                                          dasfaker
                                          Keymaster
                                            • Topics: 80
                                            • Replies: 793
                                            • Total: 873
                                            • ★★★

                                            Cool you found it.

                                          Viewing 20 posts - 1 through 20 (of 49 total)
                                          • The forum ‘Programming’ is closed to new topics and replies.
                                          There is currently 0 users and 61 guests online
                                          No users are currently active
                                          Forum Statistics
                                          Threads: 2,495, Posts: 17,374, Members: 77,605
                                          Most users ever online was 12 on January 22, 2019 3:47 pm
                                          Ctrlr