/[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 29812 - (show annotations)
Wed Dec 19 04:03:22 2001 UTC (18 years, 2 months ago) by xavier
Original Path: trunk/Src/bench/Eiffel/interface/new_graphical/windows/eb_development_window.e
File size: 86956 byte(s)
This event was in fact useless.

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

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.23