Beispiel #1
0
 public bool Drop(object sender, string filename, int X, int Y)
 {
     if ((filename.IndexOf(".wav", StringComparison.CurrentCultureIgnoreCase) == filename.Length - 4)
         )
     {
         if (local.current_mouse_page == null)
         {
             return(false);
         }
         Rectangle r = new Rectangle(
             local.partX - ((local.current_mouse_page.partsX / 10) - 1) / 2
             , local.partY - ((local.current_mouse_page.partsY / 10) - 1) / 2
             , local.current_mouse_page.partsX / 10
             , local.current_mouse_page.partsY / 10);
         ControlTracker tracker = local.current_mouse_page.MakeControl(typeof(WavePlayer)
                                                                       , typeof(IReflectorButton)
                                                                       , r);
         WavePlayer player = tracker.o as WavePlayer;
         player.SoundFile = filename;
         PSI_Button button = tracker.c as PSI_Button;
         button.Text = filename;
         //IReflectorCanvas c = sender as IReflectorCanvas;
         //c.MakeControl( typeof( Task ) );
         return(true);
     }
     return(false);
 }
Beispiel #2
0
        //private buttons_class buttons;
        //System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;


        /// <summary>
        /// Quick little summary of what I'm about to do, why I'm going to do it,
        /// and we'll see if it makes sense.
        ///
        /// What this will be:  A little 12to15-key keypad, with a clear and an enter
        /// hopefully tied-to some common control
        ///
        /// How to get this done.  The first thing that jumps-out at a person is,
        /// "hey, we could use buttons, and that would be AWESOME."
        ///
        /// The next thing, do a table layout of sorts.  Each button takes
        /// up the full thing.  Shouldn't be too bad.
        ///
        ///
        /// </summary>

        public PSI_Keypad()
        {
            bool enable_accumulator_display = true;

            // 4 is enough for normal keypad
            local_rows    = enable_accumulator_display?5:4;
            local_columns = 3;             //someday in the near future, we may change this.

            gs = new GlareSet("default");
            gs.attrib.Primary   = Color.Blue;          // Color.FromArgb( 64, Color.Blue );
            gs.attrib.Secondary = Color.SkyBlue;
            gs.attrib.TextColor = Color.White;

            InitializeComponent();

            if (enable_accumulator_display)
            {
                accumulator = new TextBox();
                Controls.Add(accumulator, 0, 0);
                SetColumnSpan(accumulator, 3);
                accumulator.Dock = DockStyle.Fill;
            }

            ColumnCount = local_columns;
            for (int i = 0; i < local_columns; i++)
            {
                ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F / (float)local_columns));
            }
            Location = new System.Drawing.Point(0, 0);
            Name     = "tableLayoutPanel1";
            RowCount = local_rows;
            if (enable_accumulator_display)
            {
                RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F / (float)(local_rows * 2)));
            }
            for (int i = enable_accumulator_display ? 1 : 0; i < local_rows; i++)
            {
                RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F / (float)local_rows));
            }
            Size     = this.Size;         //new System.Drawing.Size(529, 419);
            TabIndex = 0;

            //And now, for the buttons
            button_grid = new PSI_Button[local_columns, local_rows];

            for (int i = 0; i < local_columns; i++)
            {
                for (int j = enable_accumulator_display ? 1 : 0; j < local_rows; j++)
                {
                    button_grid[i, j] = new PSI_Button(this.Parent as Canvas);
                    Controls.Add(button_grid[i, j], i, j);
                    this.button_grid[i, j].Dock     = System.Windows.Forms.DockStyle.Fill;
                    this.button_grid[i, j].Name     = "button" + i.ToString() + j.ToString();
                    this.button_grid[i, j].TabIndex = 0;
                    this.button_grid[i, j].Text     = i.ToString() + "," + j.ToString();
                    //this.button_grid[i, j].UseVisualStyleBackColor = true;
                }
            }
        }
Beispiel #3
0
        bool IReflectorPluginDropFileTarget.Drop(object sender
                                                 , string filename, int x, int y)
        {
            if ((filename.IndexOf(".exe") == filename.Length - 4) ||
                (filename.IndexOf(".bat") == filename.Length - 4) ||
                (filename.IndexOf(".cmd") == filename.Length - 4)
                )
            {
                if (core_common.current_mouse_page == null)
                {
                    return(false);
                }

                Rectangle r = new Rectangle(
                    core_common.partX - ((core_common.current_mouse_page.partsX / 10) - 1) / 2
                    , core_common.partY - ((core_common.current_mouse_page.partsY / 10) - 1) / 2
                    , core_common.current_mouse_page.partsX / 10
                    , core_common.current_mouse_page.partsY / 10);
                ControlTracker tracker = core_common.current_mouse_page.MakeControl(typeof(Task)
                                                                                    , typeof(IReflectorButton)
                                                                                    , r);
                Task task       = tracker.o as Task;
                int  last_slash = filename.LastIndexOfAny(new char[] { '/', '\\' });
                if (last_slash == -1)
                {
                    last_slash = 0;
                }
                task.task.ProgramName = filename.Substring(last_slash + 1);
                task.task.WorkingPath = filename.Substring(0, last_slash);
                PSI_Button button = tracker.c as PSI_Button;
                button.Text = filename;
                //IReflectorCanvas c = sender as IReflectorCanvas;
                //c.MakeControl( typeof( Task ) );
                return(true);
            }
            return(false);
        }
Beispiel #4
0
 public RowSelectButton(PSI_Button pc)
 {
     MyPC = pc;
     StaticLocal.RowSelectors.Add(this);
     rowid = StaticLocal.RowSelectors.Count;
 }
Beispiel #5
0
 void IReflectorCreate.OnCreate(System.Windows.Forms.Control pc)
 {
     me      = pc as PSI_Button;
     pc.Text = fileset["Name"].ToString();
 }
Beispiel #6
0
 public BallSelectButton(PSI_Button pc)
 {
     MyPC = pc;
     StaticLocal.BallSelectors.Add(this);
     myid = StaticLocal.BallSelectors.Count;
 }