Kaydet (Commit) fb3f8909 authored tarafından Enrico Tröger's avatar Enrico Tröger

Remove old code.

Pass and use also parent and title arguments to win32_show_document_open_dialog().

git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@4914 ea778897-0a13-0410-b9d1-a72fbfd435f5
üst 1e9b5cf9
......@@ -3,6 +3,10 @@
* src/win32.c:
Sort file filters for the native Windows file open dialog by name.
Don't use file filters for the native Windows Save As dialog.
* src/dialogs.c, src/win32.c, src/win32.h:
Remove old code.
Pass and use also parent and title arguments to
win32_show_document_open_dialog().
2010-05-15 Frank Lanitz <frank(at)frank(dot)uvena(dot)de>
......
......@@ -339,19 +339,23 @@ gchar *win32_show_project_open_dialog(GtkWidget *parent, const gchar *title,
/* initial_dir can be NULL to use the current working directory.
* Returns: TRUE if the dialog was not cancelled. */
gboolean win32_show_document_open_dialog(gboolean file_open, const gchar *initial_dir)
gboolean win32_show_document_open_dialog(GtkWindow *parent, const gchar *title, const gchar *initial_dir)
{
OPENFILENAMEW of;
gint retval;
guint x;
gchar tmp[MAX_PATH];
wchar_t fname[MAX_PATH];
wchar_t w_dir[MAX_PATH];
wchar_t w_title[512];
fname[0] = '\0';
if (initial_dir != NULL)
MultiByteToWideChar(CP_UTF8, 0, initial_dir, -1, w_dir, sizeof(w_dir));
MultiByteToWideChar(CP_UTF8, 0, title, -1, w_title, sizeof(w_title));
/* initialise file dialog info struct */
memset(&of, 0, sizeof of);
#ifdef OPENFILENAME_SIZE_VERSION_400
......@@ -359,7 +363,7 @@ gboolean win32_show_document_open_dialog(gboolean file_open, const gchar *initia
#else
of.lStructSize = sizeof of;
#endif
of.hwndOwner = GDK_WINDOW_HWND(main_widgets.window->window);
of.hwndOwner = GDK_WINDOW_HWND(GTK_WIDGET(parent)->window);
of.lpstrFilter = get_file_filters();
of.lpstrCustomFilter = NULL;
......@@ -368,18 +372,11 @@ gboolean win32_show_document_open_dialog(gboolean file_open, const gchar *initia
of.lpstrInitialDir = (initial_dir != NULL) ? w_dir : NULL;
of.nMaxFile = 2048;
of.lpstrFileTitle = NULL;
of.lpstrTitle = NULL;
of.lpstrTitle = w_title;
of.lpstrDefExt = L"";
if (file_open)
{
of.Flags = OFN_ALLOWMULTISELECT | OFN_FILEMUSTEXIST | OFN_EXPLORER;
retval = GetOpenFileNameW(&of);
}
else
{
of.Flags = OFN_OVERWRITEPROMPT | OFN_PATHMUSTEXIST;
retval = GetSaveFileNameW(&of);
}
if (!retval)
{
......@@ -392,10 +389,6 @@ gboolean win32_show_document_open_dialog(gboolean file_open, const gchar *initia
return FALSE;
}
if (file_open)
{
guint x;
x = of.nFileOffset - 1;
if (x != wcslen(fname))
{ /* open a single file */
......@@ -426,14 +419,6 @@ gboolean win32_show_document_open_dialog(gboolean file_open, const gchar *initia
x++;
}
}
}
else
{
GeanyDocument *doc = document_get_current();
WideCharToMultiByte(CP_UTF8, 0, fname, -1, tmp, sizeof(tmp), NULL, NULL);
document_save_file_as(doc, tmp);
}
return (retval != 0);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment