sync from upstream up to 22:14a375563e2b

This includes the following commits:

changeset:   22:14a375563e2b
summary:     chang "while" command to "type -P" in bash based configure

changeset:   21:c4bf7c0f33d2
summary:     updated codec paper for RS01 life cycle

changeset:   20:dbcaad8128aa
summary:     replaced build count with mercurial changeset

changeset:   19:fba258a6acfa
summary:     Added tag 0.79.10 for changeset 49950be5a2ef

changeset:   18:49950be5a2ef
summary:     merged some debian patches

changeset:   17:815be3929c41
summary:     merged "easy" patches from Stéphane Lesimple's version

changeset:   16:7d15f8a958cb
summary:     Made printf format strings 32/64bit safe as suggested by Stéphane;

changeset:   15:1055a53b8d6d
summary:     reorganized code for --with-gui=[yes|no] option

changeset:   14:fbe2ae12a32c
summary:     Added tag 0.79.9 for changeset f2fdd6d3a1f5

changeset:   13:f2fdd6d3a1f5
summary:     updated TODO and CHANGELOG

And other changes that were needed to resolve the (many) conflicts.
This commit is contained in:
Stéphane Lesimple
2021-10-04 21:50:50 +02:00
parent 244111e7db
commit db4d3af31d
196 changed files with 17479 additions and 15516 deletions

View File

@@ -20,6 +20,8 @@
* along with dvdisaster. If not, see <http://www.gnu.org/licenses/>.
*/
/*** src type: no GUI code ***/
#include "dvdisaster.h"
/***

View File

@@ -1,6 +1,6 @@
/* dvdisaster: Additional error correction for optical media.
* Copyright (C) 2004-2017 Carsten Gnoerlich.
* Copyright (C) 2019 The dvdisaster development team.
* Copyright (C) 2019-2021 The dvdisaster development team.
*
* Email: support@dvdisaster.org
*
@@ -20,6 +20,8 @@
* along with dvdisaster. If not, see <http://www.gnu.org/licenses/>.
*/
/*** src type: no GUI code ***/
#include "dvdisaster.h"
#if defined(SYS_LINUX)

View File

@@ -20,6 +20,8 @@
* along with dvdisaster. If not, see <http://www.gnu.org/licenses/>.
*/
/*** src type: some GUI code ***/
#include "dvdisaster.h"
#include "inlined-icons.h"
@@ -36,99 +38,9 @@
/* safety margin in case we're getting UTF path names */
#define WIN_MAX_PATH (4*MAX_PATH)
/*
* Find the place of our executable
* (Windows only)
*/
static char* get_exe_path()
{ char path[WIN_MAX_PATH];
int n = GetModuleFileNameA(NULL, path, WIN_MAX_PATH);
if(n>0 && n<WIN_MAX_PATH-1)
{ char *backslash = strrchr(path, '\\');
if(backslash) *backslash=0;
return g_strdup(path);
}
return g_strdup(".");
}
#endif
/***
*** Locate the binary and documentation directory
***/
static void get_base_dirs()
{
/*** Unless completely disabled through a configure option, the
source directory is supposed to hold the most recent files,
so try this first (never under Windows). */
#if defined(WITH_EMBEDDED_SRC_PATH_YES) && !defined(SYS_MINGW)
if(DirStat(SRCDIR))
{ Closure->binDir = g_strdup(SRCDIR);
Closure->docDir = g_strdup_printf("%s/documentation",SRCDIR);
Verbose("Using paths from SRCDIR = %s\n", SRCDIR);
goto find_dotfile;
}
#endif /* WITH_EMBEDDED_SRC_PATH_YES */
/*** Otherwise try the installation directory.
On Unices this is a hardcoded directory. */
#ifndef SYS_MINGW
if(DirStat(BINDIR))
Closure->binDir = g_strdup(BINDIR);
if(DirStat(DOCDIR))
Closure->docDir = g_strdup(DOCDIR);
Verbose("Using hardcoded BINDIR = %s, DOCDIR = %s\n", BINDIR, DOCDIR);
#else
Closure->binDir = get_exe_path();
/* We'll just put the 2 PDF in the same dir, portable mode */
Closure->docDir = g_strdup(Closure->binDir);
Verbose("Using path from get_exe_path() = %s\n", Closure->binDir);
#endif
/* for AppImage, get docdir from env if there */
if (g_getenv("DVDISASTER_DOCDIR"))
{ if (Closure->docDir)
g_free(Closure->docDir);
Closure->docDir = g_strdup(g_getenv("DVDISASTER_DOCDIR"));
}
/*** The location of the dotfile depends on the operating system.
Under Unix the users home directory is used. */
#if defined(WITH_EMBEDDED_SRC_PATH_YES) && !defined(SYS_MINGW)
find_dotfile:
#endif /* WITH_EMBEDDED_SRC_PATH_YES */
#ifndef SYS_MINGW
Closure->homeDir = g_strdup(g_getenv("HOME"));
#else
Closure->homeDir = g_strdup(Closure->binDir); /* portable mode */
#endif
if(!Closure->dotFile) /* may have been set by the --resource-file option */
#ifndef SYS_MINGW
Closure->dotFile = g_strdup_printf("%s/.dvdisaster", Closure->homeDir);
#else
/* Windows doesn't really love dotfiles */
Closure->dotFile = g_strdup_printf("%s/dvdisaster.cfg", Closure->homeDir);
#endif
Verbose("\nUsing file locations:\n"
"- Homedir: %s\n"
"- Bin dir: %s\n"
"- Doc dir: %s\n"
"- dotfile: %s\n\n",
Closure->homeDir,
Closure->binDir,
Closure->docDir,
Closure->dotFile);
}
#ifdef WITH_GUI_YES
/***
*** Set/get color values
@@ -138,8 +50,7 @@ find_dotfile:
* Update color string for the <span color="#f00baa">...</span> string
*/
#ifndef WITH_CLI_ONLY_YES
void UpdateMarkup(char **string, GdkColor *color)
void GuiUpdateMarkup(char **string, GdkColor *color)
{ int hexval;
hexval = (color->red << 8) & 0xff0000;
@@ -154,7 +65,7 @@ void UpdateMarkup(char **string, GdkColor *color)
* Default color values
*/
void DefaultColors()
void GuiDefaultColors()
{
Closure->redText->red = 0xffff;
Closure->redText->green = 0;
@@ -200,8 +111,8 @@ void DefaultColors()
Closure->whiteSector->green = 0xffff;
Closure->whiteSector->blue = 0xffff;
UpdateMarkup(&Closure->redMarkup, Closure->redText);
UpdateMarkup(&Closure->greenMarkup, Closure->greenText);
GuiUpdateMarkup(&Closure->redMarkup, Closure->redText);
GuiUpdateMarkup(&Closure->greenMarkup, Closure->greenText);
}
static void save_colors(FILE *dotfile, char *symbol, GdkColor *color)
@@ -223,7 +134,6 @@ static void get_color(GdkColor *color, char *value)
color->green = hex&0xff00;
color->blue = (hex<<8)&0xff00;
}
#endif
/***
*** Save and restore user settings to/from the .dvdisaster file
@@ -231,7 +141,7 @@ static void get_color(GdkColor *color, char *value)
#define MAX_LINE_LEN 512
void ReadDotfile()
void GuiReadDotfile()
{ FILE *dotfile;
char line[MAX_LINE_LEN];
@@ -247,7 +157,7 @@ void ReadDotfile()
/* Get first MAX_LINE_LEN bytes of line, discard the rest */
line[MAX_LINE_LEN-1] = 1;
if (!fgets(line, MAX_LINE_LEN, dotfile)) break;
if(!fgets(line, MAX_LINE_LEN, dotfile)) break;
if(!line[MAX_LINE_LEN-1]) /* line longer than buffer */
while(!feof(dotfile) && fgetc(dotfile) != '\n')
;
@@ -337,13 +247,12 @@ void ReadDotfile()
if(!strcmp(symbol, "verbose")) { Closure->verbose = atoi(value); continue; }
if(!strcmp(symbol, "welcome-msg")) { Closure->welcomeMessage = atoi(value); continue; }
#ifndef WITH_CLI_ONLY_YES
if(!strcmp(symbol, "positive-text")) { get_color(Closure->greenText, value);
UpdateMarkup(&Closure->greenMarkup, Closure->greenText);
GuiUpdateMarkup(&Closure->greenMarkup, Closure->greenText);
continue;
}
if(!strcmp(symbol, "negative-text")) { get_color(Closure->redText, value);
UpdateMarkup(&Closure->redMarkup, Closure->redText);
GuiUpdateMarkup(&Closure->redMarkup, Closure->redText);
continue;
}
if(!strcmp(symbol, "bar-color")) { get_color(Closure->barColor, value); continue; }
@@ -355,7 +264,6 @@ void ReadDotfile()
if(!strcmp(symbol, "ignored-sector")) { get_color(Closure->blueSector, value); continue; }
if(!strcmp(symbol, "highlit-sector")) { get_color(Closure->whiteSector, value); continue; }
if(!strcmp(symbol, "present-sector")) { get_color(Closure->darkSector, value); continue; }
#endif
}
if(fclose(dotfile))
@@ -442,7 +350,6 @@ static void update_dotfile()
g_fprintf(dotfile, "verbose: %d\n", Closure->verbose);
g_fprintf(dotfile, "welcome-msg: %d\n\n", Closure->welcomeMessage);
#ifndef WITH_CLI_ONLY_YES
save_colors(dotfile, "positive-text", Closure->greenText);
save_colors(dotfile, "negative-text", Closure->redText);
save_colors(dotfile, "bar-color", Closure->barColor);
@@ -454,12 +361,65 @@ static void update_dotfile()
save_colors(dotfile, "ignored-sector", Closure->blueSector);
save_colors(dotfile, "highlit-sector", Closure->whiteSector);
save_colors(dotfile, "present-sector", Closure->darkSector);
#endif
if(fclose(dotfile))
g_printf("Error closing configuration file %s: %s\n",
Closure->dotFile, strerror(errno));
}
#endif /* WITH_GUI_YES */
/***
*** Locate the binary and documentation directory
***/
static void get_base_dirs()
{
/*** Unless completely disabled through a configure option, the
source directory is supposed to hold the most recent files,
so try this first. */
#ifdef WITH_EMBEDDED_SRC_PATH_YES
if(DirStat(SRCDIR))
{ Closure->binDir = g_strdup(SRCDIR);
Closure->docDir = g_strdup_printf("%s/documentation",SRCDIR);
Verbose("Using paths from SRCDIR = %s\n", SRCDIR);
goto find_dotfile;
}
#endif /* WITH_EMBEDDED_SRC_PATH_YES */
/*** Otherwise try the installation directory.
On Unices this is a hardcoded directory. */
#if defined(SYS_LINUX) || defined(SYS_FREEBSD) || defined(SYS_NETBSD) || defined(SYS_UNKNOWN)
if(DirStat(BINDIR))
Closure->binDir = g_strdup(BINDIR);
if(DirStat(DOCDIR))
Closure->docDir = g_strdup(DOCDIR);
Verbose("Using hardcoded BINDIR = %s, DOCDIR = %s\n", BINDIR, DOCDIR);
#endif
/*** The location of the dotfile depends on the operating system.
Under Unix the users home directory is used. */
#ifdef WITH_EMBEDDED_SRC_PATH_YES
find_dotfile:
#endif /* WITH_EMBEDDED_SRC_PATH_YES */
Closure->homeDir = g_strdup(g_getenv("HOME"));
if(!Closure->dotFile) /* may have been set by the --resource-file option */
Closure->dotFile = g_strdup_printf("%s/.dvdisaster", Closure->homeDir);
Verbose("\nUsing file locations:\n"
"- Homedir: %s\n"
"- Bin dir: %s\n"
"- Doc dir: %s\n"
"- dotfile: %s\n\n",
Closure->homeDir,
Closure->binDir,
Closure->docDir,
Closure->dotFile);
}
/***
*** Allocate and initialize our global variables
@@ -561,11 +521,11 @@ void InitClosure()
Closure->bdSize3 = Closure->savedBDSize3 = BDXL_TL_SIZE;
Closure->bdSize4 = Closure->savedBDSize4 = BDXL_QL_SIZE;
#ifndef WITH_CLI_ONLY_YES
Closure->logString = g_string_sized_new(1024);
Closure->logLock = g_malloc0(sizeof(GMutex));
g_mutex_init(Closure->logLock);
#ifdef WITH_GUI_YES
Closure->background = g_malloc0(sizeof(GdkColor));
Closure->foreground = g_malloc0(sizeof(GdkColor));
Closure->grid = g_malloc0(sizeof(GdkColor));
@@ -582,12 +542,9 @@ void InitClosure()
Closure->whiteSector = g_malloc0(sizeof(GdkColor));
Closure->darkSector = g_malloc0(sizeof(GdkColor));
DefaultColors();
Closure->tooltipOn = gdk_pixbuf_new_from_inline(-1, dvdisaster_tooltip, FALSE, NULL);
Closure->tooltipOff = gdk_pixbuf_new_from_inline(-1, dvdisaster_nothing, FALSE, NULL);
#endif
GuiDefaultColors();
#endif /* WITH_GUI_YES */
memset(Closure->bs, '\b', 255);
memset(Closure->sp, ' ', 255);
@@ -631,12 +588,11 @@ void cond_free_ptr_array(GPtrArray *a)
void FreeClosure()
{
#ifndef WITH_CLI_ONLY_YES
#ifdef WITH_GUI_YES
if(Closure->guiMode)
#endif
/* in CLI-only mode, always update dotfile */
update_dotfile();
#endif
cond_free(Closure->cookedVersion);
cond_free(Closure->versionString);
cond_free(Closure->device);
@@ -660,13 +616,9 @@ void FreeClosure()
cond_free(Closure->dDumpDir);
cond_free(Closure->dDumpPrefix);
#ifndef WITH_CLI_ONLY_YES
if(Closure->prefsContext)
FreePreferences(Closure->prefsContext);
if(Closure->rawEditorContext)
FreeRawEditorContext(Closure->rawEditorContext);
if(Closure->crcBuf)
FreeCrcBuf(Closure->crcBuf);
if(Closure->logString)
g_string_free(Closure->logString, TRUE);
@@ -675,6 +627,13 @@ void FreeClosure()
g_free(Closure->logLock);
}
#ifdef WITH_GUI_YES
if(Closure->prefsContext)
GuiFreePreferences(Closure->prefsContext);
if(Closure->rawEditorContext)
GuiFreeRawEditorContext(Closure->rawEditorContext);
if(Closure->drawGC)
g_object_unref(Closure->drawGC);
@@ -697,21 +656,17 @@ void FreeClosure()
cond_free(Closure->greenMarkup);
cond_free(Closure->invisibleDash);
if(Closure->readLinearCurve)
FreeCurve(Closure->readLinearCurve);
if(Closure->readLinearSpiral)
FreeSpiral(Closure->readLinearSpiral);
if(Closure->readAdaptiveSpiral)
FreeSpiral(Closure->readAdaptiveSpiral);
GuiFreeCurve(Closure->readLinearCurve);
GuiFreeSpiral(Closure->readLinearSpiral);
GuiFreeSpiral(Closure->readAdaptiveSpiral);
if(Closure->readAdaptiveSubtitle)
g_free(Closure->readAdaptiveSubtitle);
if(Closure->readAdaptiveErrorMsg)
g_free(Closure->readAdaptiveErrorMsg);
#endif
#endif /* WITH_GUI_YES */
g_free(Closure);
}

View File

@@ -20,6 +20,8 @@
* along with dvdisaster. If not, see <http://www.gnu.org/licenses/>.
*/
/*** src type: no GUI code ***/
#include "dvdisaster.h"
/***

View File

@@ -20,6 +20,8 @@
* along with dvdisaster. If not, see <http://www.gnu.org/licenses/>.
*/
/*** src type: no GUI code ***/
#include "dvdisaster.h"
#include "scsi-layer.h"
@@ -171,13 +173,18 @@ int CheckAgainstCrcBuffer(CrcBuf *cb, gint64 idx, unsigned char *buf)
* cached CRC and md5 informaton
*/
int CrcBufValid(CrcBuf *crcbuf, Image *image, EccHeader *eh)
int CrcBufValid(CrcBuf *crcbuf, Image *image, int mode)
{
if(!crcbuf)
{ Verbose("CrcBufValid: crcbuf==NULL\n");
return FALSE;
}
if(!image)
{ Verbose("CrcBufValid: image==NULL\n");
return FALSE;
}
/* if still in building state we do not have all CRC sums */
if(crcbuf->md5State & MD5_BUILDING)
@@ -192,7 +199,50 @@ int CrcBufValid(CrcBuf *crcbuf, Image *image, EccHeader *eh)
{ Verbose("CrcBufValid: NOT complete\n");
return FALSE;
}
/* compare fingerprints of buffer and image */
if(image->fpState != 2)
{ Verbose("CrcBufValid: image fingerprint not valid (%d)\n",
image->fpState);
return FALSE;
}
if(!crcbuf->fpValid)
{ Verbose("CrcBufValid: crcbuf fingerprint not valid\n");
return FALSE;
}
if(crcbuf->fpSector != image->fpSector)
{ Verbose("CrcBufValid: crcbuf/image have different fingerprint sectors (%d/%" PRId64 ")\n",
crcbuf->fpSector, image->fpSector);
return FALSE;
}
if(memcmp(crcbuf->mediumFP, image->imageFP, 16))
{ Verbose("CrcBufValid: crcbuf/image have different fingerprints\n");
return FALSE;
}
/* additionally, compare the image sizes */
switch(mode)
{ case FULL_IMAGE:
if(image->sectorSize != crcbuf->allSectors)
{ Verbose("CrcBufValid(..., FULL_IMAGE): crcbuf/image have different size (%" PRId64 "/%" PRId64 " sectors)\n",
image->sectorSize, crcbuf->allSectors);
return FALSE;
}
break;
case DATA_SECTORS_ONLY:
if(image->sectorSize != crcbuf->dataSectors)
{ Verbose("CrcBufValid(..., DATA_SECTORS_ONLY): crcbuf/image have different size (%" PRId64 "/%" PRId64 " sectors)\n",
image->sectorSize, crcbuf->dataSectors);
return FALSE;
}
break;
}
Verbose("CrcBufValid: buffer VALID\n");
return TRUE;
}

View File

@@ -19,8 +19,10 @@
* You should have received a copy of the GNU General Public License
* along with dvdisaster. If not, see <http://www.gnu.org/licenses/>.
*/
// DVDISASTER_GUI_FILE
/*** src type: only GUI code ***/
#ifdef WITH_GUI_YES
#include "dvdisaster.h"
/***
@@ -31,7 +33,7 @@
* Initialize the curve
*/
Curve* CreateCurve(GtkWidget *widget, char *left_label, char *left_format, int n_values, int bottom_format)
Curve* GuiCreateCurve(GtkWidget *widget, char *left_label, char *left_format, int n_values, int bottom_format)
{ Curve *curve = g_malloc0(sizeof(Curve));
curve->widget = widget;
@@ -59,8 +61,9 @@ Curve* CreateCurve(GtkWidget *widget, char *left_label, char *left_format, int n
* Get rid of it
*/
void FreeCurve(Curve *curve)
{
void GuiFreeCurve(Curve *curve)
{ if(!curve) return;
g_object_unref(curve->layout);
g_free(curve->leftLabel);
if(curve->leftLogLabel)
@@ -76,7 +79,7 @@ void FreeCurve(Curve *curve)
* Reset the values
*/
void ZeroCurve(Curve *curve)
void GuiZeroCurve(Curve *curve)
{ int i;
if(curve)
@@ -95,19 +98,19 @@ void ZeroCurve(Curve *curve)
* Calculate pixel coords from curve values
*/
int CurveX(Curve *curve, gdouble x)
int GuiCurveX(Curve *curve, gdouble x)
{ gdouble width = (curve->rightX - curve->leftX - curve->margin);
return 1 + curve->leftX + ((gdouble)x * width) / 1000.0;
}
int CurveLX(Curve *curve, gdouble x)
int GuiCurveLX(Curve *curve, gdouble x)
{ gdouble width = (curve->rightX - curve->leftX - curve->margin);
return 1 + curve->leftX + (x * width) / (gdouble)curve->maxX;
}
int CurveY(Curve *curve, gdouble y)
int GuiCurveY(Curve *curve, gdouble y)
{ gdouble hfact;
hfact = (gdouble)(curve->bottomY - curve->topY)
@@ -116,7 +119,7 @@ int CurveY(Curve *curve, gdouble y)
return curve->bottomY - y * hfact;
}
int CurveLogY(Curve *curve, gdouble y) /* not really a log */
int GuiCurveLogY(Curve *curve, gdouble y) /* not really a log */
{ gdouble hfact;
if(y<1) return curve->bottomLY;
@@ -131,21 +134,21 @@ int CurveLogY(Curve *curve, gdouble y) /* not really a log */
*** Calculate the curve geometry
***/
void UpdateCurveGeometry(Curve *curve, char *largest_left_label, int right_padding)
void GuiUpdateCurveGeometry(Curve *curve, char *largest_left_label, int right_padding)
{ GtkAllocation *a = &curve->widget->allocation;
int w,h;
/* Top and bottom margins */
SetText(curve->layout, curve->leftLabel, &w, &h);
GuiSetText(curve->layout, curve->leftLabel, &w, &h);
curve->topY = h + 10;
SetText(curve->layout, "0123456789", &w, &h);
GuiSetText(curve->layout, "0123456789", &w, &h);
curve->bottomY = a->height - h - 10;
/* Left and right margins */
SetText(curve->layout, largest_left_label, &w, &h);
GuiSetText(curve->layout, largest_left_label, &w, &h);
curve->leftX = 5 + 6 + 3 + w;
curve->rightX = a->width - right_padding;
@@ -164,7 +167,7 @@ void UpdateCurveGeometry(Curve *curve, char *largest_left_label, int right_paddi
*** Redraw the coordinate axes
***/
void RedrawAxes(Curve *curve)
void GuiRedrawAxes(Curve *curve)
{ GdkDrawable *d = curve->widget->window;
int i,w,h,x,y;
int yg=0;
@@ -184,7 +187,7 @@ void RedrawAxes(Curve *curve)
}
gdk_gc_set_rgb_fg_color(Closure->drawGC, Closure->curveColor);
SetText(curve->layout, curve->leftLabel, &w, &h);
GuiSetText(curve->layout, curve->leftLabel, &w, &h);
x = curve->leftX - w/2;
if(x < 5) x = 5;
gdk_draw_layout(d, Closure->drawGC,
@@ -198,7 +201,7 @@ void RedrawAxes(Curve *curve)
char buf[16];
gdk_gc_set_rgb_fg_color(Closure->drawGC, Closure->logColor);
SetText(curve->layout, curve->leftLogLabel, &w, &h);
GuiSetText(curve->layout, curve->leftLogLabel, &w, &h);
x = curve->leftX - w/2;
if(x < 5) x = 5;
@@ -207,9 +210,9 @@ void RedrawAxes(Curve *curve)
for(val=400; val>3; val/=2)
{ y = CurveLogY(curve, val);
{ y = GuiCurveLogY(curve, val);
sprintf(buf,"%d",val);
SetText(curve->layout, buf, &w, &h);
GuiSetText(curve->layout, buf, &w, &h);
gdk_gc_set_rgb_fg_color(Closure->drawGC, Closure->logColor);
gdk_draw_layout(d, Closure->drawGC, curve->leftX-9-w, y-h/2, curve->layout);
gdk_gc_set_rgb_fg_color(Closure->drawGC, Closure->foreground);
@@ -218,13 +221,13 @@ void RedrawAxes(Curve *curve)
gdk_draw_line(d, Closure->drawGC, curve->leftX, y, curve->rightX, y);
val /=2;
y = CurveLogY(curve, val);
y = GuiCurveLogY(curve, val);
gdk_gc_set_rgb_fg_color(Closure->drawGC, Closure->foreground);
gdk_draw_line(d, Closure->drawGC, curve->leftX-3, y, curve->leftX, y);
if(curve->bottomLY-curve->topLY > 8*h)
{ sprintf(buf,"%d",val);
SetText(curve->layout, buf, &w, &h);
GuiSetText(curve->layout, buf, &w, &h);
gdk_gc_set_rgb_fg_color(Closure->drawGC, Closure->logColor);
gdk_draw_layout(d, Closure->drawGC, curve->leftX-9-w, y-h/2, curve->layout);
}
@@ -240,9 +243,9 @@ void RedrawAxes(Curve *curve)
{ char buf[4];
g_snprintf(buf, 4, curve->leftFormat, i);
SetText(curve->layout, buf, &w, &h);
GuiSetText(curve->layout, buf, &w, &h);
y = yg = CurveY(curve, i);
y = yg = GuiCurveY(curve, i);
gdk_gc_set_rgb_fg_color(Closure->drawGC, Closure->curveColor);
gdk_draw_layout(d, Closure->drawGC, curve->leftX-9-w, y-h/2, curve->layout);
gdk_gc_set_rgb_fg_color(Closure->drawGC, Closure->foreground);
@@ -252,7 +255,7 @@ void RedrawAxes(Curve *curve)
gdk_draw_line(d, Closure->drawGC, curve->leftX, y, curve->rightX, y);
gdk_gc_set_rgb_fg_color(Closure->drawGC, Closure->foreground);
y = CurveY(curve, i+step/2);
y = GuiCurveY(curve, i+step/2);
if(y >= curve->topY)
gdk_draw_line(d, Closure->drawGC, curve->leftX-3, y, curve->leftX, y);
}
@@ -304,9 +307,9 @@ void RedrawAxes(Curve *curve)
else g_snprintf(buf, 10, "%3.1fG",(gdouble)i/1024.0);
break;
}
SetText(curve->layout, buf, &w, &h);
GuiSetText(curve->layout, buf, &w, &h);
x = CurveLX(curve,i)-1;
x = GuiCurveLX(curve,i)-1;
gdk_draw_line(d, Closure->drawGC, x, bottom_y+6, x, bottom_y);
gdk_draw_layout(d, Closure->drawGC, x-w/2, bottom_y+8, curve->layout);
@@ -319,7 +322,7 @@ void RedrawAxes(Curve *curve)
}
gdk_gc_set_rgb_fg_color(Closure->drawGC, Closure->foreground);
x = CurveLX(curve,i+step/2)-1;
x = GuiCurveLX(curve,i+step/2)-1;
if(x < curve->rightX)
gdk_draw_line(d, Closure->drawGC, x, bottom_y+3, x, bottom_y);
}
@@ -329,21 +332,21 @@ void RedrawAxes(Curve *curve)
* Redraw the curve
*/
void RedrawCurve(Curve *curve, int last)
void GuiRedrawCurve(Curve *curve, int last)
{ int i,x0,x1,fy0,fy1;
x0 = CurveX(curve, 0);
fy0 = CurveY(curve, curve->fvalue[0]);
x0 = GuiCurveX(curve, 0);
fy0 = GuiCurveY(curve, curve->fvalue[0]);
gdk_gc_set_rgb_fg_color(Closure->drawGC, Closure->curveColor);
/* Draw the curve */
for(i=1; i<=last; i++)
{ x1 = CurveX(curve, i);
{ x1 = GuiCurveX(curve, i);
if(curve->enable & DRAW_ICURVE)
{ int iy = CurveY(curve, curve->ivalue[i]);
{ int iy = GuiCurveY(curve, curve->ivalue[i]);
if(curve->ivalue[i] > 0)
{ gdk_gc_set_rgb_fg_color(Closure->drawGC, Closure->barColor);
@@ -354,7 +357,7 @@ void RedrawCurve(Curve *curve, int last)
}
if(curve->enable & DRAW_LCURVE)
{ int iy = CurveLogY(curve, curve->lvalue[i]);
{ int iy = GuiCurveLogY(curve, curve->lvalue[i]);
if(curve->lvalue[i] > 0)
{ gdk_gc_set_rgb_fg_color(Closure->drawGC, Closure->logColor);
@@ -365,7 +368,7 @@ void RedrawCurve(Curve *curve, int last)
}
if(curve->enable & DRAW_FCURVE && curve->fvalue[i] >= 0)
{ fy1 = CurveY(curve, curve->fvalue[i]);
{ fy1 = GuiCurveY(curve, curve->fvalue[i]);
if(x0 < x1)
{ gdk_gc_set_rgb_fg_color(Closure->drawGC, Closure->curveColor);
@@ -377,3 +380,4 @@ void RedrawCurve(Curve *curve, int last)
x0 = x1;
}
}
#endif /* WITH_GUI_YES */

View File

@@ -20,6 +20,8 @@
* along with dvdisaster. If not, see <http://www.gnu.org/licenses/>.
*/
/*** src type: no GUI code ***/
#include "dvdisaster.h"
#include "rs02-includes.h"
@@ -499,7 +501,6 @@ void Erase(char *arg)
image = OpenImageFromFile(Closure->imageName, O_RDWR, IMG_PERMS);
if(!image)
Stop(_("Can't open %s:\n%s"), Closure->imageName, strerror(errno));
ExamineUDF(image); /* get the volume label */
/** See if there is a special debugging option following
the sector range. This is intentionally an undocumented feature. */

View File

@@ -20,6 +20,8 @@
* along with dvdisaster. If not, see <http://www.gnu.org/licenses/>.
*/
/*** src type: some GUI code ***/
#include "dvdisaster.h"
#define DSM_VERSION "1.00"
@@ -260,7 +262,7 @@ int CheckForMissingSectors(unsigned char *buf, guint64 sector,
*** Dialogue for indicating problem with the missing sector
***/
#ifndef WITH_CLI_ONLY_YES
#ifdef WITH_GUI_YES
static void insert_buttons(GtkDialog *dialog)
{
gtk_dialog_add_buttons(dialog,
@@ -270,13 +272,10 @@ static void insert_buttons(GtkDialog *dialog)
#endif
void ExplainMissingSector(unsigned char *buf, guint64 sector, int error, int source_type, int *number)
{
#ifndef WITH_CLI_ONLY_YES
int answer;
#endif
guint64 recorded_number;
{ guint64 recorded_number;
char *vol_label, *label_msg;
int answer;
if(Closure->noMissingWarnings)
return;
@@ -293,11 +292,7 @@ void ExplainMissingSector(unsigned char *buf, guint64 sector, int error, int sou
/* In CLI mode, only report the first unrecoverable sector unless verbose is given. */
#ifndef WITH_CLI_ONLY_YES
if(!Closure->guiMode && !Closure->verbose && *number > 0)
#else
if(!Closure->verbose && *number > 0)
#endif
{ if(*number == 1)
PrintLog(_("* ... more unrecoverable sectors found ...\n"
"* further messages are suppressed unless the -v option is given.\n"));
@@ -312,13 +307,9 @@ void ExplainMissingSector(unsigned char *buf, guint64 sector, int error, int sou
vol_label = get_volume_label(buf);
if(vol_label)
{
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
{ if(Closure->guiMode)
label_msg = g_strdup_printf(_("\n\nThe label of the original (defective) medium was:\n%s\n\n"), vol_label);
else
#endif
label_msg = g_strdup_printf(_("\n* \n* The label of the original (defective) medium was:\n* \n* %s\n* "), vol_label);
else label_msg = g_strdup_printf(_("\n* \n* The label of the original (defective) medium was:\n* \n* %s\n* "), vol_label);
g_free(vol_label);
}
else label_msg = g_strdup("\n");
@@ -339,18 +330,14 @@ void ExplainMissingSector(unsigned char *buf, guint64 sector, int error, int sou
"repaired by dvdisaster. Also it will not be possible to create\n"
"error correction data for it. Sorry for the bad news.\n");
#ifndef WITH_CLI_ONLY_YES
if(!Closure->guiMode)
#endif
PrintLogWithAsterisks(msg,sector, recorded_number, label_msg);
#ifndef WITH_CLI_ONLY_YES
else
{ answer = ModalDialog(GTK_MESSAGE_ERROR, GTK_BUTTONS_NONE, insert_buttons, msg,
sector, recorded_number, label_msg);
{ answer = GuiModalDialog(GTK_MESSAGE_ERROR, GTK_BUTTONS_NONE, insert_buttons,
msg, sector, recorded_number, label_msg);
if(answer) Closure->noMissingWarnings = TRUE;
}
#endif
}
break;
@@ -366,17 +353,13 @@ void ExplainMissingSector(unsigned char *buf, guint64 sector, int error, int sou
"repaired by dvdisaster. Also it will not be possible to create\n"
"error correction data for it. Sorry for the bad news.\n");
#ifndef WITH_CLI_ONLY_YES
if(!Closure->guiMode)
#endif
PrintLogWithAsterisks(msg,sector, label_msg);
#ifndef WITH_CLI_ONLY_YES
PrintLogWithAsterisks(msg,sector, label_msg);
else
{ answer = ModalDialog(GTK_MESSAGE_ERROR, GTK_BUTTONS_NONE, insert_buttons, msg,
sector, label_msg);
{ answer = GuiModalDialog(GTK_MESSAGE_ERROR, GTK_BUTTONS_NONE, insert_buttons,
msg, sector, label_msg);
if(answer) Closure->noMissingWarnings = TRUE;
}
#endif
}
break;
}
@@ -395,18 +378,14 @@ void ExplainMissingSector(unsigned char *buf, guint64 sector, int error, int sou
"repaired by dvdisaster. Also it will not be possible to create\n"
"error correction data for it. Sorry for the bad news.\n");
#ifndef WITH_CLI_ONLY_YES
if(!Closure->guiMode)
#endif
PrintLogWithAsterisks(msg, sector);
#ifndef WITH_CLI_ONLY_YES
else
{ answer = ModalDialog(GTK_MESSAGE_ERROR, GTK_BUTTONS_NONE, insert_buttons, msg,
sector);
{ answer = GuiModalDialog(GTK_MESSAGE_ERROR, GTK_BUTTONS_NONE, insert_buttons, msg,
sector);
if(answer) Closure->noMissingWarnings = TRUE;
}
#endif
}
/* Error was found while reading an ecc file */
@@ -419,18 +398,14 @@ void ExplainMissingSector(unsigned char *buf, guint64 sector, int error, int sou
"in the ecc file are missing and its error correction\n"
"capacity will be reduced.\n");
#ifndef WITH_CLI_ONLY_YES
if(!Closure->guiMode)
#endif
PrintLogWithAsterisks(msg, sector);
#ifndef WITH_CLI_ONLY_YES
else
{ answer = ModalDialog(GTK_MESSAGE_ERROR, GTK_BUTTONS_NONE, insert_buttons, msg,
sector);
{ answer = GuiModalDialog(GTK_MESSAGE_ERROR, GTK_BUTTONS_NONE, insert_buttons, msg,
sector);
if(answer) Closure->noMissingWarnings = TRUE;
}
#endif
}
g_free(label_msg);

View File

@@ -20,13 +20,15 @@
* along with dvdisaster. If not, see <http://www.gnu.org/licenses/>.
*/
/*** src type: some GUI code ***/
#include "dvdisaster.h"
/*
* Those are now declared as extern in dvdisaster.h,
* and as such are accessible from everywhere.
* MinGW didn't link these being declared directly
* MinGW didn't like these being declared directly
* in dvdisaster.h (ended up having one copy of each
* struct for every .c including dvdisaster.h)
*/
@@ -117,19 +119,19 @@ typedef enum
int main(int argc, char *argv[])
{ int mode = MODE_NONE;
int sequence = MODE_NONE;
#ifndef WITH_CLI_ONLY_YES
int devices_queried = FALSE;
#endif
char *debug_arg = NULL;
char *read_range = NULL;
int debug_mode_required=FALSE;
#ifdef WITH_NLS_YES
char *locale_test;
#ifdef WITH_EMBEDDED_SRC_PATH_YES
char src_locale_path[strlen(SRCDIR)+10];
#endif /* WITH_EMBEDDED_SRC_PATH_YES */
#endif
int debug_mode_required=FALSE;
#ifdef WITH_GUI_YES
int devices_queried = FALSE;
#endif
#ifdef WITH_MEMDEBUG_YES
atexit(check_memleaks);
#endif
@@ -778,7 +780,7 @@ int main(int argc, char *argv[])
if(!Closure->device && mode == MODE_SEQUENCE
&& (sequence & (1<<MODE_READ | 1<<MODE_SCAN)))
{ Closure->device = DefaultDevice();
#ifndef WITH_CLI_ONLY_YES
#ifdef WITH_GUI_YES
devices_queried = TRUE;
#endif
}
@@ -939,10 +941,10 @@ int main(int argc, char *argv[])
/*** If no mode was selected, print the help screen. */
#ifndef WITH_CLI_ONLY_YES
#ifdef WITH_GUI_YES
if(mode == MODE_HELP)
#else
if(mode == MODE_HELP || mode == MODE_NONE)
if(mode == MODE_NONE || mode == MODE_HELP)
#endif
{
/* TRANSLATORS: Program options like -r and --read are not to be translated
@@ -1042,10 +1044,10 @@ int main(int argc, char *argv[])
exit(EXIT_FAILURE);
}
#ifndef WITH_CLI_ONLY_YES
/* If no mode was selected at the command line,
start the graphical user interface. */
#ifdef WITH_GUI_YES
if(mode == MODE_NONE)
{
/* We need to query devices in order to build
@@ -1070,11 +1072,11 @@ int main(int argc, char *argv[])
}
Closure->guiMode = TRUE;
ReadDotfile();
CreateMainWindow(&argc, &argv);
GuiReadDotfile();
GuiCreateMainWindow(&argc, &argv);
}
#endif
FreeClosure();
exit(exitCode);
}

View File

@@ -38,25 +38,13 @@
#define _GNU_SOURCE
/* under MinGW, __attribute__ format printf doesn't work and outputs warnings for %lld,
* even if it's supported and doesn't output any warning under -Wformat when directly
* used with the real printf() func. However 'gnu_printf' works, see
* https://github.com/ocornut/imgui/issues/3592
*/
#ifdef __MINGW32__ /* defined under 32 and 64 bits mingw */
# define PRINTF_FLAVOR gnu_printf
#else
# define PRINTF_FLAVOR printf
#endif
#define PRINTF_FORMAT2(ARG1,ARG2) __attribute__((format(PRINTF_FLAVOR, ARG1, ARG2)))
#define PRINTF_FORMAT(ARG) PRINTF_FORMAT2(ARG,ARG+1)
#include <glib.h>
#include <glib/gprintf.h>
#ifndef WITH_CLI_ONLY_YES
#include <gtk/gtk.h>
#ifdef WITH_GUI_YES
#include <gtk/gtk.h>
#else
#include <glib-object.h>
#endif
#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
@@ -82,6 +70,48 @@
#error "need multithreading glib2"
#endif
#ifdef WITH_GUI_NO
/* define some symbols normally coming from gtk and helper libs */
#define GTK_MESSAGE_QUESTION 0
#define GTK_MESSAGE_WARNING 0
#define GTK_MESSAGE_ERROR 0
#define GTK_BUTTONS_OK 0
#define GTK_BUTTONS_OK_CANCEL 0
#define GTK_BUTTONS_NONE 0
typedef int GtkButtonsType;
typedef void GtkDialog;
typedef void GtkLabel;
typedef void GtkNotebook;
typedef int GtkMessageType;
typedef void GtkScrolledWindow;
typedef void GtkTextBuffer;
typedef void GtkTooltips;
typedef void GtkWidget;
typedef void GtkWindow;
typedef void GdkColor;
typedef void GdkDrawable;
typedef void GdkGC;
typedef void GdkPixbuf;
typedef void PangoLayout;
#endif
/* under MinGW, __attribute__ format printf doesn't work and outputs warnings for %lld,
* even if it's supported and doesn't output any warning under -Wformat when directly
* used with the real printf() func. However 'gnu_printf' works, see
* https://github.com/ocornut/imgui/issues/3592
*/
#ifdef __MINGW32__ /* defined under 32 and 64 bits mingw */
# define PRINTF_FLAVOR gnu_printf
#else
# define PRINTF_FLAVOR printf
#endif
#define PRINTF_FORMAT2(ARG1,ARG2) __attribute__((format(PRINTF_FLAVOR, ARG1, ARG2)))
#define PRINTF_FORMAT(ARG) PRINTF_FORMAT2(ARG,ARG+1)
/* Phrase extraction for gettext()
Note that these functions are even required when
WITH_NLS_NO is set! */
@@ -110,12 +140,6 @@
#define round(x) rint(x)
#endif
#ifdef WITH_CLI_ONLY_YES
#define STATUS_LABEL_OR_NULL NULL
#else
#define STATUS_LABEL_OR_NULL Closure->status
#endif
/* Some standard media sizes */
/* WARNING: These values affect RS03 in non-obvious ways.
@@ -309,15 +333,12 @@ typedef struct _GlobalClosure
struct _CrcBuf *crcBuf; /* crcBuf of last image read */
#ifndef WITH_CLI_ONLY_YES
/*** GUI-related things */
int guiMode; /* TRUE if GUI is active */
int stopActions; /* crude method to stop ongoing action(s) */
#endif
int noMissingWarnings; /* suppress warnings about inconsistent missing sectors */
#ifndef WITH_CLI_ONLY_YES
GtkWidget *logWidget; /* Dialog for the log display */
GtkScrolledWindow *logScroll; /* and its scrolled window */
GtkTextBuffer *logBuffer; /* Text buffer for the log output */
@@ -344,7 +365,7 @@ typedef struct _GlobalClosure
GtkWidget *eccEntry; /* ecc name entry field */
GtkWidget *notebook; /* The notebook behind our central output area */
GtkLabel *status; /* The status label */
GtkWidget *status; /* The status label */
GtkWidget *prefsButton;
GtkWidget *helpButton;
@@ -401,9 +422,7 @@ typedef struct _GlobalClosure
GtkWidget *readLinearErrors;
GtkWidget *readLinearFootline;
GtkWidget *readLinearFootlineBox;
#endif
gint64 crcErrors, readErrors; /* these are passed between threads and must therefore be global */
#ifndef WITH_CLI_ONLY_YES
/*** Widgets for the adaptive reading action */
@@ -413,7 +432,6 @@ typedef struct _GlobalClosure
char *readAdaptiveSubtitle;
char *readAdaptiveErrorMsg;
int additionalSpiralColor;
#endif
} GlobalClosure;
@@ -508,7 +526,7 @@ typedef struct _CrcBlock
} CrcBlock;
/***
*** dvdisaster.c
*** forward declarations
***/
extern struct _RawBuffer *rawbuffer_forward;
@@ -551,15 +569,16 @@ int ProbeCacheLineSize();
void InitClosure(void);
void LocalizedFileDefaults(void);
#ifndef WITH_CLI_ONLY_YES
void UpdateMarkup(char**, GdkColor*);
void DefaultColors(void);
#endif
void FreeClosure(void);
void ReadDotfile(void);
void WriteSignature(void);
int VerifySignature(void);
#ifdef WITH_GUI_YES
void GuiDefaultColors(void);
void GuiReadDotfile(void);
void GuiUpdateMarkup(char**, GdkColor*);
#endif
/***
*** crc32.c
***/
@@ -617,16 +636,20 @@ enum
#define CRCBUF_UPDATE_ALL 3
#define CRCBUF_UPDATE_CRC_AFTER_DATA 1<<2
/* Modes for CtcBufValid */
#define FULL_IMAGE 0
#define DATA_SECTORS_ONLY 1
CrcBuf *CreateCrcBuf(struct _Image*);
void FreeCrcBuf(CrcBuf*);
int CheckAgainstCrcBuffer(CrcBuf*, gint64, unsigned char*);
int AddSectorToCrcBuffer(CrcBuf*, int, guint64, unsigned char*, int);
int CrcBufValid(CrcBuf*, struct _Image*, EccHeader*);
int CrcBufValid(CrcBuf*, struct _Image*, int);
void PrintCrcBuf(CrcBuf*);
#ifndef WITH_CLI_ONLY_YES
/***
*** curve.c
***/
@@ -659,17 +682,19 @@ typedef struct _Curve
#define DRAW_FCURVE (1<<1)
#define DRAW_LCURVE (1<<2)
Curve* CreateCurve(GtkWidget*, char*, char*, int, int);
void ZeroCurve(Curve*);
void FreeCurve(Curve*);
#ifdef WITH_GUI_YES
Curve* GuiCreateCurve(GtkWidget*, char*, char*, int, int);
void GuiZeroCurve(Curve*);
void GuiFreeCurve(Curve*);
void UpdateCurveGeometry(Curve*, char*, int);
void GuiUpdateCurveGeometry(Curve*, char*, int);
int CurveX(Curve*, gdouble);
int CurveY(Curve*, gdouble);
int CurveLogY(Curve*, gdouble);
void RedrawAxes(Curve*);
void RedrawCurve(Curve*, int);
int GuiCurveX(Curve*, gdouble);
int GuiCurveY(Curve*, gdouble);
int GuiCurveLogY(Curve*, gdouble);
void GuiRedrawAxes(Curve*);
void GuiRedrawCurve(Curve*, int);
#endif
/***
@@ -737,9 +762,7 @@ void PrintEccHeader(EccHeader*);
*** fix-window.c
***/
#ifndef WITH_CLI_ONLY_YES
void CreateFixWindow(GtkWidget*);
#endif
/***
*** galois.c
@@ -797,7 +820,6 @@ void FreeGaloisTables(GaloisTables*);
ReedSolomonTables *CreateReedSolomonTables(GaloisTables*, gint32, gint32, int);
void FreeReedSolomonTables(ReedSolomonTables*);
#ifndef WITH_CLI_ONLY_YES
/***
*** help-dialogs.c
***/
@@ -820,25 +842,26 @@ typedef struct _LabelWithOnlineHelp
int outerPadding; /* Padding between window and outer vbox */
} LabelWithOnlineHelp;
LabelWithOnlineHelp* CreateLabelWithOnlineHelp(char*, char*);
LabelWithOnlineHelp* CloneLabelWithOnlineHelp(LabelWithOnlineHelp*, char*);
void FreeLabelWithOnlineHelp(LabelWithOnlineHelp*);
void SetOnlineHelpLinkText(LabelWithOnlineHelp*, char*);
void AddHelpListItem(LabelWithOnlineHelp*, char*, ...) PRINTF_FORMAT(2);
void AddHelpParagraph(LabelWithOnlineHelp*, char*, ...) PRINTF_FORMAT(2);
void AddHelpWidget(LabelWithOnlineHelp*, GtkWidget*);
#ifdef WITH_GUI_YES
LabelWithOnlineHelp* GuiCreateLabelWithOnlineHelp(char*, char*);
LabelWithOnlineHelp* GuiCloneLabelWithOnlineHelp(LabelWithOnlineHelp*, char*);
void GuiFreeLabelWithOnlineHelp(LabelWithOnlineHelp*);
void GuiSetOnlineHelpLinkText(LabelWithOnlineHelp*, char*);
void GuiAddHelpListItem(LabelWithOnlineHelp*, char*, ...) PRINTF_FORMAT(2);
void GuiAddHelpParagraph(LabelWithOnlineHelp*, char*, ...) PRINTF_FORMAT(2);
void GuiAddHelpWidget(LabelWithOnlineHelp*, GtkWidget*);
/* Specific online help dialogs */
GtkWidget* ShowTextfile(char*, char*, char*, GtkScrolledWindow**, GtkTextBuffer**);
void ShowGPL();
void ShowLog();
void UpdateLog();
void AboutDialog();
GtkWidget* GuiShowTextfile(char*, char*, char*, GtkScrolledWindow**, GtkTextBuffer**);
void GuiShowGPL();
void GuiShowLog();
void GuiUpdateLog();
void GuiAboutDialog();
void AboutText(GtkWidget*, char*, ...) PRINTF_FORMAT(2);
void AboutLink(GtkWidget*, char*, char*);
void AboutTextWithLink(GtkWidget*, char*, char*);
void GuiAboutText(GtkWidget*, char*, ...) PRINTF_FORMAT(2);
void GuiAboutLink(GtkWidget*, char*, char*);
void GuiAboutTextWithLink(GtkWidget*, char*, char*);
#endif
/***
@@ -858,7 +881,9 @@ int AckHeuristic(struct _RawBuffer*);
*** icon-factory.c
***/
void CreateIconFactory();
#ifdef WITH_GUI_YES
void GuiCreateIconFactory();
#endif
/***
*** image.c
@@ -1018,16 +1043,21 @@ typedef enum
ACTION_STRIP /* --- does not have a window */
} MajorActions;
void CreateMainWindow(int*, char***);
void ContinueWithAction(int);
#ifdef WITH_GUI_YES
void GuiCreateMainWindow(int*, char***);
void GuiContinueWithAction(int);
#endif
/***
*** medium-info.c
***/
void CreateMediumInfoWindow(void);
void PrintMediumInfo(void*);
#ifdef WITH_GUI_YES
void GuiCreateMediumInfoWindow(void);
#endif
/***
*** memtrack.c
***/
@@ -1077,14 +1107,14 @@ int forget(void*);
void check_memleaks(void);
#ifndef WITH_CLI_ONLY_YES
/***
*** menubar.c
***/
void AttachTooltip(GtkWidget*, char*, char*);
GtkWidget* CreateMenuBar(GtkWidget*);
GtkWidget* CreateToolBar(GtkWidget*);
#ifdef WITH_GUI_YES
void GuiAttachTooltip(GtkWidget*, char*, char*);
GtkWidget* GuiCreateMenuBar(GtkWidget*);
GtkWidget* GuiCreateToolBar(GtkWidget*);
#endif
/***
@@ -1098,7 +1128,7 @@ GtkWidget* CreateToolBar(GtkWidget*);
#define ECC_MD5_BAD (1<<2)
typedef struct _Method
{ char name[5]; /* Method name tag */
{ char name[4]; /* Method name tag */
guint32 properties; /* see definition above */
char *description; /* Fulltext description */
char *menuEntry; /* Text for use in preferences menu */
@@ -1113,7 +1143,6 @@ typedef struct _Method
void (*updateCksums)(Image*, gint64, unsigned char*);/* checksum while reading an image */
int (*finalizeCksums)(Image*);
void *ckSumClosure; /* working closure for above */
#ifndef WITH_CLI_ONLY_YES
void (*createVerifyWindow)(struct _Method*, GtkWidget*);
void (*createCreateWindow)(struct _Method*, GtkWidget*);
void (*createFixWindow)(struct _Method*, GtkWidget*);
@@ -1123,12 +1152,9 @@ typedef struct _Method
void (*resetFixWindow)(struct _Method*);
void (*resetPrefsPage)(struct _Method*);
void (*readPreferences)(struct _Method*);
#endif
void (*destroy)(struct _Method*);
#ifndef WITH_CLI_ONLY_YES
int tabWindowIndex; /* our position in the (invisible) notebook */
void *widgetList; /* linkage to window system */
#endif
} Method;
void BindMethods(void); /* created by configure in method-link.c */
@@ -1159,12 +1185,9 @@ void Verbose(char*, ...) PRINTF_FORMAT(1);
void PrintTimeToLog(GTimer*, char*, ...) PRINTF_FORMAT(2);
void PrintProgress(char*, ...) PRINTF_FORMAT(1);
void ClearProgress(void);
#ifndef WITH_CLI_ONLY_YES
void PrintCLIorLabel(GtkLabel*, char*, ...) PRINTF_FORMAT(2);
#else
void PrintCLIorLabel(void*, char*, ...) PRINTF_FORMAT(2);
#endif
void PrintCLIorLabel(GtkWidget*, char*, ...) PRINTF_FORMAT(2);
int GetLongestTranslation(char*, ...);
void vLogWarning(char*, va_list);
void LogWarning(char*, ...) PRINTF_FORMAT(1);
void Stop(char*, ...) PRINTF_FORMAT(1);
@@ -1173,51 +1196,60 @@ void UnregisterCleanup(void);
GThread* CreateGThread(GThreadFunc, gpointer);
#ifndef WITH_CLI_ONLY_YES
void ShowWidget(GtkWidget*);
void AllowActions(gboolean);
/***
*** misc-gui.c
***/
void ShowMessage(GtkWindow*, char*, GtkMessageType);
GtkWidget* CreateMessage(char*, GtkMessageType, ...) PRINTF_FORMAT2(1,3);
void SetLabelText(GtkLabel*, char*, ...) PRINTF_FORMAT(2);
void SetProgress(GtkWidget*, int, int);
int ModalDialog(GtkMessageType, GtkButtonsType, void (*)(GtkDialog*), char*, ...) PRINTF_FORMAT(4);
int ModalWarning(GtkMessageType, GtkButtonsType, void (*)(GtkDialog*), char*, ...) PRINTF_FORMAT(4);
#define ModalWarningOrCLI(a,b,c,d,...) ModalWarning(a,b,c,d,__VA_ARGS__)
#ifdef WITH_GUI_YES
void GuiAllowActions(gboolean);
int GuiConfirmEccDeletion(char *);
int GuiConfirmImageDeletion(char *);
GtkWidget* GuiCreateMessage(char*, GtkMessageType, ...) PRINTF_FORMAT2(1,3);
void GuiExitWorkerThread();
int GuiGetLabelWidth(GtkLabel*, char*, ...) PRINTF_FORMAT(2);
void GuiLockLabelSize(GtkWidget*, char*, ...) PRINTF_FORMAT(2);
int GuiModalDialog(GtkMessageType, GtkButtonsType, void (*)(GtkDialog*), char*, ...) PRINTF_FORMAT(4);
void GuiReverseCancelOK(GtkDialog*);
void GuiSetLabelText(GtkWidget*, char*, ...) PRINTF_FORMAT(2);
void GuiShowMessage(GtkWindow*, char*, GtkMessageType);
void GuiSetProgress(GtkWidget*, int, int);
void GuiSetText(PangoLayout*, char*, int*, int*);
void GuiShowWidget(GtkWidget*);
void GuiSwitchAndSetFootline(GtkWidget*, int, GtkWidget*, char*, ...) PRINTF_FORMAT(4);
#else
int ModalWarning(char*, ...) PRINTF_FORMAT(1);
#define ModalWarningOrCLI(a,b,c,d,...) ModalWarning(d,__VA_ARGS__)
#define GuiAllowActions(g)
#define GuiConfirmEccDeletion(c) (1)
#define GuiConfirmImageDeletion(c) (1)
#define GuiCreateMessage(a, b, args...)
#define GuiExitWorkerThread()
#define GuiGetLabelWidth(l, c, args...) (0)
#define GuiLockLabelSize(w, c, args...)
#define GuiModalDialog(a, b, c, d, args...) (0)
#define GuiReverseCancelOK(d)
#define GuiSetLabelText(w, c, args...)
#define GuiShowMessage(w, a, b)
#define GuiSetProgress(w, a, b)
#define GuiSetText(p, a, b, c)
#define GuiShowWidget(w)
#define GuiSwitchAndSetFootline(w, a, b, c, args...)
#endif
#ifndef WITH_CLI_ONLY_YES
void SetText(PangoLayout*, char*, int*, int*);
void SwitchAndSetFootline(GtkWidget*, int, GtkWidget*, char*, ...) PRINTF_FORMAT(4);
void ReverseCancelOK(GtkDialog*);
void TimedInsensitive(GtkWidget*, int);
int ModalWarning(GtkMessageType, GtkButtonsType, void (*)(GtkDialog*), char*, ...) PRINTF_FORMAT(4);
int GetLabelWidth(GtkLabel*, char*, ...) PRINTF_FORMAT(2);
void LockLabelSize(GtkLabel*, char*, ...) PRINTF_FORMAT(2);
#endif
int ConfirmImageDeletion(char *);
int ConfirmEccDeletion(char *);
void StripECCFromImageFile(void);
#ifndef WITH_CLI_ONLY_YES
/***
*** preferences.c
***/
void CreatePreferencesWindow(void);
void UpdateMethodPreferences(void);
void HidePreferences(void);
void FreePreferences(void*);
#ifdef WITH_GUI_YES
void GuiCreatePreferencesWindow(void);
void GuiUpdateMethodPreferences(void);
void GuiHidePreferences(void);
void GuiFreePreferences(void*);
void UpdatePrefsExhaustiveSearch(void);
void UpdatePrefsConfirmDeletion(void);
void RegisterPreferencesHelpWindow(LabelWithOnlineHelp*);
void GuiUpdatePrefsExhaustiveSearch(void);
void GuiUpdatePrefsConfirmDeletion(void);
void GuiRegisterPreferencesHelpWindow(LabelWithOnlineHelp*);
#endif
/***
@@ -1231,7 +1263,7 @@ void GetLastSense(int*, int*, int*);
/***
*** random.c
**/
***/
#define MY_RAND_MAX 2147483647
@@ -1243,9 +1275,8 @@ guint32 Random32(void);
*** raw-editor.c
***/
void CreateRawEditor(void);
void FreeRawEditorContext(void*);
void GuiCreateRawEditor(void);
void GuiFreeRawEditorContext(void*);
/***
*** raw-sector-cache.c
@@ -1275,18 +1306,24 @@ void ReadDefectiveSectorFile(DefectiveSectorHeader *, struct _RawBuffer*, char*)
void ReadMediumLinear(gpointer);
#ifndef WITH_CLI_ONLY_YES
/***
*** read-linear-window.c
***/
void ResetLinearReadWindow();
void CreateLinearReadWindow(GtkWidget*);
#ifdef WITH_GUI_YES
void GuiInitializeCurve(void*, int, int);
void GuiAddCurveValues(void*, int, int, int);
void GuiMarkExistingSectors(void);
void InitializeCurve(void*, int, int);
void AddCurveValues(void*, int, int, int);
void MarkExistingSectors(void);
void RedrawReadLinearWindow(void);
void GuiResetLinearReadWindow();
void GuiRedrawReadLinearWindow(void);
void GuiCreateLinearReadWindow(GtkWidget*);
#else
#define GuiInitializeCurve(a, b, c)
#define GuiAddCurveValues(a, b, c, d)
#define GuiMarkExistingSectors()
#define GuiRedrawReadLinearWindow()
#endif
/***
@@ -1294,28 +1331,39 @@ void RedrawReadLinearWindow(void);
***/
void GetReadingRange(gint64, gint64*, gint64*);
void ReadMediumAdaptive(gpointer);
#ifndef WITH_CLI_ONLY_YES
/***
*** read-adaptive-window.c
***/
#define ADAPTIVE_READ_SPIRAL_SIZE 4800
void ResetAdaptiveReadWindow();
void SetAdaptiveReadMinimumPercentage(int);
void CreateAdaptiveReadWindow(GtkWidget*);
#ifdef WITH_GUI_YES
void GuiClipReadAdaptiveSpiral(int);
void GuiChangeSegmentColor(GdkColor*, int);
void GuiRemoveFillMarkers();
void ClipReadAdaptiveSpiral(int);
void SetAdaptiveReadSubtitle(char*);
void SetAdaptiveReadFootline(char*, GdkColor*);
void UpdateAdaptiveResults(gint64, gint64, gint64, int);
void ChangeSegmentColor(GdkColor*, int);
void RemoveFillMarkers();
void GuiSetAdaptiveReadSubtitle(char*);
void GuiSetAdaptiveReadFootline(char*, GdkColor*);
void GuiSetAdaptiveReadMinimumPercentage(int);
void GuiUpdateAdaptiveResults(gint64, gint64, gint64, int);
void GuiResetAdaptiveReadWindow();
#else
#define GuiClipReadAdaptiveSpiral(i)
#define GuiChangeSegmentColor(g, i)
#define GuiRemoveFillMarkers()
#define GuiSetAdaptiveReadSubtitle(c)
#define GuiSetAdaptiveReadFootline(c, d)
#define GuiSetAdaptiveReadMinimumPercentage(i)
#define GuiUpdateAdaptiveResults(a, b, c, d)
#endif
void GuiCreateAdaptiveReadWindow(GtkWidget*);
/***
*** recover-raw.c
***/
@@ -1456,13 +1504,7 @@ int ProbeAltiVec(void);
*** show-manual.c
***/
void ShowURL(char*);
/***
*** show-html.c
***/
void ShowHTML(char*);
void GuiShowURL(char*);
/***
*** smart-lec.c
@@ -1478,7 +1520,6 @@ void *PrepareIterativeSmartLEC(RawBuffer*);
void SmartLECIteration(void*, char*);
void EndIterativeSmartLEC(void*);
#ifndef WITH_CLI_ONLY_YES
/***
*** spiral.c
***/
@@ -1498,22 +1539,28 @@ typedef struct _Spiral
GdkColor *colorUnderCursor;
} Spiral;
Spiral* CreateSpiral(GdkColor*, GdkColor*, int, int, int);
void SetSpiralWidget(Spiral*, GtkWidget*);
void FillSpiral(Spiral*, GdkColor*);
void FreeSpiral(Spiral*);
void DrawSpiral(Spiral*);
void DrawSpiralSegment(Spiral*, GdkColor*, int);
void DrawSpiralLabel(Spiral*, PangoLayout*, char*, GdkColor*, int, int);
#ifdef WITH_GUI_YES
Spiral* GuiCreateSpiral(GdkColor*, GdkColor*, int, int, int);
void GuiSetSpiralWidget(Spiral*, GtkWidget*);
void GuiFreeSpiral(Spiral*);
void ChangeSpiralCursor(Spiral*, int);
void MoveSpiralCursor(Spiral*, int);
void GuiFillSpiral(Spiral*, GdkColor*);
void GuiDrawSpiral(Spiral*);
void GuiDrawSpiralSegment(Spiral*, GdkColor*, int);
void GuiDrawSpiralLabel(Spiral*, PangoLayout*, char*, GdkColor*, int, int);
void GuiChangeSpiralCursor(Spiral*, int);
void GuiMoveSpiralCursor(Spiral*, int);
#else
#define GuiChangeSpiralCursor(a, b)
#define GuiFreeSpiral(s)
#endif
/***
*** welcome-window.c
***/
void CreateWelcomePage(GtkNotebook*);
#endif
void GuiCreateWelcomePage(GtkNotebook*);
#endif /* DVDISASTER_H */
void StripECCFromImageFile(void);
#endif /* DVDISASTER_H */

View File

@@ -20,6 +20,8 @@
* along with dvdisaster. If not, see <http://www.gnu.org/licenses/>.
*/
/*** src type: some GUI code ***/
#include "dvdisaster.h"
#include "rs01-includes.h"
@@ -53,7 +55,12 @@ void register_rs01(void)
method->finalizeCksums = RS01FinalizeCksums;
method->expectedImageSize = RS01ExpectedImageSize;
#ifndef WITH_CLI_ONLY_YES
/*** Widget list must even exist with dummy values in CLI only version
to prevent null ptr references in SetLabel() etc. */
method->widgetList = g_malloc0(sizeof(RS01Widgets));
#ifdef WITH_GUI_YES
/*** Linkage to rs01-window.c */
method->createCreateWindow = CreateRS01EWindow;
@@ -70,7 +77,7 @@ void register_rs01(void)
method->createVerifyWindow = CreateRS01VerifyWindow;
method->resetVerifyWindow = ResetRS01VerifyWindow;
#endif
/*** Register ourself */
method->destroy = destroy;
@@ -79,26 +86,22 @@ void register_rs01(void)
}
static void destroy(Method *method)
{
#ifndef WITH_CLI_ONLY_YES
RS01Widgets *wl = (RS01Widgets*)method->widgetList;
#endif
{ RS01Widgets *wl = (RS01Widgets*)method->widgetList;
g_free(method->ckSumClosure);
#ifndef WITH_CLI_ONLY_YES
if(wl)
{ if(wl->fixCurve) FreeCurve(wl->fixCurve);
if(wl->cmpSpiral)
FreeSpiral(wl->cmpSpiral);
{
#ifdef WITH_GUI_YES
GuiFreeCurve(wl->fixCurve);
GuiFreeSpiral(wl->cmpSpiral);
if(wl->cmpLayout)
g_object_unref(wl->cmpLayout);
#endif
g_free(wl);
}
#endif
}

View File

@@ -20,6 +20,8 @@
* along with dvdisaster. If not, see <http://www.gnu.org/licenses/>.
*/
/*** src type: some GUI code ***/
#include "dvdisaster.h"
#include "rs02-includes.h"
@@ -54,7 +56,12 @@ void register_rs02(void)
method->finalizeCksums = RS02FinalizeCksums;
method->expectedImageSize = RS02ExpectedImageSize;
#ifndef WITH_CLI_ONLY_YES
/*** Widget list must even exist with dummy values in CLI only version
to prevent null ptr references in SetLabel() etc. */
method->widgetList = g_malloc0(sizeof(RS02Widgets));
#ifdef WITH_GUI_YES
/*** Linkage to rs02-window.c */
method->createCreateWindow = CreateRS02EncWindow;
@@ -72,7 +79,7 @@ void register_rs02(void)
method->createVerifyWindow = CreateRS02VerifyWindow;
method->resetVerifyWindow = ResetRS02VerifyWindow;
#endif
/*** Register ourself */
method->destroy = destroy;
@@ -81,28 +88,23 @@ void register_rs02(void)
}
static void destroy(Method *method)
{
#ifndef WITH_CLI_ONLY_YES
RS02Widgets *wl = (RS02Widgets*)method->widgetList;
#endif
{ RS02Widgets *wl = (RS02Widgets*)method->widgetList;
RS02CksumClosure *csc = (RS02CksumClosure*)method->ckSumClosure;
if(csc->lay)
g_free(csc->lay);
g_free(method->ckSumClosure);
#ifndef WITH_CLI_ONLY_YES
if(wl)
{ if(wl->fixCurve) FreeCurve(wl->fixCurve);
if(wl->cmpSpiral)
FreeSpiral(wl->cmpSpiral);
{
#ifdef WITH_GUI_YES
GuiFreeCurve(wl->fixCurve);
GuiFreeSpiral(wl->cmpSpiral);
if(wl->cmpLayout)
g_object_unref(wl->cmpLayout);
#endif
g_free(wl);
}
#endif
}

View File

@@ -20,6 +20,8 @@
* along with dvdisaster. If not, see <http://www.gnu.org/licenses/>.
*/
/*** src type: some GUI code ***/
#include "dvdisaster.h"
#include "rs03-includes.h"
@@ -55,7 +57,9 @@ void register_rs03(void)
method->recognizeEccFile = RS03RecognizeFile;
method->recognizeEccImage = RS03RecognizeImage;
#ifndef WITH_CLI_ONLY_YES
method->widgetList = g_malloc0(sizeof(RS03Widgets));
#ifdef WITH_GUI_YES
/*** Linkage to rs03-window.c */
method->createCreateWindow = CreateRS03EncWindow;
@@ -72,8 +76,8 @@ void register_rs03(void)
method->createVerifyWindow = CreateRS03VerifyWindow;
method->resetVerifyWindow = ResetRS03VerifyWindow;
#endif
#endif /* WITH_GUI_YES */
/*** Register ourself */
method->destroy = destroy;
@@ -82,28 +86,23 @@ void register_rs03(void)
}
static void destroy(Method *method)
{
#ifndef WITH_CLI_ONLY_YES
RS03Widgets *wl = (RS03Widgets*)method->widgetList;
#endif
{ RS03Widgets *wl = (RS03Widgets*)method->widgetList;
RS03CksumClosure *csc = (RS03CksumClosure*)method->ckSumClosure;
if(csc->lay)
g_free(csc->lay);
g_free(method->ckSumClosure);
#ifndef WITH_CLI_ONLY_YES
if(wl)
{ if(wl->fixCurve) FreeCurve(wl->fixCurve);
if(wl->cmpSpiral)
FreeSpiral(wl->cmpSpiral);
{
#ifdef WITH_GUI_YES
GuiFreeCurve(wl->fixCurve);
GuiFreeSpiral(wl->cmpSpiral);
if(wl->cmpLayout)
g_object_unref(wl->cmpLayout);
#endif
g_free(wl);
}
#endif
}

View File

@@ -20,6 +20,8 @@
* along with dvdisaster. If not, see <http://www.gnu.org/licenses/>.
*/
/*** src type: no GUI code ***/
#include "dvdisaster.h"
/***

View File

@@ -23,6 +23,8 @@
* along with dvdisaster. If not, see <http://www.gnu.org/licenses/>.
*/
/*** src type: no GUI code ***/
#include "dvdisaster.h"
#include "galois-inlines.h"

View File

@@ -19,8 +19,10 @@
* You should have received a copy of the GNU General Public License
* along with dvdisaster. If not, see <http://www.gnu.org/licenses/>.
*/
// DVDISASTER_GUI_FILE
/*** src type: only GUI code ***/
#ifdef WITH_GUI_YES
#include "dvdisaster.h"
#include "build.h"
@@ -101,7 +103,7 @@ static gint help_cb(GtkWidget *widget, GdkEvent *event, gpointer data)
* Create a frame labeled with a link to the help system
*/
LabelWithOnlineHelp* CreateLabelWithOnlineHelp(char *title, char *ascii_text)
LabelWithOnlineHelp* GuiCreateLabelWithOnlineHelp(char *title, char *ascii_text)
{ GtkWidget *window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
GtkWidget *vbox, *hbox, *button;
GtkWidget *ebox = gtk_event_box_new();
@@ -114,7 +116,7 @@ LabelWithOnlineHelp* CreateLabelWithOnlineHelp(char *title, char *ascii_text)
lwoh->linkLabel = gtk_label_new(NULL);
lwoh->linkBox = ebox;
lwoh->windowTitle = g_locale_to_utf8(title, -1, NULL, NULL, NULL);
SetOnlineHelpLinkText(lwoh, ascii_text);
GuiSetOnlineHelpLinkText(lwoh, ascii_text);
/*** Add a tooltip image */
lwoh->tooltip = gtk_image_new();
@@ -164,7 +166,7 @@ LabelWithOnlineHelp* CreateLabelWithOnlineHelp(char *title, char *ascii_text)
return lwoh;
}
LabelWithOnlineHelp* CloneLabelWithOnlineHelp(LabelWithOnlineHelp *orig, char *ascii_text)
LabelWithOnlineHelp* GuiCloneLabelWithOnlineHelp(LabelWithOnlineHelp *orig, char *ascii_text)
{ LabelWithOnlineHelp *lwoh;
GtkWidget *ebox = gtk_event_box_new();
@@ -181,7 +183,7 @@ LabelWithOnlineHelp* CloneLabelWithOnlineHelp(LabelWithOnlineHelp *orig, char *a
lwoh->windowTitle = g_strdup("ignore");
lwoh->tooltip = orig->tooltip;
SetOnlineHelpLinkText(lwoh, ascii_text);
GuiSetOnlineHelpLinkText(lwoh, ascii_text);
/*** Put link label into an event box */
@@ -197,7 +199,7 @@ LabelWithOnlineHelp* CloneLabelWithOnlineHelp(LabelWithOnlineHelp *orig, char *a
return lwoh;
}
void SetOnlineHelpLinkText(LabelWithOnlineHelp *lwoh, char *ascii_text)
void GuiSetOnlineHelpLinkText(LabelWithOnlineHelp *lwoh, char *ascii_text)
{ char text[strlen(ascii_text)+80];
if(lwoh->normalText) g_free(lwoh->normalText);
@@ -208,7 +210,7 @@ void SetOnlineHelpLinkText(LabelWithOnlineHelp *lwoh, char *ascii_text)
lwoh->highlitText = g_locale_to_utf8(text, -1, NULL, NULL, NULL);
}
void FreeLabelWithOnlineHelp(LabelWithOnlineHelp *lwoh)
void GuiFreeLabelWithOnlineHelp(LabelWithOnlineHelp *lwoh)
{
if(lwoh->lastSizes)
{ int i;
@@ -249,7 +251,7 @@ static gboolean wrapper_fix_cb(GtkWidget *widget, GdkEventExpose *event, gpointe
return FALSE;
}
void AddHelpParagraph(LabelWithOnlineHelp *lwoh, char *format, ...)
void GuiAddHelpParagraph(LabelWithOnlineHelp *lwoh, char *format, ...)
{ GtkWidget *label = gtk_label_new(NULL);
va_list argp;
char *text,*utf;
@@ -280,7 +282,7 @@ void AddHelpParagraph(LabelWithOnlineHelp *lwoh, char *format, ...)
* The list may be preceeded by an optional paragraph of text.
*/
void AddHelpListItem(LabelWithOnlineHelp *lwoh, char *format, ...)
void GuiAddHelpListItem(LabelWithOnlineHelp *lwoh, char *format, ...)
{ GtkWidget *label = gtk_label_new(NULL);
GtkWidget *bullet = gtk_label_new(" - ");
GtkWidget *hbox = gtk_hbox_new(FALSE, 0);
@@ -317,7 +319,7 @@ void AddHelpListItem(LabelWithOnlineHelp *lwoh, char *format, ...)
* Add a (fully functional!) widget set to the help window
*/
void AddHelpWidget(LabelWithOnlineHelp *lwoh, GtkWidget *widget)
void GuiAddHelpWidget(LabelWithOnlineHelp *lwoh, GtkWidget *widget)
{
gtk_box_pack_start(GTK_BOX(lwoh->vbox), widget, FALSE, FALSE, 10);
gtk_box_pack_start(GTK_BOX(lwoh->vbox), gtk_hseparator_new(), FALSE, FALSE, 10);
@@ -373,7 +375,7 @@ static gboolean log_idle_func(gpointer data)
}
void UpdateLog()
void GuiUpdateLog()
{ static int unique_addr;
if(Closure->logWidget)
@@ -382,7 +384,7 @@ void UpdateLog()
}
}
void ShowLog()
void GuiShowLog()
{ GtkWidget *w;
if(Closure->logWidget)
@@ -390,10 +392,10 @@ void ShowLog()
return;
}
w = ShowTextfile(_("windowtitle|Log data"),
_("<big>Log data</big>\n"
"<i>Protocol of the current or previous action</i>"),
"*LOG*", &Closure->logScroll, &Closure->logBuffer);
w = GuiShowTextfile(_("windowtitle|Log data"),
_("<big>Log data</big>\n"
"<i>Protocol of the current or previous action</i>"),
"*LOG*", &Closure->logScroll, &Closure->logBuffer);
g_signal_connect(G_OBJECT(w), "destroy", G_CALLBACK(log_destroy_cb), NULL);
@@ -405,12 +407,12 @@ void ShowLog()
*** Specific help dialogs
***/
void ShowGPL()
void GuiShowGPL()
{
ShowTextfile(_("windowtitle|GNU General Public License"),
_("<big>GNU General Public License</big>\n"
"<i>The license terms of dvdisaster.</i>"),
"COPYING", NULL, NULL);
GuiShowTextfile(_("windowtitle|GNU General Public License"),
_("<big>GNU General Public License</big>\n"
"<i>The license terms of dvdisaster.</i>"),
"COPYING", NULL, NULL);
}
/*
@@ -481,8 +483,8 @@ char *find_file(char *file, size_t *size, char *lang)
return NULL;
}
GtkWidget* ShowTextfile(char *title, char *explanation, char *file,
GtkScrolledWindow **scroll_out, GtkTextBuffer **buffer_out)
GtkWidget* GuiShowTextfile(char *title, char *explanation, char *file,
GtkScrolledWindow **scroll_out, GtkTextBuffer **buffer_out)
{ GtkWidget *dialog, *scroll_win, *vbox, *lab, *sep, *view;
GtkTextBuffer *buffer;
GtkTextIter start;
@@ -598,8 +600,8 @@ static gint about_cb(GtkWidget *widget, GdkEvent *event, gpointer data)
switch(event->type)
{ case GDK_BUTTON_PRESS:
if(!inside) return FALSE; /* Defect in certain Gtk versions? */
if(!strcmp(label,"GPL")) ShowGPL();
else ShowURL(g_strdup(label));
if(!strcmp(label,"GPL")) GuiShowGPL();
else GuiShowURL(g_strdup(label));
break;
case GDK_ENTER_NOTIFY:
g_sprintf(text, "<span underline=\"single\" color=\"blue\">%s</span>", label);
@@ -621,7 +623,7 @@ static gint about_cb(GtkWidget *widget, GdkEvent *event, gpointer data)
return FALSE;
}
void AboutText(GtkWidget *parent, char *format, ...)
void GuiAboutText(GtkWidget *parent, char *format, ...)
{ GtkWidget *lab;
char *tmp, *utf_text;
va_list argp;
@@ -641,7 +643,7 @@ void AboutText(GtkWidget *parent, char *format, ...)
va_end(argp);
}
void AboutLink(GtkWidget *parent, char *label, char *action)
void GuiAboutLink(GtkWidget *parent, char *label, char *action)
{ GtkWidget *ebox,*lab;
char text[strlen(label)+80];
char *label_copy = strdup(label);
@@ -663,7 +665,7 @@ void AboutLink(GtkWidget *parent, char *label, char *action)
g_free(utf);
}
void AboutTextWithLink(GtkWidget *parent, char *text, char *action)
void GuiAboutTextWithLink(GtkWidget *parent, char *text, char *action)
{ char *copy,*head,*end_of_line;
char *link_start,*link_end;
char *utf;
@@ -693,7 +695,7 @@ void AboutTextWithLink(GtkWidget *parent, char *text, char *action)
g_free(utf);
}
AboutLink(hbox, link_start, action);
GuiAboutLink(hbox, link_start, action);
if(*link_end)
{ GtkWidget *lab = gtk_label_new(NULL);
@@ -704,7 +706,7 @@ void AboutTextWithLink(GtkWidget *parent, char *text, char *action)
g_free(utf);
}
}
else AboutText(parent, "%s", head);
else GuiAboutText(parent, "%s", head);
if(end_of_line) head = end_of_line+1;
else break;
@@ -713,7 +715,7 @@ void AboutTextWithLink(GtkWidget *parent, char *text, char *action)
g_free(copy);
}
void AboutDialog()
void GuiAboutDialog()
{ GtkWidget *about, *vbox, *sep;
char *text;
@@ -734,35 +736,37 @@ void AboutDialog()
text = g_strdup_printf("<span weight=\"bold\" size=\"xx-large\">dvdisaster</span><i> "
"Version %s</i>",
Closure->cookedVersion);
AboutText(vbox, "%s", text);
GuiAboutText(vbox, "%s", text);
g_free(text);
AboutText(vbox, _("Copyright 2004-2017 Carsten Gnoerlich.\nCopyright 2019-2021 The dvdisaster development team."));
GuiAboutText(vbox, _("Copyright 2004-2017 Carsten Gnoerlich.\nCopyright 2019-2021 The dvdisaster development team."));
sep = gtk_hseparator_new();
gtk_box_pack_start(GTK_BOX(vbox), sep, FALSE, FALSE, 10);
AboutText(vbox, _("dvdisaster provides a margin of safety against data loss\n"
"on optical media caused by aging or scratches.\n"
"It creates error correction data which is used to recover\n"
"unreadable sectors if the disc becomes damaged later on.\n"));
GuiAboutText(vbox, _("dvdisaster provides a margin of safety against data loss\n"
"on optical media caused by aging or scratches.\n"
"It creates error correction data which is used to recover\n"
"unreadable sectors if the disc becomes damaged later on.\n"));
AboutTextWithLink(vbox, _("This software comes with <b>absolutely no warranty</b>.\n"
GuiAboutTextWithLink(vbox, _("This software comes with <b>absolutely no warranty</b>.\n"
"This is free software and you are welcome to redistribute it\n"
"under the conditions of the [GNU General Public License].\n"),
"GPL");
AboutText(vbox, _("\ne-mail: support@dvdisaster.org"));
GuiAboutText(vbox, _("\ne-mail: support@dvdisaster.org"));
text = g_strdup_printf("WWW: [%s]", HOMEPAGE);
AboutTextWithLink(vbox, text, HOMEPAGE);
GuiAboutTextWithLink(vbox, text, HOMEPAGE);
g_free(text);
#ifdef SYS_NETBSD
AboutText(vbox, _("\nNetBSD port: Sergey Svishchev &lt;svs@ropnet.ru&gt;"));
GuiAboutText(vbox, _("\nNetBSD port: Sergey Svishchev &lt;svs@ropnet.ru&gt;"));
#endif
/* Show it */
gtk_widget_show_all(about);
}
#endif /* WITH_GUI_YES */

View File

@@ -21,6 +21,8 @@
* along with dvdisaster. If not, see <http://www.gnu.org/licenses/>.
*/
/*** src type: no GUI code ***/
#include "dvdisaster.h"
/***

View File

@@ -19,8 +19,10 @@
* You should have received a copy of the GNU General Public License
* along with dvdisaster. If not, see <http://www.gnu.org/licenses/>.
*/
// DVDISASTER_GUI_FILE
/*** src type: only GUI code ***/
#ifdef WITH_GUI_YES
#include "dvdisaster.h"
#include "inlined-icons.h"
@@ -53,7 +55,7 @@ static GdkPixbuf* create_icon(GtkIconFactory *ifact, char *name, const guint8 *i
return pb;
}
void CreateIconFactory()
void GuiCreateIconFactory()
{ GtkIconFactory *ifact;
/*** Create and register our icon factory */
@@ -86,3 +88,4 @@ void CreateIconFactory()
create_icon(ifact, "dvdisaster-gtk-quit", dvdisaster_gtk_quit);
create_icon(ifact, "dvdisaster-gtk-stop", dvdisaster_gtk_stop);
}
#endif /* WITH_GUI_YES */

View File

@@ -20,6 +20,8 @@
* along with dvdisaster. If not, see <http://www.gnu.org/licenses/>.
*/
/*** src type: some GUI code ***/
#include "dvdisaster.h"
#include "scsi-layer.h"
#include "udf.h"
@@ -148,9 +150,10 @@ int ReportImageEccInconsistencies(Image *image)
if(!image || image->type == IMAGE_NONE)
{ if(image) CloseImage(image);
#ifndef WITH_CLI_ONLY_YES
#ifdef WITH_GUI_YES
if(Closure->guiMode)
{ CreateMessage(_("Image file %s not present or permission denied.\n"), GTK_MESSAGE_ERROR, Closure->imageName);
{ GuiCreateMessage(_("Image file %s not present or permission denied.\n"), GTK_MESSAGE_ERROR, Closure->imageName);
return TRUE;
}
else
@@ -163,13 +166,14 @@ int ReportImageEccInconsistencies(Image *image)
if(image->eccFile && !image->eccFileMethod)
{ CloseImage(image);
#ifndef WITH_CLI_ONLY_YES
#ifdef WITH_GUI_YES
if(Closure->guiMode)
{ CreateMessage(_("\nError correction file type unknown.\n"), GTK_MESSAGE_ERROR);
{ GuiCreateMessage(_("\nError correction file type unknown.\n"), GTK_MESSAGE_ERROR);
return TRUE;
}
else
#endif
#endif
{ Stop(_("\nError correction file type unknown.\n"));
}
}
@@ -178,9 +182,10 @@ int ReportImageEccInconsistencies(Image *image)
if(!image->eccFile && image->eccFileState == ECCFILE_NOPERM)
{ CloseImage(image);
#ifndef WITH_CLI_ONLY_YES
#ifdef WITH_GUI_YES
if(Closure->guiMode)
{ CreateMessage(_("\nPermission denied on ecc file (perhaps not writeable?).\n"),
{ GuiCreateMessage(_("\nPermission denied on ecc file (perhaps not writeable?).\n"),
GTK_MESSAGE_ERROR);
return TRUE;
}
@@ -195,10 +200,11 @@ int ReportImageEccInconsistencies(Image *image)
if(!image->eccFile && !image->eccMethod)
{ CloseImage(image);
#ifndef WITH_CLI_ONLY_YES
#ifdef WITH_GUI_YES
if(Closure->guiMode)
{ CreateMessage(_("\nNo error correction file present.\n"
"No error correction data recognized in image.\n"), GTK_MESSAGE_ERROR);
{ GuiCreateMessage(_("\nNo error correction file present.\n"
"No error correction data recognized in image.\n"), GTK_MESSAGE_ERROR);
return TRUE;
}
else

View File

@@ -20,11 +20,12 @@
* along with dvdisaster. If not, see <http://www.gnu.org/licenses/>.
*/
/*** src type: no GUI code ***/
#include "dvdisaster.h"
#include "galois-inlines.h"
/***
*** Mapping between cd frame and parity vectors
***/

View File

@@ -20,6 +20,8 @@
* along with dvdisaster. If not, see <http://www.gnu.org/licenses/>.
*/
/*** src type: some GUI code ***/
#include "dvdisaster.h"
/***
@@ -211,7 +213,7 @@ ssize_t LargeRead(LargeFile *lf, void *buf, size_t count)
* Writing large files
*/
#ifndef WITH_CLI_ONLY_YES
#ifdef WITH_GUI_YES
static void insert_buttons(GtkDialog *dialog)
{
gtk_dialog_add_buttons(dialog,
@@ -226,9 +228,7 @@ static ssize_t xwrite(int fdes, void *buf_base, size_t count)
/* Simply fail when going out of space in command line mode */
#ifndef WITH_CLI_ONLY_YES
if(!Closure->guiMode)
#endif
{ while(count)
{ ssize_t n = write(fdes, buf, count);
@@ -243,7 +243,7 @@ static ssize_t xwrite(int fdes, void *buf_base, size_t count)
return total;
}
#ifndef WITH_CLI_ONLY_YES
#ifdef WITH_GUI_YES
/* Give the user a chance to free more space in GUI mode.
When running out of space, the last write() may complete
with n<count but no error condition, so we try writing
@@ -257,10 +257,10 @@ static ssize_t xwrite(int fdes, void *buf_base, size_t count)
if(errno != ENOSPC) return total;
answer = ModalDialog(GTK_MESSAGE_QUESTION, GTK_BUTTONS_NONE, insert_buttons,
_("Error while writing the file:\n\n%s\n\n"
"You can redo this operation after freeing some space."),
strerror(errno));
answer = GuiModalDialog(GTK_MESSAGE_QUESTION, GTK_BUTTONS_NONE, insert_buttons,
_("Error while writing the file:\n\n%s\n\n"
"You can redo this operation after freeing some space."),
strerror(errno));
if(!answer) return total;
}
@@ -271,9 +271,9 @@ static ssize_t xwrite(int fdes, void *buf_base, size_t count)
buf += n;
}
}
#endif /* WITH_GUI_YES */
return total;
#endif
}
ssize_t LargeWrite(LargeFile *lf, void *buf, size_t count)

View File

@@ -20,6 +20,8 @@
* along with dvdisaster. If not, see <http://www.gnu.org/licenses/>.
*/
/*** src type: no GUI code ***/
#include "dvdisaster.h"
#include <time.h>

View File

@@ -19,8 +19,10 @@
* You should have received a copy of the GNU General Public License
* along with dvdisaster. If not, see <http://www.gnu.org/licenses/>.
*/
// DVDISASTER_GUI_FILE
/*** src type: only GUI code ***/
#ifdef WITH_GUI_YES
#include "dvdisaster.h"
/***
@@ -61,6 +63,7 @@ static void action_cb(GtkWidget *widget, gpointer data)
if(action != ACTION_STOP)
{
/* Clear the log buffer, request new log file time stamp */
if(action != ACTION_CREATE_CONT)
{ g_mutex_lock(Closure->logLock);
g_string_truncate(Closure->logString, 0);
@@ -68,6 +71,7 @@ static void action_cb(GtkWidget *widget, gpointer data)
g_mutex_unlock(Closure->logLock);
Closure->logFileStamped = FALSE;
}
/* Make sure we're using the current file selections */
g_free(Closure->imageName);
@@ -90,21 +94,21 @@ static void action_cb(GtkWidget *widget, gpointer data)
{ int len = strlen(Closure->eccName);
if(!strcmp(Closure->eccName, Closure->imageName))
{ CreateMessage(_("The .iso image and error correction file\n"
"must not be the same file!\n\n"
"If you intended to create or use an .iso image\n"
"which is augmented with error correction data,\n"
"please leave the error correction file name blank."),
GTK_MESSAGE_ERROR);
{ GuiCreateMessage(_("The .iso image and error correction file\n"
"must not be the same file!\n\n"
"If you intended to create or use an .iso image\n"
"which is augmented with error correction data,\n"
"please leave the error correction file name blank."),
GTK_MESSAGE_ERROR);
return;
}
if(!strcmp(Closure->eccName+len-4, ".iso"))
{ CreateMessage(_("The error correction file type must not be \".iso\".\n\n"
"If you intended to create or use an .iso image\n"
"which is augmented with error correction data,\n"
"please leave the error correction file name blank."),
GTK_MESSAGE_ERROR);
{ GuiCreateMessage(_("The error correction file type must not be \".iso\".\n\n"
"If you intended to create or use an .iso image\n"
"which is augmented with error correction data,\n"
"please leave the error correction file name blank."),
GTK_MESSAGE_ERROR);
return;
}
}
@@ -126,18 +130,18 @@ static void action_cb(GtkWidget *widget, gpointer data)
break;
case ACTION_READ:
AllowActions(FALSE);
GuiAllowActions(FALSE);
if(Closure->adaptiveRead)
{ gtk_notebook_set_current_page(GTK_NOTEBOOK(Closure->notebook), 2);
ResetAdaptiveReadWindow();
GuiResetAdaptiveReadWindow();
CreateGThread((GThreadFunc)ReadMediumAdaptive, (gpointer)0);
}
else
{ gtk_notebook_set_current_page(GTK_NOTEBOOK(Closure->notebook), 1);
Closure->additionalSpiralColor = 1;
ResetLinearReadWindow();
GuiResetLinearReadWindow();
CreateGThread((GThreadFunc)ReadMediumLinear, (gpointer)0);
}
break;
@@ -146,15 +150,15 @@ static void action_cb(GtkWidget *widget, gpointer data)
case ACTION_CREATE_CONT:
method = FindMethod(Closure->methodName);
if(!method)
{ CreateMessage(_("\nMethod %s not available.\n"
"Use -m without parameters for a method list.\n"),
GTK_MESSAGE_ERROR, Closure->methodName);
{ GuiCreateMessage(_("\nMethod %s not available.\n"
"Use -m without parameters for a method list.\n"),
GTK_MESSAGE_ERROR, Closure->methodName);
break;
}
gtk_notebook_set_current_page(GTK_NOTEBOOK(Closure->notebook), method->tabWindowIndex);
method->resetCreateWindow(method);
AllowActions(FALSE);
GuiAllowActions(FALSE);
CreateGThread((GThreadFunc)method->create, (gpointer)method);
break;
@@ -170,13 +174,13 @@ static void action_cb(GtkWidget *widget, gpointer data)
if(image && image->eccFileMethod) method = image->eccFileMethod;
else if(image && image->eccMethod) method = image->eccMethod;
else { CreateMessage(_("Internal error: No suitable method for repairing image."),
GTK_MESSAGE_ERROR);
else { GuiCreateMessage(_("Internal error: No suitable method for repairing image."),
GTK_MESSAGE_ERROR);
return;
}
gtk_notebook_set_current_page(GTK_NOTEBOOK(Closure->notebook), method->tabWindowIndex+1);
method->resetFixWindow(method);
AllowActions(FALSE);
GuiAllowActions(FALSE);
CreateGThread((GThreadFunc)method->fix, (gpointer)image);
}
break;
@@ -184,13 +188,13 @@ static void action_cb(GtkWidget *widget, gpointer data)
case ACTION_SCAN:
gtk_notebook_set_current_page(GTK_NOTEBOOK(Closure->notebook), 1);
Closure->additionalSpiralColor = -1;
ResetLinearReadWindow();
AllowActions(FALSE);
GuiResetLinearReadWindow();
GuiAllowActions(FALSE);
CreateGThread((GThreadFunc)ReadMediumLinear, (gpointer)1);
break;
case ACTION_STRIP:
AllowActions(FALSE);
GuiAllowActions(FALSE);
CreateGThread((GThreadFunc)StripECCFromImageFile, (gpointer)0);
break;
@@ -209,14 +213,14 @@ static void action_cb(GtkWidget *widget, gpointer data)
if(image && image->eccFileMethod) method = image->eccFileMethod;
else if(image && image->eccMethod) method = image->eccMethod;
else if(!(method = FindMethod("RS01")))
{ CreateMessage(_("RS01 method not available for comparing files."),
GTK_MESSAGE_ERROR);
{ GuiCreateMessage(_("RS01 method not available for comparing files."),
GTK_MESSAGE_ERROR);
return;
}
gtk_notebook_set_current_page(GTK_NOTEBOOK(Closure->notebook), method->tabWindowIndex+2);
method->resetVerifyWindow(method);
AllowActions(FALSE);
GuiAllowActions(FALSE);
CreateGThread((GThreadFunc)method->verify, (gpointer)image);
break;
}
@@ -237,7 +241,7 @@ static gboolean action_idle_func(gpointer action)
}
void ContinueWithAction(int action)
void GuiContinueWithAction(int action)
{
g_idle_add(action_idle_func, GINT_TO_POINTER(action));
}
@@ -280,59 +284,66 @@ static GtkWidget* create_action_bar(GtkNotebook *notebook)
Closure->readButton = wid = create_button(_("button|Read"), "dvdisaster-read");
g_signal_connect(G_OBJECT(wid), "clicked", G_CALLBACK(action_cb), (gpointer)ACTION_READ);
gtk_box_pack_start(GTK_BOX(vbox), wid, FALSE, FALSE, 0);
AttachTooltip(wid, _("tooltip|Read Image"), _("Reads an optical disc image into a file (or tries to complete an existing image file)."));
GuiAttachTooltip(wid, _("tooltip|Read Image"),
_("Reads an optical disc image into a file (or tries to complete an existing image file)."));
content = gtk_vbox_new(FALSE, 0); /* read linear window */
ignore = gtk_label_new("read_tab_l");
gtk_notebook_append_page(notebook, content, ignore);
CreateLinearReadWindow(content);
GuiCreateLinearReadWindow(content);
content = gtk_vbox_new(FALSE, 0); /* read adaptive window */
ignore = gtk_label_new("read_tab_a");
gtk_notebook_append_page(notebook, content, ignore);
CreateAdaptiveReadWindow(content);
GuiCreateAdaptiveReadWindow(content);
/*** Create */
Closure->createButton = wid = create_button(_("button|Create"), "dvdisaster-create");
g_signal_connect(G_OBJECT(wid), "clicked", G_CALLBACK(action_cb), (gpointer)ACTION_CREATE);
gtk_box_pack_start(GTK_BOX(vbox), wid, FALSE, FALSE, 0);
AttachTooltip(wid, _("tooltip|Create error correction data"), _("Creates error correction data. Requires an image file."));
GuiAttachTooltip(wid, _("tooltip|Create error correction data"),
_("Creates error correction data. Requires an image file."));
/*** Scan */
Closure->scanButton = wid = create_button(_("button|Scan"), "dvdisaster-scan");
g_signal_connect(G_OBJECT(wid), "clicked", G_CALLBACK(action_cb), (gpointer)ACTION_SCAN);
gtk_box_pack_start(GTK_BOX(vbox), wid, FALSE, FALSE, 0);
AttachTooltip(wid, _("tooltip|Scan medium"), _("Scans medium for unreadable sectors."));
GuiAttachTooltip(wid, _("tooltip|Scan medium"),
_("Scans medium for unreadable sectors."));
/*** Fix */
Closure->fixButton = wid = create_button(_("button|Fix"), "dvdisaster-fix");
g_signal_connect(G_OBJECT(wid), "clicked", G_CALLBACK(action_cb), (gpointer)ACTION_FIX);
gtk_box_pack_start(GTK_BOX(vbox), wid, FALSE, FALSE, 0);
AttachTooltip(wid, _("tooltip|Repair image"), _("Repairs an image. Requires an image file and error correction data."));
GuiAttachTooltip(wid, _("tooltip|Repair image"),
_("Repairs an image. Requires an image file and error correction data."));
/*** Verify */
Closure->testButton = wid = create_button(_("button|Verify"), "dvdisaster-verify");
g_signal_connect(G_OBJECT(wid), "clicked", G_CALLBACK(action_cb), (gpointer)ACTION_VERIFY);
gtk_box_pack_start(GTK_BOX(vbox), wid, FALSE, FALSE, 0);
AttachTooltip(wid, _("tooltip|Consistency check"), _("Tests consistency of error correction data and image file."));
GuiAttachTooltip(wid, _("tooltip|Consistency check"),
_("Tests consistency of error correction data and image file."));
/*** Strip */
Closure->stripButton = wid = create_button(_("button|Strip"), "dvdisaster-strip");
g_signal_connect(G_OBJECT(wid), "clicked", G_CALLBACK(action_cb), (gpointer)ACTION_STRIP);
gtk_box_pack_start(GTK_BOX(vbox), wid, FALSE, FALSE, 0);
AttachTooltip(wid, _("tooltip|Strip ECC"), _("Strip ECC data from an augmented image."));
GuiAttachTooltip(wid, _("tooltip|Strip ECC"),
_("Strip ECC data from an augmented image."));
/*** Stop */
wid = create_button(_("button|Stop"), "dvdisaster-gtk-stop");
g_signal_connect(G_OBJECT(wid), "clicked", G_CALLBACK(action_cb), (gpointer)ACTION_STOP);
gtk_box_pack_end(GTK_BOX(vbox), wid, FALSE, FALSE, 0);
AttachTooltip(wid, _("tooltip|Abort action"), _("Aborts an ongoing action."));
GuiAttachTooltip(wid, _("tooltip|Abort action"),
_("Aborts an ongoing action."));
/*** Block drive related actions if no drives were found */
@@ -384,10 +395,10 @@ static GtkWidget* create_action_bar(GtkNotebook *notebook)
*/
static void log_cb(GtkWidget *widget, gpointer data)
{ ShowLog();
{ GuiShowLog();
}
void CreateMainWindow(int *argc, char ***argv)
void GuiCreateMainWindow(int *argc, char ***argv)
{ GtkWidget *window,*wid,*outer_box,*middle_box,*status_box,*sep;
GtkWidget *box, *icon, *button;
char title[80];
@@ -407,7 +418,7 @@ void CreateMainWindow(int *argc, char ***argv)
/*** Create our icons */
CreateIconFactory();
GuiCreateIconFactory();
/*** Open the main window */
@@ -439,13 +450,13 @@ void CreateMainWindow(int *argc, char ***argv)
/* Menu and tool bar */
wid = CreateMenuBar(outer_box);
wid = GuiCreateMenuBar(outer_box);
gtk_box_pack_start(GTK_BOX(outer_box), wid, FALSE, FALSE, 0);
sep = gtk_hseparator_new();
gtk_box_pack_start(GTK_BOX(outer_box), sep, FALSE, FALSE, 0);
wid = CreateToolBar(outer_box);
wid = GuiCreateToolBar(outer_box);
gtk_box_pack_start(GTK_BOX(outer_box), wid, FALSE, FALSE, 3);
/* Middle part */
@@ -461,7 +472,7 @@ void CreateMainWindow(int *argc, char ***argv)
gtk_notebook_set_show_border(GTK_NOTEBOOK(wid), FALSE);
gtk_box_pack_start(GTK_BOX(middle_box), wid, TRUE, TRUE, 0);
CreateWelcomePage(GTK_NOTEBOOK(Closure->notebook));
GuiCreateWelcomePage(GTK_NOTEBOOK(Closure->notebook));
wid = create_action_bar((GTK_NOTEBOOK(Closure->notebook)));
gtk_box_pack_end(GTK_BOX(middle_box), wid, FALSE, FALSE, 3);
@@ -479,7 +490,7 @@ void CreateMainWindow(int *argc, char ***argv)
/* Status bar contents. */
Closure->status = GTK_LABEL(gtk_label_new(NULL));
Closure->status = gtk_label_new(NULL);
gtk_label_set_ellipsize(GTK_LABEL(Closure->status), PANGO_ELLIPSIZE_END);
gtk_misc_set_alignment(GTK_MISC(Closure->status), 0.0, 0.5);
gtk_box_pack_start(GTK_BOX(status_box), GTK_WIDGET(Closure->status), TRUE, TRUE, 5);
@@ -488,9 +499,9 @@ void CreateMainWindow(int *argc, char ***argv)
gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE);
gtk_box_pack_end(GTK_BOX(status_box), button, FALSE, FALSE, 5);
g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(log_cb), NULL);
AttachTooltip(button,
_("tooltip|Protocol for current action"),
_("Displays additional information created during the current or last action."));
GuiAttachTooltip(button,
_("tooltip|Protocol for current action"),
_("Displays additional information created during the current or last action."));
box = gtk_hbox_new(FALSE, 0);
gtk_container_add(GTK_CONTAINER(button), box);
@@ -507,3 +518,4 @@ void CreateMainWindow(int *argc, char ***argv)
gtk_widget_show_all(window);
gtk_main();
}
#endif /* WITH_GUI_YES */

View File

@@ -20,6 +20,8 @@
* along with dvdisaster. If not, see <http://www.gnu.org/licenses/>.
*/
/*** src type: no GUI code ***/
#include "dvdisaster.h"
#if 0

View File

@@ -20,32 +20,33 @@
* along with dvdisaster. If not, see <http://www.gnu.org/licenses/>.
*/
/*** src type: some GUI code ***/
#include "dvdisaster.h"
#include "scsi-layer.h"
#include "udf.h"
#ifndef WITH_CLI_ONLY_YES
/*
* Local data
*/
typedef struct _medium_info
{ GtkLabel *profileDescr;
GtkLabel *physicalType;
GtkLabel *bookType;
GtkLabel *manufID;
GtkLabel *discStatus;
GtkLabel *usedCapacity1;
GtkLabel *usedCapacity2;
GtkLabel *blankCapacity;
GtkLabel *isoLabel;
GtkLabel *isoSize;
GtkLabel *isoTime;
GtkLabel *eccState;
GtkLabel *eccSize;
GtkLabel *eccVersion;
GtkLabel *exhaustiveSearch;
{ GtkWidget *profileDescr;
GtkWidget *physicalType;
GtkWidget *bookType;
GtkWidget *manufID;
GtkWidget *discStatus;
GtkWidget *usedCapacity1;
GtkWidget *usedCapacity2;
GtkWidget *blankCapacity;
GtkWidget *isoLabel;
GtkWidget *isoSize;
GtkWidget *isoTime;
GtkWidget *eccState;
GtkWidget *eccSize;
GtkWidget *eccVersion;
GtkWidget *exhaustiveSearch;
GtkWidget *exhaustiveSearchButton;
} medium_info;
@@ -54,23 +55,22 @@ typedef struct _medium_info
***/
static void print_defaults(medium_info *mi)
{ SetLabelText(mi->physicalType, _("Please wait..."));
SetLabelText(mi->bookType, "-");
SetLabelText(mi->manufID, "-");
SetLabelText(mi->profileDescr, "-");
SetLabelText(mi->discStatus, "-");
SetLabelText(mi->usedCapacity1, "-");
SetLabelText(mi->usedCapacity2, " ");
SetLabelText(mi->blankCapacity, "-");
SetLabelText(mi->isoLabel, "-");
SetLabelText(mi->isoSize, "-");
SetLabelText(mi->isoTime, "-");
SetLabelText(mi->eccState, "-");
SetLabelText(mi->eccSize, "-");
SetLabelText(mi->eccVersion, "-");
SetLabelText(mi->exhaustiveSearch, "-");
{ GuiSetLabelText(mi->physicalType, _("Please wait..."));
GuiSetLabelText(mi->bookType, "-");
GuiSetLabelText(mi->manufID, "-");
GuiSetLabelText(mi->profileDescr, "-");
GuiSetLabelText(mi->discStatus, "-");
GuiSetLabelText(mi->usedCapacity1, "-");
GuiSetLabelText(mi->usedCapacity2, " ");
GuiSetLabelText(mi->blankCapacity, "-");
GuiSetLabelText(mi->isoLabel, "-");
GuiSetLabelText(mi->isoSize, "-");
GuiSetLabelText(mi->isoTime, "-");
GuiSetLabelText(mi->eccState, "-");
GuiSetLabelText(mi->eccSize, "-");
GuiSetLabelText(mi->eccVersion, "-");
GuiSetLabelText(mi->exhaustiveSearch, "-");
}
#endif
static void print_tab(char *label, int tab_width)
{ char *translation=_(label);
@@ -89,34 +89,27 @@ static void print_tab(char *label, int tab_width)
void PrintMediumInfo(void *mi_ptr)
{ Image *image;
DeviceHandle *dh;
#ifndef WITH_CLI_ONLY_YES
medium_info *mi=(medium_info*)mi_ptr;
#endif
char *disc_status;
char *sess_status;
int tab_width=30;
#ifndef WITH_CLI_ONLY_YES
if(!mi) /* create dummy medium_info in CLI mode so that PrintCLIorLabel() won't crash */
{ mi=alloca(sizeof(medium_info));
memset(mi, 0, sizeof(medium_info));
}
#endif
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
print_defaults(mi);
#ifdef WITH_GUI_YES
/*** Ensure the UI is fully updated before our thread is stuck doing i/o */
while (gtk_events_pending()) gtk_main_iteration();
#endif
image = OpenImageFromDevice(Closure->device, 2 /* allow blanks, see comment in OpenImageFromDevice() */);
#ifndef WITH_CLI_ONLY_YES
/*** in case of !image, say that we didn't find any medium */
if(Closure->guiMode)
SetLabelText(mi->physicalType, _("Medium not present"));
#endif
GuiSetLabelText(mi->physicalType, _("Medium not present"));
if(!image) return;
dh = image->dh;
QueryBlankCapacity(dh);
@@ -136,37 +129,13 @@ void PrintMediumInfo(void *mi_ptr)
NULL)+1;
print_tab("Medium type:",tab_width);
PrintCLIorLabel(
#ifndef WITH_CLI_ONLY_YES
mi->physicalType,
#else
NULL,
#endif
"%s\n", dh->typeDescr);
PrintCLIorLabel(mi->physicalType, "%s\n", dh->typeDescr);
print_tab("Book type:",tab_width);
PrintCLIorLabel(
#ifndef WITH_CLI_ONLY_YES
mi->bookType,
#else
NULL,
#endif
"%s\n", dh->bookDescr);
PrintCLIorLabel(mi->bookType, "%s\n", dh->bookDescr);
print_tab("Manuf.-ID:",tab_width);
PrintCLIorLabel(
#ifndef WITH_CLI_ONLY_YES
mi->manufID,
#else
NULL,
#endif
"%s\n", dh->manuID);
PrintCLIorLabel(mi->manufID, "%s\n", dh->manuID);
print_tab("Drive profile:",tab_width);
PrintCLIorLabel(
#ifndef WITH_CLI_ONLY_YES
mi->profileDescr,
#else
NULL,
#endif
"%s\n", dh->profileDescr);
PrintCLIorLabel(mi->profileDescr, "%s\n", dh->profileDescr);
switch(dh->discStatus&3)
{ case 0: disc_status = g_strdup(_("empty")); break;
@@ -183,44 +152,20 @@ NULL,
print_tab("Disc status:",tab_width);
PrintCLIorLabel(
#ifndef WITH_CLI_ONLY_YES
mi->discStatus,
#else
NULL,
#endif
_("%s (%d sessions; last session %s)\n"),
PrintCLIorLabel(mi->discStatus, _("%s (%d sessions; last session %s)\n"),
disc_status, dh->sessions, sess_status);
g_free(disc_status);
g_free(sess_status);
print_tab("Used sectors:",tab_width);
PrintCLIorLabel(
#ifndef WITH_CLI_ONLY_YES
mi->usedCapacity1,
#else
NULL,
#endif
_("%" PRId64 " sectors (%" PRId64 " MiB), from READ CAPACITY\n"),
PrintCLIorLabel(mi->usedCapacity1, _("%" PRId64 " sectors (%" PRId64 " MiB), from READ CAPACITY\n"),
dh->readCapacity+1, (dh->readCapacity+1)>>9);
print_tab(" ",tab_width);
PrintCLIorLabel(
#ifndef WITH_CLI_ONLY_YES
mi->usedCapacity2,
#else
NULL,
#endif
_("%" PRId64 " sectors (%" PRId64 " MiB), from DVD structure\n"),
PrintCLIorLabel(mi->usedCapacity2, _("%" PRId64 " sectors (%" PRId64 " MiB), from DVD structure\n"),
dh->userAreaSize, dh->userAreaSize>>9);
print_tab("Blank capacity:",tab_width);
PrintCLIorLabel(
#ifndef WITH_CLI_ONLY_YES
mi->blankCapacity,
#else
NULL,
#endif
_("%" PRId64 " sectors (%" PRId64 " MiB)\n"),
PrintCLIorLabel(mi->blankCapacity, _("%" PRId64 " sectors (%" PRId64 " MiB)\n"),
dh->blankCapacity, (dh->blankCapacity)>>9);
/* Filesystem properties */
@@ -236,30 +181,12 @@ NULL,
PrintCLI("\n\n");
print_tab("Medium label:",tab_width);
PrintCLIorLabel(
#ifndef WITH_CLI_ONLY_YES
mi->isoLabel,
#else
NULL,
#endif
"%s\n", image->isoInfo->volumeLabel);
PrintCLIorLabel(mi->isoLabel, "%s\n", image->isoInfo->volumeLabel);
print_tab("File system size:",tab_width);
PrintCLIorLabel(
#ifndef WITH_CLI_ONLY_YES
mi->isoSize,
#else
NULL,
#endif
_("%d sectors (%" PRId64 " MiB)\n"),
PrintCLIorLabel(mi->isoSize, _("%d sectors (%" PRId64 " MiB)\n"),
image->isoInfo->volumeSize, (gint64)image->isoInfo->volumeSize>>9);
print_tab("Creation time:",tab_width);
PrintCLIorLabel(
#ifndef WITH_CLI_ONLY_YES
mi->isoTime,
#else
NULL,
#endif
"%s\n", image->isoInfo->creationDate);
PrintCLIorLabel(mi->isoTime, "%s\n", image->isoInfo->creationDate);
}
/* Augmented image properties
@@ -283,44 +210,28 @@ NULL,
memcpy(method, eh->method, 4);
method[4] = 0;
print_tab("Error correction data:",tab_width);
#ifndef WITH_CLI_ONLY_YES
PrintCLIorLabel(mi->eccState, _("%s, %d roots, %4.1f%% redundancy.\n"),
#else
PrintCLIorLabel(NULL, _("%s, %d roots, %4.1f%% redundancy.\n"),
#endif
method, eh->eccBytes,
((double)eh->eccBytes*100.0)/(double)eh->dataBytes);
method, eh->eccBytes,
((double)eh->eccBytes*100.0)/(double)eh->dataBytes);
print_tab("Augmented image size:",tab_width);
#ifndef WITH_CLI_ONLY_YES
PrintCLIorLabel(mi->eccSize, _("%" PRIu64 " sectors (%" PRId64 " MiB)\n"),
#else
PrintCLIorLabel(NULL, _("%" PRId64 " sectors (%" PRId64 " MiB)\n"),
#endif
image->expectedSectors, image->expectedSectors>>9);
image->expectedSectors, image->expectedSectors>>9);
print_tab("dvdisaster version:", tab_width);
if(micro)
#ifndef WITH_CLI_ONLY_YES
PrintCLIorLabel(mi->eccVersion, "%d.%d.%d", major, minor, micro);
#else
PrintCLIorLabel(NULL, "%d.%d.%d", major, minor, micro);
#endif
else
#ifndef WITH_CLI_ONLY_YES
PrintCLIorLabel(mi->eccVersion, "%d.%d", major, minor);
#else
PrintCLIorLabel(NULL, "%d.%d", major, minor);
#endif
else PrintCLIorLabel(mi->eccVersion, "%d.%d", major, minor);
}
#ifndef WITH_CLI_ONLY_YES
#ifdef WITH_GUI_YES
if (Closure->examineRS02 && Closure->examineRS03)
{ SetLabelText(mi->exhaustiveSearch, _("yes"));
{ GuiSetLabelText(mi->exhaustiveSearch, _("yes"));
/*** Hide exhaustive search button if exhaustive search is already enabled for RS02 / RS03 */
gtk_widget_hide(mi->exhaustiveSearchButton);
} else
{ SetLabelText(mi->exhaustiveSearch, _("no"));
gtk_widget_hide(mi->exhaustiveSearchButton);
}
else
{ GuiSetLabelText(mi->exhaustiveSearch, _("no"));
gtk_widget_show(mi->exhaustiveSearchButton);
}
#endif
@@ -330,10 +241,11 @@ NULL,
CloseImage(image);
}
#ifdef WITH_GUI_YES
/***
*** GUI callbacks
***/
#ifndef WITH_CLI_ONLY_YES
/*
* Callback for drive selection
@@ -403,7 +315,7 @@ static void mi_destroy_cb(GtkWidget *widget, gpointer data)
*** Create the medium info window
***/
void CreateMediumInfoWindow()
void GuiCreateMediumInfoWindow()
{ GtkWidget *dialog,*vbox,*hbox,*table,*button,*lab,*sep,*frame,*combo_box;
medium_info *mi;
int i;
@@ -496,7 +408,7 @@ void CreateMediumInfoWindow()
gtk_misc_set_alignment(GTK_MISC(lab), 0.0, 0.0);
gtk_table_attach(GTK_TABLE(table), lab, 0, 1, 0, 1, GTK_SHRINK | GTK_FILL, GTK_SHRINK, 5, 2 );
lab = gtk_label_new(" ");
mi->physicalType = GTK_LABEL(lab);
mi->physicalType = lab;
gtk_misc_set_alignment(GTK_MISC(lab), 0.0, 0.0);
gtk_table_attach(GTK_TABLE(table), lab, 1, 2, 0, 1, GTK_EXPAND | GTK_FILL, GTK_SHRINK, 0, 0);
@@ -504,7 +416,7 @@ void CreateMediumInfoWindow()
gtk_misc_set_alignment(GTK_MISC(lab), 0.0, 0.0);
gtk_table_attach(GTK_TABLE(table), lab, 0, 1, 1, 2, GTK_SHRINK | GTK_FILL, GTK_SHRINK, 5, 2 );
lab = gtk_label_new(" ");
mi->bookType = GTK_LABEL(lab);
mi->bookType = lab;
gtk_misc_set_alignment(GTK_MISC(lab), 0.0, 0.0);
gtk_table_attach(GTK_TABLE(table), lab, 1, 2, 1, 2, GTK_EXPAND | GTK_FILL, GTK_SHRINK, 0, 0);
@@ -512,7 +424,7 @@ void CreateMediumInfoWindow()
gtk_misc_set_alignment(GTK_MISC(lab), 0.0, 0.0);
gtk_table_attach(GTK_TABLE(table), lab, 0, 1, 2, 3, GTK_SHRINK | GTK_FILL, GTK_SHRINK, 5, 2 );
lab = gtk_label_new(" ");
mi->manufID = GTK_LABEL(lab);
mi->manufID = lab;
gtk_misc_set_alignment(GTK_MISC(lab), 0.0, 0.0);
gtk_table_attach(GTK_TABLE(table), lab, 1, 2, 2, 3, GTK_EXPAND | GTK_FILL, GTK_SHRINK, 0, 0);
@@ -520,7 +432,7 @@ void CreateMediumInfoWindow()
gtk_misc_set_alignment(GTK_MISC(lab), 0.0, 0.0);
gtk_table_attach(GTK_TABLE(table), lab, 0, 1, 3, 4, GTK_SHRINK | GTK_FILL, GTK_SHRINK, 5, 2 );
lab = gtk_label_new(" ");
mi->profileDescr = GTK_LABEL(lab);
mi->profileDescr = lab;
gtk_misc_set_alignment(GTK_MISC(lab), 0.0, 0.0);
gtk_table_attach(GTK_TABLE(table), lab, 1, 2, 3, 4, GTK_EXPAND | GTK_FILL, GTK_SHRINK, 0, 0);
@@ -528,7 +440,7 @@ void CreateMediumInfoWindow()
gtk_misc_set_alignment(GTK_MISC(lab), 0.0, 0.0);
gtk_table_attach(GTK_TABLE(table), lab, 0, 1, 4, 5, GTK_SHRINK | GTK_FILL, GTK_SHRINK, 5, 2 );
lab = gtk_label_new(" ");
mi->discStatus = GTK_LABEL(lab);
mi->discStatus = lab;
gtk_misc_set_alignment(GTK_MISC(lab), 0.0, 0.0);
gtk_table_attach(GTK_TABLE(table), lab, 1, 2, 4, 5, GTK_EXPAND | GTK_FILL, GTK_SHRINK, 0, 0);
@@ -536,7 +448,7 @@ void CreateMediumInfoWindow()
gtk_misc_set_alignment(GTK_MISC(lab), 0.0, 0.0);
gtk_table_attach(GTK_TABLE(table), lab, 0, 1, 5, 6, GTK_SHRINK | GTK_FILL, GTK_SHRINK, 5, 2 );
lab = gtk_label_new(" ");
mi->usedCapacity1 = GTK_LABEL(lab);
mi->usedCapacity1 = lab;
gtk_misc_set_alignment(GTK_MISC(lab), 0.0, 0.0);
gtk_table_attach(GTK_TABLE(table), lab, 1, 2, 5, 6, GTK_EXPAND | GTK_FILL, GTK_SHRINK, 0, 0);
@@ -544,7 +456,7 @@ void CreateMediumInfoWindow()
gtk_misc_set_alignment(GTK_MISC(lab), 0.0, 0.0);
gtk_table_attach(GTK_TABLE(table), lab, 0, 1, 6, 7, GTK_SHRINK | GTK_FILL, GTK_SHRINK, 5, 2 );
lab = gtk_label_new(" ");
mi->usedCapacity2 = GTK_LABEL(lab);
mi->usedCapacity2 = lab;
gtk_misc_set_alignment(GTK_MISC(lab), 0.0, 0.0);
gtk_table_attach(GTK_TABLE(table), lab, 1, 2, 6, 7, GTK_EXPAND | GTK_FILL, GTK_SHRINK, 0, 0);
@@ -552,7 +464,7 @@ void CreateMediumInfoWindow()
gtk_misc_set_alignment(GTK_MISC(lab), 0.0, 0.0);
gtk_table_attach(GTK_TABLE(table), lab, 0, 1, 7, 8, GTK_SHRINK | GTK_FILL, GTK_SHRINK, 5, 2 );
lab = gtk_label_new(" ");
mi->blankCapacity = GTK_LABEL(lab);
mi->blankCapacity = lab;
gtk_misc_set_alignment(GTK_MISC(lab), 0.0, 0.0);
gtk_table_attach(GTK_TABLE(table), lab, 1, 2, 7, 8, GTK_EXPAND | GTK_FILL, GTK_SHRINK, 0, 0);
@@ -569,7 +481,7 @@ void CreateMediumInfoWindow()
gtk_misc_set_alignment(GTK_MISC(lab), 0.0, 0.0);
gtk_table_attach(GTK_TABLE(table), lab, 0, 1, 0, 1, GTK_SHRINK | GTK_FILL, GTK_SHRINK, 5, 2 );
lab = gtk_label_new(" ");
mi->isoLabel = GTK_LABEL(lab);
mi->isoLabel = lab;
gtk_misc_set_alignment(GTK_MISC(lab), 0.0, 0.0);
gtk_table_attach(GTK_TABLE(table), lab, 1, 2, 0, 1, GTK_EXPAND | GTK_FILL, GTK_SHRINK, 0, 0);
@@ -577,7 +489,7 @@ void CreateMediumInfoWindow()
gtk_misc_set_alignment(GTK_MISC(lab), 0.0, 0.0);
gtk_table_attach(GTK_TABLE(table), lab, 0, 1, 1, 2, GTK_SHRINK | GTK_FILL, GTK_SHRINK, 5, 2 );
lab = gtk_label_new(" ");
mi->isoSize = GTK_LABEL(lab);
mi->isoSize = lab;
gtk_misc_set_alignment(GTK_MISC(lab), 0.0, 0.0);
gtk_table_attach(GTK_TABLE(table), lab, 1, 2, 1, 2, GTK_EXPAND | GTK_FILL, GTK_SHRINK, 0, 0);
@@ -585,7 +497,7 @@ void CreateMediumInfoWindow()
gtk_misc_set_alignment(GTK_MISC(lab), 0.0, 0.0);
gtk_table_attach(GTK_TABLE(table), lab, 0, 1, 2, 3, GTK_SHRINK | GTK_FILL, GTK_SHRINK, 5, 2 );
lab = gtk_label_new(" ");
mi->isoTime = GTK_LABEL(lab);
mi->isoTime = lab;
gtk_misc_set_alignment(GTK_MISC(lab), 0.0, 0.0);
gtk_table_attach(GTK_TABLE(table), lab, 1, 2, 2, 3, GTK_EXPAND | GTK_FILL, GTK_SHRINK, 0, 0);
@@ -602,7 +514,7 @@ void CreateMediumInfoWindow()
gtk_misc_set_alignment(GTK_MISC(lab), 0.0, 0.0);
gtk_table_attach(GTK_TABLE(table), lab, 0, 1, 0, 1, GTK_SHRINK | GTK_FILL, GTK_SHRINK, 5, 2 );
lab = gtk_label_new(" ");
mi->eccState = GTK_LABEL(lab);
mi->eccState = lab;
gtk_misc_set_alignment(GTK_MISC(lab), 0.0, 0.0);
gtk_table_attach(GTK_TABLE(table), lab, 1, 3, 0, 1, GTK_EXPAND | GTK_FILL, GTK_SHRINK, 0, 0);
@@ -610,7 +522,7 @@ void CreateMediumInfoWindow()
gtk_misc_set_alignment(GTK_MISC(lab), 0.0, 0.0);
gtk_table_attach(GTK_TABLE(table), lab, 0, 1, 1, 2, GTK_SHRINK | GTK_FILL, GTK_SHRINK, 5, 2 );
lab = gtk_label_new(" ");
mi->eccSize = GTK_LABEL(lab);
mi->eccSize = lab;
gtk_misc_set_alignment(GTK_MISC(lab), 0.0, 0.0);
gtk_table_attach(GTK_TABLE(table), lab, 1, 3, 1, 2, GTK_EXPAND | GTK_FILL, GTK_SHRINK, 0, 0);
@@ -618,7 +530,7 @@ void CreateMediumInfoWindow()
gtk_misc_set_alignment(GTK_MISC(lab), 0.0, 0.0);
gtk_table_attach(GTK_TABLE(table), lab, 0, 1, 2, 3, GTK_SHRINK | GTK_FILL, GTK_SHRINK, 5, 2 );
lab = gtk_label_new(" ");
mi->eccVersion = GTK_LABEL(lab);
mi->eccVersion = lab;
gtk_misc_set_alignment(GTK_MISC(lab), 0.0, 0.0);
gtk_table_attach(GTK_TABLE(table), lab, 1, 3, 2, 3, GTK_EXPAND | GTK_FILL, GTK_SHRINK, 0, 0);
@@ -626,7 +538,7 @@ void CreateMediumInfoWindow()
gtk_misc_set_alignment(GTK_MISC(lab), 0.0, 0.0);
gtk_table_attach(GTK_TABLE(table), lab, 0, 1, 3, 4, GTK_SHRINK | GTK_FILL, GTK_SHRINK, 5, 2 );
lab = gtk_label_new(" ");
mi->exhaustiveSearch = GTK_LABEL(lab);
mi->exhaustiveSearch = lab;
gtk_misc_set_alignment(GTK_MISC(lab), 0.0, 0.0);
gtk_table_attach(GTK_TABLE(table), lab, 1, 2, 3, 4, GTK_EXPAND | GTK_FILL, GTK_SHRINK, 0, 0);
mi->exhaustiveSearchButton = gtk_button_new_with_label(_utf("Run exhaustive search"));

View File

@@ -20,6 +20,8 @@
* along with dvdisaster. If not, see <http://www.gnu.org/licenses/>.
*/
/*** src type: no GUI code ***/
#ifdef WITH_MEMDEBUG_YES
#define _GNU_SOURCE

View File

@@ -19,8 +19,10 @@
* You should have received a copy of the GNU General Public License
* along with dvdisaster. If not, see <http://www.gnu.org/licenses/>.
*/
// DVDISASTER_GUI_FILE
/*** src type: only GUI code ***/
#ifdef WITH_GUI_YES
#include "dvdisaster.h"
#include <limits.h>
@@ -104,48 +106,48 @@ static void menu_cb(GtkWidget *widget, gpointer data)
break;
case MENU_TOOLS_MEDIUM_INFO:
CreateMediumInfoWindow();
GuiCreateMediumInfoWindow();
break;
case MENU_TOOLS_RAW_EDITOR:
CreateRawEditor();
GuiCreateRawEditor();
break;
case MENU_PREFERENCES:
CreatePreferencesWindow();
GuiCreatePreferencesWindow();
break;
case MENU_HELP_MANUAL:
ShowURL(NULL);
GuiShowURL(NULL);
break;
case MENU_HELP_ABOUT:
AboutDialog();
GuiAboutDialog();
break;
case MENU_HELP_GPL:
ShowGPL();
GuiShowGPL();
break;
case MENU_HELP_CHANGELOG:
ShowTextfile(_("windowtitle|Change log"),
_("<big>Change log</big>\n"
"<i>Major differences from earlier program versions.</i>"),
"CHANGELOG", NULL, NULL);
GuiShowTextfile(_("windowtitle|Change log"),
_("<big>Change log</big>\n"
"<i>Major differences from earlier program versions.</i>"),
"CHANGELOG", NULL, NULL);
break;
case MENU_HELP_CREDITS:
ShowTextfile(_("windowtitle|Credits"),
_("<big>Credits</big>\n"
"<i>Thanks go out to...</i>"),
"CREDITS", NULL, NULL);
GuiShowTextfile(_("windowtitle|Credits"),
_("<big>Credits</big>\n"
"<i>Thanks go out to...</i>"),
"CREDITS", NULL, NULL);
break;
case MENU_HELP_TODO:
ShowTextfile(_("windowtitle|To do list"),
_("<big>To do list</big>\n"
"<i>A sneak preview of coming features ... perhaps ;-)</i>"),
"TODO", NULL, NULL);
GuiShowTextfile(_("windowtitle|To do list"),
_("<big>To do list</big>\n"
"<i>A sneak preview of coming features ... perhaps ;-)</i>"),
"TODO", NULL, NULL);
break;
default:
@@ -198,7 +200,7 @@ static void append_sub_menu(GtkWidget *parent, GtkWidget *strip, char *name)
* Using the itemfactory would make things more complicated wrt localization.
*/
GtkWidget *CreateMenuBar(GtkWidget *parent)
GtkWidget *GuiCreateMenuBar(GtkWidget *parent)
{ GtkWidget *menu_bar, *menu_anchor, *menu_strip, *item;
/* The overall menu bar */
@@ -269,10 +271,10 @@ static gint tooltip_cb(GtkWidget *widget, GdkEvent *event, gpointer data)
{
switch(event->type)
{ case GDK_ENTER_NOTIFY:
gtk_label_set_text(Closure->status, (gchar*)data);
gtk_label_set_text(GTK_LABEL(Closure->status), (gchar*)data);
break;
case GDK_LEAVE_NOTIFY:
gtk_label_set_text(Closure->status, "");
gtk_label_set_text(GTK_LABEL(Closure->status), "");
break;
default:
@@ -282,7 +284,7 @@ static gint tooltip_cb(GtkWidget *widget, GdkEvent *event, gpointer data)
return FALSE; /* don't intercept the default button callbacks! */
}
void AttachTooltip(GtkWidget *widget, char *short_descr, char *long_descr)
void GuiAttachTooltip(GtkWidget *widget, char *short_descr, char *long_descr)
{ char *long_copy = g_locale_to_utf8(long_descr, -1, NULL, NULL, NULL);
char *short_copy = g_locale_to_utf8(short_descr, -1, NULL, NULL, NULL);
@@ -334,7 +336,7 @@ static void file_select_cb(GtkWidget *widget, gpointer data)
case MENU_FILE_IMAGE:
if(!Closure->imageFileSel)
{ Closure->imageFileSel = gtk_file_selection_new(_utf("windowtitle|Image file selection"));
ReverseCancelOK(GTK_DIALOG(Closure->imageFileSel));
GuiReverseCancelOK(GTK_DIALOG(Closure->imageFileSel));
g_signal_connect(G_OBJECT(Closure->imageFileSel), "destroy",
G_CALLBACK(file_select_cb), GINT_TO_POINTER(MENU_FILE_IMAGE_DESTROY));
g_signal_connect(G_OBJECT(GTK_FILE_SELECTION(Closure->imageFileSel)->ok_button),"clicked",
@@ -371,7 +373,7 @@ static void file_select_cb(GtkWidget *widget, gpointer data)
case MENU_FILE_ECC:
if(!Closure->eccFileSel)
{ Closure->eccFileSel = gtk_file_selection_new(_utf("windowtitle|Error correction file selection"));
ReverseCancelOK(GTK_DIALOG(Closure->eccFileSel));
GuiReverseCancelOK(GTK_DIALOG(Closure->eccFileSel));
g_signal_connect(G_OBJECT(Closure->eccFileSel), "destroy",
G_CALLBACK(file_select_cb), GINT_TO_POINTER(MENU_FILE_ECC_DESTROY));
g_signal_connect(G_OBJECT(GTK_FILE_SELECTION(Closure->eccFileSel)->ok_button),"clicked",
@@ -419,7 +421,7 @@ void set_path(GtkWidget *entry, char *path)
else
{ char buf[PATH_MAX + strlen(path) + 2];
if (!getcwd(buf, PATH_MAX)) return;
if(!getcwd(buf, PATH_MAX)) return;
strcat(buf,"/");
strcat(buf,path);
@@ -454,7 +456,7 @@ static void suffix_cb(GtkWidget *widget, gpointer data)
* Create the toolbar
*/
GtkWidget *CreateToolBar(GtkWidget *parent)
GtkWidget *GuiCreateToolBar(GtkWidget *parent)
{ GtkWidget *box, *button, *ebox, *icon, *prefs, *help, *quit, *sep, *space;
GtkWidget *combo_box;
int dev_idx = 0;
@@ -472,7 +474,8 @@ GtkWidget *CreateToolBar(GtkWidget *parent)
ebox = gtk_event_box_new();
gtk_widget_set_events(ebox, GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK);
gtk_box_pack_start(GTK_BOX(box), ebox, FALSE, FALSE, 0);
AttachTooltip(ebox, _("tooltip|Drive selection"), _("Use the nearby drop-down list to select the input drive."));
GuiAttachTooltip(ebox, _("tooltip|Drive selection"),
_("Use the nearby drop-down list to select the input drive."));
icon = gtk_image_new_from_stock("dvdisaster-cd", GTK_ICON_SIZE_LARGE_TOOLBAR);
gtk_container_add(GTK_CONTAINER(ebox), icon);
@@ -496,7 +499,8 @@ GtkWidget *CreateToolBar(GtkWidget *parent)
gtk_combo_box_set_active(GTK_COMBO_BOX(combo_box), dev_idx);
gtk_widget_set_size_request(combo_box, 200, -1);
gtk_box_pack_start(GTK_BOX(box), combo_box, FALSE, FALSE, 7);
AttachTooltip(combo_box, _("tooltip|Drive selection"), _("Selects the input drive for reading images."));
GuiAttachTooltip(combo_box, _("tooltip|Drive selection"),
_("Selects the input drive for reading images."));
space = gtk_label_new(NULL);
gtk_box_pack_start(GTK_BOX(box), space, FALSE, FALSE, 1);
@@ -526,8 +530,11 @@ GtkWidget *CreateToolBar(GtkWidget *parent)
sep = gtk_vseparator_new();
gtk_box_pack_start(GTK_BOX(box), sep, FALSE, FALSE, 3);
AttachTooltip(button, _("tooltip|Image file selection"), _("Selects a new image file."));
AttachTooltip(Closure->imageEntry, _("tooltip|Current image file"), _("Shows the name of the current image file."));
GuiAttachTooltip(button, _("tooltip|Image file selection"),
_("Selects a new image file."));
GuiAttachTooltip(Closure->imageEntry,
_("tooltip|Current image file"),
_("Shows the name of the current image file."));
/*** Ecc file selection */
@@ -551,9 +558,12 @@ GtkWidget *CreateToolBar(GtkWidget *parent)
sep = gtk_vseparator_new();
gtk_box_pack_start(GTK_BOX(box), sep, FALSE, FALSE, 3);
AttachTooltip(button, _("tooltip|Error correction file selection"), _("Selects a new error correction file."));
AttachTooltip(Closure->eccEntry, _("tooltip|Current error correction file"), _("Shows the name of the current error correction file."));
GuiAttachTooltip(button,
_("tooltip|Error correction file selection"),
_("Selects a new error correction file."));
GuiAttachTooltip(Closure->eccEntry,
_("tooltip|Current error correction file"),
_("Shows the name of the current error correction file."));
/*** Preferences button */
@@ -563,7 +573,9 @@ GtkWidget *CreateToolBar(GtkWidget *parent)
gtk_container_add(GTK_CONTAINER(prefs), icon);
g_signal_connect(G_OBJECT(prefs), "clicked", G_CALLBACK(menu_cb), (gpointer)MENU_PREFERENCES);
gtk_box_pack_start(GTK_BOX(box), prefs, FALSE, FALSE, 0);
AttachTooltip(prefs, _("tooltip|Preferences"), _("Customize settings for creating images, error correction files and other stuff."));
GuiAttachTooltip(prefs,
_("tooltip|Preferences"),
_("Customize settings for creating images, error correction files and other stuff."));
/*** Help button */
@@ -573,7 +585,8 @@ GtkWidget *CreateToolBar(GtkWidget *parent)
gtk_container_add(GTK_CONTAINER(help), icon);
g_signal_connect(G_OBJECT(help), "clicked", G_CALLBACK(menu_cb), (gpointer)MENU_HELP_MANUAL);
gtk_box_pack_start(GTK_BOX(box), help, FALSE, FALSE, 0);
AttachTooltip(help, _("tooltip|User manual"), _("Displays the user manual (external PDF viewer required)."));
GuiAttachTooltip(help, _("tooltip|User manual"),
_("Displays the user manual (external PDF viewer required)."));
/*** Quit button */
@@ -583,7 +596,8 @@ GtkWidget *CreateToolBar(GtkWidget *parent)
gtk_container_add(GTK_CONTAINER(quit), icon);
g_signal_connect(G_OBJECT(quit), "clicked", G_CALLBACK(menu_cb), (gpointer)MENU_FILE_QUIT);
gtk_box_pack_start(GTK_BOX(box), quit, FALSE, FALSE, 0);
AttachTooltip(quit, _("tooltip|Quit"), _("Quit dvdisaster"));
GuiAttachTooltip(quit, _("tooltip|Quit"), _("Quit dvdisaster"));
return box;
}
#endif /* WITH_GUI_YES */

View File

@@ -20,6 +20,8 @@
* along with dvdisaster. If not, see <http://www.gnu.org/licenses/>.
*/
/*** src type: no GUI code ***/
#include "dvdisaster.h"
/***

667
src/misc-gui.c Normal file
View File

@@ -0,0 +1,667 @@
/* dvdisaster: Additional error correction for optical media.
* Copyright (C) 2004-2017 Carsten Gnoerlich.
* Copyright (C) 2019-2021 The dvdisaster development team.
*
* Email: support@dvdisaster.org
*
* This file is part of dvdisaster.
*
* dvdisaster 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 3 of the License, or
* (at your option) any later version.
*
* dvdisaster 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 dvdisaster. If not, see <http://www.gnu.org/licenses/>.
*/
/*** src type: some GUI code ***/
#include "dvdisaster.h"
/***
*** GUI functions which are cli-only safe for convenience.
***/
/*
* Label convenience functions.
* Sets the label text from another thread.
*/
#ifdef WITH_GUI_YES
typedef struct
{ GtkLabel *label;
char *text;
} label_info;
static gboolean label_idle_func(gpointer data)
{ label_info *li = (label_info*)data;
gtk_label_set_markup(li->label, li->text);
g_free(li->text);
g_free(li);
return FALSE;
}
void GuiSetLabelText(GtkWidget *widget, char *format, ...)
{ label_info *li;
va_list argp;
if(!Closure->guiMode)
return;
li = g_malloc(sizeof(label_info));
li->label = GTK_LABEL(widget);
va_start(argp, format);
if(format)
{ char *tmp = g_strdup_vprintf(format, argp);
if(!tmp) tmp=g_strdup_printf("GuiSetLabelText(%s) failed",format);
li->text = g_locale_to_utf8(tmp, -1, NULL, NULL, NULL);
g_free(tmp);
}
else li->text = g_locale_to_utf8("(null)", -1, NULL, NULL, NULL);
va_end(argp);
g_idle_add(label_idle_func, li);
}
#endif
/*
* Progress bar convenience function.
* Percentage is given as a multiple of 0.1 percent.
*/
#ifdef WITH_GUI_YES
typedef struct
{ GtkWidget *pbar;
int percent;
int max;
} progress_info;
static gboolean progress_idle_func(gpointer data)
{ progress_info *pi = (progress_info*)data;
gdouble val = (gdouble)pi->percent / (gdouble)pi->max;
char text[20];
switch(pi->max)
{ case 100: g_sprintf(text, "%3d%%",pi->percent); break;
case 1000: g_sprintf(text, "%3d.%1d%%",pi->percent/10,pi->percent%10); break;
}
gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(pi->pbar), val);
gtk_progress_bar_set_text(GTK_PROGRESS_BAR(pi->pbar), text);
g_free(pi);
return FALSE;
}
void GuiSetProgress(GtkWidget *pbar, int percent, int max)
{ progress_info *pi;
if(!Closure->guiMode) return;
pi = g_malloc(sizeof(progress_info));
pi->pbar = pbar;
pi->percent = percent;
pi->max = max;
g_idle_add(progress_idle_func, pi);
}
#endif
/*
* Switch a notebook to another page and set the text in a label.
* Used in some footlines in the GUI.
* Does nothing in CLI mode to save us from lots of #ifdef WITH_GUI
*/
#ifdef WITH_GUI_YES
typedef struct
{ GtkWidget *notebook;
int newPage;
GtkWidget *label;
char *newText;
} footline_info;
static gboolean footline_idle_func(gpointer data)
{ footline_info *fi = (footline_info*)data;
if(fi->label)
gtk_label_set_markup(GTK_LABEL(fi->label), fi->newText);
gtk_notebook_set_current_page(GTK_NOTEBOOK(fi->notebook), fi->newPage);
if(fi->newText)
g_free(fi->newText);
g_free(fi);
return FALSE;
}
void GuiSwitchAndSetFootline(GtkWidget *notebook, int page, GtkWidget *label, char *format, ...)
{ va_list argp;
char *tmp;
footline_info *fi;
int len;
if(!Closure->guiMode) return;
fi = g_malloc0(sizeof(footline_info));
fi->notebook = notebook;
fi->newPage = page;
fi->label = label;
if(label)
{ va_start(argp, format);
tmp = g_strdup_vprintf(format, argp);
len = strlen(tmp);
if(tmp[len-1] == '\n') tmp[len-1]=0;
fi->newText = g_locale_to_utf8(tmp, -1, NULL, NULL, NULL);
g_free(tmp);
va_end(argp);
}
g_idle_add(footline_idle_func, fi);
}
/*
* CLI mode and GUI mode behave differently wrt. to the worker thread.
* In CLI mode, the worker thread is the main thread and must not be terminated
* when the worker task is finished. However in GUI mode the worker is a separate
* thread which must exit after the assigned work is done.
*/
void GuiExitWorkerThread()
{
if(Closure->guiMode)
g_thread_exit(0);
}
#endif
/*
* A wrapper around GuiModalDialog() to create a logged warning.
* Note that in CLI mode the answer is always "yes",
* so warnings will be printed but never abort CLI mode.
*/
#ifdef WITH_GUI_YES
static int vmodal_dialog(GtkMessageType, GtkButtonsType,
void(*)(GtkDialog*), char*, va_list);
#endif
int ModalWarning(GtkMessageType mt, GtkButtonsType bt,
void(*button_fn)(GtkDialog*), char *msg, ...)
{ va_list argp;
int result = 1;
va_start(argp, msg);
vLogWarning(msg, argp);
va_end(argp);
#ifdef WITH_GUI_YES
if(Closure->guiMode)
{ va_start(argp, msg);
result = vmodal_dialog(mt, bt, button_fn, msg, argp);
va_end(argp);
}
#endif
return result;
}
/*
* Safety requesters before deleting something.
*/
#ifdef WITH_GUI_YES
static void insert_button(GtkDialog*);
int GuiConfirmEccDeletion(char *file)
{ int answer;
if(!Closure->guiMode) /* Always delete it in command line mode */
return TRUE;
if(!Closure->confirmDeletion) /* I told you so... */
return TRUE;
answer = GuiModalDialog(GTK_MESSAGE_QUESTION, GTK_BUTTONS_OK_CANCEL,
insert_button,
_("The error correction file is already present:\n\n"
"%s\n\n"
"Overwrite it?"),
file);
return answer == GTK_RESPONSE_OK;
}
#endif
/*** remaining GUI functions */
#ifdef WITH_GUI_YES
/*
* Spawning of idle functions.
* Idle functions are required to perform actions (like opening
* a dialogue) from a sub thread.
* However idle functions must not be spawned from the main thread
* as it would block infinitely; in that case we must run the idle
* function directly.
*/
static void call_idle_func(gboolean (*idle_func)(gpointer), gpointer data)
{
if(Closure->mainThread == g_thread_self())
{ idle_func(data);
}
else
{ g_idle_add(idle_func, data);
}
}
/***
*** Graphical user interface convenience
***/
/*
* Show the given widget
*/
static gboolean show_idle_func(gpointer data)
{
gtk_widget_show(GTK_WIDGET(data));
return FALSE;
}
void GuiShowWidget(GtkWidget *widget)
{
if(Closure->guiMode)
g_idle_add(show_idle_func, (gpointer)widget);
}
/*
* Activation / Deactivation of the action buttons
*/
static gboolean allow_actions_idle_func(gpointer data)
{ gboolean s = (data != NULL);
/* Disable/Enable parts of the menu */
gtk_widget_set_sensitive(Closure->fileMenuImage, s);
gtk_widget_set_sensitive(Closure->fileMenuEcc, s);
gtk_widget_set_sensitive(Closure->toolMenuAnchor, s);
/* Disable/Enable toolbar and sidebar buttons */
if(Closure->deviceNodes->len)
{ gtk_widget_set_sensitive(Closure->readButton, s);
gtk_widget_set_sensitive(Closure->scanButton, s);
}
gtk_widget_set_sensitive(Closure->createButton, s);
gtk_widget_set_sensitive(Closure->fixButton, s);
gtk_widget_set_sensitive(Closure->testButton, s);
gtk_widget_set_sensitive(Closure->prefsButton, s);
if(!s && Closure->prefsWindow)
{ GuiHidePreferences();
}
Closure->stopActions = FALSE;
return FALSE;
}
void GuiAllowActions(gboolean s)
{
g_idle_add(allow_actions_idle_func, GINT_TO_POINTER(s));
}
/*
* Dispatch a non-modal message dialog
*/
typedef struct
{ char *msg;
GtkMessageType type;
GtkWindow *window;
} message_info;
static gboolean message_idle_func(gpointer data)
{ message_info *mi = (message_info*)data;
GtkWidget *dialog;
dialog = gtk_message_dialog_new_with_markup(mi->window,
GTK_DIALOG_DESTROY_WITH_PARENT,
mi->type,
GTK_BUTTONS_CLOSE,
mi->msg, NULL);
gtk_label_set_line_wrap(GTK_LABEL(((struct _GtkMessageDialog*)dialog)->label), FALSE);
g_signal_connect_swapped(dialog, "response", G_CALLBACK(gtk_widget_destroy), dialog);
gtk_widget_show(dialog);
g_free(mi->msg);
g_free(mi);
return FALSE;
}
void GuiShowMessage(GtkWindow *parent, char *msg, GtkMessageType type)
{ message_info *mi;
if(!Closure->guiMode) return;
mi = g_malloc(sizeof(message_info));
mi->msg = g_strdup(msg);
mi->type = type;
mi->window = parent;
if(Closure->mainThread == g_thread_self())
message_idle_func(mi);
else g_idle_add(message_idle_func, mi);
}
/*
* Creates a message from the main thread
*/
GtkWidget* GuiCreateMessage(char *format, GtkMessageType type, ...)
{ GtkWidget *dialog;
va_list argp;
char *text,*utf8;
if(!Closure->guiMode)
return NULL;
va_start(argp, type);
text = g_strdup_vprintf(format, argp);
va_end(argp);
utf8 = g_locale_to_utf8(text, -1, NULL, NULL, NULL);
dialog = gtk_message_dialog_new(Closure->window,
GTK_DIALOG_DESTROY_WITH_PARENT,
type,
GTK_BUTTONS_CLOSE,
utf8, NULL);
gtk_label_set_line_wrap(GTK_LABEL(((struct _GtkMessageDialog*)dialog)->label), FALSE);
g_signal_connect_swapped(dialog, "response", G_CALLBACK(gtk_widget_destroy), dialog);
gtk_widget_show(dialog);
g_free(text);
g_free(utf8);
return dialog;
}
/*
* Perform a modal dialog.
* Note that the thread running the dialog is different
* from the one blocking/waiting for the response!
*/
typedef struct
{ GMutex *mutex;
GCond *cond;
char *msg;
int ret;
GtkMessageType message_type;
GtkButtonsType button_type;
void (*button_fn)(GtkDialog*);
} modal_info;
static gboolean modal_idle_func(gpointer data)
{ modal_info *mi = (modal_info*)data;
GtkWidget *dialog;
int response;
dialog = gtk_message_dialog_new(Closure->window,
GTK_DIALOG_DESTROY_WITH_PARENT,
mi->message_type,
mi->button_type,
"%s", mi->msg);
gtk_label_set_line_wrap(GTK_LABEL(((struct _GtkMessageDialog*)dialog)->label), FALSE);
if(mi->button_fn)
mi->button_fn(GTK_DIALOG(dialog));
else GuiReverseCancelOK(GTK_DIALOG(dialog));
response = gtk_dialog_run(GTK_DIALOG(dialog));
g_mutex_lock(mi->mutex);
if(mi->button_fn)
mi->ret = response;
else switch(response)
{ case GTK_RESPONSE_OK:
mi->ret = 1;
break;
default:
mi->ret = 0;
break;
}
g_cond_signal(mi->cond);
g_mutex_unlock(mi->mutex);
gtk_widget_destroy(dialog);
return FALSE;
}
static int vmodal_dialog(GtkMessageType mt, GtkButtonsType bt,
void(*button_fn)(GtkDialog*), char *msg, va_list argp)
{ modal_info *mi = g_malloc(sizeof(modal_info));
char *tmp;
int idx,ret;
mi->message_type = mt;
mi->button_type = bt;
mi->button_fn = button_fn;
mi->mutex = g_malloc(sizeof(GMutex)); g_mutex_init(mi->mutex);
mi->cond = g_malloc(sizeof(GCond)); g_cond_init(mi->cond);
tmp = g_strdup_vprintf(msg, argp);
idx = strlen(tmp); /* Remove trailing newline */
if(tmp[idx-1] == '\n')
tmp[idx-1] = 0;
mi->msg = g_locale_to_utf8(tmp, -1, NULL, NULL, NULL);
g_free(tmp);
mi->ret = -1;
call_idle_func(modal_idle_func, mi);
g_mutex_lock(mi->mutex);
while(mi->ret == -1)
g_cond_wait(mi->cond, mi->mutex);
ret = mi->ret;
g_mutex_unlock(mi->mutex);
g_free(mi->msg);
g_mutex_clear(mi->mutex);
g_free(mi->mutex);
g_cond_clear(mi->cond);
g_free(mi->cond);
g_free(mi);
return ret;
}
int GuiModalDialog(GtkMessageType mt, GtkButtonsType bt,
void(*button_fn)(GtkDialog*), char *msg, ...)
{ va_list argp;
int result;
if(!Closure->guiMode)
Stop("GuiModalDialog() called with Closure->guiMode == False");
va_start(argp, msg);
result = vmodal_dialog(mt, bt, button_fn, msg, argp);
va_end(argp);
return result;
}
/*
* Set the text in the pango layout and retrieve its extents.
*/
void GuiSetText(PangoLayout *layout, char *text, int *w, int *h)
{ PangoRectangle rect;
char *t;
if(!Closure->guiMode)
return;
t = g_locale_to_utf8(text, -1, NULL, NULL, NULL);
pango_layout_set_text(layout, t, -1);
pango_layout_get_pixel_extents(layout, NULL, &rect);
g_free(t);
*w = rect.width;
*h = rect.height;
}
/*
* Rearrange buttons to OK Cancel order
* in file dialogs
*
* gtk_dialog_set_alternative_button_order()
* has been introduced since gtk+2.6,
* but does not seem to work correctly.
*/
void GuiReverseCancelOK(GtkDialog *dialog)
{ GtkWidget *box, *button ;
if(!Closure->guiMode || !Closure->reverseCancelOK)
return;
box = dialog->action_area;
button = ((GtkBoxChild*)(g_list_first(GTK_BOX(box)->children)->data))->widget;
gtk_box_reorder_child(GTK_BOX(box), button, 1);
#if 0
gtk_dialog_set_alternative_button_order(GTK_DIALOG(dialog),
GTK_RESPONSE_OK,
GTK_RESPONSE_CANCEL,
-1);
#endif
}
/*
* Get the width of a label text
*/
int GuiGetLabelWidth(GtkLabel *label, char *format, ...)
{ PangoLayout *layout;
PangoRectangle rect;
va_list argp;
char *text;
if(!Closure->guiMode)
return 0;
va_start(argp, format);
text = g_strdup_vprintf(format, argp);
va_end(argp);
layout = gtk_label_get_layout(label);
pango_layout_set_text(layout, text, -1);
pango_layout_get_pixel_extents(layout, NULL, &rect);
g_free(text);
return rect.width;
}
/*
* Lock the size of a label to that of the given sample text.
*/
void GuiLockLabelSize(GtkWidget *wid, char *format, ...)
{ PangoLayout *layout;
PangoRectangle rect;
va_list argp;
char *text;
if(!Closure->guiMode)
return;
va_start(argp, format);
text = g_strdup_vprintf(format, argp);
va_end(argp);
layout = gtk_label_get_layout(GTK_LABEL(wid));
pango_layout_set_text(layout, text, -1);
pango_layout_get_pixel_extents(layout, NULL, &rect);
gtk_widget_set_size_request(wid, rect.width, rect.height);
gtk_misc_set_alignment(GTK_MISC(wid), 0.0, 0.0);
g_free(text);
}
/***
*** Safety requesters before overwriting stuff
***/
static void dont_ask_again_cb(GtkWidget *widget, gpointer data)
{ int state = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
Closure->confirmDeletion = !state;
GuiUpdatePrefsConfirmDeletion();
}
static void insert_button(GtkDialog *dialog)
{ GtkWidget *check,*align;
align = gtk_alignment_new(0.5, 0.5, 0.0, 0.0);
gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), align, FALSE, FALSE, 0);
check = gtk_check_button_new_with_label(_utf("Do not ask again"));
gtk_container_add(GTK_CONTAINER(align), check);
gtk_container_set_border_width(GTK_CONTAINER(align), 10);
g_signal_connect(G_OBJECT(check), "toggled", G_CALLBACK(dont_ask_again_cb), NULL);
gtk_widget_show(align);
gtk_widget_show(check);
GuiReverseCancelOK(GTK_DIALOG(dialog));
}
int GuiConfirmImageDeletion(char *file)
{ int answer;
if(!Closure->guiMode) /* Always delete it in command line mode */
return TRUE;
if(!Closure->confirmDeletion) /* I told you so... */
return TRUE;
answer = GuiModalDialog(GTK_MESSAGE_QUESTION, GTK_BUTTONS_OK_CANCEL,
insert_button,
_("Image file already exists and does not match the medium:\n\n"
"%s\n\n"
"The existing image file will be deleted."),
file);
return answer == GTK_RESPONSE_OK;
}
#endif

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -20,6 +20,8 @@
* along with dvdisaster. If not, see <http://www.gnu.org/licenses/>.
*/
/*** src type: no GUI code ***/
#include "dvdisaster.h"
/***

View File

@@ -19,8 +19,10 @@
* You should have received a copy of the GNU General Public License
* along with dvdisaster. If not, see <http://www.gnu.org/licenses/>.
*/
// DVDISASTER_GUI_FILE
/*** src type: only GUI code ***/
#ifdef WITH_GUI_YES
#include "dvdisaster.h"
#define UNDO_SLOTS 100
@@ -128,7 +130,7 @@ static raw_editor_context* create_raw_editor_context()
return rec;
}
void FreeRawEditorContext(void *rptr)
void GuiFreeRawEditorContext(void *rptr)
{ raw_editor_context *rec = rptr;
int i;
@@ -151,7 +153,7 @@ void FreeRawEditorContext(void *rptr)
static gboolean delete_cb(GtkWidget *widget, GdkEvent *event, gpointer data)
{
FreeRawEditorContext(Closure->rawEditorContext);
GuiFreeRawEditorContext(Closure->rawEditorContext);
return FALSE;
}
@@ -295,7 +297,7 @@ static void file_select_cb(GtkWidget *widget, gpointer data)
{ char filename[strlen(Closure->dDumpDir)+10];
rec->fileSel = gtk_file_selection_new(_utf("windowtitle|Raw sector dump selection"));
ReverseCancelOK(GTK_DIALOG(rec->fileSel));
GuiReverseCancelOK(GTK_DIALOG(rec->fileSel));
g_signal_connect(G_OBJECT(rec->fileSel), "destroy",
G_CALLBACK(file_select_cb), GINT_TO_POINTER(ACTION_FILESEL_DESTROY));
g_signal_connect(G_OBJECT(GTK_FILE_SELECTION(rec->fileSel)->ok_button),"clicked",
@@ -325,8 +327,8 @@ static void file_select_cb(GtkWidget *widget, gpointer data)
calculate_failures(rec);
evaluate_vectors(rec);
render_sector(rec);
SetLabelText(GTK_LABEL(rec->rightLabel), _("%s loaded, LBA %" PRId64 ", %d samples."),
rec->filepath, rec->rb->lba, rec->rb->samplesRead);
GuiSetLabelText(rec->rightLabel, _("%s loaded, LBA %" PRId64 ", %d samples."),
rec->filepath, rec->rb->lba, rec->rb->samplesRead);
break;
case ACTION_FILESEL_CANCEL:
@@ -416,7 +418,7 @@ static void buffer_io_cb(GtkWidget *widget, gpointer data)
{ char filename[strlen(Closure->dDumpDir)+10];
rec->loadBufSel = gtk_file_selection_new(_utf("windowtitle|Load buffer from file"));
ReverseCancelOK(GTK_DIALOG(rec->loadBufSel));
GuiReverseCancelOK(GTK_DIALOG(rec->loadBufSel));
g_signal_connect(G_OBJECT(rec->loadBufSel), "destroy",
G_CALLBACK(buffer_io_cb), GINT_TO_POINTER(ACTION_FILESEL_LOAD_DESTROY));
g_signal_connect(G_OBJECT(GTK_FILE_SELECTION(rec->loadBufSel)->ok_button),"clicked",
@@ -434,7 +436,7 @@ static void buffer_io_cb(GtkWidget *widget, gpointer data)
{ char filename[strlen(Closure->dDumpDir)+10];
rec->saveBufSel = gtk_file_selection_new(_utf("windowtitle|Save buffer to file"));
ReverseCancelOK(GTK_DIALOG(rec->saveBufSel));
GuiReverseCancelOK(GTK_DIALOG(rec->saveBufSel));
g_signal_connect(G_OBJECT(rec->saveBufSel), "destroy",
G_CALLBACK(buffer_io_cb), GINT_TO_POINTER(ACTION_FILESEL_SAVE_DESTROY));
g_signal_connect(G_OBJECT(GTK_FILE_SELECTION(rec->saveBufSel)->ok_button),"clicked",
@@ -471,7 +473,7 @@ static void buffer_io_cb(GtkWidget *widget, gpointer data)
render_sector(rec);
undo_remember(rec);
SetLabelText(GTK_LABEL(rec->rightLabel), _("Buffer loaded from %s."), path);
GuiSetLabelText(rec->rightLabel, _("Buffer loaded from %s."), path);
break;
}
@@ -486,7 +488,7 @@ static void buffer_io_cb(GtkWidget *widget, gpointer data)
LargeWrite(file, rec->rb->recovered, rec->rb->sampleSize);
LargeClose(file);
SetLabelText(GTK_LABEL(rec->rightLabel), _("Buffer saved to %s."), path);
GuiSetLabelText(rec->rightLabel, _("Buffer saved to %s."), path);
break;
}
@@ -509,11 +511,11 @@ static void buffer_io_cb(GtkWidget *widget, gpointer data)
static void calculate_geometry(raw_editor_context *rec)
{ int w,h;
SetText(rec->layout, "w", &w, &h);
GuiSetText(rec->layout, "w", &w, &h);
rec->charWidth = w;
rec->charHeight = h+h/4;
SetText(rec->layout, "34", &w, &h);
GuiSetText(rec->layout, "34", &w, &h);
rec->byteWidth = w+w/2;
rec->byteHeight = h+h/4;
@@ -573,11 +575,12 @@ static void evaluate_vectors(raw_editor_context *rec)
if( CheckEDC(rb->recovered, rb->xaMode)
&& CheckMSF(rb->recovered, rb->lba, STRICT_MSF_CHECK))
{ gtk_widget_set_sensitive(rec->saveButton, TRUE);
SetLabelText(GTK_LABEL(rec->leftLabel), _("*** Well done: Sector has been recovered! ***"));
GuiSetLabelText(rec->leftLabel, _("*** Well done: Sector has been recovered! ***"));
}
else
SetLabelText(GTK_LABEL(rec->leftLabel), _("Current buffer state: P %d/%d, Q %d/%d"),
rec->p2, rec->p1, rec->q2, rec->q1);
GuiSetLabelText(rec->leftLabel,
_("Current buffer state: P %d/%d, Q %d/%d"),
rec->p2, rec->p1, rec->q2, rec->q1);
}
/* Render the sector */
@@ -625,7 +628,7 @@ static void render_sector(raw_editor_context *rec)
sprintf(byte, "%c", canprint(buf[idx]) ? buf[idx] : '.');
idx++;
SetText(rec->layout, byte, &w, &h);
GuiSetText(rec->layout, byte, &w, &h);
gdk_draw_layout(d, Closure->drawGC, x, y, rec->layout);
}
}
@@ -687,7 +690,8 @@ static gboolean button_cb(GtkWidget *widget, GdkEventButton *event, gpointer dat
for(i=0; i<v_size; i++)
{ if(!vector[i]) continue;
if(erasures>2)
{ SetLabelText(GTK_LABEL(rec->rightLabel), _("%c Vector %d has >2 erasures (nothing done)."), type, v);
{ GuiSetLabelText(rec->rightLabel,
_("%c Vector %d has >2 erasures (nothing done)."), type, v);
return TRUE;
}
eras[erasures++] = i;
@@ -715,19 +719,19 @@ static gboolean button_cb(GtkWidget *widget, GdkEventButton *event, gpointer dat
err = DecodePQ(rb->rt, vector, Q_PADDING, eras, e_scratch);
}
if(err==0) SetLabelText(GTK_LABEL(rec->rightLabel),
_("%c Vector %d already good."), type, v);
if(err==0) GuiSetLabelText(rec->rightLabel,
_("%c Vector %d already good."), type, v);
else if(err==1 || err==2)
{ if(type=='P') SetPVector(rb->recovered, vector, v);
else SetQVector(rb->recovered, vector, v);
evaluate_vectors(rec);
render_sector(rec);
undo_remember(rec);
SetLabelText(GTK_LABEL(rec->rightLabel),
_("%c Vector %d corrected (%d erasures)."), type, v, e_scratch);
GuiSetLabelText(rec->rightLabel,
_("%c Vector %d corrected (%d erasures)."), type, v, e_scratch);
}
else SetLabelText(GTK_LABEL(rec->rightLabel),
_("%c Vector %d not correctable (%d erasures)."), type, v, e_scratch);
else GuiSetLabelText(rec->rightLabel,
_("%c Vector %d not correctable (%d erasures)."), type, v, e_scratch);
}
break;
@@ -741,8 +745,8 @@ static gboolean button_cb(GtkWidget *widget, GdkEventButton *event, gpointer dat
v = mouse_x/rec->charWidth;
if(!rb->pn[v])
{ SetLabelText(GTK_LABEL(rec->rightLabel),
_("no replacements for P vector %d available"), v);
{ GuiSetLabelText(rec->rightLabel,
_("no replacements for P vector %d available"), v);
return TRUE;
}
@@ -757,7 +761,7 @@ static gboolean button_cb(GtkWidget *widget, GdkEventButton *event, gpointer dat
SetPVector(rb->recovered, rb->pList[v][i], v);
evaluate_vectors(rec);
render_sector(rec);
SetLabelText(GTK_LABEL(rec->rightLabel),
GuiSetLabelText(rec->rightLabel,
_("Exchanged P vector %d with version %d (of %d)."),
v, i+1, rb->pn[v]);
rec->lastPFrame = i;
@@ -779,7 +783,7 @@ static gboolean button_cb(GtkWidget *widget, GdkEventButton *event, gpointer dat
ByteIndexToQ(bytepos, &v, &ignore);
if(!rb->qn[v])
{ SetLabelText(GTK_LABEL(rec->rightLabel),
{ GuiSetLabelText(rec->rightLabel,
_("no replacements for Q vector %d available"), v);
return TRUE;
}
@@ -793,7 +797,7 @@ static gboolean button_cb(GtkWidget *widget, GdkEventButton *event, gpointer dat
SetQVector(rb->recovered, rb->qList[v][i], v);
evaluate_vectors(rec);
render_sector(rec);
SetLabelText(GTK_LABEL(rec->rightLabel),
GuiSetLabelText(rec->rightLabel,
_("Exchanged Q vector %d with version %d (of %d)."),
v, i+1, rb->qn[v]);
rec->lastQFrame = i;
@@ -855,7 +859,7 @@ static void action_cb(GtkWidget *widget, gpointer data)
evaluate_vectors(rec);
render_sector(rec);
undo_remember(rec);
SetLabelText(GTK_LABEL(rec->rightLabel), _("Showing sample %d (of %d)."),
GuiSetLabelText(rec->rightLabel, _("Showing sample %d (of %d)."),
rec->currentSample, rec->rb->samplesRead);
break;
@@ -868,7 +872,7 @@ static void action_cb(GtkWidget *widget, gpointer data)
evaluate_vectors(rec);
render_sector(rec);
undo_remember(rec);
SetLabelText(GTK_LABEL(rec->rightLabel), _("Showing sample %d (of %d)."),
GuiSetLabelText(rec->rightLabel, _("Showing sample %d (of %d)."),
rec->currentSample, rec->rb->samplesRead);
break;
@@ -914,7 +918,7 @@ static void action_cb(GtkWidget *widget, gpointer data)
evaluate_vectors(rec);
render_sector(rec);
undo_remember(rec);
SetLabelText(GTK_LABEL(rec->rightLabel), _("Sector with lowest P failures selected."));
GuiSetLabelText(rec->rightLabel, _("Sector with lowest P failures selected."));
break;
case ACTION_SORT_BY_Q:
@@ -924,7 +928,7 @@ static void action_cb(GtkWidget *widget, gpointer data)
evaluate_vectors(rec);
render_sector(rec);
undo_remember(rec);
SetLabelText(GTK_LABEL(rec->rightLabel), _("Sector with lowest Q failures selected."));
GuiSetLabelText(rec->rightLabel, _("Sector with lowest Q failures selected."));
break;
case ACTION_SMART_LEC:
@@ -935,8 +939,7 @@ static void action_cb(GtkWidget *widget, gpointer data)
evaluate_vectors(rec);
render_sector(rec);
undo_remember(rec);
SetLabelText(GTK_LABEL(rec->rightLabel),
_("Smart L-EC: %s"), message);
GuiSetLabelText(rec->rightLabel, _("Smart L-EC: %s"), message);
break;
}
}
@@ -946,7 +949,7 @@ static void action_cb(GtkWidget *widget, gpointer data)
*** Raw sector editor widget creation
***/
void CreateRawEditor(void)
void GuiCreateRawEditor(void)
{ raw_editor_context *rec = NULL;
rec = create_raw_editor_context();
@@ -1130,3 +1133,4 @@ void CreateRawEditor(void)
gtk_widget_show_all(GTK_WIDGET(rec->window));
}
#endif /* WITH_GUI_YES */

View File

@@ -20,6 +20,8 @@
* along with dvdisaster. If not, see <http://www.gnu.org/licenses/>.
*/
/*** src type: no GUI code ***/
#include "dvdisaster.h"
/*
@@ -193,14 +195,7 @@ int SaveDefectiveSector(RawBuffer *rb, int can_c2_scan)
(long long)rb->lba);
if(!LargeStat(filename, &length))
{
PrintCLIorLabel(
#ifndef WITH_CLI_ONLY_YES
Closure->status,
#else
NULL,
#endif
_(" [Creating new cache file %s]\n"), filename);
{ PrintCLIorLabel(Closure->status,_(" [Creating new cache file %s]\n"), filename);
init_defective_sector_file(filename, rb, &file, dsh);
}
else
@@ -271,12 +266,7 @@ int SaveDefectiveSector(RawBuffer *rb, int can_c2_scan)
LargeClose(file);
PrintCLIorLabel(
#ifndef WITH_CLI_ONLY_YES
Closure->status,
#else
NULL,
#endif
PrintCLIorLabel(Closure->status,
_(" [Appended %d/%d sectors to cache file %s; LBA=%" PRId64 ", ssize=%d, %d sectors]\n"),
count, rb->samplesRead, filename, dsh->lba, dsh->sectorSize, dsh->nSectors);
@@ -325,13 +315,7 @@ int TryDefectiveSectorCache(RawBuffer *rb, unsigned char *outbuf)
status = TryCDFrameRecovery(rb, outbuf);
if(!status)
{
PrintCLIorLabel(
#ifndef WITH_CLI_ONLY_YES
Closure->status,
#else
NULL,
#endif
{ PrintCLIorLabel(Closure->status,
" [Success after processing cached sector %d]\n", i+1);
return status;
}

View File

@@ -19,10 +19,13 @@
* You should have received a copy of the GNU General Public License
* along with dvdisaster. If not, see <http://www.gnu.org/licenses/>.
*/
// DVDISASTER_GUI_FILE
/*** src type: only GUI code ***/
#include "dvdisaster.h"
#ifdef WITH_GUI_YES
/***
*** Spiral drawing and updating
***/
@@ -42,7 +45,7 @@ static int draw_text(GdkDrawable *d, PangoLayout *l, char *text, int x, int y, G
int w,h,pw;
int erase_to = Closure->readAdaptiveSpiral->mx - Closure->readAdaptiveSpiral->diameter/2;
SetText(l, text, &w, &h);
GuiSetText(l, text, &w, &h);
pw = erase_to-x;
if(pw > pixmap_width || h > pixmap_height)
@@ -141,7 +144,7 @@ static void redraw_labels(GtkWidget *widget, int erase_mask)
if(Closure->readAdaptiveErrorMsg && erase_mask & REDRAW_ERRORMSG)
{ gdk_gc_set_rgb_fg_color(Closure->drawGC, footer_color);
SetText(Closure->readLinearCurve->layout, Closure->readAdaptiveErrorMsg, &w, &h);
GuiSetText(Closure->readLinearCurve->layout, Closure->readAdaptiveErrorMsg, &w, &h);
y = Closure->readAdaptiveSpiral->my + Closure->readAdaptiveSpiral->diameter/2 - h;
gdk_draw_layout(d, Closure->drawGC, x, y, Closure->readLinearCurve->layout);
}
@@ -149,7 +152,7 @@ static void redraw_labels(GtkWidget *widget, int erase_mask)
static void redraw_spiral(GtkWidget *widget)
{
DrawSpiral(Closure->readAdaptiveSpiral);
GuiDrawSpiral(Closure->readAdaptiveSpiral);
}
/* Calculate the geometry of the spiral */
@@ -165,7 +168,7 @@ static void update_geometry(GtkWidget *widget)
static gboolean expose_cb(GtkWidget *widget, GdkEventExpose *event, gpointer data)
{
SetSpiralWidget(Closure->readAdaptiveSpiral, widget);
GuiSetSpiralWidget(Closure->readAdaptiveSpiral, widget);
if(event->count) /* Exposure compression */
return TRUE;
@@ -193,7 +196,7 @@ static gboolean clip_idle_func(gpointer data)
spiral->segmentClipping = spiral->segmentCount;
for(i=clipping; i < spiral->segmentCount; i++)
DrawSpiralSegment(spiral, Closure->background, i);
GuiDrawSpiralSegment(spiral, Closure->background, i);
spiral->outline = outline;
spiral->segmentClipping = clipping;
@@ -201,13 +204,13 @@ static gboolean clip_idle_func(gpointer data)
/* Now redraw the last turn */
for(i=ADAPTIVE_READ_SPIRAL_SIZE-300; i<=clipping; i++)
DrawSpiralSegment(spiral, Closure->background, i);
GuiDrawSpiralSegment(spiral, Closure->background, i);
}
return FALSE;
}
void ClipReadAdaptiveSpiral(int segments)
void GuiClipReadAdaptiveSpiral(int segments)
{
Closure->readAdaptiveSpiral->segmentClipping = segments;
@@ -227,14 +230,14 @@ static gboolean segment_idle_func(gpointer data)
{ int segment = GPOINTER_TO_INT(data);
segment-=100;
DrawSpiralSegment(Closure->readAdaptiveSpiral,
Closure->readAdaptiveSpiral->segmentColor[segment],
segment);
GuiDrawSpiralSegment(Closure->readAdaptiveSpiral,
Closure->readAdaptiveSpiral->segmentColor[segment],
segment);
return FALSE;
}
void ChangeSegmentColor(GdkColor *color, int segment)
void GuiChangeSegmentColor(GdkColor *color, int segment)
{
Closure->readAdaptiveSpiral->segmentColor[segment] = color;
if(Closure->readAdaptiveSpiral->cursorPos == segment)
@@ -252,12 +255,12 @@ static gboolean remove_fill_idle_func(gpointer data)
for(i=0; i<spiral->segmentCount; i++)
if(spiral->segmentColor[i] == Closure->whiteSector)
DrawSpiralSegment(spiral, Closure->background, i);
GuiDrawSpiralSegment(spiral, Closure->background, i);
return FALSE;
}
void RemoveFillMarkers()
void GuiRemoveFillMarkers()
{
g_idle_add(remove_fill_idle_func, NULL);
}
@@ -274,8 +277,11 @@ static gboolean label_redraw_idle_func(gpointer data)
return FALSE;
}
void SetAdaptiveReadSubtitle(char *title)
void GuiSetAdaptiveReadSubtitle(char *title)
{
if(!Closure->guiMode)
return;
if(Closure->readAdaptiveSubtitle)
g_free(Closure->readAdaptiveSubtitle);
@@ -284,8 +290,11 @@ void SetAdaptiveReadSubtitle(char *title)
g_idle_add(label_redraw_idle_func, GINT_TO_POINTER(REDRAW_SUBTITLE));
}
void SetAdaptiveReadFootline(char *msg, GdkColor *color)
void GuiSetAdaptiveReadFootline(char *msg, GdkColor *color)
{
if(!Closure->guiMode)
return;
if(Closure->readAdaptiveErrorMsg)
g_free(Closure->readAdaptiveErrorMsg);
@@ -295,12 +304,15 @@ void SetAdaptiveReadFootline(char *msg, GdkColor *color)
g_idle_add(label_redraw_idle_func, GINT_TO_POINTER(REDRAW_ERRORMSG));
}
void UpdateAdaptiveResults(gint64 r, gint64 c, gint64 m, int p)
void GuiUpdateAdaptiveResults(gint64 r, gint64 c, gint64 m, int p)
{ readable = r;
correctable = c;
missing = m;
percent = p;
if(!Closure->guiMode)
return;
g_idle_remove_by_data(GINT_TO_POINTER(REDRAW_PROGRESS));
g_idle_add(label_redraw_idle_func, GINT_TO_POINTER(REDRAW_PROGRESS));
}
@@ -309,8 +321,8 @@ void UpdateAdaptiveResults(gint64 r, gint64 c, gint64 m, int p)
*** Reset the notebook contents for new read action
***/
void ResetAdaptiveReadWindow()
{ FillSpiral(Closure->readAdaptiveSpiral, Closure->background);
void GuiResetAdaptiveReadWindow()
{ GuiFillSpiral(Closure->readAdaptiveSpiral, Closure->background);
// DrawSpiral(Closure->readAdaptiveSpiral);
if(Closure->readAdaptiveSubtitle)
@@ -342,7 +354,7 @@ void ResetAdaptiveReadWindow()
* Set the minimum required data recovery value
*/
void SetAdaptiveReadMinimumPercentage(int value)
void GuiSetAdaptiveReadMinimumPercentage(int value)
{ min_required = value;
}
@@ -350,7 +362,7 @@ void SetAdaptiveReadMinimumPercentage(int value)
*** Create the notebook contents for the reading and scanning action
***/
void CreateAdaptiveReadWindow(GtkWidget *parent)
void GuiCreateAdaptiveReadWindow(GtkWidget *parent)
{ GtkWidget *sep,*d_area;
Closure->readAdaptiveHeadline = gtk_label_new(NULL);
@@ -369,9 +381,10 @@ void CreateAdaptiveReadWindow(GtkWidget *parent)
gtk_box_pack_start(GTK_BOX(parent), d_area, TRUE, TRUE, 0);
g_signal_connect(G_OBJECT(d_area), "expose_event", G_CALLBACK(expose_cb), NULL);
Closure->readAdaptiveSpiral = CreateSpiral(Closure->grid, Closure->background, 10, 5,
ADAPTIVE_READ_SPIRAL_SIZE);
Closure->readAdaptiveSpiral
= GuiCreateSpiral(Closure->grid, Closure->background, 10, 5,
ADAPTIVE_READ_SPIRAL_SIZE);
gtk_widget_set_size_request(d_area, -1, Closure->readAdaptiveSpiral->diameter);
}
#endif /* WITH_GUI_YES */

View File

@@ -1,6 +1,6 @@
/* dvdisaster: Additional error correction for optical media.
* Copyright (C) 2004-2017 Carsten Gnoerlich.
* Copyright (C) 2019-2021 The dvdisaster development team.
* Copyright (C) 2019-2021 The readdvdisaster development team.
*
* Email: support@dvdisaster.org
*
@@ -20,6 +20,8 @@
* along with dvdisaster. If not, see <http://www.gnu.org/licenses/>.
*/
/*** src type: some GUI code ***/
#include "dvdisaster.h"
#include "scsi-layer.h"
@@ -368,14 +370,12 @@ static void cleanup(gpointer data)
}
bail_out:
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
{ if(rc->earlyTermination)
SetAdaptiveReadFootline(_("Aborted by unrecoverable error."), Closure->redText);
AllowActions(TRUE);
{ GuiSetAdaptiveReadFootline(_("Aborted by unrecoverable error."), Closure->redText);
}
GuiAllowActions(TRUE);
}
#endif
if(rc->image)
if(!LargeClose(rc->image))
@@ -401,7 +401,7 @@ bail_out:
g_free(rc);
#ifndef WITH_CLI_ONLY_YES
#ifdef WITH_GUI_YES
if(Closure->guiMode)
g_thread_exit(0);
#endif
@@ -490,10 +490,8 @@ static void print_progress(read_closure *rc, int immediate)
int total = rc->readable+rc->correctable;
int percent = (int)((1000LL*(long long)total)/rc->expectedSectors);
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
return;
#endif
if( rc->lastPercent >= percent
&& rc->lastCorrectable == rc->correctable
@@ -541,12 +539,7 @@ static void print_progress(read_closure *rc, int immediate)
static void clear_progress(read_closure *rc)
{
if(!rc->progressMsgLen ||
#ifndef WITH_CLI_ONLY_YES
Closure->guiMode)
#else
0)
#endif
if(!rc->progressMsgLen || Closure->guiMode)
return;
rc->progressSp[rc->progressMsgLen] = 0;
@@ -564,7 +557,9 @@ static void clear_progress(read_closure *rc)
* Sector markup in the spiral
*/
#ifndef WITH_CLI_ONLY_YES
#ifdef WITH_GUI_NO
#define mark_sector(r, s, c)
#else
static void mark_sector(read_closure *rc, gint64 sector, GdkColor *color)
{ int segment;
int changed = FALSE;
@@ -599,18 +594,19 @@ static void mark_sector(read_closure *rc, gint64 sector, GdkColor *color)
}
if(new != old)
{ ChangeSegmentColor(color, segment);
{ GuiChangeSegmentColor(color, segment);
changed = TRUE;
}
}
else changed = TRUE;
if(changed)
UpdateAdaptiveResults(rc->readable, rc->correctable,
rc->expectedSectors-rc->readable-rc->correctable,
(int)((1000LL*(rc->readable+rc->correctable))/rc->expectedSectors));
{ GuiUpdateAdaptiveResults(rc->readable, rc->correctable,
rc->expectedSectors-rc->readable-rc->correctable,
(int)((1000LL*(rc->readable+rc->correctable))/rc->expectedSectors));
}
}
#endif
#endif /* WITH_GUI_YES */
/***
*** Basic device and image handling and sanity checks.
@@ -653,10 +649,7 @@ static void open_and_determine_mode(read_closure *rc)
rc->rs01LayerSectors = (rc->ei->sectors+rc->eh->dataBytes-1)/rc->eh->dataBytes;
PrintLog(_("%s-type ECC found\n"), "RS01");
#ifndef WITH_CLI_ONLY_YES
SetAdaptiveReadMinimumPercentage((1000*(rc->eh->dataBytes-rc->eh->eccBytes))/rc->eh->dataBytes);
#endif
GuiSetAdaptiveReadMinimumPercentage((1000*(rc->eh->dataBytes-rc->eh->eccBytes))/rc->eh->dataBytes);
}
else /* see if we have RS02 type ecc */
if(rc->medium->eccHeader && !strncmp((char*)rc->medium->eccHeader->method,"RS02",4))
@@ -664,16 +657,14 @@ static void open_and_determine_mode(read_closure *rc)
rc->eh = rc->medium->eccHeader;
rc->lay = RS02LayoutFromImage(rc->medium);
#ifndef WITH_CLI_ONLY_YES
SetAdaptiveReadMinimumPercentage((1000*rc->lay->ndata)/255);
#endif
GuiSetAdaptiveReadMinimumPercentage((1000*rc->lay->ndata)/255);
PrintLog(_("%s-type ECC found\n"), "RS02");
if(Closure->version < rc->eh->neededVersion)
PrintCLI(_("* Warning: This image requires dvdisaster-%d.%d!\n"
"* Proceeding could trigger incorrect behaviour.\n"
"* Please visit http://www.dvdisaster.org for an upgrade.\n\n"),
"* Please upgrade dvdisaster.\n\n"),
rc->eh->neededVersion/10000,
(rc->eh->neededVersion%10000)/100);
@@ -699,18 +690,15 @@ static void open_and_determine_mode(read_closure *rc)
if(rc->medium->eccHeader && !strncmp((char*)rc->medium->eccHeader->method,"RS03",4))
{ int answer;
PrintLog(_("%s-type ECC found\n"), "RS03");
answer = ModalWarningOrCLI(GTK_MESSAGE_WARNING, GTK_BUTTONS_OK_CANCEL, NULL, "%s",
answer = ModalWarning(GTK_MESSAGE_WARNING, GTK_BUTTONS_OK_CANCEL, NULL,
_("Adaptive reading has not been adapted yet to handle RS03-augmented images properly.\n"
"To quote the original author: \"behaviour with RS03 is unpredictable and undefined\".\n"
"You should cancel and use the linear reading strategy instead. Continue at your own risk.\n"));
if(!answer)
{
#ifndef WITH_CLI_ONLY_YES
SetAdaptiveReadFootline(_("Aborted by user request!"), Closure->redText);
#endif
rc->earlyTermination = FALSE;
cleanup((gpointer)rc);
{ GuiSetAdaptiveReadFootline(_("Aborted by user request!"), Closure->redText);
rc->earlyTermination = FALSE;
cleanup((gpointer)rc);
}
}
@@ -757,10 +745,9 @@ static void check_size(read_closure *rc)
/* Compare size with answer from drive */
if(rc->sectors < rc->dh->sectors)
{
int answer;
{ int answer;
answer = ModalWarningOrCLI(GTK_MESSAGE_WARNING, GTK_BUTTONS_OK_CANCEL, NULL,
answer = ModalWarning(GTK_MESSAGE_WARNING, GTK_BUTTONS_OK_CANCEL, NULL,
_("Medium contains %" PRId64 " sectors more as recorded in the .ecc file\n"
"(Medium: %" PRId64 " sectors; expected from .ecc file: %" PRId64 " sectors).\n"
"Only the first %" PRId64 " medium sectors will be processed.\n"),
@@ -768,29 +755,22 @@ static void check_size(read_closure *rc)
rc->sectors);
if(!answer)
{
#ifndef WITH_CLI_ONLY_YES
SetAdaptiveReadFootline(_("Aborted by user request!"), Closure->redText);
#endif
{ GuiSetAdaptiveReadFootline(_("Aborted by user request!"), Closure->redText);
rc->earlyTermination = FALSE;
cleanup((gpointer)rc);
}
}
if(rc->sectors > rc->dh->sectors)
{
int answer;
{ int answer;
answer = ModalWarningOrCLI(GTK_MESSAGE_WARNING, GTK_BUTTONS_OK_CANCEL, NULL,
answer = ModalWarning(GTK_MESSAGE_WARNING, GTK_BUTTONS_OK_CANCEL, NULL,
_("Medium contains %" PRId64 " sectors less as recorded in the .ecc file\n"
"(Medium: %" PRId64 " sectors; expected from .ecc file: %" PRId64 " sectors).\n"),
rc->sectors - rc->dh->sectors, rc->dh->sectors, rc->sectors);
if(!answer)
{
#ifndef WITH_CLI_ONLY_YES
SetAdaptiveReadFootline(_("Aborted by user request!"), Closure->redText);
#endif
{ GuiSetAdaptiveReadFootline(_("Aborted by user request!"), Closure->redText);
rc->earlyTermination = FALSE;
cleanup((gpointer)rc);
}
@@ -807,14 +787,10 @@ void GetReadingRange(gint64 sectors, gint64 *firstSector, gint64 *lastSector)
{ gint64 first, last;
if(Closure->readStart || Closure->readEnd)
{
#ifndef WITH_CLI_ONLY_YES
if(!Closure->guiMode) /* more range checks are made below */
#endif
{ if(!Closure->guiMode) /* more range checks are made below */
{ first = Closure->readStart;
last = Closure->readEnd < 0 ? sectors-1 : Closure->readEnd;
}
#ifndef WITH_CLI_ONLY_YES
else /* be more permissive in GUI mode */
{ first = 0;
last = sectors-1;
@@ -824,7 +800,6 @@ void GetReadingRange(gint64 sectors, gint64 *firstSector, gint64 *lastSector)
last = Closure->readEnd < sectors ? Closure->readEnd : sectors-1;
}
}
#endif
if(first > last || first < 0 || last >= sectors)
Stop(_("Sectors must be in range [0..%" PRId64 "].\n"), sectors-1);
@@ -851,19 +826,15 @@ static void check_ecc_fingerprint(read_closure *rc)
fp_read = GetImageFingerprint(rc->medium, digest, rc->eh->fpSector);
if(!fp_read) /* Not readable. Bad luck. */
{
int answer;
{ int answer;
answer = ModalWarningOrCLI(GTK_MESSAGE_WARNING, GTK_BUTTONS_OK_CANCEL, NULL,
answer = ModalWarning(GTK_MESSAGE_WARNING, GTK_BUTTONS_OK_CANCEL, NULL,
_("Sector %d is missing. Can not compare medium and ecc fingerprints.\n"
"Double check that the medium and the ecc file belong together.\n"),
rc->eh->fpSector);
if(!answer)
{
#ifndef WITH_CLI_ONLY_YES
SetAdaptiveReadFootline(_("Aborted by user request!"), Closure->redText);
#endif
{ GuiSetAdaptiveReadFootline(_("Aborted by user request!"), Closure->redText);
rc->earlyTermination = FALSE;
cleanup((gpointer)rc);
}
@@ -911,18 +882,16 @@ int check_image_fingerprint(read_closure *rc)
if(memcmp(image_fp, medium_fp, 16))
{
#ifndef WITH_CLI_ONLY_YES
if(!Closure->guiMode)
#endif
Stop(_("Image file does not match the optical disc."));
#ifndef WITH_CLI_ONLY_YES
#ifdef WITH_GUI_YES
else
{ int answer = ConfirmImageDeletion(Closure->imageName);
{ int answer = GuiConfirmImageDeletion(Closure->imageName);
if(!answer)
{ rc->earlyTermination = FALSE;
SetAdaptiveReadFootline(_("Reading aborted. Please select a different image file."),
Closure->redText);
GuiSetAdaptiveReadFootline(_("Reading aborted. Please select a different image file."),
Closure->redText);
cleanup((gpointer)rc);
}
else
@@ -931,7 +900,7 @@ int check_image_fingerprint(read_closure *rc)
return TRUE; /* causes reopen of image in caller */
}
}
#endif
#endif /* WITH_GUI_YES */
}
return 0; /* okay */
@@ -945,20 +914,16 @@ int check_image_fingerprint(read_closure *rc)
void check_image_size(read_closure *rc, gint64 image_file_sectors)
{
if(image_file_sectors > rc->expectedSectors)
{
int answer;
{ int answer;
answer = ModalWarningOrCLI(GTK_MESSAGE_WARNING, GTK_BUTTONS_OK_CANCEL, NULL,
answer = ModalWarning(GTK_MESSAGE_WARNING, GTK_BUTTONS_OK_CANCEL, NULL,
_("Image file is %" PRId64 " sectors longer than inserted medium\n"
"(Image file: %" PRId64 " sectors; medium: %" PRId64 " sectors).\n"),
image_file_sectors-rc->expectedSectors,
image_file_sectors, rc->expectedSectors);
if(!answer)
{
#ifndef WITH_CLI_ONLY_YES
SetAdaptiveReadFootline(_("Aborted by user request!"), Closure->redText);
#endif
{ GuiSetAdaptiveReadFootline(_("Aborted by user request!"), Closure->redText);
rc->earlyTermination = FALSE;
cleanup((gpointer)rc);
}
@@ -976,15 +941,11 @@ static void load_crc_buf(read_closure *rc)
{
switch(rc->readMode)
{ case ECC_IN_FILE:
#ifndef WITH_CLI_ONLY_YES
SetAdaptiveReadSubtitle(_utf("Loading CRC data."));
#endif
GuiSetAdaptiveReadSubtitle(_utf("Loading CRC data."));
rc->crcBuf = GetCRCFromRS01_obsolete(rc->ei);
break;
case ECC_IN_IMAGE:
#ifndef WITH_CLI_ONLY_YES
SetAdaptiveReadSubtitle(_utf("Loading CRC data."));
#endif
GuiSetAdaptiveReadSubtitle(_utf("Loading CRC data."));
rc->crcBuf = GetCRCFromRS02_obsolete(rc->lay, rc->dh, rc->image);
break;
default:
@@ -1014,24 +975,19 @@ static void build_interval_from_image(read_closure *rc)
/*** Go through all sectors in the image file.
Check them for "dead sector markers"
and for checksum failures if ecc data is present. */
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
SetAdaptiveReadSubtitle(_("Analysing existing image file"));
#endif
GuiSetAdaptiveReadSubtitle(_("Analysing existing image file"));
for(s=0; s<=rc->highestWrittenSector; s++)
{ int n,percent;
/* Check for user interruption. */
#ifndef WITH_CLI_ONLY_YES
if(Closure->stopActions)
{ SetAdaptiveReadFootline(_("Aborted by user request!"), Closure->redText);
{ GuiSetAdaptiveReadFootline(_("Aborted by user request!"), Closure->redText);
rc->earlyTermination = FALSE;
cleanup((gpointer)rc);
}
#endif
/* Read the next sector */
@@ -1045,9 +1001,7 @@ static void build_interval_from_image(read_closure *rc)
if(current_missing)
{ int fixme=0;
#ifndef WITH_CLI_ONLY_YES
mark_sector(rc, s, Closure->redSector);
#endif
ExplainMissingSector(rc->buf, s, current_missing, SOURCE_IMAGE, &fixme);
}
@@ -1067,9 +1021,7 @@ static void build_interval_from_image(read_closure *rc)
make it missing due to the CRC failure. */
if(!current_missing)
{ current_missing = 1;
#ifndef WITH_CLI_ONLY_YES
mark_sector(rc, s, Closure->yellowSector);
#endif
}
}
@@ -1084,9 +1036,7 @@ static void build_interval_from_image(read_closure *rc)
if(rc->map)
SetBit(rc->map, s);
#ifndef WITH_CLI_ONLY_YES
mark_sector(rc, s, Closure->greenSector);
#endif
#ifdef CHECK_VISITED
rc->count[s]++;
@@ -1120,10 +1070,7 @@ static void build_interval_from_image(read_closure *rc)
percent = (100*s)/(rc->highestWrittenSector+1);
if(last_percent != percent)
{
#ifndef WITH_CLI_ONLY_YES
if(!Closure->guiMode)
#endif
{ if(!Closure->guiMode)
PrintProgress(_("Analysing existing image file: %2d%%"),percent);
last_percent = percent;
@@ -1151,11 +1098,8 @@ static void build_interval_from_image(read_closure *rc)
/*** Now that all readable sectors are known,
determine those which can already be corrected. */
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
SetAdaptiveReadSubtitle(_("Determining correctable sectors"));
#endif
GuiSetAdaptiveReadSubtitle(_("Determining correctable sectors"));
/* RS01 type error correction. */
if(rc->readMode == ECC_IN_FILE)
@@ -1186,9 +1130,7 @@ static void build_interval_from_image(read_closure *rc)
#ifdef CHECK_VISITED
rc->count[layer_idx]++;
#endif
#ifndef WITH_CLI_ONLY_YES
mark_sector(rc, layer_idx, Closure->greenSector);
#endif
}
layer_idx += rc->rs01LayerSectors;
@@ -1221,9 +1163,7 @@ static void build_interval_from_image(read_closure *rc)
&& !GetBit(rc->map, sector))
{ SetBit(rc->map, sector);
rc->correctable++;
#ifndef WITH_CLI_ONLY_YES
mark_sector(rc, sector, Closure->greenSector);
#endif
}
}
}
@@ -1238,13 +1178,10 @@ static void build_interval_from_image(read_closure *rc)
else PrintLog(_("Analysing existing image file: %" PRId64 " readable, %" PRId64 " still missing.\n"),
rc->readable, rc->expectedSectors-rc->readable-rc->correctable);
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
UpdateAdaptiveResults(rc->readable, rc->correctable,
rc->expectedSectors-rc->readable-rc->correctable,
(int)((1000LL*(rc->readable+rc->correctable))/rc->expectedSectors));
#endif
GuiUpdateAdaptiveResults(rc->readable, rc->correctable,
rc->expectedSectors-rc->readable-rc->correctable,
(int)((1000LL*(rc->readable+rc->correctable))/rc->expectedSectors));
// print_intervals(rc);
}
@@ -1267,16 +1204,12 @@ static void mark_rs02_headers(read_closure *rc)
while(hpos < end)
{ if(!GetBit(rc->map, hpos))
{ SetBit(rc->map, hpos);
#ifndef WITH_CLI_ONLY_YES
mark_sector(rc, hpos, Closure->greenSector);
#endif
rc->correctable++;
}
if(!GetBit(rc->map, hpos+1))
{ SetBit(rc->map, hpos+1);
#ifndef WITH_CLI_ONLY_YES
mark_sector(rc, hpos+1, Closure->greenSector);
#endif
rc->correctable++;
}
@@ -1288,7 +1221,7 @@ static void mark_rs02_headers(read_closure *rc)
*** Main routine for adaptive reading
***/
#ifndef WITH_CLI_ONLY_YES
#ifdef WITH_GUI_YES
static void insert_buttons(GtkDialog *dialog)
{
gtk_dialog_add_buttons(dialog,
@@ -1333,12 +1266,10 @@ void fill_gap(read_closure *rc)
t = g_strdup_printf(_("Filling image area [%" PRId64 "..%" PRId64 "]"),
firstUnwritten, rc->intervalStart-1);
clear_progress(rc);
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
{ SetAdaptiveReadSubtitle(t);
ChangeSpiralCursor(Closure->readAdaptiveSpiral, -1);
}
#endif
GuiSetAdaptiveReadSubtitle(t);
GuiChangeSpiralCursor(Closure->readAdaptiveSpiral, -1);
PrintCLI("%s", t);
g_free(t);
@@ -1364,51 +1295,43 @@ void fill_gap(read_closure *rc)
/* Check whether user hit the Stop button */
#ifndef WITH_CLI_ONLY_YES
if(Closure->stopActions)
{
if(Closure->guiMode)
SetAdaptiveReadFootline(_("Aborted by user request!"), Closure->redText);
GuiSetAdaptiveReadFootline(_("Aborted by user request!"), Closure->redText);
rc->earlyTermination = FALSE; /* suppress respective error message */
cleanup((gpointer)rc);
}
#endif
/* Cycle the progress animation */
if(j++ % 2000)
{ int seq = (j/2000)%10;
#ifndef WITH_CLI_ONLY_YES
if(!Closure->guiMode)
#endif
{ g_printf("%s", anim[seq]);
fflush(stdout);
}
}
/* Show progress in the spiral */
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
{ int segment = i / rc->sectorsPerSegment;
if(Closure->readAdaptiveSpiral->segmentColor[segment] == Closure->background)
ChangeSegmentColor(Closure->whiteSector, segment);
{ GuiChangeSegmentColor(Closure->whiteSector, segment);
}
}
#endif
}
PrintCLI(" \n");
rc->highestWrittenSector = rc->intervalStart-1;
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) /* remove temporary fill markers */
{ RemoveFillMarkers();
SetAdaptiveReadSubtitle(rc->subtitle);
{ GuiRemoveFillMarkers();
GuiSetAdaptiveReadSubtitle(rc->subtitle);
}
#endif
}
@@ -1463,20 +1386,18 @@ void ReadMediumAdaptive(gpointer data)
rc->earlyTermination = TRUE;
RegisterCleanup(_("Reading aborted"), cleanup, rc);
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
SetLabelText(GTK_LABEL(Closure->readAdaptiveHeadline), "<big>%s</big>\n<i>%s</i>",
_("Preparing for reading the medium image."),
_("Medium: not yet determined"));
#endif
GuiSetLabelText(Closure->readAdaptiveHeadline,
"<big>%s</big>\n<i>%s</i>",
_("Preparing for reading the medium image."),
_("Medium: not yet determined"));
/* Please note: Commenting the follwing Stop() out will provide
adaptive reading for RS01 and RS02, but behaviour with RS03
is unpredictable and undefined. Therefore feel free to re-enable
is unpredictable und undefined. Therefore feel free to re-enable
adaptive reading for your own use, but do not distibute such
binaries to unsuspecting users.
Adaptive reading will be re-introduced for all codecs
in one of the next versions. */
in version 0.79.11. */
/* Unofficial version addendum: we enable adaptative reading, but
we warn the user if we find RS03 data (see open_and_determine_mode()) */
@@ -1528,16 +1449,14 @@ void ReadMediumAdaptive(gpointer data)
/*** Initialize segment state counters (only in GUI mode) */
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
{ //rc->sectorsPerSegment = 1 + (rc->sectors / ADAPTIVE_READ_SPIRAL_SIZE);
rc->sectorsPerSegment = ((rc->expectedSectors+ADAPTIVE_READ_SPIRAL_SIZE-1) / ADAPTIVE_READ_SPIRAL_SIZE);
rc->segmentState = g_malloc0(ADAPTIVE_READ_SPIRAL_SIZE * sizeof(int));
// ClipReadAdaptiveSpiral(rc->sectors/rc->sectorsPerSegment);
ClipReadAdaptiveSpiral((rc->expectedSectors+rc->sectorsPerSegment-1)/rc->sectorsPerSegment);
GuiClipReadAdaptiveSpiral((rc->expectedSectors+rc->sectorsPerSegment-1)/rc->sectorsPerSegment);
}
#endif
/*** Initialize the interval list */
rc->intervals = g_malloc(8*sizeof(gint64));
@@ -1552,13 +1471,10 @@ reopen_image:
Stop(_("Can't open %s:\n%s"),Closure->imageName,strerror(errno));
PrintLog(_("Creating new %s image.\n"),Closure->imageName);
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
SetLabelText(GTK_LABEL(Closure->readAdaptiveHeadline),
"<big>%s</big>\n<i>%s</i>",
_("Reading new medium image."),
rc->dh->mediumDescr);
#endif
GuiSetLabelText(Closure->readAdaptiveHeadline,
"<big>%s</big>\n<i>%s</i>",
_("Reading new medium image."),
rc->dh->mediumDescr);
/* Mark RS02 header sectors as correctable. */
@@ -1574,13 +1490,10 @@ reopen_image:
else
{ int reopen;
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
SetLabelText(GTK_LABEL(Closure->readAdaptiveHeadline),
"<big>%s</big>\n<i>%s</i>",
_("Completing existing medium image."),
rc->dh->mediumDescr);
#endif
GuiSetLabelText(Closure->readAdaptiveHeadline,
"<big>%s</big>\n<i>%s</i>",
_("Completing existing medium image."),
rc->dh->mediumDescr);
/* Open the existing image file. */
@@ -1616,10 +1529,7 @@ reopen_image:
if(rc->readMode != IMAGE_ONLY)
{ PrintLog("%s", t);
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
SetAdaptiveReadFootline(t, Closure->greenText);
#endif
GuiSetAdaptiveReadFootline(t, Closure->greenText);
}
goto finished;
}
@@ -1637,10 +1547,7 @@ reopen_image:
/*** Read the medium image. */
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
SetAdaptiveReadSubtitle(rc->subtitle);
#endif
GuiSetAdaptiveReadSubtitle(rc->subtitle);
for(;;)
{ int cluster_mask = rc->dh->clusterSize-1;
@@ -1665,18 +1572,17 @@ reopen_image:
for(s=rc->intervalStart; s<=rc->intervalEnd; ) /* s is incremented elsewhere */
{ int nsectors,cnt;
#ifndef WITH_CLI_ONLY_YES
if(Closure->stopActions) /* somebody hit the Stop button */
{ if(Closure->guiMode)
SetAdaptiveReadFootline(_("Aborted by user request!"), Closure->redText);
{ GuiSetAdaptiveReadFootline(_("Aborted by user request!"), Closure->redText);
rc->earlyTermination = FALSE; /* suppress respective error message */
goto terminate;
}
if(Closure->guiMode)
ChangeSpiralCursor(Closure->readAdaptiveSpiral, s / rc->sectorsPerSegment);
#endif
/* avoid a division by zero */
if (Closure->guiMode)
{ GuiChangeSpiralCursor(Closure->readAdaptiveSpiral, s / rc->sectorsPerSegment);
}
/* Determine number of sectors to read. Read the next dh->clusterSize sectors
unless we're at the end of the interval or at a position which is
@@ -1723,28 +1629,26 @@ reread:
&& rc->dh->sense.sense_key
&& rc->dh->sense.sense_key != 3 && rc->dh->sense.sense_key != 5)
{
#ifndef WITH_CLI_ONLY_YES
int answer;
if(!Closure->guiMode)
#ifdef WITH_GUI_YES
int answer;
#endif
if(!Closure->guiMode)
Stop(_("Sector %" PRId64 ": %s\nCan not recover from above error.\n"
"Use the --ignore-fatal-sense option to override."),
s, GetLastSenseString(FALSE));
#ifndef WITH_CLI_ONLY_YES
answer = ModalDialog(GTK_MESSAGE_QUESTION, GTK_BUTTONS_NONE, insert_buttons,
_("Sector %" PRId64 ": %s\n\n"
"It may not be possible to recover from this error.\n"
"Should the reading continue and ignore this error?"),
s, GetLastSenseString(FALSE));
#ifdef WITH_GUI_YES
answer = GuiModalDialog(GTK_MESSAGE_QUESTION, GTK_BUTTONS_NONE, insert_buttons,
_("Sector %" PRId64 ": %s\n\n"
"It may not be possible to recover from this error.\n"
"Should the reading continue and ignore this error?"),
s, GetLastSenseString(FALSE));
if(answer == 2)
Closure->ignoreFatalSense = 2;
if(!answer)
{
SetAdaptiveReadFootline(_("Aborted by unrecoverable error."), Closure->redText);
{ GuiSetAdaptiveReadFootline(_("Aborted by unrecoverable error."), Closure->redText);
rc->earlyTermination = FALSE; /* suppress respective error message */
goto terminate;
}
@@ -1802,9 +1706,7 @@ reread:
Stop(_("Failed writing to sector %" PRId64 " in image [%s]: %s"),
b, "unv", strerror(errno));
#ifndef WITH_CLI_ONLY_YES
mark_sector(rc, b, Closure->yellowSector);
#endif
if(rc->highestWrittenSector < b)
rc->highestWrittenSector = b;
@@ -1821,9 +1723,7 @@ reread:
SetBit(rc->map, b);
rc->readable++;
#ifndef WITH_CLI_ONLY_YES
mark_sector(rc, b, Closure->greenSector);
#endif
if(rc->highestWrittenSector < b)
rc->highestWrittenSector = b;
@@ -1876,9 +1776,7 @@ reread:
&& !GetBit(rc->map, layer_idx))
{ SetBit(rc->map, layer_idx);
rc->correctable++;
#ifndef WITH_CLI_ONLY_YES
mark_sector(rc, layer_idx, Closure->greenSector);
#endif
#ifdef CHECK_VISITED
rc->count[layer_idx]++;
@@ -1921,9 +1819,7 @@ reread:
&& !GetBit(rc->map, sector))
{ SetBit(rc->map, sector);
rc->correctable++;
#ifndef WITH_CLI_ONLY_YES
mark_sector(rc, sector, Closure->greenSector);
#endif
fill_correctable_gap(rc, sector);
}
}
@@ -1948,10 +1844,9 @@ reread:
print_progress(rc, TRUE);
if(rc->readMode != IMAGE_ONLY)
{ PrintLog("%s", t);
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode && rc->ei)
SetAdaptiveReadFootline(t, Closure->foreground);
#endif
if(rc->ei)
{ GuiSetAdaptiveReadFootline(t, Closure->foreground);
}
}
if(Closure->eject)
LoadMedium(rc->dh, FALSE);
@@ -1963,20 +1858,10 @@ reread:
{ unsigned char buf[2048];
PrintCLI("\n");
if(nsectors>1) PrintCLIorLabel(
#ifndef WITH_CLI_ONLY_YES
Closure->status,
#else
NULL,
#endif
if(nsectors>1) PrintCLIorLabel(Closure->status,
_("Sectors %" PRId64 "-%" PRId64 ": %s\n"),
s, s+nsectors-1, GetLastSenseString(FALSE));
else PrintCLIorLabel(
#ifndef WITH_CLI_ONLY_YES
Closure->status,
#else
NULL,
#endif
else PrintCLIorLabel(Closure->status,
_("Sector %" PRId64 ": %s\n"),
s, GetLastSenseString(FALSE));
@@ -1996,9 +1881,7 @@ NULL,
Stop(_("Failed writing to sector %" PRId64 " in image [%s]: %s"),
s, "nds", strerror(errno));
#ifndef WITH_CLI_ONLY_YES
mark_sector(rc, s+i, Closure->redSector);
#endif
}
if(rc->highestWrittenSector < s+nsectors)
@@ -2093,12 +1976,10 @@ finished:
/* Force output of final results */
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
{ ChangeSpiralCursor(Closure->readAdaptiveSpiral, -1);
{ GuiChangeSpiralCursor(Closure->readAdaptiveSpiral, -1);
mark_sector(rc, 0, NULL);
}
#endif
/*** Summarize results. */
@@ -2114,10 +1995,7 @@ finished:
PrintLog(_("\n%s\n"
"(%" PRId64 " readable, %" PRId64 " correctable, %" PRId64 " still missing).\n"),
t, rc->readable, rc->correctable, rc->expectedSectors-total);
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
SetAdaptiveReadFootline(t, Closure->foreground);
#endif
GuiSetAdaptiveReadFootline(t, Closure->foreground);
g_free(t);
exitCode = EXIT_FAILURE;
@@ -2129,10 +2007,7 @@ finished:
{ if(rc->readable == rc->expectedSectors)
{ char *t = _("\nGood! All sectors have been read.\n");
PrintLog("%s", t);
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
SetAdaptiveReadFootline(t, Closure->foreground);
#endif
GuiSetAdaptiveReadFootline(t, Closure->foreground);
if(Closure->eject)
LoadMedium(rc->dh, FALSE);
}
@@ -2145,10 +2020,7 @@ finished:
"%2d.%1d%% of the image have been read (%" PRId64 " sectors).\n"),
t, percent/10, percent%10, rc->readable);
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
SetAdaptiveReadFootline(t, Closure->foreground);
#endif
GuiSetAdaptiveReadFootline(t, Closure->foreground);
g_free(t);
exitCode = EXIT_FAILURE;
}
@@ -2166,9 +2038,7 @@ finished:
rc->earlyTermination = FALSE;
#ifndef WITH_CLI_ONLY_YES
terminate:
#endif
cleanup((gpointer)rc);
}

View File

@@ -19,8 +19,10 @@
* You should have received a copy of the GNU General Public License
* along with dvdisaster. If not, see <http://www.gnu.org/licenses/>.
*/
// DVDISASTER_GUI_FILE
/*** src type: only GUI code ***/
#ifdef WITH_GUI_YES
#include "dvdisaster.h"
#include "read-linear.h"
@@ -52,10 +54,13 @@ static gboolean max_speed_idle_func(gpointer data)
return FALSE;
}
void InitializeCurve(void *rc_ptr, int max_rate, int can_c2)
void GuiInitializeCurve(void *rc_ptr, int max_rate, int can_c2)
{ read_closure *rc = (read_closure*)rc_ptr;
int i;
if(!Closure->guiMode)
return;
Closure->readLinearCurve->maxY = max_rate;
Closure->readLinearCurve->maxX = rc->image->dh->sectors/512;
Closure->readLinearCurve->logMaxY = C2_CLAMP_VALUE;
@@ -101,7 +106,7 @@ static gboolean curve_idle_func(gpointer data)
gtk_label_set_text(GTK_LABEL(Closure->readLinearSpeed), utf);
g_free(utf);
g_snprintf(buf, 80, _("Unreadable / skipped sectors: %" PRId64 ""), Closure->readErrors);
g_snprintf(buf, 80, _("Unreadable / skipped sectors: %" PRId64), Closure->readErrors);
utf = g_locale_to_utf8(buf, -1, NULL, NULL, NULL);
gtk_label_set_text(GTK_LABEL(Closure->readLinearErrors), utf);
@@ -111,11 +116,11 @@ static gboolean curve_idle_func(gpointer data)
for(i=rc->lastSegment; i<ci->percent; i++)
switch(Closure->readLinearCurve->ivalue[i])
{ case 0: DrawSpiralSegment(Closure->readLinearSpiral, Closure->blueSector, i); break;
case 1: DrawSpiralSegment(Closure->readLinearSpiral, Closure->greenSector, i); break;
case 2: DrawSpiralSegment(Closure->readLinearSpiral, Closure->redSector, i); break;
case 3: DrawSpiralSegment(Closure->readLinearSpiral, Closure->darkSector, i); break;
case 4: DrawSpiralSegment(Closure->readLinearSpiral, Closure->yellowSector, i); break;
{ case 0: GuiDrawSpiralSegment(Closure->readLinearSpiral, Closure->blueSector, i); break;
case 1: GuiDrawSpiralSegment(Closure->readLinearSpiral, Closure->greenSector, i); break;
case 2: GuiDrawSpiralSegment(Closure->readLinearSpiral, Closure->redSector, i); break;
case 3: GuiDrawSpiralSegment(Closure->readLinearSpiral, Closure->darkSector, i); break;
case 4: GuiDrawSpiralSegment(Closure->readLinearSpiral, Closure->yellowSector, i); break;
}
rc->lastSegment = ci->percent;
@@ -141,7 +146,7 @@ static gboolean curve_idle_func(gpointer data)
gdk_window_clear(Closure->readLinearDrawingArea->window);
redraw_curve();
rc->lastPlotted = ci->percent;
rc->lastPlottedY = CurveY(Closure->readLinearCurve, Closure->readLinearCurve->fvalue[ci->percent]);
rc->lastPlottedY = GuiCurveY(Closure->readLinearCurve, Closure->readLinearCurve->fvalue[ci->percent]);
g_free(ci);
g_mutex_lock(rc->rendererMutex);
rc->activeRenderers--;
@@ -151,14 +156,14 @@ static gboolean curve_idle_func(gpointer data)
/*** Draw the changed curve part */
x0 = CurveX(Closure->readLinearCurve, rc->lastPlotted);
y0 = CurveY(Closure->readLinearCurve, Closure->readLinearCurve->fvalue[rc->lastPlotted]);
x0 = GuiCurveX(Closure->readLinearCurve, rc->lastPlotted);
y0 = GuiCurveY(Closure->readLinearCurve, Closure->readLinearCurve->fvalue[rc->lastPlotted]);
if(rc->lastPlottedY) y0 = rc->lastPlottedY;
for(i=rc->lastPlotted+1; i<=ci->percent; i++)
{ gint x1 = CurveX(Closure->readLinearCurve, i);
gint y1 = CurveY(Closure->readLinearCurve, Closure->readLinearCurve->fvalue[i]);
gint l1 = CurveLogY(Closure->readLinearCurve, Closure->readLinearCurve->lvalue[i]);
{ gint x1 = GuiCurveX(Closure->readLinearCurve, i);
gint y1 = GuiCurveY(Closure->readLinearCurve, Closure->readLinearCurve->fvalue[i]);
gint l1 = GuiCurveLogY(Closure->readLinearCurve, Closure->readLinearCurve->lvalue[i]);
if(Closure->readLinearCurve->lvalue[i])
{ gdk_gc_set_rgb_fg_color(Closure->drawGC, Closure->logColor);
@@ -191,12 +196,12 @@ static gboolean curve_idle_func(gpointer data)
* Add one new data point
*/
void AddCurveValues(void *rc_ptr, int percent, int color, int c2)
void GuiAddCurveValues(void *rc_ptr, int percent, int color, int c2)
{ read_closure *rc = (read_closure*)rc_ptr;
curve_info *ci;
int i;
if(percent < 0 || percent > 1000)
if(!Closure->guiMode || percent < 0 || percent > 1000)
return;
ci = g_malloc(sizeof(curve_info));
@@ -240,18 +245,23 @@ void AddCurveValues(void *rc_ptr, int percent, int color, int c2)
static gboolean curve_mark_idle_func(gpointer data)
{
DrawSpiral(Closure->readLinearSpiral);
GuiDrawSpiral(Closure->readLinearSpiral);
return FALSE;
}
void MarkExistingSectors(void)
void GuiMarkExistingSectors(void)
{ int i;
int x = Closure->readLinearCurve->rightX + 20;
int x;
if(!Closure->guiMode)
return;
x = Closure->readLinearCurve->rightX + 20;
Closure->additionalSpiralColor = 3;
DrawSpiralLabel(Closure->readLinearSpiral, Closure->readLinearCurve->layout,
_("Already present"), Closure->darkSector, x, -1);
GuiDrawSpiralLabel(Closure->readLinearSpiral, Closure->readLinearCurve->layout,
_("Already present"), Closure->darkSector, x, -1);
for(i=0; i<1000; i++)
if(Closure->readLinearSpiral->segmentColor[i] == Closure->greenSector)
@@ -274,8 +284,8 @@ static void update_geometry(void)
/* Curve geometry */
UpdateCurveGeometry(Closure->readLinearCurve, "99x",
Closure->readLinearSpiral->diameter + 30);
GuiUpdateCurveGeometry(Closure->readLinearCurve, "99x",
Closure->readLinearSpiral->diameter + 30);
/* Spiral center */
@@ -285,7 +295,7 @@ static void update_geometry(void)
if(Closure->crcBuf && Closure->crcBuf->crcCached)
{ int w,h;
SetText(Closure->readLinearCurve->layout, _("Sectors with CRC errors"), &w, &h);
GuiSetText(Closure->readLinearCurve->layout, _("Sectors with CRC errors"), &w, &h);
Closure->readLinearSpiral->my -= h;
}
@@ -308,41 +318,41 @@ static void redraw_curve(void)
x = Closure->readLinearCurve->rightX + 20;
gdk_gc_set_rgb_fg_color(Closure->drawGC, Closure->curveColor);
SetText(Closure->readLinearCurve->layout, _("Medium state"), &w, &h);
GuiSetText(Closure->readLinearCurve->layout, _("Medium state"), &w, &h);
gdk_draw_layout(d, Closure->drawGC,
x,
Closure->readLinearCurve->topY - h - 5,
Closure->readLinearCurve->layout);
if(Closure->additionalSpiralColor == 0)
DrawSpiralLabel(Closure->readLinearSpiral, Closure->readLinearCurve->layout,
_("Not touched this time"), Closure->curveColor, x, -1);
GuiDrawSpiralLabel(Closure->readLinearSpiral, Closure->readLinearCurve->layout,
_("Not touched this time"), Closure->curveColor, x, -1);
if(Closure->additionalSpiralColor == 3)
DrawSpiralLabel(Closure->readLinearSpiral, Closure->readLinearCurve->layout,
_("Already present"), Closure->darkSector, x, -1);
GuiDrawSpiralLabel(Closure->readLinearSpiral, Closure->readLinearCurve->layout,
_("Already present"), Closure->darkSector, x, -1);
DrawSpiralLabel(Closure->readLinearSpiral, Closure->readLinearCurve->layout,
_("Successfully read"), Closure->greenSector, x, pos++);
GuiDrawSpiralLabel(Closure->readLinearSpiral, Closure->readLinearCurve->layout,
_("Successfully read"), Closure->greenSector, x, pos++);
if(Closure->crcBuf && Closure->crcBuf->crcCached)
DrawSpiralLabel(Closure->readLinearSpiral, Closure->readLinearCurve->layout,
_("Sectors with CRC errors"), Closure->yellowSector, x, pos++);
GuiDrawSpiralLabel(Closure->readLinearSpiral, Closure->readLinearCurve->layout,
_("Sectors with CRC errors"), Closure->yellowSector, x, pos++);
DrawSpiralLabel(Closure->readLinearSpiral, Closure->readLinearCurve->layout,
_("Unreadable / skipped"), Closure->redSector, x, pos++);
GuiDrawSpiralLabel(Closure->readLinearSpiral, Closure->readLinearCurve->layout,
_("Unreadable / skipped"), Closure->redSector, x, pos++);
DrawSpiral(Closure->readLinearSpiral);
GuiDrawSpiral(Closure->readLinearSpiral);
/* Redraw the curve */
RedrawAxes(Closure->readLinearCurve);
RedrawCurve(Closure->readLinearCurve, 1000);
GuiRedrawAxes(Closure->readLinearCurve);
GuiRedrawCurve(Closure->readLinearCurve, 1000);
}
static gboolean expose_cb(GtkWidget *widget, GdkEventExpose *event, gpointer data)
{
SetSpiralWidget(Closure->readLinearSpiral, widget);
GuiSetSpiralWidget(Closure->readLinearSpiral, widget);
if(event->count) /* Exposure compression */
return TRUE;
@@ -357,13 +367,13 @@ static gboolean expose_cb(GtkWidget *widget, GdkEventExpose *event, gpointer dat
*** Reset the notebook contents for new scan/read action
***/
void ResetLinearReadWindow()
void GuiResetLinearReadWindow()
{
gtk_notebook_set_current_page(GTK_NOTEBOOK(Closure->readLinearNotebook), 0);
ZeroCurve(Closure->readLinearCurve);
FillSpiral(Closure->readLinearSpiral, Closure->background);
DrawSpiral(Closure->readLinearSpiral);
GuiZeroCurve(Closure->readLinearCurve);
GuiFillSpiral(Closure->readLinearSpiral, Closure->background);
GuiDrawSpiral(Closure->readLinearSpiral);
}
/*
@@ -390,16 +400,16 @@ static gboolean redraw_idle_func(gpointer data)
return FALSE;
}
void RedrawReadLinearWindow(void)
{
g_idle_add(redraw_idle_func, NULL);
void GuiRedrawReadLinearWindow(void)
{ if(Closure->guiMode)
g_idle_add(redraw_idle_func, NULL);
}
/***
*** Create the notebook contents for the reading and scanning action
***/
void CreateLinearReadWindow(GtkWidget *parent)
void GuiCreateLinearReadWindow(GtkWidget *parent)
{ GtkWidget *sep,*ignore,*d_area,*notebook,*hbox;
Closure->readLinearHeadline = gtk_label_new(NULL);
@@ -441,7 +451,8 @@ void CreateLinearReadWindow(GtkWidget *parent)
ignore = gtk_label_new("footer_tab");
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), Closure->readLinearFootline, ignore);
Closure->readLinearCurve = CreateCurve(d_area, _("Speed"), "%dx", 1000, CURVE_MEGABYTES);
Closure->readLinearCurve = GuiCreateCurve(d_area, _("Speed"), "%dx", 1000, CURVE_MEGABYTES);
Closure->readLinearCurve->leftLogLabel = g_strdup(_("C2 errors"));
Closure->readLinearSpiral = CreateSpiral(Closure->grid, Closure->background, 10, 5, 1000);
Closure->readLinearSpiral = GuiCreateSpiral(Closure->grid, Closure->background, 10, 5, 1000);
}
#endif /* WITH_GUI_YES */

View File

@@ -20,6 +20,8 @@
* along with dvdisaster. If not, see <http://www.gnu.org/licenses/>.
*/
/*** src type: some GUI code ***/
#include "dvdisaster.h"
#include "read-linear.h"
@@ -57,14 +59,14 @@ static void send_eof(read_closure *rc)
static void cleanup(gpointer data)
{ read_closure *rc = (read_closure*)data;
#ifndef WITH_CLI_ONLY_YES
int i;
int renderers_left = TRUE;
#ifdef WITH_GUI_YES
int full_read = FALSE;
int aborted = rc->earlyTermination;
int scan_mode = rc->scanMode;
#endif
int i;
int renderers_left = TRUE;
/* Make sure that all spiral/curve render idle functions have finished.
They depend on some structures we are going to free now.
If Closure->stopActions == STOP_SHUTDOWN_ALL, the main thread is
@@ -72,11 +74,7 @@ static void cleanup(gpointer data)
idle functions. Executing the while loop would create a deadlock
in that case. */
while(renderers_left
#ifndef WITH_CLI_ONLY_YES
&& Closure->stopActions != STOP_SHUTDOWN_ALL
#endif
)
while(renderers_left && Closure->stopActions != STOP_SHUTDOWN_ALL)
{ g_mutex_lock(rc->rendererMutex);
if(rc->activeRenderers<=0)
renderers_left=FALSE;
@@ -112,21 +110,17 @@ static void cleanup(gpointer data)
/* Clean up reader thread */
#ifndef WITH_CLI_ONLY_YES
#ifdef WITH_GUI_YES
if(rc->image)
full_read = (rc->readOK == rc->image->dh->sectors && !Closure->crcErrors);
#endif
UnregisterCleanup();
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
{ if(rc->unreportedError)
SwitchAndSetFootline(Closure->readLinearNotebook, 1, Closure->readLinearFootline,
_("<span %s>Aborted by unrecoverable error.</span> %" PRId64 " sectors read, %" PRId64 " sectors unreadable/skipped so far."),
Closure->redMarkup, rc->readOK, Closure->readErrors);
}
#endif
if(rc->unreportedError)
GuiSwitchAndSetFootline(Closure->readLinearNotebook, 1, Closure->readLinearFootline,
_("<span %s>Aborted by unrecoverable error.</span> %" PRId64 " sectors read, %" PRId64 " sectors unreadable/skipped so far."),
Closure->redMarkup, rc->readOK, Closure->readErrors);
if(rc->readerImage)
if(!LargeClose(rc->readerImage))
@@ -173,30 +167,34 @@ static void cleanup(gpointer data)
/* Continue with ecc file creation after read.
NOTE: Images are NOT automatically augmented after a read. */
#ifndef WITH_CLI_ONLY_YES
#ifdef WITH_GUI_YES
if(Closure->readAndCreate && Closure->guiMode && !scan_mode && !aborted) /* General prerequisites */
{ if( !strncmp(Closure->methodName, "RS01", 4) /* codec prerequisites */
|| (!strncmp(Closure->methodName, "RS03", 4) && Closure->eccTarget == ECC_FILE) )
{ if(!full_read)
{ ModalDialog(GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, NULL,
_("Automatic error correction file creation\n"
"is only possible after a full reading pass.\n"));
AllowActions(TRUE);
{ GuiModalDialog(GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, NULL,
_("Automatic error correction file creation\n"
"is only possible after a full reading pass.\n"));
GuiAllowActions(TRUE);
}
else ContinueWithAction(ACTION_CREATE_CONT);
else GuiContinueWithAction(ACTION_CREATE_CONT);
}
else
{ GuiAllowActions(TRUE);
}
else AllowActions(TRUE);
}
else
if(Closure->guiMode)
AllowActions(TRUE);
{ if(Closure->guiMode)
{ GuiAllowActions(TRUE);
}
}
/* In GUI mode both the reader and worker are spawned sub threads;
however in CLI mode the reader is the main thread and must not be terminated. */
if(Closure->guiMode)
g_thread_exit(0);
#endif
#endif /* WITH_GUI_YES */
}
/***
@@ -211,23 +209,17 @@ static void register_reader(read_closure *rc)
{
if(rc->scanMode) /* Output messages differ in read and scan mode */
{ RegisterCleanup(_("Scanning aborted"), cleanup, rc);
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
SetLabelText(GTK_LABEL(Closure->readLinearHeadline),
"<big>%s</big>\n<i>%s</i>",
_("Scanning medium for read errors."),
_("Medium: not yet determined"));
#endif
GuiSetLabelText(Closure->readLinearHeadline,
"<big>%s</big>\n<i>%s</i>",
_("Scanning medium for read errors."),
_("Medium: not yet determined"));
}
else
{ RegisterCleanup(_("Reading aborted"), cleanup, rc);
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
SetLabelText(GTK_LABEL(Closure->readLinearHeadline),
"<big>%s</big>\n<i>%s</i>",
_("Preparing for reading the medium image."),
_("Medium: not yet determined"));
#endif
GuiSetLabelText(Closure->readLinearHeadline,
"<big>%s</big>\n<i>%s</i>",
_("Preparing for reading the medium image."),
_("Medium: not yet determined"));
}
}
@@ -252,34 +244,26 @@ static void determine_mode(read_closure *rc)
rc->msg = g_strdup(_("Scanning medium for read errors."));
PrintLog("%s\n", rc->msg);
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
{ if(rc->eccMethod)
SetLabelText(GTK_LABEL(Closure->readLinearHeadline),
"<big>%s</big>\n<i>- %s -</i>", rc->msg,
_("Reading CRC information"));
else
SetLabelText(GTK_LABEL(Closure->readLinearHeadline),
"<big>%s</big>\n<i>%s</i>", rc->msg, rc->image->dh->mediumDescr);
if(rc->eccMethod)
{ GuiSetLabelText(Closure->readLinearHeadline,
"<big>%s</big>\n<i>- %s -</i>", rc->msg,
_("Reading CRC information"));
}
else
{ GuiSetLabelText(Closure->readLinearHeadline,
"<big>%s</big>\n<i>%s</i>",
rc->msg, rc->image->dh->mediumDescr);
}
#endif
rc->readMarker = 0;
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
InitializeCurve(rc, rc->image->dh->maxRate, rc->image->dh->canC2Scan);
#endif
GuiInitializeCurve(rc, rc->image->dh->maxRate, rc->image->dh->canC2Scan);
return;
}
/*** If no image file exists, open a new one. */
#ifndef WITH_CLI_ONLY_YES
reopen_image:
#endif
if(!LargeStat(Closure->imageName, &image_size))
{
if(rc->msg) g_free(rc->msg);
@@ -291,25 +275,20 @@ reopen_image:
Stop(_("Can't open %s:\n%s"),Closure->imageName,strerror(errno));
PrintLog(_("Creating new %s image.\n"),Closure->imageName);
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
{ if(rc->eccMethod)
SetLabelText(GTK_LABEL(Closure->readLinearHeadline),
if(rc->eccMethod)
{ GuiSetLabelText(Closure->readLinearHeadline,
"<big>%s</big>\n<i>%s</i>", rc->msg,
_("Reading CRC information"));
else
SetLabelText(GTK_LABEL(Closure->readLinearHeadline),
"<big>%s</big>\n<i>%s</i>", rc->msg, rc->image->dh->mediumDescr);
}
#endif
else
{ GuiSetLabelText(Closure->readLinearHeadline,
"<big>%s</big>\n<i>%s</i>", rc->msg,
rc->image->dh->mediumDescr);
}
rc->rereading = FALSE;
rc->readMarker = 0;
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
InitializeCurve(rc, rc->image->dh->maxRate, rc->image->dh->canC2Scan);
#endif
GuiInitializeCurve(rc, rc->image->dh->maxRate, rc->image->dh->canC2Scan);
return;
}
@@ -354,20 +333,17 @@ reopen_image:
if(!unknown_fingerprint && memcmp(image_fp, medium_fp, 16))
{
#ifndef WITH_CLI_ONLY_YES
if(!Closure->guiMode)
#endif
Stop(_("Image file does not match the optical disc."));
#ifndef WITH_CLI_ONLY_YES
else
{ int answer = ConfirmImageDeletion(Closure->imageName);
{ int answer = GuiConfirmImageDeletion(Closure->imageName);
if(!answer)
{ rc->unreportedError = FALSE;
SwitchAndSetFootline(Closure->readLinearNotebook, 1, Closure->readLinearFootline,
_("<span %s>Reading aborted.</span> Please select a different image file."),
Closure->redMarkup);
cleanup((gpointer)rc);
GuiSwitchAndSetFootline(Closure->readLinearNotebook, 1, Closure->readLinearFootline,
_("<span %s>Reading aborted.</span> Please select a different image file."),
Closure->redMarkup);
cleanup((gpointer)rc);
}
else /* Start over with new file */
{ LargeClose(rc->readerImage);
@@ -376,7 +352,6 @@ reopen_image:
goto reopen_image;
}
}
#endif
}
/*** If the image is not complete yet, first aim to read the
@@ -388,25 +363,18 @@ reopen_image:
{ PrintLog(_("Completing image %s. Continuing with sector %" PRId64 ".\n"),
Closure->imageName, rc->readMarker);
rc->firstSector = rc->readMarker;
#ifndef WITH_CLI_ONLY_YES
Closure->additionalSpiralColor = 0; /* blue */
#endif
}
else
{ PrintLog(_("Completing image %s. Only missing sectors will be read.\n"), Closure->imageName);
#ifndef WITH_CLI_ONLY_YES
Closure->additionalSpiralColor = 3; /* dark green*/
#endif
}
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
SetLabelText(GTK_LABEL(Closure->readLinearHeadline),
"<big>%s</big>\n<i>%s</i>",rc->msg,rc->image->dh->mediumDescr);
GuiSetLabelText(Closure->readLinearHeadline,
"<big>%s</big>\n<i>%s</i>",
rc->msg,rc->image->dh->mediumDescr);
if(Closure->guiMode)
InitializeCurve(rc, rc->image->dh->maxRate, rc->image->dh->canC2Scan);
#endif
GuiInitializeCurve(rc, rc->image->dh->maxRate, rc->image->dh->canC2Scan);
}
/*
@@ -445,6 +413,19 @@ static void fill_gap(read_closure *rc)
static void prepare_crc_cache(read_closure *rc)
{
/*** Remove old cached CRC information.
The following policy holds for the CRC cache:
- scan/read and verify create the crc cache,
- but do not use cached information from previous run themselves;
e.g. existing caches are deleted here
- create uses cached information if it is available
- fix is agnostic about cached information */
if(Closure->crcBuf) /* release old cached information */
{ FreeCrcBuf(Closure->crcBuf);
Closure->crcBuf = NULL;
}
/*** Memory for the CRC32 sums is needed in two cases: */
/* a) We have suitable ecc data and want to compare CRC32sums
@@ -461,23 +442,16 @@ static void prepare_crc_cache(read_closure *rc)
PrintCLI("%s (%s) ... ",_("Reading CRC information from ecc data"),
method_name);
// FIXME: reuse CrcBuf and write respective message
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
SetLabelText(GTK_LABEL(Closure->readLinearHeadline),
GuiSetLabelText(Closure->readLinearHeadline,
"<big>%s</big>\n<i>%s</i>",
_("Reading CRC information from ecc data"),
rc->image->dh->mediumDescr);
#endif
if(rc->eccMethod->getCrcBuf)
{ Closure->crcBuf = rc->eccMethod->getCrcBuf(rc->image);
{
Closure->crcBuf = rc->eccMethod->getCrcBuf(rc->image);
Closure->crcBuf->crcCached = TRUE;
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
RedrawReadLinearWindow();
#endif
GuiRedrawReadLinearWindow();
/* Augmented image codecs provide the CRCs and md5sums for
the data portion, but not for the full image.
@@ -489,15 +463,13 @@ static void prepare_crc_cache(read_closure *rc)
else Closure->crcBuf = NULL;
if(rc->eccMethod->resetCksums)
{ rc->doChecksumsFromCodec = TRUE; // FIXME - remove?
{ rc->doChecksumsFromCodec = TRUE;
rc->eccMethod->resetCksums(rc->image);
}
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
SetLabelText(GTK_LABEL(Closure->readLinearHeadline),
"<big>%s</big>\n<i>%s</i>", rc->msg, rc->image->dh->mediumDescr);
#endif
GuiSetLabelText(Closure->readLinearHeadline,
"<big>%s</big>\n<i>%s</i>",
rc->msg, rc->image->dh->mediumDescr);
PrintCLI(_("done.\n"));
return;
}
@@ -506,7 +478,7 @@ static void prepare_crc_cache(read_closure *rc)
The image CRC32 and md5sum are calculated on the fly,
as they may be used for ecc creation later. */
Closure->crcBuf = CreateCrcBuf(rc->image); // FIXME: reuse, delete, ...
Closure->crcBuf = CreateCrcBuf(rc->image);
rc->doChecksumsFromImage = CRCBUF_UPDATE_ALL;
}
@@ -516,18 +488,14 @@ static void prepare_crc_cache(read_closure *rc)
static void prepare_timer(read_closure *rc)
{
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode && Closure->spinupDelay)
SwitchAndSetFootline(Closure->readLinearNotebook, 1, Closure->readLinearFootline,
_("Waiting %d seconds for drive to spin up...\n"), Closure->spinupDelay);
#endif
GuiSwitchAndSetFootline(Closure->readLinearNotebook, 1, Closure->readLinearFootline,
_("Waiting %d seconds for drive to spin up...\n"), Closure->spinupDelay);
SpinupDevice(rc->image->dh);
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode && Closure->spinupDelay)
SwitchAndSetFootline(Closure->readLinearNotebook, 0, Closure->readLinearFootline, "ignore");
#endif
GuiSwitchAndSetFootline(Closure->readLinearNotebook, 0, Closure->readLinearFootline, "ignore");
if(Closure->spinupDelay) /* eliminate initial seek time from timing */
ReadSectors(rc->image->dh, rc->alignedBuf[0]->buf, rc->firstSector, 1);
@@ -542,13 +510,12 @@ static void prepare_timer(read_closure *rc)
static void show_progress(read_closure *rc)
{ int percent;
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode && rc->lastErrorsPrinted != Closure->readErrors)
{ SetLabelText(GTK_LABEL(Closure->readLinearErrors),
_("Unreadable / skipped sectors: %" PRId64 ""), Closure->readErrors);
{ GuiSetLabelText(Closure->readLinearErrors,
_("Unreadable / skipped sectors: %" PRId64),
Closure->readErrors);
rc->lastErrorsPrinted = Closure->readErrors;
}
#endif
if(rc->readPos>rc->readMarker) rc->readMarker=rc->readPos;
percent = (1000*rc->readPos)/rc->image->dh->sectors;
@@ -561,24 +528,24 @@ static void show_progress(read_closure *rc)
if(rc->lastPercent != percent)
{ gulong ignore;
#ifndef WITH_CLI_ONLY_YES
#ifdef WITH_GUI_YES
int color;
if(Closure->guiMode)
ChangeSpiralCursor(Closure->readLinearSpiral, percent);
GuiChangeSpiralCursor(Closure->readLinearSpiral, percent);
#endif
if(rc->readOK <= rc->lastReadOK) /* nothing read since last sample? */
{ rc->speed = 0.0;
#ifndef WITH_CLI_ONLY_YES
#ifdef WITH_GUI_YES
if(Closure->readErrors - rc->previousReadErrors > 0)
color = 2;
else if(Closure->crcErrors - rc->previousCRCErrors > 0)
color = 4;
else color = Closure->additionalSpiralColor;
if(Closure->guiMode)
AddCurveValues(rc, percent, color, rc->maxC2);
GuiAddCurveValues(rc, percent, color, rc->maxC2);
#endif
rc->lastPercent = percent;
rc->lastSpeed = rc->speed;
@@ -590,25 +557,21 @@ static void show_progress(read_closure *rc)
{ double kb_read = (rc->readOK - rc->lastReadOK) * 2.0;
double elapsed = g_timer_elapsed(rc->speedTimer, &ignore);
double kb_sec = kb_read / elapsed;
#ifndef WITH_CLI_ONLY_YES
#ifdef WITH_GUI_YES
if(Closure->readErrors - rc->previousReadErrors > 0)
color = 2;
else if(Closure->crcErrors - rc->previousCRCErrors > 0)
color = 4;
else color = 1;
#endif
if(rc->firstSpeedValue)
{ rc->speed = kb_sec / rc->image->dh->singleRate;
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
{ AddCurveValues(rc, rc->lastPercent, color, rc->maxC2);
AddCurveValues(rc, percent, color, rc->maxC2);
}
#endif
GuiAddCurveValues(rc, rc->lastPercent, color, rc->maxC2);
GuiAddCurveValues(rc, percent, color, rc->maxC2);
rc->firstSpeedValue = FALSE;
rc->lastPercent = percent;
rc->lastSpeed = rc->speed;
@@ -630,10 +593,7 @@ static void show_progress(read_closure *rc)
cut_peaks=3;
}
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
AddCurveValues(rc, percent, color, rc->maxC2);
#endif
GuiAddCurveValues(rc, percent, color, rc->maxC2);
if(Closure->speedWarning && rc->lastSpeed > 0.5)
{ double delta = rc->speed - rc->lastSpeed;
@@ -781,9 +741,9 @@ update_mutex:
*** The reader part
***/
#ifndef WITH_CLI_ONLY_YES
#ifdef WITH_GUI_YES
static void insert_buttons(GtkDialog *dialog)
{
{
gtk_dialog_add_buttons(dialog,
_utf("Ignore once"), 1,
_utf("Ignore always"), 2,
@@ -795,6 +755,7 @@ void ReadMediumLinear(gpointer data)
{ read_closure *rc = g_malloc0(sizeof(read_closure));
int md5_failure = 0;
int unrecoverable_sectors = 0;
int corrupted_sectors = 0;
GError *err = NULL;
int nsectors;
char *t = NULL;
@@ -871,10 +832,12 @@ void ReadMediumLinear(gpointer data)
if(rc->eccHeader && (Closure->version < rc->eccHeader->neededVersion))
{
int answer;
#ifdef WITH_GUI_YES
if(Closure->guiMode)
{ int answer;
if(rc->image->eccFileState == ECCFILE_PRESENT)
answer = ModalWarningOrCLI(GTK_MESSAGE_WARNING, GTK_BUTTONS_OK_CANCEL, NULL,
answer = ModalWarning(GTK_MESSAGE_WARNING, GTK_BUTTONS_OK_CANCEL, NULL,
_("This ecc file requires dvdisaster-%d.%d!\n\n"
"Proceeding could trigger incorrect behaviour.\n"
"Please read the image without using this ecc file\n"
@@ -882,7 +845,7 @@ void ReadMediumLinear(gpointer data)
rc->eccHeader->neededVersion/10000,
(rc->eccHeader->neededVersion%10000)/100);
else
answer = ModalWarningOrCLI(GTK_MESSAGE_WARNING, GTK_BUTTONS_OK_CANCEL, NULL,
answer = ModalWarning(GTK_MESSAGE_WARNING, GTK_BUTTONS_OK_CANCEL, NULL,
_("This image requires dvdisaster-%d.%d!\n\n"
"Proceeding could trigger incorrect behaviour.\n"
"Please upgrade dvdisaster.\n\n"),
@@ -891,24 +854,36 @@ void ReadMediumLinear(gpointer data)
PrintCLI("\n");
if(!answer)
{
#ifndef WITH_CLI_ONLY_YES
SwitchAndSetFootline(Closure->readLinearNotebook, 1, Closure->readLinearFootline,
{ GuiSwitchAndSetFootline(Closure->readLinearNotebook, 1, Closure->readLinearFootline,
_("<span %s>Aborted by user request!</span> %" PRId64 " sectors read, %" PRId64 " sectors unreadable/skipped so far."),
Closure->redMarkup, rc->readOK,Closure->readErrors);
#endif
rc->unreportedError = FALSE; /* suppress respective error message */
goto terminate;
}
}
else
#endif /* WITH_GUI_YES */
{ if(rc->image->eccFileState == ECCFILE_PRESENT)
PrintCLI(_("* Warning: This ecc file requires dvdisaster-%d.%d!\n"
"* Proceeding could trigger incorrect behaviour.\n"
"* Please read the image without using this ecc file\n"
"* or upgrade dvdisaster.\n\n"),
rc->eccHeader->neededVersion/10000,
(rc->eccHeader->neededVersion%10000)/100);
else
PrintCLI(_("* Warning: This image requires dvdisaster-%d.%d!\n"
"* Proceeding could trigger incorrect behaviour.\n"
"* Please upgrade dvdisaster.\n\n"),
rc->eccHeader->neededVersion/10000,
(rc->eccHeader->neededVersion%10000)/100);
}
}
/*** See if user wants to limit the read range. */
GetReadingRange(rc->image->dh->sectors, &rc->firstSector, &rc->lastSector);
#ifndef WITH_CLI_ONLY_YES
if(rc->firstSector > 0) /* Mark skipped sectors */
Closure->additionalSpiralColor = 0; /* blue */
#endif
/*** Determine the reading mode. There are three possibilities:
1. scanning (rc->scanMode == TRUE)
@@ -973,10 +948,8 @@ next_reading_pass:
break;
}
Closure->sectorSkip = 0;
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
MarkExistingSectors();
#endif
GuiMarkExistingSectors();
rc->lastCopied = 0; /* Start rendering the spiral from the beginning */
}
@@ -993,18 +966,16 @@ next_reading_pass:
while(rc->readPos<=rc->lastSector)
{ int cluster_mask = rc->image->dh->clusterSize-1;
#ifndef WITH_CLI_ONLY_YES
if(Closure->stopActions) /* somebody hit the Stop button */
{
if(Closure->stopActions == STOP_CURRENT_ACTION) /* suppress memleak warning when closing window */
{ SwitchAndSetFootline(Closure->readLinearNotebook, 1, Closure->readLinearFootline,
_("<span %s>Aborted by user request!</span> %" PRId64 " sectors read, %" PRId64 " sectors unreadable/skipped so far."),
Closure->redMarkup, rc->readOK,Closure->readErrors);
{ GuiSwitchAndSetFootline(Closure->readLinearNotebook, 1, Closure->readLinearFootline,
_("<span %s>Aborted by user request!</span> %" PRId64 " sectors read, %" PRId64 " sectors unreadable/skipped so far."),
Closure->redMarkup, rc->readOK,Closure->readErrors);
}
rc->unreportedError = FALSE; /* suppress respective error message */
goto terminate;
}
#endif
/*** Decide between reading in fast mode (dh->clusterSize sectors at once)
or reading one sector at a time.
@@ -1056,13 +1027,19 @@ reread:
n = LargeRead(rc->readerImage, sector_buf, 2048);
if(n != 2048)
Stop(_("unexpected read error in image for sector %" PRId64 ""),rc->readPos);
Stop(_("unexpected read error in image for sector %" PRId64),rc->readPos);
err = CheckForMissingSector(sector_buf, rc->readPos+i,
rc->image->fpState == 2 ? rc->image->imageFP : NULL,
rc->image->fpSector);
#if 0 /* delete me: only explain missing sectors in the medium, not the image */
if(err != SECTOR_PRESENT)
ExplainMissingSector(sector_buf, rc->readPos+i, err, SOURCE_IMAGE, &unrecoverable_sectors);
else
#endif
if(err != SECTOR_PRESENT)
{ unrecoverable_sectors++;
}
else
{ if(!Closure->crcBuf
|| CheckAgainstCrcBuffer(Closure->crcBuf, rc->readPos+i, sector_buf) != CRC_BAD)
{ ok++; /* CRC unavailable or good */
@@ -1106,30 +1083,28 @@ reread:
if(status && !Closure->ignoreFatalSense
&& rc->image->dh->sense.sense_key && rc->image->dh->sense.sense_key != 3 && rc->image->dh->sense.sense_key != 5)
{
#ifndef WITH_CLI_ONLY_YES
int answer;
if(!Closure->guiMode)
#ifdef WITH_GUI_YES
int answer;
#endif
if(!Closure->guiMode)
Stop(_("Sector %" PRId64 ": %s\nCan not recover from above error.\n"
"Use the --ignore-fatal-sense option to override."),
rc->readPos, GetLastSenseString(FALSE));
#ifndef WITH_CLI_ONLY_YES
answer = ModalDialog(GTK_MESSAGE_QUESTION, GTK_BUTTONS_NONE, insert_buttons,
_("Sector %" PRId64 ": %s\n\n"
"It may not be possible to recover from this error.\n"
"Should the reading continue and ignore this error?"),
rc->readPos, GetLastSenseString(FALSE));
#ifdef WITH_GUI_YES
answer = GuiModalDialog(GTK_MESSAGE_QUESTION, GTK_BUTTONS_NONE, insert_buttons,
_("Sector %" PRId64 ": %s\n\n"
"It may not be possible to recover from this error.\n"
"Should the reading continue and ignore this error?"),
rc->readPos, GetLastSenseString(FALSE));
if(answer == 2)
Closure->ignoreFatalSense = 2;
if(!answer)
{
SwitchAndSetFootline(Closure->readLinearNotebook, 1, Closure->readLinearFootline,
_("<span %s>Aborted by user request!</span> %" PRId64 " sectors read, %" PRId64 " sectors unreadable/skipped so far."),
Closure->redMarkup, rc->readOK,Closure->readErrors);
{ GuiSwitchAndSetFootline(Closure->readLinearNotebook, 1, Closure->readLinearFootline,
_("<span %s>Aborted by user request!</span> %" PRId64 " sectors read, %" PRId64 " sectors unreadable/skipped so far."),
Closure->redMarkup, rc->readOK,Closure->readErrors);
rc->unreportedError = FALSE; /* suppress respective error message */
goto terminate;
}
@@ -1167,7 +1142,9 @@ reread:
rc->image->fpState == 2 ? rc->image->imageFP : NULL,
rc->image->fpSector);
if(err != SECTOR_PRESENT)
ExplainMissingSector(sector_buf+i*2048, rc->readPos+i, err, SOURCE_MEDIUM, &unrecoverable_sectors);
{ ExplainMissingSector(sector_buf+i*2048, rc->readPos+i, err, SOURCE_MEDIUM, &unrecoverable_sectors);
corrupted_sectors++; /* readable, but written corrupted */
}
}
}
@@ -1275,12 +1252,7 @@ reread:
if(Closure->sectorSkip && nsectors > 1)
{ int i;
PrintCLIorLabel(
#ifndef WITH_CLI_ONLY_YES
Closure->status,
#else
NULL,
#endif
PrintCLIorLabel(Closure->status,
_("Sector %" PRId64 ": %s Skipping %d sectors.\n"),
rc->readPos, GetLastSenseString(FALSE), nfill-1);
for(i=0; i<nfill; i++) /* workaround: large values for nfill */
@@ -1308,12 +1280,7 @@ NULL,
goto reread;
}
else
{ PrintCLIorLabel(
#ifndef WITH_CLI_ONLY_YES
Closure->status,
#else
NULL,
#endif
{ PrintCLIorLabel(Closure->status,
_("Sector %" PRId64 ": %s\n"),
rc->readPos, GetLastSenseString(FALSE));
if(rc->readPos >= rc->image->dh->sectors - 2) tao_tail++;
@@ -1336,11 +1303,10 @@ step_counter:
to checksum means we have ecc data - we can fix the image using ecc
rather than by re-reading it. */
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
ChangeSpiralCursor(Closure->readLinearSpiral, -1); /* switch cursor off */
#ifdef WITH_GUI_YES
GuiChangeSpiralCursor(Closure->readLinearSpiral, -1); /* switch cursor off */
#endif
rc->pass++;
rc->image->dh->pass = rc->pass;
@@ -1349,14 +1315,10 @@ step_counter:
&& rc->pass < Closure->readingPasses)
{ int renderers_left = TRUE;
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
SetLabelText(GTK_LABEL(Closure->readLinearHeadline),
_("<big>Trying to complete image, reading pass %d of %d.</big>\n%s"),
rc->pass+1, Closure->readingPasses, rc->image->dh->mediumDescr);
else
#endif
PrintCLI(_("\nTrying to complete image, reading pass %d of %d.\n"),
GuiSetLabelText(Closure->readLinearHeadline,
_("<big>Trying to complete image, reading pass %d of %d.</big>\n%s"),
rc->pass+1, Closure->readingPasses, rc->image->dh->mediumDescr);
PrintCLI(_("\nTrying to complete image, reading pass %d of %d.\n"),
rc->pass+1, Closure->readingPasses);
@@ -1400,7 +1362,13 @@ step_counter:
/* We were reading the image for the first time */
else /* not rereading */
{ /* Image was fully readable and had no CRC errors (if CRC was available at all!).
{ /* Image was fully readable, but contained some sectors marked as defective */
if(corrupted_sectors > 0 && !Closure->readErrors)
{ t = g_strdup_printf(_("All sectors are readable, but %d contain defective content."),
corrupted_sectors);
}
else
/* Image was fully readable and had no CRC errors (if CRC was available at all!).
So we had no faulty sectors, but ... */
if(!Closure->readErrors && !Closure->crcErrors)
{
@@ -1417,11 +1385,11 @@ step_counter:
if(!t)
{ if(rc->eccMethod) /* we had CRC sums to compare against */
{ if(rc->crcIncomplete)
t = g_strdup(_("All sectors successfully read, but incomplete or damaged checksums."));
else t = g_strdup(_("All sectors successfully read. Checksums match."));
}
else t = g_strdup(_("All sectors successfully read."));
{ if(rc->crcIncomplete)
t = g_strdup(_("All sectors successfully read, but incomplete or damaged checksums."));
else t = g_strdup(_("All sectors successfully read. Checksums match."));
}
else t = g_strdup(_("All sectors successfully read."));
}
}
else /* we have unreadable or damaged sectors */
@@ -1439,14 +1407,18 @@ step_counter:
}
PrintLog("\n%s\n",t);
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
{ if(rc->scanMode) SwitchAndSetFootline(Closure->readLinearNotebook, 1, Closure->readLinearFootline,
"%s%s",_("Scanning finished: "),t);
else SwitchAndSetFootline(Closure->readLinearNotebook, 1, Closure->readLinearFootline,
"%s%s",_("Reading finished: "),t);
{ if(rc->scanMode)
{ GuiSwitchAndSetFootline(Closure->readLinearNotebook,
1, Closure->readLinearFootline,
"%s%s",_("Scanning finished: "),t);
}
else
{ GuiSwitchAndSetFootline(Closure->readLinearNotebook,
1, Closure->readLinearFootline,
"%s%s",_("Reading finished: "),t);
}
}
#endif
if(t) g_free(t);
if(!Closure->fixedSpeedValues)
@@ -1455,22 +1427,32 @@ step_counter:
if(rc->image->dh->mainType == CD && tao_tail && tao_tail == Closure->readErrors && !Closure->noTruncate)
{ int answer;
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
answer = ModalWarningOrCLI(GTK_MESSAGE_WARNING, GTK_BUTTONS_OK_CANCEL, NULL,
answer = ModalWarning(GTK_MESSAGE_WARNING, GTK_BUTTONS_OK_CANCEL, NULL,
_("%d sectors missing at the end of the disc.\n"
"This is okay if the CD was written in TAO (track at once) mode.\n"
"The Image will be truncated accordingly. See the manual for details.\n"),
tao_tail);
else
#endif
answer = ModalWarningOrCLI(GTK_MESSAGE_WARNING, GTK_BUTTONS_OK_CANCEL, NULL,
"This is okay if the CD was written in TAO (track at once) mode.\n%s"),
tao_tail,
rc->scanMode
?
_("See the manual for details.\n")
:
_("The Image will be truncated accordingly. See the manual for details.\n")
);
else
{ answer = ModalWarning(GTK_MESSAGE_WARNING, GTK_BUTTONS_OK_CANCEL, NULL,
_("%d sectors missing at the end of the disc.\n"
"This is okay if the CD was written in TAO (track at once) mode.\n"
"The Image will be truncated accordingly. See the manual for details.\n"
"Use the --dao option to disable image truncating.\n"),
tao_tail);
"This is okay if the CD was written in TAO (track at once) mode.\n%s"),
tao_tail,
rc->scanMode
?
_("See the manual for details.\n"
"Use the --dao option to disable this message.\n")
:
_("The Image will be truncated accordingly. See the manual for details.\n"
"Use the --dao option to disable image truncating.\n")
);
}
if(!rc->scanMode && answer)
if(!LargeTruncate(rc->writerImage, (gint64)(2048*(rc->image->dh->sectors-tao_tail))))
Stop(_("Could not truncate %s: %s\n"),Closure->imageName,strerror(errno));

View File

@@ -20,6 +20,8 @@
* along with dvdisaster. If not, see <http://www.gnu.org/licenses/>.
*/
/*** src type: no GUI code ***/
#include "dvdisaster.h"
/*
@@ -475,7 +477,7 @@ static int simple_lec(RawBuffer *rb, unsigned char *frame, char *msg)
if(q_failures || p_failures || q_corrected || p_corrected)
{
PrintCLIorLabel(STATUS_LABEL_OR_NULL,
PrintCLIorLabel(Closure->status,
"Sector %" PRId64 " L-EC P/Q results: %d/%d failures, %d/%d corrected (%s).\n",
rb->lba, p_failures, q_failures, p_corrected, q_corrected, msg);
return 1;
@@ -557,7 +559,7 @@ int ValidateRawSector(RawBuffer *rb, unsigned char *frame, char *msg)
/* Tell user that L-EC succeeded */
if(lec_did_sth)
PrintCLIorLabel(STATUS_LABEL_OR_NULL,
PrintCLIorLabel(Closure->status,
"Sector %" PRId64 ": Recovered in raw reader by L-EC.\n",
rb->lba);
@@ -890,7 +892,7 @@ int TryCDFrameRecovery(RawBuffer *rb, unsigned char *outbuf)
if(CheckEDC(rb->recovered, rb->xaMode)
&& CheckMSF(rb->recovered, rb->lba, STRICT_MSF_CHECK))
{
PrintCLIorLabel(STATUS_LABEL_OR_NULL,
PrintCLIorLabel(Closure->status,
"Sector %" PRId64 ": Good. Data section passes EDC test.\n",
rb->lba);
memcpy(outbuf, rb->recovered+rb->dataOffset, 2048);
@@ -906,7 +908,7 @@ int TryCDFrameRecovery(RawBuffer *rb, unsigned char *outbuf)
if(CheckEDC(rb->recovered, rb->xaMode)
&& CheckMSF(rb->recovered, rb->lba, STRICT_MSF_CHECK))
{
PrintCLIorLabel(STATUS_LABEL_OR_NULL,
PrintCLIorLabel(Closure->status,
"Sector %" PRId64 ": Recovered in raw reader after correcting sync pattern.\n",
rb->lba);
@@ -923,7 +925,7 @@ int TryCDFrameRecovery(RawBuffer *rb, unsigned char *outbuf)
if(CheckEDC(rb->recovered, rb->xaMode)
&& CheckMSF(rb->recovered, rb->lba, STRICT_MSF_CHECK))
{
PrintCLIorLabel(STATUS_LABEL_OR_NULL,
PrintCLIorLabel(Closure->status,
"Sector %" PRId64 ": Recovered in raw reader by iterative L-EC.\n",
rb->lba);
@@ -946,8 +948,8 @@ int TryCDFrameRecovery(RawBuffer *rb, unsigned char *outbuf)
if(CheckEDC(rb->recovered, rb->xaMode)
&& CheckMSF(rb->recovered, rb->lba, STRICT_MSF_CHECK))
{ PrintCLIorLabel(STATUS_LABEL_OR_NULL,
"Sector %lld: Recovered in raw reader by smart L-EC.\n",
{ PrintCLIorLabel(Closure->status,
"Sector %" PRId64 ": Recovered in raw reader by smart L-EC.\n",
rb->lba);
memcpy(outbuf, rb->recovered+rb->dataOffset, 2048);
return 0;
@@ -958,7 +960,7 @@ int TryCDFrameRecovery(RawBuffer *rb, unsigned char *outbuf)
if(CheckEDC(rb->recovered, rb->xaMode)
&& CheckMSF(rb->recovered, rb->lba, STRICT_MSF_CHECK))
{ PrintCLIorLabel(STATUS_LABEL_OR_NULL,
{ PrintCLIorLabel(Closure->status,
"Sector %" PRId64 ": Recovered in raw reader by plausible sector search (0).\n",
rb->lba);
memcpy(outbuf, rb->recovered+rb->dataOffset, 2048);
@@ -969,7 +971,7 @@ int TryCDFrameRecovery(RawBuffer *rb, unsigned char *outbuf)
if(CheckEDC(rb->recovered, rb->xaMode)
&& CheckMSF(rb->recovered, rb->lba, STRICT_MSF_CHECK))
{ PrintCLIorLabel(STATUS_LABEL_OR_NULL,
{ PrintCLIorLabel(Closure->status,
"Sector %" PRId64 ": Recovered in raw reader by brute force plausible sector search (0).\n",
rb->lba);
memcpy(outbuf, rb->recovered+rb->dataOffset, 2048);
@@ -980,7 +982,7 @@ int TryCDFrameRecovery(RawBuffer *rb, unsigned char *outbuf)
if(CheckEDC(rb->recovered, rb->xaMode)
&& CheckMSF(rb->recovered, rb->lba, STRICT_MSF_CHECK))
{ PrintCLIorLabel(STATUS_LABEL_OR_NULL,
{ PrintCLIorLabel(Closure->status,
"Sector %" PRId64 ": Recovered in raw reader by mutual ack heuristic (0).\n",
rb->lba);
memcpy(outbuf, rb->recovered+rb->dataOffset, 2048);
@@ -991,7 +993,7 @@ int TryCDFrameRecovery(RawBuffer *rb, unsigned char *outbuf)
if(CheckEDC(rb->recovered, rb->xaMode)
&& CheckMSF(rb->recovered, rb->lba, STRICT_MSF_CHECK))
{ PrintCLIorLabel(STATUS_LABEL_OR_NULL,
{ PrintCLIorLabel(Closure->status,
"Sector %" PRId64 ": Recovered in raw reader by heuristic L-EC (0).\n",
rb->lba);
memcpy(outbuf, rb->recovered+rb->dataOffset, 2048);
@@ -1002,7 +1004,7 @@ int TryCDFrameRecovery(RawBuffer *rb, unsigned char *outbuf)
if(CheckEDC(rb->recovered, rb->xaMode)
&& CheckMSF(rb->recovered, rb->lba, STRICT_MSF_CHECK))
{ PrintCLIorLabel(STATUS_LABEL_OR_NULL,
{ PrintCLIorLabel(Closure->status,
"Sector %" PRId64 ": Recovered in raw reader by plausible sector search (1).\n",
rb->lba);
memcpy(outbuf, rb->recovered+rb->dataOffset, 2048);
@@ -1013,7 +1015,7 @@ int TryCDFrameRecovery(RawBuffer *rb, unsigned char *outbuf)
if(CheckEDC(rb->recovered, rb->xaMode)
&& CheckMSF(rb->recovered, rb->lba, STRICT_MSF_CHECK))
{ PrintCLIorLabel(STATUS_LABEL_OR_NULL,
{ PrintCLIorLabel(Closure->status,
"Sector %" PRId64 ": Recovered in raw reader by brute force plausible sector search (1).\n",
rb->lba);
memcpy(outbuf, rb->recovered+rb->dataOffset, 2048);
@@ -1024,7 +1026,7 @@ int TryCDFrameRecovery(RawBuffer *rb, unsigned char *outbuf)
if(CheckEDC(rb->recovered, rb->xaMode)
&& CheckMSF(rb->recovered, rb->lba, STRICT_MSF_CHECK))
{ PrintCLIorLabel(STATUS_LABEL_OR_NULL,
{ PrintCLIorLabel(Closure->status,
"Sector %" PRId64 ": Recovered in raw reader by mutual ack heuristic (1).\n",
rb->lba);
memcpy(outbuf, rb->recovered+rb->dataOffset, 2048);
@@ -1035,7 +1037,7 @@ int TryCDFrameRecovery(RawBuffer *rb, unsigned char *outbuf)
if(CheckEDC(rb->recovered, rb->xaMode)
&& CheckMSF(rb->recovered, rb->lba, STRICT_MSF_CHECK))
{ PrintCLIorLabel(STATUS_LABEL_OR_NULL,
{ PrintCLIorLabel(Closure->status,
"Sector %" PRId64 ": Recovered in raw reader by heuristic L-EC (1).\n",
rb->lba);
memcpy(outbuf, rb->recovered+rb->dataOffset, 2048);

View File

@@ -20,6 +20,8 @@
* along with dvdisaster. If not, see <http://www.gnu.org/licenses/>.
*/
/*** src type: no GUI code ***/
#include "dvdisaster.h"
#include "galois-inlines.h"

View File

@@ -20,6 +20,8 @@
* along with dvdisaster. If not, see <http://www.gnu.org/licenses/>.
*/
/*** src type: no GUI code ***/
#include "dvdisaster.h"
#ifdef HAVE_ALTIVEC

View File

@@ -20,6 +20,8 @@
* along with dvdisaster. If not, see <http://www.gnu.org/licenses/>.
*/
/*** src type: no GUI code ***/
#include "dvdisaster.h"
#ifdef HAVE_SSE2

View File

@@ -20,6 +20,8 @@
* along with dvdisaster. If not, see <http://www.gnu.org/licenses/>.
*/
/*** src type: no GUI code ***/
#include "dvdisaster.h"
/***

View File

@@ -20,6 +20,8 @@
* along with dvdisaster. If not, see <http://www.gnu.org/licenses/>.
*/
/*** src type: some GUI code ***/
#include "dvdisaster.h"
#include "rs01-includes.h"
@@ -206,30 +208,27 @@ void RS01ReadSector(Image *image, unsigned char *buf, gint64 s)
#define CRCBUFSIZE (1024*256)
void RS01ScanImage(Method *method, Image* image, struct MD5Context *ecc_ctxt, int mode)
{
#ifndef WITH_CLI_ONLY_YES
RS01Widgets *wl = NULL;
#endif
unsigned char buf[2048];
{ unsigned char buf[2048];
guint32 *crcbuf = NULL;
int unrecoverable_sectors = 0;
int crcidx = 0;
struct MD5Context image_md5;
gint64 s, first_missing, last_missing;
#ifndef WITH_CLI_ONLY_YES
gint64 prev_missing = 0;
gint64 prev_crc_errors = 0;
#endif
int last_percent,current_missing;
char *msg;
#ifdef WITH_GUI_YES
RS01Widgets *wl = NULL;
gint64 prev_crc_errors = 0;
gint64 prev_missing = 0;
#endif
#ifdef WITH_GUI_YES
/* Extract widget list from method */
#ifndef WITH_CLI_ONLY_YES
if(method->widgetList)
wl = (RS01Widgets*)method->widgetList;
#endif
/* Position behind the ecc file header,
initialize CRC buffer pointers */
@@ -263,13 +262,11 @@ void RS01ScanImage(Method *method, Image* image, struct MD5Context *ecc_ctxt, in
/* Check for user interruption */
#ifndef WITH_CLI_ONLY_YES
if(Closure->stopActions)
{ image->sectorsMissing += image->sectorSize - s;
if(crcbuf) g_free(crcbuf);
return;
}
#endif
/* Read the next sector */
@@ -361,18 +358,18 @@ void RS01ScanImage(Method *method, Image* image, struct MD5Context *ecc_ctxt, in
MD5Update(&image_md5, buf, n); /* update image md5sum */
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode && mode & PRINT_MODE)
percent = (VERIFY_IMAGE_SEGMENTS*(s+1))/image->sectorSize;
else
#endif
percent = (100*(s+1))/image->sectorSize;
percent = (100*(s+1))/image->sectorSize;
if(last_percent != percent)
{ PrintProgress(msg,percent);
#ifndef WITH_CLI_ONLY_YES
#ifdef WITH_GUI_YES
if(Closure->guiMode && mode & CREATE_CRC)
SetProgress(wl->encPBar1, percent, 100);
{ GuiSetProgress(wl->encPBar1, percent, 100);
}
if(Closure->guiMode && mode & PRINT_MODE)
{ RS01AddVerifyValues(method, percent, image->sectorsMissing, image->crcErrors,
@@ -382,8 +379,7 @@ void RS01ScanImage(Method *method, Image* image, struct MD5Context *ecc_ctxt, in
prev_missing = image->sectorsMissing;
prev_crc_errors = image->crcErrors;
}
#endif
#endif /* WITH_GUI_YES */
last_percent = percent;
}
}

View File

@@ -23,6 +23,8 @@
* along with dvdisaster. If not, see <http://www.gnu.org/licenses/>.
*/
/*** src type: some GUI code ***/
#include "dvdisaster.h"
#include "rs01-includes.h"
@@ -97,31 +99,19 @@ static int calculate_redundancy(char *image_name)
*** Remove the image file
***/
#ifndef WITH_CLI_ONLY_YES
static void unlink_image(GtkWidget *label)
#else
static void unlink_image(void *label)
#endif
{
if(LargeUnlink(Closure->imageName))
{ PrintLog(_("\nImage file %s deleted.\n"),Closure->imageName);
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
SetLabelText(GTK_LABEL(label),
_("\nImage file %s deleted.\n"), Closure->imageName);
#endif
{ PrintLog(_("\nImage file %s deleted.\n"),Closure->imageName);
GuiSetLabelText(label, _("\nImage file %s deleted.\n"), Closure->imageName);
}
else
{
#ifndef WITH_CLI_ONLY_YES
if(!Closure->guiMode)
#endif
{ if(!Closure->guiMode)
PrintLog("\n");
ModalWarningOrCLI(GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, NULL,
_("Image file %s not deleted: %s\n"),
Closure->imageName, strerror(errno));
else
ModalWarning(GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, NULL,
_("Image file %s not deleted: %s\n"),
Closure->imageName, strerror(errno));
}
}
@@ -135,9 +125,7 @@ static void unlink_image(void *label)
typedef struct
{ Method *self;
#ifndef WITH_CLI_ONLY_YES
RS01Widgets *wl;
#endif
GaloisTables *gt;
ReedSolomonTables *rt;
Image *image;
@@ -153,16 +141,15 @@ static void ecc_cleanup(gpointer data)
UnregisterCleanup();
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
{ if(ec->earlyTermination)
SetLabelText(GTK_LABEL(ec->wl->encFootline),
_("<span %s>Aborted by unrecoverable error.</span>"),
Closure->redMarkup);
AllowActions(TRUE);
{ GuiSetLabelText(ec->wl->encFootline,
_("<span %s>Aborted by unrecoverable error.</span>"),
Closure->redMarkup);
}
GuiAllowActions(TRUE);
}
#endif
/** Clean up */
if(ec->gt) FreeGaloisTables(ec->gt);
@@ -174,19 +161,17 @@ static void ecc_cleanup(gpointer data)
if(ec->msg) g_free(ec->msg);
if(ec->timer) g_timer_destroy(ec->timer);
#ifdef WITH_GUI_YES
if(Closure->enableCurveSwitch)
{ Closure->enableCurveSwitch = FALSE;
#ifndef WITH_CLI_ONLY_YES
RS01ShowCurveButton(ec->self);
#endif
}
#endif
g_free(ec);
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
g_thread_exit(0);
#endif
}
/*
@@ -197,9 +182,7 @@ enum { NORMAL, HIGH, GENERIC };
void RS01Create(void)
{ Method *self = FindMethod("RS01");
#ifndef WITH_CLI_ONLY_YES
RS01Widgets *wl = (RS01Widgets*)self->widgetList;
#endif
GaloisTables *gt;
ReedSolomonTables *rt;
ecc_closure *ec = g_malloc0(sizeof(ecc_closure));
@@ -224,9 +207,7 @@ void RS01Create(void)
/*** Register the cleanup procedure for GUI mode */
ec->self = self;
#ifndef WITH_CLI_ONLY_YES
ec->wl = wl;
#endif
ec->earlyTermination = TRUE;
RegisterCleanup(_("Error correction file creation aborted"), ecc_cleanup, ec);
@@ -255,11 +236,8 @@ void RS01Create(void)
nroots,
((double)nroots*100.0)/(double)ndata);
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
SetLabelText(GTK_LABEL(wl->encHeadline),
_("<big>Creating the error correction file.</big>\n<i>%s</i>"), ec->msg);
#endif
GuiSetLabelText(wl->encHeadline,
_("<big>Creating the error correction file.</big>\n<i>%s</i>"), ec->msg);
/*** Test the image file and create the CRC sums */
@@ -267,17 +245,15 @@ void RS01Create(void)
if(LargeStat(Closure->eccName, &n))
{
if(ConfirmEccDeletion(Closure->eccName))
if(GuiConfirmEccDeletion(Closure->eccName))
LargeUnlink(Closure->eccName);
#ifndef WITH_CLI_ONLY_YES /* ConfirmEccDeletion always return true if CLI */
else
{ SetLabelText(GTK_LABEL(ec->wl->encFootline),
_("<span %s>Aborted to keep existing ecc file.</span>"),
Closure->redMarkup);
{ GuiSetLabelText(ec->wl->encFootline,
_("<span %s>Aborted to keep existing ecc file.</span>"),
Closure->redMarkup);
ec->earlyTermination = FALSE;
goto terminate;
}
#endif
}
/* Open image and ecc files */
@@ -306,16 +282,13 @@ void RS01Create(void)
/* Try to use CRC values created during last read */
if(CrcBufValid(Closure->crcBuf, NULL, NULL))
if(CrcBufValid(Closure->crcBuf, image, FULL_IMAGE))
{ guint32 crc_idx;
int percent, last_percent = 0;
char *msg = _("Writing sector checksums: %3d%%");
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
SetLabelText(GTK_LABEL(wl->encLabel1),
_("<b>1. Writing image sector checksums:</b>"));
#endif
GuiSetLabelText(wl->encLabel1,
_("<b>1. Writing image sector checksums:</b>"));
memcpy(image->mediumSum, Closure->crcBuf->imageMD5sum, 16);
MD5Init(&md5Ctxt); /* md5sum of CRC portion of ecc file */
@@ -345,11 +318,7 @@ void RS01Create(void)
percent = (100*crc_idx)/image->sectorSize;
if(last_percent != percent)
{ PrintProgress(msg,percent);
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
SetProgress(wl->encPBar1, percent, 100);
#endif
GuiSetProgress(wl->encPBar1, percent, 100);
last_percent = percent;
}
@@ -362,12 +331,8 @@ void RS01Create(void)
Scan image for missing sectors and calculate the checksums.
Checksums are only computed locally and not provided in the cache. */
else
{
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
SetLabelText(GTK_LABEL(wl->encLabel1),
_("<b>1. Calculating image sector checksums:</b>"));
#endif
{ GuiSetLabelText(wl->encLabel1,
_("<b>1. Calculating image sector checksums:</b>"));
FreeCrcBuf(Closure->crcBuf); /* just a defensive measure */
Closure->crcBuf = NULL;
@@ -380,23 +345,18 @@ void RS01Create(void)
LargeUnlink(Closure->eccName); /* Do not leave a CRC-only .ecc file behind */
#ifndef WITH_CLI_ONLY_YES
if(Closure->stopActions)
{
if(Closure->stopActions == STOP_CURRENT_ACTION) /* suppress memleak warning when closing window */
SetLabelText(GTK_LABEL(wl->encFootline),
_("<span %s>Aborted by user request!</span> (partial error correction file removed)"),
Closure->redMarkup);
ec->earlyTermination = FALSE; /* suppress respective error message */
{ GuiSetLabelText(wl->encFootline,
_("<span %s>Aborted by user request!</span> (partial error correction file removed)"),
Closure->redMarkup);
}
ec->earlyTermination = FALSE; /* suppress respective error message */
goto terminate;
}
else
#endif
{
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
SetProgress(wl->encPBar1, 100, 100);
#endif
{ GuiSetProgress(wl->encPBar1, 100, 100);
Stop(_("%" PRId64 " sectors unread or missing due to errors.\n"), image->sectorsMissing);
}
@@ -405,15 +365,11 @@ void RS01Create(void)
PrintTimeToLog(ec->timer, "for CRC writing/generation.\n");
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
{ SetProgress(wl->encPBar1, 100, 100);
ShowWidget(wl->encPBar2);
ShowWidget(wl->encLabel2);
}
GuiSetProgress(wl->encPBar1, 100, 100);
GuiShowWidget(wl->encPBar2);
GuiShowWidget(wl->encLabel2);
if(!Closure->guiMode)
#endif
PrintLog("%s\n",ec->msg);
/*** Prepare Ecc file header.
@@ -531,19 +487,18 @@ void RS01Create(void)
{ int offset = 0;
unsigned char *par_idx = ec->parity;
#ifndef WITH_CLI_ONLY_YES
if(Closure->stopActions) /* User hit the Stop button */
{ if(Closure->stopActions == STOP_CURRENT_ACTION) /* suppress memleak warning when closing window */
SetLabelText(GTK_LABEL(wl->encFootline),
_("<span %s>Aborted by user request!</span> (partial error correction file removed)"),
Closure->redMarkup);
{ GuiSetLabelText(wl->encFootline,
_("<span %s>Aborted by user request!</span> (partial error correction file removed)"),
Closure->redMarkup);
}
ec->earlyTermination = FALSE; /* suppress respective error message */
LargeClose(image->eccFile);
image->eccFile = NULL;
LargeUnlink(Closure->eccName); /* Do not leave partial .ecc file behind */
goto terminate;
}
#endif
/* Read the next data sectors of this layer. */
@@ -610,13 +565,8 @@ void RS01Create(void)
progress++;
percent = (1000*progress)/max_percent;
if(last_percent != percent)
{
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
SetProgress(wl->encPBar2, percent, 1000);
else
#endif
PrintProgress(_("Ecc generation: %3d.%1d%%"), percent/10, percent%10);
{ GuiSetProgress(wl->encPBar2, percent, 1000);
PrintProgress(_("Ecc generation: %3d.%1d%%"), percent/10, percent%10);
last_percent = percent;
}
}
@@ -629,19 +579,18 @@ void RS01Create(void)
{ int offset = 0;
unsigned char *par_idx = ec->parity;
#ifndef WITH_CLI_ONLY_YES
if(Closure->stopActions) /* User hit the Stop button */
{ if(Closure->stopActions == STOP_CURRENT_ACTION) /* suppress memleak warning when closing window */
SetLabelText(GTK_LABEL(wl->encFootline),
_("<span %s>Aborted by user request!</span> (partial error correction file removed)"),
Closure->redMarkup);
{ GuiSetLabelText(wl->encFootline,
_("<span %s>Aborted by user request!</span> (partial error correction file removed)"),
Closure->redMarkup);
}
ec->earlyTermination = FALSE; /* suppress respective error message */
LargeClose(image->eccFile);
image->eccFile = NULL;
LargeUnlink(Closure->eccName); /* Do not leave partial .ecc file behind */
goto terminate;
}
#endif
/* Read the next data sectors of this layer. */
@@ -740,13 +689,8 @@ void RS01Create(void)
progress++;
percent = (1000*progress)/max_percent;
if(last_percent != percent)
{
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
SetProgress(wl->encPBar2, percent, 1000);
else
#endif
PrintProgress(_("Ecc generation: %3d.%1d%%"), percent/10, percent%10);
{ GuiSetProgress(wl->encPBar2, percent, 1000);
PrintProgress(_("Ecc generation: %3d.%1d%%"), percent/10, percent%10);
last_percent = percent;
}
}
@@ -762,19 +706,18 @@ void RS01Create(void)
{ int offset = 0;
unsigned char *par_idx = ec->parity;
#ifndef WITH_CLI_ONLY_YES
if(Closure->stopActions) /* User hit the Stop button */
{ if(Closure->stopActions == STOP_CURRENT_ACTION) /* suppress memleak warning when closing window */
SetLabelText(GTK_LABEL(wl->encFootline),
_("<span %s>Aborted by user request!</span>"),
Closure->redMarkup);
{ GuiSetLabelText(wl->encFootline,
_("<span %s>Aborted by user request!</span>"),
Closure->redMarkup);
}
ec->earlyTermination = FALSE; /* suppress respective error message */
LargeClose(image->eccFile);
image->eccFile = NULL;
LargeUnlink(Closure->eccName); /* Do not leave partial .ecc file behind */
goto terminate;
}
#endif
/* Read the next data sectors of this layer. */
@@ -1040,13 +983,8 @@ void RS01Create(void)
progress++;
percent = (1000*progress)/max_percent;
if(last_percent != percent)
{
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
SetProgress(wl->encPBar2, percent, 1000);
else
#endif
PrintProgress(_("Ecc generation: %3d.%1d%%"), percent/10, percent%10);
{ GuiSetProgress(wl->encPBar2, percent, 1000);
PrintProgress(_("Ecc generation: %3d.%1d%%"), percent/10, percent%10);
last_percent = percent;
}
}
@@ -1087,15 +1025,11 @@ void RS01Create(void)
"Make sure to keep this file on a reliable medium.\n"),
Closure->eccName);
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
{ SetProgress(wl->encPBar2, 100, 100);
GuiSetProgress(wl->encPBar2, 100, 100);
SetLabelText(GTK_LABEL(wl->encFootline),
GuiSetLabelText(wl->encFootline,
_("The error correction file has been successfully created.\n"
"Make sure to keep this file on a reliable medium."));
}
#endif
/*** If the --unlink option or respective GUI switch is set,
unlink the image. */
@@ -1103,20 +1037,14 @@ void RS01Create(void)
if(Closure->unlinkImage)
{ if(ec->image) CloseImage(ec->image);
ec->image = NULL;
#ifndef WITH_CLI_ONLY_YES
unlink_image(Closure->guiMode ? wl->encFootline2 : NULL);
#else
unlink_image(NULL);
#endif
}
/*** Clean up */
ec->earlyTermination = FALSE;
#ifndef WITH_CLI_ONLY_YES
terminate:
#endif
ecc_cleanup((gpointer)ec);
}

View File

@@ -23,6 +23,8 @@
* along with dvdisaster. If not, see <http://www.gnu.org/licenses/>.
*/
/*** src type: some GUI code ***/
#include "dvdisaster.h"
#include "rs01-includes.h"
@@ -54,10 +56,7 @@ static void read_crc(LargeFile *ecc, guint32 *buf, int first_sector, int n_secto
*/
typedef struct
{
#ifndef WITH_CLI_ONLY_YES
RS01Widgets *wl;
#endif
{ RS01Widgets *wl;
GaloisTables *gt;
ReedSolomonTables *rt;
Image *image;
@@ -73,17 +72,16 @@ static void fix_cleanup(gpointer data)
UnregisterCleanup();
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
{ if(fc->earlyTermination)
SwitchAndSetFootline(fc->wl->fixNotebook, 1,
fc->wl->fixFootline,
_("<span %s>Aborted by unrecoverable error.</span>"),
Closure->redMarkup);
AllowActions(TRUE);
{ GuiSwitchAndSetFootline(fc->wl->fixNotebook, 1,
fc->wl->fixFootline,
_("<span %s>Aborted by unrecoverable error.</span>"),
Closure->redMarkup);
}
GuiAllowActions(TRUE);
}
#endif
/** Clean up */
if(fc->image) CloseImage(fc->image);
@@ -101,10 +99,7 @@ static void fix_cleanup(gpointer data)
g_free(fc);
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
g_thread_exit(0);
#endif
GuiExitWorkerThread();
}
/*
@@ -112,11 +107,8 @@ static void fix_cleanup(gpointer data)
*/
void RS01Fix(Image *image)
{
#ifndef WITH_CLI_ONLY_YES
Method *method = FindMethod("RS01");
{ Method *method = FindMethod("RS01");
RS01Widgets *wl = (RS01Widgets*)method->widgetList;
#endif
GaloisTables *gt;
ReedSolomonTables *rt;
fix_closure *fc = g_malloc0(sizeof(fix_closure));
@@ -141,9 +133,7 @@ void RS01Fix(Image *image)
/*** Register the cleanup procedure for GUI mode */
fc->image = image;
#ifndef WITH_CLI_ONLY_YES
fc->wl = wl;
#endif
fc->earlyTermination = TRUE;
RegisterCleanup(_("Repairing of image aborted"), fix_cleanup, fc);
@@ -155,14 +145,14 @@ void RS01Fix(Image *image)
eh->eccBytes,
((double)eh->eccBytes*100.0)/(double)eh->dataBytes);
#ifndef WITH_CLI_ONLY_YES
#ifdef WITH_GUI_YES
if(Closure->guiMode)
{ SetLabelText(GTK_LABEL(wl->fixHeadline),
_("<big>Repairing the image.</big>\n<i>%s</i>"),fc->msg);
{ GuiSetLabelText(wl->fixHeadline,
_("<big>Repairing the image.</big>\n<i>%s</i>"),fc->msg);
RS01SetFixMaxValues(wl, eh->dataBytes, eh->eccBytes, image->sectorSize);
}
#endif
PrintLog(_("\nFix mode(%s): Repairable sectors will be fixed in the image.\n"),
"RS01");
@@ -205,43 +195,42 @@ void RS01Fix(Image *image)
if(diff>0 && diff<=2)
{
int answer = ModalWarningOrCLI(GTK_MESSAGE_QUESTION, GTK_BUTTONS_OK_CANCEL, NULL,
int answer = ModalWarning(GTK_MESSAGE_QUESTION, GTK_BUTTONS_OK_CANCEL, NULL,
_("Image file is %" PRId64 " sectors longer than expected.\n"
"Assuming this is a TAO mode medium.\n"
"%" PRId64 " sectors will be removed from the image end.\n"),
diff, diff);
if(!answer)
{
#ifndef WITH_CLI_ONLY_YES
SwitchAndSetFootline(fc->wl->fixNotebook, 1,
fc->wl->fixFootline,
_("<span %s>Aborted by user request!</span>"),
Closure->redMarkup);
#endif
{ GuiSwitchAndSetFootline(fc->wl->fixNotebook, 1,
fc->wl->fixFootline,
_("<span %s>Aborted by user request!</span>"),
Closure->redMarkup);
fc->earlyTermination = FALSE; /* suppress respective error message */
goto terminate;
}
/* in command line mode, 1-2 superflous sectors are silently removed. */
image->sectorSize -= diff;
image->inLast = eh->inLast;
if(!LargeTruncate(image->file, expected_image_size))
Stop(_("Could not truncate %s: %s\n"),Closure->imageName,strerror(errno));
}
#ifndef WITH_CLI_ONLY_YES
#ifdef WITH_GUI_YES
if(diff>2 && Closure->guiMode)
{ int answer = ModalDialog(GTK_MESSAGE_QUESTION, GTK_BUTTONS_OK_CANCEL, NULL,
trans,
diff,
_("Is it okay to remove the superfluous sectors?"));
{ int answer = GuiModalDialog(GTK_MESSAGE_QUESTION, GTK_BUTTONS_OK_CANCEL, NULL,
trans,
diff,
_("Is it okay to remove the superfluous sectors?"));
if(!answer)
{ SwitchAndSetFootline(fc->wl->fixNotebook, 1,
fc->wl->fixFootline,
_("<span %s>Aborted by user request!</span>"),
Closure->redMarkup);
{ GuiSwitchAndSetFootline(fc->wl->fixNotebook, 1,
fc->wl->fixFootline,
_("<span %s>Aborted by user request!</span>"),
Closure->redMarkup);
fc->earlyTermination = FALSE; /* suppress respective error message */
goto terminate;
}
@@ -254,14 +243,9 @@ void RS01Fix(Image *image)
PrintLog(_("Image has been truncated by %" PRId64 " sectors.\n"), diff);
}
#endif
if(diff>2 &&
#ifndef WITH_CLI_ONLY_YES
!Closure->guiMode)
#else
1)
#endif
#endif /* WITH_GUI_YES */
if(diff>2 && !Closure->guiMode)
{ if(!Closure->truncate)
Stop(trans,
diff,
@@ -281,30 +265,24 @@ void RS01Fix(Image *image)
if(image->sectorSize == image->expectedSectors && image->inLast > eh->inLast)
{ int difference = image->inLast - eh->inLast;
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
{ int answer = ModalDialog(GTK_MESSAGE_QUESTION, GTK_BUTTONS_OK_CANCEL, NULL,
_("The image file is %d bytes longer than noted\n"
"in the ecc file. Shall the superfluous bytes\n"
"be removed from the image file?\n"),
difference);
{ int answer = GuiModalDialog(GTK_MESSAGE_QUESTION, GTK_BUTTONS_OK_CANCEL, NULL,
_("The image file is %d bytes longer than noted\n"
"in the ecc file. Shall the superfluous bytes\n"
"be removed from the image file?\n"),
difference);
if(!answer)
{ SwitchAndSetFootline(fc->wl->fixNotebook, 1,
fc->wl->fixFootline,
_("<span %s>Aborted by user request!</span>"),
Closure->redMarkup);
{ GuiSwitchAndSetFootline(fc->wl->fixNotebook, 1,
fc->wl->fixFootline,
_("<span %s>Aborted by user request!</span>"),
Closure->redMarkup);
fc->earlyTermination = FALSE; /* suppress respective error message */
goto terminate;
}
}
#endif
#ifndef WITH_CLI_ONLY_YES
if(!Closure->guiMode && !Closure->truncate)
#else
if(!Closure->truncate)
#endif
Stop(_("The image file is %d bytes longer than noted\n"
"in the ecc file.\n"
"Add the --truncate option to the program call\n"
@@ -321,17 +299,14 @@ void RS01Fix(Image *image)
if(image->sectorSize < image->expectedSectors)
{ int answer;
answer = ModalWarningOrCLI(GTK_MESSAGE_QUESTION, GTK_BUTTONS_OK_CANCEL, NULL,
answer = ModalWarning(GTK_MESSAGE_QUESTION, GTK_BUTTONS_OK_CANCEL, NULL,
"%s",_("Image file appears to be truncated.\n"
"Consider completing it with another reading pass before going on.\n"));
if(!answer)
{
#ifndef WITH_CLI_ONLY_YES
SwitchAndSetFootline(fc->wl->fixNotebook, 1,
fc->wl->fixFootline,
_("<span %s>Aborted by user request!</span>"),
Closure->redMarkup);
#endif
{ GuiSwitchAndSetFootline(fc->wl->fixNotebook, 1,
fc->wl->fixFootline,
_("<span %s>Aborted by user request!</span>"),
Closure->redMarkup);
fc->earlyTermination = FALSE; /* suppress respective error message */
goto terminate;
}
@@ -340,18 +315,15 @@ void RS01Fix(Image *image)
if(image->fpState != FP_PRESENT)
{ int answer;
answer = ModalWarningOrCLI(GTK_MESSAGE_QUESTION, GTK_BUTTONS_OK_CANCEL, NULL,
answer = ModalWarning(GTK_MESSAGE_QUESTION, GTK_BUTTONS_OK_CANCEL, NULL,
_("Sector %d is missing. Can not compare image and ecc fingerprints.\n"
"Double check that image and ecc file belong together.\n"),
eh->fpSector);
if(!answer)
{
#ifndef WITH_CLI_ONLY_YES
SwitchAndSetFootline(fc->wl->fixNotebook, 1,
fc->wl->fixFootline,
_("<span %s>Aborted by user request!</span>"),
Closure->redMarkup);
#endif
{ GuiSwitchAndSetFootline(fc->wl->fixNotebook, 1,
fc->wl->fixFootline,
_("<span %s>Aborted by user request!</span>"),
Closure->redMarkup);
fc->earlyTermination = FALSE; /* suppress respective error message */
goto terminate;
}
@@ -399,17 +371,16 @@ void RS01Fix(Image *image)
for(si=0; si<s; si++)
{
#ifndef WITH_CLI_ONLY_YES
if(Closure->stopActions) /* User hit the Stop button */
{ if(Closure->stopActions == STOP_CURRENT_ACTION) /* suppress memleak warning when closing window */
SwitchAndSetFootline(fc->wl->fixNotebook, 1,
fc->wl->fixFootline,
_("<span %s>Aborted by user request!</span>"),
Closure->redMarkup);
{ GuiSwitchAndSetFootline(fc->wl->fixNotebook, 1,
fc->wl->fixFootline,
_("<span %s>Aborted by user request!</span>"),
Closure->redMarkup);
}
fc->earlyTermination = FALSE; /* suppress respective error message */
goto terminate;
}
#endif
/* Read the next batch of (cache_size * ndata) medium sectors
if the cache ran empty. */
@@ -472,10 +443,7 @@ void RS01Fix(Image *image)
and try to correct them. */
if(erasure_count>nroots) /* uncorrectable */
{
#ifndef WITH_CLI_ONLY_YES
if(!Closure->guiMode)
#endif
{ if(!Closure->guiMode)
{ PrintCLI(_("* %3d unrepairable sectors: "), erasure_count);
for(i=0; i<erasure_count; i++)
@@ -785,7 +753,7 @@ skip:
if(last_percent != percent)
{
#ifndef WITH_CLI_ONLY_YES
#ifdef WITH_GUI_YES
if(Closure->guiMode)
{
RS01AddFixValues(wl, percent, local_plot_max);
@@ -794,8 +762,8 @@ skip:
RS01UpdateFixResults(wl, corrected, uncorrected);
}
else
#endif
PrintProgress(_("Ecc progress: %3d.%1d%%"),percent/10,percent%10);
#endif
PrintProgress(_("Ecc progress: %3d.%1d%%"),percent/10,percent%10);
last_percent = percent;
}
@@ -811,13 +779,10 @@ skip:
if(corrected > 0) PrintLog(_("Repaired sectors: %" PRId64 " \n"),corrected);
if(uncorrected > 0)
{ PrintLog(_("Unrepaired sectors: %" PRId64 "\n"), uncorrected);
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
SwitchAndSetFootline(wl->fixNotebook, 1, wl->fixFootline,
_("Image sectors could not be fully restored "
"(%" PRId64 " repaired; <span %s>%" PRId64 " unrepaired</span>)"),
corrected, Closure->redMarkup, uncorrected);
#endif
GuiSwitchAndSetFootline(wl->fixNotebook, 1, wl->fixFootline,
_("Image sectors could not be fully restored "
"(%" PRId64 " repaired; <span %s>%" PRId64 " unrepaired</span>)"),
corrected, Closure->redMarkup, uncorrected);
}
else
{ if(!corrected)
@@ -833,12 +798,10 @@ skip:
PrintLog(_("Erasure counts per ecc block: avg = %.1f; worst = %d.\n"),
(double)damaged_sec/(double)damaged_ecc,worst_ecc);
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode && t)
SwitchAndSetFootline(wl->fixNotebook, 1, wl->fixFootline,
"%s %s", _("Repair results:"), t);
#endif
if(t)
{ GuiSwitchAndSetFootline(wl->fixNotebook, 1, wl->fixFootline,
"%s %s", _("Repair results:"), t);
}
/*** Clean up */

View File

@@ -23,7 +23,6 @@
#ifndef RS01INCLUDES_H
#define RS01INCLUDES_H
#ifndef WITH_CLI_ONLY_YES
/* Data structs from rs01-window.c */
typedef struct
@@ -97,7 +96,6 @@ typedef struct
int dataBytes;
int percent, lastPercent;
} RS01Widgets;
#endif
/*
* local working closure for internal checksums
@@ -107,7 +105,6 @@ typedef struct
{ struct MD5Context md5ctxt; /* Complete image checksum */
} RS01CksumClosure;
#ifndef WITH_CLI_ONLY_YES
/*
* These are exported via the Method struct
*/
@@ -123,7 +120,6 @@ void RS01ShowCurveButton(Method*);
void ResetRS01VerifyWindow(Method*);
void CreateRS01VerifyWindow(Method*, GtkWidget*);
#endif
/*
* These are exported (resp. only used) in ecc-rs01.c and rs01*.c
@@ -159,13 +155,11 @@ void RS01Create(void);
void RS01Fix(Image*);
#ifndef WITH_CLI_ONLY_YES
/* rs01-window.c */
void RS01AddFixValues(RS01Widgets*, int, int);
void RS01SetFixMaxValues(RS01Widgets*, int, int, gint64);
void RS01UpdateFixResults(RS01Widgets*, gint64, gint64);
#endif
/* rs01-verify.c */

View File

@@ -20,11 +20,13 @@
* along with dvdisaster. If not, see <http://www.gnu.org/licenses/>.
*/
/*** src type: some GUI code ***/
#include "dvdisaster.h"
#include "rs01-includes.h"
#ifndef WITH_CLI_ONLY_YES
#ifdef WITH_GUI_YES
/***
*** Reset the verify output window
@@ -33,28 +35,28 @@
void ResetRS01VerifyWindow(Method *self)
{ RS01Widgets *wl = (RS01Widgets*)self->widgetList;
SetLabelText(GTK_LABEL(wl->cmpChkSumErrors), "-");
SetLabelText(GTK_LABEL(wl->cmpMissingSectors), "0");
SetLabelText(GTK_LABEL(wl->cmpImageMd5Sum), "-");
SetLabelText(GTK_LABEL(wl->cmpImageResult), "");
SwitchAndSetFootline(wl->cmpImageNotebook, 1, NULL, NULL);
GuiSetLabelText(wl->cmpChkSumErrors, "-");
GuiSetLabelText(wl->cmpMissingSectors, "0");
GuiSetLabelText(wl->cmpImageMd5Sum, "-");
GuiSetLabelText(wl->cmpImageResult, "");
GuiSwitchAndSetFootline(wl->cmpImageNotebook, 1, NULL, NULL);
SetLabelText(GTK_LABEL(wl->cmpEccEmptyMsg), "");
SetLabelText(GTK_LABEL(wl->cmpEccCreatedBy), "dvdisaster");
SetLabelText(GTK_LABEL(wl->cmpEccMethod), "");
SetLabelText(GTK_LABEL(wl->cmpEccRequires), "");
SetLabelText(GTK_LABEL(wl->cmpEccMediumSectors), "");
SetLabelText(GTK_LABEL(wl->cmpEccImgMd5Sum), "");
SetLabelText(GTK_LABEL(wl->cmpEccFingerprint), _("n/a"));
SetLabelText(GTK_LABEL(wl->cmpEccBlocks), "");
SetLabelText(GTK_LABEL(wl->cmpEccMd5Sum), "");
SetLabelText(GTK_LABEL(wl->cmpEccResult), "");
SwitchAndSetFootline(wl->cmpEccNotebook, 0, NULL, NULL);
GuiSetLabelText(wl->cmpEccEmptyMsg, "");
GuiSetLabelText(wl->cmpEccCreatedBy, "dvdisaster");
GuiSetLabelText(wl->cmpEccMethod, "");
GuiSetLabelText(wl->cmpEccRequires, "");
GuiSetLabelText(wl->cmpEccMediumSectors, "");
GuiSetLabelText(wl->cmpEccImgMd5Sum, "");
GuiSetLabelText(wl->cmpEccFingerprint, _("n/a"));
GuiSetLabelText(wl->cmpEccBlocks, "");
GuiSetLabelText(wl->cmpEccMd5Sum, "");
GuiSetLabelText(wl->cmpEccResult, "");
GuiSwitchAndSetFootline(wl->cmpEccNotebook, 0, NULL, NULL);
wl->lastPercent = 0;
FillSpiral(wl->cmpSpiral, Closure->background);
DrawSpiral(wl->cmpSpiral);
GuiFillSpiral(wl->cmpSpiral, Closure->background);
GuiDrawSpiral(wl->cmpSpiral);
}
/***
@@ -76,7 +78,7 @@ static gboolean spiral_idle_func(gpointer data)
int i;
for(i=sii->from; i<=sii->to; i++)
DrawSpiralSegment(sii->cmpSpiral, sii->segColor, i-1);
GuiDrawSpiralSegment(sii->cmpSpiral, sii->segColor, i-1);
g_free(sii);
return FALSE;
@@ -92,13 +94,15 @@ void RS01AddVerifyValues(Method *method, int percent,
return;
if(newMissing)
SetLabelText(GTK_LABEL(wl->cmpMissingSectors), "<span %s>%" PRId64 "</span>",
Closure->redMarkup, totalMissing);
{ GuiSetLabelText(wl->cmpMissingSectors, "<span %s>%" PRId64 "</span>",
Closure->redMarkup, totalMissing);
}
if(newCrcErrors)
SetLabelText(GTK_LABEL(wl->cmpChkSumErrors), "<span %s>%" PRId64 "</span>",
Closure->redMarkup, totalCrcErrors);
{ GuiSetLabelText(wl->cmpChkSumErrors, "<span %s>%" PRId64 "</span>",
Closure->redMarkup, totalCrcErrors);
}
sii->cmpSpiral = wl->cmpSpiral;
sii->segColor = Closure->greenSector;
@@ -119,16 +123,16 @@ void RS01AddVerifyValues(Method *method, int percent,
static void redraw_spiral(RS01Widgets *wl)
{ int x = wl->cmpSpiral->mx - wl->cmpSpiral->diameter/2 + 10;
DrawSpiralLabel(wl->cmpSpiral, wl->cmpLayout,
_("Good sectors"), Closure->greenSector, x, 1);
GuiDrawSpiralLabel(wl->cmpSpiral, wl->cmpLayout,
_("Good sectors"), Closure->greenSector, x, 1);
DrawSpiralLabel(wl->cmpSpiral, wl->cmpLayout,
_("Sectors with CRC errors"), Closure->yellowSector, x, 2);
GuiDrawSpiralLabel(wl->cmpSpiral, wl->cmpLayout,
_("Sectors with CRC errors"), Closure->yellowSector, x, 2);
DrawSpiralLabel(wl->cmpSpiral, wl->cmpLayout,
_("Missing sectors"), Closure->redSector, x, 3);
GuiDrawSpiralLabel(wl->cmpSpiral, wl->cmpLayout,
_("Missing sectors"), Closure->redSector, x, 3);
DrawSpiral(wl->cmpSpiral);
GuiDrawSpiral(wl->cmpSpiral);
}
/*
@@ -143,11 +147,11 @@ static gboolean expose_cb(GtkWidget *widget, GdkEventExpose *event, gpointer dat
/* Finish spiral initialization */
if(!wl->cmpLayout)
{ SetSpiralWidget(wl->cmpSpiral, widget);
{ GuiSetSpiralWidget(wl->cmpSpiral, widget);
wl->cmpLayout = gtk_widget_create_pango_layout(widget, NULL);
}
SetText(wl->cmpLayout, _("Missing sectors"), &w, &h);
GuiSetText(wl->cmpLayout, _("Missing sectors"), &w, &h);
size = wl->cmpSpiral->diameter + 20 + 3*(10+h); /* approx. size of spiral + labels */
wl->cmpSpiral->mx = a->width / 2;
@@ -209,7 +213,7 @@ void CreateRS01VerifyWindow(Method *self, GtkWidget *parent)
lab = gtk_label_new(NULL);
gtk_misc_set_alignment(GTK_MISC(lab), 0.0, 0.0);
SetLabelText(GTK_LABEL(lab), _("Medium sectors:"));
GuiSetLabelText(lab, _("Medium sectors:"));
gtk_table_attach(GTK_TABLE(table2), lab, 0, 1, 0, 1, GTK_SHRINK | GTK_FILL, GTK_SHRINK, 5, 2 );
lab = wl->cmpImageSectors = gtk_label_new("0");
gtk_misc_set_alignment(GTK_MISC(lab), 0.0, 0.0);
@@ -217,7 +221,7 @@ void CreateRS01VerifyWindow(Method *self, GtkWidget *parent)
lab = gtk_label_new(NULL);
gtk_misc_set_alignment(GTK_MISC(lab), 0.0, 0.0);
SetLabelText(GTK_LABEL(lab), _("Checksum errors:"));
GuiSetLabelText(lab, _("Checksum errors:"));
gtk_table_attach(GTK_TABLE(table2), lab, 0, 1, 1, 2, GTK_SHRINK | GTK_FILL, GTK_SHRINK, 5, 2 );
lab = wl->cmpChkSumErrors = gtk_label_new("0");
gtk_misc_set_alignment(GTK_MISC(lab), 0.0, 0.0);
@@ -225,7 +229,7 @@ void CreateRS01VerifyWindow(Method *self, GtkWidget *parent)
lab = gtk_label_new(NULL);
gtk_misc_set_alignment(GTK_MISC(lab), 0.0, 0.0);
SetLabelText(GTK_LABEL(lab), _("Missing Sectors:"));
GuiSetLabelText(lab, _("Missing Sectors:"));
gtk_table_attach(GTK_TABLE(table2), lab, 0, 1, 2, 3, GTK_SHRINK | GTK_FILL, GTK_SHRINK, 5, 2 );
lab = wl->cmpMissingSectors = gtk_label_new("0");
gtk_misc_set_alignment(GTK_MISC(lab), 0.0, 0.0);
@@ -233,7 +237,7 @@ void CreateRS01VerifyWindow(Method *self, GtkWidget *parent)
lab = gtk_label_new(NULL);
gtk_misc_set_alignment(GTK_MISC(lab), 0.0, 0.0);
SetLabelText(GTK_LABEL(lab), _("Image checksum:"));
GuiSetLabelText(lab, _("Image checksum:"));
gtk_table_attach(GTK_TABLE(table2), lab, 0, 1, 3, 4, GTK_SHRINK | GTK_FILL, GTK_SHRINK, 5, 2 );
lab = wl->cmpImageMd5Sum = gtk_label_new("0");
gtk_misc_set_alignment(GTK_MISC(lab), 0.0, 0.0);
@@ -248,7 +252,7 @@ void CreateRS01VerifyWindow(Method *self, GtkWidget *parent)
frame = gtk_frame_new(_utf("Image state"));
gtk_table_attach(GTK_TABLE(table), frame, 1, 2, 0, 2, GTK_SHRINK | GTK_FILL, GTK_EXPAND | GTK_FILL, 5, 5);
wl->cmpSpiral = CreateSpiral(Closure->grid, Closure->background, 10, 5, VERIFY_IMAGE_SEGMENTS);
wl->cmpSpiral = GuiCreateSpiral(Closure->grid, Closure->background, 10, 5, VERIFY_IMAGE_SEGMENTS);
d_area = wl->cmpDrawingArea = gtk_drawing_area_new();
gtk_widget_set_size_request(d_area, wl->cmpSpiral->diameter+20, -1);
gtk_container_add(GTK_CONTAINER(frame), d_area);
@@ -275,7 +279,7 @@ void CreateRS01VerifyWindow(Method *self, GtkWidget *parent)
lab = gtk_label_new(NULL);
gtk_misc_set_alignment(GTK_MISC(lab), 0.0, 0.0);
SetLabelText(GTK_LABEL(lab), _("Created by:"));
GuiSetLabelText(lab, _("Created by:"));
gtk_table_attach(GTK_TABLE(table2), lab, 0, 1, 0, 1, GTK_SHRINK | GTK_FILL, GTK_SHRINK, 5, 2 );
lab = wl->cmpEccCreatedBy = gtk_label_new(NULL);
gtk_misc_set_alignment(GTK_MISC(lab), 0.0, 0.0);
@@ -283,7 +287,7 @@ void CreateRS01VerifyWindow(Method *self, GtkWidget *parent)
lab = gtk_label_new(NULL);
gtk_misc_set_alignment(GTK_MISC(lab), 0.0, 0.0);
SetLabelText(GTK_LABEL(lab), _("Method:"));
GuiSetLabelText(lab, _("Method:"));
gtk_table_attach(GTK_TABLE(table2), lab, 0, 1, 1, 2, GTK_SHRINK | GTK_FILL, GTK_SHRINK, 5, 2 );
lab = wl->cmpEccMethod = gtk_label_new(NULL);
gtk_misc_set_alignment(GTK_MISC(lab), 0.0, 0.0);
@@ -291,7 +295,7 @@ void CreateRS01VerifyWindow(Method *self, GtkWidget *parent)
lab = gtk_label_new(NULL);
gtk_misc_set_alignment(GTK_MISC(lab), 0.0, 0.0);
SetLabelText(GTK_LABEL(lab), _("Requires:"));
GuiSetLabelText(lab, _("Requires:"));
gtk_table_attach(GTK_TABLE(table2), lab, 0, 1, 2, 3, GTK_SHRINK | GTK_FILL, GTK_SHRINK, 5, 2 );
lab = wl->cmpEccRequires = gtk_label_new(NULL);
gtk_misc_set_alignment(GTK_MISC(lab), 0.0, 0.0);
@@ -299,7 +303,7 @@ void CreateRS01VerifyWindow(Method *self, GtkWidget *parent)
lab = gtk_label_new(NULL);
gtk_misc_set_alignment(GTK_MISC(lab), 0.0, 0.0);
SetLabelText(GTK_LABEL(lab), _("Medium sectors:"));
GuiSetLabelText(lab, _("Medium sectors:"));
gtk_table_attach(GTK_TABLE(table2), lab, 0, 1, 3, 4, GTK_SHRINK | GTK_FILL, GTK_SHRINK, 5, 2 );
lab = wl->cmpEccMediumSectors = gtk_label_new(NULL);
gtk_misc_set_alignment(GTK_MISC(lab), 0.0, 0.0);
@@ -307,7 +311,7 @@ void CreateRS01VerifyWindow(Method *self, GtkWidget *parent)
lab = gtk_label_new(NULL);
gtk_misc_set_alignment(GTK_MISC(lab), 0.0, 0.0);
SetLabelText(GTK_LABEL(lab), _("Image checksum:"));
GuiSetLabelText(lab, _("Image checksum:"));
gtk_table_attach(GTK_TABLE(table2), lab, 0, 1, 4, 5, GTK_SHRINK | GTK_FILL, GTK_SHRINK, 5, 2 );
lab = wl->cmpEccImgMd5Sum = gtk_label_new(NULL);
gtk_misc_set_alignment(GTK_MISC(lab), 0.0, 0.0);
@@ -315,7 +319,7 @@ void CreateRS01VerifyWindow(Method *self, GtkWidget *parent)
lab = gtk_label_new(NULL);
gtk_misc_set_alignment(GTK_MISC(lab), 0.0, 0.0);
SetLabelText(GTK_LABEL(lab), _("Fingerprint:"));
GuiSetLabelText(lab, _("Fingerprint:"));
gtk_table_attach(GTK_TABLE(table2), lab, 0, 1, 5, 6, GTK_SHRINK | GTK_FILL, GTK_SHRINK, 5, 2 );
lab = wl->cmpEccFingerprint = gtk_label_new(NULL);
gtk_misc_set_alignment(GTK_MISC(lab), 0.0, 0.0);
@@ -323,7 +327,7 @@ void CreateRS01VerifyWindow(Method *self, GtkWidget *parent)
lab = gtk_label_new(NULL);
gtk_misc_set_alignment(GTK_MISC(lab), 0.0, 0.0);
SetLabelText(GTK_LABEL(lab), _("Ecc blocks:"));
GuiSetLabelText(lab, _("Ecc blocks:"));
gtk_table_attach(GTK_TABLE(table2), lab, 0, 1, 6, 7, GTK_SHRINK | GTK_FILL, GTK_SHRINK, 5, 2 );
lab = wl->cmpEccBlocks = gtk_label_new(NULL);
gtk_misc_set_alignment(GTK_MISC(lab), 0.0, 0.0);
@@ -331,7 +335,7 @@ void CreateRS01VerifyWindow(Method *self, GtkWidget *parent)
lab = gtk_label_new(NULL);
gtk_misc_set_alignment(GTK_MISC(lab), 0.0, 0.0);
SetLabelText(GTK_LABEL(lab), _("Ecc checksum:"));
GuiSetLabelText(lab, _("Ecc checksum:"));
gtk_table_attach(GTK_TABLE(table2), lab, 0, 1, 7, 8, GTK_SHRINK | GTK_FILL, GTK_SHRINK, 5, 2 );
lab = wl->cmpEccMd5Sum = gtk_label_new(NULL);
gtk_misc_set_alignment(GTK_MISC(lab), 0.0, 0.0);
@@ -341,7 +345,7 @@ void CreateRS01VerifyWindow(Method *self, GtkWidget *parent)
gtk_misc_set_alignment(GTK_MISC(lab), 0.0, 0.0);
gtk_table_attach(GTK_TABLE(table2), lab, 0, 2, 8, 9, GTK_SHRINK | GTK_FILL, GTK_SHRINK, 5, 4);
}
#endif
#endif /* WITH_GUI_YES */
/***
*** Verify the prefix.* files
@@ -356,31 +360,26 @@ static void cleanup(gpointer data)
UnregisterCleanup();
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
AllowActions(TRUE);
#endif
if(vc->image) CloseImage(vc->image);
g_free(vc);
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
g_thread_exit(0);
#endif
GuiAllowActions(TRUE);
GuiExitWorkerThread();
}
/***
*** Verify entry point fpr both CLI and GUI mode
***/
void RS01Verify(Image *image)
{ verify_closure *vc = g_malloc0(sizeof(verify_closure));
Method *self = FindMethod("RS01");
#ifndef WITH_CLI_ONLY_YES
#ifdef WITH_GUI_YES
RS01Widgets *wl = (RS01Widgets*)self->widgetList;
#endif
char idigest[33],edigest[33];
gint64 excess_sectors = 0;
#ifndef WITH_CLI_ONLY_YES
char *ecc_advice = NULL;
#endif
EccHeader *eh;
gint8 method[5];
@@ -399,23 +398,17 @@ void RS01Verify(Image *image)
/*** Examine the .iso file */
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
SetLabelText(GTK_LABEL(wl->cmpHeadline), "<big>%s</big>\n<i>%s</i>",
_("Comparing image and error correction files."),
_("- Checking image file -"));
#endif
GuiSetLabelText(wl->cmpHeadline, "<big>%s</big>\n<i>%s</i>",
_("Comparing image and error correction files."),
_("- Checking image file -"));
vc->image = image;
#ifndef WITH_CLI_ONLY_YES
if(image && image->eccFile)
{ if(Closure->guiMode)
SetLabelText(GTK_LABEL(wl->cmpChkSumErrors), "0");
{ GuiSetLabelText(wl->cmpChkSumErrors, "0");
}
else
{ GuiSetLabelText(wl->cmpChkSumErrors, _("n/a"));
}
else
if(Closure->guiMode)
SetLabelText(GTK_LABEL(wl->cmpChkSumErrors), _("n/a"));
#endif
/* Report basic image properties */
@@ -423,42 +416,32 @@ void RS01Verify(Image *image)
if(!image || !image->file)
{ PrintLog(_("not present\n"));
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
SwitchAndSetFootline(wl->cmpImageNotebook, 0, NULL, NULL);
#endif
GuiSwitchAndSetFootline(wl->cmpImageNotebook, 0, NULL, NULL);
goto process_ecc;
}
if(image->inLast == 2048)
{ PrintLog(_("present, contains %" PRId64 " medium sectors.\n"), image->sectorSize);
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
SetLabelText(GTK_LABEL(wl->cmpImageSectors), "%" PRId64 "", image->sectorSize);
#endif
GuiSetLabelText(wl->cmpImageSectors, "%" PRId64, image->sectorSize);
}
else
{ PrintLog(_("present, contains %" PRId64 " medium sectors and %d bytes.\n"),
image->sectorSize-1, image->inLast);
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
SetLabelText(GTK_LABEL(wl->cmpImageSectors), _("%" PRId64 " sectors + %d bytes"),
GuiSetLabelText(wl->cmpImageSectors, _("%" PRId64 " sectors + %d bytes"),
image->sectorSize-1, image->inLast);
#endif
}
if(!Closure->quickVerify)
RS01ScanImage(self, image, NULL, PRINT_MODE);
#ifndef WITH_CLI_ONLY_YES
if(Closure->stopActions)
{ if(Closure->stopActions == STOP_CURRENT_ACTION) /* suppress memleak warning when closing window */
SetLabelText(GTK_LABEL(wl->cmpImageResult),
_("<span %s>Aborted by user request!</span>"),
Closure->redMarkup);
goto terminate;
{ GuiSetLabelText(wl->cmpImageResult,
_("<span %s>Aborted by user request!</span>"),
Closure->redMarkup);
}
goto terminate;
}
#endif
/*** Peek into the ecc file to get expected sector count */
@@ -469,12 +452,9 @@ void RS01Verify(Image *image)
{ diff = image->expectedSectors - image->sectorSize;
PrintLog(_("* truncated image : %" PRId64 " sectors too short\n"), diff);
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
SetLabelText(GTK_LABEL(wl->cmpImageSectors),
_("<span %s>%" PRId64 " (%" PRId64 " sectors too short)</span>"),
Closure->redMarkup, image->sectorSize, diff);
#endif
GuiSetLabelText(wl->cmpImageSectors,
_("<span %s>%" PRId64 " (%" PRId64 " sectors too short)</span>"),
Closure->redMarkup, image->sectorSize, diff);
image->sectorsMissing += diff;
}
if(image->sectorSize > image->expectedSectors)
@@ -484,29 +464,24 @@ void RS01Verify(Image *image)
/*** Show summary of image read */
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
{ if(image->crcErrors)
SetLabelText(GTK_LABEL(wl->cmpChkSumErrors),
"<span %s>%" PRId64 "</span>", Closure->redMarkup, image->crcErrors);
if(image->sectorsMissing)
SetLabelText(GTK_LABEL(wl->cmpMissingSectors),
"<span %s>%" PRId64 "</span>", Closure->redMarkup, image->sectorsMissing);
if(image->crcErrors)
{ GuiSetLabelText(wl->cmpChkSumErrors,
"<span %s>%" PRId64 "</span>",
Closure->redMarkup, image->crcErrors);
}
if(image->sectorsMissing)
{ GuiSetLabelText(wl->cmpMissingSectors,
"<span %s>%" PRId64 "</span>",
Closure->redMarkup, image->sectorsMissing);
}
#endif
if(excess_sectors)
{ PrintLog(_("* image too long : %" PRId64 " excess sectors\n"), excess_sectors);
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
{ SetLabelText(GTK_LABEL(wl->cmpImageSectors),
_("<span %s>%" PRId64 " (%" PRId64 " excess sectors)</span>"),
Closure->redMarkup, image->sectorSize, excess_sectors);
SetLabelText(GTK_LABEL(wl->cmpImageResult),
_("<span %s>Bad image.</span>"),
Closure->redMarkup);
}
#endif
GuiSetLabelText(wl->cmpImageSectors,
_("<span %s>%" PRId64 " (%" PRId64 " excess sectors)</span>"),
Closure->redMarkup, image->sectorSize, excess_sectors);
GuiSetLabelText(wl->cmpImageResult,
_("<span %s>Bad image.</span>"),
Closure->redMarkup);
}
else if(Closure->quickVerify)
{ PrintLog(_("* quick mode : image NOT scanned\n"));
@@ -519,23 +494,15 @@ void RS01Verify(Image *image)
if(!image->crcErrors)
{ PrintLog(_("- good image : all sectors present\n"
"- image md5sum : %s\n"),idigest);
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
{ SetLabelText(GTK_LABEL(wl->cmpImageResult),_("<span %s>Good image.</span>"), Closure->greenMarkup);
SetLabelText(GTK_LABEL(wl->cmpImageMd5Sum), "%s", idigest);
}
#endif
GuiSetLabelText(wl->cmpImageResult,_("<span %s>Good image.</span>"), Closure->greenMarkup);
GuiSetLabelText(wl->cmpImageMd5Sum, "%s", idigest);
}
else
{ PrintLog(_("* suspicious image : all sectors present, but %" PRId64 " CRC errors\n"
"- image md5sum : %s\n"),image->crcErrors,idigest);
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
{ SetLabelText(GTK_LABEL(wl->cmpImageResult), _("<span %s>Image complete, but contains checksum errors!</span>"), Closure->redMarkup);
SetLabelText(GTK_LABEL(wl->cmpImageMd5Sum), "%s", idigest);
}
#endif
GuiSetLabelText(wl->cmpImageResult, _("<span %s>Image complete, but contains checksum errors!</span>"), Closure->redMarkup);
GuiSetLabelText(wl->cmpImageMd5Sum, "%s", idigest);
}
}
else /* sectors are missing */
@@ -543,33 +510,25 @@ void RS01Verify(Image *image)
PrintLog(_("* BAD image : %" PRId64 " sectors missing\n"), image->sectorsMissing);
else PrintLog(_("* BAD image : %" PRId64 " sectors missing, %" PRId64 " CRC errors\n"),
image->sectorsMissing, image->crcErrors);
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
SetLabelText(GTK_LABEL(wl->cmpImageResult),
GuiSetLabelText(wl->cmpImageResult,
_("<span %s>Bad image.</span>"), Closure->redMarkup);
#endif
}
}
/*** The .ecc file */
process_ecc:
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
SetLabelText(GTK_LABEL(wl->cmpHeadline), "<big>%s</big>\n<i>%s</i>",
_("Comparing image and error correction files."),
_("- Checking ecc file -"));
#endif
GuiSetLabelText(wl->cmpHeadline, "<big>%s</big>\n<i>%s</i>",
_("Comparing image and error correction files."),
_("- Checking ecc file -"));
PrintLog("\n%s: ", Closure->eccName);
if(!image)
{ PrintLog(_("not present\n"));
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
SwitchAndSetFootline(wl->cmpEccNotebook, 0,
wl->cmpEccEmptyMsg,_("No error correction file present."));
#endif
GuiSwitchAndSetFootline(wl->cmpEccNotebook, 0,
wl->cmpEccEmptyMsg,_("No error correction file present."));
goto skip_ecc;
}
@@ -595,11 +554,9 @@ process_ecc:
PrintLog(_("unusable\n"));
break;
}
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
SwitchAndSetFootline(wl->cmpEccNotebook, 0,
wl->cmpEccEmptyMsg,_("No error correction file present."));
#endif
GuiSwitchAndSetFootline(wl->cmpEccNotebook, 0,
wl->cmpEccEmptyMsg,_("No error correction file present."));
goto skip_ecc;
}
@@ -625,35 +582,25 @@ process_ecc:
PrintLog(format, _("created by dvdisaster"), major, minor, micro, unstable);
PrintLog("\n");
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
{ SwitchAndSetFootline(wl->cmpEccNotebook, 1,
GuiSwitchAndSetFootline(wl->cmpEccNotebook, 1,
wl->cmpEccCreatedBy,
format, "dvdisaster",
major, minor, micro, unstable);
}
#endif
}
else /* version format x.xx */
{ char *format = "%s-%d.%d%s";
PrintLog(format, _("created by dvdisaster"),
major, minor, unstable);
PrintLog("\n");
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
SwitchAndSetFootline(wl->cmpEccNotebook, 1,
wl->cmpEccCreatedBy, format, "dvdisaster",
major, minor, unstable);
#endif
GuiSwitchAndSetFootline(wl->cmpEccNotebook, 1,
wl->cmpEccCreatedBy, format, "dvdisaster",
major, minor, unstable);
}
}
else
{ PrintLog(_("created by dvdisaster-0.41.x.\n"));
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
SwitchAndSetFootline(wl->cmpEccNotebook, 1,
wl->cmpEccCreatedBy, "dvdisaster-0.41.x");
#endif
GuiSwitchAndSetFootline(wl->cmpEccNotebook, 1,
wl->cmpEccCreatedBy, "dvdisaster-0.41.x");
}
/* Information on RS01 properties */
@@ -663,12 +610,10 @@ process_ecc:
PrintLog(_("- method : %4s, %d roots, %4.1f%% redundancy.\n"),
method, eh->eccBytes,
((double)eh->eccBytes*100.0)/(double)eh->dataBytes);
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
SetLabelText(GTK_LABEL(wl->cmpEccMethod), _("%4s, %d roots, %4.1f%% redundancy"),
method, eh->eccBytes,
((double)eh->eccBytes*100.0)/(double)eh->dataBytes);
#endif
GuiSetLabelText(wl->cmpEccMethod, _("%4s, %d roots, %4.1f%% redundancy"),
method, eh->eccBytes,
((double)eh->eccBytes*100.0)/(double)eh->dataBytes);
/* Show and verify needed version */
@@ -676,12 +621,9 @@ process_ecc:
{ PrintLog(_("- requires : dvdisaster-%d.%d (good)\n"),
eh->neededVersion/10000,
(eh->neededVersion%10000)/100);
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
SetLabelText(GTK_LABEL(wl->cmpEccRequires), "dvdisaster-%d.%d",
eh->neededVersion/10000,
(eh->neededVersion%10000)/100);
#endif
GuiSetLabelText(wl->cmpEccRequires, "dvdisaster-%d.%d",
eh->neededVersion/10000,
(eh->neededVersion%10000)/100);
}
else
{ PrintLog(_("* requires : dvdisaster-%d.%d (BAD)\n"
@@ -690,17 +632,13 @@ process_ecc:
eh->neededVersion/10000,
(eh->neededVersion%10000)/100);
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
{ SetLabelText(GTK_LABEL(wl->cmpEccRequires),
"<span %s>dvdisaster-%d.%d</span>",
Closure->redMarkup,
eh->neededVersion/10000,
(eh->neededVersion%10000)/100);
if(!ecc_advice)
ecc_advice = g_strdup_printf(_("<span %s>Please upgrade your version of dvdisaster!</span>"), Closure->redMarkup);
}
#endif
GuiSetLabelText(wl->cmpEccRequires,
"<span %s>dvdisaster-%d.%d</span>",
Closure->redMarkup,
eh->neededVersion/10000,
(eh->neededVersion%10000)/100);
if(!ecc_advice)
ecc_advice = g_strdup_printf(_("<span %s>Please upgrade your version of dvdisaster!</span>"), Closure->redMarkup);
}
@@ -712,21 +650,15 @@ process_ecc:
if(!image->file)
{ if(!ecc_in_last)
{ PrintLog(_("- medium sectors : %" PRId64 "\n"), image->expectedSectors);
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
SetLabelText(GTK_LABEL(wl->cmpEccMediumSectors), "%" PRId64 "", image->expectedSectors);
#endif
GuiSetLabelText(wl->cmpEccMediumSectors, "%" PRId64 "", image->expectedSectors);
}
else
{ PrintLog(_("- medium sectors : %" PRId64 " sectors + %d bytes\n"),
image->expectedSectors-1, ecc_in_last);
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
SetLabelText(GTK_LABEL(wl->cmpEccMediumSectors),
_("%" PRId64 " sectors + %d bytes"),
image->expectedSectors-1, ecc_in_last);
#endif
}
GuiSetLabelText(wl->cmpEccMediumSectors,
_("%" PRId64 " sectors + %d bytes"),
image->expectedSectors-1, ecc_in_last);
}
}
if(image->file)
@@ -735,20 +667,14 @@ process_ecc:
&& (!ecc_in_last || image->inLast == eh->inLast))
{ if(!ecc_in_last)
{ PrintLog(_("- medium sectors : %" PRId64 " (good)\n"), image->expectedSectors);
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
SetLabelText(GTK_LABEL(wl->cmpEccMediumSectors), "%" PRId64 "", image->expectedSectors);
#endif
GuiSetLabelText(wl->cmpEccMediumSectors, "%" PRId64, image->expectedSectors);
}
else
{ PrintLog(_("- medium sectors : %" PRId64 " sectors + %d bytes (good)\n"),
image->expectedSectors-1, ecc_in_last);
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
SetLabelText(GTK_LABEL(wl->cmpEccMediumSectors),
_("%" PRId64 " sectors + %d bytes"),
image->expectedSectors-1, ecc_in_last);
#endif
GuiSetLabelText(wl->cmpEccMediumSectors,
_("%" PRId64 " sectors + %d bytes"),
image->expectedSectors-1, ecc_in_last);
}
}
@@ -756,40 +682,31 @@ process_ecc:
{ /* TAO case (1 or 2 sectors more than expected) */
if(image->sectorSize > image->expectedSectors && image->sectorSize - image->expectedSectors <= 2)
{ PrintLog(_("* medium sectors : %" PRId64 " (BAD, perhaps TAO/DAO mismatch)\n"), image->expectedSectors);
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
{ if(!ecc_in_last)
SetLabelText(GTK_LABEL(wl->cmpEccMediumSectors), "<span %s>%" PRId64 "</span>",
Closure->redMarkup, image->expectedSectors);
else SetLabelText(GTK_LABEL(wl->cmpEccMediumSectors), "<span %s>%" PRId64 " sectors + %d bytes</span>",
Closure->redMarkup, image->expectedSectors-1, ecc_in_last);
if(!ecc_in_last)
{ GuiSetLabelText(wl->cmpEccMediumSectors, "<span %s>%" PRId64 "</span>",
Closure->redMarkup, image->expectedSectors);
}
else
{ GuiSetLabelText(wl->cmpEccMediumSectors, "<span %s>%" PRId64 " sectors + %d bytes</span>",
Closure->redMarkup, image->expectedSectors-1, ecc_in_last);
}
#endif
}
else /* more than 2 Sectors difference */
{ if(!ecc_in_last)
{ PrintLog(_("* medium sectors : %" PRId64 " (BAD)\n"), image->expectedSectors);
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
{ SetLabelText(GTK_LABEL(wl->cmpEccMediumSectors), "<span %s>%" PRId64 "</span>",
GuiSetLabelText(wl->cmpEccMediumSectors, "<span %s>%" PRId64 "</span>",
Closure->redMarkup, image->expectedSectors);
if(!ecc_advice)
ecc_advice = g_strdup_printf(_("<span %s>Image size does not match error correction file.</span>"), Closure->redMarkup);
}
#endif
if(!ecc_advice)
ecc_advice = g_strdup_printf(_("<span %s>Image size does not match error correction file.</span>"), Closure->redMarkup);
}
else /* byte size difference */
{ PrintLog(_("* medium sectors : %" PRId64 " sectors + %d bytes (BAD)\n"),
image->expectedSectors-1, ecc_in_last);
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
{ SetLabelText(GTK_LABEL(wl->cmpEccMediumSectors),
GuiSetLabelText(wl->cmpEccMediumSectors,
_("<span %s>%" PRId64 " sectors + %d bytes</span>"),
Closure->redMarkup, image->expectedSectors-1, ecc_in_last);
if(!ecc_advice)
ecc_advice = g_strdup_printf(_("<span %s>Image size does not match error correction file.</span>"), Closure->redMarkup);
}
#endif
if(!ecc_advice)
ecc_advice = g_strdup_printf(_("<span %s>Image size does not match error correction file.</span>"), Closure->redMarkup);
}
}
}
@@ -801,56 +718,45 @@ process_ecc:
{ AsciiDigest(edigest, eh->mediumSum);
if(image && image->file && !image->sectorsMissing && !excess_sectors)
{ int n = !memcmp(eh->mediumSum, image->mediumSum, 16);
if(n) PrintLog(_("- image md5sum : %s (good)\n"),edigest);
else PrintLog(_("* image md5sum : %s (BAD)\n"),edigest);
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
{ if(n) SetLabelText(GTK_LABEL(wl->cmpEccImgMd5Sum), "%s", edigest);
else
{ SetLabelText(GTK_LABEL(wl->cmpEccImgMd5Sum), "<span %s>%s</span>", Closure->redMarkup, edigest);
SetLabelText(GTK_LABEL(wl->cmpImageMd5Sum), "<span %s>%s</span>", Closure->redMarkup, idigest);
}
if(n)
{ PrintLog(_("- image md5sum : %s (good)\n"),edigest);
GuiSetLabelText(wl->cmpEccImgMd5Sum, "%s", edigest);
}
else
{ PrintLog(_("* image md5sum : %s (BAD)\n"),edigest);
GuiSetLabelText(wl->cmpEccImgMd5Sum, "<span %s>%s</span>",
Closure->redMarkup, edigest);
GuiSetLabelText(wl->cmpImageMd5Sum, "<span %s>%s</span>",
Closure->redMarkup, idigest);
}
#endif
}
else
{ PrintLog(_("- image md5sum : %s\n"),edigest);
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
SetLabelText(GTK_LABEL(wl->cmpEccImgMd5Sum), "%s", edigest);
#endif
GuiSetLabelText(wl->cmpEccImgMd5Sum, "%s", edigest);
}
}
if(image && image->file)
{ if(image->fpState != FP_PRESENT)
{ PrintLog(_("* fingerprint match: NOT POSSIBLE - related sector is missing in image!\n"));
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
SetLabelText(GTK_LABEL(wl->cmpEccFingerprint), _("<span %s>missing sector prevents calculation</span>"), Closure->redMarkup);
#endif
GuiSetLabelText(wl->cmpEccFingerprint,
_("<span %s>missing sector prevents calculation</span>"),
Closure->redMarkup);
}
else
{
if(memcmp(image->imageFP, eh->mediumFP, 16))
{ PrintLog(_("* fingerprint match: MISMATCH - .iso and .ecc don't belong together!\n"));
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
{ SetLabelText(GTK_LABEL(wl->cmpEccFingerprint),
GuiSetLabelText(wl->cmpEccFingerprint,
_("<span %s>mismatch</span>"), Closure->redMarkup);
if(!ecc_advice)
ecc_advice = g_strdup_printf(_("<span %s>Image and error correction files do not belong together!</span>"), Closure->redMarkup);
}
#endif
if(!ecc_advice)
ecc_advice = g_strdup_printf(_("<span %s>Image and error correction files do not belong together!</span>"), Closure->redMarkup);
}
else
{ PrintLog(_("- fingerprint match: good\n"));
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
SetLabelText(GTK_LABEL(wl->cmpEccFingerprint), _("good"));
#endif
GuiSetLabelText(wl->cmpEccFingerprint, _("good"));
}
}
}
@@ -867,17 +773,14 @@ process_ecc:
if(ecc_expected == ecc_blocks)
{ PrintLog(_("- ecc blocks : %" PRId64 " (good)\n"),ecc_blocks);
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
SetLabelText(GTK_LABEL(wl->cmpEccBlocks), "%" PRId64 "", ecc_blocks);
#endif
GuiSetLabelText(wl->cmpEccBlocks, "%" PRId64, ecc_blocks);
}
else
{ PrintLog(_("* ecc blocks : %" PRId64 " (BAD, expected %" PRId64 ")\n"),ecc_blocks,ecc_expected);
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
SetLabelText(GTK_LABEL(wl->cmpEccBlocks), _("<span %s>%" PRId64 " (bad, expected %" PRId64 ")</span>"),Closure->redMarkup,ecc_blocks,ecc_expected);
#endif
{ PrintLog(_("* ecc blocks : %" PRId64 " (BAD, expected %" PRId64 ")\n"),
ecc_blocks,ecc_expected);
GuiSetLabelText(wl->cmpEccBlocks,
_("<span %s>%" PRId64 " (bad, expected %" PRId64 ")</span>"),
Closure->redMarkup,ecc_blocks,ecc_expected);
}
/*** Test ecc file against its own md5sum */
@@ -898,25 +801,18 @@ process_ecc:
count += n;
percent = (100*count)/image->eccFile->size;
if(last_percent != percent)
{
#ifndef WITH_CLI_ONLY_YES
if(!Closure->guiMode)
#endif
PrintProgress(_("- ecc md5sum : %3d%%"),percent);
#ifndef WITH_CLI_ONLY_YES
else SetLabelText(GTK_LABEL(wl->cmpEccMd5Sum), "%3d%%", percent);
#endif
{ PrintProgress(_("- ecc md5sum : %3d%%"),percent);
GuiSetLabelText(wl->cmpEccMd5Sum, "%3d%%", percent);
last_percent = percent;
}
#ifndef WITH_CLI_ONLY_YES
if(Closure->stopActions)
{ if(Closure->stopActions == STOP_CURRENT_ACTION) /* suppress memleak warning when closing window */
SetLabelText(GTK_LABEL(wl->cmpEccResult),
_("<span %s>Aborted by user request!</span>"), Closure->redMarkup);
{ GuiSetLabelText(wl->cmpEccResult,
_("<span %s>Aborted by user request!</span>"), Closure->redMarkup);
}
goto terminate;
}
#endif
}
MD5Final(digest, &md5ctxt);
@@ -924,36 +820,27 @@ process_ecc:
if(memcmp(eh->eccSum, digest, 16))
{ PrintLog(_("* ecc md5sum : BAD, ecc file may be damaged!\n"));
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
{ SetLabelText(GTK_LABEL(wl->cmpEccMd5Sum), _("<span %s>bad</span>"), Closure->redMarkup);
if(!ecc_advice)
ecc_advice = g_strdup_printf(_("<span %s>Error correction file may be damaged!</span>"), Closure->redMarkup);
}
#endif
GuiSetLabelText(wl->cmpEccMd5Sum, _("<span %s>bad</span>"), Closure->redMarkup);
if(!ecc_advice)
ecc_advice = g_strdup_printf(_("<span %s>Error correction file may be damaged!</span>"), Closure->redMarkup);
}
else
{ PrintLog(_("- ecc md5sum : %s (good)\n"),edigest);
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
SetLabelText(GTK_LABEL(wl->cmpEccMd5Sum), "%s", edigest);
#endif
GuiSetLabelText(wl->cmpEccMd5Sum, "%s", edigest);
}
skip_ecc:
PrintLog("\n");
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
{ if(ecc_advice)
{ SetLabelText(GTK_LABEL(wl->cmpEccResult), "%s", ecc_advice);
g_free(ecc_advice);
}
else SetLabelText(GTK_LABEL(wl->cmpEccResult),
_("<span %s>Good error correction file.</span>"),
Closure->greenMarkup);
if(ecc_advice)
{ GuiSetLabelText(wl->cmpEccResult, "%s", ecc_advice);
g_free(ecc_advice);
}
else
{ GuiSetLabelText(wl->cmpEccResult,
_("<span %s>Good error correction file.</span>"),
Closure->greenMarkup);
}
#endif
/*** Close and clean up */

View File

@@ -19,7 +19,10 @@
* You should have received a copy of the GNU General Public License
* along with dvdisaster. If not, see <http://www.gnu.org/licenses/>.
*/
// DVDISASTER_GUI_FILE
/*** src type: only GUI code ***/
#ifdef WITH_GUI_YES
#include "dvdisaster.h"
@@ -57,8 +60,8 @@ static void set_spin_button_value(GtkSpinButton *spin, int value)
void ResetRS01EncodeWindow(Method *method)
{ RS01Widgets *wl = (RS01Widgets*)method->widgetList;
SetProgress(wl->encPBar1, 0, 100);
SetProgress(wl->encPBar2, 0, 100);
GuiSetProgress(wl->encPBar1, 0, 100);
GuiSetProgress(wl->encPBar2, 0, 100);
gtk_widget_hide(wl->encLabel2);
gtk_widget_hide(wl->encPBar2);
@@ -103,15 +106,9 @@ static gboolean curve_button_cb(GtkWidget *wid, gpointer action)
*/
void CreateRS01EWindow(Method *method, GtkWidget *parent)
{ RS01Widgets *wl;
{ RS01Widgets *wl = method->widgetList;
GtkWidget *sep,*wid,*pbar,*table,*hbox;
if(!method->widgetList)
{ wl = g_malloc0(sizeof(RS01Widgets));
method->widgetList = wl;
}
else wl = method->widgetList;
wl->encHeadline = gtk_label_new(NULL);
gtk_misc_set_alignment(GTK_MISC(wl->encHeadline), 0.0, 0.0);
gtk_misc_set_padding(GTK_MISC(wl->encHeadline), 5, 0);
@@ -200,9 +197,9 @@ void RS01SetFixMaxValues(RS01Widgets *wl, int data_bytes, int ecc_bytes, gint64
static gboolean results_idle_func(gpointer data)
{ RS01Widgets *wl = (RS01Widgets*)data;
SetLabelText(GTK_LABEL(wl->fixCorrected), _("Repaired: %" PRId64 ""), wl->corrected);
SetLabelText(GTK_LABEL(wl->fixUncorrected), _("Unrepairable: <span %s>%" PRId64 "</span>"),Closure->redMarkup, wl->uncorrected);
SetLabelText(GTK_LABEL(wl->fixProgress), _("Progress: %3d.%1d%%"), wl->percent/10, wl->percent%10);
GuiSetLabelText(wl->fixCorrected, _("Repaired: %" PRId64), wl->corrected);
GuiSetLabelText(wl->fixUncorrected, _("Unrepairable: <span %s>%" PRId64 "</span>"),Closure->redMarkup, wl->uncorrected);
GuiSetLabelText(wl->fixProgress, _("Progress: %3d.%1d%%"), wl->percent/10, wl->percent%10);
return FALSE;
}
@@ -221,9 +218,9 @@ void RS01UpdateFixResults(RS01Widgets *wl, gint64 corrected, gint64 uncorrected)
static gboolean curve_idle_func(gpointer data)
{ RS01Widgets *wl = (RS01Widgets*)data;
gint x0 = CurveX(wl->fixCurve, (double)wl->lastPercent);
gint x1 = CurveX(wl->fixCurve, (double)wl->percent);
gint y = CurveY(wl->fixCurve, wl->fixCurve->ivalue[wl->percent]);
gint x0 = GuiCurveX(wl->fixCurve, (double)wl->lastPercent);
gint x1 = GuiCurveX(wl->fixCurve, (double)wl->percent);
gint y = GuiCurveY(wl->fixCurve, wl->fixCurve->ivalue[wl->percent]);
gint i;
/*** Mark unused ecc values */
@@ -257,7 +254,7 @@ static gboolean curve_idle_func(gpointer data)
/* Redraw the ecc capacity threshold line */
y = CurveY(wl->fixCurve, wl->eccBytes);
y = GuiCurveY(wl->fixCurve, wl->eccBytes);
gdk_gc_set_rgb_fg_color(Closure->drawGC, Closure->greenSector);
gdk_draw_line(wl->fixCurve->widget->window,
Closure->drawGC,
@@ -289,7 +286,7 @@ static void update_geometry(RS01Widgets *wl)
{
/* Curve geometry */
UpdateCurveGeometry(wl->fixCurve, "999", 20);
GuiUpdateCurveGeometry(wl->fixCurve, "999", 20);
/* Label positions in the foot line */
@@ -304,12 +301,12 @@ static void redraw_curve(RS01Widgets *wl)
/* Redraw the curve */
RedrawAxes(wl->fixCurve);
RedrawCurve(wl->fixCurve, wl->percent);
GuiRedrawAxes(wl->fixCurve);
GuiRedrawCurve(wl->fixCurve, wl->percent);
/* Ecc capacity threshold line */
y = CurveY(wl->fixCurve, wl->eccBytes);
y = GuiCurveY(wl->fixCurve, wl->eccBytes);
gdk_gc_set_rgb_fg_color(Closure->drawGC, Closure->greenSector);
gdk_draw_line(wl->fixCurve->widget->window,
Closure->drawGC,
@@ -342,7 +339,7 @@ void ResetRS01FixWindow(Method *method)
gtk_notebook_set_current_page(GTK_NOTEBOOK(wl->fixNotebook), 0);
ZeroCurve(wl->fixCurve);
GuiZeroCurve(wl->fixCurve);
RS01UpdateFixResults(wl, 0, 0);
if(wl->fixCurve && wl->fixCurve->widget)
@@ -359,15 +356,9 @@ void ResetRS01FixWindow(Method *method)
*/
void CreateRS01FWindow(Method *method, GtkWidget *parent)
{ RS01Widgets *wl;
{ RS01Widgets *wl = method->widgetList;
GtkWidget *sep,*ignore,*d_area,*notebook,*hbox;
if(!method->widgetList)
{ wl = g_malloc0(sizeof(RS01Widgets));
method->widgetList = wl;
}
else wl = method->widgetList;
wl->fixHeadline = gtk_label_new(NULL);
gtk_misc_set_alignment(GTK_MISC(wl->fixHeadline), 0.0, 0.0);
gtk_misc_set_padding(GTK_MISC(wl->fixHeadline), 5, 0);
@@ -411,7 +402,7 @@ void CreateRS01FWindow(Method *method, GtkWidget *parent)
ignore = gtk_label_new("footer_tab");
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), wl->fixFootline, ignore);
wl->fixCurve = CreateCurve(d_area, _("Errors/Ecc block"), "%d", 1000, CURVE_PERCENT);
wl->fixCurve = GuiCreateCurve(d_area, _("Errors/Ecc block"), "%d", 1000, CURVE_PERCENT);
wl->fixCurve->enable = DRAW_ICURVE;
}
@@ -468,8 +459,8 @@ static void cache_cb(GtkWidget *widget, gpointer data)
utf = g_locale_to_utf8(text, -1, NULL, NULL, NULL);
gtk_label_set_markup(GTK_LABEL(lwoh->normalLabel), utf);
gtk_label_set_markup(GTK_LABEL(lwoh->linkLabel), utf);
SetOnlineHelpLinkText(lwoh, text);
UpdateMethodPreferences();
GuiSetOnlineHelpLinkText(lwoh, text);
GuiUpdateMethodPreferences();
g_free(text);
g_free(utf);
}
@@ -486,7 +477,7 @@ static void nroots_cb(GtkWidget *widget, gpointer data)
set_range_value(GTK_RANGE(wl->redundancyScaleB), value);
else set_range_value(GTK_RANGE(wl->redundancyScaleA), value);
UpdateMethodPreferences();
GuiUpdateMethodPreferences();
}
static void ecc_size_cb(GtkWidget *widget, gpointer data)
@@ -501,7 +492,7 @@ static void ecc_size_cb(GtkWidget *widget, gpointer data)
gtk_spin_button_set_value(GTK_SPIN_BUTTON(wl->redundancySpinB), atoi(Closure->redundancy));
else gtk_spin_button_set_value(GTK_SPIN_BUTTON(wl->redundancySpinA), atoi(Closure->redundancy));
UpdateMethodPreferences();
GuiUpdateMethodPreferences();
}
static void toggle_cb(GtkWidget *widget, gpointer data)
@@ -580,7 +571,7 @@ static void toggle_cb(GtkWidget *widget, gpointer data)
Closure->redundancy = g_strdup_printf("%dm", space);
}
UpdateMethodPreferences();
GuiUpdateMethodPreferences();
}
}
@@ -675,8 +666,8 @@ void CreateRS01PrefsPage(Method *method, GtkWidget *parent)
/* Normal redundancy */
lwoh = CreateLabelWithOnlineHelp(_("Normal redundancy"), _("Normal"));
RegisterPreferencesHelpWindow(lwoh);
lwoh = GuiCreateLabelWithOnlineHelp(_("Normal redundancy"), _("Normal"));
GuiRegisterPreferencesHelpWindow(lwoh);
for(i=0; i<2; i++)
{ GtkWidget *hbox = gtk_hbox_new(FALSE, 4);
@@ -694,19 +685,19 @@ void CreateRS01PrefsPage(Method *method, GtkWidget *parent)
else
{ wl->radio1B = radio;
gtk_box_pack_start(GTK_BOX(hbox), lwoh->normalLabel, FALSE, FALSE, 0);
AddHelpWidget(lwoh, hbox);
GuiAddHelpWidget(lwoh, hbox);
}
}
AddHelpParagraph(lwoh, _("<b>Normal redundancy</b>\n\n"
"The preset \"normal\" creates a redundancy of 14.3%%.\n"
"It invokes optimized program code to speed up the "
"error correction file creation."));
GuiAddHelpParagraph(lwoh, _("<b>Normal redundancy</b>\n\n"
"The preset \"normal\" creates a redundancy of 14.3%%.\n"
"It invokes optimized program code to speed up the "
"error correction file creation."));
/* High redundancy */
lwoh = CreateLabelWithOnlineHelp(_("High redundancy"), _("High"));
RegisterPreferencesHelpWindow(lwoh);
lwoh = GuiCreateLabelWithOnlineHelp(_("High redundancy"), _("High"));
GuiRegisterPreferencesHelpWindow(lwoh);
for(i=0; i<2; i++)
{ GtkWidget *hbox = gtk_hbox_new(FALSE, 4);
@@ -724,20 +715,20 @@ void CreateRS01PrefsPage(Method *method, GtkWidget *parent)
else
{ wl->radio2B = radio;
gtk_box_pack_start(GTK_BOX(hbox), lwoh->normalLabel, FALSE, FALSE, 0);
AddHelpWidget(lwoh, hbox);
GuiAddHelpWidget(lwoh, hbox);
}
}
AddHelpParagraph(lwoh, _("<b>High redundancy</b>\n\n"
"The preset \"high\" creates a redundancy of 33.5%%.\n"
"It invokes optimized program code to speed up the "
"error correction file creation."));
GuiAddHelpParagraph(lwoh, _("<b>High redundancy</b>\n\n"
"The preset \"high\" creates a redundancy of 33.5%%.\n"
"It invokes optimized program code to speed up the "
"error correction file creation."));
/* User-selected redundancy */
lwoh = CreateLabelWithOnlineHelp(_("Other redundancy"), _("Other"));
RegisterPreferencesHelpWindow(lwoh);
lwoh = GuiCreateLabelWithOnlineHelp(_("Other redundancy"), _("Other"));
GuiRegisterPreferencesHelpWindow(lwoh);
for(i=0; i<2; i++)
{ hbox = gtk_hbox_new(FALSE, 4);
@@ -771,20 +762,21 @@ void CreateRS01PrefsPage(Method *method, GtkWidget *parent)
}
else
{ wl->redundancyScaleB = scale;
AddHelpWidget(lwoh, hbox);
GuiAddHelpWidget(lwoh, hbox);
}
}
AddHelpParagraph(lwoh, _("<b>Other redundancy</b>\n\n"
"Specifies the redundancy by percent.\n"
"An error correction file with x%% redundancy "
"will be approximately x%% of the size of the "
"corresponding image file."));
GuiAddHelpParagraph(lwoh, _("<b>Other redundancy</b>\n\n"
"Specifies the redundancy by percent.\n"
"An error correction file with x%% redundancy "
"will be approximately x%% of the size of the "
"corresponding image file."));
/* Space-delimited redundancy */
lwoh = CreateLabelWithOnlineHelp(_("Space-delimited redundancy"), _("Use at most"));
RegisterPreferencesHelpWindow(lwoh);
lwoh = GuiCreateLabelWithOnlineHelp(_("Space-delimited redundancy"),
_("Use at most"));
GuiRegisterPreferencesHelpWindow(lwoh);
for(i=0; i<2; i++)
{ hbox = gtk_hbox_new(FALSE, 4);
@@ -821,18 +813,18 @@ void CreateRS01PrefsPage(Method *method, GtkWidget *parent)
else
{ wl->redundancySpinB = spin;
wl->radio4LabelB = lab;
AddHelpWidget(lwoh, hbox);
GuiAddHelpWidget(lwoh, hbox);
}
}
AddHelpParagraph(lwoh, _("<b>Space-delimited redundancy</b>\n\n"
"Specifies the maximum size of the error correction file in MiB. "
"dvdisaster will choose a suitable redundancy setting so that "
"the overall size of the error correction file does not exceed "
"the given limit.\n\n"
"<b>Advance notice:</b> When using the same size setting for "
"images of vastly different size, smaller images receive more "
"redundancy than larger ones. This is usually not what you want."));
GuiAddHelpParagraph(lwoh, _("<b>Space-delimited redundancy</b>\n\n"
"Specifies the maximum size of the error correction file in MiB. "
"dvdisaster will choose a suitable redundancy setting so that "
"the overall size of the error correction file does not exceed "
"the given limit.\n\n"
"<b>Advance notice:</b> When using the same size setting for "
"images of vastly different size, smaller images receive more "
"redundancy than larger ones. This is usually not what you want."));
/*** Preset redundancy values */
@@ -872,13 +864,13 @@ void CreateRS01PrefsPage(Method *method, GtkWidget *parent)
gtk_box_pack_start(GTK_BOX(parent), frame, FALSE, FALSE, 0);
text = g_strdup_printf(_("%d MiB of file cache"), Closure->cacheMiB);
lwoh = CreateLabelWithOnlineHelp(_("File cache"), text);
RegisterPreferencesHelpWindow(lwoh);
lwoh = GuiCreateLabelWithOnlineHelp(_("File cache"), text);
GuiRegisterPreferencesHelpWindow(lwoh);
g_free(text);
wl->cacheLwoh = lwoh;
LockLabelSize(GTK_LABEL(lwoh->normalLabel), _utf("%d MiB of file cache"), 2222);
LockLabelSize(GTK_LABEL(lwoh->linkLabel), _utf("%d MiB of file cache"), 2222);
GuiLockLabelSize(lwoh->normalLabel, _utf("%d MiB of file cache"), 2222);
GuiLockLabelSize(lwoh->linkLabel, _utf("%d MiB of file cache"), 2222);
for(i=0; i<2; i++)
{ GtkWidget *hbox = gtk_hbox_new(FALSE, 4);
@@ -909,12 +901,14 @@ void CreateRS01PrefsPage(Method *method, GtkWidget *parent)
else
{ wl->cacheScaleB = scale;
gtk_box_pack_start(GTK_BOX(hbox), lwoh->normalLabel, FALSE, FALSE, 0);
AddHelpWidget(lwoh, hbox);
GuiAddHelpWidget(lwoh, hbox);
}
}
AddHelpParagraph(lwoh, _("<b>File cache</b>\n\n"
"dvdisaster optimizes access to the image and error correction "
"files by maintaining its own cache. "
"The preset of 32MiB is suitable for most systems."));
GuiAddHelpParagraph(lwoh, _("<b>File cache</b>\n\n"
"dvdisaster optimizes access to the image and error correction "
"files by maintaining its own cache. "
"The preset of 32MiB is suitable for most systems."));
}
#endif /* WITH_GUI_YES */

View File

@@ -20,6 +20,8 @@
* along with dvdisaster. If not, see <http://www.gnu.org/licenses/>.
*/
/*** src type: no GUI code ***/
#include "dvdisaster.h"
#include "rs02-includes.h"
@@ -432,19 +434,15 @@ RS02Layout *CalcRS02Layout(Image *image)
/* See if user wants to pick a certain redundancy */
#ifndef WITH_CLI_ONLY_YES
if(!Closure->guiMode && Closure->redundancy)
#else
if(Closure->redundancy)
#endif
{ int len = strlen(Closure->redundancy);
switch(Closure->redundancy[len-1])
{ case 'r': /* pick number of roots */
{ char buf[len+1];
{ char buf[len];
memcpy(buf, Closure->redundancy, len-1);
buf[len-1]=0;
buf[len-1]=0; /* strip off the 'r' */
requested_roots = atoi(buf);
break;
}
@@ -453,7 +451,7 @@ RS02Layout *CalcRS02Layout(Image *image)
int percent;
memcpy(buf, Closure->redundancy, len-1);
buf[len-1]=0;
buf[len-1]=0; /* strip off the '%' */
percent = atoi(buf);
for(requested_roots = 7; requested_roots < 171; requested_roots++)

View File

@@ -20,6 +20,8 @@
* along with dvdisaster. If not, see <http://www.gnu.org/licenses/>.
*/
/*** src type: some GUI code ***/
#include "dvdisaster.h"
#include "rs02-includes.h"
@@ -31,9 +33,7 @@
typedef struct
{ Image *image;
Method *self;
#ifndef WITH_CLI_ONLY_YES
RS02Widgets *wl;
#endif
RS02Layout *lay;
GaloisTables *gt;
ReedSolomonTables *rt;
@@ -56,15 +56,12 @@ static void ecc_cleanup(gpointer data)
UnregisterCleanup();
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
{ if(ec->earlyTermination && ec->wl)
SetLabelText(GTK_LABEL(ec->wl->encFootline),
_("<span %s>Aborted by unrecoverable error.</span>"),
Closure->redMarkup);
AllowActions(TRUE);
if(ec->earlyTermination && ec->wl)
{ GuiSetLabelText(ec->wl->encFootline,
_("<span %s>Aborted by unrecoverable error.</span>"),
Closure->redMarkup);
}
#endif
GuiAllowActions(TRUE);
/*** We must invalidate the CRC cache as it does only cover the
data portion of the image, not the full RS02 enhanced image. */
@@ -92,10 +89,7 @@ static void ecc_cleanup(gpointer data)
g_free(ec);
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
g_thread_exit(0);
#endif
GuiExitWorkerThread();
}
/***
@@ -107,30 +101,24 @@ static void ecc_cleanup(gpointer data)
*/
static void abort_encoding(ecc_closure *ec, int truncate)
{
#ifndef WITH_CLI_ONLY_YES
RS02Widgets *wl = ec->wl;
#endif
{
if(truncate && ec->lay)
{ if(!LargeTruncate(ec->image->file, (gint64)(2048*ec->lay->dataSectors)))
Stop(_("Could not truncate %s: %s\n"),Closure->imageName,strerror(errno));
#ifndef WITH_CLI_ONLY_YES
if(Closure->stopActions == STOP_CURRENT_ACTION)
SetLabelText(GTK_LABEL(wl->encFootline),
_("<span %s>Aborted by user request!</span> (partial ecc data removed from image)"),
Closure->redMarkup);
#endif
{ GuiSetLabelText(ec->wl->encFootline,
_("<span %s>Aborted by user request!</span> (partial ecc data removed from image)"),
Closure->redMarkup);
}
}
#ifndef WITH_CLI_ONLY_YES
else
{ if(Closure->stopActions == STOP_CURRENT_ACTION)
SetLabelText(GTK_LABEL(wl->encFootline),
_("<span %s>Aborted by user request!</span>"),
Closure->redMarkup);
{ GuiSetLabelText(ec->wl->encFootline,
_("<span %s>Aborted by user request!</span>"),
Closure->redMarkup);
}
}
#endif
ec->earlyTermination = FALSE; /* suppress respective error message */
@@ -149,16 +137,12 @@ static void remove_old_ecc(ecc_closure *ec)
guint64 data_bytes;
int answer;
#ifndef WITH_CLI_ONLY_YES
if(Closure->confirmDeletion || !Closure->guiMode)
#endif
answer = ModalWarningOrCLI(GTK_MESSAGE_WARNING, GTK_BUTTONS_OK_CANCEL, NULL,
answer = ModalWarning(GTK_MESSAGE_WARNING, GTK_BUTTONS_OK_CANCEL, NULL,
_("Image \"%s\" already contains error correction information.\n"
"Truncating image to data part (%" PRId64 " sectors).\n"),
Closure->imageName, data_sectors);
#ifndef WITH_CLI_ONLY_YES
else answer = TRUE;
#endif
if(!answer)
abort_encoding(ec, FALSE);
@@ -194,7 +178,7 @@ static void check_image(ecc_closure *ec)
Otherwise create a new buffer.
*/
if(CrcBufValid(Closure->crcBuf, NULL, NULL))
if(CrcBufValid(Closure->crcBuf, image, DATA_SECTORS_ONLY))
{ ec->checksumsReused=TRUE;
memcpy(image->mediumSum, Closure->crcBuf->dataMD5sum, 16);
return;
@@ -213,10 +197,8 @@ static void check_image(ecc_closure *ec)
{ unsigned char buf[2048];
int expected,n,err;
#ifndef WITH_CLI_ONLY_YES
if(Closure->stopActions) /* User hit the Stop button */
abort_encoding(ec, FALSE);
#endif
if(sectors < image->sectorSize-1) expected = 2048;
else
@@ -256,10 +238,7 @@ static void check_image(ecc_closure *ec)
if(last_percent != percent)
{ PrintProgress(_("Preparing image (checksums, adding space): %3d%%") ,percent);
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
SetProgress(ec->wl->encPBar1, percent, 100);
#endif
GuiSetProgress(ec->wl->encPBar1, percent, 100);
last_percent = percent;
}
@@ -308,10 +287,8 @@ static void expand_image(ecc_closure *ec)
{ unsigned char buf[2048];
int n;
#ifndef WITH_CLI_ONLY_YES
if(Closure->stopActions) /* User hit the Stop button */
abort_encoding(ec, TRUE);
#endif
CreateMissingSector(buf, lay->dataSectors+sectors,
image->imageFP, FINGERPRINT_SECTOR,
@@ -326,10 +303,7 @@ static void expand_image(ecc_closure *ec)
PrintProgress(_("Preparing image (checksums taken from cache, adding space): %3d%%") ,percent);
else PrintProgress(_("Preparing image (checksums, adding space): %3d%%"), percent);
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
SetProgress(ec->wl->encPBar1, percent, 100);
#endif
GuiSetProgress(ec->wl->encPBar1, percent, 100);
last_percent = percent;
}
@@ -339,11 +313,7 @@ static void expand_image(ecc_closure *ec)
PrintProgress(_("Preparing image (checksums taken from cache, adding space): %3d%%"), 100);
else PrintProgress(_("Preparing image (checksums, adding space): %3d%%"), 100);
PrintProgress("\n");
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
SetProgress(ec->wl->encPBar1, 100, 100);
#endif
GuiSetProgress(ec->wl->encPBar1, 100, 100);
}
/*
@@ -495,13 +465,9 @@ static gint32 *enc_alpha_to;
/*** Show the second progress bar */
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
{ ShowWidget(ec->wl->encPBar2);
ShowWidget(ec->wl->encLabel2);
}
#endif
GuiShowWidget(ec->wl->encPBar2);
GuiShowWidget(ec->wl->encLabel2);
/*** Adjust image bounds to include the CRC sectors */
image->sectorSize = lay->protectedSectors;
@@ -607,10 +573,8 @@ static gint32 *enc_alpha_to;
{ int offset = 0;
unsigned char *par_idx = ec->parity;
#ifndef WITH_CLI_ONLY_YES
if(Closure->stopActions) /* User hit the Stop button */
abort_encoding(ec, TRUE);
#endif
/* Read the next data sectors of this layer. */
@@ -996,14 +960,8 @@ static gint32 *enc_alpha_to;
progress++;
percent = (1000*progress)/max_percent;
if(last_percent != percent)
{
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
SetProgress(ec->wl->encPBar2, percent, 1000);
else
#endif
PrintProgress(_("Ecc generation: %3d.%1d%%"), percent/10, percent%10);
{ GuiSetProgress(ec->wl->encPBar2, percent, 1000);
PrintProgress(_("Ecc generation: %3d.%1d%%"), percent/10, percent%10);
last_percent = percent;
}
}
@@ -1060,9 +1018,7 @@ static gint32 *enc_alpha_to;
void RS02Create(void)
{ Method *self = FindMethod("RS02");
#ifndef WITH_CLI_ONLY_YES
RS02Widgets *wl = (RS02Widgets*)self->widgetList;
#endif
Image *image = NULL;
RS02Layout *lay;
ecc_closure *ec = g_malloc0(sizeof(ecc_closure));
@@ -1090,18 +1046,14 @@ void RS02Create(void)
ec->image = image;
ec->self = self;
#ifndef WITH_CLI_ONLY_YES
ec->wl = wl;
#endif
ec->eh = g_malloc0(sizeof(EccHeader));
ec->timer = g_timer_new();
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) /* Preliminary fill text for the head line */
SetLabelText(GTK_LABEL(wl->encHeadline),
_("<big>Augmenting the image with error correction data.</big>\n<i>%s</i>"),
_("- checking image -"));
#endif
/*** Preliminary fill text for the head line (in case of GUI) */
GuiSetLabelText(wl->encHeadline,
_("<big>Augmenting the image with error correction data.</big>\n<i>%s</i>"),
_("- checking image -"));
/*** If the image already contains error correction information, remove it. */
@@ -1113,17 +1065,15 @@ void RS02Create(void)
/*** Announce what we are going to do */
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) /* Preliminary fill text for the head line */
{ ec->msg = g_strdup_printf(_("Encoding with Method RS02: %" PRId64 " MiB data, %" PRId64 " MiB ecc (%d roots; %4.1f%% redundancy)."),
lay->dataSectors/512, lay->eccSectors/512, lay->nroots, lay->redundancy);
SetLabelText(GTK_LABEL(wl->encHeadline),
_("<big>Augmenting the image with error correction data.</big>\n<i>%s</i>"),
ec->msg);
GuiSetLabelText(wl->encHeadline,
_("<big>Augmenting the image with error correction data.</big>\n<i>%s</i>"),
ec->msg);
}
else
#endif
{ ec->msg = g_strdup_printf(_("Augmenting image with Method RS02:\n %" PRId64 " MiB data, %" PRId64 " MiB ecc (%d roots; %4.1f%% redundancy)."),
lay->dataSectors/512, lay->eccSectors/512, lay->nroots, lay->redundancy);
@@ -1142,7 +1092,7 @@ void RS02Create(void)
if(lay->redundancy < 20)
{ int answer;
answer = ModalWarningOrCLI(GTK_MESSAGE_WARNING, GTK_BUTTONS_OK_CANCEL, NULL,
answer = ModalWarning(GTK_MESSAGE_WARNING, GTK_BUTTONS_OK_CANCEL, NULL,
"%s", _("Using redundancies below 20% may not give\n"
"the expected data loss protection.\n"));
@@ -1180,17 +1130,13 @@ void RS02Create(void)
(lay->dataSectors + lay->eccSectors)/512,
lay->dataSectors+lay->eccSectors);
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
{ SetProgress(wl->encPBar2, 100, 100);
GuiSetProgress(wl->encPBar2, 100, 100);
SetLabelText(GTK_LABEL(wl->encFootline),
GuiSetLabelText(wl->encFootline,
_("Image has been augmented with error correction data.\n"
"New image size is %" PRId64 " MiB (%" PRId64 " sectors).\n"),
(lay->dataSectors + lay->eccSectors)/512,
lay->dataSectors+lay->eccSectors);
}
#endif
/*** Clean up */

View File

@@ -20,6 +20,8 @@
* along with dvdisaster. If not, see <http://www.gnu.org/licenses/>.
*/
/*** src type: some GUI code ***/
#include "dvdisaster.h"
#include "rs02-includes.h"
@@ -32,9 +34,7 @@
typedef struct
{ Image *image;
EccHeader *eh;
#ifndef WITH_CLI_ONLY_YES
RS02Widgets *wl;
#endif
RS02Layout *lay;
GaloisTables *gt;
ReedSolomonTables *rt;
@@ -49,16 +49,13 @@ static void fix_cleanup(gpointer data)
UnregisterCleanup();
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
{ if(fc->earlyTermination)
SwitchAndSetFootline(fc->wl->fixNotebook, 1,
if(fc->earlyTermination)
{ GuiSwitchAndSetFootline(fc->wl->fixNotebook, 1,
fc->wl->fixFootline,
_("<span %s>Aborted by unrecoverable error.</span>"),
Closure->redMarkup);
AllowActions(TRUE);
Closure->redMarkup);
}
#endif
GuiAllowActions(TRUE);
/** Clean up */
@@ -77,10 +74,7 @@ static void fix_cleanup(gpointer data)
g_free(fc);
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
g_thread_exit(0);
#endif
GuiExitWorkerThread();
}
/*
@@ -110,24 +104,14 @@ static void expand_image(fix_closure *fc, gint64 new_size)
percent = (100*sectors) / new_sectors;
if(last_percent != percent)
{
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
;
else
#endif
PrintProgress(_("Expanding image: %3d%%"), percent);
{ if(!Closure->guiMode)
PrintProgress(_("Expanding image: %3d%%"), percent);
last_percent = percent;
}
}
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
;
else
#endif
{
PrintProgress(_("Expanding image: %3d%%"), 100);
if(!Closure->guiMode)
{ PrintProgress(_("Expanding image: %3d%%"), 100);
PrintProgress("\n");
}
@@ -140,11 +124,8 @@ static void expand_image(fix_closure *fc, gint64 new_size)
***/
void RS02Fix(Image *image)
{
#ifndef WITH_CLI_ONLY_YES
Method *self = FindMethod("RS02");
{ Method *self = FindMethod("RS02");
RS02Widgets *wl = (RS02Widgets*)self->widgetList;
#endif
RS02Layout *lay;
fix_closure *fc = g_malloc0(sizeof(fix_closure));
EccHeader *eh;
@@ -183,20 +164,15 @@ void RS02Fix(Image *image)
/*** Register the cleanup procedure for GUI mode */
fc->image = image;
#ifndef WITH_CLI_ONLY_YES
fc->wl = wl;
#endif
fc->earlyTermination = TRUE;
RegisterCleanup(_("Repairing of image aborted"), fix_cleanup, fc);
/*** Open the image file */
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
SetLabelText(GTK_LABEL(wl->fixHeadline),
_("<big>Repairing the image.</big>\n<i>%s</i>"),
_("Opening files..."));
#endif
GuiSetLabelText(wl->fixHeadline,
_("<big>Repairing the image.</big>\n<i>%s</i>"),
_("Opening files..."));
eh = fc->eh = image->eccHeader;
lay = fc->lay = RS02LayoutFromImage(image);
@@ -219,19 +195,19 @@ void RS02Fix(Image *image)
/*** Announce what we going to do */
#ifndef WITH_CLI_ONLY_YES
#ifdef WITH_GUI_YES
if(Closure->guiMode)
{ char *msg = g_strdup_printf(_("Image contains error correction data: Method RS02, %d roots, %4.1f%% redundancy."),
eh->eccBytes,
((double)eh->eccBytes*100.0)/(double)eh->dataBytes);
SetLabelText(GTK_LABEL(wl->fixHeadline),
_("<big>Repairing the image.</big>\n<i>%s</i>"), msg);
GuiSetLabelText(wl->fixHeadline,
_("<big>Repairing the image.</big>\n<i>%s</i>"), msg);
RS02SetFixMaxValues(wl, eh->dataBytes, eh->eccBytes, expected_sectors);
g_free(msg);
}
#endif
PrintLog(_("\nFix mode(%s): Repairable sectors will be fixed in the image.\n"),
"RS02");
@@ -245,41 +221,37 @@ void RS02Fix(Image *image)
"the error correction information.\n\n%s");
if(diff>0 && diff<=2)
{ int answer;
answer = ModalWarningOrCLI(GTK_MESSAGE_QUESTION, GTK_BUTTONS_OK_CANCEL, NULL,
{ int answer = ModalWarning(GTK_MESSAGE_QUESTION, GTK_BUTTONS_OK_CANCEL, NULL,
_("Image file is %" PRId64 " sectors longer than expected.\n"
"Assuming this is a TAO mode medium.\n"
"%" PRId64 " sectors will be removed from the image end.\n"),
diff, diff);
if(!answer)
{
#ifndef WITH_CLI_ONLY_YES
SwitchAndSetFootline(fc->wl->fixNotebook, 1,
fc->wl->fixFootline,
_("<span %s>Aborted by user request!</span>"),
Closure->redMarkup);
{ GuiSwitchAndSetFootline(fc->wl->fixNotebook, 1,
fc->wl->fixFootline,
_("<span %s>Aborted by user request!</span>"),
Closure->redMarkup);
fc->earlyTermination = FALSE; /* suppress respective error message */
#endif
goto terminate;
}
if(!TruncateImage(image, (gint64)(2048*expected_sectors)))
Stop(_("Could not truncate %s: %s\n"),Closure->imageName,strerror(errno));
}
#ifndef WITH_CLI_ONLY_YES
#ifdef WITH_GUI_YES
if(diff>2 && Closure->guiMode)
{ int answer = ModalDialog(GTK_MESSAGE_QUESTION, GTK_BUTTONS_OK_CANCEL, NULL,
trans,
diff,
_("Is it okay to remove the superfluous sectors?"));
{ int answer = GuiModalDialog(GTK_MESSAGE_QUESTION, GTK_BUTTONS_OK_CANCEL, NULL,
trans,
diff,
_("Is it okay to remove the superfluous sectors?"));
if(!answer)
{ SwitchAndSetFootline(fc->wl->fixNotebook, 1,
fc->wl->fixFootline,
_("<span %s>Aborted by user request!</span>"),
Closure->redMarkup);
{ GuiSwitchAndSetFootline(fc->wl->fixNotebook, 1,
fc->wl->fixFootline,
_("<span %s>Aborted by user request!</span>"),
Closure->redMarkup);
fc->earlyTermination = FALSE; /* suppress respective error message */
goto terminate;
}
@@ -291,11 +263,7 @@ void RS02Fix(Image *image)
}
#endif
#ifndef WITH_CLI_ONLY_YES
if(diff>2 && !Closure->guiMode)
#else
if(diff>2)
#endif
{ if(!Closure->truncate)
Stop(trans,
diff,
@@ -364,17 +332,16 @@ void RS02Fix(Image *image)
/* See if user hit the Stop button */
#ifndef WITH_CLI_ONLY_YES
if(Closure->stopActions)
{ if(Closure->stopActions == STOP_CURRENT_ACTION) /* suppress memleak warning when closing window */
SwitchAndSetFootline(fc->wl->fixNotebook, 1,
fc->wl->fixFootline,
_("<span %s>Aborted by user request!</span>"),
Closure->redMarkup);
{ GuiSwitchAndSetFootline(fc->wl->fixNotebook, 1,
fc->wl->fixFootline,
_("<span %s>Aborted by user request!</span>"),
Closure->redMarkup);
}
fc->earlyTermination = FALSE; /* suppress respective error message */
goto terminate;
}
#endif
/* Make sure to wrap the block_idx[] ptr properly */
@@ -492,10 +459,7 @@ void RS02Fix(Image *image)
/* Trivially reject uncorrectable ecc block */
if(erasure_count>lay->nroots) /* uncorrectable */
{
#ifndef WITH_CLI_ONLY_YES
if(!Closure->guiMode)
#endif
{ if(!Closure->guiMode)
{ PrintCLI(_("* Ecc block %" PRId64 ": %3d unrepairable sectors: "), s, erasure_count);
for(i=0; i<erasure_count; i++)
@@ -551,7 +515,7 @@ void RS02Fix(Image *image)
if(syn_error) damaged_eccblocks++;
else continue;
//printf("Syndrome error for ecc block %lld, byte %d\n",s,bi);
//printf("Syndrome error for ecc block %" PRId64 ", byte %d\n",s,bi);
/* If we have found any erasures,
initialize lambda to be the erasure locator polynomial */
@@ -820,19 +784,17 @@ skip:
percent = (1000*s)/lay->sectorsPerLayer;
if(last_percent != percent)
{
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
{
{ if(Closure->guiMode)
{
#ifdef WITH_GUI_YES
RS02AddFixValues(wl, percent, local_plot_max);
local_plot_max = 0;
//if(last_corrected != corrected || last_uncorrected != uncorrected)
RS02UpdateFixResults(wl, corrected, uncorrected);
}
else
#endif
PrintProgress(_("Ecc progress: %3d.%1d%%"),percent/10,percent%10);
}
else PrintProgress(_("Ecc progress: %3d.%1d%%"),percent/10,percent%10);
last_percent = percent;
}
@@ -852,13 +814,10 @@ skip:
corrected, data_corr, ecc_corr);
if(uncorrected > 0)
{ PrintLog(_("Unrepaired sectors: %" PRId64 "\n"), uncorrected);
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
SwitchAndSetFootline(wl->fixNotebook, 1, wl->fixFootline,
_("Image sectors could not be fully restored "
"(%" PRId64 " repaired; <span %s>%" PRId64 " unrepaired</span>)"),
corrected, Closure->redMarkup, uncorrected);
#endif
GuiSwitchAndSetFootline(wl->fixNotebook, 1, wl->fixFootline,
_("Image sectors could not be fully restored "
"(%" PRId64 " repaired; <span %s>%" PRId64 " unrepaired</span>)"),
corrected, Closure->redMarkup, uncorrected);
}
else
{ if(!corrected)
@@ -874,12 +833,11 @@ skip:
PrintLog(_("Erasure counts per ecc block: avg = %.1f; worst = %d.\n"),
(double)damaged_sectors/(double)damaged_eccsecs,worst_ecc);
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode && t)
SwitchAndSetFootline(wl->fixNotebook, 1, wl->fixFootline,
"%s %s", _("Repair results:"), t);
#endif
{ GuiSwitchAndSetFootline(wl->fixNotebook, 1, wl->fixFootline,
"%s %s", _("Repair results:"), t);
}
Verbose("\nSummary of processed sectors:\n");
Verbose("%" PRId64 " damaged sectors\n", damaged_sectors);
Verbose("%" PRId64 " CRC errors\n", crc_errors);

View File

@@ -23,7 +23,6 @@
#ifndef RS02INCLUDES_H
#define RS02INCLUDES_H
#ifndef WITH_CLI_ONLY_YES
/* Data structs from rs02-window.c */
typedef struct
@@ -103,7 +102,6 @@ typedef struct
int dataBytes;
int percent, lastPercent;
} RS02Widgets;
#endif
/*
* local working closure for internal checksums
@@ -122,7 +120,6 @@ typedef struct
* These are exported via the Method struct
*/
#ifndef WITH_CLI_ONLY_YES
void CreateRS02EncWindow(Method*, GtkWidget*);
void CreateRS02FixWindow(Method*, GtkWidget*);
void CreateRS02PrefsPage(Method*, GtkWidget*);
@@ -133,7 +130,6 @@ void ReadRS02Preferences(Method*);
void ResetRS02VerifyWindow(Method*);
void CreateRS02VerifyWindow(Method*, GtkWidget*);
#endif
/*
* These are exported (resp. only used) in ecc-rs02.c and rs02*.c
@@ -188,13 +184,11 @@ void RS02Fix(Image*);
int RS02Recognize(Image*);
#ifndef WITH_CLI_ONLY_YES
/* rs02-window.c */
void RS02AddFixValues(RS02Widgets*, int, int);
void RS02SetFixMaxValues(RS02Widgets*, int, int, gint64);
void RS02UpdateFixResults(RS02Widgets*, gint64, gint64);
#endif
/* rs02-verify.c */

View File

@@ -20,6 +20,8 @@
* along with dvdisaster. If not, see <http://www.gnu.org/licenses/>.
*/
/*** src type: some GUI code ***/
#include "dvdisaster.h"
#include "rs02-includes.h"
@@ -29,18 +31,16 @@
*** Recognize RS02 error correction data in the image
***/
#ifndef WITH_CLI_ONLY_YES
/*
* Dialog components for disabling RS02 search
*/
#ifdef WITH_GUI_YES
static void no_rs02_cb(GtkWidget *widget, gpointer data)
{ int state = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
Closure->examineRS02 = !state;
UpdatePrefsExhaustiveSearch();
GuiUpdatePrefsExhaustiveSearch();
}
static void insert_buttons(GtkDialog *dialog)
@@ -61,7 +61,7 @@ static void insert_buttons(GtkDialog *dialog)
gtk_widget_show(align);
gtk_widget_show(check);
}
#endif
#endif /* WITH_GUI_YES */
/*
* See whether a given header is valid for RS02
@@ -171,6 +171,7 @@ int RS02Recognize(Image *image)
int read_count = 0;
int answered_continue = FALSE;
gint64 max_sectors = 0;
switch(image->type)
{ case IMAGE_FILE:
Verbose("RS02Recognize: file %s\n", image->file->path);
@@ -272,10 +273,8 @@ int RS02Recognize(Image *image)
while(pos > 0)
{ int result;
#ifndef WITH_CLI_ONLY_YES
if(Closure->stopActions)
goto bail_out;
#endif
if(GetBit(try_next_header, pos))
{ Verbose("Sector %" PRId64 " cached; skipping\n", pos);
@@ -299,18 +298,16 @@ int RS02Recognize(Image *image)
read_count++;
if(!answered_continue && read_count > 5)
{
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
{ int answer = ModalDialog(GTK_MESSAGE_QUESTION, GTK_BUTTONS_NONE, insert_buttons,
_("Faster medium initialization\n\n"
"Searching this medium for error correction data may take a long time.\n"
"Press \"Skip RS02 test\" if you are certain that this medium was\n"
"not augmented with RS02 error correction data."));
if(Closure->guiMode)
{ int answer = GuiModalDialog(GTK_MESSAGE_QUESTION, GTK_BUTTONS_NONE, insert_buttons,
_("Faster medium initialization\n\n"
"Searching this medium for error correction data may take a long time.\n"
"Press \"Skip RS02 test\" if you are certain that this medium was\n"
"not augmented with RS02 error correction data."));
if(answer) goto bail_out;
answered_continue = TRUE;
}
#endif
}
goto check_next_header;
case TRY_NEXT_MODULO:

View File

@@ -20,44 +20,46 @@
* along with dvdisaster. If not, see <http://www.gnu.org/licenses/>.
*/
/*** src type: some GUI code ***/
#include "dvdisaster.h"
#include "rs02-includes.h"
#ifdef WITH_GUI_YES
/***
*** Reset the verify output window
***/
#ifndef WITH_CLI_ONLY_YES
void ResetRS02VerifyWindow(Method *self)
{ RS02Widgets *wl = (RS02Widgets*)self->widgetList;
SetLabelText(GTK_LABEL(wl->cmpImageSectors), "");
SetLabelText(GTK_LABEL(wl->cmpImageMd5Sum), "");
SetLabelText(GTK_LABEL(wl->cmpEccHeaders), "");
SetLabelText(GTK_LABEL(wl->cmpDataSection), "");
SetLabelText(GTK_LABEL(wl->cmpCrcSection), "");
SetLabelText(GTK_LABEL(wl->cmpEccSection), "");
SetLabelText(GTK_LABEL(wl->cmpImageResult), "");
GuiSetLabelText(wl->cmpImageSectors, "");
GuiSetLabelText(wl->cmpImageMd5Sum, "");
GuiSetLabelText(wl->cmpEccHeaders, "");
GuiSetLabelText(wl->cmpDataSection, "");
GuiSetLabelText(wl->cmpCrcSection, "");
GuiSetLabelText(wl->cmpEccSection, "");
GuiSetLabelText(wl->cmpImageResult, "");
SetLabelText(GTK_LABEL(wl->cmpEccCreatedBy), "dvdisaster");
SetLabelText(GTK_LABEL(wl->cmpEccMethod), "");
SetLabelText(GTK_LABEL(wl->cmpEccRequires), "");
SetLabelText(GTK_LABEL(wl->cmpEccMediumSectors), "");
SetLabelText(GTK_LABEL(wl->cmpEcc1Name), _("Data checksum:"));
SetLabelText(GTK_LABEL(wl->cmpEcc2Name), _("CRC checksum:"));
SetLabelText(GTK_LABEL(wl->cmpEcc3Name), _("Ecc checksum:"));
SetLabelText(GTK_LABEL(wl->cmpEcc1Msg), "");
SetLabelText(GTK_LABEL(wl->cmpEcc2Msg), "");
SetLabelText(GTK_LABEL(wl->cmpEcc3Msg), "");
GuiSetLabelText(wl->cmpEccCreatedBy, "dvdisaster");
GuiSetLabelText(wl->cmpEccMethod, "");
GuiSetLabelText(wl->cmpEccRequires, "");
GuiSetLabelText(wl->cmpEccMediumSectors, "");
GuiSetLabelText(wl->cmpEcc1Name, _("Data checksum:"));
GuiSetLabelText(wl->cmpEcc2Name, _("CRC checksum:"));
GuiSetLabelText(wl->cmpEcc3Name, _("Ecc checksum:"));
GuiSetLabelText(wl->cmpEcc1Msg, "");
GuiSetLabelText(wl->cmpEcc2Msg, "");
GuiSetLabelText(wl->cmpEcc3Msg, "");
SwitchAndSetFootline(wl->cmpEccNotebook, 0, NULL, NULL);
GuiSwitchAndSetFootline(wl->cmpEccNotebook, 0, NULL, NULL);
wl->lastPercent = 0;
FillSpiral(wl->cmpSpiral, Closure->background);
DrawSpiral(wl->cmpSpiral);
GuiFillSpiral(wl->cmpSpiral, Closure->background);
GuiDrawSpiral(wl->cmpSpiral);
}
/***
@@ -79,7 +81,7 @@ static gboolean spiral_idle_func(gpointer data)
int i;
for(i=sii->from; i<=sii->to; i++)
DrawSpiralSegment(sii->cmpSpiral, sii->segColor, i-1);
GuiDrawSpiralSegment(sii->cmpSpiral, sii->segColor, i-1);
g_free(sii);
return FALSE;
@@ -114,16 +116,16 @@ static void add_verify_values(Method *method, int percent,
static void redraw_spiral(RS02Widgets *wl)
{ int x = wl->cmpSpiral->mx - wl->cmpSpiral->diameter/2 + 10;
DrawSpiralLabel(wl->cmpSpiral, wl->cmpLayout,
_("Good sectors"), Closure->greenSector, x, 1);
GuiDrawSpiralLabel(wl->cmpSpiral, wl->cmpLayout,
_("Good sectors"), Closure->greenSector, x, 1);
DrawSpiralLabel(wl->cmpSpiral, wl->cmpLayout,
_("Sectors with CRC errors"), Closure->yellowSector, x, 2);
GuiDrawSpiralLabel(wl->cmpSpiral, wl->cmpLayout,
_("Sectors with CRC errors"), Closure->yellowSector, x, 2);
DrawSpiralLabel(wl->cmpSpiral, wl->cmpLayout,
_("Missing sectors"), Closure->redSector, x, 3);
GuiDrawSpiralLabel(wl->cmpSpiral, wl->cmpLayout,
_("Missing sectors"), Closure->redSector, x, 3);
DrawSpiral(wl->cmpSpiral);
GuiDrawSpiral(wl->cmpSpiral);
}
/*
@@ -138,11 +140,11 @@ static gboolean expose_cb(GtkWidget *widget, GdkEventExpose *event, gpointer dat
/* Finish spiral initialization */
if(!wl->cmpLayout)
{ SetSpiralWidget(wl->cmpSpiral, widget);
{ GuiSetSpiralWidget(wl->cmpSpiral, widget);
wl->cmpLayout = gtk_widget_create_pango_layout(widget, NULL);
}
SetText(wl->cmpLayout, _("Missing sectors"), &w, &h);
GuiSetText(wl->cmpLayout, _("Missing sectors"), &w, &h);
size = wl->cmpSpiral->diameter + 20 + 3*(10+h); /* approx. size of spiral + labels */
wl->cmpSpiral->mx = a->width / 2;
@@ -189,7 +191,7 @@ void CreateRS02VerifyWindow(Method *self, GtkWidget *parent)
lab = gtk_label_new(NULL);
gtk_misc_set_alignment(GTK_MISC(lab), 0.0, 0.0);
SetLabelText(GTK_LABEL(lab), _("Medium sectors:"));
GuiSetLabelText(lab, _("Medium sectors:"));
gtk_table_attach(GTK_TABLE(table2), lab, 0, 1, 0, 1, GTK_SHRINK | GTK_FILL, GTK_SHRINK, 5, 2 );
lab = wl->cmpImageSectors = gtk_label_new("0");
gtk_misc_set_alignment(GTK_MISC(lab), 0.0, 0.0);
@@ -197,7 +199,7 @@ void CreateRS02VerifyWindow(Method *self, GtkWidget *parent)
lab = gtk_label_new(NULL);
gtk_misc_set_alignment(GTK_MISC(lab), 0.0, 0.0);
SetLabelText(GTK_LABEL(lab), _("Data checksum:"));
GuiSetLabelText(lab, _("Data checksum:"));
gtk_table_attach(GTK_TABLE(table2), lab, 0, 1, 1, 2, GTK_SHRINK | GTK_FILL, GTK_SHRINK, 5, 2 );
lab = wl->cmpImageMd5Sum = gtk_label_new("0");
gtk_misc_set_alignment(GTK_MISC(lab), 0.0, 0.0);
@@ -205,7 +207,7 @@ void CreateRS02VerifyWindow(Method *self, GtkWidget *parent)
lab = gtk_label_new(NULL);
gtk_misc_set_alignment(GTK_MISC(lab), 0.0, 0.0);
SetLabelText(GTK_LABEL(lab), _("Ecc headers:"));
GuiSetLabelText(lab, _("Ecc headers:"));
gtk_table_attach(GTK_TABLE(table2), lab, 0, 1, 2, 3, GTK_SHRINK | GTK_FILL, GTK_SHRINK, 5, 2 );
lab = wl->cmpEccHeaders = gtk_label_new(".");
gtk_misc_set_alignment(GTK_MISC(lab), 0.0, 0.0);
@@ -213,7 +215,7 @@ void CreateRS02VerifyWindow(Method *self, GtkWidget *parent)
lab = gtk_label_new(NULL);
gtk_misc_set_alignment(GTK_MISC(lab), 0.0, 0.0);
SetLabelText(GTK_LABEL(lab), _("Data section:"));
GuiSetLabelText(lab, _("Data section:"));
gtk_table_attach(GTK_TABLE(table2), lab, 0, 1, 3, 4, GTK_SHRINK | GTK_FILL, GTK_SHRINK, 5, 2 );
lab = wl->cmpDataSection = gtk_label_new(".");
gtk_misc_set_alignment(GTK_MISC(lab), 0.0, 0.0);
@@ -221,7 +223,7 @@ void CreateRS02VerifyWindow(Method *self, GtkWidget *parent)
lab = gtk_label_new(NULL);
gtk_misc_set_alignment(GTK_MISC(lab), 0.0, 0.0);
SetLabelText(GTK_LABEL(lab), _("Crc section:"));
GuiSetLabelText(lab, _("Crc section:"));
gtk_table_attach(GTK_TABLE(table2), lab, 0, 1, 4, 5, GTK_SHRINK | GTK_FILL, GTK_SHRINK, 5, 2 );
lab = wl->cmpCrcSection = gtk_label_new(".");
gtk_misc_set_alignment(GTK_MISC(lab), 0.0, 0.0);
@@ -229,7 +231,7 @@ void CreateRS02VerifyWindow(Method *self, GtkWidget *parent)
lab = gtk_label_new(NULL);
gtk_misc_set_alignment(GTK_MISC(lab), 0.0, 0.0);
SetLabelText(GTK_LABEL(lab), _("Ecc section:"));
GuiSetLabelText(lab, _("Ecc section:"));
gtk_table_attach(GTK_TABLE(table2), lab, 0, 1, 5, 6, GTK_SHRINK | GTK_FILL, GTK_SHRINK, 5, 2 );
lab = wl->cmpEccSection= gtk_label_new(".");
gtk_misc_set_alignment(GTK_MISC(lab), 0.0, 0.0);
@@ -244,7 +246,7 @@ void CreateRS02VerifyWindow(Method *self, GtkWidget *parent)
frame = gtk_frame_new(_utf("Image state"));
gtk_table_attach(GTK_TABLE(table), frame, 1, 2, 0, 2, GTK_SHRINK | GTK_FILL, GTK_EXPAND | GTK_FILL, 5, 5);
wl->cmpSpiral = CreateSpiral(Closure->grid, Closure->background, 10, 5, VERIFY_IMAGE_SEGMENTS);
wl->cmpSpiral = GuiCreateSpiral(Closure->grid, Closure->background, 10, 5, VERIFY_IMAGE_SEGMENTS);
d_area = wl->cmpDrawingArea = gtk_drawing_area_new();
gtk_widget_set_size_request(d_area, wl->cmpSpiral->diameter+20, -1);
gtk_container_add(GTK_CONTAINER(frame), d_area);
@@ -271,7 +273,7 @@ void CreateRS02VerifyWindow(Method *self, GtkWidget *parent)
lab = gtk_label_new(NULL);
gtk_misc_set_alignment(GTK_MISC(lab), 0.0, 0.0);
SetLabelText(GTK_LABEL(lab), _("Created by:"));
GuiSetLabelText(lab, _("Created by:"));
gtk_table_attach(GTK_TABLE(table2), lab, 0, 1, 0, 1, GTK_SHRINK | GTK_FILL, GTK_SHRINK, 5, 2 );
lab = wl->cmpEccCreatedBy = gtk_label_new(NULL);
gtk_misc_set_alignment(GTK_MISC(lab), 0.0, 0.0);
@@ -279,7 +281,7 @@ void CreateRS02VerifyWindow(Method *self, GtkWidget *parent)
lab = gtk_label_new(NULL);
gtk_misc_set_alignment(GTK_MISC(lab), 0.0, 0.0);
SetLabelText(GTK_LABEL(lab), _("Method:"));
GuiSetLabelText(lab, _("Method:"));
gtk_table_attach(GTK_TABLE(table2), lab, 0, 1, 1, 2, GTK_SHRINK | GTK_FILL, GTK_SHRINK, 5, 2 );
lab = wl->cmpEccMethod = gtk_label_new(NULL);
gtk_misc_set_alignment(GTK_MISC(lab), 0.0, 0.0);
@@ -287,7 +289,7 @@ void CreateRS02VerifyWindow(Method *self, GtkWidget *parent)
lab = gtk_label_new(NULL);
gtk_misc_set_alignment(GTK_MISC(lab), 0.0, 0.0);
SetLabelText(GTK_LABEL(lab), _("Requires:"));
GuiSetLabelText(lab, _("Requires:"));
gtk_table_attach(GTK_TABLE(table2), lab, 0, 1, 2, 3, GTK_SHRINK | GTK_FILL, GTK_SHRINK, 5, 2 );
lab = wl->cmpEccRequires = gtk_label_new(NULL);
gtk_misc_set_alignment(GTK_MISC(lab), 0.0, 0.0);
@@ -295,7 +297,7 @@ void CreateRS02VerifyWindow(Method *self, GtkWidget *parent)
lab = gtk_label_new(NULL);
gtk_misc_set_alignment(GTK_MISC(lab), 0.0, 0.0);
SetLabelText(GTK_LABEL(lab), _("Medium sectors:"));
GuiSetLabelText(lab, _("Medium sectors:"));
gtk_table_attach(GTK_TABLE(table2), lab, 0, 1, 3, 4, GTK_SHRINK | GTK_FILL, GTK_SHRINK, 5, 2 );
lab = wl->cmpEccMediumSectors = gtk_label_new(NULL);
gtk_misc_set_alignment(GTK_MISC(lab), 0.0, 0.0);
@@ -303,7 +305,7 @@ void CreateRS02VerifyWindow(Method *self, GtkWidget *parent)
lab = wl->cmpEcc1Name = gtk_label_new(NULL);
gtk_misc_set_alignment(GTK_MISC(lab), 0.0, 0.0);
SetLabelText(GTK_LABEL(lab), _("Data checksum:"));
GuiSetLabelText(lab, _("Data checksum:"));
gtk_table_attach(GTK_TABLE(table2), lab, 0, 1, 4, 5, GTK_SHRINK | GTK_FILL, GTK_SHRINK, 5, 2 );
lab = wl->cmpEcc1Msg = gtk_label_new(NULL);
gtk_misc_set_alignment(GTK_MISC(lab), 0.0, 0.0);
@@ -311,7 +313,7 @@ void CreateRS02VerifyWindow(Method *self, GtkWidget *parent)
lab = wl->cmpEcc2Name = gtk_label_new(NULL);
gtk_misc_set_alignment(GTK_MISC(lab), 0.0, 0.0);
SetLabelText(GTK_LABEL(lab), _("CRC checksum:"));
GuiSetLabelText(lab, _("CRC checksum:"));
gtk_table_attach(GTK_TABLE(table2), lab, 0, 1, 5, 6, GTK_SHRINK | GTK_FILL, GTK_SHRINK, 5, 2 );
lab = wl->cmpEcc2Msg = gtk_label_new(NULL);
gtk_misc_set_alignment(GTK_MISC(lab), 0.0, 0.0);
@@ -319,7 +321,7 @@ void CreateRS02VerifyWindow(Method *self, GtkWidget *parent)
lab = wl->cmpEcc3Name = gtk_label_new(NULL);
gtk_misc_set_alignment(GTK_MISC(lab), 0.0, 0.0);
SetLabelText(GTK_LABEL(lab), _("Ecc checksum:"));
GuiSetLabelText(lab, _("Ecc checksum:"));
gtk_table_attach(GTK_TABLE(table2), lab, 0, 1, 6, 7, GTK_SHRINK | GTK_FILL, GTK_SHRINK, 5, 2 );
lab = wl->cmpEcc3Msg = gtk_label_new(NULL);
gtk_misc_set_alignment(GTK_MISC(lab), 0.0, 0.0);
@@ -330,7 +332,7 @@ void CreateRS02VerifyWindow(Method *self, GtkWidget *parent)
gtk_table_attach(GTK_TABLE(table2), lab, 0, 2, 7, 8, GTK_SHRINK | GTK_FILL, GTK_SHRINK, 5, 4);
}
#endif
#endif /* WITH_GUI_YES */
/***
*** Check the consistency of the augmented image
@@ -344,9 +346,7 @@ typedef struct
{ Image *image;
EccHeader *eh;
RS02Layout *lay;
#ifndef WITH_CLI_ONLY_YES
RS02Widgets *wl;
#endif
Bitmap *map;
guint32 *crcBuf;
gint8 *crcValid;
@@ -358,10 +358,7 @@ static void cleanup(gpointer data)
UnregisterCleanup();
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
AllowActions(TRUE);
#endif
GuiAllowActions(TRUE);
if(cc->image) CloseImage(cc->image);
if(cc->lay) g_free(cc->lay);
@@ -371,10 +368,7 @@ static void cleanup(gpointer data)
g_free(cc);
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
g_thread_exit(0);
#endif
GuiExitWorkerThread();
}
/***
@@ -515,24 +509,22 @@ static int prognosis(verify_closure *vc, gint64 missing, gint64 expected)
PrintLog(_("- prognosis : %" PRId64 " of %" PRId64 " sectors recoverable (%d.%d%%)\n"),
recoverable, expected, percentage/10, percentage%10);
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
{ SetLabelText(GTK_LABEL(vc->wl->cmpEcc1Name), "");
SetLabelText(GTK_LABEL(vc->wl->cmpEcc1Msg), "");
SetLabelText(GTK_LABEL(vc->wl->cmpEcc2Name), _("Erasure counts:"));
SetLabelText(GTK_LABEL(vc->wl->cmpEcc3Name), _("Prognosis:"));
{ GuiSetLabelText(vc->wl->cmpEcc1Name, "");
GuiSetLabelText(vc->wl->cmpEcc1Msg, "");
GuiSetLabelText(vc->wl->cmpEcc2Name, _("Erasure counts:"));
GuiSetLabelText(vc->wl->cmpEcc3Name, _("Prognosis:"));
SetLabelText(GTK_LABEL(vc->wl->cmpEcc2Msg),
_("<span %s>avg = %.1f; worst = %d per ecc block.</span>"),
worst_ecc <= vc->lay->nroots ? Closure->greenMarkup : Closure->redMarkup,
(double)damaged_sectors/(double)damaged_eccsecs,worst_ecc);
GuiSetLabelText(vc->wl->cmpEcc2Msg,
_("<span %s>avg = %.1f; worst = %d per ecc block.</span>"),
worst_ecc <= vc->lay->nroots ? Closure->greenMarkup : Closure->redMarkup,
(double)damaged_sectors/(double)damaged_eccsecs,worst_ecc);
SetLabelText(GTK_LABEL(vc->wl->cmpEcc3Msg),
_("<span %s>%" PRId64 " of %" PRId64 " sectors recoverable (%d.%d%%)</span>"),
recoverable < expected ? Closure->redMarkup : Closure->greenMarkup,
recoverable, expected, percentage/10, percentage%10);
GuiSetLabelText(vc->wl->cmpEcc3Msg,
_("<span %s>%" PRId64 " of %" PRId64 " sectors recoverable (%d.%d%%)</span>"),
recoverable < expected ? Closure->redMarkup : Closure->greenMarkup,
recoverable, expected, percentage/10, percentage%10);
}
#endif
}
/* Why the first test?
@@ -548,10 +540,8 @@ static int prognosis(verify_closure *vc, gint64 missing, gint64 expected)
void RS02Verify(Image *image)
{ verify_closure *cc = g_malloc0(sizeof(verify_closure));
#ifndef WITH_CLI_ONLY_YES
Method *self = FindMethod("RS02");
RS02Widgets *wl = self->widgetList;
#endif
EccHeader *eh;
RS02Layout *lay;
struct MD5Context image_md5;
@@ -574,26 +564,20 @@ void RS02Verify(Image *image)
gint64 hdr_missing, hdr_crc_errors;
gint64 hdr_ok,hdr_pos,hdr_correctable;
gint64 ecc_sector,expected_sectors;
#ifndef WITH_CLI_ONLY_YES
int ecc_md5_failure = FALSE;
#endif
int ecc_slice;
int major,minor,micro;
char *unstable="";
char method[5];
char *img_advice = NULL;
char *ecc_advice = NULL;
#ifndef WITH_CLI_ONLY_YES
int try_it;
#endif
int unrecoverable_sectors = 0;
/*** Prepare for early termination */
RegisterCleanup(_("Check aborted"), cleanup, cc);
#ifndef WITH_CLI_ONLY_YES
cc->wl = wl;
#endif
/* extract some important information */
@@ -609,30 +593,25 @@ void RS02Verify(Image *image)
/*** Print information on image size */
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
SetLabelText(GTK_LABEL(wl->cmpHeadline), "<big>%s</big>\n<i>%s</i>",
_("Checking the image file."),
_("Image contains error correction data."));
#endif
GuiSetLabelText(wl->cmpHeadline, "<big>%s</big>\n<i>%s</i>",
_("Checking the image file."),
_("Image contains error correction data."));
PrintLog("\n%s: ",Closure->imageName);
PrintLog(_("present, contains %" PRId64 " medium sectors.\n"),image->sectorSize);
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
{ if(expected_sectors == image->sectorSize)
{ SetLabelText(GTK_LABEL(wl->cmpImageSectors), "%" PRId64 "", image->sectorSize);
{ GuiSetLabelText(wl->cmpImageSectors, "%" PRId64, image->sectorSize);
}
else
{ SetLabelText(GTK_LABEL(wl->cmpImageSectors), "<span %s>%" PRId64 "</span>",
Closure->redMarkup, image->sectorSize);
{ GuiSetLabelText(wl->cmpImageSectors, "<span %s>%" PRId64 "</span>",
Closure->redMarkup, image->sectorSize);
if(expected_sectors > image->sectorSize)
img_advice = g_strdup_printf(_("<span %s>Image file is %" PRId64 " sectors shorter than expected.</span>"), Closure->redMarkup, expected_sectors - image->sectorSize);
else img_advice = g_strdup_printf(_("<span %s>Image file is %" PRId64 " sectors longer than expected.</span>"), Closure->redMarkup, image->sectorSize - expected_sectors);
}
}
#endif
/*** Check integrity of the ecc headers */
@@ -689,16 +668,16 @@ void RS02Verify(Image *image)
hdr_pos = (lay->protectedSectors + lay->headerModulo - 1) & ~(lay->headerModulo-1);
else hdr_pos += lay->headerModulo;
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
{ if(!hdr_crc_errors && !hdr_missing)
SetLabelText(GTK_LABEL(wl->cmpEccHeaders), _("complete"));
{ GuiSetLabelText(wl->cmpEccHeaders, _("complete"));
}
else
{ SetLabelText(GTK_LABEL(wl->cmpEccHeaders), _("<span %s>%" PRId64 " ok, %" PRId64 " CRC errors, %" PRId64 " missing</span>"),
Closure->redMarkup, hdr_ok, hdr_crc_errors, hdr_missing);
{ GuiSetLabelText(wl->cmpEccHeaders,
_("<span %s>%" PRId64 " ok, %" PRId64 " CRC errors, %" PRId64 " missing</span>"),
Closure->redMarkup, hdr_ok, hdr_crc_errors, hdr_missing);
}
}
#endif
}
/* take shortcut in quick mode */
@@ -734,15 +713,14 @@ void RS02Verify(Image *image)
/* Check for user interruption */
#ifndef WITH_CLI_ONLY_YES
if(Closure->stopActions)
{ if(Closure->stopActions == STOP_CURRENT_ACTION) /* suppress memleak warning when closing window */
SetLabelText(GTK_LABEL(wl->cmpImageResult),
_("<span %s>Aborted by user request!</span>"),
Closure->redMarkup);
{ GuiSetLabelText(wl->cmpImageResult,
_("<span %s>Aborted by user request!</span>"),
Closure->redMarkup);
}
goto terminate;
}
#endif
/* Read the next sector */
@@ -820,32 +798,32 @@ void RS02Verify(Image *image)
}
}
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
percent = (VERIFY_IMAGE_SEGMENTS*(s+1))/expected_sectors;
else
#endif
percent = (100*(s+1))/expected_sectors;
else percent = (100*(s+1))/expected_sectors;
if(last_percent != percent)
{ PrintProgress(_("- testing sectors : %3d%%") ,percent);
#ifndef WITH_CLI_ONLY_YES
#ifdef WITH_GUI_YES
if(Closure->guiMode)
{ add_verify_values(self, percent, new_missing, new_crc_errors);
if(data_missing || data_crc_errors)
SetLabelText(GTK_LABEL(wl->cmpDataSection),
_("<span %s>%" PRId64 " sectors missing; %" PRId64 " CRC errors</span>"),
Closure->redMarkup, data_missing, data_crc_errors);
{ GuiSetLabelText(wl->cmpDataSection,
_("<span %s>%" PRId64 " sectors missing; %" PRId64 " CRC errors</span>"),
Closure->redMarkup, data_missing, data_crc_errors);
}
if(crc_missing)
SetLabelText(GTK_LABEL(wl->cmpCrcSection),
_("<span %s>%" PRId64 " sectors missing</span>"),
Closure->redMarkup, crc_missing);
{ GuiSetLabelText(wl->cmpCrcSection,
_("<span %s>%" PRId64 " sectors missing</span>"),
Closure->redMarkup, crc_missing);
}
if(ecc_missing)
SetLabelText(GTK_LABEL(wl->cmpEccSection),
_("<span %s>%" PRId64 " sectors missing</span>"),
Closure->redMarkup, ecc_missing);
{ GuiSetLabelText(wl->cmpEccSection,
_("<span %s>%" PRId64 " sectors missing</span>"),
Closure->redMarkup, ecc_missing);
}
}
#endif
#endif /* WITH_GUI_YES */
last_percent = percent;
new_missing = new_crc_errors = 0;
}
@@ -853,22 +831,23 @@ void RS02Verify(Image *image)
/* Complete damage summary */
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
{ if(data_missing || data_crc_errors)
SetLabelText(GTK_LABEL(wl->cmpDataSection),
_("<span %s>%" PRId64 " sectors missing; %" PRId64 " CRC errors</span>"),
Closure->redMarkup, data_missing, data_crc_errors);
{ GuiSetLabelText(wl->cmpDataSection,
_("<span %s>%" PRId64 " sectors missing; %" PRId64 " CRC errors</span>"),
Closure->redMarkup, data_missing, data_crc_errors);
}
if(crc_missing)
SetLabelText(GTK_LABEL(wl->cmpCrcSection),
_("<span %s>%" PRId64 " sectors missing</span>"),
Closure->redMarkup, crc_missing);
{ GuiSetLabelText(wl->cmpCrcSection,
_("<span %s>%" PRId64 " sectors missing</span>"),
Closure->redMarkup, crc_missing);
}
if(ecc_missing)
SetLabelText(GTK_LABEL(wl->cmpEccSection),
_("<span %s>%" PRId64 " sectors missing</span>"),
Closure->redMarkup, ecc_missing);
{ GuiSetLabelText(wl->cmpEccSection,
_("<span %s>%" PRId64 " sectors missing</span>"),
Closure->redMarkup, ecc_missing);
}
}
#endif
/* The image md5sum is only useful if all blocks have been successfully read. */
@@ -907,35 +886,29 @@ void RS02Verify(Image *image)
PrintLog(_(" ... ecc section : %" PRId64 " sectors missing\n"), ecc_missing);
}
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
{ if(!data_missing && !data_crc_errors)
SetLabelText(GTK_LABEL(wl->cmpDataSection), _("complete"));
if(!crc_missing) SetLabelText(GTK_LABEL(wl->cmpCrcSection), _("complete"));
if(!ecc_missing) SetLabelText(GTK_LABEL(wl->cmpEccSection), _("complete"));
{ GuiSetLabelText(wl->cmpDataSection, _("complete")); }
if(!crc_missing) { GuiSetLabelText(wl->cmpCrcSection, _("complete")); }
if(!ecc_missing) { GuiSetLabelText(wl->cmpEccSection, _("complete")); }
SetLabelText(GTK_LABEL(wl->cmpImageMd5Sum), "%s", data_missing ? "-" : data_digest);
GuiSetLabelText(wl->cmpImageMd5Sum, "%s", data_missing ? "-" : data_digest);
if(img_advice)
{ SetLabelText(GTK_LABEL(wl->cmpImageResult), "%s", img_advice);
{ GuiSetLabelText(wl->cmpImageResult, "%s", img_advice);
g_free(img_advice);
}
else
{ if(!total_missing && !hdr_missing && !hdr_crc_errors && !data_crc_errors)
SetLabelText(GTK_LABEL(wl->cmpImageResult),
_("<span %s>Good image.</span>"),
Closure->greenMarkup);
{ GuiSetLabelText(wl->cmpImageResult,
_("<span %s>Good image.</span>"),
Closure->greenMarkup);
}
else
SetLabelText(GTK_LABEL(wl->cmpImageResult),
_("<span %s>Damaged image.</span>"),
Closure->redMarkup);
}
}
else
#endif
{
if(img_advice)
{ PrintLog("%s", img_advice);
{ GuiSetLabelText(wl->cmpImageResult,
_("<span %s>Damaged image.</span>"),
Closure->redMarkup);
}
}
}
@@ -957,14 +930,10 @@ continue_with_ecc:
PrintLog(format, _("created by dvdisaster"), major, minor, micro, unstable);
PrintLog("\n");
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
{ SwitchAndSetFootline(wl->cmpEccNotebook, 1,
GuiSwitchAndSetFootline(wl->cmpEccNotebook, 1,
wl->cmpEccCreatedBy,
format, "dvdisaster",
major, minor, micro, unstable);
}
#endif
}
else
{ char *format = "%s-%d.%d%s";
@@ -972,13 +941,10 @@ continue_with_ecc:
PrintLog(format, _("created by dvdisaster"), major, minor, unstable);
PrintLog("\n");
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
SwitchAndSetFootline(wl->cmpEccNotebook, 1,
wl->cmpEccCreatedBy,
format, "dvdisaster",
major, minor, unstable);
#endif
GuiSwitchAndSetFootline(wl->cmpEccNotebook, 1,
wl->cmpEccCreatedBy,
format, "dvdisaster",
major, minor, unstable);
}
/* Error correction method */
@@ -989,12 +955,9 @@ continue_with_ecc:
method, eh->eccBytes,
((double)eh->eccBytes*100.0)/(double)eh->dataBytes);
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
SetLabelText(GTK_LABEL(wl->cmpEccMethod), _("%4s, %d roots, %4.1f%% redundancy"),
method, eh->eccBytes,
((double)eh->eccBytes*100.0)/(double)eh->dataBytes);
#endif
GuiSetLabelText(wl->cmpEccMethod, _("%4s, %d roots, %4.1f%% redundancy"),
method, eh->eccBytes,
((double)eh->eccBytes*100.0)/(double)eh->dataBytes);
/* required dvdisaster version */
@@ -1004,12 +967,9 @@ continue_with_ecc:
(eh->neededVersion%10000)/100);
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
SetLabelText(GTK_LABEL(wl->cmpEccRequires), "dvdisaster-%d.%d",
eh->neededVersion/10000,
(eh->neededVersion%10000)/100);
#endif
GuiSetLabelText(wl->cmpEccRequires, "dvdisaster-%d.%d",
eh->neededVersion/10000,
(eh->neededVersion%10000)/100);
}
else
{ PrintLog(_("* requires : dvdisaster-%d.%d (BAD)\n"
@@ -1019,18 +979,16 @@ continue_with_ecc:
(eh->neededVersion%10000)/100);
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
{ SetLabelText(GTK_LABEL(wl->cmpEccRequires),
"<span %s>dvdisaster-%d.%d</span>",
Closure->redMarkup,
eh->neededVersion/10000,
(eh->neededVersion%10000)/100);
{ GuiSetLabelText(wl->cmpEccRequires,
"<span %s>dvdisaster-%d.%d</span>",
Closure->redMarkup,
eh->neededVersion/10000,
(eh->neededVersion%10000)/100);
if(!ecc_advice)
ecc_advice = g_strdup_printf(_("<span %s>Please upgrade your version of dvdisaster!</span>"), Closure->redMarkup);
}
else
#endif
{
if(!ecc_advice)
ecc_advice = g_strdup(_("Please upgrade your version of dvdisaster!"));
@@ -1043,11 +1001,8 @@ continue_with_ecc:
{ PrintLog(_("- medium sectors : %" PRId64 " / %" PRId64 " (good)\n"),
expected_sectors, lay->dataSectors);
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
SetLabelText(GTK_LABEL(wl->cmpEccMediumSectors), "%" PRId64 " / %" PRId64 "",
expected_sectors, lay->dataSectors);
#endif
GuiSetLabelText(wl->cmpEccMediumSectors, "%" PRId64 " / %" PRId64 "",
expected_sectors, lay->dataSectors);
}
else
{ if(image->sectorSize > expected_sectors && image->sectorSize - expected_sectors <= 2)
@@ -1055,14 +1010,12 @@ continue_with_ecc:
expected_sectors);
else PrintLog(_("* medium sectors : %" PRId64 " (BAD)\n"),expected_sectors);
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
{ SetLabelText(GTK_LABEL(wl->cmpEccMediumSectors),
"<span %s>%" PRId64 "</span>", Closure->redMarkup, expected_sectors);
{ GuiSetLabelText(wl->cmpEccMediumSectors,
"<span %s>%" PRId64 "</span>", Closure->redMarkup, expected_sectors);
if(!ecc_advice && image->sectorSize > expected_sectors)
ecc_advice = g_strdup_printf(_("<span %s>Image size does not match recorded size.</span>"), Closure->redMarkup);
}
#endif
}
if(Closure->quickVerify) /* take shortcut again */
@@ -1078,23 +1031,18 @@ continue_with_ecc:
if(n) PrintLog(_("- data md5sum : %s (good)\n"),hdr_digest);
else PrintLog(_("* data md5sum : %s (BAD)\n"),hdr_digest);
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
{ if(n) SetLabelText(GTK_LABEL(wl->cmpEcc1Msg), "%s", hdr_digest);
else
{ SetLabelText(GTK_LABEL(wl->cmpEcc1Msg), "<span %s>%s</span>", Closure->redMarkup, hdr_digest);
SetLabelText(GTK_LABEL(wl->cmpImageMd5Sum), "<span %s>%s</span>", Closure->redMarkup, data_digest);
}
if(n)
{ GuiSetLabelText(wl->cmpEcc1Msg, "%s", hdr_digest);
}
else
{ GuiSetLabelText(wl->cmpEcc1Msg, "<span %s>%s</span>", Closure->redMarkup, hdr_digest);
GuiSetLabelText(wl->cmpImageMd5Sum, "<span %s>%s</span>", Closure->redMarkup, data_digest);
}
#endif
}
else
{ PrintLog(_("- data md5sum : %s\n"), "-");
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
SetLabelText(GTK_LABEL(wl->cmpEcc1Msg), "%s", "-");
#endif
GuiSetLabelText(wl->cmpEcc1Msg, "%s", "-");
}
/*** md5sum of the crc portion */
@@ -1104,28 +1052,18 @@ continue_with_ecc:
if(!crc_missing)
{ if(!memcmp(eh->crcSum, cc->crcSum, 16))
{ PrintLog(_("- crc md5sum : %s (good)\n"),digest);
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
SetLabelText(GTK_LABEL(wl->cmpEcc2Msg), "%s", digest);
#endif
GuiSetLabelText(wl->cmpEcc2Msg, "%s", digest);
}
else
{ PrintLog(_("* crc md5sum : %s (BAD)\n"),digest);
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
{ SetLabelText(GTK_LABEL(wl->cmpEcc2Msg), "<span %s>%s</span>", Closure->redMarkup, digest);
}
ecc_md5_failure = TRUE;
#endif
{ PrintLog(_("* crc md5sum : %s (BAD)\n"),digest);
GuiSetLabelText(wl->cmpEcc2Msg, "<span %s>%s</span>", Closure->redMarkup, digest);
ecc_md5_failure = TRUE;
}
}
else
{ PrintLog(_("- crc md5sum : %s\n"), "-");
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
SetLabelText(GTK_LABEL(wl->cmpEcc2Msg), "%s", "-");
#endif
GuiSetLabelText(wl->cmpEcc2Msg, "%s", "-");
}
/*** meta md5sum of the ecc slices */
@@ -1135,64 +1073,48 @@ continue_with_ecc:
if(!ecc_missing)
{ if(!memcmp(eh->eccSum, ecc_sum, 16))
{ PrintLog(_("- ecc md5sum : %s (good)\n"),digest);
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
SetLabelText(GTK_LABEL(wl->cmpEcc3Msg), "%s", digest);
#endif
GuiSetLabelText(wl->cmpEcc3Msg, "%s", digest);
}
else
{ PrintLog(_("* ecc md5sum : %s (BAD)\n"),digest);
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
{ SetLabelText(GTK_LABEL(wl->cmpEcc3Msg), "<span %s>%s</span>", Closure->redMarkup, digest);
}
GuiSetLabelText(wl->cmpEcc3Msg, "<span %s>%s</span>", Closure->redMarkup, digest);
ecc_md5_failure = TRUE;
#endif
}
}
else
{ PrintLog(_("- ecc md5sum : %s\n"), "-");
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
SetLabelText(GTK_LABEL(wl->cmpEcc3Msg), "%s", "-");
#endif
GuiSetLabelText(wl->cmpEcc3Msg, "%s", "-");
}
/*** Print final results */
#ifndef WITH_CLI_ONLY_YES
try_it =
#endif
prognosis(cc, total_missing + data_crc_errors - hdr_correctable, expected_sectors);
try_it = prognosis(cc, total_missing + data_crc_errors - hdr_correctable, expected_sectors);
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
{ if(ecc_advice)
{ SetLabelText(GTK_LABEL(wl->cmpEccResult), "%s", ecc_advice);
{ GuiSetLabelText(wl->cmpEccResult, "%s", ecc_advice);
g_free(ecc_advice);
}
else
if(!crc_missing && !ecc_missing && !hdr_missing && !hdr_crc_errors && !ecc_md5_failure)
SetLabelText(GTK_LABEL(wl->cmpEccResult),
_("<span %s>Good error correction data.</span>"),
Closure->greenMarkup);
else
{ if(try_it) SetLabelText(GTK_LABEL(wl->cmpEccResult),
_("<span %s>Full data recovery is likely.</span>"),
Closure->greenMarkup);
else SetLabelText(GTK_LABEL(wl->cmpEccResult),
_("<span %s>Full data recovery is NOT possible.</span>"),
Closure->redMarkup);
{ GuiSetLabelText(wl->cmpEccResult,
_("<span %s>Good error correction data.</span>"),
Closure->greenMarkup);
}
else
{ if(try_it)
{ GuiSetLabelText(wl->cmpEccResult,
_("<span %s>Full data recovery is likely.</span>"),
Closure->greenMarkup);
}
else
{ GuiSetLabelText(wl->cmpEccResult,
_("<span %s>Full data recovery is NOT possible.</span>"),
Closure->redMarkup);
}
}
}
else
#endif
{ if(ecc_advice)
{ PrintLog("%s", ecc_advice);
g_free(ecc_advice);
}
}
/*** Close and clean up */

View File

@@ -19,7 +19,10 @@
* You should have received a copy of the GNU General Public License
* along with dvdisaster. If not, see <http://www.gnu.org/licenses/>.
*/
// DVDISASTER_GUI_FILE
/*** src type: only GUI code ***/
#ifdef WITH_GUI_YES
#include "dvdisaster.h"
@@ -41,8 +44,8 @@ static void update_geometry(RS02Widgets*);
void ResetRS02EncWindow(Method *method)
{ RS02Widgets *wl = (RS02Widgets*)method->widgetList;
SetProgress(wl->encPBar1, 0, 100);
SetProgress(wl->encPBar2, 0, 100);
GuiSetProgress(wl->encPBar1, 0, 100);
GuiSetProgress(wl->encPBar2, 0, 100);
gtk_widget_hide(wl->encLabel2);
gtk_widget_hide(wl->encPBar2);
@@ -53,13 +56,7 @@ void ResetRS02EncWindow(Method *method)
void CreateRS02EncWindow(Method *method, GtkWidget *parent)
{ GtkWidget *wid,*table,*pbar,*sep;
RS02Widgets *wl;
if(!method->widgetList)
{ wl = g_malloc0(sizeof(RS02Widgets));
method->widgetList = wl;
}
else wl = method->widgetList;
RS02Widgets *wl = method->widgetList;
wl->encHeadline = gtk_label_new(NULL);
gtk_misc_set_alignment(GTK_MISC(wl->encHeadline), 0.0, 0.0);
@@ -76,8 +73,7 @@ void CreateRS02EncWindow(Method *method, GtkWidget *parent)
gtk_box_pack_start(GTK_BOX(parent), table, FALSE, FALSE, 30);
wl->encLabel1 = wid = gtk_label_new(NULL);
gtk_label_set_markup(GTK_LABEL(wid),
_utf("<b>1. Preparing image:</b>"));
gtk_label_set_markup(GTK_LABEL(wid),_utf("<b>1. Preparing image:</b>"));
gtk_misc_set_alignment(GTK_MISC(wid), 0.0, 0.0);
gtk_table_attach(GTK_TABLE(table), wid, 0, 1, 0, 1, GTK_SHRINK | GTK_FILL, GTK_SHRINK, 20, 20);
@@ -138,9 +134,12 @@ void RS02SetFixMaxValues(RS02Widgets *wl, int data_bytes, int ecc_bytes, gint64
static gboolean results_idle_func(gpointer data)
{ RS02Widgets *wl = (RS02Widgets*)data;
SetLabelText(GTK_LABEL(wl->fixCorrected), _("Repaired: %" PRId64 ""), wl->corrected);
SetLabelText(GTK_LABEL(wl->fixUncorrected), _("Unrepairable: <span %s>%" PRId64 "</span>"),Closure->redMarkup, wl->uncorrected);
SetLabelText(GTK_LABEL(wl->fixProgress), _("Progress: %3d.%1d%%"), wl->percent/10, wl->percent%10);
GuiSetLabelText(wl->fixCorrected, _("Repaired: %" PRId64),
wl->corrected);
GuiSetLabelText(wl->fixUncorrected, _("Unrepairable: <span %s>%" PRId64 "</span>"),
Closure->redMarkup, wl->uncorrected);
GuiSetLabelText(wl->fixProgress, _("Progress: %3d.%1d%%"),
wl->percent/10, wl->percent%10);
return FALSE;
}
@@ -159,9 +158,9 @@ void RS02UpdateFixResults(RS02Widgets *wl, gint64 corrected, gint64 uncorrected)
static gboolean curve_idle_func(gpointer data)
{ RS02Widgets *wl = (RS02Widgets*)data;
gint x0 = CurveX(wl->fixCurve, (double)wl->lastPercent);
gint x1 = CurveX(wl->fixCurve, (double)wl->percent);
gint y = CurveY(wl->fixCurve, wl->fixCurve->ivalue[wl->percent]);
gint x0 = GuiCurveX(wl->fixCurve, (double)wl->lastPercent);
gint x1 = GuiCurveX(wl->fixCurve, (double)wl->percent);
gint y = GuiCurveY(wl->fixCurve, wl->fixCurve->ivalue[wl->percent]);
gint i;
/*** Mark unused ecc values */
@@ -195,7 +194,7 @@ static gboolean curve_idle_func(gpointer data)
/* Redraw the ecc capacity threshold line */
y = CurveY(wl->fixCurve, wl->eccBytes);
y = GuiCurveY(wl->fixCurve, wl->eccBytes);
gdk_gc_set_rgb_fg_color(Closure->drawGC, Closure->greenSector);
gdk_draw_line(wl->fixCurve->widget->window,
Closure->drawGC,
@@ -227,7 +226,7 @@ static void update_geometry(RS02Widgets *wl)
{
/* Curve geometry */
UpdateCurveGeometry(wl->fixCurve, "999", 20);
GuiUpdateCurveGeometry(wl->fixCurve, "999", 20);
/* Label positions in the foot line */
@@ -242,12 +241,12 @@ static void redraw_curve(RS02Widgets *wl)
/* Redraw the curve */
RedrawAxes(wl->fixCurve);
RedrawCurve(wl->fixCurve, wl->percent);
GuiRedrawAxes(wl->fixCurve);
GuiRedrawCurve(wl->fixCurve, wl->percent);
/* Ecc capacity threshold line */
y = CurveY(wl->fixCurve, wl->eccBytes);
y = GuiCurveY(wl->fixCurve, wl->eccBytes);
gdk_gc_set_rgb_fg_color(Closure->drawGC, Closure->greenSector);
gdk_draw_line(wl->fixCurve->widget->window,
Closure->drawGC,
@@ -275,7 +274,7 @@ void ResetRS02FixWindow(Method *method)
gtk_notebook_set_current_page(GTK_NOTEBOOK(wl->fixNotebook), 0);
ZeroCurve(wl->fixCurve);
GuiZeroCurve(wl->fixCurve);
RS02UpdateFixResults(wl, 0, 0);
if(wl->fixCurve && wl->fixCurve->widget)
@@ -291,7 +290,6 @@ void ResetRS02FixWindow(Method *method)
* Create the Fix window contents
*/
void CreateRS02FixWindow(Method *method, GtkWidget *parent)
{ RS02Widgets *wl;
GtkWidget *sep,*ignore,*d_area,*notebook,*hbox;
@@ -345,7 +343,7 @@ void CreateRS02FixWindow(Method *method, GtkWidget *parent)
ignore = gtk_label_new("footer_tab");
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), wl->fixFootline, ignore);
wl->fixCurve = CreateCurve(d_area, _("Errors/Ecc block"), "%d", 1000, CURVE_PERCENT);
wl->fixCurve = GuiCreateCurve(d_area, _("Errors/Ecc block"), "%d", 1000, CURVE_PERCENT);
wl->fixCurve->enable = DRAW_ICURVE;
}
@@ -396,8 +394,8 @@ static void cache_cb(GtkWidget *widget, gpointer data)
utf = g_locale_to_utf8(text, -1, NULL, NULL, NULL);
gtk_label_set_markup(GTK_LABEL(lwoh->normalLabel), utf);
gtk_label_set_markup(GTK_LABEL(lwoh->linkLabel), utf);
SetOnlineHelpLinkText(lwoh, text);
UpdateMethodPreferences();
GuiSetOnlineHelpLinkText(lwoh, text);
GuiUpdateMethodPreferences();
g_free(text);
g_free(utf);
}
@@ -781,8 +779,9 @@ void CreateRS02PrefsPage(Method *method, GtkWidget *parent)
/* Drive capacity table header */
lwoh = CreateLabelWithOnlineHelp(_("Using the smallest possible size from table"), _("Use smallest possible size from following table (in sectors):"));
RegisterPreferencesHelpWindow(lwoh);
lwoh = GuiCreateLabelWithOnlineHelp(_("Using the smallest possible size from table"),
_("Use smallest possible size from following table (in sectors):"));
GuiRegisterPreferencesHelpWindow(lwoh);
vbox2 = gtk_vbox_new(FALSE, 0);
gtk_box_pack_start(GTK_BOX(hbox), vbox2, FALSE, FALSE, 0);
@@ -801,20 +800,21 @@ void CreateRS02PrefsPage(Method *method, GtkWidget *parent)
wl->radio1B = radio;
gtk_box_pack_start(GTK_BOX(hbox), radio, FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(hbox), lwoh->normalLabel, FALSE, FALSE, 0);
AddHelpWidget(lwoh, hbox);
GuiAddHelpWidget(lwoh, hbox);
}
}
AddHelpParagraph(lwoh, _("<b>Determine augmented image size from table</b>\n\n"
"Augmented images fill up unused medium space "
"with error correction information. Activate this option "
"if you want the augmented image to fit on the smallest "
"possible medium.\n\n"
GuiAddHelpParagraph(lwoh,
_("<b>Determine augmented image size from table</b>\n\n"
"Augmented images fill up unused medium space "
"with error correction information. Activate this option "
"if you want the augmented image to fit on the smallest "
"possible medium.\n\n"
"In order to pick a suitable medium the available media "
"capacities must be known. Default sizes for CD and "
"one/two layered DVD and BD are given in the table. You can edit "
"these sizes according to your needs."));
"In order to pick a suitable medium the available media "
"capacities must be known. Default sizes for CD and "
"one/two layered DVD and BD are given in the table. You can edit "
"these sizes according to your needs."));
table = gtk_table_new(5, 6, FALSE);
gtk_box_pack_start(GTK_BOX(hbox), table, FALSE, FALSE, 0);
@@ -827,8 +827,8 @@ void CreateRS02PrefsPage(Method *method, GtkWidget *parent)
/* CD capacity table row */
lwoh = CreateLabelWithOnlineHelp(_("CD-R / CD-RW:"), _("CD-R / CD-RW:"));
RegisterPreferencesHelpWindow(lwoh);
lwoh = GuiCreateLabelWithOnlineHelp(_("CD-R / CD-RW:"), _("CD-R / CD-RW:"));
GuiRegisterPreferencesHelpWindow(lwoh);
gtk_misc_set_alignment(GTK_MISC(lwoh->linkLabel), 0.0, 0.0);
tinybox = gtk_hbox_new(FALSE, 0);
@@ -870,28 +870,29 @@ void CreateRS02PrefsPage(Method *method, GtkWidget *parent)
g_signal_connect(G_OBJECT(wl->cdUndoButtonB), "clicked", G_CALLBACK(query_cb), wl);
gtk_box_pack_start(GTK_BOX(hbox), wl->cdUndoButtonB, FALSE, FALSE, 0);
AddHelpWidget(lwoh, hbox);
GuiAddHelpWidget(lwoh, hbox);
AddHelpParagraph(lwoh, _("<b>CD medium size</b>\n\n"
"This is the maximum capacity assumed for 80min CD media. "
"Images smaller than this value will be "
"augmented with error correction information "
"so that they will fit on the specified CD.\n\n"
"You can enter the medium size in sectors of 2K each, "
"or press the \"query medium\" button to use the size "
"of a medium currently inserted in the selected "
"drive. Sometimes this value is incorrect, though.\n"
"Use the arrow button to revert to the last saved value.\n\n"
"Please note that augmented images will at most triple "
"in size as the highest possible redundancy is 200%%.\n"
"Even if this limit is not reached the augmented image "
"may be a few sectors smaller than specified for "
"technical reasons."));
GuiAddHelpParagraph(lwoh,
_("<b>CD medium size</b>\n\n"
"This is the maximum capacity assumed for 80min CD media. "
"Images smaller than this value will be "
"augmented with error correction information "
"so that they will fit on the specified CD.\n\n"
"You can enter the medium size in sectors of 2K each, "
"or press the \"query medium\" button to use the size "
"of a medium currently inserted in the selected "
"drive. Sometimes this value is incorrect, though.\n"
"Use the arrow button to revert to the last saved value.\n\n"
"Please note that augmented images will at most triple "
"in size as the highest possible redundancy is 200%%.\n"
"Even if this limit is not reached the augmented image "
"may be a few sectors smaller than specified for "
"technical reasons."));
/* DVD capacity table row */
lwoh = CreateLabelWithOnlineHelp(_("DVD 1 layer:"), _("DVD 1 layer:"));
RegisterPreferencesHelpWindow(lwoh);
lwoh = GuiCreateLabelWithOnlineHelp(_("DVD 1 layer:"), _("DVD 1 layer:"));
GuiRegisterPreferencesHelpWindow(lwoh);
gtk_misc_set_alignment(GTK_MISC(lwoh->linkLabel), 0.0, 0.0);
tinybox = gtk_hbox_new(FALSE, 0);
@@ -933,28 +934,29 @@ void CreateRS02PrefsPage(Method *method, GtkWidget *parent)
g_signal_connect(G_OBJECT(wl->dvdUndoButton1B), "clicked", G_CALLBACK(query_cb), wl);
gtk_box_pack_start(GTK_BOX(hbox), wl->dvdUndoButton1B, FALSE, FALSE, 0);
AddHelpWidget(lwoh, hbox);
GuiAddHelpWidget(lwoh, hbox);
AddHelpParagraph(lwoh, _("<b>Single layer DVD medium size</b>\n\n"
"This is the maximum capacity assumed for single layer DVD media. "
"Images exceeding the smaller media sizes but smaller "
"than this value will be augmented with error correction information "
"so that they will fit on the specified DVD.\n\n"
"You can enter the medium size in sectors of 2K each, "
"or press the \"query medium\" button to use the size "
"of a medium currently inserted in the selected "
"drive. Sometimes this value is incorrect, though.\n"
"Use the arrow button to revert to the last saved value.\n\n"
"Please note that augmented images will at most triple "
"in size as the highest possible redundancy is 200%%.\n"
"Even if this limit is not reached the augmented image "
"may be a few sectors smaller than specified for "
"technical reasons."));
GuiAddHelpParagraph(lwoh,
_("<b>Single layer DVD medium size</b>\n\n"
"This is the maximum capacity assumed for single layer DVD media. "
"Images exceeding the smaller media sizes but smaller "
"than this value will be augmented with error correction information "
"so that they will fit on the specified DVD.\n\n"
"You can enter the medium size in sectors of 2K each, "
"or press the \"query medium\" button to use the size "
"of a medium currently inserted in the selected "
"drive. Sometimes this value is incorrect, though.\n"
"Use the arrow button to revert to the last saved value.\n\n"
"Please note that augmented images will at most triple "
"in size as the highest possible redundancy is 200%%.\n"
"Even if this limit is not reached the augmented image "
"may be a few sectors smaller than specified for "
"technical reasons."));
/* DVD two layer capacity table row */
lwoh = CreateLabelWithOnlineHelp(_("DVD 2 layers:"), _("DVD 2 layers:"));
RegisterPreferencesHelpWindow(lwoh);
lwoh = GuiCreateLabelWithOnlineHelp(_("DVD 2 layers:"), _("DVD 2 layers:"));
GuiRegisterPreferencesHelpWindow(lwoh);
gtk_misc_set_alignment(GTK_MISC(lwoh->linkLabel), 0.0, 0.0);
tinybox = gtk_hbox_new(FALSE, 0);
@@ -996,28 +998,29 @@ void CreateRS02PrefsPage(Method *method, GtkWidget *parent)
g_signal_connect(G_OBJECT(wl->dvdUndoButton2B), "clicked", G_CALLBACK(query_cb), wl);
gtk_box_pack_start(GTK_BOX(hbox), wl->dvdUndoButton2B, FALSE, FALSE, 0);
AddHelpWidget(lwoh, hbox);
GuiAddHelpWidget(lwoh, hbox);
AddHelpParagraph(lwoh, _("<b>Two layered DVD medium size</b>\n\n"
"This is the maximum capacity assumed for two layered DVD media. "
"Images exceeding the smaller media sizes but smaller "
"than this value will be augmented with error correction information "
"so that they will fit on the specified DVD.\n\n"
"You can enter the medium size in sectors of 2K each, "
"or press the \"query medium\" button to use the size "
"of a medium currently inserted in the selected "
"drive. Sometimes this value is incorrect, though.\n"
"Use the arrow button to revert to the last saved value.\n\n"
"Please note that augmented images will at most triple "
"in size as the highest possible redundancy is 200%%.\n"
"Even if this limit is not reached the augmented image "
"may be a few sectors smaller than specified for "
"technical reasons."));
GuiAddHelpParagraph(lwoh,
_("<b>Two layered DVD medium size</b>\n\n"
"This is the maximum capacity assumed for two layered DVD media. "
"Images exceeding the smaller media sizes but smaller "
"than this value will be augmented with error correction information "
"so that they will fit on the specified DVD.\n\n"
"You can enter the medium size in sectors of 2K each, "
"or press the \"query medium\" button to use the size "
"of a medium currently inserted in the selected "
"drive. Sometimes this value is incorrect, though.\n"
"Use the arrow button to revert to the last saved value.\n\n"
"Please note that augmented images will at most triple "
"in size as the highest possible redundancy is 200%%.\n"
"Even if this limit is not reached the augmented image "
"may be a few sectors smaller than specified for "
"technical reasons."));
/* BD capacity table row */
lwoh = CreateLabelWithOnlineHelp(_("BD 1 layer:"), _("BD 1 layer:"));
RegisterPreferencesHelpWindow(lwoh);
lwoh = GuiCreateLabelWithOnlineHelp(_("BD 1 layer:"), _("BD 1 layer:"));
GuiRegisterPreferencesHelpWindow(lwoh);
gtk_misc_set_alignment(GTK_MISC(lwoh->linkLabel), 0.0, 0.0);
tinybox = gtk_hbox_new(FALSE, 0);
@@ -1059,27 +1062,28 @@ void CreateRS02PrefsPage(Method *method, GtkWidget *parent)
g_signal_connect(G_OBJECT(wl->bdUndoButton1B), "clicked", G_CALLBACK(query_cb), wl);
gtk_box_pack_start(GTK_BOX(hbox), wl->bdUndoButton1B, FALSE, FALSE, 0);
AddHelpWidget(lwoh, hbox);
GuiAddHelpWidget(lwoh, hbox);
AddHelpParagraph(lwoh, _("<b>Single layer BD medium size</b>\n\n"
"This is the maximum capacity assumed for single layer BD media. "
"Images exceeding the smaller media sizes but smaller "
"than this value will be augmented with error correction information "
"so that they will fit on the specified BD.\n\n"
"You can enter the medium size in sectors of 2K each, "
"or press the \"query medium\" button to use the size "
"of a blank medium currently inserted in the selected drive.\n"
"Use the arrow button to revert to the last saved value.\n\n"
"Please note that augmented images will at most triple "
"in size as the highest possible redundancy is 200%%.\n"
"Even if this limit is not reached the augmented image "
"may be a few sectors smaller than specified for "
"technical reasons."));
GuiAddHelpParagraph(lwoh,
_("<b>Single layer BD medium size</b>\n\n"
"This is the maximum capacity assumed for single layer BD media. "
"Images exceeding the smaller media sizes but smaller "
"than this value will be augmented with error correction information "
"so that they will fit on the specified BD.\n\n"
"You can enter the medium size in sectors of 2K each, "
"or press the \"query medium\" button to use the size "
"of a blank medium currently inserted in the selected drive.\n"
"Use the arrow button to revert to the last saved value.\n\n"
"Please note that augmented images will at most triple "
"in size as the highest possible redundancy is 200%%.\n"
"Even if this limit is not reached the augmented image "
"may be a few sectors smaller than specified for "
"technical reasons."));
/* BD two layer capacity table row */
lwoh = CreateLabelWithOnlineHelp(_("BD 2 layers:"), _("BD 2 layers:"));
RegisterPreferencesHelpWindow(lwoh);
lwoh = GuiCreateLabelWithOnlineHelp(_("BD 2 layers:"), _("BD 2 layers:"));
GuiRegisterPreferencesHelpWindow(lwoh);
gtk_misc_set_alignment(GTK_MISC(lwoh->linkLabel), 0.0, 0.0);
tinybox = gtk_hbox_new(FALSE, 0);
@@ -1121,27 +1125,28 @@ void CreateRS02PrefsPage(Method *method, GtkWidget *parent)
g_signal_connect(G_OBJECT(wl->bdUndoButton2B), "clicked", G_CALLBACK(query_cb), wl);
gtk_box_pack_start(GTK_BOX(hbox), wl->bdUndoButton2B, FALSE, FALSE, 0);
AddHelpWidget(lwoh, hbox);
GuiAddHelpWidget(lwoh, hbox);
AddHelpParagraph(lwoh, _("<b>Two layered BD medium size</b>\n\n"
"This is the maximum capacity assumed for two layered BD media. "
"Images exceeding the smaller media sizes but smaller "
"than this value will be augmented with error correction information "
"so that they will fit on the specified BD.\n\n"
"You can enter the medium size in sectors of 2K each, "
"or press the \"query medium\" button to use the size "
"of a blank medium currently inserted in the selected drive.\n"
"Use the arrow button to revert to the last saved value.\n\n"
"Please note that augmented images will at most triple "
"in size as the highest possible redundancy is 200%%.\n"
"Even if this limit is not reached the augmented image "
"may be a few sectors smaller than specified for "
"technical reasons."));
GuiAddHelpParagraph(lwoh,
_("<b>Two layered BD medium size</b>\n\n"
"This is the maximum capacity assumed for two layered BD media. "
"Images exceeding the smaller media sizes but smaller "
"than this value will be augmented with error correction information "
"so that they will fit on the specified BD.\n\n"
"You can enter the medium size in sectors of 2K each, "
"or press the \"query medium\" button to use the size "
"of a blank medium currently inserted in the selected drive.\n"
"Use the arrow button to revert to the last saved value.\n\n"
"Please note that augmented images will at most triple "
"in size as the highest possible redundancy is 200%%.\n"
"Even if this limit is not reached the augmented image "
"may be a few sectors smaller than specified for "
"technical reasons."));
/* BDXL three layer capacity table row */
lwoh = CreateLabelWithOnlineHelp(_("BDXL 3 layers:"), _("BDXL 3 layers:"));
RegisterPreferencesHelpWindow(lwoh);
lwoh = GuiCreateLabelWithOnlineHelp(_("BDXL 3 layers:"), _("BDXL 3 layers:"));
GuiRegisterPreferencesHelpWindow(lwoh);
gtk_misc_set_alignment(GTK_MISC(lwoh->linkLabel), 0.0, 0.0);
tinybox = gtk_hbox_new(FALSE, 0);
@@ -1183,29 +1188,30 @@ void CreateRS02PrefsPage(Method *method, GtkWidget *parent)
g_signal_connect(G_OBJECT(wl->bdUndoButton3B), "clicked", G_CALLBACK(query_cb), wl);
gtk_box_pack_start(GTK_BOX(hbox), wl->bdUndoButton3B, FALSE, FALSE, 0);
AddHelpWidget(lwoh, hbox);
GuiAddHelpWidget(lwoh, hbox);
AddHelpParagraph(lwoh, _("<b>Three layered BDXL medium size</b>\n\n"
"This is the maximum capacity assumed for three layered BDXL media. "
"Images exceeding the smaller media sizes but smaller "
"than this value will be augmented with error correction information "
"so that they will fit on the specified BD.\n\n"
"You can enter the medium size in sectors of 2K each, "
"or press the \"query medium\" button to use the size "
"of a blank medium currently inserted in the selected drive.\n"
"Use the arrow button to revert to the last saved value.\n\n"
"Please note that augmented images will at most triple "
"in size as the highest possible redundancy is 200%%.\n"
"Even if this limit is not reached the augmented image "
"may be a few sectors smaller than specified for "
"technical reasons."));
GuiAddHelpParagraph(lwoh,
_("<b>Three layered BDXL medium size</b>\n\n"
"This is the maximum capacity assumed for three layered BDXL media. "
"Images exceeding the smaller media sizes but smaller "
"than this value will be augmented with error correction information "
"so that they will fit on the specified BD.\n\n"
"You can enter the medium size in sectors of 2K each, "
"or press the \"query medium\" button to use the size "
"of a blank medium currently inserted in the selected drive.\n"
"Use the arrow button to revert to the last saved value.\n\n"
"Please note that augmented images will at most triple "
"in size as the highest possible redundancy is 200%%.\n"
"Even if this limit is not reached the augmented image "
"may be a few sectors smaller than specified for "
"technical reasons."));
/* BDXL four layer capacity table row */
lwoh = CreateLabelWithOnlineHelp(_("BDXL 4 layers:"), _("BDXL 4 layers:"));
RegisterPreferencesHelpWindow(lwoh);
lwoh = GuiCreateLabelWithOnlineHelp(_("BDXL 4 layers:"), _("BDXL 4 layers:"));
GuiRegisterPreferencesHelpWindow(lwoh);
gtk_misc_set_alignment(GTK_MISC(lwoh->linkLabel), 0.0, 0.0);
tinybox = gtk_hbox_new(FALSE, 0);
@@ -1247,9 +1253,9 @@ void CreateRS02PrefsPage(Method *method, GtkWidget *parent)
g_signal_connect(G_OBJECT(wl->bdUndoButton4B), "clicked", G_CALLBACK(query_cb), wl);
gtk_box_pack_start(GTK_BOX(hbox), wl->bdUndoButton4B, FALSE, FALSE, 0);
AddHelpWidget(lwoh, hbox);
GuiAddHelpWidget(lwoh, hbox);
AddHelpParagraph(lwoh, _("<b>Four layered BDXL medium size</b>\n\n"
GuiAddHelpParagraph(lwoh, _("<b>Four layered BDXL medium size</b>\n\n"
"This is the maximum capacity assumed for four layered BDXL media. "
"Images exceeding the smaller media sizes but smaller "
"than this value will be augmented with error correction information "
@@ -1290,8 +1296,8 @@ void CreateRS02PrefsPage(Method *method, GtkWidget *parent)
/* custom value selection */
lwoh = CreateLabelWithOnlineHelp(_("Use at most"), _("Use at most"));
RegisterPreferencesHelpWindow(lwoh);
lwoh = GuiCreateLabelWithOnlineHelp(_("Use at most"), _("Use at most"));
GuiRegisterPreferencesHelpWindow(lwoh);
for(i=0; i<2; i++)
{ GtkWidget *hbox = gtk_hbox_new(FALSE, 4);
@@ -1320,22 +1326,23 @@ void CreateRS02PrefsPage(Method *method, GtkWidget *parent)
}
else
{ wl->otherEntryB = entry;
AddHelpWidget(lwoh, hbox);
GuiAddHelpWidget(lwoh, hbox);
}
}
AddHelpParagraph(lwoh, _("<b>Use at most ... sectors</b>\n\n"
"Use this option to override the table settings; "
"the augmented image will be expanded to the size "
"given in this field.\n"
"This allows for the creation of DVD-sized augmented images "
"which would normally be fitted to CD size, and to use "
"non standard media.\n\n"
"Please note that augmented images will at most triple "
"in size as the highest possible redundancy is 200%%.\n"
"Even if this limit is not reached the augmented image "
"may be a few sectors smaller than specified for "
"technical reasons."));
GuiAddHelpParagraph(lwoh,
_("<b>Use at most ... sectors</b>\n\n"
"Use this option to override the table settings; "
"the augmented image will be expanded to the size "
"given in this field.\n"
"This allows for the creation of DVD-sized augmented images "
"which would normally be fitted to CD size, and to use "
"non standard media.\n\n"
"Please note that augmented images will at most triple "
"in size as the highest possible redundancy is 200%%.\n"
"Even if this limit is not reached the augmented image "
"may be a few sectors smaller than specified for "
"technical reasons."));
g_snprintf(value, 40, "%lld", (long long int)Closure->mediumSize);
gtk_entry_set_text(GTK_ENTRY(wl->otherEntryA), value);
@@ -1360,13 +1367,13 @@ void CreateRS02PrefsPage(Method *method, GtkWidget *parent)
gtk_box_pack_start(GTK_BOX(parent), frame, FALSE, FALSE, 0);
text = g_strdup_printf(_("%d MiB of file cache"), Closure->cacheMiB);
lwoh = CreateLabelWithOnlineHelp(_("File cache"), text);
RegisterPreferencesHelpWindow(lwoh);
lwoh = GuiCreateLabelWithOnlineHelp(_("File cache"), text);
GuiRegisterPreferencesHelpWindow(lwoh);
g_free(text);
wl->cacheLwoh = lwoh;
LockLabelSize(GTK_LABEL(lwoh->normalLabel), _utf("%d MiB of file cache"), 2222);
LockLabelSize(GTK_LABEL(lwoh->linkLabel), _utf("%d MiB of file cache"), 2222);
GuiLockLabelSize(lwoh->normalLabel, _utf("%d MiB of file cache"), 2222);
GuiLockLabelSize(lwoh->linkLabel, _utf("%d MiB of file cache"), 2222);
for(i=0; i<2; i++)
{ GtkWidget *hbox = gtk_hbox_new(FALSE, 4);
@@ -1397,12 +1404,15 @@ void CreateRS02PrefsPage(Method *method, GtkWidget *parent)
else
{ wl->cacheScaleB = scale;
gtk_box_pack_start(GTK_BOX(hbox), lwoh->normalLabel, FALSE, FALSE, 0);
AddHelpWidget(lwoh, hbox);
GuiAddHelpWidget(lwoh, hbox);
}
}
AddHelpParagraph(lwoh, _("<b>File cache</b>\n\n"
"dvdisaster optimizes access to the image and error correction "
"files by maintaining its own cache. "
"The preset of 32MiB is suitable for most systems."));
GuiAddHelpParagraph(lwoh,
_("<b>File cache</b>\n\n"
"dvdisaster optimizes access to the image and error correction "
"files by maintaining its own cache. "
"The preset of 32MiB is suitable for most systems."));
}
#endif /* WITH_GUI_YES */

View File

@@ -20,11 +20,12 @@
* along with dvdisaster. If not, see <http://www.gnu.org/licenses/>.
*/
/*** src type: no GUI code ***/
#include "dvdisaster.h"
#include "rs03-includes.h"
/***
*** Read and buffer CRC information from RS03 error correction data
***/

View File

@@ -20,6 +20,8 @@
* along with dvdisaster. If not, see <http://www.gnu.org/licenses/>.
*/
/*** src type: some GUI code ***/
#include "dvdisaster.h"
#include "rs03-includes.h"
@@ -67,9 +69,7 @@
typedef struct
{ Method *self;
Image *image;
#ifndef WITH_CLI_ONLY_YES
RS03Widgets *wl;
#endif
RS03Layout *lay;
EccHeader *eh; /* ecc header in native byte order */
EccHeader *eh_le; /* ecc header in little endian order */
@@ -147,15 +147,12 @@ static void ecc_cleanup(gpointer data)
}
}
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
{ if(ec->earlyTermination)
SetLabelText(GTK_LABEL(ec->wl->encFootline),
_("<span %s>Aborted by unrecoverable error.</span>"),
Closure->redMarkup);
AllowActions(TRUE);
if(ec->earlyTermination)
{ GuiSetLabelText(ec->wl->encFootline,
_("<span %s>Aborted by unrecoverable error.</span>"),
Closure->redMarkup);
}
#endif
GuiAllowActions(TRUE);
/*** We must invalidate the CRC cache as it does only cover the
data portion of the image, not the full RS03 enhanced image
@@ -229,10 +226,7 @@ static void ecc_cleanup(gpointer data)
if(ec->encoderData) g_free(ec->encoderData);
g_free(ec);
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
g_thread_exit(0);
#endif
GuiExitWorkerThread();
}
/***
@@ -244,32 +238,26 @@ static void ecc_cleanup(gpointer data)
*/
static void abort_encoding(ecc_closure *ec, int truncate)
{
#ifndef WITH_CLI_ONLY_YES
RS03Widgets *wl = ec->wl;
#endif
{
if(truncate && ec->lay)
{ if(Closure->eccTarget == ECC_FILE)
LargeUnlink(Closure->eccName);
else if(!LargeTruncate(ec->image->file, (gint64)(2048*ec->lay->dataSectors)))
Stop(_("Could not truncate %s: %s\n"),Closure->imageName,strerror(errno));
#ifndef WITH_CLI_ONLY_YES
if(Closure->stopActions == STOP_CURRENT_ACTION) /* suppress memleak warning when closing window */
SetLabelText(GTK_LABEL(wl->encFootline),
_("<span %s>Aborted by user request!</span> (partial ecc data removed from image)"),
Closure->redMarkup);
#endif
{ GuiSetLabelText(ec->wl->encFootline,
_("<span %s>Aborted by user request!</span> (partial ecc data removed from image)"),
Closure->redMarkup);
}
}
#ifndef WITH_CLI_ONLY_YES
else
{ if(Closure->stopActions == STOP_CURRENT_ACTION) /* suppress memleak warning when closing window */
SetLabelText(GTK_LABEL(wl->encFootline),
_("<span %s>Aborted by user request!</span>"),
Closure->redMarkup);
{ GuiSetLabelText(ec->wl->encFootline,
_("<span %s>Aborted by user request!</span>"),
Closure->redMarkup);
}
}
#endif
ec->earlyTermination = FALSE; /* suppress respective error message */
@@ -289,17 +277,15 @@ static void remove_old_ecc(ecc_closure *ec)
if(Closure->eccTarget == ECC_FILE)
{ if(LargeStat(Closure->eccName, &ignore))
{
if(ConfirmEccDeletion(Closure->eccName))
if(GuiConfirmEccDeletion(Closure->eccName))
LargeUnlink(Closure->eccName);
#ifndef WITH_CLI_ONLY_YES
else
{ SetLabelText(GTK_LABEL(ec->wl->encFootline),
_("<span %s>Aborted to keep existing ecc file.</span>"),
Closure->redMarkup);
{ GuiSetLabelText(ec->wl->encFootline,
_("<span %s>Aborted to keep existing ecc file.</span>"),
Closure->redMarkup);
ec->earlyTermination = FALSE;
ecc_cleanup((gpointer)ec);
}
#endif
}
return;
}
@@ -311,16 +297,12 @@ static void remove_old_ecc(ecc_closure *ec)
guint64 data_bytes;
int answer;
#ifndef WITH_CLI_ONLY_YES
if(Closure->confirmDeletion || !Closure->guiMode)
#endif
answer = ModalWarningOrCLI(GTK_MESSAGE_WARNING, GTK_BUTTONS_OK_CANCEL, NULL,
answer = ModalWarning(GTK_MESSAGE_WARNING, GTK_BUTTONS_OK_CANCEL, NULL,
_("Image \"%s\" already contains error correction information.\n"
"Truncating image to data part (%" PRId64 " sectors).\n"),
Closure->imageName, data_sectors);
#ifndef WITH_CLI_ONLY_YES
else answer = TRUE;
#endif
if(!answer)
abort_encoding(ec, FALSE);
@@ -384,16 +366,18 @@ static void prepare_header(ecc_closure *ec)
eh->selfCRC = 0x4c5047;
if(CrcBufValid(Closure->crcBuf, NULL, NULL))
{ if(Closure->eccTarget == ECC_FILE) /* ecc files span the whole image */
{ if(Closure->crcBuf->md5State & MD5_IMAGE_COMPLETE)
if(Closure->eccTarget == ECC_FILE) /* ecc files span the whole image */
{ if(CrcBufValid(Closure->crcBuf, image, FULL_IMAGE))
{ if(Closure->crcBuf->md5State & MD5_IMAGE_COMPLETE)
{ memcpy(eh->mediumSum, Closure->crcBuf->imageMD5sum, 16);
eh->methodFlags[0] |= MFLAG_DATA_MD5;
Verbose("CrcBuf present, ecc file: using image MD5 sum\n");
}
else Verbose("CrcBuf present, ecc file: image MD5 sum NOT available\n");
}
else /* augmented images are stripped down to the data portion */
}
else /* augmented images are stripped down to the data portion */
{ if(CrcBufValid(Closure->crcBuf, image, DATA_SECTORS_ONLY))
{ if(Closure->crcBuf->md5State & MD5_DATA_COMPLETE)
{ memcpy(eh->mediumSum, Closure->crcBuf->dataMD5sum, 16);
eh->methodFlags[0] |= MFLAG_DATA_MD5;
@@ -514,10 +498,8 @@ static void expand_image(ecc_closure *ec)
{ unsigned char dead_sector[2048];
int n;
#ifndef WITH_CLI_ONLY_YES
if(Closure->stopActions) /* User hit the Stop button */
abort_encoding(ec, TRUE);
#endif
CreateMissingSector(dead_sector, lay->firstEccPos+sectors, image->imageFP, FINGERPRINT_SECTOR,
"ECC padding by expand_image()");
@@ -530,11 +512,7 @@ static void expand_image(ecc_closure *ec)
if(last_percent != percent)
{ PrintProgress(_(progress_msg), percent);
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
SetProgress(ec->wl->encPBar1, percent, 100);
#endif
GuiSetProgress(ec->wl->encPBar1, percent, 100);
last_percent = percent;
}
@@ -543,10 +521,7 @@ static void expand_image(ecc_closure *ec)
PrintProgress(_(progress_msg), 100);
PrintProgress("\n");
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
SetProgress(ec->wl->encPBar1, 100, 100);
#endif
GuiSetProgress(ec->wl->encPBar1, 100, 100);
}
/*
@@ -629,12 +604,10 @@ static void read_next_chunk(ecc_closure *ec, guint64 chunk)
guint64 page_offset;
#endif
#ifndef WITH_CLI_ONLY_YES
if(Closure->stopActions) /* User hit the Stop button */
{ ec->abortImmediately = TRUE;
abort_encoding(ec, TRUE);
}
#endif
/* Read the next data sectors of this layer.
Note that the last layer is made from CRC sums. */
@@ -859,10 +832,7 @@ static gpointer io_thread(ecc_closure *ec)
verbose("NOTE: sectors per layer = %lld\n", (long long)lay->sectorsPerLayer);
for(chunk=0; chunk<lay->sectorsPerLayer; chunk+=ec->chunkSize)
{
#ifndef WITH_CLI_ONLY_YES
int cpu_bound = 0;
#endif
{ int cpu_bound = 0;
verbose("Starting IO processing for chunk %d\n", chunk);
@@ -917,9 +887,7 @@ static gpointer io_thread(ecc_closure *ec)
/* Wait until the encoders have finished */
g_mutex_lock(ec->lock);
#ifndef WITH_CLI_ONLY_YES
cpu_bound = ec->buffersToEncode;
#endif
while(ec->buffersToEncode)
{ verbose("%s", "IO: Waiting for encoders to finish\n");
g_cond_wait(ec->ioCond, ec->lock);
@@ -930,18 +898,14 @@ static gpointer io_thread(ecc_closure *ec)
verbose("IO: chunk %d finished\n", ec->ioChunk);
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
{ if(cpu_bound)
{ SetLabelText(GTK_LABEL(ec->wl->encBottleneck), _("CPU bound"));
ec->cpuBound++;
}
else
{ SetLabelText(GTK_LABEL(ec->wl->encBottleneck), _("I/O bound"));
ec->ioBound++;
}
if(cpu_bound)
{ GuiSetLabelText(ec->wl->encBottleneck, _("CPU bound"));
ec->cpuBound++;
}
else
{ GuiSetLabelText(ec->wl->encBottleneck, _("I/O bound"));
ec->ioBound++;
}
#endif
} /* chunk finished */
/* Broadcast read to the worker threads */
@@ -1137,7 +1101,7 @@ static gpointer encoder_thread(ecc_closure *ec)
{
ec->lastPercent = percent;
g_mutex_unlock(ec->lock);
#ifndef WITH_CLI_ONLY_YES
#ifdef WITH_GUI_YES
if(Closure->guiMode)
{ gdouble elapsed;
gulong ignore;
@@ -1145,16 +1109,16 @@ static gpointer encoder_thread(ecc_closure *ec)
elapsed=g_timer_elapsed(ec->contTimer, &ignore);
if(elapsed > 1.0)
{ gdouble mbs = ((double)ndata*(ec->progress-ec->lastProgress))/(512.0*elapsed);
SetLabelText(GTK_LABEL(ec->wl->encPerformance),
_("%5.2fMiB/s current"), mbs);
GuiSetLabelText(ec->wl->encPerformance,
_("%5.2fMiB/s current"), mbs);
ec->lastProgress = ec->progress;
g_timer_reset(ec->contTimer);
}
SetProgress(ec->wl->encPBar2, percent, 1000);
GuiSetProgress(ec->wl->encPBar2, percent, 1000);
}
else
#endif
PrintProgress(_("Ecc generation: %3d.%1d%%"), percent/10, percent%10);
#endif /* WITH_GUI_YES */
PrintProgress(_("Ecc generation: %3d.%1d%%"), percent/10, percent%10);
}
else g_mutex_unlock(ec->lock);
@@ -1178,34 +1142,32 @@ static void create_reed_solomon(ecc_closure *ec)
{ int nroots = ec->lay->nroots;
int ndata = ec->lay->ndata;
int i;
#ifndef WITH_CLI_ONLY_YES
#ifdef WITH_GUI_YES
char *alg="none";
char *iostrat="none";
#endif
/*** Show the second progress bar */
#ifndef WITH_CLI_ONLY_YES
#ifdef WITH_GUI_YES
if(Closure->guiMode)
{ ShowWidget(ec->wl->encPBar2);
ShowWidget(ec->wl->encLabel2);
ShowWidget(ec->wl->encLabel3);
ShowWidget(ec->wl->encLabel4);
ShowWidget(ec->wl->encLabel5);
ShowWidget(ec->wl->encThreads);
ShowWidget(ec->wl->encPerformance);
ShowWidget(ec->wl->encBottleneck);
{ GuiShowWidget(ec->wl->encPBar2);
GuiShowWidget(ec->wl->encLabel2);
GuiShowWidget(ec->wl->encLabel3);
GuiShowWidget(ec->wl->encLabel4);
GuiShowWidget(ec->wl->encLabel5);
GuiShowWidget(ec->wl->encThreads);
GuiShowWidget(ec->wl->encPerformance);
GuiShowWidget(ec->wl->encBottleneck);
DescribeRSEncoder(&alg, &iostrat);
SetLabelText(GTK_LABEL(ec->wl->encThreads),
_("%d threads with %s encoding and %s I/O"),
Closure->codecThreads, alg, iostrat);
SetLabelText(GTK_LABEL(ec->wl->encPerformance), "");
SetLabelText(GTK_LABEL(ec->wl->encBottleneck), "");
GuiSetLabelText(ec->wl->encThreads,
_("%d threads with %s encoding and %s I/O"),
Closure->codecThreads, alg, iostrat);
GuiSetLabelText(ec->wl->encPerformance, "");
GuiSetLabelText(ec->wl->encBottleneck, "");
}
#endif
#endif /* WITH_GUI_YES */
/*** Calculate buffer size for the parity calculation and image data caching.
The algorithm builds the parity file consecutively in chunks of
@@ -1289,9 +1251,7 @@ static void create_reed_solomon(ecc_closure *ec)
void RS03Create(void)
{ Method *method = FindMethod("RS03");
Image *image = NULL;
#ifndef WITH_CLI_ONLY_YES
RS03Widgets *wl = (RS03Widgets*)method->widgetList;
#endif
RS03Layout *lay;
ecc_closure *ec = g_malloc0(sizeof(ecc_closure));
gdouble elapsed,mbs;
@@ -1301,19 +1261,15 @@ void RS03Create(void)
/*** Register the cleanup procedure for GUI mode */
ec->self = method;
#ifndef WITH_CLI_ONLY_YES
ec->wl = wl;
#endif
ec->earlyTermination = TRUE;
RegisterCleanup(_("Error correction data creation aborted"), ecc_cleanup, ec);
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) /* Preliminary fill text for the head line */
SetLabelText(GTK_LABEL(wl->encHeadline),
_("<big>Augmenting the image with error correction data.</big>\n<i>%s</i>"),
_("- checking image -"));
#endif
/* Preliminary fill text for the head line */
GuiSetLabelText(wl->encHeadline,
_("<big>Augmenting the image with error correction data.</big>\n<i>%s</i>"),
_("- checking image -"));
/*** Open image file. */
@@ -1359,23 +1315,25 @@ void RS03Create(void)
/*** Announce what we are going to do */
ecc_sectors = lay->nroots*lay->sectorsPerLayer;
#ifndef WITH_CLI_ONLY_YES
#ifdef WITH_GUI_YES
if(Closure->guiMode) /* Preliminary fill text for the head line */
{ ec->msg = g_strdup_printf(_("Encoding with Method RS03: %" PRId64 " MiB data, %" PRId64 " MiB ecc (%d roots; %4.1f%% redundancy)."),
lay->dataSectors/512, ecc_sectors/512, lay->nroots, lay->redundancy);
if(lay->target == ECC_IMAGE)
SetLabelText(GTK_LABEL(wl->encHeadline),
_("<big>Augmenting the image with error correction data.</big>\n<i>%s</i>"),
ec->msg);
else
SetLabelText(GTK_LABEL(wl->encHeadline),
_("<big>Creating the error correction file.</big>\n<i>%s</i>"),
ec->msg);
if(lay->target == ECC_IMAGE)
{ GuiSetLabelText(wl->encHeadline,
_("<big>Augmenting the image with error correction data.</big>\n<i>%s</i>"),
ec->msg);
}
else
{ GuiSetLabelText(wl->encHeadline,
_("<big>Creating the error correction file.</big>\n<i>%s</i>"),
ec->msg);
}
}
else
#endif
#endif /* WITH_GUI_YES */
{ char *alg, *iostrat;
DescribeRSEncoder(&alg, &iostrat);
@@ -1405,7 +1363,7 @@ void RS03Create(void)
if(Closure->eccTarget == ECC_IMAGE && lay->redundancy < 20)
{ int answer;
answer = ModalWarningOrCLI(GTK_MESSAGE_WARNING, GTK_BUTTONS_OK_CANCEL, NULL,
answer = ModalWarning(GTK_MESSAGE_WARNING, GTK_BUTTONS_OK_CANCEL, NULL,
"%s", _("Using redundancies below 20% may not give\n"
"the expected data loss protection.\n"));
@@ -1421,7 +1379,7 @@ void RS03Create(void)
lay->mediumCapacity == BDXL_QL_SIZE_NODM)
{ int answer;
answer = ModalWarningOrCLI(GTK_MESSAGE_WARNING, GTK_BUTTONS_OK_CANCEL, NULL,
answer = ModalWarning(GTK_MESSAGE_WARNING, GTK_BUTTONS_OK_CANCEL, NULL,
"%s", _("BD-R size with no defect management enabled,\n"
"remember it should you need to repair this image later!\n"));
@@ -1458,33 +1416,27 @@ void RS03Create(void)
mbs = ((double)lay->ndata*lay->sectorsPerLayer)/(512.0*elapsed);
PrintLog(_("Avg performance: %5.2fs (%5.2fMiB/s) total\n"),
elapsed, mbs);
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
{ SetLabelText(GTK_LABEL(wl->encPerformance), _("%5.2fMiB/s average"), mbs);
SetLabelText(GTK_LABEL(ec->wl->encBottleneck),
GuiSetLabelText(wl->encPerformance, _("%5.2fMiB/s average"), mbs);
GuiSetLabelText(ec->wl->encBottleneck,
_("%d times CPU bound; %d times I/O bound"),
ec->cpuBound, ec->ioBound);
GuiSetProgress(wl->encPBar2, 100, 100);
if(Closure->eccTarget == ECC_IMAGE)
{ GuiSetLabelText(wl->encFootline,
_("Image has been augmented with error correction data.\n"
"New image size is %" PRId64 " MiB (%" PRId64 " sectors).\n"),
(lay->totalSectors)/512,
lay->totalSectors);
}
#endif
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
{ SetProgress(wl->encPBar2, 100, 100);
if(Closure->eccTarget == ECC_IMAGE)
SetLabelText(GTK_LABEL(wl->encFootline),
_("Image has been augmented with error correction data.\n"
"New image size is %" PRId64 " MiB (%" PRId64 " sectors).\n"),
(lay->totalSectors)/512,
lay->totalSectors);
else
SetLabelText(GTK_LABEL(wl->encFootline),
_("The error correction file has been successfully created.\n"
"Make sure to keep this file on a reliable medium."));
else
{ GuiSetLabelText(wl->encFootline,
_("The error correction file has been successfully created.\n"
"Make sure to keep this file on a reliable medium."));
}
#endif
/*** Clean up */
ec->earlyTermination = FALSE;

View File

@@ -20,6 +20,8 @@
* along with dvdisaster. If not, see <http://www.gnu.org/licenses/>.
*/
/*** src type: some GUI code ***/
#include "dvdisaster.h"
#include "rs03-includes.h"
@@ -30,10 +32,7 @@
***/
typedef struct
{
#ifndef WITH_CLI_ONLY_YES
RS03Widgets *wl;
#endif
{ RS03Widgets *wl;
RS03Layout *lay;
GaloisTables *gt;
ReedSolomonTables *rt;
@@ -49,16 +48,13 @@ static void fix_cleanup(gpointer data)
UnregisterCleanup();
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
{ if(fc->earlyTermination)
SwitchAndSetFootline(fc->wl->fixNotebook, 1,
if(fc->earlyTermination)
{ GuiSwitchAndSetFootline(fc->wl->fixNotebook, 1,
fc->wl->fixFootline,
_("<span %s>Aborted by unrecoverable error.</span>"),
Closure->redMarkup);
AllowActions(TRUE);
Closure->redMarkup);
}
#endif
GuiAllowActions(TRUE);
/** Clean up */
@@ -76,10 +72,7 @@ static void fix_cleanup(gpointer data)
g_free(fc);
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
g_thread_exit(0);
#endif
GuiExitWorkerThread();
}
/*
@@ -113,24 +106,14 @@ static void expand_image(Image *image, EccHeader *eh, gint64 new_size)
percent = (100*sectors) / new_sectors;
if(last_percent != percent)
{
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
;
else
#endif
PrintProgress(_("Expanding image: %3d%%"), percent);
{ if(!Closure->guiMode)
PrintProgress(_("Expanding image: %3d%%"), percent);
last_percent = percent;
}
}
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
;
else
#endif
{
PrintProgress(_("Expanding image: %3d%%"), 100);
if(!Closure->guiMode)
{ PrintProgress(_("Expanding image: %3d%%"), 100);
PrintProgress("\n");
}
}
@@ -140,11 +123,8 @@ static void expand_image(Image *image, EccHeader *eh, gint64 new_size)
***/
void RS03Fix(Image *image)
{
#ifndef WITH_CLI_ONLY_YES
Method *self = FindMethod("RS03");
{ Method *self = FindMethod("RS03");
RS03Widgets *wl = (RS03Widgets*)self->widgetList;
#endif
RS03Layout *lay;
fix_closure *fc = g_malloc0(sizeof(fix_closure));
EccHeader *eh;
@@ -175,16 +155,13 @@ void RS03Fix(Image *image)
gint64 damaged_eccsecs=0;
gint64 expected_sectors;
char *t=NULL;
#ifndef WITH_CLI_ONLY_YES
#ifdef WITH_GUI_YES
char *msg;
#endif
/*** Register the cleanup procedure for GUI mode */
fc->image = image;
#ifndef WITH_CLI_ONLY_YES
fc->wl = wl;
#endif
fc->earlyTermination = TRUE;
RegisterCleanup(_("Repairing of image aborted"), fix_cleanup, fc);
@@ -194,12 +171,9 @@ void RS03Fix(Image *image)
/*** Open the image file */
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
SetLabelText(GTK_LABEL(wl->fixHeadline),
_("<big>Repairing the image.</big>\n<i>%s</i>"),
_("Opening files..."));
#endif
GuiSetLabelText(wl->fixHeadline,
_("<big>Repairing the image.</big>\n<i>%s</i>"),
_("Opening files..."));
/* Calculate the layout and optinally open thee ecc file */
@@ -237,7 +211,7 @@ void RS03Fix(Image *image)
/*** Announce what we are going to do */
#ifndef WITH_CLI_ONLY_YES
#ifdef WITH_GUI_YES
if(Closure->guiMode)
{ if(eh->methodFlags[0] & MFLAG_ECC_FILE)
msg = g_strdup_printf(_("Error correction file using Method RS03, %d roots, %4.1f%% redundancy."),
@@ -248,13 +222,13 @@ void RS03Fix(Image *image)
eh->eccBytes,
((double)eh->eccBytes*100.0)/(double)eh->dataBytes);
SetLabelText(GTK_LABEL(wl->fixHeadline),
_("<big>Repairing the image.</big>\n<i>%s</i>"), msg);
GuiSetLabelText(wl->fixHeadline,
_("<big>Repairing the image.</big>\n<i>%s</i>"), msg);
RS03SetFixMaxValues(wl, eh->dataBytes, eh->eccBytes, expected_sectors);
g_free(msg);
}
#endif
#endif /* WITH_GUI_YES */
PrintLog(_("\nFix mode(%s): Repairable sectors will be fixed in the image.\n"),
eh->methodFlags[0] & MFLAG_ECC_FILE ? "RS03f" : "RS03i");
@@ -264,30 +238,26 @@ void RS03Fix(Image *image)
{ int difference = image->inLast - eh->inLast;
guint64 expected_image_size = 2048*(expected_sectors-1)+eh->inLast;
#ifndef WITH_CLI_ONLY_YES
#ifdef WITH_GUI_YES
if(Closure->guiMode)
{ int answer = ModalDialog(GTK_MESSAGE_QUESTION, GTK_BUTTONS_OK_CANCEL, NULL,
_("The image file is %d bytes longer than noted\n"
"in the ecc file. Shall the superfluous bytes\n"
"be removed from the image file?\n"),
difference);
{ int answer = GuiModalDialog(GTK_MESSAGE_QUESTION, GTK_BUTTONS_OK_CANCEL, NULL,
_("The image file is %d bytes longer than noted\n"
"in the ecc file. Shall the superfluous bytes\n"
"be removed from the image file?\n"),
difference);
if(!answer)
{ SwitchAndSetFootline(fc->wl->fixNotebook, 1,
fc->wl->fixFootline,
_("<span %s>Aborted by user request!</span>"),
Closure->redMarkup);
{ GuiSwitchAndSetFootline(fc->wl->fixNotebook, 1,
fc->wl->fixFootline,
_("<span %s>Aborted by user request!</span>"),
Closure->redMarkup);
fc->earlyTermination = FALSE; /* suppress respective error message */
goto terminate;
}
}
#endif
#ifndef WITH_CLI_ONLY_YES
#endif /* WITH_GUI_YES */
if(!Closure->guiMode && !Closure->truncate)
#else
if(!Closure->truncate)
#endif
Stop(_("The image file is %d bytes longer than noted\n"
"in the ecc file.\n"
"Add the --truncate option to the program call\n"
@@ -313,20 +283,17 @@ void RS03Fix(Image *image)
if(diff>0 && diff<=2)
{ int answer;
answer = ModalWarningOrCLI(GTK_MESSAGE_QUESTION, GTK_BUTTONS_OK_CANCEL, NULL,
answer = ModalWarning(GTK_MESSAGE_QUESTION, GTK_BUTTONS_OK_CANCEL, NULL,
_("Image file is %" PRId64 " sectors longer than expected.\n"
"Assuming this is a TAO mode medium.\n"
"%" PRId64 " sectors will be removed from the image end.\n"),
diff, diff);
if(!answer)
{
#ifndef WITH_CLI_ONLY_YES
SwitchAndSetFootline(fc->wl->fixNotebook, 1,
fc->wl->fixFootline,
_("<span %s>Aborted by user request!</span>"),
Closure->redMarkup);
#endif
{ GuiSwitchAndSetFootline(fc->wl->fixNotebook, 1,
fc->wl->fixFootline,
_("<span %s>Aborted by user request!</span>"),
Closure->redMarkup);
fc->earlyTermination = FALSE; /* suppress respective error message */
goto terminate;
}
@@ -336,19 +303,19 @@ void RS03Fix(Image *image)
if(!LargeTruncate(image->file, (gint64)expected_image_size))
Stop(_("Could not truncate %s: %s\n"),Closure->imageName,strerror(errno));
}
#ifndef WITH_CLI_ONLY_YES
#ifdef WITH_GUI_YES
if(diff>2 && Closure->guiMode)
{ int answer = ModalDialog(GTK_MESSAGE_QUESTION, GTK_BUTTONS_OK_CANCEL, NULL,
trans,
diff,
_("Is it okay to remove the superfluous sectors?"));
{ int answer = GuiModalDialog(GTK_MESSAGE_QUESTION, GTK_BUTTONS_OK_CANCEL, NULL,
trans,
diff,
_("Is it okay to remove the superfluous sectors?"));
if(!answer)
{ SwitchAndSetFootline(fc->wl->fixNotebook, 1,
fc->wl->fixFootline,
_("<span %s>Aborted by user request!</span>"),
Closure->redMarkup);
{ GuiSwitchAndSetFootline(fc->wl->fixNotebook, 1,
fc->wl->fixFootline,
_("<span %s>Aborted by user request!</span>"),
Closure->redMarkup);
fc->earlyTermination = FALSE; /* suppress respective error message */
goto terminate;
}
@@ -360,13 +327,9 @@ void RS03Fix(Image *image)
PrintLog(_("Image has been truncated by %" PRId64 " sectors.\n"), diff);
}
#endif
#ifndef WITH_CLI_ONLY_YES
#endif /* WITH_GUI_YES */
if(diff>2 && !Closure->guiMode)
#else
if(diff>2)
#endif
{ if(!Closure->truncate)
Stop(trans,
diff,
@@ -421,17 +384,16 @@ void RS03Fix(Image *image)
/* See if user hit the Stop button */
#ifndef WITH_CLI_ONLY_YES
if(Closure->stopActions)
{ if(Closure->stopActions == STOP_CURRENT_ACTION) /* suppress memleak warning when closing window */
SwitchAndSetFootline(fc->wl->fixNotebook, 1,
fc->wl->fixFootline,
_("<span %s>Aborted by user request!</span>"),
Closure->redMarkup);
{ GuiSwitchAndSetFootline(fc->wl->fixNotebook, 1,
fc->wl->fixFootline,
_("<span %s>Aborted by user request!</span>"),
Closure->redMarkup);
}
fc->earlyTermination = FALSE; /* suppress respective error message */
goto terminate;
}
#endif
/* Fill cache with the next batch of cache_size ecc blocks. */
@@ -550,10 +512,7 @@ void RS03Fix(Image *image)
/* Trivially reject uncorrectable ecc block */
if(erasure_count>lay->nroots) /* uncorrectable */
{
#ifndef WITH_CLI_ONLY_YES
if(!Closure->guiMode)
#endif
{ if(!Closure->guiMode)
{ int sep_printed = 0;
PrintCLI(_("* Ecc block %" PRId64 ": %3d unrepairable sectors: "), s, erasure_count);
@@ -876,10 +835,10 @@ void RS03Fix(Image *image)
if we were processing an augmented image. */
if(lay->target == ECC_FILE && i >= ndata-1)
{
if(!LargeSeek(image->eccFile, (gint64)(2048*sec)))
Stop(_("Failed seeking to sector %" PRId64 " in ecc file [%s]: %s"),
sec, "FW", strerror(errno));
{
if(!LargeSeek(image->eccFile, (gint64)(2048*sec)))
Stop(_("Failed seeking to sector %" PRId64 " in ecc file [%s]: %s"),
sec, "FW", strerror(errno));
n = LargeWrite(image->eccFile, cache_offset+fc->imgBlock[i], 2048);
if(n != 2048)
@@ -913,7 +872,7 @@ skip:
if(last_percent != percent)
{
#ifndef WITH_CLI_ONLY_YES
#ifdef WITH_GUI_YES
if(Closure->guiMode)
{
RS03AddFixValues(wl, percent, local_plot_max);
@@ -924,7 +883,7 @@ skip:
}
else
#endif
PrintProgress(_("Ecc progress: %3d.%1d%%"),percent/10,percent%10);
PrintProgress(_("Ecc progress: %3d.%1d%%"),percent/10,percent%10);
last_percent = percent;
}
@@ -938,17 +897,16 @@ skip:
PrintProgress(_("Ecc progress: 100.0%%\n"));
if(corrected > 0) PrintLog(_("Repaired sectors: %" PRId64 " (%" PRId64 " data, %" PRId64 " ecc)\n"),
corrected, data_corr, ecc_corr);
if(corrected > 0)
{ PrintLog(_("Repaired sectors: %" PRId64 " (%" PRId64 " data, %" PRId64 " ecc)\n"),
corrected, data_corr, ecc_corr);
}
if(uncorrected > 0)
{ PrintLog(_("Unrepaired sectors: %" PRId64 "\n"), uncorrected);
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
SwitchAndSetFootline(wl->fixNotebook, 1, wl->fixFootline,
_("Image sectors could not be fully restored "
"(%" PRId64 " repaired; <span %s>%" PRId64 " unrepaired</span>)"),
corrected, Closure->redMarkup, uncorrected);
#endif
GuiSwitchAndSetFootline(wl->fixNotebook, 1, wl->fixFootline,
_("Image sectors could not be fully restored "
"(%" PRId64 " repaired; <span %s>%" PRId64 " unrepaired</span>)"),
corrected, Closure->redMarkup, uncorrected);
exitCode = 2;
}
else
@@ -967,12 +925,11 @@ skip:
PrintLog(_("Erasure counts per ecc block: avg = %.1f; worst = %d.\n"),
(double)damaged_sectors/(double)damaged_eccsecs,worst_ecc);
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode && t)
SwitchAndSetFootline(wl->fixNotebook, 1, wl->fixFootline,
"%s %s", _("Repair results:"), t);
#endif
if(t)
{ GuiSwitchAndSetFootline(wl->fixNotebook, 1, wl->fixFootline,
"%s %s", _("Repair results:"), t);
}
Verbose("\nSummary of processed sectors:\n");
Verbose("%" PRId64 " damaged sectors\n", damaged_sectors);
Verbose("%" PRId64 " CRC errors\n", crc_errors);

View File

@@ -23,7 +23,6 @@
#ifndef RS03INCLUDES_H
#define RS03INCLUDES_H
#ifndef WITH_CLI_ONLY_YES
/* Data structs from rs03-window.c */
typedef struct
@@ -118,7 +117,6 @@ typedef struct
int dataBytes;
int percent, lastPercent;
} RS03Widgets;
#endif
/*
* local working closure for internal checksums
@@ -133,7 +131,6 @@ typedef struct
* These are exported via the Method struct
*/
#ifndef WITH_CLI_ONLY_YES
void CreateRS03EncWindow(Method*, GtkWidget*);
void CreateRS03FixWindow(Method*, GtkWidget*);
void CreateRS03PrefsPage(Method*, GtkWidget*);
@@ -144,7 +141,6 @@ void ReadRS03Preferences(Method*);
void ResetRS03VerifyWindow(Method*);
void CreateRS03VerifyWindow(Method*, GtkWidget*);
#endif
/*
* These are exported (resp. only used) in ecc-rs03.c and rs03*.c
@@ -200,13 +196,11 @@ void RS03Fix(Image*);
int RS03RecognizeFile(LargeFile*, EccHeader**);
int RS03RecognizeImage(Image*);
#ifndef WITH_CLI_ONLY_YES
/* rs03-window.c */
void RS03AddFixValues(RS03Widgets*, int, int);
void RS03SetFixMaxValues(RS03Widgets*, int, int, gint64);
void RS03UpdateFixResults(RS03Widgets*, gint64, gint64);
#endif
/* rs03-verify.c */
@@ -217,9 +211,7 @@ void RS03Verify(Image*);
/* temporary single threaded versions */
void RS03SCreate(void);
#ifndef WITH_CLI_ONLY_YES
void CreateRS03SEncWindow(Method*, GtkWidget*);
void ResetRS03SEncWindow(Method*);
#endif
#endif

View File

@@ -19,8 +19,10 @@
* You should have received a copy of the GNU General Public License
* along with dvdisaster. If not, see <http://www.gnu.org/licenses/>.
*/
// DVDISASTER_GUI_FILE
/*** src type: only GUI code ***/
#ifdef WITH_GUI_YES
#include "dvdisaster.h"
#include "rs03-includes.h"
@@ -201,7 +203,7 @@ static void nroots_cb(GtkWidget *widget, gpointer data)
set_range_value(GTK_RANGE(wl->redundancyScaleB), value);
else set_range_value(GTK_RANGE(wl->redundancyScaleA), value);
UpdateMethodPreferences();
GuiUpdateMethodPreferences();
}
static void ecc_size_cb(GtkWidget *widget, gpointer data)
@@ -216,7 +218,7 @@ static void ecc_size_cb(GtkWidget *widget, gpointer data)
gtk_spin_button_set_value(GTK_SPIN_BUTTON(wl->redundancySpinB), atoi(Closure->redundancy));
else gtk_spin_button_set_value(GTK_SPIN_BUTTON(wl->redundancySpinA), atoi(Closure->redundancy));
UpdateMethodPreferences();
GuiUpdateMethodPreferences();
}
static void toggle_cb(GtkWidget *widget, gpointer data)
@@ -295,7 +297,7 @@ static void toggle_cb(GtkWidget *widget, gpointer data)
Closure->redundancy = g_strdup_printf("%dm", space);
}
UpdateMethodPreferences();
GuiUpdateMethodPreferences();
}
}
@@ -346,8 +348,8 @@ static void prefetch_cb(GtkWidget *widget, gpointer data)
utf = g_locale_to_utf8(text, -1, NULL, NULL, NULL);
gtk_label_set_markup(GTK_LABEL(lwoh->normalLabel), utf);
gtk_label_set_markup(GTK_LABEL(lwoh->linkLabel), utf);
SetOnlineHelpLinkText(lwoh, text);
UpdateMethodPreferences();
GuiSetOnlineHelpLinkText(lwoh, text);
GuiUpdateMethodPreferences();
g_free(text);
g_free(utf);
}
@@ -365,8 +367,8 @@ static void threads_cb(GtkWidget *widget, gpointer data)
utf = g_locale_to_utf8(text, -1, NULL, NULL, NULL);
gtk_label_set_markup(GTK_LABEL(lwoh->normalLabel), utf);
gtk_label_set_markup(GTK_LABEL(lwoh->linkLabel), utf);
SetOnlineHelpLinkText(lwoh, text);
UpdateMethodPreferences();
GuiSetOnlineHelpLinkText(lwoh, text);
GuiUpdateMethodPreferences();
g_free(text);
g_free(utf);
}
@@ -491,9 +493,9 @@ void CreateRS03PrefsPage(Method *method, GtkWidget *parent)
gtk_container_set_border_width(GTK_CONTAINER(vbox), 10);
gtk_container_add(GTK_CONTAINER(frame), vbox);
lwoh = CreateLabelWithOnlineHelp(_("Error correction data storage"),
_("Store ECC data in: "));
RegisterPreferencesHelpWindow(lwoh);
lwoh = GuiCreateLabelWithOnlineHelp(_("Error correction data storage"),
_("Store ECC data in: "));
GuiRegisterPreferencesHelpWindow(lwoh);
for(i=0; i<2; i++)
{ GtkWidget *hbox = gtk_hbox_new(FALSE, 4);
@@ -527,31 +529,31 @@ void CreateRS03PrefsPage(Method *method, GtkWidget *parent)
else
{ wl->eccFileB = radio1;
wl->eccImageB = radio2;
AddHelpWidget(lwoh, hbox);
GuiAddHelpWidget(lwoh, hbox);
}
}
AddHelpParagraph(lwoh,
_("<b>Error correction data storage</b>\n\n"
"Select between two ways of storing the "
"error correction information:\n"));
GuiAddHelpParagraph(lwoh,
_("<b>Error correction data storage</b>\n\n"
"Select between two ways of storing the "
"error correction information:\n"));
AddHelpListItem(lwoh, _("Augmented image (recommended)\n"
"The error correction data will be stored along with the user data on the "
"same medium. This requires the creation of an image file prior to writing the "
"medium. The error correction data will be appended to that image "
"and fill up the remaining space.\n"
"Damaged sectors in the error correction "
"information reduce the data recovery capacity, but do not make recovery "
"impossible - a second medium for keeping or protecting the error correction "
"information is not required.\n"));
GuiAddHelpListItem(lwoh, _("Augmented image (recommended)\n"
"The error correction data will be stored along with the user data on the "
"same medium. This requires the creation of an image file prior to writing the "
"medium. The error correction data will be appended to that image "
"and fill up the remaining space.\n"
"Damaged sectors in the error correction "
"information reduce the data recovery capacity, but do not make recovery "
"impossible - a second medium for keeping or protecting the error correction "
"information is not required.\n"));
AddHelpListItem(lwoh, _("Error correction file\n"
"Error correction files are the only way of protecting existing media "
"as they can be stored somewhere else. They are kept on a separate "
"medium which must also be protected by dvdisaster. This prevents from losing the "
"error correction files in case of a medium defect.\n"));
GuiAddHelpListItem(lwoh, _("Error correction file\n"
"Error correction files are the only way of protecting existing media "
"as they can be stored somewhere else. They are kept on a separate "
"medium which must also be protected by dvdisaster. This prevents from losing the "
"error correction files in case of a medium defect.\n"));
/*** Redundancy selection */
@@ -582,8 +584,8 @@ void CreateRS03PrefsPage(Method *method, GtkWidget *parent)
/* Normal redundancy */
lwoh = CreateLabelWithOnlineHelp(_("Normal redundancy"), _("Normal"));
RegisterPreferencesHelpWindow(lwoh);
lwoh = GuiCreateLabelWithOnlineHelp(_("Normal redundancy"), _("Normal"));
GuiRegisterPreferencesHelpWindow(lwoh);
for(i=0; i<2; i++)
{ GtkWidget *hbox = gtk_hbox_new(FALSE, 4);
@@ -602,19 +604,19 @@ void CreateRS03PrefsPage(Method *method, GtkWidget *parent)
{ wl->radio1B = radio;
gtk_box_pack_start(GTK_BOX(hbox), lwoh->normalLabel, FALSE, FALSE, 0);
if (!i) gtk_box_pack_start(GTK_BOX(hbox), lwoh->tooltip, FALSE, FALSE, 0);
AddHelpWidget(lwoh, hbox);
GuiAddHelpWidget(lwoh, hbox);
}
}
AddHelpParagraph(lwoh, _("<b>Normal redundancy</b>\n\n"
"The preset \"normal\" creates a redundancy of 14.3%%.\n"
"It invokes optimized program code to speed up the "
"error correction file creation."));
GuiAddHelpParagraph(lwoh, _("<b>Normal redundancy</b>\n\n"
"The preset \"normal\" creates a redundancy of 14.3%%.\n"
"It invokes optimized program code to speed up the "
"error correction file creation."));
/* High redundancy */
lwoh = CreateLabelWithOnlineHelp(_("High redundancy"), _("High"));
RegisterPreferencesHelpWindow(lwoh);
lwoh = GuiCreateLabelWithOnlineHelp(_("High redundancy"), _("High"));
GuiRegisterPreferencesHelpWindow(lwoh);
for(i=0; i<2; i++)
{ GtkWidget *hbox = gtk_hbox_new(FALSE, 4);
@@ -632,20 +634,19 @@ void CreateRS03PrefsPage(Method *method, GtkWidget *parent)
else
{ wl->radio2B = radio;
gtk_box_pack_start(GTK_BOX(hbox), lwoh->normalLabel, FALSE, FALSE, 0);
AddHelpWidget(lwoh, hbox);
GuiAddHelpWidget(lwoh, hbox);
}
}
AddHelpParagraph(lwoh, _("<b>High redundancy</b>\n\n"
"The preset \"high\" creates a redundancy of 33.5%%.\n"
"It invokes optimized program code to speed up the "
"error correction file creation."));
GuiAddHelpParagraph(lwoh, _("<b>High redundancy</b>\n\n"
"The preset \"high\" creates a redundancy of 33.5%%.\n"
"It invokes optimized program code to speed up the "
"error correction file creation."));
/* User-selected redundancy */
lwoh = CreateLabelWithOnlineHelp(_("Other redundancy"), _("Other"));
RegisterPreferencesHelpWindow(lwoh);
lwoh = GuiCreateLabelWithOnlineHelp(_("Other redundancy"), _("Other"));
GuiRegisterPreferencesHelpWindow(lwoh);
for(i=0; i<2; i++)
{ hbox = gtk_hbox_new(FALSE, 4);
@@ -679,20 +680,21 @@ void CreateRS03PrefsPage(Method *method, GtkWidget *parent)
}
else
{ wl->redundancyScaleB = scale;
AddHelpWidget(lwoh, hbox);
GuiAddHelpWidget(lwoh, hbox);
}
}
AddHelpParagraph(lwoh, _("<b>Other redundancy</b>\n\n"
"Specifies the redundancy by percent.\n"
"An error correction file with x%% redundancy "
"will be approximately x%% of the size of the "
"corresponding image file."));
GuiAddHelpParagraph(lwoh, _("<b>Other redundancy</b>\n\n"
"Specifies the redundancy by percent.\n"
"An error correction file with x%% redundancy "
"will be approximately x%% of the size of the "
"corresponding image file."));
/* Space-delimited redundancy */
lwoh = CreateLabelWithOnlineHelp(_("Space-delimited redundancy"), _("Use at most"));
RegisterPreferencesHelpWindow(lwoh);
lwoh = GuiCreateLabelWithOnlineHelp(_("Space-delimited redundancy"),
_("Use at most"));
GuiRegisterPreferencesHelpWindow(lwoh);
for(i=0; i<2; i++)
{ hbox = gtk_hbox_new(FALSE, 4);
@@ -729,18 +731,18 @@ void CreateRS03PrefsPage(Method *method, GtkWidget *parent)
else
{ wl->redundancySpinB = spin;
wl->radio4LabelB = lab;
AddHelpWidget(lwoh, hbox);
GuiAddHelpWidget(lwoh, hbox);
}
}
AddHelpParagraph(lwoh, _("<b>Space-delimited redundancy</b>\n\n"
"Specifies the maximum size of the error correction file in MiB. "
"dvdisaster will choose a suitable redundancy setting so that "
"the overall size of the error correction file does not exceed "
"the given limit.\n\n"
"<b>Advance notice:</b> When using the same size setting for "
"images of vastly different size, smaller images receive more "
"redundancy than larger ones. This is usually not what you want."));
GuiAddHelpParagraph(lwoh, _("<b>Space-delimited redundancy</b>\n\n"
"Specifies the maximum size of the error correction file in MiB. "
"dvdisaster will choose a suitable redundancy setting so that "
"the overall size of the error correction file does not exceed "
"the given limit.\n\n"
"<b>Advance notice:</b> When using the same size setting for "
"images of vastly different size, smaller images receive more "
"redundancy than larger ones. This is usually not what you want."));
/* Preset redundancy values
FIXME: replace by ResetRS03Prefs()? */
@@ -786,13 +788,13 @@ void CreateRS03PrefsPage(Method *method, GtkWidget *parent)
gtk_container_add(GTK_CONTAINER(frame), vbox);
text = g_strdup_printf(_("%d sectors"), Closure->prefetchSectors);
lwoh = CreateLabelWithOnlineHelp(_("Sector preloading"), text);
RegisterPreferencesHelpWindow(lwoh);
lwoh = GuiCreateLabelWithOnlineHelp(_("Sector preloading"), text);
GuiRegisterPreferencesHelpWindow(lwoh);
g_free(text);
wl->prefetchLwoh = lwoh;
LockLabelSize(GTK_LABEL(lwoh->normalLabel), _utf("%d sectors"), 2222);
LockLabelSize(GTK_LABEL(lwoh->linkLabel), _utf("%d sectors"), 2222);
GuiLockLabelSize(lwoh->normalLabel, _utf("%d sectors"), 2222);
GuiLockLabelSize(lwoh->linkLabel, _utf("%d sectors"), 2222);
for(i=0; i<2; i++)
{ GtkWidget *hbox = gtk_hbox_new(FALSE, 4);
@@ -822,25 +824,25 @@ void CreateRS03PrefsPage(Method *method, GtkWidget *parent)
else
{ wl->prefetchScaleB = scale;
gtk_box_pack_start(GTK_BOX(hbox), lwoh->normalLabel, FALSE, FALSE, 0);
AddHelpWidget(lwoh, hbox);
GuiAddHelpWidget(lwoh, hbox);
}
}
AddHelpParagraph(lwoh, _("<b>Sector preloading</b>\n\n"
"dvdisaster optimizes access to the image and error correction "
"data by preloading and caching parts of them.\n\n"
"The optimal preload value depends on the storage system "
"used for the image and error correction files.\n"
"Use small preload values for systems with low latency "
"and seek time, e.g. SSDs. For magnetic hard disks "
"performance may be better using larger preload values.\n\n"
"A preload value of n will used approx. n MiB of RAM."));
GuiAddHelpParagraph(lwoh, _("<b>Sector preloading</b>\n\n"
"dvdisaster optimizes access to the image and error correction "
"data by preloading and caching parts of them.\n\n"
"The optimal preload value depends on the storage system "
"used for the image and error correction files.\n"
"Use small preload values for systems with low latency "
"and seek time, e.g. SSDs. For magnetic hard disks "
"performance may be better using larger preload values.\n\n"
"A preload value of n will used approx. n MiB of RAM."));
/*** IO strategy */
lwoh = CreateLabelWithOnlineHelp(_("I/O strategy"),
_("I/O strategy: "));
RegisterPreferencesHelpWindow(lwoh);
lwoh = GuiCreateLabelWithOnlineHelp(_("I/O strategy"),
_("I/O strategy: "));
GuiRegisterPreferencesHelpWindow(lwoh);
for(i=0; i<2; i++)
{ GtkWidget *hbox = gtk_hbox_new(FALSE, 4);
@@ -874,11 +876,11 @@ void CreateRS03PrefsPage(Method *method, GtkWidget *parent)
else
{ wl->ioRadio1B = radio1;
wl->ioRadio2B = radio2;
AddHelpWidget(lwoh, hbox);
GuiAddHelpWidget(lwoh, hbox);
}
}
AddHelpParagraph(lwoh, _("<b>I/O strategy</b>\n\n"
GuiAddHelpParagraph(lwoh, _("<b>I/O strategy</b>\n\n"
"This option controls how dvdisaster performs its disk I/O while creating error "
"correction data. Try both options and see which performs best on your hardware "
"setting.\n\n"
@@ -902,13 +904,13 @@ void CreateRS03PrefsPage(Method *method, GtkWidget *parent)
gtk_box_pack_start(GTK_BOX(parent), frame, FALSE, FALSE, 0);
text = g_strdup_printf(_("%d threads"), Closure->codecThreads);
lwoh = CreateLabelWithOnlineHelp(_("Multithreading"), text);
RegisterPreferencesHelpWindow(lwoh);
lwoh = GuiCreateLabelWithOnlineHelp(_("Multithreading"), text);
GuiRegisterPreferencesHelpWindow(lwoh);
g_free(text);
wl->threadsLwoh = lwoh;
LockLabelSize(GTK_LABEL(lwoh->normalLabel), _utf("%d threads"), 22);
LockLabelSize(GTK_LABEL(lwoh->linkLabel), _utf("%d threads"), 22);
GuiLockLabelSize(lwoh->normalLabel, _utf("%d threads"), 22);
GuiLockLabelSize(lwoh->linkLabel, _utf("%d threads"), 22);
for(i=0; i<2; i++)
{ GtkWidget *hbox = gtk_hbox_new(FALSE, 4);
@@ -939,22 +941,22 @@ void CreateRS03PrefsPage(Method *method, GtkWidget *parent)
else
{ wl->threadsScaleB = scale;
gtk_box_pack_start(GTK_BOX(hbox), lwoh->normalLabel, FALSE, FALSE, 0);
AddHelpWidget(lwoh, hbox);
GuiAddHelpWidget(lwoh, hbox);
}
}
AddHelpParagraph(lwoh, _("<b>Multithreading</b>\n\n"
"RS03 can use multiple threads (and therefore CPU cores)"
"for encoding.\n"
"For systems with 4 cores or less, set the number of "
"threads to the number of cores. If you have more cores, "
"leave one unused for doing I/O and graphics updates.\n"
"E.g. use 7 threads on an 8 core system.\n\n"
"Performance will not scale linearly "
"with the number of CPU cores. Hard disk performance "
"is more limiting than raw CPU power. When using "
"4 cores or more, memory bandwidth may also affect "
"performance."));
GuiAddHelpParagraph(lwoh, _("<b>Multithreading</b>\n\n"
"RS03 can use multiple threads (and therefore CPU cores)"
"for encoding.\n"
"For systems with 4 cores or less, set the number of "
"threads to the number of cores. If you have more cores, "
"leave one unused for doing I/O and graphics updates.\n"
"E.g. use 7 threads on an 8 core system.\n\n"
"Performance will not scale linearly "
"with the number of CPU cores. Hard disk performance "
"is more limiting than raw CPU power. When using "
"4 cores or more, memory bandwidth may also affect "
"performance."));
/*** Codec type */
@@ -965,9 +967,9 @@ void CreateRS03PrefsPage(Method *method, GtkWidget *parent)
gtk_container_set_border_width(GTK_CONTAINER(vbox), 10);
gtk_container_add(GTK_CONTAINER(frame), vbox);
lwoh = CreateLabelWithOnlineHelp(_("Encoding algorithm"),
_("Use: "));
RegisterPreferencesHelpWindow(lwoh);
lwoh = GuiCreateLabelWithOnlineHelp(_("Encoding algorithm"),
_("Use: "));
GuiRegisterPreferencesHelpWindow(lwoh);
for(i=0; i<2; i++)
{ GtkWidget *hbox = gtk_hbox_new(FALSE, 4);
@@ -1029,11 +1031,11 @@ void CreateRS03PrefsPage(Method *method, GtkWidget *parent)
wl->eaRadio2B = radio2;
wl->eaRadio3B = radio3;
wl->eaRadio4B = radio4;
AddHelpWidget(lwoh, hbox);
GuiAddHelpWidget(lwoh, hbox);
}
}
AddHelpParagraph(lwoh, _("<b>Encoding algorithm</b>\n\n"
GuiAddHelpParagraph(lwoh, _("<b>Encoding algorithm</b>\n\n"
"This option affects the speed of generating RS03 error correction data.\n"
"dvdisaster can either use a generic encoding algorithm using 32bit or 64bit "
"wide operations running on the integer unit of the processor, or use "
@@ -1045,3 +1047,4 @@ void CreateRS03PrefsPage(Method *method, GtkWidget *parent)
"otherwise the 64bit algorithm will be used."
));
}
#endif /* WITH_GUI_YES */

View File

@@ -20,6 +20,8 @@
* along with dvdisaster. If not, see <http://www.gnu.org/licenses/>.
*/
/*** src type: no GUI code ***/
#include "dvdisaster.h"
#include "udf.h"

File diff suppressed because it is too large Load Diff

View File

@@ -19,8 +19,10 @@
* You should have received a copy of the GNU General Public License
* along with dvdisaster. If not, see <http://www.gnu.org/licenses/>.
*/
// DVDISASTER_GUI_FILE
/*** src type: only GUI code ***/
#ifdef WITH_GUI_YES
#include "dvdisaster.h"
#include "rs03-includes.h"
@@ -39,8 +41,8 @@ static void update_geometry(RS03Widgets*);
void ResetRS03EncWindow(Method *method)
{ RS03Widgets *wl = (RS03Widgets*)method->widgetList;
SetProgress(wl->encPBar1, 0, 100);
SetProgress(wl->encPBar2, 0, 100);
GuiSetProgress(wl->encPBar1, 0, 100);
GuiSetProgress(wl->encPBar2, 0, 100);
gtk_widget_hide(wl->encLabel2);
gtk_widget_hide(wl->encPBar2);
@@ -58,13 +60,7 @@ void ResetRS03EncWindow(Method *method)
void CreateRS03EncWindow(Method *method, GtkWidget *parent)
{ GtkWidget *wid,*table,*pbar,*sep;
RS03Widgets *wl;
if(!method->widgetList)
{ wl = g_malloc0(sizeof(RS03Widgets));
method->widgetList = wl;
}
else wl = method->widgetList;
RS03Widgets *wl=method->widgetList;
wl->encHeadline = gtk_label_new(NULL);
gtk_misc_set_alignment(GTK_MISC(wl->encHeadline), 0.0, 0.0);
@@ -171,9 +167,9 @@ void RS03SetFixMaxValues(RS03Widgets *wl, int data_bytes, int ecc_bytes, gint64
static gboolean results_idle_func(gpointer data)
{ RS03Widgets *wl = (RS03Widgets*)data;
SetLabelText(GTK_LABEL(wl->fixCorrected), _("Repaired: %" PRId64 ""), wl->corrected);
SetLabelText(GTK_LABEL(wl->fixUncorrected), _("Unrepairable: <span %s>%" PRId64 "</span>"),Closure->redMarkup, wl->uncorrected);
SetLabelText(GTK_LABEL(wl->fixProgress), _("Progress: %3d.%1d%%"), wl->percent/10, wl->percent%10);
GuiSetLabelText(wl->fixCorrected, _("Repaired: %" PRId64 ""), wl->corrected);
GuiSetLabelText(wl->fixUncorrected, _("Unrepairable: <span %s>%" PRId64 "</span>"),Closure->redMarkup, wl->uncorrected);
GuiSetLabelText(wl->fixProgress, _("Progress: %3d.%1d%%"), wl->percent/10, wl->percent%10);
return FALSE;
}
@@ -192,9 +188,9 @@ void RS03UpdateFixResults(RS03Widgets *wl, gint64 corrected, gint64 uncorrected)
static gboolean curve_idle_func(gpointer data)
{ RS03Widgets *wl = (RS03Widgets*)data;
gint x0 = CurveX(wl->fixCurve, (double)wl->lastPercent);
gint x1 = CurveX(wl->fixCurve, (double)wl->percent);
gint y = CurveY(wl->fixCurve, wl->fixCurve->ivalue[wl->percent]);
gint x0 = GuiCurveX(wl->fixCurve, (double)wl->lastPercent);
gint x1 = GuiCurveX(wl->fixCurve, (double)wl->percent);
gint y = GuiCurveY(wl->fixCurve, wl->fixCurve->ivalue[wl->percent]);
gint i;
/*** Mark unused ecc values */
@@ -228,7 +224,7 @@ static gboolean curve_idle_func(gpointer data)
/* Redraw the ecc capacity threshold line */
y = CurveY(wl->fixCurve, wl->eccBytes);
y = GuiCurveY(wl->fixCurve, wl->eccBytes);
gdk_gc_set_rgb_fg_color(Closure->drawGC, Closure->greenSector);
gdk_draw_line(wl->fixCurve->widget->window,
Closure->drawGC,
@@ -260,7 +256,7 @@ static void update_geometry(RS03Widgets *wl)
{
/* Curve geometry */
UpdateCurveGeometry(wl->fixCurve, "999", 20);
GuiUpdateCurveGeometry(wl->fixCurve, "999", 20);
/* Label positions in the foot line */
@@ -275,12 +271,12 @@ static void redraw_curve(RS03Widgets *wl)
/* Redraw the curve */
RedrawAxes(wl->fixCurve);
RedrawCurve(wl->fixCurve, wl->percent);
GuiRedrawAxes(wl->fixCurve);
GuiRedrawCurve(wl->fixCurve, wl->percent);
/* Ecc capacity threshold line */
y = CurveY(wl->fixCurve, wl->eccBytes);
y = GuiCurveY(wl->fixCurve, wl->eccBytes);
gdk_gc_set_rgb_fg_color(Closure->drawGC, Closure->greenSector);
gdk_draw_line(wl->fixCurve->widget->window,
Closure->drawGC,
@@ -308,7 +304,7 @@ void ResetRS03FixWindow(Method *method)
gtk_notebook_set_current_page(GTK_NOTEBOOK(wl->fixNotebook), 0);
ZeroCurve(wl->fixCurve);
GuiZeroCurve(wl->fixCurve);
RS03UpdateFixResults(wl, 0, 0);
if(wl->fixCurve && wl->fixCurve->widget)
@@ -378,7 +374,8 @@ void CreateRS03FixWindow(Method *method, GtkWidget *parent)
ignore = gtk_label_new("footer_tab");
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), wl->fixFootline, ignore);
wl->fixCurve = CreateCurve(d_area, _("Errors/Ecc block"), "%d", 1000, CURVE_PERCENT);
wl->fixCurve = GuiCreateCurve(d_area, _("Errors/Ecc block"), "%d", 1000, CURVE_PERCENT);
wl->fixCurve->enable = DRAW_ICURVE;
}
#endif /* WITH_GUI_YES */

View File

@@ -20,6 +20,8 @@
* along with dvdisaster. If not, see <http://www.gnu.org/licenses/>.
*/
/*** src type: no GUI code ***/
#include "dvdisaster.h"
#include "scsi-layer.h"

View File

@@ -20,6 +20,8 @@
* along with dvdisaster. If not, see <http://www.gnu.org/licenses/>.
*/
/*** src type: some GUI code ***/
#include "dvdisaster.h"
#include "scsi-layer.h"
@@ -589,6 +591,9 @@ static int query_cd(DeviceHandle *dh, int probe_only)
dh->sessions = buf[3];
Verbose("#CD: %d sessions\n", dh->sessions);
if(dh->typeDescr) /* dh may have been reused; avoid memleak */
g_free(dh->typeDescr);
if(control & 4)
switch(buf[13])
{ case 0x00: dh->typeDescr = g_strdup_printf("%s mode 1", dh->profileDescr); dh->subType = DATA1; break;
@@ -2206,10 +2211,7 @@ int TestUnitReady(DeviceHandle *dh)
if(SendPacket(dh, cmd, 6, NULL, 0, &dh->sense, DATA_NONE) != -1)
{
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
SetLabelText(Closure->status, "");
#endif
GuiSetLabelText(Closure->status, "");
return TRUE;
}
@@ -2224,13 +2226,11 @@ int TestUnitReady(DeviceHandle *dh)
continue_waiting = TRUE;
if(continue_waiting)
{ PrintCLIorLabel(STATUS_LABEL_OR_NULL,
{ PrintCLIorLabel(Closure->status,
_("Waiting 10 seconds for drive: %d\n"),9-i);
#ifndef WITH_CLI_ONLY_YES
if(Closure->stopActions)
return FALSE;
#endif
g_usleep(G_USEC_PER_SEC);
continue;
@@ -2240,11 +2240,7 @@ int TestUnitReady(DeviceHandle *dh)
break; /* Something is wrong with the drive */
}
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
SetLabelText(Closure->status, "");
#endif
GuiSetLabelText(Closure->status, "");
return FALSE;
}
@@ -2496,10 +2492,8 @@ int ReadSectors(DeviceHandle *dh, unsigned char *buf, gint64 s, int nsectors)
if(status) /* current try was unsuccessful */
{ int last_key, last_asc, last_ascq;
#ifndef WITH_CLI_ONLY_YES
if(Closure->stopActions) /* user break */
return status;
#endif
/* Do not attempt multiple re-reads if nsectors > 1 and sectorSkip == 0
as these will be re-read with nsectors==1 anyways. */
@@ -2507,7 +2501,7 @@ int ReadSectors(DeviceHandle *dh, unsigned char *buf, gint64 s, int nsectors)
// Why only apply this shortcut to raw reading?
// if(dh->canReadDefective && nsectors > 1 && Closure->sectorSkip == 0)
if(nsectors > 1 && Closure->sectorSkip == 0)
{ PrintCLIorLabel(STATUS_LABEL_OR_NULL,
{ PrintCLIorLabel(Closure->status,
_("Sectors %" PRId64 " - %" PRId64 ": %s\n"),
s, s+nsectors-1, GetLastSenseString(FALSE));
return status;
@@ -2521,13 +2515,13 @@ int ReadSectors(DeviceHandle *dh, unsigned char *buf, gint64 s, int nsectors)
if(last_key == 3 && last_asc == 255 && last_ascq == 2 && dh->rawBuffer)
{ unsigned char *frame = dh->rawBuffer->workBuf->buf;
PrintCLIorLabel(STATUS_LABEL_OR_NULL,
PrintCLIorLabel(Closure->status,
_("Sector %" PRId64 ", try %d: %s Sector returned: %d.\n"),
s, retry, GetLastSenseString(FALSE),
MSFtoLBA(frame[12], frame[13], frame[14]));
}
else
PrintCLIorLabel(STATUS_LABEL_OR_NULL,
PrintCLIorLabel(Closure->status,
_("Sector %" PRId64 ", try %d: %s\n"),
s, retry, GetLastSenseString(FALSE));
@@ -2538,7 +2532,7 @@ int ReadSectors(DeviceHandle *dh, unsigned char *buf, gint64 s, int nsectors)
}
else /* good return status */
{ if(recommended_attempts > 1 && retry > 1)
PrintCLIorLabel(STATUS_LABEL_OR_NULL,
PrintCLIorLabel(Closure->status,
_("Sector %" PRId64 ", try %d: success\n"), s, retry);
break;

View File

@@ -20,6 +20,8 @@
* along with dvdisaster. If not, see <http://www.gnu.org/licenses/>.
*/
/*** src type: no GUI code ***/
#include "dvdisaster.h"
#include "scsi-layer.h"

View File

@@ -23,6 +23,8 @@
/* NetBSD support by Sergey Svishchev <svs@ropnet.ru>.
*/
/*** src type: no GUI code ***/
#include "dvdisaster.h"
#include "scsi-layer.h"

View File

@@ -20,6 +20,8 @@
* along with dvdisaster. If not, see <http://www.gnu.org/licenses/>.
*/
/*** src type: no GUI code ***/
#include "dvdisaster.h"
#include "scsi-layer.h"

View File

@@ -20,12 +20,14 @@
* along with dvdisaster. If not, see <http://www.gnu.org/licenses/>.
*/
/*** src type: no GUI code ***/
#include "dvdisaster.h"
#include "scsi-layer.h"
#include "udf.h"
#if defined(SYS_UNKNOWN) || defined(SYS_HURD)
#ifdef SYS_UNKNOWN
/* Dummy routines so that we can compile on unknown architectures
for which we don't have SCSI support yet. */
@@ -51,4 +53,4 @@ int SendPacket(DeviceHandle *dh, unsigned char *cmd, int cdb_size, unsigned char
return -1;
}
#endif /* defined(SYS_UNKNOWN) || defined(SYS_HURD) */
#endif /* SYS_UNKNOWN */

View File

@@ -1,408 +0,0 @@
/* dvdisaster: Additional error correction for optical media.
* Copyright (C) 2004-2012 Carsten Gnoerlich.
* Project home page: http://www.dvdisaster.com
* Email: carsten@dvdisaster.com -or- cgnoerlich@fsfe.org
*
* 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,
* or direct your browser at http://www.gnu.org.
*/
// DVDISASTER_GUI_FILE
#include "dvdisaster.h"
#if defined(SYS_LINUX) || defined(SYS_FREEBSD) || defined(SYS_KFREEBSD) || \
defined(SYS_NETBSD) || defined(SYS_HURD)
#include <sys/wait.h>
#endif
#ifdef SYS_MINGW
#include "windows.h"
#include "shellapi.h"
#endif
/***
*** Ask user to specify his browser
***/
#if defined(SYS_LINUX) || defined(SYS_FREEBSD) || defined(SYS_KFREEBSD) || \
defined(SYS_NETBSD) || defined(SYS_HURD)
#define SEARCH_BUTTON 1
typedef struct
{ GtkWidget *dialog;
GtkWidget *entry;
GtkWidget *search;
GtkWidget *filesel;
GtkWidget *fileok;
GtkWidget *filecancel;
char *url;
} browser_dialog_info;
static void response_cb(GtkWidget *widget, int response, gpointer data)
{ browser_dialog_info *bdi = (browser_dialog_info*)data;
switch(response)
{ case GTK_RESPONSE_ACCEPT:
if(Closure->browser) g_free(Closure->browser);
Closure->browser = g_strdup(gtk_entry_get_text(GTK_ENTRY(bdi->entry)));
ShowHTML(bdi->url);
break;
case GTK_RESPONSE_REJECT:
if(bdi->url) g_free(bdi->url);
break;
}
gtk_widget_destroy(widget);
if(bdi->filesel)
gtk_widget_destroy(bdi->filesel);
g_free(bdi);
}
static void search_cb(GtkWidget *widget, gpointer data)
{ browser_dialog_info *bdi = (browser_dialog_info*)data;
if(widget == bdi->search)
{ bdi->filesel = gtk_file_selection_new(_utf("windowtitle|Choose a browser"));
bdi->fileok = GTK_FILE_SELECTION(bdi->filesel)->ok_button;
bdi->filecancel = GTK_FILE_SELECTION(bdi->filesel)->cancel_button;
ReverseCancelOK(GTK_DIALOG(bdi->filesel));
gtk_file_selection_hide_fileop_buttons(GTK_FILE_SELECTION(bdi->filesel));
g_signal_connect(G_OBJECT(GTK_FILE_SELECTION(bdi->filesel)->ok_button), "clicked",
G_CALLBACK(search_cb), bdi);
g_signal_connect(G_OBJECT(GTK_FILE_SELECTION(bdi->filesel)->cancel_button), "clicked",
G_CALLBACK(search_cb), bdi);
gtk_widget_show(bdi->filesel);
}
if(widget == bdi->fileok)
{
if(Closure->browser) g_free(Closure->browser);
Closure->browser = g_strdup(gtk_file_selection_get_filename(GTK_FILE_SELECTION(bdi->filesel)));
ShowHTML(bdi->url);
gtk_widget_destroy(bdi->filesel);
gtk_widget_destroy(bdi->dialog);
g_free(bdi);
return;
}
if(widget == bdi->filecancel)
{ gtk_widget_destroy(bdi->filesel);
bdi->filesel = NULL;
}
}
static void browser_dialog(char *url)
{ GtkWidget *dialog, *vbox, *hbox, *label, *entry, *button;
browser_dialog_info *bdi = g_malloc0(sizeof(browser_dialog_info));
/* Create the dialog */
dialog = gtk_dialog_new_with_buttons(_utf("windowtitle|Browser required"),
Closure->window, GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,
GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT, NULL);
bdi->dialog = dialog;
if(url)
{ bdi->url = g_strdup(url);
}
vbox = gtk_vbox_new(FALSE, 0);
gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), vbox, FALSE, FALSE, 0);
gtk_container_set_border_width(GTK_CONTAINER(vbox), 10);
/* Insert the contents */
label = gtk_label_new(NULL);
gtk_label_set_markup(GTK_LABEL(label), _utf("<b>Could not find a suitable browser.</b>\n\n"
"Which browser would you like to use\n"
"for reading the online documentation?\n\n"
"Please enter its name (e.g. mozilla) or\n"
"use the \"Search\" button for a file dialog.\n")),
gtk_box_pack_start(GTK_BOX(vbox), label, TRUE, TRUE, 10);
hbox = gtk_hbox_new(FALSE, 0);
gtk_box_pack_start(GTK_BOX(vbox), hbox, TRUE, TRUE, 10);
bdi->entry = entry = gtk_entry_new();
gtk_box_pack_start(GTK_BOX(hbox), entry, FALSE, FALSE, 10);
bdi->search = button = gtk_button_new_with_label(_utf("Search"));
g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(search_cb), bdi);
gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 10);
/* Show it */
g_signal_connect(dialog, "response", G_CALLBACK(response_cb), bdi);
gtk_widget_show_all(dialog);
}
#endif /* SYS_ unix-like */
/***
*** Show the manual in an external browser
***/
/*
* Check the child processes exit status
* to find whether the browser could be invoked.
*/
typedef struct
{ pid_t pid;
char *url;
GtkWidget *msg;
int seconds;
} browser_info;
static void msg_destroy_cb(GtkWidget *widget, gpointer data)
{ browser_info *bi = (browser_info*)data;
bi->msg = NULL;
}
#if defined(SYS_LINUX) || defined(SYS_FREEBSD) || defined(SYS_KFREEBSD) || \
defined(SYS_NETBSD) || defined(SYS_HURD)
/*
* The following list of browsers and html wrappers
* will be tried one at a time until one entry succeeds by:
* - returning zero
* - not returning within 60 seconds
*/
static int browser_index;
static void try_browser(browser_info*);
static char *browsers[] =
{ "user-selection",
"xdg-open",
"gnome-open",
"htmlview",
"firefox",
"mozilla",
"konqueror",
"epiphany",
"opera",
"/Applications/Safari.app/Contents/MacOS/Safari", /* better way to do this? */
NULL
};
static gboolean browser_timeout_func(gpointer data)
{ browser_info *bi = (browser_info*)data;
int status;
waitpid(bi->pid, &status, WNOHANG);
/* At least mozilla returns random values under FreeBSD on success,
so we can't rely on the return value exept our own 110 one. */
if(WIFEXITED(status))
{
switch(WEXITSTATUS(status))
{ case 110: /* browser did not execute */
browser_index++;
if(!browsers[browser_index]) /* all browsers from the list failed */
{ browser_dialog(bi->url);
if(bi->msg)
gtk_widget_destroy(bi->msg);
if(bi->url)
g_free(bi->url);
g_free(bi);
}
else /* try next browser from list */
{ bi->seconds = 0;
try_browser(bi);
}
return FALSE;
case 0: /* browser assumed to be successful */
default:
if(bi->msg)
gtk_widget_destroy(bi->msg);
if(bi->url)
g_free(bi->url);
g_free(bi);
return FALSE;
}
}
bi->seconds++;
if(bi->seconds == 10 && bi->msg)
{ gtk_widget_destroy(bi->msg);
bi->msg = NULL;
}
return bi->seconds > 60 ? FALSE : TRUE;
}
#endif /* SYS_ unix-like */
#ifdef SYS_MINGW
static gboolean browser_timeout_func(gpointer data)
{ browser_info *bi = (browser_info*)data;
bi->seconds++;
if(bi->seconds >= 10)
{ if(bi->msg)
{ gtk_widget_destroy(bi->msg);
bi->msg = NULL;
}
if(bi->url) g_free(bi->url);
g_free(bi);
return FALSE;
}
return TRUE;
}
#endif /* SYS_MINGW */
/*
* Invoke the browser
*/
#if defined(SYS_LINUX) || defined(SYS_FREEBSD) || defined(SYS_KFREEBSD) || \
defined(SYS_NETBSD) || defined(SYS_HURD)
static void try_browser(browser_info *bi)
{ pid_t pid;
bi->pid = pid = fork();
if(pid == -1)
{ printf("fork failed\n");
return;
}
/* make the parent remember and wait() for the browser */
if(pid > 0)
{ g_timeout_add(1000, browser_timeout_func, (gpointer)bi);
if(browser_index)
{ g_free(Closure->browser);
Closure->browser = g_strdup(browsers[browser_index]);
}
}
/* try calling the browser */
if(pid == 0)
{ char *argv[10];
int argc = 0;
argv[argc++] = browser_index ? browsers[browser_index] : Closure->browser;
argv[argc++] = bi->url;
argv[argc++] = NULL;
execvp(argv[0], argv);
_exit(110); /* couldn't execute */
}
}
#endif /* SYS_ unix-like */
void ShowHTML(char *target)
{ browser_info *bi = g_malloc0(sizeof(browser_info));
guint64 ignore;
const char *lang;
char *path = NULL;
int http_url;
/* If no target is given, select between translations of the manual. */
if(!target) target = g_strdup("index.html");
http_url = strlen(target) > 4 && !strncmp(target, "http", 4);
if(!http_url && !strchr(target, '/')) /* create full path */
{
if(!Closure->docDir)
{
CreateMessage(_("Documentation not installed."), GTK_MESSAGE_ERROR);
g_free(bi);
return;
}
lang = g_getenv("LANG");
if(lang)
{ if(!strncmp(lang, "ru", 2))
#ifdef SYS_MINGW
path = g_strdup_printf("%s\\ru\\%s",Closure->docDir,target);
#else
path = g_strdup_printf("%s/ru/%s",Closure->docDir,target);
#endif
else if(!strncmp(lang, "de", 2))
#ifdef SYS_MINGW
path = g_strdup_printf("%s\\de\\%s",Closure->docDir,target);
#else
path = g_strdup_printf("%s/de/%s",Closure->docDir,target);
#endif
}
if(!path)
{
#ifdef SYS_MINGW
path = g_strdup_printf("%s\\en\\%s",Closure->docDir,target);
#else
path = g_strdup_printf("%s/en/%s",Closure->docDir,target);
#endif
}
#ifdef SYS_MINGW
if(!LargeStat(path, &ignore))
{
g_free(path); /* the local dir is Windows specific */
path = g_strdup_printf("%s\\local\\%s",Closure->docDir,target);
}
#endif
g_free(target);
bi->url = path;
}
else bi->url = target;
if(!http_url && !LargeStat(bi->url, &ignore))
{
CreateMessage(_("Documentation file\n%s\nnot found.\n"), GTK_MESSAGE_ERROR, bi->url);
g_free(bi);
g_free(bi->url);
return;
}
/* Lock the help button and show a message for 10 seconds. */
TimedInsensitive(Closure->helpButton, 10000);
bi->msg = CreateMessage(_("Please hang on until the browser comes up!"), GTK_MESSAGE_INFO);
g_signal_connect(G_OBJECT(bi->msg), "destroy", G_CALLBACK(msg_destroy_cb), bi);
#ifdef SYS_MINGW
/* Okay, Billy wins big time here ;-) */
ShellExecute(NULL, "open", bi->url, NULL, NULL, SW_SHOWNORMAL);
g_timeout_add(1000, browser_timeout_func, (gpointer)bi);
#endif
#if defined(SYS_LINUX) || defined(SYS_FREEBSD) || defined(SYS_KFREEBSD) || \
defined(SYS_NETBSD) || defined(SYS_HURD)
/* Try the first browser */
browser_index = 0;
try_browser(bi);
#endif
}

View File

@@ -20,6 +20,9 @@
* along with dvdisaster. If not, see <http://www.gnu.org/licenses/>.
*/
/*** src type: only GUI code ***/
#ifdef WITH_GUI_YES
#include "dvdisaster.h"
#ifdef SYS_MINGW
@@ -27,6 +30,7 @@
#include "shellapi.h"
#endif
#ifndef SYS_MINGW
static void send_errormsg(int fd, char *format, ...)
{ va_list argp;
char *msg;
@@ -52,14 +56,19 @@ static int recv_errormsg(int fd, char **msg)
return n;
}
#endif
void ShowURL(char *target)
void GuiShowURL(char *target)
{ guint64 ignore;
pid_t pid;
int hyperlink = 0;
char *path, *msg;
char *path;
#ifndef SYS_MINGW
pid_t pid;
char *msg;
int err_pipe[2]; /* child may send down err msgs to us here */
int result;
#endif
if(target && !strncmp(target, "http", 4))
{ hyperlink = 1;
@@ -71,7 +80,7 @@ void ShowURL(char *target)
if(!hyperlink)
{ if(!Closure->docDir)
{
CreateMessage(_("Documentation not installed."), GTK_MESSAGE_ERROR);
GuiCreateMessage(_("Documentation not installed."), GTK_MESSAGE_ERROR);
return;
}
@@ -86,7 +95,7 @@ void ShowURL(char *target)
if(!LargeStat(path, &ignore))
{
CreateMessage(_("Documentation file\n%s\nnot found.\n"), GTK_MESSAGE_ERROR, path);
GuiCreateMessage(_("Documentation file\n%s\nnot found.\n"), GTK_MESSAGE_ERROR, path);
g_free(path);
return;
}
@@ -102,7 +111,7 @@ void ShowURL(char *target)
result = pipe2(err_pipe, O_CLOEXEC);
if(result == -1)
{ CreateMessage(_("Could not create pipe before fork"), GTK_MESSAGE_ERROR);
{ GuiCreateMessage(_("Could not create pipe before fork"), GTK_MESSAGE_ERROR);
return;
}
pid = fork();
@@ -110,7 +119,7 @@ void ShowURL(char *target)
if(pid == -1)
{ close(err_pipe[0]);
close(err_pipe[1]);
CreateMessage(_("Could not fork to start xdg-open"), GTK_MESSAGE_ERROR);
GuiCreateMessage(_("Could not fork to start xdg-open"), GTK_MESSAGE_ERROR);
return;
}
@@ -124,7 +133,7 @@ void ShowURL(char *target)
close(err_pipe[0]);
/* prepare args and try to exec xdg-open */
argv[argc++] = "xdg-open";
argv[argc++] = path;
argv[argc++] = NULL;
@@ -133,8 +142,8 @@ void ShowURL(char *target)
/* if we reach this, telegraph our parent that sth f*cked up */
send_errormsg(err_pipe[1],
_("execvp could not execute \"xdg-open\":\n%s\nIs xdg-open installed correctly?\n"),
strerror(errno));
_("execvp could not execute \"xdg-open\":\n%s\nIs xdg-open installed correctly?\n"),
strerror(errno));
close(err_pipe[1]);
_exit(110); /* couldn't execute */
}
@@ -146,7 +155,9 @@ void ShowURL(char *target)
close(err_pipe[0]);
if(result)
CreateMessage(msg, GTK_MESSAGE_ERROR);
{ GuiCreateMessage("%s", GTK_MESSAGE_ERROR, msg);
}
#endif
}
#endif

View File

@@ -20,6 +20,8 @@
* along with dvdisaster. If not, see <http://www.gnu.org/licenses/>.
*/
/*** src type: no GUI code ***/
#include "dvdisaster.h"
//#define LOCAL_ONLY 1

View File

@@ -19,8 +19,10 @@
* You should have received a copy of the GNU General Public License
* along with dvdisaster. If not, see <http://www.gnu.org/licenses/>.
*/
// DVDISASTER_GUI_FILE
/*** src type: only GUI code ***/
#ifdef WITH_GUI_YES
#include "dvdisaster.h"
/***
@@ -32,14 +34,18 @@
* Allocate and fill in the spiral data structure
*/
Spiral* CreateSpiral(GdkColor *outline, GdkColor *fill,
int start_radius, int segment_size, int n_segments)
{ Spiral *spiral = g_malloc0(sizeof(Spiral));
Spiral* GuiCreateSpiral(GdkColor *outline, GdkColor *fill,
int start_radius, int segment_size, int n_segments)
{ Spiral *spiral;
double a = 0.0;
double scale_o = start_radius + segment_size;
double ring_expand;
int i;
if(!Closure->guiMode)
return NULL;
spiral = g_malloc0(sizeof(Spiral));
spiral->startRadius = start_radius;
spiral->segmentSize = segment_size;
spiral->segmentCount = spiral->segmentClipping = n_segments;
@@ -63,7 +69,7 @@ Spiral* CreateSpiral(GdkColor *outline, GdkColor *fill,
return spiral;
}
void SetSpiralWidget(Spiral *spiral, GtkWidget *widget)
void GuiSetSpiralWidget(Spiral *spiral, GtkWidget *widget)
{ GtkAllocation *al = &widget->allocation;
if(!spiral->drawable)
@@ -73,8 +79,10 @@ void SetSpiralWidget(Spiral *spiral, GtkWidget *widget)
}
}
void FreeSpiral(Spiral *spiral)
{ g_free(spiral->segmentPos);
void GuiFreeSpiral(Spiral *spiral)
{ if(!spiral) return;
g_free(spiral->segmentPos);
g_free(spiral->segmentColor);
g_free(spiral);
}
@@ -83,7 +91,7 @@ void FreeSpiral(Spiral *spiral)
* Fill spiral segments with given color
*/
void FillSpiral(Spiral *spiral, GdkColor *color)
void GuiFillSpiral(Spiral *spiral, GdkColor *color)
{ int i;
if(spiral)
@@ -95,7 +103,7 @@ void FillSpiral(Spiral *spiral, GdkColor *color)
* Draw the whole spiral
*/
void DrawSpiral(Spiral *spiral)
void GuiDrawSpiral(Spiral *spiral)
{ double a;
int xi0,yi0,xo0,yo0;
double scale_i,scale_o;
@@ -142,7 +150,7 @@ void DrawSpiral(Spiral *spiral)
* Draw just one segment of the spiral
*/
void DrawSpiralSegment(Spiral *spiral, GdkColor *color, int segment)
void GuiDrawSpiralSegment(Spiral *spiral, GdkColor *color, int segment)
{ double a;
double scale_i,scale_o,ring_expand;
GdkPoint points[4];
@@ -183,12 +191,12 @@ void DrawSpiralSegment(Spiral *spiral, GdkColor *color, int segment)
* Draw a label above or below the spiral
*/
void DrawSpiralLabel(Spiral *spiral, PangoLayout *layout,
char *text, GdkColor *color, int x, int line)
void GuiDrawSpiralLabel(Spiral *spiral, PangoLayout *layout,
char *text, GdkColor *color, int x, int line)
{ GdkDrawable *d = spiral->drawable;
int w,h,y;
SetText(layout, text, &w, &h);
GuiSetText(layout, text, &w, &h);
if(line > 0) y = spiral->my + spiral->diameter / 2 + 20 + (line-1) * (10 + h);
else y = spiral->my - spiral->diameter / 2 - 20 - h + (line+1) * (10 + h);
gdk_gc_set_rgb_fg_color(Closure->drawGC, color);
@@ -204,8 +212,11 @@ void DrawSpiralLabel(Spiral *spiral, PangoLayout *layout,
* Moving to segment -1 means to disable the cursor.
*/
void MoveSpiralCursor(Spiral *spiral, int to_segment)
void GuiMoveSpiralCursor(Spiral *spiral, int to_segment)
{
if(!Closure->guiMode)
return;
if(to_segment == spiral->cursorPos)
return;
@@ -215,7 +226,7 @@ void MoveSpiralCursor(Spiral *spiral, int to_segment)
/* Erase old cursor */
if(spiral->cursorPos >= 0)
DrawSpiralSegment(spiral, spiral->colorUnderCursor, spiral->cursorPos);
GuiDrawSpiralSegment(spiral, spiral->colorUnderCursor, spiral->cursorPos);
/* Moving to -1 means cursor off */
@@ -232,7 +243,7 @@ void MoveSpiralCursor(Spiral *spiral, int to_segment)
/* Draw cursor at new place */
spiral->colorUnderCursor = spiral->segmentColor[to_segment];
DrawSpiralSegment(spiral, Closure->blueSector, to_segment);
GuiDrawSpiralSegment(spiral, Closure->blueSector, to_segment);
}
/*
@@ -247,14 +258,17 @@ typedef struct _cursor_info
static gboolean cursor_idle_func(gpointer data)
{ cursor_info *ci = (cursor_info*)data;
MoveSpiralCursor(ci->spiral, ci->segment);
GuiMoveSpiralCursor(ci->spiral, ci->segment);
g_free(ci);
return FALSE;
}
void ChangeSpiralCursor(Spiral *spiral, int segment)
{
void GuiChangeSpiralCursor(Spiral *spiral, int segment)
{
if(!Closure->guiMode)
return;
if(segment != spiral->cursorPos)
{ cursor_info *ci = g_malloc(sizeof(cursor_info));
@@ -263,3 +277,4 @@ void ChangeSpiralCursor(Spiral *spiral, int segment)
g_idle_add(cursor_idle_func, ci);
}
}
#endif /* WITH_GUI_YES */

View File

@@ -20,6 +20,8 @@
* along with dvdisaster. If not, see <http://www.gnu.org/licenses/>.
*/
/*** src type: no GUI code ***/
#include "dvdisaster.h"
#include "udf.h"
@@ -364,11 +366,8 @@ static IsoInfo* examine_iso(Image *image)
/*** Iterate over the volume decriptors */
for(sector=16; sector<32; sector++)
{
#ifndef WITH_CLI_ONLY_YES
if(Closure->stopActions)
{ if(Closure->stopActions)
continue;
#endif
if(ImageReadSectors(image, buf, sector, 1) != 1)
{ Verbose(" Sector %2d: unreadable\n", sector);

View File

@@ -19,8 +19,10 @@
* You should have received a copy of the GNU General Public License
* along with dvdisaster. If not, see <http://www.gnu.org/licenses/>.
*/
// DVDISASTER_GUI_FILE
/*** src type: only GUI code ***/
#ifdef WITH_GUI_YES
#include "dvdisaster.h"
/***
@@ -79,19 +81,12 @@ static gboolean expose_cb(GtkWidget *widget, GdkEventExpose *event, gpointer dat
Closure->invisibleDash = g_strdup_printf("<span color=\"#%02x%02x%02x\">-</span>",
bg->red>>8, bg->green>>8, bg->blue>>8);
AboutText(box, _("This is <b>v0.79.6-pl9</b>. The patchlevel series are enhanced from the last upstream pre-release.\n"
"We add support for a CLI version, BD-R TL/QL, a Windows build, an option to produce bigger BD-R RS03,\n"
GuiAboutText(box, _("This is <b>v0.79.10-pl1</b>. The patchlevel series are enhanced from the last upstream release.\n"
"We add support for BD-R TL/QL, a Windows build, an option to produce bigger BD-R RS03,\n"
"images, support for stripping ECC from ISOs, re-enabled adaptive reading (except for RS03), and more.\n"
"\n"
"Please refer to the <i>Help &gt; Change log</i> menu for all the details.\n"
"The warning message from the pre-release version is retained below.\n"));
"Please refer to the <i>Help &gt; Change log</i> menu for all the details."));
AboutText(box, _("<i>Please note:</i>\n"
"This is a <span color=\"#800000\">pre-release</span> for expert users.\n"
"It may contain unfinished features.\n"
"Adaptive reading is <span color=\"#800000\">unavailable</span> in this version.\n"
"It will be re-introduced in one of the next releases."));
gtk_box_pack_start(GTK_BOX(box), gtk_hseparator_new(), FALSE, FALSE, 10);
button = gtk_check_button_new_with_label(_utf("Show this message again"));
@@ -112,7 +107,7 @@ static gboolean expose_cb(GtkWidget *widget, GdkEventExpose *event, gpointer dat
* Create the window
*/
void CreateWelcomePage(GtkNotebook *notebook)
void GuiCreateWelcomePage(GtkNotebook *notebook)
{ GtkWidget *box,*align,*ignore;
int show_msg;
@@ -135,22 +130,22 @@ void CreateWelcomePage(GtkNotebook *notebook)
widget = gtk_image_new_from_stock("dvdisaster-create", GTK_ICON_SIZE_LARGE_TOOLBAR);
gtk_box_pack_start(GTK_BOX(box), widget, FALSE, FALSE, 0);
AboutText(box, "<span weight=\"bold\" size=\"xx-large\">dvdisaster</span>");
GuiAboutText(box, "<span weight=\"bold\" size=\"xx-large\">dvdisaster</span>");
return;
#endif
}
AboutText(box, _("<span weight=\"bold\" size=\"xx-large\">Welcome to dvdisaster!</span>"));
GuiAboutText(box, _("<span weight=\"bold\" size=\"xx-large\">Welcome to dvdisaster!</span>"));
AboutText(box, _("\ndvdisaster creates error correction data to protect\n"
"optical media (CD,DVD,BD) against data loss.\n"));
GuiAboutText(box, _("\ndvdisaster creates error correction data to protect\n"
"optical media (CD,DVD,BD) against data loss.\n"));
AboutTextWithLink(box, _("Please see the [manual] for typical uses of dvdisaster.\n\n"),
GuiAboutTextWithLink(box, _("Please see the [manual] for typical uses of dvdisaster.\n\n"),
"manual.pdf");
AboutText(box, _("<i>New in this Version:</i>"));
GuiAboutText(box, _("<i>New in this Version:</i>"));
/* actual list is generated in the expose event handler */
}
#endif /* WITH_GUI_YES */