/[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 54560 - (show annotations)
Tue Aug 30 21:48:50 2005 UTC (14 years, 5 months ago) by manus
Original Path: trunk/Src/bench/Eiffel/interface/new_graphical/windows/eb_development_window.e
File size: 108384 byte(s)
Added new formatter to display invariants of a class.

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

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.23