int ObjectTree::handle(int ev) { if(ev == FL_PUSH) { const Fl_Tree_Item *clicked = find_clicked(); if(clicked && clicked->user_data()) { /* show prototype as tooltip */ Entity *e = (Entity*)clicked->user_data(); if(Fl::event_button() == FL_RIGHT_MOUSE) { deselect_all(); select((Fl_Tree_Item*) clicked); /* by default popup() does not call callbacks */ const MenuItem * m = action_menu->menu()->popup(Fl::event_x(), Fl::event_y()); if(m && m->callback()) m->do_callback(0, this); } else { e->get_prototype(tooltip_buf, sizeof(tooltip_buf)); Fl_Tooltip::current(this); Fl::belowmouse(this); /* * I will never understaind how 'entity_area()' works, as obviously y coordinate always * gets messed up. Here '50' is hardcoded to fix tooltip messed position. */ Fl_Tooltip::enter_area(this, clicked->x(), clicked->y() - 50, clicked->w(), clicked->h(), tooltip_buf); } } } else if(ev == FL_LEAVE) { Fl_Tooltip::current(NULL); } return Fl_Tree::handle(ev); }
void ElementsCtrlBase::OnKeyDown( wxListEvent& ev ) { int kc = tolower(ev.GetKeyCode()); wxLogDebug(wxT("ElementsCtrlBase::OnKeyDown - %d"), kc); if( kc >= 'a' && kc <= 'z' ) { const long startidx = (m_selidx.size() == 0 ? 0 : m_selidx.front()); long idx = startidx; wxListItem info; for( ;; ) { idx = m_list->GetNextItem(idx, wxLIST_NEXT_BELOW, wxLIST_STATE_DONTCARE); if( idx == -1 ) idx = 0; if( idx == startidx ) break; info.m_mask = wxLIST_MASK_TEXT; info.m_col = 1; info.m_itemId = idx; // skip over collection titles and those that don't start with the pressed key if( m_list->GetItem(info) && m_list->GetItemData(idx) != 0 && info.m_text.Lower().StartsWith(wxString::Format(wxT("%c"), kc)) ) { deselect_all(); select_item(idx); break; } } } }
void ElementsCtrlBase::select_next() { const long startidx = (m_selidx.size() == 0 ? 0 : m_selidx.front()); long idx = startidx; wxListItem info; for( ;; ) { idx = m_list->GetNextItem(idx, wxLIST_NEXT_BELOW, wxLIST_STATE_DONTCARE); if( idx == -1 ) idx = 0; if( idx == startidx ) break; // only one element to choose from? shouldn't happen normally info.m_mask = wxLIST_MASK_TEXT; info.m_col = 1; info.m_itemId = idx; if( m_list->GetItem(info) ) { // skip over collection titles if( m_list->GetItemData(idx) != 0 ) { deselect_all(); select_item(idx); break; } } } }
void alloc_draw_structs (void) { /* Allocate the structures needed to draw the placement and routing. Set * * up the default colors for blocks and nets. */ x_clb_left = (float *) my_malloc ((nx+2)*sizeof(float)); y_clb_bottom = (float *) my_malloc ((ny+2)*sizeof(float)); net_color = (enum color_types *) my_malloc (num_nets * sizeof (enum color_types)); block_color = (enum color_types *) my_malloc (num_blocks * sizeof (enum color_types)); deselect_all(); /* Set initial colors */ }
void View_list::key_down(Core *c, Event *e, uint8_t key_name){ if (key_name == 'a'){ select_all(); return; } if (key_name == 'A'){ deselect_all(); return; } int32_t amount = 64; if (key_name == 'N'){ scroll_all(c, e, amount, 0, 0); return; } if (key_name == 'H'){ scroll_all(c, e, -amount, 0, 0); return; } if (key_name == 'C'){ scroll_all(c, e, 0, amount, 0); return; } if (key_name == 'T'){ scroll_all(c, e, 0, -amount, 0); return; } if (key_name == 'l'){ layouter = new Virtical_layouter_v1; return; } if (key_name == 's'){ layouter = new Horizontial_layouter_v1; return; } if (key_name == '/'){ layouter = new Matrix_layouter; return; } View* v = view_at(e->cursor()); if (not v) return; if (key_name == 'x'){ v->reset_visible(); return; } v->key_down(c, e, key_name); }
void editor_t::cancel_action() { switch(current_tool) { case select: { deselect_all(); break; } case terrain_paint: { break; } case place_objects: { break; } case place_splines: { break; } default: break; }; }
void menu_click_pan(glCompObj *obj, GLfloat x, GLfloat y, glMouseButtonType t) { deselect_all(view->g[view->activeGraph]); }
void mUnselectAllSlot(GtkWidget * widget, gpointer user_data) { deselect_all(view->g[view->activeGraph]); }
void reset_selections() { deselect_all(); button_posx = 0; button_posy = 0; }
static void highlight_crit_path (void (*drawscreen_ptr) (void)) { /* Highlights all the blocks and nets on the critical path. */ t_linked_int *critical_path_head, *critical_path_node; int inode, iblk, inet, num_nets_seen; static int nets_to_highlight = 1; char msg[BUFSIZE]; if (nets_to_highlight == 0) { /* Clear the display of all highlighting. */ nets_to_highlight = 1; deselect_all (); update_message (default_message); drawscreen_ptr (); return; } critical_path_head = allocate_and_load_critical_path (); critical_path_node = critical_path_head; num_nets_seen = 0; while (critical_path_node != NULL) { inode = critical_path_node->data; get_tnode_block_and_output_net (inode, &iblk, &inet); if (num_nets_seen == nets_to_highlight) /* Last block */ block_color[iblk] = MAGENTA; else if (num_nets_seen == nets_to_highlight - 1) /* 2nd last block */ block_color[iblk] = YELLOW; else if (num_nets_seen < nets_to_highlight) /* Earlier block */ block_color[iblk] = DARKGREEN; if (inet != OPEN) { num_nets_seen++; if (num_nets_seen < nets_to_highlight) /* First nets. */ net_color[inet] = DARKGREEN; else if (num_nets_seen == nets_to_highlight) net_color[inet] = CYAN; /* Last (new) net. */ } critical_path_node = critical_path_node->next; } if (nets_to_highlight == num_nets_seen) { nets_to_highlight = 0; sprintf (msg, "All %d nets on the critical path highlighted.", num_nets_seen); } else { sprintf (msg, "First %d nets on the critical path highlighted.", nets_to_highlight); nets_to_highlight++; } free_int_list (&critical_path_head); update_message (msg); drawscreen_ptr (); }
static void highlight_blocks (float x, float y) { /* This routine is called when the user clicks in the graphics area. * * It determines if a clb was clicked on. If one was, it is * * highlighted in green, it's fanin nets and clbs are highlighted in * * blue and it's fanout is highlighted in red. If no clb was * * clicked on (user clicked on white space) any old highlighting is * * removed. Note that even though global nets are not drawn, their * * fanins and fanouts are highlighted when you click on a block * * attached to them. */ int i, j, k, hit, bnum, ipin, netnum, fanblk; int class; float io_step; char msg[BUFSIZE]; io_step = clb_width/io_rat; deselect_all (); hit = 0; for (i=0;i<=nx+1;i++) { if (x <= x_clb_left[i]+clb_width) { if (x >= x_clb_left[i]) hit = 1; break; } } if (!hit) { update_message (default_message); drawscreen(); return; } hit = 0; for (j=0;j<=ny+1;j++) { if (y <= y_clb_bottom[j]+clb_width) { if (y >= y_clb_bottom[j]) hit = 1; break; } } if (!hit) { update_message (default_message); drawscreen(); return; } /* The user selected the clb at location (i,j). */ if (clb[i][j].type == CLB) { if (clb[i][j].occ == 0) { update_message (default_message); drawscreen (); return; } bnum = clb[i][j].u.block; } else { /* IO block clb */ if (i == 0 || i == nx+1) /* Vertical columns of IOs */ k = (int) ((y - y_clb_bottom[j]) / io_step); else k = (int) ((x - x_clb_left[i]) / io_step); if (k >= clb[i][j].occ) { /* Empty spot */ update_message (default_message); drawscreen(); return; } bnum = clb[i][j].u.io_blocks[k]; } /* Highlight fanin and fanout. */ if (block[bnum].type == OUTPAD) { netnum = block[bnum].nets[0]; /* Only net. */ net_color[netnum] = BLUE; /* Outpad drives nothing */ fanblk = net[netnum].blocks[0]; /* Net driver */ block_color[fanblk] = BLUE; } else if (block[bnum].type == INPAD) { netnum = block[bnum].nets[0]; /* Only net. */ net_color[netnum] = RED; /* Driven by INPAD */ /* Highlight fanout blocks in RED */ for (ipin=1;ipin<net[netnum].num_pins;ipin++) { fanblk = net[netnum].blocks[ipin]; block_color[fanblk] = RED; } } else { /* CLB block. */ for (k=0;k<pins_per_clb;k++) { /* Each pin on a CLB */ netnum = block[bnum].nets[k]; if (netnum == OPEN) continue; class = clb_pin_class[k]; if (class_inf[class].type == DRIVER) { /* Fanout */ net_color[netnum] = RED; for (ipin=1;ipin<net[netnum].num_pins;ipin++) { fanblk = net[netnum].blocks[ipin]; block_color[fanblk] = RED; } } else { /* This net is fanin to the block. */ net_color[netnum] = BLUE; fanblk = net[netnum].blocks[0]; block_color[fanblk] = BLUE; } } }