Skip to content
Browse files

Added documentation for EditorViewport

  • Loading branch information...
1 parent 796c79f commit e7f7f4fd5c5ac7dcc8e59c8fc3113054a2ddfa1e Josh Siegle committed Dec 26, 2012
View
9 Builds/MacOSX/open-ephys.xcodeproj/project.pbxproj
@@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
- objectVersion = 45;
+ objectVersion = 44;
objects = {
/* Begin PBXBuildFile section */
@@ -1059,6 +1059,8 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
+ ARCHS = "$(ARCHS_STANDARD_64_BIT_PRE_XCODE_3_1)";
+ ARCHS_STANDARD_64_BIT_PRE_XCODE_3_1 = x86_64;
DEBUG_INFORMATION_FORMAT = dwarf;
GCC_C_LANGUAGE_STANDARD = c99;
GCC_INLINES_ARE_PRIVATE_EXTERN = YES;
@@ -1079,6 +1081,8 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
+ ARCHS = "$(ARCHS_STANDARD_64_BIT_PRE_XCODE_3_1)";
+ ARCHS_STANDARD_64_BIT_PRE_XCODE_3_1 = x86_64;
DEBUG_INFORMATION_FORMAT = dwarf;
GCC_C_LANGUAGE_STANDARD = c99;
GCC_INLINES_ARE_PRIVATE_EXTERN = YES;
@@ -1131,7 +1135,8 @@
C3E8FB47D6069235EA9D6FD7 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
- ARCHS = "$(ONLY_ACTIVE_ARCH_PRE_XCODE_3_1)";
+ ARCHS = "$(ARCHS_STANDARD_64_BIT_PRE_XCODE_3_1)";
+ ARCHS_STANDARD_64_BIT_PRE_XCODE_3_1 = x86_64;
COPY_PHASE_STRIP = NO;
GCC_DYNAMIC_NO_PIC = NO;
GCC_ENABLE_FIX_AND_CONTINUE = NO;
View
BIN ....xcodeproj/project.xcworkspace/xcuserdata/Josh.xcuserdatad/UserInterfaceState.xcuserstate
Binary file not shown.
View
4 Source/Processors/Editors/SpikeDetectorEditor.cpp
@@ -249,7 +249,7 @@ void SpikeDetectorEditor::buttonEvent(Button* button)
drawElectrodeButtons(electrodeList->getNumItems()-1);
- getEditorViewport()->makeEditorVisibleAndUpdateSettings(this);
+ getEditorViewport()->makeEditorVisible(this, true, true);
return;
} else if (button == electrodeEditorButtons[0]) // EDIT
@@ -301,7 +301,7 @@ void SpikeDetectorEditor::buttonEvent(Button* button)
removeElectrode(electrodeList->getSelectedItemIndex());
- getEditorViewport()->makeEditorVisibleAndUpdateSettings(this);
+ getEditorViewport()->makeEditorVisible(this, true, true);
return;
}
View
4 Source/UI/ControlPanel.h
@@ -296,13 +296,13 @@ class ControlPanel : public Component,
AccessClass* getAudioEditor() {return (AccessClass*) audioEditor;}
/** Sets whether or not the FilenameComponent is visible.*/
- void openState(bool);
+ void openState(bool isOpen);
/** Toggles the visibility of the FilenameComponent.*/
void toggleState();
/** Used to manually turn recording on and off.*/
- void setRecordState(bool t);
+ void setRecordState(bool isRecording);
/** Returns a boolean that indicates whether or not the FilenameComponet
is visible. */
View
38 Source/UI/EditorViewport.cpp
@@ -68,7 +68,6 @@ EditorViewport::EditorViewport()
EditorViewport::~EditorViewport()
{
- // deleteAndZero(signalChainManager);
deleteAllChildren();
}
@@ -261,13 +260,17 @@ void EditorViewport::clearSignalChain()
repaint();
}
-void EditorViewport::makeEditorVisible(GenericEditor* editor, bool highlight)
+void EditorViewport::makeEditorVisible(GenericEditor* editor, bool highlight, bool updateSettings)
{
if (editor == 0)
return;
- signalChainManager->updateVisibleEditors(editor, 0, 0, ACTIVATE);
+ if (!updateSettings)
+ signalChainManager->updateVisibleEditors(editor, 0, 0, ACTIVATE);
+ else
+ signalChainManager->updateVisibleEditors(editor, 0, 0, UPDATE);
+
refreshEditors();
for (int i = 0; i < editorArray.size(); i++)
@@ -280,25 +283,6 @@ void EditorViewport::makeEditorVisible(GenericEditor* editor, bool highlight)
}
-
-void EditorViewport::makeEditorVisibleAndUpdateSettings(GenericEditor* editor)
-{
-
- if (editor == 0)
- return;
-
- signalChainManager->updateVisibleEditors(editor, 0, 0, UPDATE);
- refreshEditors();
-
- for (int i = 0; i < editorArray.size(); i++)
- {
- editorArray[i]->deselect();
- }
-
- editor->highlight();
-
-}
-
void EditorViewport::deleteNode (GenericEditor* editor) {
if (canEdit) {
@@ -311,16 +295,6 @@ void EditorViewport::deleteNode (GenericEditor* editor) {
getProcessorGraph()->removeProcessor((GenericProcessor*) editor->getProcessor());
}
-
- // int64 t1 = Time::currentTimeMillis();
- // int64 t2 = t1;
-
- // // pause for 50 ms so multiple editors are not accidentally deleted
- // while (t2 < t1+50)
- // {
- // t2 = Time::currentTimeMillis();
- // }
-
}
View
105 Source/UI/EditorViewport.h
@@ -47,6 +47,15 @@ class SignalChainScrollButton;
Allows the user to view and edit the signal chain.
The EditorViewport is one of the most important classes in the GUI application.
+ Dragging processors from the ProcessorList adds them to the signal chain. The
+ newly added processor appears as an editor in the EditorViewport, which allows
+ the user to edit the parameters of that processor. Deleting the editor from the
+ EditorViewport removes it from the signal chain. Moving an editor (by dragging
+ and dropping within the EditorViewport) rearranges the order of processing.
+
+ The EditorViewport can be used to browse through multiple parallel signal chains
+ (by clicking the buttons on the far left), or to navigate around branching
+ signal chains.
@see UIComponent, ProcessorGraph
@@ -60,45 +69,77 @@ class EditorViewport : public Component,
{
public:
- /** Constructor. */
+ /** Constructor. Adds the buttons for browsing through the signal chains.*/
EditorViewport();
/** Destructor. */
~EditorViewport();
+ /** Draws the background of the EditorViewport. */
void paint (Graphics& g);
- // Creating and deleting editors:
+ /** Removes the processor associated with a given editor. */
void deleteNode(GenericEditor* editor);
- void selectEditor(GenericEditor* e);
- void makeEditorVisible(GenericEditor* e, bool highlight = true);
- void makeEditorVisibleAndUpdateSettings(GenericEditor* e);
+ /** Removes the processor associated with a given editor. */
+ void selectEditor(GenericEditor* editor);
+
+ /** Ensures that the user can see the requested editor. */
+ void makeEditorVisible(GenericEditor* editor, bool highlight = true, bool updateSettings = false);
+
+ /** Updates the boundaries and visibility of all the editors in the signal chain. */
void refreshEditors();
+ /** Removes all processors from the signal chain(s).*/
void clearSignalChain();
- void signalChainCanBeEdited(bool t);
+ /** Used to enable and disable drag-and-drop signal chain editing. Called by the
+ ProcessorGraph when data acquisition begins and ends. */
+ void signalChainCanBeEdited(bool canEdit);
- // DragAndDropTarget methods:
- bool isInterestedInDragSource (const String& /*sourceDescription*/, Component* /*sourceComponent*/);
- void itemDragEnter (const String& /*sourceDescription*/, Component* /*sourceComponent*/, int /*x*/, int /*y*/);
- void itemDragMove (const String& /*sourceDescription*/, Component* /*sourceComponent*/, int /*x*/, int /*y*/);
- void itemDragExit (const String& /*sourceDescription*/, Component* /*sourceComponent*/);
- void itemDropped (const String& sourceDescription, Component* /*sourceComponent*/, int /*x*/, int /*y*/);
+ /** Determines whether or not the EditorViewport should respond to
+ the component that is currently being dragged. */
+ bool isInterestedInDragSource (const String& sourceDescription, Component* sourceComponent);
+
+ /** Called when a dragged item (usually a name from the ProcessorList) enters the
+ boundaries of the EditorViewport. Causes the background of the EditorViewport to change color.*/
+ void itemDragEnter (const String& sourceDescription, Component* sourceComponent, int x, int y);
+
+ /** Called when a dragged item (usually a name from the ProcessorList) moves within the
+ boundaries of the EditorViewport. Causes existing editors (if any) to shift their position
+ to make room for the new processor that could be dropped.*/
+ void itemDragMove (const String& sourceDescription, Component* sourceComponent, int x, int y);
+
+ /** Called when a dragged item (usually a name from the ProcessorList) leaves the
+ boundaries of the EditorViewport. Causes the background of the EditorViewport to change color.*/
+ void itemDragExit (const String& sourceDescription, Component* sourceComponent);
+
+ /** Called when a dragged item (usually a name from the ProcessorList) is released within the
+ boundaries of the EditorViewport. Adds the dropped processor to the signal chain.*/
+ void itemDropped (const String& sourceDescription, Component* sourceComponent, int x, int y);
- // mouse and keypress methods:
+ /** Called when a mouse click begins within the EditorViewport. Usually used to select editors.*/
void mouseDown(const MouseEvent &e);
+
+ /** Called when a mouse drag occurs within the EditorViewport. Usually used to move editors around in the signal chain.*/
void mouseDrag(const MouseEvent &e);
+
+ /** Called when a mouse click ends within the EditorViewport. Usually used to indicate that a moving editor has been dropped.*/
void mouseUp(const MouseEvent &e);
+
+ /** Called when the mouse leaves the boundaries of the EditorViewport.*/
void mouseExit(const MouseEvent &e);
- //void mouseEnter(const MouseEvent &e);
- //void mouseExit
- //void modifierKeysChanged (const ModifierKeys & modifiers);
+
+ /** Called when a key is pressed an the EditorViewport has keyboard focus.*/
bool keyPressed (const KeyPress &key);
+
+ /** Changes which editor is selected, depending on the keypress (and modifier keys).*/
void moveSelection( const KeyPress &key);
+
+ /** Called when one of the buttons the EditorViewport listens to has been clicked.*/
void buttonClicked(Button* button);
+ /** Returns an array of pointers to SignalChainTabButtons (which themselves hold pointers to the sources of each signal chain). */
Array<SignalChainTabButton*, CriticalSection> requestSignalChain() {return signalChainArray;}
/** Save the current configuration as an XML file. */
@@ -107,13 +148,19 @@ class EditorViewport : public Component,
/** Load a saved configuration from an XML file. */
const String loadState();
+ /** Converts information about a given editor to XML. */
XmlElement* createNodeXml(GenericEditor*, int);
+
+ /** Converts information about a splitter or merge to XML. */
XmlElement* switchNodeXml(GenericProcessor*);
+ /** Checks whether or not the signal chain scroll buttons need to be activated. */
void checkScrollButtons(int topTab);
+ /** Returns a boolean indicating whether or not the signal chain is empty. */
bool isSignalChainEmpty();
+ /** The index of the left-most editor (used for scrolling purposes). */
int leftmostEditor;
File currentFile;
@@ -138,9 +185,6 @@ class EditorViewport : public Component,
Font font;
Image sourceDropImage;
- void createNewTab(GenericEditor* editor);
- void removeTab(int tabIndex);
-
int borderSize, tabSize, tabButtonSize;
int insertionPoint;
@@ -164,19 +208,40 @@ class EditorViewport : public Component,
};
+/**
+
+ Allows the user to navigate between multiple parallel signal chains.
+
+ Each SignalChainTabButton sits on the left-hand side of the EditorViewport
+ and is associated with a given signal chain. Clicking the tab button makes
+ the editors for its signal chain visible.
+
+ @see EditorViewport
+
+*/
+
class SignalChainTabButton : public Button
{
public:
SignalChainTabButton();
~SignalChainTabButton() {}
+ /** Determines the first editor in the signal chain associated with a SignalChainTabButton.*/
void setEditor(GenericEditor* p) {firstEditor = p;}
+
+ /** Sets the SignalChainManager for this SignalChainTabButton.*/
void setManager(SignalChainManager* scm_) {scm = scm_;}
+
+ /** Returns the editor associated with this SignalChainTabButton.*/
GenericEditor* getEditor() {return firstEditor;}
+ /** Sets the number of this SignalChainTabButton.*/
void setNumber(int n) {num = n;}
+ /** Returns the state of the configurationChanged variable.*/
bool hasNewConnections() {return configurationChanged;}
+
+ /** Sets the state of the configurationChanged variable.*/
void hasNewConnections(bool t) {configurationChanged = t;}
int offset;
@@ -187,8 +252,10 @@ class SignalChainTabButton : public Button
SignalChainManager* scm;
+ /** Draws the SignalChainTabButton.*/
void paintButton(Graphics &g, bool isMouseOver, bool isButtonDown);
+ /** Called when a mouse click occurs inside a SignalChainTabButton.*/
void clicked();
enum actions {ADD, MOVE, REMOVE, ACTIVATE};
View
18 Source/UI/SignalChainManager.h
@@ -52,24 +52,42 @@ class SignalChainManager : AccessClass
Array<SignalChainTabButton*, CriticalSection>&);
~SignalChainManager();
+ /** Updates the editors currently displayed by the EditorViewport.*/
void updateVisibleEditors(GenericEditor* activeEditor, int index, int insertionPoint, int action);
+ /** Creates a tab button for a new signal chain. */
void createNewTab(GenericEditor* editor);
+
+ /** Removes the tab button for a deleted signal chain. */
void removeTab(int tabIndex);
+
+ /** Scrolls the SignalChainTabButtons up, if there are more signal chains
+ than can be viewed at once.*/
void scrollUp();
+
+ /** Scrolls the SignalChainTabButtons down, if there are more signal chains
+ than can be viewed at once.*/
void scrollDown();
+ /** Clears the signal chain.*/
void clearSignalChain();
private:
+ /** An array of all currently visible editors.*/
Array<GenericEditor*, CriticalSection>& editorArray;
+
+ /** An array of all existing signal chains (as referenced by their associated
+ SignalChainTabButtons).*/
Array<SignalChainTabButton*, CriticalSection>& signalChainArray;
+ /** A pointer to the EditorViewport.*/
EditorViewport* ev;
+ /** Updates the visibility of SignalChainTabButtons.*/
void refreshTabs();
+ /** The index of the top tab (used for scrolling purposes).*/
int topTab;
const int tabSize;

0 comments on commit e7f7f4f

Please sign in to comment.
Something went wrong with that request. Please try again.