I see that in the xrc, the listbookpage(in the page wxWidgets: XRC File Format ) doesn't have the icon or image property, and it is set in the function:
// add all plugins configuration panels
AddPluginPanels();
Not sure where is cause of such issue.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
When the XRC is loading, there is no image in the listctrl. All the images were added here:
void EditorConfigurationDlg::UpdateListbookImages()
{
wxListbook* lb = XRCCTRL(*this, "nbMain", wxListbook);
int sel = lb->GetSelection();
if (SettingsIconsStyle(Manager::Get()->GetConfigManager(_T("app"))->ReadInt(_T("/environment/settings_size"), 0)))
{
SetSettingsIconsStyle(lb->GetListView(), sisNoIcons);
lb->SetImageList(nullptr);
}
else
{
lb->SetImageList(m_pImageList);
// set page images according to their on/off status
for (size_t i = 0; i < IMAGES_COUNT + m_PluginPanels.GetCount(); ++i)
lb->SetPageImage(i, (i * 2) + (sel == (int)i ? 0 : 1));
SetSettingsIconsStyle(lb->GetListView(), sisLargeIcons);
}
// update the page title
wxString label = lb->GetPageText(sel);
// replace any stray & with && because label makes it an underscore
while (label.Replace(_T(" & "), _T(" && ")))
;
XRCCTRL(*this, "lblBigTitle", wxStaticText)->SetLabel(label);
XRCCTRL(*this, "pnlTitleInfo", wxPanel)->Layout();
}
I will try to see what is the size of "lb->GetListView()".
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I can scale the bitmap size of the listview inside the listbook, if I set to 40, then I see the icons are shown in the middle of the listview. But if I change it to 120, I see the same effect, that is the icons are moved a bit to the left edge of the listview, also the image the automatically scaled when put inside the listview.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
What is this code in EditorConfigurationDlg::LoadListbookImages? Mine is totally different. If you want other people to understand you post patches not whole function out of scope.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The notebook sample in the wx git(3.x) head does not expose such issue, I can just use large images, such as 80 x 80 icons, the code need to change is:
It is much simpler, it just set the image list by the function call:
// wxToolbook doesn't work without icons so always use them for it.
if ( m_chkShowImages || m_type == Type_Toolbook )
{
m_bookCtrl->SetImageList(m_imageList);
}
While, in our C::B's code, we did more things, such as set image for each panel.
Last edit: ollydbg 2016-01-05
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
void EditorConfigurationDlg::AddPluginPanels()
{
const wxString base = _T("images/settings/");
// for plugins who do not supply icons, use common generic icons
const wxString noimg = _T("images/settings/generic-plugin");
I just create a very simple wx application, and when I hit a button, a dialog is opened, and I just load the file content "editor_configuration.xrc", and later, I just load several images, and set images on the listbook, it works just fine. See the screen shot as attachment.
To build the wx sample, you may get an build error, since there is no wxScintilla control, so you need to remove such component from the UI. To load and set the images, I just use such code:
I just removed all the non-GUI related code in the constructor of EditorConfigurationDlg, and I still see the wrong position of the icons. This issue also happens if I change the EditorConfigurationDlg class from wxScrollingDialog to wxDialog? (I simply replace the text wxScrollingDialog to wxDialog in the editorconfigurationdlg.cpp and the editorconfigurationdlg.h, also inside the editor_configuration.xrc. )
So, what is the reason? I really don't know. A dialog opened from C::B is behaves badly compared if opened from a minimal sample wx app?
Any hints?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Oh my god, if I simplify the listbook xrc, and I see even a very simple listbook which have only one panel will also expose this error, see the image shot as attachment.
Probably this is asymetric to have a space for a vertical scrollbar.
What happens if you add more items in the listbook and there are items that are not visible?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I can reproduce this bug in a very simple wx sample code under WinXP&MinGW-Build5.2, but another wx user can't not reproduce this bug on Win7&VC++2008.
See that wx-user maillist discussion.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Diff:
This is where the XRC is loaded:
The XRC file is located in:
I see that in the xrc, the listbookpage(in the page wxWidgets: XRC File Format ) doesn't have the icon or image property, and it is set in the function:
Not sure where is cause of such issue.
Have you checked the size of the two list controls?
Probalby the easiest way to debug this is to step into the loading functions to see what happens.
By the looks of it the images are resized and this is causing the uglyness.
When the XRC is loading, there is no image in the listctrl. All the images were added here:
I will try to see what is the size of "lb->GetListView()".
Also in wxGTK it looks fine with wx3.0.
I can scale the bitmap size of the listview inside the listbook, if I set to 40, then I see the icons are shown in the middle of the listview. But if I change it to 120, I see the same effect, that is the icons are moved a bit to the left edge of the listview, also the image the automatically scaled when put inside the listview.
What is this code in EditorConfigurationDlg::LoadListbookImages? Mine is totally different. If you want other people to understand you post patches not whole function out of scope.
The notebook sample in the wx git(3.x) head does not expose such issue, I can just use large images, such as 80 x 80 icons, the code need to change is:
It is much simpler, it just set the image list by the function call:
While, in our C::B's code, we did more things, such as set image for each panel.
Last edit: ollydbg 2016-01-05
BTW: Can you try with wx-master if this same problem exists?
I build C::B trunk against wx-master. (The wx library version is 3.1)
I can still see the same issue as C::B against wx 3.0.2.
If C::B is build with such patch
Then, the result C::B with have 40 sized icon in the Editor configure dialog, and the icon is correctly centered in the listview.
void EditorConfigurationDlg::AddPluginPanels()
{
const wxString base = _T("images/settings/");
// for plugins who do not supply icons, use common generic icons
const wxString noimg = _T("images/settings/generic-plugin");
}
lb->SetPageImage(lb->GetPageCount() - 1, m_pImageList->GetImageCount() - 2);
I just create a very simple wx application, and when I hit a button, a dialog is opened, and I just load the file content "editor_configuration.xrc", and later, I just load several images, and set images on the listbook, it works just fine. See the screen shot as attachment.
To build the wx sample, you may get an build error, since there is no wxScintilla control, so you need to remove such component from the UI. To load and set the images, I just use such code:
So, I guess the issue is inside C::B?
I use wxDialog as a sample, and our C::B use wxScrollingDialog, but I don't think there are much difference.
I just removed all the non-GUI related code in the constructor of EditorConfigurationDlg, and I still see the wrong position of the icons. This issue also happens if I change the EditorConfigurationDlg class from wxScrollingDialog to wxDialog? (I simply replace the text wxScrollingDialog to wxDialog in the editorconfigurationdlg.cpp and the editorconfigurationdlg.h, also inside the editor_configuration.xrc. )
So, what is the reason? I really don't know. A dialog opened from C::B is behaves badly compared if opened from a minimal sample wx app?
Any hints?
Oh my god, if I simplify the listbook xrc, and I see even a very simple listbook which have only one panel will also expose this error, see the image shot as attachment.
Even a much simplier wxDialog.
Probably this is asymetric to have a space for a vertical scrollbar.
What happens if you add more items in the listbook and there are items that are not visible?
The same issue, see the screen shot below, that's why I reduce the panel number to 1.
I asked a question in wx-user maillist
https://groups.google.com/d/topic/wx-users/eA2pNgviez8/discussion
Without the XRC file, I can still reproduce this bug inside C::B, see: https://groups.google.com/d/msg/wx-users/eA2pNgviez8/ifbIpukmAQAJ But I can't reproduce this inside a minimal wx sample program.
I'd debug them side by side inside the wxwidgets code to see what is different.
I can reproduce this bug in a very simple wx sample code under WinXP&MinGW-Build5.2, but another wx user can't not reproduce this bug on Win7&VC++2008.
See that wx-user maillist discussion.
I see this issue in our wx 2.8 based C::B, see this forum report and screen shot:
Bad icons of C::B in the 16.01 release