Author Topic: wxSmith and the Style woes of the future.  (Read 20233 times)

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7582
    • My Best Post
Re: wxSmith and the Style woes of the future.
« Reply #15 on: July 30, 2018, 12:35:30 pm »
Here is a try to preserve old files. Can someone try if it works and probably do a review if I'm doing the correct thing, because I'm pretty new in the wxsmith code.

Building Win7 wx2.8.12 with your patch; but, I only know a little bit of how to use wxSmith.
I will see if the debug wxs file gets converted correctly. Likely post the changes to get a better opinion on it.
Since, I also do not use debugger very much.

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7582
    • My Best Post
Re: wxSmith and the Style woes of the future.
« Reply #16 on: July 30, 2018, 01:16:27 pm »
The wxs file does not get changed/saved; but, the .cpp and .h files are changed.
Is this on purpose or on accident?
Edit: Thinking about it; it does make sense not to change the wxs file till after the next CB Release and maybe even later than that.

Tested on debuggersettingsdlg.wxs

Code
 src/src/debuggersettingsdlg.cpp | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/src/debuggersettingsdlg.cpp b/src/src/debuggersettingsdlg.cpp
index 68bfe67dd..9fdf9ee6d 100644
--- a/src/src/debuggersettingsdlg.cpp
+++ b/src/src/debuggersettingsdlg.cpp
@@ -3,8 +3,8 @@
 
 #ifndef CB_PRECOMP
  //(*InternalHeadersPCH(DebuggerSettingsDlg)
- #include <wx/string.h>
  #include <wx/intl.h>
+ #include <wx/string.h>
  //*)
 
     #include <wx/choicdlg.h>
@@ -35,18 +35,18 @@ END_EVENT_TABLE()
 DebuggerSettingsDlg::DebuggerSettingsDlg(wxWindow* parent)
 {
  //(*Initialize(DebuggerSettingsDlg)
- wxStaticLine* staticLine;
  wxBoxSizer* headerSizer;
  wxBoxSizer* mainSizer;
- wxStdDialogButtonSizer* stdDialogButtons;
  wxPanel* header;
+ wxStaticLine* staticLine;
+ wxStdDialogButtonSizer* stdDialogButtons;
 
  Create(parent, wxID_ANY, _("Debugger settings"), wxDefaultPosition, wxDefaultSize, wxCAPTION|wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxCLOSE_BOX|wxMAXIMIZE_BOX|wxMINIMIZE_BOX, _T("wxID_ANY"));
  mainSizer = new wxBoxSizer(wxVERTICAL);
- header = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxNO_BORDER|wxTRANSPARENT_WINDOW, _T("wxID_ANY"));
+ header = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE|wxTRANSPARENT_WINDOW, _T("wxID_ANY"));
  header->SetBackgroundColour(wxColour(0,64,128));
  headerSizer = new wxBoxSizer(wxHORIZONTAL);
- m_activeInfo = new wxStaticText(header, ID_LABEL_ACTIVE_INFO, _("Active debugger config"), wxDefaultPosition, wxDefaultSize, wxNO_BORDER|wxTRANSPARENT_WINDOW, _T("ID_LABEL_ACTIVE_INFO"));
+ m_activeInfo = new wxStaticText(header, ID_LABEL_ACTIVE_INFO, _("Active debugger config"), wxDefaultPosition, wxDefaultSize, wxBORDER_NONE|wxTRANSPARENT_WINDOW, _T("ID_LABEL_ACTIVE_INFO"));
  m_activeInfo->SetForegroundColour(wxColour(255,255,255));
  m_activeInfo->SetBackgroundColour(wxColour(0,64,128));
  wxFont m_activeInfoFont(12,wxFONTFAMILY_DEFAULT,wxFONTSTYLE_NORMAL,wxFONTWEIGHT_BOLD,false,wxEmptyString,wxFONTENCODING_DEFAULT);

Code
 src/src/debuggersettingsdlg.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/src/debuggersettingsdlg.h b/src/src/debuggersettingsdlg.h
index 9ab0523f7..749848bb4 100644
--- a/src/src/debuggersettingsdlg.h
+++ b/src/src/debuggersettingsdlg.h
@@ -3,9 +3,9 @@
 
 #ifndef CB_PRECOMP
  //(*HeadersPCH(DebuggerSettingsDlg)
- #include <wx/sizer.h>
- #include <wx/panel.h>
  #include "scrollingdialog.h"
+ #include <wx/panel.h>
+ #include <wx/sizer.h>
  #include <wx/stattext.h>
  //*)
 
@@ -40,8 +40,8 @@ class DebuggerSettingsDlg: public wxScrollingDialog
 
  private:
  //(*Declarations(DebuggerSettingsDlg)
- wxTreebook* m_treebook;
  wxStaticText* m_activeInfo;
+ wxTreebook* m_treebook;
  //*)
 
  //(*Identifiers(DebuggerSettingsDlg)

Tim S.
« Last Edit: July 30, 2018, 01:20:51 pm by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: wxSmith and the Style woes of the future.
« Reply #17 on: July 30, 2018, 01:27:29 pm »
The wxs file does not get changed/saved; but, the .cpp and .h files are changed.
Is this on purpose or on accident?
Does the wxs file change if you edit it (unrelated to the style changes)? I think this is sort of expected with the current version and it is accidental.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1553
Re: wxSmith and the Style woes of the future.
« Reply #18 on: July 30, 2018, 01:37:19 pm »
Works for me in W7/64 with wx3.1.1/32, can open WXS files with old style flags and they get converted on the fly in the WXS editor. The CPP and WXS files only change when any property is modified within the editor.

Probably the "upgraded" WXS file will fail to load with an unpatched CB, have not tested this because I executed update31 and lost the unpatched version.

Anyway, the old names are still valid and there is no deprecation notice, just the 'old' comment.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: wxSmith and the Style woes of the future.
« Reply #19 on: July 30, 2018, 03:01:40 pm »
I guess the assert is shown, because we don't prevent two styles related to borders to be set simultaneously. Unfortunately the check seems to be windows only.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline ouch

  • Almost regular
  • **
  • Posts: 223
Re: wxSmith and the Style woes of the future.
« Reply #20 on: July 30, 2018, 07:34:40 pm »
I'm at work atm I'll check that patch when I get off. But what happens when you open a wxs file that contains old styles with the patched wxsmith is simply no style gets checked. No error messages or anything. I assume that's because no option matches what is saved and it's just ignored as a result.

edit: Oh, also don't forget wxSmith can save .XRC code too. So it needs to write correctly to the users code, the wxs file and the wxSmith generated xrc file too.

I have an active project that uses XRC files so I'll check that your patch works with those after work too.

Also can linux controls actually have two border styles applied to them? Or should the style selection be changed to like a combobox or something so only one can be selected?
« Last Edit: July 30, 2018, 07:41:21 pm by ouch »

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: wxSmith and the Style woes of the future.
« Reply #21 on: July 30, 2018, 11:04:11 pm »
Doesn't make sense to have, but these are style flags, so the control cannot be changed to a radiobox/button or similar.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline ouch

  • Almost regular
  • **
  • Posts: 223
Re: wxSmith and the Style woes of the future.
« Reply #22 on: July 31, 2018, 06:27:08 am »
That patch works for me in that the value gets converted properly on load but doesn't actually get changed on anything until something is changed causing wxSmith to update. once that happens however all files are changed accordingly.