* removed debugging output, minor color fix
[ardour.git] / gtk2_ardour / canvas-flag.cc
1 #include "canvas-flag.h"
2 #include <iostream>
3 #include "ardour_ui.h"
4
5 using namespace Gnome::Canvas;
6 using namespace std;
7
8
9 void 
10 CanvasFlag::delete_allocated_objects()
11 {
12         delete _text;
13         _text = 0;
14
15         delete _line;
16         _line = 0;
17
18         delete _rect;
19         _rect = 0;
20 }
21
22 void 
23 CanvasFlag::set_text(string& a_text)
24 {
25         delete_allocated_objects();
26         
27         _text = new InteractiveText(*this, this, 0.0, 0.0, Glib::ustring(a_text));
28         _text->property_justification() = Gtk::JUSTIFY_CENTER;
29         _text->property_fill_color_rgba() = _outline_color_rgba;
30         double flagwidth  = _text->property_text_width()  + 10.0;
31         double flagheight = _text->property_text_height() + 3.0;
32         _text->property_x() = flagwidth / 2.0;
33         _text->property_y() = flagheight / 2.0;
34         _text->show();
35         _line = new SimpleLine(*this, 0.0, 0.0, 0.0, _height);
36         _line->property_color_rgba() = _outline_color_rgba;
37         _rect = new InteractiveRect(*this, this, 0.0, 0.0, flagwidth, flagheight);
38         _rect->property_outline_color_rgba() = _outline_color_rgba;
39         _rect->property_fill_color_rgba() = _fill_color_rgba;
40         _text->raise_to_top();  
41 }
42
43 CanvasFlag::~CanvasFlag()
44 {
45         delete_allocated_objects();
46 }
47
48 bool
49 CanvasFlag::on_event(GdkEvent* ev)
50 {
51         return false;
52 }