src/ldtypes.cpp

changeset 357
9c954c222996
parent 319
d0f41342ef51
child 359
bcdfc801658b
equal deleted inserted replaced
356:08398f57aba3 357:9c954c222996
21 #include "file.h" 21 #include "file.h"
22 #include "misc.h" 22 #include "misc.h"
23 #include "gui.h" 23 #include "gui.h"
24 #include "history.h" 24 #include "history.h"
25 #include "gldraw.h" 25 #include "gldraw.h"
26
27 char const* g_saObjTypeNames[] = {
28 "subfile",
29 "quadrilateral",
30 "triangle",
31 "line",
32 "condline",
33 "vertex",
34 "bfc",
35 "overlay",
36 "comment",
37 "unknown",
38 "empty",
39 "unidentified",
40 };
41
42 // Should probably get rid of this array sometime
43 char const* g_saObjTypeIcons[] = {
44 "subfile",
45 "quad",
46 "triangle",
47 "line",
48 "condline",
49 "vertex",
50 "bfc",
51 "overlay",
52 "comment",
53 "error",
54 "empty",
55 "error",
56 };
57 26
58 // List of all LDObjects 27 // List of all LDObjects
59 vector<LDObject*> g_LDObjects; 28 vector<LDObject*> g_LDObjects;
60 29
61 // ============================================================================= 30 // =============================================================================
386 // the wrong index colors which messes up selection. 355 // the wrong index colors which messes up selection.
387 for (LDObject* obj : objsToCompile) 356 for (LDObject* obj : objsToCompile)
388 g_win->R ()->compileObject (obj); 357 g_win->R ()->compileObject (obj);
389 } 358 }
390 359
360 str LDObject::typeName( LDObject::Type type )
361 {
362 LDObject* obj = LDObject::getDefault( type );
363 str name = obj->typeName();
364 delete obj;
365 return name;
366 }
367
391 // ============================================================================= 368 // =============================================================================
392 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 369 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
393 // ============================================================================= 370 // =============================================================================
394 str LDObject::objectListContents (const vector<LDObject*>& objs) { 371 str LDObject::objectListContents (const vector<LDObject*>& objs) {
395 bool firstDetails = true; 372 bool firstDetails = true;
410 continue; 387 continue;
411 388
412 if (!firstDetails) 389 if (!firstDetails)
413 text += ", "; 390 text += ", ";
414 391
415 str noun = fmt ("%1%2", g_saObjTypeNames[objType], plural (objCount)); 392 str noun = fmt ("%1%2", typeName( objType ), plural( objCount ));
416 393
417 // Plural of "vertex" is "vertices". Stupid English. 394 // Plural of "vertex" is "vertices". Stupid English.
418 if (objType == LDObject::Vertex && objCount != 1) 395 if (objType == LDObject::Vertex && objCount != 1)
419 noun = "vertices"; 396 noun = "vertices";
420 397

mercurial