mirror of
https://github.com/CalcProgrammer1/OpenRGB.git
synced 2026-04-04 06:11:07 -04:00
RGBController API Overhaul
* Reorganize and clean up RGBController API functions
* Add functions to get protected RGBController member values
* Make NetworkClient, ProfileManager, and ResourceManager friend classes so they can access protected members
* Protected previously-public RGBController members
* Information strings (name, vendor, description, version, serial location)
* Device type
* Active mode
* Flags
* LEDs vector
* LED alternate names vector
* Modes vector
* Colors vector
* Zones vector
* Add CONTROLLER_FLAG_HIDDEN to allow plugins to hide controllers from control GUI
* Add update reason codes to RGBController update callback and signal updates on more RGBController events
* Add loop zone types and segmented zone type
* Add matrix map field to segments
* Rework matrix_map_type from using pointers to vector to prevent memory leaks
* Rework KeyboardLayoutManager to return new matrix_map_type
* Add access mutex to RGBController API
* Add per-zone modes ot RGBController API
* Add JSON description functions to RGBController API
This commit is contained in:
@@ -348,17 +348,6 @@ RGBController_Mountain60Keyboard::~RGBController_Mountain60Keyboard()
|
||||
mountain_thread->join();
|
||||
delete mountain_thread;
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Delete the matrix map |
|
||||
\*-----------------------------------------------------*/
|
||||
for(unsigned int zone_index = 0; zone_index < zones.size(); zone_index++)
|
||||
{
|
||||
if(zones[zone_index].type == ZONE_TYPE_MATRIX)
|
||||
{
|
||||
delete zones[zone_index].matrix_map;
|
||||
}
|
||||
}
|
||||
|
||||
delete controller;
|
||||
}
|
||||
|
||||
@@ -368,19 +357,13 @@ void RGBController_Mountain60Keyboard::SetupZones()
|
||||
new_kb.ChangeKeys(mountain60_keyboard_overlay_no_numpad);
|
||||
|
||||
zone new_zone;
|
||||
matrix_map_type * new_map = new matrix_map_type;
|
||||
|
||||
new_zone.name = "Mountain Everest 60";
|
||||
new_zone.type = ZONE_TYPE_MATRIX;
|
||||
new_zone.matrix_map = new_map;
|
||||
new_zone.matrix_map->height = new_kb.GetRowCount();
|
||||
new_zone.matrix_map->width = new_kb.GetColumnCount();
|
||||
new_zone.matrix_map->map = new unsigned int[new_map->height * new_map->width];
|
||||
new_zone.leds_count = new_kb.GetKeyCount();
|
||||
new_zone.leds_min = new_zone.leds_count;
|
||||
new_zone.leds_max = new_zone.leds_count;
|
||||
|
||||
new_kb.GetKeyMap(new_map->map, KEYBOARD_MAP_FILL_TYPE_COUNT);
|
||||
new_zone.matrix_map = new_kb.GetKeyMap(KEYBOARD_MAP_FILL_TYPE_COUNT);
|
||||
|
||||
for(unsigned int led_idx = 0; led_idx < new_zone.leds_count; led_idx++)
|
||||
{
|
||||
@@ -395,13 +378,6 @@ void RGBController_Mountain60Keyboard::SetupZones()
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_Mountain60Keyboard::ResizeZone(int /*zone*/, int /*new_size*/)
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| This device does not support resizing zones |
|
||||
\*---------------------------------------------------------*/
|
||||
}
|
||||
|
||||
void RGBController_Mountain60Keyboard::DeviceUpdateLEDs()
|
||||
{
|
||||
unsigned char* color_data = new unsigned char[(leds.size()*4)];
|
||||
@@ -423,12 +399,12 @@ void RGBController_Mountain60Keyboard::DeviceUpdateLEDs()
|
||||
delete[] color_data;
|
||||
}
|
||||
|
||||
void RGBController_Mountain60Keyboard::UpdateZoneLEDs(int /*zone*/)
|
||||
void RGBController_Mountain60Keyboard::DeviceUpdateZoneLEDs(int /*zone*/)
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
|
||||
void RGBController_Mountain60Keyboard::UpdateSingleLED(int /*led*/)
|
||||
void RGBController_Mountain60Keyboard::DeviceUpdateSingleLED(int /*led*/)
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
|
||||
@@ -32,11 +32,9 @@ public:
|
||||
|
||||
void SetupZones();
|
||||
|
||||
void ResizeZone(int zone, int new_size);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void UpdateZoneLEDs(int zone);
|
||||
void UpdateSingleLED(int led);
|
||||
void DeviceUpdateZoneLEDs(int zone);
|
||||
void DeviceUpdateSingleLED(int led);
|
||||
|
||||
void DeviceUpdateMode();
|
||||
void DeviceSaveMode();
|
||||
|
||||
@@ -688,17 +688,6 @@ RGBController_MountainKeyboard::RGBController_MountainKeyboard(MountainKeyboardC
|
||||
|
||||
RGBController_MountainKeyboard::~RGBController_MountainKeyboard()
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| Delete the matrix map |
|
||||
\*---------------------------------------------------------*/
|
||||
for(unsigned int zone_index = 0; zone_index < zones.size(); zone_index++)
|
||||
{
|
||||
if(zones[zone_index].matrix_map != NULL)
|
||||
{
|
||||
delete zones[zone_index].matrix_map;
|
||||
}
|
||||
}
|
||||
|
||||
delete controller;
|
||||
}
|
||||
|
||||
@@ -716,13 +705,9 @@ void RGBController_MountainKeyboard::SetupZones()
|
||||
new_zone.leds_min = zone_definitions[zone_idx].size;
|
||||
new_zone.leds_max = zone_definitions[zone_idx].size;
|
||||
new_zone.leds_count = zone_definitions[zone_idx].size;
|
||||
new_zone.matrix_map = NULL;
|
||||
if (zone_definitions[zone_idx].type == ZONE_TYPE_MATRIX)
|
||||
{
|
||||
new_zone.matrix_map = new matrix_map_type;
|
||||
new_zone.matrix_map->height = zone_definitions[zone_idx].height;
|
||||
new_zone.matrix_map->width = zone_definitions[zone_idx].width;
|
||||
new_zone.matrix_map->map = zone_definitions[zone_idx].ptr;
|
||||
new_zone.matrix_map.Set(zone_definitions[zone_idx].height, zone_definitions[zone_idx].width, zone_definitions[zone_idx].ptr);
|
||||
}
|
||||
zones.push_back(new_zone);
|
||||
}
|
||||
@@ -767,13 +752,6 @@ void RGBController_MountainKeyboard::SetupZones()
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_MountainKeyboard::ResizeZone(int /*zone*/, int /*new_size*/)
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| This device does not support resizing zones |
|
||||
\*---------------------------------------------------------*/
|
||||
}
|
||||
|
||||
void RGBController_MountainKeyboard::DeviceUpdate(const mode& current_mode)
|
||||
{
|
||||
switch(current_mode.value)
|
||||
@@ -1016,12 +994,12 @@ void RGBController_MountainKeyboard::DeviceUpdateLEDs()
|
||||
DeviceUpdate(current_mode);
|
||||
}
|
||||
|
||||
void RGBController_MountainKeyboard::UpdateZoneLEDs(int /*zone*/)
|
||||
void RGBController_MountainKeyboard::DeviceUpdateZoneLEDs(int /*zone*/)
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
|
||||
void RGBController_MountainKeyboard::UpdateSingleLED(int /*led*/)
|
||||
void RGBController_MountainKeyboard::DeviceUpdateSingleLED(int /*led*/)
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
|
||||
@@ -42,11 +42,9 @@ public:
|
||||
|
||||
void SetupZones();
|
||||
|
||||
void ResizeZone(int zone, int new_size);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void UpdateZoneLEDs(int zone);
|
||||
void UpdateSingleLED(int led);
|
||||
void DeviceUpdateZoneLEDs(int zone);
|
||||
void DeviceUpdateSingleLED(int led);
|
||||
|
||||
void DeviceUpdateMode();
|
||||
void DeviceSaveMode();
|
||||
|
||||
Reference in New Issue
Block a user