From 77fa09cf95046c3413f6df95f7fbe10ee2bb7cb5 Mon Sep 17 00:00:00 2001 From: David Korth Date: Sun, 5 Jan 2025 11:14:03 -0500 Subject: [PATCH] [gtk] RomDataView_gtk4.cpp: Move the alignment tables into setup_listitem_cb_text(). These tables are only used in this function. --- src/gtk/RomDataView_gtk4.cpp | 31 ++++++++++++------------------- 1 file changed, 12 insertions(+), 19 deletions(-) diff --git a/src/gtk/RomDataView_gtk4.cpp b/src/gtk/RomDataView_gtk4.cpp index 6ddaf6b22..0b8389ef0 100644 --- a/src/gtk/RomDataView_gtk4.cpp +++ b/src/gtk/RomDataView_gtk4.cpp @@ -28,18 +28,6 @@ using std::vector; // TODO: Ideal icon size? Using 32x32 for now. static constexpr int icon_sz = 32; -// Format tables. -// Pango enum values are known to fit in uint8_t. -static constexpr array align_tbl_xalign = {{ - // Order: TXA_D, TXA_L, TXA_C, TXA_R - 0.0f, 0.0f, 0.5f, 1.0f -}}; -static constexpr array align_tbl_halign = {{ - // Order: TXA_D, TXA_L, TXA_C, TXA_R - GTK_ALIGN_START, GTK_ALIGN_START, - GTK_ALIGN_CENTER, GTK_ALIGN_END -}}; - // GtkSignalListItemFactory signal handlers // Reference: https://blog.gtk.org/2020/09/05/a-primer-on-gtklistview/ // NOTE: user_data is RpListDataItemCol0Type. @@ -82,6 +70,18 @@ setup_listitem_cb_text(GtkListItemFactory *factory, GtkListItem *list_item, gpoi { RP_UNUSED(factory); + // Format tables. + // Pango enum values are known to fit in uint8_t. + static constexpr array align_tbl_xalign = {{ + // Order: TXA_D, TXA_L, TXA_C, TXA_R + 0.0f, 0.0f, 0.5f, 1.0f + }}; + static constexpr array align_tbl_halign = {{ + // Order: TXA_D, TXA_L, TXA_C, TXA_R + GTK_ALIGN_START, GTK_ALIGN_START, + GTK_ALIGN_CENTER, GTK_ALIGN_END + }}; + const uint32_t align_data = (GPOINTER_TO_UINT(user_data) & RomFields::TXA_MASK); GtkWidget *const label = gtk_label_new(nullptr); @@ -279,13 +279,6 @@ rp_rom_data_view_init_listdata(RpRomDataView *page, const RomFields::Field &fiel (listDataDesc.names ? listDataDesc.names->at(i).c_str() : ""), factory); gtk_column_view_append_column(GTK_COLUMN_VIEW(columnView), column); -#if 0 - // Header/data alignment - g_object_set(column, - "alignment", align_tbl_xalign[col_attrs.align_headers & RomFields::TXA_MASK], - nullptr); -#endif - // Column sizing // NOTE: We don't have direct equivalents to QHeaderView::ResizeMode. switch (col_attrs.sizing & RomFields::COLSZ_MASK) {