/[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 27860 - (show annotations)
Fri Sep 21 17:50:27 2001 UTC (18 years, 5 months ago) by xavier
Original Path: trunk/Src/bench/Eiffel/interface/new_graphical/windows/eb_development_window.e
File size: 87654 byte(s)
Yiiihaaaaaa :)
Fixed the editor-related commands:
1) The menu items now do the same as the accelerators (commands are now applicable on the editors other than the main one),
2) The commands can now be disabled when the text is empty (for example when removing the current class from the system),
3) Commands can now be disabled when the editor is not editable (if necessary)

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

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.23