/[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 32663 - (show annotations)
Tue Jul 2 22:47:03 2002 UTC (17 years, 7 months ago) by manus
Original Path: trunk/Src/bench/Eiffel/interface/new_graphical/windows/eb_development_window.e
File size: 89076 byte(s)
Make sure that all external commands menu item are added to the `recycling'
process. Not doing so, we were keeping a reference to a dead EB_DEVELOPMENT_WINDOW.

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

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.23