OSDN Git Service

Ring 1.10 以来となる開発環境の日本語ローカライズ版 (評価版) を追加 (ノートパッド、フォームデザイナー、対話型実行環境、ファイルの検索)。
[ring-lang-081/ring.git] / applications / formdesigner / source / controls / qtextedit.ring
1 /*
2 **      Project : Form Designer 
3 **      File Purpose :  QTextEdit Control
4 **      Date : 2017.04.29
5 **      Author :  Mahmoud Fayed <msfclipper@yahoo.com>
6 */
7
8 package formdesigner
9
10 # We use QLineEdit as parent - We need just the looking (not functionality)
11 class FormDesigner_QTextEdit from QLineEdit
12
13         CreateCommonAttributes()
14         CreateMoveResizeCornersAttributes()
15
16         cText = ""
17
18         ccopyAvailableEvent = ""
19         ccurrentCharFormatChangedEvent = ""
20         ccursorPositionChangedEvent = ""
21         credoAvailableEvent = ""
22         cselectionChangedEvent = ""
23         ctextChangedEvent = ""
24         cundoAvailableEvent = ""
25
26         cBackColor = "white"
27
28         func TextValue
29                 return cText
30
31         func SetTextValue value
32                 cText = value
33
34         func SetcopyAvailableEventCode cValue
35                 ccopyAvailableEvent = cValue
36
37         func copyAvailableEventCode
38                 return ccopyAvailableEvent
39
40         func SetcurrentCharFormatChangedEventCode cValue
41                 ccurrentCharFormatChangedEvent = cValue
42
43         func currentCharFormatChangedEventCode
44                 return ccurrentCharFormatChangedEvent
45
46         func SetcursorPositionChangedEventCode cValue
47                 ccursorPositionChangedEvent = cValue
48
49         func cursorPositionChangedEventCode
50                 return ccursorPositionChangedEvent
51
52         func SetredoAvailableEventCode cValue
53                 credoAvailableEvent = cValue
54
55         func redoAvailableEventCode
56                 return credoAvailableEvent
57
58         func SetselectionChangedEventCode cValue
59                 cselectionChangedEvent = cValue
60
61         func selectionChangedEventCode
62                 return cselectionChangedEvent
63
64         func SettextChangedEventCode cValue
65                 ctextChangedEvent = cValue
66
67         func textChangedEventCode
68                 return ctextChangedEvent
69
70         func SetundoAvailableEventCode cValue
71                 cundoAvailableEvent = cValue
72
73         func undoAvailableEventCode
74                 return cundoAvailableEvent
75
76         func AddObjectProperties  oDesigner
77                 AddObjectCommonProperties(oDesigner)
78                 oDesigner.oView.AddProperty(T_FORMDESIGNER_ATTRIBUTE_TEXT,False)                                # "Text"
79                 oDesigner.oView.AddProperty(T_FORMDESIGNER_ATTRIBUTE_COPYAVAILABLEEVENT,False)                  # "copyAvailableEvent"
80                 oDesigner.oView.AddProperty(T_FORMDESIGNER_ATTRIBUTE_CURRENTCHARFORMATCHANGEDEVENT,False)       # "currentCharFormatChangedEvent"
81                 oDesigner.oView.AddProperty(T_FORMDESIGNER_ATTRIBUTE_CURSORPOSITIONCHANGEDEVENT,False)          # "cursorPositionChangedEvent"
82                 oDesigner.oView.AddProperty(T_FORMDESIGNER_ATTRIBUTE_REDOAVAIABLEEVENT,False)                   # "redoAvailableEvent"
83                 oDesigner.oView.AddProperty(T_FORMDESIGNER_ATTRIBUTE_SELECTIONCHANGEDEVENT,False)               # "selectionChangedEvent"
84                 oDesigner.oView.AddProperty(T_FORMDESIGNER_ATTRIBUTE_TEXTCHANGEDEVENT,False)                    # "textChangedEvent"
85                 oDesigner.oView.AddProperty(T_FORMDESIGNER_ATTRIBUTE_UNDOAVAILABLEEVENT,False)                  # "undoAvailableEvent"
86
87         func DisplayProperties oDesigner
88                 DisplayCommonProperties(oDesigner)
89                 oPropertiesTable = oDesigner.oView.oPropertiesTable
90                 oPropertiesTable.Blocksignals(True)
91                 # Set the Text
92                         oPropertiesTable.item(C_AFTERCOMMON,1).settext(TextValue())
93                 oPropertiesTable.item(C_AFTERCOMMON+1,1).settext(copyAvailableEventcode())
94                 oPropertiesTable.item(C_AFTERCOMMON+2,1).settext(currentCharFormatChangedEventcode())
95                 oPropertiesTable.item(C_AFTERCOMMON+3,1).settext(cursorPositionChangedEventcode())
96                 oPropertiesTable.item(C_AFTERCOMMON+4,1).settext(redoAvailableEventcode())
97                 oPropertiesTable.item(C_AFTERCOMMON+5,1).settext(selectionChangedEventcode())
98                 oPropertiesTable.item(C_AFTERCOMMON+6,1).settext(textChangedEventcode())
99                 oPropertiesTable.item(C_AFTERCOMMON+7,1).settext(undoAvailableEventcode())
100                 oPropertiesTable.Blocksignals(False)
101                 # Set the object name
102                         setText(oDesigner.oModel.GetObjectName(self))
103
104         func UpdateProperties oDesigner,nRow,nCol,cValue
105                 UpdateCommonProperties(oDesigner,nRow,nCol,cValue)
106                 if nCol = 1 {
107                         switch nRow {
108                                 case C_AFTERCOMMON
109                                         setTextValue(cValue)
110                                 case C_AFTERCOMMON+1
111                                         setcopyAvailableEventCode(cValue)
112                                 case C_AFTERCOMMON+2
113                                         setcurrentCharFormatChangedEventCode(cValue)
114                                 case C_AFTERCOMMON+3
115                                         setcursorPositionChangedEventCode(cValue)
116                                 case C_AFTERCOMMON+4
117                                         setredoAvailableEventCode(cValue)
118                                 case C_AFTERCOMMON+5
119                                         setselectionChangedEventCode(cValue)
120                                 case C_AFTERCOMMON+6
121                                         settextChangedEventCode(cValue)
122                                 case C_AFTERCOMMON+7
123                                         setundoAvailableEventCode(cValue)
124                         }
125                 }
126                 # Set the object name
127                         setText(oDesigner.oModel.GetObjectName(self))
128
129         func ObjectDataAsString oDesigner,nTabsCount
130                 cOutput = ObjectDataAsString2(oDesigner,nTabsCount)
131                 cTabs = std_copy(char(9),nTabsCount)
132                 cOutput += "," + nl + cTabs + ' :text =  "' + oDesigner.PrepareStringForFormFile(TextValue()) + '"'
133                 cOutput += "," + nl + cTabs + ' :setcopyAvailableEvent =  "' + oDesigner.PrepareStringForFormFile(copyAvailableEventCode()) + '"'
134                 cOutput += "," + nl + cTabs + ' :setcurrentCharFormatChangedEvent =  "' + oDesigner.PrepareStringForFormFile(currentCharFormatChangedEventCode()) + '"'
135                 cOutput += "," + nl + cTabs + ' :setcursorPositionChangedEvent =  "' + oDesigner.PrepareStringForFormFile(cursorPositionChangedEventCode()) + '"'
136                 cOutput += "," + nl + cTabs + ' :setredoAvailableEvent =  "' + oDesigner.PrepareStringForFormFile(redoAvailableEventCode()) + '"'
137                 cOutput += "," + nl + cTabs + ' :setselectionChangedEvent =  "' + oDesigner.PrepareStringForFormFile(selectionChangedEventCode()) + '"'
138                 cOutput += "," + nl + cTabs + ' :settextChangedEvent =  "' + oDesigner.PrepareStringForFormFile(textChangedEventCode()) + '"'
139                 cOutput += "," + nl + cTabs + ' :setundoAvailableEvent =  "' + oDesigner.PrepareStringForFormFile(undoAvailableEventCode()) + '"'
140                 return cOutput
141
142         func GenerateCustomCode oDesigner
143                 cOutput = ""
144                 cOutput += 'setText("#{f1}")' + nl
145                 cOutput = substr(cOutput,"#{f1}",oDesigner.PrepareStringForFormFile(textValue()))
146                 cOutput += 'setcopyAvailableEvent("#{f1}")' + nl
147                 cOutput = PrepareEvent(cOutput,copyAvailableEventCode(),"#{f1}")
148                 cOutput = substr(cOutput,"#{f1}",copyAvailableEventCode())
149                 cOutput += 'setcurrentCharFormatChangedEvent("#{f1}")' + nl
150                 cOutput = PrepareEvent(cOutput,currentCharFormatChangedEventCode(),"#{f1}")
151                 cOutput = substr(cOutput,"#{f1}",currentCharFormatChangedEventCode())
152                 cOutput += 'setcursorPositionChangedEvent("#{f1}")' + nl
153                 cOutput = PrepareEvent(cOutput,cursorPositionChangedEventCode(),"#{f1}")
154                 cOutput = substr(cOutput,"#{f1}",cursorPositionChangedEventCode())
155                 cOutput += 'setredoAvailableEvent("#{f1}")' + nl
156                 cOutput = PrepareEvent(cOutput,redoAvailableEventCode(),"#{f1}")
157                 cOutput = substr(cOutput,"#{f1}",redoAvailableEventCode())
158                 cOutput += 'setselectionChangedEvent("#{f1}")' + nl
159                 cOutput = PrepareEvent(cOutput,selectionChangedEventCode(),"#{f1}")
160                 cOutput = substr(cOutput,"#{f1}",selectionChangedEventCode())
161                 cOutput += 'settextChangedEvent("#{f1}")' + nl
162                 cOutput = PrepareEvent(cOutput,textChangedEventCode(),"#{f1}")
163                 cOutput = substr(cOutput,"#{f1}",textChangedEventCode())
164                 cOutput += 'setundoAvailableEvent("#{f1}")' + nl
165                 cOutput = PrepareEvent(cOutput,undoAvailableEventCode(),"#{f1}")
166                 cOutput = substr(cOutput,"#{f1}",undoAvailableEventCode())
167                 return cOutput
168
169         func RestoreProperties oDesigner,Item
170                 RestoreCommonProperties(oDesigner,item)
171                 itemdata = item[:data]
172                 setTextValue(itemdata[:text])
173                 setText(oDesigner.oModel.GetObjectName(self))
174                 SetcopyAvailableEventCode(itemdata[:setcopyAvailableEvent])
175                 SetcurrentCharFormatChangedEventCode(itemdata[:setcurrentCharFormatChangedEvent])
176                 SetcursorPositionChangedEventCode(itemdata[:setcursorPositionChangedEvent])
177                 SetredoAvailableEventCode(itemdata[:setredoAvailableEvent])
178                 SetselectionChangedEventCode(itemdata[:setselectionChangedEvent])
179                 SettextChangedEventCode(itemdata[:settextChangedEvent])
180                 SetundoAvailableEventCode(itemdata[:setundoAvailableEvent])
181