3
* Copyright (c) 2004-2006 by Alastair M. Robinson
4
* Distributed under the terms of the GNU General Public License -
5
* see the file named "COPYING" for more details.
16
#include "support/configdb.h"
17
#include "photoprint_state.h"
19
#include "pp_mainwindow.h"
20
#include "support/progressbar.h"
22
#include "support/generaldialogs.h"
23
#include "splashscreen/splashscreen.h"
30
bool ParseOptions(int argc,char *argv[],char **presetname)
33
static struct option long_options[] =
35
{"help",no_argument,NULL,'h'},
36
{"version",no_argument,NULL,'v'},
37
{"preset",required_argument,NULL,'p'},
38
{"batch",no_argument,NULL,'b'},
45
c = getopt_long(argc,argv,"hvp:b",long_options,NULL);
51
printf("Usage: %s [options] image1 [image2] ... \n",argv[0]);
52
printf("\t -h --help\t\tdisplay this message\n");
53
printf("\t -v --version\t\tdisplay version\n");
54
printf("\t -p --preset\t\tread a specific preset file\n");
55
printf("\t -b --batch\t\trun without user interface\n");
59
printf("%s\n",PACKAGE_STRING);
74
static void destroy( GtkWidget *widget,
81
int main(int argc,char **argv)
85
cerr << "Photoprint starting..." << endl;
86
gboolean have_gtk=false;
87
char *presetname=NULL;
89
bool batchmode=ParseOptions(argc,argv,&presetname);
91
have_gtk=gtk_init_check (&argc, &argv);
93
SplashScreen *splash=NULL;
96
splash=new SplashScreen;
97
splash->SetMessage("Initializing...");
100
cerr << "SplashScreen displayed..." << endl;
102
PhotoPrint_State state(batchmode);
104
cerr << "State created..." << endl;
107
state.SetFilename(presetname);
108
cerr << "Set initial filename" << endl;
111
splash->SetMessage("Checking .photoprint directory...");
113
CheckSettingsDir(".photoprint");
116
splash->SetMessage("Loading preset...");
121
splash->SetMessage("Creating layout...");
131
cerr << "Running in batch mode" << endl;
134
for(int i=optind;i<argc;++i)
136
cerr << "Adding file: " << argv[i] << endl;
137
state.layout->AddImage(argv[i]);
140
state.layout->Print(&p);
143
catch(const char *err)
145
cerr << "Error: " << err << endl;
152
GtkWidget *mainwindow;
153
mainwindow = pp_mainwindow_new(&state);
154
g_signal_connect (G_OBJECT (mainwindow), "destroy",
155
G_CALLBACK (destroy), NULL);
156
gtk_widget_show (mainwindow);
160
ProgressBar p("Loading images...",true,mainwindow);
162
for(int i=optind;i<argc;++i)
164
if(!p.DoProgress(i-optind,argc-optind))
166
lastpage=state.layout->AddImage(argv[i]);
168
state.layout->SetCurrentPage(lastpage);
171
pp_mainwindow_refresh(PP_MAINWINDOW(mainwindow));
175
catch (const char *err)
177
ErrorMessage_Dialog(err);
181
catch(const char *err)
183
cerr << "Error: " << err << endl;
3
* Copyright (c) 2004-2006 by Alastair M. Robinson
4
* Distributed under the terms of the GNU General Public License -
5
* see the file named "COPYING" for more details.
16
#include <gutenprint/gutenprint.h>
22
#include "support/configdb.h"
23
#include "photoprint_state.h"
25
#include "pp_mainwindow.h"
26
#include "support/progressbar.h"
28
#include "support/generaldialogs.h"
29
#include "splashscreen/splashscreen.h"
30
#include "profilemanager/profileselector.h"
31
#include "profilemanager/intentselector.h"
32
#include "support/patheditor.h"
36
#define _(x) gettext(x)
37
#define N_(x) gettext_noop(x)
41
bool ParseOptions(int argc,char *argv[],char **presetname)
44
static struct option long_options[] =
46
{"help",no_argument,NULL,'h'},
47
{"version",no_argument,NULL,'v'},
48
{"preset",required_argument,NULL,'p'},
49
{"batch",no_argument,NULL,'b'},
56
c = getopt_long(argc,argv,"hvp:b",long_options,NULL);
62
printf("Usage: %s [options] image1 [image2] ... \n",argv[0]);
63
printf("\t -h --help\t\tdisplay this message\n");
64
printf("\t -v --version\t\tdisplay version\n");
65
printf("\t -p --preset\t\tread a specific preset file\n");
66
printf("\t -b --batch\t\trun without user interface\n");
70
printf("%s\n",PACKAGE_STRING);
85
static void destroy( GtkWidget *widget,
92
int main(int argc,char **argv)
94
cerr << "Photoprint starting..." << endl;
95
gboolean have_gtk=false;
96
char *presetname=NULL;
100
bool batchmode=ParseOptions(argc,argv,&presetname);
102
have_gtk=gtk_init_check (&argc, &argv);
107
setlocale(LC_ALL,"");
109
cerr << "Setting up gettext... " << PACKAGE << ", " << LOCALEDIR << endl;
110
bindtextdomain(PACKAGE,LOCALEDIR);
111
bind_textdomain_codeset(PACKAGE, "UTF-8");
116
SplashScreen *splash=NULL;
119
splash=new SplashScreen;
120
splash->SetMessage(_("Initializing..."));
123
PhotoPrint_State state(batchmode);
125
cerr << "State created..." << endl;
128
state.SetFilename(presetname);
129
cerr << "Set initial filename" << endl;
132
splash->SetMessage(_("Checking .photoprint directory..."));
134
CheckSettingsDir(".photoprint");
137
splash->SetMessage(_("Loading preset..."));
142
splash->SetMessage(_("Creating layout..."));
146
cerr << "Translation test: " << _("Initializing...") << endl;
150
cerr << "Translation test: " << _("Initializing...") << endl;
156
cerr << "Running in batch mode" << endl;
159
for(int i=optind;i<argc;++i)
161
cerr << "Adding file: " << argv[i] << endl;
162
state.layout->AddImage(argv[i]);
165
state.layout->Print(&p);
168
catch(const char *err)
170
cerr << "Error: " << err << endl;
177
GtkWidget *mainwindow;
178
cerr << "Translation test: " << _("Initializing...") << endl;
179
mainwindow = pp_mainwindow_new(&state);
180
g_signal_connect (G_OBJECT (mainwindow), "destroy",
181
G_CALLBACK (destroy), NULL);
182
gtk_widget_show (mainwindow);
184
cerr << "Translation test: " << _("Initializing...") << endl;
188
ProgressBar p(_("Loading images..."),true,mainwindow);
190
for(int i=optind;i<argc;++i)
192
if(!p.DoProgress(i-optind,argc-optind))
194
lastpage=state.layout->AddImage(argv[i]);
196
state.layout->SetCurrentPage(lastpage);
199
cerr << "Translation test: " << _("Initializing...") << endl;
201
pp_mainwindow_refresh(PP_MAINWINDOW(mainwindow));
203
cerr << "Translation test: " << _("Initializing...") << endl;
207
catch (const char *err)
209
ErrorMessage_Dialog(err);
213
catch(const char *err)
215
cerr << "Error: " << err << endl;