| author | Sam Spilsbury <smspillaz@gmail.com> | 2009-11-27 04:38:23 (GMT) |
|---|---|---|
| committer | Sam Spilsbury <smspillaz@gmail.com> | 2009-11-27 04:38:23 (GMT) |
| commit | 7caf74dcc465a914168184acb325c2d331c09ed9 (patch) (side-by-side diff) | |
| tree | 9572cd9f0733718006e58f27472c0be3c219d26f | |
| parent | cd3cc22c57bae95f232db324b63bebc6bd4334c5 (diff) | |
| download | elements-7caf74dcc465a914168184acb325c2d331c09ed9.tar.gz elements-7caf74dcc465a914168184acb325c2d331c09ed9.tar.bz2 | |
Add framework to toggle certain element types and add relevant actions to elements sub-plugins. Also kill some debug messages and s/TRUE/true s/FALSE/false s/Bool/bool
| -rwxr-xr-x | elements.xml.in | 5 | ||||
| -rw-r--r-- | plugins/autumn/autumn.xml.in | 7 | ||||
| -rw-r--r-- | plugins/autumn/src/autumn.cpp | 37 | ||||
| -rw-r--r-- | plugins/autumn/src/autumn.h | 5 | ||||
| -rw-r--r-- | plugins/bubbles/bubbles.xml.in | 5 | ||||
| -rw-r--r-- | plugins/bubbles/src/bubbles.cpp | 40 | ||||
| -rw-r--r-- | plugins/bubbles/src/bubbles.h | 5 | ||||
| -rw-r--r-- | plugins/fireflies/fireflies.xml.in | 11 | ||||
| -rw-r--r-- | plugins/fireflies/src/fireflies.cpp | 41 | ||||
| -rw-r--r-- | plugins/fireflies/src/fireflies.h | 5 | ||||
| -rw-r--r-- | plugins/snow/snow.xml.in | 5 | ||||
| -rw-r--r-- | plugins/snow/src/snow.cpp | 39 | ||||
| -rw-r--r-- | plugins/snow/src/snow.h | 5 | ||||
| -rw-r--r-- | plugins/stars/src/stars.cpp | 42 | ||||
| -rw-r--r-- | plugins/stars/src/stars.h | 5 | ||||
| -rw-r--r-- | plugins/stars/stars.xml.in | 5 | ||||
| -rw-r--r-- | src/elements.cpp | 181 | ||||
| -rw-r--r-- | src/private.h | 4 | ||||
| -rw-r--r-- | src/type.cpp | 2 |
19 files changed, 366 insertions, 83 deletions
diff --git a/elements.xml.in b/elements.xml.in index 0b8f0d2..858caf1 100755 --- a/elements.xml.in +++ b/elements.xml.in @@ -37,6 +37,11 @@ <_short>Toggle Selected Element</_short> <_long>Select the Next Element in the list</_long> </option> + <option name="toggle_name" type="action"> + <_short>Toggle Name</_short> + <_long>Toggle an Element by Name. Use the Option "type"</_long> + <allowed/> + </option> </group> <group> <_short>General</_short> diff --git a/plugins/autumn/autumn.xml.in b/plugins/autumn/autumn.xml.in index 1f4efe1..51332b6 100644 --- a/plugins/autumn/autumn.xml.in +++ b/plugins/autumn/autumn.xml.in @@ -14,7 +14,12 @@ </deps> <options> <group> - <_short>Autumn</_short> + <_short>Autumn</_short> + <option name="toggle_autumn" type="key"> + <_short>Toggle all autumn elements</_short> + <_long>Toggle all autumn elements defined in the elements + list</_long> + </option> <option name="x_sway" type="float"> <_short>Sway Of leaves</_short> <_long>sway of leaves</_long> diff --git a/plugins/autumn/src/autumn.cpp b/plugins/autumn/src/autumn.cpp index 27a33ea..3473ca1 100644 --- a/plugins/autumn/src/autumn.cpp +++ b/plugins/autumn/src/autumn.cpp @@ -65,8 +65,6 @@ AutumnElement::move () ELEMENTS_SCREEN (screen); - //fprintf (stderr, "autumnFloat is %f\n", autumnFloat[0][autumnAge[1]]); - x += (autumnFloat[0][autumnAge[0]] * (float) es->updateDelay ()) / 80; y += (autumnFloat[1][autumnAge[1]] * (float) es->updateDelay ()) / 80 + autumnSpeed; @@ -92,6 +90,39 @@ AutumnElement::move () } } +bool +AutumnScreen::toggle (CompAction *action, + CompAction::State state, + CompOption::Vector &options) +{ + CompPlugin *p = CompPlugin::find ("elements"); + + if (!p) + return true; + + options = p->vTable->getOptions (); + + foreach (CompOption opt, options) + { + if (opt.type () == CompOption::TypeAction && + opt.name () == "toggle_name") + { + CompOption o; + CompOption::Vector newOptions = options; + + o.setName ("type", CompOption::TypeString); + o.value ().set ("autumn"); + + newOptions.push_back (o); + + opt.value ().action ().initiate () (action, state, newOptions); + + break; + } + } + + return false; +} void AutumnElement::fini () @@ -103,6 +134,8 @@ AutumnScreen::AutumnScreen (CompScreen *) : { type = ElementType::create ("autumn", "Autumn", AutumnElement::create); + optionSetToggleAutumnInitiate (AutumnScreen::toggle); + if (!type) setFailed (); } diff --git a/plugins/autumn/src/autumn.h b/plugins/autumn/src/autumn.h index 5dec8ba..7319f9e 100644 --- a/plugins/autumn/src/autumn.h +++ b/plugins/autumn/src/autumn.h @@ -60,6 +60,11 @@ class AutumnScreen : AutumnScreen (CompScreen *); ~AutumnScreen (); + static bool + toggle (CompAction *, + CompAction::State, + CompOption::Vector &); + ElementType *type; }; diff --git a/plugins/bubbles/bubbles.xml.in b/plugins/bubbles/bubbles.xml.in index b4dc65b..63ff969 100644 --- a/plugins/bubbles/bubbles.xml.in +++ b/plugins/bubbles/bubbles.xml.in @@ -15,6 +15,11 @@ <options> <group> <_short>Bubbles</_short> + <option name="toggle_bubble" type="key"> + <_short>Toggle all bubbles elements</_short> + <_long>Toggle all bubbles elements defined in the elements + list</_long> + </option> <option name="viscosity" type="float"> <_short>Viscosity of liquid</_short> <_long>Viscosity of liquid</_long> diff --git a/plugins/bubbles/src/bubbles.cpp b/plugins/bubbles/src/bubbles.cpp index 8cf20b0..59ef17e 100644 --- a/plugins/bubbles/src/bubbles.cpp +++ b/plugins/bubbles/src/bubbles.cpp @@ -81,10 +81,50 @@ BubbleElement::fini () { } +bool +BubbleScreen::toggle (CompAction *action, + CompAction::State state, + CompOption::Vector &options) +{ + CompPlugin *p = CompPlugin::find ("elements"); + + if (!p) + return true; + + options = p->vTable->getOptions (); + + foreach (CompOption opt, options) + { + if (opt.type () == CompOption::TypeAction && + opt.name () == "toggle_name") + { + CompOption o; + CompOption::Vector newOptions = options; + + o.setName ("type", CompOption::TypeString); + o.value ().set ("bubbles"); + + newOptions.push_back (o); + + opt.value ().action ().initiate () (action, state, newOptions); + + break; + } + } + + return false; +} + + BubbleScreen::BubbleScreen (CompScreen *screen) : PluginClassHandler <BubbleScreen, CompScreen> (screen) { type = ElementType::create ("bubbles", "Bubble", BubbleElement::create); + + optionSetToggleBubbleInitiate (BubbleScreen::toggle); + + if (!type) + setFailed (); } BubbleScreen::~BubbleScreen () diff --git a/plugins/bubbles/src/bubbles.h b/plugins/bubbles/src/bubbles.h index 750a06a..20f9da9 100644 --- a/plugins/bubbles/src/bubbles.h +++ b/plugins/bubbles/src/bubbles.h @@ -60,6 +60,11 @@ class BubbleScreen : BubbleScreen (CompScreen *); ~BubbleScreen (); + static bool + toggle (CompAction *, + CompAction::State, + CompOption::Vector &); + ElementType *type; }; diff --git a/plugins/fireflies/fireflies.xml.in b/plugins/fireflies/fireflies.xml.in index 3090d1b..ef5d387 100644 --- a/plugins/fireflies/fireflies.xml.in +++ b/plugins/fireflies/fireflies.xml.in @@ -12,6 +12,17 @@ <plugin>elements</plugin> </relation> </deps> + <options> + <group> + <_short>Fireflies</_short> + <option name="toggle_firefly" type="key"> + <_short>Toggle all fireflies elements</_short> + <_long>Toggle all fireflies elements defined in the elements + list</_long> + </option> + </group> + </options> + <extension base_plugin="elements" screen="true"> <base_option>element_type</base_option> <restriction> diff --git a/plugins/fireflies/src/fireflies.cpp b/plugins/fireflies/src/fireflies.cpp index 0276133..bd3ae60 100644 --- a/plugins/fireflies/src/fireflies.cpp +++ b/plugins/fireflies/src/fireflies.cpp @@ -94,10 +94,51 @@ FireflyElement::move () z += zs * es->updateDelay () * ffSpeed; } +bool +FirefliesScreen::toggle (CompAction *action, + CompAction::State state, + CompOption::Vector &options) +{ + CompPlugin *p = CompPlugin::find ("elements"); + + if (!p) + return true; + + options = p->vTable->getOptions (); + + foreach (CompOption opt, options) + { + if (opt.type () == CompOption::TypeAction && + opt.name () == "toggle_name") + { + CompOption o; + CompOption::Vector newOptions = options; + + o.setName ("type", CompOption::TypeString); + o.value ().set ("fireflies"); + + newOptions.push_back (o); + + opt.value ().action ().initiate () (action, state, newOptions); + + break; + } + } + + return false; +} + + + FirefliesScreen::FirefliesScreen (CompScreen *screen) : PluginClassHandler <FirefliesScreen, CompScreen> (screen) { type = ElementType::create ("fireflies", "Firefly", FireflyElement::create); + + optionSetToggleFireflyInitiate (FirefliesScreen::toggle); + + if (!type) + setFailed (); } FirefliesScreen::~FirefliesScreen () diff --git a/plugins/fireflies/src/fireflies.h b/plugins/fireflies/src/fireflies.h index 97af5fe..af07be4 100644 --- a/plugins/fireflies/src/fireflies.h +++ b/plugins/fireflies/src/fireflies.h @@ -59,6 +59,11 @@ class FirefliesScreen : FirefliesScreen (CompScreen *); ~FirefliesScreen (); + static bool + toggle (CompAction *, + CompAction::State, + CompOption::Vector &); + ElementType *type; }; diff --git a/plugins/snow/snow.xml.in b/plugins/snow/snow.xml.in index 838003b..20b5ebd 100644 --- a/plugins/snow/snow.xml.in +++ b/plugins/snow/snow.xml.in @@ -15,6 +15,11 @@ <options> <group> <_short>Snow</_short> + <option name="toggle_snow" type="key"> + <_short>Toggle all snow elements</_short> + <_long>Toggle all snow elements defined in the elements + list</_long> + </option> <option name="snow_sway" type="int"> <_short>Snow sway</_short> <_long>Side-to-side movement of Snow.</_long> diff --git a/plugins/snow/src/snow.cpp b/plugins/snow/src/snow.cpp index 6084a6d..6fe379b 100644 --- a/plugins/snow/src/snow.cpp +++ b/plugins/snow/src/snow.cpp @@ -82,10 +82,49 @@ SnowElement::fini () { } +bool +SnowScreen::toggle (CompAction *action, + CompAction::State state, + CompOption::Vector &options) +{ + CompPlugin *p = CompPlugin::find ("elements"); + + if (!p) + return true; + + options = p->vTable->getOptions (); + + foreach (CompOption opt, options) + { + if (opt.type () == CompOption::TypeAction && + opt.name () == "toggle_name") + { + CompOption o; + CompOption::Vector newOptions = options; + + o.setName ("type", CompOption::TypeString); + o.value ().set ("snow"); + + newOptions.push_back (o); + + opt.value ().action ().initiate () (action, state, newOptions); + + break; + } + } + + return false; +} + SnowScreen::SnowScreen (CompScreen *screen) : PluginClassHandler <SnowScreen, CompScreen> (screen) { type = ElementType::create ("snow", "Snow", SnowElement::create); + + optionSetToggleSnowInitiate (SnowScreen::toggle); + + if (!type) + setFailed (); } SnowScreen::~SnowScreen () diff --git a/plugins/snow/src/snow.h b/plugins/snow/src/snow.h index b38b6e4..2da3dd9 100644 --- a/plugins/snow/src/snow.h +++ b/plugins/snow/src/snow.h @@ -58,6 +58,11 @@ class SnowScreen : SnowScreen (CompScreen *); ~SnowScreen (); + static bool + toggle (CompAction *, + CompAction::State, + CompOption::Vector &); + ElementType *type; }; diff --git a/plugins/stars/src/stars.cpp b/plugins/stars/src/stars.cpp index 9729bb1..41b3575 100644 --- a/plugins/stars/src/stars.cpp +++ b/plugins/stars/src/stars.cpp @@ -69,21 +69,55 @@ StarElement::move () ys = starBezierCurve(dy, tmp); zs = starBezierCurve(dz, tmp); - //fprintf (stderr, "updateDelay is %i starsSpeed is %i xs is %f ys is %f zs is %f\n", updateDelay, starsSpeed, xs, ys, zs); - x += xs * updateDelay * starsSpeed; y += ys * updateDelay * starsSpeed; z += zs * updateDelay * starsSpeed; +} + +bool +StarScreen::toggle (CompAction *action, + CompAction::State state, + CompOption::Vector &options) +{ + CompPlugin *p = CompPlugin::find ("elements"); + + if (!p) + return true; + + options = p->vTable->getOptions (); - //fprintf (stderr, "xs is %f ys is %f zs is %f\n", xs, ys, zs); + foreach (CompOption opt, options) + { + if (opt.type () == CompOption::TypeAction && + opt.name () == "toggle_name") + { + CompOption o; + CompOption::Vector newOptions = options; - //fprintf (stderr, "x is %f y is %f\n", x, y, z); + o.setName ("type", CompOption::TypeString); + o.value ().set ("stars"); + + newOptions.push_back (o); + + opt.value ().action ().initiate () (action, state, newOptions); + + break; + } + } + + return false; } + StarScreen::StarScreen (CompScreen *screen) : PluginClassHandler <StarScreen, CompScreen> (screen) { type = ElementType::create ("stars", "Stars", StarElement::create); + + optionSetToggleStarInitiate (StarScreen::toggle); + + if (!type) + setFailed (); } StarScreen::~StarScreen () diff --git a/plugins/stars/src/stars.h b/plugins/stars/src/stars.h index 45dea38..8e90162 100644 --- a/plugins/stars/src/stars.h +++ b/plugins/stars/src/stars.h @@ -58,6 +58,11 @@ class StarScreen : StarScreen (CompScreen *); ~StarScreen (); + static bool + toggle (CompAction *, + CompAction::State, + CompOption::Vector &); + ElementType *type; }; diff --git a/plugins/stars/stars.xml.in b/plugins/stars/stars.xml.in index 8b90b8e..4ad6d27 100644 --- a/plugins/stars/stars.xml.in +++ b/plugins/stars/stars.xml.in @@ -15,6 +15,11 @@ <options> <group> <_short>Stars</_short> + <option name="toggle_star" type="key"> + <_short>Toggle all stars elements</_short> + <_long>Toggle all stars elements defined in the elements + list</_long> + </option> <option name="star_offset_x" type="int"> <_short>Star X Offset</_short> <_long>The X point on the screen where stars should start</_long> diff --git a/src/elements.cpp b/src/elements.cpp index e6f368f..033a04c 100644 --- a/src/elements.cpp +++ b/src/elements.cpp @@ -138,8 +138,6 @@ PrivateElementScreen::displayTextInfo (CompOption::Value::Vector cType) if (text && text->valid) text->render (type, animIter); - fprintf (stderr, "returning true\n"); - return true; } @@ -158,7 +156,7 @@ PrivateElementScreen::nextElement (CompAction *action, CompOption::Value::Vector cType, cPath, cIter; CompString name; int i; - Bool foundHigher = FALSE; + bool foundHigher = false; cType = optionGetElementType (); cPath = optionGetElementImage (); @@ -170,14 +168,14 @@ PrivateElementScreen::nextElement (CompAction *action, compLogMessage ("elements", CompLogLevelWarn, "Options are not set correctly," " cannot read this setting."); - return FALSE; + return false; } for (i = 0; i < cIter.size (); i++) { if (cIter.at (i).i () > animIter) { - foundHigher = TRUE; + foundHigher = true; listIter = i; animIter = cIter.at (i).i (); break; @@ -208,7 +206,7 @@ PrivateElementScreen::prevElement (CompAction *action, CompOption::Value::Vector cType, cPath, cIter; CompString name; int i; - Bool foundLower = FALSE; + bool foundLower = false; ELEMENTS_SCREEN (screen); @@ -222,14 +220,14 @@ PrivateElementScreen::prevElement (CompAction *action, compLogMessage ("elements", CompLogLevelWarn, "Options are not set correctly," " cannot read this setting."); - return FALSE; + return false; } for (i = cIter.size () -1; i > -1; i--) { if (cIter.at (i).i () < animIter) { - foundLower = TRUE; + foundLower = true; listIter = i; animIter = cIter.at (i).i (); break; @@ -259,12 +257,88 @@ PrivateElementScreen::prevElement (CompAction *action, } bool +PrivateElementScreen::toggleElementName (CompAction *action, + CompAction::State state, + CompOption::Vector &options) +{ + CompString string; + CompString elementType; + bool success = true; + bool stopped = false; + int savedIter = 0; + ElementAnimation *currAnim = NULL; + CompOption::Value::Vector cIter = optionGetElementIter (); + CompOption::Value::Vector cType = optionGetElementType (); + CompOption::Value::Vector cPath = optionGetElementImage (); + CompOption::Value::Vector cCap = optionGetElementCap (); + CompOption::Value::Vector cSize = optionGetElementSize (); + CompOption::Value::Vector cSpeed = optionGetElementSpeed (); + CompOption::Value::Vector cRot = optionGetElementRotate (); + + elementType = CompOption::getStringOptionNamed (options, "type", ""); + + if (!((cType.size () == cIter.size ()) && + (cPath.size () == cIter.size ()) && + (cCap.size () == cIter.size ()) && + (cSize.size () == cIter.size ()) && + (cSpeed.size () == cIter.size ())) && + (cRot.size () == cIter.size ())) + { + compLogMessage ("elements", CompLogLevelWarn, + "Options are not set correctly," + " cannot read this setting."); + return false; + } + + foreach (ElementAnimation *anim, animations) + { + if (anim->type ()->name () == elementType) + { + if (anim->active ()) + anim->stop (); + else + anim->start (); + + stopped = true; + } + } + + if (!stopped) + { + if (!redrawTimer.active ()) + redrawTimer.start (); + + for (int i = 0; i < cIter.size (); i++) + { + if (cType.at (i).s () == elementType && + savedIter != cIter.at (i).i ()) + { + savedIter = cIter.at (i).i (); + + currAnim = ElementAnimation::create (cType.at (i).s (), + cCap.at (i).i () , + cSize.at (i).i (), + cSpeed.at (i).i (), + cIter.at (i).i (), + cRot.at (i).b ()); + + currAnim->start (); + break; + } + } + } + + return true; +} + + +bool PrivateElementScreen::toggleSelected (CompAction *action, CompAction::State state, CompOption::Vector &options) { CompString string; - bool success = TRUE; + bool success = true; ElementAnimation *currAnim = NULL; CompOption::Value::Vector cIter = optionGetElementIter (); CompOption::Value::Vector cType = optionGetElementType (); @@ -274,6 +348,8 @@ PrivateElementScreen::toggleSelected (CompAction *action, CompOption::Value::Vector cSpeed = optionGetElementSpeed (); CompOption::Value::Vector cRot = optionGetElementRotate (); + fprintf (stderr, "toggleSelected called\n"); + if (!((cType.size () == cIter.size ()) && (cPath.size () == cIter.size ()) && (cCap.size () == cIter.size ()) && @@ -289,14 +365,10 @@ PrivateElementScreen::toggleSelected (CompAction *action, if (optionGetTitleOnToggle ()) if (!displayTextInfo (cType)) - { - fprintf (stderr, "display text info returned false\n"); return true; - } foreach (ElementAnimation *anim, animations) { - fprintf (stderr, "anim id is %i animIter is %i\n", anim->id (), animIter); if (anim->id () == animIter) { if (anim->active ()) @@ -310,9 +382,6 @@ PrivateElementScreen::toggleSelected (CompAction *action, } } - if (currAnim) - fprintf (stderr, "currAnim exists?\n"); - if (!currAnim) { if (!redrawTimer.active ()) @@ -388,8 +457,6 @@ PrivateElementScreen::render (const GLMatrix &transform) needUpdate = false; } - //fprintf (stderr, "rendering\n"); - foreach (ElementAnimation *anim, animations) { if (anim->textures ().size () > 0) @@ -398,7 +465,6 @@ PrivateElementScreen::render (const GLMatrix &transform) ElementTexture *eTex = (anim->textures () [n]); foreach (Element *e, anim->elements ()) { - //fprintf (stderr, "rendering an element at %f %f %f with %f\n", e->x, e->y, e->z, e->rAngle); glPushMatrix (); glLoadMatrixf (transform.getMatrix ()); glColor4f (1.0, 1.0, 1.0, e->opacity); @@ -493,8 +559,6 @@ PrivateElementScreen::redrawTimeout () if (anim->active ()) { - //fprintf (stderr, "seems that this anim is active\n"); - foreach (Element *e, anim->mElements) { /* This tests to see if the element is offscreen, if so @@ -512,7 +576,6 @@ PrivateElementScreen::redrawTimeout () if (anim->testAllOffscreen ()) { - //fprintf (stderr, "seems that all for this anim is offscreen\n"); anim->mTexture.clear (); anim->mElements.clear (); delete anim; @@ -527,10 +590,7 @@ PrivateElementScreen::redrawTimeout () } foreach (Element *e, anim->elements ()) - { - //fprintf (stderr, "moved an element\n"); e->move (); - } it++; } @@ -556,8 +616,6 @@ PrivateElementScreen::redrawTimeout () CompositeScreen::get (screen)->damageScreen (); } - //fprintf (stderr, "redraw timeout called\n"); - return true; } @@ -580,7 +638,7 @@ PrivateElementScreen::updateElementTextures () CompOption::Value::Vector cSize = optionGetElementSize (); CompOption::Value::Vector cSpeed = optionGetElementSpeed (); CompOption::Value::Vector cRot = optionGetElementRotate (); - Bool initiate = FALSE; + bool initiate = false; if (!((cType.size () == cIter.size ()) && (cPath.size () == cIter.size ()) && @@ -637,17 +695,17 @@ PrivateElementScreen::updateElementTextures () anim->setNElement (nElement); /* FIXME: NULL check? */ - initiate = TRUE; + initiate = true; } if (type != anim->type ()->name ()) { anim->setType (type); - initiate = TRUE; + initiate = true; } if (anim->rotate () != rotate) - initiate = TRUE; + initiate = true; anim->setRotate (rotate); anim->setSize (size); @@ -666,8 +724,6 @@ void PrivateElementScreen::optionChanged (CompOption *option, ElementsOptions::Options num) { - fprintf (stderr, "optionChanged called\n"); - switch (num) { case ElementsOptions::ElementType: @@ -739,8 +795,6 @@ PrivateElementScreen::PrivateElementScreen (CompScreen *screen) : if (cIter.at (i).i () < lowest) lowest = cIter.at (i).i (); - fprintf (stderr, "set actions\n"); - optionSetNextElementKeyInitiate (boost::bind (&PrivateElementScreen::nextElement, this, _1, _2, _3)); @@ -753,6 +807,9 @@ PrivateElementScreen::PrivateElementScreen (CompScreen *screen) : (&PrivateElementScreen::toggleSelected, this, _1, _2, _3)); + optionSetToggleNameInitiate (boost::bind + (&PrivateElementScreen::toggleElementName, this, _1, _2, _3)); + setupDisplayList (); } @@ -764,45 +821,6 @@ ElementScreen::ElementScreen (CompScreen *screen) : if (!priv) setFailed (); -#define optionNotify(name) \ -priv->optionSet##name##Notify(boost::bind(&PrivateElementScreen::optionChanged, this->priv, _1, _2)) - - optionNotify (ElementType); - optionNotify (ElementImage); - optionNotify (ElementSize); - optionNotify (ElementSpeed); - optionNotify (ElementCap); - optionNotify (ElementRotate); - optionNotify (UpdateDelay); - -#undef optionNotify - -#define actionSet(name, init) \ -priv->optionSet##name##KeyInitiate(boost::bind \ - (&PrivateElementScreen::##init##, this->priv, _1, _2, _3)) - - - -#undef actionSet - -#if 0 -#define newElementType(name, desc, createFunc, deleteFunc) \ -new ElementType (name, desc, createFunc, deleteFunc) - - newElementType ("autumn", "Autumn", AutumnElement::create, - AutumnElement::destroy); - newElementType ("bubbles", "Bubbles", BubbleElement::create, - BubbleElement::destroy); - newElementType ("fireflies", "Fireflies", FireflyElement::create, - FireflyElement::destroy); - newElementType ("snow", "Snow", SnowElement::create, - SnowElement::destroy); - newElementType ("stars", "Stars", StarElement::create, - StarElement::destroy); - -#undef newElementType -#endif - if (priv) { @@ -816,7 +834,22 @@ new ElementType (name, desc, createFunc, deleteFunc) priv->updateElementTextures (); + +#define optionNotify(name) \ +priv->optionSet##name##Notify(boost::bind(&PrivateElementScreen::optionChanged, this->priv, _1, _2)) + + optionNotify (ElementType); + optionNotify (ElementImage); + optionNotify (ElementSize); + optionNotify (ElementSpeed); + optionNotify (ElementCap); + optionNotify (ElementRotate); + optionNotify (UpdateDelay); + +#undef optionNotify } + + } ElementScreen::~ElementScreen () diff --git a/src/private.h b/src/private.h index 4618a09..b662ba0 100644 --- a/src/private.h +++ b/src/private.h @@ -136,6 +136,10 @@ class PrivateElementScreen : CompAction::State state, CompOption::Vector &options); + bool toggleElementName (CompAction *action, + CompAction::State state, + CompOption::Vector &options); + void render (const GLMatrix &); void setupDisplayList (); void updateElementTextures (); diff --git a/src/type.cpp b/src/type.cpp index 6cb7b25..d124a94 100644 --- a/src/type.cpp +++ b/src/type.cpp @@ -105,8 +105,6 @@ ElementType::create (CompString name, es->priv->types.push_back (type); - fprintf (stderr, "ElementType::create called\n"); - return type; } |
