diff --git a/rtdata/themes/09-Gray-Orange.gtkrc b/rtdata/themes/09-Gray-Orange.gtkrc index 11b82bb25..e08fd939c 100644 --- a/rtdata/themes/09-Gray-Orange.gtkrc +++ b/rtdata/themes/09-Gray-Orange.gtkrc @@ -153,6 +153,13 @@ style "clearlooks-spinbutton" { } } +style "clearlooks-framelessspinbutton" { + + # IMPORTANT! + # base[NORMAL] must have the same color than notebook bg[NORMAL] + base[NORMAL] = shade (1.02, @rt_bg_color) +} + style "clearlooks-scale" { xthickness = 2 ythickness = 2 @@ -209,6 +216,8 @@ style "clearlooks-vscrollbar" { style "clearlooks-notebook_bg" { + # IMPORTANT! + # If you modify bg[NORMAL] here under, you must set clearlooks-framelessspinbutton -> base[NORMAL] to the very same value bg[NORMAL] = shade (1.02, @rt_bg_color) bg[ACTIVE] = @rt_base_color } @@ -454,6 +463,7 @@ widget_class "*.." style "clearlooks-treeview_header" widget "*.partialPasteHeader.*" style "clearlooks-frame_title" widget "*.partialPasteHeaderSep" style "clearlooks-partialPasteHeaderSep" widget "*.histButton" style "clearlooks-histButton" +widget "*.FramelessSpinButton" style "clearlooks-framelessspinbutton" # The window of the tooltip is called "gtk-tooltip" ################################################################## diff --git a/rtdata/themes/17-Gray-Red.gtkrc b/rtdata/themes/17-Gray-Red.gtkrc index 6ff72761c..8bce5f943 100644 --- a/rtdata/themes/17-Gray-Red.gtkrc +++ b/rtdata/themes/17-Gray-Red.gtkrc @@ -153,6 +153,13 @@ style "clearlooks-spinbutton" { } } +style "clearlooks-framelessspinbutton" { + + # IMPORTANT! + # base[NORMAL] must have the same color than notebook bg[NORMAL] + base[NORMAL] = shade (1.02, @rt_bg_color) +} + style "clearlooks-scale" { xthickness = 2 ythickness = 2 @@ -209,6 +216,8 @@ style "clearlooks-vscrollbar" { style "clearlooks-notebook_bg" { + # IMPORTANT! + # If you modify bg[NORMAL] here under, you must set clearlooks-framelessspinbutton -> base[NORMAL] to the very same value bg[NORMAL] = shade (1.02, @rt_bg_color) bg[ACTIVE] = shade (0.80, @rt_bg_color) } @@ -454,6 +463,7 @@ widget_class "*.." style "clearlooks-treeview_header" widget "*.partialPasteHeader.*" style "clearlooks-frame_title" widget "*.partialPasteHeaderSep" style "clearlooks-partialPasteHeaderSep" widget "*.histButton" style "clearlooks-histButton" +widget "*.FramelessSpinButton" style "clearlooks-framelessspinbutton" # The window of the tooltip is called "gtk-tooltip" ################################################################## diff --git a/rtdata/themes/21-Gray-Gray.gtkrc b/rtdata/themes/21-Gray-Gray.gtkrc index f7c723732..7c36d98d8 100644 --- a/rtdata/themes/21-Gray-Gray.gtkrc +++ b/rtdata/themes/21-Gray-Gray.gtkrc @@ -153,6 +153,13 @@ style "clearlooks-spinbutton" { } } +style "clearlooks-framelessspinbutton" { + + # IMPORTANT! + # base[NORMAL] must have the same color than notebook bg[NORMAL] + base[NORMAL] = shade (1.02, @rt_bg_color) +} + style "clearlooks-scale" { xthickness = 2 ythickness = 2 @@ -209,6 +216,8 @@ style "clearlooks-vscrollbar" { style "clearlooks-notebook_bg" { + # IMPORTANT! + # If you modify bg[NORMAL] here under, you must set clearlooks-framelessspinbutton -> base[NORMAL] to the very same value bg[NORMAL] = shade (1.02, @rt_bg_color) bg[ACTIVE] = @rt_base_color } @@ -465,6 +474,7 @@ widget_class "*.." style "clearlooks-treeview_header" widget "*.partialPasteHeader.*" style "clearlooks-frame_title" widget "*.partialPasteHeaderSep" style "clearlooks-partialPasteHeaderSep" widget "*.histButton" style "clearlooks-histButton" +widget "*.FramelessSpinButton" style "clearlooks-framelessspinbutton" # The window of the tooltip is called "gtk-tooltip" ################################################################## diff --git a/rtdata/themes/25-Gray-Gray.gtkrc b/rtdata/themes/25-Gray-Gray.gtkrc index a75ddbbe9..a3cf6d1ff 100644 --- a/rtdata/themes/25-Gray-Gray.gtkrc +++ b/rtdata/themes/25-Gray-Gray.gtkrc @@ -153,6 +153,13 @@ style "clearlooks-spinbutton" { } } +style "clearlooks-framelessspinbutton" { + + # IMPORTANT! + # base[NORMAL] must have the same color than notebook bg[NORMAL] + base[NORMAL] = shade (1.02, @rt_bg_color) +} + style "clearlooks-scale" { xthickness = 2 ythickness = 2 @@ -209,6 +216,8 @@ style "clearlooks-vscrollbar" { style "clearlooks-notebook_bg" { + # IMPORTANT! + # If you modify bg[NORMAL] here under, you must set clearlooks-framelessspinbutton -> base[NORMAL] to the very same value bg[NORMAL] = shade (1.02, @rt_bg_color) bg[ACTIVE] = shade (0.80, @rt_bg_color) } @@ -454,6 +463,7 @@ widget_class "*.." style "clearlooks-treeview_header" widget "*.partialPasteHeader.*" style "clearlooks-frame_title" widget "*.partialPasteHeaderSep" style "clearlooks-partialPasteHeaderSep" widget "*.histButton" style "clearlooks-histButton" +widget "*.FramelessSpinButton" style "clearlooks-framelessspinbutton" # The window of the tooltip is called "gtk-tooltip" ################################################################## diff --git a/rtdata/themes/25-Gray-Purple.gtkrc b/rtdata/themes/25-Gray-Purple.gtkrc index e571b08e9..a50cf093f 100644 --- a/rtdata/themes/25-Gray-Purple.gtkrc +++ b/rtdata/themes/25-Gray-Purple.gtkrc @@ -153,6 +153,13 @@ style "clearlooks-spinbutton" { } } +style "clearlooks-framelessspinbutton" { + + # IMPORTANT! + # base[NORMAL] must have the same color than notebook bg[NORMAL] + base[NORMAL] = shade (1.02, @rt_bg_color) +} + style "clearlooks-scale" { xthickness = 2 ythickness = 2 @@ -209,6 +216,8 @@ style "clearlooks-vscrollbar" { style "clearlooks-notebook_bg" { + # IMPORTANT! + # If you modify bg[NORMAL] here under, you must set clearlooks-framelessspinbutton -> base[NORMAL] to the very same value bg[NORMAL] = shade (1.02, @rt_bg_color) bg[ACTIVE] = shade (0.80, @rt_bg_color) } @@ -454,6 +463,7 @@ widget_class "*.." style "clearlooks-treeview_header" widget "*.partialPasteHeader.*" style "clearlooks-frame_title" widget "*.partialPasteHeaderSep" style "clearlooks-partialPasteHeaderSep" widget "*.histButton" style "clearlooks-histButton" +widget "*.FramelessSpinButton" style "clearlooks-framelessspinbutton" # The window of the tooltip is called "gtk-tooltip" ################################################################## diff --git a/rtdata/themes/25-Gray-Red.gtkrc b/rtdata/themes/25-Gray-Red.gtkrc index 427ee936d..19dfbd184 100644 --- a/rtdata/themes/25-Gray-Red.gtkrc +++ b/rtdata/themes/25-Gray-Red.gtkrc @@ -153,6 +153,13 @@ style "clearlooks-spinbutton" { } } +style "clearlooks-framelessspinbutton" { + + # IMPORTANT! + # base[NORMAL] must have the same color than notebook bg[NORMAL] + base[NORMAL] = shade (1.02, @rt_bg_color) +} + style "clearlooks-scale" { xthickness = 2 ythickness = 2 @@ -209,6 +216,8 @@ style "clearlooks-vscrollbar" { style "clearlooks-notebook_bg" { + # IMPORTANT! + # If you modify bg[NORMAL] here under, you must set clearlooks-framelessspinbutton -> base[NORMAL] to the very same value bg[NORMAL] = shade (1.02, @rt_bg_color) bg[ACTIVE] = shade (0.80, @rt_bg_color) } @@ -454,6 +463,7 @@ widget_class "*.." style "clearlooks-treeview_header" widget "*.partialPasteHeader.*" style "clearlooks-frame_title" widget "*.partialPasteHeaderSep" style "clearlooks-partialPasteHeaderSep" widget "*.histButton" style "clearlooks-histButton" +widget "*.FramelessSpinButton" style "clearlooks-framelessspinbutton" # The window of the tooltip is called "gtk-tooltip" ################################################################## diff --git a/rtdata/themes/37-Gray-Red-Textured.gtkrc b/rtdata/themes/37-Gray-Red-Textured.gtkrc index 5f18b01f7..e23536d4f 100644 --- a/rtdata/themes/37-Gray-Red-Textured.gtkrc +++ b/rtdata/themes/37-Gray-Red-Textured.gtkrc @@ -155,6 +155,13 @@ style "clearlooks-spinbutton" { } } +style "clearlooks-framelessspinbutton" { + + # IMPORTANT! + # base[NORMAL] must have the same color than notebook bg[NORMAL] + base[NORMAL] = @rt_bg_color +} + style "clearlooks-scale" { xthickness = 2 ythickness = 2 @@ -558,6 +565,8 @@ style "clearlooks-range" { style "clearlooks-notebook_bg" { + # IMPORTANT! + # If you modify bg[NORMAL] here under, you must set clearlooks-framelessspinbutton -> base[NORMAL] to the very same value bg[NORMAL] = @rt_bg_color bg[ACTIVE] = shade (0.85, @rt_bg_color) } @@ -805,6 +814,7 @@ widget_class "*.." style "clearlooks-treeview_header" widget "*.partialPasteHeader.*" style "clearlooks-frame_title" widget "*.partialPasteHeaderSep" style "clearlooks-partialPasteHeaderSep" widget "*.histButton" style "clearlooks-histButton" +widget "*.FramelessSpinButton" style "clearlooks-framelessspinbutton" # The window of the tooltip is called "gtk-tooltip" ################################################################## diff --git a/rtdata/themes/37-Gray-Red.gtkrc b/rtdata/themes/37-Gray-Red.gtkrc index 65a9f2ff1..75c700c75 100644 --- a/rtdata/themes/37-Gray-Red.gtkrc +++ b/rtdata/themes/37-Gray-Red.gtkrc @@ -153,6 +153,13 @@ style "clearlooks-spinbutton" { } } +style "clearlooks-framelessspinbutton" { + + # IMPORTANT! + # base[NORMAL] must have the same color than notebook bg[NORMAL] + base[NORMAL] = @rt_bg_color +} + style "clearlooks-scale" { xthickness = 2 ythickness = 2 @@ -209,6 +216,8 @@ style "clearlooks-vscrollbar" { style "clearlooks-notebook_bg" { + # IMPORTANT! + # If you modify bg[NORMAL] here under, you must set clearlooks-framelessspinbutton -> base[NORMAL] to the very same value bg[NORMAL] = @rt_bg_color bg[ACTIVE] = shade (0.85, @rt_bg_color) } @@ -455,6 +464,7 @@ widget_class "*.." style "clearlooks-treeview_header" widget "*.partialPasteHeader.*" style "clearlooks-frame_title" widget "*.partialPasteHeaderSep" style "clearlooks-partialPasteHeaderSep" widget "*.histButton" style "clearlooks-histButton" +widget "*.FramelessSpinButton" style "clearlooks-framelessspinbutton" # The window of the tooltip is called "gtk-tooltip" ################################################################## diff --git a/rtdata/themes/63-Gray-Cyan.gtkrc b/rtdata/themes/63-Gray-Cyan.gtkrc index b45a21c8e..966d27923 100644 --- a/rtdata/themes/63-Gray-Cyan.gtkrc +++ b/rtdata/themes/63-Gray-Cyan.gtkrc @@ -153,6 +153,13 @@ style "clearlooks-spinbutton" { } } +style "clearlooks-framelessspinbutton" { + + # IMPORTANT! + # base[NORMAL] must have the same color than notebook bg[NORMAL] + base[NORMAL] = shade (1.05, @rt_bg_color) +} + style "clearlooks-scale" { xthickness = 2 ythickness = 2 @@ -209,6 +216,8 @@ style "clearlooks-vscrollbar" { style "clearlooks-notebook_bg" { + # IMPORTANT! + # If you modify bg[NORMAL] here under, you must set clearlooks-framelessspinbutton -> base[NORMAL] to the very same value bg[NORMAL] = shade (1.05, @rt_bg_color) bg[ACTIVE] = shade (0.92, @rt_bg_color) } @@ -455,6 +464,7 @@ widget_class "*.." style "clearlooks-treeview_header" widget "*.partialPasteHeader.*" style "clearlooks-frame_title" widget "*.partialPasteHeaderSep" style "clearlooks-partialPasteHeaderSep" widget "*.histButton" style "clearlooks-histButton" +widget "*.FramelessSpinButton" style "clearlooks-framelessspinbutton" # The window of the tooltip is called "gtk-tooltip" ################################################################## diff --git a/rtdata/themes/92-Beige-DarkCyan.gtkrc b/rtdata/themes/92-Beige-DarkCyan.gtkrc index 195c8309c..72ae0e43d 100644 --- a/rtdata/themes/92-Beige-DarkCyan.gtkrc +++ b/rtdata/themes/92-Beige-DarkCyan.gtkrc @@ -153,6 +153,13 @@ style "clearlooks-spinbutton" { } } +style "clearlooks-framelessspinbutton" { + + # IMPORTANT! + # base[NORMAL] must have the same color than notebook bg[NORMAL] + base[NORMAL] = shade (1.02, @rt_bg_color) +} + style "clearlooks-scale" { xthickness = 2 ythickness = 2 @@ -209,6 +216,8 @@ style "clearlooks-vscrollbar" { style "clearlooks-notebook_bg" { + # IMPORTANT! + # If you modify bg[NORMAL] here under, you must set clearlooks-framelessspinbutton -> base[NORMAL] to the very same value bg[NORMAL] = shade (1.02, @rt_bg_color) } @@ -442,6 +451,7 @@ widget_class "*.." style "clearlooks-treeview_header" widget "*.partialPasteHeader.*" style "clearlooks-frame_title" widget "*.partialPasteHeaderSep" style "clearlooks-partialPasteHeaderSep" widget "*.histButton" style "clearlooks-histButton" +widget "*.FramelessSpinButton" style "clearlooks-framelessspinbutton" # The window of the tooltip is called "gtk-tooltip" ################################################################## diff --git a/rtdata/themes/Default.gtkrc b/rtdata/themes/Default.gtkrc index fc74d755b..ca06c4d9f 100644 --- a/rtdata/themes/Default.gtkrc +++ b/rtdata/themes/Default.gtkrc @@ -142,6 +142,13 @@ style "clearlooks-spinbutton" { } } +style "clearlooks-framelessspinbutton" { + + # IMPORTANT! + # base[NORMAL] must have the same color than notebook bg[NORMAL] + base[NORMAL] = shade (1.02, @rt_bg_color) +} + style "clearlooks-scale" { xthickness = 2 ythickness = 2 @@ -190,6 +197,8 @@ style "clearlooks-vscrollbar" { style "clearlooks-notebook_bg" { + # IMPORTANT! + # If you modify bg[NORMAL] here under, you must set clearlooks-framelessspinbutton -> base[NORMAL] to the very same value bg[NORMAL] = shade (1.02, @rt_bg_color) } @@ -395,6 +404,7 @@ widget_class "*.." style "clearlooks-treeview_header" widget "*.partialPasteHeader.*" style "clearlooks-frame_title" widget "*.partialPasteHeaderSep" style "clearlooks-partialPasteHeaderSep" widget "*.histButton" style "clearlooks-histButton" +widget "*.FramelessSpinButton" style "clearlooks-framelessspinbutton" # The window of the tooltip is called "gtk-tooltip" ################################################################## diff --git a/rtgui/adjuster.cc b/rtgui/adjuster.cc index 62126a5af..d585c1720 100644 --- a/rtgui/adjuster.cc +++ b/rtgui/adjuster.cc @@ -67,6 +67,8 @@ Adjuster::Adjuster (Glib::ustring vlabel, double vmin, double vmax, double vstep hbox->pack_end (*reset, Gtk::PACK_SHRINK, 0); spin = Gtk::manage (new MySpinButton ()); + spin->set_has_frame(false); + spin->set_name("FramelessSpinButton"); hbox->pack_end (*spin, Gtk::PACK_SHRINK, 0); @@ -132,6 +134,8 @@ Adjuster::Adjuster (Gtk::Image *imgIcon, double vmin, double vmax, double vstep, hbox->pack_end (*reset, Gtk::PACK_SHRINK, 0); spin = Gtk::manage (new MySpinButton ()); + spin->set_has_frame(false); + spin->set_name("FramelessSpinButton"); reset->set_size_request (-1, spin->get_height()); @@ -208,18 +212,13 @@ void Adjuster::setLimits (double vmin, double vmax, double vstep, double vdefaul spin->set_digits (digits); spin->set_increments (vstep, 2.0*vstep); spin->set_range (vmin, vmax); + spin->updateSize(); spin->set_value (shapeValue(vdefault)); slider->set_digits (digits); slider->set_increments (vstep, 2.0*vstep); slider->set_range (vmin, vmax); slider->set_value (shapeValue(vdefault)); //defaultVal = shapeValue (vdefault); - - double maxAbs = fmax(fabs(vmin), fabs(vmax)); - int digits2; - for (digits2=0; maxAbs/pow(double(10),digits2)>=1.0; digits2++); - spin->set_width_chars(digits+digits2+(vmin<0?1:0)+(digits>0?1:0)); - sliderChange.block (false); spinChange.block (false); } diff --git a/rtgui/guiutils.cc b/rtgui/guiutils.cc index 85812ba64..9dffd7d9d 100644 --- a/rtgui/guiutils.cc +++ b/rtgui/guiutils.cc @@ -309,13 +309,44 @@ MySpinButton::MySpinButton () { Gtk::Border border; border.bottom = 0; border.top = 0; - border.left = 0; - border.right = 0; + border.left = 3; + border.right = 3; set_inner_border(border); + set_numeric(true); + set_wrap(true); + set_alignment(Gtk::ALIGN_RIGHT); +} + +void MySpinButton::updateSize() { + double vMin, vMax; + double step, page; + double maxAbs; + unsigned int digits, digits2; + unsigned int maxLen; + + get_range(vMin, vMax); + get_increments (step, page); + + maxAbs = fmax(fabs(vMin), fabs(vMax)); + digits = get_digits(); + for (digits2=0; maxAbs/pow(double(10),digits2)>=1.0; digits2++); + maxLen = digits+digits2+(vMin<0?1:0)+(digits>0?1:0); + + set_max_length(maxLen); + set_width_chars(maxLen); +} + +bool MySpinButton::on_key_press_event (GdkEventKey* event) { + bool rcode = Gtk::Widget::on_key_press_event(event); + if ( (event->string[0] >= 'a' && event->string[0] <= 'z') + ||(event->string[0] >= 'A' && event->string[0] <= 'Z') + || event->string[0] == '+' + ) + return false; + return rcode; } bool MySpinButton::on_scroll_event (GdkEventScroll* event) { - // If Shift is pressed, the widget is modified if (event->state & GDK_SHIFT_MASK) { Gtk::SpinButton::on_scroll_event(event); diff --git a/rtgui/guiutils.h b/rtgui/guiutils.h index e150ca127..9256d5c09 100644 --- a/rtgui/guiutils.h +++ b/rtgui/guiutils.h @@ -109,10 +109,13 @@ public: */ class MySpinButton : public Gtk::SpinButton { +protected: bool on_scroll_event (GdkEventScroll* event); + bool on_key_press_event (GdkEventKey* event); public: MySpinButton (); + void updateSize(); }; /**