Example #1
0
void CtrlrGroup::valueTreePropertyChanged (ValueTree &treeWhosePropertyHasChanged, const Identifier &property)
{
	if (property == Ids::uiGroupOutlineColour1 || property == Ids::uiGroupOutlineColour2
			|| property == Ids::uiGroupBackgroundColour1 || property == Ids::uiGroupBackgroundColour2
			|| property == Ids::uiGroupBackgroundGradientType || property == Ids::uiGroupOutlineGradientType
			|| property == Ids::uiGroupOutlineRoundAngle || property == Ids::uiGroupOutlineThickness)
	{
		repaint();
	}
	else if (property == Ids::uiGroupTextColour)
	{
		label->setColour (Label::textColourId, VAR2COLOUR(getProperty(Ids::uiGroupTextColour)));
	}
	else if (property == Ids::uiGroupText)
	{
		label->setText (getProperty(Ids::uiGroupText), dontSendNotification);
	}
	else if (property == Ids::uiGroupTextFont)
	{
		label->setFont (STR2FONT(getProperty(Ids::uiGroupTextFont)));
	}
	else if (property == Ids::uiGroupTextPlacement)
	{
		label->setJustificationType (justificationFromProperty(getProperty(Ids::uiGroupTextPlacement)));
	}
	else if (property == Ids::uiGroupTextMargin)
	{
		textMargin			= getProperty(Ids::uiGroupTextMargin);
	}

	else if (property == Ids::uiGroupBackgroundImage
		|| property == Ids::uiGroupBackgroundImageAlpha
		|| property == Ids::uiGroupBackgroundImageLayout
		)
	{
		setResource();
	}
	else
	{
		CtrlrComponent::valueTreePropertyChanged(treeWhosePropertyHasChanged, property);
	}

	if (restoreStateInProgress == false)
	{
		resized();
	}
}
void CtrlrCustomButtonInternal::drawTextBoxText(Graphics &g, const Rectangle<int> &frameRect, const Rectangle<int> &totalAreaToDraw)
{
	RectangleList<int> list;
	list.add (totalAreaToDraw);
	list.subtract (frameRect);
	Rectangle<int> destination = list.getBounds();

	const int destinationWidth = (int)owner.getProperty(::Ids::uiImageButtonTextWidth)  ? (int)owner.getProperty(::Ids::uiImageButtonTextWidth)  : destination.getWidth();
	const int destinatioHeight = (int)owner.getProperty(::Ids::uiImageButtonTextHeight) ? (int)owner.getProperty(::Ids::uiImageButtonTextHeight) : destination.getHeight();

	destination.setSize (destinationWidth, destinatioHeight);

	g.setColour (VAR2COLOUR(owner.getProperty(::Ids::uiImageButtonTextColour)));
	g.setFont (owner.getOwner().getOwnerPanel().getCtrlrManagerOwner().getFontManager().getFontFromString(owner.getProperty(::Ids::uiButtonTextFont)));

	g.drawFittedText (getButtonText(),
							destination.getX(),
							destination.getY(),
							destination.getWidth(),
							destination.getHeight(),
							justificationFromProperty (owner.getProperty(::Ids::uiButtonTextJustification)),
							2);
}
Example #3
0
void CtrlrHyperlink::valueTreePropertyChanged (ValueTree &treeWhosePropertyHasChanged, const Identifier &property)
{
    if (property == Ids::uiButtonContent)
	{
		buttonContentChanged();
	}
	else if (property == Ids::uiHyperlinkColour)
	{
		hyperlinkButton->setColour (HyperlinkButton::textColourId, VAR2COLOUR(getProperty(property)));
	}
	else if (property == Ids::uiHyperlinkOpensUrl)
    {
        hyperlinkButton->setURL (getProperty(property) ? URL(getProperty(property)) : URL(String::empty));
    }
	else if (property == Ids::uiHyperlinkFont
		|| property == Ids::uiHyperlinkFitTextToSize
		|| property == Ids::uiHyperlinkTextJustification)
	{
		hyperlinkButton->setFont (STR2FONT(getProperty(Ids::uiHyperlinkFont)), getProperty(Ids::uiHyperlinkFitTextToSize), justificationFromProperty(getProperty(Ids::uiHyperlinkTextJustification)));
	}
	else
	{
		CtrlrComponent::valueTreePropertyChanged(treeWhosePropertyHasChanged, property);
	}

	if (restoreStateInProgress == false)
	{
		resized();
	}
}
Example #4
0
void CtrlrLCDLabel::valueTreePropertyChanged (ValueTree &treeWhosePropertyHasChanged, const Identifier &property)
{
	if (property == Ids::uiLabelDisplaysAllValues)
	{
		if ((bool)getProperty(property) == true)
		{
			owner.getOwnerPanel().addPanelListener(this);
		}
		else
		{
			owner.getOwnerPanel().removePanelListener(this);
		}
	}
	else if (property == Ids::uiLabelText)
	{
		ctrlrLabel->setText (getProperty(Ids::uiLabelText), sendNotification);
	}
	else if (property == Ids::uiLabelBgColour)
	{
		repaint();
	}
	else if (property == Ids::uiLabelTextColour)
	{
		ctrlrLabel->setColour (Label::textColourId, VAR2COLOUR(getProperty(Ids::uiLabelTextColour)));
		ctrlrLabel->setColour (TextEditor::textColourId, VAR2COLOUR(getProperty(Ids::uiLabelTextColour)));
	}
	else if (property == Ids::uiLabelFitFont)
	{
		ctrlrLabel->getProperties().set ("fh", getProperty(Ids::uiLabelFitFont));
		const String t = ctrlrLabel->getText();
		ctrlrLabel->setFont (CtrlrFontManager::getBuiltInFont ((int)getProperty(Ids::uiLCDLabelFont)).withHeight((float)getProperty(Ids::uiLCDLabelFontHeight)));
		ctrlrLabel->setText (t, dontSendNotification);
	}
	else if (property == Ids::uiLabelJustification)
	{
		ctrlrLabel->setJustificationType (justificationFromProperty(getProperty(property)));
	}
	else if (property == Ids::uiLCDLabelFont || property == Ids::uiLCDLabelFontHeight)
	{
		ctrlrLabel->setFont(CtrlrFontManager::getBuiltInFont ((int)getProperty(Ids::uiLCDLabelFont)).withHeight((float)getProperty(Ids::uiLCDLabelFontHeight)));
	}
	else if (property == Ids::uiLabelEditOnSingleClick
		|| property == Ids::uiLabelEditOnDoubleClick
		|| property == Ids::uiLabelEditFocusDiscardsChanges)
	{
		ctrlrLabel->setEditable ((bool)getProperty(Ids::uiLabelEditOnSingleClick),(bool)getProperty(Ids::uiLabelEditOnDoubleClick),(bool)getProperty(Ids::uiLabelEditFocusDiscardsChanges));
	}
	else if (property == Ids::uiLabelChangedCbk)
	{
		if (getProperty(property) == String::empty)
			return;

		labelChangedCbk = owner.getOwnerPanel().getCtrlrLuaManager().getMethodManager().getMethod(getProperty(property));
	}
	else if (property == Ids::uiLabelInputHighlightTextColour || property == Ids::uiLabelInputHighlightColour)
	{
		ctrlrLabel->setColour (TextEditor::highlightColourId, VAR2COLOUR(getProperty(Ids::uiLabelInputHighlightColour)));
		ctrlrLabel->setColour (TextEditor::highlightedTextColourId, VAR2COLOUR(getProperty(Ids::uiLabelInputHighlightTextColour)));
	}
	else
	{
		CtrlrComponent::valueTreePropertyChanged(treeWhosePropertyHasChanged, property);
	}

	if (restoreStateInProgress == false)
	{
		resized();
	}
}
Example #5
0
//==============================================================================
void CtrlrXYSurface::paint (Graphics& g)
{
    //[UserPrePaint] Add your own custom painting code here..
    //[/UserPrePaint]

    //[UserPaint] Add your own custom painting code here..
	gradientFromProperty (g, usableRectangle.getSmallestIntegerContainer(), getObjectTree(), Ids::uiXYSurfaceBgGradientType, Ids::uiXYSurfaceBackgroundColour1, Ids::uiXYSurfaceBackgroundColour2);
	g.fillRoundedRectangle ((float)usableRectangle.getTopLeft().getX(), (float)usableRectangle.getTopLeft().getY(), (float)usableRectangle.getWidth(), (float)usableRectangle.getHeight(), getProperty(Ids::uiXYSurfaceCornerSize));

	gradientFromProperty (g, usableRectangle.getSmallestIntegerContainer(), getObjectTree(), Ids::uiXYSurfaceOutlineGradientType, Ids::uiXYSurfaceOutlineColour1, Ids::uiXYSurfaceOutlineColour2);
    g.drawRoundedRectangle ((float)usableRectangle.getX(), (float)usableRectangle.getY(), (float)usableRectangle.getWidth(), (float)usableRectangle.getHeight(), getProperty(Ids::uiXYSurfaceCornerSize), getProperty(Ids::uiXYSurfaceOutlineThickness));

	const int snapSize	= (int)getProperty (Ids::uiXYSurfaceGradientGrain, 8);
	Colour colour		= VAR2COLOUR(getProperty(Ids::uiXYSurfaceGradientColour));

	if (snapSize > 0)
	{
		Image backgroundFill(Image::ARGB, snapSize, snapSize, true);
		Graphics g1(backgroundFill);

		if (snapSize > 2)
		{
			g1.setColour (colour);
			g1.drawRect (0, 0, snapSize + 1, snapSize + 1);
		}

		g.setTiledImageFill (backgroundFill, 0, 0, 1.0f);
		g.fillRoundedRectangle ((float)usableRectangle.getX(), (float)usableRectangle.getY(), (float)usableRectangle.getWidth(), (float)usableRectangle.getHeight(), getProperty(Ids::uiXYSurfaceCornerSize));
	}

	if (backgroundImage.isValid())
	{
		if ((int)getProperty (Ids::uiXYSurfaceBgImageLayout) == 8192)
		{
			g.setTiledImageFill (backgroundImage, 0, 0, (float)getProperty (Ids::uiXYSurfaceBgImageAlpha)/255.0f);
			g.fillRect ((float)usableRectangle.getX(), (float)usableRectangle.getY(), (float)usableRectangle.getWidth(), (float)usableRectangle.getHeight());
		}
		else
		{
			g.setColour (Colours::black.withAlpha ((float)getProperty (Ids::uiXYSurfaceBgImageAlpha)/255.0f));
			g.drawImageWithin (backgroundImage,
								usableRectangle.getX(),
								usableRectangle.getX(),
								usableRectangle.getWidth(),
								usableRectangle.getHeight(),
								RectanglePlacement(getProperty (Ids::uiXYSurfaceBgImageLayout)));
		}
	}

	if (getProperty (Ids::uiXYSurfaceXTrackEnabled))
	{
		const Point<int> c = surfaceModulator->getBounds().getCentre();

		g.setColour (VAR2COLOUR(getProperty(Ids::uiXYSurfaceYTrackColour)));
		g.drawLine ((float)c.getX(), (float)usableRectangle.getY(), (float)c.getX(), (float)usableRectangle.getBottom(), getProperty(Ids::uiXYSurfaceYTrackThickness));

		g.setColour (VAR2COLOUR(getProperty(Ids::uiXYSurfaceXTrackColour)));
		g.drawLine ((float)usableRectangle.getX(), (float)c.getY(), (float)usableRectangle.getWidth(), (float)c.getY(), getProperty(Ids::uiXYSurfaceXTrackThickness));
	}

	if ((bool)getProperty(Ids::uiXYSurfaceInfoLabelVisible))
	{
		// const int xScale = (int)getProperty(Ids::uiXYSurfaceMaxX);
		// const int yScale = (int)getProperty(Ids::uiXYSurfaceMaxY);

		const Point<int> c = surfaceModulator->getBounds().getCentre();
		g.setColour (VAR2COLOUR(getProperty (Ids::uiXYSurfaceInfoLabelColour)));
		g.setFont (STR2FONT(getProperty(Ids::uiXYSurfaceInfoLabelFont)));
		g.drawText ("X="+String(getValueForPosition(c.getX(), true))+" Y="+String(getValueForPosition(c.getY(), false)),
					usableRectangle.getX() + 8,
					usableRectangle.getY() + 8,
					usableRectangle.getWidth()-16,
					usableRectangle.getHeight()-16,
					justificationFromProperty(getProperty (Ids::uiXYSurfaceInfoLabelLocation)),
					true);
	}

    //[/UserPaint]
}