From 6abdde0334e9300ebe11f970a870a79cd3010835 Mon Sep 17 00:00:00 2001 From: Urho Laukkarinen Date: Thu, 17 Feb 2022 18:08:13 +0200 Subject: [PATCH] Add more source code links to demos (#1260) --- egui_demo_lib/src/apps/demo/code_example.rs | 4 ++++ egui_demo_lib/src/apps/demo/context_menu.rs | 3 +++ egui_demo_lib/src/apps/demo/font_book.rs | 4 ++++ egui_demo_lib/src/apps/demo/paint_bezier.rs | 6 +++--- 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/egui_demo_lib/src/apps/demo/code_example.rs b/egui_demo_lib/src/apps/demo/code_example.rs index 5c62e606a..2047fa19b 100644 --- a/egui_demo_lib/src/apps/demo/code_example.rs +++ b/egui_demo_lib/src/apps/demo/code_example.rs @@ -83,6 +83,10 @@ impl super::View for CodeExample { fn ui(&mut self, ui: &mut egui::Ui) { use crate::syntax_highlighting::code_view_ui; + ui.vertical_centered(|ui| { + ui.add(crate::__egui_github_link_file!()); + }); + code_view_ui( ui, r" diff --git a/egui_demo_lib/src/apps/demo/context_menu.rs b/egui_demo_lib/src/apps/demo/context_menu.rs index bd8123655..4476c1ec0 100644 --- a/egui_demo_lib/src/apps/demo/context_menu.rs +++ b/egui_demo_lib/src/apps/demo/context_menu.rs @@ -105,6 +105,9 @@ impl super::View for ContextMenus { }); }); }); + ui.vertical_centered(|ui| { + ui.add(crate::__egui_github_link_file!()); + }); } } diff --git a/egui_demo_lib/src/apps/demo/font_book.rs b/egui_demo_lib/src/apps/demo/font_book.rs index 3a5a2ef65..b42654670 100644 --- a/egui_demo_lib/src/apps/demo/font_book.rs +++ b/egui_demo_lib/src/apps/demo/font_book.rs @@ -31,6 +31,10 @@ impl super::Demo for FontBook { impl super::View for FontBook { fn ui(&mut self, ui: &mut egui::Ui) { + ui.vertical_centered(|ui| { + ui.add(crate::__egui_github_link_file!()); + }); + ui.label(format!( "The selected font supports {} characters.", self.named_chars diff --git a/egui_demo_lib/src/apps/demo/paint_bezier.rs b/egui_demo_lib/src/apps/demo/paint_bezier.rs index 3d1cc5473..d315b7b2d 100644 --- a/egui_demo_lib/src/apps/demo/paint_bezier.rs +++ b/egui_demo_lib/src/apps/demo/paint_bezier.rs @@ -242,9 +242,9 @@ impl super::Demo for PaintBezier { impl super::View for PaintBezier { fn ui(&mut self, ui: &mut Ui) { - // ui.vertical_centered(|ui| { - // ui.add(crate::__egui_github_link_file!()); - // }); + ui.vertical_centered(|ui| { + ui.add(crate::__egui_github_link_file!()); + }); self.ui_control(ui); Frame::dark_canvas(ui.style()).show(ui, |ui| {