/* * init debug related GUI (watch tree view) * arguments: */ void debug_init() { /* create watch page */ wtree = wtree_init(on_watch_expanded_callback, on_watch_dragged_callback, on_watch_key_pressed_callback, on_watch_changed, on_watch_button_pressed_callback); wmodel = gtk_tree_view_get_model(GTK_TREE_VIEW(wtree)); wstore = GTK_TREE_STORE(wmodel); tab_watch = gtk_scrolled_window_new( gtk_tree_view_get_hadjustment(GTK_TREE_VIEW(wtree)), gtk_tree_view_get_vadjustment(GTK_TREE_VIEW(wtree)) ); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(tab_watch), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_container_add(GTK_CONTAINER(tab_watch), wtree); /* create autos page */ atree = atree_init(on_watch_expanded_callback, on_watch_button_pressed_callback); tab_autos = gtk_scrolled_window_new( gtk_tree_view_get_hadjustment(GTK_TREE_VIEW(atree)), gtk_tree_view_get_vadjustment(GTK_TREE_VIEW(atree)) ); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(tab_autos), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_container_add(GTK_CONTAINER(tab_autos), atree); /* create stack trace page */ stree = stree_init(editor_open_position, on_select_frame); tab_call_stack = gtk_scrolled_window_new( gtk_tree_view_get_hadjustment(GTK_TREE_VIEW(stree )), gtk_tree_view_get_vadjustment(GTK_TREE_VIEW(stree )) ); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(tab_call_stack), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_container_add(GTK_CONTAINER(tab_call_stack), stree); /* create debug terminal page */ terminal = vte_terminal_new(); /* create PTY */ openpty(&pty_master, &pty_slave, NULL, NULL, NULL); grantpt(pty_master); unlockpt(pty_master); vte_terminal_set_pty(VTE_TERMINAL(terminal), pty_master); GtkWidget *scrollbar = gtk_vscrollbar_new(GTK_ADJUSTMENT(VTE_TERMINAL(terminal)->adjustment)); GTK_WIDGET_UNSET_FLAGS(scrollbar, GTK_CAN_FOCUS); tab_terminal = gtk_frame_new(NULL); gtk_frame_set_shadow_type (GTK_FRAME(tab_terminal), GTK_SHADOW_NONE); GtkWidget *hbox = gtk_hbox_new(FALSE, 0); gtk_container_add(GTK_CONTAINER(tab_terminal), hbox); gtk_box_pack_start(GTK_BOX(hbox), terminal, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(hbox), scrollbar, FALSE, FALSE, 0); /* set the default widget size first to prevent VTE expanding too much, * sometimes causing the hscrollbar to be too big or out of view. */ gtk_widget_set_size_request(GTK_WIDGET(terminal), 10, 10); vte_terminal_set_size(VTE_TERMINAL(terminal), 30, 1); /* set terminal font. */ GKeyFile *config = g_key_file_new(); gchar *configfile = g_strconcat(geany_data->app->configdir, G_DIR_SEPARATOR_S, "geany.conf", NULL); g_key_file_load_from_file(config, configfile, G_KEY_FILE_NONE, NULL); gchar *font = utils_get_setting_string(config, "VTE", "font", "Monospace 10"); vte_terminal_set_font_from_string (VTE_TERMINAL(terminal), font); /* debug messages page */ tab_messages = gtk_scrolled_window_new(NULL, NULL); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(tab_messages), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); hadj = gtk_scrolled_window_get_hadjustment(GTK_SCROLLED_WINDOW(tab_messages)); vadj = gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(tab_messages)); debugger_messages_textview = gtk_text_view_new(); gtk_text_view_set_editable (GTK_TEXT_VIEW (debugger_messages_textview), FALSE); gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(tab_messages), debugger_messages_textview); /* create tex tags */ GtkTextBuffer *buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(debugger_messages_textview)); gtk_text_buffer_create_tag(buffer, "black", "foreground", "#000000", NULL); gtk_text_buffer_create_tag(buffer, "grey", "foreground", "#AAAAAA", NULL); gtk_text_buffer_create_tag(buffer, "red", "foreground", "#FF0000", NULL); gtk_text_buffer_create_tag(buffer, "green", "foreground", "#00FF00", NULL); gtk_text_buffer_create_tag(buffer, "blue", "foreground", "#0000FF", NULL); gtk_text_buffer_create_tag(buffer, "yellow", "foreground", "#FFFF00", NULL); gtk_text_buffer_create_tag(buffer, "brown", "foreground", "#BB8915", NULL); gtk_text_buffer_create_tag(buffer, "rose", "foreground", "#BA92B7", NULL); }
static GtkWidget * usage_view_create_widget (PlannerView *view) { PlannerUsageViewPriv *priv; MrpProject *project; GtkWidget *hpaned; GtkWidget *left_frame; GtkWidget *right_frame; PlannerUsageModel *model; GtkWidget *tree; GtkWidget *vbox; GtkWidget *sw; GtkWidget *chart; GtkAdjustment *hadj, *vadj; project = planner_window_get_project (view->main_window); priv = PLANNER_USAGE_VIEW (view)->priv; priv->project = project; g_signal_connect (project, "loaded", G_CALLBACK (usage_view_project_loaded_cb), view); g_signal_connect (project, "resource_added", G_CALLBACK (usage_view_resource_added_cb), view); model = planner_usage_model_new (project); tree = planner_usage_tree_new (view->main_window, model); priv->tree = tree; left_frame = gtk_frame_new (NULL); right_frame = gtk_frame_new (NULL); vbox = gtk_vbox_new (FALSE, 3); gtk_box_pack_start (GTK_BOX (vbox), tree, TRUE, TRUE, 0); hadj = gtk_tree_view_get_hadjustment (GTK_TREE_VIEW (tree)); gtk_box_pack_start (GTK_BOX (vbox), gtk_hscrollbar_new (hadj), FALSE, TRUE, 0); gtk_container_add (GTK_CONTAINER (left_frame), vbox); hadj = GTK_ADJUSTMENT (gtk_adjustment_new (0, 0, 0, 90, 250, 2000)); vadj = gtk_tree_view_get_vadjustment (GTK_TREE_VIEW (tree)); chart = planner_usage_chart_new_with_model (GTK_TREE_MODEL (model)); priv->chart = PLANNER_USAGE_CHART (chart); planner_usage_chart_set_view (PLANNER_USAGE_CHART (priv->chart), PLANNER_USAGE_TREE (priv->tree)); gtk_widget_set_events (GTK_WIDGET (priv->chart), GDK_SCROLL_MASK); g_signal_connect (priv->chart, "scroll-event", G_CALLBACK (usage_view_chart_scroll_event), view); sw = gtk_scrolled_window_new (hadj, vadj); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), GTK_POLICY_ALWAYS, GTK_POLICY_AUTOMATIC); gtk_container_add (GTK_CONTAINER (right_frame), sw); gtk_container_add (GTK_CONTAINER (sw), chart); hpaned = gtk_hpaned_new (); gtk_frame_set_shadow_type (GTK_FRAME (left_frame), GTK_SHADOW_IN); gtk_frame_set_shadow_type (GTK_FRAME (right_frame), GTK_SHADOW_IN); gtk_paned_add1 (GTK_PANED (hpaned), left_frame); gtk_paned_add2 (GTK_PANED (hpaned), right_frame); usage_view_load_columns (PLANNER_USAGE_VIEW (view)); g_signal_connect (tree, "columns-changed", G_CALLBACK (usage_view_tree_view_columns_changed_cb), view); g_signal_connect (tree, "destroy", G_CALLBACK (usage_view_tree_view_destroy_cb), view); g_signal_connect (tree, "row_expanded", G_CALLBACK (usage_view_row_expanded), chart); g_signal_connect (tree, "row_collapsed", G_CALLBACK (usage_view_row_collapsed), chart); g_signal_connect (tree, "expand_all", G_CALLBACK (usage_view_expand_all), chart); g_signal_connect (tree, "collapse_all", G_CALLBACK (usage_view_collapse_all), chart); g_signal_connect (chart, "status_updated", G_CALLBACK (usage_view_usage_status_updated), view); g_signal_connect_after (tree, "size_request", G_CALLBACK (usage_view_tree_view_size_request_cb), NULL); g_signal_connect_after (tree, "scroll_event", G_CALLBACK (usage_view_tree_view_scroll_event_cb), view); g_signal_connect (tree, "style_set", G_CALLBACK (usage_view_tree_style_set_cb), view); gtk_tree_view_expand_all (GTK_TREE_VIEW (tree)); planner_usage_chart_expand_all (PLANNER_USAGE_CHART (chart)); g_object_unref (model); return hpaned; }