OSDN Git Service

Ring ノートパッドの更新 (v.1.0.4 → v.1.0.7)
[ring-lang-081/ring.git] / applications / rnote / source / rnotemainwindow.ring
1 # The Ring Notepad Application (RNote)
2 # Author : Mahmoud Fayed <msfclipper@yahoo.com>
3
4 class RNoteMainWindow
5
6         func CreateMainWindow 
7
8                 oDesktop = new qDesktopWidget()
9
10                 win1 = new qMainWindow() {
11                         setwindowtitle("Ring Notepad")
12                         setwinicon(self,this.cCurrentDir + "/image/notepad.png")
13                         this.oFilter = new qAllEvents(this.win1)
14                         this.oFilter.setCloseEvent(Method(:RingNotepadXButton))
15                         installEventFilter(this.oFilter)
16                         this.CreateToolbars()   
17                         this.CreateMenubar()
18                         this.CreateStatusbar()
19                         this.CreateProjectFiles()       
20                         this.CreateSourceCode()
21                         this.CreateWebBrowser() 
22                         this.CreateFunctionsList()
23                         this.CreateClassesList()
24                         this.CreateOutputWindow()
25                         this.CreateFormDesigner()
26                         this.PrepareDockableWindows()
27                 }
28         
29         func CreateToolBars
30                 win1 {
31                         aBtns = [
32                                         new qtoolbutton(this.win1) {
33                                                 setbtnimage(self,"image/new.png")
34                                                 setclickEvent(Method(:NewFile))
35                                                 settooltip("New File (Ctrl+N)")
36                                         } ,
37                                         new qtoolbutton(this.win1) {
38                                                 setbtnimage(self,"image/open.png")
39                                                 setclickEvent(Method(:Open))
40                                                 settooltip("Open File (Ctrl+O)")
41                                         } ,
42                                         new qtoolbutton(this.win1) {
43                                                 setbtnimage(self,"image/save.png")
44                                                 setclickEvent(Method(:Save))
45                                                 settooltip("Save (Ctrl+S)")
46                                          } ,
47                                         new qtoolbutton(this.win1) {
48                                                 setbtnimage(self,"image/saveas.png")
49                                                 setclickEvent(Method(:SaveAs))
50                                                 settooltip("Save As (Ctrl+E)")
51                                          } ,
52                                         new qtoolbutton(this.win1) {
53                                                 setbtnimage(self,"image/undo.png")
54                                                 setclickEvent(Method(:Undo))
55                                                 settooltip("Undo (Ctrl+Z)")
56                                         } ,
57                                         new qtoolbutton(this.win1) {
58                                                 setbtnimage(self,"image/cut.png")
59                                                 setclickEvent(Method(:Cut))
60                                                 settooltip("Cut (Ctrl+X)")
61                                          } ,
62                                         new qtoolbutton(this.win1) {
63                                                 setbtnimage(self,"image/copy.png")
64                                                 setclickEvent(Method(:CopyText))
65                                                 settooltip("Copy (Ctrl+C)")
66                                         } ,
67                                         new qtoolbutton(this.win1) {
68                                                 setbtnimage(self,"image/paste.png")
69                                                 setclickEvent(Method(:Paste))
70                                                 settooltip("Paste (Ctrl+V)")
71                                         } ,
72                                         new qtoolbutton(this.win1) {
73                                                 setbtnimage(self,"image/font.png")
74                                                 setclickEvent(Method(:Font))
75                                                 settooltip("Font (Ctrl+I)")
76                                         } ,
77                                         new qtoolbutton(this.win1) {
78                                                 setbtnimage(self,"image/search.png")
79                                                 setclickEvent(Method(:OpenFindWindow))
80                                                 settooltip("Find and Replace (Ctrl+F)")
81                                         } ,
82                                         new qtoolbutton(this.win1) {
83                                                 setbtnimage(self,"image/print.png")
84                                                 setclickEvent(Method(:Print))
85                                                 settooltip("Print (Ctrl+P)")
86                                         } ,
87                                         new qtoolbutton(this.win1) {
88                                                 setbtnimage(self,"image/debug.png")
89                                                 setclickevent(Method(:Debug)) 
90                                                 settooltip("Debug - Run then wait! (Ctrl+D)")
91                                         } ,
92                                         new qtoolbutton(this.win1) {
93                                                 setbtnimage(self,"image/run.png")
94                                                 setclickEvent(Method(:Run))
95                                                 settooltip("Run the program (Ctrl+R) ")
96                                         } ,
97                                         new qtoolbutton(this.win1) {
98                                                 setbtnimage(self,"image/rungui.png")
99                                                 setclickEvent(Method(:RunNoConsole))
100                                                 settooltip("Run GUI Application - No Console (Ctrl+F5)")
101                                         } ,
102                                         new qtoolbutton(this.win1) {
103                                                 setbtnimage(self,"image/web.png")
104                                                 setclickEvent(Method(:RunInBrowser))
105                                                 settooltip("Run Web Application - Open In Browser (Ctrl+F6)")
106                                         } ,
107                                         new qtoolbutton(this.win1) {
108                                                 setbtnimage(self,"image/close.png")
109                                                 setclickEvent(Method(:Quit))
110                                                 settooltip("Quit (Ctrl+Q)")
111                                         }
112                                 ]
113         
114                         tool1 = addtoolbar("files")  {
115                                 for x in aBtns addwidget(x) addseparator() next
116                         }
117         
118                         # Main File Toolbar
119                         tool2 = addtoolbar("mainfile")  {
120                                 oLblMainFile = new qLabel(this.win1) {
121                                         setText("Main File : ")
122                                 }
123                                 this.oTxtMainFile = new qLineEdit(this.win1) {
124                                         setStylesheet("border: 0px;  background-color: rgba(0, 0, 0, 0);")
125                                         setReadOnly(True)
126                                 }
127                                 oBtnSetFile = new qtoolbutton(this.win1) {
128                                         setbtnimage(self,"image/open.png")
129                                         setclickEvent(Method(:SetMainFile))
130                                         settooltip("Set the Main File to be the current source file (Ctrl+Shift+M)")
131                                 }
132                                 oBtnDebugMainFile = new qtoolbutton(this.win1) {
133                                                 setbtnimage(self,"image/debug.png")
134                                                 setclickevent(Method(:DebugMainFile)) 
135                                                 settooltip("Main File : Debug  - Run then wait! (Ctrl+Shift+D)")
136                                 } 
137                                 oBtnRunMainFile = new qtoolbutton(this.win1) {
138                                                 setbtnimage(self,"image/run.png")
139                                                 setclickEvent(Method(:RunMainFile))
140                                                 settooltip("Main File : Run the program (Ctrl+Shift+R)")
141                                 } 
142                                 oBtnRunGUIMainFile = new qtoolbutton(this.win1) {
143                                                 setbtnimage(self,"image/rungui.png")
144                                                 setclickEvent(Method(:RunGUIMainFile))
145                                                 settooltip("Main File : Run GUI Application - No Console (Ctrl+Shift+F5)")
146                                 } 
147                                 oBtnRunWebMainFile = new qtoolbutton(this.win1) {
148                                                 setbtnimage(self,"image/web.png")
149                                                 setclickEvent(Method(:RunInBrowserMainFile))
150                                                 settooltip("Main File : Run Web Application - Open In Browser (Ctrl+Shift+F6)")
151                                 } 
152                                 AddWidget(oLblMainFile)
153                                 AddWidget(this.oTxtMainFile)
154                                 AddWidget(oBtnSetFile)
155                                 AddWidget(oBtnDebugMainFile)
156                                 AddWidget(oBtnRunMainFile)
157                                 AddWidget(oBtnRunGUIMainFile)
158                                 AddWidget(oBtnRunWebMainFile)
159                         }
160                 }
161         
162         func CreateMenubar 
163                 win1 {
164                                 menu1 = new qmenubar(this.win1) {
165                                         subFile         = addmenu("File")
166                                         subEdit         = addmenu("Edit")
167                                         subView         = addmenu("View")
168                                         subProgram      = addmenu("Program")
169                                         subBrowser      = addmenu("Browser")
170                                         subTools        = addmenu("Tools")
171                                         subDistribute   = addmenu("Distribute")
172                                         subHelp         = addmenu("Help")
173                                         subFile {
174                                                 oAction = new qAction(this.win1) {
175                                                         setShortcut(new QKeySequence("Ctrl+n"))
176                                                         setbtnimage(self,"image/new.png")
177                                                         settext("New")
178                                                         setclickEvent(Method(:NewFile))
179                                                 }
180                                                 addaction(oAction)
181                                                 oAction = new qAction(this.win1) {
182                                                         setShortcut(new QKeySequence("Ctrl+o"))
183                                                         setbtnimage(self,"image/open.png")
184                                                         settext("Open")
185                                                         setclickEvent(Method(:Open))
186                                                 }
187                                                 addaction(oAction)
188                                                 addseparator()
189                                                 oAction = new qAction(this.win1) {
190                                                         setShortcut(new QKeySequence("Ctrl+s"))
191                                                         setbtnimage(self,"image/save.png")
192                                                         settext("Save")
193                                                         setclickEvent(Method(:Save))
194                                                 }
195                                                 addaction(oAction)
196                                                 addseparator()
197                                                 oAction = new qAction(this.win1) {
198                                                         setShortcut(new QKeySequence("Ctrl+e"))
199                                                         setbtnimage(self,"image/saveas.png")
200                                                         settext("Save As")
201                                                         setclickEvent(Method(:SaveAs))
202                                                 }
203                                                 addaction(oAction)
204                                                 addseparator()
205                                                 oAction = new qAction(this.win1) {
206                                                         setShortcut(new QKeySequence("Ctrl+p"))
207                                                         setbtnimage(self,"image/print.png")
208                                                         settext("Print to PDF")
209                                                         setclickEvent(Method(:Print))
210                                                 }
211                                                 addaction(oAction)
212                                                 addseparator()
213                                                 oAction = new qaction(this.win1) {
214                                                         setShortcut(new QKeySequence("Ctrl+q"))
215                                                         setbtnimage(self,"image/close.png")
216                                                         settext("Exit")
217                                                         setstatustip("Exit")
218                                                         setclickEvent(Method(:Quit))
219                                                 }
220                                                 addaction(oAction)
221                                         }
222                                         subEdit {
223                                                 oAction = new qAction(this.win1) {
224                                                         setShortcut(new QKeySequence("Ctrl+z"))
225                                                         setbtnimage(self,"image/undo.png")
226                                                         settext("Undo")
227                                                         setclickEvent(Method(:Undo))
228                                                 }
229                                                 addaction(oAction)
230                                                 addseparator()
231                                                 oAction = new qAction(this.win1) {
232                                                         setShortcut(new QKeySequence("Ctrl+x"))
233                                                         setbtnimage(self,"image/cut.png")
234                                                         settext("Cut")
235                                                         setclickEvent(Method(:Cut))
236                                                 }
237                                                 addaction(oAction)
238                                                 oAction = new qAction(this.win1) {
239                                                         setShortcut(new QKeySequence("Ctrl+c"))
240                                                         setbtnimage(self,"image/copy.png")
241                                                         settext("Copy")
242                                                         setclickEvent(Method(:CopyText))
243                                                 }
244                                                 addaction(oAction)
245                                                 oAction = new qAction(this.win1) {
246                                                         setShortcut(new QKeySequence("Ctrl+v"))
247                                                         setbtnimage(self,"image/paste.png")
248                                                         settext("Paste")
249                                                         setclickEvent(Method(:Paste))
250                                                 }
251                                                 addaction(oAction)
252                                                 addseparator()
253                                                 oAction = new qAction(this.win1) {
254                                                         setShortcut(new QKeySequence("Ctrl+i"))
255                                                         setbtnimage(self,"image/font.png")
256                                                         settext("Font")
257                                                         setclickEvent(Method(:Font))
258                                                 }
259                                                 addseparator()
260                                                 addaction(oAction)
261                                                 oAction = new qAction(this.win1) {
262                                                         setShortcut(new QKeySequence("Ctrl+t"))
263                                                         setbtnimage(self,"image/colors.png")
264                                                         settext("Text Color")
265                                                         setclickEvent(Method(:SelectColor))
266                                                 }
267                                                 addaction(oAction)
268                                                 oAction = new qAction(this.win1) {
269                                                         setShortcut(new QKeySequence("Ctrl+b"))
270                                                         setbtnimage(self,"image/colors.png")
271                                                         settext("Back Color")
272                                                         setclickEvent(Method(:SelectColor2))
273                                                 }
274                                                 addaction(oAction)
275                                                 addseparator()
276                                                 oAction = new qAction(this.win1) {
277                                                         setShortcut(new QKeySequence("Ctrl+h"))
278                                                         settext("Set Tab Width")
279                                                         setclickEvent(Method(:TabWidth))
280                                                 }
281                                                 addaction(oAction)
282                                                 oAction = new qAction(this.win1) {
283                                                         setShortcut(new QKeySequence("Ctrl+g"))
284                                                         settext("Go to line")
285                                                         setclickEvent(Method(:Goto))
286                                                 }
287                                                 addaction(oAction)
288                                                 oAction = new qAction(this.win1) {
289                                                         setShortcut(new QKeySequence("Ctrl+f"))
290                                                         setbtnimage(self,"image/search.png")
291                                                         settext("Find and Replace")
292                                                         setclickEvent(Method(:OpenFindWindow))
293                                                 }
294                                                 addaction(oAction)
295                                                 addseparator()
296                                                 oAction = new qAction(this.win1) {
297                                                         setShortcut(new QKeySequence("Ctrl+Shift+i"))
298                                                         settext("Insert Text")
299                                                         setclickEvent(Method(:OpenInsertWindow))
300                                                 }
301                                                 addaction(oAction)
302                                                 oAction = new qAction(this.win1) {
303                                                         setShortcut(new QKeySequence("Ctrl+Shift+L"))
304                                                         settext("Lower case")
305                                                         setclickEvent(Method(:lowerCase))
306                                                 }
307                                                 addaction(oAction)
308                                                 oAction = new qAction(this.win1) {
309                                                         setShortcut(new QKeySequence("Ctrl+Shift+U"))
310                                                         settext("Upper case")
311                                                         setclickEvent(Method(:upperCase))
312                                                 }
313                                                 addaction(oAction)
314                                                 oAction = new qAction(this.win1) {
315                                                         setShortcut(new QKeySequence("Ctrl+Shift+C"))
316                                                         settext("Capitalize")
317                                                         setclickEvent(Method(:capitalize))
318                                                 }
319                                                 addaction(oAction)
320                                                 addseparator()
321                                                 oAction = new qAction(this.win1) {
322                                                         setShortcut(new QKeySequence("Ctrl+alt+C"))
323                                                         setbtnimage(self,"image/comment2.png")
324                                                         settext("Comment Lines")
325                                                         setclickEvent(Method(:CommentLines))
326                                                 }
327                                                 addaction(oAction)
328                                                 oAction = new qAction(this.win1) {
329                                                         setShortcut(new QKeySequence("Ctrl+alt+B"))
330                                                         setbtnimage(self,"image/comment.png")
331                                                         settext("Comment Block Of Lines")
332                                                         setclickEvent(Method(:CommentBlockLines))
333                                                 }
334                                                 addaction(oAction)
335                                                 addseparator()
336                                                 oAction = new qAction(this.win1) {
337                                                         setShortcut(new QKeySequence("Ctrl+alt+f"))
338                                                         setbtnimage(self,"image/search.png")
339                                                         settext("Find in Files")
340                                                         setclickEvent(Method(:OpenFindInFiles))
341                                                 }
342                                                 addaction(oAction)
343         
344                                         }
345                                         subView {
346                                                 oAction = new qAction(this.win1) {
347                                                         setShortcut(new QKeySequence("Ctrl+j"))
348                                                         setbtnimage(self,"image/project.png")
349                                                         settext("Project Files")
350                                                         setclickEvent(Method(:ProjectWindowStatus))
351                                                 }
352                                                 addaction(oAction)
353                                                 addseparator()
354                                                 oAction = new qAction(this.win1) {
355                                                         setShortcut(new QKeySequence("Ctrl+u"))
356                                                         setbtnimage(self,"image/source.png")
357                                                         setclickEvent(Method(:SourceCodeWindowStatus))
358                                                         settext("Source Code")
359                                                 }
360                                                 addaction(oAction)
361                                                 addseparator()
362                                                 oAction = new qAction(this.win1) {
363                                                         setShortcut(new QKeySequence("Ctrl+w"))
364                                                         setbtnimage(self,"image/richtext.png")
365                                                         setclickEvent(Method(:WebBrowserWindowStatus))
366                                                         settext("Web Browser")
367                                                 }
368                                                 addaction(oAction)
369                                                 addseparator()
370                                                 oAction = new qAction(this.win1) {
371                                                         setShortcut(new QKeySequence("Alt+f"))
372                                                         setbtnimage(self,"image/source.png")
373                                                         setclickEvent(Method(:FunctionsListWindowStatus))
374                                                         settext("Functions List")
375                                                 }
376                                                 addaction(oAction)
377                                                 addseparator()
378                                                 oAction = new qAction(this.win1) {
379                                                         setShortcut(new QKeySequence("Alt+c"))
380                                                         setbtnimage(self,"image/source.png")
381                                                         setclickEvent(Method(:ClassesListWindowStatus))
382                                                         settext("Classes List")
383                                                 }
384                                                 addaction(oAction)
385                                                 addseparator()
386                                                 oAction = new qAction(this.win1) {
387                                                         setShortcut(new QKeySequence("Alt+o"))
388                                                         setbtnimage(self,"image/source.png")
389                                                         setclickEvent(Method(:OutputWindowStatus))
390                                                         settext("Output Window")
391                                                 }
392                                                 addaction(oAction)
393                                                 addseparator()
394                                                 oAction = new qAction(this.win1) {
395                                                         setShortcut(new QKeySequence("CTRL+SHIFT+F"))
396                                                         setbtnimage(self,"image/formdesigner.png")
397                                                         setclickEvent(Method(:FormDesignerWindowStatus))
398                                                         settext("Form Designer Window")
399                                                 }
400                                                 addaction(oAction)
401                                                 addseparator()
402                                                 oAction = new qAction(this.win1) {
403                                                         setclickEvent(Method(:EditFullScreen))
404                                                         setbtnimage(self,"image/source.png")
405                                                         setShortcut(new QKeySequence("Ctrl+Shift+F1"))
406                                                         settext("Source Code (Full Screen)")
407                                                 }
408                                                 addaction(oAction)
409                                                 addseparator()
410                                                 subStyle = addmenu("Style")
411                                                 subStyle {
412                                                         setbtnimage(self,"image/colors.png")
413                                                         oAction = new qAction(this.win1) {
414                                                                 setShortcut(new QKeySequence("Ctrl+Shift+W"))
415                                                                 setclickEvent(Method("SetStyleColor(0)"))
416                                                                 settext("Windows")
417                                                         }
418                                                         addaction(oAction)
419                                                         addseparator()
420                                                         oAction = new qAction(this.win1) {
421                                                                 setShortcut(new QKeySequence("Ctrl+Shift+2"))
422                                                                 setclickEvent(Method("SetStyleColor(1)"))
423                                                                 settext("Fusion : White")
424                                                         }
425                                                         addaction(oAction)
426                                                         addseparator()
427                                                         oAction = new qAction(this.win1) {
428                                                                 setShortcut(new QKeySequence("Ctrl+Shift+3"))
429                                                                 setclickEvent(Method("SetStyleColor(2)"))
430                                                                 settext("Fusion : Blue")
431                                                         }
432                                                         addaction(oAction)
433                                                         addseparator()
434                                                         oAction = new qAction(this.win1) {
435                                                                 setShortcut(new QKeySequence("Ctrl+Shift+4"))
436                                                                 setclickEvent(Method("SetStyleColor(3)"))
437                                                                 settext("Fusion : Black")
438                                                         }
439                                                         addaction(oAction)
440                                                         addseparator()
441                                                         oAction = new qAction(this.win1) {
442                                                                 setShortcut(new QKeySequence("Ctrl+Shift+5"))
443                                                                 setclickEvent(Method("SetStyleColor(4)"))
444                                                                 settext("Modern")
445                                                         }
446                                                         addaction(oAction)
447                                                         addseparator()
448                                                         oAction = new qAction(this.win1) {
449                                                                 setShortcut(new QKeySequence("Ctrl+Shift+6"))
450                                                                 setclickEvent(Method("SetStyleColor(5)"))
451                                                                 settext("Modern : Black")
452                                                         }
453                                                         addaction(oAction)
454                                                         addseparator()
455                                                         oAction = new qAction(this.win1) {
456                                                                 setShortcut(new QKeySequence("Ctrl+Shift+7"))
457                                                                 setclickEvent(Method("SetStyleColor(6)"))
458                                                                 settext("Modern : Black 2")
459                                                         }
460                                                         addaction(oAction)
461                                                         addseparator()
462                                                         oAction = new qAction(this.win1) {
463                                                                 setShortcut(new QKeySequence("Ctrl+Shift+8"))
464                                                                 setclickEvent(Method("SetStyleColor(7)"))
465                                                                 settext("Notepad : White")
466                                                         }
467                                                         addaction(oAction)
468                                                         addseparator()
469                                                         oAction = new qAction(this.win1) {
470                                                                 setShortcut(new QKeySequence("Ctrl+Shift+9"))
471                                                                 setclickEvent(Method("SetStyleColor(8)"))
472                                                                 settext("Notepad : Purple")
473                                                         }
474                                                         addaction(oAction)
475                                                         addseparator()
476                                                         oAction = new qAction(this.win1) {
477                                                                 setShortcut(new QKeySequence("Ctrl+Shift+A"))
478                                                                 setclickEvent(Method("SetStyleColor(9)"))
479                                                                 settext("Notepad : DarkBlue")
480                                                         }
481                                                         addaction(oAction)
482                                                         addseparator()
483                                                         oAction = new qAction(this.win1) {
484                                                                 setShortcut(new QKeySequence("Ctrl+Shift+F7"))
485                                                                 setclickEvent(Method("SetStyleColor(10)"))
486                                                                 settext("Notepad : Black")
487                                                         }
488                                                         addaction(oAction)
489                                                         addseparator()
490                                                         oAction = new qAction(this.win1) {
491                                                                 setShortcut(new QKeySequence("Ctrl+Shift+F8"))
492                                                                 setclickEvent(Method("SetStyleColor(11)"))
493                                                                 settext("Art")
494                                                         }
495                                                         addaction(oAction)
496                                                         addseparator()
497                                                         oAction = new qAction(this.win1) {
498                                                                 setShortcut(new QKeySequence("Ctrl+Shift+F9"))
499                                                                 setclickEvent(Method("SetStyleColor(12)"))
500                                                                 settext("Art 2")
501                                                         }
502                                                         addaction(oAction)
503                                                         addseparator()
504                                                         oAction = new qAction(this.win1) {
505                                                                 setShortcut(new QKeySequence("Ctrl+Shift+F10"))
506                                                                 setclickEvent(Method("SetStyleColor(13)"))
507                                                                 settext("Art 3")
508                                                         }
509                                                         addaction(oAction)
510                                                         addseparator()
511                                                         oAction = new qAction(this.win1) {
512                                                                 setShortcut(new QKeySequence("Ctrl+Shift+F11"))
513                                                                 setclickEvent(Method("SetStyleColor(14)"))
514                                                                 settext("Image")
515                                                         }
516                                                         addaction(oAction)
517                                                         addseparator()
518                                                         oAction = new qAction(this.win1) {
519                                                                 setShortcut(new QKeySequence("Ctrl+Shift+F12"))
520                                                                 setclickEvent(Method("SetStyleColor(15)"))
521                                                                 settext("Image 2")
522                                                         }
523                                                         addaction(oAction)
524                                                 }
525                                                 addseparator()
526                                                 subStyle = addmenu("Mode")
527                                                 subStyle {
528                                                         oAction = new qAction(this.win1) {
529                                                                 setShortcut(new QKeySequence("Ctrl+1"))
530                                                                 setclickEvent(Method("SetMode(1)"))
531                                                                 settext("General")
532                                                         }
533                                                         addaction(oAction)
534                                                         addseparator()
535                                                         oAction = new qAction(this.win1) {
536                                                                 setShortcut(new QKeySequence("Ctrl+2"))
537                                                                 setclickEvent(Method("SetMode(2)"))
538                                                                 settext("Learning Ring (Editor + Documentation)")
539                                                         }
540                                                         addaction(oAction)
541                                                         addseparator()
542                                                         oAction = new qAction(this.win1) {
543                                                                 setShortcut(new QKeySequence("Ctrl+3"))
544                                                                 setclickEvent(Method("SetMode(3)"))
545                                                                 settext("Coding (Project File + Editor)")
546                                                         }
547                                                         addaction(oAction)
548                                                         addseparator()
549                                                         oAction = new qAction(this.win1) {
550                                                                 setShortcut(new QKeySequence("Ctrl+4"))
551                                                                 setclickEvent(Method("SetMode(4)"))
552                                                                 settext("Coding (All Windows)")
553                                                         }
554                                                         addaction(oAction)
555                                                         addseparator()
556                                                         oAction = new qAction(this.win1) {
557                                                                 setShortcut(new QKeySequence("Ctrl+5"))
558                                                                 setclickEvent(Method("SetMode(5)"))
559                                                                 settext("Coding (Code Editor)")
560                                                         }
561                                                         addaction(oAction)
562                                                         addseparator()
563                                                         oAction = new qAction(this.win1) {
564                                                                 setShortcut(new QKeySequence("Ctrl+6"))
565                                                                 setclickEvent(Method("SetMode(6)"))
566                                                                 settext("GUI Development (Code Editor + Form Designer)")
567                                                         }
568                                                         addaction(oAction)
569                                                         addseparator()
570                                                         oAction = new qAction(this.win1) {
571                                                                 setShortcut(new QKeySequence("Ctrl+7"))
572                                                                 setclickEvent(Method("SetMode(7)"))
573                                                                 settext("Web Development (Code Editor + Web Browser)")
574                                                         }
575                                                         addaction(oAction)
576                                                         addseparator()
577                                                         oAction = new qAction(this.win1) {
578                                                                 setShortcut(new QKeySequence("Ctrl+8"))
579                                                                 setclickEvent(Method("SetMode(8)"))
580                                                                 settext("Testing (Project Files + Code Editor + Output Window)")
581                                                         }
582                                                         addaction(oAction)
583                                                         addseparator()
584                                                         oAction = new qAction(this.win1) {
585                                                                 setShortcut(new QKeySequence("Ctrl+9"))
586                                                                 setclickEvent(Method("SetMode(9)"))
587                                                                 settext("Common (All Windows + Output Window in the bottom)")
588                                                         }
589                                                         addaction(oAction)
590                                                 }
591                                         } 
592                                         subProgram {
593                                                 oAction = new qAction(this.win1) {
594                                                         setShortcut(new QKeySequence("Ctrl+d"))
595                                                         setbtnimage(self,"image/debug.png")
596                                                         settext("Debug (Run then wait!)")
597                                                         setclickEvent(Method(:Debug))
598                                                 }
599                                                 addaction(oAction)
600                                                 oAction = new qAction(this.win1) {
601                                                         setShortcut(new QKeySequence("Ctrl+r"))
602                                                         setbtnimage(self,"image/run.png")
603                                                         settext("Run")
604                                                         setclickEvent(Method(:Run))
605                                                 }
606                                                 addaction(oAction)
607                                                 oAction = new qAction(this.win1) {
608                                                         setShortcut(new QKeySequence("Ctrl+F5"))
609                                                         setbtnimage(self,"image/rungui.png")
610                                                         settext("Run GUI Application (No Console)")
611                                                         setclickEvent(Method(:RunNoConsole))
612                                                 }
613                                                 addaction(oAction)
614                                                 oAction = new qAction(this.win1) {
615                                                         setShortcut(new QKeySequence("Ctrl+F6"))
616                                                         setbtnimage(self,"image/web.png")
617                                                         settext("Run Web Application (Open In Browser)")
618                                                         setclickEvent(Method(:RunInBrowser))
619                                                 }
620                                                 addaction(oAction)
621                                                 addseparator()
622                                                 oAction = new qAction(this.win1) {
623                                                         setShortcut(new QKeySequence("Ctrl+Shift+M"))
624                                                         setbtnimage(self,"image/open.png")
625                                                         settext("Set the Main File to be the current source file")
626                                                         setclickEvent(Method(:SetMainFile))
627                                                 }
628                                                 addaction(oAction)
629                                                 oAction = new qAction(this.win1) {
630                                                         setShortcut(new QKeySequence("Ctrl+Shift+d"))
631                                                         setbtnimage(self,"image/debug.png")
632                                                         settext("Main File : Debug (Run then wait!)")
633                                                         setclickEvent(Method(:DebugMainFile))
634                                                 }
635                                                 addaction(oAction)
636                                                 oAction = new qAction(this.win1) {
637                                                         setShortcut(new QKeySequence("Ctrl+Shift+r"))
638                                                         setbtnimage(self,"image/run.png")
639                                                         settext("Main File : Run")
640                                                         setclickEvent(Method(:RunMainFile))
641                                                 }
642                                                 addaction(oAction)
643                                                 oAction = new qAction(this.win1) {
644                                                         setShortcut(new QKeySequence("Ctrl+Shift+F5"))
645                                                         setbtnimage(self,"image/rungui.png")
646                                                         settext("Main File : Run GUI Application (No Console)")
647                                                         setclickEvent(Method(:RunGUIMainFile))
648                                                 }
649                                                 addaction(oAction)
650                                                 oAction = new qAction(this.win1) {
651                                                         setShortcut(new QKeySequence("Ctrl+Shift+F6"))
652                                                         setbtnimage(self,"image/web.png")
653                                                         settext("Main File : Run Web Application (Open In Browser)")
654                                                         setclickEvent(Method(:RunInBrowserMainFile))
655                                                 }
656                                                 addaction(oAction)
657                                         }  
658                                         subBrowser {
659                                                 for x=1 to len(this.aBrowserLinks)
660                                                         item = this.aBrowserLinks[x]
661                                                         oAction = new qAction(this.win1) {
662                                                                 settext(item[1])
663                                                                 setclickEvent(Method(:BrowserLink+"("+x+")"))
664                                                         }
665                                                         addaction(oAction)
666                                                         if x != len(this.aBrowserLinks)
667                                                                 addseparator()
668                                                         ok
669                                                 next
670                                         }
671                                         subTools {
672                                                 oAction = new qAction(this.win1) {
673                                                         settext("Form Designer")
674                                                         setclickEvent(Method(:OpenFormDesigner))
675                                                 }
676                                                 addaction(oAction)
677                                                 addseparator()
678                                                 oAction = new qAction(this.win1) {
679                                                         setShortcut(new QKeySequence("Alt+R"))
680                                                         settext("RingREPL - Console")
681                                                         setclickEvent(Method(:REPLConsole))
682                                                 }
683                                                 addaction(oAction)
684                                                 oAction = new qAction(this.win1) {
685                                                         setShortcut(new QKeySequence("Alt+Shift+R"))
686                                                         settext("RingREPL - GUI")
687                                                         setclickEvent(Method(:REPLGUI))
688                                                 }
689                                                 addaction(oAction)
690                                                 addseparator()
691                                                 subOSTools = addmenu("Operating System Tools")
692                                                 subOSTools {
693                                                         oAction = new qAction(this.win1) {
694                                                                 settext("Terminal (Command Prompt)")
695                                                                 setShortcut(new QKeySequence("Alt+Shift+T"))
696                                                                 setclickEvent(Method(:OSTerminal))
697                                                         }
698                                                         addaction(oAction)
699                                                         addseparator()
700                                                         oAction = new qAction(this.win1) {
701                                                                 settext("Files Manager (Explorer)")
702                                                                 setShortcut(new QKeySequence("Alt+Shift+F"))
703                                                                 setclickEvent(Method(:OSFilesManager))
704                                                         }
705                                                         addaction(oAction)
706                                                 }
707                                         }
708                                         subDistribute {
709                                                 oAction = new qAction(this.win1) {
710                                                         settext("Generate Ring Object File (*.ringo)")
711                                                         setclickEvent(Method("Distribute(1)"))
712                                                 }
713                                                 addaction(oAction)
714                                                 addseparator()
715                                                 oAction = new qAction(this.win1) {
716                                                         settext("Ring2EXE (Build Console Application)")
717                                                         setclickEvent(Method("Distribute(2)"))
718                                                 }
719                                                 addaction(oAction)
720                                                 addseparator()
721                                                 oAction = new qAction(this.win1) {
722                                                         settext("Ring2EXE (Distribute Application - Use All Runtime)")
723                                                         setclickEvent(Method("Distribute(3)"))
724                                                 }
725                                                 addaction(oAction)
726                                                 oAction = new qAction(this.win1) {
727                                                         settext("Ring2EXE (Distribute Application - Use All Runtime - Hide Console Window)")
728                                                         setclickEvent(Method("Distribute(4)"))
729                                                 }
730                                                 addaction(oAction)
731                                                 oAction = new qAction(this.win1) {
732                                                         settext("Ring2EXE (Distribute RingQt Application)")
733                                                         setclickEvent(Method("Distribute(5)"))
734                                                 }
735                                                 addaction(oAction)
736                                                 oAction = new qAction(this.win1) {
737                                                         settext("Ring2EXE (Distribute RingAllegro Game)")
738                                                         setclickEvent(Method("Distribute(6)"))
739                                                 }
740                                                 addaction(oAction)
741                                                 addseparator()
742                                                 oAction = new qAction(this.win1) {
743                                                         settext("Ring2EXE (Prepare Qt Project - Distribute for Mobile Devices)")
744                                                         setclickEvent(Method("Distribute(7)"))
745                                                 }
746                                                 addaction(oAction)
747                                         }
748                                         subHelp {
749                                                 subHelpLF = addmenu("Language Reference")
750                                                 subHelpLF {
751                                                         oAction = new qAction(this.win1) {
752                                                                 settext("CHM File")
753                                                                 setclickEvent(Method(:OpenCHM))
754                                                         }
755                                                         addaction(oAction)
756                                                         oAction = new qAction(this.win1) {
757                                                                 settext("PDF File")
758                                                                 setclickEvent(Method(:OpenPDF))
759                                                         }
760                                                         addaction(oAction)
761                                                 }
762                                                 addseparator()
763                                                 subHelpTools = addmenu("Development Tools")
764                                                 subHelpTools {
765         
766                                                         oAction = new qAction(this.win1) {
767                                                                 settext("Programming Language")
768                                                                 setclickEvent(Method(:Lang))
769                                                         }
770                                                         addaction(oAction)
771                                                         oAction = new qAction(this.win1) {
772                                                                 settext("GUI Library")
773                                                                 setclickEvent(Method(:GUI))
774                                                         }
775                                                         addaction(oAction)
776                                                 }
777                                                 addseparator()
778                                                 oAction = new qAction(this.win1) {
779                                                         settext("About")
780                                                         setclickEvent(Method(:pAbout))
781                                                 }
782                                                 addaction(oAction)
783                                         }
784                                 }
785                                 setmenubar(menu1)
786                 }
787
788         func CreateStatusbar
789                 win1 {
790                         this.status1 = new qstatusbar(this.win1) {
791                                 showmessage("Ready!",0)
792                         }
793                         setstatusbar(this.status1)
794                 }
795
796         func StatusMessage cMsg
797                 status1.showmessage(cMsg,0)
798
799         func CreateProjectFiles
800                 win1 {
801                         this.tree1 = new qtreeview(this.win1) {
802                                 setStylesheet("font-size: 30")
803                                 setclickedEvent(Method(:ChangeFile))
804                                 setActivatedEvent(Method(:ChangeFile))
805                                 setGeometry(00,00,200,400)
806                                 setminimumwidth(floor(this.oDesktop.width()*0.2))
807                                 chdir(this.cStartUpFolder)
808                                 oDir = new QDir()
809                                 this.ofile = new QFileSystemModel() {
810                                         setrootpath(oDir.currentpath())
811                                         myfiles = new qstringlist() {
812                                                 append("*.ring")
813                                                 append("*.rh")
814                                                 append("*.rform")
815                                                 append("*.txt")
816                                                 append("*.html")
817                                                 append("*.rhtml")
818                                                 append("*.css")
819                                                 append("*.js")
820                                                 append("*.xml")
821                                                 append("*.data")
822                                                 append("*.sh")
823                                                 append("*.bat")
824                                                 append("*.md")
825                                                 append("*.cf")
826                                                 append("*.qml")
827                                                 append("*.ini")
828                                         }
829                                         setnamefilters(myfiles)
830                                         setNameFilterDisables(false)
831                                 }
832                                 setmodel(this.ofile)
833                                 myindex = this.ofile.index(oDir.currentpath(),0)
834                                 for x = 1 to this.ofile.columncount()
835                                         hidecolumn(x)
836                                 next
837                                 setcurrentindex(myindex)
838                                 setexpanded(myindex,true)
839                                 header().hide()
840                                 chdir(exefolder())
841                                 if not ismacosx()
842                                         this.cWebsite = "file:///"+oDir.CurrentPath() + "/../docs/build/html/index.html"
843                                 ok
844                         }
845                         this.oDockProjectFiles = new qdockwidget(this.win1,0) {
846                                 setGeometry(00,00,200,200)
847                                 setwindowtitle("Project Files")
848                                 setwidget(this.tree1)
849                         }
850                 }
851
852         func CreateSourceCode
853                 win1 {
854                         oTabsFilter = new qAllEvents(this.win1) {
855                                 setContextmenuEvent(Method(:TabsContextMenu))
856                         }
857
858                         this.filestabs = new qTabWidget(this.win1) {
859                                 setFixedheight(35)
860                                 settabsclosable(True)
861                                 AddTab(new qWidget(),"noname")
862                                 setcurrentchangedevent(Method(:ChangeFileTab))
863                                 Settabcloserequestedevent(Method(:CloseFileTab))
864                                 installeventfilter(oTabsFilter)
865                         }
866
867                         this.textedit1 = new codeeditor(this.win1) {
868                                 setCursorPositionChangedEvent(Method(:CursorPositionChanged))
869                                 setLineWrapMode(QTextEdit_NoWrap)
870                                 setTextChangedEvent(Method(:TextChanged))
871                                 setLineNumbersAreaColor(this.aStyleColors[:LineNumbersAreaColor])
872                                 setLineNumbersAreaBackColor(this.aStyleColors[:LineNumbersAreaBackColor])
873                                 this.oFilterTextEdit = new qAllEvents(this.win1)
874                                 this.oFilterTextEdit.setkeypressevent(Method(:TextEditKeyPress))
875                                 installEventFilter(this.oFilterTextEdit)
876
877                         }
878                         this.AutoComplete()
879                         this.oACTimer = new qtimer(this.win1) {
880                                 setinterval(5000)
881                                 settimeoutevent(Method(:AutoCompleteTimer))
882                                 start()
883                         }
884                         new RingCodeHighLighter(this.textedit1.document() ) {
885                                 if ismethod(self,:setkeywordsbold) 
886                                         setKeywordsbold(this.lKeywordsBold)
887                                 ok
888                                 setColors(
889                                         this.aStyleColors[:SyntaxKeywordsColor],
890                                         this.aStyleColors[:SyntaxClassNamesColor],
891                                         this.aStyleColors[:SyntaxCommentsColor],
892                                         this.aStyleColors[:SyntaxLiteralsColor],
893                                         this.aStyleColors[:SyntaxFunctionCallsColor]
894                                 )
895                         }
896                         this.oTabsAndText = new qWidget() {
897                                 this.oLayoutTabsText = new qVBoxlayout() {
898                                         AddWidget(this.filestabs)
899                                         AddWidget(this.textedit1)
900                                         setContentsMargins(0,0,0,0)
901                                         setspacing(0)
902                                 }
903                                 setLayout(this.oLayoutTabsText)
904                         }
905                         this.oDockSourceCode = new qdockwidget(this.win1,0) {
906                                 setwidget(this.oTabsAndText)
907                                 setwindowtitle("Source Code")
908                                 setminimumwidth(floor(this.oDesktop.width()*0.17))                                                     
909                         }
910                 }
911
912         func CreateWebBrowser
913                 win1 {
914                         this.oWebBrowser = new qWidget() {
915                                 setstylesheet("color: black ; background-color: rgba(239,235,231,255);")
916                                 setWindowFlags(Qt_SubWindow)
917                                 oWBLabel = new qLabel(this.win1) {
918                                         setText("Website: ")
919                                 }
920                                 this.oWBText = new qLineEdit(this.win1) {
921                                         setText(this.cWebSite)
922                                         setReturnPressedEvent(Method(:WebGo))
923                                 }
924                                 oWBGo = new qPushButton(this.win1) {
925                                         setText("Go")
926                                         setClickEvent(Method(:WebGo))
927                                 }
928                                 oWBBack = new qPushButton(this.win1) {
929                                         setText("Back")
930                                         setClickEvent(Method(:WebBack))
931                                 }
932                                 oWBLayout1 = new qHBoxLayout() {
933                                         addWidget(oWBLabel)
934                                         addWidget(this.oWBText)
935                                         addWidget(oWBGo)
936                                         addWidget(oWBBack)
937                                 }
938                                 this.oWebView = new qWebView(this.win1) {
939                                         loadpage(new qurl(this.cWebSite))
940                                 }
941                                 oWBlayout2 = new qVBoxLayout() {
942                                         addLayout(oWBLayout1)
943                                         addWidget(this.oWebView)
944                                 }
945                                 setLayout(oWBLayout2)
946                         }
947                         this.oDockWebBrowser = new qdockwidget(this.win1,0) {
948                                 setwidget(this.oWebBrowser)
949                                 setwindowtitle("Web Browser")
950                         }
951                 }
952
953         func CreateFunctionsList
954                 win1 {
955                         this.aFunctionsPos = [] # Lines Numbers for each function
956                         this.oFunctionsList = new qListwidget(this.win1) {
957                                 setitemdoubleclickedEvent(Method(:SelectFunction))
958                                 setitemactivatedEvent(Method(:SelectFunction))
959                         }
960                         this.oDockFunctionsList = new qDockwidget(this.win1,0) {
961                                 setWidget(this.oFunctionsList)
962                                 setwindowtitle("Functions")
963                         }
964                 }
965
966         func CreateClassesList
967                 win1 {
968                         this.aClassesPos = []   # Lines Numbers for each class
969                         this.oClassesList = new qListwidget(this.win1) {
970                                 setitemdoubleclickedEvent(Method(:SelectClass))
971                                 setitemactivatedEvent(Method(:SelectClass))
972                         }
973                         this.oDockClassesList = new qDockwidget(this.win1,0) {
974                                 setWidget(this.oClassesList)
975                                 setwindowtitle("Classes")
976                         }
977                 }
978
979         func CreateOutputWindow
980                 win1 {
981                         this.oProcess = NULL
982                         this.oOutputWindow = new qWidget()
983                         oProcessLabel = new qLabel(this.oOutputWindow) {
984                                 setText("Input :")
985                         }
986                         this.oProcessText = new qlineEdit(this.oOutputWindow) {
987                                 setreturnPressedEvent(Method(:SendProcessData))
988                         }
989                         oProcessbtnSend = new qpushbutton(this.oOutputWindow) {
990                                 setText("Send")
991                                 setClickEvent(Method(:SendProcessData))
992                         }
993                         oClearbtn = new qpushbutton(this.oOutputWindow) {
994                                 setText("Clear")
995                                 setClickEvent(Method(:ClearProcess))
996                         }
997                         oProcessLayout1 = new qhboxlayout() {
998                                 AddWidget(oProcessLabel)
999                                 AddWidget(this.oProcessText)
1000                                 Addwidget(oProcessbtnSend)
1001                                 Addwidget(oClearbtn)
1002                         }
1003                         this.oProcessEditbox = new qPlaintextedit(this.oOutputWindow) 
1004                         oProcessLayout2 = new qvboxlayout() {
1005                                 addWidget(this.oProcesseditbox)
1006                                 addlayout(oProcesslayout1)
1007                         }
1008                         this.oOutputWindow.setlayout(oProcessLayout2)
1009                         this.oDockOutputWindow = new qDockWidget(this.win1,0) {
1010                                 setwidget( this.oOutputWindow )
1011                                 setwindowtitle("Output")
1012                         }
1013                 }
1014
1015         func CreateFormDesigner
1016                 win1 {
1017                         this.oDockFormDesigner = new qDockwidget(this.win1,0) {
1018                                 setwindowtitle("Form Designer")
1019                         }
1020                         this.FormDesignerDock()
1021                 }
1022
1023         func PrepareDockableWindows
1024                 win1 {
1025                         adddockwidget(Qt_LeftDockWidgetArea,this.oDockProjectFiles,1)
1026                         adddockwidget(Qt_RightDockWidgetArea,this.oDockSourceCode,2)
1027                         adddockwidget(Qt_RightDockWidgetArea,this.oDockFunctionsList,1)
1028                         adddockwidget(Qt_RightDockWidgetArea,this.oDockClassesList,1)
1029                         adddockwidget(Qt_RightDockWidgetArea,this.oDockWebBrowser,1)
1030                         adddockwidget(Qt_BottomDockWidgetArea,this.oDockOutputWindow,1)
1031                         adddockwidget(Qt_RightDockWidgetArea,this.oDockFormDesigner,1)
1032                         this.win1 {
1033                                 tabifydockwidget(this.oDockFunctionsList,this.oDockClassesList)
1034                                 tabifydockwidget(this.oDockFunctionsList,this.oDockOutputWindow)
1035                                 tabifydockwidget(this.oDockSourceCode,this.oDockFormDesigner)
1036                                 tabifydockwidget(this.oDockSourceCode,this.oDockWebBrowser)
1037                         }
1038                         this.oDockSourceCode.raise()
1039                         this.oDockFunctionsList.raise()
1040                 }
1041
1042         func RingNotepadXButton
1043                 SaveSettings() 
1044
1045         func EditFullScreen
1046                 if lEditboxFullScreen 
1047                         oDockSourceCode { show() raise() }
1048                         textedit1.setParent(oTabsAndText)
1049                         oLayoutTabsText.AddWidget(textedit1)
1050                         textedit1 { show() setfocus(7) }
1051                 else 
1052                         oDockSourceCode.hide()
1053                         textedit1 { 
1054                                 setParent(NULL)
1055                                 showfullscreen()
1056                                 setfocus(7)
1057                         }
1058                 ok
1059                 lEditboxFullScreen = ! lEditboxFullScreen 
1060
1061         func TextEditKeyPress
1062                 nKeyCode = this.oFilterTextEdit.getkeycode()
1063                 # Check CTRL+SHIFT+F1
1064                 if lEditboxFullScreen and nKeyCode = Qt_Key_Escape
1065                         EditFullScreen()
1066                         return
1067                 ok
1068                 this.oFilterTextEdit.setEventoutput(False)