Browse Source

Dropped gicon sources, get it at https://archive.org/details/gicon-0.1.2

master
squeaky otter 2 months ago
parent
commit
6e75b655dd
70 changed files with 0 additions and 18009 deletions
  1. +0
    -1
      README.md
  2. +0
    -45
      docs/gicon-0.1.2/INSTALL
  3. +0
    -33
      docs/gicon-0.1.2/Makefile
  4. +0
    -49
      docs/gicon-0.1.2/common.h
  5. +0
    -582
      docs/gicon-0.1.2/file.c
  6. +0
    -75
      docs/gicon-0.1.2/file.h
  7. +0
    -747
      docs/gicon-0.1.2/gui.controls.c
  8. +0
    -532
      docs/gicon-0.1.2/gui.main.c
  9. +0
    -26
      docs/gicon-0.1.2/gui.main.h
  10. +0
    -581
      docs/gicon-0.1.2/gui.memoholder.c
  11. +0
    -168
      docs/gicon-0.1.2/gui.notebook.c
  12. +0
    -51
      docs/gicon-0.1.2/gui.notebook.h
  13. +0
    -176
      docs/gicon-0.1.2/gui.preferences.c
  14. +0
    -25
      docs/gicon-0.1.2/gui.preferences.h
  15. +0
    -314
      docs/gicon-0.1.2/gui.print.c
  16. +0
    -29
      docs/gicon-0.1.2/gui.print.h
  17. +0
    -382
      docs/gicon-0.1.2/gui.settings.c
  18. +0
    -4596
      docs/gicon-0.1.2/gui.xml
  19. BIN
      docs/gicon-0.1.2/help/controls/bracketing.gif
  20. BIN
      docs/gicon-0.1.2/help/controls/camera.gif
  21. BIN
      docs/gicon-0.1.2/help/controls/exposure.gif
  22. BIN
      docs/gicon-0.1.2/help/controls/film.gif
  23. BIN
      docs/gicon-0.1.2/help/controls/flash.gif
  24. +0
    -195
      docs/gicon-0.1.2/help/controls/index.html
  25. BIN
      docs/gicon-0.1.2/help/controls/lens.gif
  26. BIN
      docs/gicon-0.1.2/help/controls/misc.gif
  27. BIN
      docs/gicon-0.1.2/help/controls/toolbar.gif
  28. BIN
      docs/gicon-0.1.2/help/gicon.logo.jpg
  29. +0
    -145
      docs/gicon-0.1.2/help/index.html
  30. +0
    -303
      docs/gicon-0.1.2/help/license.html
  31. BIN
      docs/gicon-0.1.2/help/main/custom.gif
  32. BIN
      docs/gicon-0.1.2/help/main/download.gif
  33. +0
    -236
      docs/gicon-0.1.2/help/main/index.html
  34. BIN
      docs/gicon-0.1.2/help/main/lcd.blink.gif
  35. BIN
      docs/gicon-0.1.2/help/main/main.gif
  36. BIN
      docs/gicon-0.1.2/help/main/preview.gif
  37. BIN
      docs/gicon-0.1.2/help/main/toolbar.gif
  38. BIN
      docs/gicon-0.1.2/help/print/controls.gif
  39. +0
    -112
      docs/gicon-0.1.2/help/print/index.html
  40. BIN
      docs/gicon-0.1.2/help/print/label.gif
  41. BIN
      docs/gicon-0.1.2/help/print/print.gif
  42. +0
    -83
      docs/gicon-0.1.2/help/properties/index.html
  43. BIN
      docs/gicon-0.1.2/help/properties/preferences.gif
  44. BIN
      docs/gicon-0.1.2/help/settings/af.transmission.gif
  45. BIN
      docs/gicon-0.1.2/help/settings/basic.gif
  46. BIN
      docs/gicon-0.1.2/help/settings/beep.gif
  47. +0
    -264
      docs/gicon-0.1.2/help/settings/index.html
  48. BIN
      docs/gicon-0.1.2/help/settings/memoholder.gif
  49. BIN
      docs/gicon-0.1.2/help/settings/misc.gif
  50. BIN
      docs/gicon-0.1.2/help/settings/toolbar.gif
  51. BIN
      docs/gicon-0.1.2/help/settings/viewfinder.gif
  52. +0
    -102
      docs/gicon-0.1.2/help/status/index.html
  53. BIN
      docs/gicon-0.1.2/help/status/roll.gif
  54. BIN
      docs/gicon-0.1.2/help/status/status.gif
  55. BIN
      docs/gicon-0.1.2/help/status/toolbar.gif
  56. +0
    -1192
      docs/gicon-0.1.2/nkn.c
  57. +0
    -187
      docs/gicon-0.1.2/nkn.h
  58. +0
    -36
      docs/gicon-0.1.2/pixmaps/controls.xpm
  59. +0
    -98
      docs/gicon-0.1.2/pixmaps/focus.xpm
  60. +0
    -5093
      docs/gicon-0.1.2/pixmaps/gicon.logo.xpm
  61. +0
    -297
      docs/gicon-0.1.2/pixmaps/label.scale.xpm
  62. +0
    -78
      docs/gicon-0.1.2/pixmaps/release.xpm
  63. +0
    -31
      docs/gicon-0.1.2/pixmaps/settings.xpm
  64. +0
    -418
      docs/gicon-0.1.2/pixmaps/status.xpm
  65. +0
    -309
      docs/gicon-0.1.2/print.c
  66. +0
    -51
      docs/gicon-0.1.2/print.h
  67. +0
    -141
      docs/gicon-0.1.2/tty.c
  68. +0
    -71
      docs/gicon-0.1.2/tty.h
  69. +0
    -124
      docs/gicon-0.1.2/util.c
  70. +0
    -31
      docs/gicon-0.1.2/util.h

+ 0
- 1
README.md View File

@ -54,7 +54,6 @@ make CC=clang++ CXX=clang++
See the folder `docs/`.
- Text files about the DataLink protocol (packet format, etc.)
- `N90 Buddy for Palm Souce` source code for a PalmOS 3.x app
- `gicon-0.1.2` source code for a very old (gtk1-era) linux app, uses `tty` for serial comm
## Example


+ 0
- 45
docs/gicon-0.1.2/INSTALL View File

@ -1,45 +0,0 @@
Installation Instructions for GICON
------------------------------------------------------------------------
STEP 1 - Unzip and untar the tarball
$ gzip -d gIcon-0.1.0.tgz
$ tar xvf gIcon-0.1.0.tar
This will create a directory called gIcon-0.1.0 in your working directory
------------------------------------------------------------------------
STEP 2 - Specify the install directory
Edit the Makefile by changing the INSTALL variable
to the desired install directory.
INSTALL = /opt/gicon
------------------------------------------------------------------------
STEP 3 - Type make in the command prompt
This will complie the source code. You will need GTK newer than 1.2.8,
and Gnome Glade 0.5.8 installed.
------------------------------------------------------------------------
STEP 4 - Type make install in the command prompt
This will copy all the neccesary files into the specified install
directory.
------------------------------------------------------------------------
STEP 5 - Edit your .profile
Add the following lines to you profile:
GICON_HOME=/opt/gicon - the install directory
GICON_HELP_BROWSER=netscape - the browser used to visualze the help
export GICON_HOME GICON_HELP_BROWSER
PATH=/opt/gicon:$PATH
------------------------------------------------------------------------
STEP 6 - Remove source code from your working directory, optional
rm -rf gIcon-0.1.0

+ 0
- 33
docs/gicon-0.1.2/Makefile View File

@ -1,33 +0,0 @@
INSTALL = /opt/gicon
CC = gcc
CFLAGS = -g -Wall `gnome-config --cflags gnome gnomeui libglade`
LDFLAGS = `gnome-config --libs gnome gnomeui libglade`
LIBS = -L/usr/lib/
OBJS = util.o tty.o nkn.o file.o print.o \
gui.preferences.o gui.controls.o gui.settings.o \
gui.main.o gui.notebook.o gui.print.o gui.memoholder.o
PROGRAM = gicon
all: $(OBJS)
gcc $(LDFLAGS) $(OBJS) $(LIBS) -g -lm -o $(PROGRAM)
clean:
rm -f *.o *~ core
tags:
cd $(HOME)Projects/gicon-0.1.2; find . | xargs etags -o TAGS
id:
cd $(HOME)/Projects/gicon-0.1.2; mkid -m $(HOME)/share/id-lang.map -o ID *
install:
mkdir $(INSTALL); \
cp -R help $(INSTALL); \
cp -R pixmaps $(INSTALL); \
cp gicon gui.xml $(INSTALL);
uninstall:
rm -rf $(INSTALL); \
rm $(HOME)/.gicon

+ 0
- 49
docs/gicon-0.1.2/common.h View File

@ -1,49 +0,0 @@
/*
common.h
Copyright (C) 2002 Balint Kis (balint.kis@mail.com)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef _COMMON_H
#define _COMMON_H
#define OK 0
#define FAIL 1
#define FALSE 0
#define TRUE 1
#define DISABLE 0
#define ENABLE 1
typedef signed char sint8;
typedef unsigned char uint8;
typedef signed int sint16;
typedef unsigned int uint16;
typedef signed long sint32;
typedef unsigned long uint32;
#if 0
# define DEBUG(a) { printf a; }
#else
# define DEBUG(a)
#endif
#endif

+ 0
- 582
docs/gicon-0.1.2/file.c View File

@ -1,582 +0,0 @@
/*
file.c
Copyright (C) 2002 Balint Kis (balint.kis@mail.com)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <string.h>
#include <stdio.h>
#include <time.h>
#include "nkn.h"
#include "print.h"
#include "file.h"
#include "util.h"
#include "gui.print.h"
#include "gui.preferences.h"
extern tNKN_DataArray rpNKN_ProgramMode[];
extern tNKN_DataArray rpNKN_LightMetering[];
extern tNKN_DataArray rpNKN_FlashMode[];
extern tNKN_DataArray rpNKN_Compensation[];
extern tNKN_DataArray rpCameraIsoFilmSpeed[];
extern tNKN_DataArray rpCameraExposureEffective[];
extern tNKN_DataArray rpCameraApertureEffective[];
extern tNKN_DataArray rpCameraFocusDistance[];
extern tNKN_DataArray rpCameraIsoFilmSpeed[];
extern tNKN_DataArray rpCameraExposureEffective[];
extern tNKN_DataArray rpCameraApertureEffective[];
extern tNKN_DataArray rpCameraFocusDistance[];
extern tFileFormat geDefaultFileFormat;
void vReadNKNString (FILE *, uint8 *);
void vWriteNKNString (FILE *, uint8 *);
void vGetData (uint8 *, uint8, uint8 *);
uint16 ui16DetectFileTypeByFileName (uint8 *, tFileFormat *);
uint16 ui16DetectFileTypeByFileContent(uint8 *, tFileFormat *);
uint16 ui16OpenNKN_File (uint8 *, tRoll *);
uint16 ui16OpenTXT_File (uint8 *, tRoll *);
uint16 ui16SaveNKN_File (uint8 *, tRoll *);
uint16 ui16SaveTXT_File (uint8 *, tRoll *);
void vGetData(uint8 *pui8Source, uint8 ui8WordNumber, uint8 *pui8Result) {
uint16 ui8CharIndex = 0;
uint16 ui16FirstCharIndex = 0;
uint8 ui8WordIndex = 0;
/* seek for the separator */
if (ui8WordNumber > 0) {
for (ui8CharIndex = 0 ; pui8Source[ui8CharIndex] != '\n'; ui8CharIndex++) {
if (pui8Source[ui8CharIndex] == '\t') {
ui8WordIndex++;
if (ui8WordIndex == ui8WordNumber)
break;
}
}
ui16FirstCharIndex = ++ui8CharIndex;
}
/* scan until the next separator */
for (; pui8Source[ui8CharIndex] != '\n'; ui8CharIndex++) {
if ((pui8Source[ui8CharIndex] == '\t') ||
(pui8Source[ui8CharIndex] == '\0') ||
(pui8Source[ui8CharIndex] == '\r')) {
ui8WordIndex++;
if (ui8WordIndex == (ui8WordNumber + 1))
break;
}
pui8Result[ui8CharIndex - ui16FirstCharIndex] = pui8Source[ui8CharIndex];
}
/* add null character to the end of the string */
pui8Result[ui8CharIndex - ui16FirstCharIndex] = '\0';
}
void vReadNKNString(FILE *pFileDescriptor, uint8 *pui8String) {
uint8 ui8Length = fgetc(pFileDescriptor);
fread(pui8String, ui8Length, 1, pFileDescriptor);
pui8String[ui8Length] = '\0';
}
void vWriteNKNString(FILE *pFileDescriptor, uint8 *pui8String) {
uint8 ui8Length = strlen(pui8String);
fwrite(&ui8Length, 1, 1, pFileDescriptor);
fwrite(pui8String, ui8Length, 1, pFileDescriptor);
}
uint16 ui16OpenFile(uint8 *pui8FileName, tRoll *prRoll) {
uint16 ui16EntryIndex;
uint16 ui16FrameIndex;
tFileFormat eFileFormat;
if (ui16DetectFileTypeByFileContent(pui8FileName, &eFileFormat) != OK)
return FAIL;
if (eFileFormat != FILE_FORMAT_UNKNOWN)
for (ui16EntryIndex = 0; ui16EntryIndex < ENTRY_NUMBER; ui16EntryIndex++)
for (ui16FrameIndex = 0; ui16FrameIndex < MAX_FRAME_NUMBER; ui16FrameIndex++) {
prRoll->table[ui16FrameIndex].list[ui16EntryIndex] = malloc(256);
strcpy(prRoll->table[ui16FrameIndex].list[ui16EntryIndex],"");
}
switch (eFileFormat) {
case FILE_FORMAT_TXT:
return ui16OpenTXT_File(pui8FileName, prRoll);
case FILE_FORMAT_NKN:
return ui16OpenNKN_File(pui8FileName, prRoll);
default:
prRoll = NULL;
}
return FAIL;
}
uint16 ui16SaveFile(uint8 *pui8FileName, tRoll *prRoll) {
tFileFormat eFileFormat;
if (ui16DetectFileTypeByFileName(pui8FileName, &eFileFormat) != OK)
return FAIL;
switch (eFileFormat) {
case FILE_FORMAT_TXT:
return ui16SaveTXT_File(pui8FileName, prRoll);
case FILE_FORMAT_NKN:
return ui16SaveNKN_File(pui8FileName, prRoll);
default:
return FAIL;
}
return OK;
}
uint16 ui16OpenNKN_File(uint8 *pui8FileName, tRoll *prRoll) {
FILE *pFileDescriptor;
uint8 pui8Header[4];
uint8 pui8Version[2];
uint8 pui8Dummy[3];
uint8 ui8FrameCount;
uint8 ui8Char;
uint8 *pui8String = NULL;
if ((pFileDescriptor = fopen(pui8FileName, "r" )) == NULL) {
printf("Cannot open input file %s.\n", pui8FileName);
return FAIL;
}
strcpy(prRoll->pui8FileName, pui8FileName);
vReadNKNString(pFileDescriptor, pui8Header);
fread(pui8Version, 2, 1, pFileDescriptor);
fread(&(prRoll->ui32TimeStamp), 4, 1, pFileDescriptor);
/* compensate elapsed time between UNIX and NKN time */
/* 01/01/1970 00:00:00 - 12/31/1969 16:00:00 = 0x7080 seconds */
prRoll->ui32TimeStamp -= 0x7080;
strcpy(prRoll->pui8TimeStamp, ctime(&(prRoll->ui32TimeStamp)));
vReadNKNString(pFileDescriptor, prRoll->pui8RollTitle);
vReadNKNString(pFileDescriptor, prRoll->pui8CameraType);
vNKN_DataToString(rpCameraIsoFilmSpeed, fgetc(pFileDescriptor), &pui8String);
strcpy(prRoll->pui8FilmSpeed, pui8String);
prRoll->ui8StorageLevel = fgetc(pFileDescriptor);
fread(pui8Dummy, 3, 1, pFileDescriptor);
ui8FrameCount = fgetc(pFileDescriptor);
fread(pui8Dummy, 1, 1, pFileDescriptor);
prRoll->ui8FrameCounter = 0;
while (prRoll->ui8FrameCounter < ui8FrameCount) {
vReadNKNString(pFileDescriptor, prRoll->table[prRoll->ui8FrameCounter].list[9]);
sprintf(prRoll->table[prRoll->ui8FrameCounter].list[0], "%.2d", prRoll->ui8FrameCounter + 1);
ui8Char = fgetc(pFileDescriptor);
vNKN_DataToString(rpCameraExposureEffective, ui8Char, &pui8String);
if (pui8String != NULL)
strcpy(prRoll->table[prRoll->ui8FrameCounter].list[1], pui8String);
ui8Char = fgetc(pFileDescriptor);
vNKN_DataToString(rpCameraApertureEffective, ui8Char, &pui8String);
if (pui8String != NULL)
strcpy(prRoll->table[prRoll->ui8FrameCounter].list[2], pui8String);
ui8Char = fgetc(pFileDescriptor);
vNKN_DataToString(rpNKN_ProgramMode, ui8Char, &pui8String);
if (pui8String != NULL)
strcpy(prRoll->table[prRoll->ui8FrameCounter].list[3], pui8String);
ui8Char = fgetc(pFileDescriptor);
vNKN_DataToString(rpNKN_LightMetering, ui8Char, &pui8String);
if (pui8String != NULL)
strcpy(prRoll->table[prRoll->ui8FrameCounter].list[4], pui8String);
if (prRoll->ui8StorageLevel > 0x00) {
ui8Char = fgetc(pFileDescriptor);
vNKN_DataToString(rpNKN_FlashMode, ui8Char, &pui8String);
if (pui8String != NULL)
strcpy(prRoll->table[prRoll->ui8FrameCounter].list[5], pui8String);
ui8Char = fgetc(pFileDescriptor);
vNKN_DataToString(rpCameraFocusDistance, ui8Char, &pui8String);
if (pui8String != NULL)
strcpy(prRoll->table[prRoll->ui8FrameCounter].list[6], pui8String);
if (prRoll->ui8StorageLevel > 0x01) {
ui8Char = fgetc(pFileDescriptor);
vNKN_DataToString(rpNKN_Compensation, ui8Char, &pui8String);
if (pui8String != NULL)
strcpy(prRoll->table[prRoll->ui8FrameCounter].list[7], pui8String);
ui8Char = fgetc(pFileDescriptor);
vNKN_DataToString(rpNKN_Compensation, ui8Char, &pui8String);
if (pui8String != NULL)
strcpy(prRoll->table[prRoll->ui8FrameCounter].list[8], pui8String);
}
}
prRoll->ui8FrameCounter++;
}
fclose(pFileDescriptor);
return OK;
}
uint16 ui16SaveNKN_File(uint8 *pui8FileName, tRoll *prRoll) {
uint8 pui8Version[2] = {0x01, 0x01};
uint8 pui8Dummy1[3] = {0x00, 0x01, 0x00};
uint8 ui8Dummy2 = 0x00;
FILE *pFileDescriptor;
uint8 ui8Data;
uint16 ui16Data;
uint16 ui16FrameIndex;
if ((pFileDescriptor = fopen(pui8FileName, "w" )) == NULL) {
printf("Cannot open input file %s.\n", pui8FileName);
return FAIL;
}
vWriteNKNString(pFileDescriptor, "N90");
fwrite(pui8Version, 2, 1, pFileDescriptor);
prRoll->ui32TimeStamp = ui32InverseCtime(prRoll->pui8TimeStamp);
fwrite(&(prRoll->ui32TimeStamp), 4, 1, pFileDescriptor);
vWriteNKNString(pFileDescriptor, prRoll->pui8RollTitle);
vWriteNKNString(pFileDescriptor, prRoll->pui8CameraType);
vNKN_StringToData(rpCameraIsoFilmSpeed, prRoll->pui8FilmSpeed, &ui16Data);
ui8Data = (uint8)ui16Data;
fwrite(&(ui8Data), 1, 1, pFileDescriptor);
fwrite(&(prRoll->ui8StorageLevel), 1, 1, pFileDescriptor);
fwrite(pui8Dummy1, 3, 1, pFileDescriptor);
fwrite(&(prRoll->ui8FrameCounter), 1, 1, pFileDescriptor);
fwrite(&ui8Dummy2, 1, 1, pFileDescriptor);
for (ui16FrameIndex = 0; ui16FrameIndex < prRoll->ui8FrameCounter; ui16FrameIndex++) {
/* caption */
vWriteNKNString(pFileDescriptor, prRoll->table[ui16FrameIndex].list[9]);
/* exposure */
vNKN_StringToData(rpCameraExposureEffective, prRoll->table[ui16FrameIndex].list[1], &ui16Data);
ui8Data = (uint8)ui16Data;
fwrite(&ui8Data, 1, 1, pFileDescriptor);
vNKN_StringToData(rpCameraApertureEffective, prRoll->table[ui16FrameIndex].list[2], &ui16Data);
ui8Data = (uint8)ui16Data;
fwrite(&ui8Data, 1, 1, pFileDescriptor);
vNKN_StringToData(rpNKN_ProgramMode, prRoll->table[ui16FrameIndex].list[3], &ui16Data);
ui8Data = (uint8)ui16Data;
fwrite(&ui8Data, 1, 1, pFileDescriptor);
vNKN_StringToData(rpNKN_LightMetering, prRoll->table[ui16FrameIndex].list[4], &ui16Data);
ui8Data = (uint8)ui16Data;
fwrite(&ui8Data, 1, 1, pFileDescriptor);
if (prRoll->ui8StorageLevel > 0x00) {
vNKN_StringToData(rpNKN_FlashMode, prRoll->table[ui16FrameIndex].list[5], &ui16Data);
ui8Data = (uint8)ui16Data;
fwrite(&ui8Data, 1, 1, pFileDescriptor);
vNKN_StringToData(rpCameraFocusDistance, prRoll->table[ui16FrameIndex].list[6], &ui16Data);
ui8Data = (uint8)ui16Data;
fwrite(&ui8Data, 1, 1, pFileDescriptor);
if (prRoll->ui8StorageLevel > 0x01) {
vNKN_StringToData(rpNKN_Compensation, prRoll->table[ui16FrameIndex].list[7], &ui16Data);
ui8Data = (uint8)ui16Data;
fwrite(&ui8Data, 1, 1, pFileDescriptor);
vNKN_StringToData(rpNKN_Compensation, prRoll->table[ui16FrameIndex].list[8], &ui16Data);
ui8Data = (uint8)ui16Data;
fwrite(&ui8Data, 1, 1, pFileDescriptor);
}
}
}
fclose(pFileDescriptor);
return OK;
}
uint16 ui16OpenTXT_File(uint8 *pui8FileName, tRoll *prRoll) {
uint8 pui8Buffer[512];
uint16 ui16ColumnIndex;
FILE *pFileDescriptor;
if ((pFileDescriptor = fopen(pui8FileName, "r" )) == NULL) {
printf("Cannot open input file %s.\n", pui8FileName);
return FAIL;
}
strcpy(prRoll->pui8FileName, pui8FileName);
fgets(pui8Buffer, 512, pFileDescriptor);
fgets(pui8Buffer, 512, pFileDescriptor);
vGetData(pui8Buffer, 1, prRoll->pui8RollTitle);
fgets(pui8Buffer, 512, pFileDescriptor);
vGetData(pui8Buffer, 1, prRoll->pui8CameraType);
fgets(pui8Buffer, 512, pFileDescriptor);
vGetData(pui8Buffer, 1, prRoll->pui8FilmSpeed);
fgets(pui8Buffer, 512, pFileDescriptor);
vGetData(pui8Buffer, 1, prRoll->pui8TimeStamp);
fgets(pui8Buffer, 512, pFileDescriptor);
prRoll->ui8FrameCounter = 0;
fgets(pui8Buffer, 512, pFileDescriptor);
while (!feof(pFileDescriptor)) {
for (ui16ColumnIndex = 0; ui16ColumnIndex < 10; ui16ColumnIndex++) {
vGetData(pui8Buffer, ui16ColumnIndex, prRoll->table[prRoll->ui8FrameCounter].list[ui16ColumnIndex]);
}
prRoll->ui8FrameCounter++;
fgets(pui8Buffer, 512, pFileDescriptor);
}
fclose(pFileDescriptor);
return OK;
}
uint16 ui16SaveTXT_File(uint8 *pui8FileName, tRoll *prRoll) {
uint8 pui8Buffer[512];
uint16 ui16FrameIndex;
FILE *pFileDescriptor;
if ((pFileDescriptor = fopen(pui8FileName, "w" )) == NULL) {
printf("Cannot open input file %s.\n", pui8FileName);
return FAIL;
}
sprintf(pui8Buffer, "Data File:\t%s\n", pui8FileName);
fputs(pui8Buffer, pFileDescriptor);
sprintf(pui8Buffer, "Roll Title:\t%s\n", prRoll->pui8RollTitle);
fputs(pui8Buffer, pFileDescriptor);
sprintf(pui8Buffer, "Camera:\t%s\n", prRoll->pui8CameraType);
fputs(pui8Buffer, pFileDescriptor);
sprintf(pui8Buffer, "Film Speed:\t%s\n", prRoll->pui8FilmSpeed);
fputs(pui8Buffer, pFileDescriptor);
sprintf(pui8Buffer, "Time Stamp:\t%s", prRoll->pui8TimeStamp);
fputs(pui8Buffer, pFileDescriptor);
sprintf(pui8Buffer, "Frame\tShutter Speed\tAperture\tExposure Mode\t");
fputs(pui8Buffer, pFileDescriptor);
sprintf(pui8Buffer, "Metering System\tFlash-Sync Mode\tFocal Length\t");
fputs(pui8Buffer, pFileDescriptor);
sprintf(pui8Buffer, "Exposure\tFlash\tCaption\n");
fputs(pui8Buffer, pFileDescriptor);
for (ui16FrameIndex = 0; ui16FrameIndex < prRoll->ui8FrameCounter; ui16FrameIndex++) {
sprintf(pui8Buffer,
"%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n",
prRoll->table[ui16FrameIndex].list[0],
prRoll->table[ui16FrameIndex].list[1],
prRoll->table[ui16FrameIndex].list[2],
prRoll->table[ui16FrameIndex].list[3],
prRoll->table[ui16FrameIndex].list[4],
prRoll->table[ui16FrameIndex].list[5],
prRoll->table[ui16FrameIndex].list[6],
prRoll->table[ui16FrameIndex].list[7],
prRoll->table[ui16FrameIndex].list[8],
prRoll->table[ui16FrameIndex].list[9]);
fputs(pui8Buffer, pFileDescriptor);
}
fclose(pFileDescriptor);
return OK;
}
uint16 ui16DetectFileTypeByFileName(uint8 *pui8FileName, tFileFormat *peFileFormat){
uint16 ui16FileNameLength = strlen(pui8FileName) - 3;
if (strcasecmp(pui8FileName + ui16FileNameLength, "txt") == 0)
*peFileFormat = FILE_FORMAT_TXT;
else if (strcasecmp(pui8FileName + ui16FileNameLength, "nkn") == 0)
*peFileFormat = FILE_FORMAT_NKN;
else
*peFileFormat = geDefaultFileFormat;
return OK;
}
uint16 ui16DetectFileTypeByFileContent(uint8 *pui8FileName, tFileFormat *peFileFormat) {
FILE *pFileDescriptor;
uint8 pui8Header[4];
uint8 pui8Version[2];
uint8 pui8Buffer[256];
/* check for the NKN format by reading the version */
if ((pFileDescriptor = fopen(pui8FileName, "r" )) == NULL) {
printf("Cannot open input file %s.\n", pui8FileName);
return FAIL;
}
fread(pui8Header, 4, 1, pFileDescriptor);
fread(pui8Version, 2, 1, pFileDescriptor);
fclose(pFileDescriptor);
if ((pui8Version[0] == 1) && (pui8Version[1] == 1)) {
*peFileFormat = FILE_FORMAT_NKN;
return OK;
}
/* check for the TXT format by reading the first line */
if ((pFileDescriptor = fopen(pui8FileName, "r" )) == NULL) {
printf("Cannot open input file %s.\n", pui8FileName);
return FAIL;
}
fgets(pui8Buffer, sizeof(pui8Buffer), pFileDescriptor);
fclose(pFileDescriptor);
if (strncmp(pui8Buffer, "Data File:", 10) == 0) {
*peFileFormat = FILE_FORMAT_TXT;
return OK;
}
*peFileFormat = FILE_FORMAT_UNKNOWN;
return OK;
}
uint16 ui16ReadConfigFile() {
struct stat sBuf;
FILE *pFileDescriptor;
uint8 *ui8Home = getenv("HOME");
uint8 *pui8ConfigFileName;
uint16 ui16Baud;
uint8 pui8Device[256];
uint8 pui8PrintTo[256];
uint8 pui8PrinterCommand[256];
uint8 pui8PaperSize[256];
uint8 pui8CopyrightNote[256];
tFileFormat eDefaultFileFormat;
tPrintLayout rPrintLayout;
uint8 pui8Buffer[256];
pui8ConfigFileName = (char *)malloc(sizeof(char)*(strlen(ui8Home)+9));
memset(pui8ConfigFileName, 0, sizeof(char)*(strlen(ui8Home)+9));
sprintf(pui8ConfigFileName, "%s/.gicon", ui8Home);
/* configuration file does not exist, load defaults */
if (stat(pui8ConfigFileName, &sBuf) != 0) {
vPrintLoadDefaults();
vPreferencesLoadDefaults();
return OK;
}
/* open config file and load values */
if ((pFileDescriptor = fopen(pui8ConfigFileName, "r" )) == NULL) {
printf("Cannot open configuration file: %s.\n", pui8ConfigFileName);
return FAIL;
}
vReadNKNString(pFileDescriptor, pui8Device);
vReadNKNString(pFileDescriptor, pui8Buffer);
ui16Baud = atoi(pui8Buffer);
vReadNKNString(pFileDescriptor, pui8Buffer);
eDefaultFileFormat = atoi(pui8Buffer);
vReadNKNString(pFileDescriptor, pui8PrintTo);
vReadNKNString(pFileDescriptor, pui8PrinterCommand);
vReadNKNString(pFileDescriptor, pui8PaperSize);
vReadNKNString(pFileDescriptor, pui8CopyrightNote);
vReadNKNString(pFileDescriptor, pui8Buffer);
rPrintLayout.ui8Orientation = atoi(pui8Buffer);
vReadNKNString(pFileDescriptor, pui8Buffer);
rPrintLayout.ui8PrintCaption = atoi(pui8Buffer);
vReadNKNString(pFileDescriptor, pui8Buffer);
rPrintLayout.ui8PrintTitle = atoi(pui8Buffer);
vReadNKNString(pFileDescriptor, pui8Buffer);
rPrintLayout.ui8Columns = atoi(pui8Buffer);
vReadNKNString(pFileDescriptor, pui8Buffer);
rPrintLayout.fHorizontalOffset = atof(pui8Buffer);
vReadNKNString(pFileDescriptor, pui8Buffer);
rPrintLayout.fVerticalOffset = atof(pui8Buffer);
vReadNKNString(pFileDescriptor, pui8Buffer);
rPrintLayout.fLabelWidth = atof(pui8Buffer);
vReadNKNString(pFileDescriptor, pui8Buffer);
rPrintLayout.fLabelHeight = atof(pui8Buffer);
vReadNKNString(pFileDescriptor, pui8Buffer);
rPrintLayout.fColumnSpacing = atof(pui8Buffer);
vReadNKNString(pFileDescriptor, pui8Buffer);
rPrintLayout.fRowSpacing = atof(pui8Buffer);
vPreferencesSet(pui8Device, ui16Baud, eDefaultFileFormat);
vPrintSet(pui8PrintTo, pui8PrinterCommand, pui8PaperSize,
pui8CopyrightNote, &rPrintLayout);
fclose(pFileDescriptor);
return OK;
}
uint16 ui16WriteConfigFile() {
FILE *pFileDescriptor;
uint8 *ui8Home = getenv("HOME");
uint8 *pui8ConfigFileName;
uint16 ui16Baud;
uint8 ui8DefaultFileFormat;
uint8 *pui8Device;
uint8 *pui8PrintTo;
uint8 *pui8PrinterCommand;
uint8 *pui8PaperSize;
uint8 *pui8CopyrightNote;
uint8 pui8Buffer[256];
tPrintLayout prPrintLayout;
pui8ConfigFileName = (char *)malloc(sizeof(char)*(strlen(ui8Home)+9));
memset(pui8ConfigFileName, 0, sizeof(char)*(strlen(ui8Home)+9));
sprintf(pui8ConfigFileName, "%s/.gicon", ui8Home);
if ((pFileDescriptor = fopen(pui8ConfigFileName, "w" )) == NULL) {
printf("Cannot open configuration file: %s.\n", pui8ConfigFileName);
return FAIL;
}
vPreferencesGet(&pui8Device, &ui16Baud, &ui8DefaultFileFormat);
vPrintGet(&pui8PrintTo, &pui8PrinterCommand,
&pui8PaperSize, &pui8CopyrightNote, &prPrintLayout);
vWriteNKNString(pFileDescriptor, pui8Device);
sprintf(pui8Buffer, "%d", ui16Baud);
vWriteNKNString(pFileDescriptor, pui8Buffer);
sprintf(pui8Buffer, "%d", ui8DefaultFileFormat);
vWriteNKNString(pFileDescriptor, pui8Buffer);
vWriteNKNString(pFileDescriptor, pui8PrintTo);
vWriteNKNString(pFileDescriptor, pui8PrinterCommand);
vWriteNKNString(pFileDescriptor, pui8PaperSize);
vWriteNKNString(pFileDescriptor, pui8CopyrightNote);
sprintf(pui8Buffer, "%d", prPrintLayout.ui8Orientation);
vWriteNKNString(pFileDescriptor, pui8Buffer);
sprintf(pui8Buffer, "%d", prPrintLayout.ui8PrintCaption);
vWriteNKNString(pFileDescriptor, pui8Buffer);
sprintf(pui8Buffer, "%d", prPrintLayout.ui8PrintTitle);
vWriteNKNString(pFileDescriptor, pui8Buffer);
sprintf(pui8Buffer, "%d", prPrintLayout.ui8Columns);
vWriteNKNString(pFileDescriptor, pui8Buffer);
sprintf(pui8Buffer, "%f", prPrintLayout.fHorizontalOffset);
vWriteNKNString(pFileDescriptor, pui8Buffer);
sprintf(pui8Buffer, "%f", prPrintLayout.fVerticalOffset);
vWriteNKNString(pFileDescriptor, pui8Buffer);
sprintf(pui8Buffer, "%f", prPrintLayout.fLabelWidth);
vWriteNKNString(pFileDescriptor, pui8Buffer);
sprintf(pui8Buffer, "%f", prPrintLayout.fLabelHeight);
vWriteNKNString(pFileDescriptor, pui8Buffer);
sprintf(pui8Buffer, "%f", prPrintLayout.fColumnSpacing);
vWriteNKNString(pFileDescriptor, pui8Buffer);
sprintf(pui8Buffer, "%f", prPrintLayout.fRowSpacing);
vWriteNKNString(pFileDescriptor, pui8Buffer);
fclose(pFileDescriptor);
return OK;
}

+ 0
- 75
docs/gicon-0.1.2/file.h View File

@ -1,75 +0,0 @@
/*
file.h
Copyright (C) 2002 Balint Kis (balint.kis@mail.com)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef _FILE_H
#define _FILE_H
#include <string.h>
#include <stdio.h>
#include "common.h"
#define MAX_ROLL_NUMBER 100
#define MAX_FRAME_NUMBER 40
#define ENTRY_STRING_LENGTH 256
#define ENTRY_INDEX_FRAME 0
#define ENTRY_INDEX_EXPOSURE 1
#define ENTRY_INDEX_APERTURE 2
#define ENTRY_INDEX_MODE 3
#define ENTRY_INDEX_METERING 4
#define ENTRY_INDEX_FLASH_MODE 5
#define ENTRY_INDEX_FOCAL_LENGHT 6
#define ENTRY_INDEX_EXP_COMP 7
#define ENTRY_INDEX_FLASH_COMP 8
#define ENTRY_INDEX_CAPTION 9
#define ENTRY_NUMBER 10
typedef enum {
FILE_FORMAT_TXT,
FILE_FORMAT_NKN,
FILE_FORMAT_UNKNOWN,
} tFileFormat;
typedef struct {
char *list[10];
} tTableElement;
typedef struct {
uint8 pui8FileName[512];
uint8 pui8RollTitle[256];
uint8 pui8CameraType[20];
uint8 pui8FilmSpeed[6];
uint8 pui8TimeStamp[30];
uint8 ui8FrameCounter;
uint8 ui8StorageLevel;
uint32 ui32TimeStamp;
tTableElement table[40];
} tRoll;
uint16 ui16OpenFile(uint8 *, tRoll *);
uint16 ui16SaveFile(uint8 *, tRoll *);
uint16 ui16ReadConfigFile();
uint16 ui16WriteConfigFile();
#endif

+ 0
- 747
docs/gicon-0.1.2/gui.controls.c View File

@ -1,747 +0,0 @@
/*
gui.controls.c
Copyright (C) 2002 Balint Kis (balint.kis@mail.com)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <string.h>
#include <gnome.h>
#include <glade/glade.h>
#include <math.h>
#include <string.h>
#include "common.h"
#include "nkn.h"
#include "util.h"
extern uint8 gpui8XmlPath[256];
extern uint8 gpui8Device[256];
extern uint16 gui16Baud;
extern tNKN_DataArray rpCameraIsoFilmSpeed[];
extern tNKN_DataArray rpCameraExposure[];
extern tNKN_DataArray rpCameraExposureEffective[];
extern tNKN_DataArray rpCameraExposureCompensation[];
extern tNKN_DataArray rpCameraProgramMode[];
extern tNKN_DataArray rpCameraProgramModeVariProgram[];
extern tNKN_DataArray rpCameraLightMetering[];
extern tNKN_DataArray rpCameraMotorDrive[];
extern tNKN_DataArray rpCameraFocusArea[];
extern tNKN_DataArray rpCameraBracketing[];
extern tNKN_DataArray rpCameraBracketingStep[];
extern tNKN_DataArray rpCameraFlashMode[];
extern tNKN_DataArray rpFlashInstallStatus[];
extern tNKN_DataArray rpFlashReady[];
extern tNKN_DataArray rpCameraFlashSyncSpeed[];
extern tNKN_DataArray rpCameraFlashCompensation[];
extern tNKN_DataArray rpCameraLensIdentifier[];
extern tNKN_DataArray rpCameraApertureTable[];
extern tNKN_DataArray rpCameraApertureEffective[];
extern tNKN_DataArray rpCameraFocusMode[];
extern tNKN_DataArray rpCameraFocusDistance[];
extern tNKN_DataArray rpFocusStatus[];
extern tNKN_DataArray rpCameraGeneralStatus[];
extern tNKN_DataArray rpCameraMemoHolderDownload[];
void vControlsButtonDownload_Released(void);
void vControlsButtonUpload_Released(void);
void vControlsButtonDefault_Released(void);
void vControlsButtonFocus_Released(void);
void vControlsButtonRelease_Released(void);
void vControlsButtonHelp_Released(void);
void vControlsWindow_Destroy(void);
void vControlBracketingMode_Changed(void);
void vControlsButtonSetSensitive(uint8);
void vControlsWindowDestroy(void);
uint16 ui16ControlsConvertFocusDistance(uint8);
static struct {
GtkWidget *pWidget;
uint8 *pui8WidgetString;
uint8 ui8Enable;
uint16 ui16WidgetValue;
uint16 ui16DefaultValue;
uint16 ui16RegisterValue;
uint8 ui8RegisterMode;
uint32 ui32RegisterAddress;
uint8 ui8RegisterWidth;
uint16 ui16RegisterMask;
uint8 ui8RegisterShift;
tNKN_DataArray *prData;
} grWidgetTable[] = {
{NULL, "entryControlProgramMode", 1, 0, 0, 0, CAMERA_PROGRAM_MODE, rpCameraProgramMode},
{NULL, "entryControlLightMeteringMode", 1, 0, 0, 0, CAMERA_LIGHT_METERING, rpCameraLightMetering},
{NULL, "entryControlMotorDrive", 1, 0, 0, 0, CAMERA_MOTOR_DRIVE, rpCameraMotorDrive},
{NULL, "entryControlAutoFocusArea", 1, 0, 0, 0, CAMERA_FOCUS_AREA, rpCameraFocusArea},
{NULL, "entryControlISOFilmSpeed", 1, 0, 0, 0, CAMERA_FILM_ISO, rpCameraIsoFilmSpeed},
{NULL, "entryControlExposure", 1, 0, 0, 0, CAMERA_EXPOSURE, rpCameraExposure},
{NULL, "entryControlExposureCompensation", 1, 0, 0, 0, CAMERA_EXPOSURE_COMPENSATION, rpCameraExposureCompensation},
{NULL, "entryControlFlashMode", 1, 0, 0, 0, CAMERA_FLASH_MODE, rpCameraFlashMode},
{NULL, "entryControlFlashExposure", 1, 0, 0, 0, CAMERA_FLASH_SYNC_SPEED, rpCameraFlashSyncSpeed},
{NULL, "entryControlFlashExposureCompensation", 1, 0, 0, 0, CAMERA_FLASH_COMPENSATION, rpCameraFlashCompensation},
{NULL, "spinbuttonControlMiscellaneousSelfTimer", 1, 0, 0, 0, CAMERA_SELF_TIMER, NULL},
{NULL, "spinbuttonControlMiscellaneousLCDLightTimer", 1, 0, 0, 0, CAMERA_LCD_LIGHT_ON_TIME, NULL},
{NULL, "entryControlMiscellaneousLCDLights", 1, 0, 0, 0, CAMERA_LCD_LIGHT, rpCameraGeneralStatus},
{NULL, "entryControlBracketingMode", 1, 0, 0, 0, CAMERA_BRACKETING, rpCameraBracketing},
{NULL, "entryControlFramesPerSequence", 0, 0, 0, 0, CAMERA_SEQUENCE_FRAME_COUNTER, NULL},
{NULL, "entryControlStepsPerFrame", 0, 0, 0, 0, CAMERA_BRACKETING_STEP, rpCameraBracketingStep},
/* these widgets are for display only, do not uplodad */
{NULL, "entryControlAperture", 1, 0, 0, 0, CAMERA_APERTURE_EFFECTIVE, rpCameraApertureEffective},
{NULL, "entryControlRollNumber", 1, 0, 0, 0, CAMERA_ROLL_NUMBER, NULL},
{NULL, "entryControlTotalFrames", 1, 0, 0, 0, CAMERA_TOTAL_FRAMES, NULL},
{NULL, "entryControlCurrentFrame", 1, 0, 0, 0, CAMERA_FRAME_NUMBER, NULL},
{NULL, "entryControlFlashInstallStatus", 1, 0, 0, 0, CAMERA_FLASH_INSTALL_STATUS, rpFlashInstallStatus},
{NULL, "entryControlFlashOperationalStatus", 1, 0, 0, 0, CAMERA_FLASH_READY, rpFlashReady},
{NULL, "entryControlFlashSlowSyncStatus", 1, 0, 0, 0, CAMERA_FLASH_SLOW_SYNC_STATUS, rpCameraGeneralStatus},
{NULL, "entryControlLensType", 1, 0, 0, 0, CAMERA_LENS_IDENTIFIER, rpCameraLensIdentifier},
{NULL, "entryControlApertureRange", 1, 0, 0, 0, CAMERA_APERTURE_RANGE_LOWER, rpCameraApertureTable},
{NULL, "entryControlZoomedAperture", 1, 0, 0, 0, CAMERA_APERTURE_ZOOMED, rpCameraApertureTable},
{NULL, "entryControlZoomCurrent", 1, 0, 0, 0, CAMERA_ZOOM_CURRENT, rpCameraFocusDistance},
{NULL, "entryControlFocalLength", 1, 0, 0, 0, CAMERA_FOCAL_LENGTH_LOWER, rpCameraFocusDistance},
{NULL, "entryControlFocusDistance", 1, 0, 0, 0, CAMERA_FOCUS_DISTANCE, NULL},
{NULL, "entryControlFocusMode", 1, 0, 0, 0, CAMERA_LENS_FOCUS_MODE, rpCameraFocusMode},
{NULL, "entryControlFocusStatus", 1, 0, 0, 0, CAMERA_FOCUS_STATUS, rpFocusStatus},
};
#define WIDGET_TABLE_SIZE 31
#define WIDGET_TABLE_UPLOAD_SIZE 16
#define WIDGET_INDEX_PROGRAM_MODE 0
#define WIDGET_INDEX_EXPOSURE 5
#define WIDGET_INDEX_FLASH_EXPOSURE 8
#define WIDGET_INDEX_SELF_TIMER 10
#define WIDGET_INDEX_LCD_TIMER 11
#define WIDGET_INDEX_BRACKETING_MODE 13
#define WIDGET_INDEX_FRAMES_PER_SEQUENCE 14
#define WIDGET_INDEX_STEPS_PER_FRAME 15
#define WIDGET_INDEX_CURRENT_FRAME 19
#define WIDGET_INDEX_FLASH_INSTALL_STATUS 20
#define WIDGET_INDEX_APERTURE_RANGE_LOWER 24
#define WIDGET_INDEX_FOCAL_LENGTH_LOWER 27
#define WIDGET_INDEX_FOCUS_DISTANCE 28
#define WIDGET_INDEX_FOCUS_STATUS 30
static struct {
uint16 ui16WidgetValue;
uint16 ui16DefaultValue;
uint16 ui16RegisterValue;
uint8 ui8RegisterMode;
uint32 ui32RegisterAddress;
uint8 ui8RegisterWidth;
uint16 ui16RegisterMask;
uint8 ui8RegisterShift;
tNKN_DataArray *prData;
} grAuxWidgetTable[] = {
{0, 0, 0, CAMERA_PROGRAM_MODE_VARI_PROGRAM, rpCameraProgramModeVariProgram},
{0, 0, 0, CAMERA_FILM_ISO_EFFECTIVE, rpCameraIsoFilmSpeed},
{0, 0, 0, CAMERA_APERTURE_RANGE_UPPER, rpCameraApertureEffective},
{0, 0, 0, CAMERA_FOCAL_LENGTH_UPPER, rpCameraFocusDistance},
{0, 0, 0, CAMERA_EXPOSURE_EFFECTIVE, rpCameraExposureEffective},
};
#define WIDGET_AUX_TABLE_SIZE 5
#define WIDGET_AUX_TABLE_UPLOAD_SIZE 1
#define WIDGET_AUX_INDEX_MODE_VARI_PROGRAM 0
#define WIDGET_AUX_INDEX_FILM_ISO 1
#define WIDGET_AUX_INDEX_APERTURE_RANGE_UPPER 2
#define WIDGET_AUX_INDEX_FOCAL_LENGTH_UPPER 3
#define WIDGET_AUX_INDEX_EXPOSURE_EFFECTIVE 4
GtkWidget *gpControlsWindow = NULL;
GtkWidget *gpControlsApplicationBar = NULL;
GtkWidget *gpControlsComboFramesPerSequence = NULL;
GtkWidget *gpControlsComboStepsPerFrame = NULL;
GtkWidget *gpControlsComboExposure = NULL;
GtkWidget *gpControlsComboFlashExposure = NULL;
GtkWidget *gpControlsButtonDownload = NULL;
GtkWidget *gpControlsButtonUpload = NULL;
GtkWidget *gpControlsButtonDefault = NULL;
GtkWidget *gpControlsButtonFocus = NULL;
GtkWidget *gpControlsButtonRelease = NULL;
uint8 gui8DefaultControlsLoaded = FALSE;
uint16 gui16FileDescriptor;
uint16 ui16ControlsConvertFocusDistance(uint8 ui8RawValue) {
double ui64RetVal = pow(10, ui8RawValue/1.25);
ui64RetVal = sqrt(ui64RetVal);
ui64RetVal = sqrt(ui64RetVal);
ui64RetVal = sqrt(ui64RetVal);
ui64RetVal = sqrt(ui64RetVal);
ui64RetVal = sqrt(ui64RetVal);
return (uint16)ui64RetVal;
}
void vMenuViewShowControlsActivate(void) {
uint16 ui16Index;
GladeXML *xmlControlsWindow;
if (gpControlsWindow != NULL)
return;
if(!(xmlControlsWindow = glade_xml_new(gpui8XmlPath, "windowControls"))) {
g_warning("We could not load the interface!");
return;
}
glade_xml_signal_autoconnect(xmlControlsWindow);
gpControlsWindow = glade_xml_get_widget(xmlControlsWindow, "windowControls");
for (ui16Index = 0; ui16Index < WIDGET_TABLE_SIZE; ui16Index++)
grWidgetTable[ui16Index].pWidget = glade_xml_get_widget(xmlControlsWindow, grWidgetTable[ui16Index].pui8WidgetString);
gpControlsButtonDownload = glade_xml_get_widget(xmlControlsWindow, "buttonDownloadControl");
gpControlsButtonUpload = glade_xml_get_widget(xmlControlsWindow, "buttonUploadControl");
gpControlsButtonDefault = glade_xml_get_widget(xmlControlsWindow, "buttonDefaultControl");
gpControlsButtonFocus = glade_xml_get_widget(xmlControlsWindow, "buttonFocusControl");
gpControlsButtonRelease = glade_xml_get_widget(xmlControlsWindow, "buttonReleaseControl");
gpControlsComboFramesPerSequence = glade_xml_get_widget(xmlControlsWindow, "comboControlFramesPerSequence");
gpControlsComboStepsPerFrame = glade_xml_get_widget(xmlControlsWindow, "comboControlStepsPerFrame");
gpControlsComboExposure = glade_xml_get_widget(xmlControlsWindow, "comboControlExposure");
gpControlsComboFlashExposure = glade_xml_get_widget(xmlControlsWindow, "comboControlFlashExposure");
gpControlsApplicationBar = glade_xml_get_widget(xmlControlsWindow, "appbarControls");
vControlsButtonDownload_Released();
gtk_object_unref(GTK_OBJECT(xmlControlsWindow));
}
void vControlsButtonDownload_Released(void) {
uint8 *pui8String = NULL;
uint8 *pui8String2 = NULL;
uint8 ui8Buffer[256];
uint16 ui16Value;
uint16 ui16ReturnValue;
uint16 ui16Index;
float fFocusDistance;
vControlsButtonSetSensitive(FALSE);
gnome_appbar_set_progress(GNOME_APPBAR(gpControlsApplicationBar), 0);
gnome_appbar_set_status(GNOME_APPBAR(gpControlsApplicationBar), "Downloading...");
while (gtk_events_pending())
gtk_main_iteration();
ui16ReturnValue = ui16NKN_WakeUp(&gui16FileDescriptor, gpui8Device);
ui16ReturnValue += ui16NKN_SignIn(gui16FileDescriptor);
if (ui16ReturnValue > 0) {
vControlsButtonSetSensitive(TRUE);
gnome_appbar_set_status(GNOME_APPBAR(gpControlsApplicationBar), "");
gnome_app_error(GNOME_APP(gpControlsWindow), "Failed establish connection.");
return;
}
ui16ReturnValue = ui16NKN_SetBaud(gui16FileDescriptor, gui16Baud);
for (ui16Index = 0; ui16Index < WIDGET_AUX_TABLE_SIZE; ui16Index++) {
/* get data from register */
ui16ReturnValue += ui16NKN_Read16(gui16FileDescriptor,
grAuxWidgetTable[ui16Index].ui8RegisterMode,
grAuxWidgetTable[ui16Index].ui32RegisterAddress,
grAuxWidgetTable[ui16Index].ui8RegisterWidth,
grAuxWidgetTable[ui16Index].ui16RegisterMask,
grAuxWidgetTable[ui16Index].ui8RegisterShift,
&ui16Value);
grAuxWidgetTable[ui16Index].ui16RegisterValue = ui16Value;
grAuxWidgetTable[ui16Index].ui16WidgetValue = ui16Value;
if (!gui8DefaultControlsLoaded)
grAuxWidgetTable[ui16Index].ui16DefaultValue = ui16Value;
gnome_appbar_set_progress(GNOME_APPBAR(gpControlsApplicationBar), (gfloat)(1/(gfloat)(WIDGET_TABLE_SIZE + WIDGET_AUX_TABLE_SIZE))*ui16Index);
while (gtk_events_pending())
gtk_main_iteration();
}
for (ui16Index = 0; ui16Index < WIDGET_TABLE_SIZE; ui16Index++) {
/* get data from register */
ui16ReturnValue += ui16NKN_Read16(gui16FileDescriptor,
grWidgetTable[ui16Index].ui8RegisterMode,
grWidgetTable[ui16Index].ui32RegisterAddress,
grWidgetTable[ui16Index].ui8RegisterWidth,
grWidgetTable[ui16Index].ui16RegisterMask,
grWidgetTable[ui16Index].ui8RegisterShift,
&ui16Value);
grWidgetTable[ui16Index].ui16RegisterValue = ui16Value;
grWidgetTable[ui16Index].ui16WidgetValue = ui16Value;
if (!gui8DefaultControlsLoaded)
grWidgetTable[ui16Index].ui16DefaultValue = ui16Value;
switch(ui16Index) {
case WIDGET_INDEX_PROGRAM_MODE:
if (grWidgetTable[ui16Index].ui16RegisterValue >= 0x08) {
vNKN_DataToString(grAuxWidgetTable[WIDGET_AUX_INDEX_MODE_VARI_PROGRAM].prData,
grAuxWidgetTable[WIDGET_AUX_INDEX_MODE_VARI_PROGRAM].ui16RegisterValue,
&pui8String);
gtk_entry_set_text(GTK_ENTRY(grWidgetTable[ui16Index].pWidget), pui8String);
}
else {
vNKN_DataToString(grWidgetTable[ui16Index].prData, grWidgetTable[ui16Index].ui16RegisterValue, &pui8String);
gtk_entry_set_text(GTK_ENTRY(grWidgetTable[ui16Index].pWidget), pui8String);
}
grWidgetTable[WIDGET_INDEX_EXPOSURE].ui8Enable = ((grWidgetTable[ui16Index].ui16RegisterValue == 0x01) || /* shutter */
(grWidgetTable[ui16Index].ui16RegisterValue == 0x03)); /* manual */
gtk_widget_set_sensitive(gpControlsComboExposure, grWidgetTable[WIDGET_INDEX_EXPOSURE].ui8Enable);
break;
case WIDGET_INDEX_EXPOSURE:
/* if not enabled, get effective exposure, so we show always up to date value */
if (!grWidgetTable[WIDGET_INDEX_EXPOSURE].ui8Enable) {
vNKN_DataToString(grAuxWidgetTable[WIDGET_AUX_INDEX_EXPOSURE_EFFECTIVE].prData,
grAuxWidgetTable[WIDGET_AUX_INDEX_EXPOSURE_EFFECTIVE].ui16RegisterValue,
&pui8String);
}
else {
vNKN_DataToString(grWidgetTable[WIDGET_INDEX_EXPOSURE].prData,
grWidgetTable[WIDGET_INDEX_EXPOSURE].ui16RegisterValue,
&pui8String);
}
gtk_entry_set_text(GTK_ENTRY(grWidgetTable[ui16Index].pWidget), pui8String);
break;
case WIDGET_INDEX_CURRENT_FRAME:
if (grWidgetTable[ui16Index].ui16RegisterValue == 0)
sprintf(ui8Buffer, "NO FILM");
else
sprintf(ui8Buffer, "%d", grWidgetTable[ui16Index].ui16RegisterValue - 1);
gtk_entry_set_text(GTK_ENTRY(grWidgetTable[ui16Index].pWidget), ui8Buffer);
break;
case WIDGET_INDEX_FLASH_INSTALL_STATUS:
vNKN_DataToString(grWidgetTable[ui16Index].prData, grWidgetTable[ui16Index].ui16RegisterValue, &pui8String);
gtk_entry_set_text(GTK_ENTRY(grWidgetTable[ui16Index].pWidget), pui8String);
/* enable/disable controls flash controls */
grWidgetTable[WIDGET_INDEX_FLASH_EXPOSURE].ui8Enable = (grWidgetTable[ui16Index].ui16RegisterValue == 0x01);
gtk_widget_set_sensitive(gpControlsComboFlashExposure, grWidgetTable[WIDGET_INDEX_FLASH_EXPOSURE].ui8Enable);
break;
case WIDGET_INDEX_APERTURE_RANGE_LOWER:
vNKN_DataToString(grWidgetTable[ui16Index].prData, grWidgetTable[ui16Index].ui16RegisterValue, &pui8String);
if (grWidgetTable[ui16Index].ui16RegisterValue == grAuxWidgetTable[WIDGET_AUX_INDEX_APERTURE_RANGE_UPPER].ui16RegisterValue)
gtk_entry_set_text(GTK_ENTRY(grWidgetTable[ui16Index].pWidget), pui8String);
else {
vNKN_DataToString(grAuxWidgetTable[WIDGET_AUX_INDEX_APERTURE_RANGE_UPPER].prData,
grAuxWidgetTable[WIDGET_AUX_INDEX_APERTURE_RANGE_UPPER].ui16RegisterValue,
&pui8String2);
sprintf(ui8Buffer, "%s - %s", pui8String2, pui8String);
gtk_entry_set_text(GTK_ENTRY(grWidgetTable[ui16Index].pWidget), ui8Buffer);
}
break;
case WIDGET_INDEX_FOCAL_LENGTH_LOWER:
vNKN_DataToString(grWidgetTable[ui16Index].prData, grWidgetTable[ui16Index].ui16RegisterValue, &pui8String);
if (grWidgetTable[ui16Index].ui16RegisterValue == grAuxWidgetTable[WIDGET_AUX_INDEX_FOCAL_LENGTH_UPPER].ui16RegisterValue)
gtk_entry_set_text(GTK_ENTRY(grWidgetTable[ui16Index].pWidget), pui8String);
else {
vNKN_DataToString(grAuxWidgetTable[WIDGET_AUX_INDEX_FOCAL_LENGTH_UPPER].prData,
grAuxWidgetTable[WIDGET_AUX_INDEX_FOCAL_LENGTH_UPPER].ui16RegisterValue,
&pui8String2);
sprintf(ui8Buffer, "%s - %s", pui8String, pui8String2);
gtk_entry_set_text(GTK_ENTRY(grWidgetTable[ui16Index].pWidget), ui8Buffer);
}
break;
case WIDGET_INDEX_FOCUS_DISTANCE:
fFocusDistance = ui16ControlsConvertFocusDistance(grWidgetTable[ui16Index].ui16RegisterValue);
sprintf(ui8Buffer, "%.2f meter", fFocusDistance/100);
gtk_entry_set_text(GTK_ENTRY(grWidgetTable[ui16Index].pWidget), ui8Buffer);
break;
case WIDGET_INDEX_SELF_TIMER:
sprintf(ui8Buffer, "%d", grWidgetTable[ui16Index].ui16RegisterValue + 2);
gtk_entry_set_text(GTK_ENTRY(GTK_SPIN_BUTTON(grWidgetTable[ui16Index].pWidget)), ui8Buffer);
break;
case WIDGET_INDEX_LCD_TIMER:
sprintf(ui8Buffer, "%d", grWidgetTable[ui16Index].ui16RegisterValue ? grWidgetTable[ui16Index].ui16RegisterValue : 8);
gtk_entry_set_text(GTK_ENTRY(GTK_SPIN_BUTTON(grWidgetTable[ui16Index].pWidget)), ui8Buffer);
break;
case WIDGET_INDEX_FOCUS_STATUS:
/* sprintf(ui8Buffer, "%x", grWidgetTable[ui16Index].ui16RegisterValue); */
vNKN_DataToString(grWidgetTable[ui16Index].prData, (grWidgetTable[ui16Index].ui16RegisterValue < 0xFB), &pui8String);
gtk_entry_set_text(GTK_ENTRY(grWidgetTable[ui16Index].pWidget), pui8String);
break;
default:
if (grWidgetTable[ui16Index].prData == NULL) {
sprintf(ui8Buffer, "%d", grWidgetTable[ui16Index].ui16RegisterValue);
gtk_entry_set_text(GTK_ENTRY(grWidgetTable[ui16Index].pWidget), ui8Buffer);
}
else {
vNKN_DataToString(grWidgetTable[ui16Index].prData, grWidgetTable[ui16Index].ui16RegisterValue, &pui8String);
if (pui8String == NULL) {
sprintf(ui8Buffer, "0x%x:UNKNOWN", grWidgetTable[ui16Index].ui16RegisterValue);
gtk_entry_set_text(GTK_ENTRY(grWidgetTable[ui16Index].pWidget), ui8Buffer);
}
else
gtk_entry_set_text(GTK_ENTRY(grWidgetTable[ui16Index].pWidget), pui8String);
}
}
gnome_appbar_set_progress(GNOME_APPBAR(gpControlsApplicationBar), (gfloat)(1/(gfloat)(WIDGET_TABLE_SIZE + WIDGET_AUX_TABLE_SIZE))*(ui16Index + WIDGET_AUX_TABLE_SIZE));
while (gtk_events_pending())
gtk_main_iteration();
}
gui8DefaultControlsLoaded = TRUE;
ui16ReturnValue += ui16NKN_SignOff(gui16FileDescriptor);
gnome_appbar_set_progress(GNOME_APPBAR(gpControlsApplicationBar), 1);
gnome_appbar_set_status(GNOME_APPBAR(gpControlsApplicationBar), "Download complete.");
vControlsButtonSetSensitive(TRUE);
}
void vControlsButtonUpload_Released(void) {
uint8 *pui8String;
uint16 ui16Index;
uint16 ui16ReturnValue;
vControlsButtonSetSensitive(FALSE);
gnome_appbar_set_progress(GNOME_APPBAR(gpControlsApplicationBar), 0);
gnome_appbar_set_status(GNOME_APPBAR(gpControlsApplicationBar), "Uploading...");
while (gtk_events_pending())
gtk_main_iteration();
ui16ReturnValue = ui16NKN_WakeUp(&gui16FileDescriptor, gpui8Device);
ui16ReturnValue += ui16NKN_SignIn(gui16FileDescriptor);
if (ui16ReturnValue > 0) {
vControlsButtonSetSensitive(TRUE);
gnome_appbar_set_status(GNOME_APPBAR(gpControlsApplicationBar), "");
gnome_app_error(GNOME_APP(gpControlsWindow), "Failed establish connection.");
return;
}
ui16ReturnValue = ui16NKN_SetBaud(gui16FileDescriptor, gui16Baud);
for (ui16Index = 0; ui16Index < WIDGET_TABLE_UPLOAD_SIZE; ui16Index++) {
if (!grWidgetTable[ui16Index].ui8Enable)
continue;
switch(ui16Index) {
case WIDGET_INDEX_PROGRAM_MODE:
pui8String = gtk_entry_get_text(GTK_ENTRY(grWidgetTable[ui16Index].pWidget));
vNKN_StringToData(grWidgetTable[ui16Index].prData, pui8String, &grWidgetTable[ui16Index].ui16WidgetValue);
if (grWidgetTable[ui16Index].ui16WidgetValue == 0xFFFF) {
grWidgetTable[ui16Index].ui16WidgetValue = 0x08;
vNKN_StringToData(grAuxWidgetTable[WIDGET_AUX_INDEX_MODE_VARI_PROGRAM].prData,
pui8String,
&grAuxWidgetTable[WIDGET_AUX_INDEX_MODE_VARI_PROGRAM].ui16WidgetValue);
break;
}
break;
case WIDGET_INDEX_SELF_TIMER:
pui8String = gtk_entry_get_text(GTK_ENTRY(grWidgetTable[ui16Index].pWidget));
grWidgetTable[ui16Index].ui16WidgetValue = atoi(pui8String) - 2;
break;
case WIDGET_INDEX_LCD_TIMER:
pui8String = gtk_entry_get_text(GTK_ENTRY(grWidgetTable[ui16Index].pWidget));
grWidgetTable[ui16Index].ui16WidgetValue = atoi(pui8String);
if (grWidgetTable[ui16Index].ui16WidgetValue == 8)
grWidgetTable[ui16Index].ui16WidgetValue = 0;
break;
default:
if (grWidgetTable[ui16Index].prData == NULL) {
grWidgetTable[ui16Index].ui16WidgetValue = atoi(gtk_entry_get_text(GTK_ENTRY(grWidgetTable[ui16Index].pWidget)));
}
else {
vNKN_StringToData(grWidgetTable[ui16Index].prData, gtk_entry_get_text(GTK_ENTRY(grWidgetTable[ui16Index].pWidget)), &grWidgetTable[ui16Index].ui16WidgetValue);
}
}
if (grWidgetTable[ui16Index].ui16WidgetValue != grWidgetTable[ui16Index].ui16RegisterValue) {
grWidgetTable[ui16Index].ui16RegisterValue = grWidgetTable[ui16Index].ui16WidgetValue;
ui16ReturnValue += ui16NKN_Write16(gui16FileDescriptor,
grWidgetTable[ui16Index].ui8RegisterMode,
grWidgetTable[ui16Index].ui32RegisterAddress,
grWidgetTable[ui16Index].ui8RegisterWidth,
grWidgetTable[ui16Index].ui16RegisterMask,
grWidgetTable[ui16Index].ui8RegisterShift,
grWidgetTable[ui16Index].ui16RegisterValue);
}
gnome_appbar_set_progress(GNOME_APPBAR(gpControlsApplicationBar), (gfloat)(1/(gfloat)(WIDGET_TABLE_UPLOAD_SIZE + 1))*ui16Index);
while (gtk_events_pending())
gtk_main_iteration();
}
ui16Index = WIDGET_AUX_INDEX_MODE_VARI_PROGRAM;
if (grAuxWidgetTable[ui16Index].ui16WidgetValue != grAuxWidgetTable[ui16Index].ui16RegisterValue) {
grAuxWidgetTable[ui16Index].ui16RegisterValue = grAuxWidgetTable[ui16Index].ui16WidgetValue;
ui16ReturnValue += ui16NKN_Write16(gui16FileDescriptor,
grAuxWidgetTable[ui16Index].ui8RegisterMode,
grAuxWidgetTable[ui16Index].ui32RegisterAddress,
grAuxWidgetTable[ui16Index].ui8RegisterWidth,
grAuxWidgetTable[ui16Index].ui16RegisterMask,
grAuxWidgetTable[ui16Index].ui8RegisterShift,
grAuxWidgetTable[ui16Index].ui16RegisterValue);
}
gnome_appbar_set_progress(GNOME_APPBAR(gpControlsApplicationBar), (gfloat)(1/(gfloat)(WIDGET_TABLE_UPLOAD_SIZE + 1))*ui16Index);
while (gtk_events_pending())
gtk_main_iteration();
ui16ReturnValue += ui16NKN_SignOff(gui16FileDescriptor);
gnome_appbar_set_progress(GNOME_APPBAR(gpControlsApplicationBar), 1);
gnome_appbar_set_status(GNOME_APPBAR(gpControlsApplicationBar), "Upload complete.");
vControlsButtonSetSensitive(TRUE);
}
void vControlsButtonDefault_Released(void) {
uint8 *pui8String = NULL;
uint8 ui8Buffer[256];
uint16 ui16Index;
uint16 ui16ReturnValue;
if (!gui8DefaultControlsLoaded) {
gnome_app_message(GNOME_APP(gpControlsWindow), "No default values loaded.\nDefault values will be loaded\nat the first download.");
return;
}
vControlsButtonSetSensitive(FALSE);
gnome_appbar_set_progress(GNOME_APPBAR(gpControlsApplicationBar), 0);
gnome_appbar_set_status(GNOME_APPBAR(gpControlsApplicationBar), "Uploading defaults...");
while (gtk_events_pending())
gtk_main_iteration();
ui16ReturnValue = ui16NKN_WakeUp(&gui16FileDescriptor, gpui8Device);
ui16ReturnValue += ui16NKN_SignIn(gui16FileDescriptor);
if (ui16ReturnValue > 0) {
vControlsButtonSetSensitive(TRUE);
gnome_appbar_set_status(GNOME_APPBAR(gpControlsApplicationBar), "");
gnome_app_error(GNOME_APP(gpControlsWindow), "Failed establish connection.");
return;
}
ui16ReturnValue = ui16NKN_SetBaud(gui16FileDescriptor, gui16Baud);
for (ui16Index = 0; ui16Index < WIDGET_TABLE_UPLOAD_SIZE; ui16Index++) {
if (!grWidgetTable[ui16Index].ui8Enable)
continue;
switch(ui16Index) {
case WIDGET_INDEX_PROGRAM_MODE:
if (grWidgetTable[ui16Index].ui16DefaultValue == 0x08) {
vNKN_DataToString(grAuxWidgetTable[WIDGET_AUX_INDEX_MODE_VARI_PROGRAM].prData,
grAuxWidgetTable[WIDGET_AUX_INDEX_MODE_VARI_PROGRAM].ui16DefaultValue,
&pui8String);
gtk_entry_set_text(GTK_ENTRY(grWidgetTable[ui16Index].pWidget), pui8String);
}
else {
vNKN_DataToString(grWidgetTable[ui16Index].prData, grWidgetTable[ui16Index].ui16DefaultValue, &pui8String);
gtk_entry_set_text(GTK_ENTRY(grWidgetTable[ui16Index].pWidget), pui8String);
}
grWidgetTable[WIDGET_INDEX_EXPOSURE].ui8Enable = ((grWidgetTable[ui16Index].ui16DefaultValue == 0x01) || /* shutter */
(grWidgetTable[ui16Index].ui16DefaultValue == 0x03)); /* manual */
gtk_widget_set_sensitive(gpControlsComboExposure, grWidgetTable[WIDGET_INDEX_EXPOSURE].ui8Enable);
break;
case WIDGET_INDEX_SELF_TIMER:
sprintf(ui8Buffer, "%d", grWidgetTable[ui16Index].ui16DefaultValue + 2);
gtk_entry_set_text(GTK_ENTRY(GTK_SPIN_BUTTON(grWidgetTable[ui16Index].pWidget)), ui8Buffer);
break;
case WIDGET_INDEX_LCD_TIMER:
sprintf(ui8Buffer, "%d", grWidgetTable[ui16Index].ui16DefaultValue ? grWidgetTable[ui16Index].ui16DefaultValue : 8);
gtk_entry_set_text(GTK_ENTRY(GTK_SPIN_BUTTON(grWidgetTable[ui16Index].pWidget)), ui8Buffer);
break;
default:
if (grWidgetTable[ui16Index].prData == NULL) {
sprintf(ui8Buffer, "%d", grWidgetTable[ui16Index].ui16DefaultValue);
gtk_entry_set_text(GTK_ENTRY(grWidgetTable[ui16Index].pWidget), ui8Buffer);
}
else {
vNKN_DataToString(grWidgetTable[ui16Index].prData, grWidgetTable[ui16Index].ui16DefaultValue, &pui8String);
gtk_entry_set_text(GTK_ENTRY(grWidgetTable[ui16Index].pWidget), pui8String);
}
}
if (grWidgetTable[ui16Index].ui16RegisterValue != grWidgetTable[ui16Index].ui16DefaultValue) {
grWidgetTable[ui16Index].ui16RegisterValue = grWidgetTable[ui16Index].ui16DefaultValue;
ui16ReturnValue += ui16NKN_Write16(gui16FileDescriptor,
grWidgetTable[ui16Index].ui8RegisterMode,
grWidgetTable[ui16Index].ui32RegisterAddress,
grWidgetTable[ui16Index].ui8RegisterWidth,
grWidgetTable[ui16Index].ui16RegisterMask,
grWidgetTable[ui16Index].ui8RegisterShift,
grWidgetTable[ui16Index].ui16DefaultValue);
}
gnome_appbar_set_progress(GNOME_APPBAR(gpControlsApplicationBar), (gfloat)(1/(gfloat)(WIDGET_TABLE_UPLOAD_SIZE + 1))*ui16Index);
while (gtk_events_pending())
gtk_main_iteration();
}
ui16Index = WIDGET_AUX_INDEX_MODE_VARI_PROGRAM;
if (grAuxWidgetTable[ui16Index].ui16WidgetValue != grAuxWidgetTable[ui16Index].ui16RegisterValue) {
grAuxWidgetTable[ui16Index].ui16RegisterValue = grAuxWidgetTable[ui16Index].ui16WidgetValue;
ui16ReturnValue += ui16NKN_Write16(gui16FileDescriptor,
grAuxWidgetTable[ui16Index].ui8RegisterMode,
grAuxWidgetTable[ui16Index].ui32RegisterAddress,
grAuxWidgetTable[ui16Index].ui8RegisterWidth,
grAuxWidgetTable[ui16Index].ui16RegisterMask,
grAuxWidgetTable[ui16Index].ui8RegisterShift,
grAuxWidgetTable[ui16Index].ui16DefaultValue);
}
gnome_appbar_set_progress(GNOME_APPBAR(gpControlsApplicationBar), (gfloat)(1/(gfloat)(WIDGET_TABLE_UPLOAD_SIZE + 1))*ui16Index);
while (gtk_events_pending())
gtk_main_iteration();
ui16ReturnValue += ui16NKN_SignOff(gui16FileDescriptor);
gnome_appbar_set_progress(GNOME_APPBAR(gpControlsApplicationBar), 1);
gnome_appbar_set_status(GNOME_APPBAR(gpControlsApplicationBar), "Upload complete.");
vControlsButtonSetSensitive(TRUE);
}
void vControlsButtonFocus_Released(void) {
uint16 ui16ReturnValue;
gnome_appbar_set_progress(GNOME_APPBAR(gpControlsApplicationBar), 0);
gnome_appbar_set_status(GNOME_APPBAR(gpControlsApplicationBar), "Focusing...");
while (gtk_events_pending())
gtk_main_iteration();
ui16ReturnValue = ui16NKN_WakeUp(&gui16FileDescriptor, gpui8Device);
ui16ReturnValue += ui16NKN_SignIn(gui16FileDescriptor);
if (ui16ReturnValue > 0) {
vControlsButtonSetSensitive(TRUE);
gnome_appbar_set_status(GNOME_APPBAR(gpControlsApplicationBar), "");
gnome_app_error(GNOME_APP(gpControlsWindow), "Failed establish connection.");
return;
}
ui16ReturnValue = ui16NKN_Focus(gui16FileDescriptor);;
ui16ReturnValue += ui16NKN_SignOff(gui16FileDescriptor);
gnome_appbar_set_progress(GNOME_APPBAR(gpControlsApplicationBar), 1);
gnome_appbar_set_status(GNOME_APPBAR(gpControlsApplicationBar), "Focusing complete.");
}
void vControlsButtonRelease_Released(void) {
uint16 ui16ReturnValue;
gnome_appbar_set_progress(GNOME_APPBAR(gpControlsApplicationBar), 0);
gnome_appbar_set_status(GNOME_APPBAR(gpControlsApplicationBar), "Taking picture...");
while (gtk_events_pending())
gtk_main_iteration();
ui16ReturnValue = ui16NKN_WakeUp(&gui16FileDescriptor, gpui8Device);
ui16ReturnValue += ui16NKN_SignIn(gui16FileDescriptor);
if (ui16ReturnValue > 0) {
vControlsButtonSetSensitive(TRUE);
gnome_appbar_set_status(GNOME_APPBAR(gpControlsApplicationBar), "");
gnome_app_error(GNOME_APP(gpControlsWindow), "Failed establish connection.");
return;
}
ui16ReturnValue = ui16NKN_Release(gui16FileDescriptor);;
ui16ReturnValue += ui16NKN_SignOff(gui16FileDescriptor);
gnome_appbar_set_progress(GNOME_APPBAR(gpControlsApplicationBar), 1);
gnome_appbar_set_status(GNOME_APPBAR(gpControlsApplicationBar), "Picture taken.");
}
void vControlsButtonHelp_Released(void) {
sint16 si16ReturnValue;
gnome_appbar_set_status(GNOME_APPBAR(gpControlsApplicationBar), "Starting Browser...");
si16ReturnValue = si16UtilLaunchHelpBrowser("help/controls/index.html");
gnome_appbar_set_status(GNOME_APPBAR(gpControlsApplicationBar), "");
if (si16ReturnValue < 0)
gnome_app_error(GNOME_APP(gpControlsWindow), "Failed to start the help browser.");
}
void vControlsBracketingMode_Changed(void) {
uint8 *pui8String = gtk_entry_get_text(GTK_ENTRY(grWidgetTable[WIDGET_INDEX_BRACKETING_MODE].pWidget));
uint16 ui16BracketingMode = 0;
vNKN_StringToData(grWidgetTable[WIDGET_INDEX_BRACKETING_MODE].prData, pui8String, &ui16BracketingMode);
switch (ui16BracketingMode) {
default:
gnome_app_error (GNOME_APP(gpControlsWindow), "Invalid value ");
case 0x0:
gtk_widget_set_sensitive(gpControlsComboFramesPerSequence, 0);
gtk_widget_set_sensitive(gpControlsComboStepsPerFrame, 0);
grWidgetTable[WIDGET_INDEX_FRAMES_PER_SEQUENCE].ui8Enable = 0;
grWidgetTable[WIDGET_INDEX_STEPS_PER_FRAME].ui8Enable = 0;
break;
case 0x1:
case 0x8:
gtk_widget_set_sensitive(gpControlsComboFramesPerSequence, 1);
gtk_widget_set_sensitive(gpControlsComboStepsPerFrame, 0);
grWidgetTable[WIDGET_INDEX_FRAMES_PER_SEQUENCE].ui8Enable = 1;
grWidgetTable[WIDGET_INDEX_STEPS_PER_FRAME].ui8Enable = 0;
break;