From a73d81fc89430968c9575f839b2f1400db0df387 Mon Sep 17 00:00:00 2001 From: Kolan Sh Date: Mon, 15 Jan 2018 12:05:21 +0300 Subject: [PATCH] Most of methods should be virtual. --- src/Axis.vala | 2 +- src/Grid.vala | 2 +- src/Legend.vala | 2 +- src/Marker.vala | 2 +- src/Place.vala | 2 +- src/Series.vala | 2 +- src/Text.vala | 13 ++++++------- 7 files changed, 12 insertions(+), 13 deletions(-) diff --git a/src/Axis.vala b/src/Axis.vala index dd35252..9c7a2b5 100644 --- a/src/Axis.vala +++ b/src/Axis.vala @@ -77,7 +77,7 @@ namespace CairoChart { public Line.Style line_style = Line.Style (); public double font_indent = 5; - public Axis copy () { + public virtual Axis copy () { var axis = new Axis (); axis._date_format = this._date_format; axis._dsec_signs = this._dsec_signs; diff --git a/src/Grid.vala b/src/Grid.vala index 0c3e62c..e486a0e 100644 --- a/src/Grid.vala +++ b/src/Grid.vala @@ -8,7 +8,7 @@ namespace CairoChart { public Line.Style line_style = Line.Style (); - public Grid copy () { + public virtual Grid copy () { var grid = new Grid (); grid.color = this.color; grid.line_style = this.line_style; diff --git a/src/Legend.vala b/src/Legend.vala index 11d2398..9797ab7 100644 --- a/src/Legend.vala +++ b/src/Legend.vala @@ -21,7 +21,7 @@ namespace CairoChart { public double text_vspace = 2.0; public bool show = true; - public Legend copy () { + public virtual Legend copy () { var legend = new Legend (); legend.position = this.position; legend.font_style = this.font_style; diff --git a/src/Marker.vala b/src/Marker.vala index e5902ba..681da83 100644 --- a/src/Marker.vala +++ b/src/Marker.vala @@ -20,7 +20,7 @@ namespace CairoChart { this.size = size; } - public Marker copy () { + public virtual Marker copy () { return new Marker (type, size); } diff --git a/src/Place.vala b/src/Place.vala index fcaad33..f810a4c 100644 --- a/src/Place.vala +++ b/src/Place.vala @@ -29,7 +29,7 @@ namespace CairoChart { public double zoom_y_min = 0; public double zoom_y_max = 1; - public Place copy () { + public virtual Place copy () { var place = new Place (); place.x_min = this.x_min; place.x_max = this.x_max; diff --git a/src/Series.vala b/src/Series.vala index d7ed81b..8400d48 100644 --- a/src/Series.vala +++ b/src/Series.vala @@ -41,7 +41,7 @@ namespace CairoChart { public bool zoom_show = true; - public Series copy () { + public virtual Series copy () { var series = new Series (); series._color = this._color; series.axis_x = this.axis_x.copy (); diff --git a/src/Text.vala b/src/Text.vala index b8813bc..bd999b2 100644 --- a/src/Text.vala +++ b/src/Text.vala @@ -1,11 +1,10 @@ namespace CairoChart { - [Compact] public class Text { public string text = ""; public Font.Style style = Font.Style (); public Color color = Color(); - public Cairo.TextExtents get_extents (Cairo.Context context) { + public virtual Cairo.TextExtents get_extents (Cairo.Context context) { context.select_font_face (style.family, style.slant, style.weight); context.set_font_size (style.size); Cairo.TextExtents extents; @@ -13,7 +12,7 @@ namespace CairoChart { return extents; } - public double get_width (Cairo.Context context) { + public virtual double get_width (Cairo.Context context) { var extents = get_extents (context); switch (style.orientation) { case Font.Orientation.HORIZONTAL: return extents.width; @@ -22,7 +21,7 @@ namespace CairoChart { } } - public double get_height (Cairo.Context context) { + public virtual double get_height (Cairo.Context context) { var extents = get_extents (context); switch (style.orientation) { case Font.Orientation.HORIZONTAL: return extents.height; @@ -36,7 +35,7 @@ namespace CairoChart { double height; } - public Size get_size (Cairo.Context context) { + public virtual Size get_size (Cairo.Context context) { var sz = Size(); var extents = get_extents (context); switch (style.orientation) { @@ -52,7 +51,7 @@ namespace CairoChart { return sz; } - public void show (Cairo.Context context) { + public virtual void show (Cairo.Context context) { context.select_font_face(style.family, style.slant, style.weight); @@ -74,7 +73,7 @@ namespace CairoChart { this.color = color; } - public Text copy () { + public virtual Text copy () { var text = new Text (); text.text = this.text; text.style = this.style;