1 #exe=1 d g
2 #charoem = 1
3 #include = %EXEPATH%\lib\stdlib.ge
4 #libdir = %EXEPATH%\lib
5 #libdir1 = %EXEPATH%\..\lib\vis
6 #silent = 1
7 #wait=1
8 #output = %EXEPATH%\visedit.exe
9 //#!gentee.exe -f -p exe "%1"
10
11 type mytype
12 {
13 //uint prop
14 }
15
16
17 property uint mytype.prop
18 {
19 return 0
20 }
21
22 method uint mytype.x
23 {
24 uint z = this.prop
25 this.prop
26 //100~~100
27 //xxx
28 return 0
29 }
30
31
32 /*property zz.y( uint x, y, s)
33 {
34 }*/
35
36 /*method zz.y( uint x )
37 {
38 }*/
39 /*
40 func test<main>
41 {
42 zz x
43 uint p
44 //p = &x
45 //x.y
46 print( "zzzzzzzz0\n" )
47 //x.y
48 p = &x.y+1
49 getch()
50
51 }*/
52
53 include {
54 "..\\..\\lib\\ini\\ini.g"
55 // "..\\stdlib\\stdlib.ge"
56 // "test1.g"
57 }
58 func z
59 {
60 min(10,1)
61 }
62
63
64 define {
65 DESIGNING = 1
66 }
67 ifdef !$DESIGNING
68 {
69 sss
70 // $aaaaaaa
71 }
72 define {
73 COMP = 0
74 }
75
76 include {
77 // "..\\stdlib\\stdlib.g"
78 //"events.g"
79 "app.g"
80 "images.g"
81 "btn.g"
82 "panel.g"
83 "scrollbox.g"
84 "edit.g"
85 "menu.g"
86 "popupmenu.g"
87 "treeview.g"
88 "listview.g"
89 "tab.g"
90 "combobox.g"
91 "dialogs.g"
92 "label.g"
93 "labeled.g"
94 "picture.g"
95 "url.g"
96 "btnpic.g"
97 "tray.g"
98 "splitter.g"
99 "toolbar.g"
100
101
102 "btnsys.g"
103 "winedit.g"
104 "proplist.g"
105 //"..\\gt\\gt.g"
106 }
107
108 ifdef $DESIGNING {
109 include {
110 "design_menu.g"
111 "design_tab.g"
112 }
113 }
114
115 global {
116 uint mi0
117 uint mi1
118 uint ed1
119 uint ed2
120 uint pm
121 uint tt
122 uint cbb
123 }
124
125 type project
126 {
127 str filename
128 str runfile
129 str resources
130 }
131
132 type myform <inherit=vForm>
133 {
134 project prj
135 //str srcfile
136 vPropList props
137 vPropList events
138
139 vMenu MainMenu
140
141 vTreeView objtv //Список компонентов для добавления
142 vEdit edcurcomp //Текущий выбранный элемент
143
144 uint edform
145 //vPropList x
146 //vBtn btArrow
147 uint curaddcomp //Тип выбранного объекта для добавления
148 vOpenSaveDialog dlgOpen
149 uint desform //Дополнительное окно редактирования
150
151 str gffile //Содержимое gf файла
152 str filename //Имя файла для сохранения
153 filetime ftgf //Время изменения gf файла
154 uint flgsaved //Файлы были сохранены
155 uint flgchanged //Были изменения
156 uint flggfchanged //Были изменения в gf файле
157 str curdir //текущая директория
158 //vMenuDesign md
159 //vLabel Label
160 vVEPanel VEPanel
161
162 uint CurCompEdit //Текущее окно дополнительного редактирования
163
164 }
165
166 method myform myform.init( )
167 {
168 //print( "myform.init\n" )
169 return this
170 }
171
172 include
173 {
174 "main_save.g"
175 }
176
177 //Установка нового значения свойства
178 method myform.propset <alias=propset>( evparProp ev )
179 {
180 .flgchanged = 1
181 cm.GetCompDescr( .VEPanel.Selected.TypeId ).FindProp( ev.name.str() ).SetVal( .VEPanel.Selected, ev.value )
182 if ev.name.str() == "Name"
183 {
184 .GFSetHeaderf()
185 }
186 //.VEPanel.WE.green()
187 //.VEPanel.WE.select( .VEPanel.WE.winn->vCtrl )
188 //.VEPanel.Selected = .VEPanel.Selected
189 .VEPanel.Selected = .VEPanel.Selected
190 .VEPanel.Virtual( $mDesChanged, .VEPanel.Selected )
191 }
192
193 method myform.eventset <alias=eventset>( evparProp ev )
194 {
195 .flgchanged = 1
196 uint event as cm.GetCompDescr( .VEPanel.Selected.TypeId ).FindEvent( ev.name.str() )
197 str oldval = event.GetVal( .VEPanel.Selected )
198
199 uint resset = event.SetVal( .VEPanel.Selected, ev.value )
200
201 uint descr as ManEvents.Descrs[*ManEvents.Descrs - 1]
202 if resset & $EVENT_RENAME
203 {
204 .GFSetMethodf( oldval, ev.value.str(), descr.EventType )
205 }
206 elif resset & $EVENT_NEW
207 {
208 .GFSetMethodf( oldval, ev.value.str(), descr.EventType )
209 }
210 //.VEPanel.WE.green()
211 //.VEPanel.WE.select( .VEPanel.WE.winn->vCtrl )
212 .VEPanel.Selected = .VEPanel.Selected
213 }
214
215
216 method vComp.GetArrType( arr a of uint, uint typeid )
217 {
218 uint i
219 if this.TypeIs( typeid )
220 {
221 a[a.expand( 1 )] = &this
222 }
223 fornum i=0, *this.Comps
224 {
225 if this.Comps[i]->vComp.p_designing
226 {
227 this.Comps[i]->vComp.GetArrType( a, typeid )
228 }
229 }
230 }
231
232
233 method myform.getpropslist <alias=getpropslist>( evparEvent ev )
234 {
235 uint cd as cm.GetCompDescr( .VEPanel.Selected.TypeId )
236 if &cd
237 {
238 uint p as cd.FindProp( .props.ar[ .props.ncur ].Name.str() )
239 if p.PropType == uint || p.PropType == int
240 {
241 if p.Vals
242 {
243 .props.cb.Clear()
244 foreach enval, p.Vals->arr of CompEnumVal
245 {
246 .props.cb.AddItem( enval.Name.ustr(), 0->ustr, 0 )
247 }
248 }
249 }
250 elif ( p.PropType == vComp || type_isinherit( p.PropType, vComp ))
251 {
252 arr a of uint
253 .props.cb.Clear()
254 .VEPanel.Selected.GetForm()->vComp.GetArrType( a, p.PropType )
255 foreach item, a
256 {
257 .props.cb.AddItem( item->vComp.Name.ustr(), 0->ustr, 0 )
258 }
259 }
260 }
261 }
262
263 method myform.geteventslist <alias=geteventslist>( evparEvent ev )
264 {
265 uint cd as cm.GetCompDescr( .VEPanel.Selected.TypeId )
266 if &cd
267 {
268 uint event as cd.FindEvent( .events.ar[ .events.ncur ].Name.str() )
269
270 .events.cb.Clear()
271
272 if &event
273 {
274
275 foreach descr, ManEvents.Descrs
276 {
277 if descr.EventType == event.EventType
278 {
279
280 .events.cb.AddItem( descr.MethodName.ustr(), 0->ustr, 0 )
281 }
282 }
283 }
284 }
285 }
286
287
288
289 //Выбор текущего компонента
290 method myform.compselect <alias=compselect>( evparEvent ev )
291 {
292 if &.VEPanel.Selected()//.VEPanel.WE.winn
293 {
294 .flgchanged = 1
295 arr ap of PropItem
296 arr ae of PropItem
297 cm.GetPropList( .VEPanel.Selected, ap, ae )
298 .props.setar( ap )
299 .events.setar( ae )
300 .edcurcomp.Text = " ".ustr() + .VEPanel.Selected.TypeName + " " +.VEPanel.Selected.Name
301 if .CurCompEdit
302 {
303 .CurCompEdit->vForm.Virtual( $mSelectComp, .VEPanel.Selected )
304 }
305 }
306 }
307
308
309 method vComp myform.newcompdes( uint typeid, vComp owner )
310 {
311 uint comp as owner.CreateComp( typeid, 1 )->vComp
312 if &comp
313 {
314 uint curn
315 str name
316 str typename = comp.TypeName
317 uint ar as new( arr of uint )->arr of uint
318 //ar.expand( 1 )
319 ar.expand( *cm.GetCompDescr( typeid ).Events )
320 comp.des1 = &ar
321 if *comp.TypeName > 1
322 {
323 typename.substr( comp.TypeName, 1, *comp.TypeName-1 )
324 }
325 else
326 {
327 typename = comp.TypeName
328 }
329 do
330 {
331 name = typename + "\(curn++)"
332 }
333 while &(.edform->vForm.FindComp( name ))
334 comp.Name = name
335 comp.p_designing = 1
336 //.GetNoVis()
337 .VEPanel.Update()
338 }
339 return comp
340 }
341
342
343 method myform.QueryCreate <alias=myform_QueryCreate >( evparQueryCreate evpQ )
344 {
345 //uint b as .newcompdes( .VEPanel.WE.flgadd, .VEPanel.WE.winn->vComp )
346
347 //uint b as this.newctrl( typeid )
348 //print( "sss0 \(evpQ.TypeId) \(.VEPanel.WE.flgadd) \(evpQ.Owner->vComp.Name)\n" )
349 if evpQ.NewComp = &.newcompdes( ?( evpQ.TypeId, evpQ.TypeId, .VEPanel.WE.flgadd ) , evpQ.Owner->vComp )
350 {
351 uint b as evpQ.NewComp->vComp
352 if b.TypeIs( vVirtCtrl )
353 {
354 b as vVirtCtrl
355 b.Left = evpQ.loc.left
356 b.Top = evpQ.loc.top
357 if evpQ.loc.width : b.Width = evpQ.loc.width
358 if evpQ.loc.height : b.Height = evpQ.loc.height
359 }
360
361 //this.bt_arrow.checked = 1
362 .GFSetHeaderf()
363 //.GFSetProps()
364 .flgchanged = 1
365 if .objtv.Selected && .objtv.Selected.Tag
366 {
367 //print( "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaax\n" )
368 .objtv.Selected = .objtv.Selected.Parent
369 }
370 //.btArrow.Checked = 1
371 }
372
373 //arr ap of PropItem
374 //cm.GetPropList( .VEPanel.WE.winn->vComp, ap )
375 //.props.setar( ap )
376 }
377
378
379
380 method myform.New()
381 {
382 if .flgchanged: .GFSave( 1 )
383 if .edform
384 {
385 .edform->vComp.DestroyComp()
386 .VEPanel.NoVisList.Clear()
387 ManEvents.Descrs.clear()
388 }
389 ManEvents.Descrs.expand(1)
390
391 uint newform as .VEPanel.VisPanel->vComp.CreateComp( vForm )->vForm
392 uint ar as new( arr of uint )->arr of uint
393 ar.expand( *cm.GetCompDescr( vForm ).Events )
394 newform.des1 = &ar
395
396 newform.p_designing = 1
397 newform.TabOrder = 0
398 .edform = &newform
399 newform.Name = "Form0"
400 .GFSetNew()
401 .Caption = "New".ustr()
402 .VEPanel.WE.select( newform->vCtrl )
403 .VEPanel.Selected = newform
404 .VEPanel.Virtual( $mDesChanged, .VEPanel.Selected )
405 .flgchanged = 0
406 .flgsaved = 0
407
408
409 }
410
411 type aftercreate
412 {
413 uint prop
414 uint comp
415 ustr val
416 }
417
418 method vComp vComp.Load( gtitem gi, arr after of aftercreate )
419 {
420 uint typeid = gettypeid( gi.get( "TypeName" ) )
421 if typeid
422 {
423 uint comp as this.CreateComp( typeid, 1 )->vComp
424 //comp.p_designing = 1
425 comp.p_loading = 1
426 uint ar as new( arr of uint )->arr of uint
427 ar.expand( *cm.GetCompDescr( typeid ).Events )
428 comp.des1 = &ar
429 uint props as gi.findrel( "/Properties" )
430 if &props
431 {
432 foreach prop, props
433 {
434 ustr val
435 val.fromutf8( prop->gtitem.value )
436 uint compprop as cm.GetCompDescr( typeid ).FindProp( prop->gtitem.name )
437 if &compprop
438 {
439 if compprop.PropFlags & $PROP_LOADAFTERCREATE
440 {
441 uint curafter as after[after.expand(1)]
442 curafter.comp = &comp
443 curafter.val = val
444 curafter.prop = &compprop
445 }
446 else : compprop.SetVal( comp, val )
447 }
448 }
449 }
450 uint events as gi.findrel( "/Events" )
451 if &events
452 {
453 foreach event, events
454 {
455 ustr val
456 val.fromutf8( event->gtitem.value )
457 uint compevent as cm.GetCompDescr( typeid ).FindEvent( event->gtitem.name )
458 if &compevent : compevent.SetVal( comp, val )
459 }
460 }
461 uint children as gi.findrel( "/Children" )
462 if &children
463 {
464 foreach obj, children
465 {
466 //print( obj->gtitem.name )
467 comp.Load( obj->gtitem, after)
468 }
469 }
470 props as gi.findrel( "/PropertiesAfter" )
471 if &props
472 {
473 foreach prop, props
474 {
475 ustr val
476 val.fromutf8( prop->gtitem.value )
477 //print( prop->gtitem.name + "=" + val + "\n" )
478 uint compprop as cm.GetCompDescr( typeid ).FindProp( prop->gtitem.name )
479 if &compprop : compprop.SetVal( comp, val )
480 }
481 }
482 comp.p_loading = 0
483 //print( "out\n" )
484 return comp
485 }
486 return 0->vComp
487 }
488
489 method myform.Open ( str filename )
490 {
491 gt g
492
493 .filename = filename
494
495 if !.gffile.read( .filename + ".gf" ) : return
496 g.read( .filename + ".frm" )
497 .Caption = .filename.ustr() + ".gf"
498 //print( "op3\n" )
499
500 //0->vComp.Load( g.root().findrel( "/Object" ) )
501 ManEvents.Descrs.clear()
502 ManEvents.Descrs.expand(1)
503
504 foreach obj, g.root()
505 {
506
507 arr after of aftercreate
508 uint newform as .VEPanel.VisPanel->vComp.Load( obj->gtitem, after )->vForm
509 uint i
510 fornum i = 0, *after
511 {
512 uint curafter as after[i]
513 curafter.prop->CompProp.SetVal( curafter.comp->vComp, curafter.val )
514 }
515
516 if &newform
517 {
518
519 //print( "d1\n")
520 if .edform
521 {
522 .edform->vForm.DestroyComp()
523 .VEPanel.NoVisList.Clear()
524 }
525 .edform = &newform
526 newform.p_designing = 1
527 newform.TabOrder = 0
528 //.VEPanel.WE.select( newform->vCtrl )
529 .VEPanel.Selected = newform
530 .VEPanel.Virtual( $mDesChanged, .VEPanel.Selected )
531 //print( "d2 \(newform->vCtrl.cidx) \(oldform.cidx)\n")
532
533 //print( "d3\n")
534 }
535 break
536
537 }
538 .VEPanel.Update()
539 .flgchanged = 0
540 .flgsaved = 1
541 }
542
543 method myform.OpenQuery
544 {
545 //print( "op1\n" )
546 if .flgchanged: .GFSave( 1 )
547 //print( "op2\n" )
548
549 .dlgOpen.DefExt = ".gf".ustr()
550 .dlgOpen.Filters[0]= "Gentee form (*.gf)\\*.gf".ustr()
551 .dlgOpen.FileName = "".ustr()
552 if !.dlgOpen.ShowOpenFile() : return
553 str dir, fname
554 .dlgOpen.FileName.str().fgetparts( dir, fname, 0->str )
555 .Open( dir + "\\" + fname )
556 //this.Save( ev )
557 }
558
559 method myform.btnRun_click <alias=btnRun_click> ( evparEvent ev )
560 {
561 //.md.Owner = this
562 //.md.Visible = 1
563 //print( " run \(.flgchanged) \(.flgsaved ) \(.flggfchanged)\n" )
564
565 .GFSave( 0 )
566 if .flgsaved
567 {
568 if *.prj.runfile
569 {
570 //process( "\"\( getmodulepath( "", "gentee.exe" ) )\" \"\(.prj.runfile)\"", "".fgetdir(.prj.runfile), 0 )
571 setcurdir( "".fgetdir( .prj.runfile ) )
572 print( .prj.runfile )
573 shell( .prj.runfile )
574 }
575 else
576 {
577 //print( "zzz \(getmodulepath( "", "gentee.exe" ))\n" )
578 //process( "\"\( getmodulepath( "", "gentee.exe" ) )\" \"\(.filename).g\"", "".fgetdir(.filename), 0 )
579 shell( "\(.filename).g" )
580 }
581 }
582 }
583
584
585 method myform.objtv_afterselect <alias=myform_objtv_afterselect> ( evparTVAfter eva )
586 {
587 if eva.CurItem
588 {
589 this.VEPanel.WE.flgadd = eva.CurItem->TVItem.Tag
590 }
591 else : this.VEPanel.WE.flgadd = 0
592 }
593
594 method myform.NewFile <alias=NewFile> ( evparEvent ev)
595 {
596 this.New()
597 }
598
599 method myform.OpenFile <alias=OpenFile> (evparEvent ev)
600 {
601 this.OpenQuery()
602 }
603
604 method myform.OpenProject( str filename )
605 {
606 gt g
607 uint gi, gc
608 g.read( filename )
609 gi as g.root().findrel( "/project" )
610 if &gi
611 {
612 .prj.filename = filename
613 gc as gi.findrel( "/runfile" )
614 if &gc : .prj.runfile = gc.value
615 gc as gi.findrel( "/resources" )
616 if &gc : .prj.resources = gc.value
617 if &gc
618 {
619 .prj.resources = gc.value
620 DesApp.Lng.load( .prj.resources + "\\language", "english", "english" )
621 DesApp.ImgM.MainDir = .prj.resources + "images"
622 DesApp.ImgM.Load( "default", 1 )
623 .edform->vForm.Virtual( $mLangChanged )
624
625 }
626 }
627 }
628
629 method myform.OpenProjectQuery <alias=OpenProjectQuery> (evparEvent ev)
630 {
631 //print( "openproject\n" )
632 .dlgOpen.DefExt = ".gp".ustr()
633 .dlgOpen.Filters[0]= "Gentee project (*.gp)\\*.gp".ustr()
634 .dlgOpen.FileName = "".ustr()
635 if !.dlgOpen.ShowOpenFile() : return
636 .OpenProject( .dlgOpen.FileName.str() )
637
638 //.prj.resources =
639 //print( "op3\n" )
640
641 //0->vComp.Load( g.root().findrel( "/Object" ) )
642
643 //Open( dir + "\\" + fname )
644 }
645
646 method myform.SaveFile <alias=SaveFile> (evparEvent ev)
647 {
648 .GFSave( 0 )
649 }
650
651 method myform.SaveAsFile <alias=SaveAsFile> (evparEvent ev)
652 {
653 .GFSave( 1 )
654 }
655
656
657 method myform.QuerySelect <alias=myform_QuerySelect>( evparValUint eQS )
658 {
659 //.VEPanel.WE.select( eQS.val->vComp )
660 .VEPanel.Selected = eQS.val->vComp
661 }
662
663 method myform.CompEditDelete <alias=myform_CompEditDelete>( evparEvent ev )
664 {
665 .CurCompEdit = 0
666 }
667
668
669 method myform.VEPanel_DblClick <alias=myform_VEPanel_DblClick> ( evparValUint evn )
670 {
671
672 uint comp as .VEPanel.Selected
673
674 if &comp && !.CurCompEdit
675 {
676 if comp.TypeIs( vCustomMenu )
677 {
678 .CurCompEdit = &comp->vCustomMenu.Design( this, myform_QueryCreate, myform_QuerySelect, myform_CompEditDelete )
679 }
680 elif comp.TypeIs( vTab )
681 {
682 .CurCompEdit = &comp->vTab.Design( this, myform_QueryCreate, myform_QuerySelect, myform_CompEditDelete )
683 }
684 elif comp.TypeIs( vToolBar )
685 {
686 //newcompdes( vToolBarItem, comp )
687 evparQueryCreate eQC
688 eQC.Owner = &comp
689 eQC.TypeId = vToolBarItem
690 .QueryCreate( eQC )
691
692 //.flgchanged = 1
693 }
694 if .CurCompEdit
695 {
696 POINT pos
697 pos.x = .VEPanel.Left
698 pos.y = .VEPanel.Top
699 ClientToScreen( this.hwnd, pos )
700 .CurCompEdit->vForm.Left = pos.x//.VEPanel.Left
701 .CurCompEdit->vForm.Top = pos.y//.VEPanel.Top
702 SetFocus( .CurCompEdit->vForm.hwnd )
703 }
704 }
705 }
706
707
708
709 method myform.CloseQuery <alias=myform_CloseQuery>( evparQuery evpQ )
710 {
711 if .flgchanged : .GFSave( 1 )
712 if .flgsaved
713 {
714
715 ini prefs
716 prefs.setvalue( "PROJECT", "last", .filename )
717 prefs.setvalue( "PROJECT", "project", .prj.filename )
718 prefs.write( .curdir + "\\visedit.ini" )
719 }
720 //evpQ.flgCancel = 1
721 //this.DestroyComp()
722 }
723
724
725 global
726 {
727 ustr xxx
728 }
729 func t<main>
730 {
731 uint mybtn
732 myform x
733 getcurdir( x.curdir )
734
735 App.ImgM.MainDir = x.curdir + "\\images"
736 App.ImgM.Load( "default", 1 )
737
738 if App.Lng.load( x.curdir + "\\language", "english", "english")
739 {
740 ustr u
741 //print( "is [\(x.curdir + "\\language")] [\(str(App.Lng.getlang( "test2", u )))]\n")
742 }
743
744 x.Owner = App
745
746
747
748 //ti.lParam =
749 //print( "set tip = \( hwndTip ) \n " )
750 //print( "send1 = \(SendMessage( hwndTip, $TTM_ADDTOOL, 0, &ti ))\n" )
751 x.OnCloseQuery.Set( x, myform_CloseQuery )
752 /*x.hwndTip = CreateWindowEx( 0, "tooltips_class32".ustr().ptr(), 0,
753 $WS_POPUP | 0x01 | 0x02, // | $TTS_NOPREFIX | $TTS_ALWAYSTIP,
754 0x80000000, 0x80000000,
755 0x80000000, 0x80000000, //$CW_USEDEFAULT,
756 0, 0, GetModuleHandle( 0 ), 0)
757 print( "Createtim \(x.hwndTip)\n")
758 SetWindowPos(x.hwndTip, $HWND_TOPMOST,0, 0, 0, 0,
759 $SWP_NOMOVE | $SWP_NOSIZE | $SWP_NOACTIVATE)
760 //print( "send2 = \(SendMessage( .hwndTip, $TTM_ACTIVATE, 1, 0 ))\n" )
761
762 TOOLINFO ti
763 ti.cbSize = sizeof( TOOLINFO ) + 10
764 ti.uFlags = $TTF_SUBCLASS//0//$TTF_IDISHWND //| $TTF_SUBCLASS //$TTF_IDISHWND |
765 ti.hwnd = x.hwnd
766 ti.uId = x.hwnd
767 ti.rect.right = 200
768 ti.rect.bottom = 200
769 //ti.hinst = GetModuleHandle( 0 )
770 ti.lpszText = "test sdddddddddddddddddd".ustr().ptr()
771 //ti.lParam =
772 print( "set tip = \( x.hwndTip ) \n " )
773 print( "send1 = \(SendMessage( x.hwndTip, $TTM_ADDTOOL, 0, &ti ))\n" )
774 */
775
776 //FreeConsole()
777 with x.VEPanel
778 {
779 .Owner = x
780 .Left = 200
781 .Width = x.Width - .Left
782 .HorzAlign = $alhLeftRight
783 .VertAlign = $alvClient
784
785 }
786
787 //print( "setmenu1\n" )
788 x.MainMenu.Owner = x
789 //print( "setmenu2\n" )
790 uint cim, csim
791 cim as x.MainMenu.CreateComp( vMenuItem )->vMenuItem
792 cim.Caption = "file".ustr()
793 csim as cim.CreateComp( vMenuItem )->vMenuItem
794 csim.OnClick.Set( x, NewFile )
795 csim.Caption = "New".ustr()
796 csim as cim.CreateComp( vMenuItem )->vMenuItem
797 csim.Caption = "Open".ustr()
798 csim.OnClick.Set( x, OpenFile )
799 csim as cim.CreateComp( vMenuItem )->vMenuItem
800 csim.Caption = "Save".ustr()
801 csim.OnClick.Set( x, SaveFile )
802 csim as cim.CreateComp( vMenuItem )->vMenuItem
803 csim.Caption = "Save as".ustr()
804 csim.OnClick.Set( x, SaveAsFile )
805 csim as cim.CreateComp( vMenuItem )->vMenuItem
806 csim.Caption = "Open project".ustr()
807 csim.OnClick.Set( x, OpenProjectQuery )
808
809 uint panleft as x.CreateComp( vPanel )->vPanel
810 panleft.HorzAlign = $alhLeft
811 panleft.Width = 200
812 panleft.VertAlign = $alvClient
813 //panleft.Visible = 0
814 //panleft.Border = $brdLowered
815 //panleft.Border = 0
816
817 mybtn as panleft.CreateComp( vBtn )->vBtn
818 mybtn.Top = 0
819 mybtn.HorzAlign = $alhCenter
820 mybtn.Caption = "Run".ustr()
821 mybtn.OnClick.Set(x,btnRun_click)
822 //x.Label.Owner = panleft->vComp
823
824 with x.objtv
825 {
826 .Owner = panleft
827 .HorzAlign = $alhClient
828 .Top = mybtn.Top + mybtn.Height
829 .Height = 150
830 //.VertAlign = $alvTopBottom
831 .ShowSelection = 1
832 .RowSelect = 1
833 .OnAfterSelect.Set( x, myform_objtv_afterselect )
834
835 uint winlist as x.objtv.Root.AppendChild( "Windows objects".ustr(), 0 )
836 winlist.SortType = $TVSORT_SORT
837 foreach descr, cm.Descrs
838 {
839 if descr.VisComp
840 {
841 str typename
842 typename.substr( descr.TypeName, 1, *descr.TypeName-1 )
843 winlist.AppendChild( typename.ustr(), descr.TypeId )
844 }
845 }
846 winlist.Expanded = 1
847 }
848
849 with x.edcurcomp
850 {
851 .Owner = panleft
852 .Border = 0
853 .Top = x.objtv.Top + x.objtv.Height
854 .Height = 20
855 .HorzAlign = $alhClient
856 .ReadOnly = 1
857 .TabStop = 0
858 //.Enabled = 0
859 }
860
861 uint tabbottom as panleft.CreateComp( vTab )->vTab
862 tabbottom.Top = x.edcurcomp.Top + x.edcurcomp.Height
863 tabbottom.VertAlign = $alvTopBottom
864 tabbottom.HorzAlign = $alhClient
865 tabbottom.Bottom = 0
866 uint tiProperties as tabbottom.CreateComp( vTabItem )->vTabItem
867 tiProperties.Caption = "Properties".ustr()
868 uint tiEvents as tabbottom.CreateComp( vTabItem )->vTabItem
869 tiEvents.Caption = "Events".ustr()
870
871 //print( "pppp10\n" )
872 x.props.Owner = tiProperties
873 x.props.HorzAlign = $alhClient
874 x.props.VertAlign = $alvClient
875 x.props.onPropSet.Set( x, propset )
876 x.props.ongetlist.Set( x, getpropslist )
877 x.events.Owner = tiEvents
878 x.events.HorzAlign = $alhClient
879 x.events.VertAlign = $alvClient
880 x.events.onPropSet.Set( x, eventset )
881 x.events.ongetlist.Set( x, geteventslist )
882 // x.VEPanel.WE.Owner = x.panEdVis
883 // x.VEPanel.WE.onSelect.set( x, compselect )
884 // x.VEPanel.WE.onNew.set( x, myform_QueryCreate )
885
886 x.VEPanel.onSelect.Set( x, compselect )
887 x.VEPanel.onQueryCreate.Set( x, myform_QueryCreate )
888 x.VEPanel.OnDblClick.Set( x, myform_VEPanel_DblClick )
889
890
891 x.dlgOpen.Owner = x
892 x.dlgOpen.DefExt = "gf".ustr()
893
894 x.dlgOpen.Filters.expand(2)
895 x.dlgOpen.InitialDir = $"K:\gentee\".ustr()
896
897 ini prefs
898 str filename
899 //print( "open \( 1 ) )\n" )
900 prefs.read( x.curdir + "\\visedit.ini" )
901 if prefs.getvalue( "PROJECT", "last", filename, "" ) &&
902 *filename
903 {
904 x.Open( filename )
905 filename.clear()
906 prefs.getvalue( "PROJECT", "project", filename, "" )
907 x.OpenProject( filename )
908 }
909 else
910 {
911 x.New()
912 }
913
914 App.Run()
915 }