///if we want to initiate, it has to be in here void pre_mainstream_tick(manager& orbital_manager) { update_child(); if(current_elapsed_time < hold_time * dt_s) return; ///return home if(target == nullptr && orbit == nullptr && capture == nullptr && home != nullptr) { start_journey(orbital_manager, home, home, nullptr, nullptr); } update_child(); }
void Desktop::draw(void) { if(!damage()) return; if(damage() & (FL_DAMAGE_ALL | FL_DAMAGE_EXPOSE)) { /* * If any overlay was previously visible during full redraw, it will not be cleared because of fast flip. * This will assure that does not happened. */ fl_overlay_clear(); EDE_DESKTOP_WINDOW::draw(); //E_DEBUG(E_STRLOC ": REDRAW ALL\n"); } if(damage() & EDE_DESKTOP_DAMAGE_OVERLAY) { if(selbox->show) fl_overlay_rect(selbox->x, selbox->y, selbox->w, selbox->h); else fl_overlay_clear(); /* * now scan all icons and see if they needs redraw, and if do * just update their label since it is indicator of selection */ for(int i = 0; i < children(); i++) { if(child(i)->damage() == EDE_DESKTOP_DAMAGE_CHILD_LABEL) { update_child(*child(i)); child(i)->clear_damage(); //E_DEBUG(E_STRLOC ": ICON REDRAW \n"); } } } clear_damage(); }
void Fl_Popup_ListView::draw() { draw_frame(); if((damage() & ~FL_DAMAGE_CHILD)) draw_child(*m_listView); else update_child(*m_listView); //Fl_Popup_Window::draw(); }
void Fl_Tool_Bar::draw() { int n; if(opened()) { // make it not draw the inside label: int saved = flags(); align(FL_ALIGN_TOP); if(damage() & ~FL_DAMAGE_CHILD) { draw_frame(); fl_push_clip(box()->dx(), box()->dy(), w()-box()->dw()-(m_menubut->visible()?20:0), h()-box()->dh()); for (n = children(); n--;) draw_child(*child(n)); draw_box(); draw_inside_label(); fl_pop_clip(); if(m_menubut->visible()) { fl_push_clip(w()-box()->dw()-(m_menubut->visible()?20:0), box()->dy(), 30, h()-box()->dh()); draw_child(*m_menubut); draw_box(); fl_pop_clip(); } for (n = 0; n < children(); n++) draw_outside_label(*child(n)); } else { fl_push_clip(box()->dx(), box()->dy(), w()-box()->dw()-(m_menubut->visible()?20:0), h()-box()->dh()); for(n = 0; n < children(); n++) { Fl_Widget& w = *child(n); if (w.damage() & FL_DAMAGE_CHILD_LABEL) { draw_outside_label(w); w.set_damage(w.damage() & ~FL_DAMAGE_CHILD_LABEL); } update_child(w); } fl_pop_clip(); } flags(saved); if (damage() & (FL_DAMAGE_EXPOSE|FL_DAMAGE_HIGHLIGHT|FL_DAMAGE_ALL)) { Fl_Flags f = 0; if (pushed) f.set(FL_VALUE); if (highlighted) f.set(FL_HIGHLIGHT); draw_glyph(0, 0, 0, glyph_size(), h(), f); } } else Fl_Bar::draw(); }
void tick(manager& orbital_manager, orbital* sun, float dt) { current_elapsed_time += dt; ///we need to pick the correct retrograde if(orbit != nullptr) { double diff = (probe->pos - orbit->pos).length(); //if(diff < orbit_distance * 1.2) ///yup, this was the issue! if(diff < orbit->radius * 100) { double rad = diff; double orbital_velocity = orbit->get_orbital_velocity(rad); vec2d diff = orbit->pos - orbit->old_pos; probe->orbit_speed(orbital_velocity, orbit->pos); if(orbit != sun) probe->old_pos = probe->old_pos - diff; orbit = nullptr; current_elapsed_time = 0; } } if(capture != nullptr) { double diff = (probe->pos - capture->pos).length(); if(diff < 0.1 * 1000 * 1000 * 1000) { child = capture; capture = nullptr; } } update_child(); }
void Fl_Canvas::draw() { Fl_Widget*const* a = array(); if (damage() & ~FL_DAMAGE_CHILD) // redraw the entire thing: { if (m_BG) { int X=0,Y=0; while (Y<w()) { while (X<h()) { m_BG->draw(parent()->x()+X,parent()->y()+Y); #if FL_MAJOR_VERSION == 1 && FL_MINOR_VERSION == 0 X+=m_BG->w; #else X+=m_BG->w(); #endif } #if FL_MAJOR_VERSION == 1 && FL_MINOR_VERSION == 0 Y+=m_BG->h; #else Y+=m_BG->h(); #endif X=0; } } else { draw_box(); } // draw minimised modules first for (int i=children(); i--;) { Fl_Widget& o = **a++; if (((Fl_DeviceGUI*)&o)->IsMinimised()) { draw_child(o); draw_outside_label(o); std::vector<int>::iterator sel = std::find( m_Selection.m_DeviceIds.begin(), m_Selection.m_DeviceIds.end(), ((Fl_DeviceGUI*)&o)->GetID() ); if (sel != m_Selection.m_DeviceIds.end()) { fl_color(FL_YELLOW); fl_rect(o.x(), o.y(), o.w(), o.h()); } } } DrawWires(); // draw maximised modules on top of everything else Fl_Widget*const* a = array(); for (int i=children(); i--;) { Fl_Widget& o = **a++; if (!((Fl_DeviceGUI*)&o)->IsMinimised()) { draw_child(o); draw_outside_label(o); std::vector<int>::iterator sel = std::find( m_Selection.m_DeviceIds.begin(), m_Selection.m_DeviceIds.end(), ((Fl_DeviceGUI*)&o)->GetID() ); if (sel != m_Selection.m_DeviceIds.end()) { fl_color(FL_YELLOW); fl_rect(o.x(), o.y(), o.w(), o.h()); } } } } else // only redraw the children that need it: { for (int i=children(); i--;) update_child(**a++); } DrawSelection(); }
static int recursive_visit_set_parent(struct filter_node *node, struct filter_node *parent) { int ret; if (!node) { fprintf(stderr, "[error] %s: NULL child\n", __func__); return -EINVAL; } node->parent = parent; switch (node->type) { case NODE_UNKNOWN: default: fprintf(stderr, "[error] %s: unknown node type\n", __func__); return -EINVAL; case NODE_ROOT: assert(parent == NULL); return recursive_visit_set_parent(node->u.root.child, node); case NODE_EXPRESSION: switch (node->u.expression.type) { case AST_EXP_UNKNOWN: default: fprintf(stderr, "[error] %s: unknown expression type\n", __func__); return -EINVAL; case AST_EXP_NESTED: return recursive_visit_set_parent(node->u.expression.u.child, node); case AST_EXP_IDENTIFIER: /* fall-through */ case AST_EXP_GLOBAL_IDENTIFIER: { struct filter_node *orig_node = node; while (node->u.expression.prev) { struct filter_node *prev; prev = node->u.expression.prev; if (prev->type != NODE_EXPRESSION || (prev->u.expression.type != AST_EXP_IDENTIFIER && prev->u.expression.type != AST_EXP_GLOBAL_IDENTIFIER)) { fprintf(stderr, "[error] %s: expecting identifier before link\n", __func__); return -EINVAL; } prev->u.expression.next = node; prev->u.expression.pre_op = node->u.expression.post_op; prev->parent = node->parent; node = prev; } /* Set first child as forward */ ret = update_child(parent, orig_node, node); if (ret) return ret; } case AST_EXP_CONSTANT: case AST_EXP_FLOAT_CONSTANT: case AST_EXP_STRING: break; } break; case NODE_OP: ret = recursive_visit_set_parent(node->u.op.lchild, node); if (ret) return ret; return recursive_visit_set_parent(node->u.op.rchild, node); case NODE_UNARY_OP: return recursive_visit_set_parent(node->u.unary_op.child, node); } return 0; }