summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@samsung.com>2018-09-18 16:29:38 +0200
committerDaniel Kolesa <d.kolesa@samsung.com>2018-09-18 16:29:38 +0200
commitbdbb68a7ff35b9d4b64d7617913c075f99b4f344 (patch)
tree95bc4cad1e926af3751aceb58f60f82ea20a5b8c
parent0a98dfec80d37a3c65b656ad7efeca02536a7736 (diff)
remove obsolete graph theming
-rw-r--r--gendoc.lua218
1 files changed, 0 insertions, 218 deletions
diff --git a/gendoc.lua b/gendoc.lua
index ebfd808..9cfddce 100644
--- a/gendoc.lua
+++ b/gendoc.lua
@@ -458,216 +458,6 @@ build_inherit_summary = function(cl, buf)
458 return buf 458 return buf
459end 459end
460 460
461local default_theme_light = {
462 classes = {
463 regular = {
464 style = "filled",
465 color = "black",
466 fill_color = "white",
467 font_color = "black",
468 primary_color = "black",
469 primary_fill_color = "gray",
470 primary_font_color = "black"
471 },
472 abstract = {
473 style = "filled",
474 color = "black",
475 fill_color = "white",
476 font_color = "black",
477 primary_color = "black",
478 primary_fill_color = "gray",
479 primary_font_color = "black"
480 },
481 mixin = {
482 style = "filled",
483 color = "blue",
484 fill_color = "white",
485 font_color = "black",
486 primary_color = "blue",
487 primary_fill_color = "skyblue",
488 primary_font_color = "black"
489 },
490 interface = {
491 style = "filled",
492 color = "cornflowerblue",
493 fill_color = "white",
494 font_color = "black",
495 primary_color = "cornflowerblue",
496 primary_fill_color = "azure",
497 primary_font_color = "black"
498 }
499 },
500 node = {
501 shape = "box"
502 },
503 edge = {
504 color = "black"
505 },
506 bg_color = "transparent",
507 rank_dir = "TB",
508 size = "6"
509}
510
511local default_theme_dark = {
512 classes = {
513 regular = {
514 style = "filled",
515 color = "gray15",
516 fill_color = "gray15",
517 font_color = "white",
518 primary_color = "gray15",
519 primary_fill_color = "black",
520 primary_font_color = "white"
521 },
522 abstract = {
523 style = "filled",
524 color = "gray15",
525 fill_color = "gray15",
526 font_color = "white",
527 primary_color = "gray15",
528 primary_fill_color = "black",
529 primary_font_color = "white"
530 },
531 mixin = {
532 style = "filled",
533 color = "deepskyblue",
534 fill_color = "gray15",
535 font_color = "white",
536 primary_color = "deepskyblue",
537 primary_fill_color = "deepskyblue4",
538 primary_font_color = "white"
539 },
540 interface = {
541 style = "filled",
542 color = "cornflowerblue",
543 fill_color = "gray15",
544 font_color = "white",
545 primary_color = "cornflowerblue",
546 primary_fill_color = "dodgerblue4",
547 primary_font_color = "white"
548 }
549 },
550 node = {
551 shape = "box"
552 },
553 edge = {
554 color = "gray35"
555 },
556 bg_color = "transparent",
557 rank_dir = "TB",
558 size = "6"
559}
560
561local current_theme = default_theme_dark
562
563local validate_ctheme = function(tb, name)
564 if type(tb.classes[name]) ~= "table" then
565 return false
566 end
567 local t = tb.classes[name]
568 if type(t.style) ~= "string" then
569 return false
570 end
571 if type(t.color) ~= "string" then
572 return false
573 end
574 if type(t.fill_color) ~= "string" then
575 return false
576 end
577 if type(t.font_color) ~= "string" then
578 return false
579 end
580 if not t.primary_color then
581 t.primary_color = t.color
582 end
583 if not t.primary_fill_color then
584 t.primary_fill_color = t.fill_color
585 end
586 if not t.primary_font_color then
587 t.primary_font_color = t.font_color
588 end
589 if type(t.primary_color) ~= "string" then
590 return false
591 end
592 if type(t.primary_fill_color) ~= "string" then
593 return false
594 end
595 if type(t.primary_font_color) ~= "string" then
596 return false
597 end
598 return true
599end
600
601local validate_theme = function(tb)
602 if type(tb) ~= "table" then
603 return false
604 end
605 if type(tb.classes) ~= "table" then
606 return false
607 end
608 if not tb.node then
609 tb.node = current_theme.node
610 end
611 if not tb.edge then
612 tb.edge = current_theme.edge
613 end
614 if not tb.bg_color then
615 tb.bg_color = current_theme.bg_color
616 end
617 if not tb.rank_dir then
618 tb.rank_dir = current_theme.rank_dir
619 end
620 if not tb.size then
621 tb.size = current_theme.size
622 end
623 if type(tb.node) ~= "table" then
624 return false
625 end
626 if type(tb.edge) ~= "table" then
627 return false
628 end
629 if type(tb.bg_color) ~= "string" then
630 return false
631 end
632 if type(tb.rank_dir) ~= "string" then
633 return false
634 end
635 if type(tb.size) ~= "string" then
636 return false
637 end
638 if not validate_ctheme(tb, "regular") then
639 return false
640 end
641 if not validate_ctheme(tb, "abstract") then
642 return false
643 end
644 if not validate_ctheme(tb, "mixin") then
645 return false
646 end
647 if not validate_ctheme(tb, "interface") then
648 return false
649 end
650 return true
651end
652
653local set_theme = function(tname)
654 local tf = io.open(tname)
655 if tf then
656 local cont = tf:read("*all")
657 tf:close()
658 local tb, err = serializer.deserialize(cont)
659 if not tb then
660 error("error parsing theme '" .. tname .. "': " .. err)
661 end
662 if not validate_theme(tb) then
663 error("invalid theme '" .. tname .. "'")
664 end
665 current_theme = tb
666 else
667 error("theme '" .. tname .. "' does not exist")
668 end
669end
670
671local find_parent_impl 461local find_parent_impl
672find_parent_impl = function(fulln, cl) 462find_parent_impl = function(fulln, cl)
673 for pcl in cl:inherits_get() do 463 for pcl in cl:inherits_get() do
@@ -1732,8 +1522,6 @@ getopt.parse {
1732 { category = "Generator" }, 1522 { category = "Generator" },
1733 { "r", "root", true, help = "Root path of the docs." }, 1523 { "r", "root", true, help = "Root path of the docs." },
1734 { "n", "namespace", true, help = "Root namespace of the docs." }, 1524 { "n", "namespace", true, help = "Root namespace of the docs." },
1735 { nil, "graph-theme", true, help = "Optional graph theme." },
1736 { nil, "graph-theme-light", false, help = "Use light builtin graph theme." },
1737 { nil, "disable-notes", false, help = "Disable notes plugin usage." }, 1525 { nil, "disable-notes", false, help = "Disable notes plugin usage." },
1738 { nil, "disable-folded", false, help = "Disable folded plugin usage." }, 1526 { nil, "disable-folded", false, help = "Disable folded plugin usage." },
1739 { nil, "disable-title", false, help = "Disable title plugin usage." }, 1527 { nil, "disable-title", false, help = "Disable title plugin usage." },
@@ -1753,12 +1541,6 @@ getopt.parse {
1753 if opts["p"] then 1541 if opts["p"] then
1754 printgen = function(...) print(...) end 1542 printgen = function(...) print(...) end
1755 end 1543 end
1756 if opts["graph-theme-dark"] then
1757 current_theme = default_theme_light
1758 end
1759 if opts["graph-theme"] then
1760 set_theme(opts["graph-theme"])
1761 end
1762 local rootns = (not opts["n"] or opts["n"] == "") 1544 local rootns = (not opts["n"] or opts["n"] == "")
1763 and "develop:api" or opts["n"] 1545 and "develop:api" or opts["n"]
1764 local dr 1546 local dr