The MinGW.org Installation Manager Tool
Revision | c98d9b50d52e04be91c0f3c080ce9198c98f8ed4 (tree) |
---|---|
Time | 2013-01-11 00:43:34 |
Author | Keith Marshall <keithmarshall@user...> |
Commiter | Keith Marshall |
Implement data sheet compiler for list of installed files.
@@ -1,3 +1,17 @@ | ||
1 | +2013-01-10 Keith Marshall <keithmarshall@users.sourceforge.net> | |
2 | + | |
3 | + Implement data sheet compiler for list of installed files. | |
4 | + | |
5 | + * src/pkgdata.cpp: #include pkgproc.h; it furnishes... | |
6 | + (pkgManifest): ...this class declaration, which is required by... | |
7 | + (DataSheetMaker::DisplayFilesManifest): ...this new private inline | |
8 | + method; declare and implement it; subsequently, invoke it... | |
9 | + (DataSheetMaker::OnPaint) [PKG_DATASHEET_INSTALLED_FILES]: ...here. | |
10 | + (pkgTroffLayoutEngine::WriteLn): Correct a defect in handling of | |
11 | + excess-length unbreakable "words" outside the viewport; previously | |
12 | + they were not dropped from the input queue, resulting in repeated | |
13 | + reprocessing in an infinite loop. | |
14 | + | |
1 | 15 | 2013-01-09 Keith Marshall <keithmarshall@users.sourceforge.net> |
2 | 16 | |
3 | 17 | Include release tags in GUI displayed package versions. |
@@ -38,6 +38,7 @@ | ||
38 | 38 | #include "pkgkeys.h" |
39 | 39 | #include "pkginfo.h" |
40 | 40 | #include "pkglist.h" |
41 | +#include "pkgproc.h" | |
41 | 42 | #include "pkgtask.h" |
42 | 43 | |
43 | 44 | #include <windowsx.h> |
@@ -293,6 +294,19 @@ bool pkgTroffLayoutEngine::WriteLn( HDC canvas, RECT *bounds ) | ||
293 | 294 | */ |
294 | 295 | TextOutW( canvas, bounds->left, bounds->top - offset, linebuf, filled ); |
295 | 296 | } |
297 | + else if( (fold == 0) && (new_width > max_width) ) | |
298 | + /* | |
299 | + * The output line which we've just processed lies outside | |
300 | + * the viewport. We note that it's initial (non-breakable) | |
301 | + * "word" would require more display width than the viewport | |
302 | + * can accommodate, if it were to be moved into the visible | |
303 | + * region; thus, this "word" will continue to be presented | |
304 | + * to the formatting engine, as the next input "word" to be | |
305 | + * processed. This would result in an infinite loop, so we | |
306 | + * MUST discard this "word" from the input queue. | |
307 | + */ | |
308 | + curr = (pkgTroffLayoutEngine *)(curr->next); | |
309 | + | |
296 | 310 | /* Finally, adjust the top boundary of the viewport, to indicate |
297 | 311 | * where the NEXT output line, if any, is to be positioned, and |
298 | 312 | * return TRUE, to indicate that an output line was processed. |
@@ -337,6 +351,7 @@ class DataSheetMaker: public ChildWindowMaker | ||
337 | 351 | static int DisplayLicenceURL( const char * ); |
338 | 352 | static int DisplayPackageURL( const char * ); |
339 | 353 | inline void DisplayDescription( pkgXmlNode * ); |
354 | + inline void DisplayFilesManifest( pkgXmlNode * ); | |
340 | 355 | void ComposeDescription( pkgXmlNode *, pkgXmlNode * ); |
341 | 356 | int FormatRecord( int, const char *, const char * ); |
342 | 357 | inline void FormatText( const char * ); |
@@ -569,6 +584,81 @@ void DataSheetMaker::ComposeDescription( pkgXmlNode *ref, pkgXmlNode *root ) | ||
569 | 584 | } |
570 | 585 | } |
571 | 586 | |
587 | +void DataSheetMaker::DisplayFilesManifest( pkgXmlNode *ref ) | |
588 | +{ | |
589 | + /* Helper method to compile the list of files installed by a package, | |
590 | + * for display on the "Installed Files" tab of the data sheet panel. | |
591 | + */ | |
592 | + pkgActionItem avail; | |
593 | + if( (ref = pkgGetStatus( ref, &avail )) == NULL ) | |
594 | + { | |
595 | + /* This represents a package which is available, but has not been | |
596 | + * installed; we simply decline to compile the files list. | |
597 | + */ | |
598 | + FormatRecord( 0, "Package", | |
599 | + avail.Selection()->GetPropVal( tarname_key, value_unknown ) | |
600 | + ); | |
601 | + bounding_box.top += PARAGRAPH_MARGIN; | |
602 | + FormatText( | |
603 | + "This package has not been installed; " | |
604 | + "the list of installed files is not available for packages " | |
605 | + "which have not been installed." | |
606 | + ); | |
607 | + } | |
608 | + else | |
609 | + { /* This represents a package which has been installed; begin | |
610 | + * compilation of the list of installed files. | |
611 | + */ | |
612 | + const char *tarname; | |
613 | + FormatRecord( 0, "Package", | |
614 | + tarname = ref->GetPropVal( tarname_key, value_unknown ) | |
615 | + ); | |
616 | + if( match_if_explicit( ref->ArchiveName(), value_none ) ) | |
617 | + { | |
618 | + /* This is a meta-package; there are no files to list. | |
619 | + */ | |
620 | + bounding_box.top += PARAGRAPH_MARGIN; | |
621 | + FormatText( | |
622 | + "This meta-package facilitates the installation of a collection " | |
623 | + "of other logically related packages; it provides no files, and " | |
624 | + "may be safely removed." | |
625 | + ); | |
626 | + } | |
627 | + else | |
628 | + { /* This is a real package; retrieve the manifest of installed files, | |
629 | + * which was created during the installation process. | |
630 | + */ | |
631 | + pkgXmlNode *index; | |
632 | + pkgManifest inventory( package_key, tarname ); | |
633 | + if( (index = inventory.GetRoot()->FindFirstAssociate( manifest_key )) != NULL ) | |
634 | + { | |
635 | + /* We've located a files list within the manifest; process it... | |
636 | + */ | |
637 | + FormatRecord( 0, "This package provides the following files", "" ); | |
638 | + bounding_box.left += LEFT_MARGIN; bounding_box.top += PARAGRAPH_MARGIN; | |
639 | + do { if( (ref = index->FindFirstAssociate( filename_key )) != NULL ) | |
640 | + /* | |
641 | + * We found at least one file name within the list; emit it | |
642 | + * to the display, followed by any additional names present. | |
643 | + */ | |
644 | + do { FormatText( ref->GetPropVal( pathname_key, value_unknown ) ); | |
645 | + } while( (ref = ref->FindNextAssociate( filename_key )) != NULL ); | |
646 | + | |
647 | + /* There should be no more than one, but check for, and process | |
648 | + * any additional files lists which may be present. | |
649 | + */ | |
650 | + } while( (index = index->FindNextAssociate( manifest_key )) != NULL ); | |
651 | + } | |
652 | + else | |
653 | + { /* The manifest appears to be lacking any files list; diagnose. | |
654 | + */ | |
655 | + bounding_box.top += PARAGRAPH_MARGIN; | |
656 | + FormatText( "This package appears to provide no files." ); | |
657 | + } | |
658 | + } | |
659 | + } | |
660 | +} | |
661 | + | |
572 | 662 | static pkgXmlNode *pkgListSelection( HWND package_ref, LVITEM *lookup ) |
573 | 663 | { |
574 | 664 | /* Helper function, to retrieve the active selection from the |
@@ -668,6 +758,14 @@ long DataSheetMaker::OnPaint() | ||
668 | 758 | DisplayDescription( pkgListSelection( PackageRef, &lookup ) ); |
669 | 759 | break; |
670 | 760 | |
761 | + case PKG_DATASHEET_INSTALLED_FILES: | |
762 | + /* Available only for packages which have been installed, | |
763 | + * this comprises the files list content from the manifest | |
764 | + * which was created during the installation process. | |
765 | + */ | |
766 | + DisplayFilesManifest( pkgListSelection( PackageRef, &lookup ) ); | |
767 | + break; | |
768 | + | |
671 | 769 | default: |
672 | 770 | /* Handle requests for data sheets for which we have yet |
673 | 771 | * to provide a compiling routine. |