mirror of
https://github.com/FellippeHeitor/InForm.git
synced 2025-01-15 03:49:56 +00:00
Clipboard operations with controls in design mode. Also:
- Allow preview to be detached from the editor window. - Checked items in menus. - Show message while compiling the Preview component. - New controls are placed inside the selected frame. - Fixed selecting text when textbox is inside a frame. - Fix detection of Preview window and the relaunch routine. - Make frames always be redrawn in DesignMode.
This commit is contained in:
parent
e3a27a54ae
commit
bc1cd37c41
5 changed files with 295 additions and 85 deletions
139
InForm.ui
139
InForm.ui
|
@ -143,6 +143,7 @@ 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
|
||||
|
||||
'Control types:
|
||||
DIM SHARED __UI_Type(0 TO 17) AS __UI_Types
|
||||
|
@ -256,6 +257,7 @@ SUB __UI_Init
|
|||
_DISPLAY
|
||||
|
||||
__UI_ThemeSetup
|
||||
__UI_OnLoad
|
||||
|
||||
__UI_EventsTimer = _FREETIMER
|
||||
__UI_RefreshTimer = _FREETIMER
|
||||
|
@ -266,7 +268,6 @@ SUB __UI_Init
|
|||
|
||||
__UI_AutoRefresh = __UI_True
|
||||
__UI_Loaded = __UI_True
|
||||
__UI_OnLoad
|
||||
END SUB
|
||||
|
||||
'---------------------------------------------------------------------------------
|
||||
|
@ -495,11 +496,15 @@ SUB __UI_ProcessInput
|
|||
END IF
|
||||
|
||||
'2- Triggered by manually resizing:
|
||||
IF (_RESIZE AND __UI_Controls(__UI_FormID).CanResize) OR __UI_CurrentBackColor <> __UI_Controls(__UI_FormID).BackColor THEN
|
||||
DIM CheckResize AS _BYTE
|
||||
CheckResize = _RESIZE
|
||||
IF (CheckResize AND __UI_Controls(__UI_FormID).CanResize) OR __UI_CurrentBackColor <> __UI_Controls(__UI_FormID).BackColor OR __UI_Controls(__UI_FormID).Width <> _WIDTH(0) OR __UI_Controls(__UI_FormID).Height <> _HEIGHT(0) THEN
|
||||
__UI_AutoRefresh = __UI_False
|
||||
_DELAY .1
|
||||
__UI_Controls(__UI_FormID).Width = _RESIZEWIDTH
|
||||
__UI_Controls(__UI_FormID).Height = _RESIZEHEIGHT
|
||||
IF CheckResize THEN
|
||||
__UI_Controls(__UI_FormID).Width = _RESIZEWIDTH
|
||||
__UI_Controls(__UI_FormID).Height = _RESIZEHEIGHT
|
||||
END IF
|
||||
__UI_CurrentBackColor = __UI_Controls(__UI_FormID).BackColor
|
||||
OldScreen& = _DEST
|
||||
SCREEN _NEWIMAGE(__UI_Controls(__UI_FormID).Width, __UI_Controls(__UI_FormID).Height, 32)
|
||||
|
@ -883,22 +888,22 @@ SUB __UI_UpdateDisplay
|
|||
|
||||
__UI_ForceRedraw = __UI_False
|
||||
|
||||
STATIC WaitMessage AS LONG, WaitMessageSetup AS _BYTE, PrevWaitMessage AS STRING
|
||||
STATIC WaitMessageSetup AS _BYTE, PrevWaitMessage AS STRING
|
||||
DIM NoInputMessage$
|
||||
IF TIMER - __UI_LastInputReceived > 2 THEN
|
||||
'Visually indicate that something is hogging the input routine
|
||||
IF WaitMessage = 0 THEN
|
||||
WaitMessage = _NEWIMAGE(_WIDTH(0), _HEIGHT(0), 32)
|
||||
ELSEIF _WIDTH(WaitMessage) <> _WIDTH(0) OR _HEIGHT(WaitMessage) <> _HEIGHT(0) THEN
|
||||
_FREEIMAGE WaitMessage
|
||||
WaitMessage = _NEWIMAGE(_WIDTH(0), _HEIGHT(0), 32)
|
||||
IF __UI_WaitMessageHandle = 0 THEN
|
||||
__UI_WaitMessageHandle = _NEWIMAGE(_WIDTH(0), _HEIGHT(0), 32)
|
||||
ELSEIF _WIDTH(__UI_WaitMessageHandle) <> _WIDTH(0) OR _HEIGHT(__UI_WaitMessageHandle) <> _HEIGHT(0) THEN
|
||||
_FREEIMAGE __UI_WaitMessageHandle
|
||||
__UI_WaitMessageHandle = _NEWIMAGE(_WIDTH(0), _HEIGHT(0), 32)
|
||||
END IF
|
||||
|
||||
IF WaitMessageSetup = __UI_False OR PrevWaitMessage <> __UI_WaitMessage THEN
|
||||
PrevWaitMessage = __UI_WaitMessage
|
||||
WaitMessageSetup = __UI_True
|
||||
PrevDest = _DEST
|
||||
_DEST WaitMessage
|
||||
_DEST __UI_WaitMessageHandle
|
||||
LINE (0, 0)-STEP(_WIDTH, _HEIGHT), _RGBA32(0, 0, 0, 170), BF
|
||||
_FONT 16
|
||||
_PRINTMODE _KEEPBACKGROUND
|
||||
|
@ -915,10 +920,10 @@ SUB __UI_UpdateDisplay
|
|||
_PRINTSTRING (_WIDTH / 2 - _PRINTWIDTH(NoInputMessage$) / 2, _HEIGHT \ 2 + 3), __UI_WaitMessage
|
||||
END IF
|
||||
_DEST PrevDest
|
||||
__UI_MakeHardwareImage WaitMessage
|
||||
__UI_MakeHardwareImage __UI_WaitMessageHandle
|
||||
END IF
|
||||
IF _EXIT THEN SYSTEM 'Can't force user to wait...
|
||||
_PUTIMAGE , WaitMessage
|
||||
_PUTIMAGE , __UI_WaitMessageHandle
|
||||
END IF
|
||||
|
||||
_DISPLAY
|
||||
|
@ -931,7 +936,8 @@ END FUNCTION
|
|||
|
||||
SUB __UI_EventDispatcher
|
||||
STATIC __UI_LastMouseIconSet AS _BYTE
|
||||
STATIC __UI_PreviousMouseDownOnID AS LONG
|
||||
STATIC __UI_PreviousMouseDownOnID AS LONG, __UI_LastMouseDownEvent AS DOUBLE
|
||||
STATIC __UI_MouseDownTop AS INTEGER, __UI_MouseDownLeft AS INTEGER
|
||||
STATIC __UI_JustOpenedMenu AS _BYTE
|
||||
STATIC ControlClipboard$
|
||||
DIM i AS LONG, ThisItem%
|
||||
|
@ -1044,6 +1050,7 @@ SUB __UI_EventDispatcher
|
|||
END IF
|
||||
IF __UI_FocusSearch = __UI_FirstSelectedID THEN
|
||||
'Full circle. No controls can be selected at the moment
|
||||
__UI_Controls(__UI_FocusSearch).ControlIsSelected = __UI_True
|
||||
EXIT DO
|
||||
END IF
|
||||
|
||||
|
@ -1136,10 +1143,12 @@ SUB __UI_EventDispatcher
|
|||
IF __UI_MouseButton1 THEN
|
||||
'Mouse button is first pressed
|
||||
IF __UI_MouseIsDown = __UI_False THEN
|
||||
__UI_MouseDownTop = __UI_MouseTop
|
||||
__UI_MouseDownLeft = __UI_MouseLeft
|
||||
IF __UI_DesignMode THEN
|
||||
IF _KEYDOWN(100304) OR _KEYDOWN(100303) THEN
|
||||
IF __UI_Controls(__UI_HoveringID).Type <> __UI_Type_Form AND __UI_Controls(__UI_HoveringID).Type <> __UI_Type_Font AND __UI_Controls(__UI_HoveringID).Type <> __UI_Type_MenuBar AND __UI_Controls(__UI_HoveringID).Type <> __UI_Type_MenuItem AND __UI_Controls(__UI_HoveringID).Type <> __UI_Type_MenuPanel AND __UI_Controls(__UI_HoveringID).Type <> __UI_Type_ContextMenu AND __UI_Controls(__UI_HoveringID).Type <> __UI_Type_MenuItem THEN
|
||||
IF __UI_Controls(__UI_HoveringID).ControlIsSelected = __UI_False AND __UI_Controls(__UI_HoveringID).ParentID = __UI_Controls(__UI_FirstSelectedID).ParentID THEN
|
||||
IF __UI_Controls(__UI_HoveringID).Type <> __UI_Type_Frame AND __UI_Controls(__UI_HoveringID).Type <> __UI_Type_Form AND __UI_Controls(__UI_HoveringID).Type <> __UI_Type_Font AND __UI_Controls(__UI_HoveringID).Type <> __UI_Type_MenuBar AND __UI_Controls(__UI_HoveringID).Type <> __UI_Type_MenuItem AND __UI_Controls(__UI_HoveringID).Type <> __UI_Type_MenuPanel AND __UI_Controls(__UI_HoveringID).Type <> __UI_Type_ContextMenu AND __UI_Controls(__UI_HoveringID).Type <> __UI_Type_MenuItem THEN
|
||||
IF __UI_Controls(__UI_HoveringID).ControlIsSelected = __UI_False AND __UI_Controls(__UI_HoveringID).ParentID = __UI_Controls(__UI_FirstSelectedID).ParentID AND __UI_Controls(__UI_FirstSelectedID).Type <> __UI_Type_Frame THEN
|
||||
__UI_Controls(__UI_HoveringID).ControlIsSelected = __UI_True
|
||||
__UI_TotalSelectedControls = __UI_TotalSelectedControls + 1
|
||||
END IF
|
||||
|
@ -1156,6 +1165,11 @@ SUB __UI_EventDispatcher
|
|||
__UI_TotalSelectedControls = 1
|
||||
__UI_FirstSelectedID = __UI_HoveringID
|
||||
END IF
|
||||
ELSE
|
||||
IF __UI_Controls(__UI_FirstSelectedID).Type = __UI_Type_Frame AND (TIMER - __UI_LastMouseDownEvent < .5 AND (__UI_MouseTop = __UI_MouseDownTop AND __UI_MouseLeft = __UI_MouseDownLeft)) THEN
|
||||
'Select all controls inside a frame
|
||||
GOTO SelectAllInFrame
|
||||
END IF
|
||||
END IF
|
||||
END IF
|
||||
ELSEIF __UI_Controls(__UI_HoveringID).CanHaveFocus AND NOT __UI_Controls(__UI_HoveringID).Disabled THEN
|
||||
|
@ -1186,7 +1200,7 @@ SUB __UI_EventDispatcher
|
|||
__UI_Controls(__UI_HoveringID).TextIsSelected = __UI_False
|
||||
__UI_SelectedText = ""
|
||||
__UI_SelectionLength = 0
|
||||
__UI_Controls(__UI_HoveringID).SelectionStart = ((__UI_MouseLeft - __UI_Controls(__UI_HoveringID).Left - __UI_Controls(__UI_Controls(__UI_HoveringID).ParentID).Left) / _FONTWIDTH) + (__UI_Controls(__UI_HoveringID).InputViewStart - 1)
|
||||
__UI_Controls(__UI_HoveringID).SelectionStart = ((__UI_MouseLeft - (__UI_Controls(__UI_HoveringID).Left + __UI_Controls(__UI_Controls(__UI_HoveringID).ParentID).Left)) / _FONTWIDTH) + (__UI_Controls(__UI_HoveringID).InputViewStart - 1)
|
||||
__UI_Controls(__UI_HoveringID).Cursor = __UI_Controls(__UI_HoveringID).SelectionStart
|
||||
IF __UI_Controls(__UI_HoveringID).SelectionStart > LEN(__UI_Texts(__UI_HoveringID)) THEN __UI_Controls(__UI_HoveringID).SelectionStart = LEN(__UI_Texts(__UI_HoveringID))
|
||||
IF __UI_Controls(__UI_HoveringID).Cursor > LEN(__UI_Texts(__UI_HoveringID)) THEN __UI_Controls(__UI_HoveringID).Cursor = LEN(__UI_Texts(__UI_HoveringID))
|
||||
|
@ -1205,13 +1219,23 @@ SUB __UI_EventDispatcher
|
|||
END IF
|
||||
END IF
|
||||
__UI_MouseDown __UI_HoveringID
|
||||
__UI_LastMouseDownEvent = TIMER
|
||||
ELSE
|
||||
'Mouse button is still pressed
|
||||
IF __UI_DesignMode THEN
|
||||
IF __UI_ResizeHandleHover = 0 THEN
|
||||
IF __UI_ResizeHandleHover = 0 AND (TIMER - __UI_LastMouseDownEvent > .3 OR (__UI_MouseTop <> __UI_MouseDownTop OR __UI_MouseLeft <> __UI_MouseDownLeft)) THEN
|
||||
IF __UI_IsDragging = __UI_False THEN
|
||||
__UI_IsDragging = __UI_True
|
||||
__UI_DraggingID = __UI_HoveringID
|
||||
FOR i = 1 TO UBOUND(__UI_Controls)
|
||||
IF __UI_Controls(i).ControlIsSelected AND __UI_Controls(i).Type = __UI_Type_Frame THEN
|
||||
__UI_DraggingID = i
|
||||
FOR i = 1 TO UBOUND(__UI_Controls)
|
||||
IF i <> __UI_DraggingID THEN __UI_Controls(i).ControlIsSelected = __UI_False
|
||||
NEXT
|
||||
EXIT FOR
|
||||
END IF
|
||||
NEXT
|
||||
__UI_MouseDownOnID = 0
|
||||
__UI_DragY = __UI_MouseTop
|
||||
__UI_DragX = __UI_MouseLeft
|
||||
|
@ -1239,11 +1263,11 @@ SUB __UI_EventDispatcher
|
|||
ELSEIF __UI_MouseDownOnID = __UI_HoveringID THEN
|
||||
IF __UI_IsSelectingText THEN
|
||||
_FONT (__UI_Controls(__UI_IsSelectingTextOnID).Font)
|
||||
IF __UI_MouseLeft <= __UI_Controls(__UI_IsSelectingTextOnID).Left AND __UI_Controls(__UI_IsSelectingTextOnID).InputViewStart > 1 THEN
|
||||
IF __UI_MouseLeft <= __UI_Controls(__UI_IsSelectingTextOnID).Left + __UI_Controls(__UI_Controls(__UI_IsSelectingTextOnID).ParentID).Left AND __UI_Controls(__UI_IsSelectingTextOnID).InputViewStart > 1 THEN
|
||||
__UI_Controls(__UI_IsSelectingTextOnID).InputViewStart = __UI_Controls(__UI_IsSelectingTextOnID).InputViewStart - 1
|
||||
__UI_Controls(__UI_IsSelectingTextOnID).Cursor = __UI_Controls(__UI_IsSelectingTextOnID).InputViewStart
|
||||
ELSE
|
||||
__UI_Controls(__UI_IsSelectingTextOnID).Cursor = ((__UI_MouseLeft - __UI_Controls(__UI_IsSelectingTextOnID).Left) / _FONTWIDTH) + (__UI_Controls(__UI_IsSelectingTextOnID).InputViewStart - 1)
|
||||
__UI_Controls(__UI_IsSelectingTextOnID).Cursor = ((__UI_MouseLeft - (__UI_Controls(__UI_IsSelectingTextOnID).Left + __UI_Controls(__UI_Controls(__UI_IsSelectingTextOnID).ParentID).Left)) / _FONTWIDTH) + (__UI_Controls(__UI_IsSelectingTextOnID).InputViewStart - 1)
|
||||
IF __UI_Controls(__UI_IsSelectingTextOnID).Cursor < 0 THEN __UI_Controls(__UI_IsSelectingTextOnID).Cursor = 0
|
||||
IF __UI_Controls(__UI_IsSelectingTextOnID).Cursor > LEN(__UI_Texts(__UI_IsSelectingTextOnID)) THEN __UI_Controls(__UI_IsSelectingTextOnID).Cursor = LEN(__UI_Texts(__UI_IsSelectingTextOnID))
|
||||
IF __UI_Controls(__UI_IsSelectingTextOnID).Cursor <> __UI_Controls(__UI_IsSelectingTextOnID).SelectionStart THEN
|
||||
|
@ -1328,7 +1352,7 @@ SUB __UI_EventDispatcher
|
|||
__UI_Controls(__UI_HoveringID).Value = NOT __UI_Controls(__UI_HoveringID).Value
|
||||
CASE __UI_Type_TextBox
|
||||
_FONT (__UI_Controls(__UI_HoveringID).Font)
|
||||
__UI_Controls(__UI_HoveringID).Cursor = ((__UI_MouseLeft - __UI_Controls(__UI_HoveringID).Left - __UI_Controls(__UI_Controls(__UI_HoveringID).ParentID).Left) / _FONTWIDTH) + (__UI_Controls(__UI_HoveringID).InputViewStart - 1)
|
||||
__UI_Controls(__UI_HoveringID).Cursor = ((__UI_MouseLeft - (__UI_Controls(__UI_HoveringID).Left + __UI_Controls(__UI_Controls(__UI_HoveringID).ParentID).Left)) / _FONTWIDTH) + (__UI_Controls(__UI_HoveringID).InputViewStart - 1)
|
||||
IF __UI_Controls(__UI_HoveringID).Cursor > LEN(__UI_Texts(__UI_HoveringID)) THEN __UI_Controls(__UI_HoveringID).Cursor = LEN(__UI_Texts(__UI_HoveringID))
|
||||
CASE __UI_Type_ListBox
|
||||
IF __UI_Controls(__UI_HoveringID).HasVScrollbar AND __UI_MouseLeft >= __UI_Controls(__UI_HoveringID).Left + __UI_Controls(__UI_HoveringID).Width - 25 + ContainerOffsetLeft THEN
|
||||
|
@ -1997,32 +2021,67 @@ SUB __UI_EventDispatcher
|
|||
END IF
|
||||
ELSEIF __UI_Focus = 0 AND __UI_DesignMode AND __UI_KeyHit <> 0 THEN 'No buttons will respond while in design mode
|
||||
SELECT CASE __UI_Keyhit
|
||||
CASE ASC("A"), ASC("a")
|
||||
IF __UI_CtrlIsDown THEN
|
||||
IF __UI_TotalSelectedControls = 1 AND __UI_Controls(__UI_FirstSelectedID).Type = __UI_Type_Frame THEN
|
||||
SelectAllInFrame:
|
||||
DIM ThisContainer AS LONG
|
||||
ThisContainer = __UI_Controls(__UI_FirstSelectedID).ID
|
||||
__UI_Controls(__UI_FirstSelectedID).ControlIsSelected = __UI_False
|
||||
__UI_TotalSelectedControls = 0
|
||||
FOR i = 1 TO UBOUND(__UI_Controls)
|
||||
IF __UI_Controls(i).Type <> __UI_Type_Frame AND __UI_Controls(i).Type <> __UI_Type_Form AND __UI_Controls(i).Type <> __UI_Type_Font AND __UI_Controls(i).Type <> __UI_Type_MenuBar AND __UI_Controls(i).Type <> __UI_Type_MenuItem AND __UI_Controls(i).Type <> __UI_Type_MenuPanel AND __UI_Controls(i).Type <> __UI_Type_ContextMenu AND __UI_Controls(i).Type <> __UI_Type_MenuItem THEN
|
||||
IF __UI_Controls(i).ParentID = ThisContainer THEN
|
||||
__UI_Controls(i).ControlIsSelected = __UI_True
|
||||
__UI_TotalSelectedControls = __UI_TotalSelectedControls + 1
|
||||
IF __UI_TotalSelectedControls = 1 THEN __UI_FirstSelectedID = __UI_Controls(i).ID
|
||||
END IF
|
||||
END IF
|
||||
NEXT
|
||||
ELSE
|
||||
__UI_TotalSelectedControls = 0
|
||||
FOR i = 1 TO UBOUND(__UI_Controls)
|
||||
IF __UI_Controls(i).Type <> __UI_Type_Frame AND __UI_Controls(i).Type <> __UI_Type_Form AND __UI_Controls(i).Type <> __UI_Type_Font AND __UI_Controls(i).Type <> __UI_Type_MenuBar AND __UI_Controls(i).Type <> __UI_Type_MenuItem AND __UI_Controls(i).Type <> __UI_Type_MenuPanel AND __UI_Controls(i).Type <> __UI_Type_ContextMenu AND __UI_Controls(i).Type <> __UI_Type_MenuItem THEN
|
||||
IF __UI_Controls(i).ParentID = 0 THEN
|
||||
__UI_Controls(i).ControlIsSelected = __UI_True
|
||||
__UI_TotalSelectedControls = __UI_TotalSelectedControls + 1
|
||||
IF __UI_TotalSelectedControls = 1 THEN __UI_FirstSelectedID = __UI_Controls(i).ID
|
||||
END IF
|
||||
END IF
|
||||
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)
|
||||
FOR i = 1 TO UBOUND(__UI_Controls)
|
||||
IF __UI_Controls(i).ControlIsSelected THEN
|
||||
IF __UI_Controls(i).ControlIsSelected AND __UI_Controls(i).Type <> __UI_Type_Frame THEN
|
||||
ControlClipboard$ = ControlClipboard$ + MKL$(i)
|
||||
END IF
|
||||
NEXT
|
||||
_CLIPBOARD$ = "InForm" + CHR$(1)
|
||||
END IF
|
||||
__UI_ControlOperation = __UI_True
|
||||
CASE ASC("V"), ASC("v")
|
||||
IF __UI_CtrlIsDown THEN
|
||||
Clip$ = _CLIPBOARD$
|
||||
IF Clip$ = "InForm" + CHR$(1) THEN
|
||||
DIM PasteID AS LONG, ThisControl AS LONG, FirstToBeSelected AS LONG
|
||||
DIM TempCanvas AS LONG, TempHelperCanvas AS LONG
|
||||
|
||||
j = CVL(MID$(ControlClipboard$, 1, 4))
|
||||
|
||||
FOR i = 1 TO UBOUND(__UI_Controls)
|
||||
__UI_Controls(i).ControlIsSelected = __UI_False
|
||||
NEXT
|
||||
|
||||
DIM PasteID AS LONG, ThisControl AS LONG
|
||||
DIM TempCanvas AS LONG, TempHelperCanvas AS LONG
|
||||
__UI_AutoRefresh = __UI_False
|
||||
_DELAY .1
|
||||
Clip$ = MID$(ControlClipboard$, 5)
|
||||
FOR i = 1 TO j
|
||||
ThisControl = CVL(MID$(ControlClipboard$, 4 + (i * 4 - 3), 4))
|
||||
IF __UI_Controls(ThisControl).ID > 0 THEN
|
||||
ThisControl = CVL(MID$(Clip$, (i * 4 - 3), 4))
|
||||
IF __UI_Controls(ThisControl).ID > 0 AND __UI_Controls(ThisControl).Type <> __UI_Type_Frame THEN
|
||||
PasteID = __UI_NewControl(__UI_Controls(ThisControl).Type, "", 0, 0, 0, 0, 0)
|
||||
TempCanvas = __UI_Controls(PasteID).Canvas
|
||||
TempHelperCanvas = __UI_Controls(PasteID).HelperCanvas
|
||||
|
@ -2032,34 +2091,44 @@ SUB __UI_EventDispatcher
|
|||
__UI_Controls(PasteID).Name = "CopyOf" + __UI_Controls(PasteID).Name
|
||||
LOOP
|
||||
__UI_Controls(PasteID).ID = PasteID
|
||||
__UI_Controls(PasteID).ParentID = 0
|
||||
__UI_Captions(PasteID) = __UI_Captions(ThisControl)
|
||||
__UI_Texts(PasteID) = __UI_Texts(ThisControl)
|
||||
__UI_Tips(PasteID) = __UI_Tips(ThisControl)
|
||||
__UI_Controls(PasteID).Canvas = TempCanvas
|
||||
__UI_Controls(PasteID).HelperCanvas = TempHelperCanvas
|
||||
IF __UI_FirstSelectedID > 0 THEN
|
||||
__UI_Controls(PasteID).Top = __UI_Controls(__UI_FirstSelectedID).Top + 20
|
||||
__UI_Controls(PasteID).Left = __UI_Controls(__UI_FirstSelectedID).Left + 20
|
||||
ELSE
|
||||
__UI_Controls(PasteID).Top = __UI_Controls(PasteID).Top + 20
|
||||
__UI_Controls(PasteID).Left = __UI_Controls(PasteID).Left + 20
|
||||
END IF
|
||||
__UI_Controls(PasteID).Top = __UI_Controls(PasteID).Top + 20
|
||||
__UI_Controls(PasteID).Left = __UI_Controls(PasteID).Left + 20
|
||||
__UI_Controls(PasteID).ControlIsSelected = __UI_True
|
||||
|
||||
IF i = 1 THEN FirstToBeSelected = PasteID
|
||||
END IF
|
||||
NEXT
|
||||
__UI_TotalSelectedControls = j
|
||||
__UI_FirstSelectedID = CVL(MID$(ControlClipboard$, 1, 4))
|
||||
__UI_FirstSelectedID = FirstToBeSelected
|
||||
__UI_ForceRedraw = __UI_True
|
||||
__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
|
||||
IF __UI_Controls(i).Type = __UI_Type_Frame THEN
|
||||
'Remove controls from container before deleting it
|
||||
FOR j = 1 TO UBOUND(__UI_Controls)
|
||||
IF __UI_Controls(j).ParentID = __UI_Controls(i).ID THEN
|
||||
__UI_Controls(j).ParentID = 0
|
||||
__UI_Controls(j).Top = __UI_Controls(j).Top + __UI_Controls(i).Top
|
||||
__UI_Controls(j).Left = __UI_Controls(j).Left + __UI_Controls(i).Left
|
||||
END IF
|
||||
NEXT
|
||||
END IF
|
||||
__UI_DestroyControl __UI_Controls(i)
|
||||
__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
|
||||
|
@ -2273,6 +2342,8 @@ FUNCTION __UI_NewControl (ControlType AS INTEGER, ControlName AS STRING, NewWidt
|
|||
END IF
|
||||
|
||||
IF ControlType = __UI_Type_Frame THEN
|
||||
IF NewWidth = 0 THEN NewWidth = 10
|
||||
IF NewHeight = 0 THEN NewHeight = 10
|
||||
__UI_Controls(NextSlot).Canvas = _NEWIMAGE(NewWidth, NewHeight, 32)
|
||||
END IF
|
||||
|
||||
|
|
147
UiEditor.bas
147
UiEditor.bas
|
@ -8,6 +8,7 @@ DIM SHARED RedTextBoxID AS LONG, GreenTextBoxID AS LONG, BlueTextBoxID AS LONG
|
|||
DIM SHARED ColorPropertiesListID AS LONG
|
||||
DIM SHARED UiPreviewPID AS LONG, TotalSelected AS LONG, FirstSelected AS LONG
|
||||
DIM SHARED PreviewFormID AS LONG, ColorPreviewID AS LONG
|
||||
DIM SHARED CheckPreviewTimer AS INTEGER, PreviewAttached AS _BYTE
|
||||
|
||||
CONST OffsetEditorPID = 1
|
||||
CONST OffsetPreviewPID = 5
|
||||
|
@ -28,6 +29,9 @@ REDIM SHARED PreviewTips(0) AS STRING
|
|||
REDIM SHARED PreviewFonts(0) AS STRING
|
||||
REDIM SHARED PreviewControls(0) AS __UI_ControlTYPE
|
||||
|
||||
CheckPreviewTimer = _FREETIMER
|
||||
ON TIMER(CheckPreviewTimer, .003) CheckPreview
|
||||
|
||||
$IF WIN THEN
|
||||
DECLARE DYNAMIC LIBRARY "kernel32"
|
||||
FUNCTION OpenProcess& (BYVAL dwDesiredAccess AS LONG, BYVAL bInheritHandle AS LONG, BYVAL dwProcessId AS LONG)
|
||||
|
@ -39,7 +43,6 @@ $ELSE
|
|||
FUNCTION PROCESS_CLOSED& ALIAS kill (BYVAL pid AS INTEGER, BYVAL signal AS INTEGER)
|
||||
END DECLARE
|
||||
$END IF
|
||||
|
||||
'$include:'InForm.ui'
|
||||
'$include:'UiEditor.frm'
|
||||
'$include:'xp.uitheme'
|
||||
|
@ -49,6 +52,9 @@ SUB __UI_Click (id AS LONG)
|
|||
DIM Answer AS _BYTE, Dummy AS LONG, b$, UiEditorFile AS INTEGER
|
||||
|
||||
SELECT EVERYCASE UCASE$(RTRIM$(__UI_Controls(id).Name))
|
||||
CASE "VIEWMENUPREVIEWDETACH"
|
||||
PreviewAttached = NOT PreviewAttached
|
||||
__UI_Controls(__UI_GetID("ViewMenuPreviewDetach")).Value = PreviewAttached
|
||||
CASE "ADDBUTTON": Dummy = __UI_Type_Button
|
||||
CASE "ADDLABEL": Dummy = __UI_Type_Label
|
||||
CASE "ADDTEXTBOX": Dummy = __UI_Type_TextBox
|
||||
|
@ -694,20 +700,25 @@ SUB __UI_BeforeUpdateDisplay
|
|||
LoadPreview
|
||||
|
||||
$IF WIN THEN
|
||||
b$ = MKI$(_SCREENX)
|
||||
PUT #UiEditorFile, OffsetWindowLeft, b$
|
||||
IF PreviewAttached THEN
|
||||
b$ = MKI$(_SCREENX)
|
||||
PUT #UiEditorFile, OffsetWindowLeft, b$
|
||||
|
||||
b$ = MKI$(_SCREENY)
|
||||
PUT #UiEditorFile, OffsetWindowTop, b$
|
||||
b$ = MKI$(_SCREENY)
|
||||
PUT #UiEditorFile, OffsetWindowTop, b$
|
||||
ELSE
|
||||
b$ = MKI$(-1)
|
||||
PUT #UiEditorFile, OffsetWindowLeft, b$
|
||||
PUT #UiEditorFile, OffsetWindowTop, b$
|
||||
END IF
|
||||
$END IF
|
||||
|
||||
b$ = SPACE$(4): GET #UiEditorFile, OffsetPreviewPID, b$
|
||||
UiPreviewPID = CVL(b$)
|
||||
|
||||
'Controls in the editor lose focus when the preview is manipulated
|
||||
b$ = SPACE$(2): GET #UiEditorFile, OffsetNewDataFromPreview, b$
|
||||
IF CVI(b$) = -1 THEN __UI_Focus = 0
|
||||
b$ = MKI$(0): PUT #UiEditorFile, OffsetNewDataFromPreview, b$
|
||||
IF CVI(b$) = -1 THEN
|
||||
__UI_Focus = 0
|
||||
b$ = MKI$(0): PUT #UiEditorFile, OffsetNewDataFromPreview, b$
|
||||
END IF
|
||||
|
||||
b$ = SPACE$(4): GET #UiEditorFile, OffsetTotalControlsSelected, b$
|
||||
TotalSelected = CVL(b$)
|
||||
|
@ -836,27 +847,6 @@ SUB __UI_BeforeUpdateDisplay
|
|||
UpdateColorPreview __UI_Controls(ColorPropertiesListID).Value, ThisColor, ThisBackColor
|
||||
END IF
|
||||
|
||||
'Check if the editor is still alive
|
||||
$IF WIN THEN
|
||||
DIM hnd&, b&, ExitCode&
|
||||
hnd& = OpenProcess(&H400, 0, UiPreviewPID)
|
||||
b& = GetExitCodeProcess(hnd&, ExitCode&)
|
||||
IF b& = 1 AND ExitCode& = 259 THEN
|
||||
'Preview is active.
|
||||
__UI_Controls(__UI_GetID("ViewMenuPreview")).Disabled = __UI_True
|
||||
ELSE
|
||||
'Preview was closed.
|
||||
__UI_Controls(__UI_GetID("ViewMenuPreview")).Disabled = __UI_False
|
||||
END IF
|
||||
b& = CloseHandle(hnd&)
|
||||
$ELSE
|
||||
IF PROCESS_CLOSED(UiPreviewPID, 0) THEN
|
||||
__UI_Controls(__UI_GetID("ViewMenuPreview")).Disabled = __UI_False
|
||||
ELSE
|
||||
__UI_Controls(__UI_GetID("ViewMenuPreview")).Disabled = __UI_True
|
||||
END IF
|
||||
$END IF
|
||||
|
||||
MidRead = __UI_False
|
||||
CLOSE #UiEditorFile
|
||||
END IF
|
||||
|
@ -915,6 +905,8 @@ SUB __UI_OnLoad
|
|||
ColorPropertiesListID = __UI_GetID("ColorPropertiesList")
|
||||
ColorPreviewID = __UI_GetID("ColorPreview")
|
||||
|
||||
PreviewAttached = __UI_True
|
||||
|
||||
IF _FILEEXISTS("UiEditorPreview.frmbin") THEN KILL "UiEditorPreview.frmbin"
|
||||
IF _FILEEXISTS("UiEditor.dat") THEN KILL "UiEditor.dat"
|
||||
|
||||
|
@ -923,20 +915,28 @@ SUB __UI_OnLoad
|
|||
IF _FILEEXISTS("UiEditorPreview.bas") = 0 THEN
|
||||
GOTO UiEditorPreviewNotFound
|
||||
ELSE
|
||||
b$ = "Compiling Preview component..."
|
||||
GOSUB ShowMessage
|
||||
SHELL "qb64.exe -x UiEditorPreview.bas"
|
||||
IF _FILEEXISTS("UiEditorPreview.exe") = 0 THEN GOTO UiEditorPreviewNotFound
|
||||
END IF
|
||||
END IF
|
||||
b$ = "Launching..."
|
||||
GOSUB ShowMessage
|
||||
SHELL _DONTWAIT "UiEditorPreview.exe"
|
||||
$ELSE
|
||||
IF _FILEEXISTS("UiEditorPreview") = 0 THEN
|
||||
IF _FILEEXISTS("UiEditorPreview.bas") = 0 THEN
|
||||
GOTO UiEditorPreviewNotFound
|
||||
ELSE
|
||||
b$ = "Compiling Preview component..."
|
||||
GOSUB ShowMessage
|
||||
SHELL "./qb64 -x UiEditorPreview.bas"
|
||||
IF _FILEEXISTS("UiEditorPreview") = 0 THEN GOTO UiEditorPreviewNotFound
|
||||
END IF
|
||||
END IF
|
||||
b$ = "Launching..."
|
||||
GOSUB ShowMessage
|
||||
SHELL _DONTWAIT "./UiEditorPreview"
|
||||
$END IF
|
||||
|
||||
|
@ -946,10 +946,20 @@ SUB __UI_OnLoad
|
|||
PUT #UiEditorFile, OffsetEditorPID, b$
|
||||
CLOSE #UiEditorFile
|
||||
|
||||
TIMER(CheckPreviewTimer) ON
|
||||
|
||||
EXIT SUB
|
||||
UiEditorPreviewNotFound:
|
||||
i = __UI_MessageBox("UiEditorPreview component not found or failed to load.", "UiEditor", __UI_MsgBox_OkOnly + __UI_MsgBox_Critical)
|
||||
SYSTEM
|
||||
|
||||
ShowMessage:
|
||||
_DEST 0
|
||||
CLS , __UI_DefaultColor(__UI_Type_Form, 2)
|
||||
COLOR __UI_DefaultColor(__UI_Type_Form, 1), _RGBA32(0, 0, 0, 0)
|
||||
_PRINTSTRING (_WIDTH \ 2 - _PRINTWIDTH(b$) \ 2, _HEIGHT \ 2 - _FONTHEIGHT \ 2), b$
|
||||
_DISPLAY
|
||||
RETURN
|
||||
END SUB
|
||||
|
||||
SUB __UI_KeyPress (id AS LONG)
|
||||
|
@ -964,7 +974,7 @@ SUB __UI_KeyPress (id AS LONG)
|
|||
SELECT CASE TempValue
|
||||
CASE 1, 2, 3 'Name, caption, text
|
||||
b$ = MKL$(LEN(__UI_Texts(PropertyValueID))) + __UI_Texts(PropertyValueID)
|
||||
CASE 4, 5, 6, 7 'Top, left, width, hegiht
|
||||
CASE 4, 5, 6, 7 'Top, left, width, height
|
||||
b$ = MKI$(VAL(__UI_Texts(PropertyValueID)))
|
||||
CASE 8 'Font
|
||||
CASE 9 'BackStyle
|
||||
|
@ -1393,3 +1403,76 @@ SUB QuickColorPreview (ThisColor AS _UNSIGNED LONG)
|
|||
__UI_Controls(ColorPreviewID).PreviousValue = 0 'Force update
|
||||
END SUB
|
||||
|
||||
SUB CheckPreview
|
||||
'Check if the preview window is still alive
|
||||
DIM b$, UiEditorFile AS INTEGER
|
||||
|
||||
UiEditorFile = FREEFILE
|
||||
OPEN "UiEditor.dat" FOR BINARY AS #UiEditorFile
|
||||
b$ = SPACE$(4): GET #UiEditorFile, OffsetPreviewPID, b$
|
||||
CLOSE #UiEditorFile
|
||||
UiPreviewPID = CVL(b$)
|
||||
$IF WIN THEN
|
||||
DIM hnd&, b&, c&, ExitCode&
|
||||
IF UiPreviewPID > 0 THEN
|
||||
hnd& = OpenProcess(&H400, 0, UiPreviewPID)
|
||||
b& = GetExitCodeProcess(hnd&, ExitCode&)
|
||||
c& = CloseHandle(hnd&)
|
||||
IF b& = 1 AND ExitCode& = 259 THEN
|
||||
'Preview is active.
|
||||
__UI_Controls(__UI_GetID("ViewMenuPreview")).Disabled = __UI_True
|
||||
ELSE
|
||||
'Preview was closed.
|
||||
TIMER(__UI_EventsTimer) OFF
|
||||
__UI_Controls(__UI_GetID("ViewMenuPreview")).Disabled = __UI_False
|
||||
__UI_WaitMessage = "Reloading preview window..."
|
||||
OPEN "UiEditor.dat" FOR BINARY AS #UiEditorFile
|
||||
b$ = MKL$(0): PUT #UiEditorFile, OffsetPreviewPID, b$
|
||||
CLOSE #UiEditorFile
|
||||
UiPreviewPID = 0
|
||||
SHELL _DONTWAIT "UiEditorPreview.exe"
|
||||
__UI_LastInputReceived = 0 'Make the "Please wait" message show up immediataly
|
||||
DO
|
||||
_LIMIT 10
|
||||
OPEN "UiEditor.dat" FOR BINARY AS #UiEditorFile
|
||||
b$ = SPACE$(4)
|
||||
GET #UiEditorFile, OffsetPreviewPID, b$
|
||||
CLOSE #UiEditorFile
|
||||
LOOP UNTIL CVL(b$) > 0
|
||||
|
||||
UiPreviewPID = CVL(b$)
|
||||
|
||||
TIMER(__UI_EventsTimer) ON
|
||||
END IF
|
||||
END IF
|
||||
$ELSE
|
||||
IF UiPreviewPID > 0 THEN
|
||||
IF PROCESS_CLOSED(UiPreviewPID, 0) THEN
|
||||
'Preview was closed.
|
||||
TIMER(__UI_EventsTimer) OFF
|
||||
__UI_Controls(__UI_GetID("ViewMenuPreview")).Disabled = __UI_False
|
||||
__UI_WaitMessage = "Reloading preview window..."
|
||||
OPEN "UiEditor.dat" FOR BINARY AS #UiEditorFile
|
||||
b$ = MKL$(0): PUT #UiEditorFile, OffsetPreviewPID, b$
|
||||
CLOSE #UiEditorFile
|
||||
UiPreviewPID = 0
|
||||
SHELL _DONTWAIT "./UiEditorPreview"
|
||||
__UI_LastInputReceived = 0 'Make the "Please wait" message show up immediataly
|
||||
DO
|
||||
_LIMIT 10
|
||||
OPEN "UiEditor.dat" FOR BINARY AS #UiEditorFile
|
||||
b$ = SPACE$(4)
|
||||
GET #UiEditorFile, OffsetPreviewPID, b$
|
||||
CLOSE #UiEditorFile
|
||||
LOOP UNTIL CVL(b$) > 0
|
||||
|
||||
UiPreviewPID = CVL(b$)
|
||||
|
||||
TIMER(__UI_EventsTimer) ON
|
||||
ELSE
|
||||
'Preview is active.
|
||||
__UI_Controls(__UI_GetID("ViewMenuPreview")).Disabled = __UI_True
|
||||
END IF
|
||||
END IF
|
||||
$END IF
|
||||
END SUB
|
||||
|
|
10
UiEditor.frm
10
UiEditor.frm
|
@ -32,6 +32,12 @@ SUB __UI_LoadForm
|
|||
__UI_NewID = __UI_NewControl(__UI_Type_MenuItem, "ViewMenuPreview", 56, 18, 0, 40, __UI_GetID("ViewMenu"))
|
||||
__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_MenuItem, "HelpMenuHelp", 0, 0, 0, 0, __UI_GetID("HelpMenu"))
|
||||
__UI_SetCaption "HelpMenuHelp", "&What's all this?"
|
||||
|
||||
|
@ -78,7 +84,7 @@ SUB __UI_LoadForm
|
|||
__UI_SetCaption "PropertiesFrame", "Control properties: Form1"
|
||||
__UI_Controls(__UI_NewID).HasBorder = __UI_True
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_DropdownList, "PropertiesList", 174, 21, 20, 20, __UI_GetID("PropertiesFrame"))
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_DropdownList, "PropertiesList", 174, 23, 20, 20, __UI_GetID("PropertiesFrame"))
|
||||
__UI_AddListBoxItem "PropertiesList", "Name"
|
||||
__UI_AddListBoxItem "PropertiesList", "Caption"
|
||||
__UI_AddListBoxItem "PropertiesList", "Text"
|
||||
|
@ -182,7 +188,7 @@ SUB __UI_LoadForm
|
|||
__UI_Controls(__UI_NewID).Interval = 25
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_TextBox, "GreenValue", 36, 23, 400, 70, __UI_GetID("ColorMixer"))
|
||||
__UI_Controls(__UI_NewID).BorderColor = _RGB32(0, 200, 0)
|
||||
__UI_Controls(__UI_NewID).BorderColor = _RGB32(0, 180, 0)
|
||||
__UI_Controls(__UI_NewID).HasBorder = __UI_True
|
||||
__UI_Controls(__UI_NewID).CanHaveFocus = __UI_True
|
||||
|
||||
|
|
|
@ -16,6 +16,8 @@ CONST OffsetFirstSelectedID = 27
|
|||
CONST OffsetPropertyChanged = 31
|
||||
CONST OffsetPropertyValue = 33
|
||||
|
||||
DIM SHARED UiPreviewPID AS LONG
|
||||
|
||||
$IF WIN THEN
|
||||
DECLARE DYNAMIC LIBRARY "kernel32"
|
||||
FUNCTION OpenProcess& (BYVAL dwDesiredAccess AS LONG, BYVAL bInheritHandle AS LONG, BYVAL dwProcessId AS LONG)
|
||||
|
@ -79,6 +81,14 @@ SUB __UI_BeforeUpdateDisplay
|
|||
|
||||
SavePreview
|
||||
|
||||
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
|
||||
|
||||
|
@ -115,33 +125,48 @@ SUB __UI_BeforeUpdateDisplay
|
|||
$END IF
|
||||
|
||||
'New control:
|
||||
DIM ThisContainer AS LONG, TempWidth AS INTEGER, TempHeight AS INTEGER
|
||||
b$ = SPACE$(2): GET #UiEditorFile, OffsetNewControl, b$
|
||||
TempValue = CVI(b$)
|
||||
b$ = MKI$(0): PUT #UiEditorFile, OffsetNewControl, b$
|
||||
IF TempValue > 0 THEN
|
||||
IF __UI_Controls(__UI_Controls(__UI_FirstSelectedID).ParentID).Type = __UI_Type_Frame THEN
|
||||
ThisContainer = __UI_Controls(__UI_FirstSelectedID).ParentID
|
||||
TempWidth = __UI_Controls(__UI_Controls(__UI_FirstSelectedID).ParentID).Width
|
||||
TempHeight = __UI_Controls(__UI_Controls(__UI_FirstSelectedID).ParentID).Height
|
||||
ELSEIF __UI_Controls(__UI_FirstSelectedID).Type = __UI_Type_Frame THEN
|
||||
ThisContainer = __UI_Controls(__UI_FirstSelectedID).ID
|
||||
TempWidth = __UI_Controls(__UI_FirstSelectedID).Width
|
||||
TempHeight = __UI_Controls(__UI_FirstSelectedID).Height
|
||||
ELSE
|
||||
TempWidth = __UI_Controls(__UI_FormID).Width
|
||||
TempHeight = __UI_Controls(__UI_FormID).Height
|
||||
END IF
|
||||
SELECT CASE TempValue
|
||||
CASE __UI_Type_Button
|
||||
TempValue = __UI_NewControl(__UI_Type_Button, "", 80, 23, _WIDTH \ 2 - 40, _HEIGHT \ 2 - 12, 0)
|
||||
TempValue = __UI_NewControl(__UI_Type_Button, "", 80, 23, TempWidth \ 2 - 40, TempHeight \ 2 - 12, ThisContainer)
|
||||
CASE __UI_Type_Label, __UI_Type_CheckBox, __UI_Type_RadioButton
|
||||
TempValue = __UI_NewControl(TempValue, "", 150, 23, _WIDTH \ 2 - 75, _HEIGHT \ 2 - 12, 0)
|
||||
TempValue = __UI_NewControl(TempValue, "", 150, 23, TempWidth \ 2 - 75, TempHeight \ 2 - 12, ThisContainer)
|
||||
__UI_SetCaption __UI_Controls(TempValue).Name, RTRIM$(__UI_Controls(TempValue).Name)
|
||||
CASE __UI_Type_TextBox
|
||||
TempValue = __UI_NewControl(__UI_Type_TextBox, "", 120, 23, _WIDTH \ 2 - 60, _HEIGHT \ 2 - 12, 0)
|
||||
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, "")
|
||||
__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
|
||||
TempValue = __UI_NewControl(__UI_Type_ListBox, "", 200, 200, _WIDTH \ 2 - 100, _HEIGHT \ 2 - 100, 0)
|
||||
TempValue = __UI_NewControl(__UI_Type_ListBox, "", 200, 200, TempWidth \ 2 - 100, TempHeight \ 2 - 100, ThisContainer)
|
||||
__UI_Controls(TempValue).HasBorder = __UI_True
|
||||
CASE __UI_Type_DropdownList
|
||||
TempValue = __UI_NewControl(__UI_Type_DropdownList, "", 200, 23, _WIDTH \ 2 - 100, _HEIGHT \ 2 - 12, 0)
|
||||
TempValue = __UI_NewControl(__UI_Type_DropdownList, "", 200, 23, TempWidth \ 2 - 100, TempHeight \ 2 - 12, ThisContainer)
|
||||
CASE __UI_Type_TrackBar
|
||||
TempValue = __UI_NewControl(__UI_Type_TrackBar, "", 300, 45, _WIDTH \ 2 - 150, _HEIGHT \ 2 - 23, 0)
|
||||
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, _WIDTH \ 2 - 150, _HEIGHT \ 2 - 12, 0)
|
||||
TempValue = __UI_NewControl(__UI_Type_ProgressBar, "", 300, 23, TempWidth \ 2 - 150, TempHeight \ 2 - 12, ThisContainer)
|
||||
CASE __UI_Type_PictureBox, __UI_Type_Frame
|
||||
TempValue = __UI_NewControl(TempValue, "", 230, 150, _WIDTH \ 2 - 115, _HEIGHT \ 2 - 75, 0)
|
||||
IF TempValue = __UI_Type_Frame THEN __UI_SetCaption __UI_Controls(TempValue).Name, RTRIM$(__UI_Controls(TempValue).Name)
|
||||
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)
|
||||
__UI_SetCaption __UI_Controls(TempValue).Name, RTRIM$(__UI_Controls(TempValue).Name)
|
||||
END SELECT
|
||||
FOR i = 1 TO UBOUND(__UI_Controls)
|
||||
__UI_Controls(i).ControlIsSelected = __UI_False
|
||||
|
@ -214,6 +239,7 @@ SUB __UI_BeforeUpdateDisplay
|
|||
END IF
|
||||
NEXT
|
||||
ELSE
|
||||
IF TempValue < 20 THEN TempValue = 20
|
||||
__UI_Controls(__UI_FormID).Width = TempValue
|
||||
END IF
|
||||
CASE 7 'Height
|
||||
|
@ -227,6 +253,7 @@ SUB __UI_BeforeUpdateDisplay
|
|||
END IF
|
||||
NEXT
|
||||
ELSE
|
||||
IF TempValue < 20 THEN TempValue = 20
|
||||
__UI_Controls(__UI_FormID).Height = TempValue
|
||||
END IF
|
||||
CASE 8 'Font
|
||||
|
@ -402,14 +429,10 @@ SUB __UI_BeforeUnload
|
|||
END SUB
|
||||
|
||||
SUB __UI_OnLoad
|
||||
DIM b$, UiEditorFile AS INTEGER
|
||||
DIM b$
|
||||
__UI_DesignMode = __UI_True
|
||||
|
||||
UiEditorFile = FREEFILE
|
||||
OPEN "UiEditor.dat" FOR BINARY AS #UiEditorFile
|
||||
b$ = MKL$(__UI_GetPID)
|
||||
PUT #UiEditorFile, OffsetPreviewPID, b$
|
||||
CLOSE #UiEditorFile
|
||||
UiPreviewPID = __UI_GetPID
|
||||
|
||||
LoadPreview
|
||||
END SUB
|
||||
|
|
31
xp.uitheme
31
xp.uitheme
|
@ -1041,7 +1041,7 @@ SUB __UI_DrawFrame (This AS __UI_ControlTYPE)
|
|||
__UI_ClearColor ControlImage, 0, 0
|
||||
END IF
|
||||
|
||||
IF This.ChildrenRedrawn OR __UI_Captions(This.ID) <> __UI_TempCaptions(This.ID) OR This.HelperCanvas = 0 OR (__UI_IsDragging AND __UI_Controls(__UI_DraggingID).ParentID = This.ID) OR This.Value <> This.PreviousValue OR __UI_ForceRedraw THEN
|
||||
IF This.ChildrenRedrawn OR __UI_Captions(This.ID) <> __UI_TempCaptions(This.ID) OR This.HelperCanvas = 0 OR (__UI_IsDragging AND __UI_Controls(__UI_DraggingID).ParentID = This.ID) OR This.Value <> This.PreviousValue OR __UI_ForceRedraw OR __UI_DesignMode THEN
|
||||
'Last time we drew this frame its children had different images
|
||||
This.ChildrenRedrawn = __UI_False
|
||||
This.PreviousValue = This.Value
|
||||
|
@ -1194,6 +1194,15 @@ END SUB
|
|||
SUB __UI_DrawMenuPanel (This AS __UI_ControlTYPE, ControlState AS _BYTE)
|
||||
DIM PrevDest AS LONG, CaptionIndent AS INTEGER, TempCaption$
|
||||
|
||||
DIM CheckMarkIndex AS _BYTE
|
||||
STATIC ControlImage AS LONG
|
||||
CONST CheckMarkWidth = 7
|
||||
CONST CheckMarkHeight = 7
|
||||
IF ControlImage = 0 THEN
|
||||
ControlImage = __UI_LoadThemeImage("menucheckmark.bmp")
|
||||
__UI_ClearColor ControlImage, 0, 0
|
||||
END IF
|
||||
|
||||
IF This.Value <> This.PreviousValue OR This.FocusState <> (__UI_Focus = This.ID) OR This.ControlState <> ControlState OR __UI_ForceRedraw THEN
|
||||
'Last time this control was drawn it had a different state/caption, so it'll be redrawn
|
||||
This.FocusState = (__UI_Focus = This.ID)
|
||||
|
@ -1230,12 +1239,15 @@ SUB __UI_DrawMenuPanel (This AS __UI_ControlTYPE, ControlState AS _BYTE)
|
|||
IF __UI_Focus = i OR (__UI_HoveringID = i AND __UI_Focus = i) THEN
|
||||
LINE (3, __UI_Controls(i).Top)-STEP(This.Width - 7, __UI_Controls(i).Height - 1), This.SelectedBackColor, BF
|
||||
c = This.SelectedForeColor
|
||||
CheckMarkIndex = 2
|
||||
ELSE
|
||||
c = This.ForeColor
|
||||
CheckMarkIndex = 1
|
||||
END IF
|
||||
|
||||
IF __UI_Controls(i).Disabled THEN
|
||||
c = __UI_Darken(__UI_Controls(__UI_FormID).BackColor, 80)
|
||||
CheckMarkIndex = 3
|
||||
END IF
|
||||
|
||||
COLOR c
|
||||
|
@ -1246,6 +1258,11 @@ SUB __UI_DrawMenuPanel (This AS __UI_ControlTYPE, ControlState AS _BYTE)
|
|||
'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
|
||||
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)
|
||||
END IF
|
||||
END IF
|
||||
NEXT
|
||||
'---
|
||||
|
@ -1321,8 +1338,18 @@ FUNCTION __UI_ImageData$ (File$)
|
|||
DIM A$
|
||||
|
||||
SELECT CASE LCASE$(File$)
|
||||
CASE "menucheckmark.bmp"
|
||||
A$ = MKI$(7) + MKI$(21) 'Width, Height
|
||||
A$ = A$ + "o3`ooo?0oooo0looo3`ooo?0oooo0loo0000oo?0oooo0looo3`ooo?0oooo0loo0000o3000l?000`oo3`ooo?0oooo0loo0000"
|
||||
A$ = A$ + "o3000l?000`o0000o3000loo0loo0000o3000l?000`oo3`oo3000l?000`o0000o3000l?000`oo3`ooo?0oooo0loo0000o300"
|
||||
A$ = A$ + "0l?000`oo3`ooo?0oooo0looo3`ooo?0oo?000`oo3`ooo?0oooo0looo3`ooo?0oooo0looo3`ooo?0oooo0looo3`ooooooooo"
|
||||
A$ = A$ + "0looo3`ooo?0oooo0looo3`ooooooooooooooooooo?0oooo0looo3`oooooooooooooooooooooooooooooo3`ooooooooooooo"
|
||||
A$ = A$ + "oooooo?0oooooooooooooooooooooooooooooo?0oooo0looo3`ooooooooooooooooooo?0oooo0looo3`ooo?0oooo0loooooo"
|
||||
A$ = A$ + "oo?0oooo0looo3`ooo?0oooo0looo3`ooo?0oooo0looo3`ooo?0oo_ZVNjoo3`ooo?0oooo0looo3`ooo?0oo_ZVNjoZJjYo[ZY"
|
||||
A$ = A$ + "Wnoo0looo3`ooo?0oo_ZVNjoZJjYo[ZYWn_ZVNjoZJjYoo?0oo_ZVNjoZJjYo[ZYWnoo0looZJjYo[ZYWn_ZVNjoZJjYo[ZYWnoo"
|
||||
A$ = A$ + "0looo3`ooo?0oo_ZVNjoZJjYo[ZYWnoo0looo3`ooo?0oooo0looo3`oo[ZYWnoo0looo3`ooo?0oooo0loo%%%0"
|
||||
CASE "slidertrack.png"
|
||||
A$ = MKI$(5) + MKI$(5) 'Width, Height
|
||||
A$ = MKI$(5) + MKI$(5)
|
||||
A$ = A$ + "EcMgoc;`0oOVLfiodS?nok>meoO[a:ko7g\coWNlboOlfOoog[_noCiUHn?i[cnoY7_lo[^lco_onkooIb9WoG]eFo?h]3ooaKom"
|
||||
A$ = A$ + "oO_njoocCCmom:l`oooooo?mhSoo^COm%%o3"
|
||||
CASE "frame.png"
|
||||
|
|
Loading…
Reference in a new issue