Exemplo n.º 1
0
        public MetaEditor(EngineDescription buildInfo, TagEntry tag, MetaContainer parentContainer, TagHierarchy tags,
                          ICacheFile cache, IStreamManager streamManager, IRTEProvider rteProvider, Trie stringIDTrie)
        {
            InitializeComponent();

            _parentMetaContainer = parentContainer;
            _tag          = tag;
            _tags         = tags;
            _buildInfo    = buildInfo;
            _cache        = cache;
            _fileManager  = streamManager;
            _rteProvider  = rteProvider;
            _searchTimer  = new Timer(SearchTimer);
            _stringIdTrie = stringIDTrie;

            // Load Plugin Path
            string className = VariousFunctions.SterilizeTagClassName(CharConstant.ToString(tag.RawTag.Class.Magic)).Trim();

            _pluginPath = string.Format("{0}\\{1}\\{2}.xml", VariousFunctions.GetApplicationLocation() + @"Plugins",
                                        _buildInfo.Settings.GetSetting <string>("plugins"), className);

            // Set Option boxes
            cbShowInvisibles.IsChecked  = App.AssemblyStorage.AssemblySettings.PluginsShowInvisibles;
            cbShowComments.IsChecked    = App.AssemblyStorage.AssemblySettings.PluginsShowComments;
            cbShowEnumIndex.IsChecked   = App.AssemblyStorage.AssemblySettings.PluginsShowEnumIndex;
            cbShowInformation.IsChecked = App.AssemblyStorage.AssemblySettings.PluginsShowInformation;

            // Load Meta
            RefreshEditor(MetaReader.LoadType.File);

            // Set init finished
            hasInitFinished = true;
        }
Exemplo n.º 2
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            var sourceClass = value as TagClass;

            if (sourceClass == null)
            {
                return(null);
            }

            //hax 2 tha max
            var nullTag = new TagEntry(null, null, "(null)");

            var tagList = new CompositeCollection();

            tagList.Add(nullTag);

            var mainTagListContainer = new CollectionContainer();

            mainTagListContainer.Collection = sourceClass.Children;

            tagList.Add(mainTagListContainer);


            return(tagList);
        }
Exemplo n.º 3
0
 // Note: TagEntry modifiers don't modify the database directly. They return a VideoFile which can then be written.
 // add or modify a tag on a file object
 // returns the file object with the tag added
 public static VideoFile AddTag(int fileId, TagEntry tag)
 {
     // get the file from the database
     VideoFile file = Files.GetFile(fileId);
     DoAddTag(file, tag);
     return file;
 }
Exemplo n.º 4
0
        public MetaContainer(BuildInformation buildInfo, TagEntry tag, TagHierarchy tags, ICacheFile cache, IStreamManager streamManager, IRTEProvider rteProvider, Trie stringIDTrie)
        {
            InitializeComponent();

            _tag = tag;
            _tags = tags;
            _buildInfo = buildInfo;
            _cache = cache;
            _streamManager = streamManager;
            _rteProvider = rteProvider;
            _stringIDTrie = stringIDTrie;

            tbMetaEditors.SelectedIndex = (int)Settings.halomapLastSelectedMetaEditor;

            // Create Meta Information Tab
            _metaInformation = new MetaInformation(_buildInfo, _tag, _cache);
            tabTagInfo.Content = _metaInformation;

            // Create Meta Editor Tab
            _metaEditor = new MetaEditor(_buildInfo, _tag, this, _tags, _cache, _streamManager, _rteProvider, _stringIDTrie)
                              {
                                  Padding = new Thickness(0)
                              };
            tabMetaEditor.Content = _metaEditor;

            // Create Plugin Editor Tab
            _pluginEditor = new PluginEditor(_buildInfo, _tag, this, _metaEditor);
            tabPluginEditor.Content = _pluginEditor;
        }
Exemplo n.º 5
0
        private void ValueChanged(object sender, SelectionChangedEventArgs e)
        {
            if (cbTagEntry.SelectedIndex < 0)
            {
                cbTagEntry.SelectedIndex = 0;
            }

            if (cbTagGroup.SelectedIndex > 0)
            {
                btnSearch.IsEnabled  = true;
                cbTagEntry.IsEnabled = true;

                TagEntry currentTag = ((TagEntry)cbTagEntry.SelectedItem);

                if (currentTag != null && currentTag.RawTag != null && !currentTag.IsNull)
                {
                    btnJumpToTag.IsEnabled = true;
                }
                else
                {
                    btnJumpToTag.IsEnabled = false;
                }
            }
            else
            {
                btnJumpToTag.IsEnabled = false;
                btnSearch.IsEnabled    = false;
                cbTagEntry.IsEnabled   = false;
            }
            bool tagValid = cbTagEntry.SelectedIndex != 1;
        }
Exemplo n.º 6
0
        // update a single tag associated with a file
        public static bool UpdateFileTag(int fileId, TagEntry tag, List <TagEntry> oldTags)
        {
            bool success;

            string[] rows =
            {
                "type_id",
                "file_id",
                "data"
            };
            string[] data =
            {
                tag.TypeId.ToString(),
                tag.FileId.ToString(),
                tag.Data.ToString()
            };
            if (oldTags.Contains(tag))
            {
                TagEntry oldTag = oldTags[(oldTags.IndexOf(tag))];

                success = Database.SimpleUpdateQuery(_tagsTable, "id",
                                                     oldTag.Id, rows, data);
            }
            else
            {
                success = Database.SimpleInsertQuery(_tagsTable, rows, data);
            }
            return(success);
        }
Exemplo n.º 7
0
        public void LoadNewTagEntry(TagEntry tag)
        {
            _tag = tag;

            // Load Plugin Path
            string groupName = VariousFunctions.SterilizeTagGroupName(CharConstant.ToString(_tag.RawTag.Group.Magic)).Trim();

            _pluginPath = string.Format("{0}\\{1}\\{2}.xml", VariousFunctions.GetApplicationLocation() + @"Plugins",
                                        _buildInfo.Settings.GetSetting <string>("plugins"), groupName);

            if (_buildInfo.Settings.PathExists("fallbackPlugins"))
            {
                _fallbackPluginPath = string.Format("{0}\\{1}\\{2}.xml", VariousFunctions.GetApplicationLocation() + @"Plugins",
                                                    _buildInfo.Settings.GetSetting <string>("fallbackPlugins"), groupName);
            }

            // Set Option boxes
            cbShowInvisibles.IsChecked  = App.AssemblyStorage.AssemblySettings.PluginsShowInvisibles;
            cbShowComments.IsChecked    = App.AssemblyStorage.AssemblySettings.PluginsShowComments;
            cbShowInformation.IsChecked = App.AssemblyStorage.AssemblySettings.PluginsShowInformation;

            cbEnumPrefix.SelectedIndex = (int)App.AssemblyStorage.AssemblySettings.PluginsEnumPrefix;

            // Load Meta
            RefreshEditor(MetaReader.LoadType.File);
        }
Exemplo n.º 8
0
        void BuildUI(Window parent)
        {
            TransientFor   = parent;
            WindowPosition = WindowPosition.CenterOnParent;

            photo_view = new PhotoImageView(Controller.Photos);
            photo_scrolled.Add(photo_view);
            photo_scrolled.SetSizeRequest(200, 200);
            photo_view.Show();

            GtkUtil.ModifyColors(photo_scrolled);
            GtkUtil.ModifyColors(photo_view);

            var tray = new BrowseablePointerGridView(photo_view.Item)
            {
                DisplayTags = false
            };

            icon_scrolled.Add(tray);
            tray.Show();

            progress_bar.Hide();

            import_button.Sensitive = false;

            tag_entry = new TagEntry(App.Instance.Database.Tags, false);
            tag_entry.UpdateFromTagNames(new string [] {});
            tagentry_box.Add(tag_entry);
            tag_entry.Show();
            attachtags_label.MnemonicWidget = tag_entry;
        }
Exemplo n.º 9
0
        public MetaEditor(BuildInformation buildInfo, TagEntry tag, MetaContainer parentContainer, TagHierarchy tags, ICacheFile cache, IStreamManager streamManager, IRTEProvider rteProvider, Trie stringIDTrie)
        {
            InitializeComponent();

            _parentMetaContainer = parentContainer;
            _tag = tag;
            _tags = tags;
            _buildInfo = buildInfo;
            _cache = cache;
            _streamManager = streamManager;
            _rteProvider = rteProvider;
            _searchTimer = new Timer(SearchTimer);
            _stringIDTrie = stringIDTrie;

            // Load Plugin Path
            string className = VariousFunctions.SterilizeTagClassName(CharConstant.ToString(tag.RawTag.Class.Magic)).Trim();
            _pluginPath = string.Format("{0}\\{1}\\{2}.xml", VariousFunctions.GetApplicationLocation() + @"Plugins", _buildInfo.PluginFolder, className);

            // Set Invisibility box
            cbShowInvisibles.IsChecked = Settings.pluginsShowInvisibles;

            // Load Meta
            RefreshEditor();

            // Set init finished
            hasInitFinished = true;
        }
Exemplo n.º 10
0
        public MetaEditor(EngineDescription buildInfo, TagEntry tag, MetaContainer parentContainer, TagHierarchy tags,
			ICacheFile cache, IStreamManager streamManager, IRTEProvider rteProvider, Trie stringIDTrie)
        {
            InitializeComponent();

            _parentMetaContainer = parentContainer;
            _tag = tag;
            _tags = tags;
            _buildInfo = buildInfo;
            _cache = cache;
            _fileManager = streamManager;
            _rteProvider = rteProvider;
            _searchTimer = new Timer(SearchTimer);
            _stringIdTrie = stringIDTrie;

            // Load Plugin Path
            string className = VariousFunctions.SterilizeTagClassName(CharConstant.ToString(tag.RawTag.Class.Magic)).Trim();
            _pluginPath = string.Format("{0}\\{1}\\{2}.xml", VariousFunctions.GetApplicationLocation() + @"Plugins",
                _buildInfo.Settings.GetSetting<string>("plugins"), className);

            // Set Option boxes
            cbShowInvisibles.IsChecked = App.AssemblyStorage.AssemblySettings.PluginsShowInvisibles;
            cbShowComments.IsChecked = App.AssemblyStorage.AssemblySettings.PluginsShowComments;
            cbShowEnumIndex.IsChecked = App.AssemblyStorage.AssemblySettings.PluginsShowEnumIndex;
            cbShowInformation.IsChecked = App.AssemblyStorage.AssemblySettings.PluginsShowInformation;

            // Load Meta
            RefreshEditor(MetaReader.LoadType.File);

            // Set init finished
            hasInitFinished = true;
        }
Exemplo n.º 11
0
        public PluginEditor(EngineDescription buildInfo, TagEntry tag, MetaContainer parent, MetaEditor sibling)
        {
            InitializeComponent();

            txtPlugin.TextArea.TextEntered += PluginTextEntered;

            _parent  = parent;
            _sibling = sibling;

            LoadSyntaxHighlighting();
            SetHighlightColor();
            LoadCodeCompletion();

            App.AssemblyStorage.AssemblySettings.PropertyChanged += Settings_SettingsChanged;

            string groupName = VariousFunctions.SterilizeTagGroupName(CharConstant.ToString(tag.RawTag.Group.Magic)).Trim();

            _pluginPath = string.Format("{0}\\{1}\\{2}.xml", VariousFunctions.GetApplicationLocation() + @"Plugins",
                                        buildInfo.Settings.GetSetting <string>("plugins"), groupName.Trim());

            if (buildInfo.Settings.PathExists("fallbackPlugins"))
            {
                _fallbackPluginPath = string.Format("{0}\\{1}\\{2}.xml", VariousFunctions.GetApplicationLocation() + @"Plugins",
                                                    buildInfo.Settings.GetSetting <string>("fallbackPlugins"), groupName.Trim());
            }
            LoadPlugin();
        }
Exemplo n.º 12
0
        // Note: TagEntry modifiers don't modify the database directly. They return a VideoFile which can then be written.
        // add or modify a tag on a file object
        // returns the file object with the tag added
        public static VideoFile AddTag(int fileId, TagEntry tag)
        {
            // get the file from the database
            VideoFile file = Files.GetFile(fileId);

            DoAddTag(file, tag);
            return(file);
        }
Exemplo n.º 13
0
        public BspEditor(TagEntry tag, ICacheFile cache, IStreamManager streamManager)
        {
            InitializeComponent();

            _tag           = tag;
            _cache         = cache;
            _streamManager = streamManager;
        }
Exemplo n.º 14
0
		public BspEditor(TagEntry tag, ICacheFile cache, IStreamManager streamManager)
		{
			InitializeComponent();

			_tag = tag;
			_cache = cache;
			_streamManager = streamManager;
		}
Exemplo n.º 15
0
        internal static void ShowTagEntry(Form form)
        {
            TagEntry tagEntryWindow = new TagEntry {
                Owner = form
            };

            tagEntryWindow.InitializeForm();
            tagEntryWindow.Show(form);
        }
Exemplo n.º 16
0
        public void TagEntry_TagEntryConstructor_Accept()
        {
            var tagEntry1 = new TagEntry(0, 1, 2, null);

            Assert.True(tagEntry1.Id == 0);
            Assert.True(tagEntry1.TypeId == 1);
            Assert.True(tagEntry1.FileId == 2);
            Assert.True(tagEntry1.Data == null);
        }
Exemplo n.º 17
0
        public void TagEntry_TagEntryConstructor_Accept()
        {
            var tagEntry1 = new TagEntry(0, 1, 2, null);

            Assert.True(tagEntry1.Id == 0);
            Assert.True(tagEntry1.TypeId == 1);
            Assert.True(tagEntry1.FileId == 2);
            Assert.True(tagEntry1.Data == null);
        }
Exemplo n.º 18
0
 // add the same tag to a batch of files
 public static List <VideoFile> BatchAddTag(List <VideoFile> files, TagEntry tag)
 {
     for (int i = 0; i < files.Count; i++)
     {
         // PLEASE TEST: not sure if works this way in C#
         DoAddTag(files[i], tag);
     }
     return(files);
 }
Exemplo n.º 19
0
 // helper method for code portability
 private static void DoAddTag(VideoFile file, TagEntry tag)
 {
     // remove an old version if it's there
     if (file.Tags.Contains(tag))
     {
         file.Tags.Remove(tag);
     }
     file.Tags.Add(tag);
 }
Exemplo n.º 20
0
        public SoundEditor(EngineDescription buildInfo, string cacheLocation, TagEntry tag, ICacheFile cache, IStreamManager streamManager)
        {
            InitializeComponent();

            _buildInfo     = buildInfo;
            _cacheLocation = cacheLocation;
            _tag           = tag;
            _cache         = cache;
            _streamManager = streamManager;

            var viewModel = new ViewModel();

            DataContext       = viewModel;
            viewModel.TagName = _tag.TagFileName;
            viewModel.Sound   = _sound;

            if (!_cache.ResourceMetaLoader.SupportsSounds)
            {
                IsEnabled = false;
                MetroMessageBox.Show("Unsupported", "Assembly doesn't support sounds on this build of Halo yet.");
                return;
            }

            using (var reader = _streamManager.OpenRead())
            {
                _soundResourceGestalt = _cache.LoadSoundResourceGestaltData(reader);
                _sound = _cache.ResourceMetaLoader.LoadSoundMeta(_tag.RawTag, reader);
                var resourceTable = _cache.Resources.LoadResourceTable(reader);
                _soundResource = resourceTable.Resources.First(r => r.Index == _sound.ResourceIndex);
                _resourcePages = new []
                {
                    _soundResource.Location.PrimaryPage,
                    _soundResource.Location.SecondaryPage,
                    _soundResource.Location.TertiaryPage,
                };

                viewModel.ResourcePages =
                    new ObservableCollection <ResourcePage>(_resourcePages.ToList());
            }

            var playback = _soundResourceGestalt.SoundPlaybacks[_sound.PlaybackIndex];

            var soundPermutations = new ISoundPermutation[playback.EncodedPermutationCount];

            for (var i = 0; i < playback.EncodedPermutationCount; i++)
            {
                var permutation = _soundResourceGestalt.SoundPermutations[i + playback.FirstPermutationIndex];
                soundPermutations[i] = permutation;
                viewModel.Permutations.Add(new ViewModel.ViewPermutation
                {
                    Name             = _cache.StringIDs.GetString(permutation.SoundName),
                    Index            = i,
                    SoundPermutation = permutation
                });
            }
        }
Exemplo n.º 21
0
        public void TagEntry_TagEquals_Accept()
        {
            var tagEntry1 = new TagEntry(0, 1, 2, null);
            var tagEntry2 = new TagEntry(3, 1, 4, null);
            var tagEntry3 = new TagEntry(5, 6, 7, null);

            Assert.True(tagEntry1.Equals(tagEntry2));
            Assert.False(tagEntry1.Equals(tagEntry3));
            Assert.False(tagEntry1.Equals(null));
        }
Exemplo n.º 22
0
        public void TagEntry_TagEquals_Accept()
        {
            var tagEntry1 = new TagEntry(0, 1, 2, null);
            var tagEntry2 = new TagEntry(3, 1, 4, null);
            var tagEntry3 = new TagEntry(5, 6, 7, null);

            Assert.True(tagEntry1.Equals(tagEntry2));
            Assert.False(tagEntry1.Equals(tagEntry3));
            Assert.False(tagEntry1.Equals(null));
        }
Exemplo n.º 23
0
        private static string[] LinuxTags; // custom type

        public static void Load(TACT.Net.TACTRepo tactRepo)
        {
            var tags = tactRepo.InstallFile.Tags.Select(x => x.Name).ToHashSet(StringComparer.OrdinalIgnoreCase);

            tags.Remove("Web"); // never needed for this use-case

            foreach (var type in new[] { "mac", "win64", "win32", "win", "linux" })
            {
                var temp = tags.ToList();

                switch (type)
                {
                case "mac":
                    temp.Remove("Windows");
                    temp.Remove("x86_64");
                    MacTags = temp.ToArray();
                    break;

                case "win64":
                    temp.Remove("OSX");
                    temp.Remove("x86_32");
                    Win64Tags = temp.ToArray();
                    break;

                case "win32":
                    temp.Remove("OSX");
                    temp.Remove("x86_64");
                    Win32Tags = temp.ToArray();
                    break;

                case "win":
                    temp.Remove("OSX");
                    WinTags = temp.ToArray();
                    break;

                case "linux":
                    temp.Insert(0, "Linux");
                    temp.Remove("OSX");
                    temp.Remove("Windows");
                    temp.Remove("x86_64");
                    LinuxTags = temp.ToArray();
                    break;
                }
            }

            // add linux tag
            var linuxtag = new TagEntry()
            {
                Name   = "Linux",
                TypeId = 3 // Platform
            };

            tactRepo.InstallFile.AddOrUpdate(linuxtag);
            tactRepo.DownloadFile.AddOrUpdate(linuxtag);
        }
Exemplo n.º 24
0
        public void TageEntry_TagIdentical_Accept()
        {
            var data = "blah blah blah";
            var tagEntry1 = new TagEntry(0, 1, 2, data);
            var tagEntry2 = new TagEntry(0, 1, 2, data);
            var tagEntry3 = new TagEntry(1, 1, 2, data);

            Assert.True(tagEntry1.isIdentical(tagEntry2));
            Assert.False(tagEntry1.isIdentical(tagEntry3));
            Assert.False(tagEntry1.isIdentical(null));
        }
Exemplo n.º 25
0
        public void TageEntry_TagIdentical_Accept()
        {
            var data      = "blah blah blah";
            var tagEntry1 = new TagEntry(0, 1, 2, data);
            var tagEntry2 = new TagEntry(0, 1, 2, data);
            var tagEntry3 = new TagEntry(1, 1, 2, data);

            Assert.True(tagEntry1.isIdentical(tagEntry2));
            Assert.False(tagEntry1.isIdentical(tagEntry3));
            Assert.False(tagEntry1.isIdentical(null));
        }
Exemplo n.º 26
0
        public MetaInformation(EngineDescription buildInfo, TagEntry tag, ICacheFile cache)
        {
            InitializeComponent();

            lblTagName.Text = tag.TagFileName != null
                ? tag.TagFileName + "." + tag.ClassName
                : "0x" + tag.RawTag.Index.Value.ToString("X");

            lblDatum.Text = string.Format("Datum Index: {0}", tag.RawTag.Index);
            lblAddress.Text = string.Format("Memory Address: 0x{0:X8}", tag.RawTag.MetaLocation.AsPointer());
            lblOffset.Text = string.Format("File Offset: 0x{0:X}", tag.RawTag.MetaLocation.AsOffset());
        }
Exemplo n.º 27
0
        public MetaInformation(EngineDescription buildInfo, TagEntry tag, ICacheFile cache)
        {
            InitializeComponent();

            lblTagName.Text = tag.TagFileName != null
                                ? tag.TagFileName + "." + tag.ClassName
                                : "0x" + tag.RawTag.Index.Value.ToString("X");

            lblDatum.Text   = string.Format("Datum Index: {0}", tag.RawTag.Index);
            lblAddress.Text = string.Format("Memory Address: 0x{0:X8}", tag.RawTag.MetaLocation.AsPointer());
            lblOffset.Text  = string.Format("File Offset: 0x{0:X}", tag.RawTag.MetaLocation.AsOffset());
        }
Exemplo n.º 28
0
        public BitmapEditor(EngineDescription buildInfo, string cacheLocation, TagEntry tag, ICacheFile cache, IStreamManager streamManager)
        {
            // #TODO: Notification changes
            InitializeComponent();

            _buildInfo     = buildInfo;
            _cacheLocation = cacheLocation;
            _tag           = tag;
            _cache         = cache;
            _streamManager = streamManager;

            txtTagName.Text = _tag.TagFileName;
        }
Exemplo n.º 29
0
 private void LoadTagEntries()
 {
     SandboxTagEntries = new List <TagEntry>();
     SandboxStream.SeekTo(0xD494);
     for (var entry = 0; entry < 0x100; entry++)
     {
         var tagEntry = new TagEntry(SandboxStream, SandboxMapMetaData);
         if (tagEntry.Tag != null)
         {
             tagEntry.Tag.TagIndex = entry;
         }
         SandboxTagEntries.Add(tagEntry);
     }
 }
Exemplo n.º 30
0
 /// <summary>
 /// Load the usermap's Tag Entries
 /// </summary>
 public void LoadTagEntry()
 {
     _forgeTagEntries = new List <TagEntry>();
     _forgeStream.SeekTo(0xD494);
     for (int entry = 0; entry < 0x100; entry++)
     {
         TagEntry tagEntry = new TagEntry(_forgeStream, _forgeMapTags);
         if (tagEntry.Tag != null)
         {
             tagEntry.Tag.TagIndex = entry;
         }
         _forgeTagEntries.Add(tagEntry);
     }
 }
Exemplo n.º 31
0
 public SettlementTemplatePresenter([NotNull] ApplicationPresenter applicationPresenter, [NotNull] SettlementTemplateView view,
                                    [NotNull] SettlementTemplate template) : base(view, "ThisTemplate.HeaderString", template, applicationPresenter)
 {
     _hhdIntensity = new EnergyIntensityConverter.EnergyIntensityForDisplay(EnergyIntensityType.EnergyIntensive, "Energy Intensive");
     _template     = template;
     RefreshGeneratedSettlements();
     RefreshGeneratedHouses();
     foreach (var tag in Sim.HouseholdTags.It)
     {
         var te = new TagEntry(tag, false);
         AllTags.Add(te);
     }
     RefreshTraits();
 }
Exemplo n.º 32
0
        public MetaEditor(EngineDescription buildInfo, TagEntry tag, MetaContainer parentContainer, TagHierarchy tags,
                          ICacheFile cache, IStreamManager streamManager, IRTEProvider rteProvider, Trie stringIDTrie)
        {
            InitializeComponent();

            _parentMetaContainer = parentContainer;
            _tag          = tag;
            _tags         = tags;
            _buildInfo    = buildInfo;
            _cache        = cache;
            _fileManager  = streamManager;
            _rteProvider  = rteProvider;
            _searchTimer  = new Timer(SearchTimer);
            _stringIdTrie = stringIDTrie;

            // Load Plugin Path
            string groupName = VariousFunctions.SterilizeTagGroupName(CharConstant.ToString(tag.RawTag.Group.Magic)).Trim();

            _pluginPath = string.Format("{0}\\{1}\\{2}.xml", VariousFunctions.GetApplicationLocation() + @"Plugins",
                                        _buildInfo.Settings.GetSetting <string>("plugins"), groupName);

            if (_buildInfo.Settings.PathExists("fallbackPlugins"))
            {
                _fallbackPluginPath = string.Format("{0}\\{1}\\{2}.xml", VariousFunctions.GetApplicationLocation() + @"Plugins",
                                                    _buildInfo.Settings.GetSetting <string>("fallbackPlugins"), groupName);
            }

            // Set Option boxes
            cbShowInvisibles.IsChecked  = App.AssemblyStorage.AssemblySettings.PluginsShowInvisibles;
            cbShowComments.IsChecked    = App.AssemblyStorage.AssemblySettings.PluginsShowComments;
            cbShowInformation.IsChecked = App.AssemblyStorage.AssemblySettings.PluginsShowInformation;

            cbEnumPrefix.SelectedIndex = (int)App.AssemblyStorage.AssemblySettings.PluginsEnumPrefix;

            // Load Meta
            RefreshEditor(MetaReader.LoadType.File);

            // Load Info
            lblTagName.Text = tag.TagFileName != null
                                ? tag.TagFileName + "." + tag.GroupName
                                : "0x" + tag.RawTag.Index.Value.ToString("X");

            lblDatum.Text   = string.Format("{0}", tag.RawTag.Index);
            lblAddress.Text = string.Format("0x{0:X8}", tag.RawTag.MetaLocation.AsPointer());
            lblOffset.Text  = string.Format("0x{0:X}", tag.RawTag.MetaLocation.AsOffset());

            // Set init finished
            hasInitFinished = true;
        }
Exemplo n.º 33
0
        public void LoadNewTagEntry(TagEntry tag)
        {
            TagEntry = tag;

            // Create Meta Information Tab
            //_metaInformation = new MetaInformation(_buildInfo, _tag, _cache);
            //tabTagInfo.Content = _metaInformation;

            // Create Meta Editor Tab
            _metaEditor.LoadNewTagEntry(tag);

            // Create Plugin Editor Tab
            _pluginEditor           = new PluginEditor(_buildInfo, _tag, this, _metaEditor);
            tabPluginEditor.Content = _pluginEditor;
        }
Exemplo n.º 34
0
 public static void AddTag(int x, int y, string name, object key)
 {
     for (int i = 0; i < m_Tags.Count; i++)
     {
         TagEntry entry = (TagEntry)m_Tags[i];
         if (entry.m_Key.Equals(key))
         {
             entry.m_X    = x;
             entry.m_Y    = y;
             entry.m_Name = name;
             return;
         }
     }
     m_Tags.Add(new TagEntry(x, y, name, key));
 }
Exemplo n.º 35
0
        public void LoadNewTagEntry(TagEntry tag)
        {
            TagEntry = tag;

            // Create Meta Information Tab
            _metaInformation = new MetaInformation(_buildInfo, _tag, _cache);
            tabTagInfo.Content = _metaInformation;

            // Create Meta Editor Tab
            _metaEditor.LoadNewTagEntry(tag);

            // Create Plugin Editor Tab
            _pluginEditor = new PluginEditor(_buildInfo, _tag, this, _metaEditor);
            tabPluginEditor.Content = _pluginEditor;
        }
Exemplo n.º 36
0
        public EditCopyPage(Guid gameId, CopyModel model)
        {
            InitializeComponent();

            MessagingCenter.Unsubscribe <EditCopyViewModel>(this, "Tag:Added");
            MessagingCenter.Subscribe <EditCopyViewModel>(this, "Tag:Added", _ =>
            {
                TagEntry.Text = "";
                TagEntry.Focus();
            });

            BindingContext = _vm = new EditCopyViewModel(gameId, model)
            {
                Navigation = Navigation
            };
        }
Exemplo n.º 37
0
        public void fill()
        {
            CacheFilled = true;

            JiraServer selectedServer = AtlassianPanel.Instance.Jira.CurrentlySelectedServerOrDefault;

            if (selectedServer == null)
            {
                return;
            }


            foreach (ITextSnapshotLine line in buffer.CurrentSnapshot.Lines)
            {
                SnapshotSpan span = new SnapshotSpan(line.Start, line.End);

                foreach (ClassificationSpan classification in classifier.GetClassificationSpans(span))
                {
                    if (!classification.ClassificationType.Classification.ToLower().Contains("comment"))
                    {
                        continue;
                    }

                    MatchCollection matches = JiraIssueUtils.ISSUE_REGEX.Matches(classification.Span.GetText());

                    foreach (Match match in matches.Cast <Match>().Where(match => match.Success))
                    {
                        SortedDictionary <string, JiraProject> projects = JiraServerCache.Instance.getProjects(selectedServer);
                        if (!projects.ContainsKey(match.Groups[2].Value))
                        {
                            continue;
                        }

                        SnapshotSpan snapshotSpan = new SnapshotSpan(classification.Span.Start + match.Index, match.Length);

                        TagEntry tagEntry = new TagEntry(snapshotSpan.Start, snapshotSpan.End, match.Groups[0].Value);
//                        DebugMon.Instance().addText("adding tag entry: " + tagEntry);
                        cache.Add(tagEntry);
                    }
                }
            }
            if (buffer.Properties.ContainsProperty(propertyName))
            {
                buffer.Properties.RemoveProperty(propertyName);
            }
            buffer.Properties.AddProperty(propertyName, Entries);
        }
Exemplo n.º 38
0
        public void VisitTagRef(TagRefData field)
        {
            SeekToOffset(field.Offset);

            TagGroup   tagGroup = null;
            DatumIndex index;

            if (field.WithGroup)
            {
                // Read the datum index based upon the layout
                StructureValueCollection values = StructureReader.ReadStructure(_reader, _tagRefLayout);
                index = new DatumIndex(values.GetInteger("datum index"));

                // Check the group, in case the datum index is null
                var magic = values.GetInteger("tag group magic");
                var str   = CharConstant.ToString((int)magic);
                tagGroup = field.Tags.Groups.FirstOrDefault(c => c.TagGroupMagic == str);
            }
            else
            {
                // Just read the datum index at the current position
                index = DatumIndex.ReadFrom(_reader);
            }

            TagEntry tag = null;

            if (index.IsValid && index.Index < field.Tags.Entries.Count)
            {
                tag = field.Tags.Entries[index.Index];
                if (tag == null || tag.RawTag == null || tag.RawTag.Index != index)
                {
                    tag = null;
                }
            }

            if (tag != null)
            {
                field.Group = field.Tags.Groups.FirstOrDefault(c => c.RawGroup == tag.RawTag.Group);
                field.Value = tag;
            }
            else
            {
                field.Group = tagGroup;
                field.Value = null;
            }
        }
Exemplo n.º 39
0
        public PluginEditor(BuildInformation buildInfo, TagEntry tag, MetaContainer parent, MetaEditor sibling)
        {
            InitializeComponent();

            txtPlugin.TextArea.TextEntered += PluginTextEntered;

            _parent = parent;
            _sibling = sibling;

            LoadSyntaxHighlighting();
            LoadCodeCompletion();

            Settings.SettingsChanged += Settings_SettingsChanged;

            string className = VariousFunctions.SterilizeTagClassName(CharConstant.ToString(tag.RawTag.Class.Magic));
            _pluginPath = string.Format("{0}\\{1}\\{2}.xml", VariousFunctions.GetApplicationLocation() + @"Plugins", buildInfo.PluginFolder, className);
            LoadPlugin();
        }
Exemplo n.º 40
0
        // associate a tag with a file
        public static Response AssociateFileTag(TagEntry tag, int fileId)
        {
            string[] rows =
            {
                "type_id",
                "file_id",
                "data"
            };
            string[] data =
            {
                tag.TypeId.ToString(),
                fileId.ToString(),
                tag.Data.ToString()
            };
            bool success = Database.SimpleInsertQuery(_fileTagsTable, rows, data);

            return((success) ? Response.Success : Response.FailedDatabase);
        }
Exemplo n.º 41
0
        public MetaEditor(EngineDescription buildInfo, TagEntry tag, MetaContainer parentContainer, TagHierarchy tags,
                          ICacheFile cache, IStreamManager streamManager, IRTEProvider rteProvider, Trie stringIDTrie)
        {
            InitializeComponent();

            _parentMetaContainer = parentContainer;
            _tags         = tags;
            _buildInfo    = buildInfo;
            _cache        = cache;
            _fileManager  = streamManager;
            _rteProvider  = rteProvider;
            _searchTimer  = new Timer(SearchTimer);
            _stringIdTrie = stringIDTrie;

            LoadNewTagEntry(tag);

            // Set init finished
            hasInitFinished = true;
        }
Exemplo n.º 42
0
        public PluginEditor(EngineDescription buildInfo, TagEntry tag, MetaContainer parent, MetaEditor sibling)
        {
            InitializeComponent();

            txtPlugin.TextArea.TextEntered += PluginTextEntered;

            _parent = parent;
            _sibling = sibling;

            LoadSyntaxHighlighting();
            LoadCodeCompletion();

            App.AssemblyStorage.AssemblySettings.PropertyChanged += Settings_SettingsChanged;

            string className = VariousFunctions.SterilizeTagClassName(CharConstant.ToString(tag.RawTag.Class.Magic)).Trim();
            _pluginPath =
                string.Format("{0}\\{1}\\{2}.xml", VariousFunctions.GetApplicationLocation() + @"Plugins",
                    buildInfo.Settings.GetSetting<string>("plugins"), className.Trim());
            LoadPlugin();
        }
Exemplo n.º 43
0
        public MetaContainer(BuildInformation buildInfo, TagEntry tag, TagHierarchy tags, ICacheFile cache, IStreamManager streamManager)
        {
            InitializeComponent();

            _tag = tag;
            _buildInfo = buildInfo;
            _cache = cache;

            tbMetaEditors.SelectedIndex = (int)Settings.halomapLastSelectedMetaEditor;

            // Create Meta Information Tab
            MetaInformation metaInformation = new MetaInformation(_buildInfo, _tag, _cache);
            tabTagInfo.Content = metaInformation;

            // Create Meta Editor Tab
            MetaEditor metaEditor = new MetaEditor(_buildInfo, _tag, tags, _cache, streamManager);
            tabMetaEditor.Content = metaEditor;

            // Create Plugin Editor Tab
            PluginEditor pluginEditor = new PluginEditor(_buildInfo, _tag, this, metaEditor);
            tabPluginEditor.Content = pluginEditor;
        }
Exemplo n.º 44
0
		internal void Add( int x, int y, int z )
		{
			TagEntry Entry;
			uint Offset;

			// Offset = x + (y << Tag_Shift_x) + (z << (Tag_Shift_x + Tag_Shift_y));

			Offset = ( (uint)x & Tag_Mask_x )
					+ ( ( (uint)y << Tag_Shift_x ) & Tag_Mask_y )
					+ ( ( (uint)z << ( Tag_Shift_x + Tag_Shift_y ) ) & Tag_Mask_z );

			Entry = TagHash[Offset];
			while( Entry != null )
			{
				if( ( Entry.x == x ) && ( Entry.y == y ) && ( Entry.z == z ) ) return;
				Entry = Entry.Next;
			}

			Entry = new TagEntry();

			Entry.x = x; Entry.y = y; Entry.z = z;

			Entry.Prev = null;
			if( ( Entry.Next = TagHash[Offset] ) != null ) Entry.Next.Prev = Entry;
			TagHash[Offset] = Entry;
		}
Exemplo n.º 45
0
 /// <summary>
 /// Load the usermap's Tag Entries
 /// </summary>
 public void LoadTagEntry()
 {
     _forgeTagEntries = new List<TagEntry>();
     _forgeStream.SeekTo(0xD494);
     for (int entry = 0; entry < 0x100; entry++)
     {
         TagEntry tagEntry = new TagEntry(_forgeStream, _forgeMapTags);
         if (tagEntry.Tag != null)
         {
             tagEntry.Tag.TagIndex = entry;
         }
         _forgeTagEntries.Add(tagEntry);
     }
 }
Exemplo n.º 46
0
        public void LoadNewTagEntry(TagEntry tag)
        {
            _tag = tag;

            // Load Plugin Path
            string className = VariousFunctions.SterilizeTagClassName(CharConstant.ToString(_tag.RawTag.Class.Magic)).Trim();
            _pluginPath = string.Format("{0}\\{1}\\{2}.xml", VariousFunctions.GetApplicationLocation() + @"Plugins",
                _buildInfo.Settings.GetSetting<string>("plugins"), className);

            // Set Option boxes
            cbShowInvisibles.IsChecked = App.AssemblyStorage.AssemblySettings.PluginsShowInvisibles;
            cbShowComments.IsChecked = App.AssemblyStorage.AssemblySettings.PluginsShowComments;
            cbShowEnumIndex.IsChecked = App.AssemblyStorage.AssemblySettings.PluginsShowEnumIndex;
            cbShowInformation.IsChecked = App.AssemblyStorage.AssemblySettings.PluginsShowInformation;

            // Load Meta
            RefreshEditor(MetaReader.LoadType.File);
        }
Exemplo n.º 47
0
 private void LoadTagEntries()
 {
     SandboxTagEntries = new List<TagEntry>();
     SandboxStream.SeekTo(0xD494);
     for(var entry = 0; entry < 0x100; entry++)
     {
         var tagEntry = new TagEntry(SandboxStream, SandboxMapMetaData);
         if (tagEntry.Tag != null)
             tagEntry.Tag.TagIndex = entry;
         SandboxTagEntries.Add(tagEntry);
     }
 }
Exemplo n.º 48
0
        public MetaContainer(EngineDescription buildInfo, TagEntry tag, TagHierarchy tags, ICacheFile cache,
			IStreamManager streamManager, IRTEProvider rteProvider, Trie stringIDTrie)
        {
            InitializeComponent();

            _tag = tag;
            _tags = tags;
            _buildInfo = buildInfo;
            _cache = cache;
            _streamManager = streamManager;
            _rteProvider = rteProvider;
            _stringIDTrie = stringIDTrie;

            tbMetaEditors.SelectedIndex = (int) App.AssemblyStorage.AssemblySettings.HalomapLastSelectedMetaEditor;

            // Create Meta Information Tab
            _metaInformation = new MetaInformation(_buildInfo, _tag, _cache);
            tabTagInfo.Content = _metaInformation;

            // Create Meta Editor Tab
            _metaEditor = new MetaEditor(_buildInfo, _tag, this, _tags, _cache, _streamManager, _rteProvider, _stringIDTrie)
            {
                Padding = new Thickness(0)
            };
            tabMetaEditor.Content = _metaEditor;

            // Create Plugin Editor Tab
            _pluginEditor = new PluginEditor(_buildInfo, _tag, this, _metaEditor);
            tabPluginEditor.Content = _pluginEditor;

            // Create Raw Tabs

            #region Models

            //if (_cache.ResourceMetaLoader.SupportsRenderModels && _tag.RawTag.Class.Magic == CharConstant.FromString("mode"))
            //{
            //	tabSound.Visibility = Visibility.Visible;
            //	tabSound.Content = new SoundEditor(_tag, _cache, _streamManager);
            //}
            //else
            //{
            //	tabSound.Visibility = Visibility.Collapsed;
            //	if (App.AssemblyStorage.AssemblySettings.halomapLastSelectedMetaEditor == App.AssemblyStorage.AssemblySettings.LastMetaEditorType.Model)
            //		tbMetaEditors.SelectedIndex = (int)App.AssemblyStorage.AssemblySettings.LastMetaEditorType.MetaEditor;
            //}

            #endregion

            #region BSP

            /*if (true && _tag.RawTag.Class.Magic == CharConstant.FromString("sbsp")) // add some manual check here akarias, since you code isn't in blamite
            {
                tabBspEditor.Visibility = Visibility.Visible;
                tabBspEditor.Content = new BspEditor(_tag, _cache, _streamManager);
            }
            else*/
            {
                tabBspEditor.Visibility = Visibility.Collapsed;
                if (App.AssemblyStorage.AssemblySettings.HalomapLastSelectedMetaEditor == Settings.LastMetaEditorType.Bsp)
                    tbMetaEditors.SelectedIndex = (int) Settings.LastMetaEditorType.MetaEditor;
            }

            #endregion

            #region Sound

            //if (_cache.ResourceMetaLoader.SupportsSounds && _tag.RawTag.Class.Magic == CharConstant.FromString("snd!"))
            //{
            //	tabSound.Visibility = Visibility.Visible;
            //	tabSound.Content = new SoundEditor(_tag, _cache, _streamManager);
            //}
            //else
            //{
            //	tabSound.Visibility = Visibility.Collapsed;
            //	if (App.AssemblyStorage.AssemblySettings.halomapLastSelectedMetaEditor == App.AssemblyStorage.AssemblySettings.LastMetaEditorType.Sound)
            //		tbMetaEditors.SelectedIndex = (int)App.AssemblyStorage.AssemblySettings.LastMetaEditorType.MetaEditor;
            //}

            #endregion
        }
Exemplo n.º 49
0
 // add the same tag to a batch of files
 public static List<VideoFile> BatchAddTag(List<VideoFile> files, TagEntry tag)
 {
     for (int i = 0; i < files.Count; i++)
     {
         // PLEASE TEST: not sure if works this way in C#
         DoAddTag(files[i],tag);
     }
     return files;
 }
Exemplo n.º 50
0
        // update a single tag associated with a file
        public static bool UpdateFileTag(int fileId, TagEntry tag, List<TagEntry> oldTags)
        {
            bool success;
            string[] rows =
                {
                    "type_id",
                    "file_id",
                    "data"
                };
            string[] data =
            {
                  tag.TypeId.ToString(),
                  tag.FileId.ToString(),
                  tag.Data.ToString()
            };
            if (oldTags.Contains(tag))
            {
                TagEntry oldTag = oldTags[(oldTags.IndexOf(tag))];

                success = Database.SimpleUpdateQuery(_tagsTable, "id",
                    oldTag.Id, rows, data);
            }
            else
            {
                success = Database.SimpleInsertQuery(_tagsTable, rows, data);
            }
            return success;
        }
Exemplo n.º 51
0
 // helper method for code portability
 private static void DoAddTag(VideoFile file, TagEntry tag)
 {
     // remove an old version if it's there
     if (file.Tags.Contains(tag))
     {
         file.Tags.Remove(tag);
     }
     file.Tags.Add(tag);
 }
Exemplo n.º 52
0
	//
	// Constructor
	//
	public MainWindow (Db db)
	{
		this.db = db;

		if (Toplevel == null)
			Toplevel = this;

		Glade.XML gui = new Glade.XML (null, "f-spot.glade", "main_window", null);
		gui.Autoconnect (this);

		LoadPreference (Preferences.MAIN_WINDOW_WIDTH);
		LoadPreference (Preferences.MAIN_WINDOW_X);
		LoadPreference (Preferences.MAIN_WINDOW_MAXIMIZED);
		main_window.ShowAll ();

		LoadPreference (Preferences.SIDEBAR_POSITION);
		LoadPreference (Preferences.METADATA_EMBED_IN_IMAGE);
		
		slide_delay = new FSpot.Delay (new GLib.IdleHandler (SlideShow));
		
		toolbar = new Gtk.Toolbar ();
		toolbar_vbox.PackStart (toolbar);
	
		Widget import_button = GtkUtil.MakeToolbarButton (toolbar, "gtk-add", Catalog.GetString ("Import"), new System.EventHandler (HandleImportCommand));
		SetTip (import_button, Catalog.GetString ("Import photos"));
		toolbar.AppendSpace ();

		rl_button = GtkUtil.MakeToolbarButton (toolbar, "f-spot-rotate-270", new System.EventHandler (HandleRotate270Command));
		rr_button = GtkUtil.MakeToolbarButton (toolbar, "f-spot-rotate-90", new System.EventHandler (HandleRotate90Command));
		toolbar.AppendSpace ();
		
		// FIXME putting these two toggle buttons in a radio group would prevent
		// the two toggle sounds from being emitted every time you switch modes
		browse_button = GtkUtil.MakeToolbarToggleButton (toolbar, "f-spot-browse", 
								 new System.EventHandler (HandleToggleViewBrowse)) as ToggleButton;
		SetTip (browse_button, Catalog.GetString ("Browse many photos simultaneously"));
		edit_button = GtkUtil.MakeToolbarToggleButton (toolbar, "f-spot-edit-image", 
							       new System.EventHandler (HandleToggleViewPhoto)) as ToggleButton;
		SetTip (edit_button, Catalog.GetString ("View and edit a photo"));

		toolbar.AppendSpace ();

		Widget fs_button = GtkUtil.MakeToolbarButton (toolbar, "f-spot-fullscreen", new System.EventHandler (HandleViewFullscreen));
		SetTip (fs_button, Catalog.GetString ("View photos fullscreen"));
		
		Widget ss_button = GtkUtil.MakeToolbarButton (toolbar, "f-spot-slideshow", new System.EventHandler (HandleViewSlideShow));
		SetTip (ss_button, Catalog.GetString ("View photos in a slideshow"));

		tag_selection_widget = new TagSelectionWidget (db.Tags);
		tag_selection_scrolled.Add (tag_selection_widget);
		
		tag_selection_widget.Selection.Changed += HandleTagSelectionChanged;
		tag_selection_widget.DragDataGet += HandleTagSelectionDragDataGet;
		tag_selection_widget.DragDrop += HandleTagSelectionDragDrop;
		tag_selection_widget.DragBegin += HandleTagSelectionDragBegin;
		tag_selection_widget.KeyPressEvent += HandleTagSelectionKeyPress;
		Gtk.Drag.SourceSet (tag_selection_widget, Gdk.ModifierType.Button1Mask | Gdk.ModifierType.Button3Mask,
				    tag_target_table, DragAction.Copy | DragAction.Move);

		tag_selection_widget.DragDataReceived += HandleTagSelectionDragDataReceived;
		tag_selection_widget.DragMotion += HandleTagSelectionDragMotion;
		Gtk.Drag.DestSet (tag_selection_widget, DestDefaults.All, tag_dest_target_table, 
				  DragAction.Copy | DragAction.Move ); 

		tag_selection_widget.ButtonPressEvent += HandleTagSelectionButtonPressEvent;
		tag_selection_widget.PopupMenu += HandleTagSelectionPopupMenu;
		tag_selection_widget.RowActivated += HandleTagSelectionRowActivated;
		
		LoadPreference (Preferences.TAG_ICON_SIZE);

		info_box = new InfoBox ();
		info_box.VersionIdChanged += HandleInfoBoxVersionIdChange;
		left_vbox.PackStart (info_box, false, true, 0);
		
		try {
			query = new FSpot.PhotoQuery (db.Photos);
		} catch (System.Exception e) {
			//FIXME assume any exception here is due to a corrupt db and handle that.
			RestoreDb (e);
			query = new FSpot.PhotoQuery (db.Photos);
		}

		UpdateStatusLabel ();
		query.Changed += HandleQueryChanged;

		db.Photos.ItemsChanged += HandleDbItemsChanged;
		db.Tags.ItemsChanged += HandleTagsChanged;
		db.Tags.ItemsAdded += HandleTagsChanged;
		db.Tags.ItemsRemoved += HandleTagsChanged;
#if SHOW_CALENDAR
		FSpot.SimpleCalendar cal = new FSpot.SimpleCalendar (query);
		cal.DaySelected += HandleCalendarDaySelected;
		left_vbox.PackStart (cal, false, true, 0);
#endif

		group_selector = new FSpot.GroupSelector ();
		group_selector.Adaptor = new FSpot.TimeAdaptor (query);

		group_selector.ShowAll ();
		
		if (zoom_scale != null) {
			zoom_scale.ValueChanged += HandleZoomScaleValueChanged;
		}

		view_vbox.PackStart (group_selector, false, false, 0);
		view_vbox.ReorderChild (group_selector, 0);

		find_bar = new FindBar (query, tag_selection_widget.Model);
		//find_bar = new FindBar (query, db.Tags);
		view_vbox.PackStart (find_bar, false, false, 0);
		main_window.KeyPressEvent += HandleKeyPressEvent;
		
		query_widget = new FSpot.QueryWidget (query, db, tag_selection_widget);
		query_widget.Logic.Changed += HandleQueryLogicChanged;
		view_vbox.PackStart (query_widget, false, false, 0);
		view_vbox.ReorderChild (query_widget, 1);

		icon_view = new QueryView (query);
		icon_view.ZoomChanged += HandleZoomChanged;
		LoadPreference (Preferences.ZOOM);
		LoadPreference (Preferences.SHOW_TAGS);
		LoadPreference (Preferences.SHOW_DATES);
		icon_view_scrolled.Add (icon_view);
		icon_view.DoubleClicked += HandleDoubleClicked;
		icon_view.Vadjustment.ValueChanged += HandleIconViewScroll;
		icon_view.GrabFocus ();

		new FSpot.PreviewPopup (icon_view);

		Gtk.Drag.SourceSet (icon_view, Gdk.ModifierType.Button1Mask | Gdk.ModifierType.Button3Mask,
				    icon_source_target_table, DragAction.Copy | DragAction.Move);
		
		icon_view.DragBegin += HandleIconViewDragBegin;
		icon_view.DragDataGet += HandleIconViewDragDataGet;

		near_image.SetFromStock ("f-spot-stock_near", IconSize.SmallToolbar);
		far_image.SetFromStock ("f-spot-stock_far", IconSize.SmallToolbar);

		PhotoTagMenu pmenu = new PhotoTagMenu ();
		pmenu.TagSelected += HandleRemoveTagMenuSelected;
		remove_tag.Submenu = pmenu;
		
		Gtk.Drag.DestSet (icon_view, DestDefaults.All, icon_dest_target_table, 
				  DragAction.Copy | DragAction.Move); 

		//		icon_view.DragLeave += new DragLeaveHandler (HandleIconViewDragLeave);
		icon_view.DragMotion += HandleIconViewDragMotion;
		icon_view.DragDrop += HandleIconViewDragDrop;
		icon_view.DragDataReceived += HandleIconViewDragDataReceived;
		icon_view.KeyPressEvent += HandleIconViewKeyPressEvent;

		photo_view = new PhotoView (query);
		photo_box.Add (photo_view);

		photo_view.ButtonPressEvent += HandlePhotoViewButtonPressEvent;
		photo_view.KeyPressEvent += HandlePhotoViewKeyPressEvent;
		photo_view.UpdateStarted += HandlePhotoViewUpdateStarted;
		photo_view.UpdateFinished += HandlePhotoViewUpdateFinished;

		photo_view.View.ZoomChanged += HandleZoomChanged;

		// Tag typing: focus the tag entry if the user starts typing a tag
		icon_view.KeyPressEvent += HandlePossibleTagTyping;
		photo_view.KeyPressEvent += HandlePossibleTagTyping;
		tag_entry = new TagEntry (db.Tags);
		tag_entry.KeyPressEvent += HandleTagEntryKeyPressEvent;
		tag_entry.TagsAttached += HandleTagEntryTagsAttached;
		tag_entry.TagsRemoved += HandleTagEntryRemoveTags;
		tag_entry.Activated += HandleTagEntryActivate;
		tag_entry_container.Add (tag_entry);

		Gtk.Drag.DestSet (photo_view, DestDefaults.All, tag_target_table, 
				  DragAction.Copy | DragAction.Move); 

		photo_view.DragMotion += HandlePhotoViewDragMotion;
		photo_view.DragDrop += HandlePhotoViewDragDrop;
		photo_view.DragDataReceived += HandlePhotoViewDragDataReceived;

		view_notebook.SwitchPage += HandleViewNotebookSwitchPage;
		group_selector.Adaptor.GlassSet += HandleAdaptorGlassSet;
		group_selector.Adaptor.Changed += HandleAdaptorChanged;
		LoadPreference (Preferences.GROUP_ADAPTOR);
		LoadPreference (Preferences.GROUP_ADAPTOR_ORDER_ASC);

		this.selection = new MainSelection (this);
		this.selection.Changed += HandleSelectionChanged;
		this.selection.ItemsChanged += HandleSelectionItemsChanged;

		UpdateMenus ();

		main_window.ShowAll ();

		tagbar.Hide ();
		find_bar.Hide ();

		UpdateFindByTagMenu ();

		LoadPreference (Preferences.SHOW_TOOLBAR);
		LoadPreference (Preferences.SHOW_SIDEBAR);
		LoadPreference (Preferences.SHOW_TIMELINE);
		
		Preferences.SettingChanged += OnPreferencesChanged;

		main_window.DeleteEvent += HandleDeleteEvent;
		
		query_widget.HandleChanged (query);
		query_widget.Hide ();

		// When the icon_view is loaded, set it's initial scroll position
		icon_view.SizeAllocated += HandleIconViewReady;

		export.Activated += HandleExportActivated;
		UpdateToolbar ();

		Banshee.Kernel.Scheduler.Resume ();
	}
Exemplo n.º 53
0
	//
	// Constructor
	//
	public MainWindow (Db db)
	{
		this.db = db;

		if (Toplevel == null)
			Toplevel = this;

		Glade.XML gui = new Glade.XML (null, "f-spot.glade", "main_window", "f-spot");
		gui.Autoconnect (this);

		LoadPreference (Preferences.MAIN_WINDOW_WIDTH);
		LoadPreference (Preferences.MAIN_WINDOW_X);
		LoadPreference (Preferences.MAIN_WINDOW_MAXIMIZED);
		main_window.ShowAll ();

		LoadPreference (Preferences.SIDEBAR_POSITION);
		LoadPreference (Preferences.METADATA_EMBED_IN_IMAGE);

		LoadPreference (Preferences.COLOR_MANAGEMENT_ENABLED);
 		LoadPreference (Preferences.COLOR_MANAGEMENT_USE_X_PROFILE);
 		FSpot.ColorManagement.LoadSettings();
	
#if GTK_2_10
		pagesetup_menu_item.Activated += HandlePageSetupActivated;
#else
		pagesetup_menu_item.Visible = false;
#endif
		toolbar = new Gtk.Toolbar ();
		toolbar_vbox.PackStart (toolbar);

		ToolButton import_button = GtkUtil.ToolButtonFromTheme ("gtk-add", Catalog.GetString ("Import"), false);
		import_button.Clicked += HandleImportCommand;
		import_button.SetTooltip (ToolTips, Catalog.GetString ("Import new images"), null);
		toolbar.Insert (import_button, -1);
	
		toolbar.Insert (new SeparatorToolItem (), -1);

		ToolButton rl_button = GtkUtil.ToolButtonFromTheme ("object-rotate-left", Catalog.GetString ("Rotate Left"), true);
		rl_button.Clicked += HandleRotate270Command;
		toolbar.Insert (rl_button, -1);

		ToolButton rr_button = GtkUtil.ToolButtonFromTheme ("object-rotate-right", Catalog.GetString ("Rotate Right"), true);
		rr_button.Clicked += HandleRotate90Command;
		toolbar.Insert (rr_button, -1);

		toolbar.Insert (new SeparatorToolItem (), -1);

		browse_button = new ToggleToolButton ();
		browse_button.Label = Catalog.GetString ("Browse");
		browse_button.IconName = "mode-browse";
		browse_button.IsImportant = true;
		browse_button.Toggled += HandleToggleViewBrowse;
		browse_button.SetTooltip (ToolTips, Catalog.GetString ("Browse many photos simultaneously"), null);
		toolbar.Insert (browse_button, -1);

		edit_button = new ToggleToolButton ();
		edit_button.Label = Catalog.GetString ("Edit Image");
		edit_button.IconName = "mode-image-edit";
		edit_button.IsImportant = true;
		edit_button.Toggled += HandleToggleViewPhoto;
		edit_button.SetTooltip (ToolTips, Catalog.GetString ("View and edit a photo"), null);
		toolbar.Insert (edit_button, -1);

		toolbar.Insert (new SeparatorToolItem (), -1);

		ToolButton fs_button = GtkUtil.ToolButtonFromTheme ("view-fullscreen", Catalog.GetString ("Fullscreen"), true);
		fs_button.Clicked += HandleViewFullscreen;
		fs_button.SetTooltip (ToolTips, Catalog.GetString ("View photos fullscreen"), null);
		toolbar.Insert (fs_button, -1);

		ToolButton ss_button = GtkUtil.ToolButtonFromTheme ("media-playback-start", Catalog.GetString ("Slideshow"), true);
		ss_button.Clicked += HandleViewSlideShow;
		ss_button.SetTooltip (ToolTips, Catalog.GetString ("View photos in a slideshow"), null);
		toolbar.Insert (ss_button, -1);

		SeparatorToolItem white_space = new SeparatorToolItem ();
		white_space.Draw = false;
		white_space.Expand = true;
		toolbar.Insert (white_space, -1);

		ToolItem label_item = new ToolItem ();
		count_label = new Label (String.Empty);
		label_item.Child = count_label;
		toolbar.Insert (label_item, -1);

		display_previous_button = new ToolButton (Stock.GoBack);
		toolbar.Insert (display_previous_button, -1);
		display_previous_button.SetTooltip (ToolTips, Catalog.GetString ("Previous photo"), String.Empty);
		display_previous_button.Clicked += new EventHandler (HandleDisplayPreviousButtonClicked);

		display_next_button = new ToolButton (Stock.GoForward);
		toolbar.Insert (display_next_button, -1);
		display_next_button.SetTooltip (ToolTips, Catalog.GetString ("Next photo"), String.Empty);
		display_next_button.Clicked += new EventHandler (HandleDisplayNextButtonClicked);

		sidebar = new Sidebar ();
		ViewModeChanged += sidebar.HandleMainWindowViewModeChanged;
		sidebar_vbox.Add (sidebar);

		tag_selection_scrolled = new ScrolledWindow ();
		tag_selection_scrolled.ShadowType = ShadowType.In;
		
		tag_selection_widget = new TagSelectionWidget (db.Tags);
		tag_selection_scrolled.Add (tag_selection_widget);

		sidebar.AppendPage (tag_selection_scrolled, Catalog.GetString ("Tags"), "tag");

		AddinManager.AddExtensionNodeHandler ("/FSpot/Sidebar", OnSidebarExtensionChanged);

		sidebar.Context = ViewContext.Library;
 		
		sidebar.CloseRequested += HideSidebar;
		sidebar.Show ();

		info_box = new InfoBox ();
		ViewModeChanged += info_box.HandleMainWindowViewModeChanged;
		info_box.VersionIdChanged += delegate (InfoBox box, uint version_id) { UpdateForVersionIdChange (version_id);};
		sidebar_vbox.PackEnd (info_box, false, false, 0);

		info_box.Context = ViewContext.Library;
		
		tag_selection_widget.Selection.Changed += HandleTagSelectionChanged;
		tag_selection_widget.DragDataGet += HandleTagSelectionDragDataGet;
		tag_selection_widget.DragDrop += HandleTagSelectionDragDrop;
		tag_selection_widget.DragBegin += HandleTagSelectionDragBegin;
		tag_selection_widget.KeyPressEvent += HandleTagSelectionKeyPress;
		Gtk.Drag.SourceSet (tag_selection_widget, Gdk.ModifierType.Button1Mask | Gdk.ModifierType.Button3Mask,
				    tag_target_table, DragAction.Copy | DragAction.Move);

		tag_selection_widget.DragDataReceived += HandleTagSelectionDragDataReceived;
		tag_selection_widget.DragMotion += HandleTagSelectionDragMotion;
		Gtk.Drag.DestSet (tag_selection_widget, DestDefaults.All, tag_dest_target_table, 
				  DragAction.Copy | DragAction.Move ); 

		tag_selection_widget.ButtonPressEvent += HandleTagSelectionButtonPressEvent;
		tag_selection_widget.PopupMenu += HandleTagSelectionPopupMenu;
		tag_selection_widget.RowActivated += HandleTagSelectionRowActivated;
		
		LoadPreference (Preferences.TAG_ICON_SIZE);
		
		try {
			query = new FSpot.PhotoQuery (db.Photos);
		} catch (System.Exception e) {
			//FIXME assume any exception here is due to a corrupt db and handle that.
			new RepairDbDialog (e, db.Repair (), main_window);
			query = new FSpot.PhotoQuery (db.Photos);
		}

		UpdateStatusLabel ();
		query.Changed += HandleQueryChanged;

		db.Photos.ItemsChanged += HandleDbItemsChanged;
		db.Tags.ItemsChanged += HandleTagsChanged;
		db.Tags.ItemsAdded += HandleTagsChanged;
		db.Tags.ItemsRemoved += HandleTagsChanged;
#if SHOW_CALENDAR
		FSpot.SimpleCalendar cal = new FSpot.SimpleCalendar (query);
		cal.DaySelected += HandleCalendarDaySelected;
		left_vbox.PackStart (cal, false, true, 0);
#endif

		group_selector = new FSpot.GroupSelector ();
		group_selector.Adaptor = new FSpot.TimeAdaptor (query, Preferences.Get<bool> (Preferences.GROUP_ADAPTOR_ORDER_ASC));

		group_selector.ShowAll ();
		
		if (zoom_scale != null) {
			zoom_scale.ValueChanged += HandleZoomScaleValueChanged;
		}

		view_vbox.PackStart (group_selector, false, false, 0);
		view_vbox.ReorderChild (group_selector, 0);

		find_bar = new FindBar (query, tag_selection_widget.Model);
		view_vbox.PackStart (find_bar, false, false, 0);
		view_vbox.ReorderChild (find_bar, 1);
		main_window.KeyPressEvent += HandleKeyPressEvent;
		
		query_widget = new FSpot.QueryWidget (query, db, tag_selection_widget);
		query_widget.Logic.Changed += HandleQueryLogicChanged;
		view_vbox.PackStart (query_widget, false, false, 0);
		view_vbox.ReorderChild (query_widget, 2);

		icon_view = new QueryView (query);
		icon_view.ZoomChanged += HandleZoomChanged;
		LoadPreference (Preferences.ZOOM);
		LoadPreference (Preferences.SHOW_TAGS);
		LoadPreference (Preferences.SHOW_DATES);
		LoadPreference (Preferences.SHOW_RATINGS);
		icon_view_scrolled.Add (icon_view);
		icon_view.DoubleClicked += HandleDoubleClicked;
		icon_view.Vadjustment.ValueChanged += HandleIconViewScroll;
		icon_view.GrabFocus ();

		new FSpot.PreviewPopup (icon_view);

		Gtk.Drag.SourceSet (icon_view, Gdk.ModifierType.Button1Mask | Gdk.ModifierType.Button3Mask,
				    icon_source_target_table, DragAction.Copy | DragAction.Move);
		
		icon_view.DragBegin += HandleIconViewDragBegin;
		icon_view.DragDataGet += HandleIconViewDragDataGet;

		TagMenu tag_menu = new TagMenu (null, Database.Tags);
		tag_menu.NewTagHandler += delegate { HandleCreateTagAndAttach (this, null); };
		tag_menu.TagSelected += HandleAttachTagMenuSelected;
		tag_menu.Populate();
		attach_tag.Submenu = tag_menu;
		
		PhotoTagMenu pmenu = new PhotoTagMenu ();
		pmenu.TagSelected += HandleRemoveTagMenuSelected;
		remove_tag.Submenu = pmenu;
		
		Gtk.Drag.DestSet (icon_view, DestDefaults.All, icon_dest_target_table, 
				  DragAction.Copy | DragAction.Move); 

		//		icon_view.DragLeave += new DragLeaveHandler (HandleIconViewDragLeave);
		icon_view.DragMotion += HandleIconViewDragMotion;
		icon_view.DragDrop += HandleIconViewDragDrop;
		icon_view.DragDataReceived += HandleIconViewDragDataReceived;
		icon_view.KeyPressEvent += HandleIconViewKeyPressEvent;

		photo_view = new PhotoView (query);
		photo_box.Add (photo_view);

		photo_view.DoubleClicked += HandleDoubleClicked;
		photo_view.KeyPressEvent += HandlePhotoViewKeyPressEvent;
		photo_view.UpdateStarted += HandlePhotoViewUpdateStarted;
		photo_view.UpdateFinished += HandlePhotoViewUpdateFinished;

		photo_view.View.ZoomChanged += HandleZoomChanged;

		// Tag typing: focus the tag entry if the user starts typing a tag
		icon_view.KeyPressEvent += HandlePossibleTagTyping;
		photo_view.KeyPressEvent += HandlePossibleTagTyping;
		tag_entry = new TagEntry (db.Tags);
		tag_entry.KeyPressEvent += HandleTagEntryKeyPressEvent;
		tag_entry.TagsAttached += HandleTagEntryTagsAttached;
		tag_entry.TagsRemoved += HandleTagEntryRemoveTags;
		tag_entry.Activated += HandleTagEntryActivate;
		tag_entry_container.Add (tag_entry);

		Gtk.Drag.DestSet (photo_view, DestDefaults.All, tag_target_table, 
				  DragAction.Copy | DragAction.Move); 

		photo_view.DragMotion += HandlePhotoViewDragMotion;
		photo_view.DragDrop += HandlePhotoViewDragDrop;
		photo_view.DragDataReceived += HandlePhotoViewDragDataReceived;

		view_notebook.SwitchPage += HandleViewNotebookSwitchPage;
		group_selector.Adaptor.GlassSet += HandleAdaptorGlassSet;
		group_selector.Adaptor.Changed += HandleAdaptorChanged;
		LoadPreference (Preferences.GROUP_ADAPTOR);
		LoadPreference (Preferences.GROUP_ADAPTOR_ORDER_ASC);

		this.selection = new MainSelection (this);
		this.selection.Changed += HandleSelectionChanged;
		this.selection.ItemsChanged += HandleSelectionItemsChanged;
		this.selection.Changed += sidebar.HandleSelectionChanged;
		this.selection.ItemsChanged += sidebar.HandleSelectionItemsChanged;

		Mono.Addins.AddinManager.ExtensionChanged += PopulateExtendableMenus;
		PopulateExtendableMenus (null, null);

		UpdateMenus ();

		main_window.ShowAll ();

		tagbar.Hide ();
		find_bar.Hide ();

		UpdateFindByTagMenu ();

		LoadPreference (Preferences.SHOW_TOOLBAR);
		LoadPreference (Preferences.SHOW_SIDEBAR);
		LoadPreference (Preferences.SHOW_TIMELINE);
		LoadPreference (Preferences.SHOW_FILMSTRIP);

		LoadPreference (Preferences.GNOME_MAILTO_ENABLED);
		
		Preferences.SettingChanged += OnPreferencesChanged;

		main_window.DeleteEvent += HandleDeleteEvent;
		
		query_widget.HandleChanged (query);
		query_widget.Hide ();

		// When the icon_view is loaded, set it's initial scroll position
		icon_view.SizeAllocated += HandleIconViewReady;

		export.Activated += HandleExportActivated;
		UpdateToolbar ();

		Banshee.Kernel.Scheduler.Resume ();
	}
Exemplo n.º 54
0
        private void LoadControlType()
        {
            UseCache = false;
            if (ItemVersionId == -1)
            {
                BindItemData(true);
                //trArticleId.Visible = false;
                cmdDelete.Visible = false;
            }
            else
            {
                BindItemData();
                cmdDelete.Visible = IsAdmin;
            }

            var av = (Article)VersionInfoObject;

            //Item Edit
            itemEditControl = (ItemEdit)LoadControl(ItemControlToLoad);
            itemEditControl.ModuleConfiguration = ModuleConfiguration;
            itemEditControl.ID = Path.GetFileNameWithoutExtension(ItemControlToLoad);
            itemEditControl.VersionInfoObject = VersionInfoObject;
            phControls.Controls.Add(itemEditControl);

            //Article Text Editor
            TeArticleText = (TextEditor)LoadControl("~/controls/TextEditor.ascx");
            TeArticleText.HtmlEncode = false;
            TeArticleText.TextRenderMode = "Raw";
            //TeArticleText.Width = ArticleEditWidth; //default values for the editor
            TeArticleText.Height = ArticleEditHeight; //default values for the editor
            TeArticleText.ChooseMode = true;
            phArticleText.Controls.Add(TeArticleText);
            TeArticleText.Text = av.ArticleText;

            //Parent Category Relationship
            parentCategoryRelationship = (ItemRelationships)LoadControl("../controls/ItemRelationships.ascx");
            parentCategoryRelationship.ModuleConfiguration = ModuleConfiguration;

            parentCategoryRelationship.LocalResourceFile = ItemrelationshipResourceFile;
            parentCategoryRelationship.VersionInfoObject = VersionInfoObject;
            parentCategoryRelationship.ListRelationshipTypeId = Util.RelationshipType.ItemToParentCategory.GetId();
            parentCategoryRelationship.CreateRelationshipTypeId = Util.RelationshipType.ItemToParentCategory.GetId();
            parentCategoryRelationship.AvailableSelectionMode = ListSelectionMode.Single;
            parentCategoryRelationship.IsRequired = true;
            parentCategoryRelationship.FlatView = true;
            parentCategoryRelationship.ItemTypeId = ItemType.Category.GetId();
            phParentCategory.Controls.Add(parentCategoryRelationship);

            //Related Category Relationship
            relatedCategoryRelationships = (ItemRelationships)LoadControl("../controls/ItemRelationships.ascx");
            relatedCategoryRelationships.ModuleConfiguration = ModuleConfiguration;
            relatedCategoryRelationships.LocalResourceFile = ItemrelationshipResourceFile;
            relatedCategoryRelationships.VersionInfoObject = VersionInfoObject;
            relatedCategoryRelationships.ListRelationshipTypeId = Util.RelationshipType.ItemToParentCategory.GetId();
            relatedCategoryRelationships.CreateRelationshipTypeId = Util.RelationshipType.ItemToRelatedCategory.GetId();
            relatedCategoryRelationships.AvailableSelectionMode = ListSelectionMode.Multiple;
            relatedCategoryRelationships.IsRequired = false;
            relatedCategoryRelationships.FlatView = true;
            relatedCategoryRelationships.ItemTypeId = ItemType.Category.GetId();
            phRelatedCategories.Controls.Add(relatedCategoryRelationships);

            //load approval status
            itemApprovalStatus = (ItemApproval)LoadControl(ApprovalControlToLoad);
            itemApprovalStatus.ModuleConfiguration = ModuleConfiguration;
            itemApprovalStatus.ID = Path.GetFileNameWithoutExtension(ApprovalControlToLoad);
            itemApprovalStatus.VersionInfoObject = VersionInfoObject;
            phApproval.Controls.Add(itemApprovalStatus);

            if (AllowTags)
            {
                var tagList = new StringBuilder(255);
                foreach (ItemTag it in VersionInfoObject.Tags)
                {
                    tagList.Append(Tag.GetTag(it.TagId, PortalId).Name);
                    tagList.Append(";");
                }

                tagEntryControl = (TagEntry)LoadControl(TagControlToLoad);
                tagEntryControl.ModuleConfiguration = ModuleConfiguration;
                tagEntryControl.ID = Path.GetFileNameWithoutExtension(TagControlToLoad);

                tagEntryControl.TagList = tagList.ToString();
                phTagEntry.Controls.Add(tagEntryControl);

            }
            else
            {
            }
        }
Exemplo n.º 55
0
 // associate a tag with a file
 public static Response AssociateFileTag(TagEntry tag, int fileId)
 {
     string[] rows =
     {
         "type_id",
         "file_id",
         "data"
     };
     string[] data =
     {
         tag.TypeId.ToString(),
         fileId.ToString(),
         tag.Data.ToString()
     };
     bool success = Database.SimpleInsertQuery(_fileTagsTable, rows, data);
     return (success) ? Response.Success : Response.FailedDatabase;
 }
Exemplo n.º 56
0
        public void LoadNewTagEntry(TagEntry tag)
        {
            _tag = tag;

            // Load Plugin Path
            var className = VariousFunctions.SterilizeTagClassName(CharConstant.ToString(_tag.RawTag.Class.Magic)).Trim();
            _pluginPath = string.Format("{0}\\{1}\\{2}.xml", VariousFunctions.GetApplicationLocation() + @"Plugins", _buildInfo.PluginFolder, className);

            // Set Invisibility box
            cbShowInvisibles.IsChecked = Settings.pluginsShowInvisibles;

            // Load Meta
            RefreshEditor(MetaReader.LoadType.File);
        }
Exemplo n.º 57
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            var sourceClass = value as TagClass;
            if (sourceClass == null)
                return null;

            //hax 2 tha max
            var nullTag = new TagEntry(null, null, "(null)");

            var tagList = new CompositeCollection();
            tagList.Add(nullTag);

            var mainTagListContainer = new CollectionContainer();
            mainTagListContainer.Collection = sourceClass.Children;

            tagList.Add(mainTagListContainer);

            return tagList;
        }