LAF Collection for everyone
-
Now my question is @Christoph-Hart @d-healey @orange @Matt_SF @Fortune what is
getIdealPopupMenuItemSize
,drawthumbnail
,drawmatrixpeakmeter
,drawsliderpack
drawtablecell
,drawwhitenote
functions? How to use them? Any Example? Documentation is not full of all laf.registerfunction examples. Can we get update ? This help doc will be a great place to learn Local LAF for newbies. -
@DabDab I haven't look at these yet. But it would be great if someone has the examples.
drawmatrixpeakmeter
looks interesting -
How can I use Sliderpack Flash using LAF? I have tried but it is not linked with step size.
const var SliderPack1 = Content.getComponent("SliderPack1"); SliderPack1.setLocalLookAndFeel(locl_laf); locl_laf.registerFunction("drawSliderPackFlashOverlay", function(g, obj) { g.setColour(Colours.pink); g.drawRect([0,0,20,240], 2.0); });
-
@DabDab Please use
(obj.area);
-
OK.. Now I got it
-
@DabDab Another example You can try:
const locl_laf = Content.createLocalLookAndFeel(); const var SliderPack1 = Content.getComponent("SliderPack1"); SliderPack1.setLocalLookAndFeel(locl_laf); locl_laf.registerFunction("drawSliderPackFlashOverlay", function(g, obj) { g.setColour(obj.itemColour); g.fillRect(obj.area); g.setColour(obj.itemColour2); var a = obj.area; g.fillRect([a[0], 230, a[2], 12]); }); locl_laf.registerFunction("drawSliderPackBackground", function(g, obj) { g.fillAll(obj.bgColour); });
-
@DabDab Alternatively you can open the Hise source code with the IDE. I am using Xcode, so searching for the keyword is a short way to understand what is going on. When we search
drawMatrixPeakMeter
, we will find this:void ScriptingObjects::ScriptedLookAndFeel::Laf::drawMatrixPeakMeter(Graphics& g_, float* peakValues, float* maxPeaks, int numChannels, bool isVertical, float segmentSize, float paddingSize, Component* c) { if (functionDefined("drawMatrixPeakMeter")) { auto obj = new DynamicObject(); Array<var> peaks, maxPeakArray; for(int i = 0; i < numChannels; i++) { peaks.add(peakValues[i]); if(maxPeaks != nullptr) maxPeakArray.add(maxPeaks[numChannels]); } obj->setProperty("area", ApiHelpers::getVarRectangle(c->getLocalBounds().toFloat())); obj->setProperty("numChannels", numChannels); obj->setProperty("peaks", var(peaks)); obj->setProperty("maxPeaks", var(maxPeakArray)); obj->setProperty("isVertical", isVertical); obj->setProperty("segmentSize", segmentSize); obj->setProperty("paddingSize", paddingSize); if(auto pc = c->findParentComponentOfClass<PanelWithProcessorConnection>()) { obj->setProperty("processorId", pc->getConnectedProcessor()->getId()); } setColourOrBlack(obj, "bgColour", *c, MatrixPeakMeter::ColourIds::bgColour); setColourOrBlack(obj, "itemColour", *c, MatrixPeakMeter::ColourIds::peakColour); setColourOrBlack(obj, "itemColour2", *c, MatrixPeakMeter::ColourIds::trackColour); setColourOrBlack(obj, "textColour", *c, MatrixPeakMeter::ColourIds::maxPeakColour); if (get()->callWithGraphics(g_, "drawMatrixPeakMeter", var(obj), c)) return; }
Thus we can say that the below list is for the properties of the
drawMatrixPeakMeter
LAF function. Then you can insert a MatrixPeakMeter FloatingTile and go on with these..obj.area obj.numChannels obj.peaks obj.maxPeaks obj.isVertical obj.segmentSize obj.paddingSize obj.processorId obj.bgColour obj.itemColour obj.itemColour2 obj.textColour obj.maxPeakColour
-
@orange Which Cpp file do I need to open to view all LAF functions?
-
@orange Can you prepare an example please ?
-
@DabDab Open the Hise Standalone Project file and search for the keyword.
-
@orange Thanks a lot.
I got all the functions.
"drawAlertWindow", "getAlertWindowMarkdownStyleData", "drawAlertWindowIcon", "drawPopupMenuBackground", "drawPopupMenuItem", "drawToggleButton", "drawRotarySlider", "drawLinearSlider", "drawDialogButton", "drawComboBox", "drawNumberTag", "createPresetBrowserIcons", "drawPresetBrowserBackground", "drawPresetBrowserColumnBackground", "drawPresetBrowserListItem", "drawPresetBrowserSearchBar", "drawPresetBrowserTag", "drawTableBackground", "drawTablePath", "drawTablePoint", "drawTableRuler", "drawScrollbar", "drawMidiDropper", "drawThumbnailBackground", "drawThumbnailText", "drawThumbnailPath", "drawThumbnailRange", "drawThumbnailRuler", "getThumbnailRenderOptions", "drawAhdsrBackground", "drawAhdsrBall", "drawAhdsrPath", "drawKeyboardBackground", "drawWhiteNote", "drawBlackNote", "drawSliderPackBackground", "drawSliderPackFlashOverlay", "drawSliderPackRightClickLine", "drawSliderPackTextPopup", "getIdealPopupMenuItemSize", "drawTableRowBackground", "drawTableCell", "drawTableHeaderBackground", "drawTableHeaderColumn", "drawFilterDragHandle", "drawFilterBackground", "drawFilterPath", "drawFilterGridLines", "drawAnalyserBackground", "drawAnalyserPath", "drawAnalyserGrid", "drawMatrixPeakMeter"
Now have to learn how to use them.
-
@orange So generous man!!!! :smiling_face_with_heart-eyes: Thanks you thank you!
-
Shaded SliderPacks - Although I think this should have it's own LAF function rather than using drawLinearSlider as there are some quirks doing it this way - and doing it for a +/- SliderPack seems rather overcomplicated
If anyone can get the +/- SliderPack to get rounded corners that look right please let me know!
HiseSnippet 1694.3ocsX80TaaDDWBPLQNABjlo8UM7jI1wU1Fv3ISZw+kPvfUvT9SYXxHKc19Jx2YjOavjguG8w9wouzm6Wi9AnyztmjrkLwlX6lpAjmc2a282t2d6cmzroFn1so1BhxG2qERP7YRU5QXMx0PGSD1Kuf3xRGn2lgrUbYksWK81sQlBhhyuKmgn7BBNO+0OlU2RmXf7YIHbBEafJgahY9b01YerkUQcSzw3lAF8F6rmAkjiZQ6.3YdIUgV5FWoWGcnNeXyIIHtXASLiZWgoyPsgwjkZ1qRC5MD2weBtMtpEhSDWnBXHW1B4ZfsL05GqsEDDWPyOxm2MxeozAXS7.99YfUbDn3qQvbf3bCCoEFBRwGGjJRsL4FXLvat.vaAW3spTECabKluDN1dpzdDXxolNj1CBK2wJL2eufTNJLBBKVS8qPEsAhAZDdKU0nJvq0eSHHy2lozU2VohE1DYqAo9MTdqResqiX4nMaQI.Q30BLl0FixaNAJuIW4fZqUJSw.5YXifrZIpgtUIJ8pLDyhHjU3g8HWmDSjRgbFaLaTcLuhtXGhACSIgWyzV+lRXBR21EaqEUoVeg0ipPq9KqG5SgBIy8mN3JfQLcvMuwkUWOVc0s5fNjZ2T2BeGxDbnb8Xs4wNujNr5soRplHSxLIAr.R3d8cTa7c.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F9O4g+OqK7pZFnMZ27k37zbZ3CuRVjSWkKuKWtlC8gbZsXf90xwoS1wkdJv5IHKpAl0aTX8efmgvZsHYAekd+7bWo80gdhw5KjJgH0YMlLjdE2Sm7dvSmQ095POgKAVUBtcIgfrpfrfSfQ+RKkGoQ9NoxcXs5v9JXpUkNPq.zW2tuw7MxbSrQdN2HEHlelIVYBWVsnz6fiUMhkje9kggqjSM6Xw2jJ38z4ePBOAv4CGZ2K9kdIsgp3fevho3x6pi7x6i7zeSHbWURCyLZLZ7N2HvK+3j+Oi2AmKnPsZP0jOXWPp3Yy528XJfBbsNFlT+.clMFNjiy1tvwofsJbKpZ2ujziVseW+JHhoZ+k4dBi2eQ.WX79BEZpaXS+nga8H+is7DGN.lHNemIYoC3zJwGTAKoFSUnI1D+QCCdp30.1GsNIlAcRNC5rwLnylyfNaMC5jZFzY6GUG9meKSGFso6xDfgVAm6AHJ5tQrSEov+BLftwVE
-
@DanH Do the sliderpacks not have LAF ?
-
@lalalandsynth Sure, you can draw the background, the text label and the flash animation but there's no need for another function than
drawLinearSlider
(also the sliders are juce::Sliders so it would be super difficult to branch that into another function. -
Wow, this sharing is going great and it has become a great collection! :D
Today we've got a nice Knob Peak Meter from @Steve-Mohican and this cool Shaded SliderPacks from @DanH. Thank you, guys! Both of them are on GitHub now.
Send your stuff guys, let's show the power of this incredible community!
Knob Peak Meter by @Steve-Mohican
Shaded SliderPacks by @DanH
-
How to implement Matrix Peak Meter?
const locl_laf = Content.createLocalLookAndFeel(); const var FloatingTile1 = Content.getComponent("FloatingTile1"); FloatingTile1.setLocalLookAndFeel(locl_laf); locl_laf.registerFunction("drawMatrixPeakMeter", function(g, obj) { if(obj.ProcessorId == "SAW"); var a = obj.area; g.setColour(obj.bgColour); g.fillRect([a[0],a[1],obj.area[2],a[3]+300]); if(obj.peaks); g.setColour(Colours.red); g.fillRect([0,0,obj.area[2],2]); if(obj.maxPeaks); g.setColour(Colours.cyan); g.fillRect([0,obj.area[1]+335,obj.area[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VAi+DoTb9k
-
@DabDab Use curly braces with your if statements.
-
@d-healey Still No luck
Content.makeFrontInterface(600, 600); const locl_laf = Content.createLocalLookAndFeel(); const var FloatingTile1 = Content.getComponent("FloatingTile1"); FloatingTile1.setLocalLookAndFeel(locl_laf); locl_laf.registerFunction("drawMatrixPeakMeter", function(g, obj) { if(obj.ProcessorId == "SAW"); { var a = obj.area; g.setColour(obj.bgColour); g.fillRect([a[0],a[1],obj.area[2],a[3]+300]); } if(obj.peaks); { g.setColour(Colours.red); g.fillRect([0,0,obj.area[2],2]); } if(obj.maxPeaks); { g.setColour(Colours.cyan); g.fillRect([0,obj.area[1]+335,obj.area[2]+2,2]); } });
-
@Christoph-Hart ok thanks for the info - if you find time could you please check my sliderpack snippett? - I couldn't use drawRect for the + side of the arp sliderpack as it wouldn't draw anything, and instead had to use drawRoundedRectangle with a border radius of 1. Trying to set the radius above 1 resulted in a some weird elongated curves on the + side too
It's all a bit fiddly!
HiseSnippet 1694.3ocsX80TaaDDWBPLQNABjlo8UM7jI1wU1Fv3ISZw+kPvfUvT9SYXxHKc19Jx2YjOavjguG8w9wouzm6Wi9AnyztmjrkLwlX6lpAjmc2a282t2d6cmzroFn1so1BhxG2qERP7YRU5QXMx0PGSD1Kuf3xRGn2lgrUbYksWK81sQlBhhyuKmgn7BBNO+0OlU2RmXf7YIHbBEafJgahY9b01YerkUQcSzw3lAF8F6rmAkjiZQ6.3YdIUgV5FWoWGcnNeXyIIHtXASLiZWgoyPsgwjkZ1qRC5MD2weBtMtpEhSDWnBXHW1B4ZfsL05GqsEDDWPyOxm2MxeozAXS7.99YfUbDn3qQvbf3bCCoEFBRwGGjJRsL4FXLvat.vaAW3spTECabKluDN1dpzdDXxolNj1CBK2wJL2eufTNJLBBKVS8qPEsAhAZDdKU0nJvq0eSHHy2lozU2VohE1DYqAo9MTdqResqiX4nMaQI.Q30BLl0FixaNAJuIW4fZqUJSw.5YXifrZIpgtUIJ8pLDyhHjU3g8HWmDSjRgbFaLaTc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