Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
chunmingwang authored May 23, 2024
1 parent 2a83cbc commit 90a882c
Show file tree
Hide file tree
Showing 9 changed files with 172 additions and 57 deletions.
51 changes: 51 additions & 0 deletions Clock.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
1 24 "Manifest.xml"

#define APP_TITLE_STR "Chinese Calendar\0"
#define VER_FILEDESCRIPTION_STR "\0"

#define VER_FILEVERSION 0,0,0,1992
#define VER_FILEVERSION_STR "0.0.0.1992\0"

#define VER_LEGALCOPYRIGHT_STR "Cm.Wang\0"

#define VER_INTERNALNAME_STR "Chinese Calendar\0"
#define VER_ORIGINALFILENAME_STR "Chinese Calendar\0"
#define VER_PRODUCTNAME_STR "Chinese Calendar\0"

#define VER_PRODUCTVERSION 0,0,0,0
#define VER_PRODUCTVERSION_STR "0.0.0\0"
#define VER_COMPANYNAME_STR "Visual FB Editor\0"

VS_VERSION_INFO VERSIONINFO
FILEVERSION VER_FILEVERSION
PRODUCTVERSION VER_PRODUCTVERSION
FILEOS VOS__WINDOWS32
FILETYPE VFT_APP
FILESUBTYPE VFT2_UNKNOWN
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904E4"
BEGIN
VALUE "ApplicationTitle", APP_TITLE_STR
VALUE "FileDescription", VER_FILEDESCRIPTION_STR
VALUE "FileVersion", VER_FILEVERSION_STR
VALUE "InternalName", VER_INTERNALNAME_STR
VALUE "LegalCopyright", VER_LEGALCOPYRIGHT_STR
VALUE "OriginalFilename", VER_ORIGINALFILENAME_STR
VALUE "ProductName", VER_PRODUCTNAME_STR
VALUE "ProductVersion", VER_PRODUCTVERSION_STR
VALUE "CompanyName", VER_COMPANYNAME_STR
END
END
BLOCK "VarFileInfo"
BEGIN
/* The following line should only be modified for localized versions. */
/* It consists of any number of WORD,WORD pairs, with each pair */
/* describing a language,codepage combination supported by the file. */
/* */
/* For example, a file might have values "0x409,1252" indicating that it */
/* supports English language (0x409) in the Windows ANSI codepage (1252). */
VALUE "Translation", 0x409, 1252
END
END
137 changes: 94 additions & 43 deletions frmClock.frm
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
'#Region "Form"
' frmClock时钟
' Copyright (c) 2024 CM.Wang
' Freeware. Use at your own risk.

'#Region "Form"
#if defined(__FB_MAIN__) AndAlso Not defined(__MAIN_FILE__)
#define __MAIN_FILE__
#ifdef __FB_WIN32__
Expand All @@ -10,15 +14,17 @@
#include once "mff/TimerComponent.bi"
#include once "mff/Menus.bi"
#include once "mff/Dialogs.bi"
#include once "mff/ComboBoxEdit.bi"

#include once "gdip.bi"
#include once "gdipAnalogClock.bi"
#include once "gdipDay.bi"
#include once "gdipMonth.bi"
#include once "gdipTextClock.bi"

#include once "../SapiTTS/Speech.bi"
#include once "../Sapi/Speech.bi"
#include once "../MDINotepad/Text.bi"
#include once "../Midi/midi.bi"

Const MSG_SAPI_EVENT = WM_USER + 1024 ' --> change me

Expand Down Expand Up @@ -58,7 +64,11 @@
mnuAudioSub(Any) As MenuItem Ptr
mnuVoiceSub(Any) As MenuItem Ptr
mVoiceCount As Integer = -1
pSpVoice As Afx_ISpVoice Ptr
pSpVoice As ISpVoice Ptr

'midi
mMidiID As UINT = -1
mMidiOut As HMIDIOUT

'Profile
mRectAnalog As Rect
Expand Down Expand Up @@ -98,6 +108,8 @@
Declare Sub ProfileRelease() '释放Profile资源
Declare Sub ProfileSave(sFileName As WString, sKeyValue() As WString Ptr) '存储Profile

Declare Sub Notify(Title As WString, Info As WString)

'Clock
mLocateHorizontal As Integer
mLocateVertical As Integer
Expand Down Expand Up @@ -3120,32 +3132,33 @@ Private Sub frmClockType.SpeechNow(sDt As Double, ByVal sLan As Integer = 0)
End Select
#ifdef __USE_WINAPI__
If pSpVoice Then pSpVoice->Speak(s, SVSFlagsAsync, NULL)
Notify(!"VisualFBEditor GDIP Clock\0", *s)
#endif
WDeAllocate(s)
End Sub

Private Sub frmClockType.SpeechInit()
#ifdef __USE_WINAPI__
' // Create an instance of the SpVoice object
' Create an instance of the SpVoice object
Dim classID As IID, riid As IID
CLSIDFromString(Afx_CLSID_SpVoice, @classID)
IIDFromString(Afx_IID_ISpVoice, @riid)
CLSIDFromString(CLSID_SpVoice, @classID)
IIDFromString(IID_ISpVoice, @riid)
CoCreateInstance(@classID, NULL, CLSCTX_ALL, @riid, @pSpVoice)
If pSpVoice = NULL Then Exit Sub

mnuAnnounce.Enabled = True

' // Set the object of interest to word boundaries
' Set the object of interest to word boundaries
pSpVoice->SetInterest(SPFEI(SPEI_WORD_BOUNDARY), SPFEI(SPEI_WORD_BOUNDARY))
' // Set the handle of the window that will receive the MSG_SAPI_EVENT message
' Set the handle of the window that will receive the MSG_SAPI_EVENT message
pSpVoice->SetNotifyWindowMessage(Handle, MSG_SAPI_EVENT, 0, 0)

Dim pVoice As Afx_ISpObjectToken Ptr
Dim pAudio As Afx_ISpObjectToken Ptr
Dim pTokenCategory As Afx_ISpObjectTokenCategory Ptr
Dim pTokenEnum As Afx_IEnumSpObjectTokens Ptr
Dim pVoice As ISpObjectToken Ptr
Dim pAudio As ISpObjectToken Ptr
Dim pTokenCategory As ISpObjectTokenCategory Ptr
Dim pTokenEnum As IEnumSpObjectTokens Ptr

Dim pTokenItem As Afx_ISpObjectToken Ptr
Dim pTokenItem As ISpObjectToken Ptr
Dim pStr As WString Ptr = CAllocate(0, 2048)
Dim pCount As Long
Dim i As Long
Expand Down Expand Up @@ -3516,6 +3529,7 @@ Private Sub frmClockType.mnuMenu_Click(ByRef Sender As MenuItem)
ProfileSave(*mProfileName, mKeyValue())
Form_Resize(This, Width, Height)
FileName2Menu(*mProfileExt)
Notify(!"VisualFBEditor GDIP Clock\0", !"Profile saved.\r\n" & *mProfileName)
Case "mnuProfileSaveAs"
SaveFileDialog1.FileName = *mProfileName
SaveFileDialog1.Filter = "gdipClock Profile|*" & *mProfileExt
Expand All @@ -3537,6 +3551,7 @@ Private Sub frmClockType.mnuMenu_Click(ByRef Sender As MenuItem)
WLet(mProfileName, *mAppPath & Sender.Caption & *mProfileExt)
If ProfileLoad(*mProfileName, mKeyValue()) Then
Profile2Clock(mKeyValue())
Notify(!"VisualFBEditor GDIP Clock\0", !"Profile loaded.\r\n" & *mProfileName)
End If
mTextClock.TextAlpha(mTextAlpha1, mTextAlpha2)
If mRectMain.Right And mRectMain.Bottom Then Move(mRectMain.Left, mRectMain.Top, mRectMain.Right, mRectMain.Bottom)
Expand Down Expand Up @@ -4300,7 +4315,7 @@ Private Sub frmClockType.mnuMenu_Click(ByRef Sender As MenuItem)
For i = 0 To mVoiceCount
If @Sender = mnuVoiceSub(i) Then
#ifdef __USE_WINAPI__
If pSpVoice Then pSpVoice->SetVoice(Cast(Afx_ISpObjectToken Ptr, Sender.Tag))
If pSpVoice Then pSpVoice->SetVoice(Cast(ISpObjectToken Ptr, Sender.Tag))
#endif
Else
mnuVoiceSub(i)->Checked = False
Expand All @@ -4311,7 +4326,7 @@ Private Sub frmClockType.mnuMenu_Click(ByRef Sender As MenuItem)
For i = 0 To mAudioCount
If @Sender = mnuAudioSub(i) Then
#ifdef __USE_WINAPI__
If pSpVoice Then pSpVoice->SetOutput(Cast(Afx_ISpObjectToken Ptr, Sender.Tag), True)
If pSpVoice Then pSpVoice->SetOutput(Cast(ISpObjectToken Ptr, Sender.Tag), True)
#endif
Else
mnuAudioSub(i)->Checked = False
Expand All @@ -4325,6 +4340,9 @@ Private Sub frmClockType.Form_Create(ByRef Sender As Control)
ProfileInitial()
SpeechInit()

midiOutOpen(@mMidiOut, mMidiID, NULL, NULL, NULL)
If mMidiOut Then SendProgramChange(mMidiOut, 0, 14)

ProfileFrmClock(mKeyValDef())

ScreenInfo(mScreenWidth, mScreenHeight)
Expand Down Expand Up @@ -4356,21 +4374,7 @@ Private Sub frmClockType.Form_Create(ByRef Sender As Control)
End With
Shell_NotifyIcon(NIM_ADD, @SystrayIcon)

With SystrayIcon
.uFlags = NIF_INFO
.szInfo = !"\0"
.szInfoTitle = !"\0"
End With
Shell_NotifyIcon(NIM_MODIFY, @SystrayIcon)

With SystrayIcon
.uFlags = NIF_INFO
.szInfo = !"GDIP Clock\0"
.szInfoTitle = !"VisualFBEditor\0"
.uTimeout = 1
.dwInfoFlags = 1
End With
Shell_NotifyIcon(NIM_MODIFY, @SystrayIcon)
Notify(!"VisualFBEditor\0", !"Welcome to use GDIP Clock!\0")

WLet(mProfileName, ProfileDefLoad())
If ProfileLoad(*mProfileName, mKeyValue()) Then
Expand All @@ -4397,6 +4401,25 @@ Private Sub frmClockType.Form_Show(ByRef Sender As Form)
TimerComponent1.Enabled = True
End Sub

Private Sub frmClockType.Notify(Title As WString, Info As WString)

With SystrayIcon
.uFlags = NIF_INFO
.szInfo = !"\0"
.szInfoTitle = !"\0"
End With
Shell_NotifyIcon(NIM_MODIFY, @SystrayIcon)

With SystrayIcon
.uFlags = NIF_INFO
.szInfo = Info
.szInfoTitle = Title
.uTimeout = 1
.dwInfoFlags = 1
End With
Shell_NotifyIcon(NIM_MODIFY, @SystrayIcon)

End Sub
Private Sub frmClockType.Transparent(v As Boolean)
Form_Resize(This, Width, Height)
frmTrans.Enabled = v
Expand Down Expand Up @@ -4466,6 +4489,8 @@ Private Sub frmClockType.Form_Close(ByRef Sender As Form, ByRef Action As Intege
If mnuProfileSaveOnExit.Checked Then ProfileSave(*mProfileName, mKeyValue())
ProfileRelease()

If mMidiOut Then midiOutClose(mMidiOut)

Shell_NotifyIcon(NIM_DELETE, @SystrayIcon)
End Sub

Expand All @@ -4492,22 +4517,48 @@ Private Sub frmClockType.TimerComponent1_Timer(ByRef Sender As TimerComponent)

Static sNow As Double
Dim dNow As Double = Now()
If sNow = dNow Then Exit Sub

'1/4,1/2, 整点报时
If sNow = dNow Then Exit Sub
sNow = dNow
If mnuAnnounce0.Checked Then Exit Sub
If Second(dNow) <> 0 Then Exit Sub
Dim m As Integer = Minute(dNow)
Dim h As Integer = Hour(dNow)
If mnuAnnounce1.Checked Then
If m = 0 Then SpeechNow(dNow, mLanguage)
End If
If mnuAnnounce2.Checked Then
If m = 0 Or m = 30 Then SpeechNow(dNow, mLanguage)

Dim m As Integer
Dim h As Integer

'midi报时
If Second(dNow) = 0 Then
m = Minute(dNow)
h = Hour(dNow)
If mnuAnnounce1.Checked Then
If m = 0 Then
If mMidiOut Then SendNoteOn(mMidiOut, 0, 61, 255)
End If
End If
If mnuAnnounce2.Checked Then
If m = 0 Or m = 30 Then
If mMidiOut Then SendNoteOn(mMidiOut, 0, 61, 255)
End If
End If
If mnuAnnounce3.Checked Then
If m = 0 Or m = 15 Or m = 30 Or m = 45 Then
If mMidiOut Then SendNoteOn(mMidiOut, 0, 61, 255)
End If
End If
End If
If mnuAnnounce3.Checked Then
If m = 0 Or m = 15 Or m = 30 Or m = 45 Then SpeechNow(dNow, mLanguage)

'1/4,1/2,整点报时
If Second(dNow) = 1 Then
m = Minute(dNow)
h = Hour(dNow)
If mnuAnnounce1.Checked Then
If m = 0 Then SpeechNow(dNow, mLanguage)
End If
If mnuAnnounce2.Checked Then
If m = 0 Or m = 30 Then SpeechNow(dNow, mLanguage)
End If
If mnuAnnounce3.Checked Then
If m = 0 Or m = 15 Or m = 30 Or m = 45 Then SpeechNow(dNow, mLanguage)
End If
End If
End Sub

Expand All @@ -4529,7 +4580,7 @@ Private Sub frmClockType.Form_MouseMove(ByRef Sender As Control, MouseButton As
End Sub

Private Sub frmClockType.Form_Click(ByRef Sender As Control)

If mMidiOut Then SendNoteOn(mMidiOut, 0, 61, 255)
End Sub

Private Sub frmClockType.Form_DropFile(ByRef Sender As Control, ByRef Filename As WString)
Expand Down
6 changes: 5 additions & 1 deletion frmDay.frm
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
'#Region "Form"
' frmDay日历
' Copyright (c) 2024 CM.Wang
' Freeware. Use at your own risk.

'#Region "Form"
#if defined(__FB_MAIN__) AndAlso Not defined(__MAIN_FILE__)
#define __MAIN_FILE__
#ifdef __FB_WIN32__
Expand Down
6 changes: 5 additions & 1 deletion frmMonth.frm
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
'#Region "Form"
' frmMonth月历
' Copyright (c) 2024 CM.Wang
' Freeware. Use at your own risk.

'#Region "Form"
#if defined(__FB_MAIN__) AndAlso Not defined(__MAIN_FILE__)
#define __MAIN_FILE__
#ifdef __FB_WIN32__
Expand Down
2 changes: 2 additions & 0 deletions gdipAnalogClock.bas
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ Private Property AnalogClock.FileName(ByRef fFileName As WString)
mBackScale = mBackImage.Height / mBackImage.Width
End If
End Property

Private Property AnalogClock.FileName() ByRef As WString
If mBackFile Then
Return *mBackFile
Expand Down Expand Up @@ -126,6 +127,7 @@ Private Function AnalogClock.DrawTray() As GpImage Ptr

Return sTmpBitmap.Image
End Function

Private Function AnalogClock.DrawScale() As GpImage Ptr
Dim As Single fRadius = mWidth / 2
'刻度距离边缘
Expand Down
4 changes: 2 additions & 2 deletions gdipClock.rc
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
#define APP_TITLE_STR "gdipClock\0"
#define VER_FILEDESCRIPTION_STR "gdipClock\0"

#define VER_FILEVERSION 0,0,0,2632
#define VER_FILEVERSION_STR "0.0.0.2632\0"
#define VER_FILEVERSION 0,0,0,2740
#define VER_FILEVERSION_STR "0.0.0.2740\0"

#define VER_LEGALCOPYRIGHT_STR "Cm.Wang\0"

Expand Down
4 changes: 2 additions & 2 deletions gdipClock.vfp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ OpenProjectAsFolder=false
MajorVersion=0
MinorVersion=0
RevisionVersion=0
BuildVersion=2632
BuildVersion=2740
AutoIncrementVersion=false
ApplicationTitle="gdipClock"
ApplicationIcon=""
Expand All @@ -43,7 +43,7 @@ OptimizationLevel=0
OptimizationFastCode=false
OptimizationSmallCode=false
CompilationArguments32Windows="-x "gdipClock32.exe""
CompilationArguments64Windows="-x "gdipClock64.exe""
CompilationArguments64Windows="-x "gdipClock64.exe" -gen gas64"
CompilationArguments32Linux=""
CompilationArguments64Linux=""
CompilerPath=""
Expand Down
Loading

0 comments on commit 90a882c

Please # to comment.