From 1fdb3aeb5c968254ccf1a7b816683e87eaa00b3a Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Thu, 20 May 2021 01:17:50 +0300 Subject: [PATCH 37/37] gtk: 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 ++++++++++++++- client/gui-gtk-4.0/repodlgs.c | 15 ++++++++++++++- 3 files changed, 42 insertions(+), 3 deletions(-) diff --git a/client/gui-gtk-3.0/repodlgs.c b/client/gui-gtk-3.0/repodlgs.c index e1acbf867f..be61b1e9c4 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); @@ -1253,6 +1260,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, @@ -1287,6 +1295,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 /* ... */ }, @@ -1400,6 +1411,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, @@ -1432,6 +1444,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 120a8934bf..b41a4a17a9 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, diff --git a/client/gui-gtk-4.0/repodlgs.c b/client/gui-gtk-4.0/repodlgs.c index 4a9cb58bcf..6eb9dd4cd3 100644 --- a/client/gui-gtk-4.0/repodlgs.c +++ b/client/gui-gtk-4.0/repodlgs.c @@ -760,6 +760,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, @@ -780,6 +781,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 */ @@ -806,10 +808,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; @@ -863,6 +868,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); @@ -891,6 +897,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); @@ -1258,6 +1265,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, @@ -1292,6 +1300,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 /* ... */ }, @@ -1405,6 +1416,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, @@ -1437,6 +1449,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