@@ -27,6 +27,35 @@ fn write_text(str: &str, color: Color32, job: &mut LayoutJob) {
27
27
job. append ( str, 0.0 , TextFormat { font_id : FONT_ID , color, ..Default :: default ( ) } ) ;
28
28
}
29
29
30
+ fn symbol_context_menu_ui ( ui : & mut Ui , symbol : & ObjSymbol ) {
31
+ ui. scope ( |ui| {
32
+ ui. style_mut ( ) . override_text_style = Some ( egui:: TextStyle :: Monospace ) ;
33
+ ui. style_mut ( ) . wrap = Some ( false ) ;
34
+
35
+ if let Some ( name) = & symbol. demangled_name {
36
+ if ui. button ( format ! ( "Copy \" {}\" " , name) ) . clicked ( ) {
37
+ ui. output ( ) . copied_text = name. clone ( ) ;
38
+ ui. close_menu ( ) ;
39
+ }
40
+ }
41
+ if ui. button ( format ! ( "Copy \" {}\" " , symbol. name) ) . clicked ( ) {
42
+ ui. output ( ) . copied_text = symbol. name . clone ( ) ;
43
+ ui. close_menu ( ) ;
44
+ }
45
+ } ) ;
46
+ }
47
+
48
+ fn symbol_hover_ui ( ui : & mut Ui , symbol : & ObjSymbol ) {
49
+ ui. scope ( |ui| {
50
+ ui. style_mut ( ) . override_text_style = Some ( egui:: TextStyle :: Monospace ) ;
51
+ ui. style_mut ( ) . wrap = Some ( false ) ;
52
+
53
+ ui. colored_label ( Color32 :: WHITE , format ! ( "Name: {}" , symbol. name) ) ;
54
+ ui. colored_label ( Color32 :: WHITE , format ! ( "Address: {:x}" , symbol. address) ) ;
55
+ ui. colored_label ( Color32 :: WHITE , format ! ( "Size: {:x}" , symbol. size) ) ;
56
+ } ) ;
57
+ }
58
+
30
59
fn symbol_ui (
31
60
ui : & mut Ui ,
32
61
symbol : & ObjSymbol ,
@@ -63,7 +92,10 @@ fn symbol_ui(
63
92
write_text ( ") " , Color32 :: GRAY , & mut job) ;
64
93
}
65
94
write_text ( name, Color32 :: WHITE , & mut job) ;
66
- let response = SelectableLabel :: new ( selected, job) . ui ( ui) ;
95
+ let response = SelectableLabel :: new ( selected, job)
96
+ . ui ( ui)
97
+ . context_menu ( |ui| symbol_context_menu_ui ( ui, symbol) )
98
+ . on_hover_ui_at_pointer ( |ui| symbol_hover_ui ( ui, symbol) ) ;
67
99
if response. clicked ( ) {
68
100
* selected_symbol = Some ( symbol. name . clone ( ) ) ;
69
101
* current_view = View :: FunctionDiff ;
@@ -125,10 +157,13 @@ fn symbol_list_ui(
125
157
}
126
158
127
159
fn build_log_ui ( ui : & mut Ui , status : & BuildStatus ) {
128
- ui. scope ( |ui| {
129
- ui. style_mut ( ) . override_text_style = Some ( egui:: TextStyle :: Monospace ) ;
130
- ui. style_mut ( ) . wrap = Some ( false ) ;
131
- ui. colored_label ( Color32 :: from_rgb ( 255 , 0 , 0 ) , & status. log ) ;
160
+ ScrollArea :: both ( ) . auto_shrink ( [ false , false ] ) . show ( ui, |ui| {
161
+ ui. scope ( |ui| {
162
+ ui. style_mut ( ) . override_text_style = Some ( egui:: TextStyle :: Monospace ) ;
163
+ ui. style_mut ( ) . wrap = Some ( false ) ;
164
+
165
+ ui. colored_label ( Color32 :: from_rgb ( 255 , 0 , 0 ) , & status. log ) ;
166
+ } ) ;
132
167
} ) ;
133
168
}
134
169
0 commit comments