]> git.saurik.com Git - wxWidgets.git/blobdiff - utils/dialoged/src/reseditr.cpp
New wxHtml stuff, including a TagHandler for placing wxPython widgets
[wxWidgets.git] / utils / dialoged / src / reseditr.cpp
index a5f3709768539b682e17dcf9cfee418dbf35fa3a..e6157c5e8240dad2d24e22957e2619f626a6c715 100644 (file)
 #include <math.h>
 #include <string.h>
 
-#if wxUSE_IOSTREAMH
-#if defined(__WXMSW__) && !defined(__GNUWIN32__)
-#include <strstrea.h>
-#else
-#include <strstream.h>
-#endif
-#else
-#include <strstream>
-#endif
-
-#ifdef __WXMSW__
-#include <windows.h>
-#endif
-
 #ifdef __WXMSW__
 #include "wx/help.h"
 #endif
@@ -152,12 +138,13 @@ wxResourceManager::~wxResourceManager()
 bool wxResourceManager::Initialize()
 {
   // Set up the resource filename for each platform.
+  // TODO: This shold be replaced by wxConfig usage.
 #ifdef __WXMSW__
   // dialoged.ini in the Windows directory
-  char buf[256];
-  GetWindowsDirectory(buf, 256);
-  strcat(buf, "\\dialoged.ini");
-  m_optionsResourceFilename = buf;
+  wxString windowsDir = wxGetOSDirectory();
+  windowsDir += "\\dialoged.ini" ;
+
+  m_optionsResourceFilename = windowsDir;
 #elif defined(__WXGTK__) || defined(__WXMOTIF__)
   wxGetHomeDir( &m_optionsResourceFilename );
   m_optionsResourceFilename += "/.dialogedrc";
@@ -323,7 +310,7 @@ bool wxResourceManager::ShowResourceEditor(bool show, wxWindow *WXUNUSED(parent)
     c->bottom.SameAs     (m_editorFrame, wxBottom, 0);
     c->width.Unconstrained();
 #if defined(__WXGTK__) || defined(__WXMOTIF__)
-    c->height.Absolute(105);
+    c->height.Absolute(120);
 #else
     c->height.Absolute(60);
 #endif
@@ -340,10 +327,8 @@ bool wxResourceManager::ShowResourceEditor(bool show, wxWindow *WXUNUSED(parent)
   else
   {
     wxFrame *fr = m_editorFrame;
-    if (m_editorFrame->OnClose())
+    if (m_editorFrame->Close())
     {
-      fr->Show(FALSE);
-      delete fr;
       m_editorFrame = NULL;
       m_editorPanel = NULL;
     }
@@ -394,7 +379,7 @@ bool wxResourceManager::Save(const wxString& filename)
 bool wxResourceManager::SaveAs()
 {
   wxString s(wxFileSelector("Save resource file", wxPathOnly(WXSTRINGCAST m_currentFilename), wxFileNameFromPath(WXSTRINGCAST m_currentFilename),
-    "wxr", "*.wxr", wxSAVE | wxOVERWRITE_PROMPT));
+    "wxr", "*.wxr", wxSAVE | wxOVERWRITE_PROMPT, wxTheApp->GetTopWindow()));
     
   if (s.IsNull() || s == "")
     return FALSE;
@@ -437,7 +422,7 @@ bool wxResourceManager::New(bool loadFromFile, const wxString& filename)
     wxString str = filename;
     if (str == wxString(""))
     {
-      wxString f(wxFileSelector("Open resource file", NULL, NULL, "wxr", "*.wxr", 0, NULL));
+      wxString f(wxFileSelector("Open resource file", NULL, NULL, "wxr", "*.wxr", 0, wxTheApp->GetTopWindow()));
       if (!f.IsNull() && f != "")
         str = f;
       else
@@ -2076,6 +2061,7 @@ BEGIN_EVENT_TABLE(wxResourceEditorFrame, wxFrame)
     EVT_MENU(RESED_DELETE, wxResourceEditorFrame::OnDeleteSelection)
     EVT_MENU(RESED_RECREATE, wxResourceEditorFrame::OnRecreateSelection)
     EVT_MENU(RESED_TEST, wxResourceEditorFrame::OnTest)
+    EVT_CLOSE(wxResourceEditorFrame::OnCloseWindow)
 END_EVENT_TABLE()
 
 wxResourceEditorFrame::wxResourceEditorFrame(wxResourceManager *resMan, wxFrame *parent, const wxString& title,
@@ -2157,12 +2143,15 @@ void wxResourceEditorFrame::OnRecreateSelection(wxCommandEvent& WXUNUSED(event))
       manager->RecreateSelection();
 }
 
-bool wxResourceEditorFrame::OnClose()
+void wxResourceEditorFrame::OnCloseWindow(wxCloseEvent& event)
 {
   if (manager->Modified())
   {
-  if (!manager->Clear(TRUE, FALSE))
-     return FALSE;
+     if (!manager->Clear(TRUE, FALSE))
+     {
+       event.Veto();
+       return;
+    }
   }
     
   if (!Iconized())
@@ -2181,7 +2170,7 @@ bool wxResourceEditorFrame::OnClose()
   manager->SetEditorFrame(NULL);
   manager->SetEditorToolBar(NULL);
 
-  return TRUE;
+  this->Destroy();
 }
 
 /*
@@ -2189,7 +2178,6 @@ bool wxResourceEditorFrame::OnClose()
  */
 
 BEGIN_EVENT_TABLE(wxResourceEditorScrolledWindow, wxScrolledWindow)
-    EVT_SCROLL(wxResourceEditorScrolledWindow::OnScroll)
     EVT_PAINT(wxResourceEditorScrolledWindow::OnPaint)
 END_EVENT_TABLE()
 
@@ -2208,17 +2196,6 @@ wxResourceEditorScrolledWindow::~wxResourceEditorScrolledWindow()
 {
 }
 
-void wxResourceEditorScrolledWindow::OnScroll(wxScrollEvent& event)
-{
-    wxScrolledWindow::OnScroll(event);
-
-    int x, y;
-    ViewStart(& x, & y);
-
-    if (m_childWindow)
-        m_childWindow->Move(m_marginX + (- x * 10), m_marginY + (- y * 10));
-}
-
 void wxResourceEditorScrolledWindow::OnPaint(wxPaintEvent& WXUNUSED(event))
 {
     wxPaintDC dc(this);
@@ -2281,19 +2258,10 @@ void ObjectMenuProc(wxMenu& menu, wxCommandEvent& event)
  *
  */
 
-#if defined(__WXGTK__) || defined(__WXMOTIF__)   // I don't dare to delete it...
 BEGIN_EVENT_TABLE(EditorToolBar, wxToolBar)
+//     EVT_PAINT(EditorToolBar::OnPaint)
 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)