Browse Source

Mikes experimental visual studio build

MikeNix-VisualStudio
surkhe 6 months ago
parent
commit
a3f10add73
  1. 225
      ChangeLog
  2. 422
      GBCSolution.cpp
  3. 59
      GBCSolution.h
  4. 3
      GEBC.kdev4
  5. 20
      GEBC.sln
  6. 109
      GEBC.vcxproj
  7. 84
      GEBC.vcxproj.filters
  8. 7
      GEBC.vcxproj.user
  9. 31
      GNU_Ballistics.cpp
  10. 1660
      InputWindow.cpp
  11. 151
      InputWindow.h
  12. 6
      LicenseWindow.cpp
  13. 2
      PBRWindow.cpp
  14. 710
      PlotWindow.cpp
  15. 2
      PlotWindow.h
  16. 27
      RangeWindow.cpp
  17. 960
      TargetWindow.cpp
  18. 73
      TargetWindow.h
  19. 2
      lib/ballistics/ballistics.cpp
  20. 16
      make-mingw
  21. 11
      make-slack64

225
ChangeLog

@ -1,88 +1,137 @@ @@ -1,88 +1,137 @@
Jan 2011 mnix@wanm.com.au
* Added TargetWindow - view of target as seen from shooter.
* Added a perspective checkbox to the target window. This switches
between path as seen by shooter (on) and path relative to line of
sight (off). For example, a bullet 1/2 way to the target will
line up with a point twice as far above line of sight in the target
as it actually is. ie if the bullet is 1" above line of sight at 50
yds, it will be in line with a point 2" above line of sight on a
target at 100 yds. The line appears to move on the target because as
you move the target back (say to 200 yds) the bullet at 50 yds and
1" high will line up with a point 4" high on the target at 200 yds.
* If a file name is given on the command line it is loaded at startup.
No checking is done on the file name - if it does not exist,
bad things may happen.
* Added various target types including common NRA and ISSF targets
* Added a "variance" ring around the impact point. This is 1 MOA plus
a bit on the sides as alowance for spin drift (it's added to both
sides and left to the viewer to decide on whether to allow for left
or right twist. The amount is so small it doesn't matter much
anyway (we allow a generic 0.1 MOA per 100 yards beyond 100 yards)
Nov 2010 mnix#wanm.com.au
* Added a drop down box to the Plot Window to select scope guides.
* Changed the calculations for the scope guides to draw them more
accurately.
* Get Zero to float in the path plot
* Clip the scope guides
* Added an option for guides every 1 degree
Oct 2010 mnix@wanm.com.au
* Added scope guides to the path plot as a ready reference to how the
trajectory compares to the field of view of the scope, in particular to
one and 5 MIL marks on a MIL-DOT reticle. Included code for MOA
as well, but commented it out pending GUI button to select
MIL/MOA/NONE
* Modified InputWindow and PlotWindow to handle plotting memory 3
* Consolidated a lot of code in PlotWindow into 3 new functions.
* modified InputWindow::cb_Solve() to treat zero ranges < 2 yards as a
zeroangle and report the zeroangle used in the output window.
This allows plotting the paths of different loads shot from the one
barrel and scope alignment (eg for a two different loads in a .308
without adjusting the scope, what is the elevation adjustment for
each load?) Useful for hunters who might select different loads for
different targets, but do not want to mess with their zero.
* Allowed for larger y_range in plots.
* Reduced the minimum range in the PlotWindow to 50 yds (default still
200). Useful for low power (ie .22) shooters.
* Added Drop (MIL), Windage (MIL) and Target Size (MIL) columns to the
RangeWindow (not all export formats have been updated yet).
All useful for users of MIL-DOT reticles.
Need to add a GUI box for entering the target size in inches - that
way you can enter the size in inches of whatever you intend to shoot,
then in the field measure your target in MIL in the scope, look that up
on the range table and instantly get bullet drop and windage in MIL,
no maths required.
* Added metric conversions of the summary data at the top of the range
table.
* Cleaned up SOME of the misuse of malloc/delete/free
delete calls the destructor then frees the memory. Calling free on
an object after deleting it is an error, so is calling delete after
calling the destructor!
Also mixing new/free and malloc/delete on the same object is bad.
Only use malloc with free, and only new with delete.
* Re-wrote the GenTable and Export* code in RangeWindow to be data-driven.
Adding a column, or modifying the layout of the load data is now
done in one place and automatically appears in ALL output formats.
Aug 2017 mnix@wanm.com.au
* Added a couple of rectangular target options to the Target Window.
* Added scope guides for the Pulsar Digisight N750 and N960 digital
night vision scopes as they don't use standard MIL or MOA marks.
* Added Digisight clicks for N750 and N960 to the range table.
Clicks are relative to the zero of the scope, so if your Y value for
a 200 yard zero is +10 and the table is for a 200 yard zero, you
will need to add 10 to the value in the table to get the Y value
to set in your scope for the given range.
Dec 2011 mnix@wanm.com.au
* minor tweaks and a make-mingw script to cross-compile under mingw32
on linux. Also a make-slack64 script to configure and build for
linux again. Now you can build for win32 from either windows or
linux, as well as for 32 and 64 bit linux. The saved files are
compatible between all versions too.
* Updated to compile under windows using VisualC 2010.
You still need to find libharu and fltk for win32, and will need to
adjust the include and linker library paths in the project to reflect
their location, but GEBC should compile after that.
* More code cleanups and bugfixes
* Changed the way GBCSolution works so that we don't store pointers and other
silly things in the data file. This also makes the data file structure binary
compatible between 32 and 64 bit compiles, and allows for file versions in
case we want to add more fields later.
* added a #pragma pack(4) to the definition of GBCSolution so that the
solution files are compatible between linux and windows executables.
* improved handling of attempts to open a non-existant or invalid file.
* TargetWindow - Better centering of the target, checkbox to centre
target on point of impact or point of aim.
* Improve the display for very low velocity projectiles (eg Tranquiliser Darts)
Mar 2011 mnix@wanm.com.au
* TargetWindow - replace inch grid with scope marking grid (MIL or
MOA) when perspective is on because inches don't make sense in this
mode - they can only be correct at the target range.
Jan 2011 mnix@wanm.com.au
* Added TargetWindow - view of target as seen from shooter.
* Added a perspective checkbox to the target window. This switches
between path as seen by shooter (on) and path relative to line of
sight (off). For example, a bullet 1/2 way to the target will
line up with a point twice as far above line of sight in the target
as it actually is. ie if the bullet is 1" above line of sight at 50
yds, it will be in line with a point 2" above line of sight on a
target at 100 yds. The line appears to move on the target because as
you move the target back (say to 200 yds) the bullet at 50 yds and
1" high will line up with a point 4" high on the target at 200 yds.
* If a file name is given on the command line it is loaded at startup.
No checking is done on the file name - if it does not exist,
bad things may happen.
* Added various target types including common NRA and ISSF targets
* Added a "variance" ring around the impact point. This is 1 MOA plus
a bit on the sides as alowance for spin drift (it's added to both
sides and left to the viewer to decide on whether to allow for left
or right twist. The amount is so small it doesn't matter much
anyway (we allow a generic 0.1 MOA per 100 yards beyond 100 yards)
Nov 2010 mnix#wanm.com.au
* Added a drop down box to the Plot Window to select scope guides.
* Changed the calculations for the scope guides to draw them more
accurately.
* Get Zero to float in the path plot
* Clip the scope guides
* Added an option for guides every 1 degree
Oct 2010 mnix@wanm.com.au
* Added scope guides to the path plot as a ready reference to how the
trajectory compares to the field of view of the scope, in particular to
one and 5 MIL marks on a MIL-DOT reticle. Included code for MOA
as well, but commented it out pending GUI button to select
MIL/MOA/NONE
* Modified InputWindow and PlotWindow to handle plotting memory 3
* Consolidated a lot of code in PlotWindow into 3 new functions.
* modified InputWindow::cb_Solve() to treat zero ranges < 2 yards as a
zeroangle and report the zeroangle used in the output window.
This allows plotting the paths of different loads shot from the one
barrel and scope alignment (eg for a two different loads in a .308
without adjusting the scope, what is the elevation adjustment for
each load?) Useful for hunters who might select different loads for
different targets, but do not want to mess with their zero.
* Allowed for larger y_range in plots.
* Reduced the minimum range in the PlotWindow to 50 yds (default still
200). Useful for low power (ie .22) shooters.
* Added Drop (MIL), Windage (MIL) and Target Size (MIL) columns to the
RangeWindow (not all export formats have been updated yet).
All useful for users of MIL-DOT reticles.
Need to add a GUI box for entering the target size in inches - that
way you can enter the size in inches of whatever you intend to shoot,
then in the field measure your target in MIL in the scope, look that up
on the range table and instantly get bullet drop and windage in MIL,
no maths required.
* Added metric conversions of the summary data at the top of the range
table.
* Cleaned up SOME of the misuse of malloc/delete/free
delete calls the destructor then frees the memory. Calling free on
an object after deleting it is an error, so is calling delete after
calling the destructor!
Also mixing new/free and malloc/delete on the same object is bad.
Only use malloc with free, and only new with delete.
* Re-wrote the GenTable and Export* code in RangeWindow to be data-driven.
Adding a column, or modifying the layout of the load data is now
done in one place and automatically appears in ALL output formats.

422
GBCSolution.cpp

@ -1,33 +1,33 @@ @@ -1,33 +1,33 @@
#include "GBCSolution.h"
GBCSolution::GBCSolution(void){
}
GBCSolution::GBCSolution(double* isolution, const char* iname, double ibc, double isightheight, int iweight, int imv, int iangle, int izerorange, int iwindspeed, int iwindangle, int itemp, int ihumidity, double ipressure, int ialtitude, int entries, int useweather, int idf){
sln=isolution;
strcpy(name,iname);
bc=ibc;
sightheight=isightheight;
weight=iweight;
mv=imv;
angle=iangle;
zerorange=izerorange;
windspeed=iwindspeed;
windangle=iwindangle;
temp=itemp;
humidity=ihumidity;
pressure=ipressure;
altitude=ialtitude;
rows=entries;
ckweather=useweather;
df = idf;
}
GBCSolution::GBCSolution(void){
sln=NULL;
memset(&param,sizeof(param),0);
}
GBCSolution::GBCSolution(double* isolution, const char* iname, double ibc, double isightheight, int iweight, int imv, int iangle, int izerorange, int iwindspeed, int iwindangle, int itemp, int ihumidity, double ipressure, int ialtitude, int entries, int useweather, int idf){
sln=isolution;
strncpy(param.name,iname,sizeof(param.name));
param.bc=ibc;
param.sightheight=isightheight;
param.weight=iweight;
param.mv=imv;
param.angle=iangle;
param.zerorange=izerorange;
param.windspeed=iwindspeed;
param.windangle=iwindangle;
param.temp=itemp;
param.humidity=ihumidity;
param.pressure=ipressure;
param.altitude=ialtitude;
param.rows=entries;
param.ckweather=useweather;
param.df = idf;
}
GBCSolution::~GBCSolution(){
if (this->sln != NULL) {
@ -36,157 +36,215 @@ GBCSolution::~GBCSolution(){ @@ -36,157 +36,215 @@ GBCSolution::~GBCSolution(){
}
}
const char* GBCSolution::Name(void){
return name;
}
double GBCSolution::BC(void){
return bc;
}
double GBCSolution::SightHeight(void){
return sightheight;
}
int GBCSolution::MuzzleVelocity(void){
return mv;
}
int GBCSolution::ShootingAngle(void){
return angle;
}
int GBCSolution::ZeroRange(void){
return zerorange;
}
int GBCSolution::WindSpeed(void){
return windspeed;
}
int GBCSolution::WindAngle(void){
return windangle;
}
int GBCSolution::Temp(void){
return temp;
}
double GBCSolution::Pressure(void){
return pressure;
}
int GBCSolution::Humidity(void){
return humidity;
}
int GBCSolution::Altitude(void){
return altitude;
}
double GBCSolution::GetRange(int yardage){
double size=sln[__BCOMP_MAXRANGE__*10+1];
if (yardage<size){
return sln[10*yardage];
}
else return 0;
}
double GBCSolution::GetPath(int yardage){
double size=sln[__BCOMP_MAXRANGE__*10+1];
if (yardage<size){
return sln[10*yardage+1];
}
else return 0;
}
double GBCSolution::GetMOA(int yardage){
double size=sln[__BCOMP_MAXRANGE__*10+1];
if (yardage<size){
return sln[10*yardage+2];
}
else return 0;
}
double GBCSolution::GetTime(int yardage){
double size=sln[__BCOMP_MAXRANGE__*10+1];
if (yardage<size){
return sln[10*yardage+3];
}
else return 0;
}
double GBCSolution::GetWindage(int yardage){
double size=sln[__BCOMP_MAXRANGE__*10+1];
if (yardage<size){
return sln[10*yardage+4];
}
else return 0;
}
double GBCSolution::GetWindageMOA(int yardage){
double size=sln[__BCOMP_MAXRANGE__*10+1];
if (yardage<size){
return sln[10*yardage+5];
}
else return 0;
}
double GBCSolution::GetVelocity(int yardage){
double size=sln[__BCOMP_MAXRANGE__*10+1];
if (yardage<size){
return sln[10*yardage+6];
}
else return 0;
}
double GBCSolution::GetVx(int yardage){
double size=sln[__BCOMP_MAXRANGE__*10+1];
if (yardage<size){
return sln[10*yardage+7];
}
else return 0;
}
double GBCSolution::GetVy(int yardage){
double size=sln[__BCOMP_MAXRANGE__*10+1];
if (yardage<size){
return sln[10*yardage+8];
}
else return 0;
}
double GBCSolution::GetDrop(int yardage){
double size=sln[__BCOMP_MAXRANGE__*10+1];
if (yardage<size){
return sln[10*yardage+9];
}
else return 0;
}
double GBCSolution::GetEnergy(int k){
return (double)weight*GetVelocity(k)*GetVelocity(k)/450436;
}
int GBCSolution::MaxRows(void){
return rows;
}
int GBCSolution::MaxRows(int mr){
rows=mr;
return rows;
}
int GBCSolution::Weight(void){
return weight;
}
int GBCSolution::UseWeather(void){
return ckweather;
}
#define FILEVERSION 0
int GBCSolution::Save(FILE* f) {
int wrote;
param.reserved1=0;
param.reserved2=FILEVERSION;
wrote=fwrite(&param, 1, sizeof(param), f);
if (wrote == sizeof(param)) return 1;
return 0;
}
int GBCSolution::Load(FILE* f) {
int read;
Clear();
read=fread(&param, 1, sizeof(param), f);
// file saved by current version?
if ((read == sizeof(param)) && (param.reserved1==0) && (param.reserved2==FILEVERSION))
return 1;
if ((param.reserved1 == 0) && (param.reserved2 < 256)) {
// not the original format with pointers in it...
if (param.reserved2 < FILEVERSION) {
// default any missing fields based on version number in the file
}
return 1;
}
else if (read==336) {
// the original format... the first part of the data is valid, default any new fields
// no new fields yet :-)
return 1;
}
return 0;
}
bool GBCSolution::Solved()
{
return sln!=NULL;
}
void GBCSolution::Clear()
{
if (sln!=NULL) {
free(sln);
sln=NULL;
}
}
const char* GBCSolution::Name(void){
return param.name;
}
double GBCSolution::BC(void){
return param.bc;
}
double GBCSolution::SightHeight(void){
return param.sightheight;
}
int GBCSolution::DragFunction(void )
{
return param.df;
}
int GBCSolution::MuzzleVelocity(void){
return param.mv;
}
int GBCSolution::ShootingAngle(void){
return param.angle;
}
int GBCSolution::ZeroRange(void){
return param.zerorange;
}
int GBCSolution::WindSpeed(void){
return param.windspeed;
}
int GBCSolution::WindAngle(void){
return param.windangle;
}
int GBCSolution::Temp(void){
return param.temp;
}
double GBCSolution::Pressure(void){
return param.pressure;
}
int GBCSolution::Humidity(void){
return param.humidity;
}
int GBCSolution::Altitude(void){
return param.altitude;
}
double GBCSolution::GetRange(int yardage){
double size=sln[__BCOMP_MAXRANGE__*10+1];
if (yardage<size){
return sln[10*yardage];
}
else return 0;
}
double GBCSolution::GetPath(int yardage){
double size=sln[__BCOMP_MAXRANGE__*10+1];
if (yardage<size){
return sln[10*yardage+1];
}
else return 0;
}
double GBCSolution::GetMOA(int yardage){
double size=sln[__BCOMP_MAXRANGE__*10+1];
if (yardage<size){
return sln[10*yardage+2];
}
else return 0;
}
double GBCSolution::GetTime(int yardage){
double size=sln[__BCOMP_MAXRANGE__*10+1];
if (yardage<size){
return sln[10*yardage+3];
}
else return 0;
}
double GBCSolution::GetWindage(int yardage){
double size=sln[__BCOMP_MAXRANGE__*10+1];
if (yardage<size){
return sln[10*yardage+4];
}
else return 0;
}
double GBCSolution::GetWindageMOA(int yardage){
double size=sln[__BCOMP_MAXRANGE__*10+1];
if (yardage<size){
return sln[10*yardage+5];
}
else return 0;
}
double GBCSolution::GetVelocity(int yardage){
double size=sln[__BCOMP_MAXRANGE__*10+1];
if (yardage<size){
return sln[10*yardage+6];
}
else return 0;
}
double GBCSolution::GetVx(int yardage){
double size=sln[__BCOMP_MAXRANGE__*10+1];
if (yardage<size){
return sln[10*yardage+7];
}
else return 0;
}
double GBCSolution::GetVy(int yardage){
double size=sln[__BCOMP_MAXRANGE__*10+1];
if (yardage<size){
return sln[10*yardage+8];
}
else return 0;
}
double GBCSolution::GetDrop(int yardage){
double size=sln[__BCOMP_MAXRANGE__*10+1];
if (yardage<size){
return sln[10*yardage+9];
}
else return 0;
}
double GBCSolution::GetEnergy(int k){
return (double)param.weight*GetVelocity(k)*GetVelocity(k)/450436;
}
int GBCSolution::MaxRows(void){
return param.rows;
}
int GBCSolution::MaxRows(int mr){
param.rows=mr;
return param.rows;
}
int GBCSolution::Weight(void){
return param.weight;
}
int GBCSolution::UseWeather(void){
return param.ckweather;
}

59
GBCSolution.h

@ -4,6 +4,36 @@ @@ -4,6 +4,36 @@
#include "lib/ballistics/ballistics.h"
#include <stdio.h>
#include <string.h>
#include <stdint.h>
#pragma pack(4)
struct GBCSolutionFile {
// reserved data is a leftover from the original format which saved
// two pointers as part of the file. On 64-bit systems this changes
// the file format (as pointers are bigger) so now we have to do more work
uint32_t reserved1;
int df;
uint32_t reserved2;
char name[255];
int weight;
double bc;
double sightheight;
int mv;
int angle;
int zerorange;
int windspeed;
int windangle;
int temp;
int ckweather;
double pressure;
int humidity;
int altitude;
int rows;
};
#pragma pack()
class GBCSolution {
@ -30,11 +60,14 @@ class GBCSolution { @@ -30,11 +60,14 @@ class GBCSolution {
);
~GBCSolution();
int Save(FILE* f);
int Load(FILE* f);
bool Solved();
double* sln;
const char* Name(void);
double BC(void);
double SightHeight(void);
int DragFunction(void);
int MuzzleVelocity(void);
int ShootingAngle(void);
int ZeroRange(void);
@ -61,27 +94,11 @@ class GBCSolution { @@ -61,27 +94,11 @@ class GBCSolution {
double GetDrop(int yardage);
double GetEnergy(int yardage);
int df;
private:
double* solution;
char name[255];
int weight;
double bc;
double sightheight;
int mv;
int angle;
int zerorange;
int windspeed;
int windangle;
int temp;
int ckweather;
double pressure;
int humidity;
int altitude;
int rows;
void Clear();
double* sln;
GBCSolutionFile param;
};
#endif

3
GEBC.kdev4

@ -0,0 +1,3 @@ @@ -0,0 +1,3 @@
[Project]
Manager=KDevCustomMakeManager
Name=GEBC

20
GEBC.sln

@ -0,0 +1,20 @@ @@ -0,0 +1,20 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GEBC", "GEBC.vcxproj", "{0A18849B-44BF-3B99-0239-D99A8BD9FE04}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{0A18849B-44BF-3B99-0239-D99A8BD9FE04}.Debug|Win32.ActiveCfg = Debug|Win32
{0A18849B-44BF-3B99-0239-D99A8BD9FE04}.Debug|Win32.Build.0 = Debug|Win32
{0A18849B-44BF-3B99-0239-D99A8BD9FE04}.Release|Win32.ActiveCfg = Debug|Win32
{0A18849B-44BF-3B99-0239-D99A8BD9FE04}.Release|Win32.Build.0 = Debug|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

109
GEBC.vcxproj

@ -0,0 +1,109 @@ @@ -0,0 +1,109 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<Keyword>Win32Proj</Keyword>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<OutDir>$(SolutionDir)$(Configuration)\</OutDir>
<IntDir>$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>D:\src\libharu-2.1.0\include;D:\src\fltk-1.3.0;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<Optimization>Disabled</Optimization>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
<TargetMachine>MachineX86</TargetMachine>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<AdditionalLibraryDirectories>D:\src\libharu-2.1.0\lib_static;D:\src\fltk-1.3.0\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>libhpdf.lib;fltkd.lib;fltkformsd.lib;fltkgld.lib;fltkimagesd.lib;fltkjpegd.lib;fltkpngd.lib;fltkzlibd.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>D:\src\libharu-2.1.0\include;D:\src\fltk-1.3.0;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Link>
<TargetMachine>MachineX86</TargetMachine>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>libhpdf.lib;fltkd.lib;fltkformsd.lib;fltkgld.lib;fltkimagesd.lib;fltkjpegd.lib;fltkpngd.lib;fltkzlibd.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>D:\src\libharu-2.1.0\lib_static;D:\src\fltk-1.3.0\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<EntryPointSymbol>
</EntryPointSymbol>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="AboutWindow.cpp" />
<ClCompile Include="GBCSolution.cpp" />
<ClCompile Include="GNU_Ballistics.cpp" />
<ClCompile Include="InputWindow.cpp" />
<ClCompile Include="lib\ballistics\ballistics.cpp" />
<ClCompile Include="LicenseWindow.cpp" />
<ClCompile Include="PBRWindow.cpp" />
<ClCompile Include="PlotWindow.cpp" />
<ClCompile Include="RangeWindow.cpp" />
<ClCompile Include="TargetWindow.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="AboutWindow.h" />
<ClInclude Include="confdefs.h" />
<ClInclude Include="GBCSolution.h" />
<ClInclude Include="InputWindow.h" />
<ClInclude Include="lib\ballistics\ballistics.h" />
<ClInclude Include="lib\ballistics\internal.h" />
<ClInclude Include="LicenseWindow.h" />
<ClInclude Include="PBRWindow.h" />
<ClInclude Include="PlotWindow.h" />
<ClInclude Include="RangeWindow.h" />
<ClInclude Include="TargetWindow.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

84
GEBC.vcxproj.filters

@ -0,0 +1,84 @@ @@ -0,0 +1,84 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="AboutWindow.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="GBCSolution.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="GNU_Ballistics.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="InputWindow.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="LicenseWindow.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="PBRWindow.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="PlotWindow.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="RangeWindow.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="TargetWindow.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="lib\ballistics\ballistics.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="AboutWindow.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="confdefs.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="GBCSolution.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="InputWindow.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="LicenseWindow.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="PBRWindow.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="PlotWindow.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="RangeWindow.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="TargetWindow.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="lib\ballistics\ballistics.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="lib\ballistics\internal.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
</Project>

7
GEBC.vcxproj.user

@ -0,0 +1,7 @@ @@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LocalDebuggerCommandArguments>"D:\src\gebc\264 Remington Magnum 120gr.gbc"</LocalDebuggerCommandArguments>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
</Project>

31
GNU_Ballistics.cpp

@ -1,12 +1,39 @@ @@ -1,12 +1,39 @@
#include <FL/Fl.H>
#include <FL/Fl_Window.H>
#include "InputWindow.h"
using namespace std;
int main (int argc, char *argv[]){
#ifdef _WIN32
#include <windows.h>
int __stdcall WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
{
InputWindow win(400,500,"GNU Exterior Ballistics Computer (Windows)");
if (lpCmdLine && *lpCmdLine) {
if (*lpCmdLine == '"') {
char *c=lpCmdLine;
c++;
while (*c && *c!='"') c++;
if (c>lpCmdLine && *c == '"') {
*c='\0';
lpCmdLine++;
}
}
win.OpenFile(lpCmdLine);
}
return Fl::run();
}
#else
int main (int argc, char *argv[])
{
InputWindow win(400,500,"GNU Exterior Ballistics Computer");
if (argc==2) {
win.OpenFile(argv[1]);
}
return Fl::run();
}
#endif

1660
InputWindow.cpp

File diff suppressed because it is too large Load Diff

151
InputWindow.h

@ -3,23 +3,23 @@ @@ -3,23 +3,23 @@
#include "lib/ballistics/ballistics.h"
#include <FL/Fl.H>
#include <FL/Fl_Window.H>
#include <FL/Fl_Help_Dialog.H>
#include <FL/Fl_Output.H>
#include <FL/Fl_File_Chooser.H>
#include <FL/Fl_BMP_Image.H>
#include <FL/Fl_Button.H>
#include <FL/Fl_Input.H>
#include <FL/Fl_Round_Button.H>
#include <FL/Fl_Int_Input.H>
#include <FL/Fl_Float_Input.H>
#include <FL/Fl_Check_Button.H>
#include <FL/Fl_Menu_Item.H>
#include <FL/Fl_Menu_Bar.H>
#include <FL/Fl_Multiline_Output.H>
#include <FL/Fl_Box.H>
#include <FL/Fl_Text_Display.H>
#include <FL/Fl.H>
#include <FL/Fl_Window.H>
#include <FL/Fl_Help_Dialog.H>
#include <FL/Fl_Output.H>
#include <FL/Fl_File_Chooser.H>
#include <FL/Fl_BMP_Image.H>
#include <FL/Fl_Button.H>
#include <FL/Fl_Input.H>
#include <FL/Fl_Round_Button.H>
#include <FL/Fl_Int_Input.H>
#include <FL/Fl_Float_Input.H>
#include <FL/Fl_Check_Button.H>
#include <FL/Fl_Menu_Item.H>
#include <FL/Fl_Menu_Bar.H>
#include <FL/Fl_Multiline_Output.H>
#include <FL/Fl_Box.H>
#include <FL/Fl_Text_Display.H>
#include <stdlib.h>
#include <stdio.h>
@ -31,6 +31,8 @@ @@ -31,6 +31,8 @@
#include "PlotWindow.h"
#include "TargetWindow.h"
#define MEM_SLOTS 8
class InputWindow : public Fl_Window{
public:
@ -39,34 +41,17 @@ class InputWindow : public Fl_Window{ @@ -39,34 +41,17 @@ class InputWindow : public Fl_Window{
void OpenFile(char *fname);
Fl_Button* btSolve;
Fl_Button* btSolve;
Fl_Button* btReset;
Fl_Button* btStdAtmosphere;
Fl_Button* btShowChart;
Fl_Button* btPlot;
Fl_Button* btCompare;
Fl_Button* btSaveSolution;
Fl_Button* btLoadSolution;
double* Solution;
double* Smem1;
double* Smem2;
double* Smem3;
double* Smem4;
double* Smem5;
double* Smem6;
double* Smem7;
double* Smem8;
Fl_Button* btSaveSolution;
Fl_Button* btLoadSolution;
GBCSolution* gsln;
GBCSolution* mem1;
GBCSolution* mem2;
GBCSolution* mem3;
GBCSolution* mem4;
GBCSolution* mem5;
GBCSolution* mem6;
GBCSolution* mem7;
GBCSolution* mem8;
GBCSolution* mem[MEM_SLOTS+1];
int useSolution;
@ -81,12 +66,12 @@ class InputWindow : public Fl_Window{ @@ -81,12 +66,12 @@ class InputWindow : public Fl_Window{
Fl_Check_Button* ckWeather;
Fl_Input* inName;
Fl_Int_Input* inWeight;
Fl_Float_Input* inBC;
Fl_Float_Input* inBC;
Fl_Float_Input* inSH;
Fl_Int_Input* inMV;
Fl_Int_Input* inAngle;
Fl_Int_Input* inAngle;
Fl_Float_Input* inZero;
Fl_Int_Input* inVwind;
Fl_Int_Input* inVwind;
Fl_Int_Input* inAwind;
Fl_Int_Input* inTemp; Fl_Float_Input* inPressure;
Fl_Int_Input* inHumidity;
@ -95,47 +80,45 @@ class InputWindow : public Fl_Window{ @@ -95,47 +80,45 @@ class InputWindow : public Fl_Window{
Fl_Menu_Bar *menu;
Fl_Menu_Item *pmenuitems;
// Menu Item Declarations.
Fl_Menu_Item m_File;
Fl_Menu_Item mc_New;
Fl_Menu_Item mc_Open;
Fl_Menu_Item mc_Save;
Fl_Menu_Item mc_Export;
Fl_Menu_Item mc_Quit;
Fl_Menu_Item m_Edit;
Fl_Menu_Item mc_Copy;
Fl_Menu_Item mc_Paste;
Fl_Menu_Item mc_Options;
Fl_Menu_Item m_Analyze;
Fl_Menu_Item mc_Table;
Fl_Menu_Item mc_Plot;
Fl_Menu_Item mc_Target;
Fl_Menu_Item mc_Compare;
Fl_Menu_Item m_Aids;
Fl_Menu_Item mc_RangeCard;
Fl_Menu_Item mc_ClickChart;
Fl_Menu_Item mc_RangeTable;
Fl_Menu_Item m_Solution;
Fl_Menu_Item mc_Solve;
Fl_Menu_Item mc_Data;
Fl_Menu_Item mc_Advanced;
// Menu Item Declarations.
Fl_Menu_Item m_File;
Fl_Menu_Item mc_New;
Fl_Menu_Item mc_Open;
Fl_Menu_Item mc_Save;
Fl_Menu_Item mc_Export;
Fl_Menu_Item mc_Quit;
Fl_Menu_Item m_Edit;
Fl_Menu_Item mc_Copy;
Fl_Menu_Item mc_Paste;
Fl_Menu_Item mc_Options;
Fl_Menu_Item m_Help;
Fl_Menu_Item mc_Help;
Fl_Menu_Item mc_License;
Fl_Menu_Item mc_About;
Fl_Menu_Item mc_Bug;
Fl_Multiline_Output* oStatus;
Fl_Menu_Item m_Analyze;
Fl_Menu_Item mc_Table;
Fl_Menu_Item mc_Plot;
Fl_Menu_Item mc_Target;
Fl_Menu_Item mc_Compare;
Fl_Menu_Item m_Aids;
Fl_Menu_Item mc_RangeCard;
Fl_Menu_Item mc_ClickChart;
Fl_Menu_Item mc_RangeTable;
Fl_Menu_Item m_Solution;
Fl_Menu_Item mc_Solve;
Fl_Menu_Item mc_Data;
Fl_Menu_Item mc_Advanced;
Fl_Menu_Item m_Help;
Fl_Menu_Item mc_Help;
Fl_Menu_Item mc_License;
Fl_Menu_Item mc_About;
Fl_Menu_Item mc_Bug;
Fl_Multiline_Output* oStatus;
// Fl_Menu_Item mc_Store1,mc_Store2, mc_Store3, mc_Store4, mc_Store5;
// FL Outputs
Fl_Output* out;
// FL Outputs
Fl_Output* out;
private:
static void cb_Solve(Fl_Widget*, void*);
@ -162,6 +145,7 @@ class InputWindow : public Fl_Window{ @@ -162,6 +145,7 @@ class InputWindow : public Fl_Window{
static void cb_Target(Fl_Widget*, void*);
static void cb_Options(Fl_Widget*, void*);
static void StoreMem(Fl_Widget* o, void* v, int mslot);
static void cb_Store1(Fl_Widget*, void*);
static void cb_Store2(Fl_Widget*, void*);
static void cb_Store3(Fl_Widget*, void*);
@ -171,15 +155,10 @@ class InputWindow : public Fl_Window{ @@ -171,15 +155,10 @@ class InputWindow : public Fl_Window{
static void cb_Store7(Fl_Widget*, void*);
static void cb_Store8(Fl_Widget*, void*);
static void cb_PBR(Fl_Widget*, void*);
void Paste(void);
void Copy(void);
};

6
LicenseWindow.cpp

File diff suppressed because one or more lines are too long

2
PBRWindow.cpp

@ -7,7 +7,7 @@ PBRWindow::PBRWindow(InputWindow* IW):Fl_Window(250,300,"Optimize Point Blank Ra @@ -7,7 +7,7 @@ PBRWindow::PBRWindow(InputWindow* IW):Fl_Window(250,300,"Optimize Point Blank Ra
begin();
CD = new Fl_Float_Input(30,20,60,25,"Drag Coefficient");
CD = new Fl_Float_Input(30,20,60,25,"Ballistic Coefficient");
VI = new Fl_Int_Input(30,50,60,25,"Initial Velocity (ft/s)");
SH = new Fl_Float_Input(30,80,60,25,"Sight Height (inches)");
VitalSize = new Fl_Float_Input(30,110,60,25,"Vital Zone Size (inches)");

710
PlotWindow.cpp

@ -7,52 +7,61 @@ @@ -7,52 +7,61 @@
#define PT_ENERGY 4
#define PT_WINDAGE 5
PlotWindow::PlotWindow(int w, int h, GBCSolution* Gsln, GBCSolution* GMEM1, GBCSolution* GMEM2, GBCSolution* GMEM3) : Fl_Window(w,h,"Solution Visualization Tools"){
// Store a pointer to the calling solution.
gsln=Gsln;
mem1=GMEM1;
mem2=GMEM2;
PlotWindow::PlotWindow(int w, int h, GBCSolution* Gsln, GBCSolution* GMEM1, GBCSolution* GMEM2, GBCSolution* GMEM3) : Fl_Window(w,h,"Solution Visualization Tools"){
// Store a pointer to the calling solution.
gsln=Gsln;
mem1=GMEM1;
mem2=GMEM2;
mem3=GMEM3;
x_click=0;
y_click=0;
begin();
this->size_range(0,0,1600,1600);
// Put a simple menu, for saving or closing the window.
menu = new Fl_Menu_Bar(0,0,w,25,"MENU");
Fl_Menu_Item items[]= {
{"&File",0,0,0,FL_SUBMENU},
{"Save as..",0,0,0,FL_SUBMENU | FL_MENU_INACTIVE},
{"PNG (.png)",0,(Fl_Callback*)cb_nothing,this,0},
{"JPEG (.jpg)",0,(Fl_Callback*)cb_nothing,this,0},
{"Bitmap (.bmp)",0,(Fl_Callback*)cb_nothing,this,0},
{"Adobe PDF (.pdf)",0,(Fl_Callback*)cb_nothing,this,0},
{0},
{"&Close",0,(Fl_Callback*)cb_Close,this,0},
{0},
{0}
};
menu->copy(items);
menu->down_box(FL_NO_BOX);
// Put in a range slider for selecting the chart's range.
sl_x = new Fl_Value_Slider(150,30,350,30,"Range (yds)");
sl_x->align(FL_ALIGN_RIGHT);
sl_x->value(200);
sl_x->minimum(50);
sl_x->maximum(gsln->MaxRows());
sl_x->type(FL_HOR_NICE_SLIDER);
sl_x->callback(cb_slUpdate,this);
sl_x->precision(0);
sl_x->step(10);
//Fl_Button* btPlot = new Fl_Button(600,40,70,30,"UPDATE");
//btPlot->callback(cb_btPlot,this);
x_click=0;
y_click=0;
begin();
this->size_range(0,0,1600,1600);
// Put a simple menu, for saving or closing the window.
menu = new Fl_Menu_Bar(0,0,w,25,"MENU");
Fl_Menu_Item items[]= {
{"&File",0,0,0,FL_SUBMENU},
{"Save as..",0,0,0,FL_SUBMENU | FL_MENU_INACTIVE},
{"PNG (.png)",0,(Fl_Callback*)cb_nothing,this,0},
{"JPEG (.jpg)",0,(Fl_Callback*)cb_nothing,this,0},
{"Bitmap (.bmp)",0,(Fl_Callback*)cb_nothing,this,0},
{"Adobe PDF (.pdf)",0,(Fl_Callback*)cb_nothing,this,0},
{0},
{"&Close",0,(Fl_Callback*)cb_Close,this,0},
{0},
{0}
};
menu->copy(items);
menu->down_box(FL_NO_BOX);
// Put in a range slider for selecting the chart's range.
sl_x = new Fl_Value_Slider(150,30,350,30,"Range (yds)");
sl_x->align(FL_ALIGN_RIGHT);
sl_x->maximum(gsln->MaxRows());
sl_x->type(FL_HOR_NICE_SLIDER);
sl_x->callback(cb_slUpdate,this);
sl_x->precision(0);
// Normal firearms are ok with this
if (gsln->MaxRows() > 200) {
sl_x->step(10);
sl_x->minimum(50);
sl_x->value(200);
}
else { // low velocity / power such as tranquiliser darts, paintballs?
sl_x->step(5);
sl_x->minimum(30);
sl_x->value(50);
}
//Fl_Button* btPlot = new Fl_Button(600,40,70,30,"UPDATE");
//btPlot->callback(cb_btPlot,this);
Fl_Menu_Item guideitems[]={
{"None",0,(Fl_Callback*)cb_Guides, this, 0},
@ -66,33 +75,37 @@ PlotWindow::PlotWindow(int w, int h, GBCSolution* Gsln, GBCSolution* GMEM1, GBCS @@ -66,33 +75,37 @@ PlotWindow::PlotWindow(int w, int h, GBCSolution* Gsln, GBCSolution* GMEM1, GBCS
{"2-10,20 MOA",0,(Fl_Callback*)cb_Guides, this, 0},
{"1-5 Degrees",0,(Fl_Callback*)cb_Guides, this, 0},
{"5,10,15 Degree",0,(Fl_Callback*)cb_Guides, this, 0},
{"10,20,30,40,50 Digisight N750 clicks",0,(Fl_Callback*)cb_Guides, this, 0},
{"10,20..90 Digisight N750 clicks",0,(Fl_Callback*)cb_Guides, this, 0},
{"10,20,30,40,50 Digisight N960 clicks",0,(Fl_Callback*)cb_Guides, this, 0},
{"10,20..90 Digisight N960 clicks",0,(Fl_Callback*)cb_Guides, this, 0},
{0}
};
cScopeGuides = new Fl_Choice(290,65,150,30,"Scope Guides");
cScopeGuides->copy(guideitems);
cScopeGuides->value(1);
btMem1 = new Fl_Check_Button(590,30,20,20,"Memory 1");
btMem2 = new Fl_Check_Button(590,50,20,20,"Memory 2");
btMem3 = new Fl_Check_Button(590,70,20,20,"Memory 3");
btMem1->align(FL_ALIGN_RIGHT);
btMem2->align(FL_ALIGN_RIGHT);
btMem3->align(FL_ALIGN_RIGHT);
btMem1->labelcolor(FL_RED);
btMem2->labelcolor(FL_DARK_GREEN);
btMem3->labelcolor(FL_BLACK);
btMem1->callback(cb_Mem1,this);
btMem2->callback(cb_Mem2,this);
btMem3->callback(cb_Mem2,this);
if (mem1==NULL) btMem1->deactivate();
if (mem2==NULL) btMem2->deactivate();
if (mem3==NULL) btMem3->deactivate();
if (mem1!=NULL) btMem1->tooltip(mem1->Name());
if (mem2!=NULL) btMem2->tooltip(mem2->Name());
if (mem3!=NULL) btMem3->tooltip(mem3->Name());
btMem1 = new Fl_Check_Button(590,30,20,20,"Memory 1");
btMem2 = new Fl_Check_Button(590,50,20,20,"Memory 2");
btMem3 = new Fl_Check_Button(590,70,20,20,"Memory 3");
btMem1->align(FL_ALIGN_RIGHT);
btMem2->align(FL_ALIGN_RIGHT);
btMem3->align(FL_ALIGN_RIGHT);
btMem1->labelcolor(FL_RED);
btMem2->labelcolor(FL_DARK_GREEN);
btMem3->labelcolor(FL_BLACK);
btMem1->callback(cb_Mem1,this);
btMem2->callback(cb_Mem2,this);
btMem3->callback(cb_Mem2,this);
if (mem1==NULL) btMem1->deactivate();
if (mem2==NULL) btMem2->deactivate();
if (mem3==NULL) btMem3->deactivate();
if (mem1!=NULL) btMem1->tooltip(mem1->Name());
if (mem2!=NULL) btMem2->tooltip(mem2->Name());
if (mem3!=NULL) btMem3->tooltip(mem3->Name());
Fl_Menu_Item plottypeitems[]={
{"Path (inches)",0,(Fl_Callback*)cb_PlotType, this, 0},
{"Drop (inches)",0,(Fl_Callback*)cb_PlotType, this, 0},
@ -105,32 +118,32 @@ PlotWindow::PlotWindow(int w, int h, GBCSolution* Gsln, GBCSolution* GMEM1, GBCS @@ -105,32 +118,32 @@ PlotWindow::PlotWindow(int w, int h, GBCSolution* Gsln, GBCSolution* GMEM1, GBCS
cPlotType = new Fl_Choice(35,65,130,30,"Plot");
cPlotType->copy(plottypeitems);
cPlotType->value(0);
end();
show();
}
PlotWindow::~PlotWindow(void){
delete menu;
delete sl_x;
delete btMem1;
delete btMem2;
delete btMem3;
end();
show();
}
PlotWindow::~PlotWindow(void){
delete menu;
delete sl_x;
delete btMem1;
delete btMem2;
delete btMem3;
delete cScopeGuides;
delete cPlotType;
}
void PlotWindow::draw(void){
// Let the window draw itself first.
Fl_Window::draw();
}
void PlotWindow::draw(void){
// Let the window draw itself first.
Fl_Window::draw();
switch (cPlotType->value()) {
case PT_PATH : PlotPath(PT_PATH); break;
case PT_DROP : PlotPath(PT_DROP); break;
@ -139,24 +152,24 @@ void PlotWindow::draw(void){ @@ -139,24 +152,24 @@ void PlotWindow::draw(void){
case PT_HVELOCITY:PlotVelocity(PT_HVELOCITY);break;
case PT_WINDAGE: PlotPath(PT_WINDAGE); break;
}
}
int PlotWindow::handle(int evt){
if (evt==FL_PUSH && Fl::event_button1()){
x_click=Fl::event_x();
y_click=Fl::event_y();
this->redraw();
}
return Fl_Window::handle(evt);
}
}
int PlotWindow::handle(int evt){
if (evt==FL_PUSH && Fl::event_button1()){
x_click=Fl::event_x();
y_click=Fl::event_y();
this->redraw();
}
return Fl_Window::handle(evt);
}
/*
PlotMem()
@ -263,29 +276,30 @@ void PlotWindow::SetupPlot(void){ @@ -263,29 +276,30 @@ void PlotWindow::SetupPlot(void){
y_scale = (double)(ymax-ymin) / (double)y_range;
// The gridlines look best with 15-25 graduations in x, so we set some basic defaults here.
x_ticks=25;
x_ticks=10;
if (sl_x->value() > 100) x_ticks=25;
if (sl_x->value() > 500) x_ticks=50;
if (sl_x->value() > 1000) x_ticks=100;
if (sl_x->value() > 2000) x_ticks=250;
if (sl_x->value() > 4000) x_ticks=500;
// The y-axis looks best with about 7-12 ticks, so we scale it here reasonably.
y_ticks=1;
if (y_range > 10) y_ticks=2;
if (y_range > 20) y_ticks=6;
if (y_range > 40) y_ticks=12;
if (y_range > 80) y_ticks=24;
if (y_range > 200) y_ticks=48;
if (y_range > 400) y_ticks=100;
if (y_range > 800) y_ticks=250;
if (y_range > 1600) y_ticks=500;
if (y_range > 3200) y_ticks=1000;
if (y_range > 6400) y_ticks=2000;