コード例 #1
0
void PpuDebugComponent::resized()
{
	auto working_area = getLocalBounds();
	tabbed_button_bar_.setBounds(working_area.removeFromTop(30));

	if (background_component_.isVisible()) background_component_.setBounds(working_area.removeFromTop(30));

	opengl_canvas_component_.setBounds(working_area);
	tileset_renderer_.SetViewportArea(working_area);
	background_renderer_.SetViewportArea(working_area);
}
コード例 #2
0
void FilterIOConfigurationWindow::resized()
{
    auto r = getLocalBounds().reduced (10);

    title.setBounds (r.removeFromTop (14));
    r.reduce (10, 0);

    if (inConfig != nullptr)
        inConfig->setBounds (r.removeFromTop (160));

    if (outConfig != nullptr)
        outConfig->setBounds (r.removeFromTop (160));
}
コード例 #3
0
void CpuRegistersComponent::resized()
{
	auto working_area = getLocalBounds();
	auto flags_area = working_area.removeFromRight(getWidth() / 3);

	registers_list_.setBounds(working_area.reduced(1, 1));
	registers_list_.setRowHeight(working_area.getHeight() / 6);

	const auto flags_area_height = flags_area.getHeight();
	zero_flag_toggle_.setBounds(flags_area.removeFromTop(flags_area_height / 4));
	subtract_flag_toggle_.setBounds(flags_area.removeFromTop(flags_area_height / 4));
	half_carry_flag_toggle_.setBounds(flags_area.removeFromTop(flags_area_height / 4));
	carry_flag_toggle_.setBounds(flags_area);
}
コード例 #4
0
void PlaybackPane::resized() {
    scroll_bar.setBounds(getLocalBounds().removeFromBottom(20));

    auto bounds = getLocalBounds();
    auto top = bounds.removeFromTop(40);
    top.reduce(2, 2);
    ruler.setBounds(bounds.removeFromTop(20));
    renderer.setBounds(bounds);

    transport.setBounds(top.removeFromLeft(200));
    follow_playback_button.setBounds(top.removeFromRight(150));
    bypass_button.setBounds(top.removeFromRight(150));

    load_different_button.setBounds(top.removeFromLeft(150));
}
コード例 #5
0
void DropShadow::drawForRectangle (Graphics& g, const Rectangle<int>& targetArea) const
{
    ColourGradient cg (colour, 0, 0, colour.withAlpha (0.0f), 0, 0, false);

    for (float i = 0.05f; i < 1.0f; i += 0.1f)
        cg.addColour (1.0 - i, colour.withMultipliedAlpha (i * i));

    const float radiusInset = radius / 2.0f;
    const float expandedRadius = radius + radiusInset;

    auto area = targetArea.toFloat().reduced (radiusInset) + offset.toFloat();

    auto r = area.expanded (expandedRadius);
    auto top = r.removeFromTop (expandedRadius);
    auto bottom = r.removeFromBottom (expandedRadius);

    drawShadowSection (g, cg, top.removeFromLeft  (expandedRadius), true, 1.0f, 1.0f, 0, 1.0f);
    drawShadowSection (g, cg, top.removeFromRight (expandedRadius), true, 0, 1.0f, 1.0f, 1.0f);
    drawShadowSection (g, cg, top, false, 0, 1.0f, 0, 0);

    drawShadowSection (g, cg, bottom.removeFromLeft  (expandedRadius), true, 1.0f, 0, 0, 0);
    drawShadowSection (g, cg, bottom.removeFromRight (expandedRadius), true, 0, 0, 1.0f, 0);
    drawShadowSection (g, cg, bottom, false, 0, 0, 0, 1.0f);

    drawShadowSection (g, cg, r.removeFromLeft  (expandedRadius), false, 1.0f, 0, 0, 0);
    drawShadowSection (g, cg, r.removeFromRight (expandedRadius), false, 0, 0, 1.0f, 0);

    g.setColour (colour);
    g.fillRect (area);
}
コード例 #6
0
void MultiChoicePropertyComponent::resized()
{
    auto bounds = getLookAndFeel().getPropertyComponentContentPosition (*this);

    bounds.removeFromBottom (5);

    auto buttonSlice = bounds.removeFromBottom (10);
    expandButton.setSize (10, 10);
    expandButton.setCentrePosition (buttonSlice.getCentre());

    numHidden = 0;

    for (auto* b : choiceButtons)
    {
        if (bounds.getHeight() >= 25)
        {
            b->setVisible (true);
            b->setBounds (bounds.removeFromTop (25).reduced (5, 2));
        }
        else
        {
            b->setVisible (false);
            ++numHidden;
        }
    }
}
コード例 #7
0
ファイル: testCode.c プロジェクト: Emraldis/CIS2050
int main(void){
	Stack * stack;
	char * tempValue;
	int i;
	
	printf("\nCreating a new Stack");
	
	stack = createStack("1");
	tempValue = malloc(sizeof(char) * 128);
	
	for(i=2;i<101;i++){
		sprintf(tempValue,"%d",i);
		stack = addToStack(tempValue,stack);
	}
	
	printf("\nThe value of the element on top of the stack is: %s",getTopValue(stack));
	printf("\nPrinting the stack");
	printStack(stack);
	printf("\nRemoving the top element of the stack, and printing again");
	stack = removeFromTop(stack);
	printStack(stack);
	printf("\nThe value of the element on top of the stack is: %s",getTopValue(stack));
	printf("\nDeleting the stack, and then printing again");
	stack = deleteStack(stack);
	printStack(stack);
	printf("\nThe value of the element on top of the stack is: %s",getTopValue(stack));
	printf("\nAttempting to delete an empty stack");
	stack = deleteStack(stack);
	printf("\nAttempting to remove the top element of an empty stack");
	stack = removeFromTop(stack);
	printf("\nAttempting to add an element to an empty stack");
	stack = addToStack("1",stack);	
	printf("\nThe value of the element on top of the stack is: %s",getTopValue(stack));
	printf("\nPrinting the stack");
	printStack(stack);
	printf("\nAdding an element with an empty value");
	stack = addToStack(NULL,stack);
	printf("\nThe value of the element on top of the stack is: %s",getTopValue(stack));
	printf("\nPrinting the stack");	
	printStack(stack);
	printf("\n");
	
	return(0);
}
コード例 #8
0
//==============================================================================
void ResizableWindow::activeWindowStatusChanged()
{
    auto border = getContentComponentBorder();
    auto area = getLocalBounds();

    repaint (area.removeFromTop (border.getTop()));
    repaint (area.removeFromLeft (border.getLeft()));
    repaint (area.removeFromRight (border.getRight()));
    repaint (area.removeFromBottom (border.getBottom()));
}
コード例 #9
0
    void resized() override
    {
        auto bounds = getLocalBounds();
        auto headerBounds = bounds.removeFromTop (getHeaderSize());

        if (customHeaderComponent != nullptr)
            customHeaderComponent->setBounds (headerBounds);

        component->setBounds (bounds);
    }
コード例 #10
0
void ProjectContentComponent::resized()
{
    auto r = getLocalBounds();

    r.removeFromRight (10);
    r.removeFromLeft (15);
    r.removeFromBottom (40);
    r.removeFromTop (5);

    if (header != nullptr)
        header->setBounds (r.removeFromTop (40));

    r.removeFromTop (10);

    auto sidebarArea = r.removeFromLeft (sidebarTabs.getWidth() != 0 ? sidebarTabs.getWidth()
                                                                     : r.getWidth() / 4);

    if (sidebarTabs.isVisible())
        sidebarTabs.setBounds (sidebarArea);

    if (resizerBar != nullptr)
        resizerBar->setBounds (r.withWidth (4));

    if (auto* h = dynamic_cast<HeaderComponent*> (header.get()))
    {
        h->sidebarTabsWidthChanged (sidebarTabs.getWidth());
        r.removeFromRight (h->getUserButtonWidth());
    }

    if (contentView != nullptr)
    {
        if (fileNameLabel != nullptr && fileNameLabel->isVisible())
            fileNameLabel->setBounds (r.removeFromTop (15));

        contentView->setBounds (r);
    }

    if (logo != nullptr)
        logo->setBounds (r.reduced (r.getWidth() / 6, r.getHeight() / 6));
}
コード例 #11
0
void ConvolutionMatrixComponent::resized() {
    auto matrix_height = optimum_routing_size * model.get_num_inputs();
    auto matrix_width = optimum_routing_size * model.get_num_outputs();

    auto input_width = getWidth() - matrix_width;

    auto bounds = getLocalBounds();
    auto left = bounds.removeFromLeft(input_width);
    auto input_area = left.removeFromTop(matrix_height);

    hrtf_component.setBounds(left.reduced(4, 4));

    auto matrix_area = bounds.removeFromTop(matrix_height);
    auto output_area = bounds;

    for (auto i = 0u; i != routings.size(); ++i) {
        auto y = i * optimum_routing_size;
        for (auto j = 0u; j != routings[i].size(); ++j) {
            auto x = j * optimum_routing_size;
            routings[i][j]->setSize(optimum_routing_size, optimum_routing_size);
            routings[i][j]->setTopLeftPosition(matrix_area.getTopLeft() +
                                               juce::Point<int>(x, y));
        }
    }

    for (auto i = 0u; i != inputs.size(); ++i) {
        inputs[i]->setSize(input_area.getWidth(), optimum_routing_size);
        inputs[i]->setTopLeftPosition(
                input_area.getTopLeft() +
                juce::Point<int>(0, i * optimum_routing_size));
    }

    for (auto i = 0u; i != outputs.size(); ++i) {
        outputs[i]->setSize(optimum_routing_size, output_area.getHeight());
        outputs[i]->setTopLeftPosition(
                output_area.getTopLeft() +
                juce::Point<int>(i * optimum_routing_size, 0));
    }
}
コード例 #12
0
void ProjucerLookAndFeel::layoutFileBrowserComponent (FileBrowserComponent& browserComp,
                                                      DirectoryContentsDisplayComponent* fileListComponent,
                                                      FilePreviewComponent* previewComp,
                                                      ComboBox* currentPathBox,
                                                      TextEditor* filenameBox,
                                                      Button* goUpButton)
{
    const auto sectionHeight = 22;
    const auto buttonWidth = 50;

    auto b = browserComp.getLocalBounds().reduced (20, 5);

    auto topSlice    = b.removeFromTop (sectionHeight);
    auto bottomSlice = b.removeFromBottom (sectionHeight);

    currentPathBox->setBounds (topSlice.removeFromLeft (topSlice.getWidth() - buttonWidth));
    currentPathBox->setColour (ComboBox::backgroundColourId,    findColour (backgroundColourId));
    currentPathBox->setColour (ComboBox::textColourId,          findColour (defaultTextColourId));
    currentPathBox->setColour (ComboBox::arrowColourId,         findColour (defaultTextColourId));

    topSlice.removeFromLeft (6);
    goUpButton->setBounds (topSlice);

    bottomSlice.removeFromLeft (50);
    filenameBox->setBounds (bottomSlice);
    filenameBox->setColour (TextEditor::backgroundColourId, findColour (backgroundColourId));
    filenameBox->setColour (TextEditor::textColourId,       findColour (defaultTextColourId));
    filenameBox->setColour (TextEditor::outlineColourId,    findColour (defaultTextColourId));
    filenameBox->applyFontToAllText (filenameBox->getFont());

    if (previewComp != nullptr)
        previewComp->setBounds (b.removeFromRight (b.getWidth() / 3));

    if (auto listAsComp = dynamic_cast<Component*> (fileListComponent))
        listAsComp->setBounds (b.reduced (0, 10));
}
コード例 #13
0
void MidiKeyboardComponent::resized()
{
    auto w = getWidth();
    auto h = getHeight();

    if (w > 0 && h > 0)
    {
        if (orientation != horizontalKeyboard)
            std::swap (w, h);

        auto kx2 = getKeyPos (rangeEnd).getEnd();

        if ((int) firstKey != rangeStart)
        {
            auto kx1 = getKeyPos (rangeStart).getStart();

            if (kx2 - kx1 <= w)
            {
                firstKey = (float) rangeStart;
                sendChangeMessage();
                repaint();
            }
        }

        scrollDown->setVisible (canScroll && firstKey > (float) rangeStart);

        xOffset = 0;

        if (canScroll)
        {
            auto scrollButtonW = jmin (scrollButtonWidth, w / 2);
            auto r = getLocalBounds();

            if (orientation == horizontalKeyboard)
            {
                scrollDown->setBounds (r.removeFromLeft  (scrollButtonW));
                scrollUp  ->setBounds (r.removeFromRight (scrollButtonW));
            }
            else if (orientation == verticalKeyboardFacingLeft)
            {
                scrollDown->setBounds (r.removeFromTop    (scrollButtonW));
                scrollUp  ->setBounds (r.removeFromBottom (scrollButtonW));
            }
            else
            {
                scrollDown->setBounds (r.removeFromBottom (scrollButtonW));
                scrollUp  ->setBounds (r.removeFromTop    (scrollButtonW));
            }

            auto endOfLastKey = getKeyPos (rangeEnd).getEnd();

            float mousePositionVelocity;
            auto spaceAvailable = w;
            auto lastStartKey = remappedXYToNote ({ endOfLastKey - spaceAvailable, 0 }, mousePositionVelocity) + 1;

            if (lastStartKey >= 0 && ((int) firstKey) > lastStartKey)
            {
                firstKey = (float) jlimit (rangeStart, rangeEnd, lastStartKey);
                sendChangeMessage();
            }

            xOffset = getKeyPos ((int) firstKey).getStart();
        }
        else
        {
            firstKey = (float) rangeStart;
        }

        scrollUp->setVisible (canScroll && getKeyPos (rangeEnd).getStart() > w);
        repaint();
    }
}