Project

General

Profile

3136a_3.txt

Sergey Ivanovskiy, 08/19/2016 02:23 PM

Download (3.59 KB)

 
1
=== modified file 'src/com/goldencode/p2j/ui/client/gui/FrameGuiImpl.java'
2
--- src/com/goldencode/p2j/ui/client/gui/FrameGuiImpl.java	2016-08-18 19:36:02 +0000
3
+++ src/com/goldencode/p2j/ui/client/gui/FrameGuiImpl.java	2016-08-19 18:16:52 +0000
4
@@ -75,7 +75,8 @@
5
 ** 038 HC  20160628 Prevented unhandled exceptions when window/frame closed/destroyed.
6
 ** 039 EVL 20160622 Adding refresh dialog title after config update.
7
 ** 040 SBI 20160713 Fixed the cursor if the mouse pointer over labels.
8
-** 041 SBI 20160818 Fixed the look and feel for empty frames according to the Progress 4GL GUI.
9
+** 041 SBI 20160818 Fixed the look and feel for frames according to the Progress 4GL GUI minimal
10
+**                  frame size.
11
 */
12
 
13
 package com.goldencode.p2j.ui.client.gui;
14
@@ -103,8 +104,8 @@
15
 public class FrameGuiImpl
16
 extends Frame<GuiOutputManager>
17
 {
18
-   /** The frame's default size given in pixels */
19
-   private static final int DEFAULT_SIZE_IN_PIXELS = 16;
20
+   /** The frame's minimal size given in pixels */
21
+   private static final int DEFAULT_MINIMAL_SIZE_IN_PIXELS = 16;
22
    
23
    /** Screen driver */
24
    private GuiDriver gd;
25
@@ -136,11 +137,11 @@
26
    /** Keeping track on explicit virtual height setting. */
27
    private boolean explicitVirtualHeight = false;
28
    
29
-   /** The default width of the empty frame. */
30
-   private final double defaultWidth;
31
+   /** The default minimal width of the empty frame. */
32
+   private final double defaultMinimalWidth;
33
    
34
-   /** The default height of the empty frame. */
35
-   private final double defaultHeight;
36
+   /** The default minimal height of the empty frame. */
37
+   private final double defaultMinimalHeight;
38
    
39
    /**
40
     * Special constructor used to restore component using given configuration.
41
@@ -173,8 +174,8 @@
42
       cc = screen.coordinates();
43
       
44
       // calculates the frame's default size from its pixels size
45
-      defaultHeight = cc.heightFromNative(DEFAULT_SIZE_IN_PIXELS);
46
-      defaultWidth  = cc.widthFromNative(DEFAULT_SIZE_IN_PIXELS);
47
+      defaultMinimalHeight = cc.heightFromNative(DEFAULT_MINIMAL_SIZE_IN_PIXELS);
48
+      defaultMinimalWidth  = cc.widthFromNative(DEFAULT_MINIMAL_SIZE_IN_PIXELS);
49
    }
50
    
51
    /**
52
@@ -495,15 +496,15 @@
53
       super.realizeFrame(realize);
54
       if (realize)
55
       {
56
-         AbstractContainer<GuiOutputManager> container = getContentPane();
57
-         if (container != null)
58
+         double currentWidth  = width();
59
+         double currentHeight = height();
60
+         if (currentWidth < defaultMinimalWidth || currentHeight < defaultMinimalHeight)
61
          {
62
-            // if this frame has no widgets and its dimension is not set,
63
-            // then set its default dimension.
64
-            if (container.widgets().length == 0 && !config().fixedWidth && !config().fixedHeight)
65
-            {
66
-               setOuterSize(defaultWidth, defaultHeight);
67
-            }
68
+            currentWidth  = Math.max(currentWidth,  defaultMinimalWidth);
69
+            currentHeight = Math.max(currentHeight, defaultMinimalHeight);
70
+            setOuterSize(currentWidth, currentHeight);
71
+            config().widthChars  = currentWidth;
72
+            config().heightChars = currentHeight;
73
          }
74
       }
75
    }
76
@@ -632,6 +633,12 @@
77
       if (!explicitVirtualHeight)
78
       {
79
          super.calculateHeight(d, delta);
80
+         // fix the calculated inner size
81
+         double minimalInnerHeight = defaultMinimalHeight - calculateHeightDelta();
82
+         if (d.height < minimalInnerHeight)
83
+         {
84
+            d.height = minimalInnerHeight;
85
+         }
86
       }
87
       else if (config().virtualHeightChars != BaseConfig.INV_COORD)
88
       {
89