Commit 31e19780 authored by John van Groningen's avatar John van Groningen

determine window position when a window is opened the first time,

don't store window positions for windows that have not been opened
in project files
parent b7db3ec7
......@@ -155,6 +155,12 @@ ed_open_cont pathName cont ps
# windowIcon = if isDefMod DefmodIcon (if isImpMod ImpmodIcon CleanIcon)
# syncols = if isDefMod (prefs.defcols) (if isImpMod (prefs.impcols) (prefs.syncols))
// # (boom, ps) = readFileInTree ps // P4
# optional_window_pos_and_size = if (isJust inf)
(if isDefMod
(fromJust inf).defeo.pos_size
(fromJust inf).impeo.pos_size)
NoWindowPosAndSize
# ps = openEditWindow mn_und (if readOnly title` title) pathName text font tabs margin syncols windowId (
[ WindowClose (noLS (ed_close windowId))
, WindowKeyboard (\_ -> True) Able keyboardfun
......@@ -162,15 +168,15 @@ ed_open_cont pathName cont ps
, WindowDeactivate (ed_deactivate title)
, WindowInit (noLS (SetWindowIcon windowId windowIcon))
, WindowMouse noMouseMoved Able editWindowMouse //(editWindowMouse boom) // P4
] ++ (if (isJust inf)
[ WindowViewSize (if isDefMod
{w=(fromJust inf).defeo.pos_size.sizex,h=(fromJust inf).defeo.pos_size.sizey}
{w=(fromJust inf).impeo.pos_size.sizex,h=(fromJust inf).impeo.pos_size.sizey})
, WindowPos (if isDefMod
(Fix,OffsetVector {vx=(fromJust inf).defeo.pos_size.posx,vy=(fromJust inf).defeo.pos_size.posy})
(Fix,OffsetVector {vx=(fromJust inf).impeo.pos_size.posx,vy=(fromJust inf).impeo.pos_size.posy}))
]
[])
] ++
(case optional_window_pos_and_size of
WindowPosAndSize window_pos_and_size
-> [ WindowViewSize {w=window_pos_and_size.sizex,h=window_pos_and_size.sizey}
, WindowPos (Fix,OffsetVector {vx=window_pos_and_size.posx,vy=window_pos_and_size.posy})
]
_
->[]
)
) ps
# (_,ps) = message windowId (setNewlineConvention nlConv) ps
# (_,ps) = message windowId (setReadOnly readOnly) ps
......@@ -436,7 +442,7 @@ ed_common_close update_in_project win ps
# (siz,ps) = accPIO (getWindowViewSize win) ps
# modname = GetModuleName nam
# isDefmod = IsDefPathname nam
# pos_size = {posx = pos.vx,posy=pos.vy,sizex=siz.w,sizey=siz.Size.h}
# pos_size = WindowPosAndSize {posx = pos.vx,posy=pos.vy,sizex=siz.w,sizey=siz.Size.h}
# update = \inf=:{defeo,impeo} -> if isDefmod
{inf & defeo = {defeo & pos_size = pos_size}, defopen = not update_in_project}
{inf & impeo = {impeo & pos_size = pos_size}, impopen = not update_in_project}
......
......@@ -199,7 +199,7 @@ pm_new` path projectpath ps
# ps = pm_shut ps // just in case
# (prefs,ps) = getPrefs ps
edo = {newlines=HostNativeNewlineConvention}
eo = {eo = edo, pos_size = DefWindowPos_and_Size}
eo = {eo = edo, pos_size = NoWindowPosAndSize}
co = prefs.compopts //DefCompilerOptions
go = prefs.cgenopts //DefCodeGenOptions
lo = prefs.linkopts //DefaultLinkOptions
......
......@@ -663,7 +663,7 @@ pm_set ps
| isNothing nlc
= ps // this should not occur
# nlc = fromJust nlc
# pos_size = {posx = pos.vx,posy=pos.vy,sizex=siz.w,sizey=siz.Size.h}
# pos_size = WindowPosAndSize {posx = pos.vx,posy=pos.vy,sizex=siz.w,sizey=siz.Size.h}
# eo = {newlines = nlc}
# weo = {eo = eo,pos_size = pos_size}
# wco = DefaultCompilerOptions
......
......@@ -1125,8 +1125,8 @@ where
defaultCO = prefs.compopts
eo =
{ newlines = HostNativeNewlineConvention}
defeo = {pos_size = DefWindowPos_and_Size, eo = eo}
impeo = {pos_size = DefWindowPos_and_Size, eo = eo}
defeo = {pos_size = NoWindowPosAndSize, eo = eo}
impeo = {pos_size = NoWindowPosAndSize, eo = eo}
modname = GetModuleName next
modinfo = PR_GetModuleInfo modname project
......@@ -1368,8 +1368,8 @@ ProcessCompilerMsg cstate compileOrCheckSyntax co path abcpath CompilerOK filein
where
(version,ps) = getCurrentVers ps0
eo = { newlines = HostNativeNewlineConvention}
defeo = {pos_size = DefWindowPos_and_Size, eo = eo}
impeo = {pos_size = DefWindowPos_and_Size, eo = eo}
defeo = {pos_size = NoWindowPosAndSize, eo = eo}
impeo = {pos_size = NoWindowPosAndSize, eo = eo}
check_dependant_dates :: !String !Pathname !(List Modulename) !(Maybe ModuleDate) !(List ModuleDate) !*DirCache -> (Bool,String,*DirCache)
check_dependant_dates modname abcpath mods xxx_md xxx_dd dircache
......
......@@ -156,8 +156,8 @@ where
EmptyModInfo :: ModInfo
EmptyModInfo = { dir = EmptyPathname,
compilerOptions = DefaultCompilerOptions,
defeo = {eo=DefaultEditOptions,pos_size=DefWindowPos_and_Size},
impeo = {eo=DefaultEditOptions,pos_size=DefWindowPos_and_Size},
defeo = {eo=DefaultEditOptions,pos_size=NoWindowPosAndSize},
impeo = {eo=DefaultEditOptions,pos_size=NoWindowPosAndSize},
defopen = False,
impopen = False,
date = NoDate,
......@@ -288,9 +288,14 @@ EditWdOptionsTable :: OptionsTable EditWdOptions
EditWdOptionsTable =
{
GroupedOption "Editor" EditOptionsTable (\a->a.eo) (\v a->{a & eo=v}),
GroupedOption "WindowPosition" WindowPositionTable (\a->a.pos_size) (\v a->{a & pos_size=v})
OptionalGroupedOption "WindowPosition" is_no_position_and_size WindowPositionTable (\a->a.pos_size) (\v a->{a & pos_size=v})
}
is_no_position_and_size NoWindowPosAndSize
= True
is_no_position_and_size _
= False
EditOptionsTable :: OptionsTable EditOptions
EditOptionsTable =
{}
......@@ -302,15 +307,18 @@ EditOptionsTable =
, SimpleOption "ShowLins" (\a->a.EditOptions.showlins) (\v a->{EditOptions | a & showlins=v})
}
*/
WindowPositionTable :: OptionsTable WindowPos_and_Size
WindowPositionTable :: OptionsTable OptionalWindowPosAndSize
WindowPositionTable =
{
SimpleOption "X" (\a->a.posx) (\v a->{a & posx=v}),
SimpleOption "Y" (\a->a.posy) (\v a->{a & posy=v}),
SimpleOption "SizeX" (\a->a.sizex) (\v a->{a & sizex=v}),
SimpleOption "SizeY" (\a->a.sizey) (\v a->{a & sizey=v})
SimpleOption "X" (\a->(getWindowPosAndSize a).posx) (\v a->WindowPosAndSize {getWindowPosAndSize a & posx=v}),
SimpleOption "Y" (\a->(getWindowPosAndSize a).posy) (\v a->WindowPosAndSize {getWindowPosAndSize a & posy=v}),
SimpleOption "SizeX" (\a->(getWindowPosAndSize a).sizex) (\v a->WindowPosAndSize {getWindowPosAndSize a & sizex=v}),
SimpleOption "SizeY" (\a->(getWindowPosAndSize a).sizey) (\v a->WindowPosAndSize {getWindowPosAndSize a & sizey=v})
}
getWindowPosAndSize (WindowPosAndSize wps) = wps
getWindowPosAndSize NoWindowPosAndSize = DefWindowPos_and_Size
StaticInfoTable =
{ ListOption "Mods" PathName "" (\a->a.stat_mods) (\v a->{a & stat_mods=v})
, ListOption "Objs" PathName "" (\a->a.stat_objs) (\v a->{a & stat_objs=v})
......
......@@ -671,8 +671,8 @@ where
defaultModInfo =
{ dir = EmptyPathname
, compilerOptions = DefaultCompilerOptions
, defeo = {eo=DefaultEditOptions,pos_size=DefWindowPos_and_Size}
, impeo = {eo=DefaultEditOptions,pos_size=DefWindowPos_and_Size}
, defeo = {eo=DefaultEditOptions,pos_size=NoWindowPosAndSize}
, impeo = {eo=DefaultEditOptions,pos_size=NoWindowPosAndSize}
, defopen = False
, impopen = False
, date = NoDate
......
......@@ -59,7 +59,10 @@ instance == LinkMethod
, sizey :: !Int
}
instance == WindowPos_and_Size
:: OptionalWindowPosAndSize = NoWindowPosAndSize | WindowPosAndSize !WindowPos_and_Size;
//instance == WindowPos_and_Size
instance == OptionalWindowPosAndSize
DefWindowPos_and_Size :: WindowPos_and_Size
......@@ -83,7 +86,7 @@ instance == EditOptions
:: EditWdOptions =
{ eo :: !EditOptions
, pos_size :: !WindowPos_and_Size
, pos_size :: !OptionalWindowPosAndSize
}
// The Code Generator Options: default settings for the code generator
......
......@@ -213,6 +213,15 @@ where
, sizey :: !Int
}
instance == OptionalWindowPosAndSize
where
(==) (WindowPosAndSize pos1) (WindowPosAndSize pos2)
= pos1==pos2
(==) NoWindowPosAndSize NoWindowPosAndSize
= True
(==) _ _
= False
instance == WindowPos_and_Size
where
(==) :: !WindowPos_and_Size !WindowPos_and_Size -> Bool
......@@ -259,7 +268,7 @@ where
// The Window parameters: edit options and window position and size
:: EditWdOptions =
{ eo :: !EditOptions
, pos_size :: !WindowPos_and_Size
, pos_size :: !OptionalWindowPosAndSize
}
// edit options, window pos&size
......
......@@ -24,11 +24,13 @@ GetOptions :: !(OptionsTable a) ![Option] !a -> a
Simple :: Conversions a | toString, fromString a
SimpleWithStringConversion :: ({#Char} -> {#Char}) -> (Conversions a) | toString, fromString a
List :: (OptionsTableEntry a) a -> Conversions (List a)
OptionalGroup :: (OptionsTable a) (a->Bool) -> Conversions a
Group :: (OptionsTable a) -> Conversions a
SimpleOption l g p :== {labelName = l, conversions = Simple, get = g, put = p}
SimpleWithStringConversionOption c l g p :== {labelName = l, conversions = SimpleWithStringConversion c, get = g, put = p}
GroupedOption l s g p :== {labelName = l, conversions = Group s, get = g, put = p}
OptionalGroupedOption l e s g p :== {labelName = l, conversions = OptionalGroup s e, get = g, put = p}
ListOption l s d g p :== {labelName = l, conversions = List s d, get = g, put = p}
ConvertToString :: !String -> String
......@@ -78,6 +78,18 @@ Group subOptionTable =
= \_ subOptions value -> GetOptions subOptionTable subOptions value
}
OptionalGroup :: (OptionsTable a) (a->Bool) -> Conversions a
OptionalGroup subOptionTable is_empty_group =
{
toValue
= \value
= if (is_empty_group value)
(Nothing, [])
(Nothing, PutOptions subOptionTable value),
fromValue
= \_ subOptions value -> GetOptions subOptionTable subOptions value
}
List :: (OptionsTableEntry a) a -> Conversions (List a)
List optionsTableEntry defaultValue =
{
......
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