/[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 57886 - (show annotations)
Thu Mar 30 00:13:44 2006 UTC (13 years, 10 months ago) by manus
Original Path: trunk/Src/bench/Eiffel/interface/new_graphical/windows/eb_development_window.e
File size: 129217 byte(s)
Defined `group' and use it in `set_editing_location_by_feature'. Made `cluster'
  use group and left a `conf_todo_msg' call since there is one caller left that
  needs to be updated. Doing this made pick and drop work in the editor.

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