/[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 54985 - (show annotations)
Fri Oct 7 01:22:05 2005 UTC (14 years, 4 months ago) by tedf
Original Path: trunk/Src/bench/Eiffel/interface/new_graphical/windows/eb_development_window.e
File size: 114881 byte(s)
Made features tool and address bar change according to current cursor location in the editor.

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

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.23