private void ClearContributionInformation()
 {
     nameLabel.Text       = "";
     groupColor.Enabled   = false;
     groupCol2.Enabled    = false;
     selectorDir.Enabled  = false;
     groupDesign.Enabled  = false;
     selectorColor.count  = 0;
     selectorCol2.count   = 0;
     selectorDesign.count = 0;
     numHeight.Enabled    = false;
     numHeight.Text       = "";
     costBox.cost         = 0;
     //and now clear the preview... somehow?
     current = dummy;
     redrawPreview();
 }
 public MultiSelectorController()
 {
     CategoryTreeWnd.ShowForm();
     CategoryTreeWnd.OnNodeSelected += new NodeSelectedEvent(OnNodeSelected);
     dummy = (GenericStructureContribution)PluginManager.theInstance.getContribution("null-contrib");
     //
     // Windows フォーム デザイナ サポートに必要です。
     //
     InitializeComponent();
     World.world.viewOptions.OnViewOptionChanged += new OptionChangedHandler(this.redrawPreview);
     OnNodeSelected(CategoryTreeWnd.getSelectedCategory(), 0);
     if (typeBox.Items.Count != 0)
     {
         typeBox_SelectedIndexChanged(this, null);
     }
     //SetAllCategories();
     bShowDetail = false;
     btnDetail_Click(this, null);
 }
        // callback from StructureCategoryWindow
        internal void OnNodeSelected(StructCategory cat, int option)
        {
            typeBox.Items.Clear();
            typeBox.Text = "";
            typeList.Items.Clear();
            typeMap.Clear();
            SetCategoryEntries(cat, typeMap);

            if (typeBox.Items.Count > 0)
            {
                typeBox.SelectedIndex  = 0;
                typeList.SelectedIndex = 0;
            }
            else
            {
                current = dummy;
            }

            UpdateContribution();
        }
        protected void SetAllCategories()
        {
            GenericStructureContribution[] arrCont = (GenericStructureContribution[])
                                                     PluginManager.theInstance.listContributions(typeof(GenericStructureContribution));
            int n = arrCont.Length;

            typeMap.Clear();
            for (int i = 0; i < n; i++)
            {
                GenericStructureContribution contrib = arrCont[i];
                string key = contrib.name;
                if (!typeMap.ContainsKey(key))
                {
                    typeBox.Items.Add(contrib);
                    typeList.Items.Add(contrib);
                    typeMap.Add(key, new Hashtable());
                }
                designMap = (ArrayList)typeMap[key];
                designMap.Add(contrib);
            }
            typeBox.SelectedIndex  = 0;
            typeList.SelectedIndex = 0;
        }
        protected void SetCategoryEntries(StructCategory cat, Hashtable worktable)
        {
            int n = cat.Entries.Count;

            for (int i = 0; i < n; i++)
            {
                GenericStructureContribution contrib
                    = (GenericStructureContribution)PluginManager.theInstance.getContribution((string)cat.Entries[i]);
                string key = contrib.name;
                if (!worktable.ContainsKey(key))
                {
                    typeBox.Items.Add(contrib);
                    typeList.Items.Add(contrib);
                    worktable.Add(key, new ArrayList());
                }
                designMap = (ArrayList)worktable[key];
                designMap.Add(contrib);
            }
            n = cat.Subcategories.Count;
            for (int i = 0; i < n; i++)
            {
                SetCategoryEntries(cat.Subcategories[i], typeMap);
            }
        }
 private void UpdateCol2()
 {
     current = (GenericStructureContribution)currentList[selectorCol2.current];
 }
 /// <summary>
 /// デザイナ サポートに必要なメソッドです。このメソッドの内容を
 /// コード エディタで変更しないでください。
 /// </summary>
 private void InitializeComponent()
 {
     this.nameLabel      = new System.Windows.Forms.Label();
     this.previewBox     = new System.Windows.Forms.PictureBox();
     this.selectorDesign = new freetrain.controls.IndexSelector();
     this.selectorDir    = new freetrain.controls.IndexSelector();
     this.labelDir       = new System.Windows.Forms.Label();
     this.selectorColor  = new freetrain.controls.IndexSelector();
     this.typeBox        = new System.Windows.Forms.ComboBox();
     this.numHeight      = new System.Windows.Forms.NumericUpDown();
     this.labelHeight    = new System.Windows.Forms.Label();
     this.btnDetail      = new System.Windows.Forms.Button();
     this.labelInfo      = new System.Windows.Forms.Label();
     this.costBox        = new freetrain.controls.CostBox();
     this.groupColor     = new System.Windows.Forms.GroupBox();
     this.cbRandColor    = new System.Windows.Forms.CheckBox();
     this.groupDesign    = new System.Windows.Forms.GroupBox();
     this.cbRandDesign   = new System.Windows.Forms.CheckBox();
     this.groupCol2      = new System.Windows.Forms.GroupBox();
     this.selectorCol2   = new freetrain.controls.IndexSelector();
     this.cbRandCol2     = new System.Windows.Forms.CheckBox();
     this.typeList       = new System.Windows.Forms.ListBox();
     ((System.ComponentModel.ISupportInitialize)(this.previewBox)).BeginInit();
     ((System.ComponentModel.ISupportInitialize)(this.numHeight)).BeginInit();
     this.groupColor.SuspendLayout();
     this.groupDesign.SuspendLayout();
     this.groupCol2.SuspendLayout();
     this.SuspendLayout();
     //
     // nameLabel
     //
     this.nameLabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
                                                                   | System.Windows.Forms.AnchorStyles.Right)));
     this.nameLabel.BackColor   = System.Drawing.Color.White;
     this.nameLabel.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
     this.nameLabel.Location    = new System.Drawing.Point(4, 38);
     this.nameLabel.Name        = "nameLabel";
     this.nameLabel.Size        = new System.Drawing.Size(152, 17);
     this.nameLabel.TabIndex    = 2;
     this.nameLabel.TextAlign   = System.Drawing.ContentAlignment.BottomCenter;
     //
     // previewBox
     //
     this.previewBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
                                                                    | System.Windows.Forms.AnchorStyles.Right)));
     this.previewBox.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
     this.previewBox.Location    = new System.Drawing.Point(4, 114);
     this.previewBox.Name        = "previewBox";
     this.previewBox.Size        = new System.Drawing.Size(172, 268);
     this.previewBox.TabIndex    = 3;
     this.previewBox.TabStop     = false;
     this.previewBox.Click      += new System.EventHandler(this.previewBox_Click);
     //
     // selectorDesign
     //
     this.selectorDesign.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
                                                                        | System.Windows.Forms.AnchorStyles.Right)));
     this.selectorDesign.count         = 10;
     this.selectorDesign.current       = 0;
     this.selectorDesign.dataSource    = null;
     this.selectorDesign.Location      = new System.Drawing.Point(24, 19);
     this.selectorDesign.Name          = "selectorDesign";
     this.selectorDesign.Size          = new System.Drawing.Size(112, 16);
     this.selectorDesign.TabIndex      = 1;
     this.selectorDesign.indexChanged += new System.EventHandler(this.selectorDesign_indexChanged);
     //
     // selectorDir
     //
     this.selectorDir.Anchor        = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
     this.selectorDir.count         = 10;
     this.selectorDir.current       = 0;
     this.selectorDir.dataSource    = null;
     this.selectorDir.Location      = new System.Drawing.Point(251, 192);
     this.selectorDir.Name          = "selectorDir";
     this.selectorDir.Size          = new System.Drawing.Size(88, 17);
     this.selectorDir.TabIndex      = 5;
     this.selectorDir.indexChanged += new System.EventHandler(this.selectorDir_indexChanged);
     //
     // labelDir
     //
     this.labelDir.Anchor   = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
     this.labelDir.Location = new System.Drawing.Point(190, 192);
     this.labelDir.Name     = "labelDir";
     this.labelDir.Size     = new System.Drawing.Size(59, 17);
     this.labelDir.TabIndex = 4;
     this.labelDir.Text     = "Direction";
     //! this.labelDir.Text = "方向:";
     this.labelDir.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
     //
     // selectorColor
     //
     this.selectorColor.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
                                                                       | System.Windows.Forms.AnchorStyles.Right)));
     this.selectorColor.count         = 10;
     this.selectorColor.current       = 0;
     this.selectorColor.dataSource    = null;
     this.selectorColor.Location      = new System.Drawing.Point(24, 17);
     this.selectorColor.Name          = "selectorColor";
     this.selectorColor.Size          = new System.Drawing.Size(112, 16);
     this.selectorColor.TabIndex      = 1;
     this.selectorColor.indexChanged += new System.EventHandler(this.selectorColor_indexChanged);
     //
     // typeBox
     //
     this.typeBox.Anchor                = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
     this.typeBox.Location              = new System.Drawing.Point(190, 4);
     this.typeBox.Name                  = "typeBox";
     this.typeBox.Size                  = new System.Drawing.Size(160, 21);
     this.typeBox.TabIndex              = 0;
     this.typeBox.SelectedIndexChanged += new System.EventHandler(this.typeBox_SelectedIndexChanged);
     //
     // numHeight
     //
     this.numHeight.Anchor        = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
     this.numHeight.Location      = new System.Drawing.Point(251, 214);
     this.numHeight.Name          = "numHeight";
     this.numHeight.Size          = new System.Drawing.Size(88, 20);
     this.numHeight.TabIndex      = 7;
     this.numHeight.TextAlign     = System.Windows.Forms.HorizontalAlignment.Right;
     this.numHeight.ValueChanged += new System.EventHandler(this.numHeight_ValueChanged);
     //
     // labelHeight
     //
     this.labelHeight.Anchor    = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
     this.labelHeight.Location  = new System.Drawing.Point(193, 214);
     this.labelHeight.Name      = "labelHeight";
     this.labelHeight.Size      = new System.Drawing.Size(58, 18);
     this.labelHeight.TabIndex  = 6;
     this.labelHeight.Text      = "Height";
     this.labelHeight.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
     //! this.labelHeight.Text = "高さ:";
     //
     // btnDetail
     //
     this.btnDetail.Anchor   = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
     this.btnDetail.Font     = new System.Drawing.Font("Wingdings 3", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(2)));
     this.btnDetail.Location = new System.Drawing.Point(330, 250);
     this.btnDetail.Name     = "btnDetail";
     this.btnDetail.Size     = new System.Drawing.Size(20, 21);
     this.btnDetail.TabIndex = 9;
     this.btnDetail.Text     = "q";
     this.btnDetail.Visible  = false;
     this.btnDetail.Click   += new System.EventHandler(this.btnDetail_Click);
     //
     // labelInfo
     //
     this.labelInfo.Anchor      = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
     this.labelInfo.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
     this.labelInfo.Location    = new System.Drawing.Point(190, 278);
     this.labelInfo.Name        = "labelInfo";
     this.labelInfo.Size        = new System.Drawing.Size(156, 104);
     this.labelInfo.TabIndex    = 9;
     this.labelInfo.UseMnemonic = false;
     //
     // costBox
     //
     this.costBox.Anchor   = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
     this.costBox.cost     = 0;
     this.costBox.label    = "Cost:";
     this.costBox.Location = new System.Drawing.Point(190, 235);
     //! this.costBox.label = "費用:";
     this.costBox.Name     = "costBox";
     this.costBox.Size     = new System.Drawing.Size(136, 40);
     this.costBox.TabIndex = 8;
     //
     // groupColor
     //
     this.groupColor.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
     this.groupColor.Controls.Add(this.selectorColor);
     this.groupColor.Controls.Add(this.cbRandColor);
     this.groupColor.Location = new System.Drawing.Point(190, 103);
     this.groupColor.Name     = "groupColor";
     this.groupColor.Size     = new System.Drawing.Size(160, 37);
     this.groupColor.TabIndex = 2;
     this.groupColor.TabStop  = false;
     this.groupColor.Text     = "Color 1";
     //! this.groupColor.Text = "色:";
     //
     // cbRandColor
     //
     this.cbRandColor.Anchor     = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
     this.cbRandColor.BackColor  = System.Drawing.SystemColors.Control;
     this.cbRandColor.CheckAlign = System.Drawing.ContentAlignment.MiddleRight;
     this.cbRandColor.Location   = new System.Drawing.Point(73, 0);
     this.cbRandColor.Name       = "cbRandColor";
     this.cbRandColor.Size       = new System.Drawing.Size(71, 17);
     this.cbRandColor.TabIndex   = 0;
     this.cbRandColor.Text       = "Random";
     this.cbRandColor.TextAlign  = System.Drawing.ContentAlignment.MiddleRight;
     this.cbRandColor.UseVisualStyleBackColor = false;
     //! this.cbRandColor.Text = "ランダム";
     //
     // groupDesign
     //
     this.groupDesign.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
     this.groupDesign.Controls.Add(this.cbRandDesign);
     this.groupDesign.Controls.Add(this.selectorDesign);
     this.groupDesign.Controls.Add(this.nameLabel);
     this.groupDesign.Location = new System.Drawing.Point(190, 37);
     this.groupDesign.Name     = "groupDesign";
     this.groupDesign.Size     = new System.Drawing.Size(160, 62);
     this.groupDesign.TabIndex = 1;
     this.groupDesign.TabStop  = false;
     this.groupDesign.Text     = "Design";
     //! this.groupDesign.Text = "デザイン:";
     //
     // cbRandDesign
     //
     this.cbRandDesign.Anchor     = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
     this.cbRandDesign.BackColor  = System.Drawing.SystemColors.Control;
     this.cbRandDesign.CheckAlign = System.Drawing.ContentAlignment.MiddleRight;
     this.cbRandDesign.Location   = new System.Drawing.Point(73, -1);
     this.cbRandDesign.Name       = "cbRandDesign";
     this.cbRandDesign.Size       = new System.Drawing.Size(71, 17);
     this.cbRandDesign.TabIndex   = 0;
     this.cbRandDesign.Text       = "Random";
     //! this.cbRandDesign.Text = "ランダム";
     this.cbRandDesign.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
     this.cbRandDesign.UseVisualStyleBackColor = false;
     //
     // groupCol2
     //
     this.groupCol2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
     this.groupCol2.Controls.Add(this.selectorCol2);
     this.groupCol2.Controls.Add(this.cbRandCol2);
     this.groupCol2.Location = new System.Drawing.Point(190, 142);
     this.groupCol2.Name     = "groupCol2";
     this.groupCol2.Size     = new System.Drawing.Size(160, 37);
     this.groupCol2.TabIndex = 3;
     this.groupCol2.TabStop  = false;
     this.groupCol2.Text     = "Color 2";
     //! this.groupCol2.Text = "色2:";
     //
     // selectorCol2
     //
     this.selectorCol2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
                                                                      | System.Windows.Forms.AnchorStyles.Right)));
     this.selectorCol2.count         = 10;
     this.selectorCol2.current       = 0;
     this.selectorCol2.dataSource    = null;
     this.selectorCol2.Location      = new System.Drawing.Point(24, 17);
     this.selectorCol2.Name          = "selectorCol2";
     this.selectorCol2.Size          = new System.Drawing.Size(112, 16);
     this.selectorCol2.TabIndex      = 1;
     this.selectorCol2.indexChanged += new System.EventHandler(this.selectorCol2_indexChanged);
     //
     // cbRandCol2
     //
     this.cbRandCol2.Anchor     = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
     this.cbRandCol2.BackColor  = System.Drawing.SystemColors.Control;
     this.cbRandCol2.CheckAlign = System.Drawing.ContentAlignment.MiddleRight;
     this.cbRandCol2.Location   = new System.Drawing.Point(73, 0);
     this.cbRandCol2.Name       = "cbRandCol2";
     this.cbRandCol2.Size       = new System.Drawing.Size(71, 17);
     this.cbRandCol2.TabIndex   = 0;
     this.cbRandCol2.Text       = "Random";
     //! this.cbRandCol2.Text = "ランダム";
     this.cbRandCol2.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
     this.cbRandCol2.UseVisualStyleBackColor = false;
     //
     // typeList
     //
     this.typeList.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                                                                  | System.Windows.Forms.AnchorStyles.Right)));
     this.typeList.Location              = new System.Drawing.Point(4, 4);
     this.typeList.Name                  = "typeList";
     this.typeList.Size                  = new System.Drawing.Size(172, 95);
     this.typeList.TabIndex              = 10;
     this.typeList.SelectedIndexChanged += new System.EventHandler(this.typeList_SelectedIndexChanged);
     //
     // MultiSelectorController
     //
     this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
     this.ClientSize        = new System.Drawing.Size(354, 386);
     this.Controls.Add(this.costBox);
     this.Controls.Add(this.numHeight);
     this.Controls.Add(this.groupDesign);
     this.Controls.Add(this.selectorDir);
     this.Controls.Add(this.labelDir);
     this.Controls.Add(this.btnDetail);
     this.Controls.Add(this.labelInfo);
     this.Controls.Add(this.groupColor);
     this.Controls.Add(this.groupCol2);
     this.Controls.Add(this.typeList);
     this.Controls.Add(this.typeBox);
     this.Controls.Add(this.previewBox);
     this.Controls.Add(this.labelHeight);
     this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.SizableToolWindow;
     this.Name            = "MultiSelectorController";
     this.Resize         += new System.EventHandler(this.updateAfterResize);
     ((System.ComponentModel.ISupportInitialize)(this.previewBox)).EndInit();
     ((System.ComponentModel.ISupportInitialize)(this.numHeight)).EndInit();
     this.groupColor.ResumeLayout(false);
     this.groupDesign.ResumeLayout(false);
     this.groupCol2.ResumeLayout(false);
     this.ResumeLayout(false);
 }