[Orxonox-commit 6388] r11045 - in code/branches/presentationHS15/src: libraries/core/command orxonox/overlays

landauf at orxonox.net landauf at orxonox.net
Tue Jan 5 11:00:32 CET 2016


Author: landauf
Date: 2016-01-05 11:00:32 +0100 (Tue, 05 Jan 2016)
New Revision: 11045

Modified:
   code/branches/presentationHS15/src/libraries/core/command/ArgumentCompletionFunctions.h
   code/branches/presentationHS15/src/orxonox/overlays/OverlayGroup.cc
Log:
added argument completion function for overlay groups

Modified: code/branches/presentationHS15/src/libraries/core/command/ArgumentCompletionFunctions.h
===================================================================
--- code/branches/presentationHS15/src/libraries/core/command/ArgumentCompletionFunctions.h	2016-01-05 08:13:31 UTC (rev 11044)
+++ code/branches/presentationHS15/src/libraries/core/command/ArgumentCompletionFunctions.h	2016-01-05 10:00:32 UTC (rev 11045)
@@ -160,8 +160,8 @@
     which wraps the defined function. This can be accessed by calling autocompletion::functionname();
 */
 #define ARGUMENT_COMPLETION_FUNCTION_DECLARATION(functionname) \
-    _CoreExport ArgumentCompleter* functionname(); \
-    _CoreExport ArgumentCompletionList acf_##functionname
+    ArgumentCompleter* functionname(); \
+    ArgumentCompletionList acf_##functionname
 
 /**
     @brief Used to implement an argument completion function.
@@ -195,16 +195,16 @@
 {
     namespace autocompletion
     {
-        ARGUMENT_COMPLETION_FUNCTION_DECLARATION(fallback)();
-        ARGUMENT_COMPLETION_FUNCTION_DECLARATION(groupsandcommands)(const std::string& fragment);
-        ARGUMENT_COMPLETION_FUNCTION_DECLARATION(subcommands)(const std::string& fragment, const std::string& group);
-        ARGUMENT_COMPLETION_FUNCTION_DECLARATION(command)(const std::string& fragment);
-        ARGUMENT_COMPLETION_FUNCTION_DECLARATION(hiddencommand)(const std::string& fragment);
-        ARGUMENT_COMPLETION_FUNCTION_DECLARATION(files)(const std::string& fragment);
-        ARGUMENT_COMPLETION_FUNCTION_DECLARATION(settingssections)();
-        ARGUMENT_COMPLETION_FUNCTION_DECLARATION(settingsentries)(const std::string& fragment, const std::string& section);
-        ARGUMENT_COMPLETION_FUNCTION_DECLARATION(settingsvalue)(const std::string& fragment, const std::string& entry, const std::string& section);
-        ARGUMENT_COMPLETION_FUNCTION_DECLARATION(tclthreads)();
+        _CoreExport ARGUMENT_COMPLETION_FUNCTION_DECLARATION(fallback)();
+        _CoreExport ARGUMENT_COMPLETION_FUNCTION_DECLARATION(groupsandcommands)(const std::string& fragment);
+        _CoreExport ARGUMENT_COMPLETION_FUNCTION_DECLARATION(subcommands)(const std::string& fragment, const std::string& group);
+        _CoreExport ARGUMENT_COMPLETION_FUNCTION_DECLARATION(command)(const std::string& fragment);
+        _CoreExport ARGUMENT_COMPLETION_FUNCTION_DECLARATION(hiddencommand)(const std::string& fragment);
+        _CoreExport ARGUMENT_COMPLETION_FUNCTION_DECLARATION(files)(const std::string& fragment);
+        _CoreExport ARGUMENT_COMPLETION_FUNCTION_DECLARATION(settingssections)();
+        _CoreExport ARGUMENT_COMPLETION_FUNCTION_DECLARATION(settingsentries)(const std::string& fragment, const std::string& section);
+        _CoreExport ARGUMENT_COMPLETION_FUNCTION_DECLARATION(settingsvalue)(const std::string& fragment, const std::string& entry, const std::string& section);
+        _CoreExport ARGUMENT_COMPLETION_FUNCTION_DECLARATION(tclthreads)();
     }
 }
 

Modified: code/branches/presentationHS15/src/orxonox/overlays/OverlayGroup.cc
===================================================================
--- code/branches/presentationHS15/src/orxonox/overlays/OverlayGroup.cc	2016-01-05 08:13:31 UTC (rev 11044)
+++ code/branches/presentationHS15/src/orxonox/overlays/OverlayGroup.cc	2016-01-05 10:00:32 UTC (rev 11045)
@@ -41,13 +41,28 @@
 
 namespace orxonox
 {
+    namespace autocompletion
+    {
+        /**
+            @brief Returns the names of all currently existing OverlayGroups.
+        */
+        ARGUMENT_COMPLETION_FUNCTION_DECLARATION(overlaygroupnames)();
+        ARGUMENT_COMPLETION_FUNCTION_IMPLEMENTATION(overlaygroupnames)()
+        {
+            ArgumentCompletionList names;
+            for (ObjectList<OverlayGroup>::iterator it = ObjectList<OverlayGroup>::begin(); it; ++it)
+                names.push_back(ArgumentCompletionListElement(it->getName(), getLowercase(it->getName())));
+            return names;
+        }
+    }
+
+    SetConsoleCommand("OverlayGroup", "toggleVisibility", &OverlayGroup::toggleVisibility).argumentCompleter(0, autocompletion::overlaygroupnames());
+    SetConsoleCommand("OverlayGroup", "show",             &OverlayGroup::show            ).argumentCompleter(0, autocompletion::overlaygroupnames());
+    SetConsoleCommand("OverlayGroup", "scaleGroup",       &OverlayGroup::scaleGroup      ).argumentCompleter(0, autocompletion::overlaygroupnames());
+    SetConsoleCommand("OverlayGroup", "scrollGroup",      &OverlayGroup::scrollGroup     ).argumentCompleter(0, autocompletion::overlaygroupnames());
+
     RegisterClass(OverlayGroup);
 
-    SetConsoleCommand("OverlayGroup", "toggleVisibility", &OverlayGroup::toggleVisibility);
-    SetConsoleCommand("OverlayGroup", "show", &OverlayGroup::show);
-    SetConsoleCommand("OverlayGroup", "scaleGroup",       &OverlayGroup::scaleGroup);
-    SetConsoleCommand("OverlayGroup", "scrollGroup",      &OverlayGroup::scrollGroup);
-
     OverlayGroup::OverlayGroup(Context* context)
         : BaseObject(context)
     {




More information about the Orxonox-commit mailing list