void NTLookAndFeel::drawTickBox(juce::Graphics &g, juce::Component &button, float x, float y, float w, float h, bool ticked, bool isEnabled, bool isMouseOverButton, bool isButtonDown){
    
    auto& toggle = dynamic_cast<ToggleButton&>(button);
    
    if (toggle.getRadioGroupId() > 0) {
        auto rect = Rectangle<float>(x,y,w,h);
        rect.reduce(w * .2, h*.2);
        
        g.setColour(Colours::white);
        g.fillEllipse(rect);
        g.setColour(Colours::lightgrey);
        g.drawEllipse(rect,2);
        
        if (ticked) {
            rect.reduce(rect.getWidth() * .2,rect.getHeight() *.2);

            g.fillEllipse(rect);
        }
    }else{
        auto rect = Rectangle<float>(x,y,w,h);
        g.setColour(Colours::white);
        g.fillRect(rect);
        g.setColour(Colours::lightgrey);
        g.drawRect(rect,3);
        if (ticked) {
            rect.reduce(rect.getWidth() * .25,rect.getHeight() *.25);
            g.fillRect(rect);
        }

    }
    
    
}
Example #2
0
void WaveViewer::paint(juce::Graphics &g) {
  g.drawImage(background_,
              0, 0, getWidth(), getHeight(),
              0, 0, background_.getWidth(), background_.getHeight());

  if (wave_state_) {
    float amplitude = amplitude_slider_ ? amplitude_slider_->getValue() : 1.0f;

    if (phase_ >= 0.0 && phase_ < 1.0) {
      float x = phaseToX(phase_);
      g.setColour(Colour(0x33ffffff));
      g.fillRect(x - 0.5f, 0.0f, 1.0f, (float)getHeight());

      mopo::Wave::Type type = static_cast<mopo::Wave::Type>(static_cast<int>(wave_slider_->getValue()));
      float value = amplitude * mopo::Wave::wave(type, phase_);
      float y = PADDING + (getHeight() - 2 * PADDING) * (1.0f - value) / 2.0f;
      g.setColour(Colour(0xff03a9f4));
      g.fillEllipse(x - MARKER_WIDTH / 2.0f, y - MARKER_WIDTH / 2.0f,
                    MARKER_WIDTH, MARKER_WIDTH);
      g.setColour(Colour(0xffffffff));
      g.fillEllipse(x - MARKER_WIDTH / 4.0f, y - MARKER_WIDTH / 4.0f,
                    MARKER_WIDTH / 2.0f, MARKER_WIDTH / 2.0f);
    }
  }
}
Example #3
0
void WaveViewer::paint(juce::Graphics &g) {
  g.drawImageWithin(background_,
                    0, 0, getWidth(), getHeight(), RectanglePlacement());

  if (wave_phase_) {
    if (phase_ >= 0.0 && phase_ < 1.0) {
      float x = phaseToX(phase_);
      g.setColour(Colour(0x33ffffff));
      g.fillRect(x - 0.5f, 0.0f, 1.0f, (float)getHeight());

      float y = PADDING + (getHeight() - 2 * PADDING) * (1.0f - amp_) / 2.0f;

      if (is_control_rate_)
        g.setColour(Colour(0xff00e676));
      else
        g.setColour(Colour(0xff03a9f4));
      g.fillEllipse(x - MARKER_WIDTH / 2.0f, y - MARKER_WIDTH / 2.0f,
                    MARKER_WIDTH, MARKER_WIDTH);
      g.setColour(Colour(0xff000000));
      g.fillEllipse(x - MARKER_WIDTH / 4.0f, y - MARKER_WIDTH / 4.0f,
                    MARKER_WIDTH / 2.0f, MARKER_WIDTH / 2.0f);
    }
  }
}