Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
vdelachaux committed Dec 20, 2024
1 parent d24aaa5 commit 278815f
Show file tree
Hide file tree
Showing 2 changed files with 89 additions and 65 deletions.
126 changes: 80 additions & 46 deletions Project/Sources/Classes/_EDITOR_Controller.4dm
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ property stringSplitter; lockButton : cs:C1710.button
property detail; searchPicker : cs:C1710.subform
property fileList; stringList : cs:C1710.listbox
property strings; locked; withFile : cs:C1710.group
property spinner : cs:C1710.stepper

// MARK: Constants 🔐
property FILE_EXTENSION:=".xlf"
Expand All @@ -39,6 +40,8 @@ property default; main; resources : Object

property groupPtr; resnamePtr; contentPtr : Pointer

property stringListConstraints : cs:C1710.constraints

Class constructor($mainLanguage : Text)

// MARK:Delegates 📦
Expand Down Expand Up @@ -149,6 +152,23 @@ Function init()
// MARK: Search Picker
This:C1470.searchPicker:=This:C1470.form.Subform("searchPicker"; {}; This:C1470)

This:C1470.spinner:=This:C1470.form.Stepper("spinner")

// MARK: Constraints
This:C1470.stringListConstraints:=This:C1470.form.constraints

This:C1470.stringListConstraints.add({\
target: "spinner"; \
type: "horizontal-alignment"; \
alignment: "center"; \
reference: "stringList"})

This:C1470.stringListConstraints.add({\
target: "wrap"; \
type: "horizontal-alignment"; \
alignment: "center"; \
reference: "stringList"})

// === === === === === === === === === === === === === === === === === === === === === === === ===
Function handleEvents($e : cs:C1710.evt)

Expand Down Expand Up @@ -206,51 +226,61 @@ Function handleEvents($e : cs:C1710.evt)
//______________________________________________________
End case

Else
return

// MARK: Widget Methods
Case of

//==============================================
: (This:C1470.fileList.catch($e))

This:C1470._fileListManager($e)

//==============================================
: (This:C1470.stringList.catch($e))

This:C1470._stringListManager($e)

//==============================================
: (This:C1470.newFile.catch($e))

This:C1470.newFileManager()

//==============================================
: (This:C1470.newGroup.catch($e))

This:C1470.newGroupManager()

//==============================================
: (This:C1470.newString.catch($e))

This:C1470.newStringManager()

//==============================================
: (This:C1470.lockButton.catch($e))

This:C1470.deDuplicateIDs()

//==============================================
: (This:C1470.stringSplitter.catch($e))

This:C1470.strings.center(True:C214)
This:C1470.locked.center(True:C214)

//==============================================
End case
End if

If ($e.objectName="stringSplitter")

This:C1470.stringListConstraints.apply()

return

End if

// MARK: Widget Methods
Case of

//==============================================
: (This:C1470.fileList.catch($e))

This:C1470._fileListManager($e)

//==============================================
: (This:C1470.stringList.catch($e))

This:C1470._stringListManager($e)

//==============================================
: (This:C1470.newFile.catch($e))

This:C1470.newFileManager()

//==============================================
: (This:C1470.newGroup.catch($e))

This:C1470.newGroupManager()

//==============================================
: (This:C1470.newString.catch($e))

This:C1470.newStringManager()

//==============================================
: (This:C1470.lockButton.catch($e))

This:C1470.deDuplicateIDs()

//==============================================
: (This:C1470.stringSplitter.catch($e))

This:C1470.strings.center(True:C214)
This:C1470.locked.center(True:C214)

//==============================================
End case


// === === === === === === === === === === === === === === === === === === === === === === === ===
Function onLoad()

Expand Down Expand Up @@ -288,13 +318,13 @@ Function onLoad()
borderColor: 0x00C0C0C0\
}

This:C1470.spinner.start(True:C214)

This:C1470.form.refresh()

// === === === === === === === === === === === === === === === === === === === === === === === ===
Function update()

var $c : Collection

If (This:C1470.fileList.item=Null:C1517) && (This:C1470.fileList.rowsNumber>0)

// Select last used file
Expand All @@ -303,15 +333,15 @@ Function update()
If ($o#Null:C1517)\
&& (Length:C16(String:C10($o.file))>0)

$c:=Form:C1466.files.indices("name = :1"; $o.file)
var $c : Collection:=Form:C1466.files.indices("name = :1"; $o.file)

End if

This:C1470.doSelectFile($c.length>0 ? $c[0]+1 : 1)

End if

var $isWritable : Boolean:=Not:C34(Bool:C1537(This:C1470.current.duplicateID))
var $isWritable:=Not:C34(Bool:C1537(This:C1470.current.duplicateID))

This:C1470.strings.show(This:C1470.current.error=Null:C1517)
This:C1470.newString.enable((This:C1470.stringList.item#Null:C1517) & $isWritable)
Expand Down Expand Up @@ -465,6 +495,8 @@ Function _fileListManager($e : cs:C1710.evt)
//______________________________________________________
: ($e.code=On Selection Change:K2:29)

This:C1470.spinner.start(True:C214)

This:C1470.stringList.unselect()
This:C1470.stringList.item:=Null:C1517

Expand Down Expand Up @@ -1781,6 +1813,8 @@ Function _LOAD_STRINGS()
// Reset resname color
This:C1470.stringList.resetForegroundColor(2)

This:C1470.spinner.stop(True:C214)

This:C1470.locked.show($main.duplicateID)
This:C1470.form.refresh()

Expand Down
28 changes: 9 additions & 19 deletions Project/Sources/Forms/EDITOR/form.4DForm
Original file line number Diff line number Diff line change
Expand Up @@ -429,15 +429,6 @@
"class": "dev",
"style": "flat"
},
"wait": {
"type": "picture",
"top": 170,
"left": 186,
"width": 128,
"height": 128,
"picture": "/RESOURCES/Images/wait.gif",
"visibility": "hidden"
},
"searchPicker": {
"type": "subform",
"left": 597,
Expand All @@ -452,6 +443,14 @@
"dataSourceTypeHint": "undefined",
"sizingX": "move",
"method": "subformWidgetMethod"
},
"spinner": {
"type": "spinner",
"left": 245,
"top": 105,
"width": 32,
"height": 32,
"visibility": "hidden"
}
},
"entryOrder": [
Expand Down Expand Up @@ -486,23 +485,14 @@
"lockMessage",
"lockButton"
]
},
"wait": {
"visible": false,
"objects": [
"wait"
]
},
"widget": {
"visible": false
}
}
},
"$4d": {
"version": "1",
"kind": "form"
},
"geometryStamp": 943,
"geometryStamp": 982,
"method": "formMethod",
"memorizeGeometry": true
}

0 comments on commit 278815f

Please sign in to comment.