From e94f9133ed8f4569c30ea0167310b090fd663bcc Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Fri, 10 Mar 2023 04:37:59 +0200 Subject: [PATCH 11/15] repodlgs_g.h: Move 'extern "C"' funcion declarations out They are not part of gui API. See osdn #45314 Signed-off-by: Marko Lindqvist --- client/gui-gtk-3.22/citydlg.c | 2 +- client/gui-gtk-4.0/citydlg.c | 2 +- client/gui-qt/fc_client.cpp | 3 +- client/gui-qt/gui_main.cpp | 5 +-- client/gui-qt/menu.cpp | 2 +- client/gui-qt/pages.cpp | 2 +- client/gui-qt/qtg_cxxside.cpp | 11 +++++++ client/gui-qt/qtg_cxxside.h | 8 +++++ client/gui-qt/repodlgs.cpp | 14 ++++----- client/gui-qt/repodlgs.h | 5 +-- client/gui-stub/repodlgs.c | 18 +++++------ client/gui_interface.c | 57 +++++++++++++++++++++++++++++++++++ client/gui_interface.h | 9 ++++++ client/include/repodlgs_g.h | 9 ++---- client/update_queue.h | 4 +++ common/generate_packets.py | 4 +++ 16 files changed, 117 insertions(+), 38 deletions(-) diff --git a/client/gui-gtk-3.22/citydlg.c b/client/gui-gtk-3.22/citydlg.c index 6827296cbc..f6e17cf2d8 100644 --- a/client/gui-gtk-3.22/citydlg.c +++ b/client/gui-gtk-3.22/citydlg.c @@ -65,7 +65,7 @@ #include "helpdlg.h" #include "inputdlg.h" #include "mapview.h" -#include "repodlgs.h" +#include "update_queue.h" #include "wldlg.h" #include "citydlg.h" diff --git a/client/gui-gtk-4.0/citydlg.c b/client/gui-gtk-4.0/citydlg.c index 9d8ec1d011..026ece83d2 100644 --- a/client/gui-gtk-4.0/citydlg.c +++ b/client/gui-gtk-4.0/citydlg.c @@ -65,7 +65,7 @@ #include "helpdlg.h" #include "inputdlg.h" #include "mapview.h" -#include "repodlgs.h" +#include "update_queue.h" #include "wldlg.h" #include "citydlg.h" diff --git a/client/gui-qt/fc_client.cpp b/client/gui-qt/fc_client.cpp index afb7681e4e..db0d5a29f1 100644 --- a/client/gui-qt/fc_client.cpp +++ b/client/gui-qt/fc_client.cpp @@ -58,7 +58,6 @@ fc_icons* fc_icons::m_instance = 0; fc_font* fc_font::m_instance = 0; extern "C" { bool get_turn_done_button_state(); - void real_science_report_dialog_update(void*); } extern void write_shortcuts(); @@ -379,7 +378,7 @@ void fc_client::switch_page(int new_pg) minimapview_wdg->reset(); overview_size_changed(); update_sidebar_tooltips(); - real_science_report_dialog_update(nullptr); + qtg_real_science_report_dialog_update(nullptr); show_new_turn_info(); break; case PAGE_SCENARIO: diff --git a/client/gui-qt/gui_main.cpp b/client/gui-qt/gui_main.cpp index 20ebcba1f5..e588dbfebd 100644 --- a/client/gui-qt/gui_main.cpp +++ b/client/gui-qt/gui_main.cpp @@ -58,9 +58,6 @@ #include "hudwidget.h" #include "qtg_cxxside.h" -extern "C" { - void real_science_report_dialog_update(void*); -} extern void restart_notify_dialogs(); extern void city_font_update(); @@ -432,7 +429,7 @@ static void apply_font(struct option *poption) update_city_descriptions(); gui()->infotab->chtwdg->update_font(); QApplication::setFont(*fc_font::instance()->get_font(fonts::default_font)); - real_science_report_dialog_update(nullptr); + qtg_real_science_report_dialog_update(nullptr); fc_font::instance()->get_mapfont_size(); gui()->update_fonts(); } diff --git a/client/gui-qt/menu.cpp b/client/gui-qt/menu.cpp index 0221e0faa6..3f8f2c6778 100644 --- a/client/gui-qt/menu.cpp +++ b/client/gui-qt/menu.cpp @@ -2514,7 +2514,7 @@ void mr_menu::menus_sensitive() **************************************************************************/ void mr_menu::slot_show_research_tab() { - science_report_dialog_popup(true); + qtg_science_report_dialog_popup(true); } /**********************************************************************//** diff --git a/client/gui-qt/pages.cpp b/client/gui-qt/pages.cpp index 83fc667634..19f23b4c4a 100644 --- a/client/gui-qt/pages.cpp +++ b/client/gui-qt/pages.cpp @@ -47,12 +47,12 @@ #include "pages.h" #include "plrdlg.h" #include "qtg_cxxside.h" +#include "repodlgs_g.h" #include "sidebar.h" #include "sprite.h" #include "voteinfo_bar.h" extern "C" { -#include "repodlgs_g.h" #include "cityrep_g.h" const char *science_dialog_text(void); const char *get_bulb_tooltip(void); diff --git a/client/gui-qt/qtg_cxxside.cpp b/client/gui-qt/qtg_cxxside.cpp index 9a6fb19ba0..13819ac55b 100644 --- a/client/gui-qt/qtg_cxxside.cpp +++ b/client/gui-qt/qtg_cxxside.cpp @@ -122,4 +122,15 @@ void setup_gui_funcs() funcs->gui_recv_accept_treaty = qtg_recv_accept_treaty; funcs->request_action_confirmation = qtg_request_action_confirmation; + + funcs->real_science_report_dialog_update + = qtg_real_science_report_dialog_update; + funcs->science_report_dialog_redraw = qtg_science_report_dialog_redraw; + funcs->science_report_dialog_popup = qtg_science_report_dialog_popup; + funcs->real_economy_report_dialog_update + = qtg_real_economy_report_dialog_update; + funcs->real_units_report_dialog_update + = qtg_real_units_report_dialog_update; + funcs->endgame_report_dialog_start = qtg_endgame_report_dialog_start; + funcs->endgame_report_dialog_player = qtg_endgame_report_dialog_player; } diff --git a/client/gui-qt/qtg_cxxside.h b/client/gui-qt/qtg_cxxside.h index e230745676..50f02a7fa1 100644 --- a/client/gui-qt/qtg_cxxside.h +++ b/client/gui-qt/qtg_cxxside.h @@ -156,4 +156,12 @@ void qtg_recv_accept_treaty(struct Treaty *ptreaty, struct player *they); void qtg_request_action_confirmation(const char *expl, struct act_confirmation_data *data); +void qtg_real_science_report_dialog_update(void *unused); +void qtg_science_report_dialog_redraw(); +void qtg_science_report_dialog_popup(bool raise); +void qtg_real_economy_report_dialog_update(void *unused); +void qtg_real_units_report_dialog_update(void *unused); +void qtg_endgame_report_dialog_start(const struct packet_endgame_report *packet); +void qtg_endgame_report_dialog_player(const struct packet_endgame_player *packet); + #endif // FC__QTG_CXXSIDE_H diff --git a/client/gui-qt/repodlgs.cpp b/client/gui-qt/repodlgs.cpp index faacc74855..4a4fbfbecc 100644 --- a/client/gui-qt/repodlgs.cpp +++ b/client/gui-qt/repodlgs.cpp @@ -1153,7 +1153,7 @@ void science_report::goal_tech_changed(int changed_index) /************************************************************************//** Update the science report. ****************************************************************************/ -void real_science_report_dialog_update(void *unused) +void qtg_real_science_report_dialog_update(void *unused) { int i; int percent; @@ -1654,7 +1654,7 @@ void endgame_report::update_report(const struct packet_endgame_player *packet) Display the science report. Optionally raise it. Typically triggered by F6. ****************************************************************************/ -void science_report_dialog_popup(bool raise) +void qtg_science_report_dialog_popup(bool raise) { science_report *sci_rep; int i; @@ -1681,7 +1681,7 @@ void science_report_dialog_popup(bool raise) /************************************************************************//** Update the economy report. ****************************************************************************/ -void real_economy_report_dialog_update(void *unused) +void qtg_real_economy_report_dialog_update(void *unused) { int i; eco_report *eco_rep; @@ -1728,7 +1728,7 @@ void economy_report_dialog_popup(bool raise) /************************************************************************//** Update the units report. ****************************************************************************/ -void real_units_report_dialog_update(void *unused) +void qtg_real_units_report_dialog_update(void *unused) { if (units_reports::instance()->isVisible()) { units_reports::instance()->update_units(); @@ -1747,7 +1747,7 @@ void units_report_dialog_popup(bool raise) /************************************************************************//** Show a dialog with player statistics at endgame. ****************************************************************************/ -void endgame_report_dialog_start(const struct packet_endgame_report *packet) +void qtg_endgame_report_dialog_start(const struct packet_endgame_report *packet) { endgame_report *end_rep; @@ -1785,7 +1785,7 @@ void popup_endgame_report() /************************************************************************//** Received endgame report information about single player. ****************************************************************************/ -void endgame_report_dialog_player(const struct packet_endgame_player *packet) +void qtg_endgame_report_dialog_player(const struct packet_endgame_player *packet) { int i; endgame_report *end_rep; @@ -1803,7 +1803,7 @@ void endgame_report_dialog_player(const struct packet_endgame_player *packet) /************************************************************************//** Resize and redraw the requirement tree. ****************************************************************************/ -void science_report_dialog_redraw(void) +void qtg_science_report_dialog_redraw() { int i; science_report *sci_rep; diff --git a/client/gui-qt/repodlgs.h b/client/gui-qt/repodlgs.h index 6d016753c6..e7ec15bcce 100644 --- a/client/gui-qt/repodlgs.h +++ b/client/gui-qt/repodlgs.h @@ -18,10 +18,6 @@ #include #endif -extern "C" { -#include "repodlgs_g.h" -} - // Qt #include #include @@ -29,6 +25,7 @@ extern "C" { // client #include "climisc.h" +#include "repodlgs_g.h" // gui-qt #include "fonts.h" diff --git a/client/gui-stub/repodlgs.c b/client/gui-stub/repodlgs.c index 7b803bcbac..2c62cc5be8 100644 --- a/client/gui-stub/repodlgs.c +++ b/client/gui-stub/repodlgs.c @@ -23,23 +23,21 @@ /* client */ #include "repodlgs_common.h" -#include "cityrep.h" - #include "repodlgs.h" /**********************************************************************//** Update the science report. **************************************************************************/ -void real_science_report_dialog_update(void *unused) +void gui_real_science_report_dialog_update(void *unused) { /* PORTME */ } /**********************************************************************//** - Display the science report. Optionally raise it. + Display the science report. Optionally raise it. Typically triggered by F6. **************************************************************************/ -void science_report_dialog_popup(bool raise) +void gui_science_report_dialog_popup(bool raise) { /* PORTME */ } @@ -47,7 +45,7 @@ void science_report_dialog_popup(bool raise) /**********************************************************************//** Update the economy report. **************************************************************************/ -void real_economy_report_dialog_update(void *unused) +void gui_real_economy_report_dialog_update(void *unused) { /* PORTME */ } @@ -64,7 +62,7 @@ void economy_report_dialog_popup(bool raise) /**********************************************************************//** Update the units report. **************************************************************************/ -void real_units_report_dialog_update(void *unused) +void gui_real_units_report_dialog_update(void *unused) { /* PORTME */ } @@ -81,7 +79,7 @@ void units_report_dialog_popup(bool raise) /**********************************************************************//** Show a dialog with player statistics at endgame. **************************************************************************/ -void endgame_report_dialog_start(const struct packet_endgame_report *packet) +void gui_endgame_report_dialog_start(const struct packet_endgame_report *packet) { /* PORTME */ } @@ -89,7 +87,7 @@ void endgame_report_dialog_start(const struct packet_endgame_report *packet) /**********************************************************************//** Received endgame report information about single player. **************************************************************************/ -void endgame_report_dialog_player(const struct packet_endgame_player *packet) +void gui_endgame_report_dialog_player(const struct packet_endgame_player *packet) { /* PORTME */ } @@ -97,7 +95,7 @@ void endgame_report_dialog_player(const struct packet_endgame_player *packet) /**********************************************************************//** Resize and redraw the requirement tree. **************************************************************************/ -void science_report_dialog_redraw(void) +void gui_science_report_dialog_redraw(void) { /* PORTME */ } diff --git a/client/gui_interface.c b/client/gui_interface.c index d434ff8956..afdb294ea8 100644 --- a/client/gui_interface.c +++ b/client/gui_interface.c @@ -29,6 +29,7 @@ #include "graphics_g.h" #include "gui_main_g.h" #include "mapview_g.h" +#include "repodlgs_g.h" #include "themes_g.h" #include "gui_interface.h" @@ -701,3 +702,59 @@ void request_action_confirmation(const char *expl, { funcs.request_action_confirmation(expl, data); } + +/**********************************************************************//** + Call real_science_report_dialog_update callback +**************************************************************************/ +void real_science_report_dialog_update(void *unused) +{ + funcs.real_science_report_dialog_update(unused); +} + +/**********************************************************************//** + Call science_report_dialog_redraw callback +**************************************************************************/ +void science_report_dialog_redraw(void) +{ + funcs.science_report_dialog_redraw(); +} + +/**********************************************************************//** + Call science_report_dialog_popup callback +**************************************************************************/ +void science_report_dialog_popup(bool raise) +{ + funcs.science_report_dialog_popup(raise); +} + +/**********************************************************************//** + Call real_economy_report_dialog_update callback +**************************************************************************/ +void real_economy_report_dialog_update(void *unused) +{ + funcs.real_economy_report_dialog_update(unused); +} + +/**********************************************************************//** + Call real_units_report_dialog_update callback +**************************************************************************/ +void real_units_report_dialog_update(void *unused) +{ + funcs.real_units_report_dialog_update(unused); +} + +/**********************************************************************//** + Call endgame_report_dialog_start callback +**************************************************************************/ +void endgame_report_dialog_start(const struct packet_endgame_report *packet) +{ + funcs.endgame_report_dialog_start(packet); +} + +/**********************************************************************//** + Call endgame_report_dialog_player callback +**************************************************************************/ +void endgame_report_dialog_player(const struct packet_endgame_player *packet) +{ + funcs.endgame_report_dialog_player(packet); +} diff --git a/client/gui_interface.h b/client/gui_interface.h index 16d7fff3ca..aa8a084ee1 100644 --- a/client/gui_interface.h +++ b/client/gui_interface.h @@ -22,6 +22,7 @@ extern "C" { #include "diptreaty.h" #include "fc_types.h" #include "featured_text.h" +#include "packets_gen.h" #include "tile.h" /* client/include */ @@ -162,6 +163,14 @@ struct gui_funcs { void (*request_action_confirmation)(const char *expl, struct act_confirmation_data *data); + + void (*real_science_report_dialog_update)(void *unused); + void (*science_report_dialog_redraw)(void); + void (*science_report_dialog_popup)(bool raise); + void (*real_economy_report_dialog_update)(void *unused); + void (*real_units_report_dialog_update)(void *unused); + void (*endgame_report_dialog_start)(const struct packet_endgame_report *packet); + void (*endgame_report_dialog_player)(const struct packet_endgame_player *packet); }; struct gui_funcs *get_gui_funcs(void); diff --git a/client/include/repodlgs_g.h b/client/include/repodlgs_g.h index d3bc44fe5c..ab224a6acd 100644 --- a/client/include/repodlgs_g.h +++ b/client/include/repodlgs_g.h @@ -1,4 +1,4 @@ -/********************************************************************** +/*********************************************************************** Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -37,9 +37,4 @@ GUI_FUNC_PROTO(void, real_science_report_dialog_update, void *unused) GUI_FUNC_PROTO(void, real_economy_report_dialog_update, void *unused) GUI_FUNC_PROTO(void, real_units_report_dialog_update, void *unused) -/* Actually defined in update_queue.c */ -void science_report_dialog_update(void); -void economy_report_dialog_update(void); -void units_report_dialog_update(void); - -#endif /* FC__REPODLGS_G_H */ +#endif /* FC__REPODLGS_G_H */ diff --git a/client/update_queue.h b/client/update_queue.h index 4825261f2c..4e75ed3f90 100644 --- a/client/update_queue.h +++ b/client/update_queue.h @@ -61,6 +61,10 @@ void update_queue_connect_processing_finished_full(int request_id, bool update_queue_is_switching_page(void); +void science_report_dialog_update(void); +void economy_report_dialog_update(void); +void units_report_dialog_update(void); + #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/common/generate_packets.py b/common/generate_packets.py index 6b1e3e5db2..1579ba6488 100755 --- a/common/generate_packets.py +++ b/common/generate_packets.py @@ -3338,7 +3338,11 @@ def write_common_header(path: "str | Path | None", packets: PacketsDefinition): /* common */ #include "actions.h" #include "city.h" +#include "conn_types.h" #include "disaster.h" +#include "events.h" +#include "player.h" +#include "tech.h" #include "unit.h" /* common/aicore */ -- 2.39.2