2 * dselect - Debian package maintenance user interface
3 * pkginfo.cc - handles (re)draw of package list window infopad
5 * Copyright © 1995 Ian Jackson <ijackson@chiark.greenend.org.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 published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This is distributed in the hope that it will be useful,
13 * but 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 License
18 * along with this program. If not, see <https://www.gnu.org/licenses/>.
27 #include <dpkg/i18n.h>
28 #include <dpkg/dpkg.h>
29 #include <dpkg/dpkg-db.h>
30 #include <dpkg/string.h>
36 const struct helpmenuentry
*packagelist::helpmenulist() {
37 static const struct helpmenuentry
39 { 'i', &hlp_mainintro
},
40 { 'k', &hlp_listkeys
},
41 { 'l', &hlp_displayexplain1
},
42 { 'd', &hlp_displayexplain2
},
46 { 'i', &hlp_readonlyintro
},
47 { 'k', &hlp_listkeys
},
48 { 'l', &hlp_displayexplain1
},
49 { 'd', &hlp_displayexplain2
},
53 { 'i', &hlp_recurintro
},
54 { 'k', &hlp_listkeys
},
55 { 'l', &hlp_displayexplain1
},
56 { 'd', &hlp_displayexplain2
},
60 modstatdb_get_status() == msdbrw_readonly
? ro
:
66 packagelist::itr_recursive()
71 const packagelist::infotype
packagelist::infoinfos
[]= {
72 { &packagelist::itr_recursive
, &packagelist::itd_relations
},
73 { nullptr, &packagelist::itd_description
},
74 { nullptr, &packagelist::itd_statuscontrol
},
75 { nullptr, &packagelist::itd_availablecontrol
},
79 const packagelist::infotype
*const packagelist::baseinfo
= infoinfos
;
81 void packagelist::severalinfoblurb()
84 vb(_("The line you have highlighted represents many packages; "
85 "if you ask to install, remove, hold, etc. it you will affect all "
86 "the packages which match the criterion shown.\n"
88 "If you move the highlight to a line for a particular package "
89 "you will see information about that package displayed here."
91 "You can use 'o' and 'O' to change the sort order and give yourself "
92 "the opportunity to mark packages in different kinds of groups."));
93 wordwrapinfo(0,vb
.string());
96 void packagelist::itd_relations() {
97 whatinfovb(_("Interrelationships"));
99 if (table
[cursorline
]->pkg
->set
->name
) {
100 debug(dbg_general
, "packagelist[%p]::idt_relations(); '%s'",
101 this, table
[cursorline
]->relations
.string());
102 waddstr(infopad
,table
[cursorline
]->relations
.string());
108 void packagelist::itd_description() {
109 whatinfovb(_("Description"));
111 if (table
[cursorline
]->pkg
->set
->name
) {
112 const char *m
= table
[cursorline
]->pkg
->available
.description
;
114 m
= table
[cursorline
]->pkg
->installed
.description
;
116 m
= _("No description available.");
117 const char *p
= strchrnul(m
, '\n');
120 wattrset(infopad
, part_attr
[info_head
]);
121 waddstr(infopad
, table
[cursorline
]->pkg
->set
->name
);
122 waddstr(infopad
," - ");
123 waddnstr(infopad
,m
,l
);
124 wattrset(infopad
, part_attr
[info_body
]);
126 waddstr(infopad
,"\n\n");
134 void packagelist::itd_statuscontrol() {
135 whatinfovb(_("Installed control file information"));
138 if (!table
[cursorline
]->pkg
->set
->name
) {
142 varbuf_stanza(&vb
, table
[cursorline
]->pkg
,
143 &table
[cursorline
]->pkg
->installed
);
144 debug(dbg_general
, "packagelist[%p]::idt_statuscontrol(); '%s'",
146 waddstr(infopad
,vb
.string());
150 void packagelist::itd_availablecontrol() {
151 whatinfovb(_("Available control file information"));
154 if (!table
[cursorline
]->pkg
->set
->name
) {
158 varbuf_stanza(&vb
, table
[cursorline
]->pkg
,
159 &table
[cursorline
]->pkg
->available
);
160 debug(dbg_general
, "packagelist[%p]::idt_availablecontrol(); '%s'",
162 waddstr(infopad
,vb
.string());
166 void packagelist::redrawinfo() {
168 if (!currentinfo
|| !currentinfo
->display
) currentinfo
= baseinfo
;
169 if (!currentinfo
->relevant
) break;
170 if ((this->*currentinfo
->relevant
)()) break;
173 if (!info_height
) return;
175 werase(infopad
); wmove(infopad
,0,0);
177 debug(dbg_general
, "packagelist[%p]::redrawinfo(); #=%zd",
178 this, currentinfo
- baseinfo
);
180 (this->*currentinfo
->display
)();