1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Cleaned up some ints that should have been CommandIDs.

This commit is contained in:
jules 2013-09-17 18:45:48 +01:00
parent 58f4a38ad8
commit 57db92b276
9 changed files with 61 additions and 55 deletions

View file

@ -27,32 +27,35 @@
*/ */
namespace JucerCommandIDs namespace JucerCommandIDs
{ {
static const int test = 0xf20009; enum
static const int toFront = 0xf2000a; {
static const int toBack = 0xf2000b; test = 0xf20009,
toFront = 0xf2000a,
toBack = 0xf2000b,
static const int group = 0xf20017; group = 0xf20017,
static const int ungroup = 0xf20018; ungroup = 0xf20018,
static const int showGrid = 0xf2000e; showGrid = 0xf2000e,
static const int enableSnapToGrid = 0xf2000f; enableSnapToGrid = 0xf2000f,
static const int editCompLayout = 0xf20010; editCompLayout = 0xf20010,
static const int editCompGraphics = 0xf20011; editCompGraphics = 0xf20011,
static const int bringBackLostItems = 0xf20012; bringBackLostItems = 0xf20012,
static const int zoomIn = 0xf20013; zoomIn = 0xf20013,
static const int zoomOut = 0xf20014; zoomOut = 0xf20014,
static const int zoomNormal = 0xf20015; zoomNormal = 0xf20015,
static const int spaceBarDrag = 0xf20016; spaceBarDrag = 0xf20016,
static const int compOverlay0 = 0xf20020; compOverlay0 = 0xf20020,
static const int compOverlay33 = 0xf20021; compOverlay33 = 0xf20021,
static const int compOverlay66 = 0xf20022; compOverlay66 = 0xf20022,
static const int compOverlay100 = 0xf20023; compOverlay100 = 0xf20023,
static const int newDocumentBase = 0xf32001; newDocumentBase = 0xf32001,
static const int newComponentBase = 0xf30001; newComponentBase = 0xf30001,
static const int newElementBase = 0xf31001; newElementBase = 0xf31001
};
} }

View file

@ -45,8 +45,8 @@ Button::Button (const String& name)
autoRepeatSpeed (0), autoRepeatSpeed (0),
autoRepeatMinimumDelay (-1), autoRepeatMinimumDelay (-1),
radioGroupId (0), radioGroupId (0),
commandID (0),
connectedEdgeFlags (0), connectedEdgeFlags (0),
commandID(),
buttonState (buttonNormal), buttonState (buttonNormal),
lastToggleState (false), lastToggleState (false),
clickTogglesState (false), clickTogglesState (false),
@ -464,7 +464,7 @@ void Button::parentHierarchyChanged()
//============================================================================== //==============================================================================
void Button::setCommandToTrigger (ApplicationCommandManager* const newCommandManager, void Button::setCommandToTrigger (ApplicationCommandManager* const newCommandManager,
const int newCommandID, const bool generateTip) const CommandID newCommandID, const bool generateTip)
{ {
commandID = newCommandID; commandID = newCommandID;
generateTooltip = generateTip; generateTooltip = generateTip;

View file

@ -212,11 +212,11 @@ public:
@see addShortcut, getCommandID @see addShortcut, getCommandID
*/ */
void setCommandToTrigger (ApplicationCommandManager* commandManagerToUse, void setCommandToTrigger (ApplicationCommandManager* commandManagerToUse,
int commandID, CommandID commandID,
bool generateTooltip); bool generateTooltip);
/** Returns the command ID that was set by setCommandToTrigger(). */ /** Returns the command ID that was set by setCommandToTrigger(). */
int getCommandID() const noexcept { return commandID; } CommandID getCommandID() const noexcept { return commandID; }
//============================================================================== //==============================================================================
/** Assigns a shortcut key to trigger the button. /** Assigns a shortcut key to trigger the button.
@ -457,7 +457,8 @@ private:
uint32 buttonPressTime, lastRepeatTime; uint32 buttonPressTime, lastRepeatTime;
ApplicationCommandManager* commandManagerToUse; ApplicationCommandManager* commandManagerToUse;
int autoRepeatDelay, autoRepeatSpeed, autoRepeatMinimumDelay; int autoRepeatDelay, autoRepeatSpeed, autoRepeatMinimumDelay;
int radioGroupId, commandID, connectedEdgeFlags; int radioGroupId, connectedEdgeFlags;
CommandID commandID;
ButtonState buttonState; ButtonState buttonState;
Value isOn; Value isOn;

View file

@ -51,37 +51,40 @@ typedef int CommandID;
*/ */
namespace StandardApplicationCommandIDs namespace StandardApplicationCommandIDs
{ {
/** This command ID should be used to send a "Quit the App" command. enum
{
/** This command ID should be used to send a "Quit the App" command.
This command is recognised by the JUCEApplication class, so if it is invoked This command is recognised by the JUCEApplication class, so if it is invoked
and no other ApplicationCommandTarget handles the event first, the JUCEApplication and no other ApplicationCommandTarget handles the event first, the JUCEApplication
object will catch it and call JUCEApplicationBase::systemRequestedQuit(). object will catch it and call JUCEApplicationBase::systemRequestedQuit().
*/ */
static const CommandID quit = 0x1001; quit = 0x1001,
/** The command ID that should be used to send a "Delete" command. */ /** The command ID that should be used to send a "Delete" command. */
static const CommandID del = 0x1002; del = 0x1002,
/** The command ID that should be used to send a "Cut" command. */ /** The command ID that should be used to send a "Cut" command. */
static const CommandID cut = 0x1003; cut = 0x1003,
/** The command ID that should be used to send a "Copy to clipboard" command. */ /** The command ID that should be used to send a "Copy to clipboard" command. */
static const CommandID copy = 0x1004; copy = 0x1004,
/** The command ID that should be used to send a "Paste from clipboard" command. */ /** The command ID that should be used to send a "Paste from clipboard" command. */
static const CommandID paste = 0x1005; paste = 0x1005,
/** The command ID that should be used to send a "Select all" command. */ /** The command ID that should be used to send a "Select all" command. */
static const CommandID selectAll = 0x1006; selectAll = 0x1006,
/** The command ID that should be used to send a "Deselect all" command. */ /** The command ID that should be used to send a "Deselect all" command. */
static const CommandID deselectAll = 0x1007; deselectAll = 0x1007,
/** The command ID that should be used to send a "undo" command. */ /** The command ID that should be used to send a "undo" command. */
static const CommandID undo = 0x1008; undo = 0x1008,
/** The command ID that should be used to send a "redo" command. */ /** The command ID that should be used to send a "redo" command. */
static const CommandID redo = 0x1009; redo = 0x1009
};
} }

View file

@ -22,9 +22,8 @@
============================================================================== ==============================================================================
*/ */
ApplicationCommandInfo::ApplicationCommandInfo (const CommandID commandID_) noexcept ApplicationCommandInfo::ApplicationCommandInfo (const CommandID cid) noexcept
: commandID (commandID_), : commandID (cid), flags (0)
flags (0)
{ {
} }

View file

@ -1302,7 +1302,7 @@ void PopupMenu::addItem (const int itemResultID, const String& itemText,
} }
void PopupMenu::addCommandItem (ApplicationCommandManager* commandManager, void PopupMenu::addCommandItem (ApplicationCommandManager* commandManager,
const int commandID, const CommandID commandID,
const String& displayName) const String& displayName)
{ {
jassert (commandManager != nullptr && commandID != 0); jassert (commandManager != nullptr && commandID != 0);

View file

@ -133,7 +133,7 @@ public:
the command's registered name the command's registered name
*/ */
void addCommandItem (ApplicationCommandManager* commandManager, void addCommandItem (ApplicationCommandManager* commandManager,
int commandID, CommandID commandID,
const String& displayName = String::empty); const String& displayName = String::empty);

View file

@ -1267,7 +1267,7 @@ bool CodeEditorComponent::perform (const InvocationInfo& info)
return performCommand (info.commandID); return performCommand (info.commandID);
} }
bool CodeEditorComponent::performCommand (const int commandID) bool CodeEditorComponent::performCommand (const CommandID commandID)
{ {
switch (commandID) switch (commandID)
{ {

View file

@ -408,7 +408,7 @@ private:
void cut(); void cut();
void indentSelectedLines (int spacesToAdd); void indentSelectedLines (int spacesToAdd);
bool skipBackwardsToPreviousTab(); bool skipBackwardsToPreviousTab();
bool performCommand (int); bool performCommand (CommandID);
int indexToColumn (int line, int index) const noexcept; int indexToColumn (int line, int index) const noexcept;
int columnToIndex (int line, int column) const noexcept; int columnToIndex (int line, int column) const noexcept;