-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathObjPosMod.hsp
More file actions
4092 lines (3893 loc) · 187 KB
/
Copy pathObjPosMod.hsp
File metadata and controls
4092 lines (3893 loc) · 187 KB
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
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
//_______________________________________
// ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄
// Object Pos Module Ver. 2.0
//==============================================================================
// 使い方
// 1. スクリプトの冒頭で#include "ObjPosMod.hsp"。
// 2. buttonやboxf等のオブジェクトに対し、Ctrlを押しながらマウスの左ドラッグで
// 位置を変更、右ドラッグでサイズを変更できるようになる。
// 3. リストからスクリプトを書き換えたいオブジェクトを選択し「スクリプト変更」
// ボタンを押すと、スクリプトエディタ上の文字が書き換えられる。
// (エディタで開いてない場合は「ファイルを開く」ボタンになる。)
//
// ※1 オブジェクト操作時にあわせて+Shiftも押すと移動の縦横制限をしたり、サイズ
// を縦横同時に合わせることができる。
// ※2 矩形複数選択 ... 左ドラッグ : オブジェクトを完全に囲んだものを選択
// 右ドラッグ : オブジェクトと矩形が重なったものを選択
//
// 対応環境 : Windows8以降、HSP3.6以降
//==============================================================================
// モジュール
// #module ObjPosModScriptClass :スクリプト管理クラス
// #module ObjPosModExpClass :ObjPosMod拡張クラス
// #module ObjPosModDataClass :オブジェクトのクラス
// #module ObjPosModHsedModule :スクリプトエディタ操作用モジュール
// #module ObjPosMod :ObjPosMod本体
//------------------------------------------------------------------------------
#ifdef _debug
#ifndef __ObjPosMod__
#define __ObjPosMod__
#include "modclbk3.hsp"
#include "mod_regexp.as"
#define _MODULE_NAME_@ObjPosMod "Object Pos Module"
#define _MODULE_VERSION_@ObjPosMod "2.0"
//--------------------------------------
// システム変数
//======================================
// _ObjPosMod_BlankWinID_ :空きIDの登録(これ以降のIDを使わせてもらう。何も指定されていない場合、自動でID10000以上が使用されます)
// _ObjPosMod_BlackListID_ :ウィンドウIDブラックリスト[配列可](ここにあるIDのウィンドウはスルーされる)
// _ObjPosMod_WhiteListID_ :ウィンドウIDホワイトリスト[配列可](ブラックリストの指定がなくホワイトリストだけ指定された場合、ホワイトリストに無いウィンドウIDはスルーされる)
//--------------------------------------
;空きID
#ifndef _ObjPosMod_BlankWinID_
if _ObjPosMod_BlankWinID_ = 0 : _ObjPosMod_BlankWinID_ = 10000
#endif
;ON/OFFリスト
#ifndef _ObjPosMod_BlackListID_
dim _ObjPosMod_BlackListID_, 1 : _ObjPosMod_BlackListID_ = -1
#endif
#ifndef _ObjPosMod_WhiteListID_
dim _ObjPosMod_WhiteListID_, 1 : _ObjPosMod_WhiteListID_ = -1
#endif
;各module内の変数初期化
varinit@ObjPosModScriptClass
varinit@ObjPosModDataClass
varinit@ObjPosMod
// ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄
// ObjPosModスクリプト管理クラス(モジュール型変数)
//==============================================================================
// hspFile :スクリプトのファイルパス
// script :スクリプト全文
//------------------------------------------------------------------------------
#module ObjPosModScriptClass \
hspFile, \
script
//--------------------------------------
// モジュール変数名定義(モジュール内省略の為)
//--------------------------------------
#define objScript objScript@ObjPosModDataClass
//--------------------------------------
// 変数初期化
//--------------------------------------
#deffunc local varinit
;カレントディレクトリを保持しておく
dirCurrent = dir_cur
return
//--------------------------------------
// コンストラクタ
//--------------------------------------
#modinit str _hspFile, str _script
hspFile = _hspFile
script = _script
if vartype( hsptmp_ ) = 4 {
hsptmp_ = ""
exist dirCurrent+"\\hsptmp"
if strsize ! -1 {
sdim hsptmp_, strsize+1
bload dirCurrent+"\\hsptmp", hsptmp_, strsize
}
//HSEDぐるっと回してhsptmpと一致するファイル名(タブ)を取得しておく
hsptmp_filename_ = HSED_GetFilename@ObjPosModHsedModule( hsptmp_ )
}
mref thisID, 2
return thisID
//--------------------------------------
// Getter Settter
//--------------------------------------
#modcfunc local hspFile_
return hspFile
#modcfunc local script_
return script
#modfunc local _Set_script_ str p1
script = p1 : return
//--------------------------------------
// スクリプト読み込み
//--------------------------------------
#deffunc local Load_script_ str _hspFile
hspFilePath = Get_fullPath_(_hspFile)
if _hspFile = "???" || hspFilePath = hsptmp_filename_ {
if hsptmp_filename_ ! "" : hsptmp_ = HSED_GetScript@ObjPosModHsedModule( hsptmp_filename_ ) ;エディタからスクリプト更新(無題だったら持ってるhsptmpで強行する)
return -1 ;新規読み込みでない
}
cn = -1
foreach objScript
if hspFile_(objScript.cnt) = hspFilePath : cn = cnt : break
loop
if cn = -1 {
//まだ読み込んでないなら追加
exist hspFilePath
if strsize ! -1 {
sdim fullScript, strsize+1
bload hspFilePath, fullScript, strsize
newmod objScript, ObjPosModScriptClass, hspFilePath, fullScript
return stat ;新規読み込みはモジュールIDを返す
}
}else {
//読み込み済みで強制ロードなら更新
_Set_script_ objScript.cn, HSED_GetScript@ObjPosModHsedModule( hspFilePath ) ;エディタからスクリプト取得
}
return -1 ;新規読み込みでない
//--------------------------------------
// 指定hspファイルのスクリプトを返す
//--------------------------------------
#defcfunc local Get_script_ str _hspFile
hspFilePath = Get_fullPath_(_hspFile)
if _hspFile = "???" || hspFilePath = hsptmp_filename_ : return hsptmp_
cn = -1
foreach objScript
if hspFile_(objScript.cnt) = hspFilePath : cn = cnt : break
loop
if cn = -1 : Load_script_ _hspFile : cn = stat //もしまだ持ってないならロード
if cn = -1 : return ""
return script_(objScript.cn)
//--------------------------------------
// 読み込み済みのスクリプトを指定したものに更新
//--------------------------------------
#deffunc local Set_script_ str _hspFile, var _script
hspFilePath = Get_fullPath_(_hspFile)
if _hspFile = "???" || hspFilePath = hsptmp_filename_ {
hsptmp_ = _script
return
}
cn = -1
foreach objScript
if hspFile_(objScript.cnt) = hspFilePath : cn = cnt : break
loop
if cn = -1 : newmod objScript, ObjPosModScriptClass, hspFilePath, _script : return //もしまだ持ってないならnewmod
_Set_script_ objScript.cn, _script
return
//--------------------------------------
// 相対パスの場合、カレントとcommonのファイル有無を調べて絶対パスを返す
//--------------------------------------
#defcfunc local Get_fullPath_ str _hspFile
hspFilePath = _hspFile
if strmid( hspFilePath, 1, 2 ) = ":\\" : return _hspFile ;絶対パス
hspFileCurrentPath = dirCurrent+"\\"+_hspFile
hspFileCommonPath = dir_exe+"\\common\\"+_hspFile
;existを極力減らすため読み込んだことがある(存在を知っている)ファイルがあるか探す
cn = -1
foreach objScript
if hspFile_(objScript.cnt) = hspFileCurrentPath || hspFile_(objScript.cnt) = hspFileCommonPath : cn = cnt : break
loop
if cn ! -1 : return hspFile_(objScript.cn)
exist dir_exe+"\\common\\"+hspFilePath
if strsize!-1 : return dir_exe+"\\common\\"+_hspFile
return dirCurrent+"\\"+_hspFile
#global
//------------------------------------------------------------------------------
// End of ObjPosModスクリプト管理クラス(モジュール型変数)
//_______________________________________
// ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄
// ObjPosMod拡張クラス(モジュール型変数)
//==============================================================================
// exobjFileName :ObjPosModの拡張モジュールを記述しているhspファイル名
// hspFileName :拡張オブジェクトが記述されているhspファイル名(将来的に利用したい)
// objType :拡張オブジェクトの名前[#deffunc名](複数deffuncまたいで使用しているlineやmesをリストに出したくない場合は「拡張オブジェクト名|無視deffunc1|無視deffunc2|・・・」とする)
// layeredType :オブジェクト選択時の表示タイプ(0:winobjタイプ, 1:bgscrタイプ)、描画リフレッシュ処理が必要なとき(+2:追加オプション)[ほぼGroupBox用]
// label_RewriteScript :エディタ書き換え処理を登録するラベル
// label_ListDetail :ObjPosModのリストの備考に何を書くかを登録するラベル
// label_HitTest :オブジェクトをマウスで選択するときの特殊条件を登録するラベル
// label_RedrawObj :オブジェクトサイズ変更時に独自描画が必要な場合に登録するラベル
//------------------------------------------------------------------------------
#module ObjPosModExpClass \
exobjFileName, \
hspFileName, \
objType, \
layeredType, \
label_RewriteScript, \
label_ListDetail, \
label_HitTest, \
label_RedrawObj
//--------------------------------------
// 記号定数
//--------------------------------------
#const AFFECTOPTION_CurrentPos 1
#const AFFECTOPTION_Objsize 2
#const AFFECTOPTION_Font 4
//--------------------------------------
// モジュール変数名定義(モジュール内省略の為)
//--------------------------------------
#define objExp objExp@ObjPosModDataClass
//--------------------------------------
// Expオブジェクト登録命令(ユーザー用)
//--------------------------------------
#define global ObjPosModExp_AddObjType(%1,%2,%3=0,%4=0,%5=0,%6=0,%7=0,%8=0) ScFile@ObjPosModExpClass=__file__ : _lbl1_@ObjPosModExpClass=%5 : _lbl2_@ObjPosModExpClass=%6 : _lbl3_@ObjPosModExpClass=%7 : _lbl4_@ObjPosModExpClass=%8 : _ObjPosModExp_AddObjType@ObjPosModExpClass %1,%2,%3,%4
#deffunc local _ObjPosModExp_AddObjType str p1, str p2, int p3, int p4
if vartype( _lbl1_ ) ! 1 : _lbl1_ = *DummyLabel@ObjPosModExpClass
if vartype( _lbl2_ ) ! 1 : _lbl2_ = *DummyLabel@ObjPosModExpClass
if vartype( _lbl3_ ) ! 1 : _lbl3_ = *DummyLabel@ObjPosModExpClass
if vartype( _lbl4_ ) ! 1 : _lbl4_ = *DummyLabel@ObjPosModExpClass
newmod objExp@ObjPosModDataClass, ObjPosModExpClass, ScFile, p1, p2, p3, p4, _lbl1_, _lbl2_, _lbl3_, _lbl4_
return
//--------------------------------------
// コンストラクタ
//--------------------------------------
#modinit str _exobjFileName, str _hspFileName, str _objType, int _affectOption, int _layeredType, label _label_RewriteScript, label _label_ListDetail, label _label_HitTest, label _label_RedrawObj
exobjFileName = _exobjFileName
hspFileName = _hspFileName
objType = _objType
layeredType = _layeredType
label_RewriteScript = _label_RewriteScript
label_ListDetail = _label_ListDetail
label_HitTest = _label_HitTest
label_RedrawObj = _label_RedrawObj
split objType, "|", objnames
objnames = strtrim(objnames)
if objnames ! "" {
if _affectOption & AFFECTOPTION_CurrentPos : funcnameChangesCurrent_@ObjPosModDataClass( length.funcnameChangesCurrent_ ) = objnames
if _affectOption & AFFECTOPTION_Objsize : funcnameAffectedSize_objsize_@ObjPosModDataClass( length.funcnameAffectedSize_objsize_ ) = objnames
if _affectOption & AFFECTOPTION_Font : funcnameAffectedSize_font_@ObjPosModDataClass( length.funcnameAffectedSize_font_ ) = objnames
}
return
//--------------------------------------
// Getter Settter
//--------------------------------------
#modcfunc local exobjFileName_
return exobjFileName
#modcfunc local hspFileName_
return hspFileName
#modcfunc local objType_
split objType, "|", funcs : return funcs.0
#modcfunc local objTypes_
return objType
#modcfunc local layeredType_
return layeredType
#modfunc local label_RewriteScript_
refLabel = label_RewriteScript : return
#modfunc local label_ListDetail_
refLabel = label_ListDetail : return
#modfunc local label_HitTest_
refLabel = label_HitTest : return
#modfunc local label_RedrawObj_
refLabel = label_RedrawObj : return
//--------------------------------------
// 拡張命令として登録されているオブジェクト内で使用されている命令かどうか
//--------------------------------------
#defcfunc local IsInsideExpObj str _scFile, int _scLine
ret = 1
filename = getpath( _scFile, 8+16 )
//まず_scFileがそもそもobjExpに登録されているか確認しておく(ここで弾かれればまだ処理軽い)
foreach objExp
if filename = getpath( exobjFileName_(objExp.cnt), 8+16 ) : ret = 0 : break //将来的に exobjFileName_ → hspFileName_ に出来たら良いなぁ。
loop
if ret = 1 : return 0
hspDefFunc = getpath( GetHspDefFunc_( _scFile, _scLine ), 16 ) ;mesやlineの命令が何の#deffunc内で使われているかを取得
if hspDefFunc = "" : return 0
foreach objExp
if filename = getpath( exobjFileName_(objExp.cnt), 8+16 ) { //将来的に exobjFileName_ → hspFileName_ に出来たら良いなぁ。
objtype_buf = objTypes_(objExp.cnt) : split objtype_buf, "|", objtypes
repeat stat
if getpath( objtypes.cnt, 16 ) = hspDefFunc : ret = 1 : break
loop
if ret = 1 : break
}
loop
return ret
//--------------------------------------
// 何の#deffuncに属しているか取得する(実際とは異なる場合があるので注意)
//--------------------------------------
#defcfunc local GetHspDefFunc_ str _scFile, int _scLine, \
local result
// フルスクリプトを貰って検索する
fullScript_buf = Get_script_@ObjPosModScriptClass( _scFile )
GetIndex_toFuncAndLineHead@ObjPosModDataClass index_toFunc, index_lineHead, fullScript_buf, _scLine, "" ;指定Line行頭までのindexを取得(index_toFunc==-1)
script_buf_before = strmid( fullScript_buf, 0, index_lineHead )
;#globalがあるならそこまではざっくりカットしてしまう
matches result, script_buf_before, "^(?:.|\n)*#global((?:.|\n)*)$", 0, 0, 1
if stat ! 0 : script_buf_before = result( stat-1, 1 )
;最後に見つかった#deffuncに属しているものとして取得する(ただし実際は異なる場合がある。returnを気にしたいがスコープを探るのが辛い)
matches result, script_buf_before, "#defc?func[ \t]+(?:local[ \t]+)?(\\w+)", 0, 0, 1
if stat ! 0 {
result = result( stat-1, 1 )
}else {
result = ""
}
return result
//--------------------------------------
// ダミーラベル
//--------------------------------------
*DummyLabel@ObjPosModExpClass
return
#global
//------------------------------------------------------------------------------
// End of オブジェクトのクラス(モジュール型変数)
//_______________________________________
// ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄
// オブジェクトのクラス(モジュール型変数)
//==============================================================================
// winID :オブジェクトを配置したウィンドウのID
// winHwnd :オブジェクトを配置したウィンドウのhWnd
// objID :オブジェクトのID
// objHwnd :オブジェクトのhWnd
// objType :オブジェクトのタイプ("mes","button"等)
// pos_xy0 :オブジェクトの位置(初期)
// pos_xy1 :オブジェクトの位置(移動中)
// pos_xy2 :オブジェクトの位置(移動後)
// size_wh0 :オブジェクトのサイズ(初期)
// size_wh1 :オブジェクトのサイズ(変更中)
// size_wh2 :オブジェクトのサイズ(変更後)
// objed_cxy :オブジェクトを配置したときの元のカレントポジション
// objsz_py :オブジェクトを配置したときのobjsize p3(Y方向の最低確保行サイズ)
// colorRGB :オブジェクトを配置したときのカレントカラー
// hspLine :オブジェクトを配置したときのHSPファイルの行数
// hspFile :オブジェクトを配置したときのHSPファイル名
// changedCount :オブジェクトを変更したかのフラグ(全体を通して自動カウントした数値が入る)
// maeScript :変更前のスクリプト(変更必要箇所抜き出し)
// atoScript :変更後のスクリプト(変更必要箇所抜き出し)
// fullScript :モジュール変数としては今は使ってない。スクリプト管理クラスを噛ませて取り出している。
// hasBeenFixed :スクリプトが修正済みかのフラグ
// opt1~ ;上記以外でオブジェクトに必要なデータを保存(objTypeによって変数の型が異なる)
//------------------------------------------------------------------------------
#module ObjPosModDataClass \
modID, \
winID, \
winHwnd, \
objID, \
objHwnd, \
objType, \
pos_x0, pos_y0, \
pos_x1, pos_y1, \
pos_x2, pos_y2, \
size_w0, size_h0, \
size_w1, size_h1, \
size_w2, size_h2, \
objed_cx, objed_cy, \
objsz_py, \
colorR, colorG, colorB, \
hspLine, \
hspFile, \
hspDefFunc, \
changedCount, \
maeScript, atoScript, \
fullScript, \
hasBeenFixed, \
opt1, opt2, opt3, opt4, opt5, opt6, opt7
//--------------------------------------
// 記号定数
//--------------------------------------
#const INT_MAX 2147483647
//--------------------------------------
// 変数初期化
//--------------------------------------
#deffunc local varinit
;hsptmp拾い用にカレントディレクトリを保持しておく
dirCurrent = dir_cur
//Update_MaeAtoScript_で使う配列の初期化
funcnameChangesCurrent_ = "mes", "line", "chkbox", "mesbox", "input", "combox", "listbox", "winobj", "button", "pos"
scopeBreakerReg_before_ = "(\n|:|\\{|[ \t])return(\n|:|\\}|[ \t])", "(\n|:|\\{|[ \t])stop(\n|:|\\}|[ \t])", "(?:\n|:|\\{|[ \t])screen[ \t]+", "(?:\n|:|\\{|[ \t])bgscr[ \t]+", "(?:\n|:|\\{|[ \t])buffer[ \t]+", "(?:\n|:|\\{|[ \t])gsel[ \t]+", "\\}", "\\*[A-Za-z_]\w*?(\n|:|\\}|[ \t])"
scopeBreakerReg_after_pos_ = "(\n|:|\\{|[ \t])return(\n|:|\\}|[ \t])", "(\n|:|\\{|[ \t])stop(\n|:|\\}|[ \t])", "(?:\n|:|\\{|[ \t])screen[ \t]+", "(?:\n|:|\\{|[ \t])bgscr[ \t]+", "(?:\n|:|\\{|[ \t])buffer[ \t]+", "(?:\n|:|\\{|[ \t])gsel[ \t]+", "(?:\n|:|\\{|[ \t])line[ \t]+.*?,.*?,.+?,.+?"
scopeBreakerReg_after_size_ = "(\n|:|\\{|[ \t])return(\n|:|\\}|[ \t])", "(\n|:|\\{|[ \t])stop(\n|:|\\}|[ \t])", "(?:\n|:|\\{|[ \t])screen[ \t]+", "(?:\n|:|\\{|[ \t])bgscr[ \t]+", "(?:\n|:|\\{|[ \t])buffer[ \t]+", "(?:\n|:|\\{|[ \t])gsel[ \t]+"
funcnameAffectedSize_font_ = "mes"
funcnameAffectedSize_objsize_ = "chkbox", "mesbox", "input", "combox", "listbox", "winobj", "button"
;モジュール変数の初期化
newmod objExp, ObjPosModExpClass, "", "", "", 0, 0, *DummyLabel@ObjPosModExpClass, *DummyLabel@ObjPosModExpClass, *DummyLabel@ObjPosModExpClass, *DummyLabel@ObjPosModExpClass
delmod objExp.0
newmod objScript, ObjPosModScriptClass, "", ""
delmod objScript.0
return
//--------------------------------------
// コンストラクタ
//--------------------------------------
#modinit int _winid, int _winHwnd, int _objID, int _objHwnd, str _objType, int _pos_x0, int _pos_y0, int _size_w0, int _size_h0, int _objed_cx, int _objed_cy, int _objsz_py, int _colorR, int _colorG, int _colorB, str _hspFile, int _hspLine
modID = modID_counter_ : modID_counter_++
winID = _winid
winHwnd = _winHwnd
objID = _objID
objHwnd = _objHwnd
objType = _objType
pos_x0 = _pos_x0
pos_y0 = _pos_y0
pos_x1 = pos_x0
pos_y1 = pos_y0
pos_x2 = pos_x0
pos_y2 = pos_y0
size_w0 = _size_w0 : if size_w0 < 0 : size_w0 = 0
size_h0 = _size_h0 : if size_h0 < 0 : size_h0 = 0
size_w1 = size_w0
size_h1 = size_h0
size_w2 = size_w0
size_h2 = size_h0
objed_cx = _objed_cx
objed_cy = _objed_cy
objsz_py = _objsz_py
colorR = _colorR
colorG = _colorG
colorB = _colorB
hspFile = _hspFile
hspLine = _hspLine
changedCount = 0
maeScript = ""
atoScript = ""
fullScript = ""
hasBeenFixed = 0
mref thisID, 2
return thisID
//--------------------------------------
// 既にファイル/行/命令が同一のオブジェクトが作られていないかnewmodする前に確認 (ループ内の描画オブジェクトは最初の1つだけを扱う為)
//--------------------------------------
#defcfunc local isCreated array mod, str _hspFile, int _hspLine, str _objType
flg = 0
foreach mod
if hspFile_(mod.cnt)=_hspFile & hspLine_(mod.cnt)=_hspLine & objType_(mod.cnt)=_objType : flg = 1 : break
loop
return flg
//--------------------------------------
// Getter Settter
//--------------------------------------
#modcfunc local modID_
return modID
#modcfunc local winID_
return winID
#modcfunc local winHwnd_
return winHwnd
#modcfunc local objID_
return objID
#modcfunc local objHwnd_
return objHwnd
#modcfunc local pos_x0_
return pos_x0
#modcfunc local pos_y0_
return pos_y0
#modcfunc local pos_x1_
return pos_x1
#modfunc local Set_pos_x1_ int p1
pos_x1 = p1 : return
#modcfunc local pos_y1_
return pos_y1
#modfunc local Set_pos_y1_ int p1
pos_y1 = p1 : return
#modcfunc local pos_x2_
return pos_x2
#modfunc local Set_pos_x2_ int p1
pos_x2 = p1 : return
#modcfunc local pos_y2_
return pos_y2
#modfunc local Set_pos_y2_ int p1
pos_y2 = p1 : return
#modcfunc local size_w0_
return size_w0
#modcfunc local size_h0_
return size_h0
#modcfunc local size_w1_
return size_w1
#modfunc local Set_size_w1_ int p1
size_w1 = p1 : if p1<0 { size_w1 = 0 } : return
#modcfunc local size_h1_
return size_h1
#modfunc local Set_size_h1_ int p1
size_h1 = p1 : if p1<0 { size_h1 = 0 } : return
#modcfunc local size_w2_
return size_w2
#modfunc local Set_size_w2_ int p1
size_w2 = p1 : if p1<0 { size_w2 = 0 } : return
#modcfunc local size_h2_
return size_h2
#modfunc local Set_size_h2_ int p1
size_h2 = p1 : if p1<0 { size_h2 = 0 } : return
#modcfunc local objed_cx_
return objed_cx
#modcfunc local objed_cy_
return objed_cy
#modcfunc local objsz_py_
return objsz_py
#modcfunc local colorR_
return colorR
#modcfunc local colorG_
return colorG
#modcfunc local colorB_
return colorB
#modcfunc local objType_
return objType
#modcfunc local hspFile_
return hspFile
#modcfunc local hspLine_
return hspLine
#modcfunc local changedCount_
return changedCount
#modcfunc local maeScript_
return maeScript
#modfunc local Set_maeScript_ str p1
maeScript = p1 : return
#modcfunc local atoScript_
return atoScript
#modfunc local Set_atoScript_ str p1
atoScript = p1 : return
#modcfunc local _fullScript_
return fullScript
#modfunc local _Set_fullScript_ str p1
fullScript = p1 : return
#modcfunc local _hspDefFunc_
return hspDefFunc
#modfunc local _Set_hspDefFunc_ str p1
hspDefFunc = p1 : return
#modcfunc local hasBeenFixed_
return hasBeenFixed
#modfunc local Set_hasBeenFixed_ int p1
hasBeenFixed = p1 : return
//--------------------------------------
// 特殊Getter (ObjPosModスクリプト管理クラスとの橋渡し)
//======================================
// MODE_OverwriteHsed_==1 (NeedReload_fullScript内) :Update_MaeAtoScript_内でエディタのスクリプトを書き換えるため、エディタから引っ張ってきて最新のスクリプトに更新する
//--------------------------------------
#modcfunc local fullScript_
if NeedReload_fullScript( hspFile ) : Load_script_@ObjPosModScriptClass hspFile
//ファイル名から
return Get_script_@ObjPosModScriptClass( hspFile )
//--------------------------------------
// スクリプトエディタ書き込み時はモード変更する(fullScript_取得の際スクリプトを再読み込み)
//--------------------------------------
#deffunc local SetMode_OverwriteHsed_ int p1
MODE_OverwriteHsed_ = (p1!=0)
sdim reloadedFile, 1024, 1 ;モード変更時に初期化
reloadedCount = 0
return
#defcfunc local NeedReload_fullScript str filename ;Needを問われる度に無ければ追加していく
if MODE_OverwriteHsed_ = 0 : return 0
reloaded = 0
repeat reloadedCount
if reloadedFile(cnt) = filename : reloaded = 1 : break
loop
if reloaded = 0 : reloadedFile( reloadedCount ) = filename : reloadedCount++
return ( reloaded == 0 )
//--------------------------------------
// 特殊Setter (ObjPosModスクリプト管理クラスとの橋渡し)
//--------------------------------------
#modfunc local Set_fullScript_ var script
Set_script_@ObjPosModScriptClass hspFile, script
return
//--------------------------------------
// 特殊Setter (2個同時Set、自動カウント)
//--------------------------------------
#modfunc local Set_pos_xy0_ int p1, int p2
pos_x0 = p1 : pos_y0 = p2 : return
#modfunc local Set_pos_xy1_ int p1, int p2
pos_x1 = p1 : pos_y1 = p2 : return
#modfunc local Set_pos_xy2_ int p1, int p2
pos_x2 = p1 : pos_y2 = p2 : return
#modfunc local Set_size_wh0_ int p1, int p2
size_w0 = p1 : size_h0 = p2 : if p1<0 { size_w0 = 0 } : if p2<0 { size_h0 = 0 } : return
#modfunc local Set_size_wh1_ int p1, int p2
size_w1 = p1 : size_h1 = p2 : if p1<0 { size_w1 = 0 } : if p2<0 { size_h1 = 0 } : return
#modfunc local Set_size_wh2_ int p1, int p2
size_w2 = p1 : size_h2 = p2 : if p1<0 { size_w2 = 0 } : if p2<0 { size_h2 = 0 } : return
#modfunc local Set_objed_cxy_ int p1, int p2
objed_cx = p1 : objed_cy = p2 : return
#modfunc local AutoSet_changedCount_
changedCounter_++ : changedCount = changedCounter_ : return
//--------------------------------------
// Getter Settter (opt項目 : objTypeによって変数の型が異なる。pos,size以外の必要なデータを保存。)
//--------------------------------------
#modcfunc local opt1_
return opt1
#define global Set_opt1_@ObjPosModDataClass(%1,%2) vt@ObjPosModDataClass=%2 : _Set_opt1_@ObjPosModDataClass %1
#modfunc local _Set_opt1_
opt1 = vt : return
#modcfunc local opt2_
return opt2
#define global Set_opt2_@ObjPosModDataClass(%1,%2) vt@ObjPosModDataClass=%2 : _Set_opt2_@ObjPosModDataClass %1
#modfunc local _Set_opt2_
opt2 = vt : return
#modcfunc local opt3_
return opt3
#define global Set_opt3_@ObjPosModDataClass(%1,%2) vt@ObjPosModDataClass=%2 : _Set_opt3_@ObjPosModDataClass %1
#modfunc local _Set_opt3_
opt3 = vt : return
#modcfunc local opt4_
return opt4
#define global Set_opt4_@ObjPosModDataClass(%1,%2) vt@ObjPosModDataClass=%2 : _Set_opt4_@ObjPosModDataClass %1
#modfunc local _Set_opt4_
opt4 = vt : return
#modcfunc local opt5_
return opt5
#define global Set_opt5_@ObjPosModDataClass(%1,%2) vt@ObjPosModDataClass=%2 : _Set_opt5_@ObjPosModDataClass %1
#modfunc local _Set_opt5_
opt5 = vt : return
#modcfunc local opt6_
return opt6
#define global Set_opt6_@ObjPosModDataClass(%1,%2) vt@ObjPosModDataClass=%2 : _Set_opt6_@ObjPosModDataClass %1
#modfunc local _Set_opt6_
opt6 = vt : return
#modcfunc local opt7_
return opt7
#define global Set_opt7_@ObjPosModDataClass(%1,%2) vt@ObjPosModDataClass=%2 : _Set_opt7_@ObjPosModDataClass %1
#modfunc local _Set_opt7_
opt7 = vt : return
//--------------------------------------
// modIDと照合して真のモジュールIDを取得(モジュールの順番はデータ削除等を挟むと作成順通りにならないため)
//--------------------------------------
#defcfunc local Get_modID_ array mod, int _id //Get_modID_@ObjPosModDataClass( objData,cnt )って書いてもらう(ドットでなくカンマ)
id = _id //Exp用処置
ret = -1
foreach mod
if modID_(mod.cnt) = id : ret = cnt : break
loop
return ret
//--------------------------------------
// スクリプトエディタでファイルを開いているか
//--------------------------------------
#modcfunc local IsOpenedHspFile_
if hspFile_( thismod ) = "???" : return 1 ;hsptmp
hspFilePath = Get_fullPath_@ObjPosModScriptClass( hspFile_( thismod ) )
return HSED_IsOpenedFile@ObjPosModHsedModule( hspFilePath )
//--------------------------------------
// 入力されたモジュール変数ID配列をスクリプトの末尾にある方から順にソートして返す(書き換え時、新規追加pos等が発生したときにカレント戻しと追加posが被るという意味のない重複を防ぐため)
//--------------------------------------
#deffunc local Get_SortedArray_DescendingScriptLine array mod, array out_modIDs, array modIDs, int modIDs_count, \
local i, \
local len, \
local max, \
local name
;面倒くさいので先にファイル名をリストにしてしまう
sdim names, 512,1
names(0) = hspFile_( mod.modIDs(0) )
repeat modIDs_count-1, 1
flg = 0 : cn = cnt
repeat length.names
if hspFile_( mod.modIDs(cn) ) = names(cnt) : flg = 1 : break
loop
if flg = 1 : continue
names( length.names ) = hspFile_( mod.modIDs(cn) )
loop
;面倒くさいのでmodIDsをコピーして取り出したヤツは-1で消していくことにする
dim temp_modIDs, modIDs_count
memcpy temp_modIDs, modIDs, 4 * modIDs_count
;同じファイル名のものを塊として、hspLine_の若い順にソート
dim out_modIDs, modIDs_count : i = 0
repeat length.names
name = names(cnt)
repeat modIDs_count
max = -1 : len = -1
repeat modIDs_count
if temp_modIDs(cnt) = -1 : continue
if hspFile_( mod.temp_modIDs(cnt) ) ! name : continue
if max < hspLine_( mod.temp_modIDs(cnt) ) : max = hspLine_( mod.temp_modIDs(cnt) ) : len = -1 : cn = cnt : continue
if max = hspLine_( mod.temp_modIDs(cnt) ) {
;行数が同じ場合はindexも調査して順番をつける
if len = -1 {
;先に控えているだけだったヤツを調査
fullScript_buf = fullScript_( mod.temp_modIDs(cn) )
GetIndex_toFuncAndLineHead len, index_lineHead, fullScript_buf, hspLine_( mod.temp_modIDs(cn) ), objType_( mod.temp_modIDs(cn) ) ;objTypeの命令頭までのindex(とその行頭までのindex)を取得
}
;後から被りを見つけた方のヤツを調査
GetIndex_toFuncAndLineHead index_toFunc, index_lineHead, fullScript_buf, hspLine_( mod.temp_modIDs(cnt) ), objType_( mod.temp_modIDs(cnt) )
if len < index_toFunc : max = hspLine_( mod.temp_modIDs(cnt) ) : cn = cnt
continue
}
loop
if max = -1 : break
out_modIDs( i ) = temp_modIDs( cn ) : i++
temp_modIDs( cn ) = -1
loop
loop
return i
//--------------------------------------
// 内部データを使ってmaeScript,atoScriptを更新 - Update_MaeAtoScript_@ObjPosModDataClass objData,cnt って書いてもらう(ドットでなくカンマ)
//======================================
// MODE_OverwriteHsed_ == 1 :エディタのスクリプトも書き換える
//--------------------------------------
#deffunc local Update_MaeAtoScript_ array mod, int _id, \
local result, \
local _result
id = _id //Exp用処置
if hasBeenFixed_( mod.id ) ! 0 : return ;スクリプト書き換え済みだったらそれ以上変更できないようにする
//--------------------------------------
// エディタ書き換えの処理配列の初期化(オブジェクトの位置/サイズを変更したときにどういう風にスクリプトを変更していけば良いかの処理を入れる配列)
//======================================
// syori_line :書き換え処理をする行番号
// syori_index_lineHead :書き換え行の行頭のindex
// syori_index_fromLineHead :書き換える文字は行頭から何index目か
// syori_delete_len :書き換えで消す文字のbyte数
// syori_write :書き換えで消した後に書き込む文字
// (syori_count) :処理配列のインデックス
//--------------------------------------
dim syori_line, 1
dim syori_index_lineHead, 1
dim syori_index_fromLineHead, 1
dim syori_delete_len, 1
sdim syori_write, 1024, 1
syori_count = 0
fullScript_buf = fullScript_( mod.id )
; fullScript_buf :スクリプト全文
if fullScript_buf = "" : return ;エディタに書き込み時、最新スクリプトを取得しに行くが問題があった場合空欄が返る -> 処理中止
;objTypeの命令頭までのindexとその行頭までのindexを取得
GetIndex_toFuncAndLineHead index_toFunc, index_lineHead, fullScript_buf, hspLine_(mod.id), objType_(mod.id)
; index_toFunc :命令(objType_)までのインデックス
; index_lineHead :命令(objType_)の書いてある行数
if index_toFunc = -1 :return
switch objType_(mod.id)
case "mes"
//------------------------------------------------------------------------------
// 書き換えの基準について
//==============================================================================
// pos : font
// ← mesと一番近いposとの間に邪魔な命令がなければ、このposのパラメータを変化させれば良い。
// (input) ← 仮にカレントポジションが変わる命令が間にあったら、適切なposがないのでmes命令直前にposを書き加える必要がある。
// mes
// ← mesの次のカレントポジションが関わる命令までの間にposがあれば、mesの位置をいじっても後ろの命令に影響を与えない。つまりmes命令直後にカレントポジションを戻す処理を書き加える必要はない。
// (stop) ┌→ 但し、(button)との間に仮に(stop)などのカレントポジションのスコープ(関わり)が切れる記述があった場合(このstopがbuttonの手前にあった場合)、posを書き加えるのは冗長になるため必要ない。
// (button) ← 仮にカレントポジションに関わる命令があったら、mesのposだけ変えると後ろが全てズレてしまうので、mes命令直後にカレントポジションを戻す処理(pos)を書き加える必要がある。
// pos
// ※ これのfont版や、他のobjTypeのpos,objsizeも調査して、それぞれ処理方法を決定する。(boxf等、命令によってはパラメータに組み込まれたり、カレントが変更されなかったりとこれらの調査がいらない場合もある。)
//------------------------------------------------------------------------------
script_buf_before = strmid( fullScript_buf, 0, index_toFunc ) ;オブジェクト命令の手前のスクリプトを取得
script_buf_after = strmid( fullScript_buf, index_toFunc, INT_MAX ) ;オブジェクト命令から後ろのスクリプトを取得
oneLineScript_buf_after_textReplacedDummy = GetOneLineScript_TextReplacedDummy( script_buf_after ) ;オブジェクト命令が書いてある行のスクリプト(1行だけ)。文字列やコメントを「X」で置き換えてある。
//pos調査
if pos_x0_( mod.id ) ! pos_x2_( mod.id ) || pos_y0_( mod.id ) ! pos_y2_( mod.id ) {
//index_toFunc前のpos調査
GetData_BeforeFunc_SubMatch lineNum_before, indexLineHead_before, indexSubMatch1_before, lenSubMatch2_before, script_buf_before, "^((?:.|\n)*(?:\n|:|\\{|[ \t])pos[ \t]+)("+pos_x0_(mod.id)+"[ \t]*,[ \t]*"+pos_y0_(mod.id)+")", funcnameChangesCurrent_, scopeBreakerReg_before_
; lineNum_before :pos命令の書いてある行数
; indexLineHead_before :pos命令のある行の行頭までのインデックス
; indexSubMatch1_before :pos命令のパラメータ手前までのインデックス(submatch文字列の1つ目の結果の長さを返している)
; lenSubMatch2_before :pos命令のパラメータ部分の文字列長(submatch文字列の2つ目の結果の長さを返している)
if stat ! 0 {
; posが見つかった
syori_line( syori_count ) = lineNum_before
syori_index_lineHead( syori_count ) = indexLineHead_before
syori_index_fromLineHead( syori_count ) = indexSubMatch1_before - indexLineHead_before
syori_delete_len( syori_count ) = lenSubMatch2_before
syori_write( syori_count ) = ""+pos_x2_( mod.id )+", "+pos_y2_( mod.id )
syori_count++
}else {
; posが見つからなかった(または見つかったが間に邪魔者がいたからそのposは使えない)ときはオブジェクト命令手前にposを追記させる
syori_line( syori_count ) = hspLine_(mod.id)
syori_index_lineHead( syori_count ) = index_lineHead
syori_index_fromLineHead( syori_count ) = index_toFunc - index_lineHead
syori_delete_len( syori_count ) = 0
syori_write( syori_count ) = "pos "+pos_x2_( mod.id )+", "+pos_y2_( mod.id )+" : "
syori_count++
}
//index_toFunc後ろのpos調査
if NeedBackToOriginal_AfterFunc_SubMatch( script_buf_after, "^((?:.|\n)*?(?:\n|:|\\{|[ \t]))pos[ \t]+", funcnameChangesCurrent_, scopeBreakerReg_after_pos_ ) {
; mes令直後にカレントポジションを戻す処理(pos)を書き加える必要がある
syori_line( syori_count ) = hspLine_(mod.id)
syori_index_lineHead( syori_count ) = index_lineHead
syori_index_fromLineHead( syori_count ) = index_toFunc - index_lineHead + strlen.submatch( oneLineScript_buf_after_textReplacedDummy, "^(mes[ \t]+.*?)[ \t]*(?:\n|:|;|//|/\\*|\\}|$)" )
syori_delete_len( syori_count ) = 0
syori_write( syori_count ) = " : pos "+objed_cx_( mod.id )+", "+objed_cy_( mod.id )
syori_count++
}
}
//font調査
if opt4_( mod.id ) ! opt5_( mod.id ) {
//index_toFunc前のfont調査
GetData_BeforeFunc_SubMatch lineNum_before, indexLineHead_before, indexSubMatch1_before, lenSubMatch2_before, script_buf_before, "^((?:.|\n)*(?:\n|:|\\{|[ \t])font[ \t]+.*?,[ \t]*)("+opt4_(mod.id)+")[ \t]*(?:,|\n|:|;|//|/\\*|\\}|$)", funcnameAffectedSize_font_, scopeBreakerReg_before_
if stat ! 0 {
syori_line( syori_count ) = lineNum_before
syori_index_lineHead( syori_count ) = indexLineHead_before
syori_index_fromLineHead( syori_count ) = indexSubMatch1_before - indexLineHead_before
syori_delete_len( syori_count ) = lenSubMatch2_before
syori_write( syori_count ) = ""+opt5_( mod.id )
syori_count++
}else {
syori_line( syori_count ) = hspLine_(mod.id)
syori_index_lineHead( syori_count ) = index_lineHead
syori_index_fromLineHead( syori_count ) = index_toFunc - index_lineHead
syori_delete_len( syori_count ) = 0
syori_write( syori_count ) = "font \""+opt3_( mod.id )+"\", "+opt5_( mod.id )
if opt6_( mod.id ) ! 0 : syori_write( syori_count ) += ", "+opt6_( mod.id )
if opt7_( mod.id ) ! 1 {
if opt6_( mod.id ) = 0 : syori_write( syori_count ) += ", "
syori_write( syori_count ) += ", "+opt7_( mod.id )
}
syori_write( syori_count ) += " : "
syori_count++
}
//index_toFunc後ろのfont調査
if NeedBackToOriginal_AfterFunc_SubMatch( script_buf_after, "^((?:.|\n)*?(?:\n|:|\\{|[ \t]))font[ \t]+", funcnameAffectedSize_font_, scopeBreakerReg_after_size_ ) {
syori_line( syori_count ) = hspLine_(mod.id)
syori_index_lineHead( syori_count ) = index_lineHead
syori_index_fromLineHead( syori_count ) = index_toFunc - index_lineHead + strlen.submatch( oneLineScript_buf_after_textReplacedDummy, "^(mes[ \t]+.*?)[ \t]*(?:\n|:|;|//|/\\*|\\}|$)" )
syori_delete_len( syori_count ) = 0
syori_write( syori_count ) = " : font \""+opt3_( mod.id )+"\", "+opt4_( mod.id )
if opt6_( mod.id ) ! 0 : syori_write( syori_count ) += ", "+opt6_( mod.id )
if opt7_( mod.id ) ! 1 {
if opt6_( mod.id ) = 0 : syori_write( syori_count ) += ", "
syori_write( syori_count ) += ", "+opt7_( mod.id )
}
syori_count++
}
}
swbreak
case "boxf"
//--------------------------------------
// オブジェクト自身にpos,sizeパラメータがあり、手前や後続に影響を与えない。
//--------------------------------------
script_buf_after = strmid( fullScript_buf, index_toFunc, INT_MAX )
oneLineScript_buf_after_textReplacedDummy = GetOneLineScript_TextReplacedDummy( script_buf_after )
//オブジェクト調査
matches result, oneLineScript_buf_after_textReplacedDummy, "^(boxf[ \t]+)(.*?)[ \t]*(?:\n|:|;|//|/\\*|\\}|$)", 0, 1, 1
if stat = 0 : swbreak
syori_line( syori_count ) = hspLine_(mod.id)
syori_index_lineHead( syori_count ) = index_lineHead
syori_index_fromLineHead( syori_count ) = index_toFunc - index_lineHead + strlen.result(0,1)
syori_delete_len( syori_count ) = strlen.result(0,2)
syori_write( syori_count ) = ""+pos_x2_( mod.id )+", "+pos_y2_( mod.id )+", "+( size_w2_(mod.id) + pos_x2_( mod.id ) - 1 )+", "+( size_h2_(mod.id) + pos_y2_( mod.id ) - 1 )
syori_count++
swbreak
case "line"
//--------------------------------------
// オブジェクト自身にpos,sizeパラメータがあるが、後続には影響を与えてしまう。後ろだけpos調査。
//--------------------------------------
script_buf_after = strmid( fullScript_buf, index_toFunc, INT_MAX )
oneLineScript_buf_after_textReplacedDummy = GetOneLineScript_TextReplacedDummy( script_buf_after )
//index_toFunc後ろのpos調査
if NeedBackToOriginal_AfterFunc_SubMatch( script_buf_after, "^((?:.|\n)*?(?:\n|:|\\{|[ \t]))pos[ \t]+", funcnameChangesCurrent_, scopeBreakerReg_after_pos_ ) {
syori_line( syori_count ) = hspLine_(mod.id)
syori_index_lineHead( syori_count ) = index_lineHead
syori_index_fromLineHead( syori_count ) = index_toFunc - index_lineHead + strlen.submatch( oneLineScript_buf_after_textReplacedDummy, "^(line[ \t]*.*?)[ \t]*(?:\n|:|;|//|/\\*|\\}|$)" )
syori_delete_len( syori_count ) = 0
syori_write( syori_count ) = " : pos "+objed_cx_( mod.id )+", "+objed_cy_( mod.id )
syori_count++
}
//オブジェクト調査(pos,size)
matches result, oneLineScript_buf_after_textReplacedDummy, "^(line)[ \t]*(?:\n|:|;|//|/\\*|\\}|$)", 0, 1, 1 ;パラメータが全省略されている
_result = ""
if stat = 0 {
matches result, oneLineScript_buf_after_textReplacedDummy, "^(line[ \t]*)(.*?)[ \t]*(?:\n|:|;|//|/\\*|\\}|$)", 0, 1, 1
if stat = 0 : swbreak
_result = result(0,2)
}
syori_line( syori_count ) = hspLine_(mod.id)
syori_index_lineHead( syori_count ) = index_lineHead
syori_index_fromLineHead( syori_count ) = index_toFunc - index_lineHead + strlen.result(0,1)
syori_delete_len( syori_count ) = strlen._result
write_atama = "" : if result(0,1) = "line" : write_atama = " " ;「line」だけでパラメータ全省略のときもある。新たに書き足されるパラメータの間に空白を入れる。
switch opt3_( mod.id )
case 0 : syori_write( syori_count ) = write_atama + ( pos_x2_(mod.id) )+", "+( pos_y2_(mod.id) )+", "+( pos_x2_(mod.id) + size_w2_(mod.id) )+", "+( pos_y2_(mod.id) + size_h2_(mod.id) ) : swbreak
case 1 : syori_write( syori_count ) = write_atama + ( pos_x2_(mod.id) + size_w2_(mod.id) )+", "+( pos_y2_(mod.id) + size_h2_(mod.id) )+", "+( pos_x2_(mod.id) )+", "+( pos_y2_(mod.id) ) : swbreak
case 2 : syori_write( syori_count ) = write_atama + ( pos_x2_(mod.id) )+", "+( pos_y2_(mod.id) + size_h2_(mod.id) )+", "+( pos_x2_(mod.id) + size_w2_(mod.id) )+", "+( pos_y2_(mod.id) ) : swbreak
default: syori_write( syori_count ) = write_atama + ( pos_x2_(mod.id) + size_w2_(mod.id) )+", "+( pos_y2_(mod.id) )+", "+( pos_x2_(mod.id) )+", "+( pos_y2_(mod.id) + size_h2_(mod.id) ) : swbreak
swend
syori_count++
swbreak
case "circle"
//--------------------------------------
// オブジェクト自身にpos,sizeパラメータがあり、手前や後続に影響を与えない。
//--------------------------------------
script_buf_after = strmid( fullScript_buf, index_toFunc, INT_MAX )
oneLineScript_buf_after_textReplacedDummy = GetOneLineScript_TextReplacedDummy( script_buf_after )
//オブジェクト調査
matches result, oneLineScript_buf_after_textReplacedDummy, "^(circle)[ \t]*(?:\n|:|;|//|/\\*|\\}|$)", 0, 1, 1 ;パラメータが全省略されている
_result = ""
if stat = 0 {
matches result, oneLineScript_buf_after_textReplacedDummy, "^(circle[ \t]+)(.*?,.*?,.*?,.*?),.*?[ \t]*(?:\n|:|;|//|/\\*|\\}|$)", 0, 1, 1 ;第5パラメータまであるとき
if stat = 0 {
matches result, oneLineScript_buf_after_textReplacedDummy, "^(circle[ \t]+)(.*?)(?:\n|:|;|//|/\\*|\\}|$)", 0, 1, 1
if stat = 0 : swbreak
}
_result = result(0,2)
}
syori_line( syori_count ) = hspLine_(mod.id)
syori_index_lineHead( syori_count ) = index_lineHead
syori_index_fromLineHead( syori_count ) = index_toFunc - index_lineHead + strlen.result(0,1)
syori_delete_len( syori_count ) = strlen._result
write_atama = "" : if result(0,1) = "circle" : write_atama = " " ;「circle」だけでパラメータ全省略のときもある。新たに書き足されるパラメータの間に空白を入れる。
syori_write( syori_count ) = write_atama + pos_x2_( mod.id )+", "+pos_y2_( mod.id )+", "+( size_w2_(mod.id) + pos_x2_( mod.id ) )+", "+( size_h2_(mod.id) + pos_y2_( mod.id ) )
syori_count++
swbreak
case "grect"
//--------------------------------------
// オブジェクト自身にpos,sizeパラメータがあり、手前や後続に影響を与えない。
//--------------------------------------
script_buf_after = strmid( fullScript_buf, index_toFunc, INT_MAX )
oneLineScript_buf_after_textReplacedDummy = GetOneLineScript_TextReplacedDummy( script_buf_after )
//オブジェクト調査
matches result, oneLineScript_buf_after_textReplacedDummy, "^(grect[ \t]+)(.*?,.*?)(,.*?)(,.*?,.*?)[ \t]*(?:\n|:|;|//|/\\*|\\}|$)", 0, 1, 1 ;第5パラメータまであるとき
if stat > 0 {
_result = result(0,2) + result(0,3) + result(0,4), strmid( script_buf_after, strlen(result(0,1)+result(0,2)), strlen(result(0,3)) ) ;_result(1)は長さだけでなくスクリプトを使いたいのでダミーじゃないscript_buf_afterから拾い直す
}else {
matches result, script_buf_after, "^(grect[ \t]+)(.*?,.*?)(,.*?)(,.*?)[ \t]*(?:\n|:|;|//|/\\*|\\}|$)", 0, 1, 1 ;第4パラメータまであるとき
if stat > 0 {
_result = result(0,2) + result(0,3) + result(0,4), strmid( script_buf_after, strlen(result(0,1)+result(0,2)), strlen(result(0,3)) )
}else {
matches result, script_buf_after, "^(grect[ \t]+)(.*?,.*?)(,.*?)[ \t]*(?:\n|:|;|//|/\\*|\\}|$)", 0, 1, 1 ;第3パラメータまであるとき
if stat > 0 {
_result = result(0,2) + result(0,3), strmid( script_buf_after, strlen(result(0,1)+result(0,2)), strlen(result(0,3)) )
}else {
matches result, script_buf_after, "^(grect[ \t]+)(.*?)[ \t]*(?:\n|:|;|//|/\\*|\\}|$)", 0, 1, 1 ;第1か第2パラメータまであるとき
if stat > 0 {
_result = result(0,2), ", "+opt1_( mod.id )
}else {
matches result, script_buf_after, "^(grect)[ \t]*(?:\n|:|;|//|/\\*|\\}|$)", 0, 1, 1 ;パラメータが全省略されているとき
if stat = 0 : swbreak
_result = "", ", "+opt1_( mod.id )
}
}
}
}
dig = opt1_( mod.id )
dbl = sin(dig)*sin(dig)-cos(dig)*cos(dig)
w = size_w1_( mod.id )
h = size_h1_( mod.id )
syori_line( syori_count ) = hspLine_(mod.id)
syori_index_lineHead( syori_count ) = index_lineHead
syori_index_fromLineHead( syori_count ) = index_toFunc - index_lineHead + strlen.result(0,1)
syori_delete_len( syori_count ) = strlen._result(0)
write_atama = "" : if result(0,1) = "grect" : write_atama = " " ;「circle」だけでパラメータ全省略のときもある。新たに書き足されるパラメータの間に空白を入れる。
syori_write( syori_count ) = write_atama + (pos_x2_( mod.id ) + (w+1)/2)+", "+(pos_y2_( mod.id ) + (h+1)/2)+ _result(1) +", "+(int((cos(dig)*w-sin(dig)*h)/(-dbl)*10+5)/10)+", "+(int((sin(dig)*w-cos(dig)*h)/dbl*10+5)/10)
syori_count++
swbreak
case "picload"
//--------------------------------------
// サイズ不変。posのみ調査する。
//--------------------------------------
script_buf_before = strmid( fullScript_buf, 0, index_toFunc )
script_buf_after = strmid( fullScript_buf, index_toFunc, INT_MAX )
oneLineScript_buf_after_textReplacedDummy = GetOneLineScript_TextReplacedDummy( script_buf_after )
//pos調査
if pos_x0_( mod.id ) ! pos_x2_( mod.id ) || pos_y0_( mod.id ) ! pos_y2_( mod.id ) {
//index_toFunc前のpos調査
GetData_BeforeFunc_SubMatch lineNum_before, indexLineHead_before, indexSubMatch1_before, lenSubMatch2_before, script_buf_before, "^((?:.|\n)*(?:\n|:|\\{|[ \t])pos[ \t]+)("+pos_x0_(mod.id)+"[ \t]*,[ \t]*"+pos_y0_(mod.id)+")", funcnameChangesCurrent_, scopeBreakerReg_before_
if stat ! 0 {
syori_line( syori_count ) = lineNum_before
syori_index_lineHead( syori_count ) = indexLineHead_before
syori_index_fromLineHead( syori_count ) = indexSubMatch1_before - indexLineHead_before
syori_delete_len( syori_count ) = lenSubMatch2_before
syori_write( syori_count ) = ""+pos_x2_( mod.id )+", "+pos_y2_( mod.id )