From 9ccbaac697f571381571677c6f7bdb13281fe3a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Minisini?= Date: Mon, 17 Mar 2008 14:54:17 +0000 Subject: [PATCH] [INTERPRETER] * NEW: New API for returning the parent (event observer) of an object. [COMPILER] * BUG: Setting a property without having to use ME is possible now, if the property is defined in the same file of course. * NEW: Mid$() can be used on the left side of an assignment. [GB.FORM] * BUG: ValueBox now reformats its contents after its Value property has been set. [GB.GTK] * BUG: Composed keys are correctly handled again by KeyPress events, but the SCIM input method does not work yet. * BUG: Form are their own event observer only if no event observer is defined at form instanciation. * BUG: The default tray icon is the same as gb.qt now. [GB.QT] * BUG: TrayIcon objects are correctly destroyed at program exit. * BUG: Form are their own event observer only if no event observer is defined at form instanciation. * BUG: TrayIcon Width, Height, ScreenX and ScreenY properties do not crash anymore when the tray icon is hidden. They return zero instead. git-svn-id: svn://localhost/gambas/trunk@1187 867c0c6c-44f3-4631-809d-bfa615b0a4ec --- TODO | 9 +- app/src/gambas3/.settings | 5 +- comp/src/gb.form/.info | 8 +- comp/src/gb.form/ValueBox.class | 3 + examples/examples/Games/GameOfLife/.settings | 5 +- gb.gtk/src/CWindow.cpp | 3 +- gb.gtk/src/gapplication.cpp | 2 +- gb.gtk/src/gtrayicon.cpp | 232 +------------------ gb.qt/share/gb.form.trayicon.h | 165 +++++++++++++ gb.qt/src/CTrayIcon.cpp | 217 ++++------------- gb.qt/src/CWindow.cpp | 3 +- gb.qt/src/main.cpp | 2 + main/gbc/gbc_class.c | 1 + main/gbc/gbc_class.h | 6 +- main/gbc/gbc_trans.h | 4 + main/gbc/gbc_trans_code.c | 6 + main/gbc/gbc_trans_expr.c | 13 +- main/gbc/gbc_trans_subr.c | 62 ++++- main/gbx/gbx_api.c | 1 + main/gbx/gbx_class.h | 89 +++---- main/gbx/gbx_class_native.c | 2 +- main/gbx/gbx_expression.h | 6 +- main/share/gambas.h | 1 + main/share/gb_code_temp.h | 43 +++- main/share/gb_reserved.h | 6 +- main/share/gb_reserved_temp.h | 6 +- 26 files changed, 424 insertions(+), 476 deletions(-) create mode 100644 gb.qt/share/gb.form.trayicon.h diff --git a/TODO b/TODO index 3567b16fd..d75d83544 100644 --- a/TODO +++ b/TODO @@ -1,21 +1,16 @@ TODO list: always incomplete :-) -------------------------------- -CONFIGURATION - -- Raise an error when libffi is not found. - COMPILER - Compilation error must indicate the column, not only the line. -- Better error message if a class form structure is incorrect. Otherwise the error - talks about the form generated code. INTERPRETER - A stack that can grow dynamically. - A special syntax to make variable writable once only (for controls variables). -- Add global parameters for each component. +- Add global parameters for each component. Or no, a global configuration repository, to + tell, for example, which sokcet the mysql component must use... - Make objects printable, with a "_print" hidden method or something else. - Make objects writable and readable to streams. - Perl regexp with the MATCH operator. diff --git a/app/src/gambas3/.settings b/app/src/gambas3/.settings index 6f63e321e..f2218e058 100644 --- a/app/src/gambas3/.settings +++ b/app/src/gambas3/.settings @@ -93,11 +93,10 @@ SearchString=True [OpenFile] File[1]="Project.module:0.0" +Active=1 File[2]="FForm.form" File[3]="FMain.form" -Active=3 -File[4]="img/search.png" -Count=4 +Count=3 [Watches] Count=1 diff --git a/comp/src/gb.form/.info b/comp/src/gb.form/.info index 80120cd63..1199fdbf8 100644 --- a/comp/src/gb.form/.info +++ b/comp/src/gb.form/.info @@ -1081,6 +1081,10 @@ _new m +TextBox_LostFocus +m + + TextBox_KeyPress m @@ -1089,10 +1093,6 @@ TextBox_Change m -TextBox_LostFocus -m - - Timer_Timer m diff --git a/comp/src/gb.form/ValueBox.class b/comp/src/gb.form/ValueBox.class index 7a0349d6d..4fa5d2def 100644 --- a/comp/src/gb.form/ValueBox.class +++ b/comp/src/gb.form/ValueBox.class @@ -89,6 +89,7 @@ END PRIVATE SUB Value_Write(Value AS Variant) SUPER.Text = Str(Value) + TextBox_LostFocus END @@ -215,6 +216,8 @@ PRIVATE SUB FormatDateTime(sSep AS String) SUPER.Text = sVal +FINALLY + ME.Pos = iPos 'DEBUG "ME.Pos = "; iPos 'DEBUG System.Backtrace.Join("/") diff --git a/examples/examples/Games/GameOfLife/.settings b/examples/examples/Games/GameOfLife/.settings index 0ca3d2f71..be4ac811e 100644 --- a/examples/examples/Games/GameOfLife/.settings +++ b/examples/examples/Games/GameOfLife/.settings @@ -15,7 +15,10 @@ SearchComment=False SearchString=True [OpenFile] -Count=0 +File[1]="CGameField.class:0.0" +Active=1 +File[2]="FMain.class:11.0" +Count=2 [Watches] Count=0 diff --git a/gb.gtk/src/CWindow.cpp b/gb.gtk/src/CWindow.cpp index 2d76bf696..daab8d5c5 100644 --- a/gb.gtk/src/CWindow.cpp +++ b/gb.gtk/src/CWindow.cpp @@ -316,7 +316,8 @@ END_METHOD BEGIN_METHOD_VOID(CFORM_new) - GB.Attach(_object, _object, "Form"); + if (!GB.Parent(_object)) + GB.Attach(_object, _object, "Form"); END_METHOD diff --git a/gb.gtk/src/gapplication.cpp b/gb.gtk/src/gapplication.cpp index 87b5d14ce..af5a46228 100644 --- a/gb.gtk/src/gapplication.cpp +++ b/gb.gtk/src/gapplication.cpp @@ -134,7 +134,7 @@ bool gKey::enable(GtkWidget *widget, GdkEventKey *event) _valid = true; _event = *event; - //filter = gtk_im_context_filter_keypress(_im_context, &_event); + filter = gtk_im_context_filter_keypress(_im_context, &_event); //fprintf(stderr, "gKey::enable: filter = %d event->string = '%s'\n", filter, event->string); if (filter && _im_text) diff --git a/gb.gtk/src/gtrayicon.cpp b/gb.gtk/src/gtrayicon.cpp index 88024f9f8..af97be89b 100644 --- a/gb.gtk/src/gtrayicon.cpp +++ b/gb.gtk/src/gtrayicon.cpp @@ -56,236 +56,8 @@ Default picture ******************************************************************************/ -/* XPM */ -static const char *_default_trayicon[] = { -/* columns rows colors chars-per-pixel */ -"24 24 200 2", -" c black", -". c #0C0C0C", -"X c #121015", -"o c #100926", -"O c #10033A", -"+ c #110C35", -"@ c #101334", -"# c #11253E", -"$ c #10293F", -"% c #282828", -"& c #212C37", -"* c gray23", -"= c #100743", -"- c #100C45", -"; c #101F46", -": c #101E4B", -"> c #0F374D", -", c #17264C", -"< c #1D2A45", -"1 c #182F4E", -"2 c #102351", -"3 c #102957", -"4 c #14324C", -"5 c #12384E", -"6 c #173552", -"7 c #103A51", -"8 c #123761", -"9 c #123B60", -"0 c #2D384E", -"q c #10465A", -"w c #104A5E", -"e c #1F4363", -"r c #10526B", -"t c #105470", -"y c #195B79", -"u c #106374", -"i c #106B7C", -"p c #34445C", -"a c #264563", -"s c #2D4966", -"d c #275374", -"f c #265678", -"g c #225A7D", -"h c #2B5374", -"j c #324C67", -"k c #305565", -"l c #39536C", -"z c #345C79", -"x c #4B4B4B", -"c c #404F56", -"v c #4E5356", -"b c #4F575B", -"n c #525354", -"m c #535658", -"M c #565B5D", -"N c #455469", -"B c #4D5D64", -"V c #505D61", -"C c #406277", -"Z c #5C6264", -"A c #55657B", -"S c #556970", -"D c #5C6B71", -"F c #57717B", -"G c #626262", -"H c #6E6C74", -"J c #657075", -"K c #647279", -"L c #687378", -"P c #777777", -"I c #787C7E", -"U c #107080", -"Y c #187788", -"T c #235D81", -"R c #295F82", -"E c #256387", -"W c #296580", -"Q c #296A83", -"! c #297391", -"~ c #297599", -"^ c #2F7C9A", -"/ c #2A7DA3", -"( c #4A7E99", -") c #556380", -"_ c #547683", -"` c #5E728A", -"' c #597884", -"] c #5A7B88", -"[ c #507FA6", -"{ c #657788", -"} c #647E89", -"| c #6F7C83", -" . c #2C84AA", -".. c #2E8EB6", -"X. c #2F92BA", -"o. c #3182A2", -"O. c #3086A8", -"+. c #308FB6", -"@. c #3696AE", -"#. c #3096BE", -"$. c #3098C0", -"%. c #3B9DC3", -"&. c #5D8494", -"*. c #5F8A9B", -"=. c #5386A0", -"-. c #5794B3", -";. c #51A2BD", -":. c #6D838D", -">. c #688E9D", -",. c #76858E", -"<. c #778891", -"1. c #738C9B", -"2. c #798A93", -"3. c #77909C", -"4. c #7A929F", -"5. c #6988A1", -"6. c #6392A5", -"7. c #6295AA", -"8. c #6B99AB", -"9. c #669FB6", -"0. c #7492A2", -"q. c #719AAC", -"w. c #7D98A4", -"e. c #7C9EAF", -"r. c #66A2B9", -"t. c #6BA1B6", -"y. c #6DA0B9", -"u. c #76A1B3", -"i. c #77AABF", -"p. c #579DC2", -"a. c #45A2C6", -"s. c #43A9D0", -"d. c #58ABCE", -"f. c #60AFCE", -"g. c #69AAC3", -"h. c #6BAEC8", -"j. c #6BB1CB", -"k. c #60B0D3", -"l. c #6CB6D2", -"z. c #6DB8D4", -"x. c #77B1C8", -"c. c #76B6D0", -"v. c #76BBD5", -"b. c #79BCD5", -"n. c #59C0E2", -"m. c #70C0DE", -"M. c #65C8E6", -"N. c #66CCEF", -"B. c #69C0E4", -"V. c #71C5E5", -"C. c #72C7E9", -"Z. c #72C9EA", -"A. c #74CEF0", -"S. c #76D3F6", -"D. c #76D5F9", -"F. c #77D8FC", -"G. c #79DCFE", -"H. c #7AE0FE", -"J. c #818282", -"K. c #858688", -"L. c #80939D", -"P. c #939393", -"I. c #9A9A9A", -"U. c #8499A5", -"Y. c #839EA9", -"T. c #889FAB", -"R. c #87A4B2", -"E. c #8DA6B2", -"W. c #92ACB9", -"Q. c #94B0BA", -"!. c #A9A6AE", -"~. c #A8A9A9", -"^. c #B4B5B5", -"/. c #93B2C1", -"(. c #9BB8C7", -"). c #9DBBCB", -"_. c #8CC5DC", -"`. c #A6C7D8", -"'. c #A8CCDD", -"]. c #AED5DF", -"[. c #AACDE1", -"{. c #B0D6E9", -"}. c #B2D8EC", -"|. c #BDE0E3", -" X c #BAE2F7", -".X c #BFE9FA", -"XX c gray76", -"oX c #CCCDCC", -"OX c #C1EDFD", -"+X c #C6F2FF", -"@X c #C8F5FC", -"#X c #CCFAFE", -"$X c #DAECF4", -"%X c #D4FEFE", -"&X c #D9FFFF", -"*X c #E5E5E5", -"=X c #EEEEEE", -"-X c #F5FAFC", -";X c gray100", -":X c None", -/* pixels */ -":X:X:X:X:X:X:X}.}.}.'.`.).W.T.2.| :X:X:X:X:X:X:X", -":X:X:X:X:X.XOXOXOX.X X}.'.).Q.U.,.L M :X:X:X:X:X", -":X:X:X:X+X@X#X#X#X+XOX X{.`.(.E.L.| Z m :X:X:X:X", -":X:X:XOX#X%X&X%X#X#X.X/.4.).).W.U.<.J m x :X:X:X", -":X:X+X#X%X&X&X|.Y.1.D I.^.V ,.K D 3.:.D v v :X:X", -":X.X@X%X&X&XU.z ~ W K.*X=XoXn *X^.B 0.} S B b :X", -":XOX#X&X%X{ E #.$.Q ~.% * *Xn . P G u.>.] F S :X", -"}.OX#X%XW.f #.#.$.^ I J.P.XX& X P.Z i.6.>.&.' F ", -"}.OX#X@Xl ..$.$.$.#.k J.I.c O.s H _ x.9.8.6.>.] ", -"}..X+X].d $.$.$.d.%.$.o.! #.$.+.a 9.c.g.9.9.8.=.", -"[. X.X[.R $.#.a.$X$.$.$.$.$.$.$. .s h.h.h.g.9.7.", -"`.}. X[.h $.#.v.;X%.$.$.$.$.$.$.$./ l l.z.l.j.9.", -"(.'.}.}.p O.#._.;Xb.#.#.$.#.$.$.#.#.E j l.m.z.g.", -"W.).`.'.A 1 ..f.-X$Xa.#.$.$.$.$.#.#.$.e -.V.V.j.", -"T.W.(.).) O , T 5.!.` g / X.$.$.$.$.$...k.A.V.z.", -"<.U.E.W.0.+ O O ; r u r 7 4 T X.$.$.$.s.F.S.V.z.", -"| ,.4.U.E.N o + O - 3 t i i w 6 ~ $.%.N.G.D.Z.l.", -":XL | <.w.e.0 q 7 @ : - 2 r U u 4 T n.H.G.D.Z.:X", -":XM Z J :.0.q.p > w ; 7 3 3 t U Y ;.G.H.G.A.B.:X", -":X:Xm m D } >.6.C < $ # 7 8 y @.M.G.G.G.S.A.:X:X", -":X:X:Xx v S ] >.6.7.=.( =.p.B.F.G.G.G.S.Z.:X:X:X", -":X:X:X:Xv B S &.6.r.g.l.m.Z.Z.S.F.S.A.A.:X:X:X:X", -":X:X:X:X:Xb S ' >.7.r.h.z.m.V.Z.Z.Z.V.:X:X:X:X:X", -":X:X:X:X:X:X:XF ] =.7.9.h.h.z.z.z.:X:X:X:X:X:X:X" -}; + +#include "gb.form.trayicon.h" /***************************************************************************** diff --git a/gb.qt/share/gb.form.trayicon.h b/gb.qt/share/gb.form.trayicon.h new file mode 100644 index 000000000..792b466ac --- /dev/null +++ b/gb.qt/share/gb.form.trayicon.h @@ -0,0 +1,165 @@ +static const char * _default_trayicon[] = { +"24 24 136 2", +" c None", +". c #4167C6", +"+ c #446ECF", +"@ c #4975D8", +"# c #4E7DDF", +"$ c #5586E7", +"% c #314F9E", +"& c #2D4A91", +"* c #3153A9", +"= c #304F9B", +"- c #365AB7", +"; c #3C64C5", +"> c #446FD3", +", c #4D7DE1", +"' c #5A8EED", +") c #2D4371", +"! c #46628B", +"~ c #688CB7", +"{ c #5D7FAA", +"] c #668AB6", +"^ c #3B5CA7", +"/ c #3556A2", +"( c #365BB8", +"_ c #3F67C9", +": c #4977DC", +"< c #568AEB", +"[ c #33496F", +"} c #749CC7", +"| c #80AAD7", +"1 c #81ADD9", +"2 c #82AED9", +"3 c #81ACD8", +"4 c #7AA4D0", +"5 c #729BCA", +"6 c #3457AE", +"7 c #476AB0", +"8 c #577CB9", +"9 c #4870C1", +"0 c #5486E6", +"a c #7BA4D0", +"b c #7DA8D5", +"c c #7AA5D3", +"d c #80ABD8", +"e c #82AEDA", +"f c #83AFDA", +"g c #7EA8D6", +"h c #668CC1", +"i c #7EA9D5", +"j c #81ADD8", +"k c #8CB5DC", +"l c #9FBDDC", +"m c #BBD7ED", +"n c #9AAEC3", +"o c #79A2D1", +"p c #77A1D1", +"q c #5278BB", +"r c #3D5DA1", +"s c #6F97C8", +"t c #587DBA", +"u c #7EA9D6", +"v c #82ADDA", +"w c #81ACD9", +"x c #7FAAD6", +"y c #6F91B9", +"z c #6A85A0", +"A c #9DC4E5", +"B c #849AA4", +"C c #1E1F20", +"D c #6189C5", +"E c #335195", +"F c #395BA9", +"G c #4667A2", +"H c #4E72B6", +"I c #2E4E9F", +"J c #729ACA", +"K c #7FAAD7", +"L c #83AFDB", +"M c #7CA6D3", +"N c #202B38", +"O c #020202", +"P c #495B6D", +"Q c #C4E6FB", +"R c #718186", +"S c #4A6EB5", +"T c #3E5E9E", +"U c #587DBC", +"V c #78A1CF", +"W c #466AB6", +"X c #5F84BB", +"Y c #78A0CE", +"Z c #7FA9D6", +"` c #24313F", +" . c #324256", +".. c #97C1E6", +"+. c #C7E9FC", +"@. c #2F4E98", +"#. c #719ACA", +"$. c #6990C2", +"%. c #81ABD6", +"&. c #78A0CA", +"*. c #5E7DA0", +"=. c #77A0CB", +"-. c #80ABD7", +";. c #93BEE4", +">. c #C4E5FA", +",. c #4B6DA9", +"'. c #6F97C5", +"). c #84AFDA", +"!. c #82ADD9", +"~. c #8AB5DE", +"{. c #B0D6F1", +"]. c #719ACC", +"^. c #7197C3", +"/. c #85B0DB", +"(. c #84B0DB", +"_. c #91BCE2", +":. c #638DD3", +"<. c #799DDB", +"[. c #4A6EC2", +"}. c #718AB8", +"|. c #8DA6CA", +"1. c #92ACD1", +"2. c #C4D9EE", +"3. c #AEC6E7", +"4. c #38539B", +"5. c #405A99", +"6. c #7D95BC", +"7. c #9EB6D7", +"8. c #C3D8EE", +"9. c #5771AD", +"0. c #25418F", +"a. c #4863A1", +"b. c #C5D9EF", +"c. c #6384CA", +"d. c #3D65C5", +"e. c #395AB0", +" ", +" ", +" . + @ # $ ", +" % & * = - ; > , ' ", +" ) ! ~ { ] ^ / ( _ : < ", +" [ } | 1 2 3 4 5 6 7 8 9 0 ", +" a b c d 1 e f g h i j k l m n ", +" o p q r s t u v w f v x y z A B C ", +" D E F G H I J K f L e M N O P Q R ", +" S T U V W X Y u f L f Z ` O ...+. ", +" @.#.$. %.e L L e &.*.=.-.;.>. ", +" ,.'. ).L L f e e e !.~.{. ", +" ].^. /.(.L L f f f f _. ", +" b ", +" -. ", +" ", +" :. ", +" <.[.}.|.1. ", +" 2.3.4.5.6.7. ", +" 8.9.0.a. ", +" b.c.d.e. ", +" ", +" ", +" "}; + + + diff --git a/gb.qt/src/CTrayIcon.cpp b/gb.qt/src/CTrayIcon.cpp index 3f95874ee..ae8d239f2 100644 --- a/gb.qt/src/CTrayIcon.cpp +++ b/gb.qt/src/CTrayIcon.cpp @@ -64,169 +64,7 @@ DECLARE_EVENT(EVENT_Menu); static int _state; static QList _list; -static const char * _default_trayicon[] = { -"24 24 136 2", -" c None", -". c #4167C6", -"+ c #446ECF", -"@ c #4975D8", -"# c #4E7DDF", -"$ c #5586E7", -"% c #314F9E", -"& c #2D4A91", -"* c #3153A9", -"= c #304F9B", -"- c #365AB7", -"; c #3C64C5", -"> c #446FD3", -", c #4D7DE1", -"' c #5A8EED", -") c #2D4371", -"! c #46628B", -"~ c #688CB7", -"{ c #5D7FAA", -"] c #668AB6", -"^ c #3B5CA7", -"/ c #3556A2", -"( c #365BB8", -"_ c #3F67C9", -": c #4977DC", -"< c #568AEB", -"[ c #33496F", -"} c #749CC7", -"| c #80AAD7", -"1 c #81ADD9", -"2 c #82AED9", -"3 c #81ACD8", -"4 c #7AA4D0", -"5 c #729BCA", -"6 c #3457AE", -"7 c #476AB0", -"8 c #577CB9", -"9 c #4870C1", -"0 c #5486E6", -"a c #7BA4D0", -"b c #7DA8D5", -"c c #7AA5D3", -"d c #80ABD8", -"e c #82AEDA", -"f c #83AFDA", -"g c #7EA8D6", -"h c #668CC1", -"i c #7EA9D5", -"j c #81ADD8", -"k c #8CB5DC", -"l c #9FBDDC", -"m c #BBD7ED", -"n c #9AAEC3", -"o c #79A2D1", -"p c #77A1D1", -"q c #5278BB", -"r c #3D5DA1", -"s c #6F97C8", -"t c #587DBA", -"u c #7EA9D6", -"v c #82ADDA", -"w c #81ACD9", -"x c #7FAAD6", -"y c #6F91B9", -"z c #6A85A0", -"A c #9DC4E5", -"B c #849AA4", -"C c #1E1F20", -"D c #6189C5", -"E c #335195", -"F c #395BA9", -"G c #4667A2", -"H c #4E72B6", -"I c #2E4E9F", -"J c #729ACA", -"K c #7FAAD7", -"L c #83AFDB", -"M c #7CA6D3", -"N c #202B38", -"O c #020202", -"P c #495B6D", -"Q c #C4E6FB", -"R c #718186", -"S c #4A6EB5", -"T c #3E5E9E", -"U c #587DBC", -"V c #78A1CF", -"W c #466AB6", -"X c #5F84BB", -"Y c #78A0CE", -"Z c #7FA9D6", -"` c #24313F", -" . c #324256", -".. c #97C1E6", -"+. c #C7E9FC", -"@. c #2F4E98", -"#. c #719ACA", -"$. c #6990C2", -"%. c #81ABD6", -"&. c #78A0CA", -"*. c #5E7DA0", -"=. c #77A0CB", -"-. c #80ABD7", -";. c #93BEE4", -">. c #C4E5FA", -",. c #4B6DA9", -"'. c #6F97C5", -"). c #84AFDA", -"!. c #82ADD9", -"~. c #8AB5DE", -"{. c #B0D6F1", -"]. c #719ACC", -"^. c #7197C3", -"/. c #85B0DB", -"(. c #84B0DB", -"_. c #91BCE2", -":. c #638DD3", -"<. c #799DDB", -"[. c #4A6EC2", -"}. c #718AB8", -"|. c #8DA6CA", -"1. c #92ACD1", -"2. c #C4D9EE", -"3. c #AEC6E7", -"4. c #38539B", -"5. c #405A99", -"6. c #7D95BC", -"7. c #9EB6D7", -"8. c #C3D8EE", -"9. c #5771AD", -"0. c #25418F", -"a. c #4863A1", -"b. c #C5D9EF", -"c. c #6384CA", -"d. c #3D65C5", -"e. c #395AB0", -" ", -" ", -" . + @ # $ ", -" % & * = - ; > , ' ", -" ) ! ~ { ] ^ / ( _ : < ", -" [ } | 1 2 3 4 5 6 7 8 9 0 ", -" a b c d 1 e f g h i j k l m n ", -" o p q r s t u v w f v x y z A B C ", -" D E F G H I J K f L e M N O P Q R ", -" S T U V W X Y u f L f Z ` O ...+. ", -" @.#.$. %.e L L e &.*.=.-.;.>. ", -" ,.'. ).L L f e e e !.~.{. ", -" ].^. /.(.L L f f f f _. ", -" b ", -" -. ", -" ", -" :. ", -" <.[.}.|.1. ", -" 2.3.4.5.6.7. ", -" 8.9.0.a. ", -" b.c.d.e. ", -" ", -" ", -" "}; - +#include "gb.form.trayicon.h" static CTRAYICON *find_object(const QObject *o) { @@ -474,6 +312,47 @@ BEGIN_PROPERTY(CTRAYICON_count) END_PROPERTY +BEGIN_PROPERTY(CTRAYICON_screen_x) + + if (WIDGET) + CCONTROL_screen_x(_object, _param); + else + GB.ReturnInteger(0); + +END_PROPERTY + + +BEGIN_PROPERTY(CTRAYICON_screen_y) + + if (WIDGET) + CCONTROL_screen_y(_object, _param); + else + GB.ReturnInteger(0); + +END_PROPERTY + + +BEGIN_PROPERTY(CTRAYICON_w) + + if (WIDGET) + CCONTROL_w(_object, _param); + else + GB.ReturnInteger(0); + +END_PROPERTY + + +BEGIN_PROPERTY(CTRAYICON_h) + + if (WIDGET) + CCONTROL_h(_object, _param); + else + GB.ReturnInteger(0); + +END_PROPERTY + + + GB_DESC CTrayIconsDesc[] = { @@ -506,12 +385,12 @@ GB_DESC CTrayIconDesc[] = GB_PROPERTY("Tooltip", "s", CTRAYICON_tooltip), GB_PROPERTY("Tag", "v", CTRAYICON_tag), - GB_PROPERTY_READ("ScreenX", "i", CCONTROL_screen_x), - GB_PROPERTY_READ("ScreenY", "i", CCONTROL_screen_y), - GB_PROPERTY_READ("Width", "i", CCONTROL_w), - GB_PROPERTY_READ("Height", "i", CCONTROL_h), - GB_PROPERTY_READ("W", "i", CCONTROL_w), - GB_PROPERTY_READ("H", "i", CCONTROL_h), + GB_PROPERTY_READ("ScreenX", "i", CTRAYICON_screen_x), + GB_PROPERTY_READ("ScreenY", "i", CTRAYICON_screen_y), + GB_PROPERTY_READ("Width", "i", CTRAYICON_w), + GB_PROPERTY_READ("Height", "i", CTRAYICON_h), + GB_PROPERTY_READ("W", "i", CTRAYICON_w), + GB_PROPERTY_READ("H", "i", CTRAYICON_h), GB_EVENT("Enter", NULL, NULL, &EVENT_Enter), GB_EVENT("GotFocus", NULL, NULL, &EVENT_GotFocus), diff --git a/gb.qt/src/CWindow.cpp b/gb.qt/src/CWindow.cpp index e3ef16509..aacc4d179 100644 --- a/gb.qt/src/CWindow.cpp +++ b/gb.qt/src/CWindow.cpp @@ -395,7 +395,8 @@ END_METHOD BEGIN_METHOD_VOID(CFORM_new) - GB.Attach(_object, _object, "Form"); + if (!GB.Parent(_object)) + GB.Attach(_object, _object, "Form"); END_METHOD diff --git a/gb.qt/src/main.cpp b/gb.qt/src/main.cpp index 015132e5a..1d80d3884 100644 --- a/gb.qt/src/main.cpp +++ b/gb.qt/src/main.cpp @@ -526,6 +526,8 @@ static void hook_loop() if (!must_quit()) qApp->exec(); + else + MAIN_check_quit(); //qDebug("Exit event loop"); } diff --git a/main/gbc/gbc_class.c b/main/gbc/gbc_class.c index d164a37b8..e6b37d03d 100644 --- a/main/gbc/gbc_class.c +++ b/main/gbc/gbc_class.c @@ -223,6 +223,7 @@ void CLASS_add_function(CLASS *class, TRANS_FUNC *decl) func->line = decl->line; func->name = decl->index; func->last_code = (-1); + func->last_code2 = (-1); func->stack = 8; // Some stack may be needed for initialization functions func->finally = 0; func->catch = 0; diff --git a/main/gbc/gbc_class.h b/main/gbc/gbc_class.h index 455141519..572e3519f 100644 --- a/main/gbc/gbc_class.h +++ b/main/gbc/gbc_class.h @@ -101,15 +101,17 @@ typedef int line; // ...which is this line ushort *code; // Compile bytecode + short *pos_line; // Bytecode position of each code line + ushort ncode; // Number of instructions ushort ncode_max; // Size of the bytecode allocation short last_code; // Last compiled bytecode position + short last_code2; // Last last compiled bytecode position short stack; // Needed stack short finally; // FINALLY position short catch; // CATCH position - - short *pos_line; // Bytecode position of each code line + short _reserved2; } PACKED FUNCTION; diff --git a/main/gbc/gbc_trans.h b/main/gbc/gbc_trans.h index 0993cc0cc..b53ad4591 100644 --- a/main/gbc/gbc_trans.h +++ b/main/gbc/gbc_trans.h @@ -88,6 +88,8 @@ enum { TS_SUBR_SLEEP, TS_SUBR_RANDOMIZE, TS_SUBR_ERROR_TO, + TS_SUBR_LEFT, + TS_SUBR_MID, }; enum { @@ -133,6 +135,7 @@ PUBLIC void TRANS_init_optional(TRANS_PARAM *param); /* trans_expr.c */ PUBLIC void TRANS_expression(bool check); +PUBLIC void TRANS_ignore_expression(); PUBLIC void TRANS_reference(void); PUBLIC boolean TRANS_affectation(bool check); PUBLIC void TRANS_operation(short op, short nparam, bool output, PATTERN previous); @@ -212,6 +215,7 @@ PUBLIC void TRANS_debug(void); PUBLIC void TRANS_error(void); PUBLIC void TRANS_scan(void); PUBLIC void TRANS_randomize(void); +PUBLIC void TRANS_mid(void); #endif diff --git a/main/gbc/gbc_trans_code.c b/main/gbc/gbc_trans_code.c index 65dbdb525..58098f249 100644 --- a/main/gbc/gbc_trans_code.c +++ b/main/gbc/gbc_trans_code.c @@ -226,6 +226,12 @@ void TRANS_statement(void) return; } } + else if (PATTERN_is_subr(look[0]) && (PATTERN_index(look[0]) == SUBR_Mid || PATTERN_index(look[0]) == SUBR_MidS)) + { + JOB->current++; + TRANS_mid(); + return; + } if (!TRANS_affectation(FALSE)) TRANS_expression(TRUE); diff --git a/main/gbc/gbc_trans_expr.c b/main/gbc/gbc_trans_expr.c index d4593ad89..0d4a6a3fd 100644 --- a/main/gbc/gbc_trans_expr.c +++ b/main/gbc/gbc_trans_expr.c @@ -191,7 +191,12 @@ static void trans_identifier(int index, boolean first, boolean point, PATTERN ne CODE_push_extern(sym->global.value); } - else if (type == TK_EVENT || type == TK_PROPERTY || type == TK_LABEL) + else if (type == TK_PROPERTY) + { + CODE_push_me(FALSE); + CODE_push_unknown(CLASS_add_unknown(JOB->class, index)); + } + else if (type == TK_EVENT || type == TK_LABEL) { goto __CLASS; } @@ -561,6 +566,12 @@ PUBLIC void TRANS_expression(boolean check_statement) } } +PUBLIC void TRANS_ignore_expression() +{ + TRANS_TREE *tree = TRANS_tree(FALSE); + ARRAY_delete(&tree); +} + PUBLIC void TRANS_reference(void) { diff --git a/main/gbc/gbc_trans_subr.c b/main/gbc/gbc_trans_subr.c index 2943fbf3f..f29854d6e 100644 --- a/main/gbc/gbc_trans_subr.c +++ b/main/gbc/gbc_trans_subr.c @@ -55,7 +55,8 @@ static void trans_subr(int subr, int nparam) { ".Shell" }, { ".Wait" }, { ".Kill" }, { ".Move" }, { ".Mkdir" }, { ".Rmdir" }, { ".Array" }, { ".Copy" }, { ".Link" }, { ".Error" }, { ".Lock" }, { ".Unlock" }, { ".InputFrom" }, { ".OutputTo" }, { ".Debug" }, - { ".Sleep" }, { ".Randomize" }, { ".ErrorTo" } + { ".Sleep" }, { ".Randomize" }, { ".ErrorTo" }, + { "Left" }, { "Mid" } }; TRANS_SUBR_INFO *tsi = &subr_info[subr]; @@ -692,7 +693,7 @@ void TRANS_swap(void) sa = JOB->current; TRANS_expression(FALSE); - TRANS_want(RS_COMMA, "comma"); + TRANS_want(RS_COMMA, "Comma"); sb = JOB->current; TRANS_expression(FALSE); @@ -722,6 +723,63 @@ void TRANS_rmdir(void) CODE_drop(); } +void TRANS_mid() +{ + PATTERN *str; + PATTERN *pos; + PATTERN *len; + PATTERN *save; + + TRANS_want(RS_LBRA, "Left brace"); + + str = JOB->current; + TRANS_expression(FALSE); + + TRANS_want(RS_COMMA, "Comma"); + + pos = JOB->current; + TRANS_expression(FALSE); + CODE_push_number(1); + CODE_op(C_SUB, 2, TRUE); + TRANS_subr(TS_SUBR_LEFT, 2); + + if (TRANS_is(RS_COMMA)) + { + len = JOB->current; + TRANS_ignore_expression(); + } + else + { + len = NULL; + } + + TRANS_want(RS_RBRA, "Right brace"); + TRANS_want(RS_EQUAL, "Equal"); + + TRANS_expression(FALSE); + + save = JOB->current; + + if (len) + { + JOB->current = str; + TRANS_expression(FALSE); + JOB->current = pos; + TRANS_expression(FALSE); + JOB->current = len; + TRANS_expression(FALSE); + CODE_op(C_ADD, 2, TRUE); + TRANS_subr(TS_SUBR_MID, 2); + } + + CODE_op(C_CAT, len ? 3 : 2, FALSE); + + JOB->current = str; + TRANS_reference(); + + JOB->current = save; +} + #if 0 void TRANS_scan(void) { diff --git a/main/gbx/gbx_api.c b/main/gbx/gbx_api.c index 9c9828f29..1f118cb66 100644 --- a/main/gbx/gbx_api.c +++ b/main/gbx/gbx_api.c @@ -115,6 +115,7 @@ void *GAMBAS_Api[] = (void *)GB_UnrefKeep, (void *)GB_Detach, (void *)GB_Attach, + (void *)OBJECT_parent, (void *)GB_New, (void *)CLASS_auto_create, (void *)GB_CheckObject, diff --git a/main/gbx/gbx_class.h b/main/gbx/gbx_class.h index 19ced3a2b..27e232e51 100644 --- a/main/gbx/gbx_class.h +++ b/main/gbx/gbx_class.h @@ -227,57 +227,58 @@ enum typedef struct _CLASS { - struct _CLASS *class; /* 4 Points at the 'Class' class ! */ - int ref; /* 8 Reference count */ - int count; /* 12 Number of instanciated objects */ - struct _CLASS *parent; /* 16 Inherited class */ - COMPONENT *component; /* 20 The component the class belongs to */ - char *name; /* 24 Class name */ - char *path; /* 28 Source file path */ + struct _CLASS *class; /* 4 Points at the 'Class' class ! */ + int ref; /* 8 Reference count */ + int count; /* 12 Number of instanciated objects */ + struct _CLASS *parent; /* 16 Inherited class */ + COMPONENT *component; /* 20 The component the class belongs to */ + char *name; /* 24 Class name */ + char *path; /* 28 Source file path */ - unsigned state : 2; /* Initialization state */ - unsigned debug : 1; /* Debugging information ? */ - unsigned free_name : 1; /* Must free the class name */ - unsigned free_event : 1; /* Must free class->event */ - unsigned in_load : 1; /* Class being loaded */ - unsigned exit : 1; /* Marker used by CLASS_exit */ - unsigned auto_create : 1; /* Automatically instanciated */ - unsigned no_create : 1; /* Cannot instanciate this class */ - unsigned is_virtual : 1; /* Virtual class (name beginning with a dot) */ - unsigned mmapped : 1; /* mmap() was used to load the class */ - unsigned swap : 1; /* class endianness was swapped */ - unsigned enum_static : 1; /* if class enumeration is static */ - unsigned quick_array : 2; /* array accessor optimization type */ - unsigned is_stream : 1; /* 30 If the class inherits stream */ - - short n_desc; /* 32 number of descriptions */ - CLASS_DESC_SYMBOL *table; /* 36 class description */ - - short n_event; /* 38 number of events */ - short _reserved; /* 40 */ - - CLASS_EVENT *event; /* 44 event description */ - - int _reserved2; /* 48 quick array get method */ - int _reserved3; /* 52 quick array put method */ + unsigned state : 2; /* Initialization state */ + unsigned debug : 1; /* Debugging information ? */ + unsigned free_name : 1; /* Must free the class name */ + unsigned free_event : 1; /* Must free class->event */ + unsigned in_load : 1; /* Class being loaded */ + unsigned exit : 1; /* Marker used by CLASS_exit */ + unsigned auto_create : 1; /* Automatically instanciated */ + unsigned no_create : 1; /* Cannot instanciate this class */ + unsigned is_virtual : 1; /* Virtual class (name beginning with a dot) */ + unsigned mmapped : 1; /* mmap() was used to load the class */ + unsigned swap : 1; /* class endianness was swapped */ + unsigned enum_static : 1; /* if class enumeration is static */ + unsigned quick_array : 2; /* array accessor optimization type */ + unsigned is_stream : 1; /* 30 If the class inherits stream */ - int (*check)(); /* 56 method for checking that an object is valid */ + unsigned _reserved : 16; /* 32 */ - short special[16]; /* 88 special functions index (_new, _free, ...) */ + short n_desc; /* 34 number of descriptions */ + short n_event; /* 36 number of events */ - uint size_stat; /* 92 static class size */ - uint size; /* 96 dynamic class size */ - uint off_event; /* 100 offset of OBJECT_EVENT structure in the object */ + CLASS_DESC_SYMBOL *table; /* 40 class description */ - char *data; /* 104 class file data for loaded class / generated description for native class */ - CLASS_LOAD *load; /* 108 information about loaded class */ + CLASS_EVENT *event; /* 44 event description */ - char *stat; /* 112 static class data */ - TYPE *signature; /* 116 signatures address */ - char *string; /* 120 strings address */ + int _reserved1; /* 48 */ + int _reserved2; /* 52 quick array put method */ + + int (*check)(); /* 56 method for checking that an object is valid */ - void *instance; /* 124 automatically created instance */ - struct _CLASS *next; /* 128 next class */ + short special[16]; /* 88 special functions index (_new, _free, ...) */ + + uint size_stat; /* 92 static class size */ + uint size; /* 96 dynamic class size */ + uint off_event; /* 100 offset of OBJECT_EVENT structure in the object */ + + char *data; /* 104 class file data for loaded class / generated description for native class */ + CLASS_LOAD *load; /* 108 information about loaded class */ + + char *stat; /* 112 static class data */ + TYPE *signature; /* 116 signatures address */ + char *string; /* 120 strings address */ + + void *instance; /* 124 automatically created instance */ + struct _CLASS *next; /* 128 next class */ } CLASS; diff --git a/main/gbx/gbx_class_native.c b/main/gbx/gbx_class_native.c index 7dc1be2ff..8ff10761d 100644 --- a/main/gbx/gbx_class_native.c +++ b/main/gbx/gbx_class_native.c @@ -145,7 +145,7 @@ CLASS *CLASS_register_class(GB_DESC *ptr, CLASS *class) class->check = (int (*)())(desc->hook.func); //SET_IF_NULL(class->check, CLASS_return_zero); break; - + default: start = desc; break; diff --git a/main/gbx/gbx_expression.h b/main/gbx/gbx_expression.h index aae79f276..c206a1f5d 100644 --- a/main/gbx/gbx_expression.h +++ b/main/gbx/gbx_expression.h @@ -51,11 +51,13 @@ typedef int *var; short nvar; short last_code; + short last_code2; + unsigned analyze : 1; + unsigned _reserved : 15; int stack_usage; void *op; - unsigned analyze : 1; - unsigned _reserved : 31; } + PACKED EXPRESSION; typedef diff --git a/main/share/gambas.h b/main/share/gambas.h index 527e54f17..19ae39dd9 100644 --- a/main/share/gambas.h +++ b/main/share/gambas.h @@ -788,6 +788,7 @@ typedef void (*UnrefKeep)(void **, int); void (*Detach)(void *); void (*Attach)(void *, void *, const char *); + void *(*Parent)(void *); int (*New)(void **, GB_CLASS, char *, void *); void *(*AutoCreate)(GB_CLASS, int); int (*CheckObject)(void *); diff --git a/main/share/gb_code_temp.h b/main/share/gb_code_temp.h index cdbc77367..9e114e734 100644 --- a/main/share/gb_code_temp.h +++ b/main/share/gb_code_temp.h @@ -50,6 +50,7 @@ static void start_code(void) if (JOB->debug && !JOB->nobreak) CODE_break(); #endif + cur_func->last_code2 = cur_func->last_code; cur_func->last_code = cur_func->ncode; } @@ -99,6 +100,13 @@ static void use_stack(int use) #endif } +static void CODE_undo() +{ + cur_func->ncode = cur_func->last_code; + cur_func->last_code = cur_func->last_code2; + cur_func->last_code2 = (-1); +} + int CODE_get_current_pos(void) { return cur_func->ncode; @@ -154,6 +162,14 @@ static ushort *get_last_code() return &cur_func->code[cur_func->last_code]; } +static ushort *get_last_code2() +{ + if (cur_func->last_code2 < 0) + return NULL; + + return &cur_func->code[cur_func->last_code2]; +} + #ifdef PROJECT_COMP bool CODE_popify_last(void) @@ -258,7 +274,7 @@ bool CODE_check_jump_not(void) if (op != C_NOT) return FALSE; - cur_func->ncode--; + CODE_undo(); return TRUE; } @@ -682,10 +698,14 @@ void CODE_op(short op, short nparam, boolean fixed) { if (op == C_ADD || op == C_SUB) { - PCODE *last_code = get_last_code(); + PCODE *last_code; + short value, value2; + + last_code = get_last_code(); + if (last_code && ((*last_code & 0xF000) == C_PUSH_QUICK)) { - short value = *last_code & 0xFFF; + value = *last_code & 0xFFF; if (value >= 0x800) value |= 0xF000; if (op == C_SUB) value = (-value); @@ -696,6 +716,23 @@ void CODE_op(short op, short nparam, boolean fixed) *last_code = C_ADD_QUICK | (value & 0x0FFF); use_stack(1 - nparam); + + // Now, look if we are PUSH QUICK then ADD QUICK + + last_code = get_last_code2(); + if (last_code && ((*last_code & 0xF000) == C_PUSH_QUICK)) + { + value2 = *last_code & 0xFFF; + if (value2 >= 0x800) value2 |= 0xF000; + value += value2; + + if (value >= -2048L && value < 2048L) + { + *last_code = C_PUSH_QUICK | (value & 0x0FFF); + CODE_undo(); + } + } + return; } } diff --git a/main/share/gb_reserved.h b/main/share/gb_reserved.h index d602eda5e..efe53c6b3 100644 --- a/main/share/gb_reserved.h +++ b/main/share/gb_reserved.h @@ -306,6 +306,8 @@ EXTERN TABLE *COMP_res_table; EXTERN TABLE *COMP_subr_table; EXTERN int SUBR_VarPtr; +EXTERN int SUBR_Mid; +EXTERN int SUBR_MidS; #endif @@ -316,8 +318,6 @@ int RESERVED_find_word(const char *word, int len); SUBR_INFO *SUBR_get(const char *subr_name); SUBR_INFO *SUBR_get_from_opcode(ushort opcode, ushort optype); -int SUBR_get_index(const char *subr_name); -/*CONST_INFO *CONST_get(char *cst_name); -CONST_INFO *CONST_get_from_index(short index);*/ +//int SUBR_get_index(const char *subr_name); #endif diff --git a/main/share/gb_reserved_temp.h b/main/share/gb_reserved_temp.h index 4d4d5aede..89357776b 100644 --- a/main/share/gb_reserved_temp.h +++ b/main/share/gb_reserved_temp.h @@ -507,6 +507,8 @@ TABLE *COMP_res_table; TABLE *COMP_subr_table; int SUBR_VarPtr; +int SUBR_Mid; +int SUBR_MidS; static uchar _operator_table[256] = { 0 }; @@ -559,7 +561,7 @@ void RESERVED_init(void) } #endif - /* Table des routines int�r�s */ + /* Subroutines table */ TABLE_create(&COMP_subr_table, 0, TF_IGNORE_CASE); for (subr = &COMP_subr_info[0]; subr->name; subr++) @@ -576,6 +578,8 @@ void RESERVED_init(void) #endif SUBR_VarPtr = get_index("VarPtr"); + SUBR_Mid = get_index("Mid"); + SUBR_MidS = get_index("Mid$"); /* Table des constantes */