📄 form.c
字号:
{
switch(cmd)
{
case left: //左移一列
if(sample_new_table.array>0)
sample_new_table.array-=1;
else
sample_new_table.array=9;
break;
case right: //右移一列
if(sample_new_table.array<9)
sample_new_table.array+=1;
else
sample_new_table.array=0;
break;
//输入和保存字符
case DATA:
languge_mode(English,yes); //切换语言
sample_new_table.str[sample_new_table.colomn-1][sample_new_table.array]=dat; //存入到内存
set_window_char(dat); //显示字符
if(sample_new_table.array<9)
sample_new_table.array+=1; //右移一列
else
sample_new_table.array=0;
break;
default:
break;
}
set_caract_pos(sample_new_table.ins_dot[sample_new_table.array].x,sample_new_table.ins_dot[sample_new_table.array].y+sample_new_table.v_step*(sample_new_table.colomn-1));
}
}
//============================================================================================================================
//试样编号函数
//============================================================================================================================
void sample_sub(void)
{
unsigned char i;
show_form(&sample_form);
show_new_table_para();
current_form_index=sample_form.index;
while(1)
{
current_form_index=sample_form.index;
switch(search(sample_form.index)) //查询
{
case on_btn_NO_0:
new_table_edit(DATA,'0');
break;
case on_btn_NO_1:
new_table_edit(DATA,'1');
break;
case on_btn_NO_2:
new_table_edit(DATA,'2');
break;
case on_btn_NO_3:
new_table_edit(DATA,'3');
break;
case on_btn_NO_4:
new_table_edit(DATA,'4');
break;
case on_btn_NO_5:
new_table_edit(DATA,'5');
break;
case on_btn_NO_6:
new_table_edit(DATA,'6');
break;
case on_btn_NO_7:
new_table_edit(DATA,'7');
break;
case on_btn_NO_8:
new_table_edit(DATA,'8');
break;
case on_btn_NO_9:
new_table_edit(DATA,'9');
break;
case on_btn_NO_q:
if(shift_flag==1)
new_table_edit(DATA,'Q');
else
new_table_edit(DATA,'q');
break;
case on_btn_NO_w:
if(shift_flag==1)
new_table_edit(DATA,'W');
else
new_table_edit(DATA,'w');
break;
case on_btn_NO_e:
if(shift_flag==1)
new_table_edit(DATA,'E');
else
new_table_edit(DATA,'e');
break;
case on_btn_NO_r:
if(shift_flag==1)
new_table_edit(DATA,'R');
else
new_table_edit(DATA,'r');
break;
case on_btn_NO_t:
if(shift_flag==1)
new_table_edit(DATA,'T');
else
new_table_edit(DATA,'t');
break;
case on_btn_NO_y:
if(shift_flag==1)
new_table_edit(DATA,'Y');
else
new_table_edit(DATA,'y');
break;
case on_btn_NO_u:
if(shift_flag==1)
new_table_edit(DATA,'U');
else
new_table_edit(DATA,'u');
break;
case on_btn_NO_i:
if(shift_flag==1)
new_table_edit(DATA,'I');
else
new_table_edit(DATA,'i');
break;
case on_btn_NO_o:
if(shift_flag==1)
new_table_edit(DATA,'O');
else
new_table_edit(DATA,'o');
break;
case on_btn_NO_p:
if(shift_flag==1)
new_table_edit(DATA,'P');
else
new_table_edit(DATA,'p');
break;
case on_btn_NO_a:
if(shift_flag==1)
new_table_edit(DATA,'A');
else
new_table_edit(DATA,'a');
break;
case on_btn_NO_s:
if(shift_flag==1)
new_table_edit(DATA,'S');
else
new_table_edit(DATA,'s');
break;
case on_btn_NO_d:
if(shift_flag==1)
new_table_edit(DATA,'D');
else
new_table_edit(DATA,'d');
break;
case on_btn_NO_f:
if(shift_flag==1)
new_table_edit(DATA,'F');
else
new_table_edit(DATA,'f');
break;
case on_btn_NO_g:
if(shift_flag==1)
new_table_edit(DATA,'G');
else
new_table_edit(DATA,'g');
break;
case on_btn_NO_h:
if(shift_flag==1)
new_table_edit(DATA,'H');
else
new_table_edit(DATA,'h');
break;
case on_btn_NO_j:
if(shift_flag==1)
new_table_edit(DATA,'J');
else
new_table_edit(DATA,'j');
break;
case on_btn_NO_k:
if(shift_flag==1)
new_table_edit(DATA,'K');
else
new_table_edit(DATA,'k');
break;
case on_btn_NO_l:
if(shift_flag==1)
new_table_edit(DATA,'L');
else
new_table_edit(DATA,'l');
break;
case on_btn_NO_z:
if(shift_flag==1)
new_table_edit(DATA,'Z');
else
new_table_edit(DATA,'z');
break;
case on_btn_NO_x:
if(shift_flag==1)
new_table_edit(DATA,'X');
else
new_table_edit(DATA,'x');
break;
case on_btn_NO_c:
if(shift_flag==1)
new_table_edit(DATA,'C');
else
new_table_edit(DATA,'c');
break;
case on_btn_NO_v:
if(shift_flag==1)
new_table_edit(DATA,'V');
else
new_table_edit(DATA,'v');
break;
case on_btn_NO_b:
if(shift_flag==1)
new_table_edit(DATA,'B');
else
new_table_edit(DATA,'b');
break;
case on_btn_NO_n:
if(shift_flag==1)
new_table_edit(DATA,'N');
else
new_table_edit(DATA,'n');
break;
case on_btn_NO_m:
if(shift_flag==1)
new_table_edit(DATA,'M');
else
new_table_edit(DATA,'m');
break;
case on_btn_NO_shift: //大小写切换
if(shift_flag==0)
shift_flag=1;
else
shift_flag=0;
break;
case on_btn_NO_up:
break;
case on_btn_NO_down:
break;
case on_btn_NO_left:
new_table_edit(left,NULL);
break;
case on_btn_NO_right:
new_table_edit(right,NULL);
break;
case on_btn_NO_uppage:
break;
case on_btn_NO_downpage:
break;
case on_btn_NO_new:
if(new_enable==yes)
{
sample_new_table.colomn++;
if(sample_new_table.colomn>8)
sample_new_table.colomn=1;
languge_mode(English,yes); //置语言模式
for(i=0;i<10;i++)
{
set_caract_pos(sample_new_table.ins_dot[i].x,sample_new_table.ins_dot[i].y+sample_new_table.v_step*(sample_new_table.colomn-1));
sample_new_table.str[sample_new_table.colomn-1][i]=' ';
set_window_char(' ');
}
//打两个时间间隔符
set_caract_pos(sample_new_table.ins_dot[5].x+8,sample_new_table.ins_dot[5].y+sample_new_table.v_step*(sample_new_table.colomn-1));
set_window_char('/');
set_caract_pos(sample_new_table.ins_dot[7].x+8,sample_new_table.ins_dot[7].y+sample_new_table.v_step*(sample_new_table.colomn-1));
set_window_char('/');
//初始化光标位置于左端
init_caract(sample_new_table.ins_dot[0].x,sample_new_table.ins_dot[0].y+sample_new_table.v_step*(sample_new_table.colomn-1),0x4f,0x00,yes); //在表中置光标
edit_enable=yes;
new_enable=no;
}
break;
case on_btn_NO_ok:
//分配存储空间
fs.sum=read_byte(0); //读出总的项目数
if(fs.sum<250)
{
fs.pointer=read_byte(1);
fs.item_addr=2+fs.pointer*74; //计算出新建项目的起始地址
write_byte(fs.sum+1,0); //总项目加1
write_byte(fs.pointer+1,1); //项目号加1
if(fs.sum==249)
fs.restart=yes; //通知转头
}
else if(fs.sum==250)
{
if(fs.restart==yes)
{
fs.pointer=0;
fs.item_addr=2+fs.pointer*74; //计算出新建项目的起始地址
write_byte(fs.pointer+1,1); //项目号加1
fs.restart=no;
}
else
{
fs.pointer=read_byte(1);
fs.item_addr=2+fs.pointer*74; //计算出新建项目的起始地址
write_byte(fs.pointer+1,1); //项目号加1
}
}
//存入编号
for(i=0;i<10;i++)
write_byte(sample_new_table.str[sample_new_table.colomn-1][i],fs.item_addr+i);
//格式化该项目数据区,标记数据结束标志
for(i=10;i<74;i++)
write_byte('\r',fs.item_addr+i);
send_message(0,on_btn_para); //进入参数设置界面
edit_enable=no;
new_enable=yes;
return;
break;
case on_btn_NO_return:
show_form(&Main_form); //返回主界面
if(scale_renew==1)
{
//重画刻度和曲线起点
draw_scale();
curve1.x0=45;
curve1.y0=380;
curve2.x0=45;
curve2.y0=200;
}
return;
break;
case Idel:
break;
default:
break;
}
}
}
//===========================================================================================================
//参数设置例子回调函数
//===========================================================================================================
void para_form_exp_sub(void)
{
show_form(¶_exp_form);
current_form_index=para_exp_form.index;
while(1)
{
current_form_index=para_exp_form.index;
switch(search(para_exp_form.index)) //查询
{
case on_btn_para_exp_return:
show_form(¶_form); //返回参数界面
show_para();
init_caract(para_table.ins_dot[para_table.colomn][para_table.array].x,para_table.ins_dot[para_table.colomn][para_table.array].y,0x4f,0x00,yes); //在表中置光标
return;
default:
break;
}
}
}
//=============================================================================================================================
//参数表的编辑输入
//==============================================================================================================================
void table_edit(unsigned int cmd, unsigned char dat)
{
set_caract_color(0x4f,0x00);
switch(cmd)
{
case up: //上移一行
if(para_table.colomn>0)
para_table.colomn-=1;
else
para_table.colomn=8;
break;
case down: //下移一行
if(para_table.colomn<8)
para_table.colomn+=1;
else
para_table.colomn=0;
break;
case left: //左移一列
if(para_table.array>0)
para_table.array-=1;
else
{
para_table.array=7;
if(para_table.colomn>0)
para_table.colomn-=1;
}
break;
case right: //右移一列
if(para_table.array<7)
para_table.array+=1;
else
{
para_table.array=0;
if(para_table.colomn<8)
para_table.colomn+=1;
}
break;
//输入和保存字符
case DATA:
languge_mode(English,yes); //切换语言
para_table.str[para_table.colomn][para_table.array]=dat; //存入到内存
set_window_char(dat); //显示字符
if(touch_screen_input)
{
if(para_table.array<7)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -