mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 19:22:45 +00:00 
			
		
		
		
	TextEditor: Put fonts in exclusive action group
This commit is contained in:
		
							parent
							
								
									4a57cbc98f
								
							
						
					
					
						commit
						15cb4207fc
					
				
					 2 changed files with 10 additions and 2 deletions
				
			
		|  | @ -429,12 +429,18 @@ TextEditorWidget::TextEditorWidget() | ||||||
|     view_menu.add_action(*m_html_preview_action); |     view_menu.add_action(*m_html_preview_action); | ||||||
|     view_menu.add_separator(); |     view_menu.add_separator(); | ||||||
| 
 | 
 | ||||||
|  |     font_actions.set_exclusive(true); | ||||||
|  | 
 | ||||||
|     auto& font_menu = view_menu.add_submenu("Font"); |     auto& font_menu = view_menu.add_submenu("Font"); | ||||||
|     GUI::FontDatabase::the().for_each_fixed_width_font([&](const StringView& font_name) { |     GUI::FontDatabase::the().for_each_fixed_width_font([&](const StringView& font_name) { | ||||||
|         font_menu.add_action(GUI::Action::create(font_name, [this](const GUI::Action& action) { |         auto action = GUI::Action::create_checkable(font_name, [&](auto& action) { | ||||||
|             m_editor->set_font(GUI::FontDatabase::the().get_by_name(action.text())); |             m_editor->set_font(GUI::FontDatabase::the().get_by_name(action.text())); | ||||||
|             m_editor->update(); |             m_editor->update(); | ||||||
|         })); |         }); | ||||||
|  |         if (m_editor->font().name() == font_name) | ||||||
|  |             action->set_checked(true); | ||||||
|  |         font_actions.add_action(*action); | ||||||
|  |         font_menu.add_action(*action); | ||||||
|     }); |     }); | ||||||
| 
 | 
 | ||||||
|     syntax_actions.set_exclusive(true); |     syntax_actions.set_exclusive(true); | ||||||
|  |  | ||||||
|  | @ -106,6 +106,8 @@ private: | ||||||
| 
 | 
 | ||||||
|     RefPtr<Web::PageView> m_page_view; |     RefPtr<Web::PageView> m_page_view; | ||||||
| 
 | 
 | ||||||
|  |     GUI::ActionGroup font_actions; | ||||||
|  | 
 | ||||||
|     bool m_document_dirty { false }; |     bool m_document_dirty { false }; | ||||||
|     bool m_document_opening { false }; |     bool m_document_opening { false }; | ||||||
|     bool m_auto_detect_preview_mode { false }; |     bool m_auto_detect_preview_mode { false }; | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 thankyouverycool
						thankyouverycool