OSDN Git Service

Ring 1.10 以来となる開発環境の日本語ローカライズ版 (評価版) を追加 (ノートパッド、フォームデザイナー、対話型実行環境、ファイルの検索)。
[ring-lang-081/ring.git] / applications / build / ja-jp / rnote / rnoteinserttext.ring
diff --git a/applications/build/ja-jp/rnote/rnoteinserttext.ring b/applications/build/ja-jp/rnote/rnoteinserttext.ring
new file mode 100644 (file)
index 0000000..6627e1c
--- /dev/null
@@ -0,0 +1,78 @@
+oInsert        = NULL
+templateList   = NULL
+
+load "templates.ring"
+
+class RNoteInsertText
+
+       func OpenInsertWindow
+
+               oInsert = new QWidget() {
+                       setwindowtitle("テキストの挿入")
+                       resize(400,350)
+                       setwindowflags(Qt_WindowStaysOnTopHint)
+
+
+                       templateLabel = new QLabel(oInsert) {
+                               setGeometry(50,30,100,20)
+                               settext("挿入するテキスト : ")
+                       }
+          
+                       templateList = new QListWidget(oInsert) {
+                               setGeometry(150,30,200,200)
+                               for aCodeTemplate in aCodeTemplates
+                                       addItem(aCodeTemplate[1])
+                               next    
+                               templateList.setitemactivatedEvent(Method(:insertText))
+                       }
+                       BtntnOk = new qpushbutton(oInsert) {
+                               setgeometry(180,250,50,50)
+                               setText(T_FROMDESIGNER_WF_OK)
+                               setClickEvent(Method(:insertText))
+                       }
+
+                       BtnCancel = new qpushbutton(oInsert) {
+                               setgeometry(250,250,50,50)
+                               setText(T_FROMDESIGNER_WF_CANCEL)
+                               setClickEvent(Method(:pCancel))
+                       }
+
+                       oInsertLayout1 = new qVBoxlayout() {
+                               AddWidget(templateLabel)
+                               AddWidget(templateList)
+                       }
+
+                       oInsertLayout2 = new qVBoxlayout() {
+                               AddWidget(BtntnOk)
+                               AddWidget(BtnCancel)
+                       }
+
+                       LayoutButtonMain = new QHBoxLayout()                    
+                       LayoutButtonMain.AddLayout(oInsertLayout1)
+                       LayoutButtonMain.AddLayout(oInsertLayout2)
+
+                       setLayout(LayoutButtonMain)
+                       setwindowflags(Qt_CustomizeWindowHint | Qt_WindowTitleHint) 
+                       show()
+
+               }
+
+       func insertText
+
+               nr = templateList.currentRow()+1
+               function = aCodeTemplates[nr][2]
+               output = call function()
+               cTextContent = textedit1.toplaintext()
+               oCursor = textedit1.textcursor()
+               nPosStart = oCursor.Position()
+               nPosEnd = len(cTextContent) - nPosStart
+               cNewContent = substr(cTextContent,1,nPosStart)+ output +
+                       substr(cTextContent,nPosStart+1,nPosEnd)
+               textedit1.setPlaintext(cNewContent)
+               oCursor.setposition(nPosStart+len(output),0)
+               textedit1.settextcursor(oCursor)
+
+       func pCancel
+
+               oInsert.close()