1 /* Copyright 2000 Kjetil S. Matheussen
3 This program is free software; you can redistribute it and/or
4 modify it under the terms of the GNU General Public License
5 as published by the Free Software Foundation; either version 2
6 of the License, or (at your option) any later version.
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
13 You should have received a copy of the GNU General Public License
14 along with this program; if not, write to the Free Software
15 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
23 #include "nsmtracker.h"
24 #include "visual_proc.h"
27 #include "gfx_tempotrackheader_proc.h"
29 extern struct Root
*root
;
31 void UpdateTempoTrackHeader_reltempo(
32 struct Tracker_Windows
*window
,
33 struct WBlocks
*wblock
,
37 char *name
="RelTempoMax (RelTempoMin is 1/RelTempoMax)";
39 int numchars
=(wblock
->temponodearea
.x2
-wblock
->temponodearea
.x
)/window
->fontwidth
;
45 if(numchars
<=0) return;
47 presicion
=numchars
-(wblock
->reltempomax
>=10.0 ? 3:2);
53 presicion
=min(5,presicion
);
59 if(strlen(temp
)>numchars
){
67 wblock
->temponodearea
.x
+1,
69 wblock
->temponodearea
.x2
,
75 wblock
->temponodearea
.x
+1,
76 wblock
->a
.y1
+window
->org_fontheight
,false
79 sprintf(temp
,"%.*s",numchars
,name
);
80 if(numchars
<strlen(name
)-1){
81 cuttemp
=temp
[numchars
];
88 wblock
->temponodearea
.x
+1,
93 temp
[numchars
]=cuttemp
;
95 GFX_Line(window
,1,wblock
->temponodearea
.x
+1,wblock
->t
.y1
-1,wblock
->temponodearea
.x2
+1,wblock
->t
.y1
-1);
98 void UpdateTempoTrackHeader_LPB(
99 struct Tracker_Windows
*window
,
100 struct WBlocks
*wblock
,
107 wblock
->lpbTypearea
.x
+1,
111 sprintf(temp
,"%3d",root
->lpb
);
114 wblock
->lpbTypearea
.x
+1,
115 wblock
->a
.y1
+window
->org_fontheight
,false
120 void UpdateTempoTrackHeader_BPM(
121 struct Tracker_Windows
*window
,
122 struct WBlocks
*wblock
,
129 wblock
->tempoTypearea
.x
+1,
133 sprintf(temp
,"%3d",root
->tempo
);
136 wblock
->tempoTypearea
.x
+1,
137 wblock
->a
.y1
+window
->org_fontheight
,false
142 void UpdateTempoTrackHeader(
143 struct Tracker_Windows
*window
,
144 struct WBlocks
*wblock
146 UpdateTempoTrackHeader_LPB(window
,wblock
,2);
147 UpdateTempoTrackHeader_BPM(window
,wblock
,2);
148 UpdateTempoTrackHeader_reltempo(window
,wblock
,2);
151 void DrawTempoTrackHeader(
152 struct Tracker_Windows
*window
,
153 struct WBlocks
*wblock
157 wblock
->lpbTypearea
.x
+1,
159 wblock
->temponodearea
.x2
+3,
163 UpdateTempoTrackHeader_LPB(window
,wblock
,2);
164 UpdateTempoTrackHeader_BPM(window
,wblock
,2);
165 UpdateTempoTrackHeader_reltempo(window
,wblock
,2);