Commit b7db3ec7 authored by John van Groningen's avatar John van Groningen

make new window fit in outer window / screen

parent 66f28a3b
...@@ -6,9 +6,20 @@ import StdInt, StdClass, StdList ...@@ -6,9 +6,20 @@ import StdInt, StdClass, StdList
import StdWindow, StdControlReceiver, StdIOBasic import StdWindow, StdControlReceiver, StdIOBasic
import EdMessage, EdMonad, EdLook, EdVisualText, EdState import EdMessage, EdMonad, EdLook, EdVisualText, EdState
import ioutil import ioutil
from StdProcess import getProcessWindowSize
//--- //---
determine_default_window_size :: !Int !*(IOSt *a) -> (!Size,!*(IOSt *a))
determine_default_window_size lineHeight io
# ({w=process_window_width,h=process_window_height},io) = getProcessWindowSize io
default_window_width = process_window_width-40
default_window_width = if (default_window_width>800) 800
(if (default_window_width<100) 100 default_window_width)
process_window_lines = (process_window_height-60) / lineHeight
default_window_lines = if (process_window_lines>40) 40
(if (process_window_lines<5) 5 process_window_lines)
= ({w=default_window_width,h=default_window_lines*lineHeight},io)
openEditWindow :: Id .Title String Text !Font (Int,Bool,Bool,Bool,Bool) Int SyntaxColours Id [.WindowAttribute *(EditState,*PSt *b)] !*(PSt *b) -> *PSt *b | Editor b openEditWindow :: Id .Title String Text !Font (Int,Bool,Bool,Bool,Bool) Int SyntaxColours Id [.WindowAttribute *(EditState,*PSt *b)] !*(PSt *b) -> *PSt *b | Editor b
openEditWindow uId title pathName text font tabs margin syncols windowId atts ps openEditWindow uId title pathName text font tabs margin syncols windowId atts ps
# (editorState,ps) = getEditorState ps # (editorState,ps) = getEditorState ps
...@@ -23,8 +34,11 @@ openEditWindow uId title pathName text font tabs margin syncols windowId atts ps ...@@ -23,8 +34,11 @@ openEditWindow uId title pathName text font tabs margin syncols windowId atts ps
(viewDomain, (editState, ps)) = computeViewDomain (editState, ps) (viewDomain, (editState, ps)) = computeViewDomain (editState, ps)
// setup the window attributes // setup the window attributes
editLook = editWindowLook editState editLook = editWindowLook editState
(default_window_size,io) = determine_default_window_size fontInfo.FontInfo.lineHeight ps.io
ps = {ps & io=io}
windowAttrs = atts ++ // in this order so that new attributes override default atts windowAttrs = atts ++ // in this order so that new attributes override default atts
[ WindowViewSize { w = 800, h = fontInfo.FontInfo.lineHeight * 40 } [
WindowViewSize default_window_size
, WindowHMargin 0 0 , WindowHMargin 0 0
, WindowVMargin 0 0 , WindowVMargin 0 0
, WindowId windowId , WindowId windowId
......
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