|
From: <ma...@us...> - 2004-01-14 13:26:52
|
Update of /cvsroot/sharedaemon/ui-wx/src
In directory sc8-pr-cvs1:/tmp/cvs-serv27376
Modified Files:
MainDlg.cpp MainDlg.h
Log Message:
Fixed toolbar images (re)generation if toolbar is not visible at the time of iconset change.
Index: MainDlg.cpp
===================================================================
RCS file: /cvsroot/sharedaemon/ui-wx/src/MainDlg.cpp,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -d -r1.60 -r1.61
--- MainDlg.cpp 14 Jan 2004 13:02:24 -0000 1.60
+++ MainDlg.cpp 14 Jan 2004 13:26:44 -0000 1.61
@@ -316,7 +316,6 @@
void CMainDlg::CreateMyToolBar(bool gen_images) {
int tool_align; /* For storing values read from configuration */
bool show_tool; /* For storing values read from configuration */
-unsigned int i; /* Loop counter */
wxArrayString names; /* Names for multibutton controls */
wxArrayString images; /* Images for multibutton controls */
@@ -326,6 +325,10 @@
show_tool = true;
+ if (start_up || gen_images) { /* Gen them before anything else */
+ GenToolBarImages();
+ }
+
m_config->Read(wxT("/General/Show ToolBar"), &show_tool, true);
if (!show_tool) {
return;
@@ -339,19 +342,6 @@
tool_align|wxNO_BORDER|wxTB_3DBUTTONS|wxTB_FLAT|wxCLIP_CHILDREN
);
- if (start_up || gen_images) {
- for (i=0;i<pages.GetCount();i++) {
- if (pages.IsEmpty()) {
- break;
- }
- names.Add(pages[i]->short_title);
- }
- names.Add(_("Connect"));
- names.Add(_("Options"));
- img->CalcToolBitmapSize(names);
- names.Clear();
- }
-
tb->SetToolBitmapSize(
wxSize(img->tool_img_width, img->tool_img_height)
);
@@ -383,10 +373,6 @@
int ids[2]; /* Identifiers for multibutton controls */
unsigned int i; /* Loop counter */
- if (gen_images) {
- img->MakeToolImage(_("Connect"), wxT("btn_connect"));
- }
-
/* On wxMSW, only use custom control in horizontal toolbar. */
#ifdef __WXMSW__
if (tool_align == wxTB_HORIZONTAL) {
@@ -437,12 +423,6 @@
if (pages.IsEmpty()){
break;
}
- if (gen_images) {
- img->MakeToolImage(
- pages.Item(i)->GetData()->short_title,
- pages.Item(i)->GetData()->image
- );
- }
tb->AddTool(
pages.Item(i)->GetData()->id,
pages.Item(i)->GetData()->short_title,
@@ -454,11 +434,6 @@
);
}
- if (gen_images) {
- img->MakeToolImage(
- _("Options"), wxT("btn_guisettings")
- );
- }
/* On wxMSW, only use custom control in horizontal toolbar. */
#ifdef __WXMSW__
if (tool_align == wxTB_HORIZONTAL) {
@@ -1220,3 +1195,36 @@
systray->SetIcon(icon);
#endif
}
+
+/*********************************************************** GenToolBarImages */
+/* This method iterates on the pages list and calls correct functions for */
+/* (re)generating toolbar button images. */
+/******************************************************************************/
+void CMainDlg::GenToolBarImages() {
+unsigned int i; /* Loop counter */
+wxArrayString names; /* Names for button texts */
+
+ for (i=0;i<pages.GetCount();i++) {
+ if (pages.IsEmpty()) {
+ break;
+ }
+ names.Add(pages[i]->short_title);
+ }
+ names.Add(_("Connect"));
+ names.Add(_("Options"));
+ img->CalcToolBitmapSize(names);
+ names.Clear();
+ for (i=0;i<pages.GetCount();i++) {
+ if (pages.IsEmpty()) {
+ break;
+ }
+ img->MakeToolImage(
+ pages.Item(i)->GetData()->short_title,
+ pages.Item(i)->GetData()->image
+ );
+ }
+ img->MakeToolImage(_("Connect"), wxT("btn_connect"));
+ img->MakeToolImage(
+ _("Options"), wxT("btn_guisettings")
+ );
+}
Index: MainDlg.h
===================================================================
RCS file: /cvsroot/sharedaemon/ui-wx/src/MainDlg.h,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- MainDlg.h 14 Jan 2004 13:02:24 -0000 1.20
+++ MainDlg.h 14 Jan 2004 13:26:44 -0000 1.21
@@ -185,6 +185,7 @@
void GenerateToolBarButtons( /* There the actual buttons are created */
MyToolBar *tb, bool gen_images, int tool_align
);
+ void GenToolBarImages(); /* (re)generates toolbar button images */
/* Getters - small methods for retreiving various kinds of data */
Page* GetCurPage() { return cur_page;} /* Returns current active page */
|