59 # define dprintf printf("%s(): ", __FUNCTION__); printf
61 # define dprintf if(0) printf
64 #define NUMBER_OF_DEFAULT_COLORS 18
65 #define NUMBER_OF_DEFAULT_TRANSFORMATIONS 20
89 {0,0,1,1,0,FALSE,FALSE,FALSE},
90 {0,0,1,1,0,FALSE,FALSE,FALSE},
91 {0,0,1,1,0,FALSE,FALSE,FALSE},
92 {0,0,1,1,0,FALSE,FALSE,FALSE},
93 {0,0,1,1,0,FALSE,FALSE,FALSE},
94 {0,0,1,1,0,FALSE,FALSE,FALSE},
95 {0,0,1,1,0,FALSE,FALSE,FALSE},
96 {0,0,1,1,0,FALSE,FALSE,FALSE},
97 {0,0,1,1,0,FALSE,FALSE,FALSE},
98 {0,0,1,1,0,FALSE,FALSE,FALSE},
99 {0,0,1,1,0,FALSE,FALSE,FALSE},
100 {0,0,1,1,0,FALSE,FALSE,FALSE},
101 {0,0,1,1,0,FALSE,FALSE,FALSE},
102 {0,0,1,1,0,FALSE,FALSE,FALSE},
103 {0,0,1,1,0,FALSE,FALSE,FALSE},
104 {0,0,1,1,0,FALSE,FALSE,FALSE},
105 {0,0,1,1,0,FALSE,FALSE,FALSE},
106 {0,0,1,1,0,FALSE,FALSE,FALSE},
107 {0,0,1,1,0,FALSE,FALSE,FALSE},
108 {0,0,1,1,0,FALSE,FALSE,FALSE},
111 #ifdef HAVE_GETOPT_LONG
114 const struct option longopts[] = {
116 {
"border", required_argument, NULL,
'B'},
117 {
"dpi", required_argument, NULL,
'D'},
118 {
"version", no_argument, NULL,
'V'},
119 {
"origin", required_argument, NULL,
'O'},
120 {
"window_inch", required_argument, NULL,
'W'},
121 {
"antialias", no_argument, NULL,
'a'},
122 {
"background", required_argument, NULL,
'b'},
123 {
"dump", no_argument, NULL,
'd'},
124 {
"foreground", required_argument, NULL,
'f'},
125 {
"rotate", required_argument, NULL,
'r'},
126 {
"mirror", required_argument, NULL,
'm'},
127 {
"help", no_argument, NULL,
'h'},
128 {
"log", required_argument, NULL,
'l'},
129 {
"output", required_argument, NULL,
'o'},
130 {
"project", required_argument, NULL,
'p'},
131 {
"tools", required_argument, NULL,
't'},
132 {
"translate", required_argument, NULL,
'T'},
133 {
"window", required_argument, NULL,
'w'},
134 {
"export", required_argument, NULL,
'x'},
135 {
"geometry", required_argument, &longopt_val, 1},
137 {
"gtk-module", required_argument, &longopt_val, 2},
138 {
"g-fatal-warnings",no_argument, &longopt_val, 2},
139 {
"gtk-debug", required_argument, &longopt_val, 2},
140 {
"gtk-no-debug", required_argument, &longopt_val, 2},
141 {
"gdk-debug", required_argument, &longopt_val, 2},
142 {
"gdk-no-debug", required_argument, &longopt_val, 2},
143 {
"display", required_argument, &longopt_val, 2},
144 {
"sync", no_argument, &longopt_val, 2},
145 {
"no-xshm", no_argument, &longopt_val, 2},
146 {
"name", required_argument, &longopt_val, 2},
147 {
"class", required_argument, &longopt_val, 2},
151 const char *opt_options =
"VadhB:D:O:W:b:f:r:m:l:o:p:t:T:w:x:";
159 gboolean logToFileOption;
160 gchar *logToFileFilename;
164 main_open_project_from_filename(
gerbv_project_t *gerbvProject, gchar *filename)
166 project_list_t *list, *plist;
167 gint i, max_layer_num = -1;
170 dprintf(_(
"Opening project = %s\n"), (gchar *) filename);
174 GERB_MESSAGE(_(
"could not read %s[%d]"), (gchar *) filename,
183 if (plist->layerno > max_layer_num)
184 max_layer_num = plist->layerno;
191 for (i = -1; i <= max_layer_num; i++) {
194 if (plist->layerno != i) {
199 GdkColor colorTemplate = {0,
200 plist->rgb[0], plist->rgb[1], plist->rgb[2]};
207 gchar *fullName = NULL;
208 gchar *dirName = NULL;
211 if (!g_path_is_absolute (plist->filename)) {
213 dirName = g_path_get_dirname (filename);
214 fullName = g_build_filename (dirName,
215 plist->filename, NULL);
217 fullName = g_strdup (plist->filename);
220 if (gerbv_open_image(gerbvProject, fullName,
223 plist->n_attr, TRUE) == -1) {
224 GERB_MESSAGE(_(
"could not read file: %s"),
234 file_info = gerbvProject->
file[fileIndex];
235 file_info->
color = colorTemplate;
236 file_info->
alpha = plist->alpha;
251 project_destroy_project_list(list);
258 gerbvProject->
project = g_strdup(filename);
259 if (gerbvProject->
project == NULL)
260 GERB_FATAL_ERROR(_(
"malloc gerbvProject->project failed"));
265 main_save_project_from_filename(
gerbv_project_t *gerbvProject, gchar *filename)
267 project_list_t *list, *plist;
268 gchar *dirName = g_path_get_dirname (filename);
272 list = g_new0 (project_list_t, 1);
275 list->filename = g_strdup(gerbvProject->
path);
277 list->rgb[1] = gerbvProject->
background.green;
281 for (idx = 0; idx <= gerbvProject->
last_loaded; idx++) {
282 if (gerbvProject->
file[idx]) {
283 plist = g_new0 (project_list_t, 1);
285 plist->layerno = idx;
289 if (strncmp (dirName, gerbvProject->
file[idx]->
fullPathname, strlen(dirName)) == 0) {
291 plist->filename = g_strdup(gerbvProject->
file[idx]->
fullPathname + strlen(dirName) + 1);
297 file_info = gerbvProject->
file[idx];
298 plist->rgb[0] = file_info->
color.red;
299 plist->rgb[1] = file_info->
color.green;
300 plist->rgb[2] = file_info->
color.blue;
301 plist->alpha = file_info->
alpha;
315 if (write_project_file(gerbvProject, gerbvProject->
project, list)) {
316 GERB_MESSAGE(_(
"Failed to write project"));
318 project_destroy_project_list(list);
324 main_save_as_project_from_filename(
gerbv_project_t *gerbvProject, gchar *filename)
334 gerbvProject->
project = g_strdup(filename);
335 if (gerbvProject->
project == NULL)
336 GERB_FATAL_ERROR(_(
"malloc gerbvProject->project failed"));
337 main_save_project_from_filename (gerbvProject, filename);
340 GArray *log_array_tmp = NULL;
345 callbacks_temporary_handle_log_messages(
const gchar *log_domain,
346 GLogLevelFlags log_level,
347 const gchar *message, gpointer user_data) {
348 struct log_struct item;
350 item.domain = g_strdup (log_domain);
351 item.level = log_level;
352 item.message = g_strdup (message);
353 g_array_append_val (log_array_tmp, item);
355 g_log_default_handler (log_domain, log_level, message, user_data);
359 main(
int argc,
char *argv[])
363 int req_width = -1, req_height = -1;
364 #ifdef HAVE_GETOPT_LONG
368 char *project_filename = NULL;
369 gboolean exportFromCommandline = FALSE, userSuppliedOrigin=FALSE, userSuppliedWindow=FALSE,
370 userSuppliedAntiAlias=FALSE, userSuppliedWindowInPixels=FALSE, userSuppliedDpi=FALSE;
371 gint layerctr =0, transformCount = 0, exportType = 0;
372 gdouble initial_rotation = 0.0;
373 gboolean initial_mirror_x = FALSE;
374 gboolean initial_mirror_y = FALSE;
375 gchar *exportFilename = NULL;
376 gfloat userSuppliedOriginX=0.0,userSuppliedOriginY=0.0,userSuppliedDpiX=72.0, userSuppliedDpiY=72.0,
377 userSuppliedWidth=0, userSuppliedHeight=0,
378 userSuppliedBorder = GERBV_DEFAULT_BORDER_COEFF;
381 setlocale(LC_ALL,
"");
382 bindtextdomain(PACKAGE, LOCALEDIR);
384 bind_textdomain_codeset(PACKAGE,
"UTF-8");
393 memset((
void *)&
screen, 0,
sizeof(gerbv_screen_t));
397 mainProject->
execname = g_strdup(argv[0]);
398 mainProject->
execpath = g_path_get_dirname(argv[0]);
408 logToFileOption = FALSE;
409 logToFileFilename = NULL;
414 #ifdef HAVE_GETOPT_LONG
415 (read_opt = getopt_long(argc, argv, opt_options,
416 longopts, &longopt_idx))
418 (read_opt = getopt(argc, argv, opt_options))
423 #ifdef HAVE_GETOPT_LONG
426 switch (longopt_val) {
428 fprintf(stderr, _(
"Not handled option %s\n"), longopts[longopt_idx].name);
432 req_width = (int)strtol(optarg, &rest, 10);
438 fprintf(stderr, _(
"Split X and Y parameters with an x\n"));
443 req_height = (int)strtol(rest, &rest, 10);
473 if (optarg == NULL) {
474 fprintf(stderr, _(
"You must specify the border in the format <alpha>.\n"));
477 if (strlen (optarg) > 10) {
478 fprintf(stderr, _(
"Specified border is not recognized.\n"));
481 sscanf (optarg,
"%f",&userSuppliedBorder);
482 if (userSuppliedBorder < 0) {
483 fprintf(stderr, _(
"Specified border is smaller than zero!\n"));
486 userSuppliedBorder/=100.0;
489 if (optarg == NULL) {
490 fprintf(stderr, _(
"You must give an resolution in the format <DPI_XxDPI_Y> or <DPI_X_and_Y>.\n"));
493 if (strlen (optarg) > 20) {
494 fprintf(stderr, _(
"Specified resolution is not recognized.\n"));
497 if(strchr(optarg,
'x')!=NULL){
498 sscanf (optarg,
"%fx%f",&userSuppliedDpiX,&userSuppliedDpiY);
500 sscanf (optarg,
"%f",&userSuppliedDpiX);
501 userSuppliedDpiY = userSuppliedDpiX;
503 if ((userSuppliedDpiX <= 0) || (userSuppliedDpiY <= 0)) {
504 fprintf(stderr, _(
"Specified resolution should be greater than 0.\n"));
507 userSuppliedDpi=TRUE;
510 if (optarg == NULL) {
511 fprintf(stderr, _(
"You must give an origin in the format <lower_left_X x lower_left_Y>.\n"));
514 if (strlen (optarg) > 20) {
515 fprintf(stderr, _(
"Specified origin is not recognized.\n"));
518 sscanf (optarg,
"%fx%f",&userSuppliedOriginX,&userSuppliedOriginY);
519 userSuppliedOrigin=TRUE;
522 printf(_(
"gerbv version %s\n"), VERSION);
523 printf(_(
"Copyright (C) 2001 -- 2008 by Stefan Petersen\n"
524 "and the respective original authors listed in the source files.\n"));
527 userSuppliedAntiAlias = TRUE;
530 if (optarg == NULL) {
531 fprintf(stderr, _(
"You must give an background color in the hex-format <#RRGGBB>.\n"));
534 if ((strlen (optarg) != 7)||(optarg[0]!=
'#')) {
535 fprintf(stderr, _(
"Specified color format is not recognized.\n"));
539 sscanf (optarg,
"#%2x%2x%2x",&r,&g,&b);
540 if ( (r<0)||(r>255)||(g<0)||(g>255)||(b<0)||(b>255)) {
542 fprintf(stderr, _(
"Specified color values should be between 00 and FF.\n"));
550 if (optarg == NULL) {
551 fprintf(stderr, _(
"You must give an foreground color in the hex-format <#RRGGBB> or <#RRGGBBAA>.\n"));
554 if (((strlen (optarg) != 7)&&(strlen (optarg) != 9))||(optarg[0]!=
'#')) {
555 fprintf(stderr, _(
"Specified color format is not recognized.\n"));
559 if(strlen(optarg)==7){
560 sscanf (optarg,
"#%2x%2x%2x",&r,&g,&b);
564 sscanf (optarg,
"#%2x%2x%2x%2x",&r,&g,&b,&a);
567 if ( (r<0)||(r>255)||(g<0)||(g>255)||(b<0)||(b>255)||(a<0)||(a>255) ) {
569 fprintf(stderr, _(
"Specified color values should be between 0x00 (0) and 0xFF (255).\n"));
572 mainDefaultColors[layerctr].red = r;
573 mainDefaultColors[layerctr].green = g;
574 mainDefaultColors[layerctr].blue = b;
575 mainDefaultColors[layerctr].alpha = a;
578 if (layerctr == NUMBER_OF_DEFAULT_COLORS)
582 if (optarg == NULL) {
583 fprintf(stderr, _(
"You must give the initial rotation angle\n"));
587 initial_rotation = (gdouble)strtod(optarg, &rest);
593 fprintf(stderr, _(
"Failed parsing rotate value\n"));
598 if (optarg == NULL) {
599 fprintf(stderr, _(
"You must give the axis to mirror about\n"));
602 if (strchr(optarg,
'x') != NULL || strchr(optarg,
'X') != NULL) {
603 initial_mirror_x = TRUE;
605 if (strchr(optarg,
'y') != NULL || strchr(optarg,
'Y') != NULL) {
606 initial_mirror_y = TRUE;
608 if (!(initial_mirror_x || initial_mirror_y)) {
609 fprintf(stderr, _(
"Failed parsing mirror axis\n"));
614 if (optarg == NULL) {
615 fprintf(stderr, _(
"You must give a filename to send log to\n"));
618 logToFileOption = TRUE;
619 logToFileFilename = optarg;
622 if (optarg == NULL) {
623 fprintf(stderr, _(
"You must give a filename to export to.\n"));
626 exportFilename = optarg;
629 if (optarg == NULL) {
630 fprintf(stderr, _(
"You must give a project filename\n"));
633 project_filename = optarg;
636 if (optarg == NULL) {
637 fprintf(stderr, _(
"You must give a filename to read the tools from.\n"));
640 if (!gerbv_process_tools_file(optarg)) {
641 fprintf(stderr, _(
"*** ERROR processing tools file \"%s\".\n"), optarg);
642 fprintf(stderr, _(
"Make sure all lines of the file are formatted like this:\n"
643 "T01 0.024\nT02 0.032\nT03 0.040\n...\n"
644 "*** EXITING to prevent erroneous display.\n"));
649 if (optarg == NULL) {
650 fprintf(stderr, _(
"You must give a translation in the format <X,Y>.\n"));
653 if (strlen (optarg) > 30) {
654 fprintf(stderr, _(
"The translation format is not recognized.\n"));
657 float transX=0, transY=0;
659 sscanf (optarg,
"%f,%f",&transX,&transY);
660 mainDefaultTransformations[transformCount].
translateX = transX;
661 mainDefaultTransformations[transformCount].
translateY = transY;
664 if (transformCount == NUMBER_OF_DEFAULT_TRANSFORMATIONS)
668 userSuppliedWindowInPixels = TRUE;
670 if (optarg == NULL) {
671 fprintf(stderr, _(
"You must give a window size in the format <width x height>.\n"));
674 if (strlen (optarg) > 20) {
675 fprintf(stderr, _(
"Specified window size is not recognized.\n"));
678 sscanf (optarg,
"%fx%f", &userSuppliedWidth, &userSuppliedHeight);
679 if (((userSuppliedWidth < 0.001) || (userSuppliedHeight < 0.001)) ||
680 ((userSuppliedWidth > 2000) || (userSuppliedHeight > 2000))) {
681 fprintf(stderr, _(
"Specified window size is out of bounds.\n"));
684 userSuppliedWindow = TRUE;
687 if (optarg == NULL) {
688 fprintf(stderr, _(
"You must supply an export type.\n"));
691 if (strcmp (optarg,
"png") == 0) {
693 exportFromCommandline = TRUE;
695 else if (strcmp (optarg,
"pdf") == 0) {
697 exportFromCommandline = TRUE;
698 }
else if (strcmp (optarg,
"svg") == 0) {
700 exportFromCommandline = TRUE;
701 }
else if (strcmp (optarg,
"ps") == 0) {
703 exportFromCommandline = TRUE;
705 else if (strcmp (optarg,
"rs274x") == 0) {
707 exportFromCommandline = TRUE;
709 else if (strcmp (optarg,
"drill") == 0) {
711 exportFromCommandline = TRUE;
714 fprintf(stderr, _(
"Unrecognized export type.\n"));
719 screen.dump_parsed_image = 1;
723 #ifdef HAVE_GETOPT_LONG
724 printf(_(
"Usage: gerbv [OPTIONS...] [FILE...]\n\n"
725 "Available options:\n"
726 " -B, --border=<b> Border around the image in percent of the\n"
727 " width/height. Defaults to %d%%.\n"
728 " -D, --dpi=<XxY>or<R> Resolution (Dots per inch) for the output\n"
729 " bitmap. With the format <XxY>, different\n"
730 " resolutions for X- and Y-direction are used.\n"
731 " With the format <R>, both are the same.\n"
732 " -O, --origin=<XxY> Use the specified coordinates (in inches).\n"
733 " for the lower left corner.\n"
734 " -V, --version Print version of gerbv.\n"
735 " -a, --antialias Use antialiasing for generated bitmap output.\n"
736 " -b, --background=<hex> Use background color <hex> (like #RRGGBB).\n"
737 " -f, --foreground=<hex> Use foreground color <hex> (like #RRGGBB or\n"
738 " #RRGGBBAA for setting the alpha).\n"
739 " Use multiple -f flags to set the color for\n"
740 " multiple layers.\n"
741 " -r, --rotate=<degree> Set initial orientation for all layers.\n"
742 " -m, --mirror=<axis> Set initial mirroring axis (X or Y).\n"
743 " -h, --help Print this help message.\n"
744 " -l, --log=<logfile> Send error messages to <logfile>.\n"
745 " -o, --output=<filename> Export to <filename>.\n"
746 " -p, --project=<prjfile> Load project file <prjfile>.\n"
747 " -W, --window_inch=<WxH> Window size in inches <WxH> for the\n"
749 " -w, --window=<WxH> Window size in pixels <WxH> for the\n"
750 " exported image. Autoscales to fit\n"
751 " if no resolution is specified. If a\n"
752 " resolution is specified, it will clip.\n"
753 " -t, --tools=<toolfile> Read Excellon tools from file <toolfile>.\n"
754 " -T, --translate=<X,Y> Translate the image by <X,Y> (useful for\n"
755 " arranging panels). Use multiple -T flags\n"
756 " for multiple layers.\n"
757 " -x, --export=<png/pdf/ps/svg/ Export a rendered picture to a file with\n"
758 " rs274x/drill> the specified format.\n"),
759 (
int)(GERBV_DEFAULT_BORDER_COEFF * 100));
761 printf(_(
"Usage: gerbv [OPTIONS...] [FILE...]\n\n"
762 "Available options:\n"
763 " -B<b> Border around the image in percent of the\n"
764 " width/height. Defaults to %d%%.\n"
765 " -D<XxY>or<R> Resolution (Dots per inch) for the output\n"
766 " bitmap. With the format <XxY>, different\n"
767 " resolutions for X- and Y-direction are used.\n"
768 " With the format <R>, both are the same.\n"
769 " -O<XxY> Use the specified coordinates (in inches)\n"
770 " for the lower left corner.\n"
771 " -V Print version of gerbv.\n"
772 " -a Use antialiasing for generated bitmap output.\n"
773 " -b<hexcolor> Use background color <hexcolor> (like #RRGGBB).\n"
774 " -f<hexcolor> Use foreground color <hexcolor> (like #RRGGBB or\n"
775 " #RRGGBBAA for setting the alpha).\n"
776 " Use multiple -f flags to set the color for\n"
777 " multiple layers.\n"
778 " -r<degree> Set initial orientation for all layers.\n"
779 " -m<axis> Set initial mirroring axis (X or Y).\n"
780 " -h Print this help message.\n"
781 " -l<logfile> Send error messages to <logfile>.\n"
782 " -o<filename> Export to <filename>.\n"
783 " -p<prjfile> Load project file <prjfile>.\n"
784 " -W<WxH> Window size in inches <WxH> for the\n"
786 " -w<WxH> Window size in pixels <WxH> for the\n"
787 " exported image. Autoscales to fit\n"
788 " if no resolution is specified. If a\n"
789 " resolution is specified, it will clip.\n"
791 " -t<toolfile> Read Excellon tools from file <toolfile>\n"
792 " -T<X,Y> Translate the image by <X,Y> (useful for\n"
793 " arranging panels). Use multiple -T flags\n"
794 " for multiple layers.\n"
795 " -x <png/pdf/ps/svg/ Export a rendered picture to a file with\n"
796 " rs274x/drill> the specified format.\n"),
797 (
int)(GERBV_DEFAULT_BORDER_COEFF * 100));
803 printf(_(
"Not handled option [%d=%c]\n"), read_opt, read_opt);
814 log_array_tmp = g_array_new (TRUE, FALSE,
sizeof (
struct log_struct));
815 g_log_set_handler (NULL,
816 G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION | G_LOG_LEVEL_MASK,
817 callbacks_temporary_handle_log_messages, NULL);
818 if (project_filename) {
819 printf(_(
"Loading project %s...\n"), project_filename);
822 g_free (mainProject->
path);
823 if (!g_path_is_absolute(project_filename)) {
824 gchar *fullName = g_build_filename (g_get_current_dir (),
825 project_filename, NULL);
826 main_open_project_from_filename (mainProject, fullName);
827 mainProject->
path = g_path_get_dirname (fullName);
830 main_open_project_from_filename (mainProject, project_filename);
831 mainProject->
path = g_path_get_dirname (project_filename);
834 gint loadedIndex = 0;
835 for(i = optind ; i < argc; i++) {
836 g_free (mainProject->
path);
837 if (!g_path_is_absolute(argv[i])) {
838 gchar *fullName = g_build_filename (g_get_current_dir (),
841 mainDefaultColors[loadedIndex % NUMBER_OF_DEFAULT_COLORS].red*257,
842 mainDefaultColors[loadedIndex % NUMBER_OF_DEFAULT_COLORS].green*257,
843 mainDefaultColors[loadedIndex % NUMBER_OF_DEFAULT_COLORS].blue*257,
844 mainDefaultColors[loadedIndex % NUMBER_OF_DEFAULT_COLORS].alpha*257);
845 mainProject->
path = g_path_get_dirname (fullName);
849 mainDefaultColors[loadedIndex % NUMBER_OF_DEFAULT_COLORS].red*257,
850 mainDefaultColors[loadedIndex % NUMBER_OF_DEFAULT_COLORS].green*257,
851 mainDefaultColors[loadedIndex % NUMBER_OF_DEFAULT_COLORS].blue*257,
852 mainDefaultColors[loadedIndex % NUMBER_OF_DEFAULT_COLORS].alpha*257);
853 mainProject->
path = g_path_get_dirname (argv[i]);
859 if (initial_rotation != 0.0) {
862 gdouble initial_radians = M_PI*initial_rotation/180;
864 dprintf(
"Rotating all layers by %.0f degrees\n", (
float) initial_rotation);
865 for(i = 0; i < mainProject->
max_files; i++) {
866 if (mainProject->
file[i])
871 if (initial_mirror_x || initial_mirror_y) {
874 if (initial_mirror_x) {
875 dprintf(
"Mirroring all layers about x axis\n");
877 if (initial_mirror_y) {
878 dprintf(
"Mirroring all layers about y axis\n");
881 for (i = 0; i < mainProject->
max_files; i++) {
882 if (mainProject->
file[i]) {
889 screen.unit = GERBV_DEFAULT_UNIT;
890 if (exportFromCommandline) {
893 gboolean freeFilename = FALSE;
895 if (!exportFilename) {
896 if (exportType == 1) {
897 exportFilename = g_strdup (
"output.png");
898 }
else if (exportType == 2) {
899 exportFilename = g_strdup (
"output.pdf");
900 }
else if (exportType == 3) {
901 exportFilename = g_strdup (
"output.svg");
902 }
else if (exportType == 4){
903 exportFilename = g_strdup (
"output.ps");
904 }
else if (exportType == 5){
905 exportFilename = g_strdup (
"output.gbx");
907 exportFilename = g_strdup (
"output.cnc");
913 gerbv_render_get_boundingbox(mainProject, &bb);
915 if(!userSuppliedOrigin){
916 userSuppliedOriginX = bb.
left;
917 userSuppliedOriginY = bb.
top;
920 float width = bb.
right - userSuppliedOriginX + 0.001;
921 float height = bb.
bottom - userSuppliedOriginY + 0.001;
923 if(!userSuppliedWindow){
924 userSuppliedWidth = width;
925 userSuppliedHeight = height;
928 if( (!userSuppliedDpi)&& userSuppliedWindowInPixels){
929 userSuppliedDpiX = MIN(((userSuppliedWidth-0.5) / width),((userSuppliedHeight-0.5) / height));
930 userSuppliedDpiY = userSuppliedDpiX;
931 userSuppliedOriginX -= 0.5/userSuppliedDpiX;
932 userSuppliedOriginY -= 0.5/userSuppliedDpiY;
937 if(userSuppliedBorder!=0){
939 if(!userSuppliedWindowInPixels){
940 userSuppliedOriginX -= (userSuppliedWidth*userSuppliedBorder)/2.0;
941 userSuppliedOriginY -= (userSuppliedHeight*userSuppliedBorder)/2.0;
942 userSuppliedWidth += userSuppliedWidth*userSuppliedBorder;
943 userSuppliedHeight += userSuppliedHeight*userSuppliedBorder;
947 userSuppliedOriginX -= ((userSuppliedWidth/userSuppliedDpiX)*userSuppliedBorder)/2.0;
948 userSuppliedOriginY -= ((userSuppliedHeight/userSuppliedDpiX)*userSuppliedBorder)/2.0;
949 userSuppliedDpiX -= (userSuppliedDpiX*userSuppliedBorder);
950 userSuppliedDpiY -= (userSuppliedDpiY*userSuppliedBorder);
954 if(!userSuppliedWindowInPixels){
955 userSuppliedWidth *= userSuppliedDpiX;
956 userSuppliedHeight *= userSuppliedDpiY;
961 if(userSuppliedWidth <=0)
962 userSuppliedWidth = 1;
963 if(userSuppliedHeight <=0)
964 userSuppliedHeight = 1;
968 userSuppliedOriginX, userSuppliedOriginY,
970 userSuppliedWidth,userSuppliedHeight };
972 if (exportType == 1) {
974 }
else if (exportType == 2) {
976 }
else if (exportType == 3) {
978 }
else if (exportType == 4) {
980 }
else if (exportType == 5) {
986 if (mainProject->
file[i]) {
995 fprintf(stderr, _(
"A valid file was not loaded.\n"));
998 }
else if (exportType == 6) {
1004 if (mainProject->
file[i]) {
1013 fprintf(stderr, _(
"A valid file was not loaded.\n"));
1019 free (exportFilename);
1023 gtk_init (&argc, &argv);
1024 interface_create_gui (req_width, req_height);
1027 render_free_screen_resources();