LookAndFeel()

Home Forums General Programming LookAndFeel()

Viewing 20 posts - 21 through 40 (of 49 total)
  • Author
    Posts
  • #37895
    atom
    Keymaster
      • Topics: 159
      • Replies: 2945
      • Total: 3104
      • ★★★★★

      The new Ctrlr nightly has a new and improved implementation for LookAndFeel, the JoMoX Mbrane 11 panel shows how to use that, it should be fairly complete. I tested it mostly on Linux so i don’t know how other platforms will react to the change.

      Please let me know in case of any errors.

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

        Just looking at your demo, it’s possible to have several designs for sliders, for example?

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

          Sure, as many as you can implement.

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

            But how can I assign a different l&f script to each modulator? All I see in the demo is a general call to change l&f, but all sliders use the same script, buttons the same script and so on.

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

              You apply the look and feel definition to a component, in the example it’s applied to the cancas (this is what you or someone wanted, that if you apply the LF to a group/canvas/tab all the child components get the new LF).

              But you can pick your component just apply the LF to whatever panel:getComponent() you want, you can have each slider with a different LF object.

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

                I get it, fantastic. I’ll let you know if it’s all ok.

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

                  Everything working fine, Atom, but I have two doubts:

                  In the combo example, I can’t use imported fonts.

                  getComboBoxFont = function(comboBox)
                  font1 = resources:getResourceAsFont ("blabla")
                  return Font("Courier New",18.0,1) -- works
                  return Font(font1,9,1) -- doesn't work
                  return Font("blabla",9,1) -- doesn't work
                  end}

                  The second one, I want to add the ticked mark to the item selected, and the mark must be a shape or draw, not an image. How to manage drawableIcon argument?

                  drawPopupMenuItem = function(g, area, isSeparator, isActive, isHighlighted, isTicked, hasSubMenu, text, shortcutKeyText, drawableIcon, textColourPtr)

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

                    this will work:

                    getComboBoxFont = function(comboBox)
                    	font = resources:getResourceAsFont("TR-909")
                    
                    	if font ~= nil then
                    		return font
                    	else
                    		return Font("Courier New",18.0,1)
                    	end
                    end

                    there are some methods that modify the font object in this situation, some of them look like new ones that i didn’t add yet, but i will fill this gab for now below is the list of methods that are included:

                    so something like this should also work
                    return font:italicised()

                    .def("setTypefaceName", &Font::setTypefaceName)
                    			.def("getTypefaceStyle", &Font::getTypefaceStyle)
                    			.def("withTypefaceStyle", &Font::withTypefaceStyle)
                    			.def("getHeight", &Font::getHeight)
                    			.def("withHeight", &Font::withHeight)
                    			.def("withPointHeight", &Font::withPointHeight)
                    			.def("setHeightWithoutChangingWidth", &Font::setHeightWithoutChangingWidth)
                    			.def("getDescent", &Font::getDescent)
                    			.def("withStyle", &Font::withStyle)
                    			.def("setBold", &Font::setBold)
                    			.def("isBold", &Font::isBold)
                    			.def("italicised", &Font::italicised)
                    			.def("setUnderline", &Font::setUnderline)
                    			.def("getHorizontalScale", &Font::getHorizontalScale)
                    			.def("setHorizontalScale", &Font::setHorizontalScale)
                    			.def("withExtraKerningFactor", &Font::withExtraKerningFactor)
                    			.def("setSizeAndStyle", (void (Font::*)(float, int, float, float))&Font::setSizeAndStyle)
                    			.def("setSizeAndStyle", (void (Font::*)(float, const String &, float, float))&Font::setSizeAndStyle)
                    			.def("getStringWidth", &Font::getStringWidth)
                    			.def("getGlyphPositions", &Font::getGlyphPositions)
                    			.def("toString", &Font::toString)
                    			.scope
                    			[
                    				def("getDefaultSansSerifFontName", &Font::getDefaultSansSerifFontName),
                    				def("getDefaultSerifFontName", &Font::getDefaultSerifFontName),
                    				def("getDefaultMonospacedFontName ", &Font::getDefaultMonospacedFontName),
                    				def("getDefaultStyle", &Font::getDefaultStyle),
                    				def("getDefaultTypefaceForFont", &Font::getDefaultTypefaceForFont),
                    				def("findAllTypefaceNames", &Font::findAllTypefaceNames),
                    				def("findAllTypefaceStyles", &Font::findAllTypefaceStyles),
                    				def("getFallbackFontName", &Font::getFallbackFontName),
                    				def("setFallbackFontName", &Font::setFallbackFontName),
                    				def("getFallbackFontStyle", &Font::getFallbackFontStyle),
                    				def("setFallbackFontStyle", &Font::setFallbackFontStyle),
                    				def("fromString", &Font::fromString)
                    			]
                    			.enum_("FontStyleFlags")
                    			[
                    				value("plain", 0),
                    				value("bold", 1),
                    				value("italic", 2),
                    				value("underlined", 3)
                    			]
                    #38192
                    dasfaker
                    Keymaster
                      • Topics: 80
                      • Replies: 793
                      • Total: 873
                      • ★★★

                      Thanks, that worked.

                      Now I’m stuck trying to draw the thumb of a horizontal slider. I get working drawLinearSlider, but the thumb doesn’t appear.


                      drawLinearSliderBackground = function (g, x, y, width, height, sliderPos, minSliderPos, maxSliderPos, SliderStyle, slider)

                      g:fillAll(colourDark)
                      end,

                      drawLinearSliderThumb = function (g, x, y, width, height, sliderPos, minSliderPos, maxSliderPos, SliderStyle, slider)
                      g:fillRectangle(x,y,width * 0.5, height * 0.5)
                      end,

                      getSliderThumbRadius = function(Slider)
                      return 5.0;
                      end,

                      createSliderButton = function(slider, isIncrement)
                      isIncrement = true
                      end}

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

                        Have a look at your logs fillRectangle does no exist fillRect exists

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

                          It must be something else, because after the correction I still don’t see anything drawn.

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

                            This should work (a white rectangle for a vertical slider, you need to do different calculations for different slider styles:

                            sliderRadius = 7
                            	kx = x + width * 0.5	
                            	ky = sliderPos
                            	outlineThickness = 2
                            
                            	g:setColour (Colour (0xffffffff))	
                            	g:drawRect (kx - sliderRadius, ky - sliderRadius, 	sliderRadius * 2.0, sliderRadius * 2.0, outlineThickness)

                            When i doubt look at the JUCE source code, that’s where all the calculation for the default LookAndFeel are done, it’s a good source of ideas: https://github.com/julianstorer/JUCE/blob/master/modules/juce_gui_basics/lookandfeel/juce_LookAndFeel_V2.cpp

                            for the new LookAndFeel you can have a look at:
                            https://github.com/julianstorer/JUCE/blob/master/modules/juce_gui_basics/lookandfeel/juce_LookAndFeel_V3.cpp

                            etc.

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

                              Thanks a lot for the links, I was wondering if they where available.

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

                                The answer was to create function drawLinearSliderThumb outside lf_SliderHorizontal_Impl and call it from drawLinearSlider.

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

                                  Hi Atom

                                  It’s possible to have L&F implementation for PopUpMenu objects?

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

                                    For all of them or specific ones you create on your own in Lua ?

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

                                      Specific ones created in my lua scripts.

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

                                        Hi
                                        I encounter issue with UIfixedSlider()
                                        the look and fell seems not applied on this type of modulator
                                        just tried to adapt the jomox example .
                                        it works with ui slider

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

                                          Hi

                                          i tried this :
                                          jj = Rectangle( (width * 0.5)-(width*0.04) , (width * 0.5) – (width*0.13)-((width-(width*0.16))- (width * 0.5)) ,width*0.08,width*0.13)
                                          g:excludeClipRegion (jj)
                                          working

                                          now i would this
                                          jj = Path()
                                          jj:addRectangle((width * 0.5)-(width*0.04),(width * 0.5) – (width*0.13)-( (width-(width*0.16) )- (width * 0.5)) ,width*0.08,width*0.13)

                                          hh = jj:getBoundsTransformed(AffineTransform( AffineTransform .rotation (angle,(width * 0.5),(width * 0.5))))
                                          — hh = Rectangle Float

                                          g:excludeClipRegion (hh:toInt()) — i need Rectangle Int

                                          this is not working ,ctrlr doesn’t tell me it’s unregistered

                                          What i doing wrong ?

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

                                            There’s no Rectangle:toInt() function. In Juce there is Rectangle:toType() function, but it is not visible doing what(RectangleObject), so maybe it’s not registered.

                                          Viewing 20 posts - 21 through 40 (of 49 total)
                                          • The forum ‘Programming’ is closed to new topics and replies.
                                          There is currently 0 users and 115 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