incubator-bluesky-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From p...@apache.org
Subject svn commit: r819907 [5/5] - in /incubator/bluesky/trunk/RealClass/Student: ./ src/ src/pic/
Date Tue, 29 Sep 2009 12:36:47 GMT
Added: incubator/bluesky/trunk/RealClass/Student/src/interface.cc
URL: http://svn.apache.org/viewvc/incubator/bluesky/trunk/RealClass/Student/src/interface.cc?rev=819907&view=auto
==============================================================================
--- incubator/bluesky/trunk/RealClass/Student/src/interface.cc (added)
+++ incubator/bluesky/trunk/RealClass/Student/src/interface.cc Tue Sep 29 12:36:46 2009
@@ -0,0 +1,1703 @@
+#ifdef HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <string.h>
+#include <stdio.h>
+#include <gdk/gdkkeysyms.h>
+#include <gtk/gtk.h>
+#include <stdlib.h>
+#include <iostream> 
+#include <fstream.h>
+#include <string.h>
+
+#include <gdk/gdk.h>
+#include <gtk/gtk.h>
+#include <gdk/gdkx.h>
+#include <gdk/gdkimage.h>
+
+#include "ncclient.hh"
+#include "callbacks.hh"
+#include "interface.h"
+#include "support.hh"
+#include "errormessage.h"
+
+char* p_window_title_MainFrame = "Students Client";
+char* p_toolbar_start = "Start";
+char* p_toolbar_start_NetConf = "Settings";
+char* p_toolbar_start_LogonSys = "Login System";
+char* p_toolbar_start_ExitSys = "Quit";
+char* p_toolbar_Class = "Class";
+char* p_toolbar_Class_Join = "Join Class";
+char* p_toolbar_Class_Quit = "Exit Class";
+char* p_toolbar_Operations = "Operations";
+char* p_toolbar_Operations_Interactive = "Start Communication";
+char* p_toolbar_Operations_QInteractive = "Exit Communication";
+char* p_toolbar_Help = "Help";
+char* p_toolbar_Help_About = "About";
+char* p_GraphButt_NetConf = "Settings";
+char* p_GraphButt_Comment_NetConf = "Network configuration";
+char* p_GraphButt_LogSys = "Login";
+char* p_GraphButt_Comment_LogSys = "Login System";
+char* p_GraphButt_JoinClass = "Joinclass";
+char* p_GraphButt_Comment_JoinClass = "Join Class";
+char* p_GraphButt_QuitClass = "ExClass";
+char* p_GraphButt_Comment_QuitClass = "Exit Class";
+char* p_GraphButt_Interactive = "Commu";
+char* p_GraphButt_Comment_Interactive = "Start Communication";
+char* p_GraphButt_QInteractive = "ExCom";
+char* p_GraphButt_Comment_QInteractive = "Exit Communication";
+char* p_GraphButt_ExitSys = "Quit";
+char* p_GraphButt_Comment_ExitSys = "Quit System";
+char* p_Butt_StuView = "Studentview";
+char* p_Butt_MyView = "My View";
+char* p_StaticTxt_InputMessage = "Message:";
+char* p_Butt_SendMessage = "Snd";
+char* p_Butt_ClearMessage = "Clr";
+
+char * p_Window_Title_LogonSys = "Login Information";
+
+char * p_LogonSys_StaticTxt_UserName = "User:";
+
+char * p_LogonSys_StaticTxt_Password = "PWD:";
+
+char * p_LogonSys_Butt_Cancel = "Cancel";
+
+char * p_LogonSys_Butt_OK = "OK";
+
+char* p_Window_Title_NetConf = "Network Configuration";
+
+char* p_NetConf_StaticTxt_ClassServerIP = "Server IP";
+
+char* p_NetConf_StaticTxt_ClassServerPort = "Server Port";
+
+char* p_NetConf_StaticTxt_UserIP = "User IP";
+
+char* p_NetConf_StaticTxt_StdRevPort = "Receive Port";
+
+char* p_NetConf_Butt_Comment_AmateurCautious = "For professional user only!";//"Amateur Cautious!";
+
+char* p_NetConf_Butt_Advance = "Advanced";
+
+char* p_Netconf_Butt_Cancel = "Cancel";
+
+char* p_Netconf_Butt_Ok = "OK";
+
+char* p_StaticTxt_ExitSys = "Quit System?";
+
+char* p_ExitDialog_Butt_Cancel = "Cancel";
+
+char* p_ExitDialog_Butt_Yes = "Yes";
+
+char * p_Window_Title_ClassList = "Class List";
+
+char * p_Lable_ClassListDLG_ClassID = "Class ID";
+
+char * p_Lable_ClassListDLG_ClassName = "Class Name";
+
+char * p_Lable_ClassListDLG_TeacherName = "Teacher";
+
+char * p_Lable_ClassListDLG_ClassState = "State";
+
+char * p_Lable_ClassListDLG_ClassIntro = "Class Introduction";
+
+char * p_Butt_ClassListDLG_Help = "Help";
+
+char * p_Butt_ClassListDLG_Cancel = "Cancel";
+
+char * p_Butt_ClassListDLG_OK = "OK";
+
+char * p_StaticTxt_QuitClassDLG_QuitClass = "Exit Class?";
+
+char * p_Butt_QuitClass_Cancel = "Cancel";
+
+char * p_Butt_QuitClass_QuitClass = "Yes";
+
+char * p_Window_Title_AboutDlg = "About Our System";
+
+char
+		* p_StaticTxt_AboutDlg_AboutSys =
+				"\n                 About BlueSky Real time Interactive System\n\n                                 System Version   1.0.0\n\n     The system is developed by the Satellite-Terrestrial Networks\n\n  Tech R&D key laboratory of Xi'an jiaotong university.Our system \n\n  is still at the testing phase. You are welcome to contact us with \n\n  your suggestion.";
+
+char * p_Butt_AboutDLG_OK = "OK";
+
+using namespace std;
+typedef unsigned long DWORD;
+extern char IP[30]; 
+struct TRCClientLogin stulogin;
+
+GtkAdjustment *adj1, *adj2;
+GtkWidget *localIPentry;
+GtkWidget *IPentry;
+GtkWidget *teachaudioentry;
+GtkWidget *centerport_entry;
+
+GtkWidget *loadsys;
+GtkWidget *class1; 
+
+GtkWidget *addclass;
+GtkWidget *exitclass;
+GtkWidget *loadtool; 
+GtkWidget *addclasstool; 
+GtkWidget *exitclasstool;
+GtkWidget *exchangetool;
+GtkWidget *cancelextool;
+GtkWidget *clist1;
+
+GtkWidget *requestchange;
+GtkWidget *cancelchange;
+
+GtkWidget *classdialog;
+
+GtkWidget *nameentry;
+GtkWidget *psdentry;
+
+GtkWidget *sendchatbut;
+GtkWidget *chatentry;
+
+GtkWidget *stu_clist;
+GtkWidget *chatview;
+GtkWidget *chat_show;
+
+GtkWidget *networktool;
+GtkWidget *networkconfig;
+
+GtkWidget *screenimage;
+GtkWidget *teachimage;
+GtkWidget *studimage;
+
+GtkWidget *studimagebut;
+GtkTextBuffer *chat_buffer; 
+GtkTextIter chat_end;
+GtkTextIter chat_start;
+
+GtkTextBuffer *TeachChat_buffer;
+GtkTextIter TeachChat_end;
+GtkTextIter TeachChat_start;
+
+char namesave[16] = "";
+char CenterIP[16];
+
+char CenterPort[8];
+extern struct class_center center;
+
+void config_file_write()
+{
+	FILE *fp;
+	int len;
+	if ((fp = fopen("/usr/local/bin/center_config.txt", "wt")) == NULL)
+	{
+		printf("cannot open this file\n");
+	}
+	else
+	{
+		remove("/usr/local/bin/center_config.txt");
+		fp = fopen("/usr/local/bin/center_config.txt", "wt+");
+		printf("give file data is %s\n", center.Center_port);
+
+		len = strlen(center.Center_IP);
+		fputc('I', fp);
+		fputc('P', fp);
+		fputc('=', fp);
+		for (int i = 0; i < len; i++)
+		{
+			if (center.Center_IP[i] != '\0')
+			{
+				fputc(center.Center_IP[i], fp);
+			}
+		}
+
+		fputc('\n', fp);
+		printf("Center  port is %s\n", center.Center_port);
+
+		len = strlen(center.Center_port);
+		fputc('P', fp);
+		fputc('O', fp);
+		fputc('R', fp);
+		fputc('T', fp);
+		fputc('=', fp);
+		for (int i = 0; i < len; i++)
+		{
+			if (center.Center_port[i] != '\0')
+			{
+				fputc(center.Center_port[i], fp);
+			}
+		}
+		fputc('\r', fp);
+		fputc('\n', fp);
+		fclose(fp);
+	}
+
+}
+
+void config_file_read()
+{
+	FILE *fp;
+	char ch;
+	int i = 1, j = 1;
+	if ((fp = fopen("/usr/local/bin/center_config.txt", "r")) == NULL)
+	{
+		printf("can't open this file for read\n");
+		strcpy(center.Center_IP, "202.117.10.88");
+		strcpy(center.Center_port, "12345");
+	}
+	else
+	{
+		ch = fgetc(fp);
+		if (ch == EOF)
+		{
+			fclose(fp);
+			return;
+		}
+
+		while (ch != '=')
+		{
+			ch = fgetc(fp);
+			if (ch == EOF)
+			{
+				fclose(fp);
+				return;
+			}
+
+		}
+		i = 0;
+		while (ch != EOF)
+		{
+			ch = fgetc(fp);
+
+			if (((ch >= 48) && (ch <= 57)) || ch == 46)
+			{
+				CenterIP[i] = ch;
+
+				i++;
+			}
+			else if (ch == 10 || ch == 13)
+				break;
+			else
+				continue;
+		}
+
+		while (ch != '=')
+		{
+			ch = fgetc(fp);
+			if (ch == EOF)
+			{
+				fclose(fp);
+				return;
+			}
+		}
+
+		j = 0;
+		while (ch != EOF)
+		{
+			ch = fgetc(fp);
+
+			if (((ch >= 48) && (ch <= 57)) || ch == 46)
+			{
+				CenterPort[j] = ch;
+				j++;
+			}
+			else if (ch == 10 || ch == 13)
+				break;
+			else
+				continue;
+		}
+		strcpy(center.Center_IP, CenterIP);
+		strcpy(center.Center_port, CenterPort);
+		printf("center.Center_IP is %s\n", center.Center_IP);
+		fclose(fp);
+	}
+}
+
+GtkWidget*
+create_mainwindow(void)
+{
+	GtkWidget *mainwindow;
+	GtkWidget *vbox1;
+	GtkWidget *menubar1;
+	GtkWidget *begin;
+	GtkWidget *begin_menu;
+	GtkWidget *separator;
+	GtkWidget *exitsys;
+	GtkWidget *class_menu;
+	GtkWidget *operate;
+	GtkWidget *operate_menu;
+	GtkWidget *help;
+	GtkWidget *help_menu;
+	GtkWidget *about;
+	GtkWidget *hbox1;
+	GtkWidget *vbox2;
+	GtkWidget *vbox8;
+	GtkWidget *vbox10;
+	GtkWidget *toolbar1;
+	GtkIconSize tmp_toolbar_icon_size;
+	GtkWidget *tmp_image;
+	GtkWidget *separatortoolitem7;
+	GtkWidget *separatortoolitem1;
+	GtkWidget *separatortoolitem2;
+	GtkWidget *separatortoolitem3;
+	GtkWidget *separatortoolitem4;
+	GtkWidget *separatortoolitem5;
+	GtkWidget *exittool;
+	GtkWidget *hbox18;
+	GtkWidget *studframe;
+	GtkWidget *alignment4;
+	GtkWidget *vbox11;
+	GtkWidget *hseparator4;
+	GtkWidget *hbox19;
+	GtkWidget *vseparator1;
+	GtkWidget *myimagebut;
+	GtkWidget *hseparator5;
+	GtkWidget *hseparator6;
+	GtkWidget *scrolledwindow1;
+
+	GtkWidget *label;
+	GtkWidget *screenframe;
+	GtkWidget *alignment5;
+	GtkWidget *vbox12;
+	GtkWidget *scrolledwindow4;
+	GtkWidget *hseparator7;
+	GtkWidget *hbox20;
+	GtkWidget *inputlab;
+	GtkWidget *label2;
+	GtkWidget *list1;
+	GtkWidget *label3;
+	GtkAccelGroup *accel_group;
+	GtkTooltips *tooltips;
+
+	GdkScreen *ServerScreen;
+	ServerScreen = gdk_screen_get_default();
+	int iHeight = gdk_screen_get_height(ServerScreen);
+	int iWidth = gdk_screen_get_width(ServerScreen);
+
+	if (iWidth < 1024 || iHeight < 768)
+	{
+		Error_dia(screensize_error, screensize_errorms);
+		return NULL;
+	}
+
+	else
+	{
+		tooltips = gtk_tooltips_new();
+		accel_group = gtk_accel_group_new();
+
+		mainwindow = gtk_window_new(GTK_WINDOW_TOPLEVEL);
+		gtk_widget_set_size_request(mainwindow, 1024, 705);
+		//windows title	Main Frame
+		gtk_window_set_title(GTK_WINDOW(mainwindow), p_window_title_MainFrame);
+		gtk_window_set_resizable(GTK_WINDOW(mainwindow), FALSE);
+
+		vbox1 = gtk_vbox_new(FALSE, 0);
+		gtk_widget_show(vbox1);
+		gtk_container_add(GTK_CONTAINER(mainwindow), vbox1);
+
+		menubar1 = gtk_menu_bar_new();
+		gtk_widget_show(menubar1);
+		gtk_box_pack_start(GTK_BOX(vbox1), menubar1, FALSE, FALSE, 0);
+		//toolbar options---->start
+		begin = gtk_menu_item_new_with_mnemonic(p_toolbar_start);
+		gtk_widget_show(begin);
+		gtk_container_add(GTK_CONTAINER(menubar1), begin);
+
+		begin_menu = gtk_menu_new();
+		gtk_menu_item_set_submenu(GTK_MENU_ITEM(begin), begin_menu);
+		//toolbar options---->start---->network config
+		networkconfig
+				= gtk_menu_item_new_with_mnemonic(p_toolbar_start_NetConf);
+		gtk_widget_show(networkconfig);
+		gtk_container_add(GTK_CONTAINER(begin_menu), networkconfig);
+		gtk_widget_add_accelerator(networkconfig, "activate", accel_group,
+				GDK_N, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE);
+
+		separator = gtk_separator_menu_item_new();
+		gtk_widget_show(separator);
+		gtk_container_add(GTK_CONTAINER(begin_menu), separator);
+		gtk_widget_set_sensitive(separator, FALSE);
+
+		//toolbar options---->start---->logon system
+		loadsys = gtk_menu_item_new_with_mnemonic(p_toolbar_start_LogonSys);
+		gtk_widget_show(loadsys);
+		gtk_container_add(GTK_CONTAINER(begin_menu), loadsys);
+		gtk_widget_add_accelerator(loadsys, "activate", accel_group, GDK_L,
+				GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE);
+		gtk_widget_set_sensitive(loadsys, FALSE); 
+		//toolbar options---->start---->exit system
+		exitsys = gtk_menu_item_new_with_mnemonic(p_toolbar_start_ExitSys);
+		gtk_widget_show(exitsys);
+		gtk_container_add(GTK_CONTAINER(begin_menu), exitsys);
+		gtk_widget_add_accelerator(exitsys, "activate", accel_group, GDK_Q,
+				GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE);
+
+		//toolbar options---->class
+		class1 = gtk_menu_item_new_with_mnemonic(p_toolbar_Class);
+		gtk_widget_show(class1);
+		gtk_container_add(GTK_CONTAINER(menubar1), class1);
+
+		class_menu = gtk_menu_new();
+		gtk_menu_item_set_submenu(GTK_MENU_ITEM(class1), class_menu);
+		
+		//toolbar options---->class---->join class
+		addclass = gtk_menu_item_new_with_mnemonic(p_toolbar_Class_Join);
+		gtk_widget_show(addclass);
+		gtk_container_add(GTK_CONTAINER(class_menu), addclass);
+		gtk_widget_set_sensitive(addclass, FALSE); 
+		//toolbar options---->class---->quit class
+		exitclass = gtk_menu_item_new_with_mnemonic(p_toolbar_Class_Quit);
+		
+		gtk_widget_show(exitclass);
+		gtk_container_add(GTK_CONTAINER(class_menu), exitclass);
+		gtk_widget_set_sensitive(exitclass, FALSE); 
+		//toolbar options---->Operations
+		operate = gtk_menu_item_new_with_mnemonic(p_toolbar_Operations);
+		gtk_widget_show(operate);
+		gtk_container_add(GTK_CONTAINER(menubar1), operate);
+
+		operate_menu = gtk_menu_new();
+		gtk_menu_item_set_submenu(GTK_MENU_ITEM(operate), operate_menu);
+		//toolbar options---->operations---->interactive
+		requestchange = gtk_menu_item_new_with_mnemonic(
+				p_toolbar_Operations_Interactive);
+		
+		gtk_widget_show(requestchange);
+		gtk_container_add(GTK_CONTAINER(operate_menu), requestchange);
+		gtk_widget_set_sensitive(requestchange, FALSE); 
+
+		//toolbar options---->operations---->Qinteractive
+		cancelchange = gtk_menu_item_new_with_mnemonic(
+				p_toolbar_Operations_QInteractive);
+		
+		gtk_widget_show(cancelchange);
+		gtk_container_add(GTK_CONTAINER(operate_menu), cancelchange);
+		gtk_widget_set_sensitive(cancelchange, FALSE); 
+		
+		//toolbar options---->help
+		help = gtk_menu_item_new_with_mnemonic(p_toolbar_Help);
+		
+		gtk_widget_show(help);
+		gtk_container_add(GTK_CONTAINER(menubar1), help);
+
+		help_menu = gtk_menu_new();
+		gtk_menu_item_set_submenu(GTK_MENU_ITEM(help), help_menu);
+
+		//toolbar options---->help---->about
+		about = gtk_menu_item_new_with_mnemonic(p_toolbar_Help_About);
+		
+		gtk_widget_show(about);
+		gtk_container_add(GTK_CONTAINER(help_menu), about);
+
+		hbox1 = gtk_hbox_new(FALSE, 0);
+		gtk_widget_show(hbox1);
+		gtk_box_pack_start(GTK_BOX(vbox1), hbox1, TRUE, TRUE, 0);
+
+		vbox2 = gtk_vbox_new(FALSE, 0);
+		gtk_widget_show(vbox2);
+		gtk_box_pack_start(GTK_BOX(hbox1), vbox2, TRUE, TRUE, 0);
+
+		vbox8 = gtk_vbox_new(FALSE, 0);
+		gtk_widget_show(vbox8);
+		gtk_box_pack_start(GTK_BOX(vbox2), vbox8, TRUE, TRUE, 0);
+
+		vbox10 = gtk_vbox_new(FALSE, 0);
+		gtk_widget_show(vbox10);
+		gtk_box_pack_start(GTK_BOX(vbox8), vbox10, TRUE, TRUE, 0);
+
+		toolbar1 = gtk_toolbar_new();
+		gtk_widget_show(toolbar1);
+		gtk_box_pack_start(GTK_BOX(vbox10), toolbar1, FALSE, FALSE, 0);
+		gtk_widget_set_size_request(toolbar1, -1, 47);
+		gtk_toolbar_set_style(GTK_TOOLBAR(toolbar1), GTK_TOOLBAR_BOTH);
+		tmp_toolbar_icon_size
+				= gtk_toolbar_get_icon_size(GTK_TOOLBAR(toolbar1));
+
+		tmp_image = gtk_image_new_from_stock("gtk-preferences",
+				tmp_toolbar_icon_size);
+		gtk_widget_show(tmp_image);
+
+		//GraphicButtons Network configure
+		networktool = (GtkWidget*) gtk_tool_button_new(tmp_image,
+				p_GraphButt_NetConf);
+		
+		gtk_widget_show(networktool);
+		gtk_container_add(GTK_CONTAINER(toolbar1), networktool);
+		gtk_widget_set_size_request(networktool, 65, 45);
+
+		//Comment Network configure
+		gtk_tool_item_set_tooltip(GTK_TOOL_ITEM(networktool), tooltips,
+				p_GraphButt_Comment_NetConf, NULL);
+		
+		separatortoolitem7 = (GtkWidget*) gtk_separator_tool_item_new();
+		gtk_widget_show(separatortoolitem7);
+		gtk_container_add(GTK_CONTAINER(toolbar1), separatortoolitem7);
+
+		tmp_image = gtk_image_new_from_stock("gtk-go-forward",
+				tmp_toolbar_icon_size);
+		gtk_widget_show(tmp_image);
+
+		//GraphicButtons Logon System
+		loadtool = (GtkWidget*) gtk_tool_button_new(tmp_image,
+				p_GraphButt_LogSys);
+		
+		gtk_widget_show(loadtool);
+		gtk_container_add(GTK_CONTAINER(toolbar1), loadtool);
+		gtk_widget_set_size_request(loadtool, 65, 45);
+
+		//GraphicButtons Comment Logon System
+		gtk_tool_item_set_tooltip(GTK_TOOL_ITEM(loadtool), tooltips,
+				p_GraphButt_Comment_LogSys, NULL);
+		
+		gtk_widget_set_sensitive(loadtool, FALSE); 
+		separatortoolitem1 = (GtkWidget*) gtk_separator_tool_item_new();
+		gtk_widget_show(separatortoolitem1);
+		gtk_container_add(GTK_CONTAINER(toolbar1), separatortoolitem1);
+
+		tmp_image = gtk_image_new_from_stock("gtk-execute",
+				tmp_toolbar_icon_size);
+		gtk_widget_show(tmp_image);
+
+		//GraphicButtons Join Class
+		addclasstool = (GtkWidget*) gtk_tool_button_new(tmp_image,
+				p_GraphButt_JoinClass);
+		
+		gtk_widget_show(addclasstool);
+		gtk_container_add(GTK_CONTAINER(toolbar1), addclasstool);
+		gtk_widget_set_size_request(addclasstool, 65, 45);
+
+		//GraphicButtons Comment Join Class
+		gtk_tool_item_set_tooltip(GTK_TOOL_ITEM(addclasstool), tooltips,
+				p_GraphButt_Comment_JoinClass, NULL);
+		
+		gtk_widget_set_sensitive(addclasstool, FALSE); 
+		separatortoolitem2 = (GtkWidget*) gtk_separator_tool_item_new();
+		gtk_widget_show(separatortoolitem2);
+		gtk_container_add(GTK_CONTAINER(toolbar1), separatortoolitem2);
+
+		tmp_image = gtk_image_new_from_stock("gtk-stop", tmp_toolbar_icon_size);
+		gtk_widget_show(tmp_image);
+
+		//GraphicButtons Quit Class
+		exitclasstool = (GtkWidget*) gtk_tool_button_new(tmp_image,
+				p_GraphButt_QuitClass);
+		
+		gtk_widget_show(exitclasstool);
+		gtk_container_add(GTK_CONTAINER(toolbar1), exitclasstool);
+		gtk_widget_set_size_request(exitclasstool, 65, 45);
+
+		//GraphicButtons Comment Quit Class
+		gtk_tool_item_set_tooltip(GTK_TOOL_ITEM(exitclasstool), tooltips,
+				p_GraphButt_Comment_QuitClass, NULL);
+		
+		gtk_widget_set_sensitive(exitclasstool, FALSE); 
+		separatortoolitem3 = (GtkWidget*) gtk_separator_tool_item_new();
+		gtk_widget_show(separatortoolitem3);
+		gtk_container_add(GTK_CONTAINER(toolbar1), separatortoolitem3);
+
+		tmp_image = gtk_image_new_from_stock("gtk-zoom-fit",
+				tmp_toolbar_icon_size);
+		gtk_widget_show(tmp_image);
+
+		//GraphicButtons interactive
+		exchangetool = (GtkWidget*) gtk_tool_button_new(tmp_image,
+				p_GraphButt_Interactive);
+		
+		gtk_widget_show(exchangetool);
+		gtk_container_add(GTK_CONTAINER(toolbar1), exchangetool);
+		gtk_widget_set_size_request(exchangetool, 65, 45);
+
+		//GraphicButtons Comment interactive
+		gtk_tool_item_set_tooltip(GTK_TOOL_ITEM(exchangetool), tooltips,
+				p_GraphButt_Comment_Interactive, NULL);
+		
+		gtk_widget_set_sensitive(exchangetool, FALSE); 
+
+		separatortoolitem4 = (GtkWidget*) gtk_separator_tool_item_new();
+		gtk_widget_show(separatortoolitem4);
+		gtk_container_add(GTK_CONTAINER(toolbar1), separatortoolitem4);
+
+		tmp_image = gtk_image_new_from_stock("gtk-jump-to",
+				tmp_toolbar_icon_size);
+		gtk_widget_show(tmp_image);
+
+		//GraphicButtons Qinteractive
+		cancelextool = (GtkWidget*) gtk_tool_button_new(tmp_image,
+				p_GraphButt_QInteractive);
+		
+		gtk_widget_show(cancelextool);
+		gtk_container_add(GTK_CONTAINER(toolbar1), cancelextool);
+		gtk_widget_set_size_request(cancelextool, 65, 45);
+
+		//Graphic Buttons Comment Qinteractive
+		gtk_tool_item_set_tooltip(GTK_TOOL_ITEM(cancelextool), tooltips,
+				p_GraphButt_Comment_QInteractive, NULL);
+		
+		gtk_widget_set_sensitive(cancelextool, FALSE); 
+
+		separatortoolitem5 = (GtkWidget*) gtk_separator_tool_item_new();
+		gtk_widget_show(separatortoolitem5);
+		gtk_container_add(GTK_CONTAINER(toolbar1), separatortoolitem5);
+
+		tmp_image = gtk_image_new_from_stock("gtk-quit", tmp_toolbar_icon_size);
+		gtk_widget_show(tmp_image);
+
+		//Graphic Buttons ExitSystem
+		exittool = (GtkWidget*) gtk_tool_button_new(tmp_image,
+				p_GraphButt_ExitSys);
+		
+		gtk_widget_show(exittool);
+		gtk_container_add(GTK_CONTAINER(toolbar1), exittool);
+		gtk_widget_set_size_request(exittool, 65, 40);
+
+		//Graphic Buttons Comment ExitSystem
+		gtk_tool_item_set_tooltip(GTK_TOOL_ITEM(exittool), tooltips,
+				p_GraphButt_Comment_ExitSys, NULL);
+		
+		hbox18 = gtk_hbox_new(FALSE, 0);
+		gtk_widget_show(hbox18);
+		gtk_box_pack_start(GTK_BOX(vbox10), hbox18, TRUE, TRUE, 0);
+
+		studframe = gtk_frame_new(NULL);
+		gtk_widget_show(studframe);
+		gtk_box_pack_start(GTK_BOX(hbox18), studframe, TRUE, TRUE, 0);
+		gtk_frame_set_label_align(GTK_FRAME(studframe), 0, 0);
+
+		alignment4 = gtk_alignment_new(0.5, 0.5, 1, 1);
+		gtk_widget_show(alignment4);
+		gtk_container_add(GTK_CONTAINER(studframe), alignment4);
+		gtk_alignment_set_padding(GTK_ALIGNMENT(alignment4), 0, 0, 12, 0);
+
+		vbox11 = gtk_vbox_new(FALSE, 0);
+		gtk_widget_show(vbox11);
+		gtk_container_add(GTK_CONTAINER(alignment4), vbox11);
+
+		teachimage = create_pixmap(mainwindow, NULL);
+
+		gtk_widget_show(teachimage);
+		gtk_box_pack_start(GTK_BOX(vbox11), teachimage, TRUE, TRUE, 0);
+		gtk_widget_set_size_request(teachimage, 200, 150);
+
+		hseparator4 = gtk_hseparator_new();
+		gtk_widget_show(hseparator4);
+		gtk_box_pack_start(GTK_BOX(vbox11), hseparator4, TRUE, TRUE, 0);
+		gtk_widget_set_size_request(hseparator4, 1, 2);
+
+		hbox19 = gtk_hbox_new(FALSE, 0);
+		gtk_widget_show(hbox19);
+		gtk_box_pack_start(GTK_BOX(vbox11), hbox19, TRUE, TRUE, 0);
+		gtk_widget_set_size_request(hbox19, 175, 15);
+
+		//Buttons Student View 
+		studimagebut = gtk_button_new_with_mnemonic(p_Butt_StuView);
+		
+		gtk_widget_show(studimagebut);
+		gtk_box_pack_start(GTK_BOX(hbox19), studimagebut, TRUE, FALSE, 0);
+		gtk_widget_set_size_request(studimagebut, 90, 10);
+
+		vseparator1 = gtk_vseparator_new();
+		gtk_widget_show(vseparator1);
+		gtk_box_pack_start(GTK_BOX(hbox19), vseparator1, FALSE, FALSE, 0);
+		gtk_widget_set_size_request(vseparator1, 1, 1);
+
+		//Buttons My View
+		myimagebut = gtk_button_new_with_mnemonic(p_Butt_MyView);
+		
+		gtk_widget_show(myimagebut);
+		gtk_box_pack_end(GTK_BOX(hbox19), myimagebut, TRUE, FALSE, 0);
+		gtk_widget_set_size_request(myimagebut, 90, 10);
+
+		hseparator5 = gtk_hseparator_new();
+		gtk_widget_show(hseparator5);
+		gtk_box_pack_start(GTK_BOX(vbox11), hseparator5, TRUE, TRUE, 0);
+		gtk_widget_set_size_request(hseparator5, 0, 0);
+
+		studimage = create_pixmap(mainwindow, NULL);
+		gtk_widget_show(studimage);
+		gtk_box_pack_start(GTK_BOX(vbox11), studimage, TRUE, TRUE, 0);
+		gtk_widget_set_size_request(studimage, 176, 144);
+
+		hseparator6 = gtk_hseparator_new();
+		gtk_widget_show(hseparator6);
+		gtk_box_pack_start(GTK_BOX(vbox11), hseparator6, TRUE, TRUE, 0);
+
+		scrolledwindow1 = gtk_scrolled_window_new(NULL, NULL);
+		gtk_widget_show(scrolledwindow1);
+		gtk_box_pack_start(GTK_BOX(vbox11), scrolledwindow1, TRUE, TRUE, 0);
+		gtk_widget_set_size_request(scrolledwindow1, 176, 102);
+		gtk_scrolled_window_set_shadow_type(
+				GTK_SCROLLED_WINDOW(scrolledwindow1), GTK_SHADOW_IN);
+		gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolledwindow1),
+				GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+
+		chatview = gtk_text_view_new();
+		gtk_widget_show(chatview);
+		gtk_container_add(GTK_CONTAINER(scrolledwindow1), chatview);
+		gtk_widget_set_size_request(chatview, 170, 110);
+		gtk_text_view_set_editable(GTK_TEXT_VIEW(chatview), FALSE);
+		//gtk_text_buffer_set_text (gtk_text_view_get_buffer (GTK_TEXT_VIEW (chatview)), "\350\201\212\345\244\251\350\256\260\345\275\225\346\230\276\347\244\272\346\241\206", -1);
+		TeachChat_buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(chatview));
+		gtk_text_buffer_get_end_iter(TeachChat_buffer, &TeachChat_end);
+
+		adj1 = gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(
+				scrolledwindow1));
+
+		label = gtk_label_new("");
+		gtk_widget_show(label);
+		gtk_frame_set_label_widget(GTK_FRAME(studframe), label);
+		gtk_label_set_use_markup(GTK_LABEL(label), TRUE);
+
+		screenframe = gtk_frame_new(NULL);
+		gtk_widget_show(screenframe);
+		gtk_box_pack_start(GTK_BOX(hbox18), screenframe, TRUE, TRUE, 0);
+		gtk_frame_set_label_align(GTK_FRAME(screenframe), 0, 0);
+
+		alignment5 = gtk_alignment_new(0.5, 0.5, 1, 1);
+		gtk_widget_show(alignment5);
+		gtk_container_add(GTK_CONTAINER(screenframe), alignment5);
+		gtk_alignment_set_padding(GTK_ALIGNMENT(alignment5), 0, 0, 12, 0);
+
+		vbox12 = gtk_vbox_new(FALSE, 0);
+		gtk_widget_show(vbox12);
+		gtk_container_add(GTK_CONTAINER(alignment5), vbox12);
+
+		scrolledwindow4 = gtk_scrolled_window_new(NULL, NULL);
+		gtk_widget_show(scrolledwindow4);
+		gtk_box_pack_start(GTK_BOX(vbox12), scrolledwindow4, TRUE, TRUE, 0);
+		gtk_scrolled_window_set_shadow_type(
+				GTK_SCROLLED_WINDOW(scrolledwindow4), GTK_SHADOW_IN);
+		gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolledwindow4),
+				GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+
+		chat_show = gtk_text_view_new();
+		gtk_widget_show(chat_show);
+		gtk_container_add(GTK_CONTAINER(scrolledwindow4), chat_show);
+		gtk_widget_set_size_request(chat_show, 750, 550);
+		gtk_text_view_set_editable(GTK_TEXT_VIEW(chat_show), FALSE);
+		gtk_text_view_set_cursor_visible(GTK_TEXT_VIEW(chat_show), FALSE);
+		chat_buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(chat_show));
+		gtk_text_buffer_get_end_iter(chat_buffer, &chat_end);
+
+		adj2 = gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(
+				scrolledwindow4));
+		
+		label3 = gtk_label_new("");
+		gtk_widget_show(label3);
+		gtk_box_pack_start(GTK_BOX(vbox12), label3, TRUE, FALSE, 0);
+		gtk_widget_set_size_request(label3, -1, 8);
+
+		hseparator7 = gtk_hseparator_new();
+		gtk_widget_show(hseparator7);
+		gtk_box_pack_start(GTK_BOX(vbox12), hseparator7, TRUE, FALSE, 0);
+
+		hbox20 = gtk_hbox_new(FALSE, 0);
+		gtk_widget_show(hbox20);
+		gtk_box_pack_start(GTK_BOX(vbox12), hbox20, TRUE, FALSE, 0);
+
+		//Static text Input Message
+		inputlab = gtk_label_new(p_StaticTxt_InputMessage);
+		
+		gtk_widget_show(inputlab);
+		gtk_box_pack_start(GTK_BOX(hbox20), inputlab, FALSE, FALSE, 0);
+		gtk_widget_set_size_request(inputlab, 60, 25);
+		gtk_label_set_justify(GTK_LABEL(inputlab), GTK_JUSTIFY_CENTER);
+
+		chatentry = gtk_entry_new();
+		gtk_widget_show(chatentry);
+		gtk_box_pack_start(GTK_BOX(hbox20), chatentry, TRUE, FALSE, 0);
+		gtk_widget_set_size_request(chatentry, 580, 25);
+
+		GtkWidget *clearchatbut;
+		GtkWidget*labelpre;
+		GtkWidget*labelmid;
+		GtkWidget *labelend;
+
+		labelpre = gtk_label_new("");
+		gtk_widget_show(labelpre);
+		gtk_box_pack_start(GTK_BOX(hbox20), labelpre, TRUE, FALSE, 0);
+		gtk_widget_set_size_request(labelpre, 10, -1);
+
+		//Buttons Send Message
+		sendchatbut = gtk_button_new_with_mnemonic(p_Butt_SendMessage);
+		
+		gtk_widget_show(sendchatbut);
+		gtk_box_pack_start(GTK_BOX(hbox20), sendchatbut, FALSE, TRUE, 0);
+		gtk_widget_set_size_request(sendchatbut, 40, 25);
+
+		labelmid = gtk_label_new("");
+		gtk_widget_show(labelmid);
+		gtk_box_pack_start(GTK_BOX(hbox20), labelmid, TRUE, FALSE, 0);
+		gtk_widget_set_size_request(labelmid, 5, -1);
+
+		//Buttons Clear Message
+		clearchatbut = gtk_button_new_with_mnemonic(p_Butt_ClearMessage);
+		
+		gtk_widget_show(clearchatbut);
+		gtk_box_pack_start(GTK_BOX(hbox20), clearchatbut, FALSE, TRUE, 0);
+		gtk_widget_set_size_request(clearchatbut, 40, 25);
+
+		labelend = gtk_label_new("");
+		gtk_widget_show(labelend);
+		gtk_box_pack_start(GTK_BOX(hbox20), labelend, TRUE, FALSE, 0);
+		gtk_widget_set_size_request(labelend, 10, -1);
+
+		label2 = gtk_label_new("");
+		gtk_widget_show(label2);
+		gtk_frame_set_label_widget(GTK_FRAME(screenframe), label2);
+		gtk_label_set_use_markup(GTK_LABEL(label2), TRUE);
+
+		list1 = gtk_list_new();
+		gtk_widget_show(list1);
+		gtk_box_pack_start(GTK_BOX(vbox2), list1, FALSE, FALSE, 0);
+
+		g_signal_connect(G_OBJECT(mainwindow), "destroy", G_CALLBACK(
+				gtk_main_quit), NULL);
+
+		g_signal_connect((gpointer) networkconfig, "activate", G_CALLBACK(
+				on_networkconfig_activate), NULL);
+		g_signal_connect((gpointer) loadsys, "activate", G_CALLBACK(
+				on_loadsys_activate), NULL);
+		g_signal_connect((gpointer) exitsys, "activate", G_CALLBACK(
+				on_exitsys_activate), NULL);
+		g_signal_connect((gpointer) addclass, "activate", G_CALLBACK(
+				on_addclass_activate), NULL);
+		g_signal_connect((gpointer) exitclass, "activate", G_CALLBACK(
+				on_exitclass_activate), NULL);
+		g_signal_connect((gpointer) requestchange, "activate", G_CALLBACK(
+				on_requestchange_activate), NULL);
+		g_signal_connect((gpointer) cancelchange, "activate", G_CALLBACK(
+				on_cancelchange_activate), NULL);
+		g_signal_connect((gpointer) about, "activate", G_CALLBACK(
+				on_about1_activate), NULL);
+		
+		g_signal_connect((gpointer) networktool, "clicked", G_CALLBACK(
+				on_networktool_clicked), NULL);
+
+		g_signal_connect((gpointer) loadtool, "clicked", G_CALLBACK(
+				on_loadtool_clicked), NULL);
+
+		g_signal_connect((gpointer) addclasstool, "clicked", G_CALLBACK(
+				on_addclasstool_clicked), NULL);
+
+		g_signal_connect((gpointer) exitclasstool, "clicked", G_CALLBACK(
+				on_exitclasstool_clicked), NULL);
+
+		g_signal_connect((gpointer) exchangetool, "clicked", G_CALLBACK(
+				on_exchangetool_clicked), NULL);
+
+		g_signal_connect((gpointer) cancelextool, "clicked", G_CALLBACK(
+				on_cancelextool_clicked), NULL);
+
+		g_signal_connect((gpointer) exittool, "clicked", G_CALLBACK(
+				on_exittool_clicked), NULL);
+
+		g_signal_connect((gpointer) studimagebut, "clicked", G_CALLBACK(
+				on_studimagebut_clicked), NULL);
+
+		g_signal_connect((gpointer) myimagebut, "clicked", G_CALLBACK(
+				on_myimagebut_clicked), NULL);
+
+		g_signal_connect((gpointer) sendchatbut, "clicked", G_CALLBACK(
+				on_sendchatbut_clicked), NULL);
+
+		g_signal_connect((gpointer) chatentry, "activate", G_CALLBACK(
+				on_chatentry_activate), NULL);
+		g_signal_connect((gpointer) clearchatbut, "clicked", G_CALLBACK(
+				on_clearchatbut_clicked), NULL);
+
+		g_signal_connect(G_OBJECT(mainwindow), "delete_event", G_CALLBACK(
+				mainwindow_delete_event), mainwindow);
+
+		return mainwindow;
+	}
+}
+
+GtkWidget*
+create_loaddialog(void)
+{
+	GtkWidget *loaddialog;
+	GtkWidget *dialog_vbox1;
+	GtkWidget *vbox3;
+	GtkWidget *hbox6;
+	GtkWidget *usename;
+
+	GtkWidget *hbox7;
+	GtkWidget *password;
+
+	GtkWidget *dialog_action_area1;
+	GtkWidget *loadcancelbut;
+	GtkWidget *loadokbutton;
+
+	loaddialog = gtk_dialog_new();
+	gtk_window_set_modal(GTK_WINDOW(loaddialog), TRUE);
+	gtk_widget_set_size_request(loaddialog, 281, 174);
+
+	//Windows Title Logon System
+	gtk_window_set_title(GTK_WINDOW(loaddialog), p_Window_Title_LogonSys);
+	
+	gtk_window_set_type_hint(GTK_WINDOW(loaddialog),
+			GDK_WINDOW_TYPE_HINT_DIALOG);
+
+	dialog_vbox1 = GTK_DIALOG(loaddialog)->vbox;
+	gtk_widget_show(dialog_vbox1);
+
+	vbox3 = gtk_vbox_new(FALSE, 0);
+	gtk_widget_show(vbox3);
+	gtk_box_pack_start(GTK_BOX(dialog_vbox1), vbox3, TRUE, TRUE, 0);
+
+	hbox6 = gtk_hbox_new(FALSE, 0);
+	gtk_widget_show(hbox6);
+	gtk_box_pack_start(GTK_BOX(vbox3), hbox6, TRUE, TRUE, 0);
+
+	//Static Text LogonSystem---->User Name
+	usename = gtk_label_new(p_LogonSys_StaticTxt_UserName);
+	
+	gtk_widget_show(usename);
+	gtk_box_pack_start(GTK_BOX(hbox6), usename, FALSE, FALSE, 0);
+	gtk_widget_set_size_request(usename, 39, 14);
+
+	nameentry = gtk_entry_new();
+	gtk_widget_show(nameentry);
+	gtk_box_pack_start(GTK_BOX(hbox6), nameentry, TRUE, TRUE, 0);
+	gtk_widget_set_size_request(nameentry, 158, 25);
+	gtk_entry_set_text(GTK_ENTRY(nameentry), namesave);
+
+	hbox7 = gtk_hbox_new(FALSE, 0);
+	gtk_widget_show(hbox7);
+	gtk_box_pack_start(GTK_BOX(vbox3), hbox7, TRUE, TRUE, 0);
+
+	//Static Text LogonSystem---->Password
+	password = gtk_label_new(p_LogonSys_StaticTxt_Password);
+	
+	gtk_widget_show(password);
+	gtk_box_pack_start(GTK_BOX(hbox7), password, FALSE, FALSE, 0);
+	gtk_widget_set_size_request(password, 39, 14);
+
+	psdentry = gtk_entry_new();
+	gtk_widget_show(psdentry);
+	gtk_box_pack_start(GTK_BOX(hbox7), psdentry, TRUE, TRUE, 0);
+	gtk_widget_set_size_request(psdentry, 158, 25);
+	gtk_entry_set_visibility(GTK_ENTRY(psdentry), FALSE);
+
+	dialog_action_area1 = GTK_DIALOG(loaddialog)->action_area;
+	gtk_widget_show(dialog_action_area1);
+	gtk_button_box_set_layout(GTK_BUTTON_BOX(dialog_action_area1),
+			GTK_BUTTONBOX_END);
+
+	//Buttons Logon Sysem Cancel
+	loadcancelbut = gtk_button_new_from_stock(p_LogonSys_Butt_Cancel);
+	
+	gtk_widget_show(loadcancelbut);
+	gtk_dialog_add_action_widget(GTK_DIALOG(loaddialog), loadcancelbut,
+			GTK_RESPONSE_CANCEL);
+	gtk_widget_set_size_request(loadcancelbut, 79, 32);
+	GTK_WIDGET_SET_FLAGS(loadcancelbut, GTK_CAN_DEFAULT);
+
+	//Buttons Logon Sysem OK
+	loadokbutton = gtk_button_new_from_stock(p_LogonSys_Butt_OK);
+	gtk_widget_show(loadokbutton);
+	gtk_dialog_add_action_widget(GTK_DIALOG(loaddialog), loadokbutton,
+			GTK_RESPONSE_OK);
+	GTK_WIDGET_SET_FLAGS(loadokbutton, GTK_CAN_DEFAULT);
+
+	g_signal_connect((gpointer) loadcancelbut, "clicked", G_CALLBACK(
+			on_loadcancelbut_clicked), loaddialog);
+
+	g_signal_connect((gpointer) loadokbutton, "clicked", G_CALLBACK(
+			on_loadokbutton_clicked), loaddialog);
+	return loaddialog;
+}
+
+GtkWidget*
+create_networkdialog(void)
+{
+	GtkWidget *networkdialog;
+	GtkWidget *dialog_vbox3;
+	GtkWidget *frame4;
+	GtkWidget *alignment5;
+	GtkWidget *table4;
+	GtkWidget *IPlabel;
+	GtkWidget *consolelabel;
+	GtkWidget *localIPlab;
+	GtkWidget *Teachaudiolab;
+	
+	GtkWidget *dialog_action_area3;
+	GtkWidget *Topconfigbutton;
+	GtkWidget *alignment4;
+	GtkWidget *hbox4;
+	GtkWidget *image1;
+	GtkWidget *label4;
+	GtkWidget *networkcancel;
+	GtkWidget *networkOk;
+	GtkTooltips *tooltips;
+
+	tooltips = gtk_tooltips_new();
+
+	networkdialog = gtk_dialog_new();
+
+	gtk_window_set_modal(GTK_WINDOW(networkdialog), TRUE);
+
+	gtk_widget_set_size_request(networkdialog, 371, 244);
+
+	//Network configuration Window Title Network Configure
+	gtk_window_set_title(GTK_WINDOW(networkdialog), p_Window_Title_NetConf);
+	
+	gtk_window_set_resizable(GTK_WINDOW(networkdialog), FALSE);
+	gtk_window_set_type_hint(GTK_WINDOW(networkdialog),
+			GDK_WINDOW_TYPE_HINT_DIALOG);
+	gtk_window_set_gravity(GTK_WINDOW(networkdialog), GDK_GRAVITY_STATIC);
+
+	dialog_vbox3 = GTK_DIALOG(networkdialog)->vbox;
+	gtk_widget_show(dialog_vbox3);
+
+	frame4 = gtk_frame_new(NULL);
+	gtk_widget_show(frame4);
+	gtk_box_pack_start(GTK_BOX(dialog_vbox3), frame4, TRUE, TRUE, 0);
+	gtk_widget_set_size_request(frame4, 397, 229);
+	gtk_frame_set_label_align(GTK_FRAME(frame4), 0, 0);
+	gtk_frame_set_shadow_type(GTK_FRAME(frame4), GTK_SHADOW_ETCHED_OUT);
+
+	alignment5 = gtk_alignment_new(0.5, 0.5, 1, 1);
+	gtk_widget_show(alignment5);
+	gtk_container_add(GTK_CONTAINER(frame4), alignment5);
+	gtk_alignment_set_padding(GTK_ALIGNMENT(alignment5), 0, 0, 12, 0);
+
+	table4 = gtk_table_new(4, 2, FALSE);
+	gtk_widget_show(table4);
+	gtk_container_add(GTK_CONTAINER(alignment5), table4);
+
+	//Network configuration Static Text Class Server Center IP Address
+	IPlabel = gtk_label_new(p_NetConf_StaticTxt_ClassServerIP);
+	
+	gtk_widget_show(IPlabel);
+	gtk_table_attach(GTK_TABLE(table4), IPlabel, 0, 1, 0, 1,
+			(GtkAttachOptions)(GTK_FILL), (GtkAttachOptions)(0), 0, 0);
+	gtk_widget_set_size_request(IPlabel, 105, 45);
+	gtk_misc_set_alignment(GTK_MISC(IPlabel), 0, 0.5);
+
+	//Network configuration Static Text Class Server Center Port
+	consolelabel = gtk_label_new(p_NetConf_StaticTxt_ClassServerPort);
+	
+	gtk_widget_show(consolelabel);
+	gtk_table_attach(GTK_TABLE(table4), consolelabel, 0, 1, 1, 2,
+			(GtkAttachOptions)(GTK_FILL), (GtkAttachOptions)(0), 0, 0);
+	gtk_widget_set_size_request(consolelabel, 105, 40);
+	gtk_misc_set_alignment(GTK_MISC(consolelabel), 0, 0.5);
+
+	//Network configuration Static Text User IP Address
+	localIPlab = gtk_label_new(p_NetConf_StaticTxt_UserIP);
+	
+	gtk_widget_show(localIPlab);
+	gtk_table_attach(GTK_TABLE(table4), localIPlab, 0, 1, 2, 3,
+			(GtkAttachOptions)(GTK_FILL), (GtkAttachOptions)(0), 0, 0);
+	gtk_widget_set_size_request(localIPlab, 105, 40);
+	gtk_misc_set_alignment(GTK_MISC(localIPlab), 0, 0.5);
+
+	//Network configuration Static Standard Receive Port
+	Teachaudiolab = gtk_label_new(p_NetConf_StaticTxt_StdRevPort);
+	
+	gtk_widget_show(Teachaudiolab);
+	gtk_table_attach(GTK_TABLE(table4), Teachaudiolab, 0, 1, 3, 4,
+			(GtkAttachOptions)(GTK_FILL), (GtkAttachOptions)(0), 0, 0);
+	gtk_widget_set_size_request(Teachaudiolab, 105, 40);
+	gtk_misc_set_alignment(GTK_MISC(Teachaudiolab), 0, 0.5);
+
+	IPentry = gtk_entry_new();
+	gtk_entry_set_text(GTK_ENTRY(IPentry), center.Center_IP);
+	printf("give IPENTERY is %s\n", center.Center_IP);
+
+	gtk_widget_show(IPentry);
+	gtk_table_attach(GTK_TABLE(table4), IPentry, 1, 2, 0, 1,
+			(GtkAttachOptions)(GTK_EXPAND | GTK_FILL), (GtkAttachOptions)(0),
+			0, 0);
+	gtk_widget_set_size_request(IPentry, 130, 32);
+	gtk_entry_set_invisible_char(GTK_ENTRY(IPentry), 9679);
+
+	centerport_entry = gtk_entry_new();
+	gtk_entry_set_text(GTK_ENTRY(centerport_entry), center.Center_port);
+	gtk_widget_set_sensitive(centerport_entry, FALSE);
+	gtk_widget_show(centerport_entry);
+	gtk_table_attach(GTK_TABLE(table4), centerport_entry, 1, 2, 1, 2,
+			(GtkAttachOptions)(GTK_EXPAND | GTK_FILL), (GtkAttachOptions)(0),
+			0, 0);
+	gtk_widget_set_size_request(centerport_entry, 130, 32);
+	gtk_entry_set_invisible_char(GTK_ENTRY(centerport_entry), 9679);
+
+	localIPentry = gtk_entry_new();
+	gtk_entry_set_text(GTK_ENTRY(localIPentry), IP);
+	gtk_widget_set_sensitive(localIPentry, FALSE);
+	gtk_widget_show(localIPentry);
+	gtk_table_attach(GTK_TABLE(table4), localIPentry, 1, 2, 2, 3,
+			(GtkAttachOptions)(GTK_EXPAND | GTK_FILL), (GtkAttachOptions)(0),
+			0, 0);
+	gtk_widget_set_size_request(localIPentry, 130, 32);
+	gtk_entry_set_invisible_char(GTK_ENTRY(localIPentry), 9679);
+
+	teachaudioentry = gtk_entry_new();
+	gtk_entry_set_text(GTK_ENTRY(teachaudioentry), "59872");
+	gtk_widget_set_sensitive(teachaudioentry, FALSE);
+	gtk_widget_show(teachaudioentry);
+	gtk_table_attach(GTK_TABLE(table4), teachaudioentry, 1, 2, 3, 4,
+			(GtkAttachOptions)(GTK_EXPAND | GTK_FILL), (GtkAttachOptions)(0),
+			0, 0);
+	gtk_widget_set_size_request(teachaudioentry, 130, 32);
+	gtk_entry_set_invisible_char(GTK_ENTRY(teachaudioentry), 9679);
+
+	dialog_action_area3 = GTK_DIALOG(networkdialog)->action_area;
+	gtk_widget_show(dialog_action_area3);
+	gtk_button_box_set_layout(GTK_BUTTON_BOX(dialog_action_area3),
+			GTK_BUTTONBOX_END);
+
+	Topconfigbutton = gtk_button_new();
+	gtk_widget_show(Topconfigbutton);
+	gtk_dialog_add_action_widget(GTK_DIALOG(networkdialog), Topconfigbutton,
+			GTK_RESPONSE_CANCEL);
+	GTK_WIDGET_SET_FLAGS(Topconfigbutton, GTK_CAN_DEFAULT);
+
+	//Network configuration Buttons Comment Amateur Cautious
+	gtk_tooltips_set_tip(tooltips, Topconfigbutton,
+			p_NetConf_Butt_Comment_AmateurCautious, NULL);
+	
+	alignment4 = gtk_alignment_new(0.5, 0.5, 0, 0);
+	gtk_widget_show(alignment4);
+	gtk_container_add(GTK_CONTAINER(Topconfigbutton), alignment4);
+
+	hbox4 = gtk_hbox_new(FALSE, 2);
+	gtk_widget_show(hbox4);
+	gtk_container_add(GTK_CONTAINER(alignment4), hbox4);
+
+	image1 = gtk_image_new_from_stock("gtk-apply", GTK_ICON_SIZE_BUTTON);
+	gtk_widget_show(image1);
+	gtk_box_pack_start(GTK_BOX(hbox4), image1, FALSE, FALSE, 0);
+
+	//Network configuration button advanced setting
+	label4 = gtk_label_new_with_mnemonic(p_NetConf_Butt_Advance);
+	
+	gtk_widget_show(label4);
+	gtk_box_pack_start(GTK_BOX(hbox4), label4, FALSE, FALSE, 0);
+
+	//Network configuration button Cancel
+	networkcancel = gtk_button_new_from_stock(p_Netconf_Butt_Cancel);
+	
+	gtk_widget_show(networkcancel);
+	gtk_dialog_add_action_widget(GTK_DIALOG(networkdialog), networkcancel,
+			GTK_RESPONSE_CANCEL);
+	GTK_WIDGET_SET_FLAGS(networkcancel, GTK_CAN_DEFAULT);
+
+	//Network configuration button Ok
+	networkOk = gtk_button_new_from_stock(p_Netconf_Butt_Ok);
+	gtk_widget_show(networkOk);
+	gtk_dialog_add_action_widget(GTK_DIALOG(networkdialog), networkOk,
+			GTK_RESPONSE_OK);
+	GTK_WIDGET_SET_FLAGS(networkOk, GTK_CAN_DEFAULT);
+
+	g_signal_connect((gpointer) Topconfigbutton, "clicked", G_CALLBACK(
+			on_Topconfigbutton_clicked), NULL);
+	g_signal_connect((gpointer) networkcancel, "clicked", G_CALLBACK(
+			on_networkcancel_clicked), networkdialog);
+	g_signal_connect((gpointer) networkOk, "clicked", G_CALLBACK(
+			on_networkOk_clicked), networkdialog);
+
+	return networkdialog;
+}
+
+GtkWidget*
+create_classdialog(void)
+{
+
+	GtkWidget *dialog_vbox4;
+	GtkWidget *vbox13;
+	GtkWidget *scrolledwindow2;
+
+	GtkWidget *IDlab;
+	GtkWidget *classnamelab;
+	GtkWidget *teachnamelab;
+	GtkWidget *statelab;
+	GtkWidget *intrudlab;
+	GtkWidget *dialog_action_area4;
+	GtkWidget *helpbutton1;
+	GtkWidget *classcancelbut;
+	GtkWidget *classokbut;
+
+	classdialog = gtk_dialog_new();
+	gtk_window_set_modal(GTK_WINDOW(classdialog), TRUE);
+	gtk_widget_set_size_request(classdialog, 594, 346);
+
+	//Class list dialog windows title 	
+	gtk_window_set_title(GTK_WINDOW(classdialog), p_Window_Title_ClassList);
+	gtk_window_set_type_hint(GTK_WINDOW(classdialog),
+			GDK_WINDOW_TYPE_HINT_DIALOG);
+
+	dialog_vbox4 = GTK_DIALOG(classdialog)->vbox;
+	gtk_widget_show(dialog_vbox4);
+
+	vbox13 = gtk_vbox_new(FALSE, 0);
+	gtk_widget_show(vbox13);
+	gtk_box_pack_start(GTK_BOX(dialog_vbox4), vbox13, TRUE, TRUE, 0);
+
+	scrolledwindow2 = gtk_scrolled_window_new(NULL, NULL);
+	gtk_widget_show(scrolledwindow2);
+	gtk_box_pack_start(GTK_BOX(vbox13), scrolledwindow2, TRUE, TRUE, 0);
+	gtk_widget_set_size_request(scrolledwindow2, 463, 74);
+	gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolledwindow2),
+			GTK_SHADOW_IN);
+
+	clist1 = gtk_clist_new(5);
+	gtk_widget_show(clist1);
+	gtk_container_add(GTK_CONTAINER(scrolledwindow2), clist1);
+	gtk_widget_set_size_request(clist1, 440, 32);
+	gtk_clist_set_column_width(GTK_CLIST(clist1), 0, 80);
+	gtk_clist_set_column_width(GTK_CLIST(clist1), 1, 80);
+	gtk_clist_set_column_width(GTK_CLIST(clist1), 2, 80);
+	gtk_clist_set_column_width(GTK_CLIST(clist1), 3, 80);
+	gtk_clist_set_column_width(GTK_CLIST(clist1), 4, 80);
+	gtk_clist_column_titles_show(GTK_CLIST(clist1));
+
+	//Class list dialog lable class ID
+	IDlab = gtk_label_new(p_Lable_ClassListDLG_ClassID);
+	//*^__^*IDlab = gtk_label_new ("ID");
+	gtk_widget_show(IDlab);
+	gtk_clist_set_column_widget(GTK_CLIST(clist1), 0, IDlab);
+
+	//Class list dialog lable class name
+	classnamelab = gtk_label_new(p_Lable_ClassListDLG_ClassName);
+	
+	gtk_widget_show(classnamelab);
+	gtk_clist_set_column_widget(GTK_CLIST(clist1), 1, classnamelab);
+
+	//Class list dialog lable teacher name
+	teachnamelab = gtk_label_new(p_Lable_ClassListDLG_TeacherName);
+	
+	gtk_widget_show(teachnamelab);
+	gtk_clist_set_column_widget(GTK_CLIST(clist1), 2, teachnamelab);
+
+	//Class list dialog lable class state
+	statelab = gtk_label_new(p_Lable_ClassListDLG_ClassState);
+	
+	gtk_widget_show(statelab);
+	gtk_clist_set_column_widget(GTK_CLIST(clist1), 3, statelab);
+
+	//Class list dialog lable class introduction
+	intrudlab = gtk_label_new(p_Lable_ClassListDLG_ClassIntro);
+	
+	gtk_widget_show(intrudlab);
+	gtk_clist_set_column_widget(GTK_CLIST(clist1), 4, intrudlab);
+
+	dialog_action_area4 = GTK_DIALOG(classdialog)->action_area;
+	gtk_widget_show(dialog_action_area4);
+	gtk_widget_set_size_request(dialog_action_area4, 410, 42);
+	gtk_button_box_set_layout(GTK_BUTTON_BOX(dialog_action_area4),
+			GTK_BUTTONBOX_END);
+
+	//Class list dialog button Help
+	helpbutton1 = gtk_button_new_from_stock(p_Butt_ClassListDLG_Help);
+	
+	gtk_widget_show(helpbutton1);
+	gtk_dialog_add_action_widget(GTK_DIALOG(classdialog), helpbutton1,
+			GTK_RESPONSE_HELP);
+	GTK_WIDGET_SET_FLAGS(helpbutton1, GTK_CAN_DEFAULT);
+
+	//Class list dialog button Cancle
+	classcancelbut = gtk_button_new_from_stock(p_Butt_ClassListDLG_Cancel);
+	
+	gtk_widget_show(classcancelbut);
+	gtk_dialog_add_action_widget(GTK_DIALOG(classdialog), classcancelbut,
+			GTK_RESPONSE_CANCEL);
+	GTK_WIDGET_SET_FLAGS(classcancelbut, GTK_CAN_DEFAULT);
+
+	//Class list dialog button OK
+	classokbut = gtk_button_new_from_stock(p_Butt_ClassListDLG_OK);
+	//*^__^*classokbut = gtk_button_new_from_stock ("gtk-ok");
+	gtk_widget_show(classokbut);
+	gtk_dialog_add_action_widget(GTK_DIALOG(classdialog), classokbut,
+			GTK_RESPONSE_OK);
+	GTK_WIDGET_SET_FLAGS(classokbut, GTK_CAN_DEFAULT);
+
+	g_signal_connect((gpointer) classcancelbut, "clicked", G_CALLBACK(
+			on_classcancelbut_clicked), classdialog);
+	
+	g_signal_connect((gpointer) classokbut, "clicked", G_CALLBACK(
+			on_classokbut_clicked), classdialog);
+	g_signal_connect(GTK_OBJECT(clist1), "select_row", G_CALLBACK(
+			select_clist_row), NULL);
+
+	return classdialog;
+}
+
+GtkWidget*
+create_stu_dialog(void)
+{
+	GtkWidget *stu_dialog;
+	GtkWidget *dialog_vbox5;
+	GtkWidget *stu_scroll;
+
+	GtkWidget *ClientID;
+	GtkWidget *stud_namelab;
+	GtkWidget *stateLab;
+	GtkWidget *dialog_action_area5;
+	GtkWidget *stulist_cancelbut;
+	GtkWidget *stulist_okbut;
+
+	stu_dialog = gtk_dialog_new();
+	gtk_widget_set_size_request(stu_dialog, 317, 419);
+
+	gtk_window_set_title(GTK_WINDOW(stu_dialog),
+			"\345\255\246\347\224\237\345\210\227\350\241\250");
+	gtk_window_set_resizable(GTK_WINDOW(stu_dialog), FALSE);
+	gtk_window_set_type_hint(GTK_WINDOW(stu_dialog),
+			GDK_WINDOW_TYPE_HINT_DIALOG);
+
+	dialog_vbox5 = GTK_DIALOG(stu_dialog)->vbox;
+	gtk_widget_show(dialog_vbox5);
+
+	stu_scroll = gtk_scrolled_window_new(NULL, NULL);
+	gtk_widget_show(stu_scroll);
+	gtk_box_pack_start(GTK_BOX(dialog_vbox5), stu_scroll, TRUE, TRUE, 0);
+	gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(stu_scroll),
+			GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+
+	stu_clist = gtk_clist_new(3);
+	gtk_widget_show(stu_clist);
+	gtk_container_add(GTK_CONTAINER(stu_scroll), stu_clist);
+	gtk_clist_set_column_width(GTK_CLIST(stu_clist), 0, 80);
+	gtk_clist_set_column_width(GTK_CLIST(stu_clist), 1, 80);
+	gtk_clist_set_column_width(GTK_CLIST(stu_clist), 2, 80);
+	gtk_clist_column_titles_show(GTK_CLIST(stu_clist));
+	gtk_clist_set_shadow_type(GTK_CLIST(stu_clist), GTK_SHADOW_ETCHED_IN);
+
+	ClientID = gtk_label_new("\345\255\246\347\224\237ID");
+	gtk_widget_show(ClientID);
+	gtk_clist_set_column_widget(GTK_CLIST(stu_clist), 0, ClientID);
+	gtk_widget_set_size_request(ClientID, 31, 13);
+	gtk_label_set_justify(GTK_LABEL(ClientID), GTK_JUSTIFY_CENTER);
+
+	stud_namelab = gtk_label_new("\345\255\246\347\224\237\345\220\215");
+	gtk_widget_show(stud_namelab);
+	gtk_clist_set_column_widget(GTK_CLIST(stu_clist), 1, stud_namelab);
+	gtk_widget_set_size_request(stud_namelab, 30, 11);
+	gtk_label_set_justify(GTK_LABEL(stud_namelab), GTK_JUSTIFY_CENTER);
+
+	stateLab
+			= gtk_label_new("\344\272\244\344\272\222\346\203\205\345\206\265");
+	gtk_widget_show(stateLab);
+	gtk_clist_set_column_widget(GTK_CLIST(stu_clist), 2, stateLab);
+	gtk_widget_set_size_request(stateLab, 30, 11);
+
+	dialog_action_area5 = GTK_DIALOG(stu_dialog)->action_area;
+	gtk_widget_show(dialog_action_area5);
+	gtk_widget_set_size_request(dialog_action_area5, 190, 42);
+	gtk_button_box_set_layout(GTK_BUTTON_BOX(dialog_action_area5),
+			GTK_BUTTONBOX_END);
+
+	stulist_cancelbut = gtk_button_new_from_stock("gtk-cancel");
+	gtk_widget_show(stulist_cancelbut);
+	gtk_dialog_add_action_widget(GTK_DIALOG(stu_dialog), stulist_cancelbut,
+			GTK_RESPONSE_CANCEL);
+	gtk_widget_set_size_request(stulist_cancelbut, 69, 32);
+	GTK_WIDGET_SET_FLAGS(stulist_cancelbut, GTK_CAN_DEFAULT);
+
+	stulist_okbut = gtk_button_new_from_stock("gtk-ok");
+	gtk_widget_show(stulist_okbut);
+	gtk_dialog_add_action_widget(GTK_DIALOG(stu_dialog), stulist_okbut,
+			GTK_RESPONSE_OK);
+	gtk_widget_set_size_request(stulist_okbut, 69, 32);
+	GTK_WIDGET_SET_FLAGS(stulist_okbut, GTK_CAN_DEFAULT);
+
+	g_signal_connect((gpointer) stulist_cancelbut, "clicked", G_CALLBACK(
+			on_stulist_cancelbut_clicked), stu_dialog);
+	g_signal_connect((gpointer) stulist_okbut, "clicked", G_CALLBACK(
+			on_stulist_okbut_clicked), stu_dialog);
+
+	return stu_dialog;
+}
+
+GtkWidget*
+create_about_dialog(void)
+{
+	GtkWidget *about_dialog;
+	GtkWidget *dialog_vbox7;
+	GtkWidget *scrolledwindow4;
+	GtkWidget *viewport2;
+	GtkWidget *scrolledwindow5;
+	GtkWidget *textview1;
+	GtkWidget *dialog_action_area7;
+	GtkWidget *about_ok;
+	about_dialog = gtk_dialog_new();
+	
+	gtk_widget_set_size_request(about_dialog, 430, 300);
+	
+	//About Dialog windows title
+	gtk_window_set_title(GTK_WINDOW(about_dialog), p_Window_Title_AboutDlg);
+	gtk_window_set_resizable(GTK_WINDOW(about_dialog), FALSE);
+	gtk_window_set_type_hint(GTK_WINDOW(about_dialog),
+			GDK_WINDOW_TYPE_HINT_DIALOG);
+
+	dialog_vbox7 = GTK_DIALOG(about_dialog)->vbox;
+	gtk_widget_show(dialog_vbox7);
+
+	scrolledwindow4 = gtk_scrolled_window_new(NULL, NULL);
+	gtk_widget_show(scrolledwindow4);
+	gtk_box_pack_start(GTK_BOX(dialog_vbox7), scrolledwindow4, TRUE, TRUE, 0);
+	gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolledwindow4),
+			GTK_POLICY_NEVER, GTK_POLICY_NEVER);
+	gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolledwindow4),
+			GTK_SHADOW_IN);
+
+	viewport2 = gtk_viewport_new(NULL, NULL);
+	gtk_widget_show(viewport2);
+	gtk_container_add(GTK_CONTAINER(scrolledwindow4), viewport2);
+
+	scrolledwindow5 = gtk_scrolled_window_new(NULL, NULL);
+	gtk_widget_show(scrolledwindow5);
+	gtk_container_add(GTK_CONTAINER(viewport2), scrolledwindow5);
+	gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolledwindow5),
+			GTK_POLICY_NEVER, GTK_POLICY_NEVER);
+	gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolledwindow5),
+			GTK_SHADOW_IN);
+
+	textview1 = gtk_text_view_new();
+	gtk_widget_show(textview1);
+	gtk_container_add(GTK_CONTAINER(scrolledwindow5), textview1);
+
+	//About Dialog Static text System informations
+	gtk_text_buffer_set_text(
+			gtk_text_view_get_buffer(GTK_TEXT_VIEW(textview1)),
+			p_StaticTxt_AboutDlg_AboutSys, -1);
+	
+	dialog_action_area7 = GTK_DIALOG(about_dialog)->action_area;
+	gtk_widget_show(dialog_action_area7);
+	gtk_widget_set_size_request(dialog_action_area7, 96, 42);
+	gtk_button_box_set_layout(GTK_BUTTON_BOX(dialog_action_area7),
+			GTK_BUTTONBOX_END);
+
+	//About Dialog Buttons OK
+	about_ok = gtk_button_new_from_stock(p_Butt_AboutDLG_OK);
+	
+	gtk_widget_show(about_ok);
+	gtk_dialog_add_action_widget(GTK_DIALOG(about_dialog), about_ok,
+			GTK_RESPONSE_OK);
+	GTK_WIDGET_SET_FLAGS(about_ok, GTK_CAN_DEFAULT);
+
+	g_signal_connect((gpointer) about_ok, "clicked", G_CALLBACK(
+			on_about_clicked), about_dialog);
+
+	return about_dialog;
+}
+
+GtkWidget*
+create_exit_class_dialog(void) 
+{
+	GtkWidget *exit_class_dialog;
+	GtkWidget *dialog_vbox10;
+	GtkWidget *vbox44;
+	GtkWidget *label90;
+	GtkWidget *label92;
+	GtkWidget *label91;
+	GtkWidget *dialog_action_area10;
+	GtkWidget *exit_class_cancel;
+	GtkWidget *exit_class_yes;
+
+	exit_class_dialog = gtk_dialog_new();
+	gtk_window_set_title(GTK_WINDOW(exit_class_dialog), (""));
+
+	//GTK_WINDOW (exit_rec_dialog)->type = GTK_WINDOW_POPUP;
+	gtk_window_set_resizable(GTK_WINDOW(exit_class_dialog), FALSE);
+	gtk_window_set_modal(GTK_WINDOW(exit_class_dialog), TRUE);
+	gtk_window_set_position(GTK_WINDOW(exit_class_dialog), GTK_WIN_POS_CENTER);
+	gtk_window_set_type_hint(GTK_WINDOW(exit_class_dialog),
+			GDK_WINDOW_TYPE_HINT_DIALOG);
+
+	dialog_vbox10 = GTK_DIALOG(exit_class_dialog)->vbox;
+	gtk_widget_show(dialog_vbox10);
+
+	vbox44 = gtk_vbox_new(FALSE, 0);
+	gtk_widget_show(vbox44);
+	gtk_box_pack_start(GTK_BOX(dialog_vbox10), vbox44, FALSE, FALSE, 0);
+
+	label90 = gtk_label_new("");
+	gtk_widget_show(label90);
+	gtk_box_pack_start(GTK_BOX(vbox44), label90, FALSE, FALSE, 0);
+	gtk_widget_set_size_request(label90, 48, 24);
+
+	//Quit Class Dialog Static text Quit Class~?
+	label92 = gtk_label_new(p_StaticTxt_QuitClassDLG_QuitClass);
+	
+	gtk_widget_show(label92);
+	gtk_box_pack_start(GTK_BOX(vbox44), label92, FALSE, FALSE, 0);
+
+	label91 = gtk_label_new("");
+	gtk_widget_show(label91);
+	gtk_box_pack_start(GTK_BOX(vbox44), label91, FALSE, FALSE, 0);
+	gtk_widget_set_size_request(label91, -1, 24);
+
+	dialog_action_area10 = GTK_DIALOG(exit_class_dialog)->action_area;
+	gtk_widget_show(dialog_action_area10);
+	gtk_widget_set_size_request(dialog_action_area10, -1, 32);
+	gtk_button_box_set_layout(GTK_BUTTON_BOX(dialog_action_area10),
+			GTK_BUTTONBOX_END);
+
+	//exit_rec_cancel = gtk_button_new_from_stock ("gtk-cancel");
+
+	//Quit Class Dialog Buttons Cancle Quit
+	exit_class_cancel = gtk_button_new_with_mnemonic(p_Butt_QuitClass_Cancel);
+	gtk_widget_show(exit_class_cancel);
+	gtk_dialog_add_action_widget(GTK_DIALOG(exit_class_dialog),
+			exit_class_cancel, GTK_RESPONSE_CANCEL);
+	gtk_widget_set_size_request(exit_class_cancel, -1, 20);
+	GTK_WIDGET_SET_FLAGS(exit_class_cancel, GTK_CAN_DEFAULT);
+
+	
+	//Quit Class Dialog Buttons Quit Class
+	exit_class_yes = gtk_button_new_with_mnemonic(p_Butt_QuitClass_QuitClass);
+	
+	gtk_widget_show(exit_class_yes);
+	gtk_dialog_add_action_widget(GTK_DIALOG(exit_class_dialog), exit_class_yes,
+			GTK_RESPONSE_OK);
+	GTK_WIDGET_SET_FLAGS(exit_class_yes, GTK_CAN_DEFAULT);
+
+	g_signal_connect((gpointer) exit_class_cancel, "clicked", G_CALLBACK(
+			on_exit_class_cancel_clicked), exit_class_dialog);
+	g_signal_connect((gpointer) exit_class_yes, "clicked", G_CALLBACK(
+			on_exit_class_yes_clicked), exit_class_dialog);
+
+	/* Store pointers to all widgets, for use by lookup_widget(). */
+
+	return exit_class_dialog;
+}
+
+GtkWidget*
+create_exit_system_dialog(void) 
+{
+	GtkWidget *exit_system_dialog;
+	GtkWidget *dialog_vbox10;
+	GtkWidget *vbox44;
+	GtkWidget *label90;
+	GtkWidget *label92;
+	GtkWidget *label91;
+	GtkWidget *dialog_action_area10;
+	GtkWidget *exit_system_cancel;
+	GtkWidget *exit_system_yes;
+
+	exit_system_dialog = gtk_dialog_new();
+	gtk_window_set_title(GTK_WINDOW(exit_system_dialog), (""));
+
+	//GTK_WINDOW (exit_rec_dialog)->type = GTK_WINDOW_POPUP;
+	gtk_window_set_resizable(GTK_WINDOW(exit_system_dialog), FALSE);
+	gtk_window_set_modal(GTK_WINDOW(exit_system_dialog), TRUE);
+	gtk_window_set_position(GTK_WINDOW(exit_system_dialog), GTK_WIN_POS_CENTER);
+	gtk_window_set_type_hint(GTK_WINDOW(exit_system_dialog),
+			GDK_WINDOW_TYPE_HINT_DIALOG);
+
+	dialog_vbox10 = GTK_DIALOG(exit_system_dialog)->vbox;
+	gtk_widget_show(dialog_vbox10);
+
+	vbox44 = gtk_vbox_new(FALSE, 0);
+	gtk_widget_show(vbox44);
+	gtk_box_pack_start(GTK_BOX(dialog_vbox10), vbox44, FALSE, FALSE, 0);
+
+	label90 = gtk_label_new("");
+	gtk_widget_show(label90);
+	gtk_box_pack_start(GTK_BOX(vbox44), label90, FALSE, FALSE, 0);
+	gtk_widget_set_size_request(label90, 48, 24);
+
+	//Static Text Exit Dialog ExitSystem??
+	label92 = gtk_label_new(p_StaticTxt_ExitSys);
+	gtk_widget_show(label92);
+	gtk_box_pack_start(GTK_BOX(vbox44), label92, FALSE, FALSE, 0);
+
+	label91 = gtk_label_new("");
+	gtk_widget_show(label91);
+	gtk_box_pack_start(GTK_BOX(vbox44), label91, FALSE, FALSE, 0);
+	gtk_widget_set_size_request(label91, -1, 24);
+
+	dialog_action_area10 = GTK_DIALOG(exit_system_dialog)->action_area;
+	gtk_widget_show(dialog_action_area10);
+	gtk_widget_set_size_request(dialog_action_area10, -1, 32);
+	gtk_button_box_set_layout(GTK_BUTTON_BOX(dialog_action_area10),
+			GTK_BUTTONBOX_END);
+
+	//exit_rec_cancel = gtk_button_new_from_stock ("gtk-cancel");
+
+	//Buttons ExitDialog Cancel
+	exit_system_cancel = gtk_button_new_with_mnemonic(p_ExitDialog_Butt_Cancel);
+	gtk_widget_show(exit_system_cancel);
+	gtk_dialog_add_action_widget(GTK_DIALOG(exit_system_dialog),
+			exit_system_cancel, GTK_RESPONSE_CANCEL);
+	gtk_widget_set_size_request(exit_system_cancel, -1, 20);
+	GTK_WIDGET_SET_FLAGS(exit_system_cancel, GTK_CAN_DEFAULT);
+
+	//Buttons ExitDialog Yes
+	exit_system_yes = gtk_button_new_with_mnemonic(p_ExitDialog_Butt_Yes);
+	gtk_widget_show(exit_system_yes);
+	gtk_dialog_add_action_widget(GTK_DIALOG(exit_system_dialog),
+			exit_system_yes, GTK_RESPONSE_OK);
+	GTK_WIDGET_SET_FLAGS(exit_system_yes, GTK_CAN_DEFAULT);
+
+	g_signal_connect((gpointer) exit_system_cancel, "clicked", G_CALLBACK(
+			on_exit_system_cancel_clicked), exit_system_dialog);
+	g_signal_connect((gpointer) exit_system_yes, "clicked", G_CALLBACK(
+			on_exit_system_yes_clicked), exit_system_dialog);
+
+	/* Store pointers to all widgets, for use by lookup_widget(). */
+
+	return exit_system_dialog;
+}
+
+void Error_dia(gchar *input, gchar *solution)
+{
+	GtkWidget *Message_dia;
+	gchar message[100];
+	strcpy(message, input);
+	strcat(message, solution);
+
+	Message_dia = gtk_message_dialog_new(NULL, GTK_DIALOG_MODAL,
+			GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, message);
+	gtk_dialog_run(GTK_DIALOG(Message_dia));
+	gtk_widget_destroy(Message_dia);
+}
+
+void get_networkconfig()
+{
+	DWORD Dtv_port;
+	DWORD Dta_port;
+	DWORD Dts_port;
+	DWORD Dsa_port;
+	DWORD Dsv_port;
+
+	const char *LocalIP = gtk_entry_get_text(GTK_ENTRY(localIPentry));
+	const char *classcenterIP = gtk_entry_get_text(GTK_ENTRY(IPentry));
+	const char *classcenterport = gtk_entry_get_text(
+			GTK_ENTRY(centerport_entry));
+
+	const char *ta_port = gtk_entry_get_text(GTK_ENTRY(teachaudioentry));
+
+	strcpy(CenterIP, classcenterIP);
+	strcpy(CenterPort, classcenterport);
+	strcpy(center.Center_port, CenterPort);
+	strcpy(center.Center_IP, CenterIP);
+	printf("get centerport config is %s\n", classcenterport);
+	Dta_port = atol(ta_port);
+	Dtv_port = Dta_port + 2;
+	Dts_port = Dta_port + 4;
+	Dsa_port = Dta_port + 6;
+	Dsv_port = Dta_port + 8;
+
+	config_file_write();
+	strcpy(stulogin.ClientIP, LocalIP);
+	stulogin.SeMCU_TAPort = Dta_port;
+	stulogin.SeMCU_TVPort = Dtv_port;
+	stulogin.SeMCU_TSPort = Dts_port;
+	stulogin.SeMCU_SAPort = Dsa_port;
+	stulogin.SeMCU_SVPort = Dsv_port;
+}
+
+void get_loadsys()
+{
+	const char *name = gtk_entry_get_text(GTK_ENTRY(nameentry));
+	const char *psd = gtk_entry_get_text(GTK_ENTRY(psdentry));
+	strcpy(namesave, name);
+	strcpy(stulogin.ClientName, name);
+	strcpy(stulogin.ClientPass, psd);
+	stulogin.ClientVersionID = 1.0;
+	cout << "stulogin.ClientName" << " " << stulogin.ClientName << endl;
+	cout << "stulogin.ClientPass" << " " << stulogin.ClientPass << endl;
+}

Added: incubator/bluesky/trunk/RealClass/Student/src/interface.h
URL: http://svn.apache.org/viewvc/incubator/bluesky/trunk/RealClass/Student/src/interface.h?rev=819907&view=auto
==============================================================================
--- incubator/bluesky/trunk/RealClass/Student/src/interface.h (added)
+++ incubator/bluesky/trunk/RealClass/Student/src/interface.h Tue Sep 29 12:36:46 2009
@@ -0,0 +1,216 @@
+#if !defined(INTERFACE_H)
+#define INTERFACE_H
+struct class_center
+{
+	char Center_IP[25];
+	char Center_port[8];
+};
+void config_file_read();
+
+GtkWidget* create_mainwindow(void);
+GtkWidget* create_loaddialog(void);
+
+GtkWidget*create_networkdialog(void);
+GtkWidget* create_classdialog(void);
+GtkWidget* create_stu_dialog(void);
+GtkWidget*create_about_dialog(void);
+GtkWidget*create_exit_class_dialog(void);
+GtkWidget*create_exit_system_dialog(void);
+void
+Error_dia(gchar *input, gchar *solution);
+void get_networkconfig();
+void get_loadsys();
+
+//windows title Main Frame
+extern char* p_window_title_MainFrame;
+
+//toolbar options---->start
+extern char* p_toolbar_start;
+
+//toolbar options---->start---->network configuration
+extern char* p_toolbar_start_NetConf;
+
+//toolbar options---->start---->logon system
+extern char* p_toolbar_start_LogonSys;
+
+//toolbar options---->start---->exit system
+extern char* p_toolbar_start_ExitSys;
+
+//toolbar options---->class
+extern char* p_toolbar_Class;
+
+//toolbar options---->class---->join class 
+extern char* p_toolbar_Class_Join;
+
+//toolbar options---->class---->quit class 
+extern char* p_toolbar_Class_Quit;
+
+//toolbar options---->operations 
+extern char* p_toolbar_Operations;
+
+//toolbar options---->operations---->interactive 
+extern char* p_toolbar_Operations_Interactive;
+
+//toolbar options---->operations---->Quit interactive 
+extern char* p_toolbar_Operations_QInteractive;
+
+//toolbar options---->help 
+extern char* p_toolbar_Help;
+
+//toolbar options---->help---->about 
+extern char* p_toolbar_Help_About;
+
+//Graphic Buttons Network Configure 
+extern char* p_GraphButt_NetConf;
+
+//Graphic Buttons Comment Network configuration 
+extern char* p_GraphButt_Comment_NetConf;
+
+//Graphic Buttons Logon System 
+extern char* p_GraphButt_LogSys;
+
+//Graphic Buttons Comment Logon System 
+extern char* p_GraphButt_Comment_LogSys;
+
+//Graphic Buttons Join Class 
+extern char* p_GraphButt_JoinClass;
+
+//Graphic Buttons Comment Join Class 
+extern char* p_GraphButt_Comment_JoinClass;
+
+//Graphic Buttons Quit Class 
+extern char* p_GraphButt_QuitClass;
+
+//Graphic Buttons Comment Quit Class 
+extern char* p_GraphButt_Comment_QuitClass;
+
+//Graphic Buttons Interactive 
+extern char* p_GraphButt_Interactive;
+
+//Graphic Buttons Comment Interactive 
+extern char* p_GraphButt_Comment_Interactive;
+
+//Graphic Buttons Quit interactive
+extern char* p_GraphButt_QInteractive;
+
+//Graphic Buttons Comment Quit Interactive 
+extern char* p_GraphButt_Comment_QInteractive;
+
+//Graphic Buttons Exit System
+extern char* p_GraphButt_ExitSys;
+
+//Graphic Buttons Comment Exit System 
+extern char* p_GraphButt_Comment_ExitSys;
+
+//Buttons Student View
+extern char* p_Butt_StuView;
+
+//Buttons My View
+extern char* p_Butt_MyView;
+
+//Static text Input Message
+extern char* p_StaticTxt_InputMessage;
+
+//Buttons Send Message
+extern char* p_Butt_SendMessage;
+
+//Buttons Clear Message
+extern char* p_Butt_ClearMessage;
+
+//Windows Title Logon System
+extern char * p_Window_Title_LogonSys;
+
+//Static Text LogonSystem---->User Name
+extern char * p_LogonSys_StaticTxt_UserName;
+
+//Static Text LogonSystem---->Password
+extern char * p_LogonSys_StaticTxt_Password;
+
+//Logon System button Cancel
+extern char * p_LogonSys_Butt_Cancel;
+
+//Logon System button OK
+extern char * p_LogonSys_Butt_OK;
+
+//Windows Title Network configuration
+extern char * p_Window_Title_NetConf;
+
+//Static Text Network configuration---->Class Server Center IP Address
+extern char * p_NetConf_StaticTxt_ClassServerIP;
+
+//Static Text Network configuration---->Class Server Center Port
+extern char * p_NetConf_StaticTxt_ClassServerPort;
+
+//Static Text Network configuration---->User IP Address
+extern char * p_NetConf_StaticTxt_UserIP;
+
+//Static Text Network configuration---->Standard Receive Port
+extern char * p_NetConf_StaticTxt_StdRevPort;
+
+//Network configuration Buttons Comment Amateur Cautious
+extern char * p_NetConf_Butt_Comment_AmateurCautious;
+
+//Network configuration Buttons Advanced settings
+extern char * p_NetConf_Butt_Advance;
+
+//Network configuration button Cancel
+extern char * p_Netconf_Butt_Cancel;
+
+//Network configuration button OK
+extern char * p_Netconf_Butt_Ok;
+
+//Static Text Exit Dialog??
+extern char * p_StaticTxt_ExitSys;
+//
+//Buttons ExitDialog Cancel
+extern char * p_ExitDialog_Butt_Cancel;
+//
+//Buttons ExitDialog Yes
+extern char * p_ExitDialog_Butt_Yes;
+
+//windows title class list
+extern char * p_Window_Title_ClassList;
+//
+//Class list dialog lable class ID
+extern char * p_Lable_ClassListDLG_ClassID;
+//
+//Class list dialog lable class name
+extern char * p_Lable_ClassListDLG_ClassName;
+//
+//Class list dialog lable teacher name
+extern char * p_Lable_ClassListDLG_TeacherName;
+//
+//Class list dialog lable class state
+extern char * p_Lable_ClassListDLG_ClassState;
+//
+//Class list dialog lable class introduction
+extern char * p_Lable_ClassListDLG_ClassIntro;
+//
+//Class list dialog button Help
+extern char * p_Butt_ClassListDLG_Help;
+//
+//Class list dialog button Cancel
+extern char * p_Butt_ClassListDLG_Cancel;
+//
+//Class list dialog button OK
+extern char * p_Butt_ClassListDLG_OK;
+
+//Quit Class Dialog Static text Quit Class~?
+extern char * p_StaticTxt_QuitClassDLG_QuitClass;
+//
+//Quit Class Dialog Buttons Cancle Quit
+extern char * p_Butt_QuitClass_Cancel;
+//
+//Quit Class Dialog Buttons Quit Class
+//
+extern char * p_Butt_QuitClass_QuitClass;
+
+//About Dialog windows title
+extern char * p_Window_Title_AboutDlg;
+//
+//About Dialog Static text System informations
+extern char * p_StaticTxt_AboutDlg_AboutSys;
+//
+//About Dialog Buttons OK
+extern char * p_Butt_AboutDLG_OK;
+#endif

Added: incubator/bluesky/trunk/RealClass/Student/src/ncclient.hh
URL: http://svn.apache.org/viewvc/incubator/bluesky/trunk/RealClass/Student/src/ncclient.hh?rev=819907&view=auto
==============================================================================
--- incubator/bluesky/trunk/RealClass/Student/src/ncclient.hh (added)
+++ incubator/bluesky/trunk/RealClass/Student/src/ncclient.hh Tue Sep 29 12:36:46 2009
@@ -0,0 +1,331 @@
+#ifndef _NCCLIENT_H
+#define _NCCLIENT_H
+
+#include<stdio.h>
+#include<string.h>
+#define CLIENT_SIZE  200 
+
+typedef unsigned long DWORD;
+struct CRCLMSG
+{
+	DWORD rclType;
+	DWORD msglen;
+	char msg[10000];
+};
+
+struct TRCClientLogin
+{
+	char ClientName[CLIENT_SIZE];
+	DWORD ClientVersionID;
+	char ClientPass[16];
+	char ClientIP[16];
+
+	DWORD SeMCU_TAPort;
+	DWORD SeMCU_TVPort;
+	DWORD SeMCU_TSPort;
+	DWORD SeMCU_SAPort;
+	DWORD SeMCU_SVPort;
+
+};
+
+struct TGroupInfo
+{
+	DWORD GroupID;
+	char GroupName[128];
+	char TeacherName[CLIENT_SIZE];
+};
+struct TClientInfo
+{
+	int ClientID;
+	char ClientN[CLIENT_SIZE];
+};
+
+struct TRCClientLoginR
+{
+	DWORD ResponseType;
+	DWORD ClientID;
+	DWORD ClientType;
+};
+struct TRCClientLogout
+{
+	int ClientID;
+};
+
+struct TRCDestoryGroup
+{
+	int TeacherID;
+	int GroupID;
+};
+
+struct TRCDestoryGroupR
+{
+	int ResponseType;
+};
+struct TRCDestoryGroupRToClient
+{
+	int GroupID;
+};
+
+struct TRCClientJionInGroup
+{
+	int ClientID;
+	int GroupID;
+	int C_TAPort;
+	int C_TVPort;
+	int C_TScrPort;
+	int C_CAPort;
+	int C_CVPort;
+};
+
+struct TSState
+{
+	int ClientID;
+	char ClientN[CLIENT_SIZE];
+	int AVMode;
+};
+struct CRCLClientJoinInGroupR
+{
+	DWORD ResponseType;
+	DWORD GroupID;
+	char MCUIP[16]; //MCU IP
+	char SeMCUIP[16];//MCUIP
+	DWORD TAPort;
+	DWORD TVPort;
+	DWORD TSPort;
+	DWORD CAPort;
+	DWORD CVPort;
+	DWORD RoomMode;
+};
+
+struct TRCNewClientJionInGroupR
+{
+	int ResponseType;
+	int GroupID;
+	char TU_IP[16];
+	char SeTUIP;
+	int TU_TAPort;
+	int TU_TVPort;
+	int TU_TScrPort;
+	int TU_CAPort;
+	int TU_CVPort;
+	int IfseTU;
+};
+struct TRCNewClientJionInGroupRToSeTUClient
+{
+	int ClientID;
+	char ClientIP[16];
+	int C_TAPort;
+	int C_TVPort;
+	int C_TScrPort;
+	int C_CAPort;
+	int C_CVPort;
+};
+
+struct TRCClientJionInGroupRToAll
+{
+	struct TSState ClientInfo;
+};
+
+struct TRCClientLeaveGroup
+{
+	int ClientID;
+	int GroupID;
+};
+struct TRCClientLeaveGroupR
+{
+	int ResponseType;
+	int GroupID;
+};
+
+struct TRCClientLeaveGroupRToAll
+{
+	struct TSState ClientInfo;
+};
+
+struct TRCClientLeaveGroupRToMCU
+{
+	struct TClientInfo ClientInfo;
+
+};
+
+struct TRCMCILeaveGroup
+{
+	int MCUID; //MCU ID
+};
+
+struct TRCMCULeaveGroupRToOther
+{
+	int GroupID;
+};
+
+struct TRCSeMCULeaveGroupR
+{
+	int ResponseType;
+};
+
+struct TRCSeMCULeaveGroupRToClient
+{
+	int SeMCUID;
+};
+
+struct TRCClientGetGroupInfo
+{
+	DWORD ClientID;
+};
+
+struct TRCClientGetGroupInfoR
+{
+	int ResponseType;
+	DWORD GroupCount;
+	DWORD groupchatMode;
+	struct TGroupInfo GroupList[10];
+
+};
+
+struct TCRCLTeacherTextBroadcast
+{
+	int TeacherID;
+	int GroupID;
+	char TeacherN[CLIENT_SIZE];
+	int InfoLength;
+	char Info[1024];
+};
+
+struct TCRCLTeacherTextBroadcastR
+{
+	char TeacherN[CLIENT_SIZE];
+	int InfoLength;
+	char Info[1024];
+};
+
+struct TCRCLClientApplyFocus
+{
+	int ClientID;
+	int GroupID;
+};
+
+struct TCRCLClientApplyFocusR
+{
+	int ResponseType;
+};
+
+struct TCRCLClientDestroyFocus
+{
+	int ClientID;
+	int GroupID;
+};
+
+struct TCRCLClientDestroyFocusR
+{
+	int ResponseType;
+};
+
+struct TCRCLClientTextBroadcast
+{
+	int ClientID;
+	int GroupID;
+	int InfoLength;
+	char Info[1024];
+};
+
+struct TCRCLClientTextBroadcastR
+{
+	char ClientName[CLIENT_SIZE];
+	int InfoLength;
+	char Info[1024];
+};
+
+struct CRCLClientGetClientInfo
+{
+	int ClientID;
+	int GroupID;
+};
+
+struct TCRCLClientGetClientInfoR
+{
+	int ResponseType;
+	int ClientCount;
+	struct TSState ClientList[1024];
+};
+
+struct TCRCLTeacherAllowClientFocus
+{
+	int TeacherID;
+	int ClientID;
+	int GroupID;
+};
+
+struct TCRCLTeacherAllowClientFocusR
+{
+	int ResponseType;
+	int ClientID;
+};
+
+struct TCRCLTeacherAllowClientFocusRToMS
+{
+	int FocusClientID;
+};
+
+struct TCRCLTeacherCancelClientFocus
+{
+	int TeacherID;
+	int ClientID;
+	int GroupID;
+};
+
+struct TCRCLTeacherCancelClientFocusR
+{
+	int ResponseType;
+	int ClientID;
+};
+
+struct TCRCLTeacherSwitchModeR
+{
+	DWORD ModeType; //0 chat 1 teach
+};
+
+struct TCRCLTeacherCancelClientFocusRToMS
+{
+	int ClientID;
+};
+
+//ID 1092
+struct TCRCLTeacherAgreeChat
+{
+
+	DWORD Agreechat; //agree 1,don't agree 0	
+
+};
+
+struct TPara
+{
+	char LocalIP[50];
+	char MCUIP[50];
+	char StudentN[30];
+	char PassWord[30];
+	char TeacherN[30];
+	char CourseN[50];
+	int ClientID;
+	int GroupID;
+	int C_TAPort;
+	int C_TVPort;
+	int C_TScrPort;
+	int C_CAPort;
+	int C_CVPort;
+
+	int TAPort;
+	int TVPort;
+	int TscrPort;
+	int SAPort;
+	int SVPort;
+
+	int MCU_CAPort;
+	int MCU_CVPort;
+	char *CenterIP;
+	int CenterPort;
+	int ClientType;
+	int IfSeMCUClient;
+	char *SeTUClient_MCU_IP;
+};
+
+#endif

Added: incubator/bluesky/trunk/RealClass/Student/src/pic/screen.bmp
URL: http://svn.apache.org/viewvc/incubator/bluesky/trunk/RealClass/Student/src/pic/screen.bmp?rev=819907&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/bluesky/trunk/RealClass/Student/src/pic/screen.bmp
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/bluesky/trunk/RealClass/Student/src/pic/teacher2.bmp
URL: http://svn.apache.org/viewvc/incubator/bluesky/trunk/RealClass/Student/src/pic/teacher2.bmp?rev=819907&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/bluesky/trunk/RealClass/Student/src/pic/teacher2.bmp
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/bluesky/trunk/RealClass/Student/src/singlecomm.cpp
URL: http://svn.apache.org/viewvc/incubator/bluesky/trunk/RealClass/Student/src/singlecomm.cpp?rev=819907&view=auto
==============================================================================
--- incubator/bluesky/trunk/RealClass/Student/src/singlecomm.cpp (added)
+++ incubator/bluesky/trunk/RealClass/Student/src/singlecomm.cpp Tue Sep 29 12:36:46 2009
@@ -0,0 +1,106 @@
+// CSingleComm.cpp: implementation of the CSingleComm class.
+
+#include "asyncsocketex.h"
+#include "singlecomm.h"
+
+#define SOCKETMUTEX_LOCK	{\
+							socketmutex.Lock();	\
+							}
+
+#define SOCKETMUTEX_UNLOCK	{	\
+							socketmutex.Unlock();}
+
+CSingleComm::CSingleComm()
+{
+
+	m_socket = 0;
+}
+
+CSingleComm::~CSingleComm()
+{
+
+	m_socket = 0;
+}
+
+bool CSingleComm::Init()
+{
+	if (!CTCPComm::Init())
+		return false;
+
+	if (!socketmutex.IsInitialized())
+	{
+		if (socketmutex.Init() < 0)
+			return false;
+	}
+
+	return true;
+}
+
+int CSingleComm::OnPollThreadError(int status)
+{
+
+	return -1;
+}
+
+int CSingleComm::Poll()
+{
+	int nRes;
+	SOCKETMUTEX_LOCK
+
+	if (m_socket == 0)
+	{
+		SOCKETMUTEX_UNLOCK
+		return 0;
+	}
+
+	nRes = m_socket->Poll();
+	if (nRes < 0)
+	{
+		SOCKETMUTEX_UNLOCK
+		return nRes;
+	}
+
+	m_socket->SetStatus(nRes);
+
+	SOCKETMUTEX_UNLOCK
+	return nRes;
+}
+
+int CSingleComm::PolledSocket()
+{
+
+	SOCKETMUTEX_LOCK
+
+	if (m_socket == 0)
+	{
+		SOCKETMUTEX_UNLOCK
+		return 0;
+	}
+
+	m_socket->OnEvent();
+
+	SOCKETMUTEX_UNLOCK
+	return 1;
+}
+
+void CSingleComm::Attach(CAsyncSocketEx* socket)
+{
+	SOCKETMUTEX_LOCK
+
+	m_socket = socket;
+	SOCKETMUTEX_UNLOCK
+}
+
+CAsyncSocketEx* CSingleComm::Detach()
+{
+	SOCKETMUTEX_LOCK
+	CAsyncSocketEx* p = m_socket;
+	m_socket = 0;
+	SOCKETMUTEX_UNLOCK
+	return p;
+}
+
+void CSingleComm::OnPollThreadStep()
+{
+	usleep(200000);
+}

Added: incubator/bluesky/trunk/RealClass/Student/src/singlecomm.h
URL: http://svn.apache.org/viewvc/incubator/bluesky/trunk/RealClass/Student/src/singlecomm.h?rev=819907&view=auto
==============================================================================
--- incubator/bluesky/trunk/RealClass/Student/src/singlecomm.h (added)
+++ incubator/bluesky/trunk/RealClass/Student/src/singlecomm.h Tue Sep 29 12:36:46 2009
@@ -0,0 +1,29 @@
+// CSingleComm.h: interface for the CSingleComm class.
+
+#if !defined(SINGLECOMM_H)
+#define SINGLECOMM_H
+
+#include <jmutex.h>
+#include "tcpcomm.h"
+
+class CSingleComm: public CTCPComm
+{
+public:
+	CAsyncSocketEx* Detach();
+	void Attach(CAsyncSocketEx* socket);
+	CSingleComm();
+	virtual ~CSingleComm();
+	virtual bool Init();
+
+protected:
+	virtual void OnPollThreadStep();
+	virtual int OnPollThreadError(int status);
+	virtual int PolledSocket();
+	virtual int Poll();
+
+private:
+	JMutex socketmutex;
+	CAsyncSocketEx* m_socket;
+};
+
+#endif // !defined(SINGLECOMM_H)

Added: incubator/bluesky/trunk/RealClass/Student/src/stdafx.h
URL: http://svn.apache.org/viewvc/incubator/bluesky/trunk/RealClass/Student/src/stdafx.h?rev=819907&view=auto
==============================================================================
--- incubator/bluesky/trunk/RealClass/Student/src/stdafx.h (added)
+++ incubator/bluesky/trunk/RealClass/Student/src/stdafx.h Tue Sep 29 12:36:46 2009
@@ -0,0 +1,40 @@
+// stdafx.h : include file for standard system include files,
+//  or project specific include files that are used frequently, but
+//      are changed infrequently
+//
+
+#if !defined(STDAFX_H_LINUX)
+#define STDAFX_H_LINUX
+	#include <sys/socket.h>
+	#include <netinet/in.h>
+	#include <arpa/inet.h>
+	#include <sys/ioctl.h>
+	#include <net/if.h>
+	#include <string.h>
+	#include <netdb.h>
+	#include <unistd.h>
+	#include <stdio.h>
+
+
+	#define RTPSOCKERR					-1
+
+
+
+	//#define FALSE						false	
+	//#define TRUE							true	
+	#define INVALID_SOCKET				0
+	#define SOCKET_ERROR  			    RTPSOCKERR
+
+	#define IOCTL						ioctl
+	#define CLOSESOCKET(x)				close(x);
+
+	typedef int							SOCKET;
+	typedef sockaddr					SOCKADDR;
+	typedef struct sockaddr_in		SOCKADDR_IN;
+//	typedef bool							BOOL;
+	typedef unsigned int				UINT;
+	typedef const char*					LPCTSTR;
+	typedef char*						LPSTR;
+	typedef unsigned long				DWORD;
+	typedef struct hostent				HOSTENT, *LPHOSTENT;
+#endif // !defined(STDAFX_H_LINUX)

Added: incubator/bluesky/trunk/RealClass/Student/src/support.cc
URL: http://svn.apache.org/viewvc/incubator/bluesky/trunk/RealClass/Student/src/support.cc?rev=819907&view=auto
==============================================================================
--- incubator/bluesky/trunk/RealClass/Student/src/support.cc (added)
+++ incubator/bluesky/trunk/RealClass/Student/src/support.cc Tue Sep 29 12:36:46 2009
@@ -0,0 +1,96 @@
+
+#ifdef HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <string.h>
+#include <stdio.h>
+#include <gtk/gtk.h>
+
+#include "support.hh"
+
+static GList *pixmaps_directories = NULL;
+
+/* Use this function to set the directory containing installed pixmaps. */
+void add_pixmap_directory(const gchar *directory)
+{
+	pixmaps_directories = g_list_prepend(pixmaps_directories, g_strdup(
+			directory));
+}
+
+/* This is an internally used function to find pixmap files. */
+static gchar*
+find_pixmap_file(const gchar *filename)
+{
+	GList *elem;
+
+	/* We step through each of the pixmaps directory to find it. */
+	elem = pixmaps_directories;
+	while (elem)
+	{
+		gchar *pathname = g_strdup_printf("%s%s%s", (gchar*) elem->data,
+				G_DIR_SEPARATOR_S, filename);
+		if (g_file_test(pathname, G_FILE_TEST_EXISTS))
+			return pathname;
+		g_free(pathname);
+		elem = elem->next;
+	}
+	return NULL;
+}
+
+/* This is an internally used function to create pixmaps. */
+GtkWidget*
+create_pixmap(GtkWidget *widget, const gchar *filename)
+{
+	gchar *pathname = NULL;
+	GtkWidget *pixmap;
+
+	if (!filename || !filename[0])
+		return gtk_image_new();
+
+	pathname = find_pixmap_file(filename);
+
+	if (!pathname)
+	{
+		g_warning("Couldn't find pixmap file: %s", filename);
+		return gtk_image_new();
+	}
+
+	pixmap = gtk_image_new_from_file(pathname);
+	g_free(pathname);
+	return pixmap;
+}
+
+/* This is an internally used function to create pixmaps. */
+GdkPixbuf*
+create_pixbuf(const gchar *filename)
+{
+	gchar *pathname = NULL;
+	GdkPixbuf *pixbuf;
+	GError *error = NULL;
+
+	if (!filename || !filename[0])
+		return NULL;
+
+	pathname = find_pixmap_file(filename);
+
+	if (!pathname)
+	{
+		g_warning("Couldn't find pixmap file: %s", filename);
+		return NULL;
+	}
+
+	pixbuf = gdk_pixbuf_new_from_file(pathname, &error);
+	if (!pixbuf)
+	{
+		fprintf(stderr, "Failed to load pixbuf file: %s: %s\n", pathname,
+				error->message);
+		g_error_free(error);
+	}
+	g_free(pathname);
+	return pixbuf;
+}
+

Added: incubator/bluesky/trunk/RealClass/Student/src/support.hh
URL: http://svn.apache.org/viewvc/incubator/bluesky/trunk/RealClass/Student/src/support.hh?rev=819907&view=auto
==============================================================================
--- incubator/bluesky/trunk/RealClass/Student/src/support.hh (added)
+++ incubator/bluesky/trunk/RealClass/Student/src/support.hh Tue Sep 29 12:36:46 2009
@@ -0,0 +1,15 @@
+#ifdef HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
+#include <gtk/gtk.h>
+
+/* Use this function to set the directory containing installed pixmaps. */
+void add_pixmap_directory(const gchar *directory);
+
+/* This is used to create the pixmaps used in the interface. */
+GtkWidget* create_pixmap(GtkWidget *widget, const gchar *filename);
+
+/* This is used to create the pixbufs used in the interface. */
+GdkPixbuf* create_pixbuf(const gchar *filename);
+

Added: incubator/bluesky/trunk/RealClass/Student/src/tcpcomm.cpp
URL: http://svn.apache.org/viewvc/incubator/bluesky/trunk/RealClass/Student/src/tcpcomm.cpp?rev=819907&view=auto
==============================================================================
--- incubator/bluesky/trunk/RealClass/Student/src/tcpcomm.cpp (added)
+++ incubator/bluesky/trunk/RealClass/Student/src/tcpcomm.cpp Tue Sep 29 12:36:46 2009
@@ -0,0 +1,66 @@
+// TCPComm.cpp: implementation of the CTCPComm class.
+
+#include "stdafx.h"
+#include "asyncsocketex.h"
+#include "tcpcomm.h"
+#include "tcppollthread.h"
+
+CTCPComm::CTCPComm()
+{
+
+	m_pThread = 0;
+}
+
+CTCPComm::~CTCPComm()
+{
+
+}
+
+int CTCPComm::OnPollThreadError(int status)
+{
+	return -1;
+}
+
+bool CTCPComm::Init()
+{
+
+	if (m_pThread)
+	{
+		m_pThread->Stop();
+		return true;
+	}
+
+	m_pThread = new CTCPPollThread(this);
+
+	if (m_pThread)
+		return true;
+
+	return false;
+}
+
+int CTCPComm::Start()
+{
+	if (m_pThread == 0)
+	{
+		return -1;
+	}
+	return m_pThread->Start();
+}
+
+bool CTCPComm::IsPolling()
+{
+	if (m_pThread == 0)
+	{
+		return false;
+	}
+	return m_pThread->IsRunning();
+}
+
+void CTCPComm::Stop()
+{
+	if (m_pThread)
+	{
+		m_pThread->Stop();
+	}
+
+}

Added: incubator/bluesky/trunk/RealClass/Student/src/tcpcomm.h
URL: http://svn.apache.org/viewvc/incubator/bluesky/trunk/RealClass/Student/src/tcpcomm.h?rev=819907&view=auto
==============================================================================
--- incubator/bluesky/trunk/RealClass/Student/src/tcpcomm.h (added)
+++ incubator/bluesky/trunk/RealClass/Student/src/tcpcomm.h Tue Sep 29 12:36:46 2009
@@ -0,0 +1,28 @@
+// TCPComm.h: interface for the CTCPComm class.
+
+#if !defined(TCPCOMM_H)
+#define TCPCOMM_H
+
+class CTCPPollThread;
+class CTCPComm
+{
+	friend class CTCPPollThread;
+public:
+	void Stop();
+	bool IsPolling();
+	int Start();
+	virtual bool Init();
+	CTCPComm();
+	virtual ~CTCPComm();
+
+protected:
+	virtual void OnPollThreadStep() = 0;
+	virtual int OnPollThreadError(int status);
+	virtual int PolledSocket() = 0;
+	virtual int Poll() = 0;
+
+private:
+	CTCPPollThread *m_pThread;
+};
+
+#endif // !defined(TCPCOMM_H)

Added: incubator/bluesky/trunk/RealClass/Student/src/tcppollthread.cpp
URL: http://svn.apache.org/viewvc/incubator/bluesky/trunk/RealClass/Student/src/tcppollthread.cpp?rev=819907&view=auto
==============================================================================
--- incubator/bluesky/trunk/RealClass/Student/src/tcppollthread.cpp (added)
+++ incubator/bluesky/trunk/RealClass/Student/src/tcppollthread.cpp Tue Sep 29 12:36:46 2009
@@ -0,0 +1,83 @@
+#include "tcppollthread.h"
+#include "tcpcomm.h"
+
+CTCPPollThread::CTCPPollThread(CTCPComm* pcomm)
+{
+	m_pcomm = pcomm;
+	stop = false;
+}
+
+CTCPPollThread::~CTCPPollThread()
+{
+	Stop();
+}
+
+int CTCPPollThread::Start()
+{
+	if (JThread::IsRunning())
+		return -1;
+
+	if (!stopmutex.IsInitialized())
+	{
+		if (stopmutex.Init() < 0)
+			return -1;
+	}
+	stop = false;
+	if (JThread::Start() < 0)
+		return -1;
+	return 0;
+}
+
+void CTCPPollThread::Stop()
+{
+	if (!IsRunning())
+		return;
+
+	stopmutex.Lock();
+	stop = true;
+	stopmutex.Unlock();
+
+	if (JThread::IsRunning())
+	{
+		JThread::Kill();
+	}
+	stop = false;
+}
+
+void *CTCPPollThread::Thread()
+{
+	JThread::ThreadStarted();
+
+	int status;
+	bool stopthread;
+
+	stopmutex.Lock();
+	stopthread = stop;
+	stopmutex.Unlock();
+	while (!stopthread)
+	{
+		status = m_pcomm->Poll();
+		if (status < 0)
+		{
+			stopthread = 0;
+			m_pcomm->OnPollThreadError(status);
+		}
+		else
+		{
+			status = m_pcomm->PolledSocket();
+			if (status < 0)
+			{
+				stopthread = true;
+				m_pcomm->OnPollThreadError(status);
+			}
+			else
+			{
+				m_pcomm->OnPollThreadStep();
+				stopmutex.Lock();
+				stopthread = stop;
+				stopmutex.Unlock();
+			}
+		}
+	}
+	return 0;
+}

Added: incubator/bluesky/trunk/RealClass/Student/src/tcppollthread.h
URL: http://svn.apache.org/viewvc/incubator/bluesky/trunk/RealClass/Student/src/tcppollthread.h?rev=819907&view=auto
==============================================================================
--- incubator/bluesky/trunk/RealClass/Student/src/tcppollthread.h (added)
+++ incubator/bluesky/trunk/RealClass/Student/src/tcppollthread.h Tue Sep 29 12:36:46 2009
@@ -0,0 +1,26 @@
+
+#ifndef CTCPPOLLTHREAD_H
+
+#define CTCPPOLLTHREAD_H
+
+#include "jthread.h"
+#include "jmutex.h"
+
+class CTCPComm;
+class CTCPPollThread: private JThread
+{
+	friend class CTCPComm;
+public:
+	CTCPPollThread(CTCPComm* pcomm);
+	~CTCPPollThread();
+	int Start();
+	void Stop();
+private:
+	void *Thread();
+
+	bool stop;
+	JMutex stopmutex;
+	CTCPComm *m_pcomm;
+};
+
+#endif // CTCPPOLLTHREAD_H



Mime
View raw message