📄 cursor.cpp
字号:
#include <graphics.h>
#include <stdio.h>
#include "keydef.h"
#include "global.h"
#include "g_func.h"
#include "cursor.h"
void cursor()
{
// if(curs_flag==1){ //removed @04-05-31,lingyi
clear_rect(105,473,300,473);
clear_rect(105,473,300,473);
disable();
setcolor(YELLOW);
line(x_pos,473,x_pos+6,473);
enable();
// }
}
void curskey_p()
{
if(curs_flag==0)
return;
if(((_keyid==FREQ||(_keyid==MARKER&&_softkeyid!=6))&&((bit_cnt==4&&cnt==1)||(bit_cnt==5&&cnt==2)||(bit_cnt==6&&cnt==3)||(bit_cnt==7&&cnt==1)||(bit_cnt==8&&cnt==2)))||
((_keyid==POWER||(_keyid==MARKER&&(_softkeyid==6||(_softkeyid==7&&_softkeyid1==73&&_softkeyid2==731))))&&(bit_cnt-cnt==2))||
(_keyid==SWEEP&&(bit_cnt-cnt==3)))
x_pos+=26;
else
x_pos+=13;
cnt++;
if(cnt>bit_cnt&&(_keyid==FREQ||_keyid==SWEEP||(_keyid==SCALE&&(_softkeyid==2||_softkeyid==4))||
(_keyid==MARKER&&(_softkeyid!=6&&_softkeyid!=7))||_keyid==AVERAGE||_keyid==STORE||_keyid==SYSTEM)){
cnt=1;
x_pos=107;
}
else if(cnt>bit_cnt&&(_keyid==POWER||(_keyid==SCALE&&_softkeyid==3)||
(_keyid==MARKER&&(_softkeyid==6||(_softkeyid==7&&_softkeyid2==731))))){
cnt=1;
x_pos=120;
}
// printf("%d %d\n",bit_cnt,cnt);
cursor();
}
//modified on 2004-7-7,add conditions when freq is lower than 1kHz
void bit_cnt_frq(long freq)
{
if(freq<100)
bit_cnt=2;
else if(freq<1000)
bit_cnt=3;
else if(freq<10000)
bit_cnt=4;
else
if(freq>=10000&&freq<=99999){
bit_cnt=5;
}
else if(freq>=100000&&freq<=999999)
bit_cnt=6;
else if(freq>=1000000&&freq<=9999999)
bit_cnt=7;
else if(freq>=10000000&&freq<=50000000)
bit_cnt=8;
}
void bit_cnt_pwr(float power)
{
if(power>=-9.99&&power<10.00)
bit_cnt=3;
else
bit_cnt=4;
}
void bit_cnt_swp(long swp_t)
{ // if(_softkeyid1==11){
if(swp_t>=100000)
bit_cnt=6;
else if(swp_t>=10000)
bit_cnt=5;
else if(swp_t>=1000)
bit_cnt=4;
else if(swp_t>=100)
bit_cnt=3;
else if(swp_t>=50)
bit_cnt=2;
/* }
if(_softkeyid1==12)
{ if(swp_t>=100000)
bit_cnt=6;
else if(swp_t>=10000)
bit_cnt=5;
else bit_cnt=4;
}*/
}
void bit_cnt_swpp(int swp_ps)
{
if(swp_ps>=100)
bit_cnt=3;
else if(swp_ps>=10)
bit_cnt=2;
else if(swp_ps>=0)
bit_cnt=1;
}
void bit_cnt_vol(float vol)
{
if(vol>=10||vol<=-10)
bit_cnt=2;
else
bit_cnt=1;
}
void bit_cnt_scal(float scal)
{
if(scal>=1&&scal<10)
bit_cnt=1;
else
bit_cnt=2;
}
void bit_cnt_avg(int avg_t)
{
if(avg_t>=100)
bit_cnt=3;
else if(avg_t>=10)
bit_cnt=2;
else if(avg_t>=1)
bit_cnt=1;
}
//04-05-24,lingyi
void bit_cnt_sys(int dt)
{
if(dt>=1000)
bit_cnt=4;
else if(dt>=100)
bit_cnt=3;
else if(dt>=10)
bit_cnt=2;
else if(dt>=0)
bit_cnt=1;
}
void init_cur_frq(long freq)
{
x_pos=107;
cnt=1;
cursor();
bit_cnt_frq(freq);
}
void init_cur_pwr(float power)
{
x_pos=120;
cnt=1;
cursor();
bit_cnt_pwr(power);
}
void init_cur_swp(long swp_t)
{
x_pos=107;
cnt=1;
cursor();
bit_cnt_swp(swp_t);
}
void init_cur_swpp(int swp_ps)
{
x_pos=107;
cnt=1;
bit_cnt_swpp(swp_ps);
}
void init_cur_vol(float vol)
{
x_pos=120;
cnt=1;
cursor();
bit_cnt_vol(vol);
}
void init_cur_scal(float scal)
{
x_pos=107;
cnt=1;
cursor();
bit_cnt_vol(scal);
}
void init_cur_pos()
{
x_pos=107;
bit_cnt=1;
cnt=1;
cursor();
}
void init_cur_avg(int avg_t)
{
x_pos=107;
cursor();
bit_cnt_avg(avg_t);
cnt=1;
}
void init_cur_str()
{
x_pos=107;
cursor();
bit_cnt=cnt=1;
}
void init_cur_sys(int dt) //add at 04-05-31
{
x_pos=107;
cursor();
bit_cnt_sys(dt);
cnt=1;
}
void curs_forward()
{
x_pos+=13;
cursor();
}
void curs_backward()
{
x_pos-=13;
cursor();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -