Ejemplo n.º 1
0
void update_regHiLo()
{
	char txt[24];

	gtk_clist_freeze( GTK_CLIST(clRegHiLo) );
	
	if( gui_fantom_hi != hi ) {
		gui_fantom_hi = hi;
		sprintf( txt, "%.16llX", gui_fantom_hi );
		gtk_clist_set_text( GTK_CLIST(clRegHiLo), 0, 0, txt );
		gtk_clist_set_background( GTK_CLIST(clRegHiLo), 0, &color_modif);
	}
	else
		gtk_clist_set_background( GTK_CLIST(clRegHiLo), 0, &color_ident);

	if(gui_fantom_lo!=lo) {
		gui_fantom_lo=lo;
		sprintf(txt, "%.16llX", gui_fantom_lo );
		gtk_clist_set_text( GTK_CLIST(clRegHiLo), 1, 0, txt );
		gtk_clist_set_background( GTK_CLIST(clRegHiLo), 0, &color_modif);
	}
	else
		gtk_clist_set_background( GTK_CLIST(clRegHiLo), 1, &color_ident);

	gtk_clist_thaw( GTK_CLIST(clRegHiLo) );
}
Ejemplo n.º 2
0
void update_FGR()
{
    int i;
    char txt[24];

    gtk_clist_freeze( GTK_CLIST(clFGR) );
    for(i=0; i<32; i++) {
        if( gui_fantom_simple[i]!= *reg_cop1_simple[i] )
        {
            gui_fantom_simple[i] = *reg_cop1_simple[i];
            sprintf(txt, "%f", *reg_cop1_simple[i] );
            gtk_clist_set_text( GTK_CLIST(clFGR), i, 1, txt );
            gtk_clist_set_background( GTK_CLIST(clFGR), i, &color_modif);
        } else {
            gtk_clist_set_background( GTK_CLIST(clFGR), i, &color_ident);
        }
    }
    gtk_clist_thaw( GTK_CLIST(clFGR) );

    gtk_clist_freeze( GTK_CLIST(clFGR2) );
    for(i=0; i<32; i++) {
        if( gui_fantom_double[i]!=  *reg_cop1_double[i] )
        {
            gui_fantom_double[i] = *reg_cop1_double[i];
            sprintf(txt, "%f", *reg_cop1_double[i] );
            gtk_clist_set_text( GTK_CLIST(clFGR2), i, 1, txt );
            gtk_clist_set_background( GTK_CLIST(clFGR2), i, &color_modif);
        } else {
            gtk_clist_set_background( GTK_CLIST(clFGR2), i, &color_ident);
        }
    }
    gtk_clist_thaw( GTK_CLIST(clFGR2) );
}
Ejemplo n.º 3
0
void update_GPR()
{
	int i;
	char txt[24];

	gtk_clist_freeze( GTK_CLIST(clGPR) );
	
	for(i=0; i<32; i++)
	{
		// Les "registres fantomes" evitent de raffraichir l'affichage de chaque
		// registre. Seules les modifications sont affichees a l'ecran.
		if(gui_fantom_gpr[i]!=reg[i])
		{
			gui_fantom_gpr[i] = reg[i];
			sprintf(txt, "%.16llX", reg[i]);
			gtk_clist_set_text( GTK_CLIST(clGPR), i, 0, txt );
			gtk_clist_set_background( GTK_CLIST(clGPR), i, &color_modif);
		}
		else
		{
			gtk_clist_set_background( GTK_CLIST(clGPR), i, &color_ident);
		}
	}
	gtk_clist_thaw( GTK_CLIST(clGPR) );
}
Ejemplo n.º 4
0
/* This is called automatically when we recieve a drop */
static void
clist_drag_data_received(GtkWidget        *widget,
                         GdkDragContext   *context,
                         gint             x,
                         gint             y,
                         GtkSelectionData *data,
                         guint            drag_info,
                         guint            time,
                         FileView         *view)
{
  gint row, col;
  FileInfo *info;
  gchar dest_dir[PATH_MAX];

  gtk_clist_set_background(GTK_CLIST(view->clist), view->last_row,
                           &CLIST_COLOR);

  if (!gtk_clist_get_selection_info(GTK_CLIST(view->clist), x, y, &row, &col))
  {
    g_snprintf(dest_dir, sizeof(dest_dir), "%s/", view->dir);
  }
  else
  {
    info = gtk_clist_get_row_data(GTK_CLIST(view->clist), row);

    if (is_dir(info))
      g_snprintf(dest_dir, sizeof(dest_dir), "%s/%s/", view->dir, info->filename);
    else
      g_snprintf(dest_dir, sizeof(dest_dir), "%s/", view->dir);
  }

  create_drag_op_menu(dest_dir, (gchar *)data->data);
  gtk_drag_finish(context, FALSE, FALSE, time);
}
Ejemplo n.º 5
0
/* This function is called whenever we need to exchange curr_view and
 * other_view.
 */
static void
switch_views()
{
  gint i;
  gint num_cols;
  GtkStyle *style;
  FileView *temp;
  GList *tmp;

  temp = other_view;
  other_view = curr_view;
  curr_view = temp;

  gtk_signal_emit_by_name(GTK_OBJECT(other_view->clist), "end-selection");
  if (other_view->old_selection)
    g_list_free(other_view->old_selection);
  other_view->old_selection = g_list_copy(
                                GTK_CLIST(other_view->clist)->selection);
  for (tmp = other_view->old_selection; tmp != NULL; tmp = tmp->next)
    gtk_clist_set_background(GTK_CLIST(other_view->clist), (gint)tmp->data,
                             &SELECT_COLOR);
  for (tmp = curr_view->old_selection; tmp != NULL; tmp = tmp->next)
    gtk_clist_set_background(GTK_CLIST(curr_view->clist), (gint)tmp->data,
                             &CLIST_COLOR);

  gtk_clist_unselect_all(GTK_CLIST(other_view->clist));
  style = gtk_style_copy(gtk_widget_get_style(
                         GTK_CLIST(other_view->clist)->column[0].button));
  style->bg[GTK_STATE_NORMAL] = COL_COLOR;
  num_cols = GTK_CLIST(curr_view->clist)->columns;
  for (i = 0; i < num_cols; i++)
  {
    gtk_widget_set_style(GTK_CLIST(curr_view->clist)->column[i].button,
                         style);
    gtk_widget_set_style(curr_view->sort_arrows[i], style);
  }
  for (i = 0; i < num_cols; i++)
  {
    gtk_widget_restore_default_style(
          GTK_CLIST(other_view->clist)->column[i].button);
    gtk_widget_restore_default_style(other_view->sort_arrows[i]);
  }

  chdir(curr_view->dir);
}
Ejemplo n.º 6
0
static void
clist_drag_leave(GtkWidget         *widget,
                 GdkDragContext    *context,
                 guint             time,
                 FileView          *view)
{
  gtk_clist_set_background(GTK_CLIST(view->clist), view->last_row,
                           &CLIST_COLOR);
}
Ejemplo n.º 7
0
/* This handles the highlighting of the rows */
static gboolean
clist_drag_motion(GtkWidget         *widget,
                  GdkDragContext    *context,
                  gint              x,
                  gint              y,
                  guint             time,
                  FileView          *view)
{
  gint row, col;

  gtk_clist_set_background(GTK_CLIST(view->clist), view->last_row,
                           &CLIST_COLOR);

  if (gtk_clist_get_selection_info(GTK_CLIST(view->clist), x, y, &row, &col))
  {
    gtk_clist_set_background(GTK_CLIST(view->clist), row, &DRAG_HILIGHT);
    view->last_row = row;
  }
    
  return TRUE;  
}
Ejemplo n.º 8
0
void update_regSI()
{
	char txt[24];

	gtk_clist_freeze( GTK_CLIST(clRegSI) );

	if( gui_fantom_reg_SI[0] != si_register.si_dram_addr ) {
		gui_fantom_reg_SI[0] = si_register.si_dram_addr;
		sprintf( txt, "%.16lX", si_register.si_dram_addr);
		gtk_clist_set_text( GTK_CLIST(clRegSI), 0, 0, txt );
		gtk_clist_set_background( GTK_CLIST(clRegSI), 0, &color_modif);
	} else {
		gtk_clist_set_background( GTK_CLIST(clRegSI), 0, &color_ident);
	}

	if( gui_fantom_reg_SI[1] != si_register.si_pif_addr_rd64b )
	{
		gui_fantom_reg_SI[1] = si_register.si_pif_addr_rd64b;
		sprintf( txt, "%.16lX", si_register.si_pif_addr_rd64b);
		gtk_clist_set_text( GTK_CLIST(clRegSI), 1, 0, txt );
		gtk_clist_set_background( GTK_CLIST(clRegSI), 1, &color_modif);
	} else {
		gtk_clist_set_background( GTK_CLIST(clRegSI), 1, &color_ident);
	}

	if( gui_fantom_reg_SI[2] != si_register.si_pif_addr_wr64b )
	{
		gui_fantom_reg_SI[2] = si_register.si_pif_addr_wr64b;
		sprintf( txt, "%.16lX", si_register.si_pif_addr_wr64b);
		gtk_clist_set_text( GTK_CLIST(clRegSI), 2, 0, txt );
		gtk_clist_set_background( GTK_CLIST(clRegSI), 2, &color_modif);
	} else {
		gtk_clist_set_background( GTK_CLIST(clRegSI), 2, &color_ident);
	}


	if( gui_fantom_reg_SI[3] != si_register.si_stats )
	{
		gui_fantom_reg_SI[3] = si_register.si_stats;
		sprintf( txt, "%.16lX", si_register.si_stats );
		gtk_clist_set_text( GTK_CLIST(clRegSI), 3, 0, txt );
		gtk_clist_set_background( GTK_CLIST(clRegSI), 3, &color_modif);
	} else {
		gtk_clist_set_background( GTK_CLIST(clRegSI), 3, &color_ident);
	}

	gtk_clist_thaw( GTK_CLIST(clRegSI) );
}
Ejemplo n.º 9
0
void
toggle_tag_cb ()
{
  FileInfo *info = gtk_clist_get_row_data (GTK_CLIST (curr_view->clist),
					   curr_view->row);
  gint row = curr_view->row;

  if (g_list_find (curr_view->tagged, info) != NULL)
    {
      curr_view->tagged = g_list_remove (curr_view->tagged, info);
      gtk_clist_set_background (GTK_CLIST (curr_view->clist), row,
				&CLIST_COLOR);
			status_bar_message("File removed from tag list");
    }
  else
    {
      curr_view->tagged = g_list_append (curr_view->tagged, info);
			gtk_clist_unselect_all(GTK_CLIST(curr_view->clist));
      gtk_clist_set_background (GTK_CLIST (curr_view->clist), row,
				&TAG_COLOR);
			status_bar_message("File is tagged");
    }
}
Ejemplo n.º 10
0
void MedSLTDocWindow::SetHelpExamples(string& result)
{
	ACE_TRACE("[MedSLTDocWindow::SetHelpExamples()]");

	GdkColormap *colormap = gtk_widget_get_colormap(m_list);
	GdkColor color;
	
	// Get GTK thread lock
	gdk_threads_enter();
	
	string buffer("");
	
	m_list_items = 0;

	if ((m_back_translation != "") && (m_back_translation != "error."))
	{
		buffer = m_back_translation + "?";
		WrapText(buffer);
		gchar* item = g_strdup(buffer.c_str());
		gtk_clist_append((GtkCList*)m_list, &item);
		
		color.red = color_map[m_list_items][0];
		color.green = color_map[m_list_items][1];
		color.blue = color_map[m_list_items][2];
		gdk_color_alloc(colormap, &color);
		gtk_clist_set_background(GTK_CLIST(m_list), 0, &color);
					
		free(item);
		++m_list_items;
	}
	
	buffer = "";
	
	while (result.size() > 0)
	{
		SplitHelpExamples(result, buffer, "_");
		
		if ((buffer == "") || (buffer == "error."))
		{
			break;
		}
		
		if (buffer != m_back_translation)
		{
			buffer += "?";
			WrapText(buffer);
			gchar* item = g_strdup(buffer.c_str());
			gtk_clist_append((GtkCList*)m_list, &item);
			
			color.red = color_map[m_list_items][0];
			color.green = color_map[m_list_items][1];
			color.blue = color_map[m_list_items][2];
							
			gdk_color_alloc(colormap, &color);
			gtk_clist_set_background(GTK_CLIST(m_list), m_list_items, &color);	
							
			free(item);	
			++m_list_items;
			buffer = "";
			
			ACE_DEBUG((LM_DEBUG, ACE_TEXT("%I[DEBUG] [MedSLTDocWindow::SetHelpExamples()] "
					"[Ouput: %s]\n"), buffer.c_str()));	
			
		}
	}
	
	if (m_list_items != 0)
	{
		gtk_clist_select_row((GtkCList*)m_list, 0, 0);
		SetListIndex(0);
	}
		
	gdk_flush();
	
	// Release GTK thread lock
	gdk_threads_leave();
	
	return; 
}
Ejemplo n.º 11
0
MedSLTDocWindow::MedSLTDocWindow(MedSLTDocWindowObserver& observer)
	: 	m_observer(observer),
		m_list_index(0),
		m_list_items(0),
		m_is_fullscreen(FALSE),
		m_back_translation(""),
		m_ui_state(UI_STATE_DISCONNECTED),
		m_wrap_position(5)
{
	ACE_TRACE("[MedSLTDocWindow::MedSLTDocWindow()]");

	GtkBox*					hbox;
	GtkBox* 				coverbox;
	GtkBox* 				textbox;
	GtkBox* 				buthbox;
	GtkWidget* 				menu;
	GtkWidget* 				appimage;	
	GtkWidget*				scroll1;
	GtkWidget* 				scroll2;
	GtkWidget*				scroll3;
	PangoFontDescription*	font1;
	PangoFontDescription*	font2;
	//GtkStyle*				style;
	GtkAccelGroup*			accel = gtk_accel_group_new();

	// Window
#ifdef _MAEMO
	m_window = GTK_WINDOW(hildon_window_new());	
#else
	m_window = GTK_WINDOW(gtk_window_new(GTK_WINDOW_TOPLEVEL));
	gtk_window_set_default_size(m_window, 450, -1);
#endif
	
	gtk_window_add_accel_group(m_window, accel);	
	gtk_window_set_icon_from_file(m_window, app_icon, NULL);	
	gtk_container_set_border_width(GTK_CONTAINER(m_window), 5);
	
	// Boxes
	coverbox = GTK_BOX(gtk_vbox_new(False, 5));	
	hbox = GTK_BOX(gtk_hbox_new(False, 5));	
	textbox = GTK_BOX(gtk_vbox_new(False, 5));
	buthbox = GTK_BOX(gtk_vbox_new(False, 5));
			
	// Image
	appimage = gtk_image_new_from_file(app_icon_big);
	
	// Fonts	
	font1 = pango_font_description_from_string("Monospace Bold 21");
	font2 = pango_font_description_from_string("Monospace Bold 16");
	
	// Lists
	m_list = gtk_clist_new(1);
		 
	gtk_widget_set_size_request(GTK_WIDGET(m_list), 550, 180);
	
	gtk_clist_set_row_height((GtkCList*)m_list, 65);

	gtk_widget_modify_font(m_list, font1);
	
	gchar* text[3][1] = {	{"where is the pain?"},
								{"do you have fever?"},
								{"do you have headaches in\nthe morning?"}};
	
	gtk_clist_append((GtkCList*)m_list, text[0]);
	gtk_clist_append((GtkCList*)m_list, text[1]);
	gtk_clist_append((GtkCList*)m_list, text[2]);
	
	m_list_items = 3;
	
	GdkColormap *colormap;
	GdkColor color;
		
	colormap = gtk_widget_get_colormap(m_list);
	color.red = color_map[0][0];
	color.green = color_map[0][1];
	color.blue = color_map[0][2];
	gdk_color_alloc(colormap, &color);
	gtk_clist_set_background(GTK_CLIST(m_list), 0, &color);

	color.red = color_map[1][0];
	color.green = color_map[1][1];
	color.blue = color_map[1][2];
	gdk_color_alloc(colormap, &color);
	gtk_clist_set_background(GTK_CLIST(m_list), 1, &color);
	
	color.red = color_map[2][0];
	color.green = color_map[2][1];
	color.blue = color_map[2][2];
	gdk_color_alloc(colormap, &color);
	gtk_clist_set_background(GTK_CLIST(m_list), 2, &color);
		
	gtk_clist_select_row((GtkCList*)m_list, 0, 0);
	
	// Styles
	//style = gtk_style_new();
	//style->font_desc = font2;
	//gdk_color_parse("red", &(style->bg[GTK_STATE_NORMAL]));
	//gdk_color_parse ("green", &(style->bg[GTK_STATE_PRELIGHT]));
	//gdk_color_parse ("green", &(style->bg[GTK_STATE_ACTIVE]));
		
	// Text Boxes
	m_txtbox1 = gtk_text_view_new();
			
	gtk_widget_modify_font(m_txtbox1, font1);
		
	gtk_widget_set_size_request(GTK_WIDGET(m_txtbox1), 550, 20);
		
	gtk_text_view_set_editable(GTK_TEXT_VIEW(m_txtbox1), false);
		
	gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(m_txtbox1), GTK_WRAP_WORD_CHAR);
	
	color.red = color_map[3][0];
	color.green = color_map[3][1];
	color.blue = color_map[3][2];
	
	gtk_widget_modify_base(GTK_WIDGET(m_txtbox1), GTK_STATE_NORMAL, &color);
	//gtk_widget_modify_fg(GTK_WIDGET(m_txtbox1), GTK_STATE_NORMAL, &color);
	
 	//gtk_widget_set_style(GTK_WIDGET(m_txtbox1), style);
	
	m_txtbox2 = gtk_text_view_new();
				
	gtk_widget_modify_font(m_txtbox2, font1);
			
	gtk_widget_set_size_request(GTK_WIDGET(m_txtbox2), 550, 20);
			
	gtk_text_view_set_editable(GTK_TEXT_VIEW(m_txtbox2), false);
			
	gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(m_txtbox2), GTK_WRAP_WORD_CHAR);
		
	// Scroll bars
	scroll1 = gtk_scrolled_window_new(NULL, NULL);
	scroll2 = gtk_scrolled_window_new(NULL, NULL);
	scroll3 = gtk_scrolled_window_new(NULL, NULL);
	
	gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scroll1), GTK_POLICY_ALWAYS, GTK_POLICY_ALWAYS);
	gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scroll2), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
	gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scroll3), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
	
	gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scroll1), GTK_SHADOW_IN);
	gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scroll2), GTK_SHADOW_IN);
	gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scroll3), GTK_SHADOW_IN);
	
	gtk_container_add(GTK_CONTAINER(scroll1), GTK_WIDGET(m_list));
	gtk_container_add(GTK_CONTAINER(scroll2), GTK_WIDGET(m_txtbox1));
	gtk_container_add(GTK_CONTAINER(scroll3), GTK_WIDGET(m_txtbox2));
			
	// Text labels
	m_understood = gtk_label_new("Understood");
	m_response = gtk_label_new("Response");
	m_translation = gtk_label_new("Translation");

	gtk_widget_modify_font(m_understood, font2);
	gtk_widget_modify_font(m_response, font2);
	gtk_widget_modify_font(m_translation, font2);
	
	gtk_label_set_justify(GTK_LABEL(m_understood), GTK_JUSTIFY_LEFT);
	gtk_label_set_justify(GTK_LABEL(m_response), GTK_JUSTIFY_LEFT);
	gtk_label_set_justify(GTK_LABEL(m_translation), GTK_JUSTIFY_LEFT);
		
	gtk_label_set_ellipsize(GTK_LABEL(m_understood), PANGO_ELLIPSIZE_END);	
	gtk_label_set_ellipsize(GTK_LABEL(m_response), PANGO_ELLIPSIZE_END);
	gtk_label_set_ellipsize(GTK_LABEL(m_translation), PANGO_ELLIPSIZE_END);
		
	// Buttons
	m_rec = gtk_button_new();
	m_speech = gtk_button_new();
	m_abort = gtk_button_new();
	m_up = gtk_button_new();
	m_select = gtk_button_new();
	m_down = gtk_button_new();
	
	gtk_button_set_image(GTK_BUTTON(m_rec),
							gtk_image_new_from_file(record_icon));
	gtk_button_set_image(GTK_BUTTON(m_speech),
									gtk_image_new_from_file(speech_icon));
	gtk_button_set_image(GTK_BUTTON(m_abort),
							gtk_image_new_from_file(stop_icon));
	gtk_button_set_image(GTK_BUTTON(m_up),
							gtk_image_new_from_file(up_icon));
	gtk_button_set_image(GTK_BUTTON(m_select),
							gtk_image_new_from_file(select_icon));
	gtk_button_set_image(GTK_BUTTON(m_down),
							gtk_image_new_from_file(down_icon));

	// Menu
	// Recheck: Is it destroyed somewhere
	menu = CreateMenu(accel);
	
	// Progress bar
	m_progressbar = gtk_progress_bar_new();
	gtk_progress_set_text_alignment(GTK_PROGRESS(m_progressbar),
									0.5, 0.5);
	gtk_widget_set_size_request(GTK_WIDGET(m_progressbar), 150, 50);	
	//gtk_container_add(GTK_CONTAINER(m_window), GTK_WIDGET(vbox));	
		
	gtk_box_pack_start(textbox, m_understood, TRUE, TRUE, 0);
	gtk_box_pack_start(textbox, scroll1, TRUE, TRUE, 0);
	gtk_box_pack_start(textbox, m_response, TRUE, TRUE, 0);
	gtk_box_pack_start(textbox, scroll2, TRUE, TRUE, 0);
	gtk_box_pack_start(textbox, m_translation, TRUE, TRUE, 0);
	gtk_box_pack_start(textbox, scroll3, TRUE, TRUE, 0);
	
	gtk_box_pack_start(buthbox, m_rec, TRUE, TRUE, 0);
	gtk_box_pack_start(buthbox, m_speech, TRUE, TRUE, 0);
	gtk_box_pack_start(buthbox, m_abort, TRUE, TRUE, 0);
	gtk_box_pack_start(buthbox, m_up, TRUE, TRUE, 0);
	gtk_box_pack_start(buthbox, m_select, TRUE, TRUE, 0);
	gtk_box_pack_start(buthbox, m_down, TRUE, TRUE, 0);
	
	gtk_box_pack_start(hbox, GTK_WIDGET(textbox), TRUE, TRUE, 0);
	gtk_box_pack_start(hbox, GTK_WIDGET(buthbox), TRUE, TRUE, 0);
	
	gtk_box_pack_start(coverbox, GTK_WIDGET(hbox), TRUE, TRUE, 0);
	//gtk_box_pack_start(coverbox, m_progressbar, TRUE, TRUE, 0);
		
	gtk_container_add(GTK_CONTAINER(m_window), GTK_WIDGET(coverbox));
	
#ifdef _MAEMO
	hildon_window_set_menu(HILDON_WINDOW(m_window), GTK_MENU(menu));	
#else
	gtk_box_pack_start(vbox, menu, FALSE, FALSE, 0);
#endif

	// Signals
	g_signal_connect(G_OBJECT(m_rec), "clicked", 
						G_CALLBACK(RecognizeClicked), this);
	g_signal_connect(G_OBJECT(m_speech), "clicked",
							G_CALLBACK(AbortClicked), this);
	g_signal_connect(G_OBJECT(m_abort), "clicked",
						G_CALLBACK(AbortClicked), this);
	g_signal_connect(G_OBJECT(m_up), "clicked",
						G_CALLBACK(UpClicked), this);
	g_signal_connect(G_OBJECT(m_select), "clicked",
						G_CALLBACK(SelectClicked), this);
	g_signal_connect(G_OBJECT(m_down), "clicked",
						G_CALLBACK(DownClicked), this);
	g_signal_connect(G_OBJECT(m_list), "select_row",
						G_CALLBACK(ListRowSelected), this);
	g_signal_connect(G_OBJECT(m_window), "destroy",
						G_CALLBACK(CloseApp), this);
	g_signal_connect(G_OBJECT(m_window), "delete_event",
						G_CALLBACK(CloseApp), this);

	// Shortcuts
#ifndef _MAEMO
	gtk_widget_add_accelerator(m_rec, "clicked", accel, GDK_space,
								0, 0);
	gtk_widget_add_accelerator(m_speech, "clicked", accel, GDK_space,
									0, 0);
	gtk_widget_add_accelerator(m_abort, "clicked", accel, GDK_space,
								0, 0);
	gtk_widget_add_accelerator(m_next, "clicked", accel, GDK_Right,
								GDK_CONTROL_MASK, 0);
#endif

	// Initial state
	SetUiState(UI_STATE_DISCONNECTED);
	
	return;
}
Ejemplo n.º 12
0
void update_regVI()
{
	//TODO: To be rewritten.
	char txt[24];

	gtk_clist_freeze( GTK_CLIST(clRegVI) );

	if( gui_fantom_reg_VI[0] != vi_register.vi_status )
	{
		gui_fantom_reg_VI[0] = vi_register.vi_status;
		sprintf( txt, "%.16lX", vi_register.vi_status );
		gtk_clist_set_text( GTK_CLIST(clRegVI), 0, 0, txt );
		gtk_clist_set_background( GTK_CLIST(clRegVI), 0, &color_modif);
	} else {
		gtk_clist_set_background( GTK_CLIST(clRegVI), 0, &color_ident);
	}

	if( gui_fantom_reg_VI[1] != vi_register.vi_origin )
	{
		gui_fantom_reg_VI[1] = vi_register.vi_origin;
		sprintf( txt, "%.16lX", vi_register.vi_origin );
		gtk_clist_set_text( GTK_CLIST(clRegVI), 1, 0, txt );
		gtk_clist_set_background( GTK_CLIST(clRegVI), 1, &color_modif);
	} else {
		gtk_clist_set_background( GTK_CLIST(clRegVI), 1, &color_ident);
	}

	if( gui_fantom_reg_VI[2] != vi_register.vi_width )
	{
		gui_fantom_reg_VI[2] = vi_register.vi_width;
		sprintf( txt, "%.16lX", vi_register.vi_width );
		gtk_clist_set_text( GTK_CLIST(clRegVI), 2, 0, txt );
		gtk_clist_set_background( GTK_CLIST(clRegVI), 2, &color_modif);
	} else {
		gtk_clist_set_background( GTK_CLIST(clRegVI), 2, &color_ident);
	}

	if( gui_fantom_reg_VI[3] != vi_register.vi_v_intr )
	{
		gui_fantom_reg_VI[3] = vi_register.vi_v_intr;
		sprintf( txt, "%.16lX", vi_register.vi_v_intr );
		gtk_clist_set_text( GTK_CLIST(clRegVI), 3, 0, txt );
		gtk_clist_set_background( GTK_CLIST(clRegVI), 3, &color_modif);
	} else {
		gtk_clist_set_background( GTK_CLIST(clRegVI), 3, &color_ident);
	}

	if( gui_fantom_reg_VI[4] != (uint32) vi_register.vi_current )
	{
		gui_fantom_reg_VI[4] = vi_register.vi_current;
		sprintf( txt, "%.16lX", vi_register.vi_current );
		gtk_clist_set_text( GTK_CLIST(clRegVI), 4, 0, txt );
		gtk_clist_set_background( GTK_CLIST(clRegVI), 4, &color_modif);
	} else {
		gtk_clist_set_background( GTK_CLIST(clRegVI), 4, &color_ident);
	}

	if( gui_fantom_reg_VI[5] != (uint32) vi_register.vi_burst )
	{
		gui_fantom_reg_VI[5] = vi_register.vi_burst;
		sprintf( txt, "%.16lX", vi_register.vi_burst );
		gtk_clist_set_text( GTK_CLIST(clRegVI), 5, 0, txt );
		gtk_clist_set_background( GTK_CLIST(clRegVI), 5, &color_modif);
	} else {
		gtk_clist_set_background( GTK_CLIST(clRegVI), 5, &color_ident);
	}
	
	if( gui_fantom_reg_VI[6] != (uint32) vi_register.vi_v_sync )
	{
		gui_fantom_reg_VI[6] = vi_register.vi_v_sync;
		sprintf( txt, "%.16lX", vi_register.vi_v_sync );
		gtk_clist_set_text( GTK_CLIST(clRegVI), 6, 0, txt );
		gtk_clist_set_background( GTK_CLIST(clRegVI), 6, &color_modif);
	} else {
		gtk_clist_set_background( GTK_CLIST(clRegVI), 6, &color_ident);
	}

	if( gui_fantom_reg_VI[7] != (uint32) vi_register.vi_h_sync )
	{
		gui_fantom_reg_VI[7] = vi_register.vi_h_sync;
		sprintf( txt, "%.16lX", vi_register.vi_h_sync );
		gtk_clist_set_text( GTK_CLIST(clRegVI), 7, 0, txt );
		gtk_clist_set_background( GTK_CLIST(clRegVI), 7, &color_modif);
	} else {
		gtk_clist_set_background( GTK_CLIST(clRegVI), 7, &color_ident);
	}

	if( gui_fantom_reg_VI[8] != (uint32) vi_register.vi_leap )
	{
		gui_fantom_reg_VI[8] = vi_register.vi_leap;
		sprintf( txt, "%.16lX", vi_register.vi_leap );
		gtk_clist_set_text( GTK_CLIST(clRegVI), 8, 0, txt );
		gtk_clist_set_background( GTK_CLIST(clRegVI), 8, &color_modif);
	} else {
		gtk_clist_set_background( GTK_CLIST(clRegVI), 8, &color_ident);
	}

	if( gui_fantom_reg_VI[9] != (uint32) vi_register.vi_h_start )
	{
		gui_fantom_reg_VI[9] = vi_register.vi_h_start;
		sprintf( txt, "%.16lX", vi_register.vi_h_start );
		gtk_clist_set_text( GTK_CLIST(clRegVI), 9, 0, txt );
		gtk_clist_set_background( GTK_CLIST(clRegVI), 9, &color_modif);
	} else {
		gtk_clist_set_background( GTK_CLIST(clRegVI), 9, &color_ident);
	}

	if( gui_fantom_reg_VI[10] != (uint32) vi_register.vi_v_start )
	{
		gui_fantom_reg_VI[10] = vi_register.vi_v_start;
		sprintf( txt, "%.16lX", vi_register.vi_v_start );
		gtk_clist_set_text( GTK_CLIST(clRegVI), 10, 0, txt );
		gtk_clist_set_background( GTK_CLIST(clRegVI), 10, &color_modif);
	} else {
		gtk_clist_set_background( GTK_CLIST(clRegVI), 10, &color_ident);
	}

	if( gui_fantom_reg_VI[11] != (uint32) vi_register.vi_v_burst )
	{
		gui_fantom_reg_VI[11] = vi_register.vi_v_burst;
		sprintf( txt, "%.16lX", vi_register.vi_v_burst );
		gtk_clist_set_text( GTK_CLIST(clRegVI), 11, 0, txt );
		gtk_clist_set_background( GTK_CLIST(clRegVI), 11, &color_modif);
	} else {
		gtk_clist_set_background( GTK_CLIST(clRegVI), 11, &color_ident);
	}

	if( gui_fantom_reg_VI[12] != (uint32) vi_register.vi_x_scale )
	{
		gui_fantom_reg_VI[12] = vi_register.vi_x_scale;
		sprintf( txt, "%.16lX", vi_register.vi_x_scale);
		gtk_clist_set_text( GTK_CLIST(clRegVI), 12, 0, txt );
		gtk_clist_set_background( GTK_CLIST(clRegVI), 12, &color_modif);
	} else {
		gtk_clist_set_background( GTK_CLIST(clRegVI), 12, &color_ident);
	}

	if( gui_fantom_reg_VI[13] != (uint32) vi_register.vi_y_scale )
	{
		gui_fantom_reg_VI[13] = vi_register.vi_y_scale;
		sprintf( txt, "%.16lX", vi_register.vi_y_scale);
		gtk_clist_set_text( GTK_CLIST(clRegVI), 13, 0, txt );
		gtk_clist_set_background( GTK_CLIST(clRegVI), 13, &color_modif);
	} else {
		gtk_clist_set_background( GTK_CLIST(clRegVI), 13, &color_ident);
	}

	if( gui_fantom_reg_VI[14] != rdram[0x300/4] )
	{
		gui_fantom_reg_VI[14] = rdram[0x300/4];
		sprintf( txt, "%.16lX", rdram[0x300/4] );
		gtk_clist_set_text( GTK_CLIST(clRegVI), 14, 0, txt );
		gtk_clist_set_background( GTK_CLIST(clRegVI), 14, &color_modif);
	} else {
		gtk_clist_set_background( GTK_CLIST(clRegVI), 14, &color_ident);
	}

	gtk_clist_thaw( GTK_CLIST(clRegVI) );
}
Ejemplo n.º 13
0
void update_TLB()
{
    int i;
    char **txt;
    txt=malloc( 19*sizeof(char*) );
    for(i=0; i<19; i++)
        txt[i]=malloc( 64*sizeof(char) );


    gtk_clist_freeze( GTK_CLIST(clTLBentries) );

    for( i=0; i<32; i++)
    {
        if( (gui_fantom_tlb_entry[i].mask != tlb_e[i].mask)	||
                (gui_fantom_tlb_entry[i].vpn2 != tlb_e[i].vpn2)	||
                (gui_fantom_tlb_entry[i].g != tlb_e[i].g)		||
                (gui_fantom_tlb_entry[i].asid != tlb_e[i].asid)	||
                (gui_fantom_tlb_entry[i].pfn_even != tlb_e[i].pfn_even) ||
                (gui_fantom_tlb_entry[i].c_even != tlb_e[i].c_even) ||
                (gui_fantom_tlb_entry[i].d_even != tlb_e[i].d_even) ||
                (gui_fantom_tlb_entry[i].v_even != tlb_e[i].v_even) ||
                (gui_fantom_tlb_entry[i].pfn_odd != tlb_e[i].pfn_odd)	||
                (gui_fantom_tlb_entry[i].c_odd != tlb_e[i].c_odd)	||
                (gui_fantom_tlb_entry[i].d_odd != tlb_e[i].d_odd)	||
                (gui_fantom_tlb_entry[i].v_odd != tlb_e[i].v_odd)	||
                (gui_fantom_tlb_entry[i].r != tlb_e[i].r)		||
                (gui_fantom_tlb_entry[i].start_even != tlb_e[i].start_even) ||
                (gui_fantom_tlb_entry[i].end_even != tlb_e[i].end_even)     ||
                (gui_fantom_tlb_entry[i].phys_even != tlb_e[i].phys_even)   ||
                (gui_fantom_tlb_entry[i].start_odd != tlb_e[i].start_odd)   ||
                (gui_fantom_tlb_entry[i].end_odd != tlb_e[i].end_odd)	     ||
                (gui_fantom_tlb_entry[i].phys_odd != tlb_e[i].phys_odd) )
        {
            gtk_clist_remove( GTK_CLIST(clTLBentries), i);

            gui_fantom_tlb_entry[i].mask	= tlb_e[i].mask;
            sprintf( txt[0], "%hX", tlb_e[i].mask);
            gui_fantom_tlb_entry[i].vpn2	= tlb_e[i].vpn2;
            sprintf( txt[1], "%lX", tlb_e[i].vpn2);
            gui_fantom_tlb_entry[i].g	= tlb_e[i].g;
            sprintf( txt[2], "%hhX", tlb_e[i].g);
            gui_fantom_tlb_entry[i].asid	= tlb_e[i].asid;
            sprintf( txt[3], "%hhX", tlb_e[i].asid);
            gui_fantom_tlb_entry[i].pfn_even= tlb_e[i].pfn_even;
            sprintf( txt[4], "%lX", tlb_e[i].pfn_even);
            gui_fantom_tlb_entry[i].c_even	= tlb_e[i].c_even;
            sprintf( txt[5], "%hhX", tlb_e[i].c_even);
            gui_fantom_tlb_entry[i].d_even	= tlb_e[i].d_even;
            sprintf( txt[6], "%hhX", tlb_e[i].d_even);
            gui_fantom_tlb_entry[i].v_even	= tlb_e[i].v_even;
            sprintf( txt[7], "%hhX", tlb_e[i].v_even);
            gui_fantom_tlb_entry[i].pfn_odd	= tlb_e[i].pfn_odd;
            sprintf( txt[8], "%lX", tlb_e[i].pfn_odd);
            gui_fantom_tlb_entry[i].c_odd	= tlb_e[i].c_odd;
            sprintf( txt[9], "%hhX", tlb_e[i].c_odd);
            gui_fantom_tlb_entry[i].d_odd	= tlb_e[i].d_odd;
            sprintf( txt[10], "%hhX", tlb_e[i].d_odd);
            gui_fantom_tlb_entry[i].v_odd	= tlb_e[i].v_odd;
            sprintf( txt[11], "%hhX", tlb_e[i].v_odd);
            gui_fantom_tlb_entry[i].r	= tlb_e[i].r;
            sprintf( txt[12], "%hhX", tlb_e[i].r);
            //gui_fantom_tlb_entry[i].check_parity_mask = tlb_e[i].check_parity_mask; NOT USED?

            gui_fantom_tlb_entry[i].start_even = tlb_e[i].start_even;
            sprintf( txt[13], "%lX", tlb_e[i].start_even);
            gui_fantom_tlb_entry[i].end_even   = tlb_e[i].end_even;
            sprintf( txt[14], "%lX", tlb_e[i].end_even);
            gui_fantom_tlb_entry[i].phys_even  = tlb_e[i].phys_even;
            sprintf( txt[15], "%lX", tlb_e[i].phys_even);
            gui_fantom_tlb_entry[i].start_odd  = tlb_e[i].start_odd;
            sprintf( txt[16], "%lX", tlb_e[i].start_odd);
            gui_fantom_tlb_entry[i].end_odd    = tlb_e[i].end_odd;
            sprintf( txt[17], "%lX", tlb_e[i].end_odd);
            gui_fantom_tlb_entry[i].phys_odd   = tlb_e[i].phys_odd;
            sprintf( txt[18], "%lX", tlb_e[i].phys_odd);

            gtk_clist_insert( GTK_CLIST(clTLBentries), i, txt);
            gtk_clist_set_background( GTK_CLIST(clTLBentries), i, &color_modif);
        }
        else
            gtk_clist_set_background( GTK_CLIST(clTLBentries), i, &color_ident);
    }

    gtk_clist_thaw( GTK_CLIST(clTLBentries) );
}
Ejemplo n.º 14
0
void    zapzaktaxi(class lzaktaxi_data *data)
{

class iceb_clock skur(data->window);
char  bros[300];
char  strsql[300];
SQL_str  row,row1;
int    kolstr=0;
const short DLINNA=500;
gchar *stroka[KOLTITL];
int   i=0;

data->metkavz=0;

//gdk_window_set_cursor(data->scrolled_window->window,gdk_cursor_new(ICEB_CURSOR_GDITE));
gtk_clist_clear(GTK_CLIST(data->list));

for(i=0 ; i < KOLTITL; i++)
 stroka[i]=new gchar[DLINNA];

//Формируем запрос к базе данных
zapros(strsql,data);


if((kolstr=data->cur.make_cursor(&bd,strsql)) < 0)
 {
  gdk_window_set_cursor(data->scrolled_window->window,gdk_cursor_new(ICEB_CURSOR));
  iceb_msql_error(&bd,gettext("Ошибка создания курсора !"),strsql,data->window);
  return;
 }
data->kolzap=0;
short nomstr=0;
char gosnomer[40];
SQLCURSOR cur1;
int nom_row=0;
while(data->cur.read_cursor(&row) != 0)
 {
  
  if(lzaktaxi_prov_row(row,data) != 0)
   continue;

  nomstr=0;
  //Метка не выполненного заказа
  memset(stroka[nomstr],'\0',sizeof(DLINNA));
  nom_row=0;
  if(row[0][0] == '0')
   {
    strcpy(stroka[nomstr],"?");  
    nom_row=1;
   }  

  //Дата и время заказа
  nomstr++;
  memset(stroka[nomstr],'\0',sizeof(DLINNA));
  sprintf(stroka[nomstr],"%s %s",iceb_u_datzap(row[6]),row[7]);

  nomstr++;
  //Адрес подачи
  memset(stroka[nomstr],'\0',sizeof(DLINNA));
  strncpy(stroka[nomstr],iceb_u_toutf(row[10]),DLINNA-1);

  nomstr++;
  //Куда ехать
  memset(stroka[nomstr],'\0',sizeof(DLINNA));
  strncpy(stroka[nomstr],iceb_u_toutf(row[11]),DLINNA-1);

  nomstr++;
  //Телефон  
  memset(stroka[nomstr],'\0',sizeof(DLINNA));
  strncpy(stroka[nomstr],iceb_u_toutf(row[4]),DLINNA-1);


  nomstr++;
  //Код клиента
  memset(stroka[nomstr],'\0',sizeof(DLINNA));
  strncpy(stroka[nomstr],iceb_u_toutf(row[1]),DLINNA-1);

  nomstr++;
  //Водитель
  memset(gosnomer,'\0',sizeof(gosnomer));
  memset(stroka[nomstr],'\0',sizeof(DLINNA));
  if(row[2][0] != '\0')
   {
    memset(bros,'\0',sizeof(bros));
    sprintf(strsql,"select fio,gosn from Taxivod where kod='%s'",row[2]);
    if(sql_readkey(&bd,strsql,&row1,&cur1) == 1)
     {
      strncpy(bros,row1[0],sizeof(bros)-1);
      strncpy(gosnomer,row1[1],sizeof(gosnomer)-1);
     }
    sprintf(strsql,"%s %s",row[2],bros);
    strncpy(stroka[nomstr],iceb_u_toutf(strsql),DLINNA-1);
   }
  else
   strncpy(stroka[nomstr],"",DLINNA-1);

  nomstr++;
  //Гос.номер автомобиля
  memset(stroka[nomstr],'\0',sizeof(DLINNA));
  if(row[2][0] != '\0')
   {
    strncpy(stroka[nomstr],iceb_u_toutf(gosnomer),DLINNA-1);
   }

  nomstr++;
  //Код завершения
  memset(stroka[nomstr],'\0',sizeof(DLINNA));
  if(atoi(row[0]) != 0)
   { 
    memset(bros,'\0',sizeof(bros));
    sprintf(strsql,"select naik from Taxikzz where kod=%s",row[0]);
//    printf("%s\n",strsql);
    if(sql_readkey(&bd,strsql,&row1,&cur1) == 1)
     strncpy(bros,row1[0],sizeof(bros)-1);
   
    strncpy(stroka[nomstr],iceb_u_toutf(bros),DLINNA-1);
   }
  else
    strncpy(stroka[nomstr],"",DLINNA-1);


  nomstr++;
  //Количество пассажиров
  memset(stroka[nomstr],'\0',sizeof(DLINNA));
  strncpy(stroka[nomstr],row[5],DLINNA-1);

  nomstr++;
  //Коментарий
  memset(stroka[nomstr],'\0',sizeof(DLINNA));
  strncpy(stroka[nomstr],iceb_u_toutf(row[12]),DLINNA-1);


  nomstr++;
  //Фамилия
  memset(stroka[nomstr],'\0',sizeof(DLINNA));
  strncpy(stroka[nomstr],iceb_u_toutf(row[3]),DLINNA-1);

  nomstr++;
  //Сумма
  memset(stroka[nomstr],'\0',sizeof(DLINNA));
  strncpy(stroka[nomstr],row[13],DLINNA-1);



  nomstr++;
  //Дата и время заказа
  memset(stroka[nomstr],'\0',sizeof(DLINNA));
  sprintf(stroka[nomstr],"%s %s",iceb_u_datzap(row[8]),row[9]);


  nomstr++;
  //Дата и время установки отметки завершения
  memset(stroka[nomstr],'\0',sizeof(DLINNA));
  strncpy(stroka[nomstr],iceb_u_vremzap(row[14]),DLINNA-1);


  nomstr++;
  //Дата и время записи
  memset(stroka[nomstr],'\0',sizeof(DLINNA));
  strncpy(stroka[nomstr],iceb_u_vremzap(row[16]),DLINNA-1);


  nomstr++;
  //Оператор
  memset(stroka[nomstr],'\0',sizeof(DLINNA));
  strncpy(stroka[nomstr],iceb_u_kszap(row[15],0),DLINNA-1);

    
  gtk_clist_append((GtkCList *)data->list,stroka);

  gtk_clist_set_row_data((GtkCList *)data-> list,data->kolzap++,row);
  if(nom_row == 1)
   {
   
    if(prov_zak_time(row[6],row[7],1800) == 0)
     gtk_clist_set_background((GtkCList *)data->list,data->kolzap-1,&data->color_red);
    else
     gtk_clist_set_background((GtkCList *)data->list,data->kolzap-1,&data->color_blue);
   }
 }

gtk_widget_set_sensitive(GTK_WIDGET(data->knopka[FK2]),TRUE);//доступна
gtk_widget_set_sensitive(GTK_WIDGET(data->knopka[SFK2]),FALSE);//Недоступна
gtk_widget_set_sensitive(GTK_WIDGET(data->knopka[FK3]),FALSE);//Недоступна
gtk_widget_set_sensitive(GTK_WIDGET(data->knopka[FK6]),FALSE);//Недоступна
gtk_widget_set_sensitive(GTK_WIDGET(data->knopka[FK4]),TRUE);//доступна

//gdk_window_set_cursor(data->scrolled_window->window,gdk_cursor_new(ICEB_CURSOR));

sprintf(bros,"К/з: %d",data->kolzap);

gtk_label_set_text(GTK_LABEL(data->labelkz),iceb_u_toutf(bros));

//printf("zapzaktaxi-fine\n");

}