User forums > Using Code::Blocks
Configure dialog icon issue when clicked
ollydbg:
Ok, can you test the patch below:
--- Code: ---Index: E:/code/cb/cb_trunk_sf/src/src/editorconfigurationdlg.cpp
===================================================================
--- E:/code/cb/cb_trunk_sf/src/src/editorconfigurationdlg.cpp (revision 8972)
+++ E:/code/cb/cb_trunk_sf/src/src/editorconfigurationdlg.cpp (working copy)
@@ -275,8 +275,6 @@
{
bmp = cbLoadBitmap(base + base_imgs[i] + _T(".png"), wxBITMAP_TYPE_PNG);
images->Add(bmp);
- bmp = cbLoadBitmap(base + base_imgs[i] + _T("-off.png"), wxBITMAP_TYPE_PNG);
- images->Add(bmp);
}
wxListbook* lb = XRCCTRL(*this, "nbMain", wxListbook);
lb->AssignImageList(images);
@@ -286,6 +284,8 @@
// add all plugins configuration panels
AddPluginPanels();
+ UpdateListbookImages();
+
// the following code causes a huge dialog to be created with wx2.8.4
// commenting it out fixes the problem (along with some XRC surgery)
// if this causes problems with earlier wx versions we might need to
@@ -309,7 +309,7 @@
void EditorConfigurationDlg::AddPluginPanels()
{
const wxString base = _T("images/settings/");
- const wxString noimg = _T("images/settings/generic-plugin");
+ const wxString noimg = _T("images/settings/generic-plugin"); //for those plugins who does not supply icons
wxListbook* lb = XRCCTRL(*this, "nbMain", wxListbook);
// get all configuration panels which are about the editor.
@@ -321,37 +321,26 @@
panel->SetParentDialog(this);
lb->AddPage(panel, panel->GetTitle());
- wxString onFile = ConfigManager::LocateDataFile(base + panel->GetBitmapBaseName() + _T(".png"), sdDataGlobal | sdDataUser);
- if (onFile.IsEmpty())
- onFile = ConfigManager::LocateDataFile(noimg + _T(".png"), sdDataGlobal | sdDataUser);
- wxString offFile = ConfigManager::LocateDataFile(base + panel->GetBitmapBaseName() + _T("-off.png"), sdDataGlobal | sdDataUser);
- if (offFile.IsEmpty())
- offFile = ConfigManager::LocateDataFile(noimg + _T("-off.png"), sdDataGlobal | sdDataUser);
+ wxString iconFile = ConfigManager::LocateDataFile(base + panel->GetBitmapBaseName() + _T(".png"), sdDataGlobal | sdDataUser);
+ if (iconFile.IsEmpty())
+ iconFile = ConfigManager::LocateDataFile(noimg + _T(".png"), sdDataGlobal | sdDataUser);
- lb->GetImageList()->Add(cbLoadBitmap(onFile));
- lb->GetImageList()->Add(cbLoadBitmap(offFile));
- lb->SetPageImage(lb->GetPageCount() - 1, lb->GetImageList()->GetImageCount() - 2);
+ lb->GetImageList()->Add(cbLoadBitmap(iconFile));
+
+ lb->SetPageImage(lb->GetPageCount() - 1, lb->GetImageList()->GetImageCount() - 1);
}
-
- UpdateListbookImages();
}
void EditorConfigurationDlg::UpdateListbookImages()
{
wxListbook* lb = XRCCTRL(*this, "nbMain", wxListbook);
int sel = lb->GetSelection();
- // set page images according to their on/off status
+ // set page images
for (size_t i = 0; i < IMAGES_COUNT + m_PluginPanels.GetCount(); ++i)
{
- lb->SetPageImage(i, (i * 2) + (sel == (int)i ? 0 : 1));
+ lb->SetPageImage(i, i);
}
- // the selection colour is ruining the on/off effect,
- // so make sure no item is selected ;)
- // (only if we have icons showing)
- if (GetSettingsIconsStyle(lb->GetListView()) != sisNoIcons)
- lb->GetListView()->Select(sel, false);
-
// update the page title
wxString label = lb->GetPageText(sel);
// replace any stray & with && because label makes it an underscore
--- End code ---
I just remove all the off.png related code.
The further improvement as I see is that: Do not call the UpdateListbookImages() in the OnPageChanged Event handler, I think we can create a simple function like: UpdateListbookTitles() instead.
oBFusCATed:
--- Quote from: ollydbg on April 09, 2013, 03:25:12 am ---I just remove all the off.png related code.
--- End quote ---
Please before you commit test it on linux. Probably this is a linux hack to make icons different.
ollydbg:
--- Quote from: oBFusCATed on April 09, 2013, 09:24:46 am ---
--- Quote from: ollydbg on April 09, 2013, 03:25:12 am ---I just remove all the off.png related code.
--- End quote ---
Please before you commit test it on linux. Probably this is a linux hack to make icons different.
--- End quote ---
OK, no hurry, I'm waiting for all your comments especially on Linux testing result.
oBFusCATed:
--- Quote from: ollydbg on April 09, 2013, 09:27:22 am ---OK, no hurry, I'm waiting for all your comments especially on Linux testing result.
--- End quote ---
I had no intention to test it.
I've just said that probably removing the off images is not good idea on linux.
Probably because there is no automatic highlight in wxGTK.
MortenMacFly:
I dont see an important reason to remove the black and white Images. Just the hack in a First place would be fine and does Not affect 3rd Party plugins at all.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version