From 5c638080c416cdfbaa8486ede5c4347150404569 Mon Sep 17 00:00:00 2001 From: kazer_ Date: Fri, 26 Oct 2007 16:34:26 +0000 Subject: [PATCH] Added a button to switch from navit to nghost git-svn-id: https://navit.svn.sourceforge.net/svnroot/navit/trunk@477 ffa7fe5e-494d-0410-b361-a75ebd5db220 --- navit/src/gui/sdl/Makefile.am | 2 +- navit/src/gui/sdl/datafiles/layouts/TaharezLook.layout | 8 +++++++- navit/src/gui/sdl/gui_sdl_window.cpp | 2 ++ navit/src/gui/sdl/sdl_events.cpp | 13 +++++++++++++ navit/src/gui/sdl/sdl_events.h | 1 + 5 files changed, 24 insertions(+), 2 deletions(-) diff --git a/navit/src/gui/sdl/Makefile.am b/navit/src/gui/sdl/Makefile.am index 9d18064..6c5cb2b 100644 --- a/navit/src/gui/sdl/Makefile.am +++ b/navit/src/gui/sdl/Makefile.am @@ -2,5 +2,5 @@ include $(top_srcdir)/Makefile.inc SUBDIRS=datafiles AM_CPPFLAGS = @NAVIT_CFLAGS@ @CEGUI_CFLAGS@ @GLC_CFLAGS@ -I$(top_srcdir)/src -DMODULE=\"gui_sdl\" modulegui_LTLIBRARIES = libgui_sdl.la -libgui_sdl_la_SOURCES = gui_sdl_window.cpp sdl_events.cpp gui_sdl.h sdl_events.h +libgui_sdl_la_SOURCES = gui_sdl_window.cpp sdl_events.cpp gui_sdl.h sdl_events.h wmcontrol.c wmcontrol.h libgui_sdl_la_LIBADD = @SDL_LIBS@ @CEGUI_LIBS@ @OPENGL_LIBS@ @GLC_LIBS@ diff --git a/navit/src/gui/sdl/datafiles/layouts/TaharezLook.layout b/navit/src/gui/sdl/datafiles/layouts/TaharezLook.layout index 4f6dc84..dcbdb37 100755 --- a/navit/src/gui/sdl/datafiles/layouts/TaharezLook.layout +++ b/navit/src/gui/sdl/datafiles/layouts/TaharezLook.layout @@ -133,6 +133,12 @@ + + + + + + @@ -141,7 +147,7 @@ - + diff --git a/navit/src/gui/sdl/gui_sdl_window.cpp b/navit/src/gui/sdl/gui_sdl_window.cpp index 9b28a91..cf98f96 100644 --- a/navit/src/gui/sdl/gui_sdl_window.cpp +++ b/navit/src/gui/sdl/gui_sdl_window.cpp @@ -27,6 +27,7 @@ #include "GL/glc.h" #include "sdl_events.h" +#include "wmcontrol.h" #define VM_2D 0 #define VM_3D 1 @@ -663,6 +664,7 @@ static void init_sdlgui(char * skin_layout,int fullscreen) CEGUI::WindowManager::getSingleton().getWindow("OSD/RoadbookButton")->subscribeEvent(PushButton::EventClicked, Event::Subscriber(RoadBookSwitch)); CEGUI::WindowManager::getSingleton().getWindow("OSD/RoadbookButton")->setText(_("RoadBook")); + CEGUI::WindowManager::getSingleton().getWindow("OSD/nGhostButton")->subscribeEvent(PushButton::EventClicked, Event::Subscriber(Switch_to_nGhost)); // this one is maybe not needed anymore CEGUI::WindowManager::getSingleton().getWindow("OSD/RoadbookButton2")->subscribeEvent(PushButton::EventClicked, Event::Subscriber(RoadBookSwitch)); diff --git a/navit/src/gui/sdl/sdl_events.cpp b/navit/src/gui/sdl/sdl_events.cpp index 4efd50b..ca7f3ad 100644 --- a/navit/src/gui/sdl/sdl_events.cpp +++ b/navit/src/gui/sdl/sdl_events.cpp @@ -13,6 +13,8 @@ // Theses are needed for searches #include "search.h" +// Library for window switching (-> nGhost) +#include "wmcontrol.h" struct sdl_destination{ @@ -422,6 +424,17 @@ bool DialogWindowSwitch(const CEGUI::EventArgs& event) return true; } +bool Switch_to_nGhost(const CEGUI::EventArgs& event) +{ + printf("Switching to nGhost\n"); + if (window_switch("Nanonymous")==EXIT_FAILURE) + { + popen("nghost","r"); + } + +} + + bool RoadBookSwitch(const CEGUI::EventArgs& event) { using namespace CEGUI; diff --git a/navit/src/gui/sdl/sdl_events.h b/navit/src/gui/sdl/sdl_events.h index 1f475f0..6d3c93c 100644 --- a/navit/src/gui/sdl/sdl_events.h +++ b/navit/src/gui/sdl/sdl_events.h @@ -15,6 +15,7 @@ void handle_destination_change(); bool DestinationEntryChange(const CEGUI::EventArgs& event); bool DialogWindowSwitch(const CEGUI::EventArgs& event); +bool Switch_to_nGhost(const CEGUI::EventArgs& event); bool RoadBookSwitch(const CEGUI::EventArgs& event); bool ButtonGo(const CEGUI::EventArgs& event); bool ZoomIn(const CEGUI::EventArgs& event); -- 2.7.4