49 |
ID_POPUP_PROPS = 4506 |
ID_POPUP_PROPS = 4506 |
50 |
ID_POPUP_VISIBLE = 4507 |
ID_POPUP_VISIBLE = 4507 |
51 |
ID_POPUP_PROJ = 4509 |
ID_POPUP_PROJ = 4509 |
52 |
|
ID_POPUP_REMOVE = 4510 |
53 |
|
ID_POPUP_SHOWTABLE = 4511 |
54 |
|
|
55 |
BMP_SIZE_W = 15 |
BMP_SIZE_W = 15 |
56 |
BMP_SIZE_H = 15 |
BMP_SIZE_H = 15 |
125 |
EVT_MENU(self, ID_POPUP_BOTTOM, self._OnMoveBottom) |
EVT_MENU(self, ID_POPUP_BOTTOM, self._OnMoveBottom) |
126 |
EVT_MENU(self, ID_POPUP_VISIBLE, self._OnToggleVisibility) |
EVT_MENU(self, ID_POPUP_VISIBLE, self._OnToggleVisibility) |
127 |
EVT_MENU(self, ID_POPUP_PROJ, self._OnProjection) |
EVT_MENU(self, ID_POPUP_PROJ, self._OnProjection) |
128 |
|
EVT_MENU(self, ID_POPUP_REMOVE, self._OnRemoveLayer) |
129 |
|
EVT_MENU(self, ID_POPUP_SHOWTABLE, self._OnShowTable) |
130 |
|
|
131 |
self.tree = LegendTree(self, ID_LEGEND_TREE, map, mainWindow) |
self.tree = LegendTree(self, ID_LEGEND_TREE, map, mainWindow) |
132 |
|
|
208 |
def _OnProjection(self, event): |
def _OnProjection(self, event): |
209 |
self.tree.LayerProjection() |
self.tree.LayerProjection() |
210 |
|
|
211 |
|
def _OnRemoveLayer(self, event): |
212 |
|
self.mainWindow.RemoveLayer() |
213 |
|
|
214 |
|
def _OnShowTable(self, event): |
215 |
|
self.mainWindow.LayerShowTable() |
216 |
|
|
217 |
def __EnableButtons(self, on): |
def __EnableButtons(self, on): |
218 |
self.toolBar.EnableTool(ID_LEGEND_TOP, on) |
self.toolBar.EnableTool(ID_LEGEND_TOP, on) |
219 |
self.toolBar.EnableTool(ID_LEGEND_RAISE, on) |
self.toolBar.EnableTool(ID_LEGEND_RAISE, on) |
268 |
|
|
269 |
self.SetMap(map) |
self.SetMap(map) |
270 |
|
|
271 |
|
def _OnRightClick(self, event): |
272 |
|
"""Select item and pop up a context menu""" |
273 |
|
|
274 |
|
# The pop up menu is related to the legend tree, so we have direct |
275 |
|
# access on the tree items. The events issued by the menu are handled |
276 |
|
# by the legend panel, since most of the handlers are already |
277 |
|
# implemented there. |
278 |
|
|
279 |
|
# Update item selection to the right click |
280 |
|
item = event.GetItem() |
281 |
|
self.SelectItem(item) |
282 |
|
|
283 |
|
# Create the menu |
284 |
|
menu = wxMenu("", 0) |
285 |
|
|
286 |
|
# The "Visible" item is a special ... |
287 |
|
menuitem = wxMenuItem(menu, ID_POPUP_VISIBLE, _("Visible"), |
288 |
|
"", wxITEM_CHECK) |
289 |
|
menu.AppendItem(menuitem) |
290 |
|
layer, group = self.GetSelectedHierarchy() |
291 |
|
menuitem.Check(layer.Visible()) |
292 |
|
|
293 |
|
menu.AppendSeparator() |
294 |
|
menu.Append(ID_POPUP_PROPS, _("&Properties...")) |
295 |
|
menu.Append(ID_POPUP_PROJ, _("Pro&jection...")) |
296 |
|
menu.Append(ID_POPUP_REMOVE, _("&Remove Layer")) |
297 |
|
menu.Append(ID_POPUP_SHOWTABLE, _("Show Ta&ble")) |
298 |
|
menu.AppendSeparator() |
299 |
|
menu.Append(ID_POPUP_TOP, _("Top Layer")) |
300 |
|
menu.Append(ID_POPUP_UP, _("Raise Layer")) |
301 |
|
menu.Append(ID_POPUP_DOWN, _("Lower Layer")) |
302 |
|
menu.Append(ID_POPUP_BOTTOM, _("Bottom Layer")) |
303 |
|
|
304 |
|
# Display the menu |
305 |
|
pos = event.GetPoint() |
306 |
|
shift = self.ClientToScreen((0,0)) |
307 |
|
self.PopupMenu(menu, pos) |
308 |
|
|
309 |
def find_layer(self, layer): |
def find_layer(self, layer): |
310 |
"""Return the tree item for the layer""" |
"""Return the tree item for the layer""" |
311 |
root = self.GetRootItem() |
root = self.GetRootItem() |
473 |
event.Veto() |
event.Veto() |
474 |
self.preventExpandCollapse = False |
self.preventExpandCollapse = False |
475 |
|
|
|
def _OnRightClick(self, event): |
|
|
"""Select item and pop up a context menu""" |
|
|
|
|
|
# The pop up menu is related to the legend tree, so we have direct |
|
|
# access on the tree items. The events issued by the menu are handled |
|
|
# by the legend panel, since most of the handlers are already |
|
|
# implemented there. |
|
|
|
|
|
# Update item selection to the right click |
|
|
item = event.GetItem() |
|
|
self.SelectItem(item) |
|
|
|
|
|
# Create the menu |
|
|
menu = wxMenu("", 0) |
|
|
|
|
|
# The "Visible" item is a special ... |
|
|
menuitem = wxMenuItem(menu, ID_POPUP_VISIBLE, _("Visible"), |
|
|
"", wxITEM_CHECK) |
|
|
menu.AppendItem(menuitem) |
|
|
layer, group = self.GetSelectedHierarchy() |
|
|
menuitem.Check(layer.Visible()) |
|
|
|
|
|
menu.AppendSeparator() |
|
|
menu.Append(ID_POPUP_PROPS, _("Properties")) |
|
|
menu.Append(ID_POPUP_PROJ, _("Projection")) |
|
|
menu.AppendSeparator() |
|
|
menu.Append(ID_POPUP_TOP, _("Top")) |
|
|
menu.Append(ID_POPUP_UP, _("Up")) |
|
|
menu.Append(ID_POPUP_DOWN, _("Down")) |
|
|
menu.Append(ID_POPUP_BOTTOM, _("Bottom")) |
|
|
|
|
|
# Display the menu |
|
|
pos = event.GetPoint() |
|
|
shift = self.ClientToScreen((0,0)) |
|
|
self.PopupMenu(menu, pos) |
|
|
|
|
476 |
def _OnItemActivated(self, event): |
def _OnItemActivated(self, event): |
477 |
# The following looks strange but is need under Windows to |
# The following looks strange but is need under Windows to |
478 |
# raise the Properties on double-click: The tree control |
# raise the Properties on double-click: The tree control |