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 "inputdlg.h"
#include "mapview.h"
#include "menu.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 *event)
 
static void popupinfo_positioning_callback (GtkWidget *w, GtkAllocation *alloc, gpointer data)
 
static void popit (GdkEventButton *event, 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 237 of file mapctrl.c.

Referenced by setup_widgets().

◆ butt_down_overviewcanvas()

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

Button pressed at overview

Definition at line 467 of file mapctrl.c.

Referenced by setup_widgets().

◆ 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 216 of file mapctrl.c.

Referenced by setup_widgets().

◆ center_on_unit()

void center_on_unit ( void  )

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

Definition at line 490 of file mapctrl.c.

Referenced by center_view_callback(), and center_view_callback().

◆ 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 347 of file mapctrl.c.

Referenced by base_set_mapview_origin(), request_unit_connect(), request_unit_goto(), request_unit_patrol(), and mr_menu::slot_delayed_goto().

◆ leave_mapcanvas()

gboolean leave_mapcanvas ( GtkWidget *  widget,
GdkEventCrossing *  event 
)

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

Definition at line 429 of file mapctrl.c.

Referenced by setup_widgets().

◆ 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 400 of file mapctrl.c.

Referenced by setup_widgets().

◆ move_overviewcanvas()

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

Overview canvas moved

Definition at line 458 of file mapctrl.c.

Referenced by setup_widgets().

◆ 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 173 of file mapctrl.c.

Referenced by popup_newcity_dialog().

◆ popit()

static void popit ( GdkEventButton *  event,
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 118 of file mapctrl.c.

Referenced by butt_down_mapcanvas(), left_butt_down_mapcanvas(), and middle_butt_down_mapcanvas().

◆ popit_button_release()

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

Button released when showing info label

Definition at line 66 of file mapctrl.c.

Referenced by popit(), and popit().

◆ 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 194 of file mapctrl.c.

Referenced by handle_city_name_suggestion_info().

◆ popupinfo_popdown_callback()

void popupinfo_popdown_callback ( GtkWidget *  w,
gpointer  data 
)

Information label destruction requested

Definition at line 164 of file mapctrl.c.

Referenced by popit(), popit(), and popit().

◆ 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 80 of file mapctrl.c.

Referenced by popit(), and popit().

◆ 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 207 of file mapctrl.c.

Referenced by update_turn_done_button_state().

◆ 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 373 of file mapctrl.c.

Referenced by base_set_mapview_origin().

Variable Documentation

◆ cur_x

gint cur_x
extern

Definition at line 183 of file gui_main.c.

Referenced by move_mapcanvas(), and move_mapcanvas().

◆ cur_y

gint cur_y

Definition at line 61 of file mapctrl.c.

Referenced by move_mapcanvas(), and move_mapcanvas().