~rainct/screenruler/screenruler-gtk3

« back to all changes in this revision

Viewing changes to preferences_window.rb

  • Committer: yella
  • Date: 2008-12-23 10:55:52 UTC
  • Revision ID: yella@nutwork-20081223105552-3sv20ja8wpw14bo9
- use radiobuttons in preference window
- bump to 0.89

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
                # GTK signal handlers
32
32
                @window.signal_connect('delete_event') { hide }
33
33
 
34
 
                @system_ppi_setting_label.markup = sprintf("<small>(currently %d x %d)</small>", system_ppi_horizontal, system_ppi_vertical)
 
34
                @system_ppi_setting_label.markup = sprintf("(%d x %d)", system_ppi_horizontal, system_ppi_vertical)
35
35
        end
36
36
 
37
37
        def foreground_color ; return @foreground_color_button.color ; end
42
42
        attr_reader :opacity
43
43
 
44
44
        def ppi_horizontal
45
 
                if @use_system_ppi_checkbutton.active?
 
45
                if @use_custom_ppi_radiobutton.active?
 
46
                        @ppi_horizontal_spinbutton.value
 
47
                else
46
48
                        system_ppi_horizontal
47
 
                else
48
 
                        @ppi_horizontal_spinbutton.value
49
49
                end
50
50
        end
51
51
 
52
52
        def ppi_vertical
53
 
                if @use_system_ppi_checkbutton.active?
 
53
                if @use_custom_ppi_radiobutton.active?
 
54
                        @ppi_vertical_spinbutton.value
 
55
                else
54
56
                        system_ppi_vertical
55
 
                else
56
 
                        @ppi_vertical_spinbutton.value
57
57
                end
58
58
        end
59
59
 
70
70
                @opacity = settings['opacity'] || DEFAULT_OPACITY
71
71
                @ppi_horizontal_spinbutton.value = settings['horizontal_pixels_per_inch'] || system_ppi_horizontal
72
72
                @ppi_vertical_spinbutton.value = settings['vertical_pixels_per_inch'] || system_ppi_vertical
73
 
                @use_system_ppi_checkbutton.active = !(settings['use_custom_pixels_per_inch'] || false)
 
73
                @use_custom_ppi_radiobutton.active = !(settings['use_custom_pixels_per_inch'] || false)
74
74
        end
75
75
 
76
76
        def write_settings(settings)
78
78
                settings['background_color'] = self.background_color.to_hex
79
79
                settings['font'] = self.font
80
80
                settings['opacity'] = @opacity
81
 
                settings['use_custom_pixels_per_inch'] = !@use_system_ppi_checkbutton.active?
 
81
                settings['use_custom_pixels_per_inch'] = @use_custom_ppi_radiobutton.active?
82
82
                settings['horizontal_pixels_per_inch'] = @ppi_horizontal_spinbutton.value
83
83
                settings['vertical_pixels_per_inch'] = @ppi_vertical_spinbutton.value
84
84
        end
104
104
                on_style_changed
105
105
        end
106
106
 
107
 
        def on_use_system_ppi_checkbutton_toggled
108
 
                @custom_ppi_settings_container.sensitive = !@use_system_ppi_checkbutton.active?
109
 
                @system_ppi_setting_label.sensitive = @use_system_ppi_checkbutton.active?
 
107
        def on_use_custom_ppi_radiobutton_toggled
 
108
                @custom_ppi_settings_container.sensitive = @use_custom_ppi_radiobutton.active?
 
109
                @system_ppi_setting_label.sensitive = !@use_custom_ppi_radiobutton.active?
110
110
                on_style_changed
111
111
        end
112
112