summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@gmx.de>2012-04-14 14:54:45 +0200
committercinap_lenrek <cinap_lenrek@gmx.de>2012-04-14 14:54:45 +0200
commit9509b5850b4c2a6faead9db20445071011a6432e (patch)
treeb4472f7a8a803f4daf60acb749a88251df4e1edc /sys
parent34918e7081c00639fd9e4194300c0a9947981898 (diff)
mothra: plpack in any case, even if labels dont fit
Diffstat (limited to 'sys')
-rw-r--r--sys/src/cmd/mothra/libpanel/pack.c33
-rw-r--r--sys/src/cmd/mothra/libpanel/panel.h2
-rw-r--r--sys/src/cmd/mothra/mothra.c8
3 files changed, 15 insertions, 28 deletions
diff --git a/sys/src/cmd/mothra/libpanel/pack.c b/sys/src/cmd/mothra/libpanel/pack.c
index fef854c64..d5e1f0249 100644
--- a/sys/src/cmd/mothra/libpanel/pack.c
+++ b/sys/src/cmd/mothra/libpanel/pack.c
@@ -66,24 +66,18 @@ Point pl_getshare(Panel *p){
}
/*
* Set the sizes and rectangles of p and its descendants, given their requested sizes.
- * Returns 1 if everything fit, 0 otherwise.
- * For now we punt in the case that the children don't all fit.
- * Possibly we should shrink all the children's sizereqs to fit,
- * by the same means used to do EXPAND, except clamping at some minimum size,
- * but that smacks of AI.
*/
-Panel *pl_toosmall;
-int pl_setrect(Panel *p, Point ul, Point avail){
+void pl_setrect(Panel *p, Point ul, Point avail){
Point space, newul, newspace, slack, share;
int l;
Panel *c;
p->size=subpt(p->sizereq, p->pad);
ul=addpt(ul, divpt(p->pad, 2));
avail=subpt(avail, p->pad);
- if(p->size.x>avail.x || p->size.y>avail.y){
- pl_toosmall=p;
- return 0; /* not enough space! */
- }
+ if(p->size.x>avail.x)
+ p->size.x = avail.x;
+ if(p->size.y>avail.y)
+ p->size.y = avail.y;
if(p->flags&(FILLX|EXPAND)) p->size.x=avail.x;
if(p->flags&(FILLY|EXPAND)) p->size.y=avail.y;
switch(p->flags&PLACE){
@@ -127,34 +121,33 @@ int pl_setrect(Panel *p, Point ul, Point avail){
case PACKN:
newul=Pt(ul.x, ul.y+c->sizereq.y);
newspace=Pt(space.x, space.y-c->sizereq.y);
- if(!pl_setrect(c, ul, Pt(space.x, c->sizereq.y))) return 0;
+ pl_setrect(c, ul, Pt(space.x, c->sizereq.y));
break;
case PACKW:
newul=Pt(ul.x+c->sizereq.x, ul.y);
newspace=Pt(space.x-c->sizereq.x, space.y);
- if(!pl_setrect(c, ul, Pt(c->sizereq.x, space.y))) return 0;
+ pl_setrect(c, ul, Pt(c->sizereq.x, space.y));
break;
case PACKS:
newul=ul;
newspace=Pt(space.x, space.y-c->sizereq.y);
- if(!pl_setrect(c, Pt(ul.x, ul.y+space.y-c->sizereq.y),
- Pt(space.x, c->sizereq.y))) return 0;
+ pl_setrect(c, Pt(ul.x, ul.y+space.y-c->sizereq.y),
+ Pt(space.x, c->sizereq.y));
break;
case PACKE:
newul=ul;
newspace=Pt(space.x-c->sizereq.x, space.y);
- if(!pl_setrect(c, Pt(ul.x+space.x-c->sizereq.x, ul.y),
- Pt(c->sizereq.x, space.y))) return 0;
+ pl_setrect(c, Pt(ul.x+space.x-c->sizereq.x, ul.y),
+ Pt(c->sizereq.x, space.y));
break;
}
ul=newul;
space=newspace;
}
- return 1;
}
-int plpack(Panel *p, Rectangle where){
+void plpack(Panel *p, Rectangle where){
pl_sizereq(p);
- return pl_setrect(p, where.min, subpt(where.max, where.min));
+ pl_setrect(p, where.min, subpt(where.max, where.min));
}
/*
* move an already-packed panel so that p->r=raddp(p->r, d)
diff --git a/sys/src/cmd/mothra/libpanel/panel.h b/sys/src/cmd/mothra/libpanel/panel.h
index f85c94121..becca3eb8 100644
--- a/sys/src/cmd/mothra/libpanel/panel.h
+++ b/sys/src/cmd/mothra/libpanel/panel.h
@@ -98,7 +98,7 @@ struct Panel{
#define PRI_POPUP 1 /* popup menus */
#define PRI_SCROLLBAR 2 /* scroll bars */
int plinit(int); /* initialization */
-int plpack(Panel *, Rectangle); /* figure out where to put the Panel & children */
+void plpack(Panel *, Rectangle); /* figure out where to put the Panel & children */
void plmove(Panel *, Point); /* move an already-packed panel to a new location */
void pldraw(Panel *, Image *); /* display the panel on the bitmap */
void plfree(Panel *); /* give back space */
diff --git a/sys/src/cmd/mothra/mothra.c b/sys/src/cmd/mothra/mothra.c
index cf915c8ef..c56630ba2 100644
--- a/sys/src/cmd/mothra/mothra.c
+++ b/sys/src/cmd/mothra/mothra.c
@@ -174,7 +174,7 @@ void mkpanels(void){
plscroll(list, 0, bar);
p=plgroup(root, PACKN|FILLX);
pllabel(p, PACKW, "Title:");
- curttl=pllabel(p, PACKE|EXPAND, "Initializing");
+ curttl=pllabel(p, PACKE|EXPAND, "---");
plplacelabel(curttl, PLACEW);
p=plgroup(root, PACKN|FILLX);
pllabel(p, PACKW, "Url:");
@@ -445,14 +445,8 @@ void eresized(int new){
exits("getwindow");
}
r=screen->r;
- plinitlabel(curttl, PACKE|EXPAND, "---");
- plinitlabel(cururl, PACKE|EXPAND, "---");
plpack(root, r);
plpack(alt, r);
- if(current){
- plinitlabel(curttl, PACKE|EXPAND, current->title);
- plinitlabel(cururl, PACKE|EXPAND, current->url->fullname);
- }
draw(screen, r, display->white, 0, ZP);
pldraw(root, screen);
unlockdisplay(display);