From 4188be2a76f8aed89ef682ff6df01b83babea22b Mon Sep 17 00:00:00 2001 From: FellippeHeitor Date: Sat, 22 Oct 2016 10:09:59 -0200 Subject: [PATCH] File loading/saving routines implemented. Also: - New list box method: __UI_ReplaceListBoxItem. - Menu items can have icons. --- InForm.ui | 126 +++-- InForm/disk.png | Bin 0 -> 12965 bytes UiEditor.bas | 1128 ++++++++++++++++++++++++++++++------------- UiEditor.frm | 131 ++--- UiEditorPreview.bas | 137 ++++-- xp.uitheme | 49 +- 6 files changed, 1071 insertions(+), 500 deletions(-) create mode 100644 InForm/disk.png diff --git a/InForm.ui b/InForm.ui index c500130..549b9df 100644 --- a/InForm.ui +++ b/InForm.ui @@ -57,6 +57,7 @@ TYPE __UI_ControlTYPE Interval AS _FLOAT HotKey AS INTEGER HotKeyOffset AS INTEGER + HotKeyPosition AS INTEGER ShowPercentage AS _BYTE InputViewStart AS LONG PreviousInputViewStart AS LONG @@ -137,13 +138,13 @@ DIM SHARED __UI_ActiveMenu AS LONG, __UI_ParentMenu AS LONG DIM SHARED __UI_ActiveTipID AS LONG, __UI_TipTimer AS DOUBLE DIM SHARED __UI_ActiveTipTop AS INTEGER, __UI_ActiveTipLeft AS INTEGER DIM SHARED __UI_FormID AS LONG, __UI_HasMenuBar AS LONG -DIM SHARED __UI_ScrollbarWidth AS INTEGER -DIM SHARED __UI_ScrollbarButtonHeight AS INTEGER +DIM SHARED __UI_ScrollbarWidth AS INTEGER, __UI_ScrollbarButtonHeight AS INTEGER +DIM SHARED __UI_MenuBarOffset AS INTEGER, __UI_MenuItemOffset AS INTEGER DIM SHARED __UI_ForceRedraw AS _BYTE, __UI_AutoRefresh AS _BYTE DIM SHARED __UI_CurrentTitle AS STRING, __UI_WindowHandle AS LONG DIM SHARED __UI_DesignMode AS _BYTE, __UI_FirstSelectedID AS LONG, __UI_ResizingForm AS _BYTE DIM SHARED __UI_WaitMessage AS STRING, __UI_TotalSelectedControls AS LONG -DIM SHARED __UI_WaitMessageHandle AS LONG, __UI_ControlOperation AS _BYTE +DIM SHARED __UI_WaitMessageHandle AS LONG 'Control types: DIM SHARED __UI_Type(0 TO 17) AS __UI_Types @@ -211,6 +212,8 @@ CONST __UI_MsgBox_Continue = 11 CONST __UI_True = -1 CONST __UI_False = 0 +ON ERROR GOTO __UI_ErrorHandler + __UI_LoadForm __UI_Init @@ -220,6 +223,10 @@ DO _LIMIT 1 LOOP +SYSTEM +__UI_ErrorHandler: +RESUME NEXT + '--------------------------------------------------------------------------------- SUB __UI_Init DIM i AS LONG @@ -231,7 +238,7 @@ SUB __UI_Init IF __UI_Controls(__UI_FormID).CenteredWindow THEN _SCREENMOVE _MIDDLE - IF __UI_Controls(__UI_FormID).Font = 0 THEN __UI_Controls(__UI_FormID).Font = __UI_Font("VGA Emulated", "", 16, "") + IF __UI_Controls(__UI_FormID).Font = 0 THEN __UI_Controls(__UI_FormID).Font = __UI_Font("", 16, "") IF __UI_Captions(__UI_FormID) = "" THEN __UI_Captions(__UI_FormID) = RTRIM$(__UI_Controls(__UI_FormID).Name) @@ -555,6 +562,8 @@ SUB __UI_UpdateDisplay IF __UI_AutoRefresh = __UI_False THEN EXIT SUB + ON ERROR GOTO __UI_ErrorHandler + __UI_BeforeUpdateDisplay 'Clear frames canvases and count its children: @@ -1335,12 +1344,10 @@ SUB __UI_EventDispatcher __UI_Controls(__UI_DraggingID).Top = __UI_PreviewTop __UI_Controls(__UI_DraggingID).Left = __UI_PreviewLeft __UI_DraggingID = 0 - __UI_EndDrag END IF IF __UI_IsResizing THEN __UI_IsResizing = __UI_False __UI_ResizingID = 0 - __UI_EndResize END IF IF __UI_DraggingThumb THEN __UI_DraggingThumb = __UI_False @@ -2063,7 +2070,6 @@ SUB __UI_EventDispatcher NEXT END IF END IF - __UI_ControlOperation = __UI_True CASE ASC("C"), ASC("c") IF __UI_CtrlIsDown AND __UI_TotalSelectedControls > 0 THEN ControlClipboard$ = MKL$(__UI_TotalSelectedControls) @@ -2074,7 +2080,6 @@ SUB __UI_EventDispatcher NEXT _CLIPBOARD$ = "InForm" + CHR$(1) END IF - __UI_ControlOperation = __UI_True CASE ASC("V"), ASC("v") IF __UI_CtrlIsDown THEN Clip$ = _CLIPBOARD$ @@ -2122,7 +2127,6 @@ SUB __UI_EventDispatcher __UI_AutoRefresh = __UI_True END IF END IF - __UI_ControlOperation = __UI_True CASE 21248 'Delete FOR i = 1 TO UBOUND(__UI_Controls) IF __UI_Controls(i).ControlIsSelected THEN @@ -2140,7 +2144,6 @@ SUB __UI_EventDispatcher __UI_TotalSelectedControls = __UI_TotalSelectedControls - 1 END IF NEXT - __UI_ControlOperation = __UI_True CASE 19200 'Left arrow key FOR i = 1 TO UBOUND(__UI_Controls) IF __UI_Controls(i).ControlIsSelected THEN @@ -2204,8 +2207,8 @@ FUNCTION __UI_GetFontID (FontHandle&) END FUNCTION '--------------------------------------------------------------------------------- -FUNCTION __UI_Font& (NewFontName AS STRING, NewFontFile AS STRING, NewFontSize AS INTEGER, NewFontAttributes AS STRING) - DIM NextSlot AS LONG, i AS LONG, Temp$ +FUNCTION __UI_Font& (NewFontFile AS STRING, NewFontSize AS INTEGER, TempNewFontAttributes AS STRING) + DIM NextSlot AS LONG, i AS LONG, Temp$, NewFontAttributes AS STRING 'If the passed font is already loaded, we'll just return its handle FOR NextSlot = 1 TO UBOUND(__UI_Controls) @@ -2242,13 +2245,41 @@ FUNCTION __UI_Font& (NewFontName AS STRING, NewFontFile AS STRING, NewFontSize A __UI_DestroyControl __UI_Controls(NextSlot) 'This control is inactive but may still retain properties __UI_Controls(NextSlot).ID = NextSlot __UI_Controls(NextSlot).Type = __UI_Type_Font - __UI_Controls(NextSlot).Name = NewFontName + __UI_Controls(NextSlot).Name = "Font" + LTRIM$(STR$(__UI_Type(__UI_Type_Font).Count)) IF NewFontFile = "" THEN 'Internal emulated fonts - __UI_Controls(NextSlot).Value = NewFontSize - __UI_Controls(NextSlot).Max = NewFontSize + IF NewFontSize <> 8 AND NewFontSize <> 16 THEN + __UI_Controls(NextSlot).Value = 16 + __UI_Controls(NextSlot).Max = 16 + ELSE + __UI_Controls(NextSlot).Value = NewFontSize + __UI_Controls(NextSlot).Max = NewFontSize + END IF ELSE + 'Parse attributes + IF INSTR(UCASE$(TempNewFontAttributes), "MONOSPACE") THEN NewFontAttributes = "MONOSPACE" + IF INSTR(UCASE$(TempNewFontAttributes), "BOLD") THEN + IF LEN(NewFontAttributes) > 0 THEN NewFontAttributes = NewFontAttributes + "," + NewFontAttributes = NewFontAttributes + "BOLD" + END IF + IF INSTR(UCASE$(TempNewFontAttributes), "ITALIC") THEN + IF LEN(NewFontAttributes) > 0 THEN NewFontAttributes = NewFontAttributes + "," + NewFontAttributes = NewFontAttributes + "ITALIC" + END IF + IF INSTR(UCASE$(TempNewFontAttributes), "UNDERLINE") THEN + IF LEN(NewFontAttributes) > 0 THEN NewFontAttributes = NewFontAttributes + "," + NewFontAttributes = NewFontAttributes + "UNDERLINE" + END IF + IF INSTR(UCASE$(TempNewFontAttributes), "UNICODE") THEN + IF LEN(NewFontAttributes) > 0 THEN NewFontAttributes = NewFontAttributes + "," + NewFontAttributes = NewFontAttributes + "UNICODE" + END IF + IF INSTR(UCASE$(TempNewFontAttributes), "DONTBLEND") THEN + IF LEN(NewFontAttributes) > 0 THEN NewFontAttributes = NewFontAttributes + "," + NewFontAttributes = NewFontAttributes + "DONTBLEND" + END IF + __UI_Controls(NextSlot).Value = _LOADFONT(NewFontFile, NewFontSize, NewFontAttributes) __UI_Controls(NextSlot).Max = NewFontSize __UI_Texts(NextSlot) = NewFontFile @@ -2259,6 +2290,7 @@ FUNCTION __UI_Font& (NewFontName AS STRING, NewFontFile AS STRING, NewFontSize A 'If loading the requested font fails, we default to _FONT 16 IF __UI_Controls(NextSlot).Value <= 0 THEN __UI_DestroyControl __UI_Controls(NextSlot) + __UI_Controls(NextSlot).Value = 16 __UI_Font& = 16 END IF END IF @@ -2320,7 +2352,7 @@ FUNCTION __UI_NewControl (ControlType AS INTEGER, ControlName AS STRING, NewWidt __UI_Controls(NextSlot).Font = __UI_Controls(ParentID).Font END IF - IF __UI_Controls(NextSlot).Font = 0 THEN __UI_Controls(NextSlot).Font = __UI_Font("VGA Emulated", "", 16, "") + IF __UI_Controls(NextSlot).Font = 0 THEN __UI_Controls(NextSlot).Font = __UI_Font("", 16, "") __UI_Controls(NextSlot).Width = NewWidth __UI_Controls(NextSlot).Height = NewHeight @@ -2504,7 +2536,7 @@ END SUB '--------------------------------------------------------------------------------- SUB __UI_SetCaption (Control$, TempCaption$) DIM i AS LONG, FindSep%, ThisID AS LONG, NewCaption$, UsedList$, TempKey AS _UNSIGNED _BYTE - DIM PrevFont AS LONG, TempCanvas AS LONG, PrevDest AS LONG, ItemOffset AS INTEGER + DIM PrevFont AS LONG, TempCanvas AS LONG, PrevDest AS LONG ThisID = __UI_GetID(Control$) IF ThisID = 0 THEN EXIT SUB @@ -2524,6 +2556,7 @@ SUB __UI_SetCaption (Control$, TempCaption$) TempKey = ASC(UCASE$(NewCaption$), FindSep%) IF INSTR(UsedList$, CHR$(TempKey)) = 0 THEN __UI_Controls(ThisID).HotKey = TempKey + __UI_Controls(ThisID).HotKeyPosition = FindSep% PrevFont = _FONT @@ -2580,10 +2613,6 @@ SUB __UI_LoadImage (This AS __UI_ControlTYPE, File$) IF This.HelperCanvas <> 0 THEN _FREEIMAGE This.HelperCanvas - IF This.Type = __UI_Type_PictureBox OR This.Type = __UI_Type_Button THEN - __UI_Texts(This.ID) = File$ - END IF - IF _FILEEXISTS(File$) THEN This.HelperCanvas = _LOADIMAGE(File$, 32) IF This.HelperCanvas = -1 THEN ErrorMessage$ = "Unable to load file:" @@ -2607,6 +2636,10 @@ SUB __UI_LoadImage (This AS __UI_ControlTYPE, File$) _PRINTSTRING (5, 5), ErrorMessage$ _PRINTSTRING (5, 5 + _FONTHEIGHT), File$ _DEST PrevDest + ELSE + IF This.Type = __UI_Type_PictureBox OR This.Type = __UI_Type_Button OR This.Type = __UI_Type_MenuItem THEN + __UI_Texts(This.ID) = File$ + END IF END IF END SUB @@ -2783,7 +2816,7 @@ SUB __UI_RemoveListBoxItem (WhichListBox$, ItemToRemove AS INTEGER) DIM This AS __UI_ControlTYPE, TempText$, ThisItem%, FindLF&, TempCaption$ This = __UI_Controls(__UI_GetID(WhichListBox$)) - IF This.Type <> __UI_Type_ListBox THEN ERROR 5: EXIT SUB + IF This.Type <> __UI_Type_ListBox AND This.Type <> __UI_Type_DropdownList THEN ERROR 5: EXIT SUB IF ItemToRemove > This.Max THEN ERROR 6: EXIT SUB @@ -2816,6 +2849,38 @@ SUB __UI_RemoveListBoxItem (WhichListBox$, ItemToRemove AS INTEGER) __UI_Controls(This.ID) = This END SUB +'--------------------------------------------------------------------------------- +SUB __UI_ReplaceListBoxItem (WhichListBox$, ItemToReplace AS INTEGER, NewText$) + DIM This AS __UI_ControlTYPE, TempText$, ThisItem%, FindLF&, TempCaption$ + + This = __UI_Controls(__UI_GetID(WhichListBox$)) + IF This.Type <> __UI_Type_ListBox AND This.Type <> __UI_Type_DropdownList THEN ERROR 5: EXIT SUB + + IF ItemToReplace > This.Max THEN ERROR 6: EXIT SUB + + TempText$ = __UI_Texts(This.ID) + __UI_Texts(This.ID) = "" + + ThisItem% = 0 + DO WHILE LEN(TempText$) + ThisItem% = ThisItem% + 1 + FindLF& = INSTR(TempText$, CHR$(13)) + IF FindLF& THEN + TempCaption$ = LEFT$(TempText$, FindLF& - 1) + TempText$ = MID$(TempText$, FindLF& + 1) + ELSE + TempCaption$ = TempText$ + TempText$ = "" + END IF + + IF ThisItem% <> ItemToReplace THEN + __UI_Texts(This.ID) = __UI_Texts(This.ID) + TempCaption$ + CHR$(13) + ELSE + __UI_Texts(This.ID) = __UI_Texts(This.ID) + NewText$ + CHR$(13) + END IF + LOOP +END SUB + '--------------------------------------------------------------------------------- SUB __UI_ListBoxSearchItem (This AS __UI_ControlTYPE) STATIC SearchPattern$, LastListKeyHit AS DOUBLE @@ -2968,7 +3033,7 @@ END SUB '--------------------------------------------------------------------------------- SUB __UI_ActivateMenu (This AS __UI_ControlTYPE, SelectFirstItem AS _BYTE) - DIM i AS LONG, ItemOffset AS INTEGER, TotalItems AS INTEGER, ItemHeight AS INTEGER + DIM i AS LONG, TotalItems AS INTEGER, ItemHeight AS INTEGER IF NOT This.Disabled THEN IF __UI_ActiveMenu > 0 THEN __UI_DestroyControl __UI_Controls(__UI_ActiveMenu) @@ -2987,17 +3052,13 @@ SUB __UI_ActivateMenu (This AS __UI_ControlTYPE, SelectFirstItem AS _BYTE) __UI_Controls(__UI_ActiveMenu).Top = __UI_MouseTop END IF - IF _PRINTWIDTH("W") <> _PRINTWIDTH("I") THEN ItemOffset = _PRINTWIDTH("____") ELSE ItemOffset = _PRINTWIDTH("__") - 'Calculate panel's width and position the menu items - __UI_Controls(__UI_ActiveMenu).Width = 120 - ItemHeight = _FONTHEIGHT * 1.5 __UI_Controls(__UI_ActiveMenu).Height = _FONTHEIGHT * .3 FOR i = 1 TO UBOUND(__UI_Controls) IF __UI_Controls(i).ParentID = This.ID AND NOT __UI_Controls(i).Hidden THEN TotalItems = TotalItems + 1 - __UI_Controls(i).Width = ItemOffset * 2 + _PRINTWIDTH(__UI_Captions(i)) + __UI_Controls(i).Width = __UI_MenuItemOffset * 2 + _PRINTWIDTH(__UI_Captions(i)) IF __UI_Controls(__UI_ActiveMenu).Width < __UI_Controls(i).Width THEN __UI_Controls(__UI_ActiveMenu).Width = __UI_Controls(i).Width END IF @@ -3138,26 +3199,25 @@ END FUNCTION '--------------------------------------------------------------------------------- SUB __UI_RefreshMenuBar 'Calculate menu items' .Left and .Width - DIM LeftOffset AS INTEGER, ItemOffset AS INTEGER, i AS LONG + DIM LeftOffset AS INTEGER, i AS LONG DIM TotalItems AS INTEGER, LastMenuItem AS LONG _FONT (__UI_Controls(__UI_FormID).Font) - IF _PRINTWIDTH("W") <> _PRINTWIDTH("I") THEN ItemOffset = _PRINTWIDTH("__") ELSE ItemOffset = _PRINTWIDTH("__") FOR i = 1 TO UBOUND(__UI_Controls) IF __UI_Controls(i).ID > 0 THEN IF __UI_Controls(i).Type = __UI_Type_MenuBar AND NOT __UI_Controls(i).Hidden THEN TotalItems = TotalItems + 1 IF TotalItems = 1 THEN - LeftOffset = ItemOffset + LeftOffset = __UI_MenuBarOffset ELSE LeftOffset = LeftOffset + __UI_Controls(LastMenuItem).Width END IF - __UI_Controls(i).Width = ItemOffset + _PRINTWIDTH(__UI_Captions(i)) + ItemOffset + __UI_Controls(i).Width = __UI_MenuBarOffset + _PRINTWIDTH(__UI_Captions(i)) + __UI_MenuBarOffset IF __UI_Controls(i).Align = __UI_Left THEN __UI_Controls(i).Left = LeftOffset ELSE - __UI_Controls(i).Left = __UI_Controls(__UI_FormID).Width - 1 - ItemOffset - __UI_Controls(i).Width + __UI_Controls(i).Left = __UI_Controls(__UI_FormID).Width - 1 - __UI_MenuBarOffset - __UI_Controls(i).Width END IF LastMenuItem = i END IF diff --git a/InForm/disk.png b/InForm/disk.png new file mode 100644 index 0000000000000000000000000000000000000000..71dfaf8ba057a57f419facfddd1a695ec4b2a711 GIT binary patch literal 12965 zcmaKTc|4R~`1W}oGt3w4PL0`&Xwu}>6~=^%?&9DChTN)BAX<)U0Wfy-6o9*j zh(kmZ$QULkz;PG~5zB^0$gKRwu&U=qTfZ>wvpulAcf#l{Q7zj#&aRNXclC`>S-{r| zVfcFn4-Vz)^Sbj2ux-gIYzoU3e#)8+W2#@FKMVi)J|kyupU)5mBqoqG6z&8zj=#+@zFs~4GMW*Ae><{pue4E9=VzTY6%&n|6j?fjaZb$=PLwf-XL z#SuQ}ZQ_nVR>_u9e64{Ei%5{_lShvlesxA}FLLz_UKh&^y?*Xjm!N`$Of1Wbo*DI^ zm7qe8D`M%o=+WXb5Z=3YHGSXnwBG)f%L*edMBYhGN%`L2;#|*sEvq17 zWve|MgQO=ugznJv^IgGGxd>Nvz{sr4PfdJX|DFXFc-!}Y@O`uRFMT4>#dRYwtme|X5P`yhD zekEkQu}bWYf3+J4A?$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F>9&}Uo+s$cuATK$+)=&9f1KbrYD&Co_I979A^LOFn2 zib>HocER*QU&bFikXbR86MLQ25t)3(3?Z}CG0JpsMuOD|=j>tixnJA3YKs!VKu|IyM*ImIjq z#Ol4)2BucR?k0#DL4N23f-@GUH&|Q?N=n$A^`Qr*PEWR~sik;3LTtC>L+Qw_^$lw! zEBHLv>$~3&f{;kKY)(b!FbH zYD7BWFWo)rpkGVeO7HT_zyc(u?`-?*JrNjHx zLI1`ByeJkqyW^`VeBVGr@Y+|`xeN(V@0KLGA^it`KcCgEM=8O_IXHMiDCKndOeEHN z&hSlk&><}*R=}yN&SVp1y*fS0*%n$JBl&Dt{=Q!K90!W&dZTh+r0m@3n%_B)@G)Y3 z#ejnIcu*PboyXjIVqPDqqE1{_l0T>H9TJvrCigsdHL3bQTr`?pBUQ5xZaSWUEKI%U zhV$}fug&`stjn5Xhpx^XI;Cf+9Di1*ttm*C8~>nh#`N&_C#IGW8m~pt)vuzVDJg*g zmQp`BFt-Q&dwlQO2FkX(a(r>kDxWd9FJ|KeYJ`W`>%jwK@;UYspFgr-3=>##cFJ=b zMP-tK{_)RSJMwO__w}Ldo4=k=A5-ncem;uGCnvNw$!^Xk8nA7-sU5Lm1`dOj;+1pLUlErK7K(083LFlTssU^#1{XEM#B+ literal 0 HcmV?d00001 diff --git a/UiEditor.bas b/UiEditor.bas index 79afb3a..794df46 100644 --- a/UiEditor.bas +++ b/UiEditor.bas @@ -5,9 +5,10 @@ _ICON DIM SHARED RedTrackID AS LONG, GreenTrackID AS LONG, BlueTrackID AS LONG DIM SHARED RedTextBoxID AS LONG, GreenTextBoxID AS LONG, BlueTextBoxID AS LONG -DIM SHARED ColorPropertiesListID AS LONG +DIM SHARED ColorPropertiesListID AS LONG, PropertyValueID AS LONG DIM SHARED UiPreviewPID AS LONG, TotalSelected AS LONG, FirstSelected AS LONG DIM SHARED PreviewFormID AS LONG, ColorPreviewID AS LONG +DIM SHARED BackStyleListID AS LONG DIM SHARED CheckPreviewTimer AS INTEGER, PreviewAttached AS _BYTE CONST OffsetEditorPID = 1 @@ -28,6 +29,7 @@ REDIM SHARED PreviewTexts(0) AS STRING REDIM SHARED PreviewTips(0) AS STRING REDIM SHARED PreviewFonts(0) AS STRING REDIM SHARED PreviewControls(0) AS __UI_ControlTYPE +REDIM SHARED PreviewParentIDS(0) AS STRING CheckPreviewTimer = _FREETIMER ON TIMER(CheckPreviewTimer, .003) CheckPreview @@ -67,8 +69,8 @@ SUB __UI_Click (id AS LONG) CASE "ADDPICTUREBOX": Dummy = __UI_Type_PictureBox CASE "ADDFRAME": Dummy = __UI_Type_Frame CASE "ADDBUTTON", "ADDLABEL", "ADDTEXTBOX", "ADDCHECKBOX", _ - "ADDRADIOBUTTON", "ADDLISTBOX", "ADDDROPDOWNLIST", _ - "ADDTRACKBAR", "ADDPROGRESSBAR", "ADDPICTUREBOX", "ADDFRAME" + "ADDRADIOBUTTON", "ADDLISTBOX", "ADDDROPDOWNLIST", _ + "ADDTRACKBAR", "ADDPROGRESSBAR", "ADDPICTUREBOX", "ADDFRAME" UiEditorFile = FREEFILE OPEN "UiEditor.dat" FOR BINARY AS #UiEditorFile b$ = MKI$(Dummy) @@ -98,18 +100,21 @@ SUB __UI_Click (id AS LONG) CASE "CENTEREDWINDOW" b$ = MKI$(__UI_Controls(__UI_GetID("CenteredWindow")).Value) SendData b$, 21 + CASE "RESIZABLE" + b$ = MKI$(__UI_Controls(__UI_GetID("Resizable")).Value) + SendData b$, 29 CASE "VIEWMENUPREVIEW" $IF WIN THEN SHELL _DONTWAIT "UiEditorPreview.exe" $ELSE SHELL _DONTWAIT "./UiEditorPreview" $END IF - CASE "LOADEDFONTS" + CASE "VIEWMENULOADEDFONTS" DIM Temp$ - FOR Dummy = 1 TO UBOUND(__UI_Controls) - IF __UI_Controls(Dummy).Type = __UI_Type_Font THEN + FOR Dummy = 1 TO UBOUND(PreviewFonts) + IF LEN(PreviewFonts(Dummy)) THEN IF LEN(Temp$) THEN Temp$ = Temp$ + CHR$(10) - Temp$ = Temp$ + RTRIM$(__UI_Controls(Dummy).Name) + " (" + __UI_Texts(Dummy) + ")" + STR$(__UI_Controls(Dummy).Max) + "pt, " + __UI_Captions(Dummy) + Temp$ = Temp$ + PreviewFonts(Dummy) END IF NEXT IF LEN(Temp$) THEN @@ -212,24 +217,21 @@ SUB __UI_Click (id AS LONG) CASE -5 'Font IF LogFileLoad THEN PRINT #2, "FONT:"; DIM FontSetup$, FindSep AS INTEGER - DIM NewFontName AS STRING, NewFontFile AS STRING + DIM NewFontFile AS STRING DIM NewFontSize AS INTEGER, NewFontAttributes AS STRING b$ = SPACE$(2): GET #1, , b$ FontSetup$ = SPACE$(CVI(b$)): GET #1, , FontSetup$ IF LogFileLoad THEN PRINT #2, FontSetup$ - FindSep = INSTR(FontSetup$, "\") - NewFontName = LEFT$(FontSetup$, FindSep - 1): FontSetup$ = MID$(FontSetup$, FindSep + 1) - - FindSep = INSTR(FontSetup$, "\") + FindSep = INSTR(FontSetup$, "*") NewFontFile = LEFT$(FontSetup$, FindSep - 1): FontSetup$ = MID$(FontSetup$, FindSep + 1) - FindSep = INSTR(FontSetup$, "\") + FindSep = INSTR(FontSetup$, "*") NewFontSize = VAL(LEFT$(FontSetup$, FindSep - 1)): FontSetup$ = MID$(FontSetup$, FindSep + 1) NewFontAttributes = FontSetup$ - __UI_Controls(Dummy).Font = __UI_Font(NewFontName, NewFontFile, NewFontSize, NewFontAttributes) + __UI_Controls(Dummy).Font = __UI_Font(NewFontFile, NewFontSize, NewFontAttributes) CASE -6 'ForeColor b$ = SPACE$(4): GET #1, , b$ __UI_Controls(Dummy).ForeColor = _CV(_UNSIGNED LONG, b$) @@ -346,316 +348,11 @@ SUB __UI_Click (id AS LONG) CLOSE #1 END IF CASE "FILEMENUSAVE" - OPEN "form.frm" FOR OUTPUT AS #1 - IF _FILEEXISTS("form.frmbin") THEN KILL "form.frmbin" - OPEN "form.frmbin" FOR BINARY AS #2 - PRINT #1, "'InForm - GUI system for QB64" - PRINT #1, "'Fellippe Heitor, 2016 - fellippe@qb64.org - @fellippeheitor" - PRINT #1, "'Beta version 1" - PRINT #1, "SUB __UI_LoadForm" - PRINT #1, " DIM __UI_NewID AS LONG" - PRINT #1, - b$ = "InForm" + CHR$(1) - PUT #2, 1, b$ - b$ = MKL$(UBOUND(__UI_Controls)) - PUT #2, , b$ - FOR i = 1 TO UBOUND(__UI_Controls) - IF __UI_Controls(i).ID > 0 AND __UI_Controls(i).Type <> __UI_Type_MenuPanel AND __UI_Controls(i).Type <> __UI_Type_Font AND LEN(RTRIM$(__UI_Controls(i).Name)) > 0 THEN - a$ = " __UI_NewID = __UI_NewControl(" - SELECT CASE __UI_Controls(i).Type - CASE __UI_Type_Form: a$ = a$ + "__UI_Type_Form, " - CASE __UI_Type_Frame: a$ = a$ + "__UI_Type_Frame, " - CASE __UI_Type_Button: a$ = a$ + "__UI_Type_Button, " - CASE __UI_Type_Label: a$ = a$ + "__UI_Type_Label, " - CASE __UI_Type_CheckBox: a$ = a$ + "__UI_Type_CheckBox, " - CASE __UI_Type_RadioButton: a$ = a$ + "__UI_Type_RadioButton, " - CASE __UI_Type_TextBox: a$ = a$ + "__UI_Type_TextBox, " - CASE __UI_Type_ProgressBar: a$ = a$ + "__UI_Type_ProgressBar, " - CASE __UI_Type_ListBox: a$ = a$ + "__UI_Type_ListBox, " - CASE __UI_Type_DropdownList: a$ = a$ + "__UI_Type_DropdownList, " - CASE __UI_Type_MenuBar: a$ = a$ + "__UI_Type_MenuBar, " - CASE __UI_Type_MenuItem: a$ = a$ + "__UI_Type_MenuItem, " - CASE __UI_Type_PictureBox: a$ = a$ + "__UI_Type_PictureBox, " - CASE __UI_Type_TrackBar: a$ = a$ + "__UI_Type_TrackBar, " - CASE __UI_Type_ContextMenu: a$ = a$ + "__UI_Type_ContextMenu, " - END SELECT - a$ = a$ + CHR$(34) + RTRIM$(__UI_Controls(i).Name) + CHR$(34) + "," - a$ = a$ + STR$(__UI_Controls(i).Width) + "," - a$ = a$ + STR$(__UI_Controls(i).Height) + "," - a$ = a$ + STR$(__UI_Controls(i).Left) + "," - a$ = a$ + STR$(__UI_Controls(i).Top) + "," - IF __UI_Controls(i).ParentID > 0 THEN - a$ = a$ + " __UI_GetID(" + CHR$(34) + RTRIM$(__UI_Controls(__UI_Controls(i).ParentID).Name) + CHR$(34) + "))" - ELSE - a$ = a$ + " 0)" - END IF - PRINT #1, a$ - b$ = MKI$(-1) + MKI$(__UI_Controls(i).Type) '-1 indicates a new control - b$ = b$ + MKI$(LEN(RTRIM$(__UI_Controls(i).Name))) - b$ = b$ + RTRIM$(__UI_Controls(i).Name) - b$ = b$ + MKI$(__UI_Controls(i).Width) + MKI$(__UI_Controls(i).Height) + MKI$(__UI_Controls(i).Left) + MKI$(__UI_Controls(i).Top) + MKI$(LEN(RTRIM$(__UI_Controls(__UI_Controls(i).ParentID).Name))) + RTRIM$(__UI_Controls(__UI_Controls(i).ParentID).Name) - PUT #2, , b$ - - IF LEN(__UI_Captions(i)) > 0 THEN - a$ = " __UI_SetCaption " + CHR$(34) + RTRIM$(__UI_Controls(i).Name) + CHR$(34) + ", " + __UI_SpecialCharsToCHR$(__UI_Captions(i)) - b$ = MKI$(-2) + MKL$(LEN(__UI_Captions(i))) '-2 indicates a caption - PUT #2, , b$ - PUT #2, , __UI_Captions(i) - PRINT #1, a$ - END IF - - IF LEN(__UI_Tips(i)) > 0 THEN - a$ = " __UI_SetTip " + CHR$(34) + RTRIM$(__UI_Controls(i).Name) + CHR$(34) + ", " + __UI_SpecialCharsToCHR$(__UI_Tips(i)) - b$ = MKI$(-24) + MKL$(LEN(__UI_Tips(i))) '-24 indicates a tip - PUT #2, , b$ - PUT #2, , __UI_Tips(i) - PRINT #1, a$ - END IF - - IF LEN(__UI_Texts(i)) > 0 THEN - SELECT CASE __UI_Controls(i).Type - CASE __UI_Type_ListBox, __UI_Type_DropdownList - DIM TempCaption$, TempText$, FindLF&, ThisItem%, ThisItemTop% - DIM LastVisibleItem AS INTEGER - - TempText$ = __UI_Texts(i) - ThisItem% = 0 - DO WHILE LEN(TempText$) - ThisItem% = ThisItem% + 1 - FindLF& = INSTR(TempText$, CHR$(13)) - IF FindLF& THEN - TempCaption$ = LEFT$(TempText$, FindLF& - 1) - TempText$ = MID$(TempText$, FindLF& + 1) - ELSE - TempCaption$ = TempText$ - TempText$ = "" - END IF - a$ = " __UI_AddListBoxItem " + CHR$(34) + RTRIM$(__UI_Controls(i).Name) + CHR$(34) + ", " + CHR$(34) + TempCaption$ + CHR$(34) - PRINT #1, a$ - LOOP - CASE __UI_Type_PictureBox, __UI_Type_Button - a$ = " __UI_LoadImage __UI_Controls(__UI_NewID), " + CHR$(34) + __UI_Texts(i) + CHR$(34) - PRINT #1, a$ - CASE ELSE - a$ = " __UI_SetText " + CHR$(34) + RTRIM$(__UI_Controls(i).Name) + CHR$(34) + ", " + __UI_SpecialCharsToCHR$(__UI_Captions(i)) - PRINT #1, a$ - END SELECT - b$ = MKI$(-3) + MKL$(LEN(__UI_Texts(i))) '-3 indicates a text - PUT #2, , b$ - PUT #2, , __UI_Texts(i) - END IF - IF __UI_Controls(i).TransparentColor > 0 THEN - PRINT #1, " __UI_ClearColor __UI_Controls(__UI_NewID).HelperCanvas, " + LTRIM$(STR$(__UI_Controls(i).TransparentColor)) + ", -1" - b$ = MKI$(-28) + _MK$(_UNSIGNED LONG, __UI_Controls(i).TransparentColor) - PUT #2, , b$ - END IF - IF __UI_Controls(i).Stretch THEN - PRINT #1, " __UI_Controls(__UI_NewID).Stretch = __UI_True" - b$ = MKI$(-4) - PUT #2, , b$ - END IF - 'Inheritable properties won't be saved if they are the same as the parent's - IF __UI_Controls(i).Type = __UI_Type_Form THEN - IF __UI_Controls(i).Font = 8 OR __UI_Controls(i).Font = 16 THEN - 'Internal fonts - SaveInternalFont: - FontSetup$ = "__UI_Font(" + CHR$(34) + "VGA Emulated" + CHR$(34) + ", " + CHR$(34) + CHR$(34) + "," + STR$(__UI_Controls(__UI_GetFontID(__UI_Controls(i).Font)).Max) + ", " + CHR$(34) + CHR$(34) + ")" - PRINT #1, " __UI_Controls(__UI_NewID).Font = " + FontSetup$ - FontSetup$ = "VGA Emulated\\" + LTRIM$(STR$(__UI_Controls(__UI_GetFontID(__UI_Controls(i).Font)).Max)) + "\" - b$ = MKI$(-5) + MKI$(LEN(FontSetup$)) + FontSetup$ - PUT #2, , b$ - ELSE - SaveExternalFont: - FontSetup$ = "__UI_Font(" + CHR$(34) + RTRIM$(__UI_Controls(__UI_GetFontID(__UI_Controls(i).Font)).Name) + CHR$(34) + ", " + CHR$(34) + __UI_Texts(__UI_GetFontID(__UI_Controls(i).Font)) + CHR$(34) + "," + STR$(__UI_Controls(__UI_GetFontID(__UI_Controls(i).Font)).Max) + ", " + CHR$(34) + __UI_Captions(__UI_GetFontID(__UI_Controls(i).Font)) + CHR$(34) + ")" - PRINT #1, " __UI_Controls(__UI_NewID).Font = " + FontSetup$ - FontSetup$ = RTRIM$(__UI_Controls(__UI_GetFontID(__UI_Controls(i).Font)).Name) + "\" + __UI_Texts(__UI_GetFontID(__UI_Controls(i).Font)) + "\" + LTRIM$(STR$(__UI_Controls(__UI_GetFontID(__UI_Controls(i).Font)).Max)) + "\" + __UI_Captions(__UI_GetFontID(__UI_Controls(i).Font)) - b$ = MKI$(-5) + MKI$(LEN(FontSetup$)) + FontSetup$ - PUT #2, , b$ - END IF - ELSE - IF __UI_Controls(i).ParentID > 0 THEN - IF __UI_Controls(i).Font > 0 AND __UI_Controls(i).Font <> __UI_Controls(__UI_Controls(i).ParentID).Font THEN - IF __UI_Controls(i).Font = 8 OR __UI_Controls(i).Font = 167 THEN - GOTO SaveInternalFont - ELSE - GOTO SaveExternalFont - END IF - END IF - ELSE - IF __UI_Controls(i).Font > 0 AND __UI_Controls(i).Font <> __UI_Controls(__UI_FormID).Font THEN - IF __UI_Controls(i).Font = 8 OR __UI_Controls(i).Font = 167 THEN - GOTO SaveInternalFont - ELSE - GOTO SaveExternalFont - END IF - END IF - END IF - END IF - 'Colors are saved only if they differ from the theme's defaults - IF __UI_Controls(i).ForeColor <> __UI_DefaultColor(__UI_Controls(i).Type, 1) THEN - PRINT #1, " __UI_Controls(__UI_NewID).ForeColor = _RGB32(" + LTRIM$(STR$(_RED32(__UI_Controls(i).ForeColor))) + ", " + LTRIM$(STR$(_GREEN32(__UI_Controls(i).ForeColor))) + ", " + LTRIM$(STR$(_BLUE32(__UI_Controls(i).ForeColor))) + ")" - b$ = MKI$(-6) + _MK$(_UNSIGNED LONG, __UI_Controls(i).ForeColor) - PUT #2, , b$ - END IF - IF __UI_Controls(i).BackColor <> __UI_DefaultColor(__UI_Controls(i).Type, 2) THEN - PRINT #1, " __UI_Controls(__UI_NewID).BackColor = _RGB32(" + LTRIM$(STR$(_RED32(__UI_Controls(i).BackColor))) + ", " + LTRIM$(STR$(_GREEN32(__UI_Controls(i).BackColor))) + ", " + LTRIM$(STR$(_BLUE32(__UI_Controls(i).BackColor))) + ")" - b$ = MKI$(-7) + _MK$(_UNSIGNED LONG, __UI_Controls(i).BackColor) - PUT #2, , b$ - END IF - IF __UI_Controls(i).SelectedForeColor <> __UI_DefaultColor(__UI_Controls(i).Type, 3) THEN - PRINT #1, " __UI_Controls(__UI_NewID).SelectedForeColor = _RGB32(" + LTRIM$(STR$(_RED32(__UI_Controls(i).SelectedForeColor))) + ", " + LTRIM$(STR$(_GREEN32(__UI_Controls(i).SelectedForeColor))) + ", " + LTRIM$(STR$(_BLUE32(__UI_Controls(i).SelectedForeColor))) + ")" - b$ = MKI$(-8) + _MK$(_UNSIGNED LONG, __UI_Controls(i).SelectedForeColor) - PUT #2, , b$ - END IF - IF __UI_Controls(i).SelectedBackColor <> __UI_DefaultColor(__UI_Controls(i).Type, 4) THEN - PRINT #1, " __UI_Controls(__UI_NewID).SelectedBackColor = _RGB32(" + LTRIM$(STR$(_RED32(__UI_Controls(i).SelectedBackColor))) + ", " + LTRIM$(STR$(_GREEN32(__UI_Controls(i).SelectedBackColor))) + ", " + LTRIM$(STR$(_BLUE32(__UI_Controls(i).SelectedBackColor))) + ")" - b$ = MKI$(-9) + _MK$(_UNSIGNED LONG, __UI_Controls(i).SelectedBackColor) - PUT #2, , b$ - END IF - IF __UI_Controls(i).BorderColor <> __UI_DefaultColor(__UI_Controls(i).Type, 5) THEN - PRINT #1, " __UI_Controls(__UI_NewID).BorderColor = _RGB32(" + LTRIM$(STR$(_RED32(__UI_Controls(i).BorderColor))) + ", " + LTRIM$(STR$(_GREEN32(__UI_Controls(i).BorderColor))) + ", " + LTRIM$(STR$(_BLUE32(__UI_Controls(i).BorderColor))) + ")" - b$ = MKI$(-10) + _MK$(_UNSIGNED LONG, __UI_Controls(i).BorderColor) - PUT #2, , b$ - END IF - IF __UI_Controls(i).BackStyle = __UI_Transparent THEN - PRINT #1, " __UI_Controls(__UI_NewID).BackStyle = __UI_Transparent" - b$ = MKI$(-11): PUT #2, , b$ - END IF - IF __UI_Controls(i).HasBorder THEN - PRINT #1, " __UI_Controls(__UI_NewID).HasBorder = __UI_True" - b$ = MKI$(-12): PUT #2, , b$ - END IF - IF __UI_Controls(i).Align = __UI_Center THEN - PRINT #1, " __UI_Controls(__UI_NewID).Align = __UI_Center" - b$ = MKI$(-13) + _MK$(_BYTE, __UI_Controls(i).Align): PUT #2, , b$ - ELSEIF __UI_Controls(i).Align = __UI_Right THEN - PRINT #1, " __UI_Controls(__UI_NewID).Align = __UI_Right" - b$ = MKI$(-13) + _MK$(_BYTE, __UI_Controls(i).Align): PUT #2, , b$ - END IF - IF __UI_Controls(i).Value <> 0 THEN - PRINT #1, " __UI_Controls(__UI_NewID).Value = " + LTRIM$(STR$(__UI_Controls(i).Value)) - b$ = MKI$(-14) + _MK$(_FLOAT, __UI_Controls(i).Value): PUT #2, , b$ - END IF - IF __UI_Controls(i).Min <> 0 THEN - PRINT #1, " __UI_Controls(__UI_NewID).Min = " + LTRIM$(STR$(__UI_Controls(i).Min)) - b$ = MKI$(-15) + _MK$(_FLOAT, __UI_Controls(i).Min): PUT #2, , b$ - END IF - IF __UI_Controls(i).Max <> 0 THEN - PRINT #1, " __UI_Controls(__UI_NewID).Max = " + LTRIM$(STR$(__UI_Controls(i).Max)) - b$ = MKI$(-16) + _MK$(_FLOAT, __UI_Controls(i).Max): PUT #2, , b$ - END IF - IF __UI_Controls(i).HotKey <> 0 THEN - PRINT #1, " __UI_Controls(__UI_NewID).HotKey = " + LTRIM$(STR$(__UI_Controls(i).HotKey)) - b$ = MKI$(-17) + MKI$(__UI_Controls(i).HotKey): PUT #2, , b$ - END IF - IF __UI_Controls(i).HotKeyOffset <> 0 THEN - PRINT #1, " __UI_Controls(__UI_NewID).HotKeyOffset = " + LTRIM$(STR$(__UI_Controls(i).HotKeyOffset)) - b$ = MKI$(-18) + MKI$(__UI_Controls(i).HotKeyOffset): PUT #2, , b$ - END IF - IF __UI_Controls(i).ShowPercentage THEN - PRINT #1, " __UI_Controls(__UI_NewID).ShowPercentage = __UI_True" - b$ = MKI$(-19): PUT #2, , b$ - END IF - IF __UI_Controls(i).CanHaveFocus THEN - PRINT #1, " __UI_Controls(__UI_NewID).CanHaveFocus = __UI_True" - b$ = MKI$(-20): PUT #2, , b$ - END IF - IF __UI_Controls(i).Disabled THEN - PRINT #1, " __UI_Controls(__UI_NewID).Disabled = __UI_True" - b$ = MKI$(-21): PUT #2, , b$ - END IF - IF __UI_Controls(i).Hidden THEN - PRINT #1, " __UI_Controls(__UI_NewID).Hidden = __UI_True" - b$ = MKI$(-22): PUT #2, , b$ - END IF - IF __UI_Controls(i).CenteredWindow THEN - PRINT #1, " __UI_Controls(__UI_NewID).CenteredWindow = __UI_True" - b$ = MKI$(-23): PUT #2, , b$ - END IF - IF __UI_Controls(i).ContextMenuID THEN - PRINT #1, " __UI_Controls(__UI_NewID).ContextMenuID = __UI_GetID(" + CHR$(34) + RTRIM$(__UI_Controls(__UI_Controls(i).ContextMenuID).Name) + CHR$(34) + ")" - b$ = MKI$(-25) + MKI$(LEN(RTRIM$(__UI_Controls(__UI_Controls(i).ContextMenuID).Name))) + RTRIM$(__UI_Controls(__UI_Controls(i).ContextMenuID).Name): PUT #2, , b$ - END IF - IF __UI_Controls(i).Interval THEN - PRINT #1, " __UI_Controls(__UI_NewID).Interval = " + LTRIM$(STR$(__UI_Controls(i).Interval)) - b$ = MKI$(-26) + _MK$(_FLOAT, __UI_Controls(i).Interval): PUT #2, , b$ - END IF - IF __UI_Controls(i).WordWrap THEN - PRINT #1, " __UI_Controls(__UI_NewID).WordWrap = __UI_True" - b$ = MKI$(-27): PUT #2, , b$ - END IF - IF __UI_Controls(i).CanResize AND __UI_Controls(i).Type = __UI_Type_Form THEN - PRINT #1, " __UI_Controls(__UI_NewID).CanResize = __UI_True" - b$ = MKI$(-29): PUT #2, , b$ - END IF - PRINT #1, - END IF - NEXT - b$ = MKI$(-1024): PUT #2, , b$ 'end of file - PRINT #1, "END SUB" - CLOSE #1, #2 - OPEN "program.bas" FOR OUTPUT AS #1 - PRINT #1, "'$INCLUDE:'InForm.ui'" - PRINT #1, "'$INCLUDE:'form.frm'" - PRINT #1, "'$INCLUDE:'xp.uitheme'" - PRINT #1, - PRINT #1, "'Event procedures: ---------------------------------------------------------------" - FOR i = 1 TO 12 - SELECT EVERYCASE i - CASE 1: PRINT #1, "SUB __UI_OnLoad" - CASE 2: PRINT #1, "SUB __UI_BeforeUpdateDisplay" - CASE 3: PRINT #1, "SUB __UI_BeforeUnload" - CASE 4: PRINT #1, "SUB __UI_Click (id AS LONG)" - CASE 5: PRINT #1, "SUB __UI_MouseEnter (id AS LONG)" - CASE 6: PRINT #1, "SUB __UI_MouseLeave (id AS LONG)" - CASE 7: PRINT #1, "SUB __UI_FocusIn (id AS LONG)" - CASE 8: PRINT #1, "SUB __UI_FocusOut (id AS LONG)" - CASE 9: PRINT #1, "SUB __UI_MouseDown (id AS LONG)" - CASE 10: PRINT #1, "SUB __UI_MouseUp (id AS LONG)" - CASE 11: PRINT #1, "SUB __UI_KeyPress (id AS LONG)" - CASE 12: PRINT #1, "SUB __UI_ValueChanged (id AS LONG)" - - CASE 1 TO 3 - PRINT #1, - - CASE 4 TO 6, 9, 10 'All controls except for Menu panels, and internal context menus - PRINT #1, " SELECT CASE UCASE$(RTRIM$(__UI_Controls(id).Name))" - FOR Dummy = 1 TO UBOUND(__UI_Controls) - IF __UI_Controls(Dummy).ID AND __UI_Controls(Dummy).Type <> __UI_Type_Font AND __UI_Controls(Dummy).Type <> __UI_Type_ContextMenu AND RTRIM$(__UI_Controls(Dummy).Name) <> "__UI_TextFieldMenu" AND __UI_Controls(Dummy).ParentID <> __UI_GetID("__UI_TextFieldMenu") THEN - PRINT #1, " CASE " + CHR$(34) + UCASE$(RTRIM$(__UI_Controls(Dummy).Name)) + CHR$(34) - PRINT #1, - END IF - NEXT - PRINT #1, " END SELECT" - - CASE 7, 8, 11 'Controls that can have focus only - PRINT #1, " SELECT CASE UCASE$(RTRIM$(__UI_Controls(id).Name))" - FOR Dummy = 1 TO UBOUND(__UI_Controls) - IF __UI_Controls(Dummy).ID AND __UI_Controls(Dummy).CanHaveFocus THEN - PRINT #1, " CASE " + CHR$(34) + UCASE$(RTRIM$(__UI_Controls(Dummy).Name)) + CHR$(34) - PRINT #1, - END IF - NEXT - PRINT #1, " END SELECT" - - CASE 12 'Dropdown list, List box and Track bar - PRINT #1, " SELECT CASE UCASE$(RTRIM$(__UI_Controls(id).Name))" - FOR Dummy = 1 TO UBOUND(__UI_Controls) - IF __UI_Controls(Dummy).ID AND (__UI_Controls(Dummy).Type = __UI_Type_ListBox OR __UI_Controls(Dummy).Type = __UI_Type_DropdownList OR __UI_Controls(Dummy).Type = __UI_Type_TrackBar) THEN - PRINT #1, " CASE " + CHR$(34) + UCASE$(RTRIM$(__UI_Controls(Dummy).Name)) + CHR$(34) - PRINT #1, - END IF - NEXT - PRINT #1, " END SELECT" - END SELECT - PRINT #1, "END SUB" - PRINT #1, - NEXT - CLOSE #1 + SaveForm CASE "HELPMENUABOUT" - Answer = __UI_MessageBox("UI beta" + CHR$(10) + "by Fellippe Heitor" + CHR$(10) + CHR$(10) + "Twitter: @fellippeheitor" + CHR$(10) + "e-mail: fellippe@qb64.org", "About", __UI_MsgBox_OkOnly + __UI_MsgBox_Information) + Answer = __UI_MessageBox("InForm Designer" + CHR$(10) + "by Fellippe Heitor" + CHR$(10) + CHR$(10) + "Twitter: @fellippeheitor" + CHR$(10) + "e-mail: fellippe@qb64.org", "About", __UI_MsgBox_OkOnly + __UI_MsgBox_Information) CASE "HELPMENUHELP" - Answer = __UI_MessageBox("This will soon become a GUI editor, which will allow an event-driven approach to programs written in QB64.", "What's all this?", __UI_MsgBox_OkOnly + __UI_MsgBox_Information) + Answer = __UI_MessageBox("Design a form and export the resulting code to generate an event-driven QB64 program.", "What's all this?", __UI_MsgBox_OkOnly + __UI_MsgBox_Information) CASE "FILEMENUEXIT" SYSTEM END SELECT @@ -742,35 +439,37 @@ SUB __UI_BeforeUpdateDisplay IF FirstSelected = 0 THEN FirstSelected = PreviewFormID - IF __UI_Focus <> __UI_GetID("PropertyValue") THEN + IF __UI_Focus <> PropertyValueID THEN SELECT CASE SelectedProperty CASE 1 'Name - __UI_Texts(__UI_GetID("PropertyValue")) = RTRIM$(PreviewControls(FirstSelected).Name) + __UI_Texts(PropertyValueID) = RTRIM$(PreviewControls(FirstSelected).Name) CASE 2 'Caption - __UI_Texts(__UI_GetID("PropertyValue")) = PreviewCaptions(FirstSelected) + __UI_Texts(PropertyValueID) = PreviewCaptions(FirstSelected) CASE 3 'Text - __UI_Texts(__UI_GetID("PropertyValue")) = PreviewTexts(FirstSelected) + __UI_Texts(PropertyValueID) = PreviewTexts(FirstSelected) CASE 4 'Top - __UI_Texts(__UI_GetID("PropertyValue")) = LTRIM$(STR$(PreviewControls(FirstSelected).Top)) + __UI_Texts(PropertyValueID) = LTRIM$(STR$(PreviewControls(FirstSelected).Top)) CASE 5 'Left - __UI_Texts(__UI_GetID("PropertyValue")) = LTRIM$(STR$(PreviewControls(FirstSelected).Left)) + __UI_Texts(PropertyValueID) = LTRIM$(STR$(PreviewControls(FirstSelected).Left)) CASE 6 'Width - __UI_Texts(__UI_GetID("PropertyValue")) = LTRIM$(STR$(PreviewControls(FirstSelected).Width)) + __UI_Texts(PropertyValueID) = LTRIM$(STR$(PreviewControls(FirstSelected).Width)) CASE 7 'Height - __UI_Texts(__UI_GetID("PropertyValue")) = LTRIM$(STR$(PreviewControls(FirstSelected).Height)) + __UI_Texts(PropertyValueID) = LTRIM$(STR$(PreviewControls(FirstSelected).Height)) CASE 8 'Font - __UI_Texts(__UI_GetID("PropertyValue")) = PreviewFonts(FirstSelected) - CASE 9 'BackStyle - __UI_Texts(__UI_GetID("PropertyValue")) = LTRIM$(STR$(PreviewControls(FirstSelected).BackStyle)) + __UI_Texts(PropertyValueID) = PreviewFonts(FirstSelected) + CASE 9 'Tooltip + __UI_Texts(PropertyValueID) = PreviewTips(FirstSelected) CASE 10 'Value - __UI_Texts(__UI_GetID("PropertyValue")) = LTRIM$(STR$(PreviewControls(FirstSelected).Value)) + __UI_Texts(PropertyValueID) = LTRIM$(STR$(PreviewControls(FirstSelected).Value)) CASE 11 'Min - __UI_Texts(__UI_GetID("PropertyValue")) = LTRIM$(STR$(PreviewControls(FirstSelected).Min)) + __UI_Texts(PropertyValueID) = LTRIM$(STR$(PreviewControls(FirstSelected).Min)) CASE 12 'Max - __UI_Texts(__UI_GetID("PropertyValue")) = LTRIM$(STR$(PreviewControls(FirstSelected).Max)) + __UI_Texts(PropertyValueID) = LTRIM$(STR$(PreviewControls(FirstSelected).Max)) CASE 13 'Interval - __UI_Texts(__UI_GetID("PropertyValue")) = LTRIM$(STR$(PreviewControls(FirstSelected).Interval)) + __UI_Texts(PropertyValueID) = LTRIM$(STR$(PreviewControls(FirstSelected).Interval)) END SELECT + ELSE + __UI_CursorAdjustments END IF 'Update checkboxes: @@ -783,6 +482,114 @@ SUB __UI_BeforeUpdateDisplay __UI_Controls(__UI_GetID("Hidden")).Value = PreviewControls(FirstSelected).Hidden __UI_Controls(__UI_GetID("CenteredWindow")).Value = PreviewControls(FirstSelected).CenteredWindow __UI_Controls(__UI_GetID("AlignOptions")).Value = PreviewControls(FirstSelected).Align + 1 + IF PreviewControls(FirstSelected).BackStyle THEN + __UI_Controls(__UI_GetID("BackStyleOptions")).Value = 2 + ELSE + __UI_Controls(__UI_GetID("BackStyleOptions")).Value = 1 + END IF + __UI_Controls(__UI_GetID("Resizable")).Value = PreviewControls(FirstSelected).CanResize + + 'Disable properties that don't apply + __UI_Controls(__UI_GetID("Stretch")).Disabled = __UI_True + __UI_Controls(__UI_GetID("HasBorder")).Disabled = __UI_True + __UI_Controls(__UI_GetID("ShowPercentage")).Disabled = __UI_True + __UI_Controls(__UI_GetID("WordWrap")).Disabled = __UI_True + __UI_Controls(__UI_GetID("CanHaveFocus")).Disabled = __UI_True + __UI_Controls(__UI_GetID("Disabled")).Disabled = __UI_True + __UI_Controls(__UI_GetID("Hidden")).Disabled = __UI_True + __UI_Controls(__UI_GetID("CenteredWindow")).Disabled = __UI_True + __UI_Controls(__UI_GetID("AlignOptions")).Disabled = __UI_True + __UI_Controls(BackStyleListID).Disabled = __UI_True + __UI_ReplaceListBoxItem "PropertiesList", 3, "Text" + __UI_Controls(__UI_GetID("Resizable")).Disabled = __UI_True + IF TotalSelected > 0 THEN + SELECT EVERYCASE PreviewControls(FirstSelected).Type + CASE __UI_Type_PictureBox + __UI_ReplaceListBoxItem "PropertiesList", 3, "Image file" + __UI_Controls(__UI_GetID("Stretch")).Disabled = __UI_False + __UI_Controls(BackStyleListID).Disabled = __UI_False + SELECT CASE SelectedProperty + CASE 1, 3, 4, 5, 6, 7, 9 + __UI_Controls(PropertyValueID).Disabled = __UI_False + CASE ELSE + __UI_Controls(PropertyValueID).Disabled = __UI_True + END SELECT + CASE __UI_Type_Frame, __UI_Type_Label + __UI_Controls(BackStyleListID).Disabled = __UI_False + SELECT CASE SelectedProperty + CASE 1, 2, 4, 5, 6, 7, 8, 9 + __UI_Controls(PropertyValueID).Disabled = __UI_False + CASE ELSE + __UI_Controls(PropertyValueID).Disabled = __UI_True + END SELECT + CASE __UI_Type_TextBox + __UI_Controls(BackStyleListID).Disabled = __UI_False + CASE __UI_Type_Button + __UI_ReplaceListBoxItem "PropertiesList", 3, "Image file" + CASE __UI_Type_Button, __UI_Type_TextBox + SELECT CASE SelectedProperty + CASE 1, 2, 3, 4, 5, 6, 7, 8, 9 + __UI_Controls(PropertyValueID).Disabled = __UI_False + CASE ELSE + __UI_Controls(PropertyValueID).Disabled = __UI_True + END SELECT + CASE __UI_Type_CheckBox, __UI_Type_RadioButton + __UI_Controls(BackStyleListID).Disabled = __UI_False + SELECT CASE SelectedProperty + CASE 1, 2, 4, 5, 6, 7, 8, 9, 10 + __UI_Controls(PropertyValueID).Disabled = __UI_False + CASE ELSE + __UI_Controls(PropertyValueID).Disabled = __UI_True + END SELECT + CASE __UI_Type_ProgressBar + SELECT CASE SelectedProperty + CASE 1, 2, 4, 5, 6, 7, 8, 9, 10, 11, 12 + __UI_Controls(PropertyValueID).Disabled = __UI_False + CASE ELSE + __UI_Controls(PropertyValueID).Disabled = __UI_True + END SELECT + CASE __UI_Type_TrackBar + SELECT CASE SelectedProperty + CASE 1, 4, 5, 6, 7, 9, 10, 11, 12, 13 + __UI_Controls(PropertyValueID).Disabled = __UI_False + CASE ELSE + __UI_Controls(PropertyValueID).Disabled = __UI_True + END SELECT + CASE __UI_Type_ListBox, __UI_Type_DropdownList + __UI_Controls(BackStyleListID).Disabled = __UI_False + SELECT CASE SelectedProperty + CASE 1, 3, 4, 5, 6, 7, 8, 9, 10, 12 + __UI_Controls(PropertyValueID).Disabled = __UI_False + CASE ELSE + __UI_Controls(PropertyValueID).Disabled = __UI_True + END SELECT + CASE __UI_Type_Frame, __UI_Type_Label, __UI_Type_TextBox, __UI_Type_ListBox, __UI_Type_DropdownList, __UI_Type_PictureBox + __UI_Controls(__UI_GetID("HasBorder")).Disabled = __UI_False + CASE __UI_Type_ProgressBar + __UI_Controls(__UI_GetID("ShowPercentage")).Disabled = __UI_False + CASE __UI_Type_Label + __UI_Controls(__UI_GetID("WordWrap")).Disabled = __UI_False + CASE __UI_Type_Button, __UI_Type_CheckBox, __UI_Type_RadioButton, __UI_Type_TextBox, __UI_Type_ListBox, __UI_Type_DropdownList, __UI_Type_TrackBar + __UI_Controls(__UI_GetID("CanHaveFocus")).Disabled = __UI_False + CASE __UI_Type_Button, __UI_Type_CheckBox, __UI_Type_RadioButton, __UI_Type_TextBox, __UI_Type_ListBox, __UI_Type_DropdownList, __UI_Type_TrackBar, __UI_Type_Label, __UI_Type_ProgressBar + __UI_Controls(__UI_GetID("Disabled")).Disabled = __UI_False + CASE __UI_Type_Frame, __UI_Type_Button, __UI_Type_CheckBox, __UI_Type_RadioButton, __UI_Type_TextBox, __UI_Type_ListBox, __UI_Type_DropdownList, __UI_Type_TrackBar, __UI_Type_Label, __UI_Type_ProgressBar, __UI_Type_PictureBox + __UI_Controls(__UI_GetID("Hidden")).Disabled = __UI_False + CASE __UI_Type_Label + __UI_Controls(__UI_GetID("AlignOptions")).Disabled = __UI_False + END SELECT + ELSE + 'Properties relative to the form + __UI_Controls(__UI_GetID("CenteredWindow")).Disabled = __UI_False + __UI_Controls(__UI_GetID("Resizable")).Disabled = __UI_False + + SELECT CASE SelectedProperty + CASE 1, 2, 6, 7, 8 'Name, Caption, Width, Height, Font + __UI_Controls(PropertyValueID).Disabled = __UI_False + CASE ELSE + __UI_Controls(PropertyValueID).Disabled = __UI_True + END SELECT + END IF 'Update the color mixer DIM ThisColor AS _UNSIGNED LONG, ThisBackColor AS _UNSIGNED LONG @@ -894,6 +701,21 @@ SUB __UI_OnLoad __UI_Controls(__UI_GetID("AddFrame")).HelperCanvas = _NEWIMAGE(16, 16, 32) i = i + 1: _PUTIMAGE (0, 0), CommControls, __UI_Controls(__UI_GetID("AddFrame")).HelperCanvas, (0, i * 16 - 16)-STEP(15, 15) + + 'Properly loaded helper images assign a file name to the control's text property. + 'Any text will do for internallly stored images: + __UI_Texts(__UI_GetID("AddButton")) = "." + __UI_Texts(__UI_GetID("AddLabel")) = "." + __UI_Texts(__UI_GetID("AddTextBox")) = "." + __UI_Texts(__UI_GetID("AddCheckBox")) = "." + __UI_Texts(__UI_GetID("AddRadioButton")) = "." + __UI_Texts(__UI_GetID("AddListBox")) = "." + __UI_Texts(__UI_GetID("AddDropdownList")) = "." + __UI_Texts(__UI_GetID("AddTrackBar")) = "." + __UI_Texts(__UI_GetID("AddProgressBar")) = "." + __UI_Texts(__UI_GetID("AddPictureBox")) = "." + __UI_Texts(__UI_GetID("AddFrame")) = "." + _FREEIMAGE CommControls __UI_ForceRedraw = __UI_True @@ -903,11 +725,40 @@ SUB __UI_OnLoad GreenTrackID = __UI_GetID("Green"): GreenTextBoxID = __UI_GetID("GreenValue") BlueTrackID = __UI_GetID("Blue"): BlueTextBoxID = __UI_GetID("BlueValue") ColorPropertiesListID = __UI_GetID("ColorPropertiesList") + BackStyleListID = __UI_GetID("BackStyleOptions") ColorPreviewID = __UI_GetID("ColorPreview") + PropertyValueID = __UI_GetID("PropertyValue") PreviewAttached = __UI_True IF _FILEEXISTS("UiEditorPreview.frmbin") THEN KILL "UiEditorPreview.frmbin" + + DIM FileToOpen$, FreeFileNum AS INTEGER + IF _FILEEXISTS(COMMAND$) THEN + SELECT CASE LCASE$(RIGHT$(COMMAND$, 4)) + CASE ".bas", ".frm" + IF _FILEEXISTS(LEFT$(COMMAND$, LEN(COMMAND$) - 4) + ".frmbin") THEN + FileToOpen$ = LEFT$(COMMAND$, LEN(COMMAND$) - 4) + ".frmbin" + END IF + CASE ELSE + IF LCASE$(RIGHT$(COMMAND$, 7)) = ".frmbin" THEN + FileToOpen$ = COMMAND$ + END IF + END SELECT + + IF LEN(FileToOpen$) > 0 THEN + FreeFileNum = FREEFILE + OPEN FileToOpen$ FOR BINARY AS #FreeFileNum + b$ = SPACE$(LOF(FreeFileNum)) + GET #FreeFileNum, 1, b$ + CLOSE #FreeFileNum + + OPEN "UiEditorPreview.frmbin" FOR BINARY AS #FreeFileNum + PUT #FreeFileNum, 1, b$ + CLOSE #FreeFileNum + END IF + END IF + IF _FILEEXISTS("UiEditor.dat") THEN KILL "UiEditor.dat" $IF WIN THEN @@ -967,17 +818,15 @@ SUB __UI_KeyPress (id AS LONG) CASE "PROPERTYVALUE" 'Send the preview the new property value DIM FloatValue AS _FLOAT, b$, TempValue AS LONG, i AS LONG - DIM PropertyValueID AS LONG - PropertyValueID = __UI_GetID("PropertyValue") TempValue = __UI_Controls(__UI_GetID("PropertiesList")).Value SELECT CASE TempValue - CASE 1, 2, 3 'Name, caption, text + CASE 1, 2, 3, 9 'Name, caption, text, tooltips b$ = MKL$(LEN(__UI_Texts(PropertyValueID))) + __UI_Texts(PropertyValueID) CASE 4, 5, 6, 7 'Top, left, width, height b$ = MKI$(VAL(__UI_Texts(PropertyValueID))) CASE 8 'Font - CASE 9 'BackStyle + b$ = MKL$(LEN(__UI_Texts(PropertyValueID))) + __UI_Texts(PropertyValueID) CASE 10, 11, 12, 13 'Value, min, max, interval b$ = _MK$(_FLOAT, VAL(__UI_Texts(PropertyValueID))) END SELECT @@ -986,11 +835,15 @@ SUB __UI_KeyPress (id AS LONG) END SUB SUB __UI_ValueChanged (id AS LONG) + DIM b$ SELECT EVERYCASE UCASE$(RTRIM$(__UI_Controls(id).Name)) CASE "ALIGNOPTIONS" - DIM b$ b$ = MKI$(__UI_Controls(__UI_GetID("AlignOptions")).Value - 1) SendData b$, 22 + CASE "BACKSTYLEOPTIONS" + b$ = MKI$(0) + IF __UI_Controls(__UI_GetID("BACKSTYLEOPTIONS")).Value = 2 THEN b$ = MKI$(-1) + SendData b$, 28 CASE "RED" __UI_Texts(RedTextBoxID) = LTRIM$(STR$(__UI_Controls(RedTrackID).Value)) CASE "GREEN" @@ -1005,12 +858,6 @@ SUB __UI_ValueChanged (id AS LONG) END SELECT END SUB -SUB __UI_EndDrag -END SUB - -SUB __UI_EndResize -END SUB - FUNCTION EditorImageData$ (FileName$) DIM A$ @@ -1239,6 +1086,7 @@ SUB LoadPreview REDIM PreviewTips(1 TO CVL(b$)) AS STRING REDIM PreviewFonts(1 TO CVL(b$)) AS STRING REDIM PreviewControls(0 TO CVL(b$)) AS __UI_ControlTYPE + REDIM PreviewParentIDS(0 TO CVL(b$)) AS STRING b$ = SPACE$(2): GET #BinaryFileNum, , b$ IF CVI(b$) <> -1 THEN GOTO LoadError @@ -1260,9 +1108,15 @@ SUB LoadPreview b$ = SPACE$(2): GET #BinaryFileNum, , b$ NewTop = CVI(b$) b$ = SPACE$(2): GET #BinaryFileNum, , b$ - NewParentID = SPACE$(CVI(b$)): GET #BinaryFileNum, , NewParentID + IF CVI(b$) > 0 THEN + NewParentID = SPACE$(CVI(b$)): GET #BinaryFileNum, , NewParentID + ELSE + NewParentID = "" + END IF PreviewControls(Dummy).ID = Dummy + PreviewParentIDS(Dummy) = RTRIM$(NewParentID) + PreviewControls(Dummy).Type = NewType PreviewControls(Dummy).Name = NewName PreviewControls(Dummy).Width = NewWidth PreviewControls(Dummy).Height = NewHeight @@ -1350,6 +1204,9 @@ SUB LoadPreview PreviewControls(Dummy).WordWrap = __UI_True CASE -29 PreviewControls(Dummy).CanResize = __UI_True + CASE -30 + b$ = SPACE$(2): GET #BinaryFileNum, , b$ + PreviewControls(Dummy).HotKeyPosition = CVI(b$) CASE -1 'new control EXIT DO CASE -1024 @@ -1476,3 +1333,576 @@ SUB CheckPreview END IF $END IF END SUB + +SUB SaveForm + DIM BaseOutputFileName AS STRING, BinaryFileNum AS INTEGER + DIM TextFileNum AS INTEGER, Answer AS _BYTE, b$, i AS LONG + DIM a$, FontSetup$, FindSep AS INTEGER, NewFontFile AS STRING + DIM NewFontSize AS INTEGER, Dummy AS LONG + + BaseOutputFileName = RTRIM$(PreviewControls(PreviewFormID).Name) + IF _FILEEXISTS(BaseOutputFileName + ".bas") OR _FILEEXISTS(BaseOutputFileName + ".frmbin") OR _FILEEXISTS(BaseOutputFileName + ".bas") THEN + Answer = __UI_MessageBox("Some files will be overwritten. Proceed?", "", __UI_MsgBox_YesNo + __UI_MsgBox_Question) + IF Answer = __UI_MsgBox_No THEN EXIT SUB + END IF + TextFileNum = FREEFILE + OPEN BaseOutputFileName + ".frm" FOR OUTPUT AS #TextFileNum + IF _FILEEXISTS(BaseOutputFileName + ".frmbin") THEN KILL BaseOutputFileName + ".frmbin" + BinaryFileNum = FREEFILE + OPEN BaseOutputFileName + ".frmbin" FOR BINARY AS #BinaryFileNum + PRINT #TextFileNum, "'InForm - GUI system for QB64 - Beta version 1" + PRINT #TextFileNum, "'Fellippe Heitor, 2016 - fellippe@qb64.org - @fellippeheitor" + PRINT #TextFileNum, "'-----------------------------------------------------------" + PRINT #TextFileNum, "SUB __UI_LoadForm" + PRINT #TextFileNum, + PRINT #TextFileNum, " DIM __UI_NewID AS LONG" + PRINT #TextFileNum, + b$ = "InForm" + CHR$(1) + PUT #BinaryFileNum, 1, b$ + b$ = MKL$(UBOUND(PreviewControls)) + PUT #BinaryFileNum, , b$ + + 'First pass is for the main form and containers (frames and menubars) + 'Second pass is for the rest of controls + DIM ThisPass AS _BYTE + FOR ThisPass = 1 TO 2 + FOR i = 1 TO UBOUND(PreviewControls) + IF PreviewControls(i).ID > 0 AND PreviewControls(i).Type <> __UI_Type_MenuPanel AND PreviewControls(i).Type <> __UI_Type_Font AND LEN(RTRIM$(PreviewControls(i).Name)) > 0 THEN + a$ = " __UI_NewID = __UI_NewControl(" + SELECT CASE PreviewControls(i).Type + CASE __UI_Type_Form: a$ = a$ + "__UI_Type_Form, ": IF ThisPass = 2 THEN GOTO EndOfThisPass + CASE __UI_Type_Frame: a$ = a$ + "__UI_Type_Frame, ": IF ThisPass = 2 THEN GOTO EndOfThisPass + CASE __UI_Type_Button: a$ = a$ + "__UI_Type_Button, ": IF ThisPass = 1 THEN GOTO EndOfThisPass + CASE __UI_Type_Label: a$ = a$ + "__UI_Type_Label, ": IF ThisPass = 1 THEN GOTO EndOfThisPass + CASE __UI_Type_CheckBox: a$ = a$ + "__UI_Type_CheckBox, ": IF ThisPass = 1 THEN GOTO EndOfThisPass + CASE __UI_Type_RadioButton: a$ = a$ + "__UI_Type_RadioButton, ": IF ThisPass = 1 THEN GOTO EndOfThisPass + CASE __UI_Type_TextBox: a$ = a$ + "__UI_Type_TextBox, ": IF ThisPass = 1 THEN GOTO EndOfThisPass + CASE __UI_Type_ProgressBar: a$ = a$ + "__UI_Type_ProgressBar, ": IF ThisPass = 1 THEN GOTO EndOfThisPass + CASE __UI_Type_ListBox: a$ = a$ + "__UI_Type_ListBox, ": IF ThisPass = 1 THEN GOTO EndOfThisPass + CASE __UI_Type_DropdownList: a$ = a$ + "__UI_Type_DropdownList, ": IF ThisPass = 1 THEN GOTO EndOfThisPass + CASE __UI_Type_MenuBar: a$ = a$ + "__UI_Type_MenuBar, ": IF ThisPass = 2 THEN GOTO EndOfThisPass + CASE __UI_Type_MenuItem: a$ = a$ + "__UI_Type_MenuItem, ": IF ThisPass = 1 THEN GOTO EndOfThisPass + CASE __UI_Type_PictureBox: a$ = a$ + "__UI_Type_PictureBox, ": IF ThisPass = 1 THEN GOTO EndOfThisPass + CASE __UI_Type_TrackBar: a$ = a$ + "__UI_Type_TrackBar, ": IF ThisPass = 1 THEN GOTO EndOfThisPass + CASE __UI_Type_ContextMenu: a$ = a$ + "__UI_Type_ContextMenu, ": IF ThisPass = 1 THEN GOTO EndOfThisPass + END SELECT + a$ = a$ + CHR$(34) + RTRIM$(PreviewControls(i).Name) + CHR$(34) + "," + a$ = a$ + STR$(PreviewControls(i).Width) + "," + a$ = a$ + STR$(PreviewControls(i).Height) + "," + a$ = a$ + STR$(PreviewControls(i).Left) + "," + a$ = a$ + STR$(PreviewControls(i).Top) + "," + IF LEN(PreviewParentIDS(i)) > 0 THEN + a$ = a$ + " __UI_GetID(" + CHR$(34) + PreviewParentIDS(i) + CHR$(34) + "))" + ELSE + a$ = a$ + " 0)" + END IF + PRINT #TextFileNum, a$ + b$ = MKI$(-1) + MKL$(0) + MKI$(PreviewControls(i).Type) '-1 indicates a new control + b$ = b$ + MKI$(LEN(RTRIM$(PreviewControls(i).Name))) + b$ = b$ + RTRIM$(PreviewControls(i).Name) + b$ = b$ + MKI$(PreviewControls(i).Width) + MKI$(PreviewControls(i).Height) + MKI$(PreviewControls(i).Left) + MKI$(PreviewControls(i).Top) + MKI$(LEN(PreviewParentIDS(i))) + PreviewParentIDS(i) + PUT #BinaryFileNum, , b$ + + IF LEN(PreviewCaptions(i)) > 0 THEN + IF PreviewControls(i).HotKeyPosition > 0 THEN + a$ = LEFT$(PreviewCaptions(i), PreviewControls(i).HotKeyPosition - 1) + "&" + MID$(PreviewCaptions(i), PreviewControls(i).HotKeyPosition) + ELSE + a$ = PreviewCaptions(i) + END IF + a$ = " __UI_SetCaption " + CHR$(34) + RTRIM$(PreviewControls(i).Name) + CHR$(34) + ", " + __UI_SpecialCharsToCHR$(a$) + b$ = MKI$(-2) + MKL$(LEN(PreviewCaptions(i))) '-2 indicates a caption + PUT #BinaryFileNum, , b$ + PUT #BinaryFileNum, , PreviewCaptions(i) + PRINT #TextFileNum, a$ + END IF + + IF LEN(PreviewTips(i)) > 0 THEN + a$ = " __UI_SetTip " + CHR$(34) + RTRIM$(PreviewControls(i).Name) + CHR$(34) + ", " + __UI_SpecialCharsToCHR$(PreviewTips(i)) + b$ = MKI$(-24) + MKL$(LEN(PreviewTips(i))) '-24 indicates a tip + PUT #BinaryFileNum, , b$ + PUT #BinaryFileNum, , PreviewTips(i) + PRINT #TextFileNum, a$ + END IF + + IF LEN(PreviewTexts(i)) > 0 THEN + SELECT CASE PreviewControls(i).Type + CASE __UI_Type_ListBox, __UI_Type_DropdownList + DIM TempCaption$, TempText$, FindLF&, ThisItem%, ThisItemTop% + DIM LastVisibleItem AS INTEGER + + TempText$ = PreviewTexts(i) + ThisItem% = 0 + DO WHILE LEN(TempText$) + ThisItem% = ThisItem% + 1 + FindLF& = INSTR(TempText$, CHR$(13)) + IF FindLF& THEN + TempCaption$ = LEFT$(TempText$, FindLF& - 1) + TempText$ = MID$(TempText$, FindLF& + 1) + ELSE + TempCaption$ = TempText$ + TempText$ = "" + END IF + a$ = " __UI_AddListBoxItem " + CHR$(34) + RTRIM$(PreviewControls(i).Name) + CHR$(34) + ", " + CHR$(34) + TempCaption$ + CHR$(34) + PRINT #TextFileNum, a$ + LOOP + CASE __UI_Type_PictureBox, __UI_Type_Button + a$ = " __UI_LoadImage __UI_Controls(__UI_NewID), " + CHR$(34) + PreviewTexts(i) + CHR$(34) + PRINT #TextFileNum, a$ + CASE ELSE + a$ = " __UI_SetText " + CHR$(34) + RTRIM$(PreviewControls(i).Name) + CHR$(34) + ", " + __UI_SpecialCharsToCHR$(PreviewCaptions(i)) + PRINT #TextFileNum, a$ + END SELECT + b$ = MKI$(-3) + MKL$(LEN(PreviewTexts(i))) '-3 indicates a text + PUT #BinaryFileNum, , b$ + PUT #BinaryFileNum, , PreviewTexts(i) + END IF + IF PreviewControls(i).TransparentColor > 0 THEN + PRINT #TextFileNum, " __UI_ClearColor __UI_Controls(__UI_NewID).HelperCanvas, " + LTRIM$(STR$(PreviewControls(i).TransparentColor)) + ", -1" + b$ = MKI$(-28) + _MK$(_UNSIGNED LONG, PreviewControls(i).TransparentColor) + PUT #BinaryFileNum, , b$ + END IF + IF PreviewControls(i).Stretch THEN + PRINT #TextFileNum, " __UI_Controls(__UI_NewID).Stretch = __UI_True" + b$ = MKI$(-4) + PUT #BinaryFileNum, , b$ + END IF + 'Fonts + IF LEN(PreviewFonts(i)) > 0 THEN + DIM NewFontParameters AS STRING + FontSetup$ = PreviewFonts(i) + b$ = MKI$(-5) + MKI$(LEN(FontSetup$)) + FontSetup$ + PUT #BinaryFileNum, , b$ + + 'Parse FontSetup$ into Font variables + FindSep = INSTR(FontSetup$, "*") + NewFontFile = LEFT$(FontSetup$, FindSep - 1) + FontSetup$ = MID$(FontSetup$, FindSep + 1) + + FindSep = INSTR(FontSetup$, "*") + NewFontParameters = LEFT$(FontSetup$, FindSep - 1) + FontSetup$ = MID$(FontSetup$, FindSep + 1) + + FontSetup$ = "__UI_Font(" + CHR$(34) + NewFontFile + CHR$(34) + ", " + FontSetup$ + ", " + CHR$(34) + NewFontParameters + CHR$(34) + ")" + PRINT #TextFileNum, " __UI_Controls(__UI_NewID).Font = " + FontSetup$ + END IF + 'Colors are saved only if they differ from the theme's defaults + IF PreviewControls(i).ForeColor > 0 AND PreviewControls(i).ForeColor <> __UI_DefaultColor(PreviewControls(i).Type, 1) THEN + PRINT #TextFileNum, " __UI_Controls(__UI_NewID).ForeColor = _RGB32(" + LTRIM$(STR$(_RED32(PreviewControls(i).ForeColor))) + ", " + LTRIM$(STR$(_GREEN32(PreviewControls(i).ForeColor))) + ", " + LTRIM$(STR$(_BLUE32(PreviewControls(i).ForeColor))) + ")" + b$ = MKI$(-6) + _MK$(_UNSIGNED LONG, PreviewControls(i).ForeColor) + PUT #BinaryFileNum, , b$ + END IF + IF PreviewControls(i).BackColor > 0 AND PreviewControls(i).BackColor <> __UI_DefaultColor(PreviewControls(i).Type, 2) THEN + PRINT #TextFileNum, " __UI_Controls(__UI_NewID).BackColor = _RGB32(" + LTRIM$(STR$(_RED32(PreviewControls(i).BackColor))) + ", " + LTRIM$(STR$(_GREEN32(PreviewControls(i).BackColor))) + ", " + LTRIM$(STR$(_BLUE32(PreviewControls(i).BackColor))) + ")" + b$ = MKI$(-7) + _MK$(_UNSIGNED LONG, PreviewControls(i).BackColor) + PUT #BinaryFileNum, , b$ + END IF + IF PreviewControls(i).SelectedForeColor > 0 AND PreviewControls(i).SelectedForeColor <> __UI_DefaultColor(PreviewControls(i).Type, 3) THEN + PRINT #TextFileNum, " __UI_Controls(__UI_NewID).SelectedForeColor = _RGB32(" + LTRIM$(STR$(_RED32(PreviewControls(i).SelectedForeColor))) + ", " + LTRIM$(STR$(_GREEN32(PreviewControls(i).SelectedForeColor))) + ", " + LTRIM$(STR$(_BLUE32(PreviewControls(i).SelectedForeColor))) + ")" + b$ = MKI$(-8) + _MK$(_UNSIGNED LONG, PreviewControls(i).SelectedForeColor) + PUT #BinaryFileNum, , b$ + END IF + IF PreviewControls(i).SelectedBackColor > 0 AND PreviewControls(i).SelectedBackColor <> __UI_DefaultColor(PreviewControls(i).Type, 4) THEN + PRINT #TextFileNum, " __UI_Controls(__UI_NewID).SelectedBackColor = _RGB32(" + LTRIM$(STR$(_RED32(PreviewControls(i).SelectedBackColor))) + ", " + LTRIM$(STR$(_GREEN32(PreviewControls(i).SelectedBackColor))) + ", " + LTRIM$(STR$(_BLUE32(PreviewControls(i).SelectedBackColor))) + ")" + b$ = MKI$(-9) + _MK$(_UNSIGNED LONG, PreviewControls(i).SelectedBackColor) + PUT #BinaryFileNum, , b$ + END IF + IF PreviewControls(i).BorderColor > 0 AND PreviewControls(i).BorderColor <> __UI_DefaultColor(PreviewControls(i).Type, 5) THEN + PRINT #TextFileNum, " __UI_Controls(__UI_NewID).BorderColor = _RGB32(" + LTRIM$(STR$(_RED32(PreviewControls(i).BorderColor))) + ", " + LTRIM$(STR$(_GREEN32(PreviewControls(i).BorderColor))) + ", " + LTRIM$(STR$(_BLUE32(PreviewControls(i).BorderColor))) + ")" + b$ = MKI$(-10) + _MK$(_UNSIGNED LONG, PreviewControls(i).BorderColor) + PUT #BinaryFileNum, , b$ + END IF + IF PreviewControls(i).BackStyle = __UI_Transparent THEN + PRINT #TextFileNum, " __UI_Controls(__UI_NewID).BackStyle = __UI_Transparent" + b$ = MKI$(-11): PUT #BinaryFileNum, , b$ + END IF + IF PreviewControls(i).HasBorder THEN + PRINT #TextFileNum, " __UI_Controls(__UI_NewID).HasBorder = __UI_True" + b$ = MKI$(-12): PUT #BinaryFileNum, , b$ + END IF + IF PreviewControls(i).Align = __UI_Center THEN + PRINT #TextFileNum, " __UI_Controls(__UI_NewID).Align = __UI_Center" + b$ = MKI$(-13) + _MK$(_BYTE, PreviewControls(i).Align): PUT #BinaryFileNum, , b$ + ELSEIF PreviewControls(i).Align = __UI_Right THEN + PRINT #TextFileNum, " __UI_Controls(__UI_NewID).Align = __UI_Right" + b$ = MKI$(-13) + _MK$(_BYTE, PreviewControls(i).Align): PUT #BinaryFileNum, , b$ + END IF + IF PreviewControls(i).Value <> 0 THEN + PRINT #TextFileNum, " __UI_Controls(__UI_NewID).Value = " + LTRIM$(STR$(PreviewControls(i).Value)) + b$ = MKI$(-14) + _MK$(_FLOAT, PreviewControls(i).Value): PUT #BinaryFileNum, , b$ + END IF + IF PreviewControls(i).Min <> 0 THEN + PRINT #TextFileNum, " __UI_Controls(__UI_NewID).Min = " + LTRIM$(STR$(PreviewControls(i).Min)) + b$ = MKI$(-15) + _MK$(_FLOAT, PreviewControls(i).Min): PUT #BinaryFileNum, , b$ + END IF + IF PreviewControls(i).Max <> 0 THEN + PRINT #TextFileNum, " __UI_Controls(__UI_NewID).Max = " + LTRIM$(STR$(PreviewControls(i).Max)) + b$ = MKI$(-16) + _MK$(_FLOAT, PreviewControls(i).Max): PUT #BinaryFileNum, , b$ + END IF + 'IF PreviewControls(i).HotKey <> 0 THEN + ' PRINT #TextFileNum, " __UI_Controls(__UI_NewID).HotKey = " + LTRIM$(STR$(PreviewControls(i).HotKey)) + ' b$ = MKI$(-17) + MKI$(PreviewControls(i).HotKey): PUT #BinaryFileNum, , b$ + 'END IF + 'IF PreviewControls(i).HotKeyOffset <> 0 THEN + ' PRINT #TextFileNum, " __UI_Controls(__UI_NewID).HotKeyOffset = " + LTRIM$(STR$(PreviewControls(i).HotKeyOffset)) + ' b$ = MKI$(-18) + MKI$(PreviewControls(i).HotKeyOffset): PUT #BinaryFileNum, , b$ + 'END IF + IF PreviewControls(i).ShowPercentage THEN + PRINT #TextFileNum, " __UI_Controls(__UI_NewID).ShowPercentage = __UI_True" + b$ = MKI$(-19): PUT #BinaryFileNum, , b$ + END IF + IF PreviewControls(i).CanHaveFocus THEN + PRINT #TextFileNum, " __UI_Controls(__UI_NewID).CanHaveFocus = __UI_True" + b$ = MKI$(-20): PUT #BinaryFileNum, , b$ + END IF + IF PreviewControls(i).Disabled THEN + PRINT #TextFileNum, " __UI_Controls(__UI_NewID).Disabled = __UI_True" + b$ = MKI$(-21): PUT #BinaryFileNum, , b$ + END IF + IF PreviewControls(i).Hidden THEN + PRINT #TextFileNum, " __UI_Controls(__UI_NewID).Hidden = __UI_True" + b$ = MKI$(-22): PUT #BinaryFileNum, , b$ + END IF + IF PreviewControls(i).CenteredWindow THEN + PRINT #TextFileNum, " __UI_Controls(__UI_NewID).CenteredWindow = __UI_True" + b$ = MKI$(-23): PUT #BinaryFileNum, , b$ + END IF + IF PreviewControls(i).ContextMenuID THEN + PRINT #TextFileNum, " __UI_Controls(__UI_NewID).ContextMenuID = __UI_GetID(" + CHR$(34) + RTRIM$(PreviewControls(PreviewControls(i).ContextMenuID).Name) + CHR$(34) + ")" + b$ = MKI$(-25) + MKI$(LEN(RTRIM$(PreviewControls(PreviewControls(i).ContextMenuID).Name))) + RTRIM$(PreviewControls(PreviewControls(i).ContextMenuID).Name): PUT #BinaryFileNum, , b$ + END IF + IF PreviewControls(i).Interval THEN + PRINT #TextFileNum, " __UI_Controls(__UI_NewID).Interval = " + LTRIM$(STR$(PreviewControls(i).Interval)) + b$ = MKI$(-26) + _MK$(_FLOAT, PreviewControls(i).Interval): PUT #BinaryFileNum, , b$ + END IF + IF PreviewControls(i).WordWrap THEN + PRINT #TextFileNum, " __UI_Controls(__UI_NewID).WordWrap = __UI_True" + b$ = MKI$(-27): PUT #BinaryFileNum, , b$ + END IF + IF PreviewControls(i).CanResize AND PreviewControls(i).Type = __UI_Type_Form THEN + PRINT #TextFileNum, " __UI_Controls(__UI_NewID).CanResize = __UI_True" + b$ = MKI$(-29): PUT #BinaryFileNum, , b$ + END IF + PRINT #TextFileNum, + END IF + EndOfThisPass: + NEXT + NEXT ThisPass + + b$ = MKI$(-1024): PUT #BinaryFileNum, , b$ 'end of file + PRINT #TextFileNum, "END SUB" + CLOSE #TextFileNum, #BinaryFileNum + OPEN BaseOutputFileName + ".bas" FOR OUTPUT AS #TextFileNum + PRINT #TextFileNum, "'This program was generated by" + PRINT #TextFileNum, "'InForm - GUI system for QB64 - Beta version 1" + PRINT #TextFileNum, "'Fellippe Heitor, 2016 - fellippe@qb64.org - @fellippeheitor" + PRINT #TextFileNum, "'-----------------------------------------------------------" + PRINT #TextFileNum, "'$INCLUDE:'InForm.ui'" + PRINT #TextFileNum, "'$INCLUDE:'" + BaseOutputFileName + ".frm'" + PRINT #TextFileNum, "'$INCLUDE:'xp.uitheme'" + PRINT #TextFileNum, + PRINT #TextFileNum, "'Event procedures: ---------------------------------------------------------------" + FOR i = 1 TO 12 + SELECT EVERYCASE i + CASE 1: PRINT #TextFileNum, "SUB __UI_OnLoad" + CASE 2: PRINT #TextFileNum, "SUB __UI_BeforeUpdateDisplay" + CASE 3: PRINT #TextFileNum, "SUB __UI_BeforeUnload" + CASE 4: PRINT #TextFileNum, "SUB __UI_Click (id AS LONG)" + CASE 5: PRINT #TextFileNum, "SUB __UI_MouseEnter (id AS LONG)" + CASE 6: PRINT #TextFileNum, "SUB __UI_MouseLeave (id AS LONG)" + CASE 7: PRINT #TextFileNum, "SUB __UI_FocusIn (id AS LONG)" + CASE 8: PRINT #TextFileNum, "SUB __UI_FocusOut (id AS LONG)" + CASE 9: PRINT #TextFileNum, "SUB __UI_MouseDown (id AS LONG)" + CASE 10: PRINT #TextFileNum, "SUB __UI_MouseUp (id AS LONG)" + CASE 11: PRINT #TextFileNum, "SUB __UI_KeyPress (id AS LONG)" + CASE 12: PRINT #TextFileNum, "SUB __UI_ValueChanged (id AS LONG)" + + CASE 1 TO 3 + PRINT #TextFileNum, + + CASE 4 TO 6, 9, 10 'All controls except for Menu panels, and internal context menus + PRINT #TextFileNum, " SELECT CASE UCASE$(RTRIM$(__UI_Controls(id).Name))" + FOR Dummy = 1 TO UBOUND(PreviewControls) + IF PreviewControls(Dummy).ID > 0 AND PreviewControls(Dummy).Type <> __UI_Type_Font AND PreviewControls(Dummy).Type <> __UI_Type_ContextMenu THEN + PRINT #TextFileNum, " CASE " + CHR$(34) + UCASE$(RTRIM$(PreviewControls(Dummy).Name)) + CHR$(34) + PRINT #TextFileNum, + END IF + NEXT + PRINT #TextFileNum, " END SELECT" + + CASE 7, 8, 11 'Controls that can have focus only + PRINT #TextFileNum, " SELECT CASE UCASE$(RTRIM$(__UI_Controls(id).Name))" + FOR Dummy = 1 TO UBOUND(PreviewControls) + IF PreviewControls(Dummy).ID > 0 AND PreviewControls(Dummy).CanHaveFocus THEN + PRINT #TextFileNum, " CASE " + CHR$(34) + UCASE$(RTRIM$(PreviewControls(Dummy).Name)) + CHR$(34) + PRINT #TextFileNum, + END IF + NEXT + PRINT #TextFileNum, " END SELECT" + + CASE 12 'Dropdown list, List box and Track bar + PRINT #TextFileNum, " SELECT CASE UCASE$(RTRIM$(__UI_Controls(id).Name))" + FOR Dummy = 1 TO UBOUND(PreviewControls) + IF PreviewControls(Dummy).ID > 0 AND (PreviewControls(Dummy).Type = __UI_Type_ListBox OR PreviewControls(Dummy).Type = __UI_Type_DropdownList OR PreviewControls(Dummy).Type = __UI_Type_TrackBar) THEN + PRINT #TextFileNum, " CASE " + CHR$(34) + UCASE$(RTRIM$(PreviewControls(Dummy).Name)) + CHR$(34) + PRINT #TextFileNum, + END IF + NEXT + PRINT #TextFileNum, " END SELECT" + END SELECT + PRINT #TextFileNum, "END SUB" + PRINT #TextFileNum, + NEXT + CLOSE #TextFileNum + Answer = __UI_MessageBox("Exporting successful. Files output:" + CHR$(10) + " " + BaseOutputFileName + ".bas" + CHR$(10) + " " + BaseOutputFileName + ".frm" + CHR$(10) + " " + BaseOutputFileName + ".frmbin" + CHR$(10) + CHR$(10) + "Exit to QB64?", "", __UI_MsgBox_YesNo + __UI_MsgBox_Question) + IF Answer = __UI_MsgBox_No THEN EXIT SUB + $IF WIN THEN + SHELL _DONTWAIT "qb64.exe " + BaseOutputFileName + ".bas" + $ELSE + SHELL _DONTWAIT "./qb64 " + BaseOutputFileName + ".bas" + $END IF + SYSTEM +END SUB + +SUB SaveSelf + DIM b$, i AS LONG, a$, FontSetup$ + OPEN "form.frm" FOR OUTPUT AS #1 + IF _FILEEXISTS("form.frmbin") THEN KILL "form.frmbin" + OPEN "form.frmbin" FOR BINARY AS #2 + PRINT #1, "'UI form, beta version" + PRINT #1, "DIM __UI_NewID AS LONG" + PRINT #1, + b$ = "UI" + PUT #2, 1, b$ + b$ = MKL$(UBOUND(__UI_Controls)) + PUT #2, , b$ + FOR i = 1 TO UBOUND(__UI_Controls) + IF __UI_Controls(i).ID > 0 AND __UI_Controls(i).Type <> __UI_Type_MenuPanel AND __UI_Controls(i).Type <> __UI_Type_Font AND LEN(RTRIM$(__UI_Controls(i).Name)) > 0 THEN + a$ = "__UI_NewID = __UI_NewControl(" + SELECT CASE __UI_Controls(i).Type + CASE __UI_Type_Form: a$ = a$ + "__UI_Type_Form, " + CASE __UI_Type_Frame: a$ = a$ + "__UI_Type_Frame, " + CASE __UI_Type_Button: a$ = a$ + "__UI_Type_Button, " + CASE __UI_Type_Label: a$ = a$ + "__UI_Type_Label, " + CASE __UI_Type_CheckBox: a$ = a$ + "__UI_Type_CheckBox, " + CASE __UI_Type_RadioButton: a$ = a$ + "__UI_Type_RadioButton, " + CASE __UI_Type_TextBox: a$ = a$ + "__UI_Type_TextBox, " + CASE __UI_Type_ProgressBar: a$ = a$ + "__UI_Type_ProgressBar, " + CASE __UI_Type_ListBox: a$ = a$ + "__UI_Type_ListBox, " + CASE __UI_Type_DropdownList: a$ = a$ + "__UI_Type_DropdownList, " + CASE __UI_Type_MenuBar: a$ = a$ + "__UI_Type_MenuBar, " + CASE __UI_Type_MenuItem: a$ = a$ + "__UI_Type_MenuItem, " + CASE __UI_Type_PictureBox: a$ = a$ + "__UI_Type_PictureBox, " + CASE __UI_Type_TrackBar: a$ = a$ + "__UI_Type_TrackBar, " + CASE __UI_Type_ContextMenu: a$ = a$ + "__UI_Type_ContextMenu, " + END SELECT + a$ = a$ + CHR$(34) + RTRIM$(__UI_Controls(i).Name) + CHR$(34) + "," + a$ = a$ + STR$(__UI_Controls(i).Width) + "," + a$ = a$ + STR$(__UI_Controls(i).Height) + "," + a$ = a$ + STR$(__UI_Controls(i).Left) + "," + a$ = a$ + STR$(__UI_Controls(i).Top) + "," + IF __UI_Controls(i).ParentID > 0 THEN + a$ = a$ + " __UI_GetID(" + CHR$(34) + RTRIM$(__UI_Controls(__UI_Controls(i).ParentID).Name) + CHR$(34) + "))" + ELSE + a$ = a$ + "0)" + END IF + PRINT #1, a$ + b$ = MKI$(-1) + MKL$(0) + MKI$(__UI_Controls(i).Type) '-1 indicates a new control + b$ = b$ + MKI$(LEN(RTRIM$(__UI_Controls(i).Name))) + b$ = b$ + RTRIM$(__UI_Controls(i).Name) + b$ = b$ + MKI$(__UI_Controls(i).Width) + MKI$(__UI_Controls(i).Height) + MKI$(__UI_Controls(i).Left) + MKI$(__UI_Controls(i).Top) + MKI$(LEN(RTRIM$(__UI_Controls(__UI_Controls(i).ParentID).Name))) + RTRIM$(__UI_Controls(__UI_Controls(i).ParentID).Name) + PUT #2, , b$ + + IF LEN(__UI_Captions(i)) > 0 THEN + a$ = "__UI_SetCaption " + CHR$(34) + RTRIM$(__UI_Controls(i).Name) + CHR$(34) + ", " + __UI_SpecialCharsToCHR$(__UI_Captions(i)) + b$ = MKI$(-2) + MKL$(LEN(__UI_Captions(i))) '-2 indicates a caption + PUT #2, , b$ + PUT #2, , __UI_Captions(i) + PRINT #1, a$ + END IF + + IF LEN(__UI_Tips(i)) > 0 THEN + a$ = "__UI_SetTip " + CHR$(34) + RTRIM$(__UI_Controls(i).Name) + CHR$(34) + ", " + __UI_SpecialCharsToCHR$(__UI_Tips(i)) + b$ = MKI$(-24) + MKL$(LEN(__UI_Tips(i))) '-24 indicates a tip + PUT #2, , b$ + PUT #2, , __UI_Tips(i) + PRINT #1, a$ + END IF + + IF LEN(__UI_Texts(i)) > 0 THEN + SELECT CASE __UI_Controls(i).Type + CASE __UI_Type_ListBox, __UI_Type_DropdownList + DIM TempCaption$, TempText$, FindLF&, ThisItem%, ThisItemTop% + DIM LastVisibleItem AS INTEGER + + TempText$ = __UI_Texts(i) + ThisItem% = 0 + DO WHILE LEN(TempText$) + ThisItem% = ThisItem% + 1 + FindLF& = INSTR(TempText$, CHR$(13)) + IF FindLF& THEN + TempCaption$ = LEFT$(TempText$, FindLF& - 1) + TempText$ = MID$(TempText$, FindLF& + 1) + ELSE + TempCaption$ = TempText$ + TempText$ = "" + END IF + a$ = "__UI_AddListBoxItem " + CHR$(34) + RTRIM$(__UI_Controls(i).Name) + CHR$(34) + ", " + CHR$(34) + TempCaption$ + CHR$(34) + PRINT #1, a$ + LOOP + CASE __UI_Type_PictureBox, __UI_Type_Button + a$ = "__UI_LoadImage __UI_Controls(__UI_NewID), " + CHR$(34) + __UI_Texts(i) + CHR$(34) + PRINT #1, a$ + CASE ELSE + a$ = "__UI_SetText " + CHR$(34) + RTRIM$(__UI_Controls(i).Name) + CHR$(34) + ", " + __UI_SpecialCharsToCHR$(__UI_Captions(i)) + PRINT #1, a$ + END SELECT + b$ = MKI$(-3) + MKL$(LEN(__UI_Texts(i))) '-3 indicates a text + PUT #2, , b$ + PUT #2, , __UI_Texts(i) + END IF + IF __UI_Controls(i).TransparentColor > 0 THEN + PRINT #1, "__UI_ClearColor __UI_Controls(__UI_NewID).HelperCanvas, " + LTRIM$(STR$(__UI_Controls(i).TransparentColor)) + ", -1" + b$ = MKI$(-28) + _MK$(_UNSIGNED LONG, __UI_Controls(i).TransparentColor) + PUT #2, , b$ + END IF + IF __UI_Controls(i).Stretch THEN + PRINT #1, "__UI_Controls(__UI_NewID).Stretch = __UI_True" + b$ = MKI$(-4) + PUT #2, , b$ + END IF + 'Inheritable properties won't be saved if they are the same as the parent's + IF __UI_Controls(i).Type = __UI_Type_Form THEN + IF __UI_Controls(i).Font = 8 OR __UI_Controls(i).Font = 16 THEN + 'Internal fonts + SaveInternalFont: + FontSetup$ = "__UI_Font(" + CHR$(34) + "VGA Emulated" + CHR$(34) + ", " + CHR$(34) + CHR$(34) + "," + STR$(__UI_Controls(__UI_GetFontID(__UI_Controls(i).Font)).Max) + ", " + CHR$(34) + CHR$(34) + ")" + PRINT #1, "__UI_Controls(__UI_NewID).Font = " + FontSetup$ + FontSetup$ = "**" + LTRIM$(STR$(__UI_Controls(__UI_GetFontID(__UI_Controls(i).Font)).Max)) + b$ = MKI$(-5) + MKI$(LEN(FontSetup$)) + FontSetup$ + PUT #2, , b$ + ELSE + SaveExternalFont: + FontSetup$ = "__UI_Font(" + CHR$(34) + __UI_Texts(__UI_GetFontID(__UI_Controls(i).Font)) + CHR$(34) + "," + STR$(__UI_Controls(__UI_GetFontID(__UI_Controls(i).Font)).Max) + ", " + CHR$(34) + __UI_Captions(__UI_GetFontID(__UI_Controls(i).Font)) + CHR$(34) + ")" + PRINT #1, "__UI_Controls(__UI_NewID).Font = " + FontSetup$ + FontSetup$ = RTRIM$(__UI_Controls(__UI_GetFontID(__UI_Controls(i).Font)).Name) + "\" + __UI_Texts(__UI_GetFontID(__UI_Controls(i).Font)) + "\" + LTRIM$(STR$(__UI_Controls(__UI_GetFontID(__UI_Controls(i).Font)).Max)) + "\" + __UI_Captions(__UI_GetFontID(__UI_Controls(i).Font)) + b$ = MKI$(-5) + MKI$(LEN(FontSetup$)) + FontSetup$ + PUT #2, , b$ + END IF + ELSE + IF __UI_Controls(i).ParentID > 0 THEN + IF __UI_Controls(i).Font > 0 AND __UI_Controls(i).Font <> __UI_Controls(__UI_Controls(i).ParentID).Font THEN + IF __UI_Controls(i).Font = 8 OR __UI_Controls(i).Font = 167 THEN + GOTO SaveInternalFont + ELSE + GOTO SaveExternalFont + END IF + END IF + ELSE + IF __UI_Controls(i).Font > 0 AND __UI_Controls(i).Font <> __UI_Controls(__UI_FormID).Font THEN + IF __UI_Controls(i).Font = 8 OR __UI_Controls(i).Font = 167 THEN + GOTO SaveInternalFont + ELSE + GOTO SaveExternalFont + END IF + END IF + END IF + END IF + 'Colors are saved only if they differ from the theme's defaults + IF __UI_Controls(i).ForeColor <> __UI_DefaultColor(__UI_Controls(i).Type, 1) THEN + PRINT #1, "__UI_Controls(__UI_NewID).ForeColor = _RGB32(" + LTRIM$(STR$(_RED32(__UI_Controls(i).ForeColor))) + ", " + LTRIM$(STR$(_GREEN32(__UI_Controls(i).ForeColor))) + ", " + LTRIM$(STR$(_BLUE32(__UI_Controls(i).ForeColor))) + ")" + b$ = MKI$(-6) + _MK$(_UNSIGNED LONG, __UI_Controls(i).ForeColor) + PUT #2, , b$ + END IF + IF __UI_Controls(i).BackColor <> __UI_DefaultColor(__UI_Controls(i).Type, 2) THEN + PRINT #1, "__UI_Controls(__UI_NewID).BackColor = _RGB32(" + LTRIM$(STR$(_RED32(__UI_Controls(i).BackColor))) + ", " + LTRIM$(STR$(_GREEN32(__UI_Controls(i).BackColor))) + ", " + LTRIM$(STR$(_BLUE32(__UI_Controls(i).BackColor))) + ")" + b$ = MKI$(-7) + _MK$(_UNSIGNED LONG, __UI_Controls(i).BackColor) + PUT #2, , b$ + END IF + IF __UI_Controls(i).SelectedForeColor <> __UI_DefaultColor(__UI_Controls(i).Type, 3) THEN + PRINT #1, "__UI_Controls(__UI_NewID).SelectedForeColor = _RGB32(" + LTRIM$(STR$(_RED32(__UI_Controls(i).SelectedForeColor))) + ", " + LTRIM$(STR$(_GREEN32(__UI_Controls(i).SelectedForeColor))) + ", " + LTRIM$(STR$(_BLUE32(__UI_Controls(i).SelectedForeColor))) + ")" + b$ = MKI$(-8) + _MK$(_UNSIGNED LONG, __UI_Controls(i).SelectedForeColor) + PUT #2, , b$ + END IF + IF __UI_Controls(i).SelectedBackColor <> __UI_DefaultColor(__UI_Controls(i).Type, 4) THEN + PRINT #1, "__UI_Controls(__UI_NewID).SelectedBackColor = _RGB32(" + LTRIM$(STR$(_RED32(__UI_Controls(i).SelectedBackColor))) + ", " + LTRIM$(STR$(_GREEN32(__UI_Controls(i).SelectedBackColor))) + ", " + LTRIM$(STR$(_BLUE32(__UI_Controls(i).SelectedBackColor))) + ")" + b$ = MKI$(-9) + _MK$(_UNSIGNED LONG, __UI_Controls(i).SelectedBackColor) + PUT #2, , b$ + END IF + IF __UI_Controls(i).BorderColor <> __UI_DefaultColor(__UI_Controls(i).Type, 5) THEN + PRINT #1, "__UI_Controls(__UI_NewID).BorderColor = _RGB32(" + LTRIM$(STR$(_RED32(__UI_Controls(i).BorderColor))) + ", " + LTRIM$(STR$(_GREEN32(__UI_Controls(i).BorderColor))) + ", " + LTRIM$(STR$(_BLUE32(__UI_Controls(i).BorderColor))) + ")" + b$ = MKI$(-10) + _MK$(_UNSIGNED LONG, __UI_Controls(i).BorderColor) + PUT #2, , b$ + END IF + IF __UI_Controls(i).BackStyle = __UI_Transparent THEN + PRINT #1, "__UI_Controls(__UI_NewID).BackStyle = __UI_Transparent" + b$ = MKI$(-11): PUT #2, , b$ + END IF + IF __UI_Controls(i).HasBorder THEN + PRINT #1, "__UI_Controls(__UI_NewID).HasBorder = __UI_True" + b$ = MKI$(-12): PUT #2, , b$ + END IF + IF __UI_Controls(i).Align = __UI_Center THEN + PRINT #1, "__UI_Controls(__UI_NewID).Align = __UI_Center" + b$ = MKI$(-13) + _MK$(_BYTE, __UI_Controls(i).Align): PUT #2, , b$ + ELSEIF __UI_Controls(i).Align = __UI_Right THEN + PRINT #1, "__UI_Controls(__UI_NewID).Align = __UI_Right" + b$ = MKI$(-13) + _MK$(_BYTE, __UI_Controls(i).Align): PUT #2, , b$ + END IF + IF __UI_Controls(i).Value <> 0 THEN + PRINT #1, "__UI_Controls(__UI_NewID).Value = " + LTRIM$(STR$(__UI_Controls(i).Value)) + b$ = MKI$(-14) + _MK$(_FLOAT, __UI_Controls(i).Value): PUT #2, , b$ + END IF + IF __UI_Controls(i).Min <> 0 THEN + PRINT #1, "__UI_Controls(__UI_NewID).Min = " + LTRIM$(STR$(__UI_Controls(i).Min)) + b$ = MKI$(-15) + _MK$(_FLOAT, __UI_Controls(i).Min): PUT #2, , b$ + END IF + IF __UI_Controls(i).Max <> 0 THEN + PRINT #1, "__UI_Controls(__UI_NewID).Max = " + LTRIM$(STR$(__UI_Controls(i).Max)) + b$ = MKI$(-16) + _MK$(_FLOAT, __UI_Controls(i).Max): PUT #2, , b$ + END IF + IF __UI_Controls(i).HotKey <> 0 THEN + PRINT #1, "__UI_Controls(__UI_NewID).HotKey = " + LTRIM$(STR$(__UI_Controls(i).HotKey)) + b$ = MKI$(-17) + MKI$(__UI_Controls(i).HotKey): PUT #2, , b$ + END IF + IF __UI_Controls(i).HotKeyOffset <> 0 THEN + PRINT #1, "__UI_Controls(__UI_NewID).HotKeyOffset = " + LTRIM$(STR$(__UI_Controls(i).HotKeyOffset)) + b$ = MKI$(-18) + MKI$(__UI_Controls(i).HotKeyOffset): PUT #2, , b$ + END IF + IF __UI_Controls(i).ShowPercentage THEN + PRINT #1, "__UI_Controls(__UI_NewID).ShowPercentage = __UI_True" + b$ = MKI$(-19): PUT #2, , b$ + END IF + IF __UI_Controls(i).CanHaveFocus THEN + PRINT #1, "__UI_Controls(__UI_NewID).CanHaveFocus = __UI_True" + b$ = MKI$(-20): PUT #2, , b$ + END IF + IF __UI_Controls(i).Disabled THEN + PRINT #1, "__UI_Controls(__UI_NewID).Disabled = __UI_True" + b$ = MKI$(-21): PUT #2, , b$ + END IF + IF __UI_Controls(i).Hidden THEN + PRINT #1, "__UI_Controls(__UI_NewID).Hidden = __UI_True" + b$ = MKI$(-22): PUT #2, , b$ + END IF + IF __UI_Controls(i).CenteredWindow THEN + PRINT #1, "__UI_Controls(__UI_NewID).CenteredWindow = __UI_True" + b$ = MKI$(-23): PUT #2, , b$ + END IF + IF __UI_Controls(i).ContextMenuID THEN + PRINT #1, "__UI_Controls(__UI_NewID).ContextMenuID = __UI_GetID(" + CHR$(34) + RTRIM$(__UI_Controls(__UI_Controls(i).ContextMenuID).Name) + CHR$(34) + ")" + b$ = MKI$(-25) + MKI$(LEN(RTRIM$(__UI_Controls(__UI_Controls(i).ContextMenuID).Name))) + RTRIM$(__UI_Controls(__UI_Controls(i).ContextMenuID).Name): PUT #2, , b$ + END IF + IF __UI_Controls(i).Interval THEN + PRINT #1, "__UI_Controls(__UI_NewID).Interval = " + LTRIM$(STR$(__UI_Controls(i).Interval)) + b$ = MKI$(-26) + _MK$(_FLOAT, __UI_Controls(i).Interval): PUT #2, , b$ + END IF + IF __UI_Controls(i).WordWrap THEN + PRINT #1, "__UI_Controls(__UI_NewID).WordWrap = __UI_True" + b$ = MKI$(-27): PUT #2, , b$ + END IF + PRINT #1, + END IF + NEXT + b$ = MKI$(-1024): PUT #2, , b$ 'end of file + CLOSE #1, #2 +END SUB diff --git a/UiEditor.frm b/UiEditor.frm index fc02460..0cc588d 100644 --- a/UiEditor.frm +++ b/UiEditor.frm @@ -1,42 +1,51 @@ -'InForm - GUI system for QB64 +'InForm - GUI system for QB64 - Beta version 1 'Fellippe Heitor, 2016 - fellippe@qb64.org - @fellippeheitor -'Beta version 1 +'----------------------------------------------------------- SUB __UI_LoadForm + DIM __UI_NewID AS LONG - __UI_NewID = __UI_NewControl(__UI_Type_Form, "Form1", 598, 430, 0, 0, 0) - __UI_SetCaption "Form1", "InForm Designer" - __UI_Controls(__UI_NewID).Font = __UI_Font("Noto Mono", "InForm\NotoMono-Regular.ttf", 12, "MONOSPACE") + __UI_NewID = __UI_NewControl(__UI_Type_Form, "UiEditorForm", 598, 430, 0, 0, 0) + __UI_SetCaption "UiEditorForm", "InForm Designer" + __UI_Controls(__UI_NewID).Font = __UI_Font("InForm\NotoMono-Regular.ttf", 12, "MONOSPACE") - __UI_NewID = __UI_NewControl(__UI_Type_MenuBar, "FileMenu", 56, 18, 14, 0, 0) + __UI_NewID = __UI_NewControl(__UI_Type_MenuBar, "FileMenu", 44, 18, 8, 0, 0) __UI_SetCaption "FileMenu", "&File" - __UI_NewID = __UI_NewControl(__UI_Type_MenuItem, "FileMenuLoad", 140, 18, 0, 4, __UI_GetID("FileMenu")) - __UI_SetCaption "FileMenuLoad", "&Load form.frmbin" - __UI_Controls(__UI_NewID).Disabled = __UI_True + __UI_NewID = __UI_NewControl(__UI_Type_MenuBar, "ViewMenu", 44, 18, 52, 0, 0) + __UI_SetCaption "ViewMenu", "&View" + + __UI_NewID = __UI_NewControl(__UI_Type_MenuBar, "HelpMenu", 44, 18, 545, 0, 0) + __UI_SetCaption "HelpMenu", "&Help" + __UI_Controls(__UI_NewID).Align = __UI_Right + + __UI_NewID = __UI_NewControl(__UI_Type_Frame, "ToolBox", 62, 376, 30, 40, 0) + __UI_Controls(__UI_NewID).HasBorder = __UI_True + + __UI_NewID = __UI_NewControl(__UI_Type_Frame, "PropertiesFrame", 457, 186, 110, 40, 0) + __UI_SetCaption "PropertiesFrame", "Control properties: Main form" + __UI_Controls(__UI_NewID).HasBorder = __UI_True + + __UI_NewID = __UI_NewControl(__UI_Type_Frame, "ColorMixer", 457, 175, 110, 240, 0) + __UI_SetCaption "ColorMixer", "Color mixer" + __UI_Controls(__UI_NewID).HasBorder = __UI_True __UI_NewID = __UI_NewControl(__UI_Type_MenuItem, "FileMenuSave", 91, 18, 0, 22, __UI_GetID("FileMenu")) __UI_SetCaption "FileMenuSave", "&Save form-" - __UI_Controls(__UI_NewID).Disabled = __UI_True - + __UI_LoadImage __UI_Controls(__UI_NewID), "InForm\disk.png" + __UI_NewID = __UI_NewControl(__UI_Type_MenuItem, "FileMenuExit", 56, 18, 0, 40, __UI_GetID("FileMenu")) __UI_SetCaption "FileMenuExit", "E&xit" - __UI_NewID = __UI_NewControl(__UI_Type_MenuBar, "ViewMenu", 56, 18, 14, 0, 0) - __UI_SetCaption "ViewMenu", "&View" + __UI_NewID = __UI_NewControl(__UI_Type_MenuItem, "ViewMenuPreviewDetach", 56, 18, 0, 40, __UI_GetID("ViewMenu")) + __UI_SetCaption "ViewMenuPreviewDetach", "&Keep preview window attached" + __UI_Controls(__UI_NewID).Value = -1 __UI_NewID = __UI_NewControl(__UI_Type_MenuItem, "ViewMenuPreview", 56, 18, 0, 40, __UI_GetID("ViewMenu")) - __UI_SetCaption "ViewMenuPreview", "Open &preview window" + __UI_SetCaption "ViewMenuPreview", "&Open preview window-" - $IF WIN THEN - __UI_NewID = __UI_NewControl(__UI_Type_MenuItem, "ViewMenuPreviewDetach", 56, 18, 0, 40, __UI_GetID("ViewMenu")) - __UI_Controls(__UI_NewID).Value = __UI_True - __UI_SetCaption "ViewMenuPreviewDetach", "&Keep preview window attached" - $END IF - - __UI_NewID = __UI_NewControl(__UI_Type_MenuBar, "HelpMenu", 56, 18, 527, 0, 0) - __UI_SetCaption "HelpMenu", "&Help" - __UI_Controls(__UI_NewID).Align = __UI_Right + __UI_NewID = __UI_NewControl(__UI_Type_MenuItem, "ViewMenuLoadedFonts", 56, 18, 0, 40, __UI_GetID("ViewMenu")) + __UI_SetCaption "ViewMenuLoadedFonts", "&Loaded fonts" __UI_NewID = __UI_NewControl(__UI_Type_MenuItem, "HelpMenuHelp", 0, 0, 0, 0, __UI_GetID("HelpMenu")) __UI_SetCaption "HelpMenuHelp", "&What's all this?" @@ -44,46 +53,39 @@ SUB __UI_LoadForm __UI_NewID = __UI_NewControl(__UI_Type_MenuItem, "HelpMenuAbout", 0, 0, 0, 0, __UI_GetID("HelpMenu")) __UI_SetCaption "HelpMenuAbout", "&About..." - __UI_NewID = __UI_NewControl(__UI_Type_Frame, "ToolBox", 62, 376, 30, 40, 0) - __UI_Controls(__UI_NewID).HasBorder = __UI_True - - __UI_NewID = __UI_NewControl(__UI_Type_Button, "AddButton", 22, 22, 20, 20, __UI_GetID("ToolBox")) + __UI_NewID = __UI_NewControl(__UI_Type_Button, "AddButton", 22, 22, 20, 26, __UI_GetID("ToolBox")) __UI_Controls(__UI_NewID).CanHaveFocus = __UI_True - __UI_NewID = __UI_NewControl(__UI_Type_Button, "AddLabel", 22, 22, 20, 50, __UI_GetID("ToolBox")) + __UI_NewID = __UI_NewControl(__UI_Type_Button, "AddLabel", 22, 22, 20, 56, __UI_GetID("ToolBox")) __UI_Controls(__UI_NewID).CanHaveFocus = __UI_True - __UI_NewID = __UI_NewControl(__UI_Type_Button, "AddTextBox", 22, 22, 20, 80, __UI_GetID("ToolBox")) + __UI_NewID = __UI_NewControl(__UI_Type_Button, "AddTextBox", 22, 22, 20, 86, __UI_GetID("ToolBox")) __UI_Controls(__UI_NewID).CanHaveFocus = __UI_True - __UI_NewID = __UI_NewControl(__UI_Type_Button, "AddCheckBox", 22, 22, 20, 110, __UI_GetID("ToolBox")) + __UI_NewID = __UI_NewControl(__UI_Type_Button, "AddCheckBox", 22, 22, 20, 116, __UI_GetID("ToolBox")) __UI_Controls(__UI_NewID).CanHaveFocus = __UI_True - __UI_NewID = __UI_NewControl(__UI_Type_Button, "AddRadioButton", 22, 22, 20, 140, __UI_GetID("ToolBox")) + __UI_NewID = __UI_NewControl(__UI_Type_Button, "AddRadioButton", 22, 22, 20, 146, __UI_GetID("ToolBox")) __UI_Controls(__UI_NewID).CanHaveFocus = __UI_True - __UI_NewID = __UI_NewControl(__UI_Type_Button, "AddListBox", 22, 22, 20, 170, __UI_GetID("ToolBox")) + __UI_NewID = __UI_NewControl(__UI_Type_Button, "AddListBox", 22, 22, 20, 176, __UI_GetID("ToolBox")) __UI_Controls(__UI_NewID).CanHaveFocus = __UI_True - __UI_NewID = __UI_NewControl(__UI_Type_Button, "AddDropdownList", 22, 22, 20, 200, __UI_GetID("ToolBox")) + __UI_NewID = __UI_NewControl(__UI_Type_Button, "AddDropdownList", 22, 22, 20, 206, __UI_GetID("ToolBox")) __UI_Controls(__UI_NewID).CanHaveFocus = __UI_True - __UI_NewID = __UI_NewControl(__UI_Type_Button, "AddTrackBar", 22, 22, 20, 230, __UI_GetID("ToolBox")) + __UI_NewID = __UI_NewControl(__UI_Type_Button, "AddTrackBar", 22, 22, 20, 236, __UI_GetID("ToolBox")) __UI_Controls(__UI_NewID).CanHaveFocus = __UI_True - __UI_NewID = __UI_NewControl(__UI_Type_Button, "AddProgressBar", 22, 22, 20, 260, __UI_GetID("ToolBox")) + __UI_NewID = __UI_NewControl(__UI_Type_Button, "AddProgressBar", 22, 22, 20, 266, __UI_GetID("ToolBox")) __UI_Controls(__UI_NewID).CanHaveFocus = __UI_True - __UI_NewID = __UI_NewControl(__UI_Type_Button, "AddPictureBox", 22, 22, 20, 290, __UI_GetID("ToolBox")) + __UI_NewID = __UI_NewControl(__UI_Type_Button, "AddPictureBox", 22, 22, 20, 296, __UI_GetID("ToolBox")) __UI_Controls(__UI_NewID).CanHaveFocus = __UI_True - __UI_NewID = __UI_NewControl(__UI_Type_Button, "AddFrame", 22, 22, 20, 320, __UI_GetID("ToolBox")) + __UI_NewID = __UI_NewControl(__UI_Type_Button, "AddFrame", 22, 22, 20, 326, __UI_GetID("ToolBox")) __UI_Controls(__UI_NewID).CanHaveFocus = __UI_True - __UI_NewID = __UI_NewControl(__UI_Type_Frame, "PropertiesFrame", 457, 186, 110, 40, 0) - __UI_SetCaption "PropertiesFrame", "Control properties: Form1" - __UI_Controls(__UI_NewID).HasBorder = __UI_True - __UI_NewID = __UI_NewControl(__UI_Type_DropdownList, "PropertiesList", 174, 23, 20, 20, __UI_GetID("PropertiesFrame")) __UI_AddListBoxItem "PropertiesList", "Name" __UI_AddListBoxItem "PropertiesList", "Caption" @@ -93,71 +95,80 @@ SUB __UI_LoadForm __UI_AddListBoxItem "PropertiesList", "Width" __UI_AddListBoxItem "PropertiesList", "Height" __UI_AddListBoxItem "PropertiesList", "Font" - __UI_AddListBoxItem "PropertiesList", "BackStyle" + __UI_AddListBoxItem "PropertiesList", "Tool tip" __UI_AddListBoxItem "PropertiesList", "Value" __UI_AddListBoxItem "PropertiesList", "Min" __UI_AddListBoxItem "PropertiesList", "Max" __UI_AddListBoxItem "PropertiesList", "Interval" __UI_Controls(__UI_NewID).HasBorder = __UI_True __UI_Controls(__UI_NewID).Value = 1 + __UI_Controls(__UI_NewID).Max = 13 __UI_Controls(__UI_NewID).CanHaveFocus = __UI_True __UI_NewID = __UI_NewControl(__UI_Type_TextBox, "PropertyValue", 250, 23, 200, 20, __UI_GetID("PropertiesFrame")) __UI_Controls(__UI_NewID).HasBorder = __UI_True __UI_Controls(__UI_NewID).CanHaveFocus = __UI_True - __UI_NewID = __UI_NewControl(__UI_Type_CheckBox, "Stretch", 150, 17, 70, 59, __UI_GetID("PropertiesFrame")) + __UI_NewID = __UI_NewControl(__UI_Type_CheckBox, "Stretch", 150, 17, 22, 59, __UI_GetID("PropertiesFrame")) __UI_SetCaption "Stretch", "Stretch" __UI_Controls(__UI_NewID).CanHaveFocus = __UI_True - __UI_NewID = __UI_NewControl(__UI_Type_CheckBox, "HasBorder", 150, 17, 70, 79, __UI_GetID("PropertiesFrame")) + __UI_NewID = __UI_NewControl(__UI_Type_CheckBox, "HasBorder", 150, 17, 22, 79, __UI_GetID("PropertiesFrame")) __UI_SetCaption "HasBorder", "Has border" - __UI_Controls(__UI_NewID).Value = -1 __UI_Controls(__UI_NewID).CanHaveFocus = __UI_True - __UI_NewID = __UI_NewControl(__UI_Type_CheckBox, "ShowPercentage", 149, 17, 70, 99, __UI_GetID("PropertiesFrame")) + __UI_NewID = __UI_NewControl(__UI_Type_CheckBox, "ShowPercentage", 149, 17, 22, 99, __UI_GetID("PropertiesFrame")) __UI_SetCaption "ShowPercentage", "Show percentage" __UI_Controls(__UI_NewID).CanHaveFocus = __UI_True - __UI_NewID = __UI_NewControl(__UI_Type_CheckBox, "WordWrap", 150, 17, 70, 119, __UI_GetID("PropertiesFrame")) + __UI_NewID = __UI_NewControl(__UI_Type_CheckBox, "WordWrap", 150, 17, 22, 119, __UI_GetID("PropertiesFrame")) __UI_SetCaption "WordWrap", "Word wrap" __UI_Controls(__UI_NewID).CanHaveFocus = __UI_True - __UI_NewID = __UI_NewControl(__UI_Type_CheckBox, "CanHaveFocus", 150, 17, 230, 59, __UI_GetID("PropertiesFrame")) + __UI_NewID = __UI_NewControl(__UI_Type_CheckBox, "CanHaveFocus", 150, 17, 182, 59, __UI_GetID("PropertiesFrame")) __UI_SetCaption "CanHaveFocus", "Can have focus" - __UI_Controls(__UI_NewID).Value = -1 __UI_Controls(__UI_NewID).CanHaveFocus = __UI_True - __UI_NewID = __UI_NewControl(__UI_Type_CheckBox, "Disabled", 150, 17, 230, 79, __UI_GetID("PropertiesFrame")) + __UI_NewID = __UI_NewControl(__UI_Type_CheckBox, "Disabled", 150, 17, 182, 79, __UI_GetID("PropertiesFrame")) __UI_SetCaption "Disabled", "Disabled" - __UI_Controls(__UI_NewID).Value = -1 __UI_Controls(__UI_NewID).CanHaveFocus = __UI_True - __UI_NewID = __UI_NewControl(__UI_Type_CheckBox, "Hidden", 150, 17, 230, 99, __UI_GetID("PropertiesFrame")) + __UI_NewID = __UI_NewControl(__UI_Type_CheckBox, "Hidden", 150, 17, 182, 99, __UI_GetID("PropertiesFrame")) __UI_SetCaption "Hidden", "Hidden" - __UI_Controls(__UI_NewID).Value = -1 __UI_Controls(__UI_NewID).CanHaveFocus = __UI_True - __UI_NewID = __UI_NewControl(__UI_Type_CheckBox, "CenteredWindow", 150, 17, 230, 119, __UI_GetID("PropertiesFrame")) + __UI_NewID = __UI_NewControl(__UI_Type_CheckBox, "CenteredWindow", 150, 17, 182, 119, __UI_GetID("PropertiesFrame")) __UI_SetCaption "CenteredWindow", "Centered window" - __UI_Controls(__UI_NewID).Value = -1 __UI_Controls(__UI_NewID).CanHaveFocus = __UI_True - __UI_NewID = __UI_NewControl(__UI_Type_Label, "Label1", 83, 20, 70, 150, __UI_GetID("PropertiesFrame")) + __UI_NewID = __UI_NewControl(__UI_Type_CheckBox, "Resizable", 102, 17, 339, 59, __UI_GetID("PropertiesFrame")) + __UI_SetCaption "Resizable", "Resizable" + __UI_Controls(__UI_NewID).CanHaveFocus = __UI_True + + __UI_NewID = __UI_NewControl(__UI_Type_Label, "Label1", 83, 20, 24, 151, __UI_GetID("PropertiesFrame")) __UI_SetCaption "Label1", "Text align:" - __UI_NewID = __UI_NewControl(__UI_Type_DropdownList, "AlignOptions", 155, 20, 160, 150, __UI_GetID("PropertiesFrame")) + __UI_NewID = __UI_NewControl(__UI_Type_DropdownList, "AlignOptions", 104, 20, 109, 151, __UI_GetID("PropertiesFrame")) __UI_SetCaption "AlignOptions", "Left" __UI_AddListBoxItem "AlignOptions", "Left" __UI_AddListBoxItem "AlignOptions", "Center" __UI_AddListBoxItem "AlignOptions", "Right" __UI_Controls(__UI_NewID).HasBorder = __UI_True __UI_Controls(__UI_NewID).Value = 1 + __UI_Controls(__UI_NewID).Max = 3 __UI_Controls(__UI_NewID).CanHaveFocus = __UI_True - __UI_NewID = __UI_NewControl(__UI_Type_Frame, "ColorMixer", 457, 175, 110, 240, 0) - __UI_SetCaption "ColorMixer", "Color mixer" + __UI_NewID = __UI_NewControl(__UI_Type_Label, "Label2", 83, 20, 225, 151, __UI_GetID("PropertiesFrame")) + __UI_SetCaption "Label2", "Back style:" + + __UI_NewID = __UI_NewControl(__UI_Type_DropdownList, "BackStyleOptions", 134, 20, 311, 151, __UI_GetID("PropertiesFrame")) + __UI_SetCaption "BackStyleOptions", "Left" + __UI_AddListBoxItem "BackStyleOptions", "Opaque" + __UI_AddListBoxItem "BackStyleOptions", "Transparent" __UI_Controls(__UI_NewID).HasBorder = __UI_True + __UI_Controls(__UI_NewID).Value = 1 + __UI_Controls(__UI_NewID).Max = 2 + __UI_Controls(__UI_NewID).CanHaveFocus = __UI_True __UI_NewID = __UI_NewControl(__UI_Type_DropdownList, "ColorPropertiesList", 161, 21, 10, 20, __UI_GetID("ColorMixer")) __UI_AddListBoxItem "ColorPropertiesList", "ForeColor" @@ -167,6 +178,7 @@ SUB __UI_LoadForm __UI_AddListBoxItem "ColorPropertiesList", "BorderColor" __UI_Controls(__UI_NewID).HasBorder = __UI_True __UI_Controls(__UI_NewID).Value = 1 + __UI_Controls(__UI_NewID).Max = 5 __UI_Controls(__UI_NewID).CanHaveFocus = __UI_True __UI_NewID = __UI_NewControl(__UI_Type_PictureBox, "ColorPreview", 159, 115, 10, 51, __UI_GetID("ColorMixer")) @@ -201,4 +213,5 @@ SUB __UI_LoadForm __UI_Controls(__UI_NewID).BorderColor = _RGB32(0, 0, 255) __UI_Controls(__UI_NewID).HasBorder = __UI_True __UI_Controls(__UI_NewID).CanHaveFocus = __UI_True + END SUB diff --git a/UiEditorPreview.bas b/UiEditorPreview.bas index 56350a8..d425476 100644 --- a/UiEditorPreview.bas +++ b/UiEditorPreview.bas @@ -41,12 +41,6 @@ SUB __UI_Click (id AS LONG) SendData b$, OffsetNewDataFromPreview END SUB -SUB __UI_EndDrag -END SUB - -SUB __UI_EndResize -END SUB - SUB __UI_MouseEnter (id AS LONG) DIM b$ b$ = MKI$(-1) @@ -84,11 +78,6 @@ SUB __UI_BeforeUpdateDisplay b$ = MKL$(UiPreviewPID) SendData b$, OffsetPreviewPID - IF __UI_ControlOperation THEN - __UI_ControlOperation = __UI_False - b$ = MKI$(-1): SendData b$, OffsetNewDataFromPreview - END IF - UiEditorFile = FREEFILE OPEN "UiEditor.dat" FOR BINARY AS #UiEditorFile @@ -150,7 +139,7 @@ SUB __UI_BeforeUpdateDisplay __UI_SetCaption __UI_Controls(TempValue).Name, RTRIM$(__UI_Controls(TempValue).Name) CASE __UI_Type_TextBox TempValue = __UI_NewControl(__UI_Type_TextBox, "", 120, 23, TempWidth \ 2 - 60, TempHeight \ 2 - 12, ThisContainer) - IF _FONTWIDTH(__UI_Controls(TempValue).Font) = 0 THEN __UI_Controls(TempValue).Font = __UI_Font("VGA Emulated", "", 16, "") + IF _FONTWIDTH(__UI_Controls(TempValue).Font) = 0 THEN __UI_Controls(TempValue).Font = __UI_Font("", 16, "") __UI_Controls(TempValue).FieldArea = __UI_Controls(TempValue).Width \ _FONTWIDTH(__UI_Controls(TempValue).Font) - 1 __UI_SetCaption __UI_Controls(TempValue).Name, RTRIM$(__UI_Controls(TempValue).Name) CASE __UI_Type_ListBox @@ -162,7 +151,7 @@ SUB __UI_BeforeUpdateDisplay TempValue = __UI_NewControl(__UI_Type_TrackBar, "", 300, 45, TempWidth \ 2 - 150, TempHeight \ 2 - 23, ThisContainer) CASE __UI_Type_ProgressBar TempValue = __UI_NewControl(__UI_Type_ProgressBar, "", 300, 23, TempWidth \ 2 - 150, TempHeight \ 2 - 12, ThisContainer) - CASE __UI_Type_PictureBox, __UI_Type_Frame + CASE __UI_Type_PictureBox TempValue = __UI_NewControl(TempValue, "", 230, 150, TempWidth \ 2 - 115, TempHeight \ 2 - 75, ThisContainer) CASE __UI_Type_Frame TempValue = __UI_NewControl(TempValue, "", 230, 150, TempWidth \ 2 - 115, TempHeight \ 2 - 75, 0) @@ -187,10 +176,18 @@ SUB __UI_BeforeUpdateDisplay TempValue = CVI(b$) SELECT CASE TempValue CASE 1 'Name + b$ = SPACE$(4): GET #UiEditorFile, OffsetPropertyValue, b$ + b$ = SPACE$(CVL(b$)): GET #UiEditorFile, , b$ + IF __UI_GetID(b$) > 0 THEN + DO + b$ = b$ + "_" + IF __UI_GetID(b$) = 0 THEN EXIT DO + LOOP + END IF IF __UI_TotalSelectedControls = 1 THEN - b$ = SPACE$(4): GET #UiEditorFile, OffsetPropertyValue, b$ - b$ = SPACE$(CVL(b$)): GET #UiEditorFile, , b$ __UI_Controls(__UI_FirstSelectedID).Name = b$ + ELSE + __UI_Controls(__UI_FormID).Name = b$ END IF CASE 2 'Caption b$ = SPACE$(4): GET #UiEditorFile, OffsetPropertyValue, b$ @@ -198,7 +195,7 @@ SUB __UI_BeforeUpdateDisplay IF __UI_TotalSelectedControls > 0 THEN FOR i = 1 TO UBOUND(__UI_Controls) IF __UI_Controls(i).ControlIsSelected THEN - __UI_Captions(i) = b$ + __UI_SetCaption RTRIM$(__UI_Controls(i).Name), b$ END IF NEXT ELSE @@ -210,6 +207,9 @@ SUB __UI_BeforeUpdateDisplay FOR i = 1 TO UBOUND(__UI_Controls) IF __UI_Controls(i).ControlIsSelected THEN __UI_Texts(i) = b$ + IF __UI_Controls(i).Type = __UI_Type_Button OR __UI_Controls(i).Type = __UI_Type_PictureBox THEN + __UI_LoadImage __UI_Controls(i), b$ + END IF END IF NEXT CASE 4 'Top @@ -257,7 +257,44 @@ SUB __UI_BeforeUpdateDisplay __UI_Controls(__UI_FormID).Height = TempValue END IF CASE 8 'Font - CASE 9 'BackStyle + b$ = SPACE$(4): GET #UiEditorFile, OffsetPropertyValue, b$ + b$ = SPACE$(CVL(b$)): GET #UiEditorFile, , b$ + DIM NewFontFile AS STRING + DIM NewFontSize AS INTEGER, NewFontParameters AS STRING + DIM FindSep AS INTEGER, TotalSep AS INTEGER + + 'Parse b$ into Font data + FindSep = INSTR(b$, "*") + IF FindSep THEN TotalSep = TotalSep + 1 + NewFontFile = LEFT$(b$, FindSep - 1) + b$ = MID$(b$, FindSep + 1) + + FindSep = INSTR(b$, "*") + IF FindSep THEN TotalSep = TotalSep + 1 + NewFontParameters = LEFT$(b$, FindSep - 1) + b$ = MID$(b$, FindSep + 1) + + NewFontSize = VAL(b$) + + IF TotalSep = 2 AND NewFontSize > 0 THEN + IF __UI_TotalSelectedControls > 0 THEN + FOR i = 1 TO UBOUND(__UI_Controls) + IF __UI_Controls(i).ControlIsSelected THEN + __UI_Controls(i).Font = __UI_Font(NewFontFile, NewFontSize, NewFontParameters) + END IF + NEXT + ELSE + __UI_Controls(__UI_FormID).Font = __UI_Font(NewFontFile, NewFontSize, NewFontParameters) + END IF + END IF + CASE 9 'Tooltip + b$ = SPACE$(4): GET #UiEditorFile, OffsetPropertyValue, b$ + b$ = SPACE$(CVL(b$)): GET #UiEditorFile, , b$ + FOR i = 1 TO UBOUND(__UI_Controls) + IF __UI_Controls(i).ControlIsSelected THEN + __UI_Tips(i) = b$ + END IF + NEXT CASE 10 'Value b$ = SPACE$(LEN(FloatValue)): GET #UiEditorFile, OffsetPropertyValue, b$ FOR i = 1 TO UBOUND(__UI_Controls) @@ -337,6 +374,7 @@ SUB __UI_BeforeUpdateDisplay NEXT CASE 21 'CenteredWindow b$ = SPACE$(2): GET #UiEditorFile, OffsetPropertyValue, b$ + TempValue = CVI(b$) IF __UI_TotalSelectedControls = 0 THEN __UI_Controls(__UI_FormID).CenteredWindow = TempValue END IF @@ -402,6 +440,19 @@ SUB __UI_BeforeUpdateDisplay ELSE __UI_Controls(__UI_FormID).BorderColor = _CV(_UNSIGNED LONG, b$) END IF + CASE 28 'BackStyle + b$ = SPACE$(2): GET #UiEditorFile, OffsetPropertyValue, b$ + FOR i = 1 TO UBOUND(__UI_Controls) + IF __UI_Controls(i).ControlIsSelected THEN + __UI_Controls(i).BackStyle = CVI(b$) + END IF + NEXT + CASE 29 'CanResize + b$ = SPACE$(2): GET #UiEditorFile, OffsetPropertyValue, b$ + TempValue = CVI(b$) + IF __UI_TotalSelectedControls = 0 THEN + __UI_Controls(__UI_FormID).CanResize = TempValue + END IF END SELECT __UI_ForceRedraw = __UI_True END IF @@ -473,7 +524,7 @@ SUB LoadPreview IF LogFileLoad THEN PRINT #LogFileNum, "DESTROYED CONTROLS" b$ = SPACE$(4): GET #BinaryFileNum, , b$ - IF LogFileLoad THEN PRINT #LogFileNum, "READ NEW ARRAYS:" + STR$(CVI(b$)) + IF LogFileLoad THEN PRINT #LogFileNum, "READ NEW ARRAYS:" + STR$(CVL(b$)) REDIM _PRESERVE __UI_Captions(1 TO CVL(b$)) AS STRING REDIM _PRESERVE __UI_TempCaptions(1 TO CVL(b$)) AS STRING @@ -528,7 +579,7 @@ SUB LoadPreview b$ = SPACE$(4): GET #BinaryFileNum, , b$ b$ = SPACE$(CVL(b$)) GET #BinaryFileNum, , b$ - __UI_Captions(TempValue) = b$ + __UI_SetCaption RTRIM$(__UI_Controls(TempValue).Name), b$ IF LogFileLoad THEN PRINT #LogFileNum, "CAPTION:" + __UI_Captions(TempValue) CASE -3 'Text b$ = SPACE$(4): GET #BinaryFileNum, , b$ @@ -551,18 +602,15 @@ SUB LoadPreview FontSetup$ = SPACE$(CVI(b$)): GET #BinaryFileNum, , FontSetup$ IF LogFileLoad THEN PRINT #LogFileNum, FontSetup$ - FindSep = INSTR(FontSetup$, "\") - NewFontName = LEFT$(FontSetup$, FindSep - 1): FontSetup$ = MID$(FontSetup$, FindSep + 1) - - FindSep = INSTR(FontSetup$, "\") + FindSep = INSTR(FontSetup$, "*") NewFontFile = LEFT$(FontSetup$, FindSep - 1): FontSetup$ = MID$(FontSetup$, FindSep + 1) - FindSep = INSTR(FontSetup$, "\") - NewFontSize = VAL(LEFT$(FontSetup$, FindSep - 1)): FontSetup$ = MID$(FontSetup$, FindSep + 1) + FindSep = INSTR(FontSetup$, "*") + NewFontAttributes = LEFT$(FontSetup$, FindSep - 1): FontSetup$ = MID$(FontSetup$, FindSep + 1) - NewFontAttributes = FontSetup$ + NewFontSize = VAL(FontSetup$) - __UI_Controls(TempValue).Font = __UI_Font(NewFontName, NewFontFile, NewFontSize, NewFontAttributes) + __UI_Controls(TempValue).Font = __UI_Font(NewFontFile, NewFontSize, NewFontAttributes) CASE -6 'ForeColor b$ = SPACE$(4): GET #BinaryFileNum, , b$ __UI_Controls(TempValue).ForeColor = _CV(_UNSIGNED LONG, b$) @@ -707,13 +755,23 @@ SUB SavePreview b$ = MKI$(-1) + MKL$(i) + MKI$(__UI_Controls(i).Type) '-1 indicates a new control b$ = b$ + MKI$(LEN(RTRIM$(__UI_Controls(i).Name))) b$ = b$ + RTRIM$(__UI_Controls(i).Name) - b$ = b$ + MKI$(__UI_Controls(i).Width) + MKI$(__UI_Controls(i).Height) + MKI$(__UI_Controls(i).Left) + MKI$(__UI_Controls(i).Top) + MKI$(LEN(RTRIM$(__UI_Controls(__UI_Controls(i).ParentID).Name))) + RTRIM$(__UI_Controls(__UI_Controls(i).ParentID).Name) + b$ = b$ + MKI$(__UI_Controls(i).Width) + MKI$(__UI_Controls(i).Height) + MKI$(__UI_Controls(i).Left) + MKI$(__UI_Controls(i).Top) + IF __UI_Controls(i).ParentID > 0 THEN + b$ = b$ + MKI$(LEN(RTRIM$(__UI_Controls(__UI_Controls(i).ParentID).Name))) + RTRIM$(__UI_Controls(__UI_Controls(i).ParentID).Name) + ELSE + b$ = b$ + MKI$(0) + END IF PUT #BinFileNum, , b$ IF LEN(__UI_Captions(i)) > 0 THEN - b$ = MKI$(-2) + MKL$(LEN(__UI_Captions(i))) '-2 indicates a caption + IF __UI_Controls(i).HotKeyPosition > 0 THEN + a$ = LEFT$(__UI_Captions(i), __UI_Controls(i).HotKeyPosition - 1) + "&" + MID$(__UI_Captions(i), __UI_Controls(i).HotKeyPosition) + ELSE + a$ = __UI_Captions(i) + END IF + b$ = MKI$(-2) + MKL$(LEN(a$)) '-2 indicates a caption PUT #BinFileNum, , b$ - PUT #BinFileNum, , __UI_Captions(i) + PUT #BinFileNum, , a$ END IF IF LEN(__UI_Tips(i)) > 0 THEN @@ -740,12 +798,12 @@ SUB SavePreview IF __UI_Controls(i).Font = 8 OR __UI_Controls(i).Font = 16 THEN 'Internal fonts SaveInternalFont: - FontSetup$ = "VGA Emulated\\" + LTRIM$(STR$(__UI_Controls(__UI_GetFontID(__UI_Controls(i).Font)).Max)) + "\" + FontSetup$ = "**" + LTRIM$(STR$(__UI_Controls(__UI_GetFontID(__UI_Controls(i).Font)).Max)) b$ = MKI$(-5) + MKI$(LEN(FontSetup$)) + FontSetup$ PUT #BinFileNum, , b$ ELSE SaveExternalFont: - FontSetup$ = RTRIM$(__UI_Controls(__UI_GetFontID(__UI_Controls(i).Font)).Name) + "\" + __UI_Texts(__UI_GetFontID(__UI_Controls(i).Font)) + "\" + LTRIM$(STR$(__UI_Controls(__UI_GetFontID(__UI_Controls(i).Font)).Max)) + "\" + __UI_Captions(__UI_GetFontID(__UI_Controls(i).Font)) + FontSetup$ = __UI_Texts(__UI_GetFontID(__UI_Controls(i).Font)) + "*" + __UI_Captions(__UI_GetFontID(__UI_Controls(i).Font)) + "*" + LTRIM$(STR$(__UI_Controls(__UI_GetFontID(__UI_Controls(i).Font)).Max)) b$ = MKI$(-5) + MKI$(LEN(FontSetup$)) + FontSetup$ PUT #BinFileNum, , b$ END IF @@ -809,12 +867,12 @@ SUB SavePreview IF __UI_Controls(i).Max <> 0 THEN b$ = MKI$(-16) + _MK$(_FLOAT, __UI_Controls(i).Max): PUT #BinFileNum, , b$ END IF - IF __UI_Controls(i).HotKey <> 0 THEN - b$ = MKI$(-17) + MKI$(__UI_Controls(i).HotKey): PUT #BinFileNum, , b$ - END IF - IF __UI_Controls(i).HotKeyOffset <> 0 THEN - b$ = MKI$(-18) + MKI$(__UI_Controls(i).HotKeyOffset): PUT #BinFileNum, , b$ - END IF + 'IF __UI_Controls(i).HotKey <> 0 THEN + ' b$ = MKI$(-17) + MKI$(__UI_Controls(i).HotKey): PUT #BinFileNum, , b$ + 'END IF + 'IF __UI_Controls(i).HotKeyOffset <> 0 THEN + ' b$ = MKI$(-18) + MKI$(__UI_Controls(i).HotKeyOffset): PUT #BinFileNum, , b$ + 'END IF IF __UI_Controls(i).ShowPercentage THEN b$ = MKI$(-19): PUT #BinFileNum, , b$ END IF @@ -842,6 +900,9 @@ SUB SavePreview IF __UI_Controls(i).CanResize AND __UI_Controls(i).Type = __UI_Type_Form THEN b$ = MKI$(-29): PUT #BinFileNum, , b$ END IF + IF __UI_Controls(i).HotKey > 0 THEN + b$ = MKI$(-30) + MKI$(__UI_Controls(i).HotKeyPosition): PUT #BinFileNum, , b$ + END IF END IF NEXT b$ = MKI$(-1024): PUT #BinFileNum, , b$ 'end of file diff --git a/xp.uitheme b/xp.uitheme index e6a160e..e2120d0 100644 --- a/xp.uitheme +++ b/xp.uitheme @@ -9,6 +9,8 @@ SUB __UI_ThemeSetup 'Metrics __UI_ScrollbarWidth = 17 __UI_ScrollbarButtonHeight = 17 + __UI_MenuBarOffset = 8 + __UI_MenuItemOffset = 22 END SUB '--------------------------------------------------------------------------------- @@ -91,7 +93,7 @@ SUB __UI_DrawButton (This AS __UI_ControlTYPE, ControlState AS _BYTE) 'Does this button have a helper canvas (icon)? DIM IconRatio AS INTEGER, IconWidth AS INTEGER, IconHeight AS INTEGER - IF This.HelperCanvas < -1 THEN + IF This.HelperCanvas < -1 AND LEN(__UI_Texts(This.ID)) > 0 THEN IF LEN(TempCaption$) THEN 'Icon will be to the left of caption IconHeight = This.Height - 6 @@ -131,7 +133,7 @@ SUB __UI_DrawButton (This AS __UI_ControlTYPE, ControlState AS _BYTE) _PRINTSTRING ((IconWidth / 2) + (This.Width \ 2 - _PRINTWIDTH(TempCaption$) \ 2), ((This.Height \ 2) - _FONTHEIGHT \ 2) + 2), TempCaption$ 'Hot key: - IF This.HotKey > 0 AND __UI_ShowHotKeys AND NOT This.Disabled THEN + IF This.HotKey > 0 AND ((__UI_ShowHotKeys AND NOT This.Disabled) OR __UI_DesignMode) THEN LINE ((This.Width \ 2 - _PRINTWIDTH(TempCaption$) \ 2) + This.HotKeyOffset, ((This.Height \ 2) + _FONTHEIGHT \ 2) + 1)-STEP(_PRINTWIDTH(CHR$(This.HotKey)) - 1, 0), This.ForeColor END IF @@ -222,7 +224,7 @@ SUB __UI_DrawLabel (This AS __UI_ControlTYPE, ControlState AS _BYTE) LOOP 'Hot key: - IF This.HotKey > 0 AND __UI_ShowHotKeys AND NOT This.Disabled THEN + IF This.HotKey > 0 AND ((__UI_ShowHotKeys AND NOT This.Disabled) OR __UI_DesignMode) THEN LINE (CaptionLeftFirstLine + This.HotKeyOffset, CaptionIndent + _FONTHEIGHT + 2)-STEP(_PRINTWIDTH(CHR$(This.HotKey)) - 1, 0), This.ForeColor END IF ELSE @@ -240,7 +242,7 @@ SUB __UI_DrawLabel (This AS __UI_ControlTYPE, ControlState AS _BYTE) _PRINTSTRING (CaptionLeft, ((This.Height \ 2) - _FONTHEIGHT \ 2)), TempCaption$ 'Hot key: - IF This.HotKey > 0 AND __UI_ShowHotKeys AND NOT This.Disabled THEN + IF This.HotKey > 0 AND ((__UI_ShowHotKeys AND NOT This.Disabled) OR __UI_DesignMode) THEN LINE (CaptionLeftFirstLine + This.HotKeyOffset, ((This.Height \ 2) + (_FONTHEIGHT \ 2)))-STEP(_PRINTWIDTH(CHR$(This.HotKey)) - 1, 0), This.ForeColor END IF END IF @@ -319,7 +321,7 @@ SUB __UI_DrawRadioButton (This AS __UI_ControlTYPE, ControlState AS _BYTE) _PRINTSTRING (CaptionIndent, ((This.Height \ 2) - _FONTHEIGHT \ 2) + 1), TempCaption$ 'Hot key: - IF This.HotKey > 0 AND __UI_ShowHotKeys AND NOT This.Disabled THEN + IF This.HotKey > 0 AND ((__UI_ShowHotKeys AND NOT This.Disabled) OR __UI_DesignMode) THEN LINE (CaptionIndent + This.HotKeyOffset, ((This.Height \ 2) + _FONTHEIGHT \ 2))-STEP(_PRINTWIDTH(CHR$(This.HotKey)) - 1, 0), This.ForeColor END IF @@ -397,7 +399,7 @@ SUB __UI_DrawCheckBox (This AS __UI_ControlTYPE, ControlState AS _BYTE) _PRINTSTRING (CaptionIndent, ((This.Height \ 2) - _FONTHEIGHT \ 2) + 1), TempCaption$ 'Hot key: - IF This.HotKey > 0 AND __UI_ShowHotKeys AND NOT This.Disabled THEN + IF This.HotKey > 0 AND ((__UI_ShowHotKeys AND NOT This.Disabled) OR __UI_DesignMode) THEN LINE (CaptionIndent + This.HotKeyOffset, ((This.Height \ 2) + _FONTHEIGHT \ 2))-STEP(_PRINTWIDTH(CHR$(This.HotKey)) - 1, 0), This.ForeColor END IF @@ -591,9 +593,11 @@ SUB __UI_DrawTextBox (This AS __UI_ControlTYPE, ControlState, ss1 AS LONG, ss2 A IF This.Type = __UI_Type_TextBox THEN 'Make sure textboxes have fixed width fonts and a proper FieldArea property IF _FONTWIDTH((This.Font)) = 0 THEN - This.Font = __UI_Font(RTRIM$(__UI_Controls(__UI_GetFontID(This.Font)).Name), __UI_Texts(__UI_GetFontID(This.Font)), __UI_Controls(__UI_GetFontID(This.Font)).Max, "monospace") + This.Font = __UI_Font(__UI_Texts(__UI_GetFontID(This.Font)), __UI_Controls(__UI_GetFontID(This.Font)).Max, "monospace") END IF - This.FieldArea = This.Width \ _FONTWIDTH((This.Font)) - 1 + This.FieldArea = This.Width / _FONTWIDTH((This.Font)) - 1 + ELSE + EXIT SUB END IF IF This.ControlState <> ControlState OR _ @@ -1109,7 +1113,7 @@ SUB __UI_DrawFrame (This AS __UI_ControlTYPE) _PRINTSTRING (CaptionLeft, 0), TempCaption$ 'Hot key: - IF This.HotKey > 0 AND __UI_ShowHotKeys AND NOT This.Disabled THEN + IF This.HotKey > 0 AND ((__UI_ShowHotKeys AND NOT This.Disabled) OR __UI_DesignMode) THEN LINE (CaptionLeft + _PRINTWIDTH(" ") + This.HotKeyOffset, 0 + _FONTHEIGHT)-STEP(_PRINTWIDTH(CHR$(This.HotKey)) - 1, 0), This.ForeColor END IF END IF @@ -1152,9 +1156,6 @@ SUB __UI_DrawMenuBar (This AS __UI_ControlTYPE, ControlState AS _BYTE) _FONT (This.Font) '--- - DIM ItemOffset% - IF _PRINTWIDTH("W") <> _PRINTWIDTH("I") THEN ItemOffset% = _PRINTWIDTH("__") ELSE ItemOffset% = _PRINTWIDTH("__") - CLS , This.BackColor _PRINTMODE _KEEPBACKGROUND @@ -1176,10 +1177,10 @@ SUB __UI_DrawMenuBar (This AS __UI_ControlTYPE, ControlState AS _BYTE) COLOR c - _PRINTSTRING (ItemOffset%, ((This.Height \ 2) - _FONTHEIGHT \ 2)), TempCaption$ - IF This.HotKey > 0 AND (__UI_AltIsDown OR __UI_Controls(__UI_Focus).Type = __UI_Type_MenuBar) THEN + _PRINTSTRING (__UI_MenuBarOffset, ((This.Height \ 2) - _FONTHEIGHT \ 2)), TempCaption$ + IF This.HotKey > 0 AND ((__UI_AltIsDown OR __UI_Controls(__UI_Focus).Type = __UI_Type_MenuBar) OR __UI_DesignMode) THEN 'Has "hot-key" - LINE (ItemOffset% + This.HotKeyOffset, ((This.Height \ 2) + _FONTHEIGHT \ 2) - 1)-STEP(_PRINTWIDTH(CHR$(This.HotKey)) - 1, 0), c + LINE (__UI_MenuBarOffset + This.HotKeyOffset, ((This.Height \ 2) + _FONTHEIGHT \ 2) - 1)-STEP(_PRINTWIDTH(CHR$(This.HotKey)) - 1, 0), c END IF '--- @@ -1220,9 +1221,6 @@ SUB __UI_DrawMenuPanel (This AS __UI_ControlTYPE, ControlState AS _BYTE) _FONT (This.Font) '--- - DIM ItemOffset AS INTEGER - IF _PRINTWIDTH("W") <> _PRINTWIDTH("I") THEN ItemOffset = _PRINTWIDTH("____") ELSE ItemOffset = _PRINTWIDTH("__") - COLOR , _RGBA32(0, 0, 0, 0) CLS _PRINTMODE _KEEPBACKGROUND @@ -1259,16 +1257,25 @@ SUB __UI_DrawMenuPanel (This AS __UI_ControlTYPE, ControlState AS _BYTE) COLOR c - _PRINTSTRING (__UI_Controls(i).Left + ItemOffset, __UI_Controls(i).Top + __UI_Controls(i).Height \ 2 - _FONTHEIGHT \ 2), TempCaption$ + _PRINTSTRING (__UI_Controls(i).Left + __UI_MenuItemOffset, __UI_Controls(i).Top + __UI_Controls(i).Height \ 2 - _FONTHEIGHT \ 2), TempCaption$ IF __UI_Controls(i).HotKey > 0 THEN 'Has "hot-key" - LINE (__UI_Controls(i).Left + ItemOffset + __UI_Controls(i).HotKeyOffset, __UI_Controls(i).Top + __UI_Controls(i).Height \ 2 + _FONTHEIGHT \ 2 - 1)-STEP(_PRINTWIDTH(CHR$(__UI_Controls(i).HotKey)) - 1, 0), c + LINE (__UI_Controls(i).Left + __UI_MenuItemOffset + __UI_Controls(i).HotKeyOffset, __UI_Controls(i).Top + __UI_Controls(i).Height \ 2 + _FONTHEIGHT \ 2 - 1)-STEP(_PRINTWIDTH(CHR$(__UI_Controls(i).HotKey)) - 1, 0), c END IF IF __UI_Controls(i).Value = __UI_True THEN 'Checked menu item - _PUTIMAGE (ItemOffset \ 2 - CheckMarkWidth \ 2, __UI_Controls(i).Top + __UI_Controls(i).Height \ 2 - CheckMarkHeight \ 2), ControlImage, , (0, CheckMarkIndex * CheckMarkHeight - CheckMarkHeight)-STEP(6, 6) + _PUTIMAGE (__UI_MenuItemOffset \ 2 - CheckMarkWidth \ 2, __UI_Controls(i).Top + __UI_Controls(i).Height \ 2 - CheckMarkHeight \ 2), ControlImage, , (0, CheckMarkIndex * CheckMarkHeight - CheckMarkHeight)-STEP(6, 6) + ELSE + 'Does this menu item have a helper canvas (icon)? + DIM IconRatio AS INTEGER, IconWidth AS INTEGER, IconHeight AS INTEGER + IF __UI_Controls(i).HelperCanvas < -1 AND LEN(__UI_Texts(__UI_Controls(i).ID)) > 0 THEN + 'Icon will be to the left of caption + IconHeight = 16 + IconWidth = _WIDTH(__UI_Controls(i).HelperCanvas) * IconHeight / _HEIGHT(__UI_Controls(i).HelperCanvas) + _PUTIMAGE (3, __UI_Controls(i).Top + __UI_Controls(i).Height / 2 - IconHeight / 2)-STEP(IconWidth - 1, IconHeight - 1), __UI_Controls(i).HelperCanvas + END IF END IF IF HasSeparator THEN