private void listViewUserAction(object sender, ListViewAdpter.UserActionEventArgs e)
        {
            if (e.Action == ListViewAdpter.UserActionEventArgs.ActionType.del){
                if(MessageBox.Show(
                    StringResources.GetValue("tip_sure_del_label"),
                    "warning",
                    MessageBoxButtons.YesNo,
                    MessageBoxIcon.Warning) != DialogResult.Yes)
                {
                    return;
                }
            }
            picview.EnableMakeImage = false;
            if (e.Value <= wsp.GroupDefine.UserGroupCount)
            {
                for(int i=e.Index.Length-1;i>=0;i--) {
                    int index = e.Index[i];
                    if (e.Action == ListViewAdpter.UserActionEventArgs.ActionType.setGroup)
                        wsp.Store.UpdateLabelCategory(fileName, index, e.Value);
                    else if (e.Action == ListViewAdpter.UserActionEventArgs.ActionType.del)
                        wsp.Store.DelLabelItem(fileName, index);

                }

            }
            picview.EnableMakeImage = true;
            picview.MakeImageNow();
        }
        public WorkspaceControlAdpter(
            ToolStripButtonGroup ModeButtons, 
            ToolStripComboBox FileSelectComboBox, 
            TextBox TranslateTextBox, 
            GroupBox TextBoxGroupBox,
            ListViewAdpter LabelListViewAPT, 
            PicView picView, 
            ContextMenuStrip contextMenuQuictText,
            ToolStrip toolStrip,
            Workspace workspace)
        {
            wsp = workspace;
            wsp.UserGroupDefineChanged += new EventHandler(userGroupChanged);

            LabelFileManager.FileListChanged += new EventHandler(fileListChanged);
            LabelFileManager.LabelItemListChanged += new EventHandler(labelItemListChanged);
            LabelFileManager.LabelItemTextChanged += new EventHandler(labelItemTextChanged);
            LabelFileManager.GroupListChanged += new EventHandler(labelItemTextChanged);
            textboxgroupbox = TextBoxGroupBox;

            picview = picView;
            picview.Image = null;
            picview.Refresh();
            picview.LabelUserAction += new PicView.UserActionEventHandler(picView_UserClickAction);
            picview.MouseMove += new MouseEventHandler(picView_MouseMove);
            picview.MouseClick += new MouseEventHandler(picView_MosueClick);
            picview.KeyDown += new KeyEventHandler(picViewKeyDown);
            picview.PreviewKeyDown += new PreviewKeyDownEventHandler(picView_PreviewKeyDown);

            combo = FileSelectComboBox;
            combo.Items.Clear();
            combo.DropDownStyle = ComboBoxStyle.DropDownList;
            combo.SelectedIndexChanged += new EventHandler(comboSelectedIndexChanged);

            textbox = TranslateTextBox;
            textbox.PreviewKeyDown += new PreviewKeyDownEventHandler(textboxPreviewKeyDown);
            textbox.KeyDown += new KeyEventHandler(textbox_KeyDown);
            textbox.TextChanged += new EventHandler(textbox_TextChanged);

            listviewapt = LabelListViewAPT;
            listviewapt.ListViewSelectedIndexChanged += new EventHandler(listViewSelectedIndexChanged);
            listviewapt.UserSetCategory += new ListViewAdpter.UserActionEventHandler(listViewUserAction);

            this.modebuttons = ModeButtons;
            this.modebuttons.IndexChanged += new EventHandler(modeButtons_IndexChanged);

            menuquicktext = contextMenuQuictText;
            foreach(GlobalVar.QuickTextItem item in GlobalVar.QuickTextItems){
                string menuItemStr = item.Text + "(&" + item.Key + ")";
                menuquicktext.Items.Add(menuItemStr).ToolTipText = item.Text;

            }
            menuquicktext.ItemClicked += new ToolStripItemClickedEventHandler(quickTextItemClicked);
            menuquicktext.Opened += new EventHandler(quickTextOpened);
            menuquicktext.Closed += new  ToolStripDropDownClosedEventHandler(quickTextClosed);

            groupbuttons = new GroupButtonAdaptor(toolStrip, wsp.GroupDefine);

            toolstrip = toolStrip;
            NewFile();
        }
Пример #3
0
        public WorkspaceControlAdpter(
            ToolStripButtonGroup ModeButtons,
            ToolStripComboBox FileSelectComboBox,
            TextBox TranslateTextBox,
            GroupBox TextBoxGroupBox,
            ListViewAdpter LabelListViewAPT,
            PicView picView,
            ContextMenuStrip contextMenuQuictText,
            ToolStrip toolStrip,
            Workspace workspace)
        {
            wsp = workspace;
            wsp.UserGroupDefineChanged += new EventHandler(userGroupChanged);

            LabelFileManager.FileListChanged      += new EventHandler(fileListChanged);
            LabelFileManager.LabelItemListChanged += new EventHandler(labelItemListChanged);
            LabelFileManager.LabelItemTextChanged += new EventHandler(labelItemTextChanged);
            LabelFileManager.GroupListChanged     += new EventHandler(labelItemTextChanged);
            textboxgroupbox = TextBoxGroupBox;

            picview       = picView;
            picview.Image = null;
            picview.Refresh();
            picview.LabelUserAction += new PicView.UserActionEventHandler(picView_UserClickAction);
            picview.MouseMove       += new MouseEventHandler(picView_MouseMove);
            picview.MouseClick      += new MouseEventHandler(picView_MosueClick);
            picview.KeyDown         += new KeyEventHandler(picViewKeyDown);
            picview.PreviewKeyDown  += new PreviewKeyDownEventHandler(picView_PreviewKeyDown);

            combo = FileSelectComboBox;
            combo.Items.Clear();
            combo.DropDownStyle         = ComboBoxStyle.DropDownList;
            combo.SelectedIndexChanged += new EventHandler(comboSelectedIndexChanged);

            textbox = TranslateTextBox;
            textbox.PreviewKeyDown += new PreviewKeyDownEventHandler(textboxPreviewKeyDown);
            textbox.KeyDown        += new KeyEventHandler(textbox_KeyDown);
            textbox.TextChanged    += new EventHandler(textbox_TextChanged);

            listviewapt = LabelListViewAPT;
            listviewapt.ListViewSelectedIndexChanged += new EventHandler(listViewSelectedIndexChanged);
            listviewapt.UserSetCategory += new ListViewAdpter.UserActionEventHandler(listViewUserAction);

            this.modebuttons = ModeButtons;
            this.modebuttons.IndexChanged += new EventHandler(modeButtons_IndexChanged);

            menuquicktext = contextMenuQuictText;
            foreach (GlobalVar.QuickTextItem item in GlobalVar.QuickTextItems)
            {
                string menuItemStr = item.Text + "(&" + item.Key + ")";
                menuquicktext.Items.Add(menuItemStr).ToolTipText = item.Text;
            }
            menuquicktext.ItemClicked += new ToolStripItemClickedEventHandler(quickTextItemClicked);
            menuquicktext.Opened      += new EventHandler(quickTextOpened);
            menuquicktext.Closed      += new  ToolStripDropDownClosedEventHandler(quickTextClosed);

            groupbuttons = new GroupButtonAdaptor(toolStrip, wsp.GroupDefine);

            toolstrip = toolStrip;
            NewFile();
        }