aboutdlg.cpp

Go to the documentation of this file.
00001 // $Id: aboutdlg.cpp 1282 2006-06-09 09:46:49Z alex $
00002 /* @@tag:xara-cn@@ DO NOT MODIFY THIS LINE
00003 ================================XARAHEADERSTART===========================
00004  
00005                Xara LX, a vector drawing and manipulation program.
00006                     Copyright (C) 1993-2006 Xara Group Ltd.
00007        Copyright on certain contributions may be held in joint with their
00008               respective authors. See AUTHORS file for details.
00009 
00010 LICENSE TO USE AND MODIFY SOFTWARE
00011 ----------------------------------
00012 
00013 This file is part of Xara LX.
00014 
00015 Xara LX is free software; you can redistribute it and/or modify it
00016 under the terms of the GNU General Public License version 2 as published
00017 by the Free Software Foundation.
00018 
00019 Xara LX and its component source files are distributed in the hope
00020 that it will be useful, but WITHOUT ANY WARRANTY; without even the
00021 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00022 See the GNU General Public License for more details.
00023 
00024 You should have received a copy of the GNU General Public License along
00025 with Xara LX (see the file GPL in the root directory of the
00026 distribution); if not, write to the Free Software Foundation, Inc., 51
00027 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
00028 
00029 
00030 ADDITIONAL RIGHTS
00031 -----------------
00032 
00033 Conditional upon your continuing compliance with the GNU General Public
00034 License described above, Xara Group Ltd grants to you certain additional
00035 rights. 
00036 
00037 The additional rights are to use, modify, and distribute the software
00038 together with the wxWidgets library, the wxXtra library, and the "CDraw"
00039 library and any other such library that any version of Xara LX relased
00040 by Xara Group Ltd requires in order to compile and execute, including
00041 the static linking of that library to XaraLX. In the case of the
00042 "CDraw" library, you may satisfy obligation under the GNU General Public
00043 License to provide source code by providing a binary copy of the library
00044 concerned and a copy of the license accompanying it.
00045 
00046 Nothing in this section restricts any of the rights you have under
00047 the GNU General Public License.
00048 
00049 
00050 SCOPE OF LICENSE
00051 ----------------
00052 
00053 This license applies to this program (XaraLX) and its constituent source
00054 files only, and does not necessarily apply to other Xara products which may
00055 in part share the same code base, and are subject to their own licensing
00056 terms.
00057 
00058 This license does not apply to files in the wxXtra directory, which
00059 are built into a separate library, and are subject to the wxWindows
00060 license contained within that directory in the file "WXXTRA-LICENSE".
00061 
00062 This license does not apply to the binary libraries (if any) within
00063 the "libs" directory, which are subject to a separate license contained
00064 within that directory in the file "LIBS-LICENSE".
00065 
00066 
00067 ARRANGEMENTS FOR CONTRIBUTION OF MODIFICATIONS
00068 ----------------------------------------------
00069 
00070 Subject to the terms of the GNU Public License (see above), you are
00071 free to do whatever you like with your modifications. However, you may
00072 (at your option) wish contribute them to Xara's source tree. You can
00073 find details of how to do this at:
00074   http://www.xaraxtreme.org/developers/
00075 
00076 Prior to contributing your modifications, you will need to complete our
00077 contributor agreement. This can be found at:
00078   http://www.xaraxtreme.org/developers/contribute/
00079 
00080 Please note that Xara will not accept modifications which modify any of
00081 the text between the start and end of this header (marked
00082 XARAHEADERSTART and XARAHEADEREND).
00083 
00084 
00085 MARKS
00086 -----
00087 
00088 Xara, Xara LX, Xara X, Xara X/Xtreme, Xara Xtreme, the Xtreme and Xara
00089 designs are registered or unregistered trademarks, design-marks, and/or
00090 service marks of Xara Group Ltd. All rights in these marks are reserved.
00091 
00092 
00093       Xara Group Ltd, Gaddesden Place, Hemel Hempstead, HP2 6EX, UK.
00094                         http://www.xara.com/
00095 
00096 =================================XARAHEADEREND============================
00097  */
00098 
00099 // Implementation of the AboutDlg class
00100 // (This code derived from layerdlg.cpp)
00101 
00102 /* 
00103 */ 
00104 
00105 #include "camtypes.h"
00106  
00107 #include "aboutdlg.h"   
00108 //#include "aboutres.h"   
00109 //#include "app.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00110 #include "camelot.h"
00111 //#include "dialogop.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00112 #include "dlgmgr.h"
00113 #include "dragmgr.h"
00114 //#include "ensure.h"   - in camtypes.h [AUTOMATICALLY REMOVED]
00115 //#include "errors.h"  - in camtypes.h [AUTOMATICALLY REMOVED]
00116 //#include "mario.h"
00117 //#include "ollie.h"
00118 //#include "release.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00119 #include "bubbleid.h"
00120 
00121 #include "ccdc.h"           // For render-into-dialogue support
00122 #include "dlgcol.h"
00123 //#include "fillattr.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00124 #include "grnddib.h"
00125 #include "cversion.h"
00126 #include "product.h"
00127 // Added by Craig Hamilton 21/12/00.
00128 //#include "registry.h"
00129 // End added.
00130 
00131 #include "menuops.h"
00132 
00133 CC_IMPLEMENT_DYNCREATE(AboutDlg, DialogOp)   
00134 
00135 
00136 // This line MUST go after all CC_IMPLEMENT lines
00137 #define new CAM_DEBUG_NEW
00138 
00139 #if defined(DIALOGOP_ABOUT_BOX)
00140 #ifndef STANDALONE
00141 const INT32         AboutDlg::IDD = _R(IDD_ABOUTDLG);   // The dialogs id
00142 #else
00143 const INT32         AboutDlg::IDD = _R(IDD_ABOUTDLG_SA);    // The dialogs id
00144 #endif
00145 
00146 const CDlgMode      AboutDlg::Mode = MODELESS;      // The dialog is modeless  
00147 
00148 AboutDlg*           AboutDlg::TheDlg = NULL;
00149 double              AboutDlg::CurrentAngle = -1.0;
00150 #endif
00151 
00152 /********************************************************************************************
00153 >   AboutDlg::AboutDlg()
00154     virtual AboutDlg::~AboutDlg()
00155 
00156 
00157     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
00158     Created:    02/02/94
00159     Inputs:     -
00160     Outputs:    -
00161     Returns:    -
00162     Purpose:    AboutDlg (About Camelot dialogue) constructor
00163     Errors:     -
00164     SeeAlso:    -
00165 
00166 ********************************************************************************************/
00167 
00168 #if defined(DIALOGOP_ABOUT_BOX)
00169 AboutDlg::AboutDlg()
00170   : DialogOp(AboutDlg::IDD, AboutDlg::Mode) 
00171 {   
00172     TheDlg = this;
00173     if (CurrentAngle >= 0.0)
00174         GetApplication()->RegisterIdleProcessor(IDLEPRIORITY_HIGH, this);
00175 }
00176 
00177 
00178 AboutDlg::~AboutDlg()
00179 {   
00180     TheDlg = NULL;
00181     GetApplication()->RemoveIdleProcessor(IDLEPRIORITY_HIGH, this);
00182     if (CurrentAngle >= 0.0)
00183         CurrentAngle = -1.0;
00184     else
00185         CurrentAngle = 0.0;
00186 }
00187 #else
00188 AboutDlg::AboutDlg()
00189 {   
00190 }
00191 
00192 AboutDlg::~AboutDlg()
00193 {   
00194 }
00195 #endif
00196 
00197 #if defined(DIALOGOP_ABOUT_BOX)
00198 /********************************************************************************************
00199 
00200 >   MsgResult AboutDlg::Message(Msg* Message);
00201 
00202     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
00203     Created:    02/02/94
00204     Inputs:     -
00205     Outputs:    -
00206     Returns:    -
00207     Purpose:    Handles all the About dialog's messages 
00208     Errors:     -
00209     SeeAlso:    -
00210 
00211 ********************************************************************************************/
00212 
00213 MsgResult AboutDlg::Message(Msg* Message)
00214 {
00215     if (IS_OUR_DIALOG_MSG(Message))
00216     {
00217         DialogMsg* Msg = (DialogMsg*)Message;
00218         
00219         if ((Msg->DlgMsg == DIM_COMMIT) || (Msg->DlgMsg == DIM_CANCEL))
00220         {
00221             Close(); // Close and destroy the dialog 
00222             End();
00223             return (DLG_EAT_IF_HUNGRY(Msg));     
00224         }
00225 
00226         if (Msg->DlgMsg == DIM_REDRAW)
00227         {
00228             // We don't care which redraw gadget we're drawing - they're all
00229             // redrawn the same! Grab the redraw information
00230             ReDrawInfoType *RedrawInfo = (ReDrawInfoType *) Msg->DlgMsgParam;
00231 
00232             // Get a render region: Use a virtual coord space of (0,0) to (dx, dy)
00233             DocRect VirtualSize(0, 0, RedrawInfo->dx, RedrawInfo->dy);
00234 
00235             RenderRegion *pRender;
00236             pRender = CreateGRenderRegion(&VirtualSize, RedrawInfo);
00237             if (pRender != NULL)
00238             {
00239                 // Interlock redraw with the drag manager to ensure we don't redraw over any drag blobs
00240                 DragManagerOp::RedrawStarting(WindowID, Msg->GadgetID);
00241 
00242                 DialogColourInfo RedrawColours;         // Object supplying Host OS redraw colours
00243 
00244                 pRender->SaveContext();
00245 
00246                 DocColour   colTrans( COLOUR_TRANS );
00247                 pRender->SetLineColour( colTrans );
00248 
00249                 LinearFillAttribute GradFill;
00250                 ColourHSVT ColDef;
00251                 if (CurrentAngle >= 0.0)
00252                 {
00253                     if (Msg->GadgetID == _R(IDC_STRIPE1))
00254                         CurrentAngle = (CurrentAngle >= 1.0) ? 0.0 : CurrentAngle + 0.001;
00255 
00256                     ColDef.Hue = (Msg->GadgetID == _R(IDC_STRIPE1)) ? CurrentAngle : 1.0 - CurrentAngle;
00257                     ColDef.Saturation = 1.0;
00258                     ColDef.Value = 0.9;
00259                 }
00260                 else
00261                 {
00262                     ColDef.Hue = 0.0;
00263                     ColDef.Saturation = 0.0;
00264                     ColDef.Value = 0.0;
00265                 }
00266                 GradFill.Colour     = DocColour(COLOURMODEL_HSVT, (ColourGeneric*) &ColDef);
00267                 if (CurrentAngle < 0.0)
00268                     ColDef.Value = 0.75;
00269                 GradFill.EndColour  = DocColour(COLOURMODEL_HSVT, (ColourGeneric*) &ColDef);
00270 
00271                 DocCoord ThePoint(0, 0);
00272                 GradFill.SetStartPoint(&ThePoint);
00273                 ThePoint = DocCoord(RedrawInfo->dx, 0);
00274                 GradFill.SetEndPoint(&ThePoint);
00275                 GradFill.SetEndPoint2(NULL);
00276 
00277                 pRender->SetFillGeometry(&GradFill, FALSE);         // Set Grad-filled
00278 
00279                 FillEffectAltRainbowAttribute AltRainbow;
00280                 if (CurrentAngle >= 0.0)
00281                     pRender->SetFillEffect(&AltRainbow, FALSE);     // Set alt-rainbow fill
00282 
00283                 // And create and render a rectangular path (must use a path to get grad fill)
00284                 Path SquarePath;
00285                 SquarePath.Initialise(12, 12);
00286                 SquarePath.FindStartOfPath();
00287 
00288                 SquarePath.InsertMoveTo(VirtualSize.lo);
00289                 SquarePath.InsertLineTo(DocCoord(VirtualSize.hi.x, VirtualSize.lo.y));
00290                 SquarePath.InsertLineTo(VirtualSize.hi);
00291                 SquarePath.InsertLineTo(DocCoord(VirtualSize.lo.x, VirtualSize.hi.y));
00292                 SquarePath.IsFilled = TRUE;
00293 
00294                 pRender->DrawPath(&SquarePath);     // Render the value square
00295 
00296                 pRender->RestoreContext();
00297 
00298                 DestroyGRenderRegion(pRender);
00299 
00300                 // And turn off the drag redraw interlock
00301                 DragManagerOp::RedrawFinished();
00302             }
00303         }
00304     }
00305     return DialogOp::Message(Message);  
00306 }  
00307 
00308 
00309 
00310 BOOL AboutDlg::OnIdleEvent()
00311 {
00312     InvalidateGadget(_R(IDC_STRIPE1));
00313     InvalidateGadget(_R(IDC_STRIPE2));
00314 
00315     PaintGadgetNow(_R(IDC_STRIPE1));
00316     PaintGadgetNow(_R(IDC_STRIPE2));
00317 
00318     return TRUE;
00319 }
00320 #endif
00321 
00322 
00323 /********************************************************************************************
00324 
00325 >   OpState AboutDlg::GetState(String_256*, OpDescriptor*)
00326 
00327     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
00328     Created:    02/02/94
00329     Inputs:     -
00330     Outputs:    -
00331     Returns:    -
00332     Purpose:    Returns the OpState of the About Dialogue operation
00333     Errors:     -
00334     SeeAlso:    -
00335 
00336 ********************************************************************************************/
00337 
00338 OpState AboutDlg::GetState(String_256*, OpDescriptor*)
00339 {    
00340     OpState OpSt;
00341     OpSt.Greyed = false;
00342     
00343     return(OpSt);
00344 }
00345 
00346 /********************************************************************************************
00347 
00348 >   BOOL AboutDlg::Init()
00349 
00350     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
00351     Created:    02/02/94
00352     Inputs:     -
00353     Outputs:    -
00354     Returns:    FALSE if it fails (due to lack of memory)
00355     Purpose:    Creates an OpDescriptor for an About dialog
00356     Errors:     -
00357     SeeAlso:    -
00358 
00359 ********************************************************************************************/
00360 
00361 BOOL AboutDlg::Init()
00362 {  
00363     return (RegisterOpDescriptor(
00364                                 0,
00365                                 _R(IDS_ABOUTDLG2), 
00366                                 CC_RUNTIME_CLASS(AboutDlg),
00367                                 OPTOKEN_ABOUTDLG,
00368                                 AboutDlg::GetState,
00369                                 0,  /* help ID */
00370                                 _R(IDBBL_ABOUTDLG),
00371                                 0,
00372                                 0,  /* bitmap ID */
00373                                 SYSTEMBAR_ILLEGAL,              // Bar ID
00374                                 FALSE,                          // Recieve system messages
00375                                 FALSE,                          // Smart duplicate operation
00376                                 TRUE,                           // Clean operation
00377                                 0,                              // No vertical counterpart
00378                                 _R(IDS_BARSINFO_ONE)                // String for one copy only
00379                                 ));
00380 
00381 }   
00382  
00383 #if defined(DIALOGOP_ABOUT_BOX)
00384 /********************************************************************************************
00385 
00386 >   BOOL AboutDlg::Create()
00387 
00388     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
00389     Created:    02/02/94
00390     Inputs:     -
00391     Outputs:    -
00392     Returns:    FALSE if it fails
00393     Purpose:    Creates an About dialog (without showing it), and fills in its info fields
00394     Errors:     -
00395     SeeAlso:    -
00396 
00397 ********************************************************************************************/
00398 
00399 BOOL AboutDlg::Create()
00400 {                            
00401     if (DialogOp::Create())
00402     {  
00403         InitDialog();       // Set the initial control values
00404         return TRUE; 
00405     }
00406 
00407     return FALSE;
00408 }           
00409 #endif
00410 
00411 
00412 /********************************************************************************************
00413 
00414 >   void AboutDlg::Do(OpDescriptor*)
00415 
00416     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
00417     Created:    02/02/94
00418     Inputs:     -
00419     Outputs:    -
00420     Returns:    -
00421     Purpose:    Creates and shows an About Dialog
00422     Errors:     -
00423     SeeAlso:    -
00424 
00425 ********************************************************************************************/
00426 
00427 
00428 void AboutDlg::Do(OpDescriptor*)
00429 {
00430 #if defined(DIALOGOP_ABOUT_BOX)
00431     Create();
00432     Open();
00433 #else   
00434     CCamApp::DoAboutBox();
00435     End();
00436 #endif
00437 }
00438 
00439 
00440 #if defined(DIALOGOP_ABOUT_BOX)
00441 
00442 /********************************************************************************************
00443 
00444 >   BOOL AboutDlg::InitDialog()
00445 
00446     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
00447     Created:    02/02/94
00448     Inputs:     -
00449     Outputs:    -
00450     Returns:    FALSE if initialisation failed
00451     Purpose:    Initialises an AboutDlg ready for being shown
00452     Errors:     -
00453     SeeAlso:    -
00454 
00455 ********************************************************************************************/
00456 
00457 
00458 BOOL AboutDlg::InitDialog()
00459 {   
00460     String_64   Text1, Text2, ProdDetailed;
00461 
00462     // add the static RETAIL version number that the user sees and that is used 
00463     // to determine if new versions are available. 
00464 
00465     Text1 = TEXT(PRODUCT_RETAIL_VERSION_NO "  " __DATE__);
00466 
00467     // the product name we display here should be the more detailed name of this product
00468     // (e.g. Xara Xtreme Plus, Xara Xtreme Pro.)
00469 
00470     ProdDetailed = _T("Banana hammock");
00471 
00472     Text2.MakeMsg(_R(IDS_CAMVERSION), &ProdDetailed, &Text1);
00473 
00474     SetStringGadgetValue(_R(IDC_CAMVERSION), &Text2);       // (Camelot program version number)
00475 
00476 /*#ifndef STANDALONE
00477     Text1 = (LPCTSTR) ReleaseInfo::GetLicensee();       // (Licensee)
00478     SetStringGadgetValue(_R(IDC_LICENSEE), &Text1);
00479 
00480     Text1 = (LPCTSTR) ReleaseInfo::GetCompany();        // (Organisation)
00481     SetStringGadgetValue(_R(IDC_COMPANY), &Text1);
00482 
00483     wxString    serialNumber = OpRegister::GetSerialNumber();
00484     Text1 = (LPCTSTR) serialNumber;
00485     SetStringGadgetValue(_R(IDC_SERIAL), &Text1);
00486     // End altered.
00487 
00488 #endif */
00489 
00490     return TRUE; 
00491 }
00492 #endif

Generated on Sat Nov 10 03:44:07 2007 for Camelot by  doxygen 1.4.4