Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #4 from ramcdona/master

Fixes and version bump to 2.0.2.
  • Loading branch information...
commit 7b37d5464b399bc1974dc07d2f8175ea1a7eee1b 2 parents 4408bd1 + d80a431
@ramcdona ramcdona authored
View
3  examples/setup/VspPreferences.xml
@@ -18,7 +18,8 @@
</OutputName>
</Vsp_OutputNames>
<WindowManagerStyle>1</WindowManagerStyle>
- <DefaultComponentFileID>0</DefaultComponentFileID>
+ <AutoSaveInterval>180</AutoSaveInterval>
+ <DefaultComponentFileID>1</DefaultComponentFileID>
<DefaultComponentFileList>
<DefaultComponentFile>
<Name>BWB</Name>
View
1  src/vsp/VspPreferences.cpp
@@ -102,6 +102,7 @@ VspPreferences::VspPreferences()
}
windowMgrStyle = xmlFindInt(root, "WindowManagerStyle", 0);
+ autoSaveInterval = xmlFindInt(root, "AutoSaveInterval", 180);
}
View
1  src/vsp/VspPreferences.h
@@ -51,6 +51,7 @@ class VspPreferences
int getNumOutputNames() { return outputNameVec.size(); }
Stringc getOutputName(int i);
int windowMgrStyle;
+ int autoSaveInterval;
int getDefaultCompFileID() { return m_DefaultCompFileID; }
void setDefaultCompFileID( int id );
View
20 src/vsp/aircraft.cpp
@@ -474,17 +474,20 @@ void Aircraft::reorderGeom( int action )
}
-void Aircraft::writeFile( const char* file_name )
+void Aircraft::writeFile( const char* file_name, bool restore_file_name )
{
vector< Geom* > gVec = geomVec;
gVec.push_back( getUserGeom() );
- writeFile( file_name, gVec, labelVec );
+ writeFile( file_name, gVec, labelVec, restore_file_name );
}
-void Aircraft::writeFile( const char* file_name, vector< Geom * > &gVec, vector< LabelGeom * > &lVec )
+void Aircraft::writeFile( const char* file_name, vector< Geom * > &gVec, vector< LabelGeom * > &lVec, bool restore_file_name )
{
- fileName = file_name;
- setTempDir( fileName, false );
+ if ( !restore_file_name )
+ {
+ fileName = file_name;
+ setTempDir( fileName, false );
+ }
xmlDocPtr doc = xmlNewDoc((const xmlChar *)"1.0");
@@ -3354,9 +3357,14 @@ void Aircraft::updateExportFileNames()
void Aircraft::setTempDir( const char* fn, bool user_set )
{
Stringc dirString = fn;
+
+ int dirLen = dirString.get_length();
+ for (int i=0; i<dirLen; i++) {
+ if ( dirString[i] == '\\' ) dirString[i] = '/';
+ }
+
if ( dirString.count_substrings( "/" ) >= 1 )
{
- int dirLen = dirString.get_length();
int slashLoc = dirLen-1;
while ( slashLoc > 0 )
View
4 src/vsp/aircraft.h
@@ -82,8 +82,8 @@ class Aircraft
VSPDLL int openFile( const char* file_name );
int insertFile( const char* file_name );
- void writeFile( const char* file_name );
- void writeFile( const char* file_name, vector< Geom * > &gVec, vector< LabelGeom * > &lVec );
+ void writeFile( const char* file_name , bool restore_file_name = false );
+ void writeFile( const char* file_name, vector< Geom * > &gVec, vector< LabelGeom * > &lVec, bool restore_file_name = false );
int readFile( const char* file_name );
int readOldRamFile ( const char* file_name );
View
23 src/vsp/geom.cpp
@@ -2852,17 +2852,7 @@ int XSecGeom::read_xsec( const char* file_name )
}
fclose(fp);
- surfVec.clear();
- for ( int i = 0 ; i < (int)xsecCompVec.size() ; i++ )
- {
- xsecCompVec[i].load_refl_pnts_xsecs();
- xsecCompVec[i].load_hidden_surf();
- xsecCompVec[i].load_normals();
- xsecCompVec[i].load_uw();
- surfVec.push_back( &xsecCompVec[i] );
- }
-
- update_bbox();
+ generate();
return 1;
}
@@ -2943,7 +2933,16 @@ void XSecGeom::LoadLinkableParms( vector< Parm* > & parmVec )
void XSecGeom::generate()
{
- update_bbox();
+ surfVec.clear();
+ for ( int i = 0 ; i < (int)xsecCompVec.size() ; i++ )
+ {
+ xsecCompVec[i].load_refl_pnts_xsecs();
+ xsecCompVec[i].load_hidden_surf();
+ xsecCompVec[i].load_normals();
+ xsecCompVec[i].load_uw();
+ surfVec.push_back( &xsecCompVec[i] );
+ }
+ update_bbox();
}
void XSecGeom::computeCenter()
View
9 src/vsp/main.cpp
@@ -33,6 +33,7 @@
#include "scriptMgr.h"
#include "FeaMeshMgr.h"
#include "CfdMeshMgr.h"
+#include "VspPreferences.h"
// Include OpenNurbs for Rhino Dump
// ON Needs to be undefined for it to compile
@@ -558,17 +559,16 @@ void vsp_exit()
}
-#define AUTO_SAVE_TIME (180)
void autoSaveTimeoutHandler(void *data)
{
if ( airPtr )
{
Stringc backupfn = airPtr->getTempDir();
backupfn.concatenate("vsp_autobackup.vsp");
- airPtr->writeFile(backupfn.get_char_star());
+ airPtr->writeFile(backupfn.get_char_star(), true);
}
- Fl::repeat_timeout(AUTO_SAVE_TIME, autoSaveTimeoutHandler, data );
+ Fl::repeat_timeout(VspPreferences::Instance()->autoSaveInterval, autoSaveTimeoutHandler, data );
}
@@ -615,7 +615,8 @@ int main( int argc, char** argv)
}
else
{
- Fl::add_timeout( AUTO_SAVE_TIME, autoSaveTimeoutHandler, airPtr );
+ if (VspPreferences::Instance()->autoSaveInterval > 0)
+ Fl::add_timeout( VspPreferences::Instance()->autoSaveInterval, autoSaveTimeoutHandler, airPtr );
screenMgrPtr->showGui( argc-1, argv );
}
View
6 src/vsp/main.h
@@ -10,9 +10,9 @@
#ifndef main_h
#define main_h
-#define VSPVERSION1 "Vehicle Sketch Pad 2.0.1"
-#define VSPVERSION2 "OpenVSP 2.0.1 - 2/2/12"
-#define VSPVERSION3 "OpenVSP 2.0.1 : Vehicle Sketch Pad"
+#define VSPVERSION1 "Vehicle Sketch Pad 2.0.2"
+#define VSPVERSION2 "OpenVSP 2.0.2 - 2/21/12"
+#define VSPVERSION3 "OpenVSP 2.0.2 : Vehicle Sketch Pad"
void vsp_exit();
View
23 src/vsp/vspGlWindow.cpp
@@ -322,12 +322,16 @@ void VirtGlWindow::mouseDrag( int mx, int my )
if ( !showFlag )
return;
- if ( (Fl::event_state(FL_BUTTON1) && Fl::event_button3() ) || Fl::event_state(FL_BUTTON2) )
+ if ( (Fl::event_state(FL_BUTTON1) && Fl::event_button3() ) ||
+ (Fl::event_state(FL_BUTTON1) && Fl::event_ctrl() ) ||
+ (Fl::event_state(FL_BUTTON1) && Fl::event_state(FL_META) ) ||
+ Fl::event_state(FL_BUTTON2) )
currTrack.poll( SCALE, mx-wx, my-wy );
+ else if ( Fl::event_state(FL_BUTTON3 ) ||
+ (Fl::event_state(FL_BUTTON1) && Fl::event_alt()))
+ currTrack.poll( TRANSLATE, mx-wx, my-wy );
else if ( Fl::event_state(FL_BUTTON1 ) )
currTrack.poll( ROTATE, mx-wx, my-wy );
- else if ( Fl::event_state(FL_BUTTON3 ) )
- currTrack.poll( TRANSLATE, mx-wx, my-wy );
}
@@ -433,15 +437,22 @@ Fl_Gl_Window(x,y,w,h,"Vsp GL Window")
vWin[TWO_LOW] = new VirtGlWindow( 0, h/2, w, h/2 );
//==== Set Up Initial Viewing Angles ====//
- vWin[FOUR_LOW_L]->currTrack.set_init_angle(PI/2.0, 0.0, 0.0);
+ //vWin[FOUR_LOW_L]->currTrack.set_init_angle(PI/2.0, 0.0, 0.0);
+ vWin[FOUR_LOW_L]->currTrack.set_init_angle(PI/2.0, -PI/2.0, 0.0);
vWin[FOUR_LOW_L]->currTrack.init();
- vWin[FOUR_UP_R]->currTrack.set_init_angle(PI/2.0, -PI/2.0, 0.0);
+ //vWin[FOUR_UP_R]->currTrack.set_init_angle(PI/2.0, -PI/2.0, 0.0);
+ vWin[FOUR_UP_R]->currTrack.set_init_angle(PI/4.0, -PI/6.0, -PI/6.0);
vWin[FOUR_UP_R]->currTrack.init();
- vWin[FOUR_LOW_R]->currTrack.set_init_angle(PI/4.0, -PI/6.0, -PI/6.0);
+ //vWin[FOUR_LOW_R]->currTrack.set_init_angle(PI/4.0, -PI/6.0, -PI/6.0);
+ vWin[FOUR_LOW_R]->currTrack.set_init_angle(PI/2.0, 0.0, 0.0);
vWin[FOUR_LOW_R]->currTrack.init();
+ //vWin[FOUR_UP_L]->currTrack.set_init_angle(0.0, 0.0, 0.0);
+ vWin[FOUR_UP_L]->currTrack.set_init_angle(0.0, 0.0, -PI/2.0);
+ vWin[FOUR_UP_L]->currTrack.init();
+
vWin[TWO_L]->currTrack.set_init_angle(0.0, 0.0, PI/2.0);
vWin[TWO_L]->currTrack.init();
Please sign in to comment.
Something went wrong with that request. Please try again.