]> git.saurik.com Git - wxWidgets.git/blobdiff - utils/dialoged/src/reseditr.cpp
SetTitle() works even if menu was created without title initially (and setting
[wxWidgets.git] / utils / dialoged / src / reseditr.cpp
index c112a89b234b211f21cf54840c7a9ec47be7bac1..507ced9872bf1409f7420b7bc94a1f50e2adc567 100644 (file)
@@ -37,6 +37,7 @@
 #endif
 
 #include "wx/scrolbar.h"
+#include "wx/config.h"
 
 #include <ctype.h>
 #include <stdlib.h>
@@ -104,8 +105,8 @@ wxResourceManager::wxResourceManager():
   m_editorToolBar = NULL;
 
   // Default window positions
-  m_resourceEditorWindowSize.width = 470;
-  m_resourceEditorWindowSize.height = 300;
+  m_resourceEditorWindowSize.width = 500;
+  m_resourceEditorWindowSize.height = 450;
 
   m_resourceEditorWindowSize.x = 0;
   m_resourceEditorWindowSize.y = 0;
@@ -149,10 +150,8 @@ bool wxResourceManager::Initialize()
   strcat(buf, "\\dialoged.ini");
   m_optionsResourceFilename = buf;
 #elif defined(__WXGTK__)
-  char buf[500];
-  wxGetHomeDir(buf);
-  strcat(buf, "/.dialogedrc");
-  m_optionsResourceFilename = buf;
+  wxGetHomeDir( &m_optionsResourceFilename );
+  m_optionsResourceFilename += "/.dialogedrc";
 #else
 #error "Unsupported platform."
 #endif
@@ -197,6 +196,18 @@ bool wxResourceManager::Initialize()
 
 bool wxResourceManager::LoadOptions()
 {
+  wxConfig config("DialogEd", "wxWindows");
+
+  config.Read("editorWindowX", &m_resourceEditorWindowSize.x);
+  config.Read("editorWindowY", &m_resourceEditorWindowSize.y);
+  config.Read("editorWindowWidth", &m_resourceEditorWindowSize.width);
+  config.Read("editorWindowHeight", &m_resourceEditorWindowSize.height);
+  config.Read("propertyWindowX", &m_propertyWindowSize.x);
+  config.Read("propertyWindowY", &m_propertyWindowSize.y);
+  config.Read("propertyWindowWidth", &m_propertyWindowSize.width);
+  config.Read("propertyWindowHeight", &m_propertyWindowSize.height);
+
+  /*
   wxGetResource("DialogEd", "editorWindowX", &m_resourceEditorWindowSize.x, m_optionsResourceFilename.GetData());
   wxGetResource("DialogEd", "editorWindowY", &m_resourceEditorWindowSize.y, m_optionsResourceFilename.GetData());
   wxGetResource("DialogEd", "editorWindowWidth", &m_resourceEditorWindowSize.width, m_optionsResourceFilename.GetData());
@@ -205,11 +216,23 @@ bool wxResourceManager::LoadOptions()
   wxGetResource("DialogEd", "propertyWindowY", &m_propertyWindowSize.y, m_optionsResourceFilename.GetData());
   wxGetResource("DialogEd", "propertyWindowWidth", &m_propertyWindowSize.width, m_optionsResourceFilename.GetData());
   wxGetResource("DialogEd", "propertyWindowHeight", &m_propertyWindowSize.height, m_optionsResourceFilename.GetData());
+  */
   return TRUE;
 }
 
 bool wxResourceManager::SaveOptions()
 {
+  wxConfig config("DialogEd", "wxWindows");
+
+  config.Write("editorWindowX", m_resourceEditorWindowSize.x);
+  config.Write("editorWindowY", m_resourceEditorWindowSize.y);
+  config.Write("editorWindowWidth", m_resourceEditorWindowSize.width);
+  config.Write("editorWindowHeight", m_resourceEditorWindowSize.height);
+  config.Write("propertyWindowX", m_propertyWindowSize.x);
+  config.Write("propertyWindowY", m_propertyWindowSize.y);
+  config.Write("propertyWindowWidth", m_propertyWindowSize.width);
+  config.Write("propertyWindowHeight", m_propertyWindowSize.height);
+  /*
   wxWriteResource("DialogEd", "editorWindowX", m_resourceEditorWindowSize.x, m_optionsResourceFilename.GetData());
   wxWriteResource("DialogEd", "editorWindowY", m_resourceEditorWindowSize.y, m_optionsResourceFilename.GetData());
   wxWriteResource("DialogEd", "editorWindowWidth", m_resourceEditorWindowSize.width, m_optionsResourceFilename.GetData());
@@ -219,6 +242,7 @@ bool wxResourceManager::SaveOptions()
   wxWriteResource("DialogEd", "propertyWindowY", m_propertyWindowSize.y, m_optionsResourceFilename.GetData());
   wxWriteResource("DialogEd", "propertyWindowWidth", m_propertyWindowSize.width, m_optionsResourceFilename.GetData());
   wxWriteResource("DialogEd", "propertyWindowHeight", m_propertyWindowSize.height, m_optionsResourceFilename.GetData());
+  */
 
   return TRUE;
 }
@@ -285,7 +309,7 @@ bool wxResourceManager::ShowResourceEditor(bool show, wxWindow *WXUNUSED(parent)
     c->bottom.SameAs     (m_editorFrame, wxBottom, 0);
     c->width.Unconstrained();
 #ifdef __WXGTK__
-    c->height.Absolute(70);
+    c->height.Absolute(140);
 #else
     c->height.Absolute(60);
 #endif
@@ -663,8 +687,7 @@ wxFrame *wxResourceManager::OnCreateEditorFrame(const char *title)
 
   frame->SetAutoLayout(TRUE);
 #ifdef __WXMSW__
-  wxIcon *icon = new wxIcon("DIALOGEDICON");
-  frame->SetIcon(icon);
+  frame->SetIcon(wxIcon("DIALOGEDICON"));
 #endif
   return frame;
 }
@@ -869,7 +892,7 @@ void wxResourceManager::AddItemsRecursively(long parent, wxItemResource *resourc
       node = node->Next();
     }
   }
-  m_editorResourceTree->ExpandItem(id, wxTREE_EXPAND_EXPAND);
+//  m_editorResourceTree->ExpandItem(id, wxTREE_EXPAND_EXPAND);
 }
 
 bool wxResourceManager::EditSelectedResource()
@@ -897,8 +920,8 @@ bool wxResourceManager::Edit(wxItemResource *res)
   }
   else
   {
-        long style = res->GetStyle();
-        res->SetStyle(style|wxRAISED_BORDER);
+//        long style = res->GetStyle();
+//        res->SetStyle(style|wxRAISED_BORDER);
         panel = new wxPanel;
         wxResourceEditorDialogHandler *handler = new wxResourceEditorDialogHandler(panel, res, panel->GetEventHandler(),
            this);
@@ -907,7 +930,7 @@ bool wxResourceManager::Edit(wxItemResource *res)
 
         panel->PushEventHandler(handler);
 
-        res->SetStyle(style);
+//        res->SetStyle(style);
                handler->AddChildHandlers(); // Add event handlers for all controls
         AssociateResource(res, panel);
 
@@ -1427,7 +1450,9 @@ bool wxResourceManager::DeleteResource(wxWindow *win)
     {
       RemoveSelection(item);
       childHandler->SelectItem(FALSE);
+#ifndef __WXGTK__
       item->GetParent()->Refresh();
+#endif
     }
   }
   
@@ -2187,10 +2212,19 @@ void ObjectMenuProc(wxMenu& menu, wxCommandEvent& event)
  *
  */
 
+#ifdef __WXGTK__   // I don't dare to delete it...
+BEGIN_EVENT_TABLE(EditorToolBar, wxToolBar)
+END_EVENT_TABLE()
+
+#else
+
 BEGIN_EVENT_TABLE(EditorToolBar, wxToolBar)
        EVT_PAINT(EditorToolBar::OnPaint)
 END_EVENT_TABLE()
 
+#endif
+
 EditorToolBar::EditorToolBar(wxFrame *frame, const wxPoint& pos, const wxSize& size,
             long style):
   wxToolBar(frame, -1, pos, size, style)