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
This commit is contained in:
Julian Smart
1998-09-06 16:55:57 +00:00
parent acb62b847b
commit 560b92f577
4 changed files with 78 additions and 14 deletions

View File

@@ -1927,7 +1927,19 @@ bool wxWindow::IsOwnGtkWindow( GdkWindow *window )
void wxWindow::SetFont( const wxFont &font ) void wxWindow::SetFont( const wxFont &font )
{ {
m_font = 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) if (!m_hasOwnStyle)
{ {
m_hasOwnStyle = TRUE; m_hasOwnStyle = TRUE;
@@ -1942,6 +1954,7 @@ void wxWindow::SetFont( const wxFont &font )
style->font = gdk_font_ref( m_font.GetInternalFont( 1.0 ) ); style->font = gdk_font_ref( m_font.GetInternalFont( 1.0 ) );
gtk_widget_set_style( m_widget, style ); gtk_widget_set_style( m_widget, style );
#endif
} }
wxFont *wxWindow::GetFont(void) wxFont *wxWindow::GetFont(void)

View File

@@ -1927,7 +1927,19 @@ bool wxWindow::IsOwnGtkWindow( GdkWindow *window )
void wxWindow::SetFont( const wxFont &font ) void wxWindow::SetFont( const wxFont &font )
{ {
m_font = 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) if (!m_hasOwnStyle)
{ {
m_hasOwnStyle = TRUE; m_hasOwnStyle = TRUE;
@@ -1942,6 +1954,7 @@ void wxWindow::SetFont( const wxFont &font )
style->font = gdk_font_ref( m_font.GetInternalFont( 1.0 ) ); style->font = gdk_font_ref( m_font.GetInternalFont( 1.0 ) );
gtk_widget_set_style( m_widget, style ); gtk_widget_set_style( m_widget, style );
#endif
} }
wxFont *wxWindow::GetFont(void) wxFont *wxWindow::GetFont(void)

View File

@@ -144,8 +144,6 @@ void wxResourceEditorDialogHandler::OnLeftClick(int x, int y, int keys)
return; return;
} }
wxResourceManager* manager = resourceManager;
switch (wxResourceManager::GetCurrentResourceManager()->GetEditorControlList()->GetSelection()) switch (wxResourceManager::GetCurrentResourceManager()->GetEditorControlList()->GetSelection())
{ {
case RESED_BUTTON: case RESED_BUTTON:
@@ -214,7 +212,7 @@ void wxResourceEditorDialogHandler::OnRightClick(int x, int y, int WXUNUSED(keys
handlerDialog->PopupMenu(menu, x, y); 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) if (keys & wxKEY_CTRL)
{ {
@@ -346,7 +344,7 @@ void wxResourceEditorDialogHandler::OnMouseEvent(wxMouseEvent& event)
OnLeftClick(x, y, keys); OnLeftClick(x, y, keys);
} }
else if (event.RightUp()) else if (event.RightDown())
{ {
if (m_mouseCaptured) if (m_mouseCaptured)
{ {
@@ -466,6 +464,7 @@ void wxResourceEditorDialogHandler::ProcessItemEvent(wxControl *item, wxMouseEve
{ {
oldDragX = x; oldDragY = y; oldDragX = x; oldDragY = y;
} }
// Obsolete; no longer try to right-drag
else if (event.RightUp() && dragItem && dragMode == wxDRAG_MODE_CONTINUE_RIGHT) else if (event.RightUp() && dragItem && dragMode == wxDRAG_MODE_CONTINUE_RIGHT)
{ {
dragMode = wxDRAG_MODE_NONE; dragMode = wxDRAG_MODE_NONE;
@@ -499,6 +498,20 @@ void wxResourceEditorDialogHandler::ProcessItemEvent(wxControl *item, wxMouseEve
} }
else if (event.RightDown()) 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; dragItem = item;
dragMode = wxDRAG_MODE_START_RIGHT; dragMode = wxDRAG_MODE_START_RIGHT;
firstDragX = x; firstDragX = x;
@@ -510,6 +523,7 @@ void wxResourceEditorDialogHandler::ProcessItemEvent(wxControl *item, wxMouseEve
handlerDialog->CaptureMouse(); handlerDialog->CaptureMouse();
m_mouseCaptured = TRUE; m_mouseCaptured = TRUE;
} }
*/
} }
else if (event.LeftUp()) else if (event.LeftUp())
{ {
@@ -528,6 +542,7 @@ void wxResourceEditorDialogHandler::ProcessItemEvent(wxControl *item, wxMouseEve
} }
else if (event.RightUp()) else if (event.RightUp())
{ {
/*
if (dragItem) if (dragItem)
childHandler->OnRightClick(x, y, keys); childHandler->OnRightClick(x, y, keys);
else else
@@ -540,6 +555,7 @@ void wxResourceEditorDialogHandler::ProcessItemEvent(wxControl *item, wxMouseEve
handlerDialog->ReleaseMouse(); handlerDialog->ReleaseMouse();
m_mouseCaptured = FALSE; m_mouseCaptured = FALSE;
} }
*/
} }
} }
} }
@@ -716,7 +732,6 @@ void wxResourceEditorControlHandler::OnDragBegin(int x, int y, int WXUNUSED(keys
// dc.DestroyClippingRegion(); // dc.DestroyClippingRegion();
wxPanel *panel = (wxPanel *)handlerControl->GetParent(); wxPanel *panel = (wxPanel *)handlerControl->GetParent();
wxResourceEditorDialogHandler *panelHandler = (wxResourceEditorDialogHandler *)panel->GetEventHandler();
// Erase selection handles // Erase selection handles
// DrawSelectionHandles(dc, TRUE); // DrawSelectionHandles(dc, TRUE);
@@ -769,11 +784,9 @@ void wxResourceEditorControlHandler::OnDragBegin(int x, int y, int WXUNUSED(keys
dc.EndDrawing(); 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(); wxPanel *panel = (wxPanel *)handlerControl->GetParent();
wxResourceEditorDialogHandler *panelHandler = (wxResourceEditorDialogHandler *)panel->GetEventHandler();
int xpos, ypos, width, height; int xpos, ypos, width, height;
handlerControl->GetPosition(&xpos, &ypos); handlerControl->GetPosition(&xpos, &ypos);
handlerControl->GetSize(&width, &height); 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) void wxResourceEditorControlHandler::OnDragEnd(int x, int y, int WXUNUSED(keys), wxDC& dc, int selectionHandle)
{ {
wxPanel *panel = (wxPanel *)handlerControl->GetParent(); wxPanel *panel = (wxPanel *)handlerControl->GetParent();
wxResourceEditorDialogHandler *panelHandler = (wxResourceEditorDialogHandler *)panel->GetEventHandler();
dc.BeginDrawing(); dc.BeginDrawing();

View File

@@ -37,6 +37,7 @@
#endif #endif
#include "wx/scrolbar.h" #include "wx/scrolbar.h"
#include "wx/config.h"
#include <ctype.h> #include <ctype.h>
#include <stdlib.h> #include <stdlib.h>
@@ -104,8 +105,8 @@ wxResourceManager::wxResourceManager():
m_editorToolBar = NULL; m_editorToolBar = NULL;
// Default window positions // Default window positions
m_resourceEditorWindowSize.width = 470; m_resourceEditorWindowSize.width = 500;
m_resourceEditorWindowSize.height = 300; m_resourceEditorWindowSize.height = 450;
m_resourceEditorWindowSize.x = 0; m_resourceEditorWindowSize.x = 0;
m_resourceEditorWindowSize.y = 0; m_resourceEditorWindowSize.y = 0;
@@ -197,6 +198,18 @@ bool wxResourceManager::Initialize()
bool wxResourceManager::LoadOptions() 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", "editorWindowX", &m_resourceEditorWindowSize.x, m_optionsResourceFilename.GetData());
wxGetResource("DialogEd", "editorWindowY", &m_resourceEditorWindowSize.y, m_optionsResourceFilename.GetData()); wxGetResource("DialogEd", "editorWindowY", &m_resourceEditorWindowSize.y, m_optionsResourceFilename.GetData());
wxGetResource("DialogEd", "editorWindowWidth", &m_resourceEditorWindowSize.width, 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", "propertyWindowY", &m_propertyWindowSize.y, m_optionsResourceFilename.GetData());
wxGetResource("DialogEd", "propertyWindowWidth", &m_propertyWindowSize.width, m_optionsResourceFilename.GetData()); wxGetResource("DialogEd", "propertyWindowWidth", &m_propertyWindowSize.width, m_optionsResourceFilename.GetData());
wxGetResource("DialogEd", "propertyWindowHeight", &m_propertyWindowSize.height, m_optionsResourceFilename.GetData()); wxGetResource("DialogEd", "propertyWindowHeight", &m_propertyWindowSize.height, m_optionsResourceFilename.GetData());
*/
return TRUE; return TRUE;
} }
bool wxResourceManager::SaveOptions() 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", "editorWindowX", m_resourceEditorWindowSize.x, m_optionsResourceFilename.GetData());
wxWriteResource("DialogEd", "editorWindowY", m_resourceEditorWindowSize.y, m_optionsResourceFilename.GetData()); wxWriteResource("DialogEd", "editorWindowY", m_resourceEditorWindowSize.y, m_optionsResourceFilename.GetData());
wxWriteResource("DialogEd", "editorWindowWidth", m_resourceEditorWindowSize.width, 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", "propertyWindowY", m_propertyWindowSize.y, m_optionsResourceFilename.GetData());
wxWriteResource("DialogEd", "propertyWindowWidth", m_propertyWindowSize.width, m_optionsResourceFilename.GetData()); wxWriteResource("DialogEd", "propertyWindowWidth", m_propertyWindowSize.width, m_optionsResourceFilename.GetData());
wxWriteResource("DialogEd", "propertyWindowHeight", m_propertyWindowSize.height, m_optionsResourceFilename.GetData()); wxWriteResource("DialogEd", "propertyWindowHeight", m_propertyWindowSize.height, m_optionsResourceFilename.GetData());
*/
return TRUE; return TRUE;
} }
@@ -285,7 +311,7 @@ bool wxResourceManager::ShowResourceEditor(bool show, wxWindow *WXUNUSED(parent)
c->bottom.SameAs (m_editorFrame, wxBottom, 0); c->bottom.SameAs (m_editorFrame, wxBottom, 0);
c->width.Unconstrained(); c->width.Unconstrained();
#ifdef __WXGTK__ #ifdef __WXGTK__
c->height.Absolute(70); c->height.Absolute(140);
#else #else
c->height.Absolute(60); c->height.Absolute(60);
#endif #endif