00001
00030 #include <stdio.h>
00031
00032 #include <Xm/Xm.h>
00033 #include <Xm/MwmUtil.h>
00034 #include <Xm/PushB.h>
00035 #include <Xm/BulletinB.h>
00036 #include <Xm/Frame.h>
00037 #include <Xm/Label.h>
00038 #include <Xm/DrawingA.h>
00039
00040 #include "../../config.h"
00041 #include "util.h"
00042 #include "about_dialog.h"
00043
00044
00045
00046 static Widget about_dialog;
00047
00048
00060 static void
00061 on_about_dialog_close_button_clicked (Widget w, XtPointer client_data, XtPointer call_data)
00062 {
00063 XtUnmanageChild (about_dialog);
00064 }
00065
00066
00078 static void
00079 on_about_dialog_credits_button_clicked (Widget w, XtPointer client_data, XtPointer call_data)
00080 {
00082 }
00083
00084
00096 static void
00097 on_about_dialog_license_button_clicked (Widget w, XtPointer client_data, XtPointer call_data)
00098 {
00100 }
00101
00102
00114 void
00115 create_about_dialog (Widget parent)
00116 {
00117 Widget about_dialog_drawing_area;
00118 Widget about_dialog_frame;
00119 Widget about_dialog_credits_button;
00120 Widget about_dialog_license_button;
00121 Widget about_dialog_close_button;
00122 Widget about_dialog_label;
00123 Arg args[10];
00124 XmString xmstrings[10];
00125 XmFontList fontlist;
00126
00127
00128 XtSetArg (args[0], XmNtitle, "About pcb-lfpw");
00129 XtSetArg (args[1], XmNdeleteResponse, XmDO_NOTHING);
00130 XtSetArg (args[2], XmNmwmFunctions,
00131 MWM_FUNC_RESIZE |
00132 MWM_FUNC_MOVE |
00133 MWM_FUNC_MINIMIZE |
00134 MWM_FUNC_MAXIMIZE);
00135 XtSetArg (args[3], XmNbackground, get_pixel (parent, "gray"));
00136 about_dialog = XmCreateBulletinBoardDialog
00137 (
00138 parent,
00139 "about_dialog",
00140 args,
00141 4
00142 );
00143
00144 XtSetArg (args[0], XmNbackground, get_pixel (parent, "gray"));
00145 about_dialog_drawing_area = XtCreateManagedWidget
00146 (
00147 "about_dialog_drawing_area",
00148 xmDrawingAreaWidgetClass,
00149 about_dialog,
00150 args,
00151 1
00152 );
00153
00154 XtSetArg (args[0], XmNshadowThickness, 5);
00155 XtSetArg (args[1], XmNshadowType, XmSHADOW_OUT);
00156 about_dialog_frame = XtCreateManagedWidget
00157 (
00158 "about_dialog_frame",
00159 xmFrameWidgetClass,
00160 about_dialog_drawing_area,
00161 args,
00162 2);
00163
00164 XtSetArg (args[0], XmNforeground, get_pixel (parent, "black"));
00165 XtSetArg (args[1], XmNbackground, get_pixel (parent, "gray"));
00166 fontlist = get_fontlist (parent, "-adobe-helvetica-bold-r-normal--14-140-75-75-p-82-iso8859-1");
00167 XtSetArg (args[2], XmNfontList, fontlist);
00168 xmstrings[0] = XmStringCreateSimple ("Credits");
00169 XtSetArg (args[3], XmNlabelString, xmstrings[0]);
00170 XtSetArg (args[4], XmNshowAsDefault, 1);
00171 XtSetArg (args[5], XmNy, 200);
00172 XtSetArg (args[6], XmNx, 155);
00173 about_dialog_credits_button = XtCreateManagedWidget
00174 (
00175 "about_dialog_credits_button",
00176 xmPushButtonWidgetClass,
00177 about_dialog_drawing_area,
00178 args,
00179 7
00180 );
00181 XtAddCallback (about_dialog_credits_button, XmNactivateCallback,
00182 on_about_dialog_credits_button_clicked, NULL);
00183 XmStringFree (xmstrings[0]);
00184 XmFontListFree (fontlist);
00185
00186 XtSetArg (args[0], XmNforeground, get_pixel (parent, "black"));
00187 XtSetArg (args[1], XmNbackground, get_pixel (parent, "gray"));
00188 fontlist = get_fontlist (parent, "-adobe-helvetica-bold-r-normal--14-140-75-75-p-82-iso8859-1");
00189 XtSetArg (args[2], XmNfontList, fontlist);
00190 xmstrings[0] = XmStringCreateSimple ("License");
00191 XtSetArg (args[3], XmNlabelString, xmstrings[0]);
00192 XtSetArg (args[4], XmNshowAsDefault, 1);
00193 XtSetArg (args[5], XmNy, 200);
00194 XtSetArg (args[6], XmNx, 155);
00195 about_dialog_license_button = XtCreateManagedWidget
00196 (
00197 "about_dialog_license_button",
00198 xmPushButtonWidgetClass,
00199 about_dialog_drawing_area,
00200 args,
00201 7
00202 );
00203 XtAddCallback (about_dialog_license_button, XmNactivateCallback,
00204 on_about_dialog_license_button_clicked, NULL);
00205 XmStringFree (xmstrings[0]);
00206 XmFontListFree (fontlist);
00207
00208 XtSetArg (args[0], XmNforeground, get_pixel (parent, "black"));
00209 XtSetArg (args[1], XmNbackground, get_pixel (parent, "gray"));
00210 fontlist = get_fontlist (parent, "-adobe-helvetica-bold-r-normal--14-140-75-75-p-82-iso8859-1");
00211 XtSetArg (args[2], XmNfontList, fontlist);
00212 xmstrings[0] = XmStringCreateSimple ("Close");
00213 XtSetArg (args[3], XmNlabelString, xmstrings[0]);
00214 XtSetArg (args[4], XmNshowAsDefault, 1);
00215 XtSetArg (args[5], XmNy, 200);
00216 XtSetArg (args[6], XmNx, 155);
00217 about_dialog_close_button = XtCreateManagedWidget
00218 (
00219 "about_dialog_close_button",
00220 xmPushButtonWidgetClass,
00221 about_dialog_drawing_area,
00222 args,
00223 7
00224 );
00225 XtAddCallback (about_dialog_close_button, XmNactivateCallback,
00226 on_about_dialog_close_button_clicked, NULL);
00227 XmStringFree (xmstrings[0]);
00228 XmFontListFree (fontlist);
00229
00230 XtSetArg (args[0], XmNalignment, XmALIGNMENT_BEGINNING);
00231 XtSetArg (args[1], XmNtraversalOn, False);
00232 XtSetArg (args[2], XmNmarginHeight, 10);
00233 XtSetArg (args[3], XmNmarginWidth, 10);
00234 XtSetArg (args[4], XmNrecomputeSize, True);
00235 XtSetArg (args[5], XmNforeground, get_pixel (parent, "black"));
00236 XtSetArg (args[6], XmNbackground, get_pixel (parent, "gray"));
00237 xmstrings[0] = create_about_dialog_xmstring ();
00238 XtSetArg (args[7], XmNlabelString, xmstrings[0]);
00239 fontlist = get_fontlist (parent, "-adobe-helvetica-medium-r-normal--14-140-75-75-p-77-iso8859-1");
00240 XtSetArg (args[8], XmNfontList, fontlist);
00241 about_dialog_label = XtCreateManagedWidget
00242 (
00243 "about_dialog_label",
00244 xmLabelWidgetClass,
00245 about_dialog_frame,
00246 args,
00247 9
00248 );
00249 XmStringFree (xmstrings[0]);
00250 XmFontListFree (fontlist);
00251 }
00252
00253
00262 static XmString
00263 create_about_dialog_xmstring ()
00264 {
00265 XmString xms;
00266 XmString nxt;
00267 XmString lst;
00268
00269 lst = XmStringCreateLtoR ("\npcb-lfpw - pcb footprintwizard\n", XmSTRING_DEFAULT_CHARSET);
00270 nxt = XmStringCreateLtoR (" Version: ", XmSTRING_DEFAULT_CHARSET);
00271 xms = XmStringConcat (lst, nxt);
00272 XmStringFree (lst);
00273 XmStringFree (nxt);
00274 nxt = xms;
00275 lst = XmStringCreateLtoR (VERSION, XmSTRING_DEFAULT_CHARSET);
00276 xms = XmStringConcat (xms, lst);
00277 XmStringFree (lst);
00278 XmStringFree (nxt);
00279 nxt = xms;
00280 lst = XmStringCreateLtoR ("\n", XmSTRING_DEFAULT_CHARSET);
00281 xms = XmStringConcat (xms, lst);
00282 XmStringFree (lst);
00283 XmStringFree (nxt);
00284 nxt = xms;
00285 lst = XmStringCreateLtoR ("\npcb-lfpw is a program for the creation of\n", XmSTRING_DEFAULT_CHARSET);
00286 xms = XmStringConcat (xms, lst);
00287 XmStringFree (lst);
00288 XmStringFree (nxt);
00289 nxt = xms;
00290 lst = XmStringCreateLtoR ("\nfootprint files to be used by the pcb layout\n", XmSTRING_DEFAULT_CHARSET);
00291 xms = XmStringConcat (xms, lst);
00292 XmStringFree (lst);
00293 XmStringFree (nxt);
00294 nxt = xms;
00295 lst = XmStringCreateLtoR ("\napplication.\n", XmSTRING_DEFAULT_CHARSET);
00296 xms = XmStringConcat (xms, lst);
00297 XmStringFree (lst);
00298 XmStringFree (nxt);
00299 nxt = xms;
00300 lst = XmStringCreateLtoR ("\nFurther information about pcb-lfpw ", XmSTRING_DEFAULT_CHARSET);
00301 xms = XmStringConcat (xms, lst);
00302 XmStringFree (lst);
00303 XmStringFree (nxt);
00304 nxt = xms;
00305 lst = XmStringCreateLtoR ("can be found at:\n", XmSTRING_DEFAULT_CHARSET);
00306 xms = XmStringConcat (xms, lst);
00307 XmStringFree (lst);
00308 XmStringFree (nxt);
00309 nxt = xms;
00310 lst = XmStringCreateLtoR ("\nhttp://www.xs4all.nl/~ljh4timm/pcb-fpw/pcb-fpw.html", XmSTRING_DEFAULT_CHARSET);
00311 xms = XmStringConcat (xms, lst);
00312 XmStringFree (lst);
00313 XmStringFree (nxt);
00314 return (xms);
00315 }
00316
00317
00318