File: FormAskKeySoundGenerationUiImpl.cs

package info (click to toggle)
cadencii 3.3.9%2Bsvn20110818.r1732-6
  • links: PTS
  • area: main
  • in suites: buster
  • size: 35,916 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 (250 lines) | stat: -rw-r--r-- 8,485 bytes parent folder | download | duplicates (5)
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
/*
 * FormAskKeySoundGenerationUiImpl.cs
 * Copyright © 2010-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.
 */
using System;

using System.Windows.Forms;
using org.kbinani.apputil;

namespace org.kbinani.cadencii
{

    public class FormAskKeySoundGenerationUiImpl : Form, FormAskKeySoundGenerationUi
    {
        private FormAskKeySoundGenerationUiListener mListener;

        public FormAskKeySoundGenerationUiImpl( FormAskKeySoundGenerationUiListener controller )
        {
            InitializeComponent();
            mListener = controller;
            registerEventHandlers();
            Util.applyFontRecurse( this, AppManager.editorConfig.getBaseFont() );
        }


        #region FormAskKeySoundGenerationUiインターフェースの実装
        
        /// <summary>
        /// メッセージの文字列を設定します.
        /// </summary>
        /// <param name="value">設定する文字列.</param>
        public void setMessageLabelText( string value )
        {
            lblMessage.Text = value;
        }

        public void setAlwaysPerformThisCheckCheckboxText( string value )
        {
            chkAlwaysPerformThisCheck.Text = value;
        }

        public void setYesButtonText( string value )
        {
            btnYes.Text = value;
        }

        public void setNoButtonText( string value )
        {
            btnNo.Text = value;
        }

        public void setAlwaysPerformThisCheck( bool value )
        {
            chkAlwaysPerformThisCheck.Checked = value;
        }

        public bool isAlwaysPerformThisCheck()
        {
            return chkAlwaysPerformThisCheck.Checked;
        }

        #endregion



        #region UiBaseインターフェースの実装

        public int showDialog( Object parent_form )
        {
            DialogResult ret;
            if ( parent_form == null || (parent_form != null && !(parent_form is Form)) )
            {
                ret = base.ShowDialog();
            }
            else
            {
                Form form = (Form)parent_form;
                ret = base.ShowDialog( form );
            }
            if ( ret == DialogResult.OK || ret == DialogResult.Yes )
            {
                return 1;
            }
            else
            {
                return 0;
            }
        }

        #endregion



        #region public methods
        /// <summary>
        /// フォームを閉じます.
        /// valueがtrueのときダイアログの結果をCancelに,それ以外の場合はOKとなるようにします.
        /// </summary>
        public void close( bool value )
        {
            if ( value )
            {
                this.DialogResult = DialogResult.Cancel;
            }
            else
            {
                this.DialogResult = DialogResult.OK;
            }
        }
        #endregion



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

        private void registerEventHandlers()
        {
            btnYes.Click += new EventHandler( btnYes_Click );
            btnNo.Click += new EventHandler( btnNo_Click );
        }
        
        #endregion



        #region event handlers

        private void btnYes_Click( Object sender, EventArgs e )
        {
            mListener.buttonOkClickedSlot();
        }

        private void btnNo_Click( Object sender, EventArgs e )
        {
            mListener.buttonCancelClickedSlot();
        }
        #endregion



        #region UI implementation
        
        private void InitializeComponent()
        {
            this.btnNo = new Button();
            this.btnYes = new Button();
            this.chkAlwaysPerformThisCheck = new CheckBox();
            this.lblMessage = new Label();
            this.SuspendLayout();
            // 
            // btnNo
            // 
            this.btnNo.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
            this.btnNo.DialogResult = System.Windows.Forms.DialogResult.Cancel;
            this.btnNo.Location = new System.Drawing.Point( 183, 112 );
            this.btnNo.Name = "btnNo";
            this.btnNo.Size = new System.Drawing.Size( 75, 23 );
            this.btnNo.TabIndex = 5;
            this.btnNo.Text = "No";
            this.btnNo.UseVisualStyleBackColor = true;
            // 
            // btnYes
            // 
            this.btnYes.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
            this.btnYes.DialogResult = System.Windows.Forms.DialogResult.Cancel;
            this.btnYes.Location = new System.Drawing.Point( 63, 112 );
            this.btnYes.Name = "btnYes";
            this.btnYes.Size = new System.Drawing.Size( 75, 23 );
            this.btnYes.TabIndex = 4;
            this.btnYes.Text = "Yes";
            this.btnYes.UseVisualStyleBackColor = true;
            // 
            // chkAlwaysPerformThisCheck
            // 
            this.chkAlwaysPerformThisCheck.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
            this.chkAlwaysPerformThisCheck.AutoSize = true;
            this.chkAlwaysPerformThisCheck.Checked = true;
            this.chkAlwaysPerformThisCheck.CheckState = System.Windows.Forms.CheckState.Checked;
            this.chkAlwaysPerformThisCheck.Location = new System.Drawing.Point( 14, 77 );
            this.chkAlwaysPerformThisCheck.Name = "chkAlwaysPerformThisCheck";
            this.chkAlwaysPerformThisCheck.Size = new System.Drawing.Size( 284, 16 );
            this.chkAlwaysPerformThisCheck.TabIndex = 6;
            this.chkAlwaysPerformThisCheck.Text = "Always perform this check when starting Cadencii.";
            this.chkAlwaysPerformThisCheck.UseVisualStyleBackColor = true;
            // 
            // lblMessage
            // 
            this.lblMessage.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
                        | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.lblMessage.AutoEllipsis = true;
            this.lblMessage.Location = new System.Drawing.Point( 12, 21 );
            this.lblMessage.Name = "lblMessage";
            this.lblMessage.Size = new System.Drawing.Size( 302, 53 );
            this.lblMessage.TabIndex = 7;
            this.lblMessage.Text = "It seems some key-board sounds are missing. Do you want to re-generate them now?";
            // 
            // FormAskKeySoundGeneration
            // 
            this.CancelButton = this.btnNo;
            this.ClientSize = new System.Drawing.Size( 326, 147 );
            this.Controls.Add( this.lblMessage );
            this.Controls.Add( this.chkAlwaysPerformThisCheck );
            this.Controls.Add( this.btnNo );
            this.Controls.Add( this.btnYes );
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
            this.MaximizeBox = false;
            this.MinimizeBox = false;
            this.Name = "FormAskKeySoundGeneration";
            this.ShowIcon = false;
            this.ShowInTaskbar = false;
            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
            this.ResumeLayout( false );
            this.PerformLayout();

        }

        private Button btnNo;
        private CheckBox chkAlwaysPerformThisCheck;
        private Label lblMessage;
        private Button btnYes;

        #endregion
    }

#if JAVA

#elif __cplusplus

} } }

#else

}

#endif