<commit_before>/** $Id: syncviews.c,v 1.1 2006-01-31 21:58:27 ensonic Exp $
 * test synchonized scrolling of two treeviews
 *
 * gcc -Wall -g `pkg-config gtk+-2.0 --cflags --libs` syncviews.c -o syncviews
 */
 
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <gtk/gtk.h>
#include <gdk/gdk.h>
#include <glib.h>

GtkWidget *window=NULL;
GtkWidget *scrolled_window1=NULL;
GtkWidget *scrolled_window2=NULL;
GtkWidget *tree_view1=NULL;
GtkWidget *tree_view2=NULL;

static void destroy(GtkWidget *widget,gpointer data) {
  gtk_main_quit();
}

static void init() {
  gint i;
  GtkWidget *box;
  GtkCellRenderer *renderer;
  GtkListStore *store;
  GtkTreeIter tree_iter;
  GtkAdjustment *vadjust;

  window=gtk_window_new(GTK_WINDOW_TOPLEVEL);
  gtk_window_set_title(GTK_WINDOW(window), "Syncronized views");
  gtk_widget_set_usize(GTK_WIDGET(window), 500, 300);
  g_signal_connect(G_OBJECT(window), "destroy",	G_CALLBACK (destroy), NULL);
  
  box=gtk_hbox_new(FALSE,0);
  gtk_container_add(GTK_CONTAINER(window), box);
  
  // first view
  scrolled_window1=gtk_scrolled_window_new(NULL, NULL);
  gtk_container_add(GTK_CONTAINER(box), scrolled_window1);

  gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled_window1),GTK_POLICY_NEVER,GTK_POLICY_NEVER);
  gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolled_window1),GTK_SHADOW_ETCHED_IN);
  tree_view1=gtk_tree_view_new();
  g_object_set(GTK_TREE_VIEW(tree_view1),"enable-search",FALSE,"rules-hint",TRUE,NULL);
  gtk_tree_selection_set_mode(gtk_tree_view_get_selection(GTK_TREE_VIEW(tree_view1)),GTK_SELECTION_BROWSE);
  renderer=gtk_cell_renderer_text_new();
  g_object_set(G_OBJECT(renderer),"xalign",1.0,NULL);
  gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(tree_view1),-1,"Col 1.1",renderer,"text",0,NULL);
  renderer=gtk_cell_renderer_text_new();
  gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(tree_view1),-1,"Col 1.2",renderer,"text",1,NULL);
  gtk_container_add(GTK_CONTAINER(scrolled_window1),tree_view1);
  
  // first view
  scrolled_window2=gtk_scrolled_window_new(NULL, NULL);
  gtk_container_add(GTK_CONTAINER(box), scrolled_window2);

  gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled_window2),GTK_POLICY_NEVER,GTK_POLICY_AUTOMATIC);
  gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolled_window2),GTK_SHADOW_ETCHED_IN);
  tree_view2=gtk_tree_view_new();
  g_object_set(GTK_TREE_VIEW(tree_view2),"enable-search",FALSE,"rules-hint",TRUE,NULL);
  gtk_tree_selection_set_mode(gtk_tree_view_get_selection(GTK_TREE_VIEW(tree_view2)),GTK_SELECTION_BROWSE);
  renderer=gtk_cell_renderer_text_new();
  g_object_set(G_OBJECT(renderer),"xalign",1.0,NULL);
  gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(tree_view2),-1,"Col 2.1",renderer,"text",0,NULL);
  renderer=gtk_cell_renderer_text_new();
  gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(tree_view2),-1,"Col 2.2",renderer,"text",1,NULL);
  gtk_container_add(GTK_CONTAINER(scrolled_window2),tree_view2);
  
  // shared list store
  store=gtk_list_store_new(2,G_TYPE_INT,G_TYPE_INT);

  for(i=0;i<15;i++) {
    gtk_list_store_append(store, &tree_iter);
    gtk_list_store_set(store,&tree_iter,0,i,1,i*i,-1);
  }
  gtk_tree_view_set_model(GTK_TREE_VIEW(tree_view1),GTK_TREE_MODEL(store));
  gtk_tree_view_set_model(GTK_TREE_VIEW(tree_view2),GTK_TREE_MODEL(store));<commit_msg>* design/gui/syncviews.c: (init): made this more similar to the sequence view to figure out what is going wrong with the resizing * src/ui/edit/main-page-patterns.c: (bt_main_page_patterns_init_ui): * src/ui/edit/main-page-sequence.c: (bt_main_page_sequence_init_ui): * src/ui/edit/main-window.c: (bt_main_window_init_ui): fixed sizing problem, applied separator and no-shadow change to pattern view, added separators around split-pane handle<commit_after>/** $Id: syncviews.c,v 1.2 2006-08-08 19:46:13 ensonic Exp $
 * test synchonized scrolling of two treeviews
 *
 * gcc -Wall -g `pkg-config gtk+-2.0 --cflags --libs` syncviews.c -o syncviews
 */
 
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <gtk/gtk.h>
#include <gdk/gdk.h>
#include <glib.h>

GtkWidget *window=NULL;
GtkWidget *scrolled_window1=NULL;
GtkWidget *scrolled_window2=NULL;
GtkWidget *tree_view1=NULL;
GtkWidget *tree_view2=NULL;

static void destroy(GtkWidget *widget,gpointer data) {
  gtk_main_quit();
}

static void init() {
  gint i;
  GtkWidget *box;
  GtkCellRenderer *renderer;
  GtkListStore *store;
  GtkTreeIter tree_iter;
  GtkAdjustment *vadjust;

  window=gtk_window_new(GTK_WINDOW_TOPLEVEL);
  gtk_window_set_title(GTK_WINDOW(window), "Syncronized views");
  //gtk_widget_set_size_request(GTK_WIDGET(window),300,200);
  //gtk_widget_set_usize(GTK_WIDGET(window), 300, 200);
  // if we use this, that sizing does not work as expected
  //gtk_window_set_default_size(GTK_WINDOW(window),300, 250);
  gtk_window_resize(GTK_WINDOW(window),300,200);
  g_signal_connect(G_OBJECT(window), "destroy",	G_CALLBACK (destroy), NULL);
  
  box=gtk_hbox_new(FALSE,0);
  gtk_container_add(GTK_CONTAINER(window), box);
 
  // first view
  scrolled_window1=gtk_scrolled_window_new(NULL, NULL);
  gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled_window1),GTK_POLICY_NEVER,GTK_POLICY_NEVER);
  gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolled_window1),GTK_SHADOW_NONE);
  tree_view1=gtk_tree_view_new();
  g_object_set(GTK_TREE_VIEW(tree_view1),"enable-search",FALSE,"rules-hint",TRUE,NULL);
  gtk_widget_set_size_request(GTK_WIDGET(tree_view1),100,40);
  gtk_tree_selection_set_mode(gtk_tree_view_get_selection(GTK_TREE_VIEW(tree_view1)),GTK_SELECTION_BROWSE);
  renderer=gtk_cell_renderer_text_new();
  g_object_set(G_OBJECT(renderer),"xalign",1.0,NULL);
  gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(tree_view1),-1,"Col 1.1",renderer,"text",0,NULL);
  renderer=gtk_cell_renderer_text_new();
  gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(tree_view1),-1,"Col 1.2",renderer,"text",1,NULL);
  gtk_container_add(GTK_CONTAINER(scrolled_window1),tree_view1);
  gtk_box_pack_start(GTK_BOX(box), GTK_WIDGET(scrolled_window1), FALSE, FALSE, 0);
  
  // add vertical separator
  gtk_box_pack_start(GTK_BOX(box), gtk_vseparator_new(), FALSE, FALSE, 0);

  // second view
  scrolled_window2=gtk_scrolled_window_new(NULL, NULL);
  gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled_window2),GTK_POLICY_NEVER,GTK_POLICY_AUTOMATIC);
  gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolled_window2),GTK_SHADOW_NONE);
  tree_view2=gtk_tree_view_new();
  g_object_set(GTK_TREE_VIEW(tree_view2),"enable-search",FALSE,"rules-hint",TRUE,NULL);
  gtk_tree_selection_set_mode(gtk_tree_view_get_selection(GTK_TREE_VIEW(tree_view2)),GTK_SELECTION_BROWSE);
  renderer=gtk_cell_renderer_text_new();
  g_object_set(G_OBJECT(renderer),"xalign",1.0,NULL);
  gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(tree_view2),-1,"Col 2.1",renderer,"text",0,NULL);
  renderer=gtk_cell_renderer_text_new();
  gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(tree_view2),-1,"Col 2.2",renderer,"text",1,NULL);
  gtk_container_add(GTK_CONTAINER(scrolled_window2),tree_view2);
  gtk_box_pack_start(GTK_BOX(box), GTK_WIDGET(scrolled_window2), TRUE, TRUE, 0);
  
  // shared list store
  store=gtk_list_store_new(2,G_TYPE_INT,G_TYPE_INT);

  for(i=0;i<15;i++) {
    gtk_list_store_append(store, &tree_iter);
    gtk_list_store_set(store,&tree_iter,0,i,1,i*i,-1);
  }
  gtk_tree_view_set_model(GTK_TREE_VIEW(tree_view1),GTK_TREE_MODEL(store));
  gtk_tree_view_set_model(GTK_TREE_VIEW(tree_view2),GTK_TREE_MODEL(store));
{'fraction_non_alphanumeric': 0.12267852471880722, 'fraction_numerical': 0.02445723253989014, 'mean_word_length': 9.141909814323608, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '57849', 'n_tokens_mistral': 3274, 'n_tokens_neox': 3153, 'n_words': 331}