[Aptitude-svn-commit] r3535 - in branches/aptitude-0.3/aptitude: . src
Daniel Burrows
dburrows@costa.debian.org
Sat, 02 Jul 2005 14:06:03 +0000
Author: dburrows
Date: Sat Jul 2 14:06:00 2005
New Revision: 3535
Modified:
branches/aptitude-0.3/aptitude/ChangeLog
branches/aptitude-0.3/aptitude/src/edit_pkg_hier.cc
Log:
Fix the package hierarchy editor for wide characters.
Modified: branches/aptitude-0.3/aptitude/ChangeLog
==============================================================================
--- branches/aptitude-0.3/aptitude/ChangeLog (original)
+++ branches/aptitude-0.3/aptitude/ChangeLog Sat Jul 2 14:06:00 2005
@@ -1,5 +1,10 @@
2005-07-02 Daniel Burrows <dburrows@debian.org>
+ * src/edit_pkg_hier.cc:
+
+ Update the package hierarchy editor for wide characters
+ (slightly hackily?)
+
* src/download_bar.cc:
Update the download-bar to use the new signature of
Modified: branches/aptitude-0.3/aptitude/src/edit_pkg_hier.cc
==============================================================================
--- branches/aptitude-0.3/aptitude/src/edit_pkg_hier.cc (original)
+++ branches/aptitude-0.3/aptitude/src/edit_pkg_hier.cc Sat Jul 2 14:06:00 2005
@@ -32,6 +32,7 @@
#include <vscreen/config/keybindings.h>
#include <vscreen/vs_subtree.h>
+#include <vscreen/transcode.h>
using namespace std;
using namespace __gnu_cxx;
@@ -42,9 +43,11 @@
bool selected;
pkg_hier::group *group;
pkg_hier::item *item;
+ // whatever
+ wstring group_name;
public:
vs_hier_item(pkg_hier::group *_group, pkg_hier::item *_item)
- :vs_treeitem(true), group(_group)
+ :vs_treeitem(true), group(_group), group_name(transcode(group->name, "ASCII"))
{
set_item(_item);
}
@@ -93,17 +96,17 @@
while(todisp.size()<width)
todisp+=" ";
- win->mvaddnstr(y, 0, todisp.c_str(), width);
+ win->mvaddnstr(y, 0, transcode(todisp, "ASCII"), width);
}
- const char *tag() const
+ const wchar_t *tag()
{
- return group->name.c_str();
+ return group_name.c_str();
}
- const char *label() const
+ const wchar_t *label()
{
- return group->name.c_str();
+ return group_name.c_str();
}
void commit()
@@ -132,9 +135,9 @@
// FIXME: I shouldn't have to do this.
class silly_subtree:public vs_subtree_generic
{
- string txt;
+ wstring txt;
public:
- silly_subtree(bool expanded, string _txt)
+ silly_subtree(bool expanded, const wstring &_txt)
:vs_subtree_generic(expanded), txt(_txt) {}
void paint(vs_tree *win, int y, bool hierarchical, const style &st)
@@ -142,8 +145,8 @@
vs_subtree_generic::paint(win, y, hierarchical, txt);
}
- const char *tag() const {return txt.c_str();}
- const char *label() const {return txt.c_str();}
+ const wchar_t *tag() {return txt.c_str();}
+ const wchar_t *label() {return txt.c_str();}
};
vs_hier_editor::vs_hier_editor():item(NULL)
@@ -205,7 +208,7 @@
if(items.empty())
{
- silly_subtree *newroot=new silly_subtree(true, "All groups");
+ silly_subtree *newroot=new silly_subtree(true, L"All groups");
// Add all available groups to the list.
for(pkg_hier::groupmap::iterator i=user_pkg_hier->groups.begin();