Option::~Option() { for (int i = 0; i < ReportCount(); i++) { ReportInfo* r = reinterpret_cast<ReportInfo*>(m_reports[i]); delete r; } }
bool Option::BudgetReport(int report) { bool budget = false; if ((report >= 0) && (report < ReportCount())) { ReportInfo* r = reinterpret_cast<ReportInfo*>(m_reports[report]); budget = r->type; } return budget; }
wxString Option::ReportName(int report) { wxString name = ""; if ((report >= 0) && (report < ReportCount())) { ReportInfo* r = reinterpret_cast<ReportInfo*>(m_reports[report]); name = r->name; } return name; }
wxString Option::ReportGroup(int report) { wxString group = ""; if ((report >= 0) && (report < ReportCount())) { ReportInfo* r = reinterpret_cast<ReportInfo*>(m_reports[report]); group = r->group; } return group; }
bool Option::HideReport(int report) { bool hideReport = false; if ((report >= 0) && (report < ReportCount())) { ReportInfo* r = reinterpret_cast<ReportInfo*>(m_reports[report]); int bitField = 1 << static_cast<int>(r->id); hideReport = ((m_hideReport & bitField) != 0); } return hideReport; }
wxString Option::ReportFullName(int report) { wxString name = ""; if ((report >= 0) && (report < ReportCount())) { ReportInfo* r = reinterpret_cast<ReportInfo*>(m_reports[report]); name = r->group; if (name.IsEmpty()) name = r->name; else name += wxString(" (") + r->name + wxString(")"); } return name; }
void Option::HideReport(int report, bool value) { if ((report >= 0) && (report < ReportCount())) { ReportInfo* r = reinterpret_cast<ReportInfo*>(m_reports[report]); int bitField = 1 << static_cast<int>(r->id); if (value) m_hideReport |= bitField; else m_hideReport &= ~bitField; Model_Setting::instance().Set("HIDE_REPORT", m_hideReport); } }
Collection(USB_HID_PHYSICAL), // // The buttons. // UsagePage(USB_HID_BUTTONS), UsageMinimum(1), UsageMaximum(3), LogicalMinimum(0), LogicalMaximum(1), // // 3 - 1 bit values for the buttons. // ReportSize(1), ReportCount(3), Input(USB_HID_INPUT_DATA | USB_HID_INPUT_VARIABLE | USB_HID_INPUT_ABS), // // 1 - 5 bit unused constant value to fill the 8 bits. // ReportSize(5), ReportCount(1), Input(USB_HID_INPUT_CONSTANT | USB_HID_INPUT_ARRAY | USB_HID_INPUT_ABS), // // The X and Y axis. // UsagePage(USB_HID_GENERIC_DESKTOP),
// The following is the HID report structure definition that is passed back // to the host. // //***************************************************************************** static const uint8_t g_pui8KeybReportDescriptor[] = { UsagePage(USB_HID_GENERIC_DESKTOP), Usage(USB_HID_KEYBOARD), Collection(USB_HID_APPLICATION), // // Modifier keys. // 8 - 1 bit values indicating the modifier keys (ctrl, shift...) // ReportSize(1), ReportCount(8), UsagePage(USB_HID_USAGE_KEYCODES), UsageMinimum(224), UsageMaximum(231), LogicalMinimum(0), LogicalMaximum(1), Input(USB_HID_INPUT_DATA | USB_HID_INPUT_VARIABLE | USB_HID_INPUT_ABS), // // One byte of rsvd data required by HID spec. // ReportCount(1), ReportSize(8), Input(USB_HID_INPUT_CONSTANT), //
UsagePage(USB_HID_GENERIC_DESKTOP), Usage(USB_HID_GAMEPAD), Collection(USB_HID_APPLICATION), Collection(USB_HID_PHYSICAL), ReportID(1), // // The X and Y (Will appear as two thumb controls). // UsagePage(USB_HID_GENERIC_DESKTOP), Usage(USB_HID_X), Usage(USB_HID_Y), LogicalMinimum(-1), LogicalMaximum(1), ReportSize(2), ReportCount(2), Input(USB_HID_INPUT_DATA | USB_HID_INPUT_VARIABLE | USB_HID_INPUT_ABS | USB_HID_INPUT_NONULL), ReportCount(4), ReportSize(1), Input(USB_HID_INPUT_CONSTANT | USB_HID_INPUT_ARRAY | USB_HID_INPUT_ABS), // // 12 - 1 bit values for the first set of buttons. // UsagePage(USB_HID_BUTTONS), UsageMinimum(1), UsageMaximum(12), LogicalMinimum(0), LogicalMaximum(1), ReportSize(1),
// 0x06, 0x00, 0xff, // HUT chap 3 table 1 // Vendor specific value 0xff00 UsagePageVendor(0xff00), // 0x09, 0x01, // Arbitrary number as we are vendor specific Usage(0x01), // 0xa1, 0x01, Collection(USB_HID_APPLICATION), // 0x85, 0x3f, // Vendor specific. Appears arbitrary. // ID can be left undefined if only one report type is created // 0x95, 0x3f, // The number of items in the report ReportCount(HID_PACKET_SIZE), // 0x75, 0x08, // As this is just generic data, 8 bits in a byte ReportSize(0x08), 0x26, 0xff, 0x00, // LogicalMaximum(0xff00), // 0x15, 0x01, LogicalMinimum(0), // 0x09, 0x80, // Arbitrary number as we are vendor specific Usage(0x01), // 0x81, 0x02, Input (Data,Var,Abs) // This shows we are describing the report that goes to the host Input(USB_HID_INPUT_DATA | USB_HID_INPUT_VARIABLE | USB_HID_INPUT_ABS), // Second report, same except it's output ReportCount(HID_PACKET_SIZE),
Usage (USB_HID_POINTER), Collection (USB_HID_PHYSICAL), // // The X, Y and Z values which are specified as 8-bit absolute // position values. // Usage (USB_HID_X), Usage (USB_HID_Y), Usage (USB_HID_Z), // // 3 8-bit absolute values. // ReportSize(8), ReportCount(3), Input(USB_HID_INPUT_DATA | USB_HID_INPUT_VARIABLE | USB_HID_INPUT_ABS), // // The 8 buttons. // UsagePage(USB_HID_BUTTONS), UsageMinimum(1), UsageMaximum(8), LogicalMinimum(0), LogicalMaximum(1), PhysicalMinimum(0), PhysicalMaximum(1), //
// UsagePage(USB_HID_GENERIC_DESKTOP), Usage (USB_HID_POINTER), Collection (USB_HID_PHYSICAL), // // The X, Y, RX, and RY values which are specified as 8-bit // absolute position values. // Usage(USB_HID_X), // // 4 8-bit absolute values. // ReportSize(10), ReportCount(1), Input(USB_HID_INPUT_DATA | USB_HID_INPUT_VARIABLE | USB_HID_INPUT_ABS), ReportCount(1), ReportSize(6), Input(USB_HID_INPUT_CONSTANT), Usage (USB_HID_Y), ReportSize(10), ReportCount(1), Input(USB_HID_INPUT_DATA | USB_HID_INPUT_VARIABLE | USB_HID_INPUT_ABS), ReportCount(1), ReportSize(6),
//***************************************************************************** // // The report descriptor for the volume class device. (Built off CustomHid example) // //***************************************************************************** static const uint8_t g_pui8CustomHidReportDescriptor[] = { UsagePage(USB_HID_CONSUMER_DEVICE), Usage(USB_HID_USAGE_CONSUMER_CONTROL), Collection(USB_HID_APPLICATION), LogicalMinimum(0), LogicalMaximum(1), Usage(USB_HID_VOLUME_UP), Usage(USB_HID_VOLUME_DOWN), ReportSize(1), ReportCount(2), Input(USB_HID_INPUT_DATA | USB_HID_INPUT_VARIABLE | USB_HID_INPUT_RELATIVE), ReportCount(6), Input(USB_HID_INPUT_CONSTANT | USB_HID_INPUT_ARRAY | USB_HID_INPUT_ABS), EndCollection, }; //***************************************************************************** // // The HID descriptor for the customhid device. // //***************************************************************************** static const tHIDDescriptor g_sCustomHidHIDDescriptor = { 9, // bLength USB_HID_DTYPE_HID, // bDescriptorType
mmPrintableBase* Option::ReportFunction(int report) { mmPrintableBase* function = nullptr; if ((report >= 0) && (report < ReportCount())) { ReportInfo* r = reinterpret_cast<ReportInfo*>(m_reports[report]); switch (r->id) { case ReportInfo::MyUsage: function = new mmReportMyUsage(); break; case ReportInfo::MonthlySummaryofAccounts: function = new mmReportSummaryByDate(0); break; case ReportInfo::YearlySummaryofAccounts: function = new mmReportSummaryByDate(1); break; case ReportInfo::WheretheMoneyGoes: function = new mmReportCategoryExpensesGoes(); break; case ReportInfo::WheretheMoneyComesFrom: function = new mmReportCategoryExpensesComes(); break; case ReportInfo::CategoriesSummary: function = new mmReportCategoryExpensesCategories(); break; case ReportInfo::CategoriesMonthly: function = new mmReportCategoryOverTimePerformance(); break; case ReportInfo::Payees: function = new mmReportPayeeExpenses(); break; case ReportInfo::IncomevsExpensesSummary: function = new mmReportIncomeExpenses(); break; case ReportInfo::IncomevsExpensesMonthly: function = new mmReportIncomeExpensesMonthly(); break; case ReportInfo::BudgetPerformance: function = new mmReportBudgetingPerformance(); break; case ReportInfo::BudgetCategorySummary: function = new mmReportBudgetCategorySummary(); break; case ReportInfo::MonthlyCashFlow: function = new mmReportCashFlow(mmReportCashFlow::MONTHLY); break; case ReportInfo::DailyCashFlow: function = new mmReportCashFlow(mmReportCashFlow::DAILY); break; case ReportInfo::StocksReportPerformance: function = new mmReportChartStocks(); break; case ReportInfo::StocksReportSummary: function = new mmReportSummaryStocks(); break; case ReportInfo::ForecastReport: function = new mmReportForecast(); break; default: break; } if (function != nullptr) function->setSettings(ReportSettings(r->id)); } return function; }