From dd87fa25f1ea143594c268c993ff8e50cbf60962 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Thu, 20 May 2021 01:17:50 +0300 Subject: [PATCH 48/48] 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.22/repodlgs.c | 15 ++++++++++++++- client/gui-gtk-4.0/repodlgs.c | 15 ++++++++++++++- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/client/gui-gtk-3.22/repodlgs.c b/client/gui-gtk-3.22/repodlgs.c index 15fec40eef..44b6eb782f 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 /* ... */ }, @@ -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-4.0/repodlgs.c b/client/gui-gtk-4.0/repodlgs.c index 1c6ab44c1b..14f6e7af22 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 /* ... */ }, @@ -1406,6 +1417,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, @@ -1438,6 +1450,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