From: Julian Smart Date: Sun, 6 Sep 1998 16:55:57 +0000 (+0000) Subject: Commented out Robert's SetFont change for now; changed menu handling slightly X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/560b92f577ddd77b1f44eece2b33543608eb52af Commented out Robert's SetFont change for now; changed menu handling slightly in Dialog Editor; use wxConfig now in Dialog Editor git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@683 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index 4a17f081c1..8159b280a2 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -1927,7 +1927,19 @@ bool wxWindow::IsOwnGtkWindow( GdkWindow *window ) void wxWindow::SetFont( const wxFont &font ) { m_font = font; - GtkStyle *style = (GtkStyle*) NULL; + + // Unfortunately this results in a crash in GTK on deletion + // of windows, e.g. the wxStatusBar in Dialog Editor. +#if 0 + + // ADDED BY JACS: not sure if this is the right thing to do, + // but will avoid a segv when SetFont(wxNullFont) is called. + if (((wxFont*) &font)->Ok()) + m_font = font; + else + m_font = *wxSWISS_FONT; + + GtkStyle *style = (GtkStyle`*) NULL; if (!m_hasOwnStyle) { m_hasOwnStyle = TRUE; @@ -1942,6 +1954,7 @@ void wxWindow::SetFont( const wxFont &font ) style->font = gdk_font_ref( m_font.GetInternalFont( 1.0 ) ); gtk_widget_set_style( m_widget, style ); +#endif } wxFont *wxWindow::GetFont(void) diff --git a/src/gtk1/window.cpp b/src/gtk1/window.cpp index 4a17f081c1..8159b280a2 100644 --- a/src/gtk1/window.cpp +++ b/src/gtk1/window.cpp @@ -1927,7 +1927,19 @@ bool wxWindow::IsOwnGtkWindow( GdkWindow *window ) void wxWindow::SetFont( const wxFont &font ) { m_font = font; - GtkStyle *style = (GtkStyle*) NULL; + + // Unfortunately this results in a crash in GTK on deletion + // of windows, e.g. the wxStatusBar in Dialog Editor. +#if 0 + + // ADDED BY JACS: not sure if this is the right thing to do, + // but will avoid a segv when SetFont(wxNullFont) is called. + if (((wxFont*) &font)->Ok()) + m_font = font; + else + m_font = *wxSWISS_FONT; + + GtkStyle *style = (GtkStyle`*) NULL; if (!m_hasOwnStyle) { m_hasOwnStyle = TRUE; @@ -1942,6 +1954,7 @@ void wxWindow::SetFont( const wxFont &font ) style->font = gdk_font_ref( m_font.GetInternalFont( 1.0 ) ); gtk_widget_set_style( m_widget, style ); +#endif } wxFont *wxWindow::GetFont(void) diff --git a/utils/dialoged/src/dlghndlr.cpp b/utils/dialoged/src/dlghndlr.cpp index aad48c3e3b..cfa37ec97e 100644 --- a/utils/dialoged/src/dlghndlr.cpp +++ b/utils/dialoged/src/dlghndlr.cpp @@ -144,8 +144,6 @@ void wxResourceEditorDialogHandler::OnLeftClick(int x, int y, int keys) return; } - wxResourceManager* manager = resourceManager; - switch (wxResourceManager::GetCurrentResourceManager()->GetEditorControlList()->GetSelection()) { case RESED_BUTTON: @@ -214,7 +212,7 @@ void wxResourceEditorDialogHandler::OnRightClick(int x, int y, int WXUNUSED(keys handlerDialog->PopupMenu(menu, x, y); } -void wxResourceEditorDialogHandler::OnItemLeftClick(wxControl *item, int x, int y, int keys) +void wxResourceEditorDialogHandler::OnItemLeftClick(wxControl *item, int WXUNUSED(x), int WXUNUSED(y), int keys) { if (keys & wxKEY_CTRL) { @@ -346,7 +344,7 @@ void wxResourceEditorDialogHandler::OnMouseEvent(wxMouseEvent& event) OnLeftClick(x, y, keys); } - else if (event.RightUp()) + else if (event.RightDown()) { if (m_mouseCaptured) { @@ -466,6 +464,7 @@ void wxResourceEditorDialogHandler::ProcessItemEvent(wxControl *item, wxMouseEve { oldDragX = x; oldDragY = y; } + // Obsolete; no longer try to right-drag else if (event.RightUp() && dragItem && dragMode == wxDRAG_MODE_CONTINUE_RIGHT) { dragMode = wxDRAG_MODE_NONE; @@ -499,6 +498,20 @@ void wxResourceEditorDialogHandler::ProcessItemEvent(wxControl *item, wxMouseEve } else if (event.RightDown()) { + if (m_mouseCaptured) + { + handlerDialog->ReleaseMouse(); + m_mouseCaptured = FALSE; + } + + if (item) + childHandler->OnRightClick(x, y, keys); + else + OnRightClick(x, y, keys); + + dragItem = NULL; dragMode = wxDRAG_MODE_NONE; dragType = wxDRAG_TYPE_NONE; + + /* dragItem = item; dragMode = wxDRAG_MODE_START_RIGHT; firstDragX = x; @@ -510,6 +523,7 @@ void wxResourceEditorDialogHandler::ProcessItemEvent(wxControl *item, wxMouseEve handlerDialog->CaptureMouse(); m_mouseCaptured = TRUE; } + */ } else if (event.LeftUp()) { @@ -528,6 +542,7 @@ void wxResourceEditorDialogHandler::ProcessItemEvent(wxControl *item, wxMouseEve } else if (event.RightUp()) { + /* if (dragItem) childHandler->OnRightClick(x, y, keys); else @@ -540,6 +555,7 @@ void wxResourceEditorDialogHandler::ProcessItemEvent(wxControl *item, wxMouseEve handlerDialog->ReleaseMouse(); m_mouseCaptured = FALSE; } + */ } } } @@ -716,7 +732,6 @@ void wxResourceEditorControlHandler::OnDragBegin(int x, int y, int WXUNUSED(keys // dc.DestroyClippingRegion(); wxPanel *panel = (wxPanel *)handlerControl->GetParent(); - wxResourceEditorDialogHandler *panelHandler = (wxResourceEditorDialogHandler *)panel->GetEventHandler(); // Erase selection handles // DrawSelectionHandles(dc, TRUE); @@ -769,11 +784,9 @@ void wxResourceEditorControlHandler::OnDragBegin(int x, int y, int WXUNUSED(keys dc.EndDrawing(); } -void wxResourceEditorControlHandler::OnDragContinue(bool paintIt, int x, int y, int WXUNUSED(keys), wxDC& dc, int selectionHandle) +void wxResourceEditorControlHandler::OnDragContinue(bool WXUNUSED(paintIt), int x, int y, int WXUNUSED(keys), wxDC& dc, int selectionHandle) { wxPanel *panel = (wxPanel *)handlerControl->GetParent(); - wxResourceEditorDialogHandler *panelHandler = (wxResourceEditorDialogHandler *)panel->GetEventHandler(); - int xpos, ypos, width, height; handlerControl->GetPosition(&xpos, &ypos); handlerControl->GetSize(&width, &height); @@ -890,7 +903,6 @@ void wxResourceEditorControlHandler::OnDragContinue(bool paintIt, int x, int y, void wxResourceEditorControlHandler::OnDragEnd(int x, int y, int WXUNUSED(keys), wxDC& dc, int selectionHandle) { wxPanel *panel = (wxPanel *)handlerControl->GetParent(); - wxResourceEditorDialogHandler *panelHandler = (wxResourceEditorDialogHandler *)panel->GetEventHandler(); dc.BeginDrawing(); diff --git a/utils/dialoged/src/reseditr.cpp b/utils/dialoged/src/reseditr.cpp index cf9467e0d4..0b9de9be09 100644 --- a/utils/dialoged/src/reseditr.cpp +++ b/utils/dialoged/src/reseditr.cpp @@ -37,6 +37,7 @@ #endif #include "wx/scrolbar.h" +#include "wx/config.h" #include #include @@ -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; @@ -197,6 +198,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 +218,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 +244,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 +311,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