+++ /dev/null
-/////////////////////////////////////////////////////////////////////////////
-// Name: makeproj.cpp
-// Purpose: Generate sample VC++ project files
-// Author: Julian Smart
-// Modified by:
-// Created: 10/12/98
-// RCS-ID: $Id$
-// Copyright: (c) Julian Smart
-// Licence: wxWindows licence
-/////////////////////////////////////////////////////////////////////////////
-
-#ifdef __GNUG__
-#pragma implementation "makeproj.h"
-#endif
-
-// For compilers that support precompilation, includes "wx.h".
-#include "wx/wxprec.h"
-
-#if defined(__BORLANDC__)
-#pragma hdrstop
-#endif
-
-#include "wx/wx.h"
-#include "wx/deprecated/setup.h"
-#include "wx/deprecated/resource.h"
-
-#if wxUSE_IOSTREAMH
-#include <iostream.h>
-#include <fstream.h>
-#else
-#include <iostream>
-#include <fstream>
-#endif
-
-#include "makeproj.h"
-#include "projgenrc.h"
-
-// ----------------------------------------------------------------------------
-// ressources
-// ----------------------------------------------------------------------------
-// the application icon
-#if defined(__WXGTK__) || defined(__WXMOTIF__)
- #include "mondrian.xpm"
-#endif
-
-// ----------------------------------------------------------------------------
-// private classes
-// ----------------------------------------------------------------------------
-
-const wxStringList wxEmptyStringList;
-
-// Define a new application type, each program should derive a class from wxApp
-class MyApp : public wxApp
-{
-public:
- // override base class virtuals
- // ----------------------------
-
- // this one is called on application startup and is a good place for the app
- // initialization (doing it here and not in the ctor allows to have an error
- // return: if OnInit() returns false, the application terminates)
- virtual bool OnInit();
-
- bool GenerateSample(const wxString& projectName, const wxString& targetName,
- const wxString& path, const wxStringList& sourceFiles, const wxString& relativeRootPath = "../..",
- const wxStringList& extraLibsDebug = wxEmptyStringList,
- const wxStringList& extraLibsRelease = wxEmptyStringList);
- void GenerateSamples(const wxString& dir); // Takes wxWindows directory path
-};
-
-// Define a new frame type: this is going to be our main frame
-class MyFrame : public wxFrame
-{
-public:
- // ctor(s)
- MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size);
-
- // event handlers (these functions should _not_ be virtual)
- void OnQuit(wxCommandEvent& event);
- void OnAbout(wxCommandEvent& event);
- void OnGenerate(wxCommandEvent& event);
-
- bool GenerateSample(const wxString& projectName, const wxString& targetName,
- const wxString& path, const wxStringList& sourceFiles, const wxString& relativeRootPath = "../..");
-
-private:
- // any class wishing to process wxWindows events must use this macro
- DECLARE_EVENT_TABLE()
-};
-
-// Define a dialog: this will be our main dialog
-class MyDialog : public wxDialog
-{
-public:
- // ctor(s)
- MyDialog(const wxString& title, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize);
-
- // event handlers (these functions should _not_ be virtual)
- void OnQuit(wxCommandEvent& event);
- void OnAbout(wxCommandEvent& event);
- void OnGenerate(wxCommandEvent& event);
- void OnGenerateSamples(wxCommandEvent& event);
-
-private:
- // any class wishing to process wxWindows events must use this macro
- DECLARE_EVENT_TABLE()
-};
-
-
-// ----------------------------------------------------------------------------
-// constants
-// ----------------------------------------------------------------------------
-
-// IDs for the controls and the menu commands
-enum
-{
- // menu items
- MakeProject_Quit = 1,
- MakeProject_About,
- MakeProject_Generate,
- MakeProject_GenerateSamples,
-
- // controls start here (the numbers are, of course, arbitrary)
- MakeProject_Text = 1000,
-};
-
-// ----------------------------------------------------------------------------
-// event tables and other macros for wxWindows
-// ----------------------------------------------------------------------------
-
-// the event tables connect the wxWindows events with the functions (event
-// handlers) which process them. It can be also done at run-time, but for the
-// simple menu events like this the static method is much simpler.
-BEGIN_EVENT_TABLE(MyFrame, wxFrame)
- EVT_MENU(MakeProject_Quit, MyFrame::OnQuit)
- EVT_MENU(MakeProject_About, MyFrame::OnAbout)
- EVT_MENU(MakeProject_Generate, MyFrame::OnGenerate)
-END_EVENT_TABLE()
-
-// Create a new application object: this macro will allow wxWindows to create
-// the application object during program execution (it's better than using a
-// static object for many reasons) and also declares the accessor function
-// wxGetApp() which will return the reference of the right type (i.e. MyApp and
-// not wxApp)
-IMPLEMENT_APP(MyApp)
-
-// ============================================================================
-// implementation
-// ============================================================================
-
-// ----------------------------------------------------------------------------
-// the application class
-// ----------------------------------------------------------------------------
-
-// 'Main program' equivalent: the program execution "starts" here
-bool MyApp::OnInit()
-{
-#if 0
- // Create the main application window
- MyFrame *frame = new MyFrame("MakeProject wxWindows App",
- wxPoint(50, 50), wxSize(450, 340));
-
- frame->Show(TRUE);
- SetTopWindow(frame);
-#endif
- wxResourceParseFile("projgenrc.wxr");
-
- MyDialog* dialog = new MyDialog("VC++ MakeProject");
- dialog->ShowModal();
-
- delete dialog;
-
- return FALSE;
-}
-
-bool MyApp::GenerateSample(const wxString& projectName, const wxString& targetName,
- const wxString& path, const wxStringList& sourceFiles, const wxString& relativeRootPath,
- const wxStringList& extraLibsDebug, const wxStringList& extraLibsRelease)
-{
- wxString relativeIncludePath(relativeRootPath + wxString("/include"));
- wxString relativeLibPath(relativeRootPath + wxString("/lib"));
- wxString relativeIncludePathContrib(relativeRootPath + wxString("/contrib/include"));
- wxString relativeLibPathContrib(relativeRootPath + wxString("/contrib/lib"));
-
- wxProject project;
-
- // For all samples
- project.SetIncludeDirs(wxStringList((const char*) relativeIncludePath, (const char*) relativeIncludePathContrib, 0));
- project.SetResourceIncludeDirs(wxStringList((const char*) relativeIncludePath, (const char*) relativeIncludePathContrib, 0));
- project.SetLibDirs(wxStringList((const char*) relativeLibPath, (const char*) relativeLibPathContrib, 0));
-
-// project.SetExtraLibsDebug(wxStringList("opengl32.lib", "glu32.lib", 0));
-// project.SetExtraLibsRelease(wxStringList("opengl32.lib", "glu32.lib", 0));
- project.SetExtraLibsDebug(extraLibsDebug);
- project.SetExtraLibsRelease(extraLibsRelease);
-
- project.SetProjectName(projectName);
- project.SetTargetName(targetName);
- project.SetProjectPath(path);
- project.SetSourceFiles(sourceFiles);
-
- if (!project.GenerateVCProject())
- {
- wxString msg("Could not generate ");
- msg += projectName;
- wxMessageBox(msg);
- return FALSE;
- }
- return TRUE;
-}
-
-
-void MyApp::GenerateSamples(const wxString& dir)
-{
- // Small bug. Because we don't distinguish between Debug/DebugDLL, Release/ReleaseDLL,
- // we can't yet make a sample that uses other wxWindows static libraries + the wxWindows DLL library.
-
- //// Samples
-
- GenerateSample("CalendarVC", "calendar", dir + wxString("/samples/calendar"), wxStringList("calendar.cpp", 0));
- GenerateSample("CaretVC", "caret", dir + wxString("/samples/caret"), wxStringList("caret.cpp", 0));
- GenerateSample("CheckLstVC", "checklst", dir + wxString("/samples/checklst"), wxStringList("checklst.cpp", 0));
- GenerateSample("ConfigVC", "conftest", dir + wxString("/samples/config"), wxStringList("conftest.cpp", 0));
- GenerateSample("ControlsVC", "controls", dir + wxString("/samples/controls"), wxStringList("controls.cpp", 0));
- GenerateSample("DbVC", "dbtest", dir + wxString("/samples/db"),
- wxStringList("dbtest.cpp", "listdb.cpp", "dbtest.h", "listdb.h", 0));
- GenerateSample("DialogsVC", "dialogs", dir + wxString("/samples/dialogs"),
- wxStringList("dialogs.cpp", "dialogs.h", 0));
- GenerateSample("DndVC", "dnd", dir + wxString("/samples/dnd"), wxStringList("dnd.cpp", 0));
- GenerateSample("DocViewVC", "docview", dir + wxString("/samples/docview"),
- wxStringList("docview.cpp", "doc.cpp", "view.cpp", "docview.h", "doc.h", "view.h", 0));
- GenerateSample("DocVwMDIVC", "docview", dir + wxString("/samples/docvwmdi"),
- wxStringList("docview.cpp", "doc.cpp", "view.cpp", "docview.h", "doc.h", "view.h", 0));
- GenerateSample("DynamicVC", "dynamic", dir + wxString("/samples/dynamic"), wxStringList("dynamic.cpp", 0));
- GenerateSample("DrawingVC", "drawing", dir + wxString("/samples/drawing"), wxStringList("drawing.cpp", 0));
- GenerateSample("ExecVC", "exec", dir + wxString("/samples/exec"), wxStringList("exec.cpp", 0));
- GenerateSample("EventVC", "event", dir + wxString("/samples/event"), wxStringList("event.cpp", 0));
- GenerateSample("GridVC", "grid", dir + wxString("/samples/grid"), wxStringList("grid.cpp", 0));
- GenerateSample("NewGridVC", "griddemo", dir + wxString("/samples/newgrid"), wxStringList("griddemo.cpp", 0));
- GenerateSample("HelpVC", "demo", dir + wxString("/samples/help"), wxStringList("demo.cpp", 0));
-
- // OpenGL samples
- GenerateSample("CubeVC", "cube", dir + wxString("/samples/opengl/cube"), wxStringList("cube.cpp", "cube.h", 0),
- "../../..", wxStringList("opengl32.lib", "glu32.lib", 0), wxStringList("opengl32.lib", "glu32.lib", 0));
- GenerateSample("IsosurfVC", "isosurf", dir + wxString("/samples/opengl/isosurf"), wxStringList("isosurf.cpp", "isousrf.h", 0),
- "../../..", wxStringList("opengl32.lib", "glu32.lib", 0), wxStringList("opengl32.lib", "glu32.lib", 0));
- GenerateSample("PenguinVC", "penguin", dir + wxString("/samples/opengl/penguin"), wxStringList("penguin.cpp", "penguin.h",
- "lw.cpp", "lw.h", "trackball.c", "trackball.h", 0),
- "../../..", wxStringList("opengl32.lib", "glu32.lib", 0), wxStringList("opengl32.lib", "glu32.lib", 0));
-
- // wxHTML samples
- GenerateSample("AboutVC", "about", dir + wxString("/samples/html/about"), wxStringList("about.cpp", 0),
- "../../..");
- GenerateSample("HelpVC", "help", dir + wxString("/samples/html/help"), wxStringList("help.cpp", 0),
- "../../..");
- GenerateSample("PrintingVC", "printing", dir + wxString("/samples/html/printing"), wxStringList("printing.cpp", 0),
- "../../..");
- GenerateSample("TestVC", "test", dir + wxString("/samples/html/test"), wxStringList("test.cpp", 0),
- "../../..");
- GenerateSample("VirtualVC", "virtual", dir + wxString("/samples/html/virtual"), wxStringList("virtual.cpp", 0),
- "../../..");
- GenerateSample("WidgetVC", "widget", dir + wxString("/samples/html/widget"), wxStringList("widget.cpp", 0),
- "../../..");
- GenerateSample("ZipVC", "zip", dir + wxString("/samples/html/zip"), wxStringList("zip.cpp", 0),
- "../../..");
- GenerateSample("HelpViewVC", "helpview", dir + wxString("/samples/html/helpview"), wxStringList("helpview.cpp", 0),
- "../../..");
-
- GenerateSample("ImageVC", "image", dir + wxString("/samples/image"), wxStringList("image.cpp", 0));
- GenerateSample("InternatVC", "internat", dir + wxString("/samples/internat"), wxStringList("internat.cpp", 0));
- GenerateSample("JoytestVC", "joytest", dir + wxString("/samples/joytest"), wxStringList("joytest.cpp", "joytest.h", 0));
- GenerateSample("LayoutVC", "layout", dir + wxString("/samples/layout"), wxStringList("layout.cpp", "layout.h", 0));
- GenerateSample("ListctrlVC", "listtest", dir + wxString("/samples/listctrl"), wxStringList("listtest.cpp", "listtest.h", 0));
- GenerateSample("MdiVC", "mdi", dir + wxString("/samples/mdi"), wxStringList("mdi.cpp", "mdi.h", 0));
- GenerateSample("MemcheckVC", "memcheck", dir + wxString("/samples/memcheck"), wxStringList("memcheck.cpp", 0));
- // Don't always generate this project since it has to be tweaked by hand.
- // GenerateSample("MfcVC", "mfctest", dir + wxString("/samples/mfc"), wxStringList("mfctest.cpp", "mfctest.h", 0));
- GenerateSample("MiniframVC", "minifram", dir + wxString("/samples/minifram"), wxStringList("minifram.cpp", "minifram.h", 0));
- GenerateSample("MinimalVC", "minimal", dir + wxString("/samples/minimal"), wxStringList("minimal.cpp", 0));
- GenerateSample("NativdlgVC", "nativdlg", dir + wxString("/samples/nativdlg"), wxStringList("nativdlg.cpp", "nativdlg.h", "resource.h", 0));
- GenerateSample("DialupVC", "nettest", dir + wxString("/samples/dialup"), wxStringList("nettest.cpp", 0));
- GenerateSample("NotebookVC", "notebook", dir + wxString("/samples/notebook"), wxStringList("notebook.cpp", "notebook.h", 0));
- GenerateSample("OleautoVC", "oleauto", dir + wxString("/samples/oleauto"), wxStringList("oleauto.cpp", 0));
- GenerateSample("OwnerdrwVC", "ownerdrw", dir + wxString("/samples/ownerdrw"), wxStringList("ownerdrw.cpp", 0));
- GenerateSample("PngVC", "pngdemo", dir + wxString("/samples/png"), wxStringList("pngdemo.cpp", "pngdemo.h", 0));
- GenerateSample("PrintingVC", "printing", dir + wxString("/samples/printing"), wxStringList("printing.cpp", "printing.h", 0));
- GenerateSample("ProplistVC", "proplist", dir + wxString("/samples/proplist"), wxStringList("proplist.cpp", "proplist.h", 0));
- GenerateSample("PropsizeVC", "propsize", dir + wxString("/samples/propsize"), wxStringList("propsize.cpp", 0));
- GenerateSample("RegtestVC", "regtest", dir + wxString("/samples/regtest"), wxStringList("regtest.cpp", 0));
- GenerateSample("ResourceVC", "resource", dir + wxString("/samples/resource"), wxStringList("resource.cpp", "resource.h", 0));
- GenerateSample("RichEditVC", "wxLayout", dir + wxString("/samples/richedit"), wxStringList("wxLayout.cpp",
- "kbList.cpp", "wxllist.cpp", "wxlparser.cpp", "wxlwindow.cpp", 0));
- GenerateSample("SashtestVC", "sashtest", dir + wxString("/samples/sashtest"), wxStringList("sashtest.cpp", "sashtest.h", 0));
- GenerateSample("ScrollVC", "scroll", dir + wxString("/samples/scroll"), wxStringList("scroll.cpp", 0));
- GenerateSample("ScrollsubVC", "scrollsub", dir + wxString("/samples/scrollsub"), wxStringList("scrollsub.cpp", 0));
- GenerateSample("SplitterVC", "splitter", dir + wxString("/samples/splitter"), wxStringList("splitter.cpp", 0));
- GenerateSample("StatbarVC", "statbar", dir + wxString("/samples/statbar"), wxStringList("statbar.cpp", 0));
- GenerateSample("TabVC", "tab", dir + wxString("/samples/tab"), wxStringList("tab.cpp", "tab.h", 0));
- GenerateSample("TaskbarVC", "tbtest", dir + wxString("/samples/taskbar"), wxStringList("tbtest.cpp", "tbtest.h", 0));
- GenerateSample("TextVC", "text", dir + wxString("/samples/text"), wxStringList("text.cpp", 0));
- GenerateSample("ThreadVC", "thread", dir + wxString("/samples/thread"), wxStringList("thread.cpp", 0));
- GenerateSample("ToolbarVC", "toolbar", dir + wxString("/samples/toolbar"), wxStringList("toolbar.cpp", 0));
- GenerateSample("TreectrlVC", "treectrl", dir + wxString("/samples/treectrl"), wxStringList("treectrl.cpp", "treectrl.h", 0));
- GenerateSample("TypetestVC", "typetest", dir + wxString("/samples/typetest"), wxStringList("typetest.cpp", "typetest.h", 0));
- GenerateSample("ValidateVC", "validate", dir + wxString("/samples/validate"), wxStringList("validate.cpp", "validate.h", 0));
- GenerateSample("ClientVC", "client", dir + wxString("/samples/sockets"), wxStringList("client.cpp", 0));
- GenerateSample("ServerVC", "server", dir + wxString("/samples/sockets"), wxStringList("server.cpp", 0));
- GenerateSample("ClientVC", "client", dir + wxString("/samples/ipc"), wxStringList("client.cpp", "client.h", "ddesetup.h", 0));
- GenerateSample("ServerVC", "server", dir + wxString("/samples/ipc"), wxStringList("server.cpp", "server.h", "ddesetup.h", 0));
- GenerateSample("CaretVC", "caret", dir + wxString("/samples/caret"), wxStringList("caret.cpp", 0));
- GenerateSample("DrawingVC", "drawing", dir + wxString("/samples/drawing"), wxStringList("drawing.cpp", 0));
- GenerateSample("ScrollVC", "scroll", dir + wxString("/samples/scroll"), wxStringList("scroll.cpp", 0));
- GenerateSample("WizardVC", "wizard", dir + wxString("/samples/wizard"), wxStringList("wizard.cpp", 0));
- GenerateSample("RotateVC", "rotate", dir + wxString("/samples/rotate"), wxStringList("rotate.cpp", 0));
- GenerateSample("ExecVC", "exec", dir + wxString("/samples/exec"), wxStringList("exec.cpp", 0));
- GenerateSample("FontVC", "font", dir + wxString("/samples/font"), wxStringList("font.cpp", 0));
- GenerateSample("MenuVC", "menu", dir + wxString("/samples/menu"), wxStringList("menu.cpp", 0));
- GenerateSample("TreelayVC", "treelay", dir + wxString("/samples/treelay"), wxStringList("treelay.cpp", "treelay.h", 0));
- GenerateSample("DragimagVC", "dragimag", dir + wxString("/samples/dragimag"), wxStringList("dragimag.cpp", "dragimag.h", 0));
- GenerateSample("PlotVC", "plot", dir + wxString("/samples/plot"), wxStringList("plot.cpp", 0));
-
- //// Demos
-
- GenerateSample("BombsVC", "bombs", dir + wxString("/demos/bombs"),
- wxStringList("bombs.cpp", "bombs1.cpp", "game.cpp", "bombs.h", "game.h", 0));
-
- GenerateSample("FortyVC", "forty", dir + wxString("/demos/forty"),
- wxStringList("forty.cpp", "canvas.cpp", "card.cpp", "game.cpp", "pile.cpp", "playerdg.cpp", "scoredg.cpp", "scorefil.cpp",
- "canvas.h", "forty.h", "card.h", "game.h", "pile.h", "playerdg.h", "scoredg.h", "scorefil.h",
- 0));
-
- GenerateSample("FractalVC", "fractal", dir + wxString("/demos/fractal"), wxStringList("fractal.cpp", 0));
-
- GenerateSample("LifeVC", "life", dir + wxString("/demos/life"),
- wxStringList("life.cpp", "game.cpp", "dialogs.cpp", "life.h", "game.h", "dialogs.h", 0));
-
- GenerateSample("PoemVC", "wxpoem", dir + wxString("/demos/poem"), wxStringList("wxpoem.cpp", "wxpoem.h", 0));
-
- GenerateSample("DbbrowseVC", "dbbrowse", dir + wxString("/demos/dbbrowse"),
- wxStringList("dbbrowse.cpp", "browsedb.cpp", "dbgrid.cpp", "dbtree.cpp", "dlguser.cpp", "doc.cpp",
- "pgmctrl.cpp", "tabpgwin.cpp",
- "dbbrowse.h", "browsedb.h", "dbgrid.h", "dbtree.h", "dlguser.h", "doc.h", "pgmctrl.h", "std.h", "tabpgwin.h",
- 0));
-
- //// Samples in contrib
-
- // OGLEdit
-
- GenerateSample("OGLEditVC", "ogledit", dir + wxString("/contrib/samples/ogl/ogledit"),
- wxStringList("ogledit.cpp", "doc.cpp", "palette.cpp", "view.cpp",
- "doc.h", "ogledit.h", "palette.h", "view.h", 0),
- "../../../..",
- wxStringList("ogld.lib", 0), wxStringList("ogl.lib", 0));
-
- // OGL Studio
-
- GenerateSample("StudioVC", "studio", dir + wxString("/contrib/samples/ogl/studio"),
- wxStringList("studio.cpp", "cspalette.cpp", "dialogs.cpp", "view.cpp",
- "doc.cpp", "mainfrm.cpp", "project.cpp", "shapes.cpp", "symbols.cpp", "csprint.cpp",
- "studio.h", "cspalette.h", "dialogs.h", "view.h",
- "doc.h", "mainfrm.h", "project.h", "shapes.h", "symbols.h", 0),
- "../../../..",
- wxStringList("ogld.lib", 0), wxStringList("ogl.lib", 0));
-
- // MMedia mmboard
-
- GenerateSample("MMboardVC", "mmboard", dir + wxString("/contrib/samples/mmedia"),
- wxStringList("mmboard.cpp", "mmboard.h", "mmbman.cpp", "mmbman.h", 0),
- "../../..",
- wxStringList("mmediad.lib", 0), wxStringList("mmedia.lib", 0));
-
- // STC (Scintilla widget)
-
- GenerateSample("StcTestVC", "stctest", dir + wxString("/contrib/samples/stc"),
- wxStringList("stctest.cpp", 0),
- "../../..",
- wxStringList("stcd.lib", 0), wxStringList("stc.lib", 0));
-
- //// Utilities
-
- // Dialog Editor
-
- GenerateSample("DialogEdVC", "dialoged", dir + wxString("/utils/dialoged/src"),
- wxStringList("dialoged.cpp", "dlghndlr.cpp", "edlist.cpp", "edtree.cpp",
- "reseditr.cpp", "reswrite.cpp", "symbtabl.cpp", "winstyle.cpp", "winprop.cpp",
- "dialoged.h", "dlghndlr.h", "edlist.h", "edtree.h", "reseditr.h", "symbtabl.h", "winprop.h",
- "winstyle.h", 0),
- "../../..");
-
- // Tex2RTF
-
- GenerateSample("Tex2RTFVC", "tex2rtf", dir + wxString("/utils/tex2rtf/src"),
- wxStringList("tex2rtf.cpp", "htmlutil.cpp", "readshg.cpp", "rtfutils.cpp",
- "table.cpp", "tex2any.cpp", "texutils.cpp", "xlputils.cpp",
- "bmputils.h", "readshg.h", "rtfutils.h", "table.h", "tex2any.h", "tex2rtf.h", "wxhlpblk.h",
- 0),
- "../../..");
-
- // HelpGen
-
- GenerateSample("HelpGenVC", "helpgen", dir + wxString("/utils/helpgen/src"),
- wxStringList("helpgen.cpp", "cjparser.cpp", "docripper.cpp", "ifcontext.cpp",
- "markup.cpp", "ripper_main.cpp", "scriptbinder.cpp", "sourcepainter.cpp",
- "srcparser.cpp",
- "cjparser.h", "docripper.h", "ifcontext.h", "markup.h", "scriptbinder.h", "sourcepainter.h",
- "srcparser.h", "wxstlac.h", "wxstllst.h", "wxstlvec.h", 0),
- "../../..");
-
- // ProjGen
- GenerateSample("ProjGenVC", "makeproj", dir + wxString("/utils/projgen"),
- wxStringList("makeproj.cpp", "makeproj.h", 0),
- "../..");
-
- // hhp2cached
-
- GenerateSample("hhp2cachedVC", "hhp2cached", dir + wxString("/utils/hhp2cached"),
- wxStringList("hhp2cached.cpp", 0),
- "../..");
-
-}
-
-// ----------------------------------------------------------------------------
-// main frame
-// ----------------------------------------------------------------------------
-
-// frame constructor
-MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
- : wxFrame((wxFrame *)NULL, -1, title, pos, size)
-{
- // set the frame icon
- SetIcon(wxICON(mondrian));
-
- // create a menu bar
- wxMenu *menuFile = new wxMenu;
-
- menuFile->Append(MakeProject_Generate, "&Generate");
- menuFile->Append(MakeProject_About, "&About...");
- menuFile->AppendSeparator();
- menuFile->Append(MakeProject_Quit, "E&xit");
-
- // now append the freshly created menu to the menu bar...
- wxMenuBar *menuBar = new wxMenuBar;
- menuBar->Append(menuFile, "&File");
-
- // ... and attach this menu bar to the frame
- SetMenuBar(menuBar);
-
- // create a status bar just for fun (by default with 1 pane only)
- CreateStatusBar(2);
- SetStatusText("Welcome to wxWindows!");
-}
-
-
-// event handlers
-
-void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
-{
- // TRUE is to force the frame to close
- Close(TRUE);
-}
-
-void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
-{
- wxMessageBox("MakeProject: generates VC++ project files",
- "About MakeProject", wxOK | wxICON_INFORMATION, this);
-}
-
-void MyFrame::OnGenerate(wxCommandEvent& WXUNUSED(event))
-{
- wxGetApp().GenerateSamples("d:/wx2/wxWindows");
-}
-
-bool MyFrame::GenerateSample(const wxString& projectName, const wxString& targetName,
- const wxString& path, const wxStringList& sourceFiles, const wxString& relativeRootPath)
-{
- return wxGetApp().GenerateSample(projectName, targetName, path, sourceFiles, relativeRootPath);
-}
-
-/*
- * wxProject
- */
-
-wxProject::wxProject()
-{
-}
-
-wxProject::~wxProject()
-{
-}
-
-
-bool wxProject::GenerateVCProject()
-{
- wxString fullProjectName = m_path + wxString("/") + m_projectName + ".dsp";
-
- ofstream stream(fullProjectName);
- if (stream.bad())
- return FALSE;
-
- /////////////////////// General stuff
-
- stream << "# Microsoft Developer Studio Project File - Name=\"" << m_projectName << "\" - Package Owner=<4>\n";
- stream << "# Microsoft Developer Studio Generated Build File, Format Version 5.00\n";
- stream << "# (Actually, generated by MakeProject, (c) Julian Smart, 1998)\n";
- stream << "# ** DO NOT EDIT **\n\n";
- stream << "# TARGTYPE \"Win32 (x86) Application\" 0x0101\n\n";
- stream << "CFG=" << m_projectName << " - Win32 Debug\n";
- stream << "!MESSAGE This is not a valid makefile. To build this project using NMAKE,\n";
- stream << "!MESSAGE use the Export Makefile command and run\n";
- stream << "!MESSAGE\n";
- stream << "!MESSAGE NMAKE /f \"" << m_projectName << ".mak\".\n";
- stream << "!MESSAGE\n";
- stream << "!MESSAGE You can specify a configuration when running NMAKE\n";
- stream << "!MESSAGE by defining the macro CFG on the command line. For example:\n";
- stream << "!MESSAGE\n";
- stream << "!MESSAGE NMAKE /f \"" << m_projectName << ".mak\" CFG=\"" << m_projectName << " - Win32 Debug\"\n";
- stream << "!MESSAGE\n";
- stream << "!MESSAGE Possible choices for configuration are:\n";
- stream << "!MESSAGE\n";
- stream << "!MESSAGE \"" << m_projectName << " - Win32 Release\" (based on \"Win32 (x86) Application\")\n";
- stream << "!MESSAGE \"" << m_projectName << " - Win32 Debug\" (based on \"Win32 (x86) Application\")\n";
- stream << "!MESSAGE \"" << m_projectName << " - Win32 Debug DLL\" (based on \"Win32 (x86) Application\")\n";
- stream << "!MESSAGE \"" << m_projectName << " - Win32 Release DLL\" (based on \"Win32 (x86) Application\")\n";
- stream << "!MESSAGE\n";
- stream << "\n";
- stream << "# Begin Project\n";
- stream << "# PROP Scc_ProjName \"\"\n";
- stream << "# PROP Scc_LocalPath \"\"\n";
- stream << "CPP=cl.exe\n";
- stream << "MTL=midl.exe\n";
- stream << "RSC=rc.exe\n";
- stream << "\n";
-
- /////////////////////// Win32 Release target
-
- stream << "!IF \"$(CFG)\" == \"" << m_projectName << " - Win32 Release\"\n";
- stream << "\n";
- stream << "# PROP BASE Use_MFC 0\n";
- stream << "# PROP BASE Use_Debug_Libraries 0\n";
- stream << "# PROP BASE Output_Dir \"Release\"\n";
- stream << "# PROP BASE Intermediate_Dir \"Release\"\n";
- stream << "# PROP BASE Target_Dir \"\"\n";
- stream << "# PROP Use_MFC 0\n";
- stream << "# PROP Use_Debug_Libraries 0\n";
- stream << "# PROP Output_Dir \"Release\"\n";
- stream << "# PROP Intermediate_Dir \"Release\"\n";
- stream << "# PROP Ignore_Export_Lib 0\n";
- stream << "# PROP Target_Dir \"\"\n";
- stream << "# ADD BASE CPP /nologo /W3 /GX /O2 /D \"WIN32\" /D \"NDEBUG\" /D \"_WINDOWS\" /YX /FD /c\n";
- stream << "# ADD CPP /nologo /MD /W3 /GX /O1 /Ob2";
-
- int n = m_includeDirs.Number();
- int i;
- for (i = 0; i < n; i++)
- {
- wxString includeDir = m_includeDirs[i];
- stream << " /I \"" << includeDir << "\"";
- }
-
- stream << " /D \"NDEBUG\" /D \"WIN32\" /D \"_WINDOWS\" /D \"__WINDOWS__\" /D \"__WXMSW__\" /D \"__WIN95__\" /D \"__WIN32__\" /D WINVER=0x0400 /D \"STRICT\" /FD /c\n";
- stream << "# SUBTRACT CPP /YX\n";
- stream << "# ADD BASE MTL /nologo /D \"NDEBUG\" /mktyplib203 /o NUL /win32\n";
- stream << "# ADD MTL /nologo /D \"NDEBUG\" /mktyplib203 /o NUL /win32\n";
- stream << "# ADD BASE RSC /l 0x809 /d \"NDEBUG\"\n";
- stream << "# ADD RSC /l 0x809 /d \"NDEBUG\"\n";
- stream << "BSC32=bscmake.exe\n";
- stream << "# ADD BASE BSC32 /nologo\n";
- stream << "# ADD BSC32 /nologo\n";
- stream << "LINK32=link.exe\n";
- stream << "# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib winmm.lib /nologo /subsystem:windows /machine:I386\n";
- stream << "# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib winmm.lib wx.lib png.lib zlib.lib jpeg.lib tiff.lib ";
- n = m_extraLibsRelease.Number();
- for (i = 0; i < n; i++)
- {
- wxString lib = m_extraLibsRelease[i];
- stream << lib << " ";
- }
-
- stream << "/nologo /subsystem:windows /machine:I386 /nodefaultlib:\"libc.lib,libci.lib,msvcrtd.lib\" /out:\"Release/" << m_targetName << ".exe\"";
-
- n = m_releaseLibDirs.Number();
- for (i = 0; i < n; i++)
- {
- wxString libDir = m_releaseLibDirs[i];
- stream << " /libpath:\"" << libDir << "\"";
- }
- n = m_libDirs.Number();
- for (i = 0; i < n; i++)
- {
- wxString libDir = m_libDirs[i];
- stream << " /libpath:\"" << libDir << "\"";
- }
- stream << "\n";
- stream << "\n";
-
- /////////////////////// Win32 Debug target
-
- stream << "!ELSEIF \"$(CFG)\" == \"" << m_projectName << " - Win32 Debug\"\n";
- stream << "\n";
- stream << "# PROP BASE Use_MFC 0\n";
- stream << "# PROP BASE Use_Debug_Libraries 1\n";
- stream << "# PROP BASE Output_Dir \"Debug\"\n";
- stream << "# PROP BASE Intermediate_Dir \"Debug\"\n";
- stream << "# PROP BASE Target_Dir \"\"\n";
- stream << "# PROP Use_MFC 0\n";
- stream << "# PROP Use_Debug_Libraries 1\n";
- stream << "# PROP Output_Dir \"Debug\"\n";
- stream << "# PROP Intermediate_Dir \"Debug\"\n";
- stream << "# PROP Ignore_Export_Lib 0\n";
- stream << "# PROP Target_Dir \"\"\n";
- stream << "# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D \"WIN32\" /D \"_DEBUG\" /D \"_WINDOWS\" /YX /FD /c\n";
- stream << "# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od";
-
- n = m_includeDirs.Number();
- for (i = 0; i < n; i++)
- {
- wxString includeDir = m_includeDirs[i];
- stream << " /I \"" << includeDir << "\"";
- }
-
- stream << " /D \"WIN32\" /D \"_DEBUG\" /D \"_WINDOWS\" /D \"__WINDOWS__\" /D \"__WXMSW__\" /D DEBUG=1 /D \"__WXDEBUG__\" /D \"__WIN95__\" /D \"__WIN32__\" /D WINVER=0x0400 /D \"STRICT\" /Yu\"wx/wxprec.h\" /FD /c\n";
- stream << "# ADD BASE MTL /nologo /D \"_DEBUG\" /mktyplib203 /o NUL /win32\n";
- stream << "# ADD MTL /nologo /D \"_DEBUG\" /mktyplib203 /o NUL /win32\n";
- stream << "# ADD BASE RSC /l 0x809 /d \"_DEBUG\"\n";
- stream << "# ADD RSC /l 0x809 /d \"_DEBUG\"\n";
- stream << "BSC32=bscmake.exe\n";
- stream << "# ADD BASE BSC32 /nologo\n";
- stream << "# ADD BSC32 /nologo\n";
- stream << "LINK32=link.exe\n";
- stream << "# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib winmm.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept\n";
- stream << "# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib winmm.lib wxd.lib pngd.lib zlibd.lib jpegd.lib tiffd.lib ";
- n = m_extraLibsDebug.Number();
- for (i = 0; i < n; i++)
- {
- wxString lib = m_extraLibsDebug[i];
- stream << lib << " ";
- }
- stream << "/nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:\"libcd.lib,libcid.lib,msvcrt.lib\" /out:\"Debug/" << m_targetName << ".exe\" /pdbtype:sept";
-
- n = m_debugLibDirs.Number();
- for (i = 0; i < n; i++)
- {
- wxString libDir = m_debugLibDirs[i];
- stream << " /libpath:\"" << libDir << "\"";
- }
- n = m_libDirs.Number();
- for (i = 0; i < n; i++)
- {
- wxString libDir = m_libDirs[i];
- stream << " /libpath:\"" << libDir << "\"";
- }
- stream << "\n";
- stream << "\n";
-// stream << "!ENDIF\n";
-// stream << "\n";
-
- /////////////////////// Win32 Debug DLL target
-
- stream << "!ELSEIF \"$(CFG)\" == \"" << m_projectName << " - Win32 Debug DLL\"\n";
- stream << "\n";
- stream << "# PROP BASE Use_MFC 0\n";
- stream << "# PROP BASE Use_Debug_Libraries 1\n";
- stream << "# PROP BASE Output_Dir \"DebugDLL\"\n";
- stream << "# PROP BASE Intermediate_Dir \"DebugDLL\"\n";
- stream << "# PROP BASE Target_Dir \"\"\n";
- stream << "# PROP Use_MFC 0\n";
- stream << "# PROP Use_Debug_Libraries 1\n";
- stream << "# PROP Output_Dir \"DebugDLL\"\n";
- stream << "# PROP Intermediate_Dir \"DebugDLL\"\n";
- stream << "# PROP Ignore_Export_Lib 0\n";
- stream << "# PROP Target_Dir \"\"\n";
- stream << "# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D \"WIN32\" /D \"_DEBUG\" /D \"_WINDOWS\" /YX /FD /c\n";
- stream << "# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od";
-
- n = m_includeDirs.Number();
- for (i = 0; i < n; i++)
- {
- wxString includeDir = m_includeDirs[i];
- stream << " /I \"" << includeDir << "\"";
- }
-
- stream << " /D \"WIN32\" /D \"_DEBUG\" /D \"_WINDOWS\" /D \"__WINDOWS__\" /D \"__WXMSW__\" /D DEBUG=1 /D \"__WXDEBUG__\" /D \"__WIN95__\" /D \"__WIN32__\" /D WINVER=0x0400 /D \"STRICT\" /D WXUSINGDLL=1 /Yu\"wx/wxprec.h\" /FD /c\n";
- stream << "# ADD BASE MTL /nologo /D \"_DEBUG\" /mktyplib203 /o NUL /win32\n";
- stream << "# ADD MTL /nologo /D \"_DEBUG\" /mktyplib203 /o NUL /win32\n";
- stream << "# ADD BASE RSC /l 0x809 /d \"_DEBUG\"\n";
- stream << "# ADD RSC /l 0x809 /d \"_DEBUG\"\n";
- stream << "BSC32=bscmake.exe\n";
- stream << "# ADD BASE BSC32 /nologo\n";
- stream << "# ADD BSC32 /nologo\n";
- stream << "LINK32=link.exe\n";
- stream << "# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib winmm.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept\n";
- stream << "# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib winmm.lib wxdlld.lib ";
- n = m_extraLibsDebug.Number();
- for (i = 0; i < n; i++)
- {
- wxString lib = m_extraLibsDebug[i];
- stream << lib << " ";
- }
- stream << "/nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:\"libcd.lib\" /nodefaultlib:\"libcid.lib\" /out:\"DebugDLL/" << m_targetName << ".exe\" /pdbtype:sept";
-
- n = m_debugLibDirs.Number();
- for (i = 0; i < n; i++)
- {
- wxString libDir = m_debugLibDirs[i];
- libDir += "DLL"; // Assume that we have e.g. Debug so make it DebugDLL
- stream << " /libpath:\"" << libDir << "\"";
- }
- n = m_libDirs.Number();
- for (i = 0; i < n; i++)
- {
- wxString libDir = m_libDirs[i];
- stream << " /libpath:\"" << libDir << "\"";
- }
- stream << "\n";
- stream << "\n";
-// stream << "!ENDIF\n";
-// stream << "\n";
-
- /////////////////////// Win32 Release DLL target
-
- stream << "!ELSEIF \"$(CFG)\" == \"" << m_projectName << " - Win32 Release DLL\"\n";
- stream << "\n";
- stream << "# PROP BASE Use_MFC 0\n";
- stream << "# PROP BASE Use_Debug_Libraries 0\n";
- stream << "# PROP BASE Output_Dir \"ReleaseDLL\"\n";
- stream << "# PROP BASE Intermediate_Dir \"ReleaseDLL\"\n";
- stream << "# PROP BASE Target_Dir \"\"\n";
- stream << "# PROP Use_MFC 0\n";
- stream << "# PROP Use_Debug_Libraries 0\n";
- stream << "# PROP Output_Dir \"ReleaseDLL\"\n";
- stream << "# PROP Intermediate_Dir \"ReleaseDLL\"\n";
- stream << "# PROP Ignore_Export_Lib 0\n";
- stream << "# PROP Target_Dir \"\"\n";
- stream << "# ADD BASE CPP /nologo /W3 /GX /O2 /D \"WIN32\" /D \"NDEBUG\" /D \"_WINDOWS\" /YX /FD /c\n";
- stream << "# ADD CPP /nologo /MD /W3 /GX /O1 /Ob2";
-
- n = m_includeDirs.Number();
- for (i = 0; i < n; i++)
- {
- wxString includeDir = m_includeDirs[i];
- stream << " /I \"" << includeDir << "\"";
- }
-
- stream << " /D \"NDEBUG\" /D \"WIN32\" /D \"_WINDOWS\" /D \"__WINDOWS__\" /D \"__WXMSW__\" /D \"__WIN95__\" /D \"__WIN32__\" /D WINVER=0x0400 /D \"STRICT\" /D WXUSINGDLL=1 /FD /c\n";
- stream << "# SUBTRACT CPP /YX\n";
- stream << "# ADD BASE MTL /nologo /D \"NDEBUG\" /mktyplib203 /o NUL /win32\n";
- stream << "# ADD MTL /nologo /D \"NDEBUG\" /mktyplib203 /o NUL /win32\n";
- stream << "# ADD BASE RSC /l 0x809 /d \"NDEBUG\"\n";
- stream << "# ADD RSC /l 0x809 /d \"NDEBUG\"\n";
- stream << "BSC32=bscmake.exe\n";
- stream << "# ADD BASE BSC32 /nologo\n";
- stream << "# ADD BSC32 /nologo\n";
- stream << "LINK32=link.exe\n";
- stream << "# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib winmm.lib /nologo /subsystem:windows /machine:I386\n";
- stream << "# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib winmm.lib wxdll.lib ";
- n = m_extraLibsRelease.Number();
- for (i = 0; i < n; i++)
- {
- wxString lib = m_extraLibsRelease[i];
- stream << lib << " ";
- }
- stream << "/nologo /subsystem:windows /machine:I386 /nodefaultlib:\"libc.lib\" /nodefaultlib:\"libci.lib\" /out:\"ReleaseDLL/" << m_targetName << ".exe\"";
-
- n = m_releaseLibDirs.Number();
- for (i = 0; i < n; i++)
- {
- wxString libDir = m_releaseLibDirs[i];
- libDir += "DLL"; // Assume that we have e.g. Release so make it ReleaseDLL
- stream << " /libpath:\"" << libDir << "\"";
- }
- n = m_libDirs.Number();
- for (i = 0; i < n; i++)
- {
- wxString libDir = m_libDirs[i];
- stream << " /libpath:\"" << libDir << "\"";
- }
- stream << "\n";
- stream << "\n";
- stream << "!ENDIF\n";
- stream << "\n";
-
- /////////////////////// Source code for targets
-
- stream << "# Begin Target\n";
- stream << "\n";
- stream << "# Name \"" << m_projectName << " - Win32 Release\"\n";
- stream << "# Name \"" << m_projectName << " - Win32 Debug\"\n";
- stream << "# Name \"" << m_projectName << " - Win32 Debug DLL\"\n";
- stream << "# Name \"" << m_projectName << " - Win32 Release DLL\"\n";
-
- // C++ source files
- n = m_sourceFiles.Number();
- for (i = 0; i < n; i++)
- {
- wxString sourceFile = m_sourceFiles[i];
-
- stream << "# Begin Source File\n";
- stream << "\n";
- stream << "SOURCE=.\\" << sourceFile << "\n";
- stream << "\n";
- stream << "!IF \"$(CFG)\" == \"" << m_projectName << " - Win32 Release\"\n";
- stream << "\n";
- stream << "!ELSEIF \"$(CFG)\" == \"" << m_projectName << " - Win32 Debug\"\n";
- stream << "\n";
- stream << "# SUBTRACT CPP /YX /Yc /Yu\n";
- stream << "\n";
- stream << "!ELSEIF \"$(CFG)\" == \"" << m_projectName << " - Win32 Debug DLL\"\n";
- stream << "\n";
- stream << "# SUBTRACT BASE CPP /YX /Yc /Yu\n";
- stream << "# SUBTRACT CPP /YX /Yc /Yu\n";
- stream << "\n";
- stream << "!ELSEIF \"$(CFG)\" == \"" << m_projectName << " - Win32 Release DLL\"\n";
- stream << "\n";
- stream << "!ENDIF\n";
- stream << "\n";
- stream << "# End Source File\n";
- }
-
- // The .rc file: assume it has the target name + rc extension.
- stream << "# Begin Source File\n";
- stream << "\n";
- stream << "SOURCE=.\\" << m_targetName << ".rc\n";
- stream << "# ADD BASE RSC /l 0x809\n";
- stream << "# ADD RSC /l 0x809";
-
- n = m_resourceIncludeDirs.Number();
- for (i = 0; i < n; i++)
- {
- wxString includeDir = m_resourceIncludeDirs[i];
- stream << " /i \"" << includeDir << "\"";
- }
-
- stream << "\n";
- stream << "# End Source File\n";
- stream << "# End Target\n";
- stream << "# End Project\n";
-
- // Now generate the .dsw workspace file
-
- wxString fullWorkSpaceName = m_path + wxString("/") + m_projectName + ".dsw";
-
- ofstream stream2(fullWorkSpaceName);
- if (stream2.bad())
- return FALSE;
-
- stream2 << "Microsoft Developer Studio Workspace File, Format Version 5.00\n";
- stream2 << "# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!\n";
- stream2 << "\n";
- stream2 << "###############################################################################\n";
- stream2 << "\n";
- stream2 << "Project: \"" << m_projectName << "\"=.\\" << m_projectName << ".dsp - Package Owner=<4>\n";
- stream2 << "\n";
- stream2 << "Package=<5>\n";
- stream2 << "{{{\n";
- stream2 << "}}}\n";
- stream2 << "\n";
- stream2 << "Package=<4>\n";
- stream2 << "{{{\n";
- stream2 << "}}}\n";
- stream2 << "\n";
- stream2 << "###############################################################################\n";
- stream2 << "\n";
- stream2 << "Global:\n";
- stream2 << "\n";
- stream2 << "Package=<5>\n";
- stream2 << "{{{\n";
- stream2 << "}}}\n";
- stream2 << "\n";
- stream2 << "Package=<3>\n";
- stream2 << "{{{\n";
- stream2 << "}}}\n";
- stream2 << "\n";
- stream2 << "###############################################################################\n";
- stream2 << "\n";
-
- return TRUE;
-}
-
-BEGIN_EVENT_TABLE(MyDialog, wxDialog)
- EVT_BUTTON(wxID_EXIT, MyDialog::OnQuit)
- EVT_BUTTON(ID_GENERATE_PROJECT, MyDialog::OnGenerate)
- EVT_BUTTON(ID_GENERATE_SAMPLES, MyDialog::OnGenerateSamples)
-END_EVENT_TABLE()
-
-// ----------------------------------------------------------------------------
-// main frame
-// ----------------------------------------------------------------------------
-
-// frame constructor
-MyDialog::MyDialog(const wxString& title, const wxPoint& pos, const wxSize& size):
- wxDialog()
-{
- LoadFromResource((wxWindow*) NULL, "project_dialog");
-
-}
-
-void MyDialog::OnQuit(wxCommandEvent& event)
-{
- this->EndModal(wxID_OK);
-}
-
-void MyDialog::OnAbout(wxCommandEvent& event)
-{
-}
-
-void MyDialog::OnGenerate(wxCommandEvent& event)
-{
-}
-
-void MyDialog::OnGenerateSamples(wxCommandEvent& event)
-{
- char* dir = getenv("WXWIN");
- wxString dirStr;
- if (dir)
- dirStr = dir;
- wxTextEntryDialog dialog(this, "Please enter the wxWindows directory", "Text entry", dirStr, wxOK|wxCANCEL);
- if (dialog.ShowModal() == wxID_OK)
- {
- if (wxDirExists(dialog.GetValue()))
- {
-// wxGetApp().GenerateSample("MinimalVC", "minimal", dir + wxString("/samples/minimal"),
-// wxStringList("minimal.cpp", 0));
-
- wxGetApp().GenerateSamples(dialog.GetValue());
- }
- else
- {
- wxMessageBox("This directory doesn't exist.");
- }
- }
-}
-
+++ /dev/null
-/////////////////////////////////////////////////////////////////////////////
-// Name: projgen.h
-// Purpose: Project generator classes.
-// Author: Julian Smart
-// Modified by:
-// Created: 04/12/98
-// RCS-ID: $Id$
-// Copyright: (c) Julian Smart
-// Licence: wxWindows licence
-/////////////////////////////////////////////////////////////////////////////
-
-/*
-
-Description
------------
-
-The top-level object is wxProjectDatabase, which maintains a list of wxProjectGenerator
-objects. Each wxProjectGenerator object contains a list of wxGeneratorConfiguration objects,
-and each of these in turn stores a list of variants which represent compiler-specific options in that
-configuration. wxProjectDatabase also stores a list of generic options (again variants),
-which may cause compiler-specific options to be stored in configurations.
-
-The usage is like this. The IDE (or other calling application) adds a number of project generators
-at initialization, one for each kind of compiler. For a new project, the app should call InitializeGenerators
-in order to call OnInitializeDefaults for each generator, which will call back into the wxProjectDatabase
-to get user-settable defaults.
-
-The app can then set generic options. When a generic option (such as 'use debug info')
-is set for a particular configuration, all generator objects are notified via OnSetGenericOption and they
-translate the generic option into a specific one (for that configuration).
-
-The wxProjectDatabase object can also be used to set compiler-specific options directly if required,
-but normally this would not be required. Each wxProjectGenerator should also have the opportunity
-to set initial defaults. These defaults should be editable by the user.
-
-Each wxProjectGenerator can access the parent wxProjectDatabase object at any time, since it
-may need to make a judgement about several generic settings in order to know what specific
-compiler options should be set.
-
-TODO: make a list of generic compiler options that each generator should recognise.
-
-*/
-
-#ifndef _PROJGEN_H_
-#define _PROJGEN_H_
-
-#ifdef __GNUG__
-#pragma interface "projgen.h"
-#endif
-
-#include "wx/defs.h"
-#include "wx/string.h"
-#include "wx/hash.h"
-#include "wx/variant.h"
-
-typedef enum {
- wxPROJECT_CAP_NONE = 0,
- wxPROJECT_CAP_MAKEFILE = 1,
- wxPROJECT_CAP_PROJECT = 2,
-} wxProjectCapability;
-
-class wxProjectGenerator;
-class wxGeneratorConfiguration;
-
-/*
- * wxProjectDatabase
- * This class maintains a list to all wxProjectGenerator objects, one for
- * each compiler.
- * Setting a generic option in wxProjectDatabase causes the individual wxProjectGenerator
- * objects to set their compiler-specific options for later generation.
- */
-
-class wxProjectDatabase: public wxObject
-{
-DECLARE_CLASS(wxProjectDatabase)
-public:
- wxProjectDatabase();
- ~wxProjectDatabase();
-
-// Operations
- // Generate project or makefile for a named compiler. Give an optional compiler version.
- virtual bool GenerateProject(const wxString& compiler, const wxString& filename, bool isMakefile, int compilerVersion = 0);
-
- // This calls each wxProjectGenerator's OnInitializeDefaults function to fill out the
- // defaults for each configuration. The generators will probably call back into the wxProjectDatabase
- // to get the defaults from a file (see GetDefaultCompilerOptions below).
- virtual bool InitializeGenerators();
-
-// Accessors
- // Get the capability: can it generate projects, or makefiles, or neither?
- virtual wxProjectCapability GetCapability(const wxString& compiler) const ;
-
- // Override this for your app so that when the wxProjectGenerator initializes its defaults, it
- // can call this to get specific option values that may be setup by the user.
- virtual wxVariant GetDefaultCompilerOption(const wxString& compiler, const wxString& config, const wxString& option) const ;
-
- // Gets all the default options for the named compiler/config. Likewise, override this to provide
- // a list of defaults to the calling wxProjectGenerator.
- virtual wxStringList GetDefaultCompilerOptionList(const wxString& compiler, const wxString& config) const ;
-
-// Compiler/configuration-specific options
- // Get a compiler-specific option value from the name.
- virtual wxVariant GetCompilerOption(const wxString& compiler, const wxString& config, const wxString& name) const;
-
- // Set the compiler-specific option
- virtual void SetCompilerOption(const wxString& compiler, const wxString& config, const wxString& name, const wxVariant& value);
-
- // Removes the compiler-specific option
- virtual void RemoveCompilerOption(const wxString& compiler, const wxString& config, const wxString& name);
-
- // Does this option exist?
- virtual bool HasCompilerOption(const wxString& compiler, const wxString& config, const wxString& name) const;
-
-// Generic options
- // Get a generic option value from the name.
- virtual wxVariant GetGenericOption(const wxString& config, const wxString& name) const;
-
- // Set the generic option value. This calls SetGenericOption for each wxProjectGenerator,
- // which will cause compiler-specific values to be placed in the relevant config
- virtual void SetGenericOption(const wxString& config, const wxString& name, const wxVariant& value);
-
- // Removes the generic option.
- virtual void RemoveGenericOption(const wxString& config, const wxString& name);
-
- // Does this option exist?
- virtual bool HasGenericOption(const wxString& config, const wxString& name) const;
-
-// Project path
- inline void SetProjectPath(const wxString& path) { m_projectPath = path; };
- inline wxString GetProjectPath() const { return m_projectPath; };
-
-// Project name
- inline void SetProjectName(const wxString& name) { m_projectName = name; };
- inline wxString GetProjectName() const { return m_projectName; };
-
-// The source files in the project
- // Add a file to the project. Normally this will be relative to the project path.
- // TODO: Files are managed within the wxProjectDatabase, but what about extra files
- // for specific platforms? Well, let's assume that even on Unix, you'd create a .rc
- // file, even if this isn't used in the resulting project/makefile on Unix.
- virtual void AddFile(const wxString& filename);
- virtual void RemoveFile(const wxString& filename);
- virtual bool FileExists(const wxString& filename) const;
-
-// TODO: management of include paths, library paths, libraries
-
-// Generator management
- virtual void AddGenerator(wxProjectGenerator* generator) ;
- virtual void RemoveGenerator(wxProjectGenerator* generator) ; // Doesn't delete it, just removes it
- virtual wxProjectGenerator* FindGenerator(const wxString& compiler) const ;
- virtual void ClearGenerators();
-
-protected:
- // List of wxProjectGenerator objects
- wxList m_generators;
-
- // List of compiler-independent configurations, such as "debug".
- wxList m_genericConfigurations;
-
- // List of source files
- wxStringList m_sourceFiles;
-
- // List of library paths
- wxStringList m_libraryPaths;
-
- // List of libraries: TODO this should be compiler-specific, surely?
- wxStringList m_libraries;
-
- // List of include paths
- wxStringList m_includePaths;
-
- // Project path
- wxString m_projectPath;
-
- // Project name
- wxString m_projectName;
-};
-
-/*
- * wxGeneratorConfiguration
- * A configuration, e.g. "debug", "release"
- */
-
-class wxGeneratorConfiguration: public wxObject
-{
-DECLARE_CLASS(wxGeneratorConfiguration)
-public:
- wxGeneratorConfiguration(const wxString& name);
- ~wxGeneratorConfiguration();
-
- // Does this option exist?
- virtual bool HasOption(const wxString& name) const;
-
- // Find option: returns NULL if there is no such option.
- wxVariant* FindOption(const wxString& name) const;
-
- // Get an option value
- virtual wxVariant GetOption(const wxString& name) const;
-
- // Set the option
- virtual void SetOption(const wxString& name, const wxVariant& value);
-
- // Remove the option
- virtual void RemoveOption(const wxString& name);
-
- // Does this option exist?
- virtual bool HasOption(const wxString& name) const;
-
- // Get the list of options
- inline const wxList& GetOptions() const { return m_options; }
-
- inline void SetName(const wxString& name) { m_name = name; }
- inline wxString GetName() const { return m_name; }
-
-protected:
- // Configuration name
- wxString m_name;
-
- // List of wxVariants
- wxList m_options;
-};
-
-/*
- * wxProjectGenerator.
- * Only derived classes can be instantiated.
- */
-
-class wxProjectGenerator: public wxObject
-{
-DECLARE_CLASS(wxProjectGenerator)
-public:
- wxProjectGenerator(const wxString& name, wxProjectDatabase* topLevel);
- ~wxProjectGenerator();
-
-// Operations
- // Generate project or makefile. Give an optional compiler version.
- virtual bool GenerateProject(bool isMakefile, int compilerVersion = 0) = 0;
-
- // Called when the defaults should be initialized.
- // It would recognise e.g. the "Debug" configuration name and set specific defaults, possibly
- // reading them from a database to allow for tailoring.
- // It is likely to call wxProjectDatabase::GetDefaultCompilerOption.
- virtual bool OnInitializeDefaults(const wxString& config) = 0;
-
- // This is called by wxProjectDatabase::SetGenericOption, and it tells this object
- // to translate it to a specific option. Then this object will (probably) call SetOption.
- virtual bool OnSetGenericOption(const wxString& config, const wxString& name, const wxVariant& value) = 0;
-
-// Accessors
- // Get the capability: can it generate projects, or makefiles, or neither?
- virtual wxProjectCapability GetCapability() const = 0;
-
- // Name
- inline void SetName(const wxString& name) { m_name = name; }
- inline wxString GetName() const { return m_name; }
-
- // Top-level wxProjectDatabase object
- inline void SetTopLevel(wxProjectDatabase* topLevel) { m_topLevel = topLevel; }
- inline wxProjectDatabase* GetTopLevel() const { return m_topLevel; }
-
-// Options
- // Get an option value
- virtual wxVariant GetOption(const wxString& config, const wxString& name) const;
-
- // Set the option
- virtual void SetOption(const wxString& config, const wxString& name, const wxVariant& value);
-
- // Remove the option
- virtual void RemoveOption(const wxString& config, const wxString& name);
-
- // Does this option exist?
- virtual bool HasOption(const wxString& name) const;
-
- // Get the list of options
- inline const wxList& GetConfigurations() const { return m_configs; }
-
-// Configuration management
- wxGeneratorConfiguation* FindConfiguration(const wxString& config) const ;
- void AddConfiguration(wxGeneratorConfiguration* config) ;
- void RemoveConfiguration(wxGeneratorConfiguration* config) ;
- void ClearConfigurations() ;
-
-protected:
- // List of wxGeneratorConfiguration objects
- wxList m_configs;
-
- // Compiler name
- wxString m_name;
-
- // Top-level object
- wxProjectDatabase* m_topLevel;
-};
-
-#endif
- // projgen.h
-
+++ /dev/null
-static char *project_dialog = "dialog(name = 'project_dialog',\
- style = 'wxRAISED_BORDER | wxCAPTION | wxTHICK_FRAME | wxSYSTEM_MENU',\
- title = 'VC++ Project Generation',\
- id = 100,\
- x = 10, y = 10, width = 269, height = 186,\
- background_colour = 'C0C0C0',\
- use_dialog_units = 1,\
- use_system_defaults = 0,\
- font = [8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif'],\
- control = [101, wxTextCtrl, '', '0', 'textctrl2', 136, 18, 120, 11, '',\
- [8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']],\
- control = [102, wxStaticText, 'Project path:', '0', 'statictext3', 136, 9, 112, 9, '',\
- [8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']],\
- control = [104, wxStaticText, 'Project name:', '0', 'static1234', 8, 9, 58, 9, '',\
- [8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']],\
- control = [105, wxTextCtrl, '', '0', 'textctrl6', 9, 18, 60, 11, '',\
- [8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']],\
- control = [6002, wxStaticText, 'Project target:', '0', 'statictext6', 72, 8, 56, 10, '',\
- [8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']],\
- control = [6003, wxTextCtrl, '', '0', 'textctrl7', 72, 18, 60, 11, '',\
- [8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']],\
- control = [6005, wxStaticText, 'Source files:', '0', 'statictext9', 8, 34, 248, 6, '',\
- [8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']],\
- control = [6006, wxTextCtrl, '', '0', 'textctrl10', 8, 44, 249, 11, '',\
- [8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']],\
- control = [6007, wxStaticText, 'Include paths:', '0', 'statictext11', 8, 60, 116, 10, '',\
- [8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']],\
- control = [6006, wxTextCtrl, '', '0', 'textctrl12', 8, 71, 128, 11, '',\
- [8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']],\
- control = [6009, wxStaticText, 'Resource include paths:', '0', 'statictext13', 140, 61, 104, 12, '',\
- [8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']],\
- control = [6010, wxTextCtrl, '', '0', 'textctrl14', 140, 71, 116, 11, '',\
- [8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']],\
- control = [6011, wxStaticText, 'Library paths:', '0', 'statictext15', 9, 87, 246, 10, '',\
- [8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']],\
- control = [6012, wxTextCtrl, '', '0', 'textctrl16', 8, 98, 248, 11, '',\
- [8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']],\
- control = [6013, wxTextCtrl, '', '0', 'textctrl17', 8, 121, 122, 11, '',\
- [8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']],\
- control = [6015, wxStaticText, 'Debug library paths:', '0', 'statictext19', 8, 112, 117, 9, '',\
- [8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']],\
- control = [6016, wxStaticText, 'Release library paths:', '0', 'statictext20', 137, 112, 120, 11, '',\
- [8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']],\
- control = [6017, wxTextCtrl, '', '0', 'textctrl21', 136, 121, 120, 11, '',\
- [8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']],\
- control = [6018, wxStaticText, 'Extra libraries:', '0', 'statictext22', 8, 139, 240, 10, '',\
- [8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']],\
- control = [6019, wxTextCtrl, '', '0', 'textctrl23', 8, 147, 248, 11, '',\
- [8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']],\
- control = [6020, wxButton, 'Generate project', '0', 'button24', 8, 165, 65, 13, '',\
- [8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']],\
- control = [5006, wxButton, 'Close', '0', 'button25', 73, 165, 64, 13, '',\
- [8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']],\
- control = [6021, wxButton, 'Generate wxWin samples...', '0', 'button26', 172, 165, 84, 13, '',\
- [8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']]).";
-