Commit da3a144d authored by Diederik van Arkel's avatar Diederik van Arkel
Browse files

consolidate font filtering

parent 6d30fd2f
...@@ -8,7 +8,7 @@ import EdMouse, EdKeyboard ...@@ -8,7 +8,7 @@ import EdMouse, EdKeyboard
from StrictList import slFromList from StrictList import slFromList
from UtilStrictLists import StrictListToList,:: List(:!),IsEmptyList from UtilStrictLists import StrictListToList,:: List(:!),IsEmptyList
import IDE,IdeState,UtilIO import IDE,IdeState,IdePlatform
//-- //--
...@@ -199,19 +199,6 @@ cw_deactivate ps ...@@ -199,19 +199,6 @@ cw_deactivate ps
import morecontrols, colorpickcontrol, ioutil, colourclip import morecontrols, colorpickcontrol, ioutil, colourclip
import StdClipboard import StdClipboard
lisFixedWidth :: .FontName *Picture -> (Bool,*Picture)
lisFixedWidth fontname env
# ((ok,font), env) = openFont {fName=fontname,fSize=12,fStyles=[]} env
| not ok = (ok,env)
# (wide, env) = getFontCharWidth font 'M' env
(narrow, env) = getFontCharWidth font 'i' env
= (wide == narrow, env)
lfilter :: [.Bool] [.a] -> [.a];
lfilter [True:r] [a:x] = [a:lfilter r x]
lfilter [_:r] [_:x] = lfilter r x
lfilter _ _ = []
::CWC_LS = ::CWC_LS =
{ cur :: CWC_CR // current colour { cur :: CWC_CR // current colour
, txt :: Colour , txt :: Colour
...@@ -248,7 +235,8 @@ conswinPane ps ...@@ -248,7 +235,8 @@ conswinPane ps
# (fontNames, ps) # (fontNames, ps)
= accPIO (accScreenPicture getFontNames) ps = accPIO (accScreenPicture getFontNames) ps
// filter fixed width fonts.... // filter fixed width fonts....
# (fixed,ps) = seqList (map (\f->accPIO (accScreenPicture (lisFixedWidth f))) fontNames) ps // # (fixed,ps) = seqList (map (\f->accPIO (accScreenPicture (lisFixedWidth f))) fontNames) ps
# (fixed,ps) = accPIO (accScreenPicture (seqList (map lisFixedWidth fontNames))) ps
# fontNames = lfilter fixed fontNames # fontNames = lfilter fixed fontNames
# fontSizes = [7, 8, 9, 10, 12, 14, 18, 24 ] # fontSizes = [7, 8, 9, 10, 12, 14, 18, 24 ]
# {conswinfont={fName=inifn,fSize=inifs},conswinsync=sync} # {conswinfont={fName=inifn,fSize=inifs},conswinsync=sync}
......
...@@ -4,7 +4,7 @@ import StdTuple, StdEnum, StdList, StdFunc, StdMisc ...@@ -4,7 +4,7 @@ import StdTuple, StdEnum, StdList, StdFunc, StdMisc
import StdMenu, StdWindow, StdId, StdPSt, StdControl import StdMenu, StdWindow, StdId, StdPSt, StdControl
import StdClipboard, StdControlReceiver import StdClipboard, StdControlReceiver
import EdKeyMapping, EdState, EdClient, EdKeyboard import EdKeyMapping, EdState, EdClient, EdKeyboard
import IDE, IdeState, ExtNotice, UtilIO import IDE, IdeState, ExtNotice, IdePlatform
import colorpickcontrol import colorpickcontrol
import ioutil, morecontrols import ioutil, morecontrols
import typewin, colourclip import typewin, colourclip
...@@ -27,21 +27,6 @@ where ...@@ -27,21 +27,6 @@ where
//-- //--
lisFixedWidth :: .FontName *Picture -> (Bool,*Picture)
lisFixedWidth fontname env
# ((ok,font), env) = openFont {fName=fontname,fSize=12,fStyles=[]} env
| not ok = (ok,env)
# (wide, env) = getFontCharWidth font 'M' env
(narrow, env) = getFontCharWidth font 'i' env
= (wide == narrow, env)
lfilter :: [.Bool] [.a] -> [.a];
lfilter [True:r] [a:x] = [a:lfilter r x]
lfilter [_:r] [_:x] = lfilter r x
lfilter _ _ = []
//--
:: ECLS = {ids::[Id],act::Int,cls::[Colour],mfs::EditMenuLS General} :: ECLS = {ids::[Id],act::Int,cls::[Colour],mfs::EditMenuLS General}
froot txt ps froot txt ps
...@@ -527,7 +512,8 @@ defaultFontAndTabs :: !*(PSt *General) -> *(PSt *General) ...@@ -527,7 +512,8 @@ defaultFontAndTabs :: !*(PSt *General) -> *(PSt *General)
defaultFontAndTabs ps defaultFontAndTabs ps
# (names, ps) = accPIO (accScreenPicture getFontNames) ps # (names, ps) = accPIO (accScreenPicture getFontNames) ps
// filter fixed width fonts.... // filter fixed width fonts....
# (fixed,ps) = seqList (map (\f->accPIO (accScreenPicture (lisFixedWidth f))) names) ps // # (fixed,ps) = seqList (map (\f->accPIO (accScreenPicture (lisFixedWidth f))) names) ps
# (fixed,ps) = accPIO (accScreenPicture (seqList (map lisFixedWidth names))) ps
# names = lfilter fixed names # names = lfilter fixed names
# (prefs,ps) = getPrefs ps # (prefs,ps) = getPrefs ps
# fontdef = prefs.edwinfont # fontdef = prefs.edwinfont
......
...@@ -12,7 +12,7 @@ from IdeState import :: General, getErrInfo, setErrInfo, :: ErrorInfo, :: MenuId ...@@ -12,7 +12,7 @@ from IdeState import :: General, getErrInfo, setErrInfo, :: ErrorInfo, :: MenuId
from IdeState import :: SearchMenuIds, :: PLMMessage, :: PLMReply, :: MIn, :: EditMenuLS, getInteract, writeLog from IdeState import :: SearchMenuIds, :: PLMMessage, :: PLMReply, :: MIn, :: EditMenuLS, getInteract, writeLog
from EdClient import lineSelection from EdClient import lineSelection
import EdClient import EdClient
import UtilIO import IdePlatform
/* /*
ADD: ADD:
......
...@@ -8,7 +8,7 @@ import EdMouse, EdKeyboard ...@@ -8,7 +8,7 @@ import EdMouse, EdKeyboard
from StrictList import slFromList from StrictList import slFromList
from UtilStrictLists import StrictListToList,:: List(:!),IsEmptyList from UtilStrictLists import StrictListToList,:: List(:!),IsEmptyList
import IDE,IdeState,UtilIO import IDE,IdeState,IdePlatform
import morecontrols, colorpickcontrol, ioutil, colourclip import morecontrols, colorpickcontrol, ioutil, colourclip
import StdClipboard import StdClipboard
...@@ -214,19 +214,6 @@ tw_deactivate ps ...@@ -214,19 +214,6 @@ tw_deactivate ps
//-- type win options... //-- type win options...
lisFixedWidth :: .FontName *Picture -> (Bool,*Picture)
lisFixedWidth fontname env
# ((ok,font), env) = openFont {fName=fontname,fSize=12,fStyles=[]} env
| not ok = (ok,env)
# (wide, env) = getFontCharWidth font 'M' env
(narrow, env) = getFontCharWidth font 'i' env
= (wide == narrow, env)
lfilter :: [.Bool] [.a] -> [.a];
lfilter [True:r] [a:x] = [a:lfilter r x]
lfilter [_:r] [_:x] = lfilter r x
lfilter _ _ = []
::TWC_LS = ::TWC_LS =
{ cur :: TWC_CR // current colour { cur :: TWC_CR // current colour
, txt :: Colour , txt :: Colour
...@@ -262,7 +249,8 @@ typewinPane ps ...@@ -262,7 +249,8 @@ typewinPane ps
# (twi,ps) = accPLoc getTypeWinInfo ps # (twi,ps) = accPLoc getTypeWinInfo ps
# (fontNames, ps) # (fontNames, ps)
= accPIO (accScreenPicture getFontNames) ps = accPIO (accScreenPicture getFontNames) ps
# (fixed,ps) = seqList (map (\f->accPIO (accScreenPicture (lisFixedWidth f))) fontNames) ps // # (fixed,ps) = seqList (map (\f->accPIO (accScreenPicture (lisFixedWidth f))) fontNames) ps
# (fixed,ps) = accPIO (accScreenPicture (seqList (map lisFixedWidth fontNames))) ps
# fontNames = lfilter fixed fontNames # fontNames = lfilter fixed fontNames
# fontSizes = [7, 8, 9, 10, 12, 14, 18, 24 ] # fontSizes = [7, 8, 9, 10, 12, 14, 18, 24 ]
# {typewinfont={fName=inifn,fSize=inifs},typewinsync=sync} # {typewinfont={fName=inifn,fSize=inifs},typewinsync=sync}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment