00001
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
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
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
00060 FXIMPLEMENT(GUIGLObjectPopupMenu, FXMenuPane, GUIGLObjectPopupMenuMap, ARRAYNUMBER(GUIGLObjectPopupMenuMap))
00061
00062
00063
00064
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);
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