/[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 54437 - (show annotations)
Wed Aug 24 11:56:34 2005 UTC (14 years, 6 months ago) by jfiat
Original Path: trunk/Src/bench/Eiffel/interface/new_graphical/windows/eb_development_window.e
File size: 108216 byte(s)
added assembly information to cluster display

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

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.23