00001 00002 /*************************************************************************** 00003 * * 00004 * This program is free software; you can redistribute it and/or modify * 00005 * it under the terms of the GNU General Public License as published by * 00006 * the Free Software Foundation; either version 2 of the License, or * 00007 * (at your option) any later version. * 00008 * * 00009 ***************************************************************************/ 00010 00011 #include "targetcoordinatelocator.h" 00012 #include "../dialogs/fieldmarker.h" 00013 #include "../spfst.h" 00014 #include "../spfst-legacy.h" 00015 #include "../mainscreenwidget.h" 00016 #include "../mapdisplay.h" 00017 #include "../iconrepository.h" 00018 00019 00020 00021 SDL_Surface* TargetCoordinateLocator :: getImage() 00022 { 00023 return IconRepository::getIcon("target.png").getBaseSurface(); 00024 }; 00025 bool TargetCoordinateLocator :: eventMouseButtonDown (const SDL_MouseButtonEvent *button) 00026 { 00027 if ( button->button == 3 ) { 00028 SelectFromMap sfm( positions, actmap, false, true); 00029 sfm.Show(); 00030 sfm.RunModal(); 00031 } 00032 if ( button->button == 1 ) { 00033 MapDisplayPG* md = getMainScreenWidget()->getMapDisplay(); 00034 md->cursor.goTo( *positions.begin() ); 00035 actmap->getCursor() = *positions.begin(); 00036 cursorMoved(); 00037 } 00038 00039 return true; 00040 } 00041 00042 TargetCoordinateLocator::TargetCoordinateLocator(PG_Widget* parent, const PG_Point& pos, const SelectFromMap::CoordinateList& coordinates ) : PG_Image( parent, pos, getImage(), false ) 00043 { 00044 positions = coordinates; 00045 } 00046
1.5.1