Ejemplo n.º 1
0
        static unsafe void Main(string[] args)
        {
#if FAMISTUDIO_WINDOWS
            try
            {
                // This is only supported in Windows 8.1+.
                SetProcessDpiAwareness(1 /*Process_System_DPI_Aware*/);
            }
            catch { }
#endif

            Settings.Load();
            Cursors.Initialize();
            RenderTheme.Initialize();
            PlatformUtils.Initialize();
            ClipboardUtils.Initialize();
            FamiStudioTempoUtils.Initialize();
            NesApu.InitializeNoteTables();

#if FAMISTUDIO_WINDOWS
            PerformanceCounter.Initialize();
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
#endif


            var famiStudio = new FamiStudio(args.Length > 0 ? args[0] : null);
            famiStudio.Run();

            Settings.Save();
        }
Ejemplo n.º 2
0
 public void Copy()
 {
     if (IsSelectionValid())
     {
         ClipboardUtils.SavePatterns(App.Project, GetSelectedPatterns());
     }
 }
Ejemplo n.º 3
0
        public void Paste()
        {
            if (!IsSelectionValid())
            {
                return;
            }

            var mergeInstruments = ClipboardUtils.ContainsMissingInstruments(App.Project, false);

            bool createMissingInstrument = false;

            if (mergeInstruments)
            {
                createMissingInstrument = PlatformUtils.MessageBox($"You are pasting notes referring to unknown instruments. Do you want to create the missing instrument?", "Paste", MessageBoxButtons.YesNo) == DialogResult.Yes;
            }

            App.UndoRedoManager.BeginTransaction(createMissingInstrument ? TransactionScope.Project : TransactionScope.Song, Song.Id);

            var patterns = ClipboardUtils.LoadPatterns(App.Project, Song, createMissingInstrument);

            if (patterns == null)
            {
                App.UndoRedoManager.AbortTransaction();
                return;
            }

            for (int i = 0; i < patterns.GetLength(0); i++)
            {
                for (int j = 0; j < patterns.GetLength(1); j++)
                {
                    var pattern = patterns[i, j];

                    if (pattern != null && (i + minSelectedPatternIdx) < Song.Length &&
                        pattern.ChannelType < Song.Channels.Length &&
                        pattern.ChannelType == Song.Channels[pattern.ChannelType].Type)
                    {
                        Song.Channels[pattern.ChannelType].PatternInstances[i + minSelectedPatternIdx] = pattern;
                    }
                }
            }

            App.UndoRedoManager.EndTransaction();
            PatternsPasted?.Invoke();
            ConditionalInvalidate();
        }