Skip to content

Commit e3a26ce

Browse files
committed
fixed data filter dialog bug
1 parent dcbc20d commit e3a26ce

File tree

4 files changed

+24
-18
lines changed

4 files changed

+24
-18
lines changed

libstage/canvas.cc

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1004,15 +1004,15 @@ void Canvas::renderFrame()
10041004
colorstack.Pop();
10051005

10061006
// ENERGY BOX
1007-
if (PowerPack::global_capacity > 0) {
1008-
colorstack.Push(0.8, 1.0, 0.8, 0.85); // pale green
1009-
glRectf(0, height, width, 90);
1010-
colorstack.Push(0, 0, 0); // black
1011-
Gl::draw_string_multiline(margin, height + margin, width, 50, world->EnergyString().c_str(),
1012-
(Fl_Align)(FL_ALIGN_LEFT | FL_ALIGN_BOTTOM));
1013-
colorstack.Pop();
1014-
colorstack.Pop();
1015-
}
1007+
// if (PowerPack::global_capacity > 0) {
1008+
// colorstack.Push(0.8, 1.0, 0.8, 0.85); // pale green
1009+
// glRectf(0, height, width, 90);
1010+
// colorstack.Push(0, 0, 0); // black
1011+
// Gl::draw_string_multiline(margin, height + margin, width, 50, world->EnergyString().c_str(),
1012+
// (Fl_Align)(FL_ALIGN_LEFT | FL_ALIGN_BOTTOM));
1013+
// colorstack.Pop();
1014+
// colorstack.Pop();
1015+
// }
10161016

10171017
glEnable(GL_DEPTH_TEST);
10181018
glPopMatrix();

libstage/options_dlg.cc

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,10 @@ void OptionsDlg::updateChecks()
5555
scroll->begin();
5656
for (unsigned int i = 0; i < options.size(); i++) {
5757
Fl_Check_Button *check =
58-
new Fl_Check_Button(0, boxH * (i + 1) + vm, scroll->w(), boxH, options[i]->name().c_str());
58+
new Fl_Check_Button(0, boxH * (i + 1) + vm, scroll->w(), boxH, "foo" );//options[i]->name().c_str());
59+
60+
// must copy the text for the label! fixes yukky bug.
61+
check->copy_label( options[i]->name().c_str() );
5962
if (options[i]->val())
6063
check->set();
6164
check->callback(checkChanged, this);
@@ -74,7 +77,7 @@ void OptionsDlg::setOptions(const std::set<Option *> &opts)
7477
void OptionsDlg::showAllOpt(Option *opt)
7578
{
7679
showAll = opt;
77-
showAllCheck->label(opt->name().c_str());
80+
showAllCheck->copy_label(opt->name().c_str());
7881
showAllCheck->value(opt->val());
7982
}
8083

libstage/world.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ void World::DestroySuperRegion(SuperRegion *sr)
186186

187187
void World::Run()
188188
{
189-
// first check wheter there is a single gui world
189+
// first check whether there is a single gui world
190190
bool found_gui = false;
191191
FOR_EACH (world_it, world_set) {
192192
found_gui |= (*world_it)->IsGUI();
@@ -1110,7 +1110,7 @@ void World::RemovePowerPack(PowerPack *pp)
11101110

11111111
/// Register an Option for pickup by the GUI
11121112
void World::RegisterOption(Option *opt)
1113-
{
1113+
{
11141114
assert(opt);
11151115
option_table.insert(opt);
11161116
}

libstage/worldgui.cc

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,8 @@ WorldGui::WorldGui(int width, int height, const char *caption)
195195
real_time_interval(sim_interval), real_time_now(RealTimeNow()),
196196
real_time_recorded(real_time_now), timing_interval(20)
197197
{
198+
Fl::lock(); // start FLTK's thread safe behaviour
199+
198200
Fl::scheme("");
199201
resizable(canvas);
200202
caption_prefix = caption ? std::string(caption) : std::string(PROJECT) + " v" + Stg::Version();
@@ -416,8 +418,8 @@ std::string WorldGui::ClockString() const
416418

417419
const double localratio = (double)sim_interval / (double)(real_time_interval / timing_interval);
418420

419-
char buf[32];
420-
snprintf(buf, 32, " [%.1f]", localratio);
421+
char buf[64];
422+
snprintf(buf, 64, " [%.1f]", localratio);
421423
str += buf;
422424

423425
if (paused == true)
@@ -443,12 +445,13 @@ void WorldGui::RemoveChild(Model *mod)
443445
std::string WorldGui::EnergyString() const
444446
{
445447
char str[512];
446-
snprintf(str, 255, "Energy\n stored: %.0f / %.0f KJ\n input: %.0f "
447-
"KJ\n output: %.0f KJ at %.2f KW\n",
448+
snprintf(str, 512,
449+
"Energy\n stored: %.0f / %.0f KJ\n input: %.0f "
450+
"KJ\n output: %.0f KJ at %.2f KW\n",
448451
PowerPack::global_stored / 1e3, PowerPack::global_capacity / 1e3,
449452
PowerPack::global_input / 1e3, PowerPack::global_dissipated / 1e3,
450453
(PowerPack::global_dissipated / (sim_time / 1e6)) / 1e3);
451-
454+
452455
return std::string(str);
453456
}
454457

0 commit comments

Comments
 (0)