Skip to content

Commit

Permalink
changed all references from iTunesAlarm to iSnooze, except for file &…
Browse files Browse the repository at this point in the history
… class names.

added the ability to disable single alarms without deleting them.
icon now turns red whenever it's not going to go off, not just when it is explicitly disabled.
  • Loading branch information
codingismy11to7 committed Jul 28, 2006
1 parent cc8183f commit 56767b6
Show file tree
Hide file tree
Showing 38 changed files with 333 additions and 242 deletions.
10 changes: 5 additions & 5 deletions AboutDlg.cpp
Expand Up @@ -2,20 +2,20 @@
//
// Copyright (c) 2004, Steven Scott (progoth@gmail.com)
//
// This file is part of iTunesAlarm.
// This file is part of iSnooze.
//
// iTunesAlarm is free software; you can redistribute it and/or modify
// iSnooze is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// iTunesAlarm is distributed in the hope that it will be useful,
// iSnooze is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with iTunesAlarm; if not, write to the Free Software
// along with iSnooze; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

#include "stdafx.h"
Expand Down Expand Up @@ -64,6 +64,6 @@ BOOL CAboutDlg::OnInitDialog(void)

void CAboutDlg::OnBnClickedPaypal()
{
ShellExecute( GetSafeHwnd(), _T("open"), _T("https://www.paypal.com/xclick/business=progoth%40gmail.com&no_shipping=1&item_name=Donation%20to%20iTunesAlarm!&no_note=1&tax=0&currency_code=USD"),
ShellExecute( GetSafeHwnd(), _T("open"), _T("https://www.paypal.com/xclick/business=progoth%40gmail.com&no_shipping=1&item_name=Donation%20to%20iSnooze!&no_note=1&tax=0&currency_code=USD"),
NULL, NULL, 0 );
}
8 changes: 4 additions & 4 deletions AboutDlg.h
@@ -1,19 +1,19 @@
// Copyright (c) 2004, Steven Scott (progoth@gmail.com)
//
// This file is part of iTunesAlarm.
// This file is part of iSnooze.
//
// iTunesAlarm is free software; you can redistribute it and/or modify
// iSnooze is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// iTunesAlarm is distributed in the hope that it will be useful,
// iSnooze is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with iTunesAlarm; if not, write to the Free Software
// along with iSnooze; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

#pragma once
Expand Down
8 changes: 4 additions & 4 deletions ChildView.cpp
Expand Up @@ -2,20 +2,20 @@
//
// Copyright (c) 2004, Steven Scott (progoth@gmail.com)
//
// This file is part of iTunesAlarm.
// This file is part of iSnooze.
//
// iTunesAlarm is free software; you can redistribute it and/or modify
// iSnooze is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// iTunesAlarm is distributed in the hope that it will be useful,
// iSnooze is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with iTunesAlarm; if not, write to the Free Software
// along with iSnooze; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

#include "stdafx.h"
Expand Down
8 changes: 4 additions & 4 deletions ChildView.h
Expand Up @@ -2,20 +2,20 @@
//
// Copyright (c) 2004, Steven Scott (progoth@gmail.com)
//
// This file is part of iTunesAlarm.
// This file is part of iSnooze.
//
// iTunesAlarm is free software; you can redistribute it and/or modify
// iSnooze is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// iTunesAlarm is distributed in the hope that it will be useful,
// iSnooze is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with iTunesAlarm; if not, write to the Free Software
// along with iSnooze; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA


Expand Down
24 changes: 16 additions & 8 deletions ConfigDlg.cpp
Expand Up @@ -2,20 +2,20 @@
//
// Copyright (c) 2004, Steven Scott (progoth@gmail.com)
//
// This file is part of iTunesAlarm.
// This file is part of iSnooze.
//
// iTunesAlarm is free software; you can redistribute it and/or modify
// iSnooze is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// iTunesAlarm is distributed in the hope that it will be useful,
// iSnooze is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with iTunesAlarm; if not, write to the Free Software
// along with iSnooze; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

#include "stdafx.h"
Expand Down Expand Up @@ -164,7 +164,7 @@ void CConfigDlg::LoadFromReg()
CButton *runatstartup = (CButton*)GetDlgItem( IDC_STARTUP_CHECK );
RegMap t(HKEY_CURRENT_USER);
t = t[_T("Software")][_T("Microsoft")][_T("Windows")][_T("CurrentVersion")][_T("Run")];
runatstartup->SetCheck( ((t.has_key(_T("iTunesAlarm")))?BST_CHECKED:BST_UNCHECKED) );
runatstartup->SetCheck( ((t.has_key(_T("iSnooze")))?BST_CHECKED:BST_UNCHECKED) );

long st = 0xff & (long)m_reg[_T("SnoozeTime")];
if( st < 1 ) st = 1; if( st > 60 ) st = 60;
Expand Down Expand Up @@ -202,6 +202,7 @@ void CConfigDlg::SetDlgTimeFromTAD( const DayTime::TimeAndDays &in )
((CButton*)GetDlgItem(IDC_THURSDAY_CHECK))->SetCheck( ((in.day & DayTime::THURSDAY)?BST_CHECKED:BST_UNCHECKED) );
((CButton*)GetDlgItem(IDC_FRIDAY_CHECK))->SetCheck( ((in.day & DayTime::FRIDAY)?BST_CHECKED:BST_UNCHECKED) );
((CButton*)GetDlgItem(IDC_SATURDAY_CHECK))->SetCheck( ((in.day & DayTime::SATURDAY)?BST_CHECKED:BST_UNCHECKED) );
((CButton*)GetDlgItem(IDC_SINGLE_ENABLE))->SetCheck( ((in.day & DayTime::ALARM_ENABLED)?BST_CHECKED:BST_UNCHECKED) );
}

void CConfigDlg::SaveTimeToReg()
Expand All @@ -227,6 +228,7 @@ void CConfigDlg::GetTADFromDlgTime( DayTime::TimeAndDays &out )
if( ((CButton*)GetDlgItem(IDC_THURSDAY_CHECK))->GetCheck() == BST_CHECKED ) out.day |= DayTime::THURSDAY;
if( ((CButton*)GetDlgItem(IDC_FRIDAY_CHECK))->GetCheck() == BST_CHECKED ) out.day |= DayTime::FRIDAY;
if( ((CButton*)GetDlgItem(IDC_SATURDAY_CHECK))->GetCheck() == BST_CHECKED ) out.day |= DayTime::SATURDAY;
if( ((CButton*)GetDlgItem(IDC_SINGLE_ENABLE))->GetCheck() == BST_CHECKED ) out.day |= DayTime::ALARM_ENABLED;
}

void CConfigDlg::SelectPlaylist()
Expand Down Expand Up @@ -300,6 +302,7 @@ BEGIN_MESSAGE_MAP(CConfigDlg, CDialog)
ON_BN_CLICKED(IDC_THURSDAY_CHECK, OnBnClickedThursdayCheck)
ON_BN_CLICKED(IDC_FRIDAY_CHECK, OnBnClickedFridayCheck)
ON_BN_CLICKED(IDC_SATURDAY_CHECK, OnBnClickedSaturdayCheck)
ON_BN_CLICKED(IDC_SINGLE_ENABLE, OnBnClickedSingleEnable)
END_MESSAGE_MAP()

// CConfigDlg message handlers
Expand Down Expand Up @@ -372,12 +375,12 @@ void CConfigDlg::OnBnClickedOk()
{
TCHAR f[MAX_PATH];
GetModuleFileName( NULL, f, MAX_PATH );
t[_T("iTunesAlarm")] = f;
t[_T("iSnooze")] = f;
}
else
{
if( t.has_key( _T("iTunesAlarm") ) )
t.deleteValue( _T("iTunesAlarm") );
if( t.has_key( _T("iSnooze") ) )
t.deleteValue( _T("iSnooze") );
}

m_reg[_T("BeenRun")] = true;
Expand Down Expand Up @@ -527,3 +530,8 @@ void CConfigDlg::OnBnClickedSaturdayCheck()
{
DoDayCheck( IDC_SATURDAY_CHECK, DayTime::SATURDAY );
}

void CConfigDlg::OnBnClickedSingleEnable()
{
DoDayCheck( IDC_SINGLE_ENABLE, DayTime::ALARM_ENABLED );
}
9 changes: 5 additions & 4 deletions ConfigDlg.h
@@ -1,19 +1,19 @@
// Copyright (c) 2004, Steven Scott (progoth@gmail.com)
//
// This file is part of iTunesAlarm.
// This file is part of iSnooze.
//
// iTunesAlarm is free software; you can redistribute it and/or modify
// iSnooze is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// iTunesAlarm is distributed in the hope that it will be useful,
// iSnooze is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with iTunesAlarm; if not, write to the Free Software
// along with iSnooze; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

#pragma once
Expand Down Expand Up @@ -118,4 +118,5 @@ class CConfigDlg : public CDialog
afx_msg void OnBnClickedThursdayCheck();
afx_msg void OnBnClickedFridayCheck();
afx_msg void OnBnClickedSaturdayCheck();
afx_msg void OnBnClickedSingleEnable();
};
27 changes: 17 additions & 10 deletions DayTime.cpp
@@ -1,19 +1,19 @@
// Copyright (c) 2004, Steven Scott (progoth@gmail.com)
//
// This file is part of iTunesAlarm.
// This file is part of iSnooze.
//
// iTunesAlarm is free software; you can redistribute it and/or modify
// iSnooze is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// iTunesAlarm is distributed in the hope that it will be useful,
// iSnooze is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with iTunesAlarm; if not, write to the Free Software
// along with iSnooze; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

#include "StdAfx.h"
Expand All @@ -24,15 +24,15 @@ using namespace DayTime;

const TCHAR *DayTime::DayNames[7] = { _T("Sun"), _T("Mon"), _T("Tue"), _T("Wed"), _T("Thu"), _T("Fri"), _T("Sat") };

TimeAndDays::TimeAndDays( int hour, int minute, BYTE days )
TimeAndDays::TimeAndDays( int hour, int minute, BYTE days, bool enabled /*= true*/ )
{
this->day = days;
this->day = days | ( enabled ? ALARM_ENABLED : 0);
setTime( hour, minute );
}

TimeAndDays::TimeAndDays( const SYSTEMTIME &st )
TimeAndDays::TimeAndDays( const SYSTEMTIME &st, bool enabled /*= true*/ )
{
this->day = Win2DayTime[ st.wDayOfWeek ];
this->day = Win2DayTime[ st.wDayOfWeek ] | ( enabled ? ALARM_ENABLED : 0);
setTime( st.wHour, st.wMinute );
}

Expand Down Expand Up @@ -63,10 +63,12 @@ tstring TimeAndDays::getString() const
tstringstream str;
int hour, minute;
getTime( hour, minute );
if( !( day & ALARM_ENABLED ) )
str << _T("(D!) ");
str << hour << _T(":") << std::setw(2) << std::setfill(_T('0')) << minute << _T(" ");
if( day == ALL_DAYS )
if( (0x7f & day) == ALL_DAYS )
str << _T("Every day");
else if( day == WEEKDAYS )
else if( (0x7f & day) == WEEKDAYS )
str << _T("Mon-Fri");
else
{
Expand Down Expand Up @@ -110,6 +112,11 @@ void DayTime::addSorted( const TimeAndDays &tm, std::list< TimeAndDays* > &list
{
std::list< TimeAndDays* >::iterator i, end = list.end();

if( !tm.isEnabled() )
{
list.push_back( new TimeAndDays( tm ) );
return;
}
for( i = list.begin(); i != end; ++i )
{
if( (**i) > tm )
Expand Down
33 changes: 24 additions & 9 deletions DayTime.h
@@ -1,19 +1,19 @@
// Copyright (c) 2004, Steven Scott (progoth@gmail.com)
//
// This file is part of iTunesAlarm.
// This file is part of iSnooze.
//
// iTunesAlarm is free software; you can redistribute it and/or modify
// iSnooze is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// iTunesAlarm is distributed in the hope that it will be useful,
// iSnooze is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with iTunesAlarm; if not, write to the Free Software
// along with iSnooze; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

//#pragma once
Expand All @@ -37,16 +37,18 @@ namespace DayTime {
const unsigned char ALL_DAYS = 127;
const unsigned char WEEKDAYS = 62;

const unsigned char ALARM_ENABLED = 128;

const unsigned char Win2DayTime[] = {SUNDAY,MONDAY,TUESDAY,WEDNESDAY,THURSDAY,FRIDAY,SATURDAY};

extern const TCHAR *DayNames[7];

class TimeAndDays
{
public:
TimeAndDays():time(0), day(0){}
TimeAndDays( int hour, int minute, BYTE days );
TimeAndDays( const SYSTEMTIME &st );
TimeAndDays():time(0), day(ALARM_ENABLED){}
TimeAndDays( int hour, int minute, BYTE days, bool enabled = true );
TimeAndDays( const SYSTEMTIME &st, bool enabled = true );

void setTime( int hour, int minute );

Expand All @@ -60,13 +62,13 @@ namespace DayTime {
void getToBinary( BYTE *data ) const
{
((unsigned short*)data)[0] = 0x07ff & time;
((unsigned char*)data)[2] = 0x7f & day;
((unsigned char*)data)[2] = day;
}

void setFromBinary( const char *data )
{
time = 0x07ff & ((unsigned short*)data)[0];
day = 0x7f & ((unsigned char*)data)[2];
day = ((unsigned char*)data)[2];
}

bool isIncluded( const SYSTEMTIME &o ) const
Expand All @@ -76,6 +78,19 @@ namespace DayTime {
return ( (minute == o.wMinute) && (hour == o.wHour) );
}

bool isEnabled() const
{
return (day & ALARM_ENABLED) != 0;
}

void isEnabled( bool e )
{
if( e )
day |= ALARM_ENABLED;
else
day &= ~ALARM_ENABLED;
}

tstring getString() const;

unsigned short time;
Expand Down
8 changes: 4 additions & 4 deletions GroupControl.cpp
Expand Up @@ -37,20 +37,20 @@
// above link for the original.
//
//
// This file is part of iTunesAlarm.
// This file is part of iSnooze.
//
// iTunesAlarm is free software; you can redistribute it and/or modify
// iSnooze is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// iTunesAlarm is distributed in the hope that it will be useful,
// iSnooze is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with iTunesAlarm; if not, write to the Free Software
// along with iSnooze; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//

Expand Down

0 comments on commit 56767b6

Please sign in to comment.