/[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 29871 - (show annotations)
Thu Dec 20 23:30:18 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: 87038 byte(s)
Now display the error messages of the address manager in the status bar.

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

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.23