diff --git a/src/colorbutton.vala b/src/colorbutton.vala index 4a0a22f..df50642 100644 --- a/src/colorbutton.vala +++ b/src/colorbutton.vala @@ -15,7 +15,7 @@ * along with this program. If not, see . * */ -public class Colorway.PaletteButton : Gtk.Button { +public class Colorway.PaletteButton : He.FillButton { private Gtk.CssProvider provider = new Gtk.CssProvider(); private string _hex = ""; private Gtk.Stack image_stack = new Gtk.Stack(); diff --git a/src/hue_slider.vala b/src/hue_slider.vala index 967c8ed..d912ed8 100644 --- a/src/hue_slider.vala +++ b/src/hue_slider.vala @@ -19,26 +19,27 @@ * Co-Authored by: Arvianto Dwi Wicaksono */ -public class Colorway.HueSlider : Gtk.Scale { +public class Colorway.HueSlider : He.Slider { // Signals public signal void on_value_changed (double hue); public HueSlider (double hue) { - this.adjustment = new Gtk.Adjustment (hue, 0, 360, 1, 360, 0); + scale.adjustment = new Gtk.Adjustment (hue, 0, 360, 1, 360, 0); } construct { // Initialize parent's properties - this.orientation = Gtk.Orientation.HORIZONTAL; - this.draw_value = false; - this.digits = 0; - this.has_origin = false; + scale.orientation = Gtk.Orientation.HORIZONTAL; + scale.draw_value = false; + scale.digits = 0; + scale.has_origin = false; this.add_css_class ("clr-hue"); + this.stop_indicator_visibility = true; - this.value_changed.connect (() => { - double hue = this.adjustment.get_value () / 360; + scale.value_changed.connect (() => { + double hue = scale.adjustment.get_value () / 360; on_value_changed (hue); }); } diff --git a/src/window.vala b/src/window.vala index c695904..1bbdc8d 100644 --- a/src/window.vala +++ b/src/window.vala @@ -149,13 +149,13 @@ namespace Colorway { (float)Utils.make_srgb(g), (float)Utils.make_srgb(b)); - hue_slider.set_value(ch*360); + hue_slider.scale.set_value(ch*360); color_box.append(da); color_box.append(hue_slider); da.on_sv_move.connect ((s, v) => { - double hue = hue_slider.get_value () / 360; + double hue = hue_slider.scale.get_value () / 360; Gtk.hsv_to_rgb ((float)hue, (float)s, (float)v, out active_color.red, out active_color.green, out active_color.blue); var pcda = Utils.make_hex((float)Utils.make_srgb(active_color.red), @@ -202,7 +202,7 @@ namespace Colorway { setup_color_rules.begin (color, contrast, hue, s, v, color_rule_dropdown, sbox, tbox); }); - double hue = hue_slider.get_value () / 360; + double hue = hue_slider.scale.get_value () / 360; double s, v; da.pos_to_sv (out s, out v); setup_color_rules.begin (color, contrast, hue, s, v, color_rule_dropdown, sbox, tbox); @@ -246,7 +246,7 @@ namespace Colorway { da.sv_to_pos (csl, cvl); da.queue_draw(); - hue_slider.set_value(chl*360); + hue_slider.scale.set_value(chl*360); color = pcl.up(); color_label.get_entry ().set_text (pcl.up()); @@ -298,7 +298,7 @@ namespace Colorway { tbox.set_visible (false); break; case 1: - var h = (hue_shift (hue_slider.get_value (), 180.0)) / 360; + var h = (hue_shift (hue_slider.scale.get_value (), 180.0)) / 360; double cs, cv; da.pos_to_sv (out cs, out cv); Gtk.hsv_to_rgb ((float)h, (float)cs, (float)cv, out active_color.red, out active_color.green, out active_color.blue); @@ -312,7 +312,7 @@ namespace Colorway { break; case 2: - var ch1 = (hue_shift (hue_slider.get_value (), 120.0)) / 360; + var ch1 = (hue_shift (hue_slider.scale.get_value (), 120.0)) / 360; double cs1, cv1; da.pos_to_sv (out cs1, out cv1); Gtk.hsv_to_rgb ((float)ch1, (float)cs1, (float)cv1, out active_color.red, out active_color.green, out active_color.blue); @@ -320,7 +320,7 @@ namespace Colorway { (float)Utils.make_srgb(active_color.green), (float)Utils.make_srgb(active_color.blue)); - var ch2 = (hue_shift (hue_slider.get_value (), 240.0)) / 360; + var ch2 = (hue_shift (hue_slider.scale.get_value (), 240.0)) / 360; double cs2, cv2; da.pos_to_sv (out cs2, out cv2); Gtk.hsv_to_rgb ((float)ch2, (float)cs2, (float)cv2, out active_color.red, out active_color.green, out active_color.blue); @@ -334,7 +334,7 @@ namespace Colorway { break; case 3: - var ch1 = (hue_shift (hue_slider.get_value (), 90.0)) / 360; + var ch1 = (hue_shift (hue_slider.scale.get_value (), 90.0)) / 360; double cs1, cv1; da.pos_to_sv (out cs1, out cv1); Gtk.hsv_to_rgb ((float)ch1, (float)cs1, (float)cv1, out active_color.red, out active_color.green, out active_color.blue); @@ -342,7 +342,7 @@ namespace Colorway { (float)Utils.make_srgb(active_color.green), (float)Utils.make_srgb(active_color.blue)); - var ch2 = (hue_shift (hue_slider.get_value (), 180.0)) / 360; + var ch2 = (hue_shift (hue_slider.scale.get_value (), 180.0)) / 360; double cs2, cv2; da.pos_to_sv (out cs2, out cv2); Gtk.hsv_to_rgb ((float)ch2, (float)cs2, (float)cv2, out active_color.red, out active_color.green, out active_color.blue); @@ -350,7 +350,7 @@ namespace Colorway { (float)Utils.make_srgb(active_color.green), (float)Utils.make_srgb(active_color.blue)); - var ch3 = (hue_shift (hue_slider.get_value (), 270.0)) / 360; + var ch3 = (hue_shift (hue_slider.scale.get_value (), 270.0)) / 360; double cs3, cv3; da.pos_to_sv (out cs3, out cv3); Gtk.hsv_to_rgb ((float)ch3, (float)cs3, (float)cv3, out active_color.red, out active_color.green, out active_color.blue); @@ -427,7 +427,7 @@ namespace Colorway { active_color = color_portal; da.active_color = color_portal; - hue_slider.set_value(h*360); + hue_slider.scale.set_value(h*360); if (Utils.contrast_ratio(active_color, {0,0,0,1}) > Utils.contrast_ratio(active_color, {1,1,1,1}) + 3) { contrast = "#000000";