void getArrowPosition(GList *pertchartnodes) { GList *l1 = NULL; GList *l2 = NULL; gint i = 0; Chart *anposition = NULL; Chart *suposition = NULL; g_printf("-----------@#$@#$in getArrowPosition function\n"); gint j; for(j=0;j<200;j++) { arrow[j].x1 = 0; } for(l1=pertchartnodes;l1;l1=l1->next) { gchar *ancestorname = mrp_task_get_name(MRP_TASK(planner_pertchart_node_get_task(l1->data))); anposition = getPositionByTaskName(pertnodes,ancestorname); if(anposition) { l2 = getPertNodeSuccessors(l1->data); for(;l2;l2=l2->next) { g_printf("*******************************in the 2th loop*******************************\n"); gchar *successorname = mrp_task_get_name(MRP_TASK(planner_pertchart_node_get_task(l2->data))); suposition = getPositionByTaskName(pertnodes,successorname); if(suposition) { arrow[i].x1 = anposition->x + anposition->w; arrow[i].y1 = anposition->y + anposition->h/2; arrow[i].x2 = anposition->x + anposition->w + X_GAP/2; arrow[i].y2 = anposition->y + anposition->h/2; arrow[i].x3 = anposition->x + anposition->w + X_GAP/2; arrow[i].y3 = suposition->y + suposition->h/2; arrow[i].x4 = suposition->x; arrow[i].y4 = suposition->y + suposition->h/2; i++; } else { g_printf("do not find the position\n"); //break; } } } else { g_printf("do not find the position\n"); //break; } //i++; } Lin = i; g_printf("%d\n",i); g_printf("-----------out getArrowPosition function\n"); }
gboolean isCrossingArrow(PlannerPertchartNode *pertchartnode) { int maxUp = 10000,maxDown = -1; GList *l1 = NULL; GList *l2 = NULL; GList *l3 = NULL; GList *l4 = NULL; l1 = getPertNodeSuccessors(pertchartnode); for(;l1;l1=l1->next) { gint row = planner_pertchart_node_get_row(l1->data); if(row < maxUp) maxUp = row; if(row > maxDown) maxDown = row; } gint col = planner_pertchart_node_get_col(pertchartnode); l2 = getPertNodeInColumn(col); l2 = g_list_remove(l2,pertchartnode); for(;l2;l2=l2->next) { l3 = getPertNodeSuccessors(l2->data); for(;l3;l3=l3->next) { gint row1 = planner_pertchart_node_get_row(pertchartnode); gint col1 = planner_pertchart_node_get_col(pertchartnode); gint row2 = planner_pertchart_node_get_row(l2->data); gint col2 = planner_pertchart_node_get_col(l2->data); gint row3 = planner_pertchart_node_get_row(l3->data); gint col3 = planner_pertchart_node_get_col(l3->data); gint sig = 0; for(l4=getPertNodeSuccessors(pertchartnode);l4;l4=l4->next) { gchar *name1 = mrp_task_get_name(MRP_TASK(planner_pertchart_node_get_task(l4->data))); gchar *name2 = mrp_task_get_name(MRP_TASK(planner_pertchart_node_get_task(l3->data))); if(!g_strcmp0(name1,name2)) sig = 1; } if(maxUp < row1) { if(row3 <= row1 && !sig) return TRUE; } if(maxDown > row1) { if(row3 >= row1 && !sig) return TRUE; } } } return FALSE; }
static void show_view_update_ui (PlannerShowView *view) { PlannerShowViewPriv *priv; GList *list, *l; gboolean value; gboolean rel_value = FALSE; gboolean link_value = FALSE; gint count_value = 0; if (!PLANNER_VIEW (view)->activated) { return; } priv = view->priv; list = planner_task_tree_get_selected_tasks( PLANNER_TASK_TREE (priv->tree) ); for (l = list; l; l = l->next) { if (mrp_task_has_relation(MRP_TASK (l->data) )) { rel_value = TRUE; break; } } for (l = list; l; l = l->next) { count_value++; } value = (list != NULL ); link_value = (count_value >= 2); g_list_free(list); }
static void task_view_update_ui (PlannerView *view) { PlannerTaskViewPriv *priv; GList *list, *l; gboolean value; gboolean rel_value = FALSE; gboolean link_value = FALSE; gint count = 0; if (!view->activated) { return; } priv = PLANNER_TASK_VIEW (view)->priv; list = planner_task_tree_get_selected_tasks (PLANNER_TASK_TREE (priv->tree)); for (l = list; l; l = l->next) { if (mrp_task_has_relation (MRP_TASK (l->data))) { rel_value = TRUE; break; } } for (l = list; l; l = l->next) { count++; } value = (list != NULL); link_value = (count >= 2); g_object_set (gtk_action_group_get_action (priv->actions, "EditTask"), "sensitive", value, NULL); g_object_set (gtk_action_group_get_action (priv->actions, "RemoveTask"), "sensitive", value, NULL); g_object_set (gtk_action_group_get_action (priv->actions, "UnlinkTask"), "sensitive", rel_value, NULL); g_object_set (gtk_action_group_get_action (priv->actions, "LinkTasks"), "sensitive", link_value, NULL); g_object_set (gtk_action_group_get_action (priv->actions, "IndentTask"), "sensitive", value, NULL); g_object_set (gtk_action_group_get_action (priv->actions, "UnindentTask"), "sensitive", value, NULL); g_object_set (gtk_action_group_get_action (priv->actions, "MoveTaskUp"), "sensitive", value, NULL); g_object_set (gtk_action_group_get_action (priv->actions, "MoveTaskDown"), "sensitive", value, NULL); g_object_set (gtk_action_group_get_action (priv->actions, "ResetConstraint"), "sensitive", value, NULL); g_list_free (list); }