~valavanisalex/ubuntu/precise/inkscape/fix-943984

« back to all changes in this revision

Viewing changes to src/main.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Bryce Harrington
  • Date: 2009-07-02 17:09:45 UTC
  • mfrom: (1.1.9 upstream)
  • Revision ID: james.westby@ubuntu.com-20090702170945-nn6d6zswovbwju1t
Tags: 0.47~pre1-0ubuntu1
* New upstream release.
  - Don't constrain maximization on small resolution devices (pre0)
    (LP: #348842)
  - Fixes segfault on startup (pre0)
    (LP: #391149)

Show diffs side-by-side

added added

removed removed

Lines of Context:
469
469
static Glib::ustring _win32_getExePath()
470
470
{
471
471
    char exeName[MAX_PATH+1];
 
472
    // TODO these should use xxxW() calls explicitly and convert UTF-16 <--> UTF-8
472
473
    GetModuleFileName(NULL, exeName, MAX_PATH);
473
474
    char *slashPos = strrchr(exeName, '\\');
474
 
    if (slashPos)
 
475
    if (slashPos) {
475
476
        *slashPos = '\0';
 
477
    }
476
478
    Glib::ustring s = exeName;
477
479
    return s;
478
480
}
483
485
 */
484
486
static int _win32_set_inkscape_env(const Glib::ustring &exePath)
485
487
{
 
488
    // TODO use g_getenv() and g_setenv() that use filename encoding, which is UTF-8 on Windows
486
489
 
487
490
    char *oldenv = getenv("PATH");
488
491
    Glib::ustring tmp = "PATH=";
531
534
        tmp += oldenv;
532
535
    }
533
536
    g_setenv("PYTHONPATH", tmp.c_str(), TRUE);
534
 
    
 
537
 
535
538
    return 0;
536
539
}
537
540
 
559
562
      HKCR\svgfile\shell\open\command is a good example
560
563
    */
561
564
    Glib::ustring homedir = _win32_getExePath();
 
565
    // TODO these should use xxxW() calls explicitly and convert UTF-16 <--> UTF-8
562
566
    SetCurrentDirectory(homedir.c_str());
563
567
    _win32_set_inkscape_env(homedir);
564
568
    RegistryTool rt;
610
614
    gboolean use_gui;
611
615
 
612
616
#ifndef WIN32
 
617
    // TODO use g_getenv() and g_setenv() that use filename encoding, which is UTF-8 on Windows
613
618
    use_gui = (getenv("DISPLAY") != NULL);
614
619
#else
615
620
    use_gui = TRUE;
1452
1457
    if (sp_export_area_canvas) {
1453
1458
        if (sp_export_eps) {
1454
1459
            g_warning ("EPS cannot have its bounding box extend beyond its content, so if your drawing is smaller than the canvas, --export-area-canvas will clip it to drawing.");
1455
 
        } 
 
1460
        }
1456
1461
        (*i)->set_param_bool ("areaCanvas", TRUE);
1457
1462
    } else {
1458
1463
        (*i)->set_param_bool ("areaCanvas", FALSE);
1459
1464
    }
1460
1465
 
1461
 
    if (!sp_export_area_drawing && !sp_export_area_canvas && !sp_export_id) { 
 
1466
    if (!sp_export_area_drawing && !sp_export_area_canvas && !sp_export_id) {
1462
1467
        // neither is set, set canvas as default for ps/pdf and drawing for eps
1463
1468
        if (sp_export_eps) {
1464
1469
            try {
1465
1470
               (*i)->set_param_bool("areaDrawing", TRUE);
1466
1471
            } catch (...) {}
1467
 
        } 
 
1472
        }
1468
1473
    }
1469
1474
 
1470
1475
    if (sp_export_text_to_path) {