Simple mock-up starting point.

This commit is contained in:
2026-06-04 13:43:41 -04:00
parent f627f51d52
commit 3f5fffee57
2 changed files with 132 additions and 0 deletions
+2
View File
@@ -0,0 +1,2 @@
all: calx
CXXFLAGS+= -std=c++26
+130
View File
@@ -0,0 +1,130 @@
#include <iostream>
#include <iomanip>
#include <string>
#include <unistd.h>
namespace
{
namespace C
{
const int startHour= 6;
}
enum Color : int { red= 1, green= 2, yellow= 3, blue= 4, magenta= 5, cyan= 6, white= 7 };
struct Appointment
{
std::string name;
int startHour;
int startQuarter;
int duration; // Quarter hours
int day;
Color color;
friend std::ostream &
operator << ( std::ostream &os, const Appointment &appointment )
{
if( false )
{
std::cout << " Wakeup ";
}
for( int i= 0; i < appointment.duration; ++i )
{
os << "[" << 10 * appointment.day << "G["
<< ( 1 + ( appointment.startHour - 6 ) * 4 + appointment.startQuarter + i )
<< "B[4" << appointment.color
<< ";1m";
if( i == 0 )
{
if( appointment.name.size() <= 9 ) os << std::left << std::setw( 9 ) << appointment.name;
else os << std::setw( 6 ) << appointment.name.substr(0,6) << "...";
}
else os << std::setw( 9 ) << "";
os << "";
}
return os;
}
};
Appointment appointments[]=
{
{ "Wakeup", 6, 0, 1, 3, red },
{ "Wakeup", 7, 1, 2, 2, red },
{ "Meeting", 9, 1, 5, 5, blue },
{ "Long Meeting Name", 8, 1, 8, 6, cyan },
};
}
int
main()
{
using namespace std::literals::string_literals;
/* */
auto example= R"(
| Time | Mon | Tue | Wed | Thu | Fri | Sat | Sun |
| 06:00 | | | | | | | |
| | | | | | | | |
| | | | | | | | |
|_______| | | | | | | |
| 07:00 | | | | | | | |
| | | | | | | | |
| | | | | | | | |
|_______| | | | | | | |
| 08:00 | | | | | | | |
| | | | | | | | |
| | | | | | | | |
|_______| | | | | | | |
| 09:00 | | | | | | | |
| | | | | | | | |
| | | | | | | | |
|_______| | | | | | | |
| 10:00 | | | | | | | |
| | | | | | | | |
| | | | | | | | |
|_______| | | | | | | |
| 11:00 | | | | | | | |
| | | | | | | | |
| | | | | | | | |
|_______| | | | | | | |
)"s.substr( 1 );
example.pop_back(); example.pop_back();
std::cout << "" << example;
if( false )
{
std::cout << " Wakeup ";
std::cout << " ";
std::cout << " ";
std::cout << " Wakeup ";
std::cout << " ";
std::cout << " ";
std::cout << " ";
std::cout << " Meeting ";
std::cout << " ";
std::cout << " ";
std::cout << " ";
}
for( auto &appt: appointments )
{
std::cout << appt;
}
std::cout << "[?25l" << std::flush;
sleep( 20 );
std::cout << "[?25h" << std::flush;
}