mirror of
https://github.com/FellippeHeitor/InForm.git
synced 2024-05-12 06:50:12 +00:00
Update UiEditor to remember QB64-PE compiler path
This commit is contained in:
parent
4052343623
commit
e2ee59af0f
|
@ -218,23 +218,29 @@ $END IF
|
|||
|
||||
UiEditorTitle$ = "InForm Designer"
|
||||
|
||||
' Get the location of QB64-PE
|
||||
' First look in obvious places
|
||||
IF _FILEEXISTS("." + PathSep$ + QB64_EXE_NAME) THEN
|
||||
QB64_EXE_PATH = "." + PathSep$ + QB64_EXE_NAME
|
||||
ELSEIF _FILEEXISTS(".." + PathSep$ + QB64_EXE_NAME) THEN
|
||||
QB64_EXE_PATH = ".." + PathSep$ + QB64_EXE_NAME
|
||||
ELSEIF _FILEEXISTS(".." + PathSep$ + "QB64pe" + PathSep$ + QB64_EXE_NAME) THEN
|
||||
QB64_EXE_PATH = ".." + PathSep$ + "QB64pe" + PathSep$ + QB64_EXE_NAME
|
||||
ELSEIF _FILEEXISTS(".." + PathSep$ + "qb64pe" + PathSep$ + QB64_EXE_NAME) THEN
|
||||
QB64_EXE_PATH = ".." + PathSep$ + "qb64pe" + PathSep$ + QB64_EXE_NAME
|
||||
ELSE
|
||||
QB64_EXE_PATH = _SELECTFOLDERDIALOG$("Select QB64-PE directory:")
|
||||
IF _FILEEXISTS(QB64_EXE_PATH + PathSep$ + QB64_EXE_NAME) THEN
|
||||
QB64_EXE_PATH = QB64_EXE_PATH + PathSep$ + QB64_EXE_NAME
|
||||
QB64_EXE_PATH = ReadSetting("InForm/InForm.ini", "InForm Settings", "QB64PE path") ' read the compiler path name from the INI
|
||||
|
||||
IF NOT _FILEEXISTS(QB64_EXE_PATH) THEN ' if the compiler is missing then look for it in obvious places
|
||||
IF _FILEEXISTS("." + PathSep$ + QB64_EXE_NAME) THEN
|
||||
QB64_EXE_PATH = "." + PathSep$ + QB64_EXE_NAME
|
||||
ELSEIF _FILEEXISTS(".." + PathSep$ + QB64_EXE_NAME) THEN
|
||||
QB64_EXE_PATH = ".." + PathSep$ + QB64_EXE_NAME
|
||||
ELSEIF _FILEEXISTS(".." + PathSep$ + "QB64pe" + PathSep$ + QB64_EXE_NAME) THEN
|
||||
QB64_EXE_PATH = ".." + PathSep$ + "QB64pe" + PathSep$ + QB64_EXE_NAME
|
||||
ELSEIF _FILEEXISTS(".." + PathSep$ + "qb64pe" + PathSep$ + QB64_EXE_NAME) THEN
|
||||
QB64_EXE_PATH = ".." + PathSep$ + "qb64pe" + PathSep$ + QB64_EXE_NAME
|
||||
ELSE
|
||||
_MESSAGEBOX UiEditorTitle$, QB64_DISPLAY + " executable not found.", "error"
|
||||
SYSTEM 1
|
||||
QB64_EXE_PATH = _SELECTFOLDERDIALOG$("Select QB64-PE directory:")
|
||||
|
||||
IF _FILEEXISTS(QB64_EXE_PATH + PathSep$ + QB64_EXE_NAME) THEN
|
||||
QB64_EXE_PATH = QB64_EXE_PATH + PathSep$ + QB64_EXE_NAME
|
||||
ELSE
|
||||
_MESSAGEBOX UiEditorTitle$, QB64_DISPLAY + " executable not found.", "error"
|
||||
|
||||
SYSTEM 1
|
||||
END IF
|
||||
|
||||
WriteSetting "InForm/InForm.ini", "InForm Settings", "QB64PE path", QB64_EXE_PATH ' save the complete path name to the INI
|
||||
END IF
|
||||
END IF
|
||||
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
'INI Manager
|
||||
'Fellippe Heitor, 2017-2019 - fellippe@qb64.org - @fellippeheitor
|
||||
'Fellippe Heitor, 2017-2021 - fellippe@qb64.org - @fellippeheitor
|
||||
|
||||
'This file isn't required to be at the top of your programs,
|
||||
'unless you intend to use OPTION _EXPLICIT
|
||||
|
||||
'Global variables declaration
|
||||
DIM currentIniFileName$
|
||||
DIM currentIniFileName$, LoadedFiles$
|
||||
DIM currentIniFileLOF AS _UNSIGNED LONG
|
||||
DIM IniWholeFile$
|
||||
DIM IniSectionData$
|
||||
|
@ -18,4 +18,3 @@ DIM IniDisableAutoCommit
|
|||
DIM IniCODE
|
||||
DIM IniAllowBasicComments
|
||||
DIM IniForceReload
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
'INI Manager - Beta 4
|
||||
'Fellippe Heitor, 2017 - fellippe@qb64.org - @fellippeheitor
|
||||
'INI Manager v1.01
|
||||
'Fellippe Heitor, 2017-2021 - fellippe@qb64.org - @fellippeheitor
|
||||
|
||||
SUB IniSortSection (file$, __section$)
|
||||
SHARED IniCODE, IniLastKey$, IniWholeFile$
|
||||
|
@ -78,7 +78,8 @@ SUB IniDeleteKey (file$, __section$, __key$)
|
|||
SHARED IniLF$, IniWholeFile$, IniSectionData$
|
||||
SHARED IniLastSection$, IniLastKey$, IniNewFile$
|
||||
|
||||
DIM tempValue$, section$, key$
|
||||
DIM tempValue$
|
||||
DIM section$, key$
|
||||
DIM FoundLF AS _UNSIGNED LONG
|
||||
|
||||
IniCODE = 0
|
||||
|
@ -127,6 +128,7 @@ END SUB
|
|||
SUB IniCommit
|
||||
SHARED currentIniFileName$, IniWholeFile$, currentIniFileLOF AS _UNSIGNED LONG
|
||||
SHARED IniNewFile$, IniDisableAutoCommit, IniCODE
|
||||
SHARED LoadedFiles$
|
||||
|
||||
IF currentIniFileName$ = "" THEN IniCODE = 18: EXIT SUB
|
||||
|
||||
|
@ -134,8 +136,17 @@ SUB IniCommit
|
|||
currentIniFileLOF = LEN(IniNewFile$)
|
||||
|
||||
IF NOT IniDisableAutoCommit THEN
|
||||
DIM fileNum AS INTEGER
|
||||
fileNum = FREEFILE
|
||||
DIM fileNum AS INTEGER, findFile AS INTEGER
|
||||
|
||||
'search LoadedFiles$, so we use the same file handle every time
|
||||
findFile = INSTR(LoadedFiles$, "@" + currentIniFileName$ + "@")
|
||||
IF findFile = 0 THEN
|
||||
fileNum = FREEFILE
|
||||
LoadedFiles$ = LoadedFiles$ + "@" + MKI$(fileNum) + "@" + currentIniFileName$ + "@"
|
||||
ELSE
|
||||
fileNum = CVI(MID$(LoadedFiles$, findFile - 2, 2))
|
||||
CLOSE fileNum
|
||||
END IF
|
||||
|
||||
OPEN currentIniFileName$ FOR BINARY AS #fileNum
|
||||
|
||||
|
@ -146,7 +157,8 @@ SUB IniCommit
|
|||
END IF
|
||||
|
||||
PUT #fileNum, 1, IniNewFile$
|
||||
CLOSE #fileNum
|
||||
CLOSE #fileNum 'flush
|
||||
OPEN currentIniFileName$ FOR BINARY AS #fileNum 'keep open
|
||||
END IF
|
||||
END SUB
|
||||
|
||||
|
@ -495,12 +507,12 @@ SUB WriteSetting (file$, __section$, __key$, __value$)
|
|||
'add values to the end of the specified section$
|
||||
IniNewFile$ = LEFT$(IniWholeFile$, endSection - 1)
|
||||
IniNewFile$ = IniNewFile$ + key$ + "=" + value$ + IniLF$
|
||||
IF MID$(IniWholeFile$, endSection, 2) <> IniLF$ THEN IniNewFile$ = IniNewFile$ + IniLF$
|
||||
IF MID$(IniWholeFile$, endSection, LEN(IniLF$)) <> IniLF$ THEN IniNewFile$ = IniNewFile$ + IniLF$
|
||||
IniNewFile$ = IniNewFile$ + MID$(IniWholeFile$, endSection)
|
||||
ELSE
|
||||
'add values to the end of the file
|
||||
IniNewFile$ = IniWholeFile$
|
||||
IF RIGHT$(IniNewFile$, 2) = IniLF$ THEN
|
||||
IF RIGHT$(IniNewFile$, LEN(IniLF$)) = IniLF$ THEN
|
||||
IniNewFile$ = IniNewFile$ + key$ + "=" + value$
|
||||
ELSE
|
||||
IniNewFile$ = IniNewFile$ + IniLF$ + key$ + "=" + value$
|
||||
|
@ -516,9 +528,9 @@ SUB WriteSetting (file$, __section$, __key$, __value$)
|
|||
IniNewFile$ = IniWholeFile$
|
||||
IF section$ = "[]" THEN GOTO WriteAtTop
|
||||
|
||||
IF RIGHT$(IniNewFile$, 4) = IniLF$ + IniLF$ THEN
|
||||
IF RIGHT$(IniNewFile$, LEN(IniLF$) * 2) = IniLF$ + IniLF$ THEN
|
||||
IniNewFile$ = IniNewFile$ + section$ + IniLF$ + key$ + "=" + value$ + IniLF$
|
||||
ELSEIF RIGHT$(IniNewFile$, 2) = IniLF$ THEN
|
||||
ELSEIF RIGHT$(IniNewFile$, LEN(IniLF$)) = IniLF$ THEN
|
||||
IniNewFile$ = IniNewFile$ + IniLF$ + section$ + IniLF$ + key$ + "=" + value$ + IniLF$
|
||||
ELSE
|
||||
IniNewFile$ = IniNewFile$ + IniLF$ + IniLF$ + section$ + IniLF$ + key$ + "=" + value$ + IniLF$
|
||||
|
@ -553,6 +565,20 @@ END SUB
|
|||
|
||||
SUB IniClose
|
||||
SHARED IniDisableAutoCommit, currentIniFileName$
|
||||
SHARED LoadedFiles$
|
||||
DIM findFile AS INTEGER, fileNum AS INTEGER
|
||||
|
||||
IF currentIniFileName$ = "" THEN EXIT SUB
|
||||
|
||||
'search LoadedFiles$, so we use the same file handle every time
|
||||
findFile = INSTR(LoadedFiles$, "@" + currentIniFileName$ + "@")
|
||||
IF findFile = 0 THEN
|
||||
'not open; nothing to close
|
||||
EXIT SUB
|
||||
ELSE
|
||||
fileNum = CVI(MID$(LoadedFiles$, findFile - 2, 2))
|
||||
CLOSE fileNum
|
||||
END IF
|
||||
|
||||
IniDisableAutoCommit = 0
|
||||
IniCommit
|
||||
|
@ -564,8 +590,8 @@ SUB IniLoad (file$)
|
|||
SHARED IniCODE, currentIniFileName$, IniLF$, IniWholeFile$
|
||||
SHARED currentIniFileLOF AS _UNSIGNED LONG
|
||||
SHARED IniForceReload
|
||||
|
||||
DIM fileNum AS INTEGER
|
||||
SHARED LoadedFiles$
|
||||
DIM fileNum AS INTEGER, findFile AS INTEGER
|
||||
|
||||
'Error messages are returned with IniCODE
|
||||
'Error descriptions can be fetched with function IniINFO$
|
||||
|
@ -585,18 +611,24 @@ SUB IniLoad (file$)
|
|||
IF _FILEEXISTS(file$) THEN
|
||||
currentIniFileName$ = file$
|
||||
|
||||
'add to LoadedFiles$, so we use the same file handle every time
|
||||
findFile = INSTR(LoadedFiles$, "@" + file$ + "@")
|
||||
IF findFile = 0 THEN
|
||||
fileNum = FREEFILE
|
||||
LoadedFiles$ = LoadedFiles$ + "@" + MKI$(fileNum) + "@" + file$ + "@"
|
||||
ELSE
|
||||
fileNum = CVI(MID$(LoadedFiles$, findFile - 2, 2))
|
||||
END IF
|
||||
|
||||
'Load file into memory
|
||||
fileNum = FREEFILE
|
||||
CLOSE fileNum
|
||||
OPEN currentIniFileName$ FOR BINARY AS #fileNum
|
||||
currentIniFileLOF = LOF(fileNum)
|
||||
IniWholeFile$ = SPACE$(currentIniFileLOF)
|
||||
GET #fileNum, 1, IniWholeFile$
|
||||
CLOSE #fileNum
|
||||
|
||||
'Check if this ini file uses CRLF or LF
|
||||
IF INSTR(IniWholeFile$, CHR$(13)) THEN IniLF$ = CHR$(13) + CHR$(10) ELSE IniLF$ = CHR$(10)
|
||||
|
||||
'IF RIGHT$(IniWholeFile$, 2) <> IniLF$ THEN IniWholeFile$ = IniWholeFile$ + IniLF$
|
||||
ELSE
|
||||
IniFileNotFound:
|
||||
IniCODE = 1
|
||||
|
@ -637,14 +669,17 @@ FUNCTION IniNextKey$
|
|||
|
||||
tempKey$ = LTRIM$(RTRIM$(MID$(IniSectionData$ + tempLF$, position + 1, Equal - position - 1)))
|
||||
|
||||
IF INSTR(tempKey$, CHR$(10)) > 0 THEN tempKey$ = MID$(tempKey$, INSTR(tempKey$, CHR$(10)) + 1)
|
||||
IF INSTR(tempKey$, CHR$(10)) > 0 THEN
|
||||
position = position + INSTR(tempKey$, CHR$(10)) + 1
|
||||
tempKey$ = MID$(tempKey$, INSTR(tempKey$, CHR$(10)) + 1)
|
||||
END IF
|
||||
|
||||
DO WHILE LEFT$(tempKey$, LEN(IniLF$)) = IniLF$
|
||||
tempKey$ = MID$(tempKey$, LEN(IniLF$) + 1)
|
||||
position = position + LEN(IniLF$)
|
||||
LOOP
|
||||
|
||||
position = INSTR(position, IniSectionData$ + tempLF$, IniLF$) + 1
|
||||
position = INSTR(position + 1, IniSectionData$ + tempLF$, IniLF$)
|
||||
|
||||
IF LEFT$(tempKey$, 1) = ";" OR LEFT$(tempKey$, 1) = "'" OR INSTR(tempKey$, "[") > 0 OR INSTR(tempKey$, "]") > 0 OR INSTR(tempKey$, "=") > 0 THEN
|
||||
GOTO FindKey
|
||||
|
@ -754,4 +789,3 @@ FUNCTION IniArraySort%% (arr() AS STRING)
|
|||
'Returns -1 (true) if any changes were made
|
||||
IniArraySort%% = moves& > 0
|
||||
END FUNCTION
|
||||
|
||||
|
|
344
examples/PlayFX/InForm/InForm.bi
Normal file
344
examples/PlayFX/InForm/InForm.bi
Normal file
|
@ -0,0 +1,344 @@
|
|||
'InForm - GUI library for QB64
|
||||
'Fellippe Heitor, 2016-2019 - fellippe@qb64.org - @fellippeheitor
|
||||
'
|
||||
|
||||
$If VERSION < 3.8 Then
|
||||
$Error This requires the latest version of QB64-PE from https://github.com/QB64-Phoenix-Edition/QB64pe/releases
|
||||
$End If
|
||||
|
||||
DECLARE LIBRARY
|
||||
FUNCTION __UI_GetPID ALIAS getpid ()
|
||||
END DECLARE
|
||||
|
||||
DECLARE CUSTOMTYPE LIBRARY
|
||||
SUB __UI_MemCopy ALIAS memcpy (BYVAL dest AS _OFFSET, BYVAL source AS _OFFSET, BYVAL bytes AS LONG)
|
||||
END DECLARE
|
||||
|
||||
$IF WIN THEN
|
||||
DECLARE LIBRARY
|
||||
FUNCTION GetSystemMetrics& (BYVAL WhichMetric&)
|
||||
END DECLARE
|
||||
|
||||
CONST __UI_SM_SWAPBUTTON = 23
|
||||
$END IF
|
||||
|
||||
$SCREENHIDE
|
||||
_CONTROLCHR OFF
|
||||
|
||||
TYPE __UI_ControlTYPE
|
||||
ID AS LONG
|
||||
ParentID AS LONG
|
||||
PreviousParentID AS LONG
|
||||
ContextMenuID AS LONG
|
||||
Type AS INTEGER
|
||||
Name AS STRING * 40
|
||||
ParentName AS STRING * 40
|
||||
SubMenu AS _BYTE
|
||||
MenuPanelID AS LONG
|
||||
SourceControl AS LONG
|
||||
Top AS INTEGER
|
||||
Left AS INTEGER
|
||||
Width AS INTEGER
|
||||
Height AS INTEGER
|
||||
Canvas AS LONG
|
||||
HelperCanvas AS LONG
|
||||
TransparentColor AS _UNSIGNED LONG
|
||||
Stretch AS _BYTE
|
||||
PreviousStretch AS _BYTE
|
||||
Font AS INTEGER
|
||||
PreviousFont AS INTEGER
|
||||
BackColor AS _UNSIGNED LONG
|
||||
ForeColor AS _UNSIGNED LONG
|
||||
SelectedForeColor AS _UNSIGNED LONG
|
||||
SelectedBackColor AS _UNSIGNED LONG
|
||||
BackStyle AS _BYTE
|
||||
HasBorder AS _BYTE
|
||||
BorderSize AS INTEGER
|
||||
Padding AS INTEGER
|
||||
Encoding AS LONG
|
||||
Align AS _BYTE
|
||||
PrevAlign AS _BYTE
|
||||
VAlign AS _BYTE
|
||||
PrevVAlign AS _BYTE
|
||||
BorderColor AS _UNSIGNED LONG
|
||||
Value AS _FLOAT
|
||||
PreviousValue AS _FLOAT
|
||||
Min AS _FLOAT
|
||||
PrevMin AS _FLOAT
|
||||
Max AS _FLOAT
|
||||
PrevMax AS _FLOAT
|
||||
Interval AS _FLOAT
|
||||
PrevInterval AS _FLOAT
|
||||
MinInterval AS _FLOAT
|
||||
PrevMinInterval AS _FLOAT
|
||||
HotKey AS INTEGER
|
||||
HotKeyOffset AS INTEGER
|
||||
HotKeyPosition AS INTEGER
|
||||
ShowPercentage AS _BYTE
|
||||
AutoScroll AS _BYTE
|
||||
AutoSize AS _BYTE
|
||||
InputViewStart AS LONG
|
||||
PreviousInputViewStart AS LONG
|
||||
LastVisibleItem AS INTEGER
|
||||
ItemHeight AS INTEGER
|
||||
HasVScrollbar AS _BYTE
|
||||
VScrollbarButton2Top AS INTEGER
|
||||
HoveringVScrollbarButton AS _BYTE
|
||||
ThumbHeight AS INTEGER
|
||||
ThumbTop AS INTEGER
|
||||
VScrollbarRatio AS SINGLE
|
||||
Cursor AS LONG
|
||||
PasswordField AS _BYTE
|
||||
PrevCursor AS LONG
|
||||
FieldArea AS LONG
|
||||
PreviousFieldArea AS LONG
|
||||
TextIsSelected AS _BYTE
|
||||
BypassSelectOnFocus AS _BYTE
|
||||
Multiline AS _BYTE
|
||||
NumericOnly AS _BYTE
|
||||
FirstVisibleLine AS LONG
|
||||
PrevFirstVisibleLine AS LONG
|
||||
CurrentLine AS LONG
|
||||
PrevCurrentLine AS LONG
|
||||
VisibleCursor AS LONG
|
||||
PrevVisibleCursor AS LONG
|
||||
ControlIsSelected AS _BYTE
|
||||
LeftOffsetFromFirstSelected AS INTEGER
|
||||
TopOffsetFromFirstSelected AS INTEGER
|
||||
SelectionLength AS LONG
|
||||
SelectionStart AS LONG
|
||||
WordWrap AS _BYTE
|
||||
CanResize AS _BYTE
|
||||
CanHaveFocus AS _BYTE
|
||||
Disabled AS _BYTE
|
||||
Hidden AS _BYTE
|
||||
PreviouslyHidden AS _BYTE
|
||||
CenteredWindow AS _BYTE
|
||||
ControlState AS _BYTE
|
||||
ChildrenRedrawn AS _BYTE
|
||||
FocusState AS LONG
|
||||
LastChange AS SINGLE
|
||||
Redraw AS _BYTE
|
||||
BulletStyle AS _BYTE
|
||||
MenuItemGroup AS INTEGER
|
||||
KeyCombo AS LONG
|
||||
BoundTo AS LONG
|
||||
BoundProperty AS LONG
|
||||
END TYPE
|
||||
|
||||
TYPE __UI_Types
|
||||
Name AS STRING * 16
|
||||
Count AS LONG
|
||||
TurnsInto AS INTEGER
|
||||
DefaultHeight AS INTEGER
|
||||
MinimumHeight AS INTEGER
|
||||
DefaultWidth AS INTEGER
|
||||
MinimumWidth AS INTEGER
|
||||
RestrictResize AS _BYTE
|
||||
END TYPE
|
||||
|
||||
TYPE __UI_ThemeImagesType
|
||||
FileName AS STRING * 32
|
||||
Handle AS LONG
|
||||
END TYPE
|
||||
|
||||
TYPE __UI_WordWrapHistoryType
|
||||
StringSlot AS LONG
|
||||
Width AS INTEGER
|
||||
LongestLine AS INTEGER
|
||||
Font AS LONG
|
||||
TotalLines AS INTEGER
|
||||
END TYPE
|
||||
|
||||
TYPE __UI_KeyCombos
|
||||
Combo AS STRING * 14 ' "CTRL+SHIFT+F12"
|
||||
FriendlyCombo AS STRING * 14 ' "Ctrl+Shift+F12"
|
||||
ControlID AS LONG
|
||||
END TYPE
|
||||
|
||||
REDIM SHARED Caption(0 TO 100) AS STRING
|
||||
REDIM SHARED __UI_TempCaptions(0 TO 100) AS STRING
|
||||
REDIM SHARED Text(0 TO 100) AS STRING
|
||||
REDIM SHARED __UI_TempTexts(0 TO 100) AS STRING
|
||||
REDIM SHARED Mask(0 TO 100) AS STRING
|
||||
REDIM SHARED __UI_TempMask(0 TO 100) AS STRING
|
||||
REDIM SHARED ToolTip(0 TO 100) AS STRING
|
||||
REDIM SHARED __UI_TempTips(0 TO 100) AS STRING
|
||||
REDIM SHARED Control(0 TO 100) AS __UI_ControlTYPE
|
||||
REDIM SHARED ControlDrawOrder(0) AS LONG
|
||||
REDIM SHARED __UI_ThemeImages(0 TO 100) AS __UI_ThemeImagesType
|
||||
REDIM SHARED __UI_WordWrapHistoryTexts(0 TO 100) AS STRING
|
||||
REDIM SHARED __UI_WordWrapHistoryResults(0 TO 100) AS STRING
|
||||
REDIM SHARED __UI_WordWrapHistory(0 TO 100) AS __UI_WordWrapHistoryType
|
||||
REDIM SHARED __UI_ThisLineChars(0) AS LONG, __UI_FocusedTextBoxChars(0) AS LONG
|
||||
REDIM SHARED __UI_ActiveMenu(0 TO 100) AS LONG, __UI_ParentMenu(0 TO 100) AS LONG
|
||||
REDIM SHARED __UI_KeyCombo(0 TO 100) AS __UI_KeyCombos
|
||||
|
||||
DIM SHARED __UI_TotalKeyCombos AS LONG, __UI_BypassKeyCombos AS _BYTE
|
||||
DIM SHARED table1252$(0 TO 255), table437$(0 TO 255)
|
||||
DIM SHARED __UI_MouseLeft AS INTEGER, __UI_MouseTop AS INTEGER
|
||||
DIM SHARED __UI_MouseWheel AS INTEGER, __UI_MouseButtonsSwap AS _BYTE
|
||||
DIM SHARED __UI_PrevMouseLeft AS INTEGER, __UI_PrevMouseTop AS INTEGER
|
||||
DIM SHARED __UI_MouseButton1 AS _BYTE, __UI_MouseButton2 AS _BYTE
|
||||
DIM SHARED __UI_MouseIsDown AS _BYTE, __UI_MouseDownOnID AS LONG
|
||||
DIM SHARED __UI_Mouse2IsDown AS _BYTE, __UI_Mouse2DownOnID AS LONG
|
||||
DIM SHARED __UI_PreviousMouseDownOnID AS LONG
|
||||
DIM SHARED __UI_KeyIsDown AS _BYTE, __UI_KeyDownOnID AS LONG
|
||||
DIM SHARED __UI_ShiftIsDown AS _BYTE, __UI_CtrlIsDown AS _BYTE
|
||||
DIM SHARED __UI_AltIsDown AS _BYTE, __UI_ShowHotKeys AS _BYTE, __UI_AltCombo$
|
||||
DIM SHARED __UI_LastMouseClick AS SINGLE, __UI_MouseDownOnScrollbar AS SINGLE
|
||||
DIM SHARED __UI_DragX AS INTEGER, __UI_DragY AS INTEGER
|
||||
DIM SHARED __UI_DefaultButtonID AS LONG
|
||||
DIM SHARED __UI_KeyHit AS LONG, __UI_KeepFocus AS _BYTE
|
||||
DIM SHARED __UI_Focus AS LONG, __UI_PreviousFocus AS LONG, __UI_KeyboardFocus AS _BYTE
|
||||
DIM SHARED __UI_HoveringID AS LONG, __UI_LastHoveringID AS LONG, __UI_BelowHoveringID AS LONG
|
||||
DIM SHARED __UI_IsDragging AS _BYTE, __UI_DraggingID AS LONG
|
||||
DIM SHARED __UI_IsResizing AS _BYTE, __UI_ResizingID AS LONG
|
||||
DIM SHARED __UI_ResizeHandleHover AS _BYTE
|
||||
DIM SHARED __UI_IsSelectingText AS _BYTE, __UI_IsSelectingTextOnID AS LONG
|
||||
DIM SHARED __UI_SelectedText AS STRING, __UI_SelectionLength AS LONG
|
||||
DIM SHARED __UI_StateHasChanged AS _BYTE
|
||||
DIM SHARED __UI_DraggingThumb AS _BYTE, __UI_ThumbDragTop AS INTEGER
|
||||
DIM SHARED __UI_DraggingThumbOnID AS LONG
|
||||
DIM SHARED __UI_HasInput AS _BYTE, __UI_ProcessInputTimer AS SINGLE
|
||||
DIM SHARED __UI_UnloadSignal AS _BYTE, __UI_HasResized AS _BYTE
|
||||
DIM SHARED __UI_ExitTriggered AS _BYTE
|
||||
DIM SHARED __UI_Loaded AS _BYTE
|
||||
DIM SHARED __UI_EventsTimer AS INTEGER, __UI_RefreshTimer AS INTEGER
|
||||
DIM SHARED __UI_ActiveDropdownList AS LONG, __UI_ParentDropdownList AS LONG
|
||||
DIM SHARED __UI_TotalActiveMenus AS LONG, __UI_ActiveMenuIsContextMenu AS _BYTE
|
||||
DIM SHARED __UI_SubMenuDelay AS SINGLE, __UI_HoveringSubMenu AS _BYTE
|
||||
DIM SHARED __UI_TopMenuBarItem AS LONG
|
||||
DIM SHARED __UI_ActiveTipID AS LONG, __UI_TipTimer AS SINGLE, __UI_PreviousTipID AS LONG
|
||||
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, __UI_ScrollbarButtonHeight AS INTEGER
|
||||
DIM SHARED __UI_MenuBarOffset AS INTEGER, __UI_MenuItemOffset AS INTEGER
|
||||
DIM SHARED __UI_NewMenuBarTextLeft AS INTEGER, __UI_DefaultCaptionIndent AS INTEGER
|
||||
DIM SHARED __UI_ForceRedraw AS _BYTE, __UI_AutoRefresh AS _BYTE
|
||||
DIM SHARED __UI_CurrentTitle AS STRING
|
||||
DIM SHARED __UI_DesignMode AS _BYTE, __UI_FirstSelectedID AS LONG
|
||||
DIM SHARED __UI_WaitMessage AS STRING, __UI_TotalSelectedControls AS LONG
|
||||
DIM SHARED __UI_WaitMessageHandle AS LONG, __UI_EditorMode AS _BYTE
|
||||
DIM SHARED __UI_LastRenderedCharCount AS LONG
|
||||
DIM SHARED __UI_SelectionRectangleTop AS INTEGER, __UI_SelectionRectangleLeft AS INTEGER
|
||||
DIM SHARED __UI_SelectionRectangle AS _BYTE
|
||||
DIM SHARED __UI_CantShowContextMenu AS _BYTE, __UI_ShowPositionAndSize AS _BYTE
|
||||
DIM SHARED __UI_ShowInvisibleControls AS _BYTE, __UI_Snapped AS _BYTE
|
||||
DIM SHARED __UI_SnappedByProximityX AS _BYTE, __UI_SnappedByProximityY AS _BYTE
|
||||
DIM SHARED __UI_SnappedX AS INTEGER, __UI_SnappedY AS INTEGER
|
||||
DIM SHARED __UI_SnappedXID AS LONG, __UI_SnappedYID AS LONG
|
||||
DIM SHARED __UI_SnapLines AS _BYTE, __UI_SnapDistance AS INTEGER, __UI_SnapDistanceFromForm AS INTEGER
|
||||
DIM SHARED __UI_FrameRate AS SINGLE, __UI_Font8Offset AS INTEGER, __UI_Font16Offset AS INTEGER
|
||||
DIM SHARED __UI_ClipboardCheck$, __UI_MenuBarOffsetV AS INTEGER
|
||||
DIM SHARED __UI_KeepScreenHidden AS _BYTE, __UI_MaxBorderSize AS INTEGER
|
||||
DIM SHARED __UI_InternalContextMenus AS LONG, __UI_DidClick AS _BYTE
|
||||
DIM SHARED __UI_ContextMenuSourceID AS LONG
|
||||
DIM SHARED __UI_FKey(1 TO 12) AS LONG
|
||||
|
||||
'Control types: -----------------------------------------------
|
||||
DIM SHARED __UI_Type(0 TO 18) AS __UI_Types
|
||||
__UI_Type(__UI_Type_Form).Name = "Form"
|
||||
|
||||
__UI_Type(__UI_Type_Frame).Name = "Frame"
|
||||
__UI_Type(__UI_Type_Frame).DefaultWidth = 230
|
||||
__UI_Type(__UI_Type_Frame).DefaultHeight = 150
|
||||
|
||||
__UI_Type(__UI_Type_Button).Name = "Button"
|
||||
__UI_Type(__UI_Type_Button).DefaultWidth = 80
|
||||
__UI_Type(__UI_Type_Button).DefaultHeight = 23
|
||||
|
||||
__UI_Type(__UI_Type_Label).Name = "Label"
|
||||
__UI_Type(__UI_Type_Label).DefaultWidth = 150
|
||||
__UI_Type(__UI_Type_Label).DefaultHeight = 23
|
||||
|
||||
__UI_Type(__UI_Type_CheckBox).Name = "CheckBox"
|
||||
__UI_Type(__UI_Type_CheckBox).DefaultWidth = 150
|
||||
__UI_Type(__UI_Type_CheckBox).DefaultHeight = 23
|
||||
__UI_Type(__UI_Type_CheckBox).TurnsInto = __UI_Type_ToggleSwitch
|
||||
|
||||
__UI_Type(__UI_Type_RadioButton).Name = "RadioButton"
|
||||
__UI_Type(__UI_Type_RadioButton).DefaultWidth = 150
|
||||
__UI_Type(__UI_Type_RadioButton).DefaultHeight = 23
|
||||
|
||||
__UI_Type(__UI_Type_TextBox).Name = "TextBox"
|
||||
__UI_Type(__UI_Type_TextBox).DefaultWidth = 120
|
||||
__UI_Type(__UI_Type_TextBox).DefaultHeight = 23
|
||||
|
||||
__UI_Type(__UI_Type_ProgressBar).Name = "ProgressBar"
|
||||
__UI_Type(__UI_Type_ProgressBar).DefaultWidth = 300
|
||||
__UI_Type(__UI_Type_ProgressBar).DefaultHeight = 23
|
||||
|
||||
__UI_Type(__UI_Type_ListBox).Name = "ListBox"
|
||||
__UI_Type(__UI_Type_ListBox).DefaultWidth = 200
|
||||
__UI_Type(__UI_Type_ListBox).DefaultHeight = 200
|
||||
__UI_Type(__UI_Type_ListBox).TurnsInto = __UI_Type_DropdownList
|
||||
|
||||
__UI_Type(__UI_Type_DropdownList).Name = "DropdownList"
|
||||
__UI_Type(__UI_Type_DropdownList).DefaultWidth = 200
|
||||
__UI_Type(__UI_Type_DropdownList).DefaultHeight = 23
|
||||
__UI_Type(__UI_Type_DropdownList).TurnsInto = __UI_Type_ListBox
|
||||
|
||||
__UI_Type(__UI_Type_MenuBar).Name = "MenuBar"
|
||||
__UI_Type(__UI_Type_MenuBar).TurnsInto = __UI_Type_ContextMenu
|
||||
__UI_Type(__UI_Type_MenuBar).RestrictResize = __UI_CantResizeV
|
||||
|
||||
__UI_Type(__UI_Type_MenuItem).Name = "MenuItem"
|
||||
__UI_Type(__UI_Type_MenuItem).RestrictResize = __UI_CantResizeV
|
||||
|
||||
__UI_Type(__UI_Type_MenuPanel).Name = "MenuPanel"
|
||||
|
||||
__UI_Type(__UI_Type_PictureBox).Name = "PictureBox"
|
||||
__UI_Type(__UI_Type_PictureBox).DefaultWidth = 230
|
||||
__UI_Type(__UI_Type_PictureBox).DefaultHeight = 150
|
||||
|
||||
__UI_Type(__UI_Type_TrackBar).Name = "TrackBar"
|
||||
__UI_Type(__UI_Type_TrackBar).DefaultWidth = 300
|
||||
__UI_Type(__UI_Type_TrackBar).DefaultHeight = 40
|
||||
__UI_Type(__UI_Type_TrackBar).MinimumHeight = 30
|
||||
__UI_Type(__UI_Type_TrackBar).RestrictResize = __UI_CantResizeV
|
||||
|
||||
__UI_Type(__UI_Type_ContextMenu).Name = "ContextMenu"
|
||||
__UI_Type(__UI_Type_ContextMenu).TurnsInto = __UI_Type_MenuBar
|
||||
__UI_Type(__UI_Type_ContextMenu).RestrictResize = __UI_CantResize
|
||||
__UI_Type(__UI_Type_ContextMenu).DefaultWidth = 22
|
||||
__UI_Type(__UI_Type_ContextMenu).DefaultHeight = 22
|
||||
|
||||
__UI_Type(__UI_Type_Font).Name = "Font"
|
||||
|
||||
__UI_Type(__UI_Type_ToggleSwitch).Name = "ToggleSwitch"
|
||||
__UI_Type(__UI_Type_ToggleSwitch).DefaultWidth = 40
|
||||
__UI_Type(__UI_Type_ToggleSwitch).DefaultHeight = 17
|
||||
__UI_Type(__UI_Type_ToggleSwitch).TurnsInto = __UI_Type_CheckBox
|
||||
__UI_Type(__UI_Type_ToggleSwitch).RestrictResize = __UI_CantResize
|
||||
'--------------------------------------------------------------
|
||||
|
||||
__UI_RestoreFKeys
|
||||
|
||||
CONST False = 0, True = Not False
|
||||
|
||||
'$INCLUDE:'InFormVersion.bas'
|
||||
__UI_SubMenuDelay = .4
|
||||
__UI_SnapDistance = 5
|
||||
__UI_SnapDistanceFromForm = 10
|
||||
__UI_MaxBorderSize = 10
|
||||
__UI_Font8Offset = 5
|
||||
__UI_Font16Offset = 3
|
||||
__UI_ClipboardCheck$ = "InForm" + STRING$(2, 10) + "BEGIN CONTROL DATA" + CHR$(10) + STRING$(60, 45) + CHR$(10)
|
||||
|
||||
__UI_ThemeSetup
|
||||
__UI_InternalMenus
|
||||
__UI_LoadForm
|
||||
|
||||
__UI_Init
|
||||
|
||||
'Main loop
|
||||
DO
|
||||
_LIMIT 1
|
||||
LOOP
|
||||
|
||||
SYSTEM
|
||||
|
||||
__UI_ErrorHandler:
|
||||
RESUME NEXT
|
||||
|
8697
examples/PlayFX/InForm/InForm.ui
Normal file
8697
examples/PlayFX/InForm/InForm.ui
Normal file
File diff suppressed because it is too large
Load diff
7
examples/PlayFX/InForm/InFormVersion.bas
Normal file
7
examples/PlayFX/InForm/InFormVersion.bas
Normal file
|
@ -0,0 +1,7 @@
|
|||
'Starting with v1.0, __UI_VersionNumber is actually the current build.
|
||||
|
||||
CONST __UI_Version = "v1.5"
|
||||
CONST __UI_VersionNumber = 1
|
||||
CONST __UI_VersionIsBeta = 1
|
||||
CONST __UI_CopyrightSpan = "2016-2023"
|
||||
|
1144
examples/PlayFX/InForm/xp.uitheme
Normal file
1144
examples/PlayFX/InForm/xp.uitheme
Normal file
File diff suppressed because it is too large
Load diff
609
examples/PlayFX/PlayFX.bas
Normal file
609
examples/PlayFX/PlayFX.bas
Normal file
|
@ -0,0 +1,609 @@
|
|||
': This program uses
|
||||
': InForm - GUI library for QB64 - v1.5
|
||||
': Fellippe Heitor, 2016-2023 - fellippe@qb64.org - @fellippeheitor
|
||||
': https://github.com/FellippeHeitor/InForm
|
||||
'-----------------------------------------------------------
|
||||
|
||||
Option _Explicit
|
||||
|
||||
Type WaveformType
|
||||
active As Long
|
||||
waveform As Long
|
||||
note As Long
|
||||
length As Long
|
||||
lengthType As Long
|
||||
tempo As Long
|
||||
volume As Long
|
||||
volRamp As Long
|
||||
End Type
|
||||
|
||||
Dim Shared Waveform(1 To 5) As WaveformType, currentWaveform As Long, currentControl As Long
|
||||
|
||||
': Controls' IDs: ------------------------------------------------------------------
|
||||
Dim Shared PlayFXDesigner As Long
|
||||
Dim Shared Waveforms As Long
|
||||
Dim Shared ConfigureWaveform As Long
|
||||
Dim Shared PlayFX As Long
|
||||
Dim Shared Waveform1TB As Long
|
||||
Dim Shared Waveform2TB As Long
|
||||
Dim Shared Waveform3TB As Long
|
||||
Dim Shared Waveform4TB As Long
|
||||
Dim Shared Waveform5TB As Long
|
||||
Dim Shared WaveformLB As Long
|
||||
Dim Shared WaveformSlider As Long
|
||||
Dim Shared WaveformNameLB As Long
|
||||
Dim Shared NoteLB As Long
|
||||
Dim Shared NoteSlider As Long
|
||||
Dim Shared LengthLB As Long
|
||||
Dim Shared LengthSlider As Long
|
||||
Dim Shared LengthEffectsDL As Long
|
||||
Dim Shared TempoLB As Long
|
||||
Dim Shared TempoSlider As Long
|
||||
Dim Shared VolumeLB As Long
|
||||
Dim Shared VolumeSlider As Long
|
||||
Dim Shared VolRampLB As Long
|
||||
Dim Shared VolRampSlider As Long
|
||||
Dim Shared PlayFXTB As Long
|
||||
Dim Shared PlayBT As Long
|
||||
|
||||
': External modules: ---------------------------------------------------------------
|
||||
'$INCLUDE:'InForm\InForm.bi'
|
||||
'$INCLUDE:'InForm\xp.uitheme'
|
||||
'$INCLUDE:'PlayFX.frm'
|
||||
|
||||
': Custom procedures: --------------------------------------------------------------
|
||||
Function IsDifferentWaveform%% (w1 As WaveformType, w2 As WaveformType)
|
||||
IsDifferentWaveform = w1.waveform <> w2.waveform Or w1.note <> w2.note Or w1.length <> w2.length Or w1.lengthType <> w2.lengthType Or w1.tempo <> w2.tempo Or w1.volume <> w2.volume Or w1.volRamp <> w2.volRamp
|
||||
End Function
|
||||
|
||||
Sub SetConfigControls (id As Long, curCtrl As Long)
|
||||
Control(WaveformSlider).Value = Waveform(id).waveform
|
||||
Control(NoteSlider).Value = Waveform(id).note
|
||||
Control(LengthSlider).Value = Waveform(id).length
|
||||
Control(LengthEffectsDL).Value = Waveform(id).lengthType
|
||||
Control(TempoSlider).Value = Waveform(id).tempo
|
||||
Control(VolumeSlider).Value = Waveform(id).volume
|
||||
Control(VolRampSlider).Value = Waveform(id).volRamp
|
||||
|
||||
currentWaveform = id
|
||||
currentControl = curCtrl
|
||||
End Sub
|
||||
|
||||
Sub ClearWaveform (id As Long)
|
||||
Waveform(id).active = False ' set not in use
|
||||
Waveform(id).waveform = 3 ' triangle
|
||||
Waveform(id).note = 42 ' half-way through the scale
|
||||
Waveform(id).length = 4 ' quarter
|
||||
Waveform(id).lengthType = 1 ' normal
|
||||
Waveform(id).tempo = 120 ' 120
|
||||
Waveform(id).volume = 100 ' max
|
||||
Waveform(id).volRamp = 10 ' 10 ms
|
||||
End Sub
|
||||
|
||||
Sub MakePlayString
|
||||
Dim s As String
|
||||
|
||||
If Waveform(currentWaveform).active Then
|
||||
s = "T" + LTrim$(Str$(Waveform(currentWaveform).tempo)) + "L" + LTrim$(Str$(Waveform(currentWaveform).length))
|
||||
|
||||
Select Case Waveform(currentWaveform).lengthType
|
||||
Case 1
|
||||
s = s + "MN"
|
||||
|
||||
Case 2
|
||||
s = s + "ML"
|
||||
|
||||
Case 3
|
||||
s = s + "MS"
|
||||
End Select
|
||||
|
||||
s = s + "V" + LTrim$(Str$(Waveform(currentWaveform).volume)) + "Q" + LTrim$(Str$(Waveform(currentWaveform).volRamp))
|
||||
s = s + "@" + LTrim$(Str$(Waveform(currentWaveform).waveform)) + "N" + LTrim$(Str$(Waveform(currentWaveform).note))
|
||||
End If
|
||||
|
||||
Text(currentControl) = s
|
||||
End Sub
|
||||
|
||||
Sub MakePlayFXString
|
||||
Text(PlayFXTB) = "MB"
|
||||
|
||||
If Text(Waveform1TB) <> "" Then
|
||||
Text(PlayFXTB) = Text(PlayFXTB) + Text(Waveform1TB)
|
||||
End If
|
||||
|
||||
If Text(Waveform2TB) <> "" Then
|
||||
Text(PlayFXTB) = Text(PlayFXTB) + "," + Text(Waveform2TB)
|
||||
End If
|
||||
|
||||
If Text(Waveform3TB) <> "" Then
|
||||
Text(PlayFXTB) = Text(PlayFXTB) + "," + Text(Waveform3TB)
|
||||
End If
|
||||
|
||||
If Text(Waveform4TB) <> "" Then
|
||||
Text(PlayFXTB) = Text(PlayFXTB) + "," + Text(Waveform4TB)
|
||||
End If
|
||||
|
||||
If Text(Waveform5TB) <> "" Then
|
||||
Text(PlayFXTB) = Text(PlayFXTB) + "," + Text(Waveform5TB)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
': Event procedures: ---------------------------------------------------------------
|
||||
Sub __UI_BeforeInit
|
||||
|
||||
End Sub
|
||||
|
||||
Sub __UI_OnLoad
|
||||
Dim i As Long
|
||||
For i = 1 To 5
|
||||
ClearWaveform i
|
||||
Next
|
||||
|
||||
SetConfigControls 1, Waveform1TB
|
||||
SetFocus Waveform1TB
|
||||
End Sub
|
||||
|
||||
Sub __UI_BeforeUpdateDisplay
|
||||
'This event occurs at approximately 60 frames per second.
|
||||
'You can change the update frequency by calling SetFrameRate DesiredRate%
|
||||
|
||||
End Sub
|
||||
|
||||
Sub __UI_BeforeUnload
|
||||
'If you set __UI_UnloadSignal = False here you can
|
||||
'cancel the user's request to close.
|
||||
|
||||
End Sub
|
||||
|
||||
Sub __UI_Click (id As Long)
|
||||
Select Case id
|
||||
Case PlayFX
|
||||
|
||||
Case PlayFXTB
|
||||
|
||||
Case PlayBT
|
||||
Play Text(PlayFXTB)
|
||||
|
||||
Case WaveformSlider
|
||||
|
||||
Case WaveformNameLB
|
||||
|
||||
Case NoteSlider
|
||||
|
||||
Case LengthSlider
|
||||
|
||||
Case LengthEffectsDL
|
||||
|
||||
Case TempoSlider
|
||||
|
||||
Case VolumeSlider
|
||||
|
||||
Case NoteLB
|
||||
|
||||
Case LengthLB
|
||||
|
||||
Case TempoLB
|
||||
|
||||
Case VolumeLB
|
||||
|
||||
Case WaveformLB
|
||||
|
||||
Case PlayFXDesigner
|
||||
|
||||
Case Waveforms
|
||||
|
||||
Case Waveform1TB
|
||||
|
||||
Case Waveform2TB
|
||||
|
||||
Case Waveform3TB
|
||||
|
||||
Case Waveform4TB
|
||||
|
||||
Case Waveform5TB
|
||||
|
||||
Case ConfigureWaveform
|
||||
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
Sub __UI_MouseEnter (id As Long)
|
||||
Select Case id
|
||||
Case PlayFX
|
||||
|
||||
Case PlayFXTB
|
||||
|
||||
Case PlayBT
|
||||
|
||||
Case WaveformSlider
|
||||
|
||||
Case WaveformNameLB
|
||||
|
||||
Case NoteSlider
|
||||
|
||||
Case LengthSlider
|
||||
|
||||
Case LengthEffectsDL
|
||||
|
||||
Case TempoSlider
|
||||
|
||||
Case VolumeSlider
|
||||
|
||||
Case NoteLB
|
||||
|
||||
Case LengthLB
|
||||
|
||||
Case TempoLB
|
||||
|
||||
Case VolumeLB
|
||||
|
||||
Case WaveformLB
|
||||
|
||||
Case PlayFXDesigner
|
||||
|
||||
Case Waveforms
|
||||
|
||||
Case Waveform1TB
|
||||
|
||||
Case Waveform2TB
|
||||
|
||||
Case Waveform3TB
|
||||
|
||||
Case Waveform4TB
|
||||
|
||||
Case Waveform5TB
|
||||
|
||||
Case ConfigureWaveform
|
||||
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
Sub __UI_MouseLeave (id As Long)
|
||||
Select Case id
|
||||
Case PlayFX
|
||||
|
||||
Case PlayFXTB
|
||||
|
||||
Case PlayBT
|
||||
|
||||
Case WaveformSlider
|
||||
|
||||
Case WaveformNameLB
|
||||
|
||||
Case NoteSlider
|
||||
|
||||
Case LengthSlider
|
||||
|
||||
Case LengthEffectsDL
|
||||
|
||||
Case TempoSlider
|
||||
|
||||
Case VolumeSlider
|
||||
|
||||
Case NoteLB
|
||||
|
||||
Case LengthLB
|
||||
|
||||
Case TempoLB
|
||||
|
||||
Case VolumeLB
|
||||
|
||||
Case WaveformLB
|
||||
|
||||
Case PlayFXDesigner
|
||||
|
||||
Case Waveforms
|
||||
|
||||
Case Waveform1TB
|
||||
|
||||
Case Waveform2TB
|
||||
|
||||
Case Waveform3TB
|
||||
|
||||
Case Waveform4TB
|
||||
|
||||
Case Waveform5TB
|
||||
|
||||
Case ConfigureWaveform
|
||||
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
Sub __UI_FocusIn (id As Long)
|
||||
Select Case id
|
||||
Case PlayFXTB
|
||||
|
||||
Case PlayBT
|
||||
|
||||
Case WaveformSlider
|
||||
|
||||
Case NoteSlider
|
||||
|
||||
Case LengthSlider
|
||||
|
||||
Case LengthEffectsDL
|
||||
|
||||
Case TempoSlider
|
||||
|
||||
Case VolumeSlider
|
||||
|
||||
Case Waveform1TB
|
||||
SetConfigControls 1, Waveform1TB
|
||||
|
||||
Case Waveform2TB
|
||||
SetConfigControls 2, Waveform2TB
|
||||
|
||||
Case Waveform3TB
|
||||
SetConfigControls 3, Waveform3TB
|
||||
|
||||
Case Waveform4TB
|
||||
SetConfigControls 4, Waveform4TB
|
||||
|
||||
Case Waveform5TB
|
||||
SetConfigControls 5, Waveform5TB
|
||||
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
Sub __UI_FocusOut (id As Long)
|
||||
'This event occurs right before a control loses focus.
|
||||
'To prevent a control from losing focus, set __UI_KeepFocus = True below.
|
||||
Select Case id
|
||||
Case PlayFXTB
|
||||
|
||||
Case PlayBT
|
||||
|
||||
Case WaveformSlider
|
||||
|
||||
Case NoteSlider
|
||||
|
||||
Case LengthSlider
|
||||
|
||||
Case LengthEffectsDL
|
||||
|
||||
Case TempoSlider
|
||||
|
||||
Case VolumeSlider
|
||||
|
||||
Case Waveform1TB
|
||||
|
||||
Case Waveform2TB
|
||||
|
||||
Case Waveform3TB
|
||||
|
||||
Case Waveform4TB
|
||||
|
||||
Case Waveform5TB
|
||||
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
Sub __UI_MouseDown (id As Long)
|
||||
Select Case id
|
||||
Case PlayFX
|
||||
|
||||
Case PlayFXTB
|
||||
|
||||
Case PlayBT
|
||||
|
||||
Case WaveformSlider
|
||||
|
||||
Case WaveformNameLB
|
||||
|
||||
Case NoteSlider
|
||||
|
||||
Case LengthSlider
|
||||
|
||||
Case LengthEffectsDL
|
||||
|
||||
Case TempoSlider
|
||||
|
||||
Case VolumeSlider
|
||||
|
||||
Case NoteLB
|
||||
|
||||
Case LengthLB
|
||||
|
||||
Case TempoLB
|
||||
|
||||
Case VolumeLB
|
||||
|
||||
Case WaveformLB
|
||||
|
||||
Case PlayFXDesigner
|
||||
|
||||
Case Waveforms
|
||||
|
||||
Case Waveform1TB
|
||||
|
||||
Case Waveform2TB
|
||||
|
||||
Case Waveform3TB
|
||||
|
||||
Case Waveform4TB
|
||||
|
||||
Case Waveform5TB
|
||||
|
||||
Case ConfigureWaveform
|
||||
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
Sub __UI_MouseUp (id As Long)
|
||||
Select Case id
|
||||
Case PlayFX
|
||||
|
||||
Case PlayFXTB
|
||||
|
||||
Case PlayBT
|
||||
|
||||
Case WaveformSlider
|
||||
|
||||
Case WaveformNameLB
|
||||
|
||||
Case NoteSlider
|
||||
|
||||
Case LengthSlider
|
||||
|
||||
Case LengthEffectsDL
|
||||
|
||||
Case TempoSlider
|
||||
|
||||
Case VolumeSlider
|
||||
|
||||
Case NoteLB
|
||||
|
||||
Case LengthLB
|
||||
|
||||
Case TempoLB
|
||||
|
||||
Case VolumeLB
|
||||
|
||||
Case WaveformLB
|
||||
|
||||
Case PlayFXDesigner
|
||||
|
||||
Case Waveforms
|
||||
|
||||
Case Waveform1TB
|
||||
|
||||
Case Waveform2TB
|
||||
|
||||
Case Waveform3TB
|
||||
|
||||
Case Waveform4TB
|
||||
|
||||
Case Waveform5TB
|
||||
|
||||
Case ConfigureWaveform
|
||||
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
Sub __UI_KeyPress (id As Long)
|
||||
'When this event is fired, __UI_KeyHit will contain the code of the key hit.
|
||||
'You can change it and even cancel it by making it = 0
|
||||
Select Case id
|
||||
Case PlayFXTB
|
||||
|
||||
Case PlayBT
|
||||
|
||||
Case WaveformSlider
|
||||
|
||||
Case NoteSlider
|
||||
|
||||
Case LengthSlider
|
||||
|
||||
Case LengthEffectsDL
|
||||
|
||||
Case TempoSlider
|
||||
|
||||
Case VolumeSlider
|
||||
|
||||
Case Waveform1TB
|
||||
|
||||
Case Waveform2TB
|
||||
|
||||
Case Waveform3TB
|
||||
|
||||
Case Waveform4TB
|
||||
|
||||
Case Waveform5TB
|
||||
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
Sub __UI_TextChanged (id As Long)
|
||||
Select Case id
|
||||
Case PlayFXTB
|
||||
|
||||
Case Waveform1TB
|
||||
If Text(id) = "" Then
|
||||
ClearWaveform 1
|
||||
SetConfigControls 1, Waveform1TB
|
||||
End If
|
||||
|
||||
Case Waveform2TB
|
||||
If Text(id) = "" Then
|
||||
ClearWaveform 2
|
||||
SetConfigControls 2, Waveform2TB
|
||||
End If
|
||||
|
||||
Case Waveform3TB
|
||||
If Text(id) = "" Then
|
||||
ClearWaveform 3
|
||||
SetConfigControls 3, Waveform3TB
|
||||
End If
|
||||
|
||||
Case Waveform4TB
|
||||
If Text(id) = "" Then
|
||||
ClearWaveform 4
|
||||
SetConfigControls 4, Waveform4TB
|
||||
End If
|
||||
|
||||
Case Waveform5TB
|
||||
If Text(id) = "" Then
|
||||
ClearWaveform 5
|
||||
SetConfigControls 5, Waveform5TB
|
||||
End If
|
||||
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
Sub __UI_ValueChanged (id As Long)
|
||||
Select Case id
|
||||
Case WaveformSlider
|
||||
Select Case Control(id).Value
|
||||
Case 1
|
||||
SetCaption WaveformNameLB, "Square"
|
||||
|
||||
Case 2
|
||||
SetCaption WaveformNameLB, "Sawtooth"
|
||||
|
||||
Case 3
|
||||
SetCaption WaveformNameLB, "Triangle"
|
||||
|
||||
Case 4
|
||||
SetCaption WaveformNameLB, "Sine"
|
||||
|
||||
Case 5
|
||||
SetCaption WaveformNameLB, "Noise"
|
||||
End Select
|
||||
|
||||
Case NoteSlider
|
||||
|
||||
Case LengthSlider
|
||||
|
||||
Case LengthEffectsDL
|
||||
|
||||
Case TempoSlider
|
||||
|
||||
Case VolumeSlider
|
||||
|
||||
Case VolRampSlider
|
||||
|
||||
End Select
|
||||
|
||||
Dim temp As WaveformType
|
||||
temp.waveform = Control(WaveformSlider).Value
|
||||
temp.note = Control(NoteSlider).Value
|
||||
temp.length = Control(LengthSlider).Value
|
||||
temp.lengthType = Control(LengthEffectsDL).Value
|
||||
temp.tempo = Control(TempoSlider).Value
|
||||
temp.volume = Control(VolumeSlider).Value
|
||||
temp.volRamp = Control(VolRampSlider).Value
|
||||
|
||||
If IsDifferentWaveform(temp, Waveform(currentWaveform)) Then
|
||||
Waveform(currentWaveform) = temp
|
||||
Waveform(currentWaveform).active = True
|
||||
End If
|
||||
|
||||
MakePlayString
|
||||
MakePlayFXString
|
||||
End Sub
|
||||
|
||||
Sub __UI_FormResized
|
||||
|
||||
End Sub
|
||||
|
||||
'$INCLUDE:'InForm\InForm.ui'
|
231
examples/PlayFX/PlayFX.frm
Normal file
231
examples/PlayFX/PlayFX.frm
Normal file
|
@ -0,0 +1,231 @@
|
|||
': This form was generated by
|
||||
': InForm - GUI library for QB64 - v1.5
|
||||
': Fellippe Heitor, 2016-2023 - fellippe@qb64.org - @fellippeheitor
|
||||
': https://github.com/FellippeHeitor/InForm
|
||||
'-----------------------------------------------------------
|
||||
SUB __UI_LoadForm
|
||||
|
||||
DIM __UI_NewID AS LONG, __UI_RegisterResult AS LONG
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_Form, "PlayFXDesigner", 640, 450, 0, 0, 0)
|
||||
__UI_RegisterResult = 0
|
||||
SetCaption __UI_NewID, "PlayFX Designer"
|
||||
Control(__UI_NewID).Font = SetFont("segoeui.ttf", 12)
|
||||
Control(__UI_NewID).HasBorder = False
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_Frame, "Waveforms", 620, 163, 10, 10, 0)
|
||||
__UI_RegisterResult = 0
|
||||
SetCaption __UI_NewID, "Wave&forms:"
|
||||
Control(__UI_NewID).HasBorder = True
|
||||
Control(__UI_NewID).Value = 5
|
||||
Control(__UI_NewID).BorderSize = 1
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_Frame, "ConfigureWaveform", 620, 206, 10, 184, 0)
|
||||
__UI_RegisterResult = 0
|
||||
SetCaption __UI_NewID, "&Configure Waveform:"
|
||||
Control(__UI_NewID).HasBorder = True
|
||||
Control(__UI_NewID).Value = 14
|
||||
Control(__UI_NewID).BorderSize = 1
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_Frame, "PlayFX", 620, 41, 10, 399, 0)
|
||||
__UI_RegisterResult = 0
|
||||
SetCaption __UI_NewID, "Play F&X:"
|
||||
Control(__UI_NewID).HasBorder = True
|
||||
Control(__UI_NewID).Value = 2
|
||||
Control(__UI_NewID).BorderSize = 1
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_TextBox, "Waveform1TB", 600, 23, 10, 15, __UI_GetID("Waveforms"))
|
||||
__UI_RegisterResult = 0
|
||||
SetCaption __UI_NewID, "Waveform1"
|
||||
Control(__UI_NewID).HasBorder = True
|
||||
Control(__UI_NewID).CanHaveFocus = True
|
||||
Control(__UI_NewID).BorderSize = 1
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_TextBox, "Waveform2TB", 600, 23, 10, 43, __UI_GetID("Waveforms"))
|
||||
__UI_RegisterResult = 0
|
||||
SetCaption __UI_NewID, "Waveform2"
|
||||
Control(__UI_NewID).HasBorder = True
|
||||
Control(__UI_NewID).CanHaveFocus = True
|
||||
Control(__UI_NewID).BorderSize = 1
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_TextBox, "Waveform3TB", 600, 23, 10, 71, __UI_GetID("Waveforms"))
|
||||
__UI_RegisterResult = 0
|
||||
SetCaption __UI_NewID, "Waveform3"
|
||||
Control(__UI_NewID).HasBorder = True
|
||||
Control(__UI_NewID).CanHaveFocus = True
|
||||
Control(__UI_NewID).BorderSize = 1
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_TextBox, "Waveform4TB", 600, 23, 10, 99, __UI_GetID("Waveforms"))
|
||||
__UI_RegisterResult = 0
|
||||
SetCaption __UI_NewID, "Waveform4"
|
||||
Control(__UI_NewID).HasBorder = True
|
||||
Control(__UI_NewID).CanHaveFocus = True
|
||||
Control(__UI_NewID).BorderSize = 1
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_TextBox, "Waveform5TB", 600, 23, 10, 127, __UI_GetID("Waveforms"))
|
||||
__UI_RegisterResult = 0
|
||||
SetCaption __UI_NewID, "Waveform5"
|
||||
Control(__UI_NewID).HasBorder = True
|
||||
Control(__UI_NewID).CanHaveFocus = True
|
||||
Control(__UI_NewID).BorderSize = 1
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_Label, "WaveformLB", 58, 22, 15, 11, __UI_GetID("ConfigureWaveform"))
|
||||
__UI_RegisterResult = 0
|
||||
SetCaption __UI_NewID, "&Waveform:"
|
||||
Control(__UI_NewID).HasBorder = False
|
||||
Control(__UI_NewID).VAlign = __UI_Middle
|
||||
Control(__UI_NewID).AutoSize = True
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_TrackBar, "WaveformSlider", 431, 40, 73, 11, __UI_GetID("ConfigureWaveform"))
|
||||
__UI_RegisterResult = 0
|
||||
ToolTip(__UI_NewID) = "Waveform (1 - 5)"
|
||||
Control(__UI_NewID).HasBorder = False
|
||||
Control(__UI_NewID).Value = 3
|
||||
Control(__UI_NewID).Min = 1
|
||||
Control(__UI_NewID).Max = 5
|
||||
Control(__UI_NewID).CanHaveFocus = True
|
||||
Control(__UI_NewID).Interval = 1
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_Label, "WaveformNameLB", 106, 24, 504, 11, __UI_GetID("ConfigureWaveform"))
|
||||
__UI_RegisterResult = 0
|
||||
SetCaption __UI_NewID, "WaveformName"
|
||||
Control(__UI_NewID).HasBorder = True
|
||||
Control(__UI_NewID).VAlign = __UI_Middle
|
||||
Control(__UI_NewID).BorderSize = 1
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_Label, "NoteLB", 29, 22, 44, 46, __UI_GetID("ConfigureWaveform"))
|
||||
__UI_RegisterResult = 0
|
||||
SetCaption __UI_NewID, "&Note:"
|
||||
Control(__UI_NewID).HasBorder = False
|
||||
Control(__UI_NewID).VAlign = __UI_Middle
|
||||
Control(__UI_NewID).AutoSize = True
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_TrackBar, "NoteSlider", 537, 30, 73, 46, __UI_GetID("ConfigureWaveform"))
|
||||
__UI_RegisterResult = 0
|
||||
ToolTip(__UI_NewID) = "Note (0 - 84)"
|
||||
Control(__UI_NewID).HasBorder = False
|
||||
Control(__UI_NewID).Value = 42
|
||||
Control(__UI_NewID).Max = 84
|
||||
Control(__UI_NewID).CanHaveFocus = True
|
||||
Control(__UI_NewID).Interval = 1
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_Label, "LengthLB", 40, 22, 33, 78, __UI_GetID("ConfigureWaveform"))
|
||||
__UI_RegisterResult = 0
|
||||
SetCaption __UI_NewID, "&Length:"
|
||||
Control(__UI_NewID).HasBorder = False
|
||||
Control(__UI_NewID).VAlign = __UI_Middle
|
||||
Control(__UI_NewID).AutoSize = True
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_TrackBar, "LengthSlider", 463, 30, 73, 77, __UI_GetID("ConfigureWaveform"))
|
||||
__UI_RegisterResult = 0
|
||||
ToolTip(__UI_NewID) = "Length (1 - 64)"
|
||||
Control(__UI_NewID).HasBorder = False
|
||||
Control(__UI_NewID).Value = 4
|
||||
Control(__UI_NewID).Min = 1
|
||||
Control(__UI_NewID).Max = 64
|
||||
Control(__UI_NewID).CanHaveFocus = True
|
||||
Control(__UI_NewID).Interval = 1
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_DropdownList, "LengthEffectsDL", 74, 24, 536, 76, __UI_GetID("ConfigureWaveform"))
|
||||
__UI_RegisterResult = 0
|
||||
ToolTip(__UI_NewID) = "Length effect"
|
||||
AddItem __UI_NewID, "Normal"
|
||||
AddItem __UI_NewID, "Legato"
|
||||
AddItem __UI_NewID, "Staccato"
|
||||
Control(__UI_NewID).HasBorder = True
|
||||
Control(__UI_NewID).Value = 1
|
||||
Control(__UI_NewID).CanHaveFocus = True
|
||||
Control(__UI_NewID).BorderSize = 1
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_Label, "TempoLB", 39, 22, 34, 108, __UI_GetID("ConfigureWaveform"))
|
||||
__UI_RegisterResult = 0
|
||||
SetCaption __UI_NewID, "&Tempo:"
|
||||
Control(__UI_NewID).HasBorder = False
|
||||
Control(__UI_NewID).VAlign = __UI_Middle
|
||||
Control(__UI_NewID).AutoSize = True
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_TrackBar, "TempoSlider", 537, 30, 73, 108, __UI_GetID("ConfigureWaveform"))
|
||||
__UI_RegisterResult = 0
|
||||
ToolTip(__UI_NewID) = "Tempo (32 - 255)"
|
||||
Control(__UI_NewID).HasBorder = False
|
||||
Control(__UI_NewID).Value = 120
|
||||
Control(__UI_NewID).Min = 32
|
||||
Control(__UI_NewID).Max = 255
|
||||
Control(__UI_NewID).CanHaveFocus = True
|
||||
Control(__UI_NewID).Interval = 1
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_Label, "VolumeLB", 44, 22, 29, 140, __UI_GetID("ConfigureWaveform"))
|
||||
__UI_RegisterResult = 0
|
||||
SetCaption __UI_NewID, "&Volume:"
|
||||
Control(__UI_NewID).HasBorder = False
|
||||
Control(__UI_NewID).VAlign = __UI_Middle
|
||||
Control(__UI_NewID).AutoSize = True
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_TrackBar, "VolumeSlider", 537, 30, 73, 139, __UI_GetID("ConfigureWaveform"))
|
||||
__UI_RegisterResult = 0
|
||||
ToolTip(__UI_NewID) = "Volume (0 - 100)"
|
||||
Control(__UI_NewID).HasBorder = False
|
||||
Control(__UI_NewID).Value = 100
|
||||
Control(__UI_NewID).Max = 100
|
||||
Control(__UI_NewID).CanHaveFocus = True
|
||||
Control(__UI_NewID).Interval = 1
|
||||
Control(__UI_NewID).AutoSize = True
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_Label, "VolRampLB", 57, 22, 16, 171, __UI_GetID("ConfigureWaveform"))
|
||||
__UI_RegisterResult = 0
|
||||
SetCaption __UI_NewID, "Vol. &Ramp:"
|
||||
Control(__UI_NewID).HasBorder = False
|
||||
Control(__UI_NewID).VAlign = __UI_Middle
|
||||
Control(__UI_NewID).AutoSize = True
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_TrackBar, "VolRampSlider", 537, 30, 73, 170, __UI_GetID("ConfigureWaveform"))
|
||||
__UI_RegisterResult = 0
|
||||
ToolTip(__UI_NewID) = "Volume Ramp (0 - 100)"
|
||||
Control(__UI_NewID).HasBorder = False
|
||||
Control(__UI_NewID).Value = 10
|
||||
Control(__UI_NewID).Max = 100
|
||||
Control(__UI_NewID).CanHaveFocus = True
|
||||
Control(__UI_NewID).Interval = 1
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_TextBox, "PlayFXTB", 550, 23, 11, 10, __UI_GetID("PlayFX"))
|
||||
__UI_RegisterResult = 0
|
||||
SetCaption __UI_NewID, "PlayFX"
|
||||
Control(__UI_NewID).HasBorder = True
|
||||
Control(__UI_NewID).CanHaveFocus = True
|
||||
Control(__UI_NewID).BorderSize = 1
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_Button, "PlayBT", 50, 23, 560, 10, __UI_GetID("PlayFX"))
|
||||
__UI_RegisterResult = 0
|
||||
SetCaption __UI_NewID, "&Play"
|
||||
Control(__UI_NewID).HasBorder = False
|
||||
Control(__UI_NewID).CanHaveFocus = True
|
||||
|
||||
END SUB
|
||||
|
||||
SUB __UI_AssignIDs
|
||||
PlayFXDesigner = __UI_GetID("PlayFXDesigner")
|
||||
Waveforms = __UI_GetID("Waveforms")
|
||||
ConfigureWaveform = __UI_GetID("ConfigureWaveform")
|
||||
PlayFX = __UI_GetID("PlayFX")
|
||||
Waveform1TB = __UI_GetID("Waveform1TB")
|
||||
Waveform2TB = __UI_GetID("Waveform2TB")
|
||||
Waveform3TB = __UI_GetID("Waveform3TB")
|
||||
Waveform4TB = __UI_GetID("Waveform4TB")
|
||||
Waveform5TB = __UI_GetID("Waveform5TB")
|
||||
WaveformLB = __UI_GetID("WaveformLB")
|
||||
WaveformSlider = __UI_GetID("WaveformSlider")
|
||||
WaveformNameLB = __UI_GetID("WaveformNameLB")
|
||||
NoteLB = __UI_GetID("NoteLB")
|
||||
NoteSlider = __UI_GetID("NoteSlider")
|
||||
LengthLB = __UI_GetID("LengthLB")
|
||||
LengthSlider = __UI_GetID("LengthSlider")
|
||||
LengthEffectsDL = __UI_GetID("LengthEffectsDL")
|
||||
TempoLB = __UI_GetID("TempoLB")
|
||||
TempoSlider = __UI_GetID("TempoSlider")
|
||||
VolumeLB = __UI_GetID("VolumeLB")
|
||||
VolumeSlider = __UI_GetID("VolumeSlider")
|
||||
VolRampLB = __UI_GetID("VolRampLB")
|
||||
VolRampSlider = __UI_GetID("VolRampSlider")
|
||||
PlayFXTB = __UI_GetID("PlayFXTB")
|
||||
PlayBT = __UI_GetID("PlayBT")
|
||||
END SUB
|
Loading…
Reference in a new issue