~ubuntu-branches/ubuntu/wily/geany/wily

« back to all changes in this revision

Viewing changes to src/win32.c

  • Committer: Package Import Robot
  • Author(s): Chow Loong Jin
  • Date: 2011-12-10 07:43:26 UTC
  • mfrom: (3.3.7 sid)
  • Revision ID: package-import@ubuntu.com-20111210074326-s8yqbew5i20h33tf
Tags: 0.21-1ubuntu1
* Merge from Debian Unstable, remaining changes:
  - debian/patches/20_use_evince_viewer.patch:
     + use evince as viewer for pdf and dvi files
  - debian/patches/20_use_x_terminal_emulator.patch:
     + use x-terminal-emulator as terminal
  - debian/control
     + Add breaks on geany-plugins-common << 0.20
* Also fixes bugs:
  - Filter for MATLAB/Octave files filters everythign (LP: 885505)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
2
 *      win32.c - this file is part of Geany, a fast and lightweight IDE
3
3
 *
4
 
 *      Copyright 2005-2010 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
5
 
 *      Copyright 2006-2010 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
 
4
 *      Copyright 2005-2011 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
 
5
 *      Copyright 2006-2011 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
6
6
 *
7
7
 *      This program is free software; you can redistribute it and/or modify
8
8
 *      it under the terms of the GNU General Public License as published by
18
18
 *      along with this program; if not, write to the Free Software
19
19
 *      Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20
20
 *
21
 
 *  $Id: win32.c 4914 2010-05-15 11:57:40Z eht16 $
 
21
 *  $Id: win32.c 5946 2011-09-22 15:53:14Z ntrel $
22
22
 */
23
23
 
24
24
/*
121
121
 
122
122
        /* replace all "\t"s by \0 */
123
123
        len = strlen(string);
124
 
        for (i = 0; i < len; i++)
125
 
        {
126
 
                if (string[i] == '\t')
127
 
                        string[i] = '\0';
128
 
        }
 
124
        g_strdelimit(string, "\t", '\0');
 
125
        g_assert(string[len - 1] == 0x0);
129
126
        MultiByteToWideChar(CP_UTF8, 0, string, len, title, sizeof(title));
130
127
        g_free(string);
131
128
 
140
137
        gchar *filter;
141
138
 
142
139
        /* create meta file filter "All files" */
143
 
        filter = g_strdup_printf("%s\0*\0", _("All files"));
 
140
        filter = g_strdup_printf("%s\t*\t", _("All files"));
144
141
 
145
 
        len = strlen(_("All files")) + 3;
 
142
        len = strlen(filter);
 
143
        g_strdelimit(filter, "\t", '\0');
 
144
        g_assert(filter[len - 1] == 0x0);
146
145
        MultiByteToWideChar(CP_UTF8, 0, filter, len, title, sizeof(title));
147
146
        g_free(filter);
148
147
 
153
152
static wchar_t *get_filters(gboolean project_files)
154
153
{
155
154
        gchar *string;
156
 
        gint i, len;
 
155
        gint len;
157
156
        static wchar_t title[1024];
158
157
 
159
158
        if (project_files)
171
170
 
172
171
        /* replace all "\t"s by \0 */
173
172
        len = strlen(string);
174
 
        for (i = 0; i < len; i++)
175
 
        {
176
 
                if (string[i] == '\t') string[i] = '\0';
177
 
        }
 
173
        g_strdelimit(string, "\t", '\0');
 
174
        g_assert(string[len - 1] == 0x0);
178
175
        MultiByteToWideChar(CP_UTF8, 0, string, len, title, sizeof(title));
179
176
        g_free(string);
180
177
 
431
428
        gchar tmp[MAX_PATH];
432
429
        wchar_t w_file[MAX_PATH];
433
430
        wchar_t w_title[512];
434
 
        guint x;
435
431
 
436
432
        w_file[0] = '\0';
437
433
 
488
484
        gchar tmp[MAX_PATH];
489
485
        wchar_t w_file[MAX_PATH];
490
486
        wchar_t w_title[512];
491
 
        guint x;
492
487
 
493
488
        w_file[0] = '\0';
494
489
 
538
533
        CHOOSEFONT cf;
539
534
        LOGFONT lf;        /* logical font structure */
540
535
 
 
536
        memset(&lf, 0, sizeof lf);
 
537
        /* TODO: init lf members */
 
538
        
541
539
        memset(&cf, 0, sizeof cf);
542
540
        cf.lStructSize = sizeof cf;
543
541
        cf.hwndOwner = GDK_WINDOW_HWND(main_widgets.window->window);
544
542
        cf.lpLogFont = &lf;
545
 
        cf.Flags = CF_APPLY | CF_NOSCRIPTSEL | CF_FORCEFONTEXIST | CF_INITTOLOGFONTSTRUCT | CF_SCREENFONTS;
 
543
        /* support CF_APPLY? */
 
544
        cf.Flags = CF_NOSCRIPTSEL | CF_FORCEFONTEXIST | CF_INITTOLOGFONTSTRUCT | CF_SCREENFONTS;
546
545
 
547
546
        retval = ChooseFont(&cf);
548
547
 
1332
1331
 
1333
1332
gchar *win32_get_installation_dir(void)
1334
1333
{
1335
 
#if GLIB_CHECK_VERSION(2, 16, 0)
1336
1334
        return g_win32_get_package_installation_directory_of_module(NULL);
1337
 
#else
1338
 
        return g_win32_get_package_installation_directory(NULL, NULL);
1339
 
#endif
1340
1335
}
1341
1336
 
1342
1337