From 4131fcb1b53dc85ced61ff2cc41889811c8a2aaf Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Sun, 7 Oct 2012 21:42:50 +0000 Subject: Added Widget::EventClicked and Widget::EventDoubleClicked, made ModelView::clear() work according to specification. --- src/ui/modelview.cc | 18 ++++++++++++------ src/ui/modelview.h | 2 ++ src/ui/widget.h | 4 +++- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/ui/modelview.cc b/src/ui/modelview.cc index e4975a3..8069ac7 100755 --- a/src/ui/modelview.cc +++ b/src/ui/modelview.cc @@ -22,7 +22,7 @@ namespace ui { const float LIGHT_DISTANCE = -10.0f; -const float LIGHT_ATTENUATION = 0.2f; +const float LIGHT_ATTENUATION = 0.5f; ModelView::ModelView(Widget *parent) : Widget(parent) { @@ -50,7 +50,7 @@ void ModelView::print(const size_t indent) const con_print << aux::pad_left(marker, indent*2) << label() << " \"" << modelname() << "\"" << std::endl; } -void ModelView::clear() +void ModelView::reset() { set_background(false); @@ -66,9 +66,15 @@ void ModelView::clear() modelview_globebright = false; } +void ModelView::clear() +{ + reset(); + modelview_mode = Model; +} + void ModelView::set_globetexturename(const std::string & texturename, const bool bright, const std::string & coronaname) { - clear(); + reset(); modelview_globetexturename.assign(texturename); modelview_globecoronaname.assign(coronaname); modelview_globebright = bright; @@ -76,7 +82,7 @@ void ModelView::set_globetexturename(const std::string & texturename, const bool void ModelView::set_modelname(const std::string & modelname) { - clear(); + reset(); modelview_modelname.assign(modelname); } @@ -190,7 +196,7 @@ void ModelView::draw_globe() math::Vector3f(LIGHT_DISTANCE * reference_radius, 0, 0), math::Color(1.0f, 1.0f, 1.0f) ); - light->set_attenuation(LIGHT_ATTENUATION, LIGHT_ATTENUATION, 0.0f); + light->set_attenuation(0.0f, LIGHT_ATTENUATION, 0.0f); render::LightEnvironment lightenv; lightenv.add(light); @@ -290,7 +296,7 @@ void ModelView::draw_model() math::Vector3f(LIGHT_DISTANCE * reference_radius, 0, 0), math::Color(1.0f, 1.0f, 1.0f) ); - light->set_attenuation(LIGHT_ATTENUATION, LIGHT_ATTENUATION, 0.0f); + light->set_attenuation(0.0f, LIGHT_ATTENUATION, 0.0f); render::LightEnvironment lightenv; lightenv.add(light); diff --git a/src/ui/modelview.h b/src/ui/modelview.h index d49acc8..4642551 100755 --- a/src/ui/modelview.h +++ b/src/ui/modelview.h @@ -100,6 +100,8 @@ protected: virtual void on_mousemove(const math::Vector2f &cursor); private: + void reset(); + void draw_model(); void draw_globe(); diff --git a/src/ui/widget.h b/src/ui/widget.h index ada1f5b..fafdf58 100644 --- a/src/ui/widget.h +++ b/src/ui/widget.h @@ -40,7 +40,9 @@ public: EventSliderChanged = 4, EventScrollBarChanged = 5, EventWindowShow = 6, - EventWindowHide = 7 + EventWindowHide = 7, + EventClicked = 8, + EventDoubleClicked = 9 }; /// create a new widget -- cgit v1.2.3