index 6c97e260594936025172c46e88a9d06fc6c62374..7c391803e94f46dd5dda4e8930d5ea410390418a 100644 (file)
#define DEFAULTGRIDCOLOR 0x0000FF20
#define DEFAULTGRIDEMPCOLOR 0x0000FF40
-const gchar *grid_name [] = {
+static gchar const *const grid_name[] = {
N_("Rectangular grid"),
N_("Axonometric grid")
};
-const gchar *grid_svgname [] = {
+static gchar const *const grid_svgname[] = {
"xygrid",
"axonomgrid"
};
-const char *
+char const *
CanvasGrid::getName(GridType type)
{
return _(grid_name[type]);
}
-const char *
+char const *
CanvasGrid::getSVGName(GridType type)
{
return grid_svgname[type];
}
GridType
-CanvasGrid::getGridTypeFromSVGName(const char * typestr)
+CanvasGrid::getGridTypeFromSVGName(char const *typestr)
{
if (!typestr) return GRID_RECTANGULAR;
}
GridType
-CanvasGrid::getGridTypeFromName(const char * typestr)
+CanvasGrid::getGridTypeFromName(char const *typestr)
{
if (!typestr) return GRID_RECTANGULAR;
}
void
-CanvasGrid::on_repr_attr_changed (Inkscape::XML::Node * repr, const gchar *key, const gchar *oldval, const gchar *newval, bool is_interactive, void * data)
+CanvasGrid::on_repr_attr_changed(Inkscape::XML::Node *repr, gchar const *key, gchar const *oldval, gchar const *newval, bool is_interactive, void *data)
{
if (!data)
return;
#define SPACE_SIZE_X 15
#define SPACE_SIZE_Y 10
static inline void
-attach_all (Gtk::Table &table, const Gtk::Widget *arr[], unsigned size, int start = 0)
+attach_all(Gtk::Table &table, Gtk::Widget const *const arr[], unsigned size, int start = 0)
{
for (unsigned i=0, r=start; i<size/sizeof(Gtk::Widget*); i+=2)
{
@@ -384,8 +384,7 @@ CanvasXYGrid::CanvasXYGrid (SPNamedView * nv, Inkscape::XML::Node * in_repr, SPD
_("If set, displays dots at gridpoints instead of gridlines"),
"dotted", _wr, false, repr, doc);
- const Gtk::Widget* widget_array[] =
- {
+ Gtk::Widget const *const widget_array[] = {
_rumg._label, _rumg._sel,
0, _rsu_ox.getSU(),
0, _rsu_oy.getSU(),
/* fixme: Collect all these length parsing methods and think common sane API */
-static gboolean sp_nv_read_length(const gchar *str, guint base, gdouble *val, const SPUnit **unit)
+static gboolean
+sp_nv_read_length(gchar const *str, guint base, gdouble *val, SPUnit const **unit)
{
if (!str) {
return FALSE;
@@ -464,7 +464,7 @@ static gboolean sp_nv_read_length(const gchar *str, guint base, gdouble *val, co
return FALSE;
}
-static gboolean sp_nv_read_opacity(const gchar *str, guint32 *color)
+static gboolean sp_nv_read_opacity(gchar const *str, guint32 *color)
{
if (!str) {
return FALSE;
CanvasXYGrid::readRepr()
{
char buff[100];
- gchar const* value;
+ gchar const *value;
if ( (value = repr->attribute("originx")) ) {
sp_nv_read_length(value, SP_UNIT_ABSOLUTE | SP_UNIT_DEVICE, &origin[NR::X], &gridunit);
origin[NR::X] = sp_units_get_pixels(origin[NR::X], *(gridunit));
* Called when XML node attribute changed; updates dialog widgets if change was not done by widgets themselves.
*/
void
-CanvasXYGrid::onReprAttrChanged (Inkscape::XML::Node * repr, const gchar *key, const gchar *oldval, const gchar *newval, bool is_interactive)
+CanvasXYGrid::onReprAttrChanged(Inkscape::XML::Node *repr, gchar const *key, gchar const *oldval, gchar const *newval, bool is_interactive)
{
readRepr();
void
CanvasXYGrid::Render (SPCanvasBuf *buf)
{
- const gdouble sxg = floor ((buf->rect.x0 - ow[NR::X]) / sw[NR::X]) * sw[NR::X] + ow[NR::X];
- const gint xlinestart = (gint) Inkscape::round((sxg - ow[NR::X]) / sw[NR::X]);
- const gdouble syg = floor ((buf->rect.y0 - ow[NR::Y]) / sw[NR::Y]) * sw[NR::Y] + ow[NR::Y];
- const gint ylinestart = (gint) Inkscape::round((syg - ow[NR::Y]) / sw[NR::Y]);
+ gdouble const sxg = floor ((buf->rect.x0 - ow[NR::X]) / sw[NR::X]) * sw[NR::X] + ow[NR::X];
+ gint const xlinestart = (gint) Inkscape::round((sxg - ow[NR::X]) / sw[NR::X]);
+ gdouble const syg = floor ((buf->rect.y0 - ow[NR::Y]) / sw[NR::Y]) * sw[NR::Y] + ow[NR::Y];
+ gint const ylinestart = (gint) Inkscape::round((syg - ow[NR::Y]) / sw[NR::Y]);
if (!render_dotted) {
gint ylinenum;
gdouble y;
for (y = syg, ylinenum = ylinestart; y < buf->rect.y1; y += sw[NR::Y], ylinenum++) {
- const gint y0 = (gint) Inkscape::round(y);
+ gint const y0 = (gint) Inkscape::round(y);
if (!scaled[NR::Y] && (ylinenum % empspacing) == 0) {
grid_hline (buf, y0, buf->rect.x0, buf->rect.x1 - 1, empcolor);
gint xlinenum;
gdouble x;
for (x = sxg, xlinenum = xlinestart; x < buf->rect.x1; x += sw[NR::X], xlinenum++) {
- const gint ix = (gint) Inkscape::round(x);
+ gint const ix = (gint) Inkscape::round(x);
if (!scaled[NR::X] && (xlinenum % empspacing) == 0) {
grid_vline (buf, ix, buf->rect.y0, buf->rect.y1, empcolor);
} else {
gint ylinenum;
gdouble y;
for (y = syg, ylinenum = ylinestart; y < buf->rect.y1; y += sw[NR::Y], ylinenum++) {
- const gint iy = (gint) Inkscape::round(y);
+ gint const iy = (gint) Inkscape::round(y);
gint xlinenum;
gdouble x;
for (x = sxg, xlinenum = xlinestart; x < buf->rect.x1; x += sw[NR::X], xlinenum++) {
- const gint ix = (gint) Inkscape::round(x);
+ gint const ix = (gint) Inkscape::round(x);
if ( (!scaled[NR::X] && (xlinenum % empspacing) == 0)
|| (!scaled[NR::Y] && (ylinenum % empspacing) == 0) )
{