index 354d673bc3964106800deea73be3d3a2264e1c13..ed257a49a68f23ee7143ee23d4712afcbc5376a4 100644 (file)
#include <display/nr-arena-item.h>
#include <display/nr-arena.h>
#include "sp-item.h"
-#include "canvas-arena.h"
+#include "display/canvas-arena.h"
#include "filedialog.h"
#include "filedialogimpl-win32.h"
_filter_count = 0;
_title = (wchar_t*)g_utf8_to_utf16(title, -1, NULL, NULL, NULL);
+ g_assert(_title != NULL);
Glib::RefPtr<const Gdk::Window> parentWindow = parent.get_window();
g_assert(parentWindow->gobj() != NULL);
_preview_document_height = 0;
_preview_image_width = 0;
_preview_image_height = 0;
+
+ _mutex = NULL;
createFilterMenu();
}
if (imod->deactivated()) continue;
// Type
- filter.name = g_utf8_to_utf16(imod->get_filetypename(),
+ filter.name = g_utf8_to_utf16(_(imod->get_filetypename()),
-1, NULL, &filter.name_length, NULL);
// Extension
_extension_map = new Inkscape::Extension::Extension*[filter_count];
// Filter Image Files
- all_image_files.name = g_utf8_to_utf16(_(all_image_files_filter_name),
+ all_image_files.name = g_utf8_to_utf16(all_image_files_filter_name,
-1, NULL, &all_image_files.name_length, NULL);
all_image_files.filter = g_utf8_to_utf16(all_image_files_filter.data(),
-1, NULL, &all_image_files.filter_length, NULL);
+ all_image_files.mod = NULL;
filter_list.push_front(all_image_files);
- _extension_map[extension_index++] = NULL;
// Filter Inkscape Files
- all_inkscape_files.name = g_utf8_to_utf16(_(all_inkscape_files_filter_name),
+ all_inkscape_files.name = g_utf8_to_utf16(all_inkscape_files_filter_name,
-1, NULL, &all_inkscape_files.name_length, NULL);
all_inkscape_files.filter = g_utf8_to_utf16(all_inkscape_files_filter.data(),
-1, NULL, &all_inkscape_files.filter_length, NULL);
+ all_inkscape_files.mod = NULL;
filter_list.push_front(all_inkscape_files);
- _extension_map[extension_index++] = NULL;
// Filter All Files
- all_files.name = g_utf8_to_utf16(_(all_files_filter_name),
+ all_files.name = g_utf8_to_utf16(all_files_filter_name,
-1, NULL, &all_files.name_length, NULL);
all_files.filter = NULL;
all_files.filter_length = 0;
+ all_files.mod = NULL;
filter_list.push_front(all_files);
- _extension_map[extension_index++] = NULL;
filter_length += all_files.name_length + 3 +
all_inkscape_files.filter_length +
all_image_files.filter_length +
all_image_files.name_length + 3 + 1;
// Add 3 for 2*2 \0s and a *, and 1 for a trailing \0
-
-
- _filter = new wchar_t[filter_length];
+
+ _filter = new wchar_t[filter_length];
wchar_t *filterptr = _filter;
-
+
for(list<Filter>::iterator filter_iterator = filter_list.begin();
filter_iterator != filter_list.end(); filter_iterator++)
{
const Filter &filter = *filter_iterator;
- memcpy(filterptr, filter.name, filter.name_length * 2);
+ wcsncpy(filterptr, (wchar_t*)filter.name, filter.name_length);
filterptr += filter.name_length;
g_free(filter.name);
if(filter.filter != NULL)
{
- memcpy(filterptr, filter.filter, filter.filter_length * 2);
+ wcsncpy(filterptr, (wchar_t*)filter.filter, filter.filter_length);
filterptr += filter.filter_length;
g_free(filter.filter);
}
_extension_map[extension_index++] = filter.mod;
}
*(filterptr++) = L'\0';
-
+
_filter_count = extension_index;
- _filter_index = 2; // Select the 2nd filter in the list - NOT the 3rd
+ _filter_index = 2; // Select the 2nd filter in the list - 2 is NOT the 3rd
}
void FileOpenDialogImplWin32::GetOpenFileName_thread()
OPENFILENAMEEXW ofn;
g_assert(this != NULL);
+ g_assert(_mutex != NULL);
WCHAR* current_directory_string = (WCHAR*)g_utf8_to_utf16(
- _current_directory.data(), -1, NULL, NULL, NULL);
+ _current_directory.data(), _current_directory.length(),
+ NULL, NULL, NULL);
memset(&ofn, 0, sizeof(ofn));
_filter_index = ofn.nFilterIndex;
_extension = _extension_map[ofn.nFilterIndex - 1];
- myFilename = utf16_to_ustring(_path_string, _MAX_PATH);
-
// Copy the selected file name, converting from UTF-16 to UTF-8
myFilename = utf16_to_ustring(_path_string, _MAX_PATH);
pImpl->_file_dialog_wnd = hParentWnd;
pImpl->_preview_wnd =
- CreateWindow(PreviewWindowClassName, "",
+ CreateWindowA(PreviewWindowClassName, "",
WS_CHILD | WS_VISIBLE,
0, 0, 100, 100, hParentWnd, NULL, hInstance, NULL);
SetWindowLongPtr(pImpl->_preview_wnd, GWLP_USERDATA, ofn->lCustData);
pImpl->_file_selected = true;
pImpl->_mutex->unlock();
-
- //pImpl->file_selected();
}
}
break;
@@ -558,7 +558,6 @@ LRESULT CALLBACK FileOpenDialogImplWin32::preview_wnd_proc(HWND hwnd, UINT uMsg,
pImpl->_mutex->lock();
- //FillRect(dc, &client_rect, (HBRUSH)(COLOR_HOTLIGHT+1));
if(pImpl->_path_string[0] == 0)
{
FillRect(dc, &rcClient, (HBRUSH)(COLOR_3DFACE + 1));
arena, key, SP_ITEM_SHOW_DISPLAY);
NRGC gc(NULL);
- nr_matrix_set_scale(&gc.transform, scaleFactor, scaleFactor);
+ gc.transform = NR::Matrix(NR::scale(scaleFactor, scaleFactor));
nr_arena_item_invoke_update (root, NULL, &gc,
NR_ARENA_ITEM_STATE_ALL, NR_ARENA_ITEM_STATE_NONE);
Inkscape::Extension::db.get_output_list(extension_list);
int filter_count = 0;
- int filter_length = 0;
+ int filter_length = 1;
for (Inkscape::Extension::DB::OutputList::iterator current_item = extension_list.begin();
current_item != extension_list.end(); current_item++)
// Type
filter.name = g_utf8_to_utf16(
- omod->get_filetypename(), -1, NULL, &filter.name_length, NULL);
+ _(omod->get_filetypename()), -1, NULL, &filter.name_length, NULL);
filter.mod = omod;
{
const Filter &filter = *filter_iterator;
- memcpy(filterptr, filter.name, filter.name_length * 2);
+ wcsncpy(filterptr, (wchar_t*)filter.name, filter.name_length);
filterptr += filter.name_length;
g_free(filter.name);
*(filterptr++) = L'\0';
*(filterptr++) = L'*';
- memcpy(filterptr, filter.filter, filter.filter_length * 2);
+ wcsncpy(filterptr, (wchar_t*)filter.filter, filter.filter_length);
filterptr += filter.filter_length;
g_free(filter.filter);
g_assert(this != NULL);
g_assert(_main_loop != NULL);
- gunichar2* current_directory_string = g_utf8_to_utf16(
- _current_directory.data(), -1, NULL, NULL, NULL);
+ WCHAR* current_directory_string = (WCHAR*)g_utf8_to_utf16(
+ _current_directory.data(), _current_directory.length(),
+ NULL, NULL, NULL);
// Copy the selected file name, converting from UTF-8 to UTF-16
memset(_path_string, 0, sizeof(_path_string));
ofn.nFilterIndex = _filter_index;
ofn.lpstrFileTitle = NULL;
ofn.nMaxFileTitle = 0;
- ofn.lpstrInitialDir = (wchar_t*)current_directory_string;
+ ofn.lpstrInitialDir = current_directory_string;
ofn.lpstrTitle = _title;
ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;
ofn.lpstrFilter = _filter;
_result = false;
_main_loop = g_main_loop_new(g_main_context_default(), FALSE);
-
- if(Glib::Thread::create(sigc::mem_fun(*this, &FileSaveDialogImplWin32::GetSaveFileName_thread), true))
- g_main_loop_run(_main_loop);
-
- if(_result)
- appendExtension(myFilename, (Inkscape::Extension::Output*)_extension);
-
+
+ if(_main_loop != NULL)
+ {
+ if(Glib::Thread::create(sigc::mem_fun(*this, &FileSaveDialogImplWin32::GetSaveFileName_thread), true))
+ g_main_loop_run(_main_loop);
+
+ if(_result)
+ appendExtension(myFilename, (Inkscape::Extension::Output*)_extension);
+ }
+
return _result;
}