File: FormTempoConfig.cs

package info (click to toggle)
cadencii 3.3.9%2Bsvn20110818.r1732-5
  • links: PTS
  • area: main
  • in suites: stretch
  • size: 35,880 kB
  • sloc: cs: 160,836; java: 42,449; cpp: 7,605; ansic: 1,728; perl: 1,087; makefile: 236; php: 142; xml: 117; sh: 21
file content (356 lines) | stat: -rw-r--r-- 13,604 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
/*
 * FormTempoConfig.cs
 * Copyright © 2008-2011 kbinani
 *
 * This file is part of org.kbinani.cadencii.
 *
 * org.kbinani.cadencii is free software; you can redistribute it and/or
 * modify it under the terms of the GPLv3 License.
 *
 * org.kbinani.cadencii is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 */
#if JAVA
package org.kbinani.cadencii;

//INCLUDE-SECTION IMPORT ../BuildJavaUI/src/org/kbinani/cadencii/FormTempoConfig.java

import java.awt.event.*;
import org.kbinani.*;
import org.kbinani.apputil.*;
import org.kbinani.windows.forms.*;
#else
using System;
using org.kbinani.java.awt.event_;
using org.kbinani.apputil;
using org.kbinani.windows.forms;

namespace org.kbinani.cadencii
{
    using boolean = System.Boolean;
    using BEventArgs = System.EventArgs;
    using BEventHandler = System.EventHandler;
#endif

#if JAVA
    public class FormTempoConfig extends BDialog {
#else
    class FormTempoConfig : BDialog
    {
#endif
        public FormTempoConfig( int bar_count, int beat, int beat_max, int clock, int clock_max, float tempo, int pre_measure )
        {
#if JAVA
            super();
            initialize();
#else
            InitializeComponent();
#endif
            registerEventHandlers();
            setResources();
            applyLanguage();
            numBar.setMinimum( -pre_measure + 1 );
            numBar.setMaximum( 100000 );
            numBar.setFloatValue( bar_count );

            numBeat.setMinimum( 1 );
            numBeat.setMaximum( beat_max );
            numBeat.setFloatValue( beat );
            numClock.setMinimum( 0 );
            numClock.setMaximum( clock_max );
            numClock.setFloatValue( clock );
            numTempo.setFloatValue( tempo );
            Util.applyFontRecurse( this, AppManager.editorConfig.getBaseFont() );
        }

        #region public methods
        public void applyLanguage()
        {
            setTitle( _( "Global Tempo" ) );
            groupPosition.setTitle( _( "Position" ) );
            lblBar.setText( _( "Measure" ) );
            lblBar.setMnemonic( KeyEvent.VK_M, numBar );
            lblBeat.setText( _( "Beat" ) );
            lblBeat.setMnemonic( KeyEvent.VK_B, numBeat );
            lblClock.setText( _( "Clock" ) );
            lblClock.setMnemonic( KeyEvent.VK_L, numClock );
            groupTempo.setTitle( _( "Tempo" ) );
            btnOK.setText( _( "OK" ) );
            btnCancel.setText( _( "Cancel" ) );
        }

        public int getBeatCount()
        {
            return (int)numBeat.getFloatValue();
        }

        public int getClock()
        {
            return (int)numClock.getFloatValue();
        }

        public float getTempo()
        {
            return numTempo.getFloatValue();
        }
        #endregion

        #region event handlers
        public void btnOK_Click( Object sender, BEventArgs e )
        {
            setDialogResult( BDialogResult.OK );
        }

        public void btnCancel_Click( Object sender, BEventArgs e )
        {
            setDialogResult( BDialogResult.CANCEL );
        }
        #endregion

        #region helper methods
        private static String _( String id )
        {
            return Messaging.getMessage( id );
        }

        private void registerEventHandlers()
        {
            btnOK.Click += new BEventHandler( btnOK_Click );
            btnCancel.Click += new BEventHandler( btnCancel_Click );
        }

        private void setResources()
        {
        }
        #endregion

        #region ui implementation
#if JAVA
        //INCLUDE-SECTION FIELD ../BuildJavaUI/src/org/kbinani/cadencii/FormTempoConfig.java
        //INCLUDE-SECTION METHOD ../BuildJavaUI/src/org/kbinani/cadencii/FormTempoConfig.java
#else
        /// <summary>
        /// 必要なデザイナ変数です。
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// 使用中のリソースをすべてクリーンアップします。
        /// </summary>
        /// <param name="disposing">マネージ リソースが破棄される場合 true、破棄されない場合は false です。</param>
        protected override void Dispose( boolean disposing )
        {
            if ( disposing && (components != null) ) {
                components.Dispose();
            }
            base.Dispose( disposing );
        }

        #region Windows フォーム デザイナで生成されたコード

        /// <summary>
        /// デザイナ サポートに必要なメソッドです。このメソッドの内容を
        /// コード エディタで変更しないでください。
        /// </summary>
        private void InitializeComponent()
        {
            this.groupPosition = new BGroupBox();
            this.numClock = new org.kbinani.cadencii.NumericUpDownEx();
            this.numBeat = new org.kbinani.cadencii.NumericUpDownEx();
            this.numBar = new org.kbinani.cadencii.NumericUpDownEx();
            this.lblClock = new BLabel();
            this.lblBeat = new BLabel();
            this.lblBar = new BLabel();
            this.groupTempo = new BGroupBox();
            this.lblTempoRange = new BLabel();
            this.numTempo = new org.kbinani.cadencii.NumericUpDownEx();
            this.btnOK = new BButton();
            this.btnCancel = new BButton();
            this.groupPosition.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)(this.numClock)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.numBeat)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.numBar)).BeginInit();
            this.groupTempo.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)(this.numTempo)).BeginInit();
            this.SuspendLayout();
            // 
            // groupPosition
            // 
            this.groupPosition.Controls.Add( this.numClock );
            this.groupPosition.Controls.Add( this.numBeat );
            this.groupPosition.Controls.Add( this.numBar );
            this.groupPosition.Controls.Add( this.lblClock );
            this.groupPosition.Controls.Add( this.lblBeat );
            this.groupPosition.Controls.Add( this.lblBar );
            this.groupPosition.Location = new System.Drawing.Point( 11, 10 );
            this.groupPosition.Name = "groupPosition";
            this.groupPosition.Size = new System.Drawing.Size( 147, 113 );
            this.groupPosition.TabIndex = 0;
            this.groupPosition.TabStop = false;
            this.groupPosition.Text = "Position";
            // 
            // numClock
            // 
            this.numClock.Location = new System.Drawing.Point( 90, 77 );
            this.numClock.Name = "numClock";
            this.numClock.Size = new System.Drawing.Size( 45, 19 );
            this.numClock.TabIndex = 5;
            // 
            // numBeat
            // 
            this.numBeat.Location = new System.Drawing.Point( 90, 48 );
            this.numBeat.Name = "numBeat";
            this.numBeat.Size = new System.Drawing.Size( 45, 19 );
            this.numBeat.TabIndex = 4;
            // 
            // numBar
            // 
            this.numBar.Enabled = false;
            this.numBar.Location = new System.Drawing.Point( 90, 19 );
            this.numBar.Name = "numBar";
            this.numBar.Size = new System.Drawing.Size( 45, 19 );
            this.numBar.TabIndex = 3;
            // 
            // lblClock
            // 
            this.lblClock.AutoSize = true;
            this.lblClock.Location = new System.Drawing.Point( 12, 79 );
            this.lblClock.Name = "lblClock";
            this.lblClock.Size = new System.Drawing.Size( 48, 12 );
            this.lblClock.TabIndex = 2;
            this.lblClock.Text = "Clock(&L)";
            // 
            // lblBeat
            // 
            this.lblBeat.AutoSize = true;
            this.lblBeat.Location = new System.Drawing.Point( 12, 50 );
            this.lblBeat.Name = "lblBeat";
            this.lblBeat.Size = new System.Drawing.Size( 45, 12 );
            this.lblBeat.TabIndex = 1;
            this.lblBeat.Text = "Beat(&B)";
            // 
            // lblBar
            // 
            this.lblBar.AutoSize = true;
            this.lblBar.Location = new System.Drawing.Point( 12, 21 );
            this.lblBar.Name = "lblBar";
            this.lblBar.Size = new System.Drawing.Size( 65, 12 );
            this.lblBar.TabIndex = 0;
            this.lblBar.Text = "Measure(&M)";
            // 
            // groupTempo
            // 
            this.groupTempo.Controls.Add( this.lblTempoRange );
            this.groupTempo.Controls.Add( this.numTempo );
            this.groupTempo.Location = new System.Drawing.Point( 173, 10 );
            this.groupTempo.Name = "groupTempo";
            this.groupTempo.Size = new System.Drawing.Size( 143, 113 );
            this.groupTempo.TabIndex = 1;
            this.groupTempo.TabStop = false;
            this.groupTempo.Text = "Tempo";
            // 
            // lblTempoRange
            // 
            this.lblTempoRange.AutoSize = true;
            this.lblTempoRange.Location = new System.Drawing.Point( 78, 21 );
            this.lblTempoRange.Name = "lblTempoRange";
            this.lblTempoRange.Size = new System.Drawing.Size( 61, 12 );
            this.lblTempoRange.TabIndex = 6;
            this.lblTempoRange.Text = "(20 to 300)";
            // 
            // numTempo
            // 
            this.numTempo.DecimalPlaces = 2;
            this.numTempo.Location = new System.Drawing.Point( 13, 19 );
            this.numTempo.Maximum = new decimal( new int[] {
            300,
            0,
            0,
            0} );
            this.numTempo.Minimum = new decimal( new int[] {
            20,
            0,
            0,
            0} );
            this.numTempo.Name = "numTempo";
            this.numTempo.Size = new System.Drawing.Size( 59, 19 );
            this.numTempo.TabIndex = 5;
            this.numTempo.Value = new decimal( new int[] {
            120,
            0,
            0,
            0} );
            // 
            // btnOK
            // 
            this.btnOK.Location = new System.Drawing.Point( 156, 132 );
            this.btnOK.Name = "btnOK";
            this.btnOK.Size = new System.Drawing.Size( 75, 23 );
            this.btnOK.TabIndex = 2;
            this.btnOK.Text = "OK";
            this.btnOK.UseVisualStyleBackColor = true;
            // 
            // btnCancel
            // 
            this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
            this.btnCancel.Location = new System.Drawing.Point( 241, 132 );
            this.btnCancel.Name = "btnCancel";
            this.btnCancel.Size = new System.Drawing.Size( 75, 23 );
            this.btnCancel.TabIndex = 3;
            this.btnCancel.Text = "Cancel";
            this.btnCancel.UseVisualStyleBackColor = true;
            // 
            // FormTempoConfig
            // 
            this.AcceptButton = this.btnOK;
            this.AutoScaleDimensions = new System.Drawing.SizeF( 6F, 12F );
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.CancelButton = this.btnCancel;
            this.ClientSize = new System.Drawing.Size( 332, 164 );
            this.Controls.Add( this.btnCancel );
            this.Controls.Add( this.btnOK );
            this.Controls.Add( this.groupTempo );
            this.Controls.Add( this.groupPosition );
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
            this.MaximizeBox = false;
            this.MinimizeBox = false;
            this.Name = "FormTempoConfig";
            this.ShowIcon = false;
            this.ShowInTaskbar = false;
            this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
            this.Text = "Global Tempo";
            this.groupPosition.ResumeLayout( false );
            this.groupPosition.PerformLayout();
            ((System.ComponentModel.ISupportInitialize)(this.numClock)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.numBeat)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.numBar)).EndInit();
            this.groupTempo.ResumeLayout( false );
            this.groupTempo.PerformLayout();
            ((System.ComponentModel.ISupportInitialize)(this.numTempo)).EndInit();
            this.ResumeLayout( false );

        }

        #endregion

        private BGroupBox groupPosition;
        private BLabel lblClock;
        private BLabel lblBeat;
        private BLabel lblBar;
        private BGroupBox groupTempo;
        private BButton btnOK;
        private BButton btnCancel;
        private NumericUpDownEx numBar;
        private NumericUpDownEx numClock;
        private NumericUpDownEx numBeat;
        private BLabel lblTempoRange;
        private NumericUpDownEx numTempo;
#endif
        #endregion

    }

#if !JAVA
}
#endif