IMPLEMENT_DYNAMIC_CLASS(wxPrintPaperDatabase, wxList)
#endif
-wxPostScriptDC::wxPostScriptDC (void)
+wxPostScriptDC::wxPostScriptDC ()
{
// m_yOrigin = 792; // For EPS output
m_yOrigin = 842; // For A4 output
return m_ok;
}
-wxPostScriptDC::~wxPostScriptDC (void)
+wxPostScriptDC::~wxPostScriptDC ()
{
if (m_pstream)
delete m_pstream;
*m_pstream << "closepath clip newpath\n";
}
-void wxPostScriptDC::DestroyClippingRegion (void)
+void wxPostScriptDC::DestroyClippingRegion ()
{
if (!m_pstream)
return;
}
}
-void wxPostScriptDC::Clear (void)
+void wxPostScriptDC::Clear ()
{
}
}
-void wxPostScriptDC::EndDoc (void)
+void wxPostScriptDC::EndDoc ()
{
static char wxPostScriptHeaderReencodeISO1[] =
"\n/reencodeISO {\n"
#endif
}
-void wxPostScriptDC::StartPage (void)
+void wxPostScriptDC::StartPage ()
{
if (!m_pstream)
return;
*m_pstream << translate_x << " " << translate_y << " translate\n";
}
-void wxPostScriptDC::EndPage (void)
+void wxPostScriptDC::EndPage ()
{
if (!m_pstream)
return;
return TRUE;
}
-long wxPostScriptDC::GetCharHeight (void)
+long wxPostScriptDC::GetCharHeight ()
{
if (m_font.Ok())
return m_font.GetPointSize ();
*(GetStream()) << c << " " << (GetYOrigin() - d) << " lineto stroke\n";
}
-long wxPostScriptDC::GetCharWidth (void)
+long wxPostScriptDC::GetCharWidth ()
{
// Chris Breeze: reasonable approximation using wxMODERN/Courier
return (long) (GetCharHeight() * 72.0 / 120.0);
wxEndBusyCursor();
}
-int wxPostScriptPrintDialog::ShowModal (void)
+int wxPostScriptPrintDialog::ShowModal ()
{
if ( wxDialog::ShowModal() == wxID_OK )
{
}
// Get current values
-char *wxGetPrinterCommand(void)
+char *wxGetPrinterCommand()
{
return wxThePrintSetupData->GetPrinterCommand();
}
-char *wxGetPrintPreviewCommand(void)
+char *wxGetPrintPreviewCommand()
{
return wxThePrintSetupData->GetPrintPreviewCommand();
}
-char *wxGetPrinterOptions(void)
+char *wxGetPrinterOptions()
{
return wxThePrintSetupData->GetPrinterOptions();
}
-char *wxGetPrinterFile(void)
+char *wxGetPrinterFile()
{
return wxThePrintSetupData->GetPrinterFile();
}
-int wxGetPrinterOrientation(void)
+int wxGetPrinterOrientation()
{
return wxThePrintSetupData->GetPrinterOrientation();
}
wxThePrintSetupData->GetPrinterTranslation(x, y);
}
-int wxGetPrinterMode(void)
+int wxGetPrinterMode()
{
return wxThePrintSetupData->GetPrinterMode();
}
-char *wxGetAFMPath(void)
+char *wxGetAFMPath()
{
return wxThePrintSetupData->GetAFMPath();
}
* Print setup data
*/
-wxPrintSetupData::wxPrintSetupData(void)
+wxPrintSetupData::wxPrintSetupData()
{
printerCommand = (char *) NULL;
previewCommand = (char *) NULL;
printerFile = (char *) NULL;
}
-wxPrintSetupData::~wxPrintSetupData(void)
+wxPrintSetupData::~wxPrintSetupData()
{
if (printerCommand)
delete[] printerCommand;
}
// Get current values
-char *wxPrintSetupData::GetPrinterCommand(void)
+char *wxPrintSetupData::GetPrinterCommand()
{
return printerCommand;
}
-char *wxPrintSetupData::GetPrintPreviewCommand(void)
+char *wxPrintSetupData::GetPrintPreviewCommand()
{
return previewCommand;
}
-char *wxPrintSetupData::GetPrinterOptions(void)
+char *wxPrintSetupData::GetPrinterOptions()
{
return printerFlags;
}
-char *wxPrintSetupData::GetPrinterFile(void)
+char *wxPrintSetupData::GetPrinterFile()
{
return printerFile;
}
-char *wxPrintSetupData::GetPaperName(void)
+char *wxPrintSetupData::GetPaperName()
{
return paperName;
}
-int wxPrintSetupData::GetPrinterOrientation(void)
+int wxPrintSetupData::GetPrinterOrientation()
{
return printerOrient;
}
*y = printerTranslateY;
}
-int wxPrintSetupData::GetPrinterMode(void)
+int wxPrintSetupData::GetPrinterMode()
{
return printerMode;
}
-char *wxPrintSetupData::GetAFMPath(void)
+char *wxPrintSetupData::GetAFMPath()
{
return afmPath;
}
-bool wxPrintSetupData::GetColour(void)
+bool wxPrintSetupData::GetColour()
{
return printColour;
}
pageName = copystring(name);
}
-wxPrintPaperType::~wxPrintPaperType(void)
+wxPrintPaperType::~wxPrintPaperType()
{
delete[] pageName;
}
-wxPrintPaperDatabase::wxPrintPaperDatabase(void):wxList(wxKEY_STRING)
+wxPrintPaperDatabase::wxPrintPaperDatabase():wxList(wxKEY_STRING)
{
DeleteContents(TRUE);
}
-wxPrintPaperDatabase::~wxPrintPaperDatabase(void)
+wxPrintPaperDatabase::~wxPrintPaperDatabase()
{
}
-void wxPrintPaperDatabase::CreateDatabase(void)
+void wxPrintPaperDatabase::CreateDatabase()
{
// Need correct values for page size in pixels.
// Each unit is one 'point' = 1/72 of an inch.
AddPaperType(_("Legal 8 1/2 x 14 in"), 216, 356, 612, 1009);
}
-void wxPrintPaperDatabase::ClearDatabase(void)
+void wxPrintPaperDatabase::ClearDatabase()
{
Clear();
}
#include "wx/utils.h"
#include "wx/string.h"
+#include "wx/intl.h"
+#include "wx/log.h"
+
#include <stdarg.h>
#include <dirent.h>
#include <string.h>
#ifdef __SVR4__
-#include <sys/systeminfo.h>
+ #include <sys/systeminfo.h>
#endif
//------------------------------------------------------------------------
if (!title.IsNull()) fprintf( stderr, "%s ", WXSTRINGCAST(title) );
if (!msg.IsNull()) fprintf( stderr, ": %s", WXSTRINGCAST(msg) );
fprintf( stderr, ".\n" );
- exit(1);
+ exit(3); // the same exit code as for abort()
};
//------------------------------------------------------------------------
// subprocess routines
//------------------------------------------------------------------------
-typedef struct {
+struct wxEndProcessData
+{
gint pid, tag;
wxProcess *process;
-} wxEndProcessData;
+};
static void GTK_EndProcessDetector(gpointer data, gint source,
GdkInputCondition WXUNUSED(condition) )
wxEndProcessData *data = new wxEndProcessData;
int end_proc_detect[2];
- if (*argv == NULL)
- return 0;
+ wxCHECK_MSG( *argv, 0, "can't exec empty command" );
/* Create pipes */
if (pipe(end_proc_detect) == -1) {
- perror("pipe failed");
+ wxLogSysError(_("Pipe creation failed"));
return 0;
}
pid_t pid = fork();
#endif
if (pid == -1) {
- perror ("fork failed");
+ // error
+ wxLogSysError(_("Fork failed"));
return 0;
- } else if (pid == 0) {
- /* Close fd not useful */
+ }
+ else if (pid == 0) {
+ // we're in child
close(end_proc_detect[0]); // close reading side
- /* child */
#ifdef _AIX
execvp ((const char *)*argv, (const char **)argv);
#else
execvp (*argv, argv);
#endif
- if (errno == ENOENT)
- wxError("command not found", *argv);
- else
- perror (*argv);
- wxError("could not execute", *argv);
- _exit (-1);
- }
-
- close(end_proc_detect[1]); // close writing side
- data->tag = gdk_input_add(end_proc_detect[0], GDK_INPUT_READ,
- GTK_EndProcessDetector, (gpointer)data);
- data->pid = pid;
- if (!sync) {
- data->process = process;
- } else {
- data->process = (wxProcess *) NULL;
- data->pid = -(data->pid);
+ // there is no return after successful exec()
+ wxLogSysError(_("Can't execute '%s'"), *argv);
- while (data->pid != 0)
- wxYield();
-
- delete data;
+ _exit(-1);
+ }
+ else {
+ // we're in parent
+ close(end_proc_detect[1]); // close writing side
+ data->tag = gdk_input_add(end_proc_detect[0], GDK_INPUT_READ,
+ GTK_EndProcessDetector, (gpointer)data);
+ data->pid = pid;
+ if (!sync) {
+ data->process = process;
+ }
+ else {
+ data->process = (wxProcess *) NULL;
+ data->pid = -(data->pid);
+
+ while (data->pid != 0)
+ wxYield();
+
+ delete data;
+ }
+
+ // @@@ our return value indicates success even if execvp() in the child
+ // failed!
+ return pid;
}
-
- return pid;
};
long wxExecute( const wxString& command, bool sync, wxProcess *process )
{
- if (command.IsNull() || command == "") return FALSE;
+ static const char *IFS = " \t\n";
+
+ wxCHECK_MSG( !command.IsEmpty(), 0, "can't exec empty command" );
int argc = 0;
char *argv[127];
- char tmp[1024];
- const char *IFS = " \t\n";
+ char *tmp = new char[command.Len() + 1];
+ strcpy(tmp, command);
- strncpy (tmp, command, sizeof(tmp) / sizeof(char) - 1);
- tmp[sizeof (tmp) / sizeof (char) - 1] = '\0';
- argv[argc++] = strtok (tmp, IFS);
+ argv[argc++] = strtok(tmp, IFS);
while ((argv[argc++] = strtok((char *) NULL, IFS)) != NULL)
/* loop */ ;
- return wxExecute(argv, sync, process);
-};
+ long lRc = wxExecute(argv, sync, process);
+
+ delete [] tmp;
+ return lRc;
+};
#include "wx/utils.h"
#include "wx/string.h"
+#include "wx/intl.h"
+#include "wx/log.h"
+
#include <stdarg.h>
#include <dirent.h>
#include <string.h>
#ifdef __SVR4__
-#include <sys/systeminfo.h>
+ #include <sys/systeminfo.h>
#endif
//------------------------------------------------------------------------
if (!title.IsNull()) fprintf( stderr, "%s ", WXSTRINGCAST(title) );
if (!msg.IsNull()) fprintf( stderr, ": %s", WXSTRINGCAST(msg) );
fprintf( stderr, ".\n" );
- exit(1);
+ exit(3); // the same exit code as for abort()
};
//------------------------------------------------------------------------
// subprocess routines
//------------------------------------------------------------------------
-typedef struct {
+struct wxEndProcessData
+{
gint pid, tag;
wxProcess *process;
-} wxEndProcessData;
+};
static void GTK_EndProcessDetector(gpointer data, gint source,
GdkInputCondition WXUNUSED(condition) )
wxEndProcessData *data = new wxEndProcessData;
int end_proc_detect[2];
- if (*argv == NULL)
- return 0;
+ wxCHECK_MSG( *argv, 0, "can't exec empty command" );
/* Create pipes */
if (pipe(end_proc_detect) == -1) {
- perror("pipe failed");
+ wxLogSysError(_("Pipe creation failed"));
return 0;
}
pid_t pid = fork();
#endif
if (pid == -1) {
- perror ("fork failed");
+ // error
+ wxLogSysError(_("Fork failed"));
return 0;
- } else if (pid == 0) {
- /* Close fd not useful */
+ }
+ else if (pid == 0) {
+ // we're in child
close(end_proc_detect[0]); // close reading side
- /* child */
#ifdef _AIX
execvp ((const char *)*argv, (const char **)argv);
#else
execvp (*argv, argv);
#endif
- if (errno == ENOENT)
- wxError("command not found", *argv);
- else
- perror (*argv);
- wxError("could not execute", *argv);
- _exit (-1);
- }
-
- close(end_proc_detect[1]); // close writing side
- data->tag = gdk_input_add(end_proc_detect[0], GDK_INPUT_READ,
- GTK_EndProcessDetector, (gpointer)data);
- data->pid = pid;
- if (!sync) {
- data->process = process;
- } else {
- data->process = (wxProcess *) NULL;
- data->pid = -(data->pid);
+ // there is no return after successful exec()
+ wxLogSysError(_("Can't execute '%s'"), *argv);
- while (data->pid != 0)
- wxYield();
-
- delete data;
+ _exit(-1);
+ }
+ else {
+ // we're in parent
+ close(end_proc_detect[1]); // close writing side
+ data->tag = gdk_input_add(end_proc_detect[0], GDK_INPUT_READ,
+ GTK_EndProcessDetector, (gpointer)data);
+ data->pid = pid;
+ if (!sync) {
+ data->process = process;
+ }
+ else {
+ data->process = (wxProcess *) NULL;
+ data->pid = -(data->pid);
+
+ while (data->pid != 0)
+ wxYield();
+
+ delete data;
+ }
+
+ // @@@ our return value indicates success even if execvp() in the child
+ // failed!
+ return pid;
}
-
- return pid;
};
long wxExecute( const wxString& command, bool sync, wxProcess *process )
{
- if (command.IsNull() || command == "") return FALSE;
+ static const char *IFS = " \t\n";
+
+ wxCHECK_MSG( !command.IsEmpty(), 0, "can't exec empty command" );
int argc = 0;
char *argv[127];
- char tmp[1024];
- const char *IFS = " \t\n";
+ char *tmp = new char[command.Len() + 1];
+ strcpy(tmp, command);
- strncpy (tmp, command, sizeof(tmp) / sizeof(char) - 1);
- tmp[sizeof (tmp) / sizeof (char) - 1] = '\0';
- argv[argc++] = strtok (tmp, IFS);
+ argv[argc++] = strtok(tmp, IFS);
while ((argv[argc++] = strtok((char *) NULL, IFS)) != NULL)
/* loop */ ;
- return wxExecute(argv, sync, process);
-};
+ long lRc = wxExecute(argv, sync, process);
+
+ delete [] tmp;
+ return lRc;
+};