コード例 #1
0
ファイル: revise.cpp プロジェクト: tamsuiboy/reciteword-osx
tViewer::tViewer ()
{
	rw_cfg_read_int (usercfgfile, "revise_skim", "word_show_time", &w_show_time);
	if (w_show_time <= 0)
		w_show_time = 1000; // 1 seconds.
	rw_cfg_read_int (usercfgfile, "revise_skim", "meaning_show_time", &m_show_time);
	if (m_show_time <= 0)
		m_show_time = 2000; // 2 seconds.
}
コード例 #2
0
ファイル: revise.cpp プロジェクト: tamsuiboy/reciteword-osx
static void
on_revise_group_plane_clicked (gpointer data)
{
	glong index = (glong) data;
	gint zu_index = g_pReciteWord->revise_group->revise_zu_index[index];

	gint i, tmpint, last_zu_wordcount = 25, now_wordcount = 0;
	gchar tmpstr[256];
	for (i = 0; i <= zu_index; i++)
	{
		sprintf (tmpstr, "zu%d_wordcount", i);
		if (rw_cfg_read_int
		    (usercfgfile, g_pReciteWord->now_book->bookfilename,
		     tmpstr, &tmpint))
			last_zu_wordcount = tmpint;
		now_wordcount += last_zu_wordcount;
	}
	now_wordcount -= last_zu_wordcount;

	g_pReciteWord->set_now_zu_words(zu_index,last_zu_wordcount,
					g_pReciteWord->now_book->words.w + now_wordcount,
					g_pReciteWord->now_book->words.t + now_wordcount,
					g_pReciteWord->now_book->words.m + now_wordcount,
					g_pReciteWord->revise_group->order_ckbutton.status);
	g_pReciteWord->revise_group->close ();
	g_pReciteWord->ShowRevise_test ();
}
コード例 #3
0
ファイル: revise.cpp プロジェクト: tamsuiboy/reciteword-osx
CRevise_group::CRevise_group ()
{
	skin_load_revise_group (g_pReciteWord->window);
	rw_cfg_read_int (usercfgfile, "revise_group", "max_revise_times", &max_revise_times);
	if (max_revise_times==0)
		max_revise_times=6;
}
コード例 #4
0
ファイル: option.cpp プロジェクト: tamsuiboy/reciteword-osx
static gboolean 
rw_preferences_dialog_setup_revise_test_page(GtkNotebook *nb, COption *parent)
{
	GtkWidget *vbox, *hbox, *label, *check_button, *spin_button;
	vbox = gtk_vbox_new(false,18);
	label=gtk_label_new(_("The revise_test's settings."));
	gtk_misc_set_alignment (GTK_MISC (label), 0, .5);
	gtk_box_pack_start(GTK_BOX(vbox),label,false,false,0);
	check_button = gtk_check_button_new_with_label(_("Read word when answer is right."));
	gboolean b;
	rw_cfg_read_boolean (usercfgfile, "revise_test", "readword_when_answerright", &b);
	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check_button),b);
	g_signal_connect (G_OBJECT (check_button), "toggled", G_CALLBACK (on_setup_revise_test_ckbutton_toggled), (gpointer)parent);
	gtk_box_pack_start(GTK_BOX(vbox),check_button,false,false,0);
	hbox= gtk_hbox_new(false,6);
	label=gtk_label_new(_("Show"));
	gtk_box_pack_start(GTK_BOX(hbox),label,false,false,0);
	gint i;
	rw_cfg_read_int (usercfgfile, "revise_test", "headchar_len", &i);
	if (i<=0)
		i=2;
	spin_button = gtk_spin_button_new_with_range(1,5,1);
	gtk_spin_button_set_value(GTK_SPIN_BUTTON(spin_button),i);
	g_signal_connect (G_OBJECT (spin_button), "value-changed", G_CALLBACK (on_setup_revise_test_spinbutton_changed), (gpointer)parent);
	gtk_box_pack_start(GTK_BOX(hbox),spin_button,false,false,0);
	label=gtk_label_new(_("chars as the head-char.(default:2)"));
	gtk_box_pack_start(GTK_BOX(hbox),label,false,false,0);
	gtk_box_pack_start(GTK_BOX(vbox),hbox,false,false,0);
	gtk_notebook_append_page(nb,vbox,NULL);
	return true;
}
コード例 #5
0
ファイル: option.cpp プロジェクト: tamsuiboy/reciteword-osx
static gboolean 
rw_preferences_dialog_setup_firstrecite_skim_page(GtkNotebook *nb, COption *parent)
{
	GtkWidget *vbox, *hbox, *label, *spin_button;
	vbox = gtk_vbox_new(false,18);
	label=gtk_label_new(_("The Firstrecite_skim's settings."));
	gtk_misc_set_alignment (GTK_MISC (label), 0, .5);
	gtk_box_pack_start(GTK_BOX(vbox),label,false,false,0);
	hbox= gtk_hbox_new(false,6);
	label=gtk_label_new(_("Wait"));
	gtk_box_pack_start(GTK_BOX(hbox),label,false,false,0);
	gint i;
	rw_cfg_read_int (usercfgfile, "firstrecite_skim", "wait_time", &i);
	if (i<=0)
		i=4000;
	spin_button = gtk_spin_button_new_with_range(1000,20000,500);
	gtk_spin_button_set_value(GTK_SPIN_BUTTON(spin_button),i);
	g_signal_connect (G_OBJECT (spin_button), "value-changed", G_CALLBACK (on_setup_firstrecite_skim_spinbutton_changed), (gpointer)parent);
	gtk_box_pack_start(GTK_BOX(hbox),spin_button,false,false,0);
	label=gtk_label_new(_("milliseconds for echo word.(default:4000)"));
	gtk_box_pack_start(GTK_BOX(hbox),label,false,false,0);
	gtk_box_pack_start(GTK_BOX(vbox),hbox,false,false,0);
	gtk_notebook_append_page(nb,vbox,NULL);
	return true;
}
コード例 #6
0
ファイル: option.cpp プロジェクト: tamsuiboy/reciteword-osx
static gboolean 
rw_preferences_dialog_setup_revise_group_page(GtkNotebook *nb, COption *parent)
{
	GtkWidget *vbox, *hbox, *label, *spin_button;
	vbox = gtk_vbox_new(false,18);
	label=gtk_label_new(_("The revise_group's settings."));
	gtk_misc_set_alignment (GTK_MISC (label), 0, .5);
	gtk_box_pack_start(GTK_BOX(vbox),label,false,false,0);
	hbox= gtk_hbox_new(false,6);
	label=gtk_label_new(_("Revise"));
	gtk_box_pack_start(GTK_BOX(hbox),label,false,false,0);
	gint i;
	rw_cfg_read_int (usercfgfile, "revise_group", "max_revise_times", &i);
	if (i==0)
		i=6;
	spin_button = gtk_spin_button_new_with_range(1,10,1);
	gtk_spin_button_set_value(GTK_SPIN_BUTTON(spin_button),i);
	g_signal_connect (G_OBJECT (spin_button), "value-changed", G_CALLBACK (on_setup_revise_group_spinbutton_changed), (gpointer)parent);
	gtk_box_pack_start(GTK_BOX(hbox),spin_button,false,false,0);
	label=gtk_label_new(_("times for echo group.(default:6)"));
	gtk_box_pack_start(GTK_BOX(hbox),label,false,false,0);
	gtk_box_pack_start(GTK_BOX(vbox),hbox,false,false,0);
	gtk_notebook_append_page(nb,vbox,NULL);
	return true;
}
コード例 #7
0
ファイル: revise.cpp プロジェクト: tamsuiboy/reciteword-osx
void
CRevise_group::show ()
{
	init ();

	SetBackPixmap (g_pReciteWord->fixed,
		       Skin->revise_group.revise_group.p[0]);
	return_button.create (g_pReciteWord->fixed,
			      Skin->revise_group.return_button.x[0],
			      Skin->revise_group.return_button.y[0],
			      Skin->revise_group.return_button.p[0],
			      Skin->revise_group.return_button.p[1],
			      Skin->revise_group.return_button.p[2],
			      (GdkPixmap *) NULL,
			      on_revise_group_return_clicked);
	chooseword_button.create (g_pReciteWord->fixed,
			      Skin->revise_group.chooseword_button.x[0],
			      Skin->revise_group.chooseword_button.y[0],
			      Skin->revise_group.chooseword_button.p[0],
			      Skin->revise_group.chooseword_button.p[1],
			      Skin->revise_group.chooseword_button.p[2],
			      on_revise_group_chooseword_clicked,this);
	gtk_tooltips_set_tip (g_pReciteWord->tooltips, chooseword_button.event_box,"Ctrl-W","");
	order_ckbutton.create (g_pReciteWord->fixed,
			      Skin->revise_group.order_ckbutton.x[0],
			      Skin->revise_group.order_ckbutton.y[0],
			      Skin->revise_group.order_ckbutton.p[0],
			      Skin->revise_group.order_ckbutton.p[1],
			      Skin->revise_group.order_ckbutton.p[2],
				  Skin->revise_group.order_ckbutton.p[3],
			      NULL);				  
   	gboolean order;
	rw_cfg_read_boolean(usercfgfile,
			     "revise_group", "disorder",
			     &order);
	order_ckbutton.set_status(order);
	glong found_group = 0;
	gint found = TRUE;
	gint zu_index = 0, revise_times;
	gchar tmpstr[256];
	std::time_t last_time;
	double between_time;
	while (found)
	{
		sprintf (tmpstr, "zu%d_time0", zu_index);
		if (rw_cfg_read_time (usercfgfile, g_pReciteWord->now_book->bookfilename, tmpstr, &last_time))	// have firstrecited 
		{
			sprintf (tmpstr, "zu%d_revisetimes", zu_index);
			rw_cfg_read_int (usercfgfile,
					 g_pReciteWord->now_book->
					 bookfilename, tmpstr, &revise_times);
			if (revise_times < max_revise_times)
			{
				sprintf (tmpstr, "zu%d_time%d", zu_index,
					 revise_times);
				rw_cfg_read_time (usercfgfile,
						  g_pReciteWord->now_book->
						  bookfilename, tmpstr,
						  &last_time);
				between_time = (revise_times * (24 * 60 * 60)) - (12 * 60 * 60);
				std::time_t now = std::time (0);
				if (difftime (now, last_time) > between_time)
				{
					found_group++;
					if (found_group <= 5)  //only show the first 5 groups.
					{
						this->revise_zu_index[found_group-1] =
							zu_index;						
						if (revise_times > 4)
							create_plane (4,found_group-1);
						else
							create_plane (revise_times,found_group-1);
					}
				}
			}
		}
		zu_index++;
		if (zu_index > g_pReciteWord->max_zu_index)	//the current book is search over....will try old books.
			found = FALSE;
	}
	sprintf(tmpstr,_("found %ld groups in total"),found_group);
	total_groups_label = gtk_label_new(tmpstr);
	gtk_fixed_put (GTK_FIXED (g_pReciteWord->fixed), total_groups_label,
		       Skin->revise_group.total_groups_label.x[0], Skin->revise_group.total_groups_label.y[0]);
	gtk_widget_show (total_groups_label);
}
コード例 #8
0
ファイル: reciteword.cpp プロジェクト: wzssyqa/ho22bus
void
CReciteWord::load_book (gchar *filename)
{
	if (now_book)
	{
		if (!strcmp(filename,now_book->bookfilename))
			return;
		close_book();
	}

	now_book = rw_book_open_file (filename);

	if (now_book)
	{
		rw_cfg_write_string (usercfgfile, "reciteword", "book_file", now_book->bookfilename);
		rw_cfg_read_int (usercfgfile, filename, "next_zu_index", &(g_pReciteWord->next_zu_index));
		rw_cfg_read_int (usercfgfile, filename, "max_zu_index", &(g_pReciteWord->max_zu_index));
		
		rw_cfg_read_int (usercfgfile, filename, "revise_test_chooseword_by", &(g_pReciteWord->revise_test_chooseword_info.by));
		rw_cfg_read_int (usercfgfile, filename, "revise_test_chooseword_zu_index", &(g_pReciteWord->revise_test_chooseword_info.zu_index));
		rw_cfg_read_int (usercfgfile, filename, "revise_test_chooseword_scope_start", &(g_pReciteWord->revise_test_chooseword_info.scope_start));
		rw_cfg_read_int (usercfgfile, filename, "revise_test_chooseword_scope_count", &(g_pReciteWord->revise_test_chooseword_info.scope_count));

		rw_cfg_read_int (usercfgfile, filename, "revise_skim_chooseword_by", &(g_pReciteWord->revise_skim_chooseword_info.by));
		rw_cfg_read_int (usercfgfile, filename, "revise_skim_chooseword_zu_index", &(g_pReciteWord->revise_skim_chooseword_info.zu_index));
		rw_cfg_read_int (usercfgfile, filename, "revise_skim_chooseword_scope_start", &(g_pReciteWord->revise_skim_chooseword_info.scope_start));
		rw_cfg_read_int (usercfgfile, filename, "revise_skim_chooseword_scope_count", &(g_pReciteWord->revise_skim_chooseword_info.scope_count));

		rw_cfg_read_int (usercfgfile, filename, "shooting_chooseword_by", &(g_pReciteWord->shooting_chooseword_info.by));
		rw_cfg_read_int (usercfgfile, filename, "shooting_chooseword_zu_index", &(g_pReciteWord->shooting_chooseword_info.zu_index));
		rw_cfg_read_int (usercfgfile, filename, "shooting_chooseword_scope_start", &(g_pReciteWord->shooting_chooseword_info.scope_start));
		rw_cfg_read_int (usercfgfile, filename, "shooting_chooseword_scope_count", &(g_pReciteWord->shooting_chooseword_info.scope_count));

		rw_cfg_read_int (usercfgfile, filename, "typing_chooseword_by", &(g_pReciteWord->typing_chooseword_info.by));
		rw_cfg_read_int (usercfgfile, filename, "typing_chooseword_zu_index", &(g_pReciteWord->typing_chooseword_info.zu_index));
		rw_cfg_read_int (usercfgfile, filename, "typing_chooseword_scope_start", &(g_pReciteWord->typing_chooseword_info.scope_start));
		rw_cfg_read_int (usercfgfile, filename, "typing_chooseword_scope_count", &(g_pReciteWord->typing_chooseword_info.scope_count));		
	}
	else
	{
		g_print ("load %s error!\n", filename);
	}
}
コード例 #9
0
ファイル: reciteword.cpp プロジェクト: wzssyqa/ho22bus
void
CReciteWord::close_book()
{
	if (now_book)
	{
		if (usercfgfile)
		{
			gint i;
			rw_cfg_read_int (usercfgfile, now_book->bookfilename, "next_zu_index", &i);
			if (i != next_zu_index)
				rw_cfg_write_int (usercfgfile, now_book->bookfilename, "next_zu_index", next_zu_index);
			rw_cfg_read_int (usercfgfile, now_book->bookfilename, "max_zu_index", &i);
			if (i != max_zu_index)
				rw_cfg_write_int (usercfgfile, now_book->bookfilename, "max_zu_index", max_zu_index);	

			rw_cfg_read_int (usercfgfile, now_book->bookfilename, "revise_test_chooseword_by", &i);
			if (i != revise_test_chooseword_info.by)
				rw_cfg_write_int (usercfgfile, now_book->bookfilename, "revise_test_chooseword_by", revise_test_chooseword_info.by);
			rw_cfg_read_int (usercfgfile, now_book->bookfilename, "revise_test_chooseword_zu_index", &i);
			if (i != revise_test_chooseword_info.zu_index)
				rw_cfg_write_int (usercfgfile, now_book->bookfilename, "revise_test_chooseword_zu_index", revise_test_chooseword_info.zu_index);
			rw_cfg_read_int (usercfgfile, now_book->bookfilename, "revise_test_chooseword_scope_start", &i);
			if (i != revise_test_chooseword_info.scope_start)
				rw_cfg_write_int (usercfgfile, now_book->bookfilename, "revise_test_chooseword_scope_start", revise_test_chooseword_info.scope_start);
			rw_cfg_read_int (usercfgfile, now_book->bookfilename, "revise_test_chooseword_scope_count", &i);
			if (i != revise_test_chooseword_info.scope_count)
				rw_cfg_write_int (usercfgfile, now_book->bookfilename, "revise_test_chooseword_scope_count", revise_test_chooseword_info.scope_count);

			rw_cfg_read_int (usercfgfile, now_book->bookfilename, "revise_skim_chooseword_by", &i);
			if (i != revise_skim_chooseword_info.by)
				rw_cfg_write_int (usercfgfile, now_book->bookfilename, "revise_skim_chooseword_by", revise_skim_chooseword_info.by);
			rw_cfg_read_int (usercfgfile, now_book->bookfilename, "revise_skim_chooseword_zu_index", &i);
			if (i != revise_skim_chooseword_info.zu_index)
				rw_cfg_write_int (usercfgfile, now_book->bookfilename, "revise_skim_chooseword_zu_index", revise_skim_chooseword_info.zu_index);
			rw_cfg_read_int (usercfgfile, now_book->bookfilename, "revise_skim_chooseword_scope_start", &i);
			if (i != revise_skim_chooseword_info.scope_start)
				rw_cfg_write_int (usercfgfile, now_book->bookfilename, "revise_skim_chooseword_scope_start", revise_skim_chooseword_info.scope_start);
			rw_cfg_read_int (usercfgfile, now_book->bookfilename, "revise_skim_chooseword_scope_count", &i);
			if (i != revise_skim_chooseword_info.scope_count)
				rw_cfg_write_int (usercfgfile, now_book->bookfilename, "revise_skim_chooseword_scope_count", revise_skim_chooseword_info.scope_count);

			rw_cfg_read_int (usercfgfile, now_book->bookfilename, "shooting_chooseword_by", &i);
			if (i != shooting_chooseword_info.by)
				rw_cfg_write_int (usercfgfile, now_book->bookfilename, "shooting_chooseword_by", shooting_chooseword_info.by);
			rw_cfg_read_int (usercfgfile, now_book->bookfilename, "shooting_chooseword_zu_index", &i);
			if (i != shooting_chooseword_info.zu_index)
				rw_cfg_write_int (usercfgfile, now_book->bookfilename, "shooting_chooseword_zu_index", shooting_chooseword_info.zu_index);
			rw_cfg_read_int (usercfgfile, now_book->bookfilename, "shooting_chooseword_scope_start", &i);
			if (i != shooting_chooseword_info.scope_start)
				rw_cfg_write_int (usercfgfile, now_book->bookfilename, "shooting_chooseword_scope_start", shooting_chooseword_info.scope_start);
			rw_cfg_read_int (usercfgfile, now_book->bookfilename, "shooting_chooseword_scope_count", &i);
			if (i != shooting_chooseword_info.scope_count)
				rw_cfg_write_int (usercfgfile, now_book->bookfilename, "shooting_chooseword_scope_count", shooting_chooseword_info.scope_count);

			rw_cfg_read_int (usercfgfile, now_book->bookfilename, "typing_chooseword_by", &i);
			if (i != typing_chooseword_info.by)
				rw_cfg_write_int (usercfgfile, now_book->bookfilename, "typing_chooseword_by", typing_chooseword_info.by);
			rw_cfg_read_int (usercfgfile, now_book->bookfilename, "typing_chooseword_zu_index", &i);
			if (i != typing_chooseword_info.zu_index)
				rw_cfg_write_int (usercfgfile, now_book->bookfilename, "typing_chooseword_zu_index", typing_chooseword_info.zu_index);
			rw_cfg_read_int (usercfgfile, now_book->bookfilename, "typing_chooseword_scope_start", &i);
			if (i != typing_chooseword_info.scope_start)
				rw_cfg_write_int (usercfgfile, now_book->bookfilename, "typing_chooseword_scope_start", typing_chooseword_info.scope_start);
			rw_cfg_read_int (usercfgfile, now_book->bookfilename, "typing_chooseword_scope_count", &i);
			if (i != typing_chooseword_info.scope_count)
				rw_cfg_write_int (usercfgfile, now_book->bookfilename, "typing_chooseword_scope_count", typing_chooseword_info.scope_count);
		}
		rw_book_free (now_book);
		g_free(now_book);
		now_book=NULL;
	}
}