Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
kuina committed Jul 18, 2018
2 parents d8f8ef7 + 33fbce0 commit 349b0c5
Show file tree
Hide file tree
Showing 19 changed files with 390 additions and 52 deletions.
13 changes: 12 additions & 1 deletion package/readme.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
-------------------------------------------------------------------------------
Kuin Programming Language
v.2018.6.17
v.2018.7.17
(C) Kuina-chan
-------------------------------------------------------------------------------

Expand Down Expand Up @@ -43,6 +43,17 @@ v.2018.6.17
4. 変更履歴
-------------------------------------------------------------------------------

v.2018.7.17
- よく使うコードを簡単に挿入できる、スニペット機能の追加
- 互換性が失われる変更
- [email protected][email protected]に変更
- 細かな機能追加
- [email protected][email protected]
[email protected]メソッドの追加
- [email protected][email protected]イベントの追加
- 細かな不具合の修正
- math@lcm関数に渡す値が大きいとオーバーフローする不具合の修正

v.2018.6.17
- 互換性が失われる変更
- 「+**」構文の廃止と、オーバーライド元メソッドを参照する「super」構文の
Expand Down
Binary file modified package/samples/0000_kuinvaders/res/title.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified package/sys/dbg/d1003.knd
Binary file not shown.
Binary file modified package/sys/rls/d1003.knd
Binary file not shown.
49 changes: 49 additions & 0 deletions package/sys/snippet.knd
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?xml version="1.0" encoding="UTF-8"?>
<snippets>
<snippet>
<name>mainと空のウインドウ</name>
<code>var wndMain: wnd@Wnd

func main()
do @wndMain :: wnd@makeWnd(null, %normal, 800, 450, "Title")

while(wnd@act())
end while
end func
</code>
</snippet>
<snippet>
<name>mainとdrawコントロール</name>
<code>var wndMain: wnd@Wnd
var drawMain: wnd@Draw

func main()
do @wndMain :: wnd@makeWnd(null, %aspect, 1600, 900, "Title")
do @drawMain :: wnd@makeDraw(@wndMain, 0, 0, 1600, 900, %scale, %scale, false)

while(wnd@act())
do draw@render(60)
end while
end func
</code>
</snippet>
<snippet>
<name>listの走査</name>
<code>do _0.head()
while(!_0.term())
var _1: _2 :: _0.get()

do _0.next()
end while
</code>
</snippet>
<snippet>
<name>dictの走査</name>
<code>do _0.forEach(_1, null)

func _1(key: _2, value: _3, data: kuin@Class): bool
ret true
end func
</code>
</snippet>
</snippets>
13 changes: 12 additions & 1 deletion package/sys/wnd.kn
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,10 @@ end enum
+func [d0001.knd, _wndBaseFocused] focused(): bool
end func

+func [d0001.knd, _wndBaseEnable] enable(isEnabled: bool)
+func [d0001.knd, _wndBaseSetEnabled] setEnabled(isEnabled: bool)
end func

+func [d0001.knd, _wndBaseGetEnabled] getEnabled(): bool
end func

+func [d0001.knd, _wndBaseSetPos] setPos(x: int, y: int, width: int, height: int)
Expand All @@ -68,6 +71,9 @@ end enum
+func [d0001.knd, _wndBaseSetVisible] setVisible(isVisible: bool)
end func

+func [d0001.knd, _wndBaseGetVisible] getVisible(): bool
end func

+func [d0001.knd, _wndBaseClientToScreen] clientToScreen(screenX: &int, screenY: &int, clientX: int, clientY: int)
end func

Expand Down Expand Up @@ -429,6 +435,9 @@ end class
+func [d0001.knd, _listViewLenColumn] lenColumn(): int
end func

+func [d0001.knd, _listViewClearColumn] clearColumn()
end func

+func [d0001.knd, _listViewSetText] setText(idx: int, column: int, text: []char)
end func

Expand All @@ -444,7 +453,9 @@ end class
+func [d0001.knd, _listViewGetSel] getSel(): int
end func

+var onSel: func<(@WndBase)>
+var onMouseDoubleClick: func<(@WndBase)>
+var onMouseClick: func<(@WndBase)>
end class

+class Pager(@WndBase)
Expand Down
2 changes: 1 addition & 1 deletion package/sys/wndex.kn
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ end func
do result.name :: parseStr(node, "name")
if(!isRoot)
if(!parseBool(node, "enabled"))
do result.enable(false)
do result.setEnabled(false)
end if
if(!parseBool(node, "visible"))
do result.setVisible(false)
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ EXPORT Bool Interpret2(const U8* path, const void*(*func_get_src)(const U8*), co
EXPORT void Version(S64* major, S64* minor, S64* micro)
{
*major = 2018;
*minor = 6;
*minor = 7;
*micro = 17;
}

Expand Down
11 changes: 10 additions & 1 deletion src/kuin_editor/doc.kn
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,13 @@
+func treeItemOnMoveNode()
end func

+func listInfoOnSel()
+func listObjOnSel()
end func

+func listPropOnSel(listView: wnd@ListView)
end func

+func listPropOnMouseClick(listView: wnd@ListView)
end func

+func listPropOnMouseDoubleClick(listView: wnd@ListView)
Expand Down Expand Up @@ -105,6 +111,9 @@
+func undoImpl(undo2: @UndoCmd)
end func

+func getSelCode(): []char
end func

+var changed: bool
var undo: undo@Undo
end class
Expand Down
12 changes: 9 additions & 3 deletions src/kuin_editor/doc_ar.kn
Original file line number Diff line number Diff line change
Expand Up @@ -187,11 +187,17 @@
end func
end func

+*func listInfoOnSel()
var sel: int :: \form@listInfo.getSel()
+*func listObjOnSel()
var sel: int :: \form@listObj.getSel()
do me.ctrl :: sel < 0 ?(0, sel)
end func

+*func listPropOnSel(listView: wnd@ListView)
end func

+*func listPropOnMouseClick(listView: wnd@ListView)
end func

+*func listPropOnMouseDoubleClick(listView: wnd@ListView)
if(^me.holds = 0)
ret
Expand Down Expand Up @@ -285,7 +291,7 @@
do \form@showMsgRunning()
ret
end if
var name: []char :: \form@listInfo.getText(me.ctrl)
var name: []char :: \form@listObj.getText(me.ctrl)
do me.mode :: %put
do me.holdOffsetX :: x2
do me.holdOffsetY :: y2
Expand Down
69 changes: 56 additions & 13 deletions src/kuin_editor/doc_src.kn
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ end func
end func

+*func updateList(list_: wnd@List)
; TODO:
do \snippet@updateList(list_)
end func

+*func treeItemOnSel()
Expand All @@ -208,19 +208,37 @@ end func
; TODO:
end func

+*func listInfoOnSel()
; TODO:
{
var sel: int :: \[email protected]()
if(sel <> -1 & sel < ^me.listInfoItem)
do me.listInfoItem.head()
var item: @ErrListItem :: me.listInfoItem.getOffset(sel)
if(\src@jumpSrc(item.pos))
do me.propText :: item.text
do \form@updateProp()
end if
+*func listObjOnSel()
var sel: int :: \[email protected]()
if(sel = -1)
ret
end if
var code: []char :: \snippet@getCode(\[email protected](sel))
if(code =& null)
do \form@updateList()
ret
end if
do me.undo.recordBegin()
if(me.areaSel())
do me.delAreaStr()
end if
do me.ins(me.cursorX, me.cursorY, code, true)
do me.interpret1SetDirty(me.cursorY, true)
do me.undo.recordEnd()
do me.refreshCursor(false, true)
do \form@paintDrawEditor()
end func

+*func listPropOnSel(listView: wnd@ListView)
end func

+*func listPropOnMouseClick(listView: wnd@ListView)
var sel: int :: listView.getSel()
if(sel <> -1 & sel < ^me.errList)
do me.errList.head()
var item: @ErrListItem :: me.errList.getOffset(sel)
do \src@jumpSrc(item.pos)
end if
}
end func

+*func mouseDownL(x: int, y: int)
Expand Down Expand Up @@ -634,6 +652,31 @@ end func
end if
end func

+*func getSelCode(): []char
if(!me.areaSel())
ret null
end if
var x1: int :: me.areaX
var y1: int :: me.areaY
var x2: int :: me.cursorX
var y2: int :: me.cursorY
if(y1 > y2 | y1 = y2 & x1 > x2)
do x1 :$ x2
do y1 :$ y2
end if
var str: []char
if(y1 = y2)
do str :: me.src.src[y1].sub(x1, x2 - x1).trim()
else
do str :: me.src.src[y1].sub(x1, -1).trim() ~ "\n"
for i(y1 + 1, y2 - 1)
do str :~ me.src.src[i].trim() ~ "\n"
end for
do str :~ me.src.src[y2].sub(0, x2).trim()
end if
ret str
end func

func setSrc(src: [][]char)
if(src =& null | ^src = 0)
do me.src.src :: [""]
Expand Down
20 changes: 10 additions & 10 deletions src/kuin_editor/find.kn
Original file line number Diff line number Diff line change
Expand Up @@ -87,16 +87,16 @@ end func
do @wndFind.activate()
end if
do @wndFindTabFind.setSel(replace ?(1, 0))
do @wndFindEditReplace.enable(replace)
do @wndFindBtnReplace.enable(replace)
do @wndFindBtnReplaceAll.enable(replace)
do @wndFindEditReplace.setEnabled(replace)
do @wndFindBtnReplace.setEnabled(replace)
do @wndFindBtnReplaceAll.setEnabled(replace)
do wndFindChkRegularExpressionOnPush(null)
do @wndFindEditPattern.focus()
do @wndFindEditPattern.setSel(0, -1)

; TODO:
do @wndFindRadioAll.enable(false)
do @wndFindRadioSel.enable(false)
do @wndFindRadioAll.setEnabled(false)
do @wndFindRadioSel.setEnabled(false)

func wndFindOnClose(wnd: wnd@Wnd): bool
do @tabOrderFind :: null
Expand Down Expand Up @@ -137,9 +137,9 @@ end func
ret
end if
var replace: bool :: sel = 1
do @wndFindEditReplace.enable(replace)
do @wndFindBtnReplace.enable(replace)
do @wndFindBtnReplaceAll.enable(replace)
do @wndFindEditReplace.setEnabled(replace)
do @wndFindBtnReplace.setEnabled(replace)
do @wndFindBtnReplaceAll.setEnabled(replace)
end func

func wndFindEditPatternOnChange(wnd: wnd@Edit)
Expand All @@ -160,8 +160,8 @@ end func

func wndFindChkRegularExpressionOnPush(wnd: wnd@Chk)
do @wndFindChkRegularExpressionLast :: @wndFindChkRegularExpression.getChk()
do @wndFindChkDistinguishCase.enable(!@wndFindChkRegularExpressionLast)
do @wndFindChkOnlyWord.enable(!@wndFindChkRegularExpressionLast)
do @wndFindChkDistinguishCase.setEnabled(!@wndFindChkRegularExpressionLast)
do @wndFindChkOnlyWord.setEnabled(!@wndFindChkRegularExpressionLast)
end func

func wndFindBtnReplaceOnPush(wnd: wnd@Btn)
Expand Down
Loading

0 comments on commit 349b0c5

Please sign in to comment.