Mercurial > ~dholland > hg > ag > index.cgi
comparison anagram/vaclgui/about.cpp @ 0:13d2b8934445
Import AnaGram (near-)release tree into Mercurial.
author | David A. Holland |
---|---|
date | Sat, 22 Dec 2007 17:52:45 -0500 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:13d2b8934445 |
---|---|
1 /* | |
2 * AnaGram, A System for Syntax Directed Programming | |
3 * Copyright 1997-2002 Parsifal Software. All Rights Reserved. | |
4 * See the file COPYING for license and usage terms. | |
5 * | |
6 * about.cpp | |
7 */ | |
8 | |
9 #include <ifont.hpp> | |
10 | |
11 #include "about.hpp" | |
12 #include "build.h" | |
13 #include "vaclgui.hpp" | |
14 #include "version.h" | |
15 | |
16 //#define INCLUDE_LOGGING | |
17 #include "log.h" | |
18 | |
19 | |
20 AboutBox::AboutBox() | |
21 : AgFrame( IFrameWindow::border | |
22 | dialogBackground | |
23 | IFrameWindow::systemMenu) | |
24 , canvas(nextChildId(), this, this, IRectangle(), | |
25 IMultiCellCanvas::classDefaultStyle | |
26 | IWindow::clipChildren) | |
27 , anaGramIcon(nextChildId(), &canvas, &canvas, iconHandle,IRectangle(), | |
28 IIconControl::classDefaultStyle | |
29 | IIconControl::fillBackground) | |
30 , textBlock(nextChildId(), &canvas, &canvas, IRectangle(), | |
31 ISetCanvas::verticalDecks | |
32 | ISetCanvas::packTight | |
33 | ISetCanvas::centerAlign | |
34 | IWindow::clipChildren | |
35 | IWindow::visible) | |
36 , titleLines(&textBlock) | |
37 , copyrightNotice(&textBlock) | |
38 //, licenseBox(nextChildId(), &textBlock, &textBlock) | |
39 //, licensee(&textBlock, IRectangle(), | |
40 // IStaticText::classDefaultStyle | |
41 // | IStaticText::border3D), | |
42 , address(&textBlock) | |
43 , buildInfo(&textBlock) | |
44 { | |
45 LOGSECTION("AboutBox::AboutBox"); | |
46 IPaintHandler::handleEventsFor(&canvas); | |
47 IPaintHandler::handleEventsFor(&textBlock); | |
48 IFont headFont("Arial", 12); | |
49 IFont textFont("Arial", 8); | |
50 windowTitle.setText("About AnaGram"); | |
51 | |
52 LOGV(headFont.name()) LCV(headFont.pointSize()); | |
53 LOGV(textFont.name()) LCV(textFont.pointSize()); | |
54 | |
55 titleLines.setFont(headFont); | |
56 buildInfo.setFont(textFont); | |
57 copyrightNotice.setFont(textFont); | |
58 //licensee.setFont(textFont); | |
59 //licenseBox.setFont(textFont); | |
60 address.setFont(textFont); | |
61 | |
62 anaGramIcon.sizeTo(anaGramIcon.minimumSize()); | |
63 | |
64 int leading = textFont.maxSize().height() + textFont.externalLeading(); | |
65 | |
66 titleLines.setMargin(leading/2, leading/2); | |
67 titleLines.setVTab(leading/2); | |
68 titleLines.setText( | |
69 "AnaGram LALR Parser Generator\n" VERSIONSTRING | |
70 ); | |
71 LOGV(titleLines.minimumSize()); | |
72 textBlock.setDeckCount(1); | |
73 | |
74 copyrightNotice.setMargin(leading/2, leading/2); | |
75 copyrightNotice.setVTab(leading/2); | |
76 copyrightNotice.setText( | |
77 "Copyright 1993-2002 Parsifal Software. " | |
78 "All rights reserved.\n" | |
79 "Copyright 2006, 2007 David A. Holland. " | |
80 "All rights reserved.\n" | |
81 "\n" | |
82 "This version of AnaGram is free software.\n" | |
83 "There is NO WARRANTY.\n" | |
84 "See \"license\" in the help system for details.\n" | |
85 ); | |
86 | |
87 //licenseBox.setText("This copy of AnaGram is registered to:"); | |
88 //licensee.setText(licenseeText().pointer()); | |
89 //licensee.setMargin(leading, leading); | |
90 //licensee.setVTab(leading/2); | |
91 | |
92 //ISize minSize = licenseBox.minimumSize(); | |
93 //ISize licenseeSize = licensee.minimumSize(); | |
94 //if (licenseeSize.width() < minSize.width()) { | |
95 // licenseeSize.setWidth(minSize.width()); | |
96 //} | |
97 //licensee.setMinimumSize(licenseeSize); | |
98 | |
99 //LOGV(licensee.minimumSize()); | |
100 | |
101 address.setMargin(leading/2, leading/2); | |
102 address.setVTab(leading/2); | |
103 address.setText("\n\vThe AnaGram web site is\n" | |
104 "http://www.parsifalsoft.com/"); | |
105 | |
106 AgString bi1 = "\n\vBuilt "; | |
107 AgString bi2 = build_date; | |
108 AgString bi3 = "\non "; | |
109 AgString bi4 = build_os; | |
110 AgString bi = bi1.concat(bi2).concat(bi3).concat(bi4); | |
111 buildInfo.setMargin(leading/2, leading/2); | |
112 buildInfo.setVTab(leading/2); | |
113 buildInfo.setText(bi.pointer()); | |
114 | |
115 canvas.setColumnWidth(1, 16); | |
116 canvas.setColumnWidth(5, 16); | |
117 canvas.setRowHeight(1, 16); | |
118 canvas.setRowHeight(5, 16); | |
119 canvas.setColumnWidth(2, 32); | |
120 canvas.setColumnWidth(3, 0, true); | |
121 canvas.setColumnWidth(4, 32); | |
122 LOGV(canvas.rowHeight(5)); | |
123 canvas.setRowHeight(2, 32); | |
124 canvas.setRowHeight(3, 0, true); | |
125 LOGV(canvas.rowHeight(2)); | |
126 canvas.addToCell(&anaGramIcon, 2, 2, 1, 1); | |
127 LOGV(canvas.rowHeight(2)); | |
128 canvas.addToCell(&textBlock, 3, 2, 1, 3); | |
129 ISize canvasSize = canvas.minimumSize(); | |
130 LOGV(canvasSize.asString()); | |
131 ISize frameSize = frameRectFor(IRectangle(canvasSize)).size(); | |
132 setClient(&canvas); | |
133 sizeTo(frameSize); | |
134 registerTitle("About AnaGram"); | |
135 LOGV(canvas.rowHeight(2)); | |
136 } | |
137 | |
138 AboutBox::~AboutBox() { | |
139 IPaintHandler::stopHandlingEventsFor(&canvas); | |
140 IPaintHandler::stopHandlingEventsFor(&textBlock); | |
141 } | |
142 | |
143 Boolean AboutBox::paintWindow(IPaintEvent &event) { | |
144 LOGSECTION("AboutBox::paintWindow"); | |
145 LOGV(event.rect().asString()); | |
146 LOGV((int) event.controlWindow()); | |
147 LOGV((int) event.dispatchingWindow()); | |
148 LOGV(position().asString()); | |
149 event.clearBackground(IGUIColor::dialogBgnd); | |
150 return false; | |
151 } | |
152 |