diff --git a/source/MainComponent.cpp b/source/MainComponent.cpp index 2017d77..803bd2e 100644 --- a/source/MainComponent.cpp +++ b/source/MainComponent.cpp @@ -113,9 +113,15 @@ MainComponent::MainComponent (const String prjname) numHiddenLabel->addListener (this); addAndMakeVisible (createButton = new TextButton ("Create button")); + createButton->setTooltip (TRANS("Create new layer")); createButton->setButtonText (TRANS("Create")); createButton->addListener (this); + addAndMakeVisible (clearButton = new TextButton ("Clear button")); + clearButton->setTooltip (TRANS("Delete all layers")); + clearButton->setButtonText (TRANS("Clear")); + clearButton->addListener (this); + addAndMakeVisible (projectNameLabel = new Label ("Project Name label", m_file.getFileNameWithoutExtension())); projectNameLabel->setFont (Font (15.00f, Font::plain)); @@ -324,6 +330,7 @@ MainComponent::~MainComponent() numVisibleLabel = nullptr; numHiddenLabel = nullptr; createButton = nullptr; + clearButton = nullptr; projectNameLabel = nullptr; loadButton = nullptr; saveButton = nullptr; @@ -440,17 +447,19 @@ void MainComponent::resized() WeightsSlider->setBounds (896, 320, 220, 24); numEpochslabel->setBounds (564, 200, 72, 24); learningRateLabel->setBounds (652, 200, 72, 24); - numVisibleLabel->setBounds (656, 248, 48, 24); - numHiddenLabel->setBounds (780, 248, 48, 24); - createButton->setBounds (728, 280, 72, 24); projectNameLabel->setBounds (552, 248, 96, 24); + numVisibleLabel->setBounds (648, 248, 48, 24); + numVisibleYLabel->setBounds (700, 248, 48, 24); + numHiddenLabel->setBounds (748, 248, 48, 24); + m_rbmSelect->setBounds (810, 248, 62, 24); loadButton->setBounds (564, 280, 72, 24); saveButton->setBounds (644, 280, 72, 24); - numVisibleYLabel->setBounds (716, 248, 48, 24); + createButton->setBounds (724, 280, 72, 24); + clearButton->setBounds (804, 280, 72, 24); loadTrainingButton->setBounds (564, 316, 72, 24); saveTrainingButton->setBounds (644, 316, 72, 24); - clearTrainingButton->setBounds (804, 316, 72, 24); removeTrainingButton->setBounds (724, 316, 72, 24); + clearTrainingButton->setBounds (804, 316, 72, 24); numGibbsSlider->setBounds (896, 240, 220, 24); rbmDoRaoBlackwellToggleButton->setBounds (556, 60, 112, 24); rbmDoSampleVisibleToggleButton->setBounds (680, 60, 128, 24); @@ -467,7 +476,6 @@ void MainComponent::resized() weightInitLabel->setBounds (948, 200, 72, 24); rbmLearnVarianceButton->setBounds (1004, 92, 128, 24); rbmNormalizeDataToggleButton->setBounds (1004, 60, 124, 24); - m_rbmSelect->setBounds (812, 280, 62, 24); rbmDoSampleBatch->setBounds (844, 60, 128, 24); sizeMiniBatch->setBounds (1064, 20, 48, 24); rbmUseHiddenGaussianToggleButton->setBounds (840, 92, 156, 24); @@ -520,11 +528,22 @@ void MainComponent::buttonClicked (Button* buttonThatWasClicked) { m_stack = new Stack(m_file.getParentDirectory().getFullPathName().toStdString(), std::string(projectNameLabel->getText().getCharPointer())); } + Layer *pPrev = m_stack->getLayer(next_index-1); + if (pPrev) + { + numVisX = pPrev->bh().n_elem; + numVisY = 1; + } m_stack->addLayer(onConstruct("Layer", next_index, numVisX, numVisY, numHid)); m_rbmSelect->addItem(String(next_index), next_index+1); m_rbmSelect->setSelectedId(next_index+1, sendNotification); //[/UserButtonCode_createButton] } + else if (buttonThatWasClicked == clearButton) + { + m_stack = nullptr; + m_rbmSelect->clear(NotificationType::dontSendNotification); + } else if (buttonThatWasClicked == loadButton) { //[UserButtonCode_loadButton] -- add your button handler code here.. diff --git a/source/MainComponent.hpp b/source/MainComponent.hpp index 7c9f805..90974c6 100644 --- a/source/MainComponent.hpp +++ b/source/MainComponent.hpp @@ -139,6 +139,7 @@ private: ScopedPointer