59#define MAX_DIRTY_RECTS 20
73 if (x >= px && y >= py && x <= pxe && y <= pye) {
93 ||
gui()->trade_gen.cities.empty()) {
100 foreach (qgilles,
gui()->trade_gen.lines) {
119 pen.setColor(
pcolor->qcolor);
120 pen.setStyle(Qt::DashLine);
121 pen.setDashOffset(4);
123 painter->setPen(pen);
124 if (x2 - x1 == w && y2 - y1 == h) {
138 foreach (pcity,
gui()->trade_gen.virtual_cities) {
140 if (pcity->
tile !=
nullptr
142 painter->drawPixmap(
static_cast<int>(
canvas_x),
200 QTimer *
timer =
new QTimer(
this);
201 setAttribute(Qt::WA_OpaquePaintEvent,
true);
205 setMouseTracking(
true);
207 setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
218 setCursor(Qt::ArrowCursor);
223 i =
static_cast<int>(ct);
233 if (
gui()->infotab->underMouse()
234 ||
gui()->minimapview_wdg->underMouse()
235 ||
gui()->sidebar_wdg->underMouse()) {
302 int wdth,
int hght,
int recursive_nr)
304 int new_pos_x, new_pos_y;
310 if (pos_y + hght + 4 <
height() && pos_x >
width() / 2) {
311 new_pos_y = pos_y + 5;
312 }
else if (pos_x > 0 && pos_y > 10) {
313 new_pos_x = pos_x - 5;
314 }
else if (pos_y > 0) {
315 new_pos_y = pos_y - 5;
316 }
else if (pos_x + wdth + 4 < this->
width()) {
317 new_pos_x = pos_x + 5;
319 find_place(new_pos_x, new_pos_y, w, h, wdth, hght, recursive_nr);
329 int hght,
int recursive_nr)
333 QList <fcwidget *>widgets = this->findChildren <fcwidget *>();
334 bool cont_searching =
false;
336 if (recursive_nr >= 1000) {
347 for (i = 0; i < widgets.count(); i++) {
348 if (!widgets[i]->isVisible()) {
351 x = widgets[i]->pos().x();
352 y = widgets[i]->pos().y();
354 if (x == 0 && y ==0) {
357 xe = widgets[i]->pos().x() + widgets[i]->width();
358 ye = widgets[i]->pos().y() + widgets[i]->height();
361 cont_searching =
true;
364 cont_searching =
true;
367 cont_searching =
true;
370 cont_searching =
true;
373 cont_searching =
true;
378 if (cont_searching) {
391 setCursor(Qt::SizeAllCursor);
395 setFixedSize(16, 16);
411 if (!
gui()->interface_locked) {
421 if (!
gui()->interface_locked) {
436 setCursor(Qt::SizeFDiagCursor);
458 if (
gui()->interface_locked) {
463 np.setX(qp.x() -
point.x());
464 np.setY(qp.y() -
point.y());
465 np.setX(qMax(np.x(), 32));
466 np.setY(qMax(np.y(), 32));
467 parentWidget()->resize(np.x(), np.y());
477 if (
gui()->interface_locked) {
495 setCursor(Qt::ArrowCursor);
514 if (
gui()->interface_locked) {
517 if (
event->button() == Qt::LeftButton) {
518 parentWidget()->hide();
530 fcw =
reinterpret_cast<fcwidget *
>(parentWidget());
540 setAttribute(Qt::WA_OpaquePaintEvent,
true);
546 setCursor(Qt::CrossCursor);
595 const double gui_xd = gui_x, gui_yd = gui_y;
601 map_x = (gui_xd *
H + gui_yd * W) / (W *
H);
602 map_y = (gui_yd * W - gui_xd *
H) / (W *
H);
610 ntl_x = 2 * map_x - ntl_y;
638 ::gui()->menu_bar->minimap_status->setChecked(
false);
655 event->setAccepted(
true);
664 int src_x, src_y, dst_x, dst_y;
677 painter->setPen(QColor(Qt::white));
680 for (i = 0; i < 4; i++) {
685 for (i = 0; i < 4; i++) {
688 dst_x = x[(i + 1) % 4] *
w_ratio;
689 dst_y = y[(i + 1) % 4] *
h_ratio;
690 painter->drawLine(src_x, src_y, dst_x, dst_y);
726 x = qRound(x / scale_factor);
727 y = qRound(y / scale_factor);
743 *
pix = QPixmap::fromImage(image);
767 QMutexLocker locker(&
mutex);
770 scale = scale_factor;
784 int delta_x, delta_y;
810 bigger_pix.fill(Qt::black);
813 image_copy(&bigger_pix, &tpix, 0, 0, delta_x, delta_y,
815 gpix = bigger_pix.copy(delta_x + x, delta_y + y, wf, hf);
817 Qt::IgnoreAspectRatio, Qt::FastTransformation);
821 Qt::IgnoreAspectRatio, Qt::FastTransformation);
848 ix =
pix->width() - x;
849 iy =
pix->height() - y;
852 painter->drawPixmap(0, 0, *
pix, 0, 0,
pix->width(),
pix->height());
854 painter->drawPixmap(ix, iy, *
pix, 0, 0, x, y);
855 painter->drawPixmap(ix, 0, *
pix, 0, y, x, iy);
856 painter->drawPixmap(0, iy, *
pix, x, 0, ix, y);
857 painter->drawPixmap(0, 0, *
pix, x, y, ix, iy);
859 painter->setPen(QColor(palette().
color(QPalette::Highlight)));
860 painter->drawRect(0, 0,
width() - 1,
height() - 1);
871 size =
event->size();
874 &&
size.height() > 0) {
877 gui()->qt_settings.minimap_width =
static_cast<float>(
size.width())
879 gui()->qt_settings.minimap_height =
static_cast<float>(
size.height())
890 if (
event->angleDelta().y() > 0) {
927 if (
event->button() == Qt::LeftButton) {
928 if (
gui()->interface_locked) {
934 if (
event->button() == Qt::RightButton) {
936 fx =
event->pos().x();
937 fy =
event->pos().y();
952 event->setAccepted(
true);
960 if (
gui()->interface_locked) {
964 if (
event->buttons() & Qt::LeftButton) {
968 r = mapTo(
gui()->mapview_wdg, p);
971 setCursor(Qt::SizeAllCursor);
972 gui()->qt_settings.minimap_x =
static_cast<float>(p.x()) /
mapview.
width;
973 gui()->qt_settings.minimap_y =
static_cast<float>(p.y())
983 setCursor(Qt::CrossCursor);
994 gui()->update_info_label();
1003 QString s, eco_info;
1037 eco_info = QString(
_(
"%1 (+%2)"))
1041 eco_info = QString(
_(
"%1 (%2)"))
1070 if (
gui()->unitinfo_wdg->isVisible()) {
1071 gui()->unitinfo_wdg->update_actions(
nullptr);
1081 gui()->mapview_wdg->update_cursor(new_cursor_type);
1091 gui()->sw_endturn->update_final_pixmap();
1117 gui()->sw_indicators->update_final_pixmap();
1125 gui()->minimapview_wdg->update_image();
1181 gui()->mapview_wdg->height());
1200 gui()->mapview_wdg->update();
1209 gui()->mapview_wdg->update();
1275 if (
gui()->is_repo_dlg_open(
"SCI")) {
1276 i =
gui()->gimme_index_of(
"SCI");
1278 w =
gui()->game_tab_widget->widget(i);
1306 gui()->minimapview_wdg->resize(0, 0);
1307 gui()->minimapview_wdg->move(
gui()->qt_settings.minimap_x
1309 gui()->qt_settings.minimap_y
1311 gui()->minimapview_wdg->resize(
gui()->qt_settings.minimap_width
1313 gui()->qt_settings.minimap_height
1380 w = qMax(w, fm.horizontalAdvance(
str));
1382 setFixedHeight(
str_list.count() * (fm.height() + 5));
1383 setFixedWidth(w + 10);
1390 int pw = parentWidget()->width();
1416 for (
int i = 0; i <
str_list.count(); i++) {
1429 painter.begin(
this);
const char * calendar_text(void)
void image_copy(QImage *dest, QImage *src, int src_x, int src_y, int dest_x, int dest_y, int width, int height)
void pixmap_copy(QPixmap *dest, QPixmap *src, int src_x, int src_y, int dest_x, int dest_y, int width, int height)
struct canvas int int struct sprite int int int int height
struct canvas int int struct sprite bool int int fog_y struct canvas struct sprite struct color * pcolor
struct canvas int int canvas_y
struct canvas int canvas_x
struct canvas int int struct sprite int int int width
void update_sidebar_tooltips()
fc_sidewidget * sw_economy
enum client_pages current_page()
QTimer * update_info_timer
static fc_font * instance()
QFont * get_font(QString name)
QPixmap * get_pixmap(const QString &id)
static fc_icons * instance()
void update_font(const QString &name, const QFont &font)
info_tile(struct tile *ptile, QWidget *parent=0)
void paintEvent(QPaintEvent *event)
void paint(QPainter *painter, QPaintEvent *event)
void leaveEvent(QEvent *event)
void paintEvent(QPaintEvent *event)
void find_place(int pos_x, int pos_y, int &w, int &h, int wdth, int hght, int recursive_nr)
void update_cursor(enum cursor_type)
void update_font(const QString &name, const QFont &font)
void resume_searching(int pos_x, int pos_y, int &w, int &h, int wdth, int hght, int recursive_nr)
void paint(QPainter *painter, QPaintEvent *event)
void focusOutEvent(QFocusEvent *event)
void rendered_image(const QImage &image)
minimap_thread(QObject *parent=0)
void render(double scale_factor, int width, int height)
void run() Q_DECL_OVERRIDE
void update_pixmap(const QImage &image)
void paintEvent(QPaintEvent *event)
void mouseMoveEvent(QMouseEvent *event)
void paint(QPainter *painter, QPaintEvent *event)
void showEvent(QShowEvent *event)
void mouseReleaseEvent(QMouseEvent *event)
void resizeEvent(QResizeEvent *event)
minimap_view(QWidget *parent)
void mousePressEvent(QMouseEvent *event)
void scale_point(int &x, int &y)
void wheelEvent(QWheelEvent *event)
virtual void update_menu()
void moveEvent(QMoveEvent *event)
void draw_viewport(QPainter *painter)
void scale(double factor)
QQueue< call_me_back * > callback_list
void add_callback(call_me_back *cb)
bool can_client_control(void)
enum client_states client_state(void)
struct sprite * client_warming_sprite(void)
struct sprite * client_cooling_sprite(void)
struct sprite * client_research_sprite(void)
struct sprite * client_government_sprite(void)
struct color * get_color(const struct tileset *t, enum color_std stdcolor)
struct unit_list * get_units_in_focus(void)
struct unit * head_of_units_in_focus(void)
bool get_turn_done_button_state()
GdkCursor * fc_cursors[CURSOR_LAST][NUM_CURSOR_FRAMES]
void set_indicator_icons(struct sprite *bulb, struct sprite *sol, struct sprite *flake, struct sprite *gov)
#define mevent_gpos(__ev__)
void unscale_point(double scale_factor, int &x, int &y)
bool is_point_in_area(int x, int y, int px, int py, int pxe, int pye)
void draw_calculated_trade_routes(QPainter *painter)
#define fc_assert(condition)
struct tile * map_pos_to_tile(const struct civ_map *nmap, int map_x, int map_y)
void base_map_distance_vector(int *dx, int *dy, int x0dv, int y0dv, int x1dv, int y1dv)
#define current_topo_has_flag(flag)
void update_info_label(void)
void update_turn_done_button(bool do_restore)
void tileset_changed(void)
void put_cross_overlay_tile(struct tile *ptile)
void draw_selection_rectangle(int canvas_x, int canvas_y, int w, int h)
static void flush_mapcanvas(int canvas_x, int canvas_y, int pixel_width, int pixel_height)
void update_map_canvas_scrollbars_size(void)
void get_overview_area_dimensions(int *width, int *height)
void mapview_freeze(void)
int last_center_player_city
void update_overview_scroll_window_pos(int x, int y)
void update_city_descriptions(void)
void unscale_point(double scale_factor, int &x, int &y)
void pixmap_put_overlay_tile(int canvas_x, int canvas_y, struct sprite *ssprite)
void qtg_update_timeout_label(void)
void update_map_canvas_scrollbars(void)
bool mapview_is_frozen(void)
int last_center_enemy_city
void overview_size_changed(void)
void qtg_map_canvas_size_refresh(void)
bool is_point_in_area(int x, int y, int px, int py, int pxe, int pye)
void draw_calculated_trade_routes(QPainter *painter)
void update_unit_info_label(struct unit_list *punitlist)
static int mapview_frozen_level
struct canvas * get_overview_window(void)
static int num_dirty_rects
const char * get_timeout_label_text()
static QRect dirty_rects[MAX_DIRTY_RECTS]
void update_mouse_cursor(enum cursor_type new_cursor_type)
void set_indicator_icons(struct sprite *bulb, struct sprite *sol, struct sprite *flake, struct sprite *gov)
void destroy_city_dialog()
static void gui_to_overview(int *ovr_x, int *ovr_y, int gui_x, int gui_y)
void update_map_canvas_visible(void)
void map_to_gui_vector(const struct tileset *t, float zoom, float *gui_dx, float *gui_dy, int map_dx, int map_dy)
void center_tile_mapcanvas(const struct tile *ptile)
bool tile_to_canvas_pos(float *canvas_x, float *canvas_y, float zoom, const struct tile *ptile)
const char *const city_productions
const char *const notify_label
const char *const city_names
struct client_options gui_options
void overview_to_map_pos(int *map_x, int *map_y, int overview_x, int overview_y)
int player_get_expected_income(const struct player *pplayer)
#define FC_WRAP(value, range)
void(* callback)(void *data)
struct packet_game_info info
bool draw_city_trade_routes
struct player_economic economic
struct unit * autocaravan
const char * popup_info_text(struct tile *ptile)
struct city * tile_city(const struct tile *ptile)
struct sprite * get_attention_crosshair_sprite(const struct tileset *t)
bool tileset_is_isometric(const struct tileset *t)
int tileset_tile_height(const struct tileset *t)
int tileset_tile_width(const struct tileset *t)
#define NUM_CURSOR_FRAMES
bool have_cities_trade_route(const struct city *pc1, const struct city *pc2)