File: SelectedEventEntryPropertyDescriptor.cs

package info (click to toggle)
cadencii 3.3.9%2Bsvn20110818.r1732-2
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd, wheezy
  • size: 35,764 kB
  • ctags: 26,929
  • 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 (158 lines) | stat: -rw-r--r-- 5,088 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
#if ENABLE_PROPERTY
/*
 * SelectedEventEntryPropertyDescriptor.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.
 */
#if JAVA
package org.kbinani.cadencii;

import org.kbinani.*;
import org.kbinani.apputil.*;
import org.kbinani.componentmodel.*;

#else

using System;
using System.ComponentModel;
using System.Reflection;
using org.kbinani.apputil;

namespace org.kbinani.cadencii
{
    using boolean = System.Boolean;
#endif

#if JAVA
    public class SelectedEventEntryPropertyDescriptor extends PropertyDescriptor 
#else
    public class SelectedEventEntryPropertyDescriptor : PropertyDescriptor 
#endif
    {
#if !JAVA
        private Type m_type;

        public SelectedEventEntryPropertyDescriptor( MemberDescriptor md )
            : base( md ) {
            m_type = typeof( SelectedEventEntry );
        }

        public override boolean ShouldSerializeValue( Object component ) {
            return true;
        }

        public override void ResetValue( Object component ) {
        }

        public override void SetValue( Object component, Object value ) {
            PropertyInfo pi = m_type.GetProperty( this.Name );
            pi.SetValue( component, value, new Object[] { } );
        }

        public override Object GetValue( Object component ) {
            if ( component == null ) {
                return null;
            }
            PropertyInfo pi = m_type.GetProperty( base.Name );
            return pi.GetValue( component, new Object[] { } );
        }

        public override boolean CanResetValue( Object component ) {
            return false;
        }

        public override Type PropertyType {
            get {
                Type t = m_type.GetProperty( this.Name ).PropertyType;
                return t;
            }
        }

        public override Type ComponentType {
            get {
                return m_type;
            }
        }

        public override boolean IsReadOnly {
            get {
                return false;
            }
        }

        public override String DisplayName
        {
            get
            {
                return getDisplayName( base.Name );
            }
        }
#endif

        public String getDisplayName( String name )
        {
            if ( name.Equals( "Clock" ) ) {
                return _( "Clock" );
            } else if ( name.Equals( "Length" ) ) {
                return _( "Length" );
            } else if ( name.Equals( "Note" ) ) {
                return _( "Note#" );
            } else if ( name.Equals( "Velocity" ) ) {
                return _( "Velocity" );
            } else if ( name.Equals( "BendDepth" ) ) {
                return _( "Bend Depth" );
            } else if ( name.Equals( "BendLength" ) ) {
                return _( "Bend Length" );
            } else if ( name.Equals( "Decay" ) ) {
                return _( "Decay" );
            } else if ( name.Equals( "Accent" ) ) {
                return _( "Accent" );
            } else if ( name.Equals( "UpPortamento" ) ) {
                return _( "Up-Portamento" );
            } else if ( name.Equals( "DownPortamento" ) ) {
                return _( "Down-Portamento" );
            } else if ( name.Equals( "VibratoLength" ) ) {
                return _( "Vibrato Length" );
            } else if ( name.Equals( "PhoneticSymbol" ) ) {
                return _( "Phonetic Symbol" );
            } else if ( name.Equals( "Phrase" ) ) {
                return _( "Phrase" );
            } else if ( name.Equals( "PreUtterance" ) ) {
                return _( "Pre Utterance" );
            } else if ( name.Equals( "Overlap" ) ) {
                return _( "Overlap" );
            } else if ( name.Equals( "Moduration" ) ) {
                return _( "Moduration" );
            } else if ( name.Equals( "Vibrato" ) ) {
                return _( "Vibrato" );
            } else if ( name.Equals( "Attack" ) ) {
                return _( "Attack" );
            } else if ( name.Equals( "AttackDuration" ) ) {
                return _( "Attack Duration" );
            } else if ( name.Equals( "AttackDepth" ) ) {
                return _( "Attack Depth" );
            } else if ( str.compare( name, "StartPoint" ) ) {
                return _( "StartPoint" );
            } else if ( str.compare( name, "Intensity" ) ) {
                return _( "Intensity" );
            }
            return _( name );
        }

        private static String _( String id ) {
            return Messaging.getMessage( id );
        }
    }

#if !JAVA
}
#endif
#endif