GUIGLObjectPopupMenu.cpp

Go to the documentation of this file.
00001 /****************************************************************************/
00007 // The popup menu of a globject
00008 /****************************************************************************/
00009 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
00010 // Copyright 2001-2010 DLR (http://www.dlr.de/) and contributors
00011 /****************************************************************************/
00012 //
00013 //   This program is free software; you can redistribute it and/or modify
00014 //   it under the terms of the GNU General Public License as published by
00015 //   the Free Software Foundation; either version 2 of the License, or
00016 //   (at your option) any later version.
00017 //
00018 /****************************************************************************/
00019 
00020 
00021 // ===========================================================================
00022 // included modules
00023 // ===========================================================================
00024 #ifdef _MSC_VER
00025 #include <windows_config.h>
00026 #else
00027 #include <config.h>
00028 #endif
00029 
00030 #include <iostream>
00031 #include <cassert>
00032 #include <utils/gui/windows/GUISUMOAbstractView.h>
00033 #include <utils/gui/globjects/GUIGlObject.h>
00034 #include <utils/gui/windows/GUIAppEnum.h>
00035 #include "GUIGLObjectPopupMenu.h"
00036 #include <utils/gui/div/GUIParameterTableWindow.h>
00037 #include <utils/gui/div/GUIGlobalSelection.h>
00038 #include <utils/gui/div/GUIUserIO.h>
00039 #include <utils/common/ToString.h>
00040 
00041 #ifdef CHECK_MEMORY_LEAKS
00042 #include <foreign/nvwa/debug_new.h>
00043 #endif // CHECK_MEMORY_LEAKS
00044 
00045 
00046 // ===========================================================================
00047 // FOX callback mapping
00048 // ===========================================================================
00049 FXDEFMAP(GUIGLObjectPopupMenu) GUIGLObjectPopupMenuMap[]= {
00050     FXMAPFUNC(SEL_COMMAND,  MID_CENTER,         GUIGLObjectPopupMenu::onCmdCenter),
00051     FXMAPFUNC(SEL_COMMAND,  MID_COPY_NAME,      GUIGLObjectPopupMenu::onCmdCopyName),
00052     FXMAPFUNC(SEL_COMMAND,  MID_COPY_TYPED_NAME, GUIGLObjectPopupMenu::onCmdCopyTypedName),
00053     FXMAPFUNC(SEL_COMMAND,  MID_COPY_CURSOR_POSITION, GUIGLObjectPopupMenu::onCmdCopyCursorPosition),
00054     FXMAPFUNC(SEL_COMMAND,  MID_SHOWPARS,       GUIGLObjectPopupMenu::onCmdShowPars),
00055     FXMAPFUNC(SEL_COMMAND,  MID_ADDSELECT,      GUIGLObjectPopupMenu::onCmdAddSelected),
00056     FXMAPFUNC(SEL_COMMAND,  MID_REMOVESELECT,   GUIGLObjectPopupMenu::onCmdRemoveSelected)
00057 };
00058 
00059 // Object implementation
00060 FXIMPLEMENT(GUIGLObjectPopupMenu, FXMenuPane, GUIGLObjectPopupMenuMap, ARRAYNUMBER(GUIGLObjectPopupMenuMap))
00061 
00062 
00063 // ===========================================================================
00064 // method definitions
00065 // ===========================================================================
00066 GUIGLObjectPopupMenu::GUIGLObjectPopupMenu(GUIMainWindow &app,
00067         GUISUMOAbstractView &parent,
00068         GUIGlObject &o) throw()
00069         : FXMenuPane(&parent), myParent(&parent), myObject(&o),
00070         myApplication(&app), myNetworkPosition(parent.getPositionInformation()) {
00071 }
00072 
00073 
00074 GUIGLObjectPopupMenu::~GUIGLObjectPopupMenu() throw() {}
00075 
00076 
00077 long
00078 GUIGLObjectPopupMenu::onCmdCenter(FXObject*,FXSelector,void*) {
00079     myParent->centerTo(myObject);
00080     return 1;
00081 }
00082 
00083 
00084 long
00085 GUIGLObjectPopupMenu::onCmdCopyName(FXObject*,FXSelector,void*) {
00086     GUIUserIO::copyToClipboard(*myParent->getApp(), myObject->getMicrosimID());
00087     return 1;
00088 }
00089 
00090 
00091 long
00092 GUIGLObjectPopupMenu::onCmdCopyTypedName(FXObject*,FXSelector,void*) {
00093     GUIUserIO::copyToClipboard(*myParent->getApp(), myObject->getFullName());
00094     return 1;
00095 }
00096 
00097 
00098 long
00099 GUIGLObjectPopupMenu::onCmdCopyCursorPosition(FXObject*,FXSelector,void*) {
00100     GUIUserIO::copyToClipboard(*myParent->getApp(), toString(myNetworkPosition));
00101     return 1;
00102 }
00103 
00104 
00105 long
00106 GUIGLObjectPopupMenu::onCmdShowPars(FXObject*,FXSelector,void*) {
00107     myObject->getParameterWindow(*myApplication, *myParent); // !!! showParameterWindow would be more appropriate
00108     return 1;
00109 }
00110 
00111 
00112 long
00113 GUIGLObjectPopupMenu::onCmdAddSelected(FXObject*,FXSelector,void*) {
00114     gSelected.select(myObject->getType(), myObject->getGlID());
00115     myParent->update();
00116     return 1;
00117 }
00118 
00119 
00120 long
00121 GUIGLObjectPopupMenu::onCmdRemoveSelected(FXObject*,FXSelector,void*) {
00122     gSelected.deselect(myObject->getType(), myObject->getGlID());
00123     myParent->update();
00124     return 1;
00125 }
00126 
00127 
00128 /****************************************************************************/
00129 

Generated on Wed May 5 00:06:29 2010 for Sumo - Simulation of Urban MObility by  doxygen 1.5.6