Patch #1580 2006-10-24 07:24

takeshimiya

Manage plugins dialog improvement
Download
1580-Manage_plugins.patch (17.7 KB)
Category
Application::Refinement
Status
Closed
Close date
2006-10-27 12:01
Assigned to
 
Index: src/sdk/pluginsconfigurationdlg.cpp
===================================================================
--- src/sdk/pluginsconfigurationdlg.cpp    (revision 3130)
+++ src/sdk/pluginsconfigurationdlg.cpp    (working copy)
@@ -44,6 +44,7 @@
 #include <wx/dirdlg.h>
 #include <wx/progdlg.h>
 #include <wx/filename.h>
+#include <wx/html/htmlwin.h>
 
 #include "pluginsconfigurationdlg.h" // class's header file
 
@@ -61,7 +62,7 @@
     EVT_BUTTON(XRCID("btnInstall"), PluginsConfigurationDlg::OnInstall)
     EVT_BUTTON(XRCID("btnUninstall"), PluginsConfigurationDlg::OnUninstall)
     EVT_BUTTON(XRCID("btnExport"), PluginsConfigurationDlg::OnExport)
-    EVT_BUTTON(XRCID("btnInfo"), PluginsConfigurationDlg::OnInfo)
+    EVT_LIST_ITEM_SELECTED(XRCID("lstPlugins"), PluginsConfigurationDlg::OnSelect)
 
     EVT_UPDATE_UI(-1, PluginsConfigurationDlg::OnUpdateUI)
 END_EVENT_TABLE()
@@ -87,6 +88,31 @@
     }
     XRCCTRL(*this, "chkInstallGlobally", wxCheckBox)->SetValue(globalInstall);
     XRCCTRL(*this, "chkInstallConfirmation", wxCheckBox)->SetValue(confirmation);
+    
+    // Set default font size based on system default font size
+#ifdef __linux__
+    /* NOTE (mandrav#1#): wxWidgets documentation on wxHtmlWindow::SetFonts(),
+    states that the sizes array accepts values from -2 to +4.
+    My tests (under linux at least) have showed that it actually
+    expects real point sizes. */
+    
+    wxFont systemFont = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
+    int sizes[7] = {};
+    for (int i = 0; i < 7; ++i)
+        sizes[i] = systemFont.GetPointSize();
+    XRCCTRL(*this, "htmlInfo", wxHtmlWindow)->SetFonts(wxEmptyString, wxEmptyString, &sizes[0]);
+#endif
+
+    wxString initialInfo;
+    initialInfo << _T("<html><body><font color=\"#0000AA\">");
+    initialInfo << _("Tip: The above list allows for multiple selections.");
+    initialInfo << _T("</font><br /><br /><i><font color=\"#696969\">");
+    initialInfo << _("Have you saved your work first?");
+    initialInfo << _T("<br />\n");
+    initialInfo << _("All functionality in this dialog is to be considered as &quot;experimental&quot;.");
+    initialInfo << _T("</font></i><br /></body></html>\n");
+
+    XRCCTRL(*this, "htmlInfo", wxHtmlWindow)->SetPage(initialInfo);
 }
 
 void PluginsConfigurationDlg::FillList()
@@ -357,7 +383,7 @@
         cbMessageBox(_("Failed exporting one or more plugins:\n\n") + failure, _("Warning"), wxICON_WARNING);
 }
 
-void PluginsConfigurationDlg::OnInfo(wxCommandEvent& event)
+void PluginsConfigurationDlg::OnSelect(wxListEvent& event)
 {
     wxListCtrl* list = XRCCTRL(*this, "lstPlugins", wxListCtrl);
     if (list->GetSelectedItemCount() != 1)
@@ -367,15 +393,20 @@
     const PluginElement* elem = (const PluginElement*)list->GetItemData(sel);
     if (!elem)
         return;
+   
+    wxString description(elem->info.description);
+    description.Replace(_T("\n"), _T("<br />\n"));
 
     wxString info;
-    info << _("Title: ") << elem->info.title << _T('\n');
-    info << _("Version: ") << elem->info.version << _T('\n');
-    info << _("Description: ") << elem->info.description << _T('\n');
-    info << _T('\n');
-    info << _("Filename: ") << elem->fileName << _T('\n');
+    info << _T("<html><body>\n");
+    info << _T("<h3>") << elem->info.title << _T(" ");
+    info << _T("<font color=\"#0000AA\">") << elem->info.version << _T("</font></h3>");
+    info << _T("<i><font color=\"#808080\" size=\"-1\">") << UnixFilename(elem->fileName) << _T("</font></i><br />\n");
+    info << _T("<br />\n");
+    info << description << _T("<br />\n");
+    info << _T("</body></html>\n");
 
-    cbMessageBox(info, _("Information"), wxICON_INFORMATION);
+    XRCCTRL(*this, "htmlInfo", wxHtmlWindow)->SetPage(info);
 }
 
 void PluginsConfigurationDlg::OnUpdateUI(wxUpdateUIEvent& event)
@@ -402,7 +433,6 @@
     XRCCTRL(*this, "btnDisable", wxButton)->Enable(en && (lastSelectionMultiple || (hasPlugin && isAttached)));
     XRCCTRL(*this, "btnUninstall", wxButton)->Enable(en);
     XRCCTRL(*this, "btnExport", wxButton)->Enable(en);
-    XRCCTRL(*this, "btnInfo", wxButton)->Enable(en);
 }
 
 void PluginsConfigurationDlg::EndModal(int retCode)
Index: src/sdk/pluginsconfigurationdlg.h
===================================================================
--- src/sdk/pluginsconfigurationdlg.h    (revision 3130)
+++ src/sdk/pluginsconfigurationdlg.h    (working copy)
@@ -21,7 +21,7 @@
         void OnInstall(wxCommandEvent& event);
         void OnUninstall(wxCommandEvent& event);
         void OnExport(wxCommandEvent& event);
-        void OnInfo(wxCommandEvent& event);
+        void OnSelect(wxListEvent& event);
         void OnUpdateUI(wxUpdateUIEvent& event);
 
         DECLARE_EVENT_TABLE();
Index: src/sdk/resources/plugins_configuration.xrc
===================================================================
--- src/sdk/resources/plugins_configuration.xrc    (revision 3130)
+++ src/sdk/resources/plugins_configuration.xrc    (
download for full patch...
takeshimiya 2006-10-24 07:25

Manage plugins dialog improvement:

* Added an HtmlWindow for showing the current selected plugin's info.

killerbot 2006-10-27 12:01

applied with some fixes/improvements

(red color, border, and some includes)