KiCad PCB EDA Suite
Loading...
Searching...
No Matches
template_default_html.h
Go to the documentation of this file.
1/*
2 * KiCad Project Template HTML defaults
3 * Extracted from dialog_template_selector.cpp to allow reuse and to provide
4 * a styled fallback page when a template does not supply an info.html.
5 */
6
7#ifndef KICAD_TEMPLATE_DEFAULT_HTML_H
8#define KICAD_TEMPLATE_DEFAULT_HTML_H
9
10#include <wx/string.h>
11
12// Uses _() translation macro which is defined globally in KiCad builds.
13
14// Welcome (no template selected) page.
15inline wxString GetWelcomeHtml()
16{
17 return wxString(
18 "<!DOCTYPE html>"
19 "<html lang=\"en\">"
20 "<head>"
21 "<meta charset=\"UTF-8\">"
22 "<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">"
23 "<title>KiCad Project Template Selector</title>"
24 "<style>"
25 "body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif; margin: 0; padding: 20px; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: #333; min-height: 100vh; box-sizing: border-box; }"
26 ".container { max-width: 800px; margin: 0 auto; background: rgba(255, 255, 255, 0.95); border-radius: 12px; padding: 30px; box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1); backdrop-filter: blur(10px); }"
27 ".header { text-align: center; margin-bottom: 30px; }"
28 ".logo { font-size: 2.5rem; font-weight: bold; color: #4a5568; margin-bottom: 10px; text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1); }"
29 ".subtitle { font-size: 1.2rem; color: #666; margin-bottom: 20px; }"
30 ".welcome-card { "
31#if defined( __MINGW32__ )
32 "background: #4299e1;" // linear-gradient does not work with webview used on MSYS2
33#else
34 "background: linear-gradient(135deg, #4299e1, #3182ce);"
35#endif
36 "color: white; padding: 25px; border-radius: 10px; margin-bottom: 25px; box-shadow: 0 4px 15px rgba(66, 153, 225, 0.3); }"
37 ".welcome-card h2 { margin-top: 0; font-size: 1.8rem; margin-bottom: 15px; }"
38 ".instructions { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; margin-bottom: 25px; }"
39 ".instruction-card { background: #f7fafc; border: 2px solid #e2e8f0; border-radius: 8px; padding: 20px; transition: all 0.3s ease; position: relative; overflow: hidden; }"
40 ".instruction-card:hover { transform: translateY(-2px); box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1); border-color: #4299e1; }"
41 ".instruction-card::before { content: ''; position: absolute; top: 0; left: 0; width: 4px; height: 100%; background: linear-gradient(135deg, #4299e1, #3182ce); }"
42 ".instruction-card h3 { color: #2d3748; margin-top: 0; margin-bottom: 10px; font-size: 1.3rem; }"
43 ".instruction-card p { color: #4a5568; line-height: 1.6; margin: 0; }"
44 ".features { background: #f0fff4; border: 2px solid #9ae6b4; border-radius: 8px; padding: 20px; margin-bottom: 25px; }"
45 ".features h3 { color: #22543d; margin-top: 0; margin-bottom: 15px; font-size: 1.4rem; }"
46 ".features ul { color: #2f855a; line-height: 1.8; margin: 0; padding-left: 20px; }"
47 ".features li { margin-bottom: 8px; }"
48 ".tips { background: #fffaf0; border: 2px solid #fbd38d; border-radius: 8px; padding: 20px; }"
49 ".tips h3 { color: #c05621; margin-top: 0; margin-bottom: 15px; font-size: 1.4rem; }"
50 ".tips p { color: #c05621; line-height: 1.6; margin: 0 0 10px 0; }"
51 ".highlight { background: linear-gradient(120deg, #a8edea 0%, #fed6e3 100%); padding: 2px 6px; border-radius: 4px; font-weight: 600; }"
52 "</style>"
53 "</head>"
54 "<body>"
55 "<div class=\"container\">"
56 "<div class=\"header\">"
57 "<div class=\"logo\">KiCad 📑</div>"
58 "<div class=\"subtitle\">" + _( "Project Template Selector" ) + "</div>"
59 "</div>"
60 "<div class=\"welcome-card\">"
61 "<h2>" + _( "Welcome to Template Selection!" ) + "</h2>"
62 "<p>" + _( "Choose from a variety of pre-configured project templates to jumpstart your PCB design. Templates provide ready-to-use project structures with common components, libraries, and design rules." ) + "</p>"
63 "</div>"
64 "<div class=\"instructions\">"
65 "<div class=\"instruction-card\">"
66 "<h3>→ " + _( "Browse Templates" ) + "</h3>"
67 "<p>" + _( "Navigate through the template tabs above to explore different categories of project templates. Each tab contains templates organized by type or complexity." ) + "</p>"
68 "</div>"
69 "<div class=\"instruction-card\">"
70 "<h3>→ " + _( "Select a Template" ) + "</h3>"
71 "<p>" + _( "Click on any template in the list to " ) + "<span class=\"highlight\">" + _( "preview its details" ) + "</span>. " + _( "The template information will appear in this panel, showing descriptions, included components, and project structure." ) + "</p>"
72 "</div>"
73 "<div class=\"instruction-card\">"
74 "<h3>→ " + _( "Customize Path" ) + "</h3>"
75 "<p>" + _( "Use the " ) + "<span class=\"highlight\">" + _( "folder path field" ) + "</span> " + _( "above to browse custom template directories. Click the folder icon to browse, or the refresh icon to reload templates." ) + "</p>"
76 "</div>"
77 "<div class=\"instruction-card\">"
78 "<h3>→ " + _( "Create Project" ) + "</h3>"
79 "<p>" + _( "Once you've found the right template, click " ) + "<span class=\"highlight\">" + _( "OK" ) + "</span> " + _( "to create a new project based on the selected template. Your project will inherit all template settings and files." ) + "</p>"
80 "</div>"
81 "</div>"
82 "<div class=\"features\">"
83 "<h3>" + _( "What You Get with Templates" ) + "</h3>"
84 "<ul>"
85 "<li><strong>" + _( "Pre-configured libraries" ) + "</strong> " + _( "- Common components and footprints already linked" ) + "</li>"
86 "<li><strong>" + _( "Design rules" ) + "</strong> " + _( "- Appropriate electrical and mechanical constraints" ) + "</li>"
87 "<li><strong>" + _( "Layer stackups" ) + "</strong> " + _( "- Optimized for the intended application" ) + "</li>"
88 "<li><strong>" + _( "Component placement" ) + "</strong> " + _( "- Basic layout and routing guidelines" ) + "</li>"
89 "<li><strong>" + _( "Documentation" ) + "</strong> " + _( "- README files and design notes" ) + "</li>"
90 "<li><strong>" + _( "Manufacturing files" ) + "</strong> " + _( "- Gerber and drill file configurations" ) + "</li>"
91 "</ul>"
92 "</div>"
93 "<div class=\"tips\">"
94 "<h3>" + _( "Pro Tips" ) + "</h3>"
95 "<p><strong>" + _( "Start Simple:" ) + "</strong> " + _( "Begin with basic templates and add more elements as you go." ) + "</p>"
96 "<p><strong>" + _( "Customize Later:" ) + "</strong> " + _( "Templates are starting points - you can modify libraries, rules, and layouts after project creation." ) + "</p>"
97 "<p><strong>" + _( "Save Your Own:" ) + "</strong> " + _( "Once you develop preferred settings, create a custom template for future projects." ) + "</p>"
98 "</div>"
99 "</div>"
100 "</body>"
101 "</html>"
102 );
103}
104
105// Fallback when a specific template has no meta/info.html.
106inline wxString GetTemplateInfoHtml( const wxString& aTemplateName )
107{
108 return wxString(
109 "<!DOCTYPE html>"
110 "<html lang=\"en\">"
111 "<head>"
112 "<meta charset=\"UTF-8\">"
113 "<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">"
114 "<title>" + aTemplateName + " - KiCad Template</title>"
115 "<style>"
116 "body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif; margin:0; padding:20px; background:#edf2f7; color:#2d3748; }"
117 ".container { max-width: 780px; margin:0 auto; background:#ffffff; border-radius:12px; padding:32px; box-shadow:0 6px 24px rgba(0,0,0,0.08); }"
118 ".header { display:flex; align-items:center; gap:12px; margin-bottom:24px; }"
119 ".badge { background:#3182ce; color:white; padding:4px 10px; border-radius:6px; font-size:0.75rem; letter-spacing:0.05em; text-transform:uppercase; }"
120 "h1 { font-size:1.9rem; margin:0; }"
121 "p { line-height:1.55; }"
122 ".cta { background:#ebf8ff; border:1px solid #bee3f8; padding:16px 20px; border-radius:10px; margin:28px 0 18px; }"
123 ".steps { display:grid; gap:16px; margin-top:10px; }"
124 ".step { background:#f7fafc; border:1px solid #e2e8f0; padding:14px 16px; border-radius:8px; }"
125 ".step h3 { margin:0 0 6px 0; font-size:1.05rem; }"
126 ".edit-hint { background:#fffaf0; border:1px solid #fbd38d; padding:14px 16px; border-radius:8px; margin-top:24px; }"
127 "code { background:#f1f5f9; padding:2px 5px; border-radius:4px; font-size:0.85rem; }"
128 "</style>"
129 "</head><body><div class=\"container\">"
130 "<div class=\"header\"><div class=\"badge\">" + _( "Template" ) + "</div><h1>" + aTemplateName + "</h1></div>"
131 "<p>" + _( "This project template doesn't include an info page yet. You can still use it to create a new project." ) + "</p>"
132 "<div class=\"cta\">"
133 "<strong>" + _( "To use this template:" ) + "</strong>"
134 "<div class=\"steps\">"
135 "<div class=\"step\"><h3>1. " + _( "Create the project" ) + "</h3><p>" + _( "Click OK below. KiCad will create a new project folder populated with the contents of this template." ) + "</p></div>"
136 "<div class=\"step\"><h3>2. " + _( "Open schematic and PCB" ) + "</h3><p>" + _( "Use the Project Manager tree or launch Schematic and PCB editors to begin designing." ) + "</p></div>"
137 "<div class=\"step\"><h3>3. " + _( "Review libraries & settings" ) + "</h3><p>" + _( "Confirm symbol/footprint libraries, design rules, and board stackup match your needs." ) + "</p></div>"
138 "</div>" // steps
139 "</div>" // cta
140 "<div class=\"edit-hint\">"
141 "<strong>" + _( "Add an info page later:" ) + "</strong>"
142 "<p>" + _( "Create a file at" ) + " <code>meta/info.html</code> " + _( "inside this template's directory to provide rich documentation, images, or guidance." ) + "</p>"
143 "<p>" + _( "You can copy styling from the default pages for consistency." ) + "</p>"
144 "</div>"
145 "</div></body></html>"
146 );
147}
148
149#endif // KICAD_TEMPLATE_DEFAULT_HTML_H
#define _(s)
wxString GetWelcomeHtml()
wxString GetTemplateInfoHtml(const wxString &aTemplateName)