/[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 33979 - (show annotations)
Fri Aug 23 23:49:01 2002 UTC (17 years, 6 months ago) by neilc
Original Path: trunk/Src/bench/Eiffel/interface/new_graphical/windows/eb_development_window.e
File size: 93968 byte(s)
Improved way .NET feature clauses are stored for formatting and added 'get_feature_clauses'
so clients can return feature clauses for any previously formatting .NET type.

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

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.23