[beast: 19/29] BEAST: convert enum type Bst::Direction to enum class Bst::Direction
- From: Tim Janik <timj src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [beast: 19/29] BEAST: convert enum type Bst::Direction to enum class Bst::Direction
- Date: Mon, 21 Mar 2016 15:13:45 +0000 (UTC)
commit 1961acd6b5fb4a1f2be90c2455f7fd1a11d70fd2
Author: Tim Janik <timj gnu org>
Date: Tue Feb 2 23:30:19 2016 +0100
BEAST: convert enum type Bst::Direction to enum class Bst::Direction
Signed-off-by: Tim Janik <timj gnu org>
beast-gtk/bstpatternctrl.cc | 13 +++++++------
beast-gtk/bstscrollgraph.cc | 22 +++++++++++-----------
2 files changed, 18 insertions(+), 17 deletions(-)
---
diff --git a/beast-gtk/bstpatternctrl.cc b/beast-gtk/bstpatternctrl.cc
index 159f466..ec80828 100644
--- a/beast-gtk/bstpatternctrl.cc
+++ b/beast-gtk/bstpatternctrl.cc
@@ -255,7 +255,6 @@ pattern_controller_key_press (BstPatternController *self,
/* movement */
switch (movement)
{
- guint d;
case BST_PATTERN_MOVE_LEFT: focus_col--; break;
case BST_PATTERN_MOVE_RIGHT: focus_col++; break;
case BST_PATTERN_MOVE_UP: focus_row--; break;
@@ -269,11 +268,13 @@ pattern_controller_key_press (BstPatternController *self,
case BST_PATTERN_JUMP_TOP: focus_row = 0; break;
case BST_PATTERN_JUMP_BOTTOM: focus_row = bst_pattern_view_get_last_row (pview); break;
case BST_PATTERN_MOVE_NEXT:
- d = Rapicorn::Aida::enum_value_from_string<Bst::Direction> (sfi_value_get_choice
(&self->step_dir->value));
- if (d == Bst::DIR_LEFT || d == Bst::DIR_RIGHT)
- focus_col += (d == Bst::DIR_LEFT ? -1 : +1) * g_value_get_int (&self->steps->value);
- else /* UP/DOWN */
- focus_row += (d == Bst::DIR_UP ? -1 : +1) * g_value_get_int (&self->steps->value);
+ {
+ Bst::Direction d = Rapicorn::Aida::enum_value_from_string<Bst::Direction> (sfi_value_get_choice
(&self->step_dir->value));
+ if (d == Bst::Direction::DIR_LEFT || d == Bst::Direction::DIR_RIGHT)
+ focus_col += (d == Bst::Direction::DIR_LEFT ? -1 : +1) * g_value_get_int (&self->steps->value);
+ else /* UP/DOWN */
+ focus_row += (d == Bst::Direction::DIR_UP ? -1 : +1) * g_value_get_int (&self->steps->value);
+ }
break;
case BST_PATTERN_SET_STEP_WIDTH:
g_value_set_int (&self->steps->value, param);
diff --git a/beast-gtk/bstscrollgraph.cc b/beast-gtk/bstscrollgraph.cc
index 5bc4c4e..6c23c29 100644
--- a/beast-gtk/bstscrollgraph.cc
+++ b/beast-gtk/bstscrollgraph.cc
@@ -7,8 +7,8 @@
#define N_VALUES(scg) ((scg)->n_points * (scg)->n_bars)
#define VALUE(scg,b,p) (BAR (scg, b)[(p)])
#define BAR(scg,nth) ((scg)->values + (scg)->n_points * (((scg)->bar_offset + (nth)) % (scg)->n_bars))
-#define HORIZONTAL(scg) ((scg)->direction == Bst::DIR_RIGHT || (scg)->direction == Bst::DIR_LEFT)
-#define VERTICAL(scg) ((scg)->direction == Bst::DIR_UP || (scg)->direction == Bst::DIR_DOWN)
+#define HORIZONTAL(scg) ((scg)->direction == Bst::Direction::DIR_RIGHT || (scg)->direction ==
Bst::Direction::DIR_LEFT)
+#define VERTICAL(scg) ((scg)->direction == Bst::Direction::DIR_UP || (scg)->direction ==
Bst::Direction::DIR_DOWN)
#define FLIP(scg) ((scg)->flip ^ HORIZONTAL (scg))
#define FFTSZ2POINTS(k) ((k) / 2 + 1)
@@ -50,7 +50,7 @@ bst_scrollgraph_finalize (GObject *object)
static void
bst_scrollgraph_resize_values (BstScrollgraph *self, Bst::Direction direction)
{
- g_signal_emit (self, signal_resize_values, 0, CLAMP (direction, Bst::DIR_UP, Bst::DIR_DOWN));
+ g_signal_emit (self, signal_resize_values, 0, CLAMP (direction, Bst::Direction::DIR_UP,
Bst::Direction::DIR_DOWN));
}
static void
@@ -274,9 +274,9 @@ bst_scrollgraph_scroll_bars (BstScrollgraph *self)
{
GdkWindow *drawable = self->canvas;
if (HORIZONTAL (self))
- gdk_window_scroll (drawable, self->direction == Bst::DIR_LEFT ? -1 : 1, 0);
+ gdk_window_scroll (drawable, self->direction == Bst::Direction::DIR_LEFT ? -1 : 1, 0);
else
- gdk_window_scroll (drawable, 0, self->direction == Bst::DIR_UP ? -1 : 1);
+ gdk_window_scroll (drawable, 0, self->direction == Bst::Direction::DIR_UP ? -1 : 1);
}
}
@@ -300,7 +300,7 @@ bst_scrollgraph_draw_bar (BstScrollgraph *self,
GdkWindow *drawable = self->canvas;
guint8 *rgb = gdk_pixbuf_get_pixels (self->pixbuf);
guint i, n = nth;
- if (self->direction == Bst::DIR_LEFT || self->direction == Bst::DIR_UP)
+ if (self->direction == Bst::Direction::DIR_LEFT || self->direction == Bst::Direction::DIR_UP)
n = self->n_bars - 1 - (nth % self->n_bars);
GxkColorDots *cdots = create_color_dots(); // FIXME
for (i = 0; i < self->n_points; i++)
@@ -335,7 +335,7 @@ bst_scrollgraph_bar_from_coord (BstScrollgraph *self,
y -= widget->allocation.y;
}
gint n = HORIZONTAL (self) ? x : y;
- if (uint (n) < self->n_bars && (self->direction == Bst::DIR_LEFT || self->direction == Bst::DIR_UP))
+ if (uint (n) < self->n_bars && (self->direction == Bst::Direction::DIR_LEFT || self->direction ==
Bst::Direction::DIR_UP))
n = ((gint) self->n_bars) - 1 - n;
return n;
}
@@ -511,7 +511,7 @@ bst_scrollgraph_init (BstScrollgraph *self)
GtkWidget *widget = GTK_WIDGET (self);
GTK_WIDGET_UNSET_FLAGS (self, GTK_NO_WINDOW);
gtk_widget_set_double_buffered (widget, FALSE);
- self->direction = Bst::DIR_LEFT;
+ self->direction = Bst::Direction::DIR_LEFT;
self->mix_freq = 44100;
self->boost = 1;
self->window_size = 512;
@@ -522,7 +522,7 @@ bst_scrollgraph_init (BstScrollgraph *self)
self->n_bars = 0;
self->values = NULL;
widget->allocation.width = 10; widget->allocation.height = 10; // FIXME: initial values for _resize()
- bst_scrollgraph_resize_values (self, Bst::DIR_LEFT);
+ bst_scrollgraph_resize_values (self, Bst::Direction::DIR_LEFT);
}
static void
@@ -590,7 +590,7 @@ scrollgraph_resize_rulers (BstScrollgraph *self, Bst::Direction direction, gpoin
if (HORIZONTAL (self))
{
gdouble lower = 0, upper = widget->allocation.width * secs;
- gboolean sflip = self->direction == Bst::DIR_LEFT;
+ gboolean sflip = self->direction == Bst::Direction::DIR_LEFT;
gtk_ruler_set_range (GTK_RULER (hruler), sflip ? upper : lower, sflip ? lower : upper, 0, MAX
(lower, upper));
lower = 0, upper = self->mix_freq / 2;
gtk_ruler_set_range (GTK_RULER (vruler), FLIP (self) ? upper : lower, FLIP (self) ? lower : upper,
0, MAX (lower, upper));
@@ -598,7 +598,7 @@ scrollgraph_resize_rulers (BstScrollgraph *self, Bst::Direction direction, gpoin
if (VERTICAL (self))
{
gdouble lower = 0, upper = widget->allocation.height * secs;
- gboolean sflip = self->direction == Bst::DIR_UP;
+ gboolean sflip = self->direction == Bst::Direction::DIR_UP;
gtk_ruler_set_range (GTK_RULER (vruler), sflip ? upper : lower, sflip ? lower : upper, 0, MAX
(lower, upper));
lower = 0, upper = self->mix_freq / 2;
gtk_ruler_set_range (GTK_RULER (hruler), FLIP (self) ? upper : lower, FLIP (self) ? lower :
upper, 0, MAX (lower, upper));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]