/[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 57426 - (show annotations)
Fri Mar 10 20:30:45 2006 UTC (13 years, 11 months ago) by tedf
Original Path: trunk/Src/bench/Eiffel/interface/new_graphical/windows/eb_development_window.e
File size: 128945 byte(s)
1. Removed all STRUCTURED_TEXT within the compiler.
2. Replaced with TEXT_FORMATTER for editor and documentation output formatting.
 Generally, there are five descendents for the moment.
-OUTPUT_WINDOW: For simple string output. i.e. Command line, file, buffered string etc.
-TEXT_FILTER: For various documentation formatting.
-EB_OUPUT_MANAGER: Mainly for EB_GRAPHICAL_OUTPUT_MANAGER decoration.
-EDITOR_TOKEN_WRITER: Editor tokens are translated here for colorized editor views.
-TEXT_FORMATTER_DECORATOR: A decorator of TEXT_FORMATTERS. Handles context and formatting information. AST visits for outputs are mainly mediated here.
 There are two sets of interface, process_* and add_*. The main one is process_* which is recommended to use. add_* is from STRUCTURED_TEXT which does not exist any more. As it affected vastly, I still keep its interfaces.
3. SHARED_TEXT_ITEMS are all strings now, as items in structured text have been removed.
4. Wrote AST_OUTPUT_STRATEGY which is an AST_VISITOR processing AST to TEXT_FORMATTER. Wrote AST_DECORATED_OUTPUT_STRATEGY a client of TEXT_FORMATTER_DECORATOR. And one AST_DOCUMENTATION_OUTPUT_STRATEGY only for documentation.
5. Removed flat/short views buffering of STRUCTURED_TEXT. It is slightly slower than before, but in my opinion acceptable.
6. Wrote a AST_TYPE_OUTPUT_STRATEGY which visit a type and print its ‘text’ representation output to a TEXT_FORMATTER.
7. Rewrote TOKEN_VISITOR and a descendant EIFFEL_TOKEN_VISITOR for editor tokens in library and in the compiler.
8. Leave printer command prints simple text in current editor. Further work will be done a little later.
9. We gain 22% faster of documentation generation for the moment. Less than we expected, I think, mainly because of additions and accuracy we gain.


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