Skip to content
This repository has been archived by the owner on Jun 16, 2024. It is now read-only.

Commit

Permalink
Removed gui.ini related code. Closes #1
Browse files Browse the repository at this point in the history
tecnd committed Sep 24, 2021
1 parent 6ff08b3 commit afd3174
Showing 4 changed files with 10 additions and 81 deletions.
82 changes: 7 additions & 75 deletions GUIDesign.c
Original file line number Diff line number Diff line change
@@ -1145,26 +1145,10 @@ void UpdateScanValue(int Reset)
//*****************************************************************************************
void LoadSettings(void)
{
int status;
//If .ini exists, then open the file dialog. Else just open the file dialog. Add a method to load
//last used settings on program startup.
FILE *fpini;
char c, fsavename[500] = "";
static char defaultdir[200] = "C:\\UserDate\\Data";

//Check if .ini file exists. Load it if it does.
if (!(fpini = fopen("gui.ini", "r")) == NULL)
{
char fname[100] = "";
int inisize = 0;
while (fscanf(fpini, "%c", &c) != -1)
fname[inisize++] = c; //Read the contained name
}
fclose(fpini);

char fsavename[500];
// prompt for a file, if selected then load the Panel and Arrays
status = FileSelectPopup(defaultdir, "*.pan", "", "Load Settings", VAL_LOAD_BUTTON, 0, 0, 1, 1, fsavename);
if (!(status == 0))
int status = FileSelectPopupEx("C:\\UserDate\\Data", "*.pan", "", "Load Settings", VAL_LOAD_BUTTON, 0, 0, fsavename);
if (status != VAL_NO_FILE_SELECTED)
{
RecallPanelState(PANEL, fsavename, 1);
LoadArrays(fsavename, strlen(fsavename));
@@ -1173,76 +1157,24 @@ void LoadSettings(void)
{
MessagePopup("File Error", "No file was selected");
}

DrawNewTable(0);
strcpy(defaultdir, "");
}
//*****************************************************************************************
void LoadLastSettings(int check)
{
//If .ini exists, then open the file dialog. Else just open the file dialog. Add a method to load
//last used settings on program startup.
FILE *fpini = fopen("gui.ini", "r");
char c = 0, fname[100] = "", loadname[100] = "";
int inisize = 0;
//Check if .ini file exists. Load it if it does.
if (fpini)
{
while (fscanf(fpini, "%c", &c) != -1)
fname[inisize++] = c; //Read the contained name
fclose(fpini);
c = fname[inisize - 1];
strncpy(loadname, fname, inisize - 2);
}
if ((check == 0) || (c == 49)) // 49 is the ascii code for "1"
{
RecallPanelState(PANEL, loadname, 1);
LoadArrays(fname, strlen(loadname));
}
DrawNewTable(0);
}
//*****************************************************************************************

void SaveSettings(void)
/* Modified:
Feb 09, 2006 Clear the Debug box before saving. (was causing insanely large save files, and slowed down loading of old panels.)
*/
{
// Save settings: First look for file .ini This will be a simple 1 line file staating the name of the last file
//saved. Load this up and use as the starting name in the file dialog.
FILE *fpini;
char c, fsavename[500] = "";
static char defaultdir[200] = "C:\\UserDate\\Data";
int status, loadonboot = 0;
//Check if .ini file exists. Load it if it does.
if (!(fpini = fopen("gui.ini", "r")) == NULL) // if "gui.ini" exists, then read it Just contains a filename.
{ //If not, do nothing
char fname[100] = "";
int inisize = 0;
while (fscanf(fpini, "%c", &c) != -1)
fname[inisize++] = c; //Read the contained name
}
fclose(fpini);

status = FileSelectPopup(defaultdir, "*.pan", "", "Save Settings", VAL_SAVE_BUTTON, 0, 0, 1, 1, fsavename);
GetMenuBarAttribute(menuHandle, MENU_FILE_BOOTLOAD, ATTR_CHECKED, &loadonboot);
if (!(status == 0))
char fsavename[500] = "";

int status = FileSelectPopupEx("C:\\UserDate\\Data", "*.pan", "", "Save Settings", VAL_SAVE_BUTTON, 0, 0, fsavename);
if (status != VAL_NO_FILE_SELECTED)
{
ClearListCtrl(panelHandle, PANEL_DEBUG); // added Feb 09, 2006
SavePanelState(PANEL, fsavename, 1);
if (!(fpini = fopen("gui.ini", "w")) == NULL)
{
fprintf(fpini, fsavename);
fprintf(fpini, "\n%d", loadonboot);
}
fclose(fpini);
SaveArrays(fsavename, strlen(fsavename));
}
else
{
MessagePopup("File Error", "No file was selected");
}
strcpy(defaultdir, "");
}
// Helper function to alternate color every three rows
int ColorPicker(int index)
6 changes: 3 additions & 3 deletions GUIDesign.prj
Original file line number Diff line number Diff line change
@@ -608,7 +608,7 @@ Config Name = "Release"
Is 64-Bit = False
Is Release = True
Default Calling Convention = "cdecl"
Optimization Level = "No optimizations"
Optimization Level = "Optimize for speed (level 3)"
Require Prototypes = True
Show Warning IDs in Build Output = False
Selected Warning Level = "None"
@@ -627,7 +627,7 @@ Enable Unreachable Code Warning = False
Enable Assignment In Conditional Warning = False
Uninitialized Locals Compile Warning = "Aggressive"
Require Return Values = True
Enable C99 Extensions = False
Enable C99 Extensions = True
Enable OpenMP Extensions = False
Stack Size = 16000000
Stack Reserve = 16777216
@@ -874,7 +874,7 @@ Enable Pointer Mismatch Warning = False
Enable Unreachable Code Warning = False
Enable Unreferenced Identifiers Warning = False
Enable Assignment In Conditional Warning = False
Enable C99 Extensions = False
Enable C99 Extensions = True
Uninitialized Locals Compile Warning = "Aggressive"
Precompile Prefix Header = False
Prefix Header File = ""
1 change: 0 additions & 1 deletion GUIDesign2.h
Original file line number Diff line number Diff line change
@@ -5,7 +5,6 @@

void LoadSettings(void);
void SaveSettings(void);
void LoadLastSettings(int check);
void ShiftColumn3(int col, int page,int dir);
void RunOnce(void);
int GetPage(void);
2 changes: 0 additions & 2 deletions gui.ini

This file was deleted.

0 comments on commit afd3174

Please sign in to comment.