enough with umpteen "i18n.h" files. Consolidate on pbd/i18n.h
[ardour.git] / libs / surfaces / tranzport / wheel_modes.cc
1 /*
2  *   Copyright (C) 2006 Paul Davis
3  *   Copyright (C) 2007 Michael Taht
4  *
5  *   This program is free software; you can redistribute it and/or modify
6  *   it under the terms of the GNU General Public License as published by
7  *   the Free Software Foundation; either version 2 of the License, or
8  *   (at your option) any later version.
9  *
10  *   This program is distributed in the hope that it will be useful,
11  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
12  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  *   GNU General Public License for more details.
14  *
15  *   You should have received a copy of the GNU General Public License
16  *   along with this program; if not, write to the Free Software
17  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18  *
19  */
20
21 #include <iostream>
22 #include <algorithm>
23 #include <cmath>
24
25 #define __STDC_FORMAT_MACROS
26 #include <inttypes.h>
27 #include <float.h>
28 #include <sys/time.h>
29 #include <errno.h>
30
31 #if HAVE_TRANZPORT_KERNEL_DRIVER
32 #include <fcntl.h>
33 #include <poll.h>
34 #endif
35
36 #include "pbd/pthread_utils.h"
37
38 #include "ardour/route.h"
39 #include "ardour/audio_track.h"
40 #include "ardour/tempo.h"
41 #include "ardour/location.h"
42 #include "ardour/dB.h"
43
44 #include "tranzport_control_protocol.h"
45
46 using namespace ARDOUR;
47 using namespace std;
48 using namespace sigc;
49 using namespace PBD;
50
51 #include "pbd/i18n.h"
52
53 #include <pbd/abstract_ui.cc>
54
55 void
56 TranzportControlProtocol::next_wheel_shift_mode ()
57 {
58 switch (wheel_shift_mode) {
59         case WheelShiftGain:
60                 wheel_shift_mode = WheelShiftPan;
61                 break;
62         case WheelShiftPan:
63                 wheel_shift_mode = WheelShiftMaster;
64                 break;
65         case WheelShiftMaster:
66                 wheel_shift_mode = WheelShiftGain;
67                 break;
68         case WheelShiftMarker: // Not done yet, disabled
69                 wheel_shift_mode = WheelShiftGain;
70                 break;
71         }
72
73         show_wheel_mode ();
74 }
75
76 void
77 TranzportControlProtocol::next_wheel_mode ()
78 {
79         switch (wheel_mode) {
80         case WheelTimeline:
81                 wheel_mode = WheelScrub;
82                 break;
83         case WheelScrub:
84                 wheel_mode = WheelShuttle;
85                 break;
86         case WheelShuttle:
87                 wheel_mode = WheelTimeline;
88         }
89
90         show_wheel_mode ();
91 }
92
93 void
94 TranzportControlProtocol::show_wheel_mode ()
95 {
96         string text;
97
98         // if(session->transport_speed() != 0) {
99         //    if session-transport_speed() < 1.0) show_big_bar/beat
100         //    if ? greater. dont
101
102         if(session->transport_speed() != 0) {
103                 show_mini_meter();
104         } else {
105
106                 switch (wheel_mode) {
107                 case WheelTimeline:
108                         text = "Time";
109                         break;
110                 case WheelScrub:
111                         text = "Scrb";
112                         break;
113                 case WheelShuttle:
114                         text = "Shtl";
115                         break;
116                 }
117
118                 switch (wheel_shift_mode) {
119                 case WheelShiftGain:
120                         text += ":Gain";
121                         break;
122
123                 case WheelShiftPan:
124                         text += ":Pan ";
125                         break;
126
127                 case WheelShiftMaster:
128                         text += ":Mstr";
129                         break;
130
131                 case WheelShiftMarker:
132                         text += ":Mrkr";
133                         break;
134                 }
135
136                 print (1, 0, text.c_str());
137         }
138 }