- use expectations
- improved gibbs sampling - LayerArray is template class git-svn-id: http://moon:8086/svn/software/trunk/projects/RBM@18 b431acfa-c32f-4a4a-93f1-934dc6c82436
This commit is contained in:
@@ -418,7 +418,7 @@ private:
|
||||
bool isEnabled : 1, isHeading : 1;
|
||||
};
|
||||
|
||||
OwnedArray<ItemInfo> items;
|
||||
OwnedArray <ItemInfo> items;
|
||||
Value currentId;
|
||||
int lastCurrentId;
|
||||
bool isButtonDown, separatorPending, menuActive, scrollWheelEnabled;
|
||||
|
||||
@@ -460,3 +460,5 @@ void Label::textEditorFocusLost (TextEditor& ed)
|
||||
{
|
||||
textEditorTextChanged (ed);
|
||||
}
|
||||
|
||||
void Label::Listener::editorShown (Label*, TextEditor&) {}
|
||||
|
||||
@@ -184,7 +184,7 @@ public:
|
||||
virtual void labelTextChanged (Label* labelThatHasChanged) = 0;
|
||||
|
||||
/** Called when a Label goes into editing mode and displays a TextEditor. */
|
||||
virtual void editorShown (Label*, TextEditor&) {}
|
||||
virtual void editorShown (Label*, TextEditor& textEditorShown);
|
||||
};
|
||||
|
||||
/** Registers a listener that will be called when the label's text changes. */
|
||||
|
||||
@@ -45,10 +45,7 @@ public:
|
||||
*/
|
||||
virtual int getNumRows() = 0;
|
||||
|
||||
/** This method must be implemented to draw a row of the list.
|
||||
Note that the rowNumber value may be greater than the number of rows in your
|
||||
list, so be careful that you don't assume it's less than getNumRows().
|
||||
*/
|
||||
/** This method must be implemented to draw a row of the list. */
|
||||
virtual void paintListBoxItem (int rowNumber,
|
||||
Graphics& g,
|
||||
int width, int height,
|
||||
|
||||
@@ -464,9 +464,9 @@ public:
|
||||
const bool stopAtEnd)
|
||||
{
|
||||
// make sure the values are sensible..
|
||||
jassert (startAngleRadians >= 0 && endAngleRadians >= 0);
|
||||
jassert (startAngleRadians < float_Pi * 4.0f && endAngleRadians < float_Pi * 4.0f);
|
||||
jassert (startAngleRadians < endAngleRadians);
|
||||
jassert (rotaryStart >= 0 && rotaryEnd >= 0);
|
||||
jassert (rotaryStart < float_Pi * 4.0f && rotaryEnd < float_Pi * 4.0f);
|
||||
jassert (rotaryStart < rotaryEnd);
|
||||
|
||||
rotaryStart = startAngleRadians;
|
||||
rotaryEnd = endAngleRadians;
|
||||
@@ -566,7 +566,6 @@ public:
|
||||
|
||||
valueBox->setWantsKeyboardFocus (false);
|
||||
valueBox->setText (previousTextBoxContent, dontSendNotification);
|
||||
valueBox->setTooltip (owner.getTooltip());
|
||||
|
||||
if (valueBox->isEditable() != editableText) // (avoid overriding the single/double click flags unless we have to)
|
||||
valueBox->setEditable (editableText && owner.isEnabled());
|
||||
@@ -578,6 +577,10 @@ public:
|
||||
valueBox->addMouseListener (&owner, false);
|
||||
valueBox->setMouseCursor (MouseCursor::ParentCursor);
|
||||
}
|
||||
else
|
||||
{
|
||||
valueBox->setTooltip (owner.getTooltip());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1006,9 +1009,9 @@ public:
|
||||
valueBox->hideEditor (false);
|
||||
|
||||
const double value = (double) currentValue.getValue();
|
||||
const double delta = getMouseWheelDelta (value, (std::abs (wheel.deltaX) > std::abs (wheel.deltaY)
|
||||
? -wheel.deltaX : wheel.deltaY)
|
||||
* (wheel.isReversed ? -1.0f : 1.0f));
|
||||
const double delta = getMouseWheelDelta (value, (wheel.deltaX != 0 ? -wheel.deltaX : wheel.deltaY)
|
||||
* (wheel.isReversed ? -1.0f : 1.0f));
|
||||
|
||||
if (delta != 0)
|
||||
{
|
||||
const double newValue = value + jmax (interval, std::abs (delta)) * (delta < 0 ? -1.0 : 1.0);
|
||||
|
||||
@@ -26,7 +26,7 @@ class TableListBox::RowComp : public Component,
|
||||
public TooltipClient
|
||||
{
|
||||
public:
|
||||
RowComp (TableListBox& tlb) noexcept : owner (tlb), row (-1), isSelected (false)
|
||||
RowComp (TableListBox& tlb) : owner (tlb), row (-1), isSelected (false)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -192,7 +192,7 @@ public:
|
||||
if (TableListBoxModel* m = owner.getModel())
|
||||
return m->getCellTooltip (row, columnId);
|
||||
|
||||
return String();
|
||||
return String::empty;
|
||||
}
|
||||
|
||||
Component* findChildComponentForColumn (const int columnId) const
|
||||
@@ -275,7 +275,7 @@ void TableListBox::setHeader (TableHeaderComponent* newHeader)
|
||||
{
|
||||
jassert (newHeader != nullptr); // you need to supply a real header for a table!
|
||||
|
||||
Rectangle<int> newBounds (100, 28);
|
||||
Rectangle<int> newBounds (0, 0, 100, 28);
|
||||
if (header != nullptr)
|
||||
newBounds = header->getBounds();
|
||||
|
||||
@@ -287,7 +287,7 @@ void TableListBox::setHeader (TableHeaderComponent* newHeader)
|
||||
header->addListener (this);
|
||||
}
|
||||
|
||||
int TableListBox::getHeaderHeight() const noexcept
|
||||
int TableListBox::getHeaderHeight() const
|
||||
{
|
||||
return header->getHeight();
|
||||
}
|
||||
@@ -312,11 +312,16 @@ void TableListBox::autoSizeAllColumns()
|
||||
autoSizeColumn (header->getColumnIdOfIndex (i, true));
|
||||
}
|
||||
|
||||
void TableListBox::setAutoSizeMenuOptionShown (const bool shouldBeShown) noexcept
|
||||
void TableListBox::setAutoSizeMenuOptionShown (const bool shouldBeShown)
|
||||
{
|
||||
autoSizeOptionsShown = shouldBeShown;
|
||||
}
|
||||
|
||||
bool TableListBox::isAutoSizeMenuOptionShown() const
|
||||
{
|
||||
return autoSizeOptionsShown;
|
||||
}
|
||||
|
||||
Rectangle<int> TableListBox::getCellPosition (const int columnId, const int rowNumber,
|
||||
const bool relativeToComponentTopLeft) const
|
||||
{
|
||||
@@ -332,7 +337,7 @@ Rectangle<int> TableListBox::getCellPosition (const int columnId, const int rowN
|
||||
|
||||
Component* TableListBox::getCellComponent (int columnId, int rowNumber) const
|
||||
{
|
||||
if (RowComp* const rowComp = dynamic_cast<RowComp*> (getComponentForRowNumber (rowNumber)))
|
||||
if (RowComp* const rowComp = dynamic_cast <RowComp*> (getComponentForRowNumber (rowNumber)))
|
||||
return rowComp->findChildComponentForColumn (columnId);
|
||||
|
||||
return nullptr;
|
||||
@@ -365,12 +370,12 @@ void TableListBox::paintListBoxItem (int, Graphics&, int, int, bool)
|
||||
{
|
||||
}
|
||||
|
||||
Component* TableListBox::refreshComponentForRow (int rowNumber, bool rowSelected, Component* existingComponentToUpdate)
|
||||
Component* TableListBox::refreshComponentForRow (int rowNumber, bool isRowSelected_, Component* existingComponentToUpdate)
|
||||
{
|
||||
if (existingComponentToUpdate == nullptr)
|
||||
existingComponentToUpdate = new RowComp (*this);
|
||||
|
||||
static_cast<RowComp*> (existingComponentToUpdate)->update (rowNumber, rowSelected);
|
||||
static_cast <RowComp*> (existingComponentToUpdate)->update (rowNumber, isRowSelected_);
|
||||
|
||||
return existingComponentToUpdate;
|
||||
}
|
||||
@@ -445,7 +450,7 @@ void TableListBox::updateColumnComponents() const
|
||||
const int firstRow = getRowContainingPosition (0, 0);
|
||||
|
||||
for (int i = firstRow + getNumRowsOnScreen() + 2; --i >= firstRow;)
|
||||
if (RowComp* const rowComp = dynamic_cast<RowComp*> (getComponentForRowNumber (i)))
|
||||
if (RowComp* const rowComp = dynamic_cast <RowComp*> (getComponentForRowNumber (i)))
|
||||
rowComp->resized();
|
||||
}
|
||||
|
||||
@@ -460,7 +465,7 @@ void TableListBoxModel::deleteKeyPressed (int) {}
|
||||
void TableListBoxModel::returnKeyPressed (int) {}
|
||||
void TableListBoxModel::listWasScrolled() {}
|
||||
|
||||
String TableListBoxModel::getCellTooltip (int /*rowNumber*/, int /*columnId*/) { return String(); }
|
||||
String TableListBoxModel::getCellTooltip (int /*rowNumber*/, int /*columnId*/) { return String::empty; }
|
||||
var TableListBoxModel::getDragSourceDescription (const SparseSet<int>&) { return var(); }
|
||||
|
||||
Component* TableListBoxModel::refreshComponentForCell (int, int, bool, Component* existingComponentToUpdate)
|
||||
|
||||
@@ -57,7 +57,7 @@ public:
|
||||
The graphics context has its origin at the row's top-left, and your method
|
||||
should fill the area specified by the width and height parameters.
|
||||
*/
|
||||
virtual void paintRowBackground (Graphics&,
|
||||
virtual void paintRowBackground (Graphics& g,
|
||||
int rowNumber,
|
||||
int width, int height,
|
||||
bool rowIsSelected) = 0;
|
||||
@@ -66,11 +66,8 @@ public:
|
||||
|
||||
The graphics context's origin will already be set to the top-left of the cell,
|
||||
whose size is specified by (width, height).
|
||||
|
||||
Note that the rowNumber value may be greater than the number of rows in your
|
||||
list, so be careful that you don't assume it's less than getNumRows().
|
||||
*/
|
||||
virtual void paintCell (Graphics&,
|
||||
virtual void paintCell (Graphics& g,
|
||||
int rowNumber,
|
||||
int columnId,
|
||||
int width, int height,
|
||||
@@ -145,21 +142,25 @@ public:
|
||||
*/
|
||||
virtual int getColumnAutoSizeWidth (int columnId);
|
||||
|
||||
/** Returns a tooltip for a particular cell in the table. */
|
||||
/** Returns a tooltip for a particular cell in the table.
|
||||
*/
|
||||
virtual String getCellTooltip (int rowNumber, int columnId);
|
||||
|
||||
//==============================================================================
|
||||
/** Override this to be informed when rows are selected or deselected.
|
||||
|
||||
@see ListBox::selectedRowsChanged()
|
||||
*/
|
||||
virtual void selectedRowsChanged (int lastRowSelected);
|
||||
|
||||
/** Override this to be informed when the delete key is pressed.
|
||||
|
||||
@see ListBox::deleteKeyPressed()
|
||||
*/
|
||||
virtual void deleteKeyPressed (int lastRowSelected);
|
||||
|
||||
/** Override this to be informed when the return key is pressed.
|
||||
|
||||
@see ListBox::returnKeyPressed()
|
||||
*/
|
||||
virtual void returnKeyPressed (int lastRowSelected);
|
||||
@@ -209,34 +210,29 @@ public:
|
||||
/** Creates a TableListBox.
|
||||
|
||||
The model pointer passed-in can be null, in which case you can set it later
|
||||
with setModel(). The TableListBox does not take ownership of the model - it's
|
||||
the caller's responsibility to manage its lifetime and make sure it
|
||||
doesn't get deleted while still being used.
|
||||
with setModel().
|
||||
*/
|
||||
TableListBox (const String& componentName = String(),
|
||||
TableListBoxModel* model = nullptr);
|
||||
TableListBox (const String& componentName = String::empty,
|
||||
TableListBoxModel* model = 0);
|
||||
|
||||
/** Destructor. */
|
||||
~TableListBox();
|
||||
|
||||
//==============================================================================
|
||||
/** Changes the TableListBoxModel that is being used for this table.
|
||||
The TableListBox does not take ownership of the model - it's the caller's responsibility
|
||||
to manage its lifetime and make sure it doesn't get deleted while still being used.
|
||||
*/
|
||||
void setModel (TableListBoxModel* newModel);
|
||||
|
||||
/** Returns the model currently in use. */
|
||||
TableListBoxModel* getModel() const noexcept { return model; }
|
||||
TableListBoxModel* getModel() const { return model; }
|
||||
|
||||
//==============================================================================
|
||||
/** Returns the header component being used in this table. */
|
||||
TableHeaderComponent& getHeader() const noexcept { return *header; }
|
||||
TableHeaderComponent& getHeader() const { return *header; }
|
||||
|
||||
/** Sets the header component to use for the table.
|
||||
The table will take ownership of the component that you pass in, and will delete it
|
||||
when it's no longer needed.
|
||||
The pointer passed in may not be null.
|
||||
*/
|
||||
void setHeader (TableHeaderComponent* newHeader);
|
||||
|
||||
@@ -248,7 +244,7 @@ public:
|
||||
/** Returns the height of the table header.
|
||||
@see setHeaderHeight
|
||||
*/
|
||||
int getHeaderHeight() const noexcept;
|
||||
int getHeaderHeight() const;
|
||||
|
||||
//==============================================================================
|
||||
/** Resizes a column to fit its contents.
|
||||
@@ -264,14 +260,15 @@ public:
|
||||
void autoSizeAllColumns();
|
||||
|
||||
/** Enables or disables the auto size options on the popup menu.
|
||||
|
||||
By default, these are enabled.
|
||||
*/
|
||||
void setAutoSizeMenuOptionShown (bool shouldBeShown) noexcept;
|
||||
void setAutoSizeMenuOptionShown (bool shouldBeShown);
|
||||
|
||||
/** True if the auto-size options should be shown on the menu.
|
||||
@see setAutoSizeMenuOptionShown
|
||||
@see setAutoSizeMenuOptionsShown
|
||||
*/
|
||||
bool isAutoSizeMenuOptionShown() const noexcept { return autoSizeOptionsShown; }
|
||||
bool isAutoSizeMenuOptionShown() const;
|
||||
|
||||
/** Returns the position of one of the cells in the table.
|
||||
|
||||
|
||||
@@ -591,8 +591,8 @@ void Toolbar::itemDragMove (const SourceDetails& dragSourceDetails)
|
||||
{
|
||||
const Rectangle<int> previousPos (animator.getComponentDestination (prev));
|
||||
|
||||
if (std::abs (dragObjectLeft - (vertical ? previousPos.getY() : previousPos.getX()))
|
||||
< std::abs (dragObjectRight - (vertical ? current.getBottom() : current.getRight())))
|
||||
if (abs (dragObjectLeft - (vertical ? previousPos.getY() : previousPos.getX())
|
||||
< abs (dragObjectRight - (vertical ? current.getBottom() : current.getRight()))))
|
||||
{
|
||||
newIndex = getIndexOfChildComponent (prev);
|
||||
}
|
||||
@@ -602,8 +602,8 @@ void Toolbar::itemDragMove (const SourceDetails& dragSourceDetails)
|
||||
{
|
||||
const Rectangle<int> nextPos (animator.getComponentDestination (next));
|
||||
|
||||
if (std::abs (dragObjectLeft - (vertical ? current.getY() : current.getX()))
|
||||
> std::abs (dragObjectRight - (vertical ? nextPos.getBottom() : nextPos.getRight())))
|
||||
if (abs (dragObjectLeft - (vertical ? current.getY() : current.getX())
|
||||
> abs (dragObjectRight - (vertical ? nextPos.getBottom() : nextPos.getRight()))))
|
||||
{
|
||||
newIndex = getIndexOfChildComponent (next) + 1;
|
||||
}
|
||||
|
||||
@@ -1773,11 +1773,6 @@ TreeViewItem* TreeViewItem::getNextVisibleItem (const bool recurse) const noexce
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
static String escapeSlashesInTreeViewItemName (const String& s)
|
||||
{
|
||||
return s.replaceCharacter ('/', '\\');
|
||||
}
|
||||
|
||||
String TreeViewItem::getItemIdentifierString() const
|
||||
{
|
||||
String s;
|
||||
@@ -1785,12 +1780,12 @@ String TreeViewItem::getItemIdentifierString() const
|
||||
if (parentItem != nullptr)
|
||||
s = parentItem->getItemIdentifierString();
|
||||
|
||||
return s + "/" + escapeSlashesInTreeViewItemName (getUniqueName());
|
||||
return s + "/" + getUniqueName().replaceCharacter ('/', '\\');
|
||||
}
|
||||
|
||||
TreeViewItem* TreeViewItem::findItemFromIdentifierString (const String& identifierString)
|
||||
{
|
||||
const String thisId ("/" + escapeSlashesInTreeViewItemName (getUniqueName()));
|
||||
const String thisId ("/" + getUniqueName());
|
||||
|
||||
if (thisId == identifierString)
|
||||
return this;
|
||||
|
||||
Reference in New Issue
Block a user