Use central method to check for engine for processor operations
[ardour.git] / gtk2_ardour / canvas_test.cc
index 9ccc2428132ba52a657ba16574597fc697fbb5de..9dc16ba7d4d0485d0575aad143ce5e3a1a93ed90 100644 (file)
 #include "canvas/types.h"
 #include "canvas/canvas.h"
 #include "canvas/container.h"
-#include "canvas/colors.h"
+#include "gtkmm2ext/colors.h"
+#include "canvas/debug.h"
+#include "canvas/grid.h"
 #include "canvas/scroll_group.h"
 #include "canvas/text.h"
+#include "canvas/widget.h"
 
 #include "ardour_button.h"
 #include "ui_config.h"
@@ -109,6 +112,7 @@ private:
 
        ArdourCanvas::GtkCanvas* canvas;
        ArdourCanvas::Container* group;
+       ArdourCanvas::Grid* grid;
 
        ArdourButton test_button;
 };
@@ -140,7 +144,6 @@ CANVAS_UI::CANVAS_UI (int *argcp, char **argvp[], const char* localedir)
        test_button.set_text ("Don't click me");
 
        b->pack_start (*l, false, 0);
-       b->pack_start (test_button, false, 0);
        b->pack_start (*canvas, true, 0);
 
        _main_window.add (*b);
@@ -163,13 +166,64 @@ ArdourCanvas::Container*
 CANVAS_UI::initialize_canvas (ArdourCanvas::Canvas& canvas)
 {
        using namespace ArdourCanvas;
-       canvas.set_background_color (rgba_to_color (0.0, 0.0, 1.0, 1.0));
+       canvas.set_background_color (rgba_to_color (0.0, 0.0, 0.4, 1.0));
 
        ScrollGroup* scroll_group = new ScrollGroup (canvas.root(),
                        ScrollGroup::ScrollSensitivity (ScrollGroup::ScrollsVertically|ScrollGroup::ScrollsHorizontally));
 
-       Text* text = new Text (scroll_group);
-       text->set ("Canvas Text");
+       grid = new ArdourCanvas::Grid (scroll_group);
+
+       grid->set_padding (40.0);
+       grid->set_margin (0.0);
+
+       grid->set_outline_width (3.0);
+       grid->set_outline_color (Color (0x3daec1ff));
+       grid->set_outline (false);
+       grid->set_row_spacing (60.0);
+       grid->set_col_spacing (3.0);
+       grid->set_homogenous (false);
+
+       ArdourCanvas::Text* text1 = new ArdourCanvas::Text (&canvas);
+       text1->set ("hello, world");
+       text1->set_color (Color (0xff0000ff));
+
+       ArdourCanvas::Text* text2 = new ArdourCanvas::Text (&canvas);
+       text2->set ("goodbye, cruel world");
+       text2->set_color (Color (0x00ff00ff));
+
+       ArdourCanvas::Text* text3 = new ArdourCanvas::Text (&canvas);
+       text3->set ("I am the third");
+       text3->set_color (Color (0xff00ffff));
+
+       ArdourCanvas::Text* text4 = new ArdourCanvas::Text (&canvas);
+       text4->set ("I am fourth");
+       text4->set_color (Color (0xffff00ff));
+
+       grid->place (text1, 0, 0, 2, 1);
+       grid->place (text2, 2, 0);
+       grid->place (text3, 0, 2, 1, 2);
+       grid->place (text4, 1, 3);
+
+       ArdourButton* button1 = new ArdourButton ("auto-return");
+       ArdourButton* button2 = new ArdourButton ("auto-play");
+       ArdourButton* button3 = new ArdourButton ("follow range");
+       ArdourButton* button4 = new ArdourButton ("auto-input");
+
+       ArdourCanvas::Widget* w1 = new ArdourCanvas::Widget (&canvas, *button1);
+       CANVAS_DEBUG_NAME (w1, "w1");
+       grid->place (w1, 3, 0, 2, 0);
+       ArdourCanvas::Widget* w2 = new ArdourCanvas::Widget (&canvas, *button2);
+       CANVAS_DEBUG_NAME (w2, "w2");
+       grid->place (w2, 5, 0, 2, 0);
+       ArdourCanvas::Widget* w3 = new ArdourCanvas::Widget (&canvas, *button3);
+       CANVAS_DEBUG_NAME (w3, "w3");
+       grid->place (w3, 3, 1);
+       ArdourCanvas::Widget* w4 = new ArdourCanvas::Widget (&canvas, *button4);
+       CANVAS_DEBUG_NAME (w4, "w4");
+       grid->place (w4, 4, 1);
+
+       //ArdourCanvas::Widget* w = new ArdourCanvas::Widget (scroll_group, test_button);
+       //CANVAS_DEBUG_NAME (w, "TheW");
 
        return new ArdourCanvas::Container (scroll_group);
 }