*** empty log message ***

This commit is contained in:
David Rose 2000-12-08 23:06:18 +00:00
parent 5a8d35dc66
commit 456ca52ec2
14 changed files with 185 additions and 25 deletions

View File

@ -43,7 +43,7 @@ EggPalettize() : EggMultiFilter(true) {
"textures.txa); a complete record of every egg file and every texture "
"that has been referenced is kept here. This allows the program "
"to intelligently manage the multiple egg files that may reference "
"the textures in question.\n\n");
"the textures in question.");
clear_runlines();
@ -216,9 +216,10 @@ describe_input_file() {
show_text(" margin i", 10,
"This specifies the number of pixels that should be written "
"around the border of the texture when it is placed in a "
"palette image; i is the integer number. The use of a margin "
"helps cut down on color bleed from neighboring images. "
"If the texture does not end up placed in a palette image, the "
"palette image; i is the integer number of pixels. The "
"use of a margin helps cut down on color bleed "
"from neighboring images. If the texture does "
"not end up placed in a palette image, the "
"margin is not used. If not specified, the default margin is "
"used, which is specified by the :margin command (see below).\n\n");
@ -249,12 +250,20 @@ describe_input_file() {
"formats cannot be placed together on the same palette "
"images.\n\n");
show_text(" (image type)", 10,
"A texture may be converted to a particular image type, for "
"instance jpg or rgb, by naming the type. If present, this "
"overrides the :imagetype command, described below. As with "
":imagetype, you may also specify two type names separated "
"by a comma, to indicate that a different file should be written "
"for the color and alpha components.\n\n");
show_text(" (group name)", 10,
"A texture may also be assigned to a specific group by naming "
"the group. The groups are defined using the :group command "
"(see below). Normally, textures are not assigned directly "
"to groups; instead, it is more useful to assign the egg files "
"they appear on to groups; see below.\n\n");
"they are referenced in to groups; see below.\n\n");
show_text(" cont", 10,
"Normally, a texture file (or egg file) scans the lines in the "
@ -274,10 +283,11 @@ describe_input_file() {
" plane.egg : phase_2 main\n"
" *.egg : phase_2\n\n"
"Any number of egg files may be named on one line, and the group of "
"egg files may be simultaneously assigned to one or more groups. "
"The valid set of groups are defined using the :group command (see below). "
"Each texture that is referenced by a given egg file will be palettized "
"Any number of egg files may be named on one line, and the set of "
"named egg files may be simultaneously assigned to one or more groups. "
"Each group must have been previously defined using the :group command "
"(see below). Each texture that is referenced by a given "
"egg file will be palettized "
"into at least one of the groups assigned to the egg file.\n\n"
"Finally, there are a number of special commands that may appear in the "
@ -343,7 +353,9 @@ describe_input_file() {
"The default if this is unspecified is 0.1 0.01. That is, "
"round up to the next tenth, unless within a hundredth of the "
"last tenth. To disable rounding, specify ':round no'.\n\n");
"last tenth. To disable rounding, specify ':round no'. "
"Rounding is implicitly disabled when you run with the -opt "
"command line option.\n\n");
show_text(" :remap (never | group | poly)", 10,
"Sometimes two different parts of an egg file may reference "
@ -352,7 +364,7 @@ describe_input_file() {
"to (1,6), for a coverage of 1.0, while group B references "
"values ranging from (0,2) to (1,4), for a coverage of 2.0. "
"The maximum coverage used is only 2.0, and thus the texture "
"only needs to appear in the palette once, but the total range "
"only needs to appear in the palette twice, but the total range "
"of UV's is from (0,2) to (1,6), causing an apparent coverage "
"of 4.0.\n\n"
@ -360,11 +372,13 @@ describe_input_file() {
"by remapping both groups of UV's so that they overlap. This "
"parameter specifies how this operation should be done. If "
"the option is 'never', remapping will not be performed; if "
"'group', entire groups will be remapped as a unit, of 'poly', "
"'group', entire groups will be remapped as a unit, if 'poly', "
"individual polygons within a group may be remapped. This last "
"option provides the greatest minimization of UV coverage, "
"but possibly at the expense of triangle strips in the resulting "
"model (since some vertices can no longer be shared).\n\n");
"model (since some vertices can no longer be shared).\n\n"
"The default if this is unspecified is 'poly'.\n\n");
show_text(" :imagetype type[,alpha_type]", 10,
"This specifies the default type of image file that should be "
@ -408,7 +422,7 @@ describe_input_file() {
"keyword 'with' specifies any number of groups that this "
"palette group depends on; if a texture has already been "
"assigned to one of this group's dependent groups, it will "
"be considered to be assigned to this group.\n\n");
"not need to be assigned to this group.\n\n");
nout <<
@ -462,14 +476,16 @@ run() {
if (!state_file.open_read(state_filename)) {
nout << FilenameUnifier::make_user_filename(state_filename)
<< " exists, but cannot be read. Perhaps you should remove it so a new one can be created.\n";
<< " exists, but cannot be read. Perhaps you should "
<< "remove it so a new one can be created.\n";
exit(1);
}
TypedWriteable *obj = state_file.read_object();
if (obj == (TypedWriteable *)NULL || !state_file.resolve()) {
nout << FilenameUnifier::make_user_filename(state_filename)
<< " exists, but appears to be corrupt. Perhaps you should remove it so a new one can be created.\n";
<< " exists, but appears to be corrupt. Perhaps you "
<< "should remove it so a new one can be created.\n";
exit(1);
}
@ -584,15 +600,17 @@ run() {
if (!state_file.open_write(temp_filename) ||
!state_file.write_object(pal)) {
nout << "Unable to write palettization information to " << temp_filename
nout << "Unable to write palettization information to "
<< FilenameUnifier::make_user_filename(temp_filename)
<< "\n";
exit(1);
}
state_file.close();
if (!temp_filename.rename_to(state_filename)) {
nout << "Unable to rename temporary file " << temp_filename << " to "
<< state_filename << "\n";
nout << "Unable to rename temporary file "
<< FilenameUnifier::make_user_filename(temp_filename) << " to "
<< FilenameUnifier::make_user_filename(state_filename) << "\n";
exit(1);
}

View File

@ -125,7 +125,7 @@ void GtkStatsMonitor::
lost_connection() {
Windows::iterator wi;
for (wi = _windows.begin(); wi != _windows.end(); ++wi) {
(*wi)->update_title();
(*wi)->mark_dead();
}
}

View File

@ -25,6 +25,7 @@ GtkStatsPianoRoll(GtkStatsMonitor *monitor, int thread_index,
int xsize, int ysize) :
PStatPianoRoll(monitor, thread_index, xsize, ysize)
{
_is_dead = false;
set_events(GDK_EXPOSURE_MASK);
_label_align = manage(new Gtk::Alignment(1.0, 1.0));
@ -36,6 +37,21 @@ GtkStatsPianoRoll(GtkStatsMonitor *monitor, int thread_index,
request_initial_size(*this, get_xsize(), get_ysize());
}
////////////////////////////////////////////////////////////////////
// Function: GtkStatsPianoRoll::mark_dead
// Access: Public
// Description: Called when the client's connection has been lost,
// this should update the window in some obvious way to
// indicate that the window is no longer live.
////////////////////////////////////////////////////////////////////
void GtkStatsPianoRoll::
mark_dead() {
_is_dead = true;
setup_white_gc();
force_redraw();
}
////////////////////////////////////////////////////////////////////
// Function: GtkStatsPianoRoll::get_labels
@ -194,7 +210,8 @@ configure_event_impl(GdkEventConfigure *) {
Gdk_Colormap system_colormap = Gdk_Colormap::get_system();
_white_gc = Gdk_GC(_pixmap);
_white_gc.set_foreground(system_colormap.white());
setup_white_gc();
_black_gc = Gdk_GC(_pixmap);
_black_gc.set_foreground(system_colormap.black());
@ -272,3 +289,28 @@ pack_labels() {
_labels_changed = false;
}
////////////////////////////////////////////////////////////////////
// Function: GtkStatsPianoRoll::setup_white_gc
// Access: Private
// Description: Sets the color on _white_gc to be either actually
// white (if the chart is still alive) or a light gray
// (if the chart is dead).
////////////////////////////////////////////////////////////////////
void GtkStatsPianoRoll::
setup_white_gc() {
Gdk_Colormap system_colormap = Gdk_Colormap::get_system();
if (_is_dead) {
Gdk_Color death;
death.set_grey_p(0.8);
system_colormap.alloc(death);
_white_gc.set_foreground(death);
} else {
_white_gc.set_foreground(system_colormap.white());
}
}

View File

@ -30,6 +30,8 @@ public:
GtkStatsPianoRoll(GtkStatsMonitor *monitor, int thread_index,
int xsize, int ysize);
void mark_dead();
Gtk::Alignment *get_labels();
Gdk_GC get_collector_gc(int collector_index);
@ -44,6 +46,7 @@ private:
virtual gint expose_event_impl(GdkEventExpose *event);
void pack_labels();
void setup_white_gc();
private:
// Backing pixmap for drawing area.
@ -67,6 +70,7 @@ private:
Gtk::Alignment *_label_align;
Gtk::VBox *_label_box;
bool _is_dead;
};
#include "gtkStatsPianoRoll.I"

View File

@ -26,6 +26,19 @@ GtkStatsPianoWindow(GtkStatsMonitor *monitor, int thread_index,
}
////////////////////////////////////////////////////////////////////
// Function: GtkStatsPianoWindow::mark_dead
// Access: Public, Virtual
// Description: Called when the client's connection has been lost,
// this should update the window in some obvious way to
// indicate that the window is no longer live.
////////////////////////////////////////////////////////////////////
void GtkStatsPianoWindow::
mark_dead() {
GtkStatsWindow::mark_dead();
_chart->mark_dead();
}
////////////////////////////////////////////////////////////////////
// Function: GtkStatsPianoWindow::idle
// Access: Public, Virtual

View File

@ -22,6 +22,7 @@ public:
GtkStatsPianoWindow(GtkStatsMonitor *monitor, int thread_index,
int chart_xsize, int chart_ysize);
virtual void mark_dead();
virtual void idle();
protected:

View File

@ -25,6 +25,7 @@ GtkStatsStripChart(GtkStatsMonitor *monitor, PStatView &view,
int collector_index, int xsize, int ysize) :
PStatStripChart(monitor, view, collector_index, xsize, ysize)
{
_is_dead = false;
set_events(GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK);
_label_align = manage(new Gtk::Alignment(1.0, 1.0));
@ -39,6 +40,21 @@ GtkStatsStripChart(GtkStatsMonitor *monitor, PStatView &view,
request_initial_size(*this, get_xsize(), get_ysize());
}
////////////////////////////////////////////////////////////////////
// Function: GtkStatsStripChart::mark_dead
// Access: Public
// Description: Called when the client's connection has been lost,
// this should update the window in some obvious way to
// indicate that the window is no longer live.
////////////////////////////////////////////////////////////////////
void GtkStatsStripChart::
mark_dead() {
_is_dead = true;
setup_white_gc();
force_redraw();
}
////////////////////////////////////////////////////////////////////
// Function: GtkStatsStripChart::get_labels
// Access: Public
@ -261,7 +277,8 @@ configure_event_impl(GdkEventConfigure *) {
Gdk_Colormap system_colormap = Gdk_Colormap::get_system();
_white_gc = Gdk_GC(_pixmap);
_white_gc.set_foreground(system_colormap.white());
setup_white_gc();
_black_gc = Gdk_GC(_pixmap);
_black_gc.set_foreground(system_colormap.black());
@ -348,3 +365,28 @@ pack_labels() {
_labels_changed = false;
}
////////////////////////////////////////////////////////////////////
// Function: GtkStatsStripChart::setup_white_gc
// Access: Private
// Description: Sets the color on _white_gc to be either actually
// white (if the chart is still alive) or a light gray
// (if the chart is dead).
////////////////////////////////////////////////////////////////////
void GtkStatsStripChart::
setup_white_gc() {
Gdk_Colormap system_colormap = Gdk_Colormap::get_system();
if (_is_dead) {
Gdk_Color death;
death.set_grey_p(0.8);
system_colormap.alloc(death);
_white_gc.set_foreground(death);
} else {
_white_gc.set_foreground(system_colormap.white());
}
}

View File

@ -30,6 +30,8 @@ public:
PStatView &view, int collector_index,
int xsize, int ysize);
void mark_dead();
Gtk::Alignment *get_labels();
GtkStatsGuide *get_guide();
@ -53,6 +55,7 @@ private:
virtual gint button_press_event_impl(GdkEventButton *button);
void pack_labels();
void setup_white_gc();
private:
// Backing pixmap for drawing area.
@ -73,6 +76,7 @@ private:
Gtk::Alignment *_label_align;
Gtk::VBox *_label_box;
GtkStatsGuide *_guide;
bool _is_dead;
};
#include "gtkStatsStripChart.I"

View File

@ -34,6 +34,19 @@ GtkStatsStripWindow(GtkStatsMonitor *monitor, int thread_index,
}
////////////////////////////////////////////////////////////////////
// Function: GtkStatsStripWindow::mark_dead
// Access: Public, Virtual
// Description: Called when the client's connection has been lost,
// this should update the window in some obvious way to
// indicate that the window is no longer live.
////////////////////////////////////////////////////////////////////
void GtkStatsStripWindow::
mark_dead() {
GtkStatsWindow::mark_dead();
_chart->mark_dead();
}
////////////////////////////////////////////////////////////////////
// Function: GtkStatsStripWindow::idle
// Access: Public, Virtual

View File

@ -23,6 +23,7 @@ public:
GtkStatsStripWindow(GtkStatsMonitor *monitor, int thread_index,
int collector_index, int chart_xsize, int chart_ysize);
virtual void mark_dead();
virtual void idle();
protected:

View File

@ -62,6 +62,18 @@ update_title() {
}
}
////////////////////////////////////////////////////////////////////
// Function: GtkStatsWindow::mark_dead
// Access: Public, Virtual
// Description: Called when the client's connection has been lost,
// this should update the window in some obvious way to
// indicate that the window is no longer live.
////////////////////////////////////////////////////////////////////
void GtkStatsWindow::
mark_dead() {
update_title();
}
////////////////////////////////////////////////////////////////////
// Function: GtkStatsWindow::new_collector
// Access: Public, Virtual
@ -71,6 +83,7 @@ update_title() {
void GtkStatsWindow::
new_collector(int) {
}
////////////////////////////////////////////////////////////////////
// Function: GtkStatsWindow::new_thread
// Access: Public, Virtual

View File

@ -29,6 +29,7 @@ public:
virtual bool destruct();
virtual void update_title();
virtual void mark_dead();
virtual void new_collector(int collector_index);
virtual void new_thread(int thread_index);
virtual void idle();

View File

@ -87,8 +87,16 @@ void PStatServer::
poll() {
// Delete all the readers that we couldn't delete before.
while (!_lost_readers.empty()) {
delete _lost_readers.back();
PStatReader *reader = _lost_readers.back();
_lost_readers.pop_back();
reader->lost_connection();
delete reader;
}
while (!_removed_readers.empty()) {
PStatReader *reader = _removed_readers.back();
_removed_readers.pop_back();
delete reader;
}
_listener->poll();
@ -148,7 +156,7 @@ remove_reader(Connection *connection, PStatReader *reader) {
nout << "Attempt to remove undefined reader.\n";
} else {
_readers.erase(ri);
_lost_readers.push_back(reader);
_removed_readers.push_back(reader);
}
}
@ -218,7 +226,6 @@ connection_reset(const PT(Connection) &connection) {
ri = _readers.find(connection);
if (ri != _readers.end()) {
PStatReader *reader = (*ri).second;
reader->lost_connection();
_readers.erase(ri);
// Unfortunately, we can't delete the reader right away, because

View File

@ -59,6 +59,7 @@ private:
Readers _readers;
typedef vector<PStatReader *> LostReaders;
LostReaders _lost_readers;
LostReaders _removed_readers;
typedef deque<int> Ports;
Ports _available_udp_ports;