diff --git a/Pomodoro_Timer.xlsb b/Pomodoro_Timer.xlsb index 7737bcc..6e46692 100644 Binary files a/Pomodoro_Timer.xlsb and b/Pomodoro_Timer.xlsb differ diff --git a/src/Pomodoro_Timer.xlsb/API_AlwaysOnTop.bas b/src/Pomodoro_Timer.xlsb/API_AlwaysOnTop.bas index af56e3f..421d63a 100644 --- a/src/Pomodoro_Timer.xlsb/API_AlwaysOnTop.bas +++ b/src/Pomodoro_Timer.xlsb/API_AlwaysOnTop.bas @@ -20,45 +20,30 @@ End Enum 'See also: https://sysmod.wordpress.com/2016/09/03/conditional-compilation-vba-excel-macwin3264/ 'For Mac declarations -#If Mac Then - #If MAC_OFFICE_VERSION >= 15 Then - #If VBA7 Then ' 64-bit Excel 2016 for Mac - Declare PtrSafe Function SetWindowPos _ - Lib "/Applications/Microsoft Excel.app/Contents/Frameworks/MicrosoftOffice.framework/MicrosoftOffice" _ - (ByVal hWnd As LongPtr, _ - ByVal hWndInsertAfter As LongPtr, _ - ByVal X As Long, _ - ByVal Y As Long, _ - ByVal cx As Long, _ - ByVal cy As Long, _ - ByVal uFlags As Long) As Long - - Declare PtrSafe Function FindWindow _ - Lib "/Applications/Microsoft Excel.app/Contents/Frameworks/MicrosoftOffice.framework/MicrosoftOffice" _ - Alias "FindWindowA" _ - (ByVal lpClassName As String, _ - ByVal lpWindowName As String) As LongPtr - #Else ' 32-bit Excel 2016 for Mac - Declare Function SetWindowPos _ - Lib "/Applications/Microsoft Excel.app/Contents/Frameworks/MicrosoftOffice.framework/MicrosoftOffice" _ - (ByVal hWnd As Long, _ - ByVal hWndInsertAfter As Long, _ - ByVal X As Long, _ - ByVal Y As Long, _ - ByVal cx As Long, _ - ByVal cy As Long, _ - ByVal uFlags As Long) As Long - - Declare Function FindWindow _ - Lib "/Applications/Microsoft Excel.app/Contents/Frameworks/MicrosoftOffice.framework/MicrosoftOffice" _ - Alias "FindWindowA" _ - (ByVal lpClassName As String, _ - ByVal lpWindowName As String) As Long - #End If - #Else ' 32-bit Excel 2011 for Mac - - Declare Function SetWindowPos _ - Lib "Applications:Microsoft Office 2011:Office:MicrosoftOffice.framework:MicrosoftOffice" _ + +#If VBA7 Then ' Excel 2010 or later for Windows + + 'VBA version 7 compiler, therefore >= Office 2010 + 'PtrSafe means function works in 32-bit and 64-bit Office + 'LongPtr type alias resolves to Long (32 bits) in 32-bit Office, or LongLong (64 bits) in 64-bit Office + + Public Declare PtrSafe Function SetWindowPos Lib "user32" _ + (ByVal hWnd As LongPtr, _ + ByVal hWndInsertAfter As LongPtr, _ + ByVal X As Long, _ + ByVal Y As Long, _ + ByVal cx As Long, _ + ByVal cy As Long, _ + ByVal uFlags As Long) As Long + + Public Declare PtrSafe Function FindWindow Lib "user32" Alias "FindWindowA" _ + (ByVal lpClassName As String, _ + ByVal lpWindowName As String) As LongPtr + +#Else ' pre Excel 2010 for Windows + 'VBA version 6 or earlier compiler, therefore <= Office 2007 + + Public Declare Function SetWindowPos Lib "user32" _ (ByVal hWnd As Long, _ ByVal hWndInsertAfter As Long, _ ByVal X As Long, _ @@ -66,51 +51,12 @@ End Enum ByVal cx As Long, _ ByVal cy As Long, _ ByVal uFlags As Long) As Long - - Declare Function FindWindow _ - Lib "Applications:Microsoft Office 2011:Office:MicrosoftOffice.framework:MicrosoftOffice" _ - Alias "FindWindowA" _ + + Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" _ (ByVal lpClassName As String, _ ByVal lpWindowName As String) As Long - #End If -#Else - #If VBA7 Then ' Excel 2010 or later for Windows - - 'VBA version 7 compiler, therefore >= Office 2010 - 'PtrSafe means function works in 32-bit and 64-bit Office - 'LongPtr type alias resolves to Long (32 bits) in 32-bit Office, or LongLong (64 bits) in 64-bit Office - - Public Declare PtrSafe Function SetWindowPos Lib "user32" _ - (ByVal hWnd As LongPtr, _ - ByVal hWndInsertAfter As LongPtr, _ - ByVal X As Long, _ - ByVal Y As Long, _ - ByVal cx As Long, _ - ByVal cy As Long, _ - ByVal uFlags As Long) As Long - - Public Declare PtrSafe Function FindWindow Lib "user32" Alias "FindWindowA" _ - (ByVal lpClassName As String, _ - ByVal lpWindowName As String) As LongPtr - - #Else ' pre Excel 2010 for Windows - 'VBA version 6 or earlier compiler, therefore <= Office 2007 - - Public Declare Function SetWindowPos Lib "user32" _ - (ByVal hWnd As Long, _ - ByVal hWndInsertAfter As Long, _ - ByVal X As Long, _ - ByVal Y As Long, _ - ByVal cx As Long, _ - ByVal cy As Long, _ - ByVal uFlags As Long) As Long - - Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" _ - (ByVal lpClassName As String, _ - ByVal lpWindowName As String) As Long - - #End If #End If + diff --git a/src/Pomodoro_Timer.xlsb/API_Sleep.bas b/src/Pomodoro_Timer.xlsb/API_Sleep.bas index 6908c8e..1f4806f 100644 --- a/src/Pomodoro_Timer.xlsb/API_Sleep.bas +++ b/src/Pomodoro_Timer.xlsb/API_Sleep.bas @@ -3,35 +3,14 @@ Attribute VB_Name = "API_Sleep" Option Explicit -#If Mac Then - #If MAC_OFFICE_VERSION >= 15 Then - #If VBA7 Then ' 64-bit Excel 2016 for Mac - - Public Declare PtrSafe Sub Sleep _ - Lib "/Applications/Microsoft Excel.app/Contents/Frameworks/MicrosoftOffice.framework/MicrosoftOffice" _ - (ByVal dwMilliseconds As Long) - #Else ' 32-bit Excel 2016 for Mac - - Public Declare Sub Sleep _ - Lib "/Applications/Microsoft Excel.app/Contents/Frameworks/MicrosoftOffice.framework/MicrosoftOffice" _ - (ByVal dwMilliseconds As Long) - - #End If - #Else ' 32-bit Excel 2011 for Mac - Public Declare Sub Sleep _ - Lib "Applications:Microsoft Office 2011:Office:MicrosoftOffice.framework:MicrosoftOffice" _ - (ByVal dwMilliseconds As Long) - #End If -#Else - #If VBA7 Then ' Excel 2010 or later for Windows - - Public Declare PtrSafe Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long) 'For 64 Bit Systems - - #Else ' pre Excel 2010 for Windows - - Public Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long) 'For 32 Bit Systems +#If VBA7 Then ' Excel 2010 or later for Windows + + Public Declare PtrSafe Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long) 'For 64 Bit Systems + +#Else ' pre Excel 2010 for Windows - #End If + Public Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long) 'For 32 Bit Systems + #End If diff --git a/src/Pomodoro_Timer.xlsb/CountDown_mac.bas b/src/Pomodoro_Timer.xlsb/CountDown_mac.bas new file mode 100644 index 0000000..5ed66d3 --- /dev/null +++ b/src/Pomodoro_Timer.xlsb/CountDown_mac.bas @@ -0,0 +1,205 @@ +Attribute VB_Name = "CountDown_mac" +Option Explicit + +Const FREQ = 1 + +Sub Launch_timer_mac() + 'Stop the code if the form is not visible + If UFIsVisible = False Then: Debug.Print "Form is not visible. The code will now stop.": End + + Dim frm As UserForm + Set frm = PomodoroTimer + Call Optimize_VBA_Performance(True) + + OngoingTimer = True + StopTimer = False + CloseTimer = False + frm.CommandButton2.caption = "Cancel" + + 'Reset the colors + PomodoroTimer.BackColor = -2147483633 + frm.TextBox2.BackColor = -2147483633 + frm.tBx1.BackColor = -2147483633 + + StartTime = Now() + TodaysDate = Date + + + Dim M As Double, S As Double + Dim TotalTime + Dim EndTime As Double + Dim RemaingTime As Double + + TotalTime = 60 * AllowedTime + AllowedTimeSec + EndTime = DateAdd("s", TotalTime, Now()) + RemaingTime = DateDiff("s", Now(), EndTime) + + RemaingTime = DateDiff("s", Now(), EndTime) + M = Int(RemaingTime / 60) + S = RemaingTime - 60 * M + + With frm.tBx1 + .Value = Format(CStr(M), "00") & ":" & Format(CStr(S), "00") + End With + + 'Released the control to the OS + 'DoEvents + + 'Now "sleep" + Application.OnTime Now + TimeValue("00:00:01") * FREQ, "Launch_timer_mac2" + +End Sub + +Sub Launch_timer_mac2() + Dim frm As UserForm + Set frm = PomodoroTimer + + Dim M As Double, S As Double + Dim TotalTime + Dim EllapsedtTime + Dim StartTime As Double + Dim EndTime As Double + Dim RemaingTime As Double + + TotalTime = 60 * AllowedTime + AllowedTimeSec +' EllapsedtTime = TotalTime - (60 * Split(frm.tBx1.Value, ":")(0) + 1 * Split(frm.tBx1.Value, ":")(1)) +' M = Int(EllapsedtTime / 60) +' S = EllapsedtTime - 60 * M +' EndTime = DateAdd("s", TotalTime, Now()) +' StartTime = Now() - TimeValue("00:" & Format(CStr(M), "00") & ":" & Format(CStr(S), "00")) + RemaingTime = 60 * Split(frm.tBx1.Value, ":")(0) + 1 * Split(frm.tBx1.Value, ":")(1) + + If RemaingTime > 0 And Not StopTimer Then + RemaingTime = RemaingTime - FREQ + M = Int(RemaingTime / 60) + S = RemaingTime - 60 * M + + With frm.tBx1 + .Value = Format(CStr(M), "00") & ":" & Format(CStr(S), "00") + End With + + 'Released the control to the OS + 'DoEvents + + 'Now "sleep" + Application.OnTime Now + TimeValue("00:00:01") * FREQ, "Launch_timer_mac2" + + Else + + 'Since we are using the "Application.ontime" technique, it is possible that some public variables will have lost their values + If TodaysDate = 0 Then TodaysDate = Date + If StartTime = 0 Then + EllapsedtTime = TotalTime - RemaingTime + M = Int(EllapsedtTime / 60) + S = EllapsedtTime - 60 * M + StartTime = Now() - TimeValue("00:" & Format(CStr(M), "00") & ":" & Format(CStr(S), "00")) + End If + + 'Recording session + If StopTimer = False Or ThisWorkbook.Sheets("Settings").Range("Record_unfinished").Value2 = True Then + If (TotalTime - RemaingTime) / 60 > ThisWorkbook.Sheets("Settings").Range("No_Recording_limit") Then + Call Add_new_record(TodaysDate, StartTime, Now, Not (StopTimer), Range("TaskNameRng")) + End If + End If + + Call Optimize_VBA_Performance(False, xlAutomatic) + + If StopTimer = False Then 'If the timer was stopped by the user + 'Proceed with the Break + If ThisWorkbook.Sheets("Settings").Range("Sound_end_Pomodoro") = True Then Beep + frm.TextBox2.Value = "Break" + Call TakeBreak_mac + Else + 'Do nothing + frm.CommandButton2.caption = "Start" + OngoingTimer = False + End If + + If CloseTimer Then Unload frm + End If +End Sub + +Private Sub TakeBreak_mac() + Dim frm As UserForm + Set frm = PomodoroTimer + 'Reset StopTimer: + StopTimer = False + + Call Optimize_VBA_Performance(True) + + Dim M As Double, S As Double + M = BreakTime + S = BreakTimeSec + + With frm.tBx1 + .Value = Format(CStr(M), "00") & ":" & Format(CStr(S), "00") + End With + + Call TakeBreak_mac2 + +End Sub + +Private Sub TakeBreak_mac2() + Dim frm As UserForm + Set frm = PomodoroTimer + Dim M As Long, S As Long + Dim EndTime As Double + Dim RemaingTime As Double + Dim TotalTime As Long + + TotalTime = 60 * BreakTime + BreakTimeSec + RemaingTime = 60 * Split(frm.tBx1.Value, ":")(0) + 1 * Split(frm.tBx1.Value, ":")(1) + + If RemaingTime > 0 And Not StopTimer Then + RemaingTime = RemaingTime - FREQ + M = Int(RemaingTime / 60) + S = RemaingTime - 60 * M + + 'Flashing + If TotalTime - RemaingTime < 9 Then + If S Mod 2 = 1 Then + frm.BackColor = GetRGBColor_Fill(Range("Flashing_color")) 'Flashing color + frm.TextBox2.BackColor = GetRGBColor_Fill(Range("Flashing_color")) 'Flashing color + frm.tBx1.BackColor = GetRGBColor_Fill(Range("Flashing_color")) 'Flashing color + Else + frm.BackColor = -2147483633 'Normal color + frm.TextBox2.BackColor = -2147483633 'Normal color + frm.tBx1.BackColor = -2147483633 'Normal color + End If + End If + + With frm.tBx1 + .Value = Format(CStr(M), "00") & ":" & Format(CStr(S), "00") + End With + 'Released the control to the OS + 'DoEvents + 'Now "sleep" + Application.OnTime Now + TimeValue("00:00:01") * FREQ, "TakeBreak_mac2" + + Else + + If StopTimer = False Then + If ThisWorkbook.Sheets("Settings").Range("Sound_end_Break") = True Then Beep + 'Remain in color to get the user's attention + frm.BackColor = GetRGBColor_Fill(Range("Flashing_color")) 'Flashing color + frm.TextBox2.BackColor = GetRGBColor_Fill(Range("Flashing_color")) 'Flashing color + frm.tBx1.BackColor = GetRGBColor_Fill(Range("Flashing_color")) 'Flashing color + Else + frm.BackColor = -2147483633 'Normal color + frm.TextBox2.BackColor = -2147483633 'Normal color + frm.tBx1.BackColor = -2147483633 'Normal color + End If + frm.TextBox2.Value = "" + frm.CommandButton2.caption = "Start" + OngoingTimer = False + + 'Redo basic calculations form the initialize macro + M = Int(AllowedTime) + S = (AllowedTime - Int(AllowedTime)) * 60 + With frm.tBx1 + .Value = Format(CStr(M), "00") & ":" & Format(CStr(S), "00") + End With + + Call Optimize_VBA_Performance(False, xlAutomatic) + End If +End Sub diff --git a/src/Pomodoro_Timer.xlsb/Main.bas b/src/Pomodoro_Timer.xlsb/Main.bas index 72aa749..c973b25 100644 --- a/src/Pomodoro_Timer.xlsb/Main.bas +++ b/src/Pomodoro_Timer.xlsb/Main.bas @@ -13,6 +13,7 @@ Public CloseTimer As Boolean 'User clicked the X Public OngoingTimer As Boolean 'Take the value true after the timer has started (was initialized) Public StartTime As Variant Public TodaysDate As Variant +Public UFIsVisible As Boolean Sub PomodoroSession() AllowedTime = Range("Pomodoro") @@ -20,9 +21,9 @@ Sub PomodoroSession() BreakTime = Range("Break") BreakTimeSec = Range("Break_sec") AutoLaunch = True - If Range("Run_in_seperate_instance").Value = True And Reopen_decision = True Then + If Range("Run_in_seperate_instance").Value = True And Reopen_decision = True And Not IsMac Then MsgBox "To let you work with Excel while the timer is running, this file will now be reopen in a second instance of Excel." & vbNewLine & _ - "Once, the file has been reopen, you will need to relaunch the timer." + "Once, the file has been reopened, you will need to relaunch the timer." Call OpenItSelfInAnotherInstance End If ThisWorkbook.Application.WindowState = xlMinimized diff --git a/src/Pomodoro_Timer.xlsb/NamedRanges.csv b/src/Pomodoro_Timer.xlsb/NamedRanges.csv new file mode 100644 index 0000000..50f4ec4 --- /dev/null +++ b/src/Pomodoro_Timer.xlsb/NamedRanges.csv @@ -0,0 +1,18 @@ +Break;=Settings!$B$4; +Break_sec;=Settings!$B$5; +Custom_position;=Settings!$B$12; +Flashing_color;=Settings!$B$16; +Left_pos;=Settings!$B$13; +No_Recording_limit;=Settings!$B$9; +Pomodoro;=Settings!$B$2; +Pomodoro_sec;=Settings!$B$3; +Recent_Tasks;=OFFSET(Recent!$A$2,0,0,COUNTA(Recent!$A$2:$A$1000002)); +Record_unfinished;=Settings!$B$8; +Reopen_Excel_after_x;=Settings!$B$7; +Run_in_seperate_instance;=Settings!$B$6; +Shortcut;=Settings!$B$15; +Sound_end_Break;=Settings!$B$11; +Sound_end_Pomodoro;=Settings!$B$10; +TaskNameRng;=Pomodoro!$E$2; +Top_pos;=Settings!$B$14; +TopLeftCorner;=Table24[[#Headers],[Date]]; diff --git a/src/Pomodoro_Timer.xlsb/PomodoroTimer.frm b/src/Pomodoro_Timer.xlsb/PomodoroTimer.frm index 3511148..6e9a3f7 100644 --- a/src/Pomodoro_Timer.xlsb/PomodoroTimer.frm +++ b/src/Pomodoro_Timer.xlsb/PomodoroTimer.frm @@ -21,14 +21,15 @@ Option Explicit Const sleeptime = 10 'Miliseconds Private Sub UserForm_Initialize() - + UFIsVisible = True 'Position of the Userform - Me.StartUpPosition = 0 - If Range("Custom_position") = True Then - Me.Top = Range("Top_pos").Value2 * (PointPerPixelY() * GETWORKAREA_HEIGHT - Me.Height) - Me.Left = Range("Left_pos").Value2 * (PointPerPixelX() * GETWORKAREA_WIDTH - Me.Width) + If ThisWorkbook.Sheets("Settings").Range("Custom_position") = True And Not IsMac Then + Me.StartUpPosition = 0 + Me.Top = ThisWorkbook.Sheets("Settings").Range("Top_pos").Value2 * (PointPerPixelY() * GETWORKAREA_HEIGHT - Me.Height) + Me.Left = ThisWorkbook.Sheets("Settings").Range("Left_pos").Value2 * (PointPerPixelX() * GETWORKAREA_WIDTH - Me.Width) ElseIf Not IsMac Then 'Reposition the window + Me.StartUpPosition = 0 Me.Top = PointPerPixelY() * GETWORKAREA_HEIGHT - Me.Height Me.Left = PointPerPixelX() * GETWORKAREA_WIDTH - Me.Width End If @@ -45,16 +46,27 @@ Private Sub UserForm_Initialize() 'The code below makes sure that the userform stays on top of all windows. 'Source: https://www.mrexcel.com/forum/excel-questions/386643-userform-always-top.html - - AlwaysOnTop Me.caption - + If Not IsMac Then + AlwaysOnTop Me.caption + End If + + If AutoLaunch Then + If Not IsMac Then + Call Launch_timer + Else + Call Launch_timer_mac + End If + End If End Sub Private Sub UserForm_Activate() - If AutoLaunch Then Call Launch_timer + 'Nothing End Sub Private Sub Launch_timer() + 'Stop the code if the form is not visible + If UFIsVisible = False Then: Debug.Print "Form is not visible. The code will now stop.": End + Dim calc_iniset As Variant: calc_iniset = Application.Calculation Call Optimize_VBA_Performance(True) @@ -102,7 +114,7 @@ Private Sub Launch_timer() 'Recording session If StopTimer = False Or ThisWorkbook.Sheets("Settings").Range("Record_unfinished").Value2 = True Then If (TotalTime - RemaingTime) / 60 > ThisWorkbook.Sheets("Settings").Range("No_Recording_limit") Then - Call Add_new_record(TodaysDate, StartTime, Now, Not (StopTimer), Range("TaskNameRng")) + Call Add_new_record(TodaysDate, StartTime, Now, Not (StopTimer), ThisWorkbook.Sheets("Pomodoro").Range("TaskNameRng")) End If End If @@ -163,9 +175,9 @@ Private Sub TakeBreak2() 'Flashing If TotalTime - RemaingTime < 9 Then If S Mod 2 = 1 Then - PomodoroTimer.BackColor = GetRGBColor_Fill(Range("Flashing_color")) 'Flashing color - TextBox2.BackColor = GetRGBColor_Fill(Range("Flashing_color")) 'Flashing color - tBx1.BackColor = GetRGBColor_Fill(Range("Flashing_color")) 'Flashing color + PomodoroTimer.BackColor = GetRGBColor_Fill(ThisWorkbook.Sheets("Settings").Range("Flashing_color")) 'Flashing color + TextBox2.BackColor = GetRGBColor_Fill(ThisWorkbook.Sheets("Settings").Range("Flashing_color")) 'Flashing color + tBx1.BackColor = GetRGBColor_Fill(ThisWorkbook.Sheets("Settings").Range("Flashing_color")) 'Flashing color Else PomodoroTimer.BackColor = -2147483633 'Normal color TextBox2.BackColor = -2147483633 'Normal color @@ -185,9 +197,9 @@ Private Sub TakeBreak2() If StopTimer = False Then If ThisWorkbook.Sheets("Settings").Range("Sound_end_Break") = True Then Beep 'Remain in color to get the user's attention - PomodoroTimer.BackColor = GetRGBColor_Fill(Range("Flashing_color")) 'Flashing color - TextBox2.BackColor = GetRGBColor_Fill(Range("Flashing_color")) 'Flashing color - tBx1.BackColor = GetRGBColor_Fill(Range("Flashing_color")) 'Flashing color + PomodoroTimer.BackColor = GetRGBColor_Fill(ThisWorkbook.Sheets("Settings").Range("Flashing_color")) 'Flashing color + TextBox2.BackColor = GetRGBColor_Fill(ThisWorkbook.Sheets("Settings").Range("Flashing_color")) 'Flashing color + tBx1.BackColor = GetRGBColor_Fill(ThisWorkbook.Sheets("Settings").Range("Flashing_color")) 'Flashing color Else PomodoroTimer.BackColor = -2147483633 'Normal color TextBox2.BackColor = -2147483633 'Normal color @@ -210,8 +222,14 @@ End Sub Private Sub CommandButton2_Click() If OngoingTimer = False Then 'Start the timer + UFIsVisible = True 'The form must be visible + ThisWorkbook.Application.WindowState = xlMinimized CommandButton2.caption = "Cancel" - Call Launch_timer + If Not IsMac Then + Call Launch_timer + Else + Call Launch_timer_mac + End If Else 'Stop the timer StopTimer = True OngoingTimer = False @@ -233,7 +251,7 @@ Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer) 'At this point, since the user clicked on the userform to close it. Excel is the active window, but it might not be on top. 'Make Excel the active window (optional) On Error Resume Next - If ThisWorkbook.Sheets("Settings").Range("Reopen_Excel_after_x").Value2 = True Then + If ThisWorkbook.Sheets("Settings").Range("Reopen_Excel_after_x").Value2 = True And Not IsMac Then Call AppActivate(Wkb.Application.caption, True) ShowWindow GetForegroundWindow, SW_SHOWMAXIMIZED End If @@ -270,3 +288,7 @@ Private Sub AlwaysOnTop(caption As String) End If End Sub + +Private Sub UserForm_Terminate() + UFIsVisible = False +End Sub diff --git a/src/Pomodoro_Timer.xlsb/PomodoroTimer.frx b/src/Pomodoro_Timer.xlsb/PomodoroTimer.frx index 37af8fe..97c24ed 100644 Binary files a/src/Pomodoro_Timer.xlsb/PomodoroTimer.frx and b/src/Pomodoro_Timer.xlsb/PomodoroTimer.frx differ diff --git a/src/Pomodoro_Timer.xlsb/Records.bas b/src/Pomodoro_Timer.xlsb/Records.bas index 9b0fc1e..2614cd7 100644 --- a/src/Pomodoro_Timer.xlsb/Records.bas +++ b/src/Pomodoro_Timer.xlsb/Records.bas @@ -14,7 +14,7 @@ End Sub Sub new_record_test() -Call Add_new_record(Date, Now, Now, True, "TaskName") + Call Add_new_record(Date, Now, Now, True, "TaskName") End Sub diff --git a/src/Pomodoro_Timer.xlsb/Sheet1.sheet.cls b/src/Pomodoro_Timer.xlsb/Sheet1.sheet.cls new file mode 100644 index 0000000..e69de29 diff --git a/src/Pomodoro_Timer.xlsb/Sheet3.sheet.cls b/src/Pomodoro_Timer.xlsb/Sheet3.sheet.cls new file mode 100644 index 0000000..4f97aa8 --- /dev/null +++ b/src/Pomodoro_Timer.xlsb/Sheet3.sheet.cls @@ -0,0 +1 @@ +Option Explicit diff --git a/src/Pomodoro_Timer.xlsb/Sheet5.sheet.cls b/src/Pomodoro_Timer.xlsb/Sheet5.sheet.cls new file mode 100644 index 0000000..4f97aa8 --- /dev/null +++ b/src/Pomodoro_Timer.xlsb/Sheet5.sheet.cls @@ -0,0 +1 @@ +Option Explicit diff --git a/src/Pomodoro_Timer.xlsb/ThisWorkbook.sheet.cls b/src/Pomodoro_Timer.xlsb/ThisWorkbook.sheet.cls index b56ad7b..40e3c59 100644 --- a/src/Pomodoro_Timer.xlsb/ThisWorkbook.sheet.cls +++ b/src/Pomodoro_Timer.xlsb/ThisWorkbook.sheet.cls @@ -1,12 +1,29 @@ Private Sub Workbook_Open() - If Sheets("Settings").Range("Run_in_seperate_instance").Value = True Then - If Reopen_decision = True Then Call OpenItSelfInAnotherInstance - End If If Sheets("Settings").Range("Shortcut").Value = True Then Call Shortcuts End If + Call MacOptions End Sub Sub Shortcuts() Application.OnKey "{F10}", "PomodoroSession" +End Sub + +Sub MacOptions() +'PURPOSE: Hide options that are not available for Mac + +If IsMac Then + Range("Reopen_Excel_after_x").EntireRow.Hidden = True + Range("Run_in_seperate_instance").EntireRow.Hidden = True + Range("Custom_position").EntireRow.Hidden = True + Range("Left_pos").EntireRow.Hidden = True + Range("Top_pos").EntireRow.Hidden = True +Else + Range("Reopen_Excel_after_x").EntireRow.Hidden = False + Range("Run_in_seperate_instance").EntireRow.Hidden = False + Range("Custom_position").EntireRow.Hidden = False + Range("Left_pos").EntireRow.Hidden = False + Range("Top_pos").EntireRow.Hidden = False +End If + End Sub \ No newline at end of file