diff --git a/ComLib.h b/ComLib.h index 501cf94..65fca1f 100644 --- a/ComLib.h +++ b/ComLib.h @@ -32,7 +32,7 @@ #include //AA6YQ 1.65D->1.66G, JE3HHT 1.67 #define VERID "Ver1.70" //K6TU 1.68A -> 1.70A Hide FlexRadio Reserved and IQ Audio Devices -#define VERBETA "K" //JA7UDE 1.70A -> 1.70B G3WYW FT-991 CAT support +#define VERBETA "L" //JA7UDE 1.70A -> 1.70B G3WYW FT-991 CAT support //AA6YQ 1.70C added COM16-32 to PTT/FSK port selector and Radio port selector, added 991 to Yaesu Group selector entry //AA6YQ 1.70D prevent shift > 4000 Hz so CSlideFFT::Create does not divide by zero //AA6YQ 1.70E limit PTT/FSK port selector and Radio port selector to display only 8 items @@ -46,7 +46,7 @@ //AA6YQ 1.70H correct regression in 1.70E that prevents correct frequency tracking for FT-891 and FT-991 //AA6YQ 1.70J update documentation and URLs //AA6YQ 1.70K limit Help menu to one arrangement, increase height of VerDSP dialog, add "Setup always on top" option - + //JA7UDE 1.70L display the profile name in use #define VERTTL2 "MMTTY "VERID VERBETA #define VERTTL VERTTL2" Licensed under LGPL" //1.70J @@ -307,6 +307,10 @@ typedef struct { int m_LogLink; AnsiString m_LogName; + AnsiString m_ProfileName; //JA7UDE 1.70L + int m_ProfileNum; //JA7UDE 1.70L + int m_ProfileNumNew; //JA7UDE 1.70L + AnsiString m_ProfileStartUp;//JA7UDE 1.70L int m_TxPort; // 0-Sound, 1-DTR, 2-TXD int m_TxdStop; diff --git a/Main.cpp b/Main.cpp index 5488c90..2280c5d 100644 --- a/Main.cpp +++ b/Main.cpp @@ -505,6 +505,8 @@ __fastcall TMmttyWd::TMmttyWd(TComponent* Owner) sys.m_AutoTimeOffset = 0; sys.m_TimeOffset = 0; sys.m_TimeOffsetMin = 0; + sys.m_ProfileName = "Startup"; //JA7UDE 1.70L + sys.m_ProfileNum = -1; //JA7UDE 1.70L // Panel2->Top = GroupBox1->Height + 1; // 受信画面サイズの調整 UpdatePanel(); LogLink.SetHandle(Handle, CM_CMML); @@ -1702,7 +1704,20 @@ void __fastcall TMmttyWd::UpdateUI(void) } SelectCombo(TRUE); } - if( m_filemode != pSound->WaveFile.m_mode ){ + if( sys.m_ProfileNum != sys.m_ProfileNumNew ){ //JA7UDE 1.70L + AnsiString dem = "Demodulator "; //JA7UDE 1.70L + switch( m_DemType ){ + case 0: dem += "(IIR) "; break; + case 1: dem += "(FIR) "; break; + case 2: dem += "(PLL) "; break; + case 3: dem += "(FFT) "; break; + default: break; + } + dem = dem + sys.m_ProfileName; //JA7UDE 1.70L + GroupDem->Caption = dem; //JA7UDE 1.70L + sys.m_ProfileNum = sys.m_ProfileNumNew; //JA7UDE 1.70L + } + if( m_filemode != pSound->WaveFile.m_mode ){ m_filemode = pSound->WaveFile.m_mode; switch(m_filemode){ case 0: @@ -2240,9 +2255,37 @@ void __fastcall TMmttyWd::ReadRegister(void) if( verAA6YQ < VERAA6YQ ){ pAA6YQ->m_bpfTaps = 512; pAA6YQ->m_befTaps = 256; - } + } if( pAA6YQ->m_fEnabled ) pAA6YQ->Create(); delete pIniFile; + +//Profile option at startup, JA7UDE 1.70L $$ + sprintf(bf, "%sUserPara.ini", BgnDir); + pIniFile = new TMemIniFile(bf); + if( sys.m_ProfileStartUp != "" ){ + char key[32]; + AnsiString pn; + bool isReadProfile = false; + for( int i = 0; i <= 1026; i++ ){ + if( i >= 16 && i <= 1024 ) + continue; + sprintf(key, "Define%d", i); + pn = pIniFile->ReadString( key, "Name", "Default" ); + if( pn.UpperCase() == sys.m_ProfileStartUp.UpperCase() ){ + ReadProfile( i, NULL ); + isReadProfile = true; + break; + } + } + if( !isReadProfile ){ + AnsiString msg = "Profile \""; + msg += sys.m_ProfileStartUp; + msg += "\" was specified, but it was not found in UserPara.ini. MMTTY will start with Profile \"Startup\"."; + msg += " Note that if your profile has a space character, surround it with double quotation marks."; + MessageBox( NULL, msg.c_str(), "Warning", MB_OK ); + } + } + delete pIniFile; } //--------------------------------------------------------------------------- @@ -6268,6 +6311,69 @@ void __fastcall TMmttyWd::KFFTW3Click(TObject *Sender) pSound->DrawFFT(pBitmapFFTIN, 1, KXYScope->Checked ? PBoxXY->Width : 0); } //--------------------------------------------------------------------------- +void __fastcall TMmttyWd::processOptions(LPTSTR opts) //JA7UDE 1.70L +{ + + using std::string; + using std::queue; + string s; + queue queue_opts; + int i; + s = ""; + char sep = ' '; + int l = strlen(opts); + for( i = 0; i < l; i++ ){ + if( opts[i] == '"' ){ + if( sep != '"' ){ + sep = '"'; + } + else{ + sep = ' '; + } + } + else if( opts[i] == sep ){ + queue_opts.push(s); + sep = ' '; + s = ""; + continue; + } + else{ + s += opts[i]; + } + } + queue_opts.push(s); + bool isProfileSpecified = false; + while( !queue_opts.empty() ){ + string front = queue_opts.front(); + //const char *f = front.c_str(); + //printf( "%s", f ); + if( isProfileSpecified ){ + sys.m_ProfileStartUp = AnsiString( front.c_str() ); + break; + } + else if( front == "-p" ){ + isProfileSpecified = true; + } + queue_opts.pop(); + } + /* + char *tp; + char s[1024]; + strcpy( s, opts ); + tp = strtok( s, " " ); + bool isProfileSpecified = false; + while( tp != NULL ){ + tp = strtok( NULL, " " ); + if( tp != NULL && isProfileSpecified ){ + sys.m_ProfileStartUp = tp; + break; + } + else if( tp != NULL && stricmp( tp, "-p" ) == 0 ){ //profile specified? + isProfileSpecified = true; + } + } + */ +} void __fastcall TMmttyWd::FormShow(TObject *Sender) { if( Remote & REMSHOWOFF ){ @@ -8970,6 +9076,13 @@ void __fastcall TMmttyWd::ReadProfile(int n, LPCSTR pName) sprintf(key, "Define%d", n); pSound->Suspend(); + if( n == 1025 ) //JA7UDE 1.70L $$ + sys.m_ProfileName = "Default"; //JA7UDE 1.70L + else if( n == 1026 ) //JA7UDE 1.70L + sys.m_ProfileName = "Startup"; //JA7UDE 1.70L + else //JA7UDE 1.70L + sys.m_ProfileName = pIniFile->ReadString( key, "Name", "Default" ); //JA7UDE 1.70L + sys.m_ProfileNumNew = n; //JA7UDE 1.70L sys.m_FixShift = pIniFile->ReadInteger(key, "AFCFixShift", sys.m_FixShift); sys.m_AFC = pIniFile->ReadInteger(key, "AFC", sys.m_AFC); @@ -9328,6 +9441,7 @@ void __fastcall TMmttyWd::KSClick(TObject *Sender) TMenuItem *tp = GetKS(i); if( tp == (TMenuItem *)Sender ){ ReadProfile(i, NULL); + sys.m_ProfileNum = -1; //JA7UDE 1.70L UpdateItem(); break; } @@ -9467,6 +9581,7 @@ void __fastcall TMmttyWd::KSLDClick(TObject *Sender) void __fastcall TMmttyWd::KSDEFClick(TObject *Sender) { ReadProfile(1025, NULL); + sys.m_ProfileNum = -1; //JA7UDE 1.70L UpdateItem(); AdjustFocus(); } @@ -9474,6 +9589,7 @@ void __fastcall TMmttyWd::KSDEFClick(TObject *Sender) void __fastcall TMmttyWd::KSRETClick(TObject *Sender) { ReadProfile(1026, NULL); + sys.m_ProfileNum = -1; //JA7UDE 1.70L UpdateItem(); AdjustFocus(); } @@ -9925,3 +10041,9 @@ void __fastcall TMmttyWd::KExtCmdClick(TObject *Sender) //--------------------------------------------------------------------------- +void __fastcall TMmttyWd::FormCreate(TObject *Sender) +{ + processOptions(GetCommandLine()); //JA7UDE 1.70L +} +//--------------------------------------------------------------------------- + diff --git a/Main.dfm b/Main.dfm index 1eba18c..7c8ea50 100644 Binary files a/Main.dfm and b/Main.dfm differ diff --git a/Main.h b/Main.h index 3404d43..5e54fa6 100644 --- a/Main.h +++ b/Main.h @@ -37,6 +37,8 @@ #include #include #include +#include +#include //--------------------------------------------------------------------------- #include "SendFile.h" #define USEPAL 1 @@ -647,6 +649,7 @@ __published: // IDE void __fastcall KMOptClick(TObject *Sender); void __fastcall KViewClick(TObject *Sender); void __fastcall KExtCmdClick(TObject *Sender); + void __fastcall FormCreate(TObject *Sender); private: // ユーザー宣言 @@ -940,6 +943,8 @@ public: // void __fastcall SetRemoteFFT(void); //Radio command機能のインプリメント void __fastcall OpenCloseRadio(void); +// + void __fastcall processOptions(LPTSTR); //JA7UDE 1.70L // void __fastcall TopWindow(void); diff --git a/mmtty.cbproj b/mmtty.cbproj index ac12049..2631a35 100644 --- a/mmtty.cbproj +++ b/mmtty.cbproj @@ -4,7 +4,7 @@ CppVCLApplication mmtty.cpp True - Debug + Release 16.1 Application VCL @@ -96,6 +96,8 @@ mmtty_Icon.ico + mmtty_Icon.ico + None true true true @@ -119,7 +121,6 @@ false false false - None true 1033 _DEBUG;$(BCC_Defines);$(BCC_Defines) @@ -129,11 +130,24 @@ _DEBUG;$(BCC_Defines);$(BCC_Defines) + mmtty_Icon.ico + None Release_Build -M -$O+ $(BDS)\lib\release;$(ILINK_LibraryPath);$(ILINK_LibraryPath) + . + D:\MyProjects\amprog\mmtty-JA7UDE-1.70Lp\mmtty.exe + -p Multi-path + true + 1033 + true + true + true + true + true + true NDEBUG;$(BCC_Defines);$(BCC_Defines) -tWM -Vx -d -Ve -r diff --git a/mmtty.exe b/mmtty.exe index 4d9d869..e9d479b 100644 Binary files a/mmtty.exe and b/mmtty.exe differ diff --git a/mmtty.map b/mmtty.map index ff1b762..9d9c135 100644 --- a/mmtty.map +++ b/mmtty.map @@ -1,6 +1,6 @@ Start Length Name Class - 0001:00401000 00037FD98H _TEXT CODE - 0002:00781000 00003A9B8H _DATA DATA - 0003:007BB9B8 000032158H _BSS BSS + 0001:00401000 0003885B4H _TEXT CODE + 0002:0078A000 00003B06CH _DATA DATA + 0003:007C506C 000032170H _BSS BSS 0004:00000000 0000000F8H _TLS TLS