@@ -52,6 +52,7 @@ pub struct OptionsDialogResult {
5252 pub language : String ,
5353 pub update_channel : crate :: config:: UpdateChannel ,
5454 pub readability_font : ReadabilityFont ,
55+ pub line_spacing : i32 ,
5556}
5657
5758bitflags ! {
@@ -92,6 +93,7 @@ struct OptionsDialogUi {
9293 ok_button : Button ,
9394 cancel_button : Button ,
9495 readability_font : Rc < RefCell < ReadabilityFont > > ,
96+ line_spacing_ctrl : Choice ,
9597}
9698
9799pub fn show_options_dialog ( parent : & Frame , config : & ConfigManager ) -> Option < OptionsDialogResult > {
@@ -107,13 +109,15 @@ pub fn show_options_dialog(parent: &Frame, config: &ConfigManager) -> Option<Opt
107109 _ => crate :: config:: UpdateChannel :: Stable ,
108110 } ;
109111 let readability_font = ui. readability_font . borrow ( ) . clone ( ) ;
112+ let line_spacing = ui. line_spacing_ctrl . get_selection ( ) . unwrap_or ( 0 ) as i32 ;
110113 Some ( OptionsDialogResult {
111114 flags,
112115 recent_documents_to_show : ui. recent_docs_ctrl . value ( ) ,
113116 reading_speed_wpm : ui. reading_speed_ctrl . value ( ) ,
114117 language,
115118 update_channel,
116119 readability_font,
120+ line_spacing,
117121 } )
118122}
119123
@@ -122,11 +126,13 @@ fn build_options_dialog_ui(parent: &Frame, config: &ConfigManager) -> OptionsDia
122126 let notebook = Notebook :: builder ( & dialog) . with_style ( NotebookStyle :: Top ) . build ( ) ;
123127 let general_panel = Panel :: builder ( & notebook) . build ( ) ;
124128 let reading_panel = Panel :: builder ( & notebook) . build ( ) ;
129+ let readability_panel = Panel :: builder ( & notebook) . build ( ) ;
125130 let general_sizer = BoxSizer :: builder ( Orientation :: Vertical ) . build ( ) ;
126131 let reading_sizer = BoxSizer :: builder ( Orientation :: Vertical ) . build ( ) ;
132+ let readability_sizer = BoxSizer :: builder ( Orientation :: Vertical ) . build ( ) ;
127133 let restore_docs_check =
128134 CheckBox :: builder ( & general_panel) . with_label ( & t ( "&Restore previously opened documents on startup" ) ) . build ( ) ;
129- let word_wrap_check = CheckBox :: builder ( & reading_panel ) . with_label ( & t ( "&Word wrap" ) ) . build ( ) ;
135+ let word_wrap_check = CheckBox :: builder ( & readability_panel ) . with_label ( & t ( "&Word wrap" ) ) . build ( ) ;
130136 let minimize_to_tray_check = CheckBox :: builder ( & general_panel) . with_label ( & t ( "&Minimize to system tray" ) ) . build ( ) ;
131137 let start_maximized_check = CheckBox :: builder ( & general_panel) . with_label ( & t ( "&Start maximized" ) ) . build ( ) ;
132138 let compact_go_menu_check = CheckBox :: builder ( & reading_panel) . with_label ( & t ( "Show compact &go menu" ) ) . build ( ) ;
@@ -139,7 +145,7 @@ fn build_options_dialog_ui(parent: &Frame, config: &ConfigManager) -> OptionsDia
139145 for check in [ & restore_docs_check, & start_maximized_check, & minimize_to_tray_check, & check_for_updates_check] {
140146 general_sizer. add ( check, 0 , SizerFlag :: All , option_padding) ;
141147 }
142- for check in [ & word_wrap_check , & navigation_wrap_check, & compact_go_menu_check, & bookmark_sounds_check] {
148+ for check in [ & navigation_wrap_check, & compact_go_menu_check, & bookmark_sounds_check] {
143149 reading_sizer. add ( check, 0 , SizerFlag :: All , option_padding) ;
144150 }
145151 let reading_speed_label =
@@ -180,8 +186,6 @@ fn build_options_dialog_ui(parent: &Frame, config: &ConfigManager) -> OptionsDia
180186 general_sizer. add_sizer ( & channel_sizer, 0 , SizerFlag :: All , option_padding) ;
181187
182188 // Readability tab
183- let readability_panel = Panel :: builder ( & notebook) . build ( ) ;
184- let readability_sizer = BoxSizer :: builder ( Orientation :: Vertical ) . build ( ) ;
185189 let font_group_box = StaticBox :: builder ( & readability_panel) . with_label ( & t ( "Font" ) ) . build ( ) ;
186190 let font_group_sizer = StaticBoxSizerBuilder :: new_with_box ( & font_group_box, Orientation :: Vertical ) . build ( ) ;
187191 let font_preview_label = StaticText :: builder ( & readability_panel) . with_label ( "" ) . build ( ) ;
@@ -191,6 +195,16 @@ fn build_options_dialog_ui(parent: &Frame, config: &ConfigManager) -> OptionsDia
191195 font_group_sizer. add ( & choose_font_button, 0 , SizerFlag :: All , option_padding) ;
192196 font_group_sizer. add ( & reset_font_button, 0 , SizerFlag :: All , option_padding) ;
193197 readability_sizer. add_sizer ( & font_group_sizer, 0 , SizerFlag :: Expand | SizerFlag :: All , option_padding) ;
198+ let line_spacing_label = StaticText :: builder ( & readability_panel) . with_label ( & t ( "&Line spacing:" ) ) . build ( ) ;
199+ let line_spacing_ctrl = Choice :: builder ( & readability_panel) . build ( ) ;
200+ line_spacing_ctrl. append ( & t ( "Normal" ) ) ;
201+ line_spacing_ctrl. append ( & t ( "1.5\u{00d7} " ) ) ;
202+ line_spacing_ctrl. append ( & t ( "Double" ) ) ;
203+ let line_spacing_sizer = BoxSizer :: builder ( Orientation :: Horizontal ) . build ( ) ;
204+ line_spacing_sizer. add ( & line_spacing_label, 0 , SizerFlag :: AlignCenterVertical | SizerFlag :: Right , DIALOG_PADDING ) ;
205+ line_spacing_sizer. add ( & line_spacing_ctrl, 0 , SizerFlag :: AlignCenterVertical , 0 ) ;
206+ readability_sizer. add ( & word_wrap_check, 0 , SizerFlag :: All , option_padding) ;
207+ readability_sizer. add_sizer ( & line_spacing_sizer, 0 , SizerFlag :: All , option_padding) ;
194208 readability_panel. set_sizer ( readability_sizer, true ) ;
195209
196210 general_panel. set_sizer ( general_sizer, true ) ;
@@ -228,6 +242,8 @@ fn build_options_dialog_ui(parent: &Frame, config: &ConfigManager) -> OptionsDia
228242 let initial_font = config. get_readability_font ( ) ;
229243 font_preview_label. set_label ( & font_description ( & initial_font) ) ;
230244 let readability_font = Rc :: new ( RefCell :: new ( initial_font) ) ;
245+ let stored_line_spacing = config. get_line_spacing ( ) . clamp ( 0 , 2 ) as u32 ;
246+ line_spacing_ctrl. set_selection ( stored_line_spacing) ;
231247
232248 // "Choose Font..." button handler
233249 let font_state = Rc :: clone ( & readability_font) ;
@@ -273,6 +289,7 @@ fn build_options_dialog_ui(parent: &Frame, config: &ConfigManager) -> OptionsDia
273289 ok_button,
274290 cancel_button,
275291 readability_font,
292+ line_spacing_ctrl,
276293 }
277294}
278295
0 commit comments