From 8411c3272ce2cf9230841c86d6545502216ec0b8 Mon Sep 17 00:00:00 2001 From: "Jon A. Cruz" Date: Thu, 14 Jul 2011 21:35:42 -0700 Subject: Address issues with GtkRuleMetric const warnings. (bzr r10454) --- src/widgets/ruler.cpp | 32 ++++++++++++-------------------- 1 file changed, 12 insertions(+), 20 deletions(-) (limited to 'src/widgets/ruler.cpp') diff --git a/src/widgets/ruler.cpp b/src/widgets/ruler.cpp index 60e460cda..7baa0a172 100644 --- a/src/widgets/ruler.cpp +++ b/src/widgets/ruler.cpp @@ -1,5 +1,3 @@ -#define __SP_RULER_C__ - /* * Customized ruler class for inkscape * @@ -8,8 +6,9 @@ * Frank Felfe * bulia byak * Diederik van Lierop + * Jon A. Cruz * - * Copyright (C) 1999-2008 authors + * Copyright (C) 1999-2011 authors * * Released under GNU GPL, read the file 'COPYING' for more information */ @@ -377,26 +376,19 @@ sp_ruler_common_draw_ticks (GtkRuler *ruler) } } -//TODO: warning: deprecated conversion from string constant to ‘gchar*’ -// -//Turn out to be warnings that we should probably leave in place. The -// pointers/types used need to be read-only. So until we correct the using -// code, those warnings are actually desired. They say "Hey! Fix this". We -// definitely don't want to hide/ignore them. --JonCruz - -// TODO address const/non-const gchar* issue: +// Note: const casts are due to GtkRuler being const-broken and not scheduled for any more fixes. /// Ruler metrics. static GtkRulerMetric const sp_ruler_metrics[] = { // NOTE: the order of records in this struct must correspond to the SPMetric enum. - {"NONE", "", 1, { 1, 2, 5, 10, 25, 50, 100, 250, 500, 1000 }, { 1, 5, 10, 50, 100 }}, - {"millimeters", "mm", PX_PER_MM, { 1, 2, 5, 10, 25, 50, 100, 250, 500, 1000 }, { 1, 5, 10, 50, 100 }}, - {"centimeters", "cm", PX_PER_CM, { 1, 2, 5, 10, 25, 50, 100, 250, 500, 1000 }, { 1, 5, 10, 50, 100 }}, - {"inches", "in", PX_PER_IN, { 1, 2, 4, 8, 16, 32, 64, 128, 256, 512 }, { 1, 2, 4, 8, 16 }}, - {"feet", "ft", PX_PER_FT, { 1, 2, 5, 10, 25, 50, 100, 250, 500, 1000 }, { 1, 5, 10, 50, 100 }}, - {"points", "pt", PX_PER_PT, { 1, 2, 5, 10, 25, 50, 100, 250, 500, 1000 }, { 1, 5, 10, 50, 100 }}, - {"picas", "pc", PX_PER_PC, { 1, 2, 5, 10, 25, 50, 100, 250, 500, 1000 }, { 1, 5, 10, 50, 100 }}, - {"pixels", "px", PX_PER_PX, { 1, 2, 5, 10, 25, 50, 100, 250, 500, 1000 }, { 1, 5, 10, 50, 100 }}, - {"meters", "m", PX_PER_M, { 1, 2, 5, 10, 25, 50, 100, 250, 500, 1000 }, { 1, 5, 10, 50, 100 }}, + {const_cast("NONE"), const_cast(""), 1, { 1, 2, 5, 10, 25, 50, 100, 250, 500, 1000 }, { 1, 5, 10, 50, 100 }}, + {const_cast("millimeters"), const_cast("mm"), PX_PER_MM, { 1, 2, 5, 10, 25, 50, 100, 250, 500, 1000 }, { 1, 5, 10, 50, 100 }}, + {const_cast("centimeters"), const_cast("cm"), PX_PER_CM, { 1, 2, 5, 10, 25, 50, 100, 250, 500, 1000 }, { 1, 5, 10, 50, 100 }}, + {const_cast("inches"), const_cast("in"), PX_PER_IN, { 1, 2, 4, 8, 16, 32, 64, 128, 256, 512 }, { 1, 2, 4, 8, 16 }}, + {const_cast("feet"), const_cast("ft"), PX_PER_FT, { 1, 2, 5, 10, 25, 50, 100, 250, 500, 1000 }, { 1, 5, 10, 50, 100 }}, + {const_cast("points"), const_cast("pt"), PX_PER_PT, { 1, 2, 5, 10, 25, 50, 100, 250, 500, 1000 }, { 1, 5, 10, 50, 100 }}, + {const_cast("picas"), const_cast("pc"), PX_PER_PC, { 1, 2, 5, 10, 25, 50, 100, 250, 500, 1000 }, { 1, 5, 10, 50, 100 }}, + {const_cast("pixels"), const_cast("px"), PX_PER_PX, { 1, 2, 5, 10, 25, 50, 100, 250, 500, 1000 }, { 1, 5, 10, 50, 100 }}, + {const_cast("meters"), const_cast("m"), PX_PER_M, { 1, 2, 5, 10, 25, 50, 100, 250, 500, 1000 }, { 1, 5, 10, 50, 100 }}, }; void -- cgit v1.2.3