⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ncwnd_detail.cpp

📁 用linux开发的安防暴警的有关代码
💻 CPP
📖 第 1 页 / 共 2 页
字号:
/*    文件名称 :NCWnd_Detail.cpp  新建、修改、抄录名片主窗口 源程序文件    CopyRight (c) 2002 汉王科技公司    作者    : 王欣    创建时间: 2002年5月9日    当前版本: 0.1*/#include <assert.h>#include <ctype.h>#include <errno.h>#include <fcntl.h>#include <fstream.h>#include <getopt.h>#include <signal.h>#include <stdio.h>#include <stdlib.h>#include <string.h>#include <sys/ipc.h>#include <sys/msg.h>#include <sys/poll.h>#include <sys/sem.h>#include <sys/shm.h>#include <sys/stat.h>#include <sys/types.h>#include <time.h>#include <unistd.h>/******************************************************************************************					FLTK头文件 ******************************************************************************************/#include <FL/Enumerations.H>#include <FL/x.H>#include <FL/Fl.H>#include <FL/fl_ask.H>#include <FL/fl_draw.H>#include <FL/forms.H>#include <FL/Fl_Box.H>#include <FL/Fl_Bitmap.H>#include <FL/Fl_Pixmap.H>#include <FL/Fl_Multi_Label.H>#include <FL/Fl_Widget.H>#include <FL/Fl_Window.H>#include <FL/Fl_Tabs.H>#include <FL/Fl_Group.H>#include <FL/Fl_Scroll.H>#include <FL/Fl_Input.H>#include <FL/Fl_Output.H>#include <FL/Fl_Int_Input.H>#include <FL/Fl_Multiline_Output.H>#include <FL/Fl_Secret_Input.H>#include <FL/Fl_Button.H>#include <FL/Fl_Return_Button.H>#include <FL/Fl_Check_Button.H>#include <FL/Fl_Toggle_Button.H>#include <FL/Fl_Clock.H>#include <FL/Fl_Browser.H>#include <FL/Fl_Hold_Browser.H>#include <FL/Fl_Multi_Browser.H>#include <Flek/Flv_List.H>#include <Flek/Flve_Combo.H>#include <pthread.h>#include "alert_core.h"extern int 				record_operation_id;extern Flve_Combo 			*cbo_local_setup_sound;extern Flve_Combo 			*cbo_auto_dial_sound;	#include "Call_Hw_Input.h"#include "Secret_Input.h"#include "Call_Kb_Input.h"#include "NCWnd_Detail.h"#include "wordlist.h"#include "MessageBox.h"static bool g_bPlaying, g_bRecording;#ifdef X86						#include "/work/Xapplication/myprog/Headers/showcard.h"#else 						#include "/work/Xapplication/myprog/Headers/showcard.h"#endifvoid LoadFileNameToCombo (Flve_Combo *o){	WordList WD;	char path[128];	char *pointer;	struct stat mystat;	bzero(path,128);//检测设置目录	WD.MakeGeneric (SOUND_FILE_PATH, '/');	for (int i=1;i<WD.Count;i++)		{			pointer=WD.Get(i);			sprintf(path,"%s/%s",path,pointer);			if (stat (path, &mystat) != 0)				if (mkdir (path, 0700)!=0)				{					InformDlg ("创建设置文件目录失败!","错误信息");					exit(1);				}		}  DIR *dirp;  struct dirent *direntp;  if ( (dirp=opendir(SOUND_FILE_PATH))==NULL )  {    return;  }  while ( (direntp=readdir(dirp)) != NULL )  {    char *filename = direntp->d_name;    if (strcmp(filename, ".")==0 || strcmp(filename, "..")==0)    {      continue;    }    o->item.add(filename);  }  closedir(dirp);}/*void *TestPlaySound (void *p){  int audio_fd = (int)p;  int ret = PlaySound(audio_fd, g_szSoundFileName, &g_bPlaying);  if (ret<0)  {    printf("Play Sound function return %d\n", ret);  }  close(audio_fd);  g_bPlaying = false;  pthread_exit(NULL);}void TestPlaySoundTimer (void *p){  if (true==g_bPlaying)  {    Fl::repeat_timeout(0.1, TestPlaySoundTimer);  }  else  {    g_TestSoundWnd->hide();  }}void cb_TestPlaySoundWnd (Fl_Window *, void *){  g_bPlaying = false;}void cb_TestSound_Btn (Fl_Button *o, void *p){  Fl_Window *w = (Fl_Window *)p;  g_bPlaying = false;  usleep(500000);  w->hide();}Fl_Window *TestPlaySoundWnd (const char *title){  if (NULL==g_TestSoundWnd)  {    int w=150, h=73, x=(MAINWND_W-w)/2, y=(MAINWND_H-h)/2;    Fl_Window *o = g_TestSoundWnd = new Fl_Window(x, y, w, h, title);    o->set_modal();    o->align(FL_ALIGN_LEFT | FL_ALIGN_INSIDE);    {      int x=20, y=5, w=100, h=25;      new Fl_Box(FL_FLAT_BOX, x, y, w, h, "正在试听 . . .");      x=45, y=40, w=60, h=25;      Fl_Button *o1 = new Fl_Button(x, y, w, h, "停 止");      o1->callback((Fl_Callback *)cb_TestSound_Btn, (void *)g_TestSoundWnd);    }    o->end();  }  g_TestSoundWnd->show();  return g_TestSoundWnd;}*/static int g_nTimeOut = 0;								//录放音计时器超时时限(以秒为单位)static const int g_nDeftTimeOut = 10;						//默认录放音计时器超时时限(以秒为单位)static char g_szTimeBoxTitle[20];							//添加振铃或留言时间显示框static Fl_Window *g_AddRingWnd = (Fl_Window *)0;					//添加振铃窗口句柄static Call_Hw_Input *g_AddRingWnd_Ipt = (Call_Hw_Input *)0;			//添加振铃窗口输入框static Fl_Button *g_AddRingWnd_Btn_Record = (Fl_Button *)0;			//录音按钮static Fl_Button *g_AddRingWnd_Btn_Play = (Fl_Button *)0;				//放音按钮static Fl_Button *g_AddRingWnd_Btn_Stop = (Fl_Button *)0;				//停止按钮static Fl_Button *g_AddRingWnd_Btn_Add = (Fl_Button *)0;				//添加按钮static Fl_Button *g_AddRingWnd_Btn_Cancel = (Fl_Button *)0;			//取消按钮static Fl_Box *g_AddRingWnd_Box = (Fl_Box *)0;					//时间显示框static Wx_Slider *g_AddRingWnd_Slider = (Wx_Slider *)0;				//录音滑杆static void cb_ShowAddRingWnd (Fl_Window *o);static void cb_AddRingWnd_Btn (Fl_Button *o, void *p);				//添加振铃窗口,按钮消息处理static void RecordTimer (void *);							//录音计时函数static int Record (Fl_Button *o);							//录音函数static void PlayTimer (void *);							//放音计时函数static int Play (Fl_Button *o);							//放音函数static void *Record_Thread (void *p);						//录音线程函数static void *Play_Thread (void *p);							//放音线程函数/******************************************************************************************					添加振铃窗口参数:type = 0		添加振铃type = 1		添加留言 ******************************************************************************************/Fl_Window *AddAnswerWnd (void){  fl_mapcolor (FL_FREE_COL1, 222, 196, 227);  fl_mapcolor (FL_FREE_COL2, 171,191,241);  fl_mapcolor (FL_FREE_COL3, 203,215, 244);   fl_mapcolor (FL_FREE_COL4,246,235,180 );    fl_mapcolor (FL_FREE_COL5,245,233,217 );  static Fl_Window *w = NULL;  if (NULL==w)  {#ifdef arm    int width=260, height=180, x=(MAINWND_W-width)/2, y=(MAINWND_H-height)/2;#else    int width=260, height=180, x=(1024-width)/2, y=(768-height)/2;#endif    w = g_AddRingWnd = new Fl_Window (x, y, width, height);    w->callback((Fl_Callback *)cb_ShowAddRingWnd);    w->label("录音");    w->set_modal ();    {      int x=60, y=10, w=180, h=25;      Call_Hw_Input *o1 = g_AddRingWnd_Ipt = new Call_Hw_Input(x, y, w, h, "名称  ");      o1->maximum_size(MAXLEN_SOUNDNAME-1);     o1->color(FL_FREE_COL5);          int x1=20, y1=50, w1=width-2*x1, h1=25;			//录放音滑杆      Wx_Slider* o2 = g_AddRingWnd_Slider = new Wx_Slider(x1, y1, w1, h1);      o2->type(5);      o2->box(FL_FLAT_BOX);      o2->maximum(10);      o2->step(1);      o2->align(FL_ALIGN_CENTER);      fl_set_object_color (o2, FL_FREE_COL2, FL_FREE_COL2);      fl_redraw_object (o2);          int x2=20, y2=y1+h1+20, w2=25, h2=w2;			//录音按钮      Fl_Button *o3 = g_AddRingWnd_Btn_Record = new Fl_Button(x2, y2, w2, h2, "@-5circle");      o3->callback((Fl_Callback *)cb_AddRingWnd_Btn, (void *)1);      o3->labeltype(FL_SYMBOL_LABEL);      o3->labelcolor(FL_RED);      fl_set_object_color (o3, FL_FREE_COL2, FL_FREE_COL2);      fl_redraw_object (o3);          int x3=x2+w2+10;						//播放按钮      o3 = g_AddRingWnd_Btn_Play = new Fl_Button(x3, y2, w2, h2, "@-2>");      o3->callback((Fl_Callback *)cb_AddRingWnd_Btn, (void *)2);      o3->labeltype(FL_SYMBOL_LABEL);      fl_set_object_color (o3, FL_FREE_COL2, FL_FREE_COL2);      fl_redraw_object (o3);          int x4=x3+w2+10;						//停止按钮      o3 = g_AddRingWnd_Btn_Stop = new Fl_Button(x4, y2, w2, h2, "@-6square");      o3->callback((Fl_Callback *)cb_AddRingWnd_Btn, (void *)3);      o3->labeltype(FL_SYMBOL_LABEL);      fl_set_object_color (o3, FL_FREE_COL2, FL_FREE_COL2);      fl_redraw_object (o3);          int x5=x4+40, w5=120;      g_AddRingWnd_Box = new Fl_Box(FL_FLAT_BOX, x5, y2, w5, h2, "");      int x6=x2+20, y6=y2+42, w6=80, h6=h2;      Fl_Button *o4 = g_AddRingWnd_Btn_Add = new Fl_Button(x6, y6, w6, h6, "添  加");      o4->callback((Fl_Callback *)cb_AddRingWnd_Btn, (void *)4);      fl_set_object_color (o4, FL_FREE_COL2, FL_FREE_COL2);      fl_redraw_object (o4);          Fl_Button *o5 = g_AddRingWnd_Btn_Cancel = new Fl_Button(x6+w6+20, y6, w6, h6, "取  消");      o5->callback((Fl_Callback *)cb_AddRingWnd_Btn, (void *)5);      fl_set_object_color (o5, FL_FREE_COL2, FL_FREE_COL2);      fl_redraw_object (o5);      }  }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -