mirror of
https://github.com/FellippeHeitor/InForm.git
synced 2025-01-15 03:49:56 +00:00
Centralizes the detection of control type in the preview component.
Sending .ControlIsSelected was adding too many undesired UndoPointers.
This commit is contained in:
parent
634c8eaab4
commit
cc86ebda32
2 changed files with 39 additions and 30 deletions
|
@ -858,7 +858,7 @@ SUB __UI_BeforeUpdateDisplay
|
|||
DIM thisData$, thisCommand$
|
||||
STATIC OriginalImageWidth AS INTEGER, OriginalImageHeight AS INTEGER
|
||||
STATIC PrevFirstSelected AS LONG, PreviewHasMenuActive AS INTEGER
|
||||
STATIC CheckUpdateDone AS _BYTE
|
||||
STATIC CheckUpdateDone AS _BYTE, ThisControlTurnsInto AS INTEGER
|
||||
STATIC LastChange AS SINGLE
|
||||
|
||||
IF TIMER - BlinkStatusBar < 1 THEN
|
||||
|
@ -1091,6 +1091,8 @@ SUB __UI_BeforeUpdateDisplay
|
|||
OriginalImageWidth = CVI(thisData$)
|
||||
CASE "ORIGINALIMAGEHEIGHT"
|
||||
OriginalImageHeight = CVI(thisData$)
|
||||
CASE "TURNSINTO"
|
||||
ThisControlTurnsInto = CVI(thisData$)
|
||||
CASE "SELECTIONRECTANGLE"
|
||||
PreviewSelectionRectangle = CVI(thisData$)
|
||||
LoseFocus
|
||||
|
@ -1128,6 +1130,14 @@ SUB __UI_BeforeUpdateDisplay
|
|||
END IF
|
||||
END IF
|
||||
|
||||
IF ThisControlTurnsInto > 0 THEN
|
||||
Control(EditMenuConvertType).Disabled = False
|
||||
SetCaption EditMenuConvertType, "Co&nvert to " + RTRIM$(__UI_Type(ThisControlTurnsInto).Name)
|
||||
ELSE
|
||||
Control(EditMenuConvertType).Disabled = True
|
||||
SetCaption EditMenuConvertType, "Co&nvert type"
|
||||
END IF
|
||||
|
||||
DO WHILE LEN(Signal$)
|
||||
'signals -1 and -3 deprecated for now
|
||||
b$ = LEFT$(Signal$, 2)
|
||||
|
@ -1226,8 +1236,6 @@ SUB __UI_BeforeUpdateDisplay
|
|||
Control(InsertMenuMenuItem).Disabled = True
|
||||
END IF
|
||||
|
||||
Control(EditMenuConvertType).Disabled = True
|
||||
SetCaption EditMenuConvertType, "Co&nvert type"
|
||||
Control(EditMenuSetDefaultButton).Disabled = True
|
||||
Control(EditMenuSetDefaultButton).Value = False
|
||||
Control(EditMenuAllowMinMax).Disabled = True
|
||||
|
@ -1310,13 +1318,7 @@ SUB __UI_BeforeUpdateDisplay
|
|||
IF INSTR(PreviewControls(FirstSelected).Name, "NumericTextBox") = 0 THEN Caption(ControlProperties) = "Control properties (Type = NumericTextBox):"
|
||||
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
|
||||
|
||||
ELSEIF TotalSelected = 2 THEN
|
||||
Caption(ControlProperties) = "Control properties: (multiple selection)"
|
||||
|
||||
|
@ -1334,8 +1336,6 @@ SUB __UI_BeforeUpdateDisplay
|
|||
Control(AlignMenuAlignCentersH).Disabled = False
|
||||
Control(AlignMenuDistributeV).Disabled = True
|
||||
Control(AlignMenuDistributeH).Disabled = True
|
||||
|
||||
GOTO EnableConvertMenuItem
|
||||
ELSE
|
||||
SetCaption ControlProperties, "Control properties: (multiple selection)"
|
||||
|
||||
|
@ -1353,25 +1353,6 @@ SUB __UI_BeforeUpdateDisplay
|
|||
Control(AlignMenuAlignCentersH).Disabled = False
|
||||
Control(AlignMenuDistributeV).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
|
||||
|
||||
IF FirstSelected = 0 THEN FirstSelected = PreviewFormID
|
||||
|
|
|
@ -333,6 +333,7 @@ SUB __UI_BeforeUpdateDisplay
|
|||
END IF
|
||||
|
||||
STATIC prevImgWidthSent AS INTEGER, prevImgHeightSent AS INTEGER
|
||||
STATIC prevTurnsInto AS INTEGER
|
||||
IF __UI_FirstSelectedID > 0 THEN
|
||||
IF Control(__UI_FirstSelectedID).Type = __UI_Type_PictureBox AND LEN(Text(__UI_FirstSelectedID)) > 0 THEN
|
||||
IF prevImgWidthSent <> _WIDTH(Control(__UI_FirstSelectedID).HelperCanvas) OR _
|
||||
|
@ -355,6 +356,33 @@ SUB __UI_BeforeUpdateDisplay
|
|||
SendData b$, "ORIGINALIMAGEHEIGHT"
|
||||
END IF
|
||||
END IF
|
||||
|
||||
IF __UI_TotalSelectedControls = 1 THEN
|
||||
IF prevTurnsInto <> __UI_Type(Control(__UI_FirstSelectedID).Type).TurnsInto THEN
|
||||
prevTurnsInto = __UI_Type(Control(__UI_FirstSelectedID).Type).TurnsInto
|
||||
b$ = MKI$(prevTurnsInto)
|
||||
SendData b$, "TURNSINTO"
|
||||
END IF
|
||||
ELSEIF __UI_TotalSelectedControls > 1 THEN
|
||||
DIM SearchType AS INTEGER, AllControlsTurnInto AS _BYTE
|
||||
SearchType = Control(__UI_FirstSelectedID).Type
|
||||
AllControlsTurnInto = True
|
||||
FOR i = 1 TO UBOUND(Control)
|
||||
IF Control(i).ControlIsSelected THEN
|
||||
IF Control(i).Type <> SearchType THEN
|
||||
AllControlsTurnInto = False
|
||||
EXIT FOR
|
||||
END IF
|
||||
END IF
|
||||
NEXT
|
||||
SearchType = __UI_Type(SearchType).TurnsInto
|
||||
IF NOT AllControlsTurnInto THEN SearchType = 0
|
||||
IF prevTurnsInto <> SearchType THEN
|
||||
prevTurnsInto = SearchType
|
||||
b$ = MKI$(prevTurnsInto)
|
||||
SendData b$, "TURNSINTO"
|
||||
END IF
|
||||
END IF
|
||||
END IF
|
||||
|
||||
DO WHILE LEN(Signal$)
|
||||
|
|
Loading…
Reference in a new issue