Skip to content

Commit

Permalink
fix typo in C code generated to open listview gadget
Browse files Browse the repository at this point in the history
add support for LALIGN_CENTER in layout (horizontal and vertical)
save expanded state of nodes in project file
save currently selected gadget in project file
fix issue with 'show settings on add' setting not getting saved to project file correctly
add undo/redo capability
  • Loading branch information
dmcoles committed Jul 15, 2024
1 parent 2b52389 commit d26a573
Show file tree
Hide file tree
Showing 12 changed files with 296 additions and 136 deletions.
6 changes: 3 additions & 3 deletions cSourceGen.e
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
OPT MODULE,LARGE

MODULE 'images/drawlist'
MODULE '*fileStreamer','*sourceGen','*reactionObject','*windowObject','*menuObject','*stringlist','*screenObject'
MODULE '*baseStreamer','*sourceGen','*reactionObject','*windowObject','*menuObject','*stringlist','*screenObject'
MODULE '*chooserObject','*clickTabObject','*radioObject','*listBrowserObject','*tabsObject','*reactionListObject',
'*drawListObject','*speedBarObject','*listViewObject','*rexxObject','*requesterObject'

Expand All @@ -10,7 +10,7 @@ ENDOBJECT

ENUM ENUM_IDS, ENUM_IDENTS, ENUM_IDXS

PROC create(fser:PTR TO fileStreamer, libsused:PTR TO CHAR,definitionOnly,useIds,useMacros) OF cSrcGen
PROC create(fser:PTR TO baseStreamer, libsused:PTR TO CHAR,definitionOnly,useIds,useMacros) OF cSrcGen
SUPER self.create(fser,libsused,definitionOnly,useIds,useMacros)
self.type:=CSOURCE_GEN
self.stringDelimiter:=34
Expand Down Expand Up @@ -734,7 +734,7 @@ PROC genHeader(screenObject:PTR TO screenObject,rexxObject:PTR TO rexxObject, re
ENDIF

IF self.libsused[TYPE_LISTVIEW]
self.writeLine(' if( !(ListViewBase = (struct Library*) OpenLibrary("gadgest/listview.gadget",0L) ) ) return 0;')
self.writeLine(' if( !(ListViewBase = (struct Library*) OpenLibrary("gadgets/listview.gadget",0L) ) ) return 0;')
ENDIF

IF self.libsused[TYPE_VIRTUAL]
Expand Down
6 changes: 3 additions & 3 deletions drawListObject.e
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ OPT MODULE, OSVERSION=37
'exec/nodes',
'amigalib/lists'

MODULE '*reactionObject','*reactionForm','*colourPicker','*fileStreamer','*sourceGen','*stringlist','*validator'
MODULE '*reactionObject','*reactionForm','*colourPicker','*baseStreamer','*sourceGen','*stringlist','*validator'

EXPORT ENUM DRAWLISTGAD_IDENT, DRAWLISTGAD_LIST,DRAWLISTGAD_ADD, DRAWLISTGAD_EDIT, DRAWLISTGAD_DEL,
DRAWLISTGAD_OK, DRAWLISTGAD_CHILD, DRAWLISTGAD_CANCEL
Expand Down Expand Up @@ -705,7 +705,7 @@ EXPORT PROC getTypeName() OF drawListObject
RETURN 'DrawList'
ENDPROC

EXPORT PROC serialise(fser:PTR TO fileStreamer) OF drawListObject
EXPORT PROC serialise(fser:PTR TO baseStreamer) OF drawListObject
DEF tempStr[200]:STRING
DEF drawItem:PTR TO drawlist
DEF i
Expand All @@ -731,7 +731,7 @@ EXPORT PROC serialise(fser:PTR TO fileStreamer) OF drawListObject
self.serialiseChildren(fser)
ENDPROC

EXPORT PROC deserialise(fser:PTR TO fileStreamer) OF drawListObject
EXPORT PROC deserialise(fser:PTR TO baseStreamer) OF drawListObject
DEF tempStr[200]:STRING
DEF done=FALSE
DEF i
Expand Down
4 changes: 2 additions & 2 deletions eSourceGen.e
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ OPT MODULE,LARGE
OPT MODULE,LARGE

MODULE 'images/drawlist','gadgets/tabs'
MODULE '*fileStreamer','*sourceGen','*reactionObject','*menuObject','*windowObject','*stringlist','*screenObject'
MODULE '*baseStreamer','*sourceGen','*reactionObject','*menuObject','*windowObject','*stringlist','*screenObject'
MODULE '*chooserObject','*clickTabObject','*radioObject','*listBrowserObject','*rexxObject','*tabsObject',
'*reactionListObject','*reactionLists','*drawlistObject','*speedBarObject','*listViewObject','*requesterObject'

Expand All @@ -11,7 +11,7 @@ ENDOBJECT

ENUM ENUM_IDS, ENUM_IDENTS, ENUM_IDXS

PROC create(fser:PTR TO fileStreamer,libsused,definitionOnly,useIds,useMacros) OF eSrcGen
PROC create(fser:PTR TO baseStreamer,libsused,definitionOnly,useIds,useMacros) OF eSrcGen
SUPER self.create(fser,libsused,definitionOnly,useIds,useMacros)
self.type:=ESOURCE_GEN
self.stringDelimiter:=39
Expand Down
8 changes: 2 additions & 6 deletions fileStreamer.e
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
OPT MODULE,OSVERSION=37

MODULE 'dos/dos'
MODULE '*baseStreamer'

EXPORT OBJECT fileStreamer
EXPORT OBJECT fileStreamer OF baseStreamer
PRIVATE
fname:PTR TO CHAR
fh:LONG
Expand Down Expand Up @@ -40,8 +41,3 @@ PROC readLine(outStr:PTR TO CHAR) OF fileStreamer
IF (l>0) AND (outStr[l-1]="\n") THEN outStr[l-1]:=0
ENDIF
ENDPROC r

PROC read(outStr:PTR TO CHAR, len) OF fileStreamer
DEF r
r:=Fread(self.fh,outStr,1,len)
ENDPROC r
14 changes: 7 additions & 7 deletions layoutObject.e
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ EXPORT PROC createPreviewObject(scr) OF layoutObject
LAYOUT_RIGHTSPACING, self.rightSpacing,
LAYOUT_BOTTOMSPACING, self.bottomSpacing,
LAYOUT_ORIENTATION, ListItem([LAYOUT_ORIENT_HORIZ,LAYOUT_ORIENT_VERT],self.orientation),
LAYOUT_HORIZALIGNMENT, ListItem([LALIGN_LEFT, LALIGN_RIGHT],self.horizAlignment),
LAYOUT_VERTALIGNMENT, ListItem([LALIGN_TOP, LALIGN_BOTTOM],self.vertAlignment),
LAYOUT_HORIZALIGNMENT, ListItem([LALIGN_LEFT, LALIGN_RIGHT, LALIGN_CENTER],self.horizAlignment),
LAYOUT_VERTALIGNMENT, ListItem([LALIGN_TOP, LALIGN_BOTTOM, LALIGN_CENTER],self.vertAlignment),
LAYOUT_BEVELSTYLE, ListItem([BVS_NONE, BVS_THIN, BVS_BUTTON, BVS_GROUP, BVS_FIELD, BVS_DROPBOX, BVS_SBAR_HORIZ,BVS_SBAR_VERT,BVS_BOX,BVS_RADIOBUTTON,BVS_STANDARD],self.bevelStyle),
LAYOUT_BEVELSTATE, ListItem([IDS_NORMAL,IDS_SELECTED,IDS_DISABLED],self.bevelState),
LAYOUT_LABEL,self.label,
Expand Down Expand Up @@ -208,7 +208,7 @@ PROC create() OF layoutSettingsForm
CHOOSER_MAXLABELS, 12,
CHOOSER_ACTIVE, 0,
CHOOSER_WIDTH, -1,
CHOOSER_LABELS, self.labels2:=chooserLabelsA(['LALIGN_LEFT', 'LALIGN_RIGHT',0]),
CHOOSER_LABELS, self.labels2:=chooserLabelsA(['LALIGN_LEFT', 'LALIGN_RIGHT','LALIGN_CENTER',0]),
ChooserEnd,
CHILD_LABEL, LabelObject,
LABEL_TEXT, 'HorzAlignment',
Expand All @@ -221,7 +221,7 @@ PROC create() OF layoutSettingsForm
CHOOSER_MAXLABELS, 12,
CHOOSER_ACTIVE, 0,
CHOOSER_WIDTH, -1,
CHOOSER_LABELS, self.labels3:=chooserLabelsA(['LALIGN_TOP', 'LALIGN_BOTTOM',0]),
CHOOSER_LABELS, self.labels3:=chooserLabelsA(['LALIGN_TOP', 'LALIGN_BOTTOM','LALIGN_CENTER',0]),
ChooserEnd,
CHILD_LABEL, LabelObject,
LABEL_TEXT, 'VertAlignment',
Expand Down Expand Up @@ -600,12 +600,12 @@ EXPORT PROC genCodeProperties(srcGen:PTR TO srcGen) OF layoutObject
srcGen.componentProperty('LAYOUT_Orientation','LAYOUT_ORIENT_HORIZ',FALSE)
ENDIF

IF self.horizAlignment
srcGen.componentProperty('LAYOUT_HorizAlignment','LALIGN_RIGHT',FALSE)
IF self.horizAlignment
srcGen.componentProperty('LAYOUT_HorizAlignment',ListItem(['LALIGN_LEFT', 'LALIGN_RIGHT', 'LALIGN_CENTER'],self.horizAlignment),FALSE)
ENDIF

IF self.vertAlignment
srcGen.componentProperty('LAYOUT_VertAlignment','LALIGN_BOTTOM',FALSE)
srcGen.componentProperty('LAYOUT_VertAlignment',ListItem(['LALIGN_TOP', 'LALIGN_BOTTOM', 'LALIGN_CENTER'],self.vertAlignment),FALSE)
ENDIF

IF self.bevelStyle
Expand Down
26 changes: 16 additions & 10 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ all: rebuild
release: options=$(releaseoptions)
release: rebuild

rebuild: rebuild.e validator.m dialogs.m libraryVersions.m reactionLists.m tabsObject.m sketchboardObject.m virtualObject.m listViewObject.m ledObject.m textEditorObject.m tapeDeckObject.m gradSliderObject.m getColorObject.m dateBrowserObject.m colorWheelObject.m speedBarObject.m sliderObject.m bitmapObject.m penMapObject.m boingBallObject.m getScreenModeObject.m getFontObject.m getFileObject.m textFieldObject.m drawListObject.m fuelGaugeObject.m bevelObject.m listBrowserObject.m clickTabObject.m chooserObject.m radioObject.m menuObject.m rexxObject.m reactionListObject.m listManagerForm.m codeGenForm.m eSourceGen.m cSourceGen.m sourcegen.m fileStreamer.m reactionForm.m objectPicker.m windowObject.m screenObject.m paletteObject.m scrollerObject.m glyphObject.m spaceObject.m integerObject.m labelObject.m checkboxObject.m stringObject.m buttonObject.m layoutObject.m reactionObject.m stringlist.m requesterObject.m
rebuild: rebuild.e validator.m dialogs.m libraryVersions.m reactionLists.m tabsObject.m sketchboardObject.m virtualObject.m listViewObject.m ledObject.m textEditorObject.m tapeDeckObject.m gradSliderObject.m getColorObject.m dateBrowserObject.m colorWheelObject.m speedBarObject.m sliderObject.m bitmapObject.m penMapObject.m boingBallObject.m getScreenModeObject.m getFontObject.m getFileObject.m textFieldObject.m drawListObject.m fuelGaugeObject.m bevelObject.m listBrowserObject.m clickTabObject.m chooserObject.m radioObject.m menuObject.m rexxObject.m reactionListObject.m listManagerForm.m codeGenForm.m eSourceGen.m cSourceGen.m sourcegen.m fileStreamer.m stringStreamer.m baseStreamer.m reactionForm.m objectPicker.m windowObject.m screenObject.m paletteObject.m scrollerObject.m glyphObject.m spaceObject.m integerObject.m labelObject.m checkboxObject.m stringObject.m buttonObject.m layoutObject.m reactionObject.m stringlist.m requesterObject.m
$(compiler) rebuild $(options)

reactionLists.m: reactionLists.e stringlist.m
Expand Down Expand Up @@ -75,13 +75,13 @@ getColorObject.m: getColorObject.e reactionObject.m reactionForm.m sourceGen.m
dateBrowserObject.m: dateBrowserObject.e reactionObject.m reactionForm.m sourceGen.m validator.m
$(compiler) dateBrowserObject $(options)

eSourceGen.m: eSourceGen.e fileStreamer.m sourceGen.m reactionObject.m stringlist.m menuObject.m windowObject.m reactionListObject.m chooserObject.m clickTabObject.m radioObject.m listBrowserObject.m drawListObject.m screenObject.m rexxObject.m speedBarObject.m listViewObject.m tabsObject.m windowObject.m requesterObject.m
eSourceGen.m: eSourceGen.e baseStreamer.m sourceGen.m reactionObject.m stringlist.m menuObject.m windowObject.m reactionListObject.m chooserObject.m clickTabObject.m radioObject.m listBrowserObject.m drawListObject.m screenObject.m rexxObject.m speedBarObject.m listViewObject.m tabsObject.m windowObject.m requesterObject.m
$(compiler) eSourceGen $(options)

cSourceGen.m: cSourceGen.e fileStreamer.m sourceGen.m reactionObject.m stringlist.m menuObject.m windowObject.m reactionListObject.m chooserObject.m clickTabObject.m radioObject.m listBrowserObject.m drawListObject.m speedBarObject.m rexxObject.m screenObject.m listViewObject.m tabsObject.m windowObject.m requesterObject.m
cSourceGen.m: cSourceGen.e baseStreamer.m sourceGen.m reactionObject.m stringlist.m menuObject.m windowObject.m reactionListObject.m chooserObject.m clickTabObject.m radioObject.m listBrowserObject.m drawListObject.m speedBarObject.m rexxObject.m screenObject.m listViewObject.m tabsObject.m windowObject.m requesterObject.m
$(compiler) cSourceGen $(options)

sourceGen.m: sourceGen.e fileStreamer.m stringlist.m
sourceGen.m: sourceGen.e baseStreamer.m stringlist.m
$(compiler) sourceGen $(options)

layoutObject.m: layoutObject.e reactionObject.m reactionForm.m sourceGen.m validator.m
Expand All @@ -105,10 +105,10 @@ labelObject.m: labelObject.e reactionObject.m reactionForm.m colourPicker.m so
rexxObject.m: rexxObject.e reactionObject.m reactionForm.m stringlist.m
$(compiler) rexxObject $(options)

requesterObject.m: requesterObject.e reactionObject.m reactionForm.m stringlist.m fileStreamer.m
requesterObject.m: requesterObject.e reactionObject.m reactionForm.m stringlist.m baseStreamer.m
$(compiler) requesterObject $(options)

menuObject.m: menuObject.e reactionObject.m reactionForm.m stringlist.m fileStreamer.m dialogs.m
menuObject.m: menuObject.e reactionObject.m reactionForm.m stringlist.m baseStreamer.m dialogs.m
$(compiler) menuObject $(options)

buttonObject.m: buttonObject.e reactionObject.m reactionForm.m colourPicker.m sourceGen.m validator.m
Expand All @@ -135,7 +135,7 @@ textFieldObject.m: textFieldObject.e reactionObject.m reactionForm.m colourPic
tabsObject.m: tabsObject.e reactionObject.m reactionForm.m sourceGen.m stringlist.m listPicker.m reactionLists.m reactionListObject.m validator.m
$(compiler) tabsObject $(options)

drawListObject.m: drawListObject.e reactionObject.m reactionForm.m colourPicker.m sourceGen.m fileStreamer.m stringlist.m validator.m
drawListObject.m: drawListObject.e reactionObject.m reactionForm.m colourPicker.m sourceGen.m baseStreamer.m stringlist.m validator.m
$(compiler) drawListObject $(options)

fuelGaugeObject.m: fuelGaugeObject.e reactionObject.m reactionForm.m colourPicker.m sourceGen.m validator.m
Expand All @@ -162,11 +162,17 @@ listBrowserObject.m: listBrowserObject.e reactionObject.m reactionForm.m listP
clickTabObject.m: clickTabObject.e reactionObject.m reactionForm.m listPicker.m stringlist.m reactionLists.m sourceGen.m reactionListObject.m sourceGen.m validator.m
$(compiler) clickTabObject $(options)

reactionListObject.m: reactionListObject.e stringlist.m reactionObject.m fileStreamer.m
reactionListObject.m: reactionListObject.e stringlist.m reactionObject.m baseStreamer.m
$(compiler) reactionListObject $(options)

fileStreamer.m: fileStreamer.e
fileStreamer.m: fileStreamer.e baseStreamer.m
$(compiler) fileStreamer $(options)

stringStreamer.m: stringStreamer.e baseStreamer.m stringlist.m
$(compiler) stringStreamer $(options)

baseStreamer.m: baseStreamer.e
$(compiler) baseStreamer $(options)

dialogs.m: dialogs.e
$(compiler) dialogs $(options)
Expand Down Expand Up @@ -196,4 +202,4 @@ validator.m: validator.e reactionObject.m reactionForm.m stringlist.m dialogs.
$(compiler) validator $(options)

clean:
delete validator.m bitmapObject.m dialogs.m libraryVersions.m tabsObject.m sketchboardObject.m virtualObject.m listViewObject.m ledObject.m textEditorObject.m tapeDeckObject.m gradSliderObject.m getColorObject.m dateBrowserObject.m colorWheelObject.m speedBarObject.m sliderObject.m penMapObject.m boingBallObject.m getScreenModeObject.m getFontObject.m getFileObject.m textFieldObject.m fuelGaugeObject.m drawListObject.m bevelObject.m listBrowserObject.m clickTabObject.m chooserObject.m radioObject.m menuObject.m rexxObject.m reactionListObject.m listPicker.m reactionForm.m listManagerForm.m codeGenForm.m cSourcegen.m eSourceGen.m sourceGen.m objectPicker.m colourPicker.m fileStreamer.m windowObject.m screenObject.m paletteObject.m scrollerObject.m glyphObject.m spaceObject.m integerObject.m labelObject.m checkboxObject.m stringObject.m buttonObject.m layoutObject.m reactionObject.m reactionLists.m stringlist.m requesterObject.m rebuild
delete validator.m bitmapObject.m dialogs.m libraryVersions.m tabsObject.m sketchboardObject.m virtualObject.m listViewObject.m ledObject.m textEditorObject.m tapeDeckObject.m gradSliderObject.m getColorObject.m dateBrowserObject.m colorWheelObject.m speedBarObject.m sliderObject.m penMapObject.m boingBallObject.m getScreenModeObject.m getFontObject.m getFileObject.m textFieldObject.m fuelGaugeObject.m drawListObject.m bevelObject.m listBrowserObject.m clickTabObject.m chooserObject.m radioObject.m menuObject.m rexxObject.m reactionListObject.m listPicker.m reactionForm.m listManagerForm.m codeGenForm.m cSourcegen.m eSourceGen.m sourceGen.m objectPicker.m colourPicker.m baseStreamer.m fileStreamer.m stringStreamer.m windowObject.m screenObject.m paletteObject.m scrollerObject.m glyphObject.m spaceObject.m integerObject.m labelObject.m checkboxObject.m stringObject.m buttonObject.m layoutObject.m reactionObject.m reactionLists.m stringlist.m requesterObject.m rebuild
6 changes: 3 additions & 3 deletions menuObject.e
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ OPT MODULE, OSVERSION=37
'intuition/gadgetclass',
'exec/lists','exec/nodes'

MODULE '*reactionObject','*reactionForm','*stringlist','*fileStreamer','*dialogs'
MODULE '*reactionObject','*reactionForm','*stringlist','*baseStreamer','*dialogs'

EXPORT ENUM MENUGAD_ITEMLIST, MENUGAD_ITEM_NAME, MENUGAD_ITEM_COMMKEY, MENUGAD_ITEM_TYPE, MENUGAD_ITEM_MENUBAR,
MENUGAD_ITEM_CHECK, MENUGAD_ITEM_TOGGLE, MENUGAD_ITEM_CHECKED, MENUGAD_ITEM_DISABLED, MENUGAD_ITEM_MUTUALGROUP,
Expand Down Expand Up @@ -790,7 +790,7 @@ EXPORT PROC editSettings() OF menuObject
END editForm
ENDPROC res

EXPORT PROC serialise(fser:PTR TO fileStreamer) OF menuObject
EXPORT PROC serialise(fser:PTR TO baseStreamer) OF menuObject
DEF tempStr[200]:STRING
DEF menuItem:PTR TO menuItem
DEF i
Expand Down Expand Up @@ -822,7 +822,7 @@ EXPORT PROC serialise(fser:PTR TO fileStreamer) OF menuObject
self.serialiseChildren(fser)
ENDPROC

EXPORT PROC deserialise(fser:PTR TO fileStreamer) OF menuObject
EXPORT PROC deserialise(fser:PTR TO baseStreamer) OF menuObject
DEF tempStr[200]:STRING
DEF done=FALSE
DEF i
Expand Down
6 changes: 3 additions & 3 deletions reactionListObject.e
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
OPT MODULE

MODULE '*stringlist','*reactionObject','*fileStreamer'
MODULE '*stringlist','*reactionObject','*baseStreamer'

EXPORT OBJECT reactionListObject OF reactionObject
listnode:LONG
Expand All @@ -21,7 +21,7 @@ PROC end() OF reactionListObject
SUPER self.end()
ENDPROC

EXPORT PROC serialise(fser:PTR TO fileStreamer) OF reactionListObject
EXPORT PROC serialise(fser:PTR TO baseStreamer) OF reactionListObject
DEF tempStr[200]:STRING
DEF i

Expand All @@ -36,7 +36,7 @@ EXPORT PROC serialise(fser:PTR TO fileStreamer) OF reactionListObject

ENDPROC

EXPORT PROC deserialise(fser:PTR TO fileStreamer) OF reactionListObject
EXPORT PROC deserialise(fser:PTR TO baseStreamer) OF reactionListObject
DEF tempStr[200]:STRING
DEF done=FALSE
DEF i
Expand Down
6 changes: 6 additions & 0 deletions reactionObject.e
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ EXPORT OBJECT reactionObject
noDispose:CHAR
weightBar:CHAR

expanded:CHAR
tempParentId:INT
drawInfo:LONG
visInfo:LONG
Expand Down Expand Up @@ -491,6 +492,7 @@ EXPORT PROC create(parent) OF reactionObject
scr:=LockPubScreen(NIL)
self.drawInfo:=GetScreenDrawInfo(scr)
self.visInfo:=GetVisualInfoA(scr,[TAG_END])
self.expanded:=self.allowChildren()<>0
UnlockPubScreen(NIL,scr)
ENDPROC

Expand Down Expand Up @@ -634,6 +636,8 @@ EXPORT PROC serialise(fser:PTR TO fileStreamer) OF reactionObject
fser.writeLine(tempStr)
StringF(tempStr,'WEIGHTBAR: \d',self.weightBar)
fser.writeLine(tempStr)
StringF(tempStr,'EXPANDED: \d',self.expanded)
fser.writeLine(tempStr)
fser.writeLine('--')

list:=self.serialiseData()
Expand Down Expand Up @@ -736,6 +740,8 @@ PROC deserialise(fser:PTR TO fileStreamer) OF reactionObject
self.noDispose:=Val(tempStr+STRLEN)
ELSEIF StrCmp('WEIGHTBAR: ',tempStr,STRLEN)
self.weightBar:=Val(tempStr+STRLEN)
ELSEIF StrCmp('EXPANDED: ',tempStr,STRLEN)
self.expanded:=Val(tempStr+STRLEN)
ENDIF
ELSE
done:=TRUE
Expand Down
Loading

0 comments on commit d26a573

Please sign in to comment.