/[eiffelstudio]/branches/Eiffel_57_docking/Src/Eiffel/interface/new_graphical/commands/eb_toggle_labels_command.e
ViewVC logotype

Contents of /branches/Eiffel_57_docking/Src/Eiffel/interface/new_graphical/commands/eb_toggle_labels_command.e

Parent Directory Parent Directory | Revision Log Revision Log


Revision 40748 - (show annotations)
Thu Dec 11 20:26:31 2003 UTC (16 years, 1 month ago) by manus
Original Path: trunk/Src/bench/Eiffel/interface/new_graphical/commands/eb_toggle_labels_command.e
File size: 2560 byte(s)
Use `twin' instead of `clone' which is now made obsolete.
Use `as_lower' and `as_upper' whenever appropriate instead of cloning and
  then calling `to_lower' or `to_upper'.

1 indexing
2 description : "Command to change visibility of client links labels."
3 date : "$Date$"
4 revision : "$Revision$"
5
6 class
7 EB_TOGGLE_LABELS_COMMAND
8
9 inherit
10 EB_CONTEXT_DIAGRAM_COMMAND
11 redefine
12 new_toolbar_item,
13 description
14 end
15
16 create
17 make
18
19 feature -- Basic operations
20
21 execute is
22 -- Perform operation.
23 local
24 world: CONTEXT_DIAGRAM
25 do
26 if tool.class_view /= Void then
27 world := tool.class_view
28 elseif tool.cluster_view /= Void then
29 world := tool.cluster_view
30 end
31 if world /= Void then
32 if world.labels_shown then
33 world.hide_labels
34 else
35 world.show_labels
36 end
37 current_button.set_tooltip (tooltip)
38 tool.projector.full_project
39 end
40 end
41
42 new_toolbar_item (display_text: BOOLEAN; use_gray_icons: BOOLEAN): EB_COMMAND_TOGGLE_TOOL_BAR_BUTTON is
43 -- Create a new toolbar button for this command.
44 --
45 -- Call `recycle' on the result when you don't need it anymore otherwise
46 -- it will never be garbage collected.
47 local
48 tt: STRING
49 do
50 -- Add it to the managed toolbar items
51 if managed_toolbar_items = Void then
52 create managed_toolbar_items.make (1)
53 end
54 create Result.make (Current)
55 if display_text and pixmap.count >= 2 then
56 Result.set_pixmap (pixmap @ 2)
57 else
58 Result.set_pixmap (pixmap @ 1)
59 end
60 if is_sensitive then
61 Result.enable_sensitive
62 else
63 Result.disable_sensitive
64 end
65 current_button := Result
66 Result.toggle
67 tt := tooltip.twin
68 if accelerator /= Void then
69 tt.append (Opening_parenthesis)
70 tt.append (accelerator.out)
71 tt.append (Closing_parenthesis)
72 end
73 Result.set_tooltip (tt)
74 Result.select_actions.extend (agent execute)
75 end
76
77 feature {NONE} -- Implementation
78
79 pixmap: ARRAY [EV_PIXMAP] is
80 -- Pixmaps representing the command (one for the
81 -- gray version, one for the color version).
82 do
83 Result := Pixmaps.Icon_display_labels
84 end
85
86 tooltip: STRING is
87 -- Tooltip for the toolbar button.
88 do
89 if current_button.is_selected then
90 Result := Interface_names.f_diagram_hide_labels
91 else
92 Result := Interface_names.f_diagram_show_labels
93 end
94 end
95
96 description: STRING is
97 -- Description for this command.
98 do
99 Result := Interface_names.l_diagram_labels_visibility
100 end
101
102 name: STRING is "Labels_visibility"
103 -- Name of the command. Used to store the command in the
104 -- preferences.
105
106 feature {EB_CONTEXT_EDITOR} -- Implementation
107
108 current_button: EB_COMMAND_TOGGLE_TOOL_BAR_BUTTON
109 -- Current toggle button.
110
111 end -- class EB_TOGGLE_LABELS_COMMAND

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.23