Freeciv-3.1
Loading...
Searching...
No Matches
Data Structures | Functions | Variables
mapctrl.c File Reference
#include <gtk/gtk.h>
#include "fcintl.h"
#include "support.h"
#include "combat.h"
#include "game.h"
#include "map.h"
#include "player.h"
#include "unit.h"
#include "overview_common.h"
#include "client_main.h"
#include "climap.h"
#include "climisc.h"
#include "control.h"
#include "editor.h"
#include "tilespec.h"
#include "text.h"
#include "zoom.h"
#include "cma_core.h"
#include "chatline.h"
#include "citydlg.h"
#include "colors.h"
#include "dialogs.h"
#include "editgui.h"
#include "graphics.h"
#include "gui_main.h"
#include "infradlg.h"
#include "inputdlg.h"
#include "mapview.h"
#include "menu.h"
#include "rallypointdlg.h"
#include "mapctrl.h"

Go to the source code of this file.

Data Structures

struct  tmousepos
 

Functions

static gboolean popit_button_release (GtkWidget *w, GdkEventButton *ev)
 
static void popupinfo_positioning_callback (GtkWidget *w, GtkAllocation *alloc, gpointer data)
 
static void popit (GdkEventButton *ev, struct tile *ptile)
 
void popupinfo_popdown_callback (GtkWidget *w, gpointer data)
 
static void name_new_city_popup_callback (gpointer data, gint response, const char *input)
 
void popup_newcity_dialog (struct unit *punit, const char *suggestname)
 
void set_turn_done_button_state (bool state)
 
gboolean butt_release_mapcanvas (GtkWidget *w, GdkEventButton *ev, gpointer data)
 
gboolean butt_down_mapcanvas (GtkWidget *w, GdkEventButton *ev, gpointer data)
 
void create_line_at_mouse_pos (void)
 
void update_rect_at_mouse_pos (void)
 
gboolean move_mapcanvas (GtkWidget *w, GdkEventMotion *ev, gpointer data)
 
gboolean leave_mapcanvas (GtkWidget *widget, GdkEventCrossing *event)
 
gboolean move_overviewcanvas (GtkWidget *w, GdkEventMotion *ev, gpointer data)
 
gboolean butt_down_overviewcanvas (GtkWidget *w, GdkEventButton *ev, gpointer data)
 
void center_on_unit (void)
 

Variables

gint cur_x
 
gint cur_y
 

Function Documentation

◆ butt_down_mapcanvas()

gboolean butt_down_mapcanvas ( GtkWidget *  w,
GdkEventButton *  ev,
gpointer  data 
)

Handle all mouse button press on canvas. Future feature: User-configurable mouse clicks.

Definition at line 242 of file mapctrl.c.

◆ butt_down_overviewcanvas()

gboolean butt_down_overviewcanvas ( GtkWidget *  w,
GdkEventButton *  ev,
gpointer  data 
)

Button pressed at overview

Definition at line 473 of file mapctrl.c.

◆ butt_release_mapcanvas()

gboolean butt_release_mapcanvas ( GtkWidget *  w,
GdkEventButton *  ev,
gpointer  data 
)

Handle 'Mouse button released'. Because of the quickselect feature, the release of both left and right mousebutton can launch the goto.

Definition at line 221 of file mapctrl.c.

◆ center_on_unit()

void center_on_unit ( void  )

Best effort to center the map on the currently selected unit(s)

Definition at line 496 of file mapctrl.c.

◆ create_line_at_mouse_pos()

void create_line_at_mouse_pos ( void  )

Update goto line so that destination is at current mouse pointer location.

Definition at line 355 of file mapctrl.c.

◆ leave_mapcanvas()

gboolean leave_mapcanvas ( GtkWidget *  widget,
GdkEventCrossing *  event 
)

This function will reset the mouse cursor if it leaves the map.

Definition at line 435 of file mapctrl.c.

◆ move_mapcanvas()

gboolean move_mapcanvas ( GtkWidget *  w,
GdkEventMotion *  ev,
gpointer  data 
)

Triggered by the mouse moving on the mapcanvas, this function will update the mouse cursor and goto lines.

Definition at line 406 of file mapctrl.c.

◆ move_overviewcanvas()

gboolean move_overviewcanvas ( GtkWidget *  w,
GdkEventMotion *  ev,
gpointer  data 
)

Overview canvas moved

Definition at line 463 of file mapctrl.c.

◆ name_new_city_popup_callback()

static void name_new_city_popup_callback ( gpointer  data,
gint  response,
const char *  input 
)
static

Callback from city name dialog for new city.

Definition at line 176 of file mapctrl.c.

◆ popit()

static void popit ( GdkEventButton *  ev,
struct tile ptile 
)
static

Popup a label with information about the tile, unit, city, when the user used the middle mouse button on the map.

Definition at line 121 of file mapctrl.c.

◆ popit_button_release()

static gboolean popit_button_release ( GtkWidget *  w,
GdkEventButton *  ev 
)
static

Button released when showing info label

Definition at line 68 of file mapctrl.c.

◆ popup_newcity_dialog()

void popup_newcity_dialog ( struct unit punit,
const char *  suggestname 
)

Popup dialog where the user choose the name of the new city punit = (settler) unit which builds the city suggestname = suggestion of the new city's name

Definition at line 197 of file mapctrl.c.

◆ popupinfo_popdown_callback()

void popupinfo_popdown_callback ( GtkWidget *  w,
gpointer  data 
)

Information label destruction requested

Definition at line 167 of file mapctrl.c.

◆ popupinfo_positioning_callback()

static void popupinfo_positioning_callback ( GtkWidget *  w,
GtkAllocation *  alloc,
gpointer  data 
)
static

Put the popup on a smart position, after the real size of the widget is known: left of the cursor if within the right half of the map, and vice versa; displace the popup so as not to obscure it by the mouse cursor; stay always within the map if possible.

Definition at line 83 of file mapctrl.c.

◆ set_turn_done_button_state()

void set_turn_done_button_state ( bool  state)

Enable or disable the turn done button. Should probably some where else.

Definition at line 210 of file mapctrl.c.

◆ update_rect_at_mouse_pos()

void update_rect_at_mouse_pos ( void  )

The Area Selection rectangle. Called by center_tile_mapcanvas() and when the mouse pointer moves.

Definition at line 380 of file mapctrl.c.

Variable Documentation

◆ cur_x

gint cur_x
extern

Definition at line 183 of file gui_main.c.

◆ cur_y

gint cur_y

Definition at line 63 of file mapctrl.c.