Le 20/10/2015 18:42, stepharo a écrit : > for the mooc videos I must use larger fonts. > So I ended up hacking and changing the hardcoded number in default > > defaultRowHeight > ^ 24 > > rowHeight > "This is the row height your rows will have. Cells answered in > dataSource will be forced to have > this height number... We force it instead allowing lists to have > any height because the logic to > calculate rows becomes complicated. Possible, but complicated :)" > > ^ rowHeight ifNil: [ self class defaultRowHeight ] > > > Esteban two questions: > > - when I read the code of FTmorph I was thinking that a lot of it has > not much to do with UI but looks like a model :). > > - if I were about to manage the height of a row based on its actual > contents where should I put it. > FTTableContainerMorph is containing what is visible but I wonder why it > was asking this to the FastTable and to the elements displayed? > > Why the ContainerMorph does not ask the FTTableRowMorph for its height > and it could be computed based on the font. > I still did not get where the strings built. > > > may be here > > updateExposedRows > > ... > > | cell | > cell := (self owner dataSource > cellColumn: (columns at: columnIndex) > row: rowIndex). > cell width: (columnWidths at: columnIndex). > > We should add more comments to methods. > > > Stef > > > > drawOn: canvas > | x y cellWidth cellHeight rowsToDisplay rowSubviews > highligtedRowIndexes primarySelectionIndex | > > self bounds ifNil: [ ^ self ]. "Nothing to show yet" > self owner ifNil: [ ^ self ]. > > x := self left + self class rowLeftMargin. > y := self top. > cellWidth := self width - self class rowLeftMargin. > cellHeight := self owner rowHeight. > ^^^^^^^^^^^^^^^^^^^^^^^ > > highligtedRowIndexes := > self owner selectedRowIndexes, > self owner highlightedRowIndexes. > primarySelectionIndex := self owner selectedRowIndex. > > "For some superweird reason, calling #calculateExposedRows here > instead in #changed (where > it should be called) is 10x faster. Since the whole purpose of this > component is speed, for > now I'm calling it here and adding the #setNeedRecalculateRows > mechanism. > History, please forgive me." > self updateAllRows. > > rowsToDisplay := self exposedRows. > rowSubviews := OrderedCollection new: rowsToDisplay size + 1. > headerRow ifNotNil: [ > headerRow bounds: (x@y extent: cellWidth@cellHeight). > y := y + cellHeight + self owner intercellSpacing. > rowSubviews add: headerRow ]. > > rowsToDisplay keysAndValuesDo: [ :rowIndex :row | | visibleHeight | > visibleHeight := cellHeight min: (self bottom - y). > row bounds: (x@y extent: cellWidth@visibleHeight). > y := y + visibleHeight + self owner intercellSpacing. > rowSubviews add: ((highligtedRowIndexes includes: rowIndex) > ifTrue: [ > "IMPORTANT: I need to set owner to nil because otherwise > it will trigger an > invalidation of the owner when adding morph to > selectionMorph, causing an > infinite loop" > self > toSelectionRow: (row privateOwner: nil) > primary: primarySelectionIndex = rowIndex ] > ifFalse: [ row ]) ]. > > submorphs := rowSubviews asArray. > super drawOn: canvas. > needsRefreshExposedRows := false > If you load the development version of FT it will be fine normally :) Maybe not perfect for now but usable with large fonts. (You have to close and reopen the existing FT if you change font size because the change is hard coded and not announce).
I adapted also the FTFastTableComposer so that it manage the font size. -- Cyril Ferlicot http://www.synectique.eu 165 Avenue Bretagne Lille 59000 France
signature.asc
Description: OpenPGP digital signature
