From 386af6a2fa349e16f9b8abd32e3fedf13f021686 Mon Sep 17 00:00:00 2001 From: Julian Smart Date: Tue, 3 Nov 1998 15:43:57 +0000 Subject: [PATCH] Dialog Editor bug fixes, several other small ones git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@957 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/msw/todo.txt | 3 +++ src/common/resource.cpp | 25 +++++++++++++++---------- src/common/valtext.cpp | 15 ++++++++++++++- src/generic/gridg.cpp | 8 ++++---- src/msw/listctrl.cpp | 4 ++++ src/msw/window.cpp | 6 ++++++ user/wxLayout/README | Bin 1815 -> 1443 bytes utils/dialoged/src/reseditr.cpp | 14 ++++++++++++-- utils/dialoged/src/reswrite.cpp | 6 +++++- utils/dialoged/src/winprop.cpp | 32 +++++++++++++++----------------- 10 files changed, 78 insertions(+), 35 deletions(-) diff --git a/docs/msw/todo.txt b/docs/msw/todo.txt index 20fcd05992..e3510dfc97 100644 --- a/docs/msw/todo.txt +++ b/docs/msw/todo.txt @@ -86,6 +86,9 @@ Add centring, right justify styles to wxStaticText. Synchronize drawing functions on all platforms, using Chris's code to test them. +Extend wxSystemSettings to get symbols for current nationality, +e.g. ',' instead of '.' for decimal points. + LOW PRIORITY ------------ diff --git a/src/common/resource.cpp b/src/common/resource.cpp index ecc8121d7d..0c2cc28936 100644 --- a/src/common/resource.cpp +++ b/src/common/resource.cpp @@ -960,26 +960,31 @@ wxItemResource *wxResourceInterpretControl(wxResourceTable& table, wxExpr *expr) } controlItem->SetStringValues(stringList); count ++; - +// This is now obsolete: it's in the window style. // Check for wxSINGLE/wxMULTIPLE wxExpr *mult = (wxExpr *) NULL; +/* controlItem->SetValue1(wxLB_SINGLE); +*/ if ((mult = expr->Nth(count)) && ((mult->Type() == PrologString)||(mult->Type() == PrologWord))) { +/* wxString m(mult->StringValue()); - if (m == "wxMULTIPLE") + if (m == "wxLB_MULTIPLE") controlItem->SetValue1(wxLB_MULTIPLE); - else if (m == "wxEXTENDED") + else if (m == "wxLB_EXTENDED") controlItem->SetValue1(wxLB_EXTENDED); +*/ + // Ignore the value count ++; - if (expr->Nth(count) && expr->Nth(count)->Type() == PrologList) - { - // controlItem->SetLabelFont(wxResourceInterpretFontSpec(expr->Nth(count))); + } + if (expr->Nth(count) && expr->Nth(count)->Type() == PrologList) + { + // controlItem->SetLabelFont(wxResourceInterpretFontSpec(expr->Nth(count))); count ++; - if (expr->Nth(count) && expr->Nth(count)->Type() == PrologList) - controlItem->SetFont(wxResourceInterpretFontSpec(expr->Nth(count))); - } - } + if (expr->Nth(count) && expr->Nth(count)->Type() == PrologList) + controlItem->SetFont(wxResourceInterpretFontSpec(expr->Nth(count))); + } } } else if (controlType == "wxChoice") diff --git a/src/common/valtext.cpp b/src/common/valtext.cpp index 3973230d80..a14a082387 100644 --- a/src/common/valtext.cpp +++ b/src/common/valtext.cpp @@ -42,6 +42,8 @@ BEGIN_EVENT_TABLE(wxTextValidator, wxValidator) END_EVENT_TABLE() #endif +static bool wxIsNumeric(const wxString& val); + wxTextValidator::wxTextValidator(long style, wxString *val) { m_validatorStyle = style ; @@ -169,7 +171,8 @@ bool wxTextValidator::Validate(wxWindow *parent) wxMessageBox(buf,_("Validation conflict"), wxOK | wxICON_EXCLAMATION, parent); return FALSE; } - if ( (m_validatorStyle & wxFILTER_NUMERIC) && !val.IsNumber()) + if ( (m_validatorStyle & wxFILTER_NUMERIC) && !wxIsNumeric(val)) + { char buf[512]; sprintf(buf, _("%s should be numeric."), (const char *)val); @@ -291,4 +294,14 @@ void wxTextValidator::OnChar(wxKeyEvent& event) textCtrl->wxTextCtrl::OnChar(event); } +static bool wxIsNumeric(const wxString& val) +{ + int i; + for ( i = 0; i < (int)val.Length(); i++) + { + if ((!isdigit(val[i])) && (val[i] != '.')) + return FALSE; + } + return TRUE; +} diff --git a/src/generic/gridg.cpp b/src/generic/gridg.cpp index d12a8a9e1b..4b639f1e51 100644 --- a/src/generic/gridg.cpp +++ b/src/generic/gridg.cpp @@ -927,7 +927,7 @@ void wxGenericGrid::AdjustScrollbars(void) int noHorizSteps = 0; int noVertSteps = 0; - if (m_totalGridWidth <= cw) + if (m_totalGridWidth + vertScrollBarWidth <= cw) noHorizSteps = 0; else { @@ -954,7 +954,7 @@ void wxGenericGrid::AdjustScrollbars(void) noHorizSteps += nx; } - if (m_totalGridHeight <= ch) + if (m_totalGridHeight + horizScrollBarHeight <= ch) noVertSteps = 0; else { @@ -981,7 +981,7 @@ void wxGenericGrid::AdjustScrollbars(void) noVertSteps += ny; } - if (m_totalGridWidth <= cw) + if (m_totalGridWidth + vertScrollBarWidth <= cw) { if ( m_hScrollBar ) m_hScrollBar->Show(FALSE); @@ -993,7 +993,7 @@ void wxGenericGrid::AdjustScrollbars(void) m_hScrollBar->Show(TRUE); } - if (m_totalGridHeight <= ch) + if (m_totalGridHeight + horizScrollBarHeight <= ch) { if ( m_vScrollBar ) m_vScrollBar->Show(FALSE); diff --git a/src/msw/listctrl.cpp b/src/msw/listctrl.cpp index 6a0e5dec10..5b3229a3b4 100644 --- a/src/msw/listctrl.cpp +++ b/src/msw/listctrl.cpp @@ -463,7 +463,11 @@ wxTextCtrl* wxListCtrl::GetEditControl(void) const bool wxListCtrl::GetItem(wxListItem& info) const { LV_ITEM lvItem; +#ifdef __MINGW32__ + memset(&lvItem, 0, sizeof(lvItem)); +#else ZeroMemory(&lvItem, sizeof(lvItem)); // must set all fields to 0 +#endif lvItem.iItem = info.m_itemId; diff --git a/src/msw/window.cpp b/src/msw/window.cpp index 6ed701daed..2031e5cc84 100644 --- a/src/msw/window.cpp +++ b/src/msw/window.cpp @@ -433,6 +433,12 @@ bool wxWindow::Create(wxWindow *parent, wxWindowID id, int width = size.x; int height = size.y; + // To be consistent with wxGTK + if (width == -1) + width = 20; + if (height == -1) + height = 20; + wxSystemSettings settings; m_backgroundColour = settings.GetSystemColour(wxSYS_COLOUR_WINDOW) ; ; diff --git a/user/wxLayout/README b/user/wxLayout/README index 5539268bc7dac5936ee0489c21b5a84c9756f4ad..a60e58f6060c6c9fe592887456c2c6b8781f4592 100644 GIT binary patch delta 514 zcmaKoJx;_h5QX=T6h@*!v}i7CT8YH}OwCpV zHqpu?D8Z+C=X|Kjfv$YW5*KJ>?lh`gbb-L< delta 987 zcmYLI%Wl*#6je*RF$jUgiifyD0$Ncb!HPkEfTBX73nVHbR>+BO8h0E!vTx?GnvaMO zAHWZ=VaW&a7aV73nN{XGKKH!xz?omteDP+#phMCvNnBcgLK0}o+$m{nqRQ!%NGD3R?Hphdbs;5N zI^N4~mQ1HT76X#15Sf4<`b|;8)y;QTutP#ep~ksQg&N%E!OD8!SnG^& zk3C-_bd&XoqwMUG3XyOxF`h%05p3|gdvL@Ae_yC(c3?DRiad{2vO^YQTm!w#RAu+) z)|)UN{l9zR;5s%K8@Up<%og=2i-eC9hi_XutGf49-UH0k1wYz3LQZ*E1|1DG$jgnp z63uLsUb`{E9BIia%s9HB4PY}9W9ynDdqHx`5>#+A73cnaUX#mrQ+|nRJ!RFh?;r9E zgOroZ3F@wMw$d_O+rGCdPr)CdWqF;B@C)tQ4_-9P0}v>HRAWyXa`@xuOcgR(8wsm| z$Mydy7PQ~TOccJ1g#rnI2sCY-NS2)I!iz709DU{bEJnc#E|K#z?T$Y1q6<;-t6|L( zZR7<8ks4`Tp*}k8{XcuMw7Qob^~54Q9B$pYm1V7Y6;;=b^Rtc%55KqeZX_}2-nh+h zivhYlrq3RQ%cb}2``$A>noOQ3^%suGT6+Kh diff --git a/utils/dialoged/src/reseditr.cpp b/utils/dialoged/src/reseditr.cpp index fd82bb74aa..c41b680fdb 100644 --- a/utils/dialoged/src/reseditr.cpp +++ b/utils/dialoged/src/reseditr.cpp @@ -1020,7 +1020,7 @@ bool wxResourceManager::CreatePanelItem(wxItemResource *panelResource, wxPanel * if ((panelResource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS) != 0) { - wxPoint pt = panel->ConvertPixelsToDialog(pt); + wxPoint pt = panel->ConvertPixelsToDialog(wxPoint(x, y)); res->SetSize(pt.x, pt.y, -1, -1); } else res->SetSize(x, y, -1, -1); @@ -1159,6 +1159,16 @@ bool wxResourceManager::CreatePanelItem(wxItemResource *panelResource, wxPanel * if (!newItem) return FALSE; + int actualW, actualH; + newItem->GetSize(&actualW, &actualH); + wxSize actualSize(actualW, actualH); + + if ((panelResource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS) != 0) + { + actualSize = panel->ConvertPixelsToDialog(actualSize); + } + res->SetSize(res->GetX(), res->GetY(), actualSize.x, actualSize.y); + wxString newIdName; int id = GenerateWindowId(prefix, newIdName); res->SetId(id); @@ -1759,7 +1769,7 @@ wxWindow *wxResourceManager::RecreateWindowFromResource(wxWindow *win, wxWindowP wxWindow *parent = win->GetParent(); wxItemResource* parentResource = NULL; if (parent) - FindResourceForWindow(parent); + parentResource = FindResourceForWindow(parent); if (win->IsKindOf(CLASSINFO(wxPanel))) { diff --git a/utils/dialoged/src/reswrite.cpp b/utils/dialoged/src/reswrite.cpp index 41766cacd1..ef58aaefe6 100644 --- a/utils/dialoged/src/reswrite.cpp +++ b/utils/dialoged/src/reswrite.cpp @@ -310,7 +310,9 @@ bool wxResourceTableWithSaving::SaveResource(ostream& stream, wxItemResource* it node = node->Next(); } } - stream << "], "; + stream << "]"; +/* Styles are now in the window style, not in a separate arg + stream << ", "; switch (item->GetValue1()) { case wxLB_MULTIPLE: @@ -330,6 +332,8 @@ bool wxResourceTableWithSaving::SaveResource(ostream& stream, wxItemResource* it break; } } + */ + if (item->GetFont().Ok()) { stream << ",\\\n "; diff --git a/utils/dialoged/src/winprop.cpp b/utils/dialoged/src/winprop.cpp index 20d6bfbb7f..6b485e5a69 100644 --- a/utils/dialoged/src/winprop.cpp +++ b/utils/dialoged/src/winprop.cpp @@ -1086,22 +1086,16 @@ wxProperty *wxListBoxPropertyInfo::GetProperty(wxString& name) wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(listBox); if (!resource) return NULL; + + char *mult = "wxLB_SINGLE"; - char *mult = "wxSINGLE"; - - switch (resource->GetValue1()) - { - case wxLB_MULTIPLE: + if ((listBox->GetWindowStyleFlag() & wxLB_MULTIPLE) != 0) mult = "wxLB_MULTIPLE"; - break; - case wxLB_EXTENDED: + else if ((listBox->GetWindowStyleFlag() & wxLB_EXTENDED) != 0) mult = "wxLB_EXTENDED"; - break; - default: - case wxLB_SINGLE: + else mult = "wxLB_SINGLE"; - break; - } + return new wxProperty("multiple", mult, "string", new wxStringListValidator(new wxStringList("wxLB_SINGLE", "wxLB_MULTIPLE", "wxLB_EXTENDED", NULL))); @@ -1128,17 +1122,21 @@ bool wxListBoxPropertyInfo::SetProperty(wxString& name, wxProperty *property) } else if (name == "multiple") { - int mult = wxLB_SINGLE; + SetWindowStyle(m_propertyWindow, wxLB_SINGLE, FALSE); + SetWindowStyle(m_propertyWindow, wxLB_MULTIPLE, FALSE); + SetWindowStyle(m_propertyWindow, wxLB_EXTENDED, FALSE); + wxString str(property->GetValue().StringValue()); if (str == "wxLB_MULTIPLE") - mult = wxLB_MULTIPLE; + SetWindowStyle(m_propertyWindow, wxLB_MULTIPLE, TRUE); else if (str == "wxLB_EXTENDED") - mult = wxLB_EXTENDED; + SetWindowStyle(m_propertyWindow, wxLB_EXTENDED, TRUE); else - mult = wxLB_SINGLE; + SetWindowStyle(m_propertyWindow, wxLB_SINGLE, TRUE); + wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(listBox); if (resource) - resource->SetValue1(mult); + resource->SetStyle(m_propertyWindow->GetWindowStyleFlag()); wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(listBox, this); return TRUE; }