2 * dselect - Debian GNU/Linux package maintenance user interface
3 * pkginfo.cc - handles (re)draw of package list window infopad
5 * Copyright (C) 1995 Ian Jackson <iwj10@cus.cam.ac.uk>
7 * This is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as
9 * published by the Free Software Foundation; either version 2,
10 * or (at your option) any later version.
12 * This is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public
18 * License along with this; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
37 const struct helpmenuentry
*packagelist::helpmenulist() {
38 static const struct helpmenuentry
40 { 'i', &hlp_mainintro
},
41 { 'k', &hlp_listkeys
},
42 { 'l', &hlp_displayexplain1
},
43 { 'd', &hlp_displayexplain2
},
47 { 'i', &hlp_readonlyintro
},
48 { 'k', &hlp_listkeys
},
49 { 'l', &hlp_displayexplain1
},
50 { 'd', &hlp_displayexplain2
},
54 { 'i', &hlp_recurintro
},
55 { 'k', &hlp_listkeys
},
56 { 'l', &hlp_displayexplain1
},
57 { 'd', &hlp_displayexplain2
},
66 int packagelist::itr_recursive() { return recursive
; }
68 const packagelist::infotype
packagelist::infoinfos
[]= {
69 { itr_recursive
, itd_relations
},
70 { 0, itd_description
},
71 { 0, itd_statuscontrol
},
72 { 0, itd_availablecontrol
},
76 const packagelist::infotype
*const packagelist::baseinfo
= infoinfos
;
78 void packagelist::severalinfoblurb(const char *whatinfoline
) {
79 whatinfovb(whatinfoline
);
81 vb("The line you have highlighted represents many packages; "
82 "if you ask to install, remove, hold, &c it you will affect all "
83 "the packages which match the criterion shown.\n"
85 "If you move the highlight to a line for a particular package "
86 "you will see information about that package displayed here."
88 "You can use `o' and `O' to change the sort order and give yourself "
89 "the opportunity to mark packages in different kinds of groups.");
90 wordwrapinfo(0,vb
.string());
93 void packagelist::itd_relations() {
94 if (table
[cursorline
]->pkg
->name
) {
95 whatinfovb("interrelationships affecting ");
96 whatinfovb(table
[cursorline
]->pkg
->name
);
97 if (debug
) fprintf(debug
,"packagelist[%p]::idt_relations(); `%s'\n",
98 this,table
[cursorline
]->relations
.string());
99 waddstr(infopad
,table
[cursorline
]->relations
.string());
101 severalinfoblurb("interrelationships");
105 void packagelist::itd_description() {
106 if (table
[cursorline
]->pkg
->name
) {
107 whatinfovb("description of ");
108 whatinfovb(table
[cursorline
]->pkg
->name
);
110 const char *m
= table
[cursorline
]->pkg
->available
.description
;
111 if (!m
|| !*m
) m
= "no description available.";
112 const char *p
= strchr(m
,'\n');
113 int l
= p
? (int)(p
-m
) : strlen(m
);
114 wattrset(infopad
,info_headattr
);
115 waddstr(infopad
, table
[cursorline
]->pkg
->name
);
116 waddstr(infopad
," - ");
117 waddnstr(infopad
,m
,l
);
118 wattrset(infopad
,info_attr
);
120 waddstr(infopad
,"\n\n");
124 severalinfoblurb("description");
128 void packagelist::itd_statuscontrol() {
130 if (!table
[cursorline
]->pkg
->name
) {
131 severalinfoblurb("currently installed control info");
133 whatinfovb("installed control info for ");
134 whatinfovb(table
[cursorline
]->pkg
->name
);
136 varbufrecord(&vb
,table
[cursorline
]->pkg
,&table
[cursorline
]->pkg
->installed
);
139 fprintf(debug
,"packagelist[%p]::idt_statuscontrol(); `%s'\n",this,vb
.string());
140 waddstr(infopad
,vb
.string());
144 void packagelist::itd_availablecontrol() {
146 if (!table
[cursorline
]->pkg
->name
) {
147 severalinfoblurb("available version of control file info");
149 whatinfovb("available version of control info for ");
150 whatinfovb(table
[cursorline
]->pkg
->name
);
152 varbufrecord(&vb
,table
[cursorline
]->pkg
,&table
[cursorline
]->pkg
->available
);
155 fprintf(debug
,"packagelist[%p]::idt_availablecontrol(); `%s'\n",this,vb
.string());
156 waddstr(infopad
,vb
.string());
160 void packagelist::redrawinfo() {
162 if (!currentinfo
|| !currentinfo
->display
) currentinfo
= baseinfo
;
163 if (!currentinfo
->relevant
) break;
164 if ((this->*currentinfo
->relevant
)()) break;
167 if (!info_height
) return;
169 werase(infopad
); wmove(infopad
,0,0);
172 fprintf(debug
,"packagelist[%p]::redrawinfo(); #=%d\n", this,
173 (int)(currentinfo
- baseinfo
));
175 (this->*currentinfo
->display
)();
176 whatinfovb
.terminate();