Int_Slider::Int_Slider() : signal(this) { debug_path("Int_Slider"); range(0, 100); }
static void debug_path(struct traverse_info *info) { if (info->prev) { debug_path(info->prev); if (*info->prev->name.path) putchar('/'); } printf("%s", info->name.path); }
Text_Display::Text_Display(const String & in) : _value(in), _widget(0) { debug_path("Text_Display"); add(_widget = new Widget); widget_update(); }
Frame::Frame(STYLE style, bool down) : select_signal (this), select_off_signal (this), highlight_signal (this), highlight_off_signal(this), _style (style), _down (down), _margin(0) { debug_path("frame::Frame"); Fl_Group::box(FL_NO_BOX); }
static void debug_unpack_callback(int n, unsigned long mask, unsigned long dirmask, struct name_entry *names, struct traverse_info *info) { int i; printf("* unpack mask %lu, dirmask %lu, cnt %d ", mask, dirmask, n); debug_path(info); putchar('\n'); for (i = 0; i < n; i++) debug_name_entry(i, names + i); }
Abstract_Widget::Abstract_Widget() : Layout_Item(WIDGET), _text_font(Style::global()->font()), _text_color(FL_FOREGROUND_COLOR), _inside(false), _arrow_navkeys(true), _del(false) { debug_path("Abstract_Widget"); //DJV_DEBUG("Abstract_Widget::Abstract_Widget"); DJV_APP->widget_add(this); }
static GtkTreePath * gnc_tree_view_owner_get_path_from_owner (GncTreeViewOwner *view, GncOwner *owner) { GtkTreeModel *model, *f_model, *s_model; GtkTreePath *path, *f_path, *s_path; ENTER("view %p, owner %p (%s)", view, owner, gncOwnerGetName(owner)); if (owner == NULL) { LEAVE("no owner"); return NULL; } /* Reach down to the real model and get a path for this owner */ s_model = gtk_tree_view_get_model(GTK_TREE_VIEW(view)); f_model = gtk_tree_model_sort_get_model(GTK_TREE_MODEL_SORT(s_model)); model = gtk_tree_model_filter_get_model(GTK_TREE_MODEL_FILTER(f_model)); path = gnc_tree_model_owner_get_path_from_owner (GNC_TREE_MODEL_OWNER(model), owner); if (path == NULL) { LEAVE("no path"); return NULL; } /* convert back to a filtered path */ f_path = gtk_tree_model_filter_convert_child_path_to_path (GTK_TREE_MODEL_FILTER (f_model), path); gtk_tree_path_free(path); if (!f_path) { LEAVE("no filter path"); return NULL; } /* convert back to a sorted path */ s_path = gtk_tree_model_sort_convert_child_path_to_path (GTK_TREE_MODEL_SORT (s_model), f_path); gtk_tree_path_free(f_path); debug_path(LEAVE, s_path); return s_path; }
/* * Selects a single price in the price tree view. The price * tree must be in single selection mode. */ void gnc_tree_view_price_set_selected_price (GncTreeViewPrice *view, GNCPrice *price) { GtkTreeModel *model, *f_model, *s_model; GtkTreePath *path, *f_path, *s_path, *parent_path; GtkTreeSelection *selection; ENTER("view %p, price %p", view, price); /* Clear any existing selection. */ selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(view)); gtk_tree_selection_unselect_all (selection); if (price == NULL) return; s_model = gtk_tree_view_get_model(GTK_TREE_VIEW(view)); f_model = gtk_tree_model_sort_get_model(GTK_TREE_MODEL_SORT(s_model)); model = gtk_tree_model_filter_get_model (GTK_TREE_MODEL_FILTER (f_model)); path = gnc_tree_model_price_get_path_from_price (GNC_TREE_MODEL_PRICE(model), price); if (path == NULL) { LEAVE("get_path_from_price failed"); return; } debug_path(DEBUG, path); f_path = gtk_tree_model_filter_convert_child_path_to_path (GTK_TREE_MODEL_FILTER (f_model), path); gtk_tree_path_free(path); if (f_path == NULL) { LEAVE("no filter path"); return; } debug_path(DEBUG, f_path); s_path = gtk_tree_model_sort_convert_child_path_to_path (GTK_TREE_MODEL_SORT (s_model), f_path); gtk_tree_path_free(f_path); if (s_path == NULL) { LEAVE("no sort path"); return; } /* gtk_tree_view requires that a row be visible before it can be selected */ parent_path = gtk_tree_path_copy (s_path); if (gtk_tree_path_up (parent_path)) { /* This function is misnamed. It expands the actual item * specified, not the path to the item specified. I.E. It expands * one level too many, thus the get of the parent. */ gtk_tree_view_expand_to_path(GTK_TREE_VIEW(view), parent_path); } gtk_tree_path_free(parent_path); gtk_tree_selection_select_path (selection, s_path); gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW(view), s_path, NULL, FALSE, 0.0, 0.0); debug_path(LEAVE, s_path); gtk_tree_path_free(s_path); }
/* * Selects a single owner in the owner tree view. The owner * tree must be in single selection mode. */ void gnc_tree_view_owner_set_selected_owner (GncTreeViewOwner *view, GncOwner *owner) { GtkTreeModel *model, *f_model, *s_model; GtkTreePath *path, *f_path, *s_path, *parent_path; GtkTreeSelection *selection; ENTER("view %p, owner %p (%s)", view, owner, gncOwnerGetName (owner)); g_return_if_fail (GNC_IS_TREE_VIEW_OWNER (view)); /* Clear any existing selection. */ selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(view)); gtk_tree_selection_unselect_all (selection); if (owner == NULL) return; s_model = gtk_tree_view_get_model(GTK_TREE_VIEW(view)); f_model = gtk_tree_model_sort_get_model(GTK_TREE_MODEL_SORT(s_model)); model = gtk_tree_model_filter_get_model(GTK_TREE_MODEL_FILTER(f_model)); path = gnc_tree_model_owner_get_path_from_owner ( GNC_TREE_MODEL_OWNER(model), owner); if (path == NULL) { LEAVE("no path"); return; } debug_path(DEBUG, path); f_path = gtk_tree_model_filter_convert_child_path_to_path ( GTK_TREE_MODEL_FILTER (f_model), path); gtk_tree_path_free(path); if (f_path == NULL) { LEAVE("no filter path"); return; } debug_path(DEBUG, f_path); s_path = gtk_tree_model_sort_convert_child_path_to_path (GTK_TREE_MODEL_SORT (s_model), f_path); gtk_tree_path_free(f_path); if (s_path == NULL) { LEAVE("no sort path"); return; } gtk_tree_selection_select_path (selection, s_path); /* give gtk+ a chance to resize the tree view first by handling pending * configure events */ while (gtk_events_pending ()) gtk_main_iteration (); gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW(view), s_path, NULL, FALSE, 0.0, 0.0); debug_path(LEAVE, s_path); gtk_tree_path_free(s_path); }
bool get_astar_path(int actor_node, int start_tile, int destination_tile){ /** public function - see header */ int j=0; path_stack_count=0; int lowest_value=0; int next_tile=0; int map_id=clients.client[actor_node].map_id; if(explore_path(actor_node, destination_tile)==false) return false; //if #EXPLORE_TRACE commands have been used then send ascii grid to client if(clients.client[actor_node].debug_status==DEBUG_EXPLORE){ debug_explore(actor_node, destination_tile); clients.client[actor_node].debug_status=DEBUG_OFF; } //start path at destination tile next_tile=destination_tile; path_stack[0].explored=true; //load destination tile to the path clients.client[actor_node].path_count=1; clients.client[actor_node].path[ clients.client[actor_node].path_count-1]=next_tile; //loop through explored tiles finding the best adjacent moves from destination to start do{ lowest_value=9999;//works for paths up to 9999 tiles long which ought to be sufficient bool found=false; for(int i=0; i<path_stack_count; i++){ if(tile_adjacent(next_tile, path_stack[i].tile, map_id)==true){ if(path_stack[i].value<lowest_value && path_stack[i].explored==false){ //ensure path doesn't cross lateral bounds if(tile_in_lateral_bounds(next_tile, path_stack[i].tile, map_id)==true){ lowest_value=path_stack[i].value; j=i; found=true; } } } } //if no adjacent tiles then start is unreachable from destination so abort function if(found==false) { send_text(clients.client[actor_node].socket, CHAT_PERSONAL, "%cthat destination is unreachable", c_red1+127); return false; } next_tile=path_stack[j].tile; path_stack[j].explored=true; clients.client[actor_node].path_count++; if(clients.client[actor_node].path_count>PATH_MAX-1) { log_event(EVENT_ERROR, "client path array exceeded in function %s: module %s: line %i", GET_CALL_INFO); stop_server(); } clients.client[actor_node].path[ clients.client[actor_node].path_count-1]=next_tile; }while(clients.client[actor_node].path[clients.client[actor_node].path_count-1]!=start_tile); //if #TRACE_PATH command has been used then display ascii grid if(clients.client[actor_node].debug_status==DEBUG_PATH){ debug_path(actor_node, destination_tile); clients.client[actor_node].debug_status=DEBUG_OFF; } return true; }