Ejemplo n.º 1
0
void OpenUserDataRec::EventProcCBCustomize(NavCBRecPtr ioParams)
{
    wxWindow* control = m_dialog->GetExtraControl();

    if ( control )
    {
        SInt16 neededRight, neededBottom;

        wxSize size = m_dialog->GetExtraControl()->GetSize();
        neededRight = ioParams->customRect.left + size.x;
        neededBottom = ioParams->customRect.top + size.y;

        if (ioParams->customRect.right == 0 && ioParams->customRect.bottom == 0)
        {
            ioParams->customRect.right = neededRight;
            ioParams->customRect.bottom = neededBottom;
        }
        else
        {
            if ( ioParams->customRect.right != m_lastRight )
            {
                if ( ioParams->customRect.right < neededRight )
                    ioParams->customRect.right = neededRight;
            }
            if ( ioParams->customRect.bottom != m_lastBottom )
            {
                if ( ioParams->customRect.bottom < neededBottom )
                    ioParams->customRect.bottom = neededBottom;
            }
        }
        m_lastRight = ioParams->customRect.right;
        m_lastBottom = ioParams->customRect.bottom;
    }
}
Ejemplo n.º 2
0
void OpenUserDataRec::EventProcCBStart(NavCBRecPtr ioParams)
{
    if (!m_defaultLocation.empty())
    {
        // Set default location for the modern Navigation APIs
        // Apple Technical Q&A 1151
        FSRef theFile;
        wxMacPathToFSRef(m_defaultLocation, &theFile);
        AEDesc theLocation = { typeNull, NULL };
        if (noErr == ::AECreateDesc(typeFSRef, &theFile, sizeof(FSRef), &theLocation))
            ::NavCustomControl(ioParams->context, kNavCtlSetLocation, (void *) &theLocation);
    }

    if( m_extensions.GetCount() > 0 )
    {
        NavMenuItemSpec  menuItem;
        memset( &menuItem, 0, sizeof(menuItem) );
        menuItem.version = kNavMenuItemSpecVersion;
        menuItem.menuType = m_currentfilter;
        ::NavCustomControl(ioParams->context, kNavCtlSelectCustomType, &menuItem);
    }

    if (m_dialog->GetExtraControl())
    {
        m_controlAdded = true;
        ControlRef ref = m_dialog->GetExtraControl()->GetPeer()->GetControlRef();
        NavCustomControl(ioParams->context, kNavCtlAddControl, ref);
    }

}
Ejemplo n.º 3
0
void DialogAttachments::AttachFile(wxFileDialog &diag, AssEntryGroup group, wxString const& commit_msg) {
	if (diag.ShowModal() == wxID_CANCEL) return;

	wxArrayString filenames;
	diag.GetFilenames(filenames);

	wxArrayString paths;
	diag.GetPaths(paths);

	// Create attachments
	for (size_t i = 0; i < filenames.size(); ++i) {
		AssAttachment *newAttach = new AssAttachment(filenames[i], group);
		try {
			newAttach->Import(paths[i]);
		}
		catch (...) {
			delete newAttach;
			return;
		}
		ass->InsertLine(newAttach);
	}

	ass->Commit(commit_msg, AssFile::COMMIT_ATTACHMENT);

	UpdateList();
}
Ejemplo n.º 4
0
void DialogsProvider::OnOpenFileGeneric( wxCommandEvent& event )
{
    intf_dialog_args_t *p_arg = (intf_dialog_args_t *)event.GetClientData();

    if( p_arg == NULL )
    {
        msg_Dbg( p_intf, "OnOpenFileGeneric() called with NULL arg" );
        return;
    }

    if( p_file_generic_dialog == NULL )
        p_file_generic_dialog = new wxFileDialog( NULL );

    if( p_file_generic_dialog )
    {
        p_file_generic_dialog->SetMessage( wxU(p_arg->psz_title) );
        p_file_generic_dialog->SetWildcard( wxU(p_arg->psz_extensions) );
        p_file_generic_dialog->SetStyle( (p_arg->b_save ? wxSAVE : wxOPEN) |
                                         (p_arg->b_multiple ? wxMULTIPLE:0) );
    }

    if( p_file_generic_dialog &&
        p_file_generic_dialog->ShowModal() == wxID_OK )
    {
        wxArrayString paths;

        p_file_generic_dialog->GetPaths( paths );

        p_arg->i_results = paths.GetCount();
        p_arg->psz_results = (char **)malloc( p_arg->i_results *
                                              sizeof(char *) );
        for( size_t i = 0; i < paths.GetCount(); i++ )
        {
            p_arg->psz_results[i] = strdup( paths[i].mb_str(wxConvUTF8) );
        }
    }

    /* Callback */
    if( p_arg->pf_callback )
    {
        p_arg->pf_callback( p_arg );
    }

    if( p_arg->psz_results )
    {
        for( int i = 0; i < p_arg->i_results; i++ )
        {
            free( p_arg->psz_results[i] );
        }
        free( p_arg->psz_results );
    }
    if( p_arg->psz_title ) free( p_arg->psz_title );
    if( p_arg->psz_extensions ) free( p_arg->psz_extensions );

    free( p_arg );
}
Ejemplo n.º 5
0
void DialogAttachments::AttachFile(wxFileDialog &diag, wxString const& commit_msg) {
	if (diag.ShowModal() == wxID_CANCEL) return;

	wxArrayString paths;
	diag.GetPaths(paths);

	for (auto const& fn : paths)
		ass->InsertAttachment(agi::fs::path(fn));

	ass->Commit(commit_msg, AssFile::COMMIT_ATTACHMENT);

	UpdateList();
}
void pkgSerializer::OpenFile( wxFileDialog& dialog )
{
	SW_DEF( sw );

    GDataTypeFactory.OnReload();
    GPropertyFactory.OnReload();
    GetDecompiler()->OnReload();
    GetFlags()->OnReload();

    FileName = dialog.GetPath();
    FileName.Normalize();

	File.Open( FileName.GetFullPath(), wxT("rb") );

	File >> Header;

	File >> static_cast<pkgTableHeader&>(NameTable);
	File >> static_cast<pkgTableHeader&>(ExportTable);
	File >> static_cast<pkgTableHeader&>(ImportTable);

	File >> NameTable;
	File >> ExportTable;
	File >> ImportTable;


	Tables.push_back( static_cast<pkgTableHeader>(NameTable) );	
	Tables.push_back( static_cast<pkgTableHeader>(ExportTable) );
	Tables.push_back( static_cast<pkgTableHeader>(ImportTable) );

	SW_LOGF( sw );
}
Ejemplo n.º 7
0
void DialogsProvider::OnOpenFileSimple( wxCommandEvent& event )
{
    playlist_t *p_playlist =
        (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
                                       FIND_ANYWHERE );
    if( p_playlist == NULL )
    {
        return;
    }

    if( p_file_dialog == NULL )
        p_file_dialog = new wxFileDialog( NULL, wxU(_("Open File")),
            wxT(""), wxT(""), wxT("*"), wxOPEN | wxMULTIPLE );

	p_file_dialog->SetWildcard(wxU(_("All Files (*.*)|*"
        "|Sound Files (*.mp3, *.ogg, etc.)|" EXTENSIONS_AUDIO 
        "|Video Files (*.avi, *.mpg, etc.)|" EXTENSIONS_VIDEO 
        "|Playlist Files (*.m3u, *.pls, etc.)|" EXTENSIONS_PLAYLIST 
        "|Subtitle Files (*.srt, *.sub, etc.)|" EXTENSIONS_SUBTITLE)));

    if( p_file_dialog && p_file_dialog->ShowModal() == wxID_OK )
    {
        wxArrayString paths;

        p_file_dialog->GetPaths( paths );

        for( size_t i = 0; i < paths.GetCount(); i++ )
        {
            char *psz_utf8 = wxFromLocale( paths[i] );
            if( event.GetInt() )
                playlist_Add( p_playlist, psz_utf8, psz_utf8,
                              PLAYLIST_APPEND | (i ? 0 : PLAYLIST_GO) |
                              (i ? PLAYLIST_PREPARSE : 0 ),
                              PLAYLIST_END );
            else
                playlist_Add( p_playlist, psz_utf8, psz_utf8,
                              PLAYLIST_APPEND | PLAYLIST_PREPARSE , PLAYLIST_END );
            wxLocaleFree( psz_utf8 );
        }
    }

    vlc_object_release( p_playlist );
}
Ejemplo n.º 8
0
void OpenUserDataRec::EventProcCBAdjustRect(NavCBRecPtr ioParams)
{
    wxWindow* control = m_dialog->GetExtraControl();

    if ( control && m_controlAdded)
    {
        control->SetSize(ioParams->customRect.left , ioParams->customRect.top,
                         ioParams->customRect.right - ioParams->customRect.left,
                         ioParams->customRect.bottom - ioParams->customRect.top);
    }
}