MCPcopy Create free account
hub / github.com/CalcProgrammer1/OpenRGB / SetupZones

Method SetupZones

Controllers/RazerController/RGBController_Razer.cpp:140–352  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

138}
139
140void RGBController_Razer::SetupZones()
141{
142 unsigned int device_index = controller->GetDeviceIndex();
143 unsigned char layout_type = controller->GetKeyboardLayoutType();
144
145 /*---------------------------------------------------------*\
146 | Fill in zone information based on device table |
147 \*---------------------------------------------------------*/
148 for(unsigned int zone_id = 0; zone_id < RAZER_MAX_ZONES; zone_id++)
149 {
150 if(device_list[device_index]->zones[zone_id] != NULL)
151 {
152 zone new_zone;
153
154 new_zone.name = device_list[device_index]->zones[zone_id]->name;
155 new_zone.type = device_list[device_index]->zones[zone_id]->type;
156
157 new_zone.leds_count = device_list[device_index]->zones[zone_id]->rows * device_list[device_index]->zones[zone_id]->cols;
158 new_zone.leds_min = new_zone.leds_count;
159 new_zone.leds_max = new_zone.leds_count;
160
161 /*---------------------------------------------------------*\
162 | If this is a keyboard zone, check if using Keyboard Layout|
163 | Manager |
164 \*---------------------------------------------------------*/
165 if(new_zone.type == ZONE_TYPE_MATRIX)
166 {
167 if(new_zone.name == ZONE_EN_KEYBOARD && device_list[device_index]->layout != NULL)
168 {
169 /*---------------------------------------------------------*\
170 | Dynamically generate a keyboard layout |
171 \*---------------------------------------------------------*/
172 KEYBOARD_LAYOUT new_layout;
173 switch(layout_type)
174 {
175 case RAZER_LAYOUT_TYPE_AZERTY:
176 new_layout = KEYBOARD_LAYOUT::KEYBOARD_LAYOUT_ISO_AZERTY;
177 break;
178
179 case RAZER_LAYOUT_TYPE_ISO:
180 new_layout = KEYBOARD_LAYOUT::KEYBOARD_LAYOUT_ISO_QWERTY;
181 break;
182
183 case RAZER_LAYOUT_TYPE_JIS:
184 new_layout = KEYBOARD_LAYOUT::KEYBOARD_LAYOUT_ANSI_QWERTY;
185 break;
186
187 case RAZER_LAYOUT_TYPE_QWERTZ:
188 new_layout = KEYBOARD_LAYOUT::KEYBOARD_LAYOUT_ISO_QWERTZ;
189 break;
190
191 default:
192 new_layout = KEYBOARD_LAYOUT::KEYBOARD_LAYOUT_ANSI_QWERTY;
193 }
194
195 KeyboardLayoutManager new_kb(new_layout, device_list[device_index]->layout->base_size,
196 device_list[device_index]->layout->key_values);
197

Callers

nothing calls this directly

Calls 9

to_stringFunction · 0.85
GetKeyboardLayoutTypeMethod · 0.80
ChangeKeysMethod · 0.80
GetKeyMapMethod · 0.80
GetKeyCountMethod · 0.80
GetKeyNameAtMethod · 0.80
GetDeviceIndexMethod · 0.45
push_backMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected