| 184 } |
184 } |
| 185 |
185 |
| 186 // ======================================================================================================================================= |
186 // ======================================================================================================================================= |
| 187 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
187 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
| 188 // ======================================================================================================================================= |
188 // ======================================================================================================================================= |
| 189 MAKE_ACTION (radialResolution, "Radial resolution", "radial-resolve", "Resolve radials into primitives.", (0)) { |
189 MAKE_ACTION (radialConvert, "Radials to Subfiles", "radial-convert", "Convert radials into primitives.", (0)) { |
| 190 vector<str> fails; |
190 vector<str> fails; |
| 191 vector<LDObject*> sel = g_win->sel (); |
191 vector<LDObject*> sel = g_win->sel (); |
| 192 EditHistory* history = new EditHistory; |
192 EditHistory* history = new EditHistory; |
| 193 |
193 |
| 194 for (LDObject* obj : sel) { |
194 for (LDObject* obj : sel) { |
| 312 // ============================================================================= |
312 // ============================================================================= |
| 313 MAKE_ACTION (setColor, "Set Color", "palette", "Set the color on given objects.", KEY (F10)) { |
313 MAKE_ACTION (setColor, "Set Color", "palette", "Set the color on given objects.", KEY (F10)) { |
| 314 if (g_win->sel ().size() <= 0) |
314 if (g_win->sel ().size() <= 0) |
| 315 return; |
315 return; |
| 316 |
316 |
| 317 short dColor; |
317 short colnum; |
| 318 short dDefault = -1; |
318 short defcol = -1; |
| 319 |
319 |
| 320 std::vector<LDObject*> objs = g_win->sel (); |
320 std::vector<LDObject*> objs = g_win->sel (); |
| 321 |
321 |
| 322 // If all selected objects have the same color, said color is our default |
322 // If all selected objects have the same color, said color is our default |
| 323 // value to the color selection dialog. |
323 // value to the color selection dialog. |
| 324 dDefault = g_win->getSelectedColor (); |
324 defcol = g_win->getSelectedColor (); |
| 325 |
325 |
| 326 // Show the dialog to the user now and ask for a color. |
326 // Show the dialog to the user now and ask for a color. |
| 327 if (ColorSelectDialog::staticDialog (dColor, dDefault, g_win)) { |
327 if (ColorSelectDialog::staticDialog (colnum, defcol, g_win)) { |
| 328 std::vector<ulong> ulaIndices; |
328 std::vector<ulong> indices; |
| 329 std::vector<short> daColors; |
329 std::vector<short> colornums; |
| 330 |
330 |
| 331 for (LDObject* obj : objs) { |
331 for (LDObject* obj : objs) { |
| 332 if (obj->color != -1) { |
332 if (obj->isColored () == false) |
| 333 ulaIndices.push_back (obj->getIndex (g_curfile)); |
333 continue; |
| 334 daColors.push_back (obj->color); |
334 |
| 335 |
335 indices.push_back (obj->getIndex (g_curfile)); |
| 336 obj->color = dColor; |
336 colornums.push_back (obj->color); |
| 337 g_win->R ()->compileObject (obj); |
337 |
| 338 } |
338 obj->color = colnum; |
| |
339 g_win->R ()->compileObject (obj); |
| 339 } |
340 } |
| 340 |
341 |
| 341 History::addEntry (new SetColorHistory (ulaIndices, daColors, dColor)); |
342 History::addEntry (new SetColorHistory (indices, colornums, colnum)); |
| 342 g_win->refresh (); |
343 g_win->refresh (); |
| 343 } |
344 } |
| 344 } |
345 } |
| 345 |
346 |
| 346 // ============================================================================= |
347 // ============================================================================= |
| 791 return true; |
792 return true; |
| 792 |
793 |
| 793 return false; |
794 return false; |
| 794 } |
795 } |
| 795 |
796 |
| 796 MAKE_ACTION (autoColor, "Auto-color", "auto-color", "Set the color of the given object to the first found unused color.", (0)) { |
797 MAKE_ACTION (autoColor, "Autocolor", "autocolor", "Set the color of the given object to the first found unused color.", (0)) { |
| 797 short colnum = 0; |
798 short colnum = 0; |
| 798 vector<ulong> indices; |
799 vector<ulong> indices; |
| 799 vector<short> colors; |
800 vector<short> colors; |
| 800 |
801 |
| 801 while (colnum < 512 && (getColor (colnum) == null || isColorUsed (colnum))) |
802 while (colnum < 512 && (getColor (colnum) == null || isColorUsed (colnum))) |