예제 #1
0
 public TabClass()
 {
     Posts          = new Dictionary <long, PostClass>();
     _filters       = new List <FiltersClass>();
     Notify         = true;
     SoundFile      = string.Empty;
     _unreadManage  = true;
     _ids           = new List <long>();
     OldestUnreadId = -1;
     _tabType       = TabUsageType.Undefined;
     _listInfo      = null;
 }
예제 #2
0
 public TabClass()
 {
     Posts = new Dictionary<long, PostClass>();
     _filters = new List<FiltersClass>();
     Notify = true;
     SoundFile = string.Empty;
     _unreadManage = true;
     _ids = new List<long>();
     OldestUnreadId = -1;
     _tabType = TabUsageType.Undefined;
     _listInfo = null;
 }
예제 #3
0
 public TabClass(string tabName, TabUsageType tabType, ListElement list)
 {
     Posts = new Dictionary<long, PostClass>();
     TabName = tabName;
     _filters = new List<FiltersClass>();
     Notify = true;
     SoundFile = string.Empty;
     _unreadManage = true;
     _ids = new List<long>();
     OldestUnreadId = -1;
     _tabType = tabType;
     ListInfo = list;
     _sorter.Posts = IsInnerStorageTabType ? Posts : TabInformations.Instance.Posts;
 }
예제 #4
0
 public TabClass(string tabName, TabUsageType tabType, ListElement list)
 {
     Posts          = new Dictionary <long, PostClass>();
     TabName        = tabName;
     _filters       = new List <FiltersClass>();
     Notify         = true;
     SoundFile      = string.Empty;
     _unreadManage  = true;
     _ids           = new List <long>();
     OldestUnreadId = -1;
     _tabType       = tabType;
     ListInfo       = list;
     _sorter.Posts  = IsInnerStorageTabType ? Posts : TabInformations.Instance.Posts;
 }
예제 #5
0
        private void ComboUsage_SelectedIndexChanged(object sender, EventArgs e)
        {
            switch (ComboUsage.SelectedIndex)
            {
            case 0:
                Usage = TabUsageType.UserDefined;
                break;

            case 1:
                Usage = TabUsageType.Lists;
                break;

            case 2:
                Usage = TabUsageType.PublicSearch;
                break;

            default:
                Usage = TabUsageType.Undefined;
                break;
            }
        }
예제 #6
0
        private void ComboUsage_SelectedIndexChanged(object sender, EventArgs e)
        {
            switch (ComboUsage.SelectedIndex)
            {
                case 0:
                    Usage = TabUsageType.UserDefined;
                    break;

                case 1:
                    Usage = TabUsageType.Lists;
                    break;

                case 2:
                    Usage = TabUsageType.PublicSearch;
                    break;

                default:
                    Usage = TabUsageType.Undefined;
                    break;
            }
        }
예제 #7
0
        private bool TryGetTabInfo(ref string name, ref TabUsageType usageType, string title = "", string desc = "", bool showusage = false)
        {
            using (var form = new InputTabName { TabName = name })
            {
                form.SetFormTitle(title);
                form.SetFormDescription(desc);
                form.SetIsShowUsage(showusage);
                var result = form.ShowDialog();
                if (result != DialogResult.OK)
                {
                    return false;
                }

                name = form.TabName;
                if (showusage)
                {
                    usageType = form.Usage;
                }
            }

            return true;
        }
예제 #8
0
파일: Tween.cs 프로젝트: t-ashula/hoehoe2
        public bool RemoveSpecifiedTab(string tabName, bool confirm)
        {
            int idx;

            for (idx = 0; idx < ListTab.TabPages.Count; idx++)
            {
                if (ListTab.TabPages[idx].Text == tabName)
                {
                    break;
                }
            }

            if (_statuses.IsDefaultTab(tabName))
            {
                return(false);
            }

            if (confirm)
            {
                string tmp    = string.Format(R.RemoveSpecifiedTabText1, Environment.NewLine);
                var    result = MessageBox.Show(tmp, string.Format("{0} {1}", tabName, R.RemoveSpecifiedTabText2), MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);
                if (result == DialogResult.Cancel)
                {
                    return(false);
                }
            }

            SetListProperty(); // 他のタブに列幅等を反映

            TabUsageType tabType = _statuses.Tabs[tabName].TabType;

            // オブジェクトインスタンスの削除
            SplitContainer1.Panel1.SuspendLayout();
            SplitContainer1.Panel2.SuspendLayout();
            SplitContainer1.SuspendLayout();
            ListTab.SuspendLayout();
            SuspendLayout();

            TabPage tabPage    = ListTab.TabPages[idx];
            var     listCustom = (DetailsListView)tabPage.Tag;

            tabPage.Tag = null;
            tabPage.SuspendLayout();

            if (ReferenceEquals(ListTab.SelectedTab, ListTab.TabPages[idx]))
            {
                ListTab.SelectTab(_prevSelectedTab != null && ListTab.TabPages.Contains(_prevSelectedTab) ? _prevSelectedTab : ListTab.TabPages[0]);
            }

            ListTab.Controls.Remove(tabPage);

            if (tabType == TabUsageType.PublicSearch)
            {
                Control pnl = tabPage.Controls["panelSearch"];
                foreach (Control ctrl in pnl.Controls)
                {
                    if (ctrl.Name == "buttonSearch")
                    {
                        ctrl.Click -= SearchButton_Click;
                    }

                    ctrl.Enter -= SearchControls_Enter;
                    ctrl.Leave -= SearchControls_Leave;
                    pnl.Controls.Remove(ctrl);
                    ctrl.Dispose();
                }

                tabPage.Controls.Remove(pnl);
            }

            tabPage.Controls.Remove(listCustom);
            listCustom.Columns.Clear();
            listCustom.ContextMenuStrip = null;

            listCustom.SelectedIndexChanged -= MyList_SelectedIndexChanged;
            listCustom.MouseDoubleClick     -= MyList_MouseDoubleClick;
            listCustom.ColumnClick          -= MyList_ColumnClick;
            listCustom.DrawColumnHeader     -= MyList_DrawColumnHeader;
            listCustom.DragDrop             -= TweenMain_DragDrop;
            listCustom.DragOver             -= TweenMain_DragOver;
            listCustom.DrawItem             -= MyList_DrawItem;
            listCustom.MouseClick           -= MyList_MouseClick;
            listCustom.ColumnReordered      -= MyList_ColumnReordered;
            listCustom.ColumnWidthChanged   -= MyList_ColumnWidthChanged;
            listCustom.CacheVirtualItems    -= MyList_CacheVirtualItems;
            listCustom.RetrieveVirtualItem  -= MyList_RetrieveVirtualItem;
            listCustom.DrawSubItem          -= MyList_DrawSubItem;
            listCustom.HScrolled            -= MyList_HScrolled;

            _tabDialog.RemoveTab(tabName);

            listCustom.SmallImageList     = null;
            listCustom.ListViewItemSorter = null;

            // キャッシュのクリア
            if (_curTab.Equals(tabPage))
            {
                _curTab       = null;
                _curItemIndex = -1;
                _curList      = null;
                _curPost      = null;
            }

            _itemCache      = null;
            _itemCacheIndex = -1;
            _postCache      = null;

            tabPage.ResumeLayout(false);

            SplitContainer1.Panel1.ResumeLayout(false);
            SplitContainer1.Panel2.ResumeLayout(false);
            SplitContainer1.ResumeLayout(false);
            ListTab.ResumeLayout(false);
            ResumeLayout(false);
            PerformLayout();

            tabPage.Dispose();
            listCustom.Dispose();
            _statuses.RemoveTab(tabName);

            foreach (TabPage tp in ListTab.TabPages)
            {
                var lst = (DetailsListView)tp.Tag;
                lst.VirtualListSize = _statuses.Tabs[tp.Text].AllCount;
            }

            return(true);
        }
예제 #9
0
파일: Tween.cs 프로젝트: t-ashula/hoehoe2
        public bool AddNewTab(string tabName, bool startup, TabUsageType tabType, ListElement listInfo = null)
        {
            // 重複チェック
            if (ListTab.TabPages.Cast <TabPage>().Any(tb => tb.Text == tabName))
            {
                return(false);
            }

            // 新規タブ名チェック
            if (tabName == R.AddNewTabText1)
            {
                return(false);
            }

            // タブタイプ重複チェック
            if (!startup)
            {
                if (tabType == TabUsageType.DirectMessage ||
                    tabType == TabUsageType.Favorites ||
                    tabType == TabUsageType.Home ||
                    tabType == TabUsageType.Mentions ||
                    tabType == TabUsageType.Related)
                {
                    if (_statuses.GetTabByType(tabType) != null)
                    {
                        return(false);
                    }
                }
            }

            var tabPage = new TabPage();

            int cnt = ListTab.TabPages.Count;

            //// ToDo:Create and set controls follow tabtypes

            SplitContainer1.Panel1.SuspendLayout();
            SplitContainer1.Panel2.SuspendLayout();
            SplitContainer1.SuspendLayout();
            ListTab.SuspendLayout();
            SuspendLayout();

            tabPage.SuspendLayout();

            // UserTimeline関連
            Label label = null;

            if (tabType == TabUsageType.UserTimeline || tabType == TabUsageType.Lists)
            {
                label = new Label
                {
                    Dock      = DockStyle.Top,
                    Name      = "labelUser",
                    Text      = tabType == TabUsageType.Lists ? listInfo.ToString() : _statuses.Tabs[tabName].User + "'s Timeline",
                    TextAlign = ContentAlignment.MiddleLeft
                };
                using (var tmpComboBox = new ComboBox())
                {
                    label.Height = tmpComboBox.Height;
                }
            }

            ListTab.Controls.Add(tabPage);
            var listCustom = CreateDetailListView(tabName, startup);

            listCustom.SelectedIndexChanged += MyList_SelectedIndexChanged;
            listCustom.MouseDoubleClick     += MyList_MouseDoubleClick;
            listCustom.ColumnClick          += MyList_ColumnClick;
            listCustom.DrawColumnHeader     += MyList_DrawColumnHeader;
            listCustom.DragDrop             += TweenMain_DragDrop;
            listCustom.DragOver             += TweenMain_DragOver;
            listCustom.DrawItem             += MyList_DrawItem;
            listCustom.MouseClick           += MyList_MouseClick;
            listCustom.ColumnReordered      += MyList_ColumnReordered;
            listCustom.ColumnWidthChanged   += MyList_ColumnWidthChanged;
            listCustom.CacheVirtualItems    += MyList_CacheVirtualItems;
            listCustom.RetrieveVirtualItem  += MyList_RetrieveVirtualItem;
            listCustom.DrawSubItem          += MyList_DrawSubItem;
            listCustom.HScrolled            += MyList_HScrolled;
            tabPage.Controls.Add(listCustom);

            if (_statuses.IsDistributableTab(tabName))
            {
                _tabDialog.AddTab(tabName);
            }

            // 検索関連の準備
            Panel pnl = null;

            if (tabType == TabUsageType.PublicSearch)
            {
                pnl = CreateSearchPanel(tabName);
                tabPage.Controls.Add(pnl);
            }

            if (tabType == TabUsageType.UserTimeline || tabType == TabUsageType.Lists)
            {
                tabPage.Controls.Add(label);
            }

            tabPage.Location = new Point(4, 4);
            tabPage.Name     = string.Format("CTab{0}", cnt);
            tabPage.Size     = new Size(380, 260);
            tabPage.TabIndex = 2 + cnt;
            tabPage.Text     = tabName;
            tabPage.UseVisualStyleBackColor = true;

            if (tabType == TabUsageType.PublicSearch)
            {
                pnl.ResumeLayout(false);
            }

            tabPage.ResumeLayout(false);

            SplitContainer1.Panel1.ResumeLayout(false);
            SplitContainer1.Panel2.ResumeLayout(false);
            SplitContainer1.ResumeLayout(false);
            ListTab.ResumeLayout(false);
            ResumeLayout(false);
            PerformLayout();
            tabPage.Tag = listCustom;
            return(true);
        }
예제 #10
0
파일: Tween.cs 프로젝트: t-ashula/hoehoe2
        public bool AddNewTab(string tabName, bool startup, TabUsageType tabType, ListElement listInfo = null)
        {
            // 重複チェック
            if (ListTab.TabPages.Cast<TabPage>().Any(tb => tb.Text == tabName))
            {
                return false;
            }

            // 新規タブ名チェック
            if (tabName == R.AddNewTabText1)
            {
                return false;
            }

            // タブタイプ重複チェック
            if (!startup)
            {
                if (tabType == TabUsageType.DirectMessage
                    || tabType == TabUsageType.Favorites
                    || tabType == TabUsageType.Home
                    || tabType == TabUsageType.Mentions
                    || tabType == TabUsageType.Related)
                {
                    if (_statuses.GetTabByType(tabType) != null)
                    {
                        return false;
                    }
                }
            }

            var tabPage = new TabPage();

            int cnt = ListTab.TabPages.Count;

            //// ToDo:Create and set controls follow tabtypes

            SplitContainer1.Panel1.SuspendLayout();
            SplitContainer1.Panel2.SuspendLayout();
            SplitContainer1.SuspendLayout();
            ListTab.SuspendLayout();
            SuspendLayout();

            tabPage.SuspendLayout();

            // UserTimeline関連
            Label label = null;
            if (tabType == TabUsageType.UserTimeline || tabType == TabUsageType.Lists)
            {
                label = new Label
                    {
                        Dock = DockStyle.Top,
                        Name = "labelUser",
                        Text = tabType == TabUsageType.Lists ? listInfo.ToString() : _statuses.Tabs[tabName].User + "'s Timeline",
                        TextAlign = ContentAlignment.MiddleLeft
                    };
                using (var tmpComboBox = new ComboBox())
                {
                    label.Height = tmpComboBox.Height;
                }
            }

            ListTab.Controls.Add(tabPage);
            var listCustom = CreateDetailListView(tabName, startup);
            listCustom.SelectedIndexChanged += MyList_SelectedIndexChanged;
            listCustom.MouseDoubleClick += MyList_MouseDoubleClick;
            listCustom.ColumnClick += MyList_ColumnClick;
            listCustom.DrawColumnHeader += MyList_DrawColumnHeader;
            listCustom.DragDrop += TweenMain_DragDrop;
            listCustom.DragOver += TweenMain_DragOver;
            listCustom.DrawItem += MyList_DrawItem;
            listCustom.MouseClick += MyList_MouseClick;
            listCustom.ColumnReordered += MyList_ColumnReordered;
            listCustom.ColumnWidthChanged += MyList_ColumnWidthChanged;
            listCustom.CacheVirtualItems += MyList_CacheVirtualItems;
            listCustom.RetrieveVirtualItem += MyList_RetrieveVirtualItem;
            listCustom.DrawSubItem += MyList_DrawSubItem;
            listCustom.HScrolled += MyList_HScrolled;
            tabPage.Controls.Add(listCustom);

            if (_statuses.IsDistributableTab(tabName))
            {
                _tabDialog.AddTab(tabName);
            }

            // 検索関連の準備
            Panel pnl = null;
            if (tabType == TabUsageType.PublicSearch)
            {
                pnl = CreateSearchPanel(tabName);
                tabPage.Controls.Add(pnl);
            }

            if (tabType == TabUsageType.UserTimeline || tabType == TabUsageType.Lists)
            {
                tabPage.Controls.Add(label);
            }

            tabPage.Location = new Point(4, 4);
            tabPage.Name = string.Format("CTab{0}", cnt);
            tabPage.Size = new Size(380, 260);
            tabPage.TabIndex = 2 + cnt;
            tabPage.Text = tabName;
            tabPage.UseVisualStyleBackColor = true;

            if (tabType == TabUsageType.PublicSearch)
            {
                pnl.ResumeLayout(false);
            }

            tabPage.ResumeLayout(false);

            SplitContainer1.Panel1.ResumeLayout(false);
            SplitContainer1.Panel2.ResumeLayout(false);
            SplitContainer1.ResumeLayout(false);
            ListTab.ResumeLayout(false);
            ResumeLayout(false);
            PerformLayout();
            tabPage.Tag = listCustom;
            return true;
        }
예제 #11
0
 public List<TabClass> GetTabsByType(TabUsageType tabType)
 {
     // 合致したタブをListで返す
     // 合致しなければ空のListを返す
     lock (_lockObj)
     {
         return Tabs.Values.Where(tb => (tabType & tb.TabType) == tb.TabType).ToList();
     }
 }
예제 #12
0
 public TabClass GetTabByType(TabUsageType tabType)
 {
     // Home,Mentions,DM,Favは1つに制限する
     // その他のタイプを指定されたら、最初に合致したものを返す
     // 合致しなければNothingを返す
     lock (_lockObj)
     {
         return Tabs.Values.FirstOrDefault(tb => tb != null && tb.TabType == tabType);
     }
 }
예제 #13
0
        public bool AddTab(string tabName, TabUsageType tabType, ListElement list)
        {
            if (Tabs.ContainsKey(tabName))
            {
                return false;
            }

            Tabs.Add(tabName, new TabClass(tabName, tabType, list));
            Tabs[tabName].Sorter.Mode = _sorter.Mode;
            Tabs[tabName].Sorter.Order = _sorter.Order;
            return true;
        }