Skip to content

Commit e468076

Browse files
ACI0104098 report in v20.x (code factorisation AND back to expression)
1 parent 069c3a7 commit e468076

File tree

7 files changed

+118
-174
lines changed

7 files changed

+118
-174
lines changed
Lines changed: 5 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,7 @@
1-
var $pict : Picture
2-
var $url; $menu; $result : Text
3-
var $_formulas : Collection
1+
//ACI0104098 code factorisation AND back to expression
2+
var $action : Text
43

5-
If (Form:C1466.selection#Null:C1517)
6-
7-
WP GET ATTRIBUTES:C1345(Form:C1466.selection; wk image url:K81:218; $url)
8-
$_formulas:=WP Get formulas:C1702(Form:C1466.selection)
9-
10-
$menu:=Create menu:C408
11-
12-
If ($_formulas.length>0)
13-
APPEND MENU ITEM:C411($menu; Get localized string:C991("editImageFormula"))
14-
SET MENU ITEM PARAMETER:C1004($menu; -1; "insertFormula")
15-
16-
Else
17-
If ($url#"") & ($url#"data:@")
18-
APPEND MENU ITEM:C411($menu; Get localized string:C991("editImageURL"))
19-
SET MENU ITEM PARAMETER:C1004($menu; -1; "editURL")
20-
Else
21-
APPEND MENU ITEM:C411($menu; ak standard action title:K76:83)
22-
SET MENU ITEM PROPERTY:C973($menu; -1; Associated standard action:K56:1; "insertImage")
23-
24-
APPEND MENU ITEM:C411($menu; Get localized string:C991("insertImageURL"))
25-
SET MENU ITEM PARAMETER:C1004($menu; -1; "insertURL")
26-
27-
APPEND MENU ITEM:C411($menu; Get localized string:C991("insertImageFormula"))
28-
SET MENU ITEM PARAMETER:C1004($menu; -1; "insertFormula")
29-
End if
30-
End if
31-
32-
$result:=Dynamic pop up menu:C1006($menu)
33-
34-
Case of
35-
: ($result="insertURL")
36-
$url:=Request:C163(Get localized string:C991("URLhyphen"))
37-
38-
If (ok=1)
39-
WP INSERT PICTURE:C1437(Form:C1466.selection; $pict; wk replace:K81:177)
40-
WP SET ATTRIBUTES:C1342(Form:C1466.selection; wk image url:K81:218; $url)
41-
End if
42-
43-
: ($result="editURL")
44-
45-
$url:=Request:C163(Get localized string:C991("URLhyphen"); $url)
46-
If (ok=1)
47-
WP SET ATTRIBUTES:C1342(Form:C1466.selection; wk image url:K81:218; $url)
48-
End if
49-
50-
: ($result="insertFormula")
51-
52-
//WP_Set4Dexpression
53-
WP_SetFormula
54-
End case
55-
56-
RELEASE MENU:C978($menu)
57-
58-
4+
$action:=MENU_Display("Image")
5+
If ($action#"")
6+
MENU_Execute($action) //pictureInsertURL or pictureEditURL or pictureInsertFormula
597
End if
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11

22
//WP_SetFormula
3-
WP_Set4Dexpression //ACI0104058
3+
WP_Set4Dexpression //ACI0104058
4+
5+
Lines changed: 5 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,7 @@
1-
var $pict : Picture
2-
var $url; $menu; $result : Text
3-
var $_formulas : Collection
1+
//ACI0104098 code factorisation AND back to expression
2+
var $action : Text
43

5-
If (Form:C1466.selection#Null:C1517)
6-
7-
WP GET ATTRIBUTES:C1345(Form:C1466.selection; wk image url:K81:218; $url)
8-
$_formulas:=WP Get formulas:C1702(Form:C1466.selection)
9-
10-
$menu:=Create menu:C408
11-
12-
If ($_formulas.length>0)
13-
APPEND MENU ITEM:C411($menu; Get localized string:C991("editImageFormula"))
14-
SET MENU ITEM PARAMETER:C1004($menu; -1; "insertFormula")
15-
16-
Else
17-
If ($url#"") & ($url#"data:@")
18-
APPEND MENU ITEM:C411($menu; Get localized string:C991("editImageURL"))
19-
SET MENU ITEM PARAMETER:C1004($menu; -1; "editURL")
20-
Else
21-
APPEND MENU ITEM:C411($menu; ak standard action title:K76:83)
22-
SET MENU ITEM PROPERTY:C973($menu; -1; Associated standard action:K56:1; "insertImage")
23-
24-
APPEND MENU ITEM:C411($menu; Get localized string:C991("insertImageURL"))
25-
SET MENU ITEM PARAMETER:C1004($menu; -1; "insertURL")
26-
27-
APPEND MENU ITEM:C411($menu; Get localized string:C991("insertImageFormula"))
28-
SET MENU ITEM PARAMETER:C1004($menu; -1; "insertFormula")
29-
End if
30-
End if
31-
32-
$result:=Dynamic pop up menu:C1006($menu)
33-
34-
Case of
35-
: ($result="insertURL")
36-
$url:=Request:C163(Get localized string:C991("URLhyphen"))
37-
38-
If (ok=1)
39-
WP INSERT PICTURE:C1437(Form:C1466.selection; $pict; wk replace:K81:177)
40-
WP SET ATTRIBUTES:C1342(Form:C1466.selection; wk image url:K81:218; $url)
41-
End if
42-
43-
: ($result="editURL")
44-
45-
$url:=Request:C163(Get localized string:C991("URLhyphen"); $url)
46-
If (ok=1)
47-
WP SET ATTRIBUTES:C1342(Form:C1466.selection; wk image url:K81:218; $url)
48-
End if
49-
50-
: ($result="insertFormula")
51-
52-
//WP_Set4Dexpression
53-
WP_SetFormula
54-
End case
55-
56-
RELEASE MENU:C978($menu)
57-
58-
4+
$action:=MENU_Display("Image")
5+
If ($action#"")
6+
MENU_Execute($action) //pictureInsertURL or pictureEditURL or pictureInsertFormula
597
End if
Lines changed: 5 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,7 @@
1-
var $pict : Picture
2-
var $url; $menu; $result : Text
3-
var $_formulas : Collection
1+
//ACI0104098 code factorisation AND back to expression
2+
var $action : Text
43

5-
If (Form:C1466.selection#Null:C1517)
6-
7-
WP GET ATTRIBUTES:C1345(Form:C1466.selection; wk image url:K81:218; $url)
8-
$_formulas:=WP Get formulas:C1702(Form:C1466.selection)
9-
10-
$menu:=Create menu:C408
11-
12-
If ($_formulas.length>0)
13-
APPEND MENU ITEM:C411($menu; Get localized string:C991("editImageFormula"))
14-
SET MENU ITEM PARAMETER:C1004($menu; -1; "insertFormula")
15-
16-
Else
17-
If ($url#"") & ($url#"data:@")
18-
APPEND MENU ITEM:C411($menu; Get localized string:C991("editImageURL"))
19-
SET MENU ITEM PARAMETER:C1004($menu; -1; "editURL")
20-
Else
21-
APPEND MENU ITEM:C411($menu; ak standard action title:K76:83)
22-
SET MENU ITEM PROPERTY:C973($menu; -1; Associated standard action:K56:1; "insertImage")
23-
24-
APPEND MENU ITEM:C411($menu; Get localized string:C991("insertImageURL"))
25-
SET MENU ITEM PARAMETER:C1004($menu; -1; "insertURL")
26-
27-
APPEND MENU ITEM:C411($menu; Get localized string:C991("insertImageFormula"))
28-
SET MENU ITEM PARAMETER:C1004($menu; -1; "insertFormula")
29-
End if
30-
End if
31-
32-
$result:=Dynamic pop up menu:C1006($menu)
33-
34-
Case of
35-
: ($result="insertURL")
36-
$url:=Request:C163(Get localized string:C991("URLhyphen"))
37-
38-
If (ok=1)
39-
WP INSERT PICTURE:C1437(Form:C1466.selection; $pict; wk replace:K81:177)
40-
WP SET ATTRIBUTES:C1342(Form:C1466.selection; wk image url:K81:218; $url)
41-
End if
42-
43-
: ($result="editURL")
44-
45-
$url:=Request:C163(Get localized string:C991("URLhyphen"); $url)
46-
If (ok=1)
47-
WP SET ATTRIBUTES:C1342(Form:C1466.selection; wk image url:K81:218; $url)
48-
End if
49-
50-
: ($result="insertFormula")
51-
52-
//WP_Set4Dexpression
53-
WP_SetFormula
54-
End case
55-
56-
RELEASE MENU:C978($menu)
57-
58-
4+
$action:=MENU_Display("Image")
5+
If ($action#"")
6+
MENU_Execute($action) //pictureInsertURL or pictureEditURL or pictureInsertFormula
597
End if

Project/Sources/Methods/MENU_Display.4dm

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@
44
//var $1; $content : Text
55
//var $0 : Text
66

7-
var $menu; $action; $item : Text
7+
var $menu; $action; $item; $url : Text
88
var $_menuItems; $_tables : Collection
99
var $o : Object
10+
var $_formulas : Collection
1011

1112
If (Count parameters:C259>=1)
1213
$content:=$1
@@ -210,6 +211,38 @@ Case of
210211
SET MENU ITEM PROPERTY:C973($menu; -1; Associated standard action name:K28:8; "textBox/remove")
211212

212213

214+
: ($content="Image") //ACI0104098
215+
216+
217+
If (Form:C1466.selection#Null:C1517)
218+
219+
WP GET ATTRIBUTES:C1345(Form:C1466.selection; wk image url:K81:218; $url)
220+
$_formulas:=WP Get formulas:C1702(Form:C1466.selection)
221+
222+
If ($_formulas.length>0)
223+
oForm.imageSource:=$_formulas[0].formula.source // //ACI0104098
224+
225+
APPEND MENU ITEM:C411($menu; Get localized string:C991("editImageFormula"))
226+
SET MENU ITEM PARAMETER:C1004($menu; -1; "pictureInsertFormula")
227+
228+
Else
229+
If ($url#"") & ($url#"data:@")
230+
oForm.imageURL:=$url
231+
APPEND MENU ITEM:C411($menu; Get localized string:C991("editImageURL"))
232+
SET MENU ITEM PARAMETER:C1004($menu; -1; "pictureEditURL")
233+
Else
234+
APPEND MENU ITEM:C411($menu; ak standard action title:K76:83)
235+
SET MENU ITEM PROPERTY:C973($menu; -1; Associated standard action:K56:1; "insertImage") // no ITEM PARAMETER IN THIS CASE
236+
237+
APPEND MENU ITEM:C411($menu; Get localized string:C991("insertImageURL"))
238+
SET MENU ITEM PARAMETER:C1004($menu; -1; "pictureInsertURL")
239+
240+
APPEND MENU ITEM:C411($menu; Get localized string:C991("insertImageFormula"))
241+
SET MENU ITEM PARAMETER:C1004($menu; -1; "pictureInsertFormula")
242+
End if
243+
End if
244+
245+
End if
213246
End case
214247

215248
$action:=Dynamic pop up menu:C1006($menu)

Project/Sources/Methods/MENU_Execute.4dm

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@ var $area : Object
1313
var $ptr : Pointer
1414

1515
var $prompt; $path; $action; $rawText; $extension; $form; $memoErrorMethod; $formName : Text
16-
var $title; $docName; $folderPath; $propertyName : Text
16+
var $title; $docName; $folderPath; $propertyName; $url : Text
1717

18+
var $pict : Picture // empty pict to be used with URL
1819

1920
If (OB Is defined:C1231(Form:C1466; "areaPointer")) && (OB Is defined:C1231(Form:C1466; "area"))
2021

@@ -433,6 +434,40 @@ If (OB Is defined:C1231(Form:C1466; "areaPointer")) && (OB Is defined:C1231(Form
433434
End for each
434435

435436
End case
437+
438+
: ($action="picture@") //ACI0104098
439+
440+
Case of
441+
: ($action="pictureInsertURL")
442+
$url:=Request:C163(Get localized string:C991("URLhyphen"))
443+
444+
If (ok=1)
445+
WP INSERT PICTURE:C1437(Form:C1466.selection; $pict; wk replace:K81:177)
446+
WP SET ATTRIBUTES:C1342(Form:C1466.selection; wk image url:K81:218; $url)
447+
End if
448+
449+
: ($action="pictureEditURL")
450+
451+
$url:=oForm.imageURL
452+
$url:=Request:C163(Get localized string:C991("URLhyphen"); $url)
453+
If (ok=1)
454+
WP SET ATTRIBUTES:C1342(Form:C1466.selection; wk image url:K81:218; $url)
455+
End if
456+
457+
: ($action="pictureInsertFormula")
458+
459+
//ACI0104098 back to expression
460+
If (Form:C1466.selection.type=0)
461+
WP_Set4Dexpression
462+
Else
463+
WP_SetImageExpression
464+
End if
465+
466+
End case
467+
468+
469+
470+
436471
End case
437472

438473
Else
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
//%attributes = {"invisible":true}
2+
var $trueExpression : Text
3+
var $ptr : Pointer
4+
var $n : Integer
5+
6+
$trueExpression:=oForm.imageSource
7+
// the formula is displayed with virtual structure
8+
// parse to real structure before edit
9+
10+
11+
If (Not:C34(Is nil pointer:C315(masterTable))) // 27 sept 2018 (was not used before!)
12+
$ptr:=masterTable
13+
Else
14+
$ptr:=Current form table:C627
15+
If (Is nil pointer:C315($ptr))
16+
// RL 2019/12/02 : check for available table in database
17+
GET TABLE TITLES:C803($_titles; $_nums)
18+
$n:=Size of array:C274($_nums)
19+
If ($n>0)
20+
$ptr:=Table:C252($_nums{1})
21+
End if
22+
End if
23+
End if
24+
25+
If (Not:C34(Is nil pointer:C315($ptr)))
26+
EDIT FORMULA:C806($ptr->; $trueExpression)
27+
If (ok=1)
28+
WP SET ATTRIBUTES:C1342(Form:C1466.selection; wk image expression:K81:258; $trueExpression)
29+
End if
30+
End if

0 commit comments

Comments
 (0)