mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-09 16:24:57 +01:00
remove all XML related API from canvas. it may have been useful during development, but it is just a distraction - we will NEVER be saving or restoring canvas state via XML or any kind of serialized state
This commit is contained in:
parent
fe34485907
commit
84fb0a8dce
39 changed files with 1 additions and 463 deletions
|
|
@ -2335,7 +2335,6 @@ ARDOUR_UI::save_state_canfail (string name, bool switch_to_it)
|
||||||
}
|
}
|
||||||
|
|
||||||
save_ardour_state (); /* XXX cannot fail? yeah, right ... */
|
save_ardour_state (); /* XXX cannot fail? yeah, right ... */
|
||||||
editor->save_canvas_state ();
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5528,12 +5528,3 @@ Editor::shift_key_released ()
|
||||||
{
|
{
|
||||||
_stepping_axis_view = 0;
|
_stepping_axis_view = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
Editor::save_canvas_state ()
|
|
||||||
{
|
|
||||||
XMLTree* tree = static_cast<ArdourCanvas::Canvas*>(_track_canvas)->get_state ();
|
|
||||||
string path = string_compose ("%1/canvas-state.xml", _session->path());
|
|
||||||
tree->write (path);
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -454,8 +454,6 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
|
||||||
_stepping_axis_view = v;
|
_stepping_axis_view = v;
|
||||||
}
|
}
|
||||||
|
|
||||||
void save_canvas_state ();
|
|
||||||
|
|
||||||
ArdourCanvas::Group* get_trackview_group () const { return _trackview_group; }
|
ArdourCanvas::Group* get_trackview_group () const { return _trackview_group; }
|
||||||
ArdourCanvas::Group* get_time_bars_group () const;
|
ArdourCanvas::Group* get_time_bars_group () const;
|
||||||
ArdourCanvas::Group* get_track_canvas_group () const;
|
ArdourCanvas::Group* get_track_canvas_group () const;
|
||||||
|
|
|
||||||
|
|
@ -420,8 +420,6 @@ class PublicEditor : public Gtk::Window, public PBD::StatefulDestructible {
|
||||||
|
|
||||||
virtual void get_regions_at (RegionSelection &, framepos_t where, TrackViewList const &) const = 0;
|
virtual void get_regions_at (RegionSelection &, framepos_t where, TrackViewList const &) const = 0;
|
||||||
|
|
||||||
virtual void save_canvas_state () = 0;
|
|
||||||
|
|
||||||
/// Singleton instance, set up by Editor::Editor()
|
/// Singleton instance, set up by Editor::Editor()
|
||||||
|
|
||||||
static PublicEditor* _instance;
|
static PublicEditor* _instance;
|
||||||
|
|
|
||||||
|
|
@ -46,35 +46,6 @@ Canvas::Canvas ()
|
||||||
set_epoch ();
|
set_epoch ();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Construct a new Canvas from an XML tree
|
|
||||||
* @param tree XML Tree.
|
|
||||||
*/
|
|
||||||
Canvas::Canvas (XMLTree const * tree)
|
|
||||||
: _root (this)
|
|
||||||
, _log_renders (true)
|
|
||||||
, _scroll_offset_x (0)
|
|
||||||
, _scroll_offset_y (0)
|
|
||||||
{
|
|
||||||
set_epoch ();
|
|
||||||
|
|
||||||
/* XXX: little bit hacky */
|
|
||||||
_root.set_state (tree->root()->child ("Group"));
|
|
||||||
|
|
||||||
XMLNodeList const & children = tree->root()->children ();
|
|
||||||
for (XMLNodeList::const_iterator i = children.begin(); i != children.end(); ++i) {
|
|
||||||
if ((*i)->name() == ("Render")) {
|
|
||||||
_renders.push_back (
|
|
||||||
Rect (
|
|
||||||
atof ((*i)->property ("x0")->value().c_str()),
|
|
||||||
atof ((*i)->property ("y0")->value().c_str()),
|
|
||||||
atof ((*i)->property ("x1")->value().c_str()),
|
|
||||||
atof ((*i)->property ("x1")->value().c_str())
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Canvas::scroll_to (Coord x, Coord y)
|
Canvas::scroll_to (Coord x, Coord y)
|
||||||
{
|
{
|
||||||
|
|
@ -255,27 +226,6 @@ Canvas::queue_draw_item_area (Item* item, Rect area)
|
||||||
request_redraw (canvas_area);
|
request_redraw (canvas_area);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @return An XML description of the canvas and its objects */
|
|
||||||
XMLTree *
|
|
||||||
Canvas::get_state () const
|
|
||||||
{
|
|
||||||
XMLTree* tree = new XMLTree ();
|
|
||||||
XMLNode* node = new XMLNode ("Canvas");
|
|
||||||
node->add_child_nocopy (*_root.get_state ());
|
|
||||||
|
|
||||||
for (list<Rect>::const_iterator i = _renders.begin(); i != _renders.end(); ++i) {
|
|
||||||
XMLNode* render = new XMLNode ("Render");
|
|
||||||
render->add_property ("x0", string_compose ("%1", i->x0));
|
|
||||||
render->add_property ("y0", string_compose ("%1", i->y0));
|
|
||||||
render->add_property ("x1", string_compose ("%1", i->x1));
|
|
||||||
render->add_property ("y1", string_compose ("%1", i->y1));
|
|
||||||
node->add_child_nocopy (*render);
|
|
||||||
}
|
|
||||||
|
|
||||||
tree->set_root (node);
|
|
||||||
return tree;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Construct a GtkCanvas */
|
/** Construct a GtkCanvas */
|
||||||
GtkCanvas::GtkCanvas ()
|
GtkCanvas::GtkCanvas ()
|
||||||
: _current_item (0)
|
: _current_item (0)
|
||||||
|
|
@ -285,18 +235,6 @@ GtkCanvas::GtkCanvas ()
|
||||||
add_events (Gdk::BUTTON_PRESS_MASK | Gdk::BUTTON_RELEASE_MASK | Gdk::POINTER_MOTION_MASK);
|
add_events (Gdk::BUTTON_PRESS_MASK | Gdk::BUTTON_RELEASE_MASK | Gdk::POINTER_MOTION_MASK);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Construct a GtkCanvas from an XML tree.
|
|
||||||
* @param tree XML Tree.
|
|
||||||
*/
|
|
||||||
GtkCanvas::GtkCanvas (XMLTree const * tree)
|
|
||||||
: Canvas (tree)
|
|
||||||
, _current_item (0)
|
|
||||||
, _grabbed_item (0)
|
|
||||||
{
|
|
||||||
/* these are the events we want to know about */
|
|
||||||
add_events (Gdk::BUTTON_PRESS_MASK | Gdk::BUTTON_RELEASE_MASK | Gdk::POINTER_MOTION_MASK);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Handler for button presses on the canvas.
|
/** Handler for button presses on the canvas.
|
||||||
* @param ev GDK event.
|
* @param ev GDK event.
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -32,8 +32,6 @@
|
||||||
#include "pbd/signals.h"
|
#include "pbd/signals.h"
|
||||||
#include "canvas/root_group.h"
|
#include "canvas/root_group.h"
|
||||||
|
|
||||||
class XMLTree;
|
|
||||||
|
|
||||||
namespace ArdourCanvas
|
namespace ArdourCanvas
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
@ -54,7 +52,6 @@ class Canvas
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Canvas ();
|
Canvas ();
|
||||||
Canvas (XMLTree const *);
|
|
||||||
virtual ~Canvas () {}
|
virtual ~Canvas () {}
|
||||||
|
|
||||||
/** called to request a redraw of an area of the canvas */
|
/** called to request a redraw of an area of the canvas */
|
||||||
|
|
@ -79,9 +76,7 @@ public:
|
||||||
void item_changed (Item *, boost::optional<Rect>);
|
void item_changed (Item *, boost::optional<Rect>);
|
||||||
void item_moved (Item *, boost::optional<Rect>);
|
void item_moved (Item *, boost::optional<Rect>);
|
||||||
|
|
||||||
XMLTree* get_state () const;
|
virtual Cairo::RefPtr<Cairo::Context> context () = 0;
|
||||||
|
|
||||||
virtual Cairo::RefPtr<Cairo::Context> context () = 0;
|
|
||||||
|
|
||||||
std::list<Rect> const & renders () const {
|
std::list<Rect> const & renders () const {
|
||||||
return _renders;
|
return _renders;
|
||||||
|
|
@ -115,7 +110,6 @@ class GtkCanvas : public Canvas, public Gtk::EventBox
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
GtkCanvas ();
|
GtkCanvas ();
|
||||||
GtkCanvas (XMLTree const *);
|
|
||||||
|
|
||||||
void request_redraw (Rect const &);
|
void request_redraw (Rect const &);
|
||||||
void request_size (Duple);
|
void request_size (Duple);
|
||||||
|
|
|
||||||
|
|
@ -13,8 +13,6 @@ public:
|
||||||
void compute_bounding_box () const;
|
void compute_bounding_box () const;
|
||||||
|
|
||||||
void render (Rect const & area, Cairo::RefPtr<Cairo::Context>) const;
|
void render (Rect const & area, Cairo::RefPtr<Cairo::Context>) const;
|
||||||
XMLNode* get_state () const;
|
|
||||||
void set_state (XMLNode const *);
|
|
||||||
|
|
||||||
void set (Points const &);
|
void set (Points const &);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,9 +11,6 @@ class Fill : virtual public Item
|
||||||
public:
|
public:
|
||||||
Fill (Group *);
|
Fill (Group *);
|
||||||
|
|
||||||
void add_fill_state (XMLNode *) const;
|
|
||||||
void set_fill_state (XMLNode const *);
|
|
||||||
|
|
||||||
Color fill_color () const {
|
Color fill_color () const {
|
||||||
return _fill_color;
|
return _fill_color;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,8 +18,6 @@ public:
|
||||||
|
|
||||||
void render (Rect const &, Cairo::RefPtr<Cairo::Context>) const;
|
void render (Rect const &, Cairo::RefPtr<Cairo::Context>) const;
|
||||||
virtual void compute_bounding_box () const;
|
virtual void compute_bounding_box () const;
|
||||||
XMLNode* get_state () const;
|
|
||||||
void set_state (XMLNode const *);
|
|
||||||
|
|
||||||
void add (Item *);
|
void add (Item *);
|
||||||
void remove (Item *);
|
void remove (Item *);
|
||||||
|
|
|
||||||
|
|
@ -35,8 +35,6 @@ public:
|
||||||
|
|
||||||
void render (Rect const &, Cairo::RefPtr<Cairo::Context>) const;
|
void render (Rect const &, Cairo::RefPtr<Cairo::Context>) const;
|
||||||
void compute_bounding_box () const;
|
void compute_bounding_box () const;
|
||||||
XMLNode* get_state () const;
|
|
||||||
void set_state (XMLNode const *);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Cairo::Format _format;
|
Cairo::Format _format;
|
||||||
|
|
|
||||||
|
|
@ -30,8 +30,6 @@
|
||||||
|
|
||||||
#include "canvas/types.h"
|
#include "canvas/types.h"
|
||||||
|
|
||||||
class XMLNode;
|
|
||||||
|
|
||||||
namespace ArdourCanvas
|
namespace ArdourCanvas
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
@ -70,15 +68,9 @@ public:
|
||||||
/** Update _bounding_box and _bounding_box_dirty */
|
/** Update _bounding_box and _bounding_box_dirty */
|
||||||
virtual void compute_bounding_box () const = 0;
|
virtual void compute_bounding_box () const = 0;
|
||||||
|
|
||||||
virtual XMLNode* get_state () const = 0;
|
|
||||||
virtual void set_state (XMLNode const *) = 0;
|
|
||||||
|
|
||||||
void grab ();
|
void grab ();
|
||||||
void ungrab ();
|
void ungrab ();
|
||||||
|
|
||||||
void add_item_state (XMLNode *) const;
|
|
||||||
void set_item_state (XMLNode const *);
|
|
||||||
|
|
||||||
void unparent ();
|
void unparent ();
|
||||||
void reparent (Group *);
|
void reparent (Group *);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
namespace ArdourCanvas
|
|
||||||
{
|
|
||||||
|
|
||||||
class Item;
|
|
||||||
class Group;
|
|
||||||
|
|
||||||
Item* create_item (Group *, XMLNode const *);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -14,8 +14,6 @@ public:
|
||||||
|
|
||||||
void render (Rect const & area, Cairo::RefPtr<Cairo::Context>) const;
|
void render (Rect const & area, Cairo::RefPtr<Cairo::Context>) const;
|
||||||
void compute_bounding_box () const;
|
void compute_bounding_box () const;
|
||||||
XMLNode* get_state () const;
|
|
||||||
void set_state (XMLNode const *);
|
|
||||||
|
|
||||||
void set (Duple, Duple);
|
void set (Duple, Duple);
|
||||||
void set_x0 (Coord);
|
void set_x0 (Coord);
|
||||||
|
|
|
||||||
|
|
@ -14,8 +14,6 @@ public:
|
||||||
|
|
||||||
void compute_bounding_box () const;
|
void compute_bounding_box () const;
|
||||||
void render (Rect const & area, Cairo::RefPtr<Cairo::Context>) const;
|
void render (Rect const & area, Cairo::RefPtr<Cairo::Context>) const;
|
||||||
XMLNode* get_state () const;
|
|
||||||
void set_state (XMLNode const *) {}
|
|
||||||
|
|
||||||
void set_height (Distance);
|
void set_height (Distance);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,9 +13,6 @@ public:
|
||||||
Outline (Group *);
|
Outline (Group *);
|
||||||
virtual ~Outline () {}
|
virtual ~Outline () {}
|
||||||
|
|
||||||
void add_outline_state (XMLNode *) const;
|
|
||||||
void set_outline_state (XMLNode const *);
|
|
||||||
|
|
||||||
Color outline_color () const {
|
Color outline_color () const {
|
||||||
return _outline_color;
|
return _outline_color;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,8 +18,6 @@ public:
|
||||||
|
|
||||||
void render (Rect const &, Cairo::RefPtr<Cairo::Context>) const;
|
void render (Rect const &, Cairo::RefPtr<Cairo::Context>) const;
|
||||||
void compute_bounding_box () const;
|
void compute_bounding_box () const;
|
||||||
XMLNode* get_state () const;
|
|
||||||
void set_state (XMLNode const *);
|
|
||||||
|
|
||||||
void set (Glib::RefPtr<Gdk::Pixbuf>);
|
void set (Glib::RefPtr<Gdk::Pixbuf>);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,9 +13,6 @@ public:
|
||||||
|
|
||||||
void compute_bounding_box () const;
|
void compute_bounding_box () const;
|
||||||
|
|
||||||
void add_poly_item_state (XMLNode *) const;
|
|
||||||
void set_poly_item_state (XMLNode const *);
|
|
||||||
|
|
||||||
virtual void set (Points const &);
|
virtual void set (Points const &);
|
||||||
Points const & get () const;
|
Points const & get () const;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,8 +12,6 @@ public:
|
||||||
PolyLine (Group *);
|
PolyLine (Group *);
|
||||||
|
|
||||||
void render (Rect const & area, Cairo::RefPtr<Cairo::Context>) const;
|
void render (Rect const & area, Cairo::RefPtr<Cairo::Context>) const;
|
||||||
XMLNode* get_state () const;
|
|
||||||
void set_state (XMLNode const *);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,8 +13,6 @@ public:
|
||||||
Polygon (Group *);
|
Polygon (Group *);
|
||||||
|
|
||||||
void render (Rect const & area, Cairo::RefPtr<Cairo::Context>) const;
|
void render (Rect const & area, Cairo::RefPtr<Cairo::Context>) const;
|
||||||
XMLNode* get_state () const;
|
|
||||||
void set_state (XMLNode const *);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,8 +17,6 @@ public:
|
||||||
|
|
||||||
void render (Rect const &, Cairo::RefPtr<Cairo::Context>) const;
|
void render (Rect const &, Cairo::RefPtr<Cairo::Context>) const;
|
||||||
void compute_bounding_box () const;
|
void compute_bounding_box () const;
|
||||||
XMLNode* get_state () const;
|
|
||||||
void set_state (XMLNode const *);
|
|
||||||
|
|
||||||
Rect const & get () const {
|
Rect const & get () const {
|
||||||
return _rect;
|
return _rect;
|
||||||
|
|
|
||||||
|
|
@ -16,8 +16,6 @@ public:
|
||||||
|
|
||||||
void render (Rect const &, Cairo::RefPtr<Cairo::Context>) const;
|
void render (Rect const &, Cairo::RefPtr<Cairo::Context>) const;
|
||||||
void compute_bounding_box () const;
|
void compute_bounding_box () const;
|
||||||
XMLNode* get_state () const;
|
|
||||||
void set_state (XMLNode const *);
|
|
||||||
|
|
||||||
void set (std::string const &);
|
void set (std::string const &);
|
||||||
void set_color (uint32_t);
|
void set_color (uint32_t);
|
||||||
|
|
|
||||||
|
|
@ -51,9 +51,6 @@ public:
|
||||||
void render (Rect const & area, Cairo::RefPtr<Cairo::Context>) const;
|
void render (Rect const & area, Cairo::RefPtr<Cairo::Context>) const;
|
||||||
void compute_bounding_box () const;
|
void compute_bounding_box () const;
|
||||||
|
|
||||||
XMLNode* get_state () const;
|
|
||||||
void set_state (XMLNode const *);
|
|
||||||
|
|
||||||
void set_samples_per_pixel (double);
|
void set_samples_per_pixel (double);
|
||||||
void set_height (Distance);
|
void set_height (Distance);
|
||||||
void set_channel (int);
|
void set_channel (int);
|
||||||
|
|
|
||||||
|
|
@ -102,22 +102,6 @@ Curve::render (Rect const & area, Cairo::RefPtr<Cairo::Context> context) const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
XMLNode *
|
|
||||||
Curve::get_state () const
|
|
||||||
{
|
|
||||||
XMLNode* node = new XMLNode ("PolyLine");
|
|
||||||
add_poly_item_state (node);
|
|
||||||
add_outline_state (node);
|
|
||||||
return node;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
Curve::set_state (XMLNode const * node)
|
|
||||||
{
|
|
||||||
set_poly_item_state (node);
|
|
||||||
set_outline_state (node);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Curve::render_path (Rect const & area, Cairo::RefPtr<Cairo::Context> context) const
|
Curve::render_path (Rect const & area, Cairo::RefPtr<Cairo::Context> context) const
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -43,19 +43,3 @@ Fill::setup_fill_context (Cairo::RefPtr<Cairo::Context> context) const
|
||||||
{
|
{
|
||||||
set_source_rgba (context, _fill_color);
|
set_source_rgba (context, _fill_color);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
Fill::add_fill_state (XMLNode* node) const
|
|
||||||
{
|
|
||||||
node->add_property ("fill-color", string_compose ("%1", _fill_color));
|
|
||||||
node->add_property ("fill", _fill ? "yes" : "no");
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
Fill::set_fill_state (XMLNode const * node)
|
|
||||||
{
|
|
||||||
_fill_color = atoll (node->property("fill-color")->value().c_str());
|
|
||||||
_fill = PBD::string_is_affirmative (node->property("fill")->value ().c_str());
|
|
||||||
|
|
||||||
_bounding_box_dirty = true;
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,6 @@
|
||||||
#include "canvas/group.h"
|
#include "canvas/group.h"
|
||||||
#include "canvas/types.h"
|
#include "canvas/types.h"
|
||||||
#include "canvas/debug.h"
|
#include "canvas/debug.h"
|
||||||
#include "canvas/item_factory.h"
|
|
||||||
#include "canvas/item.h"
|
#include "canvas/item.h"
|
||||||
#include "canvas/canvas.h"
|
#include "canvas/canvas.h"
|
||||||
|
|
||||||
|
|
@ -249,30 +248,6 @@ Group::add_items_at_point (Duple const point, vector<Item const *>& items) const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
XMLNode *
|
|
||||||
Group::get_state () const
|
|
||||||
{
|
|
||||||
XMLNode* node = new XMLNode ("Group");
|
|
||||||
for (list<Item*>::const_iterator i = _items.begin(); i != _items.end(); ++i) {
|
|
||||||
node->add_child_nocopy (*(*i)->get_state ());
|
|
||||||
}
|
|
||||||
|
|
||||||
add_item_state (node);
|
|
||||||
return node;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
Group::set_state (XMLNode const * node)
|
|
||||||
{
|
|
||||||
set_item_state (node);
|
|
||||||
|
|
||||||
XMLNodeList const & children = node->children ();
|
|
||||||
for (XMLNodeList::const_iterator i = children.begin(); i != children.end(); ++i) {
|
|
||||||
/* this will create the item and add it to this group */
|
|
||||||
create_item (this, *i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Group::dump (ostream& o) const
|
Group::dump (ostream& o) const
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -66,15 +66,3 @@ Image::accept_data ()
|
||||||
_need_render = true;
|
_need_render = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
XMLNode *
|
|
||||||
Image::get_state () const
|
|
||||||
{
|
|
||||||
/* XXX */
|
|
||||||
return new XMLNode ("Image");
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
Image::set_state (XMLNode const * /*node*/)
|
|
||||||
{
|
|
||||||
/* XXX */
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -300,22 +300,6 @@ Item::move (Duple movement)
|
||||||
set_position (position() + movement);
|
set_position (position() + movement);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
Item::add_item_state (XMLNode* node) const
|
|
||||||
{
|
|
||||||
node->add_property ("x-position", string_compose ("%1", _position.x));
|
|
||||||
node->add_property ("y-position", string_compose ("%1", _position.y));
|
|
||||||
node->add_property ("visible", _visible ? "yes" : "no");
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
Item::set_item_state (XMLNode const * node)
|
|
||||||
{
|
|
||||||
_position.x = atof (node->property("x-position")->value().c_str());
|
|
||||||
_position.y = atof (node->property("y-position")->value().c_str());
|
|
||||||
_visible = PBD::string_is_affirmative (node->property("visible")->value());
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Item::grab ()
|
Item::grab ()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,43 +0,0 @@
|
||||||
#include "pbd/xml++.h"
|
|
||||||
#include "canvas/item_factory.h"
|
|
||||||
#include "canvas/group.h"
|
|
||||||
#include "canvas/line.h"
|
|
||||||
#include "canvas/rectangle.h"
|
|
||||||
#include "canvas/poly_line.h"
|
|
||||||
#include "canvas/polygon.h"
|
|
||||||
#include "canvas/pixbuf.h"
|
|
||||||
#include "canvas/wave_view.h"
|
|
||||||
#include "canvas/text.h"
|
|
||||||
#include "canvas/line_set.h"
|
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
using namespace ArdourCanvas;
|
|
||||||
|
|
||||||
Item*
|
|
||||||
ArdourCanvas::create_item (Group* parent, XMLNode const * node)
|
|
||||||
{
|
|
||||||
Item* item = 0;
|
|
||||||
if (node->name() == "Group") {
|
|
||||||
item = new Group (parent);
|
|
||||||
} else if (node->name() == "Line") {
|
|
||||||
item = new Line (parent);
|
|
||||||
} else if (node->name() == "Rectangle") {
|
|
||||||
item = new Rectangle (parent);
|
|
||||||
} else if (node->name() == "PolyLine") {
|
|
||||||
item = new PolyLine (parent);
|
|
||||||
} else if (node->name() == "Polygon") {
|
|
||||||
item = new Polygon (parent);
|
|
||||||
} else if (node->name() == "Pixbuf") {
|
|
||||||
item = new Pixbuf (parent);
|
|
||||||
} else if (node->name() == "WaveView") {
|
|
||||||
item = new WaveView (parent, boost::shared_ptr<ARDOUR::AudioRegion> ());
|
|
||||||
} else if (node->name() == "Text") {
|
|
||||||
item = new Text (parent);
|
|
||||||
} else if (node->name() == "LineSet") {
|
|
||||||
item = new LineSet (parent);
|
|
||||||
}
|
|
||||||
|
|
||||||
assert (item);
|
|
||||||
item->set_state (node);
|
|
||||||
return item;
|
|
||||||
}
|
|
||||||
|
|
@ -113,36 +113,3 @@ Line::set_y1 (Coord y1)
|
||||||
|
|
||||||
DEBUG_TRACE (PBD::DEBUG::CanvasItemsDirtied, "canvas item dirty: line change\n");
|
DEBUG_TRACE (PBD::DEBUG::CanvasItemsDirtied, "canvas item dirty: line change\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
XMLNode *
|
|
||||||
Line::get_state () const
|
|
||||||
{
|
|
||||||
XMLNode* node = new XMLNode ("Line");
|
|
||||||
#ifdef CANVAS_DEBUG
|
|
||||||
if (!name.empty ()) {
|
|
||||||
node->add_property ("name", name);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
node->add_property ("x0", string_compose ("%1", _points[0].x));
|
|
||||||
node->add_property ("y0", string_compose ("%1", _points[0].y));
|
|
||||||
node->add_property ("x1", string_compose ("%1", _points[1].x));
|
|
||||||
node->add_property ("y1", string_compose ("%1", _points[1].y));
|
|
||||||
|
|
||||||
add_item_state (node);
|
|
||||||
add_outline_state (node);
|
|
||||||
return node;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
Line::set_state (XMLNode const * node)
|
|
||||||
{
|
|
||||||
_points[0].x = atof (node->property("x0")->value().c_str());
|
|
||||||
_points[0].y = atof (node->property("y0")->value().c_str());
|
|
||||||
_points[1].x = atof (node->property("x1")->value().c_str());
|
|
||||||
_points[1].y = atof (node->property("y1")->value().c_str());
|
|
||||||
|
|
||||||
set_item_state (node);
|
|
||||||
set_outline_state (node);
|
|
||||||
|
|
||||||
_bounding_box_dirty = true;
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -21,12 +21,6 @@ LineSet::LineSet (Group* parent)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
XMLNode *
|
|
||||||
LineSet::get_state () const
|
|
||||||
{
|
|
||||||
/* XXX */
|
|
||||||
return new XMLNode ("LineSet");
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
LineSet::compute_bounding_box () const
|
LineSet::compute_bounding_box () const
|
||||||
|
|
|
||||||
|
|
@ -61,20 +61,3 @@ Outline::setup_outline_context (Cairo::RefPtr<Cairo::Context> context) const
|
||||||
context->set_line_width (_outline_width);
|
context->set_line_width (_outline_width);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
Outline::add_outline_state (XMLNode* node) const
|
|
||||||
{
|
|
||||||
node->add_property ("outline-color", string_compose ("%1", _outline_color));
|
|
||||||
node->add_property ("outline", _outline ? "yes" : "no");
|
|
||||||
node->add_property ("outline-width", string_compose ("%1", _outline_width));
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
Outline::set_outline_state (XMLNode const * node)
|
|
||||||
{
|
|
||||||
_outline_color = atoll (node->property("outline-color")->value().c_str());
|
|
||||||
_outline = PBD::string_is_affirmative (node->property("outline")->value().c_str());
|
|
||||||
_outline_width = atof (node->property("outline-width")->value().c_str());
|
|
||||||
|
|
||||||
_bounding_box_dirty = true;
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -49,15 +49,3 @@ Pixbuf::pixbuf() {
|
||||||
return _pixbuf;
|
return _pixbuf;
|
||||||
}
|
}
|
||||||
|
|
||||||
XMLNode *
|
|
||||||
Pixbuf::get_state () const
|
|
||||||
{
|
|
||||||
/* XXX */
|
|
||||||
return new XMLNode ("Pixbuf");
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
Pixbuf::set_state (XMLNode const * /*node*/)
|
|
||||||
{
|
|
||||||
/* XXX */
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -109,33 +109,6 @@ PolyItem::get () const
|
||||||
return _points;
|
return _points;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
PolyItem::add_poly_item_state (XMLNode* node) const
|
|
||||||
{
|
|
||||||
add_item_state (node);
|
|
||||||
|
|
||||||
for (Points::const_iterator i = _points.begin(); i != _points.end(); ++i) {
|
|
||||||
XMLNode* p = new XMLNode ("Point");
|
|
||||||
p->add_property ("x", string_compose ("%1", i->x));
|
|
||||||
p->add_property ("y", string_compose ("%1", i->y));
|
|
||||||
node->add_child_nocopy (*p);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
PolyItem::set_poly_item_state (XMLNode const * node)
|
|
||||||
{
|
|
||||||
XMLNodeList const & children = node->children ();
|
|
||||||
for (XMLNodeList::const_iterator i = children.begin(); i != children.end(); ++i) {
|
|
||||||
Duple p;
|
|
||||||
p.x = atof ((*i)->property("x")->value().c_str());
|
|
||||||
p.y = atof ((*i)->property("y")->value().c_str());
|
|
||||||
_points.push_back (p);
|
|
||||||
}
|
|
||||||
|
|
||||||
_bounding_box_dirty = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
PolyItem::dump (ostream& o) const
|
PolyItem::dump (ostream& o) const
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -19,20 +19,3 @@ PolyLine::render (Rect const & area, Cairo::RefPtr<Cairo::Context> context) cons
|
||||||
context->stroke ();
|
context->stroke ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
XMLNode *
|
|
||||||
PolyLine::get_state () const
|
|
||||||
{
|
|
||||||
XMLNode* node = new XMLNode ("PolyLine");
|
|
||||||
add_poly_item_state (node);
|
|
||||||
add_outline_state (node);
|
|
||||||
return node;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
PolyLine::set_state (XMLNode const * node)
|
|
||||||
{
|
|
||||||
set_poly_item_state (node);
|
|
||||||
set_outline_state (node);
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -31,26 +31,3 @@ Polygon::render (Rect const & area, Cairo::RefPtr<Cairo::Context> context) const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
XMLNode *
|
|
||||||
Polygon::get_state () const
|
|
||||||
{
|
|
||||||
XMLNode* node = new XMLNode ("Polygon");
|
|
||||||
#ifdef CANVAS_DEBUG
|
|
||||||
if (!name.empty ()) {
|
|
||||||
node->add_property ("name", name);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
add_poly_item_state (node);
|
|
||||||
add_outline_state (node);
|
|
||||||
add_fill_state (node);
|
|
||||||
return node;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
Polygon::set_state (XMLNode const * node)
|
|
||||||
{
|
|
||||||
set_poly_item_state (node);
|
|
||||||
set_outline_state (node);
|
|
||||||
set_fill_state (node);
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -194,39 +194,3 @@ Rectangle::set_outline_what (int what)
|
||||||
set_outline_what ((What) what);
|
set_outline_what ((What) what);
|
||||||
}
|
}
|
||||||
|
|
||||||
XMLNode *
|
|
||||||
Rectangle::get_state () const
|
|
||||||
{
|
|
||||||
XMLNode* node = new XMLNode ("Rectangle");
|
|
||||||
#ifdef CANVAS_DEBUG
|
|
||||||
if (!name.empty ()) {
|
|
||||||
node->add_property ("name", name);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
node->add_property ("x0", string_compose ("%1", _rect.x0));
|
|
||||||
node->add_property ("y0", string_compose ("%1", _rect.y0));
|
|
||||||
node->add_property ("x1", string_compose ("%1", _rect.x1));
|
|
||||||
node->add_property ("y1", string_compose ("%1", _rect.y1));
|
|
||||||
node->add_property ("outline-what", string_compose ("%1", _outline_what));
|
|
||||||
|
|
||||||
add_item_state (node);
|
|
||||||
add_outline_state (node);
|
|
||||||
add_fill_state (node);
|
|
||||||
return node;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
Rectangle::set_state (XMLNode const * node)
|
|
||||||
{
|
|
||||||
_rect.x0 = atof (node->property("x0")->value().c_str());
|
|
||||||
_rect.y0 = atof (node->property("y0")->value().c_str());
|
|
||||||
_rect.x1 = atof (node->property("x1")->value().c_str());
|
|
||||||
_rect.y1 = atof (node->property("y1")->value().c_str());
|
|
||||||
_outline_what = (What) atoi (node->property("outline-what")->value().c_str());
|
|
||||||
|
|
||||||
set_item_state (node);
|
|
||||||
set_outline_state (node);
|
|
||||||
set_fill_state (node);
|
|
||||||
|
|
||||||
_bounding_box_dirty = true;
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -131,24 +131,6 @@ Text::render (Rect const & /*area*/, Cairo::RefPtr<Cairo::Context> context) cons
|
||||||
context->fill ();
|
context->fill ();
|
||||||
}
|
}
|
||||||
|
|
||||||
XMLNode *
|
|
||||||
Text::get_state () const
|
|
||||||
{
|
|
||||||
XMLNode* node = new XMLNode ("Text");
|
|
||||||
#ifdef CANVAS_DEBUG
|
|
||||||
if (!name.empty ()) {
|
|
||||||
node->add_property ("name", name);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
return node;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
Text::set_state (XMLNode const * /*node*/)
|
|
||||||
{
|
|
||||||
/* XXX */
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Text::set_alignment (Pango::Alignment alignment)
|
Text::set_alignment (Pango::Alignment alignment)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -165,19 +165,6 @@ WaveView::compute_bounding_box () const
|
||||||
_bounding_box_dirty = false;
|
_bounding_box_dirty = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
XMLNode *
|
|
||||||
WaveView::get_state () const
|
|
||||||
{
|
|
||||||
/* XXX */
|
|
||||||
return new XMLNode ("WaveView");
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
WaveView::set_state (XMLNode const * /*node*/)
|
|
||||||
{
|
|
||||||
/* XXX */
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
WaveView::set_height (Distance height)
|
WaveView::set_height (Distance height)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,6 @@ canvas_sources = [
|
||||||
'flag.cc',
|
'flag.cc',
|
||||||
'group.cc',
|
'group.cc',
|
||||||
'image.cc',
|
'image.cc',
|
||||||
'item_factory.cc',
|
|
||||||
'line.cc',
|
'line.cc',
|
||||||
'line_set.cc',
|
'line_set.cc',
|
||||||
'lookup_table.cc',
|
'lookup_table.cc',
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue