/[eiffelstudio]/branches/Eiffel_57_docking/Src/Eiffel/interface/new_graphical/windows/eb_development_window.e
ViewVC logotype

Contents of /branches/Eiffel_57_docking/Src/Eiffel/interface/new_graphical/windows/eb_development_window.e

Parent Directory Parent Directory | Revision Log Revision Log


Revision 28469 - (show annotations)
Fri Oct 26 16:41:02 2001 UTC (18 years, 3 months ago) by xavier
Original Path: trunk/Src/bench/Eiffel/interface/new_graphical/windows/eb_development_window.e
File size: 84801 byte(s)
Fixed the bug that caused editor formats not to be refreshed after a recompilation.

1 indexing
2 description : "Window holding a project tool"
3 date : "$Date$"
4 revision : "$Revision$"
5 author : "Arnaud PICHERY [ aranud@mail.dotcom.fr ]"
6
7 class
8 EB_DEVELOPMENT_WINDOW
9
10 inherit
11 EB_TOOL_MANAGER
12 redefine
13 make,
14 init_size_and_position,
15 init_commands,
16 build_menu_bar,
17 build_menus,
18 build_file_menu,
19 build_edit_menu,
20 build_view_menu,
21 build_tools_menu,
22 build_favorites_menu,
23 refresh,
24 recycle,
25 destroy_imp,
26 destroy
27 end
28
29 EB_FILEABLE
30 redefine
31 set_stone,
32 reset,
33 stone,
34 on_text_saved,
35 perform_check_before_save,
36 check_passed,
37 update_save_symbol
38 select
39 set_stone
40 end
41
42 EB_FILEABLE
43 rename
44 set_stone as old_set_stone
45 export {NONE}
46 old_set_stone
47 redefine
48 reset,
49 stone,
50 on_text_saved,
51 perform_check_before_save,
52 check_passed,
53 update_save_symbol
54 end
55
56
57 -- Shared tools & contexts
58 SHARED_APPLICATION_EXECUTION
59
60 SHARED_EIFFEL_PROJECT
61
62 PROJECT_CONTEXT
63
64 EB_SHARED_MANAGERS
65
66 EB_SHARED_GRAPHICAL_COMMANDS
67
68 -- Ressources
69 EB_RESOURCE_USER
70
71 EB_PROJECT_TOOL_DATA
72
73 EB_GENERAL_DATA
74
75 EV_STOCK_PIXMAPS
76
77 EB_CONFIRM_SAVE_CALLBACK
78
79 -- Errors
80 EB_GRAPHICAL_ERROR_MANAGER
81
82 TEXT_OBSERVER
83 redefine
84 on_text_reset, on_text_edited,
85 on_text_back_to_its_last_saved_state,
86 on_text_fully_loaded
87 end
88
89 EB_FORMATTER_DATA
90
91 EB_SHARED_EDITOR_DATA
92
93 EV_KEY_CONSTANTS
94 export
95 {NONE} All
96 end
97
98 creation {EB_WINDOW_MANAGER}
99 make,
100 make_as_context_tool,
101 make_as_editor
102
103 feature {NONE} -- Initialization
104
105 make_as_context_tool is
106 -- Create a new development window and expand the context tool.
107 do
108 make
109 if not context_tool.shown then
110 context_tool.show
111 end
112 if not unified_stone then
113 toggle_stone_cmd.execute
114 end
115 context_tool.explorer_bar_item.maximize
116 end
117
118 make_as_editor is
119 -- Create a new development window and expand the editor tool.
120 do
121 make
122 editor_tool.explorer_bar_item.maximize
123 end
124
125 make is
126 -- Create a new development window.
127 do
128 unified_stone := context_unified_stone
129 -- Build the history manager, the address manager, ...
130 create history_manager.make (Current)
131 create address_manager.make (Current, False)
132 build_formatters
133 address_manager.set_formatters (managed_main_formatters)
134
135 -- Register to the preferences manager
136 register
137
138 -- Init commands, build interface, build menus, ...
139 Precursor
140
141 initialized := False -- Reset the flag since initialization is not yet complete.
142 set_up_accelerators
143
144 -- Update widgets visibilities
145 update
146
147 -- Finish initializing the main editor formatters
148 end_build_formatters
149
150 address_manager.disable_formatters
151 if Eiffel_project.manager.is_project_loaded then
152 on_project_created
153 on_project_loaded
154 elseif Eiffel_project.manager.is_created then
155 on_project_unloaded
156 on_project_created
157 else
158 on_project_unloaded
159 end
160
161 initialized := True
162 is_destroying := False
163 end
164
165 init_size_and_position is
166 -- Initialize window size.
167 local
168 default_width, default_height: INTEGER
169 screen: EV_SCREEN
170 do
171 create screen
172 default_width := window_preferences.width.min (screen.width)
173 default_height := window_preferences.height.min (screen.height)
174 window.set_size (default_width, default_height)
175
176 -- Maximize window if needed.
177 if window_preferences.is_maximized then
178 window.maximize
179 end
180 end
181
182 init_commands is
183 -- Initialize commands.
184 local
185 accel: EV_ACCELERATOR
186 do
187 Precursor
188 create toolbarable_commands.make (15)
189
190 -- Open, save, ...
191 toolbarable_commands.extend (new_editor_cmd)
192
193 toolbarable_commands.extend (new_context_tool_cmd)
194
195 create open_cmd.make (Current)
196 toolbarable_commands.extend (open_cmd)
197
198 create save_cmd.make (Current)
199 toolbarable_commands.extend (save_cmd)
200
201 create save_as_cmd.make (Current)
202 if editor_tool = Void or else editor_tool.text_area.is_empty then
203 save_as_cmd.disable_sensitive
204 else
205 save_as_cmd.enable_sensitive
206 end
207
208 create shell_cmd.make (Current)
209 toolbarable_commands.extend (shell_cmd)
210
211 create print_cmd.make (Current)
212 if is_empty then
213 print_cmd.disable_sensitive
214 else
215 print_cmd.enable_sensitive
216 end
217 toolbarable_commands.extend (print_cmd)
218
219 -- Compilation
220 create c_workbench_compilation_cmd.make_workbench (Current)
221 create c_finalized_compilation_cmd.make_finalized (Current)
222 if has_dll_generation then
223 create show_dynamic_lib_tool.make
224 show_dynamic_lib_tool.set_menu_name (Interface_names.m_New_dynamic_lib)
225 show_dynamic_lib_tool.add_agent (~show_dynamic_library_dialog)
226 end
227 if has_profiler then
228 create show_profiler
229 end
230
231 -- Undo/redo, cut, copy, paste.
232 create undo_cmd.make (Current)
233 toolbarable_commands.extend (undo_cmd)
234
235 create redo_cmd.make (Current)
236 toolbarable_commands.extend (redo_cmd)
237
238 create editor_paste_cmd.make (Current)
239 toolbarable_commands.extend (editor_paste_cmd)
240
241 create new_cluster_cmd.make (Current)
242 toolbarable_commands.extend (new_cluster_cmd)
243
244 create new_class_cmd.make (Current)
245 toolbarable_commands.extend (new_class_cmd)
246
247 create delete_class_cluster_cmd.make (Current)
248 toolbarable_commands.extend (delete_class_cluster_cmd)
249
250 create new_feature_cmd.make (Current)
251 toolbarable_commands.extend (new_feature_cmd)
252
253 create toggle_stone_cmd.make (Current)
254 toolbarable_commands.extend (toggle_stone_cmd)
255
256 create send_stone_to_context_cmd.make
257 send_stone_to_context_cmd.set_pixmaps (Pixmaps.Icon_send_stone_down)
258 send_stone_to_context_cmd.set_tooltip (Interface_names.e_Send_stone_to_context)
259 send_stone_to_context_cmd.set_menu_name (Interface_names.m_Send_stone_to_context)
260 send_stone_to_context_cmd.set_name ("Send_to_context")
261 send_stone_to_context_cmd.add_agent (~send_stone_to_context)
262 create accel.make_with_key_combination (
263 create {EV_KEY}.make_with_code (Kcst.Key_down), False, True, False
264 )
265 accel.actions.extend (~send_stone_to_context)
266 send_stone_to_context_cmd.set_accelerator (accel)
267 send_stone_to_context_cmd.disable_sensitive
268 toolbarable_commands.extend (send_stone_to_context_cmd)
269
270 toolbarable_commands.extend (window_manager.minimize_all_cmd)
271 window_manager.minimize_all_cmd.enable_sensitive
272 toolbarable_commands.extend (window_manager.raise_all_cmd)
273 window_manager.raise_all_cmd.enable_sensitive
274
275 toolbarable_commands.extend (New_development_window_cmd)
276 -- Show tool/toolbar commands (will be filled when tools will
277 -- be created)
278 create show_tool_commands.make (7)
279 create show_toolbar_commands.make (3)
280
281 window.focus_in_actions.extend(~on_focus)
282
283 new_feature_cmd.disable_sensitive
284
285 create editors.make (5)
286 end
287
288 set_up_accelerators is
289 -- Fill the accelerator of `window' with the accelerators of the `toolbarable_commands'.
290 do
291 from
292 toolbarable_commands.start
293 until
294 toolbarable_commands.after
295 loop
296 if toolbarable_commands.item.accelerator /= Void then
297 window.accelerators.extend (toolbarable_commands.item.accelerator)
298 end
299 toolbarable_commands.forth
300 end
301
302 from
303 debugger_manager.toolbarable_commands.start
304 until
305 debugger_manager.toolbarable_commands.after
306 loop
307 if
308 debugger_manager.toolbarable_commands.item.accelerator /= Void
309 then
310 window.accelerators.extend (debugger_manager.toolbarable_commands.item.accelerator)
311 end
312 debugger_manager.toolbarable_commands.forth
313 end
314 end
315
316 build_formatters is
317 -- Build all formatters used.
318 local
319 form: EB_CLASS_TEXT_FORMATTER
320 accel: EV_ACCELERATOR
321 do
322 create managed_class_formatters.make (10)
323 managed_class_formatters.extend (create {EB_CLICKABLE_FORMATTER}.make (Current))
324 managed_class_formatters.extend (create {EB_FLAT_FORMATTER}.make (Current))
325 managed_class_formatters.extend (create {EB_SHORT_FORMATTER}.make (Current))
326 managed_class_formatters.extend (create {EB_FLAT_SHORT_FORMATTER}.make (Current))
327 managed_class_formatters.extend (Void)
328 managed_class_formatters.extend (create {EB_ANCESTORS_FORMATTER}.make (Current))
329 managed_class_formatters.extend (create {EB_DESCENDANTS_FORMATTER}.make (Current))
330 managed_class_formatters.extend (create {EB_CLIENTS_FORMATTER}.make (Current))
331 managed_class_formatters.extend (create {EB_SUPPLIERS_FORMATTER}.make (Current))
332 managed_class_formatters.extend (Void)
333 managed_class_formatters.extend (create {EB_ATTRIBUTES_FORMATTER}.make (Current))
334 managed_class_formatters.extend (create {EB_ROUTINES_FORMATTER}.make (Current))
335 managed_class_formatters.extend (create {EB_DEFERREDS_FORMATTER}.make (Current))
336 managed_class_formatters.extend (create {EB_ONCES_FORMATTER}.make (Current))
337 managed_class_formatters.extend (create {EB_EXTERNALS_FORMATTER}.make (Current))
338 managed_class_formatters.extend (create {EB_EXPORTED_FORMATTER}.make (Current))
339
340 create managed_feature_formatters.make (5)
341 managed_feature_formatters.extend (create {EB_BASIC_FEATURE_FORMATTER}.make (Current))
342 managed_feature_formatters.extend (create {EB_ROUTINE_FLAT_FORMATTER}.make (Current))
343 managed_feature_formatters.extend (Void)
344 managed_feature_formatters.extend (create {EB_CALLERS_FORMATTER}.make (Current))
345 managed_feature_formatters.extend (create {EB_IMPLEMENTERS_FORMATTER}.make (Current))
346 managed_feature_formatters.extend (create {EB_ROUTINE_ANCESTORS_FORMATTER}.make (Current))
347 managed_feature_formatters.extend (create {EB_ROUTINE_DESCENDANTS_FORMATTER}.make (Current))
348 managed_feature_formatters.extend (create {EB_HOMONYMS_FORMATTER}.make (Current))
349
350 create managed_main_formatters.make (5)
351 create {EB_BASIC_TEXT_FORMATTER} form.make (Current)
352 create accel.make_with_key_combination (
353 create {EV_KEY}.make_with_code (Kcst.Key_t),
354 True, False, True)
355 accel.actions.extend (form~execute)
356 form.set_accelerator (accel)
357 managed_main_formatters.extend (form)
358
359 create {EB_CLICKABLE_FORMATTER} form.make (Current)
360 create accel.make_with_key_combination (
361 create {EV_KEY}.make_with_code (Kcst.Key_c),
362 True, False, True)
363 accel.actions.extend (form~execute)
364 form.set_accelerator (accel)
365 managed_main_formatters.extend (form)
366
367 create {EB_FLAT_FORMATTER} form.make (Current)
368 create accel.make_with_key_combination (
369 create {EV_KEY}.make_with_code (Kcst.Key_f),
370 True, False, True)
371 accel.actions.extend (form~execute)
372 form.set_accelerator (accel)
373 managed_main_formatters.extend (form)
374
375 create {EB_SHORT_FORMATTER} form.make (Current)
376 create accel.make_with_key_combination (
377 create {EV_KEY}.make_with_code (Kcst.Key_o),
378 True, False, True)
379 accel.actions.extend (form~execute)
380 form.set_accelerator (accel)
381 managed_main_formatters.extend (form)
382
383 create {EB_FLAT_SHORT_FORMATTER} form.make (Current)
384 create accel.make_with_key_combination (
385 create {EV_KEY}.make_with_code (Kcst.Key_i),
386 True, False, True)
387 accel.actions.extend (form~execute)
388 form.set_accelerator (accel)
389 managed_main_formatters.extend (form)
390
391 from
392 managed_class_formatters.start
393 until
394 managed_class_formatters.after
395 loop
396 if managed_class_formatters.item /= Void then
397 managed_class_formatters.item.enable_breakpoints
398 end
399 managed_class_formatters.forth
400 end
401 from
402 managed_main_formatters.start
403 until
404 managed_main_formatters.after
405 loop
406 managed_main_formatters.item.enable_breakpoints
407 managed_main_formatters.forth
408 end
409 end
410
411 end_build_formatters is
412 -- Finish the initialization of formatters (associate them with the editor and select a formatter).
413 local
414 f_ind: INTEGER
415 do
416 from
417 managed_class_formatters.start
418 until
419 managed_class_formatters.after
420 loop
421 if managed_class_formatters.item /= Void then
422 managed_class_formatters.item.set_manager (context_tool)
423 end
424 managed_class_formatters.forth
425 end
426 from
427 managed_feature_formatters.start
428 until
429 managed_feature_formatters.after
430 loop
431 if managed_feature_formatters.item /= Void then
432 managed_feature_formatters.item.set_manager (context_tool)
433 end
434 managed_feature_formatters.forth
435 end
436 from
437 managed_main_formatters.start
438 until
439 managed_main_formatters.after
440 loop
441 managed_main_formatters.item.set_editor (editor_tool.text_area)
442 managed_main_formatters.item.on_shown
443 if managed_main_formatters.item.accelerator /= Void then
444 window.accelerators.extend (managed_main_formatters.item.accelerator)
445 end
446 managed_main_formatters.forth
447 end
448
449 (managed_main_formatters @ 1).enable_select;
450
451 -- We now select the correct class formatter.
452 f_ind := default_class_formatter_index
453 --| This takes the formatter separators in consideration.
454 if f_ind > 4 then
455 f_ind := f_ind + 1
456 end
457 if f_ind > 8 then
458 f_ind := f_ind + 1
459 end
460 if f_ind < 1 or f_ind > managed_class_formatters.count then
461 f_ind := 6
462 end
463 (managed_class_formatters @ f_ind).enable_select;
464
465 -- We now select the correct feature formatter.
466 f_ind := default_feature_formatter_index
467 if f_ind > 2 then
468 f_ind := f_ind + 1
469 end
470 if f_ind < 1 or f_ind > managed_feature_formatters.count then
471 f_ind := 2
472 end
473 (managed_feature_formatters @ f_ind).enable_select
474 end
475
476 build_tools is
477 -- Build all tools that can take place in this window and put them
478 -- in `left_tools' or `bottom_tools'.
479 local
480 show_cmd: EB_SHOW_TOOL_COMMAND
481 do
482 -- Build the features tool
483 create features_tool.make (Current, left_panel)
484 left_tools.extend (features_tool.explorer_bar_item)
485 create show_cmd.make (Current, features_tool.explorer_bar_item)
486 show_tool_commands.extend (show_cmd)
487 toolbarable_commands.extend (show_cmd)
488 add_recyclable (features_tool)
489
490 -- Build the cluster tool
491 create cluster_tool.make (Current, left_panel, Current)
492 left_tools.extend (cluster_tool.explorer_bar_item)
493 create show_cmd.make (Current, cluster_tool.explorer_bar_item)
494 show_tool_commands.extend (show_cmd)
495 toolbarable_commands.extend (show_cmd)
496 add_recyclable (cluster_tool)
497
498 -- Build the favorites tool
499 create favorites_tool.make (Current, left_panel, favorites_manager)
500 left_tools.extend (favorites_tool.explorer_bar_item)
501 create show_cmd.make (Current, favorites_tool.explorer_bar_item)
502 show_tool_commands.extend (show_cmd)
503 toolbarable_commands.extend (show_cmd)
504 add_recyclable (favorites_tool)
505
506 -- Build the windows tool (formerly known as Selector tool)
507 create windows_tool.make (Current, left_panel)
508 left_tools.extend (windows_tool.explorer_bar_item)
509 create show_cmd.make (Current, windows_tool.explorer_bar_item)
510 show_tool_commands.extend (show_cmd)
511 toolbarable_commands.extend (show_cmd)
512 add_recyclable (windows_tool)
513
514 -- Build the search tool
515 create search_tool.make (Current, left_panel)
516 left_tools.extend (search_tool.explorer_bar_item)
517 create show_cmd.make (Current, search_tool.explorer_bar_item)
518 show_tool_commands.extend (show_cmd)
519 toolbarable_commands.extend (show_cmd)
520 add_recyclable (search_tool)
521
522 -- Build the editor tool
523 create editor_tool.make (Current, right_panel)
524 bottom_tools.extend (editor_tool.explorer_bar_item)
525 editor_tool.text_area.add_edition_observer(save_cmd)
526 editor_tool.text_area.add_edition_observer(save_as_cmd)
527 editor_tool.text_area.add_edition_observer(print_cmd)
528 editor_tool.text_area.add_edition_observer(Current)
529 editor_tool.text_area.drop_actions.set_veto_pebble_function (~can_drop)
530 add_recyclable (editor_tool)
531
532 -- Build the context tool
533 create context_tool.make (Current, right_panel)
534 bottom_tools.extend (context_tool.explorer_bar_item)
535 create show_cmd.make (Current, context_tool.explorer_bar_item)
536 show_tool_commands.extend (show_cmd)
537 toolbarable_commands.extend (show_cmd)
538 add_recyclable (context_tool)
539
540 -- Set the flag "Tools initialized"
541 tools_initialized := True
542
543 -- Initialize undo / redo accelerators
544 create undo_accelerator.make_with_key_combination (create {EV_KEY}.make_with_code (Key_z), True, False, False)
545 if has_case then
546 undo_accelerator.actions.extend (agent (context_tool.editor.undo_cmd).on_ctrl_z)
547 end
548 undo_accelerator.actions.extend (agent undo_cmd.accelerator_execute)
549 create redo_accelerator.make_with_key_combination (create {EV_KEY}.make_with_code (Key_y), True, False, False)
550 if has_case then
551 redo_accelerator.actions.extend (agent (context_tool.editor.redo_cmd).on_ctrl_y)
552 end
553 redo_accelerator.actions.extend (agent redo_cmd.accelerator_execute)
554 window.accelerators.extend (undo_accelerator)
555 window.accelerators.extend (redo_accelerator)
556 end
557
558 feature -- Access
559
560 cluster: CLUSTER_I is
561 -- Cluster for current class. Void if none.
562 local
563 classi_stone: CLASSI_STONE
564 cluster_stone: CLUSTER_STONE
565 do
566 classi_stone ?= stone
567 if classi_stone /= Void then
568 Result := classi_stone.cluster
569 end
570 cluster_stone ?= stone
571 if cluster_stone /= Void then
572 Result := cluster_stone.cluster_i
573 end
574 end
575
576 class_name: STRING is
577 -- Name of the current class, Void if none.
578 local
579 class_stone: CLASSI_STONE
580 do
581 class_stone ?= stone
582 if class_stone /= Void then
583 Result := class_stone.class_name
584 end
585 end
586
587 feature_name: STRING is
588 -- Name of the current feature, Void if none.
589 local
590 feature_stone: FEATURE_STONE
591 do
592 feature_stone ?= stone
593 if feature_stone /= Void then
594 Result := feature_stone.feature_name
595 end
596 end
597
598 feature -- Window Settings
599
600 set_initialized is
601 -- Set `initialized' to True.
602 do
603 initialized := True
604 end
605
606 set_text (a_text: STRING) is
607 -- Assign `a_text' to `text'.
608 require
609 a_text_not_void: a_text /= Void
610 do
611 editor_tool.text_area.set_text (a_text)
612 ensure
613 --| FIXME This needs to work: text_assigned: text.is_equal (a_text)
614 --| FIXME changed_flag_set: changed
615 end
616
617 feature -- Window Properties
618
619 changed: BOOLEAN is
620 -- Has something been changed and not yet been saved?
621 do
622 Result := editor_tool.changed
623 end
624
625 is_empty: BOOLEAN is
626 -- Does `Current's text is empty?
627 do
628 Result := editor_tool = Void or else editor_tool.text_area.is_empty
629 end
630
631 text: STRING is
632 -- Text representing Current
633 do
634 Result := editor_tool.text_area.text
635 end
636
637 pixmap: EV_PIXMAP is
638 -- Pixmap representing Current window.
639 do
640 Result := Pixmaps.Icon_development_window
641 end
642
643 preference_tool_is_hidden: BOOLEAN
644 -- Is the preference tool hidden?
645
646 profile_tool_is_hidden: BOOLEAN
647 -- Is the profile tool hidden?
648
649 feature -- Pulldown Menus
650
651 metric_menu: EV_MENU
652 -- Menu for entries of metric tool.
653
654 format_menu: EV_MENU
655 -- ID Menu for formats.
656 -- Only used during debugging
657
658 compile_menu: EV_MENU
659 -- Compile ID menu.
660
661 debug_menu: EV_MENU
662 -- Debug ID menu.
663
664 active_menus (erase: BOOLEAN) is
665 -- Enable all the menus and if `erase' clean
666 -- the content of the Project tool.
667 do
668 compile_menu.enable_sensitive
669 if erase then
670 output_manager.clear
671 end
672 end
673
674 disable_menus is
675 -- Disable all the menus.
676 do
677 compile_menu.disable_sensitive
678 end
679
680 feature -- Modifiable menus
681
682 melt_menu_item: EV_MENU_ITEM
683 -- Melt menu entry
684
685 freeze_menu_item: EV_MENU_ITEM
686 -- Freeze menu entry
687
688 finalize_menu_item: EV_MENU_ITEM
689 -- Finalize menu entry
690
691 feature -- Update
692
693 synchronize is
694 -- Synchronize stones.
695 local
696 st: STONE
697 do
698 during_synchronization := True
699 favorites_manager.refresh
700 context_tool.synchronize
701 cluster_tool.synchronize
702 history_manager.synchronize
703 features_tool.synchronize
704 if stone /= Void then
705 st := stone.synchronized_stone
706 end
707 editor_tool.text_area.update_click_list (False)
708 set_stone (st)
709 update_save_symbol
710 address_manager.refresh
711 during_synchronization := False
712 end
713
714 synchronize_routine_tool_to_default is
715 -- Synchronize the editor tool to the debug format.
716 do
717 --| FIXME ARNAUD: To be implemented
718 end
719
720 clear_object_tool is
721 -- Clear the contents of the object tool if shown.
722 do
723 --| FIXME ARNAUD: To be implemented
724 end
725
726 build_menus is
727 -- Build all menus displayed in the development window.
728 do
729 -- Build each menu
730 build_file_menu
731 build_edit_menu
732 build_view_menu
733 build_favorites_menu
734 build_project_menu
735 build_debug_menu
736 build_tools_menu
737 build_window_menu
738 build_help_menu
739 -- Build the menu bar.
740 build_menu_bar
741 end
742
743 build_debug_menu is
744 -- Build the `Debug' menu through the debugger_manager.
745 local
746 conv_mit: EB_COMMAND_MENU_ITEM
747 do
748 debug_menu := debugger_manager.new_debug_menu
749 from
750 debug_menu.start
751 until
752 debug_menu.after
753 loop
754 conv_mit ?= debug_menu.item
755 if conv_mit /= Void then
756 add_recyclable (conv_mit)
757 end
758 debug_menu.forth
759 end
760 end
761
762 build_menu_bar is
763 -- Build the menu bar
764 local
765 mb: EV_MENU_BAR
766 do
767 check
768 window.menu_bar /= Void implies not window.menu_bar.is_empty
769 -- If a menu bar was already present, it shouldn't be empty.
770 end
771 if window.menu_bar /= Void then
772 mb := window.menu_bar
773 from
774 mb.start
775 mb.forth
776 until
777 mb.after
778 loop
779 mb.remove
780 end
781 else
782 create mb
783 window.set_menu_bar (mb)
784 mb.extend (file_menu)
785 end
786
787 if Eiffel_project.manager.is_created then
788 mb.extend (edit_menu)
789 mb.extend (view_menu)
790 mb.extend (favorites_menu)
791 mb.extend (project_menu)
792 mb.extend (debug_menu)
793 else
794 mb.extend (view_menu)
795 end
796 mb.extend (tools_menu)
797 mb.extend (window_menu)
798 mb.extend (help_menu)
799 end
800
801 feature -- Graphical Interface
802
803 build_general_toolbar is
804 -- Set up the general toolbar (New, Save, Search, Shell, Undo, Redo, ...)
805 local
806 cell: EV_CELL
807 hsep: EV_HORIZONTAL_SEPARATOR
808 hbox: EV_HORIZONTAL_BOX
809 do
810 -- Create the toolbar.
811 create general_toolbar
812 general_customizable_toolbar := window_preferences.retrieve_general_toolbar (toolbarable_commands)
813 if window_preferences.show_text_in_general_toolbar then
814 general_customizable_toolbar.enable_text_displayed
815 end
816 create hbox
817 hbox.extend (general_customizable_toolbar.widget)
818 hbox.disable_item_expand (general_customizable_toolbar.widget)
819
820 -- Generate the toolbar.
821 general_customizable_toolbar.update_toolbar
822
823 -- Cell to fill in empty space and receive the right click menu holder.
824 create cell
825 cell.pointer_button_release_actions.extend (~toolbar_right_click_action)
826 hbox.extend (cell)
827
828 -- Create the vertical layout (separator + toolbar)
829 create hsep
830 general_toolbar.set_padding (2)
831 general_toolbar.extend (hsep)
832 general_toolbar.disable_item_expand (hsep)
833 general_toolbar.extend (hbox)
834 general_toolbar.pointer_button_release_actions.extend (~toolbar_right_click_action)
835
836 -- Create the command to show/hide this toolbar.
837 create show_general_toolbar_command.make (general_toolbar, Interface_names.m_General_toolbar)
838 show_toolbar_commands.extend (show_general_toolbar_command)
839 if window_preferences.show_general_toolbar then
840 show_general_toolbar_command.enable_visible
841 else
842 show_general_toolbar_command.disable_visible
843 end
844
845 end
846
847 build_address_toolbar is
848 -- Set up the address toolbar (Back, Forward, Current, Class name, feature name, ...)
849 local
850 tb: EV_TOOL_BAR
851 -- address_bar: EV_HORIZONTAL_BOX -- Contains "Class" + Combobox + "Feature" + Combobox + "Format" + Combobox
852 hsep: EV_HORIZONTAL_SEPARATOR
853 hbox: EV_HORIZONTAL_BOX -- Contains HistoryToolbar (back, forth, current) + `address_bar'
854 cell: EV_CELL
855 accel: EV_ACCELERATOR
856 do
857 -- Create the toolbar
858 create address_toolbar
859 create hsep
860 create hbox
861 -- create address_bar
862 create tb
863 address_toolbar.set_padding (2)
864 address_toolbar.extend (hsep)
865 address_toolbar.disable_item_expand (hsep)
866 address_toolbar.extend (hbox)
867
868 hbox.extend (tb)
869 hbox.disable_item_expand (tb)
870 -- hbox.extend (address_bar)
871 -- hbox.disable_item_expand (address_bar)
872
873 -- Back icon
874 tb.extend (history_manager.back_command.new_toolbar_item (False, False))
875
876 -- Forward icon
877 tb.extend (history_manager.forth_command.new_toolbar_item (False, False))
878
879 -- Set up the accelerators.
880 create accel.make_with_key_combination (
881 create {EV_KEY}.make_with_code (Kcst.Key_right), False, True, False
882 )
883 accel.actions.extend (~on_forth)
884 window.accelerators.extend (accel)
885
886 create accel.make_with_key_combination (
887 create {EV_KEY}.make_with_code (Kcst.Key_left), False, True, False
888 )
889 accel.actions.extend (~on_back)
890 window.accelerators.extend (accel)
891
892 ------------------------------------------
893 -- Address bar (Class name & feature name)
894 ------------------------------------------
895 hbox.extend (address_manager.widget)
896
897 -- Create the command to show/hide this toolbar.
898 create show_address_toolbar_command.make (address_toolbar, Interface_names.m_Address_toolbar)
899 show_toolbar_commands.extend (show_address_toolbar_command)
900
901 if window_preferences.show_address_toolbar then
902 show_address_toolbar_command.enable_visible
903 else
904 show_address_toolbar_command.disable_visible
905 end
906
907 -- Cell to fill in empty space and receive the right click menu holder.
908 create cell
909 cell.pointer_button_release_actions.extend (~toolbar_right_click_action)
910 hbox.extend (cell)
911 end
912
913 build_project_toolbar is
914 -- Build toolbar corresponding to the project options bar
915 local
916 cell: EV_CELL
917 hsep: EV_HORIZONTAL_SEPARATOR
918 hbox: EV_HORIZONTAL_BOX
919 do
920 create project_toolbar
921 create hsep
922 project_toolbar.extend (hsep)
923 project_toolbar.disable_item_expand (hsep)
924
925 -- Generate the toolbar.
926 create hbox
927 project_customizable_toolbar := debugger_manager.new_toolbar
928 hbox.extend (project_customizable_toolbar.widget)
929 hbox.disable_item_expand (project_customizable_toolbar.widget)
930
931 project_customizable_toolbar.update_toolbar
932
933 -- Create the command to show/hide this toolbar.
934 create show_project_toolbar_command.make (project_toolbar, Interface_names.m_Project_toolbar)
935 show_toolbar_commands.extend (show_project_toolbar_command)
936 if window_preferences.show_project_toolbar then
937 show_project_toolbar_command.enable_visible
938 else
939 show_project_toolbar_command.disable_visible
940 end
941
942 -- Cell to fill in empty space and receive the right click menu holder.
943 create cell
944 cell.pointer_button_release_actions.extend (~toolbar_right_click_action)
945 hbox.extend (cell)
946 project_toolbar.extend (hbox)
947 end
948
949 feature -- Menu Building
950
951 build_file_menu is
952 -- Build the file menu.
953 local
954 new_project_cmd: EB_NEW_PROJECT_COMMAND
955 open_project_cmd: EB_OPEN_PROJECT_COMMAND
956 send_to_menu: EV_MENU
957 menu_item: EV_MENU_ITEM
958 command_menu_item: EB_COMMAND_MENU_ITEM
959 do
960 create file_menu.make_with_text (Interface_names.m_File)
961
962 -- New
963 command_menu_item := New_development_window_cmd.new_menu_item
964 add_recyclable (command_menu_item)
965 file_menu.extend (command_menu_item)
966
967 -- New editor
968 command_menu_item := New_editor_cmd.new_menu_item
969 add_recyclable (command_menu_item)
970 file_menu.extend (command_menu_item)
971
972 -- New context tool
973 command_menu_item := New_context_tool_cmd.new_menu_item
974 add_recyclable (command_menu_item)
975 file_menu.extend (command_menu_item)
976
977 -- Open
978 command_menu_item := open_cmd.new_menu_item
979 add_recyclable (command_menu_item)
980 file_menu.extend (command_menu_item)
981
982 -- Close
983 create menu_item.make_with_text (Interface_names.m_Close)
984 menu_item.select_actions.extend (~destroy)
985 file_menu.extend (menu_item)
986
987 -- Separator --------------------------------------
988 file_menu.extend (create {EV_MENU_SEPARATOR})
989
990 -- Save
991 command_menu_item := save_cmd.new_menu_item
992 add_recyclable (command_menu_item)
993 file_menu.extend (command_menu_item)
994
995 -- Save as
996 command_menu_item := save_as_cmd.new_menu_item
997 add_recyclable (command_menu_item)
998 file_menu.extend (command_menu_item)
999
1000 -- Sent to
1001 create send_to_menu.make_with_text (Interface_names.m_Send_to)
1002 -- External editor
1003 command_menu_item := shell_cmd.new_menu_item
1004 add_recyclable (command_menu_item)
1005 send_to_menu.extend (command_menu_item)
1006 file_menu.extend (send_to_menu)
1007
1008 -- Separator --------------------------------------
1009 file_menu.extend (create {EV_MENU_SEPARATOR})
1010 command_menu_item := print_cmd.new_menu_item
1011 add_recyclable (command_menu_item)
1012 file_menu.extend (command_menu_item)
1013
1014 -- Separator --------------------------------------
1015 file_menu.extend (create {EV_MENU_SEPARATOR})
1016
1017 -- New Project
1018 create new_project_cmd.make_with_parent (window)
1019 create menu_item.make_with_text (Interface_names.m_New_project)
1020 menu_item.select_actions.extend (new_project_cmd~execute)
1021 file_menu.extend (menu_item)
1022
1023 -- Open Project
1024 create open_project_cmd.make_with_parent (window)
1025 create menu_item.make_with_text (Interface_names.m_Open_project)
1026 menu_item.select_actions.extend (agent open_project_cmd.execute)
1027 file_menu.extend (menu_item)
1028
1029 -- Recent Projects
1030 recent_projects_menu := recent_projects_manager.new_menu
1031 add_recyclable (recent_projects_menu)
1032 file_menu.extend (recent_projects_menu)
1033
1034 -- Separator --------------------------------------
1035 file_menu.extend (create {EV_MENU_SEPARATOR})
1036
1037 -- Exit
1038 command_menu_item := Exit_application_cmd.new_menu_item
1039 add_recyclable (Command_menu_item)
1040 file_menu.extend (command_menu_item)
1041 end
1042
1043 build_class_info_menu: EV_MENU is
1044 -- Build the class format sub-menu.
1045 local
1046 form: EB_CLASS_INFO_FORMATTER
1047 empty_menu: EV_MENU_ITEM
1048 i: INTEGER
1049 do
1050 create Result.make_with_text (Interface_names.m_Class_info)
1051 i := 1
1052
1053 create empty_menu.make_with_text (Interface_names.m_Formatter_separators @ i)
1054 i := i + 1
1055 empty_menu.disable_sensitive
1056 Result.extend (empty_menu)
1057 from
1058 managed_class_formatters.start
1059 until
1060 managed_class_formatters.after
1061 loop
1062 form := managed_class_formatters.item
1063 if form /= Void then
1064 Result.extend (form.new_menu_item)
1065 else
1066 create empty_menu.make_with_text (Interface_names.m_Formatter_separators @ i)
1067 i := i + 1
1068 empty_menu.disable_sensitive
1069 Result.extend (empty_menu)
1070 end
1071 managed_class_formatters.forth
1072 end
1073 end
1074
1075 build_feature_info_menu: EV_MENU is
1076 -- Build the feature format sub-menu.
1077 local
1078 form: EB_FEATURE_INFO_FORMATTER
1079 do
1080 create Result.make_with_text (Interface_names.m_Feature_info)
1081 from
1082 managed_feature_formatters.start
1083 until
1084 managed_feature_formatters.after
1085 loop
1086 form := managed_feature_formatters.item
1087 if form /= Void then
1088 Result.extend (form.new_menu_item)
1089 end
1090 managed_feature_formatters.forth
1091 end
1092 end
1093
1094 build_edit_menu is
1095 -- Create and build `edit_menu'
1096 local
1097 command_menu_item: EB_COMMAND_MENU_ITEM
1098 sub_menu: EV_MENU
1099 cmd: EB_EDITOR_COMMAND
1100 os_cmd: EB_ON_SELECTION_COMMAND
1101 editor: EB_SMART_EDITOR
1102 do
1103 editor := editor_tool.text_area
1104 create command_controller.make
1105
1106 create edit_menu.make_with_text (Interface_names.m_Edit)
1107
1108 -- Undo
1109 command_menu_item := undo_cmd.new_menu_item
1110 add_recyclable (command_menu_item)
1111 edit_menu.extend (command_menu_item)
1112
1113 -- Redo
1114 command_menu_item := redo_cmd.new_menu_item
1115 add_recyclable (command_menu_item)
1116 edit_menu.extend (command_menu_item)
1117
1118 -- Separator --------------------------------------
1119 edit_menu.extend (create {EV_MENU_SEPARATOR})
1120
1121 -- Cut
1122 create os_cmd.make (Current)
1123 os_cmd.set_menu_name (Interface_names.M_cut)
1124 os_cmd.set_pixmaps (pixmaps.icon_cut)
1125 os_cmd.set_name ("Editor_cut")
1126 os_cmd.set_tooltip (interface_names.f_cut)
1127 os_cmd.add_agent (~cut_selection)
1128 toolbarable_commands.extend (os_cmd)
1129 os_cmd.set_needs_editable (True)
1130 command_controller.add_selection_command (os_cmd)
1131 command_menu_item := os_cmd.new_menu_item
1132 add_recyclable (command_menu_item)
1133 edit_menu.extend (command_menu_item)
1134
1135 -- Copy
1136 create os_cmd.make (Current)
1137 os_cmd.set_menu_name (Interface_names.M_copy)
1138 os_cmd.set_pixmaps (pixmaps.icon_copy)
1139 os_cmd.set_name ("Editor_copy")
1140 os_cmd.set_tooltip (interface_names.f_copy)
1141 os_cmd.add_agent (~copy_selection)
1142 toolbarable_commands.extend (os_cmd)
1143 os_cmd.set_needs_editable (False)
1144 command_controller.add_selection_command (os_cmd)
1145 command_menu_item := os_cmd.new_menu_item
1146 add_recyclable (command_menu_item)
1147 edit_menu.extend (command_menu_item)
1148
1149 -- Paste
1150 command_menu_item := editor_paste_cmd.new_menu_item
1151 add_recyclable (command_menu_item)
1152 edit_menu.extend (command_menu_item)
1153
1154 -- Separator --------------------------------------
1155 edit_menu.extend (create {EV_MENU_SEPARATOR})
1156
1157 -- Select all
1158 create cmd.make
1159 cmd.set_menu_name (Interface_names.m_select_all)
1160 cmd.add_agent (~select_all)
1161 command_menu_item := cmd.new_menu_item
1162 command_controller.add_edition_command (cmd)
1163 add_recyclable (command_menu_item)
1164 edit_menu.extend (command_menu_item)
1165
1166 -- Separator --------------------------------------
1167 edit_menu.extend (create {EV_MENU_SEPARATOR})
1168
1169 -- Search
1170 create cmd.make
1171 cmd.set_menu_name (Interface_names.m_Search + "%T" + Editor_preferences.shorcut_name_for_action (3))
1172 cmd.add_agent (editor~search)
1173 command_menu_item := cmd.new_menu_item
1174 command_controller.add_edition_command (cmd)
1175 add_recyclable (command_menu_item)
1176 edit_menu.extend (command_menu_item)
1177
1178 -- Replace
1179 create cmd.make
1180 cmd.set_menu_name (Interface_names.m_Replace + "%T" + Editor_preferences.shorcut_name_for_action (4))
1181 cmd.add_agent (editor~replace)
1182 cmd.set_needs_editable (True)
1183 command_menu_item := cmd.new_menu_item
1184 command_controller.add_edition_command (cmd)
1185 add_recyclable (command_menu_item)
1186 edit_menu.extend (command_menu_item)
1187
1188 -- Find sub menu
1189
1190 create sub_menu.make_with_text (Interface_names.m_Find)
1191
1192 -- Find next
1193 create cmd.make
1194 cmd.set_menu_name (Interface_names.m_Find_next + "%T" + Editor_preferences.shorcut_name_for_action (6))
1195 cmd.add_agent (~find_next)
1196 command_menu_item := cmd.new_menu_item
1197 command_controller.add_edition_command (cmd)
1198 add_recyclable (command_menu_item)
1199 sub_menu.extend (command_menu_item)
1200
1201 -- Find previous
1202 create cmd.make
1203 cmd.set_menu_name (Interface_names.m_Find_previous + "%T" + Editor_preferences.shorcut_name_for_action (7))
1204 cmd.add_agent (~find_previous)
1205 command_menu_item := cmd.new_menu_item
1206 command_controller.add_edition_command (cmd)
1207 add_recyclable (command_menu_item)
1208 sub_menu.extend (command_menu_item)
1209
1210 -- Find selection
1211 create os_cmd.make (Current)
1212 os_cmd.set_menu_name (Interface_names.m_Find_selection + "%T" + Editor_preferences.shorcut_name_for_action (5))
1213 os_cmd.add_agent (~find_selection)
1214 command_menu_item := os_cmd.new_menu_item
1215 command_controller.add_selection_command (os_cmd)
1216 add_recyclable (command_menu_item)
1217 sub_menu.extend (command_menu_item)
1218
1219 edit_menu.extend (sub_menu)
1220
1221
1222 -- Separator --------------------------------------
1223 edit_menu.extend (create {EV_MENU_SEPARATOR})
1224
1225 create sub_menu.make_with_text (Interface_names.m_Advanced)
1226
1227 create os_cmd.make (Current)
1228 os_cmd.set_needs_editable (True)
1229 command_controller.add_selection_command (os_cmd)
1230 os_cmd.set_menu_name (Interface_names.m_Indent)
1231 os_cmd.add_agent (editor~indent_selection)
1232 command_menu_item := os_cmd.new_menu_item
1233 add_recyclable (command_menu_item)
1234 sub_menu.extend (command_menu_item)
1235
1236 create os_cmd.make (Current)
1237 os_cmd.set_needs_editable (True)
1238 command_controller.add_selection_command (os_cmd)
1239 os_cmd.set_menu_name (Interface_names.m_Unindent)
1240 os_cmd.add_agent (editor~unindent_selection)
1241 command_menu_item := os_cmd.new_menu_item
1242 add_recyclable (command_menu_item)
1243 sub_menu.extend (command_menu_item)
1244
1245 create os_cmd.make (Current)
1246 os_cmd.set_needs_editable (True)
1247 command_controller.add_selection_command (os_cmd)
1248 os_cmd.set_menu_name (Interface_names.m_To_lower)
1249 os_cmd.add_agent (editor~set_selection_case (True))
1250 command_menu_item := os_cmd.new_menu_item
1251 add_recyclable (command_menu_item)
1252 sub_menu.extend (command_menu_item)
1253
1254 create os_cmd.make (Current)
1255 os_cmd.set_needs_editable (True)
1256 command_controller.add_selection_command (os_cmd)
1257 os_cmd.set_menu_name (Interface_names.m_To_upper)
1258 os_cmd.add_agent (editor~set_selection_case (False))
1259 command_menu_item := os_cmd.new_menu_item
1260 add_recyclable (command_menu_item)
1261 sub_menu.extend (command_menu_item)
1262
1263 create cmd.make
1264 cmd.set_needs_editable (True)
1265 cmd.set_menu_name (Interface_names.m_Comment)
1266 cmd.add_agent (editor~comment_selection)
1267 command_menu_item := cmd.new_menu_item
1268 command_controller.add_edition_command (cmd)
1269 add_recyclable (command_menu_item)
1270 sub_menu.extend (command_menu_item)
1271
1272 create cmd.make
1273 cmd.set_needs_editable (True)
1274 cmd.set_menu_name (Interface_names.m_Uncomment)
1275 cmd.add_agent (editor~uncomment_selection)
1276 command_menu_item := cmd.new_menu_item
1277 command_controller.add_edition_command (cmd)
1278 add_recyclable (command_menu_item)
1279 sub_menu.extend (command_menu_item)
1280
1281 -- Separator --------------------------------------
1282 sub_menu.extend (create {EV_MENU_SEPARATOR})
1283
1284 -- Insert if block
1285 create cmd.make
1286 cmd.set_needs_editable (True)
1287 cmd.set_menu_name (Interface_names.m_If_block)
1288 cmd.add_agent (editor~embed_in_block("if then", 3))
1289 command_menu_item := cmd.new_menu_item
1290 command_controller.add_edition_command (cmd)
1291 add_recyclable (command_menu_item)
1292 sub_menu.extend (command_menu_item)
1293
1294 -- Insert debug block
1295 create cmd.make
1296 cmd.set_needs_editable (True)
1297 cmd.set_menu_name (Interface_names.m_debug_block)
1298 cmd.add_agent (editor~embed_in_block("debug", 5))
1299 command_menu_item := cmd.new_menu_item
1300 command_controller.add_edition_command (cmd)
1301 add_recyclable (command_menu_item)
1302 sub_menu.extend (command_menu_item)
1303
1304
1305 -- Separator --------------------------------------
1306 sub_menu.extend (create {EV_MENU_SEPARATOR})
1307
1308 -- Complete word
1309 create cmd.make
1310 cmd.set_needs_editable (True)
1311 cmd.set_menu_name (Interface_names.m_Complete_word + "%T" + Editor_preferences.shorcut_name_for_action (1))
1312 command_menu_item := cmd.new_menu_item
1313 command_controller.add_edition_command (cmd)
1314 cmd.add_agent (editor~complete_feature_name)
1315
1316 add_recyclable (command_menu_item)
1317 sub_menu.extend (command_menu_item)
1318
1319 -- Complete class name
1320 create cmd.make
1321 cmd.set_needs_editable (True)
1322 cmd.set_menu_name (Interface_names.m_Complete_class_name + "%T" + Editor_preferences.shorcut_name_for_action (2))
1323 command_menu_item := cmd.new_menu_item
1324 command_controller.add_edition_command (cmd)
1325 cmd.add_agent (editor~complete_class_name)
1326
1327 add_recyclable (command_menu_item)
1328 sub_menu.extend (command_menu_item)
1329
1330 sub_menu.extend (create {EV_MENU_SEPARATOR})
1331
1332 -- show/hide formatting marks.
1333 create cmd.make
1334 if editor_tool.text_area.view_invisible_symbols then
1335 cmd.set_menu_name (Interface_names.m_Hide_formatting_marks)
1336 else
1337 cmd.set_menu_name (Interface_names.m_Show_formatting_marks)
1338 end
1339 formatting_marks_command_menu_item := cmd.new_menu_item
1340 command_controller.add_edition_command (cmd)
1341 cmd.add_agent (~toggle_formatting_marks)
1342
1343 add_recyclable (formatting_marks_command_menu_item)
1344 sub_menu.extend (formatting_marks_command_menu_item)
1345
1346 edit_menu.extend (sub_menu)
1347 end
1348
1349 build_view_menu is
1350 -- Build the view menu.
1351 local
1352 form: EB_CLASS_INFO_FORMATTER
1353 new_menu_item: EB_COMMAND_MENU_ITEM
1354 new_basic_item: EV_MENU_ITEM
1355 do
1356 Precursor
1357
1358 new_menu_item := toggle_stone_cmd.new_menu_item
1359 view_menu.extend (new_menu_item)
1360 add_recyclable (new_menu_item)
1361
1362 new_menu_item := send_stone_to_context_cmd.new_menu_item
1363 view_menu.extend (new_menu_item)
1364 add_recyclable (new_menu_item)
1365 -- Go to menu
1366 new_basic_item := history_manager.new_menu
1367 view_menu.extend (new_basic_item)
1368
1369 -- Separator --------------------------------------
1370 view_menu.extend (create {EV_MENU_SEPARATOR})
1371 view_menu.extend (build_class_info_menu)
1372 view_menu.extend (build_feature_info_menu)
1373
1374 -- Separator --------------------------------------
1375 view_menu.extend (create {EV_MENU_SEPARATOR})
1376
1377 from
1378 managed_main_formatters.start
1379 until
1380 managed_main_formatters.after
1381 loop
1382 form := managed_main_formatters.item
1383 new_basic_item := form.new_menu_item
1384 new_basic_item.select_actions.put_front (form~invalidate)
1385 view_menu.extend (new_basic_item)
1386 --add_recyclable (new_basic_item)
1387 managed_main_formatters.forth
1388 end
1389 end
1390
1391 build_favorites_menu is
1392 -- Build the favorites menu
1393 do
1394 Precursor {EB_TOOL_MANAGER}
1395
1396 create show_favorites_menu_item
1397 update_show_favorites_menu_item
1398 show_favorites_menu_item.select_actions.extend (~execute_show_favorites)
1399
1400 favorites_menu.start
1401 favorites_menu.put_right (show_favorites_menu_item)
1402 favorites_menu.select_actions.extend (~update_show_favorites_menu_item)
1403 end
1404
1405 build_project_menu is
1406 -- Build the project menu.
1407 local
1408 command_menu_item: EB_COMMAND_MENU_ITEM
1409 do
1410 create project_menu.make_with_text (Interface_names.m_Project)
1411
1412 -- Melt
1413 command_menu_item := Melt_project_cmd.new_menu_item
1414 add_recyclable (command_menu_item)
1415 project_menu.extend (command_menu_item)
1416
1417 -- Freeze
1418 command_menu_item := Freeze_project_cmd.new_menu_item
1419 add_recyclable (command_menu_item)
1420 project_menu.extend (command_menu_item)
1421
1422 -- Finalize
1423 command_menu_item := Finalize_project_cmd.new_menu_item
1424 add_recyclable (command_menu_item)
1425 project_menu.extend (command_menu_item)
1426
1427 -- Precompile
1428 command_menu_item := precompilation_cmd.new_menu_item
1429 add_recyclable (command_menu_item)
1430 project_menu.extend (command_menu_item)
1431
1432 -- Separator -------------------------------------------------
1433 project_menu.extend (create {EV_MENU_SEPARATOR})
1434
1435 -- Compile Workbench C code
1436 command_menu_item := c_workbench_compilation_cmd.new_menu_item
1437 add_recyclable (command_menu_item)
1438 project_menu.extend (command_menu_item)
1439
1440 -- Compile Finalized C code
1441 command_menu_item := c_finalized_compilation_cmd.new_menu_item
1442 add_recyclable (command_menu_item)
1443 project_menu.extend (command_menu_item)
1444
1445 -- Execute Finalized code
1446 command_menu_item := run_finalized_cmd.new_menu_item
1447 add_recyclable (command_menu_item)
1448 project_menu.extend (command_menu_item)
1449
1450 -- Separator -------------------------------------------------
1451 project_menu.extend (create {EV_MENU_SEPARATOR})
1452
1453 -- System Tool window
1454 command_menu_item := system_cmd.new_menu_item
1455 add_recyclable (command_menu_item)
1456 project_menu.extend (command_menu_item)
1457
1458 -- System information
1459 command_menu_item := system_info_cmd.new_menu_item
1460 add_recyclable (command_menu_item)
1461 project_menu.extend (command_menu_item)
1462
1463 -- Error information
1464 command_menu_item := display_error_help_cmd.new_menu_item
1465 add_recyclable (command_menu_item)
1466 project_menu.extend (command_menu_item)
1467
1468 if has_documentation_generation or has_xmi_generation then
1469 -- Separator -------------------------------------------------
1470 project_menu.extend (create {EV_MENU_SEPARATOR})
1471 end
1472
1473 if has_documentation_generation then
1474 -- Generate Documentation
1475 command_menu_item := document_cmd.new_menu_item
1476 add_recyclable (command_menu_item)
1477 project_menu.extend (command_menu_item)
1478 end
1479
1480 if has_xmi_generation then
1481 -- Export XMI
1482 command_menu_item := export_cmd.new_menu_item
1483 add_recyclable (command_menu_item)
1484 project_menu.extend (command_menu_item)
1485 end
1486 end
1487
1488 build_tools_menu is
1489 -- Create and build `tools_menu'
1490 local
1491 command_menu_item: EB_COMMAND_MENU_ITEM
1492 menu_item: EV_MENU_ITEM
1493 do
1494 create tools_menu.make_with_text (Interface_names.m_Tools)
1495
1496 -- New Cluster command.
1497 command_menu_item := new_cluster_cmd.new_menu_item
1498 add_recyclable (command_menu_item)
1499 tools_menu.extend (command_menu_item)
1500
1501 -- New Class command.
1502 command_menu_item := new_class_cmd.new_menu_item
1503 add_recyclable (command_menu_item)
1504 tools_menu.extend (command_menu_item)
1505
1506 -- New Feature command.
1507 command_menu_item := new_feature_cmd.new_menu_item
1508 add_recyclable (command_menu_item)
1509 tools_menu.extend (command_menu_item)
1510
1511 -- Delete class/cluster command.
1512 command_menu_item := delete_class_cluster_cmd.new_menu_item
1513 add_recyclable (command_menu_item)
1514 tools_menu.extend (command_menu_item)
1515
1516 -- Separator --------------------------------------
1517 tools_menu.extend (create {EV_MENU_SEPARATOR})
1518
1519
1520 if has_metrics then
1521 -- Metric tool
1522 create metric_menu.make_with_text (interface_names.l_Tab_metrics)
1523 create menu_item.make_with_text (interface_names.metric_calculate)
1524 metric_menu.extend (menu_item)
1525 create menu_item.make_with_text (interface_names.metric_add)
1526 metric_menu.extend (menu_item)
1527 create menu_item.make_with_text (interface_names.metric_delete)
1528 metric_menu.extend (menu_item)
1529 create menu_item.make_with_text (interface_names.metric_details)
1530 metric_menu.extend (menu_item)
1531 create menu_item.make_with_text (interface_names.metric_new_metrics)
1532 metric_menu.extend (menu_item)
1533 create menu_item.make_with_text (interface_names.metric_management)
1534 metric_menu.extend (menu_item)
1535 create menu_item.make_with_text (interface_names.metric_archive)
1536 metric_menu.extend (menu_item)
1537 metric_menu.disable_sensitive
1538 tools_menu.extend (metric_menu)
1539 end
1540
1541 if has_profiler then
1542 -- Profiler Window
1543 command_menu_item := show_profiler.new_menu_item
1544 add_recyclable (command_menu_item)
1545 tools_menu.extend (command_menu_item)
1546 end
1547
1548 -- Precompile Wizard
1549 command_menu_item := wizard_precompile_cmd.new_menu_item
1550 add_recyclable (command_menu_item)
1551 tools_menu.extend (command_menu_item)
1552
1553 if has_dll_generation then
1554 -- Dynamic Library Window
1555 command_menu_item := show_dynamic_lib_tool.new_menu_item
1556 add_recyclable (command_menu_item)
1557 tools_menu.extend (command_menu_item)
1558 end
1559
1560 if debugger_manager.display_dotnet_cmd then
1561 -- Import .Net Assembly
1562 command_menu_item := dotnet_import_cmd.new_menu_item
1563 add_recyclable (command_menu_item)
1564 tools_menu.extend (command_menu_item)
1565 end
1566
1567 -- Separator -------------------------------------------------
1568 tools_menu.extend (create {EV_MENU_SEPARATOR})
1569
1570 -- Preferences
1571 command_menu_item := Show_preferences_cmd.new_menu_item
1572 add_recyclable (command_menu_item)
1573 tools_menu.extend (command_menu_item)
1574 end
1575
1576 feature -- Stone process
1577
1578 stone: STONE
1579 -- Current stone
1580
1581 toggle_unified_stone is
1582 -- Change the stone management mode.
1583 do
1584 unified_stone := not unified_stone
1585 if unified_stone then
1586 send_stone_to_context
1587 send_stone_to_context_cmd.disable_sensitive
1588 context_tool.link_to_development_window
1589 else
1590 if stone /= Void then
1591 send_stone_to_context_cmd.enable_sensitive
1592 end
1593 context_tool.cut_from_development_window
1594 end
1595 end
1596
1597 set_stone (a_stone: STONE) is
1598 -- Display text associated with `a_stone', if any and if possible
1599 local
1600 feature_stone: FEATURE_STONE
1601 old_class_stone: CLASSI_STONE
1602 test_stone: CLASSI_STONE
1603 same_class: BOOLEAN
1604 conv_ferrst: FEATURE_ERROR_STONE
1605 do
1606 old_class_stone ?= stone
1607 feature_stone ?= a_stone
1608 if old_class_stone /= Void then
1609 create test_stone.make (old_class_stone.class_i)
1610 same_class := test_stone.same_as (a_stone)
1611 -- We need to compare classes. If `old_class_stone' is a FEATURE_STONE
1612 -- `same_as' will compare features. Therefore, we need `test_stone' to be sure
1613 -- we have a CLASSI_STONE.
1614 if same_class and then feature_stone /= Void then
1615 same_class := False
1616 -- if the stone corresponding to a feature of currently opened class is dropped
1617 -- we attempt to scroll to the feature without asking to save the file
1618 -- except if it is during a resynchronization, in which case we do not scroll at all.
1619 if editor_tool.text_area.text_is_fully_loaded then
1620 if not during_synchronization then
1621 editor_tool.text_area.find_feature_named (feature_stone.feature_name)
1622 feature_stone_already_processed := editor_tool.text_area.found_feature
1623 else
1624 feature_stone_already_processed := True
1625 end
1626 conv_ferrst ?= feature_stone
1627 if feature_stone_already_processed and conv_ferrst /= Void then
1628 -- Scroll to the line of the error.
1629 if not during_synchronization then
1630 editor_tool.text_area.display_line_when_ready (conv_ferrst.line_number, True)
1631 end
1632 end
1633 end
1634 end
1635 end
1636 -- first, let's check if there is already something in this window
1637 -- if there's nothing, there's no need to save anything...
1638 if stone = Void or else not changed or else feature_stone_already_processed or else same_class then
1639 set_stone_after_check (a_stone)
1640 feature_stone_already_processed := False
1641 else
1642 -- there is something to be saved
1643 -- if user chooses to save, current file will be parsed
1644 -- if there is a syntax_error, new file is not loaded
1645 save_and (~set_stone_after_check (a_stone))
1646 if text_saved and then not syntax_is_correct then
1647 text_saved := False
1648 during_synchronization := True
1649 set_stone_after_check (stone)
1650 during_synchronization := False
1651 address_manager.refresh
1652 end
1653 end
1654 end
1655
1656 force_stone (s: STONE) is
1657 -- make `s' the new value of `stone', and
1658 -- change the display accordingly. Try to
1659 -- extract a class from `s' whenever possible.
1660 do
1661 if s.is_storable then
1662 set_stone (s)
1663 if not unified_stone then
1664 context_tool.advanced_set_stone (s)
1665 end
1666 end
1667 end
1668
1669 process_class (s: CLASSI_STONE) is
1670 -- Process class stone
1671 do
1672 set_stone (s)
1673 end
1674
1675 process_feature_error (s: FEATURE_ERROR_STONE) is
1676 -- Process feature error stone.
1677 local
1678 cl_stone: CLASSC_STONE
1679 e_class: CLASS_C
1680 txt: STRING
1681 pos, end_pos: INTEGER
1682 do
1683 set_default_format
1684 e_class := s.e_feature.written_class
1685 if e_class.lace_class.hide_implementation then
1686 set_stone (s)
1687 else
1688 create cl_stone.make (e_class)
1689 set_stone (cl_stone)
1690 editor_tool.text_area.deselect_all
1691 pos := s.error_position
1692 txt := text
1693 if txt.count > pos then
1694 if txt.item (pos) = '%N' then
1695 end_pos := txt.index_of ('%N', pos + 1)
1696 else
1697 end_pos := txt.index_of ('%N', pos)
1698 end
1699 if pos /= 0 then
1700 editor_tool.text_area.highlight_selected (pos, end_pos)
1701 end
1702 end
1703 end
1704 end
1705
1706
1707 process_class_syntax (s: CL_SYNTAX_STONE) is
1708 -- Process class syntax.
1709 local
1710 cl_stone: CLASSC_STONE
1711 do
1712 -- call set_stone to ensure the proper class is displayed
1713 create cl_stone.make (s.e_class)
1714 set_stone (cl_stone)
1715 editor_tool.text_area.deselect_all
1716 editor_tool.text_area.highlight_when_ready (s.start_position + 1, s.end_position + 1)
1717 end
1718
1719 refresh is
1720 -- Synchronize clickable elements with text, if possible.
1721 do
1722 --| FIXME ARNAUD
1723 -- synchronise_stone
1724 --| END FIXME
1725 --| FIXME XR: Refresh current display in the editor.
1726 editor_tool.text_area.update_click_list (False)
1727 update_save_symbol
1728 address_manager.refresh
1729 -- The cluster manager should already be refreshed by the window manager.
1730 -- cluster_manager.refresh
1731 -- context_tool.refresh
1732 end
1733
1734 quick_refresh is
1735 -- Redraw the main editor's drawing area.
1736 do
1737 editor_tool.text_area.refresh
1738 context_tool.quick_refresh
1739 end
1740
1741 set_default_format is
1742 -- Default format of windows.
1743 --| FIXME ARNAUD: To be implemented.
1744 -- local
1745 -- f: EB_FORMATTER
1746 do
1747 -- if stone /= Void then
1748 -- if stone.class_i.hide_implementation then
1749 -- f := format_list.precompiled_default_format
1750 -- else
1751 -- f := format_list.default_format
1752 -- end
1753 -- else
1754 -- f := format_list.default_format
1755 -- end
1756 -- set_last_format (f)
1757 --| END FIXME
1758 end
1759
1760 feature -- Resource Update
1761
1762 update is
1763 -- Update Current with the registered resources.
1764 do
1765 -- Show/hide general toolbar
1766 if window_preferences.show_general_toolbar then
1767 show_general_toolbar_command.enable_visible
1768 else
1769 show_general_toolbar_command.disable_visible
1770 end
1771
1772 -- Show/hide address toolbar
1773 if window_preferences.show_address_toolbar then
1774 show_address_toolbar_command.enable_visible
1775 else
1776 show_address_toolbar_command.disable_visible
1777 end
1778
1779 -- Show/hide project toolbar
1780 if window_preferences.show_project_toolbar then
1781 show_project_toolbar_command.enable_visible
1782 else
1783 show_project_toolbar_command.disable_visible
1784 end
1785
1786 left_panel.load_from_resource (window_preferences.left_panel_layout)
1787 right_panel.load_from_resource (window_preferences.right_panel_layout)
1788 end
1789
1790 update_splitters is
1791 -- Refresh the position of the splitter on screen according to
1792 -- our internal values.
1793 do
1794 -- Set the interior layout
1795 if panel.full then
1796 panel.set_split_position (splitter_position.max (panel.minimum_split_position).min (panel.maximum_split_position))
1797 end
1798 left_panel.refresh_splitter
1799 right_panel.refresh_splitter
1800 end
1801
1802 register is
1803 -- Register to preferences we want notification of.
1804 do
1805 end
1806
1807 unregister is
1808 -- unregister to preferences we want notification of.
1809 do
1810 end
1811
1812 reset is
1813 -- Reset the window contents
1814 do
1815 Precursor
1816 address_manager.reset
1817
1818 --| FIXME ARNAUD, multiformat not yet implemented.
1819 -- format_list.enable_imp_formats_sensitive
1820 --| END FIXME
1821 end
1822
1823 syntax_is_correct: BOOLEAN is
1824 -- file was successfully parsed.
1825 do
1826 Result := editor_tool.text_area.syntax_is_correct
1827 end
1828
1829 on_project_created is
1830 -- Inform tools that the current project has been loaded or re-loaded.
1831 do
1832 build_menu_bar
1833 enable_commands_on_project_created
1834 context_tool.on_project_created
1835 address_manager.on_project_created
1836 if has_dll_generation then
1837 show_dynamic_lib_tool.enable_sensitive
1838 end
1839 if has_profiler then
1840 show_profiler.enable_sensitive
1841 end
1842 end
1843
1844 on_project_loaded is
1845 -- Inform tools that the current project has been loaded or re-loaded.
1846 do
1847 -- cluster_manager.on_project_loaded
1848 enable_commands_on_project_loaded
1849 cluster_tool.on_project_loaded
1850 context_tool.on_project_loaded
1851 end
1852
1853 on_project_unloaded is
1854 -- Inform tools that the current project will soon been unloaded.
1855 do
1856 -- cluster_manager.on_project_unloaded
1857 disable_commands_on_project_unloaded
1858 cluster_tool.on_project_unloaded
1859 context_tool.on_project_unloaded
1860 address_manager.on_project_unloaded
1861 build_menu_bar
1862 if has_dll_generation then
1863 show_dynamic_lib_tool.disable_sensitive
1864 end
1865 if has_profiler then
1866 show_profiler.disable_sensitive
1867 end
1868 end
1869
1870 save_before_compiling is
1871 -- save the text but do not update clickable positions
1872 do
1873 save_only := True
1874 save_text
1875 end
1876
1877 perform_check_before_save is
1878 local
1879 dial: EV_CONFIRMATION_DIALOG
1880 do
1881 debug ("EDITOR")
1882 if editor_tool.text_area.current_text /= Void and then changed then
1883 io.error.putstring ("%N Warning: Attempting to save a non editable format%N")
1884 end
1885 end
1886 if editor_tool.text_area.open_backup then
1887 create dial.make_with_text(Warning_messages.w_Save_backup)
1888 dial.set_buttons_and_actions(<<"Continue", "Cancel">>, <<~continue_save, ~cancel_save>>)
1889 dial.set_default_push_button(dial.button("Continue"))
1890 dial.set_default_cancel_button(dial.button("Cancel"))
1891 dial.set_title ("Save Backup")
1892 dial.show_modal_to_window (window)
1893 else
1894 check_passed := True
1895 end
1896 end
1897
1898 continue_save is
1899 -- continue saving
1900 do
1901 check_passed := True
1902 end
1903
1904 cancel_save is
1905 -- cancel saving
1906 do
1907 check_passed := False
1908 end
1909
1910 process is
1911 -- process the user entry in the address bar
1912 do
1913 save_canceled := False
1914 end
1915
1916 on_text_saved is
1917 -- Notify the editor that the text has been saved
1918 local
1919 str: STRING
1920 do
1921 Precursor
1922 editor_tool.on_text_saved
1923 text_saved := True
1924 if not save_only then
1925 editor_tool.text_area.update_click_list (True)
1926 end
1927 save_only := False
1928 str := clone (title)
1929 if str @ 1 = '*' then
1930 str.tail (str.count - 2)
1931 set_title (str)
1932 end
1933 update_formatters
1934 end
1935
1936 save_and (an_action: PROCEDURE [ANY, TUPLE []]) is
1937 local
1938 save_dialog: EB_CONFIRM_SAVE_DIALOG
1939 do
1940 save_canceled := True
1941 text_saved := False
1942 create save_dialog.make_and_launch (Current,Current)
1943 if not save_canceled and then syntax_is_correct then
1944 an_action.call([])
1945 end
1946 end
1947
1948 feature -- Window management
1949
1950 show_window is
1951 -- Show the window
1952 do
1953 show
1954 end
1955
1956 raise_window is
1957 -- Show the window and set the focus to it.
1958 do
1959 show
1960 --| FIXME, set the focus.
1961 end
1962
1963 hide_window is
1964 -- Hide the window
1965 do
1966 hide
1967 end
1968
1969 destroy_window is
1970 -- Destroy the window.
1971 do
1972 destroy
1973 end
1974
1975 give_focus is
1976 -- Give the focus to the address manager.
1977 do
1978 address_manager.set_focus
1979 end
1980
1981 feature -- Tools & Controls
1982
1983 editor_tool: EB_EDITOR_TOOL
1984
1985 favorites_tool: EB_FAVORITES_TOOL
1986
1987 cluster_tool: EB_CLUSTER_TOOL
1988
1989 search_tool: EB_SEARCH_TOOL
1990
1991 features_tool: EB_FEATURES_TOOL
1992
1993 windows_tool: EB_WINDOWS_TOOL
1994
1995 context_tool: EB_CONTEXT_TOOL
1996 -- Context explorer for current class and system.
1997
1998 address_manager: EB_ADDRESS_MANAGER
1999 -- Text field in the toolbar
2000 -- Allow user to enter the name
2001 -- of the class he wants to edit.
2002
2003 project_manager: EB_PROJECT_MANAGER is
2004 -- Project manager associated to the project the user is working on.
2005 do
2006 Result := Eiffel_project.manager
2007 end
2008
2009 managed_class_formatters: ARRAYED_LIST [EB_CLASS_INFO_FORMATTER]
2010 -- All formatters that operate on a class.
2011
2012 managed_feature_formatters: ARRAYED_LIST [EB_FEATURE_INFO_FORMATTER]
2013 -- All formatters that operate on a class.
2014
2015 managed_main_formatters: ARRAYED_LIST [EB_CLASS_TEXT_FORMATTER]
2016 -- All formatters that can be displayed in the main editor frame.
2017
2018 unified_stone: BOOLEAN
2019 -- Is the stone common with the context tool or not?
2020
2021 feature -- Multiple editor management
2022
2023 add_editor_to_list (an_editor: EB_EDITOR) is
2024 -- adds `an_editor' to `editors'
2025 do
2026 editors.extend (an_editor)
2027 end
2028
2029 current_editor: EB_EDITOR is
2030 -- current editor, if none, main editor
2031 do
2032 if current_editor_index /= 0 then
2033 Result := editors @ current_editor_index
2034 else
2035 Result := editors.first
2036 end
2037 end
2038
2039 set_current_editor (an_editor: EB_EDITOR) is
2040 -- set `an_editor' as main editor
2041 local
2042 old_index: INTEGER
2043 new_index: INTEGER
2044 do
2045 old_index := current_editor_index
2046 new_index := editors.index_of (an_editor, 1)
2047 if
2048 editors.valid_index (new_index) and
2049 old_index /= new_index
2050 then
2051 current_editor_index := new_index
2052 from
2053 editors.start
2054 until
2055 editors.after
2056 loop
2057 if editors.index /= current_editor_index and then editors.item.has_selection then
2058 editors.item.disable_selection
2059 end
2060 editors.forth
2061 end
2062 update_paste_cmd
2063 -- Last thing, update the menu entry for the formatting marks.
2064 if current_editor.view_invisible_symbols then
2065 formatting_marks_command_menu_item.set_text (Interface_names.m_Hide_formatting_marks)
2066 else
2067 formatting_marks_command_menu_item.set_text(Interface_names.m_Show_formatting_marks)
2068 end
2069 command_controller.set_current_editor (an_editor)
2070 end
2071 end
2072
2073 update_paste_cmd is
2074 -- Update `editor_paste_cmd'. To be performed when an editor grabs the focus.
2075 local
2076 txt: STRING
2077 do
2078 txt := current_editor.clipboard.text
2079 if
2080 not current_editor.is_empty and then
2081 current_editor.is_editable and then
2082 txt /= Void and then
2083 not txt.is_empty
2084 then
2085 editor_paste_cmd.enable_sensitive
2086 else
2087 editor_paste_cmd.disable_sensitive
2088 end
2089 end
2090
2091 feature {NONE} -- Multiple editor management
2092
2093 editors: ARRAYED_LIST [EB_EDITOR]
2094 -- editor contained in `Current'
2095
2096 current_editor_index: INTEGER
2097 -- Index in `editors' of the editor that has the focus.
2098
2099 feature {EB_WINDOW_MANAGER} -- Window management / Implementation
2100
2101 destroy_imp is
2102 -- Destroy window.
2103 do
2104 -- To avoid reentrance
2105 if not is_destroying then
2106 is_destroying := True
2107 window_preferences.save_left_panel_layout (left_panel.save_to_resource)
2108 window_preferences.save_right_panel_layout (right_panel.save_to_resource)
2109 window_preferences.save_search_tool_options (search_tool)
2110 hide
2111
2112 -- Commit saves
2113 window_preferences.save_resources
2114
2115 -- If a launched application is still running, kill it.
2116 if
2117 Application.is_running and then
2118 debugger_manager.debugging_window = Current
2119 then
2120 Application.kill
2121 end
2122 toolbars_area.wipe_out
2123 address_manager.recycle
2124 project_customizable_toolbar.recycle
2125 Precursor {EB_TOOL_MANAGER}
2126
2127 -- These components are automatically recycled through `add_recyclable'.
2128 -- cluster_tool.recycle
2129 -- context_tool.recycle
2130 -- editor_tool.recycle
2131 -- favorites_tool.recycle
2132 -- features_tool.recycle
2133 -- search_tool.recycle
2134 -- windows_tool.recycle
2135
2136 -- The compile menu is never created !!!
2137 -- compile_menu.destroy
2138 -- debug_menu.destroy
2139 -- project_menu.destroy
2140
2141 managed_class_formatters.wipe_out
2142 managed_feature_formatters.wipe_out
2143 managed_main_formatters.wipe_out
2144 toolbarable_commands.wipe_out
2145 editors.wipe_out
2146 stone := Void
2147 end
2148 end
2149
2150 feature {NONE} -- Implementation
2151
2152 set_stone_after_check (a_stone: STONE) is
2153 local
2154 old_stone: STONE
2155 new_class_stone: CLASSI_STONE
2156 old_class_stone: CLASSI_STONE
2157 conv_classc: CLASSC_STONE
2158 conv_brkstone: BREAKABLE_STONE
2159 cluster_st: CLUSTER_STONE
2160 feature_stone: FEATURE_STONE
2161 conv_ferrst: FEATURE_ERROR_STONE
2162 tmp_structured_text: STRUCTURED_TEXT
2163 conv_errst: ERROR_STONE
2164 class_file: RAW_FILE
2165 class_text_exists: BOOLEAN
2166 same_class: BOOLEAN
2167 test_stone: CLASSI_STONE
2168 conv_ace: ACE_SYNTAX_STONE
2169 str: STRING
2170 do
2171 -- the text does not change if the text was saved with syntax errors
2172 cur_wid := window
2173 if cur_wid = Void then
2174 --| Do nothing.
2175 else
2176 if old_cur = Void then
2177 old_cur := cur_wid.pointer_style
2178 end
2179 -- cur_wid.enable_capture
2180 cur_wid.set_pointer_style (Wait_cursor)
2181 end
2182
2183 conv_brkstone ?= a_stone
2184 conv_errst ?= a_stone
2185 conv_ace ?= a_stone
2186 if conv_brkstone /= Void then
2187 if Application.is_breakpoint_enabled (conv_brkstone.routine, conv_brkstone.index) then
2188 Application.remove_breakpoint (conv_brkstone.routine, conv_brkstone.index)
2189 else
2190 Application.set_breakpoint (conv_brkstone.routine, conv_brkstone.index)
2191 end
2192 output_manager.display_stop_points
2193 window_manager.quick_refresh_all
2194 elseif conv_errst /= Void then
2195 display_error_help_cmd.execute_with_stone (conv_errst)
2196 elseif conv_ace /= Void then
2197 --| FIXME XR: What should we do?!
2198 else
2199
2200 -- Remember previous stone.
2201 old_stone := stone
2202 old_class_stone ?= stone
2203
2204 -- New stone properties
2205 new_class_stone ?= a_stone
2206
2207 -- Set the stone.
2208 old_set_stone (a_stone)
2209 cluster_st ?= a_stone
2210
2211 new_feature_cmd.disable_sensitive
2212 -- We update the state of the `Add to Favorites' command.
2213 if new_class_stone /= Void then
2214 favorites_menu.first.enable_sensitive
2215 else
2216 favorites_menu.first.disable_sensitive
2217 end
2218
2219 -- Update the history.
2220 if
2221 new_class_stone /= Void
2222 then
2223 history_manager.extend (new_class_stone)
2224 elseif
2225 cluster_st /= Void
2226 then
2227 history_manager.extend (cluster_st)
2228 end
2229 -- Update the address manager if needed.
2230 address_manager.refresh
2231 if
2232 new_class_stone /= Void
2233 then
2234 -- class stone was dropped
2235 create class_file.make (new_class_stone.class_i.file_name)
2236 class_text_exists := class_file.exists
2237 feature_stone ?= a_stone
2238 --| We have to create a classi_stone to check whether the stones are really similar.
2239 --| Otherwise a redefinition of same_as may be called.
2240 create test_stone.make (new_class_stone.class_i)
2241 if test_stone.same_as (old_class_stone) then
2242 same_class := True
2243 end
2244 if not feature_stone_already_processed then
2245 if
2246 same_class and then text_saved
2247 then
2248 -- nothing changed in the editor
2249 -- we only have to update click_list
2250 if editor_tool.text_area.is_editable then
2251 editor_tool.text_area.update_click_list (False)
2252 end
2253 else
2254 if changed then
2255 -- user has already chosen not to save the file
2256 -- do not ask again
2257 editor_tool.text_area.no_save_before_next_load
2258 end
2259 end
2260 end
2261
2262 conv_classc ?= new_class_stone
2263 if conv_classc = Void or else feature_stone /= Void and not feature_stone_already_processed and not (same_class and context_tool.sending_stone) then
2264 -- If a classi_stone or a feature_stone has been dropped,
2265 -- display the basic text formatter.
2266 if class_text_exists then
2267 managed_main_formatters.first.set_stone (new_class_stone)
2268 managed_main_formatters.first.execute
2269 else
2270 editor_tool.text_area.clear_window
2271 editor_tool.text_area.display_message (Warning_messages.w_file_not_exist (new_class_stone.class_i.file_name))
2272 end
2273 end
2274 if conv_classc = Void then
2275 --| The dropped class is not compiled.
2276 --| Display only the textual formatter.
2277 address_manager.disable_formatters
2278 else
2279 --| We have a compiled class.
2280 if
2281 class_text_exists and then
2282 Eiffel_project.Workbench.last_reached_degree <= 2
2283 then
2284 new_feature_cmd.enable_sensitive
2285 end
2286
2287 address_manager.enable_formatters
2288 if not class_text_exists then
2289 --| Disable the textual formatter.
2290 managed_main_formatters.first.disable_sensitive
2291 from
2292 managed_main_formatters.start
2293 managed_main_formatters.forth
2294 until
2295 managed_main_formatters.after
2296 loop
2297 managed_main_formatters.item.set_stone (new_class_stone)
2298 managed_main_formatters.forth
2299 end
2300 managed_main_formatters.i_th (2).execute
2301 else
2302 if not changed then
2303 --| Enable all formatters.
2304 if
2305 not feature_stone_already_processed or
2306 not managed_main_formatters.first.selected
2307 then
2308 from
2309 managed_main_formatters.start
2310 until
2311 managed_main_formatters.after
2312 loop
2313 managed_main_formatters.item.set_stone (new_class_stone)
2314 managed_main_formatters.forth
2315 end
2316 end
2317 else
2318 address_manager.disable_formatters
2319 managed_main_formatters.first.set_stone (new_class_stone)
2320 end
2321 end
2322 end
2323 else
2324 -- not a class text : cannot be edited
2325 editor_tool.text_area.disable_editable
2326 address_manager.disable_formatters
2327
2328 --| Disable all formatters.
2329 from
2330 managed_main_formatters.start
2331 until
2332 managed_main_formatters.after
2333 loop
2334 managed_main_formatters.item.set_stone (Void)
2335 managed_main_formatters.forth
2336 end
2337 if cluster_st /= Void then
2338 --| FIXME XR: Really manage cluster display in the main editor
2339 create tmp_structured_text.make
2340 tmp_structured_text.add_string ("Cluster: " + cluster_st.cluster_i.cluster_name)
2341 tmp_structured_text.add_new_line
2342 tmp_structured_text.add_string ("Cluster path: " + cluster_st.cluster_i.path)
2343 editor_tool.text_area.process_text (tmp_structured_text)
2344 --| END FIXME
2345 end
2346 end
2347 if feature_stone /= Void and class_text_exists and not feature_stone_already_processed and not (same_class and context_tool.sending_stone) then
2348 conv_ferrst ?= feature_stone
2349 if conv_ferrst /= Void then
2350 -- Scroll to the line of the error.
2351 editor_tool.text_area.display_line_when_ready (conv_ferrst.line_number, True)
2352 else
2353 -- if a feature_stone has been dropped
2354 -- scroll to the corresponding feature in the basic text format
2355 if feature_stone.e_feature.ast /= Void and not during_synchronization then
2356 scroll_to_feature (feature_stone.e_feature.ast, new_class_stone.class_i)
2357 end
2358 end
2359 end
2360 -- Update the title of the window
2361 if a_stone /= Void then
2362 if changed then
2363 str := clone (a_stone.header)
2364 str.prepend ("* ")
2365 set_title (str)
2366 else
2367 set_title (a_stone.header)
2368 end
2369 else
2370 set_title (Interface_names.t_Empty_development_window)
2371 end
2372
2373 -- Refresh the tools.
2374 features_tool.set_stone (a_stone)
2375 cluster_tool.set_stone (a_stone)
2376 -- Update the context tool.
2377 if unified_stone then
2378 context_tool.set_stone (a_stone)
2379 end
2380
2381 end
2382 if
2383 stone /= Void and then
2384 not unified_stone
2385 then
2386 send_stone_to_context_cmd.enable_sensitive
2387 else
2388 send_stone_to_context_cmd.disable_sensitive
2389 end
2390 if cur_wid = Void then
2391 --| Do nothing.
2392 else
2393 cur_wid.set_pointer_style (old_cur)
2394 old_cur := Void
2395 -- cur_wid.disable_capture
2396 cur_wid := Void
2397 end
2398 end
2399
2400 scroll_to_feature (feat_as: FEATURE_AS; displayed_class: CLASS_I) is
2401 -- highlight the feature correspnding to `feat_as' in the class represented by `displayed_class'
2402 require
2403 class_is_not_void: displayed_class /= Void
2404 feat_as_is_not_void: feat_as /= Void
2405 local
2406 begin_index, offset: INTEGER
2407 tmp_text: STRING
2408 do
2409 begin_index := feat_as.start_position
2410 if platform_constants.is_windows then
2411 tmp_text := displayed_class.text.substring (1, begin_index)
2412 offset := tmp_text.occurrences('%R')
2413 end
2414 editor_tool.text_area.scroll_to_when_ready (begin_index - offset)
2415 end
2416
2417
2418 check_passed: BOOLEAN
2419
2420 save_canceled: BOOLEAN
2421 -- did user cancel save ?
2422
2423 save_only: BOOLEAN
2424 -- skip parse and update after save ?
2425
2426 text_saved: BOOLEAN
2427 -- has the user chosen to save the file
2428
2429 is_destroying: BOOLEAN
2430 -- Is `current' being currently destroyed?
2431
2432 feature_stone_already_processed: BOOLEAN
2433 -- Is the processed stone a feature stone and has it
2434 -- been already processed by the editor ?
2435
2436 feature {NONE} -- Implementation
2437
2438 update_save_symbol is
2439 do
2440 {EB_FILEABLE} Precursor
2441 if changed then
2442 save_cmd.enable_sensitive
2443 address_manager.disable_formatters
2444 else
2445 save_cmd.disable_sensitive
2446 update_formatters
2447 end
2448 if is_empty then
2449 print_cmd.disable_sensitive
2450 save_as_cmd.disable_sensitive
2451 else
2452 print_cmd.enable_sensitive
2453 save_as_cmd.enable_sensitive
2454 end
2455 end
2456
2457 update_formatters is
2458 -- Give a correct sensitivity to formatters.
2459 local
2460 cist: CLASSI_STONE
2461 cst: CLASSC_STONE
2462 file: RAW_FILE
2463 do
2464 cst ?= stone
2465 if cst /= Void then
2466 if changed then
2467 address_manager.disable_formatters
2468 else
2469 address_manager.enable_formatters
2470 create file.make (cst.e_class.lace_class.file_name)
2471 if not file.exists then
2472 if managed_main_formatters.first.selected then
2473 managed_main_formatters.i_th (2).execute
2474 end
2475 managed_main_formatters.first.disable_sensitive
2476 end
2477 end
2478 else
2479 address_manager.disable_formatters
2480 cist ?= stone
2481 if cist /= Void then
2482 managed_main_formatters.first.execute
2483 end
2484 end
2485 end
2486
2487 on_text_reset is
2488 -- The main editor has just been wiped out
2489 -- before loading a new file.
2490 local
2491 str: STRING
2492 do
2493 str := clone (title)
2494 if str @ 1 = '*' then
2495 str.tail (str.count - 2)
2496 set_title (str)
2497 end
2498 address_manager.disable_formatters
2499 end
2500
2501 on_text_fully_loaded is
2502 -- The main editor has just been reloaded.
2503 do
2504 update_paste_cmd
2505 update_formatters
2506 end
2507
2508 on_text_back_to_its_last_saved_state is
2509 local
2510 str: STRING
2511 do
2512 str := clone (title)
2513 if str @ 1 = '*' then
2514 str.tail (str.count - 2)
2515 set_title (str)
2516 end
2517 update_formatters
2518 end
2519
2520
2521 on_text_edited (unused: BOOLEAN) is
2522 -- The text in the editor is modified, add the '*' in the title.
2523 -- Gray out the formatters.
2524 local
2525 str: STRING
2526 do
2527 str := clone (title)
2528 if str @ 1 /= '*' then
2529 str.prepend ("* ")
2530 set_title (str)
2531 end
2532 address_manager.disable_formatters
2533 end
2534
2535 on_back is
2536 -- User pressed Alt+left.
2537 -- Go back in the history (or the context history).
2538 do
2539 if context_tool_has_focus then
2540 if context_tool.history_manager.is_back_possible then
2541 context_tool.history_manager.back_command.execute
2542 end
2543 elseif history_manager.is_back_possible then
2544 history_manager.back_command.execute
2545 end
2546 end
2547
2548 on_forth is
2549 -- User pressed Alt+right.
2550 -- Go forth in the history (or the context history).
2551 do
2552 if context_tool_has_focus then
2553 if context_tool.history_manager.is_forth_possible then
2554 context_tool.history_manager.forth_command.execute
2555 end
2556 elseif history_manager.is_forth_possible then
2557 history_manager.forth_command.execute
2558 end
2559 end
2560
2561 context_tool_has_focus: BOOLEAN is
2562 -- Does the context tool or one of its children has the focus?
2563 local
2564 fw: EV_WIDGET
2565 cont: EV_CONTAINER
2566 wid: EV_WIDGET
2567 do
2568 fw := (create {EV_ENVIRONMENT}).application.focused_widget
2569 wid := context_tool.explorer_bar_item.widget
2570 if wid = fw then
2571 Result := True
2572 elseif fw = Void then
2573 Result := False
2574 else
2575 from
2576 cont := fw.parent
2577 until
2578 cont = wid or cont = Void
2579 loop
2580 cont := cont.parent
2581 end
2582 if cont = wid then
2583 Result := True
2584 end
2585 end
2586 end
2587
2588 saved_cursor: CURSOR
2589 -- Saved cursor position for displaying the stack.
2590
2591 can_drop (st: ANY): BOOLEAN is
2592 -- Can the user drop the stone `st'?
2593 local
2594 conv_ace: ACE_SYNTAX_STONE
2595 do
2596 conv_ace ?= st
2597 Result := conv_ace = Void
2598 end
2599
2600 quick_refresh_on_class_drop (unused: CLASSI_STONE) is
2601 -- Quick refresh all windows.
2602 do
2603 window_manager.quick_refresh_all
2604 end
2605
2606 quick_refresh_on_brk_drop (unused: BREAKABLE_STONE) is
2607 -- Quick refresh all windows.
2608 do
2609 window_manager.quick_refresh_all
2610 end
2611
2612 send_stone_to_context is
2613 -- Send current stone to the context tool.
2614 -- Used by `send_stone_to_context_cmd'.
2615 do
2616 if stone /= Void then
2617 context_tool.set_stone (stone)
2618 end
2619 end
2620
2621 destroy is
2622 -- check if current text has been saved and destroy
2623 local
2624 dialog_w: EB_WARNING_DIALOG
2625 do
2626 if editor_tool /= Void and then editor_tool.text_area /= Void and then changed and then not confirmed then
2627 Exit_application_cmd.set_already_save_confirmed (True)
2628 create dialog_w.make_with_text (Interface_names.l_Close_warning)
2629 dialog_w.set_buttons_and_actions (<<"Yes", "No", "Cancel">>, <<~save_and_destroy, ~force_destroy, Exit_application_cmd~set_already_save_confirmed (False)>>)
2630 dialog_w.set_default_push_button (dialog_w.button("Yes"))
2631 dialog_w.set_default_cancel_button (dialog_w.button("Cancel"))
2632 dialog_w.show_modal_to_window (window)
2633 else
2634 Precursor {EB_TOOL_MANAGER}
2635 Exit_application_cmd.set_already_save_confirmed (False)
2636 end
2637 end
2638
2639 save_and_destroy is
2640 do
2641 save_text
2642 destroy
2643 end
2644
2645 force_destroy is
2646 -- Destroy without asking.
2647 do
2648 confirmed := True
2649 destroy
2650 confirmed := False
2651 end
2652
2653 confirmed: BOOLEAN
2654 -- Did the user say he wanted to exit?
2655
2656 show_dynamic_library_dialog is
2657 -- Create a new dynamic library window and display it.
2658 do
2659 Window_manager.create_dynamic_lib_window
2660 end
2661
2662 recycle is
2663 -- Call the precursors.
2664 do
2665 {EB_TOOL_MANAGER} Precursor
2666 command_controller.recycle
2667 end
2668
2669 feature {NONE} -- Implementation: Editor commands
2670
2671 select_all is
2672 -- Select the whole text in the focused editor.
2673 do
2674 current_editor.select_all
2675 end
2676
2677 find_next is
2678 -- Find the next occurrence of the search text.
2679 local
2680 cv_ced: EB_CLICKABLE_EDITOR
2681 do
2682 if search_tool.currently_searched /= Void then
2683 cv_ced ?= current_editor
2684 if cv_ced /= Void then
2685 cv_ced.find_next
2686 end
2687 else
2688 search_tool.set_focus
2689 end
2690 end
2691
2692 find_previous is
2693 -- Find the previous occurrence of the search text.
2694 local
2695 cv_ced: EB_CLICKABLE_EDITOR
2696 do
2697 if search_tool.currently_searched /= Void then
2698 cv_ced ?= current_editor
2699 if cv_ced /= Void then
2700 cv_ced.find_previous
2701 end
2702 else
2703 search_tool.set_focus
2704 end
2705 end
2706
2707 find_selection is
2708 -- Find the next occurrence of the selection.
2709 local
2710 cv_ced: EB_CLICKABLE_EDITOR
2711 do
2712 cv_ced ?= current_editor
2713 if cv_ced /= Void then
2714 cv_ced.find_selection
2715 end
2716 end
2717
2718 cut_selection is
2719 -- Cut the selection in the current editor.
2720 do
2721 current_editor.cut_selection
2722 end
2723
2724 copy_selection is
2725 -- Cut the selection in the current editor.
2726 do
2727 current_editor.copy_selection
2728 end
2729
2730 toggle_formatting_marks is
2731 -- Show/Hide formatting marks in the editor and update related menu item.
2732 do
2733 current_editor.toggle_view_invisible_symbols
2734 if current_editor.view_invisible_symbols then
2735 formatting_marks_command_menu_item.set_text (Interface_names.m_Hide_formatting_marks)
2736 else
2737 formatting_marks_command_menu_item.set_text(Interface_names.m_Show_formatting_marks)
2738 end
2739 end
2740
2741 feature {NONE} -- Implementation / Menus
2742
2743 old_cur: EV_CURSOR
2744 -- Cursor saved while displaying the hourglass cursor.
2745
2746 cur_wid: EV_WIDGET
2747 -- Widget on which the hourglass cursor was set.
2748
2749 project_menu: EV_MENU
2750 -- Menu for entries relative to the Project.
2751
2752 recent_projects_menu: EB_RECENT_PROJECTS_MANAGER_MENU
2753 -- SubMenu for recent projects.
2754
2755 during_synchronization: BOOLEAN
2756 -- Are we during a resynchronization?
2757
2758 formatting_marks_command_menu_item: EB_COMMAND_MENU_ITEM
2759 -- Menu item used to shw/hide formatting marks.
2760
2761 undo_accelerator: EV_ACCELERATOR
2762 -- Accelerator for Ctrl+Z
2763
2764 redo_accelerator: EV_ACCELERATOR
2765 -- Accelerator for Ctrl+Y
2766
2767 feature {EB_TOOL} -- Implementation / Commands
2768
2769 shell_cmd: EB_OPEN_SHELL_COMMAND
2770 -- Command to use an external editor.
2771
2772 undo_cmd: EB_UNDO_COMMAND
2773 -- Command to undo in the editor.
2774
2775 redo_cmd: EB_REDO_COMMAND
2776 -- Command to redo in the editor.
2777
2778 editor_cut_cmd: EB_ON_SELECTION_COMMAND
2779 -- Command to cut text in the editor.
2780
2781 editor_copy_cmd: EB_ON_SELECTION_COMMAND
2782 -- Command to copy text in the editor.
2783
2784 editor_paste_cmd: EB_EDITOR_PASTE_COMMAND
2785 -- Command to paste text in the editor.
2786
2787 melt_cmd: EB_MELT_PROJECT_COMMAND
2788 -- Command to start compilation.
2789
2790 freeze_cmd: EB_FREEZE_PROJECT_COMMAND
2791 -- Command to Freeze the project.
2792
2793 finalize_cmd: EB_FINALIZE_PROJECT_COMMAND
2794 -- Command to Finalize the project.
2795
2796 c_workbench_compilation_cmd: EB_C_COMPILATION_COMMAND
2797 -- Command to compile the workbench C code.
2798
2799 c_finalized_compilation_cmd: EB_C_COMPILATION_COMMAND
2800 -- Command to compile the finalized C code.
2801
2802 new_cluster_cmd: EB_NEW_CLUSTER_COMMAND
2803 -- Command to create a new cluster.
2804
2805 new_class_cmd: EB_NEW_CLASS_COMMAND
2806 -- Command to create a new class.
2807
2808 new_feature_cmd: EB_NEW_FEATURE_COMMAND
2809 -- Command to execute the feature wizard.
2810
2811 toggle_stone_cmd: EB_UNIFY_STONE_CMD
2812 -- Command to toggle between the stone management modes.
2813
2814 delete_class_cluster_cmd: EB_DELETE_CLASS_CLUSTER_COMMAND
2815 -- Command to remove a class or a cluster from the system
2816 -- (permanent deletion).
2817
2818 show_profiler: EB_SHOW_PROFILE_TOOL
2819 -- What allows us to display the profiler window.
2820
2821 toolbarable_commands: ARRAYED_LIST [EB_TOOLBARABLE_COMMAND]
2822 -- All commands that can be put in a toolbar.
2823
2824 command_controller: EB_EDITOR_COMMAND_CONTROLLER
2825 -- Object that takes care of updating the sensitivity of all editor commands.
2826
2827 save_as_cmd: EB_SAVE_FILE_AS_COMMAND
2828 -- Command to save a class with a different file name.
2829
2830 system_info_cmd: EB_STANDARD_CMD is
2831 -- Command to display information about the system (root class,...)
2832 do
2833 Result := debugger_manager.system_info_cmd
2834 end
2835
2836 display_error_help_cmd: EB_ERROR_INFORMATION_CMD is
2837 -- Command to pop up a dialog giving help on compilation errors.
2838 do
2839 Result := debugger_manager.display_error_help_cmd
2840 end
2841
2842 send_stone_to_context_cmd: EB_STANDARD_CMD
2843 -- Command to send the current stone to the context tool.
2844
2845 print_cmd: EB_PRINT_COMMAND
2846 -- Command to print the content of editor with focus
2847
2848 dotnet_import_cmd: EB_DOTNET_IMPORT_CMD is
2849 -- Manage .Net assemblies.
2850 do
2851 Result := debugger_manager.dotnet_import_cmd
2852 end
2853
2854 show_favorites_menu_item: EV_MENU_ITEM
2855 -- Show/Hide favorites menu item.
2856
2857 update_show_favorites_menu_item is
2858 -- Update `show_favorites_menu_item' menu label.
2859 do
2860 if favorites_tool.shown then
2861 show_favorites_menu_item.set_text (Interface_names.m_Hide_favorites)
2862 else
2863 show_favorites_menu_item.set_text (Interface_names.m_Show_favorites)
2864 end
2865 end
2866
2867 execute_show_favorites is
2868 -- Show `favorites_tool' if it is closed, close
2869 -- it in the opposite case.
2870 do
2871 update_show_favorites_menu_item
2872 if favorites_tool.shown then
2873 favorites_tool.close
2874 else
2875 favorites_tool.show
2876 end
2877 end
2878
2879 feature {NONE} -- external edition handling
2880
2881 on_focus is
2882 -- check if the text has not been modified by an external editor
2883 local
2884 dialog: EV_INFORMATION_DIALOG
2885 button_labels: ARRAY [STRING]
2886 actions: ARRAY [PROCEDURE [ANY, TUPLE]]
2887 do
2888 debug ("DEBUGGER_INTERFACE")
2889 io.putstring ("Took focus!%N")
2890 end
2891 if not editor_tool.edited_file_is_up_to_date then
2892 if not editor_tool.file_date_already_checked then
2893 if not editor_tool.changed and Editor_preferences.automatic_update
2894 then
2895 editor_tool.reload
2896 else
2897 create dialog.make_with_text (warning_messages.w_file_modified_by_another_editor)
2898 create button_labels.make (1, 2)
2899 create actions.make (1, 2)
2900 button_labels.put (interface_names.b_Reload, 1)
2901 actions.put (editor_tool~reload, 1)
2902 button_labels.put (interface_names.b_Continue_anyway, 2)
2903 actions.put (editor_tool~set_changed (True), 2)
2904 dialog.set_buttons_and_actions (button_labels,actions)
2905 dialog.set_default_push_button (dialog.button (button_labels @ 1))
2906 dialog.set_default_cancel_button (dialog.button (button_labels @ 2))
2907 dialog.set_title (interface_names.t_External_edition)
2908 dialog.show_modal_to_window (window)
2909 end
2910 end
2911 end
2912 end
2913
2914 feature {NONE} -- Execution
2915
2916 Kcst: EV_KEY_CONSTANTS is
2917 -- A way to access key constants.
2918 once
2919 create Result
2920 end
2921
2922 toolbar_right_click_action (a_x, a_y, a_button: INTEGER; a_x_tilt, a_y_tilt, a_pressure: DOUBLE; a_screen_x, a_screen_y: INTEGER) is
2923 -- Action called when the user right-click in the toolbar.
2924 -- Display a popup menu to show/hide toolbars and customize the general toolbar.
2925 local
2926 popup_menu: EV_MENU
2927 do
2928 if a_button = 3 then
2929 popup_menu := build_toolbar_menu
2930 popup_menu.show
2931 end
2932 end
2933
2934 enable_commands_on_project_created is
2935 -- Enable commands when a new project has been created (not yet compiled)
2936 do
2937 system_info_cmd.enable_sensitive
2938 if
2939 stone /= Void and then
2940 not unified_stone
2941 then
2942 send_stone_to_context_cmd.enable_sensitive
2943 end
2944 end
2945
2946 enable_commands_on_project_loaded is
2947 -- Enable commands when a new project has been created and compiled
2948 do
2949 if has_profiler then
2950 show_profiler.enable_sensitive
2951 end
2952 if has_dll_generation then
2953 show_dynamic_lib_tool.enable_sensitive
2954 end
2955 open_cmd.enable_sensitive
2956 new_class_cmd.enable_sensitive
2957 new_cluster_cmd.enable_sensitive
2958 system_info_cmd.enable_sensitive
2959 if unified_stone then
2960 send_stone_to_context_cmd.disable_sensitive
2961 elseif stone /= Void then
2962 send_stone_to_context_cmd.enable_sensitive
2963 end
2964 new_class_cmd.enable_sensitive
2965 new_cluster_cmd.enable_sensitive
2966 delete_class_cluster_cmd.enable_sensitive
2967 c_workbench_compilation_cmd.enable_sensitive
2968 c_finalized_compilation_cmd.enable_sensitive
2969 end
2970
2971 disable_commands_on_project_unloaded is
2972 -- Enable commands when a project has been closed.
2973 do
2974 if has_dll_generation then
2975 show_dynamic_lib_tool.disable_sensitive
2976 end
2977 if has_profiler then
2978 show_profiler.disable_sensitive
2979 end
2980 open_cmd.disable_sensitive
2981 new_class_cmd.disable_sensitive
2982 new_cluster_cmd.disable_sensitive
2983 if not project_manager.is_created then
2984 system_info_cmd.disable_sensitive
2985 send_stone_to_context_cmd.disable_sensitive
2986 end
2987 delete_class_cluster_cmd.disable_sensitive
2988 c_workbench_compilation_cmd.disable_sensitive
2989 c_finalized_compilation_cmd.disable_sensitive
2990 end
2991
2992 end -- class EB_DEVELOPMENT_WINDOW
2993

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.23