예제 #1
0
    void createSVGDrawable()
    {
        lastSVGLoadTime = Time::getCurrentTime();

        MemoryInputStream iconsFileStream (BinaryData::icons_zip, BinaryData::icons_zipSize, false);
        ZipFile icons (&iconsFileStream, false);

        // Load a random SVG file from our embedded icons.zip file.
        const ScopedPointer<InputStream> svgFileStream (icons.createStreamForEntry (Random::getSystemRandom().nextInt (icons.getNumEntries())));

        if (svgFileStream != nullptr)
        {
            svgDrawable = dynamic_cast <DrawableComposite*> (Drawable::createFromImageDataStream (*svgFileStream));

            if (svgDrawable != nullptr)
            {
                // to make our icon the right size, we'll set its bounding box to the size and position that we want.
                svgDrawable->setBoundingBox (RelativeParallelogram (Point<float> (-100, -100),
                                                                    Point<float> (100, -100),
                                                                    Point<float> (-100, 100)));
            }
        }
    }
예제 #2
0
Drawable* ResourceLoader::createSVGDrawable(const String& filename)
{
	initObjectIconMap();

    if (iconsFromZipFile.size() == 0)
    {
        // If we've not already done so, load all the images from the zip file..
        MemoryInputStream iconsFileStream (BinaryData::icons_zip, BinaryData::icons_zipSize, false);
        ZipFile icons (&iconsFileStream, false);

        for (int i = 0; i < icons.getNumEntries(); ++i)
        {
            ScopedPointer<InputStream> svgFileStream (icons.createStreamForEntry (i));

            if (svgFileStream != 0)
            {
                iconNames.add (icons.getEntry(i)->filename);
                iconsFromZipFile.add (Drawable::createFromImageDataStream (*svgFileStream));
            }
        }
    }

    return iconsFromZipFile [iconNames.indexOf (filename)];//->createCopy();
}
예제 #3
0
//==============================================================================
PreferencesPane::PreferencesPane (const Value& loudnessBarWidth,
                                  const Value& loudnessBarMinValue,
                                  const Value& loudnessBarMaxValue,
                                  const Value& showIntegratedLoudnessHistoryValue,
                                  const Value& showLoudnessRangeHistoryValue,
                                  const Value& showShortTermLoudnessHistoryValue,
                                  const Value& showMomentaryLoudnessHistoryValue)
  : loudnessHistoryGroup (String::empty, "History Graph"),
    showIntegratedLoudnessHistory ("I"),
    showLoudnessRangeHistory("LRA"),
    showShortTimeLoudnessHistory ("S"),
    showMomentaryLoudnessHistory ("M")
{
    // Get the icons from the embedded zip.
    // ------------------------------------
    // Source: JuceDemo WidgetsDemo.cpp:616
    StringArray iconNames;
    OwnedArray<Drawable> iconsFromZipFile;
    
    const bool dontKeepInternalCopyOfData = false;
    MemoryInputStream iconsFileStream (BinaryData::icons_zip, BinaryData::icons_zipSize, dontKeepInternalCopyOfData);
    const bool dontDeleteStreamWhenDestroyed = false;
    ZipFile icons (&iconsFileStream, dontDeleteStreamWhenDestroyed);
    
    for (int i = 0; i < icons.getNumEntries(); ++i)
    {
        ScopedPointer<InputStream> svgFileStream (icons.createStreamForEntry (i));
        
        if (svgFileStream != 0)
        {
            // DBG(icons.getEntry(i)->filename);
            iconNames.add (icons.getEntry(i)->filename);
            iconsFromZipFile.add (Drawable::createFromImageDataStream (*svgFileStream));
        }
    }
    
    ScopedPointer<DrawableComposite> wrench = dynamic_cast <DrawableComposite*> (iconsFromZipFile [iconNames.indexOf ("wrenchByIonicons.svg")]->createCopy());
    AnimatedSidePanel::setCaptionAndIcon("Preferences", wrench);

    loudnessBarSizeLeftIcon = dynamic_cast <DrawableComposite*> (iconsFromZipFile [iconNames.indexOf ("barsWide.svg")]->createCopy());
    addAndMakeVisible (loudnessBarSizeLeftIcon);
    loudnessBarSizeRightIcon = dynamic_cast <DrawableComposite*> (iconsFromZipFile [iconNames.indexOf ("barsNarrow.svg")]->createCopy());
    addAndMakeVisible (loudnessBarSizeRightIcon);
    loudnessBarRangeLeftIcon = dynamic_cast <DrawableComposite*> (iconsFromZipFile [iconNames.indexOf ("rangeArrow.svg")]->createCopy());
    addAndMakeVisible (loudnessBarRangeLeftIcon);
    
    resized();
    
    
    const bool isReadOnly = false;
    const int textEntryBoxWidth = 0;
    const int textEntryBoxHeight = 0;
    
    loudnessBarSize.setRange (-300.0, -5.0, 1.0); // This value multiplied by -1 results in the used with
        // for each loudness bar. Negative values have been chosen to invert the behaviour of the slider
        // (left side: big bars, right side: small bars).
    loudnessBarSize.getValueObject().referTo(loudnessBarWidth);
    loudnessBarSize.setTextBoxStyle(Slider::NoTextBox, isReadOnly, textEntryBoxWidth, textEntryBoxHeight);
    loudnessBarSize.setColour(Slider::trackColourId, Colours::black);
    addAndMakeVisible (&loudnessBarSize);

    loudnessBarRange.setRange (-100, 0.0, 1.0);
    loudnessBarRange.getMinValueObject().referTo (loudnessBarMinValue);
    loudnessBarRange.getMaxValueObject().referTo (loudnessBarMaxValue);
    loudnessBarRange.setTextBoxStyle (Slider::NoTextBox, isReadOnly, textEntryBoxWidth, textEntryBoxHeight);
    loudnessBarRange.setPopupDisplayEnabled (true, this);
    loudnessBarRange.setTextValueSuffix (" LUFS");
    addAndMakeVisible (&loudnessBarRange);
    
    addAndMakeVisible (&loudnessHistoryGroup);
    
    showIntegratedLoudnessHistory.setClickingTogglesState (true);
    showIntegratedLoudnessHistory.getToggleStateValue().referTo (showIntegratedLoudnessHistoryValue);
    showIntegratedLoudnessHistory.setWantsKeyboardFocus (false);
    loudnessHistoryGroup.addAndMakeVisible (&showIntegratedLoudnessHistory);
    
    showLoudnessRangeHistory.setClickingTogglesState (true);
    showLoudnessRangeHistory.getToggleStateValue().referTo (showLoudnessRangeHistoryValue);
    showLoudnessRangeHistory.setWantsKeyboardFocus (false);
    loudnessHistoryGroup.addAndMakeVisible (&showLoudnessRangeHistory);
    
    showShortTimeLoudnessHistory.setClickingTogglesState (true);
    showShortTimeLoudnessHistory.getToggleStateValue().referTo (showShortTermLoudnessHistoryValue);
    showShortTimeLoudnessHistory.setWantsKeyboardFocus (false);
    loudnessHistoryGroup.addAndMakeVisible (&showShortTimeLoudnessHistory);
    
    showMomentaryLoudnessHistory.setClickingTogglesState (true);
    showMomentaryLoudnessHistory.getToggleStateValue().referTo (showMomentaryLoudnessHistoryValue);
    showMomentaryLoudnessHistory.setWantsKeyboardFocus (false);
    loudnessHistoryGroup.addAndMakeVisible (&showMomentaryLoudnessHistory);


	// Colours
	// -------

	setBackgroundColour (Colours::white.withAlpha (0.5f));

	loudnessBarSize.setColour (Slider::thumbColourId, Colours::black);
	loudnessBarRange.setColour (Slider::thumbColourId, Colours::black);
	loudnessBarRange.setColour (Slider::trackColourId, Colours::black);

	Colour loudnessHistoryGroupColour = Colour (0xff000000); // (Colour (0xff00ad00)); //Colour (0xff7f7f7f);
	loudnessHistoryGroup.setColour (GroupComponent::outlineColourId, loudnessHistoryGroupColour);
	loudnessHistoryGroup.setColour (GroupComponent::textColourId, loudnessHistoryGroupColour);

	Colour textColourOn = Colours::black;
	Colour buttonOnColour = Colour (0xffffff00);
	Colour textColourOff = Colour (0xff9a9a9a);
	Colour buttonOffColour = Colour (0xff383838);
	showIntegratedLoudnessHistory.setColour (TextButton::buttonOnColourId, Colours::yellow.darker ().darker ());
	showIntegratedLoudnessHistory.setColour (TextButton::textColourOnId, textColourOn);
	showIntegratedLoudnessHistory.setColour (TextButton::buttonColourId, buttonOffColour);
	showIntegratedLoudnessHistory.setColour (TextButton::textColourOffId, textColourOff);
	showLoudnessRangeHistory.setColour (TextButton::buttonOnColourId, Colours::blue.darker ());
	showLoudnessRangeHistory.setColour (TextButton::textColourOnId, textColourOn);
	showLoudnessRangeHistory.setColour (TextButton::buttonColourId, buttonOffColour);
	showLoudnessRangeHistory.setColour (TextButton::textColourOffId, textColourOff);
	showShortTimeLoudnessHistory.setColour (TextButton::buttonOnColourId, Colours::green);
	showShortTimeLoudnessHistory.setColour (TextButton::textColourOnId, textColourOn);
	showShortTimeLoudnessHistory.setColour (TextButton::buttonColourId, buttonOffColour);
	showShortTimeLoudnessHistory.setColour (TextButton::textColourOffId, textColourOff);
	showMomentaryLoudnessHistory.setColour (TextButton::buttonOnColourId, Colours::darkgreen);
	showMomentaryLoudnessHistory.setColour (TextButton::textColourOnId, textColourOn);
	showMomentaryLoudnessHistory.setColour (TextButton::buttonColourId, buttonOffColour);
	showMomentaryLoudnessHistory.setColour (TextButton::textColourOffId, textColourOff);
}