- 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:
@@ -22,7 +22,7 @@
|
||||
==============================================================================
|
||||
*/
|
||||
|
||||
MenuBarComponent::MenuBarComponent (MenuBarModel* m)
|
||||
MenuBarComponent::MenuBarComponent (MenuBarModel* model_)
|
||||
: model (nullptr),
|
||||
itemUnderMouse (-1),
|
||||
currentPopupIndex (-1),
|
||||
@@ -32,7 +32,7 @@ MenuBarComponent::MenuBarComponent (MenuBarModel* m)
|
||||
setWantsKeyboardFocus (false);
|
||||
setMouseClickGrabsKeyboardFocus (false);
|
||||
|
||||
setModel (m);
|
||||
setModel (model_);
|
||||
}
|
||||
|
||||
MenuBarComponent::~MenuBarComponent()
|
||||
@@ -284,26 +284,22 @@ void MenuBarComponent::mouseMove (const MouseEvent& e)
|
||||
|
||||
bool MenuBarComponent::keyPressed (const KeyPress& key)
|
||||
{
|
||||
bool used = false;
|
||||
const int numMenus = menuNames.size();
|
||||
const int currentIndex = jlimit (0, menuNames.size() - 1, currentPopupIndex);
|
||||
|
||||
if (numMenus > 0)
|
||||
if (key.isKeyCode (KeyPress::leftKey))
|
||||
{
|
||||
const int currentIndex = jlimit (0, numMenus - 1, currentPopupIndex);
|
||||
|
||||
if (key.isKeyCode (KeyPress::leftKey))
|
||||
{
|
||||
showMenu ((currentIndex + numMenus - 1) % numMenus);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (key.isKeyCode (KeyPress::rightKey))
|
||||
{
|
||||
showMenu ((currentIndex + 1) % numMenus);
|
||||
return true;
|
||||
}
|
||||
showMenu ((currentIndex + numMenus - 1) % numMenus);
|
||||
used = true;
|
||||
}
|
||||
else if (key.isKeyCode (KeyPress::rightKey))
|
||||
{
|
||||
showMenu ((currentIndex + 1) % numMenus);
|
||||
used = true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return used;
|
||||
}
|
||||
|
||||
void MenuBarComponent::menuBarItemsChanged (MenuBarModel* /*menuBarModel*/)
|
||||
|
||||
@@ -40,9 +40,9 @@ public:
|
||||
//==============================================================================
|
||||
/** Creates a menu bar.
|
||||
|
||||
@param model the model object to use to control this bar. You can
|
||||
pass nullptr into this if you like, and set the model
|
||||
later using the setModel() method
|
||||
@param model the model object to use to control this bar. You can
|
||||
pass 0 into this if you like, and set the model later
|
||||
using the setModel() method
|
||||
*/
|
||||
MenuBarComponent (MenuBarModel* model);
|
||||
|
||||
@@ -57,7 +57,8 @@ public:
|
||||
*/
|
||||
void setModel (MenuBarModel* newModel);
|
||||
|
||||
/** Returns the current menu bar model being used. */
|
||||
/** Returns the current menu bar model being used.
|
||||
*/
|
||||
MenuBarModel* getModel() const noexcept;
|
||||
|
||||
//==============================================================================
|
||||
|
||||
@@ -80,7 +80,8 @@ public:
|
||||
virtual ~Listener() {}
|
||||
|
||||
//==============================================================================
|
||||
/** This callback is made when items are changed in the menu bar model. */
|
||||
/** This callback is made when items are changed in the menu bar model.
|
||||
*/
|
||||
virtual void menuBarItemsChanged (MenuBarModel* menuBarModel) = 0;
|
||||
|
||||
/** This callback is made when an application command is invoked that
|
||||
@@ -100,6 +101,7 @@ public:
|
||||
void addListener (Listener* listenerToAdd) noexcept;
|
||||
|
||||
/** Removes a listener.
|
||||
|
||||
@see addListener
|
||||
*/
|
||||
void removeListener (Listener* listenerToRemove) noexcept;
|
||||
@@ -128,7 +130,7 @@ public:
|
||||
|
||||
//==============================================================================
|
||||
#if JUCE_MAC || DOXYGEN
|
||||
/** OSX ONLY - Sets the model that is currently being shown as the main
|
||||
/** MAC ONLY - Sets the model that is currently being shown as the main
|
||||
menu bar at the top of the screen on the Mac.
|
||||
|
||||
You can pass 0 to stop the current model being displayed. Be careful
|
||||
@@ -149,12 +151,12 @@ public:
|
||||
const PopupMenu* extraAppleMenuItems = nullptr,
|
||||
const String& recentItemsMenuName = String::empty);
|
||||
|
||||
/** OSX ONLY - Returns the menu model that is currently being shown as
|
||||
/** MAC ONLY - Returns the menu model that is currently being shown as
|
||||
the main menu bar.
|
||||
*/
|
||||
static MenuBarModel* getMacMainMenu();
|
||||
|
||||
/** OSX ONLY - Returns the menu that was last passed as the extraAppleMenuItems
|
||||
/** MAC ONLY - Returns the menu that was last passed as the extraAppleMenuItems
|
||||
argument to setMacMainMenu(), or nullptr if none was specified.
|
||||
*/
|
||||
static const PopupMenu* getMacExtraAppleItemsMenu();
|
||||
@@ -162,7 +164,7 @@ public:
|
||||
|
||||
//==============================================================================
|
||||
/** @internal */
|
||||
void applicationCommandInvoked (const ApplicationCommandTarget::InvocationInfo&) override;
|
||||
void applicationCommandInvoked (const ApplicationCommandTarget::InvocationInfo& info) override;
|
||||
/** @internal */
|
||||
void applicationCommandListChanged() override;
|
||||
/** @internal */
|
||||
@@ -170,7 +172,7 @@ public:
|
||||
|
||||
private:
|
||||
ApplicationCommandManager* manager;
|
||||
ListenerList<Listener> listeners;
|
||||
ListenerList <Listener> listeners;
|
||||
|
||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MenuBarModel)
|
||||
};
|
||||
|
||||
@@ -1216,7 +1216,12 @@ public:
|
||||
|
||||
void paint (Graphics& g) override
|
||||
{
|
||||
getLookAndFeel().drawPopupMenuSectionHeader (g, getLocalBounds(), getName());
|
||||
g.setFont (getLookAndFeel().getPopupMenuFont().boldened());
|
||||
g.setColour (findColour (PopupMenu::headerTextColourId));
|
||||
|
||||
g.drawFittedText (getName(),
|
||||
12, 0, getWidth() - 16, proportionOfHeight (0.8f),
|
||||
Justification::bottomLeft, 1);
|
||||
}
|
||||
|
||||
void getIdealSize (int& idealWidth, int& idealHeight)
|
||||
|
||||
@@ -562,9 +562,6 @@ public:
|
||||
const Drawable* icon,
|
||||
const Colour* textColour) = 0;
|
||||
|
||||
virtual void drawPopupMenuSectionHeader (Graphics&, const Rectangle<int>& area,
|
||||
const String& sectionName) = 0;
|
||||
|
||||
/** Returns the size and style of font to use in popup menus. */
|
||||
virtual Font getPopupMenuFont() = 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user