Skip to content

Commit

Permalink
ACI 0104195 and ACI 0104196
Browse files Browse the repository at this point in the history
  • Loading branch information
Roland-Lannuzel committed Sep 5, 2023
1 parent 5985528 commit 543c1ba
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 45 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ If ($oCurrent#Null:C1517)

Else

ALERT:C41("not available yet ffor this target")
BEEP:C151
//ALERT("Not available yet for this target")

End if
2 changes: 1 addition & 1 deletion Project/Sources/Forms/WP_Palette_Backgrounds/form.4DForm
Original file line number Diff line number Diff line change
Expand Up @@ -751,5 +751,5 @@
"version": "1",
"kind": "form"
},
"geometryStamp": 1595
"geometryStamp": 1603
}
47 changes: 25 additions & 22 deletions Project/Sources/Methods/WP_CopyPasteMenu.4dm
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,6 @@ Else
$hasPasteMenu2:=False:C215
End if

//If ($context="FrameBackground")
//$oSettings2:=(OBJECT Get pointer(Object named;"oSettings2"))->
//If (Not(OB Is empty($oSettings2)))
//$hasPasteMenu2:=True
//Else
//$hasPasteMenu2:=False
//End if
//End if

// get the RANGE according to context ----------------------------------------------------------------------------------------------

Case of
Expand Down Expand Up @@ -123,19 +114,21 @@ Case of
: ($context="Background")

APPEND MENU ITEM:C411($menu; Get localized string:C991("CopyBackground"))
SET MENU ITEM PARAMETER:C1004($menu; -1; "Copy1")
SET MENU ITEM PARAMETER:C1004($menu; -1; "CopyBackground") //<ACI0104195>

If ($hasPasteMenu1)
APPEND MENU ITEM:C411($menu; "(-")
End if

If ($hasPasteMenu1)
APPEND MENU ITEM:C411($menu; Get localized string:C991("PasteBackground"))
SET MENU ITEM PARAMETER:C1004($menu; -1; "Paste1")
SET MENU ITEM PARAMETER:C1004($menu; -1; "PasteBackground") //<ACI0104195>

End if

End case


// call the menu ------------------------------------------------------------------------------------------------------------------------------
$Parameter:=Dynamic pop up menu:C1006($menu)
RELEASE MENU:C978($menu)
Expand Down Expand Up @@ -313,6 +306,11 @@ Case of

: ($context="Background")

$oCurrent:=Form:C1466.selection // 2023/09/05 RL
If (Not:C34(Undefined:C82($oCurrent.container)))
$oCurrent:=$oCurrent.container
End if

CLEAR VARIABLE:C89(oSettings1)

// numeric values
Expand All @@ -335,6 +333,8 @@ Case of
ARRAY TEXT:C222($_attributes; 0)
APPEND TO ARRAY:C911($_attributes; wk background width:K81:27)
APPEND TO ARRAY:C911($_attributes; wk background height:K81:28)
APPEND TO ARRAY:C911($_attributes; wk background image url:K81:220) // <ACI0104195>

$n:=Size of array:C274($_attributes)
For ($i; 1; $n)
WP GET ATTRIBUTES:C1345($oCurrent; $_attributes{$i}; $textValue)
Expand All @@ -344,9 +344,6 @@ Case of
End for
oSettings1:=oSettings1

// +++
(OBJECT Get pointer:C1124(Object named:K67:5; "bgndPictPreviewCopy"))->:=(OBJECT Get pointer:C1124(Object named:K67:5; "bgndPictPreview"))->


End case

Expand All @@ -360,6 +357,20 @@ Case of
Case of
: ($Parameter="Paste1")
$oSettings:=oSettings1

: ($Parameter="PasteBackground") // <ACI0104195>

$oSettings:=oSettings1

$oCurrent:=Form:C1466.selection // 2023/09/05 RL
If (Not:C34(Undefined:C82($oCurrent.container)))
$oCurrent:=$oCurrent.container
Else
If ($oCurrent.type=wk type character:K81:296)
$oCurrent:=WP Paragraph range:C1346(Form:C1466.selection)
End if
End if

: ($Parameter="Paste2")
$oSettings:=oSettings2
End case
Expand Down Expand Up @@ -421,14 +432,6 @@ Case of
End for
End if

If ($context="Background")

//$ptrPreview:=(OBJECT Get pointer(Object named;"bgndPictPreview"))
$ptrPreviewCopy:=(OBJECT Get pointer:C1124(Object named:K67:5; "bgndPictPreviewCopy"))
//$ptrPreview->:=$ptrPreviewCopy->
WP_SetBackgroundPicture($oCurrent; $ptrPreviewCopy->)

End if

SET TIMER:C645(-1)

Expand Down
51 changes: 30 additions & 21 deletions Project/Sources/Methods/WP_GetBackgroundSize.4dm
Original file line number Diff line number Diff line change
Expand Up @@ -22,30 +22,39 @@ If (Not:C34(OB Is empty:C1297($range)))
$refUnit:=oForm.verticalSizeUnits
End if

If ($size="auto") | ($size="cover") | ($size="contain")

OBJECT SET VALUE:C1742($refValue; 0)
$refUnit.index:=$refUnit.css.indexOf($size)
$refUnit.memoUnit:=""

Else // ex 50%, 10mm, 2.5cm, 5in or 120pt

$n:=Length:C16($size)
For ($i; 1; $n)
$char:=$size[[$i]]
If (($char>="0") & ($char<="9")) | ($char=".")
$sizeVal:=$sizeVal+$char
Else
$sizeUnit:=Substring:C12($size; $i)
$i:=$n
End if
End for

// <ACI0104195> NOT multiple units
If ($size#"")

OBJECT SET VALUE:C1742($refValue; Num:C11($sizeVal; "."))
$refUnit.index:=$refUnit.css.indexOf($sizeUnit)
$refUnit.memoUnit:=$refUnit.css[$refUnit.index] // "%","mm","cm","in" or "pt"
// <ACI0104082>
If ($size="auto") | ($size="cover") | ($size="contain")
OBJECT SET VALUE:C1742($refValue; 0)
$refUnit.index:=$refUnit.css.indexOf($size)
$refUnit.memoUnit:=""
Else // ex 50%, 10mm, 2.5cm, 5in or 120pt

$n:=Length:C16($size)
For ($i; 1; $n)
$char:=$size[[$i]]
If (($char>="0") & ($char<="9")) | ($char=".")
$sizeVal:=$sizeVal+$char
Else
$sizeUnit:=Substring:C12($size; $i)
$i:=$n
End if
End for

OBJECT SET VALUE:C1742($refValue; Num:C11($sizeVal; "."))
$refUnit.index:=$refUnit.css.indexOf($sizeUnit)
$refUnit.memoUnit:=$refUnit.css[$refUnit.index] // "%","mm","cm","in" or "pt"

End if
// </ACI0104082>

Else
// multiple units… do nothing.
End if
// </ACI0104195>

End for

Expand Down

0 comments on commit 543c1ba

Please sign in to comment.