diff --git a/bin/data/settings/projectGeneratorSettings.xml b/bin/data/settings/projectGeneratorSettings.xml
index 5f488c8..4572ce6 100644
--- a/bin/data/settings/projectGeneratorSettings.xml
+++ b/bin/data/settings/projectGeneratorSettings.xml
@@ -1,6 +1,24 @@
-
-../../../../
+
-
-apps/myApps
+
+
+
+ ../../../../
+
+
+
+ 1
+
+
+
+
+
+
+ apps/myApps
+
+
+
+
diff --git a/projectGenerator.xcodeproj/project.pbxproj b/projectGenerator.xcodeproj/project.pbxproj
index ffe0e46..5f47102 100644
--- a/projectGenerator.xcodeproj/project.pbxproj
+++ b/projectGenerator.xcodeproj/project.pbxproj
@@ -45,6 +45,9 @@
E4C2424810CC5A17004149E2 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E4C2424510CC5A17004149E2 /* Cocoa.framework */; };
E4C2424910CC5A17004149E2 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E4C2424610CC5A17004149E2 /* IOKit.framework */; };
E4EB6799138ADC1D00A09F29 /* GLUT.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BBAB23BE13894E4700AA2426 /* GLUT.framework */; };
+ FD63DC6817B3CEA90023EEB1 /* basePGPage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FD63DC6417B3CEA90023EEB1 /* basePGPage.cpp */; };
+ FD63DC6917B3CEA90023EEB1 /* simplePGPage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FD63DC6617B3CEA90023EEB1 /* simplePGPage.cpp */; };
+ FD63DC7217B56EE50023EEB1 /* generateProjects.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FD63DC7017B56EE50023EEB1 /* generateProjects.cpp */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
@@ -104,7 +107,6 @@
116EA81C150E7288004EBBD3 /* CBLinuxProject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CBLinuxProject.h; sourceTree = ""; };
119B95D714A65CA0001E1E20 /* pugiconfig.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = pugiconfig.hpp; sourceTree = ""; };
119B95D814A65CA0001E1E20 /* pugixml.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = pugixml.hpp; sourceTree = ""; };
- 11BCDC821607709900FCCD85 /* textButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = textButton.h; sourceTree = ""; };
27C4A1A9179491920031C6E4 /* ofxBaseGui.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ofxBaseGui.cpp; sourceTree = ""; };
27C4A1AA179491920031C6E4 /* ofxBaseGui.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ofxBaseGui.h; sourceTree = ""; };
27C4A1AB179491920031C6E4 /* ofxButton.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ofxButton.cpp; sourceTree = ""; };
@@ -143,6 +145,13 @@
E4C2424610CC5A17004149E2 /* IOKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IOKit.framework; path = /System/Library/Frameworks/IOKit.framework; sourceTree = ""; };
E4EB691F138AFCF100A09F29 /* CoreOF.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = CoreOF.xcconfig; path = ../../../libs/openFrameworksCompiled/project/osx/CoreOF.xcconfig; sourceTree = SOURCE_ROOT; };
E4EB6923138AFD0F00A09F29 /* Project.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Project.xcconfig; sourceTree = ""; };
+ FD63DC6217B3CDF20023EEB1 /* textButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = textButton.h; sourceTree = ""; };
+ FD63DC6417B3CEA90023EEB1 /* basePGPage.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = basePGPage.cpp; sourceTree = ""; };
+ FD63DC6517B3CEA90023EEB1 /* basePGPage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = basePGPage.h; sourceTree = ""; };
+ FD63DC6617B3CEA90023EEB1 /* simplePGPage.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = simplePGPage.cpp; sourceTree = ""; };
+ FD63DC6717B3CEA90023EEB1 /* simplePGPage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = simplePGPage.h; sourceTree = ""; };
+ FD63DC7017B56EE50023EEB1 /* generateProjects.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = generateProjects.cpp; sourceTree = ""; };
+ FD63DC7117B56EE50023EEB1 /* generateProjects.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = generateProjects.h; sourceTree = ""; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -359,13 +368,14 @@
E4B69E1C0A3A1BDC003C02F2 /* src */ = {
isa = PBXGroup;
children = (
+ FD63DC6317B3CEA90023EEB1 /* pages */,
+ FD63DC6117B3CDF20023EEB1 /* gui */,
113CAA5614F88EDD00D3906E /* utils */,
1120712314AE3D4F0035CB7E /* projects */,
119B95D214A65CA0001E1E20 /* pugixmlLib */,
E4B69E1D0A3A1BDC003C02F2 /* main.cpp */,
E4B69E1F0A3A1BDC003C02F2 /* testApp.h */,
E4B69E1E0A3A1BDC003C02F2 /* testApp.cpp */,
- 11BCDC821607709900FCCD85 /* textButton.h */,
11D6814214A8EC0F008E3E3D /* addons */,
);
path = src;
@@ -380,6 +390,27 @@
name = openFrameworks;
sourceTree = "";
};
+ FD63DC6117B3CDF20023EEB1 /* gui */ = {
+ isa = PBXGroup;
+ children = (
+ FD63DC6217B3CDF20023EEB1 /* textButton.h */,
+ );
+ path = gui;
+ sourceTree = "";
+ };
+ FD63DC6317B3CEA90023EEB1 /* pages */ = {
+ isa = PBXGroup;
+ children = (
+ FD63DC7017B56EE50023EEB1 /* generateProjects.cpp */,
+ FD63DC7117B56EE50023EEB1 /* generateProjects.h */,
+ FD63DC6417B3CEA90023EEB1 /* basePGPage.cpp */,
+ FD63DC6517B3CEA90023EEB1 /* basePGPage.h */,
+ FD63DC6617B3CEA90023EEB1 /* simplePGPage.cpp */,
+ FD63DC6717B3CEA90023EEB1 /* simplePGPage.h */,
+ );
+ path = pages;
+ sourceTree = "";
+ };
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
@@ -437,8 +468,7 @@
E4328148138ABC890047C5CB /* openFrameworksDebug.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
- name = openFrameworksDebug.a;
- path = openFrameworks.a;
+ path = openFrameworksDebug.a;
remoteRef = E4328147138ABC890047C5CB /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
@@ -487,6 +517,9 @@
27C4A1BF179491920031C6E4 /* ofxSlider.cpp in Sources */,
27C4A1C0179491920031C6E4 /* ofxSliderGroup.cpp in Sources */,
27C4A1C1179491920031C6E4 /* ofxToggle.cpp in Sources */,
+ FD63DC6817B3CEA90023EEB1 /* basePGPage.cpp in Sources */,
+ FD63DC6917B3CEA90023EEB1 /* simplePGPage.cpp in Sources */,
+ FD63DC7217B56EE50023EEB1 /* generateProjects.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
diff --git a/src/textButton.h b/src/gui/textButton.h
similarity index 88%
rename from src/textButton.h
rename to src/gui/textButton.h
index ff74e2d..77ba73c 100644
--- a/src/textButton.h
+++ b/src/gui/textButton.h
@@ -21,18 +21,28 @@ class textButton{
ofRectangle rect;
bool bSelectable;
bool bDrawLong;
-
string secondaryText;
-
-
string deliminater;
int maxWidth;
-
-
bool bMouseOver;
ofColor off;
ofColor on;
-
+
+
+ void setup(ofTrueTypeFont * _font, ofTrueTypeFont * _secondFont, string _prefix, string _text, string _secondaryText, ofPoint anchor, string _deliminator = ""){
+
+ deliminater = _deliminator;
+
+ font = _font;
+ secondFont = _secondFont;
+ prefix = _prefix;
+ topLeftAnchor.set(anchor); //set top button position - others are set relative to this.
+ setText(_text);
+ secondaryText = _secondaryText;
+
+ }
+
+
void setText(string newText){
diff --git a/src/main.cpp b/src/main.cpp
index 390bf81..9a14760 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -8,9 +8,109 @@
int main( int argc, char *argv[] ){
+
+
+ cout << "In main." << endl;
+ cout << "ofGetTargetPlatform=" << ofGetTargetPlatform() << endl;
+
+#ifdef TARGET_LINUX
+ cout << "linux " << endl;
+ if(argc==1){
+
+ ofAppGlutWindow window;
+ ofSetupOpenGL(&window, 1024, 610, OF_WINDOW);
+ testApp * app = new testApp;
+
+ ofRunApp( app );
+
+ }else{
+ ofAppNoWindow window;
+ ofSetupOpenGL(&window, 1024,768, OF_WINDOW);
+ testApp * app = new testApp;
+ app->makeProjects.buildAllExamples = false;
+ app->makeProjects.projectPath = "";
+ for(int i=1;imakeProjects.targetsToMake.push_back( OF_TARGET_LINUX );
+ }else if(arg=="linux64"){
+ app->makeProjects.targetsToMake.push_back( OF_TARGET_LINUX64 );
+ }else if(arg=="linuxarmv6l"){
+ app->makeProjects.targetsToMake.push_back( OF_TARGET_LINUXARMV6L );
+ }else if(arg=="linuxarmv7l"){
+ app->makeProjects.targetsToMake.push_back( OF_TARGET_LINUXARMV7L );
+ }else if(arg=="win_cb"){
+ app->makeProjects.targetsToMake.push_back( OF_TARGET_WINGCC );
+ }else if(arg=="vs"){
+ app->makeProjects.targetsToMake.push_back( OF_TARGET_WINVS );
+ }else if(arg=="osx"){
+ app->makeProjects.targetsToMake.push_back( OF_TARGET_OSX );
+ }else if(arg=="ios"){
+ app->makeProjects.targetsToMake.push_back( OF_TARGET_IPHONE );
+ }else if(arg=="android"){
+ ofLogError() << "platform not supported yet" << endl;
+ std::exit(1);
+ }else if(arg=="allplatforms"){
+ app->makeProjects.targetsToMake.push_back( OF_TARGET_LINUX );
+ app->makeProjects.targetsToMake.push_back( OF_TARGET_LINUX64 );
+ app->makeProjects.targetsToMake.push_back( OF_TARGET_LINUXARMV6L );
+ app->makeProjects.targetsToMake.push_back( OF_TARGET_LINUXARMV7L );
+ app->makeProjects.targetsToMake.push_back( OF_TARGET_WINGCC );
+ app->makeProjects.targetsToMake.push_back( OF_TARGET_WINVS );
+ app->makeProjects.targetsToMake.push_back( OF_TARGET_OSX );
+ app->makeProjects.targetsToMake.push_back( OF_TARGET_IPHONE );
+ }else if(arg=="allexamples"){
+ app->makeProjects.buildAllExamples = true;
+ }else if(arg=="help"){
+ cout << "OF Project Generator Usage:" << endl;
+ cout << "projectGenerator [options] [pathToExample]" << endl;
+ cout << "Options:" << endl;
+ cout << "--osx: generate osx project files" << endl;
+ cout << "--win_cb: generate windows codeblocks project files" << endl;
+ cout << "--vs: generate windows visual studio project files" << endl;
+ cout << "--linux: generate linux project files" << endl;
+ cout << "--linux64: generate linux 64bits project files" << endl;
+ cout << "--linuxarmv6l: generate linux armv6l project files" << endl;
+ cout << "--linuxarmv7l: generate linux armv7l project files" << endl;
+ cout << "--ios: generate iOS project files" << endl;
+ cout << "--allplatforms: generate project files for all platforms" << endl;
+ cout << "--allexamples: generate project files for all examples. [pathToExample] is not needed in this case." << endl;
+ cout << endl;
+ cout << "default: create project files for current platform for selected path" << endl;
+ cout << "running over existing example updates project files for selected platforms" << endl;
+ cout << "without parameters, shows gui" << endl;
+ std::exit(0);
+ }else{
+ cout << "Error: Unknown argument --" << arg << ". Run \'projectGenerator help\' for details. Aborting." << endl;
+ std::exit(1);
+ }
+ }else if(arg.find("-", 0, 1)==0){
+ cout << "Error: Unknown argument " << arg << ". Run \'projectGenerator help\' for details. Aborting." << endl;
+ std::exit(1);
+ }else{
+ app->makeProjects.projectPath = ofFilePath::removeTrailingSlash(ofFilePath::getPathForDirectory(ofFilePath::getAbsolutePath(arg,false)));
+ }
+ }
+
+ if (!(app->makeProjects.buildAllExamples) && app->makeProjects.projectPath.empty()){
+ cout << "Error: No target project given. Either run projectGenerator with the --allexamples option or supply a target project folder path. Run \'projectGenerator help\' for details." << endl;
+ std::exit(1);
+ }
+
+ if(app->makeProjects.targetsToMake.empty())
+ app->makeProjects.targetsToMake.push_back( ofGetTargetPlatform() );
+ ofRunApp( app );
+ }
+#else
+ printf("??");
ofAppGlutWindow window;
ofSetupOpenGL(&window, 1024, 610, OF_WINDOW);
testApp * app = new testApp;
- //app->buildAllExamples = false;
- ofRunApp( app );
+ //app->makeProjects.buildAllExamples = false;
+ ofRunApp( app );
+
+#endif
+
}
diff --git a/src/pages/basePGPage.cpp b/src/pages/basePGPage.cpp
new file mode 100644
index 0000000..e69de29
diff --git a/src/pages/basePGPage.h b/src/pages/basePGPage.h
new file mode 100644
index 0000000..5828956
--- /dev/null
+++ b/src/pages/basePGPage.h
@@ -0,0 +1,36 @@
+#pragma once
+
+#include "ofMain.h"
+
+
+class basePGPage {
+
+ public:
+
+ virtual void setup() = 0;;
+ virtual void update() = 0;;
+ virtual void draw() = 0;;
+
+ virtual void keyPressed (int key) = 0;;
+ virtual void keyReleased(int key) = 0;;
+ virtual void mouseMoved(int x, int y ) = 0;;
+ virtual void mouseDragged(int x, int y, int button) = 0;;
+ virtual void mousePressed(int x, int y, int button) = 0;;
+ virtual void mouseReleased(int x, int y, int button) = 0;;
+ virtual void windowResized(int w, int h) = 0;;
+ virtual void dragEvent(ofDragInfo dragInfo) = 0;;
+ virtual void gotMessage(ofMessage msg) = 0;;
+
+
+ typedef struct {
+ string appRoot;
+ bool multiplatform;
+ string defaultNewProjectLocation;
+ } pgSettings;
+
+ pgSettings settings;
+
+ ofTrueTypeFont * font;
+ ofTrueTypeFont * titleFont;
+ ofTrueTypeFont * secondFont;
+};
diff --git a/src/pages/generateProjects.cpp b/src/pages/generateProjects.cpp
new file mode 100644
index 0000000..48d228a
--- /dev/null
+++ b/src/pages/generateProjects.cpp
@@ -0,0 +1,626 @@
+#include "generateProjects.h"
+#include "Utils.h"
+#include
+#include "ofConstants.h"
+
+
+
+
+
+//------------------------------------------------------
+string generateProjects::setupForTarget(int targ){
+
+ if(project){
+ delete project;
+ }
+ string target;
+ switch(targ){
+ case OF_TARGET_OSX:
+ project = new xcodeProject;
+ target = "osx";
+ break;
+ case OF_TARGET_WINGCC:
+ project = new CBWinProject;
+ target = "win_cb";
+ break;
+ case OF_TARGET_WINVS:
+ project = new visualStudioProject;
+ target = "vs";
+ break;
+ case OF_TARGET_IPHONE:
+ project = new xcodeProject();
+ target = "ios";
+ break;
+ case OF_TARGET_ANDROID:
+ break;
+ case OF_TARGET_LINUX64:
+ project = new CBLinuxProject;
+ target = "linux64";
+ break;
+ case OF_TARGET_LINUX:
+ project = new CBLinuxProject;
+ target = "linux";
+ break;
+ }
+
+ project->setup(target);
+
+ return target;
+}
+
+
+
+void generateProjects::setStatus(string newStatus){
+ statusEnergy = 1;
+ status = newStatus;
+ statusSetTime = ofGetElapsedTimef();
+}
+
+
+
+//--------------------------------------------------------------
+void generateProjects::setup(){
+ ofEnableAlphaBlending();
+ ofEnableSmoothing();
+ ofSetLogLevel(OF_LOG_VERBOSE);
+ ofSetVerticalSync(true);
+
+
+ statusEnergy = 0;
+
+ mode = 0;
+ bInited = false;
+ project = NULL;
+ sketchName = "mySketch";
+
+
+
+ //-------------------------------------
+ // calculate the bin path (../../../ on osx) and the sketch path (bin -> root - > defaultLoc)
+ //-------------------------------------
+
+ // if appToRoot is wrong, we have alot of issues. all these paths are used in this project:
+
+#ifdef TARGET_OSX
+ string binPath = ofFilePath::getAbsolutePath(ofFilePath::join(ofFilePath::getCurrentWorkingDirectory(), "../../../"));
+#else
+ string binPath = ofFilePath::getCurrentExeDir();
+#endif
+
+ string ofRoot = ofFilePath::getAbsolutePath(ofFilePath::join(binPath, settings.appRoot));
+ examplesPath = ofFilePath::join(ofRoot, "examples");
+
+ addonsPath = ofFilePath::getAbsolutePath(ofFilePath::join(ofRoot,"addons"));
+ sketchPath = ofFilePath::getAbsolutePath(ofFilePath::join(ofRoot, defaultLoc));
+
+
+ convertWindowsToUnixPath(ofRoot);
+ convertWindowsToUnixPath(addonsPath);
+ convertWindowsToUnixPath(sketchPath);
+
+ // there's some issues internally in OF with non unix paths for OF root
+ setOFRoot(ofRoot);
+
+ //-------------------------------------
+ // get settings
+ //-------------------------------------
+
+ // Sketch button
+ //
+ button.font = font;
+ button.secondFont = secondFont;
+
+
+ // Path button
+ //
+ button.topLeftAnchor.set(76, 160+40);
+ button.deliminater = "/";
+ button.prefix = "Base OF path: ";
+ button.setText(sketchPath);
+ button.secondaryText = "<< CLICK TO CHANGE THE DIRECTORY";
+ button.topLeftAnchor.set(button.topLeftAnchor.x, button.topLeftAnchor.y + button.rect.height + 20);
+ buttons.push_back(button);
+
+
+ button.deliminater = "/";
+ button.prefix = "Examples path: ";
+ button.setText(examplesPath);
+ button.secondaryText = "<< CLICK TO CHANGE THE DIRECTORY";
+ button.topLeftAnchor.set(button.topLeftAnchor.x, button.topLeftAnchor.y + button.rect.height + 20);
+ buttons.push_back(button);
+
+ // Platform text
+ //
+ button.deliminater = ", ";
+ button.prefix = "Platforms: ";
+ button.secondaryText = "";
+ button.bDrawLong = false;
+ button.secondaryText = "";
+ button.bSelectable = false;
+ button.setText(platform);
+
+ button.topLeftAnchor.set(button.topLeftAnchor.x, button.topLeftAnchor.y + button.rect.height + 20);
+ buttons.push_back(button);
+
+
+ // Generate
+ //
+ generateButton = button;
+ generateButton.topLeftAnchor.set(906, 535);
+ //generateButton.setColor(ofColor(50, 150, 255));
+ generateButton.deliminater = ",";
+ generateButton.prefix = "GENERATE PROJECT";
+ generateButton.bSelectable = true;
+ generateButton.setText("");
+ generateButton.bDrawLong = false;
+
+ addonButton = button;
+ addonButton.topLeftAnchor.set(906, 535);
+ addonButton.prefix = "<< BACK";
+ addonButton.setText("");
+ addonButton.bDrawLong = false;
+
+
+ for (int i = 0; i < buttons.size(); i++){
+ buttons[i].calculateRect();
+ }
+ addonButton.calculateRect();
+ generateButton.calculateRect();
+
+
+
+ //-------------------------------------
+ // platform panel (not used, really, but here just in case)
+ //-------------------------------------
+ panelPlatforms.setup();
+ panelPlatforms.add(wincbToggle.setup("windows (codeblocks)",ofGetTargetPlatform()==OF_TARGET_WINGCC));
+ panelPlatforms.add(winvsToggle.setup("windows (visual studio)", ofGetTargetPlatform()==OF_TARGET_WINVS));
+ panelPlatforms.add(linuxcbToggle.setup("linux (codeblocks)",ofGetTargetPlatform()==OF_TARGET_LINUX));
+ panelPlatforms.add(linux64cbToggle.setup("linux64 (codeblocks)",ofGetTargetPlatform()==OF_TARGET_LINUX64));
+
+//for ios, we need to fake that the target is ios (since we're compiling w/ osx OF)
+
+//#define MAKE_IOS
+
+#ifdef MAKE_IOS
+ panelPlatforms.add(osxToggle.setup("osx (xcode)",false));
+ panelPlatforms.add(iosToggle.setup("ios (xcode)",true));
+#else
+ panelPlatforms.add(osxToggle.setup("osx (xcode)",ofGetTargetPlatform()==OF_TARGET_OSX));
+ panelPlatforms.add(iosToggle.setup("ios (xcode)",ofGetTargetPlatform()==OF_TARGET_IPHONE));
+#endif
+
+
+ // update the platforms text in the platform button
+ string platforms = "";
+ for (int i = 0; i < panelPlatforms.getNumControls(); i++){
+ if (*((ofxToggle *)panelPlatforms.getControl(i))){
+ if (platforms.length() > 0) platforms+=", ";
+ platforms += ((ofxToggle *)panelPlatforms.getControl(i))->getName();
+
+ };
+ }
+ buttons[2].setText(platforms);
+
+
+ panelPlatforms.setPosition(10,40);
+ panelCoreAddons.setPosition(10,40);
+ panelOtherAddons.setPosition(330,40);
+
+
+ logo.loadImage("images/ofw-logo.png");
+
+ ofBackground(230,230,230);
+
+
+ generateButton.topLeftAnchor.set(ofGetWidth() - buttons[0].rect.x - generateButton.rect.width + 10 ,
+ ofGetHeight() - generateButton.rect.height - 40);// 535);
+ generateButton.calculateRect();
+
+ addonButton.topLeftAnchor.set(ofGetWidth() - buttons[0].rect.x - addonButton.rect.width + 10 ,
+ ofGetHeight() - addonButton.rect.height - 40);// 535);
+ addonButton.calculateRect();
+
+}
+
+
+
+
+
+
+//--------------------------------------------------------------
+void generateProjects::update(){
+
+ float diff = ofGetElapsedTimef()- statusSetTime;
+ if (diff > 3){
+ statusEnergy *= 0.99;;
+ }
+ //-------------------------------------
+ // if we are in addon mode check
+ //-------------------------------------
+
+ if (mode == MODE_ADDON ) addonButton.checkMousePressed(ofPoint(ofGetMouseX(), ofGetMouseY()));
+
+
+ //-------------------------------------
+ // layout our normal buttons, check the mouse
+ //-------------------------------------
+
+ for (int i = 0; i < buttons.size(); i++){
+ buttons[i].calculateRect();
+ buttons[i].checkMousePressed(ofPoint(ofGetMouseX(), ofGetMouseY()));
+ }
+
+ generateButton.checkMousePressed(ofPoint(ofGetMouseX(), ofGetMouseY()));
+
+ for (int i = 0; i < buttons.size(); i++){
+ if (i != 0){
+ buttons[i].topLeftAnchor.y = buttons[i-1].topLeftAnchor.y +buttons[i-1].rect.height + 20;
+ }
+ }
+
+
+ //-------------------------------------
+ // addons panels can be really long, so use the mouse pos to move them if we need to
+ //-------------------------------------
+
+ if (panelCoreAddons.getShape().height > ofGetHeight()){
+ float pct = ofMap(ofGetMouseY(), 0,ofGetHeight(), 0,1,true);
+ float diff = panelCoreAddons.getShape().height - ofGetHeight();
+ panelCoreAddons.setPosition(panelCoreAddons.getPosition().x,-diff * pct);
+ }
+
+ if (panelOtherAddons.getShape().height > ofGetHeight()){
+ float pct = ofMap(ofGetMouseY(), 0,ofGetHeight(), 0,1,true);
+ float diff = panelOtherAddons.getShape().height - ofGetHeight();
+ panelOtherAddons.setPosition(panelOtherAddons.getPosition().x,-diff * pct);
+ }
+
+}
+
+//--------------------------------------------------------------
+void generateProjects::draw(){
+
+
+ //cout << ofFilePath::join(ofFilePath::join(ofFilePath::getCurrentExeDir(), "../../../"), appToRoot) << endl;
+
+ cout << settings.appRoot << endl;
+ //cout << ofFilePath::join(ofFilePath::join(ofFilePath::getCurrentExeDir(), "../../../"), appToRoot) << endl;
+
+ if (mode != MODE_ADDON ) {
+
+ ofSetColor(100);
+ logo.draw(64, 61,logo.getWidth(),logo.getHeight());
+
+ //ofSetColor(74,255,203);
+ titleFont->drawString("PROJECT", 64 + logo.getWidth() + 25, 85);
+ titleFont->drawString("GENERATOR", 64 + logo.getWidth() + 25, 117);
+ }
+
+ if (mode == 0){
+ for (int i = 0; i < buttons.size(); i++){
+ buttons[i].draw();
+ }
+
+ generateButton.draw();
+
+ } else if (mode == 1){
+ panelCoreAddons.draw();
+ if (bHaveNonCoreAddons){
+ panelOtherAddons.draw();
+ }
+ } else if (mode == 2){
+ panelPlatforms.draw();
+ }
+ //cout << panelAddons.getShape().height << endl;
+
+
+
+
+ if (mode == 1 ){
+ addonButton.draw();
+
+ ofRectangle rect = secondFont->getStringBoundingBox("select core and non-core addons to add", addonButton.topLeftAnchor.x-200, 60);
+ ofSetColor(220,220,220);
+ ofRect(rect.x-10, rect.y-10, rect.width+20, rect.height+20);
+ ofSetColor(0,0,0);
+ secondFont->drawString("select core and non-core addons to add", addonButton.topLeftAnchor.x-200, 60);
+ }
+
+ if (mode == 0){
+ ofFill();
+ ofSetColor(0 + 220 * (1-statusEnergy),0 + 220 * (1-statusEnergy),0 + 220 * (1-statusEnergy));
+ ofRect(0,ofGetHeight(), ofGetWidth(), -25);
+ ofSetColor(255,255,255, 255 * statusEnergy);
+ ofDrawBitmapString(status, 10,ofGetHeight()-8);
+ }
+}
+
+//--------------------------------------------------------------
+void generateProjects::keyPressed(int key){
+
+ if (key == ' '){
+
+ }
+
+
+}
+
+
+void generateProjects::generateExamples(){
+
+
+
+ ofDirectory dir;
+ //string examplesPath = ofFilePath::join(getOFRoot(),"examples");
+ ofLogNotice() << "Generating examples (from: " << examplesPath << ")";
+ dir.listDir(examplesPath);
+
+
+ // vector targetsToMake;
+ // if( osxToggle ) targetsToMake.push_back(OF_TARGET_OSX);
+ // if( iosToggle ) targetsToMake.push_back(OF_TARGET_IPHONE);
+ // if( wincbToggle ) targetsToMake.push_back(OF_TARGET_WINGCC);
+ // if( winvsToggle ) targetsToMake.push_back(OF_TARGET_WINVS);
+ // if( linuxcbToggle ) targetsToMake.push_back(OF_TARGET_LINUX);
+ // if( linux64cbToggle ) targetsToMake.push_back(OF_TARGET_LINUX64);
+
+
+ string target = setupForTarget(OF_TARGET_OSX);
+
+ for (int i = 0; i < (int)dir.size(); i++){
+
+ // don't check subdirectories that aren't directories! (eg., .gitignore etc)
+ if(!dir.getFile(i).isDirectory()) continue;
+
+ if( target == "ios" ){
+ if( dir.getName(i) != "ios" ) continue;
+ }else{
+ if (dir.getName(i) == "android" || dir.getName(i) == "ios") continue;
+ }
+
+ ofDirectory subdir;
+ string examplesPath = dir.getPath(i);
+
+ ofLogNotice() << "Generating examples in folder: " << examplesPath;
+
+ subdir.listDir(examplesPath);
+
+ for (int j = 0; j < (int)subdir.size(); j++){
+
+ // don't create projects that aren't directories! (eg., .gitkeep etc)
+ if(!subdir.getFile(j).isDirectory()) continue;
+
+ ofLogNotice() << "------------------------------------------------";
+ ofLogNotice() << "Generating example: " << subdir.getPath(j);
+ ofLogNotice() << "------------------------------------------------";
+
+ project->setup(target);
+ project->create(subdir.getPath(j));
+ vector < string > addons;
+ parseAddonsDotMake(project->getPath() + "addons.make", addons);
+ for (int i = 0; i < (int)addons.size(); i++){
+ ofAddon addon;
+ addon.pathToOF = getOFRelPath(subdir.getPath(j));
+ addon.fromFS(ofFilePath::join(ofFilePath::join(getOFRoot(), "addons"), addons[i]),target);
+ project->addAddon(addon);
+ }
+ project->save(false);
+
+ }
+ }
+ ofLogNotice() << " ";
+ ofLogNotice() << "Finished generating examples for " << target;
+}
+
+
+
+void generateProjects::generateProject(){
+
+// vector targetsToMake;
+// if( osxToggle ) targetsToMake.push_back(OF_TARGET_OSX);
+// if( iosToggle ) targetsToMake.push_back(OF_TARGET_IPHONE);
+// if( wincbToggle ) targetsToMake.push_back(OF_TARGET_WINGCC);
+// if( winvsToggle ) targetsToMake.push_back(OF_TARGET_WINVS);
+// if( linuxcbToggle ) targetsToMake.push_back(OF_TARGET_LINUX);
+// if( linux64cbToggle ) targetsToMake.push_back(OF_TARGET_LINUX64);
+//
+// if( targetsToMake.size() == 0 ){
+// cout << "Error: makeNewProjectViaDialog - must specifiy a project to generate " <create(path)){
+// vector addonsToggles = panelCoreAddons.getControlNames();
+// for (int i = 0; i < (int) addonsToggles.size(); i++){
+// ofxToggle toggle = panelCoreAddons.getToggle(addonsToggles[i]);
+// if(toggle){
+// ofAddon addon;
+// addon.pathToOF = getOFRelPath(path);
+// addon.fromFS(ofFilePath::join(addonsPath, addonsToggles[i]),target);
+// project->addAddon(addon);
+//
+// }
+// }
+//
+//
+// addonsToggles = panelOtherAddons.getControlNames();
+// for (int i = 0; i < (int) addonsToggles.size(); i++){
+// ofxToggle toggle = panelOtherAddons.getToggle(addonsToggles[i]);
+// if(toggle){
+// ofAddon addon;
+//
+// addon.pathToOF = getOFRelPath(path);
+// cout << getOFRelPath(path) << " " << path << endl;
+// addon.fromFS(ofFilePath::join(addonsPath, addonsToggles[i]),target);
+// project->addAddon(addon);
+//
+// }
+// }
+//
+// project->save(true);
+// }
+// }
+//
+//
+// printf("done with project generation \n");
+// setStatus("generated: " + buttons[1].myText + "/" + buttons[0].myText);
+
+ // go through the control panels, do stuff
+}
+
+//--------------------------------------------------------------
+void generateProjects::keyReleased(int key){
+
+
+
+}
+
+//--------------------------------------------------------------
+void generateProjects::mouseMoved(int x, int y ){
+
+}
+
+//--------------------------------------------------------------
+void generateProjects::mouseDragged(int x, int y, int button){
+
+}
+
+//--------------------------------------------------------------
+void generateProjects::mousePressed(int x, int y, int button){
+
+ if (mode == MODE_NORMAL){
+
+
+ // check the mouse for press
+
+ for (int i = 0; i < buttons.size(); i++){
+ buttons[i].checkMousePressed(ofPoint(x, y));
+ }
+
+
+ //-------------------------------------
+ // 4 = genearate
+ //-------------------------------------
+
+
+ if (generateButton.bMouseOver == true){
+ generateExamples();
+ }
+
+
+
+ //-------------------------------------
+ // 0 = OF root
+ //-------------------------------------
+
+ if (buttons[0].bMouseOver == true){
+
+ string command = "";
+
+ ofDirectory dir( getOFRoot() );
+
+
+ #ifdef TARGET_WIN32
+ ofFileDialogResult res = ofSystemLoadDialog("please select OF root folder", true, windowsFromUnixPath(dir.path()));
+ #else
+ ofFileDialogResult res = ofSystemLoadDialog("please select OF root folder", true, dir.path());
+ #endif
+
+
+ if (res.bSuccess){
+ string result = res.filePath;
+ convertWindowsToUnixPath(result);
+ buttons[0].setText( result );
+ setStatus("path set to: " + result);
+ }
+
+
+ }
+
+
+ //-------------------------------------
+ // 1 = examples directory
+ //-------------------------------------
+
+ if (buttons[1].bMouseOver == true){
+
+ string command = "";
+
+ ofDirectory dir( ofFilePath::join(getOFRoot(), "examples" ));
+
+
+#ifdef TARGET_WIN32
+ ofFileDialogResult res = ofSystemLoadDialog("please select examples folder", true, windowsFromUnixPath(dir.path()));
+#else
+ ofFileDialogResult res = ofSystemLoadDialog("please select examples folder", true, dir.path());
+#endif
+
+
+ if (res.bSuccess){
+ string result = res.filePath;
+ convertWindowsToUnixPath(result);
+ buttons[1].setText( result );
+ examplesPath = result;
+ setStatus("path set to: " + result);
+ }
+ }
+
+
+ //-------------------------------------
+ // 2 = platform (disabled)
+ //-------------------------------------
+
+
+ if (buttons[2].bMouseOver == true){
+ // platform is diabled for now
+ mode = 2;
+ }
+
+ }
+
+ if (mode == MODE_PLATFORM){
+
+ }
+}
+
+//--------------------------------------------------------------
+void generateProjects::mouseReleased(int x, int y, int button){
+
+}
+
+//--------------------------------------------------------------
+void generateProjects::windowResized(int w, int h){
+ generateButton.topLeftAnchor.set(ofGetWidth() - buttons[0].rect.x - generateButton.rect.width + 10 ,
+ ofGetHeight() - generateButton.rect.height - 40);// 535);
+ generateButton.calculateRect();
+
+ addonButton.topLeftAnchor.set(ofGetWidth() - buttons[0].rect.x - addonButton.rect.width + 10 ,
+ ofGetHeight() - addonButton.rect.height - 40);// 535);
+ addonButton.calculateRect();
+
+}
+
+//--------------------------------------------------------------
+void generateProjects::gotMessage(ofMessage msg){
+
+}
+
+//--------------------------------------------------------------
+void generateProjects::dragEvent(ofDragInfo dragInfo){
+
+}
diff --git a/src/pages/generateProjects.h b/src/pages/generateProjects.h
new file mode 100644
index 0000000..184b180
--- /dev/null
+++ b/src/pages/generateProjects.h
@@ -0,0 +1,89 @@
+#pragma once
+
+
+#include "basePGPage.h"
+
+#include "ofMain.h"
+#include "CBLinuxProject.h"
+#include "CBWinProject.h"
+#include "visualStudioProject.h"
+#include "xcodeProject.h"
+#include
+
+#include "ofxGui.h"
+#include "ofAddon.h"
+#include "ofxXmlSettings.h"
+#include "textButton.h"
+
+
+
+class generateProjects : public basePGPage {
+
+ public:
+
+ void setup();
+ void update();
+ void draw();
+
+ void keyPressed (int key);
+ void keyReleased(int key);
+ void mouseMoved(int x, int y );
+ void mouseDragged(int x, int y, int button);
+ void mousePressed(int x, int y, int button);
+ void mouseReleased(int x, int y, int button);
+ void windowResized(int w, int h);
+ void dragEvent(ofDragInfo dragInfo);
+ void gotMessage(ofMessage msg);
+
+
+ string sketchName;
+ string sketchPath;
+ string addons;
+ string platform;
+ string examplesPath;
+
+ ofxPanel panelCoreAddons;
+ ofxPanel panelOtherAddons;
+ bool bHaveNonCoreAddons;
+
+ ofxPanel panelPlatforms;
+
+ ofxToggle osxToggle, iosToggle, wincbToggle, winvsToggle, linuxcbToggle, linux64cbToggle;
+
+ int mode;
+ enum { MODE_NORMAL, MODE_ADDON, MODE_PLATFORM };
+
+ baseProject * project;
+
+ string setupForTarget(int targ);
+
+ void generateProject();
+ void generateExamples();
+
+
+ string addonsPath;
+ string status;
+ string defaultLoc;
+
+ float uiLeftX;
+
+
+ textButton button;
+ textButton generateButton;
+ textButton addonButton;
+ textButton platformButton;
+
+ vector < textButton > buttons;
+
+ bool isAddonCore(string addon);
+ bool bInited;
+ vector < string > coreAddons;
+
+
+ float statusSetTime;
+ float statusEnergy;
+ void setStatus(string newStatus);
+
+ ofImage logo;
+
+};
diff --git a/src/pages/makeProjectsPGPage.cpp b/src/pages/makeProjectsPGPage.cpp
new file mode 100644
index 0000000..16cc377
--- /dev/null
+++ b/src/pages/makeProjectsPGPage.cpp
@@ -0,0 +1,376 @@
+#include "makeProjectsPGPage.h"
+#include "Utils.h"
+#include
+
+//--------------------------------------------------------------
+void makeProjectsPGPage::setup(){
+
+
+ // Sketch button
+ //
+
+ textButton button;
+
+ button.font = font;
+ button.secondFont = secondFont;
+ button.prefix = "Name: ";
+ button.topLeftAnchor.set(76, 160+40); //set top button position - others are set relative to this.
+ button.setText("");
+
+ button.secondaryText = "<< CLICK TO CHANGE THE NAME";
+ buttons.push_back(button);
+
+ // Path button
+ //
+ button.deliminater = "/";
+ button.prefix = "Path: ";
+ button.setText("");
+ button.secondaryText = "<< CLICK TO CHANGE THE DIRECTORY";
+ button.topLeftAnchor.set(button.topLeftAnchor.x, button.topLeftAnchor.y + button.rect.height + 20);
+ buttons.push_back(button);
+
+ // Platform text
+ //
+ button.deliminater = ", ";
+ button.prefix = "Platforms: ";
+ button.secondaryText = "";
+ button.bDrawLong = false;
+ button.secondaryText = "";
+ button.bSelectable = false;
+ button.setText("");
+
+ button.topLeftAnchor.set(button.topLeftAnchor.x, button.topLeftAnchor.y + button.rect.height + 20);
+ buttons.push_back(button);
+
+ // Addons button
+ //
+ button.deliminater = ", ";
+ button.bDrawLong = true;
+ button.prefix = "Addons: ";
+ button.secondaryText = "<< CLICK TO SELECT ADDONS";
+ button.bSelectable = true;
+ button.setText("");
+
+ button.topLeftAnchor.set(button.topLeftAnchor.x, button.topLeftAnchor.y + button.rect.height + 20);
+ buttons.push_back(button);
+
+
+
+
+ //ofSetLogLevel(OF_LOG_VERBOSE);
+ project = NULL;
+
+ while(!checkConfigExists()){
+ askOFRoot();
+ }
+
+ setOFRoot(getOFRootFromConfig());
+
+
+ int targ = ofGetTargetPlatform();
+ //plat = OF_TARGET_IPHONE;
+
+ setupForTarget(targ);
+ if(projectPath!="" || buildAllExamples){
+ for(int i = 0; i < (int)targetsToMake.size(); i++){
+ setupForTarget(targetsToMake[i]);
+ if(buildAllExamples){
+ generateExamples();
+ }else{
+ project->setup(target);
+ project->create(projectPath);
+ vector < string > addons;
+ parseAddonsDotMake(project->getPath() + "addons.make", addons);
+ for (int i = 0; i < (int)addons.size(); i++){
+ ofAddon addon;
+ addon.fromFS(ofFilePath::join(ofFilePath::join(getOFRoot(), "addons"), addons[i]),target);
+ project->addAddon(addon);
+ }
+ project->save(false);
+ }
+ }
+ std::exit(0);
+ }
+
+#ifndef COMMAND_LINE_ONLY
+
+
+
+
+ examplesPanel.setup("generate examples", "examples.xml", 400, 10);
+ examplesPanel.add(generateButton.setup("<--Generate"));
+ examplesPanel.add(wincbToggle.setup("win CB projects",ofGetTargetPlatform()==OF_TARGET_WINGCC));
+ examplesPanel.add(winvsToggle.setup("win VS projects", ofGetTargetPlatform()==OF_TARGET_WINVS));
+ examplesPanel.add(linuxcbToggle.setup("linux CB projects",ofGetTargetPlatform()==OF_TARGET_LINUX));
+ examplesPanel.add(linux64cbToggle.setup("linux64 CB projects",ofGetTargetPlatform()==OF_TARGET_LINUX64));
+ examplesPanel.add(linuxarmv6lcbToggle.setup("linuxarmv6l CB projects",ofGetTargetPlatform()==OF_TARGET_LINUXARMV6L));
+ examplesPanel.add(linuxarmv7lcbToggle.setup("linuxarmv7l CB projects",ofGetTargetPlatform()==OF_TARGET_LINUXARMV7L));
+ examplesPanel.add(osxToggle.setup("osx projects",ofGetTargetPlatform()==OF_TARGET_OSX));
+ examplesPanel.add(iosToggle.setup("ios projects",ofGetTargetPlatform()==OF_TARGET_IPHONE));
+
+ generateButton.addListener(this,&makeProjectsPGPage::generateExamplesCB);
+
+ ofSetVerticalSync(true);
+ ofEnableAlphaBlending();
+ ofSetFrameRate(60);
+#else
+ std::exit(0);
+#endif
+}
+
+void makeProjectsPGPage::setupForTarget(int targ){
+
+ if(project){
+ delete project;
+ }
+
+ switch(targ){
+ case OF_TARGET_OSX:
+ project = new xcodeProject;
+ target = "osx";
+ break;
+ case OF_TARGET_WINGCC:
+ project = new CBWinProject;
+ target = "win_cb";
+ break;
+ case OF_TARGET_WINVS:
+ project = new visualStudioProject;
+ target = "vs";
+ break;
+ case OF_TARGET_IPHONE:
+ project = new xcodeProject();
+ target = "ios";
+ break;
+ case OF_TARGET_ANDROID:
+ break;
+ case OF_TARGET_LINUX:
+ project = new CBLinuxProject;
+ target = "linux";
+ break;
+ case OF_TARGET_LINUX64:
+ project = new CBLinuxProject;
+ target = "linux64";
+ break;
+ case OF_TARGET_LINUXARMV6L:
+ project = new CBLinuxProject;
+ target = "linuxarmv6l";
+ break;
+ case OF_TARGET_LINUXARMV7L:
+ project = new CBLinuxProject;
+ target = "linuxarmv7l";
+ break;
+ }
+}
+
+void makeProjectsPGPage::generateExamplesCB(){
+
+#ifndef COMMAND_LINE_ONLY
+
+ targetsToMake.clear();
+ if( osxToggle ) targetsToMake.push_back(OF_TARGET_OSX);
+ if( iosToggle ) targetsToMake.push_back(OF_TARGET_IPHONE);
+ if( wincbToggle ) targetsToMake.push_back(OF_TARGET_WINGCC);
+ if( winvsToggle ) targetsToMake.push_back(OF_TARGET_WINVS);
+ if( linuxcbToggle ) targetsToMake.push_back(OF_TARGET_LINUX);
+ if( linux64cbToggle ) targetsToMake.push_back(OF_TARGET_LINUX64);
+ if( linuxarmv6lcbToggle ) targetsToMake.push_back(OF_TARGET_LINUXARMV6L);
+ if( linuxarmv7lcbToggle ) targetsToMake.push_back(OF_TARGET_LINUXARMV7L);
+
+ if( targetsToMake.size() == 0 ){
+ cout << "Error: generateExamplesCB - must specifiy a project to generate " <setup(target);
+ project->create(subdir.getPath(j));
+ vector < string > addons;
+ parseAddonsDotMake(project->getPath() + "addons.make", addons);
+ for (int i = 0; i < (int)addons.size(); i++){
+ ofAddon addon;
+ addon.pathToOF = getOFRelPath(subdir.getPath(j));
+ addon.fromFS(ofFilePath::join(ofFilePath::join(getOFRoot(), "addons"), addons[i]),target);
+ project->addAddon(addon);
+ }
+ project->save(false);
+
+ }
+ }
+ ofLogNotice() << " ";
+ ofLogNotice() << "Finished generating examples for " << target;
+}
+
+
+
+
+//--------------------------------------------------------------
+void makeProjectsPGPage::update(){
+
+ for (int i = 0; i < buttons.size(); i++){
+ if (i != 0){
+ buttons[i].topLeftAnchor.y = buttons[i-1].topLeftAnchor.y +buttons[i-1].rect.height + 20;
+ }
+ }
+
+
+}
+
+//--------------------------------------------------------------
+void makeProjectsPGPage::draw(){
+
+#ifndef COMMAND_LINE_ONLY
+ //ofBackgroundGradient(ofColor::gray,ofColor::black);
+
+ panelOptions.draw();
+ examplesPanel.draw();
+
+ ofSetColor(0,0,0,100);
+
+ ofRect(ofPathRect);
+
+ /*ofDrawBitmapString("press 'm' to make all files\npress ' ' to make a specific file", ofPoint(30,30));*/
+ ofSetColor(255);
+ ofDrawBitmapString(drawableOfPath, ofPathDrawPoint);
+#endif
+
+
+
+ for (int i = 0; i < buttons.size(); i++){
+ buttons[i].draw();
+ }
+
+}
+
+//--------------------------------------------------------------
+void makeProjectsPGPage::keyPressed(int key){
+
+
+}
+
+//--------------------------------------------------------------
+void makeProjectsPGPage::keyReleased(int key){
+
+}
+
+//--------------------------------------------------------------
+void makeProjectsPGPage::mouseMoved(int x, int y ){
+
+}
+
+//--------------------------------------------------------------
+void makeProjectsPGPage::mouseDragged(int x, int y, int button){
+
+}
+
+//--------------------------------------------------------------
+void makeProjectsPGPage::mousePressed(int x, int y, int button){
+
+}
+
+//--------------------------------------------------------------
+void makeProjectsPGPage::mouseReleased(int x, int y, int button){
+
+}
+
+//--------------------------------------------------------------
+void makeProjectsPGPage::windowResized(int w, int h){
+
+}
+
+//--------------------------------------------------------------
+void makeProjectsPGPage::gotMessage(ofMessage msg){
+
+}
+
+//--------------------------------------------------------------
+void makeProjectsPGPage::dragEvent(ofDragInfo dragInfo){
+
+}
+//
+////--------------------------------------------------------------
+//void makeProjectsPGPage::setupDrawableOFPath(){
+//
+//#ifndef COMMAND_LINE_ONLY
+// vector subdirs = ofSplitString("OF path: " + getOFRoot(), "/");
+// int textLength = 0;
+// int padding = 5;
+// string path = "";
+// int lines=1;
+// int fontSize = 8;
+// float leading = 1.7;
+//
+// ofPathRect.x = padding;
+// ofPathRect.y = padding;
+// ofPathDrawPoint.x = padding*2;
+// ofPathDrawPoint.y = padding*2 + fontSize * leading;
+//
+// for(int i = 0; i < subdirs.size(); i++) {
+// if (i > 0 && i 1){
+// ofPathRect.width = ofGetWidth() - padding*2;
+// }
+// ofPathRect.height = lines * fontSize * leading + (padding*2);
+//
+// drawableOfPath = path;
+//
+// examplesPanel.setPosition(examplesPanel.getPosition().x, ofPathRect.y + ofPathRect.height + padding);
+//#endif
+//
+//
+//}
diff --git a/src/pages/makeProjectsPGPage.h b/src/pages/makeProjectsPGPage.h
new file mode 100644
index 0000000..ef2a4a8
--- /dev/null
+++ b/src/pages/makeProjectsPGPage.h
@@ -0,0 +1,67 @@
+#pragma once
+
+//#define COMMAND_LINE_ONLY
+
+#include "ofMain.h"
+#include "basePGPage.h"
+
+#include "CBLinuxProject.h"
+#include "CBWinProject.h"
+#include "visualStudioProject.h"
+#include "xcodeProject.h"
+#include
+
+#ifndef COMMAND_LINE_ONLY
+#include "ofxGui.h"
+#endif
+
+#include "textButton.h"
+
+class makeProjectsPGPage : public basePGPage {
+
+ public:
+ void setup();
+ void update();
+ void draw();
+
+ void keyPressed (int key);
+ void keyReleased(int key);
+ void mouseMoved(int x, int y );
+ void mouseDragged(int x, int y, int button);
+ void mousePressed(int x, int y, int button);
+ void mouseReleased(int x, int y, int button);
+ void windowResized(int w, int h);
+ void dragEvent(ofDragInfo dragInfo);
+ void gotMessage(ofMessage msg);
+
+ void setupForTarget(int targ);
+ void generateExamplesCB();
+ void generateExamples();
+
+
+
+ // new:
+ vector < textButton > buttons;
+
+
+
+ baseProject * project;
+
+ string projectPath;
+ string target;
+ vector targetsToMake;
+ bool buildAllExamples;
+
+#ifndef COMMAND_LINE_ONLY
+ string drawableOfPath;
+ ofRectangle ofPathRect;
+ ofPoint ofPathDrawPoint;
+
+ ofxPanel panelOptions;
+ ofxButton createProject, updateProject, createAndOpen, changeOFRoot;
+
+ ofxPanel examplesPanel;
+ ofxToggle osxToggle, iosToggle, wincbToggle, winvsToggle, linuxcbToggle, linux64cbToggle,linuxarmv6lcbToggle,linuxarmv7lcbToggle;
+ ofxButton generateButton;
+#endif
+};
diff --git a/src/pages/simplePGPage.cpp b/src/pages/simplePGPage.cpp
new file mode 100644
index 0000000..5fe173f
--- /dev/null
+++ b/src/pages/simplePGPage.cpp
@@ -0,0 +1,685 @@
+#include "simplePGPage.h"
+#include "Utils.h"
+#include
+#include "ofConstants.h"
+
+
+//------------------------------------------------------
+bool simplePGPage::isAddonCore(string addon){
+
+
+ if (bInited == false){
+ coreAddons.push_back("ofx3DModelLoader");
+ coreAddons.push_back("ofxAssimpModelLoader");
+ coreAddons.push_back("ofxDirList");
+ coreAddons.push_back("ofxNetwork");
+ coreAddons.push_back("ofxOpenCv");
+ coreAddons.push_back("ofxOsc");
+ coreAddons.push_back("ofxThread");
+ coreAddons.push_back("ofxThreadedImageLoader");
+ coreAddons.push_back("ofxVectorGraphics");
+ coreAddons.push_back("ofxVectorMath");
+ coreAddons.push_back("ofxXmlSettings");
+ coreAddons.push_back("ofxSvg");
+ coreAddons.push_back("ofxGui");
+ coreAddons.push_back("ofxKinect");
+ bInited = true;
+ }
+
+
+ for (int i = 0; i < coreAddons.size(); i++){
+ if (coreAddons[i] == addon){
+ return true;
+ }
+ }
+ return false;
+}
+
+
+
+
+//------------------------------------------------------
+string simplePGPage::setupForTarget(int targ){
+
+ if(project){
+ delete project;
+ }
+ string target;
+ switch(targ){
+ case OF_TARGET_OSX:
+ project = new xcodeProject;
+ target = "osx";
+ break;
+ case OF_TARGET_WINGCC:
+ project = new CBWinProject;
+ target = "win_cb";
+ break;
+ case OF_TARGET_WINVS:
+ project = new visualStudioProject;
+ target = "vs";
+ break;
+ case OF_TARGET_IPHONE:
+ project = new xcodeProject();
+ target = "ios";
+ break;
+ case OF_TARGET_ANDROID:
+ break;
+ case OF_TARGET_LINUX64:
+ project = new CBLinuxProject;
+ target = "linux64";
+ break;
+ case OF_TARGET_LINUX:
+ project = new CBLinuxProject;
+ target = "linux";
+ break;
+ }
+
+ project->setup(target);
+
+ return target;
+}
+
+
+
+void simplePGPage::setStatus(string newStatus){
+ statusEnergy = 1;
+ status = newStatus;
+ statusSetTime = ofGetElapsedTimef();
+}
+
+
+
+//--------------------------------------------------------------
+void simplePGPage::setup(){
+ ofEnableAlphaBlending();
+ ofEnableSmoothing();
+ ofSetLogLevel(OF_LOG_VERBOSE);
+ ofSetVerticalSync(true);
+
+
+ statusEnergy = 0;
+
+ mode = 0;
+ bInited = false;
+ project = NULL;
+ sketchName = "mySketch";
+
+
+
+ //-------------------------------------
+ // calculate the bin path (../../../ on osx) and the sketch path (bin -> root - > defaultLoc)
+ //-------------------------------------
+
+ // if appToRoot is wrong, we have alot of issues. all these paths are used in this project:
+
+#ifdef TARGET_OSX
+ string binPath = ofFilePath::getAbsolutePath(ofFilePath::join(ofFilePath::getCurrentWorkingDirectory(), "../../../"));
+#else
+ string binPath = ofFilePath::getCurrentExeDir();
+#endif
+
+ string ofRoot = ofFilePath::getAbsolutePath(ofFilePath::join(binPath, settings.appRoot));
+
+ addonsPath = ofFilePath::getAbsolutePath(ofFilePath::join(ofRoot,"addons"));
+ sketchPath = ofFilePath::getAbsolutePath(ofFilePath::join(ofRoot, settings.defaultNewProjectLocation));
+
+
+
+
+ convertWindowsToUnixPath(ofRoot);
+ convertWindowsToUnixPath(addonsPath);
+ convertWindowsToUnixPath(sketchPath);
+
+ // there's some issues internally in OF with non unix paths for OF root
+ setOFRoot(ofRoot);
+
+ //-------------------------------------
+ // get settings
+ //-------------------------------------
+
+
+
+ // Sketch button
+ //
+ button.setup(font, secondFont, "Name: ", sketchName, "<< CLICK TO CHANGE THE NAME", ofPoint(76, 160+40));
+ buttons.push_back(button);
+
+ // Path button
+ //
+ button.setup(font, secondFont, "Path: ", sketchPath, "<< CLICK TO CHANGE THE DIRECTORY", ofPoint(76, button.topLeftAnchor.y + button.rect.height + 20), "/");
+ buttons.push_back(button);
+
+ // Platform text
+ //
+ button.deliminater = ", ";
+ button.prefix = "Platforms: ";
+ button.secondaryText = "";
+ button.bDrawLong = false;
+ button.secondaryText = "";
+ button.bSelectable = settings.multiplatform == true;
+ button.setText(platform);
+
+ button.topLeftAnchor.set(button.topLeftAnchor.x, button.topLeftAnchor.y + button.rect.height + 20);
+ buttons.push_back(button);
+
+ // Addons button
+ //
+ button.deliminater = ", ";
+ button.bDrawLong = true;
+ button.prefix = "Addons: ";
+ button.secondaryText = "<< CLICK TO SELECT ADDONS";
+ button.bSelectable = true;
+ button.setText(addons);
+
+ button.topLeftAnchor.set(button.topLeftAnchor.x, button.topLeftAnchor.y + button.rect.height + 20);
+ buttons.push_back(button);
+
+ // Generate
+ //
+ generateButton = button;
+ generateButton.topLeftAnchor.set(906, 535);
+ //generateButton.setColor(ofColor(50, 150, 255));
+ generateButton.deliminater = ",";
+ generateButton.prefix = "GENERATE PROJECT";
+ generateButton.bSelectable = true;
+ generateButton.setText("");
+ generateButton.bDrawLong = false;
+
+ addonButton = button;
+ addonButton.topLeftAnchor.set(906, 535);
+ addonButton.prefix = "<< BACK";
+ addonButton.setText("");
+ addonButton.bDrawLong = false;
+
+ platformButton = button;
+ platformButton.topLeftAnchor.set(906, 535);
+ platformButton.prefix = "<< BACK";
+ platformButton.setText("");
+ platformButton.bDrawLong = false;
+
+
+ for (int i = 0; i < buttons.size(); i++){
+ buttons[i].calculateRect();
+ }
+ addonButton.calculateRect();
+ generateButton.calculateRect();
+ platformButton.calculateRect();
+
+ //-------------------------------------
+ // addons panels:
+ //-------------------------------------
+
+ panelCoreAddons.setup();
+ panelOtherAddons.setup();
+
+ ofDirectory addons(addonsPath);
+
+ addons.listDir();
+ for(int i=0;i<(int)addons.size();i++){
+ string addon = addons.getName(i);
+
+ if(addon.find("ofx")==0){
+
+ if (isAddonCore(addon)){
+ ofxToggle * toggle = new ofxToggle();
+ panelCoreAddons.add(toggle->setup(addon,false,300));
+ } else {
+ bHaveNonCoreAddons = true;
+ ofxToggle * toggle = new ofxToggle();
+ panelOtherAddons.add(toggle->setup(addon,false,300));
+ }
+
+
+ }
+ }
+
+ //-------------------------------------
+ // platform panel (not used, really, but here just in case)
+ //-------------------------------------
+ panelPlatforms.setup();
+ panelPlatforms.add(wincbToggle.setup("windows (codeblocks)",ofGetTargetPlatform()==OF_TARGET_WINGCC));
+ panelPlatforms.add(winvsToggle.setup("windows (visual studio)", ofGetTargetPlatform()==OF_TARGET_WINVS));
+ panelPlatforms.add(linuxcbToggle.setup("linux (codeblocks)",ofGetTargetPlatform()==OF_TARGET_LINUX));
+ panelPlatforms.add(linux64cbToggle.setup("linux64 (codeblocks)",ofGetTargetPlatform()==OF_TARGET_LINUX64));
+
+//for ios, we need to fake that the target is ios (since we're compiling w/ osx OF)
+
+//#define MAKE_IOS
+
+#ifdef MAKE_IOS
+ panelPlatforms.add(osxToggle.setup("osx (xcode)",false));
+ panelPlatforms.add(iosToggle.setup("ios (xcode)",true));
+#else
+ panelPlatforms.add(osxToggle.setup("osx (xcode)",ofGetTargetPlatform()==OF_TARGET_OSX));
+ panelPlatforms.add(iosToggle.setup("ios (xcode)",ofGetTargetPlatform()==OF_TARGET_IPHONE));
+#endif
+
+
+ // update the platforms text in the platform button
+ string platforms = "";
+ for (int i = 0; i < panelPlatforms.getNumControls(); i++){
+ if (*((ofxToggle *)panelPlatforms.getControl(i))){
+ if (platforms.length() > 0) platforms+=", ";
+ platforms += ((ofxToggle *)panelPlatforms.getControl(i))->getName();
+
+ };
+ }
+ buttons[2].setText(platforms);
+
+
+ panelPlatforms.setPosition(10,40);
+ panelCoreAddons.setPosition(10,40);
+ panelOtherAddons.setPosition(330,40);
+
+
+ logo.loadImage("images/ofw-logo.png");
+
+ ofBackground(230,230,230);
+
+
+ generateButton.topLeftAnchor.set(ofGetWidth() - buttons[0].rect.x - generateButton.rect.width + 10 ,
+ ofGetHeight() - generateButton.rect.height - 40);// 535);
+ generateButton.calculateRect();
+
+ addonButton.topLeftAnchor.set(ofGetWidth() - buttons[0].rect.x - addonButton.rect.width + 10 ,
+ ofGetHeight() - addonButton.rect.height - 40);// 535);
+ addonButton.calculateRect();
+
+}
+
+
+
+
+
+
+//--------------------------------------------------------------
+void simplePGPage::update(){
+
+ float diff = ofGetElapsedTimef()- statusSetTime;
+ if (diff > 3){
+ statusEnergy *= 0.99;;
+ }
+ //-------------------------------------
+ // if we are in addon mode check
+ //-------------------------------------
+
+ if (mode == MODE_ADDON ) addonButton.checkMousePressed(ofPoint(ofGetMouseX(), ofGetMouseY()));
+ if (mode == MODE_PLATFORM) platformButton.checkMousePressed(ofPoint(ofGetMouseX(), ofGetMouseY()));
+
+
+ //-------------------------------------
+ // layout our normal buttons, check the mouse
+ //-------------------------------------
+
+ for (int i = 0; i < buttons.size(); i++){
+ buttons[i].calculateRect();
+ buttons[i].checkMousePressed(ofPoint(ofGetMouseX(), ofGetMouseY()));
+ }
+
+ generateButton.checkMousePressed(ofPoint(ofGetMouseX(), ofGetMouseY()));
+
+ for (int i = 0; i < buttons.size(); i++){
+ if (i != 0){
+ buttons[i].topLeftAnchor.y = buttons[i-1].topLeftAnchor.y +buttons[i-1].rect.height + 20;
+ }
+ }
+
+
+ //-------------------------------------
+ // addons panels can be really long, so use the mouse pos to move them if we need to
+ //-------------------------------------
+
+ if (panelCoreAddons.getShape().height > ofGetHeight()){
+ float pct = ofMap(ofGetMouseY(), 0,ofGetHeight(), 0,1,true);
+ float diff = panelCoreAddons.getShape().height - ofGetHeight();
+ panelCoreAddons.setPosition(panelCoreAddons.getPosition().x,-diff * pct);
+ }
+
+ if (panelOtherAddons.getShape().height > ofGetHeight()){
+ float pct = ofMap(ofGetMouseY(), 0,ofGetHeight(), 0,1,true);
+ float diff = panelOtherAddons.getShape().height - ofGetHeight();
+ panelOtherAddons.setPosition(panelOtherAddons.getPosition().x,-diff * pct);
+ }
+
+}
+
+//--------------------------------------------------------------
+void simplePGPage::draw(){
+
+
+
+ if (mode != MODE_ADDON ) {
+
+ ofSetColor(100);
+ logo.draw(64, 61,logo.getWidth(),logo.getHeight());
+
+ //ofSetColor(74,255,203);
+ titleFont->drawString("PROJECT", 64 + logo.getWidth() + 25, 85);
+ titleFont->drawString("GENERATOR", 64 + logo.getWidth() + 25, 117);
+ }
+
+ if (mode == 0){
+ for (int i = 0; i < buttons.size(); i++){
+ buttons[i].draw();
+ }
+
+ generateButton.draw();
+
+ } else if (mode == 1){
+ panelCoreAddons.draw();
+ if (bHaveNonCoreAddons){
+ panelOtherAddons.draw();
+ }
+ } else if (mode == 2){
+ panelPlatforms.draw();
+ }
+ //cout << panelAddons.getShape().height << endl;
+
+
+
+
+ if (mode == MODE_ADDON ){
+ addonButton.draw();
+
+ ofRectangle rect = secondFont->getStringBoundingBox("select core and non-core addons to add", addonButton.topLeftAnchor.x-200, 60);
+ ofSetColor(220,220,220);
+ ofRect(rect.x-10, rect.y-10, rect.width+20, rect.height+20);
+ ofSetColor(0,0,0);
+ secondFont->drawString("select core and non-core addons to add", addonButton.topLeftAnchor.x-200, 60);
+ }
+
+
+ if (mode == MODE_PLATFORM){
+ panelPlatforms.draw();
+ platformButton.draw();
+ }
+
+
+ if (mode == 0){
+ ofFill();
+ ofSetColor(0 + 220 * (1-statusEnergy),0 + 220 * (1-statusEnergy),0 + 220 * (1-statusEnergy));
+ ofRect(0,ofGetHeight(), ofGetWidth(), -25);
+ ofSetColor(255,255,255, 255 * statusEnergy);
+ ofDrawBitmapString(status, 10,ofGetHeight()-8);
+ }
+}
+
+//--------------------------------------------------------------
+void simplePGPage::keyPressed(int key){
+
+ if (key == ' '){
+
+ //printf("%s -------- \n", ResultBuffer);
+ //std::exit(0);
+ }
+
+
+}
+
+void simplePGPage::generateProject(){
+
+ vector targetsToMake;
+ if( osxToggle ) targetsToMake.push_back(OF_TARGET_OSX);
+ if( iosToggle ) targetsToMake.push_back(OF_TARGET_IPHONE);
+ if( wincbToggle ) targetsToMake.push_back(OF_TARGET_WINGCC);
+ if( winvsToggle ) targetsToMake.push_back(OF_TARGET_WINVS);
+ if( linuxcbToggle ) targetsToMake.push_back(OF_TARGET_LINUX);
+ if( linux64cbToggle ) targetsToMake.push_back(OF_TARGET_LINUX64);
+
+ if( targetsToMake.size() == 0 ){
+ cout << "Error: makeNewProjectViaDialog - must specifiy a project to generate " <create(path)){
+ vector addonsToggles = panelCoreAddons.getControlNames();
+ for (int i = 0; i < (int) addonsToggles.size(); i++){
+ ofxToggle toggle = panelCoreAddons.getToggle(addonsToggles[i]);
+ if(toggle){
+ ofAddon addon;
+ addon.pathToOF = getOFRelPath(path);
+ addon.fromFS(ofFilePath::join(addonsPath, addonsToggles[i]),target);
+ project->addAddon(addon);
+
+ }
+ }
+
+
+ addonsToggles = panelOtherAddons.getControlNames();
+ for (int i = 0; i < (int) addonsToggles.size(); i++){
+ ofxToggle toggle = panelOtherAddons.getToggle(addonsToggles[i]);
+ if(toggle){
+ ofAddon addon;
+
+ addon.pathToOF = getOFRelPath(path);
+ cout << getOFRelPath(path) << " " << path << endl;
+ addon.fromFS(ofFilePath::join(addonsPath, addonsToggles[i]),target);
+ project->addAddon(addon);
+
+ }
+ }
+
+ project->save(true);
+ }
+ }
+
+
+ printf("done with project generation \n");
+ setStatus("generated: " + buttons[1].myText + "/" + buttons[0].myText);
+
+ // go through the control panels, do stuff
+}
+
+//--------------------------------------------------------------
+void simplePGPage::keyReleased(int key){
+
+
+
+}
+
+//--------------------------------------------------------------
+void simplePGPage::mouseMoved(int x, int y ){
+
+}
+
+//--------------------------------------------------------------
+void simplePGPage::mouseDragged(int x, int y, int button){
+
+}
+
+//--------------------------------------------------------------
+void simplePGPage::mousePressed(int x, int y, int button){
+
+ if (mode == MODE_NORMAL){
+
+
+ // check the mouse for press
+
+ for (int i = 0; i < buttons.size(); i++){
+ buttons[i].checkMousePressed(ofPoint(x, y));
+ }
+
+
+ //-------------------------------------
+ // 4 = genearate
+ //-------------------------------------
+
+
+ if (generateButton.bMouseOver == true){
+ generateProject();
+ }
+
+ //-------------------------------------
+ // 0 = sketch name
+ //-------------------------------------
+
+ if (buttons[0].bMouseOver == true){
+ string text = ofSystemTextBoxDialog("choose sketch name", buttons[0].myText);
+ fixStringCharacters(text);
+ setStatus("sketch name set to: " + text);
+ buttons[0].setText(text);
+ }
+
+ //-------------------------------------
+ // 1 = sketch path
+ //-------------------------------------
+
+ if (buttons[1].bMouseOver == true){
+
+ string command = "";
+
+ ofDirectory dir(ofFilePath::join(getOFRoot(),defaultLoc));
+
+ if (!dir.exists()){
+ dir.create();
+ }
+
+
+ #ifdef TARGET_WIN32
+ ofFileDialogResult res = ofSystemLoadDialog("please select sketch folder", true, windowsFromUnixPath(dir.path()));
+ #else
+ ofFileDialogResult res = ofSystemLoadDialog("please select sketch folder", true, dir.path());
+ #endif
+
+
+ if (res.bSuccess){
+ string result = res.filePath;
+ convertWindowsToUnixPath(result);
+ buttons[1].setText( result );
+
+ setStatus("path set to: " + result);
+ }
+
+
+ }
+
+
+ //-------------------------------------
+ // 2 = platform (disabled)
+ //-------------------------------------
+
+
+ if (buttons[2].bMouseOver == true){
+ // platform is diabled for now
+ mode = MODE_PLATFORM;
+ }
+
+ //-------------------------------------
+ // 3 = addon
+ //-------------------------------------
+
+ if (buttons[3].bMouseOver == true){
+ mode = MODE_ADDON;
+
+ }
+ }
+
+ //-------------------------------------
+ // handle addon mode
+ //-------------------------------------
+
+ if (mode == MODE_ADDON ){
+
+ //-------------------------------------
+ // if we hit he back button, collect the addons for display
+ //-------------------------------------
+
+ if (addonButton.bMouseOver){
+
+ string addons = "";
+
+ for (int i = 0; i < panelCoreAddons.getNumControls(); i++){
+ if (*((ofxToggle *)panelCoreAddons.getControl(i))){
+ if (addons.length() > 0) addons+=", ";
+ addons += ((ofxToggle *)panelCoreAddons.getControl(i))->getName();
+
+ }
+
+ }
+ for (int i = 0; i < panelOtherAddons.getNumControls(); i++){
+ if (*((ofxToggle *)panelOtherAddons.getControl(i))){
+ if (addons.length() > 0) addons+=", ";
+ addons += ((ofxToggle *)panelOtherAddons.getControl(i))->getName();
+
+ }
+
+ }
+ buttons[3].setText(addons);
+
+ setStatus("addons set to: " + addons);
+
+ addonButton.bMouseOver = false;
+ mode = MODE_NORMAL;
+ }
+ }
+
+ if (mode == MODE_PLATFORM){
+
+ if (platformButton.bMouseOver){
+
+ string platforms = "";
+
+ for (int i = 0; i < panelPlatforms.getNumControls(); i++){
+ if (*((ofxToggle *)panelPlatforms.getControl(i))){
+ if (platforms.length() > 0) platforms+=", ";
+ platforms += ((ofxToggle *)panelPlatforms.getControl(i))->getName();
+
+ }
+
+ }
+
+ buttons[2].setText(platforms);
+
+ setStatus("platforms set to: " + platforms);
+
+ platformButton.bMouseOver = false;
+ mode = MODE_NORMAL;
+
+ }
+ }
+}
+
+//--------------------------------------------------------------
+void simplePGPage::mouseReleased(int x, int y, int button){
+
+}
+
+//--------------------------------------------------------------
+void simplePGPage::windowResized(int w, int h){
+ generateButton.topLeftAnchor.set(ofGetWidth() - buttons[0].rect.x - generateButton.rect.width + 10 ,
+ ofGetHeight() - generateButton.rect.height - 40);// 535);
+ generateButton.calculateRect();
+
+ addonButton.topLeftAnchor.set(ofGetWidth() - buttons[0].rect.x - addonButton.rect.width + 10 ,
+ ofGetHeight() - addonButton.rect.height - 40);// 535);
+ addonButton.calculateRect();
+
+ platformButton.topLeftAnchor.set(ofGetWidth() - buttons[0].rect.x - addonButton.rect.width + 10 ,
+ ofGetHeight() - addonButton.rect.height - 40);// 535);
+ platformButton.calculateRect();
+
+}
+
+//--------------------------------------------------------------
+void simplePGPage::gotMessage(ofMessage msg){
+
+}
+
+//--------------------------------------------------------------
+void simplePGPage::dragEvent(ofDragInfo dragInfo){
+
+}
diff --git a/src/pages/simplePGPage.h b/src/pages/simplePGPage.h
new file mode 100644
index 0000000..94eb058
--- /dev/null
+++ b/src/pages/simplePGPage.h
@@ -0,0 +1,91 @@
+#pragma once
+
+
+#include "basePGPage.h"
+
+#include "ofMain.h"
+#include "CBLinuxProject.h"
+#include "CBWinProject.h"
+#include "visualStudioProject.h"
+#include "xcodeProject.h"
+#include
+
+#include "ofxGui.h"
+#include "ofAddon.h"
+#include "ofxXmlSettings.h"
+#include "textButton.h"
+
+
+
+class simplePGPage : public basePGPage {
+
+ public:
+
+ void setup();
+ void update();
+ void draw();
+
+ void keyPressed (int key);
+ void keyReleased(int key);
+ void mouseMoved(int x, int y );
+ void mouseDragged(int x, int y, int button);
+ void mousePressed(int x, int y, int button);
+ void mouseReleased(int x, int y, int button);
+ void windowResized(int w, int h);
+ void dragEvent(ofDragInfo dragInfo);
+ void gotMessage(ofMessage msg);
+
+
+ string sketchName;
+ string sketchPath;
+ string addons;
+ string platform;
+
+ ofxPanel panelCoreAddons;
+ ofxPanel panelOtherAddons;
+ bool bHaveNonCoreAddons;
+
+ ofxPanel panelPlatforms;
+
+ ofxToggle osxToggle, iosToggle, wincbToggle, winvsToggle, linuxcbToggle, linux64cbToggle;
+
+
+ int mode;
+ enum { MODE_NORMAL, MODE_ADDON, MODE_PLATFORM };
+
+ baseProject * project;
+
+ string setupForTarget(int targ);
+
+ void generateProject();
+
+ string addonsPath;
+ string status;
+
+ string appToRoot;
+ string defaultLoc;
+
+ float uiLeftX;
+
+
+ textButton button;
+ textButton generateButton;
+ textButton addonButton;
+ textButton platformButton;
+
+
+
+ vector < textButton > buttons;
+
+ bool isAddonCore(string addon);
+ bool bInited;
+ vector < string > coreAddons;
+
+
+ float statusSetTime;
+ float statusEnergy;
+ void setStatus(string newStatus);
+
+ ofImage logo;
+
+};
diff --git a/src/projects/xcodeProject.cpp b/src/projects/xcodeProject.cpp
index b1af746..cf559f4 100644
--- a/src/projects/xcodeProject.cpp
+++ b/src/projects/xcodeProject.cpp
@@ -749,7 +749,6 @@ void xcodeProject::addInclude(string includeName){
} else {
//printf("we don't have HEADER_SEARCH_PATHS, so we're adding them... and calling this function again \n");
- query[255];
sprintf(query, "//key[contains(.,'baseConfigurationReference')]/parent::node()//key[contains(.,'buildSettings')]/following-sibling::node()[1]");
pugi::xpath_node_set dictArray = doc.select_nodes(query);
diff --git a/src/testApp.cpp b/src/testApp.cpp
index 8fe20c5..ddc2deb 100644
--- a/src/testApp.cpp
+++ b/src/testApp.cpp
@@ -3,527 +3,93 @@
#include
#include "ofConstants.h"
-void convertWindowsToUnixPath(string & path){
- for (int i = 0; i < path.size(); i++){
- if (path[i] == '\\') path[i] = '/';
- }
-}
-
-string windowsFromUnixPath(string path){
- for (int i = 0; i < path.size(); i++){
- if (path[i] == '/') path[i] = '\\';
- }
- return path;
-}
-
-//------------------------------------------------------
-bool testApp::isAddonCore(string addon){
-
-
- if (bInited == false){
- coreAddons.push_back("ofx3DModelLoader");
- coreAddons.push_back("ofxAssimpModelLoader");
- coreAddons.push_back("ofxDirList");
- coreAddons.push_back("ofxNetwork");
- coreAddons.push_back("ofxOpenCv");
- coreAddons.push_back("ofxOsc");
- coreAddons.push_back("ofxThread");
- coreAddons.push_back("ofxThreadedImageLoader");
- coreAddons.push_back("ofxVectorGraphics");
- coreAddons.push_back("ofxVectorMath");
- coreAddons.push_back("ofxXmlSettings");
- coreAddons.push_back("ofxSvg");
- coreAddons.push_back("ofxGui");
- coreAddons.push_back("ofxKinect");
- bInited = true;
- }
-
-
-
- for (int i = 0; i < coreAddons.size(); i++){
-
- if (coreAddons[i] == addon){
- return true;
- }
- }
- return false;
-}
-
-//------------------------------------------------------
-// for project names, let's fix replace any odd characters with _
-void fixStringCharacters(string &toFix){
- // replace all non alpha numeric (ascii) characters with _
- for (int i = 0; i < toFix.size(); i++){
- int which = (int)toFix[i];
- if ((which >= 48 && which <= 57) ||
- (which >= 65 && which <= 90) ||
- (which >= 97 && which <= 122)){
- } else {
- toFix[i] = '_';
- }
- }
-}
-
-
-
-//------------------------------------------------------
-string testApp::setupForTarget(int targ){
-
- if(project){
- delete project;
- }
- string target;
- switch(targ){
- case OF_TARGET_OSX:
- project = new xcodeProject;
- target = "osx";
- break;
- case OF_TARGET_WINGCC:
- project = new CBWinProject;
- target = "win_cb";
- break;
- case OF_TARGET_WINVS:
- project = new visualStudioProject;
- target = "vs";
- break;
- case OF_TARGET_IPHONE:
- project = new xcodeProject();
- target = "ios";
- break;
- case OF_TARGET_ANDROID:
- break;
- case OF_TARGET_LINUX64:
- project = new CBLinuxProject;
- target = "linux64";
- break;
- case OF_TARGET_LINUX:
- project = new CBLinuxProject;
- target = "linux";
- break;
- }
-
- project->setup(target);
-
- return target;
-}
-
-
-
-void testApp::setStatus(string newStatus){
- statusEnergy = 1;
- status = newStatus;
- statusSetTime = ofGetElapsedTimef();
-}
//--------------------------------------------------------------
void testApp::setup(){
- ofEnableAlphaBlending();
- ofEnableSmoothing();
- ofSetLogLevel(OF_LOG_VERBOSE);
- ofSetVerticalSync(true);
-
- statusEnergy = 0;
+ mode = MODE_SIMPLE;
+
- mode = 0;
- bInited = false;
- project = NULL;
- sketchName = "mySketch";
-
-
- //-------------------------------------
- // get settings
- //-------------------------------------
-
- XML.loadFile("settings/projectGeneratorSettings.xml");
- appToRoot = XML.getValue("appToRoot", "../../../../");
- defaultLoc = XML.getValue("defaultNewProjectLocation", "apps/myApps");
- //-------------------------------------
- // calculate the bin path (../../../ on osx) and the sketch path (bin -> root - > defaultLoc)
- //-------------------------------------
-
- // if appToRoot is wrong, we have alot of issues. all these paths are used in this project:
-
-#ifdef TARGET_OSX
- string binPath = ofFilePath::getAbsolutePath(ofFilePath::join(ofFilePath::getCurrentWorkingDirectory(), "../../../"));
-#else
- string binPath = ofFilePath::getCurrentExeDir();
-#endif
-
- string ofRoot = ofFilePath::getAbsolutePath(ofFilePath::join(binPath, appToRoot));
-
- addonsPath = ofFilePath::getAbsolutePath(ofFilePath::join(ofRoot,"addons"));
- sketchPath = ofFilePath::getAbsolutePath(ofFilePath::join(ofRoot, defaultLoc));
-
-
- convertWindowsToUnixPath(ofRoot);
- convertWindowsToUnixPath(addonsPath);
- convertWindowsToUnixPath(sketchPath);
-
- // there's some issues internally in OF with non unix paths for OF root
- setOFRoot(ofRoot);
-
-
-
- //-------------------------------------
- // get settings
- //-------------------------------------
-
-
//-------------------------------------
- // load font and setup the buttons
+ // load fonts
+
font.loadFont("fonts/Inconsolata.otf", 14, true,false,false,0.3,90);
titleFont.loadFont("fonts/Inconsolata.otf", 28, true,false,false,0.3,90);
secondFont.loadFont("fonts/Inconsolata.otf", 11, true,false,false,0.3,90);
- // Sketch button
- //
- button.font = &font;
- button.secondFont = &secondFont;
- button.prefix = "Name: ";
- button.topLeftAnchor.set(76, 160+40); //set top button position - others are set relative to this.
- button.setText(sketchName);
-
- button.secondaryText = "<< CLICK TO CHANGE THE NAME";
- buttons.push_back(button);
-
- // Path button
- //
- button.deliminater = "/";
- button.prefix = "Path: ";
- button.setText(sketchPath);
- button.secondaryText = "<< CLICK TO CHANGE THE DIRECTORY";
- button.topLeftAnchor.set(button.topLeftAnchor.x, button.topLeftAnchor.y + button.rect.height + 20);
- buttons.push_back(button);
-
- // Platform text
- //
- button.deliminater = ", ";
- button.prefix = "Platforms: ";
- button.secondaryText = "";
- button.bDrawLong = false;
- button.secondaryText = "";
- button.bSelectable = false;
- button.setText(platform);
-
- button.topLeftAnchor.set(button.topLeftAnchor.x, button.topLeftAnchor.y + button.rect.height + 20);
- buttons.push_back(button);
-
- // Addons button
- //
- button.deliminater = ", ";
- button.bDrawLong = true;
- button.prefix = "Addons: ";
- button.secondaryText = "<< CLICK TO SELECT ADDONS";
- button.bSelectable = true;
- button.setText(addons);
-
- button.topLeftAnchor.set(button.topLeftAnchor.x, button.topLeftAnchor.y + button.rect.height + 20);
- buttons.push_back(button);
-
- // Generate
- //
- generateButton = button;
- generateButton.topLeftAnchor.set(906, 535);
- //generateButton.setColor(ofColor(50, 150, 255));
- generateButton.deliminater = ",";
- generateButton.prefix = "GENERATE PROJECT";
- generateButton.bSelectable = true;
- generateButton.setText("");
- generateButton.bDrawLong = false;
- addonButton = button;
- addonButton.topLeftAnchor.set(906, 535);
- addonButton.prefix = "<< BACK";
- addonButton.setText("");
- addonButton.bDrawLong = false;
-
- for (int i = 0; i < buttons.size(); i++){
- buttons[i].calculateRect();
- }
- addonButton.calculateRect();
- generateButton.calculateRect();
-
- //-------------------------------------
- // addons panels:
//-------------------------------------
-
- panelCoreAddons.setup();
- panelOtherAddons.setup();
-
- ofDirectory addons(addonsPath);
-
- addons.listDir();
- for(int i=0;i<(int)addons.size();i++){
- string addon = addons.getName(i);
-
- if(addon.find("ofx")==0){
-
- if (isAddonCore(addon)){
- ofxToggle * toggle = new ofxToggle();
- panelCoreAddons.add(toggle->setup(addon,false,300));
- } else {
- bHaveNonCoreAddons = true;
- ofxToggle * toggle = new ofxToggle();
- panelOtherAddons.add(toggle->setup(addon,false,300));
- }
-
-
- }
- }
-
- //-------------------------------------
- // platform panel (not used, really, but here just in case)
- //-------------------------------------
- panelPlatforms.setup();
- panelPlatforms.add(wincbToggle.setup("windows (codeblocks)",ofGetTargetPlatform()==OF_TARGET_WINGCC));
- panelPlatforms.add(winvsToggle.setup("windows (visual studio)", ofGetTargetPlatform()==OF_TARGET_WINVS));
- panelPlatforms.add(linuxcbToggle.setup("linux (codeblocks)",ofGetTargetPlatform()==OF_TARGET_LINUX));
- panelPlatforms.add(linux64cbToggle.setup("linux64 (codeblocks)",ofGetTargetPlatform()==OF_TARGET_LINUX64));
-
-//for ios, we need to fake that the target is ios (since we're compiling w/ osx OF)
-
-//#define MAKE_IOS
+ // load settings
-#ifdef MAKE_IOS
- panelPlatforms.add(osxToggle.setup("osx (xcode)",false));
- panelPlatforms.add(iosToggle.setup("ios (xcode)",true));
-#else
- panelPlatforms.add(osxToggle.setup("osx (xcode)",ofGetTargetPlatform()==OF_TARGET_OSX));
- panelPlatforms.add(iosToggle.setup("ios (xcode)",ofGetTargetPlatform()==OF_TARGET_IPHONE));
-#endif
+ XML.loadFile("settings/projectGeneratorSettings.xml");
+ string appToRoot = XML.getValue("settings:base:appToRoot", "../../../../");
+ string defaultLoc = XML.getValue("settings:simplePage:defaultNewProjectLocation", "apps/myApps");
+ bool bMultiPlaform = XML.getValue("settings:base:multiplatform", 0) == 0 ? false : true;
+ basePGPage::pgSettings settings;
+ settings.appRoot = appToRoot;
+ settings.defaultNewProjectLocation = defaultLoc;
+ settings.multiplatform = bMultiPlaform;
+ cout << settings.appRoot << endl;
- // update the platforms text in the platform button
- string platforms = "";
- for (int i = 0; i < panelPlatforms.getNumControls(); i++){
- if (*((ofxToggle *)panelPlatforms.getControl(i))){
- if (platforms.length() > 0) platforms+=", ";
- platforms += ((ofxToggle *)panelPlatforms.getControl(i))->getName();
-
- };
- }
- buttons[2].setText(platforms);
-
-
- panelPlatforms.setPosition(10,40);
- panelCoreAddons.setPosition(10,40);
- panelOtherAddons.setPosition(330,40);
-
-
- logo.loadImage("images/ofw-logo.png");
-
- ofBackground(230,230,230);
+ simple.settings = settings;
+ makeProjects.settings = settings;
+
+
+
+ simple.font = &font;
+ simple.titleFont = &titleFont;
+ simple.secondFont = &secondFont;
+
+ makeProjects.font = &font;
+ makeProjects.titleFont = &titleFont;
+ makeProjects.secondFont = &secondFont;
+
+ //-------------------------------------
+
+ simple.setup();
+ makeProjects.setup();
- generateButton.topLeftAnchor.set(ofGetWidth() - buttons[0].rect.x - generateButton.rect.width + 10 ,
- ofGetHeight() - generateButton.rect.height - 40);// 535);
- generateButton.calculateRect();
- addonButton.topLeftAnchor.set(ofGetWidth() - buttons[0].rect.x - addonButton.rect.width + 10 ,
- ofGetHeight() - addonButton.rect.height - 40);// 535);
- addonButton.calculateRect();
-
}
-
-
-
-
-
//--------------------------------------------------------------
void testApp::update(){
-
- float diff = ofGetElapsedTimef()- statusSetTime;
- if (diff > 3){
- statusEnergy *= 0.99;;
- }
- //-------------------------------------
- // if we are in addon mode check
- //-------------------------------------
-
- if (mode == MODE_ADDON ) addonButton.checkMousePressed(ofPoint(mouseX, mouseY));
-
-
- //-------------------------------------
- // layout our normal buttons, check the mouse
- //-------------------------------------
-
- for (int i = 0; i < buttons.size(); i++){
- buttons[i].calculateRect();
- buttons[i].checkMousePressed(ofPoint(mouseX, mouseY));
- }
-
- generateButton.checkMousePressed(ofPoint(mouseX, mouseY));
- for (int i = 0; i < buttons.size(); i++){
- if (i != 0){
- buttons[i].topLeftAnchor.y = buttons[i-1].topLeftAnchor.y +buttons[i-1].rect.height + 20;
- }
- }
-
-
- //-------------------------------------
- // addons panels can be really long, so use the mouse pos to move them if we need to
- //-------------------------------------
-
- if (panelCoreAddons.getShape().height > ofGetHeight()){
- float pct = ofMap(ofGetMouseY(), 0,ofGetHeight(), 0,1,true);
- float diff = panelCoreAddons.getShape().height - ofGetHeight();
- panelCoreAddons.setPosition(panelCoreAddons.getPosition().x,-diff * pct);
- }
-
- if (panelOtherAddons.getShape().height > ofGetHeight()){
- float pct = ofMap(ofGetMouseY(), 0,ofGetHeight(), 0,1,true);
- float diff = panelOtherAddons.getShape().height - ofGetHeight();
- panelOtherAddons.setPosition(panelOtherAddons.getPosition().x,-diff * pct);
- }
-
+
+ if (mode == MODE_SIMPLE) simple.update();
+ else if (mode == MODE_MAKE_ALL) makeProjects.update();
}
//--------------------------------------------------------------
void testApp::draw(){
-
- if (mode != MODE_ADDON ) {
-
- ofSetColor(100);
- logo.draw(64, 61,logo.getWidth(),logo.getHeight());
-
- //ofSetColor(74,255,203);
- titleFont.drawString("PROJECT", 64 + logo.getWidth() + 25, 85);
- titleFont.drawString("GENERATOR", 64 + logo.getWidth() + 25, 117);
- }
-
- if (mode == 0){
- for (int i = 0; i < buttons.size(); i++){
- buttons[i].draw();
- }
-
- generateButton.draw();
-
- } else if (mode == 1){
- panelCoreAddons.draw();
- if (bHaveNonCoreAddons){
- panelOtherAddons.draw();
- }
- } else if (mode == 2){
- panelPlatforms.draw();
- }
- //cout << panelAddons.getShape().height << endl;
-
+ if (mode == MODE_SIMPLE) simple.draw();
+ else if (mode == MODE_MAKE_ALL) makeProjects.draw();
-
-
- if (mode == 1 ){
- addonButton.draw();
-
- ofRectangle rect = secondFont.getStringBoundingBox("select core and non-core addons to add", addonButton.topLeftAnchor.x-200, 60);
- ofSetColor(220,220,220);
- ofRect(rect.x-10, rect.y-10, rect.width+20, rect.height+20);
- ofSetColor(0,0,0);
- secondFont.drawString("select core and non-core addons to add", addonButton.topLeftAnchor.x-200, 60);
- }
-
- if (mode == 0){
- ofFill();
- ofSetColor(0 + 220 * (1-statusEnergy),0 + 220 * (1-statusEnergy),0 + 220 * (1-statusEnergy));
- ofRect(0,ofGetHeight(), ofGetWidth(), -25);
- ofSetColor(255,255,255, 255 * statusEnergy);
- ofDrawBitmapString(status, 10,ofGetHeight()-8);
- }
}
//--------------------------------------------------------------
void testApp::keyPressed(int key){
- if (key == ' '){
-
- //printf("%s -------- \n", ResultBuffer);
- //std::exit(0);
- }
-
-
-}
-
-void testApp::generateProject(){
-
- vector targetsToMake;
- if( osxToggle ) targetsToMake.push_back(OF_TARGET_OSX);
- if( iosToggle ) targetsToMake.push_back(OF_TARGET_IPHONE);
- if( wincbToggle ) targetsToMake.push_back(OF_TARGET_WINGCC);
- if( winvsToggle ) targetsToMake.push_back(OF_TARGET_WINVS);
- if( linuxcbToggle ) targetsToMake.push_back(OF_TARGET_LINUX);
- if( linux64cbToggle ) targetsToMake.push_back(OF_TARGET_LINUX64);
-
- if( targetsToMake.size() == 0 ){
- cout << "Error: makeNewProjectViaDialog - must specifiy a project to generate " <create(path)){
- vector addonsToggles = panelCoreAddons.getControlNames();
- for (int i = 0; i < (int) addonsToggles.size(); i++){
- ofxToggle toggle = panelCoreAddons.getToggle(addonsToggles[i]);
- if(toggle){
- ofAddon addon;
- addon.pathToOF = getOFRelPath(path);
- addon.fromFS(ofFilePath::join(addonsPath, addonsToggles[i]),target);
- project->addAddon(addon);
-
- }
- }
-
-
- addonsToggles = panelOtherAddons.getControlNames();
- for (int i = 0; i < (int) addonsToggles.size(); i++){
- ofxToggle toggle = panelOtherAddons.getToggle(addonsToggles[i]);
- if(toggle){
- ofAddon addon;
-
- addon.pathToOF = getOFRelPath(path);
- cout << getOFRelPath(path) << " " << path << endl;
- addon.fromFS(ofFilePath::join(addonsPath, addonsToggles[i]),target);
- project->addAddon(addon);
-
- }
- }
-
- project->save(true);
- }
- }
-
-
- printf("done with project generation \n");
- setStatus("generated: " + buttons[1].myText + "/" + buttons[0].myText);
-
- // go through the control panels, do stuff
+
+
+
+ if (mode == MODE_SIMPLE) simple.keyPressed(key);
+ else if (mode == MODE_MAKE_ALL) makeProjects.keyPressed(key);
+
+
+ if (key == OF_KEY_RIGHT){ mode++; mode %= 2; }
}
//--------------------------------------------------------------
void testApp::keyReleased(int key){
-
-
-
}
//--------------------------------------------------------------
@@ -539,132 +105,8 @@ void testApp::mouseDragged(int x, int y, int button){
//--------------------------------------------------------------
void testApp::mousePressed(int x, int y, int button){
- if (mode == MODE_NORMAL){
-
-
- // check the mouse for press
-
- for (int i = 0; i < buttons.size(); i++){
- buttons[i].checkMousePressed(ofPoint(x, y));
- }
-
-
- //-------------------------------------
- // 4 = genearate
- //-------------------------------------
-
-
- if (generateButton.bMouseOver == true){
- generateProject();
- }
-
- //-------------------------------------
- // 0 = sketch name
- //-------------------------------------
-
- if (buttons[0].bMouseOver == true){
- string text = ofSystemTextBoxDialog("choose sketch name", buttons[0].myText);
- fixStringCharacters(text);
- setStatus("sketch name set to: " + text);
- buttons[0].setText(text);
- }
-
- //-------------------------------------
- // 1 = sketch path
- //-------------------------------------
-
- if (buttons[1].bMouseOver == true){
-
- string command = "";
-
- ofDirectory dir(ofFilePath::join(getOFRoot(),defaultLoc));
-
- if (!dir.exists()){
- dir.create();
- }
-
-
- #ifdef TARGET_WIN32
- ofFileDialogResult res = ofSystemLoadDialog("please select sketch folder", true, windowsFromUnixPath(dir.path()));
- #else
- ofFileDialogResult res = ofSystemLoadDialog("please select sketch folder", true, dir.path());
- #endif
-
-
- if (res.bSuccess){
- string result = res.filePath;
- convertWindowsToUnixPath(result);
- buttons[1].setText( result );
-
- setStatus("path set to: " + result);
- }
-
-
- }
-
-
- //-------------------------------------
- // 2 = platform (disabled)
- //-------------------------------------
-
-
- if (buttons[2].bMouseOver == true){
- // platform is diabled for now
- mode = 2;
- }
-
- //-------------------------------------
- // 3 = addon
- //-------------------------------------
-
- if (buttons[3].bMouseOver == true){
- mode = MODE_ADDON;
-
- }
- }
-
- //-------------------------------------
- // handle addon mode
- //-------------------------------------
-
- if (mode == MODE_ADDON ){
-
- //-------------------------------------
- // if we hit he back button, collect the addons for display
- //-------------------------------------
-
- if (addonButton.bMouseOver){
-
- string addons = "";
-
- for (int i = 0; i < panelCoreAddons.getNumControls(); i++){
- if (*((ofxToggle *)panelCoreAddons.getControl(i))){
- if (addons.length() > 0) addons+=", ";
- addons += ((ofxToggle *)panelCoreAddons.getControl(i))->getName();
-
- }
-
- }
- for (int i = 0; i < panelOtherAddons.getNumControls(); i++){
- if (*((ofxToggle *)panelOtherAddons.getControl(i))){
- if (addons.length() > 0) addons+=", ";
- addons += ((ofxToggle *)panelOtherAddons.getControl(i))->getName();
-
- }
-
- }
- buttons[3].setText(addons);
-
- setStatus("addons set to: " + addons);
-
- addonButton.bMouseOver = false;
- mode = MODE_NORMAL;
- }
- }
-
- if (mode == MODE_PLATFORM){
-
- }
+ if (mode == MODE_SIMPLE) simple.mousePressed(x,y,button);
+ else if (mode == MODE_MAKE_ALL) makeProjects.mousePressed(x,y,button);
}
//--------------------------------------------------------------
@@ -674,13 +116,9 @@ void testApp::mouseReleased(int x, int y, int button){
//--------------------------------------------------------------
void testApp::windowResized(int w, int h){
- generateButton.topLeftAnchor.set(ofGetWidth() - buttons[0].rect.x - generateButton.rect.width + 10 ,
- ofGetHeight() - generateButton.rect.height - 40);// 535);
- generateButton.calculateRect();
- addonButton.topLeftAnchor.set(ofGetWidth() - buttons[0].rect.x - addonButton.rect.width + 10 ,
- ofGetHeight() - addonButton.rect.height - 40);// 535);
- addonButton.calculateRect();
+ if (mode == MODE_SIMPLE) simple.windowResized(w,h);
+ //makeProjectsPGPage.windowResized(w, h);
}
@@ -688,48 +126,8 @@ void testApp::windowResized(int w, int h){
void testApp::gotMessage(ofMessage msg){
}
-void testApp::addAddon(string addon) {
-
- string addons = "";
-
- for (int i = 0; i < panelCoreAddons.getNumControls(); i++){
-
- ofxToggle *toggle = ((ofxToggle *)panelCoreAddons.getControl(i));
- if(toggle->getName()==addon) {
- (*toggle) = true;
- }
-
- if (*toggle){
- if (addons.length() > 0) addons+=", ";
- addons += toggle->getName();
- }
-
- }
- for (int i = 0; i < panelOtherAddons.getNumControls(); i++){
- ofxToggle *toggle = ((ofxToggle *)panelOtherAddons.getControl(i));
-
- if(toggle->getName()==addon) {
- (*toggle) = true;
- }
-
- if (*toggle){
- if (addons.length() > 0) addons+=", ";
- addons += toggle->getName();
- }
-
- }
- buttons[3].setText(addons);
-}
//--------------------------------------------------------------
void testApp::dragEvent(ofDragInfo dragInfo){
- for(int i = 0; i < dragInfo.files.size(); i++) {
- string path = dragInfo.files[i];
- ofFile f(path);
- ofFile parent(f.getEnclosingDirectory());
- if(parent.getFileName()=="addons") {
- string addon = f.getFileName();
- addAddon(addon);
- }
- }
+
}
diff --git a/src/testApp.h b/src/testApp.h
index 3437a23..e52c96c 100644
--- a/src/testApp.h
+++ b/src/testApp.h
@@ -3,17 +3,9 @@
//#define COMMAND_LINE_ONLY
#include "ofMain.h"
-#include "CBLinuxProject.h"
-#include "CBWinProject.h"
-#include "visualStudioProject.h"
-#include "xcodeProject.h"
-#include
-
-#include "ofxGui.h"
-#include "ofAddon.h"
-#include "ofxXmlSettings.h"
-#include "textButton.h"
-
+#include "simplePGPage.h"
+#include "makeProjectsPGPage.h"
+#include "generateProjects.h"
class testApp : public ofBaseApp{
@@ -33,37 +25,27 @@ class testApp : public ofBaseApp{
void dragEvent(ofDragInfo dragInfo);
void gotMessage(ofMessage msg);
+ simplePGPage simple;
+ generateProjects makeProjects;
+ ofxXmlSettings XML;
- string sketchName;
- string sketchPath;
- string addons;
- string platform;
-
- ofxPanel panelCoreAddons;
- ofxPanel panelOtherAddons;
- bool bHaveNonCoreAddons;
-
- ofxPanel panelPlatforms;
- ofxToggle osxToggle, iosToggle, wincbToggle, winvsToggle, linuxcbToggle, linux64cbToggle;
-
ofTrueTypeFont font;
ofTrueTypeFont titleFont;
ofTrueTypeFont secondFont;
- int mode;
- enum { MODE_NORMAL, MODE_ADDON, MODE_PLATFORM };
-
- baseProject * project;
-
- string setupForTarget(int targ);
+ enum {
+ MODE_SIMPLE,
+ MODE_MAKE_ALL
+ };
+ int mode;
+
void generateProject();
string addonsPath;
string status;
- ofxXmlSettings XML;
string appToRoot;
string defaultLoc;
diff --git a/src/utils/Utils.cpp b/src/utils/Utils.cpp
index 47f8c28..b123055 100644
--- a/src/utils/Utils.cpp
+++ b/src/utils/Utils.cpp
@@ -44,6 +44,38 @@ using namespace Poco;
#include "ofUtils.h"
+void convertWindowsToUnixPath(string & path){
+ for (int i = 0; i < path.size(); i++){
+ if (path[i] == '\\') path[i] = '/';
+ }
+}
+
+string windowsFromUnixPath(string path){
+ for (int i = 0; i < path.size(); i++){
+ if (path[i] == '/') path[i] = '\\';
+ }
+ return path;
+}
+
+//------------------------------------------------------
+// for project names, let's fix replace any odd characters with _
+void fixStringCharacters(string &toFix){
+
+ // replace all non alpha numeric (ascii) characters with _
+ for (int i = 0; i < toFix.size(); i++){
+ int which = (int)toFix[i];
+ if ((which >= 48 && which <= 57) ||
+ (which >= 65 && which <= 90) ||
+ (which >= 97 && which <= 122)){
+ } else {
+ toFix[i] = '_';
+ }
+ }
+}
+
+
+
+
string StringToUpper(string strToConvert)
{
std::transform(strToConvert.begin(), strToConvert.end(), strToConvert.begin(), ::toupper);
diff --git a/src/utils/Utils.h b/src/utils/Utils.h
index fd6e00e..b693a03 100644
--- a/src/utils/Utils.h
+++ b/src/utils/Utils.h
@@ -15,6 +15,10 @@
#include "ofMain.h"
+void convertWindowsToUnixPath(string & path);
+string windowsFromUnixPath(string path);
+void fixStringCharacters(string &toFix);
+
string generateUUID(string input);
string getOFRoot();