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

consolidate font filtering

parent 6d30fd2f
......@@ -8,7 +8,7 @@ import EdMouse, EdKeyboard
from StrictList import slFromList
from UtilStrictLists import StrictListToList,:: List(:!),IsEmptyList
import IDE,IdeState,UtilIO
import IDE,IdeState,IdePlatform
//--
......@@ -199,19 +199,6 @@ cw_deactivate ps
import morecontrols, colorpickcontrol, ioutil, colourclip
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 =
{ cur :: CWC_CR // current colour
, txt :: Colour
......@@ -248,7 +235,8 @@ conswinPane ps
# (fontNames, ps)
= accPIO (accScreenPicture getFontNames) ps
// 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
# fontSizes = [7, 8, 9, 10, 12, 14, 18, 24 ]
# {conswinfont={fName=inifn,fSize=inifs},conswinsync=sync}
......
......@@ -4,7 +4,7 @@ import StdTuple, StdEnum, StdList, StdFunc, StdMisc
import StdMenu, StdWindow, StdId, StdPSt, StdControl
import StdClipboard, StdControlReceiver
import EdKeyMapping, EdState, EdClient, EdKeyboard
import IDE, IdeState, ExtNotice, UtilIO
import IDE, IdeState, ExtNotice, IdePlatform
import colorpickcontrol
import ioutil, morecontrols
import typewin, colourclip
......@@ -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}
froot txt ps
......@@ -527,7 +512,8 @@ defaultFontAndTabs :: !*(PSt *General) -> *(PSt *General)
defaultFontAndTabs ps
# (names, ps) = accPIO (accScreenPicture getFontNames) ps
// 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
# (prefs,ps) = getPrefs ps
# fontdef = prefs.edwinfont
......
......@@ -12,7 +12,7 @@ from IdeState import :: General, getErrInfo, setErrInfo, :: ErrorInfo, :: MenuId
from IdeState import :: SearchMenuIds, :: PLMMessage, :: PLMReply, :: MIn, :: EditMenuLS, getInteract, writeLog
from EdClient import lineSelection
import EdClient
import UtilIO
import IdePlatform
/*
ADD:
......
......@@ -8,7 +8,7 @@ import EdMouse, EdKeyboard
from StrictList import slFromList
from UtilStrictLists import StrictListToList,:: List(:!),IsEmptyList
import IDE,IdeState,UtilIO
import IDE,IdeState,IdePlatform
import morecontrols, colorpickcontrol, ioutil, colourclip
import StdClipboard
......@@ -214,19 +214,6 @@ tw_deactivate ps
//-- 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 =
{ cur :: TWC_CR // current colour
, txt :: Colour
......@@ -262,7 +249,8 @@ typewinPane ps
# (twi,ps) = accPLoc getTypeWinInfo ps
# (fontNames, 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
# fontSizes = [7, 8, 9, 10, 12, 14, 18, 24 ]
# {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