mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 06:48:12 +00:00
LibGUI: Use enum for TextEditor modes & add new DisplayOnly mode
Adds a new, more restrictive read-only state to TextEditor which forbids copying, selecting, editor cursors, and context menus. Provides a unique appearance on focus which accomodates ComboBox widgets. All TextEditor modes are now accessed by enum and set_mode() which sets the editor to Editable, ReadOnly or DisplayOnly. Updates applications still using set_readonly().
This commit is contained in:
parent
dc716194c8
commit
b2783a234a
6 changed files with 92 additions and 18 deletions
|
@ -734,11 +734,11 @@ void open_file(const String& filename)
|
|||
auto project_file = g_project->get_file(filename);
|
||||
if (project_file) {
|
||||
current_editor().set_document(const_cast<GUI::TextDocument&>(project_file->document()));
|
||||
current_editor().set_readonly(false);
|
||||
current_editor().set_mode(GUI::TextEditor::Editable);
|
||||
} else {
|
||||
auto external_file = ProjectFile::construct_with_name(filename);
|
||||
current_editor().set_document(const_cast<GUI::TextDocument&>(external_file->document()));
|
||||
current_editor().set_readonly(true);
|
||||
current_editor().set_mode(GUI::TextEditor::ReadOnly);
|
||||
}
|
||||
|
||||
if (filename.ends_with(".cpp") || filename.ends_with(".h"))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue