From ecd83115ae582c48d12be302f993d9e22763c8df Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Thu, 20 May 2021 01:23:43 +0300 Subject: [PATCH 40/40] gtk3/.22: Add empty space for scrollbar in units and economy reports Scrollbar was hiding rightmost column of the reports. Work around that by adding empty column where the scrollbar goes. Patch by alain_bkr See osdn #42167 Signed-off-by: Marko Lindqvist --- client/gui-gtk-3.0/repodlgs.c | 15 ++++++++++++++- client/gui-gtk-3.22/repodlgs.c | 15 ++++++++++++++- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/client/gui-gtk-3.0/repodlgs.c b/client/gui-gtk-3.0/repodlgs.c index 8f71bf2051..c3909b1478 100644 --- a/client/gui-gtk-3.0/repodlgs.c +++ b/client/gui-gtk-3.0/repodlgs.c @@ -755,6 +755,7 @@ enum economy_report_columns { ERD_COL_COUNT, ERD_COL_COST, ERD_COL_TOTAL_COST, + ERD_COL_EMPTY, /* will make an empty space for scroll bar */ /* Not visible. */ ERD_COL_IS_IMPROVEMENT, @@ -775,6 +776,7 @@ static GtkListStore *economy_report_store_new(void) G_TYPE_INT, /* ERD_COL_COUNT */ G_TYPE_INT, /* ERD_COL_COST */ G_TYPE_INT, /* ERD_COL_TOTAL_COST */ + G_TYPE_STRING, /* ERD_COL_EMPTY */ G_TYPE_BOOLEAN, /* ERD_COL_IS_IMPROVEMENT */ G_TYPE_INT, /* ERD_COL_UNI_KIND */ G_TYPE_INT); /* ERD_COL_UNI_VALUE_ID */ @@ -801,10 +803,13 @@ economy_report_column_name(enum economy_report_columns col) case ERD_COL_TOTAL_COST: /* TRANS: Upkeep total, count*cost. */ return _("U Total"); + case ERD_COL_EMPTY: + /* empty space for scrollbar*/ + return " "; case ERD_COL_IS_IMPROVEMENT: case ERD_COL_CID: case ERD_COL_NUM: - break; + break; /* no more columns will be displayed after reaching this */ } return NULL; @@ -858,6 +863,7 @@ static void economy_report_update(struct economy_report *preport) ERD_COL_COUNT, pentry->count, ERD_COL_COST, pentry->cost, ERD_COL_TOTAL_COST, pentry->total_cost, + ERD_COL_EMPTY, " ", ERD_COL_IS_IMPROVEMENT, TRUE, ERD_COL_CID, id, -1); @@ -886,6 +892,7 @@ static void economy_report_update(struct economy_report *preport) ERD_COL_COUNT, pentry->count, ERD_COL_COST, pentry->cost, ERD_COL_TOTAL_COST, pentry->total_cost, + ERD_COL_EMPTY, " ", ERD_COL_IS_IMPROVEMENT, FALSE, ERD_COL_CID, id, -1); @@ -1252,6 +1259,7 @@ enum units_report_columns { URD_COL_SHIELD, URD_COL_FOOD, URD_COL_GOLD, + URD_COL_EMPTY, /* empty space for scrollbar */ /* Not visible. */ URD_COL_TEXT_WEIGHT, @@ -1286,6 +1294,9 @@ static const struct { N_("Total food upkeep"), TRUE, -1 }, { /* URD_COL_GOLD */ G_TYPE_INT, N_("Gold"), N_("Total gold upkeep"), TRUE, -1 }, + { /* URD_COL_EMPTY */ G_TYPE_STRING, " ", + " ", TRUE, -1 }, + { /* URD_COL_TEXT_WEIGHT */ G_TYPE_INT, NULL /* ... */ }, { /* URD_COL_UPG_VISIBLE */ G_TYPE_BOOLEAN, NULL /* ... */ }, { /* URD_COL_NUPG_VISIBLE */ G_TYPE_BOOLEAN, NULL /* ... */ }, @@ -1399,6 +1410,7 @@ static void units_report_update(struct units_report *preport) URD_COL_SHIELD, info->upkeep[O_SHIELD], URD_COL_FOOD, info->upkeep[O_FOOD], URD_COL_GOLD, info->upkeep[O_GOLD], + URD_COL_EMPTY, " ", URD_COL_TEXT_WEIGHT, PANGO_WEIGHT_NORMAL, URD_COL_UPG_VISIBLE, TRUE, URD_COL_NUPG_VISIBLE, FALSE, @@ -1431,6 +1443,7 @@ static void units_report_update(struct units_report *preport) URD_COL_SHIELD, unit_totals.upkeep[O_SHIELD], URD_COL_FOOD, unit_totals.upkeep[O_FOOD], URD_COL_GOLD, unit_totals.upkeep[O_GOLD], + URD_COL_EMPTY, " ", URD_COL_TEXT_WEIGHT, PANGO_WEIGHT_BOLD, URD_COL_UPG_VISIBLE, FALSE, URD_COL_NUPG_VISIBLE, TRUE, diff --git a/client/gui-gtk-3.22/repodlgs.c b/client/gui-gtk-3.22/repodlgs.c index faa21225e2..cb93627c34 100644 --- a/client/gui-gtk-3.22/repodlgs.c +++ b/client/gui-gtk-3.22/repodlgs.c @@ -754,6 +754,7 @@ enum economy_report_columns { ERD_COL_COUNT, ERD_COL_COST, ERD_COL_TOTAL_COST, + ERD_COL_EMPTY, /* will make an empty space for scroll bar */ /* Not visible. */ ERD_COL_IS_IMPROVEMENT, @@ -774,6 +775,7 @@ static GtkListStore *economy_report_store_new(void) G_TYPE_INT, /* ERD_COL_COUNT */ G_TYPE_INT, /* ERD_COL_COST */ G_TYPE_INT, /* ERD_COL_TOTAL_COST */ + G_TYPE_STRING, /* ERD_COL_EMPTY */ G_TYPE_BOOLEAN, /* ERD_COL_IS_IMPROVEMENT */ G_TYPE_INT, /* ERD_COL_UNI_KIND */ G_TYPE_INT); /* ERD_COL_UNI_VALUE_ID */ @@ -800,10 +802,13 @@ economy_report_column_name(enum economy_report_columns col) case ERD_COL_TOTAL_COST: /* TRANS: Upkeep total, count*cost. */ return _("U Total"); + case ERD_COL_EMPTY: + /* empty space for scrollbar*/ + return " "; case ERD_COL_IS_IMPROVEMENT: case ERD_COL_CID: case ERD_COL_NUM: - break; + break; /* no more columns will be displayed after reaching this */ } return NULL; @@ -857,6 +862,7 @@ static void economy_report_update(struct economy_report *preport) ERD_COL_COUNT, pentry->count, ERD_COL_COST, pentry->cost, ERD_COL_TOTAL_COST, pentry->total_cost, + ERD_COL_EMPTY, " ", ERD_COL_IS_IMPROVEMENT, TRUE, ERD_COL_CID, id, -1); @@ -885,6 +891,7 @@ static void economy_report_update(struct economy_report *preport) ERD_COL_COUNT, pentry->count, ERD_COL_COST, pentry->cost, ERD_COL_TOTAL_COST, pentry->total_cost, + ERD_COL_EMPTY, " ", ERD_COL_IS_IMPROVEMENT, FALSE, ERD_COL_CID, id, -1); @@ -1252,6 +1259,7 @@ enum units_report_columns { URD_COL_SHIELD, URD_COL_FOOD, URD_COL_GOLD, + URD_COL_EMPTY, /* empty space for scrollbar */ /* Not visible. */ URD_COL_TEXT_WEIGHT, @@ -1286,6 +1294,9 @@ static const struct { N_("Total food upkeep"), TRUE, -1 }, { /* URD_COL_GOLD */ G_TYPE_INT, N_("Gold"), N_("Total gold upkeep"), TRUE, -1 }, + { /* URD_COL_EMPTY */ G_TYPE_STRING, " ", + " ", TRUE, -1 }, + { /* URD_COL_TEXT_WEIGHT */ G_TYPE_INT, NULL /* ... */ }, { /* URD_COL_UPG_VISIBLE */ G_TYPE_BOOLEAN, NULL /* ... */ }, { /* URD_COL_NUPG_VISIBLE */ G_TYPE_BOOLEAN, NULL /* ... */ }, @@ -1399,6 +1410,7 @@ static void units_report_update(struct units_report *preport) URD_COL_SHIELD, info->upkeep[O_SHIELD], URD_COL_FOOD, info->upkeep[O_FOOD], URD_COL_GOLD, info->upkeep[O_GOLD], + URD_COL_EMPTY, " ", URD_COL_TEXT_WEIGHT, PANGO_WEIGHT_NORMAL, URD_COL_UPG_VISIBLE, TRUE, URD_COL_NUPG_VISIBLE, FALSE, @@ -1431,6 +1443,7 @@ static void units_report_update(struct units_report *preport) URD_COL_SHIELD, unit_totals.upkeep[O_SHIELD], URD_COL_FOOD, unit_totals.upkeep[O_FOOD], URD_COL_GOLD, unit_totals.upkeep[O_GOLD], + URD_COL_EMPTY, " ", URD_COL_TEXT_WEIGHT, PANGO_WEIGHT_BOLD, URD_COL_UPG_VISIBLE, FALSE, URD_COL_NUPG_VISIBLE, TRUE, -- 2.30.2