1
1
Fork 0
mirror of https://github.com/FellippeHeitor/InForm.git synced 2025-01-15 03:49:56 +00:00

Adds "Convert Type" to UiEditor's Edit menu.

This commit is contained in:
FellippeHeitor 2018-08-18 21:16:47 -03:00
parent 02817799b1
commit 8bbbed6353
4 changed files with 53 additions and 1 deletions

View file

@ -26,7 +26,7 @@ DIM SHARED EditMenuUndo AS LONG, EditMenuRedo AS LONG, EditMenuCut AS LONG
DIM SHARED EditMenuCopy AS LONG, EditMenuPaste AS LONG DIM SHARED EditMenuCopy AS LONG, EditMenuPaste AS LONG
DIM SHARED EditMenuDelete AS LONG, EditMenuSelectAll AS LONG DIM SHARED EditMenuDelete AS LONG, EditMenuSelectAll AS LONG
DIM SHARED EditMenuCP437 AS LONG, EditMenuCP1252 AS LONG DIM SHARED EditMenuCP437 AS LONG, EditMenuCP1252 AS LONG
DIM SHARED EditMenuSetDefaultButton AS LONG DIM SHARED EditMenuConvertType AS LONG, EditMenuSetDefaultButton AS LONG
DIM SHARED EditMenuRestoreDimensions AS LONG DIM SHARED EditMenuRestoreDimensions AS LONG
DIM SHARED EditMenuAllowMinMax AS LONG, EditMenuZOrdering AS LONG DIM SHARED EditMenuAllowMinMax AS LONG, EditMenuZOrdering AS LONG
@ -289,6 +289,9 @@ SUB __UI_Click (id AS LONG)
CheckUpdates = NOT CheckUpdates CheckUpdates = NOT CheckUpdates
Control(id).Value = CheckUpdates Control(id).Value = CheckUpdates
SaveSettings SaveSettings
CASE EditMenuConvertType
b$ = MKI$(0)
SendData b$, 225
CASE EditMenuSetDefaultButton CASE EditMenuSetDefaultButton
SendSignal -6 SendSignal -6
CASE EditMenuRestoreDimensions CASE EditMenuRestoreDimensions
@ -670,6 +673,8 @@ SUB __UI_MouseEnter (id AS LONG)
Caption(StatusBar) = "Applies code page 437 to the current form." Caption(StatusBar) = "Applies code page 437 to the current form."
CASE EditMenuCP1252 CASE EditMenuCP1252
Caption(StatusBar) = "Applies code page 1252 to the current form." Caption(StatusBar) = "Applies code page 1252 to the current form."
CASE EditMenuConvertType
Caption(StatusBar) = "Converts this control's type into another similar in functionality."
CASE EditMenuSetDefaultButton CASE EditMenuSetDefaultButton
Caption(StatusBar) = "Makes the currently selected button the default button." Caption(StatusBar) = "Makes the currently selected button the default button."
CASE EditMenuRestoreDimensions CASE EditMenuRestoreDimensions
@ -1223,6 +1228,8 @@ SUB __UI_BeforeUpdateDisplay
Control(InsertMenuMenuItem).Disabled = True Control(InsertMenuMenuItem).Disabled = True
END IF END IF
Control(EditMenuConvertType).Disabled = True
SetCaption EditMenuConvertType, "Co&nvert type"
Control(EditMenuSetDefaultButton).Disabled = True Control(EditMenuSetDefaultButton).Disabled = True
Control(EditMenuSetDefaultButton).Value = False Control(EditMenuSetDefaultButton).Value = False
Control(EditMenuAllowMinMax).Disabled = True Control(EditMenuAllowMinMax).Disabled = True
@ -1305,6 +1312,11 @@ SUB __UI_BeforeUpdateDisplay
IF INSTR(PreviewControls(FirstSelected).Name, "NumericTextBox") = 0 THEN Caption(ControlProperties) = "Control properties (Type = NumericTextBox):" IF INSTR(PreviewControls(FirstSelected).Name, "NumericTextBox") = 0 THEN Caption(ControlProperties) = "Control properties (Type = NumericTextBox):"
END IF END IF
END IF END IF
IF __UI_Type(PreviewControls(FirstSelected).Type).TurnsInto THEN
Control(EditMenuConvertType).Disabled = False
SetCaption EditMenuConvertType, "Co&nvert to " + RTRIM$(__UI_Type(__UI_Type(PreviewControls(FirstSelected).Type).TurnsInto).Name)
END IF
END IF END IF
ELSEIF TotalSelected = 2 THEN ELSEIF TotalSelected = 2 THEN
@ -1325,6 +1337,7 @@ SUB __UI_BeforeUpdateDisplay
Control(AlignMenuDistributeV).Disabled = True Control(AlignMenuDistributeV).Disabled = True
Control(AlignMenuDistributeH).Disabled = True Control(AlignMenuDistributeH).Disabled = True
GOTO EnableConvertMenuItem
ELSE ELSE
SetCaption ControlProperties, "Control properties: (multiple selection)" SetCaption ControlProperties, "Control properties: (multiple selection)"
@ -1343,6 +1356,24 @@ SUB __UI_BeforeUpdateDisplay
Control(AlignMenuDistributeV).Disabled = False Control(AlignMenuDistributeV).Disabled = False
Control(AlignMenuDistributeH).Disabled = False Control(AlignMenuDistributeH).Disabled = False
EnableConvertMenuItem:
IF __UI_Type(PreviewControls(FirstSelected).Type).TurnsInto THEN
DIM SearchType AS INTEGER, EnableConvertMenuItemCheck AS _BYTE
SearchType = PreviewControls(FirstSelected).Type
EnableConvertMenuItemCheck = True
FOR i = 1 TO UBOUND(PreviewControls)
IF PreviewControls(i).ControlIsSelected THEN
IF PreviewControls(i).Type <> SearchType THEN
EnableConvertMenuItemCheck = False
EXIT FOR
END IF
END IF
NEXT
IF EnableConvertMenuItemCheck THEN
Control(EditMenuConvertType).Disabled = False
SetCaption EditMenuConvertType, "Co&nvert to " + RTRIM$(__UI_Type(__UI_Type(PreviewControls(FirstSelected).Type).TurnsInto).Name)
END IF
END IF
END IF END IF
IF FirstSelected = 0 THEN FirstSelected = PreviewFormID IF FirstSelected = 0 THEN FirstSelected = PreviewFormID
@ -3121,6 +3152,8 @@ SUB LoadPreview
PreviewControls(Dummy).BulletStyle = __UI_Bullet PreviewControls(Dummy).BulletStyle = __UI_Bullet
CASE -41 CASE -41
PreviewControls(Dummy).AutoScroll = True PreviewControls(Dummy).AutoScroll = True
CASE -42
PreviewControls(Dummy).ControlIsSelected = True
CASE -1 'new control CASE -1 'new control
EXIT DO EXIT DO
CASE -1024 CASE -1024

View file

@ -110,6 +110,10 @@ SUB __UI_LoadForm
SetCaption __UI_NewID, "Use code page &Windows-1252-" SetCaption __UI_NewID, "Use code page &Windows-1252-"
Control(__UI_NewID).BulletStyle = __UI_Bullet Control(__UI_NewID).BulletStyle = __UI_Bullet
__UI_NewID = __UI_NewControl(__UI_Type_MenuItem, "EditMenuConvertType", 103, 18, 0, 88, __UI_GetID("EditMenu"))
SetCaption __UI_NewID, "Co&nvert type"
Control(__UI_NewID).Disabled = True
__UI_NewID = __UI_NewControl(__UI_Type_MenuItem, "EditMenuSetDefaultButton", 103, 18, 0, 88, __UI_GetID("EditMenu")) __UI_NewID = __UI_NewControl(__UI_Type_MenuItem, "EditMenuSetDefaultButton", 103, 18, 0, 88, __UI_GetID("EditMenu"))
SetCaption __UI_NewID, "Set as &default button" SetCaption __UI_NewID, "Set as &default button"
Control(__UI_NewID).Disabled = True Control(__UI_NewID).Disabled = True
@ -816,4 +820,5 @@ SUB __UI_AssignIDs
FontSwitchMenu = __UI_GetID("FontSwitchMenu") FontSwitchMenu = __UI_GetID("FontSwitchMenu")
AutoScroll = __UI_GetID("AutoScroll") AutoScroll = __UI_GetID("AutoScroll")
PasteListBT = __UI_GetID("PasteListBT") PasteListBT = __UI_GetID("PasteListBT")
EditMenuConvertType = __UI_GetID("EditMenuConvertType")
END SUB END SUB

View file

@ -979,6 +979,8 @@ SUB __UI_BeforeUpdateDisplay
CASE 223 CASE 223
b$ = ReadSequential$(Property$, 2) b$ = ReadSequential$(Property$, 2)
AlternateNumericOnlyProperty AlternateNumericOnlyProperty
CASE 225
ConvertControlToAlternativeType
END SELECT END SELECT
__UI_ForceRedraw = True __UI_ForceRedraw = True
LOOP LOOP
@ -1990,6 +1992,8 @@ SUB LoadPreview (Destination AS _BYTE)
Control(TempValue).BulletStyle = __UI_Bullet Control(TempValue).BulletStyle = __UI_Bullet
CASE -41 CASE -41
Control(TempValue).AutoScroll = True Control(TempValue).AutoScroll = True
CASE -42
'ControlIsSelected; ignored;
CASE -1 'new control CASE -1 'new control
IF LogFileLoad THEN PRINT #LogFileNum, "READ NEW CONTROL: -1" IF LogFileLoad THEN PRINT #LogFileNum, "READ NEW CONTROL: -1"
EXIT DO EXIT DO
@ -2700,6 +2704,14 @@ SUB SavePreview (Destination AS _BYTE)
Clip$ = Clip$ + b$ Clip$ = Clip$ + b$
END IF END IF
END IF END IF
IF Control(i).ControlIsSelected THEN
b$ = MKI$(-42)
IF Disk THEN
'Don't save this property (design time only)
ELSE
Clip$ = Clip$ + b$
END IF
END IF
END IF END IF
NEXT NEXT
NEXT NEXT

View file

@ -76,5 +76,7 @@ FOR EACH CONTROL (FORM INCLUDED):
INTEGER -40 (BulletStyle = __UI_Bullet) INTEGER -40 (BulletStyle = __UI_Bullet)
INTEGER -41 (AutoScroll = True) INTEGER -41 (AutoScroll = True)
For ListBox controls For ListBox controls
INTEGER -42 ControlIsSelected
(doesn't get saved; used at design time only)
------------------- -------------------
INTEGER -1024 (End of file) INTEGER -1024 (End of file)