]> git.saurik.com Git - wxWidgets.git/blobdiff - contrib/utils/wxrcedit/propframe.cpp
typos fixed and more notes on some changes
[wxWidgets.git] / contrib / utils / wxrcedit / propframe.cpp
index cb82a0d32d94039cb3534c2128aa51ad181d0ba7..1e160c67e7c1900fda0007747d49f5dbf17bf1d5 100644 (file)
@@ -27,6 +27,7 @@
 #include "propedit.h"
 #include "pe_basic.h"
 #include "pe_adv.h"
+#include "editor.h"
 
 // ------------- support classes --------
 
@@ -37,7 +38,18 @@ class PropsTree: public wxRemotelyScrolledTreeCtrl
         PropsTree(wxWindow* parent, wxWindowID id, const wxPoint& pt = wxDefaultPosition,
             const wxSize& sz = wxDefaultSize, long style = wxTR_HAS_BUTTONS)
             : wxRemotelyScrolledTreeCtrl(parent, id, pt, sz, style),
-              m_EditCtrl(NULL) {}
+              m_EditCtrl(NULL) 
+               {
+#if 0
+            // VS: Don't do it, it is *extremely* ugly.
+            //     FIXME: find a better solution.
+
+                       //make text larger so controls will fit properly
+                       wxFont font = GetFont();
+                       font.SetPointSize(font.GetPointSize()*1.5);
+                       SetFont(font);
+#endif
+        }
 
            void OnPaint(wxPaintEvent& event)
         {
@@ -48,9 +60,9 @@ class PropsTree: public wxRemotelyScrolledTreeCtrl
             // Reset the device origin since it may have been set
             dc.SetDeviceOrigin(0, 0);
 
-               wxPen pen(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DLIGHT), 1, wxSOLID);
-               dc.SetPen(pen);
-            
+               wxPen pen(wxColour(_T("BLACK")), 1, wxSOLID);
+               dc.SetPen(pen);          
+
                dc.SetBrush(* wxTRANSPARENT_BRUSH);
 
             wxSize clientSize = GetClientSize();
@@ -62,6 +74,7 @@ class PropsTree: public wxRemotelyScrolledTreeCtrl
                        if (h.IsOk() && GetBoundingRect(h, itemRect))
                        {
                                cy = itemRect.GetTop();
+
                                dc.DrawLine(0, cy, clientSize.x, cy);
                                lastH = h;
                        }
@@ -72,7 +85,7 @@ class PropsTree: public wxRemotelyScrolledTreeCtrl
                        dc.DrawLine(0, cy, clientSize.x, cy);
                }
         }
-        
+
         void OnSelChange(wxTreeEvent& event)
         {
             if (m_EditCtrl != NULL)
@@ -87,6 +100,7 @@ class PropsTree: public wxRemotelyScrolledTreeCtrl
             {
                 wxRect bounding;
                 GetBoundingRect(item, bounding);
+
                 bounding.SetX(0);
                 bounding.SetWidth(GetCompanionWindow()->GetSize().x); 
                 dt->EditCtrl->BeginEdit(bounding, item);
@@ -104,6 +118,19 @@ class PropsTree: public wxRemotelyScrolledTreeCtrl
                 m_EditCtrl = NULL;
             }
         }
+
+        void OnScroll(wxScrollWinEvent& event)
+        {
+            event.Skip();
+            if (event.GetOrientation() == wxHORIZONTAL) return;
+            if (!m_EditCtrl) return;
+            
+            wxTreeItemId id = GetSelection();
+            wxRect bounding;
+            GetBoundingRect(id, bounding);
+            
+            m_EditCtrl->Move(-1, bounding.y);
+        }
         
         PropEditCtrl *m_EditCtrl;
         
@@ -113,6 +140,7 @@ class PropsTree: public wxRemotelyScrolledTreeCtrl
 BEGIN_EVENT_TABLE(PropsTree, wxRemotelyScrolledTreeCtrl)
        EVT_PAINT(PropsTree::OnPaint)
     EVT_TREE_SEL_CHANGED(-1, PropsTree::OnSelChange)
+    EVT_SCROLLWIN(PropsTree::OnScroll)
 END_EVENT_TABLE()
 
 
@@ -153,11 +181,10 @@ class PropsValueWindow: public wxTreeCompanionWindow
             wxTreeItemId item = GetTreeCtrl()->HitTest(wxPoint(1, event.GetY()), flags);
             if (item.IsOk())
             {
-                GetTreeCtrl()->ScrollTo(item);
                 GetTreeCtrl()->SelectItem(item);
             }
         }
-        
+
         DECLARE_EVENT_TABLE()
 };
 
@@ -184,7 +211,13 @@ PropertiesFrame *PropertiesFrame::Get()
 }
 
 PropertiesFrame::PropertiesFrame()
-    : wxFrame(NULL, -1, _("Properties"))
+    : wxFrame(EditorFrame::Get(), -1, _("Properties"),
+              wxDefaultPosition, wxDefaultSize,
+              wxDEFAULT_FRAME_STYLE | wxFRAME_NO_TASKBAR 
+#ifdef __WXMSW__
+              | wxFRAME_TOOL_WINDOW
+#endif
+              )
 {
     ms_Instance = this;
     m_Node = NULL;
@@ -221,13 +254,15 @@ PropertiesFrame::PropertiesFrame()
     m_EditCtrls.Put(_T("coord"), new PropEditCtrlCoord(this));
     m_EditCtrls.Put(_T("color"), new PropEditCtrlColor(this));
     m_EditCtrls.Put(_T("dimension"), new PropEditCtrlDim(this));
-    m_EditCtrls.Put(_T("flags"), new PropEditCtrlTxt(this));
+    m_EditCtrls.Put(_T("flags"), new PropEditCtrlFlags(this));
     m_EditCtrls.Put(_T("integer"), new PropEditCtrlInt(this));
     m_EditCtrls.Put(_T("not_implemented"), new PropEditCtrlNull(this));
     m_EditCtrls.Put(_T("text"), new PropEditCtrlTxt(this));
-    m_EditCtrls.Put(_T("xmlid"), new PropEditCtrlXMLID(this));
+    m_EditCtrls.Put(_T("xmlid"), new PropEditCtrlXRCID(this));
     m_EditCtrls.Put(_T("font"), new PropEditCtrlFont(this));
     m_EditCtrls.Put(_T("choice"), new PropEditCtrlChoice(this));
+    m_EditCtrls.Put(_T("file"), new PropEditCtrlFile(this));
+    m_EditCtrls.Put(_T("imagefile"), new PropEditCtrlImageFile(this));
     m_EditCtrls.Put(_T(""), new PropEditCtrlNull(this));
             
     ClearProps();
@@ -254,7 +289,7 @@ void PropertiesFrame::ShowProps(wxXmlNode *node)
    m_Node = node;
    
    ClearProps();
-   AddSingleProp(PropertyInfo(_T("xmlid"), _T("XMLID"), wxEmptyString));
+   AddSingleProp(PropertyInfo(_T("xmlid"), _T("XRCID"), wxEmptyString));
    AddProps(NodeHandler::Find(node)->GetPropsList(node));
    
    m_tree->Expand(m_tree->GetRootItem());
@@ -280,10 +315,12 @@ void PropertiesFrame::AddProps(PropertyInfoArray& plist)
 
 
 
-void PropertiesFrame::AddSingleProp(const PropertyInfo& pinfo)
+void PropertiesFrame::AddSingleProp(const PropertyInfo& pinfo, wxTreeItemId *root)
 {
     PropEditCtrl *pec = (PropEditCtrl*)m_EditCtrls.Get(pinfo.Type);
-    wxTreeItemId tid = m_tree->GetRootItem();
+    wxTreeItemId tid;
+    if (root != NULL) tid = *root;
+    else tid = m_tree->GetRootItem();
     
     if (pec == NULL)
         wxLogError(_("Unknown property type '%s'!"), pinfo.Type.c_str());