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

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.23