Added sanity checking to kernel vnsprintf
[tpg/acess2.git] / Usermode / Applications / axwin2_src / WM / wm.c
index 9ddff76..9bd5aa4 100644 (file)
@@ -6,7 +6,7 @@
  */
 #include "common.h"
 #include <stdlib.h>
-#include <strings.h>
+#include <string.h>
 #include "wm.h"
 
 // === IMPORTS ===
@@ -90,6 +90,10 @@ void WM_SetSize(tElement *Element, int Size)
        return ;
 }
 
+/**
+ * \brief Set the text field of an element
+ * \note Used for the image path on ELETYPE_IMAGE
+ */
 void WM_SetText(tElement *Element, char *Text)
 {
        if(!Element)    return ;
@@ -125,6 +129,11 @@ void WM_SetText(tElement *Element, char *Text)
 }
 
 // --- Pre-Rendering ---
+/**
+ * \name Pre-Rendering
+ * \brief Updates the element positions and sizes
+ * \{
+ */
 /**
  * \brief Updates the dimensions of an element
  * 
@@ -193,44 +202,38 @@ void WM_UpdateDimensions(tElement *Element, int Pass)
        // Pass 2 - Set sizes and recurse
        for( child = Element->FirstChild; child; child = child->NextSibling )
        {
-               // Cross Size
-               if( child->FixedCross ) {
-                       if( Element->Flags & ELEFLAG_VERTICAL )
-                               child->CachedW = child->FixedCross;
-                       else
-                               child->CachedH = child->FixedCross;
-               }
-               else {
-                        int    cross;
-                       _SysDebug("%p,%p ->MinCross = %i", Element, child, child->MinCross);
-                       // Expand to fill?
-                       // TODO: Extra flag so options are (Expand, Equal, Wrap)
-                       if( child->Flags & ELEFLAG_NOEXPAND )
-                               cross = child->MinCross;
-                       else
-                               cross = fullCross;
-                       
-                       _SysDebug("%p,%p - cross = %i", Element, child, cross);
-                       
-                       if( Element->Flags & ELEFLAG_VERTICAL )
-                               child->CachedW = cross;
-                       else
-                               child->CachedH = cross;
-               }
+                int    cross, with;
                
-               // With size
-               if( child->FixedWith ) {
-                       if( Element->Flags & ELEFLAG_VERTICAL )
-                               child->CachedH = child->FixedWith;
-                       else
-                               child->CachedW = child->FixedWith;
-               }
-               else {
-                       if( Element->Flags & ELEFLAG_VERTICAL )
-                               child->CachedH = dynWith;
-                       else
-                               child->CachedW = dynWith;
-               }
+               _SysDebug("%p,%p ->MinCross = %i", Element, child, child->MinCross);
+
+               
+               // --- Cross Size ---
+               if( child->FixedCross )
+                       cross = child->FixedCross;
+               // Expand to fill?
+               // TODO: Extra flag so options are (Expand, Equal, Wrap)
+               else if( child->Flags & ELEFLAG_NOEXPAND )
+                       cross = child->MinCross;
+               else
+                       cross = fullCross;
+               _SysDebug("%p,%p - cross = %i", Element, child, cross);
+               if( Element->Flags & ELEFLAG_VERTICAL )
+                       child->CachedW = cross;
+               else
+                       child->CachedH = cross;
+               
+               // --- With Size ---
+               if( child->FixedWith)
+                       with = child->FixedWith;
+               else if( child->Flags & ELEFLAG_NOSTRETCH )
+                       with = child->MinWith;
+               else
+                       with = dynWith;
+               _SysDebug("%p,%p - with = %i", Element, child, with);
+               if( Element->Flags & ELEFLAG_VERTICAL )
+                       child->CachedH = with;
+               else
+                       child->CachedW = with;
                
                WM_UpdateDimensions(child, 0);
        }
@@ -292,7 +295,6 @@ void WM_UpdatePosition(tElement *Element)
                );
 }
 
-
 /**
  * \brief Update the minimum dimensions of the element
  * \note Called after a child's minimum dimensions have changed
@@ -337,6 +339,9 @@ void WM_UpdateMinDims(tElement *Element)
        // Recurse upwards
        WM_UpdateMinDims(Element->Parent);
 }
+/**
+ * \}
+ */
 
 // --- Render ---
 void WM_RenderWidget(tElement *Element)

UCC git Repository :: git.ucc.asn.au