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

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.23