summaryrefslogtreecommitdiffstats
path: root/Panel.c
diff options
context:
space:
mode:
authorHisham Muhammad <hisham@gobolinux.org>2006-07-12 01:16:03 +0000
committerHisham Muhammad <hisham@gobolinux.org>2006-07-12 01:16:03 +0000
commitdbe2670b69e163cb146d3fc3b3c7b82ea3f71278 (patch)
tree6c9163067c52e387b24593f545fa2c549e4b4acf /Panel.c
parente46f1426b906433c291de05432de9a9a43e14f4a (diff)
Perform RichString operations by hand.
Avoid unnecessary operations when processing entries on ProcessList.
Diffstat (limited to 'Panel.c')
-rw-r--r--Panel.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/Panel.c b/Panel.c
index fef7018b..f014fca7 100644
--- a/Panel.c
+++ b/Panel.c
@@ -96,16 +96,12 @@ void Panel_init(Panel* this, int x, int y, int w, int h, char* type, bool owner)
void Panel_done(Panel* this) {
assert (this != NULL);
- RichString_delete(this->header);
Vector_delete(this->items);
}
inline void Panel_setRichHeader(Panel* this, RichString header) {
assert (this != NULL);
- if (this->header.len > 0) {
- RichString_delete(this->header);
- }
this->header = header;
this->needsRedraw = true;
}
@@ -274,7 +270,8 @@ void Panel_draw(Panel* this, bool focus) {
for(int i = first, j = 0; j < this->h && i < last; i++, j++) {
Object* itemObj = Vector_get(this->items, i);
- RichString itemRef = RichString_new();
+ RichString itemRef;
+ RichString_initVal(itemRef);
itemObj->display(itemObj, &itemRef);
int amt = MIN(itemRef.len - scrollH, this->w);
if (i == this->selected) {
@@ -296,10 +293,12 @@ void Panel_draw(Panel* this, bool focus) {
} else {
Object* oldObj = Vector_get(this->items, this->oldSelected);
- RichString oldRef = RichString_new();
+ RichString oldRef;
+ RichString_initVal(oldRef);
oldObj->display(oldObj, &oldRef);
Object* newObj = Vector_get(this->items, this->selected);
- RichString newRef = RichString_new();
+ RichString newRef;
+ RichString_initVal(newRef);
newObj->display(newObj, &newRef);
mvhline(y+ this->oldSelected - this->scrollV, x+0, ' ', this->w);
if (scrollH < oldRef.len)

© 2014-2024 Faster IT GmbH | imprint | privacy policy