/[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 36309 - (show annotations)
Wed Mar 12 07:34:28 2003 UTC (16 years, 11 months ago) by manus
Original Path: trunk/Src/bench/Eiffel/interface/new_graphical/windows/eb_development_window.e
File size: 94086 byte(s)
Cosmetics: replaced ~ by keyword `agent'
Fixed VUEX errors on agents that were not previously detected by compiler
  because it was not checked.

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

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.23