mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 10:22:45 -04:00
more enhancements
This commit is contained in:
parent
4413cb9591
commit
b9ef189d16
@ -1,5 +1,5 @@
|
|||||||
#begin bin_target
|
#begin bin_target
|
||||||
#define USE_FREETYPE yes
|
#define USE_PACKAGES freetype
|
||||||
|
|
||||||
#define TARGET indexify
|
#define TARGET indexify
|
||||||
#define OTHER_LIBS \
|
#define OTHER_LIBS \
|
||||||
@ -21,7 +21,7 @@
|
|||||||
#end bin_target
|
#end bin_target
|
||||||
|
|
||||||
#begin bin_target
|
#begin bin_target
|
||||||
#define USE_FREETYPE yes
|
#define USE_PACKAGES freetype
|
||||||
|
|
||||||
#define TARGET font-samples
|
#define TARGET font-samples
|
||||||
#define OTHER_LIBS \
|
#define OTHER_LIBS \
|
||||||
|
@ -47,6 +47,7 @@ bool format_rose = false;
|
|||||||
bool dummy_mode = false;
|
bool dummy_mode = false;
|
||||||
bool draw_frames = false;
|
bool draw_frames = false;
|
||||||
bool omit_roll_headers = false;
|
bool omit_roll_headers = false;
|
||||||
|
DSearchPath cm_search;
|
||||||
bool omit_full_links = false;
|
bool omit_full_links = false;
|
||||||
bool caption_frame_numbers = false;
|
bool caption_frame_numbers = false;
|
||||||
|
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
#include "pandatoolbase.h"
|
#include "pandatoolbase.h"
|
||||||
|
|
||||||
#include "filename.h"
|
#include "filename.h"
|
||||||
|
#include "dSearchPath.h"
|
||||||
|
|
||||||
// Some of these constants may be modified by command-line parameters
|
// Some of these constants may be modified by command-line parameters
|
||||||
// from the user.
|
// from the user.
|
||||||
@ -92,6 +93,7 @@ extern bool draw_frames;
|
|||||||
// with its own little header. This also ignored the roll.cm file if
|
// with its own little header. This also ignored the roll.cm file if
|
||||||
// it exists.
|
// it exists.
|
||||||
extern bool omit_roll_headers;
|
extern bool omit_roll_headers;
|
||||||
|
extern DSearchPath cm_search;
|
||||||
|
|
||||||
// True to omit links to the full-size source images.
|
// True to omit links to the full-size source images.
|
||||||
extern bool omit_full_links;
|
extern bool omit_full_links;
|
||||||
|
@ -134,6 +134,12 @@ Indexify() {
|
|||||||
"headers defined in roll.cm files.",
|
"headers defined in roll.cm files.",
|
||||||
&Indexify::dispatch_none, &omit_roll_headers);
|
&Indexify::dispatch_none, &omit_roll_headers);
|
||||||
|
|
||||||
|
add_option
|
||||||
|
("cmdir", "director", 0,
|
||||||
|
"Searches in the named directory for .cm files before searching within "
|
||||||
|
"the source archive. This option may be repeated.",
|
||||||
|
&Indexify::dispatch_search_path, NULL, &cm_search);
|
||||||
|
|
||||||
add_option
|
add_option
|
||||||
("omit-full", "", 0,
|
("omit-full", "", 0,
|
||||||
"Omits links to the full-size images.",
|
"Omits links to the full-size images.",
|
||||||
|
@ -178,7 +178,7 @@ scan(const string &extension) {
|
|||||||
|
|
||||||
if (_photos.empty()) {
|
if (_photos.empty()) {
|
||||||
nout << _dir << " contains no photos.\n";
|
nout << _dir << " contains no photos.\n";
|
||||||
return false;
|
// This is not an error, just a notice.
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -194,6 +194,10 @@ collect_index_images() {
|
|||||||
// Don't call this twice.
|
// Don't call this twice.
|
||||||
nassertv(_index_images.empty());
|
nassertv(_index_images.empty());
|
||||||
|
|
||||||
|
if (is_empty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
IndexImage *index_image = new IndexImage(this, _index_images.size());
|
IndexImage *index_image = new IndexImage(this, _index_images.size());
|
||||||
_index_images.push_back(index_image);
|
_index_images.push_back(index_image);
|
||||||
|
|
||||||
@ -223,6 +227,17 @@ get_newest_contributing_filename() const {
|
|||||||
return _newest_contributing_filename;
|
return _newest_contributing_filename;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: RollDirectory::is_empty
|
||||||
|
// Access: Public
|
||||||
|
// Description: Returns true if the directory is empty (has no
|
||||||
|
// photos).
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
bool RollDirectory::
|
||||||
|
is_empty() const {
|
||||||
|
return _photos.empty();
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: RollDirectory::get_num_photos
|
// Function: RollDirectory::get_num_photos
|
||||||
// Access: Public
|
// Access: Public
|
||||||
@ -274,6 +289,9 @@ get_index_image(int n) const {
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
bool RollDirectory::
|
bool RollDirectory::
|
||||||
generate_images(const Filename &archive_dir, PNMTextMaker *text_maker) {
|
generate_images(const Filename &archive_dir, PNMTextMaker *text_maker) {
|
||||||
|
if (is_empty()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
nassertr(!_index_images.empty(), false);
|
nassertr(!_index_images.empty(), false);
|
||||||
|
|
||||||
IndexImages::iterator ii;
|
IndexImages::iterator ii;
|
||||||
@ -297,11 +315,24 @@ generate_images(const Filename &archive_dir, PNMTextMaker *text_maker) {
|
|||||||
bool RollDirectory::
|
bool RollDirectory::
|
||||||
generate_html(ostream &root_html, const Filename &archive_dir,
|
generate_html(ostream &root_html, const Filename &archive_dir,
|
||||||
const Filename &roll_dir_root) {
|
const Filename &roll_dir_root) {
|
||||||
|
if (is_empty()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
nassertr(!_index_images.empty(), false);
|
nassertr(!_index_images.empty(), false);
|
||||||
|
|
||||||
|
root_html
|
||||||
|
<< "<a name=\"" << _basename << "\">\n";
|
||||||
|
|
||||||
if (!omit_roll_headers) {
|
if (!omit_roll_headers) {
|
||||||
Filename cm_filename(_dir, _basename);
|
Filename cm_filename(_basename);
|
||||||
cm_filename.set_extension("cm");
|
cm_filename.set_extension("cm");
|
||||||
|
if (cm_search.is_empty() || !cm_filename.resolve_filename(cm_search)) {
|
||||||
|
// If the cm file isn't found along the search path specified
|
||||||
|
// via -cmdir on the command line, then look for it in the
|
||||||
|
// appropriate source directory.
|
||||||
|
cm_filename = Filename(_dir, cm_filename);
|
||||||
|
}
|
||||||
|
|
||||||
if (cm_filename.exists()) {
|
if (cm_filename.exists()) {
|
||||||
// If the comment file for the roll exists, insert its contents
|
// If the comment file for the roll exists, insert its contents
|
||||||
// here instead of the generic header.
|
// here instead of the generic header.
|
||||||
|
@ -46,6 +46,7 @@ public:
|
|||||||
|
|
||||||
const Filename &get_newest_contributing_filename() const;
|
const Filename &get_newest_contributing_filename() const;
|
||||||
|
|
||||||
|
bool is_empty() const;
|
||||||
int get_num_photos() const;
|
int get_num_photos() const;
|
||||||
Photo *get_photo(int n) const;
|
Photo *get_photo(int n) const;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user